2022-12-30 18:08:56

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 00/20] staging: r8188eu: some xmit cleanups

Start cleaning up the code that transmits data frames to the dongle
via USB.

This should be applied on top of the "merge public action functions"
series.

Martin Kaiser (20):
staging: r8188eu: make xmitframe_swencrypt a void function
staging: r8188eu: remove some unused CAM defines
staging: r8188eu: cmd_seq is write-only
staging: r8188eu: return immediately if we're not meant to encrypt
staging: r8188eu: remove unused parameter
staging: r8188eu: simplify rtl8188eu_xmit_tasklet
staging: r8188eu: remove rtl8188eu_init_xmit_priv
staging: r8188eu: remove duplicate psta check
staging: r8188eu: simplify frame type check
staging: r8188eu: simplify rtw_make_wlanhdr's error handling
staging: r8188eu: clean up qos_option setting
staging: r8188eu: remove unused bpending array
staging: r8188eu: remove unused dma_transfer_addr
staging: r8188eu: bm_pending is not used
staging: r8188eu: terminate_xmitthread_sema is not used
staging: r8188eu: tx_retevt semaphore is not used
staging: r8188eu: remove unnecessary rtw_free_xmitframe call
staging: r8188eu: phwxmit parameter is unused
staging: r8188eu: rtw_init_hwxmits is not needed
staging: r8188eu: we use a constant number of hw_xmit entries

drivers/staging/r8188eu/core/rtw_cmd.c | 4 -
drivers/staging/r8188eu/core/rtw_xmit.c | 239 ++++++++----------
drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 27 +-
drivers/staging/r8188eu/hal/usb_ops_linux.c | 14 +-
.../staging/r8188eu/include/rtl8188e_spec.h | 21 --
.../staging/r8188eu/include/rtl8188e_xmit.h | 4 +-
drivers/staging/r8188eu/include/rtw_cmd.h | 1 -
drivers/staging/r8188eu/include/rtw_xmit.h | 9 +-
8 files changed, 116 insertions(+), 203 deletions(-)

--
2.30.2


2022-12-30 18:08:57

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 03/20] staging: r8188eu: cmd_seq is write-only

The cmd_seq component of struct cmd_priv is set and incremented but never
read. It can be removed.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/core/rtw_cmd.c | 4 ----
drivers/staging/r8188eu/include/rtw_cmd.h | 1 -
2 files changed, 5 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
index 19b2f73d481d..eb79435da355 100644
--- a/drivers/staging/r8188eu/core/rtw_cmd.c
+++ b/drivers/staging/r8188eu/core/rtw_cmd.c
@@ -65,8 +65,6 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)

/* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */

- pcmdpriv->cmd_seq = 1;
-
pcmdpriv->cmd_allocated_buf = kzalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ,
GFP_KERNEL);

@@ -233,8 +231,6 @@ int rtw_cmd_thread(void *context)
ret = cmd_hdl(pcmd->padapter, pcmdbuf);
pcmd->res = ret;
}
-
- pcmdpriv->cmd_seq++;
} else {
pcmd->res = H2C_PARAMETERS_ERROR;
}
diff --git a/drivers/staging/r8188eu/include/rtw_cmd.h b/drivers/staging/r8188eu/include/rtw_cmd.h
index c330a4435b31..9df7d4bf441d 100644
--- a/drivers/staging/r8188eu/include/rtw_cmd.h
+++ b/drivers/staging/r8188eu/include/rtw_cmd.h
@@ -32,7 +32,6 @@ struct cmd_priv {
struct completion start_cmd_thread;
struct completion stop_cmd_thread;
struct __queue cmd_queue;
- u8 cmd_seq;
u8 *cmd_buf; /* shall be non-paged, and 4 bytes aligned */
u8 *cmd_allocated_buf;
u8 *rsp_buf; /* shall be non-paged, and 4 bytes aligned */
--
2.30.2

2022-12-30 18:09:04

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 07/20] staging: r8188eu: remove rtl8188eu_init_xmit_priv

rtl8188eu_init_xmit_priv's only jobs is to initialise the xmit tasklet.

Remove rtl8188eu_init_xmit_priv and initialise the xmit tasklet in
_rtw_init_xmit_priv. Yet again, this makes the code a tiny bit smaller.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/core/rtw_xmit.c | 2 +-
drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 10 ----------
drivers/staging/r8188eu/include/rtl8188e_xmit.h | 1 -
3 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 35d291d78c60..62b66a205a06 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -211,7 +211,7 @@ int _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
mutex_init(&pxmitpriv->ack_tx_mutex);
rtw_sctx_init(&pxmitpriv->ack_tx_ops, 0);

