rtl8xxxu: Move skb delivery into parse_tx_desc() handler
authorJes Sorensen <Jes.Sorensen@redhat.com>
Mon, 27 Jun 2016 16:32:00 +0000 (12:32 -0400)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 8 Jul 2016 13:41:53 +0000 (16:41 +0300)
This is another prepatory patch to be able to handle aggregated RX
packets.

In order to avoid adding a prototype, this also moves the
rtl8723bu_handle_c2h() function.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c

index 53efebe5e3272e1b287635372646a711d172b982..0fea007b904a60f3a3d1ce72cbd553426f4b98f9 100644 (file)
@@ -5045,6 +5045,51 @@ static void rtl8xxxu_rx_urb_work(struct work_struct *work)
        }
 }
 
+static void rtl8723bu_handle_c2h(struct rtl8xxxu_priv *priv,
+                                struct sk_buff *skb)
+{
+       struct rtl8723bu_c2h *c2h = (struct rtl8723bu_c2h *)skb->data;
+       struct device *dev = &priv->udev->dev;
+       int len;
+
+       len = skb->len - 2;
+
+       dev_dbg(dev, "C2H ID %02x seq %02x, len %02x source %02x\n",
+               c2h->id, c2h->seq, len, c2h->bt_info.response_source);
+
+       switch(c2h->id) {
+       case C2H_8723B_BT_INFO:
+               if (c2h->bt_info.response_source >
+                   BT_INFO_SRC_8723B_BT_ACTIVE_SEND)
+                       dev_dbg(dev, "C2H_BT_INFO WiFi only firmware\n");
+               else
+                       dev_dbg(dev, "C2H_BT_INFO BT/WiFi coexist firmware\n");
+
+               if (c2h->bt_info.bt_has_reset)
+                       dev_dbg(dev, "BT has been reset\n");
+               if (c2h->bt_info.tx_rx_mask)
+                       dev_dbg(dev, "BT TRx mask\n");
+
+               break;
+       case C2H_8723B_BT_MP_INFO:
+               dev_dbg(dev, "C2H_MP_INFO ext ID %02x, status %02x\n",
+                       c2h->bt_mp_info.ext_id, c2h->bt_mp_info.status);
+               break;
+       case C2H_8723B_RA_REPORT:
+               dev_dbg(dev,
+                       "C2H RA RPT: rate %02x, unk %i, macid %02x, noise %i\n",
+                       c2h->ra_report.rate, c2h->ra_report.dummy0_0,
+                       c2h->ra_report.macid, c2h->ra_report.noisy_state);
+               break;
+       default:
+               dev_info(dev, "Unhandled C2H event %02x seq %02x\n",
+                        c2h->id, c2h->seq);
+               print_hex_dump(KERN_INFO, "C2H content: ", DUMP_PREFIX_NONE,
+                              16, 1, c2h->raw.payload, len, false);
+               break;
+       }
+}
+
 int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb,
                            struct ieee80211_rx_status *rx_status)
 {
@@ -5094,6 +5139,7 @@ int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb,
        rx_status->freq = hw->conf.chandef.chan->center_freq;
        rx_status->band = hw->conf.chandef.chan->band;
 
+       ieee80211_rx_irqsafe(hw, skb);
        return RX_TYPE_DATA_PKT;
 }
 
@@ -5125,6 +5171,8 @@ int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb,
        if (rx_desc->rpt_sel) {
                struct device *dev = &priv->udev->dev;
                dev_dbg(dev, "%s: C2H packet\n", __func__);
+               rtl8723bu_handle_c2h(priv, skb);
+               dev_kfree_skb(skb);
                return RX_TYPE_C2H;
        }
 
@@ -5152,54 +5200,10 @@ int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb,
        rx_status->freq = hw->conf.chandef.chan->center_freq;
        rx_status->band = hw->conf.chandef.chan->band;
 
+       ieee80211_rx_irqsafe(hw, skb);
        return RX_TYPE_DATA_PKT;
 }
 
-static void rtl8723bu_handle_c2h(struct rtl8xxxu_priv *priv,
-                                struct sk_buff *skb)
-{
-       struct rtl8723bu_c2h *c2h = (struct rtl8723bu_c2h *)skb->data;
-       struct device *dev = &priv->udev->dev;
-       int len;
-
-       len = skb->len - 2;
-
-       dev_dbg(dev, "C2H ID %02x seq %02x, len %02x source %02x\n",
-               c2h->id, c2h->seq, len, c2h->bt_info.response_source);
-
-       switch(c2h->id) {
-       case C2H_8723B_BT_INFO:
-               if (c2h->bt_info.response_source >
-                   BT_INFO_SRC_8723B_BT_ACTIVE_SEND)
-                       dev_dbg(dev, "C2H_BT_INFO WiFi only firmware\n");
-               else
-                       dev_dbg(dev, "C2H_BT_INFO BT/WiFi coexist firmware\n");
-
-               if (c2h->bt_info.bt_has_reset)
-                       dev_dbg(dev, "BT has been reset\n");
-               if (c2h->bt_info.tx_rx_mask)
-                       dev_dbg(dev, "BT TRx mask\n");
-
-               break;
-       case C2H_8723B_BT_MP_INFO:
-               dev_dbg(dev, "C2H_MP_INFO ext ID %02x, status %02x\n",
-                       c2h->bt_mp_info.ext_id, c2h->bt_mp_info.status);
-               break;
-       case C2H_8723B_RA_REPORT:
-               dev_dbg(dev,
-                       "C2H RA RPT: rate %02x, unk %i, macid %02x, noise %i\n",
-                       c2h->ra_report.rate, c2h->ra_report.dummy0_0,
-                       c2h->ra_report.macid, c2h->ra_report.noisy_state);
-               break;
-       default:
-               dev_info(dev, "Unhandled C2H event %02x seq %02x\n",
-                        c2h->id, c2h->seq);
-               print_hex_dump(KERN_INFO, "C2H content: ", DUMP_PREFIX_NONE,
-                              16, 1, c2h->raw.payload, len, false);
-               break;
-       }
-}
-
 static void rtl8xxxu_rx_complete(struct urb *urb)
 {
        struct rtl8xxxu_rx_urb *rx_urb =
@@ -5209,19 +5213,11 @@ static void rtl8xxxu_rx_complete(struct urb *urb)
        struct sk_buff *skb = (struct sk_buff *)urb->context;
        struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);
        struct device *dev = &priv->udev->dev;
-       int rx_type;
 
        skb_put(skb, urb->actual_length);
 
        if (urb->status == 0) {
-               rx_type = priv->fops->parse_rx_desc(priv, skb, rx_status);
-
-               if (rx_type == RX_TYPE_DATA_PKT)
-                       ieee80211_rx_irqsafe(hw, skb);
-               else {
-                       rtl8723bu_handle_c2h(priv, skb);
-                       dev_kfree_skb(skb);
-               }
+               priv->fops->parse_rx_desc(priv, skb, rx_status);
 
                skb = NULL;
                rx_urb->urb.context = NULL;