aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-18 11:25:14 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-18 11:25:14 -0400
commitbfea13d4a127aab4c10085b6f9b6e2ff4f023f79 (patch)
tree4195848eb43a12409511cea39903c3e4c6249281
parent32f9306b161a5e0c892132f7227f36de94090289 (diff)
parentf6c5d736af6bc71cebc017e4001ec5efff1ee116 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: [IPV4]: Remove IPVS icmp hack from route.c for now. [IPV4]: Correct rp_filter help text. [TCP]: TCP_CONG_YEAH requires TCP_CONG_VEGAS [TCP] slow start: Make comments and code logic clearer. [BLUETOOTH]: Fix locking in hci_sock_dev_event(). [NET]: Fix BMSR_100{HALF,FULL}2 defines in linux/mii.h [NET]: lockdep classes in register_netdevice
-rw-r--r--include/linux/mii.h4
-rw-r--r--net/bluetooth/hci_sock.c6
-rw-r--r--net/core/dev.c69
-rw-r--r--net/ipv4/Kconfig7
-rw-r--r--net/ipv4/route.c4
-rw-r--r--net/ipv4/tcp_cong.c40
6 files changed, 103 insertions, 27 deletions
diff --git a/include/linux/mii.h b/include/linux/mii.h
index beddc6d3b0f6..151b7e0182c7 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -56,8 +56,8 @@
56#define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */ 56#define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */
57#define BMSR_RESV 0x00c0 /* Unused... */ 57#define BMSR_RESV 0x00c0 /* Unused... */
58#define BMSR_ESTATEN 0x0100 /* Extended Status in R15 */ 58#define BMSR_ESTATEN 0x0100 /* Extended Status in R15 */
59#define BMSR_100FULL2 0x0200 /* Can do 100BASE-T2 HDX */ 59#define BMSR_100HALF2 0x0200 /* Can do 100BASE-T2 HDX */
60#define BMSR_100HALF2 0x0400 /* Can do 100BASE-T2 FDX */ 60#define BMSR_100FULL2 0x0400 /* Can do 100BASE-T2 FDX */
61#define BMSR_10HALF 0x0800 /* Can do 10mbps, half-duplex */ 61#define BMSR_10HALF 0x0800 /* Can do 10mbps, half-duplex */
62#define BMSR_10FULL 0x1000 /* Can do 10mbps, full-duplex */ 62#define BMSR_10FULL 0x1000 /* Can do 10mbps, full-duplex */
63#define BMSR_100HALF 0x2000 /* Can do 100mbps, half-duplex */ 63#define BMSR_100HALF 0x2000 /* Can do 100mbps, half-duplex */
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index bfc9a35bad33..1dae3dfc66a9 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -665,7 +665,8 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,
665 /* Detach sockets from device */ 665 /* Detach sockets from device */
666 read_lock(&hci_sk_list.lock); 666 read_lock(&hci_sk_list.lock);
667 sk_for_each(sk, node, &hci_sk_list.head) { 667 sk_for_each(sk, node, &hci_sk_list.head) {
668 lock_sock(sk); 668 local_bh_disable();
669 bh_lock_sock_nested(sk);
669 if (hci_pi(sk)->hdev == hdev) { 670 if (hci_pi(sk)->hdev == hdev) {
670 hci_pi(sk)->hdev = NULL; 671 hci_pi(sk)->hdev = NULL;
671 sk->sk_err = EPIPE; 672 sk->sk_err = EPIPE;
@@ -674,7 +675,8 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,
674 675
675 hci_dev_put(hdev); 676 hci_dev_put(hdev);
676 } 677 }
677 release_sock(sk); 678 bh_unlock_sock(sk);
679 local_bh_enable();
678 } 680 }
679 read_unlock(&hci_sk_list.lock); 681 read_unlock(&hci_sk_list.lock);
680 } 682 }
diff --git a/net/core/dev.c b/net/core/dev.c
index 8301e2ac747f..f2b61111e26d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -116,6 +116,7 @@
116#include <linux/dmaengine.h> 116#include <linux/dmaengine.h>
117#include <linux/err.h> 117#include <linux/err.h>
118#include <linux/ctype.h> 118#include <linux/ctype.h>
119#include <linux/if_arp.h>
119 120
120/* 121/*
121 * The list of packet types we will receive (as opposed to discard) 122 * The list of packet types we will receive (as opposed to discard)
@@ -217,6 +218,73 @@ extern void netdev_unregister_sysfs(struct net_device *);
217#define netdev_unregister_sysfs(dev) do { } while(0) 218#define netdev_unregister_sysfs(dev) do { } while(0)
218#endif 219#endif
219 220
221#ifdef CONFIG_DEBUG_LOCK_ALLOC
222/*
223 * register_netdevice() inits dev->_xmit_lock and sets lockdep class
224 * according to dev->type
225 */
226static const unsigned short netdev_lock_type[] =
227 {ARPHRD_NETROM, ARPHRD_ETHER, ARPHRD_EETHER, ARPHRD_AX25,
228 ARPHRD_PRONET, ARPHRD_CHAOS, ARPHRD_IEEE802, ARPHRD_ARCNET,
229 ARPHRD_APPLETLK, ARPHRD_DLCI, ARPHRD_ATM, ARPHRD_METRICOM,
230 ARPHRD_IEEE1394, ARPHRD_EUI64, ARPHRD_INFINIBAND, ARPHRD_SLIP,
231 ARPHRD_CSLIP, ARPHRD_SLIP6, ARPHRD_CSLIP6, ARPHRD_RSRVD,
232 ARPHRD_ADAPT, ARPHRD_ROSE, ARPHRD_X25, ARPHRD_HWX25,
233 ARPHRD_PPP, ARPHRD_CISCO, ARPHRD_LAPB, ARPHRD_DDCMP,
234 ARPHRD_RAWHDLC, ARPHRD_TUNNEL, ARPHRD_TUNNEL6, ARPHRD_FRAD,
235 ARPHRD_SKIP, ARPHRD_LOOPBACK, ARPHRD_LOCALTLK, ARPHRD_FDDI,
236 ARPHRD_BIF, ARPHRD_SIT, ARPHRD_IPDDP, ARPHRD_IPGRE,
237 ARPHRD_PIMREG, ARPHRD_HIPPI, ARPHRD_ASH, ARPHRD_ECONET,
238 ARPHRD_IRDA, ARPHRD_FCPP, ARPHRD_FCAL, ARPHRD_FCPL,
239 ARPHRD_FCFABRIC, ARPHRD_IEEE802_TR, ARPHRD_IEEE80211,
240 ARPHRD_IEEE80211_PRISM, ARPHRD_IEEE80211_RADIOTAP, ARPHRD_VOID,
241 ARPHRD_NONE};
242
243static const char *netdev_lock_name[] =
244 {"_xmit_NETROM", "_xmit_ETHER", "_xmit_EETHER", "_xmit_AX25",
245 "_xmit_PRONET", "_xmit_CHAOS", "_xmit_IEEE802", "_xmit_ARCNET",
246 "_xmit_APPLETLK", "_xmit_DLCI", "_xmit_ATM", "_xmit_METRICOM",
247 "_xmit_IEEE1394", "_xmit_EUI64", "_xmit_INFINIBAND", "_xmit_SLIP",
248 "_xmit_CSLIP", "_xmit_SLIP6", "_xmit_CSLIP6", "_xmit_RSRVD",
249 "_xmit_ADAPT", "_xmit_ROSE", "_xmit_X25", "_xmit_HWX25",
250 "_xmit_PPP", "_xmit_CISCO", "_xmit_LAPB", "_xmit_DDCMP",
251 "_xmit_RAWHDLC", "_xmit_TUNNEL", "_xmit_TUNNEL6", "_xmit_FRAD",
252 "_xmit_SKIP", "_xmit_LOOPBACK", "_xmit_LOCALTLK", "_xmit_FDDI",
253 "_xmit_BIF", "_xmit_SIT", "_xmit_IPDDP", "_xmit_IPGRE",
254 "_xmit_PIMREG", "_xmit_HIPPI", "_xmit_ASH", "_xmit_ECONET",
255 "_xmit_IRDA", "_xmit_FCPP", "_xmit_FCAL", "_xmit_FCPL",
256 "_xmit_FCFABRIC", "_xmit_IEEE802_TR", "_xmit_IEEE80211",
257 "_xmit_IEEE80211_PRISM", "_xmit_IEEE80211_RADIOTAP", "_xmit_VOID",
258 "_xmit_NONE"};
259
260static struct lock_class_key netdev_xmit_lock_key[ARRAY_SIZE(netdev_lock_type)];
261
262static inline unsigned short netdev_lock_pos(unsigned short dev_type)
263{
264 int i;
265
266 for (i = 0; i < ARRAY_SIZE(netdev_lock_type); i++)
267 if (netdev_lock_type[i] == dev_type)
268 return i;
269 /* the last key is used by default */
270 return ARRAY_SIZE(netdev_lock_type) - 1;
271}
272
273static inline void netdev_set_lockdep_class(spinlock_t *lock,
274 unsigned short dev_type)
275{
276 int i;
277
278 i = netdev_lock_pos(dev_type);
279 lockdep_set_class_and_name(lock, &netdev_xmit_lock_key[i],
280 netdev_lock_name[i]);
281}
282#else
283static inline void netdev_set_lockdep_class(spinlock_t *lock,
284 unsigned short dev_type)
285{
286}
287#endif
220 288
221/******************************************************************************* 289/*******************************************************************************
222 290
@@ -3001,6 +3069,7 @@ int register_netdevice(struct net_device *dev)
3001 3069
3002 spin_lock_init(&dev->queue_lock); 3070 spin_lock_init(&dev->queue_lock);
3003 spin_lock_init(&dev->_xmit_lock); 3071 spin_lock_init(&dev->_xmit_lock);
3072 netdev_set_lockdep_class(&dev->_xmit_lock, dev->type);
3004 dev->xmit_lock_owner = -1; 3073 dev->xmit_lock_owner = -1;
3005 spin_lock_init(&dev->ingress_lock); 3074 spin_lock_init(&dev->ingress_lock);
3006 3075
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index c68196cc56ab..010fbb2d45e9 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -43,11 +43,11 @@ config IP_ADVANCED_ROUTER
43 asymmetric routing (packets from you to a host take a different path 43 asymmetric routing (packets from you to a host take a different path
44 than packets from that host to you) or if you operate a non-routing 44 than packets from that host to you) or if you operate a non-routing
45 host which has several IP addresses on different interfaces. To turn 45 host which has several IP addresses on different interfaces. To turn
46 rp_filter off use: 46 rp_filter on use:
47 47
48 echo 0 > /proc/sys/net/ipv4/conf/<device>/rp_filter 48 echo 1 > /proc/sys/net/ipv4/conf/<device>/rp_filter
49 or 49 or
50 echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter 50 echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter
51 51
52 If unsure, say N here. 52 If unsure, say N here.
53 53
@@ -577,6 +577,7 @@ config TCP_CONG_VENO
577config TCP_CONG_YEAH 577config TCP_CONG_YEAH
578 tristate "YeAH TCP" 578 tristate "YeAH TCP"
579 depends on EXPERIMENTAL 579 depends on EXPERIMENTAL
580 select TCP_CONG_VEGAS
580 default n 581 default n
581 ---help--- 582 ---help---
582 YeAH-TCP is a sender-side high-speed enabled TCP congestion control 583 YeAH-TCP is a sender-side high-speed enabled TCP congestion control
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index cb76e3c725a0..df9fe4f2e8cc 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2396,7 +2396,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
2396 2396
2397 /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */ 2397 /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */
2398 dev_out = ip_dev_find(oldflp->fl4_src); 2398 dev_out = ip_dev_find(oldflp->fl4_src);
2399 if ((dev_out == NULL) && !(sysctl_ip_nonlocal_bind)) 2399 if (dev_out == NULL)
2400 goto out; 2400 goto out;
2401 2401
2402 /* I removed check for oif == dev_out->oif here. 2402 /* I removed check for oif == dev_out->oif here.
@@ -2407,7 +2407,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
2407 of another iface. --ANK 2407 of another iface. --ANK
2408 */ 2408 */
2409 2409
2410 if (dev_out && oldflp->oif == 0 2410 if (oldflp->oif == 0
2411 && (MULTICAST(oldflp->fl4_dst) || oldflp->fl4_dst == htonl(0xFFFFFFFF))) { 2411 && (MULTICAST(oldflp->fl4_dst) || oldflp->fl4_dst == htonl(0xFFFFFFFF))) {
2412 /* Special hack: user can direct multicasts 2412 /* Special hack: user can direct multicasts
2413 and limited broadcast via necessary interface 2413 and limited broadcast via necessary interface
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
index 86b26539e54b..1260e52ad772 100644
--- a/net/ipv4/tcp_cong.c
+++ b/net/ipv4/tcp_cong.c
@@ -276,30 +276,34 @@ int tcp_set_congestion_control(struct sock *sk, const char *name)
276 276
277 277
278/* 278/*
279 * Slow start (exponential increase) with 279 * Slow start is used when congestion window is less than slow start
280 * RFC3742 Limited Slow Start (fast linear increase) support. 280 * threshold. This version implements the basic RFC2581 version
281 * and optionally supports:
282 * RFC3742 Limited Slow Start - growth limited to max_ssthresh
283 * RFC3465 Appropriate Byte Counting - growth limited by bytes acknowledged
281 */ 284 */
282void tcp_slow_start(struct tcp_sock *tp) 285void tcp_slow_start(struct tcp_sock *tp)
283{ 286{
284 int cnt = 0; 287 int cnt; /* increase in packets */
285 288
286 if (sysctl_tcp_abc) { 289 /* RFC3465: ABC Slow start
287 /* RFC3465: Slow Start 290 * Increase only after a full MSS of bytes is acked
288 * TCP sender SHOULD increase cwnd by the number of 291 *
289 * previously unacknowledged bytes ACKed by each incoming 292 * TCP sender SHOULD increase cwnd by the number of
290 * acknowledgment, provided the increase is not more than L 293 * previously unacknowledged bytes ACKed by each incoming
291 */ 294 * acknowledgment, provided the increase is not more than L
292 if (tp->bytes_acked < tp->mss_cache) 295 */
293 return; 296 if (sysctl_tcp_abc && tp->bytes_acked < tp->mss_cache)
294 } 297 return;
295 298
296 if (sysctl_tcp_max_ssthresh > 0 && 299 if (sysctl_tcp_max_ssthresh > 0 && tp->snd_cwnd > sysctl_tcp_max_ssthresh)
297 tp->snd_cwnd > sysctl_tcp_max_ssthresh) 300 cnt = sysctl_tcp_max_ssthresh >> 1; /* limited slow start */
298 cnt += sysctl_tcp_max_ssthresh>>1;
299 else 301 else
300 cnt += tp->snd_cwnd; 302 cnt = tp->snd_cwnd; /* exponential increase */
301 303
302 /* RFC3465: We MAY increase by 2 if discovered delayed ack */ 304 /* RFC3465: ABC
305 * We MAY increase by 2 if discovered delayed ack
306 */
303 if (sysctl_tcp_abc > 1 && tp->bytes_acked >= 2*tp->mss_cache) 307 if (sysctl_tcp_abc > 1 && tp->bytes_acked >= 2*tp->mss_cache)
304 cnt <<= 1; 308 cnt <<= 1;
305 tp->bytes_acked = 0; 309 tp->bytes_acked = 0;