From: Felix Fietkau Date: Sat, 8 Oct 2011 14:48:29 +0000 (+0000) Subject: iw: update to v3.1, add support for per-chain signal strength info X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b486d768d1655b6a1675bbfeb5a3b5b8196b63ab;p=openwrt%2Fstaging%2Fthess.git iw: update to v3.1, add support for per-chain signal strength info SVN-Revision: 28385 --- diff --git a/package/iw/Makefile b/package/iw/Makefile index 2b714f8f98..c0f6eb7394 100644 --- a/package/iw/Makefile +++ b/package/iw/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iw -PKG_VERSION:=0.9.22 -PKG_RELEASE:=2 +PKG_VERSION:=3.1 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://wireless.kernel.org/download/iw/ -PKG_MD5SUM:=561c2602c5ce7c65a590118286c0892a +PKG_MD5SUM:=2b63438a12b7dc481140cb9a69c86e4a PKG_BUILD_DEPENDS:=mac80211 include $(INCLUDE_DIR)/package.mk diff --git a/package/iw/patches/001-nl80211_h_sync.patch b/package/iw/patches/001-nl80211_h_sync.patch new file mode 100644 index 0000000000..1c425273a4 --- /dev/null +++ b/package/iw/patches/001-nl80211_h_sync.patch @@ -0,0 +1,251 @@ +--- a/nl80211.h ++++ b/nl80211.h +@@ -6,7 +6,7 @@ + * Copyright 2006-2010 Johannes Berg + * Copyright 2008 Michael Wu + * Copyright 2008 Luis Carlos Cobo +- * Copyright 2008 Michael Buesch ++ * Copyright 2008 Michael Buesch + * Copyright 2008, 2009 Luis R. Rodriguez + * Copyright 2008 Jouni Malinen + * Copyright 2008 Colin McCabe +@@ -161,6 +161,13 @@ + * @NL80211_CMD_SET_BEACON: set the beacon on an access point interface + * using the %NL80211_ATTR_BEACON_INTERVAL, %NL80211_ATTR_DTIM_PERIOD, + * %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL attributes. ++ * Following attributes are provided for drivers that generate full Beacon ++ * and Probe Response frames internally: %NL80211_ATTR_SSID, ++ * %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE, ++ * %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS, ++ * %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY, ++ * %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_IE, %NL80211_ATTR_IE_PROBE_RESP, ++ * %NL80211_ATTR_IE_ASSOC_RESP. + * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface, + * parameters are like for %NL80211_CMD_SET_BEACON. + * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it +@@ -762,6 +769,8 @@ enum nl80211_commands { + * that can be added to a scan request + * @NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN: maximum length of information + * elements that can be added to a scheduled scan request ++ * @NL80211_ATTR_MAX_MATCH_SETS: maximum number of sets that can be ++ * used with @NL80211_ATTR_SCHED_SCAN_MATCH, a wiphy attribute. + * + * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz) + * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive +@@ -842,18 +851,20 @@ enum nl80211_commands { + * @NL80211_ATTR_STATUS_CODE: StatusCode for the %NL80211_CMD_CONNECT + * event (u16) + * @NL80211_ATTR_PRIVACY: Flag attribute, used with connect(), indicating +- * that protected APs should be used. ++ * that protected APs should be used. This is also used with NEW_BEACON to ++ * indicate that the BSS is to use protection. + * +- * @NL80211_ATTR_CIPHERS_PAIRWISE: Used with CONNECT and ASSOCIATE to +- * indicate which unicast key ciphers will be used with the connection ++ * @NL80211_ATTR_CIPHERS_PAIRWISE: Used with CONNECT, ASSOCIATE, and NEW_BEACON ++ * to indicate which unicast key ciphers will be used with the connection + * (an array of u32). +- * @NL80211_ATTR_CIPHER_GROUP: Used with CONNECT and ASSOCIATE to indicate +- * which group key cipher will be used with the connection (a u32). +- * @NL80211_ATTR_WPA_VERSIONS: Used with CONNECT and ASSOCIATE to indicate +- * which WPA version(s) the AP we want to associate with is using ++ * @NL80211_ATTR_CIPHER_GROUP: Used with CONNECT, ASSOCIATE, and NEW_BEACON to ++ * indicate which group key cipher will be used with the connection (a ++ * u32). ++ * @NL80211_ATTR_WPA_VERSIONS: Used with CONNECT, ASSOCIATE, and NEW_BEACON to ++ * indicate which WPA version(s) the AP we want to associate with is using + * (a u32 with flags from &enum nl80211_wpa_versions). +- * @NL80211_ATTR_AKM_SUITES: Used with CONNECT and ASSOCIATE to indicate +- * which key management algorithm(s) to use (an array of u32). ++ * @NL80211_ATTR_AKM_SUITES: Used with CONNECT, ASSOCIATE, and NEW_BEACON to ++ * indicate which key management algorithm(s) to use (an array of u32). + * + * @NL80211_ATTR_REQ_IE: (Re)association request information elements as + * sent out by the card, for ROAM and successful CONNECT events. +@@ -1002,6 +1013,24 @@ enum nl80211_commands { + + * @NL80211_ATTR_SCHED_SCAN_INTERVAL: Interval between scheduled scan + * cycles, in msecs. ++ ++ * @NL80211_ATTR_SCHED_SCAN_MATCH: Nested attribute with one or more ++ * sets of attributes to match during scheduled scans. Only BSSs ++ * that match any of the sets will be reported. These are ++ * pass-thru filter rules. ++ * For a match to succeed, the BSS must match all attributes of a ++ * set. Since not every hardware supports matching all types of ++ * attributes, there is no guarantee that the reported BSSs are ++ * fully complying with the match sets and userspace needs to be ++ * able to ignore them by itself. ++ * Thus, the implementation is somewhat hardware-dependent, but ++ * this is only an optimization and the userspace application ++ * needs to handle all the non-filtered results anyway. ++ * If the match attributes don't make sense when combined with ++ * the values passed in @NL80211_ATTR_SCAN_SSIDS (eg. if an SSID ++ * is included in the probe request, but the match attributes ++ * will never let it go through), -EINVAL may be returned. ++ * If ommited, no filtering is done. + * + * @NL80211_ATTR_INTERFACE_COMBINATIONS: Nested attribute listing the supported + * interface combinations. In each nested item, it contains attributes +@@ -1014,6 +1043,33 @@ enum nl80211_commands { + * @%NL80211_ATTR_REKEY_DATA: nested attribute containing the information + * necessary for GTK rekeying in the device, see &enum nl80211_rekey_data. + * ++ * @NL80211_ATTR_SCAN_SUPP_RATES: rates per to be advertised as supported in scan, ++ * nested array attribute containing an entry for each band, with the entry ++ * being a list of supported rates as defined by IEEE 802.11 7.3.2.2 but ++ * without the length restriction (at most %NL80211_MAX_SUPP_RATES). ++ * ++ * @NL80211_ATTR_HIDDEN_SSID: indicates whether SSID is to be hidden from Beacon ++ * and Probe Response (when response to wildcard Probe Request); see ++ * &enum nl80211_hidden_ssid, represented as a u32 ++ * ++ * @NL80211_ATTR_IE_PROBE_RESP: Information element(s) for Probe Response frame. ++ * This is used with %NL80211_CMD_NEW_BEACON and %NL80211_CMD_SET_BEACON to ++ * provide extra IEs (e.g., WPS/P2P IE) into Probe Response frames when the ++ * driver (or firmware) replies to Probe Request frames. ++ * @NL80211_ATTR_IE_ASSOC_RESP: Information element(s) for (Re)Association ++ * Response frames. This is used with %NL80211_CMD_NEW_BEACON and ++ * %NL80211_CMD_SET_BEACON to provide extra IEs (e.g., WPS/P2P IE) into ++ * (Re)Association Response frames when the driver (or firmware) replies to ++ * (Re)Association Request frames. ++ * ++ * @NL80211_ATTR_STA_WME: Nested attribute containing the wme configuration ++ * of the station, see &enum nl80211_sta_wme_attr. ++ * @NL80211_ATTR_SUPPORT_AP_UAPSD: the device supports uapsd when working ++ * as AP. ++ * ++ * @NL80211_ATTR_ROAM_SUPPORT: Indicates whether the firmware is capable of ++ * roaming to another AP in the same ESS if the signal lever is low. ++ * + * @NL80211_ATTR_MAX: highest attribute number currently defined + * @__NL80211_ATTR_AFTER_LAST: internal use + */ +@@ -1217,6 +1273,21 @@ enum nl80211_attrs { + NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS, + NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN, + ++ NL80211_ATTR_SCAN_SUPP_RATES, ++ ++ NL80211_ATTR_HIDDEN_SSID, ++ ++ NL80211_ATTR_IE_PROBE_RESP, ++ NL80211_ATTR_IE_ASSOC_RESP, ++ ++ NL80211_ATTR_STA_WME, ++ NL80211_ATTR_SUPPORT_AP_UAPSD, ++ ++ NL80211_ATTR_ROAM_SUPPORT, ++ ++ NL80211_ATTR_SCHED_SCAN_MATCH, ++ NL80211_ATTR_MAX_MATCH_SETS, ++ + /* add attributes here, update the policy in nl80211.c */ + + __NL80211_ATTR_AFTER_LAST, +@@ -1426,6 +1497,8 @@ enum nl80211_sta_bss_param { + * @NL80211_STA_INFO_BSS_PARAM: current station's view of BSS, nested attribute + * containing info as possible, see &enum nl80211_sta_bss_param + * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected ++ * @NL80211_STA_INFO_CHAIN_SIGNAL: per-chain signal strength of last PPDU ++ * @NL80211_STA_INFO_CHAIN_SIGNAL_AVG: per-chain signal strength average + * @__NL80211_STA_INFO_AFTER_LAST: internal + * @NL80211_STA_INFO_MAX: highest possible station info attribute + */ +@@ -1447,6 +1520,8 @@ enum nl80211_sta_info { + NL80211_STA_INFO_RX_BITRATE, + NL80211_STA_INFO_BSS_PARAM, + NL80211_STA_INFO_CONNECTED_TIME, ++ NL80211_STA_INFO_CHAIN_SIGNAL, ++ NL80211_STA_INFO_CHAIN_SIGNAL_AVG, + + /* keep last */ + __NL80211_STA_INFO_AFTER_LAST, +@@ -1676,6 +1751,26 @@ enum nl80211_reg_rule_attr { + }; + + /** ++ * enum nl80211_sched_scan_match_attr - scheduled scan match attributes ++ * @__NL80211_SCHED_SCAN_MATCH_ATTR_INVALID: attribute number 0 is reserved ++ * @NL80211_SCHED_SCAN_MATCH_ATTR_SSID: SSID to be used for matching, ++ * only report BSS with matching SSID. ++ * @NL80211_SCHED_SCAN_MATCH_ATTR_MAX: highest scheduled scan filter ++ * attribute number currently defined ++ * @__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST: internal use ++ */ ++enum nl80211_sched_scan_match_attr { ++ __NL80211_SCHED_SCAN_MATCH_ATTR_INVALID, ++ ++ NL80211_ATTR_SCHED_SCAN_MATCH_SSID, ++ ++ /* keep last */ ++ __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST, ++ NL80211_SCHED_SCAN_MATCH_ATTR_MAX = ++ __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST - 1 ++}; ++ ++/** + * enum nl80211_reg_rule_flags - regulatory rule flags + * + * @NL80211_RRF_NO_OFDM: OFDM modulation not allowed +@@ -1826,6 +1921,13 @@ enum nl80211_mntr_flags { + * @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a + * source mesh point for path selection elements. + * ++ * @NL80211_MESHCONF_HWMP_RANN_INTERVAL: The interval of time (in TUs) between ++ * root announcements are transmitted. ++ * ++ * @NL80211_MESHCONF_GATE_ANNOUNCEMENTS: Advertise that this mesh station has ++ * access to a broader network beyond the MBSS. This is done via Root ++ * Announcement frames. ++ * + * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute + * + * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use +@@ -1847,6 +1949,8 @@ enum nl80211_meshconf_params { + NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, + NL80211_MESHCONF_HWMP_ROOTMODE, + NL80211_MESHCONF_ELEMENT_TTL, ++ NL80211_MESHCONF_HWMP_RANN_INTERVAL, ++ NL80211_MESHCONF_GATE_ANNOUNCEMENTS, + + /* keep last */ + __NL80211_MESHCONF_ATTR_AFTER_LAST, +@@ -2423,4 +2527,37 @@ enum nl80211_rekey_data { + MAX_NL80211_REKEY_DATA = NUM_NL80211_REKEY_DATA - 1 + }; + ++/** ++ * enum nl80211_hidden_ssid - values for %NL80211_ATTR_HIDDEN_SSID ++ * @NL80211_HIDDEN_SSID_NOT_IN_USE: do not hide SSID (i.e., broadcast it in ++ * Beacon frames) ++ * @NL80211_HIDDEN_SSID_ZERO_LEN: hide SSID by using zero-length SSID element ++ * in Beacon frames ++ * @NL80211_HIDDEN_SSID_ZERO_CONTENTS: hide SSID by using correct length of SSID ++ * element in Beacon frames but zero out each byte in the SSID ++ */ ++enum nl80211_hidden_ssid { ++ NL80211_HIDDEN_SSID_NOT_IN_USE, ++ NL80211_HIDDEN_SSID_ZERO_LEN, ++ NL80211_HIDDEN_SSID_ZERO_CONTENTS ++}; ++ ++/** ++ * enum nl80211_sta_wme_attr - station WME attributes ++ * @__NL80211_STA_WME_INVALID: invalid number for nested attribute ++ * @NL80211_STA_WME_QUEUES: bitmap of uapsd queues. ++ * @NL80211_STA_WME_MAX_SP: max service period. ++ * @__NL80211_STA_WME_AFTER_LAST: internal ++ * @NL80211_STA_WME_MAX: highest station WME attribute ++ */ ++enum nl80211_sta_wme_attr { ++ __NL80211_STA_WME_INVALID, ++ NL80211_STA_WME_UAPSD_QUEUES, ++ NL80211_STA_WME_MAX_SP, ++ ++ /* keep last */ ++ __NL80211_STA_WME_AFTER_LAST, ++ NL80211_STA_WME_MAX = __NL80211_STA_WME_AFTER_LAST - 1 ++}; ++ + #endif /* __LINUX_NL80211_H */ diff --git a/package/iw/patches/001-nl80211_sync.patch b/package/iw/patches/001-nl80211_sync.patch deleted file mode 100644 index a385897b75..0000000000 --- a/package/iw/patches/001-nl80211_sync.patch +++ /dev/null @@ -1,81 +0,0 @@ ---- a/nl80211.h -+++ b/nl80211.h -@@ -148,6 +148,10 @@ - * @NL80211_CMD_SET_MPATH: Set mesh path attributes for mesh path to - * destination %NL80211_ATTR_MAC on the interface identified by - * %NL80211_ATTR_IFINDEX. -+ * @NL80211_CMD_NEW_MPATH: Create a new mesh path for the destination given by -+ * %NL80211_ATTR_MAC via %NL80211_ATTR_MPATH_NEXT_HOP. -+ * @NL80211_CMD_DEL_MPATH: Delete a mesh path to the destination given by -+ * %NL80211_ATTR_MAC. - * @NL80211_CMD_NEW_PATH: Add a mesh path with given attributes to the - * the interface identified by %NL80211_ATTR_IFINDEX. - * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC -@@ -612,7 +616,7 @@ enum nl80211_commands { - * consisting of a nested array. - * - * @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes). -- * @NL80211_ATTR_PLINK_ACTION: action to perform on the mesh peer link. -+ * @NL80211_ATTR_STA_PLINK_ACTION: action to perform on the mesh peer link. - * @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path. - * @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path - * info given for %NL80211_CMD_GET_MPATH, nested attribute described at -@@ -879,7 +883,9 @@ enum nl80211_commands { - * See &enum nl80211_key_default_types. - * - * @NL80211_ATTR_MESH_SETUP: Optional mesh setup parameters. These cannot be -- * changed once the mesh is active. -+ * changed once the mesh is active. -+ * @NL80211_ATTR_MESH_CONFIG: Mesh configuration parameters, a nested attribute -+ * containing attributes from &enum nl80211_meshconf_params. - * - * @NL80211_ATTR_MAX: highest attribute number currently defined - * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -1225,8 +1231,6 @@ enum nl80211_rate_info { - * @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs) - * @NL80211_STA_INFO_RX_BYTES: total received bytes (u32, from this station) - * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station) -- * @__NL80211_STA_INFO_AFTER_LAST: internal -- * @NL80211_STA_INFO_MAX: highest possible station info attribute - * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm) - * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute - * containing info as possible, see &enum nl80211_sta_info_txrate. -@@ -1236,6 +1240,13 @@ enum nl80211_rate_info { - * @NL80211_STA_INFO_TX_RETRIES: total retries (u32, to this station) - * @NL80211_STA_INFO_TX_FAILED: total failed packets (u32, to this station) - * @NL80211_STA_INFO_SIGNAL_AVG: signal strength average (u8, dBm) -+ * @NL80211_STA_INFO_LLID: the station's mesh LLID -+ * @NL80211_STA_INFO_PLID: the station's mesh PLID -+ * @NL80211_STA_INFO_PLINK_STATE: peer link state for the station -+ * @NL80211_STA_INFO_RX_BITRATE: last unicast rx rate, nested attribute -+ * containing info as possible, see &enum nl80211_sta_info_txrate. -+ * @__NL80211_STA_INFO_AFTER_LAST: internal -+ * @NL80211_STA_INFO_MAX: highest possible station info attribute - */ - enum nl80211_sta_info { - __NL80211_STA_INFO_INVALID, -@@ -1252,6 +1263,7 @@ enum nl80211_sta_info { - NL80211_STA_INFO_TX_RETRIES, - NL80211_STA_INFO_TX_FAILED, - NL80211_STA_INFO_SIGNAL_AVG, -+ NL80211_STA_INFO_RX_BITRATE, - - /* keep last */ - __NL80211_STA_INFO_AFTER_LAST, -@@ -1626,7 +1638,7 @@ enum nl80211_mntr_flags { - * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs) - * that it takes for an HWMP information element to propagate across the mesh - * -- * @NL80211_MESHCONF_ROOTMODE: whether root mode is enabled or not -+ * @NL80211_MESHCONF_HWMP_ROOTMODE: whether root mode is enabled or not - * - * @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a - * source mesh point for path selection elements. -@@ -1678,6 +1690,7 @@ enum nl80211_meshconf_params { - * element that vendors will use to identify the path selection methods and - * metrics in use. - * -+ * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number - * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use - */ - enum nl80211_mesh_setup_params { diff --git a/package/iw/patches/110-fix_rate_calculation.patch b/package/iw/patches/110-fix_rate_calculation.patch deleted file mode 100644 index e7328e39ba..0000000000 --- a/package/iw/patches/110-fix_rate_calculation.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/ibss.c -+++ b/ibss.c -@@ -104,7 +104,7 @@ static int join_ibss(struct nl80211_stat - if (*end != '\0') - return 1; - -- NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, (int) rate * 10); -+ NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, (int)(rate * 10)); - argv++; - argc--; - } diff --git a/package/iw/patches/110-ibss_ht.patch b/package/iw/patches/110-ibss_ht.patch new file mode 100644 index 0000000000..1b5dbd3e99 --- /dev/null +++ b/package/iw/patches/110-ibss_ht.patch @@ -0,0 +1,113 @@ +--- a/ibss.c ++++ b/ibss.c +@@ -27,6 +27,7 @@ static int join_ibss(struct nl80211_stat + char *value = NULL, *sptr = NULL; + float rate; + int bintval; ++ unsigned int htval; + + if (argc < 2) + return 1; +@@ -44,6 +45,12 @@ static int join_ibss(struct nl80211_stat + argv++; + argc--; + ++ if (argc && parse_channel_type(argv[0], &htval)) { ++ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, htval); ++ argv++; ++ argc--; ++ } ++ + if (argc && strcmp(argv[0], "fixed-freq") == 0) { + NLA_PUT_FLAG(msg, NL80211_ATTR_FREQ_FIXED); + argv++; +@@ -134,7 +141,7 @@ COMMAND(ibss, leave, NULL, + NL80211_CMD_LEAVE_IBSS, 0, CIB_NETDEV, leave_ibss, + "Leave the current IBSS cell."); + COMMAND(ibss, join, +- " [fixed-freq] [] [beacon-interval ]" ++ " [HT20|HT40+|HT40-] [fixed-freq] [] [beacon-interval ]" + " [basic-rates ] [mcast-rate ] " + "[key d:0:abcde]", + NL80211_CMD_JOIN_IBSS, 0, CIB_NETDEV, join_ibss, +--- a/iw.h ++++ b/iw.h +@@ -133,6 +133,7 @@ int parse_hex_mask(char *hexmask, unsign + unsigned char *parse_hex(char *hex, size_t *outlen); + + int parse_keys(struct nl_msg *msg, char **argv, int argc); ++int parse_channel_type(const char *str, unsigned int *htval); + + void print_ht_mcs(const __u8 *mcs); + void print_ampdu_length(__u8 exponent); +--- a/phy.c ++++ b/phy.c +@@ -33,30 +33,14 @@ static int handle_freqchan(struct nl_msg + int argc, char **argv) + { + char *end; +- static const struct { +- const char *name; +- unsigned int val; +- } htmap[] = { +- { .name = "HT20", .val = NL80211_CHAN_HT20, }, +- { .name = "HT40+", .val = NL80211_CHAN_HT40PLUS, }, +- { .name = "HT40-", .val = NL80211_CHAN_HT40MINUS, }, +- }; + unsigned int htval = NL80211_CHAN_NO_HT; + unsigned int freq; +- int i; + + if (!argc || argc > 2) + return 1; + +- if (argc == 2) { +- for (i = 0; i < ARRAY_SIZE(htmap); i++) { +- if (strcasecmp(htmap[i].name, argv[1]) == 0) { +- htval = htmap[i].val; +- break; +- } +- } +- if (htval == NL80211_CHAN_NO_HT) +- return 1; ++ if (argc == 2 && !parse_channel_type(argv[1], &htval)) { ++ return 1; + } + + if (!*argv[0]) +--- a/util.c ++++ b/util.c +@@ -382,6 +382,33 @@ int parse_keys(struct nl_msg *msg, char + return 2; + } + ++/* ++ * Convert a string "HT20", "HT40+" or "HT40-" into nl80211 ++ * value. Conversion is case insensitive. Returns 1 on success, 0 on error. ++ */ ++ ++int parse_channel_type(const char *str, unsigned int *htval) ++{ ++ static const struct { ++ const char *name; ++ unsigned int val; ++ } htmap[] = { ++ { .name = "HT20", .val = NL80211_CHAN_HT20, }, ++ { .name = "HT40+", .val = NL80211_CHAN_HT40PLUS, }, ++ { .name = "HT40-", .val = NL80211_CHAN_HT40MINUS, }, ++ }; ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(htmap); i++) { ++ if (strcasecmp(htmap[i].name, str) == 0) { ++ *htval = htmap[i].val; ++ return 1; ++ } ++ } ++ ++ return 0; ++} ++ + static void print_mcs_index(const __u8 *mcs) + { + unsigned int mcs_bit, prev_bit = -2, prev_cont = 0; diff --git a/package/iw/patches/120-ibss_ht.patch b/package/iw/patches/120-ibss_ht.patch deleted file mode 100644 index 1e6c34e3b7..0000000000 --- a/package/iw/patches/120-ibss_ht.patch +++ /dev/null @@ -1,113 +0,0 @@ ---- a/ibss.c -+++ b/ibss.c -@@ -27,6 +27,7 @@ static int join_ibss(struct nl80211_stat - char *value = NULL, *sptr = NULL; - float rate; - int bintval; -+ unsigned int htval; - - if (argc < 2) - return 1; -@@ -44,6 +45,12 @@ static int join_ibss(struct nl80211_stat - argv++; - argc--; - -+ if (argc && parse_channel_type(argv[0], &htval)) { -+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, htval); -+ argv++; -+ argc--; -+ } -+ - if (argc && strcmp(argv[0], "fixed-freq") == 0) { - NLA_PUT_FLAG(msg, NL80211_ATTR_FREQ_FIXED); - argv++; -@@ -134,7 +141,7 @@ COMMAND(ibss, leave, NULL, - NL80211_CMD_LEAVE_IBSS, 0, CIB_NETDEV, leave_ibss, - "Leave the current IBSS cell."); - COMMAND(ibss, join, -- " [fixed-freq] [] [beacon-interval ]" -+ " [HT20|HT40+|HT40-] [fixed-freq] [] [beacon-interval ]" - " [basic-rates ] [mcast-rate ] " - "[key d:0:abcde]", - NL80211_CMD_JOIN_IBSS, 0, CIB_NETDEV, join_ibss, ---- a/iw.h -+++ b/iw.h -@@ -130,6 +130,7 @@ void mac_addr_n2a(char *mac_addr, unsign - unsigned char *parse_hex(char *hex, size_t *outlen); - - int parse_keys(struct nl_msg *msg, char **argv, int argc); -+int parse_channel_type(const char *str, unsigned int *htval); - - void print_ht_mcs(const __u8 *mcs); - void print_ampdu_length(__u8 exponent); ---- a/phy.c -+++ b/phy.c -@@ -33,30 +33,14 @@ static int handle_freqchan(struct nl_msg - int argc, char **argv) - { - char *end; -- static const struct { -- const char *name; -- unsigned int val; -- } htmap[] = { -- { .name = "HT20", .val = NL80211_CHAN_HT20, }, -- { .name = "HT40+", .val = NL80211_CHAN_HT40PLUS, }, -- { .name = "HT40-", .val = NL80211_CHAN_HT40MINUS, }, -- }; - unsigned int htval = NL80211_CHAN_NO_HT; - unsigned int freq; -- int i; - - if (!argc || argc > 2) - return 1; - -- if (argc == 2) { -- for (i = 0; i < ARRAY_SIZE(htmap); i++) { -- if (strcasecmp(htmap[i].name, argv[1]) == 0) { -- htval = htmap[i].val; -- break; -- } -- } -- if (htval == NL80211_CHAN_NO_HT) -- return 1; -+ if (argc == 2 && !parse_channel_type(argv[1], &htval)) { -+ return 1; - } - - if (!*argv[0]) ---- a/util.c -+++ b/util.c -@@ -345,6 +345,33 @@ int parse_keys(struct nl_msg *msg, char - return 2; - } - -+/* -+ * Convert a string "HT20", "HT40+" or "HT40-" into nl80211 -+ * value. Conversion is case insensitive. Returns 1 on success, 0 on error. -+ */ -+ -+int parse_channel_type(const char *str, unsigned int *htval) -+{ -+ static const struct { -+ const char *name; -+ unsigned int val; -+ } htmap[] = { -+ { .name = "HT20", .val = NL80211_CHAN_HT20, }, -+ { .name = "HT40+", .val = NL80211_CHAN_HT40PLUS, }, -+ { .name = "HT40-", .val = NL80211_CHAN_HT40MINUS, }, -+ }; -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE(htmap); i++) { -+ if (strcasecmp(htmap[i].name, str) == 0) { -+ *htval = htmap[i].val; -+ return 1; -+ } -+ } -+ -+ return 0; -+} -+ - static void print_mcs_index(const __u8 *mcs) - { - unsigned int mcs_bit, prev_bit = -2, prev_cont = 0; diff --git a/package/iw/patches/120-per_chain_signal_strength.patch b/package/iw/patches/120-per_chain_signal_strength.patch new file mode 100644 index 0000000000..abdd6381c0 --- /dev/null +++ b/package/iw/patches/120-per_chain_signal_strength.patch @@ -0,0 +1,68 @@ +--- a/station.c ++++ b/station.c +@@ -61,6 +61,31 @@ static void print_sta_bitrate(struct nla + } + } + ++static char *get_chain_signal(struct nlattr *attr_list) ++{ ++ struct nlattr *attr; ++ static char buf[64]; ++ char *cur = buf; ++ int i = 0, rem; ++ const char *prefix; ++ ++ if (!attr_list) ++ return ""; ++ ++ nla_for_each_nested(attr, attr_list, rem) { ++ if (i++ > 0) ++ prefix = ", "; ++ else ++ prefix = "["; ++ ++ cur += snprintf(cur, sizeof(buf) - (cur - buf), "%s%d", prefix, ++ (int8_t) nla_get_u8(attr)); ++ } ++ snprintf(cur, sizeof(buf) - (cur - buf), "] "); ++ ++ return buf; ++} ++ + static int print_sta_handler(struct nl_msg *msg, void *arg) + { + struct nlattr *tb[NL80211_ATTR_MAX + 1]; +@@ -81,7 +106,10 @@ static int print_sta_handler(struct nl_m + [NL80211_STA_INFO_PLINK_STATE] = { .type = NLA_U8 }, + [NL80211_STA_INFO_TX_RETRIES] = { .type = NLA_U32 }, + [NL80211_STA_INFO_TX_FAILED] = { .type = NLA_U32 }, ++ [NL80211_STA_INFO_CHAIN_SIGNAL] = { .type = NLA_NESTED }, ++ [NL80211_STA_INFO_CHAIN_SIGNAL_AVG] = { .type = NLA_NESTED }, + }; ++ char *chain; + + nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), + genlmsg_attrlen(gnlh, 0), NULL); +@@ -128,12 +156,18 @@ static int print_sta_handler(struct nl_m + if (sinfo[NL80211_STA_INFO_TX_FAILED]) + printf("\n\ttx failed:\t%u", + nla_get_u32(sinfo[NL80211_STA_INFO_TX_FAILED])); ++ ++ chain = get_chain_signal(sinfo[NL80211_STA_INFO_CHAIN_SIGNAL]); + if (sinfo[NL80211_STA_INFO_SIGNAL]) +- printf("\n\tsignal: \t%d dBm", +- (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL])); ++ printf("\n\tsignal: \t%d %sdBm", ++ (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]), ++ chain); ++ ++ chain = get_chain_signal(sinfo[NL80211_STA_INFO_CHAIN_SIGNAL_AVG]); + if (sinfo[NL80211_STA_INFO_SIGNAL_AVG]) +- printf("\n\tsignal avg:\t%d dBm", +- (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL_AVG])); ++ printf("\n\tsignal avg:\t%d %sdBm", ++ (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL_AVG]), ++ chain); + + print_sta_bitrate(sinfo[NL80211_STA_INFO_TX_BITRATE], "tx bitrate"); + print_sta_bitrate(sinfo[NL80211_STA_INFO_RX_BITRATE], "rx bitrate");