aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-01-04 17:14:53 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-04 17:14:53 -0500
commit4cf184638bcf2bdd1bcbc661f4717b648ad4ce40 (patch)
tree9988d04b6d1864a87694f82b75a8d37911561ac3
parent62f8c40592172a9c3bc2658e63e6e76ba00b3b45 (diff)
parent71eae1ca77fd6be218d8a952d97bba827e56516d (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) stmmac_drv_probe() can race with stmmac_open() because we register the netdevice too early. Fix from Florian Fainelli. 2) UFO handling in __ip6_append_data() and ip6_finish_output() use different tests for deciding whether a frame will be fragmented or not, put them in sync. Fix from Zheng Li. 3) The rtnetlink getstats handlers need to validate that the netlink request is large enough, fix from Mathias Krause. 4) Use after free in mlx4 driver, from Jack Morgenstein. 5) Fix setting of garbage UID value in sockets during setattr() calls, from Eric Biggers. 6) Packet drop_monitor doesn't format the netlink messages properly such that nlmsg_next fails to work, fix from Reiter Wolfgang. 7) Fix handling of wildcard addresses in l2tp lookups, from Guillaume Nault. 8) __skb_flow_dissect() can crash on pptp packets, from Ian Kumlien. 9) IGMP code doesn't reset group query timers properly, from Michal Tesar. 10) Fix overzealous MAIN/LOCAL route table combining in ipv4, from Alexander Duyck. 11) vxlan offload check needs to be more strict in be2net driver, from Sabrina Dubroca. 12) Moving l3mdev to packet hooks lost RX stat counters unintentionally, fix from David Ahern. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (52 commits) sh_eth: enable RX descriptor word 0 shift on SH7734 sfc: don't report RX hash keys to ethtool when RSS wasn't enabled dpaa_eth: Initialize CGR structure before init dpaa_eth: cleanup after init_phy() failure net: systemport: Pad packet before inserting TSB net: systemport: Utilize skb_put_padto() LiquidIO VF: s/select/imply/ for PTP_1588_CLOCK libcxgb: fix error check for ip6_route_output() net: usb: asix_devices: add .reset_resume for USB PM net: vrf: Add missing Rx counters drop_monitor: consider inserted data in genlmsg_end benet: stricter vxlan offloading check in be_features_check ipv4: Do not allow MAIN to be alias for new LOCAL w/ custom rules net: macb: Updated resource allocation function calls to new version of API. net: stmmac: dwmac-oxnas: use generic pm implementation net: stmmac: dwmac-oxnas: fix fixed-link-phydev leaks net: stmmac: dwmac-oxnas: fix of-node leak Documentation/networking: fix typo in mpls-sysctl igmp: Make igmp group member RFC 3376 compliant flow_dissector: Update pptp handling to avoid null pointer deref. ...
-rw-r--r--Documentation/networking/mpls-sysctl.txt4
-rw-r--r--drivers/infiniband/hw/mlx4/main.c14
-rw-r--r--drivers/net/ethernet/broadcom/bcmsysport.c23
-rw-r--r--drivers/net/ethernet/cadence/macb_pci.c27
-rw-r--r--drivers/net/ethernet/cavium/Kconfig2
-rw-r--r--drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c12
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c4
-rw-r--r--drivers/net/ethernet/freescale/dpaa/dpaa_eth.c6
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_clock.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_rx.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/icm.c7
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c18
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/resource_tracker.c28
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c3
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c17
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_main.c51
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_stats.h32
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/eswitch.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c11
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/fs_core.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/main.c15
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c3
-rw-r--r--drivers/net/ethernet/sfc/ef10.c3
-rw-r--r--drivers/net/ethernet/sfc/ethtool.c2
-rw-r--r--drivers/net/ethernet/sfc/net_driver.h2
-rw-r--r--drivers/net/ethernet/sfc/siena.c1
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c89
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c23
-rw-r--r--drivers/net/usb/asix_devices.c1
-rw-r--r--drivers/net/vrf.c3
-rw-r--r--drivers/net/wan/slic_ds26522.c2
-rw-r--r--include/linux/mlx4/device.h2
-rw-r--r--include/linux/mlx5/device.h5
-rw-r--r--include/linux/mlx5/driver.h1
-rw-r--r--include/linux/mlx5/mlx5_ifc.h93
-rw-r--r--net/atm/lec.c2
-rw-r--r--net/core/drop_monitor.c39
-rw-r--r--net/core/flow_dissector.c5
-rw-r--r--net/core/rtnetlink.c6
-rw-r--r--net/ipv4/fib_frontend.c2
-rw-r--r--net/ipv4/igmp.c7
-rw-r--r--net/ipv4/ip_sockglue.c8
-rw-r--r--net/ipv4/route.c3
-rw-r--r--net/ipv6/ip6_output.c2
-rw-r--r--net/l2tp/l2tp_ip.c19
-rw-r--r--net/l2tp/l2tp_ip6.c24
-rw-r--r--net/mac80211/tx.c3
-rw-r--r--net/sched/cls_flower.c4
-rw-r--r--net/socket.c2
50 files changed, 273 insertions, 377 deletions
diff --git a/Documentation/networking/mpls-sysctl.txt b/Documentation/networking/mpls-sysctl.txt
index 9ed15f86c17c..15d8d16934fd 100644
--- a/Documentation/networking/mpls-sysctl.txt
+++ b/Documentation/networking/mpls-sysctl.txt
@@ -5,8 +5,8 @@ platform_labels - INTEGER
5 possible to configure forwarding for label values equal to or 5 possible to configure forwarding for label values equal to or
6 greater than the number of platform labels. 6 greater than the number of platform labels.
7 7
8 A dense utliziation of the entries in the platform label table 8 A dense utilization of the entries in the platform label table
9 is possible and expected aas the platform labels are locally 9 is possible and expected as the platform labels are locally
10 allocated. 10 allocated.
11 11
12 If the number of platform label table entries is set to 0 no 12 If the number of platform label table entries is set to 0 no
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index c8413fc120e6..7031a8dd4d14 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -1682,9 +1682,19 @@ static int __mlx4_ib_create_flow(struct ib_qp *qp, struct ib_flow_attr *flow_att
1682 size += ret; 1682 size += ret;
1683 } 1683 }
1684 1684
1685 if (mlx4_is_master(mdev->dev) && flow_type == MLX4_FS_REGULAR &&
1686 flow_attr->num_of_specs == 1) {
1687 struct _rule_hw *rule_header = (struct _rule_hw *)(ctrl + 1);
1688 enum ib_flow_spec_type header_spec =
1689 ((union ib_flow_spec *)(flow_attr + 1))->type;
1690
1691 if (header_spec == IB_FLOW_SPEC_ETH)
1692 mlx4_handle_eth_header_mcast_prio(ctrl, rule_header);
1693 }
1694
1685 ret = mlx4_cmd_imm(mdev->dev, mailbox->dma, reg_id, size >> 2, 0, 1695 ret = mlx4_cmd_imm(mdev->dev, mailbox->dma, reg_id, size >> 2, 0,
1686 MLX4_QP_FLOW_STEERING_ATTACH, MLX4_CMD_TIME_CLASS_A, 1696 MLX4_QP_FLOW_STEERING_ATTACH, MLX4_CMD_TIME_CLASS_A,
1687 MLX4_CMD_WRAPPED); 1697 MLX4_CMD_NATIVE);
1688 if (ret == -ENOMEM) 1698 if (ret == -ENOMEM)
1689 pr_err("mcg table is full. Fail to register network rule.\n"); 1699 pr_err("mcg table is full. Fail to register network rule.\n");
1690 else if (ret == -ENXIO) 1700 else if (ret == -ENXIO)
@@ -1701,7 +1711,7 @@ static int __mlx4_ib_destroy_flow(struct mlx4_dev *dev, u64 reg_id)
1701 int err; 1711 int err;
1702 err = mlx4_cmd(dev, reg_id, 0, 0, 1712 err = mlx4_cmd(dev, reg_id, 0, 0,
1703 MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A, 1713 MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A,
1704 MLX4_CMD_WRAPPED); 1714 MLX4_CMD_NATIVE);
1705 if (err) 1715 if (err)
1706 pr_err("Fail to detach network rule. registration id = 0x%llx\n", 1716 pr_err("Fail to detach network rule. registration id = 0x%llx\n",
1707 reg_id); 1717 reg_id);
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 25d1eb4933d0..7e8cf213fd81 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1012,15 +1012,6 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,
1012 goto out; 1012 goto out;
1013 } 1013 }
1014 1014
1015 /* Insert TSB and checksum infos */
1016 if (priv->tsb_en) {
1017 skb = bcm_sysport_insert_tsb(skb, dev);
1018 if (!skb) {
1019 ret = NETDEV_TX_OK;
1020 goto out;
1021 }
1022 }
1023
1024 /* The Ethernet switch we are interfaced with needs packets to be at 1015 /* The Ethernet switch we are interfaced with needs packets to be at
1025 * least 64 bytes (including FCS) otherwise they will be discarded when 1016 * least 64 bytes (including FCS) otherwise they will be discarded when
1026 * they enter the switch port logic. When Broadcom tags are enabled, we 1017 * they enter the switch port logic. When Broadcom tags are enabled, we
@@ -1028,13 +1019,21 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,
1028 * (including FCS and tag) because the length verification is done after 1019 * (including FCS and tag) because the length verification is done after
1029 * the Broadcom tag is stripped off the ingress packet. 1020 * the Broadcom tag is stripped off the ingress packet.
1030 */ 1021 */
1031 if (skb_padto(skb, ETH_ZLEN + ENET_BRCM_TAG_LEN)) { 1022 if (skb_put_padto(skb, ETH_ZLEN + ENET_BRCM_TAG_LEN)) {
1032 ret = NETDEV_TX_OK; 1023 ret = NETDEV_TX_OK;
1033 goto out; 1024 goto out;
1034 } 1025 }
1035 1026
1036 skb_len = skb->len < ETH_ZLEN + ENET_BRCM_TAG_LEN ? 1027 /* Insert TSB and checksum infos */
1037 ETH_ZLEN + ENET_BRCM_TAG_LEN : skb->len; 1028 if (priv->tsb_en) {
1029 skb = bcm_sysport_insert_tsb(skb, dev);
1030 if (!skb) {
1031 ret = NETDEV_TX_OK;
1032 goto out;
1033 }
1034 }
1035
1036 skb_len = skb->len;
1038 1037
1039 mapping = dma_map_single(kdev, skb->data, skb_len, DMA_TO_DEVICE); 1038 mapping = dma_map_single(kdev, skb->data, skb_len, DMA_TO_DEVICE);
1040 if (dma_mapping_error(kdev, mapping)) { 1039 if (dma_mapping_error(kdev, mapping)) {
diff --git a/drivers/net/ethernet/cadence/macb_pci.c b/drivers/net/ethernet/cadence/macb_pci.c
index 92be2cd8f817..9906fda76087 100644
--- a/drivers/net/ethernet/cadence/macb_pci.c
+++ b/drivers/net/ethernet/cadence/macb_pci.c
@@ -1,5 +1,5 @@
1/** 1/**
2 * macb_pci.c - Cadence GEM PCI wrapper. 2 * Cadence GEM PCI wrapper.
3 * 3 *
4 * Copyright (C) 2016 Cadence Design Systems - http://www.cadence.com 4 * Copyright (C) 2016 Cadence Design Systems - http://www.cadence.com
5 * 5 *
@@ -45,32 +45,27 @@ static int macb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
45 struct macb_platform_data plat_data; 45 struct macb_platform_data plat_data;
46 struct resource res[2]; 46 struct resource res[2];
47 47
48 /* sanity check */
49 if (!id)
50 return -EINVAL;
51
52 /* enable pci device */ 48 /* enable pci device */
53 err = pci_enable_device(pdev); 49 err = pcim_enable_device(pdev);
54 if (err < 0) { 50 if (err < 0) {
55 dev_err(&pdev->dev, "Enabling PCI device has failed: 0x%04X", 51 dev_err(&pdev->dev, "Enabling PCI device has failed: %d", err);
56 err); 52 return err;
57 return -EACCES;
58 } 53 }
59 54
60 pci_set_master(pdev); 55 pci_set_master(pdev);
61 56
62 /* set up resources */ 57 /* set up resources */
63 memset(res, 0x00, sizeof(struct resource) * ARRAY_SIZE(res)); 58 memset(res, 0x00, sizeof(struct resource) * ARRAY_SIZE(res));
64 res[0].start = pdev->resource[0].start; 59 res[0].start = pci_resource_start(pdev, 0);
65 res[0].end = pdev->resource[0].end; 60 res[0].end = pci_resource_end(pdev, 0);
66 res[0].name = PCI_DRIVER_NAME; 61 res[0].name = PCI_DRIVER_NAME;
67 res[0].flags = IORESOURCE_MEM; 62 res[0].flags = IORESOURCE_MEM;
68 res[1].start = pdev->irq; 63 res[1].start = pci_irq_vector(pdev, 0);
69 res[1].name = PCI_DRIVER_NAME; 64 res[1].name = PCI_DRIVER_NAME;
70 res[1].flags = IORESOURCE_IRQ; 65 res[1].flags = IORESOURCE_IRQ;
71 66
72 dev_info(&pdev->dev, "EMAC physical base addr = 0x%p\n", 67 dev_info(&pdev->dev, "EMAC physical base addr: %pa\n",
73 (void *)(uintptr_t)pci_resource_start(pdev, 0)); 68 &res[0].start);
74 69
75 /* set up macb platform data */ 70 /* set up macb platform data */
76 memset(&plat_data, 0, sizeof(plat_data)); 71 memset(&plat_data, 0, sizeof(plat_data));
@@ -100,7 +95,7 @@ static int macb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
100 plat_info.num_res = ARRAY_SIZE(res); 95 plat_info.num_res = ARRAY_SIZE(res);
101 plat_info.data = &plat_data; 96 plat_info.data = &plat_data;
102 plat_info.size_data = sizeof(plat_data); 97 plat_info.size_data = sizeof(plat_data);
103 plat_info.dma_mask = DMA_BIT_MASK(32); 98 plat_info.dma_mask = pdev->dma_mask;
104 99
105 /* register platform device */ 100 /* register platform device */
106 plat_dev = platform_device_register_full(&plat_info); 101 plat_dev = platform_device_register_full(&plat_info);
@@ -120,7 +115,6 @@ err_hclk_register:
120 clk_unregister(plat_data.pclk); 115 clk_unregister(plat_data.pclk);
121 116
122err_pclk_register: 117err_pclk_register:
123 pci_disable_device(pdev);
124 return err; 118 return err;
125} 119}
126 120
@@ -130,7 +124,6 @@ static void macb_remove(struct pci_dev *pdev)
130 struct macb_platform_data *plat_data = dev_get_platdata(&plat_dev->dev); 124 struct macb_platform_data *plat_data = dev_get_platdata(&plat_dev->dev);
131 125
132 platform_device_unregister(plat_dev); 126 platform_device_unregister(plat_dev);
133 pci_disable_device(pdev);
134 clk_unregister(plat_data->pclk); 127 clk_unregister(plat_data->pclk);
135 clk_unregister(plat_data->hclk); 128 clk_unregister(plat_data->hclk);
136} 129}
diff --git a/drivers/net/ethernet/cavium/Kconfig b/drivers/net/ethernet/cavium/Kconfig
index bbc8bd16cb97..dcbce6cac63e 100644
--- a/drivers/net/ethernet/cavium/Kconfig
+++ b/drivers/net/ethernet/cavium/Kconfig
@@ -77,7 +77,7 @@ config OCTEON_MGMT_ETHERNET
77config LIQUIDIO_VF 77config LIQUIDIO_VF
78 tristate "Cavium LiquidIO VF support" 78 tristate "Cavium LiquidIO VF support"
79 depends on 64BIT && PCI_MSI 79 depends on 64BIT && PCI_MSI
80 select PTP_1588_CLOCK 80 imply PTP_1588_CLOCK
81 ---help--- 81 ---help---
82 This driver supports Cavium LiquidIO Intelligent Server Adapter 82 This driver supports Cavium LiquidIO Intelligent Server Adapter
83 based on CN23XX chips. 83 based on CN23XX chips.
diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c
index 0f0de5b63622..d04a6c163445 100644
--- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c
+++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c
@@ -133,17 +133,15 @@ cxgb_find_route6(struct cxgb4_lld_info *lldi,
133 if (ipv6_addr_type(&fl6.daddr) & IPV6_ADDR_LINKLOCAL) 133 if (ipv6_addr_type(&fl6.daddr) & IPV6_ADDR_LINKLOCAL)
134 fl6.flowi6_oif = sin6_scope_id; 134 fl6.flowi6_oif = sin6_scope_id;
135 dst = ip6_route_output(&init_net, NULL, &fl6); 135 dst = ip6_route_output(&init_net, NULL, &fl6);
136 if (!dst) 136 if (dst->error ||
137 goto out; 137 (!cxgb_our_interface(lldi, get_real_dev,
138 if (!cxgb_our_interface(lldi, get_real_dev, 138 ip6_dst_idev(dst)->dev) &&
139 ip6_dst_idev(dst)->dev) && 139 !(ip6_dst_idev(dst)->dev->flags & IFF_LOOPBACK))) {
140 !(ip6_dst_idev(dst)->dev->flags & IFF_LOOPBACK)) {
141 dst_release(dst); 140 dst_release(dst);
142 dst = NULL; 141 return NULL;
143 } 142 }
144 } 143 }
145 144
146out:
147 return dst; 145 return dst;
148} 146}
149EXPORT_SYMBOL(cxgb_find_route6); 147EXPORT_SYMBOL(cxgb_find_route6);
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 7e1633bf5a22..225e9a4877d7 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -5155,7 +5155,9 @@ static netdev_features_t be_features_check(struct sk_buff *skb,
5155 skb->inner_protocol_type != ENCAP_TYPE_ETHER || 5155 skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
5156 skb->inner_protocol != htons(ETH_P_TEB) || 5156 skb->inner_protocol != htons(ETH_P_TEB) ||
5157 skb_inner_mac_header(skb) - skb_transport_header(skb) != 5157 skb_inner_mac_header(skb) - skb_transport_header(skb) !=
5158 sizeof(struct udphdr) + sizeof(struct vxlanhdr)) 5158 sizeof(struct udphdr) + sizeof(struct vxlanhdr) ||
5159 !adapter->vxlan_port ||
5160 udp_hdr(skb)->dest != adapter->vxlan_port)
5159 return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); 5161 return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
5160 5162
5161 return features; 5163 return features;
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 624ba9058dc4..c9b7ad65e563 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -733,6 +733,7 @@ static int dpaa_eth_cgr_init(struct dpaa_priv *priv)
733 priv->cgr_data.cgr.cb = dpaa_eth_cgscn; 733 priv->cgr_data.cgr.cb = dpaa_eth_cgscn;
734 734
735 /* Enable Congestion State Change Notifications and CS taildrop */ 735 /* Enable Congestion State Change Notifications and CS taildrop */
736 memset(&initcgr, 0, sizeof(initcgr));
736 initcgr.we_mask = cpu_to_be16(QM_CGR_WE_CSCN_EN | QM_CGR_WE_CS_THRES); 737 initcgr.we_mask = cpu_to_be16(QM_CGR_WE_CSCN_EN | QM_CGR_WE_CS_THRES);
737 initcgr.cgr.cscn_en = QM_CGR_EN; 738 initcgr.cgr.cscn_en = QM_CGR_EN;
738 739
@@ -2291,7 +2292,8 @@ static int dpaa_open(struct net_device *net_dev)
2291 net_dev->phydev = mac_dev->init_phy(net_dev, priv->mac_dev); 2292 net_dev->phydev = mac_dev->init_phy(net_dev, priv->mac_dev);
2292 if (!net_dev->phydev) { 2293 if (!net_dev->phydev) {
2293 netif_err(priv, ifup, net_dev, "init_phy() failed\n"); 2294 netif_err(priv, ifup, net_dev, "init_phy() failed\n");
2294 return -ENODEV; 2295 err = -ENODEV;
2296 goto phy_init_failed;
2295 } 2297 }
2296 2298
2297 for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) { 2299 for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) {
@@ -2314,6 +2316,7 @@ mac_start_failed:
2314 for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) 2316 for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++)
2315 fman_port_disable(mac_dev->port[i]); 2317 fman_port_disable(mac_dev->port[i]);
2316 2318
2319phy_init_failed:
2317 dpaa_eth_napi_disable(priv); 2320 dpaa_eth_napi_disable(priv);
2318 2321
2319 return err; 2322 return err;
@@ -2420,6 +2423,7 @@ static int dpaa_ingress_cgr_init(struct dpaa_priv *priv)
2420 } 2423 }
2421 2424
2422 /* Enable CS TD, but disable Congestion State Change Notifications. */ 2425 /* Enable CS TD, but disable Congestion State Change Notifications. */
2426 memset(&initcgr, 0, sizeof(initcgr));
2423 initcgr.we_mask = cpu_to_be16(QM_CGR_WE_CS_THRES); 2427 initcgr.we_mask = cpu_to_be16(QM_CGR_WE_CS_THRES);
2424 initcgr.cgr.cscn_en = QM_CGR_EN; 2428 initcgr.cgr.cscn_en = QM_CGR_EN;
2425 cs_th = DPAA_INGRESS_CS_THRESHOLD; 2429 cs_th = DPAA_INGRESS_CS_THRESHOLD;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_clock.c b/drivers/net/ethernet/mellanox/mlx4/en_clock.c
index 015198c14fa8..504461a464c5 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_clock.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_clock.c
@@ -245,13 +245,9 @@ static u32 freq_to_shift(u16 freq)
245{ 245{
246 u32 freq_khz = freq * 1000; 246 u32 freq_khz = freq * 1000;
247 u64 max_val_cycles = freq_khz * 1000 * MLX4_EN_WRAP_AROUND_SEC; 247 u64 max_val_cycles = freq_khz * 1000 * MLX4_EN_WRAP_AROUND_SEC;
248 u64 tmp_rounded = 248 u64 max_val_cycles_rounded = 1ULL << fls64(max_val_cycles - 1);
249 roundup_pow_of_two(max_val_cycles) > max_val_cycles ?
250 roundup_pow_of_two(max_val_cycles) - 1 : UINT_MAX;
251 u64 max_val_cycles_rounded = is_power_of_2(max_val_cycles + 1) ?
252 max_val_cycles : tmp_rounded;
253 /* calculate max possible multiplier in order to fit in 64bit */ 249 /* calculate max possible multiplier in order to fit in 64bit */
254 u64 max_mul = div_u64(0xffffffffffffffffULL, max_val_cycles_rounded); 250 u64 max_mul = div64_u64(ULLONG_MAX, max_val_cycles_rounded);
255 251
256 /* This comes from the reverse of clocksource_khz2mult */ 252 /* This comes from the reverse of clocksource_khz2mult */
257 return ilog2(div_u64(max_mul * freq_khz, 1000000)); 253 return ilog2(div_u64(max_mul * freq_khz, 1000000));
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index 3c37e216bbf3..eac527e25ec9 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -445,8 +445,14 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv)
445 ring->cqn = priv->rx_cq[ring_ind]->mcq.cqn; 445 ring->cqn = priv->rx_cq[ring_ind]->mcq.cqn;
446 446
447 ring->stride = stride; 447 ring->stride = stride;
448 if (ring->stride <= TXBB_SIZE) 448 if (ring->stride <= TXBB_SIZE) {
449 /* Stamp first unused send wqe */
450 __be32 *ptr = (__be32 *)ring->buf;
451 __be32 stamp = cpu_to_be32(1 << STAMP_SHIFT);
452 *ptr = stamp;
453 /* Move pointer to start of rx section */
449 ring->buf += TXBB_SIZE; 454 ring->buf += TXBB_SIZE;
455 }
450 456
451 ring->log_stride = ffs(ring->stride) - 1; 457 ring->log_stride = ffs(ring->stride) - 1;
452 ring->buf_size = ring->size * ring->stride; 458 ring->buf_size = ring->size * ring->stride;
diff --git a/drivers/net/ethernet/mellanox/mlx4/icm.c b/drivers/net/ethernet/mellanox/mlx4/icm.c
index 2a9dd460a95f..e1f9e7cebf8f 100644
--- a/drivers/net/ethernet/mellanox/mlx4/icm.c
+++ b/drivers/net/ethernet/mellanox/mlx4/icm.c
@@ -118,8 +118,13 @@ static int mlx4_alloc_icm_coherent(struct device *dev, struct scatterlist *mem,
118 if (!buf) 118 if (!buf)
119 return -ENOMEM; 119 return -ENOMEM;
120 120
121 if (offset_in_page(buf)) {
122 dma_free_coherent(dev, PAGE_SIZE << order,
123 buf, sg_dma_address(mem));
124 return -ENOMEM;
125 }
126
121 sg_set_buf(mem, buf, PAGE_SIZE << order); 127 sg_set_buf(mem, buf, PAGE_SIZE << order);
122 BUG_ON(mem->offset);
123 sg_dma_len(mem) = PAGE_SIZE << order; 128 sg_dma_len(mem) = PAGE_SIZE << order;
124 return 0; 129 return 0;
125} 130}
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 5e7840a7a33b..bffa6f345f2f 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -42,6 +42,7 @@
42#include <linux/io-mapping.h> 42#include <linux/io-mapping.h>
43#include <linux/delay.h> 43#include <linux/delay.h>
44#include <linux/kmod.h> 44#include <linux/kmod.h>
45#include <linux/etherdevice.h>
45#include <net/devlink.h> 46#include <net/devlink.h>
46 47
47#include <linux/mlx4/device.h> 48#include <linux/mlx4/device.h>
@@ -782,6 +783,23 @@ int mlx4_is_slave_active(struct mlx4_dev *dev, int slave)
782} 783}
783EXPORT_SYMBOL(mlx4_is_slave_active); 784EXPORT_SYMBOL(mlx4_is_slave_active);
784 785
786void mlx4_handle_eth_header_mcast_prio(struct mlx4_net_trans_rule_hw_ctrl *ctrl,
787 struct _rule_hw *eth_header)
788{
789 if (is_multicast_ether_addr(eth_header->eth.dst_mac) ||
790 is_broadcast_ether_addr(eth_header->eth.dst_mac)) {
791 struct mlx4_net_trans_rule_hw_eth *eth =
792 (struct mlx4_net_trans_rule_hw_eth *)eth_header;
793 struct _rule_hw *next_rule = (struct _rule_hw *)(eth + 1);
794 bool last_rule = next_rule->size == 0 && next_rule->id == 0 &&
795 next_rule->rsvd == 0;
796
797 if (last_rule)
798 ctrl->prio = cpu_to_be16(MLX4_DOMAIN_NIC);
799 }
800}
801EXPORT_SYMBOL(mlx4_handle_eth_header_mcast_prio);
802
785static void slave_adjust_steering_mode(struct mlx4_dev *dev, 803static void slave_adjust_steering_mode(struct mlx4_dev *dev,
786 struct mlx4_dev_cap *dev_cap, 804 struct mlx4_dev_cap *dev_cap,
787 struct mlx4_init_hca_param *hca_param) 805 struct mlx4_init_hca_param *hca_param)
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index c548beaaf910..56185a0b827d 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -4164,22 +4164,6 @@ static int validate_eth_header_mac(int slave, struct _rule_hw *eth_header,
4164 return 0; 4164 return 0;
4165} 4165}
4166 4166
4167static void handle_eth_header_mcast_prio(struct mlx4_net_trans_rule_hw_ctrl *ctrl,
4168 struct _rule_hw *eth_header)
4169{
4170 if (is_multicast_ether_addr(eth_header->eth.dst_mac) ||
4171 is_broadcast_ether_addr(eth_header->eth.dst_mac)) {
4172 struct mlx4_net_trans_rule_hw_eth *eth =
4173 (struct mlx4_net_trans_rule_hw_eth *)eth_header;
4174 struct _rule_hw *next_rule = (struct _rule_hw *)(eth + 1);
4175 bool last_rule = next_rule->size == 0 && next_rule->id == 0 &&
4176 next_rule->rsvd == 0;
4177
4178 if (last_rule)
4179 ctrl->prio = cpu_to_be16(MLX4_DOMAIN_NIC);
4180 }
4181}
4182
4183/* 4167/*
4184 * In case of missing eth header, append eth header with a MAC address 4168 * In case of missing eth header, append eth header with a MAC address
4185 * assigned to the VF. 4169 * assigned to the VF.
@@ -4363,10 +4347,7 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
4363 header_id = map_hw_to_sw_id(be16_to_cpu(rule_header->id)); 4347 header_id = map_hw_to_sw_id(be16_to_cpu(rule_header->id));
4364 4348
4365 if (header_id == MLX4_NET_TRANS_RULE_ID_ETH) 4349 if (header_id == MLX4_NET_TRANS_RULE_ID_ETH)
4366 handle_eth_header_mcast_prio(ctrl, rule_header); 4350 mlx4_handle_eth_header_mcast_prio(ctrl, rule_header);
4367
4368 if (slave == dev->caps.function)
4369 goto execute;
4370 4351
4371 switch (header_id) { 4352 switch (header_id) {
4372 case MLX4_NET_TRANS_RULE_ID_ETH: 4353 case MLX4_NET_TRANS_RULE_ID_ETH:
@@ -4394,7 +4375,6 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
4394 goto err_put_qp; 4375 goto err_put_qp;
4395 } 4376 }
4396 4377
4397execute:
4398 err = mlx4_cmd_imm(dev, inbox->dma, &vhcr->out_param, 4378 err = mlx4_cmd_imm(dev, inbox->dma, &vhcr->out_param,
4399 vhcr->in_modifier, 0, 4379 vhcr->in_modifier, 0,
4400 MLX4_QP_FLOW_STEERING_ATTACH, MLX4_CMD_TIME_CLASS_A, 4380 MLX4_QP_FLOW_STEERING_ATTACH, MLX4_CMD_TIME_CLASS_A,
@@ -4473,6 +4453,7 @@ int mlx4_QP_FLOW_STEERING_DETACH_wrapper(struct mlx4_dev *dev, int slave,
4473 struct res_qp *rqp; 4453 struct res_qp *rqp;
4474 struct res_fs_rule *rrule; 4454 struct res_fs_rule *rrule;
4475 u64 mirr_reg_id; 4455 u64 mirr_reg_id;
4456 int qpn;
4476 4457
4477 if (dev->caps.steering_mode != 4458 if (dev->caps.steering_mode !=
4478 MLX4_STEERING_MODE_DEVICE_MANAGED) 4459 MLX4_STEERING_MODE_DEVICE_MANAGED)
@@ -4489,10 +4470,11 @@ int mlx4_QP_FLOW_STEERING_DETACH_wrapper(struct mlx4_dev *dev, int slave,
4489 } 4470 }
4490 mirr_reg_id = rrule->mirr_rule_id; 4471 mirr_reg_id = rrule->mirr_rule_id;
4491 kfree(rrule->mirr_mbox); 4472 kfree(rrule->mirr_mbox);
4473 qpn = rrule->qpn;
4492 4474
4493 /* Release the rule form busy state before removal */ 4475 /* Release the rule form busy state before removal */
4494 put_res(dev, slave, vhcr->in_param, RES_FS_RULE); 4476 put_res(dev, slave, vhcr->in_param, RES_FS_RULE);
4495 err = get_res(dev, slave, rrule->qpn, RES_QP, &rqp); 4477 err = get_res(dev, slave, qpn, RES_QP, &rqp);
4496 if (err) 4478 if (err)
4497 return err; 4479 return err;
4498 4480
@@ -4517,7 +4499,7 @@ int mlx4_QP_FLOW_STEERING_DETACH_wrapper(struct mlx4_dev *dev, int slave,
4517 if (!err) 4499 if (!err)
4518 atomic_dec(&rqp->ref_count); 4500 atomic_dec(&rqp->ref_count);
4519out: 4501out:
4520 put_res(dev, slave, rrule->qpn, RES_QP); 4502 put_res(dev, slave, qpn, RES_QP);
4521 return err; 4503 return err;
4522} 4504}
4523 4505
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
index 7f6c225666c1..f0b460f47f29 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
@@ -723,6 +723,9 @@ static void mlx5e_ets_init(struct mlx5e_priv *priv)
723 int i; 723 int i;
724 struct ieee_ets ets; 724 struct ieee_ets ets;
725 725
726 if (!MLX5_CAP_GEN(priv->mdev, ets))
727 return;
728
726 memset(&ets, 0, sizeof(ets)); 729 memset(&ets, 0, sizeof(ets));
727 ets.ets_cap = mlx5_max_tc(priv->mdev) + 1; 730 ets.ets_cap = mlx5_max_tc(priv->mdev) + 1;
728 for (i = 0; i < ets.ets_cap; i++) { 731 for (i = 0; i < ets.ets_cap; i++) {
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index 352462af8d51..33a399a8b5d5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -171,7 +171,6 @@ static int mlx5e_get_sset_count(struct net_device *dev, int sset)
171 return NUM_SW_COUNTERS + 171 return NUM_SW_COUNTERS +
172 MLX5E_NUM_Q_CNTRS(priv) + 172 MLX5E_NUM_Q_CNTRS(priv) +
173 NUM_VPORT_COUNTERS + NUM_PPORT_COUNTERS + 173 NUM_VPORT_COUNTERS + NUM_PPORT_COUNTERS +
174 NUM_PCIE_COUNTERS +
175 MLX5E_NUM_RQ_STATS(priv) + 174 MLX5E_NUM_RQ_STATS(priv) +
176 MLX5E_NUM_SQ_STATS(priv) + 175 MLX5E_NUM_SQ_STATS(priv) +
177 MLX5E_NUM_PFC_COUNTERS(priv) + 176 MLX5E_NUM_PFC_COUNTERS(priv) +
@@ -219,14 +218,6 @@ static void mlx5e_fill_stats_strings(struct mlx5e_priv *priv, uint8_t *data)
219 strcpy(data + (idx++) * ETH_GSTRING_LEN, 218 strcpy(data + (idx++) * ETH_GSTRING_LEN,
220 pport_2819_stats_desc[i].format); 219 pport_2819_stats_desc[i].format);
221 220
222 for (i = 0; i < NUM_PCIE_PERF_COUNTERS; i++)
223 strcpy(data + (idx++) * ETH_GSTRING_LEN,
224 pcie_perf_stats_desc[i].format);
225
226 for (i = 0; i < NUM_PCIE_TAS_COUNTERS; i++)
227 strcpy(data + (idx++) * ETH_GSTRING_LEN,
228 pcie_tas_stats_desc[i].format);
229
230 for (prio = 0; prio < NUM_PPORT_PRIO; prio++) { 221 for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
231 for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++) 222 for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++)
232 sprintf(data + (idx++) * ETH_GSTRING_LEN, 223 sprintf(data + (idx++) * ETH_GSTRING_LEN,
@@ -339,14 +330,6 @@ static void mlx5e_get_ethtool_stats(struct net_device *dev,
339 data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.RFC_2819_counters, 330 data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.RFC_2819_counters,
340 pport_2819_stats_desc, i); 331 pport_2819_stats_desc, i);
341 332
342 for (i = 0; i < NUM_PCIE_PERF_COUNTERS; i++)
343 data[idx++] = MLX5E_READ_CTR32_BE(&priv->stats.pcie.pcie_perf_counters,
344 pcie_perf_stats_desc, i);
345
346 for (i = 0; i < NUM_PCIE_TAS_COUNTERS; i++)
347 data[idx++] = MLX5E_READ_CTR32_BE(&priv->stats.pcie.pcie_tas_counters,
348 pcie_tas_stats_desc, i);
349
350 for (prio = 0; prio < NUM_PPORT_PRIO; prio++) { 333 for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
351 for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++) 334 for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++)
352 data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[prio], 335 data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[prio],
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c
index 3691451c728c..d088effd7160 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c
@@ -247,6 +247,7 @@ static int set_flow_attrs(u32 *match_c, u32 *match_v,
247 } 247 }
248 if (fs->flow_type & FLOW_MAC_EXT && 248 if (fs->flow_type & FLOW_MAC_EXT &&
249 !is_zero_ether_addr(fs->m_ext.h_dest)) { 249 !is_zero_ether_addr(fs->m_ext.h_dest)) {
250 mask_spec(fs->m_ext.h_dest, fs->h_ext.h_dest, ETH_ALEN);
250 ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, 251 ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4,
251 outer_headers_c, dmac_47_16), 252 outer_headers_c, dmac_47_16),
252 fs->m_ext.h_dest); 253 fs->m_ext.h_dest);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index cbfa38fc72c0..1236b27b1493 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -291,36 +291,12 @@ static void mlx5e_update_q_counter(struct mlx5e_priv *priv)
291 &qcnt->rx_out_of_buffer); 291 &qcnt->rx_out_of_buffer);
292} 292}
293 293
294static void mlx5e_update_pcie_counters(struct mlx5e_priv *priv)
295{
296 struct mlx5e_pcie_stats *pcie_stats = &priv->stats.pcie;
297 struct mlx5_core_dev *mdev = priv->mdev;
298 int sz = MLX5_ST_SZ_BYTES(mpcnt_reg);
299 void *out;
300 u32 *in;
301
302 in = mlx5_vzalloc(sz);
303 if (!in)
304 return;
305
306 out = pcie_stats->pcie_perf_counters;
307 MLX5_SET(mpcnt_reg, in, grp, MLX5_PCIE_PERFORMANCE_COUNTERS_GROUP);
308 mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_MPCNT, 0, 0);
309
310 out = pcie_stats->pcie_tas_counters;
311 MLX5_SET(mpcnt_reg, in, grp, MLX5_PCIE_TIMERS_AND_STATES_COUNTERS_GROUP);
312 mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_MPCNT, 0, 0);
313
314 kvfree(in);
315}
316
317void mlx5e_update_stats(struct mlx5e_priv *priv) 294void mlx5e_update_stats(struct mlx5e_priv *priv)
318{ 295{
319 mlx5e_update_q_counter(priv); 296 mlx5e_update_q_counter(priv);
320 mlx5e_update_vport_counters(priv); 297 mlx5e_update_vport_counters(priv);
321 mlx5e_update_pport_counters(priv); 298 mlx5e_update_pport_counters(priv);
322 mlx5e_update_sw_counters(priv); 299 mlx5e_update_sw_counters(priv);
323 mlx5e_update_pcie_counters(priv);
324} 300}
325 301
326void mlx5e_update_stats_work(struct work_struct *work) 302void mlx5e_update_stats_work(struct work_struct *work)
@@ -3805,14 +3781,7 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
3805 3781
3806 mlx5_lag_add(mdev, netdev); 3782 mlx5_lag_add(mdev, netdev);
3807 3783
3808 if (mlx5e_vxlan_allowed(mdev)) {
3809 rtnl_lock();
3810 udp_tunnel_get_rx_info(netdev);
3811 rtnl_unlock();
3812 }
3813
3814 mlx5e_enable_async_events(priv); 3784 mlx5e_enable_async_events(priv);
3815 queue_work(priv->wq, &priv->set_rx_mode_work);
3816 3785
3817 if (MLX5_CAP_GEN(mdev, vport_group_manager)) { 3786 if (MLX5_CAP_GEN(mdev, vport_group_manager)) {
3818 mlx5_query_nic_vport_mac_address(mdev, 0, rep.hw_id); 3787 mlx5_query_nic_vport_mac_address(mdev, 0, rep.hw_id);
@@ -3822,6 +3791,18 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
3822 rep.netdev = netdev; 3791 rep.netdev = netdev;
3823 mlx5_eswitch_register_vport_rep(esw, 0, &rep); 3792 mlx5_eswitch_register_vport_rep(esw, 0, &rep);
3824 } 3793 }
3794
3795 if (netdev->reg_state != NETREG_REGISTERED)
3796 return;
3797
3798 /* Device already registered: sync netdev system state */
3799 if (mlx5e_vxlan_allowed(mdev)) {
3800 rtnl_lock();
3801 udp_tunnel_get_rx_info(netdev);
3802 rtnl_unlock();
3803 }
3804
3805 queue_work(priv->wq, &priv->set_rx_mode_work);
3825} 3806}
3826 3807
3827static void mlx5e_nic_disable(struct mlx5e_priv *priv) 3808static void mlx5e_nic_disable(struct mlx5e_priv *priv)
@@ -3966,10 +3947,6 @@ void mlx5e_detach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev)
3966 const struct mlx5e_profile *profile = priv->profile; 3947 const struct mlx5e_profile *profile = priv->profile;
3967 3948
3968 set_bit(MLX5E_STATE_DESTROYING, &priv->state); 3949 set_bit(MLX5E_STATE_DESTROYING, &priv->state);
3969 if (profile->disable)
3970 profile->disable(priv);
3971
3972 flush_workqueue(priv->wq);
3973 3950
3974 rtnl_lock(); 3951 rtnl_lock();
3975 if (netif_running(netdev)) 3952 if (netif_running(netdev))
@@ -3977,6 +3954,10 @@ void mlx5e_detach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev)
3977 netif_device_detach(netdev); 3954 netif_device_detach(netdev);
3978 rtnl_unlock(); 3955 rtnl_unlock();
3979 3956
3957 if (profile->disable)
3958 profile->disable(priv);
3959 flush_workqueue(priv->wq);
3960
3980 mlx5e_destroy_q_counter(priv); 3961 mlx5e_destroy_q_counter(priv);
3981 profile->cleanup_rx(priv); 3962 profile->cleanup_rx(priv);
3982 mlx5e_close_drop_rq(priv); 3963 mlx5e_close_drop_rq(priv);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
index f202f872f57f..ba5db1dd23a9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
@@ -39,7 +39,7 @@
39#define MLX5E_READ_CTR32_CPU(ptr, dsc, i) \ 39#define MLX5E_READ_CTR32_CPU(ptr, dsc, i) \
40 (*(u32 *)((char *)ptr + dsc[i].offset)) 40 (*(u32 *)((char *)ptr + dsc[i].offset))
41#define MLX5E_READ_CTR32_BE(ptr, dsc, i) \ 41#define MLX5E_READ_CTR32_BE(ptr, dsc, i) \
42 be32_to_cpu(*(__be32 *)((char *)ptr + dsc[i].offset)) 42 be64_to_cpu(*(__be32 *)((char *)ptr + dsc[i].offset))
43 43
44#define MLX5E_DECLARE_STAT(type, fld) #fld, offsetof(type, fld) 44#define MLX5E_DECLARE_STAT(type, fld) #fld, offsetof(type, fld)
45#define MLX5E_DECLARE_RX_STAT(type, fld) "rx%d_"#fld, offsetof(type, fld) 45#define MLX5E_DECLARE_RX_STAT(type, fld) "rx%d_"#fld, offsetof(type, fld)
@@ -276,32 +276,6 @@ static const struct counter_desc pport_per_prio_pfc_stats_desc[] = {
276 { "rx_%s_pause_transition", PPORT_PER_PRIO_OFF(rx_pause_transition) }, 276 { "rx_%s_pause_transition", PPORT_PER_PRIO_OFF(rx_pause_transition) },
277}; 277};
278 278
279#define PCIE_PERF_OFF(c) \
280 MLX5_BYTE_OFF(mpcnt_reg, counter_set.pcie_perf_cntrs_grp_data_layout.c)
281#define PCIE_PERF_GET(pcie_stats, c) \
282 MLX5_GET(mpcnt_reg, pcie_stats->pcie_perf_counters, \
283 counter_set.pcie_perf_cntrs_grp_data_layout.c)
284#define PCIE_TAS_OFF(c) \
285 MLX5_BYTE_OFF(mpcnt_reg, counter_set.pcie_tas_cntrs_grp_data_layout.c)
286#define PCIE_TAS_GET(pcie_stats, c) \
287 MLX5_GET(mpcnt_reg, pcie_stats->pcie_tas_counters, \
288 counter_set.pcie_tas_cntrs_grp_data_layout.c)
289
290struct mlx5e_pcie_stats {
291 __be64 pcie_perf_counters[MLX5_ST_SZ_QW(mpcnt_reg)];
292 __be64 pcie_tas_counters[MLX5_ST_SZ_QW(mpcnt_reg)];
293};
294
295static const struct counter_desc pcie_perf_stats_desc[] = {
296 { "rx_pci_signal_integrity", PCIE_PERF_OFF(rx_errors) },
297 { "tx_pci_signal_integrity", PCIE_PERF_OFF(tx_errors) },
298};
299
300static const struct counter_desc pcie_tas_stats_desc[] = {
301 { "tx_pci_transport_nonfatal_msg", PCIE_TAS_OFF(non_fatal_err_msg_sent) },
302 { "tx_pci_transport_fatal_msg", PCIE_TAS_OFF(fatal_err_msg_sent) },
303};
304
305struct mlx5e_rq_stats { 279struct mlx5e_rq_stats {
306 u64 packets; 280 u64 packets;
307 u64 bytes; 281 u64 bytes;
@@ -386,8 +360,6 @@ static const struct counter_desc sq_stats_desc[] = {
386#define NUM_PPORT_802_3_COUNTERS ARRAY_SIZE(pport_802_3_stats_desc) 360#define NUM_PPORT_802_3_COUNTERS ARRAY_SIZE(pport_802_3_stats_desc)
387#define NUM_PPORT_2863_COUNTERS ARRAY_SIZE(pport_2863_stats_desc) 361#define NUM_PPORT_2863_COUNTERS ARRAY_SIZE(pport_2863_stats_desc)
388#define NUM_PPORT_2819_COUNTERS ARRAY_SIZE(pport_2819_stats_desc) 362#define NUM_PPORT_2819_COUNTERS ARRAY_SIZE(pport_2819_stats_desc)
389#define NUM_PCIE_PERF_COUNTERS ARRAY_SIZE(pcie_perf_stats_desc)
390#define NUM_PCIE_TAS_COUNTERS ARRAY_SIZE(pcie_tas_stats_desc)
391#define NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS \ 363#define NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS \
392 ARRAY_SIZE(pport_per_prio_traffic_stats_desc) 364 ARRAY_SIZE(pport_per_prio_traffic_stats_desc)
393#define NUM_PPORT_PER_PRIO_PFC_COUNTERS \ 365#define NUM_PPORT_PER_PRIO_PFC_COUNTERS \
@@ -397,7 +369,6 @@ static const struct counter_desc sq_stats_desc[] = {
397 NUM_PPORT_2819_COUNTERS + \ 369 NUM_PPORT_2819_COUNTERS + \
398 NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS * \ 370 NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS * \
399 NUM_PPORT_PRIO) 371 NUM_PPORT_PRIO)
400#define NUM_PCIE_COUNTERS (NUM_PCIE_PERF_COUNTERS + NUM_PCIE_TAS_COUNTERS)
401#define NUM_RQ_STATS ARRAY_SIZE(rq_stats_desc) 372#define NUM_RQ_STATS ARRAY_SIZE(rq_stats_desc)
402#define NUM_SQ_STATS ARRAY_SIZE(sq_stats_desc) 373#define NUM_SQ_STATS ARRAY_SIZE(sq_stats_desc)
403 374
@@ -406,7 +377,6 @@ struct mlx5e_stats {
406 struct mlx5e_qcounter_stats qcnt; 377 struct mlx5e_qcounter_stats qcnt;
407 struct mlx5e_vport_stats vport; 378 struct mlx5e_vport_stats vport;
408 struct mlx5e_pport_stats pport; 379 struct mlx5e_pport_stats pport;
409 struct mlx5e_pcie_stats pcie;
410 struct rtnl_link_stats64 vf_vport; 380 struct rtnl_link_stats64 vf_vport;
411}; 381};
412 382
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index d6807c3cc461..f14d9c9ba773 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -1860,7 +1860,7 @@ int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,
1860 1860
1861 if (!ESW_ALLOWED(esw)) 1861 if (!ESW_ALLOWED(esw))
1862 return -EPERM; 1862 return -EPERM;
1863 if (!LEGAL_VPORT(esw, vport)) 1863 if (!LEGAL_VPORT(esw, vport) || is_multicast_ether_addr(mac))
1864 return -EINVAL; 1864 return -EINVAL;
1865 1865
1866 mutex_lock(&esw->state_lock); 1866 mutex_lock(&esw->state_lock);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index 466e161010f7..03293ed1cc22 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -695,6 +695,12 @@ int esw_offloads_init(struct mlx5_eswitch *esw, int nvports)
695 if (err) 695 if (err)
696 goto err_reps; 696 goto err_reps;
697 } 697 }
698
699 /* disable PF RoCE so missed packets don't go through RoCE steering */
700 mlx5_dev_list_lock();
701 mlx5_remove_dev_by_protocol(esw->dev, MLX5_INTERFACE_PROTOCOL_IB);
702 mlx5_dev_list_unlock();
703
698 return 0; 704 return 0;
699 705
700err_reps: 706err_reps:
@@ -718,6 +724,11 @@ static int esw_offloads_stop(struct mlx5_eswitch *esw)
718{ 724{
719 int err, err1, num_vfs = esw->dev->priv.sriov.num_vfs; 725 int err, err1, num_vfs = esw->dev->priv.sriov.num_vfs;
720 726
727 /* enable back PF RoCE */
728 mlx5_dev_list_lock();
729 mlx5_add_dev_by_protocol(esw->dev, MLX5_INTERFACE_PROTOCOL_IB);
730 mlx5_dev_list_unlock();
731
721 mlx5_eswitch_disable_sriov(esw); 732 mlx5_eswitch_disable_sriov(esw);
722 err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY); 733 err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY);
723 if (err) { 734 if (err) {
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index a263d8904a4c..0ac7a2fc916c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -1263,6 +1263,7 @@ static struct mlx5_flow_handle *add_rule_fg(struct mlx5_flow_group *fg,
1263 nested_lock_ref_node(&fte->node, FS_MUTEX_CHILD); 1263 nested_lock_ref_node(&fte->node, FS_MUTEX_CHILD);
1264 handle = add_rule_fte(fte, fg, dest, dest_num, false); 1264 handle = add_rule_fte(fte, fg, dest, dest_num, false);
1265 if (IS_ERR(handle)) { 1265 if (IS_ERR(handle)) {
1266 unlock_ref_node(&fte->node);
1266 kfree(fte); 1267 kfree(fte);
1267 goto unlock_fg; 1268 goto unlock_fg;
1268 } 1269 }
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 54e5a786f191..6547f22e6b9b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -503,6 +503,13 @@ static int handle_hca_cap(struct mlx5_core_dev *dev)
503 MLX5_SET(cmd_hca_cap, set_hca_cap, pkey_table_size, 503 MLX5_SET(cmd_hca_cap, set_hca_cap, pkey_table_size,
504 to_fw_pkey_sz(dev, 128)); 504 to_fw_pkey_sz(dev, 128));
505 505
506 /* Check log_max_qp from HCA caps to set in current profile */
507 if (MLX5_CAP_GEN_MAX(dev, log_max_qp) < profile[prof_sel].log_max_qp) {
508 mlx5_core_warn(dev, "log_max_qp value in current profile is %d, changing it to HCA capability limit (%d)\n",
509 profile[prof_sel].log_max_qp,
510 MLX5_CAP_GEN_MAX(dev, log_max_qp));
511 profile[prof_sel].log_max_qp = MLX5_CAP_GEN_MAX(dev, log_max_qp);
512 }
506 if (prof->mask & MLX5_PROF_MASK_QP_SIZE) 513 if (prof->mask & MLX5_PROF_MASK_QP_SIZE)
507 MLX5_SET(cmd_hca_cap, set_hca_cap, log_max_qp, 514 MLX5_SET(cmd_hca_cap, set_hca_cap, log_max_qp,
508 prof->log_max_qp); 515 prof->log_max_qp);
@@ -575,7 +582,6 @@ static int mlx5_irq_set_affinity_hint(struct mlx5_core_dev *mdev, int i)
575 struct mlx5_priv *priv = &mdev->priv; 582 struct mlx5_priv *priv = &mdev->priv;
576 struct msix_entry *msix = priv->msix_arr; 583 struct msix_entry *msix = priv->msix_arr;
577 int irq = msix[i + MLX5_EQ_VEC_COMP_BASE].vector; 584 int irq = msix[i + MLX5_EQ_VEC_COMP_BASE].vector;
578 int numa_node = priv->numa_node;
579 int err; 585 int err;
580 586
581 if (!zalloc_cpumask_var(&priv->irq_info[i].mask, GFP_KERNEL)) { 587 if (!zalloc_cpumask_var(&priv->irq_info[i].mask, GFP_KERNEL)) {
@@ -583,7 +589,7 @@ static int mlx5_irq_set_affinity_hint(struct mlx5_core_dev *mdev, int i)
583 return -ENOMEM; 589 return -ENOMEM;
584 } 590 }
585 591
586 cpumask_set_cpu(cpumask_local_spread(i, numa_node), 592 cpumask_set_cpu(cpumask_local_spread(i, priv->numa_node),
587 priv->irq_info[i].mask); 593 priv->irq_info[i].mask);
588 594
589 err = irq_set_affinity_hint(irq, priv->irq_info[i].mask); 595 err = irq_set_affinity_hint(irq, priv->irq_info[i].mask);
@@ -1189,6 +1195,8 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
1189{ 1195{
1190 int err = 0; 1196 int err = 0;
1191 1197
1198 mlx5_drain_health_wq(dev);
1199
1192 mutex_lock(&dev->intf_state_mutex); 1200 mutex_lock(&dev->intf_state_mutex);
1193 if (test_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state)) { 1201 if (test_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state)) {
1194 dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n", 1202 dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n",
@@ -1351,10 +1359,9 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev,
1351 1359
1352 mlx5_enter_error_state(dev); 1360 mlx5_enter_error_state(dev);
1353 mlx5_unload_one(dev, priv, false); 1361 mlx5_unload_one(dev, priv, false);
1354 /* In case of kernel call save the pci state and drain health wq */ 1362 /* In case of kernel call save the pci state */
1355 if (state) { 1363 if (state) {
1356 pci_save_state(pdev); 1364 pci_save_state(pdev);
1357 mlx5_drain_health_wq(dev);
1358 mlx5_pci_disable_device(dev); 1365 mlx5_pci_disable_device(dev);
1359 } 1366 }
1360 1367
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index f341c1bc7001..00fafabab1d0 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -819,6 +819,7 @@ static struct sh_eth_cpu_data sh7734_data = {
819 .tsu = 1, 819 .tsu = 1,
820 .hw_crc = 1, 820 .hw_crc = 1,
821 .select_mii = 1, 821 .select_mii = 1,
822 .shift_rd0 = 1,
822}; 823};
823 824
824/* SH7763 */ 825/* SH7763 */
@@ -1656,7 +1657,7 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev)
1656 else 1657 else
1657 goto out; 1658 goto out;
1658 1659
1659 if (!likely(mdp->irq_enabled)) { 1660 if (unlikely(!mdp->irq_enabled)) {
1660 sh_eth_write(ndev, 0, EESIPR); 1661 sh_eth_write(ndev, 0, EESIPR);
1661 goto out; 1662 goto out;
1662 } 1663 }
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index de2947ccc5ad..5eb0e684fd76 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -1323,7 +1323,8 @@ static int efx_ef10_init_nic(struct efx_nic *efx)
1323 } 1323 }
1324 1324
1325 /* don't fail init if RSS setup doesn't work */ 1325 /* don't fail init if RSS setup doesn't work */
1326 efx->type->rx_push_rss_config(efx, false, efx->rx_indir_table); 1326 rc = efx->type->rx_push_rss_config(efx, false, efx->rx_indir_table);
1327 efx->rss_active = (rc == 0);
1327 1328
1328 return 0; 1329 return 0;
1329} 1330}
diff --git a/drivers/net/ethernet/sfc/ethtool.c b/drivers/net/ethernet/sfc/ethtool.c
index 87bdc56b4e3a..18ebaea44e82 100644
--- a/drivers/net/ethernet/sfc/ethtool.c
+++ b/drivers/net/ethernet/sfc/ethtool.c
@@ -975,6 +975,8 @@ efx_ethtool_get_rxnfc(struct net_device *net_dev,
975 975
976 case ETHTOOL_GRXFH: { 976 case ETHTOOL_GRXFH: {
977 info->data = 0; 977 info->data = 0;
978 if (!efx->rss_active) /* No RSS */
979 return 0;
978 switch (info->flow_type) { 980 switch (info->flow_type) {
979 case UDP_V4_FLOW: 981 case UDP_V4_FLOW:
980 if (efx->rx_hash_udp_4tuple) 982 if (efx->rx_hash_udp_4tuple)
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index 1a635ced62d0..1c62c1a00fca 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -860,6 +860,7 @@ struct vfdi_status;
860 * @rx_hash_key: Toeplitz hash key for RSS 860 * @rx_hash_key: Toeplitz hash key for RSS
861 * @rx_indir_table: Indirection table for RSS 861 * @rx_indir_table: Indirection table for RSS
862 * @rx_scatter: Scatter mode enabled for receives 862 * @rx_scatter: Scatter mode enabled for receives
863 * @rss_active: RSS enabled on hardware
863 * @rx_hash_udp_4tuple: UDP 4-tuple hashing enabled 864 * @rx_hash_udp_4tuple: UDP 4-tuple hashing enabled
864 * @int_error_count: Number of internal errors seen recently 865 * @int_error_count: Number of internal errors seen recently
865 * @int_error_expire: Time at which error count will be expired 866 * @int_error_expire: Time at which error count will be expired
@@ -998,6 +999,7 @@ struct efx_nic {
998 u8 rx_hash_key[40]; 999 u8 rx_hash_key[40];
999 u32 rx_indir_table[128]; 1000 u32 rx_indir_table[128];
1000 bool rx_scatter; 1001 bool rx_scatter;
1002 bool rss_active;
1001 bool rx_hash_udp_4tuple; 1003 bool rx_hash_udp_4tuple;
1002 1004
1003 unsigned int_error_count; 1005 unsigned int_error_count;
diff --git a/drivers/net/ethernet/sfc/siena.c b/drivers/net/ethernet/sfc/siena.c
index a3901bc96586..4e54e5dc9fcb 100644
--- a/drivers/net/ethernet/sfc/siena.c
+++ b/drivers/net/ethernet/sfc/siena.c
@@ -403,6 +403,7 @@ static int siena_init_nic(struct efx_nic *efx)
403 efx_writeo(efx, &temp, FR_AZ_RX_CFG); 403 efx_writeo(efx, &temp, FR_AZ_RX_CFG);
404 404
405 siena_rx_push_rss_config(efx, false, efx->rx_indir_table); 405 siena_rx_push_rss_config(efx, false, efx->rx_indir_table);
406 efx->rss_active = true;
406 407
407 /* Enable event logging */ 408 /* Enable event logging */
408 rc = efx_mcdi_log_ctrl(efx, true, false, 0); 409 rc = efx_mcdi_log_ctrl(efx, true, false, 0);
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
index c35597586121..3dc7d279f805 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
@@ -60,8 +60,9 @@ struct oxnas_dwmac {
60 struct regmap *regmap; 60 struct regmap *regmap;
61}; 61};
62 62
63static int oxnas_dwmac_init(struct oxnas_dwmac *dwmac) 63static int oxnas_dwmac_init(struct platform_device *pdev, void *priv)
64{ 64{
65 struct oxnas_dwmac *dwmac = priv;
65 unsigned int value; 66 unsigned int value;
66 int ret; 67 int ret;
67 68
@@ -105,20 +106,20 @@ static int oxnas_dwmac_init(struct oxnas_dwmac *dwmac)
105 return 0; 106 return 0;
106} 107}
107 108
109static void oxnas_dwmac_exit(struct platform_device *pdev, void *priv)
110{
111 struct oxnas_dwmac *dwmac = priv;
112
113 clk_disable_unprepare(dwmac->clk);
114}
115
108static int oxnas_dwmac_probe(struct platform_device *pdev) 116static int oxnas_dwmac_probe(struct platform_device *pdev)
109{ 117{
110 struct plat_stmmacenet_data *plat_dat; 118 struct plat_stmmacenet_data *plat_dat;
111 struct stmmac_resources stmmac_res; 119 struct stmmac_resources stmmac_res;
112 struct device_node *sysctrl;
113 struct oxnas_dwmac *dwmac; 120 struct oxnas_dwmac *dwmac;
114 int ret; 121 int ret;
115 122
116 sysctrl = of_parse_phandle(pdev->dev.of_node, "oxsemi,sys-ctrl", 0);
117 if (!sysctrl) {
118 dev_err(&pdev->dev, "failed to get sys-ctrl node\n");
119 return -EINVAL;
120 }
121
122 ret = stmmac_get_platform_resources(pdev, &stmmac_res); 123 ret = stmmac_get_platform_resources(pdev, &stmmac_res);
123 if (ret) 124 if (ret)
124 return ret; 125 return ret;
@@ -128,72 +129,48 @@ static int oxnas_dwmac_probe(struct platform_device *pdev)
128 return PTR_ERR(plat_dat); 129 return PTR_ERR(plat_dat);
129 130
130 dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); 131 dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
131 if (!dwmac) 132 if (!dwmac) {
132 return -ENOMEM; 133 ret = -ENOMEM;
134 goto err_remove_config_dt;
135 }
133 136
134 dwmac->dev = &pdev->dev; 137 dwmac->dev = &pdev->dev;
135 plat_dat->bsp_priv = dwmac; 138 plat_dat->bsp_priv = dwmac;
139 plat_dat->init = oxnas_dwmac_init;
140 plat_dat->exit = oxnas_dwmac_exit;
136 141
137 dwmac->regmap = syscon_node_to_regmap(sysctrl); 142 dwmac->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
143 "oxsemi,sys-ctrl");
138 if (IS_ERR(dwmac->regmap)) { 144 if (IS_ERR(dwmac->regmap)) {
139 dev_err(&pdev->dev, "failed to have sysctrl regmap\n"); 145 dev_err(&pdev->dev, "failed to have sysctrl regmap\n");
140 return PTR_ERR(dwmac->regmap); 146 ret = PTR_ERR(dwmac->regmap);
147 goto err_remove_config_dt;
141 } 148 }
142 149
143 dwmac->clk = devm_clk_get(&pdev->dev, "gmac"); 150 dwmac->clk = devm_clk_get(&pdev->dev, "gmac");
144 if (IS_ERR(dwmac->clk)) 151 if (IS_ERR(dwmac->clk)) {
145 return PTR_ERR(dwmac->clk); 152 ret = PTR_ERR(dwmac->clk);
153 goto err_remove_config_dt;
154 }
146 155
147 ret = oxnas_dwmac_init(dwmac); 156 ret = oxnas_dwmac_init(pdev, plat_dat->bsp_priv);
148 if (ret) 157 if (ret)
149 return ret; 158 goto err_remove_config_dt;
150 159
151 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); 160 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
152 if (ret) 161 if (ret)
153 clk_disable_unprepare(dwmac->clk); 162 goto err_dwmac_exit;
154 163
155 return ret;
156}
157 164
158static int oxnas_dwmac_remove(struct platform_device *pdev) 165 return 0;
159{
160 struct oxnas_dwmac *dwmac = get_stmmac_bsp_priv(&pdev->dev);
161 int ret = stmmac_dvr_remove(&pdev->dev);
162
163 clk_disable_unprepare(dwmac->clk);
164
165 return ret;
166}
167
168#ifdef CONFIG_PM_SLEEP
169static int oxnas_dwmac_suspend(struct device *dev)
170{
171 struct oxnas_dwmac *dwmac = get_stmmac_bsp_priv(dev);
172 int ret;
173
174 ret = stmmac_suspend(dev);
175 clk_disable_unprepare(dwmac->clk);
176
177 return ret;
178}
179
180static int oxnas_dwmac_resume(struct device *dev)
181{
182 struct oxnas_dwmac *dwmac = get_stmmac_bsp_priv(dev);
183 int ret;
184
185 ret = oxnas_dwmac_init(dwmac);
186 if (ret)
187 return ret;
188 166
189 ret = stmmac_resume(dev); 167err_dwmac_exit:
168 oxnas_dwmac_exit(pdev, plat_dat->bsp_priv);
169err_remove_config_dt:
170 stmmac_remove_config_dt(pdev, plat_dat);
190 171
191 return ret; 172 return ret;
192} 173}
193#endif /* CONFIG_PM_SLEEP */
194
195static SIMPLE_DEV_PM_OPS(oxnas_dwmac_pm_ops,
196 oxnas_dwmac_suspend, oxnas_dwmac_resume);
197 174
198static const struct of_device_id oxnas_dwmac_match[] = { 175static const struct of_device_id oxnas_dwmac_match[] = {
199 { .compatible = "oxsemi,ox820-dwmac" }, 176 { .compatible = "oxsemi,ox820-dwmac" },
@@ -203,10 +180,10 @@ MODULE_DEVICE_TABLE(of, oxnas_dwmac_match);
203 180
204static struct platform_driver oxnas_dwmac_driver = { 181static struct platform_driver oxnas_dwmac_driver = {
205 .probe = oxnas_dwmac_probe, 182 .probe = oxnas_dwmac_probe,
206 .remove = oxnas_dwmac_remove, 183 .remove = stmmac_pltfr_remove,
207 .driver = { 184 .driver = {
208 .name = "oxnas-dwmac", 185 .name = "oxnas-dwmac",
209 .pm = &oxnas_dwmac_pm_ops, 186 .pm = &stmmac_pltfr_pm_ops,
210 .of_match_table = oxnas_dwmac_match, 187 .of_match_table = oxnas_dwmac_match,
211 }, 188 },
212}; 189};
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index bb40382e205d..39eb7a65bb9f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3339,13 +3339,6 @@ int stmmac_dvr_probe(struct device *device,
3339 3339
3340 spin_lock_init(&priv->lock); 3340 spin_lock_init(&priv->lock);
3341 3341
3342 ret = register_netdev(ndev);
3343 if (ret) {
3344 netdev_err(priv->dev, "%s: ERROR %i registering the device\n",
3345 __func__, ret);
3346 goto error_netdev_register;
3347 }
3348
3349 /* If a specific clk_csr value is passed from the platform 3342 /* If a specific clk_csr value is passed from the platform
3350 * this means that the CSR Clock Range selection cannot be 3343 * this means that the CSR Clock Range selection cannot be
3351 * changed at run-time and it is fixed. Viceversa the driver'll try to 3344 * changed at run-time and it is fixed. Viceversa the driver'll try to
@@ -3372,11 +3365,21 @@ int stmmac_dvr_probe(struct device *device,
3372 } 3365 }
3373 } 3366 }
3374 3367
3375 return 0; 3368 ret = register_netdev(ndev);
3369 if (ret) {
3370 netdev_err(priv->dev, "%s: ERROR %i registering the device\n",
3371 __func__, ret);
3372 goto error_netdev_register;
3373 }
3374
3375 return ret;
3376 3376
3377error_mdio_register:
3378 unregister_netdev(ndev);
3379error_netdev_register: 3377error_netdev_register:
3378 if (priv->hw->pcs != STMMAC_PCS_RGMII &&
3379 priv->hw->pcs != STMMAC_PCS_TBI &&
3380 priv->hw->pcs != STMMAC_PCS_RTBI)
3381 stmmac_mdio_unregister(ndev);
3382error_mdio_register:
3380 netif_napi_del(&priv->napi); 3383 netif_napi_del(&priv->napi);
3381error_hw_init: 3384error_hw_init:
3382 clk_disable_unprepare(priv->pclk); 3385 clk_disable_unprepare(priv->pclk);
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index 6c646e228833..6e98ede997d3 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -1367,6 +1367,7 @@ static struct usb_driver asix_driver = {
1367 .probe = usbnet_probe, 1367 .probe = usbnet_probe,
1368 .suspend = asix_suspend, 1368 .suspend = asix_suspend,
1369 .resume = asix_resume, 1369 .resume = asix_resume,
1370 .reset_resume = asix_resume,
1370 .disconnect = usbnet_disconnect, 1371 .disconnect = usbnet_disconnect,
1371 .supports_autosuspend = 1, 1372 .supports_autosuspend = 1,
1372 .disable_hub_initiated_lpm = 1, 1373 .disable_hub_initiated_lpm = 1,
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 7532646c3b7b..23dfb0eac098 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -967,6 +967,7 @@ static struct sk_buff *vrf_ip6_rcv(struct net_device *vrf_dev,
967 */ 967 */
968 need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr); 968 need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr);
969 if (!ipv6_ndisc_frame(skb) && !need_strict) { 969 if (!ipv6_ndisc_frame(skb) && !need_strict) {
970 vrf_rx_stats(vrf_dev, skb->len);
970 skb->dev = vrf_dev; 971 skb->dev = vrf_dev;
971 skb->skb_iif = vrf_dev->ifindex; 972 skb->skb_iif = vrf_dev->ifindex;
972 973
@@ -1011,6 +1012,8 @@ static struct sk_buff *vrf_ip_rcv(struct net_device *vrf_dev,
1011 goto out; 1012 goto out;
1012 } 1013 }
1013 1014
1015 vrf_rx_stats(vrf_dev, skb->len);
1016
1014 skb_push(skb, skb->mac_len); 1017 skb_push(skb, skb->mac_len);
1015 dev_queue_xmit_nit(skb, vrf_dev); 1018 dev_queue_xmit_nit(skb, vrf_dev);
1016 skb_pull(skb, skb->mac_len); 1019 skb_pull(skb, skb->mac_len);
diff --git a/drivers/net/wan/slic_ds26522.c b/drivers/net/wan/slic_ds26522.c
index b776a0ab106c..9d9b4e0def2a 100644
--- a/drivers/net/wan/slic_ds26522.c
+++ b/drivers/net/wan/slic_ds26522.c
@@ -218,7 +218,7 @@ static int slic_ds26522_probe(struct spi_device *spi)
218 218
219 ret = slic_ds26522_init_configure(spi); 219 ret = slic_ds26522_init_configure(spi);
220 if (ret == 0) 220 if (ret == 0)
221 pr_info("DS26522 cs%d configurated\n", spi->chip_select); 221 pr_info("DS26522 cs%d configured\n", spi->chip_select);
222 222
223 return ret; 223 return ret;
224} 224}
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 93bdb3485192..6533c16e27ad 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -1384,6 +1384,8 @@ int set_phv_bit(struct mlx4_dev *dev, u8 port, int new_val);
1384int get_phv_bit(struct mlx4_dev *dev, u8 port, int *phv); 1384int get_phv_bit(struct mlx4_dev *dev, u8 port, int *phv);
1385int mlx4_get_is_vlan_offload_disabled(struct mlx4_dev *dev, u8 port, 1385int mlx4_get_is_vlan_offload_disabled(struct mlx4_dev *dev, u8 port,
1386 bool *vlan_offload_disabled); 1386 bool *vlan_offload_disabled);
1387void mlx4_handle_eth_header_mcast_prio(struct mlx4_net_trans_rule_hw_ctrl *ctrl,
1388 struct _rule_hw *eth_header);
1387int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx); 1389int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx);
1388int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 1390int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
1389int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); 1391int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 9f489365b3d3..52b437431c6a 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -1071,11 +1071,6 @@ enum {
1071 MLX5_INFINIBAND_PORT_COUNTERS_GROUP = 0x20, 1071 MLX5_INFINIBAND_PORT_COUNTERS_GROUP = 0x20,
1072}; 1072};
1073 1073
1074enum {
1075 MLX5_PCIE_PERFORMANCE_COUNTERS_GROUP = 0x0,
1076 MLX5_PCIE_TIMERS_AND_STATES_COUNTERS_GROUP = 0x2,
1077};
1078
1079static inline u16 mlx5_to_sw_pkey_sz(int pkey_sz) 1074static inline u16 mlx5_to_sw_pkey_sz(int pkey_sz)
1080{ 1075{
1081 if (pkey_sz > MLX5_MAX_LOG_PKEY_TABLE) 1076 if (pkey_sz > MLX5_MAX_LOG_PKEY_TABLE)
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 0ae55361e674..735b36335f29 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -123,7 +123,6 @@ enum {
123 MLX5_REG_HOST_ENDIANNESS = 0x7004, 123 MLX5_REG_HOST_ENDIANNESS = 0x7004,
124 MLX5_REG_MCIA = 0x9014, 124 MLX5_REG_MCIA = 0x9014,
125 MLX5_REG_MLCR = 0x902b, 125 MLX5_REG_MLCR = 0x902b,
126 MLX5_REG_MPCNT = 0x9051,
127}; 126};
128 127
129enum mlx5_dcbx_oper_mode { 128enum mlx5_dcbx_oper_mode {
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 57bec544e20a..a852e9db6f0d 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -1757,80 +1757,6 @@ struct mlx5_ifc_eth_802_3_cntrs_grp_data_layout_bits {
1757 u8 reserved_at_4c0[0x300]; 1757 u8 reserved_at_4c0[0x300];
1758}; 1758};
1759 1759
1760struct mlx5_ifc_pcie_perf_cntrs_grp_data_layout_bits {
1761 u8 life_time_counter_high[0x20];
1762
1763 u8 life_time_counter_low[0x20];
1764
1765 u8 rx_errors[0x20];
1766
1767 u8 tx_errors[0x20];
1768
1769 u8 l0_to_recovery_eieos[0x20];
1770
1771 u8 l0_to_recovery_ts[0x20];
1772
1773 u8 l0_to_recovery_framing[0x20];
1774
1775 u8 l0_to_recovery_retrain[0x20];
1776
1777 u8 crc_error_dllp[0x20];
1778
1779 u8 crc_error_tlp[0x20];
1780
1781 u8 reserved_at_140[0x680];
1782};
1783
1784struct mlx5_ifc_pcie_tas_cntrs_grp_data_layout_bits {
1785 u8 life_time_counter_high[0x20];
1786
1787 u8 life_time_counter_low[0x20];
1788
1789 u8 time_to_boot_image_start[0x20];
1790
1791 u8 time_to_link_image[0x20];
1792
1793 u8 calibration_time[0x20];
1794
1795 u8 time_to_first_perst[0x20];
1796
1797 u8 time_to_detect_state[0x20];
1798
1799 u8 time_to_l0[0x20];
1800
1801 u8 time_to_crs_en[0x20];
1802
1803 u8 time_to_plastic_image_start[0x20];
1804
1805 u8 time_to_iron_image_start[0x20];
1806
1807 u8 perst_handler[0x20];
1808
1809 u8 times_in_l1[0x20];
1810
1811 u8 times_in_l23[0x20];
1812
1813 u8 dl_down[0x20];
1814
1815 u8 config_cycle1usec[0x20];
1816
1817 u8 config_cycle2to7usec[0x20];
1818
1819 u8 config_cycle_8to15usec[0x20];
1820
1821 u8 config_cycle_16_to_63usec[0x20];
1822
1823 u8 config_cycle_64usec[0x20];
1824
1825 u8 correctable_err_msg_sent[0x20];
1826
1827 u8 non_fatal_err_msg_sent[0x20];
1828
1829 u8 fatal_err_msg_sent[0x20];
1830
1831 u8 reserved_at_2e0[0x4e0];
1832};
1833
1834struct mlx5_ifc_cmd_inter_comp_event_bits { 1760struct mlx5_ifc_cmd_inter_comp_event_bits {
1835 u8 command_completion_vector[0x20]; 1761 u8 command_completion_vector[0x20];
1836 1762
@@ -2995,12 +2921,6 @@ union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits {
2995 u8 reserved_at_0[0x7c0]; 2921 u8 reserved_at_0[0x7c0];
2996}; 2922};
2997 2923
2998union mlx5_ifc_pcie_cntrs_grp_data_layout_auto_bits {
2999 struct mlx5_ifc_pcie_perf_cntrs_grp_data_layout_bits pcie_perf_cntrs_grp_data_layout;
3000 struct mlx5_ifc_pcie_tas_cntrs_grp_data_layout_bits pcie_tas_cntrs_grp_data_layout;
3001 u8 reserved_at_0[0x7c0];
3002};
3003
3004union mlx5_ifc_event_auto_bits { 2924union mlx5_ifc_event_auto_bits {
3005 struct mlx5_ifc_comp_event_bits comp_event; 2925 struct mlx5_ifc_comp_event_bits comp_event;
3006 struct mlx5_ifc_dct_events_bits dct_events; 2926 struct mlx5_ifc_dct_events_bits dct_events;
@@ -7320,18 +7240,6 @@ struct mlx5_ifc_ppcnt_reg_bits {
7320 union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits counter_set; 7240 union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits counter_set;
7321}; 7241};
7322 7242
7323struct mlx5_ifc_mpcnt_reg_bits {
7324 u8 reserved_at_0[0x8];
7325 u8 pcie_index[0x8];
7326 u8 reserved_at_10[0xa];
7327 u8 grp[0x6];
7328
7329 u8 clr[0x1];
7330 u8 reserved_at_21[0x1f];
7331
7332 union mlx5_ifc_pcie_cntrs_grp_data_layout_auto_bits counter_set;
7333};
7334
7335struct mlx5_ifc_ppad_reg_bits { 7243struct mlx5_ifc_ppad_reg_bits {
7336 u8 reserved_at_0[0x3]; 7244 u8 reserved_at_0[0x3];
7337 u8 single_mac[0x1]; 7245 u8 single_mac[0x1];
@@ -7937,7 +7845,6 @@ union mlx5_ifc_ports_control_registers_document_bits {
7937 struct mlx5_ifc_pmtu_reg_bits pmtu_reg; 7845 struct mlx5_ifc_pmtu_reg_bits pmtu_reg;
7938 struct mlx5_ifc_ppad_reg_bits ppad_reg; 7846 struct mlx5_ifc_ppad_reg_bits ppad_reg;
7939 struct mlx5_ifc_ppcnt_reg_bits ppcnt_reg; 7847 struct mlx5_ifc_ppcnt_reg_bits ppcnt_reg;
7940 struct mlx5_ifc_mpcnt_reg_bits mpcnt_reg;
7941 struct mlx5_ifc_pplm_reg_bits pplm_reg; 7848 struct mlx5_ifc_pplm_reg_bits pplm_reg;
7942 struct mlx5_ifc_pplr_reg_bits pplr_reg; 7849 struct mlx5_ifc_pplr_reg_bits pplr_reg;
7943 struct mlx5_ifc_ppsc_reg_bits ppsc_reg; 7850 struct mlx5_ifc_ppsc_reg_bits ppsc_reg;
diff --git a/net/atm/lec.c b/net/atm/lec.c
index 019557d0a11d..09cfe87f0a44 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -1059,7 +1059,9 @@ static void __exit lane_module_cleanup(void)
1059{ 1059{
1060 int i; 1060 int i;
1061 1061
1062#ifdef CONFIG_PROC_FS
1062 remove_proc_entry("lec", atm_proc_root); 1063 remove_proc_entry("lec", atm_proc_root);
1064#endif
1063 1065
1064 deregister_atm_ioctl(&lane_ioctl_ops); 1066 deregister_atm_ioctl(&lane_ioctl_ops);
1065 1067
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
index 8e0c0635ee97..fb55327dcfea 100644
--- a/net/core/drop_monitor.c
+++ b/net/core/drop_monitor.c
@@ -75,6 +75,7 @@ static struct sk_buff *reset_per_cpu_data(struct per_cpu_dm_data *data)
75 struct nlattr *nla; 75 struct nlattr *nla;
76 struct sk_buff *skb; 76 struct sk_buff *skb;
77 unsigned long flags; 77 unsigned long flags;
78 void *msg_header;
78 79
79 al = sizeof(struct net_dm_alert_msg); 80 al = sizeof(struct net_dm_alert_msg);
80 al += dm_hit_limit * sizeof(struct net_dm_drop_point); 81 al += dm_hit_limit * sizeof(struct net_dm_drop_point);
@@ -82,21 +83,41 @@ static struct sk_buff *reset_per_cpu_data(struct per_cpu_dm_data *data)
82 83
83 skb = genlmsg_new(al, GFP_KERNEL); 84 skb = genlmsg_new(al, GFP_KERNEL);
84 85
85 if (skb) { 86 if (!skb)
86 genlmsg_put(skb, 0, 0, &net_drop_monitor_family, 87 goto err;
87 0, NET_DM_CMD_ALERT); 88
88 nla = nla_reserve(skb, NLA_UNSPEC, 89 msg_header = genlmsg_put(skb, 0, 0, &net_drop_monitor_family,
89 sizeof(struct net_dm_alert_msg)); 90 0, NET_DM_CMD_ALERT);
90 msg = nla_data(nla); 91 if (!msg_header) {
91 memset(msg, 0, al); 92 nlmsg_free(skb);
92 } else { 93 skb = NULL;
93 mod_timer(&data->send_timer, jiffies + HZ / 10); 94 goto err;
95 }
96 nla = nla_reserve(skb, NLA_UNSPEC,
97 sizeof(struct net_dm_alert_msg));
98 if (!nla) {
99 nlmsg_free(skb);
100 skb = NULL;
101 goto err;
94 } 102 }
103 msg = nla_data(nla);
104 memset(msg, 0, al);
105 goto out;
95 106
107err:
108 mod_timer(&data->send_timer, jiffies + HZ / 10);
109out:
96 spin_lock_irqsave(&data->lock, flags); 110 spin_lock_irqsave(&data->lock, flags);
97 swap(data->skb, skb); 111 swap(data->skb, skb);
98 spin_unlock_irqrestore(&data->lock, flags); 112 spin_unlock_irqrestore(&data->lock, flags);
99 113
114 if (skb) {
115 struct nlmsghdr *nlh = (struct nlmsghdr *)skb->data;
116 struct genlmsghdr *gnlh = (struct genlmsghdr *)nlmsg_data(nlh);
117
118 genlmsg_end(skb, genlmsg_data(gnlh));
119 }
120
100 return skb; 121 return skb;
101} 122}
102 123
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index d6447dc10371..fe4e1531976c 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -468,8 +468,9 @@ ip_proto_again:
468 if (hdr->flags & GRE_ACK) 468 if (hdr->flags & GRE_ACK)
469 offset += sizeof(((struct pptp_gre_header *)0)->ack); 469 offset += sizeof(((struct pptp_gre_header *)0)->ack);
470 470
471 ppp_hdr = skb_header_pointer(skb, nhoff + offset, 471 ppp_hdr = __skb_header_pointer(skb, nhoff + offset,
472 sizeof(_ppp_hdr), _ppp_hdr); 472 sizeof(_ppp_hdr),
473 data, hlen, _ppp_hdr);
473 if (!ppp_hdr) 474 if (!ppp_hdr)
474 goto out_bad; 475 goto out_bad;
475 476
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 18b5aae99bec..75e3ea7bda08 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -3898,6 +3898,9 @@ static int rtnl_stats_get(struct sk_buff *skb, struct nlmsghdr *nlh)
3898 u32 filter_mask; 3898 u32 filter_mask;
3899 int err; 3899 int err;
3900 3900
3901 if (nlmsg_len(nlh) < sizeof(*ifsm))
3902 return -EINVAL;
3903
3901 ifsm = nlmsg_data(nlh); 3904 ifsm = nlmsg_data(nlh);
3902 if (ifsm->ifindex > 0) 3905 if (ifsm->ifindex > 0)
3903 dev = __dev_get_by_index(net, ifsm->ifindex); 3906 dev = __dev_get_by_index(net, ifsm->ifindex);
@@ -3947,6 +3950,9 @@ static int rtnl_stats_dump(struct sk_buff *skb, struct netlink_callback *cb)
3947 3950
3948 cb->seq = net->dev_base_seq; 3951 cb->seq = net->dev_base_seq;
3949 3952
3953 if (nlmsg_len(cb->nlh) < sizeof(*ifsm))
3954 return -EINVAL;
3955
3950 ifsm = nlmsg_data(cb->nlh); 3956 ifsm = nlmsg_data(cb->nlh);
3951 filter_mask = ifsm->filter_mask; 3957 filter_mask = ifsm->filter_mask;
3952 if (!filter_mask) 3958 if (!filter_mask)
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 3ff8938893ec..eae0332b0e8c 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -85,7 +85,7 @@ struct fib_table *fib_new_table(struct net *net, u32 id)
85 if (tb) 85 if (tb)
86 return tb; 86 return tb;
87 87
88 if (id == RT_TABLE_LOCAL) 88 if (id == RT_TABLE_LOCAL && !net->ipv4.fib_has_custom_rules)
89 alias = fib_new_table(net, RT_TABLE_MAIN); 89 alias = fib_new_table(net, RT_TABLE_MAIN);
90 90
91 tb = fib_trie_table(id, alias); 91 tb = fib_trie_table(id, alias);
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 68d622133f53..5b15459955f8 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -219,9 +219,14 @@ static void igmp_start_timer(struct ip_mc_list *im, int max_delay)
219static void igmp_gq_start_timer(struct in_device *in_dev) 219static void igmp_gq_start_timer(struct in_device *in_dev)
220{ 220{
221 int tv = prandom_u32() % in_dev->mr_maxdelay; 221 int tv = prandom_u32() % in_dev->mr_maxdelay;
222 unsigned long exp = jiffies + tv + 2;
223
224 if (in_dev->mr_gq_running &&
225 time_after_eq(exp, (in_dev->mr_gq_timer).expires))
226 return;
222 227
223 in_dev->mr_gq_running = 1; 228 in_dev->mr_gq_running = 1;
224 if (!mod_timer(&in_dev->mr_gq_timer, jiffies+tv+2)) 229 if (!mod_timer(&in_dev->mr_gq_timer, exp))
225 in_dev_hold(in_dev); 230 in_dev_hold(in_dev);
226} 231}
227 232
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 57e1405e8282..53ae0c6315ad 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -1225,8 +1225,14 @@ void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb)
1225 * which has interface index (iif) as the first member of the 1225 * which has interface index (iif) as the first member of the
1226 * underlying inet{6}_skb_parm struct. This code then overlays 1226 * underlying inet{6}_skb_parm struct. This code then overlays
1227 * PKTINFO_SKB_CB and in_pktinfo also has iif as the first 1227 * PKTINFO_SKB_CB and in_pktinfo also has iif as the first
1228 * element so the iif is picked up from the prior IPCB 1228 * element so the iif is picked up from the prior IPCB. If iif
1229 * is the loopback interface, then return the sending interface
1230 * (e.g., process binds socket to eth0 for Tx which is
1231 * redirected to loopback in the rtable/dst).
1229 */ 1232 */
1233 if (pktinfo->ipi_ifindex == LOOPBACK_IFINDEX)
1234 pktinfo->ipi_ifindex = inet_iif(skb);
1235
1230 pktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb); 1236 pktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb);
1231 } else { 1237 } else {
1232 pktinfo->ipi_ifindex = 0; 1238 pktinfo->ipi_ifindex = 0;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index a82a11747b3f..0fcac8e7a2b2 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1914,7 +1914,8 @@ local_input:
1914 } 1914 }
1915 } 1915 }
1916 1916
1917 rth = rt_dst_alloc(net->loopback_dev, flags | RTCF_LOCAL, res.type, 1917 rth = rt_dst_alloc(l3mdev_master_dev_rcu(dev) ? : net->loopback_dev,
1918 flags | RTCF_LOCAL, res.type,
1918 IN_DEV_CONF_GET(in_dev, NOPOLICY), false, do_cache); 1919 IN_DEV_CONF_GET(in_dev, NOPOLICY), false, do_cache);
1919 if (!rth) 1920 if (!rth)
1920 goto e_nobufs; 1921 goto e_nobufs;
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 70d0de404197..38122d04fadc 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1373,7 +1373,7 @@ emsgsize:
1373 */ 1373 */
1374 1374
1375 cork->length += length; 1375 cork->length += length;
1376 if (((length > mtu) || 1376 if ((((length + fragheaderlen) > mtu) ||
1377 (skb && skb_is_gso(skb))) && 1377 (skb && skb_is_gso(skb))) &&
1378 (sk->sk_protocol == IPPROTO_UDP) && 1378 (sk->sk_protocol == IPPROTO_UDP) &&
1379 (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len && 1379 (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len &&
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
index 8938b6ba57a0..3d73278b86ca 100644
--- a/net/l2tp/l2tp_ip.c
+++ b/net/l2tp/l2tp_ip.c
@@ -47,7 +47,8 @@ static inline struct l2tp_ip_sock *l2tp_ip_sk(const struct sock *sk)
47 return (struct l2tp_ip_sock *)sk; 47 return (struct l2tp_ip_sock *)sk;
48} 48}
49 49
50static struct sock *__l2tp_ip_bind_lookup(struct net *net, __be32 laddr, int dif, u32 tunnel_id) 50static struct sock *__l2tp_ip_bind_lookup(const struct net *net, __be32 laddr,
51 __be32 raddr, int dif, u32 tunnel_id)
51{ 52{
52 struct sock *sk; 53 struct sock *sk;
53 54
@@ -61,6 +62,7 @@ static struct sock *__l2tp_ip_bind_lookup(struct net *net, __be32 laddr, int dif
61 if ((l2tp->conn_id == tunnel_id) && 62 if ((l2tp->conn_id == tunnel_id) &&
62 net_eq(sock_net(sk), net) && 63 net_eq(sock_net(sk), net) &&
63 !(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) && 64 !(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) &&
65 (!inet->inet_daddr || !raddr || inet->inet_daddr == raddr) &&
64 (!sk->sk_bound_dev_if || !dif || 66 (!sk->sk_bound_dev_if || !dif ||
65 sk->sk_bound_dev_if == dif)) 67 sk->sk_bound_dev_if == dif))
66 goto found; 68 goto found;
@@ -71,15 +73,6 @@ found:
71 return sk; 73 return sk;
72} 74}
73 75
74static inline struct sock *l2tp_ip_bind_lookup(struct net *net, __be32 laddr, int dif, u32 tunnel_id)
75{
76 struct sock *sk = __l2tp_ip_bind_lookup(net, laddr, dif, tunnel_id);
77 if (sk)
78 sock_hold(sk);
79
80 return sk;
81}
82
83/* When processing receive frames, there are two cases to 76/* When processing receive frames, there are two cases to
84 * consider. Data frames consist of a non-zero session-id and an 77 * consider. Data frames consist of a non-zero session-id and an
85 * optional cookie. Control frames consist of a regular L2TP header 78 * optional cookie. Control frames consist of a regular L2TP header
@@ -183,8 +176,8 @@ pass_up:
183 struct iphdr *iph = (struct iphdr *) skb_network_header(skb); 176 struct iphdr *iph = (struct iphdr *) skb_network_header(skb);
184 177
185 read_lock_bh(&l2tp_ip_lock); 178 read_lock_bh(&l2tp_ip_lock);
186 sk = __l2tp_ip_bind_lookup(net, iph->daddr, inet_iif(skb), 179 sk = __l2tp_ip_bind_lookup(net, iph->daddr, iph->saddr,
187 tunnel_id); 180 inet_iif(skb), tunnel_id);
188 if (!sk) { 181 if (!sk) {
189 read_unlock_bh(&l2tp_ip_lock); 182 read_unlock_bh(&l2tp_ip_lock);
190 goto discard; 183 goto discard;
@@ -280,7 +273,7 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
280 inet->inet_saddr = 0; /* Use device */ 273 inet->inet_saddr = 0; /* Use device */
281 274
282 write_lock_bh(&l2tp_ip_lock); 275 write_lock_bh(&l2tp_ip_lock);
283 if (__l2tp_ip_bind_lookup(net, addr->l2tp_addr.s_addr, 276 if (__l2tp_ip_bind_lookup(net, addr->l2tp_addr.s_addr, 0,
284 sk->sk_bound_dev_if, addr->l2tp_conn_id)) { 277 sk->sk_bound_dev_if, addr->l2tp_conn_id)) {
285 write_unlock_bh(&l2tp_ip_lock); 278 write_unlock_bh(&l2tp_ip_lock);
286 ret = -EADDRINUSE; 279 ret = -EADDRINUSE;
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c
index f092ac441fdd..331ccf5a7bad 100644
--- a/net/l2tp/l2tp_ip6.c
+++ b/net/l2tp/l2tp_ip6.c
@@ -59,12 +59,14 @@ static inline struct l2tp_ip6_sock *l2tp_ip6_sk(const struct sock *sk)
59 59
60static struct sock *__l2tp_ip6_bind_lookup(struct net *net, 60static struct sock *__l2tp_ip6_bind_lookup(struct net *net,
61 struct in6_addr *laddr, 61 struct in6_addr *laddr,
62 const struct in6_addr *raddr,
62 int dif, u32 tunnel_id) 63 int dif, u32 tunnel_id)
63{ 64{
64 struct sock *sk; 65 struct sock *sk;
65 66
66 sk_for_each_bound(sk, &l2tp_ip6_bind_table) { 67 sk_for_each_bound(sk, &l2tp_ip6_bind_table) {
67 const struct in6_addr *addr = inet6_rcv_saddr(sk); 68 const struct in6_addr *sk_laddr = inet6_rcv_saddr(sk);
69 const struct in6_addr *sk_raddr = &sk->sk_v6_daddr;
68 struct l2tp_ip6_sock *l2tp = l2tp_ip6_sk(sk); 70 struct l2tp_ip6_sock *l2tp = l2tp_ip6_sk(sk);
69 71
70 if (l2tp == NULL) 72 if (l2tp == NULL)
@@ -72,7 +74,8 @@ static struct sock *__l2tp_ip6_bind_lookup(struct net *net,
72 74
73 if ((l2tp->conn_id == tunnel_id) && 75 if ((l2tp->conn_id == tunnel_id) &&
74 net_eq(sock_net(sk), net) && 76 net_eq(sock_net(sk), net) &&
75 (!addr || ipv6_addr_equal(addr, laddr)) && 77 (!sk_laddr || ipv6_addr_any(sk_laddr) || ipv6_addr_equal(sk_laddr, laddr)) &&
78 (!raddr || ipv6_addr_any(sk_raddr) || ipv6_addr_equal(sk_raddr, raddr)) &&
76 (!sk->sk_bound_dev_if || !dif || 79 (!sk->sk_bound_dev_if || !dif ||
77 sk->sk_bound_dev_if == dif)) 80 sk->sk_bound_dev_if == dif))
78 goto found; 81 goto found;
@@ -83,17 +86,6 @@ found:
83 return sk; 86 return sk;
84} 87}
85 88
86static inline struct sock *l2tp_ip6_bind_lookup(struct net *net,
87 struct in6_addr *laddr,
88 int dif, u32 tunnel_id)
89{
90 struct sock *sk = __l2tp_ip6_bind_lookup(net, laddr, dif, tunnel_id);
91 if (sk)
92 sock_hold(sk);
93
94 return sk;
95}
96
97/* When processing receive frames, there are two cases to 89/* When processing receive frames, there are two cases to
98 * consider. Data frames consist of a non-zero session-id and an 90 * consider. Data frames consist of a non-zero session-id and an
99 * optional cookie. Control frames consist of a regular L2TP header 91 * optional cookie. Control frames consist of a regular L2TP header
@@ -197,8 +189,8 @@ pass_up:
197 struct ipv6hdr *iph = ipv6_hdr(skb); 189 struct ipv6hdr *iph = ipv6_hdr(skb);
198 190
199 read_lock_bh(&l2tp_ip6_lock); 191 read_lock_bh(&l2tp_ip6_lock);
200 sk = __l2tp_ip6_bind_lookup(net, &iph->daddr, inet6_iif(skb), 192 sk = __l2tp_ip6_bind_lookup(net, &iph->daddr, &iph->saddr,
201 tunnel_id); 193 inet6_iif(skb), tunnel_id);
202 if (!sk) { 194 if (!sk) {
203 read_unlock_bh(&l2tp_ip6_lock); 195 read_unlock_bh(&l2tp_ip6_lock);
204 goto discard; 196 goto discard;
@@ -330,7 +322,7 @@ static int l2tp_ip6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
330 rcu_read_unlock(); 322 rcu_read_unlock();
331 323
332 write_lock_bh(&l2tp_ip6_lock); 324 write_lock_bh(&l2tp_ip6_lock);
333 if (__l2tp_ip6_bind_lookup(net, &addr->l2tp_addr, bound_dev_if, 325 if (__l2tp_ip6_bind_lookup(net, &addr->l2tp_addr, NULL, bound_dev_if,
334 addr->l2tp_conn_id)) { 326 addr->l2tp_conn_id)) {
335 write_unlock_bh(&l2tp_ip6_lock); 327 write_unlock_bh(&l2tp_ip6_lock);
336 err = -EADDRINUSE; 328 err = -EADDRINUSE;
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 2c21b7039136..0d8b716e509e 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -3287,7 +3287,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
3287 int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); 3287 int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2);
3288 int hw_headroom = sdata->local->hw.extra_tx_headroom; 3288 int hw_headroom = sdata->local->hw.extra_tx_headroom;
3289 struct ethhdr eth; 3289 struct ethhdr eth;
3290 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 3290 struct ieee80211_tx_info *info;
3291 struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; 3291 struct ieee80211_hdr *hdr = (void *)fast_tx->hdr;
3292 struct ieee80211_tx_data tx; 3292 struct ieee80211_tx_data tx;
3293 ieee80211_tx_result r; 3293 ieee80211_tx_result r;
@@ -3351,6 +3351,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
3351 memcpy(skb->data + fast_tx->da_offs, eth.h_dest, ETH_ALEN); 3351 memcpy(skb->data + fast_tx->da_offs, eth.h_dest, ETH_ALEN);
3352 memcpy(skb->data + fast_tx->sa_offs, eth.h_source, ETH_ALEN); 3352 memcpy(skb->data + fast_tx->sa_offs, eth.h_source, ETH_ALEN);
3353 3353
3354 info = IEEE80211_SKB_CB(skb);
3354 memset(info, 0, sizeof(*info)); 3355 memset(info, 0, sizeof(*info));
3355 info->band = fast_tx->band; 3356 info->band = fast_tx->band;
3356 info->control.vif = &sdata->vif; 3357 info->control.vif = &sdata->vif;
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 333f8e268431..970db7a41684 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -153,10 +153,14 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp,
153 153
154 switch (ip_tunnel_info_af(info)) { 154 switch (ip_tunnel_info_af(info)) {
155 case AF_INET: 155 case AF_INET:
156 skb_key.enc_control.addr_type =
157 FLOW_DISSECTOR_KEY_IPV4_ADDRS;
156 skb_key.enc_ipv4.src = key->u.ipv4.src; 158 skb_key.enc_ipv4.src = key->u.ipv4.src;
157 skb_key.enc_ipv4.dst = key->u.ipv4.dst; 159 skb_key.enc_ipv4.dst = key->u.ipv4.dst;
158 break; 160 break;
159 case AF_INET6: 161 case AF_INET6:
162 skb_key.enc_control.addr_type =
163 FLOW_DISSECTOR_KEY_IPV6_ADDRS;
160 skb_key.enc_ipv6.src = key->u.ipv6.src; 164 skb_key.enc_ipv6.src = key->u.ipv6.src;
161 skb_key.enc_ipv6.dst = key->u.ipv6.dst; 165 skb_key.enc_ipv6.dst = key->u.ipv6.dst;
162 break; 166 break;
diff --git a/net/socket.c b/net/socket.c
index 8487bf136e5c..a8c2307590b8 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -537,7 +537,7 @@ int sockfs_setattr(struct dentry *dentry, struct iattr *iattr)
537{ 537{
538 int err = simple_setattr(dentry, iattr); 538 int err = simple_setattr(dentry, iattr);
539 539
540 if (!err) { 540 if (!err && (iattr->ia_valid & ATTR_UID)) {
541 struct socket *sock = SOCKET_I(d_inode(dentry)); 541 struct socket *sock = SOCKET_I(d_inode(dentry));
542 542
543 sock->sk->sk_uid = iattr->ia_uid; 543 sock->sk->sk_uid = iattr->ia_uid;