Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1738774

Re: [PATCH net-next 10/10] net: hns3: Add mqprio support when interacting with network stack

Path csiph.com!weretis.net!feeder4.news.weretis.net!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Jiri Pirko <jiri@resnulli.us>
Newsgroups linux.kernel
Subject Re: [PATCH net-next 10/10] net: hns3: Add mqprio support when interacting with network stack
Date Mon, 25 Sep 2017 09:00:02 +0200
Message-ID <utvx0-2Kk-7@gated-at.bofh.it> (permalink)
References <us7Q5-kv-3@gated-at.bofh.it> <us7Q7-kv-49@gated-at.bofh.it> <usvIJ-6c6-3@gated-at.bofh.it> <usyGC-8dH-15@gated-at.bofh.it> <usyGC-8dH-13@gated-at.bofh.it> <usGNP-4A1-1@gated-at.bofh.it> <utdqq-87X-21@gated-at.bofh.it> <utpKV-7gz-7@gated-at.bofh.it>
X-Original-To Yunsheng Lin <linyunsheng@huawei.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=tUjOYNGfdsIW60VN0wpb8eF5MMY0xTu0pk1jQvEKf2k=; b=o8pQOfR88s0LDi89nfa4JfuDAdvijMwIHv1wXWSda6eV67Dn9CceYNO1SACICxPGuM XLoq2KJXpytM8yyhv/ZaLb0ob/RPDHntvXDf1vDN38eY+zu0HBuXQ/Qc90MB3dUIsxm5 nZJxWFZn7fR1Y9yu8HqoPUVucgBrQT2sbdnKW1g7xhJacc0DWZDxhG57eunG8H2lSLk8 76dCyWpkGdM/u8o8mfhsmJMKVCtW7dUMm6T1O6MoS6zy87fKB5rUsyN3+Q0L7hphLOpK 8AJSdpOSuOtP2+80Oe3B6pWRb6VnKLhhZ6xYRkrxtlNdyy7LVV/D2SzKB3qfIyyLmdUD netA==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=tUjOYNGfdsIW60VN0wpb8eF5MMY0xTu0pk1jQvEKf2k=; b=d8U1SQbLoQuYeRuPWUmap4+PKx1GyytWJbowR5J9LORa8fwphoM/wTa5eGSBoEsVA4 FZZ2KBmppf0vLYgzv7tLD+9Au5ieFwFlMZeuP0KYco8SpBpGl9ezXrmpjGnbzpISScPc IknG/6MtNAQJ8xwprfXXzHRyoFq+pvX5VXUkPNX5jM0ELGN5MWXn62UJ7AXug9xi7SZF bCZsy5UnV3dYp6GcylmxtN9sfeeJfhjse5GaDhSzg4IijJFccaE2W3SumA2MXuDflogQ 1BXt3RUbMvdu/QPoA3yPg1x0aaT1aCncoMNXjV042/yYwSX/nZ4LnoeNCCTVE2Ql3deo xGsg==
X-Gm-Message-State AHPjjUgMtILVN1PpHrI0wX9St3OsOsfYiAHvofAKCN5RiKtsW6DB5JN0 bBbsFOgDGvVDUoP2p4C3eaZ6AA==
X-Google-SMTP-Source AOwi7QAczXffF8rcgQ0ed4uHPAQcD2MJlkJFITEhTkWSOTIb70khabdUA/G0SiwECubG9dUiBN1iEQ==
X-Received by 10.28.74.89 with SMTP id x86mr2993357wma.57.1506322661448; Sun, 24 Sep 2017 23:57:41 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.8.3 (2017-05-23)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 135
Organization linux.* mail to news gateway
X-Original-Cc "davem@davemloft.net" <davem@davemloft.net>, huangdaode <huangdaode@hisilicon.com>, "xuwei (O)" <xuwei5@hisilicon.com>, "Liguozhu (Kenneth)" <liguozhu@hisilicon.com>, "Zhuangyuzeng (Yisen)" <yisen.zhuang@huawei.com>, Gabriele Paoloni <gabriele.paoloni@huawei.com>, John Garry <john.garry@huawei.com>, Linuxarm <linuxarm@huawei.com>, Salil Mehta <salil.mehta@huawei.com>, "lipeng (Y)" <lipeng321@huawei.com>, "netdev@vger.kernel.org" <netdev@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
X-Original-Date Mon, 25 Sep 2017 08:57:40 +0200
X-Original-Message-ID <20170925065740.GB1899@nanopsycho>
X-Original-References <1505992913-107256-1-git-send-email-linyunsheng@huawei.com> <1505992913-107256-11-git-send-email-linyunsheng@huawei.com> <20170922125541.GA2005@nanopsycho.orion> <59c51a37.a1c4df0a.ac4e2.8df0SMTPIN_ADDED_BROKEN@mx.google.com> <20170922160322.GB2005@nanopsycho.orion> <fdd8d8af-6d74-143a-adfa-502bd94a90d9@huawei.com> <20170924113724.GA2029@nanopsycho> <290b0679-bfc2-c23c-00ee-43768c1c2327@huawei.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1738774

