Skip to contentSkip to conversation

cfg80211: Add mesh peer AID setting API

PATCH Superseded Masashi Honma 4 participants 8 messages Jun 30, 2016 – Jul 6, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cfg80211: Add mesh peer AID setting API

Previously, mesh peer AID is not reported to kernel when local mesh STA is created without iw command. The mesh peer AID is needed by mesh peer power management functionality to identify a AID in a TIM element.

This patch creates mesh peer AID setting API.

---
 include/net/cfg80211.h       | 1 +
 include/uapi/linux/nl80211.h | 5 +++++
 net/mac80211/cfg.c           | 1 +
 net/wireless/nl80211.c       | 3 +++
 4 files changed, 10 insertions(+)
include/net/cfg80211.h +1 -0
index 7bbb00d..2fa5896 100644
@@ -805,6 +805,7 @@ struct station_parameters {
 	u32 sta_modify_mask;
 	int listen_interval;
 	u16 aid;
+	u16 mesh_aid;
 	u8 supported_rates_len;
 	u8 plink_action;
 	u8 plink_state;
include/uapi/linux/nl80211.h +5 -0
index 53c8278..f8c454e 100644
@@ -1829,6 +1829,9 @@ enum nl80211_commands {
  *	%NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities per
  *	interface type.
  *
+ * @NL80211_ATTR_MESH_PEER_AID: Association ID for the mesh peer (u16). This is
+ *	used to pull the stored data for mesh peer in power save state.
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2213,6 +2216,8 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_IFTYPE_EXT_CAPA,
 
+	NL80211_ATTR_MESH_PEER_AID,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
net/mac80211/cfg.c +1 -0
index 0c12e40..08802f7 100644
@@ -997,6 +997,7 @@ static void sta_apply_mesh_params(struct ieee80211_local *local,
 			if (sta->mesh->plink_state != NL80211_PLINK_ESTAB)
 				changed = mesh_plink_inc_estab_count(sdata);
 			sta->mesh->plink_state = params->plink_state;
+			sta->mesh->aid = params->mesh_aid;
 
 			ieee80211_mps_sta_status_update(sta);
 			changed |= ieee80211_mps_set_sta_local_pm(sta,
net/wireless/nl80211.c +3 -0
index c503e96..f41fb61 100644
@@ -4410,6 +4410,9 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
 			nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_STATE]);
 		if (params.plink_state >= NUM_NL80211_PLINK_STATES)
 			return -EINVAL;
+		if (info->attrs[NL80211_ATTR_MESH_PEER_AID])
+			params.mesh_aid = nla_get_u16(
+				info->attrs[NL80211_ATTR_MESH_PEER_AID]);
 		params.sta_modify_mask |= STATION_PARAM_APPLY_PLINK_STATE;
 	}
 
Signature · 1 line
2.5.0
#1 lore raw
All warnings (new ones prefixed by >>):

Hi,

[auto build test WARNING on mac80211-next/master]
[also build test WARNING on next-20160629]
[cannot apply to v4.7-rc5]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Masashi-Honma/cfg80211-Add-mesh-peer-AID-setting-API/20160630-171005
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

>> include/net/cfg80211.h:827: warning: No description found for parameter 'mesh_aid'
>> include/net/cfg80211.h:827: warning: No description found for parameter 'mesh_aid'
>> include/net/cfg80211.h:827: warning: No description found for parameter 'mesh_aid'
>> include/net/cfg80211.h:827: warning: No description found for parameter 'mesh_aid'
>> include/net/cfg80211.h:827: warning: No description found for parameter 'mesh_aid'
>> include/net/cfg80211.h:827: warning: No description found for parameter 'mesh_aid'
>> include/net/cfg80211.h:827: warning: No description found for parameter 'mesh_aid'
>> include/net/cfg80211.h:827: warning: No description found for parameter 'mesh_aid'
>> include/net/cfg80211.h:827: warning: No description found for parameter 'mesh_aid'
>> include/net/cfg80211.h:827: warning: No description found for parameter 'mesh_aid'
>> include/net/cfg80211.h:827: warning: No description found for parameter 'mesh_aid'
>> include/net/cfg80211.h:827: warning: No description found for parameter 'mesh_aid'
>> include/net/cfg80211.h:827: warning: No description found for parameter 'mesh_aid'
>> include/net/cfg80211.h:827: warning: No description found for parameter 'mesh_aid'
>> include/net/cfg80211.h:827: warning: No description found for parameter 'mesh_aid'
>> include/net/cfg80211.h:827: warning: No description found for parameter 'mesh_aid'
>> include/net/cfg80211.h:827: warning: No description found for parameter 'mesh_aid'
>> include/net/cfg80211.h:827: warning: No description found for parameter 'mesh_aid'
>> include/net/cfg80211.h:827: warning: No description found for parameter 'mesh_aid'
>> include/net/cfg80211.h:827: warning: No description found for parameter 'mesh_aid'

vim +/mesh_aid +827 include/net/cfg80211.h

9c3990aa Javier Cardona   2011-05-03  811  	u8 plink_state;
2c1aabf3 Johannes Berg    2013-02-14  812  	const struct ieee80211_ht_cap *ht_capa;
2c1aabf3 Johannes Berg    2013-02-14  813  	const struct ieee80211_vht_cap *vht_capa;
c75786c9 Eliad Peller     2011-08-23  814  	u8 uapsd_queues;
c75786c9 Eliad Peller     2011-08-23  815  	u8 max_sp;
3b1c5a53 Marco Porsch     2013-01-07  816  	enum nl80211_mesh_power_mode local_pm;
9d62a986 Jouni Malinen    2013-02-14  817  	u16 capability;
2c1aabf3 Johannes Berg    2013-02-14  818  	const u8 *ext_capab;
9d62a986 Jouni Malinen    2013-02-14  819  	u8 ext_capab_len;
c01fc9ad Sunil Dutt       2013-10-09  820  	const u8 *supported_channels;
c01fc9ad Sunil Dutt       2013-10-09  821  	u8 supported_channels_len;
c01fc9ad Sunil Dutt       2013-10-09  822  	const u8 *supported_oper_classes;
c01fc9ad Sunil Dutt       2013-10-09  823  	u8 supported_oper_classes_len;
60f4a7b1 Marek Kwaczynski 2013-12-03  824  	u8 opmode_notif;
60f4a7b1 Marek Kwaczynski 2013-12-03  825  	bool opmode_notif_used;
17b94247 Ayala Beker      2016-03-17  826  	int support_p2p_ps;
5727ef1b Johannes Berg    2007-12-19 @827  };
5727ef1b Johannes Berg    2007-12-19  828  
fd5b74dc Johannes Berg    2007-12-19  829  /**
89c771e5 Jouni Malinen    2014-10-10  830   * struct station_del_parameters - station deletion parameters
89c771e5 Jouni Malinen    2014-10-10  831   *
89c771e5 Jouni Malinen    2014-10-10  832   * Used to delete a station entry (or all stations).
89c771e5 Jouni Malinen    2014-10-10  833   *
89c771e5 Jouni Malinen    2014-10-10  834   * @mac: MAC address of the station to remove or NULL to remove all stations
98856866 Jouni Malinen    2014-10-20  835   * @subtype: Management frame subtype to use for indicating removal

:::::: The code at line 827 was first introduced by commit
:::::: 5727ef1b2e797a1922f5bc239b6afb2b4cfb80bc cfg80211/nl80211: station handling

:::::: TO: Johannes Berg <[email protected]> :::::: CC: David S. Miller <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#2 lore raw
In reply to Masashi Honma

include/net/cfg80211.h struct station_parameters { · line 808

Quoted 9 lines · Masashi Honma
include/net/cfg80211.h +1 -0
index 7bbb00d..2fa5896 100644
@@ -805,6 +805,7 @@ struct station_parameters {
 	u32 sta_modify_mask;
 	int listen_interval;
 	u16 aid;
+	u16 mesh_aid;

Let's call it peer_aid or mesh_peer_aid or something like that, per my email on hostapd list. Also you probably saw kbuild robot pointed out missing documentation for the field.

net/wireless/nl80211.c static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) · line 4415

Quoted 11 lines
net/wireless/nl80211.c +3 -0
index c503e96..f41fb61 100644
@@ -4410,6 +4410,9 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
 			nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_STATE]);
 		if (params.plink_state >= NUM_NL80211_PLINK_STATES)
 			return -EINVAL;
+		if (info->attrs[NL80211_ATTR_MESH_PEER_AID])
+			params.mesh_aid = nla_get_u16(
+				info->attrs[NL80211_ATTR_MESH_PEER_AID]);

We need a check against IEEE80211_MAX_AID somewhere.

Signature · 1 line
Bob Copeland %% http://bobcopeland.com/
#3 lore raw
Quoted 3 lines · Bob Copeland

Let's call it peer_aid or mesh_peer_aid or something like that, per my email on hostapd list. Also you probably saw kbuild robot pointed out missing documentation for the field.

Yes. I will modify this also.

Quoted 1 line

We need a check against IEEE80211_MAX_AID somewhere.

Sure. I will add a check.

#4 lore raw

PATCH v2 1/1 cfg80211: Add mesh peer AID setting API

In reply to Masashi Honma

Previously, mesh power management functionality works only with kernel MPM. Because user space MPM did not report mesh peer AID to kernel, the kernel could not identify the bit in TIM element. So this patch adds mesh peer AID setting API.

---
 include/net/cfg80211.h       | 2 ++
 include/uapi/linux/nl80211.h | 5 +++++
 net/mac80211/cfg.c           | 1 +
 net/wireless/nl80211.c       | 7 +++++++
 4 files changed, 15 insertions(+)
include/net/cfg80211.h +2 -0
index 7bbb00d..23e34ca 100644
@@ -774,6 +774,7 @@ enum station_parameters_apply_mask {
  *	(bitmask of BIT(NL80211_STA_FLAG_...))
  * @listen_interval: listen interval or -1 for no change
  * @aid: AID or zero for no change
+ * @peer_aid: mesh peer AID or zero for no change
  * @plink_action: plink action to take
  * @plink_state: set the peer link state for a station
  * @ht_capa: HT capabilities of station
@@ -805,6 +806,7 @@ struct station_parameters {
 	u32 sta_modify_mask;
 	int listen_interval;
 	u16 aid;
+	u16 peer_aid;
 	u8 supported_rates_len;
 	u8 plink_action;
 	u8 plink_state;
include/uapi/linux/nl80211.h +5 -0
index 53c8278..f8c454e 100644
@@ -1829,6 +1829,9 @@ enum nl80211_commands {
  *	%NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities per
  *	interface type.
  *
+ * @NL80211_ATTR_MESH_PEER_AID: Association ID for the mesh peer (u16). This is
+ *	used to pull the stored data for mesh peer in power save state.
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2213,6 +2216,8 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_IFTYPE_EXT_CAPA,
 
+	NL80211_ATTR_MESH_PEER_AID,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
net/mac80211/cfg.c +1 -0
index 0c12e40..47e99ab8 100644
@@ -997,6 +997,7 @@ static void sta_apply_mesh_params(struct ieee80211_local *local,
 			if (sta->mesh->plink_state != NL80211_PLINK_ESTAB)
 				changed = mesh_plink_inc_estab_count(sdata);
 			sta->mesh->plink_state = params->plink_state;
+			sta->mesh->aid = params->peer_aid;
 
 			ieee80211_mps_sta_status_update(sta);
 			changed |= ieee80211_mps_set_sta_local_pm(sta,
net/wireless/nl80211.c +7 -0
index 244d552..8337349 100644
@@ -4410,6 +4410,13 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
 			nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_STATE]);
 		if (params.plink_state >= NUM_NL80211_PLINK_STATES)
 			return -EINVAL;
+		if (info->attrs[NL80211_ATTR_MESH_PEER_AID]) {
+			if (nla_get_u16(info->attrs[NL80211_ATTR_MESH_PEER_AID])
+			    > IEEE80211_MAX_AID)
+				return -EINVAL;
+			params.peer_aid = nla_get_u16(
+				info->attrs[NL80211_ATTR_MESH_PEER_AID]);
+		}
 		params.sta_modify_mask |= STATION_PARAM_APPLY_PLINK_STATE;
 	}
 
Signature · 1 line
2.5.0
maintainer
#5 lore raw
Quoted 41 lines · Masashi Honma

Previously, mesh power management functionality works only with kernel
MPM. Because user space MPM did not report mesh peer AID to kernel, the kernel could not identify the bit in TIM element. So this patch adds mesh peer AID setting API.

---
 include/net/cfg80211.h       | 2 ++
 include/uapi/linux/nl80211.h | 5 +++++
 net/mac80211/cfg.c           | 1 +
 net/wireless/nl80211.c       | 7 +++++++

 4 files changed, 15 insertions(+)
include/net/cfg80211.h +2 -0
index 7bbb00d..23e34ca 100644
@@ -774,6 +774,7 @@ enum station_parameters_apply_mask {
   *	(bitmask of BIT(NL80211_STA_FLAG_...))
   * @listen_interval: listen interval or -1 for no change
   * @aid: AID or zero for no change
+ * @peer_aid: mesh peer AID or zero for no change
   * @plink_action: plink action to take
   * @plink_state: set the peer link state for a station
   * @ht_capa: HT capabilities of station
@@ -805,6 +806,7 @@ struct station_parameters {
  	u32 sta_modify_mask;
  	int listen_interval;
  	u16 aid;
+	u16 peer_aid;
  	u8 supported_rates_len;
  	u8 plink_action;
  	u8 plink_state;
include/uapi/linux/nl80211.h +0 -0
index 53c8278..f8c454e 100644
@@ -1829,6 +1829,9 @@ enum nl80211_commands {
   *	%NL80211_ATTR_EXT_CAPA_MASK, to specify the extended
Quoted 8 lines

capabilities per
  * interface type.
  *
+ * @NL80211_ATTR_MESH_PEER_AID: Association ID for the mesh peer (u16). This is
+ * used to pull the stored data for mesh peer in power save
state.

Why does this need new API all over?

It seems to me that it could just use the regular NL80211_ATTR_STA_AID attribute, and the cfg80211 code would already be in place, and you'd just need to add a single line to mac80211 and
to cfg80211_check_station_change() to accept that.

johannes

#6 lore raw
Quoted 11 lines · Johannes Berg
Quoted 5 lines

+ * @NL80211_ATTR_MESH_PEER_AID: Association ID for the mesh peer (u16). This is
+ * used to pull the stored data for mesh peer in power save
state.

Why does this need new API all over?

It seems to me that it could just use the regular NL80211_ATTR_STA_AID attribute, and the cfg80211 code would already be in place, and you'd just need to add a single line to mac80211 and
to cfg80211_check_station_change() to accept that.

We are already using NL80211_ATTR_STA_AID, though -- one is for the station's AID (in our TIM, which is NL80211_ATTR_STA_AID) and the new one is for our AID in the peer's TIM.

There is the NL80211_ATTR_PEER_AID but that seems specific to TDLS and also doesn't appear to be processed in the necessary way (e.g. overrides STA_AID in nl80211_new_station).

Signature · 1 line
Bob Copeland %% http://bobcopeland.com/
maintainer
#7 lore raw
Quoted 13 lines
Quoted 7 lines

It seems to me that it could just use the
regular NL80211_ATTR_STA_AID
attribute, and the cfg80211 code would already be in place, and you'd
just need to add a single line to mac80211 and
to cfg80211_check_station_change() to accept that.

We are already using NL80211_ATTR_STA_AID, though -- one is for the station's AID (in our TIM, which is NL80211_ATTR_STA_AID) and the new one
is for our AID in the peer's TIM.

Quoted 5 lines

There is the NL80211_ATTR_PEER_AID but that seems specific to TDLS and
also doesn't appear to be processed in the necessary way (e.g. overrides
STA_AID in nl80211_new_station).

Oh, ok. Applied then.

johannes