linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] mac80211/cfg80211/hwsim: Basic rate and TXQ params
@ 2008-10-29 17:49 Jouni Malinen
  2008-10-29 17:49 ` [PATCH 1/4] mac80211_hwsim: Debug info for BSS config changes Jouni Malinen
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Jouni Malinen @ 2008-10-29 17:49 UTC (permalink / raw)
  To: John W. Linville; +Cc: Johannes Berg, linux-wireless

These patches add cfg80211/nl80211 attributes for configuring basic
rate set and TX queue parameters for AP mode. The current hostapd
development has matching userspace code for using the new attributes. In
addition, mac80211_hwsim is extended to show more detailed debug
information on BSS and TXQ changes.

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/4] mac80211_hwsim: Debug info for BSS config changes
  2008-10-29 17:49 [PATCH 0/4] mac80211/cfg80211/hwsim: Basic rate and TXQ params Jouni Malinen
@ 2008-10-29 17:49 ` Jouni Malinen
  2008-10-30 10:42   ` Johannes Berg
  2008-10-29 17:49 ` [PATCH 2/4] nl80211: Add basic rate configuration for AP mode Jouni Malinen
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Jouni Malinen @ 2008-10-29 17:49 UTC (permalink / raw)
  To: John W. Linville; +Cc: Johannes Berg, linux-wireless

Provide detailed information on BSS configuration changes to make it
easier to debug mac80211 functionality.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>

