Skip to content

Commit 74784ee

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says: ==================== 100GbE Intel Wired LAN Driver Updates 2021-02-08 This series contains updates to the ice driver and documentation. Brett adds a log message when a trusted VF goes in and out of promiscuous for consistency with i40e driver. Dave implements a new LLDP command that allows adding VSI destinations to existing filters and adds support for netdev bonding events, current support is software based. Michal refactors code to move from VSI stored xsk_buff_pools to netdev-provided ones. Kiran implements the creation scheduler aggregator nodes and distributing VSIs within the nodes. Ben modifies rate limit calculations to use clock frequency from the hardware instead of using a hardcoded one. Jesse adds support for user to control writeback frequency. Chinh refactors DCB variables out of the ice_port_info struct. Bruce removes some unnecessary casting. Mitch fixes an error message that was reported as if_up instead of if_down. Tony adjusts fallback allocation for MSI-X to use all given vectors instead of using only the minimum configuration and updates documentation for the ice driver. ==================== Reviewed-by: Alexander Duyck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2 parents 3e566da + a851dfa commit 74784ee

25 files changed

+3234
-402
lines changed

Documentation/networking/device_drivers/ethernet/intel/ice.rst

Lines changed: 1006 additions & 21 deletions
Large diffs are not rendered by default.

drivers/net/ethernet/intel/ice/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ ice-y := ice_main.o \
2424
ice_flow.o \
2525
ice_devlink.o \
2626
ice_fw_update.o \
27+
ice_lag.o \
2728
ice_ethtool.o
2829
ice-$(CONFIG_PCI_IOV) += ice_virtchnl_pf.o ice_sriov.o
2930
ice-$(CONFIG_DCB) += ice_dcb.o ice_dcb_nl.o ice_dcb_lib.o

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include <net/devlink.h>
4040
#include <net/ipv6.h>
4141
#include <net/xdp_sock.h>
42+
#include <net/xdp_sock_drv.h>
4243
#include <net/geneve.h>
4344
#include <net/gre.h>
4445
#include <net/udp_tunnel.h>
@@ -55,6 +56,7 @@
5556
#include "ice_fdir.h"
5657
#include "ice_xsk.h"
5758
#include "ice_arfs.h"
59+
#include "ice_lag.h"
5860

5961
#define ICE_BAR0 0
6062
#define ICE_REQ_DESC_MULTIPLE 32
@@ -326,9 +328,11 @@ struct ice_vsi {
326328
struct ice_ring **xdp_rings; /* XDP ring array */
327329
u16 num_xdp_txq; /* Used XDP queues */
328330
u8 xdp_mapping_mode; /* ICE_MAP_MODE_[CONTIG|SCATTER] */
329-
struct xsk_buff_pool **xsk_pools;
330-
u16 num_xsk_pools_used;
331-
u16 num_xsk_pools;
331+
332+
/* setup back reference, to which aggregator node this VSI
333+
* corresponds to
334+
*/
335+
struct ice_agg_node *agg_node;
332336
} ____cacheline_internodealigned_in_smp;
333337

334338
/* struct that defines an interrupt vector */
@@ -377,6 +381,13 @@ enum ice_pf_flags {
377381
ICE_PF_FLAGS_NBITS /* must be last */
378382
};
379383

