Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4062557pxk; Tue, 8 Sep 2020 09:42:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVZB+ybQL8N2SDsbS/aF4+vvagxAbvLdmszmb1Z9VvMqpPlWGXedtpEHLRwdMPB+vSNK9L X-Received: by 2002:a05:6402:1495:: with SMTP id e21mr27059413edv.146.1599583374717; Tue, 08 Sep 2020 09:42:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599583374; cv=none; d=google.com; s=arc-20160816; b=l+HOvDxi9YO1D2KpGDQW2zegfNHleLVMVQqZqtldT9T9LMOkhQfGncdtJ/XTmk9+Fy uUOU1TnHTJx4kdZaWWRG3jNCuxR/H1bbvGykS+glpJzmhQafSgOrSuMKxYngKKuXiHwv +uLdXGa6MfSmSYX6Ir8sHy+7Y377s68etsMXnyugBT6BWW3x52bZohVuG7Jcrx4CExDf ji81vojfK6nR1iFnzkokCM2rqK6gON8tWhEnY0aiB+MgugllNMjSS+EzG9pDTS5zY0dr GOcwZxR1vedFfULMBPwa0GuFRJUMd7t7jRoVqzBvBkVlqm+Y8PJanhL+4iy0mnidO3Is RyGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Wxsv0LEp/2aNJWkKjc5zUFC8SJ3fPD68bRujlxBeC3s=; b=CxlavA/84CE+wgExpOdEsG7R80gGkdHtLotcgJS1k+YbV6MpCIv6iCtLrYN6jq8mcg zgp+11yLKPb+KRMKEp+MZbBpA2vEJ+k/xWupgQ2+eCGY107zG/2DWS8MJOHnYxf1k+Hw hlHKC34Y/4IaAb79ocnxnqz/suJdWwe7dzXkueXz290KQ6ixvdkF+xatbWVfjB5kohfD kvkciHRjGuQgeSAGzbt0Aljp2AvI1tYrT0NdtKhZakQfpOfiMMEoSpNps/jNqiYGNvzP X5nbne+9B9oVRafhAaVA+77XSrDPk+wJpacq3JI0gMA1lsBnStwy9gsXi6ifcTxauZ5/ 3euA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=iIfdrgcG; 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 e12si12059388ejq.375.2020.09.08.09.42.29; Tue, 08 Sep 2020 09:42:54 -0700 (PDT) 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; dkim=fail header.i=@nbd.name header.s=20160729 header.b=iIfdrgcG; 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 S1731772AbgIHQlB (ORCPT + 99 others); Tue, 8 Sep 2020 12:41:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732020AbgIHQhX (ORCPT ); Tue, 8 Sep 2020 12:37:23 -0400 Received: from nbd.name (nbd.name [IPv6:2a01:4f8:221:3d45::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 492AEC0612ED for ; Tue, 8 Sep 2020 05:55:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Wxsv0LEp/2aNJWkKjc5zUFC8SJ3fPD68bRujlxBeC3s=; b=iIfdrgcGKUeNGcV+ObiZte8h2J DGEZYOJgAOBpFwlzDrtQz5kUUMRhB8N0taavsIJnkZvP77LrKvHSzHDN/w9MUyJpzXQAJOdxUOYoK //wpIqyssl9EOyyhOkItavtz+/G/yZkMFrDSTSGp0FdVZX/9CkCi4wht1MH1KjX8s8YQ=; Received: from p4ff13fcb.dip0.t-ipconnect.de ([79.241.63.203] helo=localhost.localdomain) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.89) (envelope-from ) id 1kFcrz-00050i-3X; Tue, 08 Sep 2020 14:37:07 +0200 From: Felix Fietkau To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net Subject: [PATCH v4 13/14] mac80211: notify the driver when a sta uses 4-address mode Date: Tue, 8 Sep 2020 14:37:01 +0200 Message-Id: <20200908123702.88454-14-nbd@nbd.name> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908123702.88454-1-nbd@nbd.name> References: <20200908123702.88454-1-nbd@nbd.name> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This is needed for encapsulation offload of 4-address mode packets Signed-off-by: Felix Fietkau --- include/net/mac80211.h | 4 ++++ net/mac80211/cfg.c | 1 + net/mac80211/driver-ops.h | 14 ++++++++++++++ net/mac80211/mlme.c | 3 +++ net/mac80211/trace.h | 27 +++++++++++++++++++++++++++ 5 files changed, 49 insertions(+) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 1d1290aca870..05c8049ddd5e 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -3843,6 +3843,8 @@ enum ieee80211_reconfig_type { * This callback may sleep. * @update_vif_config: Update virtual interface offload flags * This callback may sleep. + * @sta_set_4addr: Called to notify the driver when a station starts/stops using + * 4-address mode */ struct ieee80211_ops { void (*tx)(struct ieee80211_hw *hw, @@ -4156,6 +4158,8 @@ struct ieee80211_ops { struct ieee80211_sta *sta, u8 tids); void (*update_vif_offload)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); + void (*sta_set_4addr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct ieee80211_sta *sta, bool enabled); }; /** diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index b4e39e31a985..022caf1c492b 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1696,6 +1696,7 @@ static int ieee80211_change_station(struct wiphy *wiphy, rcu_assign_pointer(vlansdata->u.vlan.sta, sta); __ieee80211_check_fast_rx_iface(vlansdata); + drv_sta_set_4addr(local, sta->sdata, &sta->sta, true); } if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN && diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index e3dfb9307fae..bcdfd19a596b 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h @@ -1399,4 +1399,18 @@ static inline void drv_update_vif_offload(struct ieee80211_local *local, trace_drv_return_void(local); } +static inline void drv_sta_set_4addr(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata, + struct ieee80211_sta *sta, bool enabled) +{ + sdata = get_bss_sdata(sdata); + if (!check_sdata_in_driver(sdata)) + return; + + trace_drv_sta_set_4addr(local, sdata, sta, enabled); + if (local->ops->sta_set_4addr) + local->ops->sta_set_4addr(&local->hw, &sdata->vif, sta, enabled); + trace_drv_return_void(local); +} + #endif /* __MAC80211_DRIVER_OPS */ diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index f241decf843d..50a9b9025725 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -3523,6 +3523,9 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, goto out; } + if (sdata->wdev.use_4addr) + drv_sta_set_4addr(local, sdata, &sta->sta, true); + mutex_unlock(&sdata->local->sta_mtx); /* diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h index 50a0a83e96fc..89723907a094 100644 --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h @@ -2740,6 +2740,33 @@ DEFINE_EVENT(local_sdata_addr_evt, drv_update_vif_offload, TP_ARGS(local, sdata) ); +TRACE_EVENT(drv_sta_set_4addr, + TP_PROTO(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata, + struct ieee80211_sta *sta, bool enabled), + + TP_ARGS(local, sdata, sta, enabled), + + TP_STRUCT__entry( + LOCAL_ENTRY + VIF_ENTRY + STA_ENTRY + __field(bool, enabled) + ), + + TP_fast_assign( + LOCAL_ASSIGN; + VIF_ASSIGN; + STA_ASSIGN; + __entry->enabled = enabled; + ), + + TP_printk( + LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " enabled:%d", + LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->enabled + ) +); + #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ #undef TRACE_INCLUDE_PATH -- 2.28.0