History

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

Pull networking fixes from David Miller: 1) mlx4 driver bug fixes (TX queue wakeups, csum complete indications) from Ido Shamay, Eran Ben Elisha, and Or Gerlitz. 2) Missing unlock in error path of PTP support in renesas driver, from Dan Carpenter. 3) Add Vitesse 8641 phy IDs to vitesse PHY driver, from Shaohui Xie. 4) Bnx2x driver bug fixes (linearization of encap packets, scratchpad parity error notifications, flow-control and speed settings) from Yuval Mintz, Manish Chopra, Shahed Shaikh, and Ariel Elior. 5) ipv6 extension header parsing in the igb chip has a HW errata, disable it. Frm Todd Fujinaka. 6) Fix PCI link state locking issue in e1000e driver, from Yanir Lubetkin. 7) Cure panics during MTU change in i40e, from Mitch Williams. 8) Don't leak promisc refs in DSA slave driver, from Gilad Ben-Yossef. 9) Add missing HAS_DMA dep to VIA Rhine driver, from Geery Uytterhoeven. 10) Make sure DMA map/unmap calls are symmetric in bnx2x driver, from Michal Schmidt. 11) Workaround for MDIO access problems in bcm7xxx devices, from FLorian Fainelli. 12) Fix races in SCTP protocol between OTTB responses and route removals, from Alexander Sverdlin. 13) Fix jumbo frame checksum issue with some mvneta devices, from Simon Guinot. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (58 commits) sock_diag: don't broadcast kernel sockets net: mvneta: disable IP checksum with jumbo frames for Armada 370 ARM: mvebu: update Ethernet compatible string for Armada XP net: mvneta: introduce compatible string "marvell, armada-xp-neta" api: fix compatibility of linux/in.h with netinet/in.h net: icplus: fix typo in constant name sis900: Trivial: Fix typos in enums stmmac: Trivial: fix typo in constant name sctp: Fix race between OOTB responce and route removal net-Liquidio: Delete unnecessary checks before the function call "vfree" vmxnet3: Bump up driver version number amd-xgbe: Add the __GFP_NOWARN flag to Rx buffer allocation net: phy: mdio-bcm-unimac: workaround initial read failures for integrated PHYs net: bcmgenet: workaround initial read failures for integrated PHYs net: phy: bcm7xxx: workaround MDIO management controller initial read bnx2x: fix DMA API usage net: via: VIA_RHINE and VIA_VELOCITY should depend on HAS_DMA net/phy: tune get_phy_c45_ids to support more c45 phy bnx2x: fix lockdep splat net: fec: don't access RACC register when not available ...

Linus Torvalds committed 11 years ago

Commit 47ebed92 parents 44b061f b92262269 files · +701 −376Browse files

Unified · Split

