aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-12 21:51:48 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-12 21:51:48 -0400
commit98260daa184c4a171834463cf85ab3a2c509d983 (patch)
tree318c3bfff9edef4da84a69895a3ac2aa39b8256a
parente225ca27057e70e7cbb14ae4c1e5f758973af645 (diff)
parentdabdaf0caa3af520dbc1df87b2fb4e77224037bd (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking updates from David Miller: 1) Alexey Kuznetsov noticed we routed TCP resets improperly in the assymetric routing case, fix this by reverting a change that made us use the incoming interface in the outgoing route key when we didn't have a socket context to work with. 2) TCP sysctl kernel memory leakage to userspace fix from Alan Cox. 3) Move UAPI bits from David Howells, WIMAX and CAN this time. 4) Fix TX stalls in e1000e wrt. Byte Queue Limits, from Hiroaki SHIMODA, Denys Fedoryshchenko, and Jesse Brandeburg. 5) Fix IPV6 crashes in packet generator module, from Amerigo Wang. 6) Tidies and fixes in the new VXLAN driver from Stephen Hemminger. 7) Bridge IP options parse doesn't check first if SKB header has at least an IP header's worth of content present. Fix from Sarveshwar Bandi. 8) The kernel now generates compound pages on transmit and the Xen netback drivers needs some adjustments in order to handle this. Fix from Ian Campbell. 9) Turn off ASPM in JME driver, from Kevin Bardon and Matthew Garrett. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (43 commits) mcs7830: Fix link state detection net: add doc for in4_pton() net: add doc for in6_pton() vti: fix sparse bit endian warnings tcp: resets are misrouted usbnet: Support devices reporting idleness Add CDC-ACM support for the CX93010-2x UCMxx USB Modem net/ethernet/jme: disable ASPM tcp: sysctl interface leaks 16 bytes of kernel memory kaweth: print correct debug ptr e1000e: Change wthresh to 1 to avoid possible Tx stalls ipv4: fix route mark sparse warning xen: netback: handle compound page fragments on transmit. bridge: Pull ip header into skb->data before looking into ip header. isdn: fix a wrapping bug in isdn_ppp_ioctl() vxlan: fix oops when give unknown ifindex vxlan: fix receive checksum handling vxlan: add additional headroom vxlan: allow configuring port range vxlan: associate with tunnel socket on transmit ...
-rw-r--r--drivers/isdn/i4l/isdn_ppp.c2
-rw-r--r--drivers/net/ethernet/intel/e1000e/e1000.h6
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c2
-rw-r--r--drivers/net/ethernet/jme.c4
-rw-r--r--drivers/net/usb/cdc_eem.c4
-rw-r--r--drivers/net/usb/kaweth.c2
-rw-r--r--drivers/net/usb/mcs7830.c30
-rw-r--r--drivers/net/usb/usbnet.c17
-rw-r--r--drivers/net/vxlan.c148
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/beacon.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c15
-rw-r--r--drivers/net/wireless/ath/ath9k/pci.c7
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c53
-rw-r--r--drivers/net/wireless/ath/carl9170/carl9170.h1
-rw-r--r--drivers/net/wireless/ath/carl9170/main.c29
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c27
-rw-r--r--drivers/net/wireless/mwifiex/join.c6
-rw-r--r--drivers/net/wireless/mwifiex/main.h2
-rw-r--r--drivers/net/wireless/mwifiex/scan.c38
-rw-r--r--drivers/net/wireless/mwifiex/sta_cmdresp.c4
-rw-r--r--drivers/net/wireless/mwifiex/sta_event.c31
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c4
-rw-r--r--drivers/net/xen-netback/netback.c40
-rw-r--r--drivers/usb/class/cdc-acm.c3
-rw-r--r--include/linux/can/Kbuild5
-rw-r--r--include/linux/if_link.h6
-rw-r--r--include/linux/of_mdio.h20
-rw-r--r--include/linux/usb/usbnet.h2
-rw-r--r--include/linux/wimax/Kbuild1
-rw-r--r--include/uapi/linux/can/Kbuild5
-rw-r--r--include/uapi/linux/can/bcm.h (renamed from include/linux/can/bcm.h)0
-rw-r--r--include/uapi/linux/can/error.h (renamed from include/linux/can/error.h)0
-rw-r--r--include/uapi/linux/can/gw.h (renamed from include/linux/can/gw.h)0
-rw-r--r--include/uapi/linux/can/netlink.h (renamed from include/linux/can/netlink.h)0
-rw-r--r--include/uapi/linux/can/raw.h (renamed from include/linux/can/raw.h)0
-rw-r--r--include/uapi/linux/wimax/Kbuild1
-rw-r--r--include/uapi/linux/wimax/i2400m.h (renamed from include/linux/wimax/i2400m.h)0
-rw-r--r--net/bridge/br_netfilter.c3
-rw-r--r--net/core/pktgen.c146
-rw-r--r--net/core/utils.c24
-rw-r--r--net/ipv4/ip_vti.c4
-rw-r--r--net/ipv4/route.c2
-rw-r--r--net/ipv4/sysctl_net_ipv4.c2
-rw-r--r--net/ipv4/tcp_ipv4.c7
-rw-r--r--net/ipv6/tcp_ipv6.c3
-rw-r--r--net/mac80211/mesh_sync.c3
-rw-r--r--net/mac80211/status.c4
-rw-r--r--net/mac80211/tx.c22
51 files changed, 450 insertions, 296 deletions
diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c
index a1e760150821..61d78fa03b1a 100644
--- a/drivers/isdn/i4l/isdn_ppp.c
+++ b/drivers/isdn/i4l/isdn_ppp.c
@@ -595,7 +595,7 @@ isdn_ppp_ioctl(int min, struct file *file, unsigned int cmd, unsigned long arg)
595 j = ipc->num / (sizeof(long) * 8); 595 j = ipc->num / (sizeof(long) * 8);
596 i = ipc->num % (sizeof(long) * 8); 596 i = ipc->num % (sizeof(long) * 8);
597 if (j < 8) 597 if (j < 8)
598 protos[j] |= (0x1 << i); 598 protos[j] |= (1UL << i);
599 ipc = ipc->next; 599 ipc = ipc->next;
600 } 600 }
601 if ((r = set_arg(argp, protos, 8 * sizeof(long)))) 601 if ((r = set_arg(argp, protos, 8 * sizeof(long))))
diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h
index cb3356c9af80..04668b47a1df 100644
--- a/drivers/net/ethernet/intel/e1000e/e1000.h
+++ b/drivers/net/ethernet/intel/e1000e/e1000.h
@@ -175,13 +175,13 @@ struct e1000_info;
175/* 175/*
176 * in the case of WTHRESH, it appears at least the 82571/2 hardware 176 * in the case of WTHRESH, it appears at least the 82571/2 hardware
177 * writes back 4 descriptors when WTHRESH=5, and 3 descriptors when 177 * writes back 4 descriptors when WTHRESH=5, and 3 descriptors when
178 * WTHRESH=4, and since we want 64 bytes at a time written back, set 178 * WTHRESH=4, so a setting of 5 gives the most efficient bus
179 * it to 5 179 * utilization but to avoid possible Tx stalls, set it to 1
180 */ 180 */
181#define E1000_TXDCTL_DMA_BURST_ENABLE \ 181#define E1000_TXDCTL_DMA_BURST_ENABLE \
182 (E1000_TXDCTL_GRAN | /* set descriptor granularity */ \ 182 (E1000_TXDCTL_GRAN | /* set descriptor granularity */ \
183 E1000_TXDCTL_COUNT_DESC | \ 183 E1000_TXDCTL_COUNT_DESC | \
184 (5 << 16) | /* wthresh must be +1 more than desired */\ 184 (1 << 16) | /* wthresh must be +1 more than desired */\
185 (1 << 8) | /* hthresh */ \ 185 (1 << 8) | /* hthresh */ \
186 0x1f) /* pthresh */ 186 0x1f) /* pthresh */
187 187
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index de57a2ba6bde..f444eb0b76d8 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -2831,7 +2831,7 @@ static void e1000_configure_tx(struct e1000_adapter *adapter)
2831 * set up some performance related parameters to encourage the 2831 * set up some performance related parameters to encourage the
2832 * hardware to use the bus more efficiently in bursts, depends 2832 * hardware to use the bus more efficiently in bursts, depends
2833 * on the tx_int_delay to be enabled, 2833 * on the tx_int_delay to be enabled,
2834 * wthresh = 5 ==> burst write a cacheline (64 bytes) at a time 2834 * wthresh = 1 ==> burst write is disabled to avoid Tx stalls
2835 * hthresh = 1 ==> prefetch when one or more available 2835 * hthresh = 1 ==> prefetch when one or more available
2836 * pthresh = 0x1f ==> prefetch if internal cache 31 or less 2836 * pthresh = 0x1f ==> prefetch if internal cache 31 or less
2837 * BEWARE: this seems to work but should be considered first if 2837 * BEWARE: this seems to work but should be considered first if
diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c
index c911d883c27e..f8064df10cc4 100644
--- a/drivers/net/ethernet/jme.c
+++ b/drivers/net/ethernet/jme.c
@@ -27,6 +27,7 @@
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/kernel.h> 28#include <linux/kernel.h>
29#include <linux/pci.h> 29#include <linux/pci.h>
30#include <linux/pci-aspm.h>
30#include <linux/netdevice.h> 31#include <linux/netdevice.h>
31#include <linux/etherdevice.h> 32#include <linux/etherdevice.h>
32#include <linux/ethtool.h> 33#include <linux/ethtool.h>
@@ -2973,6 +2974,9 @@ jme_init_one(struct pci_dev *pdev,
2973 /* 2974 /*
2974 * set up PCI device basics 2975 * set up PCI device basics
2975 */ 2976 */
2977 pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 |
2978 PCIE_LINK_STATE_CLKPM);
2979
2976 rc = pci_enable_device(pdev); 2980 rc = pci_enable_device(pdev);
2977 if (rc) { 2981 if (rc) {
2978 pr_err("Cannot enable PCI device\n"); 2982 pr_err("Cannot enable PCI device\n");
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c
index 434d5af8e6fb..c81e278629ff 100644
--- a/drivers/net/usb/cdc_eem.c
+++ b/drivers/net/usb/cdc_eem.c
@@ -244,8 +244,12 @@ static int eem_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
244 * - suspend: peripheral ready to suspend 244 * - suspend: peripheral ready to suspend
245 * - response: suggest N millisec polling 245 * - response: suggest N millisec polling
246 * - response complete: suggest N sec polling 246 * - response complete: suggest N sec polling
247 *
248 * Suspend is reported and maybe heeded.
247 */ 249 */
248 case 2: /* Suspend hint */ 250 case 2: /* Suspend hint */
251 usbnet_device_suggests_idle(dev);
252 continue;
249 case 3: /* Response hint */ 253 case 3: /* Response hint */
250 case 4: /* Response complete hint */ 254 case 4: /* Response complete hint */
251 continue; 255 continue;
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index c75e11e1b385..afb117c16d2d 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -424,7 +424,7 @@ static int kaweth_download_firmware(struct kaweth_device *kaweth,
424 424
425 netdev_dbg(kaweth->net, 425 netdev_dbg(kaweth->net,
426 "Downloading firmware at %p to kaweth device at %p\n", 426 "Downloading firmware at %p to kaweth device at %p\n",
427 fw->data, kaweth); 427 kaweth->firmware_buf, kaweth);
428 netdev_dbg(kaweth->net, "Firmware length: %d\n", data_len); 428 netdev_dbg(kaweth->net, "Firmware length: %d\n", data_len);
429 429
430 return kaweth_control(kaweth, 430 return kaweth_control(kaweth,
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c
index 03c2d8d653df..cc7e72010ac3 100644
--- a/drivers/net/usb/mcs7830.c
+++ b/drivers/net/usb/mcs7830.c
@@ -117,6 +117,7 @@ enum {
117struct mcs7830_data { 117struct mcs7830_data {
118 u8 multi_filter[8]; 118 u8 multi_filter[8];
119 u8 config; 119 u8 config;
120 u8 link_counter;
120}; 121};
121 122
122static const char driver_name[] = "MOSCHIP usb-ethernet driver"; 123static const char driver_name[] = "MOSCHIP usb-ethernet driver";
@@ -632,20 +633,31 @@ static int mcs7830_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
632static void mcs7830_status(struct usbnet *dev, struct urb *urb) 633static void mcs7830_status(struct usbnet *dev, struct urb *urb)
633{ 634{
634 u8 *buf = urb->transfer_buffer; 635 u8 *buf = urb->transfer_buffer;
635 bool link; 636 bool link, link_changed;
637 struct mcs7830_data *data = mcs7830_get_data(dev);
636 638
637 if (urb->actual_length < 16) 639 if (urb->actual_length < 16)
638 return; 640 return;
639 641
640 link = !(buf[1] & 0x20); 642 link = !(buf[1] & 0x20);
641 if (netif_carrier_ok(dev->net) != link) { 643 link_changed = netif_carrier_ok(dev->net) != link;
642 if (link) { 644 if (link_changed) {
643 netif_carrier_on(dev->net); 645 data->link_counter++;
644 usbnet_defer_kevent(dev, EVENT_LINK_RESET); 646 /*
645 } else 647 track link state 20 times to guard against erroneous
646 netif_carrier_off(dev->net); 648 link state changes reported sometimes by the chip
647 netdev_dbg(dev->net, "Link Status is: %d\n", link); 649 */
648 } 650 if (data->link_counter > 20) {
651 data->link_counter = 0;
652 if (link) {
653 netif_carrier_on(dev->net);
654 usbnet_defer_kevent(dev, EVENT_LINK_RESET);
655 } else
656 netif_carrier_off(dev->net);
657 netdev_dbg(dev->net, "Link Status is: %d\n", link);
658 }
659 } else
660 data->link_counter = 0;
649} 661}
650 662
651static const struct driver_info moschip_info = { 663static const struct driver_info moschip_info = {
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index fc9f578a1e25..f9819d10b1f9 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1588,10 +1588,27 @@ int usbnet_resume (struct usb_interface *intf)
1588 tasklet_schedule (&dev->bh); 1588 tasklet_schedule (&dev->bh);
1589 } 1589 }
1590 } 1590 }
1591
1592 if (test_and_clear_bit(EVENT_DEVICE_REPORT_IDLE, &dev->flags))
1593 usb_autopm_get_interface_no_resume(intf);
1594
1591 return 0; 1595 return 0;
1592} 1596}
1593EXPORT_SYMBOL_GPL(usbnet_resume); 1597EXPORT_SYMBOL_GPL(usbnet_resume);
1594 1598
1599/*
1600 * Either a subdriver implements manage_power, then it is assumed to always
1601 * be ready to be suspended or it reports the readiness to be suspended
1602 * explicitly
1603 */
1604void usbnet_device_suggests_idle(struct usbnet *dev)
1605{
1606 if (!test_and_set_bit(EVENT_DEVICE_REPORT_IDLE, &dev->flags)) {
1607 dev->intf->needs_remote_wakeup = 1;
1608 usb_autopm_put_interface_async(dev->intf);
1609 }
1610}
1611EXPORT_SYMBOL(usbnet_device_suggests_idle);
1595 1612
1596/*-------------------------------------------------------------------------*/ 1613/*-------------------------------------------------------------------------*/
1597 1614
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 8be9bf07bd39..607976c00162 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -106,6 +106,8 @@ struct vxlan_dev {
106 __be32 gaddr; /* multicast group */ 106 __be32 gaddr; /* multicast group */
107 __be32 saddr; /* source address */ 107 __be32 saddr; /* source address */
108 unsigned int link; /* link to multicast over */ 108 unsigned int link; /* link to multicast over */
109 __u16 port_min; /* source port range */
110 __u16 port_max;
109 __u8 tos; /* TOS override */ 111 __u8 tos; /* TOS override */
110 __u8 ttl; 112 __u8 ttl;
111 bool learn; 113 bool learn;
@@ -228,9 +230,9 @@ static u32 eth_hash(const unsigned char *addr)
228 230
229 /* only want 6 bytes */ 231 /* only want 6 bytes */
230#ifdef __BIG_ENDIAN 232#ifdef __BIG_ENDIAN
231 value <<= 16;
232#else
233 value >>= 16; 233 value >>= 16;
234#else
235 value <<= 16;
234#endif 236#endif
235 return hash_64(value, FDB_HASH_BITS); 237 return hash_64(value, FDB_HASH_BITS);
236} 238}
@@ -535,7 +537,6 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
535 } 537 }
536 538
537 __skb_pull(skb, sizeof(struct vxlanhdr)); 539 __skb_pull(skb, sizeof(struct vxlanhdr));
538 skb_postpull_rcsum(skb, eth_hdr(skb), sizeof(struct vxlanhdr));
539 540
540 /* Is this VNI defined? */ 541 /* Is this VNI defined? */
541 vni = ntohl(vxh->vx_vni) >> 8; 542 vni = ntohl(vxh->vx_vni) >> 8;
@@ -554,7 +555,6 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
554 /* Re-examine inner Ethernet packet */ 555 /* Re-examine inner Ethernet packet */
555 oip = ip_hdr(skb); 556 oip = ip_hdr(skb);
556 skb->protocol = eth_type_trans(skb, vxlan->dev); 557 skb->protocol = eth_type_trans(skb, vxlan->dev);
557 skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
558 558
559 /* Ignore packet loops (and multicast echo) */ 559 /* Ignore packet loops (and multicast echo) */
560 if (compare_ether_addr(eth_hdr(skb)->h_source, 560 if (compare_ether_addr(eth_hdr(skb)->h_source,
@@ -566,6 +566,7 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
566 566
567 __skb_tunnel_rx(skb, vxlan->dev); 567 __skb_tunnel_rx(skb, vxlan->dev);
568 skb_reset_network_header(skb); 568 skb_reset_network_header(skb);
569 skb->ip_summed = CHECKSUM_NONE;
569 570
570 err = IP_ECN_decapsulate(oip, skb); 571 err = IP_ECN_decapsulate(oip, skb);
571 if (unlikely(err)) { 572 if (unlikely(err)) {
@@ -621,46 +622,89 @@ static inline u8 vxlan_ecn_encap(u8 tos,
621 return INET_ECN_encapsulate(tos, inner); 622 return INET_ECN_encapsulate(tos, inner);
622} 623}
623 624
625static __be32 vxlan_find_dst(struct vxlan_dev *vxlan, struct sk_buff *skb)
626{
627 const struct ethhdr *eth = (struct ethhdr *) skb->data;
628 const struct vxlan_fdb *f;
629
630 if (is_multicast_ether_addr(eth->h_dest))
631 return vxlan->gaddr;
632
633 f = vxlan_find_mac(vxlan, eth->h_dest);
634 if (f)
635 return f->remote_ip;
636 else
637 return vxlan->gaddr;
638
639}
640
641static void vxlan_sock_free(struct sk_buff *skb)
642{
643 sock_put(skb->sk);
644}
645
646/* On transmit, associate with the tunnel socket */
647static void vxlan_set_owner(struct net_device *dev, struct sk_buff *skb)
648{
649 struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
650 struct sock *sk = vn->sock->sk;
651
652 skb_orphan(skb);
653 sock_hold(sk);
654 skb->sk = sk;
655 skb->destructor = vxlan_sock_free;
656}
657
658/* Compute source port for outgoing packet
659 * first choice to use L4 flow hash since it will spread
660 * better and maybe available from hardware
661 * secondary choice is to use jhash on the Ethernet header
662 */
663static u16 vxlan_src_port(const struct vxlan_dev *vxlan, struct sk_buff *skb)
664{
665 unsigned int range = (vxlan->port_max - vxlan->port_min) + 1;
666 u32 hash;
667
668 hash = skb_get_rxhash(skb);
669 if (!hash)
670 hash = jhash(skb->data, 2 * ETH_ALEN,
671 (__force u32) skb->protocol);
672
673 return (((u64) hash * range) >> 32) + vxlan->port_min;
674}
675
624/* Transmit local packets over Vxlan 676/* Transmit local packets over Vxlan
625 * 677 *
626 * Outer IP header inherits ECN and DF from inner header. 678 * Outer IP header inherits ECN and DF from inner header.
627 * Outer UDP destination is the VXLAN assigned port. 679 * Outer UDP destination is the VXLAN assigned port.
628 * source port is based on hash of flow if available 680 * source port is based on hash of flow
629 * otherwise use a random value
630 */ 681 */
631static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) 682static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
632{ 683{
633 struct vxlan_dev *vxlan = netdev_priv(dev); 684 struct vxlan_dev *vxlan = netdev_priv(dev);
634 struct rtable *rt; 685 struct rtable *rt;
635 const struct ethhdr *eth;
636 const struct iphdr *old_iph; 686 const struct iphdr *old_iph;
637 struct iphdr *iph; 687 struct iphdr *iph;
638 struct vxlanhdr *vxh; 688 struct vxlanhdr *vxh;
639 struct udphdr *uh; 689 struct udphdr *uh;
640 struct flowi4 fl4; 690 struct flowi4 fl4;
641 struct vxlan_fdb *f;
642 unsigned int pkt_len = skb->len; 691 unsigned int pkt_len = skb->len;
643 u32 hash;
644 __be32 dst; 692 __be32 dst;
693 __u16 src_port;
645 __be16 df = 0; 694 __be16 df = 0;
646 __u8 tos, ttl; 695 __u8 tos, ttl;
647 int err; 696 int err;
648 697
698 dst = vxlan_find_dst(vxlan, skb);
699 if (!dst)
700 goto drop;
701
649 /* Need space for new headers (invalidates iph ptr) */ 702 /* Need space for new headers (invalidates iph ptr) */
650 if (skb_cow_head(skb, VXLAN_HEADROOM)) 703 if (skb_cow_head(skb, VXLAN_HEADROOM))
651 goto drop; 704 goto drop;
652 705
653 eth = (void *)skb->data;
654 old_iph = ip_hdr(skb); 706 old_iph = ip_hdr(skb);
655 707
656 if (!is_multicast_ether_addr(eth->h_dest) &&
657 (f = vxlan_find_mac(vxlan, eth->h_dest)))
658 dst = f->remote_ip;
659 else if (vxlan->gaddr) {
660 dst = vxlan->gaddr;
661 } else
662 goto drop;
663
664 ttl = vxlan->ttl; 708 ttl = vxlan->ttl;
665 if (!ttl && IN_MULTICAST(ntohl(dst))) 709 if (!ttl && IN_MULTICAST(ntohl(dst)))
666 ttl = 1; 710 ttl = 1;
@@ -669,11 +713,15 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
669 if (tos == 1) 713 if (tos == 1)
670 tos = vxlan_get_dsfield(old_iph, skb); 714 tos = vxlan_get_dsfield(old_iph, skb);
671 715
672 hash = skb_get_rxhash(skb); 716 src_port = vxlan_src_port(vxlan, skb);
717
718 memset(&fl4, 0, sizeof(fl4));
719 fl4.flowi4_oif = vxlan->link;
720 fl4.flowi4_tos = RT_TOS(tos);
721 fl4.daddr = dst;
722 fl4.saddr = vxlan->saddr;
673 723
674 rt = ip_route_output_gre(dev_net(dev), &fl4, dst, 724 rt = ip_route_output_key(dev_net(dev), &fl4);
675 vxlan->saddr, vxlan->vni,
676 RT_TOS(tos), vxlan->link);
677 if (IS_ERR(rt)) { 725 if (IS_ERR(rt)) {
678 netdev_dbg(dev, "no route to %pI4\n", &dst); 726 netdev_dbg(dev, "no route to %pI4\n", &dst);
679 dev->stats.tx_carrier_errors++; 727 dev->stats.tx_carrier_errors++;
@@ -702,7 +750,7 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
702 uh = udp_hdr(skb); 750 uh = udp_hdr(skb);
703 751
704 uh->dest = htons(vxlan_port); 752 uh->dest = htons(vxlan_port);
705 uh->source = hash ? :random32(); 753 uh->source = htons(src_port);
706 754
707 uh->len = htons(skb->len); 755 uh->len = htons(skb->len);
708 uh->check = 0; 756 uh->check = 0;
@@ -715,10 +763,12 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
715 iph->frag_off = df; 763 iph->frag_off = df;
716 iph->protocol = IPPROTO_UDP; 764 iph->protocol = IPPROTO_UDP;
717 iph->tos = vxlan_ecn_encap(tos, old_iph, skb); 765 iph->tos = vxlan_ecn_encap(tos, old_iph, skb);
718 iph->daddr = fl4.daddr; 766 iph->daddr = dst;
719 iph->saddr = fl4.saddr; 767 iph->saddr = fl4.saddr;
720 iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); 768 iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst);
721 769
770 vxlan_set_owner(dev, skb);
771
722 /* See __IPTUNNEL_XMIT */ 772 /* See __IPTUNNEL_XMIT */
723 skb->ip_summed = CHECKSUM_NONE; 773 skb->ip_summed = CHECKSUM_NONE;
724 ip_select_ident(iph, &rt->dst, NULL); 774 ip_select_ident(iph, &rt->dst, NULL);
@@ -928,9 +978,11 @@ static void vxlan_setup(struct net_device *dev)
928{ 978{
929 struct vxlan_dev *vxlan = netdev_priv(dev); 979 struct vxlan_dev *vxlan = netdev_priv(dev);
930 unsigned h; 980 unsigned h;
981 int low, high;
931 982
932 eth_hw_addr_random(dev); 983 eth_hw_addr_random(dev);
933 ether_setup(dev); 984 ether_setup(dev);
985 dev->hard_header_len = ETH_HLEN + VXLAN_HEADROOM;
934 986
935 dev->netdev_ops = &vxlan_netdev_ops; 987 dev->netdev_ops = &vxlan_netdev_ops;
936 dev->destructor = vxlan_free; 988 dev->destructor = vxlan_free;
@@ -947,6 +999,10 @@ static void vxlan_setup(struct net_device *dev)
947 vxlan->age_timer.function = vxlan_cleanup; 999 vxlan->age_timer.function = vxlan_cleanup;
948 vxlan->age_timer.data = (unsigned long) vxlan; 1000 vxlan->age_timer.data = (unsigned long) vxlan;
949 1001
1002 inet_get_local_port_range(&low, &high);
1003 vxlan->port_min = low;
1004 vxlan->port_max = high;
1005
950 vxlan->dev = dev; 1006 vxlan->dev = dev;
951 1007
952 for (h = 0; h < FDB_HASH_SIZE; ++h) 1008 for (h = 0; h < FDB_HASH_SIZE; ++h)
@@ -963,6 +1019,7 @@ static const struct nla_policy vxlan_policy[IFLA_VXLAN_MAX + 1] = {
963 [IFLA_VXLAN_LEARNING] = { .type = NLA_U8 }, 1019 [IFLA_VXLAN_LEARNING] = { .type = NLA_U8 },
964 [IFLA_VXLAN_AGEING] = { .type = NLA_U32 }, 1020 [IFLA_VXLAN_AGEING] = { .type = NLA_U32 },
965 [IFLA_VXLAN_LIMIT] = { .type = NLA_U32 }, 1021 [IFLA_VXLAN_LIMIT] = { .type = NLA_U32 },
1022 [IFLA_VXLAN_PORT_RANGE] = { .len = sizeof(struct ifla_vxlan_port_range) },
966}; 1023};
967 1024
968static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[]) 1025static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[])
@@ -995,6 +1052,18 @@ static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[])
995 return -EADDRNOTAVAIL; 1052 return -EADDRNOTAVAIL;
996 } 1053 }
997 } 1054 }
1055
1056 if (data[IFLA_VXLAN_PORT_RANGE]) {
1057 const struct ifla_vxlan_port_range *p
1058 = nla_data(data[IFLA_VXLAN_PORT_RANGE]);
1059
1060 if (ntohs(p->high) < ntohs(p->low)) {
1061 pr_debug("port range %u .. %u not valid\n",
1062 ntohs(p->low), ntohs(p->high));
1063 return -EINVAL;
1064 }
1065 }
1066
998 return 0; 1067 return 0;
999} 1068}
1000 1069
@@ -1021,14 +1090,18 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
1021 if (data[IFLA_VXLAN_LOCAL]) 1090 if (data[IFLA_VXLAN_LOCAL])
1022 vxlan->saddr = nla_get_be32(data[IFLA_VXLAN_LOCAL]); 1091 vxlan->saddr = nla_get_be32(data[IFLA_VXLAN_LOCAL]);
1023 1092
1024 if (data[IFLA_VXLAN_LINK]) { 1093 if (data[IFLA_VXLAN_LINK] &&
1025 vxlan->link = nla_get_u32(data[IFLA_VXLAN_LINK]); 1094 (vxlan->link = nla_get_u32(data[IFLA_VXLAN_LINK]))) {
1095 struct net_device *lowerdev
1096 = __dev_get_by_index(net, vxlan->link);
1026 1097
1027 if (!tb[IFLA_MTU]) { 1098 if (!lowerdev) {
1028 struct net_device *lowerdev; 1099 pr_info("ifindex %d does not exist\n", vxlan->link);
1029 lowerdev = __dev_get_by_index(net, vxlan->link); 1100 return -ENODEV;
1030 dev->mtu = lowerdev->mtu - VXLAN_HEADROOM;
1031 } 1101 }
1102
1103 if (!tb[IFLA_MTU])
1104 dev->mtu = lowerdev->mtu - VXLAN_HEADROOM;
1032 } 1105 }
1033 1106
1034 if (data[IFLA_VXLAN_TOS]) 1107 if (data[IFLA_VXLAN_TOS])
@@ -1045,6 +1118,13 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
1045 if (data[IFLA_VXLAN_LIMIT]) 1118 if (data[IFLA_VXLAN_LIMIT])
1046 vxlan->addrmax = nla_get_u32(data[IFLA_VXLAN_LIMIT]); 1119 vxlan->addrmax = nla_get_u32(data[IFLA_VXLAN_LIMIT]);
1047 1120
1121 if (data[IFLA_VXLAN_PORT_RANGE]) {
1122 const struct ifla_vxlan_port_range *p
1123 = nla_data(data[IFLA_VXLAN_PORT_RANGE]);
1124 vxlan->port_min = ntohs(p->low);
1125 vxlan->port_max = ntohs(p->high);
1126 }
1127
1048 err = register_netdevice(dev); 1128 err = register_netdevice(dev);
1049 if (!err) 1129 if (!err)
1050 hlist_add_head_rcu(&vxlan->hlist, vni_head(net, vxlan->vni)); 1130 hlist_add_head_rcu(&vxlan->hlist, vni_head(net, vxlan->vni));
@@ -1073,12 +1153,17 @@ static size_t vxlan_get_size(const struct net_device *dev)
1073 nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_LEARNING */ 1153 nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_LEARNING */
1074 nla_total_size(sizeof(__u32)) + /* IFLA_VXLAN_AGEING */ 1154 nla_total_size(sizeof(__u32)) + /* IFLA_VXLAN_AGEING */
1075 nla_total_size(sizeof(__u32)) + /* IFLA_VXLAN_LIMIT */ 1155 nla_total_size(sizeof(__u32)) + /* IFLA_VXLAN_LIMIT */
1156 nla_total_size(sizeof(struct ifla_vxlan_port_range)) +
1076 0; 1157 0;
1077} 1158}
1078 1159
1079static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev) 1160static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev)
1080{ 1161{
1081 const struct vxlan_dev *vxlan = netdev_priv(dev); 1162 const struct vxlan_dev *vxlan = netdev_priv(dev);
1163 struct ifla_vxlan_port_range ports = {
1164 .low = htons(vxlan->port_min),
1165 .high = htons(vxlan->port_max),
1166 };
1082 1167
1083 if (nla_put_u32(skb, IFLA_VXLAN_ID, vxlan->vni)) 1168 if (nla_put_u32(skb, IFLA_VXLAN_ID, vxlan->vni))
1084 goto nla_put_failure; 1169 goto nla_put_failure;
@@ -1099,6 +1184,9 @@ static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev)
1099 nla_put_u32(skb, IFLA_VXLAN_LIMIT, vxlan->addrmax)) 1184 nla_put_u32(skb, IFLA_VXLAN_LIMIT, vxlan->addrmax))
1100 goto nla_put_failure; 1185 goto nla_put_failure;
1101 1186
1187 if (nla_put(skb, IFLA_VXLAN_PORT_RANGE, sizeof(ports), &ports))
1188 goto nla_put_failure;
1189
1102 return 0; 1190 return 0;
1103 1191
1104nla_put_failure: 1192nla_put_failure:
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 9fd6d9a9942e..9f31cfa56cc0 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -1804,7 +1804,7 @@ ath5k_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1804{ 1804{
1805 int ret; 1805 int ret;
1806 struct ath5k_hw *ah = hw->priv; 1806 struct ath5k_hw *ah = hw->priv;
1807 struct ath5k_vif *avf = (void *)vif->drv_priv; 1807 struct ath5k_vif *avf;
1808 struct sk_buff *skb; 1808 struct sk_buff *skb;
1809 1809
1810 if (WARN_ON(!vif)) { 1810 if (WARN_ON(!vif)) {
@@ -1819,6 +1819,7 @@ ath5k_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1819 goto out; 1819 goto out;
1820 } 1820 }
1821 1821
1822 avf = (void *)vif->drv_priv;
1822 ath5k_txbuf_free_skb(ah, avf->bbuf); 1823 ath5k_txbuf_free_skb(ah, avf->bbuf);
1823 avf->bbuf->skb = skb; 1824 avf->bbuf->skb = skb;
1824 ret = ath5k_beacon_setup(ah, avf->bbuf); 1825 ret = ath5k_beacon_setup(ah, avf->bbuf);
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index 76f07d8c272d..1b48414dca95 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -120,7 +120,7 @@ static void ath9k_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb)
120 120
121 if (ath_tx_start(hw, skb, &txctl) != 0) { 121 if (ath_tx_start(hw, skb, &txctl) != 0) {
122 ath_dbg(common, XMIT, "CABQ TX failed\n"); 122 ath_dbg(common, XMIT, "CABQ TX failed\n");
123 dev_kfree_skb_any(skb); 123 ieee80211_free_txskb(hw, skb);
124 } 124 }
125} 125}
126 126
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index f9a6ec5cf470..8e1559aba495 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1450,9 +1450,14 @@ static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type)
1450 REG_WRITE(ah, AR_RTC_FORCE_WAKE, 1450 REG_WRITE(ah, AR_RTC_FORCE_WAKE,
1451 AR_RTC_FORCE_WAKE_EN | AR_RTC_FORCE_WAKE_ON_INT); 1451 AR_RTC_FORCE_WAKE_EN | AR_RTC_FORCE_WAKE_ON_INT);
1452 1452
1453 if (!ah->reset_power_on)
1454 type = ATH9K_RESET_POWER_ON;
1455
1453 switch (type) { 1456 switch (type) {
1454 case ATH9K_RESET_POWER_ON: 1457 case ATH9K_RESET_POWER_ON:
1455 ret = ath9k_hw_set_reset_power_on(ah); 1458 ret = ath9k_hw_set_reset_power_on(ah);
1459 if (!ret)
1460 ah->reset_power_on = true;
1456 break; 1461 break;
1457 case ATH9K_RESET_WARM: 1462 case ATH9K_RESET_WARM:
1458 case ATH9K_RESET_COLD: 1463 case ATH9K_RESET_COLD:
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 566a4ce4f156..dbc1b7a4cbfd 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -741,6 +741,7 @@ struct ath_hw {
741 u32 rfkill_polarity; 741 u32 rfkill_polarity;
742 u32 ah_flags; 742 u32 ah_flags;
743 743
744 bool reset_power_on;
744 bool htc_reset_init; 745 bool htc_reset_init;
745 746
746 enum nl80211_iftype opmode; 747 enum nl80211_iftype opmode;
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 31ab82e3ba85..dd45edfa6bae 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -639,8 +639,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
639 ath_err(common, 639 ath_err(common,
640 "Unable to reset hardware; reset status %d (freq %u MHz)\n", 640 "Unable to reset hardware; reset status %d (freq %u MHz)\n",
641 r, curchan->center_freq); 641 r, curchan->center_freq);
642 spin_unlock_bh(&sc->sc_pcu_lock); 642 ah->reset_power_on = false;
643 goto mutex_unlock;
644 } 643 }
645 644
646 /* Setup our intr mask. */ 645 /* Setup our intr mask. */
@@ -665,11 +664,8 @@ static int ath9k_start(struct ieee80211_hw *hw)
665 clear_bit(SC_OP_INVALID, &sc->sc_flags); 664 clear_bit(SC_OP_INVALID, &sc->sc_flags);
666 sc->sc_ah->is_monitoring = false; 665 sc->sc_ah->is_monitoring = false;
667 666
668 if (!ath_complete_reset(sc, false)) { 667 if (!ath_complete_reset(sc, false))
669 r = -EIO; 668 ah->reset_power_on = false;
670 spin_unlock_bh(&sc->sc_pcu_lock);
671 goto mutex_unlock;
672 }
673 669
674 if (ah->led_pin >= 0) { 670 if (ah->led_pin >= 0) {
675 ath9k_hw_cfg_output(ah, ah->led_pin, 671 ath9k_hw_cfg_output(ah, ah->led_pin,
@@ -688,12 +684,11 @@ static int ath9k_start(struct ieee80211_hw *hw)
688 if (ah->caps.pcie_lcr_extsync_en && common->bus_ops->extn_synch_en) 684 if (ah->caps.pcie_lcr_extsync_en && common->bus_ops->extn_synch_en)
689 common->bus_ops->extn_synch_en(common); 685 common->bus_ops->extn_synch_en(common);
690 686
691mutex_unlock:
692 mutex_unlock(&sc->mutex); 687 mutex_unlock(&sc->mutex);
693 688
694 ath9k_ps_restore(sc); 689 ath9k_ps_restore(sc);
695 690
696 return r; 691 return 0;
697} 692}
698 693
699static void ath9k_tx(struct ieee80211_hw *hw, 694static void ath9k_tx(struct ieee80211_hw *hw,
@@ -770,7 +765,7 @@ static void ath9k_tx(struct ieee80211_hw *hw,
770 765
771 return; 766 return;
772exit: 767exit:
773 dev_kfree_skb_any(skb); 768 ieee80211_free_txskb(hw, skb);
774} 769}
775 770
776static void ath9k_stop(struct ieee80211_hw *hw) 771static void ath9k_stop(struct ieee80211_hw *hw)
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index 0e630a99b68b..f088f4bf9a26 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -324,6 +324,10 @@ static int ath_pci_suspend(struct device *device)
324static int ath_pci_resume(struct device *device) 324static int ath_pci_resume(struct device *device)
325{ 325{
326 struct pci_dev *pdev = to_pci_dev(device); 326 struct pci_dev *pdev = to_pci_dev(device);
327 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
328 struct ath_softc *sc = hw->priv;
329 struct ath_hw *ah = sc->sc_ah;
330 struct ath_common *common = ath9k_hw_common(ah);
327 u32 val; 331 u32 val;
328 332
329 /* 333 /*
@@ -335,6 +339,9 @@ static int ath_pci_resume(struct device *device)
335 if ((val & 0x0000ff00) != 0) 339 if ((val & 0x0000ff00) != 0)
336 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); 340 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
337 341
342 ath_pci_aspm_init(common);
343 ah->reset_power_on = false;
344
338 return 0; 345 return 0;
339} 346}
340 347
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 36618e3a5e60..378bd70256b2 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -66,8 +66,7 @@ static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
66static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, 66static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
67 struct ath_txq *txq, 67 struct ath_txq *txq,
68 struct ath_atx_tid *tid, 68 struct ath_atx_tid *tid,
69 struct sk_buff *skb, 69 struct sk_buff *skb);
70 bool dequeue);
71 70
72enum { 71enum {
73 MCS_HT20, 72 MCS_HT20,
@@ -176,7 +175,15 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
176 fi = get_frame_info(skb); 175 fi = get_frame_info(skb);
177 bf = fi->bf; 176 bf = fi->bf;
178 177
179 if (bf && fi->retries) { 178 if (!bf) {
179 bf = ath_tx_setup_buffer(sc, txq, tid, skb);
180 if (!bf) {
181 ieee80211_free_txskb(sc->hw, skb);
182 continue;
183 }
184 }
185
186 if (fi->retries) {
180 list_add_tail(&bf->list, &bf_head); 187 list_add_tail(&bf->list, &bf_head);
181 ath_tx_update_baw(sc, tid, bf->bf_state.seqno); 188 ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
182 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); 189 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
@@ -785,10 +792,13 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
785 fi = get_frame_info(skb); 792 fi = get_frame_info(skb);
786 bf = fi->bf; 793 bf = fi->bf;
787 if (!fi->bf) 794 if (!fi->bf)
788 bf = ath_tx_setup_buffer(sc, txq, tid, skb, true); 795 bf = ath_tx_setup_buffer(sc, txq, tid, skb);
789 796
790 if (!bf) 797 if (!bf) {
798 __skb_unlink(skb, &tid->buf_q);
799 ieee80211_free_txskb(sc->hw, skb);
791 continue; 800 continue;
801 }
792 802
793 bf->bf_state.bf_type = BUF_AMPDU | BUF_AGGR; 803 bf->bf_state.bf_type = BUF_AMPDU | BUF_AGGR;
794 seqno = bf->bf_state.seqno; 804 seqno = bf->bf_state.seqno;
@@ -1731,9 +1741,11 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
1731 return; 1741 return;
1732 } 1742 }
1733 1743
1734 bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false); 1744 bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb);
1735 if (!bf) 1745 if (!bf) {
1746 ieee80211_free_txskb(sc->hw, skb);
1736 return; 1747 return;
1748 }
1737 1749
1738 bf->bf_state.bf_type = BUF_AMPDU; 1750 bf->bf_state.bf_type = BUF_AMPDU;
1739 INIT_LIST_HEAD(&bf_head); 1751 INIT_LIST_HEAD(&bf_head);
@@ -1757,11 +1769,6 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
1757 struct ath_buf *bf; 1769 struct ath_buf *bf;
1758 1770
1759 bf = fi->bf; 1771 bf = fi->bf;
1760 if (!bf)
1761 bf = ath_tx_setup_buffer(sc, txq, tid, skb, false);
1762
1763 if (!bf)
1764 return;
1765 1772
1766 INIT_LIST_HEAD(&bf_head); 1773 INIT_LIST_HEAD(&bf_head);
1767 list_add_tail(&bf->list, &bf_head); 1774 list_add_tail(&bf->list, &bf_head);
@@ -1839,8 +1846,7 @@ u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate)
1839static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, 1846static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
1840 struct ath_txq *txq, 1847 struct ath_txq *txq,
1841 struct ath_atx_tid *tid, 1848 struct ath_atx_tid *tid,
1842 struct sk_buff *skb, 1849 struct sk_buff *skb)
1843 bool dequeue)
1844{ 1850{
1845 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1851 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
1846 struct ath_frame_info *fi = get_frame_info(skb); 1852 struct ath_frame_info *fi = get_frame_info(skb);
@@ -1852,7 +1858,7 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
1852 bf = ath_tx_get_buffer(sc); 1858 bf = ath_tx_get_buffer(sc);
1853 if (!bf) { 1859 if (!bf) {
1854 ath_dbg(common, XMIT, "TX buffers are full\n"); 1860 ath_dbg(common, XMIT, "TX buffers are full\n");
1855 goto error; 1861 return NULL;
1856 } 1862 }
1857 1863
1858 ATH_TXBUF_RESET(bf); 1864 ATH_TXBUF_RESET(bf);
@@ -1881,18 +1887,12 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
1881 ath_err(ath9k_hw_common(sc->sc_ah), 1887 ath_err(ath9k_hw_common(sc->sc_ah),
1882 "dma_mapping_error() on TX\n"); 1888 "dma_mapping_error() on TX\n");
1883 ath_tx_return_buffer(sc, bf); 1889 ath_tx_return_buffer(sc, bf);
1884 goto error; 1890 return NULL;
1885 } 1891 }
1886 1892
1887 fi->bf = bf; 1893 fi->bf = bf;
1888 1894
1889 return bf; 1895 return bf;
1890
1891error:
1892 if (dequeue)
1893 __skb_unlink(skb, &tid->buf_q);
1894 dev_kfree_skb_any(skb);
1895 return NULL;
1896} 1896}
1897 1897
1898/* FIXME: tx power */ 1898/* FIXME: tx power */
@@ -1921,9 +1921,14 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct sk_buff *skb,
1921 */ 1921 */
1922 ath_tx_send_ampdu(sc, tid, skb, txctl); 1922 ath_tx_send_ampdu(sc, tid, skb, txctl);
1923 } else { 1923 } else {
1924 bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false); 1924 bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb);
1925 if (!bf) 1925 if (!bf) {
1926 if (txctl->paprd)
1927 dev_kfree_skb_any(skb);
1928 else
1929 ieee80211_free_txskb(sc->hw, skb);
1926 return; 1930 return;
1931 }
1927 1932
1928 bf->bf_state.bfs_paprd = txctl->paprd; 1933 bf->bf_state.bfs_paprd = txctl->paprd;
1929 1934
diff --git a/drivers/net/wireless/ath/carl9170/carl9170.h b/drivers/net/wireless/ath/carl9170/carl9170.h
index 2aa4a59c72c8..2df17f1e49ef 100644
--- a/drivers/net/wireless/ath/carl9170/carl9170.h
+++ b/drivers/net/wireless/ath/carl9170/carl9170.h
@@ -303,6 +303,7 @@ struct ar9170 {
303 unsigned long queue_stop_timeout[__AR9170_NUM_TXQ]; 303 unsigned long queue_stop_timeout[__AR9170_NUM_TXQ];
304 unsigned long max_queue_stop_timeout[__AR9170_NUM_TXQ]; 304 unsigned long max_queue_stop_timeout[__AR9170_NUM_TXQ];
305 bool needs_full_reset; 305 bool needs_full_reset;
306 bool force_usb_reset;
306 atomic_t pending_restarts; 307 atomic_t pending_restarts;
307 308
308 /* interface mode settings */ 309 /* interface mode settings */
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c
index 67997b39aba7..25a1e2f4f738 100644
--- a/drivers/net/wireless/ath/carl9170/main.c
+++ b/drivers/net/wireless/ath/carl9170/main.c
@@ -465,27 +465,26 @@ static void carl9170_restart_work(struct work_struct *work)
465{ 465{
466 struct ar9170 *ar = container_of(work, struct ar9170, 466 struct ar9170 *ar = container_of(work, struct ar9170,
467 restart_work); 467 restart_work);
468 int err; 468 int err = -EIO;
469 469
470 ar->usedkeys = 0; 470 ar->usedkeys = 0;
471 ar->filter_state = 0; 471 ar->filter_state = 0;
472 carl9170_cancel_worker(ar); 472 carl9170_cancel_worker(ar);
473 473
474 mutex_lock(&ar->mutex); 474 mutex_lock(&ar->mutex);
475 err = carl9170_usb_restart(ar); 475 if (!ar->force_usb_reset) {
476 if (net_ratelimit()) { 476 err = carl9170_usb_restart(ar);
477 if (err) { 477 if (net_ratelimit()) {
478 dev_err(&ar->udev->dev, "Failed to restart device " 478 if (err)
479 " (%d).\n", err); 479 dev_err(&ar->udev->dev, "Failed to restart device (%d).\n", err);
480 } else { 480 else
481 dev_info(&ar->udev->dev, "device restarted " 481 dev_info(&ar->udev->dev, "device restarted successfully.\n");
482 "successfully.\n");
483 } 482 }
484 } 483 }
485
486 carl9170_zap_queues(ar); 484 carl9170_zap_queues(ar);
487 mutex_unlock(&ar->mutex); 485 mutex_unlock(&ar->mutex);
488 if (!err) { 486
487 if (!err && !ar->force_usb_reset) {
489 ar->restart_counter++; 488 ar->restart_counter++;
490 atomic_set(&ar->pending_restarts, 0); 489 atomic_set(&ar->pending_restarts, 0);
491 490
@@ -526,10 +525,10 @@ void carl9170_restart(struct ar9170 *ar, const enum carl9170_restart_reasons r)
526 if (!ar->registered) 525 if (!ar->registered)
527 return; 526 return;
528 527
529 if (IS_ACCEPTING_CMD(ar) && !ar->needs_full_reset) 528 if (!IS_ACCEPTING_CMD(ar) || ar->needs_full_reset)
530 ieee80211_queue_work(ar->hw, &ar->restart_work); 529 ar->force_usb_reset = true;
531 else 530
532 carl9170_usb_reset(ar); 531 ieee80211_queue_work(ar->hw, &ar->restart_work);
533 532
534 /* 533 /*
535 * At this point, the device instance might have vanished/disabled. 534 * At this point, the device instance might have vanished/disabled.
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 2691620393ea..0679458a1bac 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1596,8 +1596,9 @@ done:
1596 } 1596 }
1597 } 1597 }
1598 1598
1599 if (mwifiex_bss_start(priv, bss, &req_ssid)) 1599 ret = mwifiex_bss_start(priv, bss, &req_ssid);
1600 return -EFAULT; 1600 if (ret)
1601 return ret;
1601 1602
1602 if (mode == NL80211_IFTYPE_ADHOC) { 1603 if (mode == NL80211_IFTYPE_ADHOC) {
1603 /* Inform the BSS information to kernel, otherwise 1604 /* Inform the BSS information to kernel, otherwise
@@ -1652,9 +1653,19 @@ done:
1652 "info: association to bssid %pM failed\n", 1653 "info: association to bssid %pM failed\n",
1653 priv->cfg_bssid); 1654 priv->cfg_bssid);
1654 memset(priv->cfg_bssid, 0, ETH_ALEN); 1655 memset(priv->cfg_bssid, 0, ETH_ALEN);
1656
1657 if (ret > 0)
1658 cfg80211_connect_result(priv->netdev, priv->cfg_bssid,
1659 NULL, 0, NULL, 0, ret,
1660 GFP_KERNEL);
1661 else
1662 cfg80211_connect_result(priv->netdev, priv->cfg_bssid,
1663 NULL, 0, NULL, 0,
1664 WLAN_STATUS_UNSPECIFIED_FAILURE,
1665 GFP_KERNEL);
1655 } 1666 }
1656 1667
1657 return ret; 1668 return 0;
1658} 1669}
1659 1670
1660/* 1671/*
@@ -1802,7 +1813,7 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
1802{ 1813{
1803 struct net_device *dev = request->wdev->netdev; 1814 struct net_device *dev = request->wdev->netdev;
1804 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); 1815 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
1805 int i, offset; 1816 int i, offset, ret;
1806 struct ieee80211_channel *chan; 1817 struct ieee80211_channel *chan;
1807 struct ieee_types_header *ie; 1818 struct ieee_types_header *ie;
1808 1819
@@ -1855,8 +1866,12 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
1855 1866
1856 priv->user_scan_cfg->chan_list[i].scan_time = 0; 1867 priv->user_scan_cfg->chan_list[i].scan_time = 0;
1857 } 1868 }
1858 if (mwifiex_scan_networks(priv, priv->user_scan_cfg)) 1869
1859 return -EFAULT; 1870 ret = mwifiex_scan_networks(priv, priv->user_scan_cfg);
1871 if (ret) {
1872 dev_err(priv->adapter->dev, "scan failed: %d\n", ret);
1873 return ret;
1874 }
1860 1875
1861 if (request->ie && request->ie_len) { 1876 if (request->ie && request->ie_len) {
1862 for (i = 0; i < MWIFIEX_MAX_VSIE_NUM; i++) { 1877 for (i = 0; i < MWIFIEX_MAX_VSIE_NUM; i++) {
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c
index 82e63cee1e97..7b0858af8f5d 100644
--- a/drivers/net/wireless/mwifiex/join.c
+++ b/drivers/net/wireless/mwifiex/join.c
@@ -1180,16 +1180,18 @@ int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv,
1180 struct mwifiex_adapter *adapter = priv->adapter; 1180 struct mwifiex_adapter *adapter = priv->adapter;
1181 struct host_cmd_ds_802_11_ad_hoc_result *adhoc_result; 1181 struct host_cmd_ds_802_11_ad_hoc_result *adhoc_result;
1182 struct mwifiex_bssdescriptor *bss_desc; 1182 struct mwifiex_bssdescriptor *bss_desc;
1183 u16 reason_code;
1183 1184
1184 adhoc_result = &resp->params.adhoc_result; 1185 adhoc_result = &resp->params.adhoc_result;
1185 1186
1186 bss_desc = priv->attempted_bss_desc; 1187 bss_desc = priv->attempted_bss_desc;
1187 1188
1188 /* Join result code 0 --> SUCCESS */ 1189 /* Join result code 0 --> SUCCESS */
1189 if (le16_to_cpu(resp->result)) { 1190 reason_code = le16_to_cpu(resp->result);
1191 if (reason_code) {
1190 dev_err(priv->adapter->dev, "ADHOC_RESP: failed\n"); 1192 dev_err(priv->adapter->dev, "ADHOC_RESP: failed\n");
1191 if (priv->media_connected) 1193 if (priv->media_connected)
1192 mwifiex_reset_connect_state(priv); 1194 mwifiex_reset_connect_state(priv, reason_code);
1193 1195
1194 memset(&priv->curr_bss_params.bss_descriptor, 1196 memset(&priv->curr_bss_params.bss_descriptor,
1195 0x00, sizeof(struct mwifiex_bssdescriptor)); 1197 0x00, sizeof(struct mwifiex_bssdescriptor));
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index bfb3fa69805c..c2d0ab146af5 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -847,7 +847,7 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv,
847 struct mwifiex_bssdescriptor *bss_desc); 847 struct mwifiex_bssdescriptor *bss_desc);
848int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, 848int mwifiex_ret_802_11_associate(struct mwifiex_private *priv,
849 struct host_cmd_ds_command *resp); 849 struct host_cmd_ds_command *resp);
850void mwifiex_reset_connect_state(struct mwifiex_private *priv); 850void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason);
851u8 mwifiex_band_to_radio_type(u8 band); 851u8 mwifiex_band_to_radio_type(u8 band);
852int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac); 852int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac);
853int mwifiex_adhoc_start(struct mwifiex_private *priv, 853int mwifiex_adhoc_start(struct mwifiex_private *priv,
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index e36a75988f87..00b658d3b6ec 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -1296,7 +1296,7 @@ mwifiex_radio_type_to_band(u8 radio_type)
1296int mwifiex_scan_networks(struct mwifiex_private *priv, 1296int mwifiex_scan_networks(struct mwifiex_private *priv,
1297 const struct mwifiex_user_scan_cfg *user_scan_in) 1297 const struct mwifiex_user_scan_cfg *user_scan_in)
1298{ 1298{
1299 int ret = 0; 1299 int ret;
1300 struct mwifiex_adapter *adapter = priv->adapter; 1300 struct mwifiex_adapter *adapter = priv->adapter;
1301 struct cmd_ctrl_node *cmd_node; 1301 struct cmd_ctrl_node *cmd_node;
1302 union mwifiex_scan_cmd_config_tlv *scan_cfg_out; 1302 union mwifiex_scan_cmd_config_tlv *scan_cfg_out;
@@ -1309,25 +1309,26 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
1309 unsigned long flags; 1309 unsigned long flags;
1310 1310
1311 if (adapter->scan_processing) { 1311 if (adapter->scan_processing) {
1312 dev_dbg(adapter->dev, "cmd: Scan already in process...\n"); 1312 dev_err(adapter->dev, "cmd: Scan already in process...\n");
1313 return ret; 1313 return -EBUSY;
1314 } 1314 }
1315 1315
1316 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
1317 adapter->scan_processing = true;
1318 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
1319
1320 if (priv->scan_block) { 1316 if (priv->scan_block) {
1321 dev_dbg(adapter->dev, 1317 dev_err(adapter->dev,
1322 "cmd: Scan is blocked during association...\n"); 1318 "cmd: Scan is blocked during association...\n");
1323 return ret; 1319 return -EBUSY;
1324 } 1320 }
1325 1321
1322 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
1323 adapter->scan_processing = true;
1324 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
1325
1326 scan_cfg_out = kzalloc(sizeof(union mwifiex_scan_cmd_config_tlv), 1326 scan_cfg_out = kzalloc(sizeof(union mwifiex_scan_cmd_config_tlv),
1327 GFP_KERNEL); 1327 GFP_KERNEL);
1328 if (!scan_cfg_out) { 1328 if (!scan_cfg_out) {
1329 dev_err(adapter->dev, "failed to alloc scan_cfg_out\n"); 1329 dev_err(adapter->dev, "failed to alloc scan_cfg_out\n");
1330 return -ENOMEM; 1330 ret = -ENOMEM;
1331 goto done;
1331 } 1332 }
1332 1333
1333 buf_size = sizeof(struct mwifiex_chan_scan_param_set) * 1334 buf_size = sizeof(struct mwifiex_chan_scan_param_set) *
@@ -1336,7 +1337,8 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
1336 if (!scan_chan_list) { 1337 if (!scan_chan_list) {
1337 dev_err(adapter->dev, "failed to alloc scan_chan_list\n"); 1338 dev_err(adapter->dev, "failed to alloc scan_chan_list\n");
1338 kfree(scan_cfg_out); 1339 kfree(scan_cfg_out);
1339 return -ENOMEM; 1340 ret = -ENOMEM;
1341 goto done;
1340 } 1342 }
1341 1343
1342 mwifiex_config_scan(priv, user_scan_in, &scan_cfg_out->config, 1344 mwifiex_config_scan(priv, user_scan_in, &scan_cfg_out->config,
@@ -1364,14 +1366,16 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
1364 spin_unlock_irqrestore(&adapter->scan_pending_q_lock, 1366 spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
1365 flags); 1367 flags);
1366 } 1368 }
1367 } else {
1368 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
1369 adapter->scan_processing = true;
1370 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
1371 } 1369 }
1372 1370
1373 kfree(scan_cfg_out); 1371 kfree(scan_cfg_out);
1374 kfree(scan_chan_list); 1372 kfree(scan_chan_list);
1373done:
1374 if (ret) {
1375 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
1376 adapter->scan_processing = false;
1377 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
1378 }
1375 return ret; 1379 return ret;
1376} 1380}
1377 1381
@@ -1430,8 +1434,8 @@ int mwifiex_check_network_compatibility(struct mwifiex_private *priv,
1430 ret = mwifiex_is_network_compatible(priv, bss_desc, 1434 ret = mwifiex_is_network_compatible(priv, bss_desc,
1431 priv->bss_mode); 1435 priv->bss_mode);
1432 if (ret) 1436 if (ret)
1433 dev_err(priv->adapter->dev, "cannot find ssid " 1437 dev_err(priv->adapter->dev,
1434 "%s\n", bss_desc->ssid.ssid); 1438 "Incompatible network settings\n");
1435 break; 1439 break;
1436 default: 1440 default:
1437 ret = 0; 1441 ret = 0;
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c
index e380171c4c5d..09e6a267f566 100644
--- a/drivers/net/wireless/mwifiex/sta_cmdresp.c
+++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c
@@ -545,7 +545,7 @@ static int mwifiex_ret_802_11_deauthenticate(struct mwifiex_private *priv,
545 if (!memcmp(resp->params.deauth.mac_addr, 545 if (!memcmp(resp->params.deauth.mac_addr,
546 &priv->curr_bss_params.bss_descriptor.mac_address, 546 &priv->curr_bss_params.bss_descriptor.mac_address,
547 sizeof(resp->params.deauth.mac_addr))) 547 sizeof(resp->params.deauth.mac_addr)))
548 mwifiex_reset_connect_state(priv); 548 mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING);
549 549
550 return 0; 550 return 0;
551} 551}
@@ -558,7 +558,7 @@ static int mwifiex_ret_802_11_deauthenticate(struct mwifiex_private *priv,
558static int mwifiex_ret_802_11_ad_hoc_stop(struct mwifiex_private *priv, 558static int mwifiex_ret_802_11_ad_hoc_stop(struct mwifiex_private *priv,
559 struct host_cmd_ds_command *resp) 559 struct host_cmd_ds_command *resp)
560{ 560{
561 mwifiex_reset_connect_state(priv); 561 mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING);
562 return 0; 562 return 0;
563} 563}
564 564
diff --git a/drivers/net/wireless/mwifiex/sta_event.c b/drivers/net/wireless/mwifiex/sta_event.c
index aafde30e714a..8132119e1a21 100644
--- a/drivers/net/wireless/mwifiex/sta_event.c
+++ b/drivers/net/wireless/mwifiex/sta_event.c
@@ -41,7 +41,7 @@
41 * - Sends a disconnect event to upper layers/applications. 41 * - Sends a disconnect event to upper layers/applications.
42 */ 42 */
43void 43void
44mwifiex_reset_connect_state(struct mwifiex_private *priv) 44mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code)
45{ 45{
46 struct mwifiex_adapter *adapter = priv->adapter; 46 struct mwifiex_adapter *adapter = priv->adapter;
47 47
@@ -117,10 +117,10 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv)
117 priv->media_connected = false; 117 priv->media_connected = false;
118 dev_dbg(adapter->dev, 118 dev_dbg(adapter->dev,
119 "info: successfully disconnected from %pM: reason code %d\n", 119 "info: successfully disconnected from %pM: reason code %d\n",
120 priv->cfg_bssid, WLAN_REASON_DEAUTH_LEAVING); 120 priv->cfg_bssid, reason_code);
121 if (priv->bss_mode == NL80211_IFTYPE_STATION) { 121 if (priv->bss_mode == NL80211_IFTYPE_STATION) {
122 cfg80211_disconnected(priv->netdev, WLAN_REASON_DEAUTH_LEAVING, 122 cfg80211_disconnected(priv->netdev, reason_code, NULL, 0,
123 NULL, 0, GFP_KERNEL); 123 GFP_KERNEL);
124 } 124 }
125 memset(priv->cfg_bssid, 0, ETH_ALEN); 125 memset(priv->cfg_bssid, 0, ETH_ALEN);
126 126
@@ -186,7 +186,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
186 struct mwifiex_adapter *adapter = priv->adapter; 186 struct mwifiex_adapter *adapter = priv->adapter;
187 int ret = 0; 187 int ret = 0;
188 u32 eventcause = adapter->event_cause; 188 u32 eventcause = adapter->event_cause;
189 u16 ctrl; 189 u16 ctrl, reason_code;
190 190
191 switch (eventcause) { 191 switch (eventcause) {
192 case EVENT_DUMMY_HOST_WAKEUP_SIGNAL: 192 case EVENT_DUMMY_HOST_WAKEUP_SIGNAL:
@@ -204,22 +204,31 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
204 case EVENT_DEAUTHENTICATED: 204 case EVENT_DEAUTHENTICATED:
205 dev_dbg(adapter->dev, "event: Deauthenticated\n"); 205 dev_dbg(adapter->dev, "event: Deauthenticated\n");
206 adapter->dbg.num_event_deauth++; 206 adapter->dbg.num_event_deauth++;
207 if (priv->media_connected) 207 if (priv->media_connected) {
208 mwifiex_reset_connect_state(priv); 208 reason_code =
209 le16_to_cpu(*(__le16 *)adapter->event_body);
210 mwifiex_reset_connect_state(priv, reason_code);
211 }
209 break; 212 break;
210 213
211 case EVENT_DISASSOCIATED: 214 case EVENT_DISASSOCIATED:
212 dev_dbg(adapter->dev, "event: Disassociated\n"); 215 dev_dbg(adapter->dev, "event: Disassociated\n");
213 adapter->dbg.num_event_disassoc++; 216 adapter->dbg.num_event_disassoc++;
214 if (priv->media_connected) 217 if (priv->media_connected) {
215 mwifiex_reset_connect_state(priv); 218 reason_code =
219 le16_to_cpu(*(__le16 *)adapter->event_body);
220 mwifiex_reset_connect_state(priv, reason_code);
221 }
216 break; 222 break;
217 223
218 case EVENT_LINK_LOST: 224 case EVENT_LINK_LOST:
219 dev_dbg(adapter->dev, "event: Link lost\n"); 225 dev_dbg(adapter->dev, "event: Link lost\n");
220 adapter->dbg.num_event_link_lost++; 226 adapter->dbg.num_event_link_lost++;
221 if (priv->media_connected) 227 if (priv->media_connected) {
222 mwifiex_reset_connect_state(priv); 228 reason_code =
229 le16_to_cpu(*(__le16 *)adapter->event_body);
230 mwifiex_reset_connect_state(priv, reason_code);
231 }
223 break; 232 break;
224 233
225 case EVENT_PS_SLEEP: 234 case EVENT_PS_SLEEP:
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 540c94f8505a..01dc8891070c 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -2252,9 +2252,9 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
2252 */ 2252 */
2253 if (rt2x00_rt(rt2x00dev, RT3352)) { 2253 if (rt2x00_rt(rt2x00dev, RT3352)) {
2254 rt2800_bbp_write(rt2x00dev, 27, 0x0); 2254 rt2800_bbp_write(rt2x00dev, 27, 0x0);
2255 rt2800_bbp_write(rt2x00dev, 62, 0x26 + rt2x00dev->lna_gain); 2255 rt2800_bbp_write(rt2x00dev, 66, 0x26 + rt2x00dev->lna_gain);
2256 rt2800_bbp_write(rt2x00dev, 27, 0x20); 2256 rt2800_bbp_write(rt2x00dev, 27, 0x20);
2257 rt2800_bbp_write(rt2x00dev, 62, 0x26 + rt2x00dev->lna_gain); 2257 rt2800_bbp_write(rt2x00dev, 66, 0x26 + rt2x00dev->lna_gain);
2258 } else { 2258 } else {
2259 rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); 2259 rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain);
2260 rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); 2260 rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 4ebfcf3d8a3b..f2d6b78d901d 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -335,21 +335,35 @@ unsigned int xen_netbk_count_skb_slots(struct xenvif *vif, struct sk_buff *skb)
335 335
336 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 336 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
337 unsigned long size = skb_frag_size(&skb_shinfo(skb)->frags[i]); 337 unsigned long size = skb_frag_size(&skb_shinfo(skb)->frags[i]);
338 unsigned long offset = skb_shinfo(skb)->frags[i].page_offset;
338 unsigned long bytes; 339 unsigned long bytes;
340
341 offset &= ~PAGE_MASK;
342
339 while (size > 0) { 343 while (size > 0) {
344 BUG_ON(offset >= PAGE_SIZE);
340 BUG_ON(copy_off > MAX_BUFFER_OFFSET); 345 BUG_ON(copy_off > MAX_BUFFER_OFFSET);
341 346
342 if (start_new_rx_buffer(copy_off, size, 0)) { 347 bytes = PAGE_SIZE - offset;
348
349 if (bytes > size)
350 bytes = size;
351
352 if (start_new_rx_buffer(copy_off, bytes, 0)) {
343 count++; 353 count++;
344 copy_off = 0; 354 copy_off = 0;
345 } 355 }
346 356
347 bytes = size;
348 if (copy_off + bytes > MAX_BUFFER_OFFSET) 357 if (copy_off + bytes > MAX_BUFFER_OFFSET)
349 bytes = MAX_BUFFER_OFFSET - copy_off; 358 bytes = MAX_BUFFER_OFFSET - copy_off;
350 359
351 copy_off += bytes; 360 copy_off += bytes;
361
362 offset += bytes;
352 size -= bytes; 363 size -= bytes;
364
365 if (offset == PAGE_SIZE)
366 offset = 0;
353 } 367 }
354 } 368 }
355 return count; 369 return count;
@@ -403,14 +417,24 @@ static void netbk_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb,
403 unsigned long bytes; 417 unsigned long bytes;
404 418
405 /* Data must not cross a page boundary. */ 419 /* Data must not cross a page boundary. */
406 BUG_ON(size + offset > PAGE_SIZE); 420 BUG_ON(size + offset > PAGE_SIZE<<compound_order(page));
407 421
408 meta = npo->meta + npo->meta_prod - 1; 422 meta = npo->meta + npo->meta_prod - 1;
409 423
424 /* Skip unused frames from start of page */
425 page += offset >> PAGE_SHIFT;
426 offset &= ~PAGE_MASK;
427
410 while (size > 0) { 428 while (size > 0) {
429 BUG_ON(offset >= PAGE_SIZE);
411 BUG_ON(npo->copy_off > MAX_BUFFER_OFFSET); 430 BUG_ON(npo->copy_off > MAX_BUFFER_OFFSET);
412 431
413 if (start_new_rx_buffer(npo->copy_off, size, *head)) { 432 bytes = PAGE_SIZE - offset;
433
434 if (bytes > size)
435 bytes = size;
436
437 if (start_new_rx_buffer(npo->copy_off, bytes, *head)) {
414 /* 438 /*
415 * Netfront requires there to be some data in the head 439 * Netfront requires there to be some data in the head
416 * buffer. 440 * buffer.
@@ -420,7 +444,6 @@ static void netbk_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb,
420 meta = get_next_rx_buffer(vif, npo); 444 meta = get_next_rx_buffer(vif, npo);
421 } 445 }
422 446
423 bytes = size;
424 if (npo->copy_off + bytes > MAX_BUFFER_OFFSET) 447 if (npo->copy_off + bytes > MAX_BUFFER_OFFSET)
425 bytes = MAX_BUFFER_OFFSET - npo->copy_off; 448 bytes = MAX_BUFFER_OFFSET - npo->copy_off;
426 449
@@ -453,6 +476,13 @@ static void netbk_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb,
453 offset += bytes; 476 offset += bytes;
454 size -= bytes; 477 size -= bytes;
455 478
479 /* Next frame */
480 if (offset == PAGE_SIZE && size) {
481 BUG_ON(!PageCompound(page));
482 page++;
483 offset = 0;
484 }
485
456 /* Leave a gap for the GSO descriptor. */ 486 /* Leave a gap for the GSO descriptor. */
457 if (*head && skb_shinfo(skb)->gso_size && !vif->gso_prefix) 487 if (*head && skb_shinfo(skb)->gso_size && !vif->gso_prefix)
458 vif->rx.req_cons++; 488 vif->rx.req_cons++;
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 36f2be4def2f..981f2132d128 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1551,6 +1551,9 @@ static const struct usb_device_id acm_ids[] = {
1551 Maybe we should define a new 1551 Maybe we should define a new
1552 quirk for this. */ 1552 quirk for this. */
1553 }, 1553 },
1554 { USB_DEVICE(0x0572, 0x1340), /* Conexant CX93010-2x UCMxx */
1555 .driver_info = NO_UNION_NORMAL,
1556 },
1554 { USB_DEVICE(0x1bbb, 0x0003), /* Alcatel OT-I650 */ 1557 { USB_DEVICE(0x1bbb, 0x0003), /* Alcatel OT-I650 */
1555 .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ 1558 .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
1556 }, 1559 },
diff --git a/include/linux/can/Kbuild b/include/linux/can/Kbuild
index c62b7f1728f9..e69de29bb2d1 100644
--- a/include/linux/can/Kbuild
+++ b/include/linux/can/Kbuild
@@ -1,5 +0,0 @@
1header-y += raw.h
2header-y += bcm.h
3header-y += gw.h
4header-y += error.h
5header-y += netlink.h
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index e4dad4ddf085..3265f332998a 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -284,10 +284,16 @@ enum {
284 IFLA_VXLAN_LEARNING, 284 IFLA_VXLAN_LEARNING,
285 IFLA_VXLAN_AGEING, 285 IFLA_VXLAN_AGEING,
286 IFLA_VXLAN_LIMIT, 286 IFLA_VXLAN_LIMIT,
287 IFLA_VXLAN_PORT_RANGE,
287 __IFLA_VXLAN_MAX 288 __IFLA_VXLAN_MAX
288}; 289};
289#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1) 290#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
290 291
292struct ifla_vxlan_port_range {
293 __be16 low;
294 __be16 high;
295};
296
291/* SR-IOV virtual function management section */ 297/* SR-IOV virtual function management section */
292 298
293enum { 299enum {
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
index 6ef49b803efb..8163107b94b4 100644
--- a/include/linux/of_mdio.h
+++ b/include/linux/of_mdio.h
@@ -26,32 +26,32 @@ extern struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
26extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); 26extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
27 27
28#else /* CONFIG_OF */ 28#else /* CONFIG_OF */
29int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) 29static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
30{ 30{
31 return -ENOSYS; 31 return -ENOSYS;
32} 32}
33 33
34struct phy_device *of_phy_find_device(struct device_node *phy_np) 34static inline struct phy_device *of_phy_find_device(struct device_node *phy_np)
35{ 35{
36 return NULL; 36 return NULL;
37} 37}
38 38
39struct phy_device *of_phy_connect(struct net_device *dev, 39static inline struct phy_device *of_phy_connect(struct net_device *dev,
40 struct device_node *phy_np, 40 struct device_node *phy_np,
41 void (*hndlr)(struct net_device *), 41 void (*hndlr)(struct net_device *),
42 u32 flags, phy_interface_t iface) 42 u32 flags, phy_interface_t iface)
43{ 43{
44 return NULL; 44 return NULL;
45} 45}
46 46
47struct phy_device *of_phy_connect_fixed_link(struct net_device *dev, 47static inline struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
48 void (*hndlr)(struct net_device *), 48 void (*hndlr)(struct net_device *),
49 phy_interface_t iface) 49 phy_interface_t iface)
50{ 50{
51 return NULL; 51 return NULL;
52} 52}
53 53
54struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np) 54static inline struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np)
55{ 55{
56 return NULL; 56 return NULL;
57} 57}
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index f87cf622317f..ddbbb7de894b 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -68,6 +68,7 @@ struct usbnet {
68# define EVENT_RX_PAUSED 5 68# define EVENT_RX_PAUSED 5
69# define EVENT_DEV_ASLEEP 6 69# define EVENT_DEV_ASLEEP 6
70# define EVENT_DEV_OPEN 7 70# define EVENT_DEV_OPEN 7
71# define EVENT_DEVICE_REPORT_IDLE 8
71}; 72};
72 73
73static inline struct usb_driver *driver_of(struct usb_interface *intf) 74static inline struct usb_driver *driver_of(struct usb_interface *intf)
@@ -160,6 +161,7 @@ extern int usbnet_probe(struct usb_interface *, const struct usb_device_id *);
160extern int usbnet_suspend(struct usb_interface *, pm_message_t); 161extern int usbnet_suspend(struct usb_interface *, pm_message_t);
161extern int usbnet_resume(struct usb_interface *); 162extern int usbnet_resume(struct usb_interface *);
162extern void usbnet_disconnect(struct usb_interface *); 163extern void usbnet_disconnect(struct usb_interface *);
164extern void usbnet_device_suggests_idle(struct usbnet *dev);
163 165
164 166
165/* Drivers that reuse some of the standard USB CDC infrastructure 167/* Drivers that reuse some of the standard USB CDC infrastructure
diff --git a/include/linux/wimax/Kbuild b/include/linux/wimax/Kbuild
index 3cb4f269bb09..e69de29bb2d1 100644
--- a/include/linux/wimax/Kbuild
+++ b/include/linux/wimax/Kbuild
@@ -1 +0,0 @@
1header-y += i2400m.h
diff --git a/include/uapi/linux/can/Kbuild b/include/uapi/linux/can/Kbuild
index aafaa5aa54d4..21c91bf25a29 100644
--- a/include/uapi/linux/can/Kbuild
+++ b/include/uapi/linux/can/Kbuild
@@ -1 +1,6 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += bcm.h
3header-y += error.h
4header-y += gw.h
5header-y += netlink.h
6header-y += raw.h
diff --git a/include/linux/can/bcm.h b/include/uapi/linux/can/bcm.h
index 3ebe387fea4d..3ebe387fea4d 100644
--- a/include/linux/can/bcm.h
+++ b/include/uapi/linux/can/bcm.h
diff --git a/include/linux/can/error.h b/include/uapi/linux/can/error.h
index 7b7148bded71..7b7148bded71 100644
--- a/include/linux/can/error.h
+++ b/include/uapi/linux/can/error.h
diff --git a/include/linux/can/gw.h b/include/uapi/linux/can/gw.h
index 8e1db18c3cb6..8e1db18c3cb6 100644
--- a/include/linux/can/gw.h
+++ b/include/uapi/linux/can/gw.h
diff --git a/include/linux/can/netlink.h b/include/uapi/linux/can/netlink.h
index 14966ddb7df1..14966ddb7df1 100644
--- a/include/linux/can/netlink.h
+++ b/include/uapi/linux/can/netlink.h
diff --git a/include/linux/can/raw.h b/include/uapi/linux/can/raw.h
index a814062b0719..a814062b0719 100644
--- a/include/linux/can/raw.h
+++ b/include/uapi/linux/can/raw.h
diff --git a/include/uapi/linux/wimax/Kbuild b/include/uapi/linux/wimax/Kbuild
index aafaa5aa54d4..1c97be49971f 100644
--- a/include/uapi/linux/wimax/Kbuild
+++ b/include/uapi/linux/wimax/Kbuild
@@ -1 +1,2 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += i2400m.h
diff --git a/include/linux/wimax/i2400m.h b/include/uapi/linux/wimax/i2400m.h
index 62d356153565..62d356153565 100644
--- a/include/linux/wimax/i2400m.h
+++ b/include/uapi/linux/wimax/i2400m.h
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 68e8f364bbf8..fe43bc7b063f 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -265,6 +265,9 @@ static int br_parse_ip_options(struct sk_buff *skb)
265 struct net_device *dev = skb->dev; 265 struct net_device *dev = skb->dev;
266 u32 len; 266 u32 len;
267 267
268 if (!pskb_may_pull(skb, sizeof(struct iphdr)))
269 goto inhdr_error;
270
268 iph = ip_hdr(skb); 271 iph = ip_hdr(skb);
269 opt = &(IPCB(skb)->opt); 272 opt = &(IPCB(skb)->opt);
270 273
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 148e73d2c451..d1dc14c2aac4 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -248,8 +248,8 @@ struct pktgen_dev {
248 int removal_mark; /* non-zero => the device is marked for 248 int removal_mark; /* non-zero => the device is marked for
249 * removal by worker thread */ 249 * removal by worker thread */
250 250
251 int min_pkt_size; /* = ETH_ZLEN; */ 251 int min_pkt_size;
252 int max_pkt_size; /* = ETH_ZLEN; */ 252 int max_pkt_size;
253 int pkt_overhead; /* overhead for MPLS, VLANs, IPSEC etc */ 253 int pkt_overhead; /* overhead for MPLS, VLANs, IPSEC etc */
254 int nfrags; 254 int nfrags;
255 struct page *page; 255 struct page *page;
@@ -449,8 +449,6 @@ static void pktgen_stop_all_threads_ifs(void);
449static void pktgen_stop(struct pktgen_thread *t); 449static void pktgen_stop(struct pktgen_thread *t);
450static void pktgen_clear_counters(struct pktgen_dev *pkt_dev); 450static void pktgen_clear_counters(struct pktgen_dev *pkt_dev);
451 451
452static unsigned int scan_ip6(const char *s, char ip[16]);
453
454/* Module parameters, defaults. */ 452/* Module parameters, defaults. */
455static int pg_count_d __read_mostly = 1000; 453static int pg_count_d __read_mostly = 1000;
456static int pg_delay_d __read_mostly; 454static int pg_delay_d __read_mostly;
@@ -702,8 +700,8 @@ static int pktgen_if_show(struct seq_file *seq, void *v)
702 &pkt_dev->cur_in6_saddr, 700 &pkt_dev->cur_in6_saddr,
703 &pkt_dev->cur_in6_daddr); 701 &pkt_dev->cur_in6_daddr);
704 } else 702 } else
705 seq_printf(seq, " cur_saddr: 0x%x cur_daddr: 0x%x\n", 703 seq_printf(seq, " cur_saddr: %pI4 cur_daddr: %pI4\n",
706 pkt_dev->cur_saddr, pkt_dev->cur_daddr); 704 &pkt_dev->cur_saddr, &pkt_dev->cur_daddr);
707 705
708 seq_printf(seq, " cur_udp_dst: %d cur_udp_src: %d\n", 706 seq_printf(seq, " cur_udp_dst: %d cur_udp_src: %d\n",
709 pkt_dev->cur_udp_dst, pkt_dev->cur_udp_src); 707 pkt_dev->cur_udp_dst, pkt_dev->cur_udp_src);
@@ -1299,7 +1297,7 @@ static ssize_t pktgen_if_write(struct file *file,
1299 return -EFAULT; 1297 return -EFAULT;
1300 buf[len] = 0; 1298 buf[len] = 0;
1301 1299
1302 scan_ip6(buf, pkt_dev->in6_daddr.s6_addr); 1300 in6_pton(buf, -1, pkt_dev->in6_daddr.s6_addr, -1, NULL);
1303 snprintf(buf, sizeof(buf), "%pI6c", &pkt_dev->in6_daddr); 1301 snprintf(buf, sizeof(buf), "%pI6c", &pkt_dev->in6_daddr);
1304 1302
1305 pkt_dev->cur_in6_daddr = pkt_dev->in6_daddr; 1303 pkt_dev->cur_in6_daddr = pkt_dev->in6_daddr;
@@ -1322,7 +1320,7 @@ static ssize_t pktgen_if_write(struct file *file,
1322 return -EFAULT; 1320 return -EFAULT;
1323 buf[len] = 0; 1321 buf[len] = 0;
1324 1322
1325 scan_ip6(buf, pkt_dev->min_in6_daddr.s6_addr); 1323 in6_pton(buf, -1, pkt_dev->min_in6_daddr.s6_addr, -1, NULL);
1326 snprintf(buf, sizeof(buf), "%pI6c", &pkt_dev->min_in6_daddr); 1324 snprintf(buf, sizeof(buf), "%pI6c", &pkt_dev->min_in6_daddr);
1327 1325
1328 pkt_dev->cur_in6_daddr = pkt_dev->min_in6_daddr; 1326 pkt_dev->cur_in6_daddr = pkt_dev->min_in6_daddr;
@@ -1344,7 +1342,7 @@ static ssize_t pktgen_if_write(struct file *file,
1344 return -EFAULT; 1342 return -EFAULT;
1345 buf[len] = 0; 1343 buf[len] = 0;
1346 1344
1347 scan_ip6(buf, pkt_dev->max_in6_daddr.s6_addr); 1345 in6_pton(buf, -1, pkt_dev->max_in6_daddr.s6_addr, -1, NULL);
1348 snprintf(buf, sizeof(buf), "%pI6c", &pkt_dev->max_in6_daddr); 1346 snprintf(buf, sizeof(buf), "%pI6c", &pkt_dev->max_in6_daddr);
1349 1347
1350 if (debug) 1348 if (debug)
@@ -1365,7 +1363,7 @@ static ssize_t pktgen_if_write(struct file *file,
1365 return -EFAULT; 1363 return -EFAULT;
1366 buf[len] = 0; 1364 buf[len] = 0;
1367 1365
1368 scan_ip6(buf, pkt_dev->in6_saddr.s6_addr); 1366 in6_pton(buf, -1, pkt_dev->in6_saddr.s6_addr, -1, NULL);
1369 snprintf(buf, sizeof(buf), "%pI6c", &pkt_dev->in6_saddr); 1367 snprintf(buf, sizeof(buf), "%pI6c", &pkt_dev->in6_saddr);
1370 1368
1371 pkt_dev->cur_in6_saddr = pkt_dev->in6_saddr; 1369 pkt_dev->cur_in6_saddr = pkt_dev->in6_saddr;
@@ -2036,19 +2034,17 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
2036 /* Set up Dest MAC */ 2034 /* Set up Dest MAC */
2037 memcpy(&(pkt_dev->hh[0]), pkt_dev->dst_mac, ETH_ALEN); 2035 memcpy(&(pkt_dev->hh[0]), pkt_dev->dst_mac, ETH_ALEN);
2038 2036
2039 /* Set up pkt size */
2040 pkt_dev->cur_pkt_size = pkt_dev->min_pkt_size;
2041
2042 if (pkt_dev->flags & F_IPV6) { 2037 if (pkt_dev->flags & F_IPV6) {
2043 /*
2044 * Skip this automatic address setting until locks or functions
2045 * gets exported
2046 */
2047
2048#ifdef NOTNOW
2049 int i, set = 0, err = 1; 2038 int i, set = 0, err = 1;
2050 struct inet6_dev *idev; 2039 struct inet6_dev *idev;
2051 2040
2041 if (pkt_dev->min_pkt_size == 0) {
2042 pkt_dev->min_pkt_size = 14 + sizeof(struct ipv6hdr)
2043 + sizeof(struct udphdr)
2044 + sizeof(struct pktgen_hdr)
2045 + pkt_dev->pkt_overhead;
2046 }
2047
2052 for (i = 0; i < IN6_ADDR_HSIZE; i++) 2048 for (i = 0; i < IN6_ADDR_HSIZE; i++)
2053 if (pkt_dev->cur_in6_saddr.s6_addr[i]) { 2049 if (pkt_dev->cur_in6_saddr.s6_addr[i]) {
2054 set = 1; 2050 set = 1;
@@ -2069,9 +2065,8 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
2069 struct inet6_ifaddr *ifp; 2065 struct inet6_ifaddr *ifp;
2070 2066
2071 read_lock_bh(&idev->lock); 2067 read_lock_bh(&idev->lock);
2072 for (ifp = idev->addr_list; ifp; 2068 list_for_each_entry(ifp, &idev->addr_list, if_list) {
2073 ifp = ifp->if_next) { 2069 if ((ifp->scope & IFA_LINK) &&
2074 if (ifp->scope == IFA_LINK &&
2075 !(ifp->flags & IFA_F_TENTATIVE)) { 2070 !(ifp->flags & IFA_F_TENTATIVE)) {
2076 pkt_dev->cur_in6_saddr = ifp->addr; 2071 pkt_dev->cur_in6_saddr = ifp->addr;
2077 err = 0; 2072 err = 0;
@@ -2084,8 +2079,14 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
2084 if (err) 2079 if (err)
2085 pr_err("ERROR: IPv6 link address not available\n"); 2080 pr_err("ERROR: IPv6 link address not available\n");
2086 } 2081 }
2087#endif
2088 } else { 2082 } else {
2083 if (pkt_dev->min_pkt_size == 0) {
2084 pkt_dev->min_pkt_size = 14 + sizeof(struct iphdr)
2085 + sizeof(struct udphdr)
2086 + sizeof(struct pktgen_hdr)
2087 + pkt_dev->pkt_overhead;
2088 }
2089
2089 pkt_dev->saddr_min = 0; 2090 pkt_dev->saddr_min = 0;
2090 pkt_dev->saddr_max = 0; 2091 pkt_dev->saddr_max = 0;
2091 if (strlen(pkt_dev->src_min) == 0) { 2092 if (strlen(pkt_dev->src_min) == 0) {
@@ -2111,6 +2112,10 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
2111 pkt_dev->daddr_max = in_aton(pkt_dev->dst_max); 2112 pkt_dev->daddr_max = in_aton(pkt_dev->dst_max);
2112 } 2113 }
2113 /* Initialize current values. */ 2114 /* Initialize current values. */
2115 pkt_dev->cur_pkt_size = pkt_dev->min_pkt_size;
2116 if (pkt_dev->min_pkt_size > pkt_dev->max_pkt_size)
2117 pkt_dev->max_pkt_size = pkt_dev->min_pkt_size;
2118
2114 pkt_dev->cur_dst_mac_offset = 0; 2119 pkt_dev->cur_dst_mac_offset = 0;
2115 pkt_dev->cur_src_mac_offset = 0; 2120 pkt_dev->cur_src_mac_offset = 0;
2116 pkt_dev->cur_saddr = pkt_dev->saddr_min; 2121 pkt_dev->cur_saddr = pkt_dev->saddr_min;
@@ -2758,97 +2763,6 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
2758 return skb; 2763 return skb;
2759} 2764}
2760 2765
2761/*
2762 * scan_ip6, fmt_ip taken from dietlibc-0.21
2763 * Author Felix von Leitner <felix-dietlibc@fefe.de>
2764 *
2765 * Slightly modified for kernel.
2766 * Should be candidate for net/ipv4/utils.c
2767 * --ro
2768 */
2769
2770static unsigned int scan_ip6(const char *s, char ip[16])
2771{
2772 unsigned int i;
2773 unsigned int len = 0;
2774 unsigned long u;
2775 char suffix[16];
2776 unsigned int prefixlen = 0;
2777 unsigned int suffixlen = 0;
2778 __be32 tmp;
2779 char *pos;
2780
2781 for (i = 0; i < 16; i++)
2782 ip[i] = 0;
2783
2784 for (;;) {
2785 if (*s == ':') {
2786 len++;
2787 if (s[1] == ':') { /* Found "::", skip to part 2 */
2788 s += 2;
2789 len++;
2790 break;
2791 }
2792 s++;
2793 }
2794
2795 u = simple_strtoul(s, &pos, 16);
2796 i = pos - s;
2797 if (!i)
2798 return 0;
2799 if (prefixlen == 12 && s[i] == '.') {
2800
2801 /* the last 4 bytes may be written as IPv4 address */
2802
2803 tmp = in_aton(s);
2804 memcpy((struct in_addr *)(ip + 12), &tmp, sizeof(tmp));
2805 return i + len;
2806 }
2807 ip[prefixlen++] = (u >> 8);
2808 ip[prefixlen++] = (u & 255);
2809 s += i;
2810 len += i;
2811 if (prefixlen == 16)
2812 return len;
2813 }
2814
2815/* part 2, after "::" */
2816 for (;;) {
2817 if (*s == ':') {
2818 if (suffixlen == 0)
2819 break;
2820 s++;
2821 len++;
2822 } else if (suffixlen != 0)
2823 break;
2824
2825 u = simple_strtol(s, &pos, 16);
2826 i = pos - s;
2827 if (!i) {
2828 if (*s)
2829 len--;
2830 break;
2831 }
2832 if (suffixlen + prefixlen <= 12 && s[i] == '.') {
2833 tmp = in_aton(s);
2834 memcpy((struct in_addr *)(suffix + suffixlen), &tmp,
2835 sizeof(tmp));
2836 suffixlen += 4;
2837 len += strlen(s);
2838 break;
2839 }
2840 suffix[suffixlen++] = (u >> 8);
2841 suffix[suffixlen++] = (u & 255);
2842 s += i;
2843 len += i;
2844 if (prefixlen + suffixlen == 16)
2845 break;
2846 }
2847 for (i = 0; i < suffixlen; i++)
2848 ip[16 - suffixlen + i] = suffix[i];
2849 return len;
2850}
2851
2852static struct sk_buff *fill_packet_ipv6(struct net_device *odev, 2766static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
2853 struct pktgen_dev *pkt_dev) 2767 struct pktgen_dev *pkt_dev)
2854{ 2768{
@@ -2927,7 +2841,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
2927 sizeof(struct ipv6hdr) - sizeof(struct udphdr) - 2841 sizeof(struct ipv6hdr) - sizeof(struct udphdr) -
2928 pkt_dev->pkt_overhead; 2842 pkt_dev->pkt_overhead;
2929 2843
2930 if (datalen < sizeof(struct pktgen_hdr)) { 2844 if (datalen < 0 || datalen < sizeof(struct pktgen_hdr)) {
2931 datalen = sizeof(struct pktgen_hdr); 2845 datalen = sizeof(struct pktgen_hdr);
2932 net_info_ratelimited("increased datalen to %d\n", datalen); 2846 net_info_ratelimited("increased datalen to %d\n", datalen);
2933 } 2847 }
@@ -3548,8 +3462,6 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
3548 } 3462 }
3549 3463
3550 pkt_dev->removal_mark = 0; 3464 pkt_dev->removal_mark = 0;
3551 pkt_dev->min_pkt_size = ETH_ZLEN;
3552 pkt_dev->max_pkt_size = ETH_ZLEN;
3553 pkt_dev->nfrags = 0; 3465 pkt_dev->nfrags = 0;
3554 pkt_dev->delay = pg_delay_d; 3466 pkt_dev->delay = pg_delay_d;
3555 pkt_dev->count = pg_count_d; 3467 pkt_dev->count = pg_count_d;
diff --git a/net/core/utils.c b/net/core/utils.c
index f5613d569c23..e3487e461939 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -107,6 +107,18 @@ static inline int xdigit2bin(char c, int delim)
107 return IN6PTON_UNKNOWN; 107 return IN6PTON_UNKNOWN;
108} 108}
109 109
110/**
111 * in4_pton - convert an IPv4 address from literal to binary representation
112 * @src: the start of the IPv4 address string
113 * @srclen: the length of the string, -1 means strlen(src)
114 * @dst: the binary (u8[4] array) representation of the IPv4 address
115 * @delim: the delimiter of the IPv4 address in @src, -1 means no delimiter
116 * @end: A pointer to the end of the parsed string will be placed here
117 *
118 * Return one on success, return zero when any error occurs
119 * and @end will point to the end of the parsed string.
120 *
121 */
110int in4_pton(const char *src, int srclen, 122int in4_pton(const char *src, int srclen,
111 u8 *dst, 123 u8 *dst,
112 int delim, const char **end) 124 int delim, const char **end)
@@ -161,6 +173,18 @@ out:
161} 173}
162EXPORT_SYMBOL(in4_pton); 174EXPORT_SYMBOL(in4_pton);
163 175
176/**
177 * in6_pton - convert an IPv6 address from literal to binary representation
178 * @src: the start of the IPv6 address string
179 * @srclen: the length of the string, -1 means strlen(src)
180 * @dst: the binary (u8[16] array) representation of the IPv6 address
181 * @delim: the delimiter of the IPv6 address in @src, -1 means no delimiter
182 * @end: A pointer to the end of the parsed string will be placed here
183 *
184 * Return one on success, return zero when any error occurs
185 * and @end will point to the end of the parsed string.
186 *
187 */
164int in6_pton(const char *src, int srclen, 188int in6_pton(const char *src, int srclen,
165 u8 *dst, 189 u8 *dst,
166 int delim, const char **end) 190 int delim, const char **end)
diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
index 978bca4818ae..1831092f999f 100644
--- a/net/ipv4/ip_vti.c
+++ b/net/ipv4/ip_vti.c
@@ -374,7 +374,7 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
374 374
375 memset(&fl4, 0, sizeof(fl4)); 375 memset(&fl4, 0, sizeof(fl4));
376 flowi4_init_output(&fl4, tunnel->parms.link, 376 flowi4_init_output(&fl4, tunnel->parms.link,
377 htonl(tunnel->parms.i_key), RT_TOS(tos), 377 be32_to_cpu(tunnel->parms.i_key), RT_TOS(tos),
378 RT_SCOPE_UNIVERSE, 378 RT_SCOPE_UNIVERSE,
379 IPPROTO_IPIP, 0, 379 IPPROTO_IPIP, 0,
380 dst, tiph->saddr, 0, 0); 380 dst, tiph->saddr, 0, 0);
@@ -441,7 +441,7 @@ static int vti_tunnel_bind_dev(struct net_device *dev)
441 struct flowi4 fl4; 441 struct flowi4 fl4;
442 memset(&fl4, 0, sizeof(fl4)); 442 memset(&fl4, 0, sizeof(fl4));
443 flowi4_init_output(&fl4, tunnel->parms.link, 443 flowi4_init_output(&fl4, tunnel->parms.link,
444 htonl(tunnel->parms.i_key), 444 be32_to_cpu(tunnel->parms.i_key),
445 RT_TOS(iph->tos), RT_SCOPE_UNIVERSE, 445 RT_TOS(iph->tos), RT_SCOPE_UNIVERSE,
446 IPPROTO_IPIP, 0, 446 IPPROTO_IPIP, 0,
447 iph->daddr, iph->saddr, 0, 0); 447 iph->daddr, iph->saddr, 0, 0);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 1a0da8dc8180..432f4bb77238 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2220,7 +2220,7 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src,
2220 goto nla_put_failure; 2220 goto nla_put_failure;
2221 2221
2222 if (fl4->flowi4_mark && 2222 if (fl4->flowi4_mark &&
2223 nla_put_be32(skb, RTA_MARK, fl4->flowi4_mark)) 2223 nla_put_u32(skb, RTA_MARK, fl4->flowi4_mark))
2224 goto nla_put_failure; 2224 goto nla_put_failure;
2225 2225
2226 error = rt->dst.error; 2226 error = rt->dst.error;
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 9205e492dc9d..63d4eccc674d 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -248,6 +248,8 @@ int proc_tcp_fastopen_key(ctl_table *ctl, int write, void __user *buffer,
248 ctxt = rcu_dereference(tcp_fastopen_ctx); 248 ctxt = rcu_dereference(tcp_fastopen_ctx);
249 if (ctxt) 249 if (ctxt)
250 memcpy(user_key, ctxt->key, TCP_FASTOPEN_KEY_LENGTH); 250 memcpy(user_key, ctxt->key, TCP_FASTOPEN_KEY_LENGTH);
251 else
252 memset(user_key, 0, sizeof(user_key));
251 rcu_read_unlock(); 253 rcu_read_unlock();
252 254
253 snprintf(tbl.data, tbl.maxlen, "%08x-%08x-%08x-%08x", 255 snprintf(tbl.data, tbl.maxlen, "%08x-%08x-%08x-%08x",
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 75735c9a6a9d..ef998b008a57 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -708,10 +708,11 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
708 arg.csumoffset = offsetof(struct tcphdr, check) / 2; 708 arg.csumoffset = offsetof(struct tcphdr, check) / 2;
709 arg.flags = (sk && inet_sk(sk)->transparent) ? IP_REPLY_ARG_NOSRCCHECK : 0; 709 arg.flags = (sk && inet_sk(sk)->transparent) ? IP_REPLY_ARG_NOSRCCHECK : 0;
710 /* When socket is gone, all binding information is lost. 710 /* When socket is gone, all binding information is lost.
711 * routing might fail in this case. using iif for oif to 711 * routing might fail in this case. No choice here, if we choose to force
712 * make sure we can deliver it 712 * input interface, we will misroute in case of asymmetric route.
713 */ 713 */
714 arg.bound_dev_if = sk ? sk->sk_bound_dev_if : inet_iif(skb); 714 if (sk)
715 arg.bound_dev_if = sk->sk_bound_dev_if;
715 716
716 net = dev_net(skb_dst(skb)->dev); 717 net = dev_net(skb_dst(skb)->dev);
717 arg.tos = ip_hdr(skb)->tos; 718 arg.tos = ip_hdr(skb)->tos;
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 49c890386ce9..26175bffbaa0 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -877,7 +877,8 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win,
877 __tcp_v6_send_check(buff, &fl6.saddr, &fl6.daddr); 877 __tcp_v6_send_check(buff, &fl6.saddr, &fl6.daddr);
878 878
879 fl6.flowi6_proto = IPPROTO_TCP; 879 fl6.flowi6_proto = IPPROTO_TCP;
880 fl6.flowi6_oif = inet6_iif(skb); 880 if (ipv6_addr_type(&fl6.daddr) & IPV6_ADDR_LINKLOCAL)
881 fl6.flowi6_oif = inet6_iif(skb);
881 fl6.fl6_dport = t1->dest; 882 fl6.fl6_dport = t1->dest;
882 fl6.fl6_sport = t1->source; 883 fl6.fl6_sport = t1->source;
883 security_skb_classify_flow(skb, flowi6_to_flowi(&fl6)); 884 security_skb_classify_flow(skb, flowi6_to_flowi(&fl6));
diff --git a/net/mac80211/mesh_sync.c b/net/mac80211/mesh_sync.c
index accfa00ffcdf..a16b7b4b1e02 100644
--- a/net/mac80211/mesh_sync.c
+++ b/net/mac80211/mesh_sync.c
@@ -56,7 +56,6 @@ void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata)
56 u64 tsfdelta; 56 u64 tsfdelta;
57 57
58 spin_lock_bh(&ifmsh->sync_offset_lock); 58 spin_lock_bh(&ifmsh->sync_offset_lock);
59
60 if (ifmsh->sync_offset_clockdrift_max < beacon_int_fraction) { 59 if (ifmsh->sync_offset_clockdrift_max < beacon_int_fraction) {
61 msync_dbg(sdata, "TBTT : max clockdrift=%lld; adjusting\n", 60 msync_dbg(sdata, "TBTT : max clockdrift=%lld; adjusting\n",
62 (long long) ifmsh->sync_offset_clockdrift_max); 61 (long long) ifmsh->sync_offset_clockdrift_max);
@@ -69,11 +68,11 @@ void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata)
69 tsfdelta = -beacon_int_fraction; 68 tsfdelta = -beacon_int_fraction;
70 ifmsh->sync_offset_clockdrift_max -= beacon_int_fraction; 69 ifmsh->sync_offset_clockdrift_max -= beacon_int_fraction;
71 } 70 }
71 spin_unlock_bh(&ifmsh->sync_offset_lock);
72 72
73 tsf = drv_get_tsf(local, sdata); 73 tsf = drv_get_tsf(local, sdata);
74 if (tsf != -1ULL) 74 if (tsf != -1ULL)
75 drv_set_tsf(local, sdata, tsf + tsfdelta); 75 drv_set_tsf(local, sdata, tsf + tsfdelta);
76 spin_unlock_bh(&ifmsh->sync_offset_lock);
77} 76}
78 77
79static void mesh_sync_offset_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, 78static void mesh_sync_offset_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index 2ce89732d0f2..3af0cc4130f1 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -34,7 +34,7 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
34 skb_queue_len(&local->skb_queue_unreliable); 34 skb_queue_len(&local->skb_queue_unreliable);
35 while (tmp > IEEE80211_IRQSAFE_QUEUE_LIMIT && 35 while (tmp > IEEE80211_IRQSAFE_QUEUE_LIMIT &&
36 (skb = skb_dequeue(&local->skb_queue_unreliable))) { 36 (skb = skb_dequeue(&local->skb_queue_unreliable))) {
37 dev_kfree_skb_irq(skb); 37 ieee80211_free_txskb(hw, skb);
38 tmp--; 38 tmp--;
39 I802_DEBUG_INC(local->tx_status_drop); 39 I802_DEBUG_INC(local->tx_status_drop);
40 } 40 }
@@ -159,7 +159,7 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local,
159 "dropped TX filtered frame, queue_len=%d PS=%d @%lu\n", 159 "dropped TX filtered frame, queue_len=%d PS=%d @%lu\n",
160 skb_queue_len(&sta->tx_filtered[ac]), 160 skb_queue_len(&sta->tx_filtered[ac]),
161 !!test_sta_flag(sta, WLAN_STA_PS_STA), jiffies); 161 !!test_sta_flag(sta, WLAN_STA_PS_STA), jiffies);
162 dev_kfree_skb(skb); 162 ieee80211_free_txskb(&local->hw, skb);
163} 163}
164 164
165static void ieee80211_check_pending_bar(struct sta_info *sta, u8 *addr, u8 tid) 165static void ieee80211_check_pending_bar(struct sta_info *sta, u8 *addr, u8 tid)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index e0e0d1d0e830..c9bf83f36657 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -354,7 +354,7 @@ static void purge_old_ps_buffers(struct ieee80211_local *local)
354 total += skb_queue_len(&sta->ps_tx_buf[ac]); 354 total += skb_queue_len(&sta->ps_tx_buf[ac]);
355 if (skb) { 355 if (skb) {
356 purged++; 356 purged++;
357 dev_kfree_skb(skb); 357 ieee80211_free_txskb(&local->hw, skb);
358 break; 358 break;
359 } 359 }
360 } 360 }
@@ -466,7 +466,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
466 ps_dbg(tx->sdata, 466 ps_dbg(tx->sdata,
467 "STA %pM TX buffer for AC %d full - dropping oldest frame\n", 467 "STA %pM TX buffer for AC %d full - dropping oldest frame\n",
468 sta->sta.addr, ac); 468 sta->sta.addr, ac);
469 dev_kfree_skb(old); 469 ieee80211_free_txskb(&local->hw, old);
470 } else 470 } else
471 tx->local->total_ps_buffered++; 471 tx->local->total_ps_buffered++;
472 472
@@ -1103,7 +1103,7 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx,
1103 spin_unlock(&tx->sta->lock); 1103 spin_unlock(&tx->sta->lock);
1104 1104
1105 if (purge_skb) 1105 if (purge_skb)
1106 dev_kfree_skb(purge_skb); 1106 ieee80211_free_txskb(&tx->local->hw, purge_skb);
1107 } 1107 }
1108 1108
1109 /* reset session timer */ 1109 /* reset session timer */
@@ -1214,7 +1214,7 @@ static bool ieee80211_tx_frags(struct ieee80211_local *local,
1214#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 1214#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
1215 if (WARN_ON_ONCE(q >= local->hw.queues)) { 1215 if (WARN_ON_ONCE(q >= local->hw.queues)) {
1216 __skb_unlink(skb, skbs); 1216 __skb_unlink(skb, skbs);
1217 dev_kfree_skb(skb); 1217 ieee80211_free_txskb(&local->hw, skb);
1218 continue; 1218 continue;
1219 } 1219 }
1220#endif 1220#endif
@@ -1356,7 +1356,7 @@ static int invoke_tx_handlers(struct ieee80211_tx_data *tx)
1356 if (unlikely(res == TX_DROP)) { 1356 if (unlikely(res == TX_DROP)) {
1357 I802_DEBUG_INC(tx->local->tx_handlers_drop); 1357 I802_DEBUG_INC(tx->local->tx_handlers_drop);
1358 if (tx->skb) 1358 if (tx->skb)
1359 dev_kfree_skb(tx->skb); 1359 ieee80211_free_txskb(&tx->local->hw, tx->skb);
1360 else 1360 else
1361 __skb_queue_purge(&tx->skbs); 1361 __skb_queue_purge(&tx->skbs);
1362 return -1; 1362 return -1;
@@ -1393,7 +1393,7 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,
1393 res_prepare = ieee80211_tx_prepare(sdata, &tx, skb); 1393 res_prepare = ieee80211_tx_prepare(sdata, &tx, skb);
1394 1394
1395 if (unlikely(res_prepare == TX_DROP)) { 1395 if (unlikely(res_prepare == TX_DROP)) {
1396 dev_kfree_skb(skb); 1396 ieee80211_free_txskb(&local->hw, skb);
1397 goto out; 1397 goto out;
1398 } else if (unlikely(res_prepare == TX_QUEUED)) { 1398 } else if (unlikely(res_prepare == TX_QUEUED)) {
1399 goto out; 1399 goto out;
@@ -1465,7 +1465,7 @@ void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
1465 headroom = max_t(int, 0, headroom); 1465 headroom = max_t(int, 0, headroom);
1466 1466
1467 if (ieee80211_skb_resize(sdata, skb, headroom, may_encrypt)) { 1467 if (ieee80211_skb_resize(sdata, skb, headroom, may_encrypt)) {
1468 dev_kfree_skb(skb); 1468 ieee80211_free_txskb(&local->hw, skb);
1469 rcu_read_unlock(); 1469 rcu_read_unlock();
1470 return; 1470 return;
1471 } 1471 }
@@ -2050,8 +2050,10 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
2050 head_need += IEEE80211_ENCRYPT_HEADROOM; 2050 head_need += IEEE80211_ENCRYPT_HEADROOM;
2051 head_need += local->tx_headroom; 2051 head_need += local->tx_headroom;
2052 head_need = max_t(int, 0, head_need); 2052 head_need = max_t(int, 0, head_need);
2053 if (ieee80211_skb_resize(sdata, skb, head_need, true)) 2053 if (ieee80211_skb_resize(sdata, skb, head_need, true)) {
2054 goto fail; 2054 ieee80211_free_txskb(&local->hw, skb);
2055 return NETDEV_TX_OK;
2056 }
2055 } 2057 }
2056 2058
2057 if (encaps_data) { 2059 if (encaps_data) {
@@ -2184,7 +2186,7 @@ void ieee80211_tx_pending(unsigned long data)
2184 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 2186 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2185 2187
2186 if (WARN_ON(!info->control.vif)) { 2188 if (WARN_ON(!info->control.vif)) {
2187 kfree_skb(skb); 2189 ieee80211_free_txskb(&local->hw, skb);
2188 continue; 2190 continue;
2189 } 2191 }
2190 2192