[PATCH 25/37] staging:r8188eu: remove len member of recv_frame structure

From: Ivan Safonov
Date: Wed Oct 19 2016 - 11:06:26 EST


len replaced with pkt->len.

Signed-off-by: Ivan Safonov <insafonov@xxxxxxxxx>
---
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 14 +++++++-------
drivers/staging/rtl8188eu/core/rtw_recv.c | 23 +++++++++--------------
drivers/staging/rtl8188eu/core/rtw_security.c | 6 +++---
drivers/staging/rtl8188eu/include/rtw_recv.h | 6 +-----
drivers/staging/rtl8188eu/os_dep/mon.c | 2 +-
drivers/staging/rtl8188eu/os_dep/recv_linux.c | 9 ++-------
drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 1 -
7 files changed, 23 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index 26639f0..08bb61d 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -2051,7 +2051,7 @@ static u8 collect_bss_info(struct adapter *padapter,
u8 *p;
u16 val16, subtype;
u8 *pframe = precv_frame->pkt->data;
- u32 packet_len = precv_frame->len;
+ u32 packet_len = precv_frame->pkt->len;
u8 ie_offset;
struct registry_priv *pregistrypriv = &padapter->registrypriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
@@ -2558,7 +2558,7 @@ static unsigned int OnProbeReq(struct adapter *padapter,
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
struct wlan_bssid_ex *cur = &(pmlmeinfo->network);
u8 *pframe = precv_frame->pkt->data;
- uint len = precv_frame->len;
+ uint len = precv_frame->pkt->len;

if (check_fwstate(pmlmepriv, WIFI_STATION_STATE))
return _SUCCESS;
@@ -2606,7 +2606,7 @@ static unsigned int OnBeacon(struct adapter *padapter,
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct sta_priv *pstapriv = &padapter->stapriv;
u8 *pframe = precv_frame->pkt->data;
- uint len = precv_frame->len;
+ uint len = precv_frame->pkt->len;
struct wlan_bssid_ex *pbss;
int ret = _SUCCESS;
struct wlan_bssid_ex *pnetwork = &(pmlmeinfo->network);
@@ -2703,7 +2703,7 @@ static unsigned int OnAuth(struct adapter *padapter,
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
u8 *pframe = precv_frame->pkt->data;
- uint len = precv_frame->len;
+ uint len = precv_frame->pkt->len;

if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE)
return _FAIL;
@@ -2866,7 +2866,7 @@ static unsigned int OnAuthClient(struct adapter *padapter,
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
u8 *pframe = precv_frame->pkt->data;
- uint pkt_len = precv_frame->len;
+ uint pkt_len = precv_frame->pkt->len;

DBG_88E("%s\n", __func__);

@@ -2954,7 +2954,7 @@ static unsigned int OnAssocReq(struct adapter *padapter,
struct wlan_bssid_ex *cur = &(pmlmeinfo->network);
struct sta_priv *pstapriv = &padapter->stapriv;
u8 *pframe = precv_frame->pkt->data;
- uint pkt_len = precv_frame->len;
+ uint pkt_len = precv_frame->pkt->len;

if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE)
return _FAIL;
@@ -3386,7 +3386,7 @@ static unsigned int OnAssocRsp(struct adapter *padapter,
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
/* struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network); */
u8 *pframe = precv_frame->pkt->data;
- uint pkt_len = precv_frame->len;
+ uint pkt_len = precv_frame->pkt->len;

DBG_88E("%s\n", __func__);

diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c
index 0a520a2..5e47e25 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -80,7 +80,6 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)
&(precvpriv->free_recv_queue.queue));

precvframe->pkt = NULL;
- precvframe->len = 0;

precvframe->adapter = padapter;
precvframe++;
@@ -149,8 +148,6 @@ int rtw_free_recvframe(struct recv_frame *precvframe,

list_del_init(&(precvframe->list));

- precvframe->len = 0;
-
list_add_tail(&(precvframe->list), get_list_head(pfree_recv_queue));

spin_unlock_bh(&pfree_recv_queue->lock);
@@ -261,7 +258,7 @@ static int recvframe_chkmic(struct adapter *adapter,
}

/* icv_len included the mic code */
- datalen = precvframe->len-prxattrib->hdrlen -
+ datalen = precvframe->pkt->len-prxattrib->hdrlen -
prxattrib->iv_len-prxattrib->icv_len-8;
pframe = precvframe->pkt->data;
payload = pframe+prxattrib->hdrlen+prxattrib->iv_len;
@@ -298,8 +295,8 @@ static int recvframe_chkmic(struct adapter *adapter,
uint i;
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
("\n ======demp packet (len=%d)======\n",
- precvframe->len));
- for (i = 0; i < precvframe->len; i += 8) {
+ precvframe->pkt->len));
+ for (i = 0; i < precvframe->pkt->len; i += 8) {
RT_TRACE(_module_rtl871x_recv_c_,
_drv_err_,
("0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x",
@@ -315,7 +312,7 @@ static int recvframe_chkmic(struct adapter *adapter,
RT_TRACE(_module_rtl871x_recv_c_,
_drv_err_,
("\n ====== demp packet end [len=%d]======\n",
- precvframe->len));
+ precvframe->pkt->len));
RT_TRACE(_module_rtl871x_recv_c_,
_drv_err_,
("\n hrdlen=%d,\n",
@@ -617,7 +614,7 @@ static void count_rx_stats(struct adapter *padapter,
struct rx_pkt_attrib *pattrib = &prframe->attrib;
struct recv_priv *precvpriv = &padapter->recvpriv;

- sz = prframe->len;
+ sz = prframe->pkt->len;
precvpriv->rx_bytes += sz;

padapter->mlmepriv.LinkDetectInfo.NumRxOkInPeriod++;
@@ -1297,7 +1294,7 @@ static int wlanhdr_to_ethhdr(struct recv_frame *precvframe)
}

rmv_len = pattrib->hdrlen + pattrib->iv_len + (bsnaphdr ? SNAP_SIZE : 0);
- len = precvframe->len - rmv_len;
+ len = precvframe->pkt->len - rmv_len;

RT_TRACE(_module_rtl871x_recv_c_, _drv_info_,
("\n===pattrib->hdrlen: %x, pattrib->iv_len:%x===\n\n", pattrib->hdrlen, pattrib->iv_len));
@@ -1381,9 +1378,9 @@ static struct recv_frame *recvframe_defrag(struct adapter *adapter,
recvframe_pull_tail(prframe, pfhdr->attrib.icv_len);

/* memcpy */
- memcpy(pfhdr->pkt->tail, pnfhdr->pkt->data, pnfhdr->len);
+ memcpy(pfhdr->pkt->tail, pnfhdr->pkt->data, pnfhdr->pkt->len);

- recvframe_put(prframe, pnfhdr->len);
+ recvframe_put(prframe, pnfhdr->pkt->len);

pfhdr->attrib.icv_len = pnfhdr->attrib.icv_len;
plist = plist->next;
@@ -1516,7 +1513,7 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe)
if (prframe->attrib.iv_len > 0)
recvframe_pull(prframe, prframe->attrib.iv_len);

- a_len = prframe->len;
+ a_len = prframe->pkt->len;

pdata = prframe->pkt->data;

@@ -1605,8 +1602,6 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe)
}

exit:
-
- prframe->len = 0;
rtw_free_recvframe(prframe, pfree_recv_queue);/* free this recv_frame */

return _SUCCESS;
diff --git a/drivers/staging/rtl8188eu/core/rtw_security.c b/drivers/staging/rtl8188eu/core/rtw_security.c
index d0d2f9a..7dae6f7 100644
--- a/drivers/staging/rtl8188eu/core/rtw_security.c
+++ b/drivers/staging/rtl8188eu/core/rtw_security.c
@@ -213,7 +213,7 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)
keylength = psecuritypriv->dot11DefKeylen[keyindex];
memcpy(&wepkey[0], iv, 3);
memcpy(&wepkey[3], &psecuritypriv->dot11DefKey[keyindex].skey[0], keylength);
- length = ((struct recv_frame *)precvframe)->len-prxattrib->hdrlen-prxattrib->iv_len;
+ length = ((struct recv_frame *)precvframe)->pkt->len-prxattrib->hdrlen-prxattrib->iv_len;

payload = pframe+prxattrib->iv_len+prxattrib->hdrlen;

@@ -672,7 +672,7 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)

iv = pframe+prxattrib->hdrlen;
payload = pframe+prxattrib->iv_len+prxattrib->hdrlen;
- length = ((struct recv_frame *)precvframe)->len-prxattrib->hdrlen-prxattrib->iv_len;
+ length = ((struct recv_frame *)precvframe)->pkt->len-prxattrib->hdrlen-prxattrib->iv_len;

GET_TKIP_PN(iv, dot11txpn);

@@ -1476,7 +1476,7 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
} else {
prwskey = &stainfo->dot118021x_UncstKey.skey[0];
}
- length = ((struct recv_frame *)precvframe)->len-prxattrib->hdrlen-prxattrib->iv_len;
+ length = ((struct recv_frame *)precvframe)->pkt->len-prxattrib->hdrlen-prxattrib->iv_len;
res = aes_decipher(prwskey, prxattrib->hdrlen, pframe, length);
} else {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_aes_encrypt: stainfo==NULL!!!\n"));
diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h b/drivers/staging/rtl8188eu/include/rtw_recv.h
index eab2bef..752c40fe 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -232,7 +232,6 @@ struct recv_frame {
struct sk_buff *pkt;
struct adapter *adapter;
struct rx_pkt_attrib attrib;
- uint len;
struct sta_info *psta;
/* for A-MPDU Rx reordering buffer control */
struct recv_reorder_ctrl *preorder_ctrl;
@@ -268,7 +267,6 @@ static inline u8 *recvframe_pull(struct recv_frame *precvframe, uint sz)
data = skb_pull(precvframe->pkt, sz);
if (!data)
return NULL;
- precvframe->len -= sz;
return data;
}

@@ -286,7 +284,6 @@ static inline u8 *recvframe_put(struct recv_frame *precvframe, uint sz)
tail = skb_put(precvframe->pkt, sz);
if (!tail)
return NULL;
- precvframe->len += sz;
return tail;
}

@@ -301,10 +298,9 @@ static inline void recvframe_pull_tail(struct recv_frame *precvframe, uint sz)
if (precvframe == NULL)
return;

- if (precvframe->len < sz)
+ if (precvframe->pkt->len < sz)
return;
skb_trim(precvframe->pkt, precvframe->pkt->len - sz);
- precvframe->len -= sz;
}

