From: "huangguangbin (A)" <huangguangbin2@huawei.com>
To: Paolo Abeni <pabeni@redhat.com>, <davem@davemloft.net>,
<kuba@kernel.org>
Cc: <edumazet@google.com>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <lipeng321@huawei.com>,
<lanhao@huawei.com>
Subject: Re: [PATCH net-next 2/5] net: hns3: support ndo_select_queue()
Date: Wed, 7 Sep 2022 08:57:20 +0800 [thread overview]
Message-ID: <855274c8-fa07-8405-61d6-390b7cd9853e@huawei.com> (raw)
In-Reply-To: <8b2589bd6303133fd27cab1af27b096a5f848074.camel@redhat.com>
On 2022/9/6 21:15, Paolo Abeni wrote:
> On Mon, 2022-09-05 at 16:15 +0800, Guangbin Huang wrote:
>> To support tx packets to select queue according to its dscp field after
>> setting dscp and tc map relationship, this patch implements
>> ndo_select_queue() to set skb->priority according to the user's setting
>> dscp and priority map relationship.
>>
>> Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
>> ---
>> .../net/ethernet/hisilicon/hns3/hns3_enet.c | 46 +++++++++++++++++++
>> 1 file changed, 46 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
>> index 481a300819ad..82f83e3f8162 100644
>> --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
>> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
>> @@ -2963,6 +2963,51 @@ static int hns3_nic_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
>> return h->ae_algo->ops->set_vf_mac(h, vf_id, mac);
>> }
>>
>> +#define HNS3_INVALID_DSCP 0xff
>> +#define HNS3_DSCP_SHIFT 2
>> +
>> +static u8 hns3_get_skb_dscp(struct sk_buff *skb)
>> +{
>> + __be16 protocol = skb->protocol;
>> + u8 dscp = HNS3_INVALID_DSCP;
>> +
>> + if (protocol == htons(ETH_P_8021Q))
>> + protocol = vlan_get_protocol(skb);
>> +
>> + if (protocol == htons(ETH_P_IP))
>> + dscp = ipv4_get_dsfield(ip_hdr(skb)) >> HNS3_DSCP_SHIFT;
>> + else if (protocol == htons(ETH_P_IPV6))
>> + dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> HNS3_DSCP_SHIFT;
>> +
>> + return dscp;
>> +}
>> +
>> +static u16 hns3_nic_select_queue(struct net_device *netdev,
>> + struct sk_buff *skb,
>> + struct net_device *sb_dev)
>> +{
>> + struct hnae3_handle *h = hns3_get_handle(netdev);
>> + u8 dscp, priority;
>> + int ret;
>> +
>> + 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);
>
> This introduces an additional, unneeded indirect call in the fast path,
> you could consider replacing the above with a direct call to
> hclge_get_dscp_prio() - again taking care of the CONFIG_HNS3_DCB
> dependency.
>
> Cheers,
>
> Paolo
>
> .
>
Ok.
next prev parent reply other threads:[~2022-09-07 0:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-05 8:15 [PATCH net-next 0/5] net: hns3: updates for -next Guangbin Huang
2022-09-05 8:15 ` [PATCH net-next 1/5] net: hns3: add support config dscp map to tc Guangbin Huang
2022-09-06 1:35 ` kernel test robot
2022-09-06 13:12 ` Paolo Abeni
2022-09-06 13:50 ` huangguangbin (A)
2022-09-05 8:15 ` [PATCH net-next 2/5] net: hns3: support ndo_select_queue() Guangbin Huang
2022-09-06 13:15 ` Paolo Abeni
2022-09-07 0:57 ` huangguangbin (A) [this message]
2022-09-05 8:15 ` [PATCH net-next 3/5] net: hns3: debugfs add dump dscp map info Guangbin Huang
2022-09-05 8:15 ` [PATCH net-next 4/5] net: hns3: add querying fec statistics Guangbin Huang
2022-09-05 8:15 ` [PATCH net-next 5/5] net: hns3: add support to query and set lane number by ethtool Guangbin Huang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=855274c8-fa07-8405-61d6-390b7cd9853e@huawei.com \
--to=huangguangbin2@huawei.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=lanhao@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lipeng321@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®