Index: wireless-testing/drivers/net/wireless/mac80211_hwsim.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/mac80211_hwsim.c
+++ wireless-testing/drivers/net/wireless/mac80211_hwsim.c
@@ -415,6 +415,37 @@ static void mac80211_hwsim_bss_info_chan
 					    u32 changed)
 {
 	hwsim_check_magic(vif);
+	printk(KERN_DEBUG "%s:%s(changed=0x%x)\n",
+	       wiphy_name(hw->wiphy), __func__, changed);
+
+	if (changed & BSS_CHANGED_ASSOC) {
+		printk(KERN_DEBUG "  ASSOC: assoc=%d aid=%d\n",
+		       info->assoc, info->aid);
+	}
+
+	if (changed & BSS_CHANGED_ERP_CTS_PROT) {
+		printk(KERN_DEBUG "  ERP_CTS_PROT: %d\n", info->use_cts_prot);
+	}
+
+	if (changed & BSS_CHANGED_ERP_PREAMBLE) {
+		printk(KERN_DEBUG "  ERP_PREAMBLE: %d\n",
+		       info->use_short_preamble);
+	}
+
+	if (changed & BSS_CHANGED_ERP_SLOT) {
+		printk(KERN_DEBUG "  ERP_SLOT: %d\n", info->use_short_slot);
+	}
+
+	if (changed & BSS_CHANGED_HT) {
+		printk(KERN_DEBUG "  HT: sec_ch_offs=%d width_40_ok=%d "
+		       "op_mode=%d\n", info->ht.secondary_channel_offset,
+		       info->ht.width_40_ok, info->ht.operation_mode);
+	}
+
+	if (changed & BSS_CHANGED_BASIC_RATES) {
+		printk(KERN_DEBUG "  BASIC_RATES: 0x%llx\n",
+		       info->basic_rates);
+	}
 }
 
 static void mac80211_hwsim_sta_notify(struct ieee80211_hw *hw,

--

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/4] nl80211: Add basic rate configuration for AP mode
  2008-10-29 17:49 [PATCH 0/4] mac80211/cfg80211/hwsim: Basic rate and TXQ params Jouni Malinen
  2008-10-29 17:49 ` [PATCH 1/4] mac80211_hwsim: Debug info for BSS config changes Jouni Malinen
@ 2008-10-29 17:49 ` Jouni Malinen
  2008-10-30 10:44   ` Johannes Berg
  2008-10-29 17:49 ` [PATCH 3/4] mac80211_hwsim: Debug info for TX queue parameters Jouni Malinen
  2008-10-29 17:49 ` [PATCH 4/4] nl80211: Add TX queue parameter configuration Jouni Malinen
  3 siblings, 1 reply; 9+ messages in thread
From: Jouni Malinen @ 2008-10-29 17:49 UTC (permalink / raw)
  To: John W. Linville; +Cc: Johannes Berg, linux-wireless

Add a new attribute, NL80211_ATTR_BSS_BASIC_RATES, that can be used with
NL80211_CMD_SET_BSS for userspace (e.g., hostapd) to set which rates are
in the basic rate set.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>

Index: wireless-testing/include/linux/nl80211.h
===================================================================
--- wireless-testing.orig/include/linux/nl80211.h
+++ wireless-testing/include/linux/nl80211.h
@@ -243,6 +243,9 @@ enum nl80211_commands {
  *	(u8, 0 or 1)
  * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled
  *	(u8, 0 or 1)
+ * @NL80211_ATTR_BSS_BASIC_RATES: basic rates, array of basic
+ *	rates in format defined by IEEE 802.11 7.3.2.2 but without the length
+ *	restriction (at most %NL80211_MAX_SUPP_RATES).
  *
  * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from
  *	association request when used with NL80211_CMD_NEW_STATION)
@@ -307,6 +310,8 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_MESH_PARAMS,
 
+	NL80211_ATTR_BSS_BASIC_RATES,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
@@ -318,6 +323,7 @@ enum nl80211_attrs {
  * here
  */
 #define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY
+#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES
 
 #define NL80211_MAX_SUPP_RATES			32
 #define NL80211_MAX_SUPP_REG_RULES		32
Index: wireless-testing/include/net/cfg80211.h
===================================================================
--- wireless-testing.orig/include/net/cfg80211.h
+++ wireless-testing/include/net/cfg80211.h
@@ -280,11 +280,16 @@ struct mpath_info {
  *	(0 = no, 1 = yes, -1 = do not change)
  * @use_short_slot_time: Whether the use of short slot time is allowed
  *	(0 = no, 1 = yes, -1 = do not change)
+ * @basic_rates: basic rates in IEEE 802.11 format
+ *	(or NULL for no change)
+ * @basic_rates_len: number of basic rates
  */
 struct bss_parameters {
 	int use_cts_prot;
 	int use_short_preamble;
 	int use_short_slot_time;
+	u8 *basic_rates;
+	u8 basic_rates_len;
 };
 
 /**
Index: wireless-testing/net/mac80211/cfg.c
===================================================================
--- wireless-testing.orig/net/mac80211/cfg.c
+++ wireless-testing/net/mac80211/cfg.c
@@ -1046,6 +1046,24 @@ static int ieee80211_change_bss(struct w
 		changed |= BSS_CHANGED_ERP_SLOT;
 	}
 
+	if (params->basic_rates) {
+		int i, j;
+		u32 rates = 0;
+		struct ieee80211_local *local = wiphy_priv(wiphy);
+		struct ieee80211_supported_band *sband =
+			wiphy->bands[local->oper_channel->band];
+
+		for (i = 0; i < params->basic_rates_len; i++) {
+			int rate = (params->basic_rates[i] & 0x7f) * 5;
+			for (j = 0; j < sband->n_bitrates; j++) {
+				if (sband->bitrates[j].bitrate == rate)
+					rates |= BIT(j);
+			}
+		}
+		sdata->vif.bss_conf.basic_rates = rates;
+		changed |= BSS_CHANGED_BASIC_RATES;
+	}
+
 	ieee80211_bss_info_change_notify(sdata, changed);
 
 	return 0;
Index: wireless-testing/net/wireless/nl80211.c
===================================================================
--- wireless-testing.orig/net/wireless/nl80211.c
+++ wireless-testing/net/wireless/nl80211.c
@@ -95,6 +95,8 @@ static struct nla_policy nl80211_policy[
 	[NL80211_ATTR_BSS_CTS_PROT] = { .type = NLA_U8 },
 	[NL80211_ATTR_BSS_SHORT_PREAMBLE] = { .type = NLA_U8 },
 	[NL80211_ATTR_BSS_SHORT_SLOT_TIME] = { .type = NLA_U8 },
+	[NL80211_ATTR_BSS_BASIC_RATES] = { .type = NLA_BINARY,
+					   .len = NL80211_MAX_SUPP_RATES },
 
 	[NL80211_ATTR_MESH_PARAMS] = { .type = NLA_NESTED },
 
@@ -1613,6 +1615,12 @@ static int nl80211_set_bss(struct sk_buf
 	if (info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME])
 		params.use_short_slot_time =
 		    nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]);
+	if (info->attrs[NL80211_ATTR_BSS_BASIC_RATES]) {
+		params.basic_rates =
+			nla_data(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]);
+		params.basic_rates_len =
+			nla_len(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]);
+	}
 
 	err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
 	if (err)

--

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 3/4] mac80211_hwsim: Debug info for TX queue parameters
  2008-10-29 17:49 [PATCH 0/4] mac80211/cfg80211/hwsim: Basic rate and TXQ params Jouni Malinen
  2008-10-29 17:49 ` [PATCH 1/4] mac80211_hwsim: Debug info for BSS config changes Jouni Malinen
  2008-10-29 17:49 ` [PATCH 2/4] nl80211: Add basic rate configuration for AP mode Jouni Malinen
@ 2008-10-29 17:49 ` Jouni Malinen
  2008-10-30 10:44   ` Johannes Berg
  2008-10-29 17:49 ` [PATCH 4/4] nl80211: Add TX queue parameter configuration Jouni Malinen
  3 siblings, 1 reply; 9+ messages in thread
