2022-08-20 18:17:44

by Michael Straube

[permalink] [raw]
Subject: [PATCH 00/19] staging: r8188eu: migrate os_dep/xmit_linux.c

This series moves the functions, or their functionality, from
os_dep/xmit_linux.c to the core/* part of the driver and finally
removes os_dep/xmit_linux.c and the xmit_osdep.h header.

Tested on x86_64 with Inter-Tech DMG-02.

Please apply this on top of:
[PATCH] staging: r8188eu: remove rtw_endofpktfile()

Thanks,
Michael

Michael Straube (19):
staging: r8188eu: make rtw_remainder_len() static
staging: r8188eu: make rtw_os_xmit_schedule() static
staging: r8188eu: rename rtw_os_xmit_schedule()
staging: r8188eu: make rtw_os_xmit_resource_alloc() static
staging: r8188eu: rename rtw_os_xmit_resource_alloc()
staging: r8188eu: make rtw_os_xmit_resource_free() static
staging: r8188eu: rename rtw_os_xmit_resource_free()
staging: r8188eu: make _rtw_open_pktfile() static
staging: r8188eu: rename _rtw_open_pktfile()
staging: r8188eu: make _rtw_pktfile_read() static
staging: r8188eu: rename _rtw_pktfile_read()
staging: r8188eu: remove unnecessary initialization to zero
staging: r8188eu: move struct pkt_file to rtw_xmit.h
staging: r8188eu: move rtw_os_xmit_complete() to rtw_xmit.c
staging: r8188eu: rename rtw_os_xmit_complete()
staging: r8188eu: make rtw_os_pkt_complete() static
staging: r8188eu: rename rtw_os_pkt_complete()
staging: r8188eu: remove os_dep/xmit_linux.c
staging: r8188eu: remove xmit_osdep.h

drivers/staging/r8188eu/Makefile | 1 -
drivers/staging/r8188eu/core/rtw_mlme.c | 23 +-
drivers/staging/r8188eu/core/rtw_mlme_ext.c | 2 +-
drivers/staging/r8188eu/core/rtw_sta_mgt.c | 1 -
drivers/staging/r8188eu/core/rtw_xmit.c | 232 +++++++++++++++++--
drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 4 +-
drivers/staging/r8188eu/include/rtw_xmit.h | 16 +-
drivers/staging/r8188eu/include/xmit_osdep.h | 48 ----
drivers/staging/r8188eu/os_dep/os_intfs.c | 7 +-
drivers/staging/r8188eu/os_dep/usb_intf.c | 1 -
drivers/staging/r8188eu/os_dep/xmit_linux.c | 226 ------------------
11 files changed, 251 insertions(+), 310 deletions(-)
delete mode 100644 drivers/staging/r8188eu/include/xmit_osdep.h
delete mode 100644 drivers/staging/r8188eu/os_dep/xmit_linux.c

--
2.37.2


2022-08-20 18:28:26

by Michael Straube

[permalink] [raw]
Subject: [PATCH 07/19] staging: r8188eu: rename rtw_os_xmit_resource_free()

The function rtw_os_xmit_resource_free() was moved from the os_dep
directory. It looks like the driver was originaly written to support
different operating systems. Obviously we do not need an extra 'os'
in the function name that indicates that the function is operating
system specific. Rename it to rtw_xmit_resource_free().

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

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 426bf87a1404..eef1a27e84eb 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -50,8 +50,8 @@ static int rtw_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *px
return _SUCCESS;
}

-static void rtw_os_xmit_resource_free(struct adapter *padapter, struct xmit_buf *pxmitbuf,
- u32 free_sz)
+static void rtw_xmit_resource_free(struct adapter *padapter, struct xmit_buf *pxmitbuf,
+ u32 free_sz)
{
usb_free_urb(pxmitbuf->pxmit_urb);
kfree(pxmitbuf->pallocated_buf);
@@ -248,7 +248,7 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)
}

for (i = 0; i < NR_XMITBUFF; i++) {
- rtw_os_xmit_resource_free(padapter, pxmitbuf, (MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ));
+ rtw_xmit_resource_free(padapter, pxmitbuf, (MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ));
pxmitbuf++;
}

@@ -258,7 +258,7 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)

pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmit_extbuf;
for (i = 0; i < num_xmit_extbuf; i++) {
- rtw_os_xmit_resource_free(padapter, pxmitbuf, (max_xmit_extbuf_size + XMITBUF_ALIGN_SZ));
+ rtw_xmit_resource_free(padapter, pxmitbuf, (max_xmit_extbuf_size + XMITBUF_ALIGN_SZ));
pxmitbuf++;
}

--
2.37.2

2022-08-20 18:31:08

by Michael Straube

[permalink] [raw]
Subject: [PATCH 17/19] staging: r8188eu: rename rtw_os_pkt_complete()

The function rtw_os_pkt_complete() was moved from the os_dep
directory. It looks like the driver was originaly written to support
different operating systems. Obviously we do not need an extra 'os'
in the function name that indicates that the function is operating
system specific. Rename it to rtw_pkt_complete().

Signed-off-by: Michael Straube <[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 c324dada4f5b..f8d6f458b83e 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -229,7 +229,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
return res;
}

-static void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt)
+static void rtw_pkt_complete(struct adapter *padapter, struct sk_buff *pkt)
{
u16 queue;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
@@ -250,7 +250,7 @@ static void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt)
void rtw_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe)
{
if (pxframe->pkt)
- rtw_os_pkt_complete(padapter, pxframe->pkt);
+ rtw_pkt_complete(padapter, pxframe->pkt);
pxframe->pkt = NULL;
}

@@ -1376,7 +1376,7 @@ s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitfram
spin_unlock_bh(&pfree_xmit_queue->lock);

if (pndis_pkt)
- rtw_os_pkt_complete(padapter, pndis_pkt);
+ rtw_pkt_complete(padapter, pndis_pkt);

exit:

--
2.37.2

2022-08-20 18:36:25

by Michael Straube

[permalink] [raw]
Subject: [PATCH 05/19] staging: r8188eu: rename rtw_os_xmit_resource_alloc()

The function rtw_os_xmit_resource_alloc() was moved from the os_dep
directory. It looks like the driver was originaly written to support
different operating systems. Obviously we do not need an extra 'os'
in the function name that indicates that the function is operating
system specific. Rename it to rtw_xmit_resource_alloc().

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

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 6f3a70a1ab3c..a1d2c2f78044 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -33,8 +33,8 @@ void _rtw_init_sta_xmit_priv(struct sta_xmit_priv *psta_xmitpriv)
INIT_LIST_HEAD(&psta_xmitpriv->apsd);
}

-static int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitbuf,
- u32 alloc_sz)
+static int rtw_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitbuf,
+ u32 alloc_sz)
{
pxmitbuf->pallocated_buf = kzalloc(alloc_sz, GFP_KERNEL);
if (!pxmitbuf->pallocated_buf)
@@ -142,10 +142,10 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
pxmitbuf->ext_tag = false;

/* Tx buf allocation may fail sometimes, so sleep and retry. */
- res = rtw_os_xmit_resource_alloc(padapter, pxmitbuf, (MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ));
+ res = rtw_xmit_resource_alloc(padapter, pxmitbuf, (MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ));
if (res == _FAIL) {
msleep(10);
- res = rtw_os_xmit_resource_alloc(padapter, pxmitbuf, (MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ));
+ res = rtw_xmit_resource_alloc(padapter, pxmitbuf, (MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ));
if (res == _FAIL)
goto exit;
}
@@ -179,7 +179,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
pxmitbuf->padapter = padapter;
pxmitbuf->ext_tag = true;

- res = rtw_os_xmit_resource_alloc(padapter, pxmitbuf, max_xmit_extbuf_size + XMITBUF_ALIGN_SZ);
+ res = rtw_xmit_resource_alloc(padapter, pxmitbuf, max_xmit_extbuf_size + XMITBUF_ALIGN_SZ);
if (res == _FAIL) {
res = _FAIL;
goto exit;
--
2.37.2

2022-08-20 18:37:11

by Michael Straube

[permalink] [raw]
Subject: [PATCH 03/19] staging: r8188eu: rename rtw_os_xmit_schedule()

The function rtw_os_xmit_schedule() was moved from the os_dep
directory. It looks like the driver was originaly written to support
different operating systems. Obviously we do not need an extra 'os'
in the function name that indicates that the function is operating
system specific. Rename it to rtw_xmit_schedule().

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/core/rtw_mlme.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c
index c7f69f7918b8..9e7e0034d352 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme.c
@@ -641,7 +641,7 @@ void rtw_survey_event_callback(struct adapter *adapter, u8 *pbuf)
spin_unlock_bh(&pmlmepriv->lock);
}

