diff mbox

[2/2] GRETH: avoid overwrite IP-stack's IP-frags checksum

Message ID 1315487676-16733-2-git-send-email-daniel@gaisler.com
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Daniel Hellstrom Sept. 8, 2011, 1:14 p.m. UTC
The GRETH GBIT core does not do checksum offloading for IP
segmentation. This patch adds a check in the xmit function to
determine if the stack has calculated the checksum for us.

Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
---
 drivers/net/greth.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

Comments

Eric Dumazet Sept. 9, 2011, 1:29 p.m. UTC | #1
Le jeudi 08 septembre 2011 à 15:14 +0200, Daniel Hellstrom a écrit :
> The GRETH GBIT core does not do checksum offloading for IP
> segmentation. This patch adds a check in the xmit function to
> determine if the stack has calculated the checksum for us.
> 
> Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
> ---
>  drivers/net/greth.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/greth.c b/drivers/net/greth.c
> index 9d39fb9..27ba855 100644
> --- a/drivers/net/greth.c
> +++ b/drivers/net/greth.c
> @@ -489,7 +489,8 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev)
>  	if (nr_frags != 0)
>  		status = GRETH_TXBD_MORE;
>  
> -	status |= GRETH_TXBD_CSALL;
> +	if (skb->ip_summed == CHECKSUM_PARTIAL)
> +		status |= GRETH_TXBD_CSALL;
>  	status |= skb_headlen(skb) & GRETH_BD_LEN;
>  	if (greth->tx_next == GRETH_TXBD_NUM_MASK)
>  		status |= GRETH_BD_WR;
> @@ -512,7 +513,9 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev)
>  		greth->tx_skbuff[curr_tx] = NULL;
>  		bdp = greth->tx_bd_base + curr_tx;
>  
> -		status = GRETH_TXBD_CSALL | GRETH_BD_EN;
> +		status = GRETH_BD_EN;
> +		if (skb->ip_summed == CHECKSUM_PARTIAL)
> +			status | GRETH_TXBD_CSALL;
		typo here ?


>  		status |= frag->size & GRETH_BD_LEN;
>  
>  		/* Wrap around descriptor ring */


--
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
Daniel Hellstrom Sept. 9, 2011, 2:41 p.m. UTC | #2
On 09/09/2011 03:29 PM, Eric Dumazet wrote:
> Le jeudi 08 septembre 2011 à 15:14 +0200, Daniel Hellstrom a écrit :
>> The GRETH GBIT core does not do checksum offloading for IP
>> segmentation. This patch adds a check in the xmit function to
>> determine if the stack has calculated the checksum for us.
>>
>> Signed-off-by: Daniel Hellstrom<daniel@gaisler.com>
>> ---
>>   drivers/net/greth.c |    7 +++++--
>>   1 files changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/greth.c b/drivers/net/greth.c
>> index 9d39fb9..27ba855 100644
>> --- a/drivers/net/greth.c
>> +++ b/drivers/net/greth.c
>> @@ -489,7 +489,8 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev)
>>   	if (nr_frags != 0)
>>   		status = GRETH_TXBD_MORE;
>>
>> -	status |= GRETH_TXBD_CSALL;
>> +	if (skb->ip_summed == CHECKSUM_PARTIAL)
>> +		status |= GRETH_TXBD_CSALL;
>>   	status |= skb_headlen(skb)&  GRETH_BD_LEN;
>>   	if (greth->tx_next == GRETH_TXBD_NUM_MASK)
>>   		status |= GRETH_BD_WR;
>> @@ -512,7 +513,9 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev)
>>   		greth->tx_skbuff[curr_tx] = NULL;
>>   		bdp = greth->tx_bd_base + curr_tx;
>>
>> -		status = GRETH_TXBD_CSALL | GRETH_BD_EN;
>> +		status = GRETH_BD_EN;
>> +		if (skb->ip_summed == CHECKSUM_PARTIAL)
>> +			status | GRETH_TXBD_CSALL;
> 		typo here ?
Hi,

You're right, I had a missed space there so the code-style check failed at that line, then I fixed that by adding a space... but must have screwed it up. Will repost patch.

Thanks,
Daniel



>
>>   		status |= frag->size&  GRETH_BD_LEN;
>>
>>   		/* Wrap around descriptor ring */
>
> --
> 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
>
>

--
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
diff mbox

Patch

diff --git a/drivers/net/greth.c b/drivers/net/greth.c
index 9d39fb9..27ba855 100644
--- a/drivers/net/greth.c
+++ b/drivers/net/greth.c
@@ -489,7 +489,8 @@  greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev)
 	if (nr_frags != 0)
 		status = GRETH_TXBD_MORE;
 
-	status |= GRETH_TXBD_CSALL;
+	if (skb->ip_summed == CHECKSUM_PARTIAL)
+		status |= GRETH_TXBD_CSALL;
 	status |= skb_headlen(skb) & GRETH_BD_LEN;
 	if (greth->tx_next == GRETH_TXBD_NUM_MASK)
 		status |= GRETH_BD_WR;
@@ -512,7 +513,9 @@  greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev)
 		greth->tx_skbuff[curr_tx] = NULL;
 		bdp = greth->tx_bd_base + curr_tx;
 
-		status = GRETH_TXBD_CSALL | GRETH_BD_EN;
+		status = GRETH_BD_EN;
+		if (skb->ip_summed == CHECKSUM_PARTIAL)
+			status | GRETH_TXBD_CSALL;
 		status |= frag->size & GRETH_BD_LEN;
 
 		/* Wrap around descriptor ring */