[PATCH wpan-tools 4/6] mac: add support for setting max_frame_retries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Alexander Aring <alex.aring@xxxxxxxxx>
---
 src/mac.c      | 29 +++++++++++++++++++++++++++++
 src/nl802154.h |  4 ++++
 2 files changed, 33 insertions(+)

diff --git a/src/mac.c b/src/mac.c
index 5fa1111..16d1156 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -9,6 +9,7 @@
 #include <netlink/msg.h>
 #include <netlink/attr.h>
 
+#include "nl_updates.h"
 #include "nl802154.h"
 #include "iwpan.h"
 
@@ -38,3 +39,31 @@ nla_put_failure:
 }
 COMMAND(set, pan_id, "<pan_id>",
 	NL802154_CMD_SET_PAN_ID, 0, CIB_NETDEV, handle_pan_id_set, NULL);
+
+static int handle_max_frame_retries_set(struct nl802154_state *state,
+					struct nl_cb *cb,
+					struct nl_msg *msg,
+					int argc, char **argv,
+					enum id_input id)
+{
+	long retries;
+	char *end;
+
+	if (argc < 1)
+		return 1;
+
+	/* RETRIES */
+	retries = strtol(argv[0], &end, 0);
+	if (*end != '\0')
+		return 1;
+
+	NLA_PUT_S8(msg, NL802154_ATTR_MAX_FRAME_RETRIES, retries);
+
+	return 0;
+
+nla_put_failure:
+	return -ENOBUFS;
+}
+COMMAND(set, max_frame_retries, "<retries>",
+	NL802154_CMD_SET_MAX_FRAME_RETRIES, 0, CIB_NETDEV,
+	handle_max_frame_retries_set, NULL);
diff --git a/src/nl802154.h b/src/nl802154.h
index 762fc38..a23c34f 100644
--- a/src/nl802154.h
+++ b/src/nl802154.h
@@ -46,6 +46,8 @@ enum nl802154_commands {
 	NL802154_CMD_SET_TX_POWER,
 	NL802154_CMD_SET_CCA_MODE,
 
+	NL802154_CMD_SET_MAX_FRAME_RETRIES,
+
 	/* add new commands above here */
 
 	/* used to define NL802154_CMD_MAX below */
@@ -78,6 +80,8 @@ enum nl802154_attrs {
 
 	NL802154_ATTR_CCA_MODE,
 
+	NL802154_ATTR_MAX_FRAME_RETRIES,
+
 	/* add attributes here, update the policy in nl802154.c */
 
 	__NL802154_ATTR_AFTER_LAST,
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wpan" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux