Commit 1b8da39b authored by David S. Miller's avatar David S. Miller

Merge davem@nuts.davemloft.net:/disk1/BK/net-2.6

into kernel.bkbits.net:/home/davem/net-2.6
parents 7b51a623 8874390e
...@@ -193,10 +193,6 @@ extern struct sctp_globals { ...@@ -193,10 +193,6 @@ extern struct sctp_globals {
/* Flag to indicate if addip is enabled. */ /* Flag to indicate if addip is enabled. */
int addip_enable; int addip_enable;
/* socket receive and send buffer sizes. */
int rmem;
int wmem;
} sctp_globals; } sctp_globals;
#define sctp_rto_initial (sctp_globals.rto_initial) #define sctp_rto_initial (sctp_globals.rto_initial)
...@@ -225,8 +221,6 @@ extern struct sctp_globals { ...@@ -225,8 +221,6 @@ extern struct sctp_globals {
#define sctp_local_addr_list (sctp_globals.local_addr_list) #define sctp_local_addr_list (sctp_globals.local_addr_list)
#define sctp_local_addr_lock (sctp_globals.local_addr_lock) #define sctp_local_addr_lock (sctp_globals.local_addr_lock)
#define sctp_addip_enable (sctp_globals.addip_enable) #define sctp_addip_enable (sctp_globals.addip_enable)
#define sctp_rmem (sctp_globals.rmem)
#define sctp_wmem (sctp_globals.wmem)
/* SCTP Socket type: UDP or TCP style. */ /* SCTP Socket type: UDP or TCP style. */
typedef enum { typedef enum {
......
...@@ -276,7 +276,7 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size) ...@@ -276,7 +276,7 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size)
struct iphdr *pip; struct iphdr *pip;
struct igmpv3_report *pig; struct igmpv3_report *pig;
skb = alloc_skb(size + dev->hard_header_len + 15, GFP_ATOMIC); skb = alloc_skb(size + LL_RESERVED_SPACE(dev), GFP_ATOMIC);
if (skb == NULL) if (skb == NULL)
return 0; return 0;
...@@ -298,7 +298,7 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size) ...@@ -298,7 +298,7 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size)
skb->dst = &rt->u.dst; skb->dst = &rt->u.dst;
skb->dev = dev; skb->dev = dev;
skb_reserve(skb, (dev->hard_header_len+15)&~15); skb_reserve(skb, LL_RESERVED_SPACE(dev));
skb->nh.iph = pip =(struct iphdr *)skb_put(skb, sizeof(struct iphdr)+4); skb->nh.iph = pip =(struct iphdr *)skb_put(skb, sizeof(struct iphdr)+4);
......
...@@ -370,7 +370,7 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, ...@@ -370,7 +370,7 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
/* /*
* Okay, now see if we can stuff it in the buffer as-is. * Okay, now see if we can stuff it in the buffer as-is.
*/ */
max_headroom = (((tdev->hard_header_len+15)&~15)+sizeof(struct iphdr)); max_headroom = LL_RESERVED_SPACE(tdev) + sizeof(struct iphdr);
if (skb_headroom(skb) < max_headroom if (skb_headroom(skb) < max_headroom
|| skb_cloned(skb) || skb_shared(skb)) { || skb_cloned(skb) || skb_shared(skb)) {
......
...@@ -117,7 +117,7 @@ static void send_reset(struct sk_buff *oldskb, int hook) ...@@ -117,7 +117,7 @@ static void send_reset(struct sk_buff *oldskb, int hook)
if ((rt = route_reverse(oldskb, hook)) == NULL) if ((rt = route_reverse(oldskb, hook)) == NULL)
return; return;
hh_len = (rt->u.dst.dev->hard_header_len + 15)&~15; hh_len = LL_RESERVED_SPACE(rt->u.dst.dev);
/* We need a linear, writeable skb. We also need to expand /* We need a linear, writeable skb. We also need to expand
headroom in case hh_len of incoming interface < hh_len of headroom in case hh_len of incoming interface < hh_len of
...@@ -305,9 +305,9 @@ static void send_unreach(struct sk_buff *skb_in, int code) ...@@ -305,9 +305,9 @@ static void send_unreach(struct sk_buff *skb_in, int code)
if (length > 576) if (length > 576)
length = 576; length = 576;
hh_len = (rt->u.dst.dev->hard_header_len + 15)&~15; hh_len = LL_RESERVED_SPACE(rt->u.dst.dev);
nskb = alloc_skb(hh_len+15+length, GFP_ATOMIC); nskb = alloc_skb(hh_len + length, GFP_ATOMIC);
if (!nskb) { if (!nskb) {
ip_rt_put(rt); ip_rt_put(rt);
return; return;
......
...@@ -218,7 +218,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, ...@@ -218,7 +218,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
*/ */
head_room = opt->opt_nflen + opt->opt_flen; head_room = opt->opt_nflen + opt->opt_flen;
seg_len += head_room; seg_len += head_room;
head_room += sizeof(struct ipv6hdr) + ((dst->dev->hard_header_len + 15)&~15); head_room += sizeof(struct ipv6hdr) + LL_RESERVED_SPACE(dst->dev);
if (skb_headroom(skb) < head_room) { if (skb_headroom(skb) < head_room) {
struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room); struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room);
...@@ -844,7 +844,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse ...@@ -844,7 +844,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
mtu = inet->cork.fragsize; mtu = inet->cork.fragsize;
} }
hh_len = (rt->u.dst.dev->hard_header_len&~15) + 16; hh_len = LL_RESERVED_SPACE(rt->u.dst.dev);
fragheaderlen = sizeof(struct ipv6hdr) + (opt ? opt->opt_nflen : 0); fragheaderlen = sizeof(struct ipv6hdr) + (opt ? opt->opt_nflen : 0);
maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen - sizeof(struct frag_hdr); maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen - sizeof(struct frag_hdr);
...@@ -881,14 +881,14 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse ...@@ -881,14 +881,14 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
alloclen += sizeof(struct frag_hdr); alloclen += sizeof(struct frag_hdr);
if (transhdrlen) { if (transhdrlen) {
skb = sock_alloc_send_skb(sk, skb = sock_alloc_send_skb(sk,
alloclen + hh_len + 15, alloclen + hh_len,
(flags & MSG_DONTWAIT), &err); (flags & MSG_DONTWAIT), &err);
} else { } else {
skb = NULL; skb = NULL;
if (atomic_read(&sk->sk_wmem_alloc) <= if (atomic_read(&sk->sk_wmem_alloc) <=
2 * sk->sk_sndbuf) 2 * sk->sk_sndbuf)
skb = sock_wmalloc(sk, skb = sock_wmalloc(sk,
alloclen + hh_len + 15, 1, alloclen + hh_len, 1,
sk->sk_allocation); sk->sk_allocation);
if (unlikely(skb == NULL)) if (unlikely(skb == NULL))
err = -ENOBUFS; err = -ENOBUFS;
......
...@@ -1233,12 +1233,13 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size) ...@@ -1233,12 +1233,13 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size)
IPV6_TLV_ROUTERALERT, 2, 0, 0, IPV6_TLV_ROUTERALERT, 2, 0, 0,
IPV6_TLV_PADN, 0 }; IPV6_TLV_PADN, 0 };
skb = sock_alloc_send_skb(sk, size + dev->hard_header_len+15, 1, &err); /* we assume size > sizeof(ra) here */
skb = sock_alloc_send_skb(sk, size + LL_RESERVED_SPACE(dev), 1, &err);
if (skb == 0) if (skb == 0)
return 0; return 0;
skb_reserve(skb, (dev->hard_header_len + 15) & ~15); skb_reserve(skb, LL_RESERVED_SPACE(dev));
if (dev->hard_header) { if (dev->hard_header) {
unsigned char ha[MAX_ADDR_LEN]; unsigned char ha[MAX_ADDR_LEN];
...@@ -1580,12 +1581,12 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) ...@@ -1580,12 +1581,12 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
payload_len = len + sizeof(ra); payload_len = len + sizeof(ra);
full_len = sizeof(struct ipv6hdr) + payload_len; full_len = sizeof(struct ipv6hdr) + payload_len;
skb = sock_alloc_send_skb(sk, dev->hard_header_len + full_len + 15, 1, &err); skb = sock_alloc_send_skb(sk, LL_RESERVED_SPACE(dev) + full_len, 1, &err);
if (skb == NULL) if (skb == NULL)
return; return;
skb_reserve(skb, (dev->hard_header_len + 15) & ~15); skb_reserve(skb, LL_RESERVED_SPACE(dev));
if (dev->hard_header) { if (dev->hard_header) {
unsigned char ha[MAX_ADDR_LEN]; unsigned char ha[MAX_ADDR_LEN];
ndisc_mc_map(snd_addr, ha, dev, 1); ndisc_mc_map(snd_addr, ha, dev, 1);
......
...@@ -459,7 +459,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, ...@@ -459,7 +459,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
inc_opt = 0; inc_opt = 0;
} }
skb = sock_alloc_send_skb(sk, MAX_HEADER + len + dev->hard_header_len + 15, skb = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev),
1, &err); 1, &err);
if (skb == NULL) { if (skb == NULL) {
...@@ -468,7 +468,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, ...@@ -468,7 +468,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
return; return;
} }
skb_reserve(skb, (dev->hard_header_len + 15) & ~15); skb_reserve(skb, LL_RESERVED_SPACE(dev));
ip6_nd_hdr(sk, skb, dev, src_addr, daddr, IPPROTO_ICMPV6, len); ip6_nd_hdr(sk, skb, dev, src_addr, daddr, IPPROTO_ICMPV6, len);
msg = (struct nd_msg *)skb_put(skb, len); msg = (struct nd_msg *)skb_put(skb, len);
...@@ -545,7 +545,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh, ...@@ -545,7 +545,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
if (send_llinfo) if (send_llinfo)
len += NDISC_OPT_SPACE(dev->addr_len); len += NDISC_OPT_SPACE(dev->addr_len);
skb = sock_alloc_send_skb(sk, MAX_HEADER + len + dev->hard_header_len + 15, skb = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev),
1, &err); 1, &err);
if (skb == NULL) { if (skb == NULL) {
ND_PRINTK1("send_ns: alloc skb failed\n"); ND_PRINTK1("send_ns: alloc skb failed\n");
...@@ -553,7 +553,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh, ...@@ -553,7 +553,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
return; return;
} }
skb_reserve(skb, (dev->hard_header_len + 15) & ~15); skb_reserve(skb, LL_RESERVED_SPACE(dev));
ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len); ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len);
msg = (struct nd_msg *)skb_put(skb, len); msg = (struct nd_msg *)skb_put(skb, len);
...@@ -617,7 +617,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr, ...@@ -617,7 +617,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
if (dev->addr_len) if (dev->addr_len)
len += NDISC_OPT_SPACE(dev->addr_len); len += NDISC_OPT_SPACE(dev->addr_len);
skb = sock_alloc_send_skb(sk, MAX_HEADER + len + dev->hard_header_len + 15, skb = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev),
1, &err); 1, &err);
if (skb == NULL) { if (skb == NULL) {
ND_PRINTK1("send_ns: alloc skb failed\n"); ND_PRINTK1("send_ns: alloc skb failed\n");
...@@ -625,7 +625,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr, ...@@ -625,7 +625,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
return; return;
} }
skb_reserve(skb, (dev->hard_header_len + 15) & ~15); skb_reserve(skb, LL_RESERVED_SPACE(dev));
ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len); ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len);
hdr = (struct icmp6hdr *)skb_put(skb, len); hdr = (struct icmp6hdr *)skb_put(skb, len);
...@@ -1305,7 +1305,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, ...@@ -1305,7 +1305,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
rd_len &= ~0x7; rd_len &= ~0x7;
len += rd_len; len += rd_len;
buff = sock_alloc_send_skb(sk, MAX_HEADER + len + dev->hard_header_len + 15, buff = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev),
1, &err); 1, &err);
if (buff == NULL) { if (buff == NULL) {
ND_PRINTK1("ndisc_send_redirect: alloc_skb failed\n"); ND_PRINTK1("ndisc_send_redirect: alloc_skb failed\n");
...@@ -1315,7 +1315,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, ...@@ -1315,7 +1315,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
hlen = 0; hlen = 0;
skb_reserve(buff, (dev->hard_header_len + 15) & ~15); skb_reserve(buff, LL_RESERVED_SPACE(dev));
ip6_nd_hdr(sk, buff, dev, &saddr_buf, &skb->nh.ipv6h->saddr, ip6_nd_hdr(sk, buff, dev, &saddr_buf, &skb->nh.ipv6h->saddr,
IPPROTO_ICMPV6, len); IPPROTO_ICMPV6, len);
......
...@@ -327,7 +327,7 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, ...@@ -327,7 +327,7 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock,
goto out_unlock; goto out_unlock;
err = -ENOBUFS; err = -ENOBUFS;
skb = sock_wmalloc(sk, len+dev->hard_header_len+15, 0, GFP_KERNEL); skb = sock_wmalloc(sk, len + LL_RESERVED_SPACE(dev), 0, GFP_KERNEL);
/* /*
* If the write buffer is full, then tough. At this level the user gets to * If the write buffer is full, then tough. At this level the user gets to
...@@ -346,7 +346,7 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, ...@@ -346,7 +346,7 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock,
* hard header at transmission time by themselves. PPP is the * hard header at transmission time by themselves. PPP is the
* notable one here. This should really be fixed at the driver level. * notable one here. This should really be fixed at the driver level.
*/ */
skb_reserve(skb,(dev->hard_header_len+15)&~15); skb_reserve(skb, LL_RESERVED_SPACE(dev));
skb->nh.raw = skb->data; skb->nh.raw = skb->data;
/* Try to align data part correctly */ /* Try to align data part correctly */
...@@ -700,12 +700,12 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -700,12 +700,12 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock,
if (len > dev->mtu+reserve) if (len > dev->mtu+reserve)
goto out_unlock; goto out_unlock;
skb = sock_alloc_send_skb(sk, len+dev->hard_header_len+15, skb = sock_alloc_send_skb(sk, len + LL_RESERVED_SPACE(dev),
msg->msg_flags & MSG_DONTWAIT, &err); msg->msg_flags & MSG_DONTWAIT, &err);
if (skb==NULL) if (skb==NULL)
goto out_unlock; goto out_unlock;
skb_reserve(skb, (dev->hard_header_len+15)&~15); skb_reserve(skb, LL_RESERVED_SPACE(dev));
skb->nh.raw = skb->data; skb->nh.raw = skb->data;
if (dev->hard_header) { if (dev->hard_header) {
......
...@@ -192,7 +192,7 @@ struct sctp_association *sctp_association_init(struct sctp_association *asoc, ...@@ -192,7 +192,7 @@ struct sctp_association *sctp_association_init(struct sctp_association *asoc,
asoc->rwnd_over = 0; asoc->rwnd_over = 0;
/* Use my own max window until I learn something better. */ /* Use my own max window until I learn something better. */
asoc->peer.rwnd = sctp_rmem; asoc->peer.rwnd = SCTP_DEFAULT_MAXWINDOW;
/* Set the sndbuf size for transmit. */ /* Set the sndbuf size for transmit. */
asoc->sndbuf_used = 0; asoc->sndbuf_used = 0;
...@@ -498,7 +498,7 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc, ...@@ -498,7 +498,7 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
* so initialize ssthresh to the default value and it will be set * so initialize ssthresh to the default value and it will be set
* later when we process the INIT. * later when we process the INIT.
*/ */
peer->ssthresh = sctp_rmem; peer->ssthresh = SCTP_DEFAULT_MAXWINDOW;
peer->partial_bytes_acked = 0; peer->partial_bytes_acked = 0;
peer->flight_size = 0; peer->flight_size = 0;
......
...@@ -147,10 +147,6 @@ struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, ...@@ -147,10 +147,6 @@ struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
ep->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = ep->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] =
sp->autoclose * HZ; sp->autoclose * HZ;
/* Set up the default send/receive buffer space. */
sk->sk_rcvbuf = sctp_rmem;
sk->sk_sndbuf = sctp_wmem;
/* Use SCTP specific send buffer space queues. */ /* Use SCTP specific send buffer space queues. */
sk->sk_write_space = sctp_write_space; sk->sk_write_space = sctp_write_space;
sk->sk_use_write_queue = 1; sk->sk_use_write_queue = 1;
......
...@@ -1049,10 +1049,6 @@ __init int sctp_init(void) ...@@ -1049,10 +1049,6 @@ __init int sctp_init(void)
sctp_max_instreams = SCTP_DEFAULT_INSTREAMS; sctp_max_instreams = SCTP_DEFAULT_INSTREAMS;
sctp_max_outstreams = SCTP_DEFAULT_OUTSTREAMS; sctp_max_outstreams = SCTP_DEFAULT_OUTSTREAMS;
/* Initialize default send & receive buffer sizes. */
sctp_rmem = SCTP_DEFAULT_MAXWINDOW;
sctp_wmem = SCTP_DEFAULT_MAXWINDOW;
/* Size and allocate the association hash table. /* Size and allocate the association hash table.
* The methodology is similar to that of the tcp hash tables. * The methodology is similar to that of the tcp hash tables.
*/ */
......
...@@ -170,22 +170,6 @@ static ctl_table sctp_table[] = { ...@@ -170,22 +170,6 @@ static ctl_table sctp_table[] = {
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec .proc_handler = &proc_dointvec
}, },
{
.ctl_name = NET_SCTP_RMEM,
.procname = "rmem",
.data = &sctp_rmem,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec
},
{
.ctl_name = NET_SCTP_WMEM,
.procname = "wmem",
.data = &sctp_wmem,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec
},
{ .ctl_name = 0 } { .ctl_name = 0 }
}; };
......
...@@ -768,7 +768,7 @@ void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk, ...@@ -768,7 +768,7 @@ void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk,
needed = ntohs(chunk->chunk_hdr->length); needed = ntohs(chunk->chunk_hdr->length);
needed -= sizeof(sctp_data_chunk_t); needed -= sizeof(sctp_data_chunk_t);
} else } else
needed = sctp_rmem; needed = SCTP_DEFAULT_MAXWINDOW;
freed = 0; freed = 0;
......
...@@ -591,14 +591,14 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -591,14 +591,14 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock,
return -EMSGSIZE; return -EMSGSIZE;
} }
skb = sock_alloc_send_skb(sk, len+dev->hard_header_len+15, skb = sock_alloc_send_skb(sk, len + LL_RESERVED_SPACE(dev),
msg->msg_flags & MSG_DONTWAIT, &err); msg->msg_flags & MSG_DONTWAIT, &err);
if (skb==NULL){ if (skb==NULL){
goto out_unlock; goto out_unlock;
} }
skb_reserve(skb, (dev->hard_header_len+15)&~15); skb_reserve(skb, LL_RESERVED_SPACE(dev));
skb->nh.raw = skb->data; skb->nh.raw = skb->data;
/* Returns -EFAULT on error */ /* Returns -EFAULT on error */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment