Commit 69a0f974 authored by Jes Sorensen's avatar Jes Sorensen Committed by Greg Kroah-Hartman

staging: rtl8723au: Make rtw_xmitframe_coalesce23a() more readable

Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e59cb424
...@@ -1123,24 +1123,25 @@ s32 rtw_xmitframe_coalesce23a(struct rtw_adapter *padapter, struct sk_buff *pkt, ...@@ -1123,24 +1123,25 @@ s32 rtw_xmitframe_coalesce23a(struct rtw_adapter *padapter, struct sk_buff *pkt,
s32 bmcst = is_multicast_ether_addr(pattrib->ra); s32 bmcst = is_multicast_ether_addr(pattrib->ra);
s32 res = _SUCCESS; s32 res = _SUCCESS;
if (pattrib->psta) { if (pattrib->psta)
psta = pattrib->psta; psta = pattrib->psta;
} else { else {
DBG_8723A("%s, call rtw_get_stainfo23a()\n", __func__); DBG_8723A("%s, call rtw_get_stainfo23a()\n", __func__);
psta = rtw_get_stainfo23a(&padapter->stapriv, pattrib->ra); psta = rtw_get_stainfo23a(&padapter->stapriv, pattrib->ra);
} }
if (psta == NULL) { if (!psta) {
DBG_8723A("%s, psta == NUL\n", __func__); DBG_8723A("%s, psta == NUL\n", __func__);
return _FAIL; return _FAIL;
} }
if (!(psta->state &_FW_LINKED)) { if (!(psta->state &_FW_LINKED)) {
DBG_8723A("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, psta->state); DBG_8723A("%s, psta->state(0x%x) != _FW_LINKED\n",
__func__, psta->state);
return _FAIL; return _FAIL;
} }
if (pxmitframe->buf_addr == NULL) { if (!pxmitframe->buf_addr) {
DBG_8723A("==> %s buf_addr == NULL\n", __func__); DBG_8723A("==> %s buf_addr == NULL\n", __func__);
return _FAIL; return _FAIL;
} }
...@@ -1179,23 +1180,30 @@ s32 rtw_xmitframe_coalesce23a(struct rtw_adapter *padapter, struct sk_buff *pkt, ...@@ -1179,23 +1180,30 @@ s32 rtw_xmitframe_coalesce23a(struct rtw_adapter *padapter, struct sk_buff *pkt,
/* adding icv, if necessary... */ /* adding icv, if necessary... */
if (pattrib->iv_len) { if (pattrib->iv_len) {
if (psta != NULL) { if (psta) {
switch (pattrib->encrypt) { switch (pattrib->encrypt) {
case _WEP40_: case _WEP40_:
case _WEP104_: case _WEP104_:
WEP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); WEP_IV(pattrib->iv, psta->dot11txpn,
pattrib->key_idx);
break; break;
case _TKIP_: case _TKIP_:
if (bmcst) if (bmcst)
TKIP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); TKIP_IV(pattrib->iv,
psta->dot11txpn,
pattrib->key_idx);
else else
TKIP_IV(pattrib->iv, psta->dot11txpn, 0); TKIP_IV(pattrib->iv,
psta->dot11txpn, 0);
break; break;
case _AES_: case _AES_:
if (bmcst) if (bmcst)
AES_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); AES_IV(pattrib->iv,
psta->dot11txpn,
pattrib->key_idx);
else else
AES_IV(pattrib->iv, psta->dot11txpn, 0); AES_IV(pattrib->iv,
psta->dot11txpn, 0);
break; break;
} }
} }
...@@ -1217,14 +1225,16 @@ s32 rtw_xmitframe_coalesce23a(struct rtw_adapter *padapter, struct sk_buff *pkt, ...@@ -1217,14 +1225,16 @@ s32 rtw_xmitframe_coalesce23a(struct rtw_adapter *padapter, struct sk_buff *pkt,
mpdu_len -= llc_sz; mpdu_len -= llc_sz;
} }
if ((pattrib->icv_len >0) && (pattrib->bswenc)) if (pattrib->icv_len > 0 && pattrib->bswenc)
mpdu_len -= pattrib->icv_len; mpdu_len -= pattrib->icv_len;
if (bmcst) { if (bmcst) {
/* don't do fragment to broadcat/multicast packets */ /* don't do fragment to broadcat/multicast packets */
mem_sz = _rtw_pktfile_read23a(&pktfile, pframe, pattrib->pktlen); mem_sz = _rtw_pktfile_read23a(&pktfile, pframe,
pattrib->pktlen);
} else { } else {
mem_sz = _rtw_pktfile_read23a(&pktfile, pframe, mpdu_len); mem_sz = _rtw_pktfile_read23a(&pktfile, pframe,
mpdu_len);
} }
pframe += mem_sz; pframe += mem_sz;
...@@ -1235,7 +1245,7 @@ s32 rtw_xmitframe_coalesce23a(struct rtw_adapter *padapter, struct sk_buff *pkt, ...@@ -1235,7 +1245,7 @@ s32 rtw_xmitframe_coalesce23a(struct rtw_adapter *padapter, struct sk_buff *pkt,
frg_inx++; frg_inx++;
if (bmcst || (rtw_endofpktfile23a(&pktfile))) { if (bmcst || rtw_endofpktfile23a(&pktfile)) {
pattrib->nr_frags = frg_inx; pattrib->nr_frags = frg_inx;
pattrib->last_txcmdsz = pattrib->hdrlen + pattrib->last_txcmdsz = pattrib->hdrlen +
...@@ -1249,16 +1259,18 @@ s32 rtw_xmitframe_coalesce23a(struct rtw_adapter *padapter, struct sk_buff *pkt, ...@@ -1249,16 +1259,18 @@ s32 rtw_xmitframe_coalesce23a(struct rtw_adapter *padapter, struct sk_buff *pkt,
break; break;
} else { } else {
RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("%s: There're still something in packet!\n", __func__)); RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_,
("%s: There're still something in packet!\n",
__func__));
} }
mem_start = PTR_ALIGN(pframe, 4) + hw_hdr_offset; mem_start = PTR_ALIGN(pframe, 4) + hw_hdr_offset;
memcpy(mem_start, pbuf_start + hw_hdr_offset, pattrib->hdrlen); memcpy(mem_start, pbuf_start + hw_hdr_offset, pattrib->hdrlen);
} }
if (xmitframe_addmic(padapter, pxmitframe) == _FAIL) { if (xmitframe_addmic(padapter, pxmitframe) == _FAIL) {
RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("xmitframe_addmic(padapter, pxmitframe) == _FAIL\n")); RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_,
("xmitframe_addmic(padapter, pxmitframe) == _FAIL\n"));
DBG_8723A("xmitframe_addmic(padapter, pxmitframe) == _FAIL\n"); DBG_8723A("xmitframe_addmic(padapter, pxmitframe) == _FAIL\n");
res = _FAIL; res = _FAIL;
goto exit; goto exit;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment