From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH 2/3] hwsim: move frame processing into a separate function
Date: Wed, 28 Jun 2023 13:20:32 -0700 [thread overview]
Message-ID: <20230628202033.2320994-3-prestwoj@gmail.com> (raw)
In-Reply-To: <20230628202033.2320994-1-prestwoj@gmail.com>
The ADD/DEL_MAC_ADDR events come through the unicast handler so
move the frame processing to a separate function so these other
events can be handled.
---
tools/hwsim.c | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/tools/hwsim.c b/tools/hwsim.c
index ecee0a0a..2fee9b19 100644
--- a/tools/hwsim.c
+++ b/tools/hwsim.c
@@ -1572,7 +1572,9 @@ static void process_frame(struct hwsim_frame *frame)
hwsim_frame_unref(frame);
}
-static void unicast_handler(struct l_genl_msg *msg, void *user_data)
+
+
+static void hwsim_frame_event(struct l_genl_msg *msg)
{
struct hwsim_frame *frame;
const struct mmpdu_header *mpdu;
@@ -1581,9 +1583,6 @@ static void unicast_handler(struct l_genl_msg *msg, void *user_data)
const void *data;
const uint8_t *transmitter = NULL, *freq = NULL, *flags = NULL;
- if (l_genl_msg_get_command(msg) != HWSIM_CMD_FRAME)
- return;
-
if (!l_genl_attr_init(&attr, msg))
return;
@@ -1683,6 +1682,24 @@ static void unicast_handler(struct l_genl_msg *msg, void *user_data)
process_frame(frame);
}
+static void hwsim_unicast_handler(struct l_genl_msg *msg, void *user_data)
+{
+ uint8_t cmd;
+
+ if (l_genl_msg_get_error(msg) < 0)
+ return;
+
+ cmd = l_genl_msg_get_command(msg);
+
+ switch (cmd) {
+ case HWSIM_CMD_FRAME:
+ hwsim_frame_event(msg);
+ break;
+ default:
+ break;
+ }
+}
+
static void radio_manager_create_callback(struct l_genl_msg *msg,
void *user_data)
{
@@ -2939,8 +2956,9 @@ static void hwsim_ready(void)
}
if (!l_genl_add_unicast_watch(genl, "MAC80211_HWSIM",
- unicast_handler, NULL, NULL)) {
- l_error("Failed to set unicast handler");
+ hwsim_unicast_handler,
+ NULL, NULL)) {
+ l_error("Failed to set hwsim unicast handler");
goto error;
}
--
2.25.1
next prev parent reply other threads:[~2023-06-28 20:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-28 20:20 [PATCH 0/3] Handle DEL/ADD_MAC_ADDR events James Prestwood
2023-06-28 20:20 ` [PATCH 1/3] hwsim: add ADD/DEL_MAC_ADDR events James Prestwood
2023-06-28 20:20 ` James Prestwood [this message]
2023-06-28 20:20 ` [PATCH 3/3] hwsim: handle " James Prestwood
2023-06-28 20:49 ` James Prestwood
2023-07-06 3:05 ` Denis Kenzior
2023-07-06 3:04 ` [PATCH 0/3] Handle DEL/ADD_MAC_ADDR events Denis Kenzior
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=20230628202033.2320994-3-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.