netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next-2.6 2/7] be2net: Checksum field valid only for TCP/UDP
@ 2011-03-07 13:08 Padmanabh Ratnakar
  2011-03-11  0:05 ` Ram Pai
  0 siblings, 1 reply; 3+ messages in thread
From: Padmanabh Ratnakar @ 2011-03-07 13:08 UTC (permalink / raw)
  To: netdev, davem; +Cc: Padmanabh Ratnakar, Sathya Perla, Subramanian Seetharaman

L4 checksum field is valid only for TCP/UDP packets in Lancer

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: Subramanian Seetharaman <subbu.seetharaman@emulex.com>
---
 drivers/net/benet/be_main.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index bf34434..ac7ae21 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -865,14 +865,17 @@ static void be_rx_stats_update(struct be_rx_obj *rxo,
 
 static inline bool csum_passed(struct be_eth_rx_compl *rxcp)
 {
-	u8 l4_cksm, ipv6, ipcksm;
+	u8 l4_cksm, ipv6, ipcksm, tcpf, udpf;
 
 	l4_cksm = AMAP_GET_BITS(struct amap_eth_rx_compl, l4_cksm, rxcp);
 	ipcksm = AMAP_GET_BITS(struct amap_eth_rx_compl, ipcksm, rxcp);
 	ipv6 = AMAP_GET_BITS(struct amap_eth_rx_compl, ip_version, rxcp);
+	tcpf = AMAP_GET_BITS(struct amap_eth_rx_compl, tcpf, rxcp);
+	udpf = AMAP_GET_BITS(struct amap_eth_rx_compl, udpf, rxcp);
 
-	/* Ignore ipcksm for ipv6 pkts */
-	return l4_cksm && (ipcksm || ipv6);
+	/* L4 checksum is not reliable for non TCP/UDP packets.
+	 * Also ignore ipcksm for ipv6 pkts */
+	return (tcpf || udpf) && l4_cksm && (ipcksm || ipv6);
 }
 
 static struct be_rx_page_info *
-- 
1.6.0.2


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

* Re: [PATCH net-next-2.6 2/7] be2net: Checksum field valid only for TCP/UDP
  2011-03-07 13:08 [PATCH net-next-2.6 2/7] be2net: Checksum field valid only for TCP/UDP Padmanabh Ratnakar
@ 2011-03-11  0:05 ` Ram Pai
  2011-03-11 10:04   ` Padmanabh.Ratnakar
  0 siblings, 1 reply; 3+ messages in thread
From: Ram Pai @ 2011-03-11  0:05 UTC (permalink / raw)
  To: Padmanabh Ratnakar; +Cc: netdev, davem, Sathya Perla, Subramanian Seetharaman

On Mon, Mar 07, 2011 at 06:38:16PM +0530, Padmanabh Ratnakar wrote:
> L4 checksum field is valid only for TCP/UDP packets in Lancer
> 
> Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
> Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
> Signed-off-by: Subramanian Seetharaman <subbu.seetharaman@emulex.com>
> ---
>  drivers/net/benet/be_main.c |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
> index bf34434..ac7ae21 100644
> --- a/drivers/net/benet/be_main.c
> +++ b/drivers/net/benet/be_main.c
> @@ -865,14 +865,17 @@ static void be_rx_stats_update(struct be_rx_obj *rxo,
> 
>  static inline bool csum_passed(struct be_eth_rx_compl *rxcp)
>  {
> -	u8 l4_cksm, ipv6, ipcksm;
> +	u8 l4_cksm, ipv6, ipcksm, tcpf, udpf;
> 
>  	l4_cksm = AMAP_GET_BITS(struct amap_eth_rx_compl, l4_cksm, rxcp);
>  	ipcksm = AMAP_GET_BITS(struct amap_eth_rx_compl, ipcksm, rxcp);
>  	ipv6 = AMAP_GET_BITS(struct amap_eth_rx_compl, ip_version, rxcp);
> +	tcpf = AMAP_GET_BITS(struct amap_eth_rx_compl, tcpf, rxcp);
> +	udpf = AMAP_GET_BITS(struct amap_eth_rx_compl, udpf, rxcp);
> 
> -	/* Ignore ipcksm for ipv6 pkts */
> -	return l4_cksm && (ipcksm || ipv6);
> +	/* L4 checksum is not reliable for non TCP/UDP packets.
> +	 * Also ignore ipcksm for ipv6 pkts */
> +	return (tcpf || udpf) && l4_cksm && (ipcksm || ipv6);

Is it invalid for non-Lancer too ?  if not, then should'nt the
above condition be applied only for lancer?

RP

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

* RE: [PATCH net-next-2.6 2/7] be2net: Checksum field valid only for TCP/UDP
  2011-03-11  0:05 ` Ram Pai
@ 2011-03-11 10:04   ` Padmanabh.Ratnakar
  0 siblings, 0 replies; 3+ messages in thread
From: Padmanabh.Ratnakar @ 2011-03-11 10:04 UTC (permalink / raw)
  To: linuxram; +Cc: netdev, davem, Sathya.Perla, subbu.seetharaman

On Mon, Mar 07, 2011 at 06:38:16PM +0530, Padmanabh Ratnakar wrote:
> L4 checksum field is valid only for TCP/UDP packets in Lancer
> 
> Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
> Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
> Signed-off-by: Subramanian Seetharaman <subbu.seetharaman@emulex.com>
> ---
>  drivers/net/benet/be_main.c |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
> index bf34434..ac7ae21 100644
> --- a/drivers/net/benet/be_main.c
> +++ b/drivers/net/benet/be_main.c
> @@ -865,14 +865,17 @@ static void be_rx_stats_update(struct be_rx_obj *rxo,
> 
>  static inline bool csum_passed(struct be_eth_rx_compl *rxcp)
>  {
> -	u8 l4_cksm, ipv6, ipcksm;
> +	u8 l4_cksm, ipv6, ipcksm, tcpf, udpf;
> 
>  	l4_cksm = AMAP_GET_BITS(struct amap_eth_rx_compl, l4_cksm, rxcp);
>  	ipcksm = AMAP_GET_BITS(struct amap_eth_rx_compl, ipcksm, rxcp);
>  	ipv6 = AMAP_GET_BITS(struct amap_eth_rx_compl, ip_version, rxcp);
> +	tcpf = AMAP_GET_BITS(struct amap_eth_rx_compl, tcpf, rxcp);
> +	udpf = AMAP_GET_BITS(struct amap_eth_rx_compl, udpf, rxcp);
> 
> -	/* Ignore ipcksm for ipv6 pkts */
> -	return l4_cksm && (ipcksm || ipv6);
> +	/* L4 checksum is not reliable for non TCP/UDP packets.
> +	 * Also ignore ipcksm for ipv6 pkts */
> +	return (tcpf || udpf) && l4_cksm && (ipcksm || ipv6);

> Is it invalid for non-Lancer too ?  if not, then should'nt the
> above condition be applied only for lancer?

> RP

There is no need to apply this condition only for Lancer. This check works for BE too.
In BE, for non-tcp/udp packets l4_csum is always 0.

Thanks,
Padmanabh

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

end of thread, other threads:[~2011-03-11 10:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-07 13:08 [PATCH net-next-2.6 2/7] be2net: Checksum field valid only for TCP/UDP Padmanabh Ratnakar
2011-03-11  0:05 ` Ram Pai
2011-03-11 10:04   ` Padmanabh.Ratnakar

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).