提交 6c4a5f24 编写于 作者: C Christian Lamparter 提交者: John W. Linville

carl9170: split up carl9170_handle_mpdu

carl9170_handle_mpdu is the final part of the
rx path of the driver. It splits the raw data
streams from the device into skb packets and
passes them on to mac80211. As a result of
continuous updates, it grew over the years when
new code was added by the following commits:
	- report A-MPDU status
	- fix HT peer BA session corruption
	- A-MPDU frame type filter
	- ...

This patch splits the routine into two stages.
The first stage only deals with the details
about extracting and verifying the data from
the incoming stream. Whereas the second stage
packs it into skbs and passes it on to mac80211.
Reported-by: NJavier Lopez <jlopex@cozybit.com>
Signed-off-by: NChristian Lamparter <chunkeey@googlemail.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 f3b369e4
...@@ -660,6 +660,35 @@ static bool carl9170_ampdu_check(struct ar9170 *ar, u8 *buf, u8 ms, ...@@ -660,6 +660,35 @@ static bool carl9170_ampdu_check(struct ar9170 *ar, u8 *buf, u8 ms,
return false; return false;
} }
static int carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len,
struct ieee80211_rx_status *status)
{
struct sk_buff *skb;
/* (driver) frame trap handler
*
* Because power-saving mode handing has to be implemented by
* the driver/firmware. We have to check each incoming beacon
* from the associated AP, if there's new data for us (either
* broadcast/multicast or unicast) we have to react quickly.
*
* So, if you have you want to add additional frame trap
* handlers, this would be the perfect place!
*/
carl9170_ps_beacon(ar, buf, len);
carl9170_ba_check(ar, buf, len);
skb = carl9170_rx_copy_data(buf, len);
if (!skb)
return -ENOMEM;
memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status));
ieee80211_rx(ar->hw, skb);
return 0;
}
/* /*
* If the frame alignment is right (or the kernel has * If the frame alignment is right (or the kernel has
* CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS), and there * CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS), and there
...@@ -669,14 +698,12 @@ static bool carl9170_ampdu_check(struct ar9170 *ar, u8 *buf, u8 ms, ...@@ -669,14 +698,12 @@ static bool carl9170_ampdu_check(struct ar9170 *ar, u8 *buf, u8 ms,
* mode, and we need to observe the proper ordering, * mode, and we need to observe the proper ordering,
* this is non-trivial. * this is non-trivial.
*/ */
static void carl9170_rx_untie_data(struct ar9170 *ar, u8 *buf, int len)
static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len)
{ {
struct ar9170_rx_head *head; struct ar9170_rx_head *head;
struct ar9170_rx_macstatus *mac; struct ar9170_rx_macstatus *mac;
struct ar9170_rx_phystatus *phy = NULL; struct ar9170_rx_phystatus *phy = NULL;
struct ieee80211_rx_status status; struct ieee80211_rx_status status;
struct sk_buff *skb;
int mpdu_len; int mpdu_len;
u8 mac_status; u8 mac_status;
...@@ -788,18 +815,10 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len) ...@@ -788,18 +815,10 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len)
if (phy) if (phy)
carl9170_rx_phy_status(ar, phy, &status); carl9170_rx_phy_status(ar, phy, &status);
carl9170_ps_beacon(ar, buf, mpdu_len); if (carl9170_handle_mpdu(ar, buf, mpdu_len, &status))
carl9170_ba_check(ar, buf, mpdu_len);
skb = carl9170_rx_copy_data(buf, mpdu_len);
if (!skb)
goto drop; goto drop;
memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status));
ieee80211_rx(ar->hw, skb);
return; return;
drop: drop:
ar->rx_dropped++; ar->rx_dropped++;
} }
...@@ -851,7 +870,7 @@ static void __carl9170_rx(struct ar9170 *ar, u8 *buf, unsigned int len) ...@@ -851,7 +870,7 @@ static void __carl9170_rx(struct ar9170 *ar, u8 *buf, unsigned int len)
if (i == 12) if (i == 12)
carl9170_rx_untie_cmds(ar, buf, len); carl9170_rx_untie_cmds(ar, buf, len);
else else
carl9170_handle_mpdu(ar, buf, len); carl9170_rx_untie_data(ar, buf, len);
} }
static void carl9170_rx_stream(struct ar9170 *ar, void *buf, unsigned int len) static void carl9170_rx_stream(struct ar9170 *ar, void *buf, unsigned int len)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册