static inline s32 translate_percentage_to_dbm(u32 sig_stren_index)
diff --git a/drivers/staging/rtl8188eu/os_dep/mon.c b/drivers/staging/rtl8188eu/os_dep/mon.c
index 263c6d5..9b3f3ec 100644
--- a/drivers/staging/rtl8188eu/os_dep/mon.c
+++ b/drivers/staging/rtl8188eu/os_dep/mon.c
@@ -93,7 +93,7 @@ void rtl88eu_mon_recv_hook(struct net_device *dev, struct recv_frame *frame)

attr = &frame->attrib;
data = frame->pkt->data;
- data_len = frame->len;
+ data_len = frame->pkt->len;

/* Broadcast and multicast frames don't have attr->{iv,icv}_len set */
SET_ICE_IV_LEN(iv_len, icv_len, attr->encrypt);
diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
index 98b5817..0496348 100644
--- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
@@ -94,14 +94,9 @@ int rtw_recv_indicatepkt(struct adapter *padapter,
("rtw_recv_indicatepkt(): precv_frame->pkt->rx_data =%p\n",
precv_frame->pkt->data));
RT_TRACE(_module_recv_osdep_c_, _drv_info_,
- ("precv_frame->hdr.rx_tail =%p precv_frame->pkt->end =%p precv_frame->hdr.len =%d\n",
+ ("precv_frame->hdr.rx_tail =%p precv_frame->pkt->end =%p precv_frame->pkt->len =%d\n",
precv_frame->pkt->tail, precv_frame->pkt->end,
- precv_frame->len));
-
- skb_set_tail_pointer(skb, precv_frame->len);
-
- skb->len = precv_frame->len;
-
+ precv_frame->pkt->len));
RT_TRACE(_module_recv_osdep_c_, _drv_info_,
("skb->head =%p skb->data =%p skb->tail =%p skb->end =%p skb->len =%d\n",
skb->head, skb->data, skb_tail_pointer(skb),
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
index 3fc4d84..572a89f 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
@@ -73,7 +73,6 @@ static int recvbuf2recvframe(struct adapter *adapt, struct sk_buff *pskb)
}

INIT_LIST_HEAD(&precvframe->list);
- precvframe->len = 0;

update_recvframe_attrib_88e(precvframe, prxstat);

--
2.7.3