From: Jouni Malinen @ 2008-10-29 17:49 UTC (permalink / raw)
  To: John W. Linville; +Cc: Johannes Berg, linux-wireless

Provide detailed information on TX queue parameter changes to make it
easier to debug mac80211 functionality.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>

Index: wireless-testing/drivers/net/wireless/mac80211_hwsim.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/mac80211_hwsim.c	2008-10-29 13:27:50.000000000 +0200
+++ wireless-testing/drivers/net/wireless/mac80211_hwsim.c	2008-10-29 13:36:20.000000000 +0200
@@ -468,6 +468,17 @@
 	return 0;
 }
 
+static int mac80211_hwsim_conf_tx(
+	struct ieee80211_hw *hw, u16 queue,
+	const struct ieee80211_tx_queue_params *params)
+{
+	printk(KERN_DEBUG "%s:%s (queue=%d txop=%d cw_min=%d cw_max=%d "
+	       "aifs=%d)\n",
+	       wiphy_name(hw->wiphy), __func__, queue,
+	       params->txop, params->cw_min, params->cw_max, params->aifs);
+	return 0;
+}
+
 static const struct ieee80211_ops mac80211_hwsim_ops =
 {
 	.tx = mac80211_hwsim_tx,
@@ -481,6 +492,7 @@
 	.bss_info_changed = mac80211_hwsim_bss_info_changed,
 	.sta_notify = mac80211_hwsim_sta_notify,
 	.set_tim = mac80211_hwsim_set_tim,
+	.conf_tx = mac80211_hwsim_conf_tx,
 };
 
 

--

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 4/4] nl80211: Add TX queue parameter configuration
  2008-10-29 17:49 [PATCH 0/4] mac80211/cfg80211/hwsim: Basic rate and TXQ params Jouni Malinen
                   ` (2 preceding siblings ...)
  2008-10-29 17:49 ` [PATCH 3/4] mac80211_hwsim: Debug info for TX queue parameters Jouni Malinen
@ 2008-10-29 17:49 ` Jouni Malinen
  2008-10-30 10:49   ` Johannes Berg
  3 siblings, 1 reply; 9+ messages in thread
From: Jouni Malinen @ 2008-10-29 17:49 UTC (permalink / raw)
  To: John W. Linville; +Cc: Johannes Berg, linux-wireless

Add a new attribute, NL80211_ATTR_WIPHY_TXQ_PARAMS, that can be used with
NL80211_CMD_SET_WIPHY for userspace (e.g., hostapd) to set TX queue
parameters (txop, cwmin, cwmax, aifs).

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>

Index: wireless-testing/include/linux/nl80211.h
===================================================================
--- wireless-testing.orig/include/linux/nl80211.h
+++ wireless-testing/include/linux/nl80211.h
@@ -25,8 +25,9 @@
  *
  * @NL80211_CMD_GET_WIPHY: request information about a wiphy or dump request
  *	to get a list of all present wiphys.
- * @NL80211_CMD_SET_WIPHY: set wiphy name, needs %NL80211_ATTR_WIPHY and
- *	%NL80211_ATTR_WIPHY_NAME.
+ * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or
+ *	%NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME
+ *	and/or %NL80211_ATTR_WIPHY_TXQ_PARAMS.
  * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
  *	or rename notification. Has attributes %NL80211_ATTR_WIPHY and
  *	%NL80211_ATTR_WIPHY_NAME.
