All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxim Mikityanskiy <maximmi@nvidia.com>
To: Jakub Kicinski <kuba@kernel.org>,
	Maxim Mikityanskiy <maximmi@mellanox.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Jiri Pirko <jiri@resnulli.us>, David Ahern <dsahern@gmail.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Tariq Toukan <tariqt@nvidia.com>,
	Yossi Kuperman <yossiku@nvidia.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	<netdev@vger.kernel.org>
Subject: Re: [PATCH net-next v3 2/4] sch_htb: Hierarchical QoS hardware offload
Date: Mon, 4 Jan 2021 23:55:13 +0200	[thread overview]
Message-ID: <04607f76-3548-f6d1-061c-8d5d918f4017@nvidia.com> (raw)
In-Reply-To: <20201221171736.6f5ebe1d@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>

On 2020-12-22 03:17, Jakub Kicinski wrote:
> On Tue, 15 Dec 2020 09:42:11 +0200 Maxim Mikityanskiy wrote:
>> +	q->offload = nla_get_flag(tb[TCA_HTB_OFFLOAD]);
>> +
>> +	if (q->offload) {
>> +		if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc)
>> +			return -EOPNOTSUPP;
> 
> Is there a check somewhere making sure this is the root?

No, I should add something like:
         if (sch->parent != TC_H_ROOT)
                 return -EOPNOTSUPP;

Thanks.

>> +		q->num_direct_qdiscs = dev->real_num_tx_queues;
> 
> Why real_num_tx_queues? How do you handle queue count changes?

When HTB gets attached, we query the number of regular TX queues and use 
them for HTB direct (unclassified) traffic. When HTB is already 
attached, changing the number of channels is blocked by the driver, so 
the amount of direct queues doesn't change (otherwise it would be hard 
to maintain correspondence between queues and classes). However, new 
queues are added (i.e. real_num_tx_queues increases) when HTB classes 
are added.

>> +		q->direct_qdiscs = kcalloc(q->num_direct_qdiscs,
>> +					   sizeof(*q->direct_qdiscs),
>> +					   GFP_KERNEL);
>> +		if (!q->direct_qdiscs)
>> +			return -ENOMEM;
>> +	}
> 
> I can't quite parse after 20 minutes of staring at this code what the
> relationship between the device queues and classes is. Is there any
> relationship between real_num_tx_queues and classes?
> 

Let's say we had N TX queues before attaching HTB (i.e. 
real_num_tx_queues was N). Then queues 0..N-1 correspond to direct mode 
of HTB, and queues starting from N are used for leaf classes. So, when 
some classes are added, real_num_tx_queues will be bigger than N (say, 
it would be M), and queues N..M-1 will correspond to leaf classes. Inner 
classes don't have a backing queue.

In the current implementation, one leaf class is backed by one queue, 
but it can be changed in the future to allow multiple queues to back a 
class.

The mapping is stored in the driver and used in ndo_select_queue.

I hope it answers your question, but I'm ready to provide more details 
if you ask.

Thanks,
Max

  reply	other threads:[~2021-01-04 21:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15  7:42 [PATCH iproute2-next] tc/htb: Hierarchical QoS hardware offload Maxim Mikityanskiy
2020-12-15  7:42 ` [PATCH net-next v3 0/4] HTB offload Maxim Mikityanskiy
2020-12-15  7:42 ` [PATCH net-next v3 1/4] net: sched: Add multi-queue support to sch_tree_lock Maxim Mikityanskiy
2020-12-15  7:42 ` [PATCH net-next v3 2/4] sch_htb: Hierarchical QoS hardware offload Maxim Mikityanskiy
2020-12-22  1:17   ` Jakub Kicinski
2021-01-04 21:55     ` Maxim Mikityanskiy [this message]
2020-12-15  7:42 ` [PATCH net-next v3 3/4] sch_htb: Stats for offloaded HTB Maxim Mikityanskiy
2020-12-15  7:42 ` [PATCH net-next v3 4/4] net/mlx5e: Support HTB offload Maxim Mikityanskiy
2020-12-15 22:26 ` [PATCH iproute2-next] tc/htb: Hierarchical QoS hardware offload Stephen Hemminger
     [not found] ` <8c818766-ec3f-4c0b-f737-ec558613b946@gmail.com>
2021-02-02 11:46   ` Maxim Mikityanskiy
2021-02-02 15:32     ` David Ahern

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=04607f76-3548-f6d1-061c-8d5d918f4017@nvidia.com \
    --to=maximmi@nvidia.com \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=maximmi@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=xiyou.wangcong@gmail.com \
    --cc=yossiku@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.