Skip to content

Commit f5fbd32

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/nex
t-queue Tony Nguyen says: ==================== ice: Implement support for SRIOV + LAG Dave Ertman says: Implement support for SRIOV VF's on interfaces that are in an aggregate interface. The first interface added into the aggregate will be flagged as the primary interface, and this primary interface will be responsible for managing the VF's resources. VF's created on the primary are the only VFs that will be supported on the aggregate. Only Active-Backup mode will be supported and only aggregates whose primary interface is in switchdev mode will be supported. The ice-lag DDP must be loaded to support this feature. Additional restrictions on what interfaces can be added to the aggregate and still support SRIOV VFs are: - interfaces have to all be on the same physical NIC - all interfaces have to have the same QoS settings - interfaces have to have the FW LLDP agent disabled - only the primary interface is to be put into switchdev mode - no more than two interfaces in the aggregate --- v2: - Move NULL check for q_ctx in ice_lag_qbuf_recfg() earlier (patch 6) v1: https://lore.kernel.org/netdev/20230726182141.3797928-1-anthony.l.nguyen@intel.com/ ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 7f6c403 + 3579aa8 commit f5fbd32

File tree

16 files changed

+2182
-189
lines changed

16 files changed

+2182
-189
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ enum ice_feature {
200200
ICE_F_PTP_EXTTS,
201201
ICE_F_SMA_CTRL,
202202
ICE_F_GNSS,
203+
ICE_F_ROCE_LAG,
204+
ICE_F_SRIOV_LAG,
203205
ICE_F_MAX
204206
};
205207

