Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 26 May 2009 19:10:19 +0000 (12:10 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 26 May 2009 19:10:19 +0000 (12:10 -0700)
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (21 commits)
  r8169: avoid losing MSI interrupts
  tcp: tcp_vegas ssthresh bugfix
  mac8390: fix regression caused during net_device_ops conversion
  gianfar: fix BUG under load after introduction of skb recycling
  wimax/i2400m: usb: fix device reset on autosuspend while not yet idle
  RxRPC: Error handling for rxrpc_alloc_connection()
  ipv4: Fix oops with FIB_TRIE
  pktgen: do not access flows[] beyond its length
  gigaset: beyond ARRAY_SIZE of iwb->data
  IPv6: set RTPROT_KERNEL to initial route
  net: fix rtable leak in net/ipv4/route.c
  net: fix length computation in rt_check_expire()
  wireless: beyond ARRAY_SIZE of intf->crypto_stats
  iwlwifi: update 5000 ucode support to version 2 of API
  cfg80211: fix race between core hint and driver's custom apply
  airo: fix airo_get_encode{,ext} buffer overflow like I mean it...
  ath5k: fix interpolation with equal power levels
  iwlwifi: do not cancel delayed work inside spin_lock_irqsave
  ath5k: fix exp off-by-one when computing OFDM delta slope
  wext: verify buffer size for SIOCSIWENCODEEXT
  ...

22 files changed:
drivers/isdn/gigaset/isocdata.c
drivers/net/Makefile
drivers/net/gianfar.c
drivers/net/mac8390.c
drivers/net/r8169.c
drivers/net/wimax/i2400m/usb.c
drivers/net/wireless/airo.c
drivers/net/wireless/ath5k/phy.c
drivers/net/wireless/ath5k/reset.c
drivers/net/wireless/iwlwifi/iwl-5000.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-scan.c
drivers/net/wireless/iwlwifi/iwl3945-base.c
drivers/net/wireless/rt2x00/rt2x00debug.c
net/core/pktgen.c
net/ipv4/fib_trie.c
net/ipv4/route.c
net/ipv4/tcp_vegas.c
net/ipv6/route.c
net/rxrpc/ar-connection.c
net/wireless/reg.c
net/wireless/wext.c

index b171e75cb52e51f920125abc984648f22415e961..29808c4fb1cb658ddc9c91f9187ef4cadb39afa4 100644 (file)
@@ -175,7 +175,7 @@ int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size)
                return -EINVAL;
        }
        src = iwb->read;