384+
struct ice_agg_node {
385+
u32 agg_id;
386+
#define ICE_MAX_VSIS_IN_AGG_NODE 64
387+
u32 num_vsis;
388+
u8 valid;
389+
};
390+
380391
struct ice_pf {
381392
struct pci_dev *pdev;
382393

@@ -455,6 +466,15 @@ struct ice_pf {
455466
__le64 nvm_phy_type_lo; /* NVM PHY type low */
456467
__le64 nvm_phy_type_hi; /* NVM PHY type high */
457468
struct ice_link_default_override_tlv link_dflt_override;
469+
struct ice_lag *lag; /* Link Aggregation information */
470+
471+
#define ICE_INVALID_AGG_NODE_ID 0
472+
#define ICE_PF_AGG_NODE_ID_START 1
473+
#define ICE_MAX_PF_AGG_NODES 32
474+
struct ice_agg_node pf_agg_node[ICE_MAX_PF_AGG_NODES];
475+
#define ICE_VF_AGG_NODE_ID_START 65
476+
#define ICE_MAX_VF_AGG_NODES 32
477+
struct ice_agg_node vf_agg_node[ICE_MAX_VF_AGG_NODES];
458478
};
459479

460480
struct ice_netdev_priv {
@@ -517,17 +537,15 @@ static inline void ice_set_ring_xdp(struct ice_ring *ring)
517537
*/
518538
static inline struct xsk_buff_pool *ice_xsk_pool(struct ice_ring *ring)
519539
{
520-
struct xsk_buff_pool **pools = ring->vsi->xsk_pools;
521540
u16 qid = ring->q_index;
522541

523542
if (ice_ring_is_xdp(ring))
524543
qid -= ring->vsi->num_xdp_txq;
525544

526-
if (qid >= ring->vsi->num_xsk_pools || !pools || !pools[qid] ||
527-
!ice_is_xdp_ena_vsi(ring->vsi))
545+
if (!ice_is_xdp_ena_vsi(ring->vsi))
528546
return NULL;
529547

530-
return pools[qid];
548+
return xsk_get_pool_from_qid(ring->vsi->netdev, qid);
531549
}
532550

533551
/**
@@ -557,11 +575,31 @@ static inline struct ice_vsi *ice_get_ctrl_vsi(struct ice_pf *pf)
557575
return pf->vsi[pf->ctrl_vsi_idx];
558576
}
559577

578+
/**
579+
* ice_set_sriov_cap - enable SRIOV in PF flags
580+
* @pf: PF struct
581+
*/
582+
static inline void ice_set_sriov_cap(struct ice_pf *pf)
583+
{
584+
if (pf->hw.func_caps.common_cap.sr_iov_1_1)
585+
set_bit(ICE_FLAG_SRIOV_CAPABLE, pf->flags);
586+
}
587+
588+
/**
589+
* ice_clear_sriov_cap - disable SRIOV in PF flags
590+
* @pf: PF struct
591+
*/
592+
static inline void ice_clear_sriov_cap(struct ice_pf *pf)
593+
{
594+
clear_bit(ICE_FLAG_SRIOV_CAPABLE, pf->flags);
595+
}
596+
560597
#define ICE_FD_STAT_CTR_BLOCK_COUNT 256
561598
#define ICE_FD_STAT_PF_IDX(base_idx) \
562599
((base_idx) * ICE_FD_STAT_CTR_BLOCK_COUNT)
563600
#define ICE_FD_SB_STAT_IDX(base_idx) ICE_FD_STAT_PF_IDX(base_idx)
564601

602+
bool netif_is_ice(struct net_device *dev);
565603
int ice_vsi_setup_tx_rings(struct ice_vsi *vsi);
566604
int ice_vsi_setup_rx_rings(struct ice_vsi *vsi);
567605
int ice_vsi_open_ctrl(struct ice_vsi *vsi);

drivers/net/ethernet/intel/ice/ice_adminq_cmd.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,18 @@ struct ice_aqc_sched_elem_cmd {
695695
__le32 addr_low;
696696
};
697697

698+
struct ice_aqc_txsched_move_grp_info_hdr {
699+
__le32 src_parent_teid;
700+
__le32 dest_parent_teid;
701+
__le16 num_elems;
702+
__le16 reserved;
703+
};
704+
705+
struct ice_aqc_move_elem {
706+
struct ice_aqc_txsched_move_grp_info_hdr hdr;
707+
__le32 teid[];
708+
};
709+
698710
struct ice_aqc_elem_info_bw {
699711
__le16 bw_profile_idx;
700712
__le16 bw_alloc;
@@ -1528,6 +1540,16 @@ struct ice_aqc_lldp_stop_start_specific_agent {
15281540
u8 reserved[15];
15291541
};
15301542

1543+
/* LLDP Filter Control (direct 0x0A0A) */
1544+
struct ice_aqc_lldp_filter_ctrl {
1545+
u8 cmd_flags;
1546+
#define ICE_AQC_LLDP_FILTER_ACTION_ADD 0x0
1547+
#define ICE_AQC_LLDP_FILTER_ACTION_DELETE 0x1
1548+
u8 reserved1;
1549+
__le16 vsi_num;
1550+
u8 reserved2[12];
1551+
};
1552+
15311553
/* Get/Set RSS key (indirect 0x0B04/0x0B02) */
15321554
struct ice_aqc_get_set_rss_key {
15331555
#define ICE_AQC_GSET_RSS_KEY_VSI_VALID BIT(15)
@@ -1851,6 +1873,7 @@ struct ice_aq_desc {
18511873
struct ice_aqc_lldp_start lldp_start;
18521874
struct ice_aqc_lldp_set_local_mib lldp_set_mib;
18531875
struct ice_aqc_lldp_stop_start_specific_agent lldp_agent_ctrl;
1876+
struct ice_aqc_lldp_filter_ctrl lldp_filter_ctrl;
18541877
struct ice_aqc_get_set_rss_lut get_set_rss_lut;
18551878
struct ice_aqc_get_set_rss_key get_set_rss_key;
18561879
struct ice_aqc_add_txqs add_txqs;
@@ -1950,6 +1973,7 @@ enum ice_adminq_opc {
19501973
ice_aqc_opc_add_sched_elems = 0x0401,
19511974
ice_aqc_opc_cfg_sched_elems = 0x0403,
19521975
ice_aqc_opc_get_sched_elems = 0x0404,
1976+
ice_aqc_opc_move_sched_elems = 0x0408,
19531977
ice_aqc_opc_suspend_sched_elems = 0x0409,
19541978
ice_aqc_opc_resume_sched_elems = 0x040A,
19551979
ice_aqc_opc_query_port_ets = 0x040E,
@@ -1991,6 +2015,7 @@ enum ice_adminq_opc {
19912015
ice_aqc_opc_get_cee_dcb_cfg = 0x0A07,
19922016
ice_aqc_opc_lldp_set_local_mib = 0x0A08,
19932017
ice_aqc_opc_lldp_stop_start_specific_agent = 0x0A09,
2018+
ice_aqc_opc_lldp_filter_ctrl = 0x0A0A,
19942019

19952020
/* RSS commands */
19962021
ice_aqc_opc_set_rss_key = 0x0B02,

drivers/net/ethernet/intel/ice/ice_common.c

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ ice_aq_manage_mac_read(struct ice_hw *hw, void *buf, u16 buf_size,
110110
if (status)
111111
return status;
112112

113-
resp = (struct ice_aqc_manage_mac_read_resp *)buf;
113+
resp = buf;
114114
flags = le16_to_cpu(cmd->flags) & ICE_AQC_MAN_MAC_READ_M;
115115

116116
if (!(flags & ICE_AQC_MAN_MAC_LAN_ADDR_VALID)) {
@@ -907,6 +907,7 @@ enum ice_status ice_init_hw(struct ice_hw *hw)
907907
ice_debug(hw, ICE_DBG_SCHED, "Failed to get scheduler allocated resources\n");
908908
goto err_unroll_alloc;
909909
}
910+
ice_sched_get_psm_clk_freq(hw);
910911

911912
/* Initialize port_info struct with scheduler data */
912913
status = ice_sched_init_port(hw->port_info);
@@ -1979,7 +1980,7 @@ ice_parse_func_caps(struct ice_hw *hw, struct ice_hw_func_caps *func_p,
19791980
struct ice_aqc_list_caps_elem *cap_resp;
19801981
u32 i;
19811982

1982-
cap_resp = (struct ice_aqc_list_caps_elem *)buf;
1983+
cap_resp = buf;
19831984

19841985
memset(func_p, 0, sizeof(*func_p));
19851986

@@ -2109,7 +2110,7 @@ ice_parse_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p,
21092110
struct ice_aqc_list_caps_elem *cap_resp;
21102111
u32 i;
21112112

2112-
cap_resp = (struct ice_aqc_list_caps_elem *)buf;
2113+
cap_resp = buf;
21132114

21142115
memset(dev_p, 0, sizeof(*dev_p));
21152116

@@ -4078,6 +4079,7 @@ static enum ice_status ice_replay_pre_init(struct ice_hw *hw)
40784079
for (i = 0; i < ICE_SW_LKUP_LAST; i++)
40794080
list_replace_init(&sw->recp_list[i].filt_rules,
40804081
&sw->recp_list[i].filt_replay_rules);
4082+
ice_sched_replay_agg_vsi_preinit(hw);
40814083

40824084
return 0;
40834085
}
@@ -4109,6 +4111,8 @@ enum ice_status ice_replay_vsi(struct ice_hw *hw, u16 vsi_handle)
41094111
return status;
41104112
/* Replay per VSI all filters */
41114113
status = ice_replay_vsi_all_fltr(hw, vsi_handle);
4114+
if (!status)
4115+
status = ice_replay_vsi_agg(hw, vsi_handle);
41124116
return status;
41134117
}
41144118

@@ -4122,6 +4126,7 @@ void ice_replay_post(struct ice_hw *hw)
41224126
{
41234127
/* Delete old entries from replay filter list head */
41244128
ice_rm_all_sw_replay_rule_info(hw);
4129+
ice_sched_replay_agg(hw);
41254130
}
41264131

41274132
/**
@@ -4366,3 +4371,50 @@ ice_aq_set_lldp_mib(struct ice_hw *hw, u8 mib_type, void *buf, u16 buf_size,
43664371

43674372
return ice_aq_send_cmd(hw, &desc, buf, buf_size, cd);
43684373
}
4374+
4375+
/**
4376+
* ice_fw_supports_lldp_fltr - check NVM version supports lldp_fltr_ctrl
4377+
* @hw: pointer to HW struct
4378+
*/
4379+
bool ice_fw_supports_lldp_fltr_ctrl(struct ice_hw *hw)
4380+
{
4381+
if (hw->mac_type != ICE_MAC_E810)
4382+
return false;
4383+
4384+
if (hw->api_maj_ver == ICE_FW_API_LLDP_FLTR_MAJ) {
4385+
if (hw->api_min_ver > ICE_FW_API_LLDP_FLTR_MIN)
4386+
return true;
4387+
if (hw->api_min_ver == ICE_FW_API_LLDP_FLTR_MIN &&
4388+
hw->api_patch >= ICE_FW_API_LLDP_FLTR_PATCH)
4389+
return true;
4390+
} else if (hw->api_maj_ver > ICE_FW_API_LLDP_FLTR_MAJ) {
4391+
return true;
4392+
}
4393+
return false;
4394+
}
4395+
4396+
/**
4397+
* ice_lldp_fltr_add_remove - add or remove a LLDP Rx switch filter
4398+
* @hw: pointer to HW struct
4399+
* @vsi_num: absolute HW index for VSI
4400+
* @add: boolean for if adding or removing a filter
4401+
*/
4402+
enum ice_status
4403+
ice_lldp_fltr_add_remove(struct ice_hw *hw, u16 vsi_num, bool add)
4404+
{
4405+
struct ice_aqc_lldp_filter_ctrl *cmd;
4406+
struct ice_aq_desc desc;
4407+
4408+
cmd = &desc.params.lldp_filter_ctrl;
4409+
4410+
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_lldp_filter_ctrl);
4411+
4412+
if (add)
4413+
cmd->cmd_flags = ICE_AQC_LLDP_FILTER_ACTION_ADD;
4414+
else
4415+
cmd->cmd_flags = ICE_AQC_LLDP_FILTER_ACTION_DELETE;
4416+
4417+
cmd->vsi_num = cpu_to_le16(vsi_num);
4418+
4419+
return ice_aq_send_cmd(hw, &desc, NULL, 0, NULL);
4420+
}

drivers/net/ethernet/intel/ice/ice_common.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,7 @@ ice_sched_query_elem(struct ice_hw *hw, u32 node_teid,
175175
enum ice_status
176176
ice_aq_set_lldp_mib(struct ice_hw *hw, u8 mib_type, void *buf, u16 buf_size,
177177
struct ice_sq_cd *cd);
178+
bool ice_fw_supports_lldp_fltr_ctrl(struct ice_hw *hw);
179+
enum ice_status
180+
ice_lldp_fltr_add_remove(struct ice_hw *hw, u16 vsi_num, bool add);
178181
#endif /* _ICE_COMMON_H_ */

drivers/net/ethernet/intel/ice/ice_controlq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
838838
*/
839839
static void ice_debug_cq(struct ice_hw *hw, void *desc, void *buf, u16 buf_len)
840840
{
841-
struct ice_aq_desc *cq_desc = (struct ice_aq_desc *)desc;
841+
struct ice_aq_desc *cq_desc = desc;
842842
u16 len;
843843

844844
if (!IS_ENABLED(CONFIG_DYNAMIC_DEBUG) &&
@@ -868,7 +868,7 @@ static void ice_debug_cq(struct ice_hw *hw, void *desc, void *buf, u16 buf_len)
868868
if (buf_len < len)
869869
len = buf_len;
870870

871-
ice_debug_array(hw, ICE_DBG_AQ_DESC_BUF, 16, 1, (u8 *)buf, len);
871+
ice_debug_array(hw, ICE_DBG_AQ_DESC_BUF, 16, 1, buf, len);
872872
}
873873
}
874874

0 commit comments

Comments
 (0)