From 0e36a335c84ee6f4248909321f3c83a71fd2aa02 Mon Sep 17 00:00:00 2001 From: Alexei Lazar Date: Sun, 11 Oct 2026 11:39:29 +0300 Subject: [PATCH] net/dcb: Validate bandwidth for non-ETS traffic classes The IEEE 802.1Qaz standard defines that bandwidth allocation percentages only apply to ETS traffic classes. Reject ETS configurations that specify non-zero bandwidth for non-ETS traffic classes. Placing this check in dcbnl_ieee_set() enforces the constraint uniformly for all drivers rather than relying on each driver to validate it independently. Drop the equivalent check from NFP's dcb_ets_check(). Keep ETS bandwidth-sum validation unchanged. Signed-off-by: Alexei Lazar Reviewed-by: Carolina Jubran Signed-off-by: Tariq Toukan Link: https://patch.msgid.link/20261011083929.739261-1-tariqt@nvidia.com Signed-off-by: Jakub Kicinski --- drivers/net/ethernet/netronome/nfp/nic/dcb.c | 3 --- net/dcb/dcbnl.c | 9 +++++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/nic/dcb.c b/drivers/net/ethernet/netronome/nfp/nic/dcb.c index bb498ac6bd7d..91fbfa3708fc 100644 --- a/drivers/net/ethernet/netronome/nfp/nic/dcb.c +++ b/drivers/net/ethernet/netronome/nfp/nic/dcb.c @@ -218,9 +218,6 @@ static int dcb_ets_check(struct net_device *dev, struct ieee_ets *ets) if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_ETS) { ets_exists = true; sum += ets->tc_tx_bw[i]; - } else if (ets->tc_tx_bw[i]) { - nfp_warn(app->cpp, "ETS BW for strict/vendor TC must be 0."); - return -EINVAL; } } diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c index 35164bfa563d..ab71f5312876 100644 --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c @@ -1578,6 +1578,15 @@ static int dcbnl_ieee_set(struct net_device *netdev, struct nlmsghdr *nlh, if (ieee[DCB_ATTR_IEEE_ETS] && ops->ieee_setets) { struct ieee_ets *ets = nla_data(ieee[DCB_ATTR_IEEE_ETS]); + + /* IEEE 802.1Qaz: BW allocation applies only to ETS TCs */ + for (int i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) { + if (ets->tc_tsa[i] != IEEE_8021QAZ_TSA_ETS && + ets->tc_tx_bw[i]) { + err = -EINVAL; + goto err; + } + } err = ops->ieee_setets(netdev, ets); if (err) goto err;