-       if (unlikely(limit > BAS_OUTBUFSIZE + BAS_OUTBUFPAD ||
+       if (unlikely(limit >= BAS_OUTBUFSIZE + BAS_OUTBUFPAD ||
                     (read < src && limit >= src))) {
                pr_err("isoc write buffer frame reservation violated\n");
                return -EFAULT;
index 1fc4602a6ff2c29912f64759207f0d38a8e17895..a1c25cb4669fb8b9a95b7a1410355423d46b5599 100644 (file)
@@ -102,7 +102,7 @@ obj-$(CONFIG_HAMACHI) += hamachi.o
 obj-$(CONFIG_NET) += Space.o loopback.o
 obj-$(CONFIG_SEEQ8005) += seeq8005.o
 obj-$(CONFIG_NET_SB1000) += sb1000.o
-obj-$(CONFIG_MAC8390) += mac8390.o 8390.o
+obj-$(CONFIG_MAC8390) += mac8390.o
 obj-$(CONFIG_APNE) += apne.o 8390.o
 obj-$(CONFIG_PCMCIA_PCNET) += 8390.o
 obj-$(CONFIG_HP100) += hp100.o
index b2c49679bba78407fe51d58b57cc62344feb7b0d..a0519184e54ee7d7a30aed189a7ce13e5ab122f1 100644 (file)
@@ -1885,8 +1885,17 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit)
 
                        if (unlikely(!newskb))
                                newskb = skb;
-                       else if (skb)
+                       else if (skb) {
+                               /*
+                                * We need to reset ->data to what it
+                                * was before gfar_new_skb() re-aligned
+                                * it to an RXBUF_ALIGNMENT boundary
+                                * before we put the skb back on the
+                                * recycle list.
+                                */
+                               skb->data = skb->head + NET_SKB_PAD;
                                __skb_queue_head(&priv->rx_recycle, skb);
+                       }
                } else {
                        /* Increment the number of packets */
                        dev->stats.rx_packets++;
index 8e884869a05bfd40995af322554e6601c6d129c5..f26667d5eaaec9a4c8837528259665cff1513a6f 100644 (file)
@@ -304,7 +304,7 @@ struct net_device * __init mac8390_probe(int unit)
        if (!MACH_IS_MAC)
                return ERR_PTR(-ENODEV);
 
-       dev = alloc_ei_netdev();
+       dev = ____alloc_ei_netdev(0);
        if (!dev)
                return ERR_PTR(-ENOMEM);
 
@@ -481,10 +481,10 @@ void cleanup_module(void)
 static const struct net_device_ops mac8390_netdev_ops = {
        .ndo_open               = mac8390_open,
        .ndo_stop               = mac8390_close,
-       .ndo_start_xmit         = ei_start_xmit,
-       .ndo_tx_timeout         = ei_tx_timeout,
-       .ndo_get_stats          = ei_get_stats,
-       .ndo_set_multicast_list = ei_set_multicast_list,
+       .ndo_start_xmit         = __ei_start_xmit,
+       .ndo_tx_timeout         = __ei_tx_timeout,
+       .ndo_get_stats          = __ei_get_stats,
+       .ndo_set_multicast_list = __ei_set_multicast_list,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_set_mac_address    = eth_mac_addr,
        .ndo_change_mtu         = eth_change_mtu,
index 0b6e8c89683581efdfc35925adaa018998468db5..8247a945a1d9b0df7f11aebc858eccb7552a02cd 100644 (file)
@@ -3554,54 +3554,64 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
        int handled = 0;
        int status;
 
+       /* loop handling interrupts until we have no new ones or
+        * we hit a invalid/hotplug case.
+        */
        status = RTL_R16(IntrStatus);
+       while (status && status != 0xffff) {
+               handled = 1;
 
-       /* hotplug/major error/no more work/shared irq */
-       if ((status == 0xffff) || !status)
-               goto out;
-
-       handled = 1;
+               /* Handle all of the error cases first. These will reset
+                * the chip, so just exit the loop.
+                */
+               if (unlikely(!netif_running(dev))) {
+                       rtl8169_asic_down(ioaddr);
+                       break;
+               }
 
-       if (unlikely(!netif_running(dev))) {
-               rtl8169_asic_down(ioaddr);
-               goto out;
-       }
+               /* Work around for rx fifo overflow */
+               if (unlikely(status & RxFIFOOver) &&
+               (tp->mac_version == RTL_GIGA_MAC_VER_11)) {
+                       netif_stop_queue(dev);
+                       rtl8169_tx_timeout(dev);
+                       break;
+               }
 
-       status &= tp->intr_mask;
-       RTL_W16(IntrStatus,
-               (status & RxFIFOOver) ? (status | RxOverflow) : status);
+               if (unlikely(status & SYSErr)) {
+                       rtl8169_pcierr_interrupt(dev);
+                       break;
+               }
 
-       if (!(status & tp->intr_event))
-               goto out;
+               if (status & LinkChg)
+                       rtl8169_check_link_status(dev, tp, ioaddr);
 
-       /* Work around for rx fifo overflow */
-       if (unlikely(status & RxFIFOOver) &&
-           (tp->mac_version == RTL_GIGA_MAC_VER_11)) {
-               netif_stop_queue(dev);
-               rtl8169_tx_timeout(dev);
-               goto out;
-       }
+               /* We need to see the lastest version of tp->intr_mask to
+                * avoid ignoring an MSI interrupt and having to wait for
+                * another event which may never come.
+                */
+               smp_rmb();
+               if (status & tp->intr_mask & tp->napi_event) {
+                       RTL_W16(IntrMask, tp->intr_event & ~tp->napi_event);
+                       tp->intr_mask = ~tp->napi_event;
+
+                       if (likely(napi_schedule_prep(&tp->napi)))
+                               __napi_schedule(&tp->napi);
+                       else if (netif_msg_intr(tp)) {
+                               printk(KERN_INFO "%s: interrupt %04x in poll\n",
+                               dev->name, status);
+                       }
+               }
 
-       if (unlikely(status & SYSErr)) {
-               rtl8169_pcierr_interrupt(dev);
-               goto out;
+               /* We only get a new MSI interrupt when all active irq
+                * sources on the chip have been acknowledged. So, ack
+                * everything we've seen and check if new sources have become
+                * active to avoid blocking all interrupts from the chip.
+                */
+               RTL_W16(IntrStatus,
+                       (status & RxFIFOOver) ? (status | RxOverflow) : status);
+               status = RTL_R16(IntrStatus);
        }
 
-       if (status & LinkChg)
-               rtl8169_check_link_status(dev, tp, ioaddr);
-
-       if (status & tp->napi_event) {
-               RTL_W16(IntrMask, tp->intr_event & ~tp->napi_event);
-               tp->intr_mask = ~tp->napi_event;
-
-               if (likely(napi_schedule_prep(&tp->napi)))
-                       __napi_schedule(&tp->napi);
-               else if (netif_msg_intr(tp)) {
-                       printk(KERN_INFO "%s: interrupt %04x in poll\n",
-                              dev->name, status);
-               }
-       }
-out:
        return IRQ_RETVAL(handled);
 }
 
@@ -3617,13 +3627,15 @@ static int rtl8169_poll(struct napi_struct *napi, int budget)
 
        if (work_done < budget) {
                napi_complete(napi);
-               tp->intr_mask = 0xffff;
-               /*
-                * 20040426: the barrier is not strictly required but the
-                * behavior of the irq handler could be less predictable
-                * without it. Btw, the lack of flush for the posted pci
-                * write is safe - FR
+
+               /* We need for force the visibility of tp->intr_mask
+                * for other CPUs, as we can loose an MSI interrupt
+                * and potentially wait for a retransmit timeout if we don't.
+                * The posted write to IntrMask is safe, as it will
+                * eventually make it to the chip and we won't loose anything
+                * until it does.
                 */
+               tp->intr_mask = 0xffff;
                smp_wmb();
                RTL_W16(IntrMask, tp->intr_event);
        }
index ca4151a9e2229a20b88149577db093e98a942aae..17851321b7fd0ea7bd1e7815577ba5654de149ce 100644 (file)
@@ -505,27 +505,52 @@ int i2400mu_suspend(struct usb_interface *iface, pm_message_t pm_msg)
 #ifdef CONFIG_PM
        struct usb_device *usb_dev = i2400mu->usb_dev;
 #endif
+       unsigned is_autosuspend = 0;
        struct i2400m *i2400m = &i2400mu->i2400m;
 
+#ifdef CONFIG_PM
+       if (usb_dev->auto_pm > 0)
+               is_autosuspend = 1;
+#endif
+
        d_fnstart(3, dev, "(iface %p pm_msg %u)\n", iface, pm_msg.event);
        if (i2400m->updown == 0)
                goto no_firmware;
-       d_printf(1, dev, "fw up, requesting standby\n");
+       if (i2400m->state == I2400M_SS_DATA_PATH_CONNECTED && is_autosuspend) {
+               /* ugh -- the device is connected and this suspend
+                * request is an autosuspend one (not a system standby
+                * / hibernate).
+                *
+                * The only way the device can go to standby is if the
+                * link with the base station is in IDLE mode; that
+                * were the case, we'd be in status
+                * I2400M_SS_CONNECTED_IDLE. But we are not.
+                *
+                * If we *tell* him to go power save now, it'll reset
+                * as a precautionary measure, so if this is an
+                * autosuspend thing, say no and it'll come back
+                * later, when the link is IDLE
+                */
+               result = -EBADF;
+               d_printf(1, dev, "fw up, link up, not-idle, autosuspend: "
+                        "not entering powersave\n");
+               goto error_not_now;
+       }
+       d_printf(1, dev, "fw up: entering powersave\n");
        atomic_dec(&i2400mu->do_autopm);
        result = i2400m_cmd_enter_powersave(i2400m);
        atomic_inc(&i2400mu->do_autopm);
-#ifdef CONFIG_PM
-       if (result < 0 && usb_dev->auto_pm == 0) {
+       if (result < 0 && !is_autosuspend) {
                /* System suspend, can't fail */
                dev_err(dev, "failed to suspend, will reset on resume\n");
                result = 0;
        }
-#endif
        if (result < 0)
                goto error_enter_powersave;
        i2400mu_notification_release(i2400mu);
-       d_printf(1, dev, "fw up, got standby\n");
+       d_printf(1, dev, "powersave requested\n");
 error_enter_powersave:
+error_not_now:
 no_firmware:
        d_fnend(3, dev, "(iface %p pm_msg %u) = %d\n",
                iface, pm_msg.event, result);
index d734757391270be2b549a89376df0ccb38bb66bf..9eabf4d1f2e7cd021f5041576776aeb1a658a905 100644 (file)
@@ -6467,6 +6467,7 @@ static int airo_get_encode(struct net_device *dev,
 {
        struct airo_info *local = dev->ml_priv;
        int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
+       int wep_key_len;
        u8 buf[16];
 
        if (!local->wep_capable)
@@ -6500,11 +6501,13 @@ static int airo_get_encode(struct net_device *dev,
        dwrq->flags |= index + 1;
 
        /* Copy the key to the user buffer */
-       dwrq->length = get_wep_key(local, index, &buf[0], sizeof(buf));
-       if (dwrq->length != -1)
-               memcpy(extra, buf, dwrq->length);
-       else
+       wep_key_len = get_wep_key(local, index, &buf[0], sizeof(buf));
+       if (wep_key_len < 0) {
                dwrq->length = 0;
+       } else {
+               dwrq->length = wep_key_len;
+               memcpy(extra, buf, dwrq->length);
+       }
 
        return 0;
 }
@@ -6617,7 +6620,7 @@ static int airo_get_encodeext(struct net_device *dev,
        struct airo_info *local = dev->ml_priv;
        struct iw_point *encoding = &wrqu->encoding;
        struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
-       int idx, max_key_len;
+       int idx, max_key_len, wep_key_len;
        u8 buf[16];
 
        if (!local->wep_capable)
@@ -6661,11 +6664,13 @@ static int airo_get_encodeext(struct net_device *dev,
        memset(extra, 0, 16);
        
        /* Copy the key to the user buffer */
-       ext->key_len = get_wep_key(local, idx, &buf[0], sizeof(buf));
-       if (ext->key_len != -1)
-               memcpy(extra, buf, ext->key_len);
-       else
+       wep_key_len = get_wep_key(local, idx, &buf[0], sizeof(buf));
+       if (wep_key_len < 0) {
                ext->key_len = 0;
+       } else {
+               ext->key_len = wep_key_len;
+               memcpy(extra, buf, ext->key_len);
+       }
 
        return 0;
 }
index 9e2faae5ae942c81d5a857d2b9c528138370cbfa..b48b29dca3d2a6b70ad1e08479d12dea51f5a69d 100644 (file)
@@ -1487,28 +1487,35 @@ ath5k_get_linear_pcdac_min(const u8 *stepL, const u8 *stepR,
 {
        s8 tmp;
        s16 min_pwrL, min_pwrR;
-       s16 pwr_i = pwrL[0];
-
-       do {
-               pwr_i--;
-               tmp = (s8) ath5k_get_interpolated_value(pwr_i,
-                                               pwrL[0], pwrL[1],
-                                               stepL[0], stepL[1]);
-
-       } while (tmp > 1);
-
-       min_pwrL = pwr_i;
-
-       pwr_i = pwrR[0];
-       do {
-               pwr_i--;
-               tmp = (s8) ath5k_get_interpolated_value(pwr_i,
-                                               pwrR[0], pwrR[1],
-                                               stepR[0], stepR[1]);
-
-       } while (tmp > 1);
+       s16 pwr_i;
+
+       if (pwrL[0] == pwrL[1])
+               min_pwrL = pwrL[0];
+       else {
+               pwr_i = pwrL[0];
+               do {
+                       pwr_i--;
+                       tmp = (s8) ath5k_get_interpolated_value(pwr_i,
+                                                       pwrL[0], pwrL[1],
+                                                       stepL[0], stepL[1]);
+               } while (tmp > 1);
+
+               min_pwrL = pwr_i;
+       }
 
-       min_pwrR = pwr_i;
+       if (pwrR[0] == pwrR[1])
+               min_pwrR = pwrR[0];
+       else {
+               pwr_i = pwrR[0];
+               do {
+                       pwr_i--;
+                       tmp = (s8) ath5k_get_interpolated_value(pwr_i,
+                                                       pwrR[0], pwrR[1],
+                                                       stepR[0], stepR[1]);
+               } while (tmp > 1);
+
+               min_pwrR = pwr_i;
+       }
 
        /* Keep the right boundary so that it works for both curves */
        return max(min_pwrL, min_pwrR);
index 7a17d31b2fd9f762a2bd8870639e7e0ed8b3723c..5f72c111c2e8fbec500ef4e50fce7acff2ef685e 100644 (file)
@@ -26,7 +26,7 @@
 \*****************************/
 
 #include <linux/pci.h>                 /* To determine if a card is pci-e */
-#include <linux/bitops.h>      /* For get_bitmask_order */
+#include <linux/log2.h>
 #include "ath5k.h"
 #include "reg.h"
 #include "base.h"
@@ -69,10 +69,10 @@ static inline int ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah,
 
        /* Get exponent
         * ALGO: coef_exp = 14 - highest set bit position */
-       coef_exp = get_bitmask_order(coef_scaled);
+       coef_exp = ilog2(coef_scaled);
 
        /* Doesn't make sense if it's zero*/
-       if (!coef_exp)
+       if (!coef_scaled || !coef_exp)
                return -EINVAL;
 
        /* Note: we've shifted coef_scaled by 24 */
@@ -359,7 +359,7 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)
                        mode |= AR5K_PHY_MODE_FREQ_5GHZ;
 
                        if (ah->ah_radio == AR5K_RF5413)
-                               clock |= AR5K_PHY_PLL_40MHZ_5413;
+                               clock = AR5K_PHY_PLL_40MHZ_5413;
                        else
                                clock |= AR5K_PHY_PLL_40MHZ;
 
index e5ca2511a81a2b5949a1373ff87b329f77c161e2..9452461ce8645be87d9c3779e6388bb910d8ea63 100644 (file)
@@ -46,7 +46,7 @@
 #include "iwl-6000-hw.h"
 
 /* Highest firmware API version supported */
-#define IWL5000_UCODE_API_MAX 1
+#define IWL5000_UCODE_API_MAX 2
 #define IWL5150_UCODE_API_MAX 2
 
 /* Lowest firmware API version supported */
index 3bb28db4a40fd5aa71dfc08ac4605a84dda17e86..f46ba24757768226a842ef1f51bc0b61f53275cd 100644 (file)
@@ -669,13 +669,6 @@ static int iwl_set_mode(struct iwl_priv *priv, int mode)
        if (!iwl_is_ready_rf(priv))
                return -EAGAIN;
 
-       cancel_delayed_work(&priv->scan_check);
-       if (iwl_scan_cancel_timeout(priv, 100)) {
-               IWL_WARN(priv, "Aborted scan still in progress after 100ms\n");
-               IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n");
-               return -EAGAIN;
-       }
-
        iwl_commit_rxon(priv);
 
        return 0;
index e7c65c4f741bfb0be178586d4e8c908de347c653..6330b91e37ceab65eb776e4c336a91bf827b5607 100644 (file)
@@ -227,9 +227,6 @@ static void iwl_rx_scan_complete_notif(struct iwl_priv *priv,
        /* The HW is no longer scanning */
        clear_bit(STATUS_SCAN_HW, &priv->status);
 
-       /* The scan completion notification came in, so kill that timer... */
-       cancel_delayed_work(&priv->scan_check);
-
        IWL_DEBUG_INFO(priv, "Scan pass on %sGHz took %dms\n",
                       (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) ?
                                                "2.4" : "5.2",
@@ -712,6 +709,8 @@ static void iwl_bg_request_scan(struct work_struct *data)
 
        mutex_lock(&priv->mutex);
 
+       cancel_delayed_work(&priv->scan_check);
+
        if (!iwl_is_ready(priv)) {
                IWL_WARN(priv, "request scan called when driver not ready.\n");
                goto done;
@@ -925,6 +924,8 @@ void iwl_bg_scan_completed(struct work_struct *work)
 
        IWL_DEBUG_SCAN(priv, "SCAN complete scan\n");
 
+       cancel_delayed_work(&priv->scan_check);
+
        ieee80211_scan_completed(priv->hw, false);
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
index 4cce66133500a04087084ab8eec0979160b7262f..ff4d0e41d7c492237d5740b423be5918b526bc3f 100644 (file)
@@ -782,13 +782,6 @@ static int iwl3945_set_mode(struct iwl_priv *priv, int mode)
        if (!iwl_is_ready_rf(priv))
                return -EAGAIN;
 
-       cancel_delayed_work(&priv->scan_check);
-       if (iwl_scan_cancel_timeout(priv, 100)) {
-               IWL_WARN(priv, "Aborted scan still in progress after 100ms\n");
-               IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n");
-               return -EAGAIN;
-       }
-
        iwl3945_commit_rxon(priv);
 
        return 0;
@@ -3298,6 +3291,8 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
 
        mutex_lock(&priv->mutex);
 
+       cancel_delayed_work(&priv->scan_check);
+
        if (!iwl_is_ready(priv)) {
                IWL_WARN(priv, "request scan called when driver not ready.\n");
                goto done;
index 07d378ef0b46297995d016b039af2452e2646bea..7b3ee8c2eaef91bac4c9d959f69785d197c1ff35 100644 (file)
@@ -138,7 +138,7 @@ void rt2x00debug_update_crypto(struct rt2x00_dev *rt2x00dev,
 
        if (cipher == CIPHER_TKIP_NO_MIC)
                cipher = CIPHER_TKIP;
-       if (cipher == CIPHER_NONE || cipher > CIPHER_MAX)
+       if (cipher == CIPHER_NONE || cipher >= CIPHER_MAX)
                return;
 
        /* Remove CIPHER_NONE index */
index 3779c1438c11c84613f5ba9b40619907c9a18a9d..0666a827bc62d3a9cd067c744c650f4d6337d563 100644 (file)
@@ -2447,7 +2447,7 @@ static inline void free_SAs(struct pktgen_dev *pkt_dev)
        if (pkt_dev->cflows) {
                /* let go of the SAs if we have them */
                int i = 0;
-               for (;  i < pkt_dev->nflows; i++){
+               for (;  i < pkt_dev->cflows; i++) {
                        struct xfrm_state *x = pkt_dev->flows[i].x;
                        if (x) {
                                xfrm_state_put(x);
index ec0ae490f0b60306029126c0d848674cb2ee055d..33c7c85dfe40c5301e1953d3cddb7a45da305983 100644 (file)
@@ -986,9 +986,12 @@ fib_find_node(struct trie *t, u32 key)
 static struct node *trie_rebalance(struct trie *t, struct tnode *tn)
 {
        int wasfull;
-       t_key cindex, key = tn->key;
+       t_key cindex, key;
        struct tnode *tp;
 
+       preempt_disable();
+       key = tn->key;
+
        while (tn != NULL && (tp = node_parent((struct node *)tn)) != NULL) {
                cindex = tkey_extract_bits(key, tp->pos, tp->bits);
                wasfull = tnode_full(tp, tnode_get_child(tp, cindex));
@@ -1007,6 +1010,7 @@ static struct node *trie_rebalance(struct trie *t, struct tnode *tn)
        if (IS_TNODE(tn))
                tn = (struct tnode *)resize(t, (struct tnode *)tn);
 
+       preempt_enable();
        return (struct node *)tn;
 }
 
index c4c60e9f068acc221cb47079178df40299e3ef20..28205e5bfa9b703a30baed0afe83c24575080574 100644 (file)
@@ -784,8 +784,8 @@ static void rt_check_expire(void)
 {
        static unsigned int rover;
        unsigned int i = rover, goal;
-       struct rtable *rth, **rthp;
-       unsigned long length = 0, samples = 0;
+       struct rtable *rth, *aux, **rthp;
+       unsigned long samples = 0;
        unsigned long sum = 0, sum2 = 0;
        u64 mult;
 
@@ -795,9 +795,9 @@ static void rt_check_expire(void)
        goal = (unsigned int)mult;
        if (goal > rt_hash_mask)
                goal = rt_hash_mask + 1;
-       length = 0;
        for (; goal > 0; goal--) {
                unsigned long tmo = ip_rt_gc_timeout;
+               unsigned long length;
 
                i = (i + 1) & rt_hash_mask;
                rthp = &rt_hash_table[i].chain;
@@ -809,8 +809,10 @@ static void rt_check_expire(void)
 
                if (*rthp == NULL)
                        continue;
+               length = 0;
                spin_lock_bh(rt_hash_lock_addr(i));
                while ((rth = *rthp) != NULL) {
+                       prefetch(rth->u.dst.rt_next);
                        if (rt_is_expired(rth)) {
                                *rthp = rth->u.dst.rt_next;
                                rt_free(rth);
@@ -819,33 +821,30 @@ static void rt_check_expire(void)
                        if (rth->u.dst.expires) {
                                /* Entry is expired even if it is in use */
                                if (time_before_eq(jiffies, rth->u.dst.expires)) {
+nofree:
                                        tmo >>= 1;
                                        rthp = &rth->u.dst.rt_next;
                                        /*
-                                        * Only bump our length if the hash
-                                        * inputs on entries n and n+1 are not
-                                        * the same, we only count entries on
+                                        * We only count entries on
                                         * a chain with equal hash inputs once
                                         * so that entries for different QOS
                                         * levels, and other non-hash input
                                         * attributes don't unfairly skew
                                         * the length computation
                                         */
-                                       if ((*rthp == NULL) ||
-                                           !compare_hash_inputs(&(*rthp)->fl,
-                                                                &rth->fl))
-                                               length += ONE;
+                                       for (aux = rt_hash_table[i].chain;;) {
+                                               if (aux == rth) {
+                                                       length += ONE;
+                                                       break;
+                                               }
+                                               if (compare_hash_inputs(&aux->fl, &rth->fl))
+                                                       break;
+                                               aux = aux->u.dst.rt_next;
+                                       }
                                        continue;
                                }
-                       } else if (!rt_may_expire(rth, tmo, ip_rt_gc_timeout)) {
-                               tmo >>= 1;
-                               rthp = &rth->u.dst.rt_next;
-                               if ((*rthp == NULL) ||
-                                   !compare_hash_inputs(&(*rthp)->fl,
-                                                        &rth->fl))
-                                       length += ONE;
-                               continue;
-                       }
+                       } else if (!rt_may_expire(rth, tmo, ip_rt_gc_timeout))
+                               goto nofree;
 
                        /* Cleanup aged off entries. */
                        *rthp = rth->u.dst.rt_next;
@@ -1068,7 +1067,6 @@ out:      return 0;
 static int rt_intern_hash(unsigned hash, struct rtable *rt, struct rtable **rp)
 {
        struct rtable   *rth, **rthp;
-       struct rtable   *rthi;
        unsigned long   now;
        struct rtable *cand, **candp;
        u32             min_score;
@@ -1088,7 +1086,6 @@ restart:
        }
 
        rthp = &rt_hash_table[hash].chain;
-       rthi = NULL;
 
        spin_lock_bh(rt_hash_lock_addr(hash));
        while ((rth = *rthp) != NULL) {
@@ -1134,17 +1131,6 @@ restart:
                chain_length++;
 
                rthp = &rth->u.dst.rt_next;
-
-               /*
-                * check to see if the next entry in the chain
-                * contains the same hash input values as rt.  If it does
-                * This is where we will insert into the list, instead of
-                * at the head.  This groups entries that differ by aspects not
-                * relvant to the hash function together, which we use to adjust
-                * our chain length
-                */
-               if (*rthp && compare_hash_inputs(&(*rthp)->fl, &rt->fl))
-                       rthi = rth;
        }
 
        if (cand) {
@@ -1205,10 +1191,7 @@ restart:
                }
        }
 
-       if (rthi)
-               rt->u.dst.rt_next = rthi->u.dst.rt_next;
-       else
-               rt->u.dst.rt_next = rt_hash_table[hash].chain;
+       rt->u.dst.rt_next = rt_hash_table[hash].chain;
 
 #if RT_CACHE_DEBUG >= 2
        if (rt->u.dst.rt_next) {
@@ -1224,10 +1207,7 @@ restart:
         * previous writes to rt are comitted to memory
         * before making rt visible to other CPUS.
         */
-       if (rthi)
-               rcu_assign_pointer(rthi->u.dst.rt_next, rt);
-       else
-               rcu_assign_pointer(rt_hash_table[hash].chain, rt);
+       rcu_assign_pointer(rt_hash_table[hash].chain, rt);
 
        spin_unlock_bh(rt_hash_lock_addr(hash));
        *rp = rt;
index a453aac91bd3b740ef44363ef10e5be5390bf6dc..c6743eec9b7d0c555db5e32fdf73c82d6fa7422e 100644 (file)
@@ -158,6 +158,11 @@ void tcp_vegas_cwnd_event(struct sock *sk, enum tcp_ca_event event)
 }
 EXPORT_SYMBOL_GPL(tcp_vegas_cwnd_event);
 
+static inline u32 tcp_vegas_ssthresh(struct tcp_sock *tp)
+{
+       return  min(tp->snd_ssthresh, tp->snd_cwnd-1);
+}
+
 static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
 {
        struct tcp_sock *tp = tcp_sk(sk);
@@ -221,11 +226,10 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
                         */
                        diff = tp->snd_cwnd * (rtt-vegas->baseRTT) / vegas->baseRTT;
 
-                       if (diff > gamma && tp->snd_ssthresh > 2 ) {
+                       if (diff > gamma && tp->snd_cwnd <= tp->snd_ssthresh) {
                                /* Going too fast. Time to slow down
                                 * and switch to congestion avoidance.
                                 */
-                               tp->snd_ssthresh = 2;
 
                                /* Set cwnd to match the actual rate
                                 * exactly:
@@ -235,6 +239,7 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
                                 * utilization.
                                 */
                                tp->snd_cwnd = min(tp->snd_cwnd, (u32)target_cwnd+1);
+                               tp->snd_ssthresh = tcp_vegas_ssthresh(tp);
 
                        } else if (tp->snd_cwnd <= tp->snd_ssthresh) {
                                /* Slow start.  */
@@ -250,6 +255,8 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
                                         * we slow down.
                                         */
                                        tp->snd_cwnd--;
+                                       tp->snd_ssthresh
+                                               = tcp_vegas_ssthresh(tp);
                                } else if (diff < alpha) {
                                        /* We don't have enough extra packets
                                         * in the network, so speed up.
index 1394ddb6e35c5a570cc34f0be3d6d11b55651cc3..032a5ec391c575c72fe3036e659bc74721cc8428 100644 (file)
@@ -137,6 +137,7 @@ static struct rt6_info ip6_null_entry_template = {
                }
        },
        .rt6i_flags     = (RTF_REJECT | RTF_NONEXTHOP),
+       .rt6i_protocol  = RTPROT_KERNEL,
        .rt6i_metric    = ~(u32) 0,
        .rt6i_ref       = ATOMIC_INIT(1),
 };
@@ -159,6 +160,7 @@ static struct rt6_info ip6_prohibit_entry_template = {
                }
        },
        .rt6i_flags     = (RTF_REJECT | RTF_NONEXTHOP),
+       .rt6i_protocol  = RTPROT_KERNEL,
        .rt6i_metric    = ~(u32) 0,
        .rt6i_ref       = ATOMIC_INIT(1),
 };
@@ -176,6 +178,7 @@ static struct rt6_info ip6_blk_hole_entry_template = {
                }
        },
        .rt6i_flags     = (RTF_REJECT | RTF_NONEXTHOP),
+       .rt6i_protocol  = RTPROT_KERNEL,
        .rt6i_metric    = ~(u32) 0,
        .rt6i_ref       = ATOMIC_INIT(1),
 };
index 0f1218b8d289859cb89062ed1f799a32e051c1f6..67e38a056240df73712c56a0ba81ddc5a645626b 100644 (file)
@@ -343,9 +343,9 @@ static int rxrpc_connect_exclusive(struct rxrpc_sock *rx,
                /* not yet present - create a candidate for a new connection
                 * and then redo the check */
                conn = rxrpc_alloc_connection(gfp);
-               if (IS_ERR(conn)) {
-                       _leave(" = %ld", PTR_ERR(conn));
-                       return PTR_ERR(conn);
+               if (!conn) {
+                       _leave(" = -ENOMEM");
+                       return -ENOMEM;
                }
 
                conn->trans = trans;
@@ -508,9 +508,9 @@ int rxrpc_connect_call(struct rxrpc_sock *rx,
                /* not yet present - create a candidate for a new connection and then
                 * redo the check */
                candidate = rxrpc_alloc_connection(gfp);
-               if (IS_ERR(candidate)) {
-                       _leave(" = %ld", PTR_ERR(candidate));
-                       return PTR_ERR(candidate);
+               if (!candidate) {
+                       _leave(" = -ENOMEM");
+                       return -ENOMEM;
                }
 
                candidate->trans = trans;
index 08265ca157853c525a74512306bbe7ac055b72c3..487cb627ddbae72eadeba33794ddffe392ca771d 100644 (file)
@@ -1551,6 +1551,13 @@ static int regulatory_hint_core(const char *alpha2)
 
        queue_regulatory_request(request);
 
+       /*
+        * This ensures last_request is populated once modules
+        * come swinging in and calling regulatory hints and
+        * wiphy_apply_custom_regulatory().
+        */
+       flush_scheduled_work();
+
        return 0;
 }
 
index cb6a5bb85d802ca90cdf111451fe6b109ac08f26..0e59f9ae9b81fadcff031f044a2b1bfa14e21d3c 100644 (file)
@@ -786,6 +786,13 @@ static int ioctl_standard_iw_point(struct iw_point *iwp, unsigned int cmd,
                        err = -EFAULT;
                        goto out;
                }
+
+               if (cmd == SIOCSIWENCODEEXT) {
+                       struct iw_encode_ext *ee = (void *) extra;
+
+                       if (iwp->length < sizeof(*ee) + ee->key_len)
+                               return -EFAULT;
+               }
        }
 
        err = handler(dev, info, (union iwreq_data *) iwp, extra);