* [RFC PATCH 1/3] iw: fix makefile for cqm
@ 2010-05-11 8:39 Bruno Randolf
2010-05-11 8:39 ` [RFC PATCH 2/3] iw: sync nl80211.h with wireless-testing Bruno Randolf
2010-05-11 8:39 ` [RFC PATCH 3/3] iw: Add antenna set/get Bruno Randolf
0 siblings, 2 replies; 3+ messages in thread
From: Bruno Randolf @ 2010-05-11 8:39 UTC (permalink / raw)
To: johannes, linville; +Cc: linux-wireless, holgerschurig
Signed-off-by: Bruno Randolf <br1@einfach.org>
---
Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index e21900a..d303f45 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
OBJS = iw.o genl.o event.o info.o phy.o \
interface.o ibss.o station.o survey.o util.o \
mesh.o mpath.o scan.o reg.o version.o \
- reason.o status.o connect.o link.o offch.o ps.o cqm.c
+ reason.o status.o connect.o link.o offch.o ps.o cqm.o
OBJS += sections.o
ALL = iw
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [RFC PATCH 2/3] iw: sync nl80211.h with wireless-testing
2010-05-11 8:39 [RFC PATCH 1/3] iw: fix makefile for cqm Bruno Randolf
@ 2010-05-11 8:39 ` Bruno Randolf
2010-05-11 8:39 ` [RFC PATCH 3/3] iw: Add antenna set/get Bruno Randolf
1 sibling, 0 replies; 3+ messages in thread
From: Bruno Randolf @ 2010-05-11 8:39 UTC (permalink / raw)
To: johannes, linville; +Cc: linux-wireless, holgerschurig
adding AP isolate, set channel and antenna settings
Signed-off-by: Bruno Randolf <br1@einfach.org>
---
nl80211.h | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/nl80211.h b/nl80211.h
index daf6a34..46a2c76 100644
--- a/nl80211.h
+++ b/nl80211.h
@@ -52,6 +52,8 @@
* %NL80211_ATTR_WIPHY_CHANNEL_TYPE, %NL80211_ATTR_WIPHY_RETRY_SHORT,
* %NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
* and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD.
+ * However, for setting the channel, see %NL80211_CMD_SET_CHANNEL
+ * instead, the support here is for backward compatibility only.
* @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
* or rename notification. Has attributes %NL80211_ATTR_WIPHY and
* %NL80211_ATTR_WIPHY_NAME.
@@ -329,6 +331,18 @@
* @NL80211_CMD_NOTIFY_CQM: Connection quality monitor notification. This
* command is used as an event to indicate the that a trigger level was
* reached.
+ * @NL80211_CMD_SET_CHANNEL: Set the channel (using %NL80211_ATTR_WIPHY_FREQ
+ * and %NL80211_ATTR_WIPHY_CHANNEL_TYPE) the given interface (identifed
+ * by %NL80211_ATTR_IFINDEX) shall operate on.
+ * In case multiple channels are supported by the device, the mechanism
+ * with which it switches channels is implementation-defined.
+ * When a monitor interface is given, it can only switch channel while
+ * no other interfaces are operating to avoid disturbing the operation
+ * of any other interfaces, and other interfaces will again take
+ * precedence when they are used.
+ *
+ * @NL80211_CMD_SET_ANTENNA: Set a bitmap of antennas to use.
+ * @NL80211_CMD_GET_ANTENNA: Get antenna configuration from driver.
*
* @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use
@@ -428,6 +442,11 @@ enum nl80211_commands {
NL80211_CMD_SET_CQM,
NL80211_CMD_NOTIFY_CQM,
+ NL80211_CMD_SET_CHANNEL,
+
+ NL80211_CMD_SET_ANTENNA,
+ NL80211_CMD_GET_ANTENNA,
+
/* add new commands above here */
/* used to define NL80211_CMD_MAX below */
@@ -703,6 +722,18 @@ enum nl80211_commands {
* @NL80211_ATTR_CQM: connection quality monitor configuration in a
* nested attribute with %NL80211_ATTR_CQM_* sub-attributes.
*
+ * @NL80211_ATTR_LOCAL_STATE_CHANGE: Flag attribute to indicate that a command
+ * is requesting a local authentication/association state change without
+ * invoking actual management frame exchange. This can be used with
+ * NL80211_CMD_AUTHENTICATE, NL80211_CMD_DEAUTHENTICATE,
+ * NL80211_CMD_DISASSOCIATE.
+ *
+ * @NL80211_ATTR_AP_ISOLATE: (AP mode) Do not forward traffic between stations
+ * connected to this BSS.
+ *
+ * @NL80211_ATTR_ANTENNA_TX: Bitmap of antennas to use for transmitting.
+ * @NL80211_ATTR_ANTENNA_RX: Bitmap of antennas to use for receiving.
+ *
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
*/
@@ -856,6 +887,13 @@ enum nl80211_attrs {
NL80211_ATTR_CQM,
+ NL80211_ATTR_LOCAL_STATE_CHANGE,
+
+ NL80211_ATTR_AP_ISOLATE,
+
+ NL80211_ATTR_ANTENNA_TX,
+ NL80211_ATTR_ANTENNA_RX,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [RFC PATCH 3/3] iw: Add antenna set/get
2010-05-11 8:39 [RFC PATCH 1/3] iw: fix makefile for cqm Bruno Randolf
2010-05-11 8:39 ` [RFC PATCH 2/3] iw: sync nl80211.h with wireless-testing Bruno Randolf
@ 2010-05-11 8:39 ` Bruno Randolf
1 sibling, 0 replies; 3+ messages in thread
From: Bruno Randolf @ 2010-05-11 8:39 UTC (permalink / raw)
To: johannes, linville; +Cc: linux-wireless, holgerschurig
Add commands to set and get the antenna configuration. The antenna
configuration is defined as a bitmap of 8 antennas. When multiple antennas are
selected the driver may use diversity. Also the driver may reject antenna
configurations it cannot support.
Signed-off-by: Bruno Randolf <br1@einfach.org>
---
Makefile | 2 +
antenna.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 93 insertions(+), 1 deletions(-)
create mode 100644 antenna.c
diff --git a/Makefile b/Makefile
index d303f45..e526cda 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
OBJS = iw.o genl.o event.o info.o phy.o \
interface.o ibss.o station.o survey.o util.o \
mesh.o mpath.o scan.o reg.o version.o \
- reason.o status.o connect.o link.o offch.o ps.o cqm.o
+ reason.o status.o connect.o link.o offch.o ps.o cqm.o antenna.o
OBJS += sections.o
ALL = iw
diff --git a/antenna.c b/antenna.c
new file mode 100644
index 0000000..dd59c76
--- /dev/null
+++ b/antenna.c
@@ -0,0 +1,92 @@
+#include <net/if.h>
+#include <errno.h>
+#include <string.h>
+
+#include <netlink/genl/genl.h>
+#include <netlink/genl/family.h>
+#include <netlink/genl/ctrl.h>
+#include <netlink/msg.h>
+#include <netlink/attr.h>
+
+#include "nl80211.h"
+#include "iw.h"
+
+SECTION(antenna);
+
+static int set_antenna(struct nl80211_state *state,
+ struct nl_cb *cb,
+ struct nl_msg *msg,
+ int argc, char **argv)
+{
+ char *end;
+ uint8_t tx_ant, rx_ant;
+
+ if (argc != 4)
+ return 1;
+
+ if (strcmp(*argv, "tx") == 0) {
+ argv++;
+ argc--;
+
+ tx_ant = strtoul(argv[0], &end, 10);
+ argv++;
+ argc--;
+ }
+
+ if (strcmp(*argv, "rx") == 0) {
+ argv++;
+ argc--;
+
+ rx_ant = strtoul(argv[0], &end, 10);
+ argv++;
+ argc--;
+ }
+
+ if (*end)
+ return 1;
+
+ NLA_PUT_U8(msg, NL80211_ATTR_ANTENNA_TX, tx_ant);
+ NLA_PUT_U8(msg, NL80211_ATTR_ANTENNA_RX, rx_ant);
+ return 0;
+
+ nla_put_failure:
+ return -ENOBUFS;
+}
+
+COMMAND(antenna, set, "tx <bitmap> rx <bitmap>",
+ NL80211_CMD_SET_ANTENNA, 0, CIB_PHY, set_antenna,
+ "Set a bitmap of allowed antennas to use for TX and RX.\n"
+ "The driver may reject antenna configurations it cannot support.");
+
+
+static int print_antenna_handler(struct nl_msg *msg, void *arg)
+{
+ struct nlattr *attrs[NL80211_ATTR_MAX + 1];
+ struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
+ uint8_t tx_ant, rx_ant;
+
+ nla_parse(attrs, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
+ genlmsg_attrlen(gnlh, 0), NULL);
+
+ if (!attrs[NL80211_ATTR_ANTENNA_TX] || !attrs[NL80211_ATTR_ANTENNA_RX])
+ return NL_SKIP;
+
+ tx_ant = nla_get_u8(attrs[NL80211_ATTR_ANTENNA_TX]);
+ rx_ant = nla_get_u8(attrs[NL80211_ATTR_ANTENNA_RX]);
+
+ printf("Antenna configuration: tx %d rx %d\n", tx_ant, rx_ant);
+
+ return NL_SKIP;
+}
+
+static int get_antenna(struct nl80211_state *state,
+ struct nl_cb *cb,
+ struct nl_msg *msg,
+ int argc, char **argv)
+{
+ nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_antenna_handler, NULL);
+ return 0;
+}
+
+COMMAND(antenna, get, NULL, NL80211_CMD_GET_ANTENNA, 0, CIB_PHY, get_antenna,
+ "Retrieve antenna configuration.");
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-11 8:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-11 8:39 [RFC PATCH 1/3] iw: fix makefile for cqm Bruno Randolf
2010-05-11 8:39 ` [RFC PATCH 2/3] iw: sync nl80211.h with wireless-testing Bruno Randolf
2010-05-11 8:39 ` [RFC PATCH 3/3] iw: Add antenna set/get Bruno Randolf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox