Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3029101rdg; Tue, 17 Oct 2023 02:17:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHftKVacLeeb+MaXY7mHRBMJmx5cbayWMUuqQyu7T6xr8DotM/WW/86i+3rlqcx9o8YNuZo X-Received: by 2002:a05:6a00:1806:b0:693:4a43:1c7e with SMTP id y6-20020a056a00180600b006934a431c7emr1855807pfa.29.1697534235961; Tue, 17 Oct 2023 02:17:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697534235; cv=none; d=google.com; s=arc-20160816; b=ioPxdVTBNKarqskWt7D8DEg6Yiz1GBvPgc/P4fAOyIe3X15ULBnYZbXq+hsP+b7kdt cDy9oPEV6Z5zPmb55obNVLr+Joz1xNPsW0nUFiPUOPVfVfOY3N1IWNpVKFDK0UYS+iMm d0lGtASZgU7aNLNIGyxYLAG6fHPsd8g0RxCxQ4Q+m/fwE9mWpP48PgW+Bb/xbfbQhOsH IRztyFydeO3hIeey9o/eH/3DAl2NEGfCLVH0F5MFeizX4ViVYJklnp5RCZFasMK4T9rR 6eZ9KZ1UJ5CEXwUutbgRJE1SeyXzw9IRgNLNWBwwXUcdi1dUr6KhALy06bUNhtbBv9CF 1hmg== 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=ewqf499vJOKPTXCSFD3+VcD1SseOqazroPUCSTXJvO8=; fh=v78ykjHCzCVwxZtbRdthmW7wH6NM9QbVMtLidpf/uiI=; b=ApLTRW1Zjer4/iCiqG6svIwa45m/rkeMtg5BedkARIuK+kLzrNBpmlNfB8H37laA0H pUqNmTR/R71ansdAUjtdm7JCK4GNwPtOxTcBQ0iv1kiPvdZlwXDs9kZphUl0mk0ZQeCU 75qVPVU8i+60cvE8bQd/LSR7ZPBS/0GMNuH6bazT8/nKHUJrb2Zym3w4GbQ6TlSTOLR7 GsOtlwysoSw/pPYIVuJTsVs8OuVPxNFMsP8eisUdmUTJgorfR3HLFDW107xY0Jgy/gjR 9K8B0fldcIfncbod66LGagN+Xqt8RWbB7KpN/IwjK//+Mbp7rXIBNKL6WvQHnUHbdCIK Nv7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Z7ZZIfWr; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id y15-20020a056a00180f00b006b28fa70b3bsi1266494pfa.86.2023.10.17.02.17.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 02:17:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Z7ZZIfWr; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 0B7F3802887D; Tue, 17 Oct 2023 02:17:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234818AbjJQJRN (ORCPT + 52 others); Tue, 17 Oct 2023 05:17:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234758AbjJQJRL (ORCPT ); Tue, 17 Oct 2023 05:17:11 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E9278E for ; Tue, 17 Oct 2023 02:17:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697534229; x=1729070229; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zcgaChS2RJW0S41BN0yayNv3HBAdsyCdKoOWRSO2ARA=; b=Z7ZZIfWrsxtOpzkjMzCmkaI7tDi17YawgwZWTeIeus4kKLU0jd7b2i0Z ClfnJq6tL9/orXYfWdl55Dz4atTzSarNYSmpdMQuFck0xGiKRYfNRjVJE GgqpMd46Vi+qpzJsIfG6wYesVfFzzxUWOgbwGgbvSWcfolvrnzjEW0FVk u2X63IBKOHcVVr2RlFYyryY1Q7Izj9GRQcohfJEnyi/6QcFXcvhd8OmAE n5uJyh83dT5qxerzUPNH0396HfdWqk4o4fXx+66KBS+xrJNdWXByt9JEu B44egpYWuz1St8LQ/eAHj6StSraPLSpTX0NiBBgAdjxXpFAgAJD+kR4kx w==; X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="370808521" X-IronPort-AV: E=Sophos;i="6.03,231,1694761200"; d="scan'208";a="370808521" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2023 02:17:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="759731825" X-IronPort-AV: E=Sophos;i="6.03,231,1694761200"; d="scan'208";a="759731825" Received: from obarinsh-mobl1.ger.corp.intel.com (HELO ggreenma-mobl2.intel.com) ([10.214.213.101]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2023 02:17:07 -0700 From: gregory.greenman@intel.com To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Miri Korenblit , Gregory Greenman Subject: [PATCH 03/14] wifi: iwlwifi: support link id in SESSION_PROTECTION_NOTIF Date: Tue, 17 Oct 2023 12:16:38 +0300 Message-Id: <20231017115047.4c59b149086e.I74fe93a6337f4ec9d1bd6f791d315411ac5b40da@changeid> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231017091649.65090-1-gregory.greenman@intel.com> References: <20231017091649.65090-1-gregory.greenman@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 17 Oct 2023 02:17:15 -0700 (PDT) From: Miri Korenblit FW is introducing an API change in which link ID will be used for session protection notif. Add support for it. Signed-off-by: Miri Korenblit Signed-off-by: Gregory Greenman --- .../intel/iwlwifi/fw/api/time-event.h | 10 ++++--- .../wireless/intel/iwlwifi/mvm/time-event.c | 27 +++++++++++++++++-- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/time-event.h b/drivers/net/wireless/intel/iwlwifi/fw/api/time-event.h index 701b2929c3a4..2e15be71c957 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/api/time-event.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/api/time-event.h @@ -461,7 +461,8 @@ struct iwl_mvm_session_prot_cmd { /** * struct iwl_mvm_session_prot_notif - session protection started / ended - * @mac_id: the mac id for which the session protection started / ended + * @mac_link_id: the mac id (or link id, for notif ver > 2) for which the + * session protection started / ended * @status: 1 means success, 0 means failure * @start: 1 means the session protection started, 0 means it ended * @conf_id: see &enum iwl_mvm_session_prot_conf_id @@ -470,10 +471,13 @@ struct iwl_mvm_session_prot_cmd { * and end even the firmware could not schedule it. */ struct iwl_mvm_session_prot_notif { - __le32 mac_id; + __le32 mac_link_id; __le32 status; __le32 start; __le32 conf_id; -} __packed; /* SESSION_PROTECTION_NOTIFICATION_API_S_VER_2 */ +} __packed; +/* SESSION_PROTECTION_NOTIFICATION_API_S_VER_2 and + * SESSION_PROTECTION_NOTIFICATION_API_S_VER_3 + */ #endif /* __iwl_fw_api_time_event_h__ */ diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c index ecbebef80791..218fdf1ed530 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c @@ -898,18 +898,41 @@ void iwl_mvm_rx_session_protect_notif(struct iwl_mvm *mvm, { struct iwl_rx_packet *pkt = rxb_addr(rxb); struct iwl_mvm_session_prot_notif *notif = (void *)pkt->data; + unsigned int ver = + iwl_fw_lookup_cmd_ver(mvm->fw, + WIDE_ID(MAC_CONF_GROUP, + SESSION_PROTECTION_CMD), 2); + int id = le32_to_cpu(notif->mac_link_id); struct ieee80211_vif *vif; struct iwl_mvm_vif *mvmvif; + unsigned int notif_link_id; rcu_read_lock(); - vif = iwl_mvm_rcu_dereference_vif_id(mvm, le32_to_cpu(notif->mac_id), - true); + + if (ver <= 2) { + vif = iwl_mvm_rcu_dereference_vif_id(mvm, id, true); + } else { + struct ieee80211_bss_conf *link_conf = + iwl_mvm_rcu_fw_link_id_to_link_conf(mvm, id, true); + + if (!link_conf) + goto out_unlock; + + notif_link_id = link_conf->link_id; + vif = link_conf->vif; + } if (!vif) goto out_unlock; mvmvif = iwl_mvm_vif_from_mac80211(vif); + if (WARN(ver > 2 && mvmvif->time_event_data.link_id >= 0 && + mvmvif->time_event_data.link_id != notif_link_id, + "SESION_PROTECTION_NOTIF was received for link %u, while the current time event is on link %u\n", + notif_link_id, mvmvif->time_event_data.link_id)) + goto out_unlock; + /* The vif is not a P2P_DEVICE, maintain its time_event_data */ if (vif->type != NL80211_IFTYPE_P2P_DEVICE) { struct iwl_mvm_time_event_data *te_data = -- 2.38.1