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

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

+244 -166
+14
Documentation/networking/ip-sysctl.txt
··· 56 56 0 - disabled 57 57 1 - enabled 58 58 59 + fwmark_reflect - BOOLEAN 60 + Controls the fwmark of kernel-generated IPv4 reply packets that are not 61 + associated with a socket for example, TCP RSTs or ICMP echo replies). 62 + If unset, these packets have a fwmark of zero. If set, they have the 63 + fwmark of the packet they are replying to. 64 + Default: 0 65 + 59 66 route/max_size - INTEGER 60 67 Maximum number of routes allowed in the kernel. Increase 61 68 this when using large numbers of interfaces and/or routes. ··· 1215 1208 1216 1209 proxy_ndp - BOOLEAN 1217 1210 Do proxy ndp. 1211 + 1212 + fwmark_reflect - BOOLEAN 1213 + Controls the fwmark of kernel-generated IPv6 reply packets that are not 1214 + associated with a socket for example, TCP RSTs or ICMPv6 echo replies). 1215 + If unset, these packets have a fwmark of zero. If set, they have the 1216 + fwmark of the packet they are replying to. 1217 + Default: 0 1218 1218 1219 1219 conf/interface/*: 1220 1220 Change special settings per interface.
+5 -5
arch/arm64/boot/dts/apm-storm.dtsi
··· 599 599 compatible = "apm,xgene-enet"; 600 600 status = "disabled"; 601 601 reg = <0x0 0x17020000 0x0 0xd100>, 602 - <0x0 0X17030000 0x0 0X400>, 602 + <0x0 0X17030000 0x0 0Xc300>, 603 603 <0x0 0X10000000 0x0 0X200>; 604 604 reg-names = "enet_csr", "ring_csr", "ring_cmd"; 605 605 interrupts = <0x0 0x3c 0x4>; ··· 624 624 sgenet0: ethernet@1f210000 { 625 625 compatible = "apm,xgene-enet"; 626 626 status = "disabled"; 627 - reg = <0x0 0x1f210000 0x0 0x10000>, 628 - <0x0 0x1f200000 0x0 0X10000>, 629 - <0x0 0x1B000000 0x0 0X20000>; 627 + reg = <0x0 0x1f210000 0x0 0xd100>, 628 + <0x0 0x1f200000 0x0 0Xc300>, 629 + <0x0 0x1B000000 0x0 0X200>; 630 630 reg-names = "enet_csr", "ring_csr", "ring_cmd"; 631 631 interrupts = <0x0 0xA0 0x4>; 632 632 dma-coherent; ··· 639 639 compatible = "apm,xgene-enet"; 640 640 status = "disabled"; 641 641 reg = <0x0 0x1f610000 0x0 0xd100>, 642 - <0x0 0x1f600000 0x0 0X400>, 642 + <0x0 0x1f600000 0x0 0Xc300>, 643 643 <0x0 0x18000000 0x0 0X200>; 644 644 reg-names = "enet_csr", "ring_csr", "ring_cmd"; 645 645 interrupts = <0x0 0x60 0x4>;
+17 -1
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
··· 575 575 xgene_enet_wr_mcx_mac(pdata, MAC_CONFIG_1_ADDR, data & ~TX_EN); 576 576 } 577 577 578 - static void xgene_enet_reset(struct xgene_enet_pdata *pdata) 578 + bool xgene_ring_mgr_init(struct xgene_enet_pdata *p) 579 + { 580 + if (!ioread32(p->ring_csr_addr + CLKEN_ADDR)) 581 + return false; 582 + 583 + if (ioread32(p->ring_csr_addr + SRST_ADDR)) 584 + return false; 585 + 586 + return true; 587 + } 588 + 589 + static int xgene_enet_reset(struct xgene_enet_pdata *pdata) 579 590 { 580 591 u32 val; 592 + 593 + if (!xgene_ring_mgr_init(pdata)) 594 + return -ENODEV; 581 595 582 596 clk_prepare_enable(pdata->clk); 583 597 clk_disable_unprepare(pdata->clk); ··· 604 590 val |= SCAN_AUTO_INCR; 605 591 MGMT_CLOCK_SEL_SET(&val, 1); 606 592 xgene_enet_wr_mcx_mac(pdata, MII_MGMT_CONFIG_ADDR, val); 593 + 594 + return 0; 607 595 } 608 596 609 597 static void xgene_gport_shutdown(struct xgene_enet_pdata *pdata)
+4
drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
··· 104 104 #define BLOCK_ETH_MAC_OFFSET 0x0000 105 105 #define BLOCK_ETH_MAC_CSR_OFFSET 0x2800 106 106 107 + #define CLKEN_ADDR 0xc208 108 + #define SRST_ADDR 0xc200 109 + 107 110 #define MAC_ADDR_REG_OFFSET 0x00 108 111 #define MAC_COMMAND_REG_OFFSET 0x04 109 112 #define MAC_WRITE_REG_OFFSET 0x08 ··· 321 318 322 319 int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata); 323 320 void xgene_enet_mdio_remove(struct xgene_enet_pdata *pdata); 321 + bool xgene_ring_mgr_init(struct xgene_enet_pdata *p); 324 322 325 323 extern struct xgene_mac_ops xgene_gmac_ops; 326 324 extern struct xgene_port_ops xgene_gport_ops;
+7 -4
drivers/net/ethernet/apm/xgene/xgene_enet_main.c
··· 639 639 struct device *dev = ndev_to_dev(ndev); 640 640 struct xgene_enet_desc_ring *rx_ring, *tx_ring, *cp_ring; 641 641 struct xgene_enet_desc_ring *buf_pool = NULL; 642 - u8 cpu_bufnum = 0, eth_bufnum = 0; 643 - u8 bp_bufnum = 0x20; 644 - u16 ring_id, ring_num = 0; 642 + u8 cpu_bufnum = 0, eth_bufnum = START_ETH_BUFNUM; 643 + u8 bp_bufnum = START_BP_BUFNUM; 644 + u16 ring_id, ring_num = START_RING_NUM; 645 645 int ret; 646 646 647 647 /* allocate rx descriptor ring */ ··· 840 840 u16 dst_ring_num; 841 841 int ret; 842 842 843 - pdata->port_ops->reset(pdata); 843 + ret = pdata->port_ops->reset(pdata); 844 + if (ret) 845 + return ret; 844 846 845 847 ret = xgene_enet_create_desc_rings(ndev); 846 848 if (ret) { ··· 944 942 945 943 return ret; 946 944 err: 945 + unregister_netdev(ndev); 947 946 free_netdev(ndev); 948 947 return ret; 949 948 }
+4 -1
drivers/net/ethernet/apm/xgene/xgene_enet_main.h
··· 38 38 #define SKB_BUFFER_SIZE (XGENE_ENET_MAX_MTU - NET_IP_ALIGN) 39 39 #define NUM_PKT_BUF 64 40 40 #define NUM_BUFPOOL 32 41 + #define START_ETH_BUFNUM 2 42 + #define START_BP_BUFNUM 0x22 43 + #define START_RING_NUM 8 41 44 42 45 #define PHY_POLL_LINK_ON (10 * HZ) 43 46 #define PHY_POLL_LINK_OFF (PHY_POLL_LINK_ON / 5) ··· 86 83 }; 87 84 88 85 struct xgene_port_ops { 89 - void (*reset)(struct xgene_enet_pdata *pdata); 86 + int (*reset)(struct xgene_enet_pdata *pdata); 90 87 void (*cle_bypass)(struct xgene_enet_pdata *pdata, 91 88 u32 dst_ring_num, u16 bufpool_id); 92 89 void (*shutdown)(struct xgene_enet_pdata *pdata);
+6 -1
drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
··· 311 311 xgene_sgmac_rxtx(p, TX_EN, false); 312 312 } 313 313 314 - static void xgene_enet_reset(struct xgene_enet_pdata *p) 314 + static int xgene_enet_reset(struct xgene_enet_pdata *p) 315 315 { 316 + if (!xgene_ring_mgr_init(p)) 317 + return -ENODEV; 318 + 316 319 clk_prepare_enable(p->clk); 317 320 clk_disable_unprepare(p->clk); 318 321 clk_prepare_enable(p->clk); 319 322 320 323 xgene_enet_ecc_init(p); 321 324 xgene_enet_config_ring_if_assoc(p); 325 + 326 + return 0; 322 327 } 323 328 324 329 static void xgene_enet_cle_bypass(struct xgene_enet_pdata *p,
+6 -1
drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
··· 252 252 xgene_enet_wr_mac(pdata, AXGMAC_CONFIG_1, data & ~HSTTFEN); 253 253 } 254 254 255 - static void xgene_enet_reset(struct xgene_enet_pdata *pdata) 255 + static int xgene_enet_reset(struct xgene_enet_pdata *pdata) 256 256 { 257 + if (!xgene_ring_mgr_init(pdata)) 258 + return -ENODEV; 259 + 257 260 clk_prepare_enable(pdata->clk); 258 261 clk_disable_unprepare(pdata->clk); 259 262 clk_prepare_enable(pdata->clk); 260 263 261 264 xgene_enet_ecc_init(pdata); 262 265 xgene_enet_config_ring_if_assoc(pdata); 266 + 267 + return 0; 263 268 } 264 269 265 270 static void xgene_enet_xgcle_bypass(struct xgene_enet_pdata *pdata,
+11 -2
drivers/net/ethernet/broadcom/bcmsysport.c
··· 1110 1110 /* We just need one DMA descriptor which is DMA-able, since writing to 1111 1111 * the port will allocate a new descriptor in its internal linked-list 1112 1112 */ 1113 - p = dma_zalloc_coherent(kdev, 1, &ring->desc_dma, GFP_KERNEL); 1113 + p = dma_zalloc_coherent(kdev, sizeof(struct dma_desc), &ring->desc_dma, 1114 + GFP_KERNEL); 1114 1115 if (!p) { 1115 1116 netif_err(priv, hw, priv->netdev, "DMA alloc failed\n"); 1116 1117 return -ENOMEM; ··· 1175 1174 if (!(reg & TDMA_DISABLED)) 1176 1175 netdev_warn(priv->netdev, "TDMA not stopped!\n"); 1177 1176 1177 + /* ring->cbs is the last part in bcm_sysport_init_tx_ring which could 1178 + * fail, so by checking this pointer we know whether the TX ring was 1179 + * fully initialized or not. 1180 + */ 1181 + if (!ring->cbs) 1182 + return; 1183 + 1178 1184 napi_disable(&ring->napi); 1179 1185 netif_napi_del(&ring->napi); 1180 1186 ··· 1191 1183 ring->cbs = NULL; 1192 1184 1193 1185 if (ring->desc_dma) { 1194 - dma_free_coherent(kdev, 1, ring->desc_cpu, ring->desc_dma); 1186 + dma_free_coherent(kdev, sizeof(struct dma_desc), 1187 + ring->desc_cpu, ring->desc_dma); 1195 1188 ring->desc_dma = 0; 1196 1189 } 1197 1190 ring->size = 0;
+8 -12
drivers/net/ethernet/cisco/enic/enic_main.c
··· 940 940 struct vnic_rq_buf *buf = rq->to_use; 941 941 942 942 if (buf->os_buf) { 943 - buf = buf->next; 944 - rq->to_use = buf; 945 - rq->ring.desc_avail--; 946 - if ((buf->index & VNIC_RQ_RETURN_RATE) == 0) { 947 - /* Adding write memory barrier prevents compiler and/or 948 - * CPU reordering, thus avoiding descriptor posting 949 - * before descriptor is initialized. Otherwise, hardware 950 - * can read stale descriptor fields. 951 - */ 952 - wmb(); 953 - iowrite32(buf->index, &rq->ctrl->posted_index); 954 - } 943 + enic_queue_rq_desc(rq, buf->os_buf, os_buf_index, buf->dma_addr, 944 + buf->len); 955 945 956 946 return 0; 957 947 } ··· 1027 1037 enic->rq_truncated_pkts++; 1028 1038 } 1029 1039 1040 + pci_unmap_single(enic->pdev, buf->dma_addr, buf->len, 1041 + PCI_DMA_FROMDEVICE); 1030 1042 dev_kfree_skb_any(skb); 1043 + buf->os_buf = NULL; 1031 1044 1032 1045 return; 1033 1046 } ··· 1081 1088 /* Buffer overflow 1082 1089 */ 1083 1090 1091 + pci_unmap_single(enic->pdev, buf->dma_addr, buf->len, 1092 + PCI_DMA_FROMDEVICE); 1084 1093 dev_kfree_skb_any(skb); 1094 + buf->os_buf = NULL; 1085 1095 } 1086 1096 } 1087 1097
+8 -8
drivers/net/ethernet/freescale/fec_main.c
··· 3343 3343 netif_device_detach(ndev); 3344 3344 netif_tx_unlock_bh(ndev); 3345 3345 fec_stop(ndev); 3346 + fec_enet_clk_enable(ndev, false); 3347 + pinctrl_pm_select_sleep_state(&fep->pdev->dev); 3346 3348 } 3347 3349 rtnl_unlock(); 3348 - 3349 - fec_enet_clk_enable(ndev, false); 3350 - pinctrl_pm_select_sleep_state(&fep->pdev->dev); 3351 3350 3352 3351 if (fep->reg_phy) 3353 3352 regulator_disable(fep->reg_phy); ··· 3366 3367 return ret; 3367 3368 } 3368 3369 3369 - pinctrl_pm_select_default_state(&fep->pdev->dev); 3370 - ret = fec_enet_clk_enable(ndev, true); 3371 - if (ret) 3372 - goto failed_clk; 3373 - 3374 3370 rtnl_lock(); 3375 3371 if (netif_running(ndev)) { 3372 + pinctrl_pm_select_default_state(&fep->pdev->dev); 3373 + ret = fec_enet_clk_enable(ndev, true); 3374 + if (ret) { 3375 + rtnl_unlock(); 3376 + goto failed_clk; 3377 + } 3376 3378 fec_restart(ndev); 3377 3379 netif_tx_lock_bh(ndev); 3378 3380 netif_device_attach(ndev);
+10 -8
drivers/net/ethernet/marvell/mv643xx_eth.c
··· 1047 1047 int tx_index; 1048 1048 struct tx_desc *desc; 1049 1049 u32 cmd_sts; 1050 - struct sk_buff *skb; 1051 1050 1052 1051 tx_index = txq->tx_used_desc; 1053 1052 desc = &txq->tx_desc_area[tx_index]; ··· 1065 1066 reclaimed++; 1066 1067 txq->tx_desc_count--; 1067 1068 1068 - skb = NULL; 1069 - if (cmd_sts & TX_LAST_DESC) 1070 - skb = __skb_dequeue(&txq->tx_skb); 1069 + if (!IS_TSO_HEADER(txq, desc->buf_ptr)) 1070 + dma_unmap_single(mp->dev->dev.parent, desc->buf_ptr, 1071 + desc->byte_cnt, DMA_TO_DEVICE); 1072 + 1073 + if (cmd_sts & TX_ENABLE_INTERRUPT) { 1074 + struct sk_buff *skb = __skb_dequeue(&txq->tx_skb); 1075 + 1076 + if (!WARN_ON(!skb)) 1077 + dev_kfree_skb(skb); 1078 + } 1071 1079 1072 1080 if (cmd_sts & ERROR_SUMMARY) { 1073 1081 netdev_info(mp->dev, "tx error\n"); 1074 1082 mp->dev->stats.tx_errors++; 1075 1083 } 1076 1084 1077 - if (!IS_TSO_HEADER(txq, desc->buf_ptr)) 1078 - dma_unmap_single(mp->dev->dev.parent, desc->buf_ptr, 1079 - desc->byte_cnt, DMA_TO_DEVICE); 1080 - dev_kfree_skb(skb); 1081 1085 } 1082 1086 1083 1087 __netif_tx_unlock_bh(nq);
+18 -9
drivers/net/ethernet/marvell/mvpp2.c
··· 1692 1692 { 1693 1693 struct mvpp2_prs_entry *pe; 1694 1694 int tid_aux, tid; 1695 + int ret = 0; 1695 1696 1696 1697 pe = mvpp2_prs_vlan_find(priv, tpid, ai); 1697 1698 ··· 1724 1723 break; 1725 1724 } 1726 1725 1727 - if (tid <= tid_aux) 1728 - return -EINVAL; 1726 + if (tid <= tid_aux) { 1727 + ret = -EINVAL; 1728 + goto error; 1729 + } 1729 1730 1730 1731 memset(pe, 0 , sizeof(struct mvpp2_prs_entry)); 1731 1732 mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_VLAN); ··· 1759 1756 1760 1757 mvpp2_prs_hw_write(priv, pe); 1761 1758 1759 + error: 1762 1760 kfree(pe); 1763 1761 1764 - return 0; 1762 + return ret; 1765 1763 } 1766 1764 1767 1765 /* Get first free double vlan ai number */ ··· 1825 1821 unsigned int port_map) 1826 1822 { 1827 1823 struct mvpp2_prs_entry *pe; 1828 - int tid_aux, tid, ai; 1824 + int tid_aux, tid, ai, ret = 0; 1829 1825 1830 1826 pe = mvpp2_prs_double_vlan_find(priv, tpid1, tpid2); 1831 1827 ··· 1842 1838 1843 1839 /* Set ai value for new double vlan entry */ 1844 1840 ai = mvpp2_prs_double_vlan_ai_free_get(priv); 1845 - if (ai < 0) 1846 - return ai; 1841 + if (ai < 0) { 1842 + ret = ai; 1843 + goto error; 1844 + } 1847 1845 1848 1846 /* Get first single/triple vlan tid */ 1849 1847 for (tid_aux = MVPP2_PE_FIRST_FREE_TID; ··· 1865 1859 break; 1866 1860 } 1867 1861 1868 - if (tid >= tid_aux) 1869 - return -ERANGE; 1862 + if (tid >= tid_aux) { 1863 + ret = -ERANGE; 1864 + goto error; 1865 + } 1870 1866 1871 1867 memset(pe, 0, sizeof(struct mvpp2_prs_entry)); 1872 1868 mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_VLAN); ··· 1895 1887 mvpp2_prs_tcam_port_map_set(pe, port_map); 1896 1888 mvpp2_prs_hw_write(priv, pe); 1897 1889 1890 + error: 1898 1891 kfree(pe); 1899 - return 0; 1892 + return ret; 1900 1893 } 1901 1894 1902 1895 /* IPv4 header parsing for fragmentation and L4 offset */
+3 -4
drivers/net/ethernet/mellanox/mlx5/core/eq.c
··· 374 374 snprintf(eq->name, MLX5_MAX_EQ_NAME, "%s@pci:%s", 375 375 name, pci_name(dev->pdev)); 376 376 eq->eqn = out.eq_number; 377 + eq->irqn = vecidx; 378 + eq->dev = dev; 379 + eq->doorbell = uar->map + MLX5_EQ_DOORBEL_OFFSET; 377 380 err = request_irq(table->msix_arr[vecidx].vector, mlx5_msix_handler, 0, 378 381 eq->name, eq); 379 382 if (err) 380 383 goto err_eq; 381 - 382 - eq->irqn = vecidx; 383 - eq->dev = dev; 384 - eq->doorbell = uar->map + MLX5_EQ_DOORBEL_OFFSET; 385 384 386 385 err = mlx5_debug_eq_add(dev, eq); 387 386 if (err)
+2 -2
drivers/net/ethernet/mellanox/mlx5/core/main.c
··· 864 864 dev->profile = &profile[prof_sel]; 865 865 dev->event = mlx5_core_event; 866 866 867 + INIT_LIST_HEAD(&priv->ctx_list); 868 + spin_lock_init(&priv->ctx_lock); 867 869 err = mlx5_dev_init(dev, pdev); 868 870 if (err) { 869 871 dev_err(&pdev->dev, "mlx5_dev_init failed %d\n", err); 870 872 goto out; 871 873 } 872 874 873 - INIT_LIST_HEAD(&priv->ctx_list); 874 - spin_lock_init(&priv->ctx_lock); 875 875 err = mlx5_register_device(dev); 876 876 if (err) { 877 877 dev_err(&pdev->dev, "mlx5_register_device failed %d\n", err);
+2 -1
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
··· 2762 2762 if (test_bit(__NX_RESETTING, &adapter->state)) 2763 2763 goto reschedule; 2764 2764 2765 - if (test_bit(__NX_DEV_UP, &adapter->state)) { 2765 + if (test_bit(__NX_DEV_UP, &adapter->state) && 2766 + !(adapter->capabilities & NX_FW_CAPABILITY_LINK_NOTIFICATION)) { 2766 2767 if (!adapter->has_link_events) { 2767 2768 2768 2769 netxen_nic_handle_phy_intr(adapter);
+2 -1
drivers/net/ethernet/sfc/ef10.c
··· 180 180 EFX_MAX_CHANNELS, 181 181 resource_size(&efx->pci_dev->resource[EFX_MEM_BAR]) / 182 182 (EFX_VI_PAGE_SIZE * EFX_TXQ_TYPES)); 183 - BUG_ON(efx->max_channels == 0); 183 + if (WARN_ON(efx->max_channels == 0)) 184 + return -EIO; 184 185 185 186 nic_data = kzalloc(sizeof(*nic_data), GFP_KERNEL); 186 187 if (!nic_data)
+12 -8
drivers/net/ethernet/smsc/smc91x.c
··· 2243 2243 const struct of_device_id *match = NULL; 2244 2244 struct smc_local *lp; 2245 2245 struct net_device *ndev; 2246 - struct resource *res, *ires; 2246 + struct resource *res; 2247 2247 unsigned int __iomem *addr; 2248 2248 unsigned long irq_flags = SMC_IRQ_FLAGS; 2249 + unsigned long irq_resflags; 2249 2250 int ret; 2250 2251 2251 2252 ndev = alloc_etherdev(sizeof(struct smc_local)); ··· 2338 2337 goto out_free_netdev; 2339 2338 } 2340 2339 2341 - ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 2342 - if (!ires) { 2340 + ndev->irq = platform_get_irq(pdev, 0); 2341 + if (ndev->irq <= 0) { 2343 2342 ret = -ENODEV; 2344 2343 goto out_release_io; 2345 2344 } 2346 - 2347 - ndev->irq = ires->start; 2348 - 2349 - if (irq_flags == -1 || ires->flags & IRQF_TRIGGER_MASK) 2350 - irq_flags = ires->flags & IRQF_TRIGGER_MASK; 2345 + /* 2346 + * If this platform does not specify any special irqflags, or if 2347 + * the resource supplies a trigger, override the irqflags with 2348 + * the trigger flags from the resource. 2349 + */ 2350 + irq_resflags = irqd_get_trigger_type(irq_get_irq_data(ndev->irq)); 2351 + if (irq_flags == -1 || irq_resflags & IRQF_TRIGGER_MASK) 2352 + irq_flags = irq_resflags & IRQF_TRIGGER_MASK; 2351 2353 2352 2354 ret = smc_request_attrib(pdev, ndev); 2353 2355 if (ret)
+29 -23
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 276 276 bool stmmac_eee_init(struct stmmac_priv *priv) 277 277 { 278 278 char *phy_bus_name = priv->plat->phy_bus_name; 279 + unsigned long flags; 279 280 bool ret = false; 280 281 281 282 /* Using PCS we cannot dial with the phy registers at this stage ··· 301 300 * changed). 302 301 * In that case the driver disable own timers. 303 302 */ 303 + spin_lock_irqsave(&priv->lock, flags); 304 304 if (priv->eee_active) { 305 305 pr_debug("stmmac: disable EEE\n"); 306 306 del_timer_sync(&priv->eee_ctrl_timer); ··· 309 307 tx_lpi_timer); 310 308 } 311 309 priv->eee_active = 0; 310 + spin_unlock_irqrestore(&priv->lock, flags); 312 311 goto out; 313 312 } 314 313 /* Activate the EEE and start timers */ 314 + spin_lock_irqsave(&priv->lock, flags); 315 315 if (!priv->eee_active) { 316 316 priv->eee_active = 1; 317 317 init_timer(&priv->eee_ctrl_timer); ··· 329 325 /* Set HW EEE according to the speed */ 330 326 priv->hw->mac->set_eee_pls(priv->hw, priv->phydev->link); 331 327 332 - pr_debug("stmmac: Energy-Efficient Ethernet initialized\n"); 333 - 334 328 ret = true; 329 + spin_unlock_irqrestore(&priv->lock, flags); 330 + 331 + pr_debug("stmmac: Energy-Efficient Ethernet initialized\n"); 335 332 } 336 333 out: 337 334 return ret; ··· 765 760 if (new_state && netif_msg_link(priv)) 766 761 phy_print_status(phydev); 767 762 763 + spin_unlock_irqrestore(&priv->lock, flags); 764 + 768 765 /* At this stage, it could be needed to setup the EEE or adjust some 769 766 * MAC related HW registers. 770 767 */ 771 768 priv->eee_enabled = stmmac_eee_init(priv); 772 - 773 - spin_unlock_irqrestore(&priv->lock, flags); 774 769 } 775 770 776 771 /** ··· 964 959 } 965 960 966 961 static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, 967 - int i) 962 + int i, gfp_t flags) 968 963 { 969 964 struct sk_buff *skb; 970 965 971 966 skb = __netdev_alloc_skb(priv->dev, priv->dma_buf_sz + NET_IP_ALIGN, 972 - GFP_KERNEL); 967 + flags); 973 968 if (!skb) { 974 969 pr_err("%s: Rx init fails; skb is NULL\n", __func__); 975 970 return -ENOMEM; ··· 1011 1006 * and allocates the socket buffers. It suppors the chained and ring 1012 1007 * modes. 1013 1008 */ 1014 - static int init_dma_desc_rings(struct net_device *dev) 1009 + static int init_dma_desc_rings(struct net_device *dev, gfp_t flags) 1015 1010 { 1016 1011 int i; 1017 1012 struct stmmac_priv *priv = netdev_priv(dev); ··· 1046 1041 else 1047 1042 p = priv->dma_rx + i; 1048 1043 1049 - ret = stmmac_init_rx_buffers(priv, p, i); 1044 + ret = stmmac_init_rx_buffers(priv, p, i, flags); 1050 1045 if (ret) 1051 1046 goto err_init_rx_buffers; 1052 1047 ··· 1652 1647 struct stmmac_priv *priv = netdev_priv(dev); 1653 1648 int ret; 1654 1649 1655 - ret = init_dma_desc_rings(dev); 1656 - if (ret < 0) { 1657 - pr_err("%s: DMA descriptors initialization failed\n", __func__); 1658 - return ret; 1659 - } 1660 1650 /* DMA initialization and SW reset */ 1661 1651 ret = stmmac_init_dma_engine(priv); 1662 1652 if (ret < 0) { ··· 1705 1705 } 1706 1706 priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS; 1707 1707 1708 - priv->eee_enabled = stmmac_eee_init(priv); 1709 - 1710 - stmmac_init_tx_coalesce(priv); 1711 - 1712 1708 if ((priv->use_riwt) && (priv->hw->dma->rx_watchdog)) { 1713 1709 priv->rx_riwt = MAX_DMA_RIWT; 1714 1710 priv->hw->dma->rx_watchdog(priv->ioaddr, MAX_DMA_RIWT); ··· 1757 1761 goto dma_desc_error; 1758 1762 } 1759 1763 1764 + ret = init_dma_desc_rings(dev, GFP_KERNEL); 1765 + if (ret < 0) { 1766 + pr_err("%s: DMA descriptors initialization failed\n", __func__); 1767 + goto init_error; 1768 + } 1769 + 1760 1770 ret = stmmac_hw_setup(dev); 1761 1771 if (ret < 0) { 1762 1772 pr_err("%s: Hw setup failed\n", __func__); 1763 1773 goto init_error; 1764 1774 } 1775 + 1776 + stmmac_init_tx_coalesce(priv); 1765 1777 1766 1778 if (priv->phydev) 1767 1779 phy_start(priv->phydev); ··· 1898 1894 unsigned int nopaged_len = skb_headlen(skb); 1899 1895 unsigned int enh_desc = priv->plat->enh_desc; 1900 1896 1897 + spin_lock(&priv->tx_lock); 1898 + 1901 1899 if (unlikely(stmmac_tx_avail(priv) < nfrags + 1)) { 1900 + spin_unlock(&priv->tx_lock); 1902 1901 if (!netif_queue_stopped(dev)) { 1903 1902 netif_stop_queue(dev); 1904 1903 /* This is a hard error, log it. */ ··· 1909 1902 } 1910 1903 return NETDEV_TX_BUSY; 1911 1904 } 1912 - 1913 - spin_lock(&priv->tx_lock); 1914 1905 1915 1906 if (priv->tx_path_in_lpi_mode) 1916 1907 stmmac_disable_eee_mode(priv); ··· 2030 2025 return NETDEV_TX_OK; 2031 2026 2032 2027 dma_map_err: 2028 + spin_unlock(&priv->tx_lock); 2033 2029 dev_err(priv->device, "Tx dma map failed\n"); 2034 2030 dev_kfree_skb(skb); 2035 2031 priv->dev->stats.tx_dropped++; ··· 2287 2281 { 2288 2282 struct stmmac_priv *priv = netdev_priv(dev); 2289 2283 2290 - spin_lock(&priv->lock); 2291 2284 priv->hw->mac->set_filter(priv->hw, dev); 2292 - spin_unlock(&priv->lock); 2293 2285 } 2294 2286 2295 2287 /** ··· 2954 2950 stmmac_set_mac(priv->ioaddr, false); 2955 2951 pinctrl_pm_select_sleep_state(priv->device); 2956 2952 /* Disable clock in case of PWM is off */ 2957 - clk_disable_unprepare(priv->stmmac_clk); 2953 + clk_disable(priv->stmmac_clk); 2958 2954 } 2959 2955 spin_unlock_irqrestore(&priv->lock, flags); 2960 2956 ··· 2986 2982 } else { 2987 2983 pinctrl_pm_select_default_state(priv->device); 2988 2984 /* enable the clk prevously disabled */ 2989 - clk_prepare_enable(priv->stmmac_clk); 2985 + clk_enable(priv->stmmac_clk); 2990 2986 /* reset the phy so that it's ready */ 2991 2987 if (priv->mii) 2992 2988 stmmac_mdio_reset(priv->mii); ··· 2994 2990 2995 2991 netif_device_attach(ndev); 2996 2992 2993 + init_dma_desc_rings(ndev, GFP_ATOMIC); 2997 2994 stmmac_hw_setup(ndev); 2995 + stmmac_init_tx_coalesce(priv); 2998 2996 2999 2997 napi_enable(&priv->napi); 3000 2998
-1
drivers/net/ethernet/ti/cpsw_ale.c
··· 785 785 { 786 786 if (!ale) 787 787 return -EINVAL; 788 - cpsw_ale_stop(ale); 789 788 cpsw_ale_control_set(ale, 0, ALE_ENABLE, 0); 790 789 kfree(ale); 791 790 return 0;
+2
drivers/net/macvtap.c
··· 629 629 if (skb->ip_summed == CHECKSUM_PARTIAL) { 630 630 vnet_hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; 631 631 vnet_hdr->csum_start = skb_checksum_start_offset(skb); 632 + if (vlan_tx_tag_present(skb)) 633 + vnet_hdr->csum_start += VLAN_HLEN; 632 634 vnet_hdr->csum_offset = skb->csum_offset; 633 635 } else if (skb->ip_summed == CHECKSUM_UNNECESSARY) { 634 636 vnet_hdr->flags = VIRTIO_NET_HDR_F_DATA_VALID;
+17 -11
drivers/net/tun.c
··· 1235 1235 struct tun_pi pi = { 0, skb->protocol }; 1236 1236 ssize_t total = 0; 1237 1237 int vlan_offset = 0, copied; 1238 + int vlan_hlen = 0; 1239 + int vnet_hdr_sz = 0; 1240 + 1241 + if (vlan_tx_tag_present(skb)) 1242 + vlan_hlen = VLAN_HLEN; 1243 + 1244 + if (tun->flags & TUN_VNET_HDR) 1245 + vnet_hdr_sz = tun->vnet_hdr_sz; 1238 1246 1239 1247 if (!(tun->flags & TUN_NO_PI)) { 1240 1248 if ((len -= sizeof(pi)) < 0) 1241 1249 return -EINVAL; 1242 1250 1243 - if (len < skb->len) { 1251 + if (len < skb->len + vlan_hlen + vnet_hdr_sz) { 1244 1252 /* Packet will be striped */ 1245 1253 pi.flags |= TUN_PKT_STRIP; 1246 1254 } ··· 1258 1250 total += sizeof(pi); 1259 1251 } 1260 1252 1261 - if (tun->flags & TUN_VNET_HDR) { 1253 + if (vnet_hdr_sz) { 1262 1254 struct virtio_net_hdr gso = { 0 }; /* no info leak */ 1263 - if ((len -= tun->vnet_hdr_sz) < 0) 1255 + if ((len -= vnet_hdr_sz) < 0) 1264 1256 return -EINVAL; 1265 1257 1266 1258 if (skb_is_gso(skb)) { ··· 1292 1284 1293 1285 if (skb->ip_summed == CHECKSUM_PARTIAL) { 1294 1286 gso.flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; 1295 - gso.csum_start = skb_checksum_start_offset(skb); 1287 + gso.csum_start = skb_checksum_start_offset(skb) + 1288 + vlan_hlen; 1296 1289 gso.csum_offset = skb->csum_offset; 1297 1290 } else if (skb->ip_summed == CHECKSUM_UNNECESSARY) { 1298 1291 gso.flags = VIRTIO_NET_HDR_F_DATA_VALID; ··· 1302 1293 if (unlikely(memcpy_toiovecend(iv, (void *)&gso, total, 1303 1294 sizeof(gso)))) 1304 1295 return -EFAULT; 1305 - total += tun->vnet_hdr_sz; 1296 + total += vnet_hdr_sz; 1306 1297 } 1307 1298 1308 1299 copied = total; 1309 - total += skb->len; 1310 - if (!vlan_tx_tag_present(skb)) { 1311 - len = min_t(int, skb->len, len); 1312 - } else { 1300 + len = min_t(int, skb->len + vlan_hlen, len); 1301 + total += skb->len + vlan_hlen; 1302 + if (vlan_hlen) { 1313 1303 int copy, ret; 1314 1304 struct { 1315 1305 __be16 h_vlan_proto; ··· 1319 1311 veth.h_vlan_TCI = htons(vlan_tx_tag_get(skb)); 1320 1312 1321 1313 vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto); 1322 - len = min_t(int, skb->len + VLAN_HLEN, len); 1323 - total += VLAN_HLEN; 1324 1314 1325 1315 copy = min_t(int, vlan_offset, len); 1326 1316 ret = skb_copy_datagram_const_iovec(skb, 0, iv, copied, copy);
+1 -1
include/linux/socket.h
··· 256 256 #define MSG_EOF MSG_FIN 257 257 258 258 #define MSG_FASTOPEN 0x20000000 /* Send data in TCP SYN */ 259 - #define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exit for file 259 + #define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exec for file 260 260 descriptor received through 261 261 SCM_RIGHTS */ 262 262 #if defined(CONFIG_COMPAT)
-1
include/net/9p/transport.h
··· 34 34 * @list: used to maintain a list of currently available transports 35 35 * @name: the human-readable name of the transport 36 36 * @maxsize: transport provided maximum packet size 37 - * @pref: Preferences of this transport 38 37 * @def: set if this transport should be considered the default 39 38 * @create: member function to create a new connection on this transport 40 39 * @close: member function to discard a connection on this transport
+4
include/uapi/linux/Kbuild
··· 125 125 header-y += firewire-cdev.h 126 126 header-y += firewire-constants.h 127 127 header-y += flat.h 128 + header-y += fou.h 128 129 header-y += fs.h 129 130 header-y += fsl_hypervisor.h 130 131 header-y += fuse.h ··· 142 141 header-y += hiddev.h 143 142 header-y += hidraw.h 144 143 header-y += hpet.h 144 + header-y += hsr_netlink.h 145 145 header-y += hyperv.h 146 146 header-y += hysdn_if.h 147 147 header-y += i2c-dev.h ··· 253 251 header-y += minix_fs.h 254 252 header-y += mman.h 255 253 header-y += mmtimer.h 254 + header-y += mpls.h 256 255 header-y += mqueue.h 257 256 header-y += mroute.h 258 257 header-y += mroute6.h ··· 427 424 header-y += virtio_pci.h 428 425 header-y += virtio_ring.h 429 426 header-y += virtio_rng.h 427 + header=y += vm_sockets.h 430 428 header-y += vt.h 431 429 header-y += wait.h 432 430 header-y += wanrouter.h
+1
include/uapi/linux/if_bridge.h
··· 15 15 16 16 #include <linux/types.h> 17 17 #include <linux/if_ether.h> 18 + #include <linux/in6.h> 18 19 19 20 #define SYSFS_BRIDGE_ATTR "bridge" 20 21 #define SYSFS_BRIDGE_FDB "brforward"
+1
net/bridge/netfilter/nft_reject_bridge.c
··· 18 18 #include <net/netfilter/ipv6/nf_reject.h> 19 19 #include <linux/ip.h> 20 20 #include <net/ip.h> 21 + #include <net/ip6_checksum.h> 21 22 #include <linux/netfilter_bridge.h> 22 23 #include "../br_private.h" 23 24
+5 -2
net/dsa/slave.c
··· 553 553 /* We could not connect to a designated PHY, so use the switch internal 554 554 * MDIO bus instead 555 555 */ 556 - if (!p->phy) 556 + if (!p->phy) { 557 557 p->phy = ds->slave_mii_bus->phy_map[p->port]; 558 - else 558 + phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link, 559 + p->phy_interface); 560 + } else { 559 561 pr_info("attached PHY at address %d [%s]\n", 560 562 p->phy->addr, p->phy->drv->name); 563 + } 561 564 } 562 565 563 566 int dsa_slave_suspend(struct net_device *slave_dev)
+3
net/ipv4/geneve.c
··· 144 144 gnvh = (struct genevehdr *)__skb_push(skb, sizeof(*gnvh) + opt_len); 145 145 geneve_build_header(gnvh, tun_flags, vni, opt_len, opt); 146 146 147 + skb_set_inner_protocol(skb, htons(ETH_P_TEB)); 148 + 147 149 return udp_tunnel_xmit_skb(gs->sock, rt, skb, src, dst, 148 150 tos, ttl, df, src_port, dst_port, xnet); 149 151 } ··· 366 364 static void __exit geneve_cleanup_module(void) 367 365 { 368 366 destroy_workqueue(geneve_wq); 367 + unregister_pernet_subsys(&geneve_net_ops); 369 368 } 370 369 module_exit(geneve_cleanup_module); 371 370
+31 -29
net/ipv4/tcp_input.c
··· 2316 2316 2317 2317 /* Undo procedures. */ 2318 2318 2319 + /* We can clear retrans_stamp when there are no retransmissions in the 2320 + * window. It would seem that it is trivially available for us in 2321 + * tp->retrans_out, however, that kind of assumptions doesn't consider 2322 + * what will happen if errors occur when sending retransmission for the 2323 + * second time. ...It could the that such segment has only 2324 + * TCPCB_EVER_RETRANS set at the present time. It seems that checking 2325 + * the head skb is enough except for some reneging corner cases that 2326 + * are not worth the effort. 2327 + * 2328 + * Main reason for all this complexity is the fact that connection dying 2329 + * time now depends on the validity of the retrans_stamp, in particular, 2330 + * that successive retransmissions of a segment must not advance 2331 + * retrans_stamp under any conditions. 2332 + */ 2333 + static bool tcp_any_retrans_done(const struct sock *sk) 2334 + { 2335 + const struct tcp_sock *tp = tcp_sk(sk); 2336 + struct sk_buff *skb; 2337 + 2338 + if (tp->retrans_out) 2339 + return true; 2340 + 2341 + skb = tcp_write_queue_head(sk); 2342 + if (unlikely(skb && TCP_SKB_CB(skb)->sacked & TCPCB_EVER_RETRANS)) 2343 + return true; 2344 + 2345 + return false; 2346 + } 2347 + 2319 2348 #if FASTRETRANS_DEBUG > 1 2320 2349 static void DBGUNDO(struct sock *sk, const char *msg) 2321 2350 { ··· 2440 2411 * is ACKed. For Reno it is MUST to prevent false 2441 2412 * fast retransmits (RFC2582). SACK TCP is safe. */ 2442 2413 tcp_moderate_cwnd(tp); 2414 + if (!tcp_any_retrans_done(sk)) 2415 + tp->retrans_stamp = 0; 2443 2416 return true; 2444 2417 } 2445 2418 tcp_set_ca_state(sk, TCP_CA_Open); ··· 2459 2428 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPDSACKUNDO); 2460 2429 return true; 2461 2430 } 2462 - return false; 2463 - } 2464 - 2465 - /* We can clear retrans_stamp when there are no retransmissions in the 2466 - * window. It would seem that it is trivially available for us in 2467 - * tp->retrans_out, however, that kind of assumptions doesn't consider 2468 - * what will happen if errors occur when sending retransmission for the 2469 - * second time. ...It could the that such segment has only 2470 - * TCPCB_EVER_RETRANS set at the present time. It seems that checking 2471 - * the head skb is enough except for some reneging corner cases that 2472 - * are not worth the effort. 2473 - * 2474 - * Main reason for all this complexity is the fact that connection dying 2475 - * time now depends on the validity of the retrans_stamp, in particular, 2476 - * that successive retransmissions of a segment must not advance 2477 - * retrans_stamp under any conditions. 2478 - */ 2479 - static bool tcp_any_retrans_done(const struct sock *sk) 2480 - { 2481 - const struct tcp_sock *tp = tcp_sk(sk); 2482 - struct sk_buff *skb; 2483 - 2484 - if (tp->retrans_out) 2485 - return true; 2486 - 2487 - skb = tcp_write_queue_head(sk); 2488 - if (unlikely(skb && TCP_SKB_CB(skb)->sacked & TCPCB_EVER_RETRANS)) 2489 - return true; 2490 - 2491 2431 return false; 2492 2432 } 2493 2433
+3 -2
net/ipv6/ip6_gre.c
··· 961 961 else 962 962 dev->flags &= ~IFF_POINTOPOINT; 963 963 964 - dev->iflink = p->link; 965 - 966 964 /* Precalculate GRE options length */ 967 965 if (t->parms.o_flags&(GRE_CSUM|GRE_KEY|GRE_SEQ)) { 968 966 if (t->parms.o_flags&GRE_CSUM) ··· 1270 1272 u64_stats_init(&ip6gre_tunnel_stats->syncp); 1271 1273 } 1272 1274 1275 + dev->iflink = tunnel->parms.link; 1273 1276 1274 1277 return 0; 1275 1278 } ··· 1479 1480 dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); 1480 1481 if (!dev->tstats) 1481 1482 return -ENOMEM; 1483 + 1484 + dev->iflink = tunnel->parms.link; 1482 1485 1483 1486 return 0; 1484 1487 }
+1 -9
net/ipv6/ip6_tunnel.c
··· 289 289 int err; 290 290 291 291 t = netdev_priv(dev); 292 - err = ip6_tnl_dev_init(dev); 293 - if (err < 0) 294 - goto out; 295 292 296 293 err = register_netdevice(dev); 297 294 if (err < 0) ··· 1523 1526 1524 1527 1525 1528 static const struct net_device_ops ip6_tnl_netdev_ops = { 1529 + .ndo_init = ip6_tnl_dev_init, 1526 1530 .ndo_uninit = ip6_tnl_dev_uninit, 1527 1531 .ndo_start_xmit = ip6_tnl_xmit, 1528 1532 .ndo_do_ioctl = ip6_tnl_ioctl, ··· 1608 1610 struct ip6_tnl *t = netdev_priv(dev); 1609 1611 struct net *net = dev_net(dev); 1610 1612 struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); 1611 - int err = ip6_tnl_dev_init_gen(dev); 1612 - 1613 - if (err) 1614 - return err; 1615 1613 1616 1614 t->parms.proto = IPPROTO_IPV6; 1617 1615 dev_hold(dev); 1618 - 1619 - ip6_tnl_link_config(t); 1620 1616 1621 1617 rcu_assign_pointer(ip6n->tnls_wc[0], t); 1622 1618 return 0;
+1 -10
net/ipv6/ip6_vti.c
··· 172 172 struct vti6_net *ip6n = net_generic(net, vti6_net_id); 173 173 int err; 174 174 175 - err = vti6_dev_init(dev); 176 - if (err < 0) 177 - goto out; 178 - 179 175 err = register_netdevice(dev); 180 176 if (err < 0) 181 177 goto out; ··· 785 789 } 786 790 787 791 static const struct net_device_ops vti6_netdev_ops = { 792 + .ndo_init = vti6_dev_init, 788 793 .ndo_uninit = vti6_dev_uninit, 789 794 .ndo_start_xmit = vti6_tnl_xmit, 790 795 .ndo_do_ioctl = vti6_ioctl, ··· 855 858 struct ip6_tnl *t = netdev_priv(dev); 856 859 struct net *net = dev_net(dev); 857 860 struct vti6_net *ip6n = net_generic(net, vti6_net_id); 858 - int err = vti6_dev_init_gen(dev); 859 - 860 - if (err) 861 - return err; 862 861 863 862 t->parms.proto = IPPROTO_IPV6; 864 863 dev_hold(dev); 865 - 866 - vti6_link_config(t); 867 864 868 865 rcu_assign_pointer(ip6n->tnls_wc[0], t); 869 866 return 0;
+6 -9
net/ipv6/sit.c
··· 195 195 struct sit_net *sitn = net_generic(net, sit_net_id); 196 196 int err; 197 197 198 - err = ipip6_tunnel_init(dev); 199 - if (err < 0) 200 - goto out; 201 - ipip6_tunnel_clone_6rd(dev, sitn); 198 + memcpy(dev->dev_addr, &t->parms.iph.saddr, 4); 199 + memcpy(dev->broadcast, &t->parms.iph.daddr, 4); 202 200 203 201 if ((__force u16)t->parms.i_flags & SIT_ISATAP) 204 202 dev->priv_flags |= IFF_ISATAP; ··· 205 207 if (err < 0) 206 208 goto out; 207 209 208 - strcpy(t->parms.name, dev->name); 210 + ipip6_tunnel_clone_6rd(dev, sitn); 211 + 209 212 dev->rtnl_link_ops = &sit_link_ops; 210 213 211 214 dev_hold(dev); ··· 1329 1330 } 1330 1331 1331 1332 static const struct net_device_ops ipip6_netdev_ops = { 1333 + .ndo_init = ipip6_tunnel_init, 1332 1334 .ndo_uninit = ipip6_tunnel_uninit, 1333 1335 .ndo_start_xmit = sit_tunnel_xmit, 1334 1336 .ndo_do_ioctl = ipip6_tunnel_ioctl, ··· 1378 1378 1379 1379 tunnel->dev = dev; 1380 1380 tunnel->net = dev_net(dev); 1381 - 1382 - memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4); 1383 - memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4); 1381 + strcpy(tunnel->parms.name, dev->name); 1384 1382 1385 1383 ipip6_tunnel_bind_dev(dev); 1386 1384 dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); ··· 1403 1405 1404 1406 tunnel->dev = dev; 1405 1407 tunnel->net = dev_net(dev); 1406 - strcpy(tunnel->parms.name, dev->name); 1407 1408 1408 1409 iph->version = 4; 1409 1410 iph->protocol = IPPROTO_IPV6;