Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

Conflicts:
drivers/net/yellowfin.c

+389 -227
+3 -1
drivers/net/Kconfig
··· 1727 1727 tristate "Micrel KSZ8842" 1728 1728 depends on HAS_IOMEM 1729 1729 help 1730 - This platform driver is for Micrel KSZ8842 chip. 1730 + This platform driver is for Micrel KSZ8842 / KS8842 1731 + 2-port ethernet switch chip (managed, VLAN, QoS). 1731 1732 1732 1733 config KS8851 1733 1734 tristate "Micrel KS8851 SPI" 1734 1735 depends on SPI 1735 1736 select MII 1737 + select CRC32 1736 1738 help 1737 1739 SPI driver for Micrel KS8851 SPI attached network chip. 1738 1740
+2 -2
drivers/net/arm/w90p910_ether.c
··· 1098 1098 .probe = w90p910_ether_probe, 1099 1099 .remove = __devexit_p(w90p910_ether_remove), 1100 1100 .driver = { 1101 - .name = "w90p910-emc", 1101 + .name = "nuc900-emc", 1102 1102 .owner = THIS_MODULE, 1103 1103 }, 1104 1104 }; ··· 1119 1119 MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); 1120 1120 MODULE_DESCRIPTION("w90p910 MAC driver!"); 1121 1121 MODULE_LICENSE("GPL"); 1122 - MODULE_ALIAS("platform:w90p910-emc"); 1122 + MODULE_ALIAS("platform:nuc900-emc"); 1123 1123
+3 -2
drivers/net/b44.c
··· 952 952 int rc = NETDEV_TX_OK; 953 953 dma_addr_t mapping; 954 954 u32 len, entry, ctrl; 955 + unsigned long flags; 955 956 956 957 len = skb->len; 957 - spin_lock_irq(&bp->lock); 958 + spin_lock_irqsave(&bp->lock, flags); 958 959 959 960 /* This is a hard error, log it. */ 960 961 if (unlikely(TX_BUFFS_AVAIL(bp) < 1)) { ··· 1028 1027 dev->trans_start = jiffies; 1029 1028 1030 1029 out_unlock: 1031 - spin_unlock_irq(&bp->lock); 1030 + spin_unlock_irqrestore(&bp->lock, flags); 1032 1031 1033 1032 return rc; 1034 1033
+11 -6
drivers/net/bnx2.c
··· 401 401 struct bnx2_napi *bnapi = &bp->bnx2_napi[0]; 402 402 struct cnic_eth_dev *cp = &bp->cnic_eth_dev; 403 403 404 + mutex_lock(&bp->cnic_lock); 404 405 cp->drv_state = 0; 405 406 bnapi->cnic_present = 0; 406 407 rcu_assign_pointer(bp->cnic_ops, NULL); 408 + mutex_unlock(&bp->cnic_lock); 407 409 synchronize_rcu(); 408 410 return 0; 409 411 } ··· 433 431 struct cnic_ops *c_ops; 434 432 struct cnic_ctl_info info; 435 433 436 - rcu_read_lock(); 437 - c_ops = rcu_dereference(bp->cnic_ops); 434 + mutex_lock(&bp->cnic_lock); 435 + c_ops = bp->cnic_ops; 438 436 if (c_ops) { 439 437 info.cmd = CNIC_CTL_STOP_CMD; 440 438 c_ops->cnic_ctl(bp->cnic_data, &info); 441 439 } 442 - rcu_read_unlock(); 440 + mutex_unlock(&bp->cnic_lock); 443 441 } 444 442 445 443 static void ··· 448 446 struct cnic_ops *c_ops; 449 447 struct cnic_ctl_info info; 450 448 451 - rcu_read_lock(); 452 - c_ops = rcu_dereference(bp->cnic_ops); 449 + mutex_lock(&bp->cnic_lock); 450 + c_ops = bp->cnic_ops; 453 451 if (c_ops) { 454 452 if (!(bp->flags & BNX2_FLAG_USING_MSIX)) { 455 453 struct bnx2_napi *bnapi = &bp->bnx2_napi[0]; ··· 459 457 info.cmd = CNIC_CTL_START_CMD; 460 458 c_ops->cnic_ctl(bp->cnic_data, &info); 461 459 } 462 - rcu_read_unlock(); 460 + mutex_unlock(&bp->cnic_lock); 463 461 } 464 462 465 463 #else ··· 7689 7687 7690 7688 spin_lock_init(&bp->phy_lock); 7691 7689 spin_lock_init(&bp->indirect_lock); 7690 + #ifdef BCM_CNIC 7691 + mutex_init(&bp->cnic_lock); 7692 + #endif 7692 7693 INIT_WORK(&bp->reset_task, bnx2_reset_task); 7693 7694 7694 7695 dev->base_addr = dev->mem_start = pci_resource_start(pdev, 0);
+1
drivers/net/bnx2.h
··· 6903 6903 u32 idle_chk_status_idx; 6904 6904 6905 6905 #ifdef BCM_CNIC 6906 + struct mutex cnic_lock; 6906 6907 struct cnic_eth_dev cnic_eth_dev; 6907 6908 #endif 6908 6909
+105 -40
drivers/net/cnic.c
··· 138 138 return NULL; 139 139 } 140 140 141 + static inline void ulp_get(struct cnic_ulp_ops *ulp_ops) 142 + { 143 + atomic_inc(&ulp_ops->ref_count); 144 + } 145 + 146 + static inline void ulp_put(struct cnic_ulp_ops *ulp_ops) 147 + { 148 + atomic_dec(&ulp_ops->ref_count); 149 + } 150 + 141 151 static void cnic_ctx_wr(struct cnic_dev *dev, u32 cid_addr, u32 off, u32 val) 142 152 { 143 153 struct cnic_local *cp = dev->cnic_priv; ··· 368 358 } 369 359 read_unlock(&cnic_dev_lock); 370 360 361 + atomic_set(&ulp_ops->ref_count, 0); 371 362 rcu_assign_pointer(cnic_ulp_tbl[ulp_type], ulp_ops); 372 363 mutex_unlock(&cnic_lock); 373 364 ··· 390 379 int cnic_unregister_driver(int ulp_type) 391 380 { 392 381 struct cnic_dev *dev; 382 + struct cnic_ulp_ops *ulp_ops; 383 + int i = 0; 393 384 394 385 if (ulp_type >= MAX_CNIC_ULP_TYPE) { 395 386 printk(KERN_ERR PFX "cnic_unregister_driver: Bad type %d\n", ··· 399 386 return -EINVAL; 400 387 } 401 388 mutex_lock(&cnic_lock); 402 - if (!cnic_ulp_tbl[ulp_type]) { 389 + ulp_ops = cnic_ulp_tbl[ulp_type]; 390 + if (!ulp_ops) { 403 391 printk(KERN_ERR PFX "cnic_unregister_driver: Type %d has not " 404 392 "been registered\n", ulp_type); 405 393 goto out_unlock; ··· 425 411 426 412 mutex_unlock(&cnic_lock); 427 413 synchronize_rcu(); 414 + while ((atomic_read(&ulp_ops->ref_count) != 0) && (i < 20)) { 415 + msleep(100); 416 + i++; 417 + } 418 + 419 + if (atomic_read(&ulp_ops->ref_count) != 0) 420 + printk(KERN_WARNING PFX "%s: Failed waiting for ref count to go" 421 + " to zero.\n", dev->netdev->name); 428 422 return 0; 429 423 430 424 out_unlock: ··· 488 466 static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type) 489 467 { 490 468 struct cnic_local *cp = dev->cnic_priv; 469 + int i = 0; 491 470 492 471 if (ulp_type >= MAX_CNIC_ULP_TYPE) { 493 472 printk(KERN_ERR PFX "cnic_unregister_device: Bad type %d\n", ··· 508 485 mutex_unlock(&cnic_lock); 509 486 510 487 synchronize_rcu(); 488 + 489 + while (test_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[ulp_type]) && 490 + i < 20) { 491 + msleep(100); 492 + i++; 493 + } 494 + if (test_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[ulp_type])) 495 + printk(KERN_WARNING PFX "%s: Failed waiting for ULP up call" 496 + " to complete.\n", dev->netdev->name); 511 497 512 498 return 0; 513 499 } ··· 1133 1101 if (cp->cnic_uinfo) 1134 1102 cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); 1135 1103 1136 - rcu_read_lock(); 1137 1104 for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) { 1138 1105 struct cnic_ulp_ops *ulp_ops; 1139 1106 1140 - ulp_ops = rcu_dereference(cp->ulp_ops[if_type]); 1141 - if (!ulp_ops) 1107 + mutex_lock(&cnic_lock); 1108 + ulp_ops = cp->ulp_ops[if_type]; 1109 + if (!ulp_ops) { 1110 + mutex_unlock(&cnic_lock); 1142 1111 continue; 1112 + } 1113 + set_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); 1114 + mutex_unlock(&cnic_lock); 1143 1115 1144 1116 if (test_and_clear_bit(ULP_F_START, &cp->ulp_flags[if_type])) 1145 1117 ulp_ops->cnic_stop(cp->ulp_handle[if_type]); 1118 + 1119 + clear_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); 1146 1120 } 1147 - rcu_read_unlock(); 1148 1121 } 1149 1122 1150 1123 static void cnic_ulp_start(struct cnic_dev *dev) ··· 1157 1120 struct cnic_local *cp = dev->cnic_priv; 1158 1121 int if_type; 1159 1122 1160 - rcu_read_lock(); 1161 1123 for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) { 1162 1124 struct cnic_ulp_ops *ulp_ops; 1163 1125 1164 - ulp_ops = rcu_dereference(cp->ulp_ops[if_type]); 1165 - if (!ulp_ops || !ulp_ops->cnic_start) 1126 + mutex_lock(&cnic_lock); 1127 + ulp_ops = cp->ulp_ops[if_type]; 1128 + if (!ulp_ops || !ulp_ops->cnic_start) { 1129 + mutex_unlock(&cnic_lock); 1166 1130 continue; 1131 + } 1132 + set_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); 1133 + mutex_unlock(&cnic_lock); 1167 1134 1168 1135 if (!test_and_set_bit(ULP_F_START, &cp->ulp_flags[if_type])) 1169 1136 ulp_ops->cnic_start(cp->ulp_handle[if_type]); 1137 + 1138 + clear_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); 1170 1139 } 1171 - rcu_read_unlock(); 1172 1140 } 1173 1141 1174 1142 static int cnic_ctl(void *data, struct cnic_ctl_info *info) ··· 1183 1141 switch (info->cmd) { 1184 1142 case CNIC_CTL_STOP_CMD: 1185 1143 cnic_hold(dev); 1186 - mutex_lock(&cnic_lock); 1187 1144 1188 1145 cnic_ulp_stop(dev); 1189 1146 cnic_stop_hw(dev); 1190 1147 1191 - mutex_unlock(&cnic_lock); 1192 1148 cnic_put(dev); 1193 1149 break; 1194 1150 case CNIC_CTL_START_CMD: 1195 1151 cnic_hold(dev); 1196 - mutex_lock(&cnic_lock); 1197 1152 1198 1153 if (!cnic_start_hw(dev)) 1199 1154 cnic_ulp_start(dev); 1200 1155 1201 - mutex_unlock(&cnic_lock); 1202 1156 cnic_put(dev); 1203 1157 break; 1204 1158 default: ··· 1208 1170 int i; 1209 1171 struct cnic_local *cp = dev->cnic_priv; 1210 1172 1211 - rcu_read_lock(); 1212 1173 for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) { 1213 1174 struct cnic_ulp_ops *ulp_ops; 1214 1175 1215 - ulp_ops = rcu_dereference(cnic_ulp_tbl[i]); 1216 - if (!ulp_ops || !ulp_ops->cnic_init) 1176 + mutex_lock(&cnic_lock); 1177 + ulp_ops = cnic_ulp_tbl[i]; 1178 + if (!ulp_ops || !ulp_ops->cnic_init) { 1179 + mutex_unlock(&cnic_lock); 1217 1180 continue; 1181 + } 1182 + ulp_get(ulp_ops); 1183 + mutex_unlock(&cnic_lock); 1218 1184 1219 1185 if (!test_and_set_bit(ULP_F_INIT, &cp->ulp_flags[i])) 1220 1186 ulp_ops->cnic_init(dev); 1221 1187 1188 + ulp_put(ulp_ops); 1222 1189 } 1223 - rcu_read_unlock(); 1224 1190 } 1225 1191 1226 1192 static void cnic_ulp_exit(struct cnic_dev *dev) ··· 1232 1190 int i; 1233 1191 struct cnic_local *cp = dev->cnic_priv; 1234 1192 1235 - rcu_read_lock(); 1236 1193 for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) { 1237 1194 struct cnic_ulp_ops *ulp_ops; 1238 1195 1239 - ulp_ops = rcu_dereference(cnic_ulp_tbl[i]); 1240 - if (!ulp_ops || !ulp_ops->cnic_exit) 1196 + mutex_lock(&cnic_lock); 1197 + ulp_ops = cnic_ulp_tbl[i]; 1198 + if (!ulp_ops || !ulp_ops->cnic_exit) { 1199 + mutex_unlock(&cnic_lock); 1241 1200 continue; 1201 + } 1202 + ulp_get(ulp_ops); 1203 + mutex_unlock(&cnic_lock); 1242 1204 1243 1205 if (test_and_clear_bit(ULP_F_INIT, &cp->ulp_flags[i])) 1244 1206 ulp_ops->cnic_exit(dev); 1245 1207 1208 + ulp_put(ulp_ops); 1246 1209 } 1247 - rcu_read_unlock(); 1248 1210 } 1249 1211 1250 1212 static int cnic_cm_offload_pg(struct cnic_sock *csk) ··· 2464 2418 return 0; 2465 2419 } 2466 2420 2421 + static int cnic_register_netdev(struct cnic_dev *dev) 2422 + { 2423 + struct cnic_local *cp = dev->cnic_priv; 2424 + struct cnic_eth_dev *ethdev = cp->ethdev; 2425 + int err; 2426 + 2427 + if (!ethdev) 2428 + return -ENODEV; 2429 + 2430 + if (ethdev->drv_state & CNIC_DRV_STATE_REGD) 2431 + return 0; 2432 + 2433 + err = ethdev->drv_register_cnic(dev->netdev, cp->cnic_ops, dev); 2434 + if (err) 2435 + printk(KERN_ERR PFX "%s: register_cnic failed\n", 2436 + dev->netdev->name); 2437 + 2438 + return err; 2439 + } 2440 + 2441 + static void cnic_unregister_netdev(struct cnic_dev *dev) 2442 + { 2443 + struct cnic_local *cp = dev->cnic_priv; 2444 + struct cnic_eth_dev *ethdev = cp->ethdev; 2445 + 2446 + if (!ethdev) 2447 + return; 2448 + 2449 + ethdev->drv_unregister_cnic(dev->netdev); 2450 + } 2451 + 2467 2452 static int cnic_start_hw(struct cnic_dev *dev) 2468 2453 { 2469 2454 struct cnic_local *cp = dev->cnic_priv; ··· 2503 2426 2504 2427 if (test_bit(CNIC_F_CNIC_UP, &dev->flags)) 2505 2428 return -EALREADY; 2506 - 2507 - err = ethdev->drv_register_cnic(dev->netdev, cp->cnic_ops, dev); 2508 - if (err) { 2509 - printk(KERN_ERR PFX "%s: register_cnic failed\n", 2510 - dev->netdev->name); 2511 - goto err2; 2512 - } 2513 2429 2514 2430 dev->regview = ethdev->io_base; 2515 2431 cp->chip_id = ethdev->chip_id; ··· 2533 2463 return 0; 2534 2464 2535 2465 err1: 2536 - ethdev->drv_unregister_cnic(dev->netdev); 2537 2466 cp->free_resc(dev); 2538 2467 pci_dev_put(dev->pcidev); 2539 - err2: 2540 2468 return err; 2541 2469 } 2542 2470 2543 2471 static void cnic_stop_bnx2_hw(struct cnic_dev *dev) 2544 2472 { 2545 - struct cnic_local *cp = dev->cnic_priv; 2546 - struct cnic_eth_dev *ethdev = cp->ethdev; 2547 - 2548 2473 cnic_disable_bnx2_int_sync(dev); 2549 2474 2550 2475 cnic_reg_wr_ind(dev, BNX2_CP_SCRATCH + 0x20, 0); ··· 2550 2485 2551 2486 cnic_setup_5709_context(dev, 0); 2552 2487 cnic_free_irq(dev); 2553 - 2554 - ethdev->drv_unregister_cnic(dev->netdev); 2555 2488 2556 2489 cnic_free_resc(dev); 2557 2490 } ··· 2631 2568 probe = symbol_get(bnx2_cnic_probe); 2632 2569 if (probe) { 2633 2570 ethdev = (*probe)(dev); 2634 - symbol_put_addr(probe); 2571 + symbol_put(bnx2_cnic_probe); 2635 2572 } 2636 2573 if (!ethdev) 2637 2574 return NULL; ··· 2734 2671 else if (event == NETDEV_UNREGISTER) 2735 2672 cnic_ulp_exit(dev); 2736 2673 else if (event == NETDEV_UP) { 2737 - mutex_lock(&cnic_lock); 2674 + if (cnic_register_netdev(dev) != 0) { 2675 + cnic_put(dev); 2676 + goto done; 2677 + } 2738 2678 if (!cnic_start_hw(dev)) 2739 2679 cnic_ulp_start(dev); 2740 - mutex_unlock(&cnic_lock); 2741 2680 } 2742 2681 2743 2682 rcu_read_lock(); ··· 2758 2693 rcu_read_unlock(); 2759 2694 2760 2695 if (event == NETDEV_GOING_DOWN) { 2761 - mutex_lock(&cnic_lock); 2762 2696 cnic_ulp_stop(dev); 2763 2697 cnic_stop_hw(dev); 2764 - mutex_unlock(&cnic_lock); 2698 + cnic_unregister_netdev(dev); 2765 2699 } else if (event == NETDEV_UNREGISTER) { 2766 2700 write_lock(&cnic_dev_lock); 2767 2701 list_del_init(&dev->list); ··· 2792 2728 } 2793 2729 2794 2730 cnic_ulp_exit(dev); 2731 + cnic_unregister_netdev(dev); 2795 2732 list_del_init(&dev->list); 2796 2733 cnic_free_dev(dev); 2797 2734 }
+1
drivers/net/cnic.h
··· 176 176 unsigned long ulp_flags[MAX_CNIC_ULP_TYPE]; 177 177 #define ULP_F_INIT 0 178 178 #define ULP_F_START 1 179 + #define ULP_F_CALL_PENDING 2 179 180 struct cnic_ulp_ops *ulp_ops[MAX_CNIC_ULP_TYPE]; 180 181 181 182 /* protected by ulp_lock */
+1
drivers/net/cnic_if.h
··· 290 290 void (*iscsi_nl_send_msg)(struct cnic_dev *dev, u32 msg_type, 291 291 char *data, u16 data_size); 292 292 struct module *owner; 293 + atomic_t ref_count; 293 294 }; 294 295 295 296 extern int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops);
+1 -1
drivers/net/e100.c
··· 1900 1900 nic->ru_running = RU_SUSPENDED; 1901 1901 pci_dma_sync_single_for_device(nic->pdev, rx->dma_addr, 1902 1902 sizeof(struct rfd), 1903 - PCI_DMA_BIDIRECTIONAL); 1903 + PCI_DMA_FROMDEVICE); 1904 1904 return -ENODATA; 1905 1905 } 1906 1906
+11 -11
drivers/net/e1000e/netdev.c
··· 4539 4539 /* Allow time for pending master requests to run */ 4540 4540 e1000e_disable_pcie_master(&adapter->hw); 4541 4541 4542 - if ((adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) && 4543 - !(hw->mac.ops.check_mng_mode(hw))) { 4542 + if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) { 4544 4543 /* enable wakeup by the PHY */ 4545 4544 retval = e1000_init_phy_wakeup(adapter, wufc); 4546 4545 if (retval) ··· 4557 4558 *enable_wake = !!wufc; 4558 4559 4559 4560 /* make sure adapter isn't asleep if manageability is enabled */ 4560 - if (adapter->flags & FLAG_MNG_PT_ENABLED) 4561 + if ((adapter->flags & FLAG_MNG_PT_ENABLED) || 4562 + (hw->mac.ops.check_mng_mode(hw))) 4561 4563 *enable_wake = true; 4562 4564 4563 4565 if (adapter->hw.phy.type == e1000_phy_igp_3) ··· 4669 4669 dev_err(&pdev->dev, 4670 4670 "Cannot enable PCI device from suspend\n"); 4671 4671 return err; 4672 - } 4673 - 4674 - /* AER (Advanced Error Reporting) hooks */ 4675 - err = pci_enable_pcie_error_reporting(pdev); 4676 - if (err) { 4677 - dev_err(&pdev->dev, "pci_enable_pcie_error_reporting failed " 4678 - "0x%x\n", err); 4679 - /* non-fatal, continue */ 4680 4672 } 4681 4673 4682 4674 pci_set_master(pdev); ··· 4982 4990 e1000e_driver_name); 4983 4991 if (err) 4984 4992 goto err_pci_reg; 4993 + 4994 + /* AER (Advanced Error Reporting) hooks */ 4995 + err = pci_enable_pcie_error_reporting(pdev); 4996 + if (err) { 4997 + dev_err(&pdev->dev, "pci_enable_pcie_error_reporting failed " 4998 + "0x%x\n", err); 4999 + /* non-fatal, continue */ 5000 + } 4985 5001 4986 5002 pci_set_master(pdev); 4987 5003 /* PCI config space info */
+3 -2
drivers/net/fec_mpc52xx.c
··· 309 309 { 310 310 struct mpc52xx_fec_priv *priv = netdev_priv(dev); 311 311 struct bcom_fec_bd *bd; 312 + unsigned long flags; 312 313 313 314 if (bcom_queue_full(priv->tx_dmatsk)) { 314 315 if (net_ratelimit()) ··· 317 316 return NETDEV_TX_BUSY; 318 317 } 319 318 320 - spin_lock_irq(&priv->lock); 319 + spin_lock_irqsave(&priv->lock, flags); 321 320 dev->trans_start = jiffies; 322 321 323 322 bd = (struct bcom_fec_bd *) ··· 333 332 netif_stop_queue(dev); 334 333 } 335 334 336 - spin_unlock_irq(&priv->lock); 335 + spin_unlock_irqrestore(&priv->lock, flags); 337 336 338 337 return NETDEV_TX_OK; 339 338 }
+1
drivers/net/gianfar.c
··· 490 490 491 491 dev_set_drvdata(&ofdev->dev, NULL); 492 492 493 + unregister_netdev(dev); 493 494 iounmap(priv->regs); 494 495 free_netdev(priv->ndev); 495 496
+2
drivers/net/ibm_newemac/core.c
··· 1305 1305 1306 1306 free_irq(dev->emac_irq, dev); 1307 1307 1308 + netif_carrier_off(ndev); 1309 + 1308 1310 return 0; 1309 1311 } 1310 1312
-4
drivers/net/irda/au1k_ir.c
··· 23 23 #include <linux/init.h> 24 24 #include <linux/errno.h> 25 25 #include <linux/netdevice.h> 26 - #include <linux/etherdevice.h> 27 26 #include <linux/slab.h> 28 27 #include <linux/rtnetlink.h> 29 28 #include <linux/interrupt.h> ··· 204 205 .ndo_start_xmit = au1k_irda_hard_xmit, 205 206 .ndo_tx_timeout = au1k_tx_timeout, 206 207 .ndo_do_ioctl = au1k_irda_ioctl, 207 - .ndo_change_mtu = eth_change_mtu, 208 - .ndo_validate_addr = eth_validate_addr, 209 - .ndo_set_mac_address = eth_mac_addr, 210 208 }; 211 209 212 210 static int au1k_irda_net_init(struct net_device *dev)
+1 -3
drivers/net/irda/pxaficp_ir.c
··· 803 803 .ndo_stop = pxa_irda_stop, 804 804 .ndo_start_xmit = pxa_irda_hard_xmit, 805 805 .ndo_do_ioctl = pxa_irda_ioctl, 806 - .ndo_change_mtu = eth_change_mtu, 807 - .ndo_validate_addr = eth_validate_addr, 808 - .ndo_set_mac_address = eth_mac_addr, 809 806 }; 810 807 811 808 static int pxa_irda_probe(struct platform_device *pdev) ··· 827 830 if (!dev) 828 831 goto err_mem_3; 829 832 833 + SET_NETDEV_DEV(dev, &pdev->dev); 830 834 si = netdev_priv(dev); 831 835 si->dev = &pdev->dev; 832 836 si->pdata = pdev->dev.platform_data;
-4
drivers/net/irda/sa1100_ir.c
··· 24 24 #include <linux/init.h> 25 25 #include <linux/errno.h> 26 26 #include <linux/netdevice.h> 27 - #include <linux/etherdevice.h> 28 27 #include <linux/slab.h> 29 28 #include <linux/rtnetlink.h> 30 29 #include <linux/interrupt.h> ··· 880 881 .ndo_stop = sa1100_irda_stop, 881 882 .ndo_start_xmit = sa1100_irda_hard_xmit, 882 883 .ndo_do_ioctl = sa1100_irda_ioctl, 883 - .ndo_change_mtu = eth_change_mtu, 884 - .ndo_validate_addr = eth_validate_addr, 885 - .ndo_set_mac_address = eth_mac_addr, 886 884 }; 887 885 888 886 static int sa1100_irda_probe(struct platform_device *pdev)
+3 -2
drivers/net/ixp2000/ixpdev.c
··· 41 41 struct ixpdev_priv *ip = netdev_priv(dev); 42 42 struct ixpdev_tx_desc *desc; 43 43 int entry; 44 + unsigned long flags; 44 45 45 46 if (unlikely(skb->len > PAGE_SIZE)) { 46 47 /* @@@ Count drops. */ ··· 64 63 65 64 dev->trans_start = jiffies; 66 65 67 - local_irq_disable(); 66 + local_irq_save(flags); 68 67 ip->tx_queue_entries++; 69 68 if (ip->tx_queue_entries == TX_BUF_COUNT_PER_CHAN) 70 69 netif_stop_queue(dev); 71 - local_irq_enable(); 70 + local_irq_restore(flags); 72 71 73 72 return NETDEV_TX_OK; 74 73 }
+4 -3
drivers/net/macb.c
··· 620 620 dma_addr_t mapping; 621 621 unsigned int len, entry; 622 622 u32 ctrl; 623 + unsigned long flags; 623 624 624 625 #ifdef DEBUG 625 626 int i; ··· 636 635 #endif 637 636 638 637 len = skb->len; 639 - spin_lock_irq(&bp->lock); 638 + spin_lock_irqsave(&bp->lock, flags); 640 639 641 640 /* This is a hard error, log it. */ 642 641 if (TX_BUFFS_AVAIL(bp) < 1) { 643 642 netif_stop_queue(dev); 644 - spin_unlock_irq(&bp->lock); 643 + spin_unlock_irqrestore(&bp->lock, flags); 645 644 dev_err(&bp->pdev->dev, 646 645 "BUG! Tx Ring full when queue awake!\n"); 647 646 dev_dbg(&bp->pdev->dev, "tx_head = %u, tx_tail = %u\n", ··· 675 674 if (TX_BUFFS_AVAIL(bp) < 1) 676 675 netif_stop_queue(dev); 677 676 678 - spin_unlock_irq(&bp->lock); 677 + spin_unlock_irqrestore(&bp->lock, flags); 679 678 680 679 dev->trans_start = jiffies; 681 680
+3 -2
drivers/net/mlx4/en_tx.c
··· 437 437 { 438 438 struct mlx4_en_cq *cq = &priv->tx_cq[tx_ind]; 439 439 struct mlx4_en_tx_ring *ring = &priv->tx_ring[tx_ind]; 440 + unsigned long flags; 440 441 441 442 /* If we don't have a pending timer, set one up to catch our recent 442 443 post in case the interface becomes idle */ ··· 446 445 447 446 /* Poll the CQ every mlx4_en_TX_MODER_POLL packets */ 448 447 if ((++ring->poll_cnt & (MLX4_EN_TX_POLL_MODER - 1)) == 0) 449 - if (spin_trylock_irq(&ring->comp_lock)) { 448 + if (spin_trylock_irqsave(&ring->comp_lock, flags)) { 450 449 mlx4_en_process_tx_cq(priv->dev, cq); 451 - spin_unlock_irq(&ring->comp_lock); 450 + spin_unlock_irqrestore(&ring->comp_lock, flags); 452 451 } 453 452 } 454 453
+22 -18
drivers/net/smc91x.c
··· 196 196 /* this enables an interrupt in the interrupt mask register */ 197 197 #define SMC_ENABLE_INT(lp, x) do { \ 198 198 unsigned char mask; \ 199 - spin_lock_irq(&lp->lock); \ 199 + unsigned long smc_enable_flags; \ 200 + spin_lock_irqsave(&lp->lock, smc_enable_flags); \ 200 201 mask = SMC_GET_INT_MASK(lp); \ 201 202 mask |= (x); \ 202 203 SMC_SET_INT_MASK(lp, mask); \ 203 - spin_unlock_irq(&lp->lock); \ 204 + spin_unlock_irqrestore(&lp->lock, smc_enable_flags); \ 204 205 } while (0) 205 206 206 207 /* this disables an interrupt from the interrupt mask register */ 207 208 #define SMC_DISABLE_INT(lp, x) do { \ 208 209 unsigned char mask; \ 209 - spin_lock_irq(&lp->lock); \ 210 + unsigned long smc_disable_flags; \ 211 + spin_lock_irqsave(&lp->lock, smc_disable_flags); \ 210 212 mask = SMC_GET_INT_MASK(lp); \ 211 213 mask &= ~(x); \ 212 214 SMC_SET_INT_MASK(lp, mask); \ 213 - spin_unlock_irq(&lp->lock); \ 215 + spin_unlock_irqrestore(&lp->lock, smc_disable_flags); \ 214 216 } while (0) 215 217 216 218 /* ··· 522 520 * any other concurrent access and C would always interrupt B. But life 523 521 * isn't that easy in a SMP world... 524 522 */ 525 - #define smc_special_trylock(lock) \ 523 + #define smc_special_trylock(lock, flags) \ 526 524 ({ \ 527 525 int __ret; \ 528 - local_irq_disable(); \ 526 + local_irq_save(flags); \ 529 527 __ret = spin_trylock(lock); \ 530 528 if (!__ret) \ 531 - local_irq_enable(); \ 529 + local_irq_restore(flags); \ 532 530 __ret; \ 533 531 }) 534 - #define smc_special_lock(lock) spin_lock_irq(lock) 535 - #define smc_special_unlock(lock) spin_unlock_irq(lock) 532 + #define smc_special_lock(lock, flags) spin_lock_irqsave(lock, flags) 533 + #define smc_special_unlock(lock, flags) spin_unlock_irqrestore(lock, flags) 536 534 #else 537 - #define smc_special_trylock(lock) (1) 538 - #define smc_special_lock(lock) do { } while (0) 539 - #define smc_special_unlock(lock) do { } while (0) 535 + #define smc_special_trylock(lock, flags) (1) 536 + #define smc_special_lock(lock, flags) do { } while (0) 537 + #define smc_special_unlock(lock, flags) do { } while (0) 540 538 #endif 541 539 542 540 /* ··· 550 548 struct sk_buff *skb; 551 549 unsigned int packet_no, len; 552 550 unsigned char *buf; 551 + unsigned long flags; 553 552 554 553 DBG(3, "%s: %s\n", dev->name, __func__); 555 554 556 - if (!smc_special_trylock(&lp->lock)) { 555 + if (!smc_special_trylock(&lp->lock, flags)) { 557 556 netif_stop_queue(dev); 558 557 tasklet_schedule(&lp->tx_task); 559 558 return; ··· 562 559 563 560 skb = lp->pending_tx_skb; 564 561 if (unlikely(!skb)) { 565 - smc_special_unlock(&lp->lock); 562 + smc_special_unlock(&lp->lock, flags); 566 563 return; 567 564 } 568 565 lp->pending_tx_skb = NULL; ··· 572 569 printk("%s: Memory allocation failed.\n", dev->name); 573 570 dev->stats.tx_errors++; 574 571 dev->stats.tx_fifo_errors++; 575 - smc_special_unlock(&lp->lock); 572 + smc_special_unlock(&lp->lock, flags); 576 573 goto done; 577 574 } 578 575 ··· 611 608 612 609 /* queue the packet for TX */ 613 610 SMC_SET_MMU_CMD(lp, MC_ENQUEUE); 614 - smc_special_unlock(&lp->lock); 611 + smc_special_unlock(&lp->lock, flags); 615 612 616 613 dev->trans_start = jiffies; 617 614 dev->stats.tx_packets++; ··· 636 633 struct smc_local *lp = netdev_priv(dev); 637 634 void __iomem *ioaddr = lp->base; 638 635 unsigned int numPages, poll_count, status; 636 + unsigned long flags; 639 637 640 638 DBG(3, "%s: %s\n", dev->name, __func__); 641 639 ··· 662 658 return NETDEV_TX_OK; 663 659 } 664 660 665 - smc_special_lock(&lp->lock); 661 + smc_special_lock(&lp->lock, flags); 666 662 667 663 /* now, try to allocate the memory */ 668 664 SMC_SET_MMU_CMD(lp, MC_ALLOC | numPages); ··· 680 676 } 681 677 } while (--poll_count); 682 678 683 - smc_special_unlock(&lp->lock); 679 + smc_special_unlock(&lp->lock, flags); 684 680 685 681 lp->pending_tx_skb = skb; 686 682 if (!poll_count) {
+3 -2
drivers/net/tulip/tulip_core.c
··· 653 653 int entry; 654 654 u32 flag; 655 655 dma_addr_t mapping; 656 + unsigned long flags; 656 657 657 - spin_lock_irq(&tp->lock); 658 + spin_lock_irqsave(&tp->lock, flags); 658 659 659 660 /* Calculate the next Tx descriptor entry. */ 660 661 entry = tp->cur_tx % TX_RING_SIZE; ··· 690 689 /* Trigger an immediate transmit demand. */ 691 690 iowrite32(0, tp->base_addr + CSR1); 692 691 693 - spin_unlock_irq(&tp->lock); 692 + spin_unlock_irqrestore(&tp->lock, flags); 694 693 695 694 dev->trans_start = jiffies; 696 695
+3 -2
drivers/net/ucc_geth.c
··· 3084 3084 u8 __iomem *bd; /* BD pointer */ 3085 3085 u32 bd_status; 3086 3086 u8 txQ = 0; 3087 + unsigned long flags; 3087 3088 3088 3089 ugeth_vdbg("%s: IN", __func__); 3089 3090 3090 - spin_lock_irq(&ugeth->lock); 3091 + spin_lock_irqsave(&ugeth->lock, flags); 3091 3092 3092 3093 dev->stats.tx_bytes += skb->len; 3093 3094 ··· 3145 3144 uccf = ugeth->uccf; 3146 3145 out_be16(uccf->p_utodr, UCC_FAST_TOD); 3147 3146 #endif 3148 - spin_unlock_irq(&ugeth->lock); 3147 + spin_unlock_irqrestore(&ugeth->lock, flags); 3149 3148 3150 3149 return NETDEV_TX_OK; 3151 3150 }
+2
drivers/net/usb/pegasus.h
··· 250 250 DEFAULT_GPIO_RESET ) 251 251 PEGASUS_DEV( "IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913, 252 252 DEFAULT_GPIO_RESET | PEGASUS_II ) 253 + PEGASUS_DEV( "IO DATA USB ETX-US2", VENDOR_IODATA, 0x092a, 254 + DEFAULT_GPIO_RESET | PEGASUS_II ) 253 255 PEGASUS_DEV( "Kingston KNU101TX Ethernet", VENDOR_KINGSTON, 0x000a, 254 256 DEFAULT_GPIO_RESET) 255 257 PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x4002,
+3 -2
drivers/net/via-rhine.c
··· 1220 1220 struct rhine_private *rp = netdev_priv(dev); 1221 1221 void __iomem *ioaddr = rp->base; 1222 1222 unsigned entry; 1223 + unsigned long flags; 1223 1224 1224 1225 /* Caution: the write order is important here, set the field 1225 1226 with the "ownership" bits last. */ ··· 1264 1263 cpu_to_le32(TXDESC | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN)); 1265 1264 1266 1265 /* lock eth irq */ 1267 - spin_lock_irq(&rp->lock); 1266 + spin_lock_irqsave(&rp->lock, flags); 1268 1267 wmb(); 1269 1268 rp->tx_ring[entry].tx_status = cpu_to_le32(DescOwn); 1270 1269 wmb(); ··· 1283 1282 1284 1283 dev->trans_start = jiffies; 1285 1284 1286 - spin_unlock_irq(&rp->lock); 1285 + spin_unlock_irqrestore(&rp->lock, flags); 1287 1286 1288 1287 if (debug > 4) { 1289 1288 printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n",
+1 -1
drivers/net/via-velocity.c
··· 1789 1789 * mode 1790 1790 */ 1791 1791 if (vptr->rev_id < REV_ID_VT3216_A0) { 1792 - if (vptr->mii_status | VELOCITY_DUPLEX_FULL) 1792 + if (vptr->mii_status & VELOCITY_DUPLEX_FULL) 1793 1793 BYTE_REG_BITS_ON(TCR_TB2BDIS, &regs->TCR); 1794 1794 else 1795 1795 BYTE_REG_BITS_OFF(TCR_TB2BDIS, &regs->TCR);
+46 -15
drivers/net/virtio_net.c
··· 70 70 struct sk_buff_head recv; 71 71 struct sk_buff_head send; 72 72 73 + /* Work struct for refilling if we run low on memory. */ 74 + struct delayed_work refill; 75 + 73 76 /* Chain pages by the private ptr. */ 74 77 struct page *pages; 75 78 }; ··· 276 273 dev_kfree_skb(skb); 277 274 } 278 275 279 - static void try_fill_recv_maxbufs(struct virtnet_info *vi) 276 + static bool try_fill_recv_maxbufs(struct virtnet_info *vi, gfp_t gfp) 280 277 { 281 278 struct sk_buff *skb; 282 279 struct scatterlist sg[2+MAX_SKB_FRAGS]; 283 280 int num, err, i; 281 + bool oom = false; 284 282 285 283 sg_init_table(sg, 2+MAX_SKB_FRAGS); 286 284 for (;;) { 287 285 struct virtio_net_hdr *hdr; 288 286 289 287 skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN + NET_IP_ALIGN); 290 - if (unlikely(!skb)) 288 + if (unlikely(!skb)) { 289 + oom = true; 291 290 break; 291 + } 292 292 293 293 skb_reserve(skb, NET_IP_ALIGN); 294 294 skb_put(skb, MAX_PACKET_LEN); ··· 302 296 if (vi->big_packets) { 303 297 for (i = 0; i < MAX_SKB_FRAGS; i++) { 304 298 skb_frag_t *f = &skb_shinfo(skb)->frags[i]; 305 - f->page = get_a_page(vi, GFP_ATOMIC); 299 + f->page = get_a_page(vi, gfp); 306 300 if (!f->page) 307 301 break; 308 302 ··· 331 325 if (unlikely(vi->num > vi->max)) 332 326 vi->max = vi->num; 333 327 vi->rvq->vq_ops->kick(vi->rvq); 328 + return !oom; 334 329 } 335 330 336 - static void try_fill_recv(struct virtnet_info *vi) 331 + /* Returns false if we couldn't fill entirely (OOM). */ 332 + static bool try_fill_recv(struct virtnet_info *vi, gfp_t gfp) 337 333 { 338 334 struct sk_buff *skb; 339 335 struct scatterlist sg[1]; 340 336 int err; 337 + bool oom = false; 341 338 342 - if (!vi->mergeable_rx_bufs) { 343 - try_fill_recv_maxbufs(vi); 344 - return; 345 - } 339 + if (!vi->mergeable_rx_bufs) 340 + return try_fill_recv_maxbufs(vi, gfp); 346 341 347 342 for (;;) { 348 343 skb_frag_t *f; 349 344 350 345 skb = netdev_alloc_skb(vi->dev, GOOD_COPY_LEN + NET_IP_ALIGN); 351 - if (unlikely(!skb)) 346 + if (unlikely(!skb)) { 347 + oom = true; 352 348 break; 349 + } 353 350 354 351 skb_reserve(skb, NET_IP_ALIGN); 355 352 356 353 f = &skb_shinfo(skb)->frags[0]; 357 - f->page = get_a_page(vi, GFP_ATOMIC); 354 + f->page = get_a_page(vi, gfp); 358 355 if (!f->page) { 356 + oom = true; 359 357 kfree_skb(skb); 360 358 break; 361 359 } ··· 383 373 if (unlikely(vi->num > vi->max)) 384 374 vi->max = vi->num; 385 375 vi->rvq->vq_ops->kick(vi->rvq); 376 + return !oom; 386 377 } 387 378 388 379 static void skb_recv_done(struct virtqueue *rvq) ··· 394 383 rvq->vq_ops->disable_cb(rvq); 395 384 __napi_schedule(&vi->napi); 396 385 } 386 + } 387 + 388 + static void refill_work(struct work_struct *work) 389 + { 390 + struct virtnet_info *vi; 391 + bool still_empty; 392 + 393 + vi = container_of(work, struct virtnet_info, refill.work); 394 + napi_disable(&vi->napi); 395 + try_fill_recv(vi, GFP_KERNEL); 396 + still_empty = (vi->num == 0); 397 + napi_enable(&vi->napi); 398 + 399 + /* In theory, this can happen: if we don't get any buffers in 400 + * we will *never* try to fill again. */ 401 + if (still_empty) 402 + schedule_delayed_work(&vi->refill, HZ/2); 397 403 } 398 404 399 405 static int virtnet_poll(struct napi_struct *napi, int budget) ··· 428 400 received++; 429 401 } 430 402 431 - /* FIXME: If we oom and completely run out of inbufs, we need 432 - * to start a timer trying to fill more. */ 433 - if (vi->num < vi->max / 2) 434 - try_fill_recv(vi); 403 + if (vi->num < vi->max / 2) { 404 + if (!try_fill_recv(vi, GFP_ATOMIC)) 405 + schedule_delayed_work(&vi->refill, 0); 406 + } 435 407 436 408 /* Out of packets? */ 437 409 if (received < budget) { ··· 922 894 vi->vdev = vdev; 923 895 vdev->priv = vi; 924 896 vi->pages = NULL; 897 + INIT_DELAYED_WORK(&vi->refill, refill_work); 925 898 926 899 /* If they give us a callback when all buffers are done, we don't need 927 900 * the timer. */ ··· 971 942 } 972 943 973 944 /* Last of all, set up some receive buffers. */ 974 - try_fill_recv(vi); 945 + try_fill_recv(vi, GFP_KERNEL); 975 946 976 947 /* If we didn't even get one input buffer, we're useless. */ 977 948 if (vi->num == 0) { ··· 988 959 989 960 unregister: 990 961 unregister_netdev(dev); 962 + cancel_delayed_work_sync(&vi->refill); 991 963 free_vqs: 992 964 vdev->config->del_vqs(vdev); 993 965 free: ··· 1017 987 BUG_ON(vi->num != 0); 1018 988 1019 989 unregister_netdev(vi->dev); 990 + cancel_delayed_work_sync(&vi->refill); 1020 991 1021 992 vdev->config->del_vqs(vi->vdev); 1022 993
+67 -53
drivers/net/wireless/ipw2x00/ipw2200.c
··· 2893 2893 return 0; 2894 2894 } 2895 2895 2896 - static int ipw_fw_dma_add_buffer(struct ipw_priv *priv, 2897 - u32 src_phys, u32 dest_address, u32 length) 2896 + static int ipw_fw_dma_add_buffer(struct ipw_priv *priv, dma_addr_t *src_address, 2897 + int nr, u32 dest_address, u32 len) 2898 2898 { 2899 - u32 bytes_left = length; 2900 - u32 src_offset = 0; 2901 - u32 dest_offset = 0; 2902 - int status = 0; 2899 + int ret, i; 2900 + u32 size; 2901 + 2903 2902 IPW_DEBUG_FW(">> \n"); 2904 - IPW_DEBUG_FW_INFO("src_phys=0x%x dest_address=0x%x length=0x%x\n", 2905 - src_phys, dest_address, length); 2906 - while (bytes_left > CB_MAX_LENGTH) { 2907 - status = ipw_fw_dma_add_command_block(priv, 2908 - src_phys + src_offset, 2909 - dest_address + 2910 - dest_offset, 2911 - CB_MAX_LENGTH, 0, 0); 2912 - if (status) { 2903 + IPW_DEBUG_FW_INFO("nr=%d dest_address=0x%x len=0x%x\n", 2904 + nr, dest_address, len); 2905 + 2906 + for (i = 0; i < nr; i++) { 2907 + size = min_t(u32, len - i * CB_MAX_LENGTH, CB_MAX_LENGTH); 2908 + ret = ipw_fw_dma_add_command_block(priv, src_address[i], 2909 + dest_address + 2910 + i * CB_MAX_LENGTH, size, 2911 + 0, 0); 2912 + if (ret) { 2913 2913 IPW_DEBUG_FW_INFO(": Failed\n"); 2914 2914 return -1; 2915 2915 } else 2916 2916 IPW_DEBUG_FW_INFO(": Added new cb\n"); 2917 - 2918 - src_offset += CB_MAX_LENGTH; 2919 - dest_offset += CB_MAX_LENGTH; 2920 - bytes_left -= CB_MAX_LENGTH; 2921 - } 2922 - 2923 - /* add the buffer tail */ 2924 - if (bytes_left > 0) { 2925 - status = 2926 - ipw_fw_dma_add_command_block(priv, src_phys + src_offset, 2927 - dest_address + dest_offset, 2928 - bytes_left, 0, 0); 2929 - if (status) { 2930 - IPW_DEBUG_FW_INFO(": Failed on the buffer tail\n"); 2931 - return -1; 2932 - } else 2933 - IPW_DEBUG_FW_INFO 2934 - (": Adding new cb - the buffer tail\n"); 2935 2917 } 2936 2918 2937 2919 IPW_DEBUG_FW("<< \n"); ··· 3161 3179 3162 3180 static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len) 3163 3181 { 3164 - int rc = -1; 3182 + int ret = -1; 3165 3183 int offset = 0; 3166 3184 struct fw_chunk *chunk; 3167 - dma_addr_t shared_phys; 3168 - u8 *shared_virt; 3185 + int total_nr = 0; 3186 + int i; 3187 + struct pci_pool *pool; 3188 + u32 *virts[CB_NUMBER_OF_ELEMENTS_SMALL]; 3189 + dma_addr_t phys[CB_NUMBER_OF_ELEMENTS_SMALL]; 3169 3190 3170 3191 IPW_DEBUG_TRACE("<< : \n"); 3171 - shared_virt = pci_alloc_consistent(priv->pci_dev, len, &shared_phys); 3172 3192 3173 - if (!shared_virt) 3193 + pool = pci_pool_create("ipw2200", priv->pci_dev, CB_MAX_LENGTH, 0, 0); 3194 + if (!pool) { 3195 + IPW_ERROR("pci_pool_create failed\n"); 3174 3196 return -ENOMEM; 3175 - 3176 - memmove(shared_virt, data, len); 3197 + } 3177 3198 3178 3199 /* Start the Dma */ 3179 - rc = ipw_fw_dma_enable(priv); 3200 + ret = ipw_fw_dma_enable(priv); 3180 3201 3181 3202 /* the DMA is already ready this would be a bug. */ 3182 3203 BUG_ON(priv->sram_desc.last_cb_index > 0); 3183 3204 3184 3205 do { 3206 + u32 chunk_len; 3207 + u8 *start; 3208 + int size; 3209 + int nr = 0; 3210 + 3185 3211 chunk = (struct fw_chunk *)(data + offset); 3186 3212 offset += sizeof(struct fw_chunk); 3213 + chunk_len = le32_to_cpu(chunk->length); 3214 + start = data + offset; 3215 + 3216 + nr = (chunk_len + CB_MAX_LENGTH - 1) / CB_MAX_LENGTH; 3217 + for (i = 0; i < nr; i++) { 3218 + virts[total_nr] = pci_pool_alloc(pool, GFP_KERNEL, 3219 + &phys[total_nr]); 3220 + if (!virts[total_nr]) { 3221 + ret = -ENOMEM; 3222 + goto out; 3223 + } 3224 + size = min_t(u32, chunk_len - i * CB_MAX_LENGTH, 3225 + CB_MAX_LENGTH); 3226 + memcpy(virts[total_nr], start, size); 3227 + start += size; 3228 + total_nr++; 3229 + /* We don't support fw chunk larger than 64*8K */ 3230 + BUG_ON(total_nr > CB_NUMBER_OF_ELEMENTS_SMALL); 3231 + } 3232 + 3187 3233 /* build DMA packet and queue up for sending */ 3188 3234 /* dma to chunk->address, the chunk->length bytes from data + 3189 3235 * offeset*/ 3190 3236 /* Dma loading */ 3191 - rc = ipw_fw_dma_add_buffer(priv, shared_phys + offset, 3192 - le32_to_cpu(chunk->address), 3193 - le32_to_cpu(chunk->length)); 3194 - if (rc) { 3237 + ret = ipw_fw_dma_add_buffer(priv, &phys[total_nr - nr], 3238 + nr, le32_to_cpu(chunk->address), 3239 + chunk_len); 3240 + if (ret) { 3195 3241 IPW_DEBUG_INFO("dmaAddBuffer Failed\n"); 3196 3242 goto out; 3197 3243 } 3198 3244 3199 - offset += le32_to_cpu(chunk->length); 3245 + offset += chunk_len; 3200 3246 } while (offset < len); 3201 3247 3202 3248 /* Run the DMA and wait for the answer */ 3203 - rc = ipw_fw_dma_kick(priv); 3204 - if (rc) { 3249 + ret = ipw_fw_dma_kick(priv); 3250 + if (ret) { 3205 3251 IPW_ERROR("dmaKick Failed\n"); 3206 3252 goto out; 3207 3253 } 3208 3254 3209 - rc = ipw_fw_dma_wait(priv); 3210 - if (rc) { 3255 + ret = ipw_fw_dma_wait(priv); 3256 + if (ret) { 3211 3257 IPW_ERROR("dmaWaitSync Failed\n"); 3212 3258 goto out; 3213 3259 } 3214 - out: 3215 - pci_free_consistent(priv->pci_dev, len, shared_virt, shared_phys); 3216 - return rc; 3260 + out: 3261 + for (i = 0; i < total_nr; i++) 3262 + pci_pool_free(pool, virts[i], phys[i]); 3263 + 3264 + pci_pool_destroy(pool); 3265 + 3266 + return ret; 3217 3267 } 3218 3268 3219 3269 /* stop nic */
+1 -1
drivers/net/wireless/orinoco/hw.c
··· 644 644 int err = 0; 645 645 u8 tsc_arr[4][ORINOCO_SEQ_LEN]; 646 646 647 - if ((key < 0) || (key > 4)) 647 + if ((key < 0) || (key >= 4)) 648 648 return -EINVAL; 649 649 650 650 err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_TKIP_IV,
+10 -4
drivers/net/wireless/rtl818x/rtl8187_dev.c
··· 871 871 priv->aifsn[3] = 3; /* AIFSN[AC_BE] */ 872 872 rtl818x_iowrite8(priv, &priv->map->ACM_CONTROL, 0); 873 873 874 + /* ENEDCA flag must always be set, transmit issues? */ 875 + rtl818x_iowrite8(priv, &priv->map->MSR, RTL818X_MSR_ENEDCA); 876 + 874 877 return 0; 875 878 } 876 879 ··· 1179 1176 rtl818x_iowrite8(priv, &priv->map->BSSID[i], 1180 1177 info->bssid[i]); 1181 1178 1179 + if (priv->is_rtl8187b) 1180 + reg = RTL818X_MSR_ENEDCA; 1181 + else 1182 + reg = 0; 1183 + 1182 1184 if (is_valid_ether_addr(info->bssid)) { 1183 - reg = RTL818X_MSR_INFRA; 1184 - if (priv->is_rtl8187b) 1185 - reg |= RTL818X_MSR_ENEDCA; 1185 + reg |= RTL818X_MSR_INFRA; 1186 1186 rtl818x_iowrite8(priv, &priv->map->MSR, reg); 1187 1187 } else { 1188 - reg = RTL818X_MSR_NO_LINK; 1188 + reg |= RTL818X_MSR_NO_LINK; 1189 1189 rtl818x_iowrite8(priv, &priv->map->MSR, reg); 1190 1190 } 1191 1191
+18 -10
drivers/net/yellowfin.c
··· 346 346 static int yellowfin_open(struct net_device *dev); 347 347 static void yellowfin_timer(unsigned long data); 348 348 static void yellowfin_tx_timeout(struct net_device *dev); 349 - static void yellowfin_init_ring(struct net_device *dev); 349 + static int yellowfin_init_ring(struct net_device *dev); 350 350 static netdev_tx_t yellowfin_start_xmit(struct sk_buff *skb, 351 351 struct net_device *dev); 352 352 static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance); ··· 574 574 { 575 575 struct yellowfin_private *yp = netdev_priv(dev); 576 576 void __iomem *ioaddr = yp->base; 577 - int i; 577 + int i, ret; 578 578 579 579 /* Reset the chip. */ 580 580 iowrite32(0x80000000, ioaddr + DMACtrl); 581 581 582 - i = request_irq(dev->irq, &yellowfin_interrupt, IRQF_SHARED, dev->name, dev); 583 - if (i) return i; 582 + ret = request_irq(dev->irq, &yellowfin_interrupt, IRQF_SHARED, dev->name, dev); 583 + if (ret) 584 + return ret; 584 585 585 586 if (yellowfin_debug > 1) 586 587 printk(KERN_DEBUG "%s: yellowfin_open() irq %d.\n", 587 588 dev->name, dev->irq); 588 589 589 - yellowfin_init_ring(dev); 590 + ret = yellowfin_init_ring(dev); 591 + if (ret) { 592 + free_irq(dev->irq, dev); 593 + return ret; 594 + } 590 595 591 596 iowrite32(yp->rx_ring_dma, ioaddr + RxPtr); 592 597 iowrite32(yp->tx_ring_dma, ioaddr + TxPtr); ··· 731 726 } 732 727 733 728 /* Initialize the Rx and Tx rings, along with various 'dev' bits. */ 734 - static void yellowfin_init_ring(struct net_device *dev) 729 + static int yellowfin_init_ring(struct net_device *dev) 735 730 { 736 731 struct yellowfin_private *yp = netdev_priv(dev); 737 - int i; 732 + int i, j; 738 733 739 734 yp->tx_full = 0; 740 735 yp->cur_rx = yp->cur_tx = 0; ··· 759 754 yp->rx_ring[i].addr = cpu_to_le32(pci_map_single(yp->pci_dev, 760 755 skb->data, yp->rx_buf_sz, PCI_DMA_FROMDEVICE)); 761 756 } 757 + if (i != RX_RING_SIZE) { 758 + for (j = 0; j < i; j++) 759 + dev_kfree_skb(yp->rx_skbuff[j]); 760 + return -ENOMEM; 761 + } 762 762 yp->rx_ring[i-1].dbdma_cmd = cpu_to_le32(CMD_STOP); 763 763 yp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); 764 764 ··· 780 770 yp->tx_ring[--i].dbdma_cmd = cpu_to_le32(CMD_STOP | BRANCH_ALWAYS); 781 771 #else 782 772 { 783 - int j; 784 - 785 773 /* Tx ring needs a pair of descriptors, the second for the status. */ 786 774 for (i = 0; i < TX_RING_SIZE; i++) { 787 775 j = 2*i; ··· 814 806 } 815 807 #endif 816 808 yp->tx_tail_desc = &yp->tx_status[0]; 817 - return; 809 + return 0; 818 810 } 819 811 820 812 static netdev_tx_t yellowfin_start_xmit(struct sk_buff *skb,
+5
include/linux/gen_stats.h
··· 22 22 { 23 23 __u64 bytes; 24 24 __u32 packets; 25 + }; 26 + struct gnet_stats_basic_packed 27 + { 28 + __u64 bytes; 29 + __u32 packets; 25 30 } __attribute__ ((packed)); 26 31 27 32 /**
+1 -1
include/net/act_api.h
··· 16 16 u32 tcfc_capab; 17 17 int tcfc_action; 18 18 struct tcf_t tcfc_tm; 19 - struct gnet_stats_basic tcfc_bstats; 19 + struct gnet_stats_basic_packed tcfc_bstats; 20 20 struct gnet_stats_queue tcfc_qstats; 21 21 struct gnet_stats_rate_est tcfc_rate_est; 22 22 spinlock_t tcfc_lock;
+5 -5
include/net/gen_stats.h
··· 28 28 spinlock_t *lock, struct gnet_dump *d); 29 29 30 30 extern int gnet_stats_copy_basic(struct gnet_dump *d, 31 - struct gnet_stats_basic *b); 31 + struct gnet_stats_basic_packed *b); 32 32 extern int gnet_stats_copy_rate_est(struct gnet_dump *d, 33 33 struct gnet_stats_rate_est *r); 34 34 extern int gnet_stats_copy_queue(struct gnet_dump *d, ··· 37 37 38 38 extern int gnet_stats_finish_copy(struct gnet_dump *d); 39 39 40 - extern int gen_new_estimator(struct gnet_stats_basic *bstats, 40 + extern int gen_new_estimator(struct gnet_stats_basic_packed *bstats, 41 41 struct gnet_stats_rate_est *rate_est, 42 42 spinlock_t *stats_lock, struct nlattr *opt); 43 - extern void gen_kill_estimator(struct gnet_stats_basic *bstats, 43 + extern void gen_kill_estimator(struct gnet_stats_basic_packed *bstats, 44 44 struct gnet_stats_rate_est *rate_est); 45 - extern int gen_replace_estimator(struct gnet_stats_basic *bstats, 45 + extern int gen_replace_estimator(struct gnet_stats_basic_packed *bstats, 46 46 struct gnet_stats_rate_est *rate_est, 47 47 spinlock_t *stats_lock, struct nlattr *opt); 48 - extern bool gen_estimator_active(const struct gnet_stats_basic *bstats, 48 + extern bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats, 49 49 const struct gnet_stats_rate_est *rate_est); 50 50 #endif
+1 -1
include/net/netfilter/xt_rateest.h
··· 8 8 spinlock_t lock; 9 9 struct gnet_estimator params; 10 10 struct gnet_stats_rate_est rstats; 11 - struct gnet_stats_basic bstats; 11 + struct gnet_stats_basic_packed bstats; 12 12 }; 13 13 14 14 extern struct xt_rateest *xt_rateest_lookup(const char *name);
+1 -1
include/net/sch_generic.h
··· 73 73 */ 74 74 unsigned long state; 75 75 struct sk_buff_head q; 76 - struct gnet_stats_basic bstats; 76 + struct gnet_stats_basic_packed bstats; 77 77 struct gnet_stats_queue qstats; 78 78 }; 79 79
+6 -6
net/core/gen_estimator.c
··· 81 81 struct gen_estimator 82 82 { 83 83 struct list_head list; 84 - struct gnet_stats_basic *bstats; 84 + struct gnet_stats_basic_packed *bstats; 85 85 struct gnet_stats_rate_est *rate_est; 86 86 spinlock_t *stats_lock; 87 87 int ewma_log; ··· 165 165 } 166 166 167 167 static 168 - struct gen_estimator *gen_find_node(const struct gnet_stats_basic *bstats, 168 + struct gen_estimator *gen_find_node(const struct gnet_stats_basic_packed *bstats, 169 169 const struct gnet_stats_rate_est *rate_est) 170 170 { 171 171 struct rb_node *p = est_root.rb_node; ··· 202 202 * 203 203 * NOTE: Called under rtnl_mutex 204 204 */ 205 - int gen_new_estimator(struct gnet_stats_basic *bstats, 205 + int gen_new_estimator(struct gnet_stats_basic_packed *bstats, 206 206 struct gnet_stats_rate_est *rate_est, 207 207 spinlock_t *stats_lock, 208 208 struct nlattr *opt) ··· 262 262 * 263 263 * NOTE: Called under rtnl_mutex 264 264 */ 265 - void gen_kill_estimator(struct gnet_stats_basic *bstats, 265 + void gen_kill_estimator(struct gnet_stats_basic_packed *bstats, 266 266 struct gnet_stats_rate_est *rate_est) 267 267 { 268 268 struct gen_estimator *e; ··· 292 292 * 293 293 * Returns 0 on success or a negative error code. 294 294 */ 295 - int gen_replace_estimator(struct gnet_stats_basic *bstats, 295 + int gen_replace_estimator(struct gnet_stats_basic_packed *bstats, 296 296 struct gnet_stats_rate_est *rate_est, 297 297 spinlock_t *stats_lock, struct nlattr *opt) 298 298 { ··· 308 308 * 309 309 * Returns true if estimator is active, and false if not. 310 310 */ 311 - bool gen_estimator_active(const struct gnet_stats_basic *bstats, 311 + bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats, 312 312 const struct gnet_stats_rate_est *rate_est) 313 313 { 314 314 ASSERT_RTNL();
+8 -3
net/core/gen_stats.c
··· 106 106 * if the room in the socket buffer was not sufficient. 107 107 */ 108 108 int 109 - gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic *b) 109 + gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic_packed *b) 110 110 { 111 111 if (d->compat_tc_stats) { 112 112 d->tc_stats.bytes = b->bytes; 113 113 d->tc_stats.packets = b->packets; 114 114 } 115 115 116 - if (d->tail) 117 - return gnet_stats_copy(d, TCA_STATS_BASIC, b, sizeof(*b)); 116 + if (d->tail) { 117 + struct gnet_stats_basic sb; 118 118 119 + memset(&sb, 0, sizeof(sb)); 120 + sb.bytes = b->bytes; 121 + sb.packets = b->packets; 122 + return gnet_stats_copy(d, TCA_STATS_BASIC, &sb, sizeof(sb)); 123 + } 119 124 return 0; 120 125 } 121 126
+5
net/core/netpoll.c
··· 323 323 324 324 udelay(USEC_PER_POLL); 325 325 } 326 + 327 + WARN_ONCE(!irqs_disabled(), 328 + "netpoll_send_skb(): %s enabled interrupts in poll (%pF)\n", 329 + dev->name, ops->ndo_start_xmit); 330 + 326 331 local_irq_restore(flags); 327 332 } 328 333
+1 -1
net/core/sock.c
··· 1035 1035 sk->sk_prot = sk->sk_prot_creator = prot; 1036 1036 sock_lock_init(sk); 1037 1037 sock_net_set(sk, get_net(net)); 1038 + atomic_set(&sk->sk_wmem_alloc, 1); 1038 1039 } 1039 1040 1040 1041 return sk; ··· 1883 1882 */ 1884 1883 smp_wmb(); 1885 1884 atomic_set(&sk->sk_refcnt, 1); 1886 - atomic_set(&sk->sk_wmem_alloc, 1); 1887 1885 atomic_set(&sk->sk_drops, 0); 1888 1886 } 1889 1887 EXPORT_SYMBOL(sock_init_data);
+1 -1
net/ipv4/ip_gre.c
··· 951 951 addend += 4; 952 952 } 953 953 dev->needed_headroom = addend + hlen; 954 - mtu -= dev->hard_header_len - addend; 954 + mtu -= dev->hard_header_len + addend; 955 955 956 956 if (mtu < 68) 957 957 mtu = 68;
+3 -1
net/ipv6/af_inet6.c
··· 306 306 v4addr != htonl(INADDR_ANY) && 307 307 chk_addr_ret != RTN_LOCAL && 308 308 chk_addr_ret != RTN_MULTICAST && 309 - chk_addr_ret != RTN_BROADCAST) 309 + chk_addr_ret != RTN_BROADCAST) { 310 + err = -EADDRNOTAVAIL; 310 311 goto out; 312 + } 311 313 } else { 312 314 if (addr_type != IPV6_ADDR_ANY) { 313 315 struct net_device *dev = NULL;
+1
net/llc/af_llc.c
··· 914 914 struct llc_sock *llc = llc_sk(sk); 915 915 int rc = 0; 916 916 917 + memset(&sllc, 0, sizeof(sllc)); 917 918 lock_sock(sk); 918 919 if (sock_flag(sk, SOCK_ZAPPED)) 919 920 goto out;
+1 -1
net/netfilter/xt_RATEEST.c
··· 74 74 xt_rateest_tg(struct sk_buff *skb, const struct xt_target_param *par) 75 75 { 76 76 const struct xt_rateest_target_info *info = par->targinfo; 77 - struct gnet_stats_basic *stats = &info->est->bstats; 77 + struct gnet_stats_basic_packed *stats = &info->est->bstats; 78 78 79 79 spin_lock_bh(&info->est->lock); 80 80 stats->bytes += skb->len;
+1 -1
net/netfilter/xt_quota.c
··· 52 52 53 53 q->master = kmalloc(sizeof(*q->master), GFP_KERNEL); 54 54 if (q->master == NULL) 55 - return -ENOMEM; 55 + return false; 56 56 57 57 q->master->quota = q->quota; 58 58 return true;
+12 -9
net/netrom/nr_route.c
··· 630 630 return dev; 631 631 } 632 632 633 - static ax25_digi *nr_call_to_digi(int ndigis, ax25_address *digipeaters) 633 + static ax25_digi *nr_call_to_digi(ax25_digi *digi, int ndigis, 634 + ax25_address *digipeaters) 634 635 { 635 - static ax25_digi ax25_digi; 636 636 int i; 637 637 638 638 if (ndigis == 0) 639 639 return NULL; 640 640 641 641 for (i = 0; i < ndigis; i++) { 642 - ax25_digi.calls[i] = digipeaters[i]; 643 - ax25_digi.repeated[i] = 0; 642 + digi->calls[i] = digipeaters[i]; 643 + digi->repeated[i] = 0; 644 644 } 645 645 646 - ax25_digi.ndigi = ndigis; 647 - ax25_digi.lastrepeat = -1; 646 + digi->ndigi = ndigis; 647 + digi->lastrepeat = -1; 648 648 649 - return &ax25_digi; 649 + return digi; 650 650 } 651 651 652 652 /* ··· 656 656 { 657 657 struct nr_route_struct nr_route; 658 658 struct net_device *dev; 659 + ax25_digi digi; 659 660 int ret; 660 661 661 662 switch (cmd) { ··· 674 673 ret = nr_add_node(&nr_route.callsign, 675 674 nr_route.mnemonic, 676 675 &nr_route.neighbour, 677 - nr_call_to_digi(nr_route.ndigis, nr_route.digipeaters), 676 + nr_call_to_digi(&digi, nr_route.ndigis, 677 + nr_route.digipeaters), 678 678 dev, nr_route.quality, 679 679 nr_route.obs_count); 680 680 break; 681 681 case NETROM_NEIGH: 682 682 ret = nr_add_neigh(&nr_route.callsign, 683 - nr_call_to_digi(nr_route.ndigis, nr_route.digipeaters), 683 + nr_call_to_digi(&digi, nr_route.ndigis, 684 + nr_route.digipeaters), 684 685 dev, nr_route.quality); 685 686 break; 686 687 default:
+1 -1
net/sched/sch_atm.c
··· 49 49 struct socket *sock; /* for closing */ 50 50 u32 classid; /* x:y type ID */ 51 51 int ref; /* reference count */ 52 - struct gnet_stats_basic bstats; 52 + struct gnet_stats_basic_packed bstats; 53 53 struct gnet_stats_queue qstats; 54 54 struct atm_flow_data *next; 55 55 struct atm_flow_data *excess; /* flow for excess traffic;
+1 -1
net/sched/sch_cbq.c
··· 128 128 long avgidle; 129 129 long deficit; /* Saved deficit for WRR */ 130 130 psched_time_t penalized; 131 - struct gnet_stats_basic bstats; 131 + struct gnet_stats_basic_packed bstats; 132 132 struct gnet_stats_queue qstats; 133 133 struct gnet_stats_rate_est rate_est; 134 134 struct tc_cbq_xstats xstats;
+1 -1
net/sched/sch_drr.c
··· 22 22 unsigned int refcnt; 23 23 unsigned int filter_cnt; 24 24 25 - struct gnet_stats_basic bstats; 25 + struct gnet_stats_basic_packed bstats; 26 26 struct gnet_stats_queue qstats; 27 27 struct gnet_stats_rate_est rate_est; 28 28 struct list_head alist;
+1 -1
net/sched/sch_hfsc.c
··· 116 116 struct Qdisc_class_common cl_common; 117 117 unsigned int refcnt; /* usage count */ 118 118 119 - struct gnet_stats_basic bstats; 119 + struct gnet_stats_basic_packed bstats; 120 120 struct gnet_stats_queue qstats; 121 121 struct gnet_stats_rate_est rate_est; 122 122 unsigned int level; /* class level in hierarchy */
+1 -1
net/sched/sch_htb.c
··· 74 74 struct htb_class { 75 75 struct Qdisc_class_common common; 76 76 /* general class parameters */ 77 - struct gnet_stats_basic bstats; 77 + struct gnet_stats_basic_packed bstats; 78 78 struct gnet_stats_queue qstats; 79 79 struct gnet_stats_rate_est rate_est; 80 80 struct tc_htb_xstats xstats; /* our special stats */