rtl8xxxu: Add support for aggregated RX packets on gen1 parts

This implements support for demuxing aggregated RX packets on gen1
devices, using the rxdesc16 format.

So far this has only been tested with rtl8723au devices.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
Jes Sorensen 2016-06-27 12:32:03 -04:00 committed by Kalle Valo
parent 41892729cf
commit 040b97be60
1 changed files with 69 additions and 34 deletions

View File

@ -5093,28 +5093,54 @@ static void rtl8723bu_handle_c2h(struct rtl8xxxu_priv *priv,
int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb) int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb)
{ {
struct ieee80211_hw *hw = priv->hw; struct ieee80211_hw *hw = priv->hw;
struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb); struct ieee80211_rx_status *rx_status;
struct rtl8xxxu_rxdesc16 *rx_desc = struct rtl8xxxu_rxdesc16 *rx_desc;
(struct rtl8xxxu_rxdesc16 *)skb->data;
struct rtl8723au_phy_stats *phy_stats; struct rtl8723au_phy_stats *phy_stats;
__le32 *_rx_desc_le = (__le32 *)skb->data; struct sk_buff *next_skb = NULL;
u32 *_rx_desc = (u32 *)skb->data; __le32 *_rx_desc_le;
u32 *_rx_desc;
int drvinfo_sz, desc_shift; int drvinfo_sz, desc_shift;
int i; int i, pkt_cnt, pkt_len, urb_len, pkt_offset;
for (i = 0; i < (sizeof(struct rtl8xxxu_rxdesc16) / sizeof(u32)); i++) urb_len = skb->len;
pkt_cnt = 0;
do {
rx_desc = (struct rtl8xxxu_rxdesc16 *)skb->data;
_rx_desc_le = (__le32 *)skb->data;
_rx_desc = (u32 *)skb->data;
for (i = 0;
i < (sizeof(struct rtl8xxxu_rxdesc16) / sizeof(u32)); i++)
_rx_desc[i] = le32_to_cpu(_rx_desc_le[i]); _rx_desc[i] = le32_to_cpu(_rx_desc_le[i]);
/*
* Only read pkt_cnt from the header if we're parsing the
* first packet
*/
if (!pkt_cnt)
pkt_cnt = rx_desc->pkt_cnt;
pkt_len = rx_desc->pktlen;
drvinfo_sz = rx_desc->drvinfo_sz * 8;
desc_shift = rx_desc->shift;
pkt_offset = roundup(pkt_len + drvinfo_sz + desc_shift +
sizeof(struct rtl8xxxu_rxdesc16), 128);
if (pkt_cnt > 1)
next_skb = skb_clone(skb, GFP_ATOMIC);
rx_status = IEEE80211_SKB_RXCB(skb);
memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); memset(rx_status, 0, sizeof(struct ieee80211_rx_status));
skb_pull(skb, sizeof(struct rtl8xxxu_rxdesc16)); skb_pull(skb, sizeof(struct rtl8xxxu_rxdesc16));
phy_stats = (struct rtl8723au_phy_stats *)skb->data; phy_stats = (struct rtl8723au_phy_stats *)skb->data;
drvinfo_sz = rx_desc->drvinfo_sz * 8;
desc_shift = rx_desc->shift;
skb_pull(skb, drvinfo_sz + desc_shift); skb_pull(skb, drvinfo_sz + desc_shift);
skb_trim(skb, pkt_len);
if (rx_desc->phy_stats) if (rx_desc->phy_stats)
rtl8xxxu_rx_parse_phystats(priv, rx_status, phy_stats, rtl8xxxu_rx_parse_phystats(priv, rx_status, phy_stats,
rx_desc->rxmcs); rx_desc->rxmcs);
@ -5140,6 +5166,15 @@ int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb)
rx_status->band = hw->conf.chandef.chan->band; rx_status->band = hw->conf.chandef.chan->band;
ieee80211_rx_irqsafe(hw, skb); ieee80211_rx_irqsafe(hw, skb);
skb = next_skb;
if (skb)
skb_pull(next_skb, pkt_offset);
pkt_cnt--;
urb_len -= pkt_offset;
} while (skb && urb_len > 0 && pkt_cnt > 0);
return RX_TYPE_DATA_PKT; return RX_TYPE_DATA_PKT;
} }