diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/isdn/hisax/isdnl2.c | 20 | ||||
-rw-r--r-- | drivers/isdn/mISDN/layer2.c | 54 | ||||
-rw-r--r-- | drivers/net/ethernet/allwinner/sun4i-emac.c | 20 | ||||
-rw-r--r-- | drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bcm63xx_enet.c | 33 | ||||
-rw-r--r-- | drivers/net/ethernet/cavium/Kconfig | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_main.c | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/marvell/mv643xx_eth.c | 48 | ||||
-rw-r--r-- | drivers/net/ethernet/ti/cpsw.c | 15 | ||||
-rw-r--r-- | drivers/net/geneve.c | 40 | ||||
-rw-r--r-- | drivers/net/macvtap.c | 2 | ||||
-rw-r--r-- | drivers/net/phy/Kconfig | 5 | ||||
-rw-r--r-- | drivers/net/phy/Makefile | 1 | ||||
-rw-r--r-- | drivers/net/phy/dp83848.c | 99 | ||||
-rw-r--r-- | drivers/net/phy/micrel.c | 23 | ||||
-rw-r--r-- | drivers/net/phy/smsc.c | 19 | ||||
-rw-r--r-- | drivers/net/ppp/pppoe.c | 2 | ||||
-rw-r--r-- | drivers/net/usb/qmi_wwan.c | 4 | ||||
-rw-r--r-- | drivers/net/vxlan.c | 41 | ||||
-rw-r--r-- | drivers/net/xen-netfront.c | 14 |
22 files changed, 354 insertions, 101 deletions
diff --git a/drivers/isdn/hisax/isdnl2.c b/drivers/isdn/hisax/isdnl2.c index 18accb0a79cc..c53a53f6efb6 100644 --- a/drivers/isdn/hisax/isdnl2.c +++ b/drivers/isdn/hisax/isdnl2.c | |||
@@ -1247,7 +1247,7 @@ static void | |||
1247 | l2_pull_iqueue(struct FsmInst *fi, int event, void *arg) | 1247 | l2_pull_iqueue(struct FsmInst *fi, int event, void *arg) |
1248 | { | 1248 | { |
1249 | struct PStack *st = fi->userdata; | 1249 | struct PStack *st = fi->userdata; |
1250 | struct sk_buff *skb; | 1250 | struct sk_buff *skb, *nskb; |
1251 | struct Layer2 *l2 = &st->l2; | 1251 | struct Layer2 *l2 = &st->l2; |
1252 | u_char header[MAX_HEADER_LEN]; | 1252 | u_char header[MAX_HEADER_LEN]; |
1253 | int i, hdr_space_needed; | 1253 | int i, hdr_space_needed; |
@@ -1262,14 +1262,10 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg) | |||
1262 | return; | 1262 | return; |
1263 | 1263 | ||
1264 | hdr_space_needed = l2headersize(l2, 0); | 1264 | hdr_space_needed = l2headersize(l2, 0); |
1265 | if (hdr_space_needed > skb_headroom(skb)) { | 1265 | nskb = skb_realloc_headroom(skb, hdr_space_needed); |
1266 | struct sk_buff *orig_skb = skb; | 1266 | if (!nskb) { |
1267 | 1267 | skb_queue_head(&l2->i_queue, skb); | |
1268 | skb = skb_realloc_headroom(skb, hdr_space_needed); | 1268 | return; |
1269 | if (!skb) { | ||
1270 | dev_kfree_skb(orig_skb); | ||
1271 | return; | ||
1272 | } | ||
1273 | } | 1269 | } |
1274 | spin_lock_irqsave(&l2->lock, flags); | 1270 | spin_lock_irqsave(&l2->lock, flags); |
1275 | if (test_bit(FLG_MOD128, &l2->flag)) | 1271 | if (test_bit(FLG_MOD128, &l2->flag)) |
@@ -1282,7 +1278,7 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg) | |||
1282 | p1); | 1278 | p1); |
1283 | dev_kfree_skb(l2->windowar[p1]); | 1279 | dev_kfree_skb(l2->windowar[p1]); |
1284 | } | 1280 | } |
1285 | l2->windowar[p1] = skb_clone(skb, GFP_ATOMIC); | 1281 | l2->windowar[p1] = skb; |
1286 | 1282 | ||
1287 | i = sethdraddr(&st->l2, header, CMD); | 1283 | i = sethdraddr(&st->l2, header, CMD); |
1288 | 1284 | ||
@@ -1295,8 +1291,8 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg) | |||
1295 | l2->vs = (l2->vs + 1) % 8; | 1291 | l2->vs = (l2->vs + 1) % 8; |
1296 | } | 1292 | } |
1297 | spin_unlock_irqrestore(&l2->lock, flags); | 1293 | spin_unlock_irqrestore(&l2->lock, flags); |
1298 | memcpy(skb_push(skb, i), header, i); | 1294 | memcpy(skb_push(nskb, i), header, i); |
1299 | st->l2.l2l1(st, PH_PULL | INDICATION, skb); | 1295 | st->l2.l2l1(st, PH_PULL | INDICATION, nskb); |
1300 | test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag); | 1296 | test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag); |
1301 | if (!test_and_set_bit(FLG_T200_RUN, &st->l2.flag)) { | 1297 | if (!test_and_set_bit(FLG_T200_RUN, &st->l2.flag)) { |
1302 | FsmDelTimer(&st->l2.t203, 13); | 1298 | FsmDelTimer(&st->l2.t203, 13); |
diff --git a/drivers/isdn/mISDN/layer2.c b/drivers/isdn/mISDN/layer2.c index 949cabb88f1c..5eb380a25903 100644 --- a/drivers/isdn/mISDN/layer2.c +++ b/drivers/isdn/mISDN/layer2.c | |||
@@ -1476,7 +1476,7 @@ static void | |||
1476 | l2_pull_iqueue(struct FsmInst *fi, int event, void *arg) | 1476 | l2_pull_iqueue(struct FsmInst *fi, int event, void *arg) |
1477 | { | 1477 | { |
1478 | struct layer2 *l2 = fi->userdata; | 1478 | struct layer2 *l2 = fi->userdata; |
1479 | struct sk_buff *skb, *nskb, *oskb; | 1479 | struct sk_buff *skb, *nskb; |
1480 | u_char header[MAX_L2HEADER_LEN]; | 1480 | u_char header[MAX_L2HEADER_LEN]; |
1481 | u_int i, p1; | 1481 | u_int i, p1; |
1482 | 1482 | ||
@@ -1486,48 +1486,34 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg) | |||
1486 | skb = skb_dequeue(&l2->i_queue); | 1486 | skb = skb_dequeue(&l2->i_queue); |
1487 | if (!skb) | 1487 | if (!skb) |
1488 | return; | 1488 | return; |
1489 | |||
1490 | if (test_bit(FLG_MOD128, &l2->flag)) | ||
1491 | p1 = (l2->vs - l2->va) % 128; | ||
1492 | else | ||
1493 | p1 = (l2->vs - l2->va) % 8; | ||
1494 | p1 = (p1 + l2->sow) % l2->window; | ||
1495 | if (l2->windowar[p1]) { | ||
1496 | printk(KERN_WARNING "%s: l2 try overwrite ack queue entry %d\n", | ||
1497 | mISDNDevName4ch(&l2->ch), p1); | ||
1498 | dev_kfree_skb(l2->windowar[p1]); | ||
1499 | } | ||
1500 | l2->windowar[p1] = skb; | ||
1501 | i = sethdraddr(l2, header, CMD); | 1489 | i = sethdraddr(l2, header, CMD); |
1502 | if (test_bit(FLG_MOD128, &l2->flag)) { | 1490 | if (test_bit(FLG_MOD128, &l2->flag)) { |
1503 | header[i++] = l2->vs << 1; | 1491 | header[i++] = l2->vs << 1; |
1504 | header[i++] = l2->vr << 1; | 1492 | header[i++] = l2->vr << 1; |
1493 | } else | ||
1494 | header[i++] = (l2->vr << 5) | (l2->vs << 1); | ||
1495 | nskb = skb_realloc_headroom(skb, i); | ||
1496 | if (!nskb) { | ||
1497 | printk(KERN_WARNING "%s: no headroom(%d) copy for IFrame\n", | ||
1498 | mISDNDevName4ch(&l2->ch), i); | ||
1499 | skb_queue_head(&l2->i_queue, skb); | ||
1500 | return; | ||
1501 | } | ||
1502 | if (test_bit(FLG_MOD128, &l2->flag)) { | ||
1503 | p1 = (l2->vs - l2->va) % 128; | ||
1505 | l2->vs = (l2->vs + 1) % 128; | 1504 | l2->vs = (l2->vs + 1) % 128; |
1506 | } else { | 1505 | } else { |
1507 | header[i++] = (l2->vr << 5) | (l2->vs << 1); | 1506 | p1 = (l2->vs - l2->va) % 8; |
1508 | l2->vs = (l2->vs + 1) % 8; | 1507 | l2->vs = (l2->vs + 1) % 8; |
1509 | } | 1508 | } |
1510 | 1509 | p1 = (p1 + l2->sow) % l2->window; | |
1511 | nskb = skb_clone(skb, GFP_ATOMIC); | 1510 | if (l2->windowar[p1]) { |
1512 | p1 = skb_headroom(nskb); | 1511 | printk(KERN_WARNING "%s: l2 try overwrite ack queue entry %d\n", |
1513 | if (p1 >= i) | 1512 | mISDNDevName4ch(&l2->ch), p1); |
1514 | memcpy(skb_push(nskb, i), header, i); | 1513 | dev_kfree_skb(l2->windowar[p1]); |
1515 | else { | ||
1516 | printk(KERN_WARNING | ||
1517 | "%s: L2 pull_iqueue skb header(%d/%d) too short\n", | ||
1518 | mISDNDevName4ch(&l2->ch), i, p1); | ||
1519 | oskb = nskb; | ||
1520 | nskb = mI_alloc_skb(oskb->len + i, GFP_ATOMIC); | ||
1521 | if (!nskb) { | ||
1522 | dev_kfree_skb(oskb); | ||
1523 | printk(KERN_WARNING "%s: no skb mem in %s\n", | ||
1524 | mISDNDevName4ch(&l2->ch), __func__); | ||
1525 | return; | ||
1526 | } | ||
1527 | memcpy(skb_put(nskb, i), header, i); | ||
1528 | memcpy(skb_put(nskb, oskb->len), oskb->data, oskb->len); | ||
1529 | dev_kfree_skb(oskb); | ||
1530 | } | 1514 | } |
1515 | l2->windowar[p1] = skb; | ||
1516 | memcpy(skb_push(nskb, i), header, i); | ||
1531 | l2down(l2, PH_DATA_REQ, l2_newid(l2), nskb); | 1517 | l2down(l2, PH_DATA_REQ, l2_newid(l2), nskb); |
1532 | test_and_clear_bit(FLG_ACK_PEND, &l2->flag); | 1518 | test_and_clear_bit(FLG_ACK_PEND, &l2->flag); |
1533 | if (!test_and_set_bit(FLG_T200_RUN, &l2->flag)) { | 1519 | if (!test_and_set_bit(FLG_T200_RUN, &l2->flag)) { |
diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c index 48ce83e443c2..8d50314ac3eb 100644 --- a/drivers/net/ethernet/allwinner/sun4i-emac.c +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c | |||
@@ -847,21 +847,25 @@ static int emac_probe(struct platform_device *pdev) | |||
847 | if (ndev->irq == -ENXIO) { | 847 | if (ndev->irq == -ENXIO) { |
848 | netdev_err(ndev, "No irq resource\n"); | 848 | netdev_err(ndev, "No irq resource\n"); |
849 | ret = ndev->irq; | 849 | ret = ndev->irq; |
850 | goto out; | 850 | goto out_iounmap; |
851 | } | 851 | } |
852 | 852 | ||
853 | db->clk = devm_clk_get(&pdev->dev, NULL); | 853 | db->clk = devm_clk_get(&pdev->dev, NULL); |
854 | if (IS_ERR(db->clk)) { | 854 | if (IS_ERR(db->clk)) { |
855 | ret = PTR_ERR(db->clk); | 855 | ret = PTR_ERR(db->clk); |
856 | goto out; | 856 | goto out_iounmap; |
857 | } | 857 | } |
858 | 858 | ||
859 | clk_prepare_enable(db->clk); | 859 | ret = clk_prepare_enable(db->clk); |
860 | if (ret) { | ||
861 | dev_err(&pdev->dev, "Error couldn't enable clock (%d)\n", ret); | ||
862 | goto out_iounmap; | ||
863 | } | ||
860 | 864 | ||
861 | ret = sunxi_sram_claim(&pdev->dev); | 865 | ret = sunxi_sram_claim(&pdev->dev); |
862 | if (ret) { | 866 | if (ret) { |
863 | dev_err(&pdev->dev, "Error couldn't map SRAM to device\n"); | 867 | dev_err(&pdev->dev, "Error couldn't map SRAM to device\n"); |
864 | goto out; | 868 | goto out_clk_disable_unprepare; |
865 | } | 869 | } |
866 | 870 | ||
867 | db->phy_node = of_parse_phandle(np, "phy", 0); | 871 | db->phy_node = of_parse_phandle(np, "phy", 0); |
@@ -910,6 +914,10 @@ static int emac_probe(struct platform_device *pdev) | |||
910 | 914 | ||
911 | out_release_sram: | 915 | out_release_sram: |
912 | sunxi_sram_release(&pdev->dev); | 916 | sunxi_sram_release(&pdev->dev); |
917 | out_clk_disable_unprepare: | ||
918 | clk_disable_unprepare(db->clk); | ||
919 | out_iounmap: | ||
920 | iounmap(db->membase); | ||
913 | out: | 921 | out: |
914 | dev_err(db->dev, "not found (%d).\n", ret); | 922 | dev_err(db->dev, "not found (%d).\n", ret); |
915 | 923 | ||
@@ -921,8 +929,12 @@ out: | |||
921 | static int emac_remove(struct platform_device *pdev) | 929 | static int emac_remove(struct platform_device *pdev) |
922 | { | 930 | { |
923 | struct net_device *ndev = platform_get_drvdata(pdev); | 931 | struct net_device *ndev = platform_get_drvdata(pdev); |
932 | struct emac_board_info *db = netdev_priv(ndev); | ||
924 | 933 | ||
925 | unregister_netdev(ndev); | 934 | unregister_netdev(ndev); |
935 | sunxi_sram_release(&pdev->dev); | ||
936 | clk_disable_unprepare(db->clk); | ||
937 | iounmap(db->membase); | ||
926 | free_netdev(ndev); | 938 | free_netdev(ndev); |
927 | 939 | ||
928 | dev_dbg(&pdev->dev, "released and freed device\n"); | 940 | dev_dbg(&pdev->dev, "released and freed device\n"); |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c index 45512242baea..112f1bc8bcee 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c | |||
@@ -1595,7 +1595,7 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel) | |||
1595 | packet->rdesc_count, 1); | 1595 | packet->rdesc_count, 1); |
1596 | 1596 | ||
1597 | /* Make sure ownership is written to the descriptor */ | 1597 | /* Make sure ownership is written to the descriptor */ |
1598 | dma_wmb(); | 1598 | wmb(); |
1599 | 1599 | ||
1600 | ring->cur = cur_index + 1; | 1600 | ring->cur = cur_index + 1; |
1601 | if (!packet->skb->xmit_more || | 1601 | if (!packet->skb->xmit_more || |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c index 49f796aaad4f..cff8940e1694 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c | |||
@@ -1811,6 +1811,7 @@ static int xgbe_tx_poll(struct xgbe_channel *channel) | |||
1811 | struct netdev_queue *txq; | 1811 | struct netdev_queue *txq; |
1812 | int processed = 0; | 1812 | int processed = 0; |
1813 | unsigned int tx_packets = 0, tx_bytes = 0; | 1813 | unsigned int tx_packets = 0, tx_bytes = 0; |
1814 | unsigned int cur; | ||
1814 | 1815 | ||
1815 | DBGPR("-->xgbe_tx_poll\n"); | 1816 | DBGPR("-->xgbe_tx_poll\n"); |
1816 | 1817 | ||
@@ -1818,10 +1819,11 @@ static int xgbe_tx_poll(struct xgbe_channel *channel) | |||
1818 | if (!ring) | 1819 | if (!ring) |
1819 | return 0; | 1820 | return 0; |
1820 | 1821 | ||
1822 | cur = ring->cur; | ||
1821 | txq = netdev_get_tx_queue(netdev, channel->queue_index); | 1823 | txq = netdev_get_tx_queue(netdev, channel->queue_index); |
1822 | 1824 | ||
1823 | while ((processed < XGBE_TX_DESC_MAX_PROC) && | 1825 | while ((processed < XGBE_TX_DESC_MAX_PROC) && |
1824 | (ring->dirty != ring->cur)) { | 1826 | (ring->dirty != cur)) { |
1825 | rdata = XGBE_GET_DESC_DATA(ring, ring->dirty); | 1827 | rdata = XGBE_GET_DESC_DATA(ring, ring->dirty); |
1826 | rdesc = rdata->rdesc; | 1828 | rdesc = rdata->rdesc; |
1827 | 1829 | ||
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c index 95af75d35bc5..8b1929e9f698 100644 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c | |||
@@ -2048,7 +2048,7 @@ static void swphy_poll_timer(unsigned long data) | |||
2048 | 2048 | ||
2049 | for (i = 0; i < priv->num_ports; i++) { | 2049 | for (i = 0; i < priv->num_ports; i++) { |
2050 | struct bcm63xx_enetsw_port *port; | 2050 | struct bcm63xx_enetsw_port *port; |
2051 | int val, j, up, advertise, lpa, lpa2, speed, duplex, media; | 2051 | int val, j, up, advertise, lpa, speed, duplex, media; |
2052 | int external_phy = bcm_enet_port_is_rgmii(i); | 2052 | int external_phy = bcm_enet_port_is_rgmii(i); |
2053 | u8 override; | 2053 | u8 override; |
2054 | 2054 | ||
@@ -2091,22 +2091,27 @@ static void swphy_poll_timer(unsigned long data) | |||
2091 | lpa = bcmenet_sw_mdio_read(priv, external_phy, port->phy_id, | 2091 | lpa = bcmenet_sw_mdio_read(priv, external_phy, port->phy_id, |
2092 | MII_LPA); | 2092 | MII_LPA); |
2093 | 2093 | ||
2094 | lpa2 = bcmenet_sw_mdio_read(priv, external_phy, port->phy_id, | ||
2095 | MII_STAT1000); | ||
2096 | |||
2097 | /* figure out media and duplex from advertise and LPA values */ | 2094 | /* figure out media and duplex from advertise and LPA values */ |
2098 | media = mii_nway_result(lpa & advertise); | 2095 | media = mii_nway_result(lpa & advertise); |
2099 | duplex = (media & ADVERTISE_FULL) ? 1 : 0; | 2096 | duplex = (media & ADVERTISE_FULL) ? 1 : 0; |
2100 | if (lpa2 & LPA_1000FULL) | 2097 | |
2101 | duplex = 1; | 2098 | if (media & (ADVERTISE_100FULL | ADVERTISE_100HALF)) |
2102 | 2099 | speed = 100; | |
2103 | if (lpa2 & (LPA_1000FULL | LPA_1000HALF)) | 2100 | else |
2104 | speed = 1000; | 2101 | speed = 10; |
2105 | else { | 2102 | |
2106 | if (media & (ADVERTISE_100FULL | ADVERTISE_100HALF)) | 2103 | if (val & BMSR_ESTATEN) { |
2107 | speed = 100; | 2104 | advertise = bcmenet_sw_mdio_read(priv, external_phy, |
2108 | else | 2105 | port->phy_id, MII_CTRL1000); |
2109 | speed = 10; | 2106 | |
2107 | lpa = bcmenet_sw_mdio_read(priv, external_phy, | ||
2108 | port->phy_id, MII_STAT1000); | ||
2109 | |||
2110 | if (advertise & (ADVERTISE_1000FULL | ADVERTISE_1000HALF) | ||
2111 | && lpa & (LPA_1000FULL | LPA_1000HALF)) { | ||
2112 | speed = 1000; | ||
2113 | duplex = (lpa & LPA_1000FULL); | ||
2114 | } | ||
2110 | } | 2115 | } |
2111 | 2116 | ||
2112 | dev_info(&priv->pdev->dev, | 2117 | dev_info(&priv->pdev->dev, |
diff --git a/drivers/net/ethernet/cavium/Kconfig b/drivers/net/ethernet/cavium/Kconfig index 9b35d142f47a..8fb84e69c30e 100644 --- a/drivers/net/ethernet/cavium/Kconfig +++ b/drivers/net/ethernet/cavium/Kconfig | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | config NET_VENDOR_CAVIUM | 5 | config NET_VENDOR_CAVIUM |
6 | tristate "Cavium ethernet drivers" | 6 | bool "Cavium ethernet drivers" |
7 | depends on PCI | 7 | depends on PCI |
8 | default y | 8 | default y |
9 | ---help--- | 9 | ---help--- |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index 8fd26fdd7705..3f385ffe420f 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c | |||
@@ -1406,6 +1406,12 @@ static void i40e_get_ethtool_stats(struct net_device *netdev, | |||
1406 | data[i++] = (i40e_gstrings_veb_stats[j].sizeof_stat == | 1406 | data[i++] = (i40e_gstrings_veb_stats[j].sizeof_stat == |
1407 | sizeof(u64)) ? *(u64 *)p : *(u32 *)p; | 1407 | sizeof(u64)) ? *(u64 *)p : *(u32 *)p; |
1408 | } | 1408 | } |
1409 | for (j = 0; j < I40E_MAX_TRAFFIC_CLASS; j++) { | ||
1410 | data[i++] = veb->tc_stats.tc_tx_packets[j]; | ||
1411 | data[i++] = veb->tc_stats.tc_tx_bytes[j]; | ||
1412 | data[i++] = veb->tc_stats.tc_rx_packets[j]; | ||
1413 | data[i++] = veb->tc_stats.tc_rx_bytes[j]; | ||
1414 | } | ||
1409 | } | 1415 | } |
1410 | for (j = 0; j < I40E_GLOBAL_STATS_LEN; j++) { | 1416 | for (j = 0; j < I40E_GLOBAL_STATS_LEN; j++) { |
1411 | p = (char *)pf + i40e_gstrings_stats[j].stat_offset; | 1417 | p = (char *)pf + i40e_gstrings_stats[j].stat_offset; |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 3e595adfb0bf..b825f978d441 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
@@ -8154,6 +8154,7 @@ static int i40e_sw_init(struct i40e_pf *pf) | |||
8154 | if (pf->hw.func_caps.vmdq) { | 8154 | if (pf->hw.func_caps.vmdq) { |
8155 | pf->num_vmdq_vsis = I40E_DEFAULT_NUM_VMDQ_VSI; | 8155 | pf->num_vmdq_vsis = I40E_DEFAULT_NUM_VMDQ_VSI; |
8156 | pf->flags |= I40E_FLAG_VMDQ_ENABLED; | 8156 | pf->flags |= I40E_FLAG_VMDQ_ENABLED; |
8157 | pf->num_vmdq_qps = i40e_default_queues_per_vmdq(pf); | ||
8157 | } | 8158 | } |
8158 | 8159 | ||
8159 | #ifdef I40E_FCOE | 8160 | #ifdef I40E_FCOE |
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index 603d29df5832..6bf725921e79 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c | |||
@@ -759,11 +759,23 @@ txq_put_data_tso(struct net_device *dev, struct tx_queue *txq, | |||
759 | 759 | ||
760 | desc->l4i_chk = 0; | 760 | desc->l4i_chk = 0; |
761 | desc->byte_cnt = length; | 761 | desc->byte_cnt = length; |
762 | desc->buf_ptr = dma_map_single(dev->dev.parent, data, | 762 | |
763 | length, DMA_TO_DEVICE); | 763 | if (length <= 8 && (uintptr_t)data & 0x7) { |
764 | if (unlikely(dma_mapping_error(dev->dev.parent, desc->buf_ptr))) { | 764 | /* Copy unaligned small data fragment to TSO header data area */ |
765 | WARN(1, "dma_map_single failed!\n"); | 765 | memcpy(txq->tso_hdrs + txq->tx_curr_desc * TSO_HEADER_SIZE, |
766 | return -ENOMEM; | 766 | data, length); |
767 | desc->buf_ptr = txq->tso_hdrs_dma | ||
768 | + txq->tx_curr_desc * TSO_HEADER_SIZE; | ||
769 | } else { | ||
770 | /* Alignment is okay, map buffer and hand off to hardware */ | ||
771 | txq->tx_desc_mapping[tx_index] = DESC_DMA_MAP_SINGLE; | ||
772 | desc->buf_ptr = dma_map_single(dev->dev.parent, data, | ||
773 | length, DMA_TO_DEVICE); | ||
774 | if (unlikely(dma_mapping_error(dev->dev.parent, | ||
775 | desc->buf_ptr))) { | ||
776 | WARN(1, "dma_map_single failed!\n"); | ||
777 | return -ENOMEM; | ||
778 | } | ||
767 | } | 779 | } |
768 | 780 | ||
769 | cmd_sts = BUFFER_OWNED_BY_DMA; | 781 | cmd_sts = BUFFER_OWNED_BY_DMA; |
@@ -779,7 +791,8 @@ txq_put_data_tso(struct net_device *dev, struct tx_queue *txq, | |||
779 | } | 791 | } |
780 | 792 | ||
781 | static inline void | 793 | static inline void |
782 | txq_put_hdr_tso(struct sk_buff *skb, struct tx_queue *txq, int length) | 794 | txq_put_hdr_tso(struct sk_buff *skb, struct tx_queue *txq, int length, |
795 | u32 *first_cmd_sts, bool first_desc) | ||
783 | { | 796 | { |
784 | struct mv643xx_eth_private *mp = txq_to_mp(txq); | 797 | struct mv643xx_eth_private *mp = txq_to_mp(txq); |
785 | int hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); | 798 | int hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
@@ -788,6 +801,7 @@ txq_put_hdr_tso(struct sk_buff *skb, struct tx_queue *txq, int length) | |||
788 | int ret; | 801 | int ret; |
789 | u32 cmd_csum = 0; | 802 | u32 cmd_csum = 0; |
790 | u16 l4i_chk = 0; | 803 | u16 l4i_chk = 0; |
804 | u32 cmd_sts; | ||
791 | 805 | ||
792 | tx_index = txq->tx_curr_desc; | 806 | tx_index = txq->tx_curr_desc; |
793 | desc = &txq->tx_desc_area[tx_index]; | 807 | desc = &txq->tx_desc_area[tx_index]; |
@@ -803,9 +817,17 @@ txq_put_hdr_tso(struct sk_buff *skb, struct tx_queue *txq, int length) | |||
803 | desc->byte_cnt = hdr_len; | 817 | desc->byte_cnt = hdr_len; |
804 | desc->buf_ptr = txq->tso_hdrs_dma + | 818 | desc->buf_ptr = txq->tso_hdrs_dma + |
805 | txq->tx_curr_desc * TSO_HEADER_SIZE; | 819 | txq->tx_curr_desc * TSO_HEADER_SIZE; |
806 | desc->cmd_sts = cmd_csum | BUFFER_OWNED_BY_DMA | TX_FIRST_DESC | | 820 | cmd_sts = cmd_csum | BUFFER_OWNED_BY_DMA | TX_FIRST_DESC | |
807 | GEN_CRC; | 821 | GEN_CRC; |
808 | 822 | ||
823 | /* Defer updating the first command descriptor until all | ||
824 | * following descriptors have been written. | ||
825 | */ | ||
826 | if (first_desc) | ||
827 | *first_cmd_sts = cmd_sts; | ||
828 | else | ||
829 | desc->cmd_sts = cmd_sts; | ||
830 | |||
809 | txq->tx_curr_desc++; | 831 | txq->tx_curr_desc++; |
810 | if (txq->tx_curr_desc == txq->tx_ring_size) | 832 | if (txq->tx_curr_desc == txq->tx_ring_size) |
811 | txq->tx_curr_desc = 0; | 833 | txq->tx_curr_desc = 0; |
@@ -819,6 +841,8 @@ static int txq_submit_tso(struct tx_queue *txq, struct sk_buff *skb, | |||
819 | int desc_count = 0; | 841 | int desc_count = 0; |
820 | struct tso_t tso; | 842 | struct tso_t tso; |
821 | int hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); | 843 | int hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
844 | struct tx_desc *first_tx_desc; | ||
845 | u32 first_cmd_sts = 0; | ||
822 | 846 | ||
823 | /* Count needed descriptors */ | 847 | /* Count needed descriptors */ |
824 | if ((txq->tx_desc_count + tso_count_descs(skb)) >= txq->tx_ring_size) { | 848 | if ((txq->tx_desc_count + tso_count_descs(skb)) >= txq->tx_ring_size) { |
@@ -826,11 +850,14 @@ static int txq_submit_tso(struct tx_queue *txq, struct sk_buff *skb, | |||
826 | return -EBUSY; | 850 | return -EBUSY; |
827 | } | 851 | } |
828 | 852 | ||
853 | first_tx_desc = &txq->tx_desc_area[txq->tx_curr_desc]; | ||
854 | |||
829 | /* Initialize the TSO handler, and prepare the first payload */ | 855 | /* Initialize the TSO handler, and prepare the first payload */ |
830 | tso_start(skb, &tso); | 856 | tso_start(skb, &tso); |
831 | 857 | ||
832 | total_len = skb->len - hdr_len; | 858 | total_len = skb->len - hdr_len; |
833 | while (total_len > 0) { | 859 | while (total_len > 0) { |
860 | bool first_desc = (desc_count == 0); | ||
834 | char *hdr; | 861 | char *hdr; |
835 | 862 | ||
836 | data_left = min_t(int, skb_shinfo(skb)->gso_size, total_len); | 863 | data_left = min_t(int, skb_shinfo(skb)->gso_size, total_len); |
@@ -840,7 +867,8 @@ static int txq_submit_tso(struct tx_queue *txq, struct sk_buff *skb, | |||
840 | /* prepare packet headers: MAC + IP + TCP */ | 867 | /* prepare packet headers: MAC + IP + TCP */ |
841 | hdr = txq->tso_hdrs + txq->tx_curr_desc * TSO_HEADER_SIZE; | 868 | hdr = txq->tso_hdrs + txq->tx_curr_desc * TSO_HEADER_SIZE; |
842 | tso_build_hdr(skb, hdr, &tso, data_left, total_len == 0); | 869 | tso_build_hdr(skb, hdr, &tso, data_left, total_len == 0); |
843 | txq_put_hdr_tso(skb, txq, data_left); | 870 | txq_put_hdr_tso(skb, txq, data_left, &first_cmd_sts, |
871 | first_desc); | ||
844 | 872 | ||
845 | while (data_left > 0) { | 873 | while (data_left > 0) { |
846 | int size; | 874 | int size; |
@@ -860,6 +888,10 @@ static int txq_submit_tso(struct tx_queue *txq, struct sk_buff *skb, | |||
860 | __skb_queue_tail(&txq->tx_skb, skb); | 888 | __skb_queue_tail(&txq->tx_skb, skb); |
861 | skb_tx_timestamp(skb); | 889 | skb_tx_timestamp(skb); |
862 | 890 | ||
891 | /* ensure all other descriptors are written before first cmd_sts */ | ||
892 | wmb(); | ||
893 | first_tx_desc->cmd_sts = first_cmd_sts; | ||
894 | |||
863 | /* clear TX_END status */ | 895 | /* clear TX_END status */ |
864 | mp->work_tx_end &= ~(1 << txq->index); | 896 | mp->work_tx_end &= ~(1 << txq->index); |
865 | 897 | ||
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 55d2d8577d07..040fbc1e5508 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/pm_runtime.h> | 31 | #include <linux/pm_runtime.h> |
32 | #include <linux/gpio.h> | 32 | #include <linux/gpio.h> |
33 | #include <linux/of.h> | 33 | #include <linux/of.h> |
34 | #include <linux/of_mdio.h> | ||
34 | #include <linux/of_net.h> | 35 | #include <linux/of_net.h> |
35 | #include <linux/of_device.h> | 36 | #include <linux/of_device.h> |
36 | #include <linux/if_vlan.h> | 37 | #include <linux/if_vlan.h> |
@@ -366,6 +367,7 @@ struct cpsw_priv { | |||
366 | spinlock_t lock; | 367 | spinlock_t lock; |
367 | struct platform_device *pdev; | 368 | struct platform_device *pdev; |
368 | struct net_device *ndev; | 369 | struct net_device *ndev; |
370 | struct device_node *phy_node; | ||
369 | struct napi_struct napi_rx; | 371 | struct napi_struct napi_rx; |
370 | struct napi_struct napi_tx; | 372 | struct napi_struct napi_tx; |
371 | struct device *dev; | 373 | struct device *dev; |
@@ -1146,7 +1148,11 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv) | |||
1146 | cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, | 1148 | cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, |
1147 | 1 << slave_port, 0, 0, ALE_MCAST_FWD_2); | 1149 | 1 << slave_port, 0, 0, ALE_MCAST_FWD_2); |
1148 | 1150 | ||
1149 | slave->phy = phy_connect(priv->ndev, slave->data->phy_id, | 1151 | if (priv->phy_node) |
1152 | slave->phy = of_phy_connect(priv->ndev, priv->phy_node, | ||
1153 | &cpsw_adjust_link, 0, slave->data->phy_if); | ||
1154 | else | ||
1155 | slave->phy = phy_connect(priv->ndev, slave->data->phy_id, | ||
1150 | &cpsw_adjust_link, slave->data->phy_if); | 1156 | &cpsw_adjust_link, slave->data->phy_if); |
1151 | if (IS_ERR(slave->phy)) { | 1157 | if (IS_ERR(slave->phy)) { |
1152 | dev_err(priv->dev, "phy %s not found on slave %d\n", | 1158 | dev_err(priv->dev, "phy %s not found on slave %d\n", |
@@ -1934,11 +1940,12 @@ static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv, | |||
1934 | slave->port_vlan = data->dual_emac_res_vlan; | 1940 | slave->port_vlan = data->dual_emac_res_vlan; |
1935 | } | 1941 | } |
1936 | 1942 | ||
1937 | static int cpsw_probe_dt(struct cpsw_platform_data *data, | 1943 | static int cpsw_probe_dt(struct cpsw_priv *priv, |
1938 | struct platform_device *pdev) | 1944 | struct platform_device *pdev) |
1939 | { | 1945 | { |
1940 | struct device_node *node = pdev->dev.of_node; | 1946 | struct device_node *node = pdev->dev.of_node; |
1941 | struct device_node *slave_node; | 1947 | struct device_node *slave_node; |
1948 | struct cpsw_platform_data *data = &priv->data; | ||
1942 | int i = 0, ret; | 1949 | int i = 0, ret; |
1943 | u32 prop; | 1950 | u32 prop; |
1944 | 1951 | ||
@@ -2029,6 +2036,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
2029 | if (strcmp(slave_node->name, "slave")) | 2036 | if (strcmp(slave_node->name, "slave")) |
2030 | continue; | 2037 | continue; |
2031 | 2038 | ||
2039 | priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0); | ||
2032 | parp = of_get_property(slave_node, "phy_id", &lenp); | 2040 | parp = of_get_property(slave_node, "phy_id", &lenp); |
2033 | if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) { | 2041 | if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) { |
2034 | dev_err(&pdev->dev, "Missing slave[%d] phy_id property\n", i); | 2042 | dev_err(&pdev->dev, "Missing slave[%d] phy_id property\n", i); |
@@ -2044,7 +2052,6 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
2044 | } | 2052 | } |
2045 | snprintf(slave_data->phy_id, sizeof(slave_data->phy_id), | 2053 | snprintf(slave_data->phy_id, sizeof(slave_data->phy_id), |
2046 | PHY_ID_FMT, mdio->name, phyid); | 2054 | PHY_ID_FMT, mdio->name, phyid); |
2047 | |||
2048 | slave_data->phy_if = of_get_phy_mode(slave_node); | 2055 | slave_data->phy_if = of_get_phy_mode(slave_node); |
2049 | if (slave_data->phy_if < 0) { | 2056 | if (slave_data->phy_if < 0) { |
2050 | dev_err(&pdev->dev, "Missing or malformed slave[%d] phy-mode property\n", | 2057 | dev_err(&pdev->dev, "Missing or malformed slave[%d] phy-mode property\n", |
@@ -2245,7 +2252,7 @@ static int cpsw_probe(struct platform_device *pdev) | |||
2245 | /* Select default pin state */ | 2252 | /* Select default pin state */ |
2246 | pinctrl_pm_select_default_state(&pdev->dev); | 2253 | pinctrl_pm_select_default_state(&pdev->dev); |
2247 | 2254 | ||
2248 | if (cpsw_probe_dt(&priv->data, pdev)) { | 2255 | if (cpsw_probe_dt(priv, pdev)) { |
2249 | dev_err(&pdev->dev, "cpsw: platform data missing\n"); | 2256 | dev_err(&pdev->dev, "cpsw: platform data missing\n"); |
2250 | ret = -ENODEV; | 2257 | ret = -ENODEV; |
2251 | goto clean_runtime_disable_ret; | 2258 | goto clean_runtime_disable_ret; |
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index cde29f8a37bf..445071c163cb 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c | |||
@@ -594,14 +594,12 @@ static struct rtable *geneve_get_rt(struct sk_buff *skb, | |||
594 | rt = ip_route_output_key(geneve->net, fl4); | 594 | rt = ip_route_output_key(geneve->net, fl4); |
595 | if (IS_ERR(rt)) { | 595 | if (IS_ERR(rt)) { |
596 | netdev_dbg(dev, "no route to %pI4\n", &fl4->daddr); | 596 | netdev_dbg(dev, "no route to %pI4\n", &fl4->daddr); |
597 | dev->stats.tx_carrier_errors++; | 597 | return ERR_PTR(-ENETUNREACH); |
598 | return rt; | ||
599 | } | 598 | } |
600 | if (rt->dst.dev == dev) { /* is this necessary? */ | 599 | if (rt->dst.dev == dev) { /* is this necessary? */ |
601 | netdev_dbg(dev, "circular route to %pI4\n", &fl4->daddr); | 600 | netdev_dbg(dev, "circular route to %pI4\n", &fl4->daddr); |
602 | dev->stats.collisions++; | ||
603 | ip_rt_put(rt); | 601 | ip_rt_put(rt); |
604 | return ERR_PTR(-EINVAL); | 602 | return ERR_PTR(-ELOOP); |
605 | } | 603 | } |
606 | return rt; | 604 | return rt; |
607 | } | 605 | } |
@@ -627,12 +625,12 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev) | |||
627 | struct ip_tunnel_info *info = NULL; | 625 | struct ip_tunnel_info *info = NULL; |
628 | struct rtable *rt = NULL; | 626 | struct rtable *rt = NULL; |
629 | const struct iphdr *iip; /* interior IP header */ | 627 | const struct iphdr *iip; /* interior IP header */ |
628 | int err = -EINVAL; | ||
630 | struct flowi4 fl4; | 629 | struct flowi4 fl4; |
631 | __u8 tos, ttl; | 630 | __u8 tos, ttl; |
632 | __be16 sport; | 631 | __be16 sport; |
633 | bool udp_csum; | 632 | bool udp_csum; |
634 | __be16 df; | 633 | __be16 df; |
635 | int err; | ||
636 | 634 | ||
637 | if (geneve->collect_md) { | 635 | if (geneve->collect_md) { |
638 | info = skb_tunnel_info(skb); | 636 | info = skb_tunnel_info(skb); |
@@ -647,7 +645,7 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev) | |||
647 | rt = geneve_get_rt(skb, dev, &fl4, info); | 645 | rt = geneve_get_rt(skb, dev, &fl4, info); |
648 | if (IS_ERR(rt)) { | 646 | if (IS_ERR(rt)) { |
649 | netdev_dbg(dev, "no route to %pI4\n", &fl4.daddr); | 647 | netdev_dbg(dev, "no route to %pI4\n", &fl4.daddr); |
650 | dev->stats.tx_carrier_errors++; | 648 | err = PTR_ERR(rt); |
651 | goto tx_error; | 649 | goto tx_error; |
652 | } | 650 | } |
653 | 651 | ||
@@ -699,10 +697,37 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev) | |||
699 | tx_error: | 697 | tx_error: |
700 | dev_kfree_skb(skb); | 698 | dev_kfree_skb(skb); |
701 | err: | 699 | err: |
702 | dev->stats.tx_errors++; | 700 | if (err == -ELOOP) |
701 | dev->stats.collisions++; | ||
702 | else if (err == -ENETUNREACH) | ||
703 | dev->stats.tx_carrier_errors++; | ||
704 | else | ||
705 | dev->stats.tx_errors++; | ||
703 | return NETDEV_TX_OK; | 706 | return NETDEV_TX_OK; |
704 | } | 707 | } |
705 | 708 | ||
709 | static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb) | ||
710 | { | ||
711 | struct ip_tunnel_info *info = skb_tunnel_info(skb); | ||
712 | struct geneve_dev *geneve = netdev_priv(dev); | ||
713 | struct rtable *rt; | ||
714 | struct flowi4 fl4; | ||
715 | |||
716 | if (ip_tunnel_info_af(info) != AF_INET) | ||
717 | return -EINVAL; | ||
718 | |||
719 | rt = geneve_get_rt(skb, dev, &fl4, info); | ||
720 | if (IS_ERR(rt)) | ||
721 | return PTR_ERR(rt); | ||
722 | |||
723 | ip_rt_put(rt); | ||
724 | info->key.u.ipv4.src = fl4.saddr; | ||
725 | info->key.tp_src = udp_flow_src_port(geneve->net, skb, | ||
726 | 1, USHRT_MAX, true); | ||
727 | info->key.tp_dst = geneve->dst_port; | ||
728 | return 0; | ||
729 | } | ||
730 | |||
706 | static const struct net_device_ops geneve_netdev_ops = { | 731 | static const struct net_device_ops geneve_netdev_ops = { |
707 | .ndo_init = geneve_init, | 732 | .ndo_init = geneve_init, |
708 | .ndo_uninit = geneve_uninit, | 733 | .ndo_uninit = geneve_uninit, |
@@ -713,6 +738,7 @@ static const struct net_device_ops geneve_netdev_ops = { | |||
713 | .ndo_change_mtu = eth_change_mtu, | 738 | .ndo_change_mtu = eth_change_mtu, |
714 | .ndo_validate_addr = eth_validate_addr, | 739 | .ndo_validate_addr = eth_validate_addr, |
715 | .ndo_set_mac_address = eth_mac_addr, | 740 | .ndo_set_mac_address = eth_mac_addr, |
741 | .ndo_fill_metadata_dst = geneve_fill_metadata_dst, | ||
716 | }; | 742 | }; |
717 | 743 | ||
718 | static void geneve_get_drvinfo(struct net_device *dev, | 744 | static void geneve_get_drvinfo(struct net_device *dev, |
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 248478c6f6e4..197c93937c2d 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
@@ -137,7 +137,7 @@ static const struct proto_ops macvtap_socket_ops; | |||
137 | #define TUN_OFFLOADS (NETIF_F_HW_CSUM | NETIF_F_TSO_ECN | NETIF_F_TSO | \ | 137 | #define TUN_OFFLOADS (NETIF_F_HW_CSUM | NETIF_F_TSO_ECN | NETIF_F_TSO | \ |
138 | NETIF_F_TSO6 | NETIF_F_UFO) | 138 | NETIF_F_TSO6 | NETIF_F_UFO) |
139 | #define RX_OFFLOADS (NETIF_F_GRO | NETIF_F_LRO) | 139 | #define RX_OFFLOADS (NETIF_F_GRO | NETIF_F_LRO) |
140 | #define TAP_FEATURES (NETIF_F_GSO | NETIF_F_SG) | 140 | #define TAP_FEATURES (NETIF_F_GSO | NETIF_F_SG | NETIF_F_FRAGLIST) |
141 | 141 | ||
142 | static struct macvlan_dev *macvtap_get_vlan_rcu(const struct net_device *dev) | 142 | static struct macvlan_dev *macvtap_get_vlan_rcu(const struct net_device *dev) |
143 | { | 143 | { |
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index a7fb66580cee..60994a83a0d6 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
@@ -141,6 +141,11 @@ config MICREL_PHY | |||
141 | ---help--- | 141 | ---help--- |
142 | Supports the KSZ9021, VSC8201, KS8001 PHYs. | 142 | Supports the KSZ9021, VSC8201, KS8001 PHYs. |
143 | 143 | ||
144 | config DP83848_PHY | ||
145 | tristate "Driver for Texas Instruments DP83848 PHY" | ||
146 | ---help--- | ||
147 | Supports the DP83848 PHY. | ||
148 | |||
144 | config DP83867_PHY | 149 | config DP83867_PHY |
145 | tristate "Drivers for Texas Instruments DP83867 Gigabit PHY" | 150 | tristate "Drivers for Texas Instruments DP83867 Gigabit PHY" |
146 | ---help--- | 151 | ---help--- |
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile index 7655d47ad8d8..f31a4e25cf15 100644 --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile | |||
@@ -26,6 +26,7 @@ obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o | |||
26 | obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o | 26 | obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o |
27 | obj-$(CONFIG_NATIONAL_PHY) += national.o | 27 | obj-$(CONFIG_NATIONAL_PHY) += national.o |
28 | obj-$(CONFIG_DP83640_PHY) += dp83640.o | 28 | obj-$(CONFIG_DP83640_PHY) += dp83640.o |
29 | obj-$(CONFIG_DP83848_PHY) += dp83848.o | ||
29 | obj-$(CONFIG_DP83867_PHY) += dp83867.o | 30 | obj-$(CONFIG_DP83867_PHY) += dp83867.o |
30 | obj-$(CONFIG_STE10XP) += ste10Xp.o | 31 | obj-$(CONFIG_STE10XP) += ste10Xp.o |
31 | obj-$(CONFIG_MICREL_PHY) += micrel.o | 32 | obj-$(CONFIG_MICREL_PHY) += micrel.o |
diff --git a/drivers/net/phy/dp83848.c b/drivers/net/phy/dp83848.c new file mode 100644 index 000000000000..5ce9bef54468 --- /dev/null +++ b/drivers/net/phy/dp83848.c | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | * Driver for the Texas Instruments DP83848 PHY | ||
3 | * | ||
4 | * Copyright (C) 2015 Texas Instruments Inc. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/module.h> | ||
17 | #include <linux/phy.h> | ||
18 | |||
19 | #define DP83848_PHY_ID 0x20005c90 | ||
20 | |||
21 | /* Registers */ | ||
22 | #define DP83848_MICR 0x11 | ||
23 | #define DP83848_MISR 0x12 | ||
24 | |||
25 | /* MICR Register Fields */ | ||
26 | #define DP83848_MICR_INT_OE BIT(0) /* Interrupt Output Enable */ | ||
27 | #define DP83848_MICR_INTEN BIT(1) /* Interrupt Enable */ | ||
28 | |||
29 | /* MISR Register Fields */ | ||
30 | #define DP83848_MISR_RHF_INT_EN BIT(0) /* Receive Error Counter */ | ||
31 | #define DP83848_MISR_FHF_INT_EN BIT(1) /* False Carrier Counter */ | ||
32 | #define DP83848_MISR_ANC_INT_EN BIT(2) /* Auto-negotiation complete */ | ||
33 | #define DP83848_MISR_DUP_INT_EN BIT(3) /* Duplex Status */ | ||
34 | #define DP83848_MISR_SPD_INT_EN BIT(4) /* Speed status */ | ||
35 | #define DP83848_MISR_LINK_INT_EN BIT(5) /* Link status */ | ||
36 | #define DP83848_MISR_ED_INT_EN BIT(6) /* Energy detect */ | ||
37 | #define DP83848_MISR_LQM_INT_EN BIT(7) /* Link Quality Monitor */ | ||
38 | |||
39 | static int dp83848_ack_interrupt(struct phy_device *phydev) | ||
40 | { | ||
41 | int err = phy_read(phydev, DP83848_MISR); | ||
42 | |||
43 | return err < 0 ? err : 0; | ||
44 | } | ||
45 | |||
46 | static int dp83848_config_intr(struct phy_device *phydev) | ||
47 | { | ||
48 | int err; | ||
49 | |||
50 | if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { | ||
51 | err = phy_write(phydev, DP83848_MICR, | ||
52 | DP83848_MICR_INT_OE | | ||
53 | DP83848_MICR_INTEN); | ||
54 | if (err < 0) | ||
55 | return err; | ||
56 | |||
57 | return phy_write(phydev, DP83848_MISR, | ||
58 | DP83848_MISR_ANC_INT_EN | | ||
59 | DP83848_MISR_DUP_INT_EN | | ||
60 | DP83848_MISR_SPD_INT_EN | | ||
61 | DP83848_MISR_LINK_INT_EN); | ||
62 | } | ||
63 | |||
64 | return phy_write(phydev, DP83848_MICR, 0x0); | ||
65 | } | ||
66 | |||
67 | static struct mdio_device_id __maybe_unused dp83848_tbl[] = { | ||
68 | { DP83848_PHY_ID, 0xfffffff0 }, | ||
69 | { } | ||
70 | }; | ||
71 | MODULE_DEVICE_TABLE(mdio, dp83848_tbl); | ||
72 | |||
73 | static struct phy_driver dp83848_driver[] = { | ||
74 | { | ||
75 | .phy_id = DP83848_PHY_ID, | ||
76 | .phy_id_mask = 0xfffffff0, | ||
77 | .name = "TI DP83848", | ||
78 | .features = PHY_BASIC_FEATURES, | ||
79 | .flags = PHY_HAS_INTERRUPT, | ||
80 | |||
81 | .soft_reset = genphy_soft_reset, | ||
82 | .config_init = genphy_config_init, | ||
83 | .suspend = genphy_suspend, | ||
84 | .resume = genphy_resume, | ||
85 | .config_aneg = genphy_config_aneg, | ||
86 | .read_status = genphy_read_status, | ||
87 | |||
88 | /* IRQ related */ | ||
89 | .ack_interrupt = dp83848_ack_interrupt, | ||
90 | .config_intr = dp83848_config_intr, | ||
91 | |||
92 | .driver = { .owner = THIS_MODULE, }, | ||
93 | }, | ||
94 | }; | ||
95 | module_phy_driver(dp83848_driver); | ||
96 | |||
97 | MODULE_DESCRIPTION("Texas Instruments DP83848 PHY driver"); | ||
98 | MODULE_AUTHOR("Andrew F. Davis <afd@ti.com"); | ||
99 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 499185eaf413..cf6312fafea5 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c | |||
@@ -514,6 +514,27 @@ static int ksz8873mll_read_status(struct phy_device *phydev) | |||
514 | return 0; | 514 | return 0; |
515 | } | 515 | } |
516 | 516 | ||
517 | static int ksz9031_read_status(struct phy_device *phydev) | ||
518 | { | ||
519 | int err; | ||
520 | int regval; | ||
521 | |||
522 | err = genphy_read_status(phydev); | ||
523 | if (err) | ||
524 | return err; | ||
525 | |||
526 | /* Make sure the PHY is not broken. Read idle error count, | ||
527 | * and reset the PHY if it is maxed out. | ||
528 | */ | ||
529 | regval = phy_read(phydev, MII_STAT1000); | ||
530 | if ((regval & 0xFF) == 0xFF) { | ||
531 | phy_init_hw(phydev); | ||
532 | phydev->link = 0; | ||
533 | } | ||
534 | |||
535 | return 0; | ||
536 | } | ||
537 | |||
517 | static int ksz8873mll_config_aneg(struct phy_device *phydev) | 538 | static int ksz8873mll_config_aneg(struct phy_device *phydev) |
518 | { | 539 | { |
519 | return 0; | 540 | return 0; |
@@ -772,7 +793,7 @@ static struct phy_driver ksphy_driver[] = { | |||
772 | .driver_data = &ksz9021_type, | 793 | .driver_data = &ksz9021_type, |
773 | .config_init = ksz9031_config_init, | 794 | .config_init = ksz9031_config_init, |
774 | .config_aneg = genphy_config_aneg, | 795 | .config_aneg = genphy_config_aneg, |
775 | .read_status = genphy_read_status, | 796 | .read_status = ksz9031_read_status, |
776 | .ack_interrupt = kszphy_ack_interrupt, | 797 | .ack_interrupt = kszphy_ack_interrupt, |
777 | .config_intr = kszphy_config_intr, | 798 | .config_intr = kszphy_config_intr, |
778 | .suspend = genphy_suspend, | 799 | .suspend = genphy_suspend, |
diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 70b08958763a..dc2da8770918 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c | |||
@@ -43,16 +43,25 @@ static int smsc_phy_ack_interrupt(struct phy_device *phydev) | |||
43 | 43 | ||
44 | static int smsc_phy_config_init(struct phy_device *phydev) | 44 | static int smsc_phy_config_init(struct phy_device *phydev) |
45 | { | 45 | { |
46 | int __maybe_unused len; | ||
47 | struct device *dev __maybe_unused = &phydev->dev; | ||
48 | struct device_node *of_node __maybe_unused = dev->of_node; | ||
46 | int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); | 49 | int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); |
50 | int enable_energy = 1; | ||
47 | 51 | ||
48 | if (rc < 0) | 52 | if (rc < 0) |
49 | return rc; | 53 | return rc; |
50 | 54 | ||
51 | /* Enable energy detect mode for this SMSC Transceivers */ | 55 | if (of_find_property(of_node, "smsc,disable-energy-detect", &len)) |
52 | rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS, | 56 | enable_energy = 0; |
53 | rc | MII_LAN83C185_EDPWRDOWN); | 57 | |
54 | if (rc < 0) | 58 | if (enable_energy) { |
55 | return rc; | 59 | /* Enable energy detect mode for this SMSC Transceivers */ |
60 | rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS, | ||
61 | rc | MII_LAN83C185_EDPWRDOWN); | ||
62 | if (rc < 0) | ||
63 | return rc; | ||
64 | } | ||
56 | 65 | ||
57 | return smsc_phy_ack_interrupt(phydev); | 66 | return smsc_phy_ack_interrupt(phydev); |
58 | } | 67 | } |
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c index 2ed75060da50..5e0b43283bce 100644 --- a/drivers/net/ppp/pppoe.c +++ b/drivers/net/ppp/pppoe.c | |||
@@ -589,7 +589,7 @@ static int pppoe_release(struct socket *sock) | |||
589 | 589 | ||
590 | po = pppox_sk(sk); | 590 | po = pppox_sk(sk); |
591 | 591 | ||
592 | if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) { | 592 | if (po->pppoe_dev) { |
593 | dev_put(po->pppoe_dev); | 593 | dev_put(po->pppoe_dev); |
594 | po->pppoe_dev = NULL; | 594 | po->pppoe_dev = NULL; |
595 | } | 595 | } |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 4752e69de00e..75ae756e93cf 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -711,6 +711,10 @@ static const struct usb_device_id products[] = { | |||
711 | {QMI_FIXED_INTF(0x1199, 0x9056, 8)}, /* Sierra Wireless Modem */ | 711 | {QMI_FIXED_INTF(0x1199, 0x9056, 8)}, /* Sierra Wireless Modem */ |
712 | {QMI_FIXED_INTF(0x1199, 0x9057, 8)}, | 712 | {QMI_FIXED_INTF(0x1199, 0x9057, 8)}, |
713 | {QMI_FIXED_INTF(0x1199, 0x9061, 8)}, /* Sierra Wireless Modem */ | 713 | {QMI_FIXED_INTF(0x1199, 0x9061, 8)}, /* Sierra Wireless Modem */ |
714 | {QMI_FIXED_INTF(0x1199, 0x9070, 8)}, /* Sierra Wireless MC74xx/EM74xx */ | ||
715 | {QMI_FIXED_INTF(0x1199, 0x9070, 10)}, /* Sierra Wireless MC74xx/EM74xx */ | ||
716 | {QMI_FIXED_INTF(0x1199, 0x9071, 8)}, /* Sierra Wireless MC74xx/EM74xx */ | ||
717 | {QMI_FIXED_INTF(0x1199, 0x9071, 10)}, /* Sierra Wireless MC74xx/EM74xx */ | ||
714 | {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ | 718 | {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ |
715 | {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */ | 719 | {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */ |
716 | {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ | 720 | {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index cf262ccf5047..6369a5734d4c 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -2360,6 +2360,46 @@ static int vxlan_change_mtu(struct net_device *dev, int new_mtu) | |||
2360 | return 0; | 2360 | return 0; |
2361 | } | 2361 | } |
2362 | 2362 | ||
2363 | static int egress_ipv4_tun_info(struct net_device *dev, struct sk_buff *skb, | ||
2364 | struct ip_tunnel_info *info, | ||
2365 | __be16 sport, __be16 dport) | ||
2366 | { | ||
2367 | struct vxlan_dev *vxlan = netdev_priv(dev); | ||
2368 | struct rtable *rt; | ||
2369 | struct flowi4 fl4; | ||
2370 | |||
2371 | memset(&fl4, 0, sizeof(fl4)); | ||
2372 | fl4.flowi4_tos = RT_TOS(info->key.tos); | ||
2373 | fl4.flowi4_mark = skb->mark; | ||
2374 | fl4.flowi4_proto = IPPROTO_UDP; | ||
2375 | fl4.daddr = info->key.u.ipv4.dst; | ||
2376 | |||
2377 | rt = ip_route_output_key(vxlan->net, &fl4); | ||
2378 | if (IS_ERR(rt)) | ||
2379 | return PTR_ERR(rt); | ||
2380 | ip_rt_put(rt); | ||
2381 | |||
2382 | info->key.u.ipv4.src = fl4.saddr; | ||
2383 | info->key.tp_src = sport; | ||
2384 | info->key.tp_dst = dport; | ||
2385 | return 0; | ||
2386 | } | ||
2387 | |||
2388 | static int vxlan_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb) | ||
2389 | { | ||
2390 | struct vxlan_dev *vxlan = netdev_priv(dev); | ||
2391 | struct ip_tunnel_info *info = skb_tunnel_info(skb); | ||
2392 | __be16 sport, dport; | ||
2393 | |||
2394 | sport = udp_flow_src_port(dev_net(dev), skb, vxlan->cfg.port_min, | ||
2395 | vxlan->cfg.port_max, true); | ||
2396 | dport = info->key.tp_dst ? : vxlan->cfg.dst_port; | ||
2397 | |||
2398 | if (ip_tunnel_info_af(info) == AF_INET) | ||
2399 | return egress_ipv4_tun_info(dev, skb, info, sport, dport); | ||
2400 | return -EINVAL; | ||
2401 | } | ||
2402 | |||
2363 | static const struct net_device_ops vxlan_netdev_ops = { | 2403 | static const struct net_device_ops vxlan_netdev_ops = { |
2364 | .ndo_init = vxlan_init, | 2404 | .ndo_init = vxlan_init, |
2365 | .ndo_uninit = vxlan_uninit, | 2405 | .ndo_uninit = vxlan_uninit, |
@@ -2374,6 +2414,7 @@ static const struct net_device_ops vxlan_netdev_ops = { | |||
2374 | .ndo_fdb_add = vxlan_fdb_add, | 2414 | .ndo_fdb_add = vxlan_fdb_add, |
2375 | .ndo_fdb_del = vxlan_fdb_delete, | 2415 | .ndo_fdb_del = vxlan_fdb_delete, |
2376 | .ndo_fdb_dump = vxlan_fdb_dump, | 2416 | .ndo_fdb_dump = vxlan_fdb_dump, |
2417 | .ndo_fill_metadata_dst = vxlan_fill_metadata_dst, | ||
2377 | }; | 2418 | }; |
2378 | 2419 | ||
2379 | /* Info for udev, that this is a virtual tunnel endpoint */ | 2420 | /* Info for udev, that this is a virtual tunnel endpoint */ |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 9bf63c27a9b7..441b158d04f7 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
@@ -1706,19 +1706,19 @@ static void xennet_destroy_queues(struct netfront_info *info) | |||
1706 | } | 1706 | } |
1707 | 1707 | ||
1708 | static int xennet_create_queues(struct netfront_info *info, | 1708 | static int xennet_create_queues(struct netfront_info *info, |
1709 | unsigned int num_queues) | 1709 | unsigned int *num_queues) |
1710 | { | 1710 | { |
1711 | unsigned int i; | 1711 | unsigned int i; |
1712 | int ret; | 1712 | int ret; |
1713 | 1713 | ||
1714 | info->queues = kcalloc(num_queues, sizeof(struct netfront_queue), | 1714 | info->queues = kcalloc(*num_queues, sizeof(struct netfront_queue), |
1715 | GFP_KERNEL); | 1715 | GFP_KERNEL); |
1716 | if (!info->queues) | 1716 | if (!info->queues) |
1717 | return -ENOMEM; | 1717 | return -ENOMEM; |
1718 | 1718 | ||
1719 | rtnl_lock(); | 1719 | rtnl_lock(); |
1720 | 1720 | ||
1721 | for (i = 0; i < num_queues; i++) { | 1721 | for (i = 0; i < *num_queues; i++) { |
1722 | struct netfront_queue *queue = &info->queues[i]; | 1722 | struct netfront_queue *queue = &info->queues[i]; |
1723 | 1723 | ||
1724 | queue->id = i; | 1724 | queue->id = i; |
@@ -1728,7 +1728,7 @@ static int xennet_create_queues(struct netfront_info *info, | |||
1728 | if (ret < 0) { | 1728 | if (ret < 0) { |
1729 | dev_warn(&info->netdev->dev, | 1729 | dev_warn(&info->netdev->dev, |
1730 | "only created %d queues\n", i); | 1730 | "only created %d queues\n", i); |
1731 | num_queues = i; | 1731 | *num_queues = i; |
1732 | break; | 1732 | break; |
1733 | } | 1733 | } |
1734 | 1734 | ||
@@ -1738,11 +1738,11 @@ static int xennet_create_queues(struct netfront_info *info, | |||
1738 | napi_enable(&queue->napi); | 1738 | napi_enable(&queue->napi); |
1739 | } | 1739 | } |
1740 | 1740 | ||
1741 | netif_set_real_num_tx_queues(info->netdev, num_queues); | 1741 | netif_set_real_num_tx_queues(info->netdev, *num_queues); |
1742 | 1742 | ||
1743 | rtnl_unlock(); | 1743 | rtnl_unlock(); |
1744 | 1744 | ||
1745 | if (num_queues == 0) { | 1745 | if (*num_queues == 0) { |
1746 | dev_err(&info->netdev->dev, "no queues\n"); | 1746 | dev_err(&info->netdev->dev, "no queues\n"); |
1747 | return -EINVAL; | 1747 | return -EINVAL; |
1748 | } | 1748 | } |
@@ -1788,7 +1788,7 @@ static int talk_to_netback(struct xenbus_device *dev, | |||
1788 | if (info->queues) | 1788 | if (info->queues) |
1789 | xennet_destroy_queues(info); | 1789 | xennet_destroy_queues(info); |
1790 | 1790 | ||
1791 | err = xennet_create_queues(info, num_queues); | 1791 | err = xennet_create_queues(info, &num_queues); |
1792 | if (err < 0) | 1792 | if (err < 0) |
1793 | goto destroy_ring; | 1793 | goto destroy_ring; |
1794 | 1794 | ||