From nobody Thu Dec 30 19:22: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 52536191FD3F; Thu, 30 Dec 2021 19:22:57 +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 4JPypj1cd5z3C13; Thu, 30 Dec 2021 19:22: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 A57641DE6B; Thu, 30 Dec 2021 19:22: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 1BUJMpsu017639; Thu, 30 Dec 2021 19:22:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BUJMpEV017638; Thu, 30 Dec 2021 19:22:51 GMT (envelope-from git) Date: Thu, 30 Dec 2021 19:22:51 GMT Message-Id: <202112301922.1BUJMpEV017638@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 96e43f01b762 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 96e43f01b762b459747028a04880be4ccbfd4a38 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640892175; 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=szI4hRzbn8+Ql1WLdKZu6+TNbJ9LQQQK1TdYM9zsb6M=; b=GE69L2+RBEDcG9FaDHwnAcvHKb1liej52vRrXcuq5qiGDz3vVJbcRjtcsjztAhK3plDUvm EktI3FhPt+SLCTIs5QaWRBE3tyomJmaQrekjtJJO6mRl8szHwUGWoF9GqxOLvX8w34Gj2+ 0RIIeBgIIkjjs/+7QWY9W+WOLnGJrX1SlQrHIGu2ZRpfPes5OuXdS5G48egj6Y0WlEiJuK dwEXat6Y+9huVoB2F5SIB8r1Uf1Qz8fqFIwD1bLwucnzI7PXFcnfg9Nr/po1bDtJjbHGvk 1RHWXdhde1s+7tVmiTLENffk8HXQGm99xbWfxZmqZrlhnBTJgLmW5VAdtigznw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640892175; a=rsa-sha256; cv=none; b=IygtoxV9YOVXIWkcod/ZXgMc7Yyoj9MZv9qpd+v5p0PcecARzYKRH08fdpz88WjIiquD9T w9jrUI1yBbgd+XljheMOTq09Go+zfMVqoxQpY7xEDeRjsRLoTDoVf5EMHcWSr5GS1Aydbs 8DJ71Agb0tNOSHMEAji7LvpHzyz/bXr8+t9ugnC5SVwkxL6PRMU0CH+5kQdjNiFtvJE1N4 0k6hL99mFW/8u+6nlSJQjd6nMuhc3p71Hx+lT4+GynFxFkaSZ+wb7DaY0fA5yTpnaNbM4I ZGYOLgk1lXWxn1Mh81qTuJjUQdtR5HhTa/OJo6jot+EIE8ufDuxxgQAlrrJASw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=96e43f01b762b459747028a04880be4ccbfd4a38 commit 96e43f01b762b459747028a04880be4ccbfd4a38 Author: Bjoern A. Zeeb AuthorDate: 2021-12-27 17:41:19 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-12-30 18:28:42 +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 (cherry picked from commit 8f06a2b550c6288b48996036c325a1999780cb6a) --- 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++)