Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[cascardo/linux.git] / drivers / net / wireless / mwifiex / uap_txrx.c
index 92f76d6..3c74eb2 100644 (file)
@@ -98,7 +98,6 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv,
        int hdr_chop;
        struct timeval tv;
        struct ethhdr *p_ethhdr;
-       u8 rfc1042_eth_hdr[ETH_ALEN] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
 
        uap_rx_pd = (struct uap_rxpd *)(skb->data);
        rx_pkt_hdr = (void *)uap_rx_pd + le16_to_cpu(uap_rx_pd->rx_pkt_offset);
@@ -112,8 +111,12 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv,
                return;
        }
 
-       if (!memcmp(&rx_pkt_hdr->rfc1042_hdr,
-                   rfc1042_eth_hdr, sizeof(rfc1042_eth_hdr))) {
+       if ((!memcmp(&rx_pkt_hdr->rfc1042_hdr, bridge_tunnel_header,
+                    sizeof(bridge_tunnel_header))) ||
+           (!memcmp(&rx_pkt_hdr->rfc1042_hdr, rfc1042_header,
+                    sizeof(rfc1042_header)) &&
+            ntohs(rx_pkt_hdr->rfc1042_hdr.snap_type) != ETH_P_AARP &&
+            ntohs(rx_pkt_hdr->rfc1042_hdr.snap_type) != ETH_P_IPX)) {
                /* Replace the 803 header and rfc1042 header (llc/snap) with
                 * an Ethernet II header, keep the src/dst and snap_type
                 * (ethertype).
@@ -144,7 +147,7 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv,
                hdr_chop = (u8 *)&rx_pkt_hdr->eth803_hdr - (u8 *)uap_rx_pd;
        }
 
-       /* Chop off the leading header bytes so the it points
+       /* Chop off the leading header bytes so that it points
         * to the start of either the reconstructed EthII frame
         * or the 802.2/llc/snap frame.
         */
@@ -176,6 +179,19 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv,
        tx_info->bss_type = priv->bss_type;
        tx_info->flags |= MWIFIEX_BUF_FLAG_BRIDGED_PKT;
 
+       if (is_unicast_ether_addr(rx_pkt_hdr->eth803_hdr.h_dest)) {
+               /* Update bridge packet statistics as the
+                * packet is not going to kernel/upper layer.
+                */
+               priv->stats.rx_bytes += skb->len;
+               priv->stats.rx_packets++;
+
+               /* Sending bridge packet to TX queue, so save the packet
+                * length in TXCB to update statistics in TX complete.
+                */
+               tx_info->pkt_len = skb->len;
+       }
+
        do_gettimeofday(&tv);
        skb->tstamp = timeval_to_ktime(tv);
        mwifiex_wmm_add_buf_txqueue(priv, skb);
@@ -264,12 +280,7 @@ int mwifiex_process_uap_rx_packet(struct mwifiex_private *priv,
                        skb->len, le16_to_cpu(uap_rx_pd->rx_pkt_offset),
                        le16_to_cpu(uap_rx_pd->rx_pkt_length));
                priv->stats.rx_dropped++;
-
-               if (adapter->if_ops.data_complete)
-                       adapter->if_ops.data_complete(adapter, skb);
-               else
-                       dev_kfree_skb_any(skb);
-
+               dev_kfree_skb_any(skb);
                return 0;
        }
 
@@ -323,12 +334,8 @@ int mwifiex_process_uap_rx_packet(struct mwifiex_private *priv,
                                         uap_rx_pd->priority, ta, pkt_type,
                                         skb);
 
-       if (ret || (rx_pkt_type == PKT_TYPE_BAR)) {
-               if (adapter->if_ops.data_complete)
-                       adapter->if_ops.data_complete(adapter, skb);
-               else
-                       dev_kfree_skb_any(skb);
-       }
+       if (ret || (rx_pkt_type == PKT_TYPE_BAR))
+               dev_kfree_skb_any(skb);
 
        if (ret)
                priv->stats.rx_dropped++;