2023-01-23 20:54:08

by Martin Kaiser

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

Here's another series with cleanups of the xmit part. Amongst other
things, it replaces some __queue variables with standard list_heads.

This series also includes rebased versions of the patches that caused
conflicts during the last review cycle.

Martin Kaiser (23):
staging: r8188eu: we use a constant number of hw_xmit entries
staging: r8188eu: pass struct adapter to usb_write
staging: r8188eu: remove struct intf_hdl
staging: r8188eu: remove struct intf_priv
staging: r8188eu: simplify the sta loop in rtw_dequeue_xframe
staging: r8188eu: simplify the code to initialise inx
staging: r8188eu: remove an obsolete comment
staging: r8188eu: remove unused function parameter
staging: r8188eu: remove dead assignment
staging: r8188eu: use list_empty
staging: r8188eu: simplify dequeue_one_xmitframe
staging: r8188eu: remove redundant parameter
staging: r8188eu: make rtw_chk_hi_queue_cmd a void function
staging: r8188eu: decrement qcnt in rtw_dequeue_xframe
staging: r8188eu: simplify dequeue_one_xmitframe
staging: r8188eu: use list_head for xmitframe list
staging: r8188eu: merge dequeue_one_xmitframe into its caller
staging: r8188eu: use lists for hwxmits
staging: r8188eu: fix rtw_xmitframe_enqueue error handling
staging: r8188eu: remove rtw_xmitframe_enqueue
staging: r8188eu: struct agg_pkt_info is unused
staging: r8188eu: apsd_setting is unused
staging: r8188eu: merge rtw_free_hwxmits into its only caller

drivers/staging/r8188eu/core/rtw_cmd.c | 16 +--
drivers/staging/r8188eu/core/rtw_xmit.c | 119 +++++-------------
drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 7 +-
drivers/staging/r8188eu/hal/usb_ops_linux.c | 18 +--
drivers/staging/r8188eu/include/drv_types.h | 1 -
drivers/staging/r8188eu/include/osdep_intf.h | 32 -----
.../staging/r8188eu/include/rtl8188e_xmit.h | 3 +-
drivers/staging/r8188eu/include/rtw_cmd.h | 2 +-
drivers/staging/r8188eu/include/rtw_io.h | 8 --
drivers/staging/r8188eu/include/rtw_xmit.h | 23 +---
drivers/staging/r8188eu/os_dep/usb_intf.c | 6 -
11 files changed, 57 insertions(+), 178 deletions(-)

--
2.30.2



2023-01-23 20:54:11

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 01/23] 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 c51f6eabef87..5f2426be6c11 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1375,7 +1375,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;
@@ -1397,7 +1397,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);
@@ -1501,9 +1501,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 = kcalloc(pxmitpriv->hwxmit_entry, sizeof(struct hw_xmit), GFP_KERNEL);
+ pxmitpriv->hwxmits = kcalloc(HWXMIT_ENTRY, sizeof(struct hw_xmit), 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 883eacd98224..cc32167fb4dc 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -273,7 +273,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. */
@@ -324,7 +323,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


2023-01-23 20:54:14

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 03/23] staging: r8188eu: remove struct intf_hdl

There are no more users of struct intf_hdl in the r8188eu driver. We can
now remove this struct.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/include/drv_types.h | 1 -
drivers/staging/r8188eu/include/rtw_io.h | 6 ------
drivers/staging/r8188eu/os_dep/usb_intf.c | 6 ------
3 files changed, 13 deletions(-)

diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h
index 614673902377..7b170eed66b3 100644
--- a/drivers/staging/r8188eu/include/drv_types.h
+++ b/drivers/staging/r8188eu/include/drv_types.h
@@ -152,7 +152,6 @@ struct adapter {
struct mlme_ext_priv mlmeextpriv;
struct cmd_priv cmdpriv;
struct evt_priv evtpriv;
- struct intf_hdl intf;
struct xmit_priv xmitpriv;
struct recv_priv recvpriv;
struct sta_priv stapriv;
diff --git a/drivers/staging/r8188eu/include/rtw_io.h b/drivers/staging/r8188eu/include/rtw_io.h
index 0d2aa432f88d..033ea7146861 100644
--- a/drivers/staging/r8188eu/include/rtw_io.h
+++ b/drivers/staging/r8188eu/include/rtw_io.h
@@ -17,12 +17,6 @@
#include <linux/usb/ch9.h>

struct intf_priv;
-struct intf_hdl;
-
-struct intf_hdl {
- struct adapter *padapter;
- struct dvobj_priv *pintf_dev;
-};

int __must_check rtw_read8(struct adapter *adapter, u32 addr, u8 *data);
int __must_check rtw_read16(struct adapter *adapter, u32 addr, u16 *data);
diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c
index 1f70e5fee1b2..1f114b1fc4d5 100644
--- a/drivers/staging/r8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/r8188eu/os_dep/usb_intf.c
@@ -290,7 +290,6 @@ static int rtw_usb_if1_init(struct dvobj_priv *dvobj, struct usb_interface *pusb
{
struct adapter *padapter = NULL;
struct net_device *pnetdev = NULL;
- struct intf_hdl *pintf;
int ret;

padapter = vzalloc(sizeof(*padapter));
@@ -317,11 +316,6 @@ static int rtw_usb_if1_init(struct dvobj_priv *dvobj, struct usb_interface *pusb
padapter->intf_start = &usb_intf_start;
padapter->intf_stop = &usb_intf_stop;

- /* step init_io_priv */
- pintf = &padapter->intf;
- pintf->padapter = padapter;
- pintf->pintf_dev = adapter_to_dvobj(padapter);
-
/* step read_chip_version */
rtl8188e_read_chip_version(padapter);

--
2.30.2


2023-01-23 20:54:17

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 04/23] staging: r8188eu: remove struct intf_priv

struct intf_priv is not used in the r8188eu driver. It can be removed.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/include/osdep_intf.h | 32 --------------------
drivers/staging/r8188eu/include/rtw_io.h | 2 --
2 files changed, 34 deletions(-)

diff --git a/drivers/staging/r8188eu/include/osdep_intf.h b/drivers/staging/r8188eu/include/osdep_intf.h
index 6d66cb57225e..457fb3852a19 100644
--- a/drivers/staging/r8188eu/include/osdep_intf.h
+++ b/drivers/staging/r8188eu/include/osdep_intf.h
@@ -7,38 +7,6 @@
#include "osdep_service.h"
#include "drv_types.h"

-struct intf_priv {
- u8 *intf_dev;
- u32 max_iosz; /* USB2.0: 128, USB1.1: 64, SDIO:64 */
- u32 max_xmitsz; /* USB2.0: unlimited, SDIO:512 */
- u32 max_recvsz; /* USB2.0: unlimited, SDIO:512 */
-
- u8 *io_rwmem;
- u8 *allocated_io_rwmem;
- u32 io_wsz; /* unit: 4bytes */
- u32 io_rsz;/* unit: 4bytes */
- u8 intf_status;
-
- void (*_bus_io)(u8 *priv);
-
-/*
-Under Sync. IRP (SDIO/USB)
-A protection mechanism is necessary for the io_rwmem(read/write protocol)
-
-Under Async. IRP (SDIO/USB)
-The protection mechanism is through the pending queue.
-*/
- struct mutex ioctl_mutex;
- /* when in USB, IO is through interrupt in/out endpoints */
- struct usb_device *udev;
- struct urb *piorw_urb;
- u8 io_irp_cnt;
- u8 bio_irp_pending;
- struct timer_list io_timer;
- u8 bio_irp_timeout;
- u8 bio_timer_cancel;
-};
-
int netdev_open(struct net_device *pnetdev);
int netdev_close(struct net_device *pnetdev);

diff --git a/drivers/staging/r8188eu/include/rtw_io.h b/drivers/staging/r8188eu/include/rtw_io.h
index 033ea7146861..090555f562f2 100644
--- a/drivers/staging/r8188eu/include/rtw_io.h
+++ b/drivers/staging/r8188eu/include/rtw_io.h
@@ -16,8 +16,6 @@
#include <linux/usb.h>
#include <linux/usb/ch9.h>

-struct intf_priv;
-
int __must_check rtw_read8(struct adapter *adapter, u32 addr, u8 *data);
int __must_check rtw_read16(struct adapter *adapter, u32 addr, u16 *data);
int __must_check rtw_read32(struct adapter *adapter, u32 addr, u32 *data);
--
2.30.2


2023-01-23 20:54:19

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 05/23] staging: r8188eu: simplify the sta loop in rtw_dequeue_xframe

Use list_for_each_entry_safe to iterate over the station entries in
function rtw_dequeue_xframe instead of coding the loop manually.

We have to use the safe version, the loop body may remove a station from
the list over which we iterate.

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

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 5f2426be6c11..b07a1ce21a38 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1377,9 +1377,9 @@ static struct xmit_frame *dequeue_one_xmitframe(struct xmit_priv *pxmitpriv, str

struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i)
{
- struct list_head *sta_plist, *sta_phead;
+ struct list_head *sta_phead;
struct hw_xmit *phwxmit;
- struct tx_servq *ptxservq = NULL;
+ struct tx_servq *ptxservq, *tmp_txservq;
struct __queue *pframe_queue = NULL;
struct xmit_frame *pxmitframe = NULL;
struct adapter *padapter = pxmitpriv->adapter;
@@ -1401,10 +1401,8 @@ struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi
phwxmit = phwxmit_i + inx[i];

sta_phead = get_list_head(phwxmit->sta_queue);
- sta_plist = sta_phead->next;

- while (sta_phead != sta_plist) {
- ptxservq = container_of(sta_plist, struct tx_servq, tx_pending);
+ list_for_each_entry_safe(ptxservq, tmp_txservq, sta_phead, tx_pending) {

pframe_queue = &ptxservq->sta_pending;

@@ -1418,8 +1416,6 @@ struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi
list_del_init(&ptxservq->tx_pending);
goto exit;
}
-
- sta_plist = sta_plist->next;
}
}
exit:
--
2.30.2


2023-01-23 20:54:21

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 06/23] staging: r8188eu: simplify the code to initialise inx

Simplify the code to initialise the inx array in function
rtw_dequeue_xframe and make the code a tiny bit smaller.

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

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index b07a1ce21a38..30bc9405356d 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1384,15 +1384,11 @@ struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi
struct xmit_frame *pxmitframe = NULL;
struct adapter *padapter = pxmitpriv->adapter;
struct registry_priv *pregpriv = &padapter->registrypriv;
- int i, inx[4];
-
- inx[0] = 0; inx[1] = 1; inx[2] = 2; inx[3] = 3;
+ int i, inx[] = { 0, 1, 2, 3 };

if (pregpriv->wifi_spec == 1) {
- int j;
-
- for (j = 0; j < 4; j++)
- inx[j] = pxmitpriv->wmm_para_seq[j];
+ for (i = 0; i < ARRAY_SIZE(inx); i++)
+ inx[i] = pxmitpriv->wmm_para_seq[i];
}

spin_lock_bh(&pxmitpriv->lock);
--
2.30.2


2023-01-23 20:54:23

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 08/23] staging: r8188eu: remove unused function parameter

The pxmitpriv parameter in function dequeue_one_xmitframe is not needed.
It can be removed.

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 a431bffbccf2..aefd32b98d08 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1355,7 +1355,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 tx_servq *ptxservq, struct __queue *pframe_queue)
+static struct xmit_frame *dequeue_one_xmitframe(struct tx_servq *ptxservq, struct __queue *pframe_queue)
{
struct list_head *xmitframe_plist, *xmitframe_phead;
struct xmit_frame *pxmitframe = NULL;
@@ -1402,7 +1402,7 @@ struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi

pframe_queue = &ptxservq->sta_pending;

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

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


2023-01-23 20:54:26

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 07/23] staging: r8188eu: remove an obsolete comment

Remove an obsolete comment in rtw_dequeue_xframe. There is no break
statement any more.

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

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 30bc9405356d..a431bffbccf2 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1408,7 +1408,7 @@ struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi
phwxmit->accnt--;

/* Remove sta node when there are no pending packets. */
- if (list_empty(&pframe_queue->queue)) /* must be done after get_next and before break */
+ if (list_empty(&pframe_queue->queue))
list_del_init(&ptxservq->tx_pending);
goto exit;
}
--
2.30.2


2023-01-23 20:54:28

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 09/23] staging: r8188eu: remove dead assignment

There's no point in moving xmitframe_plist to the next list element.
xmitframe_plist is not used any more after this assignment.

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

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index aefd32b98d08..943e7a56f7ce 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1365,11 +1365,7 @@ static struct xmit_frame *dequeue_one_xmitframe(struct tx_servq *ptxservq, struc

if (xmitframe_phead != xmitframe_plist) {
pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list);
-
- xmitframe_plist = xmitframe_plist->next;
-
list_del_init(&pxmitframe->list);
-
ptxservq->qcnt--;
}
return pxmitframe;
--
2.30.2


2023-01-23 20:54:31

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 11/23] staging: r8188eu: simplify dequeue_one_xmitframe

Revert the if condition and exit immediately if the list of xmitframes
is empty. Hopefully, this makes the code a little bit simpler.

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

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 334d75214011..96079d9a6c42 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1358,16 +1358,16 @@ s32 rtw_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitfram
static struct xmit_frame *dequeue_one_xmitframe(struct tx_servq *ptxservq, struct __queue *pframe_queue)
{
struct list_head *xmitframe_plist, *xmitframe_phead;
- struct xmit_frame *pxmitframe = NULL;
+ struct xmit_frame *pxmitframe;

xmitframe_phead = get_list_head(pframe_queue);
- xmitframe_plist = xmitframe_phead->next;
+ if (list_empty(xmitframe_phead))
+ return NULL;

- if (!list_empty(xmitframe_phead)) {
- pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list);
- list_del_init(&pxmitframe->list);
- ptxservq->qcnt--;
- }
+ xmitframe_plist = xmitframe_phead->next;
+ pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list);
+ list_del_init(&pxmitframe->list);
+ ptxservq->qcnt--;
return pxmitframe;
}

--
2.30.2


2023-01-23 20:54:33

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 12/23] staging: r8188eu: remove redundant parameter

The rtl8188eu_xmitframe_complete function takes two parameters: adapter
and xmit_priv. xmit_priv is part of struct adapter, this parameter can be
removed.

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

diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
index e097fa14dc6e..e067cc271686 100644
--- a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
@@ -365,8 +365,9 @@ static u32 xmitframe_need_length(struct xmit_frame *pxmitframe)
return len;
}

-bool rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitpriv)
+bool rtl8188eu_xmitframe_complete(struct adapter *adapt)
{
+ struct xmit_priv *pxmitpriv = &adapt->xmitpriv;
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(adapt);
struct xmit_frame *pxmitframe = NULL;
struct xmit_frame *pfirstframe = NULL;
diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c
index 9f008e61a6f2..e122c8ca929c 100644
--- a/drivers/staging/r8188eu/hal/usb_ops_linux.c
+++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c
@@ -463,7 +463,6 @@ u32 rtw_read_port(struct adapter *adapter, u8 *rmem)
void rtl8188eu_xmit_tasklet(unsigned long priv)
{
struct adapter *adapt = (struct adapter *)priv;
- struct xmit_priv *pxmitpriv = &adapt->xmitpriv;

if (check_fwstate(&adapt->mlmepriv, _FW_UNDER_SURVEY))
return;
@@ -471,5 +470,5 @@ void rtl8188eu_xmit_tasklet(unsigned long priv)
do {
if (adapt->bDriverStopped || adapt->bSurpriseRemoved || adapt->bWritePortCancel)
break;
- } while (rtl8188eu_xmitframe_complete(adapt, pxmitpriv));
+ } while (rtl8188eu_xmitframe_complete(adapt));
}
diff --git a/drivers/staging/r8188eu/include/rtl8188e_xmit.h b/drivers/staging/r8188eu/include/rtl8188e_xmit.h
index e6d343ffc148..a023dd792da7 100644
--- a/drivers/staging/r8188eu/include/rtl8188e_xmit.h
+++ b/drivers/staging/r8188eu/include/rtl8188e_xmit.h
@@ -125,7 +125,6 @@ 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);
void rtl8188eu_xmit_tasklet(unsigned long priv);
-bool rtl8188eu_xmitframe_complete(struct adapter *padapter,
- struct xmit_priv *pxmitpriv);
+bool rtl8188eu_xmitframe_complete(struct adapter *padapter);

#endif /* __RTL8188E_XMIT_H__ */
--
2.30.2


2023-01-23 20:54:34

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 13/23] staging: r8188eu: make rtw_chk_hi_queue_cmd a void function

Both callers of rtw_chk_hi_queue_cmd do not check the return value.
Convert rtw_chk_hi_queue_cmd to a void function.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/core/rtw_cmd.c | 16 +++++-----------
drivers/staging/r8188eu/include/rtw_cmd.h | 2 +-
2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
index eb79435da355..d57360a68fb3 100644
--- a/drivers/staging/r8188eu/core/rtw_cmd.c
+++ b/drivers/staging/r8188eu/core/rtw_cmd.c
@@ -1197,24 +1197,20 @@ static void rtw_chk_hi_queue_hdl(struct adapter *padapter)
}
}

-u8 rtw_chk_hi_queue_cmd(struct adapter *padapter)
+void rtw_chk_hi_queue_cmd(struct adapter *padapter)
{
struct cmd_obj *ph2c;
struct drvextra_cmd_parm *pdrvextra_cmd_parm;
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
- u8 res = _SUCCESS;

ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
- if (!ph2c) {
- res = _FAIL;
- goto exit;
- }
+ if (!ph2c)
+ return;

pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC);
if (!pdrvextra_cmd_parm) {
kfree(ph2c);
- res = _FAIL;
- goto exit;
+ return;
}

pdrvextra_cmd_parm->ec_id = CHECK_HIQ_WK_CID;
@@ -1223,9 +1219,7 @@ u8 rtw_chk_hi_queue_cmd(struct adapter *padapter)

init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));

- res = rtw_enqueue_cmd(pcmdpriv, ph2c);
-exit:
- return res;
+ rtw_enqueue_cmd(pcmdpriv, ph2c);
}

u8 rtw_c2h_wk_cmd(struct adapter *padapter, u8 *c2h_evt)
diff --git a/drivers/staging/r8188eu/include/rtw_cmd.h b/drivers/staging/r8188eu/include/rtw_cmd.h
index 9df7d4bf441d..e8eecd52d1d8 100644
--- a/drivers/staging/r8188eu/include/rtw_cmd.h
+++ b/drivers/staging/r8188eu/include/rtw_cmd.h
@@ -743,7 +743,7 @@ u8 rtw_rpt_timer_cfg_cmd(struct adapter *padapter, u16 minRptTime);
u8 rtw_antenna_select_cmd(struct adapter *padapter, u8 antenna, u8 enqueue);
u8 rtw_ps_cmd(struct adapter *padapter);

-u8 rtw_chk_hi_queue_cmd(struct adapter *padapter);
+void rtw_chk_hi_queue_cmd(struct adapter *padapter);

u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan);

--
2.30.2


2023-01-23 20:54:37

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 10/23] staging: r8188eu: use list_empty

