Commit 96789ac4b3943fec27fb6bf2713633b01a3903ad

Authored by Linus Torvalds

Merge branch 'upstream-fixes' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6

Showing 5 changed files Side-by-side Diff

drivers/net/8139cp.c
... ... @@ -1118,13 +1118,18 @@
1118 1118 return -ENOMEM;
1119 1119 }
1120 1120  
  1121 +static void cp_init_rings_index (struct cp_private *cp)
  1122 +{
  1123 + cp->rx_tail = 0;
  1124 + cp->tx_head = cp->tx_tail = 0;
  1125 +}
  1126 +
1121 1127 static int cp_init_rings (struct cp_private *cp)
1122 1128 {
1123 1129 memset(cp->tx_ring, 0, sizeof(struct cp_desc) * CP_TX_RING_SIZE);
1124 1130 cp->tx_ring[CP_TX_RING_SIZE - 1].opts1 = cpu_to_le32(RingEnd);
1125 1131  
1126   - cp->rx_tail = 0;
1127   - cp->tx_head = cp->tx_tail = 0;
  1132 + cp_init_rings_index(cp);
1128 1133  
1129 1134 return cp_refill_rx (cp);
1130 1135 }
1131 1136  
1132 1137  
1133 1138  
... ... @@ -1886,30 +1891,30 @@
1886 1891  
1887 1892 spin_unlock_irqrestore (&cp->lock, flags);
1888 1893  
1889   - if (cp->pdev && cp->wol_enabled) {
1890   - pci_save_state (cp->pdev);
1891   - cp_set_d3_state (cp);
1892   - }
  1894 + pci_save_state(pdev);
  1895 + pci_enable_wake(pdev, pci_choose_state(pdev, state), cp->wol_enabled);
  1896 + pci_set_power_state(pdev, pci_choose_state(pdev, state));
