From: Martin Kaiser <martin@kaiser.cx>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
Phillip Potter <phil@philpotter.co.uk>,
Michael Straube <straube.linux@gmail.com>,
Pavel Skripkin <paskripkin@gmail.com>,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
Martin Kaiser <martin@kaiser.cx>
Subject: [PATCH 01/17] staging: r8188eu: restructure mlme subfunction handling
Date: Mon, 24 Oct 2022 10:14:01 +0200 [thread overview]
Message-ID: <20221024081417.66441-2-martin@kaiser.cx> (raw)
In-Reply-To: <20221024081417.66441-1-martin@kaiser.cx>
Move some code around in rtw_mlme_ext.c to make it simpler.
mlme_sta_tbl is used only by mgt_dispatcher. Move the table inside the
function. Move mgt_dispatcher behind the handler functions. We can then
make the handler functions static.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
drivers/staging/r8188eu/core/rtw_mlme_ext.c | 116 ++++++++++----------
1 file changed, 57 insertions(+), 59 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
index d44e455f09ca..15b7148fa898 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
@@ -12,24 +12,6 @@
#include "../include/rtl8188e_xmit.h"
#include "../include/rtl8188e_dm.h"
-/* response function for each management frame subtype, do not reorder */
-static mlme_handler mlme_sta_tbl[] = {
- OnAssocReq,
- OnAssocRsp,
- OnAssocReq,
- OnAssocRsp,
- OnProbeReq,
- OnProbeRsp,
- NULL,
- NULL,
- OnBeacon,
- NULL,
- OnDisassoc,
- OnAuthClient,
- OnDeAuth,
- OnAction,
-};
-
static u8 null_addr[ETH_ALEN] = {0, 0, 0, 0, 0, 0};
/**************************************************
@@ -393,47 +375,6 @@ void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext)
}
}
-void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame)
-{
- int index;
- mlme_handler fct;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)precv_frame->rx_data;
- struct sta_info *psta = rtw_get_stainfo(&padapter->stapriv, hdr->addr2);
-
- if (!ieee80211_is_mgmt(hdr->frame_control))
- return;
-
- /* receive the frames that ra(a1) is my address or ra(a1) is bc address. */
- if (memcmp(hdr->addr1, myid(&padapter->eeprompriv), ETH_ALEN) &&
- !is_broadcast_ether_addr(hdr->addr1))
- return;
-
- index = (le16_to_cpu(hdr->frame_control) & IEEE80211_FCTL_STYPE) >> 4;
- if (index >= ARRAY_SIZE(mlme_sta_tbl))
- return;
- fct = mlme_sta_tbl[index];
-
- if (psta) {
- if (ieee80211_has_retry(hdr->frame_control)) {
- if (precv_frame->attrib.seq_num == psta->RxMgmtFrameSeqNum)
- /* drop the duplicate management frame */
- return;
- }
- psta->RxMgmtFrameSeqNum = precv_frame->attrib.seq_num;
- }
-
- if (ieee80211_is_auth(hdr->frame_control)) {
- if (check_fwstate(pmlmepriv, WIFI_AP_STATE))
- fct = OnAuth;
- else
- fct = OnAuthClient;
- }
-
- if (fct)
- fct(padapter, precv_frame);
-}
-
static u32 p2p_listen_state_process(struct adapter *padapter, unsigned char *da)
{
bool response = true;
@@ -4004,6 +3945,63 @@ struct xmit_frame *alloc_mgtxmitframe(struct xmit_priv *pxmitpriv)
return pmgntframe;
}
+void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame)
+{
+ mlme_handler mlme_sta_tbl[] = {
+ OnAssocReq,
+ OnAssocRsp,
+ OnAssocReq,
+ OnAssocRsp,
+ OnProbeReq,
+ OnProbeRsp,
+ NULL,
+ NULL,
+ OnBeacon,
+ NULL,
+ OnDisassoc,
+ OnAuthClient,
+ OnDeAuth,
+ OnAction,
+ };
+ int index;
+ mlme_handler fct;
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)precv_frame->rx_data;
+ struct sta_info *psta = rtw_get_stainfo(&padapter->stapriv, hdr->addr2);
+
+ if (!ieee80211_is_mgmt(hdr->frame_control))
+ return;
+
+ /* receive the frames that ra(a1) is my address or ra(a1) is bc address. */
+ if (memcmp(hdr->addr1, myid(&padapter->eeprompriv), ETH_ALEN) &&
+ !is_broadcast_ether_addr(hdr->addr1))
+ return;
+
+ index = (le16_to_cpu(hdr->frame_control) & IEEE80211_FCTL_STYPE) >> 4;
+ if (index >= ARRAY_SIZE(mlme_sta_tbl))
+ return;
+ fct = mlme_sta_tbl[index];
+
+ if (psta) {
+ if (ieee80211_has_retry(hdr->frame_control)) {
+ if (precv_frame->attrib.seq_num == psta->RxMgmtFrameSeqNum)
+ /* drop the duplicate management frame */
+ return;
+ }
+ psta->RxMgmtFrameSeqNum = precv_frame->attrib.seq_num;
+ }
+
+ if (ieee80211_is_auth(hdr->frame_control)) {
+ if (check_fwstate(pmlmepriv, WIFI_AP_STATE))
+ fct = OnAuth;
+ else
+ fct = OnAuthClient;
+ }
+
+ if (fct)
+ fct(padapter, precv_frame);
+}
+
/****************************************************************************
Following are some TX functions for WiFi MLME
--
2.30.2
next prev parent reply other threads:[~2022-10-24 8:14 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-24 8:14 [PATCH 00/17] staging: r8188eu: clean up mlme handlers Martin Kaiser
2022-10-24 8:14 ` Martin Kaiser [this message]
2022-10-24 8:14 ` [PATCH 02/17] staging: r8188eu: make OnAssocReq static Martin Kaiser
2022-10-24 8:14 ` [PATCH 03/17] staging: r8188eu: make OnAssocRsp static Martin Kaiser
2022-10-24 8:14 ` [PATCH 04/17] staging: r8188eu: make OnProbeReq static Martin Kaiser
2022-10-24 8:14 ` [PATCH 05/17] staging: r8188eu: make OnProbeRsp static Martin Kaiser
2022-10-24 8:14 ` [PATCH 06/17] staging: r8188eu: make OnBeacon static Martin Kaiser
2022-10-24 8:14 ` [PATCH 07/17] staging: r8188eu: make OnDisassoc static Martin Kaiser
2022-10-24 8:14 ` [PATCH 08/17] staging: r8188eu: make OnAuthClient static Martin Kaiser
2022-10-24 8:14 ` [PATCH 09/17] staging: r8188eu: make OnDeAuth static Martin Kaiser
2022-10-24 8:14 ` [PATCH 10/17] staging: r8188eu: make OnAction static Martin Kaiser
2022-10-24 8:14 ` [PATCH 11/17] staging: r8188eu: make OnAuth static Martin Kaiser
2022-10-24 8:14 ` [PATCH 12/17] staging: r8188eu: change mlme handlers to void Martin Kaiser
2022-10-24 8:14 ` [PATCH 13/17] staging: r8188eu: remove unnecessary label Martin Kaiser
2022-10-24 8:14 ` [PATCH 14/17] staging: r8188eu: remove unnecessary else branch Martin Kaiser
2022-10-24 8:14 ` [PATCH 15/17] staging: r8188eu: remove unnecessary return Martin Kaiser
2022-10-24 8:14 ` [PATCH 16/17] staging: r8188eu: remove an else branch Martin Kaiser
2022-10-24 8:14 ` [PATCH 17/17] staging: r8188eu: go2asoc is not needed Martin Kaiser
2022-10-24 17:43 ` [PATCH 00/17] staging: r8188eu: clean up mlme handlers Philipp Hortmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221024081417.66441-2-martin@kaiser.cx \
--to=martin@kaiser.cx \
--cc=Larry.Finger@lwfinger.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=paskripkin@gmail.com \
--cc=phil@philpotter.co.uk \
--cc=straube.linux@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®