aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-05-02 12:40:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-02 12:40:42 -0400
commit9c5d1bc2b73609ada2eaba75e9c8f4963e95b977 (patch)
treebffac5114faf301e95829996b9f9f3a17e991ae6
parentba22906a9fdb197b10e3e062dc8c438efb7ea6f6 (diff)
parentb7f8fe251e4609e2a437bd2c2dea01e61db6849c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) MODULE_FIRMWARE firmware string not correct for iwlwifi 8000 chips, from Sara Sharon. 2) Fix SKB size checks in batman-adv stack on receive, from Sven Eckelmann. 3) Leak fix on mac80211 interface add error paths, from Johannes Berg. 4) Cannot invoke napi_disable() with BH disabled in myri10ge driver, fix from Stanislaw Gruszka. 5) Fix sign extension problem when computing feature masks in net_gso_ok(), from Marcelo Ricardo Leitner. 6) lan78xx driver doesn't count packets and packet lengths in its statistics properly, fix from Woojung Huh. 7) Fix the buffer allocation sizes in pegasus USB driver, from Petko Manolov. 8) Fix refcount overflows in bpf, from Alexei Starovoitov. 9) Unified dst cache handling introduced a preempt warning in ip_tunnel, fix by resetting rather then setting the cached route. From Paolo Abeni. 10) Listener hash collision test fix in soreuseport, from Craig Gallak * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (47 commits) gre: do not pull header in ICMP error processing net: Implement net_dbg_ratelimited() for CONFIG_DYNAMIC_DEBUG case tipc: only process unicast on intended node cxgb3: fix out of bounds read net/smscx5xx: use the device tree for mac address soreuseport: Fix TCP listener hash collision net: l2tp: fix reversed udp6 checksum flags ip_tunnel: fix preempt warning in ip tunnel creation/updating samples/bpf: fix trace_output example bpf: fix check_map_func_compatibility logic bpf: fix refcnt overflow drivers: net: cpsw: use of_phy_connect() in fixed-link case dt: cpsw: phy-handle, phy_id, and fixed-link are mutually exclusive drivers: net: cpsw: don't ignore phy-mode if phy-handle is used drivers: net: cpsw: fix segfault in case of bad phy-handle drivers: net: cpsw: fix parsing of phy-handle DT property in dual_emac config MAINTAINERS: net: Change maintainer for GRETH 10/100/1G Ethernet MAC device driver gre: reject GUE and FOU in collect metadata mode pegasus: fixes reported packet length pegasus: fixes URB buffer allocation size; ...
-rw-r--r--Documentation/devicetree/bindings/net/cpsw.txt6
-rw-r--r--Documentation/networking/altera_tse.txt6
-rw-r--r--Documentation/networking/ipvlan.txt6
-rw-r--r--Documentation/networking/pktgen.txt6
-rw-r--r--Documentation/networking/vrf.txt2
-rw-r--r--Documentation/networking/xfrm_sync.txt6
-rw-r--r--MAINTAINERS5
-rw-r--r--drivers/net/dsa/mv88e6xxx.c2
-rw-r--r--drivers/net/ethernet/broadcom/bnxt/bnxt.c53
-rw-r--r--drivers/net/ethernet/broadcom/bnxt/bnxt.h13
-rw-r--r--drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c3
-rw-r--r--drivers/net/ethernet/myricom/myri10ge/myri10ge.c4
-rw-r--r--drivers/net/ethernet/sfc/ef10.c15
-rw-r--r--drivers/net/ethernet/ti/cpsw.c67
-rw-r--r--drivers/net/ethernet/ti/cpsw.h1
-rw-r--r--drivers/net/ethernet/ti/davinci_emac.c5
-rw-r--r--drivers/net/ethernet/toshiba/ps3_gelic_wireless.c2
-rw-r--r--drivers/net/phy/at803x.c40
-rw-r--r--drivers/net/usb/lan78xx.c44
-rw-r--r--drivers/net/usb/pegasus.c10
-rw-r--r--drivers/net/usb/smsc75xx.c12
-rw-r--r--drivers/net/usb/smsc95xx.c12
-rw-r--r--drivers/net/wireless/ath/ath9k/ar5008_phy.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_phy.c5
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-8000.c2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-drv.c26
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c6
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/fw.c2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/drv.c10
-rw-r--r--include/linux/bpf.h3
-rw-r--r--include/linux/net.h10
-rw-r--r--include/linux/netdevice.h2
-rw-r--r--kernel/bpf/inode.c7
-rw-r--r--kernel/bpf/syscall.c24
-rw-r--r--kernel/bpf/verifier.c76
-rw-r--r--net/batman-adv/hard-interface.c3
-rw-r--r--net/batman-adv/originator.c1
-rw-r--r--net/batman-adv/routing.c9
-rw-r--r--net/batman-adv/send.c6
-rw-r--r--net/batman-adv/soft-interface.c8
-rw-r--r--net/ipv4/inet_hashtables.c2
-rw-r--r--net/ipv4/ip_gre.c30
-rw-r--r--net/ipv4/ip_tunnel.c4
-rw-r--r--net/l2tp/l2tp_core.c4
-rw-r--r--net/mac80211/iface.c4
-rw-r--r--net/tipc/node.c5
-rw-r--r--samples/bpf/trace_output_kern.c1
47 files changed, 384 insertions, 194 deletions
diff --git a/Documentation/devicetree/bindings/net/cpsw.txt b/Documentation/devicetree/bindings/net/cpsw.txt
index 28a4781ab6d7..0ae06491b430 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -45,13 +45,13 @@ Required properties:
45Optional properties: 45Optional properties:
46- dual_emac_res_vlan : Specifies VID to be used to segregate the ports 46- dual_emac_res_vlan : Specifies VID to be used to segregate the ports
47- mac-address : See ethernet.txt file in the same directory 47- mac-address : See ethernet.txt file in the same directory
48- phy_id : Specifies slave phy id 48- phy_id : Specifies slave phy id (deprecated, use phy-handle)
49- phy-handle : See ethernet.txt file in the same directory 49- phy-handle : See ethernet.txt file in the same directory
50 50
51Slave sub-nodes: 51Slave sub-nodes:
52- fixed-link : See fixed-link.txt file in the same directory 52- fixed-link : See fixed-link.txt file in the same directory
53 Either the property phy_id, or the sub-node 53
54 fixed-link can be specified 54Note: Exactly one of phy_id, phy-handle, or fixed-link must be specified.
55 55
56Note: "ti,hwmods" field is used to fetch the base address and irq 56Note: "ti,hwmods" field is used to fetch the base address and irq
57resources from TI, omap hwmod data base during device registration. 57resources from TI, omap hwmod data base during device registration.
diff --git a/Documentation/networking/altera_tse.txt b/Documentation/networking/altera_tse.txt
index 3f24df8c6e65..50b8589d12fd 100644
--- a/Documentation/networking/altera_tse.txt
+++ b/Documentation/networking/altera_tse.txt
@@ -6,7 +6,7 @@ This is the driver for the Altera Triple-Speed Ethernet (TSE) controllers
6using the SGDMA and MSGDMA soft DMA IP components. The driver uses the 6using the SGDMA and MSGDMA soft DMA IP components. The driver uses the
7platform bus to obtain component resources. The designs used to test this 7platform bus to obtain component resources. The designs used to test this
8driver were built for a Cyclone(R) V SOC FPGA board, a Cyclone(R) V FPGA board, 8driver were built for a Cyclone(R) V SOC FPGA board, a Cyclone(R) V FPGA board,
9and tested with ARM and NIOS processor hosts seperately. The anticipated use 9and tested with ARM and NIOS processor hosts separately. The anticipated use
10cases are simple communications between an embedded system and an external peer 10cases are simple communications between an embedded system and an external peer
11for status and simple configuration of the embedded system. 11for status and simple configuration of the embedded system.
12 12
@@ -65,14 +65,14 @@ Driver parameters can be also passed in command line by using:
654.1) Transmit process 654.1) Transmit process
66When the driver's transmit routine is called by the kernel, it sets up a 66When the driver's transmit routine is called by the kernel, it sets up a
67transmit descriptor by calling the underlying DMA transmit routine (SGDMA or 67transmit descriptor by calling the underlying DMA transmit routine (SGDMA or
68MSGDMA), and initites a transmit operation. Once the transmit is complete, an 68MSGDMA), and initiates a transmit operation. Once the transmit is complete, an
69interrupt is driven by the transmit DMA logic. The driver handles the transmit 69interrupt is driven by the transmit DMA logic. The driver handles the transmit
70completion in the context of the interrupt handling chain by recycling 70completion in the context of the interrupt handling chain by recycling
71resource required to send and track the requested transmit operation. 71resource required to send and track the requested transmit operation.
72 72
734.2) Receive process 734.2) Receive process
74The driver will post receive buffers to the receive DMA logic during driver 74The driver will post receive buffers to the receive DMA logic during driver
75intialization. Receive buffers may or may not be queued depending upon the 75initialization. Receive buffers may or may not be queued depending upon the
76underlying DMA logic (MSGDMA is able queue receive buffers, SGDMA is not able 76underlying DMA logic (MSGDMA is able queue receive buffers, SGDMA is not able
77to queue receive buffers to the SGDMA receive logic). When a packet is 77to queue receive buffers to the SGDMA receive logic). When a packet is
78received, the DMA logic generates an interrupt. The driver handles a receive 78received, the DMA logic generates an interrupt. The driver handles a receive
diff --git a/Documentation/networking/ipvlan.txt b/Documentation/networking/ipvlan.txt
index cf996394e466..14422f8fcdc4 100644
--- a/Documentation/networking/ipvlan.txt
+++ b/Documentation/networking/ipvlan.txt
@@ -8,7 +8,7 @@ Initial Release:
8 This is conceptually very similar to the macvlan driver with one major 8 This is conceptually very similar to the macvlan driver with one major
9exception of using L3 for mux-ing /demux-ing among slaves. This property makes 9exception of using L3 for mux-ing /demux-ing among slaves. This property makes
10the master device share the L2 with it's slave devices. I have developed this 10the master device share the L2 with it's slave devices. I have developed this
11driver in conjuntion with network namespaces and not sure if there is use case 11driver in conjunction with network namespaces and not sure if there is use case
12outside of it. 12outside of it.
13 13
14 14
@@ -42,7 +42,7 @@ out. In this mode the slaves will RX/TX multicast and broadcast (if applicable)
42as well. 42as well.
43 43
444.2 L3 mode: 444.2 L3 mode:
45 In this mode TX processing upto L3 happens on the stack instance attached 45 In this mode TX processing up to L3 happens on the stack instance attached
46to the slave device and packets are switched to the stack instance of the 46to the slave device and packets are switched to the stack instance of the
47master device for the L2 processing and routing from that instance will be 47master device for the L2 processing and routing from that instance will be
48used before packets are queued on the outbound device. In this mode the slaves 48used before packets are queued on the outbound device. In this mode the slaves
@@ -56,7 +56,7 @@ situations defines your use case then you can choose to use ipvlan -
56 (a) The Linux host that is connected to the external switch / router has 56 (a) The Linux host that is connected to the external switch / router has
57policy configured that allows only one mac per port. 57policy configured that allows only one mac per port.
58 (b) No of virtual devices created on a master exceed the mac capacity and 58 (b) No of virtual devices created on a master exceed the mac capacity and
59puts the NIC in promiscous mode and degraded performance is a concern. 59puts the NIC in promiscuous mode and degraded performance is a concern.
60 (c) If the slave device is to be put into the hostile / untrusted network 60 (c) If the slave device is to be put into the hostile / untrusted network
61namespace where L2 on the slave could be changed / misused. 61namespace where L2 on the slave could be changed / misused.
62 62
diff --git a/Documentation/networking/pktgen.txt b/Documentation/networking/pktgen.txt
index f4be85e96005..2c4e3354e128 100644
--- a/Documentation/networking/pktgen.txt
+++ b/Documentation/networking/pktgen.txt
@@ -67,12 +67,12 @@ The two basic thread commands are:
67 * add_device DEVICE@NAME -- adds a single device 67 * add_device DEVICE@NAME -- adds a single device
68 * rem_device_all -- remove all associated devices 68 * rem_device_all -- remove all associated devices
69 69
70When adding a device to a thread, a corrosponding procfile is created 70When adding a device to a thread, a corresponding procfile is created
71which is used for configuring this device. Thus, device names need to 71which is used for configuring this device. Thus, device names need to
72be unique. 72be unique.
73 73
74To support adding the same device to multiple threads, which is useful 74To support adding the same device to multiple threads, which is useful
75with multi queue NICs, a the device naming scheme is extended with "@": 75with multi queue NICs, the device naming scheme is extended with "@":
76 device@something 76 device@something
77 77
78The part after "@" can be anything, but it is custom to use the thread 78The part after "@" can be anything, but it is custom to use the thread
@@ -221,7 +221,7 @@ Sample scripts
221 221
222A collection of tutorial scripts and helpers for pktgen is in the 222A collection of tutorial scripts and helpers for pktgen is in the
223samples/pktgen directory. The helper parameters.sh file support easy 223samples/pktgen directory. The helper parameters.sh file support easy
224and consistant parameter parsing across the sample scripts. 224and consistent parameter parsing across the sample scripts.
225 225
226Usage example and help: 226Usage example and help:
227 ./pktgen_sample01_simple.sh -i eth4 -m 00:1B:21:3C:9D:F8 -d 192.168.8.2 227 ./pktgen_sample01_simple.sh -i eth4 -m 00:1B:21:3C:9D:F8 -d 192.168.8.2
diff --git a/Documentation/networking/vrf.txt b/Documentation/networking/vrf.txt
index d52aa10cfe91..5da679c573d2 100644
--- a/Documentation/networking/vrf.txt
+++ b/Documentation/networking/vrf.txt
@@ -41,7 +41,7 @@ using an rx_handler which gives the impression that packets flow through
41the VRF device. Similarly on egress routing rules are used to send packets 41the VRF device. Similarly on egress routing rules are used to send packets
42to the VRF device driver before getting sent out the actual interface. This 42to the VRF device driver before getting sent out the actual interface. This
43allows tcpdump on a VRF device to capture all packets into and out of the 43allows tcpdump on a VRF device to capture all packets into and out of the
44VRF as a whole.[1] Similiarly, netfilter [2] and tc rules can be applied 44VRF as a whole.[1] Similarly, netfilter [2] and tc rules can be applied
45using the VRF device to specify rules that apply to the VRF domain as a whole. 45using the VRF device to specify rules that apply to the VRF domain as a whole.
46 46
47[1] Packets in the forwarded state do not flow through the device, so those 47[1] Packets in the forwarded state do not flow through the device, so those
diff --git a/Documentation/networking/xfrm_sync.txt b/Documentation/networking/xfrm_sync.txt
index d7aac9dedeb4..8d88e0f2ec49 100644
--- a/Documentation/networking/xfrm_sync.txt
+++ b/Documentation/networking/xfrm_sync.txt
@@ -4,7 +4,7 @@ Krisztian <hidden@balabit.hu> and others and additional patches
4from Jamal <hadi@cyberus.ca>. 4from Jamal <hadi@cyberus.ca>.
5 5
6The end goal for syncing is to be able to insert attributes + generate 6The end goal for syncing is to be able to insert attributes + generate
7events so that the an SA can be safely moved from one machine to another 7events so that the SA can be safely moved from one machine to another
8for HA purposes. 8for HA purposes.
9The idea is to synchronize the SA so that the takeover machine can do 9The idea is to synchronize the SA so that the takeover machine can do
10the processing of the SA as accurate as possible if it has access to it. 10the processing of the SA as accurate as possible if it has access to it.
@@ -13,7 +13,7 @@ We already have the ability to generate SA add/del/upd events.
13These patches add ability to sync and have accurate lifetime byte (to 13These patches add ability to sync and have accurate lifetime byte (to
14ensure proper decay of SAs) and replay counters to avoid replay attacks 14ensure proper decay of SAs) and replay counters to avoid replay attacks
15with as minimal loss at failover time. 15with as minimal loss at failover time.
16This way a backup stays as closely uptodate as an active member. 16This way a backup stays as closely up-to-date as an active member.
17 17
18Because the above items change for every packet the SA receives, 18Because the above items change for every packet the SA receives,
19it is possible for a lot of the events to be generated. 19it is possible for a lot of the events to be generated.
@@ -163,7 +163,7 @@ If you have an SA that is getting hit by traffic in bursts such that
163there is a period where the timer threshold expires with no packets 163there is a period where the timer threshold expires with no packets
164seen, then an odd behavior is seen as follows: 164seen, then an odd behavior is seen as follows:
165The first packet arrival after a timer expiry will trigger a timeout 165The first packet arrival after a timer expiry will trigger a timeout
166aevent; i.e we dont wait for a timeout period or a packet threshold 166event; i.e we don't wait for a timeout period or a packet threshold
167to be reached. This is done for simplicity and efficiency reasons. 167to be reached. This is done for simplicity and efficiency reasons.
168 168
169-JHS 169-JHS
diff --git a/MAINTAINERS b/MAINTAINERS
index 42e65d128d01..e7fa426434e2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4903,7 +4903,7 @@ F: net/ipv4/gre_offload.c
4903F: include/net/gre.h 4903F: include/net/gre.h
4904 4904
4905GRETH 10/100/1G Ethernet MAC device driver 4905GRETH 10/100/1G Ethernet MAC device driver
4906M: Kristoffer Glembo <kristoffer@gaisler.com> 4906M: Andreas Larsson <andreas@gaisler.com>
4907L: netdev@vger.kernel.org 4907L: netdev@vger.kernel.org
4908S: Maintained 4908S: Maintained
4909F: drivers/net/ethernet/aeroflex/ 4909F: drivers/net/ethernet/aeroflex/
@@ -10014,7 +10014,8 @@ F: drivers/infiniband/hw/ocrdma/
10014 10014
10015SFC NETWORK DRIVER 10015SFC NETWORK DRIVER
10016M: Solarflare linux maintainers <linux-net-drivers@solarflare.com> 10016M: Solarflare linux maintainers <linux-net-drivers@solarflare.com>
10017M: Shradha Shah <sshah@solarflare.com> 10017M: Edward Cree <ecree@solarflare.com>
10018M: Bert Kenward <bkenward@solarflare.com>
10018L: netdev@vger.kernel.org 10019L: netdev@vger.kernel.org
10019S: Supported 10020S: Supported
10020F: drivers/net/ethernet/sfc/ 10021F: drivers/net/ethernet/sfc/
diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index a2904029cccc..5e572b3510b9 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -2181,7 +2181,7 @@ int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port,
2181 struct net_device *bridge) 2181 struct net_device *bridge)
2182{ 2182{
2183 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 2183 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
2184 int i, err; 2184 int i, err = 0;
2185 2185
2186 mutex_lock(&ps->smi_mutex); 2186 mutex_lock(&ps->smi_mutex);
2187 2187
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 12a009d720cd..72eb29ed0359 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -581,12 +581,30 @@ static inline int bnxt_alloc_rx_page(struct bnxt *bp,
581 struct page *page; 581 struct page *page;
582 dma_addr_t mapping; 582 dma_addr_t mapping;
583 u16 sw_prod = rxr->rx_sw_agg_prod; 583 u16 sw_prod = rxr->rx_sw_agg_prod;
584 unsigned int offset = 0;
584 585
585 page = alloc_page(gfp); 586 if (PAGE_SIZE > BNXT_RX_PAGE_SIZE) {
586 if (!page) 587 page = rxr->rx_page;
587 return -ENOMEM; 588 if (!page) {
589 page = alloc_page(gfp);
590 if (!page)
591 return -ENOMEM;
592 rxr->rx_page = page;
593 rxr->rx_page_offset = 0;
594 }
595 offset = rxr->rx_page_offset;
596 rxr->rx_page_offset += BNXT_RX_PAGE_SIZE;
597 if (rxr->rx_page_offset == PAGE_SIZE)
598 rxr->rx_page = NULL;
599 else
600 get_page(page);
601 } else {
602 page = alloc_page(gfp);
603 if (!page)
604 return -ENOMEM;
605 }
588 606
589 mapping = dma_map_page(&pdev->dev, page, 0, PAGE_SIZE, 607 mapping = dma_map_page(&pdev->dev, page, offset, BNXT_RX_PAGE_SIZE,
590 PCI_DMA_FROMDEVICE); 608 PCI_DMA_FROMDEVICE);
591 if (dma_mapping_error(&pdev->dev, mapping)) { 609 if (dma_mapping_error(&pdev->dev, mapping)) {
592 __free_page(page); 610 __free_page(page);
@@ -601,6 +619,7 @@ static inline int bnxt_alloc_rx_page(struct bnxt *bp,
601 rxr->rx_sw_agg_prod = NEXT_RX_AGG(sw_prod); 619 rxr->rx_sw_agg_prod = NEXT_RX_AGG(sw_prod);
602 620
603 rx_agg_buf->page = page; 621 rx_agg_buf->page = page;
622 rx_agg_buf->offset = offset;
604 rx_agg_buf->mapping = mapping; 623 rx_agg_buf->mapping = mapping;
605 rxbd->rx_bd_haddr = cpu_to_le64(mapping); 624 rxbd->rx_bd_haddr = cpu_to_le64(mapping);
606 rxbd->rx_bd_opaque = sw_prod; 625 rxbd->rx_bd_opaque = sw_prod;
@@ -642,6 +661,7 @@ static void bnxt_reuse_rx_agg_bufs(struct bnxt_napi *bnapi, u16 cp_cons,
642 page = cons_rx_buf->page; 661 page = cons_rx_buf->page;
643 cons_rx_buf->page = NULL; 662 cons_rx_buf->page = NULL;
644 prod_rx_buf->page = page; 663 prod_rx_buf->page = page;
664 prod_rx_buf->offset = cons_rx_buf->offset;
645 665
646 prod_rx_buf->mapping = cons_rx_buf->mapping; 666 prod_rx_buf->mapping = cons_rx_buf->mapping;
647 667
@@ -709,7 +729,8 @@ static struct sk_buff *bnxt_rx_pages(struct bnxt *bp, struct bnxt_napi *bnapi,
709 RX_AGG_CMP_LEN) >> RX_AGG_CMP_LEN_SHIFT; 729 RX_AGG_CMP_LEN) >> RX_AGG_CMP_LEN_SHIFT;
710 730
711 cons_rx_buf = &rxr->rx_agg_ring[cons]; 731 cons_rx_buf = &rxr->rx_agg_ring[cons];
712 skb_fill_page_desc(skb, i, cons_rx_buf->page, 0, frag_len); 732 skb_fill_page_desc(skb, i, cons_rx_buf->page,
733 cons_rx_buf->offset, frag_len);
713 __clear_bit(cons, rxr->rx_agg_bmap); 734 __clear_bit(cons, rxr->rx_agg_bmap);
714 735
715 /* It is possible for bnxt_alloc_rx_page() to allocate 736 /* It is possible for bnxt_alloc_rx_page() to allocate
@@ -740,7 +761,7 @@ static struct sk_buff *bnxt_rx_pages(struct bnxt *bp, struct bnxt_napi *bnapi,
740 return NULL; 761 return NULL;
741 } 762 }
742 763
743 dma_unmap_page(&pdev->dev, mapping, PAGE_SIZE, 764 dma_unmap_page(&pdev->dev, mapping, BNXT_RX_PAGE_SIZE,
744 PCI_DMA_FROMDEVICE); 765 PCI_DMA_FROMDEVICE);
745 766
746 skb->data_len += frag_len; 767 skb->data_len += frag_len;
@@ -1584,13 +1605,17 @@ static void bnxt_free_rx_skbs(struct bnxt *bp)
1584 1605
1585 dma_unmap_page(&pdev->dev, 1606 dma_unmap_page(&pdev->dev,
1586 dma_unmap_addr(rx_agg_buf, mapping), 1607 dma_unmap_addr(rx_agg_buf, mapping),
1587 PAGE_SIZE, PCI_DMA_FROMDEVICE); 1608 BNXT_RX_PAGE_SIZE, PCI_DMA_FROMDEVICE);
1588 1609
1589 rx_agg_buf->page = NULL; 1610 rx_agg_buf->page = NULL;
1590 __clear_bit(j, rxr->rx_agg_bmap); 1611 __clear_bit(j, rxr->rx_agg_bmap);
1591 1612
1592 __free_page(page); 1613 __free_page(page);
1593 } 1614 }
1615 if (rxr->rx_page) {
1616 __free_page(rxr->rx_page);
1617 rxr->rx_page = NULL;
1618 }
1594 } 1619 }
1595} 1620}
1596 1621
@@ -1973,7 +1998,7 @@ static int bnxt_init_one_rx_ring(struct bnxt *bp, int ring_nr)
1973 if (!(bp->flags & BNXT_FLAG_AGG_RINGS)) 1998 if (!(bp->flags & BNXT_FLAG_AGG_RINGS))
1974 return 0; 1999 return 0;
1975 2000
1976 type = ((u32)PAGE_SIZE << RX_BD_LEN_SHIFT) | 2001 type = ((u32)BNXT_RX_PAGE_SIZE << RX_BD_LEN_SHIFT) |
1977 RX_BD_TYPE_RX_AGG_BD | RX_BD_FLAGS_SOP; 2002 RX_BD_TYPE_RX_AGG_BD | RX_BD_FLAGS_SOP;
1978 2003
1979 bnxt_init_rxbd_pages(ring, type); 2004 bnxt_init_rxbd_pages(ring, type);
@@ -2164,7 +2189,7 @@ void bnxt_set_ring_params(struct bnxt *bp)
2164 bp->rx_agg_nr_pages = 0; 2189 bp->rx_agg_nr_pages = 0;
2165 2190
2166 if (bp->flags & BNXT_FLAG_TPA) 2191 if (bp->flags & BNXT_FLAG_TPA)
2167 agg_factor = 4; 2192 agg_factor = min_t(u32, 4, 65536 / BNXT_RX_PAGE_SIZE);
2168 2193
2169 bp->flags &= ~BNXT_FLAG_JUMBO; 2194 bp->flags &= ~BNXT_FLAG_JUMBO;
2170 if (rx_space > PAGE_SIZE) { 2195 if (rx_space > PAGE_SIZE) {
@@ -3020,12 +3045,12 @@ static int bnxt_hwrm_vnic_set_tpa(struct bnxt *bp, u16 vnic_id, u32 tpa_flags)
3020 /* Number of segs are log2 units, and first packet is not 3045 /* Number of segs are log2 units, and first packet is not
3021 * included as part of this units. 3046 * included as part of this units.
3022 */ 3047 */
3023 if (mss <= PAGE_SIZE) { 3048 if (mss <= BNXT_RX_PAGE_SIZE) {
3024 n = PAGE_SIZE / mss; 3049 n = BNXT_RX_PAGE_SIZE / mss;
3025 nsegs = (MAX_SKB_FRAGS - 1) * n; 3050 nsegs = (MAX_SKB_FRAGS - 1) * n;
3026 } else { 3051 } else {
3027 n = mss / PAGE_SIZE; 3052 n = mss / BNXT_RX_PAGE_SIZE;
3028 if (mss & (PAGE_SIZE - 1)) 3053 if (mss & (BNXT_RX_PAGE_SIZE - 1))
3029 n++; 3054 n++;
3030 nsegs = (MAX_SKB_FRAGS - n) / n; 3055 nsegs = (MAX_SKB_FRAGS - n) / n;
3031 } 3056 }
@@ -4309,7 +4334,7 @@ static int bnxt_setup_int_mode(struct bnxt *bp)
4309 if (bp->flags & BNXT_FLAG_MSIX_CAP) 4334 if (bp->flags & BNXT_FLAG_MSIX_CAP)
4310 rc = bnxt_setup_msix(bp); 4335 rc = bnxt_setup_msix(bp);
4311 4336
4312 if (!(bp->flags & BNXT_FLAG_USING_MSIX)) { 4337 if (!(bp->flags & BNXT_FLAG_USING_MSIX) && BNXT_PF(bp)) {
4313 /* fallback to INTA */ 4338 /* fallback to INTA */
4314 rc = bnxt_setup_inta(bp); 4339 rc = bnxt_setup_inta(bp);
4315 } 4340 }
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index 709b95b8fcba..8b823ff558ff 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -407,6 +407,15 @@ struct rx_tpa_end_cmp_ext {
407 407
408#define BNXT_PAGE_SIZE (1 << BNXT_PAGE_SHIFT) 408#define BNXT_PAGE_SIZE (1 << BNXT_PAGE_SHIFT)
409 409
410/* The RXBD length is 16-bit so we can only support page sizes < 64K */
411#if (PAGE_SHIFT > 15)
412#define BNXT_RX_PAGE_SHIFT 15
413#else
414#define BNXT_RX_PAGE_SHIFT PAGE_SHIFT
415#endif
416
417#define BNXT_RX_PAGE_SIZE (1 << BNXT_RX_PAGE_SHIFT)
418
410#define BNXT_MIN_PKT_SIZE 45 419#define BNXT_MIN_PKT_SIZE 45
411 420
412#define BNXT_NUM_TESTS(bp) 0 421#define BNXT_NUM_TESTS(bp) 0
@@ -506,6 +515,7 @@ struct bnxt_sw_rx_bd {
506 515
507struct bnxt_sw_rx_agg_bd { 516struct bnxt_sw_rx_agg_bd {
508 struct page *page; 517 struct page *page;
518 unsigned int offset;
509 dma_addr_t mapping; 519 dma_addr_t mapping;
510}; 520};
511 521
@@ -586,6 +596,9 @@ struct bnxt_rx_ring_info {
586 unsigned long *rx_agg_bmap; 596 unsigned long *rx_agg_bmap;
587 u16 rx_agg_bmap_size; 597 u16 rx_agg_bmap_size;
588 598
599 struct page *rx_page;
600 unsigned int rx_page_offset;
601
589 dma_addr_t rx_desc_mapping[MAX_RX_PAGES]; 602 dma_addr_t rx_desc_mapping[MAX_RX_PAGES];
590 dma_addr_t rx_agg_desc_mapping[MAX_RX_AGG_PAGES]; 603 dma_addr_t rx_agg_desc_mapping[MAX_RX_AGG_PAGES];
591 604
diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
index 60908eab3b3a..43da891fab97 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
@@ -576,7 +576,7 @@ static void setup_rss(struct adapter *adap)
576 unsigned int nq0 = adap2pinfo(adap, 0)->nqsets; 576 unsigned int nq0 = adap2pinfo(adap, 0)->nqsets;
577 unsigned int nq1 = adap->port[1] ? adap2pinfo(adap, 1)->nqsets : 1; 577 unsigned int nq1 = adap->port[1] ? adap2pinfo(adap, 1)->nqsets : 1;
578 u8 cpus[SGE_QSETS + 1]; 578 u8 cpus[SGE_QSETS + 1];
579 u16 rspq_map[RSS_TABLE_SIZE]; 579 u16 rspq_map[RSS_TABLE_SIZE + 1];
580 580
581 for (i = 0; i < SGE_QSETS; ++i) 581 for (i = 0; i < SGE_QSETS; ++i)
582 cpus[i] = i; 582 cpus[i] = i;
@@ -586,6 +586,7 @@ static void setup_rss(struct adapter *adap)
586 rspq_map[i] = i % nq0; 586 rspq_map[i] = i % nq0;
587 rspq_map[i + RSS_TABLE_SIZE / 2] = (i % nq1) + nq0; 587 rspq_map[i + RSS_TABLE_SIZE / 2] = (i % nq1) + nq0;
588 } 588 }
589 rspq_map[RSS_TABLE_SIZE] = 0xffff; /* terminator */
589 590
590 t3_config_rss(adap, F_RQFEEDBACKENABLE | F_TNLLKPEN | F_TNLMAPEN | 591 t3_config_rss(adap, F_RQFEEDBACKENABLE | F_TNLLKPEN | F_TNLMAPEN |
591 F_TNLPRTEN | F_TNL2TUPEN | F_TNL4TUPEN | 592 F_TNLPRTEN | F_TNL2TUPEN | F_TNL4TUPEN |
diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
index 270c9eeb7ab6..6d1a956e3f77 100644
--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
@@ -2668,9 +2668,9 @@ static int myri10ge_close(struct net_device *dev)
2668 2668
2669 del_timer_sync(&mgp->watchdog_timer); 2669 del_timer_sync(&mgp->watchdog_timer);
2670 mgp->running = MYRI10GE_ETH_STOPPING; 2670 mgp->running = MYRI10GE_ETH_STOPPING;
2671 local_bh_disable(); /* myri10ge_ss_lock_napi needs bh disabled */
2672 for (i = 0; i < mgp->num_slices; i++) { 2671 for (i = 0; i < mgp->num_slices; i++) {
2673 napi_disable(&mgp->ss[i].napi); 2672 napi_disable(&mgp->ss[i].napi);
2673 local_bh_disable(); /* myri10ge_ss_lock_napi needs this */
2674 /* Lock the slice to prevent the busy_poll handler from 2674 /* Lock the slice to prevent the busy_poll handler from
2675 * accessing it. Later when we bring the NIC up, myri10ge_open 2675 * accessing it. Later when we bring the NIC up, myri10ge_open
2676 * resets the slice including this lock. 2676 * resets the slice including this lock.
@@ -2679,8 +2679,8 @@ static int myri10ge_close(struct net_device *dev)
2679 pr_info("Slice %d locked\n", i); 2679 pr_info("Slice %d locked\n", i);
2680 mdelay(1); 2680 mdelay(1);
2681 } 2681 }
2682 local_bh_enable();
2682 } 2683 }
2683 local_bh_enable();
2684 netif_carrier_off(dev); 2684 netif_carrier_off(dev);
2685 2685
2686 netif_tx_stop_all_queues(dev); 2686 netif_tx_stop_all_queues(dev);
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 98d33d462c6c..1681084cc96f 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -1920,6 +1920,10 @@ static int efx_ef10_alloc_rss_context(struct efx_nic *efx, u32 *context,
1920 return 0; 1920 return 0;
1921 } 1921 }
1922 1922
1923 if (nic_data->datapath_caps &
1924 1 << MC_CMD_GET_CAPABILITIES_OUT_RX_RSS_LIMITED_LBN)
1925 return -EOPNOTSUPP;
1926
1923 MCDI_SET_DWORD(inbuf, RSS_CONTEXT_ALLOC_IN_UPSTREAM_PORT_ID, 1927 MCDI_SET_DWORD(inbuf, RSS_CONTEXT_ALLOC_IN_UPSTREAM_PORT_ID,
1924 nic_data->vport_id); 1928 nic_data->vport_id);
1925 MCDI_SET_DWORD(inbuf, RSS_CONTEXT_ALLOC_IN_TYPE, alloc_type); 1929 MCDI_SET_DWORD(inbuf, RSS_CONTEXT_ALLOC_IN_TYPE, alloc_type);
@@ -2923,9 +2927,16 @@ static void efx_ef10_filter_push_prep(struct efx_nic *efx,
2923 bool replacing) 2927 bool replacing)
2924{ 2928{
2925 struct efx_ef10_nic_data *nic_data = efx->nic_data; 2929 struct efx_ef10_nic_data *nic_data = efx->nic_data;
2930 u32 flags = spec->flags;
2926 2931
2927 memset(inbuf, 0, MC_CMD_FILTER_OP_IN_LEN); 2932 memset(inbuf, 0, MC_CMD_FILTER_OP_IN_LEN);
2928 2933
2934 /* Remove RSS flag if we don't have an RSS context. */
2935 if (flags & EFX_FILTER_FLAG_RX_RSS &&
2936 spec->rss_context == EFX_FILTER_RSS_CONTEXT_DEFAULT &&
2937 nic_data->rx_rss_context == EFX_EF10_RSS_CONTEXT_INVALID)
2938 flags &= ~EFX_FILTER_FLAG_RX_RSS;
2939
2929 if (replacing) { 2940 if (replacing) {
2930 MCDI_SET_DWORD(inbuf, FILTER_OP_IN_OP, 2941 MCDI_SET_DWORD(inbuf, FILTER_OP_IN_OP,
2931 MC_CMD_FILTER_OP_IN_OP_REPLACE); 2942 MC_CMD_FILTER_OP_IN_OP_REPLACE);
@@ -2985,10 +2996,10 @@ static void efx_ef10_filter_push_prep(struct efx_nic *efx,
2985 spec->dmaq_id == EFX_FILTER_RX_DMAQ_ID_DROP ? 2996 spec->dmaq_id == EFX_FILTER_RX_DMAQ_ID_DROP ?
2986 0 : spec->dmaq_id); 2997 0 : spec->dmaq_id);
2987 MCDI_SET_DWORD(inbuf, FILTER_OP_IN_RX_MODE, 2998 MCDI_SET_DWORD(inbuf, FILTER_OP_IN_RX_MODE,
2988 (spec->flags & EFX_FILTER_FLAG_RX_RSS) ? 2999 (flags & EFX_FILTER_FLAG_RX_RSS) ?
2989 MC_CMD_FILTER_OP_IN_RX_MODE_RSS : 3000 MC_CMD_FILTER_OP_IN_RX_MODE_RSS :
2990 MC_CMD_FILTER_OP_IN_RX_MODE_SIMPLE); 3001 MC_CMD_FILTER_OP_IN_RX_MODE_SIMPLE);
2991 if (spec->flags & EFX_FILTER_FLAG_RX_RSS) 3002 if (flags & EFX_FILTER_FLAG_RX_RSS)
2992 MCDI_SET_DWORD(inbuf, FILTER_OP_IN_RX_CONTEXT, 3003 MCDI_SET_DWORD(inbuf, FILTER_OP_IN_RX_CONTEXT,
2993 spec->rss_context != 3004 spec->rss_context !=
2994 EFX_FILTER_RSS_CONTEXT_DEFAULT ? 3005 EFX_FILTER_RSS_CONTEXT_DEFAULT ?
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index bbb77cd8ad67..e2fcdf1eec44 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -367,7 +367,6 @@ struct cpsw_priv {
367 spinlock_t lock; 367 spinlock_t lock;
368 struct platform_device *pdev; 368 struct platform_device *pdev;
369 struct net_device *ndev; 369 struct net_device *ndev;
370 struct device_node *phy_node;
371 struct napi_struct napi_rx; 370 struct napi_struct napi_rx;
372 struct napi_struct napi_tx; 371 struct napi_struct napi_tx;
373 struct device *dev; 372 struct device *dev;
@@ -1148,25 +1147,34 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv)
1148 cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, 1147 cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast,
1149 1 << slave_port, 0, 0, ALE_MCAST_FWD_2); 1148 1 << slave_port, 0, 0, ALE_MCAST_FWD_2);
1150 1149
1151 if (priv->phy_node) 1150 if (slave->data->phy_node) {
1152 slave->phy = of_phy_connect(priv->ndev, priv->phy_node, 1151 slave->phy = of_phy_connect(priv->ndev, slave->data->phy_node,
1153 &cpsw_adjust_link, 0, slave->data->phy_if); 1152 &cpsw_adjust_link, 0, slave->data->phy_if);
1154 else 1153 if (!slave->phy) {
1154 dev_err(priv->dev, "phy \"%s\" not found on slave %d\n",
1155 slave->data->phy_node->full_name,
1156 slave->slave_num);
1157 return;
1158 }
1159 } else {
1155 slave->phy = phy_connect(priv->ndev, slave->data->phy_id, 1160 slave->phy = phy_connect(priv->ndev, slave->data->phy_id,
1156 &cpsw_adjust_link, slave->data->phy_if); 1161 &cpsw_adjust_link, slave->data->phy_if);
1157 if (IS_ERR(slave->phy)) { 1162 if (IS_ERR(slave->phy)) {
1158 dev_err(priv->dev, "phy %s not found on slave %d\n", 1163 dev_err(priv->dev,
1159 slave->data->phy_id, slave->slave_num); 1164 "phy \"%s\" not found on slave %d, err %ld\n",
1160 slave->phy = NULL; 1165 slave->data->phy_id, slave->slave_num,
1161 } else { 1166 PTR_ERR(slave->phy));
1162 phy_attached_info(slave->phy); 1167 slave->phy = NULL;
1168 return;
1169 }
1170 }
1163 1171
1164 phy_start(slave->phy); 1172 phy_attached_info(slave->phy);
1165 1173
1166 /* Configure GMII_SEL register */ 1174 phy_start(slave->phy);
1167 cpsw_phy_sel(&priv->pdev->dev, slave->phy->interface, 1175
1168 slave->slave_num); 1176 /* Configure GMII_SEL register */
1169 } 1177 cpsw_phy_sel(&priv->pdev->dev, slave->phy->interface, slave->slave_num);
1170} 1178}
1171 1179
1172static inline void cpsw_add_default_vlan(struct cpsw_priv *priv) 1180static inline void cpsw_add_default_vlan(struct cpsw_priv *priv)
@@ -1940,12 +1948,11 @@ static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv,
1940 slave->port_vlan = data->dual_emac_res_vlan; 1948 slave->port_vlan = data->dual_emac_res_vlan;
1941} 1949}
1942 1950
1943static int cpsw_probe_dt(struct cpsw_priv *priv, 1951static int cpsw_probe_dt(struct cpsw_platform_data *data,
1944 struct platform_device *pdev) 1952 struct platform_device *pdev)
1945{ 1953{
1946 struct device_node *node = pdev->dev.of_node; 1954 struct device_node *node = pdev->dev.of_node;
1947 struct device_node *slave_node; 1955 struct device_node *slave_node;
1948 struct cpsw_platform_data *data = &priv->data;
1949 int i = 0, ret; 1956 int i = 0, ret;
1950 u32 prop; 1957 u32 prop;
1951 1958
@@ -2033,25 +2040,21 @@ static int cpsw_probe_dt(struct cpsw_priv *priv,
2033 if (strcmp(slave_node->name, "slave")) 2040 if (strcmp(slave_node->name, "slave"))
2034 continue; 2041 continue;
2035 2042
2036 priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0); 2043 slave_data->phy_node = of_parse_phandle(slave_node,
2044 "phy-handle", 0);
2037 parp = of_get_property(slave_node, "phy_id", &lenp); 2045 parp = of_get_property(slave_node, "phy_id", &lenp);
2038 if (of_phy_is_fixed_link(slave_node)) { 2046 if (slave_data->phy_node) {
2039 struct device_node *phy_node; 2047 dev_dbg(&pdev->dev,
2040 struct phy_device *phy_dev; 2048 "slave[%d] using phy-handle=\"%s\"\n",
2041 2049 i, slave_data->phy_node->full_name);
2050 } else if (of_phy_is_fixed_link(slave_node)) {
2042 /* In the case of a fixed PHY, the DT node associated 2051 /* In the case of a fixed PHY, the DT node associated
2043 * to the PHY is the Ethernet MAC DT node. 2052 * to the PHY is the Ethernet MAC DT node.
2044 */ 2053 */
2045 ret = of_phy_register_fixed_link(slave_node); 2054 ret = of_phy_register_fixed_link(slave_node);
2046 if (ret) 2055 if (ret)
2047 return ret; 2056 return ret;
2048 phy_node = of_node_get(slave_node); 2057 slave_data->phy_node = of_node_get(slave_node);
2049 phy_dev = of_phy_find_device(phy_node);
2050 if (!phy_dev)
2051 return -ENODEV;
2052 snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
2053 PHY_ID_FMT, phy_dev->mdio.bus->id,
2054 phy_dev->mdio.addr);
2055 } else if (parp) { 2058 } else if (parp) {
2056 u32 phyid; 2059 u32 phyid;
2057 struct device_node *mdio_node; 2060 struct device_node *mdio_node;
@@ -2072,7 +2075,9 @@ static int cpsw_probe_dt(struct cpsw_priv *priv,
2072 snprintf(slave_data->phy_id, sizeof(slave_data->phy_id), 2075 snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
2073 PHY_ID_FMT, mdio->name, phyid); 2076 PHY_ID_FMT, mdio->name, phyid);
2074 } else { 2077 } else {
2075 dev_err(&pdev->dev, "No slave[%d] phy_id or fixed-link property\n", i); 2078 dev_err(&pdev->dev,
2079 "No slave[%d] phy_id, phy-handle, or fixed-link property\n",
2080 i);
2076 goto no_phy_slave; 2081 goto no_phy_slave;
2077 } 2082 }
2078 slave_data->phy_if = of_get_phy_mode(slave_node); 2083 slave_data->phy_if = of_get_phy_mode(slave_node);
@@ -2275,7 +2280,7 @@ static int cpsw_probe(struct platform_device *pdev)
2275 /* Select default pin state */ 2280 /* Select default pin state */
2276 pinctrl_pm_select_default_state(&pdev->dev); 2281 pinctrl_pm_select_default_state(&pdev->dev);
2277 2282
2278 if (cpsw_probe_dt(priv, pdev)) { 2283 if (cpsw_probe_dt(&priv->data, pdev)) {
2279 dev_err(&pdev->dev, "cpsw: platform data missing\n"); 2284 dev_err(&pdev->dev, "cpsw: platform data missing\n");
2280 ret = -ENODEV; 2285 ret = -ENODEV;
2281 goto clean_runtime_disable_ret; 2286 goto clean_runtime_disable_ret;
diff --git a/drivers/net/ethernet/ti/cpsw.h b/drivers/net/ethernet/ti/cpsw.h
index 442a7038e660..e50afd1b2eda 100644
--- a/drivers/net/ethernet/ti/cpsw.h
+++ b/drivers/net/ethernet/ti/cpsw.h
@@ -18,6 +18,7 @@
18#include <linux/phy.h> 18#include <linux/phy.h>
19 19
20struct cpsw_slave_data { 20struct cpsw_slave_data {
21 struct device_node *phy_node;
21 char phy_id[MII_BUS_ID_SIZE]; 22 char phy_id[MII_BUS_ID_SIZE];
22 int phy_if; 23 int phy_if;
23 u8 mac_addr[ETH_ALEN]; 24 u8 mac_addr[ETH_ALEN];
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 58d58f002559..f56d66e6ec15 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -1512,7 +1512,10 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd)
1512 1512
1513 /* TODO: Add phy read and write and private statistics get feature */ 1513 /* TODO: Add phy read and write and private statistics get feature */
1514 1514
1515 return phy_mii_ioctl(priv->phydev, ifrq, cmd); 1515 if (priv->phydev)
1516 return phy_mii_ioctl(priv->phydev, ifrq, cmd);
1517 else
1518 return -EOPNOTSUPP;
1516} 1519}
1517 1520
1518static int match_first_device(struct device *dev, void *data) 1521static int match_first_device(struct device *dev, void *data)
diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c b/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
index 13214a6492ac..743b18266a7c 100644
--- a/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
+++ b/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
@@ -1622,7 +1622,7 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl)
1622 continue; 1622 continue;
1623 1623
1624 /* copy hw scan info */ 1624 /* copy hw scan info */
1625 memcpy(target->hwinfo, scan_info, scan_info->size); 1625 memcpy(target->hwinfo, scan_info, be16_to_cpu(scan_info->size));
1626 target->essid_len = strnlen(scan_info->essid, 1626 target->essid_len = strnlen(scan_info->essid,
1627 sizeof(scan_info->essid)); 1627 sizeof(scan_info->essid));
1628 target->rate_len = 0; 1628 target->rate_len = 0;
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index b3ffaee30858..f279a897a5c7 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -359,27 +359,25 @@ static void at803x_link_change_notify(struct phy_device *phydev)
359 * in the FIFO. In such cases, the FIFO enters an error mode it 359 * in the FIFO. In such cases, the FIFO enters an error mode it
360 * cannot recover from by software. 360 * cannot recover from by software.
361 */ 361 */
362 if (phydev->drv->phy_id == ATH8030_PHY_ID) { 362 if (phydev->state == PHY_NOLINK) {
363 if (phydev->state == PHY_NOLINK) { 363 if (priv->gpiod_reset && !priv->phy_reset) {
364 if (priv->gpiod_reset && !priv->phy_reset) { 364 struct at803x_context context;
365 struct at803x_context context; 365
366 366 at803x_context_save(phydev, &context);
367 at803x_context_save(phydev, &context); 367
368 368 gpiod_set_value(priv->gpiod_reset, 1);
369 gpiod_set_value(priv->gpiod_reset, 1); 369 msleep(1);
370 msleep(1); 370 gpiod_set_value(priv->gpiod_reset, 0);
371 gpiod_set_value(priv->gpiod_reset, 0); 371 msleep(1);
372 msleep(1); 372
373 373 at803x_context_restore(phydev, &context);
374 at803x_context_restore(phydev, &context); 374
375 375 phydev_dbg(phydev, "%s(): phy was reset\n",
376 phydev_dbg(phydev, "%s(): phy was reset\n", 376 __func__);
377 __func__); 377 priv->phy_reset = true;
378 priv->phy_reset = true;
379 }
380 } else {
381 priv->phy_reset = false;
382 } 378 }
379 } else {
380 priv->phy_reset = false;
383 } 381 }
384} 382}
385 383
@@ -391,7 +389,6 @@ static struct phy_driver at803x_driver[] = {
391 .phy_id_mask = 0xffffffef, 389 .phy_id_mask = 0xffffffef,
392 .probe = at803x_probe, 390 .probe = at803x_probe,
393 .config_init = at803x_config_init, 391 .config_init = at803x_config_init,
394 .link_change_notify = at803x_link_change_notify,
395 .set_wol = at803x_set_wol, 392 .set_wol = at803x_set_wol,
396 .get_wol = at803x_get_wol, 393 .get_wol = at803x_get_wol,
397 .suspend = at803x_suspend, 394 .suspend = at803x_suspend,
@@ -427,7 +424,6 @@ static struct phy_driver at803x_driver[] = {
427 .phy_id_mask = 0xffffffef, 424 .phy_id_mask = 0xffffffef,
428 .probe = at803x_probe, 425 .probe = at803x_probe,
429 .config_init = at803x_config_init, 426 .config_init = at803x_config_init,
430 .link_change_notify = at803x_link_change_notify,
431 .set_wol = at803x_set_wol, 427 .set_wol = at803x_set_wol,
432 .get_wol = at803x_get_wol, 428 .get_wol = at803x_get_wol,
433 .suspend = at803x_suspend, 429 .suspend = at803x_suspend,
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index f20890ee03f3..f64778ad9753 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -269,6 +269,7 @@ struct skb_data { /* skb->cb is one of these */
269 struct lan78xx_net *dev; 269 struct lan78xx_net *dev;
270 enum skb_state state; 270 enum skb_state state;
271 size_t length; 271 size_t length;
272 int num_of_packet;
272}; 273};
273 274
274struct usb_context { 275struct usb_context {
@@ -1803,7 +1804,34 @@ static void lan78xx_remove_mdio(struct lan78xx_net *dev)
1803 1804
1804static void lan78xx_link_status_change(struct net_device *net) 1805static void lan78xx_link_status_change(struct net_device *net)
1805{ 1806{
1806 /* nothing to do */ 1807 struct phy_device *phydev = net->phydev;
1808 int ret, temp;
1809
1810 /* At forced 100 F/H mode, chip may fail to set mode correctly
1811 * when cable is switched between long(~50+m) and short one.
1812 * As workaround, set to 10 before setting to 100
1813 * at forced 100 F/H mode.
1814 */
1815 if (!phydev->autoneg && (phydev->speed == 100)) {
1816 /* disable phy interrupt */
1817 temp = phy_read(phydev, LAN88XX_INT_MASK);
1818 temp &= ~LAN88XX_INT_MASK_MDINTPIN_EN_;
1819 ret = phy_write(phydev, LAN88XX_INT_MASK, temp);
1820
1821 temp = phy_read(phydev, MII_BMCR);
1822 temp &= ~(BMCR_SPEED100 | BMCR_SPEED1000);
1823 phy_write(phydev, MII_BMCR, temp); /* set to 10 first */
1824 temp |= BMCR_SPEED100;
1825 phy_write(phydev, MII_BMCR, temp); /* set to 100 later */
1826
1827 /* clear pending interrupt generated while workaround */
1828 temp = phy_read(phydev, LAN88XX_INT_STS);
1829
1830 /* enable phy interrupt back */
1831 temp = phy_read(phydev, LAN88XX_INT_MASK);
1832 temp |= LAN88XX_INT_MASK_MDINTPIN_EN_;
1833 ret = phy_write(phydev, LAN88XX_INT_MASK, temp);
1834 }
1807} 1835}
1808 1836
1809static int lan78xx_phy_init(struct lan78xx_net *dev) 1837static int lan78xx_phy_init(struct lan78xx_net *dev)
@@ -2464,7 +2492,7 @@ static void tx_complete(struct urb *urb)
2464 struct lan78xx_net *dev = entry->dev; 2492 struct lan78xx_net *dev = entry->dev;
2465 2493
2466 if (urb->status == 0) { 2494 if (urb->status == 0) {
2467 dev->net->stats.tx_packets++; 2495 dev->net->stats.tx_packets += entry->num_of_packet;
2468 dev->net->stats.tx_bytes += entry->length; 2496 dev->net->stats.tx_bytes += entry->length;
2469 } else { 2497 } else {
2470 dev->net->stats.tx_errors++; 2498 dev->net->stats.tx_errors++;
@@ -2681,10 +2709,11 @@ void lan78xx_skb_return(struct lan78xx_net *dev, struct sk_buff *skb)
2681 return; 2709 return;
2682 } 2710 }
2683 2711
2684 skb->protocol = eth_type_trans(skb, dev->net);
2685 dev->net->stats.rx_packets++; 2712 dev->net->stats.rx_packets++;
2686 dev->net->stats.rx_bytes += skb->len; 2713 dev->net->stats.rx_bytes += skb->len;
2687 2714
2715 skb->protocol = eth_type_trans(skb, dev->net);
2716
2688 netif_dbg(dev, rx_status, dev->net, "< rx, len %zu, type 0x%x\n", 2717 netif_dbg(dev, rx_status, dev->net, "< rx, len %zu, type 0x%x\n",
2689 skb->len + sizeof(struct ethhdr), skb->protocol); 2718 skb->len + sizeof(struct ethhdr), skb->protocol);
2690 memset(skb->cb, 0, sizeof(struct skb_data)); 2719 memset(skb->cb, 0, sizeof(struct skb_data));
@@ -2934,13 +2963,16 @@ static void lan78xx_tx_bh(struct lan78xx_net *dev)
2934 2963
2935 skb_totallen = 0; 2964 skb_totallen = 0;
2936 pkt_cnt = 0; 2965 pkt_cnt = 0;
2966 count = 0;
2967 length = 0;
2937 for (skb = tqp->next; pkt_cnt < tqp->qlen; skb = skb->next) { 2968 for (skb = tqp->next; pkt_cnt < tqp->qlen; skb = skb->next) {
2938 if (skb_is_gso(skb)) { 2969 if (skb_is_gso(skb)) {
2939 if (pkt_cnt) { 2970 if (pkt_cnt) {
2940 /* handle previous packets first */ 2971 /* handle previous packets first */
2941 break; 2972 break;
2942 } 2973 }
2943 length = skb->len; 2974 count = 1;
2975 length = skb->len - TX_OVERHEAD;
2944 skb2 = skb_dequeue(tqp); 2976 skb2 = skb_dequeue(tqp);
2945 goto gso_skb; 2977 goto gso_skb;
2946 } 2978 }
@@ -2961,14 +2993,13 @@ static void lan78xx_tx_bh(struct lan78xx_net *dev)
2961 for (count = pos = 0; count < pkt_cnt; count++) { 2993 for (count = pos = 0; count < pkt_cnt; count++) {
2962 skb2 = skb_dequeue(tqp); 2994 skb2 = skb_dequeue(tqp);
2963 if (skb2) { 2995 if (skb2) {
2996 length += (skb2->len - TX_OVERHEAD);
2964 memcpy(skb->data + pos, skb2->data, skb2->len); 2997 memcpy(skb->data + pos, skb2->data, skb2->len);
2965 pos += roundup(skb2->len, sizeof(u32)); 2998 pos += roundup(skb2->len, sizeof(u32));
2966 dev_kfree_skb(skb2); 2999 dev_kfree_skb(skb2);
2967 } 3000 }
2968 } 3001 }
2969 3002
2970 length = skb_totallen;
2971
2972gso_skb: 3003gso_skb:
2973 urb = usb_alloc_urb(0, GFP_ATOMIC); 3004 urb = usb_alloc_urb(0, GFP_ATOMIC);
2974 if (!urb) { 3005 if (!urb) {
@@ -2980,6 +3011,7 @@ gso_skb:
2980 entry->urb = urb; 3011 entry->urb = urb;
2981 entry->dev = dev; 3012 entry->dev = dev;
2982 entry->length = length; 3013 entry->length = length;
3014 entry->num_of_packet = count;
2983 3015
2984 spin_lock_irqsave(&dev->txq.lock, flags); 3016 spin_lock_irqsave(&dev->txq.lock, flags);
2985 ret = usb_autopm_get_interface_async(dev->intf); 3017 ret = usb_autopm_get_interface_async(dev->intf);
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index f84080215915..82129eef7774 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -411,7 +411,7 @@ static int enable_net_traffic(struct net_device *dev, struct usb_device *usb)
411 int ret; 411 int ret;
412 412
413 read_mii_word(pegasus, pegasus->phy, MII_LPA, &linkpart); 413 read_mii_word(pegasus, pegasus->phy, MII_LPA, &linkpart);
414 data[0] = 0xc9; 414 data[0] = 0xc8; /* TX & RX enable, append status, no CRC */
415 data[1] = 0; 415 data[1] = 0;
416 if (linkpart & (ADVERTISE_100FULL | ADVERTISE_10FULL)) 416 if (linkpart & (ADVERTISE_100FULL | ADVERTISE_10FULL))
417 data[1] |= 0x20; /* set full duplex */ 417 data[1] |= 0x20; /* set full duplex */
@@ -497,7 +497,7 @@ static void read_bulk_callback(struct urb *urb)
497 pkt_len = buf[count - 3] << 8; 497 pkt_len = buf[count - 3] << 8;
498 pkt_len += buf[count - 4]; 498 pkt_len += buf[count - 4];
499 pkt_len &= 0xfff; 499 pkt_len &= 0xfff;
500 pkt_len -= 8; 500 pkt_len -= 4;
501 } 501 }
502 502
503 /* 503 /*
@@ -528,7 +528,7 @@ static void read_bulk_callback(struct urb *urb)
528goon: 528goon:
529 usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb, 529 usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
530 usb_rcvbulkpipe(pegasus->usb, 1), 530 usb_rcvbulkpipe(pegasus->usb, 1),
531 pegasus->rx_skb->data, PEGASUS_MTU + 8, 531 pegasus->rx_skb->data, PEGASUS_MTU,
532 read_bulk_callback, pegasus); 532 read_bulk_callback, pegasus);
533 rx_status = usb_submit_urb(pegasus->rx_urb, GFP_ATOMIC); 533 rx_status = usb_submit_urb(pegasus->rx_urb, GFP_ATOMIC);
534 if (rx_status == -ENODEV) 534 if (rx_status == -ENODEV)
@@ -569,7 +569,7 @@ static void rx_fixup(unsigned long data)
569 } 569 }
570 usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb, 570 usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
571 usb_rcvbulkpipe(pegasus->usb, 1), 571 usb_rcvbulkpipe(pegasus->usb, 1),
572 pegasus->rx_skb->data, PEGASUS_MTU + 8, 572 pegasus->rx_skb->data, PEGASUS_MTU,
573 read_bulk_callback, pegasus); 573 read_bulk_callback, pegasus);
574try_again: 574try_again:
575 status = usb_submit_urb(pegasus->rx_urb, GFP_ATOMIC); 575 status = usb_submit_urb(pegasus->rx_urb, GFP_ATOMIC);
@@ -823,7 +823,7 @@ static int pegasus_open(struct net_device *net)
823 823
824 usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb, 824 usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
825 usb_rcvbulkpipe(pegasus->usb, 1), 825 usb_rcvbulkpipe(pegasus->usb, 1),
826 pegasus->rx_skb->data, PEGASUS_MTU + 8, 826 pegasus->rx_skb->data, PEGASUS_MTU,
827 read_bulk_callback, pegasus); 827 read_bulk_callback, pegasus);
828 if ((res = usb_submit_urb(pegasus->rx_urb, GFP_KERNEL))) { 828 if ((res = usb_submit_urb(pegasus->rx_urb, GFP_KERNEL))) {
829 if (res == -ENODEV) 829 if (res == -ENODEV)
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 30033dbe6662..c369db99c005 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -29,6 +29,7 @@
29#include <linux/crc32.h> 29#include <linux/crc32.h>
30#include <linux/usb/usbnet.h> 30#include <linux/usb/usbnet.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/of_net.h>
32#include "smsc75xx.h" 33#include "smsc75xx.h"
33 34
34#define SMSC_CHIPNAME "smsc75xx" 35#define SMSC_CHIPNAME "smsc75xx"
@@ -761,6 +762,15 @@ static int smsc75xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
761 762
762static void smsc75xx_init_mac_address(struct usbnet *dev) 763static void smsc75xx_init_mac_address(struct usbnet *dev)
763{ 764{
765 const u8 *mac_addr;
766
767 /* maybe the boot loader passed the MAC address in devicetree */
768 mac_addr = of_get_mac_address(dev->udev->dev.of_node);
769 if (mac_addr) {
770 memcpy(dev->net->dev_addr, mac_addr, ETH_ALEN);
771 return;
772 }
773
764 /* try reading mac address from EEPROM */ 774 /* try reading mac address from EEPROM */
765 if (smsc75xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, 775 if (smsc75xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
766 dev->net->dev_addr) == 0) { 776 dev->net->dev_addr) == 0) {
@@ -772,7 +782,7 @@ static void smsc75xx_init_mac_address(struct usbnet *dev)
772 } 782 }
773 } 783 }
774 784
775 /* no eeprom, or eeprom values are invalid. generate random MAC */ 785 /* no useful static MAC address found. generate a random one */
776 eth_hw_addr_random(dev->net); 786 eth_hw_addr_random(dev->net);
777 netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n"); 787 netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n");
778} 788}
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 66b3ab9f614e..2edc2bc6d1b9 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -29,6 +29,7 @@
29#include <linux/crc32.h> 29#include <linux/crc32.h>
30#include <linux/usb/usbnet.h> 30#include <linux/usb/usbnet.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/of_net.h>
32#include "smsc95xx.h" 33#include "smsc95xx.h"
33 34
34#define SMSC_CHIPNAME "smsc95xx" 35#define SMSC_CHIPNAME "smsc95xx"
@@ -765,6 +766,15 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
765 766
766static void smsc95xx_init_mac_address(struct usbnet *dev) 767static void smsc95xx_init_mac_address(struct usbnet *dev)
767{ 768{
769 const u8 *mac_addr;
770
771 /* maybe the boot loader passed the MAC address in devicetree */
772 mac_addr = of_get_mac_address(dev->udev->dev.of_node);
773 if (mac_addr) {
774 memcpy(dev->net->dev_addr, mac_addr, ETH_ALEN);
775 return;
776 }
777
768 /* try reading mac address from EEPROM */ 778 /* try reading mac address from EEPROM */
769 if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, 779 if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
770 dev->net->dev_addr) == 0) { 780 dev->net->dev_addr) == 0) {
@@ -775,7 +785,7 @@ static void smsc95xx_init_mac_address(struct usbnet *dev)
775 } 785 }
776 } 786 }
777 787
778 /* no eeprom, or eeprom values are invalid. generate random MAC */ 788 /* no useful static MAC address found. generate a random one */
779 eth_hw_addr_random(dev->net); 789 eth_hw_addr_random(dev->net);
780 netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n"); 790 netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n");
781} 791}
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
index 8f8793004b9f..1b271b99c49e 100644
--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
@@ -274,6 +274,9 @@ void ar5008_hw_cmn_spur_mitigate(struct ath_hw *ah,
274 }; 274 };
275 static const int inc[4] = { 0, 100, 0, 0 }; 275 static const int inc[4] = { 0, 100, 0, 0 };
276 276
277 memset(&mask_m, 0, sizeof(int8_t) * 123);
278 memset(&mask_p, 0, sizeof(int8_t) * 123);
279
277 cur_bin = -6000; 280 cur_bin = -6000;
278 upper = bin + 100; 281 upper = bin + 100;
279 lower = bin - 100; 282 lower = bin - 100;
@@ -424,14 +427,9 @@ static void ar5008_hw_spur_mitigate(struct ath_hw *ah,
424 int tmp, new; 427 int tmp, new;
425 int i; 428 int i;
426 429
427 int8_t mask_m[123];
428 int8_t mask_p[123];
429 int cur_bb_spur; 430 int cur_bb_spur;
430 bool is2GHz = IS_CHAN_2GHZ(chan); 431 bool is2GHz = IS_CHAN_2GHZ(chan);
431 432
432 memset(&mask_m, 0, sizeof(int8_t) * 123);
433 memset(&mask_p, 0, sizeof(int8_t) * 123);
434
435 for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { 433 for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
436 cur_bb_spur = ah->eep_ops->get_spur_channel(ah, i, is2GHz); 434 cur_bb_spur = ah->eep_ops->get_spur_channel(ah, i, is2GHz);
437 if (AR_NO_SPUR == cur_bb_spur) 435 if (AR_NO_SPUR == cur_bb_spur)
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_phy.c b/drivers/net/wireless/ath/ath9k/ar9002_phy.c
index db6624527d99..53d7445a5d12 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c
@@ -178,14 +178,9 @@ static void ar9002_hw_spur_mitigate(struct ath_hw *ah,
178 int i; 178 int i;
179 struct chan_centers centers; 179 struct chan_centers centers;
180 180
181 int8_t mask_m[123];
182 int8_t mask_p[123];
183 int cur_bb_spur; 181 int cur_bb_spur;
184 bool is2GHz = IS_CHAN_2GHZ(chan); 182 bool is2GHz = IS_CHAN_2GHZ(chan);
185 183
186 memset(&mask_m, 0, sizeof(int8_t) * 123);
187 memset(&mask_p, 0, sizeof(int8_t) * 123);
188
189 ath9k_hw_get_channel_centers(ah, chan, &centers); 184 ath9k_hw_get_channel_centers(ah, chan, &centers);
190 freq = centers.synth_center; 185 freq = centers.synth_center;
191 186
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-8000.c b/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
index 97be104d1203..b5c57eebf995 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
@@ -93,7 +93,7 @@
93#define IWL8260_SMEM_OFFSET 0x400000 93#define IWL8260_SMEM_OFFSET 0x400000
94#define IWL8260_SMEM_LEN 0x68000 94#define IWL8260_SMEM_LEN 0x68000
95 95
96#define IWL8000_FW_PRE "iwlwifi-8000" 96#define IWL8000_FW_PRE "iwlwifi-8000C-"
97#define IWL8000_MODULE_FIRMWARE(api) \ 97#define IWL8000_MODULE_FIRMWARE(api) \
98 IWL8000_FW_PRE "-" __stringify(api) ".ucode" 98 IWL8000_FW_PRE "-" __stringify(api) ".ucode"
99 99
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index f899666acb41..9e45bf9c6071 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -238,19 +238,6 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first)
238 snprintf(drv->firmware_name, sizeof(drv->firmware_name), "%s%s.ucode", 238 snprintf(drv->firmware_name, sizeof(drv->firmware_name), "%s%s.ucode",
239 name_pre, tag); 239 name_pre, tag);
240 240
241 /*
242 * Starting 8000B - FW name format has changed. This overwrites the
243 * previous name and uses the new format.
244 */
245 if (drv->trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) {
246 char rev_step = 'A' + CSR_HW_REV_STEP(drv->trans->hw_rev);
247
248 if (rev_step != 'A')
249 snprintf(drv->firmware_name,
250 sizeof(drv->firmware_name), "%s%c-%s.ucode",
251 name_pre, rev_step, tag);
252 }
253
254 IWL_DEBUG_INFO(drv, "attempting to load firmware %s'%s'\n", 241 IWL_DEBUG_INFO(drv, "attempting to load firmware %s'%s'\n",
255 (drv->fw_index == UCODE_EXPERIMENTAL_INDEX) 242 (drv->fw_index == UCODE_EXPERIMENTAL_INDEX)
256 ? "EXPERIMENTAL " : "", 243 ? "EXPERIMENTAL " : "",
@@ -1060,11 +1047,18 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
1060 return -EINVAL; 1047 return -EINVAL;
1061 } 1048 }
1062 1049
1063 if (WARN(fw_has_capa(capa, IWL_UCODE_TLV_CAPA_GSCAN_SUPPORT) && 1050 /*
1064 !gscan_capa, 1051 * If ucode advertises that it supports GSCAN but GSCAN
1065 "GSCAN is supported but capabilities TLV is unavailable\n")) 1052 * capabilities TLV is not present, or if it has an old format,
1053 * warn and continue without GSCAN.
1054 */
1055 if (fw_has_capa(capa, IWL_UCODE_TLV_CAPA_GSCAN_SUPPORT) &&
1056 !gscan_capa) {
1057 IWL_DEBUG_INFO(drv,
1058 "GSCAN is supported but capabilities TLV is unavailable\n");
1066 __clear_bit((__force long)IWL_UCODE_TLV_CAPA_GSCAN_SUPPORT, 1059 __clear_bit((__force long)IWL_UCODE_TLV_CAPA_GSCAN_SUPPORT,
1067 capa->_capa); 1060 capa->_capa);
1061 }
1068 1062
1069 return 0; 1063 return 0;
1070 1064
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
index 4856eac120f6..6938cd37be57 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
@@ -526,7 +526,8 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
526 file_len += sizeof(*dump_data) + sizeof(*dump_mem) + sram2_len; 526 file_len += sizeof(*dump_data) + sizeof(*dump_mem) + sram2_len;
527 527
528 /* Make room for fw's virtual image pages, if it exists */ 528 /* Make room for fw's virtual image pages, if it exists */
529 if (mvm->fw->img[mvm->cur_ucode].paging_mem_size) 529 if (mvm->fw->img[mvm->cur_ucode].paging_mem_size &&
530 mvm->fw_paging_db[0].fw_paging_block)
530 file_len += mvm->num_of_paging_blk * 531 file_len += mvm->num_of_paging_blk *
531 (sizeof(*dump_data) + 532 (sizeof(*dump_data) +
532 sizeof(struct iwl_fw_error_dump_paging) + 533 sizeof(struct iwl_fw_error_dump_paging) +
@@ -643,7 +644,8 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
643 } 644 }
644 645
645 /* Dump fw's virtual image */ 646 /* Dump fw's virtual image */
646 if (mvm->fw->img[mvm->cur_ucode].paging_mem_size) { 647 if (mvm->fw->img[mvm->cur_ucode].paging_mem_size &&
648 mvm->fw_paging_db[0].fw_paging_block) {
647 for (i = 1; i < mvm->num_of_paging_blk + 1; i++) { 649 for (i = 1; i < mvm->num_of_paging_blk + 1; i++) {
648 struct iwl_fw_error_dump_paging *paging; 650 struct iwl_fw_error_dump_paging *paging;
649 struct page *pages = 651 struct page *pages =
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 594cd0dc7df9..09d895fafaf2 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -144,9 +144,11 @@ void iwl_free_fw_paging(struct iwl_mvm *mvm)
144 144
145 __free_pages(mvm->fw_paging_db[i].fw_paging_block, 145 __free_pages(mvm->fw_paging_db[i].fw_paging_block,
146 get_order(mvm->fw_paging_db[i].fw_paging_size)); 146 get_order(mvm->fw_paging_db[i].fw_paging_size));
147 mvm->fw_paging_db[i].fw_paging_block = NULL;
147 } 148 }
148 kfree(mvm->trans->paging_download_buf); 149 kfree(mvm->trans->paging_download_buf);
149 mvm->trans->paging_download_buf = NULL; 150 mvm->trans->paging_download_buf = NULL;
151 mvm->trans->paging_db = NULL;
150 152
151 memset(mvm->fw_paging_db, 0, sizeof(mvm->fw_paging_db)); 153 memset(mvm->fw_paging_db, 0, sizeof(mvm->fw_paging_db));
152} 154}
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index 05b968506836..79d7cd7d461e 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -479,8 +479,18 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
479 {IWL_PCI_DEVICE(0x24F3, 0x0930, iwl8260_2ac_cfg)}, 479 {IWL_PCI_DEVICE(0x24F3, 0x0930, iwl8260_2ac_cfg)},
480 {IWL_PCI_DEVICE(0x24F3, 0x0000, iwl8265_2ac_cfg)}, 480 {IWL_PCI_DEVICE(0x24F3, 0x0000, iwl8265_2ac_cfg)},
481 {IWL_PCI_DEVICE(0x24FD, 0x0010, iwl8265_2ac_cfg)}, 481 {IWL_PCI_DEVICE(0x24FD, 0x0010, iwl8265_2ac_cfg)},
482 {IWL_PCI_DEVICE(0x24FD, 0x0110, iwl8265_2ac_cfg)},
483 {IWL_PCI_DEVICE(0x24FD, 0x1110, iwl8265_2ac_cfg)},
484 {IWL_PCI_DEVICE(0x24FD, 0x1010, iwl8265_2ac_cfg)},
485 {IWL_PCI_DEVICE(0x24FD, 0x0050, iwl8265_2ac_cfg)},
486 {IWL_PCI_DEVICE(0x24FD, 0x0150, iwl8265_2ac_cfg)},
487 {IWL_PCI_DEVICE(0x24FD, 0x9010, iwl8265_2ac_cfg)},
488 {IWL_PCI_DEVICE(0x24FD, 0x8110, iwl8265_2ac_cfg)},
489 {IWL_PCI_DEVICE(0x24FD, 0x8050, iwl8265_2ac_cfg)},
482 {IWL_PCI_DEVICE(0x24FD, 0x8010, iwl8265_2ac_cfg)}, 490 {IWL_PCI_DEVICE(0x24FD, 0x8010, iwl8265_2ac_cfg)},
483 {IWL_PCI_DEVICE(0x24FD, 0x0810, iwl8265_2ac_cfg)}, 491 {IWL_PCI_DEVICE(0x24FD, 0x0810, iwl8265_2ac_cfg)},
492 {IWL_PCI_DEVICE(0x24FD, 0x9110, iwl8265_2ac_cfg)},
493 {IWL_PCI_DEVICE(0x24FD, 0x8130, iwl8265_2ac_cfg)},
484 494
485/* 9000 Series */ 495/* 9000 Series */
486 {IWL_PCI_DEVICE(0x9DF0, 0x2A10, iwl5165_2ac_cfg)}, 496 {IWL_PCI_DEVICE(0x9DF0, 0x2A10, iwl5165_2ac_cfg)},
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 21ee41b92e8a..f1d5c5acc8dd 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -171,12 +171,13 @@ void bpf_register_prog_type(struct bpf_prog_type_list *tl);
171void bpf_register_map_type(struct bpf_map_type_list *tl); 171void bpf_register_map_type(struct bpf_map_type_list *tl);
172 172
173struct bpf_prog *bpf_prog_get(u32 ufd); 173struct bpf_prog *bpf_prog_get(u32 ufd);
174struct bpf_prog *bpf_prog_inc(struct bpf_prog *prog);
174void bpf_prog_put(struct bpf_prog *prog); 175void bpf_prog_put(struct bpf_prog *prog);
175void bpf_prog_put_rcu(struct bpf_prog *prog); 176void bpf_prog_put_rcu(struct bpf_prog *prog);
176 177
177struct bpf_map *bpf_map_get_with_uref(u32 ufd); 178struct bpf_map *bpf_map_get_with_uref(u32 ufd);
178struct bpf_map *__bpf_map_get(struct fd f); 179struct bpf_map *__bpf_map_get(struct fd f);
179void bpf_map_inc(struct bpf_map *map, bool uref); 180struct bpf_map *bpf_map_inc(struct bpf_map *map, bool uref);
180void bpf_map_put_with_uref(struct bpf_map *map); 181void bpf_map_put_with_uref(struct bpf_map *map);
181void bpf_map_put(struct bpf_map *map); 182void bpf_map_put(struct bpf_map *map);
182int bpf_map_precharge_memlock(u32 pages); 183int bpf_map_precharge_memlock(u32 pages);
diff --git a/include/linux/net.h b/include/linux/net.h
index 49175e4ced11..f840d77c6c31 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -246,7 +246,15 @@ do { \
246 net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__) 246 net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
247#define net_info_ratelimited(fmt, ...) \ 247#define net_info_ratelimited(fmt, ...) \
248 net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__) 248 net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__)
249#if defined(DEBUG) 249#if defined(CONFIG_DYNAMIC_DEBUG)
250#define net_dbg_ratelimited(fmt, ...) \
251do { \
252 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
253 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \
254 net_ratelimit()) \
255 __dynamic_pr_debug(&descriptor, fmt, ##__VA_ARGS__); \
256} while (0)
257#elif defined(DEBUG)
250#define net_dbg_ratelimited(fmt, ...) \ 258#define net_dbg_ratelimited(fmt, ...) \
251 net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__) 259 net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
252#else 260#else
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 8395308a2445..b3c46b019ac1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -4004,7 +4004,7 @@ netdev_features_t netif_skb_features(struct sk_buff *skb);
4004 4004
4005static inline bool net_gso_ok(netdev_features_t features, int gso_type) 4005static inline bool net_gso_ok(netdev_features_t features, int gso_type)
4006{ 4006{
4007 netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT; 4007 netdev_features_t feature = (netdev_features_t)gso_type << NETIF_F_GSO_SHIFT;
4008 4008
4009 /* check flags correspondence */ 4009 /* check flags correspondence */
4010 BUILD_BUG_ON(SKB_GSO_TCPV4 != (NETIF_F_TSO >> NETIF_F_GSO_SHIFT)); 4010 BUILD_BUG_ON(SKB_GSO_TCPV4 != (NETIF_F_TSO >> NETIF_F_GSO_SHIFT));
diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
index f2ece3c174a5..8f94ca1860cf 100644
--- a/kernel/bpf/inode.c
+++ b/kernel/bpf/inode.c
@@ -31,10 +31,10 @@ static void *bpf_any_get(void *raw, enum bpf_type type)
31{ 31{
32 switch (type) { 32 switch (type) {
33 case BPF_TYPE_PROG: 33 case BPF_TYPE_PROG:
34 atomic_inc(&((struct bpf_prog *)raw)->aux->refcnt); 34 raw = bpf_prog_inc(raw);
35 break; 35 break;
36 case BPF_TYPE_MAP: 36 case BPF_TYPE_MAP:
37 bpf_map_inc(raw, true); 37 raw = bpf_map_inc(raw, true);
38 break; 38 break;
39 default: 39 default:
40 WARN_ON_ONCE(1); 40 WARN_ON_ONCE(1);
@@ -297,7 +297,8 @@ static void *bpf_obj_do_get(const struct filename *pathname,
297 goto out; 297 goto out;
298 298
299 raw = bpf_any_get(inode->i_private, *type); 299 raw = bpf_any_get(inode->i_private, *type);
300 touch_atime(&path); 300 if (!IS_ERR(raw))
301 touch_atime(&path);
301 302
302 path_put(&path); 303 path_put(&path);
303 return raw; 304 return raw;
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index adc5e4bd74f8..cf5e9f7ad13a 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -218,11 +218,18 @@ struct bpf_map *__bpf_map_get(struct fd f)
218 return f.file->private_data; 218 return f.file->private_data;
219} 219}
220 220
221void bpf_map_inc(struct bpf_map *map, bool uref) 221/* prog's and map's refcnt limit */
222#define BPF_MAX_REFCNT 32768
223
224struct bpf_map *bpf_map_inc(struct bpf_map *map, bool uref)
222{ 225{
223 atomic_inc(&map->refcnt); 226 if (atomic_inc_return(&map->refcnt) > BPF_MAX_REFCNT) {
227 atomic_dec(&map->refcnt);
228 return ERR_PTR(-EBUSY);
229 }
224 if (uref) 230 if (uref)
225 atomic_inc(&map->usercnt); 231 atomic_inc(&map->usercnt);
232 return map;
226} 233}
227 234
228struct bpf_map *bpf_map_get_with_uref(u32 ufd) 235struct bpf_map *bpf_map_get_with_uref(u32 ufd)
@@ -234,7 +241,7 @@ struct bpf_map *bpf_map_get_with_uref(u32 ufd)
234 if (IS_ERR(map)) 241 if (IS_ERR(map))
235 return map; 242 return map;
236 243
237 bpf_map_inc(map, true); 244 map = bpf_map_inc(map, true);
238 fdput(f); 245 fdput(f);
239 246
240 return map; 247 return map;
@@ -658,6 +665,15 @@ static struct bpf_prog *__bpf_prog_get(struct fd f)
658 return f.file->private_data; 665 return f.file->private_data;
659} 666}
660 667
668struct bpf_prog *bpf_prog_inc(struct bpf_prog *prog)
669{
670 if (atomic_inc_return(&prog->aux->refcnt) > BPF_MAX_REFCNT) {
671 atomic_dec(&prog->aux->refcnt);
672 return ERR_PTR(-EBUSY);
673 }
674 return prog;
675}
676
661/* called by sockets/tracing/seccomp before attaching program to an event 677/* called by sockets/tracing/seccomp before attaching program to an event
662 * pairs with bpf_prog_put() 678 * pairs with bpf_prog_put()
663 */ 679 */
@@ -670,7 +686,7 @@ struct bpf_prog *bpf_prog_get(u32 ufd)
670 if (IS_ERR(prog)) 686 if (IS_ERR(prog))
671 return prog; 687 return prog;
672 688
673 atomic_inc(&prog->aux->refcnt); 689 prog = bpf_prog_inc(prog);
674 fdput(f); 690 fdput(f);
675 691
676 return prog; 692 return prog;
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index db2574e7b8b0..c5c17a62f509 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -239,16 +239,6 @@ static const char * const reg_type_str[] = {
239 [CONST_IMM] = "imm", 239 [CONST_IMM] = "imm",
240}; 240};
241 241
242static const struct {
243 int map_type;
244 int func_id;
245} func_limit[] = {
246 {BPF_MAP_TYPE_PROG_ARRAY, BPF_FUNC_tail_call},
247 {BPF_MAP_TYPE_PERF_EVENT_ARRAY, BPF_FUNC_perf_event_read},
248 {BPF_MAP_TYPE_PERF_EVENT_ARRAY, BPF_FUNC_perf_event_output},
249 {BPF_MAP_TYPE_STACK_TRACE, BPF_FUNC_get_stackid},
250};
251
252static void print_verifier_state(struct verifier_env *env) 242static void print_verifier_state(struct verifier_env *env)
253{ 243{
254 enum bpf_reg_type t; 244 enum bpf_reg_type t;
@@ -921,27 +911,52 @@ static int check_func_arg(struct verifier_env *env, u32 regno,
921 911
922static int check_map_func_compatibility(struct bpf_map *map, int func_id) 912static int check_map_func_compatibility(struct bpf_map *map, int func_id)
923{ 913{
924 bool bool_map, bool_func;
925 int i;
926
927 if (!map) 914 if (!map)
928 return 0; 915 return 0;
929 916
930 for (i = 0; i < ARRAY_SIZE(func_limit); i++) { 917 /* We need a two way check, first is from map perspective ... */
931 bool_map = (map->map_type == func_limit[i].map_type); 918 switch (map->map_type) {
932 bool_func = (func_id == func_limit[i].func_id); 919 case BPF_MAP_TYPE_PROG_ARRAY:
933 /* only when map & func pair match it can continue. 920 if (func_id != BPF_FUNC_tail_call)
934 * don't allow any other map type to be passed into 921 goto error;
935 * the special func; 922 break;
936 */ 923 case BPF_MAP_TYPE_PERF_EVENT_ARRAY:
937 if (bool_func && bool_map != bool_func) { 924 if (func_id != BPF_FUNC_perf_event_read &&
938 verbose("cannot pass map_type %d into func %d\n", 925 func_id != BPF_FUNC_perf_event_output)
939 map->map_type, func_id); 926 goto error;
940 return -EINVAL; 927 break;
941 } 928 case BPF_MAP_TYPE_STACK_TRACE:
929 if (func_id != BPF_FUNC_get_stackid)
930 goto error;
931 break;
932 default:
933 break;
934 }
935
936 /* ... and second from the function itself. */
937 switch (func_id) {
938 case BPF_FUNC_tail_call:
939 if (map->map_type != BPF_MAP_TYPE_PROG_ARRAY)
940 goto error;
941 break;
942 case BPF_FUNC_perf_event_read:
943 case BPF_FUNC_perf_event_output:
944 if (map->map_type != BPF_MAP_TYPE_PERF_EVENT_ARRAY)
945 goto error;
946 break;
947 case BPF_FUNC_get_stackid:
948 if (map->map_type != BPF_MAP_TYPE_STACK_TRACE)
949 goto error;
950 break;
951 default:
952 break;
942 } 953 }
943 954
944 return 0; 955 return 0;
956error:
957 verbose("cannot pass map_type %d into func %d\n",
958 map->map_type, func_id);
959 return -EINVAL;
945} 960}
946 961
947static int check_call(struct verifier_env *env, int func_id) 962static int check_call(struct verifier_env *env, int func_id)
@@ -2049,15 +2064,18 @@ static int replace_map_fd_with_map_ptr(struct verifier_env *env)
2049 return -E2BIG; 2064 return -E2BIG;
2050 } 2065 }
2051 2066
2052 /* remember this map */
2053 env->used_maps[env->used_map_cnt++] = map;
2054
2055 /* hold the map. If the program is rejected by verifier, 2067 /* hold the map. If the program is rejected by verifier,
2056 * the map will be released by release_maps() or it 2068 * the map will be released by release_maps() or it
2057 * will be used by the valid program until it's unloaded 2069 * will be used by the valid program until it's unloaded
2058 * and all maps are released in free_bpf_prog_info() 2070 * and all maps are released in free_bpf_prog_info()
2059 */ 2071 */
2060 bpf_map_inc(map, false); 2072 map = bpf_map_inc(map, false);
2073 if (IS_ERR(map)) {
2074 fdput(f);
2075 return PTR_ERR(map);
2076 }
2077 env->used_maps[env->used_map_cnt++] = map;
2078
2061 fdput(f); 2079 fdput(f);
2062next_insn: 2080next_insn:
2063 insn++; 2081 insn++;
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index b22b2775a0a5..c61d5b0b24d2 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -572,8 +572,7 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
572 struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface); 572 struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
573 struct batadv_hard_iface *primary_if = NULL; 573 struct batadv_hard_iface *primary_if = NULL;
574 574
575 if (hard_iface->if_status == BATADV_IF_ACTIVE) 575 batadv_hardif_deactivate_interface(hard_iface);
576 batadv_hardif_deactivate_interface(hard_iface);
577 576
578 if (hard_iface->if_status != BATADV_IF_INACTIVE) 577 if (hard_iface->if_status != BATADV_IF_INACTIVE)
579 goto out; 578 goto out;
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index e4cbb0753e37..d52f67a0c057 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -663,6 +663,7 @@ batadv_neigh_node_new(struct batadv_orig_node *orig_node,
663 ether_addr_copy(neigh_node->addr, neigh_addr); 663 ether_addr_copy(neigh_node->addr, neigh_addr);
664 neigh_node->if_incoming = hard_iface; 664 neigh_node->if_incoming = hard_iface;
665 neigh_node->orig_node = orig_node; 665 neigh_node->orig_node = orig_node;
666 neigh_node->last_seen = jiffies;
666 667
667 /* extra reference for return */ 668 /* extra reference for return */
668 kref_init(&neigh_node->refcount); 669 kref_init(&neigh_node->refcount);
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 4dd646a52f1a..b781bf753250 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -105,6 +105,15 @@ static void _batadv_update_route(struct batadv_priv *bat_priv,
105 neigh_node = NULL; 105 neigh_node = NULL;
106 106
107 spin_lock_bh(&orig_node->neigh_list_lock); 107 spin_lock_bh(&orig_node->neigh_list_lock);
108 /* curr_router used earlier may not be the current orig_ifinfo->router
109 * anymore because it was dereferenced outside of the neigh_list_lock
110 * protected region. After the new best neighbor has replace the current
111 * best neighbor the reference counter needs to decrease. Consequently,
112 * the code needs to ensure the curr_router variable contains a pointer
113 * to the replaced best neighbor.
114 */
115 curr_router = rcu_dereference_protected(orig_ifinfo->router, true);
116
108 rcu_assign_pointer(orig_ifinfo->router, neigh_node); 117 rcu_assign_pointer(orig_ifinfo->router, neigh_node);
109 spin_unlock_bh(&orig_node->neigh_list_lock); 118 spin_unlock_bh(&orig_node->neigh_list_lock);
110 batadv_orig_ifinfo_put(orig_ifinfo); 119 batadv_orig_ifinfo_put(orig_ifinfo);
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 3ce06e0a91b1..76417850d3fc 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -675,6 +675,9 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
675 675
676 if (pending) { 676 if (pending) {
677 hlist_del(&forw_packet->list); 677 hlist_del(&forw_packet->list);
678 if (!forw_packet->own)
679 atomic_inc(&bat_priv->bcast_queue_left);
680
678 batadv_forw_packet_free(forw_packet); 681 batadv_forw_packet_free(forw_packet);
679 } 682 }
680 } 683 }
@@ -702,6 +705,9 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
702 705
703 if (pending) { 706 if (pending) {
704 hlist_del(&forw_packet->list); 707 hlist_del(&forw_packet->list);
708 if (!forw_packet->own)
709 atomic_inc(&bat_priv->batman_queue_left);
710
705 batadv_forw_packet_free(forw_packet); 711 batadv_forw_packet_free(forw_packet);
706 } 712 }
707 } 713 }
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 0710379491bf..8a136b6a1ff0 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -408,11 +408,17 @@ void batadv_interface_rx(struct net_device *soft_iface,
408 */ 408 */
409 nf_reset(skb); 409 nf_reset(skb);
410 410
411 if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
412 goto dropped;
413
411 vid = batadv_get_vid(skb, 0); 414 vid = batadv_get_vid(skb, 0);
412 ethhdr = eth_hdr(skb); 415 ethhdr = eth_hdr(skb);
413 416
414 switch (ntohs(ethhdr->h_proto)) { 417 switch (ntohs(ethhdr->h_proto)) {
415 case ETH_P_8021Q: 418 case ETH_P_8021Q:
419 if (!pskb_may_pull(skb, VLAN_ETH_HLEN))
420 goto dropped;
421
416 vhdr = (struct vlan_ethhdr *)skb->data; 422 vhdr = (struct vlan_ethhdr *)skb->data;
417 423
418 if (vhdr->h_vlan_encapsulated_proto != ethertype) 424 if (vhdr->h_vlan_encapsulated_proto != ethertype)
@@ -424,8 +430,6 @@ void batadv_interface_rx(struct net_device *soft_iface,
424 } 430 }
425 431
426 /* skb->dev & skb->pkt_type are set here */ 432 /* skb->dev & skb->pkt_type are set here */
427 if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
428 goto dropped;
429 skb->protocol = eth_type_trans(skb, soft_iface); 433 skb->protocol = eth_type_trans(skb, soft_iface);
430 434
431 /* should not be necessary anymore as we use skb_pull_rcsum() 435 /* should not be necessary anymore as we use skb_pull_rcsum()
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index bc68eced0105..0d9e9d7bb029 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -470,6 +470,7 @@ static int inet_reuseport_add_sock(struct sock *sk,
470 const struct sock *sk2, 470 const struct sock *sk2,
471 bool match_wildcard)) 471 bool match_wildcard))
472{ 472{
473 struct inet_bind_bucket *tb = inet_csk(sk)->icsk_bind_hash;
473 struct sock *sk2; 474 struct sock *sk2;
474 struct hlist_nulls_node *node; 475 struct hlist_nulls_node *node;
475 kuid_t uid = sock_i_uid(sk); 476 kuid_t uid = sock_i_uid(sk);
@@ -479,6 +480,7 @@ static int inet_reuseport_add_sock(struct sock *sk,
479 sk2->sk_family == sk->sk_family && 480 sk2->sk_family == sk->sk_family &&
480 ipv6_only_sock(sk2) == ipv6_only_sock(sk) && 481 ipv6_only_sock(sk2) == ipv6_only_sock(sk) &&
481 sk2->sk_bound_dev_if == sk->sk_bound_dev_if && 482 sk2->sk_bound_dev_if == sk->sk_bound_dev_if &&
483 inet_csk(sk2)->icsk_bind_hash == tb &&
482 sk2->sk_reuseport && uid_eq(uid, sock_i_uid(sk2)) && 484 sk2->sk_reuseport && uid_eq(uid, sock_i_uid(sk2)) &&
483 saddr_same(sk, sk2, false)) 485 saddr_same(sk, sk2, false))
484 return reuseport_add_sock(sk, sk2); 486 return reuseport_add_sock(sk, sk2);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index af5d1f38217f..205a2b8a5a84 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -179,6 +179,7 @@ static __be16 tnl_flags_to_gre_flags(__be16 tflags)
179 return flags; 179 return flags;
180} 180}
181 181
182/* Fills in tpi and returns header length to be pulled. */
182static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi, 183static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
183 bool *csum_err) 184 bool *csum_err)
184{ 185{
@@ -238,7 +239,7 @@ static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
238 return -EINVAL; 239 return -EINVAL;
239 } 240 }
240 } 241 }
241 return iptunnel_pull_header(skb, hdr_len, tpi->proto, false); 242 return hdr_len;
242} 243}
243 244
244static void ipgre_err(struct sk_buff *skb, u32 info, 245static void ipgre_err(struct sk_buff *skb, u32 info,
@@ -341,7 +342,7 @@ static void gre_err(struct sk_buff *skb, u32 info)
341 struct tnl_ptk_info tpi; 342 struct tnl_ptk_info tpi;
342 bool csum_err = false; 343 bool csum_err = false;
343 344
344 if (parse_gre_header(skb, &tpi, &csum_err)) { 345 if (parse_gre_header(skb, &tpi, &csum_err) < 0) {
345 if (!csum_err) /* ignore csum errors. */ 346 if (!csum_err) /* ignore csum errors. */
346 return; 347 return;
347 } 348 }
@@ -419,6 +420,7 @@ static int gre_rcv(struct sk_buff *skb)
419{ 420{
420 struct tnl_ptk_info tpi; 421 struct tnl_ptk_info tpi;
421 bool csum_err = false; 422 bool csum_err = false;
423 int hdr_len;
422 424
423#ifdef CONFIG_NET_IPGRE_BROADCAST 425#ifdef CONFIG_NET_IPGRE_BROADCAST
424 if (ipv4_is_multicast(ip_hdr(skb)->daddr)) { 426 if (ipv4_is_multicast(ip_hdr(skb)->daddr)) {
@@ -428,7 +430,10 @@ static int gre_rcv(struct sk_buff *skb)
428 } 430 }
429#endif 431#endif
430 432
431 if (parse_gre_header(skb, &tpi, &csum_err) < 0) 433 hdr_len = parse_gre_header(skb, &tpi, &csum_err);
434 if (hdr_len < 0)
435 goto drop;
436 if (iptunnel_pull_header(skb, hdr_len, tpi.proto, false) < 0)
432 goto drop; 437 goto drop;
433 438
434 if (ipgre_rcv(skb, &tpi) == PACKET_RCVD) 439 if (ipgre_rcv(skb, &tpi) == PACKET_RCVD)
@@ -523,7 +528,8 @@ static struct rtable *gre_get_rt(struct sk_buff *skb,
523 return ip_route_output_key(net, fl); 528 return ip_route_output_key(net, fl);
524} 529}
525 530
526static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev) 531static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev,
532 __be16 proto)
527{ 533{
528 struct ip_tunnel_info *tun_info; 534 struct ip_tunnel_info *tun_info;
529 const struct ip_tunnel_key *key; 535 const struct ip_tunnel_key *key;
@@ -575,7 +581,7 @@ static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev)
575 } 581 }
576 582
577 flags = tun_info->key.tun_flags & (TUNNEL_CSUM | TUNNEL_KEY); 583 flags = tun_info->key.tun_flags & (TUNNEL_CSUM | TUNNEL_KEY);
578 build_header(skb, tunnel_hlen, flags, htons(ETH_P_TEB), 584 build_header(skb, tunnel_hlen, flags, proto,
579 tunnel_id_to_key(tun_info->key.tun_id), 0); 585 tunnel_id_to_key(tun_info->key.tun_id), 0);
580 586
581 df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0; 587 df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0;
@@ -616,7 +622,7 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb,
616 const struct iphdr *tnl_params; 622 const struct iphdr *tnl_params;
617 623
618 if (tunnel->collect_md) { 624 if (tunnel->collect_md) {
619 gre_fb_xmit(skb, dev); 625 gre_fb_xmit(skb, dev, skb->protocol);
620 return NETDEV_TX_OK; 626 return NETDEV_TX_OK;
621 } 627 }
622 628
@@ -660,7 +666,7 @@ static netdev_tx_t gre_tap_xmit(struct sk_buff *skb,
660 struct ip_tunnel *tunnel = netdev_priv(dev); 666 struct ip_tunnel *tunnel = netdev_priv(dev);
661 667
662 if (tunnel->collect_md) { 668 if (tunnel->collect_md) {
663 gre_fb_xmit(skb, dev); 669 gre_fb_xmit(skb, dev, htons(ETH_P_TEB));
664 return NETDEV_TX_OK; 670 return NETDEV_TX_OK;
665 } 671 }
666 672
@@ -893,7 +899,7 @@ static int ipgre_tunnel_init(struct net_device *dev)
893 netif_keep_dst(dev); 899 netif_keep_dst(dev);
894 dev->addr_len = 4; 900 dev->addr_len = 4;
895 901
896 if (iph->daddr) { 902 if (iph->daddr && !tunnel->collect_md) {
897#ifdef CONFIG_NET_IPGRE_BROADCAST 903#ifdef CONFIG_NET_IPGRE_BROADCAST
898 if (ipv4_is_multicast(iph->daddr)) { 904 if (ipv4_is_multicast(iph->daddr)) {
899 if (!iph->saddr) 905 if (!iph->saddr)
@@ -902,8 +908,9 @@ static int ipgre_tunnel_init(struct net_device *dev)
902 dev->header_ops = &ipgre_header_ops; 908 dev->header_ops = &ipgre_header_ops;
903 } 909 }
904#endif 910#endif
905 } else 911 } else if (!tunnel->collect_md) {
906 dev->header_ops = &ipgre_header_ops; 912 dev->header_ops = &ipgre_header_ops;
913 }
907 914
908 return ip_tunnel_init(dev); 915 return ip_tunnel_init(dev);
909} 916}
@@ -946,6 +953,11 @@ static int ipgre_tunnel_validate(struct nlattr *tb[], struct nlattr *data[])
946 if (flags & (GRE_VERSION|GRE_ROUTING)) 953 if (flags & (GRE_VERSION|GRE_ROUTING))
947 return -EINVAL; 954 return -EINVAL;
948 955
956 if (data[IFLA_GRE_COLLECT_METADATA] &&
957 data[IFLA_GRE_ENCAP_TYPE] &&
958 nla_get_u16(data[IFLA_GRE_ENCAP_TYPE]) != TUNNEL_ENCAP_NONE)
959 return -EINVAL;
960
949 return 0; 961 return 0;
950} 962}
951 963
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index 6aad0192443d..a69ed94bda1b 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -326,12 +326,12 @@ static int ip_tunnel_bind_dev(struct net_device *dev)
326 326
327 if (!IS_ERR(rt)) { 327 if (!IS_ERR(rt)) {
328 tdev = rt->dst.dev; 328 tdev = rt->dst.dev;
329 dst_cache_set_ip4(&tunnel->dst_cache, &rt->dst,
330 fl4.saddr);
331 ip_rt_put(rt); 329 ip_rt_put(rt);
332 } 330 }
333 if (dev->type != ARPHRD_ETHER) 331 if (dev->type != ARPHRD_ETHER)
334 dev->flags |= IFF_POINTOPOINT; 332 dev->flags |= IFF_POINTOPOINT;
333
334 dst_cache_reset(&tunnel->dst_cache);
335 } 335 }
336 336
337 if (!tdev && tunnel->parms.link) 337 if (!tdev && tunnel->parms.link)
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index afca2eb4dfa7..6edfa9980314 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1376,9 +1376,9 @@ static int l2tp_tunnel_sock_create(struct net *net,
1376 memcpy(&udp_conf.peer_ip6, cfg->peer_ip6, 1376 memcpy(&udp_conf.peer_ip6, cfg->peer_ip6,
1377 sizeof(udp_conf.peer_ip6)); 1377 sizeof(udp_conf.peer_ip6));
1378 udp_conf.use_udp6_tx_checksums = 1378 udp_conf.use_udp6_tx_checksums =
1379 cfg->udp6_zero_tx_checksums; 1379 ! cfg->udp6_zero_tx_checksums;
1380 udp_conf.use_udp6_rx_checksums = 1380 udp_conf.use_udp6_rx_checksums =
1381 cfg->udp6_zero_rx_checksums; 1381 ! cfg->udp6_zero_rx_checksums;
1382 } else 1382 } else
1383#endif 1383#endif
1384 { 1384 {
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 453b4e741780..e1cb22c16530 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1761,7 +1761,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
1761 1761
1762 ret = dev_alloc_name(ndev, ndev->name); 1762 ret = dev_alloc_name(ndev, ndev->name);
1763 if (ret < 0) { 1763 if (ret < 0) {
1764 free_netdev(ndev); 1764 ieee80211_if_free(ndev);
1765 return ret; 1765 return ret;
1766 } 1766 }
1767 1767
@@ -1847,7 +1847,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
1847 1847
1848 ret = register_netdevice(ndev); 1848 ret = register_netdevice(ndev);
1849 if (ret) { 1849 if (ret) {
1850 free_netdev(ndev); 1850 ieee80211_if_free(ndev);
1851 return ret; 1851 return ret;
1852 } 1852 }
1853 } 1853 }
diff --git a/net/tipc/node.c b/net/tipc/node.c
index ace178fd3850..9aaa1bc566ae 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -1444,6 +1444,7 @@ void tipc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b)
1444 int bearer_id = b->identity; 1444 int bearer_id = b->identity;
1445 struct tipc_link_entry *le; 1445 struct tipc_link_entry *le;
1446 u16 bc_ack = msg_bcast_ack(hdr); 1446 u16 bc_ack = msg_bcast_ack(hdr);
1447 u32 self = tipc_own_addr(net);
1447 int rc = 0; 1448 int rc = 0;
1448 1449
1449 __skb_queue_head_init(&xmitq); 1450 __skb_queue_head_init(&xmitq);
@@ -1460,6 +1461,10 @@ void tipc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b)
1460 return tipc_node_bc_rcv(net, skb, bearer_id); 1461 return tipc_node_bc_rcv(net, skb, bearer_id);
1461 } 1462 }
1462 1463
1464 /* Discard unicast link messages destined for another node */
1465 if (unlikely(!msg_short(hdr) && (msg_destnode(hdr) != self)))
1466 goto discard;
1467
1463 /* Locate neighboring node that sent packet */ 1468 /* Locate neighboring node that sent packet */
1464 n = tipc_node_find(net, msg_prevnode(hdr)); 1469 n = tipc_node_find(net, msg_prevnode(hdr));
1465 if (unlikely(!n)) 1470 if (unlikely(!n))
diff --git a/samples/bpf/trace_output_kern.c b/samples/bpf/trace_output_kern.c
index 8d8d1ec429eb..9b96f4fb8cea 100644
--- a/samples/bpf/trace_output_kern.c
+++ b/samples/bpf/trace_output_kern.c
@@ -18,7 +18,6 @@ int bpf_prog1(struct pt_regs *ctx)
18 u64 cookie; 18 u64 cookie;
19 } data; 19 } data;
20 20
21 memset(&data, 0, sizeof(data));
22 data.pid = bpf_get_current_pid_tgid(); 21 data.pid = bpf_get_current_pid_tgid();
23 data.cookie = 0x12345678; 22 data.cookie = 0x12345678;
24 23