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]
Date:   Wed, 25 Nov 2020 11:11:03 -0800
From:   David Awogbemila <awogbemila@...gle.com>
To:     Eric Dumazet <eric.dumazet@...il.com>
Cc:     Netdev <netdev@...r.kernel.org>,
        Alexander Duyck <alexander.duyck@...il.com>,
        Saeed Mahameed <saeed@...nel.org>,
        Catherine Sullivan <csully@...gle.com>,
        Yangchun Fu <yangchun@...gle.com>
Subject: Re: [PATCH net-next v8 4/4] gve: Add support for raw addressing in
 the tx path

>
> Code does not match the comment (Give packets to NIC.
>     Even if this packet failed to send the doorbell
>     might need to be rung because of xmit_more.)
>
> You probably meant :
>
>     if (nsegs) {
>         netdev_tx_sent_queue(tx->netdev_txq, skb->len);
>         skb_tx_timestamp(skb);
>         tx->req += nsegs;
>         if (!netif_xmit_stopped(tx->netdev_txq) && netdev_xmit_more())
>             return NETDEV_TX_OK;
>     }
>     gve_tx_put_doorbell(priv, tx->q_resources, tx->req);
>     return NETDEV_TX_OK;
>
>
> Or
>
>     if (nsegs) {
>         netdev_tx_sent_queue(tx->netdev_txq, skb->len);
>         skb_tx_timestamp(skb);
>         tx->req += nsegs;
>     }
>     if (!netif_xmit_stopped(tx->netdev_txq) && netdev_xmit_more())
>         return NETDEV_TX_OK;
>
>     gve_tx_put_doorbell(priv, tx->q_resources, tx->req);
>     return NETDEV_TX_OK;
>
> Also you forgot to free the skb if it was not sent (in case of mapping error in gve_tx_add_skb_no_copy())
>
> So you probably need to call dev_kfree_skb_any(), or risk leaking memory and freeze sockets.
>
>     if (nsegs) {
>         netdev_tx_sent_queue(tx->netdev_txq, skb->len);
>         skb_tx_timestamp(skb);
>         tx->req += nsegs;
>     } else {
>         dev_kfree_skb_any(skb);
>     }
>     if (!netif_xmit_stopped(tx->netdev_txq) && netdev_xmit_more())
>         return NETDEV_TX_OK;
>
>     gve_tx_put_doorbell(priv, tx->q_resources, tx->req);
>     return NETDEV_TX_OK;

Right, thanks for the examples Eric. I think I understand this a
little better now.
I'm trying to think about whether your second example might be better
than the first one because in the case of nsegs=0 the first example
rings the doorbell immediately regardless of xmit_more, while in the
second example, if there is xmit_more then we can delay ringing the
doorbell until we try again  - and we would be guaranteed to try again
because of xmit_more right?
My hunch for which is better is based on how __netdev_tx_sent_queue works.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