mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-11 00:40:19 +08:00
staging: rtl8723bs: move rtw_os_alloc_msdu_pkt to rtw_recv.c
Move 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. Signed-off-by: Michael Straube <straube.linux@gmail.com> Reviewed-by: Hans de Goede <hansg@kernel.org> Link: https://lore.kernel.org/r/20250822135418.118115-9-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
10bcaf9ccc
commit
f44d85d5a2
@@ -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;
|
||||
|
||||
@@ -18,7 +18,6 @@ extern void rtw_recv_returnpacket(struct net_device *cnxt, struct sk_buff *pretu
|
||||
int 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 /* */
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user