lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALs4sv0-FeMas=rSy8OHy_HLiQxQ+gZwAfZVAdzwhFbG+tTzCg@mail.gmail.com>
Date: Thu, 3 Oct 2024 09:56:40 +0530
From: Pavan Chebbi <pavan.chebbi@...adcom.com>
To: Joe Damato <jdamato@...tly.com>, Pavan Chebbi <pavan.chebbi@...adcom.com>, 
	netdev@...r.kernel.org, Michael Chan <mchan@...adcom.com>, 
	"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, 
	open list <linux-kernel@...r.kernel.org>
Subject: Re: [RFC net-next v2 2/2] tg3: Link queues to NAPIs

On Thu, Oct 3, 2024 at 4:51 AM Joe Damato <jdamato@...tly.com> wrote:
>

> This is happening because the code in the driver does this:
>
>   for (i = 0; i < tp->irq_cnt; i++) {
>           tnapi = &tp->napi[i];
>           napi_enable(&tnapi->napi);
>           if (tnapi->tx_buffers)
>                 netif_queue_set_napi(tp->dev, i, NETDEV_QUEUE_TYPE_TX,
>                                      &tnapi->napi);
>
> The code I added assumed that i is the txq or rxq index, but it's
> not - it's the index into the array of struct tg3_napi.

Yes, you are right..
>
> Corrected, the code looks like something like this:
>
>   int txq_idx = 0, rxq_idx = 0;
>   [...]
>
>   for (i = 0; i < tp->irq_cnt; i++) {
>           tnapi = &tp->napi[i];
>           napi_enable(&tnapi->napi);
>           if (tnapi->tx_buffers) {
>                 netif_queue_set_napi(tp->dev, txq_idx, NETDEV_QUEUE_TYPE_TX,
>                                      &tnapi->napi);
>                 txq_idx++
>           } else if (tnapi->rx_rcb) {
>                  netif_queue_set_napi(tp->dev, rxq_idx, NETDEV_QUEUE_TYPE_RX,
>                                       &tnapi->napi);
>                  rxq_idx++;
>           [...]
>
> I tested that and the output looks correct to me. However, what to
> do about tg3_napi_disable ?
>
> Probably something like this (txq only for brevity):
>
>   int txq_idx = tp->txq_cnt - 1;
>   [...]
>
>   for (i = tp->irq_cnt - 1; i >= 0; i--) {
>     [...]
>     if (tnapi->tx_buffers) {
>         netif_queue_set_napi(tp->dev, txq_idx, NETDEV_QUEUE_TYPE_TX,
>                              NULL);
>         txq_idx--;
>     }
>     [...]
>
> Does that seem correct to you? I wanted to ask before sending
> another revision, since I am not a tg3 expert.
>

The local counter variable for the ring ids might work because irqs
are requested sequentially.
Thinking out loud, a better way would be to save the tx/rx id inside
their struct tg3_napi in the tg3_request_irq() function.
And have a separate new function (I know you did something similar for
v1 of irq-napi linking) to link queues and napi.
I think it should work, and should help during de-linking also. Let me
know what you think.

Download attachment "smime.p7s" of type "application/pkcs7-signature" (4209 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