1893 1897  
1894 1898 return 0;
1895 1899 }
1896 1900  
1897 1901 static int cp_resume (struct pci_dev *pdev)
1898 1902 {
1899   - struct net_device *dev;
1900   - struct cp_private *cp;
  1903 + struct net_device *dev = pci_get_drvdata (pdev);
  1904 + struct cp_private *cp = netdev_priv(dev);
1901 1905 unsigned long flags;
1902 1906  
1903   - dev = pci_get_drvdata (pdev);
1904   - cp = netdev_priv(dev);
  1907 + if (!netif_running(dev))
  1908 + return 0;
1905 1909  
1906 1910 netif_device_attach (dev);
1907   -
1908   - if (cp->pdev && cp->wol_enabled) {
1909   - pci_set_power_state (cp->pdev, PCI_D0);
1910   - pci_restore_state (cp->pdev);
1911   - }
1912   -
  1911 +
  1912 + pci_set_power_state(pdev, PCI_D0);
  1913 + pci_restore_state(pdev);
  1914 + pci_enable_wake(pdev, PCI_D0, 0);
  1915 +
  1916 + /* FIXME: sh*t may happen if the Rx ring buffer is depleted */
  1917 + cp_init_rings_index (cp);
1913 1918 cp_init_hw (cp);
1914 1919 netif_start_queue (dev);
1915 1920  
... ... @@ -96,10 +96,6 @@
96 96 module_param(copybreak, int, 0);
97 97 MODULE_PARM_DESC(copybreak, "Receive copy threshold");
98 98  
99   -static int disable_msi = 0;
100   -module_param(disable_msi, int, 0);
101   -MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)");
102   -
103 99 static const struct pci_device_id sky2_id_table[] = {
104 100 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) },
105 101 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) },
... ... @@ -3126,61 +3122,6 @@
3126 3122 dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]);
3127 3123 }
3128 3124  
3129   -/* Handle software interrupt used during MSI test */
3130   -static irqreturn_t __devinit sky2_test_intr(int irq, void *dev_id,
3131   - struct pt_regs *regs)
3132   -{
3133   - struct sky2_hw *hw = dev_id;
3134   - u32 status = sky2_read32(hw, B0_Y2_SP_ISRC2);
3135   -
3136   - if (status == 0)
3137   - return IRQ_NONE;
3138   -
3139   - if (status & Y2_IS_IRQ_SW) {
3140   - sky2_write8(hw, B0_CTST, CS_CL_SW_IRQ);
3141   - hw->msi = 1;
3142   - }
3143   - sky2_write32(hw, B0_Y2_SP_ICR, 2);
3144   -
3145   - sky2_read32(hw, B0_IMSK);
3146   - return IRQ_HANDLED;
3147   -}
3148   -
3149   -/* Test interrupt path by forcing a a software IRQ */
3150   -static int __devinit sky2_test_msi(struct sky2_hw *hw)
3151   -{
3152   - struct pci_dev *pdev = hw->pdev;
3153   - int i, err;
3154   -
3155   - sky2_write32(hw, B0_IMSK, Y2_IS_IRQ_SW);
3156   -
3157   - err = request_irq(pdev->irq, sky2_test_intr, SA_SHIRQ, DRV_NAME, hw);
3158   - if (err) {
3159   - printk(KERN_ERR PFX "%s: cannot assign irq %d\n",
3160   - pci_name(pdev), pdev->irq);
3161   - return err;
3162   - }
3163   -
3164   - sky2_write8(hw, B0_CTST, CS_ST_SW_IRQ);
3165   - wmb();
3166   -
3167   - for (i = 0; i < 10; i++) {
3168   - barrier();
3169   - if (hw->msi)
3170   - goto found;
3171   - mdelay(1);
3172   - }
3173   -
3174   - err = -EOPNOTSUPP;
3175   - sky2_write8(hw, B0_CTST, CS_CL_SW_IRQ);
3176   - found:
3177   - sky2_write32(hw, B0_IMSK, 0);
3178   -
3179   - free_irq(pdev->irq, hw);
3180   -
3181   - return err;
3182   -}
3183   -
3184 3125 static int __devinit sky2_probe(struct pci_dev *pdev,
3185 3126 const struct pci_device_id *ent)
3186 3127 {
... ... @@ -3302,20 +3243,6 @@
3302 3243 }
3303 3244 }
3304 3245  
3305   - if (!disable_msi && pci_enable_msi(pdev) == 0) {
3306   - err = sky2_test_msi(hw);
3307   - if (err == -EOPNOTSUPP) {
3308   - /* MSI test failed, go back to INTx mode */
3309   - printk(KERN_WARNING PFX "%s: No interrupt was generated using MSI, "
3310   - "switching to INTx mode. Please report this failure to "
3311   - "the PCI maintainer and include system chipset information.\n",
3312   - pci_name(pdev));
3313   - pci_disable_msi(pdev);
3314   - }
3315   - else if (err)
3316   - goto err_out_unregister;
3317   - }
3318   -
3319 3246 err = request_irq(pdev->irq, sky2_intr, SA_SHIRQ | SA_SAMPLE_RANDOM,
3320 3247 DRV_NAME, hw);
3321 3248 if (err) {
... ... @@ -3332,8 +3259,6 @@
3332 3259 return 0;
3333 3260  
3334 3261 err_out_unregister:
3335   - if (hw->msi)
3336   - pci_disable_msi(pdev);
3337 3262 if (dev1) {
3338 3263 unregister_netdev(dev1);
3339 3264 free_netdev(dev1);
... ... @@ -3376,8 +3301,6 @@
3376 3301 sky2_read8(hw, B0_CTST);
3377 3302  
3378 3303 free_irq(pdev->irq, hw);
3379   - if (hw->msi)
3380   - pci_disable_msi(pdev);
3381 3304 pci_free_consistent(pdev, STATUS_LE_BYTES, hw->st_le, hw->st_dma);
3382 3305 pci_release_regions(pdev);
3383 3306 pci_disable_device(pdev);
... ... @@ -1881,7 +1881,6 @@
1881 1881 u32 intr_mask;
1882 1882  
1883 1883 int pm_cap;
1884   - int msi;
1885 1884 u8 chip_id;
1886 1885 u8 chip_rev;
1887 1886 u8 copper;
drivers/net/via-velocity.c
... ... @@ -1106,6 +1106,9 @@
1106 1106  
1107 1107 for (i = 0; i < vptr->options.numrx; i++) {
1108 1108 struct velocity_rd_info *rd_info = &(vptr->rd_info[i]);
  1109 + struct rx_desc *rd = vptr->rd_ring + i;
  1110 +
  1111 + memset(rd, 0, sizeof(*rd));
1109 1112  
1110 1113 if (!rd_info->skb)
1111 1114 continue;
net/ieee80211/ieee80211_rx.c
... ... @@ -1301,7 +1301,7 @@
1301 1301 /* dst->last_associate is not overwritten */
1302 1302 }
1303 1303  
1304   -static inline int is_beacon(int fc)
  1304 +static inline int is_beacon(__le16 fc)
1305 1305 {
1306 1306 return (WLAN_FC_GET_STYPE(le16_to_cpu(fc)) == IEEE80211_STYPE_BEACON);
1307 1307 }
... ... @@ -1348,9 +1348,7 @@
1348 1348 escape_essid(info_element->data,
1349 1349 info_element->len),
1350 1350 MAC_ARG(beacon->header.addr3),
1351   - is_beacon(le16_to_cpu
1352   - (beacon->header.
1353   - frame_ctl)) ?
  1351 + is_beacon(beacon->header.frame_ctl) ?
1354 1352 "BEACON" : "PROBE RESPONSE");
1355 1353 return;
1356 1354 }
... ... @@ -1400,9 +1398,7 @@
1400 1398 escape_essid(network.ssid,
1401 1399 network.ssid_len),
1402 1400 MAC_ARG(network.bssid),
1403   - is_beacon(le16_to_cpu
1404   - (beacon->header.
1405   - frame_ctl)) ?
  1401 + is_beacon(beacon->header.frame_ctl) ?
1406 1402 "BEACON" : "PROBE RESPONSE");
1407 1403 #endif
1408 1404 memcpy(target, &network, sizeof(*target));
1409 1405  
... ... @@ -1412,16 +1408,14 @@
1412 1408 escape_essid(target->ssid,
1413 1409 target->ssid_len),
1414 1410 MAC_ARG(target->bssid),
1415   - is_beacon(le16_to_cpu
1416   - (beacon->header.
1417   - frame_ctl)) ?
  1411 + is_beacon(beacon->header.frame_ctl) ?
1418 1412 "BEACON" : "PROBE RESPONSE");
1419 1413 update_network(target, &network);
1420 1414 }
1421 1415  
1422 1416 spin_unlock_irqrestore(&ieee->lock, flags);
1423 1417  
1424   - if (is_beacon(le16_to_cpu(beacon->header.frame_ctl))) {
  1418 + if (is_beacon(beacon->header.frame_ctl)) {
1425 1419 if (ieee->handle_beacon != NULL)
1426 1420 ieee->handle_beacon(dev, beacon, &network);
1427 1421 } else {