[PATCH 1/2 v2] mv643xx_eth: use sw csum for big packets

Saeed Bishara saeed at marvell.com
Thu Jun 10 03:38:05 EDT 2010


 

>-----Original Message-----
>From: Lennert Buytenhek [mailto:buytenh at wantstofly.org] 
>Sent: Thursday, June 10, 2010 9:44 AM
>To: Saeed Bishara
>Cc: linux-net at vger.kernel.org; linux-arm-kernel at lists.infradead.org
>Subject: Re: [PATCH 1/2 v2] mv643xx_eth: use sw csum for big packets
>
>On Wed, Jun 09, 2010 at 11:51:23AM +0300, Saeed Bishara wrote:
>
>> diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
>> index e345ec8..2d0e06b 100644
>> --- a/drivers/net/mv643xx_eth.c
>> +++ b/drivers/net/mv643xx_eth.c
>> @@ -289,6 +289,7 @@ struct mv643xx_eth_shared_private {
>>  	unsigned int t_clk;
>>  	int extended_rx_coal_limit;
>>  	int tx_bw_control;
>> +	int tx_csum_limit;
>>  };
>>  
>>  #define TX_BW_CONTROL_ABSENT		0
>> @@ -782,7 +783,8 @@ static int txq_submit_skb(struct 
>tx_queue *txq, struct sk_buff *skb)
>>  		       skb->protocol != htons(ETH_P_8021Q));
>>  
>>  		tag_bytes = (void *)ip_hdr(skb) - (void 
>*)skb->data - ETH_HLEN;
>> -		if (unlikely(tag_bytes & ~12)) {
>> +		if (unlikely(tag_bytes & ~12) ||
>> +			skb->len > mp->shared->tx_csum_limit) {
>
>Please line up skb->len with unlikely() on the line above it.
>
>
>> @@ -2666,6 +2668,9 @@ static int 
>mv643xx_eth_shared_probe(struct platform_device *pdev)
>>  	 * Detect hardware parameters.
>>  	 */
>>  	msp->t_clk = (pd != NULL && pd->t_clk != 0) ? pd->t_clk 
>: 133000000;
>> +	msp->tx_csum_limit = pd->tx_csum_limit ? 
>pd->tx_csum_limit : 9 * 1024;
>> +	/* add header count so we can compare against skb->len */
>> +	msp->tx_csum_limit += ETH_HLEN;
>>  	infer_hw_params(msp);
>
>Is the limit 9 * 1024 + 14 for the whole packet, or 9 * 1024 for the IP
>part?
the limit is for the IP part, but I thought that adding the header length, then comparing agains skb->len will be the same. What do you suggest?

>
>I.e. what happens if skb->len is 9 * 1024 + 15, but there is one VLAN
>tag present -- will the hardware be able to do the checksum offload or
>not?
>


More information about the linux-arm-kernel mailing list