Show key headers only | View raw


Mon, Sep 25, 2017 at 02:45:08AM CEST, linyunsheng@huawei.com wrote:
>Hi, Jiri
>
>On 2017/9/24 19:37, Jiri Pirko wrote:
>> Sat, Sep 23, 2017 at 02:47:20AM CEST, linyunsheng@huawei.com wrote:
>>> Hi, Jiri
>>>
>>> On 2017/9/23 0:03, Jiri Pirko wrote:
>>>> Fri, Sep 22, 2017 at 04:11:51PM CEST, linyunsheng@huawei.com wrote:
>>>>> Hi, Jiri
>>>>>
>>>>>>> - if (!tc) {
>>>>>>> + if (if_running) {
>>>>>>> + (void)hns3_nic_net_stop(netdev);
>>>>>>> + msleep(100);
>>>>>>> + }
>>>>>>> +
>>>>>>> + ret = (kinfo->dcb_ops && kinfo->dcb_ops->>setup_tc) ?
>>>>>>> + kinfo->dcb_ops->setup_tc(h, tc, prio_tc) : ->EOPNOTSUPP;
>>>>>
>>>>>> This is most odd. Why do you call dcb_ops from >ndo_setup_tc callback?
>>>>>> Why are you mixing this together? prio->tc mapping >can be done
>>>>>> directly in dcbnl
>>>>>
>>>>> Here is what we do in dcb_ops->setup_tc:
>>>>> Firstly, if current tc num is different from the tc num
>>>>> that user provide, then we setup the queues for each
>>>>> tc.
>>>>>
>>>>> Secondly, we tell hardware the pri to tc mapping that
>>>>> the stack is using. In rx direction, our hardware need
>>>>> that mapping to put different packet into different tc'
>>>>> queues according to the priority of the packet, then
>>>>> rss decides which specific queue in the tc should the
>>>>> packet goto.
>>>>>
>>>>> By mixing, I suppose you meant why we need the
>>>>> pri to tc infomation?
>>>>
>>>> by mixing, I mean what I wrote. You are calling dcb_ops callback from
>>>> ndo_setup_tc callback. So you are mixing DCBNL subsystem and TC
>>>> subsystem. Why? Why do you need sch_mqprio? Why DCBNL is not enough for
>>>> all?
>>>
>>> When using lldptool, dcbnl is involved.
>>>
>>> But when using tc qdisc, dcbbl is not involved, below is the a few key
>>> call graph in the kernel when tc qdisc cmd is executed.
>>>
>>> cmd:
>>> tc qdisc add dev eth0 root handle 1:0 mqprio num_tc 4 map 1 2 3 3 1 3 1 1 hw 1
>>>
>>> call graph:
>>> rtnetlink_rcv_msg -> tc_modify_qdisc -> qdisc_create -> mqprio_init ->
>>> hns3_nic_setup_tc
>>>
>>> When hns3_nic_setup_tc is called, we need to know how many tc num and
>>> prio_tc mapping from the tc_mqprio_qopt which is provided in the paramter
>>> in the ndo_setup_tc function, and dcb_ops is the our hardware specific
>>> method to setup the tc related parameter to the hardware, so this is why
>>> we call dcb_ops callback in ndo_setup_tc callback.
>>>
>>> I hope this will answer your question, thanks for your time.
>> 
>> Okay. I understand that you have a usecase for mqprio mapping offload
>> without lldptool being involved. Ok. I believe it is wrong to call dcb_ops
>> from tc callback. You should have a generic layer inside the driver and
>> call it from both dcb_ops and tc callbacks.
>
>Actually, dcb_ops is our generic layer inside the driver.
>Below is high level architecture:
>
>       [ tc qdisc ]	       [ lldpad ]
>             |                     |
>             |                     |
>             |                     |
>       [ hns3_enet ]        [ hns3_dcbnl ]
>             \                    /
>                \              /
>                   \        /
>                 [ hclge_dcb ]
>                   /      \
>                /            \
>             /                  \
>     [ hclgc_main ]        [ hclge_tm ]
>
>hns3_enet.c implements the ndo_setup_tc callback.
>hns3_dcbnl.c implements the dcbnl_rtnl_ops for stack's DCBNL system.
>hclge_dcb implements the dcb_ops.
>So we already have a generic layer that tc and dcbnl all call from.
>
>> 
>> Also, what happens If I run lldptool concurrently with mqprio? Who wins
>> and is going to configure the mapping?
>
>Both lldptool and tc qdisc cmd use rtnl interface provided by stack, so
>they are both protected by rtnl_lock, so we do not have to do the locking
>in the driver.

I was not asking about locking, which is obvious, I was asking about the
behaviour. Like for example:
If I use tc to configure some mapping, later on I run lldptool and change
the mapping. Does the tc dump show the updated values or the original
ones?

>
>The locking is in rtnetlink_rcv_msg:
>
>	rtnl_lock();
>	handlers = rtnl_dereference(rtnl_msg_handlers[family]);
>	if (handlers) {
>		doit = READ_ONCE(handlers[type].doit);
>		if (doit)
>			err = doit(skb, nlh, extack);
>	}
>	rtnl_unlock();
>
>Thanks.
>
>> 
>> 
>>>
>>>>
>>>>
>>>>
>>>>> I hope I did not misunderstand your question, thanks
>>>>> for your time reviewing.
>>>>
>>>> .
>>>>
>>>
>> 
>> .
>> 
>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net-next 00/10] Add support for DCB feature in hns3 driver Yunsheng Lin <linyunsheng@huawei.com> - 2017-09-21 13:30 +0200
  [PATCH net-next 01/10] net: hns3: Support for dynamically assigning tx buffer to TC Yunsheng Lin <linyunsheng@huawei.com> - 2017-09-21 13:30 +0200
    Re: [PATCH net-next 01/10] net: hns3: Support for dynamically  assigning tx buffer to TC David Miller <davem@davemloft.net> - 2017-09-22 03:50 +0200
      Re: [PATCH net-next 01/10] net: hns3: Support for dynamically  assigning tx buffer to TC Yunsheng Lin <linyunsheng@huawei.com> - 2017-09-22 04:00 +0200
        Re: [PATCH net-next 01/10] net: hns3: Support for dynamically  assigning tx buffer to TC David Miller <davem@davemloft.net> - 2017-09-22 05:50 +0200
  [PATCH net-next 02/10] net: hns3: Add support for dynamically buffer reallocation Yunsheng Lin <linyunsheng@huawei.com> - 2017-09-21 13:30 +0200
  [PATCH net-next 06/10] net: hns3: Add some interface for the support of DCB feature Yunsheng Lin <linyunsheng@huawei.com> - 2017-09-21 13:30 +0200
  [PATCH net-next 09/10] net: hns3: Setting for fc_mode and dcb enable flag in TM module Yunsheng Lin <linyunsheng@huawei.com> - 2017-09-21 13:30 +0200
  [PATCH net-next 10/10] net: hns3: Add mqprio support when interacting with network stack Yunsheng Lin <linyunsheng@huawei.com> - 2017-09-21 13:30 +0200
    Re: [PATCH net-next 10/10] net: hns3: Add mqprio support when  interacting with network stack Jiri Pirko <jiri@resnulli.us> - 2017-09-22 15:00 +0200
      Re: [PATCH net-next 10/10] net: hns3: Add mqprio support when  interacting with network stack Jiri Pirko <jiri@resnulli.us> - 2017-09-22 18:10 +0200
        Re: [PATCH net-next 10/10] net: hns3: Add mqprio support when  interacting with network stack Yunsheng Lin <linyunsheng@huawei.com> - 2017-09-23 02:50 +0200
          Re: [PATCH net-next 10/10] net: hns3: Add mqprio support when  interacting with network stack Jiri Pirko <jiri@resnulli.us> - 2017-09-24 13:40 +0200
            Re: [PATCH net-next 10/10] net: hns3: Add mqprio support when  interacting with network stack Yunsheng Lin <linyunsheng@huawei.com> - 2017-09-25 02:50 +0200
              Re: [PATCH net-next 10/10] net: hns3: Add mqprio support when  interacting with network stack Jiri Pirko <jiri@resnulli.us> - 2017-09-25 09:00 +0200
                Re: [PATCH net-next 10/10] net: hns3: Add mqprio support when  interacting with network stack Yunsheng Lin <linyunsheng@huawei.com> - 2017-09-25 09:30 +0200
  [PATCH net-next 08/10] net: hns3: Add dcb netlink interface for the support of DCB feature Yunsheng Lin <linyunsheng@huawei.com> - 2017-09-21 13:30 +0200

csiph-web