Skip to contentSkip to conversation

phy: remove split dump feature

PATCH New Alexander Aring 1 participant 5 messages Nov 8, 2014 IEEE 802.15.4

lore
Share & tools
lore

Alexander Aring

author maintainer
#0 lore raw

PATCH 1/5 phy: remove split dump feature

This patch removes the split dump feature. We don't use this right now in kernelspace and was copy&pasted from iw tool.

---
 src/info.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
src/info.c +1 -8
index 6bbe3f0..50a7bba 100644
@@ -79,8 +79,6 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
 	return 0;
 }
 
-static bool nl802154_has_split_wiphy = false;
-
 static int handle_info(struct nl802154_state *state,
 		       struct nl_cb *cb,
 		       struct nl_msg *msg,
@@ -88,13 +86,8 @@ static int handle_info(struct nl802154_state *state,
 		       enum id_input id)
 {
 	char *feat_args[] = { "features", "-q" };
-	int err;
 
-	err = handle_cmd(state, CIB_NONE, 2, feat_args);
-	if (!err && nl802154_has_split_wiphy) {
-		nla_put_flag(msg, NL802154_ATTR_SPLIT_WPAN_PHY_DUMP);
-		nlmsg_hdr(msg)->nlmsg_flags |= NLM_F_DUMP;
-	}
+	handle_cmd(state, CIB_NONE, 2, feat_args);
 
 	nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_phy_handler, NULL);
 
Signature · 1 line
2.1.3
author maintainer
#1 lore raw

PATCH 2/5 interface: backoff exponents print human readable

First print the minumum then the maxmimum backoff exponent attributes.

---
 src/interface.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
src/interface.c +2 -3
index 808b246..40c18ef 100644
@@ -160,12 +160,12 @@ static int print_iface_handler(struct nl_msg *msg, void *arg)
 		printf("%s\twpan_phy %d\n", indent, nla_get_u32(tb_msg[NL802154_ATTR_WPAN_PHY]));
 	if (tb_msg[NL802154_ATTR_MAX_FRAME_RETRIES])
 		printf("%s\tmax_frame_retries %d\n", indent, nla_get_s8(tb_msg[NL802154_ATTR_MAX_FRAME_RETRIES]));
+	if (tb_msg[NL802154_ATTR_MIN_BE])
+		printf("%s\tmin_be %d\n", indent, nla_get_u8(tb_msg[NL802154_ATTR_MIN_BE]));
 	if (tb_msg[NL802154_ATTR_MAX_BE])
 		printf("%s\tmax_be %d\n", indent, nla_get_u8(tb_msg[NL802154_ATTR_MAX_BE]));
 	if (tb_msg[NL802154_ATTR_MAX_CSMA_BACKOFFS])
 		printf("%s\tmax_csma_backoffs %d\n", indent, nla_get_u8(tb_msg[NL802154_ATTR_MAX_CSMA_BACKOFFS]));
-	if (tb_msg[NL802154_ATTR_MIN_BE])
-		printf("%s\tmin_be %d\n", indent, nla_get_u8(tb_msg[NL802154_ATTR_MIN_BE]));
 	if (tb_msg[NL802154_ATTR_LBT_MODE])
 		printf("%s\tlbt %d\n", indent, nla_get_u8(tb_msg[NL802154_ATTR_LBT_MODE]));
 
@@ -181,7 +181,6 @@ static int handle_interface_info(struct nl802154_state *state,
 	nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_iface_handler, NULL);
 	return 0;
 }
-
 TOPLEVEL(info, NULL, NL802154_CMD_GET_INTERFACE, 0, CIB_NETDEV, handle_interface_info,
 	 "Show information for this interface.");
 
Signature · 1 line
2.1.3
author maintainer
#2 lore raw

PATCH 3/5 mac: do backoff_exponent into one cmd

In reply to Alexander Aring

This patch do the backoff exponent setting in one netlink cmd. These parameters depends on each other and should be set in one cmd.

---
 src/mac.c | 54 +++++++++++++++++-------------------------------------
 1 file changed, 17 insertions(+), 37 deletions(-)
