wiphy: update wiphy_radio_work_is_running to return int
James Prestwood
PATCH v4 1/2 wiphy: update wiphy_radio_work_is_running to return int
This differentiates between pending, running, and non-existent:
false, true, -ENOENT respectively
--- src/wiphy.c | 10 +++++----- src/wiphy.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
v4:
* Changed to return true/false and -ENOENT rather than a zero success return
src/wiphy.c +5 -5
@@ -2013,14 +2013,14 @@ void wiphy_radio_work_done(struct wiphy *wiphy, uint32_t id)wiphy_radio_work_next (wiphy); } -bool wiphy_radio_work_is_running (struct wiphy *wiphy,uint32_t id) +int wiphy_radio_work_is_running (struct wiphy *wiphy,uint32_t id) { -struct wiphy_radio_work_item *item =l_queue_peek_head (wiphy->work); - +struct wiphy_radio_work_item *item =l_queue_find (wiphy->work, match_id, +L_UINT_TO_PTR (id));if (!item) -return false; +return -ENOENT ; -return item->id == id; +return item ==l_queue_peek_head (wiphy->work) ?1 :0 ; }static int wiphy_init (void )
src/wiphy.h +1 -1
@@ -130,4 +130,4 @@ uint32_t wiphy_radio_work_insert(struct wiphy *wiphy,int priority, const struct wiphy_radio_work_item_ops *ops);void wiphy_radio_work_done (struct wiphy *wiphy,uint32_t id); -bool wiphy_radio_work_is_running (struct wiphy *wiphy,uint32_t id); +int wiphy_radio_work_is_running (struct wiphy *wiphy,uint32_t id);
Signature · 1 line
2.31.1
Denis Kenzior
Hi James,
Quoted 10 lines · James Prestwood
This differentiates between pending, running, and non-existent:
false, true,-ENOENTrespectively--- src/wiphy.c | 10 +++++----- src/wiphy.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)v4:
* Changed to return true/false and-ENOENTrather than a zero success return
Both applied, thanks.
Regards,
-Denis
James Prestwood
PATCH v4 2/2 offchannel: introduce new offchannel module
In reply to James PrestwoodThis module provides a convenient wrapper around both CMD_[CANCEL_]_REMAIN_ON_CHANNEL APIs.
Certain protocols require going offchannel to send frames, and/or wait for a response. The frame-xchg module somewhat does this but has some limitations. For example you cannot just go offchannel; an initial frame must be sent out to start the procedure. In addition frame-xchg does not work for broadcasts since it expects an ACK.
This module is much simpler and only handles going offchannel for a duration. During this time frames may be sent or received. After the duration the caller will get a callback and any included error if there was one. Any offchannel request can be cancelled prior to the duration expriring if the offchannel work has finished early.
--- Makefile.am | 1 + src/offchannel.c | 325 +++++++++++++++++++++++++++++++++++++++++++++++ src/offchannel.h | 29 +++++ 3 files changed, 355 insertions(+) create mode 100644 src/offchannel.c create mode 100644 src/offchannel.h
v4:
* Updated to use new wiphy_radio_work_is_running return value
Makefile.am +1 -0
@@ -247,6 +247,7 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h src/missing.h \ src/ip-pool.h src/ip-pool.c \ src/band.h src/band.c \ src/sysfs.h src/sysfs.c \ + src/offchannel.h src/offchannel.c \ $(eap_sources) \ $(builtin_sources)
src/offchannel.c new file +325 -0
325 lines not on this page · raw message
src/offchannel.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* +* Wireless daemon for Linux +* +* Copyright (C) 2021 Intel Corporation. All rights reserved. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +* +*/ + +typedef void (*offchannel_started_cb_t )(void *user_data); +typedef void (*offchannel_destroy_cb_t )(int error,void *user_data); + +uint32_t offchannel_start (uint64_t wdev_id,uint32_t freq,uint32_t duration, +offchannel_started_cb_t started,void *user_data, +offchannel_destroy_cb_t destroy); +void offchannel_cancel (uint64_t wdev_id,uint32_t id);
Signature · 1 line
2.31.1