2022-04-14 07:41:07

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 2/4] staging: r8188eu: merge _mgt_dispatcher into mgt_dispatcher

All that the _mgt_dispatcher function does is to call a function from
a function pointer. It's not worth having a separate function for this.

Merge _mgt_dispatcher into mgt_dispatcher.

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

diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
index 66dd06371991..ba071de4c05c 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
@@ -390,19 +390,6 @@ void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext)
}
}

-static void _mgt_dispatcher(struct adapter *padapter, struct mlme_handler *ptable, struct recv_frame *precv_frame)
-{
- u8 *pframe = precv_frame->rx_data;
-
- if (ptable->func) {
- /* receive the frames that ra(a1) is my address or ra(a1) is bc address. */
- if (memcmp(GetAddr1Ptr(pframe), myid(&padapter->eeprompriv), ETH_ALEN) &&
- !is_broadcast_ether_addr(GetAddr1Ptr(pframe)))
- return;
- ptable->func(padapter, precv_frame);
- }
-}
-
void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame)
{
int index;
@@ -442,7 +429,14 @@ void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame)
else
ptable->func = &OnAuthClient;
}
- _mgt_dispatcher(padapter, ptable, precv_frame);
+
+ if (ptable->func) {
+ /* receive the frames that ra(a1) is my address or ra(a1) is bc address. */
+ if (memcmp(GetAddr1Ptr(pframe), myid(&padapter->eeprompriv), ETH_ALEN) &&
+ !is_broadcast_ether_addr(GetAddr1Ptr(pframe)))
+ return;
+ ptable->func(padapter, precv_frame);
+ }
}

static u32 p2p_listen_state_process(struct adapter *padapter, unsigned char *da)
--
2.30.2


2022-04-14 14:53:28

by Pavel Skripkin

[permalink] [raw]
Subject: Re: [PATCH 2/4] staging: r8188eu: merge _mgt_dispatcher into mgt_dispatcher

Hi Martin,

On 4/13/22 23:07, Martin Kaiser wrote:
> All that the _mgt_dispatcher function does is to call a function from
> a function pointer. It's not worth having a separate function for this.
>
> Merge _mgt_dispatcher into mgt_dispatcher.
>
> Signed-off-by: Martin Kaiser <[email protected]>
> ---

[code snip]

> +
> + if (ptable->func) {
> + /* receive the frames that ra(a1) is my address or ra(a1) is bc address. */
> + if (memcmp(GetAddr1Ptr(pframe), myid(&padapter->eeprompriv), ETH_ALEN) &&
> + !is_broadcast_ether_addr(GetAddr1Ptr(pframe)))
> + return;
> + ptable->func(padapter, precv_frame);
> + }
> }

Looks like each `mlme_sta_tbl` element has `func` member initialized. I
think, we can remove this check.




With regards,
Pavel Skripkin

2022-04-18 15:40:52

by Martin Kaiser

[permalink] [raw]
Subject: Re: [PATCH 2/4] staging: r8188eu: merge _mgt_dispatcher into mgt_dispatcher

Hi Pavel,

Thus wrote Pavel Skripkin ([email protected]):

> On 4/13/22 23:07, Martin Kaiser wrote:
> > All that the _mgt_dispatcher function does is to call a function from
> > a function pointer. It's not worth having a separate function for this.

> > Merge _mgt_dispatcher into mgt_dispatcher.

> > Signed-off-by: Martin Kaiser <[email protected]>
> > ---

> [code snip]

> > +
> > + if (ptable->func) {
> > + /* receive the frames that ra(a1) is my address or ra(a1) is bc address. */
> > + if (memcmp(GetAddr1Ptr(pframe), myid(&padapter->eeprompriv), ETH_ALEN) &&
> > + !is_broadcast_ether_addr(GetAddr1Ptr(pframe)))
> > + return;
> > + ptable->func(padapter, precv_frame);
> > + }
> > }

> Looks like each `mlme_sta_tbl` element has `func` member initialized. I
> think, we can remove this check.

I've just sent a series to refactor mgt_dispatcher.

All mlme_sta_tbl entries have a function pointer, but some of the point
to a dummy function DoReserved. I guess we should use NULL and keep the
check instead of calling a function that does nothing.

Best regards,
Martin