- rtl8188eu_init_xmit_priv(padapter);
+ tasklet_init(&pxmitpriv->xmit_tasklet, rtl8188eu_xmit_tasklet, (unsigned long)padapter);

return 0;

diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
index cca74cf28915..cf9779b86b9c 100644
--- a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
@@ -9,16 +9,6 @@
#include "../include/usb_ops.h"
#include "../include/rtl8188e_hal.h"

-s32 rtl8188eu_init_xmit_priv(struct adapter *adapt)
-{
- struct xmit_priv *pxmitpriv = &adapt->xmitpriv;
-
- tasklet_init(&pxmitpriv->xmit_tasklet,
- rtl8188eu_xmit_tasklet,
- (unsigned long)adapt);
- return _SUCCESS;
-}
-
static void rtl8188eu_cal_txdesc_chksum(struct tx_desc *ptxdesc)
{
u16 *usptr = (u16 *)ptxdesc;
diff --git a/drivers/staging/r8188eu/include/rtl8188e_xmit.h b/drivers/staging/r8188eu/include/rtl8188e_xmit.h
index 865468d6b922..82439f52b0c8 100644
--- a/drivers/staging/r8188eu/include/rtl8188e_xmit.h
+++ b/drivers/staging/r8188eu/include/rtl8188e_xmit.h
@@ -131,7 +131,6 @@ struct txrpt_ccx_88e {

void rtl8188e_fill_fake_txdesc(struct adapter *padapter, u8 *pDesc,
u32 BufferLen, u8 IsPsPoll, u8 IsBTQosNull);
-s32 rtl8188eu_init_xmit_priv(struct adapter *padapter);
s32 rtl8188eu_hal_xmit(struct adapter *padapter, struct xmit_frame *frame);
s32 rtl8188eu_mgnt_xmit(struct adapter *padapter, struct xmit_frame *frame);
s32 rtl8188eu_xmit_buf_handler(struct adapter *padapter);
--
2.30.2

2022-12-30 18:09:10

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 06/20] staging: r8188eu: simplify rtl8188eu_xmit_tasklet

Simplify the rtl8188eu_xmit_tasklet function. Remove an unnecessary
temporary variable and reformat the code.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/hal/usb_ops_linux.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c
index c51f860d3527..a238d29a3a46 100644
--- a/drivers/staging/r8188eu/hal/usb_ops_linux.c
+++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c
@@ -481,22 +481,14 @@ u32 rtw_read_port(struct adapter *adapter, u8 *rmem)

void rtl8188eu_xmit_tasklet(unsigned long priv)
{
- int ret = false;
struct adapter *adapt = (struct adapter *)priv;
struct xmit_priv *pxmitpriv = &adapt->xmitpriv;

if (check_fwstate(&adapt->mlmepriv, _FW_UNDER_SURVEY))
return;

- while (1) {
- if ((adapt->bDriverStopped) ||
- (adapt->bSurpriseRemoved) ||
- (adapt->bWritePortCancel))
- break;
-
- ret = rtl8188eu_xmitframe_complete(adapt, pxmitpriv);
-
- if (!ret)
+ do {
+ if (adapt->bDriverStopped || adapt->bSurpriseRemoved || adapt->bWritePortCancel)
break;
- }
+ } while (rtl8188eu_xmitframe_complete(adapt, pxmitpriv));
}
--
2.30.2

2022-12-30 18:09:17

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 11/20] staging: r8188eu: clean up qos_option setting

The qos_option variable in function rtw_make_wlanhdr should be a boolean
as it's set to true or false. We can directly set it to
pqospriv->qos_option instead of using a default value and if statements.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/core/rtw_xmit.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 6e3b5649b84c..0fef508408a7 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -791,7 +791,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr
struct ieee80211_hdr *pwlanhdr = (struct ieee80211_hdr *)hdr;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct qos_priv *pqospriv = &pmlmepriv->qospriv;
- u8 qos_option = false;
+ bool qos_option;
__le16 *fctrl = &pwlanhdr->frame_control;

struct sta_info *psta;
@@ -817,26 +817,20 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr
memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv), ETH_ALEN);
memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN);
-
- if (pqospriv->qos_option)
- qos_option = true;
+ qos_option = pqospriv->qos_option;
} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
/* to_ds = 0, fr_ds = 1; */
SetFrDs(fctrl);
memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
memcpy(pwlanhdr->addr2, get_bssid(pmlmepriv), ETH_ALEN);
memcpy(pwlanhdr->addr3, pattrib->src, ETH_ALEN);
-
- if (psta->qos_option)
- qos_option = true;
+ qos_option = psta->qos_option;
} else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ||
check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv), ETH_ALEN);
-
- if (psta->qos_option)
- qos_option = true;
+ qos_option = psta->qos_option;
} else {
return _FAIL;
}
--
2.30.2

