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] [thread-next>] [day] [month] [year] [list]
Message-ID: <bd875e05-ba3a-bee9-6876-70d37639e4bc@mellanox.com>
Date:   Wed, 31 Oct 2018 11:37:07 +0000
From:   Tariq Toukan <tariqt@...lanox.com>
To:     Eric Dumazet <edumazet@...gle.com>,
        "David S . Miller" <davem@...emloft.net>
CC:     netdev <netdev@...r.kernel.org>,
        Willem de Bruijn <willemb@...gle.com>,
        Tariq Toukan <tariqt@...lanox.com>,
        Eric Dumazet <eric.dumazet@...il.com>
Subject: Re: [PATCH net 3/3] net/mlx4_en: use netdev_tx_sent_queue_more()



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.

Regards,
Tariq

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