staging: rtl8723bs: get rid of os_dep/recv_linux.c
cover staging: rtl8723bs: get rid of os_dep/recv_linux.c
This series moves/merges the functions/functionality of os_dep/recv_linux.c into the corresponding parts of the driver in the core directory to reduce "os dependent" code.
The patches have been compile-tested only due to lack of hardware.
Michael Straube (13):
staging: rtl8723bs: remove wrapper rtw_init_recv_timer
staging: rtl8723bs: move rtw_recv_indicatepkt to rtw_recv.c
staging: rtl8723bs: move rtw_handle_tkip_mic_err to rtw_recv.c
staging: rtl8723bs: merge rtw_os_free_recvframe into rtw_recv.c
staging: rtl8723bs: merge rtw_os_recv_resource_alloc into rtw_recv.c
staging: rtl8723bs: merge rtw_os_recv_resource_free into rtw_recv.c
staging: rtl8723bs: merge rtw_os_recvbuf_resource_free into
rtl8723bs_recv.c
staging: rtl8723bs: move rtw_os_alloc_msdu_pkt to rtw_recv.c
staging: rtl8723bs: rename rtw_os_alloc_msdu_pkt
staging: rtl8723bs: move rtw_os_recv_indicate_pkt to rtw_recv.c
staging: rtl8723bs: rename rtw_os_recv_indicate_pkt
staging: rtl8723bs: remove os_dep/recv_linux.c
staging: rtl8723bs: remove include/recv_osdep.h
drivers/staging/rtl8723bs/Makefile | 1 - drivers/staging/rtl8723bs/core/rtw_recv.c | 194 ++++++++++++++- drivers/staging/rtl8723bs/core/rtw_sta_mgt.c | 4 +- .../staging/rtl8723bs/hal/rtl8723bs_recv.c | 6 +- drivers/staging/rtl8723bs/include/drv_types.h | 1 - .../staging/rtl8723bs/include/recv_osdep.h | 40 ---- drivers/staging/rtl8723bs/include/rtw_recv.h | 4 + drivers/staging/rtl8723bs/os_dep/recv_linux.c | 225 ------------------ 8 files changed, 199 insertions(+), 276 deletions(-) delete mode 100644 drivers/staging/rtl8723bs/include/recv_osdep.h delete mode 100644 drivers/staging/rtl8723bs/os_dep/recv_linux.c
Signature · 1 line
2.51.0
PATCH 1/13 staging: rtl8723bs: remove wrapper rtw_init_recv_timer
The function rtw_init_recv_timer in os_dep/recv_linux.c is jsut a wrapper around timer_setup. Use timer_setup directly and remove the wrapper to reduce code in the os_dep directory.
--- drivers/staging/rtl8723bs/core/rtw_sta_mgt.c | 4 +++- drivers/staging/rtl8723bs/include/recv_osdep.h | 3 --- drivers/staging/rtl8723bs/os_dep/recv_linux.c | 7 ------- 3 files changed, 3 insertions(+), 11 deletions(-)
drivers/staging/rtl8723bs/core/rtw_sta_mgt.c +3 -1
@@ -247,7 +247,9 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)INIT_LIST_HEAD (&preorder_ctrl->pending_recvframe_queue.queue);spin_lock_init (&preorder_ctrl->pending_recvframe_queue.lock); -rtw_init_recv_timer (preorder_ctrl); +/* init recv timer */ +timer_setup (&preorder_ctrl->reordering_ctrl_timer, + rtw_reordering_ctrl_timeout_handler,0 ); }/* init for DM */
drivers/staging/rtl8723bs/include/recv_osdep.h +0 -3
@@ -34,7 +34,4 @@ void rtw_os_recvbuf_resource_free(struct adapter *padapter, struct recv_buf *prestruct sk_buff *rtw_os_alloc_msdu_pkt (union recv_frame *prframe,u16 nSubframe_Length,u8 *pdata);void rtw_os_recv_indicate_pkt (struct adapter *padapter,struct sk_buff *pkt,struct rx_pkt_attrib *pattrib); -void rtw_init_recv_timer (struct recv_reorder_ctrl *preorder_ctrl); - -#endif /* */
drivers/staging/rtl8723bs/os_dep/recv_linux.c +0 -7
@@ -216,10 +216,3 @@ int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_framereturn _FAIL; } - -void rtw_init_recv_timer (struct recv_reorder_ctrl *preorder_ctrl) -{ -timer_setup (&preorder_ctrl->reordering_ctrl_timer, - rtw_reordering_ctrl_timeout_handler,0 ); - -}
Signature · 1 line
2.51.0
PATCH 2/13 staging: rtl8723bs: move rtw_recv_indicatepkt to rtw_recv.c
In reply to Michael StraubeMove the function rtw_recv_indicatepkt from os_dep/recv_linux.c to core/rtw_recv.c to reduce code in the os_dep directory.
--- drivers/staging/rtl8723bs/core/rtw_recv.c | 37 +++++++++++++++++++ .../staging/rtl8723bs/include/recv_osdep.h | 1 - drivers/staging/rtl8723bs/os_dep/recv_linux.c | 37 ------------------- 3 files changed, 37 insertions(+), 38 deletions(-)
drivers/staging/rtl8723bs/core/rtw_recv.c +37 -0
@@ -1725,6 +1725,43 @@ static void recv_indicatepkts_pkt_loss_cnt(struct debug_priv *pdbgpriv, u64 prev } +static int rtw_recv_indicatepkt (struct adapter *padapter,union recv_frame *precv_frame) +{ +struct recv_priv *precvpriv; +struct __queue *pfree_recv_queue; +struct sk_buff *skb; +struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib; + + precvpriv = &(padapter->recvpriv); + pfree_recv_queue = &(precvpriv->free_recv_queue); + + skb = precv_frame->u.hdr.pkt; +if (!skb) + goto _recv_indicatepkt_drop; + + skb->data = precv_frame->u.hdr.rx_data; + +skb_set_tail_pointer (skb, precv_frame->u.hdr.len); + + skb->len = precv_frame->u.hdr.len; + +rtw_os_recv_indicate_pkt (padapter, skb, pattrib); + +/* pointers to NULL before rtw_free_recvframe() */ + precv_frame->u.hdr.pkt =NULL ; + +rtw_free_recvframe (precv_frame, pfree_recv_queue); + +return _SUCCESS; + +_recv_indicatepkt_drop: + +/* enqueue back to free_recv_queue */ +rtw_free_recvframe (precv_frame, pfree_recv_queue); + +return _FAIL; +} +static int recv_indicatepkts_in_order (struct adapter *padapter,struct recv_reorder_ctrl *preorder_ctrl,int bforced) {struct list_head *phead, *plist;
drivers/staging/rtl8723bs/include/recv_osdep.h +0 -1
@@ -13,7 +13,6 @@ extern void _rtw_free_recv_priv(struct recv_priv *precvpriv);extern s32 rtw_recv_entry (union recv_frame *precv_frame); -extern int rtw_recv_indicatepkt (struct adapter *adapter,union recv_frame *precv_frame);extern void rtw_recv_returnpacket (struct net_device *cnxt,struct sk_buff *preturnedpkt);extern void rtw_handle_tkip_mic_err (struct adapter *padapter,u8 bgroup);
drivers/staging/rtl8723bs/os_dep/recv_linux.c +0 -37
@@ -179,40 +179,3 @@ void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup)memset (&wrqu,0x00 ,sizeof (wrqu)); wrqu.data.length =sizeof (ev); } - -int rtw_recv_indicatepkt (struct adapter *padapter,union recv_frame *precv_frame) -{ -struct recv_priv *precvpriv; -struct __queue *pfree_recv_queue; -struct sk_buff *skb; -struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib; - - precvpriv = &(padapter->recvpriv); - pfree_recv_queue = &(precvpriv->free_recv_queue); - - skb = precv_frame->u.hdr.pkt; -if (!skb) - goto _recv_indicatepkt_drop; - - skb->data = precv_frame->u.hdr.rx_data; - -skb_set_tail_pointer (skb, precv_frame->u.hdr.len); - - skb->len = precv_frame->u.hdr.len; - -rtw_os_recv_indicate_pkt (padapter, skb, pattrib); - -/* pointers to NULL before rtw_free_recvframe() */ - precv_frame->u.hdr.pkt =NULL ; - -rtw_free_recvframe (precv_frame, pfree_recv_queue); - -return _SUCCESS; - -_recv_indicatepkt_drop: - -/* enqueue back to free_recv_queue */ -rtw_free_recvframe (precv_frame, pfree_recv_queue); - -return _FAIL; -}
Signature · 1 line
2.51.0
PATCH 3/13 staging: rtl8723bs: move rtw_handle_tkip_mic_err to rtw_recv.c
In reply to Michael StraubeMove the function rtw_handle_tkip_mic_err from os_dep/recv_linux.c to core/rtw_recv.c to reduce code in the os_dep directory.
--- drivers/staging/rtl8723bs/core/rtw_recv.c | 44 +++++++++++++++++++ .../staging/rtl8723bs/include/recv_osdep.h | 2 - drivers/staging/rtl8723bs/os_dep/recv_linux.c | 44 ------------------- 3 files changed, 44 insertions(+), 46 deletions(-)
drivers/staging/rtl8723bs/core/rtw_recv.c +44 -0
@@ -294,6 +294,50 @@ struct recv_buf *rtw_dequeue_recvbuf(struct __queue *queue) } +static void rtw_handle_tkip_mic_err (struct adapter *padapter,u8 bgroup) +{ +enum nl80211_key_type key_type =0 ; +union iwreq_data wrqu; +struct iw_michaelmicfailure ev; +struct mlme_priv *pmlmepriv = &padapter->mlmepriv; +struct security_priv *psecuritypriv = &padapter->securitypriv; +unsigned long cur_time =0 ; + +if (psecuritypriv->last_mic_err_time ==0 ) { + psecuritypriv->last_mic_err_time = jiffies; + }else { + cur_time = jiffies; + +if (cur_time - psecuritypriv->last_mic_err_time <60 *HZ ) { + psecuritypriv->btkip_countermeasure = true; + psecuritypriv->last_mic_err_time =0 ; + psecuritypriv->btkip_countermeasure_time = cur_time; + }else { + psecuritypriv->last_mic_err_time = jiffies; + } + } + +if (bgroup) + key_type |=NL80211_KEYTYPE_GROUP ; +else + key_type |=NL80211_KEYTYPE_PAIRWISE ; + +cfg80211_michael_mic_failure (padapter->pnetdev, (u8 *)&pmlmepriv->assoc_bssid[0 ], key_type,-1 , +NULL ,GFP_ATOMIC ); + +memset (&ev,0x00 ,sizeof (ev)); +if (bgroup) + ev.flags |=IW_MICFAILURE_GROUP ; +else + ev.flags |=IW_MICFAILURE_PAIRWISE ; + + ev.src_addr.sa_family =ARPHRD_ETHER ; +memcpy (ev.src_addr.sa_data, &pmlmepriv->assoc_bssid[0 ],ETH_ALEN ); + +memset (&wrqu,0x00 ,sizeof (wrqu)); + wrqu.data.length =sizeof (ev); +} +static signed int recvframe_chkmic (struct adapter *adapter,union recv_frame *precvframe) {
drivers/staging/rtl8723bs/include/recv_osdep.h +0 -2
@@ -15,8 +15,6 @@ extern void _rtw_free_recv_priv(struct recv_priv *precvpriv);extern s32 rtw_recv_entry (union recv_frame *precv_frame);extern void rtw_recv_returnpacket (struct net_device *cnxt,struct sk_buff *preturnedpkt); -extern void rtw_handle_tkip_mic_err (struct adapter *padapter,u8 bgroup); -int rtw_init_recv_priv (struct recv_priv *precvpriv,struct adapter *padapter);void rtw_free_recv_priv (struct recv_priv *precvpriv);
drivers/staging/rtl8723bs/os_dep/recv_linux.c +0 -44
47 lines not on this page · raw message
Signature · 1 line
2.51.0
PATCH 4/13 staging: rtl8723bs: merge rtw_os_free_recvframe into rtw_recv.c
In reply to Michael StraubeMerge the functionality of rtw_os_free_recvframe in os_dep/recv_linux.c into rtw_free_recvframe in core/rtw_recv.c to reduce code in the os_dep directory.
--- drivers/staging/rtl8723bs/core/rtw_recv.c | 6 ++++-- drivers/staging/rtl8723bs/include/recv_osdep.h | 4 ---- drivers/staging/rtl8723bs/os_dep/recv_linux.c | 9 --------- 3 files changed, 4 insertions(+), 15 deletions(-)
drivers/staging/rtl8723bs/core/rtw_recv.c +4 -2
@@ -147,8 +147,10 @@ int rtw_free_recvframe(union recv_frame *precvframe, struct __queue *pfree_recv_struct adapter *padapter = precvframe->u.hdr.adapter;struct recv_priv *precvpriv = &padapter->recvpriv; -rtw_os_free_recvframe (precvframe); - +if (precvframe->u.hdr.pkt) { +dev_kfree_skb_any (precvframe->u.hdr.pkt);/* free skb by driver */ + precvframe->u.hdr.pkt =NULL ; + }spin_lock_bh (&pfree_recv_queue->lock);
drivers/staging/rtl8723bs/include/recv_osdep.h +0 -4
@@ -22,10 +22,6 @@ void rtw_free_recv_priv(struct recv_priv *precvpriv);void rtw_os_recv_resource_alloc (struct adapter *padapter,union recv_frame *precvframe);void rtw_os_recv_resource_free (struct recv_priv *precvpriv); - -void rtw_os_free_recvframe (union recv_frame *precvframe); - -void rtw_os_recvbuf_resource_free (struct adapter *padapter,struct recv_buf *precvbuf);struct sk_buff *rtw_os_alloc_msdu_pkt (union recv_frame *prframe,u16 nSubframe_Length,u8 *pdata);
drivers/staging/rtl8723bs/os_dep/recv_linux.c +0 -9
@@ -9,15 +9,6 @@#include <net/cfg80211.h> #include <linux/unaligned.h> -void rtw_os_free_recvframe (union recv_frame *precvframe) -{ -if (precvframe->u.hdr.pkt) { -dev_kfree_skb_any (precvframe->u.hdr.pkt);/* free skb by driver */ - - precvframe->u.hdr.pkt =NULL ; - } -} -/* alloc os related resource in union recv_frame */ void rtw_os_recv_resource_alloc (struct adapter *padapter,union recv_frame *precvframe) {
Signature · 1 line
2.51.0
PATCH 5/13 staging: rtl8723bs: merge rtw_os_recv_resource_alloc into rtw_recv.c
In reply to Michael StraubeMerge the functionality of rtw_os_recv_resource_alloc into _rtw_init_recv_priv to reduce code in the os_dep directory.
--- drivers/staging/rtl8723bs/core/rtw_recv.c | 3 ++- drivers/staging/rtl8723bs/include/recv_osdep.h | 1 - drivers/staging/rtl8723bs/os_dep/recv_linux.c | 6 ------ 3 files changed, 2 insertions(+), 8 deletions(-)
drivers/staging/rtl8723bs/core/rtw_recv.c +2 -1
@@ -66,7 +66,8 @@ signed int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padalist_add_tail (&(precvframe->u.list), &(precvpriv->free_recv_queue.queue)); -rtw_os_recv_resource_alloc (padapter, precvframe); + precvframe->u.hdr.pkt_newalloc =NULL ; + precvframe->u.hdr.pkt =NULL ; precvframe->u.hdr.len =0 ;
drivers/staging/rtl8723bs/include/recv_osdep.h +0 -1
@@ -19,7 +19,6 @@ int rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter);void rtw_free_recv_priv (struct recv_priv *precvpriv); -void rtw_os_recv_resource_alloc (struct adapter *padapter,union recv_frame *precvframe);void rtw_os_recv_resource_free (struct recv_priv *precvpriv);void rtw_os_recvbuf_resource_free (struct adapter *padapter,struct recv_buf *precvbuf);
drivers/staging/rtl8723bs/os_dep/recv_linux.c +0 -6
@@ -9,12 +9,6 @@#include <net/cfg80211.h> #include <linux/unaligned.h> -/* alloc os related resource in union recv_frame */ -void rtw_os_recv_resource_alloc (struct adapter *padapter,union recv_frame *precvframe) -{ - precvframe->u.hdr.pkt_newalloc = precvframe->u.hdr.pkt =NULL ; -} -/* free os related resource in union recv_frame */ void rtw_os_recv_resource_free (struct recv_priv *precvpriv) {
Signature · 1 line
2.51.0
PATCH 6/13 staging: rtl8723bs: merge rtw_os_recv_resource_free into rtw_recv.c
In reply to Michael StraubeMerge the functionality of rtw_os_recv_resource_free in os_dep/recv_linux.c into _rtw_free_recv_priv in core/rtw_recv.c to reduce code in the os_dep directory.
--- drivers/staging/rtl8723bs/core/rtw_recv.c | 13 ++++++++++++- drivers/staging/rtl8723bs/include/recv_osdep.h | 3 --- drivers/staging/rtl8723bs/os_dep/recv_linux.c | 18 ------------------ 3 files changed, 12 insertions(+), 22 deletions(-)
drivers/staging/rtl8723bs/core/rtw_recv.c +12 -1
@@ -91,11 +91,22 @@ signed int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padavoid _rtw_free_recv_priv (struct recv_priv *precvpriv) { +signed int i; +union recv_frame *precvframe;struct adapter *padapter = precvpriv->adapter;rtw_free_uc_swdec_pending_queue (padapter); -rtw_os_recv_resource_free (precvpriv); + precvframe = (union recv_frame *)precvpriv->precv_frame_buf; + +for (i =0 ; i <NR_RECVFRAME ; i++) { +if (precvframe->u.hdr.pkt) { +/* free skb by driver */ +dev_kfree_skb_any (precvframe->u.hdr.pkt); + precvframe->u.hdr.pkt =NULL ; + } + precvframe++; + }vfree (precvpriv->pallocated_frame_buf);
drivers/staging/rtl8723bs/include/recv_osdep.h +0 -3
@@ -18,9 +18,6 @@ extern void rtw_recv_returnpacket(struct net_device *cnxt, struct sk_buff *pretuint rtw_init_recv_priv (struct recv_priv *precvpriv,struct adapter *padapter);void rtw_free_recv_priv (struct recv_priv *precvpriv); - -void rtw_os_recv_resource_free (struct recv_priv *precvpriv); -void rtw_os_recvbuf_resource_free (struct adapter *padapter,struct recv_buf *precvbuf);struct sk_buff *rtw_os_alloc_msdu_pkt (union recv_frame *prframe,u16 nSubframe_Length,u8 *pdata);
drivers/staging/rtl8723bs/os_dep/recv_linux.c +0 -18
@@ -9,24 +9,6 @@#include <net/cfg80211.h> #include <linux/unaligned.h> -/* free os related resource in union recv_frame */ -void rtw_os_recv_resource_free (struct recv_priv *precvpriv) -{ -signed int i; -union recv_frame *precvframe; - - precvframe = (union recv_frame *) precvpriv->precv_frame_buf; - -for (i =0 ; i <NR_RECVFRAME ; i++) { -if (precvframe->u.hdr.pkt) { -/* free skb by driver */ -dev_kfree_skb_any (precvframe->u.hdr.pkt); - precvframe->u.hdr.pkt =NULL ; - } - precvframe++; - } -} -/* free os related resource in struct recv_buf */ void rtw_os_recvbuf_resource_free (struct adapter *padapter,struct recv_buf *precvbuf) {
Signature · 1 line
2.51.0
PATCH 7/13 staging: rtl8723bs: merge rtw_os_recvbuf_resource_free into rtl8723bs_recv.c
In reply to Michael StraubeMerge rtw_os_recvbuf_resource_free into rtl8723bs_init_recv_priv and into rtl8723bs_free_recv_priv to reduce code in the os_dep directory.
--- drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c | 6 ++++-- drivers/staging/rtl8723bs/include/recv_osdep.h | 2 -- drivers/staging/rtl8723bs/os_dep/recv_linux.c | 7 ------- 3 files changed, 4 insertions(+), 11 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c +4 -2
@@ -431,7 +431,8 @@ s32 rtl8723bs_init_recv_priv(struct adapter *padapter) precvpriv->free_recv_buf_queue_cnt =0 ;for (i =0 ; i < n ; i++) {list_del_init (&precvbuf->list); -rtw_os_recvbuf_resource_free (padapter, precvbuf); +if (precvbuf->pskb) +dev_kfree_skb_any (precvbuf->pskb); precvbuf++; } precvpriv->precv_buf =NULL ;
@@ -467,7 +468,8 @@ void rtl8723bs_free_recv_priv(struct adapter *padapter) precvpriv->free_recv_buf_queue_cnt =0 ;for (i =0 ; i <NR_RECVBUFF ; i++) {list_del_init (&precvbuf->list); -rtw_os_recvbuf_resource_free (padapter, precvbuf); +if (precvbuf->pskb) +dev_kfree_skb_any (precvbuf->pskb); precvbuf++; } precvpriv->precv_buf =NULL ;
drivers/staging/rtl8723bs/include/recv_osdep.h +0 -2
@@ -18,8 +18,6 @@ extern void rtw_recv_returnpacket(struct net_device *cnxt, struct sk_buff *pretuint rtw_init_recv_priv (struct recv_priv *precvpriv,struct adapter *padapter);void rtw_free_recv_priv (struct recv_priv *precvpriv); -void rtw_os_recvbuf_resource_free (struct adapter *padapter,struct recv_buf *precvbuf); -struct sk_buff *rtw_os_alloc_msdu_pkt (union recv_frame *prframe,u16 nSubframe_Length,u8 *pdata);void rtw_os_recv_indicate_pkt (struct adapter *padapter,struct sk_buff *pkt,struct rx_pkt_attrib *pattrib);
drivers/staging/rtl8723bs/os_dep/recv_linux.c +0 -7
@@ -9,13 +9,6 @@#include <net/cfg80211.h> #include <linux/unaligned.h> -/* free os related resource in struct recv_buf */ -void rtw_os_recvbuf_resource_free (struct adapter *padapter,struct recv_buf *precvbuf) -{ -if (precvbuf->pskb) -dev_kfree_skb_any (precvbuf->pskb); -} -struct sk_buff *rtw_os_alloc_msdu_pkt (union recv_frame *prframe,u16 nSubframe_Length,u8 *pdata) {u16 eth_type;
Signature · 1 line
2.51.0
PATCH 8/13 staging: rtl8723bs: move rtw_os_alloc_msdu_pkt to rtw_recv.c
In reply to Michael StraubeMove the function rtw_os_alloc_msdu_pkt from os_dep/recv_linux.c to core/rtw_recv.c to reduce code in the os_dep directory.
--- drivers/staging/rtl8723bs/core/rtw_recv.c | 40 +++++++++++++++++++ .../staging/rtl8723bs/include/recv_osdep.h | 1 - drivers/staging/rtl8723bs/os_dep/recv_linux.c | 40 ------------------- 3 files changed, 40 insertions(+), 41 deletions(-)
drivers/staging/rtl8723bs/core/rtw_recv.c +40 -0
@@ -1622,6 +1622,46 @@ static signed int wlanhdr_to_ethhdr(union recv_frame *precvframe)return _SUCCESS; } +static struct sk_buff *rtw_os_alloc_msdu_pkt (union recv_frame *prframe,u16 nSubframe_Length,u8 *pdata) +{ +u16 eth_type; +struct sk_buff *sub_skb; +struct rx_pkt_attrib *pattrib; + + pattrib = &prframe->u.hdr.attrib; + + sub_skb =rtw_skb_alloc (nSubframe_Length +12 ); +if (!sub_skb) +return NULL ; + +skb_reserve (sub_skb,12 ); +skb_put_data (sub_skb, (pdata +ETH_HLEN ), nSubframe_Length); + + eth_type =get_unaligned_be16 (&sub_skb->data[6 ]); + +if (sub_skb->len >=8 && + ((!memcmp (sub_skb->data, rfc1042_header,SNAP_SIZE ) && + eth_type !=ETH_P_AARP && eth_type !=ETH_P_IPX ) || + !memcmp (sub_skb->data, bridge_tunnel_header,SNAP_SIZE ))) { +/* +* remove RFC1042 or Bridge-Tunnel encapsulation and replace +* EtherType +*/ +skb_pull (sub_skb,SNAP_SIZE ); +memcpy (skb_push (sub_skb,ETH_ALEN ), pattrib->src,ETH_ALEN ); +memcpy (skb_push (sub_skb,ETH_ALEN ), pattrib->dst,ETH_ALEN ); + }else { +__be16 len; +/* Leave Ethernet header part of hdr and full payload */ + len =htons (sub_skb->len); +memcpy (skb_push (sub_skb,2 ), &len,2 ); +memcpy (skb_push (sub_skb,ETH_ALEN ), pattrib->src,ETH_ALEN ); +memcpy (skb_push (sub_skb,ETH_ALEN ), pattrib->dst,ETH_ALEN ); + } + +return sub_skb; +} +static int amsdu_to_msdu (struct adapter *padapter,union recv_frame *prframe) {int a_len, padding_len;
drivers/staging/rtl8723bs/include/recv_osdep.h +0 -1
@@ -18,7 +18,6 @@ extern void rtw_recv_returnpacket(struct net_device *cnxt, struct sk_buff *pretuint rtw_init_recv_priv (struct recv_priv *precvpriv,struct adapter *padapter);void rtw_free_recv_priv (struct recv_priv *precvpriv); -struct sk_buff *rtw_os_alloc_msdu_pkt (union recv_frame *prframe,u16 nSubframe_Length,u8 *pdata);void rtw_os_recv_indicate_pkt (struct adapter *padapter,struct sk_buff *pkt,struct rx_pkt_attrib *pattrib);#endif /* */
drivers/staging/rtl8723bs/os_dep/recv_linux.c +0 -40
@@ -9,46 +9,6 @@#include <net/cfg80211.h> #include <linux/unaligned.h> -struct sk_buff *rtw_os_alloc_msdu_pkt (union recv_frame *prframe,u16 nSubframe_Length,u8 *pdata) -{ -u16 eth_type; -struct sk_buff *sub_skb; -struct rx_pkt_attrib *pattrib; - - pattrib = &prframe->u.hdr.attrib; - - sub_skb =rtw_skb_alloc (nSubframe_Length +12 ); -if (!sub_skb) -return NULL ; - -skb_reserve (sub_skb,12 ); -skb_put_data (sub_skb, (pdata +ETH_HLEN ), nSubframe_Length); - - eth_type =get_unaligned_be16 (&sub_skb->data[6 ]); - -if (sub_skb->len >=8 && - ((!memcmp (sub_skb->data, rfc1042_header,SNAP_SIZE ) && - eth_type !=ETH_P_AARP && eth_type !=ETH_P_IPX ) || - !memcmp (sub_skb->data, bridge_tunnel_header,SNAP_SIZE ))) { -/* -* remove RFC1042 or Bridge-Tunnel encapsulation and replace -* EtherType -*/ -skb_pull (sub_skb,SNAP_SIZE ); -memcpy (skb_push (sub_skb,ETH_ALEN ), pattrib->src,ETH_ALEN ); -memcpy (skb_push (sub_skb,ETH_ALEN ), pattrib->dst,ETH_ALEN ); - }else { -__be16 len; -/* Leave Ethernet header part of hdr and full payload */ - len =htons (sub_skb->len); -memcpy (skb_push (sub_skb,2 ), &len,2 ); -memcpy (skb_push (sub_skb,ETH_ALEN ), pattrib->src,ETH_ALEN ); -memcpy (skb_push (sub_skb,ETH_ALEN ), pattrib->dst,ETH_ALEN ); - } - -return sub_skb; -} -void rtw_os_recv_indicate_pkt (struct adapter *padapter,struct sk_buff *pkt,struct rx_pkt_attrib *pattrib) {struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
Signature · 1 line
2.51.0
PATCH 9/13 staging: rtl8723bs: rename rtw_os_alloc_msdu_pkt
In reply to Michael StraubeRename rtw_os_alloc_msdu_pkt to rtw_alloc_msdu_pkt as the _os_ indicates operating system dependent code which is unnecessary for in-tree linux kernel code.
--- drivers/staging/rtl8723bs/core/rtw_recv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/core/rtw_recv.c +2 -2
@@ -1622,7 +1622,7 @@ static signed int wlanhdr_to_ethhdr(union recv_frame *precvframe)return _SUCCESS; } -static struct sk_buff *rtw_os_alloc_msdu_pkt (union recv_frame *prframe,u16 nSubframe_Length,u8 *pdata) +static struct sk_buff *rtw_alloc_msdu_pkt (union recv_frame *prframe,u16 nSubframe_Length,u8 *pdata) {u16 eth_type;struct sk_buff *sub_skb;
@@ -1691,7 +1691,7 @@ static int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe)if (a_len <ETH_HLEN + nSubframe_Length)break ; - sub_pkt =rtw_os_alloc_msdu_pkt (prframe, nSubframe_Length, pdata); + sub_pkt =rtw_alloc_msdu_pkt (prframe, nSubframe_Length, pdata);if (!sub_pkt)break ;
Signature · 1 line
2.51.0
PATCH 10/13 staging: rtl8723bs: move rtw_os_recv_indicate_pkt to rtw_recv.c
In reply to Michael StraubeMove the function rtw_os_recv_indicate_pkt from os_dep/recv_linux.c to core/rtw_recv.c to reduce code in the os_dep directory.
--- drivers/staging/rtl8723bs/core/rtw_recv.c | 47 +++++++++++++++++++ .../staging/rtl8723bs/include/recv_osdep.h | 2 - drivers/staging/rtl8723bs/os_dep/recv_linux.c | 45 ------------------ 3 files changed, 47 insertions(+), 47 deletions(-)
drivers/staging/rtl8723bs/core/rtw_recv.c +47 -0
@@ -1662,6 +1662,53 @@ static struct sk_buff *rtw_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubfrareturn sub_skb; } +static void rtw_os_recv_indicate_pkt (struct adapter *padapter,struct sk_buff *pkt,struct rx_pkt_attrib *pattrib) +{ +struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + +/* Indicate the packets to upper layer */ +if (pkt) { +if (check_fwstate (pmlmepriv,WIFI_AP_STATE ) == true) { +struct sk_buff *pskb2 =NULL ; +struct sta_info *psta =NULL ; +struct sta_priv *pstapriv = &padapter->stapriv; +int bmcast =is_multicast_ether_addr (pattrib->dst); + +if (memcmp (pattrib->dst,myid (&padapter->eeprompriv),ETH_ALEN )) { +if (bmcast) { + psta =rtw_get_bcmc_stainfo (padapter); + pskb2 =skb_clone (pkt,GFP_ATOMIC ); + }else { + psta =rtw_get_stainfo (pstapriv, pattrib->dst); + } + +if (psta) { +struct net_device *pnetdev = (struct net_device *)padapter->pnetdev; +/* skb->ip_summed = CHECKSUM_NONE; */ + pkt->dev = pnetdev; +skb_set_queue_mapping (pkt,rtw_recv_select_queue (pkt)); + +_rtw_xmit_entry (pkt, pnetdev); + +if (bmcast && pskb2) + pkt = pskb2; +else +return ; + } + }else { +/* to APself */ + } + } + + pkt->protocol =eth_type_trans (pkt, padapter->pnetdev); + pkt->dev = padapter->pnetdev; + + pkt->ip_summed =CHECKSUM_NONE ; + +rtw_netif_rx (padapter->pnetdev, pkt); + } +} +static int amsdu_to_msdu (struct adapter *padapter,union recv_frame *prframe) {int a_len, padding_len;
drivers/staging/rtl8723bs/include/recv_osdep.h +0 -2
@@ -18,6 +18,4 @@ extern void rtw_recv_returnpacket(struct net_device *cnxt, struct sk_buff *pretuint rtw_init_recv_priv (struct recv_priv *precvpriv,struct adapter *padapter);void rtw_free_recv_priv (struct recv_priv *precvpriv); -void rtw_os_recv_indicate_pkt (struct adapter *padapter,struct sk_buff *pkt,struct rx_pkt_attrib *pattrib); -#endif /* */
drivers/staging/rtl8723bs/os_dep/recv_linux.c +0 -45
49 lines not on this page · raw message
Signature · 1 line
2.51.0
PATCH 11/13 staging: rtl8723bs: rename rtw_os_recv_indicate_pkt
In reply to Michael StraubeRename rtw_os_recv_indicate_pkt to rtw_recv_indicate_pkt as the _os_ indicates operating system dependent code which is unnecessary for in-tree linux kernel code.
--- drivers/staging/rtl8723bs/core/rtw_recv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8723bs/core/rtw_recv.c +3 -3
@@ -1662,7 +1662,7 @@ static struct sk_buff *rtw_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubfrareturn sub_skb; } -static void rtw_os_recv_indicate_pkt (struct adapter *padapter,struct sk_buff *pkt,struct rx_pkt_attrib *pattrib) +static void rtw_recv_indicate_pkt (struct adapter *padapter,struct sk_buff *pkt,struct rx_pkt_attrib *pattrib) {struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -1771,7 +1771,7 @@ static int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe)/* Indicate the packets to upper layer */ if (sub_pkt) -rtw_os_recv_indicate_pkt (padapter, sub_pkt, &prframe->u.hdr.attrib); +rtw_recv_indicate_pkt (padapter, sub_pkt, &prframe->u.hdr.attrib); } prframe->u.hdr.len =0 ;
@@ -1890,7 +1890,7 @@ static int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *prec skb->len = precv_frame->u.hdr.len; -rtw_os_recv_indicate_pkt (padapter, skb, pattrib); +rtw_recv_indicate_pkt (padapter, skb, pattrib);/* pointers to NULL before rtw_free_recvframe() */ precv_frame->u.hdr.pkt =NULL ;
Signature · 1 line
2.51.0
PATCH 12/13 staging: rtl8723bs: remove os_dep/recv_linux.c
In reply to Michael StraubeAfter previous patches the file os_dep/recv_linux.c is empty now and we can remove it.
--- drivers/staging/rtl8723bs/Makefile | 1 - drivers/staging/rtl8723bs/os_dep/recv_linux.c | 12 ------------ 2 files changed, 13 deletions(-) delete mode 100644 drivers/staging/rtl8723bs/os_dep/recv_linux.c
drivers/staging/rtl8723bs/Makefile +0 -1
@@ -50,7 +50,6 @@ r8723bs-y = \ os_dep/ioctl_cfg80211.o \ os_dep/osdep_service.o \ os_dep/os_intfs.o \ - os_dep/recv_linux.o \ os_dep/sdio_intf.o \ os_dep/sdio_ops_linux.o \ os_dep/wifi_regd.o \
drivers/staging/rtl8723bs/os_dep/recv_linux.c deleted +0 -12
@@ -1,12 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/****************************************************************************** -* -* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. -* -******************************************************************************/ -#include <drv_types.h> -#include <linux/jiffies.h> -#include <net/cfg80211.h> -#include <linux/unaligned.h> - -
Signature · 1 line
2.51.0
PATCH 13/13 staging: rtl8723bs: remove include/recv_osdep.h
In reply to Michael StraubeMove still needed function prototypes defined in the recv_osdep.h header to rtw_recv.h and remove the now obsolete recv_osdep.h.
--- drivers/staging/rtl8723bs/include/drv_types.h | 1 - .../staging/rtl8723bs/include/recv_osdep.h | 21 ------------------- drivers/staging/rtl8723bs/include/rtw_recv.h | 4 ++++ 3 files changed, 4 insertions(+), 22 deletions(-) delete mode 100644 drivers/staging/rtl8723bs/include/recv_osdep.h
drivers/staging/rtl8723bs/include/drv_types.h +0 -1
@@ -33,7 +33,6 @@#include <xmit_osdep.h> #include <rtw_recv.h> -#include <recv_osdep.h> #include <rtw_efuse.h> #include <hal_intf.h> #include <hal_com.h>
drivers/staging/rtl8723bs/include/recv_osdep.h deleted +0 -21
@@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/****************************************************************************** -* -* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. -* -******************************************************************************/ -#ifndef __RECV_OSDEP_H_ -#define __RECV_OSDEP_H_ - - -extern signed int _rtw_init_recv_priv (struct recv_priv *precvpriv,struct adapter *padapter); -extern void _rtw_free_recv_priv (struct recv_priv *precvpriv); - - -extern s32 rtw_recv_entry (union recv_frame *precv_frame); -extern void rtw_recv_returnpacket (struct net_device *cnxt,struct sk_buff *preturnedpkt); - -int rtw_init_recv_priv (struct recv_priv *precvpriv,struct adapter *padapter); -void rtw_free_recv_priv (struct recv_priv *precvpriv); - -#endif /* */
drivers/staging/rtl8723bs/include/rtw_recv.h +4 -0
@@ -342,6 +342,10 @@ struct recv_buf *rtw_dequeue_recvbuf(struct __queue *queue);void rtw_reordering_ctrl_timeout_handler (struct timer_list *t); +signed int _rtw_init_recv_priv (struct recv_priv *precvpriv,struct adapter *padapter); +void _rtw_free_recv_priv (struct recv_priv *precvpriv); +s32 rtw_recv_entry (union recv_frame *precv_frame); +static inline u8 *get_rxmem (union recv_frame *precvframe) {/* always return rx_head... */
Signature · 1 line
2.51.0
Hi,
Quoted 14 lines · Michael Straube
This series moves/merges the functions/functionality of
os_dep/recv_linux.cinto the corresponding parts of the driver in the core directory to reduce "os dependent" code.The patches have been compile-tested only due to lack of hardware.
Michael Straube (13):
staging: rtl8723bs: remove wrapperrtw_init_recv_timer
staging: rtl8723bs: movertw_recv_indicatepkttortw_recv.c
staging: rtl8723bs: movertw_handle_tkip_mic_errtortw_recv.c
staging: rtl8723bs: mergertw_os_free_recvframeintortw_recv.c
staging: rtl8723bs: mergertw_os_recv_resource_allocintortw_recv.c
staging: rtl8723bs: mergertw_os_recv_resource_freeintortw_recv.c
staging: rtl8723bs: mergertw_os_recvbuf_resource_freeinto
Quoted 7 lines
rtl8723bs_recv.cstaging: rtl8723bs: move
rtw_os_alloc_msdu_pkttortw_recv.c
staging: rtl8723bs: renamertw_os_alloc_msdu_pkt
staging: rtl8723bs: movertw_os_recv_indicate_pkttortw_recv.c
staging: rtl8723bs: renamertw_os_recv_indicate_pkt
staging: rtl8723bs: removeos_dep/recv_linux.c
staging: rtl8723bs: removeinclude/recv_osdep.h
Thanks, series looks good to me:
for the series.
Regards,
Hans