-static void rtw_os_xmit_schedule(struct adapter *padapter)
+static void rtw_xmit_schedule(struct adapter *padapter)
{
struct xmit_priv *pxmitpriv;

@@ -736,7 +736,7 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf)
if (check_fwstate(pmlmepriv, _FW_LINKED))
p2p_ps_wk_cmd(adapter, P2P_PS_SCAN_DONE, 0);

- rtw_os_xmit_schedule(adapter);
+ rtw_xmit_schedule(adapter);
}

static void free_scanqueue(struct mlme_priv *pmlmepriv)
@@ -1134,8 +1134,7 @@ void rtw_joinbss_event_callback(struct adapter *adapter, u8 *pbuf)

mlmeext_joinbss_event_callback(adapter, pnetwork->join_res);

- rtw_os_xmit_schedule(adapter);
-
+ rtw_xmit_schedule(adapter);
}

void rtw_set_max_rpt_macid(struct adapter *adapter, u8 macid)
--
2.37.2

2022-08-20 18:37:23

by Michael Straube

[permalink] [raw]
Subject: [PATCH 01/19] staging: r8188eu: make rtw_remainder_len() static

The function rtw_remainder_len() is only used in xmit_linux.c.
Make it static.

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/include/xmit_osdep.h | 1 -
drivers/staging/r8188eu/os_dep/xmit_linux.c | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/include/xmit_osdep.h b/drivers/staging/r8188eu/include/xmit_osdep.h
index 130dc06efe73..55347de455c8 100644
--- a/drivers/staging/r8188eu/include/xmit_osdep.h
+++ b/drivers/staging/r8188eu/include/xmit_osdep.h
@@ -37,7 +37,6 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter,
void rtw_os_xmit_resource_free(struct adapter *padapter,
struct xmit_buf *pxmitbuf, u32 free_sz);

-uint rtw_remainder_len(struct pkt_file *pfile);
void _rtw_open_pktfile(struct sk_buff *pkt, struct pkt_file *pfile);
uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen);

diff --git a/drivers/staging/r8188eu/os_dep/xmit_linux.c b/drivers/staging/r8188eu/os_dep/xmit_linux.c
index 85ef27735b88..33400a9b08e1 100644
--- a/drivers/staging/r8188eu/os_dep/xmit_linux.c
+++ b/drivers/staging/r8188eu/os_dep/xmit_linux.c
@@ -11,7 +11,7 @@
#include "../include/osdep_intf.h"
#include "../include/usb_osintf.h"

-uint rtw_remainder_len(struct pkt_file *pfile)
+static uint rtw_remainder_len(struct pkt_file *pfile)
{
return pfile->buf_len - ((size_t)(pfile->cur_addr) -
(size_t)(pfile->buf_start));
--
2.37.2

2022-08-20 18:37:55

by Michael Straube

[permalink] [raw]
Subject: [PATCH 12/19] staging: r8188eu: remove unnecessary initialization to zero

The initialization to zero of the variable 'len' in rtw_pktfile_read()
is not needed. It is immediately set to another value. Remove the
initialization to zero. While at it, remove an extra space.

Signed-off-by: Michael Straube <[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 51672984156b..f79889011cd1 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -429,9 +429,9 @@ static uint rtw_remainder_len(struct pkt_file *pfile)

static uint rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen)
{
- uint len = 0;
+ uint len;

- len = rtw_remainder_len(pfile);
+ len = rtw_remainder_len(pfile);
len = (rlen > len) ? len : rlen;

if (rmem)
--
2.37.2

2022-08-20 18:38:32

by Michael Straube

[permalink] [raw]
Subject: [PATCH 02/19] staging: r8188eu: make rtw_os_xmit_schedule() static

The function rtw_os_xmit_schedule() is only used in rtw_mlme.c.
Make it static.

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/core/rtw_mlme.c | 17 +++++++++++++++++
drivers/staging/r8188eu/include/xmit_osdep.h | 2 --
drivers/staging/r8188eu/os_dep/xmit_linux.c | 17 -----------------
3 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c
index e3cf3e8962fb..c7f69f7918b8 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme.c
@@ -641,6 +641,23 @@ void rtw_survey_event_callback(struct adapter *adapter, u8 *pbuf)
spin_unlock_bh(&pmlmepriv->lock);
}

+static void rtw_os_xmit_schedule(struct adapter *padapter)
+{
+ struct xmit_priv *pxmitpriv;
+
+ if (!padapter)
+ return;
+
+ pxmitpriv = &padapter->xmitpriv;
+
+ spin_lock_bh(&pxmitpriv->lock);
+
+ if (rtw_txframes_pending(padapter))
+ tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
+
+ spin_unlock_bh(&pxmitpriv->lock);
+}
+
void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf)
{
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
diff --git a/drivers/staging/r8188eu/include/xmit_osdep.h b/drivers/staging/r8188eu/include/xmit_osdep.h
index 55347de455c8..5a09355a142a 100644
--- a/drivers/staging/r8188eu/include/xmit_osdep.h
+++ b/drivers/staging/r8188eu/include/xmit_osdep.h
@@ -30,8 +30,6 @@ struct xmit_buf;

int rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev);

-void rtw_os_xmit_schedule(struct adapter *padapter);
-
int rtw_os_xmit_resource_alloc(struct adapter *padapter,
struct xmit_buf *pxmitbuf, u32 alloc_sz);
void rtw_os_xmit_resource_free(struct adapter *padapter,
diff --git a/drivers/staging/r8188eu/os_dep/xmit_linux.c b/drivers/staging/r8188eu/os_dep/xmit_linux.c
index 33400a9b08e1..9759ff5ea76d 100644
--- a/drivers/staging/r8188eu/os_dep/xmit_linux.c
+++ b/drivers/staging/r8188eu/os_dep/xmit_linux.c
@@ -105,23 +105,6 @@ void rtw_os_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe)
pxframe->pkt = NULL;
}

-void rtw_os_xmit_schedule(struct adapter *padapter)
-{
- struct xmit_priv *pxmitpriv;
-
- if (!padapter)
- return;
-
- pxmitpriv = &padapter->xmitpriv;
-
- spin_lock_bh(&pxmitpriv->lock);
-
- if (rtw_txframes_pending(padapter))
- tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
-
- spin_unlock_bh(&pxmitpriv->lock);
-}
-
static void rtw_check_xmit_resource(struct adapter *padapter, struct sk_buff *pkt)
{
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
--
2.37.2

2022-08-20 18:41:08

by Michael Straube

[permalink] [raw]
Subject: [PATCH 14/19] staging: r8188eu: move rtw_os_xmit_complete() to rtw_xmit.c

Move the function rtw_os_xmit_complete() from the os_dep/xmit_linux.c
to core/rtw_xmit.c. The goal is to get rid of os_dep/xmit_linux.c in
follow up patches.

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/core/rtw_xmit.c | 7 +++++++
drivers/staging/r8188eu/include/rtw_xmit.h | 2 ++
drivers/staging/r8188eu/include/xmit_osdep.h | 2 --
drivers/staging/r8188eu/os_dep/xmit_linux.c | 7 -------
4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index f79889011cd1..d5878b31bdbb 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -229,6 +229,13 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
return res;
}

+void rtw_os_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe)
+{
+ if (pxframe->pkt)
+ rtw_os_pkt_complete(padapter, pxframe->pkt);
+ pxframe->pkt = NULL;
+}
+
void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)
{
int i;
diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index 0e9471fb19e4..0c46b19d2842 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -364,6 +364,8 @@ u32 rtw_get_ff_hwaddr(struct xmit_frame *pxmitframe);
int rtw_ack_tx_wait(struct xmit_priv *pxmitpriv, u32 timeout_ms);
void rtw_ack_tx_done(struct xmit_priv *pxmitpriv, int status);

+void rtw_os_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe);
+
/* include after declaring struct xmit_buf, in order to avoid warning */
#include "xmit_osdep.h"

diff --git a/drivers/staging/r8188eu/include/xmit_osdep.h b/drivers/staging/r8188eu/include/xmit_osdep.h
index 612cdab52a9f..b881399fd989 100644
--- a/drivers/staging/r8188eu/include/xmit_osdep.h
+++ b/drivers/staging/r8188eu/include/xmit_osdep.h
@@ -22,7 +22,5 @@ struct xmit_buf;
int rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev);

void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt);
-void rtw_os_xmit_complete(struct adapter *padapter,
- struct xmit_frame *pxframe);

