blob: 6a5599504f7e30587399518669c451fcfa6e9119 [file] [log] [blame]
From 4f1b4020358037425ef1e723952eb12ac9a96f5d Mon Sep 17 00:00:00 2001
From: Yonglong Liu <>
Date: Thu, 12 Mar 2020 15:11:03 +0800
Subject: [PATCH] net: hns3: fix "tc qdisc del" failed issue
commit 5eb01ddfcfb25e6ebc404a41deae946bde776731 upstream.
The HNS3 driver supports to configure TC numbers and TC to priority
map via "tc" tool. But when delete the rule, will fail, because
the HNS3 driver needs at least one TC, but the "tc" tool sets TC
number to zero when delete.
This patch makes sure that the TC number is at least one.
Fixes: 30d240dfa2e8 ("net: hns3: Add mqprio hardware offload support in hns3 driver")
Signed-off-by: Yonglong Liu <>
Signed-off-by: Huazhong Tan <>
Signed-off-by: David S. Miller <>
Signed-off-by: Paul Gortmaker <>
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index 7a8595967ad2..5a3900865503 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -1561,7 +1561,7 @@ static int hns3_setup_tc(struct net_device *netdev, void *type_data)
kinfo = &h->kinfo;
return (kinfo->dcb_ops && kinfo->dcb_ops->setup_tc) ?
- kinfo->dcb_ops->setup_tc(h, tc, prio_tc) : -EOPNOTSUPP;
+ kinfo->dcb_ops->setup_tc(h, tc ? tc : 1, prio_tc) : -EOPNOTSUPP;
static int hns3_nic_setup_tc(struct net_device *dev, enum tc_setup_type type,