All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/7] netdev: move netdev_station_info to diagnostic.h
@ 2021-01-22 18:14 James Prestwood
  2021-01-22 18:14 ` [PATCH v3 2/7] diagnostic: commonize the building of diagnostic dict James Prestwood
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: James Prestwood @ 2021-01-22 18:14 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 7609 bytes --]

With AP now getting its own diagnostic interface it made sense
to move the netdev_station_info struct definition into its own
header which eventually can be accompanied by utilities in
diagnostic.c. These utilities can then be shared with AP and
station as needed.
---
 src/diagnostic.h | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/netdev.c     | 23 ++++++++++++-----------
 src/netdev.h     | 34 ++++-----------------------------
 src/station.c    |  6 ++++--
 4 files changed, 69 insertions(+), 43 deletions(-)
 create mode 100644 src/diagnostic.h

diff --git a/src/diagnostic.h b/src/diagnostic.h
new file mode 100644
index 00000000..8292d192
--- /dev/null
+++ b/src/diagnostic.h
@@ -0,0 +1,49 @@
+/*
+ *
+ *  Wireless daemon for Linux
+ *
+ *  Copyright (C) 2020  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
+ *
+ */
+
+enum diagnostic_mcs_type {
+	DIAGNOSTIC_MCS_TYPE_NONE,
+	DIAGNOSTIC_MCS_TYPE_HT,
+	DIAGNOSTIC_MCS_TYPE_VHT,
+	DIAGNOSTIC_MCS_TYPE_HE,
+};
+
+struct diagnostic_station_info {
+	uint8_t addr[6];
+	int8_t cur_rssi;
+
+	enum diagnostic_mcs_type rx_mcs_type;
+	uint32_t rx_bitrate;
+	uint8_t rx_mcs;
+	enum diagnostic_mcs_type tx_mcs_type;
+	uint32_t tx_bitrate;
+	uint8_t tx_mcs;
+
+	uint32_t expected_throughput;
+
+	bool have_cur_rssi : 1;
+	bool have_rx_mcs : 1;
+	bool have_tx_mcs : 1;
+	bool have_rx_bitrate : 1;
+	bool have_tx_bitrate : 1;
+	bool have_expected_throughput : 1;
+};
diff --git a/src/netdev.c b/src/netdev.c
index e3ce270a..a19270c0 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -61,6 +61,7 @@
 #include "src/fils.h"
 #include "src/auth-proto.h"
 #include "src/frame-xchg.h"
+#include "src/diagnostic.h"
 
 #ifndef ENOTSUPP
 #define ENOTSUPP 524
@@ -369,7 +370,7 @@ int netdev_set_powered(struct netdev *netdev, bool powered,
 }
 
 static bool netdev_parse_bitrate(struct l_genl_attr *attr,
-					enum netdev_mcs_type *type_out,
+					enum diagnostic_mcs_type *type_out,
 					uint32_t *rate_out,
 					uint8_t *mcs_out)
 {
@@ -377,7 +378,7 @@ static bool netdev_parse_bitrate(struct l_genl_attr *attr,
 	const void *data;
 	uint32_t rate = 0;
 	uint8_t mcs = 0;
-	enum netdev_mcs_type mcs_type = NETDEV_MCS_TYPE_NONE;
+	enum diagnostic_mcs_type mcs_type = DIAGNOSTIC_MCS_TYPE_NONE;
 
 	while (l_genl_attr_next(attr, &type, &len, &data)) {
 		switch (type) {
@@ -394,7 +395,7 @@ static bool netdev_parse_bitrate(struct l_genl_attr *attr,
 				return false;
 
 			mcs = l_get_u8(data);
-			mcs_type = NETDEV_MCS_TYPE_HT;
+			mcs_type = DIAGNOSTIC_MCS_TYPE_HT;
 
 			break;
 
@@ -403,7 +404,7 @@ static bool netdev_parse_bitrate(struct l_genl_attr *attr,
 				return false;
 
 			mcs = l_get_u8(data);
-			mcs_type = NETDEV_MCS_TYPE_VHT;
+			mcs_type = DIAGNOSTIC_MCS_TYPE_VHT;
 
 			break;
 
@@ -412,7 +413,7 @@ static bool netdev_parse_bitrate(struct l_genl_attr *attr,
 				return false;
 
 			mcs = l_get_u8(data);
-			mcs_type = NETDEV_MCS_TYPE_HE;
+			mcs_type = DIAGNOSTIC_MCS_TYPE_HE;
 
 			break;
 		}
@@ -424,14 +425,14 @@ static bool netdev_parse_bitrate(struct l_genl_attr *attr,
 	*type_out = mcs_type;
 	*rate_out = rate;
 
-	if (mcs_type != NETDEV_MCS_TYPE_NONE)
+	if (mcs_type != DIAGNOSTIC_MCS_TYPE_NONE)
 		*mcs_out = mcs;
 
 	return true;
 }
 
 static bool netdev_parse_sta_info(struct l_genl_attr *attr,
-					struct netdev_station_info *info)
+					struct diagnostic_station_info *info)
 {
 	uint16_t type, len;
 	const void *data;
@@ -458,7 +459,7 @@ static bool netdev_parse_sta_info(struct l_genl_attr *attr,
 
 			info->have_rx_bitrate = true;
 
-			if (info->rx_mcs_type != NETDEV_MCS_TYPE_NONE)
+			if (info->rx_mcs_type != DIAGNOSTIC_MCS_TYPE_NONE)
 				info->have_rx_mcs = true;
 
 			break;
@@ -474,7 +475,7 @@ static bool netdev_parse_sta_info(struct l_genl_attr *attr,
 
 			info->have_tx_bitrate = true;
 
-			if (info->tx_mcs_type != NETDEV_MCS_TYPE_NONE)
+			if (info->tx_mcs_type != DIAGNOSTIC_MCS_TYPE_NONE)
 				info->have_tx_mcs = true;
 
 			break;
@@ -511,7 +512,7 @@ static void netdev_rssi_poll_cb(struct l_genl_msg *msg, void *user_data)
 	uint16_t type, len;
 	const void *data;
 	bool found;
-	struct netdev_station_info info;
+	struct diagnostic_station_info info;
 	uint8_t prev_rssi_level_idx = netdev->cur_rssi_level_idx;
 
 	netdev->rssi_poll_cmd_id = 0;
@@ -4156,7 +4157,7 @@ static void netdev_get_station_cb(struct l_genl_msg *msg, void *user_data)
 	struct l_genl_attr attr, nested;
 	uint16_t type, len;
 	const void *data;
-	struct netdev_station_info info;
+	struct diagnostic_station_info info;
 
 	netdev->get_station_cmd_id = 0;
 
diff --git a/src/netdev.h b/src/netdev.h
index e7a1c060..d5adcf09 100644
--- a/src/netdev.h
+++ b/src/netdev.h
@@ -27,6 +27,7 @@ struct scan_bss;
 struct handshake_state;
 struct eapol_sm;
 struct mmpdu_header;
+struct diagnostic_station_info;
 
 enum netdev_result {
 	NETDEV_RESULT_OK,
@@ -114,36 +115,9 @@ typedef void (*netdev_station_watch_func_t)(struct netdev *netdev,
 					const uint8_t *mac, bool added,
 					void *user_data);
 
-enum netdev_mcs_type {
-	NETDEV_MCS_TYPE_NONE,
-	NETDEV_MCS_TYPE_HT,
-	NETDEV_MCS_TYPE_VHT,
-	NETDEV_MCS_TYPE_HE,
-};
-
-struct netdev_station_info {
-	uint8_t addr[6];
-	int8_t cur_rssi;
-
-	enum netdev_mcs_type rx_mcs_type;
-	uint32_t rx_bitrate;
-	uint8_t rx_mcs;
-	enum netdev_mcs_type tx_mcs_type;
-	uint32_t tx_bitrate;
-	uint8_t tx_mcs;
-
-	uint32_t expected_throughput;
-
-	bool have_cur_rssi : 1;
-	bool have_rx_mcs : 1;
-	bool have_tx_mcs : 1;
-	bool have_rx_bitrate : 1;
-	bool have_tx_bitrate : 1;
-	bool have_expected_throughput : 1;
-};
-
-typedef void (*netdev_get_station_cb_t)(const struct netdev_station_info *info,
-					void *user_data);
+typedef void (*netdev_get_station_cb_t)(
+				const struct diagnostic_station_info *info,
+				void *user_data);
 
 struct wiphy *netdev_get_wiphy(struct netdev *netdev);
 const uint8_t *netdev_get_address(struct netdev *netdev);
diff --git a/src/station.c b/src/station.c
index c65fc0cc..41f19b09 100644
--- a/src/station.c
+++ b/src/station.c
@@ -53,6 +53,7 @@
 #include "src/netconfig.h"
 #include "src/anqp.h"
 #include "src/anqputil.h"
+#include "src/diagnostic.h"
 
 static struct l_queue *station_list;
 static uint32_t netdev_watch;
@@ -3455,8 +3456,9 @@ static void station_destroy_interface(void *user_data)
 	station_free(station);
 }
 
-static void station_get_diagnostic_cb(const struct netdev_station_info *info,
-					void *user_data)
+static void station_get_diagnostic_cb(
+				const struct diagnostic_station_info *info,
+				void *user_data)
 {
 	struct station *station = user_data;
 	struct l_dbus_message *reply;
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-01-22 18:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-22 18:14 [PATCH v3 1/7] netdev: move netdev_station_info to diagnostic.h James Prestwood
2021-01-22 18:14 ` [PATCH v3 2/7] diagnostic: commonize the building of diagnostic dict James Prestwood
2021-01-22 18:14 ` [PATCH v3 3/7] station: refactor to use diagnostic_info_to_dict James Prestwood
2021-01-22 18:14 ` [PATCH v3 4/7] ap: add AP diagnostic interface James Prestwood
2021-01-22 18:14 ` [PATCH v3 5/7] client: implement diagnostic module James Prestwood
2021-01-22 18:14 ` [PATCH v3 6/7] client: implement "ap <wlan> show" James Prestwood
2021-01-22 18:14 ` [PATCH v3 7/7] client: update station to use diagnostic_display James Prestwood

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.