2022-12-30 18:09:17

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 09/20] staging: r8188eu: simplify frame type check

Reorder the code in rtw_make_wlanhdr to make the function simpler.
There's a large if statement to check that we process only data frames.
Revert the condition and exit for non-data frames.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/core/rtw_xmit.c | 139 ++++++++++++------------
1 file changed, 70 insertions(+), 69 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 2bccb9ca42e9..502f9a6f4250 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -809,90 +809,91 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr

SetFrameSubType(fctrl, pattrib->subtype);

- if (pattrib->subtype & IEEE80211_FTYPE_DATA) {
- if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
- /* to_ds = 1, fr_ds = 0; */
- /* Data transfer to AP */
- SetToDs(fctrl);
- memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv), ETH_ALEN);
- memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
- memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN);
-
- if (pqospriv->qos_option)
- qos_option = true;
- } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
- /* to_ds = 0, fr_ds = 1; */
- SetFrDs(fctrl);
- memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
- memcpy(pwlanhdr->addr2, get_bssid(pmlmepriv), ETH_ALEN);
- memcpy(pwlanhdr->addr3, pattrib->src, ETH_ALEN);
-
- if (psta->qos_option)
- qos_option = true;
- } else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ||
- check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
- memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
- memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
- memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv), ETH_ALEN);
-
- if (psta->qos_option)
- qos_option = true;
- } else {
- res = _FAIL;
- goto exit;
- }
+ if (!(pattrib->subtype & IEEE80211_FTYPE_DATA))
+ return _SUCCESS;
+
+ if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
+ /* to_ds = 1, fr_ds = 0; */
+ /* Data transfer to AP */
+ SetToDs(fctrl);
+ memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv), ETH_ALEN);
+ memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
+ memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN);
+
+ if (pqospriv->qos_option)
+ qos_option = true;
+ } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
+ /* to_ds = 0, fr_ds = 1; */
+ SetFrDs(fctrl);
+ memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
+ memcpy(pwlanhdr->addr2, get_bssid(pmlmepriv), ETH_ALEN);
+ memcpy(pwlanhdr->addr3, pattrib->src, ETH_ALEN);

- if (pattrib->mdata)
- SetMData(fctrl);
+ if (psta->qos_option)
+ qos_option = true;
+ } else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ||
+ check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
+ memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
+ memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
+ memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv), ETH_ALEN);

- if (pattrib->encrypt)
- SetPrivacy(fctrl);
+ if (psta->qos_option)
+ qos_option = true;
+ } else {
+ res = _FAIL;
+ goto exit;
+ }

