netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] mlx4: TCP/UDP packets have L4 hash
@ 2015-07-02 11:24 Eric Dumazet
  2015-07-05 21:16 ` Ido Shamay
  2015-07-08 20:45 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Dumazet @ 2015-07-02 11:24 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Amir Vadai, Ido Shamay

From: Eric Dumazet <edumazet@google.com>

Mellanox driver has the knowledge if rxhash is a L4 hash,
if it receives a non fragmented TCP or UDP frame and
NETIF_F_RXCSUM is enabled on netdev.

ip_summed value is CHECKSUM_UNNECESSARY in this case.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Amir Vadai <amirv@mellanox.com>
Cc: Ido Shamay <idos@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_rx.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index 7a4f20bb7fcb..12c65e1ad6a9 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -917,7 +917,9 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
 			if (dev->features & NETIF_F_RXHASH)
 				skb_set_hash(gro_skb,
 					     be32_to_cpu(cqe->immed_rss_invalid),
-					     PKT_HASH_TYPE_L3);
+					     (ip_summed == CHECKSUM_UNNECESSARY) ?
+						PKT_HASH_TYPE_L4 :
+						PKT_HASH_TYPE_L3);
 
 			skb_record_rx_queue(gro_skb, cq->ring);
 			skb_mark_napi_id(gro_skb, &cq->napi);
@@ -963,7 +965,9 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
 		if (dev->features & NETIF_F_RXHASH)
 			skb_set_hash(skb,
 				     be32_to_cpu(cqe->immed_rss_invalid),
-				     PKT_HASH_TYPE_L3);
+				     (ip_summed == CHECKSUM_UNNECESSARY) ?
+					PKT_HASH_TYPE_L4 :
+					PKT_HASH_TYPE_L3);
 
 		if ((be32_to_cpu(cqe->vlan_my_qpn) &
 		    MLX4_CQE_VLAN_PRESENT_MASK) &&

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net] mlx4: TCP/UDP packets have L4 hash
  2015-07-02 11:24 [PATCH net] mlx4: TCP/UDP packets have L4 hash Eric Dumazet
@ 2015-07-05 21:16 ` Ido Shamay
  2015-07-05 21:33   ` Eric Dumazet
  2015-07-08 20:45 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Ido Shamay @ 2015-07-05 21:16 UTC (permalink / raw)
  To: Eric Dumazet, David Miller; +Cc: netdev, Amir Vadai, Ido Shamay

On 7/2/2015 2:24 PM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> Mellanox driver has the knowledge if rxhash is a L4 hash,
> if it receives a non fragmented TCP or UDP frame and
> NETIF_F_RXCSUM is enabled on netdev.
>
> ip_summed value is CHECKSUM_UNNECESSARY in this case.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Amir Vadai <amirv@mellanox.com>
> Cc: Ido Shamay <idos@mellanox.com>
> ---
>   drivers/net/ethernet/mellanox/mlx4/en_rx.c |    8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> index 7a4f20bb7fcb..12c65e1ad6a9 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> @@ -917,7 +917,9 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
>   			if (dev->features & NETIF_F_RXHASH)
>   				skb_set_hash(gro_skb,
>   					     be32_to_cpu(cqe->immed_rss_invalid),
> -					     PKT_HASH_TYPE_L3);
> +					     (ip_summed == CHECKSUM_UNNECESSARY) ?
> +						PKT_HASH_TYPE_L4 :
> +						PKT_HASH_TYPE_L3);
Thanks Eric,

We can have a relaxation of the condition  by looking only at TCP/UDP 
CQE indication (without check-sum indications)
This can cover us also when device rx-checksuming feature is off.
Do we want it or a correlation between check-sum and l4_hash is needed?

Ido
>   
>   			skb_record_rx_queue(gro_skb, cq->ring);
>   			skb_mark_napi_id(gro_skb, &cq->napi);
> @@ -963,7 +965,9 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
>   		if (dev->features & NETIF_F_RXHASH)
>   			skb_set_hash(skb,
>   				     be32_to_cpu(cqe->immed_rss_invalid),
> -				     PKT_HASH_TYPE_L3);
> +				     (ip_summed == CHECKSUM_UNNECESSARY) ?
> +					PKT_HASH_TYPE_L4 :
> +					PKT_HASH_TYPE_L3);
>   
>   		if ((be32_to_cpu(cqe->vlan_my_qpn) &
>   		    MLX4_CQE_VLAN_PRESENT_MASK) &&
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] mlx4: TCP/UDP packets have L4 hash
  2015-07-05 21:16 ` Ido Shamay
@ 2015-07-05 21:33   ` Eric Dumazet
  2015-07-05 21:44     ` Ido Shamay
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2015-07-05 21:33 UTC (permalink / raw)
  To: Ido Shamay; +Cc: David Miller, netdev, Amir Vadai, Ido Shamay

On Mon, 2015-07-06 at 00:16 +0300, Ido Shamay wrote:

> We can have a relaxation of the condition  by looking only at TCP/UDP 
> CQE indication (without check-sum indications)
> This can cover us also when device rx-checksuming feature is off.
> Do we want it or a correlation between check-sum and l4_hash is needed?

I thought about that, but this was adding a more complex test in fast
path.

Not sure we should care here, as nobody would disable hardware checksum
if they care about performance.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] mlx4: TCP/UDP packets have L4 hash
  2015-07-05 21:33   ` Eric Dumazet
@ 2015-07-05 21:44     ` Ido Shamay
  0 siblings, 0 replies; 5+ messages in thread
From: Ido Shamay @ 2015-07-05 21:44 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev, Amir Vadai, Ido Shamay

On 7/6/2015 12:33 AM, Eric Dumazet wrote:
> On Mon, 2015-07-06 at 00:16 +0300, Ido Shamay wrote:
>
>> We can have a relaxation of the condition  by looking only at TCP/UDP
>> CQE indication (without check-sum indications)
>> This can cover us also when device rx-checksuming feature is off.
>> Do we want it or a correlation between check-sum and l4_hash is needed?
> I thought about that, but this was adding a more complex test in fast
> path.
>
> Not sure we should care here, as nobody would disable hardware checksum
> if they care about performance.
I agree, thank you Eric
Acked-by: Ido Shamay <idos@mellanox.com>
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] mlx4: TCP/UDP packets have L4 hash
  2015-07-02 11:24 [PATCH net] mlx4: TCP/UDP packets have L4 hash Eric Dumazet
  2015-07-05 21:16 ` Ido Shamay
@ 2015-07-08 20:45 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2015-07-08 20:45 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, amirv, idos

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 02 Jul 2015 13:24:44 +0200

> From: Eric Dumazet <edumazet@google.com>
> 
> Mellanox driver has the knowledge if rxhash is a L4 hash,
> if it receives a non fragmented TCP or UDP frame and
> NETIF_F_RXCSUM is enabled on netdev.
> 
> ip_summed value is CHECKSUM_UNNECESSARY in this case.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied to net-next, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-07-08 20:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-02 11:24 [PATCH net] mlx4: TCP/UDP packets have L4 hash Eric Dumazet
2015-07-05 21:16 ` Ido Shamay
2015-07-05 21:33   ` Eric Dumazet
2015-07-05 21:44     ` Ido Shamay
2015-07-08 20:45 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).