diff options
76 files changed, 942 insertions, 658 deletions
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index 7c5f97033b9f..cb8943da4f12 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c | |||
| @@ -292,7 +292,9 @@ isdn_net_unbind_channel(isdn_net_local * lp) | |||
| 292 | lp->dialstate = 0; | 292 | lp->dialstate = 0; |
| 293 | dev->rx_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL; | 293 | dev->rx_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL; |
| 294 | dev->st_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL; | 294 | dev->st_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL; |
| 295 | isdn_free_channel(lp->isdn_device, lp->isdn_channel, ISDN_USAGE_NET); | 295 | if (lp->isdn_device != -1 && lp->isdn_channel != -1) |
| 296 | isdn_free_channel(lp->isdn_device, lp->isdn_channel, | ||
| 297 | ISDN_USAGE_NET); | ||
| 296 | lp->flags &= ~ISDN_NET_CONNECTED; | 298 | lp->flags &= ~ISDN_NET_CONNECTED; |
| 297 | lp->isdn_device = -1; | 299 | lp->isdn_device = -1; |
| 298 | lp->isdn_channel = -1; | 300 | lp->isdn_channel = -1; |
| @@ -2513,7 +2515,6 @@ static const struct net_device_ops isdn_netdev_ops = { | |||
| 2513 | .ndo_stop = isdn_net_close, | 2515 | .ndo_stop = isdn_net_close, |
| 2514 | .ndo_do_ioctl = isdn_net_ioctl, | 2516 | .ndo_do_ioctl = isdn_net_ioctl, |
| 2515 | 2517 | ||
| 2516 | .ndo_validate_addr = NULL, | ||
| 2517 | .ndo_start_xmit = isdn_net_start_xmit, | 2518 | .ndo_start_xmit = isdn_net_start_xmit, |
| 2518 | .ndo_get_stats = isdn_net_get_stats, | 2519 | .ndo_get_stats = isdn_net_get_stats, |
| 2519 | .ndo_tx_timeout = isdn_net_tx_timeout, | 2520 | .ndo_tx_timeout = isdn_net_tx_timeout, |
| @@ -2528,12 +2529,8 @@ static void _isdn_setup(struct net_device *dev) | |||
| 2528 | 2529 | ||
| 2529 | ether_setup(dev); | 2530 | ether_setup(dev); |
| 2530 | 2531 | ||
| 2531 | dev->flags = IFF_NOARP | IFF_POINTOPOINT; | ||
| 2532 | /* Setup the generic properties */ | 2532 | /* Setup the generic properties */ |
| 2533 | dev->mtu = 1500; | ||
| 2534 | dev->flags = IFF_NOARP|IFF_POINTOPOINT; | 2533 | dev->flags = IFF_NOARP|IFF_POINTOPOINT; |
| 2535 | dev->type = ARPHRD_ETHER; | ||
| 2536 | dev->addr_len = ETH_ALEN; | ||
| 2537 | dev->header_ops = NULL; | 2534 | dev->header_ops = NULL; |
| 2538 | dev->netdev_ops = &isdn_netdev_ops; | 2535 | dev->netdev_ops = &isdn_netdev_ops; |
| 2539 | 2536 | ||
diff --git a/drivers/net/arm/etherh.c b/drivers/net/arm/etherh.c index 745ac188babe..d15d8b79d8e5 100644 --- a/drivers/net/arm/etherh.c +++ b/drivers/net/arm/etherh.c | |||
| @@ -646,7 +646,7 @@ static const struct net_device_ops etherh_netdev_ops = { | |||
| 646 | .ndo_get_stats = ei_get_stats, | 646 | .ndo_get_stats = ei_get_stats, |
| 647 | .ndo_set_multicast_list = ei_set_multicast_list, | 647 | .ndo_set_multicast_list = ei_set_multicast_list, |
| 648 | .ndo_validate_addr = eth_validate_addr, | 648 | .ndo_validate_addr = eth_validate_addr, |
| 649 | .ndo_set_mac_addr = eth_set_mac_addr, | 649 | .ndo_set_mac_address = eth_set_mac_addr, |
| 650 | .ndo_change_mtu = eth_change_mtu, | 650 | .ndo_change_mtu = eth_change_mtu, |
| 651 | #ifdef CONFIG_NET_POLL_CONTROLLER | 651 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 652 | .ndo_poll_controller = ei_poll, | 652 | .ndo_poll_controller = ei_poll, |
diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c index 337488ec707c..a4eb6c40678c 100644 --- a/drivers/net/ax88796.c +++ b/drivers/net/ax88796.c | |||
| @@ -37,7 +37,10 @@ static int phy_debug = 0; | |||
| 37 | #define __ei_open ax_ei_open | 37 | #define __ei_open ax_ei_open |
| 38 | #define __ei_close ax_ei_close | 38 | #define __ei_close ax_ei_close |
| 39 | #define __ei_poll ax_ei_poll | 39 | #define __ei_poll ax_ei_poll |
| 40 | #define __ei_start_xmit ax_ei_start_xmit | ||
| 40 | #define __ei_tx_timeout ax_ei_tx_timeout | 41 | #define __ei_tx_timeout ax_ei_tx_timeout |
| 42 | #define __ei_get_stats ax_ei_get_stats | ||
| 43 | #define __ei_set_multicast_list ax_ei_set_multicast_list | ||
| 41 | #define __ei_interrupt ax_ei_interrupt | 44 | #define __ei_interrupt ax_ei_interrupt |
| 42 | #define ____alloc_ei_netdev ax__alloc_ei_netdev | 45 | #define ____alloc_ei_netdev ax__alloc_ei_netdev |
| 43 | #define __NS8390_init ax_NS8390_init | 46 | #define __NS8390_init ax_NS8390_init |
| @@ -623,6 +626,23 @@ static void ax_eeprom_register_write(struct eeprom_93cx6 *eeprom) | |||
| 623 | } | 626 | } |
| 624 | #endif | 627 | #endif |
| 625 | 628 | ||
| 629 | static const struct net_device_ops ax_netdev_ops = { | ||
| 630 | .ndo_open = ax_open, | ||
| 631 | .ndo_stop = ax_close, | ||
| 632 | .ndo_do_ioctl = ax_ioctl, | ||
| 633 | |||
| 634 | .ndo_start_xmit = ax_ei_start_xmit, | ||
| 635 | .ndo_tx_timeout = ax_ei_tx_timeout, | ||
| 636 | .ndo_get_stats = ax_ei_get_stats, | ||
| 637 | .ndo_set_multicast_list = ax_ei_set_multicast_list, | ||
| 638 | .ndo_validate_addr = eth_validate_addr, | ||
| 639 | .ndo_set_mac_address = eth_mac_addr, | ||
| 640 | .ndo_change_mtu = eth_change_mtu, | ||
| 641 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
| 642 | .ndo_poll_controller = ax_ei_poll, | ||
| 643 | #endif | ||
| 644 | }; | ||
| 645 | |||
| 626 | /* setup code */ | 646 | /* setup code */ |
| 627 | 647 | ||
| 628 | static void ax_initial_setup(struct net_device *dev, struct ei_device *ei_local) | 648 | static void ax_initial_setup(struct net_device *dev, struct ei_device *ei_local) |
| @@ -738,9 +758,7 @@ static int ax_init_dev(struct net_device *dev, int first_init) | |||
| 738 | ei_status.get_8390_hdr = &ax_get_8390_hdr; | 758 | ei_status.get_8390_hdr = &ax_get_8390_hdr; |
| 739 | ei_status.priv = 0; | 759 | ei_status.priv = 0; |
| 740 | 760 | ||
| 741 | dev->open = ax_open; | 761 | dev->netdev_ops = &ax_netdev_ops; |
| 742 | dev->stop = ax_close; | ||
| 743 | dev->do_ioctl = ax_ioctl; | ||
| 744 | dev->ethtool_ops = &ax_ethtool_ops; | 762 | dev->ethtool_ops = &ax_ethtool_ops; |
| 745 | 763 | ||
| 746 | ax->msg_enable = NETIF_MSG_LINK; | 764 | ax->msg_enable = NETIF_MSG_LINK; |
| @@ -753,9 +771,6 @@ static int ax_init_dev(struct net_device *dev, int first_init) | |||
| 753 | ax->mii.mdio_write = ax_phy_write; | 771 | ax->mii.mdio_write = ax_phy_write; |
| 754 | ax->mii.dev = dev; | 772 | ax->mii.dev = dev; |
| 755 | 773 | ||
| 756 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
| 757 | dev->poll_controller = ax_ei_poll; | ||
| 758 | #endif | ||
| 759 | ax_NS8390_init(dev, 0); | 774 | ax_NS8390_init(dev, 0); |
| 760 | 775 | ||
| 761 | if (first_init) | 776 | if (first_init) |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index 5ae131c147f9..c38512ebcea6 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
| @@ -679,6 +679,7 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked) | |||
| 679 | dev_kfree_skb_any(skb); | 679 | dev_kfree_skb_any(skb); |
| 680 | return -ENOMEM; | 680 | return -ENOMEM; |
| 681 | } | 681 | } |
| 682 | bp->force_copybreak = 1; | ||
| 682 | } | 683 | } |
| 683 | 684 | ||
| 684 | rh = (struct rx_header *) skb->data; | 685 | rh = (struct rx_header *) skb->data; |
| @@ -800,7 +801,7 @@ static int b44_rx(struct b44 *bp, int budget) | |||
| 800 | /* Omit CRC. */ | 801 | /* Omit CRC. */ |
| 801 | len -= 4; | 802 | len -= 4; |
| 802 | 803 | ||
| 803 | if (len > RX_COPY_THRESHOLD) { | 804 | if (!bp->force_copybreak && len > RX_COPY_THRESHOLD) { |
| 804 | int skb_size; | 805 | int skb_size; |
| 805 | skb_size = b44_alloc_rx_skb(bp, cons, bp->rx_prod); | 806 | skb_size = b44_alloc_rx_skb(bp, cons, bp->rx_prod); |
| 806 | if (skb_size < 0) | 807 | if (skb_size < 0) |
| @@ -2152,6 +2153,7 @@ static int __devinit b44_init_one(struct ssb_device *sdev, | |||
| 2152 | bp = netdev_priv(dev); | 2153 | bp = netdev_priv(dev); |
| 2153 | bp->sdev = sdev; | 2154 | bp->sdev = sdev; |
| 2154 | bp->dev = dev; | 2155 | bp->dev = dev; |
| 2156 | bp->force_copybreak = 0; | ||
| 2155 | 2157 | ||
| 2156 | bp->msg_enable = netif_msg_init(b44_debug, B44_DEF_MSG_ENABLE); | 2158 | bp->msg_enable = netif_msg_init(b44_debug, B44_DEF_MSG_ENABLE); |
| 2157 | 2159 | ||
diff --git a/drivers/net/b44.h b/drivers/net/b44.h index 7db0c84a7950..e678498de6db 100644 --- a/drivers/net/b44.h +++ b/drivers/net/b44.h | |||
| @@ -395,7 +395,7 @@ struct b44 { | |||
| 395 | u32 rx_pending; | 395 | u32 rx_pending; |
| 396 | u32 tx_pending; | 396 | u32 tx_pending; |
| 397 | u8 phy_addr; | 397 | u8 phy_addr; |
| 398 | 398 | u8 force_copybreak; | |
| 399 | struct mii_if_info mii_if; | 399 | struct mii_if_info mii_if; |
| 400 | }; | 400 | }; |
| 401 | 401 | ||
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h index fd705d1295a7..6fcccef4cf3d 100644 --- a/drivers/net/bnx2x.h +++ b/drivers/net/bnx2x.h | |||
| @@ -20,6 +20,11 @@ | |||
| 20 | * (you will need to reboot afterwards) */ | 20 | * (you will need to reboot afterwards) */ |
| 21 | /* #define BNX2X_STOP_ON_ERROR */ | 21 | /* #define BNX2X_STOP_ON_ERROR */ |
| 22 | 22 | ||
| 23 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | ||
| 24 | #define BCM_VLAN 1 | ||
| 25 | #endif | ||
| 26 | |||
| 27 | |||
| 23 | /* error/debug prints */ | 28 | /* error/debug prints */ |
| 24 | 29 | ||
| 25 | #define DRV_MODULE_NAME "bnx2x" | 30 | #define DRV_MODULE_NAME "bnx2x" |
| @@ -78,11 +83,6 @@ | |||
| 78 | #endif | 83 | #endif |
| 79 | 84 | ||
| 80 | 85 | ||
| 81 | #ifdef NETIF_F_HW_VLAN_TX | ||
| 82 | #define BCM_VLAN 1 | ||
| 83 | #endif | ||
| 84 | |||
| 85 | |||
| 86 | #define U64_LO(x) (u32)(((u64)(x)) & 0xffffffff) | 86 | #define U64_LO(x) (u32)(((u64)(x)) & 0xffffffff) |
| 87 | #define U64_HI(x) (u32)(((u64)(x)) >> 32) | 87 | #define U64_HI(x) (u32)(((u64)(x)) >> 32) |
| 88 | #define HILO_U64(hi, lo) ((((u64)(hi)) << 32) + (lo)) | 88 | #define HILO_U64(hi, lo) ((((u64)(hi)) << 32) + (lo)) |
| @@ -150,6 +150,9 @@ struct sw_rx_page { | |||
| 150 | 150 | ||
| 151 | #define PAGES_PER_SGE_SHIFT 0 | 151 | #define PAGES_PER_SGE_SHIFT 0 |
| 152 | #define PAGES_PER_SGE (1 << PAGES_PER_SGE_SHIFT) | 152 | #define PAGES_PER_SGE (1 << PAGES_PER_SGE_SHIFT) |
| 153 | #define SGE_PAGE_SIZE PAGE_SIZE | ||
| 154 | #define SGE_PAGE_SHIFT PAGE_SHIFT | ||
| 155 | #define SGE_PAGE_ALIGN(addr) PAGE_ALIGN(addr) | ||
| 153 | 156 | ||
| 154 | #define BCM_RX_ETH_PAYLOAD_ALIGN 64 | 157 | #define BCM_RX_ETH_PAYLOAD_ALIGN 64 |
| 155 | 158 | ||
| @@ -736,7 +739,7 @@ struct bnx2x { | |||
| 736 | struct bnx2x_fastpath fp[MAX_CONTEXT]; | 739 | struct bnx2x_fastpath fp[MAX_CONTEXT]; |
| 737 | void __iomem *regview; | 740 | void __iomem *regview; |
| 738 | void __iomem *doorbells; | 741 | void __iomem *doorbells; |
| 739 | #define BNX2X_DB_SIZE (16*2048) | 742 | #define BNX2X_DB_SIZE (16*BCM_PAGE_SIZE) |
| 740 | 743 | ||
| 741 | struct net_device *dev; | 744 | struct net_device *dev; |
| 742 | struct pci_dev *pdev; | 745 | struct pci_dev *pdev; |
| @@ -801,6 +804,8 @@ struct bnx2x { | |||
| 801 | #define TPA_ENABLE_FLAG 0x80 | 804 | #define TPA_ENABLE_FLAG 0x80 |
| 802 | #define NO_MCP_FLAG 0x100 | 805 | #define NO_MCP_FLAG 0x100 |
| 803 | #define BP_NOMCP(bp) (bp->flags & NO_MCP_FLAG) | 806 | #define BP_NOMCP(bp) (bp->flags & NO_MCP_FLAG) |
| 807 | #define HW_VLAN_TX_FLAG 0x400 | ||
| 808 | #define HW_VLAN_RX_FLAG 0x800 | ||
| 804 | 809 | ||
| 805 | int func; | 810 | int func; |
| 806 | #define BP_PORT(bp) (bp->func % PORT_MAX) | 811 | #define BP_PORT(bp) (bp->func % PORT_MAX) |
| @@ -811,7 +816,7 @@ struct bnx2x { | |||
| 811 | int pm_cap; | 816 | int pm_cap; |
| 812 | int pcie_cap; | 817 | int pcie_cap; |
| 813 | 818 | ||
| 814 | struct work_struct sp_task; | 819 | struct delayed_work sp_task; |
| 815 | struct work_struct reset_task; | 820 | struct work_struct reset_task; |
| 816 | 821 | ||
| 817 | struct timer_list timer; | 822 | struct timer_list timer; |
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index 4be05847f86f..7c533797c064 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c | |||
| @@ -38,9 +38,7 @@ | |||
| 38 | #include <linux/time.h> | 38 | #include <linux/time.h> |
| 39 | #include <linux/ethtool.h> | 39 | #include <linux/ethtool.h> |
| 40 | #include <linux/mii.h> | 40 | #include <linux/mii.h> |
| 41 | #ifdef NETIF_F_HW_VLAN_TX | 41 | #include <linux/if_vlan.h> |
| 42 | #include <linux/if_vlan.h> | ||
| 43 | #endif | ||
| 44 | #include <net/ip.h> | 42 | #include <net/ip.h> |
| 45 | #include <net/tcp.h> | 43 | #include <net/tcp.h> |
| 46 | #include <net/checksum.h> | 44 | #include <net/checksum.h> |
| @@ -95,6 +93,7 @@ MODULE_PARM_DESC(debug, "default debug msglevel"); | |||
| 95 | module_param(use_multi, int, 0); | 93 | module_param(use_multi, int, 0); |
| 96 | MODULE_PARM_DESC(use_multi, "use per-CPU queues"); | 94 | MODULE_PARM_DESC(use_multi, "use per-CPU queues"); |
| 97 | #endif | 95 | #endif |
| 96 | static struct workqueue_struct *bnx2x_wq; | ||
| 98 | 97 | ||
| 99 | enum bnx2x_board_type { | 98 | enum bnx2x_board_type { |
| 100 | BCM57710 = 0, | 99 | BCM57710 = 0, |
| @@ -671,7 +670,8 @@ static void bnx2x_int_disable_sync(struct bnx2x *bp, int disable_hw) | |||
| 671 | synchronize_irq(bp->pdev->irq); | 670 | synchronize_irq(bp->pdev->irq); |
| 672 | 671 | ||
| 673 | /* make sure sp_task is not running */ | 672 | /* make sure sp_task is not running */ |
| 674 | cancel_work_sync(&bp->sp_task); | 673 | cancel_delayed_work(&bp->sp_task); |
| 674 | flush_workqueue(bnx2x_wq); | ||
| 675 | } | 675 | } |
| 676 | 676 | ||
| 677 | /* fast path */ | 677 | /* fast path */ |
| @@ -972,7 +972,7 @@ static inline void bnx2x_free_rx_sge(struct bnx2x *bp, | |||
| 972 | return; | 972 | return; |
| 973 | 973 | ||
| 974 | pci_unmap_page(bp->pdev, pci_unmap_addr(sw_buf, mapping), | 974 | pci_unmap_page(bp->pdev, pci_unmap_addr(sw_buf, mapping), |
| 975 | BCM_PAGE_SIZE*PAGES_PER_SGE, PCI_DMA_FROMDEVICE); | 975 | SGE_PAGE_SIZE*PAGES_PER_SGE, PCI_DMA_FROMDEVICE); |
| 976 | __free_pages(page, PAGES_PER_SGE_SHIFT); | 976 | __free_pages(page, PAGES_PER_SGE_SHIFT); |
| 977 | 977 | ||
| 978 | sw_buf->page = NULL; | 978 | sw_buf->page = NULL; |
| @@ -1000,7 +1000,7 @@ static inline int bnx2x_alloc_rx_sge(struct bnx2x *bp, | |||
| 1000 | if (unlikely(page == NULL)) | 1000 | if (unlikely(page == NULL)) |
| 1001 | return -ENOMEM; | 1001 | return -ENOMEM; |
| 1002 | 1002 | ||
| 1003 | mapping = pci_map_page(bp->pdev, page, 0, BCM_PAGE_SIZE*PAGES_PER_SGE, | 1003 | mapping = pci_map_page(bp->pdev, page, 0, SGE_PAGE_SIZE*PAGES_PER_SGE, |
| 1004 | PCI_DMA_FROMDEVICE); | 1004 | PCI_DMA_FROMDEVICE); |
| 1005 | if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) { | 1005 | if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) { |
| 1006 | __free_pages(page, PAGES_PER_SGE_SHIFT); | 1006 | __free_pages(page, PAGES_PER_SGE_SHIFT); |
| @@ -1096,9 +1096,9 @@ static void bnx2x_update_sge_prod(struct bnx2x_fastpath *fp, | |||
| 1096 | struct eth_fast_path_rx_cqe *fp_cqe) | 1096 | struct eth_fast_path_rx_cqe *fp_cqe) |
| 1097 | { | 1097 | { |
| 1098 | struct bnx2x *bp = fp->bp; | 1098 | struct bnx2x *bp = fp->bp; |
| 1099 | u16 sge_len = BCM_PAGE_ALIGN(le16_to_cpu(fp_cqe->pkt_len) - | 1099 | u16 sge_len = SGE_PAGE_ALIGN(le16_to_cpu(fp_cqe->pkt_len) - |
| 1100 | le16_to_cpu(fp_cqe->len_on_bd)) >> | 1100 | le16_to_cpu(fp_cqe->len_on_bd)) >> |
| 1101 | BCM_PAGE_SHIFT; | 1101 | SGE_PAGE_SHIFT; |
| 1102 | u16 last_max, last_elem, first_elem; | 1102 | u16 last_max, last_elem, first_elem; |
| 1103 | u16 delta = 0; | 1103 | u16 delta = 0; |
| 1104 | u16 i; | 1104 | u16 i; |
| @@ -1203,22 +1203,22 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
| 1203 | u16 cqe_idx) | 1203 | u16 cqe_idx) |
| 1204 | { | 1204 | { |
| 1205 | struct sw_rx_page *rx_pg, old_rx_pg; | 1205 | struct sw_rx_page *rx_pg, old_rx_pg; |
| 1206 | struct page *sge; | ||
| 1207 | u16 len_on_bd = le16_to_cpu(fp_cqe->len_on_bd); | 1206 | u16 len_on_bd = le16_to_cpu(fp_cqe->len_on_bd); |
| 1208 | u32 i, frag_len, frag_size, pages; | 1207 | u32 i, frag_len, frag_size, pages; |
| 1209 | int err; | 1208 | int err; |
| 1210 | int j; | 1209 | int j; |
| 1211 | 1210 | ||
| 1212 | frag_size = le16_to_cpu(fp_cqe->pkt_len) - len_on_bd; | 1211 | frag_size = le16_to_cpu(fp_cqe->pkt_len) - len_on_bd; |
| 1213 | pages = BCM_PAGE_ALIGN(frag_size) >> BCM_PAGE_SHIFT; | 1212 | pages = SGE_PAGE_ALIGN(frag_size) >> SGE_PAGE_SHIFT; |
| 1214 | 1213 | ||
| 1215 | /* This is needed in order to enable forwarding support */ | 1214 | /* This is needed in order to enable forwarding support */ |
| 1216 | if (frag_size) | 1215 | if (frag_size) |
| 1217 | skb_shinfo(skb)->gso_size = min((u32)BCM_PAGE_SIZE, | 1216 | skb_shinfo(skb)->gso_size = min((u32)SGE_PAGE_SIZE, |
| 1218 | max(frag_size, (u32)len_on_bd)); | 1217 | max(frag_size, (u32)len_on_bd)); |
| 1219 | 1218 | ||
| 1220 | #ifdef BNX2X_STOP_ON_ERROR | 1219 | #ifdef BNX2X_STOP_ON_ERROR |
| 1221 | if (pages > 8*PAGES_PER_SGE) { | 1220 | if (pages > |
| 1221 | min((u32)8, (u32)MAX_SKB_FRAGS) * SGE_PAGE_SIZE * PAGES_PER_SGE) { | ||
| 1222 | BNX2X_ERR("SGL length is too long: %d. CQE index is %d\n", | 1222 | BNX2X_ERR("SGL length is too long: %d. CQE index is %d\n", |
| 1223 | pages, cqe_idx); | 1223 | pages, cqe_idx); |
| 1224 | BNX2X_ERR("fp_cqe->pkt_len = %d fp_cqe->len_on_bd = %d\n", | 1224 | BNX2X_ERR("fp_cqe->pkt_len = %d fp_cqe->len_on_bd = %d\n", |
| @@ -1234,9 +1234,8 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
| 1234 | 1234 | ||
| 1235 | /* FW gives the indices of the SGE as if the ring is an array | 1235 | /* FW gives the indices of the SGE as if the ring is an array |
| 1236 | (meaning that "next" element will consume 2 indices) */ | 1236 | (meaning that "next" element will consume 2 indices) */ |
| 1237 | frag_len = min(frag_size, (u32)(BCM_PAGE_SIZE*PAGES_PER_SGE)); | 1237 | frag_len = min(frag_size, (u32)(SGE_PAGE_SIZE*PAGES_PER_SGE)); |
| 1238 | rx_pg = &fp->rx_page_ring[sge_idx]; | 1238 | rx_pg = &fp->rx_page_ring[sge_idx]; |
| 1239 | sge = rx_pg->page; | ||
| 1240 | old_rx_pg = *rx_pg; | 1239 | old_rx_pg = *rx_pg; |
| 1241 | 1240 | ||
| 1242 | /* If we fail to allocate a substitute page, we simply stop | 1241 | /* If we fail to allocate a substitute page, we simply stop |
| @@ -1249,7 +1248,7 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
| 1249 | 1248 | ||
| 1250 | /* Unmap the page as we r going to pass it to the stack */ | 1249 | /* Unmap the page as we r going to pass it to the stack */ |
| 1251 | pci_unmap_page(bp->pdev, pci_unmap_addr(&old_rx_pg, mapping), | 1250 | pci_unmap_page(bp->pdev, pci_unmap_addr(&old_rx_pg, mapping), |
| 1252 | BCM_PAGE_SIZE*PAGES_PER_SGE, PCI_DMA_FROMDEVICE); | 1251 | SGE_PAGE_SIZE*PAGES_PER_SGE, PCI_DMA_FROMDEVICE); |
| 1253 | 1252 | ||
| 1254 | /* Add one frag and update the appropriate fields in the skb */ | 1253 | /* Add one frag and update the appropriate fields in the skb */ |
| 1255 | skb_fill_page_desc(skb, j, old_rx_pg.page, 0, frag_len); | 1254 | skb_fill_page_desc(skb, j, old_rx_pg.page, 0, frag_len); |
| @@ -1282,6 +1281,13 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
| 1282 | if (likely(new_skb)) { | 1281 | if (likely(new_skb)) { |
| 1283 | /* fix ip xsum and give it to the stack */ | 1282 | /* fix ip xsum and give it to the stack */ |
| 1284 | /* (no need to map the new skb) */ | 1283 | /* (no need to map the new skb) */ |
| 1284 | #ifdef BCM_VLAN | ||
| 1285 | int is_vlan_cqe = | ||
| 1286 | (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) & | ||
| 1287 | PARSING_FLAGS_VLAN); | ||
| 1288 | int is_not_hwaccel_vlan_cqe = | ||
| 1289 | (is_vlan_cqe && (!(bp->flags & HW_VLAN_RX_FLAG))); | ||
| 1290 | #endif | ||
| 1285 | 1291 | ||
| 1286 | prefetch(skb); | 1292 | prefetch(skb); |
| 1287 | prefetch(((char *)(skb)) + 128); | 1293 | prefetch(((char *)(skb)) + 128); |
| @@ -1306,6 +1312,12 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
| 1306 | struct iphdr *iph; | 1312 | struct iphdr *iph; |
| 1307 | 1313 | ||
| 1308 | iph = (struct iphdr *)skb->data; | 1314 | iph = (struct iphdr *)skb->data; |
| 1315 | #ifdef BCM_VLAN | ||
| 1316 | /* If there is no Rx VLAN offloading - | ||
| 1317 | take VLAN tag into an account */ | ||
| 1318 | if (unlikely(is_not_hwaccel_vlan_cqe)) | ||
| 1319 | iph = (struct iphdr *)((u8 *)iph + VLAN_HLEN); | ||
| 1320 | #endif | ||
| 1309 | iph->check = 0; | 1321 | iph->check = 0; |
| 1310 | iph->check = ip_fast_csum((u8 *)iph, iph->ihl); | 1322 | iph->check = ip_fast_csum((u8 *)iph, iph->ihl); |
| 1311 | } | 1323 | } |
| @@ -1313,9 +1325,8 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
| 1313 | if (!bnx2x_fill_frag_skb(bp, fp, skb, | 1325 | if (!bnx2x_fill_frag_skb(bp, fp, skb, |
| 1314 | &cqe->fast_path_cqe, cqe_idx)) { | 1326 | &cqe->fast_path_cqe, cqe_idx)) { |
| 1315 | #ifdef BCM_VLAN | 1327 | #ifdef BCM_VLAN |
| 1316 | if ((bp->vlgrp != NULL) && | 1328 | if ((bp->vlgrp != NULL) && is_vlan_cqe && |
| 1317 | (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) & | 1329 | (!is_not_hwaccel_vlan_cqe)) |
| 1318 | PARSING_FLAGS_VLAN)) | ||
| 1319 | vlan_hwaccel_receive_skb(skb, bp->vlgrp, | 1330 | vlan_hwaccel_receive_skb(skb, bp->vlgrp, |
| 1320 | le16_to_cpu(cqe->fast_path_cqe. | 1331 | le16_to_cpu(cqe->fast_path_cqe. |
| 1321 | vlan_tag)); | 1332 | vlan_tag)); |
| @@ -1355,11 +1366,23 @@ static inline void bnx2x_update_rx_prod(struct bnx2x *bp, | |||
| 1355 | rx_prods.cqe_prod = rx_comp_prod; | 1366 | rx_prods.cqe_prod = rx_comp_prod; |
| 1356 | rx_prods.sge_prod = rx_sge_prod; | 1367 | rx_prods.sge_prod = rx_sge_prod; |
| 1357 | 1368 | ||
| 1369 | /* | ||
| 1370 | * Make sure that the BD and SGE data is updated before updating the | ||
| 1371 | * producers since FW might read the BD/SGE right after the producer | ||
| 1372 | * is updated. | ||
| 1373 | * This is only applicable for weak-ordered memory model archs such | ||
| 1374 | * as IA-64. The following barrier is also mandatory since FW will | ||
| 1375 | * assumes BDs must have buffers. | ||
| 1376 | */ | ||
| 1377 | wmb(); | ||
| 1378 | |||
| 1358 | for (i = 0; i < sizeof(struct tstorm_eth_rx_producers)/4; i++) | 1379 | for (i = 0; i < sizeof(struct tstorm_eth_rx_producers)/4; i++) |
| 1359 | REG_WR(bp, BAR_TSTRORM_INTMEM + | 1380 | REG_WR(bp, BAR_TSTRORM_INTMEM + |
| 1360 | TSTORM_RX_PRODS_OFFSET(BP_PORT(bp), FP_CL_ID(fp)) + i*4, | 1381 | TSTORM_RX_PRODS_OFFSET(BP_PORT(bp), FP_CL_ID(fp)) + i*4, |
| 1361 | ((u32 *)&rx_prods)[i]); | 1382 | ((u32 *)&rx_prods)[i]); |
| 1362 | 1383 | ||
| 1384 | mmiowb(); /* keep prod updates ordered */ | ||
| 1385 | |||
| 1363 | DP(NETIF_MSG_RX_STATUS, | 1386 | DP(NETIF_MSG_RX_STATUS, |
| 1364 | "Wrote: bd_prod %u cqe_prod %u sge_prod %u\n", | 1387 | "Wrote: bd_prod %u cqe_prod %u sge_prod %u\n", |
| 1365 | bd_prod, rx_comp_prod, rx_sge_prod); | 1388 | bd_prod, rx_comp_prod, rx_sge_prod); |
| @@ -1415,7 +1438,7 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget) | |||
| 1415 | DP(NETIF_MSG_RX_STATUS, "CQE type %x err %x status %x" | 1438 | DP(NETIF_MSG_RX_STATUS, "CQE type %x err %x status %x" |
| 1416 | " queue %x vlan %x len %u\n", CQE_TYPE(cqe_fp_flags), | 1439 | " queue %x vlan %x len %u\n", CQE_TYPE(cqe_fp_flags), |
| 1417 | cqe_fp_flags, cqe->fast_path_cqe.status_flags, | 1440 | cqe_fp_flags, cqe->fast_path_cqe.status_flags, |
| 1418 | cqe->fast_path_cqe.rss_hash_result, | 1441 | le32_to_cpu(cqe->fast_path_cqe.rss_hash_result), |
| 1419 | le16_to_cpu(cqe->fast_path_cqe.vlan_tag), | 1442 | le16_to_cpu(cqe->fast_path_cqe.vlan_tag), |
| 1420 | le16_to_cpu(cqe->fast_path_cqe.pkt_len)); | 1443 | le16_to_cpu(cqe->fast_path_cqe.pkt_len)); |
| 1421 | 1444 | ||
| @@ -1547,7 +1570,7 @@ reuse_rx: | |||
| 1547 | } | 1570 | } |
| 1548 | 1571 | ||
| 1549 | #ifdef BCM_VLAN | 1572 | #ifdef BCM_VLAN |
| 1550 | if ((bp->vlgrp != NULL) && | 1573 | if ((bp->vlgrp != NULL) && (bp->flags & HW_VLAN_RX_FLAG) && |
| 1551 | (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) & | 1574 | (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) & |
| 1552 | PARSING_FLAGS_VLAN)) | 1575 | PARSING_FLAGS_VLAN)) |
| 1553 | vlan_hwaccel_receive_skb(skb, bp->vlgrp, | 1576 | vlan_hwaccel_receive_skb(skb, bp->vlgrp, |
| @@ -1580,7 +1603,6 @@ next_cqe: | |||
| 1580 | /* Update producers */ | 1603 | /* Update producers */ |
| 1581 | bnx2x_update_rx_prod(bp, fp, bd_prod_fw, sw_comp_prod, | 1604 | bnx2x_update_rx_prod(bp, fp, bd_prod_fw, sw_comp_prod, |
| 1582 | fp->rx_sge_prod); | 1605 | fp->rx_sge_prod); |
| 1583 | mmiowb(); /* keep prod updates ordered */ | ||
| 1584 | 1606 | ||
| 1585 | fp->rx_pkt += rx_pkt; | 1607 | fp->rx_pkt += rx_pkt; |
| 1586 | fp->rx_calls++; | 1608 | fp->rx_calls++; |
| @@ -1660,7 +1682,7 @@ static irqreturn_t bnx2x_interrupt(int irq, void *dev_instance) | |||
| 1660 | 1682 | ||
| 1661 | 1683 | ||
| 1662 | if (unlikely(status & 0x1)) { | 1684 | if (unlikely(status & 0x1)) { |
| 1663 | schedule_work(&bp->sp_task); | 1685 | queue_delayed_work(bnx2x_wq, &bp->sp_task, 0); |
| 1664 | 1686 | ||
| 1665 | status &= ~0x1; | 1687 | status &= ~0x1; |
| 1666 | if (!status) | 1688 | if (!status) |
| @@ -1887,7 +1909,8 @@ static int bnx2x_set_spio(struct bnx2x *bp, int spio_num, u32 mode) | |||
| 1887 | 1909 | ||
| 1888 | static void bnx2x_calc_fc_adv(struct bnx2x *bp) | 1910 | static void bnx2x_calc_fc_adv(struct bnx2x *bp) |
| 1889 | { | 1911 | { |
| 1890 | switch (bp->link_vars.ieee_fc) { | 1912 | switch (bp->link_vars.ieee_fc & |
| 1913 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_MASK) { | ||
| 1891 | case MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_NONE: | 1914 | case MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_NONE: |
| 1892 | bp->port.advertising &= ~(ADVERTISED_Asym_Pause | | 1915 | bp->port.advertising &= ~(ADVERTISED_Asym_Pause | |
| 1893 | ADVERTISED_Pause); | 1916 | ADVERTISED_Pause); |
| @@ -1957,10 +1980,11 @@ static u8 bnx2x_initial_phy_init(struct bnx2x *bp) | |||
| 1957 | rc = bnx2x_phy_init(&bp->link_params, &bp->link_vars); | 1980 | rc = bnx2x_phy_init(&bp->link_params, &bp->link_vars); |
| 1958 | bnx2x_release_phy_lock(bp); | 1981 | bnx2x_release_phy_lock(bp); |
| 1959 | 1982 | ||
| 1983 | bnx2x_calc_fc_adv(bp); | ||
| 1984 | |||
| 1960 | if (bp->link_vars.link_up) | 1985 | if (bp->link_vars.link_up) |
| 1961 | bnx2x_link_report(bp); | 1986 | bnx2x_link_report(bp); |
| 1962 | 1987 | ||
| 1963 | bnx2x_calc_fc_adv(bp); | ||
| 1964 | 1988 | ||
| 1965 | return rc; | 1989 | return rc; |
| 1966 | } | 1990 | } |
| @@ -2220,9 +2244,7 @@ static void bnx2x_link_attn(struct bnx2x *bp) | |||
| 2220 | /* Make sure that we are synced with the current statistics */ | 2244 | /* Make sure that we are synced with the current statistics */ |
| 2221 | bnx2x_stats_handle(bp, STATS_EVENT_STOP); | 2245 | bnx2x_stats_handle(bp, STATS_EVENT_STOP); |
| 2222 | 2246 | ||
| 2223 | bnx2x_acquire_phy_lock(bp); | ||
| 2224 | bnx2x_link_update(&bp->link_params, &bp->link_vars); | 2247 | bnx2x_link_update(&bp->link_params, &bp->link_vars); |
| 2225 | bnx2x_release_phy_lock(bp); | ||
| 2226 | 2248 | ||
| 2227 | if (bp->link_vars.link_up) { | 2249 | if (bp->link_vars.link_up) { |
| 2228 | 2250 | ||
| @@ -2471,6 +2493,8 @@ static void bnx2x_attn_int_asserted(struct bnx2x *bp, u32 asserted) | |||
| 2471 | if (asserted & ATTN_HARD_WIRED_MASK) { | 2493 | if (asserted & ATTN_HARD_WIRED_MASK) { |
| 2472 | if (asserted & ATTN_NIG_FOR_FUNC) { | 2494 | if (asserted & ATTN_NIG_FOR_FUNC) { |
| 2473 | 2495 | ||
| 2496 | bnx2x_acquire_phy_lock(bp); | ||
| 2497 | |||
| 2474 | /* save nig interrupt mask */ | 2498 | /* save nig interrupt mask */ |
| 2475 | bp->nig_mask = REG_RD(bp, nig_int_mask_addr); | 2499 | bp->nig_mask = REG_RD(bp, nig_int_mask_addr); |
| 2476 | REG_WR(bp, nig_int_mask_addr, 0); | 2500 | REG_WR(bp, nig_int_mask_addr, 0); |
| @@ -2526,8 +2550,10 @@ static void bnx2x_attn_int_asserted(struct bnx2x *bp, u32 asserted) | |||
| 2526 | REG_WR(bp, hc_addr, asserted); | 2550 | REG_WR(bp, hc_addr, asserted); |
| 2527 | 2551 | ||
| 2528 | /* now set back the mask */ | 2552 | /* now set back the mask */ |
| 2529 | if (asserted & ATTN_NIG_FOR_FUNC) | 2553 | if (asserted & ATTN_NIG_FOR_FUNC) { |
| 2530 | REG_WR(bp, nig_int_mask_addr, bp->nig_mask); | 2554 | REG_WR(bp, nig_int_mask_addr, bp->nig_mask); |
| 2555 | bnx2x_release_phy_lock(bp); | ||
| 2556 | } | ||
| 2531 | } | 2557 | } |
| 2532 | 2558 | ||
| 2533 | static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn) | 2559 | static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn) |
| @@ -2795,8 +2821,10 @@ static void bnx2x_attn_int_deasserted(struct bnx2x *bp, u32 deasserted) | |||
| 2795 | static void bnx2x_attn_int(struct bnx2x *bp) | 2821 | static void bnx2x_attn_int(struct bnx2x *bp) |
| 2796 | { | 2822 | { |
| 2797 | /* read local copy of bits */ | 2823 | /* read local copy of bits */ |
| 2798 | u32 attn_bits = bp->def_status_blk->atten_status_block.attn_bits; | 2824 | u32 attn_bits = le32_to_cpu(bp->def_status_blk->atten_status_block. |
| 2799 | u32 attn_ack = bp->def_status_blk->atten_status_block.attn_bits_ack; | 2825 | attn_bits); |
| 2826 | u32 attn_ack = le32_to_cpu(bp->def_status_blk->atten_status_block. | ||
| 2827 | attn_bits_ack); | ||
| 2800 | u32 attn_state = bp->attn_state; | 2828 | u32 attn_state = bp->attn_state; |
| 2801 | 2829 | ||
| 2802 | /* look for changed bits */ | 2830 | /* look for changed bits */ |
| @@ -2820,7 +2848,7 @@ static void bnx2x_attn_int(struct bnx2x *bp) | |||
| 2820 | 2848 | ||
| 2821 | static void bnx2x_sp_task(struct work_struct *work) | 2849 | static void bnx2x_sp_task(struct work_struct *work) |
| 2822 | { | 2850 | { |
| 2823 | struct bnx2x *bp = container_of(work, struct bnx2x, sp_task); | 2851 | struct bnx2x *bp = container_of(work, struct bnx2x, sp_task.work); |
| 2824 | u16 status; | 2852 | u16 status; |
| 2825 | 2853 | ||
| 2826 | 2854 | ||
| @@ -2844,7 +2872,7 @@ static void bnx2x_sp_task(struct work_struct *work) | |||
| 2844 | if (status & 0x2) | 2872 | if (status & 0x2) |
| 2845 | bp->stats_pending = 0; | 2873 | bp->stats_pending = 0; |
| 2846 | 2874 | ||
| 2847 | bnx2x_ack_sb(bp, DEF_SB_ID, ATTENTION_ID, bp->def_att_idx, | 2875 | bnx2x_ack_sb(bp, DEF_SB_ID, ATTENTION_ID, le16_to_cpu(bp->def_att_idx), |
| 2848 | IGU_INT_NOP, 1); | 2876 | IGU_INT_NOP, 1); |
| 2849 | bnx2x_ack_sb(bp, DEF_SB_ID, USTORM_ID, le16_to_cpu(bp->def_u_idx), | 2877 | bnx2x_ack_sb(bp, DEF_SB_ID, USTORM_ID, le16_to_cpu(bp->def_u_idx), |
| 2850 | IGU_INT_NOP, 1); | 2878 | IGU_INT_NOP, 1); |
| @@ -2875,7 +2903,7 @@ static irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance) | |||
| 2875 | return IRQ_HANDLED; | 2903 | return IRQ_HANDLED; |
| 2876 | #endif | 2904 | #endif |
| 2877 | 2905 | ||
| 2878 | schedule_work(&bp->sp_task); | 2906 | queue_delayed_work(bnx2x_wq, &bp->sp_task, 0); |
| 2879 | 2907 | ||
| 2880 | return IRQ_HANDLED; | 2908 | return IRQ_HANDLED; |
| 2881 | } | 2909 | } |
| @@ -2892,7 +2920,7 @@ static irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance) | |||
| 2892 | #define ADD_64(s_hi, a_hi, s_lo, a_lo) \ | 2920 | #define ADD_64(s_hi, a_hi, s_lo, a_lo) \ |
| 2893 | do { \ | 2921 | do { \ |
| 2894 | s_lo += a_lo; \ | 2922 | s_lo += a_lo; \ |
| 2895 | s_hi += a_hi + (s_lo < a_lo) ? 1 : 0; \ | 2923 | s_hi += a_hi + ((s_lo < a_lo) ? 1 : 0); \ |
| 2896 | } while (0) | 2924 | } while (0) |
| 2897 | 2925 | ||
| 2898 | /* difference = minuend - subtrahend */ | 2926 | /* difference = minuend - subtrahend */ |
| @@ -4496,7 +4524,7 @@ static void bnx2x_init_context(struct bnx2x *bp) | |||
| 4496 | 4524 | ||
| 4497 | static void bnx2x_init_ind_table(struct bnx2x *bp) | 4525 | static void bnx2x_init_ind_table(struct bnx2x *bp) |
| 4498 | { | 4526 | { |
| 4499 | int port = BP_PORT(bp); | 4527 | int func = BP_FUNC(bp); |
| 4500 | int i; | 4528 | int i; |
| 4501 | 4529 | ||
| 4502 | if (!is_multi(bp)) | 4530 | if (!is_multi(bp)) |
| @@ -4505,10 +4533,8 @@ static void bnx2x_init_ind_table(struct bnx2x *bp) | |||
| 4505 | DP(NETIF_MSG_IFUP, "Initializing indirection table\n"); | 4533 | DP(NETIF_MSG_IFUP, "Initializing indirection table\n"); |
| 4506 | for (i = 0; i < TSTORM_INDIRECTION_TABLE_SIZE; i++) | 4534 | for (i = 0; i < TSTORM_INDIRECTION_TABLE_SIZE; i++) |
| 4507 | REG_WR8(bp, BAR_TSTRORM_INTMEM + | 4535 | REG_WR8(bp, BAR_TSTRORM_INTMEM + |
| 4508 | TSTORM_INDIRECTION_TABLE_OFFSET(port) + i, | 4536 | TSTORM_INDIRECTION_TABLE_OFFSET(func) + i, |
| 4509 | i % bp->num_queues); | 4537 | BP_CL_ID(bp) + (i % bp->num_queues)); |
| 4510 | |||
| 4511 | REG_WR(bp, PRS_REG_A_PRSU_20, 0xf); | ||
| 4512 | } | 4538 | } |
| 4513 | 4539 | ||
| 4514 | static void bnx2x_set_client_config(struct bnx2x *bp) | 4540 | static void bnx2x_set_client_config(struct bnx2x *bp) |
| @@ -4517,12 +4543,12 @@ static void bnx2x_set_client_config(struct bnx2x *bp) | |||
| 4517 | int port = BP_PORT(bp); | 4543 | int port = BP_PORT(bp); |
| 4518 | int i; | 4544 | int i; |
| 4519 | 4545 | ||
| 4520 | tstorm_client.mtu = bp->dev->mtu + ETH_OVREHEAD; | 4546 | tstorm_client.mtu = bp->dev->mtu; |
| 4521 | tstorm_client.statistics_counter_id = BP_CL_ID(bp); | 4547 | tstorm_client.statistics_counter_id = BP_CL_ID(bp); |
| 4522 | tstorm_client.config_flags = | 4548 | tstorm_client.config_flags = |
| 4523 | TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE; | 4549 | TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE; |
| 4524 | #ifdef BCM_VLAN | 4550 | #ifdef BCM_VLAN |
| 4525 | if (bp->rx_mode && bp->vlgrp) { | 4551 | if (bp->rx_mode && bp->vlgrp && (bp->flags & HW_VLAN_RX_FLAG)) { |
| 4526 | tstorm_client.config_flags |= | 4552 | tstorm_client.config_flags |= |
| 4527 | TSTORM_ETH_CLIENT_CONFIG_VLAN_REMOVAL_ENABLE; | 4553 | TSTORM_ETH_CLIENT_CONFIG_VLAN_REMOVAL_ENABLE; |
| 4528 | DP(NETIF_MSG_IFUP, "vlan removal enabled\n"); | 4554 | DP(NETIF_MSG_IFUP, "vlan removal enabled\n"); |
| @@ -4531,7 +4557,7 @@ static void bnx2x_set_client_config(struct bnx2x *bp) | |||
| 4531 | 4557 | ||
| 4532 | if (bp->flags & TPA_ENABLE_FLAG) { | 4558 | if (bp->flags & TPA_ENABLE_FLAG) { |
| 4533 | tstorm_client.max_sges_for_packet = | 4559 | tstorm_client.max_sges_for_packet = |
| 4534 | BCM_PAGE_ALIGN(tstorm_client.mtu) >> BCM_PAGE_SHIFT; | 4560 | SGE_PAGE_ALIGN(tstorm_client.mtu) >> SGE_PAGE_SHIFT; |
| 4535 | tstorm_client.max_sges_for_packet = | 4561 | tstorm_client.max_sges_for_packet = |
| 4536 | ((tstorm_client.max_sges_for_packet + | 4562 | ((tstorm_client.max_sges_for_packet + |
| 4537 | PAGES_PER_SGE - 1) & (~(PAGES_PER_SGE - 1))) >> | 4563 | PAGES_PER_SGE - 1) & (~(PAGES_PER_SGE - 1))) >> |
| @@ -4714,10 +4740,11 @@ static void bnx2x_init_internal_func(struct bnx2x *bp) | |||
| 4714 | bp->e1hov); | 4740 | bp->e1hov); |
| 4715 | } | 4741 | } |
| 4716 | 4742 | ||
| 4717 | /* Init CQ ring mapping and aggregation size */ | 4743 | /* Init CQ ring mapping and aggregation size, the FW limit is 8 frags */ |
| 4718 | max_agg_size = min((u32)(bp->rx_buf_size + | 4744 | max_agg_size = |
| 4719 | 8*BCM_PAGE_SIZE*PAGES_PER_SGE), | 4745 | min((u32)(min((u32)8, (u32)MAX_SKB_FRAGS) * |
| 4720 | (u32)0xffff); | 4746 | SGE_PAGE_SIZE * PAGES_PER_SGE), |
| 4747 | (u32)0xffff); | ||
| 4721 | for_each_queue(bp, i) { | 4748 | for_each_queue(bp, i) { |
| 4722 | struct bnx2x_fastpath *fp = &bp->fp[i]; | 4749 | struct bnx2x_fastpath *fp = &bp->fp[i]; |
| 4723 | 4750 | ||
| @@ -4785,6 +4812,15 @@ static void bnx2x_nic_init(struct bnx2x *bp, u32 load_code) | |||
| 4785 | bnx2x_init_context(bp); | 4812 | bnx2x_init_context(bp); |
| 4786 | bnx2x_init_internal(bp, load_code); | 4813 | bnx2x_init_internal(bp, load_code); |
| 4787 | bnx2x_init_ind_table(bp); | 4814 | bnx2x_init_ind_table(bp); |
| 4815 | bnx2x_stats_init(bp); | ||
| 4816 | |||
| 4817 | /* At this point, we are ready for interrupts */ | ||
| 4818 | atomic_set(&bp->intr_sem, 0); | ||
| 4819 | |||
| 4820 | /* flush all before enabling interrupts */ | ||
| 4821 | mb(); | ||
| 4822 | mmiowb(); | ||
| 4823 | |||
| 4788 | bnx2x_int_enable(bp); | 4824 | bnx2x_int_enable(bp); |
| 4789 | } | 4825 | } |
| 4790 | 4826 | ||
| @@ -5134,7 +5170,6 @@ static int bnx2x_init_common(struct bnx2x *bp) | |||
| 5134 | REG_WR(bp, PXP2_REG_RQ_SRC_ENDIAN_M, 1); | 5170 | REG_WR(bp, PXP2_REG_RQ_SRC_ENDIAN_M, 1); |
| 5135 | REG_WR(bp, PXP2_REG_RQ_CDU_ENDIAN_M, 1); | 5171 | REG_WR(bp, PXP2_REG_RQ_CDU_ENDIAN_M, 1); |
| 5136 | REG_WR(bp, PXP2_REG_RQ_DBG_ENDIAN_M, 1); | 5172 | REG_WR(bp, PXP2_REG_RQ_DBG_ENDIAN_M, 1); |
| 5137 | REG_WR(bp, PXP2_REG_RQ_HC_ENDIAN_M, 1); | ||
| 5138 | 5173 | ||
| 5139 | /* REG_WR(bp, PXP2_REG_RD_PBF_SWAP_MODE, 1); */ | 5174 | /* REG_WR(bp, PXP2_REG_RD_PBF_SWAP_MODE, 1); */ |
| 5140 | REG_WR(bp, PXP2_REG_RD_QM_SWAP_MODE, 1); | 5175 | REG_WR(bp, PXP2_REG_RD_QM_SWAP_MODE, 1); |
| @@ -5212,6 +5247,7 @@ static int bnx2x_init_common(struct bnx2x *bp) | |||
| 5212 | } | 5247 | } |
| 5213 | 5248 | ||
| 5214 | bnx2x_init_block(bp, PRS_COMMON_START, PRS_COMMON_END); | 5249 | bnx2x_init_block(bp, PRS_COMMON_START, PRS_COMMON_END); |
| 5250 | REG_WR(bp, PRS_REG_A_PRSU_20, 0xf); | ||
| 5215 | /* set NIC mode */ | 5251 | /* set NIC mode */ |
| 5216 | REG_WR(bp, PRS_REG_NIC_MODE, 1); | 5252 | REG_WR(bp, PRS_REG_NIC_MODE, 1); |
| 5217 | if (CHIP_IS_E1H(bp)) | 5253 | if (CHIP_IS_E1H(bp)) |
| @@ -6393,17 +6429,8 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
| 6393 | } | 6429 | } |
| 6394 | } | 6430 | } |
| 6395 | 6431 | ||
| 6396 | bnx2x_stats_init(bp); | ||
| 6397 | |||
| 6398 | bp->state = BNX2X_STATE_OPENING_WAIT4_PORT; | 6432 | bp->state = BNX2X_STATE_OPENING_WAIT4_PORT; |
| 6399 | 6433 | ||
| 6400 | /* Enable Rx interrupt handling before sending the ramrod | ||
| 6401 | as it's completed on Rx FP queue */ | ||
| 6402 | bnx2x_napi_enable(bp); | ||
| 6403 | |||
| 6404 | /* Enable interrupt handling */ | ||
| 6405 | atomic_set(&bp->intr_sem, 0); | ||
| 6406 | |||
| 6407 | rc = bnx2x_setup_leading(bp); | 6434 | rc = bnx2x_setup_leading(bp); |
| 6408 | if (rc) { | 6435 | if (rc) { |
| 6409 | BNX2X_ERR("Setup leading failed!\n"); | 6436 | BNX2X_ERR("Setup leading failed!\n"); |
| @@ -7501,7 +7528,7 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp) | |||
| 7501 | 7528 | ||
| 7502 | mutex_init(&bp->port.phy_mutex); | 7529 | mutex_init(&bp->port.phy_mutex); |
| 7503 | 7530 | ||
| 7504 | INIT_WORK(&bp->sp_task, bnx2x_sp_task); | 7531 | INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task); |
| 7505 | INIT_WORK(&bp->reset_task, bnx2x_reset_task); | 7532 | INIT_WORK(&bp->reset_task, bnx2x_reset_task); |
| 7506 | 7533 | ||
| 7507 | rc = bnx2x_get_hwinfo(bp); | 7534 | rc = bnx2x_get_hwinfo(bp); |
| @@ -8727,6 +8754,8 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode, u8 link_up) | |||
| 8727 | tx_bd->general_data = ((UNICAST_ADDRESS << | 8754 | tx_bd->general_data = ((UNICAST_ADDRESS << |
| 8728 | ETH_TX_BD_ETH_ADDR_TYPE_SHIFT) | 1); | 8755 | ETH_TX_BD_ETH_ADDR_TYPE_SHIFT) | 1); |
| 8729 | 8756 | ||
| 8757 | wmb(); | ||
| 8758 | |||
| 8730 | fp->hw_tx_prods->bds_prod = | 8759 | fp->hw_tx_prods->bds_prod = |
| 8731 | cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + 1); | 8760 | cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + 1); |
| 8732 | mb(); /* FW restriction: must not reorder writing nbd and packets */ | 8761 | mb(); /* FW restriction: must not reorder writing nbd and packets */ |
| @@ -8778,7 +8807,6 @@ test_loopback_rx_exit: | |||
| 8778 | /* Update producers */ | 8807 | /* Update producers */ |
| 8779 | bnx2x_update_rx_prod(bp, fp, fp->rx_bd_prod, fp->rx_comp_prod, | 8808 | bnx2x_update_rx_prod(bp, fp, fp->rx_bd_prod, fp->rx_comp_prod, |
| 8780 | fp->rx_sge_prod); | 8809 | fp->rx_sge_prod); |
| 8781 | mmiowb(); /* keep prod updates ordered */ | ||
| 8782 | 8810 | ||
| 8783 | test_loopback_exit: | 8811 | test_loopback_exit: |
| 8784 | bp->link_params.loopback_mode = LOOPBACK_NONE; | 8812 | bp->link_params.loopback_mode = LOOPBACK_NONE; |
| @@ -9549,11 +9577,14 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 9549 | "sending pkt %u @%p next_idx %u bd %u @%p\n", | 9577 | "sending pkt %u @%p next_idx %u bd %u @%p\n", |
| 9550 | pkt_prod, tx_buf, fp->tx_pkt_prod, bd_prod, tx_bd); | 9578 | pkt_prod, tx_buf, fp->tx_pkt_prod, bd_prod, tx_bd); |
| 9551 | 9579 | ||
| 9552 | if ((bp->vlgrp != NULL) && vlan_tx_tag_present(skb)) { | 9580 | #ifdef BCM_VLAN |
| 9581 | if ((bp->vlgrp != NULL) && vlan_tx_tag_present(skb) && | ||
| 9582 | (bp->flags & HW_VLAN_TX_FLAG)) { | ||
| 9553 | tx_bd->vlan = cpu_to_le16(vlan_tx_tag_get(skb)); | 9583 | tx_bd->vlan = cpu_to_le16(vlan_tx_tag_get(skb)); |
| 9554 | tx_bd->bd_flags.as_bitfield |= ETH_TX_BD_FLAGS_VLAN_TAG; | 9584 | tx_bd->bd_flags.as_bitfield |= ETH_TX_BD_FLAGS_VLAN_TAG; |
| 9555 | vlan_off += 4; | 9585 | vlan_off += 4; |
| 9556 | } else | 9586 | } else |
| 9587 | #endif | ||
| 9557 | tx_bd->vlan = cpu_to_le16(pkt_prod); | 9588 | tx_bd->vlan = cpu_to_le16(pkt_prod); |
| 9558 | 9589 | ||
| 9559 | if (xmit_type) { | 9590 | if (xmit_type) { |
| @@ -9705,6 +9736,15 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 9705 | 9736 | ||
| 9706 | DP(NETIF_MSG_TX_QUEUED, "doorbell: nbd %d bd %u\n", nbd, bd_prod); | 9737 | DP(NETIF_MSG_TX_QUEUED, "doorbell: nbd %d bd %u\n", nbd, bd_prod); |
| 9707 | 9738 | ||
| 9739 | /* | ||
| 9740 | * Make sure that the BD data is updated before updating the producer | ||
| 9741 | * since FW might read the BD right after the producer is updated. | ||
| 9742 | * This is only applicable for weak-ordered memory model archs such | ||
| 9743 | * as IA-64. The following barrier is also mandatory since FW will | ||
| 9744 | * assumes packets must have BDs. | ||
| 9745 | */ | ||
| 9746 | wmb(); | ||
| 9747 | |||
| 9708 | fp->hw_tx_prods->bds_prod = | 9748 | fp->hw_tx_prods->bds_prod = |
| 9709 | cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + nbd); | 9749 | cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + nbd); |
| 9710 | mb(); /* FW restriction: must not reorder writing nbd and packets */ | 9750 | mb(); /* FW restriction: must not reorder writing nbd and packets */ |
| @@ -9718,6 +9758,9 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 9718 | dev->trans_start = jiffies; | 9758 | dev->trans_start = jiffies; |
| 9719 | 9759 | ||
| 9720 | if (unlikely(bnx2x_tx_avail(fp) < MAX_SKB_FRAGS + 3)) { | 9760 | if (unlikely(bnx2x_tx_avail(fp) < MAX_SKB_FRAGS + 3)) { |
| 9761 | /* We want bnx2x_tx_int to "see" the updated tx_bd_prod | ||
| 9762 | if we put Tx into XOFF state. */ | ||
| 9763 | smp_mb(); | ||
| 9721 | netif_stop_queue(dev); | 9764 | netif_stop_queue(dev); |
| 9722 | bp->eth_stats.driver_xoff++; | 9765 | bp->eth_stats.driver_xoff++; |
| 9723 | if (bnx2x_tx_avail(fp) >= MAX_SKB_FRAGS + 3) | 9766 | if (bnx2x_tx_avail(fp) >= MAX_SKB_FRAGS + 3) |
| @@ -9987,6 +10030,16 @@ static void bnx2x_vlan_rx_register(struct net_device *dev, | |||
| 9987 | struct bnx2x *bp = netdev_priv(dev); | 10030 | struct bnx2x *bp = netdev_priv(dev); |
| 9988 | 10031 | ||
| 9989 | bp->vlgrp = vlgrp; | 10032 | bp->vlgrp = vlgrp; |
| 10033 | |||
| 10034 | /* Set flags according to the required capabilities */ | ||
| 10035 | bp->flags &= ~(HW_VLAN_RX_FLAG | HW_VLAN_TX_FLAG); | ||
| 10036 | |||
| 10037 | if (dev->features & NETIF_F_HW_VLAN_TX) | ||
| 10038 | bp->flags |= HW_VLAN_TX_FLAG; | ||
| 10039 | |||
| 10040 | if (dev->features & NETIF_F_HW_VLAN_RX) | ||
| 10041 | bp->flags |= HW_VLAN_RX_FLAG; | ||
| 10042 | |||
| 9990 | if (netif_running(dev)) | 10043 | if (netif_running(dev)) |
| 9991 | bnx2x_set_client_config(bp); | 10044 | bnx2x_set_client_config(bp); |
| 9992 | } | 10045 | } |
| @@ -10143,6 +10196,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev, | |||
| 10143 | dev->features |= NETIF_F_HIGHDMA; | 10196 | dev->features |= NETIF_F_HIGHDMA; |
| 10144 | #ifdef BCM_VLAN | 10197 | #ifdef BCM_VLAN |
| 10145 | dev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX); | 10198 | dev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX); |
| 10199 | bp->flags |= (HW_VLAN_RX_FLAG | HW_VLAN_TX_FLAG); | ||
| 10146 | #endif | 10200 | #endif |
| 10147 | dev->features |= (NETIF_F_TSO | NETIF_F_TSO_ECN); | 10201 | dev->features |= (NETIF_F_TSO | NETIF_F_TSO_ECN); |
| 10148 | dev->features |= NETIF_F_TSO6; | 10202 | dev->features |= NETIF_F_TSO6; |
| @@ -10519,12 +10573,20 @@ static struct pci_driver bnx2x_pci_driver = { | |||
| 10519 | 10573 | ||
| 10520 | static int __init bnx2x_init(void) | 10574 | static int __init bnx2x_init(void) |
| 10521 | { | 10575 | { |
| 10576 | bnx2x_wq = create_singlethread_workqueue("bnx2x"); | ||
| 10577 | if (bnx2x_wq == NULL) { | ||
| 10578 | printk(KERN_ERR PFX "Cannot create workqueue\n"); | ||
| 10579 | return -ENOMEM; | ||
| 10580 | } | ||
| 10581 | |||
| 10522 | return pci_register_driver(&bnx2x_pci_driver); | 10582 | return pci_register_driver(&bnx2x_pci_driver); |
| 10523 | } | 10583 | } |
| 10524 | 10584 | ||
| 10525 | static void __exit bnx2x_cleanup(void) | 10585 | static void __exit bnx2x_cleanup(void) |
| 10526 | { | 10586 | { |
| 10527 | pci_unregister_driver(&bnx2x_pci_driver); | 10587 | pci_unregister_driver(&bnx2x_pci_driver); |
| 10588 | |||
| 10589 | destroy_workqueue(bnx2x_wq); | ||
| 10528 | } | 10590 | } |
| 10529 | 10591 | ||
| 10530 | module_init(bnx2x_init); | 10592 | module_init(bnx2x_init); |
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index 4e6a9195fe5f..ce900e54d8d1 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
| @@ -795,6 +795,7 @@ static int fs_enet_open(struct net_device *dev) | |||
| 795 | 795 | ||
| 796 | err = fs_init_phy(dev); | 796 | err = fs_init_phy(dev); |
| 797 | if (err) { | 797 | if (err) { |
| 798 | free_irq(fep->interrupt, dev); | ||
| 798 | if (fep->fpi->use_napi) | 799 | if (fep->fpi->use_napi) |
| 799 | napi_disable(&fep->napi); | 800 | napi_disable(&fep->napi); |
| 800 | return err; | 801 | return err; |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index efcbeb6c8673..ea530673236e 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
| @@ -1622,10 +1622,18 @@ static int gfar_clean_tx_ring(struct net_device *dev) | |||
| 1622 | static void gfar_schedule_cleanup(struct net_device *dev) | 1622 | static void gfar_schedule_cleanup(struct net_device *dev) |
| 1623 | { | 1623 | { |
| 1624 | struct gfar_private *priv = netdev_priv(dev); | 1624 | struct gfar_private *priv = netdev_priv(dev); |
| 1625 | unsigned long flags; | ||
| 1626 | |||
| 1627 | spin_lock_irqsave(&priv->txlock, flags); | ||
| 1628 | spin_lock(&priv->rxlock); | ||
| 1629 | |||
| 1625 | if (netif_rx_schedule_prep(&priv->napi)) { | 1630 | if (netif_rx_schedule_prep(&priv->napi)) { |
| 1626 | gfar_write(&priv->regs->imask, IMASK_RTX_DISABLED); | 1631 | gfar_write(&priv->regs->imask, IMASK_RTX_DISABLED); |
| 1627 | __netif_rx_schedule(&priv->napi); | 1632 | __netif_rx_schedule(&priv->napi); |
| 1628 | } | 1633 | } |
| 1634 | |||
| 1635 | spin_unlock(&priv->rxlock); | ||
| 1636 | spin_unlock_irqrestore(&priv->txlock, flags); | ||
| 1629 | } | 1637 | } |
| 1630 | 1638 | ||
| 1631 | /* Interrupt Handler for Transmit complete */ | 1639 | /* Interrupt Handler for Transmit complete */ |
diff --git a/drivers/net/ibm_newemac/mal.c b/drivers/net/ibm_newemac/mal.c index ecf9798987fa..2a2fc17b2878 100644 --- a/drivers/net/ibm_newemac/mal.c +++ b/drivers/net/ibm_newemac/mal.c | |||
| @@ -613,7 +613,9 @@ static int __devinit mal_probe(struct of_device *ofdev, | |||
| 613 | INIT_LIST_HEAD(&mal->list); | 613 | INIT_LIST_HEAD(&mal->list); |
| 614 | spin_lock_init(&mal->lock); | 614 | spin_lock_init(&mal->lock); |
| 615 | 615 | ||
| 616 | netif_napi_add(NULL, &mal->napi, mal_poll, | 616 | init_dummy_netdev(&mal->dummy_dev); |
| 617 | |||
| 618 | netif_napi_add(&mal->dummy_dev, &mal->napi, mal_poll, | ||
| 617 | CONFIG_IBM_NEW_EMAC_POLL_WEIGHT); | 619 | CONFIG_IBM_NEW_EMAC_POLL_WEIGHT); |
| 618 | 620 | ||
| 619 | /* Load power-on reset defaults */ | 621 | /* Load power-on reset defaults */ |
diff --git a/drivers/net/ibm_newemac/mal.h b/drivers/net/ibm_newemac/mal.h index 2f0a87360844..9ededfbf0726 100644 --- a/drivers/net/ibm_newemac/mal.h +++ b/drivers/net/ibm_newemac/mal.h | |||
| @@ -214,6 +214,8 @@ struct mal_instance { | |||
| 214 | int index; | 214 | int index; |
| 215 | spinlock_t lock; | 215 | spinlock_t lock; |
| 216 | 216 | ||
| 217 | struct net_device dummy_dev; | ||
| 218 | |||
| 217 | unsigned int features; | 219 | unsigned int features; |
| 218 | }; | 220 | }; |
| 219 | 221 | ||
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 29118f58a141..3a22dc41b656 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c | |||
| @@ -1073,7 +1073,7 @@ static int stir421x_patch_device(struct irda_usb_cb *self) | |||
| 1073 | { | 1073 | { |
| 1074 | unsigned int i; | 1074 | unsigned int i; |
| 1075 | int ret; | 1075 | int ret; |
| 1076 | char stir421x_fw_name[11]; | 1076 | char stir421x_fw_name[12]; |
| 1077 | const struct firmware *fw; | 1077 | const struct firmware *fw; |
| 1078 | const unsigned char *fw_version_ptr; /* pointer to version string */ | 1078 | const unsigned char *fw_version_ptr; /* pointer to version string */ |
| 1079 | unsigned long fw_version = 0; | 1079 | unsigned long fw_version = 0; |
diff --git a/drivers/net/korina.c b/drivers/net/korina.c index 4a5580c1126a..1d6e48e13366 100644 --- a/drivers/net/korina.c +++ b/drivers/net/korina.c | |||
| @@ -84,7 +84,10 @@ | |||
| 84 | #define KORINA_NUM_RDS 64 /* number of receive descriptors */ | 84 | #define KORINA_NUM_RDS 64 /* number of receive descriptors */ |
| 85 | #define KORINA_NUM_TDS 64 /* number of transmit descriptors */ | 85 | #define KORINA_NUM_TDS 64 /* number of transmit descriptors */ |
| 86 | 86 | ||
| 87 | #define KORINA_RBSIZE 536 /* size of one resource buffer = Ether MTU */ | 87 | /* KORINA_RBSIZE is the hardware's default maximum receive |
| 88 | * frame size in bytes. Having this hardcoded means that there | ||
| 89 | * is no support for MTU sizes greater than 1500. */ | ||
| 90 | #define KORINA_RBSIZE 1536 /* size of one resource buffer = Ether MTU */ | ||
| 88 | #define KORINA_RDS_MASK (KORINA_NUM_RDS - 1) | 91 | #define KORINA_RDS_MASK (KORINA_NUM_RDS - 1) |
| 89 | #define KORINA_TDS_MASK (KORINA_NUM_TDS - 1) | 92 | #define KORINA_TDS_MASK (KORINA_NUM_TDS - 1) |
| 90 | #define RD_RING_SIZE (KORINA_NUM_RDS * sizeof(struct dma_desc)) | 93 | #define RD_RING_SIZE (KORINA_NUM_RDS * sizeof(struct dma_desc)) |
| @@ -196,7 +199,7 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
| 196 | struct korina_private *lp = netdev_priv(dev); | 199 | struct korina_private *lp = netdev_priv(dev); |
| 197 | unsigned long flags; | 200 | unsigned long flags; |
| 198 | u32 length; | 201 | u32 length; |
| 199 | u32 chain_index; | 202 | u32 chain_prev, chain_next; |
| 200 | struct dma_desc *td; | 203 | struct dma_desc *td; |
| 201 | 204 | ||
| 202 | spin_lock_irqsave(&lp->lock, flags); | 205 | spin_lock_irqsave(&lp->lock, flags); |
| @@ -228,8 +231,8 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
| 228 | /* Setup the transmit descriptor. */ | 231 | /* Setup the transmit descriptor. */ |
| 229 | dma_cache_inv((u32) td, sizeof(*td)); | 232 | dma_cache_inv((u32) td, sizeof(*td)); |
| 230 | td->ca = CPHYSADDR(skb->data); | 233 | td->ca = CPHYSADDR(skb->data); |
| 231 | chain_index = (lp->tx_chain_tail - 1) & | 234 | chain_prev = (lp->tx_chain_tail - 1) & KORINA_TDS_MASK; |
| 232 | KORINA_TDS_MASK; | 235 | chain_next = (lp->tx_chain_tail + 1) & KORINA_TDS_MASK; |
| 233 | 236 | ||
| 234 | if (readl(&(lp->tx_dma_regs->dmandptr)) == 0) { | 237 | if (readl(&(lp->tx_dma_regs->dmandptr)) == 0) { |
| 235 | if (lp->tx_chain_status == desc_empty) { | 238 | if (lp->tx_chain_status == desc_empty) { |
| @@ -237,7 +240,7 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
| 237 | td->control = DMA_COUNT(length) | | 240 | td->control = DMA_COUNT(length) | |
| 238 | DMA_DESC_COF | DMA_DESC_IOF; | 241 | DMA_DESC_COF | DMA_DESC_IOF; |
| 239 | /* Move tail */ | 242 | /* Move tail */ |
| 240 | lp->tx_chain_tail = chain_index; | 243 | lp->tx_chain_tail = chain_next; |
| 241 | /* Write to NDPTR */ | 244 | /* Write to NDPTR */ |
| 242 | writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), | 245 | writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), |
| 243 | &lp->tx_dma_regs->dmandptr); | 246 | &lp->tx_dma_regs->dmandptr); |
| @@ -248,12 +251,12 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
| 248 | td->control = DMA_COUNT(length) | | 251 | td->control = DMA_COUNT(length) | |
| 249 | DMA_DESC_COF | DMA_DESC_IOF; | 252 | DMA_DESC_COF | DMA_DESC_IOF; |
| 250 | /* Link to prev */ | 253 | /* Link to prev */ |
| 251 | lp->td_ring[chain_index].control &= | 254 | lp->td_ring[chain_prev].control &= |
| 252 | ~DMA_DESC_COF; | 255 | ~DMA_DESC_COF; |
| 253 | /* Link to prev */ | 256 | /* Link to prev */ |
| 254 | lp->td_ring[chain_index].link = CPHYSADDR(td); | 257 | lp->td_ring[chain_prev].link = CPHYSADDR(td); |
| 255 | /* Move tail */ | 258 | /* Move tail */ |
| 256 | lp->tx_chain_tail = chain_index; | 259 | lp->tx_chain_tail = chain_next; |
| 257 | /* Write to NDPTR */ | 260 | /* Write to NDPTR */ |
| 258 | writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), | 261 | writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), |
| 259 | &(lp->tx_dma_regs->dmandptr)); | 262 | &(lp->tx_dma_regs->dmandptr)); |
| @@ -267,17 +270,16 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
| 267 | td->control = DMA_COUNT(length) | | 270 | td->control = DMA_COUNT(length) | |
| 268 | DMA_DESC_COF | DMA_DESC_IOF; | 271 | DMA_DESC_COF | DMA_DESC_IOF; |
| 269 | /* Move tail */ | 272 | /* Move tail */ |
| 270 | lp->tx_chain_tail = chain_index; | 273 | lp->tx_chain_tail = chain_next; |
| 271 | lp->tx_chain_status = desc_filled; | 274 | lp->tx_chain_status = desc_filled; |
| 272 | netif_stop_queue(dev); | ||
| 273 | } else { | 275 | } else { |
| 274 | /* Update tail */ | 276 | /* Update tail */ |
| 275 | td->control = DMA_COUNT(length) | | 277 | td->control = DMA_COUNT(length) | |
| 276 | DMA_DESC_COF | DMA_DESC_IOF; | 278 | DMA_DESC_COF | DMA_DESC_IOF; |
| 277 | lp->td_ring[chain_index].control &= | 279 | lp->td_ring[chain_prev].control &= |
| 278 | ~DMA_DESC_COF; | 280 | ~DMA_DESC_COF; |
| 279 | lp->td_ring[chain_index].link = CPHYSADDR(td); | 281 | lp->td_ring[chain_prev].link = CPHYSADDR(td); |
| 280 | lp->tx_chain_tail = chain_index; | 282 | lp->tx_chain_tail = chain_next; |
| 281 | } | 283 | } |
| 282 | } | 284 | } |
| 283 | dma_cache_wback((u32) td, sizeof(*td)); | 285 | dma_cache_wback((u32) td, sizeof(*td)); |
| @@ -327,13 +329,13 @@ static irqreturn_t korina_rx_dma_interrupt(int irq, void *dev_id) | |||
| 327 | 329 | ||
| 328 | dmas = readl(&lp->rx_dma_regs->dmas); | 330 | dmas = readl(&lp->rx_dma_regs->dmas); |
| 329 | if (dmas & (DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR)) { | 331 | if (dmas & (DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR)) { |
| 330 | netif_rx_schedule_prep(&lp->napi); | ||
| 331 | |||
| 332 | dmasm = readl(&lp->rx_dma_regs->dmasm); | 332 | dmasm = readl(&lp->rx_dma_regs->dmasm); |
| 333 | writel(dmasm | (DMA_STAT_DONE | | 333 | writel(dmasm | (DMA_STAT_DONE | |
| 334 | DMA_STAT_HALT | DMA_STAT_ERR), | 334 | DMA_STAT_HALT | DMA_STAT_ERR), |
| 335 | &lp->rx_dma_regs->dmasm); | 335 | &lp->rx_dma_regs->dmasm); |
| 336 | 336 | ||
| 337 | netif_rx_schedule(&lp->napi); | ||
| 338 | |||
| 337 | if (dmas & DMA_STAT_ERR) | 339 | if (dmas & DMA_STAT_ERR) |
| 338 | printk(KERN_ERR DRV_NAME "%s: DMA error\n", dev->name); | 340 | printk(KERN_ERR DRV_NAME "%s: DMA error\n", dev->name); |
| 339 | 341 | ||
| @@ -350,15 +352,20 @@ static int korina_rx(struct net_device *dev, int limit) | |||
| 350 | struct dma_desc *rd = &lp->rd_ring[lp->rx_next_done]; | 352 | struct dma_desc *rd = &lp->rd_ring[lp->rx_next_done]; |
| 351 | struct sk_buff *skb, *skb_new; | 353 | struct sk_buff *skb, *skb_new; |
| 352 | u8 *pkt_buf; | 354 | u8 *pkt_buf; |
| 353 | u32 devcs, pkt_len, dmas, rx_free_desc; | 355 | u32 devcs, pkt_len, dmas; |
| 354 | int count; | 356 | int count; |
| 355 | 357 | ||
| 356 | dma_cache_inv((u32)rd, sizeof(*rd)); | 358 | dma_cache_inv((u32)rd, sizeof(*rd)); |
| 357 | 359 | ||
| 358 | for (count = 0; count < limit; count++) { | 360 | for (count = 0; count < limit; count++) { |
| 361 | skb = lp->rx_skb[lp->rx_next_done]; | ||
| 362 | skb_new = NULL; | ||
| 359 | 363 | ||
| 360 | devcs = rd->devcs; | 364 | devcs = rd->devcs; |
| 361 | 365 | ||
| 366 | if ((KORINA_RBSIZE - (u32)DMA_COUNT(rd->control)) == 0) | ||
| 367 | break; | ||
| 368 | |||
| 362 | /* Update statistics counters */ | 369 | /* Update statistics counters */ |
| 363 | if (devcs & ETH_RX_CRC) | 370 | if (devcs & ETH_RX_CRC) |
| 364 | dev->stats.rx_crc_errors++; | 371 | dev->stats.rx_crc_errors++; |
| @@ -381,63 +388,55 @@ static int korina_rx(struct net_device *dev, int limit) | |||
| 381 | * in Rc32434 (errata ref #077) */ | 388 | * in Rc32434 (errata ref #077) */ |
| 382 | dev->stats.rx_errors++; | 389 | dev->stats.rx_errors++; |
| 383 | dev->stats.rx_dropped++; | 390 | dev->stats.rx_dropped++; |
| 384 | } | 391 | } else if ((devcs & ETH_RX_ROK)) { |
| 385 | |||
| 386 | while ((rx_free_desc = KORINA_RBSIZE - (u32)DMA_COUNT(rd->control)) != 0) { | ||
| 387 | /* init the var. used for the later | ||
| 388 | * operations within the while loop */ | ||
| 389 | skb_new = NULL; | ||
| 390 | pkt_len = RCVPKT_LENGTH(devcs); | 392 | pkt_len = RCVPKT_LENGTH(devcs); |
| 391 | skb = lp->rx_skb[lp->rx_next_done]; | 393 | |
| 392 | 394 | /* must be the (first and) last | |
| 393 | if ((devcs & ETH_RX_ROK)) { | 395 | * descriptor then */ |
| 394 | /* must be the (first and) last | 396 | pkt_buf = (u8 *)lp->rx_skb[lp->rx_next_done]->data; |
| 395 | * descriptor then */ | 397 | |
| 396 | pkt_buf = (u8 *)lp->rx_skb[lp->rx_next_done]->data; | 398 | /* invalidate the cache */ |
| 397 | 399 | dma_cache_inv((unsigned long)pkt_buf, pkt_len - 4); | |
| 398 | /* invalidate the cache */ | 400 | |
| 399 | dma_cache_inv((unsigned long)pkt_buf, pkt_len - 4); | 401 | /* Malloc up new buffer. */ |
| 400 | 402 | skb_new = netdev_alloc_skb(dev, KORINA_RBSIZE + 2); | |
| 401 | /* Malloc up new buffer. */ | 403 | |
| 402 | skb_new = netdev_alloc_skb(dev, KORINA_RBSIZE + 2); | 404 | if (!skb_new) |
| 403 | 405 | break; | |
| 404 | if (!skb_new) | 406 | /* Do not count the CRC */ |
| 405 | break; | 407 | skb_put(skb, pkt_len - 4); |
| 406 | /* Do not count the CRC */ | 408 | skb->protocol = eth_type_trans(skb, dev); |
| 407 | skb_put(skb, pkt_len - 4); | 409 | |
| 408 | skb->protocol = eth_type_trans(skb, dev); | 410 | /* Pass the packet to upper layers */ |
| 409 | 411 | netif_receive_skb(skb); | |
| 410 | /* Pass the packet to upper layers */ | 412 | dev->stats.rx_packets++; |
| 411 | netif_receive_skb(skb); | 413 | dev->stats.rx_bytes += pkt_len; |
| 412 | dev->stats.rx_packets++; | 414 | |
| 413 | dev->stats.rx_bytes += pkt_len; | 415 | /* Update the mcast stats */ |
| 414 | 416 | if (devcs & ETH_RX_MP) | |
| 415 | /* Update the mcast stats */ | 417 | dev->stats.multicast++; |
| 416 | if (devcs & ETH_RX_MP) | 418 | |
| 417 | dev->stats.multicast++; | 419 | lp->rx_skb[lp->rx_next_done] = skb_new; |
| 418 | |||
| 419 | lp->rx_skb[lp->rx_next_done] = skb_new; | ||
| 420 | } | ||
| 421 | |||
| 422 | rd->devcs = 0; | ||
| 423 | |||
| 424 | /* Restore descriptor's curr_addr */ | ||
| 425 | if (skb_new) | ||
| 426 | rd->ca = CPHYSADDR(skb_new->data); | ||
| 427 | else | ||
| 428 | rd->ca = CPHYSADDR(skb->data); | ||
| 429 | |||
| 430 | rd->control = DMA_COUNT(KORINA_RBSIZE) | | ||
| 431 | DMA_DESC_COD | DMA_DESC_IOD; | ||
| 432 | lp->rd_ring[(lp->rx_next_done - 1) & | ||
| 433 | KORINA_RDS_MASK].control &= | ||
| 434 | ~DMA_DESC_COD; | ||
| 435 | |||
| 436 | lp->rx_next_done = (lp->rx_next_done + 1) & KORINA_RDS_MASK; | ||
| 437 | dma_cache_wback((u32)rd, sizeof(*rd)); | ||
| 438 | rd = &lp->rd_ring[lp->rx_next_done]; | ||
| 439 | writel(~DMA_STAT_DONE, &lp->rx_dma_regs->dmas); | ||
| 440 | } | 420 | } |
| 421 | |||
| 422 | rd->devcs = 0; | ||
| 423 | |||
| 424 | /* Restore descriptor's curr_addr */ | ||
| 425 | if (skb_new) | ||
| 426 | rd->ca = CPHYSADDR(skb_new->data); | ||
| 427 | else | ||
| 428 | rd->ca = CPHYSADDR(skb->data); | ||
| 429 | |||
| 430 | rd->control = DMA_COUNT(KORINA_RBSIZE) | | ||
| 431 | DMA_DESC_COD | DMA_DESC_IOD; | ||
| 432 | lp->rd_ring[(lp->rx_next_done - 1) & | ||
| 433 | KORINA_RDS_MASK].control &= | ||
| 434 | ~DMA_DESC_COD; | ||
| 435 | |||
| 436 | lp->rx_next_done = (lp->rx_next_done + 1) & KORINA_RDS_MASK; | ||
| 437 | dma_cache_wback((u32)rd, sizeof(*rd)); | ||
| 438 | rd = &lp->rd_ring[lp->rx_next_done]; | ||
| 439 | writel(~DMA_STAT_DONE, &lp->rx_dma_regs->dmas); | ||
| 441 | } | 440 | } |
| 442 | 441 | ||
| 443 | dmas = readl(&lp->rx_dma_regs->dmas); | 442 | dmas = readl(&lp->rx_dma_regs->dmas); |
| @@ -623,12 +622,12 @@ korina_tx_dma_interrupt(int irq, void *dev_id) | |||
| 623 | dmas = readl(&lp->tx_dma_regs->dmas); | 622 | dmas = readl(&lp->tx_dma_regs->dmas); |
| 624 | 623 | ||
| 625 | if (dmas & (DMA_STAT_FINI | DMA_STAT_ERR)) { | 624 | if (dmas & (DMA_STAT_FINI | DMA_STAT_ERR)) { |
| 626 | korina_tx(dev); | ||
| 627 | |||
| 628 | dmasm = readl(&lp->tx_dma_regs->dmasm); | 625 | dmasm = readl(&lp->tx_dma_regs->dmasm); |
| 629 | writel(dmasm | (DMA_STAT_FINI | DMA_STAT_ERR), | 626 | writel(dmasm | (DMA_STAT_FINI | DMA_STAT_ERR), |
| 630 | &lp->tx_dma_regs->dmasm); | 627 | &lp->tx_dma_regs->dmasm); |
| 631 | 628 | ||
| 629 | korina_tx(dev); | ||
| 630 | |||
| 632 | if (lp->tx_chain_status == desc_filled && | 631 | if (lp->tx_chain_status == desc_filled && |
| 633 | (readl(&(lp->tx_dma_regs->dmandptr)) == 0)) { | 632 | (readl(&(lp->tx_dma_regs->dmandptr)) == 0)) { |
| 634 | writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), | 633 | writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), |
| @@ -901,6 +900,8 @@ static int korina_restart(struct net_device *dev) | |||
| 901 | 900 | ||
| 902 | korina_free_ring(dev); | 901 | korina_free_ring(dev); |
| 903 | 902 | ||
| 903 | napi_disable(&lp->napi); | ||
| 904 | |||
| 904 | ret = korina_init(dev); | 905 | ret = korina_init(dev); |
| 905 | if (ret < 0) { | 906 | if (ret < 0) { |
| 906 | printk(KERN_ERR DRV_NAME "%s: cannot restart device\n", | 907 | printk(KERN_ERR DRV_NAME "%s: cannot restart device\n", |
| @@ -999,14 +1000,14 @@ static int korina_open(struct net_device *dev) | |||
| 999 | * that handles the Done Finished | 1000 | * that handles the Done Finished |
| 1000 | * Ovr and Und Events */ | 1001 | * Ovr and Und Events */ |
| 1001 | ret = request_irq(lp->rx_irq, &korina_rx_dma_interrupt, | 1002 | ret = request_irq(lp->rx_irq, &korina_rx_dma_interrupt, |
| 1002 | IRQF_SHARED | IRQF_DISABLED, "Korina ethernet Rx", dev); | 1003 | IRQF_DISABLED, "Korina ethernet Rx", dev); |
| 1003 | if (ret < 0) { | 1004 | if (ret < 0) { |
| 1004 | printk(KERN_ERR DRV_NAME "%s: unable to get Rx DMA IRQ %d\n", | 1005 | printk(KERN_ERR DRV_NAME "%s: unable to get Rx DMA IRQ %d\n", |
| 1005 | dev->name, lp->rx_irq); | 1006 | dev->name, lp->rx_irq); |
| 1006 | goto err_release; | 1007 | goto err_release; |
| 1007 | } | 1008 | } |
| 1008 | ret = request_irq(lp->tx_irq, &korina_tx_dma_interrupt, | 1009 | ret = request_irq(lp->tx_irq, &korina_tx_dma_interrupt, |
| 1009 | IRQF_SHARED | IRQF_DISABLED, "Korina ethernet Tx", dev); | 1010 | IRQF_DISABLED, "Korina ethernet Tx", dev); |
| 1010 | if (ret < 0) { | 1011 | if (ret < 0) { |
| 1011 | printk(KERN_ERR DRV_NAME "%s: unable to get Tx DMA IRQ %d\n", | 1012 | printk(KERN_ERR DRV_NAME "%s: unable to get Tx DMA IRQ %d\n", |
| 1012 | dev->name, lp->tx_irq); | 1013 | dev->name, lp->tx_irq); |
| @@ -1015,7 +1016,7 @@ static int korina_open(struct net_device *dev) | |||
| 1015 | 1016 | ||
| 1016 | /* Install handler for overrun error. */ | 1017 | /* Install handler for overrun error. */ |
| 1017 | ret = request_irq(lp->ovr_irq, &korina_ovr_interrupt, | 1018 | ret = request_irq(lp->ovr_irq, &korina_ovr_interrupt, |
| 1018 | IRQF_SHARED | IRQF_DISABLED, "Ethernet Overflow", dev); | 1019 | IRQF_DISABLED, "Ethernet Overflow", dev); |
| 1019 | if (ret < 0) { | 1020 | if (ret < 0) { |
| 1020 | printk(KERN_ERR DRV_NAME"%s: unable to get OVR IRQ %d\n", | 1021 | printk(KERN_ERR DRV_NAME"%s: unable to get OVR IRQ %d\n", |
| 1021 | dev->name, lp->ovr_irq); | 1022 | dev->name, lp->ovr_irq); |
| @@ -1024,7 +1025,7 @@ static int korina_open(struct net_device *dev) | |||
| 1024 | 1025 | ||
| 1025 | /* Install handler for underflow error. */ | 1026 | /* Install handler for underflow error. */ |
| 1026 | ret = request_irq(lp->und_irq, &korina_und_interrupt, | 1027 | ret = request_irq(lp->und_irq, &korina_und_interrupt, |
| 1027 | IRQF_SHARED | IRQF_DISABLED, "Ethernet Underflow", dev); | 1028 | IRQF_DISABLED, "Ethernet Underflow", dev); |
| 1028 | if (ret < 0) { | 1029 | if (ret < 0) { |
| 1029 | printk(KERN_ERR DRV_NAME "%s: unable to get UND IRQ %d\n", | 1030 | printk(KERN_ERR DRV_NAME "%s: unable to get UND IRQ %d\n", |
| 1030 | dev->name, lp->und_irq); | 1031 | dev->name, lp->und_irq); |
| @@ -1067,6 +1068,8 @@ static int korina_close(struct net_device *dev) | |||
| 1067 | 1068 | ||
| 1068 | korina_free_ring(dev); | 1069 | korina_free_ring(dev); |
| 1069 | 1070 | ||
| 1071 | napi_disable(&lp->napi); | ||
| 1072 | |||
| 1070 | free_irq(lp->rx_irq, dev); | 1073 | free_irq(lp->rx_irq, dev); |
| 1071 | free_irq(lp->tx_irq, dev); | 1074 | free_irq(lp->tx_irq, dev); |
| 1072 | free_irq(lp->ovr_irq, dev); | 1075 | free_irq(lp->ovr_irq, dev); |
| @@ -1089,7 +1092,6 @@ static int korina_probe(struct platform_device *pdev) | |||
| 1089 | return -ENOMEM; | 1092 | return -ENOMEM; |
| 1090 | } | 1093 | } |
| 1091 | SET_NETDEV_DEV(dev, &pdev->dev); | 1094 | SET_NETDEV_DEV(dev, &pdev->dev); |
| 1092 | platform_set_drvdata(pdev, dev); | ||
| 1093 | lp = netdev_priv(dev); | 1095 | lp = netdev_priv(dev); |
| 1094 | 1096 | ||
| 1095 | bif->dev = dev; | 1097 | bif->dev = dev; |
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index f8e601c51da7..c11c568fd7db 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
| @@ -308,27 +308,16 @@ struct netxen_ring_ctx { | |||
| 308 | #define netxen_set_cmd_desc_ctxid(cmd_desc, var) \ | 308 | #define netxen_set_cmd_desc_ctxid(cmd_desc, var) \ |
| 309 | ((cmd_desc)->port_ctxid |= ((var) << 4 & 0xF0)) | 309 | ((cmd_desc)->port_ctxid |= ((var) << 4 & 0xF0)) |
| 310 | 310 | ||
| 311 | #define netxen_set_cmd_desc_flags(cmd_desc, val) \ | 311 | #define netxen_set_tx_port(_desc, _port) \ |
| 312 | (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \ | 312 | (_desc)->port_ctxid = ((_port) & 0xf) | (((_port) << 4) & 0xf0) |
| 313 | ~cpu_to_le16(0x7f)) | cpu_to_le16((val) & 0x7f) | 313 | |
| 314 | #define netxen_set_cmd_desc_opcode(cmd_desc, val) \ | 314 | #define netxen_set_tx_flags_opcode(_desc, _flags, _opcode) \ |
| 315 | (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \ | 315 | (_desc)->flags_opcode = \ |
| 316 | ~cpu_to_le16((u16)0x3f << 7)) | cpu_to_le16(((val) & 0x3f) << 7) | 316 | cpu_to_le16(((_flags) & 0x7f) | (((_opcode) & 0x3f) << 7)) |
| 317 | 317 | ||
| 318 | #define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \ | 318 | #define netxen_set_tx_frags_len(_desc, _frags, _len) \ |
| 319 | (cmd_desc)->num_of_buffers_total_length = \ | 319 | (_desc)->num_of_buffers_total_length = \ |
| 320 | ((cmd_desc)->num_of_buffers_total_length & \ | 320 | cpu_to_le32(((_frags) & 0xff) | (((_len) & 0xffffff) << 8)) |
| 321 | ~cpu_to_le32(0xff)) | cpu_to_le32((val) & 0xff) | ||
| 322 | #define netxen_set_cmd_desc_totallength(cmd_desc, val) \ | ||
| 323 | (cmd_desc)->num_of_buffers_total_length = \ | ||
| 324 | ((cmd_desc)->num_of_buffers_total_length & \ | ||
| 325 | ~cpu_to_le32((u32)0xffffff << 8)) | \ | ||
| 326 | cpu_to_le32(((val) & 0xffffff) << 8) | ||
| 327 | |||
| 328 | #define netxen_get_cmd_desc_opcode(cmd_desc) \ | ||
| 329 | ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003f) | ||
| 330 | #define netxen_get_cmd_desc_totallength(cmd_desc) \ | ||
| 331 | ((le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8) & 0xffffff) | ||
| 332 | 321 | ||
| 333 | struct cmd_desc_type0 { | 322 | struct cmd_desc_type0 { |
| 334 | u8 tcp_hdr_offset; /* For LSO only */ | 323 | u8 tcp_hdr_offset; /* For LSO only */ |
| @@ -510,7 +499,8 @@ typedef enum { | |||
| 510 | NETXEN_BRDTYPE_P3_10G_SFP_CT = 0x002a, | 499 | NETXEN_BRDTYPE_P3_10G_SFP_CT = 0x002a, |
| 511 | NETXEN_BRDTYPE_P3_10G_SFP_QT = 0x002b, | 500 | NETXEN_BRDTYPE_P3_10G_SFP_QT = 0x002b, |
| 512 | NETXEN_BRDTYPE_P3_10G_CX4 = 0x0031, | 501 | NETXEN_BRDTYPE_P3_10G_CX4 = 0x0031, |
| 513 | NETXEN_BRDTYPE_P3_10G_XFP = 0x0032 | 502 | NETXEN_BRDTYPE_P3_10G_XFP = 0x0032, |
| 503 | NETXEN_BRDTYPE_P3_10G_TP = 0x0080 | ||
| 514 | 504 | ||
| 515 | } netxen_brdtype_t; | 505 | } netxen_brdtype_t; |
| 516 | 506 | ||
| @@ -757,7 +747,7 @@ extern char netxen_nic_driver_name[]; | |||
| 757 | */ | 747 | */ |
| 758 | struct netxen_skb_frag { | 748 | struct netxen_skb_frag { |
| 759 | u64 dma; | 749 | u64 dma; |
| 760 | u32 length; | 750 | ulong length; |
| 761 | }; | 751 | }; |
| 762 | 752 | ||
| 763 | #define _netxen_set_bits(config_word, start, bits, val) {\ | 753 | #define _netxen_set_bits(config_word, start, bits, val) {\ |
| @@ -783,13 +773,7 @@ struct netxen_skb_frag { | |||
| 783 | struct netxen_cmd_buffer { | 773 | struct netxen_cmd_buffer { |
| 784 | struct sk_buff *skb; | 774 | struct sk_buff *skb; |
| 785 | struct netxen_skb_frag frag_array[MAX_BUFFERS_PER_CMD + 1]; | 775 | struct netxen_skb_frag frag_array[MAX_BUFFERS_PER_CMD + 1]; |
| 786 | u32 total_length; | 776 | u32 frag_count; |
| 787 | u32 mss; | ||
| 788 | u16 port; | ||
| 789 | u8 cmd; | ||
| 790 | u8 frag_count; | ||
| 791 | unsigned long time_stamp; | ||
| 792 | u32 state; | ||
| 793 | }; | 777 | }; |
| 794 | 778 | ||
| 795 | /* In rx_buffer, we do not need multiple fragments as is a single buffer */ | 779 | /* In rx_buffer, we do not need multiple fragments as is a single buffer */ |
| @@ -876,7 +860,6 @@ struct nx_host_rds_ring { | |||
| 876 | u32 skb_size; | 860 | u32 skb_size; |
| 877 | struct netxen_rx_buffer *rx_buf_arr; /* rx buffers for receive */ | 861 | struct netxen_rx_buffer *rx_buf_arr; /* rx buffers for receive */ |
| 878 | struct list_head free_list; | 862 | struct list_head free_list; |
| 879 | int begin_alloc; | ||
| 880 | }; | 863 | }; |
| 881 | 864 | ||
| 882 | /* | 865 | /* |
| @@ -995,31 +978,31 @@ struct netxen_recv_context { | |||
| 995 | */ | 978 | */ |
| 996 | 979 | ||
| 997 | typedef struct { | 980 | typedef struct { |
| 998 | u64 host_phys_addr; /* Ring base addr */ | 981 | __le64 host_phys_addr; /* Ring base addr */ |
| 999 | u32 ring_size; /* Ring entries */ | 982 | __le32 ring_size; /* Ring entries */ |
| 1000 | u16 msi_index; | 983 | __le16 msi_index; |
| 1001 | u16 rsvd; /* Padding */ | 984 | __le16 rsvd; /* Padding */ |
| 1002 | } nx_hostrq_sds_ring_t; | 985 | } nx_hostrq_sds_ring_t; |
| 1003 | 986 | ||
| 1004 | typedef struct { | 987 | typedef struct { |
| 1005 | u64 host_phys_addr; /* Ring base addr */ | 988 | __le64 host_phys_addr; /* Ring base addr */ |
| 1006 | u64 buff_size; /* Packet buffer size */ | 989 | __le64 buff_size; /* Packet buffer size */ |
| 1007 | u32 ring_size; /* Ring entries */ | 990 | __le32 ring_size; /* Ring entries */ |
| 1008 | u32 ring_kind; /* Class of ring */ | 991 | __le32 ring_kind; /* Class of ring */ |
| 1009 | } nx_hostrq_rds_ring_t; | 992 | } nx_hostrq_rds_ring_t; |
| 1010 | 993 | ||
| 1011 | typedef struct { | 994 | typedef struct { |
| 1012 | u64 host_rsp_dma_addr; /* Response dma'd here */ | 995 | __le64 host_rsp_dma_addr; /* Response dma'd here */ |
| 1013 | u32 capabilities[4]; /* Flag bit vector */ | 996 | __le32 capabilities[4]; /* Flag bit vector */ |
| 1014 | u32 host_int_crb_mode; /* Interrupt crb usage */ | 997 | __le32 host_int_crb_mode; /* Interrupt crb usage */ |
| 1015 | u32 host_rds_crb_mode; /* RDS crb usage */ | 998 | __le32 host_rds_crb_mode; /* RDS crb usage */ |
| 1016 | /* These ring offsets are relative to data[0] below */ | 999 | /* These ring offsets are relative to data[0] below */ |
| 1017 | u32 rds_ring_offset; /* Offset to RDS config */ | 1000 | __le32 rds_ring_offset; /* Offset to RDS config */ |
| 1018 | u32 sds_ring_offset; /* Offset to SDS config */ | 1001 | __le32 sds_ring_offset; /* Offset to SDS config */ |
| 1019 | u16 num_rds_rings; /* Count of RDS rings */ | 1002 | __le16 num_rds_rings; /* Count of RDS rings */ |
| 1020 | u16 num_sds_rings; /* Count of SDS rings */ | 1003 | __le16 num_sds_rings; /* Count of SDS rings */ |
| 1021 | u16 rsvd1; /* Padding */ | 1004 | __le16 rsvd1; /* Padding */ |
| 1022 | u16 rsvd2; /* Padding */ | 1005 | __le16 rsvd2; /* Padding */ |
| 1023 | u8 reserved[128]; /* reserve space for future expansion*/ | 1006 | u8 reserved[128]; /* reserve space for future expansion*/ |
| 1024 | /* MUST BE 64-bit aligned. | 1007 | /* MUST BE 64-bit aligned. |
| 1025 | The following is packed: | 1008 | The following is packed: |
| @@ -1029,24 +1012,24 @@ typedef struct { | |||
| 1029 | } nx_hostrq_rx_ctx_t; | 1012 | } nx_hostrq_rx_ctx_t; |
| 1030 | 1013 | ||
| 1031 | typedef struct { | 1014 | typedef struct { |
| 1032 | u32 host_producer_crb; /* Crb to use */ | 1015 | __le32 host_producer_crb; /* Crb to use */ |
| 1033 | u32 rsvd1; /* Padding */ | 1016 | __le32 rsvd1; /* Padding */ |
| 1034 | } nx_cardrsp_rds_ring_t; | 1017 | } nx_cardrsp_rds_ring_t; |
| 1035 | 1018 | ||
| 1036 | typedef struct { | 1019 | typedef struct { |
| 1037 | u32 host_consumer_crb; /* Crb to use */ | 1020 | __le32 host_consumer_crb; /* Crb to use */ |
| 1038 | u32 interrupt_crb; /* Crb to use */ | 1021 | __le32 interrupt_crb; /* Crb to use */ |
| 1039 | } nx_cardrsp_sds_ring_t; | 1022 | } nx_cardrsp_sds_ring_t; |
| 1040 | 1023 | ||
| 1041 | typedef struct { | 1024 | typedef struct { |
| 1042 | /* These ring offsets are relative to data[0] below */ | 1025 | /* These ring offsets are relative to data[0] below */ |
| 1043 | u32 rds_ring_offset; /* Offset to RDS config */ | 1026 | __le32 rds_ring_offset; /* Offset to RDS config */ |
| 1044 | u32 sds_ring_offset; /* Offset to SDS config */ | 1027 | __le32 sds_ring_offset; /* Offset to SDS config */ |
| 1045 | u32 host_ctx_state; /* Starting State */ | 1028 | __le32 host_ctx_state; /* Starting State */ |
| 1046 | u32 num_fn_per_port; /* How many PCI fn share the port */ | 1029 | __le32 num_fn_per_port; /* How many PCI fn share the port */ |
| 1047 | u16 num_rds_rings; /* Count of RDS rings */ | 1030 | __le16 num_rds_rings; /* Count of RDS rings */ |
| 1048 | u16 num_sds_rings; /* Count of SDS rings */ | 1031 | __le16 num_sds_rings; /* Count of SDS rings */ |
| 1049 | u16 context_id; /* Handle for context */ | 1032 | __le16 context_id; /* Handle for context */ |
| 1050 | u8 phys_port; /* Physical id of port */ | 1033 | u8 phys_port; /* Physical id of port */ |
| 1051 | u8 virt_port; /* Virtual/Logical id of port */ | 1034 | u8 virt_port; /* Virtual/Logical id of port */ |
| 1052 | u8 reserved[128]; /* save space for future expansion */ | 1035 | u8 reserved[128]; /* save space for future expansion */ |
| @@ -1072,34 +1055,34 @@ typedef struct { | |||
| 1072 | */ | 1055 | */ |
| 1073 | 1056 | ||
| 1074 | typedef struct { | 1057 | typedef struct { |
| 1075 | u64 host_phys_addr; /* Ring base addr */ | 1058 | __le64 host_phys_addr; /* Ring base addr */ |
| 1076 | u32 ring_size; /* Ring entries */ | 1059 | __le32 ring_size; /* Ring entries */ |
| 1077 | u32 rsvd; /* Padding */ | 1060 | __le32 rsvd; /* Padding */ |
| 1078 | } nx_hostrq_cds_ring_t; | 1061 | } nx_hostrq_cds_ring_t; |
| 1079 | 1062 | ||
| 1080 | typedef struct { | 1063 | typedef struct { |
| 1081 | u64 host_rsp_dma_addr; /* Response dma'd here */ | 1064 | __le64 host_rsp_dma_addr; /* Response dma'd here */ |
| 1082 | u64 cmd_cons_dma_addr; /* */ | 1065 | __le64 cmd_cons_dma_addr; /* */ |
| 1083 | u64 dummy_dma_addr; /* */ | 1066 | __le64 dummy_dma_addr; /* */ |
| 1084 | u32 capabilities[4]; /* Flag bit vector */ | 1067 | __le32 capabilities[4]; /* Flag bit vector */ |
| 1085 | u32 host_int_crb_mode; /* Interrupt crb usage */ | 1068 | __le32 host_int_crb_mode; /* Interrupt crb usage */ |
| 1086 | u32 rsvd1; /* Padding */ | 1069 | __le32 rsvd1; /* Padding */ |
| 1087 | u16 rsvd2; /* Padding */ | 1070 | __le16 rsvd2; /* Padding */ |
| 1088 | u16 interrupt_ctl; | 1071 | __le16 interrupt_ctl; |
| 1089 | u16 msi_index; | 1072 | __le16 msi_index; |
| 1090 | u16 rsvd3; /* Padding */ | 1073 | __le16 rsvd3; /* Padding */ |
| 1091 | nx_hostrq_cds_ring_t cds_ring; /* Desc of cds ring */ | 1074 | nx_hostrq_cds_ring_t cds_ring; /* Desc of cds ring */ |
| 1092 | u8 reserved[128]; /* future expansion */ | 1075 | u8 reserved[128]; /* future expansion */ |
| 1093 | } nx_hostrq_tx_ctx_t; | 1076 | } nx_hostrq_tx_ctx_t; |
| 1094 | 1077 | ||
| 1095 | typedef struct { | 1078 | typedef struct { |
| 1096 | u32 host_producer_crb; /* Crb to use */ | 1079 | __le32 host_producer_crb; /* Crb to use */ |
| 1097 | u32 interrupt_crb; /* Crb to use */ | 1080 | __le32 interrupt_crb; /* Crb to use */ |
| 1098 | } nx_cardrsp_cds_ring_t; | 1081 | } nx_cardrsp_cds_ring_t; |
| 1099 | 1082 | ||
| 1100 | typedef struct { | 1083 | typedef struct { |
| 1101 | u32 host_ctx_state; /* Starting state */ | 1084 | __le32 host_ctx_state; /* Starting state */ |
| 1102 | u16 context_id; /* Handle for context */ | 1085 | __le16 context_id; /* Handle for context */ |
| 1103 | u8 phys_port; /* Physical id of port */ | 1086 | u8 phys_port; /* Physical id of port */ |
| 1104 | u8 virt_port; /* Virtual/Logical id of port */ | 1087 | u8 virt_port; /* Virtual/Logical id of port */ |
| 1105 | nx_cardrsp_cds_ring_t cds_ring; /* Card cds settings */ | 1088 | nx_cardrsp_cds_ring_t cds_ring; /* Card cds settings */ |
| @@ -1202,9 +1185,9 @@ enum { | |||
| 1202 | #define VPORT_MISS_MODE_ACCEPT_MULTI 2 /* accept unmatched multicast */ | 1185 | #define VPORT_MISS_MODE_ACCEPT_MULTI 2 /* accept unmatched multicast */ |
| 1203 | 1186 | ||
| 1204 | typedef struct { | 1187 | typedef struct { |
| 1205 | u64 qhdr; | 1188 | __le64 qhdr; |
| 1206 | u64 req_hdr; | 1189 | __le64 req_hdr; |
| 1207 | u64 words[6]; | 1190 | __le64 words[6]; |
| 1208 | } nx_nic_req_t; | 1191 | } nx_nic_req_t; |
| 1209 | 1192 | ||
| 1210 | typedef struct { | 1193 | typedef struct { |
| @@ -1486,8 +1469,6 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter); | |||
| 1486 | 1469 | ||
| 1487 | void netxen_initialize_adapter_ops(struct netxen_adapter *adapter); | 1470 | void netxen_initialize_adapter_ops(struct netxen_adapter *adapter); |
| 1488 | int netxen_init_firmware(struct netxen_adapter *adapter); | 1471 | int netxen_init_firmware(struct netxen_adapter *adapter); |
| 1489 | void netxen_tso_check(struct netxen_adapter *adapter, | ||
| 1490 | struct cmd_desc_type0 *desc, struct sk_buff *skb); | ||
| 1491 | void netxen_nic_clear_stats(struct netxen_adapter *adapter); | 1472 | void netxen_nic_clear_stats(struct netxen_adapter *adapter); |
| 1492 | void netxen_watchdog_task(struct work_struct *work); | 1473 | void netxen_watchdog_task(struct work_struct *work); |
| 1493 | void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, | 1474 | void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, |
| @@ -1496,6 +1477,7 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter); | |||
| 1496 | u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctx, int max); | 1477 | u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctx, int max); |
| 1497 | void netxen_p2_nic_set_multi(struct net_device *netdev); | 1478 | void netxen_p2_nic_set_multi(struct net_device *netdev); |
| 1498 | void netxen_p3_nic_set_multi(struct net_device *netdev); | 1479 | void netxen_p3_nic_set_multi(struct net_device *netdev); |
| 1480 | void netxen_p3_free_mac_list(struct netxen_adapter *adapter); | ||
| 1499 | int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32); | 1481 | int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32); |
| 1500 | int netxen_config_intr_coalesce(struct netxen_adapter *adapter); | 1482 | int netxen_config_intr_coalesce(struct netxen_adapter *adapter); |
| 1501 | 1483 | ||
diff --git a/drivers/net/netxen/netxen_nic_ctx.c b/drivers/net/netxen/netxen_nic_ctx.c index 64b51643c626..746bdb470418 100644 --- a/drivers/net/netxen/netxen_nic_ctx.c +++ b/drivers/net/netxen/netxen_nic_ctx.c | |||
| @@ -76,7 +76,7 @@ netxen_api_unlock(struct netxen_adapter *adapter) | |||
| 76 | static u32 | 76 | static u32 |
| 77 | netxen_poll_rsp(struct netxen_adapter *adapter) | 77 | netxen_poll_rsp(struct netxen_adapter *adapter) |
| 78 | { | 78 | { |
| 79 | u32 raw_rsp, rsp = NX_CDRP_RSP_OK; | 79 | u32 rsp = NX_CDRP_RSP_OK; |
| 80 | int timeout = 0; | 80 | int timeout = 0; |
| 81 | 81 | ||
| 82 | do { | 82 | do { |
| @@ -86,10 +86,7 @@ netxen_poll_rsp(struct netxen_adapter *adapter) | |||
| 86 | if (++timeout > NX_OS_CRB_RETRY_COUNT) | 86 | if (++timeout > NX_OS_CRB_RETRY_COUNT) |
| 87 | return NX_CDRP_RSP_TIMEOUT; | 87 | return NX_CDRP_RSP_TIMEOUT; |
| 88 | 88 | ||
| 89 | netxen_nic_read_w1(adapter, NX_CDRP_CRB_OFFSET, | 89 | netxen_nic_read_w1(adapter, NX_CDRP_CRB_OFFSET, &rsp); |
| 90 | &raw_rsp); | ||
| 91 | |||
| 92 | rsp = le32_to_cpu(raw_rsp); | ||
| 93 | } while (!NX_CDRP_IS_RSP(rsp)); | 90 | } while (!NX_CDRP_IS_RSP(rsp)); |
| 94 | 91 | ||
| 95 | return rsp; | 92 | return rsp; |
| @@ -109,20 +106,16 @@ netxen_issue_cmd(struct netxen_adapter *adapter, | |||
| 109 | if (netxen_api_lock(adapter)) | 106 | if (netxen_api_lock(adapter)) |
| 110 | return NX_RCODE_TIMEOUT; | 107 | return NX_RCODE_TIMEOUT; |
| 111 | 108 | ||
| 112 | netxen_nic_write_w1(adapter, NX_SIGN_CRB_OFFSET, | 109 | netxen_nic_write_w1(adapter, NX_SIGN_CRB_OFFSET, signature); |
| 113 | cpu_to_le32(signature)); | ||
| 114 | 110 | ||
| 115 | netxen_nic_write_w1(adapter, NX_ARG1_CRB_OFFSET, | 111 | netxen_nic_write_w1(adapter, NX_ARG1_CRB_OFFSET, arg1); |
| 116 | cpu_to_le32(arg1)); | ||
| 117 | 112 | ||
| 118 | netxen_nic_write_w1(adapter, NX_ARG2_CRB_OFFSET, | 113 | netxen_nic_write_w1(adapter, NX_ARG2_CRB_OFFSET, arg2); |
| 119 | cpu_to_le32(arg2)); | ||
| 120 | 114 | ||
| 121 | netxen_nic_write_w1(adapter, NX_ARG3_CRB_OFFSET, | 115 | netxen_nic_write_w1(adapter, NX_ARG3_CRB_OFFSET, arg3); |
| 122 | cpu_to_le32(arg3)); | ||
| 123 | 116 | ||
| 124 | netxen_nic_write_w1(adapter, NX_CDRP_CRB_OFFSET, | 117 | netxen_nic_write_w1(adapter, NX_CDRP_CRB_OFFSET, |
| 125 | cpu_to_le32(NX_CDRP_FORM_CMD(cmd))); | 118 | NX_CDRP_FORM_CMD(cmd)); |
| 126 | 119 | ||
| 127 | rsp = netxen_poll_rsp(adapter); | 120 | rsp = netxen_poll_rsp(adapter); |
| 128 | 121 | ||
| @@ -133,7 +126,6 @@ netxen_issue_cmd(struct netxen_adapter *adapter, | |||
| 133 | rcode = NX_RCODE_TIMEOUT; | 126 | rcode = NX_RCODE_TIMEOUT; |
| 134 | } else if (rsp == NX_CDRP_RSP_FAIL) { | 127 | } else if (rsp == NX_CDRP_RSP_FAIL) { |
| 135 | netxen_nic_read_w1(adapter, NX_ARG1_CRB_OFFSET, &rcode); | 128 | netxen_nic_read_w1(adapter, NX_ARG1_CRB_OFFSET, &rcode); |
| 136 | rcode = le32_to_cpu(rcode); | ||
| 137 | 129 | ||
| 138 | printk(KERN_ERR "%s: failed card response code:0x%x\n", | 130 | printk(KERN_ERR "%s: failed card response code:0x%x\n", |
| 139 | netxen_nic_driver_name, rcode); | 131 | netxen_nic_driver_name, rcode); |
| @@ -183,7 +175,7 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
| 183 | 175 | ||
| 184 | int i, nrds_rings, nsds_rings; | 176 | int i, nrds_rings, nsds_rings; |
| 185 | size_t rq_size, rsp_size; | 177 | size_t rq_size, rsp_size; |
| 186 | u32 cap, reg; | 178 | u32 cap, reg, val; |
| 187 | 179 | ||
| 188 | int err; | 180 | int err; |
| 189 | 181 | ||
| @@ -225,11 +217,14 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
| 225 | 217 | ||
| 226 | prq->num_rds_rings = cpu_to_le16(nrds_rings); | 218 | prq->num_rds_rings = cpu_to_le16(nrds_rings); |
| 227 | prq->num_sds_rings = cpu_to_le16(nsds_rings); | 219 | prq->num_sds_rings = cpu_to_le16(nsds_rings); |
| 228 | prq->rds_ring_offset = 0; | 220 | prq->rds_ring_offset = cpu_to_le32(0); |
| 229 | prq->sds_ring_offset = prq->rds_ring_offset + | 221 | |
| 222 | val = le32_to_cpu(prq->rds_ring_offset) + | ||
| 230 | (sizeof(nx_hostrq_rds_ring_t) * nrds_rings); | 223 | (sizeof(nx_hostrq_rds_ring_t) * nrds_rings); |
| 224 | prq->sds_ring_offset = cpu_to_le32(val); | ||
| 231 | 225 | ||
| 232 | prq_rds = (nx_hostrq_rds_ring_t *)(prq->data + prq->rds_ring_offset); | 226 | prq_rds = (nx_hostrq_rds_ring_t *)(prq->data + |
| 227 | le32_to_cpu(prq->rds_ring_offset)); | ||
| 233 | 228 | ||
| 234 | for (i = 0; i < nrds_rings; i++) { | 229 | for (i = 0; i < nrds_rings; i++) { |
| 235 | 230 | ||
| @@ -241,17 +236,14 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
| 241 | prq_rds[i].buff_size = cpu_to_le64(rds_ring->dma_size); | 236 | prq_rds[i].buff_size = cpu_to_le64(rds_ring->dma_size); |
| 242 | } | 237 | } |
| 243 | 238 | ||
| 244 | prq_sds = (nx_hostrq_sds_ring_t *)(prq->data + prq->sds_ring_offset); | 239 | prq_sds = (nx_hostrq_sds_ring_t *)(prq->data + |
| 240 | le32_to_cpu(prq->sds_ring_offset)); | ||
| 245 | 241 | ||
| 246 | prq_sds[0].host_phys_addr = | 242 | prq_sds[0].host_phys_addr = |
| 247 | cpu_to_le64(recv_ctx->rcv_status_desc_phys_addr); | 243 | cpu_to_le64(recv_ctx->rcv_status_desc_phys_addr); |
| 248 | prq_sds[0].ring_size = cpu_to_le32(adapter->max_rx_desc_count); | 244 | prq_sds[0].ring_size = cpu_to_le32(adapter->max_rx_desc_count); |
| 249 | /* only one msix vector for now */ | 245 | /* only one msix vector for now */ |
| 250 | prq_sds[0].msi_index = cpu_to_le32(0); | 246 | prq_sds[0].msi_index = cpu_to_le16(0); |
| 251 | |||
| 252 | /* now byteswap offsets */ | ||
| 253 | prq->rds_ring_offset = cpu_to_le32(prq->rds_ring_offset); | ||
| 254 | prq->sds_ring_offset = cpu_to_le32(prq->sds_ring_offset); | ||
| 255 | 247 | ||
| 256 | phys_addr = hostrq_phys_addr; | 248 | phys_addr = hostrq_phys_addr; |
| 257 | err = netxen_issue_cmd(adapter, | 249 | err = netxen_issue_cmd(adapter, |
| @@ -269,9 +261,9 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
| 269 | 261 | ||
| 270 | 262 | ||
| 271 | prsp_rds = ((nx_cardrsp_rds_ring_t *) | 263 | prsp_rds = ((nx_cardrsp_rds_ring_t *) |
| 272 | &prsp->data[prsp->rds_ring_offset]); | 264 | &prsp->data[le32_to_cpu(prsp->rds_ring_offset)]); |
| 273 | 265 | ||
| 274 | for (i = 0; i < le32_to_cpu(prsp->num_rds_rings); i++) { | 266 | for (i = 0; i < le16_to_cpu(prsp->num_rds_rings); i++) { |
| 275 | rds_ring = &recv_ctx->rds_rings[i]; | 267 | rds_ring = &recv_ctx->rds_rings[i]; |
| 276 | 268 | ||
| 277 | reg = le32_to_cpu(prsp_rds[i].host_producer_crb); | 269 | reg = le32_to_cpu(prsp_rds[i].host_producer_crb); |
| @@ -279,7 +271,7 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
| 279 | } | 271 | } |
| 280 | 272 | ||
| 281 | prsp_sds = ((nx_cardrsp_sds_ring_t *) | 273 | prsp_sds = ((nx_cardrsp_sds_ring_t *) |
| 282 | &prsp->data[prsp->sds_ring_offset]); | 274 | &prsp->data[le32_to_cpu(prsp->sds_ring_offset)]); |
| 283 | reg = le32_to_cpu(prsp_sds[0].host_consumer_crb); | 275 | reg = le32_to_cpu(prsp_sds[0].host_consumer_crb); |
| 284 | recv_ctx->crb_sts_consumer = NETXEN_NIC_REG(reg - 0x200); | 276 | recv_ctx->crb_sts_consumer = NETXEN_NIC_REG(reg - 0x200); |
| 285 | 277 | ||
| @@ -288,7 +280,7 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
| 288 | 280 | ||
| 289 | recv_ctx->state = le32_to_cpu(prsp->host_ctx_state); | 281 | recv_ctx->state = le32_to_cpu(prsp->host_ctx_state); |
| 290 | recv_ctx->context_id = le16_to_cpu(prsp->context_id); | 282 | recv_ctx->context_id = le16_to_cpu(prsp->context_id); |
| 291 | recv_ctx->virt_port = le16_to_cpu(prsp->virt_port); | 283 | recv_ctx->virt_port = prsp->virt_port; |
| 292 | 284 | ||
| 293 | out_free_rsp: | 285 | out_free_rsp: |
| 294 | pci_free_consistent(adapter->pdev, rsp_size, prsp, cardrsp_phys_addr); | 286 | pci_free_consistent(adapter->pdev, rsp_size, prsp, cardrsp_phys_addr); |
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index e45ce2951729..c0bd40fcf708 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
| @@ -136,11 +136,9 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
| 136 | 136 | ||
| 137 | ecmd->port = PORT_TP; | 137 | ecmd->port = PORT_TP; |
| 138 | 138 | ||
| 139 | if (netif_running(dev)) { | 139 | ecmd->speed = adapter->link_speed; |
| 140 | ecmd->speed = adapter->link_speed; | 140 | ecmd->duplex = adapter->link_duplex; |
| 141 | ecmd->duplex = adapter->link_duplex; | 141 | ecmd->autoneg = adapter->link_autoneg; |
| 142 | ecmd->autoneg = adapter->link_autoneg; | ||
| 143 | } | ||
| 144 | 142 | ||
| 145 | } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { | 143 | } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { |
| 146 | u32 val; | 144 | u32 val; |
| @@ -171,7 +169,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
| 171 | } else | 169 | } else |
| 172 | return -EIO; | 170 | return -EIO; |
| 173 | 171 | ||
| 174 | ecmd->phy_address = adapter->portnum; | 172 | ecmd->phy_address = adapter->physical_port; |
| 175 | ecmd->transceiver = XCVR_EXTERNAL; | 173 | ecmd->transceiver = XCVR_EXTERNAL; |
| 176 | 174 | ||
| 177 | switch ((netxen_brdtype_t) boardinfo->board_type) { | 175 | switch ((netxen_brdtype_t) boardinfo->board_type) { |
| @@ -180,13 +178,13 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
| 180 | case NETXEN_BRDTYPE_P3_REF_QG: | 178 | case NETXEN_BRDTYPE_P3_REF_QG: |
| 181 | case NETXEN_BRDTYPE_P3_4_GB: | 179 | case NETXEN_BRDTYPE_P3_4_GB: |
| 182 | case NETXEN_BRDTYPE_P3_4_GB_MM: | 180 | case NETXEN_BRDTYPE_P3_4_GB_MM: |
| 183 | case NETXEN_BRDTYPE_P3_10000_BASE_T: | ||
| 184 | 181 | ||
| 185 | ecmd->supported |= SUPPORTED_Autoneg; | 182 | ecmd->supported |= SUPPORTED_Autoneg; |
| 186 | ecmd->advertising |= ADVERTISED_Autoneg; | 183 | ecmd->advertising |= ADVERTISED_Autoneg; |
| 187 | case NETXEN_BRDTYPE_P2_SB31_10G_CX4: | 184 | case NETXEN_BRDTYPE_P2_SB31_10G_CX4: |
| 188 | case NETXEN_BRDTYPE_P3_10G_CX4: | 185 | case NETXEN_BRDTYPE_P3_10G_CX4: |
| 189 | case NETXEN_BRDTYPE_P3_10G_CX4_LP: | 186 | case NETXEN_BRDTYPE_P3_10G_CX4_LP: |
| 187 | case NETXEN_BRDTYPE_P3_10000_BASE_T: | ||
| 190 | ecmd->supported |= SUPPORTED_TP; | 188 | ecmd->supported |= SUPPORTED_TP; |
| 191 | ecmd->advertising |= ADVERTISED_TP; | 189 | ecmd->advertising |= ADVERTISED_TP; |
| 192 | ecmd->port = PORT_TP; | 190 | ecmd->port = PORT_TP; |
| @@ -204,16 +202,33 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
| 204 | ecmd->port = PORT_FIBRE; | 202 | ecmd->port = PORT_FIBRE; |
| 205 | ecmd->autoneg = AUTONEG_DISABLE; | 203 | ecmd->autoneg = AUTONEG_DISABLE; |
| 206 | break; | 204 | break; |
| 207 | case NETXEN_BRDTYPE_P2_SB31_10G: | ||
| 208 | case NETXEN_BRDTYPE_P3_10G_SFP_PLUS: | 205 | case NETXEN_BRDTYPE_P3_10G_SFP_PLUS: |
| 209 | case NETXEN_BRDTYPE_P3_10G_SFP_CT: | 206 | case NETXEN_BRDTYPE_P3_10G_SFP_CT: |
| 210 | case NETXEN_BRDTYPE_P3_10G_SFP_QT: | 207 | case NETXEN_BRDTYPE_P3_10G_SFP_QT: |
| 208 | ecmd->advertising |= ADVERTISED_TP; | ||
| 209 | ecmd->supported |= SUPPORTED_TP; | ||
| 210 | case NETXEN_BRDTYPE_P2_SB31_10G: | ||
| 211 | case NETXEN_BRDTYPE_P3_10G_XFP: | 211 | case NETXEN_BRDTYPE_P3_10G_XFP: |
| 212 | ecmd->supported |= SUPPORTED_FIBRE; | 212 | ecmd->supported |= SUPPORTED_FIBRE; |
| 213 | ecmd->advertising |= ADVERTISED_FIBRE; | 213 | ecmd->advertising |= ADVERTISED_FIBRE; |
| 214 | ecmd->port = PORT_FIBRE; | 214 | ecmd->port = PORT_FIBRE; |
| 215 | ecmd->autoneg = AUTONEG_DISABLE; | 215 | ecmd->autoneg = AUTONEG_DISABLE; |
| 216 | break; | 216 | break; |
| 217 | case NETXEN_BRDTYPE_P3_10G_TP: | ||
| 218 | if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { | ||
| 219 | ecmd->autoneg = AUTONEG_DISABLE; | ||
| 220 | ecmd->supported |= (SUPPORTED_FIBRE | SUPPORTED_TP); | ||
| 221 | ecmd->advertising |= | ||
| 222 | (ADVERTISED_FIBRE | ADVERTISED_TP); | ||
| 223 | ecmd->port = PORT_FIBRE; | ||
| 224 | } else { | ||
| 225 | ecmd->autoneg = AUTONEG_ENABLE; | ||
| 226 | ecmd->supported |= (SUPPORTED_TP |SUPPORTED_Autoneg); | ||
| 227 | ecmd->advertising |= | ||
| 228 | (ADVERTISED_TP | ADVERTISED_Autoneg); | ||
| 229 | ecmd->port = PORT_TP; | ||
| 230 | } | ||
| 231 | break; | ||
| 217 | default: | 232 | default: |
| 218 | printk(KERN_ERR "netxen-nic: Unsupported board model %d\n", | 233 | printk(KERN_ERR "netxen-nic: Unsupported board model %d\n", |
| 219 | (netxen_brdtype_t) boardinfo->board_type); | 234 | (netxen_brdtype_t) boardinfo->board_type); |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index aa6e603bfcbf..821cff68b3f3 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
| @@ -503,17 +503,15 @@ netxen_send_cmd_descs(struct netxen_adapter *adapter, | |||
| 503 | 503 | ||
| 504 | i = 0; | 504 | i = 0; |
| 505 | 505 | ||
| 506 | netif_tx_lock_bh(adapter->netdev); | ||
| 507 | |||
| 506 | producer = adapter->cmd_producer; | 508 | producer = adapter->cmd_producer; |
| 507 | do { | 509 | do { |
| 508 | cmd_desc = &cmd_desc_arr[i]; | 510 | cmd_desc = &cmd_desc_arr[i]; |
| 509 | 511 | ||
| 510 | pbuf = &adapter->cmd_buf_arr[producer]; | 512 | pbuf = &adapter->cmd_buf_arr[producer]; |
| 511 | pbuf->mss = 0; | ||
| 512 | pbuf->total_length = 0; | ||
| 513 | pbuf->skb = NULL; | 513 | pbuf->skb = NULL; |
| 514 | pbuf->cmd = 0; | ||
| 515 | pbuf->frag_count = 0; | 514 | pbuf->frag_count = 0; |
| 516 | pbuf->port = 0; | ||
| 517 | 515 | ||
| 518 | /* adapter->ahw.cmd_desc_head[producer] = *cmd_desc; */ | 516 | /* adapter->ahw.cmd_desc_head[producer] = *cmd_desc; */ |
| 519 | memcpy(&adapter->ahw.cmd_desc_head[producer], | 517 | memcpy(&adapter->ahw.cmd_desc_head[producer], |
| @@ -531,6 +529,8 @@ netxen_send_cmd_descs(struct netxen_adapter *adapter, | |||
| 531 | 529 | ||
| 532 | netxen_nic_update_cmd_producer(adapter, adapter->cmd_producer); | 530 | netxen_nic_update_cmd_producer(adapter, adapter->cmd_producer); |
| 533 | 531 | ||
| 532 | netif_tx_unlock_bh(adapter->netdev); | ||
| 533 | |||
| 534 | return 0; | 534 | return 0; |
| 535 | } | 535 | } |
| 536 | 536 | ||
| @@ -539,16 +539,19 @@ static int nx_p3_sre_macaddr_change(struct net_device *dev, | |||
| 539 | { | 539 | { |
| 540 | struct netxen_adapter *adapter = netdev_priv(dev); | 540 | struct netxen_adapter *adapter = netdev_priv(dev); |
| 541 | nx_nic_req_t req; | 541 | nx_nic_req_t req; |
| 542 | nx_mac_req_t mac_req; | 542 | nx_mac_req_t *mac_req; |
| 543 | u64 word; | ||
| 543 | int rv; | 544 | int rv; |
| 544 | 545 | ||
| 545 | memset(&req, 0, sizeof(nx_nic_req_t)); | 546 | memset(&req, 0, sizeof(nx_nic_req_t)); |
| 546 | req.qhdr |= (NX_NIC_REQUEST << 23); | 547 | req.qhdr = cpu_to_le64(NX_NIC_REQUEST << 23); |
| 547 | req.req_hdr |= NX_MAC_EVENT; | 548 | |
| 548 | req.req_hdr |= ((u64)adapter->portnum << 16); | 549 | word = NX_MAC_EVENT | ((u64)adapter->portnum << 16); |
| 549 | mac_req.op = op; | 550 | req.req_hdr = cpu_to_le64(word); |
| 550 | memcpy(&mac_req.mac_addr, addr, 6); | 551 | |
| 551 | req.words[0] = cpu_to_le64(*(u64 *)&mac_req); | 552 | mac_req = (nx_mac_req_t *)&req.words[0]; |
| 553 | mac_req->op = op; | ||
| 554 | memcpy(mac_req->mac_addr, addr, 6); | ||
| 552 | 555 | ||
| 553 | rv = netxen_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1); | 556 | rv = netxen_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1); |
| 554 | if (rv != 0) { | 557 | if (rv != 0) { |
| @@ -612,18 +615,35 @@ send_fw_cmd: | |||
| 612 | int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) | 615 | int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) |
| 613 | { | 616 | { |
| 614 | nx_nic_req_t req; | 617 | nx_nic_req_t req; |
| 618 | u64 word; | ||
| 615 | 619 | ||
| 616 | memset(&req, 0, sizeof(nx_nic_req_t)); | 620 | memset(&req, 0, sizeof(nx_nic_req_t)); |
| 617 | 621 | ||
| 618 | req.qhdr |= (NX_HOST_REQUEST << 23); | 622 | req.qhdr = cpu_to_le64(NX_HOST_REQUEST << 23); |
| 619 | req.req_hdr |= NX_NIC_H2C_OPCODE_PROXY_SET_VPORT_MISS_MODE; | 623 | |
| 620 | req.req_hdr |= ((u64)adapter->portnum << 16); | 624 | word = NX_NIC_H2C_OPCODE_PROXY_SET_VPORT_MISS_MODE | |
| 625 | ((u64)adapter->portnum << 16); | ||
| 626 | req.req_hdr = cpu_to_le64(word); | ||
| 627 | |||
| 621 | req.words[0] = cpu_to_le64(mode); | 628 | req.words[0] = cpu_to_le64(mode); |
| 622 | 629 | ||
| 623 | return netxen_send_cmd_descs(adapter, | 630 | return netxen_send_cmd_descs(adapter, |
| 624 | (struct cmd_desc_type0 *)&req, 1); | 631 | (struct cmd_desc_type0 *)&req, 1); |
| 625 | } | 632 | } |
| 626 | 633 | ||
| 634 | void netxen_p3_free_mac_list(struct netxen_adapter *adapter) | ||
| 635 | { | ||
| 636 | nx_mac_list_t *cur, *next; | ||
| 637 | |||
| 638 | cur = adapter->mac_list; | ||
| 639 | |||
| 640 | while (cur) { | ||
| 641 | next = cur->next; | ||
| 642 | kfree(cur); | ||
| 643 | cur = next; | ||
| 644 | } | ||
| 645 | } | ||
| 646 | |||
| 627 | #define NETXEN_CONFIG_INTR_COALESCE 3 | 647 | #define NETXEN_CONFIG_INTR_COALESCE 3 |
| 628 | 648 | ||
| 629 | /* | 649 | /* |
| @@ -632,13 +652,15 @@ int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) | |||
| 632 | int netxen_config_intr_coalesce(struct netxen_adapter *adapter) | 652 | int netxen_config_intr_coalesce(struct netxen_adapter *adapter) |
| 633 | { | 653 | { |
| 634 | nx_nic_req_t req; | 654 | nx_nic_req_t req; |
| 655 | u64 word; | ||
| 635 | int rv; | 656 | int rv; |
| 636 | 657 | ||
| 637 | memset(&req, 0, sizeof(nx_nic_req_t)); | 658 | memset(&req, 0, sizeof(nx_nic_req_t)); |
| 638 | 659 | ||
| 639 | req.qhdr |= (NX_NIC_REQUEST << 23); | 660 | req.qhdr = cpu_to_le64(NX_NIC_REQUEST << 23); |
| 640 | req.req_hdr |= NETXEN_CONFIG_INTR_COALESCE; | 661 | |
| 641 | req.req_hdr |= ((u64)adapter->portnum << 16); | 662 | word = NETXEN_CONFIG_INTR_COALESCE | ((u64)adapter->portnum << 16); |
| 663 | req.req_hdr = cpu_to_le64(word); | ||
| 642 | 664 | ||
| 643 | memcpy(&req.words[0], &adapter->coal, sizeof(adapter->coal)); | 665 | memcpy(&req.words[0], &adapter->coal, sizeof(adapter->coal)); |
| 644 | 666 | ||
| @@ -772,13 +794,10 @@ int netxen_p3_get_mac_addr(struct netxen_adapter *adapter, __le64 *mac) | |||
| 772 | adapter->hw_read_wx(adapter, crbaddr, &mac_lo, 4); | 794 | adapter->hw_read_wx(adapter, crbaddr, &mac_lo, 4); |
| 773 | adapter->hw_read_wx(adapter, crbaddr+4, &mac_hi, 4); | 795 | adapter->hw_read_wx(adapter, crbaddr+4, &mac_hi, 4); |
| 774 | 796 | ||
| 775 | mac_hi = cpu_to_le32(mac_hi); | ||
| 776 | mac_lo = cpu_to_le32(mac_lo); | ||
| 777 | |||
| 778 | if (pci_func & 1) | 797 | if (pci_func & 1) |
| 779 | *mac = ((mac_lo >> 16) | ((u64)mac_hi << 16)); | 798 | *mac = le64_to_cpu((mac_lo >> 16) | ((u64)mac_hi << 16)); |
| 780 | else | 799 | else |
| 781 | *mac = ((mac_lo) | ((u64)mac_hi << 32)); | 800 | *mac = le64_to_cpu((u64)mac_lo | ((u64)mac_hi << 32)); |
| 782 | 801 | ||
| 783 | return 0; | 802 | return 0; |
| 784 | } | 803 | } |
| @@ -937,7 +956,7 @@ int netxen_load_firmware(struct netxen_adapter *adapter) | |||
| 937 | { | 956 | { |
| 938 | int i; | 957 | int i; |
| 939 | u32 data, size = 0; | 958 | u32 data, size = 0; |
| 940 | u32 flashaddr = NETXEN_BOOTLD_START, memaddr = NETXEN_BOOTLD_START; | 959 | u32 flashaddr = NETXEN_BOOTLD_START; |
| 941 | 960 | ||
| 942 | size = (NETXEN_IMAGE_START - NETXEN_BOOTLD_START)/4; | 961 | size = (NETXEN_IMAGE_START - NETXEN_BOOTLD_START)/4; |
| 943 | 962 | ||
| @@ -949,10 +968,8 @@ int netxen_load_firmware(struct netxen_adapter *adapter) | |||
| 949 | if (netxen_rom_fast_read(adapter, flashaddr, (int *)&data) != 0) | 968 | if (netxen_rom_fast_read(adapter, flashaddr, (int *)&data) != 0) |
| 950 | return -EIO; | 969 | return -EIO; |
| 951 | 970 | ||
| 952 | adapter->pci_mem_write(adapter, memaddr, &data, 4); | 971 | adapter->pci_mem_write(adapter, flashaddr, &data, 4); |
| 953 | flashaddr += 4; | 972 | flashaddr += 4; |
| 954 | memaddr += 4; | ||
| 955 | cond_resched(); | ||
| 956 | } | 973 | } |
| 957 | msleep(1); | 974 | msleep(1); |
| 958 | 975 | ||
| @@ -2034,7 +2051,13 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter) | |||
| 2034 | rv = -1; | 2051 | rv = -1; |
| 2035 | } | 2052 | } |
| 2036 | 2053 | ||
| 2037 | DPRINTK(INFO, "Discovered board type:0x%x ", boardinfo->board_type); | 2054 | if (boardinfo->board_type == NETXEN_BRDTYPE_P3_4_GB_MM) { |
| 2055 | u32 gpio = netxen_nic_reg_read(adapter, | ||
| 2056 | NETXEN_ROMUSB_GLB_PAD_GPIO_I); | ||
| 2057 | if ((gpio & 0x8000) == 0) | ||
| 2058 | boardinfo->board_type = NETXEN_BRDTYPE_P3_10G_TP; | ||
| 2059 | } | ||
| 2060 | |||
| 2038 | switch ((netxen_brdtype_t) boardinfo->board_type) { | 2061 | switch ((netxen_brdtype_t) boardinfo->board_type) { |
| 2039 | case NETXEN_BRDTYPE_P2_SB35_4G: | 2062 | case NETXEN_BRDTYPE_P2_SB35_4G: |
| 2040 | adapter->ahw.board_type = NETXEN_NIC_GBE; | 2063 | adapter->ahw.board_type = NETXEN_NIC_GBE; |
| @@ -2053,7 +2076,6 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter) | |||
| 2053 | case NETXEN_BRDTYPE_P3_10G_SFP_QT: | 2076 | case NETXEN_BRDTYPE_P3_10G_SFP_QT: |
| 2054 | case NETXEN_BRDTYPE_P3_10G_XFP: | 2077 | case NETXEN_BRDTYPE_P3_10G_XFP: |
| 2055 | case NETXEN_BRDTYPE_P3_10000_BASE_T: | 2078 | case NETXEN_BRDTYPE_P3_10000_BASE_T: |
| 2056 | |||
| 2057 | adapter->ahw.board_type = NETXEN_NIC_XGBE; | 2079 | adapter->ahw.board_type = NETXEN_NIC_XGBE; |
| 2058 | break; | 2080 | break; |
| 2059 | case NETXEN_BRDTYPE_P1_BD: | 2081 | case NETXEN_BRDTYPE_P1_BD: |
| @@ -2063,9 +2085,12 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter) | |||
| 2063 | case NETXEN_BRDTYPE_P3_REF_QG: | 2085 | case NETXEN_BRDTYPE_P3_REF_QG: |
| 2064 | case NETXEN_BRDTYPE_P3_4_GB: | 2086 | case NETXEN_BRDTYPE_P3_4_GB: |
| 2065 | case NETXEN_BRDTYPE_P3_4_GB_MM: | 2087 | case NETXEN_BRDTYPE_P3_4_GB_MM: |
| 2066 | |||
| 2067 | adapter->ahw.board_type = NETXEN_NIC_GBE; | 2088 | adapter->ahw.board_type = NETXEN_NIC_GBE; |
| 2068 | break; | 2089 | break; |
| 2090 | case NETXEN_BRDTYPE_P3_10G_TP: | ||
| 2091 | adapter->ahw.board_type = (adapter->portnum < 2) ? | ||
| 2092 | NETXEN_NIC_XGBE : NETXEN_NIC_GBE; | ||
| 2093 | break; | ||
| 2069 | default: | 2094 | default: |
| 2070 | printk("%s: Unknown(%x)\n", netxen_nic_driver_name, | 2095 | printk("%s: Unknown(%x)\n", netxen_nic_driver_name, |
| 2071 | boardinfo->board_type); | 2096 | boardinfo->board_type); |
| @@ -2110,12 +2135,16 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter) | |||
| 2110 | { | 2135 | { |
| 2111 | __u32 status; | 2136 | __u32 status; |
| 2112 | __u32 autoneg; | 2137 | __u32 autoneg; |
| 2113 | __u32 mode; | ||
| 2114 | __u32 port_mode; | 2138 | __u32 port_mode; |
| 2115 | 2139 | ||
| 2116 | netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode); | 2140 | if (!netif_carrier_ok(adapter->netdev)) { |
| 2117 | if (netxen_get_niu_enable_ge(mode)) { /* Gb 10/100/1000 Mbps mode */ | 2141 | adapter->link_speed = 0; |
| 2142 | adapter->link_duplex = -1; | ||
| 2143 | adapter->link_autoneg = AUTONEG_ENABLE; | ||
| 2144 | return; | ||
| 2145 | } | ||
| 2118 | 2146 | ||
| 2147 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { | ||
| 2119 | adapter->hw_read_wx(adapter, | 2148 | adapter->hw_read_wx(adapter, |
| 2120 | NETXEN_PORT_MODE_ADDR, &port_mode, 4); | 2149 | NETXEN_PORT_MODE_ADDR, &port_mode, 4); |
| 2121 | if (port_mode == NETXEN_PORT_MODE_802_3_AP) { | 2150 | if (port_mode == NETXEN_PORT_MODE_802_3_AP) { |
| @@ -2141,7 +2170,7 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter) | |||
| 2141 | adapter->link_speed = SPEED_1000; | 2170 | adapter->link_speed = SPEED_1000; |
| 2142 | break; | 2171 | break; |
| 2143 | default: | 2172 | default: |
| 2144 | adapter->link_speed = -1; | 2173 | adapter->link_speed = 0; |
| 2145 | break; | 2174 | break; |
| 2146 | } | 2175 | } |
| 2147 | switch (netxen_get_phy_duplex(status)) { | 2176 | switch (netxen_get_phy_duplex(status)) { |
| @@ -2164,7 +2193,7 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter) | |||
| 2164 | goto link_down; | 2193 | goto link_down; |
| 2165 | } else { | 2194 | } else { |
| 2166 | link_down: | 2195 | link_down: |
| 2167 | adapter->link_speed = -1; | 2196 | adapter->link_speed = 0; |
| 2168 | adapter->link_duplex = -1; | 2197 | adapter->link_duplex = -1; |
| 2169 | } | 2198 | } |
| 2170 | } | 2199 | } |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index d924468e506e..ca7c8d8050c9 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
| @@ -308,7 +308,6 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter) | |||
| 308 | } | 308 | } |
| 309 | memset(rds_ring->rx_buf_arr, 0, RCV_BUFFSIZE); | 309 | memset(rds_ring->rx_buf_arr, 0, RCV_BUFFSIZE); |
| 310 | INIT_LIST_HEAD(&rds_ring->free_list); | 310 | INIT_LIST_HEAD(&rds_ring->free_list); |
| 311 | rds_ring->begin_alloc = 0; | ||
| 312 | /* | 311 | /* |
| 313 | * Now go through all of them, set reference handles | 312 | * Now go through all of them, set reference handles |
| 314 | * and put them in the queues. | 313 | * and put them in the queues. |
| @@ -439,6 +438,8 @@ static int netxen_wait_rom_done(struct netxen_adapter *adapter) | |||
| 439 | long timeout = 0; | 438 | long timeout = 0; |
| 440 | long done = 0; | 439 | long done = 0; |
| 441 | 440 | ||
| 441 | cond_resched(); | ||
| 442 | |||
| 442 | while (done == 0) { | 443 | while (done == 0) { |
| 443 | done = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_GLB_STATUS); | 444 | done = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_GLB_STATUS); |
| 444 | done &= 2; | 445 | done &= 2; |
| @@ -533,12 +534,9 @@ static int do_rom_fast_write(struct netxen_adapter *adapter, int addr, | |||
| 533 | static int do_rom_fast_read(struct netxen_adapter *adapter, | 534 | static int do_rom_fast_read(struct netxen_adapter *adapter, |
| 534 | int addr, int *valp) | 535 | int addr, int *valp) |
| 535 | { | 536 | { |
| 536 | cond_resched(); | ||
| 537 | |||
| 538 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr); | 537 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr); |
| 539 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3); | ||
| 540 | udelay(100); /* prevent bursting on CRB */ | ||
| 541 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); | 538 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); |
| 539 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3); | ||
| 542 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb); | 540 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb); |
| 543 | if (netxen_wait_rom_done(adapter)) { | 541 | if (netxen_wait_rom_done(adapter)) { |
| 544 | printk("Error waiting for rom done\n"); | 542 | printk("Error waiting for rom done\n"); |
| @@ -546,7 +544,7 @@ static int do_rom_fast_read(struct netxen_adapter *adapter, | |||
| 546 | } | 544 | } |
| 547 | /* reset abyte_cnt and dummy_byte_cnt */ | 545 | /* reset abyte_cnt and dummy_byte_cnt */ |
| 548 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0); | 546 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0); |
| 549 | udelay(100); /* prevent bursting on CRB */ | 547 | udelay(10); |
| 550 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); | 548 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); |
| 551 | 549 | ||
| 552 | *valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA); | 550 | *valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA); |
| @@ -884,14 +882,16 @@ int netxen_flash_unlock(struct netxen_adapter *adapter) | |||
| 884 | int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | 882 | int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) |
| 885 | { | 883 | { |
| 886 | int addr, val; | 884 | int addr, val; |
| 887 | int i, init_delay = 0; | 885 | int i, n, init_delay = 0; |
| 888 | struct crb_addr_pair *buf; | 886 | struct crb_addr_pair *buf; |
| 889 | unsigned offset, n; | 887 | unsigned offset; |
| 890 | u32 off; | 888 | u32 off; |
| 891 | 889 | ||
| 892 | /* resetall */ | 890 | /* resetall */ |
| 891 | rom_lock(adapter); | ||
| 893 | netxen_crb_writelit_adapter(adapter, NETXEN_ROMUSB_GLB_SW_RESET, | 892 | netxen_crb_writelit_adapter(adapter, NETXEN_ROMUSB_GLB_SW_RESET, |
| 894 | 0xffffffff); | 893 | 0xffffffff); |
| 894 | netxen_rom_unlock(adapter); | ||
| 895 | 895 | ||
| 896 | if (verbose) { | 896 | if (verbose) { |
| 897 | if (netxen_rom_fast_read(adapter, NETXEN_BOARDTYPE, &val) == 0) | 897 | if (netxen_rom_fast_read(adapter, NETXEN_BOARDTYPE, &val) == 0) |
| @@ -910,7 +910,7 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
| 910 | 910 | ||
| 911 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { | 911 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { |
| 912 | if (netxen_rom_fast_read(adapter, 0, &n) != 0 || | 912 | if (netxen_rom_fast_read(adapter, 0, &n) != 0 || |
| 913 | (n != 0xcafecafeUL) || | 913 | (n != 0xcafecafe) || |
| 914 | netxen_rom_fast_read(adapter, 4, &n) != 0) { | 914 | netxen_rom_fast_read(adapter, 4, &n) != 0) { |
| 915 | printk(KERN_ERR "%s: ERROR Reading crb_init area: " | 915 | printk(KERN_ERR "%s: ERROR Reading crb_init area: " |
| 916 | "n: %08x\n", netxen_nic_driver_name, n); | 916 | "n: %08x\n", netxen_nic_driver_name, n); |
| @@ -975,6 +975,14 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
| 975 | /* do not reset PCI */ | 975 | /* do not reset PCI */ |
| 976 | if (off == (ROMUSB_GLB + 0xbc)) | 976 | if (off == (ROMUSB_GLB + 0xbc)) |
| 977 | continue; | 977 | continue; |
| 978 | if (off == (ROMUSB_GLB + 0xa8)) | ||
| 979 | continue; | ||
| 980 | if (off == (ROMUSB_GLB + 0xc8)) /* core clock */ | ||
| 981 | continue; | ||
| 982 | if (off == (ROMUSB_GLB + 0x24)) /* MN clock */ | ||
| 983 | continue; | ||
| 984 | if (off == (ROMUSB_GLB + 0x1c)) /* MS clock */ | ||
| 985 | continue; | ||
| 978 | if (off == (NETXEN_CRB_PEG_NET_1 + 0x18)) | 986 | if (off == (NETXEN_CRB_PEG_NET_1 + 0x18)) |
| 979 | buf[i].data = 0x1020; | 987 | buf[i].data = 0x1020; |
| 980 | /* skip the function enable register */ | 988 | /* skip the function enable register */ |
| @@ -992,23 +1000,21 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
| 992 | continue; | 1000 | continue; |
| 993 | } | 1001 | } |
| 994 | 1002 | ||
| 1003 | init_delay = 1; | ||
| 995 | /* After writing this register, HW needs time for CRB */ | 1004 | /* After writing this register, HW needs time for CRB */ |
| 996 | /* to quiet down (else crb_window returns 0xffffffff) */ | 1005 | /* to quiet down (else crb_window returns 0xffffffff) */ |
| 997 | if (off == NETXEN_ROMUSB_GLB_SW_RESET) { | 1006 | if (off == NETXEN_ROMUSB_GLB_SW_RESET) { |
| 998 | init_delay = 1; | 1007 | init_delay = 1000; |
| 999 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | 1008 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { |
| 1000 | /* hold xdma in reset also */ | 1009 | /* hold xdma in reset also */ |
| 1001 | buf[i].data = NETXEN_NIC_XDMA_RESET; | 1010 | buf[i].data = NETXEN_NIC_XDMA_RESET; |
| 1011 | buf[i].data = 0x8000ff; | ||
| 1002 | } | 1012 | } |
| 1003 | } | 1013 | } |
| 1004 | 1014 | ||
| 1005 | adapter->hw_write_wx(adapter, off, &buf[i].data, 4); | 1015 | adapter->hw_write_wx(adapter, off, &buf[i].data, 4); |
| 1006 | 1016 | ||
| 1007 | if (init_delay == 1) { | 1017 | msleep(init_delay); |
| 1008 | msleep(1000); | ||
| 1009 | init_delay = 0; | ||
| 1010 | } | ||
| 1011 | msleep(1); | ||
| 1012 | } | 1018 | } |
| 1013 | kfree(buf); | 1019 | kfree(buf); |
| 1014 | 1020 | ||
| @@ -1277,7 +1283,7 @@ static void netxen_process_rcv(struct netxen_adapter *adapter, int ctxid, | |||
| 1277 | 1283 | ||
| 1278 | dev_kfree_skb_any(skb); | 1284 | dev_kfree_skb_any(skb); |
| 1279 | for (i = 0; i < nr_frags; i++) { | 1285 | for (i = 0; i < nr_frags; i++) { |
| 1280 | index = frag_desc->frag_handles[i]; | 1286 | index = le16_to_cpu(frag_desc->frag_handles[i]); |
| 1281 | skb = netxen_process_rxbuf(adapter, | 1287 | skb = netxen_process_rxbuf(adapter, |
| 1282 | rds_ring, index, cksum); | 1288 | rds_ring, index, cksum); |
| 1283 | if (skb) | 1289 | if (skb) |
| @@ -1428,7 +1434,6 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid) | |||
| 1428 | struct rcv_desc *pdesc; | 1434 | struct rcv_desc *pdesc; |
| 1429 | struct netxen_rx_buffer *buffer; | 1435 | struct netxen_rx_buffer *buffer; |
| 1430 | int count = 0; | 1436 | int count = 0; |
| 1431 | int index = 0; | ||
| 1432 | netxen_ctx_msg msg = 0; | 1437 | netxen_ctx_msg msg = 0; |
| 1433 | dma_addr_t dma; | 1438 | dma_addr_t dma; |
| 1434 | struct list_head *head; | 1439 | struct list_head *head; |
| @@ -1436,7 +1441,6 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid) | |||
| 1436 | rds_ring = &recv_ctx->rds_rings[ringid]; | 1441 | rds_ring = &recv_ctx->rds_rings[ringid]; |
| 1437 | 1442 | ||
| 1438 | producer = rds_ring->producer; | 1443 | producer = rds_ring->producer; |
| 1439 | index = rds_ring->begin_alloc; | ||
| 1440 | head = &rds_ring->free_list; | 1444 | head = &rds_ring->free_list; |
| 1441 | 1445 | ||
| 1442 | /* We can start writing rx descriptors into the phantom memory. */ | 1446 | /* We can start writing rx descriptors into the phantom memory. */ |
| @@ -1444,39 +1448,37 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid) | |||
| 1444 | 1448 | ||
| 1445 | skb = dev_alloc_skb(rds_ring->skb_size); | 1449 | skb = dev_alloc_skb(rds_ring->skb_size); |
| 1446 | if (unlikely(!skb)) { | 1450 | if (unlikely(!skb)) { |
| 1447 | rds_ring->begin_alloc = index; | ||
| 1448 | break; | 1451 | break; |
| 1449 | } | 1452 | } |
| 1450 | 1453 | ||
| 1454 | if (!adapter->ahw.cut_through) | ||
| 1455 | skb_reserve(skb, 2); | ||
| 1456 | |||
| 1457 | dma = pci_map_single(pdev, skb->data, | ||
| 1458 | rds_ring->dma_size, PCI_DMA_FROMDEVICE); | ||
| 1459 | if (pci_dma_mapping_error(pdev, dma)) { | ||
| 1460 | dev_kfree_skb_any(skb); | ||
| 1461 | break; | ||
| 1462 | } | ||
| 1463 | |||
| 1464 | count++; | ||
| 1451 | buffer = list_entry(head->next, struct netxen_rx_buffer, list); | 1465 | buffer = list_entry(head->next, struct netxen_rx_buffer, list); |
| 1452 | list_del(&buffer->list); | 1466 | list_del(&buffer->list); |
| 1453 | 1467 | ||
| 1454 | count++; /* now there should be no failure */ | ||
| 1455 | pdesc = &rds_ring->desc_head[producer]; | ||
| 1456 | |||
| 1457 | if (!adapter->ahw.cut_through) | ||
| 1458 | skb_reserve(skb, 2); | ||
| 1459 | /* This will be setup when we receive the | ||
| 1460 | * buffer after it has been filled FSL TBD TBD | ||
| 1461 | * skb->dev = netdev; | ||
| 1462 | */ | ||
| 1463 | dma = pci_map_single(pdev, skb->data, rds_ring->dma_size, | ||
| 1464 | PCI_DMA_FROMDEVICE); | ||
| 1465 | pdesc->addr_buffer = cpu_to_le64(dma); | ||
| 1466 | buffer->skb = skb; | 1468 | buffer->skb = skb; |
| 1467 | buffer->state = NETXEN_BUFFER_BUSY; | 1469 | buffer->state = NETXEN_BUFFER_BUSY; |
| 1468 | buffer->dma = dma; | 1470 | buffer->dma = dma; |
| 1471 | |||
| 1469 | /* make a rcv descriptor */ | 1472 | /* make a rcv descriptor */ |
| 1473 | pdesc = &rds_ring->desc_head[producer]; | ||
| 1474 | pdesc->addr_buffer = cpu_to_le64(dma); | ||
| 1470 | pdesc->reference_handle = cpu_to_le16(buffer->ref_handle); | 1475 | pdesc->reference_handle = cpu_to_le16(buffer->ref_handle); |
| 1471 | pdesc->buffer_length = cpu_to_le32(rds_ring->dma_size); | 1476 | pdesc->buffer_length = cpu_to_le32(rds_ring->dma_size); |
| 1472 | DPRINTK(INFO, "done writing descripter\n"); | 1477 | |
| 1473 | producer = | 1478 | producer = get_next_index(producer, rds_ring->max_rx_desc_count); |
| 1474 | get_next_index(producer, rds_ring->max_rx_desc_count); | ||
| 1475 | index = get_next_index(index, rds_ring->max_rx_desc_count); | ||
| 1476 | } | 1479 | } |
| 1477 | /* if we did allocate buffers, then write the count to Phantom */ | 1480 | /* if we did allocate buffers, then write the count to Phantom */ |
| 1478 | if (count) { | 1481 | if (count) { |
| 1479 | rds_ring->begin_alloc = index; | ||
| 1480 | rds_ring->producer = producer; | 1482 | rds_ring->producer = producer; |
| 1481 | /* Window = 1 */ | 1483 | /* Window = 1 */ |
| 1482 | adapter->pci_write_normalize(adapter, | 1484 | adapter->pci_write_normalize(adapter, |
| @@ -1515,49 +1517,50 @@ static void netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter, | |||
| 1515 | struct rcv_desc *pdesc; | 1517 | struct rcv_desc *pdesc; |
| 1516 | struct netxen_rx_buffer *buffer; | 1518 | struct netxen_rx_buffer *buffer; |
| 1517 | int count = 0; | 1519 | int count = 0; |
| 1518 | int index = 0; | ||
| 1519 | struct list_head *head; | 1520 | struct list_head *head; |
| 1521 | dma_addr_t dma; | ||
| 1520 | 1522 | ||
| 1521 | rds_ring = &recv_ctx->rds_rings[ringid]; | 1523 | rds_ring = &recv_ctx->rds_rings[ringid]; |
| 1522 | 1524 | ||
| 1523 | producer = rds_ring->producer; | 1525 | producer = rds_ring->producer; |
| 1524 | index = rds_ring->begin_alloc; | ||
| 1525 | head = &rds_ring->free_list; | 1526 | head = &rds_ring->free_list; |
| 1526 | /* We can start writing rx descriptors into the phantom memory. */ | 1527 | /* We can start writing rx descriptors into the phantom memory. */ |
| 1527 | while (!list_empty(head)) { | 1528 | while (!list_empty(head)) { |
| 1528 | 1529 | ||
| 1529 | skb = dev_alloc_skb(rds_ring->skb_size); | 1530 | skb = dev_alloc_skb(rds_ring->skb_size); |
| 1530 | if (unlikely(!skb)) { | 1531 | if (unlikely(!skb)) { |
| 1531 | rds_ring->begin_alloc = index; | ||
| 1532 | break; | 1532 | break; |
| 1533 | } | 1533 | } |
| 1534 | 1534 | ||
| 1535 | if (!adapter->ahw.cut_through) | ||
| 1536 | skb_reserve(skb, 2); | ||
| 1537 | |||
| 1538 | dma = pci_map_single(pdev, skb->data, | ||
| 1539 | rds_ring->dma_size, PCI_DMA_FROMDEVICE); | ||
| 1540 | if (pci_dma_mapping_error(pdev, dma)) { | ||
| 1541 | dev_kfree_skb_any(skb); | ||
| 1542 | break; | ||
| 1543 | } | ||
| 1544 | |||
| 1545 | count++; | ||
| 1535 | buffer = list_entry(head->next, struct netxen_rx_buffer, list); | 1546 | buffer = list_entry(head->next, struct netxen_rx_buffer, list); |
| 1536 | list_del(&buffer->list); | 1547 | list_del(&buffer->list); |
| 1537 | 1548 | ||
| 1538 | count++; /* now there should be no failure */ | ||
| 1539 | pdesc = &rds_ring->desc_head[producer]; | ||
| 1540 | if (!adapter->ahw.cut_through) | ||
| 1541 | skb_reserve(skb, 2); | ||
| 1542 | buffer->skb = skb; | 1549 | buffer->skb = skb; |
| 1543 | buffer->state = NETXEN_BUFFER_BUSY; | 1550 | buffer->state = NETXEN_BUFFER_BUSY; |
| 1544 | buffer->dma = pci_map_single(pdev, skb->data, | 1551 | buffer->dma = dma; |
| 1545 | rds_ring->dma_size, | ||
| 1546 | PCI_DMA_FROMDEVICE); | ||
| 1547 | 1552 | ||
| 1548 | /* make a rcv descriptor */ | 1553 | /* make a rcv descriptor */ |
| 1554 | pdesc = &rds_ring->desc_head[producer]; | ||
| 1549 | pdesc->reference_handle = cpu_to_le16(buffer->ref_handle); | 1555 | pdesc->reference_handle = cpu_to_le16(buffer->ref_handle); |
| 1550 | pdesc->buffer_length = cpu_to_le32(rds_ring->dma_size); | 1556 | pdesc->buffer_length = cpu_to_le32(rds_ring->dma_size); |
| 1551 | pdesc->addr_buffer = cpu_to_le64(buffer->dma); | 1557 | pdesc->addr_buffer = cpu_to_le64(buffer->dma); |
| 1552 | producer = | 1558 | |
| 1553 | get_next_index(producer, rds_ring->max_rx_desc_count); | 1559 | producer = get_next_index(producer, rds_ring->max_rx_desc_count); |
| 1554 | index = get_next_index(index, rds_ring->max_rx_desc_count); | ||
| 1555 | buffer = &rds_ring->rx_buf_arr[index]; | ||
| 1556 | } | 1560 | } |
| 1557 | 1561 | ||
| 1558 | /* if we did allocate buffers, then write the count to Phantom */ | 1562 | /* if we did allocate buffers, then write the count to Phantom */ |
| 1559 | if (count) { | 1563 | if (count) { |
| 1560 | rds_ring->begin_alloc = index; | ||
| 1561 | rds_ring->producer = producer; | 1564 | rds_ring->producer = producer; |
| 1562 | /* Window = 1 */ | 1565 | /* Window = 1 */ |
| 1563 | adapter->pci_write_normalize(adapter, | 1566 | adapter->pci_write_normalize(adapter, |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index ba01524b5531..86867405a367 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | #include "netxen_nic_phan_reg.h" | 39 | #include "netxen_nic_phan_reg.h" |
| 40 | 40 | ||
| 41 | #include <linux/dma-mapping.h> | 41 | #include <linux/dma-mapping.h> |
| 42 | #include <linux/if_vlan.h> | ||
| 42 | #include <net/ip.h> | 43 | #include <net/ip.h> |
| 43 | 44 | ||
| 44 | MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); | 45 | MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); |
| @@ -242,7 +243,7 @@ static void netxen_check_options(struct netxen_adapter *adapter) | |||
| 242 | case NETXEN_BRDTYPE_P3_4_GB: | 243 | case NETXEN_BRDTYPE_P3_4_GB: |
| 243 | case NETXEN_BRDTYPE_P3_4_GB_MM: | 244 | case NETXEN_BRDTYPE_P3_4_GB_MM: |
| 244 | adapter->msix_supported = !!use_msi_x; | 245 | adapter->msix_supported = !!use_msi_x; |
| 245 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_10G; | 246 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; |
| 246 | break; | 247 | break; |
| 247 | 248 | ||
| 248 | case NETXEN_BRDTYPE_P2_SB35_4G: | 249 | case NETXEN_BRDTYPE_P2_SB35_4G: |
| @@ -251,6 +252,14 @@ static void netxen_check_options(struct netxen_adapter *adapter) | |||
| 251 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; | 252 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; |
| 252 | break; | 253 | break; |
| 253 | 254 | ||
| 255 | case NETXEN_BRDTYPE_P3_10G_TP: | ||
| 256 | adapter->msix_supported = !!use_msi_x; | ||
| 257 | if (adapter->ahw.board_type == NETXEN_NIC_XGBE) | ||
| 258 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_10G; | ||
| 259 | else | ||
| 260 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; | ||
| 261 | break; | ||
| 262 | |||
| 254 | default: | 263 | default: |
| 255 | adapter->msix_supported = 0; | 264 | adapter->msix_supported = 0; |
| 256 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; | 265 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; |
| @@ -271,10 +280,15 @@ static void netxen_check_options(struct netxen_adapter *adapter) | |||
| 271 | static int | 280 | static int |
| 272 | netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot) | 281 | netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot) |
| 273 | { | 282 | { |
| 274 | int ret = 0; | 283 | u32 val, timeout; |
| 275 | 284 | ||
| 276 | if (first_boot == 0x55555555) { | 285 | if (first_boot == 0x55555555) { |
| 277 | /* This is the first boot after power up */ | 286 | /* This is the first boot after power up */ |
| 287 | adapter->pci_write_normalize(adapter, | ||
| 288 | NETXEN_CAM_RAM(0x1fc), NETXEN_BDINFO_MAGIC); | ||
| 289 | |||
| 290 | if (!NX_IS_REVISION_P2(adapter->ahw.revision_id)) | ||
| 291 | return 0; | ||
| 278 | 292 | ||
| 279 | /* PCI bus master workaround */ | 293 | /* PCI bus master workaround */ |
| 280 | adapter->hw_read_wx(adapter, | 294 | adapter->hw_read_wx(adapter, |
| @@ -294,18 +308,26 @@ netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot) | |||
| 294 | /* clear the register for future unloads/loads */ | 308 | /* clear the register for future unloads/loads */ |
| 295 | adapter->pci_write_normalize(adapter, | 309 | adapter->pci_write_normalize(adapter, |
| 296 | NETXEN_CAM_RAM(0x1fc), 0); | 310 | NETXEN_CAM_RAM(0x1fc), 0); |
| 297 | ret = -1; | 311 | return -EIO; |
| 298 | } | 312 | } |
| 299 | 313 | ||
| 300 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | 314 | /* Start P2 boot loader */ |
| 301 | /* Start P2 boot loader */ | 315 | val = adapter->pci_read_normalize(adapter, |
| 302 | adapter->pci_write_normalize(adapter, | 316 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE); |
| 303 | NETXEN_CAM_RAM(0x1fc), NETXEN_BDINFO_MAGIC); | 317 | adapter->pci_write_normalize(adapter, |
| 304 | adapter->pci_write_normalize(adapter, | 318 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE, val | 0x1); |
| 305 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE, 1); | 319 | timeout = 0; |
| 306 | } | 320 | do { |
| 321 | msleep(1); | ||
| 322 | val = adapter->pci_read_normalize(adapter, | ||
| 323 | NETXEN_CAM_RAM(0x1fc)); | ||
| 324 | |||
| 325 | if (++timeout > 5000) | ||
| 326 | return -EIO; | ||
| 327 | |||
| 328 | } while (val == NETXEN_BDINFO_MAGIC); | ||
| 307 | } | 329 | } |
| 308 | return ret; | 330 | return 0; |
| 309 | } | 331 | } |
| 310 | 332 | ||
| 311 | static void netxen_set_port_mode(struct netxen_adapter *adapter) | 333 | static void netxen_set_port_mode(struct netxen_adapter *adapter) |
| @@ -784,8 +806,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 784 | CRB_CMDPEG_STATE, 0); | 806 | CRB_CMDPEG_STATE, 0); |
| 785 | netxen_pinit_from_rom(adapter, 0); | 807 | netxen_pinit_from_rom(adapter, 0); |
| 786 | msleep(1); | 808 | msleep(1); |
| 787 | netxen_load_firmware(adapter); | ||
| 788 | } | 809 | } |
| 810 | netxen_load_firmware(adapter); | ||
| 789 | 811 | ||
| 790 | if (NX_IS_REVISION_P3(revision_id)) | 812 | if (NX_IS_REVISION_P3(revision_id)) |
| 791 | netxen_pcie_strap_init(adapter); | 813 | netxen_pcie_strap_init(adapter); |
| @@ -801,13 +823,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 801 | 823 | ||
| 802 | } | 824 | } |
| 803 | 825 | ||
| 804 | if ((first_boot == 0x55555555) && | ||
| 805 | (NX_IS_REVISION_P2(revision_id))) { | ||
| 806 | /* Unlock the HW, prompting the boot sequence */ | ||
| 807 | adapter->pci_write_normalize(adapter, | ||
| 808 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE, 1); | ||
| 809 | } | ||
| 810 | |||
| 811 | err = netxen_initialize_adapter_offload(adapter); | 826 | err = netxen_initialize_adapter_offload(adapter); |
| 812 | if (err) | 827 | if (err) |
| 813 | goto err_out_iounmap; | 828 | goto err_out_iounmap; |
| @@ -821,7 +836,9 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 821 | adapter->pci_write_normalize(adapter, CRB_DRIVER_VERSION, i); | 836 | adapter->pci_write_normalize(adapter, CRB_DRIVER_VERSION, i); |
| 822 | 837 | ||
| 823 | /* Handshake with the card before we register the devices. */ | 838 | /* Handshake with the card before we register the devices. */ |
| 824 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); | 839 | err = netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); |
| 840 | if (err) | ||
| 841 | goto err_out_free_offload; | ||
| 825 | 842 | ||
| 826 | } /* first_driver */ | 843 | } /* first_driver */ |
| 827 | 844 | ||
| @@ -925,6 +942,7 @@ err_out_disable_msi: | |||
| 925 | if (adapter->flags & NETXEN_NIC_MSI_ENABLED) | 942 | if (adapter->flags & NETXEN_NIC_MSI_ENABLED) |
| 926 | pci_disable_msi(pdev); | 943 | pci_disable_msi(pdev); |
| 927 | 944 | ||
| 945 | err_out_free_offload: | ||
| 928 | if (first_driver) | 946 | if (first_driver) |
| 929 | netxen_free_adapter_offload(adapter); | 947 | netxen_free_adapter_offload(adapter); |
| 930 | 948 | ||
| @@ -968,6 +986,9 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
| 968 | netxen_free_hw_resources(adapter); | 986 | netxen_free_hw_resources(adapter); |
| 969 | netxen_release_rx_buffers(adapter); | 987 | netxen_release_rx_buffers(adapter); |
| 970 | netxen_free_sw_resources(adapter); | 988 | netxen_free_sw_resources(adapter); |
| 989 | |||
| 990 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) | ||
| 991 | netxen_p3_free_mac_list(adapter); | ||
| 971 | } | 992 | } |
| 972 | 993 | ||
| 973 | if (adapter->portnum == 0) | 994 | if (adapter->portnum == 0) |
| @@ -1137,29 +1158,64 @@ static int netxen_nic_close(struct net_device *netdev) | |||
| 1137 | return 0; | 1158 | return 0; |
| 1138 | } | 1159 | } |
| 1139 | 1160 | ||
| 1140 | void netxen_tso_check(struct netxen_adapter *adapter, | 1161 | static bool netxen_tso_check(struct net_device *netdev, |
| 1141 | struct cmd_desc_type0 *desc, struct sk_buff *skb) | 1162 | struct cmd_desc_type0 *desc, struct sk_buff *skb) |
| 1142 | { | 1163 | { |
| 1143 | if (desc->mss) { | 1164 | bool tso = false; |
| 1144 | desc->total_hdr_length = (sizeof(struct ethhdr) + | 1165 | u8 opcode = TX_ETHER_PKT; |
| 1145 | ip_hdrlen(skb) + tcp_hdrlen(skb)); | ||
| 1146 | 1166 | ||
| 1147 | if ((NX_IS_REVISION_P3(adapter->ahw.revision_id)) && | 1167 | if ((netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) && |
| 1148 | (skb->protocol == htons(ETH_P_IPV6))) | 1168 | skb_shinfo(skb)->gso_size > 0) { |
| 1149 | netxen_set_cmd_desc_opcode(desc, TX_TCP_LSO6); | 1169 | |
| 1150 | else | 1170 | desc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); |
| 1151 | netxen_set_cmd_desc_opcode(desc, TX_TCP_LSO); | 1171 | desc->total_hdr_length = |
| 1172 | skb_transport_offset(skb) + tcp_hdrlen(skb); | ||
| 1173 | |||
| 1174 | opcode = (skb->protocol == htons(ETH_P_IPV6)) ? | ||
| 1175 | TX_TCP_LSO6 : TX_TCP_LSO; | ||
| 1176 | tso = true; | ||
| 1152 | 1177 | ||
| 1153 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { | 1178 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { |
| 1154 | if (ip_hdr(skb)->protocol == IPPROTO_TCP) | 1179 | u8 l4proto; |
| 1155 | netxen_set_cmd_desc_opcode(desc, TX_TCP_PKT); | 1180 | |
| 1156 | else if (ip_hdr(skb)->protocol == IPPROTO_UDP) | 1181 | if (skb->protocol == htons(ETH_P_IP)) { |
| 1157 | netxen_set_cmd_desc_opcode(desc, TX_UDP_PKT); | 1182 | l4proto = ip_hdr(skb)->protocol; |
| 1158 | else | 1183 | |
| 1159 | return; | 1184 | if (l4proto == IPPROTO_TCP) |
| 1185 | opcode = TX_TCP_PKT; | ||
| 1186 | else if(l4proto == IPPROTO_UDP) | ||
| 1187 | opcode = TX_UDP_PKT; | ||
| 1188 | } else if (skb->protocol == htons(ETH_P_IPV6)) { | ||
| 1189 | l4proto = ipv6_hdr(skb)->nexthdr; | ||
| 1190 | |||
| 1191 | if (l4proto == IPPROTO_TCP) | ||
| 1192 | opcode = TX_TCPV6_PKT; | ||
| 1193 | else if(l4proto == IPPROTO_UDP) | ||
| 1194 | opcode = TX_UDPV6_PKT; | ||
| 1195 | } | ||
| 1160 | } | 1196 | } |
| 1161 | desc->tcp_hdr_offset = skb_transport_offset(skb); | 1197 | desc->tcp_hdr_offset = skb_transport_offset(skb); |
| 1162 | desc->ip_hdr_offset = skb_network_offset(skb); | 1198 | desc->ip_hdr_offset = skb_network_offset(skb); |
| 1199 | netxen_set_tx_flags_opcode(desc, 0, opcode); | ||
| 1200 | return tso; | ||
| 1201 | } | ||
| 1202 | |||
| 1203 | static void | ||
| 1204 | netxen_clean_tx_dma_mapping(struct pci_dev *pdev, | ||
| 1205 | struct netxen_cmd_buffer *pbuf, int last) | ||
| 1206 | { | ||
| 1207 | int k; | ||
| 1208 | struct netxen_skb_frag *buffrag; | ||
| 1209 | |||
| 1210 | buffrag = &pbuf->frag_array[0]; | ||
| 1211 | pci_unmap_single(pdev, buffrag->dma, | ||
| 1212 | buffrag->length, PCI_DMA_TODEVICE); | ||
| 1213 | |||
| 1214 | for (k = 1; k < last; k++) { | ||
| 1215 | buffrag = &pbuf->frag_array[k]; | ||
| 1216 | pci_unmap_page(pdev, buffrag->dma, | ||
| 1217 | buffrag->length, PCI_DMA_TODEVICE); | ||
| 1218 | } | ||
| 1163 | } | 1219 | } |
| 1164 | 1220 | ||
| 1165 | static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | 1221 | static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) |
| @@ -1167,33 +1223,22 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
| 1167 | struct netxen_adapter *adapter = netdev_priv(netdev); | 1223 | struct netxen_adapter *adapter = netdev_priv(netdev); |
| 1168 | struct netxen_hardware_context *hw = &adapter->ahw; | 1224 | struct netxen_hardware_context *hw = &adapter->ahw; |
| 1169 | unsigned int first_seg_len = skb->len - skb->data_len; | 1225 | unsigned int first_seg_len = skb->len - skb->data_len; |
| 1226 | struct netxen_cmd_buffer *pbuf; | ||
| 1170 | struct netxen_skb_frag *buffrag; | 1227 | struct netxen_skb_frag *buffrag; |
| 1171 | unsigned int i; | 1228 | struct cmd_desc_type0 *hwdesc; |
| 1229 | struct pci_dev *pdev = adapter->pdev; | ||
| 1230 | dma_addr_t temp_dma; | ||
| 1231 | int i, k; | ||
| 1172 | 1232 | ||
| 1173 | u32 producer, consumer; | 1233 | u32 producer, consumer; |
| 1174 | u32 saved_producer = 0; | 1234 | int frag_count, no_of_desc; |
| 1175 | struct cmd_desc_type0 *hwdesc; | ||
| 1176 | int k; | ||
| 1177 | struct netxen_cmd_buffer *pbuf = NULL; | ||
| 1178 | int frag_count; | ||
| 1179 | int no_of_desc; | ||
| 1180 | u32 num_txd = adapter->max_tx_desc_count; | 1235 | u32 num_txd = adapter->max_tx_desc_count; |
| 1236 | bool is_tso = false; | ||
| 1181 | 1237 | ||
| 1182 | frag_count = skb_shinfo(skb)->nr_frags + 1; | 1238 | frag_count = skb_shinfo(skb)->nr_frags + 1; |
| 1183 | 1239 | ||
| 1184 | /* There 4 fragments per descriptor */ | 1240 | /* There 4 fragments per descriptor */ |
| 1185 | no_of_desc = (frag_count + 3) >> 2; | 1241 | no_of_desc = (frag_count + 3) >> 2; |
| 1186 | if (netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) { | ||
| 1187 | if (skb_shinfo(skb)->gso_size > 0) { | ||
| 1188 | |||
| 1189 | no_of_desc++; | ||
| 1190 | if ((ip_hdrlen(skb) + tcp_hdrlen(skb) + | ||
| 1191 | sizeof(struct ethhdr)) > | ||
| 1192 | (sizeof(struct cmd_desc_type0) - 2)) { | ||
| 1193 | no_of_desc++; | ||
| 1194 | } | ||
| 1195 | } | ||
| 1196 | } | ||
| 1197 | 1242 | ||
| 1198 | producer = adapter->cmd_producer; | 1243 | producer = adapter->cmd_producer; |
| 1199 | smp_mb(); | 1244 | smp_mb(); |
| @@ -1205,34 +1250,26 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
| 1205 | } | 1250 | } |
| 1206 | 1251 | ||
| 1207 | /* Copy the descriptors into the hardware */ | 1252 | /* Copy the descriptors into the hardware */ |
| 1208 | saved_producer = producer; | ||
| 1209 | hwdesc = &hw->cmd_desc_head[producer]; | 1253 | hwdesc = &hw->cmd_desc_head[producer]; |
| 1210 | memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); | 1254 | memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); |
| 1211 | /* Take skb->data itself */ | 1255 | /* Take skb->data itself */ |
| 1212 | pbuf = &adapter->cmd_buf_arr[producer]; | 1256 | pbuf = &adapter->cmd_buf_arr[producer]; |
| 1213 | if ((netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) && | 1257 | |
| 1214 | skb_shinfo(skb)->gso_size > 0) { | 1258 | is_tso = netxen_tso_check(netdev, hwdesc, skb); |
| 1215 | pbuf->mss = skb_shinfo(skb)->gso_size; | 1259 | |
| 1216 | hwdesc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); | ||
| 1217 | } else { | ||
| 1218 | pbuf->mss = 0; | ||
| 1219 | hwdesc->mss = 0; | ||
| 1220 | } | ||
| 1221 | pbuf->total_length = skb->len; | ||
| 1222 | pbuf->skb = skb; | 1260 | pbuf->skb = skb; |
| 1223 | pbuf->cmd = TX_ETHER_PKT; | ||
| 1224 | pbuf->frag_count = frag_count; | 1261 | pbuf->frag_count = frag_count; |
| 1225 | pbuf->port = adapter->portnum; | ||
| 1226 | buffrag = &pbuf->frag_array[0]; | 1262 | buffrag = &pbuf->frag_array[0]; |
| 1227 | buffrag->dma = pci_map_single(adapter->pdev, skb->data, first_seg_len, | 1263 | temp_dma = pci_map_single(pdev, skb->data, first_seg_len, |
| 1228 | PCI_DMA_TODEVICE); | 1264 | PCI_DMA_TODEVICE); |
| 1265 | if (pci_dma_mapping_error(pdev, temp_dma)) | ||
| 1266 | goto drop_packet; | ||
| 1267 | |||
| 1268 | buffrag->dma = temp_dma; | ||
| 1229 | buffrag->length = first_seg_len; | 1269 | buffrag->length = first_seg_len; |
| 1230 | netxen_set_cmd_desc_totallength(hwdesc, skb->len); | 1270 | netxen_set_tx_frags_len(hwdesc, frag_count, skb->len); |
| 1231 | netxen_set_cmd_desc_num_of_buff(hwdesc, frag_count); | 1271 | netxen_set_tx_port(hwdesc, adapter->portnum); |
| 1232 | netxen_set_cmd_desc_opcode(hwdesc, TX_ETHER_PKT); | ||
| 1233 | 1272 | ||
| 1234 | netxen_set_cmd_desc_port(hwdesc, adapter->portnum); | ||
| 1235 | netxen_set_cmd_desc_ctxid(hwdesc, adapter->portnum); | ||
| 1236 | hwdesc->buffer1_length = cpu_to_le16(first_seg_len); | 1273 | hwdesc->buffer1_length = cpu_to_le16(first_seg_len); |
| 1237 | hwdesc->addr_buffer1 = cpu_to_le64(buffrag->dma); | 1274 | hwdesc->addr_buffer1 = cpu_to_le64(buffrag->dma); |
| 1238 | 1275 | ||
| @@ -1240,7 +1277,6 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
| 1240 | struct skb_frag_struct *frag; | 1277 | struct skb_frag_struct *frag; |
| 1241 | int len, temp_len; | 1278 | int len, temp_len; |
| 1242 | unsigned long offset; | 1279 | unsigned long offset; |
| 1243 | dma_addr_t temp_dma; | ||
| 1244 | 1280 | ||
| 1245 | /* move to next desc. if there is a need */ | 1281 | /* move to next desc. if there is a need */ |
| 1246 | if ((i & 0x3) == 0) { | 1282 | if ((i & 0x3) == 0) { |
| @@ -1256,8 +1292,12 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
| 1256 | offset = frag->page_offset; | 1292 | offset = frag->page_offset; |
| 1257 | 1293 | ||
| 1258 | temp_len = len; | 1294 | temp_len = len; |
| 1259 | temp_dma = pci_map_page(adapter->pdev, frag->page, offset, | 1295 | temp_dma = pci_map_page(pdev, frag->page, offset, |
| 1260 | len, PCI_DMA_TODEVICE); | 1296 | len, PCI_DMA_TODEVICE); |
| 1297 | if (pci_dma_mapping_error(pdev, temp_dma)) { | ||
| 1298 | netxen_clean_tx_dma_mapping(pdev, pbuf, i); | ||
| 1299 | goto drop_packet; | ||
| 1300 | } | ||
| 1261 | 1301 | ||
| 1262 | buffrag++; | 1302 | buffrag++; |
| 1263 | buffrag->dma = temp_dma; | 1303 | buffrag->dma = temp_dma; |
| @@ -1285,16 +1325,12 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
| 1285 | } | 1325 | } |
| 1286 | producer = get_next_index(producer, num_txd); | 1326 | producer = get_next_index(producer, num_txd); |
| 1287 | 1327 | ||
| 1288 | /* might change opcode to TX_TCP_LSO */ | ||
| 1289 | netxen_tso_check(adapter, &hw->cmd_desc_head[saved_producer], skb); | ||
| 1290 | |||
| 1291 | /* For LSO, we need to copy the MAC/IP/TCP headers into | 1328 | /* For LSO, we need to copy the MAC/IP/TCP headers into |
| 1292 | * the descriptor ring | 1329 | * the descriptor ring |
| 1293 | */ | 1330 | */ |
| 1294 | if (netxen_get_cmd_desc_opcode(&hw->cmd_desc_head[saved_producer]) | 1331 | if (is_tso) { |
| 1295 | == TX_TCP_LSO) { | ||
| 1296 | int hdr_len, first_hdr_len, more_hdr; | 1332 | int hdr_len, first_hdr_len, more_hdr; |
| 1297 | hdr_len = hw->cmd_desc_head[saved_producer].total_hdr_length; | 1333 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
| 1298 | if (hdr_len > (sizeof(struct cmd_desc_type0) - 2)) { | 1334 | if (hdr_len > (sizeof(struct cmd_desc_type0) - 2)) { |
| 1299 | first_hdr_len = sizeof(struct cmd_desc_type0) - 2; | 1335 | first_hdr_len = sizeof(struct cmd_desc_type0) - 2; |
| 1300 | more_hdr = 1; | 1336 | more_hdr = 1; |
| @@ -1336,6 +1372,11 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
| 1336 | netdev->trans_start = jiffies; | 1372 | netdev->trans_start = jiffies; |
| 1337 | 1373 | ||
| 1338 | return NETDEV_TX_OK; | 1374 | return NETDEV_TX_OK; |
| 1375 | |||
| 1376 | drop_packet: | ||
| 1377 | adapter->stats.txdropped++; | ||
| 1378 | dev_kfree_skb_any(skb); | ||
| 1379 | return NETDEV_TX_OK; | ||
| 1339 | } | 1380 | } |
| 1340 | 1381 | ||
| 1341 | static int netxen_nic_check_temp(struct netxen_adapter *adapter) | 1382 | static int netxen_nic_check_temp(struct netxen_adapter *adapter) |
| @@ -1407,6 +1448,8 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter) | |||
| 1407 | netif_carrier_off(netdev); | 1448 | netif_carrier_off(netdev); |
| 1408 | netif_stop_queue(netdev); | 1449 | netif_stop_queue(netdev); |
| 1409 | } | 1450 | } |
| 1451 | |||
| 1452 | netxen_nic_set_link_parameters(adapter); | ||
| 1410 | } else if (!adapter->ahw.linkup && linkup) { | 1453 | } else if (!adapter->ahw.linkup && linkup) { |
| 1411 | printk(KERN_INFO "%s: %s NIC Link is up\n", | 1454 | printk(KERN_INFO "%s: %s NIC Link is up\n", |
| 1412 | netxen_nic_driver_name, netdev->name); | 1455 | netxen_nic_driver_name, netdev->name); |
| @@ -1415,6 +1458,8 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter) | |||
| 1415 | netif_carrier_on(netdev); | 1458 | netif_carrier_on(netdev); |
| 1416 | netif_wake_queue(netdev); | 1459 | netif_wake_queue(netdev); |
| 1417 | } | 1460 | } |
| 1461 | |||
| 1462 | netxen_nic_set_link_parameters(adapter); | ||
| 1418 | } | 1463 | } |
| 1419 | } | 1464 | } |
| 1420 | 1465 | ||
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index e35460165bf7..0a06e4fd37d9 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
| @@ -231,15 +231,6 @@ struct phy_device * get_phy_device(struct mii_bus *bus, int addr) | |||
| 231 | if ((phy_id & 0x1fffffff) == 0x1fffffff) | 231 | if ((phy_id & 0x1fffffff) == 0x1fffffff) |
| 232 | return NULL; | 232 | return NULL; |
| 233 | 233 | ||
| 234 | /* | ||
| 235 | * Broken hardware is sometimes missing the pull-up resistor on the | ||
| 236 | * MDIO line, which results in reads to non-existent devices returning | ||
| 237 | * 0 rather than 0xffff. Catch this here and treat 0 as a non-existent | ||
| 238 | * device as well. | ||
| 239 | */ | ||
| 240 | if (phy_id == 0) | ||
| 241 | return NULL; | ||
| 242 | |||
| 243 | dev = phy_device_create(bus, addr, phy_id); | 234 | dev = phy_device_create(bus, addr, phy_id); |
| 244 | 235 | ||
| 245 | return dev; | 236 | return dev; |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 06b448285eb5..7b2728b8f1b7 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
| @@ -250,6 +250,7 @@ static int ppp_connect_channel(struct channel *pch, int unit); | |||
| 250 | static int ppp_disconnect_channel(struct channel *pch); | 250 | static int ppp_disconnect_channel(struct channel *pch); |
| 251 | static void ppp_destroy_channel(struct channel *pch); | 251 | static void ppp_destroy_channel(struct channel *pch); |
| 252 | static int unit_get(struct idr *p, void *ptr); | 252 | static int unit_get(struct idr *p, void *ptr); |
| 253 | static int unit_set(struct idr *p, void *ptr, int n); | ||
| 253 | static void unit_put(struct idr *p, int n); | 254 | static void unit_put(struct idr *p, int n); |
| 254 | static void *unit_find(struct idr *p, int n); | 255 | static void *unit_find(struct idr *p, int n); |
| 255 | 256 | ||
| @@ -2432,11 +2433,18 @@ ppp_create_interface(int unit, int *retp) | |||
| 2432 | } else { | 2433 | } else { |
| 2433 | if (unit_find(&ppp_units_idr, unit)) | 2434 | if (unit_find(&ppp_units_idr, unit)) |
| 2434 | goto out2; /* unit already exists */ | 2435 | goto out2; /* unit already exists */ |
| 2435 | else { | 2436 | /* |
| 2436 | /* darn, someone is cheating us? */ | 2437 | * if caller need a specified unit number |
| 2437 | *retp = -EINVAL; | 2438 | * lets try to satisfy him, otherwise -- |
| 2439 | * he should better ask us for new unit number | ||
| 2440 | * | ||
| 2441 | * NOTE: yes I know that returning EEXIST it's not | ||
| 2442 | * fair but at least pppd will ask us to allocate | ||
| 2443 | * new unit in this case so user is happy :) | ||
| 2444 | */ | ||
| 2445 | unit = unit_set(&ppp_units_idr, ppp, unit); | ||
| 2446 | if (unit < 0) | ||
| 2438 | goto out2; | 2447 | goto out2; |
| 2439 | } | ||
| 2440 | } | 2448 | } |
| 2441 | 2449 | ||
| 2442 | /* Initialize the new ppp unit */ | 2450 | /* Initialize the new ppp unit */ |
| @@ -2677,14 +2685,37 @@ static void __exit ppp_cleanup(void) | |||
| 2677 | * by holding all_ppp_mutex | 2685 | * by holding all_ppp_mutex |
| 2678 | */ | 2686 | */ |
| 2679 | 2687 | ||
| 2688 | /* associate pointer with specified number */ | ||
| 2689 | static int unit_set(struct idr *p, void *ptr, int n) | ||
| 2690 | { | ||
| 2691 | int unit, err; | ||
| 2692 | |||
| 2693 | again: | ||
| 2694 | if (!idr_pre_get(p, GFP_KERNEL)) { | ||
| 2695 | printk(KERN_ERR "PPP: No free memory for idr\n"); | ||
| 2696 | return -ENOMEM; | ||
| 2697 | } | ||
| 2698 | |||
| 2699 | err = idr_get_new_above(p, ptr, n, &unit); | ||
| 2700 | if (err == -EAGAIN) | ||
| 2701 | goto again; | ||
| 2702 | |||
| 2703 | if (unit != n) { | ||
| 2704 | idr_remove(p, unit); | ||
| 2705 | return -EINVAL; | ||
| 2706 | } | ||
| 2707 | |||
| 2708 | return unit; | ||
| 2709 | } | ||
| 2710 | |||
| 2680 | /* get new free unit number and associate pointer with it */ | 2711 | /* get new free unit number and associate pointer with it */ |
| 2681 | static int unit_get(struct idr *p, void *ptr) | 2712 | static int unit_get(struct idr *p, void *ptr) |
| 2682 | { | 2713 | { |
| 2683 | int unit, err; | 2714 | int unit, err; |
| 2684 | 2715 | ||
| 2685 | again: | 2716 | again: |
| 2686 | if (idr_pre_get(p, GFP_KERNEL) == 0) { | 2717 | if (!idr_pre_get(p, GFP_KERNEL)) { |
| 2687 | printk(KERN_ERR "Out of memory expanding drawable idr\n"); | 2718 | printk(KERN_ERR "PPP: No free memory for idr\n"); |
| 2688 | return -ENOMEM; | 2719 | return -ENOMEM; |
| 2689 | } | 2720 | } |
| 2690 | 2721 | ||
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c index 6cbefcae9ac2..be4465bc0a69 100644 --- a/drivers/net/sis900.c +++ b/drivers/net/sis900.c | |||
| @@ -509,10 +509,10 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev, | |||
| 509 | else | 509 | else |
| 510 | ret = sis900_get_mac_addr(pci_dev, net_dev); | 510 | ret = sis900_get_mac_addr(pci_dev, net_dev); |
| 511 | 511 | ||
| 512 | if (ret == 0) { | 512 | if (!ret || !is_valid_ether_addr(net_dev->dev_addr)) { |
| 513 | printk(KERN_WARNING "%s: Cannot read MAC address.\n", dev_name); | 513 | random_ether_addr(net_dev->dev_addr); |
| 514 | ret = -ENODEV; | 514 | printk(KERN_WARNING "%s: Unreadable or invalid MAC address," |
| 515 | goto err_unmap_rx; | 515 | "using random generated one\n", dev_name); |
| 516 | } | 516 | } |
| 517 | 517 | ||
| 518 | /* 630ET : set the mii access mode as software-mode */ | 518 | /* 630ET : set the mii access mode as software-mode */ |
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 6478bf63f289..0d0fa91c0251 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
| @@ -1793,8 +1793,8 @@ static int mux_device_request(struct hso_serial *serial, u8 type, u16 port, | |||
| 1793 | 1793 | ||
| 1794 | /* initialize */ | 1794 | /* initialize */ |
| 1795 | ctrl_req->wValue = 0; | 1795 | ctrl_req->wValue = 0; |
| 1796 | ctrl_req->wIndex = hso_port_to_mux(port); | 1796 | ctrl_req->wIndex = cpu_to_le16(hso_port_to_mux(port)); |
| 1797 | ctrl_req->wLength = size; | 1797 | ctrl_req->wLength = cpu_to_le16(size); |
| 1798 | 1798 | ||
| 1799 | if (type == USB_CDC_GET_ENCAPSULATED_RESPONSE) { | 1799 | if (type == USB_CDC_GET_ENCAPSULATED_RESPONSE) { |
| 1800 | /* Reading command */ | 1800 | /* Reading command */ |
diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c index 2dc241689d37..0dbd85b0162d 100644 --- a/drivers/net/wan/ixp4xx_hss.c +++ b/drivers/net/wan/ixp4xx_hss.c | |||
| @@ -622,7 +622,7 @@ static void hss_hdlc_rx_irq(void *pdev) | |||
| 622 | printk(KERN_DEBUG "%s: hss_hdlc_rx_irq\n", dev->name); | 622 | printk(KERN_DEBUG "%s: hss_hdlc_rx_irq\n", dev->name); |
| 623 | #endif | 623 | #endif |
| 624 | qmgr_disable_irq(queue_ids[port->id].rx); | 624 | qmgr_disable_irq(queue_ids[port->id].rx); |
| 625 | netif_rx_schedule(dev, &port->napi); | 625 | netif_rx_schedule(&port->napi); |
| 626 | } | 626 | } |
| 627 | 627 | ||
| 628 | static int hss_hdlc_poll(struct napi_struct *napi, int budget) | 628 | static int hss_hdlc_poll(struct napi_struct *napi, int budget) |
| @@ -651,7 +651,7 @@ static int hss_hdlc_poll(struct napi_struct *napi, int budget) | |||
| 651 | printk(KERN_DEBUG "%s: hss_hdlc_poll" | 651 | printk(KERN_DEBUG "%s: hss_hdlc_poll" |
| 652 | " netif_rx_complete\n", dev->name); | 652 | " netif_rx_complete\n", dev->name); |
| 653 | #endif | 653 | #endif |
| 654 | netif_rx_complete(dev, napi); | 654 | netif_rx_complete(napi); |
| 655 | qmgr_enable_irq(rxq); | 655 | qmgr_enable_irq(rxq); |
| 656 | if (!qmgr_stat_empty(rxq) && | 656 | if (!qmgr_stat_empty(rxq) && |
| 657 | netif_rx_reschedule(napi)) { | 657 | netif_rx_reschedule(napi)) { |
| @@ -1069,7 +1069,7 @@ static int hss_hdlc_open(struct net_device *dev) | |||
| 1069 | hss_start_hdlc(port); | 1069 | hss_start_hdlc(port); |
| 1070 | 1070 | ||
| 1071 | /* we may already have RX data, enables IRQ */ | 1071 | /* we may already have RX data, enables IRQ */ |
| 1072 | netif_rx_schedule(dev, &port->napi); | 1072 | netif_rx_schedule(&port->napi); |
| 1073 | return 0; | 1073 | return 0; |
| 1074 | 1074 | ||
| 1075 | err_unlock: | 1075 | err_unlock: |
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index ea543fcf2687..e4f9f747de88 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig | |||
| @@ -111,7 +111,7 @@ config WLAN_80211 | |||
| 111 | lets you choose drivers. | 111 | lets you choose drivers. |
| 112 | 112 | ||
| 113 | config PCMCIA_RAYCS | 113 | config PCMCIA_RAYCS |
| 114 | tristate "Aviator/Raytheon 2.4MHz wireless support" | 114 | tristate "Aviator/Raytheon 2.4GHz wireless support" |
| 115 | depends on PCMCIA && WLAN_80211 | 115 | depends on PCMCIA && WLAN_80211 |
| 116 | select WIRELESS_EXT | 116 | select WIRELESS_EXT |
| 117 | ---help--- | 117 | ---help--- |
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c index 4af2607deec0..8ef87356e083 100644 --- a/drivers/net/wireless/ath5k/base.c +++ b/drivers/net/wireless/ath5k/base.c | |||
| @@ -2644,7 +2644,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
| 2644 | if (skb_headroom(skb) < padsize) { | 2644 | if (skb_headroom(skb) < padsize) { |
| 2645 | ATH5K_ERR(sc, "tx hdrlen not %%4: %d not enough" | 2645 | ATH5K_ERR(sc, "tx hdrlen not %%4: %d not enough" |
| 2646 | " headroom to pad %d\n", hdrlen, padsize); | 2646 | " headroom to pad %d\n", hdrlen, padsize); |
| 2647 | return -1; | 2647 | return NETDEV_TX_BUSY; |
| 2648 | } | 2648 | } |
| 2649 | skb_push(skb, padsize); | 2649 | skb_push(skb, padsize); |
| 2650 | memmove(skb->data, skb->data+padsize, hdrlen); | 2650 | memmove(skb->data, skb->data+padsize, hdrlen); |
| @@ -2655,7 +2655,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
| 2655 | ATH5K_ERR(sc, "no further txbuf available, dropping packet\n"); | 2655 | ATH5K_ERR(sc, "no further txbuf available, dropping packet\n"); |
| 2656 | spin_unlock_irqrestore(&sc->txbuflock, flags); | 2656 | spin_unlock_irqrestore(&sc->txbuflock, flags); |
| 2657 | ieee80211_stop_queue(hw, skb_get_queue_mapping(skb)); | 2657 | ieee80211_stop_queue(hw, skb_get_queue_mapping(skb)); |
| 2658 | return -1; | 2658 | return NETDEV_TX_BUSY; |
| 2659 | } | 2659 | } |
| 2660 | bf = list_first_entry(&sc->txbuf, struct ath5k_buf, list); | 2660 | bf = list_first_entry(&sc->txbuf, struct ath5k_buf, list); |
| 2661 | list_del(&bf->list); | 2661 | list_del(&bf->list); |
| @@ -2673,10 +2673,10 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
| 2673 | sc->txbuf_len++; | 2673 | sc->txbuf_len++; |
| 2674 | spin_unlock_irqrestore(&sc->txbuflock, flags); | 2674 | spin_unlock_irqrestore(&sc->txbuflock, flags); |
| 2675 | dev_kfree_skb_any(skb); | 2675 | dev_kfree_skb_any(skb); |
| 2676 | return 0; | 2676 | return NETDEV_TX_OK; |
| 2677 | } | 2677 | } |
| 2678 | 2678 | ||
| 2679 | return 0; | 2679 | return NETDEV_TX_OK; |
| 2680 | } | 2680 | } |
| 2681 | 2681 | ||
| 2682 | static int | 2682 | static int |
diff --git a/drivers/net/wireless/ath5k/pcu.c b/drivers/net/wireless/ath5k/pcu.c index 0cac05c6a9ce..75eb9f43c741 100644 --- a/drivers/net/wireless/ath5k/pcu.c +++ b/drivers/net/wireless/ath5k/pcu.c | |||
| @@ -65,7 +65,7 @@ int ath5k_hw_set_opmode(struct ath5k_hw *ah) | |||
| 65 | if (ah->ah_version == AR5K_AR5210) | 65 | if (ah->ah_version == AR5K_AR5210) |
| 66 | pcu_reg |= AR5K_STA_ID1_NO_PSPOLL; | 66 | pcu_reg |= AR5K_STA_ID1_NO_PSPOLL; |
| 67 | else | 67 | else |
| 68 | AR5K_REG_DISABLE_BITS(ah, AR5K_CFG, AR5K_CFG_ADHOC); | 68 | AR5K_REG_ENABLE_BITS(ah, AR5K_CFG, AR5K_CFG_IBSS); |
| 69 | break; | 69 | break; |
| 70 | 70 | ||
| 71 | case NL80211_IFTYPE_AP: | 71 | case NL80211_IFTYPE_AP: |
| @@ -75,7 +75,7 @@ int ath5k_hw_set_opmode(struct ath5k_hw *ah) | |||
| 75 | if (ah->ah_version == AR5K_AR5210) | 75 | if (ah->ah_version == AR5K_AR5210) |
| 76 | pcu_reg |= AR5K_STA_ID1_NO_PSPOLL; | 76 | pcu_reg |= AR5K_STA_ID1_NO_PSPOLL; |
| 77 | else | 77 | else |
| 78 | AR5K_REG_ENABLE_BITS(ah, AR5K_CFG, AR5K_CFG_ADHOC); | 78 | AR5K_REG_DISABLE_BITS(ah, AR5K_CFG, AR5K_CFG_IBSS); |
| 79 | break; | 79 | break; |
| 80 | 80 | ||
| 81 | case NL80211_IFTYPE_STATION: | 81 | case NL80211_IFTYPE_STATION: |
diff --git a/drivers/net/wireless/ath5k/reg.h b/drivers/net/wireless/ath5k/reg.h index 91aaeaf88199..9189ab13286c 100644 --- a/drivers/net/wireless/ath5k/reg.h +++ b/drivers/net/wireless/ath5k/reg.h | |||
| @@ -73,7 +73,7 @@ | |||
| 73 | #define AR5K_CFG_SWRD 0x00000004 /* Byte-swap RX descriptor */ | 73 | #define AR5K_CFG_SWRD 0x00000004 /* Byte-swap RX descriptor */ |
| 74 | #define AR5K_CFG_SWRB 0x00000008 /* Byte-swap RX buffer */ | 74 | #define AR5K_CFG_SWRB 0x00000008 /* Byte-swap RX buffer */ |
| 75 | #define AR5K_CFG_SWRG 0x00000010 /* Byte-swap Register access */ | 75 | #define AR5K_CFG_SWRG 0x00000010 /* Byte-swap Register access */ |
| 76 | #define AR5K_CFG_ADHOC 0x00000020 /* AP/Adhoc indication [5211+] */ | 76 | #define AR5K_CFG_IBSS 0x00000020 /* 0-BSS, 1-IBSS [5211+] */ |
| 77 | #define AR5K_CFG_PHY_OK 0x00000100 /* [5211+] */ | 77 | #define AR5K_CFG_PHY_OK 0x00000100 /* [5211+] */ |
| 78 | #define AR5K_CFG_EEBS 0x00000200 /* EEPROM is busy */ | 78 | #define AR5K_CFG_EEBS 0x00000200 /* EEPROM is busy */ |
| 79 | #define AR5K_CFG_CLKGD 0x00000400 /* Clock gated (Disable dynamic clock) */ | 79 | #define AR5K_CFG_CLKGD 0x00000400 /* Clock gated (Disable dynamic clock) */ |
diff --git a/drivers/net/wireless/ath9k/Kconfig b/drivers/net/wireless/ath9k/Kconfig index c43bd321f97f..90a8dd873786 100644 --- a/drivers/net/wireless/ath9k/Kconfig +++ b/drivers/net/wireless/ath9k/Kconfig | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | config ATH9K | 1 | config ATH9K |
| 2 | tristate "Atheros 802.11n wireless cards support" | 2 | tristate "Atheros 802.11n wireless cards support" |
| 3 | depends on PCI && MAC80211 && WLAN_80211 | 3 | depends on PCI && MAC80211 && WLAN_80211 |
| 4 | depends on RFKILL || RFKILL=n | ||
| 4 | select MAC80211_LEDS | 5 | select MAC80211_LEDS |
| 5 | select LEDS_CLASS | 6 | select LEDS_CLASS |
| 6 | select NEW_LEDS | 7 | select NEW_LEDS |
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index 191eec50dc75..727f067aca4f 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
| @@ -2164,13 +2164,13 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
| 2164 | conf->ht.channel_type); | 2164 | conf->ht.channel_type); |
| 2165 | } | 2165 | } |
| 2166 | 2166 | ||
| 2167 | ath_update_chainmask(sc, conf->ht.enabled); | ||
| 2168 | |||
| 2167 | if (ath_set_channel(sc, &sc->sc_ah->ah_channels[pos]) < 0) { | 2169 | if (ath_set_channel(sc, &sc->sc_ah->ah_channels[pos]) < 0) { |
| 2168 | DPRINTF(sc, ATH_DBG_FATAL, "Unable to set channel\n"); | 2170 | DPRINTF(sc, ATH_DBG_FATAL, "Unable to set channel\n"); |
| 2169 | mutex_unlock(&sc->mutex); | 2171 | mutex_unlock(&sc->mutex); |
| 2170 | return -EINVAL; | 2172 | return -EINVAL; |
| 2171 | } | 2173 | } |
| 2172 | |||
| 2173 | ath_update_chainmask(sc, conf->ht.enabled); | ||
| 2174 | } | 2174 | } |
| 2175 | 2175 | ||
| 2176 | if (changed & IEEE80211_CONF_CHANGE_POWER) | 2176 | if (changed & IEEE80211_CONF_CHANGE_POWER) |
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c index 3bfc3b90f256..c92f0c6e4adc 100644 --- a/drivers/net/wireless/ath9k/xmit.c +++ b/drivers/net/wireless/ath9k/xmit.c | |||
| @@ -126,15 +126,7 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, | |||
| 126 | tx_info->flags |= IEEE80211_TX_STAT_ACK; | 126 | tx_info->flags |= IEEE80211_TX_STAT_ACK; |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | tx_info->status.rates[0].count = tx_status->retries; | 129 | tx_info->status.rates[0].count = tx_status->retries + 1; |
| 130 | if (tx_info->status.rates[0].flags & IEEE80211_TX_RC_MCS) { | ||
| 131 | /* Change idx from internal table index to MCS index */ | ||
| 132 | int idx = tx_info->status.rates[0].idx; | ||
| 133 | struct ath_rate_table *rate_table = sc->cur_rate_table; | ||
| 134 | if (idx >= 0 && idx < rate_table->rate_cnt) | ||
| 135 | tx_info->status.rates[0].idx = | ||
| 136 | rate_table->info[idx].ratecode & 0x7f; | ||
| 137 | } | ||
| 138 | 130 | ||
| 139 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); | 131 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); |
| 140 | padsize = hdrlen & 3; | 132 | padsize = hdrlen & 3; |
| @@ -264,25 +256,22 @@ static void assign_aggr_tid_seqno(struct sk_buff *skb, | |||
| 264 | } | 256 | } |
| 265 | 257 | ||
| 266 | /* Get seqno */ | 258 | /* Get seqno */ |
| 267 | 259 | /* For HT capable stations, we save tidno for later use. | |
| 268 | if (ieee80211_is_data(fc) && !is_pae(skb)) { | 260 | * We also override seqno set by upper layer with the one |
| 269 | /* For HT capable stations, we save tidno for later use. | 261 | * in tx aggregation state. |
| 270 | * We also override seqno set by upper layer with the one | 262 | * |
| 271 | * in tx aggregation state. | 263 | * If fragmentation is on, the sequence number is |
| 272 | * | 264 | * not overridden, since it has been |
| 273 | * If fragmentation is on, the sequence number is | 265 | * incremented by the fragmentation routine. |
| 274 | * not overridden, since it has been | 266 | * |
| 275 | * incremented by the fragmentation routine. | 267 | * FIXME: check if the fragmentation threshold exceeds |
| 276 | * | 268 | * IEEE80211 max. |
| 277 | * FIXME: check if the fragmentation threshold exceeds | 269 | */ |
| 278 | * IEEE80211 max. | 270 | tid = ATH_AN_2_TID(an, bf->bf_tidno); |
| 279 | */ | 271 | hdr->seq_ctrl = cpu_to_le16(tid->seq_next << |
| 280 | tid = ATH_AN_2_TID(an, bf->bf_tidno); | 272 | IEEE80211_SEQ_SEQ_SHIFT); |
| 281 | hdr->seq_ctrl = cpu_to_le16(tid->seq_next << | 273 | bf->bf_seqno = tid->seq_next; |
| 282 | IEEE80211_SEQ_SEQ_SHIFT); | 274 | INCR(tid->seq_next, IEEE80211_SEQ_MAX); |
| 283 | bf->bf_seqno = tid->seq_next; | ||
| 284 | INCR(tid->seq_next, IEEE80211_SEQ_MAX); | ||
| 285 | } | ||
| 286 | } | 275 | } |
| 287 | 276 | ||
| 288 | static int setup_tx_flags(struct ath_softc *sc, struct sk_buff *skb, | 277 | static int setup_tx_flags(struct ath_softc *sc, struct sk_buff *skb, |
| @@ -1718,11 +1707,10 @@ static int ath_tx_setup_buffer(struct ath_softc *sc, struct ath_buf *bf, | |||
| 1718 | 1707 | ||
| 1719 | /* Assign seqno, tidno */ | 1708 | /* Assign seqno, tidno */ |
| 1720 | 1709 | ||
| 1721 | if (bf_isht(bf) && (sc->sc_flags & SC_OP_TXAGGR)) | 1710 | if (ieee80211_is_data_qos(fc) && (sc->sc_flags & SC_OP_TXAGGR)) |
| 1722 | assign_aggr_tid_seqno(skb, bf); | 1711 | assign_aggr_tid_seqno(skb, bf); |
| 1723 | 1712 | ||
| 1724 | /* DMA setup */ | 1713 | /* DMA setup */ |
| 1725 | |||
| 1726 | bf->bf_mpdu = skb; | 1714 | bf->bf_mpdu = skb; |
| 1727 | 1715 | ||
| 1728 | bf->bf_dmacontext = pci_map_single(sc->pdev, skb->data, | 1716 | bf->bf_dmacontext = pci_map_single(sc->pdev, skb->data, |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 7b31a327b24a..c788bad10661 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
| @@ -3261,7 +3261,7 @@ static int b43_switch_band(struct b43_wl *wl, struct ieee80211_channel *chan) | |||
| 3261 | struct b43_wldev *down_dev; | 3261 | struct b43_wldev *down_dev; |
| 3262 | struct b43_wldev *d; | 3262 | struct b43_wldev *d; |
| 3263 | int err; | 3263 | int err; |
| 3264 | bool gmode; | 3264 | bool uninitialized_var(gmode); |
| 3265 | int prev_status; | 3265 | int prev_status; |
| 3266 | 3266 | ||
| 3267 | /* Find a device and PHY which supports the band. */ | 3267 | /* Find a device and PHY which supports the band. */ |
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index c1324e31d2f6..fb996c27a19b 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c | |||
| @@ -2465,7 +2465,7 @@ static void b43legacy_put_phy_into_reset(struct b43legacy_wldev *dev) | |||
| 2465 | static int b43legacy_switch_phymode(struct b43legacy_wl *wl, | 2465 | static int b43legacy_switch_phymode(struct b43legacy_wl *wl, |
| 2466 | unsigned int new_mode) | 2466 | unsigned int new_mode) |
| 2467 | { | 2467 | { |
| 2468 | struct b43legacy_wldev *up_dev; | 2468 | struct b43legacy_wldev *uninitialized_var(up_dev); |
| 2469 | struct b43legacy_wldev *down_dev; | 2469 | struct b43legacy_wldev *down_dev; |
| 2470 | int err; | 2470 | int err; |
| 2471 | bool gmode = 0; | 2471 | bool gmode = 0; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 8fdb34222c0a..45cfa1cf194a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
| @@ -2219,7 +2219,7 @@ int iwl3945_txpower_set_from_eeprom(struct iwl3945_priv *priv) | |||
| 2219 | /* set tx power value for all OFDM rates */ | 2219 | /* set tx power value for all OFDM rates */ |
| 2220 | for (rate_index = 0; rate_index < IWL_OFDM_RATES; | 2220 | for (rate_index = 0; rate_index < IWL_OFDM_RATES; |
| 2221 | rate_index++) { | 2221 | rate_index++) { |
| 2222 | s32 power_idx; | 2222 | s32 uninitialized_var(power_idx); |
| 2223 | int rc; | 2223 | int rc; |
| 2224 | 2224 | ||
| 2225 | /* use channel group's clip-power table, | 2225 | /* use channel group's clip-power table, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h index 52966ffbef6e..ba997204c8d4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-commands.h | |||
| @@ -255,7 +255,7 @@ struct iwl_cmd_header { | |||
| 255 | * 0x3) 54 Mbps | 255 | * 0x3) 54 Mbps |
| 256 | * | 256 | * |
| 257 | * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"): | 257 | * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"): |
| 258 | * 3-0: 10) 1 Mbps | 258 | * 6-0: 10) 1 Mbps |
| 259 | * 20) 2 Mbps | 259 | * 20) 2 Mbps |
| 260 | * 55) 5.5 Mbps | 260 | * 55) 5.5 Mbps |
| 261 | * 110) 11 Mbps | 261 | * 110) 11 Mbps |
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c index 01a2169cecec..8c71ad4f88c5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c +++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c | |||
| @@ -51,6 +51,7 @@ const char *get_cmd_string(u8 cmd) | |||
| 51 | IWL_CMD(REPLY_REMOVE_STA); | 51 | IWL_CMD(REPLY_REMOVE_STA); |
| 52 | IWL_CMD(REPLY_REMOVE_ALL_STA); | 52 | IWL_CMD(REPLY_REMOVE_ALL_STA); |
| 53 | IWL_CMD(REPLY_WEPKEY); | 53 | IWL_CMD(REPLY_WEPKEY); |
| 54 | IWL_CMD(REPLY_3945_RX); | ||
| 54 | IWL_CMD(REPLY_TX); | 55 | IWL_CMD(REPLY_TX); |
| 55 | IWL_CMD(REPLY_RATE_SCALE); | 56 | IWL_CMD(REPLY_RATE_SCALE); |
| 56 | IWL_CMD(REPLY_LEDS_CMD); | 57 | IWL_CMD(REPLY_LEDS_CMD); |
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c index d1fc305de5fe..e7289e2e7f16 100644 --- a/drivers/net/wireless/libertas_tf/main.c +++ b/drivers/net/wireless/libertas_tf/main.c | |||
| @@ -206,7 +206,7 @@ static int lbtf_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
| 206 | * there are no buffered multicast frames to send | 206 | * there are no buffered multicast frames to send |
| 207 | */ | 207 | */ |
| 208 | ieee80211_stop_queues(priv->hw); | 208 | ieee80211_stop_queues(priv->hw); |
| 209 | return 0; | 209 | return NETDEV_TX_OK; |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | static void lbtf_tx_work(struct work_struct *work) | 212 | static void lbtf_tx_work(struct work_struct *work) |
diff --git a/drivers/net/wireless/orinoco/orinoco.c b/drivers/net/wireless/orinoco/orinoco.c index bc84e2792f8a..c3bb85e0251e 100644 --- a/drivers/net/wireless/orinoco/orinoco.c +++ b/drivers/net/wireless/orinoco/orinoco.c | |||
| @@ -1610,6 +1610,16 @@ static void orinoco_rx_isr_tasklet(unsigned long data) | |||
| 1610 | struct orinoco_rx_data *rx_data, *temp; | 1610 | struct orinoco_rx_data *rx_data, *temp; |
| 1611 | struct hermes_rx_descriptor *desc; | 1611 | struct hermes_rx_descriptor *desc; |
| 1612 | struct sk_buff *skb; | 1612 | struct sk_buff *skb; |
| 1613 | unsigned long flags; | ||
| 1614 | |||
| 1615 | /* orinoco_rx requires the driver lock, and we also need to | ||
| 1616 | * protect priv->rx_list, so just hold the lock over the | ||
| 1617 | * lot. | ||
| 1618 | * | ||
| 1619 | * If orinoco_lock fails, we've unplugged the card. In this | ||
| 1620 | * case just abort. */ | ||
| 1621 | if (orinoco_lock(priv, &flags) != 0) | ||
| 1622 | return; | ||
| 1613 | 1623 | ||
| 1614 | /* extract desc and skb from queue */ | 1624 | /* extract desc and skb from queue */ |
| 1615 | list_for_each_entry_safe(rx_data, temp, &priv->rx_list, list) { | 1625 | list_for_each_entry_safe(rx_data, temp, &priv->rx_list, list) { |
| @@ -1622,6 +1632,8 @@ static void orinoco_rx_isr_tasklet(unsigned long data) | |||
| 1622 | 1632 | ||
| 1623 | kfree(desc); | 1633 | kfree(desc); |
| 1624 | } | 1634 | } |
| 1635 | |||
| 1636 | orinoco_unlock(priv, &flags); | ||
| 1625 | } | 1637 | } |
| 1626 | 1638 | ||
| 1627 | /********************************************************************/ | 1639 | /********************************************************************/ |
| @@ -3645,12 +3657,22 @@ struct net_device | |||
| 3645 | void free_orinocodev(struct net_device *dev) | 3657 | void free_orinocodev(struct net_device *dev) |
| 3646 | { | 3658 | { |
| 3647 | struct orinoco_private *priv = netdev_priv(dev); | 3659 | struct orinoco_private *priv = netdev_priv(dev); |
| 3660 | struct orinoco_rx_data *rx_data, *temp; | ||
| 3648 | 3661 | ||
| 3649 | /* No need to empty priv->rx_list: if the tasklet is scheduled | 3662 | /* If the tasklet is scheduled when we call tasklet_kill it |
| 3650 | * when we call tasklet_kill it will run one final time, | 3663 | * will run one final time. However the tasklet will only |
| 3651 | * emptying the list */ | 3664 | * drain priv->rx_list if the hw is still available. */ |
| 3652 | tasklet_kill(&priv->rx_tasklet); | 3665 | tasklet_kill(&priv->rx_tasklet); |
| 3653 | 3666 | ||
| 3667 | /* Explicitly drain priv->rx_list */ | ||
| 3668 | list_for_each_entry_safe(rx_data, temp, &priv->rx_list, list) { | ||
| 3669 | list_del(&rx_data->list); | ||
| 3670 | |||
| 3671 | dev_kfree_skb(rx_data->skb); | ||
| 3672 | kfree(rx_data->desc); | ||
| 3673 | kfree(rx_data); | ||
| 3674 | } | ||
| 3675 | |||
| 3654 | unregister_pm_notifier(&priv->pm_notifier); | 3676 | unregister_pm_notifier(&priv->pm_notifier); |
| 3655 | orinoco_uncache_fw(priv); | 3677 | orinoco_uncache_fw(priv); |
| 3656 | 3678 | ||
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c index f127602670ec..0b32215d3f5d 100644 --- a/drivers/net/wireless/orinoco/orinoco_cs.c +++ b/drivers/net/wireless/orinoco/orinoco_cs.c | |||
| @@ -435,6 +435,7 @@ static struct pcmcia_device_id orinoco_cs_ids[] = { | |||
| 435 | PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), /* Samsung SWL2000-N 11Mb/s WLAN Card */ | 435 | PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), /* Samsung SWL2000-N 11Mb/s WLAN Card */ |
| 436 | PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), /* AirWay 802.11 Adapter (PCMCIA) */ | 436 | PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), /* AirWay 802.11 Adapter (PCMCIA) */ |
| 437 | PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), /* ARtem Onair */ | 437 | PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), /* ARtem Onair */ |
| 438 | PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0003), /* ARtem Onair Comcard 11 */ | ||
| 438 | PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), /* Buffalo WLI-PCM-S11 */ | 439 | PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), /* Buffalo WLI-PCM-S11 */ |
| 439 | PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), /* Linksys WPC11 Version 2.5 */ | 440 | PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), /* Linksys WPC11 Version 2.5 */ |
| 440 | PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), /* Linksys WPC11 Version 3 */ | 441 | PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), /* Linksys WPC11 Version 3 */ |
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c index 82354b974a04..c6a370fa9bcb 100644 --- a/drivers/net/wireless/p54/p54common.c +++ b/drivers/net/wireless/p54/p54common.c | |||
| @@ -138,6 +138,7 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw) | |||
| 138 | u8 *fw_version = NULL; | 138 | u8 *fw_version = NULL; |
| 139 | size_t len; | 139 | size_t len; |
| 140 | int i; | 140 | int i; |
| 141 | int maxlen; | ||
| 141 | 142 | ||
| 142 | if (priv->rx_start) | 143 | if (priv->rx_start) |
| 143 | return 0; | 144 | return 0; |
| @@ -195,6 +196,16 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw) | |||
| 195 | else | 196 | else |
| 196 | priv->rx_mtu = (size_t) | 197 | priv->rx_mtu = (size_t) |
| 197 | 0x620 - priv->tx_hdr_len; | 198 | 0x620 - priv->tx_hdr_len; |
| 199 | maxlen = priv->tx_hdr_len + /* USB devices */ | ||
| 200 | sizeof(struct p54_rx_data) + | ||
| 201 | 4 + /* rx alignment */ | ||
| 202 | IEEE80211_MAX_FRAG_THRESHOLD; | ||
| 203 | if (priv->rx_mtu > maxlen && PAGE_SIZE == 4096) { | ||
| 204 | printk(KERN_INFO "p54: rx_mtu reduced from %d " | ||
| 205 | "to %d\n", priv->rx_mtu, | ||
| 206 | maxlen); | ||
| 207 | priv->rx_mtu = maxlen; | ||
| 208 | } | ||
| 198 | break; | 209 | break; |
| 199 | } | 210 | } |
| 200 | case BR_CODE_EXPOSED_IF: | 211 | case BR_CODE_EXPOSED_IF: |
| @@ -575,6 +586,7 @@ static int p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
| 575 | u16 freq = le16_to_cpu(hdr->freq); | 586 | u16 freq = le16_to_cpu(hdr->freq); |
| 576 | size_t header_len = sizeof(*hdr); | 587 | size_t header_len = sizeof(*hdr); |
| 577 | u32 tsf32; | 588 | u32 tsf32; |
| 589 | u8 rate = hdr->rate & 0xf; | ||
| 578 | 590 | ||
| 579 | /* | 591 | /* |
| 580 | * If the device is in a unspecified state we have to | 592 | * If the device is in a unspecified state we have to |
| @@ -603,8 +615,11 @@ static int p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
| 603 | rx_status.qual = (100 * hdr->rssi) / 127; | 615 | rx_status.qual = (100 * hdr->rssi) / 127; |
| 604 | if (hdr->rate & 0x10) | 616 | if (hdr->rate & 0x10) |
| 605 | rx_status.flag |= RX_FLAG_SHORTPRE; | 617 | rx_status.flag |= RX_FLAG_SHORTPRE; |
| 606 | rx_status.rate_idx = (dev->conf.channel->band == IEEE80211_BAND_2GHZ ? | 618 | if (dev->conf.channel->band == IEEE80211_BAND_5GHZ) |
| 607 | hdr->rate : (hdr->rate - 4)) & 0xf; | 619 | rx_status.rate_idx = (rate < 4) ? 0 : rate - 4; |
| 620 | else | ||
| 621 | rx_status.rate_idx = rate; | ||
| 622 | |||
| 608 | rx_status.freq = freq; | 623 | rx_status.freq = freq; |
| 609 | rx_status.band = dev->conf.channel->band; | 624 | rx_status.band = dev->conf.channel->band; |
| 610 | rx_status.antenna = hdr->antenna; | 625 | rx_status.antenna = hdr->antenna; |
| @@ -798,6 +813,16 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
| 798 | info->flags |= IEEE80211_TX_STAT_TX_FILTERED; | 813 | info->flags |= IEEE80211_TX_STAT_TX_FILTERED; |
| 799 | info->status.ack_signal = p54_rssi_to_dbm(dev, | 814 | info->status.ack_signal = p54_rssi_to_dbm(dev, |
| 800 | (int)payload->ack_rssi); | 815 | (int)payload->ack_rssi); |
| 816 | |||
| 817 | if (entry_data->key_type == P54_CRYPTO_TKIPMICHAEL) { | ||
| 818 | u8 *iv = (u8 *)(entry_data->align + pad + | ||
| 819 | entry_data->crypt_offset); | ||
| 820 | |||
| 821 | /* Restore the original TKIP IV. */ | ||
| 822 | iv[2] = iv[0]; | ||
| 823 | iv[0] = iv[1]; | ||
| 824 | iv[1] = (iv[0] | 0x20) & 0x7f; /* WEPSeed - 8.3.2.2 */ | ||
| 825 | } | ||
| 801 | skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data)); | 826 | skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data)); |
| 802 | ieee80211_tx_status_irqsafe(dev, entry); | 827 | ieee80211_tx_status_irqsafe(dev, entry); |
| 803 | goto out; | 828 | goto out; |
| @@ -1383,7 +1408,6 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
| 1383 | hdr->tries = ridx; | 1408 | hdr->tries = ridx; |
| 1384 | txhdr->rts_rate_idx = 0; | 1409 | txhdr->rts_rate_idx = 0; |
| 1385 | if (info->control.hw_key) { | 1410 | if (info->control.hw_key) { |
| 1386 | crypt_offset += info->control.hw_key->iv_len; | ||
| 1387 | txhdr->key_type = p54_convert_algo(info->control.hw_key->alg); | 1411 | txhdr->key_type = p54_convert_algo(info->control.hw_key->alg); |
| 1388 | txhdr->key_len = min((u8)16, info->control.hw_key->keylen); | 1412 | txhdr->key_len = min((u8)16, info->control.hw_key->keylen); |
| 1389 | memcpy(txhdr->key, info->control.hw_key->key, txhdr->key_len); | 1413 | memcpy(txhdr->key, info->control.hw_key->key, txhdr->key_len); |
| @@ -1397,6 +1421,8 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
| 1397 | } | 1421 | } |
| 1398 | /* reserve some space for ICV */ | 1422 | /* reserve some space for ICV */ |
| 1399 | len += info->control.hw_key->icv_len; | 1423 | len += info->control.hw_key->icv_len; |
| 1424 | memset(skb_put(skb, info->control.hw_key->icv_len), 0, | ||
| 1425 | info->control.hw_key->icv_len); | ||
| 1400 | } else { | 1426 | } else { |
| 1401 | txhdr->key_type = 0; | 1427 | txhdr->key_type = 0; |
| 1402 | txhdr->key_len = 0; | 1428 | txhdr->key_len = 0; |
| @@ -1824,7 +1850,7 @@ static void p54_remove_interface(struct ieee80211_hw *dev, | |||
| 1824 | 1850 | ||
| 1825 | static int p54_config(struct ieee80211_hw *dev, u32 changed) | 1851 | static int p54_config(struct ieee80211_hw *dev, u32 changed) |
| 1826 | { | 1852 | { |
| 1827 | int ret; | 1853 | int ret = 0; |
| 1828 | struct p54_common *priv = dev->priv; | 1854 | struct p54_common *priv = dev->priv; |
| 1829 | struct ieee80211_conf *conf = &dev->conf; | 1855 | struct ieee80211_conf *conf = &dev->conf; |
| 1830 | 1856 | ||
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c index c44a200059d2..6a6a72f6f82c 100644 --- a/drivers/net/wireless/p54/p54usb.c +++ b/drivers/net/wireless/p54/p54usb.c | |||
| @@ -56,6 +56,7 @@ static struct usb_device_id p54u_table[] __devinitdata = { | |||
| 56 | {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */ | 56 | {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */ |
| 57 | {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */ | 57 | {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */ |
| 58 | {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */ | 58 | {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */ |
| 59 | {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ | ||
| 59 | {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ | 60 | {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ |
| 60 | {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ | 61 | {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ |
| 61 | {USB_DEVICE(0x0846, 0x4240)}, /* Netgear WG111 (v2) */ | 62 | {USB_DEVICE(0x0846, 0x4240)}, /* Netgear WG111 (v2) */ |
| @@ -284,6 +285,7 @@ static void p54u_tx_lm87(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
| 284 | usb_fill_bulk_urb(data_urb, priv->udev, | 285 | usb_fill_bulk_urb(data_urb, priv->udev, |
| 285 | usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), | 286 | usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), |
| 286 | skb->data, skb->len, p54u_tx_cb, skb); | 287 | skb->data, skb->len, p54u_tx_cb, skb); |
| 288 | data_urb->transfer_flags |= URB_ZERO_PACKET; | ||
| 287 | 289 | ||
| 288 | usb_anchor_urb(data_urb, &priv->submitted); | 290 | usb_anchor_urb(data_urb, &priv->submitted); |
| 289 | if (usb_submit_urb(data_urb, GFP_ATOMIC)) { | 291 | if (usb_submit_urb(data_urb, GFP_ATOMIC)) { |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 30028e2422fc..af6b5847be5c 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
| @@ -38,7 +38,7 @@ | |||
| 38 | /* | 38 | /* |
| 39 | * Allow hardware encryption to be disabled. | 39 | * Allow hardware encryption to be disabled. |
| 40 | */ | 40 | */ |
| 41 | static int modparam_nohwcrypt = 1; | 41 | static int modparam_nohwcrypt = 0; |
| 42 | module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); | 42 | module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); |
| 43 | MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); | 43 | MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); |
| 44 | 44 | ||
| @@ -376,11 +376,11 @@ static int rt2500usb_config_key(struct rt2x00_dev *rt2x00dev, | |||
| 376 | 376 | ||
| 377 | /* | 377 | /* |
| 378 | * The driver does not support the IV/EIV generation | 378 | * The driver does not support the IV/EIV generation |
| 379 | * in hardware. However it doesn't support the IV/EIV | 379 | * in hardware. However it demands the data to be provided |
| 380 | * inside the ieee80211 frame either, but requires it | 380 | * both seperately as well as inside the frame. |
| 381 | * to be provided seperately for the descriptor. | 381 | * We already provided the CONFIG_CRYPTO_COPY_IV to rt2x00lib |
| 382 | * rt2x00lib will cut the IV/EIV data out of all frames | 382 | * to ensure rt2x00lib will not strip the data from the |
| 383 | * given to us by mac80211, but we must tell mac80211 | 383 | * frame after the copy, now we must tell mac80211 |
| 384 | * to generate the IV/EIV data. | 384 | * to generate the IV/EIV data. |
| 385 | */ | 385 | */ |
| 386 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | 386 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; |
| @@ -1181,7 +1181,7 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
| 1181 | test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags)); | 1181 | test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags)); |
| 1182 | rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs); | 1182 | rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs); |
| 1183 | rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, skb->len); | 1183 | rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, skb->len); |
| 1184 | rt2x00_set_field32(&word, TXD_W0_CIPHER, txdesc->cipher); | 1184 | rt2x00_set_field32(&word, TXD_W0_CIPHER, !!txdesc->cipher); |
| 1185 | rt2x00_set_field32(&word, TXD_W0_KEY_ID, txdesc->key_idx); | 1185 | rt2x00_set_field32(&word, TXD_W0_KEY_ID, txdesc->key_idx); |
| 1186 | rt2x00_desc_write(txd, 0, word); | 1186 | rt2x00_desc_write(txd, 0, word); |
| 1187 | } | 1187 | } |
| @@ -1334,14 +1334,7 @@ static void rt2500usb_fill_rxdone(struct queue_entry *entry, | |||
| 1334 | 1334 | ||
| 1335 | /* ICV is located at the end of frame */ | 1335 | /* ICV is located at the end of frame */ |
| 1336 | 1336 | ||
| 1337 | /* | 1337 | rxdesc->flags |= RX_FLAG_MMIC_STRIPPED; |
| 1338 | * Hardware has stripped IV/EIV data from 802.11 frame during | ||
| 1339 | * decryption. It has provided the data seperately but rt2x00lib | ||
| 1340 | * should decide if it should be reinserted. | ||
| 1341 | */ | ||
| 1342 | rxdesc->flags |= RX_FLAG_IV_STRIPPED; | ||
| 1343 | if (rxdesc->cipher != CIPHER_TKIP) | ||
| 1344 | rxdesc->flags |= RX_FLAG_MMIC_STRIPPED; | ||
| 1345 | if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) | 1338 | if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) |
| 1346 | rxdesc->flags |= RX_FLAG_DECRYPTED; | 1339 | rxdesc->flags |= RX_FLAG_DECRYPTED; |
| 1347 | else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) | 1340 | else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 6d92542fcf0d..87c0f2c83077 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
| @@ -807,13 +807,11 @@ static void rt2x00lib_rate(struct ieee80211_rate *entry, | |||
| 807 | { | 807 | { |
| 808 | entry->flags = 0; | 808 | entry->flags = 0; |
| 809 | entry->bitrate = rate->bitrate; | 809 | entry->bitrate = rate->bitrate; |
| 810 | entry->hw_value = rt2x00_create_rate_hw_value(index, 0); | 810 | entry->hw_value =index; |
| 811 | entry->hw_value_short = entry->hw_value; | 811 | entry->hw_value_short = index; |
| 812 | 812 | ||
| 813 | if (rate->flags & DEV_RATE_SHORT_PREAMBLE) { | 813 | if (rate->flags & DEV_RATE_SHORT_PREAMBLE) |
| 814 | entry->flags |= IEEE80211_RATE_SHORT_PREAMBLE; | 814 | entry->flags |= IEEE80211_RATE_SHORT_PREAMBLE; |
| 815 | entry->hw_value_short |= rt2x00_create_rate_hw_value(index, 1); | ||
| 816 | } | ||
| 817 | } | 815 | } |
| 818 | 816 | ||
| 819 | static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev, | 817 | static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00leds.c b/drivers/net/wireless/rt2x00/rt2x00leds.c index 68f4e0fc35b9..a0cd35b6beb5 100644 --- a/drivers/net/wireless/rt2x00/rt2x00leds.c +++ b/drivers/net/wireless/rt2x00/rt2x00leds.c | |||
| @@ -97,7 +97,7 @@ void rt2x00leds_led_assoc(struct rt2x00_dev *rt2x00dev, bool enabled) | |||
| 97 | 97 | ||
| 98 | void rt2x00leds_led_radio(struct rt2x00_dev *rt2x00dev, bool enabled) | 98 | void rt2x00leds_led_radio(struct rt2x00_dev *rt2x00dev, bool enabled) |
| 99 | { | 99 | { |
| 100 | if (rt2x00dev->led_radio.type == LED_TYPE_ASSOC) | 100 | if (rt2x00dev->led_radio.type == LED_TYPE_RADIO) |
| 101 | rt2x00led_led_simple(&rt2x00dev->led_radio, enabled); | 101 | rt2x00led_led_simple(&rt2x00dev->led_radio, enabled); |
| 102 | } | 102 | } |
| 103 | 103 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h index 03024327767b..86cd26fbf769 100644 --- a/drivers/net/wireless/rt2x00/rt2x00lib.h +++ b/drivers/net/wireless/rt2x00/rt2x00lib.h | |||
| @@ -52,22 +52,11 @@ struct rt2x00_rate { | |||
| 52 | 52 | ||
| 53 | extern const struct rt2x00_rate rt2x00_supported_rates[12]; | 53 | extern const struct rt2x00_rate rt2x00_supported_rates[12]; |
| 54 | 54 | ||
| 55 | static inline u16 rt2x00_create_rate_hw_value(const u16 index, | ||
| 56 | const u16 short_preamble) | ||
| 57 | { | ||
| 58 | return (short_preamble << 8) | (index & 0xff); | ||
| 59 | } | ||
| 60 | |||
| 61 | static inline const struct rt2x00_rate *rt2x00_get_rate(const u16 hw_value) | 55 | static inline const struct rt2x00_rate *rt2x00_get_rate(const u16 hw_value) |
| 62 | { | 56 | { |
| 63 | return &rt2x00_supported_rates[hw_value & 0xff]; | 57 | return &rt2x00_supported_rates[hw_value & 0xff]; |
| 64 | } | 58 | } |
| 65 | 59 | ||
| 66 | static inline int rt2x00_get_rate_preamble(const u16 hw_value) | ||
| 67 | { | ||
| 68 | return (hw_value & 0xff00); | ||
| 69 | } | ||
| 70 | |||
| 71 | /* | 60 | /* |
| 72 | * Radio control handlers. | 61 | * Radio control handlers. |
| 73 | */ | 62 | */ |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index eaec6bd93ed5..746a8f36b931 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
| @@ -313,7 +313,7 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, | |||
| 313 | * When preamble is enabled we should set the | 313 | * When preamble is enabled we should set the |
| 314 | * preamble bit for the signal. | 314 | * preamble bit for the signal. |
| 315 | */ | 315 | */ |
| 316 | if (rt2x00_get_rate_preamble(rate->hw_value)) | 316 | if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) |
| 317 | txdesc->signal |= 0x08; | 317 | txdesc->signal |= 0x08; |
| 318 | } | 318 | } |
| 319 | } | 319 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 83df312ac56f..0b29d767a258 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
| @@ -434,11 +434,11 @@ static int rt2x00usb_find_endpoints(struct rt2x00_dev *rt2x00dev) | |||
| 434 | 434 | ||
| 435 | if (usb_endpoint_is_bulk_in(ep_desc)) { | 435 | if (usb_endpoint_is_bulk_in(ep_desc)) { |
| 436 | rt2x00usb_assign_endpoint(rt2x00dev->rx, ep_desc); | 436 | rt2x00usb_assign_endpoint(rt2x00dev->rx, ep_desc); |
| 437 | } else if (usb_endpoint_is_bulk_out(ep_desc)) { | 437 | } else if (usb_endpoint_is_bulk_out(ep_desc) && |
| 438 | (queue != queue_end(rt2x00dev))) { | ||
| 438 | rt2x00usb_assign_endpoint(queue, ep_desc); | 439 | rt2x00usb_assign_endpoint(queue, ep_desc); |
| 440 | queue = queue_next(queue); | ||
| 439 | 441 | ||
| 440 | if (queue != queue_end(rt2x00dev)) | ||
| 441 | queue = queue_next(queue); | ||
| 442 | tx_ep_desc = ep_desc; | 442 | tx_ep_desc = ep_desc; |
| 443 | } | 443 | } |
| 444 | } | 444 | } |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index d638a8a59370..96a8d69f8790 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
| @@ -2321,6 +2321,7 @@ static struct usb_device_id rt73usb_device_table[] = { | |||
| 2321 | /* Linksys */ | 2321 | /* Linksys */ |
| 2322 | { USB_DEVICE(0x13b1, 0x0020), USB_DEVICE_DATA(&rt73usb_ops) }, | 2322 | { USB_DEVICE(0x13b1, 0x0020), USB_DEVICE_DATA(&rt73usb_ops) }, |
| 2323 | { USB_DEVICE(0x13b1, 0x0023), USB_DEVICE_DATA(&rt73usb_ops) }, | 2323 | { USB_DEVICE(0x13b1, 0x0023), USB_DEVICE_DATA(&rt73usb_ops) }, |
| 2324 | { USB_DEVICE(0x13b1, 0x0028), USB_DEVICE_DATA(&rt73usb_ops) }, | ||
| 2324 | /* MSI */ | 2325 | /* MSI */ |
| 2325 | { USB_DEVICE(0x0db0, 0x6877), USB_DEVICE_DATA(&rt73usb_ops) }, | 2326 | { USB_DEVICE(0x0db0, 0x6877), USB_DEVICE_DATA(&rt73usb_ops) }, |
| 2326 | { USB_DEVICE(0x0db0, 0x6874), USB_DEVICE_DATA(&rt73usb_ops) }, | 2327 | { USB_DEVICE(0x0db0, 0x6874), USB_DEVICE_DATA(&rt73usb_ops) }, |
diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180_dev.c index 5f887fb137a9..387c133ec0f2 100644 --- a/drivers/net/wireless/rtl818x/rtl8180_dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180_dev.c | |||
| @@ -897,6 +897,7 @@ static int __devinit rtl8180_probe(struct pci_dev *pdev, | |||
| 897 | dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | | 897 | dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | |
| 898 | IEEE80211_HW_RX_INCLUDES_FCS | | 898 | IEEE80211_HW_RX_INCLUDES_FCS | |
| 899 | IEEE80211_HW_SIGNAL_UNSPEC; | 899 | IEEE80211_HW_SIGNAL_UNSPEC; |
| 900 | dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); | ||
| 900 | dev->queues = 1; | 901 | dev->queues = 1; |
| 901 | dev->max_signal = 65; | 902 | dev->max_signal = 65; |
| 902 | 903 | ||
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c index 00ce3ef39abe..6ad6bac37706 100644 --- a/drivers/net/wireless/rtl818x/rtl8187_dev.c +++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c | |||
| @@ -213,7 +213,7 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
| 213 | urb = usb_alloc_urb(0, GFP_ATOMIC); | 213 | urb = usb_alloc_urb(0, GFP_ATOMIC); |
| 214 | if (!urb) { | 214 | if (!urb) { |
| 215 | kfree_skb(skb); | 215 | kfree_skb(skb); |
| 216 | return -ENOMEM; | 216 | return NETDEV_TX_OK; |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | flags = skb->len; | 219 | flags = skb->len; |
| @@ -281,7 +281,7 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
| 281 | } | 281 | } |
| 282 | usb_free_urb(urb); | 282 | usb_free_urb(urb); |
| 283 | 283 | ||
| 284 | return rc; | 284 | return NETDEV_TX_OK; |
| 285 | } | 285 | } |
| 286 | 286 | ||
| 287 | static void rtl8187_rx_cb(struct urb *urb) | 287 | static void rtl8187_rx_cb(struct urb *urb) |
| @@ -1471,6 +1471,7 @@ static void __devexit rtl8187_disconnect(struct usb_interface *intf) | |||
| 1471 | ieee80211_unregister_hw(dev); | 1471 | ieee80211_unregister_hw(dev); |
| 1472 | 1472 | ||
| 1473 | priv = dev->priv; | 1473 | priv = dev->priv; |
| 1474 | usb_reset_device(priv->udev); | ||
| 1474 | usb_put_dev(interface_to_usbdev(intf)); | 1475 | usb_put_dev(interface_to_usbdev(intf)); |
| 1475 | ieee80211_free_hw(dev); | 1476 | ieee80211_free_hw(dev); |
| 1476 | } | 1477 | } |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index f24556813375..ec54785d34f9 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -467,7 +467,7 @@ struct netdev_queue { | |||
| 467 | * This function is called when network device transistions to the down | 467 | * This function is called when network device transistions to the down |
| 468 | * state. | 468 | * state. |
| 469 | * | 469 | * |
| 470 | * int (*ndo_hard_start_xmit)(struct sk_buff *skb, struct net_device *dev); | 470 | * int (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev); |
| 471 | * Called when a packet needs to be transmitted. | 471 | * Called when a packet needs to be transmitted. |
| 472 | * Must return NETDEV_TX_OK , NETDEV_TX_BUSY, or NETDEV_TX_LOCKED, | 472 | * Must return NETDEV_TX_OK , NETDEV_TX_BUSY, or NETDEV_TX_LOCKED, |
| 473 | * Required can not be NULL. | 473 | * Required can not be NULL. |
| @@ -795,6 +795,7 @@ struct net_device | |||
| 795 | NETREG_UNREGISTERING, /* called unregister_netdevice */ | 795 | NETREG_UNREGISTERING, /* called unregister_netdevice */ |
| 796 | NETREG_UNREGISTERED, /* completed unregister todo */ | 796 | NETREG_UNREGISTERED, /* completed unregister todo */ |
| 797 | NETREG_RELEASED, /* called free_netdev */ | 797 | NETREG_RELEASED, /* called free_netdev */ |
| 798 | NETREG_DUMMY, /* dummy device for NAPI poll */ | ||
| 798 | } reg_state; | 799 | } reg_state; |
| 799 | 800 | ||
| 800 | /* Called from unregister, can be used to call free_netdev */ | 801 | /* Called from unregister, can be used to call free_netdev */ |
| @@ -1077,6 +1078,8 @@ extern void free_netdev(struct net_device *dev); | |||
| 1077 | extern void synchronize_net(void); | 1078 | extern void synchronize_net(void); |
| 1078 | extern int register_netdevice_notifier(struct notifier_block *nb); | 1079 | extern int register_netdevice_notifier(struct notifier_block *nb); |
| 1079 | extern int unregister_netdevice_notifier(struct notifier_block *nb); | 1080 | extern int unregister_netdevice_notifier(struct notifier_block *nb); |
| 1081 | extern int init_dummy_netdev(struct net_device *dev); | ||
| 1082 | |||
| 1080 | extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); | 1083 | extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); |
| 1081 | extern struct net_device *dev_get_by_index(struct net *net, int ifindex); | 1084 | extern struct net_device *dev_get_by_index(struct net *net, int ifindex); |
| 1082 | extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); | 1085 | extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); |
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h index e52ce475d19f..c7ee8744d26b 100644 --- a/include/linux/netfilter/x_tables.h +++ b/include/linux/netfilter/x_tables.h | |||
| @@ -270,6 +270,7 @@ struct xt_match | |||
| 270 | struct list_head list; | 270 | struct list_head list; |
| 271 | 271 | ||
| 272 | const char name[XT_FUNCTION_MAXNAMELEN-1]; | 272 | const char name[XT_FUNCTION_MAXNAMELEN-1]; |
| 273 | u_int8_t revision; | ||
| 273 | 274 | ||
| 274 | /* Return true or false: return FALSE and set *hotdrop = 1 to | 275 | /* Return true or false: return FALSE and set *hotdrop = 1 to |
| 275 | force immediate packet drop. */ | 276 | force immediate packet drop. */ |
| @@ -302,7 +303,6 @@ struct xt_match | |||
| 302 | unsigned short proto; | 303 | unsigned short proto; |
| 303 | 304 | ||
| 304 | unsigned short family; | 305 | unsigned short family; |
| 305 | u_int8_t revision; | ||
| 306 | }; | 306 | }; |
| 307 | 307 | ||
| 308 | /* Registration hooks for targets. */ | 308 | /* Registration hooks for targets. */ |
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index a65e43a17fbb..cf754ace0b75 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
| @@ -58,11 +58,11 @@ static struct ctl_table_header *brnf_sysctl_header; | |||
| 58 | static int brnf_call_iptables __read_mostly = 1; | 58 | static int brnf_call_iptables __read_mostly = 1; |
| 59 | static int brnf_call_ip6tables __read_mostly = 1; | 59 | static int brnf_call_ip6tables __read_mostly = 1; |
| 60 | static int brnf_call_arptables __read_mostly = 1; | 60 | static int brnf_call_arptables __read_mostly = 1; |
| 61 | static int brnf_filter_vlan_tagged __read_mostly = 1; | 61 | static int brnf_filter_vlan_tagged __read_mostly = 0; |
| 62 | static int brnf_filter_pppoe_tagged __read_mostly = 1; | 62 | static int brnf_filter_pppoe_tagged __read_mostly = 0; |
| 63 | #else | 63 | #else |
| 64 | #define brnf_filter_vlan_tagged 1 | 64 | #define brnf_filter_vlan_tagged 0 |
| 65 | #define brnf_filter_pppoe_tagged 1 | 65 | #define brnf_filter_pppoe_tagged 0 |
| 66 | #endif | 66 | #endif |
| 67 | 67 | ||
| 68 | static inline __be16 vlan_proto(const struct sk_buff *skb) | 68 | static inline __be16 vlan_proto(const struct sk_buff *skb) |
| @@ -686,8 +686,11 @@ static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff *skb, | |||
| 686 | if (skb->protocol == htons(ETH_P_IP) || IS_VLAN_IP(skb) || | 686 | if (skb->protocol == htons(ETH_P_IP) || IS_VLAN_IP(skb) || |
| 687 | IS_PPPOE_IP(skb)) | 687 | IS_PPPOE_IP(skb)) |
| 688 | pf = PF_INET; | 688 | pf = PF_INET; |
| 689 | else | 689 | else if (skb->protocol == htons(ETH_P_IPV6) || IS_VLAN_IPV6(skb) || |
| 690 | IS_PPPOE_IPV6(skb)) | ||
| 690 | pf = PF_INET6; | 691 | pf = PF_INET6; |
| 692 | else | ||
| 693 | return NF_ACCEPT; | ||
| 691 | 694 | ||
| 692 | nf_bridge_pull_encap_header(skb); | 695 | nf_bridge_pull_encap_header(skb); |
| 693 | 696 | ||
| @@ -828,8 +831,11 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff *skb, | |||
| 828 | if (skb->protocol == htons(ETH_P_IP) || IS_VLAN_IP(skb) || | 831 | if (skb->protocol == htons(ETH_P_IP) || IS_VLAN_IP(skb) || |
| 829 | IS_PPPOE_IP(skb)) | 832 | IS_PPPOE_IP(skb)) |
| 830 | pf = PF_INET; | 833 | pf = PF_INET; |
| 831 | else | 834 | else if (skb->protocol == htons(ETH_P_IPV6) || IS_VLAN_IPV6(skb) || |
| 835 | IS_PPPOE_IPV6(skb)) | ||
| 832 | pf = PF_INET6; | 836 | pf = PF_INET6; |
| 837 | else | ||
| 838 | return NF_ACCEPT; | ||
| 833 | 839 | ||
| 834 | #ifdef CONFIG_NETFILTER_DEBUG | 840 | #ifdef CONFIG_NETFILTER_DEBUG |
| 835 | if (skb->dst == NULL) { | 841 | if (skb->dst == NULL) { |
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index 8a8743d7d6e7..820252aee81f 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
| @@ -79,7 +79,7 @@ static inline int ebt_do_match (struct ebt_entry_match *m, | |||
| 79 | { | 79 | { |
| 80 | par->match = m->u.match; | 80 | par->match = m->u.match; |
| 81 | par->matchinfo = m->data; | 81 | par->matchinfo = m->data; |
| 82 | return m->u.match->match(skb, par); | 82 | return m->u.match->match(skb, par) ? EBT_MATCH : EBT_NOMATCH; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | static inline int ebt_dev_check(char *entry, const struct net_device *device) | 85 | static inline int ebt_dev_check(char *entry, const struct net_device *device) |
diff --git a/net/can/bcm.c b/net/can/bcm.c index 1649c8ab2c2f..b7c7d4651136 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c | |||
| @@ -347,51 +347,54 @@ static void bcm_tx_timeout_tsklet(unsigned long data) | |||
| 347 | struct bcm_op *op = (struct bcm_op *)data; | 347 | struct bcm_op *op = (struct bcm_op *)data; |
| 348 | struct bcm_msg_head msg_head; | 348 | struct bcm_msg_head msg_head; |
| 349 | 349 | ||
| 350 | /* create notification to user */ | ||
| 351 | msg_head.opcode = TX_EXPIRED; | ||
| 352 | msg_head.flags = op->flags; | ||
| 353 | msg_head.count = op->count; | ||
| 354 | msg_head.ival1 = op->ival1; | ||
| 355 | msg_head.ival2 = op->ival2; | ||
| 356 | msg_head.can_id = op->can_id; | ||
| 357 | msg_head.nframes = 0; | ||
| 358 | |||
| 359 | bcm_send_to_user(op, &msg_head, NULL, 0); | ||
| 360 | } | ||
| 361 | |||
| 362 | /* | ||
| 363 | * bcm_tx_timeout_handler - performes cyclic CAN frame transmissions | ||
| 364 | */ | ||
| 365 | static enum hrtimer_restart bcm_tx_timeout_handler(struct hrtimer *hrtimer) | ||
| 366 | { | ||
| 367 | struct bcm_op *op = container_of(hrtimer, struct bcm_op, timer); | ||
| 368 | enum hrtimer_restart ret = HRTIMER_NORESTART; | ||
| 369 | |||
| 370 | if (op->kt_ival1.tv64 && (op->count > 0)) { | 350 | if (op->kt_ival1.tv64 && (op->count > 0)) { |
| 371 | 351 | ||
| 372 | op->count--; | 352 | op->count--; |
| 373 | if (!op->count && (op->flags & TX_COUNTEVT)) | 353 | if (!op->count && (op->flags & TX_COUNTEVT)) { |
| 374 | tasklet_schedule(&op->tsklet); | 354 | |
| 355 | /* create notification to user */ | ||
| 356 | msg_head.opcode = TX_EXPIRED; | ||
| 357 | msg_head.flags = op->flags; | ||
| 358 | msg_head.count = op->count; | ||
| 359 | msg_head.ival1 = op->ival1; | ||
| 360 | msg_head.ival2 = op->ival2; | ||
| 361 | msg_head.can_id = op->can_id; | ||
| 362 | msg_head.nframes = 0; | ||
| 363 | |||
| 364 | bcm_send_to_user(op, &msg_head, NULL, 0); | ||
| 365 | } | ||
| 375 | } | 366 | } |
| 376 | 367 | ||
| 377 | if (op->kt_ival1.tv64 && (op->count > 0)) { | 368 | if (op->kt_ival1.tv64 && (op->count > 0)) { |
| 378 | 369 | ||
| 379 | /* send (next) frame */ | 370 | /* send (next) frame */ |
| 380 | bcm_can_tx(op); | 371 | bcm_can_tx(op); |
| 381 | hrtimer_forward(hrtimer, ktime_get(), op->kt_ival1); | 372 | hrtimer_start(&op->timer, |
| 382 | ret = HRTIMER_RESTART; | 373 | ktime_add(ktime_get(), op->kt_ival1), |
| 374 | HRTIMER_MODE_ABS); | ||
| 383 | 375 | ||
| 384 | } else { | 376 | } else { |
| 385 | if (op->kt_ival2.tv64) { | 377 | if (op->kt_ival2.tv64) { |
| 386 | 378 | ||
| 387 | /* send (next) frame */ | 379 | /* send (next) frame */ |
| 388 | bcm_can_tx(op); | 380 | bcm_can_tx(op); |
| 389 | hrtimer_forward(hrtimer, ktime_get(), op->kt_ival2); | 381 | hrtimer_start(&op->timer, |
| 390 | ret = HRTIMER_RESTART; | 382 | ktime_add(ktime_get(), op->kt_ival2), |
| 383 | HRTIMER_MODE_ABS); | ||
| 391 | } | 384 | } |
| 392 | } | 385 | } |
| 386 | } | ||
| 393 | 387 | ||
| 394 | return ret; | 388 | /* |
| 389 | * bcm_tx_timeout_handler - performes cyclic CAN frame transmissions | ||
| 390 | */ | ||
| 391 | static enum hrtimer_restart bcm_tx_timeout_handler(struct hrtimer *hrtimer) | ||
| 392 | { | ||
| 393 | struct bcm_op *op = container_of(hrtimer, struct bcm_op, timer); | ||
| 394 | |||
| 395 | tasklet_schedule(&op->tsklet); | ||
| 396 | |||
| 397 | return HRTIMER_NORESTART; | ||
| 395 | } | 398 | } |
| 396 | 399 | ||
| 397 | /* | 400 | /* |
diff --git a/net/core/dev.c b/net/core/dev.c index b715a55cccc4..8d675975d85b 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -2392,6 +2392,9 @@ int dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb) | |||
| 2392 | if (!(skb->dev->features & NETIF_F_GRO)) | 2392 | if (!(skb->dev->features & NETIF_F_GRO)) |
| 2393 | goto normal; | 2393 | goto normal; |
| 2394 | 2394 | ||
| 2395 | if (skb_is_gso(skb) || skb_shinfo(skb)->frag_list) | ||
| 2396 | goto normal; | ||
| 2397 | |||
| 2395 | rcu_read_lock(); | 2398 | rcu_read_lock(); |
| 2396 | list_for_each_entry_rcu(ptype, head, list) { | 2399 | list_for_each_entry_rcu(ptype, head, list) { |
| 2397 | struct sk_buff *p; | 2400 | struct sk_buff *p; |
| @@ -2488,12 +2491,6 @@ EXPORT_SYMBOL(napi_gro_receive); | |||
| 2488 | 2491 | ||
| 2489 | void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) | 2492 | void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) |
| 2490 | { | 2493 | { |
| 2491 | skb_shinfo(skb)->nr_frags = 0; | ||
| 2492 | |||
| 2493 | skb->len -= skb->data_len; | ||
| 2494 | skb->truesize -= skb->data_len; | ||
| 2495 | skb->data_len = 0; | ||
| 2496 | |||
| 2497 | __skb_pull(skb, skb_headlen(skb)); | 2494 | __skb_pull(skb, skb_headlen(skb)); |
| 2498 | skb_reserve(skb, NET_IP_ALIGN - skb_headroom(skb)); | 2495 | skb_reserve(skb, NET_IP_ALIGN - skb_headroom(skb)); |
| 2499 | 2496 | ||
| @@ -4434,6 +4431,45 @@ err_uninit: | |||
| 4434 | } | 4431 | } |
| 4435 | 4432 | ||
| 4436 | /** | 4433 | /** |
| 4434 | * init_dummy_netdev - init a dummy network device for NAPI | ||
| 4435 | * @dev: device to init | ||
| 4436 | * | ||
| 4437 | * This takes a network device structure and initialize the minimum | ||
| 4438 | * amount of fields so it can be used to schedule NAPI polls without | ||
| 4439 | * registering a full blown interface. This is to be used by drivers | ||
| 4440 | * that need to tie several hardware interfaces to a single NAPI | ||
| 4441 | * poll scheduler due to HW limitations. | ||
| 4442 | */ | ||
| 4443 | int init_dummy_netdev(struct net_device *dev) | ||
| 4444 | { | ||
| 4445 | /* Clear everything. Note we don't initialize spinlocks | ||
| 4446 | * are they aren't supposed to be taken by any of the | ||
| 4447 | * NAPI code and this dummy netdev is supposed to be | ||
| 4448 | * only ever used for NAPI polls | ||
| 4449 | */ | ||
| 4450 | memset(dev, 0, sizeof(struct net_device)); | ||
| 4451 | |||
| 4452 | /* make sure we BUG if trying to hit standard | ||
| 4453 | * register/unregister code path | ||
| 4454 | */ | ||
| 4455 | dev->reg_state = NETREG_DUMMY; | ||
| 4456 | |||
| 4457 | /* initialize the ref count */ | ||
| 4458 | atomic_set(&dev->refcnt, 1); | ||
| 4459 | |||
| 4460 | /* NAPI wants this */ | ||
| 4461 | INIT_LIST_HEAD(&dev->napi_list); | ||
| 4462 | |||
| 4463 | /* a dummy interface is started by default */ | ||
| 4464 | set_bit(__LINK_STATE_PRESENT, &dev->state); | ||
| 4465 | set_bit(__LINK_STATE_START, &dev->state); | ||
| 4466 | |||
| 4467 | return 0; | ||
| 4468 | } | ||
| 4469 | EXPORT_SYMBOL_GPL(init_dummy_netdev); | ||
| 4470 | |||
| 4471 | |||
| 4472 | /** | ||
| 4437 | * register_netdev - register a network device | 4473 | * register_netdev - register a network device |
| 4438 | * @dev: device to register | 4474 | * @dev: device to register |
| 4439 | * | 4475 | * |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 5110b359c758..65eac7739033 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
| @@ -2602,6 +2602,12 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) | |||
| 2602 | skb_shinfo(skb)->nr_frags * sizeof(skb_frag_t)); | 2602 | skb_shinfo(skb)->nr_frags * sizeof(skb_frag_t)); |
| 2603 | 2603 | ||
| 2604 | skb_shinfo(p)->nr_frags += skb_shinfo(skb)->nr_frags; | 2604 | skb_shinfo(p)->nr_frags += skb_shinfo(skb)->nr_frags; |
| 2605 | skb_shinfo(skb)->nr_frags = 0; | ||
| 2606 | |||
| 2607 | skb->truesize -= skb->data_len; | ||
| 2608 | skb->len -= skb->data_len; | ||
| 2609 | skb->data_len = 0; | ||
| 2610 | |||
| 2605 | NAPI_GRO_CB(skb)->free = 1; | 2611 | NAPI_GRO_CB(skb)->free = 1; |
| 2606 | goto done; | 2612 | goto done; |
| 2607 | } | 2613 | } |
diff --git a/net/ipv4/netfilter/iptable_filter.c b/net/ipv4/netfilter/iptable_filter.c index c9224310ebae..52cb6939d093 100644 --- a/net/ipv4/netfilter/iptable_filter.c +++ b/net/ipv4/netfilter/iptable_filter.c | |||
| @@ -93,13 +93,8 @@ ipt_local_out_hook(unsigned int hook, | |||
| 93 | { | 93 | { |
| 94 | /* root is playing with raw sockets. */ | 94 | /* root is playing with raw sockets. */ |
| 95 | if (skb->len < sizeof(struct iphdr) || | 95 | if (skb->len < sizeof(struct iphdr) || |
| 96 | ip_hdrlen(skb) < sizeof(struct iphdr)) { | 96 | ip_hdrlen(skb) < sizeof(struct iphdr)) |
| 97 | if (net_ratelimit()) | ||
| 98 | printk("iptable_filter: ignoring short SOCK_RAW " | ||
| 99 | "packet.\n"); | ||
| 100 | return NF_ACCEPT; | 97 | return NF_ACCEPT; |
| 101 | } | ||
| 102 | |||
| 103 | return ipt_do_table(skb, hook, in, out, | 98 | return ipt_do_table(skb, hook, in, out, |
| 104 | dev_net(out)->ipv4.iptable_filter); | 99 | dev_net(out)->ipv4.iptable_filter); |
| 105 | } | 100 | } |
diff --git a/net/ipv4/netfilter/iptable_mangle.c b/net/ipv4/netfilter/iptable_mangle.c index 69f2c4287146..3929d20b9e45 100644 --- a/net/ipv4/netfilter/iptable_mangle.c +++ b/net/ipv4/netfilter/iptable_mangle.c | |||
| @@ -132,12 +132,8 @@ ipt_local_hook(unsigned int hook, | |||
| 132 | 132 | ||
| 133 | /* root is playing with raw sockets. */ | 133 | /* root is playing with raw sockets. */ |
| 134 | if (skb->len < sizeof(struct iphdr) | 134 | if (skb->len < sizeof(struct iphdr) |
| 135 | || ip_hdrlen(skb) < sizeof(struct iphdr)) { | 135 | || ip_hdrlen(skb) < sizeof(struct iphdr)) |
| 136 | if (net_ratelimit()) | ||
| 137 | printk("iptable_mangle: ignoring short SOCK_RAW " | ||
| 138 | "packet.\n"); | ||
| 139 | return NF_ACCEPT; | 136 | return NF_ACCEPT; |
| 140 | } | ||
| 141 | 137 | ||
| 142 | /* Save things which could affect route */ | 138 | /* Save things which could affect route */ |
| 143 | mark = skb->mark; | 139 | mark = skb->mark; |
diff --git a/net/ipv4/netfilter/iptable_raw.c b/net/ipv4/netfilter/iptable_raw.c index 8faebfe638f1..7f65d18333e3 100644 --- a/net/ipv4/netfilter/iptable_raw.c +++ b/net/ipv4/netfilter/iptable_raw.c | |||
| @@ -65,12 +65,8 @@ ipt_local_hook(unsigned int hook, | |||
| 65 | { | 65 | { |
| 66 | /* root is playing with raw sockets. */ | 66 | /* root is playing with raw sockets. */ |
| 67 | if (skb->len < sizeof(struct iphdr) || | 67 | if (skb->len < sizeof(struct iphdr) || |
| 68 | ip_hdrlen(skb) < sizeof(struct iphdr)) { | 68 | ip_hdrlen(skb) < sizeof(struct iphdr)) |
| 69 | if (net_ratelimit()) | ||
| 70 | printk("iptable_raw: ignoring short SOCK_RAW " | ||
| 71 | "packet.\n"); | ||
| 72 | return NF_ACCEPT; | 69 | return NF_ACCEPT; |
| 73 | } | ||
| 74 | return ipt_do_table(skb, hook, in, out, | 70 | return ipt_do_table(skb, hook, in, out, |
| 75 | dev_net(out)->ipv4.iptable_raw); | 71 | dev_net(out)->ipv4.iptable_raw); |
| 76 | } | 72 | } |
diff --git a/net/ipv4/netfilter/iptable_security.c b/net/ipv4/netfilter/iptable_security.c index 36f3be3cc428..a52a35f4a584 100644 --- a/net/ipv4/netfilter/iptable_security.c +++ b/net/ipv4/netfilter/iptable_security.c | |||
| @@ -96,12 +96,8 @@ ipt_local_out_hook(unsigned int hook, | |||
| 96 | { | 96 | { |
| 97 | /* Somebody is playing with raw sockets. */ | 97 | /* Somebody is playing with raw sockets. */ |
| 98 | if (skb->len < sizeof(struct iphdr) | 98 | if (skb->len < sizeof(struct iphdr) |
| 99 | || ip_hdrlen(skb) < sizeof(struct iphdr)) { | 99 | || ip_hdrlen(skb) < sizeof(struct iphdr)) |
| 100 | if (net_ratelimit()) | ||
| 101 | printk(KERN_INFO "iptable_security: ignoring short " | ||
| 102 | "SOCK_RAW packet.\n"); | ||
| 103 | return NF_ACCEPT; | 100 | return NF_ACCEPT; |
| 104 | } | ||
| 105 | return ipt_do_table(skb, hook, in, out, | 101 | return ipt_do_table(skb, hook, in, out, |
| 106 | dev_net(out)->ipv4.iptable_security); | 102 | dev_net(out)->ipv4.iptable_security); |
| 107 | } | 103 | } |
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c index b2141e11575e..4beb04fac588 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | |||
| @@ -145,11 +145,8 @@ static unsigned int ipv4_conntrack_local(unsigned int hooknum, | |||
| 145 | { | 145 | { |
| 146 | /* root is playing with raw sockets. */ | 146 | /* root is playing with raw sockets. */ |
| 147 | if (skb->len < sizeof(struct iphdr) || | 147 | if (skb->len < sizeof(struct iphdr) || |
| 148 | ip_hdrlen(skb) < sizeof(struct iphdr)) { | 148 | ip_hdrlen(skb) < sizeof(struct iphdr)) |
| 149 | if (net_ratelimit()) | ||
| 150 | printk("ipt_hook: happy cracking.\n"); | ||
| 151 | return NF_ACCEPT; | 149 | return NF_ACCEPT; |
| 152 | } | ||
| 153 | return nf_conntrack_in(dev_net(out), PF_INET, hooknum, skb); | 150 | return nf_conntrack_in(dev_net(out), PF_INET, hooknum, skb); |
| 154 | } | 151 | } |
| 155 | 152 | ||
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c index 1fd3ef7718b6..2a8bee26f43d 100644 --- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c +++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | #include <net/netfilter/nf_conntrack_core.h> | 20 | #include <net/netfilter/nf_conntrack_core.h> |
| 21 | #include <net/netfilter/nf_log.h> | 21 | #include <net/netfilter/nf_log.h> |
| 22 | 22 | ||
| 23 | static unsigned long nf_ct_icmp_timeout __read_mostly = 30*HZ; | 23 | static unsigned int nf_ct_icmp_timeout __read_mostly = 30*HZ; |
| 24 | 24 | ||
| 25 | static bool icmp_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff, | 25 | static bool icmp_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff, |
| 26 | struct nf_conntrack_tuple *tuple) | 26 | struct nf_conntrack_tuple *tuple) |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index ce572f9dff02..0cd71b84e483 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
| @@ -522,8 +522,12 @@ static int tcp_splice_data_recv(read_descriptor_t *rd_desc, struct sk_buff *skb, | |||
| 522 | unsigned int offset, size_t len) | 522 | unsigned int offset, size_t len) |
| 523 | { | 523 | { |
| 524 | struct tcp_splice_state *tss = rd_desc->arg.data; | 524 | struct tcp_splice_state *tss = rd_desc->arg.data; |
| 525 | int ret; | ||
| 525 | 526 | ||
| 526 | return skb_splice_bits(skb, offset, tss->pipe, tss->len, tss->flags); | 527 | ret = skb_splice_bits(skb, offset, tss->pipe, rd_desc->count, tss->flags); |
| 528 | if (ret > 0) | ||
| 529 | rd_desc->count -= ret; | ||
| 530 | return ret; | ||
| 527 | } | 531 | } |
| 528 | 532 | ||
| 529 | static int __tcp_splice_read(struct sock *sk, struct tcp_splice_state *tss) | 533 | static int __tcp_splice_read(struct sock *sk, struct tcp_splice_state *tss) |
| @@ -531,6 +535,7 @@ static int __tcp_splice_read(struct sock *sk, struct tcp_splice_state *tss) | |||
| 531 | /* Store TCP splice context information in read_descriptor_t. */ | 535 | /* Store TCP splice context information in read_descriptor_t. */ |
| 532 | read_descriptor_t rd_desc = { | 536 | read_descriptor_t rd_desc = { |
| 533 | .arg.data = tss, | 537 | .arg.data = tss, |
| 538 | .count = tss->len, | ||
| 534 | }; | 539 | }; |
| 535 | 540 | ||
| 536 | return tcp_read_sock(sk, &rd_desc, tcp_splice_data_recv); | 541 | return tcp_read_sock(sk, &rd_desc, tcp_splice_data_recv); |
| @@ -611,11 +616,13 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos, | |||
| 611 | tss.len -= ret; | 616 | tss.len -= ret; |
| 612 | spliced += ret; | 617 | spliced += ret; |
| 613 | 618 | ||
| 619 | if (!timeo) | ||
| 620 | break; | ||
| 614 | release_sock(sk); | 621 | release_sock(sk); |
| 615 | lock_sock(sk); | 622 | lock_sock(sk); |
| 616 | 623 | ||
| 617 | if (sk->sk_err || sk->sk_state == TCP_CLOSE || | 624 | if (sk->sk_err || sk->sk_state == TCP_CLOSE || |
| 618 | (sk->sk_shutdown & RCV_SHUTDOWN) || !timeo || | 625 | (sk->sk_shutdown & RCV_SHUTDOWN) || |
| 619 | signal_pending(current)) | 626 | signal_pending(current)) |
| 620 | break; | 627 | break; |
| 621 | } | 628 | } |
| @@ -2382,7 +2389,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features) | |||
| 2382 | unsigned int seq; | 2389 | unsigned int seq; |
| 2383 | __be32 delta; | 2390 | __be32 delta; |
| 2384 | unsigned int oldlen; | 2391 | unsigned int oldlen; |
| 2385 | unsigned int len; | 2392 | unsigned int mss; |
| 2386 | 2393 | ||
| 2387 | if (!pskb_may_pull(skb, sizeof(*th))) | 2394 | if (!pskb_may_pull(skb, sizeof(*th))) |
| 2388 | goto out; | 2395 | goto out; |
| @@ -2398,10 +2405,13 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features) | |||
| 2398 | oldlen = (u16)~skb->len; | 2405 | oldlen = (u16)~skb->len; |
| 2399 | __skb_pull(skb, thlen); | 2406 | __skb_pull(skb, thlen); |
| 2400 | 2407 | ||
| 2408 | mss = skb_shinfo(skb)->gso_size; | ||
| 2409 | if (unlikely(skb->len <= mss)) | ||
| 2410 | goto out; | ||
| 2411 | |||
| 2401 | if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) { | 2412 | if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) { |
| 2402 | /* Packet is from an untrusted source, reset gso_segs. */ | 2413 | /* Packet is from an untrusted source, reset gso_segs. */ |
| 2403 | int type = skb_shinfo(skb)->gso_type; | 2414 | int type = skb_shinfo(skb)->gso_type; |
| 2404 | int mss; | ||
| 2405 | 2415 | ||
| 2406 | if (unlikely(type & | 2416 | if (unlikely(type & |
| 2407 | ~(SKB_GSO_TCPV4 | | 2417 | ~(SKB_GSO_TCPV4 | |
| @@ -2412,7 +2422,6 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features) | |||
| 2412 | !(type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)))) | 2422 | !(type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)))) |
| 2413 | goto out; | 2423 | goto out; |
| 2414 | 2424 | ||
| 2415 | mss = skb_shinfo(skb)->gso_size; | ||
| 2416 | skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(skb->len, mss); | 2425 | skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(skb->len, mss); |
| 2417 | 2426 | ||
| 2418 | segs = NULL; | 2427 | segs = NULL; |
| @@ -2423,8 +2432,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features) | |||
| 2423 | if (IS_ERR(segs)) | 2432 | if (IS_ERR(segs)) |
| 2424 | goto out; | 2433 | goto out; |
| 2425 | 2434 | ||
| 2426 | len = skb_shinfo(skb)->gso_size; | 2435 | delta = htonl(oldlen + (thlen + mss)); |
| 2427 | delta = htonl(oldlen + (thlen + len)); | ||
| 2428 | 2436 | ||
| 2429 | skb = segs; | 2437 | skb = segs; |
| 2430 | th = tcp_hdr(skb); | 2438 | th = tcp_hdr(skb); |
| @@ -2440,7 +2448,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features) | |||
| 2440 | csum_fold(csum_partial(skb_transport_header(skb), | 2448 | csum_fold(csum_partial(skb_transport_header(skb), |
| 2441 | thlen, skb->csum)); | 2449 | thlen, skb->csum)); |
| 2442 | 2450 | ||
| 2443 | seq += len; | 2451 | seq += mss; |
| 2444 | skb = skb->next; | 2452 | skb = skb->next; |
| 2445 | th = tcp_hdr(skb); | 2453 | th = tcp_hdr(skb); |
| 2446 | 2454 | ||
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 29c7c99e69f7..52ee1dced2ff 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
| @@ -298,6 +298,10 @@ static void fib6_dump_end(struct netlink_callback *cb) | |||
| 298 | struct fib6_walker_t *w = (void*)cb->args[2]; | 298 | struct fib6_walker_t *w = (void*)cb->args[2]; |
| 299 | 299 | ||
| 300 | if (w) { | 300 | if (w) { |
| 301 | if (cb->args[4]) { | ||
| 302 | cb->args[4] = 0; | ||
| 303 | fib6_walker_unlink(w); | ||
| 304 | } | ||
| 301 | cb->args[2] = 0; | 305 | cb->args[2] = 0; |
| 302 | kfree(w); | 306 | kfree(w); |
| 303 | } | 307 | } |
| @@ -330,15 +334,12 @@ static int fib6_dump_table(struct fib6_table *table, struct sk_buff *skb, | |||
| 330 | read_lock_bh(&table->tb6_lock); | 334 | read_lock_bh(&table->tb6_lock); |
| 331 | res = fib6_walk_continue(w); | 335 | res = fib6_walk_continue(w); |
| 332 | read_unlock_bh(&table->tb6_lock); | 336 | read_unlock_bh(&table->tb6_lock); |
| 333 | if (res != 0) { | 337 | if (res <= 0) { |
| 334 | if (res < 0) | 338 | fib6_walker_unlink(w); |
| 335 | fib6_walker_unlink(w); | 339 | cb->args[4] = 0; |
| 336 | goto end; | ||
| 337 | } | 340 | } |
| 338 | fib6_walker_unlink(w); | ||
| 339 | cb->args[4] = 0; | ||
| 340 | } | 341 | } |
| 341 | end: | 342 | |
| 342 | return res; | 343 | return res; |
| 343 | } | 344 | } |
| 344 | 345 | ||
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c index bd52151d31e9..c455cf4ee756 100644 --- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | #include <net/netfilter/ipv6/nf_conntrack_icmpv6.h> | 26 | #include <net/netfilter/ipv6/nf_conntrack_icmpv6.h> |
| 27 | #include <net/netfilter/nf_log.h> | 27 | #include <net/netfilter/nf_log.h> |
| 28 | 28 | ||
| 29 | static unsigned long nf_ct_icmpv6_timeout __read_mostly = 30*HZ; | 29 | static unsigned int nf_ct_icmpv6_timeout __read_mostly = 30*HZ; |
| 30 | 30 | ||
| 31 | static bool icmpv6_pkt_to_tuple(const struct sk_buff *skb, | 31 | static bool icmpv6_pkt_to_tuple(const struct sk_buff *skb, |
| 32 | unsigned int dataoff, | 32 | unsigned int dataoff, |
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c index 5f510a13b9f0..c5c0c5271096 100644 --- a/net/mac80211/ht.c +++ b/net/mac80211/ht.c | |||
| @@ -469,7 +469,7 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid) | |||
| 469 | struct ieee80211_sub_if_data *sdata; | 469 | struct ieee80211_sub_if_data *sdata; |
| 470 | u16 start_seq_num; | 470 | u16 start_seq_num; |
| 471 | u8 *state; | 471 | u8 *state; |
| 472 | int ret; | 472 | int ret = 0; |
| 473 | 473 | ||
| 474 | if ((tid >= STA_TID_NUM) || !(hw->flags & IEEE80211_HW_AMPDU_AGGREGATION)) | 474 | if ((tid >= STA_TID_NUM) || !(hw->flags & IEEE80211_HW_AMPDU_AGGREGATION)) |
| 475 | return -EINVAL; | 475 | return -EINVAL; |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 5abbc3f07dd6..b9074824862a 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
| @@ -699,7 +699,8 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, | |||
| 699 | return 0; | 699 | return 0; |
| 700 | 700 | ||
| 701 | /* Setting ad-hoc mode on non-IBSS channel is not supported. */ | 701 | /* Setting ad-hoc mode on non-IBSS channel is not supported. */ |
| 702 | if (sdata->local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS) | 702 | if (sdata->local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS && |
| 703 | type == NL80211_IFTYPE_ADHOC) | ||
| 703 | return -EOPNOTSUPP; | 704 | return -EOPNOTSUPP; |
| 704 | 705 | ||
| 705 | /* | 706 | /* |
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index 929ba542fd72..1159bdb4119c 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c | |||
| @@ -107,6 +107,7 @@ static struct sta_info *mesh_plink_alloc(struct ieee80211_sub_if_data *sdata, | |||
| 107 | 107 | ||
| 108 | sta->flags = WLAN_STA_AUTHORIZED; | 108 | sta->flags = WLAN_STA_AUTHORIZED; |
| 109 | sta->sta.supp_rates[local->hw.conf.channel->band] = rates; | 109 | sta->sta.supp_rates[local->hw.conf.channel->band] = rates; |
| 110 | rate_control_rate_init(sta); | ||
| 110 | 111 | ||
| 111 | return sta; | 112 | return sta; |
| 112 | } | 113 | } |
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c index 2b3b490a6073..3824990d340b 100644 --- a/net/mac80211/rc80211_minstrel.c +++ b/net/mac80211/rc80211_minstrel.c | |||
| @@ -395,13 +395,15 @@ minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband, | |||
| 395 | { | 395 | { |
| 396 | struct minstrel_sta_info *mi = priv_sta; | 396 | struct minstrel_sta_info *mi = priv_sta; |
| 397 | struct minstrel_priv *mp = priv; | 397 | struct minstrel_priv *mp = priv; |
| 398 | struct minstrel_rate *mr_ctl; | 398 | struct ieee80211_local *local = hw_to_local(mp->hw); |
| 399 | struct ieee80211_rate *ctl_rate; | ||
| 399 | unsigned int i, n = 0; | 400 | unsigned int i, n = 0; |
| 400 | unsigned int t_slot = 9; /* FIXME: get real slot time */ | 401 | unsigned int t_slot = 9; /* FIXME: get real slot time */ |
| 401 | 402 | ||
| 402 | mi->lowest_rix = rate_lowest_index(sband, sta); | 403 | mi->lowest_rix = rate_lowest_index(sband, sta); |
| 403 | mr_ctl = &mi->r[rix_to_ndx(mi, mi->lowest_rix)]; | 404 | ctl_rate = &sband->bitrates[mi->lowest_rix]; |
| 404 | mi->sp_ack_dur = mr_ctl->ack_time; | 405 | mi->sp_ack_dur = ieee80211_frame_duration(local, 10, ctl_rate->bitrate, |
| 406 | !!(ctl_rate->flags & IEEE80211_RATE_ERP_G), 1); | ||
| 405 | 407 | ||
| 406 | for (i = 0; i < sband->n_bitrates; i++) { | 408 | for (i = 0; i < sband->n_bitrates; i++) { |
| 407 | struct minstrel_rate *mr = &mi->r[n]; | 409 | struct minstrel_rate *mr = &mi->r[n]; |
| @@ -416,7 +418,7 @@ minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband, | |||
| 416 | 418 | ||
| 417 | mr->rix = i; | 419 | mr->rix = i; |
| 418 | mr->bitrate = sband->bitrates[i].bitrate / 5; | 420 | mr->bitrate = sband->bitrates[i].bitrate / 5; |
| 419 | calc_rate_durations(mi, hw_to_local(mp->hw), mr, | 421 | calc_rate_durations(mi, local, mr, |
| 420 | &sband->bitrates[i]); | 422 | &sband->bitrates[i]); |
| 421 | 423 | ||
| 422 | /* calculate maximum number of retransmissions before | 424 | /* calculate maximum number of retransmissions before |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 7e83f74cd5de..90ce9ddb9451 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
| @@ -469,7 +469,7 @@ struct nf_conn *nf_conntrack_alloc(struct net *net, | |||
| 469 | const struct nf_conntrack_tuple *repl, | 469 | const struct nf_conntrack_tuple *repl, |
| 470 | gfp_t gfp) | 470 | gfp_t gfp) |
| 471 | { | 471 | { |
| 472 | struct nf_conn *ct = NULL; | 472 | struct nf_conn *ct; |
| 473 | 473 | ||
| 474 | if (unlikely(!nf_conntrack_hash_rnd_initted)) { | 474 | if (unlikely(!nf_conntrack_hash_rnd_initted)) { |
| 475 | get_random_bytes(&nf_conntrack_hash_rnd, 4); | 475 | get_random_bytes(&nf_conntrack_hash_rnd, 4); |
| @@ -551,7 +551,7 @@ init_conntrack(struct net *net, | |||
| 551 | } | 551 | } |
| 552 | 552 | ||
| 553 | ct = nf_conntrack_alloc(net, tuple, &repl_tuple, GFP_ATOMIC); | 553 | ct = nf_conntrack_alloc(net, tuple, &repl_tuple, GFP_ATOMIC); |
| 554 | if (ct == NULL || IS_ERR(ct)) { | 554 | if (IS_ERR(ct)) { |
| 555 | pr_debug("Can't allocate conntrack.\n"); | 555 | pr_debug("Can't allocate conntrack.\n"); |
| 556 | return (struct nf_conntrack_tuple_hash *)ct; | 556 | return (struct nf_conntrack_tuple_hash *)ct; |
| 557 | } | 557 | } |
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 00e8c27130ff..3dddec6d2f7e 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
| @@ -1134,7 +1134,7 @@ ctnetlink_create_conntrack(struct nlattr *cda[], | |||
| 1134 | struct nf_conntrack_helper *helper; | 1134 | struct nf_conntrack_helper *helper; |
| 1135 | 1135 | ||
| 1136 | ct = nf_conntrack_alloc(&init_net, otuple, rtuple, GFP_ATOMIC); | 1136 | ct = nf_conntrack_alloc(&init_net, otuple, rtuple, GFP_ATOMIC); |
| 1137 | if (ct == NULL || IS_ERR(ct)) | 1137 | if (IS_ERR(ct)) |
| 1138 | return -ENOMEM; | 1138 | return -ENOMEM; |
| 1139 | 1139 | ||
| 1140 | if (!cda[CTA_TIMEOUT]) | 1140 | if (!cda[CTA_TIMEOUT]) |
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index 89837a4eef76..bfbf521f6ea5 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c | |||
| @@ -273,6 +273,10 @@ static int match_revfn(u8 af, const char *name, u8 revision, int *bestp) | |||
| 273 | have_rev = 1; | 273 | have_rev = 1; |
| 274 | } | 274 | } |
| 275 | } | 275 | } |
| 276 | |||
| 277 | if (af != NFPROTO_UNSPEC && !have_rev) | ||
| 278 | return match_revfn(NFPROTO_UNSPEC, name, revision, bestp); | ||
| 279 | |||
| 276 | return have_rev; | 280 | return have_rev; |
| 277 | } | 281 | } |
| 278 | 282 | ||
| @@ -289,6 +293,10 @@ static int target_revfn(u8 af, const char *name, u8 revision, int *bestp) | |||
| 289 | have_rev = 1; | 293 | have_rev = 1; |
| 290 | } | 294 | } |
| 291 | } | 295 | } |
| 296 | |||
| 297 | if (af != NFPROTO_UNSPEC && !have_rev) | ||
| 298 | return target_revfn(NFPROTO_UNSPEC, name, revision, bestp); | ||
| 299 | |||
| 292 | return have_rev; | 300 | return have_rev; |
| 293 | } | 301 | } |
| 294 | 302 | ||
diff --git a/net/netfilter/xt_time.c b/net/netfilter/xt_time.c index 29375ba8db73..93acaa59d108 100644 --- a/net/netfilter/xt_time.c +++ b/net/netfilter/xt_time.c | |||
| @@ -243,6 +243,17 @@ static struct xt_match xt_time_mt_reg __read_mostly = { | |||
| 243 | 243 | ||
| 244 | static int __init time_mt_init(void) | 244 | static int __init time_mt_init(void) |
| 245 | { | 245 | { |
| 246 | int minutes = sys_tz.tz_minuteswest; | ||
| 247 | |||
| 248 | if (minutes < 0) /* east of Greenwich */ | ||
| 249 | printk(KERN_INFO KBUILD_MODNAME | ||
| 250 | ": kernel timezone is +%02d%02d\n", | ||
| 251 | -minutes / 60, -minutes % 60); | ||
| 252 | else /* west of Greenwich */ | ||
| 253 | printk(KERN_INFO KBUILD_MODNAME | ||
| 254 | ": kernel timezone is -%02d%02d\n", | ||
| 255 | minutes / 60, minutes % 60); | ||
| 256 | |||
| 246 | return xt_register_match(&xt_time_mt_reg); | 257 | return xt_register_match(&xt_time_mt_reg); |
| 247 | } | 258 | } |
| 248 | 259 | ||
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 5070643ce534..2f0f0b04d3fb 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
| @@ -661,12 +661,13 @@ static void htb_charge_class(struct htb_sched *q, struct htb_class *cl, | |||
| 661 | * next pending event (0 for no event in pq). | 661 | * next pending event (0 for no event in pq). |
| 662 | * Note: Applied are events whose have cl->pq_key <= q->now. | 662 | * Note: Applied are events whose have cl->pq_key <= q->now. |
| 663 | */ | 663 | */ |
| 664 | static psched_time_t htb_do_events(struct htb_sched *q, int level) | 664 | static psched_time_t htb_do_events(struct htb_sched *q, int level, |
| 665 | unsigned long start) | ||
| 665 | { | 666 | { |
| 666 | /* don't run for longer than 2 jiffies; 2 is used instead of | 667 | /* don't run for longer than 2 jiffies; 2 is used instead of |
| 667 | 1 to simplify things when jiffy is going to be incremented | 668 | 1 to simplify things when jiffy is going to be incremented |
| 668 | too soon */ | 669 | too soon */ |
| 669 | unsigned long stop_at = jiffies + 2; | 670 | unsigned long stop_at = start + 2; |
| 670 | while (time_before(jiffies, stop_at)) { | 671 | while (time_before(jiffies, stop_at)) { |
| 671 | struct htb_class *cl; | 672 | struct htb_class *cl; |
| 672 | long diff; | 673 | long diff; |
| @@ -685,8 +686,8 @@ static psched_time_t htb_do_events(struct htb_sched *q, int level) | |||
| 685 | if (cl->cmode != HTB_CAN_SEND) | 686 | if (cl->cmode != HTB_CAN_SEND) |
| 686 | htb_add_to_wait_tree(q, cl, diff); | 687 | htb_add_to_wait_tree(q, cl, diff); |
| 687 | } | 688 | } |
| 688 | /* too much load - let's continue on next jiffie */ | 689 | /* too much load - let's continue on next jiffie (including above) */ |
| 689 | return q->now + PSCHED_TICKS_PER_SEC / HZ; | 690 | return q->now + 2 * PSCHED_TICKS_PER_SEC / HZ; |
| 690 | } | 691 | } |
| 691 | 692 | ||
| 692 | /* Returns class->node+prio from id-tree where classe's id is >= id. NULL | 693 | /* Returns class->node+prio from id-tree where classe's id is >= id. NULL |
| @@ -845,6 +846,7 @@ static struct sk_buff *htb_dequeue(struct Qdisc *sch) | |||
| 845 | struct htb_sched *q = qdisc_priv(sch); | 846 | struct htb_sched *q = qdisc_priv(sch); |
| 846 | int level; | 847 | int level; |
| 847 | psched_time_t next_event; | 848 | psched_time_t next_event; |
| 849 | unsigned long start_at; | ||
| 848 | 850 | ||
| 849 | /* try to dequeue direct packets as high prio (!) to minimize cpu work */ | 851 | /* try to dequeue direct packets as high prio (!) to minimize cpu work */ |
| 850 | skb = __skb_dequeue(&q->direct_queue); | 852 | skb = __skb_dequeue(&q->direct_queue); |
| @@ -857,6 +859,7 @@ static struct sk_buff *htb_dequeue(struct Qdisc *sch) | |||
| 857 | if (!sch->q.qlen) | 859 | if (!sch->q.qlen) |
| 858 | goto fin; | 860 | goto fin; |
| 859 | q->now = psched_get_time(); | 861 | q->now = psched_get_time(); |
| 862 | start_at = jiffies; | ||
| 860 | 863 | ||
| 861 | next_event = q->now + 5 * PSCHED_TICKS_PER_SEC; | 864 | next_event = q->now + 5 * PSCHED_TICKS_PER_SEC; |
| 862 | 865 | ||
| @@ -866,14 +869,14 @@ static struct sk_buff *htb_dequeue(struct Qdisc *sch) | |||
| 866 | psched_time_t event; | 869 | psched_time_t event; |
| 867 | 870 | ||
| 868 | if (q->now >= q->near_ev_cache[level]) { | 871 | if (q->now >= q->near_ev_cache[level]) { |
| 869 | event = htb_do_events(q, level); | 872 | event = htb_do_events(q, level, start_at); |
| 870 | if (!event) | 873 | if (!event) |
| 871 | event = q->now + PSCHED_TICKS_PER_SEC; | 874 | event = q->now + PSCHED_TICKS_PER_SEC; |
| 872 | q->near_ev_cache[level] = event; | 875 | q->near_ev_cache[level] = event; |
| 873 | } else | 876 | } else |
| 874 | event = q->near_ev_cache[level]; | 877 | event = q->near_ev_cache[level]; |
| 875 | 878 | ||
| 876 | if (event && next_event > event) | 879 | if (next_event > event) |
| 877 | next_event = event; | 880 | next_event = event; |
| 878 | 881 | ||
| 879 | m = ~q->row_mask[level]; | 882 | m = ~q->row_mask[level]; |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index b95a2d64eb59..7877e7975dae 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
| @@ -1914,10 +1914,17 @@ static int xfrm_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type, | |||
| 1914 | } | 1914 | } |
| 1915 | #endif | 1915 | #endif |
| 1916 | 1916 | ||
| 1917 | /* For the xfrm_usersa_info cases we have to work around some 32-bit vs. | ||
| 1918 | * 64-bit compatability issues. On 32-bit the structure is 220 bytes, but | ||
| 1919 | * for 64-bit it gets padded out to 224 bytes. Those bytes are just | ||
| 1920 | * padding and don't have any content we care about. Therefore as long | ||
| 1921 | * as we have enough bytes for the content we can make both cases work. | ||
| 1922 | */ | ||
| 1923 | |||
| 1917 | #define XMSGSIZE(type) sizeof(struct type) | 1924 | #define XMSGSIZE(type) sizeof(struct type) |
| 1918 | 1925 | ||
| 1919 | static const int xfrm_msg_min[XFRM_NR_MSGTYPES] = { | 1926 | static const int xfrm_msg_min[XFRM_NR_MSGTYPES] = { |
| 1920 | [XFRM_MSG_NEWSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_info), | 1927 | [XFRM_MSG_NEWSA - XFRM_MSG_BASE] = 220, /* see above */ |
| 1921 | [XFRM_MSG_DELSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_id), | 1928 | [XFRM_MSG_DELSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_id), |
| 1922 | [XFRM_MSG_GETSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_id), | 1929 | [XFRM_MSG_GETSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_id), |
| 1923 | [XFRM_MSG_NEWPOLICY - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userpolicy_info), | 1930 | [XFRM_MSG_NEWPOLICY - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userpolicy_info), |
| @@ -1927,7 +1934,7 @@ static const int xfrm_msg_min[XFRM_NR_MSGTYPES] = { | |||
| 1927 | [XFRM_MSG_ACQUIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_acquire), | 1934 | [XFRM_MSG_ACQUIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_acquire), |
| 1928 | [XFRM_MSG_EXPIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_expire), | 1935 | [XFRM_MSG_EXPIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_expire), |
| 1929 | [XFRM_MSG_UPDPOLICY - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userpolicy_info), | 1936 | [XFRM_MSG_UPDPOLICY - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userpolicy_info), |
| 1930 | [XFRM_MSG_UPDSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_info), | 1937 | [XFRM_MSG_UPDSA - XFRM_MSG_BASE] = 220, /* see above */ |
| 1931 | [XFRM_MSG_POLEXPIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_polexpire), | 1938 | [XFRM_MSG_POLEXPIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_polexpire), |
| 1932 | [XFRM_MSG_FLUSHSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_flush), | 1939 | [XFRM_MSG_FLUSHSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_flush), |
| 1933 | [XFRM_MSG_FLUSHPOLICY - XFRM_MSG_BASE] = 0, | 1940 | [XFRM_MSG_FLUSHPOLICY - XFRM_MSG_BASE] = 0, |