- if (qos_option) {
- qc = (unsigned short *)(hdr + pattrib->hdrlen - 2);
+ if (pattrib->mdata)
+ SetMData(fctrl);

- if (pattrib->priority)
- SetPriority(qc, pattrib->priority);
+ if (pattrib->encrypt)
+ SetPrivacy(fctrl);

- SetEOSP(qc, pattrib->eosp);
+ if (qos_option) {
+ qc = (unsigned short *)(hdr + pattrib->hdrlen - 2);

- SetAckpolicy(qc, pattrib->ack_policy);
- }
+ if (pattrib->priority)
+ SetPriority(qc, pattrib->priority);

- /* TODO: fill HT Control Field */
+ SetEOSP(qc, pattrib->eosp);

- /* Update Seq Num will be handled by f/w */
- if (psta) {
- psta->sta_xmitpriv.txseq_tid[pattrib->priority]++;
- psta->sta_xmitpriv.txseq_tid[pattrib->priority] &= 0xFFF;
+ SetAckpolicy(qc, pattrib->ack_policy);
+ }

- pattrib->seqnum = psta->sta_xmitpriv.txseq_tid[pattrib->priority];
+ /* TODO: fill HT Control Field */

- SetSeqNum(hdr, pattrib->seqnum);
+ /* Update Seq Num will be handled by f/w */
+ if (psta) {
+ psta->sta_xmitpriv.txseq_tid[pattrib->priority]++;
+ psta->sta_xmitpriv.txseq_tid[pattrib->priority] &= 0xFFF;

- /* check if enable ampdu */
- if (pattrib->ht_en && psta->htpriv.ampdu_enable) {
- if (psta->htpriv.agg_enable_bitmap & BIT(pattrib->priority))
- pattrib->ampdu_en = true;
- }
+ pattrib->seqnum = psta->sta_xmitpriv.txseq_tid[pattrib->priority];

- /* re-check if enable ampdu by BA_starting_seqctrl */
- if (pattrib->ampdu_en) {
- u16 tx_seq;
+ SetSeqNum(hdr, pattrib->seqnum);

- tx_seq = psta->BA_starting_seqctrl[pattrib->priority & 0x0f];
+ /* check if enable ampdu */
+ if (pattrib->ht_en && psta->htpriv.ampdu_enable) {
+ if (psta->htpriv.agg_enable_bitmap & BIT(pattrib->priority))
+ pattrib->ampdu_en = true;
+ }

- /* check BA_starting_seqctrl */
- if (SN_LESS(pattrib->seqnum, tx_seq)) {
- pattrib->ampdu_en = false;/* AGG BK */
- } else if (SN_EQUAL(pattrib->seqnum, tx_seq)) {
- psta->BA_starting_seqctrl[pattrib->priority & 0x0f] = (tx_seq + 1) & 0xfff;
+ /* re-check if enable ampdu by BA_starting_seqctrl */
+ if (pattrib->ampdu_en) {
+ u16 tx_seq;

- pattrib->ampdu_en = true;/* AGG EN */
- } else {
- psta->BA_starting_seqctrl[pattrib->priority & 0x0f] = (pattrib->seqnum + 1) & 0xfff;
- pattrib->ampdu_en = true;/* AGG EN */
- }
+ tx_seq = psta->BA_starting_seqctrl[pattrib->priority & 0x0f];
+
+ /* check BA_starting_seqctrl */
+ if (SN_LESS(pattrib->seqnum, tx_seq)) {
+ pattrib->ampdu_en = false;/* AGG BK */
+ } else if (SN_EQUAL(pattrib->seqnum, tx_seq)) {
+ psta->BA_starting_seqctrl[pattrib->priority & 0x0f] = (tx_seq + 1) & 0xfff;
+
+ pattrib->ampdu_en = true;/* AGG EN */
+ } else {
+ psta->BA_starting_seqctrl[pattrib->priority & 0x0f] = (pattrib->seqnum + 1) & 0xfff;
+ pattrib->ampdu_en = true;/* AGG EN */
}
}
}
--
2.30.2

2022-12-30 18:09:32

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 15/20] staging: r8188eu: terminate_xmitthread_sema is not used

Remove terminate_xmitthread_sema from struct xmit_priv. This semaphore is
initialised but not used.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/core/rtw_xmit.c | 1 -
drivers/staging/r8188eu/include/rtw_xmit.h | 1 -
2 files changed, 2 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index a3dccfa4d843..ca6a1f4298a4 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -69,7 +69,6 @@ int _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
/* We don't need to memset padapter->XXX to zero, because adapter is allocated by vzalloc(). */

spin_lock_init(&pxmitpriv->lock);
- sema_init(&pxmitpriv->terminate_xmitthread_sema, 0);

/*
* Please insert all the queue initializaiton using rtw_init_queue below
diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index 83638dede6e7..ef1b7123e557 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -257,7 +257,6 @@ struct agg_pkt_info {

struct xmit_priv {
spinlock_t lock;
- struct semaphore terminate_xmitthread_sema;
struct __queue be_pending;
struct __queue bk_pending;
struct __queue vi_pending;
--
2.30.2

2022-12-30 18:21:20

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 16/20] staging: r8188eu: tx_retevt semaphore is not used

Remove tx_retevt from struct xmit_priv. This semaphore is initialised but
not used.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/core/rtw_xmit.c | 2 --
drivers/staging/r8188eu/include/rtw_xmit.h | 1 -
2 files changed, 3 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index ca6a1f4298a4..eb47d8276eec 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -196,8 +196,6 @@ int _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)

pxmitpriv->txirp_cnt = 1;

- sema_init(&pxmitpriv->tx_retevt, 0);
-
/* per AC pending irp */
pxmitpriv->beq_cnt = 0;
pxmitpriv->bkq_cnt = 0;
diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index ef1b7123e557..719424dd8a49 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -280,7 +280,6 @@ struct xmit_priv {
u8 wmm_para_seq[4];/* sequence for wmm ac parameter strength
* from large to small. it's value is 0->vo,
* 1->vi, 2->be, 3->bk. */
- struct semaphore tx_retevt;/* all tx return event; */
u8 txirp_cnt;/* */
struct tasklet_struct xmit_tasklet;
/* per AC pending irp */
--
2.30.2

2022-12-30 18:22:27

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 13/20] staging: r8188eu: remove unused dma_transfer_addr

The dma_transfer_addr component in struct xmit_buf is initialised but not
used. Remove it.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/core/rtw_xmit.c | 1 -
drivers/staging/r8188eu/include/rtw_xmit.h | 1 -
2 files changed, 2 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 0fef508408a7..bf4bb1e66985 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -41,7 +41,6 @@ static int rtw_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *px
return -ENOMEM;

pxmitbuf->pbuf = (u8 *)ALIGN((size_t)(pxmitbuf->pallocated_buf), XMITBUF_ALIGN_SZ);
- pxmitbuf->dma_transfer_addr = 0;

pxmitbuf->pxmit_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!pxmitbuf->pxmit_urb) {
diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index b017f9293f86..1c4fbdf97a12 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -202,7 +202,6 @@ struct xmit_buf {
struct submit_ctx *sctx;
u32 ff_hwaddr;
struct urb *pxmit_urb;
- dma_addr_t dma_transfer_addr; /* (in) dma addr for transfer_buffer */
int last[8];
};

--
2.30.2

2022-12-30 18:29:38

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 19/20] staging: r8188eu: rtw_init_hwxmits is not needed

The _rtw_init_xmit_priv function calls rtw_alloc_hwxmits to allocate
memory for pxmitpriv->hwxmits (this is an array of struct hw_xmit). This
allocation uses kzalloc, the allocated memory is initialised with 0.

After the allocation, _rtw_init_xmit_priv calls rtw_init_hwxmits to set an
element of each hw_xmit to 0. This is not necessary, we can remove the
rtw_init_hwxmits call and the now unused function rtw_init_hwxmits.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/core/rtw_xmit.c | 10 ----------
drivers/staging/r8188eu/include/rtw_xmit.h | 1 -
2 files changed, 11 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 347f06f48a37..76b0839ca19d 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -189,8 +189,6 @@ int _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
if (rtw_alloc_hwxmits(padapter))
goto free_xmit_extbuf;

- rtw_init_hwxmits(pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry);
-
for (i = 0; i < 4; i++)
pxmitpriv->wmm_para_seq[i] = i;

@@ -1570,14 +1568,6 @@ void rtw_free_hwxmits(struct adapter *padapter)
kfree(hwxmits);
}

-void rtw_init_hwxmits(struct hw_xmit *phwxmit, int entry)
-{
- int i;
-
- for (i = 0; i < entry; i++, phwxmit++)
- phwxmit->accnt = 0;
-}
-
static int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb)
{
struct sk_buff *skb = *pskb;
diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index 719424dd8a49..eafa693efc2f 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -345,7 +345,6 @@ void _rtw_init_sta_xmit_priv(struct sta_xmit_priv *psta_xmitpriv);
s32 rtw_txframes_pending(struct adapter *padapter);
s32 rtw_txframes_sta_ac_pending(struct adapter *padapter,
struct pkt_attrib *pattrib);
-void rtw_init_hwxmits(struct hw_xmit *phwxmit, int entry);
int _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter);
void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv);
int rtw_alloc_hwxmits(struct adapter *padapter);
--
2.30.2

2022-12-30 18:31:22

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 20/20] staging: r8188eu: we use a constant number of hw_xmit entries

struct xmit_priv contains a pointer to an array of struct hw_xmit entries.
xmit_priv's (ill-named) hwxmit_entry component stores the size of this
array, i.e. the number of hw_xmit entries that are used.

The array size is constant, it's initialised to HWXMIT_ENTRY and never
updated. Simplify the code accordingly. Remove hwxmit_entry, do not pass
the array size as a function parameter and use HWXMIT_ENTRY in the code
that handles the array.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/core/rtw_xmit.c | 8 +++-----
drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 2 +-
drivers/staging/r8188eu/include/rtw_xmit.h | 3 +--
3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 76b0839ca19d..d224785a747b 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1417,7 +1417,7 @@ static struct xmit_frame *dequeue_one_xmitframe(struct xmit_priv *pxmitpriv, str
return pxmitframe;
}

-struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i, int entry)
+struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i)
{
struct list_head *sta_plist, *sta_phead;
struct hw_xmit *phwxmit;
@@ -1439,7 +1439,7 @@ struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi

spin_lock_bh(&pxmitpriv->lock);

- for (i = 0; i < entry; i++) {
+ for (i = 0; i < HWXMIT_ENTRY; i++) {
phwxmit = phwxmit_i + inx[i];

sta_phead = get_list_head(phwxmit->sta_queue);
@@ -1543,9 +1543,7 @@ int rtw_alloc_hwxmits(struct adapter *padapter)
struct hw_xmit *hwxmits;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;

- pxmitpriv->hwxmit_entry = HWXMIT_ENTRY;
-
- pxmitpriv->hwxmits = kzalloc(sizeof(struct hw_xmit) * pxmitpriv->hwxmit_entry, GFP_KERNEL);
+ pxmitpriv->hwxmits = kzalloc(sizeof(struct hw_xmit) * HWXMIT_ENTRY, GFP_KERNEL);
if (!pxmitpriv->hwxmits)
return -ENOMEM;

diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
index d1af76cc2091..e097fa14dc6e 100644
--- a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
@@ -398,7 +398,7 @@ bool rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmit
if (!pxmitbuf)
return false;

- pxmitframe = rtw_dequeue_xframe(pxmitpriv, pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry);
+ pxmitframe = rtw_dequeue_xframe(pxmitpriv, pxmitpriv->hwxmits);
if (!pxmitframe) {
/* no more xmit frame, release xmit buffer */
rtw_free_xmitbuf(pxmitpriv, pxmitbuf);
diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index eafa693efc2f..f8f10c67b764 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -276,7 +276,6 @@ struct xmit_priv {
u64 last_tx_bytes;
u64 last_tx_pkts;
struct hw_xmit *hwxmits;
- u8 hwxmit_entry;
u8 wmm_para_seq[4];/* sequence for wmm ac parameter strength
* from large to small. it's value is 0->vo,
* 1->vi, 2->be, 3->bk. */
@@ -334,7 +333,7 @@ struct tx_servq *rtw_get_sta_pending(struct adapter *padapter,
s32 rtw_xmitframe_enqueue(struct adapter *padapter,
struct xmit_frame *pxmitframe);
struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv,
- struct hw_xmit *phwxmit_i, int entry);
+ struct hw_xmit *phwxmit_i);

s32 rtw_xmit_classifier(struct adapter *padapter,
struct xmit_frame *pxmitframe);
--
2.30.2

2022-12-30 18:32:00

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 14/20] staging: r8188eu: bm_pending is not used

The bm_pending queue in struct xmit_priv is initialised but not used. It
can be removed.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/core/rtw_xmit.c | 1 -
drivers/staging/r8188eu/include/rtw_xmit.h | 1 -
2 files changed, 2 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index bf4bb1e66985..a3dccfa4d843 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -81,7 +81,6 @@ int _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
rtw_init_queue(&pxmitpriv->bk_pending);
rtw_init_queue(&pxmitpriv->vi_pending);
rtw_init_queue(&pxmitpriv->vo_pending);
- rtw_init_queue(&pxmitpriv->bm_pending);

rtw_init_queue(&pxmitpriv->free_xmit_queue);

diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index 1c4fbdf97a12..83638dede6e7 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -262,7 +262,6 @@ struct xmit_priv {
struct __queue bk_pending;
struct __queue vi_pending;
struct __queue vo_pending;
- struct __queue bm_pending;
u8 *pallocated_frame_buf;
u8 *pxmit_frame_buf;
uint free_xmitframe_cnt;
--
2.30.2

2022-12-30 18:33:37

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 17/20] staging: r8188eu: remove unnecessary rtw_free_xmitframe call

There's no need to call rtw_free_xmitframe before we dequeue the first
frame. pxmitframe is always NULL at this point, rtw_free_xmitframe will do
nothing in this case.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
index cf9779b86b9c..d1af76cc2091 100644
--- a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
@@ -398,9 +398,6 @@ bool rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmit
if (!pxmitbuf)
return false;

- /* 3 1. pick up first frame */
- rtw_free_xmitframe(pxmitpriv, pxmitframe);
-
pxmitframe = rtw_dequeue_xframe(pxmitpriv, pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry);
if (!pxmitframe) {
/* no more xmit frame, release xmit buffer */
--
2.30.2

2022-12-30 18:34:11

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 18/20] staging: r8188eu: phwxmit parameter is unused

Remove the unused function parameter phwxmit from function
dequeue_one_xmitframe.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/core/rtw_xmit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index eb47d8276eec..347f06f48a37 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1399,7 +1399,7 @@ s32 rtw_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitfram
return _SUCCESS;
}

-static struct xmit_frame *dequeue_one_xmitframe(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit, struct tx_servq *ptxservq, struct __queue *pframe_queue)
+static struct xmit_frame *dequeue_one_xmitframe(struct xmit_priv *pxmitpriv, struct tx_servq *ptxservq, struct __queue *pframe_queue)
{
struct list_head *xmitframe_plist, *xmitframe_phead;
struct xmit_frame *pxmitframe = NULL;
@@ -1452,7 +1452,7 @@ struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi

pframe_queue = &ptxservq->sta_pending;

- pxmitframe = dequeue_one_xmitframe(pxmitpriv, phwxmit, ptxservq, pframe_queue);
+ pxmitframe = dequeue_one_xmitframe(pxmitpriv, ptxservq, pframe_queue);

if (pxmitframe) {
phwxmit->accnt--;
--
2.30.2

2022-12-30 18:34:38

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 10/20] staging: r8188eu: simplify rtw_make_wlanhdr's error handling

Simplify the error handling in rtw_make_wlanhdr. Exit immediately instead
of jumping to the end of the function. We don't have to do any clean-up.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/core/rtw_xmit.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 502f9a6f4250..6e3b5649b84c 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -792,8 +792,6 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct qos_priv *pqospriv = &pmlmepriv->qospriv;
u8 qos_option = false;
-
- int res = _SUCCESS;
__le16 *fctrl = &pwlanhdr->frame_control;

struct sta_info *psta;
@@ -840,8 +838,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr
if (psta->qos_option)
qos_option = true;
} else {
- res = _FAIL;
- goto exit;
+ return _FAIL;
}

if (pattrib->mdata)
@@ -897,9 +894,8 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr
}
}
}
-exit:

