[PATCH 08/11] staging: r8188eu: ra and ta do not depend on to_ds, from_ds

From: Martin Kaiser
Date: Sun Apr 03 2022 - 12:55:24 EST


The "DS bit usage" table in include/linux/ieee80211.h shows that
ra is always addr1 and ta is always addr2.

We can set pattrib->ra and pattrib->ta regardless of the to_ds and
from_ds bits.

Signed-off-by: Martin Kaiser <martin@xxxxxxxxx>
---
drivers/staging/r8188eu/core/rtw_recv.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
index 0098f3de31d7..75c0e0b17185 100644
--- a/drivers/staging/r8188eu/core/rtw_recv.c
+++ b/drivers/staging/r8188eu/core/rtw_recv.c
@@ -962,19 +962,15 @@ static int validate_recv_data_frame(struct adapter *adapter,
if (ieee80211_has_a4(hdr->frame_control))
return _FAIL;

- if (ieee80211_has_fromds(hdr->frame_control)) {
- memcpy(pattrib->ra, pda, ETH_ALEN);
- memcpy(pattrib->ta, pbssid, ETH_ALEN);
+ memcpy(pattrib->ra, hdr->addr1, ETH_ALEN);
+ memcpy(pattrib->ta, hdr->addr2, ETH_ALEN);
+
+ if (ieee80211_has_fromds(hdr->frame_control))
ret = ap2sta_data_frame(adapter, precv_frame, &psta);
- } else if (ieee80211_has_tods(hdr->frame_control)) {
- memcpy(pattrib->ra, pbssid, ETH_ALEN);
- memcpy(pattrib->ta, psa, ETH_ALEN);
+ else if (ieee80211_has_tods(hdr->frame_control))
ret = sta2ap_data_frame(adapter, precv_frame, &psta);
- } else {
- memcpy(pattrib->ra, pda, ETH_ALEN);
- memcpy(pattrib->ta, psa, ETH_ALEN);
+ else
ret = sta2sta_data_frame(adapter, precv_frame, &psta);
- }

if (ret == _FAIL || ret == RTW_RX_HANDLED)
return ret;
--
2.30.2