summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/intel/ice/ice_dcb_nl.c
diff options
context:
space:
mode:
authorAvinash Dayanand <avinash.dayanand@intel.com>2020-02-13 13:30:59 -0800
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2020-02-19 12:12:27 -0800
commita29a912d448dbc9912705377195bf6418da5897f (patch)
tree3da50fa39eb03e5185fc0e877679e361688e3853 /drivers/net/ethernet/intel/ice/ice_dcb_nl.c
parent7d51a01599d5285fc94fa4fcea10afabfa9ca5a4 (diff)
ice: Validate config for SW DCB map
Validate the inputs for SW DCB config received either via lldptool or pcap file. And don't apply DCB for bad bandwidth inputs. Without this patch, any config having bad inputs will cause the loss of link making PF unusable even after driver reload. Recoverable only via system reboot. Signed-off-by: Avinash Dayanand <avinash.dayanand@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_dcb_nl.c')
-rw-r--r--drivers/net/ethernet/intel/ice/ice_dcb_nl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_nl.c b/drivers/net/ethernet/intel/ice/ice_dcb_nl.c
index b61aba428adb..c572aa5c28e0 100644
--- a/drivers/net/ethernet/intel/ice/ice_dcb_nl.c
+++ b/drivers/net/ethernet/intel/ice/ice_dcb_nl.c
@@ -95,6 +95,11 @@ static int ice_dcbnl_setets(struct net_device *netdev, struct ieee_ets *ets)
new_cfg->etsrec.prio_table[i] = ets->reco_prio_tc[i];
}
+ if (ice_dcb_bwchk(pf, new_cfg)) {
+ err = -EINVAL;
+ goto ets_out;
+ }
+
/* max_tc is a 1-8 value count of number of TC's, not a 0-7 value
* for the TC's index number. Add one to value if not zero, and
* for zero set it to the FW's default value
@@ -119,6 +124,7 @@ static int ice_dcbnl_setets(struct net_device *netdev, struct ieee_ets *ets)
if (err == ICE_DCB_NO_HW_CHG)
err = ICE_DCB_HW_CHG_RST;
+ets_out:
mutex_unlock(&pf->tc_mutex);
return err;
}