- return res;
+ return _SUCCESS;
}

s32 rtw_txframes_pending(struct adapter *padapter)
--
2.30.2

2022-12-30 18:36:27

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 08/20] staging: r8188eu: remove duplicate psta check

We do not need the psta check in the while loop of rtw_xmitframe_coalesce.
psta is already checked near the start of the function and is not modified
afterwards.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/core/rtw_xmit.c | 36 ++++++++++++-------------
1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 62b66a205a06..2bccb9ca42e9 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1009,25 +1009,23 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct

/* adding icv, if necessary... */
if (pattrib->iv_len) {
- if (psta) {
- switch (pattrib->encrypt) {
- case _WEP40_:
- case _WEP104_:
- WEP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx);
- break;
- case _TKIP_:
- if (bmcst)
- TKIP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx);
- else
- TKIP_IV(pattrib->iv, psta->dot11txpn, 0);
- break;
- case _AES_:
- if (bmcst)
- AES_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx);
- else
- AES_IV(pattrib->iv, psta->dot11txpn, 0);
- break;
- }
+ switch (pattrib->encrypt) {
+ case _WEP40_:
+ case _WEP104_:
+ WEP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx);
+ break;
+ case _TKIP_:
+ if (bmcst)
+ TKIP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx);
+ else
+ TKIP_IV(pattrib->iv, psta->dot11txpn, 0);
+ break;
+ case _AES_:
+ if (bmcst)
+ AES_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx);
+ else
+ AES_IV(pattrib->iv, psta->dot11txpn, 0);
+ break;
}

memcpy(pframe, pattrib->iv, pattrib->iv_len);
--
2.30.2

2022-12-30 18:50:50

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 05/20] staging: r8188eu: remove unused parameter

All callers of rtl8188eu_xmitframe_complete set the pxmitbuf parameter to
NULL, in which case rtl8188eu_xmitframe_complete allocates another
xmit_buf internally.

Remove the pxmitbuf parameter and resulting dead code.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 12 +++++-------
drivers/staging/r8188eu/hal/usb_ops_linux.c | 2 +-
drivers/staging/r8188eu/include/rtl8188e_xmit.h | 3 +--
3 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
index 6d1f56d1f9d7..cca74cf28915 100644
--- a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
@@ -375,11 +375,12 @@ static u32 xmitframe_need_length(struct xmit_frame *pxmitframe)
return len;
}

-bool rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf)
+bool rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitpriv)
{
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(adapt);
struct xmit_frame *pxmitframe = NULL;
struct xmit_frame *pfirstframe = NULL;
+ struct xmit_buf *pxmitbuf;

/* aggregate variable */
struct hw_xmit *phwxmit;
@@ -403,12 +404,9 @@ bool rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmit
else
bulksize = USB_FULL_SPEED_BULK_SIZE;

- /* check xmitbuffer is ok */
- if (!pxmitbuf) {
- pxmitbuf = rtw_alloc_xmitbuf(pxmitpriv);
- if (!pxmitbuf)
- return false;
- }
+ pxmitbuf = rtw_alloc_xmitbuf(pxmitpriv);
+ if (!pxmitbuf)
+ return false;

/* 3 1. pick up first frame */
rtw_free_xmitframe(pxmitpriv, pxmitframe);
diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c
index 7c72f5e04d9b..c51f860d3527 100644
--- a/drivers/staging/r8188eu/hal/usb_ops_linux.c
+++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c
@@ -494,7 +494,7 @@ void rtl8188eu_xmit_tasklet(unsigned long priv)
(adapt->bWritePortCancel))
break;

- ret = rtl8188eu_xmitframe_complete(adapt, pxmitpriv, NULL);
+ ret = rtl8188eu_xmitframe_complete(adapt, pxmitpriv);