#endif /* __XMIT_OSDEP_H_ */
diff --git a/drivers/staging/r8188eu/os_dep/xmit_linux.c b/drivers/staging/r8188eu/os_dep/xmit_linux.c
index e216ada44055..d67508096209 100644
--- a/drivers/staging/r8188eu/os_dep/xmit_linux.c
+++ b/drivers/staging/r8188eu/os_dep/xmit_linux.c
@@ -31,13 +31,6 @@ void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt)
dev_kfree_skb_any(pkt);
}

-void rtw_os_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe)
-{
- if (pxframe->pkt)
- rtw_os_pkt_complete(padapter, pxframe->pkt);
- pxframe->pkt = NULL;
-}
-
static void rtw_check_xmit_resource(struct adapter *padapter, struct sk_buff *pkt)
{
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
--
2.37.2

2022-08-20 18:41:14

by Michael Straube

[permalink] [raw]
Subject: [PATCH 06/19] staging: r8188eu: make rtw_os_xmit_resource_free() static

The function rtw_os_xmit_resource_free() is only used in rtw_xmit.c.
Make it static.

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/core/rtw_xmit.c | 7 +++++++
drivers/staging/r8188eu/include/xmit_osdep.h | 3 ---
drivers/staging/r8188eu/os_dep/xmit_linux.c | 8 --------
3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index a1d2c2f78044..426bf87a1404 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -50,6 +50,13 @@ static int rtw_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *px
return _SUCCESS;
}

+static void rtw_os_xmit_resource_free(struct adapter *padapter, struct xmit_buf *pxmitbuf,
+ u32 free_sz)
+{
+ usb_free_urb(pxmitbuf->pxmit_urb);
+ kfree(pxmitbuf->pallocated_buf);
+}
+
s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
{
int i;
diff --git a/drivers/staging/r8188eu/include/xmit_osdep.h b/drivers/staging/r8188eu/include/xmit_osdep.h
index 82b47b38bafd..2c663c00b985 100644
--- a/drivers/staging/r8188eu/include/xmit_osdep.h
+++ b/drivers/staging/r8188eu/include/xmit_osdep.h
@@ -30,9 +30,6 @@ struct xmit_buf;

int rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev);

-void rtw_os_xmit_resource_free(struct adapter *padapter,
- struct xmit_buf *pxmitbuf, u32 free_sz);
-
void _rtw_open_pktfile(struct sk_buff *pkt, struct pkt_file *pfile);
uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen);

diff --git a/drivers/staging/r8188eu/os_dep/xmit_linux.c b/drivers/staging/r8188eu/os_dep/xmit_linux.c
index fdecb5e1a784..3d298d8187d2 100644
--- a/drivers/staging/r8188eu/os_dep/xmit_linux.c
+++ b/drivers/staging/r8188eu/os_dep/xmit_linux.c
@@ -54,14 +54,6 @@ uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen)
return len;
}

-void rtw_os_xmit_resource_free(struct adapter *padapter,
- struct xmit_buf *pxmitbuf, u32 free_sz)
-{
- usb_free_urb(pxmitbuf->pxmit_urb);
-
- kfree(pxmitbuf->pallocated_buf);
-}
-
#define WMM_XMIT_THRESHOLD (NR_XMITFRAME * 2 / 5)

void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt)
--
2.37.2

2022-08-20 18:41:54

by Michael Straube

[permalink] [raw]
Subject: [PATCH 11/19] staging: r8188eu: rename _rtw_pktfile_read()

There is no need to prefix the function name of _rtw_pktfile_read()
with an underscore. Rename it to rtw_pktfile_read().

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

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 26bf300e672b..51672984156b 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -427,7 +427,7 @@ static uint rtw_remainder_len(struct pkt_file *pfile)
(size_t)(pfile->buf_start));
}

-static uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen)
+static uint rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen)
{
uint len = 0;

@@ -450,11 +450,11 @@ static void set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
s32 user_prio = 0;

rtw_open_pktfile(ppktfile->pkt, ppktfile);
- _rtw_pktfile_read(ppktfile, (unsigned char *)&etherhdr, ETH_HLEN);
+ rtw_pktfile_read(ppktfile, (unsigned char *)&etherhdr, ETH_HLEN);

/* get user_prio from IP hdr */
if (pattrib->ether_type == 0x0800) {
- _rtw_pktfile_read(ppktfile, (u8 *)&ip_hdr, sizeof(ip_hdr));
+ rtw_pktfile_read(ppktfile, (u8 *)&ip_hdr, sizeof(ip_hdr));
/* user_prio = (ntohs(ip_hdr.tos) >> 5) & 0x3; */
user_prio = ip_hdr.tos >> 5;
} else if (pattrib->ether_type == 0x888e) {
@@ -484,7 +484,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p


rtw_open_pktfile(pkt, &pktfile);
- _rtw_pktfile_read(&pktfile, (u8 *)&etherhdr, ETH_HLEN);
+ rtw_pktfile_read(&pktfile, (u8 *)&etherhdr, ETH_HLEN);

pattrib->ether_type = ntohs(etherhdr.h_proto);

@@ -512,7 +512,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
/* to prevent DHCP protocol fail */
u8 tmp[24];

- _rtw_pktfile_read(&pktfile, &tmp[0], 24);
+ rtw_pktfile_read(&pktfile, &tmp[0], 24);
pattrib->dhcp_pkt = 0;
if (pktfile.pkt_len > 282) {/* MINIMUM_DHCP_PACKET_SIZE) { */
if (((tmp[21] == 68) && (tmp[23] == 67)) ||
@@ -963,7 +963,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct
}

rtw_open_pktfile(pkt, &pktfile);
- _rtw_pktfile_read(&pktfile, NULL, pattrib->pkt_hdrlen);
+ rtw_pktfile_read(&pktfile, NULL, pattrib->pkt_hdrlen);

frg_inx = 0;
frg_len = pxmitpriv->frag_len - 4;/* 2346-4 = 2342 */
@@ -1021,9 +1021,9 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct

if (bmcst) {
/* don't do fragment to broadcast/multicast packets */
- mem_sz = _rtw_pktfile_read(&pktfile, pframe, pattrib->pktlen);
+ mem_sz = rtw_pktfile_read(&pktfile, pframe, pattrib->pktlen);
} else {
- mem_sz = _rtw_pktfile_read(&pktfile, pframe, mpdu_len);
+ mem_sz = rtw_pktfile_read(&pktfile, pframe, mpdu_len);
}

pframe += mem_sz;
--
2.37.2

2022-08-20 18:42:42

by Michael Straube

[permalink] [raw]
Subject: [PATCH 13/19] staging: r8188eu: move struct pkt_file to rtw_xmit.h

The code that uses struct pkt_file has been moved to rtw_xmit.c.
Move the structure definition to rtw_xmit.h.

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/include/rtw_xmit.h | 9 +++++++++
drivers/staging/r8188eu/include/xmit_osdep.h | 9 ---------
2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index 034a9f8f51c9..0e9471fb19e4 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -304,6 +304,15 @@ struct xmit_priv {
struct submit_ctx ack_tx_ops;
};

+struct pkt_file {
+ struct sk_buff *pkt;
+ size_t pkt_len; /* the remainder length of the open_file */
+ unsigned char *cur_buffer;
+ u8 *buf_start;
+ u8 *cur_addr;
+ size_t buf_len;
+};
+
struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv);
s32 rtw_free_xmitbuf_ext(struct xmit_priv *pxmitpriv,
struct xmit_buf *pxmitbuf);
diff --git a/drivers/staging/r8188eu/include/xmit_osdep.h b/drivers/staging/r8188eu/include/xmit_osdep.h
index bcecf0bb2b18..612cdab52a9f 100644
--- a/drivers/staging/r8188eu/include/xmit_osdep.h
+++ b/drivers/staging/r8188eu/include/xmit_osdep.h
@@ -7,15 +7,6 @@
#include "osdep_service.h"
#include "drv_types.h"

-struct pkt_file {
- struct sk_buff *pkt;
- size_t pkt_len; /* the remainder length of the open_file */
- unsigned char *cur_buffer;
- u8 *buf_start;
- u8 *cur_addr;
- size_t buf_len;
-};
-
extern int rtw_ht_enable;
extern int rtw_cbw40_enable;
extern int rtw_ampdu_enable;/* for enable tx_ampdu */
--
2.37.2

2022-08-20 18:42:51

by Michael Straube

[permalink] [raw]
Subject: [PATCH 19/19] staging: r8188eu: remove xmit_osdep.h

After previous cleanups the header xmit_osdep.h only contains some
structure forward declarations and extern declarations for some module
parameters. The forward declarations are not needed. We can make the
module parameters static in os_dep/os_intf.c and remove xmit_osdep.h.

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/core/rtw_mlme.c | 1 -
drivers/staging/r8188eu/core/rtw_sta_mgt.c | 1 -
drivers/staging/r8188eu/include/rtw_xmit.h | 3 ---
drivers/staging/r8188eu/include/xmit_osdep.h | 20 --------------------
drivers/staging/r8188eu/os_dep/os_intfs.c | 7 +++----
drivers/staging/r8188eu/os_dep/usb_intf.c | 1 -
6 files changed, 3 insertions(+), 30 deletions(-)
delete mode 100644 drivers/staging/r8188eu/include/xmit_osdep.h

diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c
index 9e7e0034d352..26d0aa307d17 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme.c
@@ -6,7 +6,6 @@
#include "../include/osdep_service.h"
#include "../include/drv_types.h"
#include "../include/recv_osdep.h"
-#include "../include/xmit_osdep.h"
#include "../include/hal_intf.h"
#include "../include/mlme_osdep.h"
#include "../include/sta_info.h"
diff --git a/drivers/staging/r8188eu/core/rtw_sta_mgt.c b/drivers/staging/r8188eu/core/rtw_sta_mgt.c
index 2b58e11896b4..2d61cc9169c8 100644
--- a/drivers/staging/r8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/r8188eu/core/rtw_sta_mgt.c
@@ -6,7 +6,6 @@
#include "../include/osdep_service.h"
#include "../include/drv_types.h"
#include "../include/recv_osdep.h"
-#include "../include/xmit_osdep.h"
#include "../include/mlme_osdep.h"
#include "../include/sta_info.h"

diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index 0d05ab9abcfb..8f54c41ba927 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -370,7 +370,4 @@ void rtw_ack_tx_done(struct xmit_priv *pxmitpriv, int status);
void rtw_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe);
int rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev);

