Skip to contentSkip to conversation

staging: r8188eu: another round of cleanups

PATCH New Martin Kaiser 1 participant 4 messages Nov 7, 2022 Staging

lore
Share & tools
lore
#0 lore raw

v2 cover staging: r8188eu: another round of cleanups

Here's some more cleanups, mostly related to bSurpriseRemoved and bDriverStopped.

Please apply them after the series I sent yesteday.

Changes in v2
- Fixed the header len calculation in patch 1. Thanks to Dan Carpenter for spotting this mistake.

Martin Kaiser (3):
staging: r8188eu: use a qos_hdr in validate_recv_data_frame
staging: r8188eu: drop another removal/stop check
staging: r8188eu: drop removal/stop check in
dump_mgntframe_and_wait_ack

 drivers/staging/r8188eu/core/rtw_mlme_ext.c | 6 ------
 drivers/staging/r8188eu/core/rtw_recv.c     | 9 +++++----
 2 files changed, 5 insertions(+), 10 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH v2 1/3 staging: r8188eu: use a qos_hdr in validate_recv_data_frame

Define a struct ieee80211_qos_hdr in the validate_recv_data_frame function. Use this struct to replace some numeric offsets and make the code easier to understand.

---
Changes in v2
- fixed hdrlen calculation

 drivers/staging/r8188eu/core/rtw_recv.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/staging/r8188eu/core/rtw_recv.c +5 -4
index cb0f35d7ab98..5b0a66aebff1 100644
@@ -1032,7 +1032,6 @@ static int validate_recv_data_frame(struct adapter *adapter,
 				    struct recv_frame *precv_frame)
 {
 	struct sta_info *psta = NULL;
-	u8 *ptr = precv_frame->rx_data;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)precv_frame->rx_data;
 	struct rx_pkt_attrib	*pattrib = &precv_frame->attrib;
 	struct security_priv	*psecuritypriv = &adapter->securitypriv;
@@ -1071,10 +1070,12 @@ static int validate_recv_data_frame(struct adapter *adapter,
 	pattrib->ack_policy = 0;
 	/* parsing QC field */
 	if (pattrib->qos) {
+		struct ieee80211_qos_hdr *qos_hdr = (struct ieee80211_qos_hdr *)hdr;
+
 		pattrib->priority = ieee80211_get_tid(hdr);
-		pattrib->ack_policy = GetAckpolicy((ptr + 24));
-		pattrib->amsdu = GetAMsdu((ptr + 24));
-		pattrib->hdrlen = 26;
+		pattrib->ack_policy = GetAckpolicy(&qos_hdr->qos_ctrl);
+		pattrib->amsdu = GetAMsdu(&qos_hdr->qos_ctrl);
+		pattrib->hdrlen = sizeof(*qos_hdr);
 
 		if (pattrib->priority != 0 && pattrib->priority != 3)
 			adapter->recvpriv.bIsAnyNonBEPkts = true;
Signature · 1 line
2.30.2
#2 lore raw

PATCH v2 2/3 staging: r8188eu: drop another removal/stop check

In reply to Martin Kaiser

There's no need to check bDriverStopped and bSurpriseRemoved in issue_probereq_ex.

The code path looks like

issue_probereq_ex
_issue_probereq
dump_mgntframe
or
dump_mgntframe_and_wait_ack

All paths from dump_mgntframe check the two variables. dump_mgntframe_and_wait_ack contains a check as well.

---
 drivers/staging/r8188eu/core/rtw_mlme_ext.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme_ext.c +0 -3
index 17803aca83c8..bfd6afd7266e 100644
@@ -4496,9 +4496,6 @@ int issue_probereq_ex(struct adapter *padapter, struct ndis_802_11_ssid *pssid,
 
 		i++;
 
-		if (padapter->bDriverStopped || padapter->bSurpriseRemoved)
-			break;
-
 		if (i < try_cnt && wait_ms > 0 && ret == _FAIL)
 			msleep(wait_ms);
 
Signature · 1 line
2.30.2
#3 lore raw

PATCH v2 3/3 staging: r8188eu: drop removal/stop check in dump_mgntframe_and_wait_ack

In reply to Martin Kaiser

We can remove the checks for bDriverStopped and bSurpriseRemoved in dump_mgntframe_and_wait_ack.

The code path from this function looks like

dump_mgntframe_and_wait_ack
rtl8188eu_mgnt_xmit
rtw_dump_xframe
loop over all fragments

rtw_write_port is called for each fragment. bSurpriseRemoved and bDriverStopped are checked in rtw_write_port.

---
 drivers/staging/r8188eu/core/rtw_mlme_ext.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme_ext.c +0 -3
index bfd6afd7266e..be33489d3dfd 100644
@@ -3988,9 +3988,6 @@ s32 dump_mgntframe_and_wait_ack(struct adapter *padapter, struct xmit_frame *pmg
 	u32 timeout_ms = 500;/*   500ms */
 	struct xmit_priv	*pxmitpriv = &padapter->xmitpriv;
 
-	if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
-		return -1;
-
 	mutex_lock(&pxmitpriv->ack_tx_mutex);
 	pxmitpriv->ack_tx = true;
 
Signature · 1 line
2.30.2