diff mbox

[10/13] nl80211: implement add_ts/del_ts ops

Message ID 1413893812-5122-11-git-send-email-ilan.peer@intel.com
State Accepted
Headers show

Commit Message

Ilan Peer Oct. 21, 2014, 12:16 p.m. UTC
From: Moshe Benji <Moshe.Benji@intel.com>

Add ops to notify about tspecs to add/remove.

Additionally, subscribe to ADDTS/DELTS action frames in
order to be able to process wmm ac public action frames.

Signed-off-by: Moshe Benji <moshe.benji@intel.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
---
 src/drivers/driver_nl80211.c | 92 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 92 insertions(+)

Comments

Johannes Berg Oct. 22, 2014, 6:50 a.m. UTC | #1
> +		case NL80211_CMD_ADD_TX_TS:
> +			info->wmm_ac_supported = 1;
> +			break;

I believe this is wrong as I defined the command to cover both WMM and
802.11 TSPEC, you need to check the WMM-specific feature flag instead.

johannes
Johannes Berg Oct. 22, 2014, 7:31 a.m. UTC | #2
On Wed, 2014-10-22 at 08:50 +0200, Johannes Berg wrote:
> > +		case NL80211_CMD_ADD_TX_TS:
> > +			info->wmm_ac_supported = 1;
> > +			break;
> 
> I believe this is wrong as I defined the command to cover both WMM and
> 802.11 TSPEC, you need to check the WMM-specific feature flag instead.

I'm an idiot, I made it a wiphy feature flag.

It seems better if we were to make that flag visible, just in case
somebody actually wants 802.11 tspec in the future and implements only
that?

I'll change the kernel code to advertise the feature flag so you can use
it.

johannes
Eliad Peller Oct. 22, 2014, 8:15 a.m. UTC | #3
On Wed, Oct 22, 2014 at 10:31 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Wed, 2014-10-22 at 08:50 +0200, Johannes Berg wrote:
>> > +           case NL80211_CMD_ADD_TX_TS:
>> > +                   info->wmm_ac_supported = 1;
>> > +                   break;
>>
>> I believe this is wrong as I defined the command to cover both WMM and
>> 802.11 TSPEC, you need to check the WMM-specific feature flag instead.
>
> I'm an idiot, I made it a wiphy feature flag.
>
> It seems better if we were to make that flag visible, just in case
> somebody actually wants 802.11 tspec in the future and implements only
> that?
>
> I'll change the kernel code to advertise the feature flag so you can use
> it.
>
thanks, i'll use it.

Eliad.
diff mbox

Patch

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index f662616..5a8e05f 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -540,6 +540,8 @@  static const char * nl80211_command_to_string(enum nl80211_commands cmd)
 	C2S(NL80211_CMD_CHANNEL_SWITCH)
 	C2S(NL80211_CMD_VENDOR)
 	C2S(NL80211_CMD_SET_QOS_MAP)
+	C2S(NL80211_CMD_ADD_TX_TS)
+	C2S(NL80211_CMD_DEL_TX_TS)
 	default:
 		return "NL80211_CMD_UNKNOWN";
 	}
@@ -3569,6 +3571,7 @@  struct wiphy_info_data {
 	unsigned int p2p_client_supported:1;
 	unsigned int p2p_concurrent:1;
 	unsigned int channel_switch_supported:1;
+	unsigned int wmm_ac_supported:1;
 	unsigned int set_qos_map_supported:1;
 	unsigned int have_low_prio_scan:1;
 };
