Skip to contentSkip to conversation

small patch - 2.4.21-pre7 net/core/bk

PATCH Grzegorz Jaskiewicz 1 participant 2 messages Apr 21, 2003

lore
Share & tools
lore
#0 lore raw

Maybe i just don't understeand this part of code, but i think we should not give calling driver five chances :)

---------------------------------------------------------------

core/skbuff.c.org 2003-04-21 19:42:35.000000000 +0100 renamed from core/skbuff.c 2003-04-21 19:43:10.000000000 +0100 +3 -3
@@ -167,9 +167,13 @@
        u8 *data;
 
        if (in_interrupt() && (gfp_mask & __GFP_WAIT)) {
-               printk(KERN_ERR "alloc_skb called nonatomically "
-                      "from interrupt %p\n", NET_CALLER(size));
-               BUG();
+               static int count = 0;
+               if (++count < 5) {
+                       printk(KERN_ERR "alloc_skb called nonatomically

"
+ "from interrupt %p\n", NET_CALLER(size));
+ BUG();
+ }

+               gfp_mask &= ~__GFP_WAIT;
        }
 
        /* Get the HEAD */

---------------------------------------------------------------

Also, i am bit confused with this part :

     /* Get the DATA. Size must match skb_add_mtu(). */
        size = SKB_DATA_ALIGN(size);
        data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask);
        if (data == NULL)
                goto nodata;

        /* XXX: does not include slab overhead */ 
        skb->truesize = size + sizeof(struct sk_buff);

can anybody explain me please why skb->truesize gets size+sizeof(struct sk_buff) (acording to XXX above it, it is incorrect).

Signature · 2 lines
Grzegorz Jaskiewicz aka Kain/K4
K4 labs
#1 lore raw
Quoted 1 line · Grzegorz Jaskiewicz

Maybe i just don't understeand this part of code, but i think we

should

Quoted 2 lines

not give calling driver five chances :)

of course it should be:
-----------------------------------------------------------------

core/skbuff.c 2003-04-21 19:43:10.000000000 +0100 renamed from core/skbuff.c.org 2003-04-21 19:42:35.000000000 +0100 +0 -3
@@ -167,13 +167,9 @@
        u8 *data;
 
        if (in_interrupt() && (gfp_mask & __GFP_WAIT)) {
-               static int count = 0;
-               if (++count < 5) {
-                       printk(KERN_ERR "alloc_skb called nonatomically

"
- "from interrupt %p\n", NET_CALLER(size));
- BUG();

-               }
-               gfp_mask &= ~__GFP_WAIT;
+               printk(KERN_ERR "alloc_skb called nonatomically "
+                      "from interrupt %p\n", NET_CALLER(size));
+               BUG();
        }
 
        /* Get the HEAD */

-----------------------------------------------------------------

Quoted 4 lines

Also, i am bit confused with this part :

     /* Get the DATA. Size must match skb_add_mtu(). */
        size = SKB_DATA_ALIGN(size);
        data = kmalloc(size + sizeof(struct skb_shared_info),

gfp_mask);

Quoted 7 lines
        if (data == NULL)
                goto nodata;

        /* XXX: does not include slab overhead */ 
        skb->truesize = size + sizeof(struct sk_buff);

can anybody explain me please why skb->truesize gets

size+sizeof(struct

Quoted 1 line

sk_buff) (acording to XXX above it, it is incorrect).

--
Grzegorz Jaskiewicz aka Kain/K4
K4 labs