src/mac.c +17 -37
index a6c456f..3f2dfc8 100644
@@ -95,23 +95,30 @@ COMMAND(set, max_frame_retries, "<retries>",
 	NL802154_CMD_SET_MAX_FRAME_RETRIES, 0, CIB_NETDEV,
 	handle_max_frame_retries_set, NULL);
 
-static int handle_max_be(struct nl802154_state *state,
-			 struct nl_cb *cb,
-			 struct nl_msg *msg,
-			 int argc, char **argv,
-			 enum id_input id)
+static int handle_backoff_exponent(struct nl802154_state *state,
+				   struct nl_cb *cb,
+				   struct nl_msg *msg,
+				   int argc, char **argv,
+				   enum id_input id)
 {
 	unsigned long max_be;
+	unsigned long min_be;
 	char *end;
 
-	if (argc < 1)
+	if (argc < 2)
+		return 1;
+
+	/* MIN_BE */
+	min_be = strtoul(argv[0], &end, 0);
+	if (*end != '\0')
 		return 1;
 
 	/* MAX_BE */
-	max_be = strtoul(argv[0], &end, 0);
+	max_be = strtoul(argv[1], &end, 0);
 	if (*end != '\0')
 		return 1;
 
+	NLA_PUT_U8(msg, NL802154_ATTR_MIN_BE, min_be);
 	NLA_PUT_U8(msg, NL802154_ATTR_MAX_BE, max_be);
 
 	return 0;
@@ -119,9 +126,9 @@ static int handle_max_be(struct nl802154_state *state,
 nla_put_failure:
 	return -ENOBUFS;
 }
-COMMAND(set, max_be, "<max_be>",
-	NL802154_CMD_SET_MAX_BE, 0, CIB_NETDEV,
-	handle_max_be, NULL);
+COMMAND(set, backoff_exponents, "<min_be> <max_be>",
+	NL802154_CMD_SET_BACKOFF_EXPONENT, 0, CIB_NETDEV,
+	handle_backoff_exponent, NULL);
 
 static int handle_max_csma_backoffs(struct nl802154_state *state,
 				    struct nl_cb *cb,
@@ -151,33 +158,6 @@ COMMAND(set, max_csma_backoffs, "<backoffs>",
 	NL802154_CMD_SET_MAX_CSMA_BACKOFFS, 0, CIB_NETDEV,
 	handle_max_csma_backoffs, NULL);
 
-static int handle_min_be(struct nl802154_state *state,
-			 struct nl_cb *cb,
-			 struct nl_msg *msg,
-			 int argc, char **argv,
-			 enum id_input id)
-{
-	unsigned long min_be;
-	char *end;
-
-	if (argc < 1)
-		return 1;
-
-	/* MIN_BE */
-	min_be = strtoul(argv[0], &end, 0);
-	if (*end != '\0')
-		return 1;
-
-	NLA_PUT_U8(msg, NL802154_ATTR_MIN_BE, min_be);
-
-	return 0;
-
-nla_put_failure:
-	return -ENOBUFS;
-}
-COMMAND(set, min_be, "<min_be>",
-	NL802154_CMD_SET_MIN_BE, 0, CIB_NETDEV,
-	handle_min_be, NULL);
 
 static int handle_lbt_mode(struct nl802154_state *state,
 			   struct nl_cb *cb,
Signature · 1 line
2.1.3
author maintainer
#3 lore raw

PATCH 4/5 phy: do page and channel setting into one cmd

In reply to Alexander Aring

This patch puts the page and channel setting in one cmd. These parameters depends on each other and should be set in one cmd.

---
 src/phy.c | 40 ++++++++++------------------------------
 1 file changed, 10 insertions(+), 30 deletions(-)
src/phy.c +10 -30
index e57ad6a..8379786 100644
@@ -13,33 +13,6 @@
 #include "nl802154.h"
 #include "iwpan.h"
 
-static int handle_page_set(struct nl802154_state *state,
-			   struct nl_cb *cb,
-			   struct nl_msg *msg,
-			   int argc, char **argv,
-			   enum id_input id)
-{
-	unsigned long page;
-	char *end;
-
-	if (argc < 1)
-		return 1;
-
-	/* PAGE */
-	page = strtoul(argv[0], &end, 10);
-	if (*end != '\0')
-		return 1;
-
-	NLA_PUT_U8(msg, NL802154_ATTR_PAGE, page);
-
-	return 0;
-
-nla_put_failure:
-	return -ENOBUFS;
-}
-COMMAND(set, page, "<page>",
-	NL802154_CMD_SET_PAGE, 0, CIB_PHY, handle_page_set, NULL);
-
 static int handle_channel_set(struct nl802154_state *state,
 			      struct nl_cb *cb,
 			      struct nl_msg *msg,
@@ -47,16 +20,23 @@ static int handle_channel_set(struct nl802154_state *state,
 			      enum id_input id)
 {
 	unsigned long channel;
+	unsigned long page;
 	char *end;
 
-	if (argc < 1)
+	if (argc < 2)
+		return 1;
+
+	/* PAGE */
+	page = strtoul(argv[0], &end, 10);
+	if (*end != '\0')
 		return 1;
 
 	/* CHANNEL */
-	channel = strtoul(argv[0], &end, 10);
+	channel = strtoul(argv[1], &end, 10);
 	if (*end != '\0')
 		return 1;
 
+	NLA_PUT_U8(msg, NL802154_ATTR_PAGE, page);
 	NLA_PUT_U8(msg, NL802154_ATTR_CHANNEL, channel);
 
 	return 0;
@@ -64,7 +44,7 @@ static int handle_channel_set(struct nl802154_state *state,
 nla_put_failure:
 	return -ENOBUFS;
 }
-COMMAND(set, channel, "<channel>",
+COMMAND(set, channel, "<page> <channel>",
 	NL802154_CMD_SET_CHANNEL, 0, CIB_PHY, handle_channel_set, NULL);
 
 static int handle_tx_power_set(struct nl802154_state *state,
Signature · 1 line
2.1.3
author maintainer
#4 lore raw

PATCH 5/5 nl802154: update nl802154 header

In reply to Alexander Aring
---
 src/nl802154.h | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
src/nl802154.h +2 -8
index f799d59..0f86ef8 100644
@@ -38,7 +38,6 @@ enum nl802154_commands {
 	NL802154_CMD_NEW_INTERFACE,
 	NL802154_CMD_DEL_INTERFACE,
 
-	NL802154_CMD_SET_PAGE,
 	NL802154_CMD_SET_CHANNEL,
 
 	NL802154_CMD_SET_PAN_ID,
@@ -50,9 +49,8 @@ enum nl802154_commands {
 
 	NL802154_CMD_SET_MAX_FRAME_RETRIES,
 
-	NL802154_CMD_SET_MAX_BE,
+	NL802154_CMD_SET_BACKOFF_EXPONENT,
 	NL802154_CMD_SET_MAX_CSMA_BACKOFFS,
-	NL802154_CMD_SET_MIN_BE,
 
 	NL802154_CMD_SET_LBT_MODE,
 
@@ -77,10 +75,6 @@ enum nl802154_attrs {
 
 	NL802154_ATTR_WPAN_DEV,
 
-	NL802154_ATTR_IFACE_SOCKET_OWNER,
-
-	NL802154_ATTR_SPLIT_WPAN_PHY_DUMP,
-
 	NL802154_ATTR_PAGE,
 	NL802154_ATTR_CHANNEL,
 
@@ -96,8 +90,8 @@ enum nl802154_attrs {
 	NL802154_ATTR_MAX_FRAME_RETRIES,
 
 	NL802154_ATTR_MAX_BE,
-	NL802154_ATTR_MAX_CSMA_BACKOFFS,
 	NL802154_ATTR_MIN_BE,
+	NL802154_ATTR_MAX_CSMA_BACKOFFS,
 
 	NL802154_ATTR_LBT_MODE,
 
Signature · 1 line
2.1.3