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

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

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (95 commits)
b44: GFP_DMA skb should not escape from driver
korina: do not use IRQF_SHARED with IRQF_DISABLED
korina: do not stop queue here
korina: fix handling tx_chain_tail
korina: do tx at the right position
korina: do schedule napi after testing for it
korina: rework korina_rx() for use with napi
korina: disable napi on close and restart
korina: reset resource buffer size to 1536
korina: fix usage of driver_data
bnx2x: First slow path interrupt race
bnx2x: MTU Filter
bnx2x: Indirection table initialization index
bnx2x: Missing brackets
bnx2x: Fixing the doorbell size
bnx2x: Endianness issues
bnx2x: VLAN tagged packets without VLAN offload
bnx2x: Protecting the link change indication
bnx2x: Flow control updated before reporting the link
bnx2x: Missing mask when calculating flow control
...

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