2 * Definitions for the 'struct sk_buff' memory handlers in U-Boot.
5 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
7 * See file CREDITS for list of people who contributed to this
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 #include "u-boot_compat.h"
32 static struct sk_buff *sk_table[MAX_SKB];
35 struct sk_buff * alloc_skb(u32 size, int dummy)
38 struct sk_buff * ret = NULL;
40 for (i = 0; i < MAX_SKB; i++)
49 sk_table[i] = malloc(sizeof(struct sk_buff));
52 printf("alloc_skb: malloc failed\n");
56 memset(sk_table[i], 0, sizeof(struct sk_buff));
57 sk_table[i]->data = sk_table[i]->data_unaligned =
59 if (! sk_table[i]->data)
61 printf("alloc_skb: malloc failed\n");
67 sk_table[i]->data += 16 - ((u32)sk_table[i]->data & 15);
68 sk_table[i]->len = size;
80 printf("Unable to allocate skb!\n");
86 void dev_kfree_skb_any(struct sk_buff *skb)
90 for (i = 0; i < MAX_SKB; i++)
92 if (sk_table[i] != skb)
97 free(skb->data_unaligned);
105 printf("SKB allocation error!\n");
109 void skb_reserve(struct sk_buff *skb, unsigned int len)
114 void skb_put(struct sk_buff *skb, unsigned int len)