if (!ret)
break;
diff --git a/drivers/staging/r8188eu/include/rtl8188e_xmit.h b/drivers/staging/r8188eu/include/rtl8188e_xmit.h
index 6db7fabebea9..865468d6b922 100644
--- a/drivers/staging/r8188eu/include/rtl8188e_xmit.h
+++ b/drivers/staging/r8188eu/include/rtl8188e_xmit.h
@@ -138,7 +138,6 @@ s32 rtl8188eu_xmit_buf_handler(struct adapter *padapter);
#define hal_xmit_handler rtl8188eu_xmit_buf_handler
void rtl8188eu_xmit_tasklet(unsigned long priv);
bool rtl8188eu_xmitframe_complete(struct adapter *padapter,
- struct xmit_priv *pxmitpriv,
- struct xmit_buf *pxmitbuf);
+ struct xmit_priv *pxmitpriv);

#endif /* __RTL8188E_XMIT_H__ */
--
2.30.2

2022-12-30 18:50:55

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 12/20] staging: r8188eu: remove unused bpending array

The bpending array in struct xmit_buf is unused. Remove it.

(struct xmit_buf is not part of the interface between the kernel driver and
the device's firmware. It's safe to remove components from this struct.)

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/include/rtw_xmit.h | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index 6e7ebea5362d..b017f9293f86 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -203,7 +203,6 @@ struct xmit_buf {
u32 ff_hwaddr;
struct urb *pxmit_urb;
dma_addr_t dma_transfer_addr; /* (in) dma addr for transfer_buffer */
- u8 bpending[8];
int last[8];
};

--
2.30.2

2022-12-31 10:32:47

by Philipp Hortmann

[permalink] [raw]
Subject: Re: [PATCH 00/20] staging: r8188eu: some xmit cleanups

On 12/30/22 19:06, Martin Kaiser wrote:
> Start cleaning up the code that transmits data frames to the dongle
> via USB.
>
> This should be applied on top of the "merge public action functions"
> series.
>
> Martin Kaiser (20):
> staging: r8188eu: make xmitframe_swencrypt a void function
> staging: r8188eu: remove some unused CAM defines
> staging: r8188eu: cmd_seq is write-only
> staging: r8188eu: return immediately if we're not meant to encrypt
> staging: r8188eu: remove unused parameter
> staging: r8188eu: simplify rtl8188eu_xmit_tasklet
> staging: r8188eu: remove rtl8188eu_init_xmit_priv
> staging: r8188eu: remove duplicate psta check
> staging: r8188eu: simplify frame type check
> staging: r8188eu: simplify rtw_make_wlanhdr's error handling
> staging: r8188eu: clean up qos_option setting
> staging: r8188eu: remove unused bpending array
> staging: r8188eu: remove unused dma_transfer_addr
> staging: r8188eu: bm_pending is not used
> staging: r8188eu: terminate_xmitthread_sema is not used
> staging: r8188eu: tx_retevt semaphore is not used
> staging: r8188eu: remove unnecessary rtw_free_xmitframe call
> staging: r8188eu: phwxmit parameter is unused
> staging: r8188eu: rtw_init_hwxmits is not needed
> staging: r8188eu: we use a constant number of hw_xmit entries
>
> drivers/staging/r8188eu/core/rtw_cmd.c | 4 -
> drivers/staging/r8188eu/core/rtw_xmit.c | 239 ++++++++----------
> drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 27 +-
> drivers/staging/r8188eu/hal/usb_ops_linux.c | 14 +-
> .../staging/r8188eu/include/rtl8188e_spec.h | 21 --
> .../staging/r8188eu/include/rtl8188e_xmit.h | 4 +-
> drivers/staging/r8188eu/include/rtw_cmd.h | 1 -
> drivers/staging/r8188eu/include/rtw_xmit.h | 9 +-
> 8 files changed, 116 insertions(+), 203 deletions(-)
>
Tested-by: Philipp Hortmann <[email protected]> # Edimax N150

2023-01-17 19:47:41

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 20/20] staging: r8188eu: we use a constant number of hw_xmit entries

On Fri, Dec 30, 2022 at 07:06:46PM +0100, Martin Kaiser wrote:
> struct xmit_priv contains a pointer to an array of struct hw_xmit entries.
> xmit_priv's (ill-named) hwxmit_entry component stores the size of this
> array, i.e. the number of hw_xmit entries that are used.
>
> The array size is constant, it's initialised to HWXMIT_ENTRY and never
> updated. Simplify the code accordingly. Remove hwxmit_entry, do not pass
> the array size as a function parameter and use HWXMIT_ENTRY in the code
> that handles the array.
>
> Signed-off-by: Martin Kaiser <[email protected]>
> ---
> drivers/staging/r8188eu/core/rtw_xmit.c | 8 +++-----
> drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 2 +-
> drivers/staging/r8188eu/include/rtw_xmit.h | 3 +--
> 3 files changed, 5 insertions(+), 8 deletions(-)

This commit did not apply to my tree :(

thanks,

greg k-h