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: <CANn89iJXFPQhDzxEyPY_34pOWCrv=L=BB+RETg2qs913=gCrSA@mail.gmail.com>
Date:   Wed, 31 Oct 2018 06:56:12 -0700
From:   Eric Dumazet <edumazet@...gle.com>
To:     Tariq Toukan <tariqt@...lanox.com>
Cc:     David Miller <davem@...emloft.net>,
        netdev <netdev@...r.kernel.org>,
        Willem de Bruijn <willemb@...gle.com>,
        Eric Dumazet <eric.dumazet@...il.com>
Subject: Re: [PATCH net 3/3] net/mlx4_en: use netdev_tx_sent_queue_more()

On Wed, Oct 31, 2018 at 4:37 AM Tariq Toukan <tariqt@...lanox.com> wrote:
>
>
>
> On 30/10/2018 1:25 AM, Eric Dumazet wrote:
> > This patch has two changes :
> >
> > 1) Use netdev_tx_sent_queue_more() for skbs with xmit_more
> >     This avoids mangling BQL status, since we only need to
> >     take care of it for the last skb of the batch.
> >
> > 2) doorbel only depends on xmit_more and netif_tx_queue_stopped()
> >
> >    While not strictly necessary after 1), it is more consistent
> >    this way.
> >
> > Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> > Cc: Tariq Toukan <tariqt@...lanox.com>
> > ---
> >   drivers/net/ethernet/mellanox/mlx4/en_tx.c | 10 ++++++++--
> >   1 file changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> > index 1857ee0f0871d48285a6d3711f7c3e9a1e08a05f..3acce02ade6a115881ecd72e4710e332d3f380cb 100644
> > --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> > +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> > @@ -1006,7 +1006,6 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
> >               ring->packets++;
> >       }
> >       ring->bytes += tx_info->nr_bytes;
> > -     netdev_tx_sent_queue(ring->tx_queue, tx_info->nr_bytes);
> >       AVG_PERF_COUNTER(priv->pstats.tx_pktsz_avg, skb->len);
> >
> >       if (tx_info->inl)
> > @@ -1044,7 +1043,14 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
> >               netif_tx_stop_queue(ring->tx_queue);
> >               ring->queue_stopped++;
> >       }
> > -     send_doorbell = !skb->xmit_more || netif_xmit_stopped(ring->tx_queue);
> > +
> > +     if (skb->xmit_more) {
> > +             netdev_tx_sent_queue_more(ring->tx_queue, tx_info->nr_bytes);
> > +             send_doorbell = netif_tx_queue_stopped(ring->tx_queue);
> > +     } else {
> > +             netdev_tx_sent_queue(ring->tx_queue, tx_info->nr_bytes);
> > +             send_doorbell = true;
> > +     }
> >
> >       real_size = (real_size / 16) & 0x3f;
> >
> >
>
> The drivers' code template would be nicer if we unify the two functions
> netdev_tx_sent_queue/netdev_tx_sent_queue_more to a single one with a
> parameter.
>
> Currently, all drivers that would want to benefit from this optimization
> will have to repeat these if/else blocks.

I can add a helper sure, but I can not change drivers that I am not
able to test.

So I can not change existing helper.

This patch series shows the problem and fixes one driver, a common
helper can be added when a second
driver is updated, there is no hurry.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