Skip to content

Commit

Permalink
ice: enforce no DCB config changing when in bond
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dave Ertman authored and Tony Nguyen committed Jul 27, 2023
1 parent bf65da2 commit ab2ed5d
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_dcb_nl.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ static int ice_dcbnl_setets(struct net_device *netdev, struct ieee_ets *ets)
!(pf->dcbx_cap & DCB_CAP_DCBX_VER_IEEE))
return -EINVAL;

if (pf->lag && pf->lag->bonded) {
netdev_err(netdev, "DCB changes not allowed when in a bond\n");
return -EINVAL;
}

new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg;

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

if (pf->lag && pf->lag->bonded) {
netdev_err(netdev, "DCB changes not allowed when in a bond\n");
return ICE_DCB_NO_HW_CHG;
}

qos_cfg = &pf->hw.port_info->qos_cfg;

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

if (pf->lag && pf->lag->bonded) {
netdev_err(netdev, "DCB changes not allowed when in a bond\n");
return -EINVAL;
}

mutex_lock(&pf->tc_mutex);

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

if (pf->lag && pf->lag->bonded) {
netdev_err(netdev, "DCB changes not allowed when in a bond\n");
return;
}

new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg;

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

if (pf->lag && pf->lag->bonded) {
netdev_err(netdev, "DCB changes not allowed when in a bond\n");
return ICE_DCB_NO_HW_CHG;
}

/* Nothing to do */
if (!!state == test_bit(ICE_FLAG_DCB_ENA, pf->flags))
return ICE_DCB_NO_HW_CHG;
Expand Down Expand Up @@ -451,6 +476,11 @@ ice_dcbnl_set_pg_tc_cfg_tx(struct net_device *netdev, int tc,
if (tc >= ICE_MAX_TRAFFIC_CLASS)
return;

if (pf->lag && pf->lag->bonded) {
netdev_err(netdev, "DCB changes not allowed when in a bond\n");
return;
}

new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg;

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

if (pf->lag && pf->lag->bonded) {
netdev_err(netdev, "DCB changes not allowed when in a bond\n");
return;
}

new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg;

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

if (pf->lag && pf->lag->bonded) {
netdev_err(netdev, "DCB changes not allowed when in a bond\n");
return -EINVAL;
}

max_tc = pf->hw.func_caps.common_cap.maxtc;
if (app->priority >= max_tc) {
netdev_err(netdev, "TC %d out of range, max TC %d\n",
Expand Down Expand Up @@ -836,6 +876,11 @@ static int ice_dcbnl_delapp(struct net_device *netdev, struct dcb_app *app)
return -EINVAL;
}

if (pf->lag && pf->lag->bonded) {
netdev_err(netdev, "DCB changes not allowed when in a bond\n");
return -EINVAL;
}

mutex_lock(&pf->tc_mutex);
old_cfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg;

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

if (pf->lag && pf->lag->bonded) {
netdev_err(netdev, "DCB changes not allowed when in a bond\n");
return ICE_DCB_NO_HW_CHG;
}

new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg;

mutex_lock(&pf->tc_mutex);
Expand Down

0 comments on commit ab2ed5d

Please sign in to comment.