Commit 11617b77 authored by Martin Kaiser's avatar Martin Kaiser Committed by Greg Kroah-Hartman

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: default avatarMartin Kaiser <martin@kaiser.cx>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Link: https://lore.kernel.org/r/20230123205342.229589-2-martin@kaiser.cxSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2529ca21
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment