Skip to contentSkip to conversation

mac: phy: change to new nl802154 cmds

PATCH New Alexander Aring 1 participant 3 messages Mar 18, 2015 IEEE 802.15.4

lore
Share & tools
lore

Alexander Aring

author maintainer
#0 lore raw

cover mac: phy: change to new nl802154 cmds

Hi,

this patch series contains patches to change all netlink phy and mac settings into one phy/interface command. I will applu this series mainline to wpan-tools and make a new release when the corresponding kernel nl802154 are mainline.

There is one maybe _some_ cleaner solution to make something like:

#include <linux/version.h>

#if LINUX_VERSION_CODE <= KERNEL_VERSION(foo)
...
#else
...
#endif

this would rescue newer wpan-tools with older kernels. But requires the right kernel-headers while cross-compiling and such things. I don't think that this is really necessary here now. We make a simple cut now.

- Alex

Alexander Aring (2):
phy: use NL802154_CMD_SET_WPAN_PHY
mac: use NL802154_CMD_SET_INTERFACE

 src/mac.c | 12 ++++++------
 src/phy.c |  8 ++++----
 2 files changed, 10 insertions(+), 10 deletions(-)
Signature · 1 line
2.3.3
author maintainer
#1 lore raw

PATCH 1/2 phy: use NL802154_CMD_SET_WPAN_PHY

This patch change all set commands for phy settings to NL802154_CMD_SET_WPAN_PHY which is the new command. The decision which setting should be set is now determined which attribute is set.

---
 src/phy.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
src/phy.c +4 -4
index 2e25013..ff38a42 100644
@@ -45,7 +45,7 @@ nla_put_failure:
 	return -ENOBUFS;
 }
 COMMAND(set, channel, "<page> <channel>",
-	NL802154_CMD_SET_CHANNEL, 0, CIB_PHY, handle_channel_set, NULL);
+	NL802154_CMD_SET_WPAN_PHY, 0, CIB_PHY, handle_channel_set, NULL);
 
 static int handle_tx_power_set(struct nl802154_state *state,
 			       struct nl_cb *cb,
@@ -72,7 +72,7 @@ nla_put_failure:
 	return -ENOBUFS;
 }
 COMMAND(set, tx_power, "<dBm>",
-	NL802154_CMD_SET_TX_POWER, 0, CIB_PHY, handle_tx_power_set, NULL);
+	NL802154_CMD_SET_WPAN_PHY, 0, CIB_PHY, handle_tx_power_set, NULL);
 
 static int handle_cca_mode_set(struct nl802154_state *state,
 			       struct nl_cb *cb,
@@ -113,7 +113,7 @@ nla_put_failure:
 	return -ENOBUFS;
 }
 COMMAND(set, cca_mode, "<mode|3 <1|0>>",
-	NL802154_CMD_SET_CCA_MODE, 0, CIB_PHY, handle_cca_mode_set, NULL);
+	NL802154_CMD_SET_WPAN_PHY, 0, CIB_PHY, handle_cca_mode_set, NULL);
 
 static int handle_cca_ed_level(struct nl802154_state *state,
 			       struct nl_cb *cb,
@@ -140,4 +140,4 @@ nla_put_failure:
 	return -ENOBUFS;
 }
 COMMAND(set, cca_ed_level, "<level>",
-	NL802154_CMD_SET_CCA_ED_LEVEL, 0, CIB_PHY, handle_cca_ed_level, NULL);
+	NL802154_CMD_SET_WPAN_PHY, 0, CIB_PHY, handle_cca_ed_level, NULL);
Signature · 1 line
2.3.3
author maintainer
#2 lore raw

PATCH 2/2 mac: use NL802154_CMD_SET_INTERFACE

In reply to Alexander Aring

This patch change all set commands for mac interface settings to NL802154_CMD_SET_INTERFACE which is the new command. The decision which setting should be set is now determined which attribute is set.

---
 src/mac.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
src/mac.c +6 -6
index 703d09f..9dd8456 100644
@@ -38,7 +38,7 @@ nla_put_failure:
 	return -ENOBUFS;
 }
 COMMAND(set, pan_id, "<pan_id>",
-	NL802154_CMD_SET_PAN_ID, 0, CIB_NETDEV, handle_pan_id_set, NULL);
+	NL802154_CMD_SET_INTERFACE, 0, CIB_NETDEV, handle_pan_id_set, NULL);
 
 static int handle_short_addr_set(struct nl802154_state *state,
 				 struct nl_cb *cb,
@@ -65,7 +65,7 @@ nla_put_failure:
 	return -ENOBUFS;
 }
 COMMAND(set, short_addr, "<short_addr>",
-	NL802154_CMD_SET_SHORT_ADDR, 0, CIB_NETDEV, handle_short_addr_set, NULL);
+	NL802154_CMD_SET_INTERFACE, 0, CIB_NETDEV, handle_short_addr_set, NULL);
 
 static int handle_max_frame_retries_set(struct nl802154_state *state,
 					struct nl_cb *cb,
@@ -92,7 +92,7 @@ nla_put_failure:
 	return -ENOBUFS;
 }
 COMMAND(set, max_frame_retries, "<retries>",
-	NL802154_CMD_SET_MAX_FRAME_RETRIES, 0, CIB_NETDEV,
+	NL802154_CMD_SET_INTERFACE, 0, CIB_NETDEV,
 	handle_max_frame_retries_set, NULL);
 
 static int handle_backoff_exponent(struct nl802154_state *state,
@@ -127,7 +127,7 @@ nla_put_failure:
 	return -ENOBUFS;
 }
 COMMAND(set, backoff_exponents, "<min_be> <max_be>",
-	NL802154_CMD_SET_BACKOFF_EXPONENT, 0, CIB_NETDEV,
+	NL802154_CMD_SET_INTERFACE, 0, CIB_NETDEV,
 	handle_backoff_exponent, NULL);
 
 static int handle_max_csma_backoffs(struct nl802154_state *state,
@@ -155,7 +155,7 @@ nla_put_failure:
 	return -ENOBUFS;
 }
 COMMAND(set, max_csma_backoffs, "<backoffs>",
-	NL802154_CMD_SET_MAX_CSMA_BACKOFFS, 0, CIB_NETDEV,
+	NL802154_CMD_SET_INTERFACE, 0, CIB_NETDEV,
 	handle_max_csma_backoffs, NULL);
 
 
@@ -184,4 +184,4 @@ nla_put_failure:
 	return -ENOBUFS;
 }
 COMMAND(set, lbt, "<1|0>",
-	NL802154_CMD_SET_LBT_MODE, 0, CIB_NETDEV, handle_lbt_mode, NULL);
+	NL802154_CMD_SET_INTERFACE, 0, CIB_NETDEV, handle_lbt_mode, NULL);
Signature · 1 line
2.3.3