69 files
  1. Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt +1 −1
  2. arch/arm/boot/dts/armada-370-xp.dtsi +0 −2
  3. arch/arm/boot/dts/armada-370.dtsi +8 −0
  4. arch/arm/boot/dts/armada-xp-mv78260.dtsi +1 −1
  5. arch/arm/boot/dts/armada-xp-mv78460.dtsi +1 −1
  6. arch/arm/boot/dts/armada-xp.dtsi +9 −1
  7. drivers/net/ethernet/amd/xgbe/xgbe-desc.c +1 −1
  8. drivers/net/ethernet/apm/xgene/xgene_enet_main.c +1 −1
  9. drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +7 −5
  10. drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +17 −15
  11. drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +2 −10
  12. drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +43 −15
  13. drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +32 −11
  14. drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +41 −19
  15. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c +1 −1
  16. drivers/net/ethernet/broadcom/genet/bcmgenet.h +1 −0
  17. drivers/net/ethernet/broadcom/genet/bcmmii.c +50 −4
  18. drivers/net/ethernet/cavium/liquidio/lio_ethtool.c +3 −2
  19. drivers/net/ethernet/cavium/liquidio/octeon_device.c +3 −8
  20. drivers/net/ethernet/cavium/liquidio/octeon_droq.c +1 −3
  21. drivers/net/ethernet/cavium/liquidio/request_manager.c +1 −2
  22. drivers/net/ethernet/cisco/enic/enic_main.c +2 −2
  23. drivers/net/ethernet/cisco/enic/vnic_rq.h +27 −64
  24. drivers/net/ethernet/freescale/Kconfig +2 −2
  25. drivers/net/ethernet/freescale/fec.h +2 −0
  26. drivers/net/ethernet/freescale/fec_main.c +17 −13
  27. drivers/net/ethernet/icplus/ipg.c +1 −1
  28. drivers/net/ethernet/icplus/ipg.h +1 −1
  29. drivers/net/ethernet/intel/e1000e/ich8lan.c +98 −28
  30. drivers/net/ethernet/intel/e1000e/netdev.c +34 −4
  31. drivers/net/ethernet/intel/i40evf/i40e_txrx.c +4 −0
  32. drivers/net/ethernet/intel/i40evf/i40evf.h +0 −1
  33. drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c +4 −2
  34. drivers/net/ethernet/intel/i40evf/i40evf_main.c +47 −63
  35. drivers/net/ethernet/intel/igb/e1000_82575.c +8 −4
  36. drivers/net/ethernet/intel/igb/e1000_defines.h +2 −1
  37. drivers/net/ethernet/intel/igb/igb_main.c +1 −1
  38. drivers/net/ethernet/marvell/mvneta.c +26 −1
  39. drivers/net/ethernet/mellanox/mlx4/en_netdev.c +0 −4
  40. drivers/net/ethernet/mellanox/mlx4/en_rx.c +6 −11
  41. drivers/net/ethernet/mellanox/mlx4/en_tx.c +12 −8
  42. drivers/net/ethernet/mellanox/mlx4/intf.c +7 −1
  43. drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +1 −1
  44. drivers/net/ethernet/renesas/ravb_ptp.c +3 −1
  45. drivers/net/ethernet/sis/sis900.h +2 −2
  46. drivers/net/ethernet/stmicro/stmmac/mmc_core.c +2 −2
  47. drivers/net/ethernet/via/Kconfig +2 −0
  48. drivers/net/phy/bcm7xxx.c +7 −0
  49. drivers/net/phy/mdio-bcm-unimac.c +43 −0
  50. drivers/net/phy/phy_device.c +17 −8
  51. drivers/net/phy/vitesse.c +14 −0
  52. drivers/net/vmxnet3/vmxnet3_int.h +2 −2
  53. drivers/net/xen-netfront.c +0 −7
  54. include/net/ax25.h +15 −1
  55. include/net/sock.h +0 −2
  56. include/uapi/linux/in.h +13 −3
  57. include/uapi/linux/libc-compat.h +22 −0
  58. net/ax25/af_ax25.c +15 −15
  59. net/ax25/ax25_in.c +1 −1
  60. net/core/flow_dissector.c +1 −1
  61. net/core/sock.c +1 −2
  62. net/dsa/slave.c +1 −1
  63. net/ipv4/fib_semantics.c +2 −2
  64. net/sched/cls_flower.c +2 −2
  65. net/sctp/output.c +3 −1
  66. net/sctp/socket.c +0 −6
  67. net/tipc/bcast.c +5 −0
  68. net/tipc/link.c +1 −1
  69. net/tipc/link.h +1 −0
Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt+1−1
@@ -1,7 +1,7 @@
11 * Marvell Armada 370 / Armada XP Ethernet Controller (NETA)
22
33 Required properties:
4−- compatible: should be "marvell,armada-370-neta".
4+- compatible: "marvell,armada-370-neta" or "marvell,armada-xp-neta".
55 - reg: address and length of the register set for the device.
66 - interrupts: interrupt for the device
77 - phy: See ethernet.txt file in the same directory.
arch/arm/boot/dts/armada-370-xp.dtsi+0−2
@@ -268,7 +268,6 @@ · 267 unmodified lines
268268 };
269269
270270 eth0: ethernet@70000 {
271− compatible = "marvell,armada-370-neta";
272271 reg = <0x70000 0x4000>;
273272 interrupts = <8>;
274273 clocks = <&gateclk 4>;
@@ -284,7 +283,6 @@ · 9 unmodified lines
284283 };
285284
286285 eth1: ethernet@74000 {
287− compatible = "marvell,armada-370-neta";
288286 reg = <0x74000 0x4000>;
289287 interrupts = <10>;
290288 clocks = <&gateclk 3>;
arch/arm/boot/dts/armada-370.dtsi+8−0
@@ -311,6 +311,14 @@ · 310 unmodified lines
311311 dmacap,memset;
312312 };
313313 };
314+
315+ ethernet@70000 {
316+ compatible = "marvell,armada-370-neta";
317+ };
318+
319+ ethernet@74000 {
320+ compatible = "marvell,armada-370-neta";
321+ };
314322 };
315323 };
316324 };
arch/arm/boot/dts/armada-xp-mv78260.dtsi+1−1
@@ -318,7 +318,7 @@ · 317 unmodified lines
318318 };
319319
320320 eth3: ethernet@34000 {
321− compatible = "marvell,armada-370-neta";
321+ compatible = "marvell,armada-xp-neta";
322322 reg = <0x34000 0x4000>;
323323 interrupts = <14>;
324324 clocks = <&gateclk 1>;
arch/arm/boot/dts/armada-xp-mv78460.dtsi+1−1
@@ -356,7 +356,7 @@ · 355 unmodified lines
356356 };
357357
358358 eth3: ethernet@34000 {
359− compatible = "marvell,armada-370-neta";
359+ compatible = "marvell,armada-xp-neta";
360360 reg = <0x34000 0x4000>;
361361 interrupts = <14>;
362362 clocks = <&gateclk 1>;
arch/arm/boot/dts/armada-xp.dtsi+9−1
@@ -185,7 +185,7 @@ · 184 unmodified lines
185185 };
186186
187187 eth2: ethernet@30000 {
188− compatible = "marvell,armada-370-neta";
188+ compatible = "marvell,armada-xp-neta";
189189 reg = <0x30000 0x4000>;
190190 interrupts = <12>;
191191 clocks = <&gateclk 2>;
@@ -228,6 +228,14 @@ · 36 unmodified lines
228228 };
229229 };
230230
231+ ethernet@70000 {
232+ compatible = "marvell,armada-xp-neta";
233+ };
234+
235+ ethernet@74000 {
236+ compatible = "marvell,armada-xp-neta";
237+ };
238+
231239 xor@f0900 {
232240 compatible = "marvell,orion-xor";
233241 reg = <0xF0900 0x100
drivers/net/ethernet/amd/xgbe/xgbe-desc.c+1−1
@@ -268,7 +268,7 @@ static int xgbe_alloc_pages(struct xgbe_prv_data *pdata, · 267 unmodified lines
268268 int ret;
269269
270270 /* Try to obtain pages, decreasing order if necessary */
271− gfp |= __GFP_COLD | __GFP_COMP;
271+ gfp |= __GFP_COLD | __GFP_COMP | __GFP_NOWARN;
272272 while (order >= 0) {
273273 pages = alloc_pages(gfp, order);
274274 if (pages)
drivers/net/ethernet/apm/xgene/xgene_enet_main.c+1−1
@@ -948,7 +948,7 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata) · 947 unmodified lines
948948 struct resource *res;
949949 void __iomem *base_addr;
950950 u32 offset;
951− int ret;
951+ int ret = 0;
952952
953953 pdev = pdata->pdev;
954954 dev = &pdev->dev;
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h+7−5
@@ -530,7 +530,6 @@ enum bnx2x_tpa_mode_t { · 529 unmodified lines
530530
531531 struct bnx2x_alloc_pool {
532532 struct page *page;
533− dma_addr_t dma;
534533 unsigned int offset;
535534 };
536535
@@ -2418,10 +2417,13 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id, · 1881 unmodified lines
24182417 AEU_INPUTS_ATTN_BITS_IGU_PARITY_ERROR | \
24192418 AEU_INPUTS_ATTN_BITS_MISC_PARITY_ERROR)
24202419
2421−#define HW_PRTY_ASSERT_SET_3 (AEU_INPUTS_ATTN_BITS_MCP_LATCHED_ROM_PARITY | \
2422− AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_RX_PARITY | \
2423− AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_TX_PARITY | \
2424− AEU_INPUTS_ATTN_BITS_MCP_LATCHED_SCPAD_PARITY)
2420+#define HW_PRTY_ASSERT_SET_3_WITHOUT_SCPAD \
2421+ (AEU_INPUTS_ATTN_BITS_MCP_LATCHED_ROM_PARITY | \
2422+ AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_RX_PARITY | \
2423+ AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_TX_PARITY)
2424+
2425+#define HW_PRTY_ASSERT_SET_3 (HW_PRTY_ASSERT_SET_3_WITHOUT_SCPAD | \
2426+ AEU_INPUTS_ATTN_BITS_MCP_LATCHED_SCPAD_PARITY)
24252427
24262428 #define HW_PRTY_ASSERT_SET_4 (AEU_INPUTS_ATTN_BITS_PGLUE_PARITY_ERROR | \
24272429 AEU_INPUTS_ATTN_BITS_ATC_PARITY_ERROR)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c+17−15
@@ -563,23 +563,20 @@ static int bnx2x_alloc_rx_sge(struct bnx2x *bp, struct bnx2x_fastpath *fp, · 562 unmodified lines
563563 return -ENOMEM;
564564 }
565565
566− pool->dma = dma_map_page(&bp->pdev->dev, pool->page, 0,
567− PAGE_SIZE, DMA_FROM_DEVICE);
568− if (unlikely(dma_mapping_error(&bp->pdev->dev,
569− pool->dma))) {
570− __free_pages(pool->page, PAGES_PER_SGE_SHIFT);
571− pool->page = NULL;
572− BNX2X_ERR("Can't map sge\n");
573− return -ENOMEM;
574− }
575566 pool->offset = 0;
576567 }
577568
569+ mapping = dma_map_page(&bp->pdev->dev, pool->page,
570+ pool->offset, SGE_PAGE_SIZE, DMA_FROM_DEVICE);
571+ if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) {
572+ BNX2X_ERR("Can't map sge\n");
573+ return -ENOMEM;
574+ }
575+
578576 get_page(pool->page);
579577 sw_buf->page = pool->page;
580578 sw_buf->offset = pool->offset;
581579
582− mapping = pool->dma + sw_buf->offset;
583580 dma_unmap_addr_set(sw_buf, mapping, mapping);
584581
585582 sge->addr_hi = cpu_to_le32(U64_HI(mapping));
@@ -648,9 +645,9 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp, · 62 unmodified lines
648645 return err;
649646 }
650647
651− dma_unmap_single(&bp->pdev->dev,
652− dma_unmap_addr(&old_rx_pg, mapping),
653− SGE_PAGE_SIZE, DMA_FROM_DEVICE);
648+ dma_unmap_page(&bp->pdev->dev,
649+ dma_unmap_addr(&old_rx_pg, mapping),
650+ SGE_PAGE_SIZE, DMA_FROM_DEVICE);
654651 /* Add one frag and update the appropriate fields in the skb */
655652 if (fp->mode == TPA_MODE_LRO)
656653 skb_fill_page_desc(skb, j, old_rx_pg.page,
@@ -3421,8 +3418,13 @@ static int bnx2x_pkt_req_lin(struct bnx2x *bp, struct sk_buff *skb, · 2764 unmodified lines
34213418 u32 wnd_sum = 0;
34223419
34233420 /* Headers length */
3424− hlen = (int)(skb_transport_header(skb) - skb->data) +
3425− tcp_hdrlen(skb);
3421+ if (xmit_type & XMIT_GSO_ENC)
3422+ hlen = (int)(skb_inner_transport_header(skb) -
3423+ skb->data) +
3424+ inner_tcp_hdrlen(skb);
3425+ else
3426+ hlen = (int)(skb_transport_header(skb) -
3427+ skb->data) + tcp_hdrlen(skb);
34263428
34273429 /* Amount of data (w/o headers) on linear part of SKB*/
34283430 first_bd_sz = skb_headlen(skb) - hlen;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h+2−10
@@ -807,8 +807,8 @@ static inline void bnx2x_free_rx_sge(struct bnx2x *bp, · 806 unmodified lines
807807 /* Since many fragments can share the same page, make sure to
808808 * only unmap and free the page once.
809809 */
810− dma_unmap_single(&bp->pdev->dev, dma_unmap_addr(sw_buf, mapping),
811− SGE_PAGE_SIZE, DMA_FROM_DEVICE);
810+ dma_unmap_page(&bp->pdev->dev, dma_unmap_addr(sw_buf, mapping),
811+ SGE_PAGE_SIZE, DMA_FROM_DEVICE);
812812
813813 put_page(page);
814814
@@ -974,14 +974,6 @@ static inline void bnx2x_free_rx_mem_pool(struct bnx2x *bp, · 159 unmodified lines
974974 if (!pool->page)
975975 return;
976976
977− /* Page was not fully fragmented. Unmap unused space */
978− if (pool->offset < PAGE_SIZE) {
979− dma_addr_t dma = pool->dma + pool->offset;
980− int size = PAGE_SIZE - pool->offset;
981−
982− dma_unmap_single(&bp->pdev->dev, dma, size, DMA_FROM_DEVICE);
983− }
984−
985977 put_page(pool->page);
986978
987979 pool->page = NULL;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c+43−15
@@ -257,14 +257,15 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) · 256 unmodified lines
257257 {
258258 struct bnx2x *bp = netdev_priv(dev);
259259 int cfg_idx = bnx2x_get_link_cfg_idx(bp);
260+ u32 media_type;
260261
261262 /* Dual Media boards present all available port types */
262263 cmd->supported = bp->port.supported[cfg_idx] |
263264 (bp->port.supported[cfg_idx ^ 1] &
264265 (SUPPORTED_TP | SUPPORTED_FIBRE));
265266 cmd->advertising = bp->port.advertising[cfg_idx];
266− if (bp->link_params.phy[bnx2x_get_cur_phy_idx(bp)].media_type ==
267− ETH_PHY_SFP_1G_FIBER) {
267+ media_type = bp->link_params.phy[bnx2x_get_cur_phy_idx(bp)].media_type;
268+ if (media_type == ETH_PHY_SFP_1G_FIBER) {
268269 cmd->supported &= ~(SUPPORTED_10000baseT_Full);
269270 cmd->advertising &= ~(ADVERTISED_10000baseT_Full);
270271 }
@@ -312,12 +313,26 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) · 41 unmodified lines
312313 cmd->lp_advertising |= ADVERTISED_100baseT_Full;
313314 if (status & LINK_STATUS_LINK_PARTNER_1000THD_CAPABLE)
314315 cmd->lp_advertising |= ADVERTISED_1000baseT_Half;
315− if (status & LINK_STATUS_LINK_PARTNER_1000TFD_CAPABLE)
316− cmd->lp_advertising |= ADVERTISED_1000baseT_Full;
316+ if (status & LINK_STATUS_LINK_PARTNER_1000TFD_CAPABLE) {
317+ if (media_type == ETH_PHY_KR) {
318+ cmd->lp_advertising |=
319+ ADVERTISED_1000baseKX_Full;
320+ } else {
321+ cmd->lp_advertising |=
322+ ADVERTISED_1000baseT_Full;
323+ }
324+ }
317325 if (status & LINK_STATUS_LINK_PARTNER_2500XFD_CAPABLE)
318326 cmd->lp_advertising |= ADVERTISED_2500baseX_Full;
319− if (status & LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE)
320− cmd->lp_advertising |= ADVERTISED_10000baseT_Full;
327+ if (status & LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE) {
328+ if (media_type == ETH_PHY_KR) {
329+ cmd->lp_advertising |=
330+ ADVERTISED_10000baseKR_Full;
331+ } else {
332+ cmd->lp_advertising |=
333+ ADVERTISED_10000baseT_Full;
334+ }
335+ }
321336 if (status & LINK_STATUS_LINK_PARTNER_20GXFD_CAPABLE)
322337 cmd->lp_advertising |= ADVERTISED_20000baseKR2_Full;
323338 }
@@ -564,15 +579,20 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) · 240 unmodified lines
564579 return -EINVAL;
565580 }
566581
567− if (!(bp->port.supported[cfg_idx] &
568− SUPPORTED_1000baseT_Full)) {
582+ if (bp->port.supported[cfg_idx] &
583+ SUPPORTED_1000baseT_Full) {
584+ advertising = (ADVERTISED_1000baseT_Full |
585+ ADVERTISED_TP);
586+
587+ } else if (bp->port.supported[cfg_idx] &
588+ SUPPORTED_1000baseKX_Full) {
589+ advertising = ADVERTISED_1000baseKX_Full;
590+ } else {
569591 DP(BNX2X_MSG_ETHTOOL,
570592 "1G full not supported\n");
571593 return -EINVAL;
572594 }
573595
574− advertising = (ADVERTISED_1000baseT_Full |
575− ADVERTISED_TP);
576596 break;
577597
578598 case SPEED_2500:
@@ -600,17 +620,22 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) · 21 unmodified lines
600620 return -EINVAL;
601621 }
602622 phy_idx = bnx2x_get_cur_phy_idx(bp);
603− if (!(bp->port.supported[cfg_idx]
604− & SUPPORTED_10000baseT_Full) ||
605− (bp->link_params.phy[phy_idx].media_type ==
623+ if ((bp->port.supported[cfg_idx] &
624+ SUPPORTED_10000baseT_Full) &&
625+ (bp->link_params.phy[phy_idx].media_type !=
606626 ETH_PHY_SFP_1G_FIBER)) {
627+ advertising = (ADVERTISED_10000baseT_Full |
628+ ADVERTISED_FIBRE);
629+ } else if (bp->port.supported[cfg_idx] &
630+ SUPPORTED_10000baseKR_Full) {
631+ advertising = (ADVERTISED_10000baseKR_Full |
632+ ADVERTISED_FIBRE);
633+ } else {
607634 DP(BNX2X_MSG_ETHTOOL,
608635 "10G full not supported\n");
609636 return -EINVAL;
610637 }
611638
612− advertising = (ADVERTISED_10000baseT_Full |
613− ADVERTISED_FIBRE);
614639 break;
615640
616641 default:
@@ -633,6 +658,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) · 16 unmodified lines
633658 bp->link_params.multi_phy_config = new_multi_phy_config;
634659 if (netif_running(dev)) {
635660 bnx2x_stats_handle(bp, STATS_EVENT_STOP);
661+ bnx2x_force_link_reset(bp);
636662 bnx2x_link_set(bp);
637663 }
638664
@@ -1204,6 +1230,7 @@ static int bnx2x_acquire_nvram_lock(struct bnx2x *bp) · 565 unmodified lines
12041230 if (!(val & (MCPR_NVM_SW_ARB_ARB_ARB1 << port))) {
12051231 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
12061232 "cannot get access to nvram interface\n");
1233+ bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_NVRAM);
12071234 return -EBUSY;
12081235 }
12091236
@@ -1944,6 +1971,7 @@ static int bnx2x_set_pauseparam(struct net_device *dev, · 734 unmodified lines
19441971
19451972 if (netif_running(dev)) {
19461973 bnx2x_stats_handle(bp, STATS_EVENT_STOP);
1974+ bnx2x_force_link_reset(bp);
19471975 bnx2x_link_set(bp);
19481976 }
19491977
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c+32−11
@@ -3392,9 +3392,9 @@ static void bnx2x_calc_ieee_aneg_adv(struct bnx2x_phy *phy, · 3391 unmodified lines
33923392 case BNX2X_FLOW_CTRL_AUTO:
33933393 switch (params->req_fc_auto_adv) {
33943394 case BNX2X_FLOW_CTRL_BOTH:
3395+ case BNX2X_FLOW_CTRL_RX:
33953396 *ieee_fc |= MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH;
33963397 break;
3397− case BNX2X_FLOW_CTRL_RX:
33983398 case BNX2X_FLOW_CTRL_TX:
33993399 *ieee_fc |=
34003400 MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC;
@@ -3488,14 +3488,21 @@ static void bnx2x_ext_phy_set_pause(struct link_params *params, · 87 unmodified lines
34883488 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_ADV_PAUSE, val);
34893489 }
34903490
3491−static void bnx2x_pause_resolve(struct link_vars *vars, u32 pause_result)
3492−{ /* LD LP */
3491+static void bnx2x_pause_resolve(struct bnx2x_phy *phy,
3492+ struct link_params *params,
3493+ struct link_vars *vars,
3494+ u32 pause_result)
3495+{
3496+ struct bnx2x *bp = params->bp;
3497+ /* LD LP */
34933498 switch (pause_result) { /* ASYM P ASYM P */
34943499 case 0xb: /* 1 0 1 1 */
3500+ DP(NETIF_MSG_LINK, "Flow Control: TX only\n");
34953501 vars->flow_ctrl = BNX2X_FLOW_CTRL_TX;
34963502 break;
34973503
34983504 case 0xe: /* 1 1 1 0 */
3505+ DP(NETIF_MSG_LINK, "Flow Control: RX only\n");
34993506 vars->flow_ctrl = BNX2X_FLOW_CTRL_RX;
35003507 break;
35013508
@@ -3503,10 +3510,22 @@ static void bnx2x_pause_resolve(struct link_vars *vars, u32 pause_result) · 1 unmodified line
35033510 case 0x7: /* 0 1 1 1 */
35043511 case 0xd: /* 1 1 0 1 */
35053512 case 0xf: /* 1 1 1 1 */
3506− vars->flow_ctrl = BNX2X_FLOW_CTRL_BOTH;
3513+ /* If the user selected to advertise RX ONLY,
3514+ * although we advertised both, need to enable
3515+ * RX only.
3516+ */
3517+ if (params->req_fc_auto_adv == BNX2X_FLOW_CTRL_BOTH) {
3518+ DP(NETIF_MSG_LINK, "Flow Control: RX & TX\n");
3519+ vars->flow_ctrl = BNX2X_FLOW_CTRL_BOTH;
3520+ } else {
3521+ DP(NETIF_MSG_LINK, "Flow Control: RX only\n");
3522+ vars->flow_ctrl = BNX2X_FLOW_CTRL_RX;
3523+ }
35073524 break;
35083525
35093526 default:
3527+ DP(NETIF_MSG_LINK, "Flow Control: None\n");
3528+ vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE;
35103529 break;
35113530 }
35123531 if (pause_result & (1<<0))
@@ -3567,7 +3586,7 @@ static void bnx2x_ext_phy_update_adv_fc(struct bnx2x_phy *phy, · 54 unmodified lines
35673586 pause_result |= (lp_pause &
35683587 MDIO_AN_REG_ADV_PAUSE_MASK) >> 10;
35693588 DP(NETIF_MSG_LINK, "Ext PHY pause result 0x%x\n", pause_result);
3570− bnx2x_pause_resolve(vars, pause_result);
3589+ bnx2x_pause_resolve(phy, params, vars, pause_result);
35713590
35723591 }
35733592
@@ -5396,7 +5415,7 @@ static void bnx2x_update_adv_fc(struct bnx2x_phy *phy, · 1822 unmodified lines
53965415 MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_MASK)>>7;
53975416 DP(NETIF_MSG_LINK, "pause_result CL37 0x%x\n", pause_result);
53985417 }
5399− bnx2x_pause_resolve(vars, pause_result);
5418+ bnx2x_pause_resolve(phy, params, vars, pause_result);
54005419
54015420 }
54025421
@@ -7129,7 +7148,7 @@ static void bnx2x_8073_resolve_fc(struct bnx2x_phy *phy, · 1726 unmodified lines
71297148 pause_result |= (lp_pause &
71307149 MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH) >> 7;
71317150
7132− bnx2x_pause_resolve(vars, pause_result);
7151+ bnx2x_pause_resolve(phy, params, vars, pause_result);
71337152 DP(NETIF_MSG_LINK, "Ext PHY CL37 pause result 0x%x\n",
71347153 pause_result);
71357154 }
@@ -11474,7 +11493,9 @@ static const struct bnx2x_phy phy_warpcore = { · 4338 unmodified lines
1147411493 SUPPORTED_100baseT_Half |
1147511494 SUPPORTED_100baseT_Full |
1147611495 SUPPORTED_1000baseT_Full |
11496+ SUPPORTED_1000baseKX_Full |
1147711497 SUPPORTED_10000baseT_Full |
11498+ SUPPORTED_10000baseKR_Full |
1147811499 SUPPORTED_20000baseKR2_Full |
1147911500 SUPPORTED_20000baseMLD2_Full |
1148011501 SUPPORTED_FIBRE |
@@ -11980,8 +12001,8 @@ static int bnx2x_populate_int_phy(struct bnx2x *bp, u32 shmem_base, u8 port, · 499 unmodified lines
1198012001 break;
1198112002 case PORT_HW_CFG_NET_SERDES_IF_KR:
1198212003 phy->media_type = ETH_PHY_KR;
11983− phy->supported &= (SUPPORTED_1000baseT_Full |
11984− SUPPORTED_10000baseT_Full |
12004+ phy->supported &= (SUPPORTED_1000baseKX_Full |
12005+ SUPPORTED_10000baseKR_Full |
1198512006 SUPPORTED_FIBRE |
1198612007 SUPPORTED_Autoneg |
1198712008 SUPPORTED_Pause |
@@ -11999,8 +12020,8 @@ static int bnx2x_populate_int_phy(struct bnx2x *bp, u32 shmem_base, u8 port, · 11 unmodified lines
1199912020 phy->media_type = ETH_PHY_KR;
1200012021 phy->flags |= FLAGS_WC_DUAL_MODE;
1200112022 phy->supported &= (SUPPORTED_20000baseKR2_Full |
12002− SUPPORTED_10000baseT_Full |
12003− SUPPORTED_1000baseT_Full |
12023+ SUPPORTED_10000baseKR_Full |
12024+ SUPPORTED_1000baseKX_Full |
1200412025 SUPPORTED_Autoneg |
1200512026 SUPPORTED_FIBRE |
1200612027 SUPPORTED_Pause |
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c+41−19
@@ -2287,13 +2287,11 @@ static int bnx2x_set_spio(struct bnx2x *bp, int spio, u32 mode) · 2286 unmodified lines
22872287 void bnx2x_calc_fc_adv(struct bnx2x *bp)
22882288 {
22892289 u8 cfg_idx = bnx2x_get_link_cfg_idx(bp);
2290+
2291+ bp->port.advertising[cfg_idx] &= ~(ADVERTISED_Asym_Pause |
2292+ ADVERTISED_Pause);
22902293 switch (bp->link_vars.ieee_fc &
22912294 MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_MASK) {
2292− case MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_NONE:
2293− bp->port.advertising[cfg_idx] &= ~(ADVERTISED_Asym_Pause |
2294− ADVERTISED_Pause);
2295− break;
2296−
22972295 case MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH:
22982296 bp->port.advertising[cfg_idx] |= (ADVERTISED_Asym_Pause |
22992297 ADVERTISED_Pause);
@@ -2304,8 +2302,6 @@ void bnx2x_calc_fc_adv(struct bnx2x *bp) · 4 unmodified lines
23042302 break;
23052303
23062304 default:
2307− bp->port.advertising[cfg_idx] &= ~(ADVERTISED_Asym_Pause |
2308− ADVERTISED_Pause);
23092305 break;
23102306 }
23112307 }
@@ -2351,12 +2347,16 @@ int bnx2x_initial_phy_init(struct bnx2x *bp, int load_mode) · 39 unmodified lines
23512347 if (load_mode == LOAD_DIAG) {
23522348 struct link_params *lp = &bp->link_params;
23532349 lp->loopback_mode = LOOPBACK_XGXS;
2354− /* do PHY loopback at 10G speed, if possible */
2355− if (lp->req_line_speed[cfx_idx] < SPEED_10000) {
2350+ /* Prefer doing PHY loopback at highest speed */
2351+ if (lp->req_line_speed[cfx_idx] < SPEED_20000) {
23562352 if (lp->speed_cap_mask[cfx_idx] &
2357− PORT_HW_CFG_SPEED_CAPABILITY_D0_10G)
2353+ PORT_HW_CFG_SPEED_CAPABILITY_D0_20G)
23582354 lp->req_line_speed[cfx_idx] =
2359− SPEED_10000;
2355+ SPEED_20000;
2356+ else if (lp->speed_cap_mask[cfx_idx] &
2357+ PORT_HW_CFG_SPEED_CAPABILITY_D0_10G)
2358+ lp->req_line_speed[cfx_idx] =
2359+ SPEED_10000;
23602360 else
23612361 lp->req_line_speed[cfx_idx] =
23622362 SPEED_1000;
@@ -4867,9 +4867,7 @@ static bool bnx2x_check_blocks_with_parity3(struct bnx2x *bp, u32 sig, · 2504 unmodified lines
48674867 res = true;
48684868 break;
48694869 case AEU_INPUTS_ATTN_BITS_MCP_LATCHED_SCPAD_PARITY:
4870− if (print)
4871− _print_next_block((*par_num)++,
4872− "MCP SCPAD");
4870+ (*par_num)++;
48734871 /* clear latched SCPAD PATIRY from MCP */
48744872 REG_WR(bp, MISC_REG_AEU_CLR_LATCH_SIGNAL,
48754873 1UL << 10);
@@ -4931,6 +4929,7 @@ static bool bnx2x_parity_attn(struct bnx2x *bp, bool *global, bool print, · 55 unmodified lines
49314929 (sig[3] & HW_PRTY_ASSERT_SET_3) ||
49324930 (sig[4] & HW_PRTY_ASSERT_SET_4)) {
49334931 int par_num = 0;
4932+
49344933 DP(NETIF_MSG_HW, "Was parity error: HW block parity attention:\n"
49354934 "[0]:0x%08x [1]:0x%08x [2]:0x%08x [3]:0x%08x [4]:0x%08x\n",
49364935 sig[0] & HW_PRTY_ASSERT_SET_0,
@@ -4938,9 +4937,18 @@ static bool bnx2x_parity_attn(struct bnx2x *bp, bool *global, bool print, · 1 unmodified line
49384937 sig[2] & HW_PRTY_ASSERT_SET_2,
49394938 sig[3] & HW_PRTY_ASSERT_SET_3,
49404939 sig[4] & HW_PRTY_ASSERT_SET_4);
4941− if (print)
4942− netdev_err(bp->dev,
4943− "Parity errors detected in blocks: ");
4940+ if (print) {
4941+ if (((sig[0] & HW_PRTY_ASSERT_SET_0) ||
4942+ (sig[1] & HW_PRTY_ASSERT_SET_1) ||
4943+ (sig[2] & HW_PRTY_ASSERT_SET_2) ||
4944+ (sig[4] & HW_PRTY_ASSERT_SET_4)) ||
4945+ (sig[3] & HW_PRTY_ASSERT_SET_3_WITHOUT_SCPAD)) {
4946+ netdev_err(bp->dev,
4947+ "Parity errors detected in blocks: ");
4948+ } else {
4949+ print = false;
4950+ }
4951+ }
49444952 res |= bnx2x_check_blocks_with_parity0(bp,
49454953 sig[0] & HW_PRTY_ASSERT_SET_0, &par_num, print);
49464954 res |= bnx2x_check_blocks_with_parity1(bp,
@@ -8431,7 +8439,7 @@ int bnx2x_set_eth_mac(struct bnx2x *bp, bool set) · 3484 unmodified lines
84318439 BNX2X_ETH_MAC, &ramrod_flags);
84328440 } else { /* vf */
84338441 return bnx2x_vfpf_config_mac(bp, bp->dev->dev_addr,
8434− bp->fp->index, true);
8442+ bp->fp->index, set);
84358443 }
84368444 }
84378445
@@ -9323,7 +9331,8 @@ unload_error: · 885 unmodified lines
93239331 * function stop ramrod is sent, since as part of this ramrod FW access
93249332 * PTP registers.
93259333 */
9326− bnx2x_stop_ptp(bp);
9334+ if (bp->flags & PTP_SUPPORTED)
9335+ bnx2x_stop_ptp(bp);
93279336
93289337 /* Disable HW interrupts, NAPI */
93299338 bnx2x_netif_stop(bp, 1);
@@ -11147,6 +11156,12 @@ static void bnx2x_link_settings_requested(struct bnx2x *bp) · 1817 unmodified lines
1114711156 bp->port.advertising[idx] |=
1114811157 (ADVERTISED_1000baseT_Full |
1114911158 ADVERTISED_TP);
11159+ } else if (bp->port.supported[idx] &
11160+ SUPPORTED_1000baseKX_Full) {
11161+ bp->link_params.req_line_speed[idx] =
11162+ SPEED_1000;
11163+ bp->port.advertising[idx] |=
11164+ ADVERTISED_1000baseKX_Full;
1115011165 } else {
1115111166 BNX2X_ERR("NVRAM config error. Invalid link_config 0x%x speed_cap_mask 0x%x\n",
1115211167 link_config,
@@ -11179,6 +11194,13 @@ static void bnx2x_link_settings_requested(struct bnx2x *bp) · 26 unmodified lines
1117911194 bp->port.advertising[idx] |=
1118011195 (ADVERTISED_10000baseT_Full |
1118111196 ADVERTISED_FIBRE);
11197+ } else if (bp->port.supported[idx] &
11198+ SUPPORTED_10000baseKR_Full) {
11199+ bp->link_params.req_line_speed[idx] =
11200+ SPEED_10000;
11201+ bp->port.advertising[idx] |=
11202+ (ADVERTISED_10000baseKR_Full |
11203+ ADVERTISED_FIBRE);
1118211204 } else {
1118311205 BNX2X_ERR("NVRAM config error. Invalid link_config 0x%x speed_cap_mask 0x%x\n",
1118411206 link_config,
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c+1−1
@@ -424,7 +424,7 @@ static void __bnx2x_vlan_mac_h_exec_pending(struct bnx2x *bp, · 423 unmodified lines
424424 o->head_exe_request = false;
425425 o->saved_ramrod_flags = 0;
426426 rc = bnx2x_exe_queue_step(bp, &o->exe_queue, &ramrod_flags);
427− if (rc != 0) {
427+ if ((rc != 0) && (rc != 1)) {
428428 BNX2X_ERR("execution of pending commands failed with rc %d\n",
429429 rc);
430430 #ifdef BNX2X_STOP_ON_ERROR
drivers/net/ethernet/broadcom/genet/bcmgenet.h+1−0
@@ -594,6 +594,7 @@ struct bcmgenet_priv { · 593 unmodified lines
594594 wait_queue_head_t wq;
595595 struct phy_device *phydev;
596596 struct device_node *phy_dn;
597+ struct device_node *mdio_dn;
597598 struct mii_bus *mii_bus;
598599 u16 gphy_rev;
599600 struct clk *clk_eee;
drivers/net/ethernet/broadcom/genet/bcmmii.c+50−4
@@ -408,6 +408,52 @@ static int bcmgenet_mii_probe(struct net_device *dev) · 407 unmodified lines
408408 return 0;
409409 }
410410
411+/* Workaround for integrated BCM7xxx Gigabit PHYs which have a problem with
412+ * their internal MDIO management controller making them fail to successfully
413+ * be read from or written to for the first transaction. We insert a dummy
414+ * BMSR read here to make sure that phy_get_device() and get_phy_id() can
415+ * correctly read the PHY MII_PHYSID1/2 registers and successfully register a
416+ * PHY device for this peripheral.
417+ *
418+ * Once the PHY driver is registered, we can workaround subsequent reads from
419+ * there (e.g: during system-wide power management).
420+ *
421+ * bus->reset is invoked before mdiobus_scan during mdiobus_register and is
422+ * therefore the right location to stick that workaround. Since we do not want
423+ * to read from non-existing PHYs, we either use bus->phy_mask or do a manual
424+ * Device Tree scan to limit the search area.
425+ */
426+static int bcmgenet_mii_bus_reset(struct mii_bus *bus)
427+{
428+ struct net_device *dev = bus->priv;
429+ struct bcmgenet_priv *priv = netdev_priv(dev);
430+ struct device_node *np = priv->mdio_dn;
431+ struct device_node *child = NULL;
432+ u32 read_mask = 0;
433+ int addr = 0;
434+
435+ if (!np) {
436+ read_mask = 1 << priv->phy_addr;
437+ } else {
438+ for_each_available_child_of_node(np, child) {
439+ addr = of_mdio_parse_addr(&dev->dev, child);
440+ if (addr < 0)
441+ continue;
442+
443+ read_mask |= 1 << addr;
444+ }
445+ }
446+
447+ for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
448+ if (read_mask & 1 << addr) {
449+ dev_dbg(&dev->dev, "Workaround for PHY @ %d\n", addr);
450+ mdiobus_read(bus, addr, MII_BMSR);
451+ }
452+ }
453+
454+ return 0;
455+}
456+
411457 static int bcmgenet_mii_alloc(struct bcmgenet_priv *priv)
412458 {
413459 struct mii_bus *bus;
@@ -427,6 +473,7 @@ static int bcmgenet_mii_alloc(struct bcmgenet_priv *priv) · 13 unmodified lines
427473 bus->parent = &priv->pdev->dev;
428474 bus->read = bcmgenet_mii_read;
429475 bus->write = bcmgenet_mii_write;
476+ bus->reset = bcmgenet_mii_bus_reset;
430477 snprintf(bus->id, MII_BUS_ID_SIZE, "%s-%d",
431478 priv->pdev->name, priv->pdev->id);
432479
@@ -443,7 +490,6 @@ static int bcmgenet_mii_of_init(struct bcmgenet_priv *priv) · 10 unmodified lines
443490 {
444491 struct device_node *dn = priv->pdev->dev.of_node;
445492 struct device *kdev = &priv->pdev->dev;
446− struct device_node *mdio_dn;
447493 char *compat;
448494 int ret;
449495
@@ -451,14 +497,14 @@ static int bcmgenet_mii_of_init(struct bcmgenet_priv *priv) · 1 unmodified line
451497 if (!compat)
452498 return -ENOMEM;
453499
454− mdio_dn = of_find_compatible_node(dn, NULL, compat);
500+ priv->mdio_dn = of_find_compatible_node(dn, NULL, compat);
455501 kfree(compat);
456− if (!mdio_dn) {
502+ if (!priv->mdio_dn) {
457503 dev_err(kdev, "unable to find MDIO bus node\n");
458504 return -ENODEV;
459505 }
460506
461− ret = of_mdiobus_register(priv->mii_bus, mdio_dn);
507+ ret = of_mdiobus_register(priv->mii_bus, priv->mdio_dn);
462508 if (ret) {
463509 dev_err(kdev, "failed to register MDIO bus\n");
464510 return ret;
drivers/net/ethernet/cavium/liquidio/lio_ethtool.c+3−2
@@ -434,8 +434,9 @@ static int lio_set_phys_id(struct net_device *netdev, · 433 unmodified lines
434434 if (ret)
435435 return ret;
436436
437− octnet_mdio45_access(lio, 1, LIO68XX_LED_BEACON_ADDR,
438− &lio->phy_beacon_val);
437+ ret = octnet_mdio45_access(lio, 1,
438+ LIO68XX_LED_BEACON_ADDR,
439+ &lio->phy_beacon_val);
439440 if (ret)
440441 return ret;
441442
drivers/net/ethernet/cavium/liquidio/octeon_device.c+3−8
@@ -650,14 +650,12 @@ void octeon_free_device_mem(struct octeon_device *oct) · 649 unmodified lines
650650
651651 for (i = 0; i < MAX_OCTEON_OUTPUT_QUEUES; i++) {
652652 /* could check mask as well */
653− if (oct->droq[i])
654− vfree(oct->droq[i]);
653+ vfree(oct->droq[i]);
655654 }
656655
657656 for (i = 0; i < MAX_OCTEON_INSTR_QUEUES; i++) {
658657 /* could check mask as well */
659− if (oct->instr_queue[i])
660− vfree(oct->instr_queue[i]);
658+ vfree(oct->instr_queue[i]);
661659 }
662660
663661 i = oct->octeon_id;
@@ -1078,10 +1076,7 @@ octeon_unregister_dispatch_fn(struct octeon_device *oct, u16 opcode, · 414 unmodified lines
10781076 oct->dispatch.count--;
10791077
10801078 spin_unlock_bh(&oct->dispatch.lock);
1081−
1082− if (dfree)
1083− vfree(dfree);
1084−
1079+ vfree(dfree);
10851080 return retval;
10861081 }
10871082
drivers/net/ethernet/cavium/liquidio/octeon_droq.c+1−3
@@ -216,9 +216,7 @@ int octeon_delete_droq(struct octeon_device *oct, u32 q_no) · 215 unmodified lines
216216 dev_dbg(&oct->pci_dev->dev, "%s[%d]\n", __func__, q_no);
217217
218218 octeon_droq_destroy_ring_buffers(oct, droq);
219−
220− if (droq->recv_buf_list)
221− vfree(droq->recv_buf_list);
219+ vfree(droq->recv_buf_list);
222220
223221 if (droq->info_base_addr)
224222 cnnic_free_aligned_dma(oct->pci_dev, droq->info_list,
drivers/net/ethernet/cavium/liquidio/request_manager.c+1−2
@@ -175,8 +175,7 @@ int octeon_delete_instr_queue(struct octeon_device *oct, u32 iq_no) · 174 unmodified lines
175175 desc_size =
176176 CFG_GET_IQ_INSTR_TYPE(CHIP_FIELD(oct, cn6xxx, conf));
177177
178− if (iq->request_list)
179− vfree(iq->request_list);
178+ vfree(iq->request_list);
180179
181180 if (iq->base_addr) {
182181 q_size = iq->max_count * desc_size;
drivers/net/ethernet/cisco/enic/enic_main.c+2−2
@@ -1208,7 +1208,7 @@ static int enic_poll(struct napi_struct *napi, int budget) · 1207 unmodified lines
12081208 napi_complete(napi);
12091209 vnic_intr_unmask(&enic->intr[intr]);
12101210 }
1211− enic_poll_unlock_napi(&enic->rq[cq_rq]);
1211+ enic_poll_unlock_napi(&enic->rq[cq_rq], napi);
12121212
12131213 return rq_work_done;
12141214 }
@@ -1414,7 +1414,7 @@ static int enic_poll_msix_rq(struct napi_struct *napi, int budget) · 199 unmodified lines
14141414 */
14151415 enic_calc_int_moderation(enic, &enic->rq[rq]);
14161416
1417− enic_poll_unlock_napi(&enic->rq[rq]);
1417+ enic_poll_unlock_napi(&enic->rq[rq], napi);
14181418 if (work_done < work_to_do) {
14191419
14201420 /* Some work done, but not enough to stay in polling,
drivers/net/ethernet/cisco/enic/vnic_rq.h+27−64
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #define _VNIC_RQ_H_
2222
2323 #include <linux/pci.h>
24+#include <linux/netdevice.h>
2425
2526 #include "vnic_dev.h"
2627 #include "vnic_cq.h"
@@ -75,6 +76,12 @@ struct vnic_rq_buf { · 48 unmodified lines
7576 uint64_t wr_id;
7677 };
7778
79+enum enic_poll_state {
80+ ENIC_POLL_STATE_IDLE,
81+ ENIC_POLL_STATE_NAPI,
82+ ENIC_POLL_STATE_POLL
83+};
84+
7885 struct vnic_rq {
7986 unsigned int index;
8087 struct vnic_dev *vdev;
@@ -86,19 +93,7 @@ struct vnic_rq { · 5 unmodified lines
8693 void *os_buf_head;
8794 unsigned int pkts_outstanding;
8895 #ifdef CONFIG_NET_RX_BUSY_POLL
89−#define ENIC_POLL_STATE_IDLE 0
90−#define ENIC_POLL_STATE_NAPI (1 << 0) /* NAPI owns this poll */
91−#define ENIC_POLL_STATE_POLL (1 << 1) /* poll owns this poll */
92−#define ENIC_POLL_STATE_NAPI_YIELD (1 << 2) /* NAPI yielded this poll */
93−#define ENIC_POLL_STATE_POLL_YIELD (1 << 3) /* poll yielded this poll */
94−#define ENIC_POLL_YIELD (ENIC_POLL_STATE_NAPI_YIELD | \
95− ENIC_POLL_STATE_POLL_YIELD)
96−#define ENIC_POLL_LOCKED (ENIC_POLL_STATE_NAPI | \
97− ENIC_POLL_STATE_POLL)
98−#define ENIC_POLL_USER_PEND (ENIC_POLL_STATE_POLL | \
99− ENIC_POLL_STATE_POLL_YIELD)
100− unsigned int bpoll_state;
101− spinlock_t bpoll_lock;
96+ atomic_t bpoll_state;
10297 #endif /* CONFIG_NET_RX_BUSY_POLL */
10398 };
10499
@@ -215,76 +210,43 @@ static inline int vnic_rq_fill(struct vnic_rq *rq, · 110 unmodified lines
215210 #ifdef CONFIG_NET_RX_BUSY_POLL
216211 static inline void enic_busy_poll_init_lock(struct vnic_rq *rq)
217212 {
218− spin_lock_init(&rq->bpoll_lock);
219− rq->bpoll_state = ENIC_POLL_STATE_IDLE;
213+ atomic_set(&rq->bpoll_state, ENIC_POLL_STATE_IDLE);
220214 }
221215
222216 static inline bool enic_poll_lock_napi(struct vnic_rq *rq)
223217 {
224− bool rc = true;
225−
226− spin_lock(&rq->bpoll_lock);
227− if (rq->bpoll_state & ENIC_POLL_LOCKED) {
228− WARN_ON(rq->bpoll_state & ENIC_POLL_STATE_NAPI);
229− rq->bpoll_state |= ENIC_POLL_STATE_NAPI_YIELD;
230− rc = false;
231− } else {
232− rq->bpoll_state = ENIC_POLL_STATE_NAPI;
233− }
234− spin_unlock(&rq->bpoll_lock);
218+ int rc = atomic_cmpxchg(&rq->bpoll_state, ENIC_POLL_STATE_IDLE,
219+ ENIC_POLL_STATE_NAPI);
235220
236− return rc;
221+ return (rc == ENIC_POLL_STATE_IDLE);
237222 }
238223
239−static inline bool enic_poll_unlock_napi(struct vnic_rq *rq)
224+static inline void enic_poll_unlock_napi(struct vnic_rq *rq,
225+ struct napi_struct *napi)
240226 {
241− bool rc = false;
242−
243− spin_lock(&rq->bpoll_lock);
244− WARN_ON(rq->bpoll_state &
245− (ENIC_POLL_STATE_POLL | ENIC_POLL_STATE_NAPI_YIELD));
246− if (rq->bpoll_state & ENIC_POLL_STATE_POLL_YIELD)
247− rc = true;
248− rq->bpoll_state = ENIC_POLL_STATE_IDLE;
249− spin_unlock(&rq->bpoll_lock);
250−
251− return rc;
227+ WARN_ON(atomic_read(&rq->bpoll_state) != ENIC_POLL_STATE_NAPI);
228+ napi_gro_flush(napi, false);
229+ atomic_set(&rq->bpoll_state, ENIC_POLL_STATE_IDLE);
252230 }
253231
254232 static inline bool enic_poll_lock_poll(struct vnic_rq *rq)
255233 {
256− bool rc = true;
257−
258− spin_lock_bh(&rq->bpoll_lock);
259− if (rq->bpoll_state & ENIC_POLL_LOCKED) {
260− rq->bpoll_state |= ENIC_POLL_STATE_POLL_YIELD;
261− rc = false;
262− } else {
263− rq->bpoll_state |= ENIC_POLL_STATE_POLL;
264− }
265− spin_unlock_bh(&rq->bpoll_lock);
234+ int rc = atomic_cmpxchg(&rq->bpoll_state, ENIC_POLL_STATE_IDLE,
235+ ENIC_POLL_STATE_POLL);
266236
267− return rc;
237+ return (rc == ENIC_POLL_STATE_IDLE);
268238 }
269239
270−static inline bool enic_poll_unlock_poll(struct vnic_rq *rq)
271−{
272− bool rc = false;
273240
274− spin_lock_bh(&rq->bpoll_lock);
275− WARN_ON(rq->bpoll_state & ENIC_POLL_STATE_NAPI);
276− if (rq->bpoll_state & ENIC_POLL_STATE_POLL_YIELD)
277− rc = true;
278− rq->bpoll_state = ENIC_POLL_STATE_IDLE;
279− spin_unlock_bh(&rq->bpoll_lock);
280−
281− return rc;
241+static inline void enic_poll_unlock_poll(struct vnic_rq *rq)
242+{
243+ WARN_ON(atomic_read(&rq->bpoll_state) != ENIC_POLL_STATE_POLL);
244+ atomic_set(&rq->bpoll_state, ENIC_POLL_STATE_IDLE);
282245 }
283246
284247 static inline bool enic_poll_busy_polling(struct vnic_rq *rq)
285248 {
286− WARN_ON(!(rq->bpoll_state & ENIC_POLL_LOCKED));
287− return rq->bpoll_state & ENIC_POLL_USER_PEND;
249+ return atomic_read(&rq->bpoll_state) & ENIC_POLL_STATE_POLL;
288250 }
289251
290252 #else
@@ -298,7 +260,8 @@ static inline bool enic_poll_lock_napi(struct vnic_rq *rq) · 7 unmodified lines
298260 return true;
299261 }
300262
301−static inline bool enic_poll_unlock_napi(struct vnic_rq *rq)
263+static inline bool enic_poll_unlock_napi(struct vnic_rq *rq,
264+ struct napi_struct *napi)
302265 {
303266 return false;
304267 }
drivers/net/ethernet/freescale/Kconfig+2−2
@@ -83,12 +83,12 @@ config UGETH_TX_ON_DEMAND · 82 unmodified lines
8383
8484 config GIANFAR
8585 tristate "Gianfar Ethernet"
86− depends on FSL_SOC
8786 select FSL_PQ_MDIO
8887 select PHYLIB
8988 select CRC32
9089 ---help---
9190 This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx,
92− and MPC86xx family of chips, and the FEC on the 8540.
91+ and MPC86xx family of chips, the eTSEC on LS1021A and the FEC
92+ on the 8540.
9393
9494 endif # NET_VENDOR_FREESCALE
drivers/net/ethernet/freescale/fec.h+2−0
@@ -428,6 +428,8 @@ struct bufdesc_ex { · 427 unmodified lines
428428 #define FEC_QUIRK_BUG_CAPTURE (1 << 10)
429429 /* Controller has only one MDIO bus */
430430 #define FEC_QUIRK_SINGLE_MDIO (1 << 11)
431+/* Controller supports RACC register */
432+#define FEC_QUIRK_HAS_RACC (1 << 12)
431433
432434 struct fec_enet_priv_tx_q {
433435 int index;
drivers/net/ethernet/freescale/fec_main.c+17−13
@@ -85,28 +85,30 @@ static struct platform_device_id fec_devtype[] = { · 84 unmodified lines
8585 .driver_data = 0,
8686 }, {
8787 .name = "imx25-fec",
88− .driver_data = FEC_QUIRK_USE_GASKET,
88+ .driver_data = FEC_QUIRK_USE_GASKET | FEC_QUIRK_HAS_RACC,
8989 }, {
9090 .name = "imx27-fec",
91− .driver_data = 0,
91+ .driver_data = FEC_QUIRK_HAS_RACC,
9292 }, {
9393 .name = "imx28-fec",
9494 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME |
95− FEC_QUIRK_SINGLE_MDIO,
95+ FEC_QUIRK_SINGLE_MDIO | FEC_QUIRK_HAS_RACC,
9696 }, {
9797 .name = "imx6q-fec",
9898 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT |
9999 FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM |
100− FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358,
100+ FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358 |
101+ FEC_QUIRK_HAS_RACC,
101102 }, {
102103 .name = "mvf600-fec",
103− .driver_data = FEC_QUIRK_ENET_MAC,
104+ .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_RACC,
104105 }, {
105106 .name = "imx6sx-fec",
106107 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT |
107108 FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM |
108109 FEC_QUIRK_HAS_VLAN | FEC_QUIRK_HAS_AVB |
109− FEC_QUIRK_ERR007885 | FEC_QUIRK_BUG_CAPTURE,
110+ FEC_QUIRK_ERR007885 | FEC_QUIRK_BUG_CAPTURE |
111+ FEC_QUIRK_HAS_RACC,
110112 }, {
111113 /* sentinel */
112114 }
@@ -970,13 +972,15 @@ fec_restart(struct net_device *ndev) · 857 unmodified lines
970972 writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
971973
972974 #if !defined(CONFIG_M5272)
973− /* set RX checksum */
974− val = readl(fep->hwp + FEC_RACC);
975− if (fep->csum_flags & FLAG_RX_CSUM_ENABLED)
976− val |= FEC_RACC_OPTIONS;
977− else
978− val &= ~FEC_RACC_OPTIONS;
979− writel(val, fep->hwp + FEC_RACC);
975+ if (fep->quirks & FEC_QUIRK_HAS_RACC) {
976+ /* set RX checksum */
977+ val = readl(fep->hwp + FEC_RACC);
978+ if (fep->csum_flags & FLAG_RX_CSUM_ENABLED)
979+ val |= FEC_RACC_OPTIONS;
980+ else
981+ val &= ~FEC_RACC_OPTIONS;
982+ writel(val, fep->hwp + FEC_RACC);
983+ }
980984 #endif
981985
982986 /*
drivers/net/ethernet/icplus/ipg.c+1−1
@@ -1028,7 +1028,7 @@ static struct net_device_stats *ipg_nic_get_stats(struct net_device *dev) · 1027 unmodified lines
10281028
10291029 /* detailed rx_errors */
10301030 sp->stats.rx_length_errors += ipg_r16(IPG_INRANGELENGTHERRORS) +
1031− ipg_r16(IPG_FRAMETOOLONGERRRORS);
1031+ ipg_r16(IPG_FRAMETOOLONGERRORS);
10321032 sp->stats.rx_crc_errors += ipg_r16(IPG_FRAMECHECKSEQERRORS);
10331033
10341034 /* Unutilized IPG statistic registers. */
drivers/net/ethernet/icplus/ipg.h+1−1
@@ -102,7 +102,7 @@ enum ipg_regs { · 101 unmodified lines
102102 #define IPG_MCSTFRAMESRCVDOK 0xB8
103103 #define IPG_BCSTFRAMESRCVDOK 0xBE
104104 #define IPG_MACCONTROLFRAMESRCVD 0xC6
105−#define IPG_FRAMETOOLONGERRRORS 0xC8
105+#define IPG_FRAMETOOLONGERRORS 0xC8
106106 #define IPG_INRANGELENGTHERRORS 0xCA
107107 #define IPG_FRAMECHECKSEQERRORS 0xCC
108108 #define IPG_FRAMESLOSTRXERRORS 0xCE
drivers/net/ethernet/intel/e1000e/ich8lan.c+98−28
@@ -237,17 +237,19 @@ static bool e1000_phy_is_accessible_pchlan(struct e1000_hw *hw) · 236 unmodified lines
237237 if (ret_val)
238238 return false;
239239 out:
240− if ((hw->mac.type == e1000_pch_lpt) ||
241− (hw->mac.type == e1000_pch_spt)) {
242− /* Unforce SMBus mode in PHY */
243− e1e_rphy_locked(hw, CV_SMB_CTRL, &phy_reg);
244− phy_reg &= ~CV_SMB_CTRL_FORCE_SMBUS;
245− e1e_wphy_locked(hw, CV_SMB_CTRL, phy_reg);
240+ if ((hw->mac.type == e1000_pch_lpt) || (hw->mac.type == e1000_pch_spt)) {
241+ /* Only unforce SMBus if ME is not active */
242+ if (!(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) {
243+ /* Unforce SMBus mode in PHY */
244+ e1e_rphy_locked(hw, CV_SMB_CTRL, &phy_reg);
245+ phy_reg &= ~CV_SMB_CTRL_FORCE_SMBUS;
246+ e1e_wphy_locked(hw, CV_SMB_CTRL, phy_reg);
246247
247− /* Unforce SMBus mode in MAC */
248− mac_reg = er32(CTRL_EXT);
249− mac_reg &= ~E1000_CTRL_EXT_FORCE_SMBUS;
250− ew32(CTRL_EXT, mac_reg);
248+ /* Unforce SMBus mode in MAC */
249+ mac_reg = er32(CTRL_EXT);
250+ mac_reg &= ~E1000_CTRL_EXT_FORCE_SMBUS;
251+ ew32(CTRL_EXT, mac_reg);
252+ }
251253 }
252254
253255 return true;
@@ -1087,6 +1089,7 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx) · 833 unmodified lines
10871089 u32 mac_reg;
10881090 s32 ret_val = 0;
10891091 u16 phy_reg;
1092+ u16 oem_reg = 0;
10901093
10911094 if ((hw->mac.type < e1000_pch_lpt) ||
10921095 (hw->adapter->pdev->device == E1000_DEV_ID_PCH_LPT_I217_LM) ||
@@ -1128,33 +1131,37 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx) · 35 unmodified lines
11281131 if (ret_val)
11291132 goto out;
11301133
1134+ /* Force SMBus mode in PHY */
1135+ ret_val = e1000_read_phy_reg_hv_locked(hw, CV_SMB_CTRL, &phy_reg);
1136+ if (ret_val)
1137+ goto release;
1138+ phy_reg |= CV_SMB_CTRL_FORCE_SMBUS;
1139+ e1000_write_phy_reg_hv_locked(hw, CV_SMB_CTRL, phy_reg);
1140+
1141+ /* Force SMBus mode in MAC */
1142+ mac_reg = er32(CTRL_EXT);
1143+ mac_reg |= E1000_CTRL_EXT_FORCE_SMBUS;
1144+ ew32(CTRL_EXT, mac_reg);
1145+
11311146 /* Si workaround for ULP entry flow on i127/rev6 h/w. Enable
11321147 * LPLU and disable Gig speed when entering ULP
11331148 */
11341149 if ((hw->phy.type == e1000_phy_i217) && (hw->phy.revision == 6)) {
11351150 ret_val = e1000_read_phy_reg_hv_locked(hw, HV_OEM_BITS,
1136− &phy_reg);
1151+ &oem_reg);
11371152 if (ret_val)
11381153 goto release;
1154+
1155+ phy_reg = oem_reg;
11391156 phy_reg |= HV_OEM_BITS_LPLU | HV_OEM_BITS_GBE_DIS;
1157+
11401158 ret_val = e1000_write_phy_reg_hv_locked(hw, HV_OEM_BITS,
11411159 phy_reg);
1160+
11421161 if (ret_val)
11431162 goto release;
11441163 }
11451164
1146− /* Force SMBus mode in PHY */
1147− ret_val = e1000_read_phy_reg_hv_locked(hw, CV_SMB_CTRL, &phy_reg);
1148− if (ret_val)
1149− goto release;
1150− phy_reg |= CV_SMB_CTRL_FORCE_SMBUS;
1151− e1000_write_phy_reg_hv_locked(hw, CV_SMB_CTRL, phy_reg);
1152−
1153− /* Force SMBus mode in MAC */
1154− mac_reg = er32(CTRL_EXT);
1155− mac_reg |= E1000_CTRL_EXT_FORCE_SMBUS;
1156− ew32(CTRL_EXT, mac_reg);
1157−
11581165 /* Set Inband ULP Exit, Reset to SMBus mode and
11591166 * Disable SMBus Release on PERST# in PHY
11601167 */
@@ -1166,10 +1173,15 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx) · 5 unmodified lines
11661173 if (to_sx) {
11671174 if (er32(WUFC) & E1000_WUFC_LNKC)
11681175 phy_reg |= I218_ULP_CONFIG1_WOL_HOST;
1176+ else
1177+ phy_reg &= ~I218_ULP_CONFIG1_WOL_HOST;
11691178
11701179 phy_reg |= I218_ULP_CONFIG1_STICKY_ULP;
1180+ phy_reg &= ~I218_ULP_CONFIG1_INBAND_EXIT;
11711181 } else {
11721182 phy_reg |= I218_ULP_CONFIG1_INBAND_EXIT;
1183+ phy_reg &= ~I218_ULP_CONFIG1_STICKY_ULP;
1184+ phy_reg &= ~I218_ULP_CONFIG1_WOL_HOST;
11731185 }
11741186 e1000_write_phy_reg_hv_locked(hw, I218_ULP_CONFIG1, phy_reg);
11751187
@@ -1181,6 +1193,15 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx) · 5 unmodified lines
11811193 /* Commit ULP changes in PHY by starting auto ULP configuration */
11821194 phy_reg |= I218_ULP_CONFIG1_START;
11831195 e1000_write_phy_reg_hv_locked(hw, I218_ULP_CONFIG1, phy_reg);
1196+
1197+ if ((hw->phy.type == e1000_phy_i217) && (hw->phy.revision == 6) &&
1198+ to_sx && (er32(STATUS) & E1000_STATUS_LU)) {
1199+ ret_val = e1000_write_phy_reg_hv_locked(hw, HV_OEM_BITS,
1200+ oem_reg);
1201+ if (ret_val)
1202+ goto release;
1203+ }
1204+
11841205 release:
11851206 hw->phy.ops.release(hw);
11861207 out:
@@ -1379,16 +1400,20 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) · 192 unmodified lines
13791400 if (((hw->mac.type == e1000_pch2lan) ||
13801401 (hw->mac.type == e1000_pch_lpt) ||
13811402 (hw->mac.type == e1000_pch_spt)) && link) {
1382− u32 reg;
1403+ u16 speed, duplex;
13831404
1384− reg = er32(STATUS);
1405+ e1000e_get_speed_and_duplex_copper(hw, &speed, &duplex);
13851406 tipg_reg = er32(TIPG);
13861407 tipg_reg &= ~E1000_TIPG_IPGT_MASK;
13871408
1388− if (!(reg & (E1000_STATUS_FD | E1000_STATUS_SPEED_MASK))) {
1409+ if (duplex == HALF_DUPLEX && speed == SPEED_10) {
13891410 tipg_reg |= 0xFF;
13901411 /* Reduce Rx latency in analog PHY */
13911412 emi_val = 0;
1413+ } else if (hw->mac.type == e1000_pch_spt &&
1414+ duplex == FULL_DUPLEX && speed != SPEED_1000) {
1415+ tipg_reg |= 0xC;
1416+ emi_val = 1;
13921417 } else {
13931418
13941419 /* Roll back the default values */
@@ -1412,14 +1437,59 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) · 17 unmodified lines
14121437
14131438 if (ret_val)
14141439 return ret_val;
1440+
1441+ if (hw->mac.type == e1000_pch_spt) {
1442+ u16 data;
1443+ u16 ptr_gap;
1444+
1445+ if (speed == SPEED_1000) {
1446+ ret_val = hw->phy.ops.acquire(hw);
1447+ if (ret_val)
1448+ return ret_val;
1449+
1450+ ret_val = e1e_rphy_locked(hw,
1451+ PHY_REG(776, 20),
1452+ &data);
1453+ if (ret_val) {
1454+ hw->phy.ops.release(hw);
1455+ return ret_val;
1456+ }
1457+
1458+ ptr_gap = (data & (0x3FF << 2)) >> 2;
1459+ if (ptr_gap < 0x18) {
1460+ data &= ~(0x3FF << 2);
1461+ data |= (0x18 << 2);
1462+ ret_val =
1463+ e1e_wphy_locked(hw,
1464+ PHY_REG(776, 20),
1465+ data);
1466+ }
1467+ hw->phy.ops.release(hw);
1468+ if (ret_val)
1469+ return ret_val;
1470+ }
1471+ }
1472+ }
1473+
1474+ /* I217 Packet Loss issue:
1475+ * ensure that FEXTNVM4 Beacon Duration is set correctly
1476+ * on power up.
1477+ * Set the Beacon Duration for I217 to 8 usec
1478+ */
1479+ if ((hw->mac.type == e1000_pch_lpt) || (hw->mac.type == e1000_pch_spt)) {
1480+ u32 mac_reg;
1481+
1482+ mac_reg = er32(FEXTNVM4);
1483+ mac_reg &= ~E1000_FEXTNVM4_BEACON_DURATION_MASK;
1484+ mac_reg |= E1000_FEXTNVM4_BEACON_DURATION_8USEC;
1485+ ew32(FEXTNVM4, mac_reg);
14151486 }
14161487
14171488 /* Work-around I218 hang issue */
14181489 if ((hw->adapter->pdev->device == E1000_DEV_ID_PCH_LPTLP_I218_LM) ||
14191490 (hw->adapter->pdev->device == E1000_DEV_ID_PCH_LPTLP_I218_V) ||
14201491 (hw->adapter->pdev->device == E1000_DEV_ID_PCH_I218_LM3) ||
1421− (hw->adapter->pdev->device == E1000_DEV_ID_PCH_I218_V3) ||
1422− (hw->mac.type == e1000_pch_spt)) {
1492+ (hw->adapter->pdev->device == E1000_DEV_ID_PCH_I218_V3)) {
14231493 ret_val = e1000_k1_workaround_lpt_lp(hw, link);
14241494 if (ret_val)
14251495 return ret_val;
drivers/net/ethernet/intel/e1000e/netdev.c+34−4
@@ -6354,13 +6354,14 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime) · 6353 unmodified lines
63546354 }
63556355
63566356 /**
6357− * e1000e_disable_aspm - Disable ASPM states
6357+ * __e1000e_disable_aspm - Disable ASPM states
63586358 * @pdev: pointer to PCI device struct
63596359 * @state: bit-mask of ASPM states to disable
6360+ * @locked: indication if this context holds pci_bus_sem locked.
63606361 *
63616362 * Some devices *must* have certain ASPM states disabled per hardware errata.
63626363 **/
6363−static void e1000e_disable_aspm(struct pci_dev *pdev, u16 state)
6364+static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state, int locked)
63646365 {
63656366 struct pci_dev *parent = pdev->bus->self;
63666367 u16 aspm_dis_mask = 0;
@@ -6399,7 +6400,10 @@ static void e1000e_disable_aspm(struct pci_dev *pdev, u16 state) · 32 unmodified lines
63996400 "L1" : "");
64006401
64016402 #ifdef CONFIG_PCIEASPM
6402− pci_disable_link_state_locked(pdev, state);
6403+ if (locked)
6404+ pci_disable_link_state_locked(pdev, state);
6405+ else
6406+ pci_disable_link_state(pdev, state);
64036407
64046408 /* Double-check ASPM control. If not disabled by the above, the
64056409 * BIOS is preventing that from happening (or CONFIG_PCIEASPM is
@@ -6422,6 +6426,32 @@ static void e1000e_disable_aspm(struct pci_dev *pdev, u16 state) · 16 unmodified lines
64226426 aspm_dis_mask);
64236427 }
64246428
6429+/**
6430+ * e1000e_disable_aspm - Disable ASPM states.
6431+ * @pdev: pointer to PCI device struct
6432+ * @state: bit-mask of ASPM states to disable
6433+ *
6434+ * This function acquires the pci_bus_sem!
6435+ * Some devices *must* have certain ASPM states disabled per hardware errata.
6436+ **/
6437+static void e1000e_disable_aspm(struct pci_dev *pdev, u16 state)
6438+{
6439+ __e1000e_disable_aspm(pdev, state, 0);
6440+}
6441+
6442+/**
6443+ * e1000e_disable_aspm_locked Disable ASPM states.
6444+ * @pdev: pointer to PCI device struct
6445+ * @state: bit-mask of ASPM states to disable
6446+ *
6447+ * This function must be called with pci_bus_sem acquired!
6448+ * Some devices *must* have certain ASPM states disabled per hardware errata.
6449+ **/
6450+static void e1000e_disable_aspm_locked(struct pci_dev *pdev, u16 state)
6451+{
6452+ __e1000e_disable_aspm(pdev, state, 1);
6453+}
6454+
64256455 #ifdef CONFIG_PM
64266456 static int __e1000_resume(struct pci_dev *pdev)
64276457 {
@@ -6435,7 +6465,7 @@ static int __e1000_resume(struct pci_dev *pdev) · 7 unmodified lines
64356465 if (adapter->flags2 & FLAG2_DISABLE_ASPM_L1)
64366466 aspm_disable_flag |= PCIE_LINK_STATE_L1;
64376467 if (aspm_disable_flag)
6438− e1000e_disable_aspm(pdev, aspm_disable_flag);
6468+ e1000e_disable_aspm_locked(pdev, aspm_disable_flag);
64396469
64406470 pci_set_master(pdev);
64416471
drivers/net/ethernet/intel/i40evf/i40e_txrx.c+4−0
@@ -484,6 +484,8 @@ int i40evf_setup_tx_descriptors(struct i40e_ring *tx_ring) · 483 unmodified lines
484484 if (!dev)
485485 return -ENOMEM;
486486
487+ /* warn if we are about to overwrite the pointer */
488+ WARN_ON(tx_ring->tx_bi);
487489 bi_size = sizeof(struct i40e_tx_buffer) * tx_ring->count;
488490 tx_ring->tx_bi = kzalloc(bi_size, GFP_KERNEL);
489491 if (!tx_ring->tx_bi)
@@ -644,6 +646,8 @@ int i40evf_setup_rx_descriptors(struct i40e_ring *rx_ring) · 154 unmodified lines
644646 struct device *dev = rx_ring->dev;
645647 int bi_size;
646648
649+ /* warn if we are about to overwrite the pointer */
650+ WARN_ON(rx_ring->rx_bi);
647651 bi_size = sizeof(struct i40e_rx_buffer) * rx_ring->count;
648652 rx_ring->rx_bi = kzalloc(bi_size, GFP_KERNEL);
649653 if (!rx_ring->rx_bi)
drivers/net/ethernet/intel/i40evf/i40evf.h+0−1
@@ -264,7 +264,6 @@ extern const char i40evf_driver_version[]; · 263 unmodified lines
264264
265265 int i40evf_up(struct i40evf_adapter *adapter);
266266 void i40evf_down(struct i40evf_adapter *adapter);
267−void i40evf_reinit_locked(struct i40evf_adapter *adapter);
268267 void i40evf_reset(struct i40evf_adapter *adapter);
269268 void i40evf_set_ethtool_ops(struct net_device *netdev);
270269 void i40evf_update_stats(struct i40evf_adapter *adapter);
drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c+4−2
@@ -267,8 +267,10 @@ static int i40evf_set_ringparam(struct net_device *netdev, · 266 unmodified lines
267267 adapter->tx_desc_count = new_tx_count;
268268 adapter->rx_desc_count = new_rx_count;
269269
270− if (netif_running(netdev))
271− i40evf_reinit_locked(adapter);
270+ if (netif_running(netdev)) {
271+ adapter->flags |= I40EVF_FLAG_RESET_NEEDED;
272+ schedule_work(&adapter->reset_task);
273+ }
272274
273275 return 0;
274276 }
drivers/net/ethernet/intel/i40evf/i40evf_main.c+47−63
@@ -170,7 +170,8 @@ static void i40evf_tx_timeout(struct net_device *netdev) · 169 unmodified lines
170170 struct i40evf_adapter *adapter = netdev_priv(netdev);
171171
172172 adapter->tx_timeout_count++;
173− if (!(adapter->flags & I40EVF_FLAG_RESET_PENDING)) {
173+ if (!(adapter->flags & (I40EVF_FLAG_RESET_PENDING |
174+ I40EVF_FLAG_RESET_NEEDED))) {
174175 adapter->flags |= I40EVF_FLAG_RESET_NEEDED;
175176 schedule_work(&adapter->reset_task);
176177 }
@@ -1460,7 +1461,7 @@ static void i40evf_configure_rss(struct i40evf_adapter *adapter) · 1283 unmodified lines
14601461 for (i = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++) {
14611462 lut = 0;
14621463 for (j = 0; j < 4; j++) {
1463− if (cqueue == adapter->vsi_res->num_queue_pairs)
1464+ if (cqueue == adapter->num_active_queues)
14641465 cqueue = 0;
14651466 lut |= ((cqueue) << (8 * j));
14661467 cqueue++;
@@ -1470,8 +1471,8 @@ static void i40evf_configure_rss(struct i40evf_adapter *adapter) · 3 unmodified lines
14701471 i40e_flush(hw);
14711472 }
14721473
1473−#define I40EVF_RESET_WAIT_MS 100
1474−#define I40EVF_RESET_WAIT_COUNT 200
1474+#define I40EVF_RESET_WAIT_MS 10
1475+#define I40EVF_RESET_WAIT_COUNT 500
14751476 /**
14761477 * i40evf_reset_task - Call-back task to handle hardware reset
14771478 * @work: pointer to work_struct
@@ -1495,10 +1496,17 @@ static void i40evf_reset_task(struct work_struct *work) · 17 unmodified lines
14951496 &adapter->crit_section))
14961497 usleep_range(500, 1000);
14971498
1499+ i40evf_misc_irq_disable(adapter);
14981500 if (adapter->flags & I40EVF_FLAG_RESET_NEEDED) {
1499− dev_info(&adapter->pdev->dev, "Requesting reset from PF\n");
1501+ adapter->flags &= ~I40EVF_FLAG_RESET_NEEDED;
1502+ /* Restart the AQ here. If we have been reset but didn't
1503+ * detect it, or if the PF had to reinit, our AQ will be hosed.
1504+ */
1505+ i40evf_shutdown_adminq(hw);
1506+ i40evf_init_adminq(hw);
15001507 i40evf_request_reset(adapter);
15011508 }
1509+ adapter->flags |= I40EVF_FLAG_RESET_PENDING;
15021510
15031511 /* poll until we see the reset actually happen */
15041512 for (i = 0; i < I40EVF_RESET_WAIT_COUNT; i++) {
@@ -1507,10 +1515,10 @@ static void i40evf_reset_task(struct work_struct *work) · 2 unmodified lines
15071515 if ((rstat_val != I40E_VFR_VFACTIVE) &&
15081516 (rstat_val != I40E_VFR_COMPLETED))
15091517 break;
1510− msleep(I40EVF_RESET_WAIT_MS);
1518+ usleep_range(500, 1000);
15111519 }
15121520 if (i == I40EVF_RESET_WAIT_COUNT) {
1513− adapter->flags &= ~I40EVF_FLAG_RESET_PENDING;
1521+ dev_info(&adapter->pdev->dev, "Never saw reset\n");
15141522 goto continue_reset; /* act like the reset happened */
15151523 }
15161524
@@ -1518,11 +1526,12 @@ static void i40evf_reset_task(struct work_struct *work) · 1 unmodified line
15181526 for (i = 0; i < I40EVF_RESET_WAIT_COUNT; i++) {
15191527 rstat_val = rd32(hw, I40E_VFGEN_RSTAT) &
15201528 I40E_VFGEN_RSTAT_VFR_STATE_MASK;
1521− if ((rstat_val == I40E_VFR_VFACTIVE) ||
1522− (rstat_val == I40E_VFR_COMPLETED))
1529+ if (rstat_val == I40E_VFR_VFACTIVE)
15231530 break;
15241531 msleep(I40EVF_RESET_WAIT_MS);
15251532 }
1533+ /* extra wait to make sure minimum wait is met */
1534+ msleep(I40EVF_RESET_WAIT_MS);
15261535 if (i == I40EVF_RESET_WAIT_COUNT) {
15271536 struct i40evf_mac_filter *f, *ftmp;
15281537 struct i40evf_vlan_filter *fv, *fvtmp;
@@ -1534,11 +1543,10 @@ static void i40evf_reset_task(struct work_struct *work) · 5 unmodified lines
15341543
15351544 if (netif_running(adapter->netdev)) {
15361545 set_bit(__I40E_DOWN, &adapter->vsi.state);
1537− i40evf_irq_disable(adapter);
1538− i40evf_napi_disable_all(adapter);
1539− netif_tx_disable(netdev);
1540− netif_tx_stop_all_queues(netdev);
15411546 netif_carrier_off(netdev);
1547+ netif_tx_disable(netdev);
1548+ i40evf_napi_disable_all(adapter);
1549+ i40evf_irq_disable(adapter);
15421550 i40evf_free_traffic_irqs(adapter);
15431551 i40evf_free_all_tx_resources(adapter);
15441552 i40evf_free_all_rx_resources(adapter);
@@ -1550,6 +1558,7 @@ static void i40evf_reset_task(struct work_struct *work) · 5 unmodified lines
15501558 list_del(&f->list);
15511559 kfree(f);
15521560 }
1561+
15531562 list_for_each_entry_safe(fv, fvtmp, &adapter->vlan_filter_list,
15541563 list) {
15551564 list_del(&fv->list);
@@ -1564,22 +1573,27 @@ static void i40evf_reset_task(struct work_struct *work) · 8 unmodified lines
15641573 i40evf_shutdown_adminq(hw);
15651574 adapter->netdev->flags &= ~IFF_UP;
15661575 clear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section);
1576+ adapter->flags &= ~I40EVF_FLAG_RESET_PENDING;
1577+ dev_info(&adapter->pdev->dev, "Reset task did not complete, VF disabled\n");
15671578 return; /* Do not attempt to reinit. It's dead, Jim. */
15681579 }
15691580
15701581 continue_reset:
1571− adapter->flags &= ~I40EVF_FLAG_RESET_PENDING;
1572−
1573− i40evf_irq_disable(adapter);
1574−
15751582 if (netif_running(adapter->netdev)) {
1576− i40evf_napi_disable_all(adapter);
1577− netif_tx_disable(netdev);
1578− netif_tx_stop_all_queues(netdev);
15791583 netif_carrier_off(netdev);
1584+ netif_tx_stop_all_queues(netdev);
1585+ i40evf_napi_disable_all(adapter);
15801586 }
1587+ i40evf_irq_disable(adapter);
15811588
15821589 adapter->state = __I40EVF_RESETTING;
1590+ adapter->flags &= ~I40EVF_FLAG_RESET_PENDING;
1591+
1592+ /* free the Tx/Rx rings and descriptors, might be better to just
1593+ * re-use them sometime in the future
1594+ */
1595+ i40evf_free_all_rx_resources(adapter);
1596+ i40evf_free_all_tx_resources(adapter);
15831597
15841598 /* kill and reinit the admin queue */
15851599 if (i40evf_shutdown_adminq(hw))
@@ -1603,6 +1617,7 @@ continue_reset: · 17 unmodified lines
16031617 adapter->aq_required = I40EVF_FLAG_AQ_ADD_MAC_FILTER;
16041618 adapter->aq_required |= I40EVF_FLAG_AQ_ADD_VLAN_FILTER;
16051619 clear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section);
1620+ i40evf_misc_irq_enable(adapter);
16061621
16071622 mod_timer(&adapter->watchdog_timer, jiffies + 2);
16081623
@@ -1624,7 +1639,10 @@ continue_reset: · 15 unmodified lines
16241639 goto reset_err;
16251640
16261641 i40evf_irq_enable(adapter, true);
1642+ } else {
1643+ adapter->state = __I40EVF_DOWN;
16271644 }
1645+
16281646 return;
16291647 reset_err:
16301648 dev_err(&adapter->pdev->dev, "failed to allocate resources during reinit\n");
@@ -1667,6 +1685,11 @@ static void i40evf_adminq_task(struct work_struct *work) · 36 unmodified lines
16671685 memset(event.msg_buf, 0, I40EVF_MAX_AQ_BUF_SIZE);
16681686 } while (pending);
16691687
1688+ if ((adapter->flags &
1689+ (I40EVF_FLAG_RESET_PENDING | I40EVF_FLAG_RESET_NEEDED)) ||
1690+ adapter->state == __I40EVF_RESETTING)
1691+ goto freedom;
1692+
16701693 /* check for error indications */
16711694 val = rd32(hw, hw->aq.arq.len);
16721695 oldval = val;
@@ -1702,6 +1725,7 @@ static void i40evf_adminq_task(struct work_struct *work) · 29 unmodified lines
17021725 if (oldval != val)
17031726 wr32(hw, hw->aq.asq.len, val);
17041727
1728+freedom:
17051729 kfree(event.msg_buf);
17061730 out:
17071731 /* re-enable Admin queue interrupt cause */
@@ -1896,47 +1920,6 @@ static struct net_device_stats *i40evf_get_stats(struct net_device *netdev) · 188 unmodified lines
18961920 return &adapter->net_stats;
18971921 }
18981922
1899−/**
1900− * i40evf_reinit_locked - Software reinit
1901− * @adapter: board private structure
1902− *
1903− * Reinititalizes the ring structures in response to a software configuration
1904− * change. Roughly the same as close followed by open, but skips releasing
1905− * and reallocating the interrupts.
1906− **/
1907−void i40evf_reinit_locked(struct i40evf_adapter *adapter)
1908−{
1909− struct net_device *netdev = adapter->netdev;
1910− int err;
1911−
1912− WARN_ON(in_interrupt());
1913−
1914− i40evf_down(adapter);
1915−
1916− /* allocate transmit descriptors */
1917− err = i40evf_setup_all_tx_resources(adapter);
1918− if (err)
1919− goto err_reinit;
1920−
1921− /* allocate receive descriptors */
1922− err = i40evf_setup_all_rx_resources(adapter);
1923− if (err)
1924− goto err_reinit;
1925−
1926− i40evf_configure(adapter);
1927−
1928− err = i40evf_up_complete(adapter);
1929− if (err)
1930− goto err_reinit;
1931−
1932− i40evf_irq_enable(adapter, true);
1933− return;
1934−
1935−err_reinit:
1936− dev_err(&adapter->pdev->dev, "failed to allocate resources during reinit\n");
1937− i40evf_close(netdev);
1938−}
1939−
19401923 /**
19411924 * i40evf_change_mtu - Change the Maximum Transfer Unit
19421925 * @netdev: network interface device structure
@@ -1952,9 +1935,10 @@ static int i40evf_change_mtu(struct net_device *netdev, int new_mtu) · 9 unmodified lines
19521935 if ((new_mtu < 68) || (max_frame > I40E_MAX_RXBUFFER))
19531936 return -EINVAL;
19541937
1955− /* must set new MTU before calling down or up */
19561938 netdev->mtu = new_mtu;
1957− i40evf_reinit_locked(adapter);
1939+ adapter->flags |= I40EVF_FLAG_RESET_NEEDED;
1940+ schedule_work(&adapter->reset_task);
1941+
19581942 return 0;
19591943 }
19601944
drivers/net/ethernet/intel/igb/e1000_82575.c+8−4
@@ -1,5 +1,5 @@
11 /* Intel(R) Gigabit Ethernet Linux driver
2− * Copyright(c) 2007-2014 Intel Corporation.
2+ * Copyright(c) 2007-2015 Intel Corporation.
33 *
44 * This program is free software; you can redistribute it and/or modify it
55 * under the terms and conditions of the GNU General Public License,
@@ -1900,8 +1900,8 @@ static void igb_clear_hw_cntrs_82575(struct e1000_hw *hw) · 1894 unmodified lines
19001900 * igb_rx_fifo_flush_82575 - Clean rx fifo after RX enable
19011901 * @hw: pointer to the HW structure
19021902 *
1903− * After rx enable if managability is enabled then there is likely some
1904− * bad data at the start of the fifo and possibly in the DMA fifo. This
1903+ * After rx enable if manageability is enabled then there is likely some
1904+ * bad data at the start of the fifo and possibly in the DMA fifo. This
19051905 * function clears the fifos and flushes any packets that came in as rx was
19061906 * being enabled.
19071907 **/
@@ -1910,6 +1910,11 @@ void igb_rx_fifo_flush_82575(struct e1000_hw *hw) · 2 unmodified lines
19101910 u32 rctl, rlpml, rxdctl[4], rfctl, temp_rctl, rx_enabled;
19111911 int i, ms_wait;
19121912
1913+ /* disable IPv6 options as per hardware errata */
1914+ rfctl = rd32(E1000_RFCTL);
1915+ rfctl |= E1000_RFCTL_IPV6_EX_DIS;
1916+ wr32(E1000_RFCTL, rfctl);
1917+
19131918 if (hw->mac.type != e1000_82575 ||
19141919 !(rd32(E1000_MANC) & E1000_MANC_RCV_TCO_EN))
19151920 return;
@@ -1937,7 +1942,6 @@ void igb_rx_fifo_flush_82575(struct e1000_hw *hw) · 21 unmodified lines
19371942 * incoming packets are rejected. Set enable and wait 2ms so that
19381943 * any packet that was coming in as RCTL.EN was set is flushed
19391944 */
1940− rfctl = rd32(E1000_RFCTL);
19411945 wr32(E1000_RFCTL, rfctl & ~E1000_RFCTL_LEF);
19421946
19431947 rlpml = rd32(E1000_RLPML);
drivers/net/ethernet/intel/igb/e1000_defines.h+2−1
@@ -344,7 +344,8 @@ · 343 unmodified lines
344344 #define E1000_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */
345345
346346 /* Header split receive */
347−#define E1000_RFCTL_LEF 0x00040000
347+#define E1000_RFCTL_IPV6_EX_DIS 0x00010000
348+#define E1000_RFCTL_LEF 0x00040000
348349
349350 /* Collision related configuration parameters */
350351 #define E1000_COLLISION_THRESHOLD 15
drivers/net/ethernet/intel/igb/igb_main.c+1−1
@@ -58,7 +58,7 @@ · 57 unmodified lines
5858
5959 #define MAJ 5
6060 #define MIN 2
61−#define BUILD 15
61+#define BUILD 18
6262 #define DRV_VERSION __stringify(MAJ) "." __stringify(MIN) "." \
6363 __stringify(BUILD) "-k"
6464 char igb_driver_name[] = "igb";
drivers/net/ethernet/marvell/mvneta.c+26−1
@@ -310,6 +310,7 @@ struct mvneta_port { · 309 unmodified lines
310310 unsigned int link;
311311 unsigned int duplex;
312312 unsigned int speed;
313+ unsigned int tx_csum_limit;
313314 int use_inband_status:1;
314315 };
315316
@@ -2508,8 +2509,10 @@ static int mvneta_change_mtu(struct net_device *dev, int mtu) · 2192 unmodified lines
25082509
25092510 dev->mtu = mtu;
25102511
2511− if (!netif_running(dev))
2512+ if (!netif_running(dev)) {
2513+ netdev_update_features(dev);
25122514 return 0;
2515+ }
25132516
25142517 /* The interface is running, so we have to force a
25152518 * reallocation of the queues
@@ -2538,9 +2541,26 @@ static int mvneta_change_mtu(struct net_device *dev, int mtu) · 22 unmodified lines
25382541 mvneta_start_dev(pp);
25392542 mvneta_port_up(pp);
25402543
2544+ netdev_update_features(dev);
2545+
25412546 return 0;
25422547 }
25432548
2549+static netdev_features_t mvneta_fix_features(struct net_device *dev,
2550+ netdev_features_t features)
2551+{
2552+ struct mvneta_port *pp = netdev_priv(dev);
2553+
2554+ if (pp->tx_csum_limit && dev->mtu > pp->tx_csum_limit) {
2555+ features &= ~(NETIF_F_IP_CSUM | NETIF_F_TSO);
2556+ netdev_info(dev,
2557+ "Disable IP checksum for MTU greater than %dB\n",
2558+ pp->tx_csum_limit);
2559+ }
2560+
2561+ return features;
2562+}
2563+
25442564 /* Get mac address */
25452565 static void mvneta_get_mac_addr(struct mvneta_port *pp, unsigned char *addr)
25462566 {
@@ -2862,6 +2882,7 @@ static const struct net_device_ops mvneta_netdev_ops = { · 315 unmodified lines
28622882 .ndo_set_rx_mode = mvneta_set_rx_mode,
28632883 .ndo_set_mac_address = mvneta_set_mac_addr,
28642884 .ndo_change_mtu = mvneta_change_mtu,
2885+ .ndo_fix_features = mvneta_fix_features,
28652886 .ndo_get_stats64 = mvneta_get_stats64,
28662887 .ndo_do_ioctl = mvneta_ioctl,
28672888 };
@@ -3107,6 +3128,9 @@ static int mvneta_probe(struct platform_device *pdev) · 239 unmodified lines
31073128 }
31083129 }
31093130
3131+ if (of_device_is_compatible(dn, "marvell,armada-370-neta"))
3132+ pp->tx_csum_limit = 1600;
3133+
31103134 pp->tx_ring_size = MVNETA_MAX_TXD;
31113135 pp->rx_ring_size = MVNETA_MAX_RXD;
31123136
@@ -3185,6 +3209,7 @@ static int mvneta_remove(struct platform_device *pdev) · 72 unmodified lines
31853209
31863210 static const struct of_device_id mvneta_match[] = {
31873211 { .compatible = "marvell,armada-370-neta" },
3212+ { .compatible = "marvell,armada-xp-neta" },
31883213 { }
31893214 };
31903215 MODULE_DEVICE_TABLE(of, mvneta_match);
drivers/net/ethernet/mellanox/mlx4/en_netdev.c+0−4
@@ -1977,10 +1977,6 @@ void mlx4_en_free_resources(struct mlx4_en_priv *priv) · 1976 unmodified lines
19771977 mlx4_en_destroy_cq(priv, &priv->rx_cq[i]);
19781978 }
19791979
1980− if (priv->base_tx_qpn) {
1981− mlx4_qp_release_range(priv->mdev->dev, priv->base_tx_qpn, priv->tx_ring_num);
1982− priv->base_tx_qpn = 0;
1983− }
19841980 }
19851981
19861982 int mlx4_en_alloc_resources(struct mlx4_en_priv *priv)
drivers/net/ethernet/mellanox/mlx4/en_rx.c+6−11
@@ -718,7 +718,7 @@ static int get_fixed_ipv6_csum(__wsum hw_checksum, struct sk_buff *skb, · 717 unmodified lines
718718 }
719719 #endif
720720 static int check_csum(struct mlx4_cqe *cqe, struct sk_buff *skb, void *va,
721− int hwtstamp_rx_filter)
721+ netdev_features_t dev_features)
722722 {
723723 __wsum hw_checksum = 0;
724724
@@ -726,14 +726,8 @@ static int check_csum(struct mlx4_cqe *cqe, struct sk_buff *skb, void *va, · 1 unmodified line
726726
727727 hw_checksum = csum_unfold((__force __sum16)cqe->checksum);
728728
729− if (((struct ethhdr *)va)->h_proto == htons(ETH_P_8021Q) &&
730− hwtstamp_rx_filter != HWTSTAMP_FILTER_NONE) {
731− /* next protocol non IPv4 or IPv6 */
732− if (((struct vlan_hdr *)hdr)->h_vlan_encapsulated_proto
733− != htons(ETH_P_IP) &&
734− ((struct vlan_hdr *)hdr)->h_vlan_encapsulated_proto
735− != htons(ETH_P_IPV6))
736− return -1;
729+ if (cqe->vlan_my_qpn & cpu_to_be32(MLX4_CQE_VLAN_PRESENT_MASK) &&
730+ !(dev_features & NETIF_F_HW_VLAN_CTAG_RX)) {
737731 hw_checksum = get_fixed_vlan_csum(hw_checksum, hdr);
738732 hdr += sizeof(struct vlan_hdr);
739733 }
@@ -896,7 +890,8 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud · 156 unmodified lines
896890
897891 if (ip_summed == CHECKSUM_COMPLETE) {
898892 void *va = skb_frag_address(skb_shinfo(gro_skb)->frags);
899− if (check_csum(cqe, gro_skb, va, ring->hwtstamp_rx_filter)) {
893+ if (check_csum(cqe, gro_skb, va,
894+ dev->features)) {
900895 ip_summed = CHECKSUM_NONE;
901896 ring->csum_none++;
902897 ring->csum_complete--;
@@ -951,7 +946,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud · 48 unmodified lines
951946 }
952947
953948 if (ip_summed == CHECKSUM_COMPLETE) {
954− if (check_csum(cqe, skb, skb->data, ring->hwtstamp_rx_filter)) {
949+ if (check_csum(cqe, skb, skb->data, dev->features)) {
955950 ip_summed = CHECKSUM_NONE;
956951 ring->csum_complete--;
957952 ring->csum_none++;
drivers/net/ethernet/mellanox/mlx4/en_tx.c+12−8
@@ -66,6 +66,7 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, · 65 unmodified lines
6666 ring->size = size;
6767 ring->size_mask = size - 1;
6868 ring->stride = stride;
69+ ring->full_size = ring->size - HEADROOM - MAX_DESC_TXBBS;
6970
7071 tmp = size * sizeof(struct mlx4_en_tx_info);
7172 ring->tx_info = kmalloc_node(tmp, GFP_KERNEL | __GFP_NOWARN, node);
@@ -180,6 +181,7 @@ void mlx4_en_destroy_tx_ring(struct mlx4_en_priv *priv, · 108 unmodified lines
180181 mlx4_bf_free(mdev->dev, &ring->bf);
181182 mlx4_qp_remove(mdev->dev, &ring->qp);
182183 mlx4_qp_free(mdev->dev, &ring->qp);
184+ mlx4_qp_release_range(priv->mdev->dev, ring->qpn, 1);
183185 mlx4_en_unmap_buffer(&ring->wqres.buf);
184186 mlx4_free_hwq_res(mdev->dev, &ring->wqres, ring->buf_size);
185187 kfree(ring->bounce_buf);
@@ -231,6 +233,11 @@ void mlx4_en_deactivate_tx_ring(struct mlx4_en_priv *priv, · 45 unmodified lines
231233 MLX4_QP_STATE_RST, NULL, 0, 0, &ring->qp);
232234 }
233235
236+static inline bool mlx4_en_is_tx_ring_full(struct mlx4_en_tx_ring *ring)
237+{
238+ return ring->prod - ring->cons > ring->full_size;
239+}
240+
234241 static void mlx4_en_stamp_wqe(struct mlx4_en_priv *priv,
235242 struct mlx4_en_tx_ring *ring, int index,
236243 u8 owner)
@@ -473,11 +480,10 @@ static bool mlx4_en_process_tx_cq(struct net_device *dev, · 236 unmodified lines
473480
474481 netdev_tx_completed_queue(ring->tx_queue, packets, bytes);
475482
476− /*
477− * Wakeup Tx queue if this stopped, and at least 1 packet
478− * was completed
483+ /* Wakeup Tx queue if this stopped, and ring is not full.
479484 */
480− if (netif_tx_queue_stopped(ring->tx_queue) && txbbs_skipped > 0) {
485+ if (netif_tx_queue_stopped(ring->tx_queue) &&
486+ !mlx4_en_is_tx_ring_full(ring)) {
481487 netif_tx_wake_queue(ring->tx_queue);
482488 ring->wake_queue++;
483489 }
@@ -921,8 +927,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) · 437 unmodified lines
921927 skb_tx_timestamp(skb);
922928
923929 /* Check available TXBBs And 2K spare for prefetch */
924− stop_queue = (int)(ring->prod - ring_cons) >
925− ring->size - HEADROOM - MAX_DESC_TXBBS;
930+ stop_queue = mlx4_en_is_tx_ring_full(ring);
926931 if (unlikely(stop_queue)) {
927932 netif_tx_stop_queue(ring->tx_queue);
928933 ring->queue_stopped++;
@@ -991,8 +996,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) · 62 unmodified lines
991996 smp_rmb();
992997
993998 ring_cons = ACCESS_ONCE(ring->cons);
994− if (unlikely(((int)(ring->prod - ring_cons)) <=
995− ring->size - HEADROOM - MAX_DESC_TXBBS)) {
999+ if (unlikely(!mlx4_en_is_tx_ring_full(ring))) {
9961000 netif_tx_wake_queue(ring->tx_queue);
9971001 ring->wake_queue++;
9981002 }
drivers/net/ethernet/mellanox/mlx4/intf.c+7−1
@@ -93,8 +93,14 @@ int mlx4_register_interface(struct mlx4_interface *intf) · 92 unmodified lines
9393 mutex_lock(&intf_mutex);
9494
9595 list_add_tail(&intf->list, &intf_list);
96− list_for_each_entry(priv, &dev_list, dev_list)
96+ list_for_each_entry(priv, &dev_list, dev_list) {
97+ if (mlx4_is_mfunc(&priv->dev) && (intf->flags & MLX4_INTFF_BONDING)) {
98+ mlx4_dbg(&priv->dev,
99+ "SRIOV, disabling HA mode for intf proto %d\n", intf->protocol);
100+ intf->flags &= ~MLX4_INTFF_BONDING;
101+ }
97102 mlx4_add_device(intf, priv);
103+ }
98104
99105 mutex_unlock(&intf_mutex);
100106
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h+1−1
@@ -279,6 +279,7 @@ struct mlx4_en_tx_ring { · 278 unmodified lines
279279 u32 size; /* number of TXBBs */
280280 u32 size_mask;
281281 u16 stride;
282+ u32 full_size;
282283 u16 cqn; /* index of port CQ associated with this ring */
283284 u32 buf_size;
284285 __be32 doorbell_qpn;
@@ -580,7 +581,6 @@ struct mlx4_en_priv { · 295 unmodified lines
580581 int vids[128];
581582 bool wol;
582583 struct device *ddev;
583− int base_tx_qpn;
584584 struct hlist_head mac_hash[MLX4_EN_MAC_HASH_SIZE];
585585 struct hwtstamp_config hwtstamp_config;
586586 u32 counter_index;
drivers/net/ethernet/renesas/ravb_ptp.c+3−1
@@ -116,8 +116,10 @@ static int ravb_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb) · 115 unmodified lines
116116 priv->ptp.current_addend = addend;
117117
118118 gccr = ravb_read(ndev, GCCR);
119− if (gccr & GCCR_LTI)
119+ if (gccr & GCCR_LTI) {
120+ spin_unlock_irqrestore(&priv->lock, flags);
120121 return -EBUSY;
122+ }
121123 ravb_write(ndev, addend & GTI_TIV, GTI);
122124 ravb_write(ndev, gccr | GCCR_LTI, GCCR);
123125
drivers/net/ethernet/sis/sis900.h+2−2
@@ -56,7 +56,7 @@ enum sis900_configuration_register_bits { · 55 unmodified lines
5656 EDB_MASTER_EN = 0x00002000
5757 };
5858
59−enum sis900_eeprom_access_reigster_bits {
59+enum sis900_eeprom_access_register_bits {
6060 MDC = 0x00000040, MDDIR = 0x00000020, MDIO = 0x00000010, /* 7016 specific */
6161 EECS = 0x00000008, EECLK = 0x00000004, EEDO = 0x00000002,
6262 EEDI = 0x00000001
@@ -73,7 +73,7 @@ enum sis900_interrupt_register_bits { · 10 unmodified lines
7373 RxERR = 0x00000004, RxDESC = 0x00000002, RxOK = 0x00000001
7474 };
7575
76−enum sis900_interrupt_enable_reigster_bits {
76+enum sis900_interrupt_enable_register_bits {
7777 IE = 0x00000001
7878 };
7979
drivers/net/ethernet/stmicro/stmmac/mmc_core.c+2−2
@@ -73,7 +73,7 @@ · 72 unmodified lines
7373 #define MMC_RX_OCTETCOUNT_G 0x00000188
7474 #define MMC_RX_BROADCASTFRAME_G 0x0000018c
7575 #define MMC_RX_MULTICASTFRAME_G 0x00000190
76−#define MMC_RX_CRC_ERRROR 0x00000194
76+#define MMC_RX_CRC_ERROR 0x00000194
7777 #define MMC_RX_ALIGN_ERROR 0x00000198
7878 #define MMC_RX_RUN_ERROR 0x0000019C
7979 #define MMC_RX_JABBER_ERROR 0x000001A0
@@ -196,7 +196,7 @@ void dwmac_mmc_read(void __iomem *ioaddr, struct stmmac_counters *mmc) · 116 unmodified lines
196196 mmc->mmc_rx_octetcount_g += readl(ioaddr + MMC_RX_OCTETCOUNT_G);
197197 mmc->mmc_rx_broadcastframe_g += readl(ioaddr + MMC_RX_BROADCASTFRAME_G);
198198 mmc->mmc_rx_multicastframe_g += readl(ioaddr + MMC_RX_MULTICASTFRAME_G);
199− mmc->mmc_rx_crc_error += readl(ioaddr + MMC_RX_CRC_ERRROR);
199+ mmc->mmc_rx_crc_error += readl(ioaddr + MMC_RX_CRC_ERROR);
200200 mmc->mmc_rx_align_error += readl(ioaddr + MMC_RX_ALIGN_ERROR);
201201 mmc->mmc_rx_run_error += readl(ioaddr + MMC_RX_RUN_ERROR);
202202 mmc->mmc_rx_jabber_error += readl(ioaddr + MMC_RX_JABBER_ERROR);
drivers/net/ethernet/via/Kconfig+2−0
@@ -18,6 +18,7 @@ if NET_VENDOR_VIA · 17 unmodified lines
1818 config VIA_RHINE
1919 tristate "VIA Rhine support"
2020 depends on (PCI || OF_IRQ)
21+ depends on HAS_DMA
2122 select CRC32
2223 select MII
2324 ---help---
@@ -42,6 +43,7 @@ config VIA_RHINE_MMIO · 18 unmodified lines
4243 config VIA_VELOCITY
4344 tristate "VIA Velocity support"
4445 depends on (PCI || (OF_ADDRESS && OF_IRQ))
46+ depends on HAS_DMA
4547 select CRC32
4648 select CRC_CCITT
4749 select MII
drivers/net/phy/bcm7xxx.c+7−0
@@ -246,6 +246,13 @@ static int bcm7xxx_28nm_config_init(struct phy_device *phydev) · 245 unmodified lines
246246 pr_info_once("%s: %s PHY revision: 0x%02x, patch: %d\n",
247247 dev_name(&phydev->dev), phydev->drv->name, rev, patch);
248248
249+ /* Dummy read to a register to workaround an issue upon reset where the
250+ * internal inverter may not allow the first MDIO transaction to pass
251+ * the MDIO management controller and make us return 0xffff for such
252+ * reads.
253+ */
254+ phy_read(phydev, MII_BMSR);
255+
249256 switch (rev) {
250257 case 0xb0:
251258 ret = bcm7xxx_28nm_b0_afe_config_init(phydev);
drivers/net/phy/mdio-bcm-unimac.c+43−0
@@ -120,6 +120,48 @@ static int unimac_mdio_write(struct mii_bus *bus, int phy_id, · 119 unmodified lines
120120 return 0;
121121 }
122122
123+/* Workaround for integrated BCM7xxx Gigabit PHYs which have a problem with
124+ * their internal MDIO management controller making them fail to successfully
125+ * be read from or written to for the first transaction. We insert a dummy
126+ * BMSR read here to make sure that phy_get_device() and get_phy_id() can
127+ * correctly read the PHY MII_PHYSID1/2 registers and successfully register a
128+ * PHY device for this peripheral.
129+ *
130+ * Once the PHY driver is registered, we can workaround subsequent reads from
131+ * there (e.g: during system-wide power management).
132+ *
133+ * bus->reset is invoked before mdiobus_scan during mdiobus_register and is
134+ * therefore the right location to stick that workaround. Since we do not want
135+ * to read from non-existing PHYs, we either use bus->phy_mask or do a manual
136+ * Device Tree scan to limit the search area.
137+ */
138+static int unimac_mdio_reset(struct mii_bus *bus)
139+{
140+ struct device_node *np = bus->dev.of_node;
141+ struct device_node *child;
142+ u32 read_mask = 0;
143+ int addr;
144+
145+ if (!np) {
146+ read_mask = ~bus->phy_mask;
147+ } else {
148+ for_each_available_child_of_node(np, child) {
149+ addr = of_mdio_parse_addr(&bus->dev, child);
150+ if (addr < 0)
151+ continue;
152+
153+ read_mask |= 1 << addr;
154+ }
155+ }
156+
157+ for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
158+ if (read_mask & 1 << addr)
159+ mdiobus_read(bus, addr, MII_BMSR);
160+ }
161+
162+ return 0;
163+}
164+
123165 static int unimac_mdio_probe(struct platform_device *pdev)
124166 {
125167 struct unimac_mdio_priv *priv;
@@ -155,6 +197,7 @@ static int unimac_mdio_probe(struct platform_device *pdev) · 29 unmodified lines
155197 bus->parent = &pdev->dev;
156198 bus->read = unimac_mdio_read;
157199 bus->write = unimac_mdio_write;
200+ bus->reset = unimac_mdio_reset;
158201 snprintf(bus->id, MII_BUS_ID_SIZE, "%s", pdev->name);
159202
160203 bus->irq = kcalloc(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL);
drivers/net/phy/phy_device.c+17−8
@@ -230,7 +230,7 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr, u32 *phy_id, · 229 unmodified lines
230230 for (i = 1;
231231 i < num_ids && c45_ids->devices_in_package == 0;
232232 i++) {
233− reg_addr = MII_ADDR_C45 | i << 16 | MDIO_DEVS2;
233+retry: reg_addr = MII_ADDR_C45 | i << 16 | MDIO_DEVS2;
234234 phy_reg = mdiobus_read(bus, addr, reg_addr);
235235 if (phy_reg < 0)
236236 return -EIO;
@@ -242,12 +242,20 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr, u32 *phy_id, · 5 unmodified lines
242242 return -EIO;
243243 c45_ids->devices_in_package |= (phy_reg & 0xffff);
244244
245− /* If mostly Fs, there is no device there,
246− * let's get out of here.
247− */
248245 if ((c45_ids->devices_in_package & 0x1fffffff) == 0x1fffffff) {
249− *phy_id = 0xffffffff;
250− return 0;
246+ if (i) {
247+ /* If mostly Fs, there is no device there,
248+ * then let's continue to probe more, as some
249+ * 10G PHYs have zero Devices In package,
250+ * e.g. Cortina CS4315/CS4340 PHY.
251+ */
252+ i = 0;
253+ goto retry;
254+ } else {
255+ /* no device there, let's get out of here */
256+ *phy_id = 0xffffffff;
257+ return 0;
258+ }
251259 }
252260 }
253261
@@ -796,10 +804,11 @@ static int genphy_config_advert(struct phy_device *phydev) · 542 unmodified lines
796804 if (phydev->supported & (SUPPORTED_1000baseT_Half |
797805 SUPPORTED_1000baseT_Full)) {
798806 adv |= ethtool_adv_to_mii_ctrl1000_t(advertise);
799− if (adv != oldadv)
800− changed = 1;
801807 }
802808
809+ if (adv != oldadv)
810+ changed = 1;
811+
803812 err = phy_write(phydev, MII_CTRL1000, adv);
804813 if (err < 0)
805814 return err;
drivers/net/phy/vitesse.c+14−0
@@ -66,6 +66,7 @@ · 65 unmodified lines
6666 #define PHY_ID_VSC8244 0x000fc6c0
6767 #define PHY_ID_VSC8514 0x00070670
6868 #define PHY_ID_VSC8574 0x000704a0
69+#define PHY_ID_VSC8641 0x00070431
6970 #define PHY_ID_VSC8662 0x00070660
7071 #define PHY_ID_VSC8221 0x000fc550
7172 #define PHY_ID_VSC8211 0x000fc4b0
@@ -271,6 +272,18 @@ static struct phy_driver vsc82xx_driver[] = { · 199 unmodified lines
271272 .ack_interrupt = &vsc824x_ack_interrupt,
272273 .config_intr = &vsc82xx_config_intr,
273274 .driver = { .owner = THIS_MODULE,},
275+}, {
276+ .phy_id = PHY_ID_VSC8641,
277+ .name = "Vitesse VSC8641",
278+ .phy_id_mask = 0x000ffff0,
279+ .features = PHY_GBIT_FEATURES,
280+ .flags = PHY_HAS_INTERRUPT,
281+ .config_init = &vsc824x_config_init,
282+ .config_aneg = &vsc82x4_config_aneg,
283+ .read_status = &genphy_read_status,
284+ .ack_interrupt = &vsc824x_ack_interrupt,
285+ .config_intr = &vsc82xx_config_intr,
286+ .driver = { .owner = THIS_MODULE,},
274287 }, {
275288 .phy_id = PHY_ID_VSC8662,
276289 .name = "Vitesse VSC8662",
@@ -318,6 +331,7 @@ static struct mdio_device_id __maybe_unused vitesse_tbl[] = { · 41 unmodified lines
318331 { PHY_ID_VSC8244, 0x000fffc0 },
319332 { PHY_ID_VSC8514, 0x000ffff0 },
320333 { PHY_ID_VSC8574, 0x000ffff0 },
334+ { PHY_ID_VSC8641, 0x000ffff0 },
321335 { PHY_ID_VSC8662, 0x000ffff0 },
322336 { PHY_ID_VSC8221, 0x000ffff0 },
323337 { PHY_ID_VSC8211, 0x000ffff0 },
drivers/net/vmxnet3/vmxnet3_int.h+2−2
@@ -69,10 +69,10 @@ · 68 unmodified lines
6969 /*
7070 * Version numbers
7171 */
72−#define VMXNET3_DRIVER_VERSION_STRING "1.3.5.0-k"
72+#define VMXNET3_DRIVER_VERSION_STRING "1.4.2.0-k"
7373
7474 /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */
75−#define VMXNET3_DRIVER_VERSION_NUM 0x01030500
75+#define VMXNET3_DRIVER_VERSION_NUM 0x01040200
7676
7777 #if defined(CONFIG_PCI_MSI)
7878 /* RSS only makes sense if MSI-X is supported. */
drivers/net/xen-netfront.c+0−7
@@ -1244,10 +1244,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev) · 1243 unmodified lines
12441244 np = netdev_priv(netdev);
12451245 np->xbdev = dev;
12461246
1247− /* No need to use rtnl_lock() before the call below as it
1248− * happens before register_netdev().
1249− */
1250− netif_set_real_num_tx_queues(netdev, 0);
12511247 np->queues = NULL;
12521248
12531249 err = -ENOMEM;
@@ -1899,9 +1895,6 @@ abort_transaction_no_dev_fatal: · 645 unmodified lines
18991895 xennet_disconnect_backend(info);
19001896 kfree(info->queues);
19011897 info->queues = NULL;
1902− rtnl_lock();
1903− netif_set_real_num_tx_queues(info->netdev, 0);
1904− rtnl_unlock();
19051898 out:
19061899 return err;
19071900 }
include/net/ax25.h+15−1
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/slab.h>
1414 #include <linux/atomic.h>
1515 #include <net/neighbour.h>
16+#include <net/sock.h>
1617
1718 #define AX25_T1CLAMPLO 1
1819 #define AX25_T1CLAMPHI (30 * HZ)
@@ -246,7 +247,20 @@ typedef struct ax25_cb { · 227 unmodified lines
246247 atomic_t refcount;
247248 } ax25_cb;
248249
249−#define ax25_sk(__sk) ((ax25_cb *)(__sk)->sk_protinfo)
250+struct ax25_sock {
251+ struct sock sk;
252+ struct ax25_cb *cb;
253+};
254+
255+static inline struct ax25_sock *ax25_sk(const struct sock *sk)
256+{
257+ return (struct ax25_sock *) sk;
258+}
259+
260+static inline struct ax25_cb *sk_to_ax25(const struct sock *sk)
261+{
262+ return ax25_sk(sk)->cb;
263+}
250264
251265 #define ax25_for_each(__ax25, list) \
252266 hlist_for_each_entry(__ax25, list, ax25_node)
include/net/sock.h+0−2
@@ -277,7 +277,6 @@ struct cg_proto; · 276 unmodified lines
277277 * @sk_incoming_cpu: record cpu processing incoming packets
278278 * @sk_txhash: computed flow hash for use on transmit
279279 * @sk_filter: socket filtering instructions
280− * @sk_protinfo: private area, net family specific, when not using slab
281280 * @sk_timer: sock cleanup timer
282281 * @sk_stamp: time stamp of last packet received
283282 * @sk_tsflags: SO_TIMESTAMPING socket options
@@ -416,7 +415,6 @@ struct sock { · 132 unmodified lines
416415 const struct cred *sk_peer_cred;
417416 long sk_rcvtimeo;
418417 long sk_sndtimeo;
419− void *sk_protinfo;
420418 struct timer_list sk_timer;
421419 ktime_t sk_stamp;
422420 u16 sk_tsflags;
include/uapi/linux/in.h+13−3
@@ -19,8 +19,10 @@ · 18 unmodified lines
1919 #define _UAPI_LINUX_IN_H
2020
2121 #include <linux/types.h>
22+#include <linux/libc-compat.h>
2223 #include <linux/socket.h>
2324
25+#if __UAPI_DEF_IN_IPPROTO
2426 /* Standard well-defined IP protocols. */
2527 enum {
2628 IPPROTO_IP = 0, /* Dummy protocol for TCP */
@@ -75,12 +77,14 @@ enum { · 48 unmodified lines
7577 #define IPPROTO_RAW IPPROTO_RAW
7678 IPPROTO_MAX
7779 };
80+#endif
7881
79−
82+#if __UAPI_DEF_IN_ADDR
8083 /* Internet address. */
8184 struct in_addr {
8285 __be32 s_addr;
8386 };
87+#endif
8488
8589 #define IP_TOS 1
8690 #define IP_TTL 2
@@ -158,6 +162,7 @@ struct in_addr { · 71 unmodified lines
158162
159163 /* Request struct for multicast socket ops */
160164
165+#if __UAPI_DEF_IP_MREQ
161166 struct ip_mreq {
162167 struct in_addr imr_multiaddr; /* IP multicast address of group */
163168 struct in_addr imr_interface; /* local IP address of interface */
@@ -209,14 +214,18 @@ struct group_filter { · 45 unmodified lines
209214 #define GROUP_FILTER_SIZE(numsrc) \
210215 (sizeof(struct group_filter) - sizeof(struct __kernel_sockaddr_storage) \
211216 + (numsrc) * sizeof(struct __kernel_sockaddr_storage))
217+#endif
212218
219+#if __UAPI_DEF_IN_PKTINFO
213220 struct in_pktinfo {
214221 int ipi_ifindex;
215222 struct in_addr ipi_spec_dst;
216223 struct in_addr ipi_addr;
217224 };
225+#endif
218226
219227 /* Structure describing an Internet (IP) socket address. */
228+#if __UAPI_DEF_SOCKADDR_IN
220229 #define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */
221230 struct sockaddr_in {
222231 __kernel_sa_family_t sin_family; /* Address family */
@@ -228,8 +237,9 @@ struct sockaddr_in { · 5 unmodified lines
228237 sizeof(unsigned short int) - sizeof(struct in_addr)];
229238 };
230239 #define sin_zero __pad /* for BSD UNIX comp. -FvK */
240+#endif
231241
232−
242+#if __UAPI_DEF_IN_CLASS
233243 /*
234244 * Definitions of the bits in an Internet address integer.
235245 * On subnets, host and network parts are found according
@@ -280,7 +290,7 @@ struct sockaddr_in { · 44 unmodified lines
280290 #define INADDR_ALLHOSTS_GROUP 0xe0000001U /* 224.0.0.1 */
281291 #define INADDR_ALLRTRS_GROUP 0xe0000002U /* 224.0.0.2 */
282292 #define INADDR_MAX_LOCAL_GROUP 0xe00000ffU /* 224.0.0.255 */
283−
293+#endif
284294
285295 /* <asm/byteorder.h> contains the htonl type stuff.. */
286296 #include <asm/byteorder.h>
include/uapi/linux/libc-compat.h+22−0
@@ -56,6 +56,13 @@ · 55 unmodified lines
5656
5757 /* GLIBC headers included first so don't define anything
5858 * that would already be defined. */
59+#define __UAPI_DEF_IN_ADDR 0
60+#define __UAPI_DEF_IN_IPPROTO 0
61+#define __UAPI_DEF_IN_PKTINFO 0
62+#define __UAPI_DEF_IP_MREQ 0
63+#define __UAPI_DEF_SOCKADDR_IN 0
64+#define __UAPI_DEF_IN_CLASS 0
65+
5966 #define __UAPI_DEF_IN6_ADDR 0
6067 /* The exception is the in6_addr macros which must be defined
6168 * if the glibc code didn't define them. This guard matches
@@ -78,6 +85,13 @@ · 16 unmodified lines
7885 /* Linux headers included first, and we must define everything
7986 * we need. The expectation is that glibc will check the
8087 * __UAPI_DEF_* defines and adjust appropriately. */
88+#define __UAPI_DEF_IN_ADDR 1
89+#define __UAPI_DEF_IN_IPPROTO 1
90+#define __UAPI_DEF_IN_PKTINFO 1
91+#define __UAPI_DEF_IP_MREQ 1
92+#define __UAPI_DEF_SOCKADDR_IN 1
93+#define __UAPI_DEF_IN_CLASS 1
94+
8195 #define __UAPI_DEF_IN6_ADDR 1
8296 /* We unconditionally define the in6_addr macros and glibc must
8397 * coordinate. */
@@ -103,6 +117,14 @@ · 19 unmodified lines
103117 * that we need. */
104118 #else /* !defined(__GLIBC__) */
105119
120+/* Definitions for in.h */
121+#define __UAPI_DEF_IN_ADDR 1
122+#define __UAPI_DEF_IN_IPPROTO 1
123+#define __UAPI_DEF_IN_PKTINFO 1
124+#define __UAPI_DEF_IP_MREQ 1
125+#define __UAPI_DEF_SOCKADDR_IN 1
126+#define __UAPI_DEF_IN_CLASS 1
127+
106128 /* Definitions for in6.h */
107129 #define __UAPI_DEF_IN6_ADDR 1
108130 #define __UAPI_DEF_IN6_ADDR_ALT 1
net/ax25/af_ax25.c+15−15
@@ -57,7 +57,7 @@ static const struct proto_ops ax25_proto_ops; · 56 unmodified lines
5757
5858 static void ax25_free_sock(struct sock *sk)
5959 {
60− ax25_cb_put(ax25_sk(sk));
60+ ax25_cb_put(sk_to_ax25(sk));
6161 }
6262
6363 /*
@@ -306,7 +306,7 @@ void ax25_destroy_socket(ax25_cb *ax25) · 242 unmodified lines
306306 while ((skb = skb_dequeue(&ax25->sk->sk_receive_queue)) != NULL) {
307307 if (skb->sk != ax25->sk) {
308308 /* A pending connection */
309− ax25_cb *sax25 = ax25_sk(skb->sk);
309+ ax25_cb *sax25 = sk_to_ax25(skb->sk);
310310
311311 /* Queue the unaccepted socket for death */
312312 sock_orphan(skb->sk);
@@ -551,7 +551,7 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname, · 238 unmodified lines
551551 return -EFAULT;
552552
553553 lock_sock(sk);
554− ax25 = ax25_sk(sk);
554+ ax25 = sk_to_ax25(sk);
555555
556556 switch (optname) {
557557 case AX25_WINDOW:
@@ -697,7 +697,7 @@ static int ax25_getsockopt(struct socket *sock, int level, int optname, · 139 unmodified lines
697697 length = min_t(unsigned int, maxlen, sizeof(int));
698698
699699 lock_sock(sk);
700− ax25 = ax25_sk(sk);
700+ ax25 = sk_to_ax25(sk);
701701
702702 switch (optname) {
703703 case AX25_WINDOW:
@@ -796,7 +796,7 @@ out: · 92 unmodified lines
796796 static struct proto ax25_proto = {
797797 .name = "AX25",
798798 .owner = THIS_MODULE,
799− .obj_size = sizeof(struct sock),
799+ .obj_size = sizeof(struct ax25_sock),
800800 };
801801
802802 static int ax25_create(struct net *net, struct socket *sock, int protocol,
@@ -858,7 +858,7 @@ static int ax25_create(struct net *net, struct socket *sock, int protocol, · 55 unmodified lines
858858 if (sk == NULL)
859859 return -ENOMEM;
860860
861− ax25 = sk->sk_protinfo = ax25_create_cb();
861+ ax25 = ax25_sk(sk)->cb = ax25_create_cb();
862862 if (!ax25) {
863863 sk_free(sk);
864864 return -ENOMEM;
@@ -910,7 +910,7 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev) · 45 unmodified lines
910910 sk->sk_state = TCP_ESTABLISHED;
911911 sock_copy_flags(sk, osk);
912912
913− oax25 = ax25_sk(osk);
913+ oax25 = sk_to_ax25(osk);
914914
915915 ax25->modulus = oax25->modulus;
916916 ax25->backoff = oax25->backoff;
@@ -938,7 +938,7 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev) · 21 unmodified lines
938938 }
939939 }
940940
941− sk->sk_protinfo = ax25;
941+ ax25_sk(sk)->cb = ax25;
942942 sk->sk_destruct = ax25_free_sock;
943943 ax25->sk = sk;
944944
@@ -956,7 +956,7 @@ static int ax25_release(struct socket *sock) · 11 unmodified lines
956956 sock_hold(sk);
957957 sock_orphan(sk);
958958 lock_sock(sk);
959− ax25 = ax25_sk(sk);
959+ ax25 = sk_to_ax25(sk);
960960
961961 if (sk->sk_type == SOCK_SEQPACKET) {
962962 switch (ax25->state) {
@@ -1066,7 +1066,7 @@ static int ax25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) · 103 unmodified lines
10661066
10671067 lock_sock(sk);
10681068
1069− ax25 = ax25_sk(sk);
1069+ ax25 = sk_to_ax25(sk);
10701070 if (!sock_flag(sk, SOCK_ZAPPED)) {
10711071 err = -EINVAL;
10721072 goto out;
@@ -1113,7 +1113,7 @@ static int __must_check ax25_connect(struct socket *sock, · 40 unmodified lines
11131113 struct sockaddr *uaddr, int addr_len, int flags)
11141114 {
11151115 struct sock *sk = sock->sk;
1116− ax25_cb *ax25 = ax25_sk(sk), *ax25t;
1116+ ax25_cb *ax25 = sk_to_ax25(sk), *ax25t;
11171117 struct full_sockaddr_ax25 *fsa = (struct full_sockaddr_ax25 *)uaddr;
11181118 ax25_digi *digi = NULL;
11191119 int ct = 0, err = 0;
@@ -1394,7 +1394,7 @@ static int ax25_getname(struct socket *sock, struct sockaddr *uaddr, · 274 unmodified lines
13941394
13951395 memset(fsa, 0, sizeof(*fsa));
13961396 lock_sock(sk);
1397− ax25 = ax25_sk(sk);
1397+ ax25 = sk_to_ax25(sk);
13981398
13991399 if (peer != 0) {
14001400 if (sk->sk_state != TCP_ESTABLISHED) {
@@ -1446,7 +1446,7 @@ static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) · 45 unmodified lines
14461446 return -EINVAL;
14471447
14481448 lock_sock(sk);
1449− ax25 = ax25_sk(sk);
1449+ ax25 = sk_to_ax25(sk);
14501450
14511451 if (sock_flag(sk, SOCK_ZAPPED)) {
14521452 err = -EADDRNOTAVAIL;
@@ -1621,7 +1621,7 @@ static int ax25_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, · 168 unmodified lines
16211621 if (skb == NULL)
16221622 goto out;
16231623
1624− if (!ax25_sk(sk)->pidincl)
1624+ if (!sk_to_ax25(sk)->pidincl)
16251625 skb_pull(skb, 1); /* Remove PID */
16261626
16271627 skb_reset_transport_header(skb);
@@ -1762,7 +1762,7 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) · 134 unmodified lines
17621762
17631763 case SIOCAX25GETINFO:
17641764 case SIOCAX25GETINFOOLD: {
1765− ax25_cb *ax25 = ax25_sk(sk);
1765+ ax25_cb *ax25 = sk_to_ax25(sk);
17661766 struct ax25_info_struct ax25_info;
17671767
17681768 ax25_info.t1 = ax25->t1 / HZ;
net/ax25/ax25_in.c+1−1
@@ -353,7 +353,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev, · 352 unmodified lines
353353 return 0;
354354 }
355355
356− ax25 = ax25_sk(make);
356+ ax25 = sk_to_ax25(make);
357357 skb_set_owner_r(skb, make);
358358 skb_queue_head(&sk->sk_receive_queue, skb);
359359
net/core/flow_dissector.c+1−1
@@ -129,7 +129,7 @@ bool __skb_flow_dissect(const struct sk_buff *skb, · 128 unmodified lines
129129 struct flow_dissector_key_ports *key_ports;
130130 struct flow_dissector_key_tags *key_tags;
131131 struct flow_dissector_key_keyid *key_keyid;
132− u8 ip_proto;
132+ u8 ip_proto = 0;
133133
134134 if (!data) {
135135 data = skb->data;
net/core/sock.c+1−2
@@ -1454,7 +1454,7 @@ void sk_destruct(struct sock *sk) · 1453 unmodified lines
14541454
14551455 static void __sk_free(struct sock *sk)
14561456 {
1457− if (unlikely(sock_diag_has_destroy_listeners(sk)))
1457+ if (unlikely(sock_diag_has_destroy_listeners(sk) && sk->sk_net_refcnt))
14581458 sock_diag_broadcast_destroy(sk);
14591459 else
14601460 sk_destruct(sk);
@@ -2269,7 +2269,6 @@ static void sock_def_write_space(struct sock *sk) · 808 unmodified lines
22692269
22702270 static void sock_def_destruct(struct sock *sk)
22712271 {
2272− kfree(sk->sk_protinfo);
22732272 }
22742273
22752274 void sk_send_sigurg(struct sock *sk)
net/dsa/slave.c+1−1
@@ -112,7 +112,7 @@ static int dsa_slave_open(struct net_device *dev) · 111 unmodified lines
112112
113113 clear_promisc:
114114 if (dev->flags & IFF_PROMISC)
115− dev_set_promiscuity(master, 0);
115+ dev_set_promiscuity(master, -1);
116116 clear_allmulti:
117117 if (dev->flags & IFF_ALLMULTI)
118118 dev_set_allmulti(master, -1);
net/ipv4/fib_semantics.c+2−2
@@ -1045,7 +1045,7 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event, · 1044 unmodified lines
10451045 nla_put_u32(skb, RTA_OIF, fi->fib_nh->nh_oif))
10461046 goto nla_put_failure;
10471047 if (fi->fib_nh->nh_flags & RTNH_F_LINKDOWN) {
1048− in_dev = __in_dev_get_rcu(fi->fib_nh->nh_dev);
1048+ in_dev = __in_dev_get_rtnl(fi->fib_nh->nh_dev);
10491049 if (in_dev &&
10501050 IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN(in_dev))
10511051 rtm->rtm_flags |= RTNH_F_DEAD;
@@ -1074,7 +1074,7 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event, · 22 unmodified lines
10741074
10751075 rtnh->rtnh_flags = nh->nh_flags & 0xFF;
10761076 if (nh->nh_flags & RTNH_F_LINKDOWN) {
1077− in_dev = __in_dev_get_rcu(nh->nh_dev);
1077+ in_dev = __in_dev_get_rtnl(nh->nh_dev);
10781078 if (in_dev &&
10791079 IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN(in_dev))
10801080 rtnh->rtnh_flags |= RTNH_F_DEAD;
net/sched/cls_flower.c+2−2
@@ -216,8 +216,8 @@ static const struct nla_policy fl_policy[TCA_FLOWER_MAX + 1] = { · 215 unmodified lines
216216 [TCA_FLOWER_KEY_IPV6_DST_MASK] = { .len = sizeof(struct in6_addr) },
217217 [TCA_FLOWER_KEY_TCP_SRC] = { .type = NLA_U16 },
218218 [TCA_FLOWER_KEY_TCP_DST] = { .type = NLA_U16 },
219− [TCA_FLOWER_KEY_TCP_SRC] = { .type = NLA_U16 },
220− [TCA_FLOWER_KEY_TCP_DST] = { .type = NLA_U16 },
219+ [TCA_FLOWER_KEY_UDP_SRC] = { .type = NLA_U16 },
220+ [TCA_FLOWER_KEY_UDP_DST] = { .type = NLA_U16 },
221221 };
222222
223223 static void fl_set_key_val(struct nlattr **tb,
net/sctp/output.c+3−1
@@ -599,7 +599,9 @@ out: · 598 unmodified lines
599599 return err;
600600 no_route:
601601 kfree_skb(nskb);
602− IP_INC_STATS(sock_net(asoc->base.sk), IPSTATS_MIB_OUTNOROUTES);
602+
603+ if (asoc)
604+ IP_INC_STATS(sock_net(asoc->base.sk), IPSTATS_MIB_OUTNOROUTES);
603605
604606 /* FIXME: Returning the 'err' will effect all the associations
605607 * associated with a socket, although only one of the paths of the
net/sctp/socket.c+0−6
@@ -2121,12 +2121,6 @@ static int sctp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, · 2120 unmodified lines
21212121 if (sp->subscribe.sctp_data_io_event)
21222122 sctp_ulpevent_read_sndrcvinfo(event, msg);
21232123
2124−#if 0
2125− /* FIXME: we should be calling IP/IPv6 layers. */
2126− if (sk->sk_protinfo.af_inet.cmsg_flags)
2127− ip_cmsg_recv(msg, skb);
2128−#endif
2129−
21302124 err = copied;
21312125
21322126 /* If skb's length exceeds the user's buffer, update the skb and
net/tipc/bcast.c+5−0
@@ -108,6 +108,11 @@ void tipc_bclink_remove_node(struct net *net, u32 addr) · 107 unmodified lines
108108
109109 tipc_bclink_lock(net);
110110 tipc_nmap_remove(&tn->bclink->bcast_nodes, addr);
111+
112+ /* Last node? => reset backlog queue */
113+ if (!tn->bclink->bcast_nodes.count)
114+ tipc_link_purge_backlog(&tn->bclink->link);
115+
111116 tipc_bclink_unlock(net);
112117 }
113118
net/tipc/link.c+1−1
@@ -404,7 +404,7 @@ void tipc_link_reset_fragments(struct tipc_link *l_ptr) · 403 unmodified lines
404404 l_ptr->reasm_buf = NULL;
405405 }
406406
407−static void tipc_link_purge_backlog(struct tipc_link *l)
407+void tipc_link_purge_backlog(struct tipc_link *l)
408408 {
409409 __skb_queue_purge(&l->backlogq);
410410 l->backlog[TIPC_LOW_IMPORTANCE].len = 0;
net/tipc/link.h+1−0
@@ -218,6 +218,7 @@ void tipc_link_reset_fragments(struct tipc_link *l_ptr); · 217 unmodified lines
218218 int tipc_link_is_up(struct tipc_link *l_ptr);
219219 int tipc_link_is_active(struct tipc_link *l_ptr);
220220 void tipc_link_purge_queues(struct tipc_link *l_ptr);
221+void tipc_link_purge_backlog(struct tipc_link *l);
221222 void tipc_link_reset_all(struct tipc_node *node);
222223 void tipc_link_reset(struct tipc_link *l_ptr);
223224 int tipc_link_xmit_skb(struct net *net, struct sk_buff *skb, u32 dest,