aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-06-01 01:28:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-06-01 01:28:28 -0400
commit6b15d6650c5301ce023d8df0cc3a60b1a76d377e (patch)
tree6107020752729cf6faa4d6e06ad7f13818e416ea
parent58c1f9950ffc6acbb907051b0a4e56aaf4baa9ce (diff)
parentfaf8dcc12c2780bfec61eb95e5ad74af2ff4f82f (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix negative error code usage in ATM layer, from Stefan Hajnoczi. 2) If CONFIG_SYSCTL is disabled, the default TTL is not initialized properly. From Ezequiel Garcia. 3) Missing spinlock init in mvneta driver, from Gregory CLEMENT. 4) Missing unlocks in hwmb error paths, also from Gregory CLEMENT. 5) Fix deadlock on team->lock when propagating features, from Ivan Vecera. 6) Work around buffer offset hw bug in alx chips, from Feng Tang. 7) Fix double listing of SCTP entries in sctp_diag dumps, from Xin Long. 8) Various statistics bug fixes in mlx4 from Eric Dumazet. 9) Fix some randconfig build errors wrt fou ipv6 from Arnd Bergmann. 10) All of l2tp was namespace aware, but the ipv6 support code was not doing so. From Shmulik Ladkani. 11) Handle on-stack hrtimers properly in pktgen, from Guenter Roeck. 12) Propagate MAC changes properly through VLAN devices, from Mike Manning. 13) Fix memory leak in bnx2x_init_one(), from Vitaly Kuznetsov. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (62 commits) sfc: Track RPS flow IDs per channel instead of per function usbnet: smsc95xx: fix link detection for disabled autonegotiation virtio_net: fix virtnet_open and virtnet_probe competing for try_fill_recv bnx2x: avoid leaking memory on bnx2x_init_one() failures fou: fix IPv6 Kconfig options openvswitch: update checksum in {push,pop}_mpls sctp: sctp_diag should dump sctp socket type net: fec: update dirty_tx even if no skb vlan: Propagate MAC address to VLANs atm: iphase: off by one in rx_pkt() atm: firestream: add more reserved strings vxlan: Accept user specified MTU value when create new vxlan link net: pktgen: Call destroy_hrtimer_on_stack() timer: Export destroy_hrtimer_on_stack() net: l2tp: Make l2tp_ip6 namespace aware Documentation: ip-sysctl.txt: clarify secure_redirects sfc: use flow dissector helpers for aRFS ieee802154: fix logic error in ieee802154_llsec_parse_dev_addr net: nps_enet: Disable interrupts before napi reschedule net/lapb: tuse %*ph to dump buffers ...
-rw-r--r--Documentation/networking/dsa/dsa.txt17
-rw-r--r--Documentation/networking/ip-sysctl.txt8
-rw-r--r--MAINTAINERS1
-rw-r--r--drivers/atm/firestream.c6
-rw-r--r--drivers/atm/iphase.c2
-rw-r--r--drivers/net/ethernet/arc/emac_mdio.c2
-rw-r--r--drivers/net/ethernet/atheros/alx/alx.h4
-rw-r--r--drivers/net/ethernet/atheros/alx/main.c48
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c17
-rw-r--r--drivers/net/ethernet/ezchip/nps_enet.c4
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c8
-rw-r--r--drivers/net/ethernet/hisilicon/hns/hns_ethtool.c11
-rw-r--r--drivers/net/ethernet/marvell/mvneta_bm.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_ethtool.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c17
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_port.c18
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_tx.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4_en.h3
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_dcbx.c5
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_dev.c52
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_main.c18
-rw-r--r--drivers/net/ethernet/qlogic/qede/qede_ethtool.c5
-rw-r--r--drivers/net/ethernet/qlogic/qede/qede_main.c26
-rw-r--r--drivers/net/ethernet/qlogic/qlge/qlge_main.c3
-rw-r--r--drivers/net/ethernet/sfc/ef10.c16
-rw-r--r--drivers/net/ethernet/sfc/efx.c32
-rw-r--r--drivers/net/ethernet/sfc/net_driver.h12
-rw-r--r--drivers/net/ethernet/sfc/rx.c102
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c2
-rw-r--r--drivers/net/team/team.c9
-rw-r--r--drivers/net/usb/pegasus.c2
-rw-r--r--drivers/net/usb/smsc95xx.c51
-rw-r--r--drivers/net/virtio_net.c18
-rw-r--r--drivers/net/vxlan.c3
-rw-r--r--drivers/ptp/ptp_chardev.c12
-rw-r--r--include/linux/sctp.h2
-rw-r--r--include/net/ip6_tunnel.h3
-rw-r--r--include/net/pkt_sched.h1
-rw-r--r--include/uapi/linux/ethtool.h11
-rw-r--r--include/uapi/linux/pkt_cls.h4
-rw-r--r--kernel/bpf/inode.c1
-rw-r--r--kernel/time/hrtimer.c1
-rw-r--r--net/8021q/vlan.c5
-rw-r--r--net/8021q/vlan.h2
-rw-r--r--net/8021q/vlan_dev.c20
-rw-r--r--net/atm/signaling.c2
-rw-r--r--net/atm/svc.c4
-rw-r--r--net/core/hwbm.c3
-rw-r--r--net/core/pktgen.c8
-rw-r--r--net/ieee802154/nl802154.c4
-rw-r--r--net/ipv4/af_inet.c8
-rw-r--r--net/ipv4/sysctl_net_ipv4.c4
-rw-r--r--net/ipv6/Kconfig9
-rw-r--r--net/ipv6/Makefile2
-rw-r--r--net/ipv6/fou6.c2
-rw-r--r--net/ipv6/ip6_gre.c3
-rw-r--r--net/l2tp/l2tp_ip6.c12
-rw-r--r--net/lapb/lapb_in.c5
-rw-r--r--net/lapb/lapb_out.c4
-rw-r--r--net/lapb/lapb_subr.c14
-rw-r--r--net/openvswitch/actions.c20
-rw-r--r--net/sched/act_police.c11
-rw-r--r--net/sched/sch_api.c4
-rw-r--r--net/sched/sch_htb.c13
-rw-r--r--net/sctp/sctp_diag.c3
-rw-r--r--net/sctp/socket.c1
-rw-r--r--net/tipc/netlink_compat.c111
67 files changed, 580 insertions, 262 deletions
diff --git a/Documentation/networking/dsa/dsa.txt b/Documentation/networking/dsa/dsa.txt
index 631b0f7ae16f..9d05ed7f7da5 100644
--- a/Documentation/networking/dsa/dsa.txt
+++ b/Documentation/networking/dsa/dsa.txt
@@ -369,8 +369,6 @@ does not allocate any driver private context space.
369Switch configuration 369Switch configuration
370-------------------- 370--------------------
371 371
372- priv_size: additional size needed by the switch driver for its private context
373
374- tag_protocol: this is to indicate what kind of tagging protocol is supported, 372- tag_protocol: this is to indicate what kind of tagging protocol is supported,
375 should be a valid value from the dsa_tag_protocol enum 373 should be a valid value from the dsa_tag_protocol enum
376 374
@@ -416,11 +414,6 @@ PHY devices and link management
416 to the switch port MDIO registers. If unavailable return a negative error 414 to the switch port MDIO registers. If unavailable return a negative error
417 code. 415 code.
418 416
419- poll_link: Function invoked by DSA to query the link state of the switch
420 builtin Ethernet PHYs, per port. This function is responsible for calling
421 netif_carrier_{on,off} when appropriate, and can be used to poll all ports in a
422 single call. Executes from workqueue context.
423
424- adjust_link: Function invoked by the PHY library when a slave network device 417- adjust_link: Function invoked by the PHY library when a slave network device
425 is attached to a PHY device. This function is responsible for appropriately 418 is attached to a PHY device. This function is responsible for appropriately
426 configuring the switch port link parameters: speed, duplex, pause based on 419 configuring the switch port link parameters: speed, duplex, pause based on
@@ -542,6 +535,16 @@ Bridge layer
542Bridge VLAN filtering 535Bridge VLAN filtering
543--------------------- 536---------------------
544 537
538- port_vlan_filtering: bridge layer function invoked when the bridge gets
539 configured for turning on or off VLAN filtering. If nothing specific needs to
540 be done at the hardware level, this callback does not need to be implemented.
541 When VLAN filtering is turned on, the hardware must be programmed with
542 rejecting 802.1Q frames which have VLAN IDs outside of the programmed allowed
543 VLAN ID map/rules. If there is no PVID programmed into the switch port,
544 untagged frames must be rejected as well. When turned off the switch must
545 accept any 802.1Q frames irrespective of their VLAN ID, and untagged frames are
546 allowed.
547
545- port_vlan_prepare: bridge layer function invoked when the bridge prepares the 548- port_vlan_prepare: bridge layer function invoked when the bridge prepares the
546 configuration of a VLAN on the given port. If the operation is not supported 549 configuration of a VLAN on the given port. If the operation is not supported
547 by the hardware, this function should return -EOPNOTSUPP to inform the bridge 550 by the hardware, this function should return -EOPNOTSUPP to inform the bridge
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index 6c7f365b1515..9ae929395b24 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -1036,15 +1036,17 @@ proxy_arp_pvlan - BOOLEAN
1036 1036
1037shared_media - BOOLEAN 1037shared_media - BOOLEAN
1038 Send(router) or accept(host) RFC1620 shared media redirects. 1038 Send(router) or accept(host) RFC1620 shared media redirects.
1039 Overrides ip_secure_redirects. 1039 Overrides secure_redirects.
1040 shared_media for the interface will be enabled if at least one of 1040 shared_media for the interface will be enabled if at least one of
1041 conf/{all,interface}/shared_media is set to TRUE, 1041 conf/{all,interface}/shared_media is set to TRUE,
1042 it will be disabled otherwise 1042 it will be disabled otherwise
1043 default TRUE 1043 default TRUE
1044 1044
1045secure_redirects - BOOLEAN 1045secure_redirects - BOOLEAN
1046 Accept ICMP redirect messages only for gateways, 1046 Accept ICMP redirect messages only to gateways listed in the
1047 listed in default gateway list. 1047 interface's current gateway list. Even if disabled, RFC1122 redirect
1048 rules still apply.
1049 Overridden by shared_media.
1048 secure_redirects for the interface will be enabled if at least one of 1050 secure_redirects for the interface will be enabled if at least one of
1049 conf/{all,interface}/secure_redirects is set to TRUE, 1051 conf/{all,interface}/secure_redirects is set to TRUE,
1050 it will be disabled otherwise 1052 it will be disabled otherwise
diff --git a/MAINTAINERS b/MAINTAINERS
index 7304d2e37a98..f8d5a3772e47 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7989,6 +7989,7 @@ Q: http://patchwork.ozlabs.org/project/netdev/list/
7989T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 7989T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
7990T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 7990T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
7991S: Odd Fixes 7991S: Odd Fixes
7992F: Documentation/devicetree/bindings/net/
7992F: drivers/net/ 7993F: drivers/net/
7993F: include/linux/if_* 7994F: include/linux/if_*
7994F: include/linux/netdevice.h 7995F: include/linux/netdevice.h
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index a969a7e443be..85aaf2222587 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -181,13 +181,17 @@ static char *res_strings[] = {
181 "reserved 27", 181 "reserved 27",
182 "reserved 28", 182 "reserved 28",
183 "reserved 29", 183 "reserved 29",
184 "reserved 30", 184 "reserved 30", /* FIXME: The strings between 30-40 might be wrong. */
185 "reassembly abort: no buffers", 185 "reassembly abort: no buffers",
186 "receive buffer overflow", 186 "receive buffer overflow",
187 "change in GFC", 187 "change in GFC",
188 "receive buffer full", 188 "receive buffer full",
189 "low priority discard - no receive descriptor", 189 "low priority discard - no receive descriptor",
190 "low priority discard - missing end of packet", 190 "low priority discard - missing end of packet",
191 "reserved 37",
192 "reserved 38",
193 "reserved 39",
194 "reseverd 40",
191 "reserved 41", 195 "reserved 41",
192 "reserved 42", 196 "reserved 42",
193 "reserved 43", 197 "reserved 43",
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index 7d00f2994738..809dd1e02091 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -1128,7 +1128,7 @@ static int rx_pkt(struct atm_dev *dev)
1128 /* make the ptr point to the corresponding buffer desc entry */ 1128 /* make the ptr point to the corresponding buffer desc entry */
1129 buf_desc_ptr += desc; 1129 buf_desc_ptr += desc;
1130 if (!desc || (desc > iadev->num_rx_desc) || 1130 if (!desc || (desc > iadev->num_rx_desc) ||
1131 ((buf_desc_ptr->vc_index & 0xffff) > iadev->num_vc)) { 1131 ((buf_desc_ptr->vc_index & 0xffff) >= iadev->num_vc)) {
1132 free_desc(dev, desc); 1132 free_desc(dev, desc);
1133 IF_ERR(printk("IA: bad descriptor desc = %d \n", desc);) 1133 IF_ERR(printk("IA: bad descriptor desc = %d \n", desc);)
1134 return -1; 1134 return -1;
diff --git a/drivers/net/ethernet/arc/emac_mdio.c b/drivers/net/ethernet/arc/emac_mdio.c
index 16419f550eff..058460bdd5a6 100644
--- a/drivers/net/ethernet/arc/emac_mdio.c
+++ b/drivers/net/ethernet/arc/emac_mdio.c
@@ -141,7 +141,7 @@ int arc_mdio_probe(struct arc_emac_priv *priv)
141 priv->bus = bus; 141 priv->bus = bus;
142 bus->priv = priv; 142 bus->priv = priv;
143 bus->parent = priv->dev; 143 bus->parent = priv->dev;
144 bus->name = "Synopsys MII Bus", 144 bus->name = "Synopsys MII Bus";
145 bus->read = &arc_mdio_read; 145 bus->read = &arc_mdio_read;
146 bus->write = &arc_mdio_write; 146 bus->write = &arc_mdio_write;
147 bus->reset = &arc_mdio_reset; 147 bus->reset = &arc_mdio_reset;
diff --git a/drivers/net/ethernet/atheros/alx/alx.h b/drivers/net/ethernet/atheros/alx/alx.h
index 8fc93c5f6abc..d02c4240b7df 100644
--- a/drivers/net/ethernet/atheros/alx/alx.h
+++ b/drivers/net/ethernet/atheros/alx/alx.h
@@ -96,6 +96,10 @@ struct alx_priv {
96 unsigned int rx_ringsz; 96 unsigned int rx_ringsz;
97 unsigned int rxbuf_size; 97 unsigned int rxbuf_size;
98 98
99 struct page *rx_page;
100 unsigned int rx_page_offset;
101 unsigned int rx_frag_size;
102
99 struct napi_struct napi; 103 struct napi_struct napi;
100 struct alx_tx_queue txq; 104 struct alx_tx_queue txq;
101 struct alx_rx_queue rxq; 105 struct alx_rx_queue rxq;
diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
index 9fe8b5e310d1..c98acdc0d14f 100644
--- a/drivers/net/ethernet/atheros/alx/main.c
+++ b/drivers/net/ethernet/atheros/alx/main.c
@@ -70,6 +70,35 @@ static void alx_free_txbuf(struct alx_priv *alx, int entry)
70 } 70 }
71} 71}
72 72
73static struct sk_buff *alx_alloc_skb(struct alx_priv *alx, gfp_t gfp)
74{
75 struct sk_buff *skb;
76 struct page *page;
77
78 if (alx->rx_frag_size > PAGE_SIZE)
79 return __netdev_alloc_skb(alx->dev, alx->rxbuf_size, gfp);
80
81 page = alx->rx_page;
82 if (!page) {
83 alx->rx_page = page = alloc_page(gfp);
84 if (unlikely(!page))
85 return NULL;
86 alx->rx_page_offset = 0;
87 }
88
89 skb = build_skb(page_address(page) + alx->rx_page_offset,
90 alx->rx_frag_size);
91 if (likely(skb)) {
92 alx->rx_page_offset += alx->rx_frag_size;
93 if (alx->rx_page_offset >= PAGE_SIZE)
94 alx->rx_page = NULL;
95 else
96 get_page(page);
97 }
98 return skb;
99}
100
101
73static int alx_refill_rx_ring(struct alx_priv *alx, gfp_t gfp) 102static int alx_refill_rx_ring(struct alx_priv *alx, gfp_t gfp)
74{ 103{
75 struct alx_rx_queue *rxq = &alx->rxq; 104 struct alx_rx_queue *rxq = &alx->rxq;
@@ -86,7 +115,7 @@ static int alx_refill_rx_ring(struct alx_priv *alx, gfp_t gfp)
86 while (!cur_buf->skb && next != rxq->read_idx) { 115 while (!cur_buf->skb && next != rxq->read_idx) {
87 struct alx_rfd *rfd = &rxq->rfd[cur]; 116 struct alx_rfd *rfd = &rxq->rfd[cur];
88 117
89 skb = __netdev_alloc_skb(alx->dev, alx->rxbuf_size, gfp); 118 skb = alx_alloc_skb(alx, gfp);
90 if (!skb) 119 if (!skb)
91 break; 120 break;
92 dma = dma_map_single(&alx->hw.pdev->dev, 121 dma = dma_map_single(&alx->hw.pdev->dev,
@@ -124,6 +153,7 @@ static int alx_refill_rx_ring(struct alx_priv *alx, gfp_t gfp)
124 alx_write_mem16(&alx->hw, ALX_RFD_PIDX, cur); 153 alx_write_mem16(&alx->hw, ALX_RFD_PIDX, cur);
125 } 154 }
126 155
156
127 return count; 157 return count;
128} 158}
129 159
@@ -592,6 +622,11 @@ static void alx_free_rings(struct alx_priv *alx)
592 kfree(alx->txq.bufs); 622 kfree(alx->txq.bufs);
593 kfree(alx->rxq.bufs); 623 kfree(alx->rxq.bufs);
594 624
625 if (alx->rx_page) {
626 put_page(alx->rx_page);
627 alx->rx_page = NULL;
628 }
629
595 dma_free_coherent(&alx->hw.pdev->dev, 630 dma_free_coherent(&alx->hw.pdev->dev,
596 alx->descmem.size, 631 alx->descmem.size,
597 alx->descmem.virt, 632 alx->descmem.virt,
@@ -646,6 +681,7 @@ static int alx_request_irq(struct alx_priv *alx)
646 alx->dev->name, alx); 681 alx->dev->name, alx);
647 if (!err) 682 if (!err)
648 goto out; 683 goto out;
684
649 /* fall back to legacy interrupt */ 685 /* fall back to legacy interrupt */
650 pci_disable_msi(alx->hw.pdev); 686 pci_disable_msi(alx->hw.pdev);
651 } 687 }
@@ -689,6 +725,7 @@ static int alx_init_sw(struct alx_priv *alx)
689 struct pci_dev *pdev = alx->hw.pdev; 725 struct pci_dev *pdev = alx->hw.pdev;
690 struct alx_hw *hw = &alx->hw; 726 struct alx_hw *hw = &alx->hw;
691 int err; 727 int err;
728 unsigned int head_size;
692 729
693 err = alx_identify_hw(alx); 730 err = alx_identify_hw(alx);
694 if (err) { 731 if (err) {
@@ -704,7 +741,12 @@ static int alx_init_sw(struct alx_priv *alx)
704 741
705 hw->smb_timer = 400; 742 hw->smb_timer = 400;
706 hw->mtu = alx->dev->mtu; 743 hw->mtu = alx->dev->mtu;
744
707 alx->rxbuf_size = ALX_MAX_FRAME_LEN(hw->mtu); 745 alx->rxbuf_size = ALX_MAX_FRAME_LEN(hw->mtu);
746 head_size = SKB_DATA_ALIGN(alx->rxbuf_size + NET_SKB_PAD) +
747 SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
748 alx->rx_frag_size = roundup_pow_of_two(head_size);
749
708 alx->tx_ringsz = 256; 750 alx->tx_ringsz = 256;
709 alx->rx_ringsz = 512; 751 alx->rx_ringsz = 512;
710 hw->imt = 200; 752 hw->imt = 200;
@@ -806,6 +848,7 @@ static int alx_change_mtu(struct net_device *netdev, int mtu)
806{ 848{
807 struct alx_priv *alx = netdev_priv(netdev); 849 struct alx_priv *alx = netdev_priv(netdev);
808 int max_frame = ALX_MAX_FRAME_LEN(mtu); 850 int max_frame = ALX_MAX_FRAME_LEN(mtu);
851 unsigned int head_size;
809 852
810 if ((max_frame < ALX_MIN_FRAME_SIZE) || 853 if ((max_frame < ALX_MIN_FRAME_SIZE) ||
811 (max_frame > ALX_MAX_FRAME_SIZE)) 854 (max_frame > ALX_MAX_FRAME_SIZE))
@@ -817,6 +860,9 @@ static int alx_change_mtu(struct net_device *netdev, int mtu)
817 netdev->mtu = mtu; 860 netdev->mtu = mtu;
818 alx->hw.mtu = mtu; 861 alx->hw.mtu = mtu;
819 alx->rxbuf_size = max(max_frame, ALX_DEF_RXBUF_SIZE); 862 alx->rxbuf_size = max(max_frame, ALX_DEF_RXBUF_SIZE);
863 head_size = SKB_DATA_ALIGN(alx->rxbuf_size + NET_SKB_PAD) +
864 SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
865 alx->rx_frag_size = roundup_pow_of_two(head_size);
820 netdev_update_features(netdev); 866 netdev_update_features(netdev);
821 if (netif_running(netdev)) 867 if (netif_running(netdev))
822 alx_reinit(alx); 868 alx_reinit(alx);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 0a5b770cefaa..c5fe915870ad 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -13941,14 +13941,14 @@ static int bnx2x_init_one(struct pci_dev *pdev,
13941 bp->doorbells = bnx2x_vf_doorbells(bp); 13941 bp->doorbells = bnx2x_vf_doorbells(bp);
13942 rc = bnx2x_vf_pci_alloc(bp); 13942 rc = bnx2x_vf_pci_alloc(bp);
13943 if (rc) 13943 if (rc)
13944 goto init_one_exit; 13944 goto init_one_freemem;
13945 } else { 13945 } else {
13946 doorbell_size = BNX2X_L2_MAX_CID(bp) * (1 << BNX2X_DB_SHIFT); 13946 doorbell_size = BNX2X_L2_MAX_CID(bp) * (1 << BNX2X_DB_SHIFT);
13947 if (doorbell_size > pci_resource_len(pdev, 2)) { 13947 if (doorbell_size > pci_resource_len(pdev, 2)) {
13948 dev_err(&bp->pdev->dev, 13948 dev_err(&bp->pdev->dev,
13949 "Cannot map doorbells, bar size too small, aborting\n"); 13949 "Cannot map doorbells, bar size too small, aborting\n");
13950 rc = -ENOMEM; 13950 rc = -ENOMEM;
13951 goto init_one_exit; 13951 goto init_one_freemem;
13952 } 13952 }
13953 bp->doorbells = ioremap_nocache(pci_resource_start(pdev, 2), 13953 bp->doorbells = ioremap_nocache(pci_resource_start(pdev, 2),
13954 doorbell_size); 13954 doorbell_size);
@@ -13957,19 +13957,19 @@ static int bnx2x_init_one(struct pci_dev *pdev,
13957 dev_err(&bp->pdev->dev, 13957 dev_err(&bp->pdev->dev,
13958 "Cannot map doorbell space, aborting\n"); 13958 "Cannot map doorbell space, aborting\n");
13959 rc = -ENOMEM; 13959 rc = -ENOMEM;
13960 goto init_one_exit; 13960 goto init_one_freemem;
13961 } 13961 }
13962 13962
13963 if (IS_VF(bp)) { 13963 if (IS_VF(bp)) {
13964 rc = bnx2x_vfpf_acquire(bp, tx_count, rx_count); 13964 rc = bnx2x_vfpf_acquire(bp, tx_count, rx_count);
13965 if (rc) 13965 if (rc)
13966 goto init_one_exit; 13966 goto init_one_freemem;
13967 } 13967 }
13968 13968
13969 /* Enable SRIOV if capability found in configuration space */ 13969 /* Enable SRIOV if capability found in configuration space */
13970 rc = bnx2x_iov_init_one(bp, int_mode, BNX2X_MAX_NUM_OF_VFS); 13970 rc = bnx2x_iov_init_one(bp, int_mode, BNX2X_MAX_NUM_OF_VFS);
13971 if (rc) 13971 if (rc)
13972 goto init_one_exit; 13972 goto init_one_freemem;
13973 13973
13974 /* calc qm_cid_count */ 13974 /* calc qm_cid_count */
13975 bp->qm_cid_count = bnx2x_set_qm_cid_count(bp); 13975 bp->qm_cid_count = bnx2x_set_qm_cid_count(bp);
@@ -13988,7 +13988,7 @@ static int bnx2x_init_one(struct pci_dev *pdev,
13988 rc = bnx2x_set_int_mode(bp); 13988 rc = bnx2x_set_int_mode(bp);
13989 if (rc) { 13989 if (rc) {
13990 dev_err(&pdev->dev, "Cannot set interrupts\n"); 13990 dev_err(&pdev->dev, "Cannot set interrupts\n");
13991 goto init_one_exit; 13991 goto init_one_freemem;
13992 } 13992 }
13993 BNX2X_DEV_INFO("set interrupts successfully\n"); 13993 BNX2X_DEV_INFO("set interrupts successfully\n");
13994 13994
@@ -13996,7 +13996,7 @@ static int bnx2x_init_one(struct pci_dev *pdev,
13996 rc = register_netdev(dev); 13996 rc = register_netdev(dev);
13997 if (rc) { 13997 if (rc) {
13998 dev_err(&pdev->dev, "Cannot register net device\n"); 13998 dev_err(&pdev->dev, "Cannot register net device\n");
13999 goto init_one_exit; 13999 goto init_one_freemem;
14000 } 14000 }
14001 BNX2X_DEV_INFO("device name after netdev register %s\n", dev->name); 14001 BNX2X_DEV_INFO("device name after netdev register %s\n", dev->name);
14002 14002
@@ -14029,6 +14029,9 @@ static int bnx2x_init_one(struct pci_dev *pdev,
14029 14029
14030 return 0; 14030 return 0;
14031 14031
14032init_one_freemem:
14033 bnx2x_free_mem_bp(bp);
14034
14032init_one_exit: 14035init_one_exit:
14033 bnx2x_disable_pcie_error_reporting(bp); 14036 bnx2x_disable_pcie_error_reporting(bp);
14034 14037
diff --git a/drivers/net/ethernet/ezchip/nps_enet.c b/drivers/net/ethernet/ezchip/nps_enet.c
index 085f9125cf42..06f031715b57 100644
--- a/drivers/net/ethernet/ezchip/nps_enet.c
+++ b/drivers/net/ethernet/ezchip/nps_enet.c
@@ -205,8 +205,10 @@ static int nps_enet_poll(struct napi_struct *napi, int budget)
205 * re-adding ourselves to the poll list. 205 * re-adding ourselves to the poll list.
206 */ 206 */
207 207
208 if (priv->tx_skb && !tx_ctrl_ct) 208 if (priv->tx_skb && !tx_ctrl_ct) {
209 nps_enet_reg_set(priv, NPS_ENET_REG_BUF_INT_ENABLE, 0);
209 napi_reschedule(napi); 210 napi_reschedule(napi);
211 }
210 } 212 }
211 213
212 return work_done; 214 return work_done;
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index ca2cccc594fd..3c0255e98535 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1197,10 +1197,8 @@ fec_enet_tx_queue(struct net_device *ndev, u16 queue_id)
1197 fec16_to_cpu(bdp->cbd_datlen), 1197 fec16_to_cpu(bdp->cbd_datlen),
1198 DMA_TO_DEVICE); 1198 DMA_TO_DEVICE);
1199 bdp->cbd_bufaddr = cpu_to_fec32(0); 1199 bdp->cbd_bufaddr = cpu_to_fec32(0);
1200 if (!skb) { 1200 if (!skb)
1201 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); 1201 goto skb_done;
1202 continue;
1203 }
1204 1202
1205 /* Check for errors. */ 1203 /* Check for errors. */
1206 if (status & (BD_ENET_TX_HB | BD_ENET_TX_LC | 1204 if (status & (BD_ENET_TX_HB | BD_ENET_TX_LC |
@@ -1239,7 +1237,7 @@ fec_enet_tx_queue(struct net_device *ndev, u16 queue_id)
1239 1237
1240 /* Free the sk buffer associated with this last transmit */ 1238 /* Free the sk buffer associated with this last transmit */
1241 dev_kfree_skb_any(skb); 1239 dev_kfree_skb_any(skb);
1242 1240skb_done:
1243 /* Make sure the update to bdp and tx_skbuff are performed 1241 /* Make sure the update to bdp and tx_skbuff are performed
1244 * before dirty_tx 1242 * before dirty_tx
1245 */ 1243 */
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
index 3d746c887873..67a648c7d3a9 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
@@ -46,7 +46,6 @@ static u32 hns_nic_get_link(struct net_device *net_dev)
46 u32 link_stat = priv->link; 46 u32 link_stat = priv->link;
47 struct hnae_handle *h; 47 struct hnae_handle *h;
48 48
49 assert(priv && priv->ae_handle);
50 h = priv->ae_handle; 49 h = priv->ae_handle;
51 50
52 if (priv->phy) { 51 if (priv->phy) {
@@ -646,8 +645,6 @@ static void hns_nic_get_drvinfo(struct net_device *net_dev,
646{ 645{
647 struct hns_nic_priv *priv = netdev_priv(net_dev); 646 struct hns_nic_priv *priv = netdev_priv(net_dev);
648 647
649 assert(priv);
650
651 strncpy(drvinfo->version, HNAE_DRIVER_VERSION, 648 strncpy(drvinfo->version, HNAE_DRIVER_VERSION,
652 sizeof(drvinfo->version)); 649 sizeof(drvinfo->version));
653 drvinfo->version[sizeof(drvinfo->version) - 1] = '\0'; 650 drvinfo->version[sizeof(drvinfo->version) - 1] = '\0';
@@ -720,8 +717,6 @@ static int hns_set_pauseparam(struct net_device *net_dev,
720 struct hnae_handle *h; 717 struct hnae_handle *h;
721 struct hnae_ae_ops *ops; 718 struct hnae_ae_ops *ops;
722 719
723 assert(priv || priv->ae_handle);
724
725 h = priv->ae_handle; 720 h = priv->ae_handle;
726 ops = h->dev->ops; 721 ops = h->dev->ops;
727 722
@@ -780,8 +775,6 @@ static int hns_set_coalesce(struct net_device *net_dev,
780 struct hnae_ae_ops *ops; 775 struct hnae_ae_ops *ops;
781 int ret; 776 int ret;
782 777
783 assert(priv || priv->ae_handle);
784
785 ops = priv->ae_handle->dev->ops; 778 ops = priv->ae_handle->dev->ops;
786 779
787 if (ec->tx_coalesce_usecs != ec->rx_coalesce_usecs) 780 if (ec->tx_coalesce_usecs != ec->rx_coalesce_usecs)
@@ -1111,8 +1104,6 @@ void hns_get_regs(struct net_device *net_dev, struct ethtool_regs *cmd,
1111 struct hns_nic_priv *priv = netdev_priv(net_dev); 1104 struct hns_nic_priv *priv = netdev_priv(net_dev);
1112 struct hnae_ae_ops *ops; 1105 struct hnae_ae_ops *ops;
1113 1106
1114 assert(priv || priv->ae_handle);
1115
1116 ops = priv->ae_handle->dev->ops; 1107 ops = priv->ae_handle->dev->ops;
1117 1108
1118 cmd->version = HNS_CHIP_VERSION; 1109 cmd->version = HNS_CHIP_VERSION;
@@ -1135,8 +1126,6 @@ static int hns_get_regs_len(struct net_device *net_dev)
1135 struct hns_nic_priv *priv = netdev_priv(net_dev); 1126 struct hns_nic_priv *priv = netdev_priv(net_dev);
1136 struct hnae_ae_ops *ops; 1127 struct hnae_ae_ops *ops;
1137 1128
1138 assert(priv || priv->ae_handle);
1139
1140 ops = priv->ae_handle->dev->ops; 1129 ops = priv->ae_handle->dev->ops;
1141 if (!ops->get_regs_len) { 1130 if (!ops->get_regs_len) {
1142 netdev_err(net_dev, "ops->get_regs_len is null!\n"); 1131 netdev_err(net_dev, "ops->get_regs_len is null!\n");
diff --git a/drivers/net/ethernet/marvell/mvneta_bm.c b/drivers/net/ethernet/marvell/mvneta_bm.c
index 01fccec632ec..466939f8f0cf 100644
--- a/drivers/net/ethernet/marvell/mvneta_bm.c
+++ b/drivers/net/ethernet/marvell/mvneta_bm.c
@@ -189,6 +189,7 @@ struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv, u8 pool_id,
189 SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); 189 SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
190 hwbm_pool->construct = mvneta_bm_construct; 190 hwbm_pool->construct = mvneta_bm_construct;
191 hwbm_pool->priv = new_pool; 191 hwbm_pool->priv = new_pool;
192 spin_lock_init(&hwbm_pool->lock);
192 193
193 /* Create new pool */ 194 /* Create new pool */
194 err = mvneta_bm_pool_create(priv, new_pool); 195 err = mvneta_bm_pool_create(priv, new_pool);
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index c761194bb323..fc95affaf76b 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -362,7 +362,7 @@ static void mlx4_en_get_ethtool_stats(struct net_device *dev,
362 362
363 for (i = 0; i < NUM_MAIN_STATS; i++, bitmap_iterator_inc(&it)) 363 for (i = 0; i < NUM_MAIN_STATS; i++, bitmap_iterator_inc(&it))
364 if (bitmap_iterator_test(&it)) 364 if (bitmap_iterator_test(&it))
365 data[index++] = ((unsigned long *)&priv->stats)[i]; 365 data[index++] = ((unsigned long *)&dev->stats)[i];
366 366
367 for (i = 0; i < NUM_PORT_STATS; i++, bitmap_iterator_inc(&it)) 367 for (i = 0; i < NUM_PORT_STATS; i++, bitmap_iterator_inc(&it))
368 if (bitmap_iterator_test(&it)) 368 if (bitmap_iterator_test(&it))
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 92e0624f4cf0..19ceced6736c 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -1296,15 +1296,16 @@ static void mlx4_en_tx_timeout(struct net_device *dev)
1296} 1296}
1297 1297
1298 1298
1299static struct net_device_stats *mlx4_en_get_stats(struct net_device *dev) 1299static struct rtnl_link_stats64 *
1300mlx4_en_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
1300{ 1301{
1301 struct mlx4_en_priv *priv = netdev_priv(dev); 1302 struct mlx4_en_priv *priv = netdev_priv(dev);
1302 1303
1303 spin_lock_bh(&priv->stats_lock); 1304 spin_lock_bh(&priv->stats_lock);
1304 memcpy(&priv->ret_stats, &priv->stats, sizeof(priv->stats)); 1305 netdev_stats_to_stats64(stats, &dev->stats);
1305 spin_unlock_bh(&priv->stats_lock); 1306 spin_unlock_bh(&priv->stats_lock);
1306 1307
1307 return &priv->ret_stats; 1308 return stats;
1308} 1309}
1309 1310
1310static void mlx4_en_set_default_moderation(struct mlx4_en_priv *priv) 1311static void mlx4_en_set_default_moderation(struct mlx4_en_priv *priv)
@@ -1876,7 +1877,6 @@ static void mlx4_en_clear_stats(struct net_device *dev)
1876 if (mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 1)) 1877 if (mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 1))
1877 en_dbg(HW, priv, "Failed dumping statistics\n"); 1878 en_dbg(HW, priv, "Failed dumping statistics\n");
1878 1879
1879 memset(&priv->stats, 0, sizeof(priv->stats));
1880 memset(&priv->pstats, 0, sizeof(priv->pstats)); 1880 memset(&priv->pstats, 0, sizeof(priv->pstats));
1881 memset(&priv->pkstats, 0, sizeof(priv->pkstats)); 1881 memset(&priv->pkstats, 0, sizeof(priv->pkstats));
1882 memset(&priv->port_stats, 0, sizeof(priv->port_stats)); 1882 memset(&priv->port_stats, 0, sizeof(priv->port_stats));
@@ -1892,6 +1892,11 @@ static void mlx4_en_clear_stats(struct net_device *dev)
1892 priv->tx_ring[i]->bytes = 0; 1892 priv->tx_ring[i]->bytes = 0;
1893 priv->tx_ring[i]->packets = 0; 1893 priv->tx_ring[i]->packets = 0;
1894 priv->tx_ring[i]->tx_csum = 0; 1894 priv->tx_ring[i]->tx_csum = 0;
1895 priv->tx_ring[i]->tx_dropped = 0;
1896 priv->tx_ring[i]->queue_stopped = 0;
1897 priv->tx_ring[i]->wake_queue = 0;
1898 priv->tx_ring[i]->tso_packets = 0;
1899 priv->tx_ring[i]->xmit_more = 0;
1895 } 1900 }
1896 for (i = 0; i < priv->rx_ring_num; i++) { 1901 for (i = 0; i < priv->rx_ring_num; i++) {
1897 priv->rx_ring[i]->bytes = 0; 1902 priv->rx_ring[i]->bytes = 0;
@@ -2482,7 +2487,7 @@ static const struct net_device_ops mlx4_netdev_ops = {
2482 .ndo_stop = mlx4_en_close, 2487 .ndo_stop = mlx4_en_close,
2483 .ndo_start_xmit = mlx4_en_xmit, 2488 .ndo_start_xmit = mlx4_en_xmit,
2484 .ndo_select_queue = mlx4_en_select_queue, 2489 .ndo_select_queue = mlx4_en_select_queue,
2485 .ndo_get_stats = mlx4_en_get_stats, 2490 .ndo_get_stats64 = mlx4_en_get_stats64,
2486 .ndo_set_rx_mode = mlx4_en_set_rx_mode, 2491 .ndo_set_rx_mode = mlx4_en_set_rx_mode,
2487 .ndo_set_mac_address = mlx4_en_set_mac, 2492 .ndo_set_mac_address = mlx4_en_set_mac,
2488 .ndo_validate_addr = eth_validate_addr, 2493 .ndo_validate_addr = eth_validate_addr,
@@ -2514,7 +2519,7 @@ static const struct net_device_ops mlx4_netdev_ops_master = {
2514 .ndo_stop = mlx4_en_close, 2519 .ndo_stop = mlx4_en_close,
2515 .ndo_start_xmit = mlx4_en_xmit, 2520 .ndo_start_xmit = mlx4_en_xmit,
2516 .ndo_select_queue = mlx4_en_select_queue, 2521 .ndo_select_queue = mlx4_en_select_queue,
2517 .ndo_get_stats = mlx4_en_get_stats, 2522 .ndo_get_stats64 = mlx4_en_get_stats64,
2518 .ndo_set_rx_mode = mlx4_en_set_rx_mode, 2523 .ndo_set_rx_mode = mlx4_en_set_rx_mode,
2519 .ndo_set_mac_address = mlx4_en_set_mac, 2524 .ndo_set_mac_address = mlx4_en_set_mac,
2520 .ndo_validate_addr = eth_validate_addr, 2525 .ndo_validate_addr = eth_validate_addr,
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_port.c b/drivers/net/ethernet/mellanox/mlx4/en_port.c
index 20b6c2e678b8..5aa8b751f417 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_port.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_port.c
@@ -152,8 +152,9 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
152 struct mlx4_counter tmp_counter_stats; 152 struct mlx4_counter tmp_counter_stats;
153 struct mlx4_en_stat_out_mbox *mlx4_en_stats; 153 struct mlx4_en_stat_out_mbox *mlx4_en_stats;
154 struct mlx4_en_stat_out_flow_control_mbox *flowstats; 154 struct mlx4_en_stat_out_flow_control_mbox *flowstats;
155 struct mlx4_en_priv *priv = netdev_priv(mdev->pndev[port]); 155 struct net_device *dev = mdev->pndev[port];
156 struct net_device_stats *stats = &priv->stats; 156 struct mlx4_en_priv *priv = netdev_priv(dev);
157 struct net_device_stats *stats = &dev->stats;
157 struct mlx4_cmd_mailbox *mailbox; 158 struct mlx4_cmd_mailbox *mailbox;
158 u64 in_mod = reset << 8 | port; 159 u64 in_mod = reset << 8 | port;
159 int err; 160 int err;
@@ -188,6 +189,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
188 } 189 }
189 stats->tx_packets = 0; 190 stats->tx_packets = 0;
190 stats->tx_bytes = 0; 191 stats->tx_bytes = 0;
192 stats->tx_dropped = 0;
191 priv->port_stats.tx_chksum_offload = 0; 193 priv->port_stats.tx_chksum_offload = 0;
192 priv->port_stats.queue_stopped = 0; 194 priv->port_stats.queue_stopped = 0;
193 priv->port_stats.wake_queue = 0; 195 priv->port_stats.wake_queue = 0;
@@ -199,6 +201,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
199 201
200 stats->tx_packets += ring->packets; 202 stats->tx_packets += ring->packets;
201 stats->tx_bytes += ring->bytes; 203 stats->tx_bytes += ring->bytes;
204 stats->tx_dropped += ring->tx_dropped;
202 priv->port_stats.tx_chksum_offload += ring->tx_csum; 205 priv->port_stats.tx_chksum_offload += ring->tx_csum;
203 priv->port_stats.queue_stopped += ring->queue_stopped; 206 priv->port_stats.queue_stopped += ring->queue_stopped;
204 priv->port_stats.wake_queue += ring->wake_queue; 207 priv->port_stats.wake_queue += ring->wake_queue;
@@ -237,21 +240,12 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
237 stats->multicast = en_stats_adder(&mlx4_en_stats->MCAST_prio_0, 240 stats->multicast = en_stats_adder(&mlx4_en_stats->MCAST_prio_0,
238 &mlx4_en_stats->MCAST_prio_1, 241 &mlx4_en_stats->MCAST_prio_1,
239 NUM_PRIORITIES); 242 NUM_PRIORITIES);
240 stats->collisions = 0;
241 stats->rx_dropped = be32_to_cpu(mlx4_en_stats->RDROP) + 243 stats->rx_dropped = be32_to_cpu(mlx4_en_stats->RDROP) +
242 sw_rx_dropped; 244 sw_rx_dropped;
243 stats->rx_length_errors = be32_to_cpu(mlx4_en_stats->RdropLength); 245 stats->rx_length_errors = be32_to_cpu(mlx4_en_stats->RdropLength);
244 stats->rx_over_errors = 0;
245 stats->rx_crc_errors = be32_to_cpu(mlx4_en_stats->RCRC); 246 stats->rx_crc_errors = be32_to_cpu(mlx4_en_stats->RCRC);
246 stats->rx_frame_errors = 0;
247 stats->rx_fifo_errors = be32_to_cpu(mlx4_en_stats->RdropOvflw); 247 stats->rx_fifo_errors = be32_to_cpu(mlx4_en_stats->RdropOvflw);
248 stats->rx_missed_errors = 0; 248 stats->tx_dropped += be32_to_cpu(mlx4_en_stats->TDROP);
249 stats->tx_aborted_errors = 0;
250 stats->tx_carrier_errors = 0;
251 stats->tx_fifo_errors = 0;
252 stats->tx_heartbeat_errors = 0;
253 stats->tx_window_errors = 0;
254 stats->tx_dropped = be32_to_cpu(mlx4_en_stats->TDROP);
255 249
256 /* RX stats */ 250 /* RX stats */
257 priv->pkstats.rx_multicast_packets = stats->multicast; 251 priv->pkstats.rx_multicast_packets = stats->multicast;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index f6e61570cb2c..76aa4d27183c 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -726,12 +726,12 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
726 bool inline_ok; 726 bool inline_ok;
727 u32 ring_cons; 727 u32 ring_cons;
728 728
729 if (!priv->port_up)
730 goto tx_drop;
731
732 tx_ind = skb_get_queue_mapping(skb); 729 tx_ind = skb_get_queue_mapping(skb);
733 ring = priv->tx_ring[tx_ind]; 730 ring = priv->tx_ring[tx_ind];
734 731
732 if (!priv->port_up)
733 goto tx_drop;
734
735 /* fetch ring->cons far ahead before needing it to avoid stall */ 735 /* fetch ring->cons far ahead before needing it to avoid stall */
736 ring_cons = ACCESS_ONCE(ring->cons); 736 ring_cons = ACCESS_ONCE(ring->cons);
737 737
@@ -1030,7 +1030,7 @@ tx_drop_unmap:
1030 1030
1031tx_drop: 1031tx_drop:
1032 dev_kfree_skb_any(skb); 1032 dev_kfree_skb_any(skb);
1033 priv->stats.tx_dropped++; 1033 ring->tx_dropped++;
1034 return NETDEV_TX_OK; 1034 return NETDEV_TX_OK;
1035} 1035}
1036 1036
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index cc84e09f324a..467d47ed2c39 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -270,6 +270,7 @@ struct mlx4_en_tx_ring {
270 unsigned long tx_csum; 270 unsigned long tx_csum;
271 unsigned long tso_packets; 271 unsigned long tso_packets;
272 unsigned long xmit_more; 272 unsigned long xmit_more;
273 unsigned int tx_dropped;
273 struct mlx4_bf bf; 274 struct mlx4_bf bf;
274 unsigned long queue_stopped; 275 unsigned long queue_stopped;
275 276
@@ -482,8 +483,6 @@ struct mlx4_en_priv {
482 struct mlx4_en_port_profile *prof; 483 struct mlx4_en_port_profile *prof;
483 struct net_device *dev; 484 struct net_device *dev;
484 unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; 485 unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
485 struct net_device_stats stats;
486 struct net_device_stats ret_stats;
487 struct mlx4_en_port_state port_state; 486 struct mlx4_en_port_state port_state;
488 spinlock_t stats_lock; 487 spinlock_t stats_lock;
489 struct ethtool_flow_id ethtool_rules[MAX_NUM_OF_FS_RULES]; 488 struct ethtool_flow_id ethtool_rules[MAX_NUM_OF_FS_RULES];
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
index cbf58e1f9333..21ec1c2df2c7 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
@@ -192,9 +192,10 @@ qed_dcbx_process_tlv(struct qed_hwfn *p_hwfn,
192 struct dcbx_app_priority_entry *p_tbl, 192 struct dcbx_app_priority_entry *p_tbl,
193 u32 pri_tc_tbl, int count, bool dcbx_enabled) 193 u32 pri_tc_tbl, int count, bool dcbx_enabled)
194{ 194{
195 u8 tc, priority, priority_map; 195 u8 tc, priority_map;
196 enum dcbx_protocol_type type; 196 enum dcbx_protocol_type type;
197 u16 protocol_id; 197 u16 protocol_id;
198 int priority;
198 bool enable; 199 bool enable;
199 int i; 200 int i;
200 201
@@ -221,7 +222,7 @@ qed_dcbx_process_tlv(struct qed_hwfn *p_hwfn,
221 * indication, but we only got here if there was an 222 * indication, but we only got here if there was an
222 * app tlv for the protocol, so dcbx must be enabled. 223 * app tlv for the protocol, so dcbx must be enabled.
223 */ 224 */
224 enable = !!(type == DCBX_PROTOCOL_ETH); 225 enable = !(type == DCBX_PROTOCOL_ETH);
225 226
226 qed_dcbx_update_app_info(p_data, p_hwfn, enable, true, 227 qed_dcbx_update_app_info(p_data, p_hwfn, enable, true,
227 priority, tc, type); 228 priority, tc, type);
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c
index 089016f46f26..2d89e8c16b32 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_dev.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c
@@ -155,12 +155,14 @@ void qed_resc_free(struct qed_dev *cdev)
155 } 155 }
156} 156}
157 157
158static int qed_init_qm_info(struct qed_hwfn *p_hwfn) 158static int qed_init_qm_info(struct qed_hwfn *p_hwfn, bool b_sleepable)
159{ 159{
160 u8 num_vports, vf_offset = 0, i, vport_id, num_ports, curr_queue = 0; 160 u8 num_vports, vf_offset = 0, i, vport_id, num_ports, curr_queue = 0;
161 struct qed_qm_info *qm_info = &p_hwfn->qm_info; 161 struct qed_qm_info *qm_info = &p_hwfn->qm_info;
162 struct init_qm_port_params *p_qm_port; 162 struct init_qm_port_params *p_qm_port;
163 u16 num_pqs, multi_cos_tcs = 1; 163 u16 num_pqs, multi_cos_tcs = 1;
164 u8 pf_wfq = qm_info->pf_wfq;
165 u32 pf_rl = qm_info->pf_rl;
164 u16 num_vfs = 0; 166 u16 num_vfs = 0;
165 167
166#ifdef CONFIG_QED_SRIOV 168#ifdef CONFIG_QED_SRIOV
@@ -182,23 +184,28 @@ static int qed_init_qm_info(struct qed_hwfn *p_hwfn)
182 184
183 /* PQs will be arranged as follows: First per-TC PQ then pure-LB quete. 185 /* PQs will be arranged as follows: First per-TC PQ then pure-LB quete.
184 */ 186 */
185 qm_info->qm_pq_params = kzalloc(sizeof(*qm_info->qm_pq_params) * 187 qm_info->qm_pq_params = kcalloc(num_pqs,
186 num_pqs, GFP_KERNEL); 188 sizeof(struct init_qm_pq_params),
189 b_sleepable ? GFP_KERNEL : GFP_ATOMIC);
187 if (!qm_info->qm_pq_params) 190 if (!qm_info->qm_pq_params)
188 goto alloc_err; 191 goto alloc_err;
189 192
190 qm_info->qm_vport_params = kzalloc(sizeof(*qm_info->qm_vport_params) * 193 qm_info->qm_vport_params = kcalloc(num_vports,
191 num_vports, GFP_KERNEL); 194 sizeof(struct init_qm_vport_params),
195 b_sleepable ? GFP_KERNEL
196 : GFP_ATOMIC);
192 if (!qm_info->qm_vport_params) 197 if (!qm_info->qm_vport_params)
193 goto alloc_err; 198 goto alloc_err;
194 199
195 qm_info->qm_port_params = kzalloc(sizeof(*qm_info->qm_port_params) * 200 qm_info->qm_port_params = kcalloc(MAX_NUM_PORTS,
196 MAX_NUM_PORTS, GFP_KERNEL); 201 sizeof(struct init_qm_port_params),
202 b_sleepable ? GFP_KERNEL
203 : GFP_ATOMIC);
197 if (!qm_info->qm_port_params) 204 if (!qm_info->qm_port_params)
198 goto alloc_err; 205 goto alloc_err;
199 206
200 qm_info->wfq_data = kcalloc(num_vports, sizeof(*qm_info->wfq_data), 207 qm_info->wfq_data = kcalloc(num_vports, sizeof(struct qed_wfq_data),
201 GFP_KERNEL); 208 b_sleepable ? GFP_KERNEL : GFP_ATOMIC);
202 if (!qm_info->wfq_data) 209 if (!qm_info->wfq_data)
203 goto alloc_err; 210 goto alloc_err;
204 211
@@ -264,10 +271,10 @@ static int qed_init_qm_info(struct qed_hwfn *p_hwfn)
264 for (i = 0; i < qm_info->num_vports; i++) 271 for (i = 0; i < qm_info->num_vports; i++)
265 qm_info->qm_vport_params[i].vport_wfq = 1; 272 qm_info->qm_vport_params[i].vport_wfq = 1;
266 273
267 qm_info->pf_wfq = 0;
268 qm_info->pf_rl = 0;
269 qm_info->vport_rl_en = 1; 274 qm_info->vport_rl_en = 1;
270 qm_info->vport_wfq_en = 1; 275 qm_info->vport_wfq_en = 1;
276 qm_info->pf_rl = pf_rl;
277 qm_info->pf_wfq = pf_wfq;
271 278
272 return 0; 279 return 0;
273 280
@@ -299,7 +306,7 @@ int qed_qm_reconf(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
299 qed_qm_info_free(p_hwfn); 306 qed_qm_info_free(p_hwfn);
300 307
301 /* initialize qed's qm data structure */ 308 /* initialize qed's qm data structure */
302 rc = qed_init_qm_info(p_hwfn); 309 rc = qed_init_qm_info(p_hwfn, false);
303 if (rc) 310 if (rc)
304 return rc; 311 return rc;
305 312
@@ -388,7 +395,7 @@ int qed_resc_alloc(struct qed_dev *cdev)
388 goto alloc_err; 395 goto alloc_err;
389 396
390 /* Prepare and process QM requirements */ 397 /* Prepare and process QM requirements */
391 rc = qed_init_qm_info(p_hwfn); 398 rc = qed_init_qm_info(p_hwfn, true);
392 if (rc) 399 if (rc)
393 goto alloc_err; 400 goto alloc_err;
394 401
@@ -581,7 +588,14 @@ static void qed_calc_hw_mode(struct qed_hwfn *p_hwfn)
581 588
582 hw_mode |= 1 << MODE_ASIC; 589 hw_mode |= 1 << MODE_ASIC;
583 590
591 if (p_hwfn->cdev->num_hwfns > 1)
592 hw_mode |= 1 << MODE_100G;
593
584 p_hwfn->hw_info.hw_mode = hw_mode; 594 p_hwfn->hw_info.hw_mode = hw_mode;
595
596 DP_VERBOSE(p_hwfn, (NETIF_MSG_PROBE | NETIF_MSG_IFUP),
597 "Configuring function for hw_mode: 0x%08x\n",
598 p_hwfn->hw_info.hw_mode);
585} 599}
586 600
587/* Init run time data for all PFs on an engine. */ 601/* Init run time data for all PFs on an engine. */
@@ -821,6 +835,11 @@ int qed_hw_init(struct qed_dev *cdev,
821 u32 load_code, param; 835 u32 load_code, param;
822 int rc, mfw_rc, i; 836 int rc, mfw_rc, i;
823 837
838 if ((int_mode == QED_INT_MODE_MSI) && (cdev->num_hwfns > 1)) {
839 DP_NOTICE(cdev, "MSI mode is not supported for CMT devices\n");
840 return -EINVAL;
841 }
842
824 if (IS_PF(cdev)) { 843 if (IS_PF(cdev)) {
825 rc = qed_init_fw_data(cdev, bin_fw_data); 844 rc = qed_init_fw_data(cdev, bin_fw_data);
826 if (rc != 0) 845 if (rc != 0)
@@ -2086,6 +2105,13 @@ void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev, u32 min_pf_rate)
2086{ 2105{
2087 int i; 2106 int i;
2088 2107
2108 if (cdev->num_hwfns > 1) {
2109 DP_VERBOSE(cdev,
2110 NETIF_MSG_LINK,
2111 "WFQ configuration is not supported for this device\n");
2112 return;
2113 }
2114
2089 for_each_hwfn(cdev, i) { 2115 for_each_hwfn(cdev, i) {
2090 struct qed_hwfn *p_hwfn = &cdev->hwfns[i]; 2116 struct qed_hwfn *p_hwfn = &cdev->hwfns[i];
2091 2117
diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c
index 8b22f87033ce..753064679bde 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_main.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_main.c
@@ -413,15 +413,17 @@ static int qed_set_int_mode(struct qed_dev *cdev, bool force_mode)
413 /* Fallthrough */ 413 /* Fallthrough */
414 414
415 case QED_INT_MODE_MSI: 415 case QED_INT_MODE_MSI:
416 rc = pci_enable_msi(cdev->pdev); 416 if (cdev->num_hwfns == 1) {
417 if (!rc) { 417 rc = pci_enable_msi(cdev->pdev);
418 int_params->out.int_mode = QED_INT_MODE_MSI; 418 if (!rc) {
419 goto out; 419 int_params->out.int_mode = QED_INT_MODE_MSI;
420 } 420 goto out;
421 }
421 422
422 DP_NOTICE(cdev, "Failed to enable MSI\n"); 423 DP_NOTICE(cdev, "Failed to enable MSI\n");
423 if (force_mode) 424 if (force_mode)
424 goto out; 425 goto out;
426 }
425 /* Fallthrough */ 427 /* Fallthrough */
426 428
427 case QED_INT_MODE_INTA: 429 case QED_INT_MODE_INTA:
diff --git a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
index 1bc75358cbc4..ad3cae3b7243 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
@@ -230,7 +230,10 @@ static int qede_get_sset_count(struct net_device *dev, int stringset)
230 case ETH_SS_PRIV_FLAGS: 230 case ETH_SS_PRIV_FLAGS:
231 return QEDE_PRI_FLAG_LEN; 231 return QEDE_PRI_FLAG_LEN;
232 case ETH_SS_TEST: 232 case ETH_SS_TEST:
233 return QEDE_ETHTOOL_TEST_MAX; 233 if (!IS_VF(edev))
234 return QEDE_ETHTOOL_TEST_MAX;
235 else
236 return 0;
234 default: 237 default:
235 DP_VERBOSE(edev, QED_MSG_DEBUG, 238 DP_VERBOSE(edev, QED_MSG_DEBUG,
236 "Unsupported stringset 0x%08x\n", stringset); 239 "Unsupported stringset 0x%08x\n", stringset);
diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
index 337e839ca586..5d00d1404bfc 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_main.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
@@ -1824,7 +1824,7 @@ static int qede_set_vf_rate(struct net_device *dev, int vfidx,
1824{ 1824{
1825 struct qede_dev *edev = netdev_priv(dev); 1825 struct qede_dev *edev = netdev_priv(dev);
1826 1826
1827 return edev->ops->iov->set_rate(edev->cdev, vfidx, max_tx_rate, 1827 return edev->ops->iov->set_rate(edev->cdev, vfidx, min_tx_rate,
1828 max_tx_rate); 1828 max_tx_rate);
1829} 1829}
1830 1830
@@ -2091,6 +2091,29 @@ static void qede_vlan_mark_nonconfigured(struct qede_dev *edev)
2091 edev->accept_any_vlan = false; 2091 edev->accept_any_vlan = false;
2092} 2092}
2093 2093
2094int qede_set_features(struct net_device *dev, netdev_features_t features)
2095{
2096 struct qede_dev *edev = netdev_priv(dev);
2097 netdev_features_t changes = features ^ dev->features;
2098 bool need_reload = false;
2099
2100 /* No action needed if hardware GRO is disabled during driver load */
2101 if (changes & NETIF_F_GRO) {
2102 if (dev->features & NETIF_F_GRO)
2103 need_reload = !edev->gro_disable;
2104 else
2105 need_reload = edev->gro_disable;
2106 }
2107
2108 if (need_reload && netif_running(edev->ndev)) {
2109 dev->features = features;
2110 qede_reload(edev, NULL, NULL);
2111 return 1;
2112 }
2113
2114 return 0;
2115}
2116
2094#ifdef CONFIG_QEDE_VXLAN 2117#ifdef CONFIG_QEDE_VXLAN
2095static void qede_add_vxlan_port(struct net_device *dev, 2118static void qede_add_vxlan_port(struct net_device *dev,
2096 sa_family_t sa_family, __be16 port) 2119 sa_family_t sa_family, __be16 port)
@@ -2175,6 +2198,7 @@ static const struct net_device_ops qede_netdev_ops = {
2175#endif 2198#endif
2176 .ndo_vlan_rx_add_vid = qede_vlan_rx_add_vid, 2199 .ndo_vlan_rx_add_vid = qede_vlan_rx_add_vid,
2177 .ndo_vlan_rx_kill_vid = qede_vlan_rx_kill_vid, 2200 .ndo_vlan_rx_kill_vid = qede_vlan_rx_kill_vid,
2201 .ndo_set_features = qede_set_features,
2178 .ndo_get_stats64 = qede_get_stats64, 2202 .ndo_get_stats64 = qede_get_stats64,
2179#ifdef CONFIG_QED_SRIOV 2203#ifdef CONFIG_QED_SRIOV
2180 .ndo_set_vf_link_state = qede_set_vf_link_state, 2204 .ndo_set_vf_link_state = qede_set_vf_link_state,
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index 83d72106471c..fd5d1c93b55b 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -4846,7 +4846,6 @@ static void ql_eeh_close(struct net_device *ndev)
4846 } 4846 }
4847 4847
4848 /* Disabling the timer */ 4848 /* Disabling the timer */
4849 del_timer_sync(&qdev->timer);
4850 ql_cancel_all_work_sync(qdev); 4849 ql_cancel_all_work_sync(qdev);
4851 4850
4852 for (i = 0; i < qdev->rss_ring_count; i++) 4851 for (i = 0; i < qdev->rss_ring_count; i++)
@@ -4873,6 +4872,7 @@ static pci_ers_result_t qlge_io_error_detected(struct pci_dev *pdev,
4873 return PCI_ERS_RESULT_CAN_RECOVER; 4872 return PCI_ERS_RESULT_CAN_RECOVER;
4874 case pci_channel_io_frozen: 4873 case pci_channel_io_frozen:
4875 netif_device_detach(ndev); 4874 netif_device_detach(ndev);
4875 del_timer_sync(&qdev->timer);
4876 if (netif_running(ndev)) 4876 if (netif_running(ndev))
4877 ql_eeh_close(ndev); 4877 ql_eeh_close(ndev);
4878 pci_disable_device(pdev); 4878 pci_disable_device(pdev);
@@ -4880,6 +4880,7 @@ static pci_ers_result_t qlge_io_error_detected(struct pci_dev *pdev,
4880 case pci_channel_io_perm_failure: 4880 case pci_channel_io_perm_failure:
4881 dev_err(&pdev->dev, 4881 dev_err(&pdev->dev,
4882 "%s: pci_channel_io_perm_failure.\n", __func__); 4882 "%s: pci_channel_io_perm_failure.\n", __func__);
4883 del_timer_sync(&qdev->timer);
4883 ql_eeh_close(ndev); 4884 ql_eeh_close(ndev);
4884 set_bit(QL_EEH_FATAL, &qdev->flags); 4885 set_bit(QL_EEH_FATAL, &qdev->flags);
4885 return PCI_ERS_RESULT_DISCONNECT; 4886 return PCI_ERS_RESULT_DISCONNECT;
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 1681084cc96f..1f309127457d 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -619,6 +619,17 @@ fail:
619 return rc; 619 return rc;
620} 620}
621 621
622static void efx_ef10_forget_old_piobufs(struct efx_nic *efx)
623{
624 struct efx_channel *channel;
625 struct efx_tx_queue *tx_queue;
626
627 /* All our existing PIO buffers went away */
628 efx_for_each_channel(channel, efx)
629 efx_for_each_channel_tx_queue(tx_queue, channel)
630 tx_queue->piobuf = NULL;
631}
632
622#else /* !EFX_USE_PIO */ 633#else /* !EFX_USE_PIO */
623 634
624static int efx_ef10_alloc_piobufs(struct efx_nic *efx, unsigned int n) 635static int efx_ef10_alloc_piobufs(struct efx_nic *efx, unsigned int n)
@@ -635,6 +646,10 @@ static void efx_ef10_free_piobufs(struct efx_nic *efx)
635{ 646{
636} 647}
637 648
649static void efx_ef10_forget_old_piobufs(struct efx_nic *efx)
650{
651}
652
638#endif /* EFX_USE_PIO */ 653#endif /* EFX_USE_PIO */
639 654
640static void efx_ef10_remove(struct efx_nic *efx) 655static void efx_ef10_remove(struct efx_nic *efx)
@@ -1018,6 +1033,7 @@ static void efx_ef10_reset_mc_allocations(struct efx_nic *efx)
1018 nic_data->must_realloc_vis = true; 1033 nic_data->must_realloc_vis = true;
1019 nic_data->must_restore_filters = true; 1034 nic_data->must_restore_filters = true;
1020 nic_data->must_restore_piobufs = true; 1035 nic_data->must_restore_piobufs = true;
1036 efx_ef10_forget_old_piobufs(efx);
1021 nic_data->rx_rss_context = EFX_EF10_RSS_CONTEXT_INVALID; 1037 nic_data->rx_rss_context = EFX_EF10_RSS_CONTEXT_INVALID;
1022 1038
1023 /* Driver-created vswitches and vports must be re-created */ 1039 /* Driver-created vswitches and vports must be re-created */
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index 0705ec869487..097f363f1630 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -1726,14 +1726,33 @@ static int efx_probe_filters(struct efx_nic *efx)
1726 1726
1727#ifdef CONFIG_RFS_ACCEL 1727#ifdef CONFIG_RFS_ACCEL
1728 if (efx->type->offload_features & NETIF_F_NTUPLE) { 1728 if (efx->type->offload_features & NETIF_F_NTUPLE) {
1729 efx->rps_flow_id = kcalloc(efx->type->max_rx_ip_filters, 1729 struct efx_channel *channel;
1730 sizeof(*efx->rps_flow_id), 1730 int i, success = 1;
1731 GFP_KERNEL); 1731
1732 if (!efx->rps_flow_id) { 1732 efx_for_each_channel(channel, efx) {
1733 channel->rps_flow_id =
1734 kcalloc(efx->type->max_rx_ip_filters,
1735 sizeof(*channel->rps_flow_id),
1736 GFP_KERNEL);
1737 if (!channel->rps_flow_id)
1738 success = 0;
1739 else
1740 for (i = 0;
1741 i < efx->type->max_rx_ip_filters;
1742 ++i)
1743 channel->rps_flow_id[i] =
1744 RPS_FLOW_ID_INVALID;
1745 }
1746
1747 if (!success) {
1748 efx_for_each_channel(channel, efx)
1749 kfree(channel->rps_flow_id);
1733 efx->type->filter_table_remove(efx); 1750 efx->type->filter_table_remove(efx);
1734 rc = -ENOMEM; 1751 rc = -ENOMEM;
1735 goto out_unlock; 1752 goto out_unlock;
1736 } 1753 }
1754
1755 efx->rps_expire_index = efx->rps_expire_channel = 0;
1737 } 1756 }
1738#endif 1757#endif
1739out_unlock: 1758out_unlock:
@@ -1744,7 +1763,10 @@ out_unlock:
1744static void efx_remove_filters(struct efx_nic *efx) 1763static void efx_remove_filters(struct efx_nic *efx)
1745{ 1764{
1746#ifdef CONFIG_RFS_ACCEL 1765#ifdef CONFIG_RFS_ACCEL
1747 kfree(efx->rps_flow_id); 1766 struct efx_channel *channel;
1767
1768 efx_for_each_channel(channel, efx)
1769 kfree(channel->rps_flow_id);
1748#endif 1770#endif
1749 down_write(&efx->filter_sem); 1771 down_write(&efx->filter_sem);
1750 efx->type->filter_table_remove(efx); 1772 efx->type->filter_table_remove(efx);
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index 38c422321cda..d13ddf9703ff 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -403,6 +403,8 @@ enum efx_sync_events_state {
403 * @event_test_cpu: Last CPU to handle interrupt or test event for this channel 403 * @event_test_cpu: Last CPU to handle interrupt or test event for this channel
404 * @irq_count: Number of IRQs since last adaptive moderation decision 404 * @irq_count: Number of IRQs since last adaptive moderation decision
405 * @irq_mod_score: IRQ moderation score 405 * @irq_mod_score: IRQ moderation score
406 * @rps_flow_id: Flow IDs of filters allocated for accelerated RFS,
407 * indexed by filter ID
406 * @n_rx_tobe_disc: Count of RX_TOBE_DISC errors 408 * @n_rx_tobe_disc: Count of RX_TOBE_DISC errors
407 * @n_rx_ip_hdr_chksum_err: Count of RX IP header checksum errors 409 * @n_rx_ip_hdr_chksum_err: Count of RX IP header checksum errors
408 * @n_rx_tcp_udp_chksum_err: Count of RX TCP and UDP checksum errors 410 * @n_rx_tcp_udp_chksum_err: Count of RX TCP and UDP checksum errors
@@ -446,6 +448,8 @@ struct efx_channel {
446 unsigned int irq_mod_score; 448 unsigned int irq_mod_score;
447#ifdef CONFIG_RFS_ACCEL 449#ifdef CONFIG_RFS_ACCEL
448 unsigned int rfs_filters_added; 450 unsigned int rfs_filters_added;
451#define RPS_FLOW_ID_INVALID 0xFFFFFFFF
452 u32 *rps_flow_id;
449#endif 453#endif
450 454
451 unsigned n_rx_tobe_disc; 455 unsigned n_rx_tobe_disc;
@@ -889,9 +893,9 @@ struct vfdi_status;
889 * @filter_sem: Filter table rw_semaphore, for freeing the table 893 * @filter_sem: Filter table rw_semaphore, for freeing the table
890 * @filter_lock: Filter table lock, for mere content changes 894 * @filter_lock: Filter table lock, for mere content changes
891 * @filter_state: Architecture-dependent filter table state 895 * @filter_state: Architecture-dependent filter table state
892 * @rps_flow_id: Flow IDs of filters allocated for accelerated RFS, 896 * @rps_expire_channel: Next channel to check for expiry
893 * indexed by filter ID 897 * @rps_expire_index: Next index to check for expiry in
894 * @rps_expire_index: Next index to check for expiry in @rps_flow_id 898 * @rps_expire_channel's @rps_flow_id
895 * @active_queues: Count of RX and TX queues that haven't been flushed and drained. 899 * @active_queues: Count of RX and TX queues that haven't been flushed and drained.
896 * @rxq_flush_pending: Count of number of receive queues that need to be flushed. 900 * @rxq_flush_pending: Count of number of receive queues that need to be flushed.
897 * Decremented when the efx_flush_rx_queue() is called. 901 * Decremented when the efx_flush_rx_queue() is called.
@@ -1035,7 +1039,7 @@ struct efx_nic {
1035 spinlock_t filter_lock; 1039 spinlock_t filter_lock;
1036 void *filter_state; 1040 void *filter_state;
1037#ifdef CONFIG_RFS_ACCEL 1041#ifdef CONFIG_RFS_ACCEL
1038 u32 *rps_flow_id; 1042 unsigned int rps_expire_channel;
1039 unsigned int rps_expire_index; 1043 unsigned int rps_expire_index;
1040#endif 1044#endif
1041 1045
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c
index 8956995b2fe7..02b0b5272c14 100644
--- a/drivers/net/ethernet/sfc/rx.c
+++ b/drivers/net/ethernet/sfc/rx.c
@@ -842,33 +842,18 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb,
842 struct efx_nic *efx = netdev_priv(net_dev); 842 struct efx_nic *efx = netdev_priv(net_dev);
843 struct efx_channel *channel; 843 struct efx_channel *channel;
844 struct efx_filter_spec spec; 844 struct efx_filter_spec spec;
845 const __be16 *ports; 845 struct flow_keys fk;
846 __be16 ether_type;
847 int nhoff;
848 int rc; 846 int rc;
849 847
850 /* The core RPS/RFS code has already parsed and validated 848 if (flow_id == RPS_FLOW_ID_INVALID)
851 * VLAN, IP and transport headers. We assume they are in the 849 return -EINVAL;
852 * header area.
853 */
854
855 if (skb->protocol == htons(ETH_P_8021Q)) {
856 const struct vlan_hdr *vh =
857 (const struct vlan_hdr *)skb->data;
858 850
859 /* We can't filter on the IP 5-tuple and the vlan 851 if (!skb_flow_dissect_flow_keys(skb, &fk, 0))
860 * together, so just strip the vlan header and filter 852 return -EPROTONOSUPPORT;
861 * on the IP part.
862 */
863 EFX_BUG_ON_PARANOID(skb_headlen(skb) < sizeof(*vh));
864 ether_type = vh->h_vlan_encapsulated_proto;
865 nhoff = sizeof(struct vlan_hdr);
866 } else {
867 ether_type = skb->protocol;
868 nhoff = 0;
869 }
870 853
871 if (ether_type != htons(ETH_P_IP) && ether_type != htons(ETH_P_IPV6)) 854 if (fk.basic.n_proto != htons(ETH_P_IP) && fk.basic.n_proto != htons(ETH_P_IPV6))
855 return -EPROTONOSUPPORT;
856 if (fk.control.flags & FLOW_DIS_IS_FRAGMENT)
872 return -EPROTONOSUPPORT; 857 return -EPROTONOSUPPORT;
873 858
874 efx_filter_init_rx(&spec, EFX_FILTER_PRI_HINT, 859 efx_filter_init_rx(&spec, EFX_FILTER_PRI_HINT,
@@ -878,56 +863,41 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb,
878 EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_IP_PROTO | 863 EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_IP_PROTO |
879 EFX_FILTER_MATCH_LOC_HOST | EFX_FILTER_MATCH_LOC_PORT | 864 EFX_FILTER_MATCH_LOC_HOST | EFX_FILTER_MATCH_LOC_PORT |
880 EFX_FILTER_MATCH_REM_HOST | EFX_FILTER_MATCH_REM_PORT; 865 EFX_FILTER_MATCH_REM_HOST | EFX_FILTER_MATCH_REM_PORT;
881 spec.ether_type = ether_type; 866 spec.ether_type = fk.basic.n_proto;
882 867 spec.ip_proto = fk.basic.ip_proto;
883 if (ether_type == htons(ETH_P_IP)) { 868
884 const struct iphdr *ip = 869 if (fk.basic.n_proto == htons(ETH_P_IP)) {
885 (const struct iphdr *)(skb->data + nhoff); 870 spec.rem_host[0] = fk.addrs.v4addrs.src;
886 871 spec.loc_host[0] = fk.addrs.v4addrs.dst;
887 EFX_BUG_ON_PARANOID(skb_headlen(skb) < nhoff + sizeof(*ip));
888 if (ip_is_fragment(ip))
889 return -EPROTONOSUPPORT;
890 spec.ip_proto = ip->protocol;
891 spec.rem_host[0] = ip->saddr;
892 spec.loc_host[0] = ip->daddr;
893 EFX_BUG_ON_PARANOID(skb_headlen(skb) < nhoff + 4 * ip->ihl + 4);
894 ports = (const __be16 *)(skb->data + nhoff + 4 * ip->ihl);
895 } else { 872 } else {
896 const struct ipv6hdr *ip6 = 873 memcpy(spec.rem_host, &fk.addrs.v6addrs.src, sizeof(struct in6_addr));
897 (const struct ipv6hdr *)(skb->data + nhoff); 874 memcpy(spec.loc_host, &fk.addrs.v6addrs.dst, sizeof(struct in6_addr));
898
899 EFX_BUG_ON_PARANOID(skb_headlen(skb) <
900 nhoff + sizeof(*ip6) + 4);
901 spec.ip_proto = ip6->nexthdr;
902 memcpy(spec.rem_host, &ip6->saddr, sizeof(ip6->saddr));
903 memcpy(spec.loc_host, &ip6->daddr, sizeof(ip6->daddr));
904 ports = (const __be16 *)(ip6 + 1);
905 } 875 }
906 876
907 spec.rem_port = ports[0]; 877 spec.rem_port = fk.ports.src;
908 spec.loc_port = ports[1]; 878 spec.loc_port = fk.ports.dst;
909 879
910 rc = efx->type->filter_rfs_insert(efx, &spec); 880 rc = efx->type->filter_rfs_insert(efx, &spec);
911 if (rc < 0) 881 if (rc < 0)
912 return rc; 882 return rc;
913 883
914 /* Remember this so we can check whether to expire the filter later */ 884 /* Remember this so we can check whether to expire the filter later */
915 efx->rps_flow_id[rc] = flow_id; 885 channel = efx_get_channel(efx, rxq_index);
916 channel = efx_get_channel(efx, skb_get_rx_queue(skb)); 886 channel->rps_flow_id[rc] = flow_id;
917 ++channel->rfs_filters_added; 887 ++channel->rfs_filters_added;
918 888
919 if (ether_type == htons(ETH_P_IP)) 889 if (spec.ether_type == htons(ETH_P_IP))
920 netif_info(efx, rx_status, efx->net_dev, 890 netif_info(efx, rx_status, efx->net_dev,
921 "steering %s %pI4:%u:%pI4:%u to queue %u [flow %u filter %d]\n", 891 "steering %s %pI4:%u:%pI4:%u to queue %u [flow %u filter %d]\n",
922 (spec.ip_proto == IPPROTO_TCP) ? "TCP" : "UDP", 892 (spec.ip_proto == IPPROTO_TCP) ? "TCP" : "UDP",
923 spec.rem_host, ntohs(ports[0]), spec.loc_host, 893 spec.rem_host, ntohs(spec.rem_port), spec.loc_host,
924 ntohs(ports[1]), rxq_index, flow_id, rc); 894 ntohs(spec.loc_port), rxq_index, flow_id, rc);
925 else 895 else
926 netif_info(efx, rx_status, efx->net_dev, 896 netif_info(efx, rx_status, efx->net_dev,
927 "steering %s [%pI6]:%u:[%pI6]:%u to queue %u [flow %u filter %d]\n", 897 "steering %s [%pI6]:%u:[%pI6]:%u to queue %u [flow %u filter %d]\n",
928 (spec.ip_proto == IPPROTO_TCP) ? "TCP" : "UDP", 898 (spec.ip_proto == IPPROTO_TCP) ? "TCP" : "UDP",
929 spec.rem_host, ntohs(ports[0]), spec.loc_host, 899 spec.rem_host, ntohs(spec.rem_port), spec.loc_host,
930 ntohs(ports[1]), rxq_index, flow_id, rc); 900 ntohs(spec.loc_port), rxq_index, flow_id, rc);
931 901
932 return rc; 902 return rc;
933} 903}
@@ -935,24 +905,34 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb,
935bool __efx_filter_rfs_expire(struct efx_nic *efx, unsigned int quota) 905bool __efx_filter_rfs_expire(struct efx_nic *efx, unsigned int quota)
936{ 906{
937 bool (*expire_one)(struct efx_nic *efx, u32 flow_id, unsigned int index); 907 bool (*expire_one)(struct efx_nic *efx, u32 flow_id, unsigned int index);
938 unsigned int index, size; 908 unsigned int channel_idx, index, size;
939 u32 flow_id; 909 u32 flow_id;
940 910
941 if (!spin_trylock_bh(&efx->filter_lock)) 911 if (!spin_trylock_bh(&efx->filter_lock))
942 return false; 912 return false;
943 913
944 expire_one = efx->type->filter_rfs_expire_one; 914 expire_one = efx->type->filter_rfs_expire_one;
915 channel_idx = efx->rps_expire_channel;
945 index = efx->rps_expire_index; 916 index = efx->rps_expire_index;
946 size = efx->type->max_rx_ip_filters; 917 size = efx->type->max_rx_ip_filters;
947 while (quota--) { 918 while (quota--) {
948 flow_id = efx->rps_flow_id[index]; 919 struct efx_channel *channel = efx_get_channel(efx, channel_idx);
949 if (expire_one(efx, flow_id, index)) 920 flow_id = channel->rps_flow_id[index];
921
922 if (flow_id != RPS_FLOW_ID_INVALID &&
923 expire_one(efx, flow_id, index)) {
950 netif_info(efx, rx_status, efx->net_dev, 924 netif_info(efx, rx_status, efx->net_dev,
951 "expired filter %d [flow %u]\n", 925 "expired filter %d [queue %u flow %u]\n",
952 index, flow_id); 926 index, channel_idx, flow_id);
953 if (++index == size) 927 channel->rps_flow_id[index] = RPS_FLOW_ID_INVALID;
928 }
929 if (++index == size) {
930 if (++channel_idx == efx->n_channels)
931 channel_idx = 0;
954 index = 0; 932 index = 0;
933 }
955 } 934 }
935 efx->rps_expire_channel = channel_idx;
956 efx->rps_expire_index = index; 936 efx->rps_expire_index = index;
957 937
958 spin_unlock_bh(&efx->filter_lock); 938 spin_unlock_bh(&efx->filter_lock);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index 3f83c369f56c..ec295851812b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -297,7 +297,7 @@ int stmmac_mdio_register(struct net_device *ndev)
297 return -ENOMEM; 297 return -ENOMEM;
298 298
299 if (mdio_bus_data->irqs) 299 if (mdio_bus_data->irqs)
300 memcpy(new_bus->irq, mdio_bus_data, sizeof(new_bus->irq)); 300 memcpy(new_bus->irq, mdio_bus_data->irqs, sizeof(new_bus->irq));
301 301
302#ifdef CONFIG_OF 302#ifdef CONFIG_OF
303 if (priv->device->of_node) 303 if (priv->device->of_node)
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index a0f64cba86ba..2ace126533cd 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -990,7 +990,7 @@ static void team_port_disable(struct team *team,
990#define TEAM_ENC_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \ 990#define TEAM_ENC_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
991 NETIF_F_RXCSUM | NETIF_F_ALL_TSO) 991 NETIF_F_RXCSUM | NETIF_F_ALL_TSO)
992 992
993static void __team_compute_features(struct team *team) 993static void ___team_compute_features(struct team *team)
994{ 994{
995 struct team_port *port; 995 struct team_port *port;
996 u32 vlan_features = TEAM_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL; 996 u32 vlan_features = TEAM_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL;
@@ -1021,15 +1021,20 @@ static void __team_compute_features(struct team *team)
1021 team->dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; 1021 team->dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
1022 if (dst_release_flag == (IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM)) 1022 if (dst_release_flag == (IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM))
1023 team->dev->priv_flags |= IFF_XMIT_DST_RELEASE; 1023 team->dev->priv_flags |= IFF_XMIT_DST_RELEASE;
1024}
1024 1025
1026static void __team_compute_features(struct team *team)
1027{
1028 ___team_compute_features(team);
1025 netdev_change_features(team->dev); 1029 netdev_change_features(team->dev);
1026} 1030}
1027 1031
1028static void team_compute_features(struct team *team) 1032static void team_compute_features(struct team *team)
1029{ 1033{
1030 mutex_lock(&team->lock); 1034 mutex_lock(&team->lock);
1031 __team_compute_features(team); 1035 ___team_compute_features(team);
1032 mutex_unlock(&team->lock); 1036 mutex_unlock(&team->lock);
1037 netdev_change_features(team->dev);
1033} 1038}
1034 1039
1035static int team_port_enter(struct team *team, struct team_port *port) 1040static int team_port_enter(struct team *team, struct team_port *port)
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 36cd7f016a8d..9bbe0161a2f4 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -473,7 +473,7 @@ static void read_bulk_callback(struct urb *urb)
473 goto goon; 473 goto goon;
474 } 474 }
475 475
476 if (!count || count < 4) 476 if (count < 4)
477 goto goon; 477 goto goon;
478 478
479 rx_status = buf[count - 2]; 479 rx_status = buf[count - 2];
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index d9d2806a47b1..dc989a8b5afb 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -61,6 +61,8 @@
61#define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \ 61#define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \
62 SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3) 62 SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3)
63 63
64#define CARRIER_CHECK_DELAY (2 * HZ)
65
64struct smsc95xx_priv { 66struct smsc95xx_priv {
65 u32 mac_cr; 67 u32 mac_cr;
66 u32 hash_hi; 68 u32 hash_hi;
@@ -69,6 +71,9 @@ struct smsc95xx_priv {
69 spinlock_t mac_cr_lock; 71 spinlock_t mac_cr_lock;
70 u8 features; 72 u8 features;
71 u8 suspend_flags; 73 u8 suspend_flags;
74 bool link_ok;
75 struct delayed_work carrier_check;
76 struct usbnet *dev;
72}; 77};
73 78
74static bool turbo_mode = true; 79static bool turbo_mode = true;
@@ -624,6 +629,44 @@ static void smsc95xx_status(struct usbnet *dev, struct urb *urb)
624 intdata); 629 intdata);
625} 630}
626 631
632static void set_carrier(struct usbnet *dev, bool link)
633{
634 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
635
636 if (pdata->link_ok == link)
637 return;
638
639 pdata->link_ok = link;
640
641 if (link)
642 usbnet_link_change(dev, 1, 0);
643 else
644 usbnet_link_change(dev, 0, 0);
645}
646
647static void check_carrier(struct work_struct *work)
648{
649 struct smsc95xx_priv *pdata = container_of(work, struct smsc95xx_priv,
650 carrier_check.work);
651 struct usbnet *dev = pdata->dev;
652 int ret;
653
654 if (pdata->suspend_flags != 0)
655 return;
656
657 ret = smsc95xx_mdio_read(dev->net, dev->mii.phy_id, MII_BMSR);
658 if (ret < 0) {
659 netdev_warn(dev->net, "Failed to read MII_BMSR\n");
660 return;
661 }
662 if (ret & BMSR_LSTATUS)
663 set_carrier(dev, 1);
664 else
665 set_carrier(dev, 0);
666
667 schedule_delayed_work(&pdata->carrier_check, CARRIER_CHECK_DELAY);
668}
669
627/* Enable or disable Tx & Rx checksum offload engines */ 670/* Enable or disable Tx & Rx checksum offload engines */
628static int smsc95xx_set_features(struct net_device *netdev, 671static int smsc95xx_set_features(struct net_device *netdev,
629 netdev_features_t features) 672 netdev_features_t features)
@@ -1165,13 +1208,20 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
1165 dev->net->flags |= IFF_MULTICAST; 1208 dev->net->flags |= IFF_MULTICAST;
1166 dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM; 1209 dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM;
1167 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; 1210 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
1211
1212 pdata->dev = dev;
1213 INIT_DELAYED_WORK(&pdata->carrier_check, check_carrier);
1214 schedule_delayed_work(&pdata->carrier_check, CARRIER_CHECK_DELAY);
1215
1168 return 0; 1216 return 0;
1169} 1217}
1170 1218
1171static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf) 1219static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf)
1172{ 1220{
1173 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]); 1221 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
1222
1174 if (pdata) { 1223 if (pdata) {
1224 cancel_delayed_work(&pdata->carrier_check);
1175 netif_dbg(dev, ifdown, dev->net, "free pdata\n"); 1225 netif_dbg(dev, ifdown, dev->net, "free pdata\n");
1176 kfree(pdata); 1226 kfree(pdata);
1177 pdata = NULL; 1227 pdata = NULL;
@@ -1695,6 +1745,7 @@ static int smsc95xx_resume(struct usb_interface *intf)
1695 1745
1696 /* do this first to ensure it's cleared even in error case */ 1746 /* do this first to ensure it's cleared even in error case */
1697 pdata->suspend_flags = 0; 1747 pdata->suspend_flags = 0;
1748 schedule_delayed_work(&pdata->carrier_check, CARRIER_CHECK_DELAY);
1698 1749
1699 if (suspend_flags & SUSPEND_ALLMODES) { 1750 if (suspend_flags & SUSPEND_ALLMODES) {
1700 /* clear wake-up sources */ 1751 /* clear wake-up sources */
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 49d84e540343..e0638e556fe7 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1925,24 +1925,11 @@ static int virtnet_probe(struct virtio_device *vdev)
1925 1925
1926 virtio_device_ready(vdev); 1926 virtio_device_ready(vdev);
1927 1927
1928 /* Last of all, set up some receive buffers. */
1929 for (i = 0; i < vi->curr_queue_pairs; i++) {
1930 try_fill_recv(vi, &vi->rq[i], GFP_KERNEL);
1931
1932 /* If we didn't even get one input buffer, we're useless. */
1933 if (vi->rq[i].vq->num_free ==
1934 virtqueue_get_vring_size(vi->rq[i].vq)) {
1935 free_unused_bufs(vi);
1936 err = -ENOMEM;
1937 goto free_recv_bufs;
1938 }
1939 }
1940
1941 vi->nb.notifier_call = &virtnet_cpu_callback; 1928 vi->nb.notifier_call = &virtnet_cpu_callback;
1942 err = register_hotcpu_notifier(&vi->nb); 1929 err = register_hotcpu_notifier(&vi->nb);
1943 if (err) { 1930 if (err) {
1944 pr_debug("virtio_net: registering cpu notifier failed\n"); 1931 pr_debug("virtio_net: registering cpu notifier failed\n");
1945 goto free_recv_bufs; 1932 goto free_unregister_netdev;
1946 } 1933 }
1947 1934
1948 /* Assume link up if device can't report link status, 1935 /* Assume link up if device can't report link status,
@@ -1960,10 +1947,9 @@ static int virtnet_probe(struct virtio_device *vdev)
1960 1947
1961 return 0; 1948 return 0;
1962 1949
1963free_recv_bufs: 1950free_unregister_netdev:
1964 vi->vdev->config->reset(vdev); 1951 vi->vdev->config->reset(vdev);
1965 1952
1966 free_receive_bufs(vi);
1967 unregister_netdev(dev); 1953 unregister_netdev(dev);
1968free_vqs: 1954free_vqs:
1969 cancel_delayed_work_sync(&vi->refill); 1955 cancel_delayed_work_sync(&vi->refill);
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 8ff30c3bdfce..f999db2f97b4 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -3086,6 +3086,9 @@ static int vxlan_newlink(struct net *src_net, struct net_device *dev,
3086 if (data[IFLA_VXLAN_REMCSUM_NOPARTIAL]) 3086 if (data[IFLA_VXLAN_REMCSUM_NOPARTIAL])
3087 conf.flags |= VXLAN_F_REMCSUM_NOPARTIAL; 3087 conf.flags |= VXLAN_F_REMCSUM_NOPARTIAL;
3088 3088
3089 if (tb[IFLA_MTU])
3090 conf.mtu = nla_get_u32(tb[IFLA_MTU]);
3091
3089 err = vxlan_dev_configure(src_net, dev, &conf); 3092 err = vxlan_dev_configure(src_net, dev, &conf);
3090 switch (err) { 3093 switch (err) {
3091 case -ENODEV: 3094 case -ENODEV:
diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
index 579fd65299a0..d637c933c8a9 100644
--- a/drivers/ptp/ptp_chardev.c
+++ b/drivers/ptp/ptp_chardev.c
@@ -208,14 +208,10 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
208 break; 208 break;
209 209
210 case PTP_SYS_OFFSET: 210 case PTP_SYS_OFFSET:
211 sysoff = kmalloc(sizeof(*sysoff), GFP_KERNEL); 211 sysoff = memdup_user((void __user *)arg, sizeof(*sysoff));
212 if (!sysoff) { 212 if (IS_ERR(sysoff)) {
213 err = -ENOMEM; 213 err = PTR_ERR(sysoff);
214 break; 214 sysoff = NULL;
215 }
216 if (copy_from_user(sysoff, (void __user *)arg,
217 sizeof(*sysoff))) {
218 err = -EFAULT;
219 break; 215 break;
220 } 216 }
221 if (sysoff->n_samples > PTP_MAX_SAMPLES) { 217 if (sysoff->n_samples > PTP_MAX_SAMPLES) {
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index dacb5e711994..de1f64318fc4 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -765,6 +765,8 @@ struct sctp_info {
765 __u8 sctpi_s_disable_fragments; 765 __u8 sctpi_s_disable_fragments;
766 __u8 sctpi_s_v4mapped; 766 __u8 sctpi_s_v4mapped;
767 __u8 sctpi_s_frag_interleave; 767 __u8 sctpi_s_frag_interleave;
768 __u32 sctpi_s_type;
769 __u32 __reserved3;
768}; 770};
769 771
770struct sctp_infox { 772struct sctp_infox {
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index d325c81332e3..43a5a0e4524c 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -63,6 +63,8 @@ struct ip6_tnl_encap_ops {
63 u8 *protocol, struct flowi6 *fl6); 63 u8 *protocol, struct flowi6 *fl6);
64}; 64};
65 65
66#ifdef CONFIG_INET
67
66extern const struct ip6_tnl_encap_ops __rcu * 68extern const struct ip6_tnl_encap_ops __rcu *
67 ip6tun_encaps[MAX_IPTUN_ENCAP_OPS]; 69 ip6tun_encaps[MAX_IPTUN_ENCAP_OPS];
68 70
@@ -138,7 +140,6 @@ struct net *ip6_tnl_get_link_net(const struct net_device *dev);
138int ip6_tnl_get_iflink(const struct net_device *dev); 140int ip6_tnl_get_iflink(const struct net_device *dev);
139int ip6_tnl_change_mtu(struct net_device *dev, int new_mtu); 141int ip6_tnl_change_mtu(struct net_device *dev, int new_mtu);
140 142
141#ifdef CONFIG_INET
142static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb, 143static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb,
143 struct net_device *dev) 144 struct net_device *dev)
144{ 145{
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 401038d2f9b8..fea53f4d92ca 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -61,6 +61,7 @@ psched_tdiff_bounded(psched_time_t tv1, psched_time_t tv2, psched_time_t bound)
61} 61}
62 62
63struct qdisc_watchdog { 63struct qdisc_watchdog {
64 u64 last_expires;
64 struct hrtimer timer; 65 struct hrtimer timer;
65 struct Qdisc *qdisc; 66 struct Qdisc *qdisc;
66}; 67};
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 9222db8ccccc..5f030b46cff4 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -1353,6 +1353,15 @@ enum ethtool_link_mode_bit_indices {
1353 ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT = 28, 1353 ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT = 28,
1354 ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT = 29, 1354 ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT = 29,
1355 ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT = 30, 1355 ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT = 30,
1356 ETHTOOL_LINK_MODE_25000baseCR_Full_BIT = 31,
1357 ETHTOOL_LINK_MODE_25000baseKR_Full_BIT = 32,
1358 ETHTOOL_LINK_MODE_25000baseSR_Full_BIT = 33,
1359 ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT = 34,
1360 ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT = 35,
1361 ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT = 36,
1362 ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT = 37,
1363 ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT = 38,
1364 ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT = 39,
1356 1365
1357 /* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit 1366 /* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit
1358 * 31. Please do NOT define any SUPPORTED_* or ADVERTISED_* 1367 * 31. Please do NOT define any SUPPORTED_* or ADVERTISED_*
@@ -1361,7 +1370,7 @@ enum ethtool_link_mode_bit_indices {
1361 */ 1370 */
1362 1371
1363 __ETHTOOL_LINK_MODE_LAST 1372 __ETHTOOL_LINK_MODE_LAST
1364 = ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT, 1373 = ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT,
1365}; 1374};
1366 1375
1367#define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) \ 1376#define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) \
diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index eba5914ba5d1..f4297c8a42fe 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -145,6 +145,8 @@ enum {
145 TCA_POLICE_PEAKRATE, 145 TCA_POLICE_PEAKRATE,
146 TCA_POLICE_AVRATE, 146 TCA_POLICE_AVRATE,
147 TCA_POLICE_RESULT, 147 TCA_POLICE_RESULT,
148 TCA_POLICE_TM,
149 TCA_POLICE_PAD,
148 __TCA_POLICE_MAX 150 __TCA_POLICE_MAX
149#define TCA_POLICE_RESULT TCA_POLICE_RESULT 151#define TCA_POLICE_RESULT TCA_POLICE_RESULT
150}; 152};
@@ -173,7 +175,7 @@ enum {
173 TCA_U32_DIVISOR, 175 TCA_U32_DIVISOR,
174 TCA_U32_SEL, 176 TCA_U32_SEL,
175 TCA_U32_POLICE, 177 TCA_U32_POLICE,
176 TCA_U32_ACT, 178 TCA_U32_ACT,
177 TCA_U32_INDEV, 179 TCA_U32_INDEV,
178 TCA_U32_PCNT, 180 TCA_U32_PCNT,
179 TCA_U32_MARK, 181 TCA_U32_MARK,
diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
index 04be7021f848..318858edb1cd 100644
--- a/kernel/bpf/inode.c
+++ b/kernel/bpf/inode.c
@@ -365,7 +365,6 @@ static struct file_system_type bpf_fs_type = {
365 .name = "bpf", 365 .name = "bpf",
366 .mount = bpf_mount, 366 .mount = bpf_mount,
367 .kill_sb = kill_litter_super, 367 .kill_sb = kill_litter_super,
368 .fs_flags = FS_USERNS_MOUNT,
369}; 368};
370 369
371MODULE_ALIAS_FS("bpf"); 370MODULE_ALIAS_FS("bpf");
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 8c7392c4fdbd..e99df0ff1d42 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -425,6 +425,7 @@ void destroy_hrtimer_on_stack(struct hrtimer *timer)
425{ 425{
426 debug_object_free(timer, &hrtimer_debug_descr); 426 debug_object_free(timer, &hrtimer_debug_descr);
427} 427}
428EXPORT_SYMBOL_GPL(destroy_hrtimer_on_stack);
428 429
429#else 430#else
430static inline void debug_hrtimer_init(struct hrtimer *timer) { } 431static inline void debug_hrtimer_init(struct hrtimer *timer) { }
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index a1e273af6fc8..82a116ba590e 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -290,6 +290,10 @@ static void vlan_sync_address(struct net_device *dev,
290 if (ether_addr_equal(vlan->real_dev_addr, dev->dev_addr)) 290 if (ether_addr_equal(vlan->real_dev_addr, dev->dev_addr))
291 return; 291 return;
292 292
293 /* vlan continues to inherit address of lower device */
294 if (vlan_dev_inherit_address(vlandev, dev))
295 goto out;
296
293 /* vlan address was different from the old address and is equal to 297 /* vlan address was different from the old address and is equal to
294 * the new address */ 298 * the new address */
295 if (!ether_addr_equal(vlandev->dev_addr, vlan->real_dev_addr) && 299 if (!ether_addr_equal(vlandev->dev_addr, vlan->real_dev_addr) &&
@@ -302,6 +306,7 @@ static void vlan_sync_address(struct net_device *dev,
302 !ether_addr_equal(vlandev->dev_addr, dev->dev_addr)) 306 !ether_addr_equal(vlandev->dev_addr, dev->dev_addr))
303 dev_uc_add(dev, vlandev->dev_addr); 307 dev_uc_add(dev, vlandev->dev_addr);
304 308
309out:
305 ether_addr_copy(vlan->real_dev_addr, dev->dev_addr); 310 ether_addr_copy(vlan->real_dev_addr, dev->dev_addr);
306} 311}
307 312
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
index 9d010a09ab98..cc1557978066 100644
--- a/net/8021q/vlan.h
+++ b/net/8021q/vlan.h
@@ -109,6 +109,8 @@ int vlan_check_real_dev(struct net_device *real_dev,
109void vlan_setup(struct net_device *dev); 109void vlan_setup(struct net_device *dev);
110int register_vlan_dev(struct net_device *dev); 110int register_vlan_dev(struct net_device *dev);
111void unregister_vlan_dev(struct net_device *dev, struct list_head *head); 111void unregister_vlan_dev(struct net_device *dev, struct list_head *head);
112bool vlan_dev_inherit_address(struct net_device *dev,
113 struct net_device *real_dev);
112 114
113static inline u32 vlan_get_ingress_priority(struct net_device *dev, 115static inline u32 vlan_get_ingress_priority(struct net_device *dev,
114 u16 vlan_tci) 116 u16 vlan_tci)
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index e7e62570bdb8..86ae75b77390 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -245,6 +245,17 @@ void vlan_dev_get_realdev_name(const struct net_device *dev, char *result)
245 strncpy(result, vlan_dev_priv(dev)->real_dev->name, 23); 245 strncpy(result, vlan_dev_priv(dev)->real_dev->name, 23);
246} 246}
247 247
248bool vlan_dev_inherit_address(struct net_device *dev,
249 struct net_device *real_dev)
250{
251 if (dev->addr_assign_type != NET_ADDR_STOLEN)
252 return false;
253
254 ether_addr_copy(dev->dev_addr, real_dev->dev_addr);
255 call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
256 return true;
257}
258
248static int vlan_dev_open(struct net_device *dev) 259static int vlan_dev_open(struct net_device *dev)
249{ 260{
250 struct vlan_dev_priv *vlan = vlan_dev_priv(dev); 261 struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
@@ -255,7 +266,8 @@ static int vlan_dev_open(struct net_device *dev)
255 !(vlan->flags & VLAN_FLAG_LOOSE_BINDING)) 266 !(vlan->flags & VLAN_FLAG_LOOSE_BINDING))
256 return -ENETDOWN; 267 return -ENETDOWN;
257 268
258 if (!ether_addr_equal(dev->dev_addr, real_dev->dev_addr)) { 269 if (!ether_addr_equal(dev->dev_addr, real_dev->dev_addr) &&
270 !vlan_dev_inherit_address(dev, real_dev)) {
259 err = dev_uc_add(real_dev, dev->dev_addr); 271 err = dev_uc_add(real_dev, dev->dev_addr);
260 if (err < 0) 272 if (err < 0)
261 goto out; 273 goto out;
@@ -560,8 +572,10 @@ static int vlan_dev_init(struct net_device *dev)
560 /* ipv6 shared card related stuff */ 572 /* ipv6 shared card related stuff */
561 dev->dev_id = real_dev->dev_id; 573 dev->dev_id = real_dev->dev_id;
562 574
563 if (is_zero_ether_addr(dev->dev_addr)) 575 if (is_zero_ether_addr(dev->dev_addr)) {
564 eth_hw_addr_inherit(dev, real_dev); 576 ether_addr_copy(dev->dev_addr, real_dev->dev_addr);
577 dev->addr_assign_type = NET_ADDR_STOLEN;
578 }
565 if (is_zero_ether_addr(dev->broadcast)) 579 if (is_zero_ether_addr(dev->broadcast))
566 memcpy(dev->broadcast, real_dev->broadcast, dev->addr_len); 580 memcpy(dev->broadcast, real_dev->broadcast, dev->addr_len);
567 581
diff --git a/net/atm/signaling.c b/net/atm/signaling.c
index 4fd6af47383a..adb6e3d21b1e 100644
--- a/net/atm/signaling.c
+++ b/net/atm/signaling.c
@@ -124,7 +124,7 @@ as_indicate_complete:
124 break; 124 break;
125 case as_addparty: 125 case as_addparty:
126 case as_dropparty: 126 case as_dropparty:
127 sk->sk_err_soft = msg->reply; 127 sk->sk_err_soft = -msg->reply;
128 /* < 0 failure, otherwise ep_ref */ 128 /* < 0 failure, otherwise ep_ref */
129 clear_bit(ATM_VF_WAITING, &vcc->flags); 129 clear_bit(ATM_VF_WAITING, &vcc->flags);
130 break; 130 break;
diff --git a/net/atm/svc.c b/net/atm/svc.c
index 3fa0a9ee98d1..878563a8354d 100644
--- a/net/atm/svc.c
+++ b/net/atm/svc.c
@@ -546,7 +546,7 @@ static int svc_addparty(struct socket *sock, struct sockaddr *sockaddr,
546 schedule(); 546 schedule();
547 } 547 }
548 finish_wait(sk_sleep(sk), &wait); 548 finish_wait(sk_sleep(sk), &wait);
549 error = xchg(&sk->sk_err_soft, 0); 549 error = -xchg(&sk->sk_err_soft, 0);
550out: 550out:
551 release_sock(sk); 551 release_sock(sk);
552 return error; 552 return error;
@@ -573,7 +573,7 @@ static int svc_dropparty(struct socket *sock, int ep_ref)
573 error = -EUNATCH; 573 error = -EUNATCH;
574 goto out; 574 goto out;
575 } 575 }
576 error = xchg(&sk->sk_err_soft, 0); 576 error = -xchg(&sk->sk_err_soft, 0);
577out: 577out:
578 release_sock(sk); 578 release_sock(sk);
579 return error; 579 return error;
diff --git a/net/core/hwbm.c b/net/core/hwbm.c
index 941c28486896..2cab489ae62e 100644
--- a/net/core/hwbm.c
+++ b/net/core/hwbm.c
@@ -55,18 +55,21 @@ int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp)
55 spin_lock_irqsave(&bm_pool->lock, flags); 55 spin_lock_irqsave(&bm_pool->lock, flags);
56 if (bm_pool->buf_num == bm_pool->size) { 56 if (bm_pool->buf_num == bm_pool->size) {
57 pr_warn("pool already filled\n"); 57 pr_warn("pool already filled\n");
58 spin_unlock_irqrestore(&bm_pool->lock, flags);
58 return bm_pool->buf_num; 59 return bm_pool->buf_num;
59 } 60 }
60 61
61 if (buf_num + bm_pool->buf_num > bm_pool->size) { 62 if (buf_num + bm_pool->buf_num > bm_pool->size) {
62 pr_warn("cannot allocate %d buffers for pool\n", 63 pr_warn("cannot allocate %d buffers for pool\n",
63 buf_num); 64 buf_num);
65 spin_unlock_irqrestore(&bm_pool->lock, flags);
64 return 0; 66 return 0;
65 } 67 }
66 68
67 if ((buf_num + bm_pool->buf_num) < bm_pool->buf_num) { 69 if ((buf_num + bm_pool->buf_num) < bm_pool->buf_num) {
68 pr_warn("Adding %d buffers to the %d current buffers will overflow\n", 70 pr_warn("Adding %d buffers to the %d current buffers will overflow\n",
69 buf_num, bm_pool->buf_num); 71 buf_num, bm_pool->buf_num);
72 spin_unlock_irqrestore(&bm_pool->lock, flags);
70 return 0; 73 return 0;
71 } 74 }
72 75
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 8604ae245960..8b02df0d354d 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2245,10 +2245,8 @@ static void spin(struct pktgen_dev *pkt_dev, ktime_t spin_until)
2245 hrtimer_set_expires(&t.timer, spin_until); 2245 hrtimer_set_expires(&t.timer, spin_until);
2246 2246
2247 remaining = ktime_to_ns(hrtimer_expires_remaining(&t.timer)); 2247 remaining = ktime_to_ns(hrtimer_expires_remaining(&t.timer));
2248 if (remaining <= 0) { 2248 if (remaining <= 0)
2249 pkt_dev->next_tx = ktime_add_ns(spin_until, pkt_dev->delay); 2249 goto out;
2250 return;
2251 }
2252 2250
2253 start_time = ktime_get(); 2251 start_time = ktime_get();
2254 if (remaining < 100000) { 2252 if (remaining < 100000) {
@@ -2273,7 +2271,9 @@ static void spin(struct pktgen_dev *pkt_dev, ktime_t spin_until)
2273 } 2271 }
2274 2272
2275 pkt_dev->idle_acc += ktime_to_ns(ktime_sub(end_time, start_time)); 2273 pkt_dev->idle_acc += ktime_to_ns(ktime_sub(end_time, start_time));
2274out:
2276 pkt_dev->next_tx = ktime_add_ns(spin_until, pkt_dev->delay); 2275 pkt_dev->next_tx = ktime_add_ns(spin_until, pkt_dev->delay);
2276 destroy_hrtimer_on_stack(&t.timer);
2277} 2277}
2278 2278
2279static inline void set_pkt_overhead(struct pktgen_dev *pkt_dev) 2279static inline void set_pkt_overhead(struct pktgen_dev *pkt_dev)
diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index ca207dbf673b..116187b5c267 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1289,8 +1289,8 @@ ieee802154_llsec_parse_dev_addr(struct nlattr *nla,
1289 nl802154_dev_addr_policy)) 1289 nl802154_dev_addr_policy))
1290 return -EINVAL; 1290 return -EINVAL;
1291 1291
1292 if (!attrs[NL802154_DEV_ADDR_ATTR_PAN_ID] && 1292 if (!attrs[NL802154_DEV_ADDR_ATTR_PAN_ID] ||
1293 !attrs[NL802154_DEV_ADDR_ATTR_MODE] && 1293 !attrs[NL802154_DEV_ADDR_ATTR_MODE] ||
1294 !(attrs[NL802154_DEV_ADDR_ATTR_SHORT] || 1294 !(attrs[NL802154_DEV_ADDR_ATTR_SHORT] ||
1295 attrs[NL802154_DEV_ADDR_ATTR_EXTENDED])) 1295 attrs[NL802154_DEV_ADDR_ATTR_EXTENDED]))
1296 return -EINVAL; 1296 return -EINVAL;
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 377424ea17a4..d39e9e47a26e 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1681,6 +1681,14 @@ static __net_init int inet_init_net(struct net *net)
1681 */ 1681 */
1682 net->ipv4.ping_group_range.range[0] = make_kgid(&init_user_ns, 1); 1682 net->ipv4.ping_group_range.range[0] = make_kgid(&init_user_ns, 1);
1683 net->ipv4.ping_group_range.range[1] = make_kgid(&init_user_ns, 0); 1683 net->ipv4.ping_group_range.range[1] = make_kgid(&init_user_ns, 0);
1684
1685 /* Default values for sysctl-controlled parameters.
1686 * We set them here, in case sysctl is not compiled.
1687 */
1688 net->ipv4.sysctl_ip_default_ttl = IPDEFTTL;
1689 net->ipv4.sysctl_ip_dynaddr = 0;
1690 net->ipv4.sysctl_ip_early_demux = 1;
1691
1684 return 0; 1692 return 0;
1685} 1693}
1686 1694
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index bb0419582b8d..1cb67de106fe 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -999,10 +999,6 @@ static __net_init int ipv4_sysctl_init_net(struct net *net)
999 if (!net->ipv4.sysctl_local_reserved_ports) 999 if (!net->ipv4.sysctl_local_reserved_ports)
1000 goto err_ports; 1000 goto err_ports;
1001 1001
1002 net->ipv4.sysctl_ip_default_ttl = IPDEFTTL;
1003 net->ipv4.sysctl_ip_dynaddr = 0;
1004 net->ipv4.sysctl_ip_early_demux = 1;
1005
1006 return 0; 1002 return 0;
1007 1003
1008err_ports: 1004err_ports:
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig
index 3f8411328de5..2343e4f2e0bf 100644
--- a/net/ipv6/Kconfig
+++ b/net/ipv6/Kconfig
@@ -232,6 +232,15 @@ config IPV6_GRE
232 232
233 Saying M here will produce a module called ip6_gre. If unsure, say N. 233 Saying M here will produce a module called ip6_gre. If unsure, say N.
234 234
235config IPV6_FOU
236 tristate
237 default NET_FOU && IPV6
238
239config IPV6_FOU_TUNNEL
240 tristate
241 default NET_FOU_IP_TUNNELS && IPV6_FOU
242 select IPV6_TUNNEL
243
235config IPV6_MULTIPLE_TABLES 244config IPV6_MULTIPLE_TABLES
236 bool "IPv6: Multiple Routing Tables" 245 bool "IPv6: Multiple Routing Tables"
237 select FIB_RULES 246 select FIB_RULES
diff --git a/net/ipv6/Makefile b/net/ipv6/Makefile
index 7ec3129c9ace..6d8ea099213e 100644
--- a/net/ipv6/Makefile
+++ b/net/ipv6/Makefile
@@ -42,7 +42,7 @@ obj-$(CONFIG_IPV6_VTI) += ip6_vti.o
42obj-$(CONFIG_IPV6_SIT) += sit.o 42obj-$(CONFIG_IPV6_SIT) += sit.o
43obj-$(CONFIG_IPV6_TUNNEL) += ip6_tunnel.o 43obj-$(CONFIG_IPV6_TUNNEL) += ip6_tunnel.o
44obj-$(CONFIG_IPV6_GRE) += ip6_gre.o 44obj-$(CONFIG_IPV6_GRE) += ip6_gre.o
45obj-$(CONFIG_NET_FOU) += fou6.o 45obj-$(CONFIG_IPV6_FOU) += fou6.o
46 46
47obj-y += addrconf_core.o exthdrs_core.o ip6_checksum.o ip6_icmp.o 47obj-y += addrconf_core.o exthdrs_core.o ip6_checksum.o ip6_icmp.o
48obj-$(CONFIG_INET) += output_core.o protocol.o $(ipv6-offload) 48obj-$(CONFIG_INET) += output_core.o protocol.o $(ipv6-offload)
diff --git a/net/ipv6/fou6.c b/net/ipv6/fou6.c
index c972d0b52579..9ea249b9451e 100644
--- a/net/ipv6/fou6.c
+++ b/net/ipv6/fou6.c
@@ -69,7 +69,7 @@ int gue6_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e,
69} 69}
70EXPORT_SYMBOL(gue6_build_header); 70EXPORT_SYMBOL(gue6_build_header);
71 71
72#ifdef CONFIG_NET_FOU_IP_TUNNELS 72#if IS_ENABLED(CONFIG_IPV6_FOU_TUNNEL)
73 73
74static const struct ip6_tnl_encap_ops fou_ip6tun_ops = { 74static const struct ip6_tnl_encap_ops fou_ip6tun_ops = {
75 .encap_hlen = fou_encap_hlen, 75 .encap_hlen = fou_encap_hlen,
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index af503f518278..f4ac2842d4d9 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -712,6 +712,7 @@ static void ip6gre_tnl_link_config(struct ip6_tnl *t, int set_mtu)
712 fl6->daddr = p->raddr; 712 fl6->daddr = p->raddr;
713 fl6->flowi6_oif = p->link; 713 fl6->flowi6_oif = p->link;
714 fl6->flowlabel = 0; 714 fl6->flowlabel = 0;
715 fl6->flowi6_proto = IPPROTO_GRE;
715 716
716 if (!(p->flags&IP6_TNL_F_USE_ORIG_TCLASS)) 717 if (!(p->flags&IP6_TNL_F_USE_ORIG_TCLASS))
717 fl6->flowlabel |= IPV6_TCLASS_MASK & p->flowinfo; 718 fl6->flowlabel |= IPV6_TCLASS_MASK & p->flowinfo;
@@ -1027,6 +1028,8 @@ static int ip6gre_tunnel_init_common(struct net_device *dev)
1027 1028
1028 dev->hard_header_len = LL_MAX_HEADER + t_hlen; 1029 dev->hard_header_len = LL_MAX_HEADER + t_hlen;
1029 dev->mtu = ETH_DATA_LEN - t_hlen; 1030 dev->mtu = ETH_DATA_LEN - t_hlen;
1031 if (dev->type == ARPHRD_ETHER)
1032 dev->mtu -= ETH_HLEN;
1030 if (!(tunnel->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) 1033 if (!(tunnel->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT))
1031 dev->mtu -= 8; 1034 dev->mtu -= 8;
1032 1035
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c
index c6f5df1bed12..6c54e03fe9c1 100644
--- a/net/l2tp/l2tp_ip6.c
+++ b/net/l2tp/l2tp_ip6.c
@@ -128,6 +128,7 @@ static inline struct sock *l2tp_ip6_bind_lookup(struct net *net,
128 */ 128 */
129static int l2tp_ip6_recv(struct sk_buff *skb) 129static int l2tp_ip6_recv(struct sk_buff *skb)
130{ 130{
131 struct net *net = dev_net(skb->dev);
131 struct sock *sk; 132 struct sock *sk;
132 u32 session_id; 133 u32 session_id;
133 u32 tunnel_id; 134 u32 tunnel_id;
@@ -154,7 +155,7 @@ static int l2tp_ip6_recv(struct sk_buff *skb)
154 } 155 }
155 156
156 /* Ok, this is a data packet. Lookup the session. */ 157 /* Ok, this is a data packet. Lookup the session. */
157 session = l2tp_session_find(&init_net, NULL, session_id); 158 session = l2tp_session_find(net, NULL, session_id);
158 if (session == NULL) 159 if (session == NULL)
159 goto discard; 160 goto discard;
160 161
@@ -188,14 +189,14 @@ pass_up:
188 goto discard; 189 goto discard;
189 190
190 tunnel_id = ntohl(*(__be32 *) &skb->data[4]); 191 tunnel_id = ntohl(*(__be32 *) &skb->data[4]);
191 tunnel = l2tp_tunnel_find(&init_net, tunnel_id); 192 tunnel = l2tp_tunnel_find(net, tunnel_id);
192 if (tunnel != NULL) 193 if (tunnel != NULL)
193 sk = tunnel->sock; 194 sk = tunnel->sock;
194 else { 195 else {
195 struct ipv6hdr *iph = ipv6_hdr(skb); 196 struct ipv6hdr *iph = ipv6_hdr(skb);
196 197
197 read_lock_bh(&l2tp_ip6_lock); 198 read_lock_bh(&l2tp_ip6_lock);
198 sk = __l2tp_ip6_bind_lookup(&init_net, &iph->daddr, 199 sk = __l2tp_ip6_bind_lookup(net, &iph->daddr,
199 0, tunnel_id); 200 0, tunnel_id);
200 read_unlock_bh(&l2tp_ip6_lock); 201 read_unlock_bh(&l2tp_ip6_lock);
201 } 202 }
@@ -263,6 +264,7 @@ static int l2tp_ip6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
263 struct inet_sock *inet = inet_sk(sk); 264 struct inet_sock *inet = inet_sk(sk);
264 struct ipv6_pinfo *np = inet6_sk(sk); 265 struct ipv6_pinfo *np = inet6_sk(sk);
265 struct sockaddr_l2tpip6 *addr = (struct sockaddr_l2tpip6 *) uaddr; 266 struct sockaddr_l2tpip6 *addr = (struct sockaddr_l2tpip6 *) uaddr;
267 struct net *net = sock_net(sk);
266 __be32 v4addr = 0; 268 __be32 v4addr = 0;
267 int addr_type; 269 int addr_type;
268 int err; 270 int err;
@@ -286,7 +288,7 @@ static int l2tp_ip6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
286 288
287 err = -EADDRINUSE; 289 err = -EADDRINUSE;
288 read_lock_bh(&l2tp_ip6_lock); 290 read_lock_bh(&l2tp_ip6_lock);
289 if (__l2tp_ip6_bind_lookup(&init_net, &addr->l2tp_addr, 291 if (__l2tp_ip6_bind_lookup(net, &addr->l2tp_addr,
290 sk->sk_bound_dev_if, addr->l2tp_conn_id)) 292 sk->sk_bound_dev_if, addr->l2tp_conn_id))
291 goto out_in_use; 293 goto out_in_use;
292 read_unlock_bh(&l2tp_ip6_lock); 294 read_unlock_bh(&l2tp_ip6_lock);
@@ -456,7 +458,7 @@ static int l2tp_ip6_backlog_recv(struct sock *sk, struct sk_buff *skb)
456 return 0; 458 return 0;
457 459
458drop: 460drop:
459 IP_INC_STATS(&init_net, IPSTATS_MIB_INDISCARDS); 461 IP_INC_STATS(sock_net(sk), IPSTATS_MIB_INDISCARDS);
460 kfree_skb(skb); 462 kfree_skb(skb);
461 return -1; 463 return -1;
462} 464}
diff --git a/net/lapb/lapb_in.c b/net/lapb/lapb_in.c
index 5dba899131b3..182470847fcf 100644
--- a/net/lapb/lapb_in.c
+++ b/net/lapb/lapb_in.c
@@ -444,10 +444,9 @@ static void lapb_state3_machine(struct lapb_cb *lapb, struct sk_buff *skb,
444 break; 444 break;
445 445
446 case LAPB_FRMR: 446 case LAPB_FRMR:
447 lapb_dbg(1, "(%p) S3 RX FRMR(%d) %02X %02X %02X %02X %02X\n", 447 lapb_dbg(1, "(%p) S3 RX FRMR(%d) %5ph\n",
448 lapb->dev, frame->pf, 448 lapb->dev, frame->pf,
449 skb->data[0], skb->data[1], skb->data[2], 449 skb->data);
450 skb->data[3], skb->data[4]);
451 lapb_establish_data_link(lapb); 450 lapb_establish_data_link(lapb);
452 lapb_dbg(0, "(%p) S3 -> S1\n", lapb->dev); 451 lapb_dbg(0, "(%p) S3 -> S1\n", lapb->dev);
453 lapb_requeue_frames(lapb); 452 lapb_requeue_frames(lapb);
diff --git a/net/lapb/lapb_out.c b/net/lapb/lapb_out.c
index ba4d015bd1a6..482c94d9d958 100644
--- a/net/lapb/lapb_out.c
+++ b/net/lapb/lapb_out.c
@@ -148,9 +148,7 @@ void lapb_transmit_buffer(struct lapb_cb *lapb, struct sk_buff *skb, int type)
148 } 148 }
149 } 149 }
150 150
151 lapb_dbg(2, "(%p) S%d TX %02X %02X %02X\n", 151 lapb_dbg(2, "(%p) S%d TX %3ph\n", lapb->dev, lapb->state, skb->data);
152 lapb->dev, lapb->state,
153 skb->data[0], skb->data[1], skb->data[2]);
154 152
155 if (!lapb_data_transmit(lapb, skb)) 153 if (!lapb_data_transmit(lapb, skb))
156 kfree_skb(skb); 154 kfree_skb(skb);
diff --git a/net/lapb/lapb_subr.c b/net/lapb/lapb_subr.c
index 9d0a426eccbb..3c1914df641f 100644
--- a/net/lapb/lapb_subr.c
+++ b/net/lapb/lapb_subr.c
@@ -113,9 +113,7 @@ int lapb_decode(struct lapb_cb *lapb, struct sk_buff *skb,
113{ 113{
114 frame->type = LAPB_ILLEGAL; 114 frame->type = LAPB_ILLEGAL;
115 115
116 lapb_dbg(2, "(%p) S%d RX %02X %02X %02X\n", 116 lapb_dbg(2, "(%p) S%d RX %3ph\n", lapb->dev, lapb->state, skb->data);
117 lapb->dev, lapb->state,
118 skb->data[0], skb->data[1], skb->data[2]);
119 117
120 /* We always need to look at 2 bytes, sometimes we need 118 /* We always need to look at 2 bytes, sometimes we need
121 * to look at 3 and those cases are handled below. 119 * to look at 3 and those cases are handled below.
@@ -284,10 +282,9 @@ void lapb_transmit_frmr(struct lapb_cb *lapb)
284 dptr++; 282 dptr++;
285 *dptr++ = lapb->frmr_type; 283 *dptr++ = lapb->frmr_type;
286 284
287 lapb_dbg(1, "(%p) S%d TX FRMR %02X %02X %02X %02X %02X\n", 285 lapb_dbg(1, "(%p) S%d TX FRMR %5ph\n",
288 lapb->dev, lapb->state, 286 lapb->dev, lapb->state,
289 skb->data[1], skb->data[2], skb->data[3], 287 &skb->data[1]);
290 skb->data[4], skb->data[5]);
291 } else { 288 } else {
292 dptr = skb_put(skb, 4); 289 dptr = skb_put(skb, 4);
293 *dptr++ = LAPB_FRMR; 290 *dptr++ = LAPB_FRMR;
@@ -299,9 +296,8 @@ void lapb_transmit_frmr(struct lapb_cb *lapb)
299 dptr++; 296 dptr++;
300 *dptr++ = lapb->frmr_type; 297 *dptr++ = lapb->frmr_type;
301 298
302 lapb_dbg(1, "(%p) S%d TX FRMR %02X %02X %02X\n", 299 lapb_dbg(1, "(%p) S%d TX FRMR %3ph\n",
303 lapb->dev, lapb->state, skb->data[1], 300 lapb->dev, lapb->state, &skb->data[1]);
304 skb->data[2], skb->data[3]);
305 } 301 }
306 302
307 lapb_transmit_buffer(lapb, skb, LAPB_RESPONSE); 303 lapb_transmit_buffer(lapb, skb, LAPB_RESPONSE);
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index 879185fe183f..9a3eb7a0ebf4 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -137,11 +137,23 @@ static bool is_flow_key_valid(const struct sw_flow_key *key)
137 return !!key->eth.type; 137 return !!key->eth.type;
138} 138}
139 139
140static void update_ethertype(struct sk_buff *skb, struct ethhdr *hdr,
141 __be16 ethertype)
142{
143 if (skb->ip_summed == CHECKSUM_COMPLETE) {
144 __be16 diff[] = { ~(hdr->h_proto), ethertype };
145
146 skb->csum = ~csum_partial((char *)diff, sizeof(diff),
147 ~skb->csum);
148 }
149
150 hdr->h_proto = ethertype;
151}
152
140static int push_mpls(struct sk_buff *skb, struct sw_flow_key *key, 153static int push_mpls(struct sk_buff *skb, struct sw_flow_key *key,
141 const struct ovs_action_push_mpls *mpls) 154 const struct ovs_action_push_mpls *mpls)
142{ 155{
143 __be32 *new_mpls_lse; 156 __be32 *new_mpls_lse;
144 struct ethhdr *hdr;
145 157
146 /* Networking stack do not allow simultaneous Tunnel and MPLS GSO. */ 158 /* Networking stack do not allow simultaneous Tunnel and MPLS GSO. */
147 if (skb->encapsulation) 159 if (skb->encapsulation)
@@ -160,9 +172,7 @@ static int push_mpls(struct sk_buff *skb, struct sw_flow_key *key,
160 172
161 skb_postpush_rcsum(skb, new_mpls_lse, MPLS_HLEN); 173 skb_postpush_rcsum(skb, new_mpls_lse, MPLS_HLEN);
162 174
163 hdr = eth_hdr(skb); 175 update_ethertype(skb, eth_hdr(skb), mpls->mpls_ethertype);
164 hdr->h_proto = mpls->mpls_ethertype;
165
166 if (!skb->inner_protocol) 176 if (!skb->inner_protocol)
167 skb_set_inner_protocol(skb, skb->protocol); 177 skb_set_inner_protocol(skb, skb->protocol);
168 skb->protocol = mpls->mpls_ethertype; 178 skb->protocol = mpls->mpls_ethertype;
@@ -193,7 +203,7 @@ static int pop_mpls(struct sk_buff *skb, struct sw_flow_key *key,
193 * field correctly in the presence of VLAN tags. 203 * field correctly in the presence of VLAN tags.
194 */ 204 */
195 hdr = (struct ethhdr *)(skb_mpls_header(skb) - ETH_HLEN); 205 hdr = (struct ethhdr *)(skb_mpls_header(skb) - ETH_HLEN);
196 hdr->h_proto = ethertype; 206 update_ethertype(skb, hdr, ethertype);
197 if (eth_p_mpls(skb->protocol)) 207 if (eth_p_mpls(skb->protocol))
198 skb->protocol = ethertype; 208 skb->protocol = ethertype;
199 209
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index 330f14e302e8..b884dae692a1 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -239,6 +239,8 @@ override:
239 police->tcfp_t_c = ktime_get_ns(); 239 police->tcfp_t_c = ktime_get_ns();
240 police->tcf_index = parm->index ? parm->index : 240 police->tcf_index = parm->index ? parm->index :
241 tcf_hash_new_index(tn); 241 tcf_hash_new_index(tn);
242 police->tcf_tm.install = jiffies;
243 police->tcf_tm.lastuse = jiffies;
242 h = tcf_hash(police->tcf_index, POL_TAB_MASK); 244 h = tcf_hash(police->tcf_index, POL_TAB_MASK);
243 spin_lock_bh(&hinfo->lock); 245 spin_lock_bh(&hinfo->lock);
244 hlist_add_head(&police->tcf_head, &hinfo->htab[h]); 246 hlist_add_head(&police->tcf_head, &hinfo->htab[h]);
@@ -268,6 +270,7 @@ static int tcf_act_police(struct sk_buff *skb, const struct tc_action *a,
268 spin_lock(&police->tcf_lock); 270 spin_lock(&police->tcf_lock);
269 271
270 bstats_update(&police->tcf_bstats, skb); 272 bstats_update(&police->tcf_bstats, skb);
273 tcf_lastuse_update(&police->tcf_tm);
271 274
272 if (police->tcfp_ewma_rate && 275 if (police->tcfp_ewma_rate &&
273 police->tcf_rate_est.bps >= police->tcfp_ewma_rate) { 276 police->tcf_rate_est.bps >= police->tcfp_ewma_rate) {
@@ -327,6 +330,7 @@ tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
327 .refcnt = police->tcf_refcnt - ref, 330 .refcnt = police->tcf_refcnt - ref,
328 .bindcnt = police->tcf_bindcnt - bind, 331 .bindcnt = police->tcf_bindcnt - bind,
329 }; 332 };
333 struct tcf_t t;
330 334
331 if (police->rate_present) 335 if (police->rate_present)
332 psched_ratecfg_getrate(&opt.rate, &police->rate); 336 psched_ratecfg_getrate(&opt.rate, &police->rate);
@@ -340,6 +344,13 @@ tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
340 if (police->tcfp_ewma_rate && 344 if (police->tcfp_ewma_rate &&
341 nla_put_u32(skb, TCA_POLICE_AVRATE, police->tcfp_ewma_rate)) 345 nla_put_u32(skb, TCA_POLICE_AVRATE, police->tcfp_ewma_rate))
342 goto nla_put_failure; 346 goto nla_put_failure;
347
348 t.install = jiffies_to_clock_t(jiffies - police->tcf_tm.install);
349 t.lastuse = jiffies_to_clock_t(jiffies - police->tcf_tm.lastuse);
350 t.expires = jiffies_to_clock_t(police->tcf_tm.expires);
351 if (nla_put_64bit(skb, TCA_POLICE_TM, sizeof(t), &t, TCA_POLICE_PAD))
352 goto nla_put_failure;
353
343 return skb->len; 354 return skb->len;
344 355
345nla_put_failure: 356nla_put_failure:
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 64f71a2155f3..ddf047df5361 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -607,6 +607,10 @@ void qdisc_watchdog_schedule_ns(struct qdisc_watchdog *wd, u64 expires, bool thr
607 if (throttle) 607 if (throttle)
608 qdisc_throttled(wd->qdisc); 608 qdisc_throttled(wd->qdisc);
609 609
610 if (wd->last_expires == expires)
611 return;
612
613 wd->last_expires = expires;
610 hrtimer_start(&wd->timer, 614 hrtimer_start(&wd->timer,
611 ns_to_ktime(expires), 615 ns_to_ktime(expires),
612 HRTIMER_MODE_ABS_PINNED); 616 HRTIMER_MODE_ABS_PINNED);
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index f6bf5818ed4d..d4b4218af6b1 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -928,17 +928,10 @@ ok:
928 } 928 }
929 } 929 }
930 qdisc_qstats_overlimit(sch); 930 qdisc_qstats_overlimit(sch);
931 if (likely(next_event > q->now)) { 931 if (likely(next_event > q->now))
932 if (!test_bit(__QDISC_STATE_DEACTIVATED, 932 qdisc_watchdog_schedule_ns(&q->watchdog, next_event, true);
933 &qdisc_root_sleeping(q->watchdog.qdisc)->state)) { 933 else
934 ktime_t time = ns_to_ktime(next_event);
935 qdisc_throttled(q->watchdog.qdisc);
936 hrtimer_start(&q->watchdog.timer, time,
937 HRTIMER_MODE_ABS_PINNED);
938 }
939 } else {
940 schedule_work(&q->work); 934 schedule_work(&q->work);
941 }
942fin: 935fin:
943 return skb; 936 return skb;
944} 937}
diff --git a/net/sctp/sctp_diag.c b/net/sctp/sctp_diag.c
index 8e3e769dc9ea..1ce724b87618 100644
--- a/net/sctp/sctp_diag.c
+++ b/net/sctp/sctp_diag.c
@@ -356,6 +356,9 @@ static int sctp_ep_dump(struct sctp_endpoint *ep, void *p)
356 if (cb->args[4] < cb->args[1]) 356 if (cb->args[4] < cb->args[1])
357 goto next; 357 goto next;
358 358
359 if ((r->idiag_states & ~TCPF_LISTEN) && !list_empty(&ep->asocs))
360 goto next;
361
359 if (r->sdiag_family != AF_UNSPEC && 362 if (r->sdiag_family != AF_UNSPEC &&
360 sk->sk_family != r->sdiag_family) 363 sk->sk_family != r->sdiag_family)
361 goto next; 364 goto next;
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 777d0324594a..67154b848aa9 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -4220,6 +4220,7 @@ int sctp_get_sctp_info(struct sock *sk, struct sctp_association *asoc,
4220 info->sctpi_s_disable_fragments = sp->disable_fragments; 4220 info->sctpi_s_disable_fragments = sp->disable_fragments;
4221 info->sctpi_s_v4mapped = sp->v4mapped; 4221 info->sctpi_s_v4mapped = sp->v4mapped;
4222 info->sctpi_s_frag_interleave = sp->frag_interleave; 4222 info->sctpi_s_frag_interleave = sp->frag_interleave;
4223 info->sctpi_s_type = sp->type;
4223 4224
4224 return 0; 4225 return 0;
4225 } 4226 }
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index 4dfc5c14f8c3..f795b1dd0ccd 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -346,9 +346,15 @@ static int tipc_nl_compat_bearer_dump(struct tipc_nl_compat_msg *msg,
346 struct nlattr **attrs) 346 struct nlattr **attrs)
347{ 347{
348 struct nlattr *bearer[TIPC_NLA_BEARER_MAX + 1]; 348 struct nlattr *bearer[TIPC_NLA_BEARER_MAX + 1];
349 int err;
350
351 if (!attrs[TIPC_NLA_BEARER])
352 return -EINVAL;
349 353
350 nla_parse_nested(bearer, TIPC_NLA_BEARER_MAX, attrs[TIPC_NLA_BEARER], 354 err = nla_parse_nested(bearer, TIPC_NLA_BEARER_MAX,
351 NULL); 355 attrs[TIPC_NLA_BEARER], NULL);
356 if (err)
357 return err;
352 358
353 return tipc_add_tlv(msg->rep, TIPC_TLV_BEARER_NAME, 359 return tipc_add_tlv(msg->rep, TIPC_TLV_BEARER_NAME,
354 nla_data(bearer[TIPC_NLA_BEARER_NAME]), 360 nla_data(bearer[TIPC_NLA_BEARER_NAME]),
@@ -460,14 +466,31 @@ static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg,
460 struct nlattr *link[TIPC_NLA_LINK_MAX + 1]; 466 struct nlattr *link[TIPC_NLA_LINK_MAX + 1];
461 struct nlattr *prop[TIPC_NLA_PROP_MAX + 1]; 467 struct nlattr *prop[TIPC_NLA_PROP_MAX + 1];
462 struct nlattr *stats[TIPC_NLA_STATS_MAX + 1]; 468 struct nlattr *stats[TIPC_NLA_STATS_MAX + 1];
469 int err;
463 470
464 nla_parse_nested(link, TIPC_NLA_LINK_MAX, attrs[TIPC_NLA_LINK], NULL); 471 if (!attrs[TIPC_NLA_LINK])
472 return -EINVAL;
465 473
466 nla_parse_nested(prop, TIPC_NLA_PROP_MAX, link[TIPC_NLA_LINK_PROP], 474 err = nla_parse_nested(link, TIPC_NLA_LINK_MAX, attrs[TIPC_NLA_LINK],
467 NULL); 475 NULL);
476 if (err)
477 return err;
478
479 if (!link[TIPC_NLA_LINK_PROP])
480 return -EINVAL;
468 481
469 nla_parse_nested(stats, TIPC_NLA_STATS_MAX, link[TIPC_NLA_LINK_STATS], 482 err = nla_parse_nested(prop, TIPC_NLA_PROP_MAX,
470 NULL); 483 link[TIPC_NLA_LINK_PROP], NULL);
484 if (err)
485 return err;
486
487 if (!link[TIPC_NLA_LINK_STATS])
488 return -EINVAL;
489
490 err = nla_parse_nested(stats, TIPC_NLA_STATS_MAX,
491 link[TIPC_NLA_LINK_STATS], NULL);
492 if (err)
493 return err;
471 494
472 name = (char *)TLV_DATA(msg->req); 495 name = (char *)TLV_DATA(msg->req);
473 if (strcmp(name, nla_data(link[TIPC_NLA_LINK_NAME])) != 0) 496 if (strcmp(name, nla_data(link[TIPC_NLA_LINK_NAME])) != 0)
@@ -569,8 +592,15 @@ static int tipc_nl_compat_link_dump(struct tipc_nl_compat_msg *msg,
569{ 592{
570 struct nlattr *link[TIPC_NLA_LINK_MAX + 1]; 593 struct nlattr *link[TIPC_NLA_LINK_MAX + 1];
571 struct tipc_link_info link_info; 594 struct tipc_link_info link_info;
595 int err;
572 596
573 nla_parse_nested(link, TIPC_NLA_LINK_MAX, attrs[TIPC_NLA_LINK], NULL); 597 if (!attrs[TIPC_NLA_LINK])
598 return -EINVAL;
599
600 err = nla_parse_nested(link, TIPC_NLA_LINK_MAX, attrs[TIPC_NLA_LINK],
601 NULL);
602 if (err)
603 return err;
574 604
575 link_info.dest = nla_get_flag(link[TIPC_NLA_LINK_DEST]); 605 link_info.dest = nla_get_flag(link[TIPC_NLA_LINK_DEST]);
576 link_info.up = htonl(nla_get_flag(link[TIPC_NLA_LINK_UP])); 606 link_info.up = htonl(nla_get_flag(link[TIPC_NLA_LINK_UP]));
@@ -758,12 +788,23 @@ static int tipc_nl_compat_name_table_dump(struct tipc_nl_compat_msg *msg,
758 u32 node, depth, type, lowbound, upbound; 788 u32 node, depth, type, lowbound, upbound;
759 static const char * const scope_str[] = {"", " zone", " cluster", 789 static const char * const scope_str[] = {"", " zone", " cluster",
760 " node"}; 790 " node"};
791 int err;
761 792
762 nla_parse_nested(nt, TIPC_NLA_NAME_TABLE_MAX, 793 if (!attrs[TIPC_NLA_NAME_TABLE])
763 attrs[TIPC_NLA_NAME_TABLE], NULL); 794 return -EINVAL;
764 795
765 nla_parse_nested(publ, TIPC_NLA_PUBL_MAX, nt[TIPC_NLA_NAME_TABLE_PUBL], 796 err = nla_parse_nested(nt, TIPC_NLA_NAME_TABLE_MAX,
766 NULL); 797 attrs[TIPC_NLA_NAME_TABLE], NULL);
798 if (err)
799 return err;
800
801 if (!nt[TIPC_NLA_NAME_TABLE_PUBL])
802 return -EINVAL;
803
804 err = nla_parse_nested(publ, TIPC_NLA_PUBL_MAX,
805 nt[TIPC_NLA_NAME_TABLE_PUBL], NULL);
806 if (err)
807 return err;
767 808
768 ntq = (struct tipc_name_table_query *)TLV_DATA(msg->req); 809 ntq = (struct tipc_name_table_query *)TLV_DATA(msg->req);
769 810
@@ -815,8 +856,15 @@ static int __tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg,
815{ 856{
816 u32 type, lower, upper; 857 u32 type, lower, upper;
817 struct nlattr *publ[TIPC_NLA_PUBL_MAX + 1]; 858 struct nlattr *publ[TIPC_NLA_PUBL_MAX + 1];
859 int err;
818 860
819 nla_parse_nested(publ, TIPC_NLA_PUBL_MAX, attrs[TIPC_NLA_PUBL], NULL); 861 if (!attrs[TIPC_NLA_PUBL])
862 return -EINVAL;
863
864 err = nla_parse_nested(publ, TIPC_NLA_PUBL_MAX, attrs[TIPC_NLA_PUBL],
865 NULL);
866 if (err)
867 return err;
820 868
821 type = nla_get_u32(publ[TIPC_NLA_PUBL_TYPE]); 869 type = nla_get_u32(publ[TIPC_NLA_PUBL_TYPE]);
822 lower = nla_get_u32(publ[TIPC_NLA_PUBL_LOWER]); 870 lower = nla_get_u32(publ[TIPC_NLA_PUBL_LOWER]);
@@ -876,7 +924,13 @@ static int tipc_nl_compat_sk_dump(struct tipc_nl_compat_msg *msg,
876 u32 sock_ref; 924 u32 sock_ref;
877 struct nlattr *sock[TIPC_NLA_SOCK_MAX + 1]; 925 struct nlattr *sock[TIPC_NLA_SOCK_MAX + 1];
878 926
879 nla_parse_nested(sock, TIPC_NLA_SOCK_MAX, attrs[TIPC_NLA_SOCK], NULL); 927 if (!attrs[TIPC_NLA_SOCK])
928 return -EINVAL;
929
930 err = nla_parse_nested(sock, TIPC_NLA_SOCK_MAX, attrs[TIPC_NLA_SOCK],
931 NULL);
932 if (err)
933 return err;
880 934
881 sock_ref = nla_get_u32(sock[TIPC_NLA_SOCK_REF]); 935 sock_ref = nla_get_u32(sock[TIPC_NLA_SOCK_REF]);
882 tipc_tlv_sprintf(msg->rep, "%u:", sock_ref); 936 tipc_tlv_sprintf(msg->rep, "%u:", sock_ref);
@@ -917,9 +971,15 @@ static int tipc_nl_compat_media_dump(struct tipc_nl_compat_msg *msg,
917 struct nlattr **attrs) 971 struct nlattr **attrs)
918{ 972{
919 struct nlattr *media[TIPC_NLA_MEDIA_MAX + 1]; 973 struct nlattr *media[TIPC_NLA_MEDIA_MAX + 1];
974 int err;
975
976 if (!attrs[TIPC_NLA_MEDIA])
977 return -EINVAL;
920 978
921 nla_parse_nested(media, TIPC_NLA_MEDIA_MAX, attrs[TIPC_NLA_MEDIA], 979 err = nla_parse_nested(media, TIPC_NLA_MEDIA_MAX, attrs[TIPC_NLA_MEDIA],
922 NULL); 980 NULL);
981 if (err)
982 return err;
923 983
924 return tipc_add_tlv(msg->rep, TIPC_TLV_MEDIA_NAME, 984 return tipc_add_tlv(msg->rep, TIPC_TLV_MEDIA_NAME,
925 nla_data(media[TIPC_NLA_MEDIA_NAME]), 985 nla_data(media[TIPC_NLA_MEDIA_NAME]),
@@ -931,8 +991,15 @@ static int tipc_nl_compat_node_dump(struct tipc_nl_compat_msg *msg,
931{ 991{
932 struct tipc_node_info node_info; 992 struct tipc_node_info node_info;
933 struct nlattr *node[TIPC_NLA_NODE_MAX + 1]; 993 struct nlattr *node[TIPC_NLA_NODE_MAX + 1];
994 int err;
934 995
935 nla_parse_nested(node, TIPC_NLA_NODE_MAX, attrs[TIPC_NLA_NODE], NULL); 996 if (!attrs[TIPC_NLA_NODE])
997 return -EINVAL;
998
999 err = nla_parse_nested(node, TIPC_NLA_NODE_MAX, attrs[TIPC_NLA_NODE],
1000 NULL);
1001 if (err)
1002 return err;
936 1003
937 node_info.addr = htonl(nla_get_u32(node[TIPC_NLA_NODE_ADDR])); 1004 node_info.addr = htonl(nla_get_u32(node[TIPC_NLA_NODE_ADDR]));
938 node_info.up = htonl(nla_get_flag(node[TIPC_NLA_NODE_UP])); 1005 node_info.up = htonl(nla_get_flag(node[TIPC_NLA_NODE_UP]));
@@ -971,8 +1038,16 @@ static int tipc_nl_compat_net_dump(struct tipc_nl_compat_msg *msg,
971{ 1038{
972 __be32 id; 1039 __be32 id;
973 struct nlattr *net[TIPC_NLA_NET_MAX + 1]; 1040 struct nlattr *net[TIPC_NLA_NET_MAX + 1];
1041 int err;
1042
1043 if (!attrs[TIPC_NLA_NET])
1044 return -EINVAL;
1045
1046 err = nla_parse_nested(net, TIPC_NLA_NET_MAX, attrs[TIPC_NLA_NET],
1047 NULL);
1048 if (err)
1049 return err;
974 1050
975 nla_parse_nested(net, TIPC_NLA_NET_MAX, attrs[TIPC_NLA_NET], NULL);
976 id = htonl(nla_get_u32(net[TIPC_NLA_NET_ID])); 1051 id = htonl(nla_get_u32(net[TIPC_NLA_NET_ID]));
977 1052
978 return tipc_add_tlv(msg->rep, TIPC_TLV_UNSIGNED, &id, sizeof(id)); 1053 return tipc_add_tlv(msg->rep, TIPC_TLV_UNSIGNED, &id, sizeof(id));