Use list_empty to check for an empty list instead of coding the check
manually.

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

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 943e7a56f7ce..334d75214011 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1363,7 +1363,7 @@ static struct xmit_frame *dequeue_one_xmitframe(struct tx_servq *ptxservq, struc
xmitframe_phead = get_list_head(pframe_queue);
xmitframe_plist = xmitframe_phead->next;

- if (xmitframe_phead != xmitframe_plist) {
+ if (!list_empty(xmitframe_phead)) {
pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list);
list_del_init(&pxmitframe->list);
ptxservq->qcnt--;
--
2.30.2


2023-01-23 20:54:56

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 14/23] staging: r8188eu: decrement qcnt in rtw_dequeue_xframe

rtw_dequeue_xframe calls dequeue_one_xmitframe and passes a struct
tx_servq. The only use for this parameter is to decrement its qcnt if an
xmit_frame could be extracted.

It makes more sense to remove the struct tx_servq parameter from
dequeue_one_xmitframe and decrement qcnt in the calling function when
dequeue_one_xmitframe returns success, i.e. when an xmit_frame was
extracted.

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

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 96079d9a6c42..7802a34ebcfd 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1355,7 +1355,7 @@ s32 rtw_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitfram
return _SUCCESS;
}

-static struct xmit_frame *dequeue_one_xmitframe(struct tx_servq *ptxservq, struct __queue *pframe_queue)
+static struct xmit_frame *dequeue_one_xmitframe(struct __queue *pframe_queue)
{
struct list_head *xmitframe_plist, *xmitframe_phead;
struct xmit_frame *pxmitframe;
@@ -1367,7 +1367,6 @@ static struct xmit_frame *dequeue_one_xmitframe(struct tx_servq *ptxservq, struc
xmitframe_plist = xmitframe_phead->next;
pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list);
list_del_init(&pxmitframe->list);
- ptxservq->qcnt--;
return pxmitframe;
}

@@ -1398,10 +1397,11 @@ struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi

pframe_queue = &ptxservq->sta_pending;

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

if (pxmitframe) {
phwxmit->accnt--;
+ ptxservq->qcnt--;

/* Remove sta node when there are no pending packets. */
if (list_empty(&pframe_queue->queue))
--
2.30.2


2023-01-23 20:54:59

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 15/23] staging: r8188eu: simplify dequeue_one_xmitframe

Simplify the dequeue_one_xmitframe function without changing its
behaviour. Drop the temporary variable xmitframe_plist.

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

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 7802a34ebcfd..79a1999ca809 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1357,15 +1357,13 @@ s32 rtw_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitfram

static struct xmit_frame *dequeue_one_xmitframe(struct __queue *pframe_queue)
{
- struct list_head *xmitframe_plist, *xmitframe_phead;
+ struct list_head *xmitframe_phead = get_list_head(pframe_queue);
struct xmit_frame *pxmitframe;

- xmitframe_phead = get_list_head(pframe_queue);
if (list_empty(xmitframe_phead))
return NULL;

- xmitframe_plist = xmitframe_phead->next;
- pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list);
+ pxmitframe = container_of(xmitframe_phead->next, struct xmit_frame, list);
list_del_init(&pxmitframe->list);
return pxmitframe;
}
--
2.30.2


2023-01-23 20:55:03

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 17/23] staging: r8188eu: merge dequeue_one_xmitframe into its caller

dequeue_one_xmitframe is a small function that is called only from
rtw_dequeue_xframe. Merge the two functions.

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

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 6060a1832431..cb0d8346ac10 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1355,18 +1355,6 @@ s32 rtw_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitfram
return _SUCCESS;
}

-static struct xmit_frame *dequeue_one_xmitframe(struct list_head *xframe_list)
-{
- struct xmit_frame *pxmitframe;
-
- if (list_empty(xframe_list))
- return NULL;
-
- pxmitframe = container_of(xframe_list->next, struct xmit_frame, list);
- list_del_init(&pxmitframe->list);
- return pxmitframe;
-}
-
struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i)
{
struct list_head *sta_phead;
@@ -1391,19 +1379,21 @@ struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi
sta_phead = get_list_head(phwxmit->sta_queue);

list_for_each_entry_safe(ptxservq, tmp_txservq, sta_phead, tx_pending) {
-
xframe_list = get_list_head(&ptxservq->sta_pending);
- pxmitframe = dequeue_one_xmitframe(xframe_list);
+ if (list_empty(xframe_list))
+ continue;

- if (pxmitframe) {
- phwxmit->accnt--;
- ptxservq->qcnt--;
+ pxmitframe = container_of(xframe_list->next, struct xmit_frame, list);
+ list_del_init(&pxmitframe->list);

- /* Remove sta node when there are no pending packets. */
- if (list_empty(xframe_list))
- list_del_init(&ptxservq->tx_pending);
- goto exit;
- }
+ phwxmit->accnt--;
+ ptxservq->qcnt--;
+
+ /* Remove sta node when there are no pending packets. */
+ if (list_empty(xframe_list))
+ list_del_init(&ptxservq->tx_pending);
+
+ goto exit;
}
}
exit:
--
2.30.2


