15e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao/*
25e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * Marvell Wireless LAN device driver: station RX data handling
35e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao *
45e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * Copyright (C) 2011, Marvell International Ltd.
55e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao *
65e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * This software file (the "File") is distributed by Marvell International
75e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * Ltd. under the terms of the GNU General Public License Version 2, June 1991
85e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * (the "License").  You may use, redistribute and/or modify this File in
95e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * accordance with the terms and conditions of the License, a copy of which
105e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * is available by writing to the Free Software Foundation, Inc.,
115e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
125e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
135e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao *
145e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
155e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
165e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * ARE EXPRESSLY DISCLAIMED.  The License provides additional details about
175e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * this warranty disclaimer.
185e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao */
195e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao
205e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao#include "decl.h"
215e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao#include "ioctl.h"
225e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao#include "util.h"
235e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao#include "fw.h"
245e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao#include "main.h"
255e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao#include "11n_aggr.h"
265e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao#include "11n_rxreorder.h"
275e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao
285e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao/*
295e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * This function processes the received packet and forwards it
305e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * to kernel/upper layer.
315e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao *
325e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * This function parses through the received packet and determines
335e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * if it is a debug packet or normal packet.
345e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao *
355e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * For non-debug packets, the function chops off unnecessary leading
365e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * header bytes, reconstructs the packet as an ethernet frame or
375e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * 802.2/llc/snap frame as required, and sends it to kernel/upper layer.
385e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao *
395e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * The completion callback is called after processing in complete.
405e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao */
415e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhaoint mwifiex_process_rx_packet(struct mwifiex_adapter *adapter,
425e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao			      struct sk_buff *skb)
435e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao{
44270e58e8898c8be40451ebee45b6c9b5bd5db04bYogesh Ashok Powar	int ret;
455e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb);
46c65a30f35f938b421ac67c34a9e70b0e49e6019aYogesh Ashok Powar	struct mwifiex_private *priv =
47c65a30f35f938b421ac67c34a9e70b0e49e6019aYogesh Ashok Powar			mwifiex_get_priv_by_id(adapter, rx_info->bss_num,
48c65a30f35f938b421ac67c34a9e70b0e49e6019aYogesh Ashok Powar					       rx_info->bss_type);
495e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	struct rx_packet_hdr *rx_pkt_hdr;
505e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	struct rxpd *local_rx_pd;
515e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	int hdr_chop;
525e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	struct ethhdr *eth_hdr;
535e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	u8 rfc1042_eth_hdr[ETH_ALEN] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
545e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao
555e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	local_rx_pd = (struct rxpd *) (skb->data);
565e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao
575e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	rx_pkt_hdr = (struct rx_packet_hdr *) ((u8 *) local_rx_pd +
585e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao				local_rx_pd->rx_pkt_offset);
595e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao
605e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	if (!memcmp(&rx_pkt_hdr->rfc1042_hdr,
615e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		    rfc1042_eth_hdr, sizeof(rfc1042_eth_hdr))) {
625e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		/*
635e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		 *  Replace the 803 header and rfc1042 header (llc/snap) with an
645e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		 *    EthernetII header, keep the src/dst and snap_type
655e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		 *    (ethertype).
665e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		 *  The firmware only passes up SNAP frames converting
675e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		 *    all RX Data from 802.11 to 802.2/LLC/SNAP frames.
685e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		 *  To create the Ethernet II, just move the src, dst address
695e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		 *    right before the snap_type.
705e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		 */
715e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		eth_hdr = (struct ethhdr *)
725e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao			((u8 *) &rx_pkt_hdr->eth803_hdr
735e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao			 + sizeof(rx_pkt_hdr->eth803_hdr) +
745e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao			 sizeof(rx_pkt_hdr->rfc1042_hdr)
755e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao			 - sizeof(rx_pkt_hdr->eth803_hdr.h_dest)
765e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao			 - sizeof(rx_pkt_hdr->eth803_hdr.h_source)
775e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao			 - sizeof(rx_pkt_hdr->rfc1042_hdr.snap_type));
785e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao
795e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		memcpy(eth_hdr->h_source, rx_pkt_hdr->eth803_hdr.h_source,
805e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		       sizeof(eth_hdr->h_source));
815e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		memcpy(eth_hdr->h_dest, rx_pkt_hdr->eth803_hdr.h_dest,
825e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		       sizeof(eth_hdr->h_dest));
835e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao
845e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		/* Chop off the rxpd + the excess memory from the 802.2/llc/snap
855e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		   header that was removed. */
865e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		hdr_chop = (u8 *) eth_hdr - (u8 *) local_rx_pd;
875e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	} else {
885e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		/* Chop off the rxpd */
895e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		hdr_chop = (u8 *) &rx_pkt_hdr->eth803_hdr -
905e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao			(u8 *) local_rx_pd;
915e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	}
925e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao
935e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	/* Chop off the leading header bytes so the it points to the start of
945e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	   either the reconstructed EthII frame or the 802.2/llc/snap frame */
955e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	skb_pull(skb, hdr_chop);
965e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao
975e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	priv->rxpd_rate = local_rx_pd->rx_rate;
985e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao
995e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	priv->rxpd_htinfo = local_rx_pd->ht_info;
1005e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao
1015e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	ret = mwifiex_recv_packet(adapter, skb);
1025e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	if (ret == -1)
1035e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		dev_err(adapter->dev, "recv packet failed\n");
1045e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao
1055e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	return ret;
1065e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao}
1075e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao
1085e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao/*
1095e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * This function processes the received buffer.
1105e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao *
1115e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * The function looks into the RxPD and performs sanity tests on the
1125e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * received buffer to ensure its a valid packet, before processing it
1135e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * further. If the packet is determined to be aggregated, it is
1145e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * de-aggregated accordingly. Non-unicast packets are sent directly to
1155e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * the kernel/upper layers. Unicast packets are handed over to the
1165e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * Rx reordering routine if 11n is enabled.
1175e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao *
1185e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao * The completion callback is called after processing in complete.
1195e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao */
1205e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhaoint mwifiex_process_sta_rx_packet(struct mwifiex_adapter *adapter,
1215e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao				  struct sk_buff *skb)
1225e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao{
1235e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	int ret = 0;
1245e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	struct rxpd *local_rx_pd;
1255e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb);
1265e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	struct rx_packet_hdr *rx_pkt_hdr;
1275e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	u8 ta[ETH_ALEN];
128270e58e8898c8be40451ebee45b6c9b5bd5db04bYogesh Ashok Powar	u16 rx_pkt_type;
129c65a30f35f938b421ac67c34a9e70b0e49e6019aYogesh Ashok Powar	struct mwifiex_private *priv =
130c65a30f35f938b421ac67c34a9e70b0e49e6019aYogesh Ashok Powar			mwifiex_get_priv_by_id(adapter, rx_info->bss_num,
131c65a30f35f938b421ac67c34a9e70b0e49e6019aYogesh Ashok Powar					       rx_info->bss_type);
1325e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao
1338ed1303321914a70ad580c1d034898e43c39b065Yogesh Ashok Powar	if (!priv)
1348ed1303321914a70ad580c1d034898e43c39b065Yogesh Ashok Powar		return -1;
1358ed1303321914a70ad580c1d034898e43c39b065Yogesh Ashok Powar
1365e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	local_rx_pd = (struct rxpd *) (skb->data);
1375e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	rx_pkt_type = local_rx_pd->rx_pkt_type;
1385e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao
1395e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	rx_pkt_hdr = (struct rx_packet_hdr *) ((u8 *) local_rx_pd +
1405e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao					local_rx_pd->rx_pkt_offset);
1415e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao
1425e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	if ((local_rx_pd->rx_pkt_offset + local_rx_pd->rx_pkt_length) >
1435e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	    (u16) skb->len) {
1445e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		dev_err(adapter->dev, "wrong rx packet: len=%d,"
1455e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao			" rx_pkt_offset=%d, rx_pkt_length=%d\n", skb->len,
1465e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		       local_rx_pd->rx_pkt_offset, local_rx_pd->rx_pkt_length);
1475e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		priv->stats.rx_dropped++;
1485e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		dev_kfree_skb_any(skb);
1495e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		return ret;
1505e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	}
1513b8ab88acaceb505aa06ef3bbf3a73b92470ae78Yogesh Ashok Powar
1525e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	if (local_rx_pd->rx_pkt_type == PKT_TYPE_AMSDU) {
1533b8ab88acaceb505aa06ef3bbf3a73b92470ae78Yogesh Ashok Powar		struct sk_buff_head list;
1543b8ab88acaceb505aa06ef3bbf3a73b92470ae78Yogesh Ashok Powar		struct sk_buff *rx_skb;
1553b8ab88acaceb505aa06ef3bbf3a73b92470ae78Yogesh Ashok Powar
1563b8ab88acaceb505aa06ef3bbf3a73b92470ae78Yogesh Ashok Powar		__skb_queue_head_init(&list);
1573b8ab88acaceb505aa06ef3bbf3a73b92470ae78Yogesh Ashok Powar
1583b8ab88acaceb505aa06ef3bbf3a73b92470ae78Yogesh Ashok Powar		skb_pull(skb, local_rx_pd->rx_pkt_offset);
1593b8ab88acaceb505aa06ef3bbf3a73b92470ae78Yogesh Ashok Powar		skb_trim(skb, local_rx_pd->rx_pkt_length);
1603b8ab88acaceb505aa06ef3bbf3a73b92470ae78Yogesh Ashok Powar
1613b8ab88acaceb505aa06ef3bbf3a73b92470ae78Yogesh Ashok Powar		ieee80211_amsdu_to_8023s(skb, &list, priv->curr_addr,
162c65a30f35f938b421ac67c34a9e70b0e49e6019aYogesh Ashok Powar					 priv->wdev->iftype, 0, false);
1633b8ab88acaceb505aa06ef3bbf3a73b92470ae78Yogesh Ashok Powar
1643b8ab88acaceb505aa06ef3bbf3a73b92470ae78Yogesh Ashok Powar		while (!skb_queue_empty(&list)) {
1653b8ab88acaceb505aa06ef3bbf3a73b92470ae78Yogesh Ashok Powar			rx_skb = __skb_dequeue(&list);
1663b8ab88acaceb505aa06ef3bbf3a73b92470ae78Yogesh Ashok Powar			ret = mwifiex_recv_packet(adapter, rx_skb);
1673b8ab88acaceb505aa06ef3bbf3a73b92470ae78Yogesh Ashok Powar			if (ret == -1)
1683b8ab88acaceb505aa06ef3bbf3a73b92470ae78Yogesh Ashok Powar				dev_err(adapter->dev, "Rx of A-MSDU failed");
1693b8ab88acaceb505aa06ef3bbf3a73b92470ae78Yogesh Ashok Powar		}
1703b8ab88acaceb505aa06ef3bbf3a73b92470ae78Yogesh Ashok Powar		return 0;
1715e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	}
1723b8ab88acaceb505aa06ef3bbf3a73b92470ae78Yogesh Ashok Powar
1735e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	/*
1745e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	 * If the packet is not an unicast packet then send the packet
1755e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	 * directly to os. Don't pass thru rx reordering
1765e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	 */
1775e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	if (!IS_11N_ENABLED(priv) ||
1785e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	    memcmp(priv->curr_addr, rx_pkt_hdr->eth803_hdr.h_dest, ETH_ALEN)) {
1795e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		mwifiex_process_rx_packet(adapter, skb);
1805e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		return ret;
1815e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	}
1825e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao
1835e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	if (mwifiex_queuing_ra_based(priv)) {
1845e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		memcpy(ta, rx_pkt_hdr->eth803_hdr.h_source, ETH_ALEN);
1855e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	} else {
1865e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		if (rx_pkt_type != PKT_TYPE_BAR)
1875e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao			priv->rx_seq[local_rx_pd->priority] =
1885e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao						local_rx_pd->seq_num;
1895e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		memcpy(ta, priv->curr_bss_params.bss_descriptor.mac_address,
1905e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		       ETH_ALEN);
1915e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	}
1925e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao
1935e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	/* Reorder and send to OS */
1945e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	ret = mwifiex_11n_rx_reorder_pkt(priv, local_rx_pd->seq_num,
1955e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao					     local_rx_pd->priority, ta,
1965e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao					     (u8) local_rx_pd->rx_pkt_type,
197a5ffddb70c5cab29fa00e2fdf12217b64b940796Amitkumar Karwar					     skb);
1985e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao
1998ed1303321914a70ad580c1d034898e43c39b065Yogesh Ashok Powar	if (ret || (rx_pkt_type == PKT_TYPE_BAR))
2005e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao		dev_kfree_skb_any(skb);
2018ed1303321914a70ad580c1d034898e43c39b065Yogesh Ashok Powar
2028ed1303321914a70ad580c1d034898e43c39b065Yogesh Ashok Powar	if (ret)
2038ed1303321914a70ad580c1d034898e43c39b065Yogesh Ashok Powar		priv->stats.rx_dropped++;
2045e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao
2055e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao	return ret;
2065e6e3a92b9a4c9416b17f468fa5c7fa2233b8b4eBing Zhao}
207