Subject: Re: problems with e1000 and jumboframes

From: Arnd Hannemann <[email-masked]>
Date: Thu, 03 Aug 2006 20:09:07 +0200

Evgeniy Polyakov schrieb:
> On Thu, Aug 03, 2006 at 07:16:31PM +0400, Evgeniy Polyakov ([email-masked]) wrote:
>>>> then skb_alloc adds a little
>>>> (sizeof(struct skb_shared_info)) at the end, and this ends up
>>>> in 32k request just for 9k jumbo frame.
>>> Strange, why this skb_shared_info cannon be added before first alignment? 
>>> And what about smaller frames like 1500, does this driver behave similar 
>>> (first align then add)?
>> It can be.
>> Could attached  (completely untested) patch help?
> 
> Actually this patch will not help, this new one could.
> 

I applied the attached pachted. And got this output:

> Intel(R) PRO/1000 Network Driver - bufsz 13762
> Intel(R) PRO/1000 Network Driver - bufsz 16222
> Intel(R) PRO/1000 Network Driver - bufsz 16058
> Intel(R) PRO/1000 Network Driver - bufsz 15894
> Intel(R) PRO/1000 Network Driver - bufsz 15730
> Intel(R) PRO/1000 Network Driver - bufsz 15566
> Intel(R) PRO/1000 Network Driver - bufsz 15402
> Intel(R) PRO/1000 Network Driver - bufsz 15238
> Intel(R) PRO/1000 Network Driver - bufsz 15074
> Intel(R) PRO/1000 Network Driver - bufsz 14910
> Intel(R) PRO/1000 Network Driver - bufsz 14746
> Intel(R) PRO/1000 Network Driver - bufsz 14582
> Intel(R) PRO/1000 Network Driver - bufsz 14418
> Intel(R) PRO/1000 Network Driver - bufsz 14254
> Intel(R) PRO/1000 Network Driver - bufsz 14090
> Intel(R) PRO/1000 Network Driver - bufsz 13926
> Intel(R) PRO/1000 Network Driver - bufsz 13762
> Intel(R) PRO/1000 Network Driver - bufsz 16222
> Intel(R) PRO/1000 Network Driver - bufsz 16058
> Intel(R) PRO/1000 Network Driver - bufsz 15894
> Intel(R) PRO/1000 Network Driver - bufsz 15730
> Intel(R) PRO/1000 Network Driver - bufsz 15566
> Intel(R) PRO/1000 Network Driver - bufsz 15402
> Intel(R) PRO/1000 Network Driver - bufsz 15238
> Intel(R) PRO/1000 Network Driver - bufsz 15074
> Intel(R) PRO/1000 Network Driver - bufsz 14910
> Intel(R) PRO/1000 Network Driver - bufsz 14746
> Intel(R) PRO/1000 Network Driver - bufsz 14582
> Intel(R) PRO/1000 Network Driver - bufsz 14418
> Intel(R) PRO/1000 Network Driver - bufsz 16222
> Intel(R) PRO/1000 Network Driver - bufsz 16222
> Intel(R) PRO/1000 Network Driver - bufsz 16222
> Intel(R) PRO/1000 Network Driver - bufsz 16222
> Intel(R) PRO/1000 Network Driver - bufsz 16222
> Intel(R) PRO/1000 Network Driver - bufsz 16222
> Intel(R) PRO/1000 Network Driver - bufsz 16222
> Intel(R) PRO/1000 Network Driver - bufsz 16222
> Intel(R) PRO/1000 Network Driver - bufsz 16222
> Intel(R) PRO/1000 Network Driver - bufsz 16222
> Intel(R) PRO/1000 Network Driver - bufsz 16222

I'm a bit puzzled that there are so much allocations. However the patch
seems to work. (at least not obviously breaks things for me yet)

Best regards
Arnd

--- linux-2.6.17.6/drivers/net/e1000/e1000_main.c	2006-08-03 17:38:53.000000000 +0200
+++ linux-2.6.17.6.patched/drivers/net/e1000/e1000_main.c	2006-08-03 19:38:53.000000000 +0200
@@ -3843,9 +3843,13 @@
 	buffer_info = &rx_ring->buffer_info[i];
 
 	while (cleaned_count--) {
-		if (!(skb = buffer_info->skb))
+		if (!(skb = buffer_info->skb)) {
+			if (SKB_DATA_ALIGN(adapter->hw.max_frame_size) + sizeof(struct skb_shared_info) <= bufsz) {
+				bufsz -= sizeof(struct skb_shared_info);
+				printk(KERN_INFO "%s - bufsz %d\n",e1000_driver_string, bufsz);
+			}
 			skb = dev_alloc_skb(bufsz);
-		else {
+		} else {
 			skb_trim(skb, 0);
 			goto map_skb;
 		}