Skip to content

Commit ab2ed5d

Browse files
dmertmananguy11
authored andcommitted
ice: enforce no DCB config changing when in bond
To support SRIOV LAG, the driver cannot allow changes to an interface's DCB configuration when in a bond. This would break the ability to modify interfaces Tx scheduling for fail-over interfaces. Block kernel generated DCB config events when in a bond. Reviewed-by: Daniel Machon <daniel.machon@microchip.com> Signed-off-by: Dave Ertman <david.m.ertman@intel.com> Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent bf65da2 commit ab2ed5d

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

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)