summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
diff options
context:
space:
mode:
authorGuangbin Huang <huangguangbin2@huawei.com>2022-09-16 10:38:01 +0800
committerJakub Kicinski <kuba@kernel.org>2022-09-21 14:32:21 -0700
commitdfea275e06c26690b1ef27399fd84ce50372b85c (patch)
tree843897ef95fedb5164335b0e23227cedaa67da38 /drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
parent04b6ba143521f4485b7f2c36c655b262a79dae97 (diff)
net: hns3: optimize converting dscp to priority process of hns3_nic_select_queue()
Currently, when function hns3_nic_select_queue() converts dscp to priority, it calls an indirect callback ae_algo->ops->get_dscp_prio to get priority. However as function hns3_nic_select_queue() is in fast path, the indirect call may cause degradation of performance. For optimization, this patch moves dscp_app_cnt and dscp_prio from struct hclge_tm_info to struct hnae3_knic_private_info, so they can be used in both hclge and hns3 layers. Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ethernet/hisilicon/hns3/hns3_enet.c')
-rw-r--r--drivers/net/ethernet/hisilicon/hns3/hns3_enet.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index db099549e511..39b75b68474c 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -2987,22 +2987,19 @@ static u16 hns3_nic_select_queue(struct net_device *netdev,
struct net_device *sb_dev)
{
struct hnae3_handle *h = hns3_get_handle(netdev);
- u8 dscp, priority;
- int ret;
+ u8 dscp;
if (h->kinfo.tc_map_mode != HNAE3_TC_MAP_MODE_DSCP ||
!h->ae_algo->ops->get_dscp_prio)
goto out;
dscp = hns3_get_skb_dscp(skb);
- if (unlikely(dscp == HNS3_INVALID_DSCP))
- goto out;
-
- ret = h->ae_algo->ops->get_dscp_prio(h, dscp, NULL, &priority);
- if (ret)
+ if (unlikely(dscp >= HNAE3_MAX_DSCP))
goto out;
- skb->priority = priority;
+ skb->priority = h->kinfo.dscp_prio[dscp];
+ if (skb->priority == HNAE3_PRIO_ID_INVALID)
+ skb->priority = 0;
out:
return netdev_pick_tx(netdev, skb, sb_dev);