@@ -178,6 +179,7 @@ enum nl80211_commands {
  * @NL80211_ATTR_WIPHY: index of wiphy to operate on, cf.
  *	/sys/class/ieee80211/<phyname>/index
  * @NL80211_ATTR_WIPHY_NAME: wiphy name (used for renaming)
+ * @NL80211_ATTR_WIPHY_TXQ_PARAMS: a nested array of TX queue parameters
  *
  * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on
  * @NL80211_ATTR_IFNAME: network interface name
@@ -312,6 +314,8 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_BSS_BASIC_RATES,
 
+	NL80211_ATTR_WIPHY_TXQ_PARAMS,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
@@ -324,6 +328,7 @@ enum nl80211_attrs {
  */
 #define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY
 #define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES
+#define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS
 
 #define NL80211_MAX_SUPP_RATES			32
 #define NL80211_MAX_SUPP_REG_RULES		32
@@ -698,4 +703,35 @@ enum nl80211_meshconf_params {
 	NL80211_MESHCONF_ATTR_MAX = __NL80211_MESHCONF_ATTR_AFTER_LAST - 1
 };
 
+/**
+ * enum nl80211_txq_attr - TX queue parameter attributes
+ * @NL80211_TXQ_ATTR_QUEUE: TX queue identifier (NL80211_TXQ_Q_*)
+ * @NL80211_TXQ_ATTR_TXOP: Maximum burst time in units of 32 usecs, 0 meaning
+ *	disabled
+ * @NL80211_TXQ_ATTR_CWMIN: Minimum contention window [a value of the form
+ *	2^n-1 in the range 1..32767]
+ * @NL80211_TXQ_ATTR_CWMAX: Maximum contention window [a value of the form
+ *	2^n-1 in the range 1..32767]
+ * @NL80211_TXQ_ATTR_AIFS: Arbitration interframe space [0..255]
+ */
+enum nl80211_txq_attr {
+	__NL80211_TXQ_ATTR_INVALID,
+	NL80211_TXQ_ATTR_QUEUE,
+	NL80211_TXQ_ATTR_TXOP,
+	NL80211_TXQ_ATTR_CWMIN,
+	NL80211_TXQ_ATTR_CWMAX,
+	NL80211_TXQ_ATTR_AIFS,
+
+	/* keep last */
+	__NL80211_TXQ_ATTR_AFTER_LAST,
+	NL80211_TXQ_ATTR_MAX = __NL80211_TXQ_ATTR_AFTER_LAST - 1
+};
+
+enum nl80211_txq_q {
+	NL80211_TXQ_Q_VO,
+	NL80211_TXQ_Q_VI,
+	NL80211_TXQ_Q_BE,
+	NL80211_TXQ_Q_BK
+};
+
 #endif /* __LINUX_NL80211_H */
Index: wireless-testing/include/net/cfg80211.h
===================================================================
--- wireless-testing.orig/include/net/cfg80211.h
+++ wireless-testing/include/net/cfg80211.h
@@ -371,6 +371,14 @@ struct mesh_config {
 	u16 dot11MeshHWMPnetDiameterTraversalTime;
 };
 
+struct ieee80211_txq_params {
+	u8 queue;
+	u16 txop;
+	u16 cwmin;
+	u16 cwmax;
+	u8 aifs;
+};
+
 /* from net/wireless.h */
 struct wiphy;
 
@@ -430,6 +438,8 @@ struct wiphy;
  * @set_mesh_cfg: set mesh parameters (by now, just mesh id)
  *
  * @change_bss: Modify parameters for a given BSS.
+ *
+ * @set_txq_params: Set TX queue parameters
  */
 struct cfg80211_ops {
 	int	(*add_virtual_intf)(struct wiphy *wiphy, char *name,
@@ -490,6 +500,9 @@ struct cfg80211_ops {
 				const struct mesh_config *nconf, u32 mask);
 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
 			      struct bss_parameters *params);
+
+	int	(*set_txq_params)(struct wiphy *wiphy,
+				  struct ieee80211_txq_params *params);
 };
 
 #endif /* __NET_CFG80211_H */
Index: wireless-testing/net/mac80211/cfg.c
===================================================================
--- wireless-testing.orig/net/mac80211/cfg.c
+++ wireless-testing/net/mac80211/cfg.c
@@ -1069,6 +1069,30 @@ static int ieee80211_change_bss(struct w
 	return 0;
 }
 
+static int ieee80211_set_txq_params(struct wiphy *wiphy,
+				    struct ieee80211_txq_params *params)
+{
+	struct ieee80211_local *local = wiphy_priv(wiphy);
+	struct ieee80211_tx_queue_params p;
+
+	if (!local->ops->conf_tx)
+		return -EOPNOTSUPP;
+
+	memset(&p, 0, sizeof(p));
+	p.aifs = params->aifs;
+	p.cw_max = params->cwmax;
+	p.cw_min = params->cwmin;
+	p.txop = params->txop;
+	if (local->ops->conf_tx(local_to_hw(local), params->queue, &p)) {
+		printk(KERN_DEBUG "%s: failed to set TX queue "
+		       "parameters for queue %d\n", local->mdev->name,
+		       params->queue);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
 struct cfg80211_ops mac80211_config_ops = {
 	.add_virtual_intf = ieee80211_add_iface,
 	.del_virtual_intf = ieee80211_del_iface,
@@ -1095,4 +1119,5 @@ struct cfg80211_ops mac80211_config_ops 
 	.get_mesh_params = ieee80211_get_mesh_params,
 #endif
 	.change_bss = ieee80211_change_bss,
+	.set_txq_params = ieee80211_set_txq_params,
 };
Index: wireless-testing/net/wireless/nl80211.c
===================================================================
--- wireless-testing.orig/net/wireless/nl80211.c
+++ wireless-testing/net/wireless/nl80211.c
@@ -58,6 +58,7 @@ static struct nla_policy nl80211_policy[
 	[NL80211_ATTR_WIPHY] = { .type = NLA_U32 },
 	[NL80211_ATTR_WIPHY_NAME] = { .type = NLA_NUL_STRING,
 				      .len = BUS_ID_SIZE-1 },
+	[NL80211_ATTR_WIPHY_TXQ_PARAMS] = { .type = NLA_NESTED },
 
 	[NL80211_ATTR_IFTYPE] = { .type = NLA_U32 },
 	[NL80211_ATTR_IFINDEX] = { .type = NLA_U32 },
@@ -286,20 +287,76 @@ static int nl80211_get_wiphy(struct sk_b
 	return -ENOBUFS;
 }
 
+static const struct nla_policy txq_params_policy[NL80211_TXQ_ATTR_MAX + 1] = {
+	[NL80211_TXQ_ATTR_QUEUE]		= { .type = NLA_U8 },
+	[NL80211_TXQ_ATTR_TXOP]			= { .type = NLA_U16 },
+	[NL80211_TXQ_ATTR_CWMIN]		= { .type = NLA_U16 },
+	[NL80211_TXQ_ATTR_CWMAX]		= { .type = NLA_U16 },
+	[NL80211_TXQ_ATTR_AIFS]			= { .type = NLA_U8 },
+};
+
+static int parse_txq_params(struct nlattr *tb[],
+			    struct ieee80211_txq_params *txq_params)
+{
+	if (!tb[NL80211_TXQ_ATTR_QUEUE] || !tb[NL80211_TXQ_ATTR_TXOP] ||
+	    !tb[NL80211_TXQ_ATTR_CWMIN] || !tb[NL80211_TXQ_ATTR_CWMAX] ||
+	    !tb[NL80211_TXQ_ATTR_AIFS])
+		return -EINVAL;
+
+	txq_params->queue = nla_get_u8(tb[NL80211_TXQ_ATTR_QUEUE]);
+	txq_params->txop = nla_get_u16(tb[NL80211_TXQ_ATTR_TXOP]);
+	txq_params->cwmin = nla_get_u16(tb[NL80211_TXQ_ATTR_CWMIN]);
+	txq_params->cwmax = nla_get_u16(tb[NL80211_TXQ_ATTR_CWMAX]);
+	txq_params->aifs = nla_get_u8(tb[NL80211_TXQ_ATTR_AIFS]);
+
+	return 0;
+}
+
 static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
 {
 	struct cfg80211_registered_device *rdev;
-	int result;
-
-	if (!info->attrs[NL80211_ATTR_WIPHY_NAME])
-		return -EINVAL;
+	int result = 0, rem_txq_params = 0;
+	struct nlattr *nl_txq_params;
 
 	rdev = cfg80211_get_dev_from_info(info);
 	if (IS_ERR(rdev))
 		return PTR_ERR(rdev);
 
-	result = cfg80211_dev_rename(rdev, nla_data(info->attrs[NL80211_ATTR_WIPHY_NAME]));
+	if (info->attrs[NL80211_ATTR_WIPHY_NAME]) {
+		result = cfg80211_dev_rename(
+			rdev, nla_data(info->attrs[NL80211_ATTR_WIPHY_NAME]));
+		if (result)
+			goto bad_res;
+	}
+
+	if (info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS]) {
+		struct ieee80211_txq_params txq_params;
+		struct nlattr *tb[NL80211_TXQ_ATTR_MAX + 1];
+
+		nla_for_each_nested(nl_txq_params,
+				    info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS],
+				    rem_txq_params) {
+			nla_parse(tb, NL80211_TXQ_ATTR_MAX,
+				  nla_data(nl_txq_params),
+				  nla_len(nl_txq_params),
+				  txq_params_policy);
+			result = parse_txq_params(tb, &txq_params);
+			if (result)
+				goto bad_res;
+
+			if (!rdev->ops->set_txq_params) {
+				result = -EOPNOTSUPP;
+				goto bad_res;
+			}
+
+			result = rdev->ops->set_txq_params(&rdev->wiphy,
+							   &txq_params);
+			if (result)
+				goto bad_res;
+		}
+	}
 
+bad_res:
 	cfg80211_put_dev(rdev);
 	return result;
 }

--

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] mac80211_hwsim: Debug info for BSS config changes
  2008-10-29 17:49 ` [PATCH 1/4] mac80211_hwsim: Debug info for BSS config changes Jouni Malinen
@ 2008-10-30 10:42   ` Johannes Berg
  0 siblings, 0 replies; 9+ messages in thread
From: Johannes Berg @ 2008-10-30 10:42 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: John W. Linville, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 417 bytes --]


> +	printk(KERN_DEBUG "%s:%s(changed=0x%x)\n",
> +	       wiphy_name(hw->wiphy), __func__, changed);

Should we print the wiphy name for each line below too so we can parse
this more easily with some validation tools?


> +	if (changed & BSS_CHANGED_BASIC_RATES) {
> +		printk(KERN_DEBUG "  BASIC_RATES: 0x%llx\n",
> +		       info->basic_rates);

That'll need an (unsigned long long) cast.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] nl80211: Add basic rate configuration for AP mode
  2008-10-29 17:49 ` [PATCH 2/4] nl80211: Add basic rate configuration for AP mode Jouni Malinen
@ 2008-10-30 10:44   ` Johannes Berg
  0 siblings, 0 replies; 9+ messages in thread
From: Johannes Berg @ 2008-10-30 10:44 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: John W. Linville, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 4695 bytes --]

On Wed, 2008-10-29 at 19:49 +0200, Jouni Malinen wrote:
> plain text document attachment (basic_rate_config.patch)
> Add a new attribute, NL80211_ATTR_BSS_BASIC_RATES, that can be used with
> NL80211_CMD_SET_BSS for userspace (e.g., hostapd) to set which rates are
> in the basic rate set.

Looks good to me, thanks.

> Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>

Acked-by: Johannes Berg <johannes@sipsolutions.net>

> Index: wireless-testing/include/linux/nl80211.h
> ===================================================================
> --- wireless-testing.orig/include/linux/nl80211.h
> +++ wireless-testing/include/linux/nl80211.h
> @@ -243,6 +243,9 @@ enum nl80211_commands {
>   *	(u8, 0 or 1)
>   * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled
>   *	(u8, 0 or 1)
> + * @NL80211_ATTR_BSS_BASIC_RATES: basic rates, array of basic
> + *	rates in format defined by IEEE 802.11 7.3.2.2 but without the length
> + *	restriction (at most %NL80211_MAX_SUPP_RATES).
>   *
>   * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from
>   *	association request when used with NL80211_CMD_NEW_STATION)
> @@ -307,6 +310,8 @@ enum nl80211_attrs {
>  
>  	NL80211_ATTR_MESH_PARAMS,
>  
> +	NL80211_ATTR_BSS_BASIC_RATES,
> +
>  	/* add attributes here, update the policy in nl80211.c */
>  
>  	__NL80211_ATTR_AFTER_LAST,
> @@ -318,6 +323,7 @@ enum nl80211_attrs {
>   * here
>   */
>  #define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY
> +#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES
>  
>  #define NL80211_MAX_SUPP_RATES			32
>  #define NL80211_MAX_SUPP_REG_RULES		32
> Index: wireless-testing/include/net/cfg80211.h
> ===================================================================
> --- wireless-testing.orig/include/net/cfg80211.h
> +++ wireless-testing/include/net/cfg80211.h
> @@ -280,11 +280,16 @@ struct mpath_info {
>   *	(0 = no, 1 = yes, -1 = do not change)
>   * @use_short_slot_time: Whether the use of short slot time is allowed
>   *	(0 = no, 1 = yes, -1 = do not change)
> + * @basic_rates: basic rates in IEEE 802.11 format
> + *	(or NULL for no change)
> + * @basic_rates_len: number of basic rates
>   */
>  struct bss_parameters {
>  	int use_cts_prot;
>  	int use_short_preamble;
>  	int use_short_slot_time;
> +	u8 *basic_rates;
> +	u8 basic_rates_len;
>  };
>  
>  /**
> Index: wireless-testing/net/mac80211/cfg.c
> ===================================================================
> --- wireless-testing.orig/net/mac80211/cfg.c
> +++ wireless-testing/net/mac80211/cfg.c
> @@ -1046,6 +1046,24 @@ static int ieee80211_change_bss(struct w
>  		changed |= BSS_CHANGED_ERP_SLOT;
>  	}
>  
> +	if (params->basic_rates) {
> +		int i, j;
> +		u32 rates = 0;
> +		struct ieee80211_local *local = wiphy_priv(wiphy);
> +		struct ieee80211_supported_band *sband =
> +			wiphy->bands[local->oper_channel->band];
> +
> +		for (i = 0; i < params->basic_rates_len; i++) {
> +			int rate = (params->basic_rates[i] & 0x7f) * 5;
> +			for (j = 0; j < sband->n_bitrates; j++) {
> +				if (sband->bitrates[j].bitrate == rate)
> +					rates |= BIT(j);
> +			}
> +		}
> +		sdata->vif.bss_conf.basic_rates = rates;
> +		changed |= BSS_CHANGED_BASIC_RATES;
> +	}
> +
>  	ieee80211_bss_info_change_notify(sdata, changed);
>  
>  	return 0;
> Index: wireless-testing/net/wireless/nl80211.c
> ===================================================================
> --- wireless-testing.orig/net/wireless/nl80211.c
> +++ wireless-testing/net/wireless/nl80211.c
> @@ -95,6 +95,8 @@ static struct nla_policy nl80211_policy[
>  	[NL80211_ATTR_BSS_CTS_PROT] = { .type = NLA_U8 },
>  	[NL80211_ATTR_BSS_SHORT_PREAMBLE] = { .type = NLA_U8 },
>  	[NL80211_ATTR_BSS_SHORT_SLOT_TIME] = { .type = NLA_U8 },
> +	[NL80211_ATTR_BSS_BASIC_RATES] = { .type = NLA_BINARY,
> +					   .len = NL80211_MAX_SUPP_RATES },
>  
>  	[NL80211_ATTR_MESH_PARAMS] = { .type = NLA_NESTED },
>  
> @@ -1613,6 +1615,12 @@ static int nl80211_set_bss(struct sk_buf
>  	if (info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME])
>  		params.use_short_slot_time =
>  		    nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]);
> +	if (info->attrs[NL80211_ATTR_BSS_BASIC_RATES]) {
> +		params.basic_rates =
> +			nla_data(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]);
> +		params.basic_rates_len =
> +			nla_len(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]);
> +	}
>  
>  	err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
>  	if (err)
> 
> --
> 
> -- 
> Jouni Malinen                                            PGP id EFC895FA
> 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/4] mac80211_hwsim: Debug info for TX queue parameters
  2008-10-29 17:49 ` [PATCH 3/4] mac80211_hwsim: Debug info for TX queue parameters Jouni Malinen
@ 2008-10-30 10:44   ` Johannes Berg
  0 siblings, 0 replies; 9+ messages in thread
From: Johannes Berg @ 2008-10-30 10:44 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: John W. Linville, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1455 bytes --]

On Wed, 2008-10-29 at 19:49 +0200, Jouni Malinen wrote:
> plain text document attachment (hwsim_tx_conf.patch)
> Provide detailed information on TX queue parameter changes to make it
> easier to debug mac80211 functionality.
> 
> Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>

Acked-by: Johannes Berg <johannes@sipsolutions.net>

> Index: wireless-testing/drivers/net/wireless/mac80211_hwsim.c
> ===================================================================
> --- wireless-testing.orig/drivers/net/wireless/mac80211_hwsim.c	2008-10-29 13:27:50.000000000 +0200
> +++ wireless-testing/drivers/net/wireless/mac80211_hwsim.c	2008-10-29 13:36:20.000000000 +0200
> @@ -468,6 +468,17 @@
>  	return 0;
>  }
>  
> +static int mac80211_hwsim_conf_tx(
> +	struct ieee80211_hw *hw, u16 queue,
> +	const struct ieee80211_tx_queue_params *params)
> +{
> +	printk(KERN_DEBUG "%s:%s (queue=%d txop=%d cw_min=%d cw_max=%d "
> +	       "aifs=%d)\n",
> +	       wiphy_name(hw->wiphy), __func__, queue,
> +	       params->txop, params->cw_min, params->cw_max, params->aifs);
> +	return 0;
> +}
> +
>  static const struct ieee80211_ops mac80211_hwsim_ops =
>  {
>  	.tx = mac80211_hwsim_tx,
> @@ -481,6 +492,7 @@
>  	.bss_info_changed = mac80211_hwsim_bss_info_changed,
>  	.sta_notify = mac80211_hwsim_sta_notify,
>  	.set_tim = mac80211_hwsim_set_tim,
> +	.conf_tx = mac80211_hwsim_conf_tx,
>  };
>  
> 
> 
> --
> 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] nl80211: Add TX queue parameter configuration
  2008-10-29 17:49 ` [PATCH 4/4] nl80211: Add TX queue parameter configuration Jouni Malinen
@ 2008-10-30 10:49   ` Johannes Berg
  0 siblings, 0 replies; 9+ messages in thread
From: Johannes Berg @ 2008-10-30 10:49 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: John W. Linville, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1694 bytes --]

On Wed, 2008-10-29 at 19:49 +0200, Jouni Malinen wrote:

> + * enum nl80211_txq_attr - TX queue parameter attributes
> + * @NL80211_TXQ_ATTR_QUEUE: TX queue identifier (NL80211_TXQ_Q_*)
> + * @NL80211_TXQ_ATTR_TXOP: Maximum burst time in units of 32 usecs, 0 meaning
> + *	disabled
> + * @NL80211_TXQ_ATTR_CWMIN: Minimum contention window [a value of the form
> + *	2^n-1 in the range 1..32767]
> + * @NL80211_TXQ_ATTR_CWMAX: Maximum contention window [a value of the form
> + *	2^n-1 in the range 1..32767]
> + * @NL80211_TXQ_ATTR_AIFS: Arbitration interframe space [0..255]

You have to add the invalid, after_last and max to the kernel-doc too
otherwise it'll warn about it.

>  
> +struct ieee80211_txq_params {
> +	u8 queue;
> +	u16 txop;
> +	u16 cwmin;
> +	u16 cwmax;
> +	u8 aifs;
> +};

Maybe add some kernel-doc describing the units etc.? And describing
which values are valid for 'queue' (or should that use the enum
VO/VI/...?)

> +	if (info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS]) {
> +		struct ieee80211_txq_params txq_params;
> +		struct nlattr *tb[NL80211_TXQ_ATTR_MAX + 1];
> +
> +		nla_for_each_nested(nl_txq_params,
> +				    info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS],
> +				    rem_txq_params) {
> +			nla_parse(tb, NL80211_TXQ_ATTR_MAX,
> +				  nla_data(nl_txq_params),
> +				  nla_len(nl_txq_params),
> +				  txq_params_policy);
> +			result = parse_txq_params(tb, &txq_params);
> +			if (result)
> +				goto bad_res;
> +
> +			if (!rdev->ops->set_txq_params) {
> +				result = -EOPNOTSUPP;
> +				goto bad_res;
> +			}

Seems you could do that check outside the loop?

Otherwise looks good to me, thanks.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-10-30 10:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-29 17:49 [PATCH 0/4] mac80211/cfg80211/hwsim: Basic rate and TXQ params Jouni Malinen
2008-10-29 17:49 ` [PATCH 1/4] mac80211_hwsim: Debug info for BSS config changes Jouni Malinen
2008-10-30 10:42   ` Johannes Berg
2008-10-29 17:49 ` [PATCH 2/4] nl80211: Add basic rate configuration for AP mode Jouni Malinen
2008-10-30 10:44   ` Johannes Berg
2008-10-29 17:49 ` [PATCH 3/4] mac80211_hwsim: Debug info for TX queue parameters Jouni Malinen
2008-10-30 10:44   ` Johannes Berg
2008-10-29 17:49 ` [PATCH 4/4] nl80211: Add TX queue parameter configuration Jouni Malinen
2008-10-30 10:49   ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).