mac80211: Support receiving data frames on multiple vifs.
From: Ben Greear <[email protected]>
When using multiple STA interfaces on the same radio, some data packets need to be received on all interfaces (broadcast, for instance).
Make the STA loop look similar to the mgt-data loop.
Also, add logic to check RX_FLAG_MMIC_ERROR for last interface in mgt-data loop.
This needs review.
---
:100644 100644 c036815... a7847e1... M net/mac80211/rx.c
net/mac80211/rx.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 70 insertions(+), 10 deletions(-)
net/mac80211/rx.c +70 -10
@@ -2613,7 +2613,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,int prepares;struct ieee80211_sub_if_data *prev =NULL ;struct sk_buff *skb_new; -struct sta_info *sta, *tmp; +struct sta_info *sta, *tmp, *prev_sta;bool found_sta = false;int err =0 ;
@@ -2644,22 +2644,74 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,ieee80211_verify_alignment (&rx);if (ieee80211_is_data (fc)) { + prev_sta =NULL ;for_each_sta_info (local, hdr->addr2, sta, tmp) { - rx.sta = sta; found_sta = true; - rx.sdata = sta->sdata; +if (!prev_sta) { + prev_sta = sta; +continue ; + } + + rx.sta = prev_sta; + rx.sdata = prev_sta->sdata; rx.flags |=IEEE80211_RX_RA_MATCH ; prepares =prepare_for_handlers (rx.sdata, &rx, hdr); -if (prepares) { -if (status->flag &RX_FLAG_MMIC_ERROR ) { -if (rx.flags &IEEE80211_RX_RA_MATCH ) -ieee80211_rx_michael_mic_report (hdr, &rx); - }else - prev = rx.sdata; +if (!prepares) + goto next_sta; + +if (status->flag &RX_FLAG_MMIC_ERROR ) { +if (rx.flags &IEEE80211_RX_RA_MATCH ) +ieee80211_rx_michael_mic_report (hdr, &rx); + goto next_sta; + } + +/* +* frame was destined for the previous interface +* so invoke RX handlers for it +*/ + skb_new =skb_copy (skb,GFP_ATOMIC ); +if (!skb_new) { +if (net_ratelimit ()) +wiphy_debug (local->hw.wiphy, +"failed to copy multicast" +" frame for %s\n" , + prev_sta->sdata->name); + goto next_sta; + } +ieee80211_invoke_rx_handlers (prev_sta->sdata, &rx, + skb_new); +next_sta: + prev_sta = sta; + }/* for all STA info */ + +if (prev_sta) { + rx.sta = prev_sta; + rx.sdata = prev_sta->sdata; + + rx.flags |=IEEE80211_RX_RA_MATCH ; + prepares =prepare_for_handlers (rx.sdata, &rx, hdr); +if (!prepares) + prev_sta =NULL ; + +if (status->flag &RX_FLAG_MMIC_ERROR ) { +if (rx.flags &IEEE80211_RX_RA_MATCH ) +ieee80211_rx_michael_mic_report (hdr, &rx); + prev_sta =NULL ; } } - } + + +if (prev_sta) { +ieee80211_invoke_rx_handlers (prev_sta->sdata, &rx, skb); +return ; + }else { +if (found_sta) { +dev_kfree_skb (skb); +return ; + } + } + }/* if data frame */ if (!found_sta) {list_for_each_entry_rcu (sdata, &local->interfaces, list) {if (!ieee80211_sdata_running (sdata))
@@ -2722,6 +2774,14 @@ next:if (!prepares) prev =NULL ; + +if (status->flag &RX_FLAG_MMIC_ERROR ) { + rx.sdata = prev; +if (rx.flags &IEEE80211_RX_RA_MATCH ) +ieee80211_rx_michael_mic_report (hdr, + &rx); + prev =NULL ; + } } }if (prev)
Signature · 1 line
1.7.2.2
Johannes Berg
maintainerQuoted 6 lines · On Mon, 2010-09-20 at 14:39 -0700, [email protected] wrote:
From: Ben Greear <[email protected]>
When using multiple STA interfaces on the same radio, some data packets need to be received on all interfaces (broadcast, for instance).
Quoted 6 lines
Make the STA loop look similar to the mgt-data loop.
Also, add logic to check
RX_FLAG_MMIC_ERRORfor last interface in mgt-data loop.This needs review.
Looks fine to me, I think.
johannes
Quoted 7 lines · Johannes Berg
Quoted 6 lines · On Mon, 2010-09-20 at 14:39 -0700, [email protected] wrote:
From: Ben Greear<[email protected]>
When using multiple STA interfaces on the same radio, some data packets need to be received on all interfaces (broadcast, for instance).
Quoted 8 lines
Quoted 6 lines
Make the STA loop look similar to the mgt-data loop.
Also, add logic to check
RX_FLAG_MMIC_ERRORfor last interface in mgt-data loop.This needs review.
Looks fine to me, I think.
Does this need any more work before being accepted upstream?
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Johannes Berg
maintainerQuoted 10 lines · Ben Greear
Quoted 9 lines · Johannes Berg
Quoted 8 lines · On Mon, 2010-09-20 at 14:39 -0700, [email protected] wrote:
From: Ben Greear<[email protected]>
When using multiple STA interfaces on the same radio, some data packets need to be received on all interfaces (broadcast, for instance).
Make the STA loop look similar to the mgt-data loop.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Also, add logic to check
RX_FLAG_MMIC_ERRORfor last interface in mgt-data loop.This needs review.
Looks fine to me, I think.
Does this need any more work before being accepted upstream?
Well, I personally would've tried to reduce the code duplication between the two loops, but right now I'm not sure I see how to.
johannes
Quoted 14 lines · Johannes Berg
Quoted 13 lines · Ben Greear
Quoted 12 lines · Johannes Berg
Quoted 11 lines · On Mon, 2010-09-20 at 14:39 -0700, [email protected] wrote:
From: Ben Greear<[email protected]>
When using multiple STA interfaces on the same radio, some data packets need to be received on all interfaces (broadcast, for instance).
Make the STA loop look similar to the mgt-data loop.
Also, add logic to check
RX_FLAG_MMIC_ERRORfor last interface in mgt-data loop.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
This needs review.
Looks fine to me, I think.
Does this need any more work before being accepted upstream?
Well, I personally would've tried to reduce the code duplication between the two loops, but right now I'm not sure I see how to.
I could move some of the rx setup code into prepare_for_handlers, but not sure how much that would help readability.
In my opinion, that would be a good candidate for a followup patch instead of adding that to this patch, though.
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Johannes Berg
maintainerQuoted 8 lines · Ben Greear
Quoted 2 lines
Well, I personally would've tried to reduce the code duplication between the two loops, but right now I'm not sure I see how to.
I could move some of the rx setup code into
prepare_for_handlers, but not sure how much that would help readability.In my opinion, that would be a good candidate for a followup patch instead of adding that to this patch, though.
Yeah, I can agree with that.
I have a patch that also touches this area, I'll let you get this one in first and rebase it.
Thanks,
Johannes
Quoted 8 lines · Johannes Berg
Quoted 6 lines · Ben Greear
Quoted 2 lines
Well, I personally would've tried to reduce the code duplication between the two loops, but right now I'm not sure I see how to.
I could move some of the rx setup code into
prepare_for_handlers, but not sure how much that would help readability.
Quoted 7 lines
Quoted 2 lines
In my opinion, that would be a good candidate for a followup patch instead of adding that to this patch, though.
Yeah, I can agree with that.
I have a patch that also touches this area, I'll let you get this one in first and rebase it.
Thanks!
I'm currently testing VAP + STA on same hardware concurrently with ath5k, and seems the VAP doesn't receive any packets.
When I get that sorted, I'll work on the rx setup code minimization patch.
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Johannes Berg
maintainerQuoted 2 lines · Ben Greear
When I get that sorted, I'll work on the rx setup code minimization patch.
working on it, will have something for review in a minute
johannes