2023-01-23 20:55:07

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 16/23] staging: r8188eu: use list_head for xmitframe list

The r8188eu driver defines a struct __queue that contains a list_head and
a spinlock.

struct tx_servq describes a station for which we have pending tx packets.
This struct contains a __queue for the pending packets (a __queue of
struct xmit_frame entries). In this particular case, the queue's spinlock
is not used, we need only the list_head.

rtw_dequeue_xframe uses a local variable for such an xmit_frame queue.
This patch replaces this variable with a list_head.

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

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 79a1999ca809..6060a1832431 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1355,15 +1355,14 @@ s32 rtw_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitfram
return _SUCCESS;
}

-static struct xmit_frame *dequeue_one_xmitframe(struct __queue *pframe_queue)
+static struct xmit_frame *dequeue_one_xmitframe(struct list_head *xframe_list)
{
- struct list_head *xmitframe_phead = get_list_head(pframe_queue);
struct xmit_frame *pxmitframe;

- if (list_empty(xmitframe_phead))
+ if (list_empty(xframe_list))
return NULL;

- pxmitframe = container_of(xmitframe_phead->next, struct xmit_frame, list);
+ pxmitframe = container_of(xframe_list->next, struct xmit_frame, list);
list_del_init(&pxmitframe->list);
return pxmitframe;
}
@@ -1373,7 +1372,7 @@ struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi
struct list_head *sta_phead;
struct hw_xmit *phwxmit;
struct tx_servq *ptxservq, *tmp_txservq;
- struct __queue *pframe_queue = NULL;
+ struct list_head *xframe_list;
struct xmit_frame *pxmitframe = NULL;
struct adapter *padapter = pxmitpriv->adapter;
struct registry_priv *pregpriv = &padapter->registrypriv;
@@ -1393,16 +1392,15 @@ struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi

list_for_each_entry_safe(ptxservq, tmp_txservq, sta_phead, tx_pending) {

- pframe_queue = &ptxservq->sta_pending;
-
- pxmitframe = dequeue_one_xmitframe(pframe_queue);
+ xframe_list = get_list_head(&ptxservq->sta_pending);
+ pxmitframe = dequeue_one_xmitframe(xframe_list);

if (pxmitframe) {
phwxmit->accnt--;
ptxservq->qcnt--;

/* Remove sta node when there are no pending packets. */
- if (list_empty(&pframe_queue->queue))
+ if (list_empty(xframe_list))
list_del_init(&ptxservq->tx_pending);
goto exit;
}
--
2.30.2


2023-01-23 20:55:11

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 19/23] staging: r8188eu: fix rtw_xmitframe_enqueue error handling

In function rtw_xmitframe_enqueue, we can simply relay the error code from
rtw_xmit_classifier.

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

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index ef6d3a9bffea..4f9defdbe257 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1347,12 +1347,7 @@ void rtw_free_xmitframe_queue(struct xmit_priv *pxmitpriv, struct __queue *pfram

s32 rtw_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitframe)
{
- if (rtw_xmit_classifier(padapter, pxmitframe) == _FAIL) {
-/* pxmitframe->pkt = NULL; */
- return _FAIL;
- }
-
- return _SUCCESS;
+ return rtw_xmit_classifier(padapter, pxmitframe);
}

struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i)
--
2.30.2


2023-01-23 20:55:14

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 18/23] staging: r8188eu: use lists for hwxmits

struct hw_xmit's sta_list points to one of vo, vi, be or bk_pending in
struct xmit_priv. All of these are defined as struct __queue, which is a
list plus a spinlock.

For these components, the spinlock is unused, we need only the list.

This patch converts sta_list and vo, vi, be and bk_pending to struct
list_head.

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

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index cb0d8346ac10..ef6d3a9bffea 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -76,10 +76,10 @@ int _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)

pxmitpriv->adapter = padapter;

- rtw_init_queue(&pxmitpriv->be_pending);
- rtw_init_queue(&pxmitpriv->bk_pending);
- rtw_init_queue(&pxmitpriv->vi_pending);
- rtw_init_queue(&pxmitpriv->vo_pending);
+ INIT_LIST_HEAD(&pxmitpriv->be_pending);
+ INIT_LIST_HEAD(&pxmitpriv->bk_pending);
+ INIT_LIST_HEAD(&pxmitpriv->vi_pending);
+ INIT_LIST_HEAD(&pxmitpriv->vo_pending);

rtw_init_queue(&pxmitpriv->free_xmit_queue);

@@ -881,10 +881,10 @@ s32 rtw_txframes_pending(struct adapter *padapter)
{
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;

- return (!list_empty(&pxmitpriv->be_pending.queue) ||
- !list_empty(&pxmitpriv->bk_pending.queue) ||
- !list_empty(&pxmitpriv->vi_pending.queue) ||
- !list_empty(&pxmitpriv->vo_pending.queue));
+ return (!list_empty(&pxmitpriv->be_pending) ||
+ !list_empty(&pxmitpriv->bk_pending) ||
+ !list_empty(&pxmitpriv->vi_pending) ||
+ !list_empty(&pxmitpriv->vo_pending));
}

