From patchwork Tue Oct 16 18:41:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamizh chelvam X-Patchwork-Id: 10644139 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 458AF157A for ; Tue, 16 Oct 2018 18:43:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 353E5288F1 for ; Tue, 16 Oct 2018 18:43:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28FE028911; Tue, 16 Oct 2018 18:43:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 82E2D288F1 for ; Tue, 16 Oct 2018 18:43:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Q71XKdcEIknuoKl6crU7716HQYqofc8AKMbbhckyW4g=; b=oo3W87KBUOjLBZQtae8RTrbxzW NWJQGFSolOfFJ9BuejAH+jNon0VJ3d6RKJta3iF7yYd0EX2xrj6fEJsiYzRAx7kUCtfZHNfozHEC6 3Dj+O+mGD+WJu8iqzTcm5tZPS1csSpmYLfA7IC7mM4tlyZGruxYr5N/zQmjLULTtKkRLCk/cN4b56 S07y9V+waebTSI/u+HW5FjBmepyID5m8KzhHBcTgQ2v+klhaQUiTuc5U1r4aqZ0Hu9dhJJrSJKUd3 C6+M6ji8yBiZXD5TCJSCZSErp5PnNJJPTPsbMUOcxyuezX3WSiujRSMDROOLkZWVJyP5AZvru20t4 1Cyw3hrA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gCUJE-0000vZ-Hw; Tue, 16 Oct 2018 18:43:12 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gCUJ5-0000rg-09 for ath10k@lists.infradead.org; Tue, 16 Oct 2018 18:43:05 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 057C561320; Tue, 16 Oct 2018 18:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539715379; bh=VwOuUUTs5I4FpiQqbOm4qFTSAjMsp8Mb9KuaWdZYemk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cDVd4EjFFneJR7BIpaoEWiLok3sgimYtowx0K4MOwXTDDvkVokd4/1yLLALWEVfgN 03Wt28lptOfNz3pTE+QOSO4RgRDn6auhgtAkjNa4Wz/MN/wQdhUrZYtH7DYYivplhn erwCPDdjPqbubD0v4JH2dMIXcljGzK+/OPJwTpWU= Received: from cheath10p342229-lin.qca.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tamizhr@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 2B039612F6; Tue, 16 Oct 2018 18:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539715377; bh=VwOuUUTs5I4FpiQqbOm4qFTSAjMsp8Mb9KuaWdZYemk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jbRdMY+89Qw72oin9Wlu9gmEIeASUQrxMuYNgMPV3bcYM9PM8A+ZPXzj0/pwvbIix 6p3bUSzlK4s3plpbLvv2UYtGQb5raoBpJBsSyvGfzJKtL2q+f76NjcZPDglNZjfZPs OcICOyxi8Lp3Fw/YQjdkKwXq36uhZ1VzW/Je7ovY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2B039612F6 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=tamizhr@codeaurora.org From: Tamizh chelvam To: ath10k@lists.infradead.org, johannes@sipsolutions.net Subject: [PATCH 3/6] mac80211: Apply per-peer NoAck tid bitmap configuration Date: Wed, 17 Oct 2018 00:11:08 +0530 Message-Id: <1539715271-14325-4-git-send-email-tamizhr@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1539715271-14325-1-git-send-email-tamizhr@codeaurora.org> References: <1539715271-14325-1-git-send-email-tamizhr@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181016_114303_112568_1C681A14 X-CRM114-Status: GOOD ( 19.39 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vasanthakumar Thiagarajan , linux-wireless@vger.kernel.org, Tamizh chelvam MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Vasanthakumar Thiagarajan Use per-peer NoAck tid bitmap, if it is configured, when setting up the qos header. If the NoAck tid bitmap is default (-1) for a peer, use the netdev wide noack policy configuration. The NoAck tid bitmap for newly connected stations is set to default (-1). Also modifies callback set_noack_tid_bitmap() with the provision to send per-peer NoAck policy configuration to the drivers. Signed-off-by: Vasanthakumar Thiagarajan Signed-off-by: Tamizh chelvam --- include/net/mac80211.h | 14 ++++++++++---- net/mac80211/cfg.c | 43 ++++++++++++++++++++++++++++++++++++++----- net/mac80211/driver-ops.h | 3 ++- net/mac80211/iface.c | 2 +- net/mac80211/sta_info.c | 2 ++ net/mac80211/sta_info.h | 3 +++ net/mac80211/tx.c | 4 +++- net/mac80211/wme.c | 34 +++++++++++++++++++++++++++++++++- 8 files changed, 92 insertions(+), 13 deletions(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 5ce7ce7..b6cc3e33 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -3624,9 +3624,14 @@ enum ieee80211_reconfig_type { * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available. * Statistics should be cumulative, currently no way to reset is provided. * - * @set_noack_tid_bitmap: Set NoAck policy TID bitmap for a virtual interface. - * Drivers mplementing this callback must take care of setting NoAck policy - * in QOS control field based on the configured TID bitmap. + * @set_noack_tid_bitmap: Set NoAck policy TID bitmap. Apply the TID NoAck + * configuration for a particular station when @sta is non-NULL. NoAck + * policy is set to default for a peer when noack_map is -1 for the peer. + * The default NoAck policy for a peer is using netdev NoAck policy. + * When @sta is NULL, apply TID NoAck configuration at virtual interface + * level. Drivers mplementing this callback must take care of setting NoAck + * policy in QOS control field based on the configured TID bitmap. + * This callback may sleep. */ struct ieee80211_ops { void (*tx)(struct ieee80211_hw *hw, @@ -3917,7 +3922,8 @@ struct ieee80211_ops { struct cfg80211_ftm_responder_stats *ftm_stats); int (*set_noack_tid_bitmap)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, int noack_map); + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, int noack_map); }; /** diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 7a7e423..02e6d49 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -344,18 +344,51 @@ static int ieee80211_set_noack_map(struct wiphy *wiphy, int noack_map) { struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); + struct sta_info *sta; + int ret; - sdata->noack_map = noack_map; + if (!peer) { + sdata->noack_map = noack_map; - if (!sdata->local->ops->set_noack_tid_bitmap) { - ieee80211_check_fast_xmit_iface(sdata); - return 0; + if (!sdata->local->ops->set_noack_tid_bitmap) { + ieee80211_check_fast_xmit_iface(sdata); + return 0; + } + + if (!ieee80211_sdata_running(sdata)) + return 0; + + return drv_set_noack_tid_bitmap(sdata->local, sdata, NULL, + noack_map); } + /* NoAck policy is for a connected client on the dev */ + if (!ieee80211_sdata_running(sdata)) + return -ENETDOWN; + + mutex_lock(&sdata->local->sta_mtx); + + sta = sta_info_get_bss(sdata, peer); + if (!sta) { + mutex_unlock(&sdata->local->sta_mtx); + return -ENOENT; + } + + sta->noack_map = noack_map; + + if (!sdata->local->ops->set_noack_tid_bitmap) { + ieee80211_check_fast_xmit(sta); + mutex_unlock(&sdata->local->sta_mtx); return 0; + } + + ret = drv_set_noack_tid_bitmap(sdata->local, sdata, + &sta->sta, noack_map); - return drv_set_noack_tid_bitmap(sdata->local, sdata, noack_map); + mutex_unlock(&sdata->local->sta_mtx); + + return ret; } static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index d705938..ed9bd59 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h @@ -1280,6 +1280,7 @@ static inline void drv_del_nan_func(struct ieee80211_local *local, static inline int drv_set_noack_tid_bitmap(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata, + struct ieee80211_sta *sta, int noack_map) { int ret; @@ -1293,7 +1294,7 @@ static inline int drv_set_noack_tid_bitmap(struct ieee80211_local *local, trace_drv_set_noack_tid_bitmap(local, sdata, noack_map); ret = local->ops->set_noack_tid_bitmap(&local->hw, &sdata->vif, - noack_map); + sta, noack_map); trace_drv_return_int(local, ret); return ret; diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 06106f2..4999977 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -635,7 +635,7 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) goto err_del_interface; if (sdata->noack_map) - drv_set_noack_tid_bitmap(local, sdata, + drv_set_noack_tid_bitmap(local, sdata, NULL, sdata->noack_map); } diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index fb8c225..d2ea8ee 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -606,6 +606,8 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU) cfg80211_new_sta(sdata->dev, sta->sta.addr, sinfo, GFP_KERNEL); kfree(sinfo); + sta->noack_map = -1; + sta_dbg(sdata, "Inserted STA %pM\n", sta->sta.addr); /* move reference to rcu-protected */ diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index 9a04327..863601a 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h @@ -583,6 +583,9 @@ struct sta_info { struct cfg80211_chan_def tdls_chandef; + /* TID bitmap for station's NoAck policy */ + int noack_map; + /* keep last! */ struct ieee80211_sta sta; }; diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index d744c4b..b57cd1f 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2872,7 +2872,9 @@ void ieee80211_check_fast_xmit(struct sta_info *sta) test_sta_flag(sta, WLAN_STA_CLEAR_PS_FILT)) goto out; - if (sdata->noack_map && !local->ops->set_noack_tid_bitmap) + if (((sta->noack_map == -1 && sdata->noack_map) || + (sta->noack_map != -1 && sta->noack_map)) && + !local->ops->set_noack_tid_bitmap) goto out; /* fast-xmit doesn't handle fragmentation at all */ diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c index 11c14b9..b1722b8 100644 --- a/net/mac80211/wme.c +++ b/net/mac80211/wme.c @@ -227,6 +227,38 @@ u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, } /** + * ieee80211_get_noack_map - Get TID bitmap of NoAck policy. NoAck policy + * could be device wide or per-station. + * + * @sdata: local subif + * @mac: MAC address of the receiver + */ +int ieee80211_get_noack_map(struct ieee80211_sub_if_data *sdata, const u8 *mac) +{ + struct sta_info *sta; + int noack_map = 0; + + /* Retrieve per-station noack_map config for the receiver, if any */ + + rcu_read_lock(); + + sta = sta_info_get(sdata, mac); + if (!sta) { + rcu_read_unlock(); + return noack_map; + } + + noack_map = sta->noack_map; + + rcu_read_unlock(); + + if (noack_map == -1) + noack_map = sdata->noack_map; + + return noack_map; +} + +/** * ieee80211_set_qos_hdr - Fill in the QoS header if there is one. * * @sdata: local subif @@ -257,7 +289,7 @@ void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, if (is_multicast_ether_addr(hdr->addr1) || (!sdata->local->ops->set_noack_tid_bitmap && - sdata->noack_map & BIT(tid))) { + ieee80211_get_noack_map(sdata, hdr->addr1) & BIT(tid))) { flags |= IEEE80211_QOS_CTL_ACK_POLICY_NOACK; info->flags |= IEEE80211_TX_CTL_NO_ACK; }