aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ice/ice_dcb_nl.c
diff options
context:
space:
mode:
authorAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>2021-07-16 15:16:41 -0700
committerTony Nguyen <anthony.l.nguyen@intel.com>2021-09-28 09:42:04 -0700
commit40b247608bc50b5c046dfb1073c0ee7f57769c86 (patch)
treeffb705614bf808d59e7afb2958f0b27f585abe1d /drivers/net/ethernet/intel/ice/ice_dcb_nl.c
parentice: Add DSCP support (diff)
downloadlinux-dev-40b247608bc50b5c046dfb1073c0ee7f57769c86.tar.xz
linux-dev-40b247608bc50b5c046dfb1073c0ee7f57769c86.zip
ice: Add feature bitmap, helpers and a check for DSCP
DSCP a.k.a L3 QoS is only supported on certain devices. To enforce this, this patch introduces a bitmap of features and helper functions. The feature bitmap is set based on device IDs on driver init. Currently, DSCP is the only feature in this bitmap, but there will be more in the future. In the DCB netlink flow, check if the feature bit is set before exercising DSCP. Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Gurucharan G <gurucharanx.g@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@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.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_nl.c b/drivers/net/ethernet/intel/ice/ice_dcb_nl.c
index 0121dbc62c8a..7fdeb411b6df 100644
--- a/drivers/net/ethernet/intel/ice/ice_dcb_nl.c
+++ b/drivers/net/ethernet/intel/ice/ice_dcb_nl.c
@@ -710,6 +710,9 @@ static int ice_dcbnl_setapp(struct net_device *netdev, struct dcb_app *app)
if (!(pf->dcbx_cap & DCB_CAP_DCBX_VER_IEEE))
return -EINVAL;
+ if (!ice_is_feature_supported(pf, ICE_F_DSCP))
+ return -EOPNOTSUPP;
+
if (app->protocol >= ICE_DSCP_NUM_VAL) {
netdev_err(netdev, "DSCP value 0x%04X out of range\n",
app->protocol);
@@ -861,8 +864,9 @@ static int ice_dcbnl_delapp(struct net_device *netdev, struct dcb_app *app)
new_cfg->app[j].priority = old_cfg->app[j + 1].priority;
}
- /* if not a DSCP APP TLV, then we are done */
- if (app->selector != IEEE_8021QAZ_APP_SEL_DSCP) {
+ /* if not a DSCP APP TLV or DSCP is not supported, we are done */
+ if (app->selector != IEEE_8021QAZ_APP_SEL_DSCP ||
+ !ice_is_feature_supported(pf, ICE_F_DSCP)) {
ret = ICE_DCB_HW_CHG;
goto delapp_out;
}