Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4344535pxu; Wed, 9 Dec 2020 14:53:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJz4BHZobmcda3DR75QC0Bqozk1FAbZvZqKlLTdxx75Cv7JkrIKZVHC2BC1MFvT23MHwP/nJ X-Received: by 2002:a17:906:cc8c:: with SMTP id oq12mr4074842ejb.419.1607554429710; Wed, 09 Dec 2020 14:53:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607554429; cv=none; d=google.com; s=arc-20160816; b=XvXYmOYBmsQHgWtznTGHzF8SjHQImzuwQFCt2t+n8Ykuvdf+NanBbSubJZ5c2jgHCe 9ZFeoG6PNsL19U1xxMBRsUPB7iUvgYcbjAdi8YN0ldS2PfIat6GeiMYUp/RomzaPaART 9xGbI6l65Vv64hzqT8qcY9M89cpF8i0fvJtmZMbrodo6H/JGLr1aDQ+cvBKxTuXbbFVh UlDq1ZtqU3rAtppEQYgKsRvuOJR/hlcPboySgqJoqIKKgPUE6xA7DM6Hyb5Glc5YAIZQ XPdi1GLNmGda7bc2HydSlEDc790PfyLsX7o/fzDrzJI5ddaqSdqU6vUEJkm+U3DqCewl 3tpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=rksPQRcR/oh3H7VxFy4NqEiIp7+nCqAsUzHDe7fsv4Y=; b=zKiyar3DY3RD7nYG7Tvbw/d0zi1o/R0Vusm3hceFj1H3RFwwESxWdj2YkpCTACbE+N Xzx3vwFz2py+P987Cxs9OcMgo7hZe9lbtmIbXDYwvjLl1VWdJGSrjYzYH6sv5LADkfiT lWYtWkHWWTPz1QRU0VkOeUrPTEwc8MrY8lE+4bO7M6QfZXfDzudCSINhjQhewLOOBmNQ vPlQZfDWuqzC1Zy15z92eTxYDNDmdbwp9VFlZnX/M3Vfok8ePMHD1y73Nx/0d1rRmrIT dapByNyV3TctsA1KZh5MVml/QFqpp5+BAoIEimM9oWkMumj9I15RCoTV/KlughHkPoGp Zhmg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id zn8si1497148ejb.16.2020.12.09.14.53.18; Wed, 09 Dec 2020 14:53:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388349AbgLIWxI (ORCPT + 99 others); Wed, 9 Dec 2020 17:53:08 -0500 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]:60223 "EHLO smail.rz.tu-ilmenau.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725965AbgLIWxI (ORCPT ); Wed, 9 Dec 2020 17:53:08 -0500 Received: from legolas.fritz.box (unknown [93.209.11.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smail.rz.tu-ilmenau.de (Postfix) with ESMTPSA id DE94B58006C; Wed, 9 Dec 2020 23:52:24 +0100 (CET) From: Markus Theil To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Markus Theil Subject: [PATCH] mac80211: enable QoS support for nl80211 ctrl port Date: Wed, 9 Dec 2020 23:52:14 +0100 Message-Id: <20201209225214.127548-1-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This patch unifies sending control port frames over nl80211 and AF_PACKET sockets a little more. Before this patch, EAPOL frames got QoS prioritization only when using AF_PACKET sockets. __ieee80211_select_queue only selects a QoS-enabled queue for control port frames, when the control port protocol is set correctly on the skb. For the AF_PACKET path this works, but the nl80211 path used ETH_P_802_3. Another check for injected frames in wme.c then prevented the QoS TID to be copied in the frame. In order to fix this, get rid of the frame injection marking for nl80211 ctrl port and set the correct ethernet protocol. Furthermore, this patch also checks and prevents frame aggregation for control port frames in order to speed up the initial connection setup a little. Signed-off-by: Markus Theil --- net/mac80211/status.c | 8 ++------ net/mac80211/tx.c | 15 +++++++-------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/net/mac80211/status.c b/net/mac80211/status.c index 6feb45135..265c1d13b 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c @@ -627,16 +627,12 @@ static void ieee80211_report_ack_skb(struct ieee80211_local *local, u64 cookie = IEEE80211_SKB_CB(skb)->ack.cookie; struct ieee80211_sub_if_data *sdata; struct ieee80211_hdr *hdr = (void *)skb->data; - __be16 ethertype = 0; - - if (skb->len >= ETH_HLEN && skb->protocol == cpu_to_be16(ETH_P_802_3)) - skb_copy_bits(skb, 2 * ETH_ALEN, ðertype, ETH_TLEN); rcu_read_lock(); sdata = ieee80211_sdata_from_skb(local, skb); if (sdata) { - if (ethertype == sdata->control_port_protocol || - ethertype == cpu_to_be16(ETH_P_PREAUTH)) + if (skb->protocol == sdata->control_port_protocol || + skb->protocol == cpu_to_be16(ETH_P_PREAUTH)) cfg80211_control_port_tx_status(&sdata->wdev, cookie, skb->data, diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 01eb08527..4dae5aa7f 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -1192,9 +1192,7 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, tx->sta = rcu_dereference(sdata->u.vlan.sta); if (!tx->sta && sdata->wdev.use_4addr) return TX_DROP; - } else if (info->flags & (IEEE80211_TX_INTFL_NL80211_FRAME_TX | - IEEE80211_TX_CTL_INJECTED) || - tx->sdata->control_port_protocol == tx->skb->protocol) { + } else if (tx->sdata->control_port_protocol == tx->skb->protocol) { tx->sta = sta_info_get_bss(sdata, hdr->addr1); } if (!tx->sta && !is_multicast_ether_addr(hdr->addr1)) @@ -1204,7 +1202,8 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) && !ieee80211_is_qos_nullfunc(hdr->frame_control) && ieee80211_hw_check(&local->hw, AMPDU_AGGREGATION) && - !ieee80211_hw_check(&local->hw, TX_AMPDU_SETUP_IN_HW)) { + !ieee80211_hw_check(&local->hw, TX_AMPDU_SETUP_IN_HW) && + !info->flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO) { struct tid_ampdu_tx *tid_tx; tid = ieee80211_get_tid(hdr); @@ -3944,7 +3943,8 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb, if (IS_ERR(sta)) sta = NULL; - if (local->ops->wake_tx_queue) { + if (local->ops->wake_tx_queue || + skb->protocol == sdata->control_port_protocol) { u16 queue = __ieee80211_select_queue(sdata, sta, skb); skb_set_queue_mapping(skb, queue); skb_get_hash(skb); @@ -5440,8 +5440,7 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, if (cookie) ctrl_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; - flags |= IEEE80211_TX_INTFL_NL80211_FRAME_TX | - IEEE80211_TX_CTL_INJECTED; + flags |= IEEE80211_TX_INTFL_NL80211_FRAME_TX; skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(struct ethhdr) + len); @@ -5458,7 +5457,7 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, ehdr->h_proto = proto; skb->dev = dev; - skb->protocol = htons(ETH_P_802_3); + skb->protocol = proto; skb_reset_network_header(skb); skb_reset_mac_header(skb); -- 2.29.2