-/* include after declaring struct xmit_buf, in order to avoid warning */
-#include "xmit_osdep.h"
-
#endif /* _RTL871X_XMIT_H_ */
diff --git a/drivers/staging/r8188eu/include/xmit_osdep.h b/drivers/staging/r8188eu/include/xmit_osdep.h
deleted file mode 100644
index 0a68b2dd8d5e..000000000000
--- a/drivers/staging/r8188eu/include/xmit_osdep.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
-/* Copyright(c) 2007 - 2011 Realtek Corporation. */
-
-#ifndef __XMIT_OSDEP_H_
-#define __XMIT_OSDEP_H_
-
-#include "osdep_service.h"
-#include "drv_types.h"
-
-extern int rtw_ht_enable;
-extern int rtw_cbw40_enable;
-extern int rtw_ampdu_enable;/* for enable tx_ampdu */
-
-struct xmit_priv;
-struct pkt_attrib;
-struct sta_xmit_priv;
-struct xmit_frame;
-struct xmit_buf;
-
-#endif /* __XMIT_OSDEP_H_ */
diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c
index 6405d88a4d24..2d2a1c27d433 100644
--- a/drivers/staging/r8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/r8188eu/os_dep/os_intfs.c
@@ -5,7 +5,6 @@

#include "../include/osdep_service.h"
#include "../include/drv_types.h"
-#include "../include/xmit_osdep.h"
#include "../include/recv_osdep.h"
#include "../include/hal_intf.h"
#include "../include/rtw_ioctl.h"
@@ -66,9 +65,9 @@ static int rtw_uapsd_acvo_en;

static int rtw_led_enable = 1;

-int rtw_ht_enable = 1;
-int rtw_cbw40_enable = 3; /* 0 :disable, bit(0): enable 2.4g, bit(1): enable 5g */
-int rtw_ampdu_enable = 1;/* for enable tx_ampdu */
+static int rtw_ht_enable = 1;
+static int rtw_cbw40_enable = 3; /* 0 :disable, bit(0): enable 2.4g, bit(1): enable 5g */
+static int rtw_ampdu_enable = 1;/* for enable tx_ampdu */
static int rtw_rx_stbc = 1;/* 0: disable, bit(0):enable 2.4g, bit(1):enable 5g, default is set to enable 2.4GHZ for IOT issue with bufflao's AP at 5GHZ */
static int rtw_ampdu_amsdu;/* 0: disabled, 1:enabled, 2:auto */

diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c
index 0c752cf0c6c5..2bc88dc03fa8 100644
--- a/drivers/staging/r8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/r8188eu/os_dep/usb_intf.c
@@ -5,7 +5,6 @@
#include "../include/osdep_service.h"
#include "../include/drv_types.h"
#include "../include/recv_osdep.h"
-#include "../include/xmit_osdep.h"
#include "../include/hal_intf.h"
#include "../include/osdep_intf.h"
#include "../include/usb_ops.h"
--
2.37.2

2022-08-20 18:43:09

by Michael Straube

[permalink] [raw]
Subject: [PATCH 08/19] staging: r8188eu: make _rtw_open_pktfile() static

The function _rtw_open_pktfile() is only used in rtw_xmit.c.
Make it static.

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/core/rtw_xmit.c | 19 ++++++++++++++++++
drivers/staging/r8188eu/include/xmit_osdep.h | 1 -
drivers/staging/r8188eu/os_dep/xmit_linux.c | 21 --------------------
3 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index eef1a27e84eb..6cf583fd9890 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -402,6 +402,25 @@ u8 qos_acm(u8 acm_mask, u8 priority)
return change_priority;
}

+static void _rtw_open_pktfile(struct sk_buff *pktptr, struct pkt_file *pfile)
+{
+ if (!pktptr) {
+ pr_err("8188eu: pktptr is NULL\n");
+ return;
+ }
+ if (!pfile) {
+ pr_err("8188eu: pfile is NULL\n");
+ return;
+ }
+ pfile->pkt = pktptr;
+ pfile->cur_addr = pktptr->data;
+ pfile->buf_start = pktptr->data;
+ pfile->pkt_len = pktptr->len;
+ pfile->buf_len = pktptr->len;
+
+ pfile->cur_buffer = pfile->buf_start;
+}
+
static void set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
{
struct ethhdr etherhdr;
diff --git a/drivers/staging/r8188eu/include/xmit_osdep.h b/drivers/staging/r8188eu/include/xmit_osdep.h
index 2c663c00b985..2ecbe3f01aa8 100644
--- a/drivers/staging/r8188eu/include/xmit_osdep.h
+++ b/drivers/staging/r8188eu/include/xmit_osdep.h
@@ -30,7 +30,6 @@ struct xmit_buf;

int rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev);

-void _rtw_open_pktfile(struct sk_buff *pkt, struct pkt_file *pfile);
uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen);

void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt);
diff --git a/drivers/staging/r8188eu/os_dep/xmit_linux.c b/drivers/staging/r8188eu/os_dep/xmit_linux.c
index 3d298d8187d2..c917024843a2 100644
--- a/drivers/staging/r8188eu/os_dep/xmit_linux.c
+++ b/drivers/staging/r8188eu/os_dep/xmit_linux.c
@@ -17,27 +17,6 @@ static uint rtw_remainder_len(struct pkt_file *pfile)
(size_t)(pfile->buf_start));
}