s32 rtw_txframes_sta_ac_pending(struct adapter *padapter, struct pkt_attrib *pattrib)
@@ -1357,7 +1357,6 @@ s32 rtw_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitfram

struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i)
{
- struct list_head *sta_phead;
struct hw_xmit *phwxmit;
struct tx_servq *ptxservq, *tmp_txservq;
struct list_head *xframe_list;
@@ -1375,10 +1374,7 @@ struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi

for (i = 0; i < HWXMIT_ENTRY; i++) {
phwxmit = phwxmit_i + inx[i];
-
- sta_phead = get_list_head(phwxmit->sta_queue);
-
- list_for_each_entry_safe(ptxservq, tmp_txservq, sta_phead, tx_pending) {
+ list_for_each_entry_safe(ptxservq, tmp_txservq, phwxmit->sta_list, tx_pending) {
xframe_list = get_list_head(&ptxservq->sta_pending);
if (list_empty(xframe_list))
continue;
@@ -1460,7 +1456,7 @@ s32 rtw_xmit_classifier(struct adapter *padapter, struct xmit_frame *pxmitframe)
ptxservq = rtw_get_sta_pending(padapter, psta, pattrib->priority, (u8 *)(&ac_index));

if (list_empty(&ptxservq->tx_pending))
- list_add_tail(&ptxservq->tx_pending, get_list_head(phwxmits[ac_index].sta_queue));
+ list_add_tail(&ptxservq->tx_pending, phwxmits[ac_index].sta_list);

list_add_tail(&pxmitframe->list, get_list_head(&ptxservq->sta_pending));
ptxservq->qcnt++;
@@ -1481,10 +1477,10 @@ int rtw_alloc_hwxmits(struct adapter *padapter)

hwxmits = pxmitpriv->hwxmits;

- hwxmits[0].sta_queue = &pxmitpriv->vo_pending;
- hwxmits[1].sta_queue = &pxmitpriv->vi_pending;
- hwxmits[2].sta_queue = &pxmitpriv->be_pending;
- hwxmits[3].sta_queue = &pxmitpriv->bk_pending;
+ hwxmits[0].sta_list = &pxmitpriv->vo_pending;
+ hwxmits[1].sta_list = &pxmitpriv->vi_pending;
+ hwxmits[2].sta_list = &pxmitpriv->be_pending;
+ hwxmits[3].sta_list = &pxmitpriv->bk_pending;

return 0;
}
diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index cc32167fb4dc..30f8000120b2 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -97,7 +97,7 @@ union txdesc {
};

struct hw_xmit {
- struct __queue *sta_queue;
+ struct list_head *sta_list;
int accnt;
};

@@ -257,10 +257,10 @@ struct agg_pkt_info {

struct xmit_priv {
spinlock_t lock;
- struct __queue be_pending;
- struct __queue bk_pending;
- struct __queue vi_pending;
- struct __queue vo_pending;
+ struct list_head be_pending;
+ struct list_head bk_pending;
+ struct list_head vi_pending;
+ struct list_head vo_pending;
u8 *pallocated_frame_buf;
u8 *pxmit_frame_buf;
uint free_xmitframe_cnt;
--
2.30.2


2023-01-23 20:57:35

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 23/23] staging: r8188eu: merge rtw_free_hwxmits into its only caller

rtw_free_hwxmits is called only by _rtw_free_xmit_priv. We can merge the
two functions and make the code a bit shorter.

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

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 3752d4fddd11..f50e10f0d51f 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -281,7 +281,7 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)

vfree(pxmitpriv->pallocated_xmit_extbuf);

- rtw_free_hwxmits(padapter);
+ kfree(pxmitpriv->hwxmits);

mutex_destroy(&pxmitpriv->ack_tx_mutex);
}
@@ -1475,15 +1475,6 @@ int rtw_alloc_hwxmits(struct adapter *padapter)
return 0;
}

-void rtw_free_hwxmits(struct adapter *padapter)
-{
- struct hw_xmit *hwxmits;
- struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
-
- hwxmits = pxmitpriv->hwxmits;
- kfree(hwxmits);
-}
-
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 33c3031de2c4..d8808e68f778 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -328,7 +328,6 @@ s32 rtw_txframes_sta_ac_pending(struct adapter *padapter,
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);
-void rtw_free_hwxmits(struct adapter *padapter);
s32 rtw_xmit(struct adapter *padapter, struct sk_buff **pkt);

int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_frame *pxmitframe);
--
2.30.2


2023-01-23 20:58:03

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 20/23] staging: r8188eu: remove rtw_xmitframe_enqueue

The rtw_xmitframe_enqueue function is only one line. We can remove it and
call rtw_xmit_classifier directly.

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

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 4f9defdbe257..3752d4fddd11 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1345,11 +1345,6 @@ void rtw_free_xmitframe_queue(struct xmit_priv *pxmitpriv, struct __queue *pfram
spin_unlock_bh(&pframequeue->lock);
}

