Received: by 10.223.176.46 with SMTP id f43csp280560wra; Tue, 23 Jan 2018 20:58:23 -0800 (PST) X-Google-Smtp-Source: AH8x225mYvEnj7bp7oLU2qQO2HpMtfx+7h58Evs9k9hI0NkMy11hhTubOTKECdKOezQkbiqcOerZ X-Received: by 10.99.148.17 with SMTP id m17mr9211995pge.367.1516769903409; Tue, 23 Jan 2018 20:58:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516769903; cv=none; d=google.com; s=arc-20160816; b=SjT4lPp24NLUKRP5T9PN+ox2fnRcrHUb6oxohyfFa4CWtzCtBNu2+Pp+2rbwcy6VkQ 48M/QaU1XHdSd1klIrzO/IG33d1roH23r9J7BZRS0yH8XCtSSCS7te4caWuPg2tGu100 OAfvZDItpgOdsSBfGnF1n5KxKkREeStjqQ+sunz4/rIdQlQCFiGV9s4/wrV0fNQ2CE9k KGlmidh9yupUZfNFN1S/Qif1PptfLvxtyi4JIuJo7UdRG4LnUmUKv7bIHWx9tVzI7Q6Q fSD0+8mpGkTauINJf2UwYsHO22YHXpS58dQ8jmSWtAsNDnpm9jSuttU4x0klhrTmw5tW 9ZEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=gAi4R4ek4vaupBbAuf7uEKGBz+kD0oS2bZi9dsAtdSs=; b=z2V9K3QYhAq27J4FbWzonG6yaj8ozJxfq0wZBLbjPe/lOlr89aYkLEWsMCTUPPdNwE phDoC3IHENOFNlQWxy/sj760qvdv9XDG1Fm+8YpgW6VNgEeNmtfFMmNJcL5gPUcbqP+R jHxXxh9Z0zIhCKTKJieo4+IrRhySyjF9xlzB112kn2YONXz8R9BmkP4+1+mIFYhmhcpY B5Uz7DrsLvo09mh1F5FRfLM8QNJ/tXSBvzMtcNIquqwAwWgf0vgJ0mV5L6fu68MDGvds I04Lcx9Mbbuv9oak+dXcR6AETRLsZlLvz3mhl2THgyhakPMkyFi3MCzTaCTEdfaYx6jk 7gwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=RoYoVWNQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 2-v6si5520557plc.784.2018.01.23.20.58.09; Tue, 23 Jan 2018 20:58:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=RoYoVWNQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932269AbeAXE5f (ORCPT + 99 others); Tue, 23 Jan 2018 23:57:35 -0500 Received: from mail-sn1nam01on0111.outbound.protection.outlook.com ([104.47.32.111]:45037 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752847AbeAXEPS (ORCPT ); Tue, 23 Jan 2018 23:15:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=gAi4R4ek4vaupBbAuf7uEKGBz+kD0oS2bZi9dsAtdSs=; b=RoYoVWNQMo+PiHTEzSeqomFqyOa3scIyDq9ZSkwmi0Flg12V6weExnFk1LDMXIZlVZXxgGrzVDNb5jQqMIJIQkkQbIDcbzNeNLwrd3gT5QmXaBsLVZYwy1BIJ/cZKFMEd4+2wpIjtxFv6/jbZnjgS6SG0dMS+oilAfAiiZeEjSM= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0998.namprd21.prod.outlook.com (52.132.133.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.0; Wed, 24 Jan 2018 04:15:13 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::6485:b98:d15e:9da7]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::6485:b98:d15e:9da7%2]) with mapi id 15.20.0464.000; Wed, 24 Jan 2018 04:15:13 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Johannes Berg , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 040/100] mac80211: use QoS NDP for AP probing Thread-Topic: [PATCH AUTOSEL for 4.14 040/100] mac80211: use QoS NDP for AP probing Thread-Index: AQHTlMncqlmAn2oSjEKF3iXg0TakxA== Date: Wed, 24 Jan 2018 04:14:43 +0000 Message-ID: <20180124041414.32065-40-alexander.levin@microsoft.com> References: <20180124041414.32065-1-alexander.levin@microsoft.com> In-Reply-To: <20180124041414.32065-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0998;7:hyXbvL/fheDuhfhkbjpsUTYboV6pfPWrSvFP3AgPN0EzW1IjOMyQElF1rdIMO8Ud9UgUpD8OValmc/xJqnQVz43U7YwZrjjIRFlDCn3YE+YPJ6Z2Y2Amc58yWf85Sn8olsvc4W/BuDJ9KGkiHmXnfny61g+ookXfWg7F1rbbMMObHKxmNPvZ4Me3g5cX2ZGMIIPRmAtkUJ3EN059mC4Pp3wfH2+W37EPweXiUryeoRjwI9jcTPHxCz8WRF573ugK x-ms-office365-filtering-correlation-id: bfafa38c-0c6e-4320-0c51-08d562e110d5 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603307)(7193020);SRVR:DM5PR2101MB0998; x-ms-traffictypediagnostic: DM5PR2101MB0998: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231046)(2400081)(944501161)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041288)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB0998;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0998; x-forefront-prvs: 056297E276 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(39380400002)(346002)(39860400002)(396003)(376002)(199004)(189003)(14454004)(3660700001)(6346003)(10290500003)(105586002)(66066001)(6506007)(8676002)(22452003)(86612001)(54906003)(10090500001)(81166006)(81156014)(76176011)(110136005)(86362001)(68736007)(106356001)(59450400001)(8936002)(3280700002)(36756003)(25786009)(107886003)(2501003)(6666003)(99286004)(2906002)(26005)(2950100002)(72206003)(102836004)(305945005)(6116002)(3846002)(5660300001)(4326008)(478600001)(316002)(53936002)(97736004)(575784001)(2900100001)(5250100002)(6512007)(6436002)(6486002)(1076002)(7736002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0998;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: AvMu9gq4UBwJx5aAffHZ+ptcmMF1by0LryiefqZWNLNufmo0hX2MZNHPxohsDcaxi59rd9XCNyabz6a0XTPrdA== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: bfafa38c-0c6e-4320-0c51-08d562e110d5 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jan 2018 04:14:43.9777 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0998 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johannes Berg [ Upstream commit 7b6ddeaf27eca72795ceeae2f0f347db1b5f9a30 ] When connected to a QoS/WMM AP, mac80211 should use a QoS NDP for probing it, instead of a regular non-QoS one, fix this. Change all the drivers to *not* allow QoS NDP for now, even though it looks like most of them should be OK with that. Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath9k/channel.c | 2 +- drivers/net/wireless/st/cw1200/sta.c | 4 ++-- drivers/net/wireless/ti/wl1251/main.c | 2 +- drivers/net/wireless/ti/wlcore/cmd.c | 5 +++-- include/net/mac80211.h | 8 +++++++- net/mac80211/mlme.c | 2 +- net/mac80211/tx.c | 29 +++++++++++++++++++++++++++-= - 7 files changed, 42 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireles= s/ath/ath9k/channel.c index f0439f2d566b..173891b11b2d 100644 --- a/drivers/net/wireless/ath/ath9k/channel.c +++ b/drivers/net/wireless/ath/ath9k/channel.c @@ -1112,7 +1112,7 @@ ath_chanctx_send_vif_ps_frame(struct ath_softc *sc, s= truct ath_vif *avp, if (!avp->assoc) return false; =20 - skb =3D ieee80211_nullfunc_get(sc->hw, vif); + skb =3D ieee80211_nullfunc_get(sc->hw, vif, false); if (!skb) return false; =20 diff --git a/drivers/net/wireless/st/cw1200/sta.c b/drivers/net/wireless/st= /cw1200/sta.c index a52224836a2b..666b88cb2cfe 100644 --- a/drivers/net/wireless/st/cw1200/sta.c +++ b/drivers/net/wireless/st/cw1200/sta.c @@ -198,7 +198,7 @@ void __cw1200_cqm_bssloss_sm(struct cw1200_common *priv= , =20 priv->bss_loss_state++; =20 - skb =3D ieee80211_nullfunc_get(priv->hw, priv->vif); + skb =3D ieee80211_nullfunc_get(priv->hw, priv->vif, false); WARN_ON(!skb); if (skb) cw1200_tx(priv->hw, NULL, skb); @@ -2266,7 +2266,7 @@ static int cw1200_upload_null(struct cw1200_common *p= riv) .rate =3D 0xFF, }; =20 - frame.skb =3D ieee80211_nullfunc_get(priv->hw, priv->vif); + frame.skb =3D ieee80211_nullfunc_get(priv->hw, priv->vif, false); if (!frame.skb) return -ENOMEM; =20 diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/t= i/wl1251/main.c index 9915d83a4a30..6d02c660b4ab 100644 --- a/drivers/net/wireless/ti/wl1251/main.c +++ b/drivers/net/wireless/ti/wl1251/main.c @@ -566,7 +566,7 @@ static int wl1251_build_null_data(struct wl1251 *wl) size =3D sizeof(struct wl12xx_null_data_template); ptr =3D NULL; } else { - skb =3D ieee80211_nullfunc_get(wl->hw, wl->vif); + skb =3D ieee80211_nullfunc_get(wl->hw, wl->vif, false); if (!skb) goto out; size =3D skb->len; diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti= /wlcore/cmd.c index 2bfc12fdc929..761cf8573a80 100644 --- a/drivers/net/wireless/ti/wlcore/cmd.c +++ b/drivers/net/wireless/ti/wlcore/cmd.c @@ -1069,7 +1069,8 @@ int wl12xx_cmd_build_null_data(struct wl1271 *wl, str= uct wl12xx_vif *wlvif) ptr =3D NULL; } else { skb =3D ieee80211_nullfunc_get(wl->hw, - wl12xx_wlvif_to_vif(wlvif)); + wl12xx_wlvif_to_vif(wlvif), + false); if (!skb) goto out; size =3D skb->len; @@ -1096,7 +1097,7 @@ int wl12xx_cmd_build_klv_null_data(struct wl1271 *wl, struct sk_buff *skb =3D NULL; int ret =3D -ENOMEM; =20 - skb =3D ieee80211_nullfunc_get(wl->hw, vif); + skb =3D ieee80211_nullfunc_get(wl->hw, vif, false); if (!skb) goto out; =20 diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 885690fa39c8..4f1d2dec43ce 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -4470,18 +4470,24 @@ struct sk_buff *ieee80211_pspoll_get(struct ieee802= 11_hw *hw, * ieee80211_nullfunc_get - retrieve a nullfunc template * @hw: pointer obtained from ieee80211_alloc_hw(). * @vif: &struct ieee80211_vif pointer from the add_interface callback. + * @qos_ok: QoS NDP is acceptable to the caller, this should be set + * if at all possible * * Creates a Nullfunc template which can, for example, uploaded to * hardware. The template must be updated after association so that correc= t * BSSID and address is used. * + * If @qos_ndp is set and the association is to an AP with QoS/WMM, the + * returned packet will be QoS NDP. + * * Note: Caller (or hardware) is responsible for setting the * &IEEE80211_FCTL_PM bit as well as Duration and Sequence Control fields. * * Return: The nullfunc template. %NULL on error. */ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw, - struct ieee80211_vif *vif); + struct ieee80211_vif *vif, + bool qos_ok); =20 /** * ieee80211_probereq_get - retrieve a Probe Request template diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 3b8e2709d8de..9115cc52ce83 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -908,7 +908,7 @@ void ieee80211_send_nullfunc(struct ieee80211_local *lo= cal, struct ieee80211_hdr_3addr *nullfunc; struct ieee80211_if_managed *ifmgd =3D &sdata->u.mgd; =20 - skb =3D ieee80211_nullfunc_get(&local->hw, &sdata->vif); + skb =3D ieee80211_nullfunc_get(&local->hw, &sdata->vif, true); if (!skb) return; =20 diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 94826680cf2b..73429841f115 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -4404,13 +4404,15 @@ struct sk_buff *ieee80211_pspoll_get(struct ieee802= 11_hw *hw, EXPORT_SYMBOL(ieee80211_pspoll_get); =20 struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) + struct ieee80211_vif *vif, + bool qos_ok) { struct ieee80211_hdr_3addr *nullfunc; struct ieee80211_sub_if_data *sdata; struct ieee80211_if_managed *ifmgd; struct ieee80211_local *local; struct sk_buff *skb; + bool qos =3D false; =20 if (WARN_ON(vif->type !=3D NL80211_IFTYPE_STATION)) return NULL; @@ -4419,7 +4421,17 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80= 211_hw *hw, ifmgd =3D &sdata->u.mgd; local =3D sdata->local; =20 - skb =3D dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*nullfunc)); + if (qos_ok) { + struct sta_info *sta; + + rcu_read_lock(); + sta =3D sta_info_get(sdata, ifmgd->bssid); + qos =3D sta && sta->sta.wme; + rcu_read_unlock(); + } + + skb =3D dev_alloc_skb(local->hw.extra_tx_headroom + + sizeof(*nullfunc) + 2); if (!skb) return NULL; =20 @@ -4429,6 +4441,19 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80= 211_hw *hw, nullfunc->frame_control =3D cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS); + if (qos) { + __le16 qos =3D cpu_to_le16(7); + + BUILD_BUG_ON((IEEE80211_STYPE_QOS_NULLFUNC | + IEEE80211_STYPE_NULLFUNC) !=3D + IEEE80211_STYPE_QOS_NULLFUNC); + nullfunc->frame_control |=3D + cpu_to_le16(IEEE80211_STYPE_QOS_NULLFUNC); + skb->priority =3D 7; + skb_set_queue_mapping(skb, IEEE80211_AC_VO); + skb_put_data(skb, &qos, sizeof(qos)); + } + memcpy(nullfunc->addr1, ifmgd->bssid, ETH_ALEN); memcpy(nullfunc->addr2, vif->addr, ETH_ALEN); memcpy(nullfunc->addr3, ifmgd->bssid, ETH_ALEN); --=20 2.11.0