-void _rtw_open_pktfile(struct sk_buff *pktptr, struct pkt_file *pfile)
-{
-
- if (!pktptr) {
- pr_err("8188eu: pktptr is NULL\n");
- return;
- }
- if (!pfile) {
- pr_err("8188eu: pfile is NULL\n");
- return;
- }
- pfile->pkt = pktptr;
- pfile->cur_addr = pktptr->data;
- pfile->buf_start = pktptr->data;
- pfile->pkt_len = pktptr->len;
- pfile->buf_len = pktptr->len;
-
- pfile->cur_buffer = pfile->buf_start;
-
-}
-
uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen)
{
uint len = 0;
--
2.37.2

2022-08-20 18:43:10

by Michael Straube

[permalink] [raw]
Subject: [PATCH 18/19] staging: r8188eu: remove os_dep/xmit_linux.c

Move the last remaining function rtw_xmit_entry(), and the static
functions it calls, from os_dep/xmit_linux.c to core/rtw_xmit.c and
remove the now empty file os_dep/xmit_linux.c.

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/Makefile | 1 -
drivers/staging/r8188eu/core/rtw_xmit.c | 102 ++++++++++++++++
drivers/staging/r8188eu/include/rtw_xmit.h | 1 +
drivers/staging/r8188eu/include/xmit_osdep.h | 2 -
drivers/staging/r8188eu/os_dep/xmit_linux.c | 115 -------------------
5 files changed, 103 insertions(+), 118 deletions(-)
delete mode 100644 drivers/staging/r8188eu/os_dep/xmit_linux.c

diff --git a/drivers/staging/r8188eu/Makefile b/drivers/staging/r8188eu/Makefile
index b38fb8157d79..afafe6957155 100644
--- a/drivers/staging/r8188eu/Makefile
+++ b/drivers/staging/r8188eu/Makefile
@@ -27,7 +27,6 @@ r8188eu-y = \
os_dep/osdep_service.o \
os_dep/usb_intf.o \
os_dep/usb_ops_linux.o \
- os_dep/xmit_linux.o \
core/rtw_ap.o \
core/rtw_br_ext.o \
core/rtw_cmd.o \
diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index f8d6f458b83e..d41d1d09d8ae 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -2226,3 +2226,105 @@ void rtw_ack_tx_done(struct xmit_priv *pxmitpriv, int status)
if (pxmitpriv->ack_tx)
rtw_sctx_done_err(&pack_tx_ops, status);
}
+
+static void rtw_check_xmit_resource(struct adapter *padapter, struct sk_buff *pkt)
+{
+ struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
+ u16 queue;
+
+ queue = skb_get_queue_mapping(pkt);
+ if (padapter->registrypriv.wifi_spec) {
+ /* No free space for Tx, tx_worker is too slow */
+ if (pxmitpriv->hwxmits[queue].accnt > WMM_XMIT_THRESHOLD)
+ netif_stop_subqueue(padapter->pnetdev, queue);
+ } else {
+ if (pxmitpriv->free_xmitframe_cnt <= 4) {
+ if (!netif_tx_queue_stopped(netdev_get_tx_queue(padapter->pnetdev, queue)))
+ netif_stop_subqueue(padapter->pnetdev, queue);
+ }
+ }
+}
+
+static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb)
+{
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
+ struct list_head *phead, *plist;
+ struct sk_buff *newskb;
+ struct sta_info *psta = NULL;
+ s32 res;
+
+ spin_lock_bh(&pstapriv->asoc_list_lock);
+ phead = &pstapriv->asoc_list;
+ plist = phead->next;
+
+ /* free sta asoc_queue */
+ while (phead != plist) {
+ psta = container_of(plist, struct sta_info, asoc_list);
+
+ plist = plist->next;
+
+ /* avoid come from STA1 and send back STA1 */
+ if (!memcmp(psta->hwaddr, &skb->data[6], 6))
+ continue;
+
+ newskb = skb_copy(skb, GFP_ATOMIC);
+
+ if (newskb) {
+ memcpy(newskb->data, psta->hwaddr, 6);
+ res = rtw_xmit(padapter, &newskb);
+ if (res < 0) {
+ pxmitpriv->tx_drop++;
+ dev_kfree_skb_any(newskb);
+ } else {
+ pxmitpriv->tx_pkts++;
+ }
+ } else {
+ pxmitpriv->tx_drop++;
+
+ spin_unlock_bh(&pstapriv->asoc_list_lock);
+ return false; /* Caller shall tx this multicast frame via normal way. */
+ }
+ }
+
+ spin_unlock_bh(&pstapriv->asoc_list_lock);
+ dev_kfree_skb_any(skb);
+ return true;
+}
+
+int rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev)
+{
+ struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev);
+ struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ s32 res = 0;
+
+ if (!rtw_if_up(padapter))
+ goto drop_packet;
+
+ rtw_check_xmit_resource(padapter, pkt);
+
+ if (!rtw_mc2u_disable && check_fwstate(pmlmepriv, WIFI_AP_STATE) &&
+ (IP_MCAST_MAC(pkt->data) || ICMPV6_MCAST_MAC(pkt->data)) &&
+ (padapter->registrypriv.wifi_spec == 0)) {
+ if (pxmitpriv->free_xmitframe_cnt > (NR_XMITFRAME / 4)) {
+ res = rtw_mlcst2unicst(padapter, pkt);
+ if (res)
+ goto exit;
+ }
+ }
+
+ res = rtw_xmit(padapter, &pkt);
+ if (res < 0)
+ goto drop_packet;
+
+ pxmitpriv->tx_pkts++;
+ goto exit;
+
+drop_packet:
+ pxmitpriv->tx_drop++;
+ dev_kfree_skb_any(pkt);
+
+exit:
+ return 0;
+}
diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index be9a7afad8ea..0d05ab9abcfb 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -368,6 +368,7 @@ int rtw_ack_tx_wait(struct xmit_priv *pxmitpriv, u32 timeout_ms);
void rtw_ack_tx_done(struct xmit_priv *pxmitpriv, int status);

void rtw_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe);
+int rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev);

/* include after declaring struct xmit_buf, in order to avoid warning */
#include "xmit_osdep.h"
diff --git a/drivers/staging/r8188eu/include/xmit_osdep.h b/drivers/staging/r8188eu/include/xmit_osdep.h
index ae738d215e99..0a68b2dd8d5e 100644
--- a/drivers/staging/r8188eu/include/xmit_osdep.h
+++ b/drivers/staging/r8188eu/include/xmit_osdep.h
@@ -17,6 +17,4 @@ struct sta_xmit_priv;
struct xmit_frame;
struct xmit_buf;

-int rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev);
-
#endif /* __XMIT_OSDEP_H_ */
diff --git a/drivers/staging/r8188eu/os_dep/xmit_linux.c b/drivers/staging/r8188eu/os_dep/xmit_linux.c
deleted file mode 100644
index 4721447a02e8..000000000000
--- a/drivers/staging/r8188eu/os_dep/xmit_linux.c
+++ /dev/null
@@ -1,115 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/* Copyright(c) 2007 - 2012 Realtek Corporation. */
-
-#define _XMIT_OSDEP_C_
-
-#include "../include/osdep_service.h"
-#include "../include/drv_types.h"
-#include "../include/wifi.h"
-#include "../include/mlme_osdep.h"
-#include "../include/xmit_osdep.h"
-#include "../include/osdep_intf.h"
-#include "../include/usb_osintf.h"
-
-static void rtw_check_xmit_resource(struct adapter *padapter, struct sk_buff *pkt)
-{
- struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
- u16 queue;
-
- queue = skb_get_queue_mapping(pkt);
- if (padapter->registrypriv.wifi_spec) {
- /* No free space for Tx, tx_worker is too slow */
- if (pxmitpriv->hwxmits[queue].accnt > WMM_XMIT_THRESHOLD)
- netif_stop_subqueue(padapter->pnetdev, queue);
- } else {
- if (pxmitpriv->free_xmitframe_cnt <= 4) {
- if (!netif_tx_queue_stopped(netdev_get_tx_queue(padapter->pnetdev, queue)))
- netif_stop_subqueue(padapter->pnetdev, queue);
- }
- }
-}
-
-static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb)
-{
- struct sta_priv *pstapriv = &padapter->stapriv;
- struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
- struct list_head *phead, *plist;
- struct sk_buff *newskb;
- struct sta_info *psta = NULL;
- s32 res;
-
- spin_lock_bh(&pstapriv->asoc_list_lock);
- phead = &pstapriv->asoc_list;
- plist = phead->next;
-
- /* free sta asoc_queue */
- while (phead != plist) {
- psta = container_of(plist, struct sta_info, asoc_list);
-
- plist = plist->next;
-
- /* avoid come from STA1 and send back STA1 */
- if (!memcmp(psta->hwaddr, &skb->data[6], 6))
- continue;
-
- newskb = skb_copy(skb, GFP_ATOMIC);
-
- if (newskb) {
- memcpy(newskb->data, psta->hwaddr, 6);
- res = rtw_xmit(padapter, &newskb);
- if (res < 0) {
- pxmitpriv->tx_drop++;
- dev_kfree_skb_any(newskb);
- } else {
- pxmitpriv->tx_pkts++;
- }
- } else {
- pxmitpriv->tx_drop++;
-
- spin_unlock_bh(&pstapriv->asoc_list_lock);
- return false; /* Caller shall tx this multicast frame via normal way. */
- }
- }
-
- spin_unlock_bh(&pstapriv->asoc_list_lock);
- dev_kfree_skb_any(skb);
- return true;
-}
-
-int rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev)
-{
- struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev);
- struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- s32 res = 0;
-
- if (!rtw_if_up(padapter))
- goto drop_packet;
-
- rtw_check_xmit_resource(padapter, pkt);
-
- if (!rtw_mc2u_disable && check_fwstate(pmlmepriv, WIFI_AP_STATE) &&
- (IP_MCAST_MAC(pkt->data) || ICMPV6_MCAST_MAC(pkt->data)) &&
- (padapter->registrypriv.wifi_spec == 0)) {
- if (pxmitpriv->free_xmitframe_cnt > (NR_XMITFRAME / 4)) {
- res = rtw_mlcst2unicst(padapter, pkt);
- if (res)
- goto exit;
- }
- }
-
- res = rtw_xmit(padapter, &pkt);
- if (res < 0)
- goto drop_packet;
-
- pxmitpriv->tx_pkts++;
- goto exit;
-
-drop_packet:
- pxmitpriv->tx_drop++;
- dev_kfree_skb_any(pkt);
-
-exit:
-
- return 0;
-}
--
2.37.2

