From nobody Mon Dec 27 19:11:51 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E057819270A8; Mon, 27 Dec 2021 19:11:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JN6jP3YZnz3vpJ; Mon, 27 Dec 2021 19:11:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A0C623718; Mon, 27 Dec 2021 19:11:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BRJBpQ0037714; Mon, 27 Dec 2021 19:11:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BRJBpv6037713; Mon, 27 Dec 2021 19:11:51 GMT (envelope-from git) Date: Mon, 27 Dec 2021 19:11:51 GMT Message-Id: <202112271911.1BRJBpv6037713@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 8f06a2b550c6 - main - iwlwifi: cherry-pick fixes from upstream iwlwifi-next List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8f06a2b550c6288b48996036c325a1999780cb6a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640632314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iYJcI1p72Vm1aPxi6R2obRfZ9eLAA4QBaEfCUD81yA8=; b=eCD8G0ZxKDexKBAw7KblVBcf+wegk3CUXO4RldGsNNG5YnmGZniOoE7dUYF4W1Nlom5kqN xhPw9GAj8dp6tZW41KHy3xaaAYUVbMcVtpooZLMv0Ba4oXB7SSiQs+CLqmQzo7nwUeNo9D rYdpA5/C++TLc7qB84n6RUsojLwwh99VMdh/D8yhqoKDorkJWCFTtGzsecFPLMKufzmgHi cH4CTu+zvAptQ1PV2H1noGcJ2zWzBMaqGrWhSfdklaVHDQUsltCy3JtyqM5vQyt1ZhJGpC CTsKa4Eq/vZ2XjBf4DtTW1mZay03AvKD84FmbsznoofvRLNYx3O6w+pwVJQEyw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640632314; a=rsa-sha256; cv=none; b=GTa5S+b5lVrgVbyZ81PXLXt09Kz3GAlvwnAfcuAewPLZzAZqc1XyJOzeD+prjuEVjua4qi 0Rf8rsaYx4BYyPyvoOnRYloUEwB1rGWG6ma1jIL4jHL8P4dDz/oHYXlVauXZQEhabh39IP 7eOZxcgH7CXLYmEMIqRRZu5yiUV2vSv9uJaA3Z/go/55VroMCzVUIbZBR0Vzv+IOxmrTgS 9DZvAkRcSeIAS0lk8IzaUV3vrpEKi/rjBMGmZHXX3HagJCl+NW5JFj1U+3enJClTQwr94l Fnynz9XUFH/cyglKmdAcH66pLeDA73OqkK0Nbo31J4EZNf3tkua+oEQAt3QeFA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=8f06a2b550c6288b48996036c325a1999780cb6a commit 8f06a2b550c6288b48996036c325a1999780cb6a Author: Bjoern A. Zeeb AuthorDate: 2021-12-27 17:41:19 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-12-27 18:47:26 +0000 iwlwifi: cherry-pick fixes from upstream iwlwifi-next Cherry-pick f973795a8d19cbf3d03807704eb7c6ff65788d5a (Fix a double free in iwl_txq_dyn_alloc_dma), db66abeea3aefed481391ecc564fb7b7fb31d742 (synchronize with FW after multicast commands), d5d8ee526d1401173ad1261c3b6388a4f947e0a3 (remove session protection upon station removal), and 8e967c137df3b236d2075f9538cb888129425d1a (avoid clearing a just saved session protection id). Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/contrib/dev/iwlwifi/mvm/mac80211.c | 23 ++++++++++++++++++++--- sys/contrib/dev/iwlwifi/mvm/time-event.c | 12 ++++++------ sys/contrib/dev/iwlwifi/queue/tx.c | 1 + 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/sys/contrib/dev/iwlwifi/mvm/mac80211.c b/sys/contrib/dev/iwlwifi/mvm/mac80211.c index 8aa929207986..cf116404d985 100644 --- a/sys/contrib/dev/iwlwifi/mvm/mac80211.c +++ b/sys/contrib/dev/iwlwifi/mvm/mac80211.c @@ -1674,6 +1674,7 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm) struct iwl_mvm_mc_iter_data iter_data = { .mvm = mvm, }; + int ret; lockdep_assert_held(&mvm->mutex); @@ -1683,6 +1684,22 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm) ieee80211_iterate_active_interfaces_atomic( mvm->hw, IEEE80211_IFACE_ITER_NORMAL, iwl_mvm_mc_iface_iterator, &iter_data); + + /* + * Send a (synchronous) ech command so that we wait for the + * multiple asynchronous MCAST_FILTER_CMD commands sent by + * the interface iterator. Otherwise, we might get here over + * and over again (by userspace just sending a lot of these) + * and the CPU can send them faster than the firmware can + * process them. + * Note that the CPU is still faster - but with this we'll + * actually send fewer commands overall because the CPU will + * not schedule the work in mac80211 as frequently if it's + * still running when rescheduled (possibly multiple times). + */ + ret = iwl_mvm_send_cmd_pdu(mvm, ECHO_CMD, 0, 0, NULL); + if (ret) + IWL_ERR(mvm, "Failed to synchronize multicast groups update\n"); } static u64 iwl_mvm_prepare_multicast(struct ieee80211_hw *hw, @@ -3292,16 +3309,16 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, if (vif->type == NL80211_IFTYPE_AP) { mvmvif->ap_assoc_sta_count--; iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL); - } else if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) { - /* remove session protection if still running */ + } else if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) iwl_mvm_stop_session_protection(mvm, vif); - } ret = 0; } else if (old_state == IEEE80211_STA_AUTH && new_state == IEEE80211_STA_NONE) { ret = 0; } else if (old_state == IEEE80211_STA_NONE && new_state == IEEE80211_STA_NOTEXIST) { + if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) + iwl_mvm_stop_session_protection(mvm, vif); ret = iwl_mvm_rm_sta(mvm, vif, sta); if (sta->tdls) { iwl_mvm_recalc_tdls_state(mvm, vif, false); diff --git a/sys/contrib/dev/iwlwifi/mvm/time-event.c b/sys/contrib/dev/iwlwifi/mvm/time-event.c index e91f8e889df7..e6813317edf3 100644 --- a/sys/contrib/dev/iwlwifi/mvm/time-event.c +++ b/sys/contrib/dev/iwlwifi/mvm/time-event.c @@ -1158,15 +1158,10 @@ void iwl_mvm_schedule_session_protection(struct iwl_mvm *mvm, cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)), .action = cpu_to_le32(FW_CTXT_ACTION_ADD), + .conf_id = cpu_to_le32(SESSION_PROTECT_CONF_ASSOC), .duration_tu = cpu_to_le32(MSEC_TO_TU(duration)), }; - /* The time_event_data.id field is reused to save session - * protection's configuration. - */ - mvmvif->time_event_data.id = SESSION_PROTECT_CONF_ASSOC; - cmd.conf_id = cpu_to_le32(mvmvif->time_event_data.id); - lockdep_assert_held(&mvm->mutex); spin_lock_bh(&mvm->time_event_lock); @@ -1180,6 +1175,11 @@ void iwl_mvm_schedule_session_protection(struct iwl_mvm *mvm, } iwl_mvm_te_clear_data(mvm, te_data); + /* + * The time_event_data.id field is reused to save session + * protection's configuration. + */ + te_data->id = le32_to_cpu(cmd.conf_id); te_data->duration = le32_to_cpu(cmd.duration_tu); te_data->vif = vif; spin_unlock_bh(&mvm->time_event_lock); diff --git a/sys/contrib/dev/iwlwifi/queue/tx.c b/sys/contrib/dev/iwlwifi/queue/tx.c index efb68b45f028..2941b3c89899 100644 --- a/sys/contrib/dev/iwlwifi/queue/tx.c +++ b/sys/contrib/dev/iwlwifi/queue/tx.c @@ -1081,6 +1081,7 @@ int iwl_txq_alloc(struct iwl_trans *trans, struct iwl_txq *txq, int slots_num, return 0; err_free_tfds: dma_free_coherent(trans->dev, tfd_sz, txq->tfds, txq->dma_addr); + txq->tfds = NULL; error: if (txq->entries && cmd_queue) for (i = 0; i < slots_num; i++)