diff options
-rw-r--r-- | drivers/net/atlx/atl1.c | 1 | ||||
-rw-r--r-- | drivers/net/enc28j60.c | 87 | ||||
-rw-r--r-- | drivers/net/ibm_newemac/Kconfig | 1 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic.h | 18 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_ethtool.c | 6 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 112 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_init.c | 46 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_isr.c | 4 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 133 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_niu.c | 22 | ||||
-rw-r--r-- | drivers/net/sky2.c | 1 | ||||
-rw-r--r-- | drivers/net/tun.c | 15 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack_extend.h | 1 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_nat_core.c | 3 | ||||
-rw-r--r-- | net/ipv4/xfrm4_mode_tunnel.c | 2 | ||||
-rw-r--r-- | net/mac80211/tx.c | 2 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_extend.c | 9 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_h323_main.c | 22 | ||||
-rw-r--r-- | net/netlink/genetlink.c | 15 | ||||
-rw-r--r-- | net/unix/af_unix.c | 79 |
20 files changed, 307 insertions, 272 deletions
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c index 919ffb9bfa4e..3e22e7817bc3 100644 --- a/drivers/net/atlx/atl1.c +++ b/drivers/net/atlx/atl1.c | |||
@@ -471,7 +471,6 @@ static int atl1_get_permanent_address(struct atl1_hw *hw) | |||
471 | memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN); | 471 | memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN); |
472 | return 0; | 472 | return 0; |
473 | } | 473 | } |
474 | return 1; | ||
475 | } | 474 | } |
476 | 475 | ||
477 | /* see if SPI FLAGS exist ? */ | 476 | /* see if SPI FLAGS exist ? */ |
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c index 46a90e9ec563..c05cb159c772 100644 --- a/drivers/net/enc28j60.c +++ b/drivers/net/enc28j60.c | |||
@@ -400,26 +400,31 @@ enc28j60_packet_write(struct enc28j60_net *priv, int len, const u8 *data) | |||
400 | mutex_unlock(&priv->lock); | 400 | mutex_unlock(&priv->lock); |
401 | } | 401 | } |
402 | 402 | ||
403 | /* | 403 | static unsigned long msec20_to_jiffies; |
404 | * Wait until the PHY operation is complete. | 404 | |
405 | */ | 405 | static int poll_ready(struct enc28j60_net *priv, u8 reg, u8 mask, u8 val) |
406 | static int wait_phy_ready(struct enc28j60_net *priv) | ||
407 | { | 406 | { |
408 | unsigned long timeout = jiffies + 20 * HZ / 1000; | 407 | unsigned long timeout = jiffies + msec20_to_jiffies; |
409 | int ret = 1; | ||
410 | 408 | ||
411 | /* 20 msec timeout read */ | 409 | /* 20 msec timeout read */ |
412 | while (nolock_regb_read(priv, MISTAT) & MISTAT_BUSY) { | 410 | while ((nolock_regb_read(priv, reg) & mask) != val) { |
413 | if (time_after(jiffies, timeout)) { | 411 | if (time_after(jiffies, timeout)) { |
414 | if (netif_msg_drv(priv)) | 412 | if (netif_msg_drv(priv)) |
415 | printk(KERN_DEBUG DRV_NAME | 413 | dev_dbg(&priv->spi->dev, |
416 | ": PHY ready timeout!\n"); | 414 | "reg %02x ready timeout!\n", reg); |
417 | ret = 0; | 415 | return -ETIMEDOUT; |
418 | break; | ||
419 | } | 416 | } |
420 | cpu_relax(); | 417 | cpu_relax(); |
421 | } | 418 | } |
422 | return ret; | 419 | return 0; |
420 | } | ||
421 | |||
422 | /* | ||
423 | * Wait until the PHY operation is complete. | ||
424 | */ | ||
425 | static int wait_phy_ready(struct enc28j60_net *priv) | ||
426 | { | ||
427 | return poll_ready(priv, MISTAT, MISTAT_BUSY, 0) ? 0 : 1; | ||
423 | } | 428 | } |
424 | 429 | ||
425 | /* | 430 | /* |
@@ -594,6 +599,32 @@ static void nolock_txfifo_init(struct enc28j60_net *priv, u16 start, u16 end) | |||
594 | nolock_regw_write(priv, ETXNDL, end); | 599 | nolock_regw_write(priv, ETXNDL, end); |
595 | } | 600 | } |
596 | 601 | ||
602 | /* | ||
603 | * Low power mode shrinks power consumption about 100x, so we'd like | ||
604 | * the chip to be in that mode whenever it's inactive. (However, we | ||
605 | * can't stay in lowpower mode during suspend with WOL active.) | ||
606 | */ | ||
607 | static void enc28j60_lowpower(struct enc28j60_net *priv, bool is_low) | ||
608 | { | ||
609 | if (netif_msg_drv(priv)) | ||
610 | dev_dbg(&priv->spi->dev, "%s power...\n", | ||
611 | is_low ? "low" : "high"); | ||
612 | |||
613 | mutex_lock(&priv->lock); | ||
614 | if (is_low) { | ||
615 | nolock_reg_bfclr(priv, ECON1, ECON1_RXEN); | ||
616 | poll_ready(priv, ESTAT, ESTAT_RXBUSY, 0); | ||
617 | poll_ready(priv, ECON1, ECON1_TXRTS, 0); | ||
618 | /* ECON2_VRPS was set during initialization */ | ||
619 | nolock_reg_bfset(priv, ECON2, ECON2_PWRSV); | ||
620 | } else { | ||
621 | nolock_reg_bfclr(priv, ECON2, ECON2_PWRSV); | ||
622 | poll_ready(priv, ESTAT, ESTAT_CLKRDY, ESTAT_CLKRDY); | ||
623 | /* caller sets ECON1_RXEN */ | ||
624 | } | ||
625 | mutex_unlock(&priv->lock); | ||
626 | } | ||
627 | |||
597 | static int enc28j60_hw_init(struct enc28j60_net *priv) | 628 | static int enc28j60_hw_init(struct enc28j60_net *priv) |
598 | { | 629 | { |
599 | u8 reg; | 630 | u8 reg; |
@@ -612,8 +643,8 @@ static int enc28j60_hw_init(struct enc28j60_net *priv) | |||
612 | priv->tx_retry_count = 0; | 643 | priv->tx_retry_count = 0; |
613 | priv->max_pk_counter = 0; | 644 | priv->max_pk_counter = 0; |
614 | priv->rxfilter = RXFILTER_NORMAL; | 645 | priv->rxfilter = RXFILTER_NORMAL; |
615 | /* enable address auto increment */ | 646 | /* enable address auto increment and voltage regulator powersave */ |
616 | nolock_regb_write(priv, ECON2, ECON2_AUTOINC); | 647 | nolock_regb_write(priv, ECON2, ECON2_AUTOINC | ECON2_VRPS); |
617 | 648 | ||
618 | nolock_rxfifo_init(priv, RXSTART_INIT, RXEND_INIT); | 649 | nolock_rxfifo_init(priv, RXSTART_INIT, RXEND_INIT); |
619 | nolock_txfifo_init(priv, TXSTART_INIT, TXEND_INIT); | 650 | nolock_txfifo_init(priv, TXSTART_INIT, TXEND_INIT); |
@@ -690,7 +721,7 @@ static int enc28j60_hw_init(struct enc28j60_net *priv) | |||
690 | 721 | ||
691 | static void enc28j60_hw_enable(struct enc28j60_net *priv) | 722 | static void enc28j60_hw_enable(struct enc28j60_net *priv) |
692 | { | 723 | { |
693 | /* enable interrutps */ | 724 | /* enable interrupts */ |
694 | if (netif_msg_hw(priv)) | 725 | if (netif_msg_hw(priv)) |
695 | printk(KERN_DEBUG DRV_NAME ": %s() enabling interrupts.\n", | 726 | printk(KERN_DEBUG DRV_NAME ": %s() enabling interrupts.\n", |
696 | __FUNCTION__); | 727 | __FUNCTION__); |
@@ -726,15 +757,12 @@ enc28j60_setlink(struct net_device *ndev, u8 autoneg, u16 speed, u8 duplex) | |||
726 | int ret = 0; | 757 | int ret = 0; |
727 | 758 | ||
728 | if (!priv->hw_enable) { | 759 | if (!priv->hw_enable) { |
729 | if (autoneg == AUTONEG_DISABLE && speed == SPEED_10) { | 760 | /* link is in low power mode now; duplex setting |
761 | * will take effect on next enc28j60_hw_init(). | ||
762 | */ | ||
763 | if (autoneg == AUTONEG_DISABLE && speed == SPEED_10) | ||
730 | priv->full_duplex = (duplex == DUPLEX_FULL); | 764 | priv->full_duplex = (duplex == DUPLEX_FULL); |
731 | if (!enc28j60_hw_init(priv)) { | 765 | else { |
732 | if (netif_msg_drv(priv)) | ||
733 | dev_err(&ndev->dev, | ||
734 | "hw_reset() failed\n"); | ||
735 | ret = -EINVAL; | ||
736 | } | ||
737 | } else { | ||
738 | if (netif_msg_link(priv)) | 766 | if (netif_msg_link(priv)) |
739 | dev_warn(&ndev->dev, | 767 | dev_warn(&ndev->dev, |
740 | "unsupported link setting\n"); | 768 | "unsupported link setting\n"); |
@@ -1307,7 +1335,8 @@ static int enc28j60_net_open(struct net_device *dev) | |||
1307 | } | 1335 | } |
1308 | return -EADDRNOTAVAIL; | 1336 | return -EADDRNOTAVAIL; |
1309 | } | 1337 | } |
1310 | /* Reset the hardware here */ | 1338 | /* Reset the hardware here (and take it out of low power mode) */ |
1339 | enc28j60_lowpower(priv, false); | ||
1311 | enc28j60_hw_disable(priv); | 1340 | enc28j60_hw_disable(priv); |
1312 | if (!enc28j60_hw_init(priv)) { | 1341 | if (!enc28j60_hw_init(priv)) { |
1313 | if (netif_msg_ifup(priv)) | 1342 | if (netif_msg_ifup(priv)) |
@@ -1337,6 +1366,7 @@ static int enc28j60_net_close(struct net_device *dev) | |||
1337 | printk(KERN_DEBUG DRV_NAME ": %s() enter\n", __FUNCTION__); | 1366 | printk(KERN_DEBUG DRV_NAME ": %s() enter\n", __FUNCTION__); |
1338 | 1367 | ||
1339 | enc28j60_hw_disable(priv); | 1368 | enc28j60_hw_disable(priv); |
1369 | enc28j60_lowpower(priv, true); | ||
1340 | netif_stop_queue(dev); | 1370 | netif_stop_queue(dev); |
1341 | 1371 | ||
1342 | return 0; | 1372 | return 0; |
@@ -1537,6 +1567,8 @@ static int __devinit enc28j60_probe(struct spi_device *spi) | |||
1537 | dev->watchdog_timeo = TX_TIMEOUT; | 1567 | dev->watchdog_timeo = TX_TIMEOUT; |
1538 | SET_ETHTOOL_OPS(dev, &enc28j60_ethtool_ops); | 1568 | SET_ETHTOOL_OPS(dev, &enc28j60_ethtool_ops); |
1539 | 1569 | ||
1570 | enc28j60_lowpower(priv, true); | ||
1571 | |||
1540 | ret = register_netdev(dev); | 1572 | ret = register_netdev(dev); |
1541 | if (ret) { | 1573 | if (ret) { |
1542 | if (netif_msg_probe(priv)) | 1574 | if (netif_msg_probe(priv)) |
@@ -1556,7 +1588,7 @@ error_alloc: | |||
1556 | return ret; | 1588 | return ret; |
1557 | } | 1589 | } |
1558 | 1590 | ||
1559 | static int enc28j60_remove(struct spi_device *spi) | 1591 | static int __devexit enc28j60_remove(struct spi_device *spi) |
1560 | { | 1592 | { |
1561 | struct enc28j60_net *priv = dev_get_drvdata(&spi->dev); | 1593 | struct enc28j60_net *priv = dev_get_drvdata(&spi->dev); |
1562 | 1594 | ||
@@ -1573,15 +1605,16 @@ static int enc28j60_remove(struct spi_device *spi) | |||
1573 | static struct spi_driver enc28j60_driver = { | 1605 | static struct spi_driver enc28j60_driver = { |
1574 | .driver = { | 1606 | .driver = { |
1575 | .name = DRV_NAME, | 1607 | .name = DRV_NAME, |
1576 | .bus = &spi_bus_type, | ||
1577 | .owner = THIS_MODULE, | 1608 | .owner = THIS_MODULE, |
1578 | }, | 1609 | }, |
1579 | .probe = enc28j60_probe, | 1610 | .probe = enc28j60_probe, |
1580 | .remove = __devexit_p(enc28j60_remove), | 1611 | .remove = __devexit_p(enc28j60_remove), |
1581 | }; | 1612 | }; |
1582 | 1613 | ||
1583 | static int __init enc28j60_init(void) | 1614 | static int __init enc28j60_init(void) |
1584 | { | 1615 | { |
1616 | msec20_to_jiffies = msecs_to_jiffies(20); | ||
1617 | |||
1585 | return spi_register_driver(&enc28j60_driver); | 1618 | return spi_register_driver(&enc28j60_driver); |
1586 | } | 1619 | } |
1587 | 1620 | ||
diff --git a/drivers/net/ibm_newemac/Kconfig b/drivers/net/ibm_newemac/Kconfig index 0d3e7380bad0..70a3272ee998 100644 --- a/drivers/net/ibm_newemac/Kconfig +++ b/drivers/net/ibm_newemac/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config IBM_NEW_EMAC | 1 | config IBM_NEW_EMAC |
2 | tristate "IBM EMAC Ethernet support" | 2 | tristate "IBM EMAC Ethernet support" |
3 | depends on PPC_DCR && PPC_MERGE | 3 | depends on PPC_DCR && PPC_MERGE |
4 | select CRC32 | ||
4 | help | 5 | help |
5 | This driver supports the IBM EMAC family of Ethernet controllers | 6 | This driver supports the IBM EMAC family of Ethernet controllers |
6 | typically found on 4xx embedded PowerPC chips, but also on the | 7 | typically found on 4xx embedded PowerPC chips, but also on the |
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 8cb29f5b1038..da4c4fb97064 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -776,7 +776,6 @@ struct netxen_hardware_context { | |||
776 | 776 | ||
777 | u8 revision_id; | 777 | u8 revision_id; |
778 | u16 board_type; | 778 | u16 board_type; |
779 | u16 max_ports; | ||
780 | struct netxen_board_info boardcfg; | 779 | struct netxen_board_info boardcfg; |
781 | u32 xg_linkup; | 780 | u32 xg_linkup; |
782 | u32 qg_linksup; | 781 | u32 qg_linksup; |
@@ -863,6 +862,7 @@ struct netxen_adapter { | |||
863 | unsigned char mac_addr[ETH_ALEN]; | 862 | unsigned char mac_addr[ETH_ALEN]; |
864 | int mtu; | 863 | int mtu; |
865 | int portnum; | 864 | int portnum; |
865 | u8 physical_port; | ||
866 | 866 | ||
867 | struct work_struct watchdog_task; | 867 | struct work_struct watchdog_task; |
868 | struct timer_list watchdog_timer; | 868 | struct timer_list watchdog_timer; |
@@ -1034,7 +1034,6 @@ int netxen_rom_se(struct netxen_adapter *adapter, int addr); | |||
1034 | 1034 | ||
1035 | /* Functions from netxen_nic_isr.c */ | 1035 | /* Functions from netxen_nic_isr.c */ |
1036 | void netxen_initialize_adapter_sw(struct netxen_adapter *adapter); | 1036 | void netxen_initialize_adapter_sw(struct netxen_adapter *adapter); |
1037 | void netxen_initialize_adapter_hw(struct netxen_adapter *adapter); | ||
1038 | void *netxen_alloc(struct pci_dev *pdev, size_t sz, dma_addr_t * ptr, | 1037 | void *netxen_alloc(struct pci_dev *pdev, size_t sz, dma_addr_t * ptr, |
1039 | struct pci_dev **used_dev); | 1038 | struct pci_dev **used_dev); |
1040 | void netxen_initialize_adapter_ops(struct netxen_adapter *adapter); | 1039 | void netxen_initialize_adapter_ops(struct netxen_adapter *adapter); |
@@ -1077,20 +1076,6 @@ static const struct netxen_brdinfo netxen_boards[] = { | |||
1077 | 1076 | ||
1078 | #define NUM_SUPPORTED_BOARDS ARRAY_SIZE(netxen_boards) | 1077 | #define NUM_SUPPORTED_BOARDS ARRAY_SIZE(netxen_boards) |
1079 | 1078 | ||
1080 | static inline void get_brd_port_by_type(u32 type, int *ports) | ||
1081 | { | ||
1082 | int i, found = 0; | ||
1083 | for (i = 0; i < NUM_SUPPORTED_BOARDS; ++i) { | ||
1084 | if (netxen_boards[i].brdtype == type) { | ||
1085 | *ports = netxen_boards[i].ports; | ||
1086 | found = 1; | ||
1087 | break; | ||
1088 | } | ||
1089 | } | ||
1090 | if (!found) | ||
1091 | *ports = 0; | ||
1092 | } | ||
1093 | |||
1094 | static inline void get_brd_name_by_type(u32 type, char *name) | 1079 | static inline void get_brd_name_by_type(u32 type, char *name) |
1095 | { | 1080 | { |
1096 | int i, found = 0; | 1081 | int i, found = 0; |
@@ -1169,5 +1154,4 @@ extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, | |||
1169 | 1154 | ||
1170 | extern struct ethtool_ops netxen_nic_ethtool_ops; | 1155 | extern struct ethtool_ops netxen_nic_ethtool_ops; |
1171 | 1156 | ||
1172 | extern int physical_port[]; /* physical port # from virtual port.*/ | ||
1173 | #endif /* __NETXEN_NIC_H_ */ | 1157 | #endif /* __NETXEN_NIC_H_ */ |
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index 6e98d830eefb..723487bf200c 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
@@ -369,7 +369,7 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) | |||
369 | for (i = 3; niu_registers[mode].reg[i - 3] != -1; i++) { | 369 | for (i = 3; niu_registers[mode].reg[i - 3] != -1; i++) { |
370 | /* GB: port specific registers */ | 370 | /* GB: port specific registers */ |
371 | if (mode == 0 && i >= 19) | 371 | if (mode == 0 && i >= 19) |
372 | window = physical_port[adapter->portnum] * | 372 | window = adapter->physical_port * |
373 | NETXEN_NIC_PORT_WINDOW; | 373 | NETXEN_NIC_PORT_WINDOW; |
374 | 374 | ||
375 | NETXEN_NIC_LOCKED_READ_REG(niu_registers[mode]. | 375 | NETXEN_NIC_LOCKED_READ_REG(niu_registers[mode]. |
@@ -527,7 +527,7 @@ netxen_nic_get_pauseparam(struct net_device *dev, | |||
527 | { | 527 | { |
528 | struct netxen_adapter *adapter = netdev_priv(dev); | 528 | struct netxen_adapter *adapter = netdev_priv(dev); |
529 | __u32 val; | 529 | __u32 val; |
530 | int port = physical_port[adapter->portnum]; | 530 | int port = adapter->physical_port; |
531 | 531 | ||
532 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { | 532 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { |
533 | if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) | 533 | if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) |
@@ -573,7 +573,7 @@ netxen_nic_set_pauseparam(struct net_device *dev, | |||
573 | { | 573 | { |
574 | struct netxen_adapter *adapter = netdev_priv(dev); | 574 | struct netxen_adapter *adapter = netdev_priv(dev); |
575 | __u32 val; | 575 | __u32 val; |
576 | int port = physical_port[adapter->portnum]; | 576 | int port = adapter->physical_port; |
577 | /* read mode */ | 577 | /* read mode */ |
578 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { | 578 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { |
579 | if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) | 579 | if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index af7356468251..c43d06b8de9b 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -396,11 +396,8 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter) | |||
396 | } | 396 | } |
397 | adapter->intr_scheme = readl( | 397 | adapter->intr_scheme = readl( |
398 | NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_CAPABILITIES_FW)); | 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 | adapter->msi_mode = readl( | 399 | adapter->msi_mode = readl( |
402 | NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_MSI_MODE_FW)); | 400 | NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_MSI_MODE_FW)); |
403 | DPRINTK(INFO, "Receive Peg ready too. starting stuff\n"); | ||
404 | 401 | ||
405 | addr = netxen_alloc(adapter->ahw.pdev, | 402 | addr = netxen_alloc(adapter->ahw.pdev, |
406 | sizeof(struct netxen_ring_ctx) + | 403 | sizeof(struct netxen_ring_ctx) + |
@@ -408,8 +405,6 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter) | |||
408 | (dma_addr_t *) & adapter->ctx_desc_phys_addr, | 405 | (dma_addr_t *) & adapter->ctx_desc_phys_addr, |
409 | &adapter->ctx_desc_pdev); | 406 | &adapter->ctx_desc_pdev); |
410 | 407 | ||
411 | printk(KERN_INFO "ctx_desc_phys_addr: 0x%llx\n", | ||
412 | (unsigned long long) adapter->ctx_desc_phys_addr); | ||
413 | if (addr == NULL) { | 408 | if (addr == NULL) { |
414 | DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); | 409 | DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); |
415 | err = -ENOMEM; | 410 | err = -ENOMEM; |
@@ -429,8 +424,6 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter) | |||
429 | adapter->max_tx_desc_count, | 424 | adapter->max_tx_desc_count, |
430 | (dma_addr_t *) & hw->cmd_desc_phys_addr, | 425 | (dma_addr_t *) & hw->cmd_desc_phys_addr, |
431 | &adapter->ahw.cmd_desc_pdev); | 426 | &adapter->ahw.cmd_desc_pdev); |
432 | printk(KERN_INFO "cmd_desc_phys_addr: 0x%llx\n", | ||
433 | (unsigned long long) hw->cmd_desc_phys_addr); | ||
434 | 427 | ||
435 | if (addr == NULL) { | 428 | if (addr == NULL) { |
436 | DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); | 429 | DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); |
@@ -1032,15 +1025,15 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter) | |||
1032 | int netxen_nic_set_mtu_gb(struct netxen_adapter *adapter, int new_mtu) | 1025 | int netxen_nic_set_mtu_gb(struct netxen_adapter *adapter, int new_mtu) |
1033 | { | 1026 | { |
1034 | netxen_nic_write_w0(adapter, | 1027 | netxen_nic_write_w0(adapter, |
1035 | NETXEN_NIU_GB_MAX_FRAME_SIZE( | 1028 | NETXEN_NIU_GB_MAX_FRAME_SIZE(adapter->physical_port), |
1036 | physical_port[adapter->portnum]), new_mtu); | 1029 | new_mtu); |
1037 | return 0; | 1030 | return 0; |
1038 | } | 1031 | } |
1039 | 1032 | ||
1040 | int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu) | 1033 | int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu) |
1041 | { | 1034 | { |
1042 | new_mtu += NETXEN_NIU_HDRSIZE + NETXEN_NIU_TLRSIZE; | 1035 | new_mtu += NETXEN_NIU_HDRSIZE + NETXEN_NIU_TLRSIZE; |
1043 | if (physical_port[adapter->portnum] == 0) | 1036 | if (adapter->physical_port == 0) |
1044 | netxen_nic_write_w0(adapter, NETXEN_NIU_XGE_MAX_FRAME_SIZE, | 1037 | netxen_nic_write_w0(adapter, NETXEN_NIU_XGE_MAX_FRAME_SIZE, |
1045 | new_mtu); | 1038 | new_mtu); |
1046 | else | 1039 | else |
@@ -1051,7 +1044,7 @@ int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu) | |||
1051 | 1044 | ||
1052 | void netxen_nic_init_niu_gb(struct netxen_adapter *adapter) | 1045 | void netxen_nic_init_niu_gb(struct netxen_adapter *adapter) |
1053 | { | 1046 | { |
1054 | netxen_niu_gbe_init_port(adapter, physical_port[adapter->portnum]); | 1047 | netxen_niu_gbe_init_port(adapter, adapter->physical_port); |
1055 | } | 1048 | } |
1056 | 1049 | ||
1057 | void | 1050 | void |
@@ -1127,7 +1120,6 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter) | |||
1127 | 1120 | ||
1128 | void netxen_nic_flash_print(struct netxen_adapter *adapter) | 1121 | void netxen_nic_flash_print(struct netxen_adapter *adapter) |
1129 | { | 1122 | { |
1130 | int valid = 1; | ||
1131 | u32 fw_major = 0; | 1123 | u32 fw_major = 0; |
1132 | u32 fw_minor = 0; | 1124 | u32 fw_minor = 0; |
1133 | u32 fw_build = 0; | 1125 | u32 fw_build = 0; |
@@ -1137,70 +1129,62 @@ void netxen_nic_flash_print(struct netxen_adapter *adapter) | |||
1137 | __le32 *ptr32; | 1129 | __le32 *ptr32; |
1138 | 1130 | ||
1139 | struct netxen_board_info *board_info = &(adapter->ahw.boardcfg); | 1131 | struct netxen_board_info *board_info = &(adapter->ahw.boardcfg); |
1140 | if (board_info->magic != NETXEN_BDINFO_MAGIC) { | 1132 | |
1141 | printk | 1133 | adapter->driver_mismatch = 0; |
1142 | ("NetXen Unknown board config, Read 0x%x expected as 0x%x\n", | 1134 | |
1143 | board_info->magic, NETXEN_BDINFO_MAGIC); | 1135 | ptr32 = (u32 *)&serial_num; |
1144 | valid = 0; | 1136 | addr = NETXEN_USER_START + |
1145 | } | 1137 | offsetof(struct netxen_new_user_info, serial_num); |
1146 | if (board_info->header_version != NETXEN_BDINFO_VERSION) { | 1138 | for (i = 0; i < 8; i++) { |
1147 | printk("NetXen Unknown board config version." | 1139 | if (netxen_rom_fast_read(adapter, addr, ptr32) == -1) { |
1148 | " Read %x, expected %x\n", | 1140 | printk("%s: ERROR reading %s board userarea.\n", |
1149 | board_info->header_version, NETXEN_BDINFO_VERSION); | 1141 | netxen_nic_driver_name, |
1150 | valid = 0; | 1142 | netxen_nic_driver_name); |
1151 | } | 1143 | adapter->driver_mismatch = 1; |
1152 | if (valid) { | 1144 | return; |
1153 | ptr32 = (u32 *)&serial_num; | ||
1154 | addr = NETXEN_USER_START + | ||
1155 | offsetof(struct netxen_new_user_info, serial_num); | ||
1156 | for (i = 0; i < 8; i++) { | ||
1157 | if (netxen_rom_fast_read(adapter, addr, ptr32) == -1) { | ||
1158 | printk("%s: ERROR reading %s board userarea.\n", | ||
1159 | netxen_nic_driver_name, | ||
1160 | netxen_nic_driver_name); | ||
1161 | return; | ||
1162 | } | ||
1163 | ptr32++; | ||
1164 | addr += sizeof(u32); | ||
1165 | } | 1145 | } |
1146 | ptr32++; | ||
1147 | addr += sizeof(u32); | ||
1148 | } | ||
1149 | |||
1150 | fw_major = readl(NETXEN_CRB_NORMALIZE(adapter, | ||
1151 | NETXEN_FW_VERSION_MAJOR)); | ||
1152 | fw_minor = readl(NETXEN_CRB_NORMALIZE(adapter, | ||
1153 | NETXEN_FW_VERSION_MINOR)); | ||
1154 | fw_build = | ||
1155 | readl(NETXEN_CRB_NORMALIZE(adapter, NETXEN_FW_VERSION_SUB)); | ||
1166 | 1156 | ||
1157 | if (adapter->portnum == 0) { | ||
1167 | get_brd_name_by_type(board_info->board_type, brd_name); | 1158 | get_brd_name_by_type(board_info->board_type, brd_name); |
1168 | 1159 | ||
1169 | printk("NetXen %s Board S/N %s Chip id 0x%x\n", | 1160 | printk("NetXen %s Board S/N %s Chip id 0x%x\n", |
1170 | brd_name, serial_num, board_info->chip_id); | 1161 | brd_name, serial_num, board_info->chip_id); |
1171 | 1162 | printk("NetXen Firmware version %d.%d.%d\n", fw_major, | |
1172 | printk("NetXen %s Board #%d, Chip id 0x%x\n", | 1163 | fw_minor, fw_build); |
1173 | board_info->board_type == 0x0b ? "XGB" : "GBE", | ||
1174 | board_info->board_num, board_info->chip_id); | ||
1175 | fw_major = readl(NETXEN_CRB_NORMALIZE(adapter, | ||
1176 | NETXEN_FW_VERSION_MAJOR)); | ||
1177 | fw_minor = readl(NETXEN_CRB_NORMALIZE(adapter, | ||
1178 | NETXEN_FW_VERSION_MINOR)); | ||
1179 | fw_build = | ||
1180 | readl(NETXEN_CRB_NORMALIZE(adapter, NETXEN_FW_VERSION_SUB)); | ||
1181 | |||
1182 | printk("NetXen Firmware version %d.%d.%d\n", fw_major, fw_minor, | ||
1183 | fw_build); | ||
1184 | } | 1164 | } |
1165 | |||
1185 | if (fw_major != _NETXEN_NIC_LINUX_MAJOR) { | 1166 | if (fw_major != _NETXEN_NIC_LINUX_MAJOR) { |
1186 | printk(KERN_ERR "The mismatch in driver version and firmware " | ||
1187 | "version major number\n" | ||
1188 | "Driver version major number = %d \t" | ||
1189 | "Firmware version major number = %d \n", | ||
1190 | _NETXEN_NIC_LINUX_MAJOR, fw_major); | ||
1191 | adapter->driver_mismatch = 1; | 1167 | adapter->driver_mismatch = 1; |
1192 | } | 1168 | } |
1193 | if (fw_minor != _NETXEN_NIC_LINUX_MINOR && | 1169 | if (fw_minor != _NETXEN_NIC_LINUX_MINOR && |
1194 | fw_minor != (_NETXEN_NIC_LINUX_MINOR + 1)) { | 1170 | fw_minor != (_NETXEN_NIC_LINUX_MINOR + 1)) { |
1195 | printk(KERN_ERR "The mismatch in driver version and firmware " | ||
1196 | "version minor number\n" | ||
1197 | "Driver version minor number = %d \t" | ||
1198 | "Firmware version minor number = %d \n", | ||
1199 | _NETXEN_NIC_LINUX_MINOR, fw_minor); | ||
1200 | adapter->driver_mismatch = 1; | 1171 | adapter->driver_mismatch = 1; |
1201 | } | 1172 | } |
1202 | if (adapter->driver_mismatch) | 1173 | if (adapter->driver_mismatch) { |
1203 | printk(KERN_INFO "Use the driver with version no %d.%d.xxx\n", | 1174 | printk(KERN_ERR "%s: driver and firmware version mismatch\n", |
1204 | fw_major, fw_minor); | 1175 | adapter->netdev->name); |
1176 | return; | ||
1177 | } | ||
1178 | |||
1179 | switch (adapter->ahw.board_type) { | ||
1180 | case NETXEN_NIC_GBE: | ||
1181 | dev_info(&adapter->pdev->dev, "%s: GbE port initialized\n", | ||
1182 | adapter->netdev->name); | ||
1183 | break; | ||
1184 | case NETXEN_NIC_XGBE: | ||
1185 | dev_info(&adapter->pdev->dev, "%s: XGbE port initialized\n", | ||
1186 | adapter->netdev->name); | ||
1187 | break; | ||
1188 | } | ||
1205 | } | 1189 | } |
1206 | 1190 | ||
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 45fa33e0cb90..70d1b22ced22 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -203,21 +203,6 @@ void netxen_initialize_adapter_sw(struct netxen_adapter *adapter) | |||
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 | void netxen_initialize_adapter_ops(struct netxen_adapter *adapter) | 206 | void netxen_initialize_adapter_ops(struct netxen_adapter *adapter) |
222 | { | 207 | { |
223 | switch (adapter->ahw.board_type) { | 208 | switch (adapter->ahw.board_type) { |
@@ -765,18 +750,13 @@ int netxen_flash_unlock(struct netxen_adapter *adapter) | |||
765 | 750 | ||
766 | int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | 751 | int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) |
767 | { | 752 | { |
768 | int addr, val, status; | 753 | int addr, val; |
769 | int n, i; | 754 | int n, i; |
770 | int init_delay = 0; | 755 | int init_delay = 0; |
771 | struct crb_addr_pair *buf; | 756 | struct crb_addr_pair *buf; |
772 | u32 off; | 757 | u32 off; |
773 | 758 | ||
774 | /* resetall */ | 759 | /* resetall */ |
775 | status = netxen_nic_get_board_info(adapter); | ||
776 | if (status) | ||
777 | printk("%s: netxen_pinit_from_rom: Error getting board info\n", | ||
778 | netxen_nic_driver_name); | ||
779 | |||
780 | netxen_crb_writelit_adapter(adapter, NETXEN_ROMUSB_GLB_SW_RESET, | 760 | netxen_crb_writelit_adapter(adapter, NETXEN_ROMUSB_GLB_SW_RESET, |
781 | NETXEN_ROMBUS_RESET); | 761 | NETXEN_ROMBUS_RESET); |
782 | 762 | ||
@@ -860,10 +840,10 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
860 | netxen_nic_pci_change_crbwindow(adapter, 1); | 840 | netxen_nic_pci_change_crbwindow(adapter, 1); |
861 | } | 841 | } |
862 | if (init_delay == 1) { | 842 | if (init_delay == 1) { |
863 | msleep(2000); | 843 | msleep(1000); |
864 | init_delay = 0; | 844 | init_delay = 0; |
865 | } | 845 | } |
866 | msleep(20); | 846 | msleep(1); |
867 | } | 847 | } |
868 | kfree(buf); | 848 | kfree(buf); |
869 | 849 | ||
@@ -938,12 +918,28 @@ int netxen_initialize_adapter_offload(struct netxen_adapter *adapter) | |||
938 | 918 | ||
939 | void netxen_free_adapter_offload(struct netxen_adapter *adapter) | 919 | void netxen_free_adapter_offload(struct netxen_adapter *adapter) |
940 | { | 920 | { |
921 | int i; | ||
922 | |||
941 | if (adapter->dummy_dma.addr) { | 923 | if (adapter->dummy_dma.addr) { |
942 | pci_free_consistent(adapter->ahw.pdev, | 924 | i = 100; |
925 | do { | ||
926 | if (dma_watchdog_shutdown_request(adapter) == 1) | ||
927 | break; | ||
928 | msleep(50); | ||
929 | if (dma_watchdog_shutdown_poll_result(adapter) == 1) | ||
930 | break; | ||
931 | } while (--i); | ||
932 | |||
933 | if (i) { | ||
934 | pci_free_consistent(adapter->ahw.pdev, | ||
943 | NETXEN_HOST_DUMMY_DMA_SIZE, | 935 | NETXEN_HOST_DUMMY_DMA_SIZE, |
944 | adapter->dummy_dma.addr, | 936 | adapter->dummy_dma.addr, |
945 | adapter->dummy_dma.phys_addr); | 937 | adapter->dummy_dma.phys_addr); |
946 | adapter->dummy_dma.addr = NULL; | 938 | adapter->dummy_dma.addr = NULL; |
939 | } else { | ||
940 | printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n", | ||
941 | adapter->netdev->name); | ||
942 | } | ||
947 | } | 943 | } |
948 | } | 944 | } |
949 | 945 | ||
diff --git a/drivers/net/netxen/netxen_nic_isr.c b/drivers/net/netxen/netxen_nic_isr.c index f487615f4063..96cec41f9019 100644 --- a/drivers/net/netxen/netxen_nic_isr.c +++ b/drivers/net/netxen/netxen_nic_isr.c | |||
@@ -145,7 +145,7 @@ static void netxen_nic_isr_other(struct netxen_adapter *adapter) | |||
145 | 145 | ||
146 | /* verify the offset */ | 146 | /* verify the offset */ |
147 | val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); | 147 | val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); |
148 | val = val >> physical_port[adapter->portnum]; | 148 | val = val >> adapter->physical_port; |
149 | if (val == adapter->ahw.qg_linksup) | 149 | if (val == adapter->ahw.qg_linksup) |
150 | return; | 150 | return; |
151 | 151 | ||
@@ -199,7 +199,7 @@ void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter) | |||
199 | 199 | ||
200 | /* WINDOW = 1 */ | 200 | /* WINDOW = 1 */ |
201 | val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); | 201 | val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); |
202 | val >>= (physical_port[adapter->portnum] * 8); | 202 | val >>= (adapter->physical_port * 8); |
203 | val &= 0xff; | 203 | val &= 0xff; |
204 | 204 | ||
205 | if (adapter->ahw.xg_linkup == 1 && val != XG_LINK_UP) { | 205 | if (adapter->ahw.xg_linkup == 1 && val != XG_LINK_UP) { |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 7144c255ce54..6797ed069f1f 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -70,17 +70,15 @@ static void netxen_nic_poll_controller(struct net_device *netdev); | |||
70 | static irqreturn_t netxen_intr(int irq, void *data); | 70 | static irqreturn_t netxen_intr(int irq, void *data); |
71 | static irqreturn_t netxen_msi_intr(int irq, void *data); | 71 | static irqreturn_t netxen_msi_intr(int irq, void *data); |
72 | 72 | ||
73 | int physical_port[] = {0, 1, 2, 3}; | ||
74 | |||
75 | /* PCI Device ID Table */ | 73 | /* PCI Device ID Table */ |
76 | static struct pci_device_id netxen_pci_tbl[] __devinitdata = { | 74 | static struct pci_device_id netxen_pci_tbl[] __devinitdata = { |
77 | {PCI_DEVICE(0x4040, 0x0001)}, | 75 | {PCI_DEVICE(0x4040, 0x0001), PCI_DEVICE_CLASS(0x020000, ~0)}, |
78 | {PCI_DEVICE(0x4040, 0x0002)}, | 76 | {PCI_DEVICE(0x4040, 0x0002), PCI_DEVICE_CLASS(0x020000, ~0)}, |
79 | {PCI_DEVICE(0x4040, 0x0003)}, | 77 | {PCI_DEVICE(0x4040, 0x0003), PCI_DEVICE_CLASS(0x020000, ~0)}, |
80 | {PCI_DEVICE(0x4040, 0x0004)}, | 78 | {PCI_DEVICE(0x4040, 0x0004), PCI_DEVICE_CLASS(0x020000, ~0)}, |
81 | {PCI_DEVICE(0x4040, 0x0005)}, | 79 | {PCI_DEVICE(0x4040, 0x0005), PCI_DEVICE_CLASS(0x020000, ~0)}, |
82 | {PCI_DEVICE(0x4040, 0x0024)}, | 80 | {PCI_DEVICE(0x4040, 0x0024), PCI_DEVICE_CLASS(0x020000, ~0)}, |
83 | {PCI_DEVICE(0x4040, 0x0025)}, | 81 | {PCI_DEVICE(0x4040, 0x0025), PCI_DEVICE_CLASS(0x020000, ~0)}, |
84 | {0,} | 82 | {0,} |
85 | }; | 83 | }; |
86 | 84 | ||
@@ -288,10 +286,11 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
288 | int pci_func_id = PCI_FUNC(pdev->devfn); | 286 | int pci_func_id = PCI_FUNC(pdev->devfn); |
289 | DECLARE_MAC_BUF(mac); | 287 | DECLARE_MAC_BUF(mac); |
290 | 288 | ||
291 | printk(KERN_INFO "%s \n", netxen_nic_driver_string); | 289 | if (pci_func_id == 0) |
290 | printk(KERN_INFO "%s \n", netxen_nic_driver_string); | ||
292 | 291 | ||
293 | if (pdev->class != 0x020000) { | 292 | if (pdev->class != 0x020000) { |
294 | printk(KERN_ERR"NetXen function %d, class %x will not " | 293 | printk(KERN_DEBUG "NetXen function %d, class %x will not " |
295 | "be enabled.\n",pci_func_id, pdev->class); | 294 | "be enabled.\n",pci_func_id, pdev->class); |
296 | return -ENODEV; | 295 | return -ENODEV; |
297 | } | 296 | } |
@@ -450,8 +449,12 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
450 | */ | 449 | */ |
451 | adapter->curr_window = 255; | 450 | adapter->curr_window = 255; |
452 | 451 | ||
453 | /* initialize the adapter */ | 452 | if (netxen_nic_get_board_info(adapter) != 0) { |
454 | netxen_initialize_adapter_hw(adapter); | 453 | printk("%s: Error getting board config info.\n", |
454 | netxen_nic_driver_name); | ||
455 | err = -EIO; | ||
456 | goto err_out_iounmap; | ||
457 | } | ||
455 | 458 | ||
456 | /* | 459 | /* |
457 | * Adapter in our case is quad port so initialize it before | 460 | * Adapter in our case is quad port so initialize it before |
@@ -530,17 +533,15 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
530 | netxen_initialize_adapter_sw(adapter); /* initialize the buffers in adapter */ | 533 | netxen_initialize_adapter_sw(adapter); /* initialize the buffers in adapter */ |
531 | 534 | ||
532 | /* Mezz cards have PCI function 0,2,3 enabled */ | 535 | /* Mezz cards have PCI function 0,2,3 enabled */ |
533 | if ((adapter->ahw.boardcfg.board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) | 536 | switch (adapter->ahw.boardcfg.board_type) { |
534 | && (pci_func_id >= 2)) | 537 | case NETXEN_BRDTYPE_P2_SB31_10G_IMEZ: |
538 | case NETXEN_BRDTYPE_P2_SB31_10G_HMEZ: | ||
539 | if (pci_func_id >= 2) | ||
535 | adapter->portnum = pci_func_id - 2; | 540 | adapter->portnum = pci_func_id - 2; |
536 | 541 | break; | |
537 | #ifdef CONFIG_IA64 | 542 | default: |
538 | if(adapter->portnum == 0) { | 543 | break; |
539 | netxen_pinit_from_rom(adapter, 0); | ||
540 | udelay(500); | ||
541 | netxen_load_firmware(adapter); | ||
542 | } | 544 | } |
543 | #endif | ||
544 | 545 | ||
545 | init_timer(&adapter->watchdog_timer); | 546 | init_timer(&adapter->watchdog_timer); |
546 | adapter->ahw.xg_linkup = 0; | 547 | adapter->ahw.xg_linkup = 0; |
@@ -613,11 +614,18 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
613 | err = -ENODEV; | 614 | err = -ENODEV; |
614 | goto err_out_free_dev; | 615 | goto err_out_free_dev; |
615 | } | 616 | } |
617 | } else { | ||
618 | writel(0, NETXEN_CRB_NORMALIZE(adapter, | ||
619 | CRB_CMDPEG_STATE)); | ||
620 | netxen_pinit_from_rom(adapter, 0); | ||
621 | msleep(1); | ||
622 | netxen_load_firmware(adapter); | ||
623 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); | ||
616 | } | 624 | } |
617 | 625 | ||
618 | /* clear the register for future unloads/loads */ | 626 | /* clear the register for future unloads/loads */ |
619 | writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc))); | 627 | writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc))); |
620 | printk(KERN_INFO "State: 0x%0x\n", | 628 | dev_info(&pdev->dev, "cmdpeg state: 0x%0x\n", |
621 | readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE))); | 629 | readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE))); |
622 | 630 | ||
623 | /* | 631 | /* |
@@ -639,9 +647,10 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
639 | /* | 647 | /* |
640 | * See if the firmware gave us a virtual-physical port mapping. | 648 | * See if the firmware gave us a virtual-physical port mapping. |
641 | */ | 649 | */ |
650 | adapter->physical_port = adapter->portnum; | ||
642 | i = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_V2P(adapter->portnum))); | 651 | i = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_V2P(adapter->portnum))); |
643 | if (i != 0x55555555) | 652 | if (i != 0x55555555) |
644 | physical_port[adapter->portnum] = i; | 653 | adapter->physical_port = i; |
645 | 654 | ||
646 | netif_carrier_off(netdev); | 655 | netif_carrier_off(netdev); |
647 | netif_stop_queue(netdev); | 656 | netif_stop_queue(netdev); |
@@ -654,22 +663,9 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
654 | goto err_out_free_dev; | 663 | goto err_out_free_dev; |
655 | } | 664 | } |
656 | 665 | ||
666 | netxen_nic_flash_print(adapter); | ||
657 | pci_set_drvdata(pdev, adapter); | 667 | pci_set_drvdata(pdev, adapter); |
658 | 668 | ||
659 | switch (adapter->ahw.board_type) { | ||
660 | case NETXEN_NIC_GBE: | ||
661 | printk(KERN_INFO "%s: QUAD GbE board initialized\n", | ||
662 | netxen_nic_driver_name); | ||
663 | break; | ||
664 | |||
665 | case NETXEN_NIC_XGBE: | ||
666 | printk(KERN_INFO "%s: XGbE board initialized\n", | ||
667 | netxen_nic_driver_name); | ||
668 | break; | ||
669 | } | ||
670 | |||
671 | adapter->driver_mismatch = 0; | ||
672 | |||
673 | return 0; | 669 | return 0; |
674 | 670 | ||
675 | err_out_free_dev: | 671 | err_out_free_dev: |
@@ -760,55 +756,8 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
760 | 756 | ||
761 | vfree(adapter->cmd_buf_arr); | 757 | vfree(adapter->cmd_buf_arr); |
762 | 758 | ||
763 | if (adapter->portnum == 0) { | 759 | if (adapter->portnum == 0) |
764 | if (init_firmware_done) { | 760 | netxen_free_adapter_offload(adapter); |
765 | i = 100; | ||
766 | do { | ||
767 | if (dma_watchdog_shutdown_request(adapter) == 1) | ||
768 | break; | ||
769 | msleep(100); | ||
770 | if (dma_watchdog_shutdown_poll_result(adapter) == 1) | ||
771 | break; | ||
772 | } while (--i); | ||
773 | |||
774 | if (i == 0) | ||
775 | printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n", | ||
776 | netdev->name); | ||
777 | |||
778 | /* clear the register for future unloads/loads */ | ||
779 | writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc))); | ||
780 | printk(KERN_INFO "State: 0x%0x\n", | ||
781 | readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE))); | ||
782 | |||
783 | /* leave the hw in the same state as reboot */ | ||
784 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); | ||
785 | netxen_pinit_from_rom(adapter, 0); | ||
786 | msleep(1); | ||
787 | netxen_load_firmware(adapter); | ||
788 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); | ||
789 | } | ||
790 | |||
791 | /* clear the register for future unloads/loads */ | ||
792 | writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc))); | ||
793 | printk(KERN_INFO "State: 0x%0x\n", | ||
794 | readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE))); | ||
795 | |||
796 | i = 100; | ||
797 | do { | ||
798 | if (dma_watchdog_shutdown_request(adapter) == 1) | ||
799 | break; | ||
800 | msleep(100); | ||
801 | if (dma_watchdog_shutdown_poll_result(adapter) == 1) | ||
802 | break; | ||
803 | } while (--i); | ||
804 | |||
805 | if (i) { | ||
806 | netxen_free_adapter_offload(adapter); | ||
807 | } else { | ||
808 | printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n", | ||
809 | netdev->name); | ||
810 | } | ||
811 | } | ||
812 | 761 | ||
813 | if (adapter->irq) | 762 | if (adapter->irq) |
814 | free_irq(adapter->irq, adapter); | 763 | free_irq(adapter->irq, adapter); |
@@ -840,13 +789,15 @@ static int netxen_nic_open(struct net_device *netdev) | |||
840 | irq_handler_t handler; | 789 | irq_handler_t handler; |
841 | unsigned long flags = IRQF_SAMPLE_RANDOM; | 790 | unsigned long flags = IRQF_SAMPLE_RANDOM; |
842 | 791 | ||
792 | if (adapter->driver_mismatch) | ||
793 | return -EIO; | ||
794 | |||
843 | if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC) { | 795 | if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC) { |
844 | err = netxen_init_firmware(adapter); | 796 | err = netxen_init_firmware(adapter); |
845 | if (err != 0) { | 797 | if (err != 0) { |
846 | printk(KERN_ERR "Failed to init firmware\n"); | 798 | printk(KERN_ERR "Failed to init firmware\n"); |
847 | return -EIO; | 799 | return -EIO; |
848 | } | 800 | } |
849 | netxen_nic_flash_print(adapter); | ||
850 | 801 | ||
851 | /* setup all the resources for the Phantom... */ | 802 | /* setup all the resources for the Phantom... */ |
852 | /* this include the descriptors for rcv, tx, and status */ | 803 | /* this include the descriptors for rcv, tx, and status */ |
@@ -895,14 +846,12 @@ static int netxen_nic_open(struct net_device *netdev) | |||
895 | if (adapter->set_mtu) | 846 | if (adapter->set_mtu) |
896 | adapter->set_mtu(adapter, netdev->mtu); | 847 | adapter->set_mtu(adapter, netdev->mtu); |
897 | 848 | ||
898 | if (!adapter->driver_mismatch) | 849 | mod_timer(&adapter->watchdog_timer, jiffies); |
899 | mod_timer(&adapter->watchdog_timer, jiffies); | ||
900 | 850 | ||
901 | napi_enable(&adapter->napi); | 851 | napi_enable(&adapter->napi); |
902 | netxen_nic_enable_int(adapter); | 852 | netxen_nic_enable_int(adapter); |
903 | 853 | ||
904 | if (!adapter->driver_mismatch) | 854 | netif_start_queue(netdev); |
905 | netif_start_queue(netdev); | ||
906 | 855 | ||
907 | return 0; | 856 | return 0; |
908 | } | 857 | } |
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c index 1c852a76c80d..a3bc7cc67a6f 100644 --- a/drivers/net/netxen/netxen_nic_niu.c +++ b/drivers/net/netxen/netxen_nic_niu.c | |||
@@ -94,7 +94,7 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg, | |||
94 | long timeout = 0; | 94 | long timeout = 0; |
95 | long result = 0; | 95 | long result = 0; |
96 | long restore = 0; | 96 | long restore = 0; |
97 | long phy = physical_port[adapter->portnum]; | 97 | long phy = adapter->physical_port; |
98 | __u32 address; | 98 | __u32 address; |
99 | __u32 command; | 99 | __u32 command; |
100 | __u32 status; | 100 | __u32 status; |
@@ -190,7 +190,7 @@ int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long reg, | |||
190 | long timeout = 0; | 190 | long timeout = 0; |
191 | long result = 0; | 191 | long result = 0; |
192 | long restore = 0; | 192 | long restore = 0; |
193 | long phy = physical_port[adapter->portnum]; | 193 | long phy = adapter->physical_port; |
194 | __u32 address; | 194 | __u32 address; |
195 | __u32 command; | 195 | __u32 command; |
196 | __u32 status; | 196 | __u32 status; |
@@ -456,7 +456,7 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port) | |||
456 | 456 | ||
457 | int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) | 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 | netxen_crb_writelit_adapter(adapter, | 461 | netxen_crb_writelit_adapter(adapter, |
462 | NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), 0x1447); | 462 | NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), 0x1447); |
@@ -573,7 +573,7 @@ static int netxen_niu_macaddr_get(struct netxen_adapter *adapter, | |||
573 | { | 573 | { |
574 | u32 stationhigh; | 574 | u32 stationhigh; |
575 | u32 stationlow; | 575 | u32 stationlow; |
576 | int phy = physical_port[adapter->portnum]; | 576 | int phy = adapter->physical_port; |
577 | u8 val[8]; | 577 | u8 val[8]; |
578 | 578 | ||
579 | if (addr == NULL) | 579 | if (addr == NULL) |
@@ -604,7 +604,7 @@ int netxen_niu_macaddr_set(struct netxen_adapter *adapter, | |||
604 | { | 604 | { |
605 | u8 temp[4]; | 605 | u8 temp[4]; |
606 | u32 val; | 606 | u32 val; |
607 | int phy = physical_port[adapter->portnum]; | 607 | int phy = adapter->physical_port; |
608 | unsigned char mac_addr[6]; | 608 | unsigned char mac_addr[6]; |
609 | int i; | 609 | int i; |
610 | DECLARE_MAC_BUF(mac); | 610 | DECLARE_MAC_BUF(mac); |
@@ -724,7 +724,7 @@ int netxen_niu_enable_gbe_port(struct netxen_adapter *adapter, | |||
724 | int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter) | 724 | int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter) |
725 | { | 725 | { |
726 | __u32 mac_cfg0; | 726 | __u32 mac_cfg0; |
727 | u32 port = physical_port[adapter->portnum]; | 727 | u32 port = adapter->physical_port; |
728 | 728 | ||
729 | if (port > NETXEN_NIU_MAX_GBE_PORTS) | 729 | if (port > NETXEN_NIU_MAX_GBE_PORTS) |
730 | return -EINVAL; | 730 | return -EINVAL; |
@@ -740,7 +740,7 @@ int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter) | |||
740 | int netxen_niu_disable_xg_port(struct netxen_adapter *adapter) | 740 | int netxen_niu_disable_xg_port(struct netxen_adapter *adapter) |
741 | { | 741 | { |
742 | __u32 mac_cfg; | 742 | __u32 mac_cfg; |
743 | u32 port = physical_port[adapter->portnum]; | 743 | u32 port = adapter->physical_port; |
744 | 744 | ||
745 | if (port > NETXEN_NIU_MAX_XG_PORTS) | 745 | if (port > NETXEN_NIU_MAX_XG_PORTS) |
746 | return -EINVAL; | 746 | return -EINVAL; |
@@ -757,7 +757,7 @@ int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter, | |||
757 | netxen_niu_prom_mode_t mode) | 757 | netxen_niu_prom_mode_t mode) |
758 | { | 758 | { |
759 | __u32 reg; | 759 | __u32 reg; |
760 | u32 port = physical_port[adapter->portnum]; | 760 | u32 port = adapter->physical_port; |
761 | 761 | ||
762 | if (port > NETXEN_NIU_MAX_GBE_PORTS) | 762 | if (port > NETXEN_NIU_MAX_GBE_PORTS) |
763 | return -EINVAL; | 763 | return -EINVAL; |
@@ -814,7 +814,7 @@ int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter, | |||
814 | int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter, | 814 | int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter, |
815 | netxen_ethernet_macaddr_t addr) | 815 | netxen_ethernet_macaddr_t addr) |
816 | { | 816 | { |
817 | int phy = physical_port[adapter->portnum]; | 817 | int phy = adapter->physical_port; |
818 | u8 temp[4]; | 818 | u8 temp[4]; |
819 | u32 val; | 819 | u32 val; |
820 | 820 | ||
@@ -867,7 +867,7 @@ int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter, | |||
867 | int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, | 867 | int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, |
868 | netxen_ethernet_macaddr_t * addr) | 868 | netxen_ethernet_macaddr_t * addr) |
869 | { | 869 | { |
870 | int phy = physical_port[adapter->portnum]; | 870 | int phy = adapter->physical_port; |
871 | u32 stationhigh; | 871 | u32 stationhigh; |
872 | u32 stationlow; | 872 | u32 stationlow; |
873 | u8 val[8]; | 873 | u8 val[8]; |
@@ -896,7 +896,7 @@ int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter, | |||
896 | netxen_niu_prom_mode_t mode) | 896 | netxen_niu_prom_mode_t mode) |
897 | { | 897 | { |
898 | __u32 reg; | 898 | __u32 reg; |
899 | u32 port = physical_port[adapter->portnum]; | 899 | u32 port = adapter->physical_port; |
900 | 900 | ||
901 | if (port > NETXEN_NIU_MAX_XG_PORTS) | 901 | if (port > NETXEN_NIU_MAX_XG_PORTS) |
902 | return -EINVAL; | 902 | return -EINVAL; |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 64b7effe49dd..711e4a8948e0 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -118,6 +118,7 @@ static DEFINE_PCI_DEVICE_TABLE(sky2_id_table) = { | |||
118 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4352) }, /* 88E8038 */ | 118 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4352) }, /* 88E8038 */ |
119 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4353) }, /* 88E8039 */ | 119 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4353) }, /* 88E8039 */ |
120 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4354) }, /* 88E8040 */ | 120 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4354) }, /* 88E8040 */ |
121 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4355) }, /* 88E8040T */ | ||
121 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4356) }, /* 88EC033 */ | 122 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4356) }, /* 88EC033 */ |
122 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4357) }, /* 88E8042 */ | 123 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4357) }, /* 88E8042 */ |
123 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x435A) }, /* 88E8048 */ | 124 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x435A) }, /* 88E8048 */ |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 0ce07a339c7e..7ab94c825b57 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -313,6 +313,21 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv, | |||
313 | 313 | ||
314 | switch (tun->flags & TUN_TYPE_MASK) { | 314 | switch (tun->flags & TUN_TYPE_MASK) { |
315 | case TUN_TUN_DEV: | 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 | skb_reset_mac_header(skb); | 331 | skb_reset_mac_header(skb); |
317 | skb->protocol = pi.proto; | 332 | skb->protocol = pi.proto; |
318 | skb->dev = tun->dev; | 333 | skb->dev = tun->dev; |
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h index f736e842977f..f80c0ed6d870 100644 --- a/include/net/netfilter/nf_conntrack_extend.h +++ b/include/net/netfilter/nf_conntrack_extend.h | |||
@@ -15,6 +15,7 @@ enum nf_ct_ext_id | |||
15 | 15 | ||
16 | /* Extensions: optional stuff which isn't permanently in struct. */ | 16 | /* Extensions: optional stuff which isn't permanently in struct. */ |
17 | struct nf_ct_ext { | 17 | struct nf_ct_ext { |
18 | struct rcu_head rcu; | ||
18 | u8 offset[NF_CT_EXT_NUM]; | 19 | u8 offset[NF_CT_EXT_NUM]; |
19 | u8 len; | 20 | u8 len; |
20 | char data[0]; | 21 | char data[0]; |
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c index 04578593e100..d2a887fc8d9b 100644 --- a/net/ipv4/netfilter/nf_nat_core.c +++ b/net/ipv4/netfilter/nf_nat_core.c | |||
@@ -556,7 +556,6 @@ static void nf_nat_cleanup_conntrack(struct nf_conn *ct) | |||
556 | 556 | ||
557 | spin_lock_bh(&nf_nat_lock); | 557 | spin_lock_bh(&nf_nat_lock); |
558 | hlist_del_rcu(&nat->bysource); | 558 | hlist_del_rcu(&nat->bysource); |
559 | nat->ct = NULL; | ||
560 | spin_unlock_bh(&nf_nat_lock); | 559 | spin_unlock_bh(&nf_nat_lock); |
561 | } | 560 | } |
562 | 561 | ||
@@ -570,8 +569,8 @@ static void nf_nat_move_storage(void *new, void *old) | |||
570 | return; | 569 | return; |
571 | 570 | ||
572 | spin_lock_bh(&nf_nat_lock); | 571 | spin_lock_bh(&nf_nat_lock); |
573 | hlist_replace_rcu(&old_nat->bysource, &new_nat->bysource); | ||
574 | new_nat->ct = ct; | 572 | new_nat->ct = ct; |
573 | hlist_replace_rcu(&old_nat->bysource, &new_nat->bysource); | ||
575 | spin_unlock_bh(&nf_nat_lock); | 574 | spin_unlock_bh(&nf_nat_lock); |
576 | } | 575 | } |
577 | 576 | ||
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c index 584e6d74e3a9..7135279f3f84 100644 --- a/net/ipv4/xfrm4_mode_tunnel.c +++ b/net/ipv4/xfrm4_mode_tunnel.c | |||
@@ -52,7 +52,7 @@ static int xfrm4_mode_tunnel_output(struct xfrm_state *x, struct sk_buff *skb) | |||
52 | IP_ECN_clear(top_iph); | 52 | IP_ECN_clear(top_iph); |
53 | 53 | ||
54 | top_iph->frag_off = (flags & XFRM_STATE_NOPMTUDISC) ? | 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 | ip_select_ident(top_iph, dst->child, NULL); | 56 | ip_select_ident(top_iph, dst->child, NULL); |
57 | 57 | ||
58 | top_iph->ttl = dst_metric(dst->child, RTAX_HOPLIMIT); | 58 | top_iph->ttl = dst_metric(dst->child, RTAX_HOPLIMIT); |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 195cb6dd02a0..ce06e791bf43 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -1567,7 +1567,7 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1567 | * make it big enough for everything we may ever need. | 1567 | * make it big enough for everything we may ever need. |
1568 | */ | 1568 | */ |
1569 | 1569 | ||
1570 | if (head_need > 0 || skb_header_cloned(skb)) { | 1570 | if (head_need > 0 || skb_cloned(skb)) { |
1571 | head_need += IEEE80211_ENCRYPT_HEADROOM; | 1571 | head_need += IEEE80211_ENCRYPT_HEADROOM; |
1572 | head_need += local->tx_headroom; | 1572 | head_need += local->tx_headroom; |
1573 | head_need = max_t(int, 0, head_need); | 1573 | head_need = max_t(int, 0, head_need); |
diff --git a/net/netfilter/nf_conntrack_extend.c b/net/netfilter/nf_conntrack_extend.c index ba1c4915e9eb..3469bc71a385 100644 --- a/net/netfilter/nf_conntrack_extend.c +++ b/net/netfilter/nf_conntrack_extend.c | |||
@@ -59,12 +59,19 @@ nf_ct_ext_create(struct nf_ct_ext **ext, enum nf_ct_ext_id id, gfp_t gfp) | |||
59 | if (!*ext) | 59 | if (!*ext) |
60 | return NULL; | 60 | return NULL; |
61 | 61 | ||
62 | INIT_RCU_HEAD(&(*ext)->rcu); | ||
62 | (*ext)->offset[id] = off; | 63 | (*ext)->offset[id] = off; |
63 | (*ext)->len = len; | 64 | (*ext)->len = len; |
64 | 65 | ||
65 | return (void *)(*ext) + off; | 66 | return (void *)(*ext) + off; |
66 | } | 67 | } |
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); | ||
73 | } | ||
74 | |||
68 | void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp) | 75 | void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp) |
69 | { | 76 | { |
70 | struct nf_ct_ext *new; | 77 | struct nf_ct_ext *new; |
@@ -104,7 +111,7 @@ void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp) | |||
104 | (void *)ct->ext + ct->ext->offset[i]); | 111 | (void *)ct->ext + ct->ext->offset[i]); |
105 | rcu_read_unlock(); | 112 | rcu_read_unlock(); |
106 | } | 113 | } |
107 | kfree(ct->ext); | 114 | call_rcu(&ct->ext->rcu, __nf_ct_ext_free_rcu); |
108 | ct->ext = new; | 115 | ct->ext = new; |
109 | } | 116 | } |
110 | 117 | ||
diff --git a/net/netfilter/nf_conntrack_h323_main.c b/net/netfilter/nf_conntrack_h323_main.c index 95da1a24aab7..2f83c158934d 100644 --- a/net/netfilter/nf_conntrack_h323_main.c +++ b/net/netfilter/nf_conntrack_h323_main.c | |||
@@ -619,6 +619,7 @@ static const struct nf_conntrack_expect_policy h245_exp_policy = { | |||
619 | static struct nf_conntrack_helper nf_conntrack_helper_h245 __read_mostly = { | 619 | static struct nf_conntrack_helper nf_conntrack_helper_h245 __read_mostly = { |
620 | .name = "H.245", | 620 | .name = "H.245", |
621 | .me = THIS_MODULE, | 621 | .me = THIS_MODULE, |
622 | .tuple.src.l3num = AF_UNSPEC, | ||
622 | .tuple.dst.protonum = IPPROTO_UDP, | 623 | .tuple.dst.protonum = IPPROTO_UDP, |
623 | .help = h245_help, | 624 | .help = h245_help, |
624 | .expect_policy = &h245_exp_policy, | 625 | .expect_policy = &h245_exp_policy, |
@@ -1765,6 +1766,7 @@ static void __exit nf_conntrack_h323_fini(void) | |||
1765 | nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[0]); | 1766 | nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[0]); |
1766 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]); | 1767 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]); |
1767 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]); | 1768 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]); |
1769 | nf_conntrack_helper_unregister(&nf_conntrack_helper_h245); | ||
1768 | kfree(h323_buffer); | 1770 | kfree(h323_buffer); |
1769 | pr_debug("nf_ct_h323: fini\n"); | 1771 | pr_debug("nf_ct_h323: fini\n"); |
1770 | } | 1772 | } |
@@ -1777,28 +1779,34 @@ static int __init nf_conntrack_h323_init(void) | |||
1777 | h323_buffer = kmalloc(65536, GFP_KERNEL); | 1779 | h323_buffer = kmalloc(65536, GFP_KERNEL); |
1778 | if (!h323_buffer) | 1780 | if (!h323_buffer) |
1779 | return -ENOMEM; | 1781 | return -ENOMEM; |
1780 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[0]); | 1782 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_h245); |
1781 | if (ret < 0) | 1783 | if (ret < 0) |
1782 | goto err1; | 1784 | goto err1; |
1783 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[1]); | 1785 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[0]); |
1784 | if (ret < 0) | 1786 | if (ret < 0) |
1785 | goto err2; | 1787 | goto err2; |
1786 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[0]); | 1788 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[1]); |
1787 | if (ret < 0) | 1789 | if (ret < 0) |
1788 | goto err3; | 1790 | goto err3; |
1789 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[1]); | 1791 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[0]); |
1790 | if (ret < 0) | 1792 | if (ret < 0) |
1791 | goto err4; | 1793 | goto err4; |
1794 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[1]); | ||
1795 | if (ret < 0) | ||
1796 | goto err5; | ||
1792 | pr_debug("nf_ct_h323: init success\n"); | 1797 | pr_debug("nf_ct_h323: init success\n"); |
1793 | return 0; | 1798 | return 0; |
1794 | 1799 | ||
1795 | err4: | 1800 | err5: |
1796 | nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[0]); | 1801 | nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[0]); |
1797 | err3: | 1802 | err4: |
1798 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]); | 1803 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]); |
1799 | err2: | 1804 | err3: |
1800 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]); | 1805 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]); |
1806 | err2: | ||
1807 | nf_conntrack_helper_unregister(&nf_conntrack_helper_h245); | ||
1801 | err1: | 1808 | err1: |
1809 | kfree(h323_buffer); | ||
1802 | return ret; | 1810 | return ret; |
1803 | } | 1811 | } |
1804 | 1812 | ||
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index f5aa23c3e886..3e1191cecaf0 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -444,8 +444,11 @@ static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
444 | if (ops->dumpit == NULL) | 444 | if (ops->dumpit == NULL) |
445 | return -EOPNOTSUPP; | 445 | return -EOPNOTSUPP; |
446 | 446 | ||
447 | return netlink_dump_start(genl_sock, skb, nlh, | 447 | genl_unlock(); |
448 | ops->dumpit, ops->done); | 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 | if (ops->doit == NULL) | 454 | if (ops->doit == NULL) |
@@ -603,9 +606,6 @@ static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb) | |||
603 | int chains_to_skip = cb->args[0]; | 606 | int chains_to_skip = cb->args[0]; |
604 | int fams_to_skip = cb->args[1]; | 607 | int fams_to_skip = cb->args[1]; |
605 | 608 | ||
606 | if (chains_to_skip != 0) | ||
607 | genl_lock(); | ||
608 | |||
609 | for (i = 0; i < GENL_FAM_TAB_SIZE; i++) { | 609 | for (i = 0; i < GENL_FAM_TAB_SIZE; i++) { |
610 | if (i < chains_to_skip) | 610 | if (i < chains_to_skip) |
611 | continue; | 611 | continue; |
@@ -623,9 +623,6 @@ static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb) | |||
623 | } | 623 | } |
624 | 624 | ||
625 | errout: | 625 | errout: |
626 | if (chains_to_skip != 0) | ||
627 | genl_unlock(); | ||
628 | |||
629 | cb->args[0] = i; | 626 | cb->args[0] = i; |
630 | cb->args[1] = n; | 627 | cb->args[1] = n; |
631 | 628 | ||
@@ -770,7 +767,7 @@ static int __init genl_init(void) | |||
770 | 767 | ||
771 | /* we'll bump the group number right afterwards */ | 768 | /* we'll bump the group number right afterwards */ |
772 | genl_sock = netlink_kernel_create(&init_net, NETLINK_GENERIC, 0, | 769 | genl_sock = netlink_kernel_create(&init_net, NETLINK_GENERIC, 0, |
773 | genl_rcv, NULL, THIS_MODULE); | 770 | genl_rcv, &genl_mutex, THIS_MODULE); |
774 | if (genl_sock == NULL) | 771 | if (genl_sock == NULL) |
775 | panic("GENL: Cannot initialize generic netlink\n"); | 772 | panic("GENL: Cannot initialize generic netlink\n"); |
776 | 773 | ||
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 392e80e3268d..b4280490cf6e 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -167,6 +167,11 @@ static inline int unix_may_send(struct sock *sk, struct sock *osk) | |||
167 | return (unix_peer(osk) == NULL || unix_our_peer(sk, osk)); | 167 | return (unix_peer(osk) == NULL || unix_our_peer(sk, osk)); |
168 | } | 168 | } |
169 | 169 | ||
170 | static inline int unix_recvq_full(struct sock const *sk) | ||
171 | { | ||
172 | return skb_queue_len(&sk->sk_receive_queue) > sk->sk_max_ack_backlog; | ||
173 | } | ||
174 | |||
170 | static struct sock *unix_peer_get(struct sock *s) | 175 | static struct sock *unix_peer_get(struct sock *s) |
171 | { | 176 | { |
172 | struct sock *peer; | 177 | struct sock *peer; |
@@ -480,6 +485,8 @@ static int unix_socketpair(struct socket *, struct socket *); | |||
480 | static int unix_accept(struct socket *, struct socket *, int); | 485 | static int unix_accept(struct socket *, struct socket *, int); |
481 | static int unix_getname(struct socket *, struct sockaddr *, int *, int); | 486 | static int unix_getname(struct socket *, struct sockaddr *, int *, int); |
482 | static unsigned int unix_poll(struct file *, struct socket *, poll_table *); | 487 | static unsigned int unix_poll(struct file *, struct socket *, poll_table *); |
488 | static unsigned int unix_datagram_poll(struct file *, struct socket *, | ||
489 | poll_table *); | ||
483 | static int unix_ioctl(struct socket *, unsigned int, unsigned long); | 490 | static int unix_ioctl(struct socket *, unsigned int, unsigned long); |
484 | static int unix_shutdown(struct socket *, int); | 491 | static int unix_shutdown(struct socket *, int); |
485 | static int unix_stream_sendmsg(struct kiocb *, struct socket *, | 492 | static int unix_stream_sendmsg(struct kiocb *, struct socket *, |
@@ -525,7 +532,7 @@ static const struct proto_ops unix_dgram_ops = { | |||
525 | .socketpair = unix_socketpair, | 532 | .socketpair = unix_socketpair, |
526 | .accept = sock_no_accept, | 533 | .accept = sock_no_accept, |
527 | .getname = unix_getname, | 534 | .getname = unix_getname, |
528 | .poll = datagram_poll, | 535 | .poll = unix_datagram_poll, |
529 | .ioctl = unix_ioctl, | 536 | .ioctl = unix_ioctl, |
530 | .listen = sock_no_listen, | 537 | .listen = sock_no_listen, |
531 | .shutdown = unix_shutdown, | 538 | .shutdown = unix_shutdown, |
@@ -546,7 +553,7 @@ static const struct proto_ops unix_seqpacket_ops = { | |||
546 | .socketpair = unix_socketpair, | 553 | .socketpair = unix_socketpair, |
547 | .accept = unix_accept, | 554 | .accept = unix_accept, |
548 | .getname = unix_getname, | 555 | .getname = unix_getname, |
549 | .poll = datagram_poll, | 556 | .poll = unix_datagram_poll, |
550 | .ioctl = unix_ioctl, | 557 | .ioctl = unix_ioctl, |
551 | .listen = unix_listen, | 558 | .listen = unix_listen, |
552 | .shutdown = unix_shutdown, | 559 | .shutdown = unix_shutdown, |
@@ -981,8 +988,7 @@ static long unix_wait_for_peer(struct sock *other, long timeo) | |||
981 | 988 | ||
982 | sched = !sock_flag(other, SOCK_DEAD) && | 989 | sched = !sock_flag(other, SOCK_DEAD) && |
983 | !(other->sk_shutdown & RCV_SHUTDOWN) && | 990 | !(other->sk_shutdown & RCV_SHUTDOWN) && |
984 | (skb_queue_len(&other->sk_receive_queue) > | 991 | unix_recvq_full(other); |
985 | other->sk_max_ack_backlog); | ||
986 | 992 | ||
987 | unix_state_unlock(other); | 993 | unix_state_unlock(other); |
988 | 994 | ||
@@ -1056,8 +1062,7 @@ restart: | |||
1056 | if (other->sk_state != TCP_LISTEN) | 1062 | if (other->sk_state != TCP_LISTEN) |
1057 | goto out_unlock; | 1063 | goto out_unlock; |
1058 | 1064 | ||
1059 | if (skb_queue_len(&other->sk_receive_queue) > | 1065 | if (unix_recvq_full(other)) { |
1060 | other->sk_max_ack_backlog) { | ||
1061 | err = -EAGAIN; | 1066 | err = -EAGAIN; |
1062 | if (!timeo) | 1067 | if (!timeo) |
1063 | goto out_unlock; | 1068 | goto out_unlock; |
@@ -1426,9 +1431,7 @@ restart: | |||
1426 | goto out_unlock; | 1431 | goto out_unlock; |
1427 | } | 1432 | } |
1428 | 1433 | ||
1429 | if (unix_peer(other) != sk && | 1434 | if (unix_peer(other) != sk && unix_recvq_full(other)) { |
1430 | (skb_queue_len(&other->sk_receive_queue) > | ||
1431 | other->sk_max_ack_backlog)) { | ||
1432 | if (!timeo) { | 1435 | if (!timeo) { |
1433 | err = -EAGAIN; | 1436 | err = -EAGAIN; |
1434 | goto out_unlock; | 1437 | goto out_unlock; |
@@ -1989,6 +1992,64 @@ static unsigned int unix_poll(struct file * file, struct socket *sock, poll_tabl | |||
1989 | return mask; | 1992 | return mask; |
1990 | } | 1993 | } |
1991 | 1994 | ||
1995 | static unsigned int unix_datagram_poll(struct file *file, struct socket *sock, | ||
1996 | poll_table *wait) | ||
1997 | { | ||
1998 | struct sock *sk = sock->sk, *peer; | ||
1999 | unsigned int mask; | ||
2000 | |||
2001 | poll_wait(file, sk->sk_sleep, wait); | ||
2002 | |||
2003 | peer = unix_peer_get(sk); | ||
2004 | if (peer) { | ||
2005 | if (peer != sk) { | ||
2006 | /* | ||
2007 | * Writability of a connected socket additionally | ||
2008 | * depends on the state of the receive queue of the | ||
2009 | * peer. | ||
2010 | */ | ||
2011 | poll_wait(file, &unix_sk(peer)->peer_wait, wait); | ||
2012 | } else { | ||
2013 | sock_put(peer); | ||
2014 | peer = NULL; | ||
2015 | } | ||
2016 | } | ||
2017 | |||
2018 | mask = 0; | ||
2019 | |||
2020 | /* exceptional events? */ | ||
2021 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) | ||
2022 | mask |= POLLERR; | ||
2023 | if (sk->sk_shutdown & RCV_SHUTDOWN) | ||
2024 | mask |= POLLRDHUP; | ||
2025 | if (sk->sk_shutdown == SHUTDOWN_MASK) | ||
2026 | mask |= POLLHUP; | ||
2027 | |||
2028 | /* readable? */ | ||
2029 | if (!skb_queue_empty(&sk->sk_receive_queue) || | ||
2030 | (sk->sk_shutdown & RCV_SHUTDOWN)) | ||
2031 | mask |= POLLIN | POLLRDNORM; | ||
2032 | |||
2033 | /* Connection-based need to check for termination and startup */ | ||
2034 | if (sk->sk_type == SOCK_SEQPACKET) { | ||
2035 | if (sk->sk_state == TCP_CLOSE) | ||
2036 | mask |= POLLHUP; | ||
2037 | /* connection hasn't started yet? */ | ||
2038 | if (sk->sk_state == TCP_SYN_SENT) | ||
2039 | return mask; | ||
2040 | } | ||
2041 | |||
2042 | /* writable? */ | ||
2043 | if (unix_writable(sk) && !(peer && unix_recvq_full(peer))) | ||
2044 | mask |= POLLOUT | POLLWRNORM | POLLWRBAND; | ||
2045 | else | ||
2046 | set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); | ||
2047 | |||
2048 | if (peer) | ||
2049 | sock_put(peer); | ||
2050 | |||
2051 | return mask; | ||
2052 | } | ||
1992 | 2053 | ||
1993 | #ifdef CONFIG_PROC_FS | 2054 | #ifdef CONFIG_PROC_FS |
1994 | static struct sock *first_unix_socket(int *i) | 2055 | static struct sock *first_unix_socket(int *i) |