2022-08-20 18:43:13

by Michael Straube

[permalink] [raw]
Subject: [PATCH 15/19] staging: r8188eu: rename rtw_os_xmit_complete()

The function rtw_os_xmit_complete() was moved from the os_dep
directory. It looks like the driver was originaly written to support
different operating systems. Obviously we do not need an extra 'os'
in the function name that indicates that the function is operating
system specific. Rename it to rtw_xmit_complete().

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/core/rtw_mlme_ext.c | 2 +-
drivers/staging/r8188eu/core/rtw_xmit.c | 10 +++++-----
drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 4 ++--
drivers/staging/r8188eu/include/rtw_xmit.h | 2 +-
4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
index 3103e8871dfd..893dac30e8e6 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
@@ -7876,7 +7876,7 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf)

spin_unlock_bh(&psta_bmc->sleep_q.lock);
if (rtl8188eu_hal_xmit(padapter, pxmitframe))
- rtw_os_xmit_complete(padapter, pxmitframe);
+ rtw_xmit_complete(padapter, pxmitframe);
spin_lock_bh(&psta_bmc->sleep_q.lock);
}
spin_unlock_bh(&psta_bmc->sleep_q.lock);
diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index d5878b31bdbb..760b115938f2 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -229,7 +229,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
return res;
}

-void rtw_os_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe)
+void rtw_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe)
{
if (pxframe->pkt)
rtw_os_pkt_complete(padapter, pxframe->pkt);
@@ -249,7 +249,7 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)
return;

for (i = 0; i < NR_XMITFRAME; i++) {
- rtw_os_xmit_complete(padapter, pxmitframe);
+ rtw_xmit_complete(padapter, pxmitframe);

pxmitframe++;
}
@@ -2017,7 +2017,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta)

spin_unlock_bh(&psta->sleep_q.lock);
if (rtl8188eu_hal_xmit(padapter, pxmitframe))
- rtw_os_xmit_complete(padapter, pxmitframe);
+ rtw_xmit_complete(padapter, pxmitframe);
spin_lock_bh(&psta->sleep_q.lock);
}

@@ -2067,7 +2067,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta)

spin_unlock_bh(&psta_bmc->sleep_q.lock);
if (rtl8188eu_hal_xmit(padapter, pxmitframe))
- rtw_os_xmit_complete(padapter, pxmitframe);
+ rtw_xmit_complete(padapter, pxmitframe);
spin_lock_bh(&psta_bmc->sleep_q.lock);
}

@@ -2141,7 +2141,7 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst
pxmitframe->attrib.triggered = 1;

if (rtl8188eu_hal_xmit(padapter, pxmitframe))
- rtw_os_xmit_complete(padapter, pxmitframe);
+ rtw_xmit_complete(padapter, pxmitframe);

if ((psta->sleepq_ac_len == 0) && (!psta->has_legacy_ac) && (wmmps_ac)) {
pstapriv->tim_bitmap &= ~BIT(psta->aid);
diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
index bdfa51949289..8e4a5acc0b18 100644
--- a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
@@ -431,7 +431,7 @@ bool rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmit
rtw_xmitframe_coalesce(adapt, pxmitframe->pkt, pxmitframe);

/* always return ndis_packet after rtw_xmitframe_coalesce */
- rtw_os_xmit_complete(adapt, pxmitframe);
+ rtw_xmit_complete(adapt, pxmitframe);

/* 3 2. aggregate same priority and same DA(AP or STA) frames */
pfirstframe = pxmitframe;
@@ -501,7 +501,7 @@ bool rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmit

rtw_xmitframe_coalesce(adapt, pxmitframe->pkt, pxmitframe);
/* always return ndis_packet after rtw_xmitframe_coalesce */
- rtw_os_xmit_complete(adapt, pxmitframe);
+ rtw_xmit_complete(adapt, pxmitframe);

/* (len - TXDESC_SIZE) == pxmitframe->attrib.last_txcmdsz */
update_txdesc(pxmitframe, pxmitframe->buf_addr, pxmitframe->attrib.last_txcmdsz, true);
diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index 0c46b19d2842..2475ca084265 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -364,7 +364,7 @@ u32 rtw_get_ff_hwaddr(struct xmit_frame *pxmitframe);
int rtw_ack_tx_wait(struct xmit_priv *pxmitpriv, u32 timeout_ms);
void rtw_ack_tx_done(struct xmit_priv *pxmitpriv, int status);

-void rtw_os_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe);
+void rtw_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe);

/* include after declaring struct xmit_buf, in order to avoid warning */
#include "xmit_osdep.h"
--
2.37.2

2022-08-20 18:43:21

by Michael Straube

[permalink] [raw]
Subject: [PATCH 09/19] staging: r8188eu: rename _rtw_open_pktfile()

There is no need to prefix the function name of _rtw_open_pktfile()
with an underscore. Rename it to rtw_open_pktfile().

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

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 6cf583fd9890..caacf35485dd 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -402,7 +402,7 @@ u8 qos_acm(u8 acm_mask, u8 priority)
return change_priority;
}

-static void _rtw_open_pktfile(struct sk_buff *pktptr, struct pkt_file *pfile)
+static void rtw_open_pktfile(struct sk_buff *pktptr, struct pkt_file *pfile)
{
if (!pktptr) {
pr_err("8188eu: pktptr is NULL\n");
@@ -427,7 +427,7 @@ static void set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
struct iphdr ip_hdr;
s32 user_prio = 0;

- _rtw_open_pktfile(ppktfile->pkt, ppktfile);
+ rtw_open_pktfile(ppktfile->pkt, ppktfile);
_rtw_pktfile_read(ppktfile, (unsigned char *)&etherhdr, ETH_HLEN);

/* get user_prio from IP hdr */
@@ -461,7 +461,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p



- _rtw_open_pktfile(pkt, &pktfile);
+ rtw_open_pktfile(pkt, &pktfile);
_rtw_pktfile_read(&pktfile, (u8 *)&etherhdr, ETH_HLEN);

pattrib->ether_type = ntohs(etherhdr.h_proto);
@@ -940,7 +940,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct
goto exit;
}

- _rtw_open_pktfile(pkt, &pktfile);
+ rtw_open_pktfile(pkt, &pktfile);
_rtw_pktfile_read(&pktfile, NULL, pattrib->pkt_hdrlen);

frg_inx = 0;
--
2.37.2

2022-08-20 18:44:58

by Michael Straube

[permalink] [raw]
Subject: [PATCH 10/19] staging: r8188eu: make _rtw_pktfile_read() static

The function _rtw_pktfile_read() is only used in rtw_xmit.c.
Make it static.

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/core/rtw_xmit.c | 22 ++++++++++++++++++++
drivers/staging/r8188eu/include/xmit_osdep.h | 2 --
drivers/staging/r8188eu/os_dep/xmit_linux.c | 22 --------------------
3 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index caacf35485dd..26bf300e672b 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -421,6 +421,28 @@ static void rtw_open_pktfile(struct sk_buff *pktptr, struct pkt_file *pfile)
pfile->cur_buffer = pfile->buf_start;
}

+static uint rtw_remainder_len(struct pkt_file *pfile)
+{
+ return pfile->buf_len - ((size_t)(pfile->cur_addr) -
+ (size_t)(pfile->buf_start));
+}
+
+static uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen)
+{
+ uint len = 0;
+
+ len = rtw_remainder_len(pfile);
+ len = (rlen > len) ? len : rlen;
+
+ if (rmem)
+ skb_copy_bits(pfile->pkt, pfile->buf_len - pfile->pkt_len, rmem, len);
+
+ pfile->cur_addr += len;
+ pfile->pkt_len -= len;
+
+ return len;
+}
+
static void set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
{
struct ethhdr etherhdr;
diff --git a/drivers/staging/r8188eu/include/xmit_osdep.h b/drivers/staging/r8188eu/include/xmit_osdep.h
index 2ecbe3f01aa8..bcecf0bb2b18 100644
--- a/drivers/staging/r8188eu/include/xmit_osdep.h
+++ b/drivers/staging/r8188eu/include/xmit_osdep.h
@@ -30,8 +30,6 @@ struct xmit_buf;

int rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev);

-uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen);
-
void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt);
void rtw_os_xmit_complete(struct adapter *padapter,
struct xmit_frame *pxframe);
diff --git a/drivers/staging/r8188eu/os_dep/xmit_linux.c b/drivers/staging/r8188eu/os_dep/xmit_linux.c
index c917024843a2..e216ada44055 100644
--- a/drivers/staging/r8188eu/os_dep/xmit_linux.c
+++ b/drivers/staging/r8188eu/os_dep/xmit_linux.c
@@ -11,28 +11,6 @@
#include "../include/osdep_intf.h"
#include "../include/usb_osintf.h"

-static uint rtw_remainder_len(struct pkt_file *pfile)
-{
- return pfile->buf_len - ((size_t)(pfile->cur_addr) -
- (size_t)(pfile->buf_start));
-}
-
-uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen)
-{
- uint len = 0;
-
- len = rtw_remainder_len(pfile);
- len = (rlen > len) ? len : rlen;
-
- if (rmem)
- skb_copy_bits(pfile->pkt, pfile->buf_len - pfile->pkt_len, rmem, len);
-
- pfile->cur_addr += len;
- pfile->pkt_len -= len;
-
- return len;
-}
-
#define WMM_XMIT_THRESHOLD (NR_XMITFRAME * 2 / 5)

void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt)
--
2.37.2

2022-08-20 19:09:54

by Michael Straube

[permalink] [raw]
Subject: [PATCH 04/19] staging: r8188eu: make rtw_os_xmit_resource_alloc() static

The function rtw_os_xmit_resource_alloc() is only used in rtw_xmit.c.
Make it static.

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/core/rtw_xmit.c | 17 +++++++++++++++++
drivers/staging/r8188eu/include/xmit_osdep.h | 2 --
drivers/staging/r8188eu/os_dep/xmit_linux.c | 16 ----------------
3 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 48631ef56114..6f3a70a1ab3c 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -33,6 +33,23 @@ void _rtw_init_sta_xmit_priv(struct sta_xmit_priv *psta_xmitpriv)
INIT_LIST_HEAD(&psta_xmitpriv->apsd);
}

+static int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitbuf,
+ u32 alloc_sz)
+{
+ pxmitbuf->pallocated_buf = kzalloc(alloc_sz, GFP_KERNEL);
+ if (!pxmitbuf->pallocated_buf)
+ return _FAIL;
+
+ 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)
+ return _FAIL;
+
+ return _SUCCESS;
+}
+
s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
{
int i;
diff --git a/drivers/staging/r8188eu/include/xmit_osdep.h b/drivers/staging/r8188eu/include/xmit_osdep.h
index 5a09355a142a..82b47b38bafd 100644
--- a/drivers/staging/r8188eu/include/xmit_osdep.h
+++ b/drivers/staging/r8188eu/include/xmit_osdep.h
@@ -30,8 +30,6 @@ struct xmit_buf;

int rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev);

-int rtw_os_xmit_resource_alloc(struct adapter *padapter,
- struct xmit_buf *pxmitbuf, u32 alloc_sz);
void rtw_os_xmit_resource_free(struct adapter *padapter,
struct xmit_buf *pxmitbuf, u32 free_sz);

diff --git a/drivers/staging/r8188eu/os_dep/xmit_linux.c b/drivers/staging/r8188eu/os_dep/xmit_linux.c
index 9759ff5ea76d..fdecb5e1a784 100644
--- a/drivers/staging/r8188eu/os_dep/xmit_linux.c
+++ b/drivers/staging/r8188eu/os_dep/xmit_linux.c
@@ -54,22 +54,6 @@ uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen)
return len;
}

-int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitbuf, u32 alloc_sz)
-{
- pxmitbuf->pallocated_buf = kzalloc(alloc_sz, GFP_KERNEL);
- if (!pxmitbuf->pallocated_buf)
- return _FAIL;
-
- 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)
- return _FAIL;
-
- return _SUCCESS;
-}
-
void rtw_os_xmit_resource_free(struct adapter *padapter,
struct xmit_buf *pxmitbuf, u32 free_sz)
{
--
2.37.2

2022-08-20 19:11:07

by Michael Straube

[permalink] [raw]
Subject: [PATCH 16/19] staging: r8188eu: make rtw_os_pkt_complete() static

The function rtw_os_pkt_complete() is only used in rtw_xmit.c.
Make it static.

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/core/rtw_xmit.c | 18 ++++++++++++++++++
drivers/staging/r8188eu/include/rtw_xmit.h | 3 +++
drivers/staging/r8188eu/include/xmit_osdep.h | 4 ----
drivers/staging/r8188eu/os_dep/xmit_linux.c | 20 --------------------
4 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 760b115938f2..c324dada4f5b 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -229,6 +229,24 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
return res;
}

+static void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt)
+{
+ u16 queue;
+ struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
+
+ queue = skb_get_queue_mapping(pkt);
+ if (padapter->registrypriv.wifi_spec) {
+ if (__netif_subqueue_stopped(padapter->pnetdev, queue) &&
+ (pxmitpriv->hwxmits[queue].accnt < WMM_XMIT_THRESHOLD))
+ netif_wake_subqueue(padapter->pnetdev, queue);
+ } else {
+ if (__netif_subqueue_stopped(padapter->pnetdev, queue))
+ netif_wake_subqueue(padapter->pnetdev, queue);
+ }
+
+ dev_kfree_skb_any(pkt);
+}
+
void rtw_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe)
{
if (pxframe->pkt)
diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index 2475ca084265..be9a7afad8ea 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -7,6 +7,9 @@
#include "osdep_service.h"
#include "drv_types.h"

+#define NR_XMITFRAME 256
+#define WMM_XMIT_THRESHOLD (NR_XMITFRAME * 2 / 5)
+
#define MAX_XMITBUF_SZ (20480) /* 20k */
#define NR_XMITBUFF (4)

diff --git a/drivers/staging/r8188eu/include/xmit_osdep.h b/drivers/staging/r8188eu/include/xmit_osdep.h
index b881399fd989..ae738d215e99 100644
--- a/drivers/staging/r8188eu/include/xmit_osdep.h
+++ b/drivers/staging/r8188eu/include/xmit_osdep.h
@@ -11,8 +11,6 @@ extern int rtw_ht_enable;
extern int rtw_cbw40_enable;
extern int rtw_ampdu_enable;/* for enable tx_ampdu */

-#define NR_XMITFRAME 256
-
struct xmit_priv;
struct pkt_attrib;
struct sta_xmit_priv;
@@ -21,6 +19,4 @@ struct xmit_buf;

int rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev);

-void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt);
-
#endif /* __XMIT_OSDEP_H_ */
diff --git a/drivers/staging/r8188eu/os_dep/xmit_linux.c b/drivers/staging/r8188eu/os_dep/xmit_linux.c
index d67508096209..4721447a02e8 100644
--- a/drivers/staging/r8188eu/os_dep/xmit_linux.c
+++ b/drivers/staging/r8188eu/os_dep/xmit_linux.c
@@ -11,26 +11,6 @@
#include "../include/osdep_intf.h"
#include "../include/usb_osintf.h"