@@ -569,6 +571,7 @@ struct ice_pf {
569571
struct mutex sw_mutex; /* lock for protecting VSI alloc flow */
570572
struct mutex tc_mutex; /* lock to protect TC changes */
571573
struct mutex adev_mutex; /* lock to protect aux device access */
574+
struct mutex lag_mutex; /* protect ice_lag struct in PF */
572575
u32 msg_enable;
573576
struct ice_ptp ptp;
574577
struct gnss_serial *gnss_serial;
@@ -639,6 +642,8 @@ struct ice_pf {
639642
struct ice_agg_node vf_agg_node[ICE_MAX_VF_AGG_NODES];
640643
};
641644

645+
extern struct workqueue_struct *ice_lag_wq;
646+
642647
struct ice_netdev_priv {
643648
struct ice_vsi *vsi;
644649
struct ice_repr *repr;

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

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ struct ice_aqc_list_caps_elem {
120120
#define ICE_AQC_CAPS_PCIE_RESET_AVOIDANCE 0x0076
121121
#define ICE_AQC_CAPS_POST_UPDATE_RESET_RESTRICT 0x0077
122122
#define ICE_AQC_CAPS_NVM_MGMT 0x0080
123+
#define ICE_AQC_CAPS_FW_LAG_SUPPORT 0x0092
124+
#define ICE_AQC_BIT_ROCEV2_LAG 0x01
125+
#define ICE_AQC_BIT_SRIOV_LAG 0x02
123126

124127
u8 major_ver;
125128
u8 minor_ver;
@@ -232,6 +235,8 @@ struct ice_aqc_set_port_params {
232235
#define ICE_AQC_SET_P_PARAMS_DOUBLE_VLAN_ENA BIT(2)
233236
__le16 bad_frame_vsi;
234237
__le16 swid;
238+
#define ICE_AQC_PORT_SWID_VALID BIT(15)
239+
#define ICE_AQC_PORT_SWID_M 0xFF
235240
u8 reserved[10];
236241
};
237242

@@ -241,10 +246,12 @@ struct ice_aqc_set_port_params {
241246
* Allocate Resources command (indirect 0x0208)
242247
* Free Resources command (indirect 0x0209)
243248
* Get Allocated Resource Descriptors Command (indirect 0x020A)
249+
* Share Resource command (indirect 0x020B)
244250
*/
245251
#define ICE_AQC_RES_TYPE_VSI_LIST_REP 0x03
246252
#define ICE_AQC_RES_TYPE_VSI_LIST_PRUNE 0x04
247253
#define ICE_AQC_RES_TYPE_RECIPE 0x05
254+
#define ICE_AQC_RES_TYPE_SWID 0x07
248255
#define ICE_AQC_RES_TYPE_FDIR_COUNTER_BLOCK 0x21
249256
#define ICE_AQC_RES_TYPE_FDIR_GUARANTEED_ENTRIES 0x22
250257
#define ICE_AQC_RES_TYPE_FDIR_SHARED_ENTRIES 0x23
@@ -264,6 +271,7 @@ struct ice_aqc_set_port_params {
264271

265272
/* Allocate Resources command (indirect 0x0208)
266273
* Free Resources command (indirect 0x0209)
274+
* Share Resource command (indirect 0x020B)
267275
*/
268276
struct ice_aqc_alloc_free_res_cmd {
269277
__le16 num_entries; /* Number of Resource entries */
@@ -818,7 +826,11 @@ struct ice_aqc_txsched_move_grp_info_hdr {
818826
__le32 src_parent_teid;
819827
__le32 dest_parent_teid;
820828
__le16 num_elems;
821-
__le16 reserved;
829+
u8 mode;
830+
#define ICE_AQC_MOVE_ELEM_MODE_SAME_PF 0x0
831+
#define ICE_AQC_MOVE_ELEM_MODE_GIVE_OWN 0x1
832+
#define ICE_AQC_MOVE_ELEM_MODE_KEEP_OWN 0x2
833+
u8 reserved;
822834
};
823835

824836
struct ice_aqc_move_elem {
@@ -1923,6 +1935,42 @@ struct ice_aqc_dis_txq_item {
19231935
__le16 q_id[];
19241936
} __packed;
19251937

1938+
/* Move/Reconfigure Tx queue (indirect 0x0C32) */
1939+
struct ice_aqc_cfg_txqs {
1940+
u8 cmd_type;
1941+
#define ICE_AQC_Q_CFG_MOVE_NODE 0x1
1942+
#define ICE_AQC_Q_CFG_TC_CHNG 0x2
1943+
#define ICE_AQC_Q_CFG_MOVE_TC_CHNG 0x3
1944+
#define ICE_AQC_Q_CFG_SUBSEQ_CALL BIT(2)
1945+
#define ICE_AQC_Q_CFG_FLUSH BIT(3)
1946+
u8 num_qs;
1947+
u8 port_num_chng;
1948+
#define ICE_AQC_Q_CFG_SRC_PRT_M 0x7
1949+
#define ICE_AQC_Q_CFG_DST_PRT_S 3
1950+
#define ICE_AQC_Q_CFG_DST_PRT_M (0x7 << ICE_AQC_Q_CFG_DST_PRT_S)
1951+
u8 time_out;
1952+
#define ICE_AQC_Q_CFG_TIMEOUT_S 2
1953+
#define ICE_AQC_Q_CFG_TIMEOUT_M (0x1F << ICE_AQC_Q_CFG_TIMEOUT_S)
1954+
__le32 blocked_cgds;
1955+
__le32 addr_high;
1956+
__le32 addr_low;
1957+
};
1958+
1959+
/* Per Q struct for Move/Reconfigure Tx LAN Queues (indirect 0x0C32) */
1960+
struct ice_aqc_cfg_txq_perq {
1961+
__le16 q_handle;
1962+
u8 tc;
1963+
u8 rsvd;
1964+
__le32 q_teid;
1965+
};
1966+
1967+
/* The buffer for Move/Reconfigure Tx LAN Queues (indirect 0x0C32) */
1968+
struct ice_aqc_cfg_txqs_buf {
1969+
__le32 src_parent_teid;
1970+
__le32 dst_parent_teid;
1971+
struct ice_aqc_cfg_txq_perq queue_info[];
1972+
};
1973+
19261974
/* Add Tx RDMA Queue Set (indirect 0x0C33) */
19271975
struct ice_aqc_add_rdma_qset {
19281976
u8 num_qset_grps;
@@ -2181,6 +2229,7 @@ struct ice_aq_desc {
21812229
struct ice_aqc_neigh_dev_req neigh_dev;
21822230
struct ice_aqc_add_txqs add_txqs;
21832231
struct ice_aqc_dis_txqs dis_txqs;
2232+
struct ice_aqc_cfg_txqs cfg_txqs;
21842233
struct ice_aqc_add_rdma_qset add_rdma_qset;
21852234
struct ice_aqc_add_get_update_free_vsi vsi_cmd;
21862235
struct ice_aqc_add_update_free_vsi_resp add_update_free_vsi_res;
@@ -2263,6 +2312,7 @@ enum ice_adminq_opc {
22632312
/* Alloc/Free/Get Resources */
22642313
ice_aqc_opc_alloc_res = 0x0208,
22652314
ice_aqc_opc_free_res = 0x0209,
2315+
ice_aqc_opc_share_res = 0x020B,
22662316
ice_aqc_opc_set_vlan_mode_parameters = 0x020C,
22672317
ice_aqc_opc_get_vlan_mode_parameters = 0x020D,
22682318

@@ -2356,6 +2406,7 @@ enum ice_adminq_opc {
23562406
/* Tx queue handling commands/events */
23572407
ice_aqc_opc_add_txqs = 0x0C30,
23582408
ice_aqc_opc_dis_txqs = 0x0C31,
2409+
ice_aqc_opc_cfg_txqs = 0x0C32,
23592410
ice_aqc_opc_add_rdma_qset = 0x0C33,
23602411

23612412
/* package commands */

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

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2241,6 +2241,14 @@ ice_parse_common_caps(struct ice_hw *hw, struct ice_hw_common_caps *caps,
22412241
"%s: reset_restrict_support = %d\n", prefix,
22422242
caps->reset_restrict_support);
22432243
break;
2244+
case ICE_AQC_CAPS_FW_LAG_SUPPORT:
2245+
caps->roce_lag = !!(number & ICE_AQC_BIT_ROCEV2_LAG);
2246+
ice_debug(hw, ICE_DBG_INIT, "%s: roce_lag = %u\n",
2247+
prefix, caps->roce_lag);
2248+
caps->sriov_lag = !!(number & ICE_AQC_BIT_SRIOV_LAG);
2249+
ice_debug(hw, ICE_DBG_INIT, "%s: sriov_lag = %u\n",
2250+
prefix, caps->sriov_lag);
2251+
break;
22442252
default:
22452253
/* Not one of the recognized common capabilities */
22462254
found = false;
@@ -4221,6 +4229,53 @@ ice_aq_dis_lan_txq(struct ice_hw *hw, u8 num_qgrps,
42214229
return status;
42224230
}
42234231

4232+
/**
4233+
* ice_aq_cfg_lan_txq
4234+
* @hw: pointer to the hardware structure
4235+
* @buf: buffer for command
4236+
* @buf_size: size of buffer in bytes
4237+
* @num_qs: number of queues being configured
4238+
* @oldport: origination lport
4239+
* @newport: destination lport
4240+
* @cd: pointer to command details structure or NULL
4241+
*
4242+
* Move/Configure LAN Tx queue (0x0C32)
4243+
*
4244+
* There is a better AQ command to use for moving nodes, so only coding
4245+
* this one for configuring the node.
4246+
*/
4247+
int
4248+
ice_aq_cfg_lan_txq(struct ice_hw *hw, struct ice_aqc_cfg_txqs_buf *buf,
4249+
u16 buf_size, u16 num_qs, u8 oldport, u8 newport,
4250+
struct ice_sq_cd *cd)
4251+
{
4252+
struct ice_aqc_cfg_txqs *cmd;
4253+
struct ice_aq_desc desc;
4254+
int status;
4255+
4256+
cmd = &desc.params.cfg_txqs;
4257+
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_cfg_txqs);
4258+
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
4259+
4260+
if (!buf)
4261+
return -EINVAL;
4262+
4263+
cmd->cmd_type = ICE_AQC_Q_CFG_TC_CHNG;
4264+
cmd->num_qs = num_qs;
4265+
cmd->port_num_chng = (oldport & ICE_AQC_Q_CFG_SRC_PRT_M);
4266+
cmd->port_num_chng |= (newport << ICE_AQC_Q_CFG_DST_PRT_S) &
4267+
ICE_AQC_Q_CFG_DST_PRT_M;
4268+
cmd->time_out = (5 << ICE_AQC_Q_CFG_TIMEOUT_S) &
4269+
ICE_AQC_Q_CFG_TIMEOUT_M;
4270+
cmd->blocked_cgds = 0;
4271+
4272+
status = ice_aq_send_cmd(hw, &desc, buf, buf_size, cd);
4273+
if (status)
4274+
ice_debug(hw, ICE_DBG_SCHED, "Failed to reconfigure nodes %d\n",
4275+
hw->adminq.sq_last_status);
4276+
return status;
4277+
}
4278+
42244279
/**
42254280
* ice_aq_add_rdma_qsets
42264281
* @hw: pointer to the hardware structure
@@ -4700,6 +4755,7 @@ ice_dis_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_queues,
47004755
break;
47014756
ice_free_sched_node(pi, node);
47024757
q_ctx->q_handle = ICE_INVAL_Q_HANDLE;
4758+
q_ctx->q_teid = ICE_INVAL_TEID;
47034759
}
47044760
mutex_unlock(&pi->sched_lock);
47054761
kfree(qg_list);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ int
186186
ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 q_handle,
187187
u8 num_qgrps, struct ice_aqc_add_tx_qgrp *buf, u16 buf_size,
188188
struct ice_sq_cd *cd);
189+
int
190+
ice_aq_cfg_lan_txq(struct ice_hw *hw, struct ice_aqc_cfg_txqs_buf *buf,
191+
u16 buf_size, u16 num_qs, u8 oldport, u8 newport,
192+
struct ice_sq_cd *cd);
189193
int ice_replay_vsi(struct ice_hw *hw, u16 vsi_handle);
190194
void ice_replay_post(struct ice_hw *hw);
191195
void ice_output_fw_log(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf);

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

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ static int ice_dcbnl_setets(struct net_device *netdev, struct ieee_ets *ets)
7070
!(pf->dcbx_cap & DCB_CAP_DCBX_VER_IEEE))
7171
return -EINVAL;
7272

73+
if (pf->lag && pf->lag->bonded) {
74+
netdev_err(netdev, "DCB changes not allowed when in a bond\n");
75+
return -EINVAL;
76+
}
77+
7378
new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg;
7479

7580
mutex_lock(&pf->tc_mutex);
@@ -170,6 +175,11 @@ static u8 ice_dcbnl_setdcbx(struct net_device *netdev, u8 mode)
170175
if (mode == pf->dcbx_cap)
171176
return ICE_DCB_NO_HW_CHG;
172177

178+
if (pf->lag && pf->lag->bonded) {
179+
netdev_err(netdev, "DCB changes not allowed when in a bond\n");
180+
return ICE_DCB_NO_HW_CHG;
181+
}
182+
173183
qos_cfg = &pf->hw.port_info->qos_cfg;
174184

175185
/* DSCP configuration is not DCBx negotiated */
@@ -261,6 +271,11 @@ static int ice_dcbnl_setpfc(struct net_device *netdev, struct ieee_pfc *pfc)
261271
!(pf->dcbx_cap & DCB_CAP_DCBX_VER_IEEE))
262272
return -EINVAL;
263273

274+
if (pf->lag && pf->lag->bonded) {
275+
netdev_err(netdev, "DCB changes not allowed when in a bond\n");
276+
return -EINVAL;
277+
}
278+
264279
mutex_lock(&pf->tc_mutex);
265280

266281
new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg;
@@ -323,6 +338,11 @@ static void ice_dcbnl_set_pfc_cfg(struct net_device *netdev, int prio, u8 set)
323338
if (prio >= ICE_MAX_USER_PRIORITY)
324339
return;
325340

341+
if (pf->lag && pf->lag->bonded) {
342+
netdev_err(netdev, "DCB changes not allowed when in a bond\n");
343+
return;
344+
}
345+
326346
new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg;
327347

328348
new_cfg->pfc.pfccap = pf->hw.func_caps.common_cap.maxtc;
@@ -379,6 +399,11 @@ static u8 ice_dcbnl_setstate(struct net_device *netdev, u8 state)
379399
!(pf->dcbx_cap & DCB_CAP_DCBX_VER_CEE))
380400
return ICE_DCB_NO_HW_CHG;
381401

402+
if (pf->lag && pf->lag->bonded) {
403+
netdev_err(netdev, "DCB changes not allowed when in a bond\n");
404+
return ICE_DCB_NO_HW_CHG;
405+
}
406+
382407
/* Nothing to do */
383408
if (!!state == test_bit(ICE_FLAG_DCB_ENA, pf->flags))
384409
return ICE_DCB_NO_HW_CHG;
@@ -451,6 +476,11 @@ ice_dcbnl_set_pg_tc_cfg_tx(struct net_device *netdev, int tc,
451476
if (tc >= ICE_MAX_TRAFFIC_CLASS)
452477
return;
453478

479+
if (pf->lag && pf->lag->bonded) {
480+
netdev_err(netdev, "DCB changes not allowed when in a bond\n");
481+
return;
482+
}
483+
454484
new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg;
455485

456486
/* prio_type, bwg_id and bw_pct per UP are not supported */
@@ -505,6 +535,11 @@ ice_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int pgid, u8 bw_pct)
505535
if (pgid >= ICE_MAX_TRAFFIC_CLASS)
506536
return;
507537

538+
if (pf->lag && pf->lag->bonded) {
539+
netdev_err(netdev, "DCB changes not allowed when in a bond\n");
540+
return;
541+
}
542+
508543
new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg;
509544

510545
new_cfg->etscfg.tcbwtable[pgid] = bw_pct;
@@ -725,6 +760,11 @@ static int ice_dcbnl_setapp(struct net_device *netdev, struct dcb_app *app)
725760
return -EINVAL;
726761
}
727762

763+
if (pf->lag && pf->lag->bonded) {
764+
netdev_err(netdev, "DCB changes not allowed when in a bond\n");
765+
return -EINVAL;
766+
}
767+
728768
max_tc = pf->hw.func_caps.common_cap.maxtc;
729769
if (app->priority >= max_tc) {
730770
netdev_err(netdev, "TC %d out of range, max TC %d\n",
@@ -836,6 +876,11 @@ static int ice_dcbnl_delapp(struct net_device *netdev, struct dcb_app *app)
836876
return -EINVAL;
837877
}
838878

879+
if (pf->lag && pf->lag->bonded) {
880+
netdev_err(netdev, "DCB changes not allowed when in a bond\n");
881+
return -EINVAL;
882+
}
883+
839884
mutex_lock(&pf->tc_mutex);
840885
old_cfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg;
841886

@@ -937,6 +982,11 @@ static u8 ice_dcbnl_cee_set_all(struct net_device *netdev)
937982
!(pf->dcbx_cap & DCB_CAP_DCBX_VER_CEE))
938983
return ICE_DCB_NO_HW_CHG;
939984

985+
if (pf->lag && pf->lag->bonded) {
986+
netdev_err(netdev, "DCB changes not allowed when in a bond\n");
987+
return ICE_DCB_NO_HW_CHG;
988+
}
989+
940990
new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg;
941991

942992
mutex_lock(&pf->tc_mutex);

0 commit comments

Comments
 (0)