aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-11-12 14:12:06 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-11-12 14:12:06 -0500
commite697b8d13ede3893724898d983eff3f8c9183643 (patch)
tree0144d2d98d33e92a1d93739f0db12997c000d456
parent46015977e70f672ae6b20a1b5fb1e361208365ba (diff)
parent2994c63863ac350c4c8c6a65d8110749c2abb95c (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (39 commits) [INET]: Small possible memory leak in FIB rules [NETNS]: init dev_base_lock only once [UNIX]: The unix_nr_socks limit can be exceeded [AF_UNIX]: Convert socks to unix_socks in scan_inflight, not in callbacks [AF_UNIX]: Make unix_tot_inflight counter non-atomic [AF_PACKET]: Allow multicast traffic to be caught by ORIGDEV when bonded ssb: Fix PCMCIA-host lowlevel bus access mac80211: fix MAC80211_RCSIMPLE Kconfig mac80211: make "decrypt failed" messages conditional upon MAC80211_DEBUG mac80211: use IW_AUTH_PRIVACY_INVOKED rather than IW_AUTH_KEY_MGMT mac80211: remove unused driver ops mac80211: remove ieee80211_common.h softmac: MAINTAINERS update rfkill: Fix sparse warning rfkill: Use mutex_lock() at register and add sanity check iwlwifi: select proper rate control algorithm mac80211: allow driver to ask for a rate control algorithm mac80211: don't allow registering the same rate control twice rfkill: Use subsys_initcall mac80211: make simple rate control algorithm built-in ...
-rw-r--r--MAINTAINERS7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c2
-rw-r--r--drivers/ssb/main.c6
-rw-r--r--drivers/ssb/pcmcia.c56
-rw-r--r--include/linux/skbuff.h4
-rw-r--r--include/net/af_unix.h2
-rw-r--r--include/net/dst.h7
-rw-r--r--include/net/fib_rules.h3
-rw-r--r--include/net/inet_hashtables.h1
-rw-r--r--include/net/mac80211.h26
-rw-r--r--net/8021q/vlan.c5
-rw-r--r--net/8021q/vlan.h1
-rw-r--r--net/8021q/vlan_dev.c26
-rw-r--r--net/core/dev.c1
-rw-r--r--net/core/dev_mcast.c14
-rw-r--r--net/core/fib_rules.c22
-rw-r--r--net/decnet/dn_route.c16
-rw-r--r--net/decnet/dn_rules.c13
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_wx.c2
-rw-r--r--net/ipv4/fib_rules.c51
-rw-r--r--net/ipv4/route.c17
-rw-r--r--net/ipv4/tcp_input.c99
-rw-r--r--net/ipv4/tunnel4.c24
-rw-r--r--net/ipv6/fib6_rules.c37
-rw-r--r--net/ipv6/route.c6
-rw-r--r--net/ipx/af_ipx.c22
-rw-r--r--net/mac80211/Kconfig12
-rw-r--r--net/mac80211/Makefile3
-rw-r--r--net/mac80211/ieee80211.c16
-rw-r--r--net/mac80211/ieee80211_common.h91
-rw-r--r--net/mac80211/ieee80211_i.h2
-rw-r--r--net/mac80211/ieee80211_ioctl.c21
-rw-r--r--net/mac80211/ieee80211_rate.c24
-rw-r--r--net/mac80211/ieee80211_rate.h3
-rw-r--r--net/mac80211/ieee80211_sta.c18
-rw-r--r--net/mac80211/rc80211_simple.c25
-rw-r--r--net/mac80211/rx.c2
-rw-r--r--net/mac80211/wep.c2
-rw-r--r--net/mac80211/wpa.c18
-rw-r--r--net/packet/af_packet.c15
-rw-r--r--net/rfkill/rfkill.c37
-rw-r--r--net/sched/cls_u32.c12
-rw-r--r--net/unix/af_unix.c9
-rw-r--r--net/unix/garbage.c26
45 files changed, 380 insertions, 428 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 6a97027262..cad0882754 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3454,15 +3454,10 @@ L: lm-sensors@lm-sensors.org
3454S: Maintained 3454S: Maintained
3455 3455
3456SOFTMAC LAYER (IEEE 802.11) 3456SOFTMAC LAYER (IEEE 802.11)
3457P: Johannes Berg
3458M: johannes@sipsolutions.net
3459P: Joe Jezak
3460M: josejx@gentoo.org
3461P: Daniel Drake 3457P: Daniel Drake
3462M: dsd@gentoo.org 3458M: dsd@gentoo.org
3463W: http://softmac.sipsolutions.net/
3464L: linux-wireless@vger.kernel.org 3459L: linux-wireless@vger.kernel.org
3465S: Maintained 3460S: Obsolete
3466 3461
3467SOFTWARE RAID (Multiple Disks) SUPPORT 3462SOFTWARE RAID (Multiple Disks) SUPPORT
3468P: Ingo Molnar 3463P: Ingo Molnar
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 4f22a7174c..be7c9f42a3 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -8354,6 +8354,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8354 } 8354 }
8355 SET_IEEE80211_DEV(hw, &pdev->dev); 8355 SET_IEEE80211_DEV(hw, &pdev->dev);
8356 8356
8357 hw->rate_control_algorithm = "iwl-3945-rs";
8358
8357 IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); 8359 IWL_DEBUG_INFO("*** LOAD DRIVER ***\n");
8358 priv = hw->priv; 8360 priv = hw->priv;
8359 priv->hw = hw; 8361 priv->hw = hw;
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index d60adcb9bd..6757c6c1b2 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -8955,6 +8955,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8955 } 8955 }
8956 SET_IEEE80211_DEV(hw, &pdev->dev); 8956 SET_IEEE80211_DEV(hw, &pdev->dev);
8957 8957
8958 hw->rate_control_algorithm = "iwl-4965-rs";
8959
8958 IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); 8960 IWL_DEBUG_INFO("*** LOAD DRIVER ***\n");
8959 priv = hw->priv; 8961 priv = hw->priv;
8960 priv->hw = hw; 8962 priv->hw = hw;
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index c12a741b55..85a20546e8 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -440,6 +440,7 @@ static int ssb_devices_register(struct ssb_bus *bus)
440 break; 440 break;
441 case SSB_BUSTYPE_PCMCIA: 441 case SSB_BUSTYPE_PCMCIA:
442#ifdef CONFIG_SSB_PCMCIAHOST 442#ifdef CONFIG_SSB_PCMCIAHOST
443 sdev->irq = bus->host_pcmcia->irq.AssignedIRQ;
443 dev->parent = &bus->host_pcmcia->dev; 444 dev->parent = &bus->host_pcmcia->dev;
444#endif 445#endif
445 break; 446 break;
@@ -1147,7 +1148,10 @@ static int __init ssb_modinit(void)
1147 1148
1148 return err; 1149 return err;
1149} 1150}
1150subsys_initcall(ssb_modinit); 1151/* ssb must be initialized after PCI but before the ssb drivers.
1152 * That means we must use some initcall between subsys_initcall
1153 * and device_initcall. */
1154fs_initcall(ssb_modinit);
1151 1155
1152static void __exit ssb_modexit(void) 1156static void __exit ssb_modexit(void)
1153{ 1157{
diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c
index b6abee846f..bb44a76b3e 100644
--- a/drivers/ssb/pcmcia.c
+++ b/drivers/ssb/pcmcia.c
@@ -63,17 +63,17 @@ int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus,
63 err = pcmcia_access_configuration_register(pdev, &reg); 63 err = pcmcia_access_configuration_register(pdev, &reg);
64 if (err != CS_SUCCESS) 64 if (err != CS_SUCCESS)
65 goto error; 65 goto error;
66 read_addr |= (reg.Value & 0xF) << 12; 66 read_addr |= ((u32)(reg.Value & 0x0F)) << 12;
67 reg.Offset = 0x30; 67 reg.Offset = 0x30;
68 err = pcmcia_access_configuration_register(pdev, &reg); 68 err = pcmcia_access_configuration_register(pdev, &reg);
69 if (err != CS_SUCCESS) 69 if (err != CS_SUCCESS)
70 goto error; 70 goto error;
71 read_addr |= reg.Value << 16; 71 read_addr |= ((u32)reg.Value) << 16;
72 reg.Offset = 0x32; 72 reg.Offset = 0x32;
73 err = pcmcia_access_configuration_register(pdev, &reg); 73 err = pcmcia_access_configuration_register(pdev, &reg);
74 if (err != CS_SUCCESS) 74 if (err != CS_SUCCESS)
75 goto error; 75 goto error;
76 read_addr |= reg.Value << 24; 76 read_addr |= ((u32)reg.Value) << 24;
77 77
78 cur_core = (read_addr - SSB_ENUM_BASE) / SSB_CORE_SIZE; 78 cur_core = (read_addr - SSB_ENUM_BASE) / SSB_CORE_SIZE;
79 if (cur_core == coreidx) 79 if (cur_core == coreidx)
@@ -152,28 +152,29 @@ error:
152 goto out_unlock; 152 goto out_unlock;
153} 153}
154 154
155/* These are the main device register access functions. 155static int select_core_and_segment(struct ssb_device *dev,
156 * do_select_core is inline to have the likely hotpath inline. 156 u16 *offset)
157 * All unlikely codepaths are out-of-line. */
158static inline int do_select_core(struct ssb_bus *bus,
159 struct ssb_device *dev,
160 u16 *offset)
161{ 157{
158 struct ssb_bus *bus = dev->bus;
162 int err; 159 int err;
163 u8 need_seg = (*offset >= 0x800) ? 1 : 0; 160 u8 need_segment;
161
162 if (*offset >= 0x800) {
163 *offset -= 0x800;
164 need_segment = 1;
165 } else
166 need_segment = 0;
164 167
165 if (unlikely(dev != bus->mapped_device)) { 168 if (unlikely(dev != bus->mapped_device)) {
166 err = ssb_pcmcia_switch_core(bus, dev); 169 err = ssb_pcmcia_switch_core(bus, dev);
167 if (unlikely(err)) 170 if (unlikely(err))
168 return err; 171 return err;
169 } 172 }
170 if (unlikely(need_seg != bus->mapped_pcmcia_seg)) { 173 if (unlikely(need_segment != bus->mapped_pcmcia_seg)) {
171 err = ssb_pcmcia_switch_segment(bus, need_seg); 174 err = ssb_pcmcia_switch_segment(bus, need_segment);
172 if (unlikely(err)) 175 if (unlikely(err))
173 return err; 176 return err;
174 } 177 }
175 if (need_seg == 1)
176 *offset -= 0x800;
177 178
178 return 0; 179 return 0;
179} 180}
@@ -181,32 +182,31 @@ static inline int do_select_core(struct ssb_bus *bus,
181static u16 ssb_pcmcia_read16(struct ssb_device *dev, u16 offset) 182static u16 ssb_pcmcia_read16(struct ssb_device *dev, u16 offset)
182{ 183{
183 struct ssb_bus *bus = dev->bus; 184 struct ssb_bus *bus = dev->bus;
184 u16 x;
185 185
186 if (unlikely(do_select_core(bus, dev, &offset))) 186 if (unlikely(select_core_and_segment(dev, &offset)))
187 return 0xFFFF; 187 return 0xFFFF;
188 x = readw(bus->mmio + offset);
189 188
190 return x; 189 return readw(bus->mmio + offset);
191} 190}
192 191
193static u32 ssb_pcmcia_read32(struct ssb_device *dev, u16 offset) 192static u32 ssb_pcmcia_read32(struct ssb_device *dev, u16 offset)
194{ 193{
195 struct ssb_bus *bus = dev->bus; 194 struct ssb_bus *bus = dev->bus;
196 u32 x; 195 u32 lo, hi;
197 196
198 if (unlikely(do_select_core(bus, dev, &offset))) 197 if (unlikely(select_core_and_segment(dev, &offset)))
199 return 0xFFFFFFFF; 198 return 0xFFFFFFFF;
200 x = readl(bus->mmio + offset); 199 lo = readw(bus->mmio + offset);
200 hi = readw(bus->mmio + offset + 2);
201 201
202 return x; 202 return (lo | (hi << 16));
203} 203}
204 204
205static void ssb_pcmcia_write16(struct ssb_device *dev, u16 offset, u16 value) 205static void ssb_pcmcia_write16(struct ssb_device *dev, u16 offset, u16 value)
206{ 206{
207 struct ssb_bus *bus = dev->bus; 207 struct ssb_bus *bus = dev->bus;
208 208
209 if (unlikely(do_select_core(bus, dev, &offset))) 209 if (unlikely(select_core_and_segment(dev, &offset)))
210 return; 210 return;
211 writew(value, bus->mmio + offset); 211 writew(value, bus->mmio + offset);
212} 212}
@@ -215,12 +215,12 @@ static void ssb_pcmcia_write32(struct ssb_device *dev, u16 offset, u32 value)
215{ 215{
216 struct ssb_bus *bus = dev->bus; 216 struct ssb_bus *bus = dev->bus;
217 217
218 if (unlikely(do_select_core(bus, dev, &offset))) 218 if (unlikely(select_core_and_segment(dev, &offset)))
219 return; 219 return;
220 readw(bus->mmio + offset); 220 writeb((value & 0xFF000000) >> 24, bus->mmio + offset + 3);
221 writew(value >> 16, bus->mmio + offset + 2); 221 writeb((value & 0x00FF0000) >> 16, bus->mmio + offset + 2);
222 readw(bus->mmio + offset); 222 writeb((value & 0x0000FF00) >> 8, bus->mmio + offset + 1);
223 writew(value, bus->mmio + offset); 223 writeb((value & 0x000000FF) >> 0, bus->mmio + offset + 0);
224} 224}
225 225
226/* Not "static", as it's used in main.c */ 226/* Not "static", as it's used in main.c */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 94e49915a8..91140fe8c1 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -387,7 +387,9 @@ extern void skb_truesize_bug(struct sk_buff *skb);
387 387
388static inline void skb_truesize_check(struct sk_buff *skb) 388static inline void skb_truesize_check(struct sk_buff *skb)
389{ 389{
390 if (unlikely((int)skb->truesize < sizeof(struct sk_buff) + skb->len)) 390 int len = sizeof(struct sk_buff) + skb->len;
391
392 if (unlikely((int)skb->truesize < len))
391 skb_truesize_bug(skb); 393 skb_truesize_bug(skb);
392} 394}
393 395
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 0864a775de..a1c805d7f4 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -12,7 +12,7 @@ extern void unix_gc(void);
12 12
13#define UNIX_HASH_SIZE 256 13#define UNIX_HASH_SIZE 256
14 14
15extern atomic_t unix_tot_inflight; 15extern unsigned int unix_tot_inflight;
16 16
17struct unix_address { 17struct unix_address {
18 atomic_t refcnt; 18 atomic_t refcnt;
diff --git a/include/net/dst.h b/include/net/dst.h
index e9ff4a4cae..2f65e894b8 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -143,6 +143,13 @@ static inline void dst_hold(struct dst_entry * dst)
143 atomic_inc(&dst->__refcnt); 143 atomic_inc(&dst->__refcnt);
144} 144}
145 145
146static inline void dst_use(struct dst_entry *dst, unsigned long time)
147{
148 dst_hold(dst);
149 dst->__use++;
150 dst->lastuse = time;
151}
152
146static inline 153static inline
147struct dst_entry * dst_clone(struct dst_entry * dst) 154struct dst_entry * dst_clone(struct dst_entry * dst)
148{ 155{
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index 017aebd906..41a301e386 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -107,4 +107,7 @@ extern int fib_rules_unregister(struct fib_rules_ops *);
107extern int fib_rules_lookup(struct fib_rules_ops *, 107extern int fib_rules_lookup(struct fib_rules_ops *,
108 struct flowi *, int flags, 108 struct flowi *, int flags,
109 struct fib_lookup_arg *); 109 struct fib_lookup_arg *);
110extern int fib_default_rule_add(struct fib_rules_ops *,
111 u32 pref, u32 table,
112 u32 flags);
110#endif 113#endif
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 8461cda374..469216d936 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -23,6 +23,7 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/wait.h> 25#include <linux/wait.h>
26#include <linux/vmalloc.h>
26 27
27#include <net/inet_connection_sock.h> 28#include <net/inet_connection_sock.h>
28#include <net/inet_sock.h> 29#include <net/inet_sock.h>
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 5fcc4c1043..17b60391fc 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -706,11 +706,16 @@ enum ieee80211_hw_flags {
706 * 706 *
707 * @queues: number of available hardware transmit queues for 707 * @queues: number of available hardware transmit queues for
708 * data packets. WMM/QoS requires at least four. 708 * data packets. WMM/QoS requires at least four.
709 *
710 * @rate_control_algorithm: rate control algorithm for this hardware.
711 * If unset (NULL), the default algorithm will be used. Must be
712 * set before calling ieee80211_register_hw().
709 */ 713 */
710struct ieee80211_hw { 714struct ieee80211_hw {
711 struct ieee80211_conf conf; 715 struct ieee80211_conf conf;
712 struct wiphy *wiphy; 716 struct wiphy *wiphy;
713 struct workqueue_struct *workqueue; 717 struct workqueue_struct *workqueue;
718 const char *rate_control_algorithm;
714 void *priv; 719 void *priv;
715 u32 flags; 720 u32 flags;
716 unsigned int extra_tx_headroom; 721 unsigned int extra_tx_headroom;
@@ -936,27 +941,11 @@ enum ieee80211_erp_change_flags {
936 * and remove_interface calls, i.e. while the interface with the 941 * and remove_interface calls, i.e. while the interface with the
937 * given local_address is enabled. 942 * given local_address is enabled.
938 * 943 *
939 * @set_ieee8021x: Enable/disable IEEE 802.1X. This item requests wlan card
940 * to pass unencrypted EAPOL-Key frames even when encryption is
941 * configured. If the wlan card does not require such a configuration,
942 * this function pointer can be set to NULL.
943 *
944 * @set_port_auth: Set port authorization state (IEEE 802.1X PAE) to be
945 * authorized (@authorized=1) or unauthorized (=0). This function can be
946 * used if the wlan hardware or low-level driver implements PAE.
947 * mac80211 will filter frames based on authorization state in any case,
948 * so this function pointer can be NULL if low-level driver does not
949 * require event notification about port state changes.
950 *
951 * @hw_scan: Ask the hardware to service the scan request, no need to start 944 * @hw_scan: Ask the hardware to service the scan request, no need to start
952 * the scan state machine in stack. 945 * the scan state machine in stack.
953 * 946 *
954 * @get_stats: return low-level statistics 947 * @get_stats: return low-level statistics
955 * 948 *
956 * @set_privacy_invoked: For devices that generate their own beacons and probe
957 * response or association responses this updates the state of privacy_invoked
958 * returns 0 for success or an error number.
959 *
960 * @get_sequence_counter: For devices that have internal sequence counters this 949 * @get_sequence_counter: For devices that have internal sequence counters this
961 * callback allows mac80211 to access the current value of a counter. 950 * callback allows mac80211 to access the current value of a counter.
962 * This callback seems not well-defined, tell us if you need it. 951 * This callback seems not well-defined, tell us if you need it.
@@ -1029,14 +1018,9 @@ struct ieee80211_ops {
1029 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, 1018 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1030 const u8 *local_address, const u8 *address, 1019 const u8 *local_address, const u8 *address,
1031 struct ieee80211_key_conf *key); 1020 struct ieee80211_key_conf *key);
1032 int (*set_ieee8021x)(struct ieee80211_hw *hw, int use_ieee8021x);
1033 int (*set_port_auth)(struct ieee80211_hw *hw, u8 *addr,
1034 int authorized);
1035 int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); 1021 int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len);
1036 int (*get_stats)(struct ieee80211_hw *hw, 1022 int (*get_stats)(struct ieee80211_hw *hw,
1037 struct ieee80211_low_level_stats *stats); 1023 struct ieee80211_low_level_stats *stats);
1038 int (*set_privacy_invoked)(struct ieee80211_hw *hw,
1039 int privacy_invoked);
1040 int (*get_sequence_counter)(struct ieee80211_hw *hw, 1024 int (*get_sequence_counter)(struct ieee80211_hw *hw,
1041 u8* addr, u8 keyidx, u8 txrx, 1025 u8* addr, u8 keyidx, u8 txrx,
1042 u32* iv32, u16* iv16); 1026 u32* iv32, u16* iv16);
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 1037748c14..6567213959 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -376,6 +376,7 @@ void vlan_setup(struct net_device *new_dev)
376 new_dev->init = vlan_dev_init; 376 new_dev->init = vlan_dev_init;
377 new_dev->open = vlan_dev_open; 377 new_dev->open = vlan_dev_open;
378 new_dev->stop = vlan_dev_stop; 378 new_dev->stop = vlan_dev_stop;
379 new_dev->set_mac_address = vlan_set_mac_address;
379 new_dev->set_multicast_list = vlan_dev_set_multicast_list; 380 new_dev->set_multicast_list = vlan_dev_set_multicast_list;
380 new_dev->change_rx_flags = vlan_change_rx_flags; 381 new_dev->change_rx_flags = vlan_change_rx_flags;
381 new_dev->destructor = free_netdev; 382 new_dev->destructor = free_netdev;
@@ -636,6 +637,10 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
636 if (!vlandev) 637 if (!vlandev)
637 continue; 638 continue;
638 639
640 flgs = vlandev->flags;
641 if (!(flgs & IFF_UP))
642 continue;
643
639 vlan_sync_address(dev, vlandev); 644 vlan_sync_address(dev, vlandev);
640 } 645 }
641 break; 646 break;
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
index cf4a80d06b..2cd1393073 100644
--- a/net/8021q/vlan.h
+++ b/net/8021q/vlan.h
@@ -60,6 +60,7 @@ int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, struct net_device *dev
60int vlan_dev_change_mtu(struct net_device *dev, int new_mtu); 60int vlan_dev_change_mtu(struct net_device *dev, int new_mtu);
61int vlan_dev_open(struct net_device* dev); 61int vlan_dev_open(struct net_device* dev);
62int vlan_dev_stop(struct net_device* dev); 62int vlan_dev_stop(struct net_device* dev);
63int vlan_set_mac_address(struct net_device *dev, void *p);
63int vlan_dev_ioctl(struct net_device* dev, struct ifreq *ifr, int cmd); 64int vlan_dev_ioctl(struct net_device* dev, struct ifreq *ifr, int cmd);
64void vlan_dev_set_ingress_priority(const struct net_device *dev, 65void vlan_dev_set_ingress_priority(const struct net_device *dev,
65 u32 skb_prio, short vlan_prio); 66 u32 skb_prio, short vlan_prio);
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 1a1740aa9a..7a36878241 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -665,6 +665,32 @@ int vlan_dev_stop(struct net_device *dev)
665 return 0; 665 return 0;
666} 666}
667 667
668int vlan_set_mac_address(struct net_device *dev, void *p)
669{
670 struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev;
671 struct sockaddr *addr = p;
672 int err;
673
674 if (!is_valid_ether_addr(addr->sa_data))
675 return -EADDRNOTAVAIL;
676
677 if (!(dev->flags & IFF_UP))
678 goto out;
679
680 if (compare_ether_addr(addr->sa_data, real_dev->dev_addr)) {
681 err = dev_unicast_add(real_dev, addr->sa_data, ETH_ALEN);
682 if (err < 0)
683 return err;
684 }
685
686 if (compare_ether_addr(dev->dev_addr, real_dev->dev_addr))
687 dev_unicast_delete(real_dev, dev->dev_addr, ETH_ALEN);
688
689out:
690 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
691 return 0;
692}
693
668int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 694int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
669{ 695{
670 struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev; 696 struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev;
diff --git a/net/core/dev.c b/net/core/dev.c
index be6cedab5a..dd7e30754c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4330,7 +4330,6 @@ static struct hlist_head *netdev_create_hash(void)
4330static int __net_init netdev_init(struct net *net) 4330static int __net_init netdev_init(struct net *net)
4331{ 4331{
4332 INIT_LIST_HEAD(&net->dev_base_head); 4332 INIT_LIST_HEAD(&net->dev_base_head);
4333 rwlock_init(&dev_base_lock);
4334 4333
4335 net->dev_name_head = netdev_create_hash(); 4334 net->dev_name_head = netdev_create_hash();
4336 if (net->dev_name_head == NULL) 4335 if (net->dev_name_head == NULL)
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index ae354057d8..647973daca 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -168,13 +168,13 @@ void dev_mc_unsync(struct net_device *to, struct net_device *from)
168 da = from->mc_list; 168 da = from->mc_list;
169 while (da != NULL) { 169 while (da != NULL) {
170 next = da->next; 170 next = da->next;
171 if (!da->da_synced) 171 if (da->da_synced) {
172 continue; 172 __dev_addr_delete(&to->mc_list, &to->mc_count,
173 __dev_addr_delete(&to->mc_list, &to->mc_count, 173 da->da_addr, da->da_addrlen, 0);
174 da->da_addr, da->da_addrlen, 0); 174 da->da_synced = 0;
175 da->da_synced = 0; 175 __dev_addr_delete(&from->mc_list, &from->mc_count,
176 __dev_addr_delete(&from->mc_list, &from->mc_count, 176 da->da_addr, da->da_addrlen, 0);
177 da->da_addr, da->da_addrlen, 0); 177 }
178 da = next; 178 da = next;
179 } 179 }
180 __dev_set_rx_mode(to); 180 __dev_set_rx_mode(to);
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 13de6f53f0..848132b6cb 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -18,6 +18,28 @@
18static LIST_HEAD(rules_ops); 18static LIST_HEAD(rules_ops);
19static DEFINE_SPINLOCK(rules_mod_lock); 19static DEFINE_SPINLOCK(rules_mod_lock);
20 20
21int fib_default_rule_add(struct fib_rules_ops *ops,
22 u32 pref, u32 table, u32 flags)
23{
24 struct fib_rule *r;
25
26 r = kzalloc(ops->rule_size, GFP_KERNEL);
27 if (r == NULL)
28 return -ENOMEM;
29
30 atomic_set(&r->refcnt, 1);
31 r->action = FR_ACT_TO_TBL;
32 r->pref = pref;
33 r->table = table;
34 r->flags = flags;
35
36 /* The lock is not required here, the list in unreacheable
37 * at the moment this function is called */
38 list_add_tail(&r->list, &ops->rules_list);
39 return 0;
40}
41EXPORT_SYMBOL(fib_default_rule_add);
42
21static void notify_rule_change(int event, struct fib_rule *rule, 43static void notify_rule_change(int event, struct fib_rule *rule,
22 struct fib_rules_ops *ops, struct nlmsghdr *nlh, 44 struct fib_rules_ops *ops, struct nlmsghdr *nlh,
23 u32 pid); 45 u32 pid);
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 97eee5e8fb..66663e5d7a 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -293,9 +293,7 @@ static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route *
293 dn_rt_hash_table[hash].chain); 293 dn_rt_hash_table[hash].chain);
294 rcu_assign_pointer(dn_rt_hash_table[hash].chain, rth); 294 rcu_assign_pointer(dn_rt_hash_table[hash].chain, rth);
295 295
296 rth->u.dst.__use++; 296 dst_use(&rth->u.dst, now);
297 dst_hold(&rth->u.dst);
298 rth->u.dst.lastuse = now;
299 spin_unlock_bh(&dn_rt_hash_table[hash].lock); 297 spin_unlock_bh(&dn_rt_hash_table[hash].lock);
300 298
301 dnrt_drop(rt); 299 dnrt_drop(rt);
@@ -308,9 +306,7 @@ static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route *
308 rcu_assign_pointer(rt->u.dst.dn_next, dn_rt_hash_table[hash].chain); 306 rcu_assign_pointer(rt->u.dst.dn_next, dn_rt_hash_table[hash].chain);
309 rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt); 307 rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt);
310 308
311 dst_hold(&rt->u.dst); 309 dst_use(&rt->u.dst, now);
312 rt->u.dst.__use++;
313 rt->u.dst.lastuse = now;
314 spin_unlock_bh(&dn_rt_hash_table[hash].lock); 310 spin_unlock_bh(&dn_rt_hash_table[hash].lock);
315 *rp = rt; 311 *rp = rt;
316 return 0; 312 return 0;
@@ -1182,9 +1178,7 @@ static int __dn_route_output_key(struct dst_entry **pprt, const struct flowi *fl
1182 (flp->mark == rt->fl.mark) && 1178 (flp->mark == rt->fl.mark) &&
1183 (rt->fl.iif == 0) && 1179 (rt->fl.iif == 0) &&
1184 (rt->fl.oif == flp->oif)) { 1180 (rt->fl.oif == flp->oif)) {
1185 rt->u.dst.lastuse = jiffies; 1181 dst_use(&rt->u.dst, jiffies);
1186 dst_hold(&rt->u.dst);
1187 rt->u.dst.__use++;
1188 rcu_read_unlock_bh(); 1182 rcu_read_unlock_bh();
1189 *pprt = &rt->u.dst; 1183 *pprt = &rt->u.dst;
1190 return 0; 1184 return 0;
@@ -1456,9 +1450,7 @@ int dn_route_input(struct sk_buff *skb)
1456 (rt->fl.oif == 0) && 1450 (rt->fl.oif == 0) &&
1457 (rt->fl.mark == skb->mark) && 1451 (rt->fl.mark == skb->mark) &&
1458 (rt->fl.iif == cb->iif)) { 1452 (rt->fl.iif == cb->iif)) {
1459 rt->u.dst.lastuse = jiffies; 1453 dst_use(&rt->u.dst, jiffies);
1460 dst_hold(&rt->u.dst);
1461 rt->u.dst.__use++;
1462 rcu_read_unlock(); 1454 rcu_read_unlock();
1463 skb->dst = (struct dst_entry *)rt; 1455 skb->dst = (struct dst_entry *)rt;
1464 return 0; 1456 return 0;
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c
index ddd3f04f09..ffebea04cc 100644
--- a/net/decnet/dn_rules.c
+++ b/net/decnet/dn_rules.c
@@ -48,15 +48,6 @@ struct dn_fib_rule
48 u8 flags; 48 u8 flags;
49}; 49};
50 50
51static struct dn_fib_rule default_rule = {
52 .common = {
53 .refcnt = ATOMIC_INIT(2),
54 .pref = 0x7fff,
55 .table = RT_TABLE_MAIN,
56 .action = FR_ACT_TO_TBL,
57 },
58};
59
60 51
61int dn_fib_lookup(struct flowi *flp, struct dn_fib_res *res) 52int dn_fib_lookup(struct flowi *flp, struct dn_fib_res *res)
62{ 53{
@@ -262,8 +253,8 @@ static struct fib_rules_ops dn_fib_rules_ops = {
262 253
263void __init dn_fib_rules_init(void) 254void __init dn_fib_rules_init(void)
264{ 255{
265 list_add_tail(&default_rule.common.list, 256 BUG_ON(fib_default_rule_add(&dn_fib_rules_ops, 0x7fff,
266 &dn_fib_rules_ops.rules_list); 257 RT_TABLE_MAIN, 0));
267 fib_rules_register(&dn_fib_rules_ops); 258 fib_rules_register(&dn_fib_rules_ops);
268} 259}
269 260
diff --git a/net/ieee80211/softmac/ieee80211softmac_wx.c b/net/ieee80211/softmac/ieee80211softmac_wx.c
index ac36767b56..e01b59aedc 100644
--- a/net/ieee80211/softmac/ieee80211softmac_wx.c
+++ b/net/ieee80211/softmac/ieee80211softmac_wx.c
@@ -470,7 +470,7 @@ ieee80211softmac_wx_set_mlme(struct net_device *dev,
470{ 470{
471 struct ieee80211softmac_device *mac = ieee80211_priv(dev); 471 struct ieee80211softmac_device *mac = ieee80211_priv(dev);
472 struct iw_mlme *mlme = (struct iw_mlme *)extra; 472 struct iw_mlme *mlme = (struct iw_mlme *)extra;
473 u16 reason = cpu_to_le16(mlme->reason_code); 473 u16 reason = mlme->reason_code;
474 struct ieee80211softmac_network *net; 474 struct ieee80211softmac_network *net;
475 int err = -EINVAL; 475 int err = -EINVAL;
476 476
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index f16839c6a7..a0ada3a8d8 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -49,33 +49,6 @@ struct fib4_rule
49#endif 49#endif
50}; 50};
51 51
52static struct fib4_rule default_rule = {
53 .common = {
54 .refcnt = ATOMIC_INIT(2),
55 .pref = 0x7FFF,
56 .table = RT_TABLE_DEFAULT,
57 .action = FR_ACT_TO_TBL,
58 },
59};
60
61static struct fib4_rule main_rule = {
62 .common = {
63 .refcnt = ATOMIC_INIT(2),
64 .pref = 0x7FFE,
65 .table = RT_TABLE_MAIN,
66 .action = FR_ACT_TO_TBL,
67 },
68};
69
70static struct fib4_rule local_rule = {
71 .common = {
72 .refcnt = ATOMIC_INIT(2),
73 .table = RT_TABLE_LOCAL,
74 .action = FR_ACT_TO_TBL,
75 .flags = FIB_RULE_PERMANENT,
76 },
77};
78
79#ifdef CONFIG_NET_CLS_ROUTE 52#ifdef CONFIG_NET_CLS_ROUTE
80u32 fib_rules_tclass(struct fib_result *res) 53u32 fib_rules_tclass(struct fib_result *res)
81{ 54{
@@ -319,11 +292,27 @@ static struct fib_rules_ops fib4_rules_ops = {
319 .owner = THIS_MODULE, 292 .owner = THIS_MODULE,
320}; 293};
321 294
322void __init fib4_rules_init(void) 295static int __init fib_default_rules_init(void)
323{ 296{
324 list_add_tail(&local_rule.common.list, &fib4_rules_ops.rules_list); 297 int err;
325 list_add_tail(&main_rule.common.list, &fib4_rules_ops.rules_list); 298
326 list_add_tail(&default_rule.common.list, &fib4_rules_ops.rules_list); 299 err = fib_default_rule_add(&fib4_rules_ops, 0,
300 RT_TABLE_LOCAL, FIB_RULE_PERMANENT);
301 if (err < 0)
302 return err;
303 err = fib_default_rule_add(&fib4_rules_ops, 0x7FFE,
304 RT_TABLE_MAIN, 0);
305 if (err < 0)
306 return err;
307 err = fib_default_rule_add(&fib4_rules_ops, 0x7FFF,
308 RT_TABLE_DEFAULT, 0);
309 if (err < 0)
310 return err;
311 return 0;
312}
327 313
314void __init fib4_rules_init(void)
315{
316 BUG_ON(fib_default_rules_init());
328 fib_rules_register(&fib4_rules_ops); 317 fib_rules_register(&fib4_rules_ops);
329} 318}
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 21b12de9e6..45651834e1 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -851,9 +851,7 @@ restart:
851 */ 851 */
852 rcu_assign_pointer(rt_hash_table[hash].chain, rth); 852 rcu_assign_pointer(rt_hash_table[hash].chain, rth);
853 853
854 rth->u.dst.__use++; 854 dst_use(&rth->u.dst, now);
855 dst_hold(&rth->u.dst);
856 rth->u.dst.lastuse = now;
857 spin_unlock_bh(rt_hash_lock_addr(hash)); 855 spin_unlock_bh(rt_hash_lock_addr(hash));
858 856
859 rt_drop(rt); 857 rt_drop(rt);
@@ -1813,11 +1811,6 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1813 goto martian_destination; 1811 goto martian_destination;
1814 1812
1815 err = ip_mkroute_input(skb, &res, &fl, in_dev, daddr, saddr, tos); 1813 err = ip_mkroute_input(skb, &res, &fl, in_dev, daddr, saddr, tos);
1816 if (err == -ENOBUFS)
1817 goto e_nobufs;
1818 if (err == -EINVAL)
1819 goto e_inval;
1820
1821done: 1814done:
1822 in_dev_put(in_dev); 1815 in_dev_put(in_dev);
1823 if (free_res) 1816 if (free_res)
@@ -1935,9 +1928,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1935 rth->fl.oif == 0 && 1928 rth->fl.oif == 0 &&
1936 rth->fl.mark == skb->mark && 1929 rth->fl.mark == skb->mark &&
1937 rth->fl.fl4_tos == tos) { 1930 rth->fl.fl4_tos == tos) {
1938 rth->u.dst.lastuse = jiffies; 1931 dst_use(&rth->u.dst, jiffies);
1939 dst_hold(&rth->u.dst);
1940 rth->u.dst.__use++;
1941 RT_CACHE_STAT_INC(in_hit); 1932 RT_CACHE_STAT_INC(in_hit);
1942 rcu_read_unlock(); 1933 rcu_read_unlock();
1943 skb->dst = (struct dst_entry*)rth; 1934 skb->dst = (struct dst_entry*)rth;
@@ -2331,9 +2322,7 @@ int __ip_route_output_key(struct rtable **rp, const struct flowi *flp)
2331 rth->fl.mark == flp->mark && 2322 rth->fl.mark == flp->mark &&
2332 !((rth->fl.fl4_tos ^ flp->fl4_tos) & 2323 !((rth->fl.fl4_tos ^ flp->fl4_tos) &
2333 (IPTOS_RT_MASK | RTO_ONLINK))) { 2324 (IPTOS_RT_MASK | RTO_ONLINK))) {
2334 rth->u.dst.lastuse = jiffies; 2325 dst_use(&rth->u.dst, jiffies);
2335 dst_hold(&rth->u.dst);
2336 rth->u.dst.__use++;
2337 RT_CACHE_STAT_INC(out_hit); 2326 RT_CACHE_STAT_INC(out_hit);
2338 rcu_read_unlock_bh(); 2327 rcu_read_unlock_bh();
2339 *rp = rth; 2328 *rp = rth;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index ca9590f4f5..20c9440ab8 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1400,11 +1400,9 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1400 /* DSACK info lost if out-of-mem, try SACK still */ 1400 /* DSACK info lost if out-of-mem, try SACK still */
1401 if (in_sack <= 0) 1401 if (in_sack <= 0)
1402 in_sack = tcp_match_skb_to_sack(sk, skb, start_seq, end_seq); 1402 in_sack = tcp_match_skb_to_sack(sk, skb, start_seq, end_seq);
1403 if (in_sack < 0) 1403 if (unlikely(in_sack < 0))
1404 break; 1404 break;
1405 1405
1406 fack_count += tcp_skb_pcount(skb);
1407
1408 sacked = TCP_SKB_CB(skb)->sacked; 1406 sacked = TCP_SKB_CB(skb)->sacked;
1409 1407
1410 /* Account D-SACK for retransmitted packet. */ 1408 /* Account D-SACK for retransmitted packet. */
@@ -1419,19 +1417,17 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1419 if ((dup_sack && in_sack) && 1417 if ((dup_sack && in_sack) &&
1420 (sacked&TCPCB_SACKED_ACKED)) 1418 (sacked&TCPCB_SACKED_ACKED))
1421 reord = min(fack_count, reord); 1419 reord = min(fack_count, reord);
1422 } else {
1423 /* If it was in a hole, we detected reordering. */
1424 if (fack_count < prior_fackets &&
1425 !(sacked&TCPCB_SACKED_ACKED))
1426 reord = min(fack_count, reord);
1427 } 1420 }
1428 1421
1429 /* Nothing to do; acked frame is about to be dropped. */ 1422 /* Nothing to do; acked frame is about to be dropped. */
1423 fack_count += tcp_skb_pcount(skb);
1430 continue; 1424 continue;
1431 } 1425 }
1432 1426
1433 if (!in_sack) 1427 if (!in_sack) {
1428 fack_count += tcp_skb_pcount(skb);
1434 continue; 1429 continue;
1430 }
1435 1431
1436 if (!(sacked&TCPCB_SACKED_ACKED)) { 1432 if (!(sacked&TCPCB_SACKED_ACKED)) {
1437 if (sacked & TCPCB_SACKED_RETRANS) { 1433 if (sacked & TCPCB_SACKED_RETRANS) {
@@ -1448,12 +1444,17 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1448 tp->retransmit_skb_hint = NULL; 1444 tp->retransmit_skb_hint = NULL;
1449 } 1445 }
1450 } else { 1446 } else {
1451 /* New sack for not retransmitted frame, 1447 if (!(sacked & TCPCB_RETRANS)) {
1452 * which was in hole. It is reordering. 1448 /* New sack for not retransmitted frame,
1453 */ 1449 * which was in hole. It is reordering.
1454 if (!(sacked & TCPCB_RETRANS) && 1450 */
1455 fack_count < prior_fackets) 1451 if (fack_count < prior_fackets)
1456 reord = min(fack_count, reord); 1452 reord = min(fack_count, reord);
1453
1454 /* SACK enhanced F-RTO (RFC4138; Appendix B) */
1455 if (!after(TCP_SKB_CB(skb)->end_seq, tp->frto_highmark))
1456 flag |= FLAG_ONLY_ORIG_SACKED;
1457 }
1457 1458
1458 if (sacked & TCPCB_LOST) { 1459 if (sacked & TCPCB_LOST) {
1459 TCP_SKB_CB(skb)->sacked &= ~TCPCB_LOST; 1460 TCP_SKB_CB(skb)->sacked &= ~TCPCB_LOST;
@@ -1462,24 +1463,13 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1462 /* clear lost hint */ 1463 /* clear lost hint */
1463 tp->retransmit_skb_hint = NULL; 1464 tp->retransmit_skb_hint = NULL;
1464 } 1465 }
1465 /* SACK enhanced F-RTO detection.
1466 * Set flag if and only if non-rexmitted
1467 * segments below frto_highmark are
1468 * SACKed (RFC4138; Appendix B).
1469 * Clearing correct due to in-order walk
1470 */
1471 if (after(end_seq, tp->frto_highmark)) {
1472 flag &= ~FLAG_ONLY_ORIG_SACKED;
1473 } else {
1474 if (!(sacked & TCPCB_RETRANS))
1475 flag |= FLAG_ONLY_ORIG_SACKED;
1476 }
1477 } 1466 }
1478 1467
1479 TCP_SKB_CB(skb)->sacked |= TCPCB_SACKED_ACKED; 1468 TCP_SKB_CB(skb)->sacked |= TCPCB_SACKED_ACKED;
1480 flag |= FLAG_DATA_SACKED; 1469 flag |= FLAG_DATA_SACKED;
1481 tp->sacked_out += tcp_skb_pcount(skb); 1470 tp->sacked_out += tcp_skb_pcount(skb);
1482 1471
1472 fack_count += tcp_skb_pcount(skb);
1483 if (fack_count > tp->fackets_out) 1473 if (fack_count > tp->fackets_out)
1484 tp->fackets_out = fack_count; 1474 tp->fackets_out = fack_count;
1485 1475
@@ -1490,6 +1480,8 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1490 } else { 1480 } else {
1491 if (dup_sack && (sacked&TCPCB_RETRANS)) 1481 if (dup_sack && (sacked&TCPCB_RETRANS))
1492 reord = min(fack_count, reord); 1482 reord = min(fack_count, reord);
1483
1484 fack_count += tcp_skb_pcount(skb);
1493 } 1485 }
1494 1486
1495 /* D-SACK. We can detect redundant retransmission 1487 /* D-SACK. We can detect redundant retransmission
@@ -1504,6 +1496,12 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1504 tp->retransmit_skb_hint = NULL; 1496 tp->retransmit_skb_hint = NULL;
1505 } 1497 }
1506 } 1498 }
1499
1500 /* SACK enhanced FRTO (RFC4138, Appendix B): Clearing correct
1501 * due to in-order walk
1502 */
1503 if (after(end_seq, tp->frto_highmark))
1504 flag &= ~FLAG_ONLY_ORIG_SACKED;
1507 } 1505 }
1508 1506
1509 if (tp->retrans_out && 1507 if (tp->retrans_out &&
@@ -1515,7 +1513,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1515 1513
1516 if ((reord < tp->fackets_out) && icsk->icsk_ca_state != TCP_CA_Loss && 1514 if ((reord < tp->fackets_out) && icsk->icsk_ca_state != TCP_CA_Loss &&
1517 (!tp->frto_highmark || after(tp->snd_una, tp->frto_highmark))) 1515 (!tp->frto_highmark || after(tp->snd_una, tp->frto_highmark)))
1518 tcp_update_reordering(sk, ((tp->fackets_out + 1) - reord), 0); 1516 tcp_update_reordering(sk, tp->fackets_out - reord, 0);
1519 1517
1520#if FASTRETRANS_DEBUG > 0 1518#if FASTRETRANS_DEBUG > 0
1521 BUG_TRAP((int)tp->sacked_out >= 0); 1519 BUG_TRAP((int)tp->sacked_out >= 0);
@@ -2630,7 +2628,8 @@ static u32 tcp_tso_acked(struct sock *sk, struct sk_buff *skb)
2630 * is before the ack sequence we can discard it as it's confirmed to have 2628 * is before the ack sequence we can discard it as it's confirmed to have
2631 * arrived at the other end. 2629 * arrived at the other end.
2632 */ 2630 */
2633static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p) 2631static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p,
2632 int prior_fackets)
2634{ 2633{
2635 struct tcp_sock *tp = tcp_sk(sk); 2634 struct tcp_sock *tp = tcp_sk(sk);
2636 const struct inet_connection_sock *icsk = inet_csk(sk); 2635 const struct inet_connection_sock *icsk = inet_csk(sk);
@@ -2639,6 +2638,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p)
2639 int fully_acked = 1; 2638 int fully_acked = 1;
2640 int flag = 0; 2639 int flag = 0;
2641 int prior_packets = tp->packets_out; 2640 int prior_packets = tp->packets_out;
2641 u32 cnt = 0;
2642 u32 reord = tp->packets_out;
2642 s32 seq_rtt = -1; 2643 s32 seq_rtt = -1;
2643 ktime_t last_ackt = net_invalid_timestamp(); 2644 ktime_t last_ackt = net_invalid_timestamp();
2644 2645
@@ -2679,10 +2680,14 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p)
2679 if ((flag & FLAG_DATA_ACKED) || 2680 if ((flag & FLAG_DATA_ACKED) ||
2680 (packets_acked > 1)) 2681 (packets_acked > 1))
2681 flag |= FLAG_NONHEAD_RETRANS_ACKED; 2682 flag |= FLAG_NONHEAD_RETRANS_ACKED;
2682 } else if (seq_rtt < 0) { 2683 } else {
2683 seq_rtt = now - scb->when; 2684 if (seq_rtt < 0) {
2684 if (fully_acked) 2685 seq_rtt = now - scb->when;
2685 last_ackt = skb->tstamp; 2686 if (fully_acked)
2687 last_ackt = skb->tstamp;
2688 }
2689 if (!(sacked & TCPCB_SACKED_ACKED))
2690 reord = min(cnt, reord);
2686 } 2691 }
2687 2692
2688 if (sacked & TCPCB_SACKED_ACKED) 2693 if (sacked & TCPCB_SACKED_ACKED)
@@ -2693,12 +2698,16 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p)
2693 if ((sacked & TCPCB_URG) && tp->urg_mode && 2698 if ((sacked & TCPCB_URG) && tp->urg_mode &&
2694 !before(end_seq, tp->snd_up)) 2699 !before(end_seq, tp->snd_up))
2695 tp->urg_mode = 0; 2700 tp->urg_mode = 0;
2696 } else if (seq_rtt < 0) { 2701 } else {
2697 seq_rtt = now - scb->when; 2702 if (seq_rtt < 0) {
2698 if (fully_acked) 2703 seq_rtt = now - scb->when;
2699 last_ackt = skb->tstamp; 2704 if (fully_acked)
2705 last_ackt = skb->tstamp;
2706 }
2707 reord = min(cnt, reord);
2700 } 2708 }
2701 tp->packets_out -= packets_acked; 2709 tp->packets_out -= packets_acked;
2710 cnt += packets_acked;
2702 2711
2703 /* Initial outgoing SYN's get put onto the write_queue 2712 /* Initial outgoing SYN's get put onto the write_queue
2704 * just like anything else we transmit. It is not 2713 * just like anything else we transmit. It is not
@@ -2730,13 +2739,18 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p)
2730 tcp_ack_update_rtt(sk, flag, seq_rtt); 2739 tcp_ack_update_rtt(sk, flag, seq_rtt);
2731 tcp_rearm_rto(sk); 2740 tcp_rearm_rto(sk);
2732 2741
2742 if (tcp_is_reno(tp)) {
2743 tcp_remove_reno_sacks(sk, pkts_acked);
2744 } else {
2745 /* Non-retransmitted hole got filled? That's reordering */
2746 if (reord < prior_fackets)
2747 tcp_update_reordering(sk, tp->fackets_out - reord, 0);
2748 }
2749
2733 tp->fackets_out -= min(pkts_acked, tp->fackets_out); 2750 tp->fackets_out -= min(pkts_acked, tp->fackets_out);
2734 /* hint's skb might be NULL but we don't need to care */ 2751 /* hint's skb might be NULL but we don't need to care */
2735 tp->fastpath_cnt_hint -= min_t(u32, pkts_acked, 2752 tp->fastpath_cnt_hint -= min_t(u32, pkts_acked,
2736 tp->fastpath_cnt_hint); 2753 tp->fastpath_cnt_hint);
2737 if (tcp_is_reno(tp))
2738 tcp_remove_reno_sacks(sk, pkts_acked);
2739
2740 if (ca_ops->pkts_acked) { 2754 if (ca_ops->pkts_acked) {
2741 s32 rtt_us = -1; 2755 s32 rtt_us = -1;
2742 2756
@@ -3019,6 +3033,7 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag)
3019 u32 ack_seq = TCP_SKB_CB(skb)->seq; 3033 u32 ack_seq = TCP_SKB_CB(skb)->seq;
3020 u32 ack = TCP_SKB_CB(skb)->ack_seq; 3034 u32 ack = TCP_SKB_CB(skb)->ack_seq;
3021 u32 prior_in_flight; 3035 u32 prior_in_flight;
3036 u32 prior_fackets;
3022 s32 seq_rtt; 3037 s32 seq_rtt;
3023 int prior_packets; 3038 int prior_packets;
3024 int frto_cwnd = 0; 3039 int frto_cwnd = 0;
@@ -3043,6 +3058,8 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag)
3043 tp->bytes_acked += min(ack - prior_snd_una, tp->mss_cache); 3058 tp->bytes_acked += min(ack - prior_snd_una, tp->mss_cache);
3044 } 3059 }
3045 3060
3061 prior_fackets = tp->fackets_out;
3062
3046 if (!(flag&FLAG_SLOWPATH) && after(ack, prior_snd_una)) { 3063 if (!(flag&FLAG_SLOWPATH) && after(ack, prior_snd_una)) {
3047 /* Window is constant, pure forward advance. 3064 /* Window is constant, pure forward advance.
3048 * No more checks are required. 3065 * No more checks are required.
@@ -3084,7 +3101,7 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag)
3084 prior_in_flight = tcp_packets_in_flight(tp); 3101 prior_in_flight = tcp_packets_in_flight(tp);
3085 3102
3086 /* See if we can take anything off of the retransmit queue. */ 3103 /* See if we can take anything off of the retransmit queue. */
3087 flag |= tcp_clean_rtx_queue(sk, &seq_rtt); 3104 flag |= tcp_clean_rtx_queue(sk, &seq_rtt, prior_fackets);
3088 3105
3089 /* Guarantee sacktag reordering detection against wrap-arounds */ 3106 /* Guarantee sacktag reordering detection against wrap-arounds */
3090 if (before(tp->frto_highmark, tp->snd_una)) 3107 if (before(tp->frto_highmark, tp->snd_una))
diff --git a/net/ipv4/tunnel4.c b/net/ipv4/tunnel4.c
index a794a8ca8b..978b3fd61e 100644
--- a/net/ipv4/tunnel4.c
+++ b/net/ipv4/tunnel4.c
@@ -17,6 +17,11 @@ static struct xfrm_tunnel *tunnel4_handlers;
17static struct xfrm_tunnel *tunnel64_handlers; 17static struct xfrm_tunnel *tunnel64_handlers;
18static DEFINE_MUTEX(tunnel4_mutex); 18static DEFINE_MUTEX(tunnel4_mutex);
19 19
20static inline struct xfrm_tunnel **fam_handlers(unsigned short family)
21{
22 return (family == AF_INET) ? &tunnel4_handlers : &tunnel64_handlers;
23}
24
20int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family) 25int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family)
21{ 26{
22 struct xfrm_tunnel **pprev; 27 struct xfrm_tunnel **pprev;
@@ -25,8 +30,7 @@ int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family)
25 30
26 mutex_lock(&tunnel4_mutex); 31 mutex_lock(&tunnel4_mutex);
27 32
28 for (pprev = (family == AF_INET) ? &tunnel4_handlers : &tunnel64_handlers; 33 for (pprev = fam_handlers(family); *pprev; pprev = &(*pprev)->next) {
29 *pprev; pprev = &(*pprev)->next) {
30 if ((*pprev)->priority > priority) 34 if ((*pprev)->priority > priority)
31 break; 35 break;
32 if ((*pprev)->priority == priority) 36 if ((*pprev)->priority == priority)
@@ -53,8 +57,7 @@ int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family)
53 57
54 mutex_lock(&tunnel4_mutex); 58 mutex_lock(&tunnel4_mutex);
55 59
56 for (pprev = (family == AF_INET) ? &tunnel4_handlers : &tunnel64_handlers; 60 for (pprev = fam_handlers(family); *pprev; pprev = &(*pprev)->next) {
57 *pprev; pprev = &(*pprev)->next) {
58 if (*pprev == handler) { 61 if (*pprev == handler) {
59 *pprev = handler->next; 62 *pprev = handler->next;
60 ret = 0; 63 ret = 0;
@@ -118,6 +121,17 @@ static void tunnel4_err(struct sk_buff *skb, u32 info)
118 break; 121 break;
119} 122}
120 123
124#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
125static void tunnel64_err(struct sk_buff *skb, u32 info)
126{
127 struct xfrm_tunnel *handler;
128
129 for (handler = tunnel64_handlers; handler; handler = handler->next)
130 if (!handler->err_handler(skb, info))
131 break;
132}
133#endif
134
121static struct net_protocol tunnel4_protocol = { 135static struct net_protocol tunnel4_protocol = {
122 .handler = tunnel4_rcv, 136 .handler = tunnel4_rcv,
123 .err_handler = tunnel4_err, 137 .err_handler = tunnel4_err,
@@ -127,7 +141,7 @@ static struct net_protocol tunnel4_protocol = {
127#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 141#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
128static struct net_protocol tunnel64_protocol = { 142static struct net_protocol tunnel64_protocol = {
129 .handler = tunnel64_rcv, 143 .handler = tunnel64_rcv,
130 .err_handler = tunnel4_err, 144 .err_handler = tunnel64_err,
131 .no_policy = 1, 145 .no_policy = 1,
132}; 146};
133#endif 147#endif
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index 706622af20..428c6b0e26 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -31,25 +31,6 @@ struct fib6_rule
31 31
32static struct fib_rules_ops fib6_rules_ops; 32static struct fib_rules_ops fib6_rules_ops;
33 33
34static struct fib6_rule main_rule = {
35 .common = {
36 .refcnt = ATOMIC_INIT(2),
37 .pref = 0x7FFE,
38 .action = FR_ACT_TO_TBL,
39 .table = RT6_TABLE_MAIN,
40 },
41};
42
43static struct fib6_rule local_rule = {
44 .common = {
45 .refcnt = ATOMIC_INIT(2),
46 .pref = 0,
47 .action = FR_ACT_TO_TBL,
48 .table = RT6_TABLE_LOCAL,
49 .flags = FIB_RULE_PERMANENT,
50 },
51};
52
53struct dst_entry *fib6_rule_lookup(struct flowi *fl, int flags, 34struct dst_entry *fib6_rule_lookup(struct flowi *fl, int flags,
54 pol_lookup_t lookup) 35 pol_lookup_t lookup)
55{ 36{
@@ -270,11 +251,23 @@ static struct fib_rules_ops fib6_rules_ops = {
270 .owner = THIS_MODULE, 251 .owner = THIS_MODULE,
271}; 252};
272 253
273void __init fib6_rules_init(void) 254static int __init fib6_default_rules_init(void)
274{ 255{
275 list_add_tail(&local_rule.common.list, &fib6_rules_ops.rules_list); 256 int err;
276 list_add_tail(&main_rule.common.list, &fib6_rules_ops.rules_list); 257
258 err = fib_default_rule_add(&fib6_rules_ops, 0,
259 RT6_TABLE_LOCAL, FIB_RULE_PERMANENT);
260 if (err < 0)
261 return err;
262 err = fib_default_rule_add(&fib6_rules_ops, 0x7FFE, RT6_TABLE_MAIN, 0);
263 if (err < 0)
264 return err;
265 return 0;
266}
277 267
268void __init fib6_rules_init(void)
269{
270 BUG_ON(fib6_default_rules_init());
278 fib_rules_register(&fib6_rules_ops); 271 fib_rules_register(&fib6_rules_ops);
279} 272}
280 273
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 973a97abc4..6ecb5e6fae 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -544,12 +544,8 @@ restart:
544 rt = rt6_device_match(rt, fl->oif, flags); 544 rt = rt6_device_match(rt, fl->oif, flags);
545 BACKTRACK(&fl->fl6_src); 545 BACKTRACK(&fl->fl6_src);
546out: 546out:
547 dst_hold(&rt->u.dst); 547 dst_use(&rt->u.dst, jiffies);
548 read_unlock_bh(&table->tb6_lock); 548 read_unlock_bh(&table->tb6_lock);
549
550 rt->u.dst.lastuse = jiffies;
551 rt->u.dst.__use++;
552
553 return rt; 549 return rt;
554 550
555} 551}
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index a195a66e0c..c76a952309 100644
--- a/net/ipx/af_ipx.c
+++ b/net/ipx/af_ipx.c
@@ -92,11 +92,6 @@ extern int ipxrtr_route_skb(struct sk_buff *skb);
92extern struct ipx_route *ipxrtr_lookup(__be32 net); 92extern struct ipx_route *ipxrtr_lookup(__be32 net);
93extern int ipxrtr_ioctl(unsigned int cmd, void __user *arg); 93extern int ipxrtr_ioctl(unsigned int cmd, void __user *arg);
94 94
95#undef IPX_REFCNT_DEBUG
96#ifdef IPX_REFCNT_DEBUG
97atomic_t ipx_sock_nr;
98#endif
99
100struct ipx_interface *ipx_interfaces_head(void) 95struct ipx_interface *ipx_interfaces_head(void)
101{ 96{
102 struct ipx_interface *rc = NULL; 97 struct ipx_interface *rc = NULL;
@@ -151,14 +146,7 @@ static void ipx_destroy_socket(struct sock *sk)
151{ 146{
152 ipx_remove_socket(sk); 147 ipx_remove_socket(sk);
153 skb_queue_purge(&sk->sk_receive_queue); 148 skb_queue_purge(&sk->sk_receive_queue);
154#ifdef IPX_REFCNT_DEBUG 149 sk_refcnt_debug_dec(sk);
155 atomic_dec(&ipx_sock_nr);
156 printk(KERN_DEBUG "IPX socket %p released, %d are still alive\n", sk,
157 atomic_read(&ipx_sock_nr));
158 if (atomic_read(&sk->sk_refcnt) != 1)
159 printk(KERN_DEBUG "Destruction sock ipx %p delayed, cnt=%d\n",
160 sk, atomic_read(&sk->sk_refcnt));
161#endif
162 sock_put(sk); 150 sock_put(sk);
163} 151}
164 152
@@ -1384,11 +1372,8 @@ static int ipx_create(struct net *net, struct socket *sock, int protocol)
1384 sk = sk_alloc(net, PF_IPX, GFP_KERNEL, &ipx_proto); 1372 sk = sk_alloc(net, PF_IPX, GFP_KERNEL, &ipx_proto);
1385 if (!sk) 1373 if (!sk)
1386 goto out; 1374 goto out;
1387#ifdef IPX_REFCNT_DEBUG 1375
1388 atomic_inc(&ipx_sock_nr); 1376 sk_refcnt_debug_inc(sk);
1389 printk(KERN_DEBUG "IPX socket %p created, now we have %d alive\n", sk,
1390 atomic_read(&ipx_sock_nr));
1391#endif
1392 sock_init_data(sock, sk); 1377 sock_init_data(sock, sk);
1393 sk->sk_no_check = 1; /* Checksum off by default */ 1378 sk->sk_no_check = 1; /* Checksum off by default */
1394 sock->ops = &ipx_dgram_ops; 1379 sock->ops = &ipx_dgram_ops;
@@ -1409,6 +1394,7 @@ static int ipx_release(struct socket *sock)
1409 1394
1410 sock_set_flag(sk, SOCK_DEAD); 1395 sock_set_flag(sk, SOCK_DEAD);
1411 sock->sk = NULL; 1396 sock->sk = NULL;
1397 sk_refcnt_debug_release(sk);
1412 ipx_destroy_socket(sk); 1398 ipx_destroy_socket(sk);
1413out: 1399out:
1414 return 0; 1400 return 0;
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
index 6fffb3845a..ce176e691a 100644
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -13,6 +13,18 @@ config MAC80211
13 This option enables the hardware independent IEEE 802.11 13 This option enables the hardware independent IEEE 802.11
14 networking stack. 14 networking stack.
15 15
16config MAC80211_RCSIMPLE
17 bool "'simple' rate control algorithm" if EMBEDDED
18 default y
19 depends on MAC80211
20 help
21 This option allows you to turn off the 'simple' rate
22 control algorithm in mac80211. If you do turn it off,
23 you absolutely need another rate control algorithm.
24
25 Say Y unless you know you will have another algorithm
26 available.
27
16config MAC80211_LEDS 28config MAC80211_LEDS
17 bool "Enable LED triggers" 29 bool "Enable LED triggers"
18 depends on MAC80211 && LEDS_TRIGGERS 30 depends on MAC80211 && LEDS_TRIGGERS
diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile
index 219cd9f934..1e6237b348 100644
--- a/net/mac80211/Makefile
+++ b/net/mac80211/Makefile
@@ -1,8 +1,9 @@
1obj-$(CONFIG_MAC80211) += mac80211.o rc80211_simple.o 1obj-$(CONFIG_MAC80211) += mac80211.o
2 2
3mac80211-objs-$(CONFIG_MAC80211_LEDS) += ieee80211_led.o 3mac80211-objs-$(CONFIG_MAC80211_LEDS) += ieee80211_led.o
4mac80211-objs-$(CONFIG_MAC80211_DEBUGFS) += debugfs.o debugfs_sta.o debugfs_netdev.o debugfs_key.o 4mac80211-objs-$(CONFIG_MAC80211_DEBUGFS) += debugfs.o debugfs_sta.o debugfs_netdev.o debugfs_key.o
5mac80211-objs-$(CONFIG_NET_SCHED) += wme.o 5mac80211-objs-$(CONFIG_NET_SCHED) += wme.o
6mac80211-objs-$(CONFIG_MAC80211_RCSIMPLE) += rc80211_simple.o
6 7
7mac80211-objs := \ 8mac80211-objs := \
8 ieee80211.o \ 9 ieee80211.o \
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index f484ca7ade..e0ee65a969 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -1072,7 +1072,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
1072 ieee80211_debugfs_add_netdev(IEEE80211_DEV_TO_SUB_IF(local->mdev)); 1072 ieee80211_debugfs_add_netdev(IEEE80211_DEV_TO_SUB_IF(local->mdev));
1073 ieee80211_if_set_type(local->mdev, IEEE80211_IF_TYPE_AP); 1073 ieee80211_if_set_type(local->mdev, IEEE80211_IF_TYPE_AP);
1074 1074
1075 result = ieee80211_init_rate_ctrl_alg(local, NULL); 1075 result = ieee80211_init_rate_ctrl_alg(local,
1076 hw->rate_control_algorithm);
1076 if (result < 0) { 1077 if (result < 0) {
1077 printk(KERN_DEBUG "%s: Failed to initialize rate control " 1078 printk(KERN_DEBUG "%s: Failed to initialize rate control "
1078 "algorithm\n", wiphy_name(local->hw.wiphy)); 1079 "algorithm\n", wiphy_name(local->hw.wiphy));
@@ -1233,8 +1234,17 @@ static int __init ieee80211_init(void)
1233 1234
1234 BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb)); 1235 BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb));
1235 1236
1237#ifdef CONFIG_MAC80211_RCSIMPLE
1238 ret = ieee80211_rate_control_register(&mac80211_rcsimple);
1239 if (ret)
1240 return ret;
1241#endif
1242
1236 ret = ieee80211_wme_register(); 1243 ret = ieee80211_wme_register();
1237 if (ret) { 1244 if (ret) {
1245#ifdef CONFIG_MAC80211_RCSIMPLE
1246 ieee80211_rate_control_unregister(&mac80211_rcsimple);
1247#endif
1238 printk(KERN_DEBUG "ieee80211_init: failed to " 1248 printk(KERN_DEBUG "ieee80211_init: failed to "
1239 "initialize WME (err=%d)\n", ret); 1249 "initialize WME (err=%d)\n", ret);
1240 return ret; 1250 return ret;
@@ -1248,6 +1258,10 @@ static int __init ieee80211_init(void)
1248 1258
1249static void __exit ieee80211_exit(void) 1259static void __exit ieee80211_exit(void)
1250{ 1260{
1261#ifdef CONFIG_MAC80211_RCSIMPLE
1262 ieee80211_rate_control_unregister(&mac80211_rcsimple);
1263#endif
1264
1251 ieee80211_wme_unregister(); 1265 ieee80211_wme_unregister();
1252 ieee80211_debugfs_netdev_exit(); 1266 ieee80211_debugfs_netdev_exit();
1253} 1267}
diff --git a/net/mac80211/ieee80211_common.h b/net/mac80211/ieee80211_common.h
deleted file mode 100644
index c15295d43d..0000000000
--- a/net/mac80211/ieee80211_common.h
+++ /dev/null
@@ -1,91 +0,0 @@
1/*
2 * IEEE 802.11 driver (80211.o) -- hostapd interface
3 * Copyright 2002-2004, Instant802 Networks, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef IEEE80211_COMMON_H
11#define IEEE80211_COMMON_H
12
13#include <linux/types.h>
14
15/*
16 * This is common header information with user space. It is used on all
17 * frames sent to wlan#ap interface.
18 */
19
20#define IEEE80211_FI_VERSION 0x80211001
21
22struct ieee80211_frame_info {
23 __be32 version;
24 __be32 length;
25 __be64 mactime;
26 __be64 hosttime;
27 __be32 phytype;
28 __be32 channel;
29 __be32 datarate;
30 __be32 antenna;
31 __be32 priority;
32 __be32 ssi_type;
33 __be32 ssi_signal;
34 __be32 ssi_noise;
35 __be32 preamble;
36 __be32 encoding;
37
38 /* Note: this structure is otherwise identical to capture format used
39 * in linux-wlan-ng, but this additional field is used to provide meta
40 * data about the frame to hostapd. This was the easiest method for
41 * providing this information, but this might change in the future. */
42 __be32 msg_type;
43} __attribute__ ((packed));
44
45
46enum ieee80211_msg_type {
47 ieee80211_msg_normal = 0,
48 ieee80211_msg_tx_callback_ack = 1,
49 ieee80211_msg_tx_callback_fail = 2,
50 /* hole at 3, was ieee80211_msg_passive_scan but unused */
51 /* hole at 4, was ieee80211_msg_wep_frame_unknown_key but now unused */
52 ieee80211_msg_michael_mic_failure = 5,
53 /* hole at 6, was monitor but never sent to userspace */
54 ieee80211_msg_sta_not_assoc = 7,
55 /* 8 was ieee80211_msg_set_aid_for_sta */
56 /* 9 was ieee80211_msg_key_threshold_notification */
57 /* 11 was ieee80211_msg_radar */
58};
59
60struct ieee80211_msg_key_notification {
61 int tx_rx_count;
62 char ifname[IFNAMSIZ];
63 u8 addr[ETH_ALEN]; /* ff:ff:ff:ff:ff:ff for broadcast keys */
64};
65
66
67enum ieee80211_phytype {
68 ieee80211_phytype_fhss_dot11_97 = 1,
69 ieee80211_phytype_dsss_dot11_97 = 2,
70 ieee80211_phytype_irbaseband = 3,
71 ieee80211_phytype_dsss_dot11_b = 4,
72 ieee80211_phytype_pbcc_dot11_b = 5,
73 ieee80211_phytype_ofdm_dot11_g = 6,
74 ieee80211_phytype_pbcc_dot11_g = 7,
75 ieee80211_phytype_ofdm_dot11_a = 8,
76};
77
78enum ieee80211_ssi_type {
79 ieee80211_ssi_none = 0,
80 ieee80211_ssi_norm = 1, /* normalized, 0-1000 */
81 ieee80211_ssi_dbm = 2,
82 ieee80211_ssi_raw = 3, /* raw SSI */
83};
84
85struct ieee80211_radar_info {
86 int channel;
87 int radar;
88 int radar_type;
89};
90
91#endif /* IEEE80211_COMMON_H */
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 4b4ed2a580..b4e32ab366 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -230,6 +230,7 @@ struct ieee80211_if_vlan {
230#define IEEE80211_STA_AUTO_SSID_SEL BIT(10) 230#define IEEE80211_STA_AUTO_SSID_SEL BIT(10)
231#define IEEE80211_STA_AUTO_BSSID_SEL BIT(11) 231#define IEEE80211_STA_AUTO_BSSID_SEL BIT(11)
232#define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12) 232#define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12)
233#define IEEE80211_STA_PRIVACY_INVOKED BIT(13)
233struct ieee80211_if_sta { 234struct ieee80211_if_sta {
234 enum { 235 enum {
235 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE, 236 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
@@ -259,7 +260,6 @@ struct ieee80211_if_sta {
259 unsigned long request; 260 unsigned long request;
260 struct sk_buff_head skb_queue; 261 struct sk_buff_head skb_queue;
261 262
262 int key_management_enabled;
263 unsigned long last_probe; 263 unsigned long last_probe;
264 264
265#define IEEE80211_AUTH_ALG_OPEN BIT(0) 265#define IEEE80211_AUTH_ALG_OPEN BIT(0)
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index 6caa3ec2cf..7027eed4d4 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -917,7 +917,6 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev,
917 struct iw_request_info *info, 917 struct iw_request_info *info,
918 struct iw_param *data, char *extra) 918 struct iw_param *data, char *extra)
919{ 919{
920 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
921 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 920 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
922 int ret = 0; 921 int ret = 0;
923 922
@@ -927,18 +926,21 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev,
927 case IW_AUTH_CIPHER_GROUP: 926 case IW_AUTH_CIPHER_GROUP:
928 case IW_AUTH_WPA_ENABLED: 927 case IW_AUTH_WPA_ENABLED:
929 case IW_AUTH_RX_UNENCRYPTED_EAPOL: 928 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
930 break;
931 case IW_AUTH_KEY_MGMT: 929 case IW_AUTH_KEY_MGMT:
930 break;
931 case IW_AUTH_PRIVACY_INVOKED:
932 if (sdata->type != IEEE80211_IF_TYPE_STA) 932 if (sdata->type != IEEE80211_IF_TYPE_STA)
933 ret = -EINVAL; 933 ret = -EINVAL;
934 else { 934 else {
935 sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED;
935 /* 936 /*
936 * Key management was set by wpa_supplicant, 937 * Privacy invoked by wpa_supplicant, store the
937 * we only need this to associate to a network 938 * value and allow associating to a protected
938 * that has privacy enabled regardless of not 939 * network without having a key up front.
939 * having a key.
940 */ 940 */
941 sdata->u.sta.key_management_enabled = !!data->value; 941 if (data->value)
942 sdata->u.sta.flags |=
943 IEEE80211_STA_PRIVACY_INVOKED;
942 } 944 }
943 break; 945 break;
944 case IW_AUTH_80211_AUTH_ALG: 946 case IW_AUTH_80211_AUTH_ALG:
@@ -948,11 +950,6 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev,
948 else 950 else
949 ret = -EOPNOTSUPP; 951 ret = -EOPNOTSUPP;
950 break; 952 break;
951 case IW_AUTH_PRIVACY_INVOKED:
952 if (local->ops->set_privacy_invoked)
953 ret = local->ops->set_privacy_invoked(
954 local_to_hw(local), data->value);
955 break;
956 default: 953 default:
957 ret = -EOPNOTSUPP; 954 ret = -EOPNOTSUPP;
958 break; 955 break;
diff --git a/net/mac80211/ieee80211_rate.c b/net/mac80211/ieee80211_rate.c
index 93abb8fff1..7254bd6098 100644
--- a/net/mac80211/ieee80211_rate.c
+++ b/net/mac80211/ieee80211_rate.c
@@ -25,13 +25,25 @@ int ieee80211_rate_control_register(struct rate_control_ops *ops)
25{ 25{
26 struct rate_control_alg *alg; 26 struct rate_control_alg *alg;
27 27
28 if (!ops->name)
29 return -EINVAL;
30
31 mutex_lock(&rate_ctrl_mutex);
32 list_for_each_entry(alg, &rate_ctrl_algs, list) {
33 if (!strcmp(alg->ops->name, ops->name)) {
34 /* don't register an algorithm twice */
35 WARN_ON(1);
36 return -EALREADY;
37 }
38 }
39
28 alg = kzalloc(sizeof(*alg), GFP_KERNEL); 40 alg = kzalloc(sizeof(*alg), GFP_KERNEL);
29 if (alg == NULL) { 41 if (alg == NULL) {
42 mutex_unlock(&rate_ctrl_mutex);
30 return -ENOMEM; 43 return -ENOMEM;
31 } 44 }
32 alg->ops = ops; 45 alg->ops = ops;
33 46
34 mutex_lock(&rate_ctrl_mutex);
35 list_add_tail(&alg->list, &rate_ctrl_algs); 47 list_add_tail(&alg->list, &rate_ctrl_algs);
36 mutex_unlock(&rate_ctrl_mutex); 48 mutex_unlock(&rate_ctrl_mutex);
37 49
@@ -61,9 +73,12 @@ ieee80211_try_rate_control_ops_get(const char *name)
61 struct rate_control_alg *alg; 73 struct rate_control_alg *alg;
62 struct rate_control_ops *ops = NULL; 74 struct rate_control_ops *ops = NULL;
63 75
76 if (!name)
77 return NULL;
78
64 mutex_lock(&rate_ctrl_mutex); 79 mutex_lock(&rate_ctrl_mutex);
65 list_for_each_entry(alg, &rate_ctrl_algs, list) { 80 list_for_each_entry(alg, &rate_ctrl_algs, list) {
66 if (!name || !strcmp(alg->ops->name, name)) 81 if (!strcmp(alg->ops->name, name))
67 if (try_module_get(alg->ops->module)) { 82 if (try_module_get(alg->ops->module)) {
68 ops = alg->ops; 83 ops = alg->ops;
69 break; 84 break;
@@ -80,9 +95,12 @@ ieee80211_rate_control_ops_get(const char *name)
80{ 95{
81 struct rate_control_ops *ops; 96 struct rate_control_ops *ops;
82 97
98 if (!name)
99 name = "simple";
100
83 ops = ieee80211_try_rate_control_ops_get(name); 101 ops = ieee80211_try_rate_control_ops_get(name);
84 if (!ops) { 102 if (!ops) {
85 request_module("rc80211_%s", name ? name : "default"); 103 request_module("rc80211_%s", name);
86 ops = ieee80211_try_rate_control_ops_get(name); 104 ops = ieee80211_try_rate_control_ops_get(name);
87 } 105 }
88 return ops; 106 return ops;
diff --git a/net/mac80211/ieee80211_rate.h b/net/mac80211/ieee80211_rate.h
index 7cd1ebab4f..23688139ff 100644
--- a/net/mac80211/ieee80211_rate.h
+++ b/net/mac80211/ieee80211_rate.h
@@ -65,6 +65,9 @@ struct rate_control_ref {
65 struct kref kref; 65 struct kref kref;
66}; 66};
67 67
68/* default 'simple' algorithm */
69extern struct rate_control_ops mac80211_rcsimple;
70
68int ieee80211_rate_control_register(struct rate_control_ops *ops); 71int ieee80211_rate_control_register(struct rate_control_ops *ops);
69void ieee80211_rate_control_unregister(struct rate_control_ops *ops); 72void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
70 73
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index fda0e06453..2079e988fc 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -704,10 +704,11 @@ static int ieee80211_privacy_mismatch(struct net_device *dev,
704{ 704{
705 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 705 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
706 struct ieee80211_sta_bss *bss; 706 struct ieee80211_sta_bss *bss;
707 int res = 0; 707 int bss_privacy;
708 int wep_privacy;
709 int privacy_invoked;
708 710
709 if (!ifsta || (ifsta->flags & IEEE80211_STA_MIXED_CELL) || 711 if (!ifsta || (ifsta->flags & IEEE80211_STA_MIXED_CELL))
710 ifsta->key_management_enabled)
711 return 0; 712 return 0;
712 713
713 bss = ieee80211_rx_bss_get(dev, ifsta->bssid, local->hw.conf.channel, 714 bss = ieee80211_rx_bss_get(dev, ifsta->bssid, local->hw.conf.channel,
@@ -715,13 +716,16 @@ static int ieee80211_privacy_mismatch(struct net_device *dev,
715 if (!bss) 716 if (!bss)
716 return 0; 717 return 0;
717 718
718 if (ieee80211_sta_wep_configured(dev) != 719 bss_privacy = !!(bss->capability & WLAN_CAPABILITY_PRIVACY);
719 !!(bss->capability & WLAN_CAPABILITY_PRIVACY)) 720 wep_privacy = !!ieee80211_sta_wep_configured(dev);
720 res = 1; 721 privacy_invoked = !!(ifsta->flags & IEEE80211_STA_PRIVACY_INVOKED);
721 722
722 ieee80211_rx_bss_put(dev, bss); 723 ieee80211_rx_bss_put(dev, bss);
723 724
724 return res; 725 if ((bss_privacy == wep_privacy) || (bss_privacy == privacy_invoked))
726 return 0;
727
728 return 1;
725} 729}
726 730
727 731
diff --git a/net/mac80211/rc80211_simple.c b/net/mac80211/rc80211_simple.c
index 314b8de888..da72737364 100644
--- a/net/mac80211/rc80211_simple.c
+++ b/net/mac80211/rc80211_simple.c
@@ -7,7 +7,6 @@
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 */ 8 */
9 9
10#include <linux/module.h>
11#include <linux/init.h> 10#include <linux/init.h>
12#include <linux/netdevice.h> 11#include <linux/netdevice.h>
13#include <linux/types.h> 12#include <linux/types.h>
@@ -29,8 +28,6 @@
29#define RATE_CONTROL_INTERVAL (HZ / 20) 28#define RATE_CONTROL_INTERVAL (HZ / 20)
30#define RATE_CONTROL_MIN_TX 10 29#define RATE_CONTROL_MIN_TX 10
31 30
32MODULE_ALIAS("rc80211_default");
33
34static void rate_control_rate_inc(struct ieee80211_local *local, 31static void rate_control_rate_inc(struct ieee80211_local *local,
35 struct sta_info *sta) 32 struct sta_info *sta)
36{ 33{
@@ -394,8 +391,7 @@ static void rate_control_simple_remove_sta_debugfs(void *priv, void *priv_sta)
394} 391}
395#endif 392#endif
396 393
397static struct rate_control_ops rate_control_simple = { 394struct rate_control_ops mac80211_rcsimple = {
398 .module = THIS_MODULE,
399 .name = "simple", 395 .name = "simple",
400 .tx_status = rate_control_simple_tx_status, 396 .tx_status = rate_control_simple_tx_status,
401 .get_rate = rate_control_simple_get_rate, 397 .get_rate = rate_control_simple_get_rate,
@@ -410,22 +406,3 @@ static struct rate_control_ops rate_control_simple = {
410 .remove_sta_debugfs = rate_control_simple_remove_sta_debugfs, 406 .remove_sta_debugfs = rate_control_simple_remove_sta_debugfs,
411#endif 407#endif
412}; 408};
413
414
415static int __init rate_control_simple_init(void)
416{
417 return ieee80211_rate_control_register(&rate_control_simple);
418}
419
420
421static void __exit rate_control_simple_exit(void)
422{
423 ieee80211_rate_control_unregister(&rate_control_simple);
424}
425
426
427subsys_initcall(rate_control_simple_init);
428module_exit(rate_control_simple_exit);
429
430MODULE_DESCRIPTION("Simple rate control algorithm for ieee80211");
431MODULE_LICENSE("GPL");
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index ece77766ea..428a9fcf57 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -509,9 +509,11 @@ ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx)
509 rx->key->tx_rx_count++; 509 rx->key->tx_rx_count++;
510 /* TODO: add threshold stuff again */ 510 /* TODO: add threshold stuff again */
511 } else { 511 } else {
512#ifdef CONFIG_MAC80211_DEBUG
512 if (net_ratelimit()) 513 if (net_ratelimit())
513 printk(KERN_DEBUG "%s: RX protected frame," 514 printk(KERN_DEBUG "%s: RX protected frame,"
514 " but have no key\n", rx->dev->name); 515 " but have no key\n", rx->dev->name);
516#endif /* CONFIG_MAC80211_DEBUG */
515 return TXRX_DROP; 517 return TXRX_DROP;
516 } 518 }
517 519
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index a84a23310f..9bf0e1cc53 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -314,9 +314,11 @@ ieee80211_crypto_wep_decrypt(struct ieee80211_txrx_data *rx)
314 314
315 if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED)) { 315 if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED)) {
316 if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) { 316 if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) {
317#ifdef CONFIG_MAC80211_DEBUG
317 if (net_ratelimit()) 318 if (net_ratelimit())
318 printk(KERN_DEBUG "%s: RX WEP frame, decrypt " 319 printk(KERN_DEBUG "%s: RX WEP frame, decrypt "
319 "failed\n", rx->dev->name); 320 "failed\n", rx->dev->name);
321#endif /* CONFIG_MAC80211_DEBUG */
320 return TXRX_DROP; 322 return TXRX_DROP;
321 } 323 }
322 } else if (!(rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED)) { 324 } else if (!(rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED)) {
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index 6695efba57..20cec1cb95 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -323,9 +323,12 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_txrx_data *rx)
323 &rx->u.rx.tkip_iv32, 323 &rx->u.rx.tkip_iv32,
324 &rx->u.rx.tkip_iv16); 324 &rx->u.rx.tkip_iv16);
325 if (res != TKIP_DECRYPT_OK || wpa_test) { 325 if (res != TKIP_DECRYPT_OK || wpa_test) {
326 printk(KERN_DEBUG "%s: TKIP decrypt failed for RX frame from " 326#ifdef CONFIG_MAC80211_DEBUG
327 "%s (res=%d)\n", 327 if (net_ratelimit())
328 rx->dev->name, print_mac(mac, rx->sta->addr), res); 328 printk(KERN_DEBUG "%s: TKIP decrypt failed for RX "
329 "frame from %s (res=%d)\n", rx->dev->name,
330 print_mac(mac, rx->sta->addr), res);
331#endif /* CONFIG_MAC80211_DEBUG */
329 return TXRX_DROP; 332 return TXRX_DROP;
330 } 333 }
331 334
@@ -594,9 +597,12 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_txrx_data *rx)
594 skb->data + hdrlen + CCMP_HDR_LEN, data_len, 597 skb->data + hdrlen + CCMP_HDR_LEN, data_len,
595 skb->data + skb->len - CCMP_MIC_LEN, 598 skb->data + skb->len - CCMP_MIC_LEN,
596 skb->data + hdrlen + CCMP_HDR_LEN)) { 599 skb->data + hdrlen + CCMP_HDR_LEN)) {
597 printk(KERN_DEBUG "%s: CCMP decrypt failed for RX " 600#ifdef CONFIG_MAC80211_DEBUG
598 "frame from %s\n", rx->dev->name, 601 if (net_ratelimit())
599 print_mac(mac, rx->sta->addr)); 602 printk(KERN_DEBUG "%s: CCMP decrypt failed "
603 "for RX frame from %s\n", rx->dev->name,
604 print_mac(mac, rx->sta->addr));
605#endif /* CONFIG_MAC80211_DEBUG */
600 return TXRX_DROP; 606 return TXRX_DROP;
601 } 607 }
602 } 608 }
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 4cb2dfba09..eb6be5030c 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -139,9 +139,6 @@ dev->hard_header == NULL (ll header is added by device, we cannot control it)
139static HLIST_HEAD(packet_sklist); 139static HLIST_HEAD(packet_sklist);
140static DEFINE_RWLOCK(packet_sklist_lock); 140static DEFINE_RWLOCK(packet_sklist_lock);
141 141
142static atomic_t packet_socks_nr;
143
144
145/* Private packet socket structures. */ 142/* Private packet socket structures. */
146 143
147struct packet_mclist 144struct packet_mclist
@@ -236,10 +233,7 @@ static void packet_sock_destruct(struct sock *sk)
236 return; 233 return;
237 } 234 }
238 235
239 atomic_dec(&packet_socks_nr); 236 sk_refcnt_debug_dec(sk);
240#ifdef PACKET_REFCNT_DEBUG
241 printk(KERN_DEBUG "PACKET socket %p is free, %d are alive\n", sk, atomic_read(&packet_socks_nr));
242#endif
243} 237}
244 238
245 239
@@ -515,7 +509,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet
515 sll->sll_hatype = dev->type; 509 sll->sll_hatype = dev->type;
516 sll->sll_protocol = skb->protocol; 510 sll->sll_protocol = skb->protocol;
517 sll->sll_pkttype = skb->pkt_type; 511 sll->sll_pkttype = skb->pkt_type;
518 if (unlikely(po->origdev) && skb->pkt_type == PACKET_HOST) 512 if (unlikely(po->origdev))
519 sll->sll_ifindex = orig_dev->ifindex; 513 sll->sll_ifindex = orig_dev->ifindex;
520 else 514 else
521 sll->sll_ifindex = dev->ifindex; 515 sll->sll_ifindex = dev->ifindex;
@@ -661,7 +655,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
661 sll->sll_hatype = dev->type; 655 sll->sll_hatype = dev->type;
662 sll->sll_protocol = skb->protocol; 656 sll->sll_protocol = skb->protocol;
663 sll->sll_pkttype = skb->pkt_type; 657 sll->sll_pkttype = skb->pkt_type;
664 if (unlikely(po->origdev) && skb->pkt_type == PACKET_HOST) 658 if (unlikely(po->origdev))
665 sll->sll_ifindex = orig_dev->ifindex; 659 sll->sll_ifindex = orig_dev->ifindex;
666 else 660 else
667 sll->sll_ifindex = dev->ifindex; 661 sll->sll_ifindex = dev->ifindex;
@@ -849,6 +843,7 @@ static int packet_release(struct socket *sock)
849 /* Purge queues */ 843 /* Purge queues */
850 844
851 skb_queue_purge(&sk->sk_receive_queue); 845 skb_queue_purge(&sk->sk_receive_queue);
846 sk_refcnt_debug_release(sk);
852 847
853 sock_put(sk); 848 sock_put(sk);
854 return 0; 849 return 0;
@@ -1010,7 +1005,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol)
1010 po->num = proto; 1005 po->num = proto;
1011 1006
1012 sk->sk_destruct = packet_sock_destruct; 1007 sk->sk_destruct = packet_sock_destruct;
1013 atomic_inc(&packet_socks_nr); 1008 sk_refcnt_debug_inc(sk);
1014 1009
1015 /* 1010 /*
1016 * Attach a protocol block 1011 * Attach a protocol block
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index 51d151c0e9..73d60a3071 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -27,6 +27,10 @@
27#include <linux/mutex.h> 27#include <linux/mutex.h>
28#include <linux/rfkill.h> 28#include <linux/rfkill.h>
29 29
30/* Get declaration of rfkill_switch_all() to shut up sparse. */
31#include "rfkill-input.h"
32
33
30MODULE_AUTHOR("Ivo van Doorn <IvDoorn@gmail.com>"); 34MODULE_AUTHOR("Ivo van Doorn <IvDoorn@gmail.com>");
31MODULE_VERSION("1.0"); 35MODULE_VERSION("1.0");
32MODULE_DESCRIPTION("RF switch support"); 36MODULE_DESCRIPTION("RF switch support");
@@ -276,21 +280,17 @@ static struct class rfkill_class = {
276 280
277static int rfkill_add_switch(struct rfkill *rfkill) 281static int rfkill_add_switch(struct rfkill *rfkill)
278{ 282{
279 int retval; 283 int error;
280
281 retval = mutex_lock_interruptible(&rfkill_mutex);
282 if (retval)
283 return retval;
284 284
285 retval = rfkill_toggle_radio(rfkill, rfkill_states[rfkill->type]); 285 mutex_lock(&rfkill_mutex);
286 if (retval)
287 goto out;
288 286
289 list_add_tail(&rfkill->node, &rfkill_list); 287 error = rfkill_toggle_radio(rfkill, rfkill_states[rfkill->type]);
288 if (!error)
289 list_add_tail(&rfkill->node, &rfkill_list);
290 290
291 out:
292 mutex_unlock(&rfkill_mutex); 291 mutex_unlock(&rfkill_mutex);
293 return retval; 292
293 return error;
294} 294}
295 295
296static void rfkill_remove_switch(struct rfkill *rfkill) 296static void rfkill_remove_switch(struct rfkill *rfkill)
@@ -387,20 +387,23 @@ int rfkill_register(struct rfkill *rfkill)
387 387
388 if (!rfkill->toggle_radio) 388 if (!rfkill->toggle_radio)
389 return -EINVAL; 389 return -EINVAL;
390 if (rfkill->type >= RFKILL_TYPE_MAX)
391 return -EINVAL;
392
393 snprintf(dev->bus_id, sizeof(dev->bus_id),
394 "rfkill%ld", (long)atomic_inc_return(&rfkill_no) - 1);
395
396 rfkill_led_trigger_register(rfkill);
390 397
391 error = rfkill_add_switch(rfkill); 398 error = rfkill_add_switch(rfkill);
392 if (error) 399 if (error)
393 return error; 400 return error;
394 401
395 snprintf(dev->bus_id, sizeof(dev->bus_id),
396 "rfkill%ld", (long)atomic_inc_return(&rfkill_no) - 1);
397
398 error = device_add(dev); 402 error = device_add(dev);
399 if (error) { 403 if (error) {
400 rfkill_remove_switch(rfkill); 404 rfkill_remove_switch(rfkill);
401 return error; 405 return error;
402 } 406 }
403 rfkill_led_trigger_register(rfkill);
404 407
405 return 0; 408 return 0;
406} 409}
@@ -416,9 +419,9 @@ EXPORT_SYMBOL(rfkill_register);
416 */ 419 */
417void rfkill_unregister(struct rfkill *rfkill) 420void rfkill_unregister(struct rfkill *rfkill)
418{ 421{
419 rfkill_led_trigger_unregister(rfkill);
420 device_del(&rfkill->dev); 422 device_del(&rfkill->dev);
421 rfkill_remove_switch(rfkill); 423 rfkill_remove_switch(rfkill);
424 rfkill_led_trigger_unregister(rfkill);
422 put_device(&rfkill->dev); 425 put_device(&rfkill->dev);
423} 426}
424EXPORT_SYMBOL(rfkill_unregister); 427EXPORT_SYMBOL(rfkill_unregister);
@@ -448,5 +451,5 @@ static void __exit rfkill_exit(void)
448 class_unregister(&rfkill_class); 451 class_unregister(&rfkill_class);
449} 452}
450 453
451module_init(rfkill_init); 454subsys_initcall(rfkill_init);
452module_exit(rfkill_exit); 455module_exit(rfkill_exit);
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index 5317102943..c390082091 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -613,17 +613,7 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle,
613 memcpy(&n->sel, s, sizeof(*s) + s->nkeys*sizeof(struct tc_u32_key)); 613 memcpy(&n->sel, s, sizeof(*s) + s->nkeys*sizeof(struct tc_u32_key));
614 n->ht_up = ht; 614 n->ht_up = ht;
615 n->handle = handle; 615 n->handle = handle;
616{ 616 n->fshift = s->hmask ? ffs(ntohl(s->hmask)) - 1 : 0;
617 u8 i = 0;
618 u32 mask = ntohl(s->hmask);
619 if (mask) {
620 while (!(mask & 1)) {
621 i++;
622 mask>>=1;
623 }
624 }
625 n->fshift = i;
626}
627 617
628#ifdef CONFIG_CLS_U32_MARK 618#ifdef CONFIG_CLS_U32_MARK
629 if (tb[TCA_U32_MARK-1]) { 619 if (tb[TCA_U32_MARK-1]) {
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 515e7a692f..e835da8fc0 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -457,7 +457,7 @@ static int unix_release_sock (struct sock *sk, int embrion)
457 * What the above comment does talk about? --ANK(980817) 457 * What the above comment does talk about? --ANK(980817)
458 */ 458 */
459 459
460 if (atomic_read(&unix_tot_inflight)) 460 if (unix_tot_inflight)
461 unix_gc(); /* Garbage collect fds */ 461 unix_gc(); /* Garbage collect fds */
462 462
463 return 0; 463 return 0;
@@ -599,15 +599,14 @@ static struct sock * unix_create1(struct net *net, struct socket *sock)
599 struct sock *sk = NULL; 599 struct sock *sk = NULL;
600 struct unix_sock *u; 600 struct unix_sock *u;
601 601
602 if (atomic_read(&unix_nr_socks) >= 2*get_max_files()) 602 atomic_inc(&unix_nr_socks);
603 if (atomic_read(&unix_nr_socks) > 2 * get_max_files())
603 goto out; 604 goto out;
604 605
605 sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, &unix_proto); 606 sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, &unix_proto);
606 if (!sk) 607 if (!sk)
607 goto out; 608 goto out;
608 609
609 atomic_inc(&unix_nr_socks);
610
611 sock_init_data(sock,sk); 610 sock_init_data(sock,sk);
612 lockdep_set_class(&sk->sk_receive_queue.lock, 611 lockdep_set_class(&sk->sk_receive_queue.lock,
613 &af_unix_sk_receive_queue_lock_key); 612 &af_unix_sk_receive_queue_lock_key);
@@ -625,6 +624,8 @@ static struct sock * unix_create1(struct net *net, struct socket *sock)
625 init_waitqueue_head(&u->peer_wait); 624 init_waitqueue_head(&u->peer_wait);
626 unix_insert_socket(unix_sockets_unbound, sk); 625 unix_insert_socket(unix_sockets_unbound, sk);
627out: 626out:
627 if (sk == NULL)
628 atomic_dec(&unix_nr_socks);
628 return sk; 629 return sk;
629} 630}
630 631
diff --git a/net/unix/garbage.c b/net/unix/garbage.c
index 406b6433e4..ebdff3d877 100644
--- a/net/unix/garbage.c
+++ b/net/unix/garbage.c
@@ -92,7 +92,7 @@ static LIST_HEAD(gc_inflight_list);
92static LIST_HEAD(gc_candidates); 92static LIST_HEAD(gc_candidates);
93static DEFINE_SPINLOCK(unix_gc_lock); 93static DEFINE_SPINLOCK(unix_gc_lock);
94 94
95atomic_t unix_tot_inflight = ATOMIC_INIT(0); 95unsigned int unix_tot_inflight;
96 96
97 97
98static struct sock *unix_get_socket(struct file *filp) 98static struct sock *unix_get_socket(struct file *filp)
@@ -133,7 +133,7 @@ void unix_inflight(struct file *fp)
133 } else { 133 } else {
134 BUG_ON(list_empty(&u->link)); 134 BUG_ON(list_empty(&u->link));
135 } 135 }
136 atomic_inc(&unix_tot_inflight); 136 unix_tot_inflight++;
137 spin_unlock(&unix_gc_lock); 137 spin_unlock(&unix_gc_lock);
138 } 138 }
139} 139}
@@ -147,7 +147,7 @@ void unix_notinflight(struct file *fp)
147 BUG_ON(list_empty(&u->link)); 147 BUG_ON(list_empty(&u->link));
148 if (atomic_dec_and_test(&u->inflight)) 148 if (atomic_dec_and_test(&u->inflight))
149 list_del_init(&u->link); 149 list_del_init(&u->link);
150 atomic_dec(&unix_tot_inflight); 150 unix_tot_inflight--;
151 spin_unlock(&unix_gc_lock); 151 spin_unlock(&unix_gc_lock);
152 } 152 }
153} 153}
@@ -161,7 +161,7 @@ static inline struct sk_buff *sock_queue_head(struct sock *sk)
161 for (skb = sock_queue_head(sk)->next, next = skb->next; \ 161 for (skb = sock_queue_head(sk)->next, next = skb->next; \
162 skb != sock_queue_head(sk); skb = next, next = skb->next) 162 skb != sock_queue_head(sk); skb = next, next = skb->next)
163 163
164static void scan_inflight(struct sock *x, void (*func)(struct sock *), 164static void scan_inflight(struct sock *x, void (*func)(struct unix_sock *),
165 struct sk_buff_head *hitlist) 165 struct sk_buff_head *hitlist)
166{ 166{
167 struct sk_buff *skb; 167 struct sk_buff *skb;
@@ -185,9 +185,9 @@ static void scan_inflight(struct sock *x, void (*func)(struct sock *),
185 * if it indeed does so 185 * if it indeed does so
186 */ 186 */
187 struct sock *sk = unix_get_socket(*fp++); 187 struct sock *sk = unix_get_socket(*fp++);
188 if(sk) { 188 if (sk) {
189 hit = true; 189 hit = true;
190 func(sk); 190 func(unix_sk(sk));
191 } 191 }
192 } 192 }
193 if (hit && hitlist != NULL) { 193 if (hit && hitlist != NULL) {
@@ -199,7 +199,7 @@ static void scan_inflight(struct sock *x, void (*func)(struct sock *),
199 spin_unlock(&x->sk_receive_queue.lock); 199 spin_unlock(&x->sk_receive_queue.lock);
200} 200}
201 201
202static void scan_children(struct sock *x, void (*func)(struct sock *), 202static void scan_children(struct sock *x, void (*func)(struct unix_sock *),
203 struct sk_buff_head *hitlist) 203 struct sk_buff_head *hitlist)
204{ 204{
205 if (x->sk_state != TCP_LISTEN) 205 if (x->sk_state != TCP_LISTEN)
@@ -235,20 +235,18 @@ static void scan_children(struct sock *x, void (*func)(struct sock *),
235 } 235 }
236} 236}
237 237
238static void dec_inflight(struct sock *sk) 238static void dec_inflight(struct unix_sock *usk)
239{ 239{
240 atomic_dec(&unix_sk(sk)->inflight); 240 atomic_dec(&usk->inflight);
241} 241}
242 242
243static void inc_inflight(struct sock *sk) 243static void inc_inflight(struct unix_sock *usk)
244{ 244{
245 atomic_inc(&unix_sk(sk)->inflight); 245 atomic_inc(&usk->inflight);
246} 246}
247 247
248static void inc_inflight_move_tail(struct sock *sk) 248static void inc_inflight_move_tail(struct unix_sock *u)
249{ 249{
250 struct unix_sock *u = unix_sk(sk);
251
252 atomic_inc(&u->inflight); 250 atomic_inc(&u->inflight);
253 /* 251 /*
254 * If this is still a candidate, move it to the end of the 252 * If this is still a candidate, move it to the end of the