Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2189505rwd; Thu, 15 Jun 2023 23:56:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7OUilQS2Vs7trRIpYMkdlfJsFRrrnrwWtqPL0fOx1OgAY0xAuDF6F5laszHaonBOvJO1wp X-Received: by 2002:a05:6808:1896:b0:398:5a28:d80c with SMTP id bi22-20020a056808189600b003985a28d80cmr1633503oib.18.1686898588157; Thu, 15 Jun 2023 23:56:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686898588; cv=none; d=google.com; s=arc-20160816; b=DCj2Z/7N4UVdYF5zDsj9juwdmOfvSwqD0szmgzjXiSrV5UhFlO4sWfWbvzAuZ7aj5L WW8j2ObtubIVs15Z7SLnsJHbrgD98FrcZ1oVeJobp/ygOpjbqB+z4b6kAeEG7cc23RzZ f3ViRZOc8nVN1DnRnBadqse+odZoSVSkikTfR1VWVCDUychvp8SNwbBh1vC80l6Wm1Ue FPg/5sr+R8rGmBZfOkI51p+j2dbHVGJI6ZA6nyCyBlpt94VD2opFaLuEWUew0JRO7kUf dwFA/TB6MQm7RD8U176CF4F4c8b/CS6HEGVWZ/kYFpCWiBmrqYbCl3Lqn7pKtqrX8EOU 6tng== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VHlm4F+rUkidYLrS/PVnL8UOwOu2j08g4uB1z/7v8LM=; b=aGidZmHrVDzVHLia3OHt8u54cETBKIs+iKmI47GoEqNDDHDu1d0YuE8ghYz/e3Aloi Ts52S7AC/ltz4Z9kj309iVqc9nm93nK9TRutx3c8L2gAtbamn5rG4mZtAR8GOnbeTkfy 5LHdhcksraINJL0PXBl5Emke6SMlRY+V4eMVTu/LAUNZ6Q422pUqKBvKEhiux9hVWxk0 dOUJEj78GtJTkO2i/ZvqeOVtf1nhnYkTvfj239h5WEH8K1ZnQlXxAC9hucjigBuLuLb2 uhLZJiOWNgYaqjOOJID0hgUQL/Ec3M4rcLoirhHCm/6OIJ8idwTfMiRShKNry/jizGC5 Jd6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="FgvF/vtM"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds19-20020a17090b08d300b0025bb9fc0fa1si990510pjb.83.2023.06.15.23.56.21; Thu, 15 Jun 2023 23:56:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="FgvF/vtM"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240269AbjFPGyh (ORCPT + 61 others); Fri, 16 Jun 2023 02:54:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242498AbjFPGye (ORCPT ); Fri, 16 Jun 2023 02:54:34 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1B501FE8 for ; Thu, 15 Jun 2023 23:54:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686898472; x=1718434472; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3PFomWAGrjdI6BtMMsExASXRKirLoxCyJK5u0Kx6Mj8=; b=FgvF/vtMILdDCpFVKm0/XEja/I/FCmWIsMcdNJ13kvtUnUizCcwJp5/t B6qQtUs5xxDJMdrZ7Fl9PORnSPp8kZu6/oL9YAo326Ow1Gb5GTfq4c1FI Nnw0iuRYZpdbu4tcHr0xaYN8zxpRMtYxe9NPxlEMWNfzEvnJGi4UuuybA lw1VhaR6uZSP+FD2hrYZ/gqLs4lbYTJWo74k4fJSHOJ+4l3OvOzhVFurW 6HX2HH1jLYbq2JA64/91MCnfqxSWibiZ6bAM5CCGcNN5D/5K1L5ZmO9FX GRkjB7Yd57iH579yQrsCS67wwORZCQ48MNYUb4vfJKc4UDr476dihD8KQ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="425078796" X-IronPort-AV: E=Sophos;i="6.00,246,1681196400"; d="scan'208";a="425078796" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2023 23:54:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="802719992" X-IronPort-AV: E=Sophos;i="6.00,246,1681196400"; d="scan'208";a="802719992" Received: from ereznaim-mobl.ger.corp.intel.com (HELO ggreenma-mobl2.intel.com) ([10.214.237.118]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2023 23:54:29 -0700 From: gregory.greenman@intel.com To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Abhishek Naik , Mukesh Sisodiya , Gregory Greenman Subject: [PATCH 03/20] wifi: mac80211: handle TDLS data frames with MLO Date: Fri, 16 Jun 2023 09:53:52 +0300 Message-Id: <20230616094948.4bf648b63dfd.I98ef1dabd14b74a92120750f7746a7a512011701@changeid> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230616065409.633290-1-gregory.greenman@intel.com> References: <20230616065409.633290-1-gregory.greenman@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Abhishek Naik If the device is associated with an AP MLD, then TDLS data frames should have - A1 = peer address, - A2 = own MLD address (since the peer may now know about MLO), and - A3 = BSSID. Change the code to do that. Signed-off-by: Abhishek Naik Signed-off-by: Mukesh Sisodiya Signed-off-by: Gregory Greenman --- net/mac80211/tx.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index d8460a14b6bd..b5183f6365aa 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2753,10 +2753,20 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, tdls_peer = test_sta_flag(sta, WLAN_STA_TDLS_PEER); if (tdls_peer) { + /* For TDLS only one link can be valid with peer STA */ + int tdls_link_id = sta->sta.valid_links ? + __ffs(sta->sta.valid_links) : 0; + struct ieee80211_link_data *link; + /* DA SA BSSID */ memcpy(hdr.addr1, skb->data, ETH_ALEN); memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); - memcpy(hdr.addr3, sdata->deflink.u.mgd.bssid, ETH_ALEN); + link = rcu_dereference(sdata->link[tdls_link_id]); + if (WARN_ON_ONCE(!link)) { + ret = -EINVAL; + goto free; + } + memcpy(hdr.addr3, link->u.mgd.bssid, ETH_ALEN); hdrlen = 24; } else if (sdata->u.mgd.use_4addr && cpu_to_be16(ethertype) != sdata->control_port_protocol) { @@ -3066,10 +3076,18 @@ void ieee80211_check_fast_xmit(struct sta_info *sta) break; case NL80211_IFTYPE_STATION: if (test_sta_flag(sta, WLAN_STA_TDLS_PEER)) { + /* For TDLS only one link can be valid with peer STA */ + int tdls_link_id = sta->sta.valid_links ? + __ffs(sta->sta.valid_links) : 0; + struct ieee80211_link_data *link; + /* DA SA BSSID */ build.da_offs = offsetof(struct ieee80211_hdr, addr1); build.sa_offs = offsetof(struct ieee80211_hdr, addr2); - memcpy(hdr->addr3, sdata->deflink.u.mgd.bssid, ETH_ALEN); + link = rcu_dereference(sdata->link[tdls_link_id]); + if (WARN_ON_ONCE(!link)) + break; + memcpy(hdr->addr3, link->u.mgd.bssid, ETH_ALEN); build.hdr_len = 24; break; } -- 2.38.1