-#define WMM_XMIT_THRESHOLD (NR_XMITFRAME * 2 / 5)
-
-void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt)
-{
- u16 queue;
- struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
-
- queue = skb_get_queue_mapping(pkt);
- if (padapter->registrypriv.wifi_spec) {
- if (__netif_subqueue_stopped(padapter->pnetdev, queue) &&
- (pxmitpriv->hwxmits[queue].accnt < WMM_XMIT_THRESHOLD))
- netif_wake_subqueue(padapter->pnetdev, queue);
- } else {
- if (__netif_subqueue_stopped(padapter->pnetdev, queue))
- netif_wake_subqueue(padapter->pnetdev, queue);
- }
-
- dev_kfree_skb_any(pkt);
-}
-
static void rtw_check_xmit_resource(struct adapter *padapter, struct sk_buff *pkt)
{
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
--
2.37.2

2022-08-21 20:37:44

by Philipp Hortmann

[permalink] [raw]
Subject: Re: [PATCH 01/19] staging: r8188eu: make rtw_remainder_len() static

On 8/20/22 20:16, Michael Straube wrote:
> The function rtw_remainder_len() is only used in xmit_linux.c.
> Make it static.
>
> Signed-off-by: Michael Straube <[email protected]>
> ---
> drivers/staging/r8188eu/include/xmit_osdep.h | 1 -
> drivers/staging/r8188eu/os_dep/xmit_linux.c | 2 +-
> 2 files changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/include/xmit_osdep.h b/drivers/staging/r8188eu/include/xmit_osdep.h
> index 130dc06efe73..55347de455c8 100644
> --- a/drivers/staging/r8188eu/include/xmit_osdep.h
> +++ b/drivers/staging/r8188eu/include/xmit_osdep.h
> @@ -37,7 +37,6 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter,
> void rtw_os_xmit_resource_free(struct adapter *padapter,
> struct xmit_buf *pxmitbuf, u32 free_sz);
>
> -uint rtw_remainder_len(struct pkt_file *pfile);
> void _rtw_open_pktfile(struct sk_buff *pkt, struct pkt_file *pfile);
> uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen);
>
> diff --git a/drivers/staging/r8188eu/os_dep/xmit_linux.c b/drivers/staging/r8188eu/os_dep/xmit_linux.c
> index 85ef27735b88..33400a9b08e1 100644
> --- a/drivers/staging/r8188eu/os_dep/xmit_linux.c
> +++ b/drivers/staging/r8188eu/os_dep/xmit_linux.c
> @@ -11,7 +11,7 @@
> #include "../include/osdep_intf.h"
> #include "../include/usb_osintf.h"
>
> -uint rtw_remainder_len(struct pkt_file *pfile)
> +static uint rtw_remainder_len(struct pkt_file *pfile)
> {
> return pfile->buf_len - ((size_t)(pfile->cur_addr) -
> (size_t)(pfile->buf_start));

Hi Michael,

cannot apply your patch on top of the patch series(11),
[PATCH] staging: r8188eu: remove ODM_ConfigRFWithHeaderFile()

cat ~/Downloads/\[PATCH\ 01_19\]\ staging\ r8188eu\ make\
rtw_remainder_len\(\)\ static.eml | git am
Applying: staging: r8188eu: make rtw_remainder_len() static
error: patch failed: drivers/staging/r8188eu/include/xmit_osdep.h:37
error: drivers/staging/r8188eu/include/xmit_osdep.h: patch does not apply
Patch failed at 0001 staging: r8188eu: make rtw_remainder_len() static

It looks like it should fit but it does not. Have you changed something
manual in the patch?

Thanks for your support.

Bye Philipp

2022-08-21 20:59:40

by Michael Straube

[permalink] [raw]
Subject: Re: [PATCH 01/19] staging: r8188eu: make rtw_remainder_len() static

On 8/21/22 21:57, Philipp Hortmann wrote:
> On 8/20/22 20:16, Michael Straube wrote:
>> The function rtw_remainder_len() is only used in xmit_linux.c.
>> Make it static.
>>
>> Signed-off-by: Michael Straube <[email protected]>
>> ---
>>   drivers/staging/r8188eu/include/xmit_osdep.h | 1 -
>>   drivers/staging/r8188eu/os_dep/xmit_linux.c  | 2 +-
>>   2 files changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/staging/r8188eu/include/xmit_osdep.h
>> b/drivers/staging/r8188eu/include/xmit_osdep.h
>> index 130dc06efe73..55347de455c8 100644
>> --- a/drivers/staging/r8188eu/include/xmit_osdep.h
>> +++ b/drivers/staging/r8188eu/include/xmit_osdep.h
>> @@ -37,7 +37,6 @@ int rtw_os_xmit_resource_alloc(struct adapter
>> *padapter,
>>   void rtw_os_xmit_resource_free(struct adapter *padapter,
>>                      struct xmit_buf *pxmitbuf, u32 free_sz);
>> -uint rtw_remainder_len(struct pkt_file *pfile);
>>   void _rtw_open_pktfile(struct sk_buff *pkt, struct pkt_file *pfile);
>>   uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen);
>> diff --git a/drivers/staging/r8188eu/os_dep/xmit_linux.c
>> b/drivers/staging/r8188eu/os_dep/xmit_linux.c
>> index 85ef27735b88..33400a9b08e1 100644
>> --- a/drivers/staging/r8188eu/os_dep/xmit_linux.c
>> +++ b/drivers/staging/r8188eu/os_dep/xmit_linux.c
>> @@ -11,7 +11,7 @@
>>   #include "../include/osdep_intf.h"
>>   #include "../include/usb_osintf.h"
>> -uint rtw_remainder_len(struct pkt_file *pfile)
>> +static uint rtw_remainder_len(struct pkt_file *pfile)
>>   {
>>       return pfile->buf_len - ((size_t)(pfile->cur_addr) -
>>              (size_t)(pfile->buf_start));
>
> Hi Michael,
>
> cannot apply your patch on top of the patch series(11),
> [PATCH] staging: r8188eu: remove ODM_ConfigRFWithHeaderFile()
>
> cat ~/Downloads/\[PATCH\ 01_19\]\ staging\ r8188eu\ make\
> rtw_remainder_len\(\)\ static.eml | git am
> Applying: staging: r8188eu: make rtw_remainder_len() static
> error: patch failed: drivers/staging/r8188eu/include/xmit_osdep.h:37
> error: drivers/staging/r8188eu/include/xmit_osdep.h: patch does not apply
> Patch failed at 0001 staging: r8188eu: make rtw_remainder_len() static
>
> It looks like it should fit but it does not. Have you changed something
> manual in the patch?
>
> Thanks for your support.
>
> Bye Philipp
>

Hi Philipp,

looks like you didn't apply

[PATCH] staging: r8188eu: remove rtw_endofpktfile()

first. On top of that it should work.
I mentioned that in the cover letter. ;)

thanks,
Michael

2022-08-22 18:37:58

by Philipp Hortmann

[permalink] [raw]
Subject: Re: [PATCH 00/19] staging: r8188eu: migrate os_dep/xmit_linux.c

On 8/20/22 20:16, Michael Straube wrote:
> This series moves the functions, or their functionality, from
> os_dep/xmit_linux.c to the core/* part of the driver and finally
> removes os_dep/xmit_linux.c and the xmit_osdep.h header.
>
> Tested on x86_64 with Inter-Tech DMG-02.
>
> Please apply this on top of:
> [PATCH] staging: r8188eu: remove rtw_endofpktfile()
>
> Thanks,
> Michael
>
> Michael Straube (19):
> staging: r8188eu: make rtw_remainder_len() static
> staging: r8188eu: make rtw_os_xmit_schedule() static
> staging: r8188eu: rename rtw_os_xmit_schedule()
> staging: r8188eu: make rtw_os_xmit_resource_alloc() static
> staging: r8188eu: rename rtw_os_xmit_resource_alloc()
> staging: r8188eu: make rtw_os_xmit_resource_free() static
> staging: r8188eu: rename rtw_os_xmit_resource_free()
> staging: r8188eu: make _rtw_open_pktfile() static
> staging: r8188eu: rename _rtw_open_pktfile()
> staging: r8188eu: make _rtw_pktfile_read() static
> staging: r8188eu: rename _rtw_pktfile_read()
> staging: r8188eu: remove unnecessary initialization to zero
> staging: r8188eu: move struct pkt_file to rtw_xmit.h
> staging: r8188eu: move rtw_os_xmit_complete() to rtw_xmit.c
> staging: r8188eu: rename rtw_os_xmit_complete()
> staging: r8188eu: make rtw_os_pkt_complete() static
> staging: r8188eu: rename rtw_os_pkt_complete()
> staging: r8188eu: remove os_dep/xmit_linux.c
> staging: r8188eu: remove xmit_osdep.h
>
> drivers/staging/r8188eu/Makefile | 1 -
> drivers/staging/r8188eu/core/rtw_mlme.c | 23 +-
> drivers/staging/r8188eu/core/rtw_mlme_ext.c | 2 +-
> drivers/staging/r8188eu/core/rtw_sta_mgt.c | 1 -
> drivers/staging/r8188eu/core/rtw_xmit.c | 232 +++++++++++++++++--
> drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 4 +-
> drivers/staging/r8188eu/include/rtw_xmit.h | 16 +-
> drivers/staging/r8188eu/include/xmit_osdep.h | 48 ----
> drivers/staging/r8188eu/os_dep/os_intfs.c | 7 +-
> drivers/staging/r8188eu/os_dep/usb_intf.c | 1 -
> drivers/staging/r8188eu/os_dep/xmit_linux.c | 226 ------------------
> 11 files changed, 251 insertions(+), 310 deletions(-)
> delete mode 100644 drivers/staging/r8188eu/include/xmit_osdep.h
> delete mode 100644 drivers/staging/r8188eu/os_dep/xmit_linux.c
>

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