wireless: add ieee80211_amsdu_to_8023s
PATCH v4 1/2 wireless: add ieee80211_amsdu_to_8023s
Move the A-MSDU handling code from mac80211 to cfg80211 so that more drivers can use it. The new created function ieee80211_amsdu_to_8023s converts an A-MSDU frame to a list of 802.3 frames.
---
V2: use __ version of sk_buff_head operations and mark addr const
V3: add parameter extra_headroom to ieee80211_amsdu_to_8023s
consume the input skb in ieee80211_amsdu_to_8023s
V4: make ieee80211_amsdu_to_8023s void
include/net/cfg80211.h | 22 +++++++++- net/mac80211/rx.c | 106 +++++++++--------------------------------------- net/wireless/util.c | 99 +++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 137 insertions(+), 90 deletions(-)
include/net/cfg80211.h +20 -2
@@ -1578,7 +1578,7 @@ unsigned int ieee80211_hdrlen(__le16 fc);* @addr: the device MAC address * @iftype: the virtual interface type */ -int ieee80211_data_to_8023 (struct sk_buff *skb,u8 *addr, +int ieee80211_data_to_8023 (struct sk_buff *skb,const u8 *addr,enum nl80211_iftype iftype);/**
@@ -1589,10 +1589,28 @@ int ieee80211_data_to_8023(struct sk_buff *skb, u8 *addr,* @bssid: the network bssid (used only for iftype STATION and ADHOC) * @qos: build 802.11 QoS data frame */ -int ieee80211_data_from_8023 (struct sk_buff *skb,u8 *addr, +int ieee80211_data_from_8023 (struct sk_buff *skb,const u8 *addr,enum nl80211_iftype iftype,u8 *bssid,bool qos);/** +* ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame +* +* Decode an IEEE 802.11n A-MSDU frame and convert it to a list of +* 802.3 frames. The @list will be empty if the decode fails. The +* @skb is consumed after the function returns. +* +* @skb: The input IEEE 802.11n A-MSDU frame. +* @list: The output list of 802.3 frames. It must be allocated and +* initialized by by the caller. +* @addr: The device MAC address. +* @iftype: The device interface type. +* @extra_headroom: The hardware extra headroom for SKBs in the @list. +*/ +void ieee80211_amsdu_to_8023s (struct sk_buff *skb,struct sk_buff_head *list, +const u8 *addr,enum nl80211_iftype iftype, +const unsigned int extra_headroom); + +/** * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame * @skb: the data frame */
net/mac80211/rx.c +20 -86
130 lines not on this page · raw message
net/wireless/util.c +97 -2
117 lines not on this page · raw message
Signature · 1 line
1.6.0.4
PATCH v4 2/2 iwmc3200wifi: rx aggregation support
When the device receives an A-MSDU frame (indicated by flag IWM_RX_TICKET_AMSDU_MSK), use ieee80211_amsdu_to_8023s to convert it to a list of 802.3 frames and handled them to upper layer.
---
V2: use __ version of sk_buff_head operations
V3: pass 0 as parameter extra_headroom to ieee80211_amsdu_to_8023s
V4: set skb->protocol for every packet in the return list
drivers/net/wireless/iwmc3200wifi/rx.c | 46 ++++++++++++++++++++++++++++--- 1 files changed, 41 insertions(+), 5 deletions(-)
drivers/net/wireless/iwmc3200wifi/rx.c +41 -5
@@ -1534,6 +1534,33 @@ static void classify8023(struct sk_buff *skb) } } +static void iwm_rx_process_amsdu (struct iwm_priv *iwm,struct sk_buff *skb) +{ +struct wireless_dev *wdev =iwm_to_wdev (iwm); +struct net_device *ndev =iwm_to_ndev (iwm); +struct sk_buff_head list; +struct sk_buff *frame; + +IWM_HEXDUMP (iwm,DBG ,RX ,"A-MSDU: " , skb->data, skb->len); + +__skb_queue_head_init (&list); +ieee80211_amsdu_to_8023s (skb, &list, ndev->dev_addr, wdev->iftype,0 ); + +while ((frame =__skb_dequeue (&list))) { + ndev->stats.rx_packets++; + ndev->stats.rx_bytes += frame->len; + + frame->protocol =eth_type_trans (frame, ndev); + frame->ip_summed =CHECKSUM_NONE ; +memset (frame->cb,0 ,sizeof (frame->cb)); + +if (netif_rx_ni (frame) ==NET_RX_DROP ) { +IWM_ERR (iwm,"Packet dropped\n" ); + ndev->stats.rx_dropped++; + } + } +} +static void iwm_rx_process_packet (struct iwm_priv *iwm,struct iwm_rx_packet *packet,struct iwm_rx_ticket_node *ticket_node)
@@ -1548,25 +1575,34 @@ static void iwm_rx_process_packet(struct iwm_priv *iwm,switch (le16_to_cpu (ticket_node->ticket->action)) {case IWM_RX_TICKET_RELEASE :IWM_DBG_RX (iwm,DBG ,"RELEASE packet\n" ); -classify8023 (skb); +iwm_rx_adjust_packet (iwm, packet, ticket_node); + skb->dev =iwm_to_ndev (iwm); +classify8023 (skb); + +if (le16_to_cpu (ticket_node->ticket->flags) & +IWM_RX_TICKET_AMSDU_MSK ) { +iwm_rx_process_amsdu (iwm, skb); +break ; + } + ret =ieee80211_data_to_8023 (skb, ndev->dev_addr, wdev->iftype);if (ret <0 ) {IWM_DBG_RX (iwm,DBG ,"Couldn't convert 802.11 header - " "%d\n" , ret); +kfree_skb (packet->skb);break ; }IWM_HEXDUMP (iwm,DBG ,RX ,"802.3: " , skb->data, skb->len); - skb->dev =iwm_to_ndev (iwm); + ndev->stats.rx_packets++; + ndev->stats.rx_bytes += skb->len; + skb->protocol =eth_type_trans (skb, ndev); skb->ip_summed =CHECKSUM_NONE ;memset (skb->cb,0 ,sizeof (skb->cb)); - ndev->stats.rx_packets++; - ndev->stats.rx_bytes += skb->len; -if (netif_rx_ni (skb) ==NET_RX_DROP ) {IWM_ERR (iwm,"Packet dropped\n" ); ndev->stats.rx_dropped++;
Signature · 1 line
1.6.0.4
Re: [PATCH v4 2/2] iwmc3200wifi: rx aggregation support
Quoted 6 lines · Zhu Yi
When the device receives an A-MSDU frame (indicated by flag
IWM_RX_TICKET_AMSDU_MSK), useieee80211_amsdu_to_8023sto convert it to a list of 802.3 frames and handled them to upper layer.Cc Johannes Berg <[email protected]>Cc Samuel Ortiz <[email protected]>
Quoted 87 lines
Signed-off-by Zhu Yi <[email protected]>---
V2: use __ version ofsk_buff_headoperations
V3: pass 0 as parameterextra_headroomtoieee80211_amsdu_to_8023s
V4: setskb->protocolfor every packet in the return listdrivers/net/wireless/iwmc3200wifi/rx.c | 46 ++++++++++++++++++++++++++++--- 1 files changed, 41 insertions(+), 5 deletions(-)drivers/net/wireless/iwmc3200wifi/rx.c +41
-5@@ -1534,6 +1534,33 @@ static void classify8023(struct sk_buff *skb) } } +static void iwm_rx_process_amsdu (struct iwm_priv *iwm,struct sk_buff *skb) +{ +struct wireless_dev *wdev =iwm_to_wdev (iwm); +struct net_device *ndev =iwm_to_ndev (iwm); +struct sk_buff_head list; +struct sk_buff *frame; + +IWM_HEXDUMP (iwm,DBG ,RX ,"A-MSDU: " , skb->data, skb->len); + +__skb_queue_head_init (&list); +ieee80211_amsdu_to_8023s (skb, &list, ndev->dev_addr, wdev->iftype,0 ); + +while ((frame =__skb_dequeue (&list))) { + ndev->stats.rx_packets++; + ndev->stats.rx_bytes += frame->len; + + frame->protocol =eth_type_trans (frame, ndev); + frame->ip_summed =CHECKSUM_NONE ; +memset (frame->cb,0 ,sizeof (frame->cb)); + +if (netif_rx_ni (frame) ==NET_RX_DROP ) { +IWM_ERR (iwm,"Packet dropped\n" ); + ndev->stats.rx_dropped++; + } + } +} +static void iwm_rx_process_packet (struct iwm_priv *iwm,struct iwm_rx_packet *packet,struct iwm_rx_ticket_node *ticket_node)@@ -1548,25 +1575,34 @@ static void iwm_rx_process_packet(struct iwm_priv *iwm,switch (le16_to_cpu (ticket_node->ticket->action)) {case IWM_RX_TICKET_RELEASE :IWM_DBG_RX (iwm,DBG ,"RELEASE packet\n" ); -classify8023 (skb); +iwm_rx_adjust_packet (iwm, packet, ticket_node); + skb->dev =iwm_to_ndev (iwm); +classify8023 (skb); + +if (le16_to_cpu (ticket_node->ticket->flags) & +IWM_RX_TICKET_AMSDU_MSK ) { +iwm_rx_process_amsdu (iwm, skb); +break ; + } + ret =ieee80211_data_to_8023 (skb, ndev->dev_addr, wdev->iftype);if (ret <0 ) {IWM_DBG_RX (iwm,DBG ,"Couldn't convert 802.11 header - " "%d\n" , ret); +kfree_skb (packet->skb);break ; }IWM_HEXDUMP (iwm,DBG ,RX ,"802.3: " , skb->data, skb->len); - skb->dev =iwm_to_ndev (iwm); + ndev->stats.rx_packets++; + ndev->stats.rx_bytes += skb->len; + skb->protocol =eth_type_trans (skb, ndev); skb->ip_summed =CHECKSUM_NONE ;memset (skb->cb,0 ,sizeof (skb->cb)); - ndev->stats.rx_packets++; - ndev->stats.rx_bytes += skb->len; -if (netif_rx_ni (skb) ==NET_RX_DROP ) {IWM_ERR (iwm,"Packet dropped\n" ); ndev->stats.rx_dropped++;