e61ba5bc5a7843026abe4143fe193b5c8d338252
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / 652-0002-rtl8xxxu-Move-skb-delivery-into-parse_tx_desc-handle.patch
1 From a635df8a41ace30d15cb6fa22a04ba5b4c364cff Mon Sep 17 00:00:00 2001
2 From: Jes Sorensen <Jes.Sorensen@redhat.com>
3 Date: Mon, 27 Jun 2016 12:32:00 -0400
4 Subject: [PATCH] rtl8xxxu: Move skb delivery into parse_tx_desc() handler
5
6 This is another prepatory patch to be able to handle aggregated RX
7 packets.
8
9 In order to avoid adding a prototype, this also moves the
10 rtl8723bu_handle_c2h() function.
11
12 Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
13 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
14 ---
15 .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 104 ++++++++++-----------
16 1 file changed, 50 insertions(+), 54 deletions(-)
17
18 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
19 +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
20 @@ -5045,6 +5045,51 @@ static void rtl8xxxu_rx_urb_work(struct
21 }
22 }
23
24 +static void rtl8723bu_handle_c2h(struct rtl8xxxu_priv *priv,
25 + struct sk_buff *skb)
26 +{
27 + struct rtl8723bu_c2h *c2h = (struct rtl8723bu_c2h *)skb->data;
28 + struct device *dev = &priv->udev->dev;
29 + int len;
30 +
31 + len = skb->len - 2;
32 +
33 + dev_dbg(dev, "C2H ID %02x seq %02x, len %02x source %02x\n",
34 + c2h->id, c2h->seq, len, c2h->bt_info.response_source);
35 +
36 + switch(c2h->id) {
37 + case C2H_8723B_BT_INFO:
38 + if (c2h->bt_info.response_source >
39 + BT_INFO_SRC_8723B_BT_ACTIVE_SEND)
40 + dev_dbg(dev, "C2H_BT_INFO WiFi only firmware\n");
41 + else
42 + dev_dbg(dev, "C2H_BT_INFO BT/WiFi coexist firmware\n");
43 +
44 + if (c2h->bt_info.bt_has_reset)
45 + dev_dbg(dev, "BT has been reset\n");
46 + if (c2h->bt_info.tx_rx_mask)
47 + dev_dbg(dev, "BT TRx mask\n");
48 +
49 + break;
50 + case C2H_8723B_BT_MP_INFO:
51 + dev_dbg(dev, "C2H_MP_INFO ext ID %02x, status %02x\n",
52 + c2h->bt_mp_info.ext_id, c2h->bt_mp_info.status);
53 + break;
54 + case C2H_8723B_RA_REPORT:
55 + dev_dbg(dev,
56 + "C2H RA RPT: rate %02x, unk %i, macid %02x, noise %i\n",
57 + c2h->ra_report.rate, c2h->ra_report.dummy0_0,
58 + c2h->ra_report.macid, c2h->ra_report.noisy_state);
59 + break;
60 + default:
61 + dev_info(dev, "Unhandled C2H event %02x seq %02x\n",
62 + c2h->id, c2h->seq);
63 + print_hex_dump(KERN_INFO, "C2H content: ", DUMP_PREFIX_NONE,
64 + 16, 1, c2h->raw.payload, len, false);
65 + break;
66 + }
67 +}
68 +
69 int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb,
70 struct ieee80211_rx_status *rx_status)
71 {
72 @@ -5094,6 +5139,7 @@ int rtl8xxxu_parse_rxdesc16(struct rtl8x
73 rx_status->freq = hw->conf.chandef.chan->center_freq;
74 rx_status->band = hw->conf.chandef.chan->band;
75
76 + ieee80211_rx_irqsafe(hw, skb);
77 return RX_TYPE_DATA_PKT;
78 }
79
80 @@ -5125,6 +5171,8 @@ int rtl8xxxu_parse_rxdesc24(struct rtl8x
81 if (rx_desc->rpt_sel) {
82 struct device *dev = &priv->udev->dev;
83 dev_dbg(dev, "%s: C2H packet\n", __func__);
84 + rtl8723bu_handle_c2h(priv, skb);
85 + dev_kfree_skb(skb);
86 return RX_TYPE_C2H;
87 }
88
89 @@ -5152,54 +5200,10 @@ int rtl8xxxu_parse_rxdesc24(struct rtl8x
90 rx_status->freq = hw->conf.chandef.chan->center_freq;
91 rx_status->band = hw->conf.chandef.chan->band;
92
93 + ieee80211_rx_irqsafe(hw, skb);
94 return RX_TYPE_DATA_PKT;
95 }
96
97 -static void rtl8723bu_handle_c2h(struct rtl8xxxu_priv *priv,
98 - struct sk_buff *skb)
99 -{
100 - struct rtl8723bu_c2h *c2h = (struct rtl8723bu_c2h *)skb->data;
101 - struct device *dev = &priv->udev->dev;
102 - int len;
103 -
104 - len = skb->len - 2;
105 -
106 - dev_dbg(dev, "C2H ID %02x seq %02x, len %02x source %02x\n",
107 - c2h->id, c2h->seq, len, c2h->bt_info.response_source);
108 -
109 - switch(c2h->id) {
110 - case C2H_8723B_BT_INFO:
111 - if (c2h->bt_info.response_source >
112 - BT_INFO_SRC_8723B_BT_ACTIVE_SEND)
113 - dev_dbg(dev, "C2H_BT_INFO WiFi only firmware\n");
114 - else
115 - dev_dbg(dev, "C2H_BT_INFO BT/WiFi coexist firmware\n");
116 -
117 - if (c2h->bt_info.bt_has_reset)
118 - dev_dbg(dev, "BT has been reset\n");
119 - if (c2h->bt_info.tx_rx_mask)
120 - dev_dbg(dev, "BT TRx mask\n");
121 -
122 - break;
123 - case C2H_8723B_BT_MP_INFO:
124 - dev_dbg(dev, "C2H_MP_INFO ext ID %02x, status %02x\n",
125 - c2h->bt_mp_info.ext_id, c2h->bt_mp_info.status);
126 - break;
127 - case C2H_8723B_RA_REPORT:
128 - dev_dbg(dev,
129 - "C2H RA RPT: rate %02x, unk %i, macid %02x, noise %i\n",
130 - c2h->ra_report.rate, c2h->ra_report.dummy0_0,
131 - c2h->ra_report.macid, c2h->ra_report.noisy_state);
132 - break;
133 - default:
134 - dev_info(dev, "Unhandled C2H event %02x seq %02x\n",
135 - c2h->id, c2h->seq);
136 - print_hex_dump(KERN_INFO, "C2H content: ", DUMP_PREFIX_NONE,
137 - 16, 1, c2h->raw.payload, len, false);
138 - break;
139 - }
140 -}
141 -
142 static void rtl8xxxu_rx_complete(struct urb *urb)
143 {
144 struct rtl8xxxu_rx_urb *rx_urb =
145 @@ -5209,19 +5213,11 @@ static void rtl8xxxu_rx_complete(struct
146 struct sk_buff *skb = (struct sk_buff *)urb->context;
147 struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);
148 struct device *dev = &priv->udev->dev;
149 - int rx_type;
150
151 skb_put(skb, urb->actual_length);
152
153 if (urb->status == 0) {
154 - rx_type = priv->fops->parse_rx_desc(priv, skb, rx_status);
155 -
156 - if (rx_type == RX_TYPE_DATA_PKT)
157 - ieee80211_rx_irqsafe(hw, skb);
158 - else {
159 - rtl8723bu_handle_c2h(priv, skb);
160 - dev_kfree_skb(skb);
161 - }
162 + priv->fops->parse_rx_desc(priv, skb, rx_status);
163
164 skb = NULL;
165 rx_urb->urb.context = NULL;