-s32 rtw_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitframe)
-{
- return rtw_xmit_classifier(padapter, pxmitframe);
-}
-
struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i)
{
struct hw_xmit *phwxmit;
diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
index e067cc271686..18557738dbad 100644
--- a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
@@ -596,7 +596,7 @@ static s32 pre_xmitframe(struct adapter *adapt, struct xmit_frame *pxmitframe)
return true;

enqueue:
- res = rtw_xmitframe_enqueue(adapt, pxmitframe);
+ res = rtw_xmit_classifier(adapt, pxmitframe);
spin_unlock_bh(&pxmitpriv->lock);

if (res != _SUCCESS) {
diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index 30f8000120b2..4aa7833487c8 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -320,8 +320,6 @@ void rtw_free_xmitframe_queue(struct xmit_priv *pxmitpriv,
struct __queue *pframequeue);
struct tx_servq *rtw_get_sta_pending(struct adapter *padapter,
struct sta_info *psta, int up, u8 *ac);
-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);

--
2.30.2


2023-01-23 20:58:29

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 22/23] staging: r8188eu: apsd_setting is unused

apsd_setting in struct tx_servq is not used, it can be removed.

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

diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index 548d2cfb88ec..33c3031de2c4 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -228,8 +228,6 @@ struct tx_servq {
struct sta_xmit_priv {
spinlock_t lock;
int option;
- int apsd_setting; /* When bit mask is on, the associated edca
- * queue supports APSD. */
struct tx_servq be_q; /* priority == 0,3 */
struct tx_servq bk_q; /* priority == 1,2 */
struct tx_servq vi_q; /* priority == 4,5 */
--
2.30.2


2023-01-23 20:59:09

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 21/23] staging: r8188eu: struct agg_pkt_info is unused

struct agg_pkt_info is not used in the r8188eu driver. Remove it.

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

diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index 4aa7833487c8..548d2cfb88ec 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -250,11 +250,6 @@ struct hw_txqueue {
int ac_tag;
};

-struct agg_pkt_info {
- u16 offset;
- u16 pkt_len;
-};
-
struct xmit_priv {
spinlock_t lock;
struct list_head be_pending;
--
2.30.2


2023-01-24 19:02:15

by Philipp Hortmann

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

On 1/23/23 21:53, Martin Kaiser wrote:
> Here's another series with cleanups of the xmit part. Amongst other
> things, it replaces some __queue variables with standard list_heads.
>
> This series also includes rebased versions of the patches that caused
> conflicts during the last review cycle.
>
> Martin Kaiser (23):
> staging: r8188eu: we use a constant number of hw_xmit entries
> staging: r8188eu: pass struct adapter to usb_write
> staging: r8188eu: remove struct intf_hdl
> staging: r8188eu: remove struct intf_priv
> staging: r8188eu: simplify the sta loop in rtw_dequeue_xframe
> staging: r8188eu: simplify the code to initialise inx
> staging: r8188eu: remove an obsolete comment
> staging: r8188eu: remove unused function parameter
> staging: r8188eu: remove dead assignment
> staging: r8188eu: use list_empty
> staging: r8188eu: simplify dequeue_one_xmitframe
> staging: r8188eu: remove redundant parameter
> staging: r8188eu: make rtw_chk_hi_queue_cmd a void function
> staging: r8188eu: decrement qcnt in rtw_dequeue_xframe
> staging: r8188eu: simplify dequeue_one_xmitframe
> staging: r8188eu: use list_head for xmitframe list
> staging: r8188eu: merge dequeue_one_xmitframe into its caller
> staging: r8188eu: use lists for hwxmits
> staging: r8188eu: fix rtw_xmitframe_enqueue error handling
> staging: r8188eu: remove rtw_xmitframe_enqueue
> staging: r8188eu: struct agg_pkt_info is unused
> staging: r8188eu: apsd_setting is unused
> staging: r8188eu: merge rtw_free_hwxmits into its only caller
>
> drivers/staging/r8188eu/core/rtw_cmd.c | 16 +--
> drivers/staging/r8188eu/core/rtw_xmit.c | 119 +++++-------------
> drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 7 +-
> drivers/staging/r8188eu/hal/usb_ops_linux.c | 18 +--
> drivers/staging/r8188eu/include/drv_types.h | 1 -
> drivers/staging/r8188eu/include/osdep_intf.h | 32 -----
> .../staging/r8188eu/include/rtl8188e_xmit.h | 3 +-
> drivers/staging/r8188eu/include/rtw_cmd.h | 2 +-
> drivers/staging/r8188eu/include/rtw_io.h | 8 --
> drivers/staging/r8188eu/include/rtw_xmit.h | 23 +---
> drivers/staging/r8188eu/os_dep/usb_intf.c | 6 -
> 11 files changed, 57 insertions(+), 178 deletions(-)
>


Tested-by: Philipp Hortmann <[email protected]> # Edimax N150