@@ -3736,6 +3739,9 @@  static void wiphy_info_supp_cmds(struct wiphy_info_data *info,
 		case NL80211_CMD_CHANNEL_SWITCH:
 			info->channel_switch_supported = 1;
 			break;
+		case NL80211_CMD_ADD_TX_TS:
+			info->wmm_ac_supported = 1;
+			break;
 		case NL80211_CMD_SET_QOS_MAP:
 			info->set_qos_map_supported = 1;
 			break;
@@ -4098,6 +4104,7 @@  static int wpa_driver_nl80211_get_info(struct wpa_driver_nl80211_data *drv,
 
 	if (info->channel_switch_supported)
 		drv->capa.flags |= WPA_DRIVER_FLAGS_AP_CSA;
+	drv->capa.wmm_ac_supported = info->wmm_ac_supported;
 
 	return 0;
 nla_put_failure:
@@ -4707,6 +4714,14 @@  static int nl80211_mgmt_subscribe_non_ap(struct i802_bss *bss)
 	if (nl80211_register_action_frame(bss, (u8 *) "\x0a\x11", 2) < 0)
 		ret = -1;
 
+	/* WMM-AC ADDTS Response */
+	if (nl80211_register_action_frame(bss, (u8 *) "\x11\x01", 2) < 0)
+		return -1;
+
+	/* WMM-AC DELTS */
+	if (nl80211_register_action_frame(bss, (u8 *) "\x11\x02", 2) < 0)
+		return -1;
+
 #ifdef CONFIG_HS20
 	/* WNM-Notification */
 	if (nl80211_register_action_frame(bss, (u8 *) "\x0a\x1a", 2) < 0)
@@ -12386,6 +12401,81 @@  error:
 }
 
 
+static int nl80211_add_ts(void *priv, u8 tsid, const u8 *addr,
+			  u8 user_priority, u16 admitted_time)
+{
+	struct i802_bss *bss = priv;
+	struct wpa_driver_nl80211_data *drv = bss->drv;
+	struct nl_msg *msg;
+	int ret;
+
+	wpa_printf(MSG_INFO,
+		   "nl80211: add_ts request: tsid=%u admitted_time=%u up=%d",
+		   tsid, admitted_time, user_priority);
+
+	if (!is_sta_interface(drv->nlmode))
+		return -ENOTSUP;
+
+	msg = nlmsg_alloc();
+	if (!msg)
+		return -ENOMEM;
+
+	nl80211_cmd(drv, msg, 0, NL80211_CMD_ADD_TX_TS);
+	if (nl80211_set_iface_id(msg, bss) < 0)
+		goto nla_put_failure;
+
+	NLA_PUT_U8(msg, NL80211_ATTR_TSID, tsid);
+	NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr);
+	NLA_PUT_U8(msg, NL80211_ATTR_USER_PRIO, user_priority);
+	NLA_PUT_U16(msg, NL80211_ATTR_ADMITTED_TIME, admitted_time);
+
+	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
+	if (ret)
+		wpa_printf(MSG_DEBUG, "nl80211: add_ts failed err=%d (%s)",
+			   ret, strerror(-ret));
+	return ret;
+
+nla_put_failure:
+	nlmsg_free(msg);
+	return -ENOBUFS;
+}
+
+
+static int nl80211_del_ts(void *priv, u8 tsid, const u8 *addr)
+{
+	struct i802_bss *bss = priv;
+	struct wpa_driver_nl80211_data *drv = bss->drv;
+	struct nl_msg *msg;
+	int ret;
+
+	wpa_printf(MSG_INFO, "nl80211: del_ts request: tsid=%u", tsid);
+
+	if (!is_sta_interface(drv->nlmode))
+		return -ENOTSUP;
+
+	msg = nlmsg_alloc();
+	if (!msg)
+		return -ENOMEM;
+
+	nl80211_cmd(drv, msg, 0, NL80211_CMD_DEL_TX_TS);
+	if (nl80211_set_iface_id(msg, bss) < 0)
+		goto nla_put_failure;
+
+	NLA_PUT_U8(msg, NL80211_ATTR_TSID, tsid);
+	NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr);
+
+	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
+	if (ret)
+		wpa_printf(MSG_DEBUG, "nl80211: del_ts failed err=%d (%s)",
+			   ret, strerror(-ret));
+	return ret;
+
+nla_put_failure:
+	nlmsg_free(msg);
+	return -ENOBUFS;
+}
+
+
 #ifdef CONFIG_TESTING_OPTIONS
 static int cmd_reply_handler(struct nl_msg *msg, void *arg)
 {
@@ -12889,4 +12979,6 @@  const struct wpa_driver_ops wpa_driver_nl80211_ops = {
 	.join_mesh = wpa_driver_nl80211_join_mesh,
 	.leave_mesh = wpa_driver_nl80211_leave_mesh,
 #endif /* CONFIG_MESH */
+	.add_tx_ts = nl80211_add_ts,
+	.del_tx_ts = nl80211_del_ts,
 };