net: Allow netdevices to specify needed head/tailroom
This patch adds needed_headroom/needed_tailroom members to struct net_device and updates many places that allocate sbks to use them. Not all of them can be converted though, and I'm sure I missed some (I mostly grepped for LL_RESERVED_SPACE) Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
8388e3da34
commit
f5184d267c
@@ -780,7 +780,7 @@ slow_path:
|
||||
* Allocate buffer.
|
||||
*/
|
||||
|
||||
if ((frag = alloc_skb(len+hlen+sizeof(struct frag_hdr)+LL_RESERVED_SPACE(rt->u.dst.dev), GFP_ATOMIC)) == NULL) {
|
||||
if ((frag = alloc_skb(len+hlen+sizeof(struct frag_hdr)+LL_ALLOCATED_SPACE(rt->u.dst.dev), GFP_ATOMIC)) == NULL) {
|
||||
NETDEBUG(KERN_INFO "IPv6: frag: no memory for new fragment!\n");
|
||||
IP6_INC_STATS(ip6_dst_idev(skb->dst),
|
||||
IPSTATS_MIB_FRAGFAILS);
|
||||
|
@@ -1411,7 +1411,7 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size)
|
||||
IPV6_TLV_PADN, 0 };
|
||||
|
||||
/* we assume size > sizeof(ra) here */
|
||||
skb = sock_alloc_send_skb(sk, size + LL_RESERVED_SPACE(dev), 1, &err);
|
||||
skb = sock_alloc_send_skb(sk, size + LL_ALLOCATED_SPACE(dev), 1, &err);
|
||||
|
||||
if (!skb)
|
||||
return NULL;
|
||||
@@ -1790,7 +1790,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
|
||||
payload_len = len + sizeof(ra);
|
||||
full_len = sizeof(struct ipv6hdr) + payload_len;
|
||||
|
||||
skb = sock_alloc_send_skb(sk, LL_RESERVED_SPACE(dev) + full_len, 1, &err);
|
||||
skb = sock_alloc_send_skb(sk, LL_ALLOCATED_SPACE(dev) + full_len, 1, &err);
|
||||
|
||||
if (skb == NULL) {
|
||||
rcu_read_lock();
|
||||
|
@@ -479,7 +479,7 @@ static void __ndisc_send(struct net_device *dev,
|
||||
|
||||
skb = sock_alloc_send_skb(sk,
|
||||
(MAX_HEADER + sizeof(struct ipv6hdr) +
|
||||
len + LL_RESERVED_SPACE(dev)),
|
||||
len + LL_ALLOCATED_SPACE(dev)),
|
||||
1, &err);
|
||||
if (!skb) {
|
||||
ND_PRINTK0(KERN_ERR
|
||||
@@ -1521,7 +1521,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
|
||||
|
||||
buff = sock_alloc_send_skb(sk,
|
||||
(MAX_HEADER + sizeof(struct ipv6hdr) +
|
||||
len + LL_RESERVED_SPACE(dev)),
|
||||
len + LL_ALLOCATED_SPACE(dev)),
|
||||
1, &err);
|
||||
if (buff == NULL) {
|
||||
ND_PRINTK0(KERN_ERR
|
||||
|
@@ -609,7 +609,6 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
|
||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||
struct ipv6hdr *iph;
|
||||
struct sk_buff *skb;
|
||||
unsigned int hh_len;
|
||||
int err;
|
||||
|
||||
if (length > rt->u.dst.dev->mtu) {
|
||||
@@ -619,13 +618,12 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
|
||||
if (flags&MSG_PROBE)
|
||||
goto out;
|
||||
|
||||
hh_len = LL_RESERVED_SPACE(rt->u.dst.dev);
|
||||
|
||||
skb = sock_alloc_send_skb(sk, length+hh_len+15,
|
||||
flags&MSG_DONTWAIT, &err);
|
||||
skb = sock_alloc_send_skb(sk,
|
||||
length + LL_ALLOCATED_SPACE(rt->u.dst.dev) + 15,
|
||||
flags & MSG_DONTWAIT, &err);
|
||||
if (skb == NULL)
|
||||
goto error;
|
||||
skb_reserve(skb, hh_len);
|
||||
skb_reserve(skb, LL_RESERVED_SPACE(rt->u.dst.dev));
|
||||
|
||||
skb->priority = sk->sk_priority;
|
||||
skb->mark = sk->sk_mark;
|
||||
|
Reference in New Issue
Block a user