diff mbox

[net] tg3: Expand 4g_overflow_test workaround to skb fragments of any size.

Message ID 1387499052-7838-1-git-send-email-nsujir@broadcom.com
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Nithin Sujir Dec. 20, 2013, 12:24 a.m. UTC
The current driver assumes that an skb fragment can only be upto jumbo
size. Presumably this was a fast-path optimization. This assumption is
no longer true as fragments can be upto 32k.

Cc: stable@vger.kernel.org
Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
 drivers/net/ethernet/broadcom/tg3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Dumazet Dec. 20, 2013, 12:38 a.m. UTC | #1
On Thu, 2013-12-19 at 16:24 -0800, Nithin Nayak Sujir wrote:
> The current driver assumes that an skb fragment can only be upto jumbo
> size. Presumably this was a fast-path optimization. This assumption is
> no longer true as fragments can be upto 32k.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
> Signed-off-by: Michael Chan <mchan@broadcom.com>
> ---
>  drivers/net/ethernet/broadcom/tg3.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index f3dd93b..8ab21d7 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -7622,7 +7622,7 @@ static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len)
>  {
>  	u32 base = (u32) mapping & 0xffffffff;
>  
> -	return (base > 0xffffdcc0) && (base + len + 8 < base);
> +	return (base + len + 8 < base);
>  }

And it is actually faster ;)

What is 8 value exactly ?



--
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
Eric Dumazet Dec. 20, 2013, 12:41 a.m. UTC | #2
On Thu, 2013-12-19 at 16:24 -0800, Nithin Nayak Sujir wrote:
> The current driver assumes that an skb fragment can only be upto jumbo
> size. Presumably this was a fast-path optimization. This assumption is
> no longer true as fragments can be upto 32k.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
> Signed-off-by: Michael Chan <mchan@broadcom.com>
> ---
>  drivers/net/ethernet/broadcom/tg3.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index f3dd93b..8ab21d7 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -7622,7 +7622,7 @@ static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len)
>  {
>  	u32 base = (u32) mapping & 0xffffffff;
>  
> -	return (base > 0xffffdcc0) && (base + len + 8 < base);
> +	return (base + len + 8 < base);
>  }
>  
>  /* Test for TSO DMA buffers that cross into regions which are within MSS bytes

btw this is also :

return base + len + 8 < base;



--
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
Nithin Sujir Dec. 20, 2013, 1:33 a.m. UTC | #3
>> -	return (base > 0xffffdcc0) && (base + len + 8 < base);
>> +	return (base + len + 8 < base);
>>   }
>
> And it is actually faster ;)
>
> What is 8 value exactly ?
>
>

Some older devices needed to be at least 8 bytes away from the boundary. For 
simplicity we use the same check for all devices.

--
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
Nithin Sujir Dec. 20, 2013, 1:35 a.m. UTC | #4
On 12/19/2013 04:41 PM, Eric Dumazet wrote:
> On Thu, 2013-12-19 at 16:24 -0800, Nithin Nayak Sujir wrote:
>> The current driver assumes that an skb fragment can only be upto jumbo
>> size. Presumably this was a fast-path optimization. This assumption is
>> no longer true as fragments can be upto 32k.
>>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
>> Signed-off-by: Michael Chan <mchan@broadcom.com>
>> ---
>>   drivers/net/ethernet/broadcom/tg3.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
>> index f3dd93b..8ab21d7 100644
>> --- a/drivers/net/ethernet/broadcom/tg3.c
>> +++ b/drivers/net/ethernet/broadcom/tg3.c
>> @@ -7622,7 +7622,7 @@ static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len)
>>   {
>>   	u32 base = (u32) mapping & 0xffffffff;
>>
>> -	return (base > 0xffffdcc0) && (base + len + 8 < base);
>> +	return (base + len + 8 < base);
>>   }
>>
>>   /* Test for TSO DMA buffers that cross into regions which are within MSS bytes
>
> btw this is also :
>
> return base + len + 8 < base;
>
>
>

I'll send a v2.

--
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/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index f3dd93b..8ab21d7 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -7622,7 +7622,7 @@  static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len)
 {
 	u32 base = (u32) mapping & 0xffffffff;
 
-	return (base > 0xffffdcc0) && (base + len + 8 < base);
+	return (base + len + 8 < base);
 }
 
 /* Test for TSO DMA buffers that cross into regions which are within MSS bytes