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

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (43 commits)
netlink: genl: fix circular locking
Revert "mac80211: Use skb_header_cloned() on TX path."
af_unix: fix 'poll for write'/ connected DGRAM sockets
tun: Proper handling of IPv6 header in tun driver when TUN_NO_PI is set
atl1: relax eeprom mac address error check
net/enc28j60: low power mode
net/enc28j60: section fix
sky2: 88E8040T pci device id
netxen: download firmware in pci probe
netxen: cleanup debug messages
netxen: remove global physical_port array
netxen: fix portnum for hp mezz cards
ibm_newemac: select CRC32 in Kconfig
xfrm: fix fragmentation for ipv4 xfrm tunnel
netfilter: nf_conntrack_h323: fix module unload crash
netfilter: nf_conntrack_h323: fix memory leak in module initialization error path
netfilter: nf_nat: fix RCU races
atm: [he] send idle cells instead of unassigned when in SDH mode
atm: [he] limit queries to the device's register space
atm: [br2864] fix routed vcmux support
...

+562 -455
+9 -2
drivers/atm/he.c
··· 1542 1542 /* initialize framer */ 1543 1543 1544 1544 #ifdef CONFIG_ATM_HE_USE_SUNI 1545 - suni_init(he_dev->atm_dev); 1545 + if (he_isMM(he_dev)) 1546 + suni_init(he_dev->atm_dev); 1546 1547 if (he_dev->atm_dev->phy && he_dev->atm_dev->phy->start) 1547 1548 he_dev->atm_dev->phy->start(he_dev->atm_dev); 1548 1549 #endif /* CONFIG_ATM_HE_USE_SUNI */ ··· 1555 1554 val = he_phy_get(he_dev->atm_dev, SUNI_TPOP_APM); 1556 1555 val = (val & ~SUNI_TPOP_APM_S) | (SUNI_TPOP_S_SDH << SUNI_TPOP_APM_S_SHIFT); 1557 1556 he_phy_put(he_dev->atm_dev, val, SUNI_TPOP_APM); 1557 + he_phy_put(he_dev->atm_dev, SUNI_TACP_IUCHP_CLP, SUNI_TACP_IUCHP); 1558 1558 } 1559 1559 1560 1560 /* 5.1.12 enable transmit and receive */ ··· 2846 2844 if (copy_from_user(&reg, arg, 2847 2845 sizeof(struct he_ioctl_reg))) 2848 2846 return -EFAULT; 2849 - 2847 + 2850 2848 spin_lock_irqsave(&he_dev->global_lock, flags); 2851 2849 switch (reg.type) { 2852 2850 case HE_REGTYPE_PCI: 2851 + if (reg.addr < 0 || reg.addr >= HE_REGMAP_SIZE) { 2852 + err = -EINVAL; 2853 + break; 2854 + } 2855 + 2853 2856 reg.val = he_readl(he_dev, reg.addr); 2854 2857 break; 2855 2858 case HE_REGTYPE_RCM:
+4 -9
drivers/atm/he.h
··· 267 267 268 268 char prod_id[30]; 269 269 char mac_addr[6]; 270 - int media; /* 271 - * 0x26 = HE155 MM 272 - * 0x27 = HE622 MM 273 - * 0x46 = HE155 SM 274 - * 0x47 = HE622 SM 275 - */ 276 - 270 + int media; 277 271 278 272 unsigned int vcibits, vpibits; 279 273 unsigned int cells_per_row; ··· 386 392 #define HE_DEV(dev) ((struct he_dev *) (dev)->dev_data) 387 393 388 394 #define he_is622(dev) ((dev)->media & 0x1) 395 + #define he_isMM(dev) ((dev)->media & 0x20) 389 396 390 397 #define HE_REGMAP_SIZE 0x100000 391 398 ··· 871 876 #define M_SN 0x3a /* integer */ 872 877 #define MEDIA 0x3e /* integer */ 873 878 #define HE155MM 0x26 874 - #define HE155SM 0x27 875 - #define HE622MM 0x46 879 + #define HE622MM 0x27 880 + #define HE155SM 0x46 876 881 #define HE622SM 0x47 877 882 #define MAC_ADDR 0x42 /* char[] */ 878 883
+13 -14
drivers/atm/iphase.c
··· 2562 2562 error = suni_init(dev); 2563 2563 if (error) 2564 2564 goto err_free_rx; 2565 - /* 2566 - * Enable interrupt on loss of signal 2567 - * SUNI_RSOP_CIE - 0x10 2568 - * SUNI_RSOP_CIE_LOSE - 0x04 2569 - */ 2570 - ia_phy_put(dev, ia_phy_get(dev, 0x10) | 0x04, 0x10); 2571 - #ifndef MODULE 2572 - error = dev->phy->start(dev); 2573 - if (error) 2574 - goto err_free_rx; 2575 - #endif 2565 + if (dev->phy->start) { 2566 + error = dev->phy->start(dev); 2567 + if (error) 2568 + goto err_free_rx; 2569 + } 2576 2570 /* Get iadev->carrier_detect status */ 2577 2571 IaFrontEndIntr(iadev); 2578 2572 } ··· 3192 3198 IF_INIT(printk("dev_id = 0x%x iadev->LineRate = %d \n", (u32)dev, 3193 3199 iadev->LineRate);) 3194 3200 3201 + pci_set_drvdata(pdev, dev); 3202 + 3195 3203 ia_dev[iadev_count] = iadev; 3196 3204 _ia_dev[iadev_count] = dev; 3197 3205 iadev_count++; ··· 3215 3219 iadev->next_board = ia_boards; 3216 3220 ia_boards = dev; 3217 3221 3218 - pci_set_drvdata(pdev, dev); 3219 - 3220 3222 return 0; 3221 3223 3222 3224 err_out_deregister_dev: ··· 3232 3238 struct atm_dev *dev = pci_get_drvdata(pdev); 3233 3239 IADEV *iadev = INPH_IA_DEV(dev); 3234 3240 3235 - ia_phy_put(dev, ia_phy_get(dev,0x10) & ~(0x4), 0x10); 3241 + /* Disable phy interrupts */ 3242 + ia_phy_put(dev, ia_phy_get(dev, SUNI_RSOP_CIE) & ~(SUNI_RSOP_CIE_LOSE), 3243 + SUNI_RSOP_CIE); 3236 3244 udelay(1); 3245 + 3246 + if (dev->phy && dev->phy->stop) 3247 + dev->phy->stop(dev); 3237 3248 3238 3249 /* De-register device */ 3239 3250 free_irq(iadev->irq, dev);
-1
drivers/net/atlx/atl1.c
··· 471 471 memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN); 472 472 return 0; 473 473 } 474 - return 1; 475 474 } 476 475 477 476 /* see if SPI FLAGS exist ? */
+63 -30
drivers/net/enc28j60.c
··· 400 400 mutex_unlock(&priv->lock); 401 401 } 402 402 403 + static unsigned long msec20_to_jiffies; 404 + 405 + static int poll_ready(struct enc28j60_net *priv, u8 reg, u8 mask, u8 val) 406 + { 407 + unsigned long timeout = jiffies + msec20_to_jiffies; 408 + 409 + /* 20 msec timeout read */ 410 + while ((nolock_regb_read(priv, reg) & mask) != val) { 411 + if (time_after(jiffies, timeout)) { 412 + if (netif_msg_drv(priv)) 413 + dev_dbg(&priv->spi->dev, 414 + "reg %02x ready timeout!\n", reg); 415 + return -ETIMEDOUT; 416 + } 417 + cpu_relax(); 418 + } 419 + return 0; 420 + } 421 + 403 422 /* 404 423 * Wait until the PHY operation is complete. 405 424 */ 406 425 static int wait_phy_ready(struct enc28j60_net *priv) 407 426 { 408 - unsigned long timeout = jiffies + 20 * HZ / 1000; 409 - int ret = 1; 410 - 411 - /* 20 msec timeout read */ 412 - while (nolock_regb_read(priv, MISTAT) & MISTAT_BUSY) { 413 - if (time_after(jiffies, timeout)) { 414 - if (netif_msg_drv(priv)) 415 - printk(KERN_DEBUG DRV_NAME 416 - ": PHY ready timeout!\n"); 417 - ret = 0; 418 - break; 419 - } 420 - cpu_relax(); 421 - } 422 - return ret; 427 + return poll_ready(priv, MISTAT, MISTAT_BUSY, 0) ? 0 : 1; 423 428 } 424 429 425 430 /* ··· 599 594 nolock_regw_write(priv, ETXNDL, end); 600 595 } 601 596 597 + /* 598 + * Low power mode shrinks power consumption about 100x, so we'd like 599 + * the chip to be in that mode whenever it's inactive. (However, we 600 + * can't stay in lowpower mode during suspend with WOL active.) 601 + */ 602 + static void enc28j60_lowpower(struct enc28j60_net *priv, bool is_low) 603 + { 604 + if (netif_msg_drv(priv)) 605 + dev_dbg(&priv->spi->dev, "%s power...\n", 606 + is_low ? "low" : "high"); 607 + 608 + mutex_lock(&priv->lock); 609 + if (is_low) { 610 + nolock_reg_bfclr(priv, ECON1, ECON1_RXEN); 611 + poll_ready(priv, ESTAT, ESTAT_RXBUSY, 0); 612 + poll_ready(priv, ECON1, ECON1_TXRTS, 0); 613 + /* ECON2_VRPS was set during initialization */ 614 + nolock_reg_bfset(priv, ECON2, ECON2_PWRSV); 615 + } else { 616 + nolock_reg_bfclr(priv, ECON2, ECON2_PWRSV); 617 + poll_ready(priv, ESTAT, ESTAT_CLKRDY, ESTAT_CLKRDY); 618 + /* caller sets ECON1_RXEN */ 619 + } 620 + mutex_unlock(&priv->lock); 621 + } 622 + 602 623 static int enc28j60_hw_init(struct enc28j60_net *priv) 603 624 { 604 625 u8 reg; ··· 643 612 priv->tx_retry_count = 0; 644 613 priv->max_pk_counter = 0; 645 614 priv->rxfilter = RXFILTER_NORMAL; 646 - /* enable address auto increment */ 647 - nolock_regb_write(priv, ECON2, ECON2_AUTOINC); 615 + /* enable address auto increment and voltage regulator powersave */ 616 + nolock_regb_write(priv, ECON2, ECON2_AUTOINC | ECON2_VRPS); 648 617 649 618 nolock_rxfifo_init(priv, RXSTART_INIT, RXEND_INIT); 650 619 nolock_txfifo_init(priv, TXSTART_INIT, TXEND_INIT); ··· 721 690 722 691 static void enc28j60_hw_enable(struct enc28j60_net *priv) 723 692 { 724 - /* enable interrutps */ 693 + /* enable interrupts */ 725 694 if (netif_msg_hw(priv)) 726 695 printk(KERN_DEBUG DRV_NAME ": %s() enabling interrupts.\n", 727 696 __FUNCTION__); ··· 757 726 int ret = 0; 758 727 759 728 if (!priv->hw_enable) { 760 - if (autoneg == AUTONEG_DISABLE && speed == SPEED_10) { 729 + /* link is in low power mode now; duplex setting 730 + * will take effect on next enc28j60_hw_init(). 731 + */ 732 + if (autoneg == AUTONEG_DISABLE && speed == SPEED_10) 761 733 priv->full_duplex = (duplex == DUPLEX_FULL); 762 - if (!enc28j60_hw_init(priv)) { 763 - if (netif_msg_drv(priv)) 764 - dev_err(&ndev->dev, 765 - "hw_reset() failed\n"); 766 - ret = -EINVAL; 767 - } 768 - } else { 734 + else { 769 735 if (netif_msg_link(priv)) 770 736 dev_warn(&ndev->dev, 771 737 "unsupported link setting\n"); ··· 1335 1307 } 1336 1308 return -EADDRNOTAVAIL; 1337 1309 } 1338 - /* Reset the hardware here */ 1310 + /* Reset the hardware here (and take it out of low power mode) */ 1311 + enc28j60_lowpower(priv, false); 1339 1312 enc28j60_hw_disable(priv); 1340 1313 if (!enc28j60_hw_init(priv)) { 1341 1314 if (netif_msg_ifup(priv)) ··· 1366 1337 printk(KERN_DEBUG DRV_NAME ": %s() enter\n", __FUNCTION__); 1367 1338 1368 1339 enc28j60_hw_disable(priv); 1340 + enc28j60_lowpower(priv, true); 1369 1341 netif_stop_queue(dev); 1370 1342 1371 1343 return 0; ··· 1567 1537 dev->watchdog_timeo = TX_TIMEOUT; 1568 1538 SET_ETHTOOL_OPS(dev, &enc28j60_ethtool_ops); 1569 1539 1540 + enc28j60_lowpower(priv, true); 1541 + 1570 1542 ret = register_netdev(dev); 1571 1543 if (ret) { 1572 1544 if (netif_msg_probe(priv)) ··· 1588 1556 return ret; 1589 1557 } 1590 1558 1591 - static int enc28j60_remove(struct spi_device *spi) 1559 + static int __devexit enc28j60_remove(struct spi_device *spi) 1592 1560 { 1593 1561 struct enc28j60_net *priv = dev_get_drvdata(&spi->dev); 1594 1562 ··· 1605 1573 static struct spi_driver enc28j60_driver = { 1606 1574 .driver = { 1607 1575 .name = DRV_NAME, 1608 - .bus = &spi_bus_type, 1609 1576 .owner = THIS_MODULE, 1610 - }, 1577 + }, 1611 1578 .probe = enc28j60_probe, 1612 1579 .remove = __devexit_p(enc28j60_remove), 1613 1580 }; 1614 1581 1615 1582 static int __init enc28j60_init(void) 1616 1583 { 1584 + msec20_to_jiffies = msecs_to_jiffies(20); 1585 + 1617 1586 return spi_register_driver(&enc28j60_driver); 1618 1587 } 1619 1588
+1
drivers/net/ibm_newemac/Kconfig
··· 1 1 config IBM_NEW_EMAC 2 2 tristate "IBM EMAC Ethernet support" 3 3 depends on PPC_DCR && PPC_MERGE 4 + select CRC32 4 5 help 5 6 This driver supports the IBM EMAC family of Ethernet controllers 6 7 typically found on 4xx embedded PowerPC chips, but also on the
+1 -17
drivers/net/netxen/netxen_nic.h
··· 776 776 777 777 u8 revision_id; 778 778 u16 board_type; 779 - u16 max_ports; 780 779 struct netxen_board_info boardcfg; 781 780 u32 xg_linkup; 782 781 u32 qg_linksup; ··· 862 863 unsigned char mac_addr[ETH_ALEN]; 863 864 int mtu; 864 865 int portnum; 866 + u8 physical_port; 865 867 866 868 struct work_struct watchdog_task; 867 869 struct timer_list watchdog_timer; ··· 1034 1034 1035 1035 /* Functions from netxen_nic_isr.c */ 1036 1036 void netxen_initialize_adapter_sw(struct netxen_adapter *adapter); 1037 - void netxen_initialize_adapter_hw(struct netxen_adapter *adapter); 1038 1037 void *netxen_alloc(struct pci_dev *pdev, size_t sz, dma_addr_t * ptr, 1039 1038 struct pci_dev **used_dev); 1040 1039 void netxen_initialize_adapter_ops(struct netxen_adapter *adapter); ··· 1075 1076 }; 1076 1077 1077 1078 #define NUM_SUPPORTED_BOARDS ARRAY_SIZE(netxen_boards) 1078 - 1079 - static inline void get_brd_port_by_type(u32 type, int *ports) 1080 - { 1081 - int i, found = 0; 1082 - for (i = 0; i < NUM_SUPPORTED_BOARDS; ++i) { 1083 - if (netxen_boards[i].brdtype == type) { 1084 - *ports = netxen_boards[i].ports; 1085 - found = 1; 1086 - break; 1087 - } 1088 - } 1089 - if (!found) 1090 - *ports = 0; 1091 - } 1092 1079 1093 1080 static inline void get_brd_name_by_type(u32 type, char *name) 1094 1081 { ··· 1154 1169 1155 1170 extern struct ethtool_ops netxen_nic_ethtool_ops; 1156 1171 1157 - extern int physical_port[]; /* physical port # from virtual port.*/ 1158 1172 #endif /* __NETXEN_NIC_H_ */
+3 -3
drivers/net/netxen/netxen_nic_ethtool.c
··· 369 369 for (i = 3; niu_registers[mode].reg[i - 3] != -1; i++) { 370 370 /* GB: port specific registers */ 371 371 if (mode == 0 && i >= 19) 372 - window = physical_port[adapter->portnum] * 372 + window = adapter->physical_port * 373 373 NETXEN_NIC_PORT_WINDOW; 374 374 375 375 NETXEN_NIC_LOCKED_READ_REG(niu_registers[mode]. ··· 527 527 { 528 528 struct netxen_adapter *adapter = netdev_priv(dev); 529 529 __u32 val; 530 - int port = physical_port[adapter->portnum]; 530 + int port = adapter->physical_port; 531 531 532 532 if (adapter->ahw.board_type == NETXEN_NIC_GBE) { 533 533 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) ··· 573 573 { 574 574 struct netxen_adapter *adapter = netdev_priv(dev); 575 575 __u32 val; 576 - int port = physical_port[adapter->portnum]; 576 + int port = adapter->physical_port; 577 577 /* read mode */ 578 578 if (adapter->ahw.board_type == NETXEN_NIC_GBE) { 579 579 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
+49 -65
drivers/net/netxen/netxen_nic_hw.c
··· 396 396 } 397 397 adapter->intr_scheme = readl( 398 398 NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_CAPABILITIES_FW)); 399 - printk(KERN_NOTICE "%s: FW capabilities:0x%x\n", netxen_nic_driver_name, 400 - adapter->intr_scheme); 401 399 adapter->msi_mode = readl( 402 400 NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_MSI_MODE_FW)); 403 - DPRINTK(INFO, "Receive Peg ready too. starting stuff\n"); 404 401 405 402 addr = netxen_alloc(adapter->ahw.pdev, 406 403 sizeof(struct netxen_ring_ctx) + ··· 405 408 (dma_addr_t *) & adapter->ctx_desc_phys_addr, 406 409 &adapter->ctx_desc_pdev); 407 410 408 - printk(KERN_INFO "ctx_desc_phys_addr: 0x%llx\n", 409 - (unsigned long long) adapter->ctx_desc_phys_addr); 410 411 if (addr == NULL) { 411 412 DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); 412 413 err = -ENOMEM; ··· 424 429 adapter->max_tx_desc_count, 425 430 (dma_addr_t *) & hw->cmd_desc_phys_addr, 426 431 &adapter->ahw.cmd_desc_pdev); 427 - printk(KERN_INFO "cmd_desc_phys_addr: 0x%llx\n", 428 - (unsigned long long) hw->cmd_desc_phys_addr); 429 432 430 433 if (addr == NULL) { 431 434 DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); ··· 1025 1032 int netxen_nic_set_mtu_gb(struct netxen_adapter *adapter, int new_mtu) 1026 1033 { 1027 1034 netxen_nic_write_w0(adapter, 1028 - NETXEN_NIU_GB_MAX_FRAME_SIZE( 1029 - physical_port[adapter->portnum]), new_mtu); 1035 + NETXEN_NIU_GB_MAX_FRAME_SIZE(adapter->physical_port), 1036 + new_mtu); 1030 1037 return 0; 1031 1038 } 1032 1039 1033 1040 int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu) 1034 1041 { 1035 1042 new_mtu += NETXEN_NIU_HDRSIZE + NETXEN_NIU_TLRSIZE; 1036 - if (physical_port[adapter->portnum] == 0) 1043 + if (adapter->physical_port == 0) 1037 1044 netxen_nic_write_w0(adapter, NETXEN_NIU_XGE_MAX_FRAME_SIZE, 1038 1045 new_mtu); 1039 1046 else ··· 1044 1051 1045 1052 void netxen_nic_init_niu_gb(struct netxen_adapter *adapter) 1046 1053 { 1047 - netxen_niu_gbe_init_port(adapter, physical_port[adapter->portnum]); 1054 + netxen_niu_gbe_init_port(adapter, adapter->physical_port); 1048 1055 } 1049 1056 1050 1057 void ··· 1120 1127 1121 1128 void netxen_nic_flash_print(struct netxen_adapter *adapter) 1122 1129 { 1123 - int valid = 1; 1124 1130 u32 fw_major = 0; 1125 1131 u32 fw_minor = 0; 1126 1132 u32 fw_build = 0; ··· 1129 1137 __le32 *ptr32; 1130 1138 1131 1139 struct netxen_board_info *board_info = &(adapter->ahw.boardcfg); 1132 - if (board_info->magic != NETXEN_BDINFO_MAGIC) { 1133 - printk 1134 - ("NetXen Unknown board config, Read 0x%x expected as 0x%x\n", 1135 - board_info->magic, NETXEN_BDINFO_MAGIC); 1136 - valid = 0; 1137 - } 1138 - if (board_info->header_version != NETXEN_BDINFO_VERSION) { 1139 - printk("NetXen Unknown board config version." 1140 - " Read %x, expected %x\n", 1141 - board_info->header_version, NETXEN_BDINFO_VERSION); 1142 - valid = 0; 1143 - } 1144 - if (valid) { 1145 - ptr32 = (u32 *)&serial_num; 1146 - addr = NETXEN_USER_START + 1147 - offsetof(struct netxen_new_user_info, serial_num); 1148 - for (i = 0; i < 8; i++) { 1149 - if (netxen_rom_fast_read(adapter, addr, ptr32) == -1) { 1150 - printk("%s: ERROR reading %s board userarea.\n", 1151 - netxen_nic_driver_name, 1152 - netxen_nic_driver_name); 1153 - return; 1154 - } 1155 - ptr32++; 1156 - addr += sizeof(u32); 1157 - } 1158 1140 1141 + adapter->driver_mismatch = 0; 1142 + 1143 + ptr32 = (u32 *)&serial_num; 1144 + addr = NETXEN_USER_START + 1145 + offsetof(struct netxen_new_user_info, serial_num); 1146 + for (i = 0; i < 8; i++) { 1147 + if (netxen_rom_fast_read(adapter, addr, ptr32) == -1) { 1148 + printk("%s: ERROR reading %s board userarea.\n", 1149 + netxen_nic_driver_name, 1150 + netxen_nic_driver_name); 1151 + adapter->driver_mismatch = 1; 1152 + return; 1153 + } 1154 + ptr32++; 1155 + addr += sizeof(u32); 1156 + } 1157 + 1158 + fw_major = readl(NETXEN_CRB_NORMALIZE(adapter, 1159 + NETXEN_FW_VERSION_MAJOR)); 1160 + fw_minor = readl(NETXEN_CRB_NORMALIZE(adapter, 1161 + NETXEN_FW_VERSION_MINOR)); 1162 + fw_build = 1163 + readl(NETXEN_CRB_NORMALIZE(adapter, NETXEN_FW_VERSION_SUB)); 1164 + 1165 + if (adapter->portnum == 0) { 1159 1166 get_brd_name_by_type(board_info->board_type, brd_name); 1160 1167 1161 1168 printk("NetXen %s Board S/N %s Chip id 0x%x\n", 1162 - brd_name, serial_num, board_info->chip_id); 1163 - 1164 - printk("NetXen %s Board #%d, Chip id 0x%x\n", 1165 - board_info->board_type == 0x0b ? "XGB" : "GBE", 1166 - board_info->board_num, board_info->chip_id); 1167 - fw_major = readl(NETXEN_CRB_NORMALIZE(adapter, 1168 - NETXEN_FW_VERSION_MAJOR)); 1169 - fw_minor = readl(NETXEN_CRB_NORMALIZE(adapter, 1170 - NETXEN_FW_VERSION_MINOR)); 1171 - fw_build = 1172 - readl(NETXEN_CRB_NORMALIZE(adapter, NETXEN_FW_VERSION_SUB)); 1173 - 1174 - printk("NetXen Firmware version %d.%d.%d\n", fw_major, fw_minor, 1175 - fw_build); 1169 + brd_name, serial_num, board_info->chip_id); 1170 + printk("NetXen Firmware version %d.%d.%d\n", fw_major, 1171 + fw_minor, fw_build); 1176 1172 } 1173 + 1177 1174 if (fw_major != _NETXEN_NIC_LINUX_MAJOR) { 1178 - printk(KERN_ERR "The mismatch in driver version and firmware " 1179 - "version major number\n" 1180 - "Driver version major number = %d \t" 1181 - "Firmware version major number = %d \n", 1182 - _NETXEN_NIC_LINUX_MAJOR, fw_major); 1183 1175 adapter->driver_mismatch = 1; 1184 1176 } 1185 1177 if (fw_minor != _NETXEN_NIC_LINUX_MINOR && 1186 1178 fw_minor != (_NETXEN_NIC_LINUX_MINOR + 1)) { 1187 - printk(KERN_ERR "The mismatch in driver version and firmware " 1188 - "version minor number\n" 1189 - "Driver version minor number = %d \t" 1190 - "Firmware version minor number = %d \n", 1191 - _NETXEN_NIC_LINUX_MINOR, fw_minor); 1192 1179 adapter->driver_mismatch = 1; 1193 1180 } 1194 - if (adapter->driver_mismatch) 1195 - printk(KERN_INFO "Use the driver with version no %d.%d.xxx\n", 1196 - fw_major, fw_minor); 1181 + if (adapter->driver_mismatch) { 1182 + printk(KERN_ERR "%s: driver and firmware version mismatch\n", 1183 + adapter->netdev->name); 1184 + return; 1185 + } 1186 + 1187 + switch (adapter->ahw.board_type) { 1188 + case NETXEN_NIC_GBE: 1189 + dev_info(&adapter->pdev->dev, "%s: GbE port initialized\n", 1190 + adapter->netdev->name); 1191 + break; 1192 + case NETXEN_NIC_XGBE: 1193 + dev_info(&adapter->pdev->dev, "%s: XGbE port initialized\n", 1194 + adapter->netdev->name); 1195 + break; 1196 + } 1197 1197 } 1198 1198
+21 -25
drivers/net/netxen/netxen_nic_init.c
··· 203 203 } 204 204 } 205 205 206 - void netxen_initialize_adapter_hw(struct netxen_adapter *adapter) 207 - { 208 - int ports = 0; 209 - struct netxen_board_info *board_info = &(adapter->ahw.boardcfg); 210 - 211 - if (netxen_nic_get_board_info(adapter) != 0) 212 - printk("%s: Error getting board config info.\n", 213 - netxen_nic_driver_name); 214 - get_brd_port_by_type(board_info->board_type, &ports); 215 - if (ports == 0) 216 - printk(KERN_ERR "%s: Unknown board type\n", 217 - netxen_nic_driver_name); 218 - adapter->ahw.max_ports = ports; 219 - } 220 - 221 206 void netxen_initialize_adapter_ops(struct netxen_adapter *adapter) 222 207 { 223 208 switch (adapter->ahw.board_type) { ··· 750 765 751 766 int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) 752 767 { 753 - int addr, val, status; 768 + int addr, val; 754 769 int n, i; 755 770 int init_delay = 0; 756 771 struct crb_addr_pair *buf; 757 772 u32 off; 758 773 759 774 /* resetall */ 760 - status = netxen_nic_get_board_info(adapter); 761 - if (status) 762 - printk("%s: netxen_pinit_from_rom: Error getting board info\n", 763 - netxen_nic_driver_name); 764 - 765 775 netxen_crb_writelit_adapter(adapter, NETXEN_ROMUSB_GLB_SW_RESET, 766 776 NETXEN_ROMBUS_RESET); 767 777 ··· 840 860 netxen_nic_pci_change_crbwindow(adapter, 1); 841 861 } 842 862 if (init_delay == 1) { 843 - msleep(2000); 863 + msleep(1000); 844 864 init_delay = 0; 845 865 } 846 - msleep(20); 866 + msleep(1); 847 867 } 848 868 kfree(buf); 849 869 ··· 918 938 919 939 void netxen_free_adapter_offload(struct netxen_adapter *adapter) 920 940 { 941 + int i; 942 + 921 943 if (adapter->dummy_dma.addr) { 922 - pci_free_consistent(adapter->ahw.pdev, 944 + i = 100; 945 + do { 946 + if (dma_watchdog_shutdown_request(adapter) == 1) 947 + break; 948 + msleep(50); 949 + if (dma_watchdog_shutdown_poll_result(adapter) == 1) 950 + break; 951 + } while (--i); 952 + 953 + if (i) { 954 + pci_free_consistent(adapter->ahw.pdev, 923 955 NETXEN_HOST_DUMMY_DMA_SIZE, 924 956 adapter->dummy_dma.addr, 925 957 adapter->dummy_dma.phys_addr); 926 - adapter->dummy_dma.addr = NULL; 958 + adapter->dummy_dma.addr = NULL; 959 + } else { 960 + printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n", 961 + adapter->netdev->name); 962 + } 927 963 } 928 964 } 929 965
+2 -2
drivers/net/netxen/netxen_nic_isr.c
··· 145 145 146 146 /* verify the offset */ 147 147 val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); 148 - val = val >> physical_port[adapter->portnum]; 148 + val = val >> adapter->physical_port; 149 149 if (val == adapter->ahw.qg_linksup) 150 150 return; 151 151 ··· 199 199 200 200 /* WINDOW = 1 */ 201 201 val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); 202 - val >>= (physical_port[adapter->portnum] * 8); 202 + val >>= (adapter->physical_port * 8); 203 203 val &= 0xff; 204 204 205 205 if (adapter->ahw.xg_linkup == 1 && val != XG_LINK_UP) {
+41 -92
drivers/net/netxen/netxen_nic_main.c
··· 70 70 static irqreturn_t netxen_intr(int irq, void *data); 71 71 static irqreturn_t netxen_msi_intr(int irq, void *data); 72 72 73 - int physical_port[] = {0, 1, 2, 3}; 74 - 75 73 /* PCI Device ID Table */ 76 74 static struct pci_device_id netxen_pci_tbl[] __devinitdata = { 77 - {PCI_DEVICE(0x4040, 0x0001)}, 78 - {PCI_DEVICE(0x4040, 0x0002)}, 79 - {PCI_DEVICE(0x4040, 0x0003)}, 80 - {PCI_DEVICE(0x4040, 0x0004)}, 81 - {PCI_DEVICE(0x4040, 0x0005)}, 82 - {PCI_DEVICE(0x4040, 0x0024)}, 83 - {PCI_DEVICE(0x4040, 0x0025)}, 75 + {PCI_DEVICE(0x4040, 0x0001), PCI_DEVICE_CLASS(0x020000, ~0)}, 76 + {PCI_DEVICE(0x4040, 0x0002), PCI_DEVICE_CLASS(0x020000, ~0)}, 77 + {PCI_DEVICE(0x4040, 0x0003), PCI_DEVICE_CLASS(0x020000, ~0)}, 78 + {PCI_DEVICE(0x4040, 0x0004), PCI_DEVICE_CLASS(0x020000, ~0)}, 79 + {PCI_DEVICE(0x4040, 0x0005), PCI_DEVICE_CLASS(0x020000, ~0)}, 80 + {PCI_DEVICE(0x4040, 0x0024), PCI_DEVICE_CLASS(0x020000, ~0)}, 81 + {PCI_DEVICE(0x4040, 0x0025), PCI_DEVICE_CLASS(0x020000, ~0)}, 84 82 {0,} 85 83 }; 86 84 ··· 286 288 int pci_func_id = PCI_FUNC(pdev->devfn); 287 289 DECLARE_MAC_BUF(mac); 288 290 289 - printk(KERN_INFO "%s \n", netxen_nic_driver_string); 291 + if (pci_func_id == 0) 292 + printk(KERN_INFO "%s \n", netxen_nic_driver_string); 290 293 291 294 if (pdev->class != 0x020000) { 292 - printk(KERN_ERR"NetXen function %d, class %x will not " 295 + printk(KERN_DEBUG "NetXen function %d, class %x will not " 293 296 "be enabled.\n",pci_func_id, pdev->class); 294 297 return -ENODEV; 295 298 } ··· 449 450 */ 450 451 adapter->curr_window = 255; 451 452 452 - /* initialize the adapter */ 453 - netxen_initialize_adapter_hw(adapter); 453 + if (netxen_nic_get_board_info(adapter) != 0) { 454 + printk("%s: Error getting board config info.\n", 455 + netxen_nic_driver_name); 456 + err = -EIO; 457 + goto err_out_iounmap; 458 + } 454 459 455 460 /* 456 461 * Adapter in our case is quad port so initialize it before ··· 533 530 netxen_initialize_adapter_sw(adapter); /* initialize the buffers in adapter */ 534 531 535 532 /* Mezz cards have PCI function 0,2,3 enabled */ 536 - if ((adapter->ahw.boardcfg.board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) 537 - && (pci_func_id >= 2)) 533 + switch (adapter->ahw.boardcfg.board_type) { 534 + case NETXEN_BRDTYPE_P2_SB31_10G_IMEZ: 535 + case NETXEN_BRDTYPE_P2_SB31_10G_HMEZ: 536 + if (pci_func_id >= 2) 538 537 adapter->portnum = pci_func_id - 2; 539 - 540 - #ifdef CONFIG_IA64 541 - if(adapter->portnum == 0) { 542 - netxen_pinit_from_rom(adapter, 0); 543 - udelay(500); 544 - netxen_load_firmware(adapter); 538 + break; 539 + default: 540 + break; 545 541 } 546 - #endif 547 542 548 543 init_timer(&adapter->watchdog_timer); 549 544 adapter->ahw.xg_linkup = 0; ··· 614 613 err = -ENODEV; 615 614 goto err_out_free_dev; 616 615 } 616 + } else { 617 + writel(0, NETXEN_CRB_NORMALIZE(adapter, 618 + CRB_CMDPEG_STATE)); 619 + netxen_pinit_from_rom(adapter, 0); 620 + msleep(1); 621 + netxen_load_firmware(adapter); 622 + netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); 617 623 } 618 624 619 625 /* clear the register for future unloads/loads */ 620 626 writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc))); 621 - printk(KERN_INFO "State: 0x%0x\n", 627 + dev_info(&pdev->dev, "cmdpeg state: 0x%0x\n", 622 628 readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE))); 623 629 624 630 /* ··· 647 639 /* 648 640 * See if the firmware gave us a virtual-physical port mapping. 649 641 */ 642 + adapter->physical_port = adapter->portnum; 650 643 i = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_V2P(adapter->portnum))); 651 644 if (i != 0x55555555) 652 - physical_port[adapter->portnum] = i; 645 + adapter->physical_port = i; 653 646 654 647 netif_carrier_off(netdev); 655 648 netif_stop_queue(netdev); ··· 663 654 goto err_out_free_dev; 664 655 } 665 656 657 + netxen_nic_flash_print(adapter); 666 658 pci_set_drvdata(pdev, adapter); 667 - 668 - switch (adapter->ahw.board_type) { 669 - case NETXEN_NIC_GBE: 670 - printk(KERN_INFO "%s: QUAD GbE board initialized\n", 671 - netxen_nic_driver_name); 672 - break; 673 - 674 - case NETXEN_NIC_XGBE: 675 - printk(KERN_INFO "%s: XGbE board initialized\n", 676 - netxen_nic_driver_name); 677 - break; 678 - } 679 - 680 - adapter->driver_mismatch = 0; 681 659 682 660 return 0; 683 661 ··· 756 760 757 761 vfree(adapter->cmd_buf_arr); 758 762 759 - if (adapter->portnum == 0) { 760 - if (init_firmware_done) { 761 - i = 100; 762 - do { 763 - if (dma_watchdog_shutdown_request(adapter) == 1) 764 - break; 765 - msleep(100); 766 - if (dma_watchdog_shutdown_poll_result(adapter) == 1) 767 - break; 768 - } while (--i); 769 - 770 - if (i == 0) 771 - printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n", 772 - netdev->name); 773 - 774 - /* clear the register for future unloads/loads */ 775 - writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc))); 776 - printk(KERN_INFO "State: 0x%0x\n", 777 - readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE))); 778 - 779 - /* leave the hw in the same state as reboot */ 780 - writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); 781 - netxen_pinit_from_rom(adapter, 0); 782 - msleep(1); 783 - netxen_load_firmware(adapter); 784 - netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); 785 - } 786 - 787 - /* clear the register for future unloads/loads */ 788 - writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc))); 789 - printk(KERN_INFO "State: 0x%0x\n", 790 - readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE))); 791 - 792 - i = 100; 793 - do { 794 - if (dma_watchdog_shutdown_request(adapter) == 1) 795 - break; 796 - msleep(100); 797 - if (dma_watchdog_shutdown_poll_result(adapter) == 1) 798 - break; 799 - } while (--i); 800 - 801 - if (i) { 802 - netxen_free_adapter_offload(adapter); 803 - } else { 804 - printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n", 805 - netdev->name); 806 - } 807 - } 763 + if (adapter->portnum == 0) 764 + netxen_free_adapter_offload(adapter); 808 765 809 766 if (adapter->irq) 810 767 free_irq(adapter->irq, adapter); ··· 789 840 irq_handler_t handler; 790 841 unsigned long flags = IRQF_SAMPLE_RANDOM; 791 842 843 + if (adapter->driver_mismatch) 844 + return -EIO; 845 + 792 846 if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC) { 793 847 err = netxen_init_firmware(adapter); 794 848 if (err != 0) { 795 849 printk(KERN_ERR "Failed to init firmware\n"); 796 850 return -EIO; 797 851 } 798 - netxen_nic_flash_print(adapter); 799 852 800 853 /* setup all the resources for the Phantom... */ 801 854 /* this include the descriptors for rcv, tx, and status */ ··· 846 895 if (adapter->set_mtu) 847 896 adapter->set_mtu(adapter, netdev->mtu); 848 897 849 - if (!adapter->driver_mismatch) 850 - mod_timer(&adapter->watchdog_timer, jiffies); 898 + mod_timer(&adapter->watchdog_timer, jiffies); 851 899 852 900 napi_enable(&adapter->napi); 853 901 netxen_nic_enable_int(adapter); 854 902 855 - if (!adapter->driver_mismatch) 856 - netif_start_queue(netdev); 903 + netif_start_queue(netdev); 857 904 858 905 return 0; 859 906 }
+11 -11
drivers/net/netxen/netxen_nic_niu.c
··· 94 94 long timeout = 0; 95 95 long result = 0; 96 96 long restore = 0; 97 - long phy = physical_port[adapter->portnum]; 97 + long phy = adapter->physical_port; 98 98 __u32 address; 99 99 __u32 command; 100 100 __u32 status; ··· 190 190 long timeout = 0; 191 191 long result = 0; 192 192 long restore = 0; 193 - long phy = physical_port[adapter->portnum]; 193 + long phy = adapter->physical_port; 194 194 __u32 address; 195 195 __u32 command; 196 196 __u32 status; ··· 456 456 457 457 int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) 458 458 { 459 - u32 portnum = physical_port[adapter->portnum]; 459 + u32 portnum = adapter->physical_port; 460 460 461 461 netxen_crb_writelit_adapter(adapter, 462 462 NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), 0x1447); ··· 573 573 { 574 574 u32 stationhigh; 575 575 u32 stationlow; 576 - int phy = physical_port[adapter->portnum]; 576 + int phy = adapter->physical_port; 577 577 u8 val[8]; 578 578 579 579 if (addr == NULL) ··· 604 604 { 605 605 u8 temp[4]; 606 606 u32 val; 607 - int phy = physical_port[adapter->portnum]; 607 + int phy = adapter->physical_port; 608 608 unsigned char mac_addr[6]; 609 609 int i; 610 610 DECLARE_MAC_BUF(mac); ··· 724 724 int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter) 725 725 { 726 726 __u32 mac_cfg0; 727 - u32 port = physical_port[adapter->portnum]; 727 + u32 port = adapter->physical_port; 728 728 729 729 if (port > NETXEN_NIU_MAX_GBE_PORTS) 730 730 return -EINVAL; ··· 740 740 int netxen_niu_disable_xg_port(struct netxen_adapter *adapter) 741 741 { 742 742 __u32 mac_cfg; 743 - u32 port = physical_port[adapter->portnum]; 743 + u32 port = adapter->physical_port; 744 744 745 745 if (port > NETXEN_NIU_MAX_XG_PORTS) 746 746 return -EINVAL; ··· 757 757 netxen_niu_prom_mode_t mode) 758 758 { 759 759 __u32 reg; 760 - u32 port = physical_port[adapter->portnum]; 760 + u32 port = adapter->physical_port; 761 761 762 762 if (port > NETXEN_NIU_MAX_GBE_PORTS) 763 763 return -EINVAL; ··· 814 814 int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter, 815 815 netxen_ethernet_macaddr_t addr) 816 816 { 817 - int phy = physical_port[adapter->portnum]; 817 + int phy = adapter->physical_port; 818 818 u8 temp[4]; 819 819 u32 val; 820 820 ··· 867 867 int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, 868 868 netxen_ethernet_macaddr_t * addr) 869 869 { 870 - int phy = physical_port[adapter->portnum]; 870 + int phy = adapter->physical_port; 871 871 u32 stationhigh; 872 872 u32 stationlow; 873 873 u8 val[8]; ··· 896 896 netxen_niu_prom_mode_t mode) 897 897 { 898 898 __u32 reg; 899 - u32 port = physical_port[adapter->portnum]; 899 + u32 port = adapter->physical_port; 900 900 901 901 if (port > NETXEN_NIU_MAX_XG_PORTS) 902 902 return -EINVAL;
+1
drivers/net/sky2.c
··· 118 118 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4352) }, /* 88E8038 */ 119 119 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4353) }, /* 88E8039 */ 120 120 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4354) }, /* 88E8040 */ 121 + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4355) }, /* 88E8040T */ 121 122 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4356) }, /* 88EC033 */ 122 123 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4357) }, /* 88E8042 */ 123 124 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x435A) }, /* 88E8048 */
+15
drivers/net/tun.c
··· 313 313 314 314 switch (tun->flags & TUN_TYPE_MASK) { 315 315 case TUN_TUN_DEV: 316 + if (tun->flags & TUN_NO_PI) { 317 + switch (skb->data[0] & 0xf0) { 318 + case 0x40: 319 + pi.proto = htons(ETH_P_IP); 320 + break; 321 + case 0x60: 322 + pi.proto = htons(ETH_P_IPV6); 323 + break; 324 + default: 325 + tun->dev->stats.rx_dropped++; 326 + kfree_skb(skb); 327 + return -EINVAL; 328 + } 329 + } 330 + 316 331 skb_reset_mac_header(skb); 317 332 skb->protocol = pi.proto; 318 333 skb->dev = tun->dev;
-1
drivers/net/wireless/b43/b43.h
··· 630 630 631 631 /* Context information for a noise calculation (Link Quality). */ 632 632 struct b43_noise_calculation { 633 - u8 channel_at_start; 634 633 bool calculation_running; 635 634 u8 nr_samples; 636 635 s8 samples[8][4];
+46 -47
drivers/net/wireless/b43/dma.c
··· 795 795 { 796 796 struct b43_dmaring *ring; 797 797 int err; 798 - int nr_slots; 799 798 dma_addr_t dma_test; 800 799 801 800 ring = kzalloc(sizeof(*ring), GFP_KERNEL); 802 801 if (!ring) 803 802 goto out; 804 - ring->type = type; 805 803 806 - nr_slots = B43_RXRING_SLOTS; 804 + ring->nr_slots = B43_RXRING_SLOTS; 807 805 if (for_tx) 808 - nr_slots = B43_TXRING_SLOTS; 806 + ring->nr_slots = B43_TXRING_SLOTS; 809 807 810 - ring->meta = kcalloc(nr_slots, sizeof(struct b43_dmadesc_meta), 808 + ring->meta = kcalloc(ring->nr_slots, sizeof(struct b43_dmadesc_meta), 811 809 GFP_KERNEL); 812 810 if (!ring->meta) 813 811 goto err_kfree_ring; 814 - if (for_tx) { 815 - ring->txhdr_cache = kcalloc(nr_slots, 816 - b43_txhdr_size(dev), 817 - GFP_KERNEL); 818 - if (!ring->txhdr_cache) 819 - goto err_kfree_meta; 820 812 821 - /* test for ability to dma to txhdr_cache */ 822 - dma_test = dma_map_single(dev->dev->dma_dev, 823 - ring->txhdr_cache, 824 - b43_txhdr_size(dev), 825 - DMA_TO_DEVICE); 826 - 827 - if (b43_dma_mapping_error(ring, dma_test, 828 - b43_txhdr_size(dev), 1)) { 829 - /* ugh realloc */ 830 - kfree(ring->txhdr_cache); 831 - ring->txhdr_cache = kcalloc(nr_slots, 832 - b43_txhdr_size(dev), 833 - GFP_KERNEL | GFP_DMA); 834 - if (!ring->txhdr_cache) 835 - goto err_kfree_meta; 836 - 837 - dma_test = dma_map_single(dev->dev->dma_dev, 838 - ring->txhdr_cache, 839 - b43_txhdr_size(dev), 840 - DMA_TO_DEVICE); 841 - 842 - if (b43_dma_mapping_error(ring, dma_test, 843 - b43_txhdr_size(dev), 1)) { 844 - 845 - b43err(dev->wl, 846 - "TXHDR DMA allocation failed\n"); 847 - goto err_kfree_txhdr_cache; 848 - } 849 - } 850 - 851 - dma_unmap_single(dev->dev->dma_dev, 852 - dma_test, b43_txhdr_size(dev), 853 - DMA_TO_DEVICE); 854 - } 855 - 813 + ring->type = type; 856 814 ring->dev = dev; 857 - ring->nr_slots = nr_slots; 858 815 ring->mmio_base = b43_dmacontroller_base(type, controller_index); 859 816 ring->index = controller_index; 860 817 if (type == B43_DMA_64BIT) ··· 835 878 #ifdef CONFIG_B43_DEBUG 836 879 ring->last_injected_overflow = jiffies; 837 880 #endif 881 + 882 + if (for_tx) { 883 + ring->txhdr_cache = kcalloc(ring->nr_slots, 884 + b43_txhdr_size(dev), 885 + GFP_KERNEL); 886 + if (!ring->txhdr_cache) 887 + goto err_kfree_meta; 888 + 889 + /* test for ability to dma to txhdr_cache */ 890 + dma_test = dma_map_single(dev->dev->dma_dev, 891 + ring->txhdr_cache, 892 + b43_txhdr_size(dev), 893 + DMA_TO_DEVICE); 894 + 895 + if (b43_dma_mapping_error(ring, dma_test, 896 + b43_txhdr_size(dev), 1)) { 897 + /* ugh realloc */ 898 + kfree(ring->txhdr_cache); 899 + ring->txhdr_cache = kcalloc(ring->nr_slots, 900 + b43_txhdr_size(dev), 901 + GFP_KERNEL | GFP_DMA); 902 + if (!ring->txhdr_cache) 903 + goto err_kfree_meta; 904 + 905 + dma_test = dma_map_single(dev->dev->dma_dev, 906 + ring->txhdr_cache, 907 + b43_txhdr_size(dev), 908 + DMA_TO_DEVICE); 909 + 910 + if (b43_dma_mapping_error(ring, dma_test, 911 + b43_txhdr_size(dev), 1)) { 912 + 913 + b43err(dev->wl, 914 + "TXHDR DMA allocation failed\n"); 915 + goto err_kfree_txhdr_cache; 916 + } 917 + } 918 + 919 + dma_unmap_single(dev->dev->dma_dev, 920 + dma_test, b43_txhdr_size(dev), 921 + DMA_TO_DEVICE); 922 + } 838 923 839 924 err = alloc_ringmemory(ring); 840 925 if (err)
+10 -6
drivers/net/wireless/b43/main.c
··· 1145 1145 b43_jssi_write(dev, 0x7F7F7F7F); 1146 1146 b43_write32(dev, B43_MMIO_MACCMD, 1147 1147 b43_read32(dev, B43_MMIO_MACCMD) | B43_MACCMD_BGNOISE); 1148 - B43_WARN_ON(dev->noisecalc.channel_at_start != dev->phy.channel); 1149 1148 } 1150 1149 1151 1150 static void b43_calculate_link_quality(struct b43_wldev *dev) ··· 1153 1154 1154 1155 if (dev->noisecalc.calculation_running) 1155 1156 return; 1156 - dev->noisecalc.channel_at_start = dev->phy.channel; 1157 1157 dev->noisecalc.calculation_running = 1; 1158 1158 dev->noisecalc.nr_samples = 0; 1159 1159 ··· 1169 1171 1170 1172 /* Bottom half of Link Quality calculation. */ 1171 1173 1174 + /* Possible race condition: It might be possible that the user 1175 + * changed to a different channel in the meantime since we 1176 + * started the calculation. We ignore that fact, since it's 1177 + * not really that much of a problem. The background noise is 1178 + * an estimation only anyway. Slightly wrong results will get damped 1179 + * by the averaging of the 8 sample rounds. Additionally the 1180 + * value is shortlived. So it will be replaced by the next noise 1181 + * calculation round soon. */ 1182 + 1172 1183 B43_WARN_ON(!dev->noisecalc.calculation_running); 1173 - if (dev->noisecalc.channel_at_start != phy->channel) 1174 - goto drop_calculation; 1175 1184 *((__le32 *)noise) = cpu_to_le32(b43_jssi_read(dev)); 1176 1185 if (noise[0] == 0x7F || noise[1] == 0x7F || 1177 1186 noise[2] == 0x7F || noise[3] == 0x7F) ··· 1219 1214 average -= 48; 1220 1215 1221 1216 dev->stats.link_noise = average; 1222 - drop_calculation: 1223 1217 dev->noisecalc.calculation_running = 0; 1224 1218 return; 1225 1219 } 1226 - generate_new: 1220 + generate_new: 1227 1221 b43_generate_noise_sample(dev); 1228 1222 } 1229 1223
+10 -9
drivers/net/wireless/rt2x00/Kconfig
··· 32 32 config RT2X00_LIB_RFKILL 33 33 boolean 34 34 depends on RT2X00_LIB 35 + depends on INPUT 35 36 select RFKILL 36 37 select INPUT_POLLDEV 37 38 38 39 config RT2X00_LIB_LEDS 39 40 boolean 40 - depends on RT2X00_LIB 41 + depends on RT2X00_LIB && NEW_LEDS 41 42 42 43 config RT2400PCI 43 44 tristate "Ralink rt2400 pci/pcmcia support" ··· 52 51 53 52 config RT2400PCI_RFKILL 54 53 bool "RT2400 rfkill support" 55 - depends on RT2400PCI 54 + depends on RT2400PCI && INPUT 56 55 select RT2X00_LIB_RFKILL 57 56 ---help--- 58 57 This adds support for integrated rt2400 devices that feature a ··· 61 60 62 61 config RT2400PCI_LEDS 63 62 bool "RT2400 leds support" 64 - depends on RT2400PCI 63 + depends on RT2400PCI && NEW_LEDS 65 64 select LEDS_CLASS 66 65 select RT2X00_LIB_LEDS 67 66 ---help--- ··· 79 78 80 79 config RT2500PCI_RFKILL 81 80 bool "RT2500 rfkill support" 82 - depends on RT2500PCI 81 + depends on RT2500PCI && INPUT 83 82 select RT2X00_LIB_RFKILL 84 83 ---help--- 85 84 This adds support for integrated rt2500 devices that feature a ··· 88 87 89 88 config RT2500PCI_LEDS 90 89 bool "RT2500 leds support" 91 - depends on RT2500PCI 90 + depends on RT2500PCI && NEW_LEDS 92 91 select LEDS_CLASS 93 92 select RT2X00_LIB_LEDS 94 93 ---help--- ··· 108 107 109 108 config RT61PCI_RFKILL 110 109 bool "RT61 rfkill support" 111 - depends on RT61PCI 110 + depends on RT61PCI && INPUT 112 111 select RT2X00_LIB_RFKILL 113 112 ---help--- 114 113 This adds support for integrated rt61 devices that feature a ··· 117 116 118 117 config RT61PCI_LEDS 119 118 bool "RT61 leds support" 120 - depends on RT61PCI 119 + depends on RT61PCI && NEW_LEDS 121 120 select LEDS_CLASS 122 121 select RT2X00_LIB_LEDS 123 122 ---help--- ··· 134 133 135 134 config RT2500USB_LEDS 136 135 bool "RT2500 leds support" 137 - depends on RT2500USB 136 + depends on RT2500USB && NEW_LEDS 138 137 select LEDS_CLASS 139 138 select RT2X00_LIB_LEDS 140 139 ---help--- ··· 153 152 154 153 config RT73USB_LEDS 155 154 bool "RT73 leds support" 156 - depends on RT73USB 155 + depends on RT73USB && NEW_LEDS 157 156 select LEDS_CLASS 158 157 select RT2X00_LIB_LEDS 159 158 ---help---
+1 -2
drivers/net/wireless/rt2x00/rt2x00pci.c
··· 412 412 if (pci_set_mwi(pci_dev)) 413 413 ERROR_PROBE("MWI not available.\n"); 414 414 415 - if (pci_set_dma_mask(pci_dev, DMA_64BIT_MASK) && 416 - pci_set_dma_mask(pci_dev, DMA_32BIT_MASK)) { 415 + if (pci_set_dma_mask(pci_dev, DMA_32BIT_MASK)) { 417 416 ERROR_PROBE("PCI DMA not supported.\n"); 418 417 retval = -EIO; 419 418 goto exit_disable_device;
+6
drivers/net/wireless/rt2x00/rt2x00usb.c
··· 362 362 } 363 363 } 364 364 365 + /* 366 + * Kill guardian urb (if required by driver). 367 + */ 368 + if (!test_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags)) 369 + return; 370 + 365 371 for (i = 0; i < rt2x00dev->bcn->limit; i++) { 366 372 priv_bcn = rt2x00dev->bcn->entries[i].priv_data; 367 373 usb_kill_urb(priv_bcn->urb);
+1
drivers/net/wireless/rt2x00/rt73usb.c
··· 2131 2131 /* D-Link */ 2132 2132 { USB_DEVICE(0x07d1, 0x3c03), USB_DEVICE_DATA(&rt73usb_ops) }, 2133 2133 { USB_DEVICE(0x07d1, 0x3c04), USB_DEVICE_DATA(&rt73usb_ops) }, 2134 + { USB_DEVICE(0x07d1, 0x3c06), USB_DEVICE_DATA(&rt73usb_ops) }, 2134 2135 { USB_DEVICE(0x07d1, 0x3c07), USB_DEVICE_DATA(&rt73usb_ops) }, 2135 2136 /* Gemtek */ 2136 2137 { USB_DEVICE(0x15a9, 0x0004), USB_DEVICE_DATA(&rt73usb_ops) },
+9 -3
drivers/ssb/main.c
··· 1168 1168 int ssb_dma_set_mask(struct ssb_device *ssb_dev, u64 mask) 1169 1169 { 1170 1170 struct device *dma_dev = ssb_dev->dma_dev; 1171 + int err = 0; 1171 1172 1172 1173 #ifdef CONFIG_SSB_PCIHOST 1173 - if (ssb_dev->bus->bustype == SSB_BUSTYPE_PCI) 1174 - return dma_set_mask(dma_dev, mask); 1174 + if (ssb_dev->bus->bustype == SSB_BUSTYPE_PCI) { 1175 + err = pci_set_dma_mask(ssb_dev->bus->host_pci, mask); 1176 + if (err) 1177 + return err; 1178 + err = pci_set_consistent_dma_mask(ssb_dev->bus->host_pci, mask); 1179 + return err; 1180 + } 1175 1181 #endif 1176 1182 dma_dev->coherent_dma_mask = mask; 1177 1183 dma_dev->dma_mask = &dma_dev->coherent_dma_mask; 1178 1184 1179 - return 0; 1185 + return err; 1180 1186 } 1181 1187 EXPORT_SYMBOL(ssb_dma_set_mask); 1182 1188
+1 -1
include/linux/if_tunnel.h
··· 41 41 __u16 __reserved; 42 42 __u32 datalen; 43 43 __u32 __reserved2; 44 - void __user *data; 44 + /* data follows */ 45 45 }; 46 46 47 47 /* PRL flags */
+1
include/net/netfilter/nf_conntrack_extend.h
··· 15 15 16 16 /* Extensions: optional stuff which isn't permanently in struct. */ 17 17 struct nf_ct_ext { 18 + struct rcu_head rcu; 18 19 u8 offset[NF_CT_EXT_NUM]; 19 20 u8 len; 20 21 char data[0];
+45 -33
net/atm/br2684.c
··· 188 188 return 0; 189 189 } 190 190 } 191 - } else { 192 - skb_push(skb, 2); 193 - if (brdev->payload == p_bridged) 191 + } else { /* e_vc */ 192 + if (brdev->payload == p_bridged) { 193 + skb_push(skb, 2); 194 194 memset(skb->data, 0, 2); 195 + } else { /* p_routed */ 196 + skb_pull(skb, ETH_HLEN); 197 + } 195 198 } 196 199 skb_debug(skb); 197 200 ··· 380 377 (skb->data + 6, ethertype_ipv4, 381 378 sizeof(ethertype_ipv4)) == 0) 382 379 skb->protocol = __constant_htons(ETH_P_IP); 383 - else { 384 - brdev->stats.rx_errors++; 385 - dev_kfree_skb(skb); 386 - return; 387 - } 380 + else 381 + goto error; 388 382 skb_pull(skb, sizeof(llc_oui_ipv4)); 389 383 skb_reset_network_header(skb); 390 384 skb->pkt_type = PACKET_HOST; ··· 394 394 (memcmp(skb->data, llc_oui_pid_pad, 7) == 0)) { 395 395 skb_pull(skb, sizeof(llc_oui_pid_pad)); 396 396 skb->protocol = eth_type_trans(skb, net_dev); 397 - } else { 398 - brdev->stats.rx_errors++; 399 - dev_kfree_skb(skb); 400 - return; 401 - } 397 + } else 398 + goto error; 402 399 403 - } else { 404 - /* first 2 chars should be 0 */ 405 - if (*((u16 *) (skb->data)) != 0) { 406 - brdev->stats.rx_errors++; 407 - dev_kfree_skb(skb); 408 - return; 400 + } else { /* e_vc */ 401 + if (brdev->payload == p_routed) { 402 + struct iphdr *iph; 403 + 404 + skb_reset_network_header(skb); 405 + iph = ip_hdr(skb); 406 + if (iph->version == 4) 407 + skb->protocol = __constant_htons(ETH_P_IP); 408 + else if (iph->version == 6) 409 + skb->protocol = __constant_htons(ETH_P_IPV6); 410 + else 411 + goto error; 412 + skb->pkt_type = PACKET_HOST; 413 + } else { /* p_bridged */ 414 + /* first 2 chars should be 0 */ 415 + if (*((u16 *) (skb->data)) != 0) 416 + goto error; 417 + skb_pull(skb, BR2684_PAD_LEN); 418 + skb->protocol = eth_type_trans(skb, net_dev); 409 419 } 410 - skb_pull(skb, BR2684_PAD_LEN + ETH_HLEN); /* pad, dstmac, srcmac, ethtype */ 411 - skb->protocol = eth_type_trans(skb, net_dev); 412 420 } 413 421 414 422 #ifdef CONFIG_ATM_BR2684_IPFILTER 415 - if (unlikely(packet_fails_filter(skb->protocol, brvcc, skb))) { 416 - brdev->stats.rx_dropped++; 417 - dev_kfree_skb(skb); 418 - return; 419 - } 423 + if (unlikely(packet_fails_filter(skb->protocol, brvcc, skb))) 424 + goto dropped; 420 425 #endif /* CONFIG_ATM_BR2684_IPFILTER */ 421 426 skb->dev = net_dev; 422 427 ATM_SKB(skb)->vcc = atmvcc; /* needed ? */ 423 428 pr_debug("received packet's protocol: %x\n", ntohs(skb->protocol)); 424 429 skb_debug(skb); 425 - if (unlikely(!(net_dev->flags & IFF_UP))) { 426 - /* sigh, interface is down */ 427 - brdev->stats.rx_dropped++; 428 - dev_kfree_skb(skb); 429 - return; 430 - } 430 + /* sigh, interface is down? */ 431 + if (unlikely(!(net_dev->flags & IFF_UP))) 432 + goto dropped; 431 433 brdev->stats.rx_packets++; 432 434 brdev->stats.rx_bytes += skb->len; 433 435 memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data)); 434 436 netif_rx(skb); 437 + return; 438 + 439 + dropped: 440 + brdev->stats.rx_dropped++; 441 + goto free_skb; 442 + error: 443 + brdev->stats.rx_errors++; 444 + free_skb: 445 + dev_kfree_skb(skb); 446 + return; 435 447 } 436 448 437 449 /* ··· 530 518 struct sk_buff *next = skb->next; 531 519 532 520 skb->next = skb->prev = NULL; 521 + br2684_push(atmvcc, skb); 533 522 BRPRIV(skb->dev)->stats.rx_bytes -= skb->len; 534 523 BRPRIV(skb->dev)->stats.rx_packets--; 535 - br2684_push(atmvcc, skb); 536 524 537 525 skb = next; 538 526 }
+26 -8
net/core/dev.c
··· 119 119 #include <linux/err.h> 120 120 #include <linux/ctype.h> 121 121 #include <linux/if_arp.h> 122 + #include <linux/if_vlan.h> 122 123 123 124 #include "net-sysfs.h" 124 125 ··· 1363 1362 } 1364 1363 EXPORT_SYMBOL(netif_device_attach); 1365 1364 1365 + static bool can_checksum_protocol(unsigned long features, __be16 protocol) 1366 + { 1367 + return ((features & NETIF_F_GEN_CSUM) || 1368 + ((features & NETIF_F_IP_CSUM) && 1369 + protocol == htons(ETH_P_IP)) || 1370 + ((features & NETIF_F_IPV6_CSUM) && 1371 + protocol == htons(ETH_P_IPV6))); 1372 + } 1373 + 1374 + static bool dev_can_checksum(struct net_device *dev, struct sk_buff *skb) 1375 + { 1376 + if (can_checksum_protocol(dev->features, skb->protocol)) 1377 + return true; 1378 + 1379 + if (skb->protocol == htons(ETH_P_8021Q)) { 1380 + struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; 1381 + if (can_checksum_protocol(dev->features & dev->vlan_features, 1382 + veh->h_vlan_encapsulated_proto)) 1383 + return true; 1384 + } 1385 + 1386 + return false; 1387 + } 1366 1388 1367 1389 /* 1368 1390 * Invalidate hardware checksum when packet is to be mangled, and ··· 1664 1640 if (skb->ip_summed == CHECKSUM_PARTIAL) { 1665 1641 skb_set_transport_header(skb, skb->csum_start - 1666 1642 skb_headroom(skb)); 1667 - 1668 - if (!(dev->features & NETIF_F_GEN_CSUM) && 1669 - !((dev->features & NETIF_F_IP_CSUM) && 1670 - skb->protocol == htons(ETH_P_IP)) && 1671 - !((dev->features & NETIF_F_IPV6_CSUM) && 1672 - skb->protocol == htons(ETH_P_IPV6))) 1673 - if (skb_checksum_help(skb)) 1674 - goto out_kfree_skb; 1643 + if (!dev_can_checksum(dev, skb) && skb_checksum_help(skb)) 1644 + goto out_kfree_skb; 1675 1645 } 1676 1646 1677 1647 gso:
+3 -3
net/ipv4/inet_connection_sock.c
··· 466 466 reqp=&lopt->syn_table[i]; 467 467 while ((req = *reqp) != NULL) { 468 468 if (time_after_eq(now, req->expires)) { 469 - if ((req->retrans < (inet_rsk(req)->acked ? max_retries : thresh)) && 470 - (inet_rsk(req)->acked || 471 - !req->rsk_ops->rtx_syn_ack(parent, req))) { 469 + if ((req->retrans < thresh || 470 + (inet_rsk(req)->acked && req->retrans < max_retries)) 471 + && !req->rsk_ops->rtx_syn_ack(parent, req)) { 472 472 unsigned long timeo; 473 473 474 474 if (req->retrans++ == 0)
+1 -2
net/ipv4/netfilter/nf_nat_core.c
··· 556 556 557 557 spin_lock_bh(&nf_nat_lock); 558 558 hlist_del_rcu(&nat->bysource); 559 - nat->ct = NULL; 560 559 spin_unlock_bh(&nf_nat_lock); 561 560 } 562 561 ··· 569 570 return; 570 571 571 572 spin_lock_bh(&nf_nat_lock); 572 - hlist_replace_rcu(&old_nat->bysource, &new_nat->bysource); 573 573 new_nat->ct = ct; 574 + hlist_replace_rcu(&old_nat->bysource, &new_nat->bysource); 574 575 spin_unlock_bh(&nf_nat_lock); 575 576 } 576 577
+1 -1
net/ipv4/raw.c
··· 934 934 srcp = inet->num; 935 935 936 936 seq_printf(seq, "%4d: %08X:%04X %08X:%04X" 937 - " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d", 937 + " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n", 938 938 i, src, srcp, dest, destp, sp->sk_state, 939 939 atomic_read(&sp->sk_wmem_alloc), 940 940 atomic_read(&sp->sk_rmem_alloc),
-4
net/ipv4/tcp_ipv4.c
··· 85 85 int sysctl_tcp_tw_reuse __read_mostly; 86 86 int sysctl_tcp_low_latency __read_mostly; 87 87 88 - /* Check TCP sequence numbers in ICMP packets. */ 89 - #define ICMP_MIN_LENGTH 8 90 - 91 - void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb); 92 88 93 89 #ifdef CONFIG_TCP_MD5SIG 94 90 static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk,
+1 -1
net/ipv4/xfrm4_mode_tunnel.c
··· 52 52 IP_ECN_clear(top_iph); 53 53 54 54 top_iph->frag_off = (flags & XFRM_STATE_NOPMTUDISC) ? 55 - 0 : XFRM_MODE_SKB_CB(skb)->frag_off; 55 + 0 : (XFRM_MODE_SKB_CB(skb)->frag_off & htons(IP_DF)); 56 56 ip_select_ident(top_iph, dst->child, NULL); 57 57 58 58 top_iph->ttl = dst_metric(dst->child, RTAX_HOPLIMIT);
+24 -20
net/ipv6/sit.c
··· 222 222 223 223 } 224 224 225 - static int ipip6_tunnel_get_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a) 225 + static int ipip6_tunnel_get_prl(struct ip_tunnel *t, 226 + struct ip_tunnel_prl __user *a) 226 227 { 227 - struct ip_tunnel_prl *kp; 228 + struct ip_tunnel_prl kprl, *kp; 228 229 struct ip_tunnel_prl_entry *prl; 229 230 unsigned int cmax, c = 0, ca, len; 230 231 int ret = 0; 231 232 232 - cmax = a->datalen / sizeof(*a); 233 - if (cmax > 1 && a->addr != htonl(INADDR_ANY)) 233 + if (copy_from_user(&kprl, a, sizeof(kprl))) 234 + return -EFAULT; 235 + cmax = kprl.datalen / sizeof(kprl); 236 + if (cmax > 1 && kprl.addr != htonl(INADDR_ANY)) 234 237 cmax = 1; 235 238 236 239 /* For simple GET or for root users, ··· 264 261 for (prl = t->prl; prl; prl = prl->next) { 265 262 if (c > cmax) 266 263 break; 267 - if (a->addr != htonl(INADDR_ANY) && prl->addr != a->addr) 264 + if (kprl.addr != htonl(INADDR_ANY) && prl->addr != kprl.addr) 268 265 continue; 269 266 kp[c].addr = prl->addr; 270 267 kp[c].flags = prl->flags; 271 268 c++; 272 - if (a->addr != htonl(INADDR_ANY)) 269 + if (kprl.addr != htonl(INADDR_ANY)) 273 270 break; 274 271 } 275 272 out: 276 273 read_unlock(&ipip6_lock); 277 274 278 275 len = sizeof(*kp) * c; 279 - ret = len ? copy_to_user(a->data, kp, len) : 0; 276 + ret = 0; 277 + if ((len && copy_to_user(a + 1, kp, len)) || put_user(len, &a->datalen)) 278 + ret = -EFAULT; 280 279 281 280 kfree(kp); 282 - if (ret) 283 - return -EFAULT; 284 281 285 - a->datalen = len; 286 - return 0; 282 + return ret; 287 283 } 288 284 289 285 static int ··· 875 873 break; 876 874 877 875 case SIOCGETPRL: 876 + err = -EINVAL; 877 + if (dev == sitn->fb_tunnel_dev) 878 + goto done; 879 + err = -ENOENT; 880 + if (!(t = netdev_priv(dev))) 881 + goto done; 882 + err = ipip6_tunnel_get_prl(t, ifr->ifr_ifru.ifru_data); 883 + break; 884 + 878 885 case SIOCADDPRL: 879 886 case SIOCDELPRL: 880 887 case SIOCCHGPRL: 881 888 err = -EPERM; 882 - if (cmd != SIOCGETPRL && !capable(CAP_NET_ADMIN)) 889 + if (!capable(CAP_NET_ADMIN)) 883 890 goto done; 884 891 err = -EINVAL; 885 892 if (dev == sitn->fb_tunnel_dev) ··· 901 890 goto done; 902 891 903 892 switch (cmd) { 904 - case SIOCGETPRL: 905 - err = ipip6_tunnel_get_prl(t, &prl); 906 - if (!err && copy_to_user(ifr->ifr_ifru.ifru_data, 907 - &prl, sizeof(prl))) 908 - err = -EFAULT; 909 - break; 910 893 case SIOCDELPRL: 911 894 err = ipip6_tunnel_del_prl(t, &prl); 912 895 break; ··· 909 904 err = ipip6_tunnel_add_prl(t, &prl, cmd == SIOCCHGPRL); 910 905 break; 911 906 } 912 - if (cmd != SIOCGETPRL) 913 - netdev_state_change(dev); 907 + netdev_state_change(dev); 914 908 break; 915 909 916 910 default:
+2 -2
net/mac80211/tx.c
··· 1562 1562 * be cloned. This could happen, e.g., with Linux bridge code passing 1563 1563 * us broadcast frames. */ 1564 1564 1565 - if (head_need > 0 || skb_header_cloned(skb)) { 1565 + if (head_need > 0 || skb_cloned(skb)) { 1566 1566 #if 0 1567 1567 printk(KERN_DEBUG "%s: need to reallocate buffer for %d bytes " 1568 1568 "of headroom\n", dev->name, head_need); 1569 1569 #endif 1570 1570 1571 - if (skb_header_cloned(skb)) 1571 + if (skb_cloned(skb)) 1572 1572 I802_DEBUG_INC(local->tx_expand_skb_head_cloned); 1573 1573 else 1574 1574 I802_DEBUG_INC(local->tx_expand_skb_head);
+2 -1
net/mac80211/wext.c
··· 496 496 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 497 497 if (sdata->vif.type == IEEE80211_IF_TYPE_STA || 498 498 sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { 499 - if (sdata->u.sta.state == IEEE80211_ASSOCIATED) { 499 + if (sdata->u.sta.state == IEEE80211_ASSOCIATED || 500 + sdata->u.sta.state == IEEE80211_IBSS_JOINED) { 500 501 ap_addr->sa_family = ARPHRD_ETHER; 501 502 memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN); 502 503 return 0;
+1 -1
net/mac80211/wme.c
··· 673 673 #ifdef CONFIG_MAC80211_HT_DEBUG 674 674 if (net_ratelimit()) 675 675 printk(KERN_DEBUG "allocated aggregation queue" 676 - " %d tid %d addr %s pool=0x%lX", 676 + " %d tid %d addr %s pool=0x%lX\n", 677 677 i, tid, print_mac(mac, sta->addr), 678 678 q->qdisc_pool[0]); 679 679 #endif /* CONFIG_MAC80211_HT_DEBUG */
+8 -1
net/netfilter/nf_conntrack_extend.c
··· 59 59 if (!*ext) 60 60 return NULL; 61 61 62 + INIT_RCU_HEAD(&(*ext)->rcu); 62 63 (*ext)->offset[id] = off; 63 64 (*ext)->len = len; 64 65 65 66 return (void *)(*ext) + off; 67 + } 68 + 69 + static void __nf_ct_ext_free_rcu(struct rcu_head *head) 70 + { 71 + struct nf_ct_ext *ext = container_of(head, struct nf_ct_ext, rcu); 72 + kfree(ext); 66 73 } 67 74 68 75 void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp) ··· 113 106 (void *)ct->ext + ct->ext->offset[i]); 114 107 rcu_read_unlock(); 115 108 } 116 - kfree(ct->ext); 109 + call_rcu(&ct->ext->rcu, __nf_ct_ext_free_rcu); 117 110 ct->ext = new; 118 111 } 119 112
+15 -7
net/netfilter/nf_conntrack_h323_main.c
··· 619 619 static struct nf_conntrack_helper nf_conntrack_helper_h245 __read_mostly = { 620 620 .name = "H.245", 621 621 .me = THIS_MODULE, 622 + .tuple.src.l3num = AF_UNSPEC, 622 623 .tuple.dst.protonum = IPPROTO_UDP, 623 624 .help = h245_help, 624 625 .expect_policy = &h245_exp_policy, ··· 1766 1765 nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[0]); 1767 1766 nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]); 1768 1767 nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]); 1768 + nf_conntrack_helper_unregister(&nf_conntrack_helper_h245); 1769 1769 kfree(h323_buffer); 1770 1770 pr_debug("nf_ct_h323: fini\n"); 1771 1771 } ··· 1779 1777 h323_buffer = kmalloc(65536, GFP_KERNEL); 1780 1778 if (!h323_buffer) 1781 1779 return -ENOMEM; 1782 - ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[0]); 1780 + ret = nf_conntrack_helper_register(&nf_conntrack_helper_h245); 1783 1781 if (ret < 0) 1784 1782 goto err1; 1785 - ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[1]); 1783 + ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[0]); 1786 1784 if (ret < 0) 1787 1785 goto err2; 1788 - ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[0]); 1786 + ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[1]); 1789 1787 if (ret < 0) 1790 1788 goto err3; 1791 - ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[1]); 1789 + ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[0]); 1792 1790 if (ret < 0) 1793 1791 goto err4; 1792 + ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[1]); 1793 + if (ret < 0) 1794 + goto err5; 1794 1795 pr_debug("nf_ct_h323: init success\n"); 1795 1796 return 0; 1796 1797 1797 - err4: 1798 + err5: 1798 1799 nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[0]); 1799 - err3: 1800 + err4: 1800 1801 nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]); 1801 - err2: 1802 + err3: 1802 1803 nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]); 1804 + err2: 1805 + nf_conntrack_helper_unregister(&nf_conntrack_helper_h245); 1803 1806 err1: 1807 + kfree(h323_buffer); 1804 1808 return ret; 1805 1809 } 1806 1810
+6 -9
net/netlink/genetlink.c
··· 444 444 if (ops->dumpit == NULL) 445 445 return -EOPNOTSUPP; 446 446 447 - return netlink_dump_start(genl_sock, skb, nlh, 448 - ops->dumpit, ops->done); 447 + genl_unlock(); 448 + err = netlink_dump_start(genl_sock, skb, nlh, 449 + ops->dumpit, ops->done); 450 + genl_lock(); 451 + return err; 449 452 } 450 453 451 454 if (ops->doit == NULL) ··· 606 603 int chains_to_skip = cb->args[0]; 607 604 int fams_to_skip = cb->args[1]; 608 605 609 - if (chains_to_skip != 0) 610 - genl_lock(); 611 - 612 606 for (i = 0; i < GENL_FAM_TAB_SIZE; i++) { 613 607 if (i < chains_to_skip) 614 608 continue; ··· 623 623 } 624 624 625 625 errout: 626 - if (chains_to_skip != 0) 627 - genl_unlock(); 628 - 629 626 cb->args[0] = i; 630 627 cb->args[1] = n; 631 628 ··· 767 770 768 771 /* we'll bump the group number right afterwards */ 769 772 genl_sock = netlink_kernel_create(&init_net, NETLINK_GENERIC, 0, 770 - genl_rcv, NULL, THIS_MODULE); 773 + genl_rcv, &genl_mutex, THIS_MODULE); 771 774 if (genl_sock == NULL) 772 775 panic("GENL: Cannot initialize generic netlink\n"); 773 776
+15 -8
net/sched/sch_htb.c
··· 28 28 * $Id: sch_htb.c,v 1.25 2003/12/07 11:08:25 devik Exp devik $ 29 29 */ 30 30 #include <linux/module.h> 31 + #include <linux/moduleparam.h> 31 32 #include <linux/types.h> 32 33 #include <linux/kernel.h> 33 34 #include <linux/string.h> ··· 54 53 */ 55 54 56 55 #define HTB_HSIZE 16 /* classid hash size */ 57 - #define HTB_HYSTERESIS 1 /* whether to use mode hysteresis for speedup */ 56 + static int htb_hysteresis __read_mostly = 0; /* whether to use mode hysteresis for speedup */ 58 57 #define HTB_VER 0x30011 /* major must be matched with number suplied by TC as version */ 59 58 60 59 #if HTB_VER >> 16 != TC_HTB_PROTOVER 61 60 #error "Mismatched sch_htb.c and pkt_sch.h" 62 61 #endif 62 + 63 + /* Module parameter and sysfs export */ 64 + module_param (htb_hysteresis, int, 0640); 65 + MODULE_PARM_DESC(htb_hysteresis, "Hysteresis mode, less CPU load, less accurate"); 63 66 64 67 /* used internaly to keep status of single class */ 65 68 enum htb_cmode { ··· 467 462 htb_remove_class_from_row(q, cl, mask); 468 463 } 469 464 470 - #if HTB_HYSTERESIS 471 465 static inline long htb_lowater(const struct htb_class *cl) 472 466 { 473 - return cl->cmode != HTB_CANT_SEND ? -cl->cbuffer : 0; 467 + if (htb_hysteresis) 468 + return cl->cmode != HTB_CANT_SEND ? -cl->cbuffer : 0; 469 + else 470 + return 0; 474 471 } 475 472 static inline long htb_hiwater(const struct htb_class *cl) 476 473 { 477 - return cl->cmode == HTB_CAN_SEND ? -cl->buffer : 0; 474 + if (htb_hysteresis) 475 + return cl->cmode == HTB_CAN_SEND ? -cl->buffer : 0; 476 + else 477 + return 0; 478 478 } 479 - #else 480 - #define htb_lowater(cl) (0) 481 - #define htb_hiwater(cl) (0) 482 - #endif 479 + 483 480 484 481 /** 485 482 * htb_class_mode - computes and returns current class mode
+11 -2
net/sctp/associola.c
··· 474 474 void sctp_assoc_set_primary(struct sctp_association *asoc, 475 475 struct sctp_transport *transport) 476 476 { 477 + int changeover = 0; 478 + 479 + /* it's a changeover only if we already have a primary path 480 + * that we are changing 481 + */ 482 + if (asoc->peer.primary_path != NULL && 483 + asoc->peer.primary_path != transport) 484 + changeover = 1 ; 485 + 477 486 asoc->peer.primary_path = transport; 478 487 479 488 /* Set a default msg_name for events. */ ··· 508 499 * double switch to the same destination address. 509 500 */ 510 501 if (transport->cacc.changeover_active) 511 - transport->cacc.cycling_changeover = 1; 502 + transport->cacc.cycling_changeover = changeover; 512 503 513 504 /* 2) The sender MUST set CHANGEOVER_ACTIVE to indicate that 514 505 * a changeover has occurred. 515 506 */ 516 - transport->cacc.changeover_active = 1; 507 + transport->cacc.changeover_active = changeover; 517 508 518 509 /* 3) The sender MUST store the next TSN to be sent in 519 510 * next_tsn_at_change.
+12 -3
net/sctp/protocol.c
··· 108 108 } 109 109 110 110 if (sctp_snmp_proc_init()) 111 - goto out_nomem; 111 + goto out_snmp_proc_init; 112 112 if (sctp_eps_proc_init()) 113 - goto out_nomem; 113 + goto out_eps_proc_init; 114 114 if (sctp_assocs_proc_init()) 115 - goto out_nomem; 115 + goto out_assocs_proc_init; 116 116 117 117 return 0; 118 118 119 + out_assocs_proc_init: 120 + sctp_eps_proc_exit(); 121 + out_eps_proc_init: 122 + sctp_snmp_proc_exit(); 123 + out_snmp_proc_init: 124 + if (proc_net_sctp) { 125 + proc_net_sctp = NULL; 126 + remove_proc_entry("sctp", init_net.proc_net); 127 + } 119 128 out_nomem: 120 129 return -ENOMEM; 121 130 }
+70 -9
net/unix/af_unix.c
··· 169 169 return (unix_peer(osk) == NULL || unix_our_peer(sk, osk)); 170 170 } 171 171 172 + static inline int unix_recvq_full(struct sock const *sk) 173 + { 174 + return skb_queue_len(&sk->sk_receive_queue) > sk->sk_max_ack_backlog; 175 + } 176 + 172 177 static struct sock *unix_peer_get(struct sock *s) 173 178 { 174 179 struct sock *peer; ··· 487 482 static int unix_accept(struct socket *, struct socket *, int); 488 483 static int unix_getname(struct socket *, struct sockaddr *, int *, int); 489 484 static unsigned int unix_poll(struct file *, struct socket *, poll_table *); 485 + static unsigned int unix_datagram_poll(struct file *, struct socket *, 486 + poll_table *); 490 487 static int unix_ioctl(struct socket *, unsigned int, unsigned long); 491 488 static int unix_shutdown(struct socket *, int); 492 489 static int unix_stream_sendmsg(struct kiocb *, struct socket *, ··· 534 527 .socketpair = unix_socketpair, 535 528 .accept = sock_no_accept, 536 529 .getname = unix_getname, 537 - .poll = datagram_poll, 530 + .poll = unix_datagram_poll, 538 531 .ioctl = unix_ioctl, 539 532 .listen = sock_no_listen, 540 533 .shutdown = unix_shutdown, ··· 555 548 .socketpair = unix_socketpair, 556 549 .accept = unix_accept, 557 550 .getname = unix_getname, 558 - .poll = datagram_poll, 551 + .poll = unix_datagram_poll, 559 552 .ioctl = unix_ioctl, 560 553 .listen = unix_listen, 561 554 .shutdown = unix_shutdown, ··· 990 983 991 984 sched = !sock_flag(other, SOCK_DEAD) && 992 985 !(other->sk_shutdown & RCV_SHUTDOWN) && 993 - (skb_queue_len(&other->sk_receive_queue) > 994 - other->sk_max_ack_backlog); 986 + unix_recvq_full(other); 995 987 996 988 unix_state_unlock(other); 997 989 ··· 1064 1058 if (other->sk_state != TCP_LISTEN) 1065 1059 goto out_unlock; 1066 1060 1067 - if (skb_queue_len(&other->sk_receive_queue) > 1068 - other->sk_max_ack_backlog) { 1061 + if (unix_recvq_full(other)) { 1069 1062 err = -EAGAIN; 1070 1063 if (!timeo) 1071 1064 goto out_unlock; ··· 1433 1428 goto out_unlock; 1434 1429 } 1435 1430 1436 - if (unix_peer(other) != sk && 1437 - (skb_queue_len(&other->sk_receive_queue) > 1438 - other->sk_max_ack_backlog)) { 1431 + if (unix_peer(other) != sk && unix_recvq_full(other)) { 1439 1432 if (!timeo) { 1440 1433 err = -EAGAIN; 1441 1434 goto out_unlock; ··· 1994 1991 return mask; 1995 1992 } 1996 1993 1994 + static unsigned int unix_datagram_poll(struct file *file, struct socket *sock, 1995 + poll_table *wait) 1996 + { 1997 + struct sock *sk = sock->sk, *peer; 1998 + unsigned int mask; 1999 + 2000 + poll_wait(file, sk->sk_sleep, wait); 2001 + 2002 + peer = unix_peer_get(sk); 2003 + if (peer) { 2004 + if (peer != sk) { 2005 + /* 2006 + * Writability of a connected socket additionally 2007 + * depends on the state of the receive queue of the 2008 + * peer. 2009 + */ 2010 + poll_wait(file, &unix_sk(peer)->peer_wait, wait); 2011 + } else { 2012 + sock_put(peer); 2013 + peer = NULL; 2014 + } 2015 + } 2016 + 2017 + mask = 0; 2018 + 2019 + /* exceptional events? */ 2020 + if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) 2021 + mask |= POLLERR; 2022 + if (sk->sk_shutdown & RCV_SHUTDOWN) 2023 + mask |= POLLRDHUP; 2024 + if (sk->sk_shutdown == SHUTDOWN_MASK) 2025 + mask |= POLLHUP; 2026 + 2027 + /* readable? */ 2028 + if (!skb_queue_empty(&sk->sk_receive_queue) || 2029 + (sk->sk_shutdown & RCV_SHUTDOWN)) 2030 + mask |= POLLIN | POLLRDNORM; 2031 + 2032 + /* Connection-based need to check for termination and startup */ 2033 + if (sk->sk_type == SOCK_SEQPACKET) { 2034 + if (sk->sk_state == TCP_CLOSE) 2035 + mask |= POLLHUP; 2036 + /* connection hasn't started yet? */ 2037 + if (sk->sk_state == TCP_SYN_SENT) 2038 + return mask; 2039 + } 2040 + 2041 + /* writable? */ 2042 + if (unix_writable(sk) && !(peer && unix_recvq_full(peer))) 2043 + mask |= POLLOUT | POLLWRNORM | POLLWRBAND; 2044 + else 2045 + set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); 2046 + 2047 + if (peer) 2048 + sock_put(peer); 2049 + 2050 + return mask; 2051 + } 1997 2052 1998 2053 #ifdef CONFIG_PROC_FS 1999 2054 static struct sock *first_unix_socket(int *i)