From 4e4dba0215b79664dff565fa36a0381f9220e6af Mon Sep 17 00:00:00 2001 From: "John W. Linville" Date: Mon, 6 Oct 2008 16:16:38 -0400 Subject: [PATCH] --- yaml --- r: 112041 b: refs/heads/master c: 8ec8ebaeceedf3a845f9e23885f26d0d00eefeb7 h: refs/heads/master i: 112039: 48631d49d2d1fefe3a19f79263a1b45918a68463 v: v3 --- [refs] | 2 +- trunk/drivers/net/wireless/ath9k/core.c | 2 - trunk/include/linux/inetdevice.h | 1 - trunk/include/linux/skbuff.h | 23 ----- trunk/include/linux/tcp.h | 9 +- trunk/include/net/inet6_hashtables.h | 15 --- trunk/include/net/inet_hashtables.h | 18 ---- trunk/include/net/netns/mib.h | 6 -- trunk/include/net/sock.h | 17 ---- trunk/include/net/tcp.h | 2 +- trunk/include/net/udp.h | 19 ++-- trunk/net/core/skbuff.c | 20 ---- trunk/net/core/sock.c | 4 +- trunk/net/dccp/ipv4.c | 5 +- trunk/net/dccp/ipv6.c | 6 +- trunk/net/ipv4/igmp.c | 7 +- trunk/net/ipv4/tcp.c | 6 +- trunk/net/ipv4/tcp_input.c | 15 ++- trunk/net/ipv4/tcp_ipv4.c | 3 +- trunk/net/ipv4/tcp_minisocks.c | 1 - trunk/net/ipv4/tcp_output.c | 18 ++-- trunk/net/ipv4/tcp_timer.c | 2 +- trunk/net/ipv4/udp.c | 21 +---- trunk/net/ipv6/af_inet6.c | 49 +++++----- trunk/net/ipv6/proc.c | 119 +++++++++++------------- trunk/net/ipv6/route.c | 28 ++---- trunk/net/ipv6/tcp_ipv6.c | 6 +- trunk/net/ipv6/udp.c | 18 +--- trunk/net/ipv6/udplite.c | 2 + 29 files changed, 147 insertions(+), 297 deletions(-) diff --git a/[refs] b/[refs] index cf45c90e8170..d3140f300c8d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b8bae41ed6a53cce56c50811a91cd963e3187d1c +refs/heads/master: 8ec8ebaeceedf3a845f9e23885f26d0d00eefeb7 diff --git a/trunk/drivers/net/wireless/ath9k/core.c b/trunk/drivers/net/wireless/ath9k/core.c index 6c433a4d003e..d7f5257d2ec1 100644 --- a/trunk/drivers/net/wireless/ath9k/core.c +++ b/trunk/drivers/net/wireless/ath9k/core.c @@ -288,8 +288,6 @@ static int ath_stop(struct ath_softc *sc) * hardware is gone (invalid). */ - if (!(sc->sc_flags & SC_OP_INVALID)) - ath9k_hw_set_interrupts(ah, 0); ath_draintxq(sc, false); if (!(sc->sc_flags & SC_OP_INVALID)) { ath_stoprecv(sc); diff --git a/trunk/include/linux/inetdevice.h b/trunk/include/linux/inetdevice.h index 06fcdb45106b..c6f51ad52d5b 100644 --- a/trunk/include/linux/inetdevice.h +++ b/trunk/include/linux/inetdevice.h @@ -25,7 +25,6 @@ struct in_device struct in_ifaddr *ifa_list; /* IP ifaddr chain */ rwlock_t mc_list_lock; struct ip_mc_list *mc_list; /* IP multicast filter chain */ - int mc_count; /* Number of installed mcasts */ spinlock_t mc_tomb_lock; struct ip_mc_list *mc_tomb; unsigned long mr_v1_seen; diff --git a/trunk/include/linux/skbuff.h b/trunk/include/linux/skbuff.h index 2725f4e5a9bf..720b688c22b6 100644 --- a/trunk/include/linux/skbuff.h +++ b/trunk/include/linux/skbuff.h @@ -968,9 +968,6 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i, skb_shinfo(skb)->nr_frags = i + 1; } -extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, - int off, int size); - #define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) #define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) @@ -1385,26 +1382,6 @@ static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev, return __netdev_alloc_skb(dev, length, GFP_ATOMIC); } -extern struct page *__netdev_alloc_page(struct net_device *dev, gfp_t gfp_mask); - -/** - * netdev_alloc_page - allocate a page for ps-rx on a specific device - * @dev: network device to receive on - * - * Allocate a new page node local to the specified device. - * - * %NULL is returned if there is no free memory. - */ -static inline struct page *netdev_alloc_page(struct net_device *dev) -{ - return __netdev_alloc_page(dev, GFP_ATOMIC); -} - -static inline void netdev_free_page(struct net_device *dev, struct page *page) -{ - __free_page(page); -} - /** * skb_clone_writable - is the header of a clone writable * @skb: buffer to check diff --git a/trunk/include/linux/tcp.h b/trunk/include/linux/tcp.h index fe77e1499ab7..767290628292 100644 --- a/trunk/include/linux/tcp.h +++ b/trunk/include/linux/tcp.h @@ -312,11 +312,8 @@ struct tcp_sock { u32 retrans_out; /* Retransmitted packets out */ u16 urg_data; /* Saved octet of OOB data and control flags */ + u8 urg_mode; /* In urgent mode */ u8 ecn_flags; /* ECN status bits. */ - u8 reordering; /* Packet reordering metric. */ - u32 snd_up; /* Urgent pointer */ - - u8 keepalive_probes; /* num of allowed keep alive probes */ /* * Options received (usually on last packet, some only on SYN packets). */ @@ -364,6 +361,8 @@ struct tcp_sock { u32 lost_retrans_low; /* Sent seq after any rxmit (lowest) */ + u8 reordering; /* Packet reordering metric. */ + u8 keepalive_probes; /* num of allowed keep alive probes */ u32 prior_ssthresh; /* ssthresh saved at recovery start */ u32 high_seq; /* snd_nxt at onset of congestion */ @@ -375,6 +374,8 @@ struct tcp_sock { u32 total_retrans; /* Total retransmits for entire connection */ u32 urg_seq; /* Seq of received urgent pointer */ + u32 snd_up; /* Urgent pointer */ + unsigned int keepalive_time; /* time before keep alive takes place */ unsigned int keepalive_intvl; /* time interval between keep alive probes */ diff --git a/trunk/include/net/inet6_hashtables.h b/trunk/include/net/inet6_hashtables.h index f74665d7bea8..e48989f04c24 100644 --- a/trunk/include/net/inet6_hashtables.h +++ b/trunk/include/net/inet6_hashtables.h @@ -91,21 +91,6 @@ static inline struct sock *__inet6_lookup(struct net *net, return inet6_lookup_listener(net, hashinfo, daddr, hnum, dif); } -static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo, - struct sk_buff *skb, - const __be16 sport, - const __be16 dport) -{ - struct sock *sk; - - if (unlikely(sk = skb_steal_sock(skb))) - return sk; - else return __inet6_lookup(dev_net(skb->dst->dev), hashinfo, - &ipv6_hdr(skb)->saddr, sport, - &ipv6_hdr(skb)->daddr, ntohs(dport), - inet6_iif(skb)); -} - extern struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo, const struct in6_addr *saddr, const __be16 sport, const struct in6_addr *daddr, const __be16 dport, diff --git a/trunk/include/net/inet_hashtables.h b/trunk/include/net/inet_hashtables.h index 5cc182f9ecae..bb619d80f2e2 100644 --- a/trunk/include/net/inet_hashtables.h +++ b/trunk/include/net/inet_hashtables.h @@ -16,7 +16,6 @@ #include -#include #include #include #include @@ -29,7 +28,6 @@ #include #include #include -#include #include #include @@ -373,22 +371,6 @@ static inline struct sock *inet_lookup(struct net *net, return sk; } -static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo, - struct sk_buff *skb, - const __be16 sport, - const __be16 dport) -{ - struct sock *sk; - const struct iphdr *iph = ip_hdr(skb); - - if (unlikely(sk = skb_steal_sock(skb))) - return sk; - else - return __inet_lookup(dev_net(skb->dst->dev), hashinfo, - iph->saddr, sport, - iph->daddr, dport, inet_iif(skb)); -} - extern int __inet_hash_connect(struct inet_timewait_death_row *death_row, struct sock *sk, u32 port_offset, int (*check_established)(struct inet_timewait_death_row *, diff --git a/trunk/include/net/netns/mib.h b/trunk/include/net/netns/mib.h index 4e58f0519ce8..449147604642 100644 --- a/trunk/include/net/netns/mib.h +++ b/trunk/include/net/netns/mib.h @@ -11,12 +11,6 @@ struct netns_mib { DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics); DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics); DEFINE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics); - -#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) - struct proc_dir_entry *proc_net_devsnmp6; - DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6); - DEFINE_SNMP_STAT(struct udp_mib, udplite_stats_in6); -#endif }; #endif diff --git a/trunk/include/net/sock.h b/trunk/include/net/sock.h index ada50c04d09f..75a312d3888a 100644 --- a/trunk/include/net/sock.h +++ b/trunk/include/net/sock.h @@ -482,11 +482,6 @@ static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb) skb->next = NULL; } -static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb) -{ - return sk->sk_backlog_rcv(sk, skb); -} - #define sk_wait_event(__sk, __timeo, __condition) \ ({ int __rc; \ release_sock(__sk); \ @@ -1329,18 +1324,6 @@ static inline void sk_change_net(struct sock *sk, struct net *net) sock_net_set(sk, hold_net(net)); } -static inline struct sock *skb_steal_sock(struct sk_buff *skb) -{ - if (unlikely(skb->sk)) { - struct sock *sk = skb->sk; - - skb->destructor = NULL; - skb->sk = NULL; - return sk; - } - return NULL; -} - extern void sock_enable_timestamp(struct sock *sk); extern int sock_get_timestamp(struct sock *, struct timeval __user *); extern int sock_get_timestampns(struct sock *, struct timespec __user *); diff --git a/trunk/include/net/tcp.h b/trunk/include/net/tcp.h index 438014d57610..f6cc34143154 100644 --- a/trunk/include/net/tcp.h +++ b/trunk/include/net/tcp.h @@ -896,7 +896,7 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb) BUG_ON(sock_owned_by_user(sk)); while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) { - sk_backlog_rcv(sk, skb1); + sk->sk_backlog_rcv(sk, skb1); NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPPREQUEUEDROPPED); } diff --git a/trunk/include/net/udp.h b/trunk/include/net/udp.h index 1e205095ea68..d38f6f2419f9 100644 --- a/trunk/include/net/udp.h +++ b/trunk/include/net/udp.h @@ -152,6 +152,11 @@ extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, __be32 daddr, __be16 dport, int dif); +DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6); + +/* UDP-Lite does not have a standardized MIB yet, so we inherit from UDP */ +DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6); + /* * SNMP statistics for UDP and UDP-Lite */ @@ -162,14 +167,12 @@ extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, if (is_udplite) SNMP_INC_STATS_BH((net)->mib.udplite_statistics, field); \ else SNMP_INC_STATS_BH((net)->mib.udp_statistics, field); } while(0) -#define UDP6_INC_STATS_BH(net, field, is_udplite) do { \ - if (is_udplite) SNMP_INC_STATS_BH((net)->mib.udplite_stats_in6, field);\ - else SNMP_INC_STATS_BH((net)->mib.udp_stats_in6, field); \ -} while(0) -#define UDP6_INC_STATS_USER(net, field, __lite) do { \ - if (__lite) SNMP_INC_STATS_USER((net)->mib.udplite_stats_in6, field); \ - else SNMP_INC_STATS_USER((net)->mib.udp_stats_in6, field); \ -} while(0) +#define UDP6_INC_STATS_BH(net, field, is_udplite) do { (void)net; \ + if (is_udplite) SNMP_INC_STATS_BH(udplite_stats_in6, field); \ + else SNMP_INC_STATS_BH(udp_stats_in6, field); } while(0) +#define UDP6_INC_STATS_USER(net, field, is_udplite) do { (void)net; \ + if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \ + else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0) #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) #define UDPX_INC_STATS_BH(sk, field) \ diff --git a/trunk/net/core/skbuff.c b/trunk/net/core/skbuff.c index 7f7bb1a636d9..8bd248a64879 100644 --- a/trunk/net/core/skbuff.c +++ b/trunk/net/core/skbuff.c @@ -263,26 +263,6 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev, return skb; } -struct page *__netdev_alloc_page(struct net_device *dev, gfp_t gfp_mask) -{ - int node = dev->dev.parent ? dev_to_node(dev->dev.parent) : -1; - struct page *page; - - page = alloc_pages_node(node, gfp_mask, 0); - return page; -} -EXPORT_SYMBOL(__netdev_alloc_page); - -void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off, - int size) -{ - skb_fill_page_desc(skb, i, page, off, size); - skb->len += size; - skb->data_len += size; - skb->truesize += size; -} -EXPORT_SYMBOL(skb_add_rx_frag); - /** * dev_alloc_skb - allocate an skbuff for receiving * @length: length to allocate diff --git a/trunk/net/core/sock.c b/trunk/net/core/sock.c index 5e2a3132a8c9..2d358dd8a03e 100644 --- a/trunk/net/core/sock.c +++ b/trunk/net/core/sock.c @@ -327,7 +327,7 @@ int sk_receive_skb(struct sock *sk, struct sk_buff *skb, const int nested) */ mutex_acquire(&sk->sk_lock.dep_map, 0, 1, _RET_IP_); - rc = sk_backlog_rcv(sk, skb); + rc = sk->sk_backlog_rcv(sk, skb); mutex_release(&sk->sk_lock.dep_map, 1, _RET_IP_); } else @@ -1374,7 +1374,7 @@ static void __release_sock(struct sock *sk) struct sk_buff *next = skb->next; skb->next = NULL; - sk_backlog_rcv(sk, skb); + sk->sk_backlog_rcv(sk, skb); /* * We are in process context here with softirqs diff --git a/trunk/net/dccp/ipv4.c b/trunk/net/dccp/ipv4.c index e3dfddab21cc..882c5c4de69e 100644 --- a/trunk/net/dccp/ipv4.c +++ b/trunk/net/dccp/ipv4.c @@ -811,8 +811,9 @@ static int dccp_v4_rcv(struct sk_buff *skb) /* Step 2: * Look up flow ID in table and get corresponding socket */ - sk = __inet_lookup_skb(&dccp_hashinfo, skb, - dh->dccph_sport, dh->dccph_dport); + sk = __inet_lookup(dev_net(skb->dst->dev), &dccp_hashinfo, + iph->saddr, dh->dccph_sport, + iph->daddr, dh->dccph_dport, inet_iif(skb)); /* * Step 2: * If no socket ... diff --git a/trunk/net/dccp/ipv6.c b/trunk/net/dccp/ipv6.c index caa7f3469626..5e1ee0da2c40 100644 --- a/trunk/net/dccp/ipv6.c +++ b/trunk/net/dccp/ipv6.c @@ -805,8 +805,10 @@ static int dccp_v6_rcv(struct sk_buff *skb) /* Step 2: * Look up flow ID in table and get corresponding socket */ - sk = __inet6_lookup_skb(&dccp_hashinfo, skb, - dh->dccph_sport, dh->dccph_dport); + sk = __inet6_lookup(dev_net(skb->dst->dev), &dccp_hashinfo, + &ipv6_hdr(skb)->saddr, dh->dccph_sport, + &ipv6_hdr(skb)->daddr, ntohs(dh->dccph_dport), + inet6_iif(skb)); /* * Step 2: * If no socket ... diff --git a/trunk/net/ipv4/igmp.c b/trunk/net/ipv4/igmp.c index 7f9e337e3908..f70fac612596 100644 --- a/trunk/net/ipv4/igmp.c +++ b/trunk/net/ipv4/igmp.c @@ -1234,7 +1234,6 @@ void ip_mc_inc_group(struct in_device *in_dev, __be32 addr) write_lock_bh(&in_dev->mc_list_lock); im->next=in_dev->mc_list; in_dev->mc_list=im; - in_dev->mc_count++; write_unlock_bh(&in_dev->mc_list_lock); #ifdef CONFIG_IP_MULTICAST igmpv3_del_delrec(in_dev, im->multiaddr); @@ -1283,7 +1282,6 @@ void ip_mc_dec_group(struct in_device *in_dev, __be32 addr) if (--i->users == 0) { write_lock_bh(&in_dev->mc_list_lock); *ip = i->next; - in_dev->mc_count--; write_unlock_bh(&in_dev->mc_list_lock); igmp_group_dropped(i); @@ -1332,7 +1330,6 @@ void ip_mc_init_dev(struct in_device *in_dev) setup_timer(&in_dev->mr_gq_timer, igmp_gq_timer_expire, (unsigned long)in_dev); in_dev->mr_ifc_count = 0; - in_dev->mc_count = 0; setup_timer(&in_dev->mr_ifc_timer, igmp_ifc_timer_expire, (unsigned long)in_dev); in_dev->mr_qrv = IGMP_Unsolicited_Report_Count; @@ -1372,8 +1369,8 @@ void ip_mc_destroy_dev(struct in_device *in_dev) write_lock_bh(&in_dev->mc_list_lock); while ((i = in_dev->mc_list) != NULL) { in_dev->mc_list = i->next; - in_dev->mc_count--; write_unlock_bh(&in_dev->mc_list_lock); + igmp_group_dropped(i); ip_ma_put(i); @@ -2386,7 +2383,7 @@ static int igmp_mc_seq_show(struct seq_file *seq, void *v) if (state->in_dev->mc_list == im) { seq_printf(seq, "%d\t%-10s: %5d %7s\n", - state->dev->ifindex, state->dev->name, state->in_dev->mc_count, querier); + state->dev->ifindex, state->dev->name, state->dev->mc_count, querier); } seq_printf(seq, diff --git a/trunk/net/ipv4/tcp.c b/trunk/net/ipv4/tcp.c index eccb7165a80c..7d81a1ee5507 100644 --- a/trunk/net/ipv4/tcp.c +++ b/trunk/net/ipv4/tcp.c @@ -497,8 +497,10 @@ static inline void skb_entail(struct sock *sk, struct sk_buff *skb) static inline void tcp_mark_urg(struct tcp_sock *tp, int flags, struct sk_buff *skb) { - if (flags & MSG_OOB) + if (flags & MSG_OOB) { + tp->urg_mode = 1; tp->snd_up = tp->write_seq; + } } static inline void tcp_push(struct sock *sk, int flags, int mss_now, @@ -1159,7 +1161,7 @@ static void tcp_prequeue_process(struct sock *sk) * necessary */ local_bh_disable(); while ((skb = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) - sk_backlog_rcv(sk, skb); + sk->sk_backlog_rcv(sk, skb); local_bh_enable(); /* Clear memory counter. */ diff --git a/trunk/net/ipv4/tcp_input.c b/trunk/net/ipv4/tcp_input.c index 63da39372d40..3b76bce769dd 100644 --- a/trunk/net/ipv4/tcp_input.c +++ b/trunk/net/ipv4/tcp_input.c @@ -2836,8 +2836,7 @@ static u32 tcp_tso_acked(struct sock *sk, struct sk_buff *skb) * is before the ack sequence we can discard it as it's confirmed to have * arrived at the other end. */ -static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets, - u32 prior_snd_una) +static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets) { struct tcp_sock *tp = tcp_sk(sk); const struct inet_connection_sock *icsk = inet_csk(sk); @@ -2904,6 +2903,9 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets, if (sacked & TCPCB_LOST) tp->lost_out -= acked_pcount; + if (unlikely(tp->urg_mode && !before(end_seq, tp->snd_up))) + tp->urg_mode = 0; + tp->packets_out -= acked_pcount; pkts_acked += acked_pcount; @@ -2933,9 +2935,6 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets, tp->lost_skb_hint = NULL; } - if (likely(between(tp->snd_up, prior_snd_una, tp->snd_una))) - tp->snd_up = tp->snd_una; - if (skb && (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED)) flag |= FLAG_SACK_RENEGING; @@ -3312,7 +3311,7 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag) goto no_queue; /* See if we can take anything off of the retransmit queue. */ - flag |= tcp_clean_rtx_queue(sk, prior_fackets, prior_snd_una); + flag |= tcp_clean_rtx_queue(sk, prior_fackets); if (tp->frto_counter) frto_cwnd = tcp_process_frto(sk, flag); @@ -4461,8 +4460,8 @@ static void tcp_new_space(struct sock *sk) if (tcp_should_expand_sndbuf(sk)) { int sndmem = max_t(u32, tp->rx_opt.mss_clamp, tp->mss_cache) + - MAX_TCP_HEADER + 16 + sizeof(struct sk_buff); - int demanded = max_t(unsigned int, tp->snd_cwnd, + MAX_TCP_HEADER + 16 + sizeof(struct sk_buff), + demanded = max_t(unsigned int, tp->snd_cwnd, tp->reordering + 1); sndmem *= 2 * demanded; if (sndmem > sk->sk_sndbuf) diff --git a/trunk/net/ipv4/tcp_ipv4.c b/trunk/net/ipv4/tcp_ipv4.c index 24ffc5e1d3da..8b24bd833cb4 100644 --- a/trunk/net/ipv4/tcp_ipv4.c +++ b/trunk/net/ipv4/tcp_ipv4.c @@ -1577,7 +1577,8 @@ int tcp_v4_rcv(struct sk_buff *skb) TCP_SKB_CB(skb)->flags = iph->tos; TCP_SKB_CB(skb)->sacked = 0; - sk = __inet_lookup_skb(&tcp_hashinfo, skb, th->source, th->dest); + sk = __inet_lookup(net, &tcp_hashinfo, iph->saddr, + th->source, iph->daddr, th->dest, inet_iif(skb)); if (!sk) goto no_tcp_socket; diff --git a/trunk/net/ipv4/tcp_minisocks.c b/trunk/net/ipv4/tcp_minisocks.c index 779f2e9d0689..f976fc57892c 100644 --- a/trunk/net/ipv4/tcp_minisocks.c +++ b/trunk/net/ipv4/tcp_minisocks.c @@ -395,7 +395,6 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req, newtp->pred_flags = 0; newtp->rcv_wup = newtp->copied_seq = newtp->rcv_nxt = treq->rcv_isn + 1; newtp->snd_sml = newtp->snd_una = newtp->snd_nxt = treq->snt_isn + 1; - newtp->snd_up = treq->snt_isn + 1; tcp_prequeue_init(newtp); diff --git a/trunk/net/ipv4/tcp_output.c b/trunk/net/ipv4/tcp_output.c index 990a58493235..493553c71d32 100644 --- a/trunk/net/ipv4/tcp_output.c +++ b/trunk/net/ipv4/tcp_output.c @@ -345,11 +345,6 @@ static void tcp_init_nondata_skb(struct sk_buff *skb, u32 seq, u8 flags) TCP_SKB_CB(skb)->end_seq = seq; } -static inline int tcp_urg_mode(const struct tcp_sock *tp) -{ - return tp->snd_una != tp->snd_up; -} - #define OPTION_SACK_ADVERTISE (1 << 0) #define OPTION_TS (1 << 1) #define OPTION_MD5 (1 << 2) @@ -651,8 +646,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, th->check = 0; th->urg_ptr = 0; - /* The urg_mode check is necessary during a below snd_una win probe */ - if (unlikely(tcp_urg_mode(tp) && + if (unlikely(tp->urg_mode && between(tp->snd_up, tcb->seq + 1, tcb->seq + 0xFFFF))) { th->urg_ptr = htons(tp->snd_up - tcb->seq); th->urg = 1; @@ -1018,7 +1012,7 @@ unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu) /* Compute the current effective MSS, taking SACKs and IP options, * and even PMTU discovery events into account. * - * LARGESEND note: !tcp_urg_mode is overkill, only frames up to snd_up + * LARGESEND note: !urg_mode is overkill, only frames up to snd_up * cannot be large. However, taking into account rare use of URG, this * is not a big flaw. */ @@ -1035,7 +1029,7 @@ unsigned int tcp_current_mss(struct sock *sk, int large_allowed) mss_now = tp->mss_cache; - if (large_allowed && sk_can_gso(sk) && !tcp_urg_mode(tp)) + if (large_allowed && sk_can_gso(sk) && !tp->urg_mode) doing_tso = 1; if (dst) { @@ -1199,7 +1193,7 @@ static inline int tcp_nagle_test(struct tcp_sock *tp, struct sk_buff *skb, /* Don't use the nagle rule for urgent data (or for the final FIN). * Nagle can be ignored during F-RTO too (see RFC4138). */ - if (tcp_urg_mode(tp) || (tp->frto_counter == 2) || + if (tp->urg_mode || (tp->frto_counter == 2) || (TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN)) return 1; @@ -2364,7 +2358,6 @@ static void tcp_connect_init(struct sock *sk) tcp_init_wl(tp, tp->write_seq, 0); tp->snd_una = tp->write_seq; tp->snd_sml = tp->write_seq; - tp->snd_up = tp->write_seq; tp->rcv_nxt = 0; tp->rcv_wup = 0; tp->copied_seq = 0; @@ -2574,7 +2567,8 @@ int tcp_write_wakeup(struct sock *sk) tcp_event_new_data_sent(sk, skb); return err; } else { - if (between(tp->snd_up, tp->snd_una + 1, tp->snd_una + 0xFFFF)) + if (tp->urg_mode && + between(tp->snd_up, tp->snd_una + 1, tp->snd_una + 0xFFFF)) tcp_xmit_probe_skb(sk, 1); return tcp_xmit_probe_skb(sk, 0); } diff --git a/trunk/net/ipv4/tcp_timer.c b/trunk/net/ipv4/tcp_timer.c index 6b6dff1164b9..5ab6ba19c3ce 100644 --- a/trunk/net/ipv4/tcp_timer.c +++ b/trunk/net/ipv4/tcp_timer.c @@ -201,7 +201,7 @@ static void tcp_delack_timer(unsigned long data) NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPSCHEDULERFAILED); while ((skb = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) - sk_backlog_rcv(sk, skb); + sk->sk_backlog_rcv(sk, skb); tp->ucopy.memory = 0; } diff --git a/trunk/net/ipv4/udp.c b/trunk/net/ipv4/udp.c index 85f8e8e10b1b..c83d0ef469c9 100644 --- a/trunk/net/ipv4/udp.c +++ b/trunk/net/ipv4/udp.c @@ -108,6 +108,9 @@ * Snmp MIB for the UDP layer */ +DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6) __read_mostly; +EXPORT_SYMBOL(udp_stats_in6); + struct hlist_head udp_hash[UDP_HTABLE_SIZE]; DEFINE_RWLOCK(udp_hash_lock); @@ -299,21 +302,6 @@ static struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr, return result; } -static inline struct sock *__udp4_lib_lookup_skb(struct sk_buff *skb, - __be16 sport, __be16 dport, - struct hlist_head udptable[]) -{ - struct sock *sk; - const struct iphdr *iph = ip_hdr(skb); - - if (unlikely(sk = skb_steal_sock(skb))) - return sk; - else - return __udp4_lib_lookup(dev_net(skb->dst->dev), iph->saddr, sport, - iph->daddr, dport, inet_iif(skb), - udptable); -} - struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, __be32 daddr, __be16 dport, int dif) { @@ -1220,7 +1208,8 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], return __udp4_lib_mcast_deliver(net, skb, uh, saddr, daddr, udptable); - sk = __udp4_lib_lookup_skb(skb, uh->source, uh->dest, udptable); + sk = __udp4_lib_lookup(net, saddr, uh->source, daddr, + uh->dest, inet_iif(skb), udptable); if (sk != NULL) { int ret = udp_queue_rcv_skb(sk, skb); diff --git a/trunk/net/ipv6/af_inet6.c b/trunk/net/ipv6/af_inet6.c index 127b240d2d81..f018704ecb86 100644 --- a/trunk/net/ipv6/af_inet6.c +++ b/trunk/net/ipv6/af_inet6.c @@ -806,8 +806,17 @@ static int __init init_ipv6_mibs(void) if (snmp_mib_init((void **)icmpv6msg_statistics, sizeof(struct icmpv6msg_mib)) < 0) goto err_icmpmsg_mib; + if (snmp_mib_init((void **)udp_stats_in6, sizeof (struct udp_mib)) < 0) + goto err_udp_mib; + if (snmp_mib_init((void **)udplite_stats_in6, + sizeof (struct udp_mib)) < 0) + goto err_udplite_mib; return 0; +err_udplite_mib: + snmp_mib_free((void **)udp_stats_in6); +err_udp_mib: + snmp_mib_free((void **)icmpv6msg_statistics); err_icmpmsg_mib: snmp_mib_free((void **)icmpv6_statistics); err_icmp_mib: @@ -822,27 +831,8 @@ static void cleanup_ipv6_mibs(void) snmp_mib_free((void **)ipv6_statistics); snmp_mib_free((void **)icmpv6_statistics); snmp_mib_free((void **)icmpv6msg_statistics); -} - -static int __net_init ipv6_init_mibs(struct net *net) -{ - if (snmp_mib_init((void **)net->mib.udp_stats_in6, - sizeof (struct udp_mib)) < 0) - return -ENOMEM; - if (snmp_mib_init((void **)net->mib.udplite_stats_in6, - sizeof (struct udp_mib)) < 0) - goto err_udplite_mib; - return 0; - -err_udplite_mib: - snmp_mib_free((void **)net->mib.udp_stats_in6); - return -ENOMEM; -} - -static void __net_exit ipv6_cleanup_mibs(struct net *net) -{ - snmp_mib_free((void **)net->mib.udp_stats_in6); - snmp_mib_free((void **)net->mib.udplite_stats_in6); + snmp_mib_free((void **)udp_stats_in6); + snmp_mib_free((void **)udplite_stats_in6); } static int inet6_net_init(struct net *net) @@ -850,11 +840,16 @@ static int inet6_net_init(struct net *net) int err = 0; net->ipv6.sysctl.bindv6only = 0; + net->ipv6.sysctl.flush_delay = 0; + net->ipv6.sysctl.ip6_rt_max_size = 4096; + net->ipv6.sysctl.ip6_rt_gc_min_interval = HZ / 2; + net->ipv6.sysctl.ip6_rt_gc_timeout = 60*HZ; + net->ipv6.sysctl.ip6_rt_gc_interval = 30*HZ; + net->ipv6.sysctl.ip6_rt_gc_elasticity = 9; + net->ipv6.sysctl.ip6_rt_mtu_expires = 10*60*HZ; + net->ipv6.sysctl.ip6_rt_min_advmss = IPV6_MIN_MTU - 20 - 40; net->ipv6.sysctl.icmpv6_time = 1*HZ; - err = ipv6_init_mibs(net); - if (err) - return err; #ifdef CONFIG_PROC_FS err = udp6_proc_init(net); if (err) @@ -865,6 +860,7 @@ static int inet6_net_init(struct net *net) err = ac6_proc_init(net); if (err) goto proc_ac6_fail; +out: #endif return err; @@ -873,9 +869,7 @@ static int inet6_net_init(struct net *net) tcp6_proc_exit(net); proc_tcp6_fail: udp6_proc_exit(net); -out: - ipv6_cleanup_mibs(net); - return err; + goto out; #endif } @@ -886,7 +880,6 @@ static void inet6_net_exit(struct net *net) tcp6_proc_exit(net); ac6_proc_exit(net); #endif - ipv6_cleanup_mibs(net); } static struct pernet_operations inet6_net_ops = { diff --git a/trunk/net/ipv6/proc.c b/trunk/net/ipv6/proc.c index c78cf754ef3f..0179b66864f1 100644 --- a/trunk/net/ipv6/proc.c +++ b/trunk/net/ipv6/proc.c @@ -29,6 +29,8 @@ #include #include +static struct proc_dir_entry *proc_net_devsnmp6; + static int sockstat6_seq_show(struct seq_file *seq, void *v) { struct net *net = seq->private; @@ -46,19 +48,6 @@ static int sockstat6_seq_show(struct seq_file *seq, void *v) return 0; } -static int sockstat6_seq_open(struct inode *inode, struct file *file) -{ - return single_open_net(inode, file, sockstat6_seq_show); -} - -static const struct file_operations sockstat6_seq_fops = { - .owner = THIS_MODULE, - .open = sockstat6_seq_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release_net, -}; - static struct snmp_mib snmp6_ipstats_list[] = { /* ipv6 mib according to RFC 2465 */ SNMP_MIB_ITEM("Ip6InReceives", IPSTATS_MIB_INRECEIVES), @@ -175,50 +164,44 @@ snmp6_seq_show_item(struct seq_file *seq, void **mib, struct snmp_mib *itemlist) static int snmp6_seq_show(struct seq_file *seq, void *v) { - struct net *net = (struct net *)seq->private; - - snmp6_seq_show_item(seq, (void **)ipv6_statistics, snmp6_ipstats_list); - snmp6_seq_show_item(seq, (void **)icmpv6_statistics, snmp6_icmp6_list); - snmp6_seq_show_icmpv6msg(seq, (void **)icmpv6msg_statistics); - snmp6_seq_show_item(seq, (void **)net->mib.udp_stats_in6, - snmp6_udp6_list); - snmp6_seq_show_item(seq, (void **)net->mib.udplite_stats_in6, - snmp6_udplite6_list); + struct inet6_dev *idev = (struct inet6_dev *)seq->private; + + if (idev) { + seq_printf(seq, "%-32s\t%u\n", "ifIndex", idev->dev->ifindex); + snmp6_seq_show_item(seq, (void **)idev->stats.ipv6, snmp6_ipstats_list); + snmp6_seq_show_item(seq, (void **)idev->stats.icmpv6, snmp6_icmp6_list); + snmp6_seq_show_icmpv6msg(seq, (void **)idev->stats.icmpv6msg); + } else { + snmp6_seq_show_item(seq, (void **)ipv6_statistics, snmp6_ipstats_list); + snmp6_seq_show_item(seq, (void **)icmpv6_statistics, snmp6_icmp6_list); + snmp6_seq_show_icmpv6msg(seq, (void **)icmpv6msg_statistics); + snmp6_seq_show_item(seq, (void **)udp_stats_in6, snmp6_udp6_list); + snmp6_seq_show_item(seq, (void **)udplite_stats_in6, snmp6_udplite6_list); + } return 0; } -static int snmp6_seq_open(struct inode *inode, struct file *file) +static int sockstat6_seq_open(struct inode *inode, struct file *file) { - return single_open_net(inode, file, snmp6_seq_show); + return single_open_net(inode, file, sockstat6_seq_show); } -static const struct file_operations snmp6_seq_fops = { +static const struct file_operations sockstat6_seq_fops = { .owner = THIS_MODULE, - .open = snmp6_seq_open, + .open = sockstat6_seq_open, .read = seq_read, .llseek = seq_lseek, .release = single_release_net, }; -static int snmp6_dev_seq_show(struct seq_file *seq, void *v) -{ - struct inet6_dev *idev = (struct inet6_dev *)seq->private; - - seq_printf(seq, "%-32s\t%u\n", "ifIndex", idev->dev->ifindex); - snmp6_seq_show_item(seq, (void **)idev->stats.ipv6, snmp6_ipstats_list); - snmp6_seq_show_item(seq, (void **)idev->stats.icmpv6, snmp6_icmp6_list); - snmp6_seq_show_icmpv6msg(seq, (void **)idev->stats.icmpv6msg); - return 0; -} - -static int snmp6_dev_seq_open(struct inode *inode, struct file *file) +static int snmp6_seq_open(struct inode *inode, struct file *file) { - return single_open(file, snmp6_dev_seq_show, PDE(inode)->data); + return single_open(file, snmp6_seq_show, PDE(inode)->data); } -static const struct file_operations snmp6_dev_seq_fops = { +static const struct file_operations snmp6_seq_fops = { .owner = THIS_MODULE, - .open = snmp6_dev_seq_open, + .open = snmp6_seq_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, @@ -227,18 +210,18 @@ static const struct file_operations snmp6_dev_seq_fops = { int snmp6_register_dev(struct inet6_dev *idev) { struct proc_dir_entry *p; - struct net *net; if (!idev || !idev->dev) return -EINVAL; - net = dev_net(idev->dev); - if (!net->mib.proc_net_devsnmp6) + if (!net_eq(dev_net(idev->dev), &init_net)) + return 0; + + if (!proc_net_devsnmp6) return -ENOENT; p = proc_create_data(idev->dev->name, S_IRUGO, - net->mib.proc_net_devsnmp6, - &snmp6_dev_seq_fops, idev); + proc_net_devsnmp6, &snmp6_seq_fops, idev); if (!p) return -ENOMEM; @@ -248,13 +231,12 @@ int snmp6_register_dev(struct inet6_dev *idev) int snmp6_unregister_dev(struct inet6_dev *idev) { - struct net *net = dev_net(idev->dev); - if (!net->mib.proc_net_devsnmp6) + if (!proc_net_devsnmp6) return -ENOENT; if (!idev || !idev->stats.proc_dir_entry) return -EINVAL; remove_proc_entry(idev->stats.proc_dir_entry->name, - net->mib.proc_net_devsnmp6); + proc_net_devsnmp6); idev->stats.proc_dir_entry = NULL; return 0; } @@ -264,27 +246,12 @@ static int ipv6_proc_init_net(struct net *net) if (!proc_net_fops_create(net, "sockstat6", S_IRUGO, &sockstat6_seq_fops)) return -ENOMEM; - - if (!proc_net_fops_create(net, "snmp6", S_IRUGO, &snmp6_seq_fops)) - goto proc_snmp6_fail; - - net->mib.proc_net_devsnmp6 = proc_mkdir("dev_snmp6", net->proc_net); - if (!net->mib.proc_net_devsnmp6) - goto proc_dev_snmp6_fail; return 0; - -proc_snmp6_fail: - proc_net_remove(net, "sockstat6"); -proc_dev_snmp6_fail: - proc_net_remove(net, "dev_snmp6"); - return -ENOMEM; } static void ipv6_proc_exit_net(struct net *net) { proc_net_remove(net, "sockstat6"); - proc_net_remove(net, "dev_snmp6"); - proc_net_remove(net, "snmp6"); } static struct pernet_operations ipv6_proc_ops = { @@ -294,11 +261,33 @@ static struct pernet_operations ipv6_proc_ops = { int __init ipv6_misc_proc_init(void) { - return register_pernet_subsys(&ipv6_proc_ops); + int rc = 0; + + if (register_pernet_subsys(&ipv6_proc_ops)) + goto proc_net_fail; + + if (!proc_net_fops_create(&init_net, "snmp6", S_IRUGO, &snmp6_seq_fops)) + goto proc_snmp6_fail; + + proc_net_devsnmp6 = proc_mkdir("dev_snmp6", init_net.proc_net); + if (!proc_net_devsnmp6) + goto proc_dev_snmp6_fail; +out: + return rc; + +proc_dev_snmp6_fail: + proc_net_remove(&init_net, "snmp6"); +proc_snmp6_fail: + unregister_pernet_subsys(&ipv6_proc_ops); +proc_net_fail: + rc = -ENOMEM; + goto out; } void ipv6_misc_proc_exit(void) { + proc_net_remove(&init_net, "dev_snmp6"); + proc_net_remove(&init_net, "snmp6"); unregister_pernet_subsys(&ipv6_proc_ops); } diff --git a/trunk/net/ipv6/route.c b/trunk/net/ipv6/route.c index e10a17015504..f4385a6569c2 100644 --- a/trunk/net/ipv6/route.c +++ b/trunk/net/ipv6/route.c @@ -2631,8 +2631,10 @@ static int ip6_route_net_init(struct net *net) net->ipv6.ip6_prohibit_entry = kmemdup(&ip6_prohibit_entry_template, sizeof(*net->ipv6.ip6_prohibit_entry), GFP_KERNEL); - if (!net->ipv6.ip6_prohibit_entry) - goto out_ip6_null_entry; + if (!net->ipv6.ip6_prohibit_entry) { + kfree(net->ipv6.ip6_null_entry); + goto out; + } net->ipv6.ip6_prohibit_entry->u.dst.path = (struct dst_entry *)net->ipv6.ip6_prohibit_entry; net->ipv6.ip6_prohibit_entry->u.dst.ops = net->ipv6.ip6_dst_ops; @@ -2640,22 +2642,16 @@ static int ip6_route_net_init(struct net *net) net->ipv6.ip6_blk_hole_entry = kmemdup(&ip6_blk_hole_entry_template, sizeof(*net->ipv6.ip6_blk_hole_entry), GFP_KERNEL); - if (!net->ipv6.ip6_blk_hole_entry) - goto out_ip6_prohibit_entry; + if (!net->ipv6.ip6_blk_hole_entry) { + kfree(net->ipv6.ip6_null_entry); + kfree(net->ipv6.ip6_prohibit_entry); + goto out; + } net->ipv6.ip6_blk_hole_entry->u.dst.path = (struct dst_entry *)net->ipv6.ip6_blk_hole_entry; net->ipv6.ip6_blk_hole_entry->u.dst.ops = net->ipv6.ip6_dst_ops; #endif - net->ipv6.sysctl.flush_delay = 0; - net->ipv6.sysctl.ip6_rt_max_size = 4096; - net->ipv6.sysctl.ip6_rt_gc_min_interval = HZ / 2; - net->ipv6.sysctl.ip6_rt_gc_timeout = 60*HZ; - net->ipv6.sysctl.ip6_rt_gc_interval = 30*HZ; - net->ipv6.sysctl.ip6_rt_gc_elasticity = 9; - net->ipv6.sysctl.ip6_rt_mtu_expires = 10*60*HZ; - net->ipv6.sysctl.ip6_rt_min_advmss = IPV6_MIN_MTU - 20 - 40; - #ifdef CONFIG_PROC_FS proc_net_fops_create(net, "ipv6_route", 0, &ipv6_route_proc_fops); proc_net_fops_create(net, "rt6_stats", S_IRUGO, &rt6_stats_seq_fops); @@ -2666,12 +2662,6 @@ static int ip6_route_net_init(struct net *net) out: return ret; -#ifdef CONFIG_IPV6_MULTIPLE_TABLES -out_ip6_prohibit_entry: - kfree(net->ipv6.ip6_prohibit_entry); -out_ip6_null_entry: - kfree(net->ipv6.ip6_null_entry); -#endif out_ip6_dst_ops: release_net(net->ipv6.ip6_dst_ops->dst_net); kfree(net->ipv6.ip6_dst_ops); diff --git a/trunk/net/ipv6/tcp_ipv6.c b/trunk/net/ipv6/tcp_ipv6.c index 6268d266c034..df16b68644e7 100644 --- a/trunk/net/ipv6/tcp_ipv6.c +++ b/trunk/net/ipv6/tcp_ipv6.c @@ -1681,7 +1681,11 @@ static int tcp_v6_rcv(struct sk_buff *skb) TCP_SKB_CB(skb)->flags = ipv6_get_dsfield(ipv6_hdr(skb)); TCP_SKB_CB(skb)->sacked = 0; - sk = __inet6_lookup_skb(&tcp_hashinfo, skb, th->source, th->dest); + sk = __inet6_lookup(net, &tcp_hashinfo, + &ipv6_hdr(skb)->saddr, th->source, + &ipv6_hdr(skb)->daddr, ntohs(th->dest), + inet6_iif(skb)); + if (!sk) goto no_tcp_socket; diff --git a/trunk/net/ipv6/udp.c b/trunk/net/ipv6/udp.c index e51da8c092fa..a6aecf76a71b 100644 --- a/trunk/net/ipv6/udp.c +++ b/trunk/net/ipv6/udp.c @@ -107,21 +107,6 @@ static struct sock *__udp6_lib_lookup(struct net *net, return result; } -static struct sock *__udp6_lib_lookup_skb(struct sk_buff *skb, - __be16 sport, __be16 dport, - struct hlist_head udptable[]) -{ - struct sock *sk; - struct ipv6hdr *iph = ipv6_hdr(skb); - - if (unlikely(sk = skb_steal_sock(skb))) - return sk; - else - return __udp6_lib_lookup(dev_net(skb->dst->dev), &iph->saddr, sport, - &iph->daddr, dport, inet6_iif(skb), - udptable); -} - /* * This should be easy, if there is something there we * return it, otherwise we block. @@ -503,7 +488,8 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], * check socket cache ... must talk to Alan about his plans * for sock caches... i'll skip this for now. */ - sk = __udp6_lib_lookup_skb(skb, uh->source, uh->dest, udptable); + sk = __udp6_lib_lookup(net, saddr, uh->source, + daddr, uh->dest, inet6_iif(skb), udptable); if (sk == NULL) { if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) diff --git a/trunk/net/ipv6/udplite.c b/trunk/net/ipv6/udplite.c index 3cd1a1ac3d6c..f6cdcb348e05 100644 --- a/trunk/net/ipv6/udplite.c +++ b/trunk/net/ipv6/udplite.c @@ -13,6 +13,8 @@ */ #include "udp_impl.h" +DEFINE_SNMP_STAT(struct udp_mib, udplite_stats_in6) __read_mostly; + static int udplitev6_rcv(struct sk_buff *skb) { return __udp6_lib_rcv(skb, udplite_hash, IPPROTO_UDPLITE);