Skip to content

Commit eeb0d56

Browse files
committed
mac80211: implement multicast forwarding on fast-RX path
In AP (or VLAN) mode, when unicast 802.11 packets are received, they might actually be multicast after conversion. In this case the fast-RX path didn't handle them properly to send them back to the wireless medium. Implement that by copying the SKB and sending it back out. The possible alternative would be to just punt the packet back to the regular (slow) RX path, but since we have almost all of the required code here already it's not so complicated to add here. Punting it back would also mean acquiring the spinlock, which would be bad for the stated purpose of the fast-RX path, to enable well-performing parallel RX. Cc: [email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent 03430fa commit eeb0d56

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

net/mac80211/rx.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3942,21 +3942,31 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx,
39423942
u64_stats_update_end(&stats->syncp);
39433943

39443944
if (fast_rx->internal_forward) {
3945-
struct sta_info *dsta = sta_info_get(rx->sdata, skb->data);
3945+
struct sk_buff *xmit_skb = NULL;
3946+
bool multicast = is_multicast_ether_addr(skb->data);
39463947

3947-
if (dsta) {
3948+
if (multicast) {
3949+
xmit_skb = skb_copy(skb, GFP_ATOMIC);
3950+
} else if (sta_info_get(rx->sdata, skb->data)) {
3951+
xmit_skb = skb;
3952+
skb = NULL;
3953+
}
3954+
3955+
if (xmit_skb) {
39483956
/*
39493957
* Send to wireless media and increase priority by 256
39503958
* to keep the received priority instead of
39513959
* reclassifying the frame (see cfg80211_classify8021d).
39523960
*/
3953-
skb->priority += 256;
3954-
skb->protocol = htons(ETH_P_802_3);
3955-
skb_reset_network_header(skb);
3956-
skb_reset_mac_header(skb);
3957-
dev_queue_xmit(skb);
3958-
return true;
3961+
xmit_skb->priority += 256;
3962+
xmit_skb->protocol = htons(ETH_P_802_3);
3963+
skb_reset_network_header(xmit_skb);
3964+
skb_reset_mac_header(xmit_skb);
3965+
dev_queue_xmit(xmit_skb);
39593966
}
3967+
3968+
if (!skb)
3969+
return true;
39603970
}
39613971

39623972
/* deliver to local stack */

0 commit comments

Comments
 (0)