Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp759776ybz; Fri, 24 Apr 2020 08:50:07 -0700 (PDT) X-Google-Smtp-Source: APiQypLrZKpEQKMmZWDU/wIio6hrOuW+4RG8yuAs8F6q3KBNe0y95hKJjh3wZVhqvOGJXkTWWQBz X-Received: by 2002:a17:906:90c1:: with SMTP id v1mr7278385ejw.322.1587743407415; Fri, 24 Apr 2020 08:50:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587743407; cv=none; d=google.com; s=arc-20160816; b=GwRYAcctoK/FWoz61rnSFCUFOWxFNKcJi4AqKMlzaOsMgkjrDyl7nTdBU6cnrzjUB4 etJLwYaowQud3sTYQLIuPQTBbJM/wMnwRVOWaTynXB21g8hHbPca1rAWTCaNrKUiJxGT rd3QHjLKyeDKyNHXz75ACzfoWfSq/jT3rQsrjyfI46Wqs0/xXcwoSNW3oRBaWXL8Ud8C 1tIwOImlKak2q29eMfdB2mUODpKSYJaq7yKNiXE9DHuBqkL1sMb77sdPtkseeSFaTUV2 Enj9jBGdCOVX8kgk9vzkHDNkqohWSPe30eVEUhdpMmugxKp25ucnld2a9dsrwdnpPh/r p6ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:cc:to:from; bh=9tWh4q0M1DUWKHYsSceaRQ8zpEYToNMZykNXyQpk9DU=; b=fcJ3w18FlD+PJqb9aI/jE3dpSjaq0sYPqDFakU1JlbXckW9yMQG2k3DoY40v9BDUMG 8ybwqQeUY5jssMYosQGs9MwezjQPypQ0xbSS0B3ZO6Wey420O4exA9o4AVobw/DEUZTx 8J59W6vX1q66eq7rPL0OQ9PfiNWylZC72S8XuZkfK6whoeKGdN5nFAvKaaLA48F/ChnL JnoHFervjgaKZRoNYeEKa+g6boW3HCV/iykepVo+hRFiz9yICND3UYfaed4iErq6t1jr 1l6JHmxDtBDPei4np4cYvxZD4KbhlyUPdanJaENN+Acd0sU4yFcdRo/bzdlKI1VVubsi 20vQ== ARC-Authentication-Results: i=1; mx.google.com; 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 r15si3212145ejr.33.2020.04.24.08.49.44; Fri, 24 Apr 2020 08:50:07 -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; 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 S1728958AbgDXPsi (ORCPT + 99 others); Fri, 24 Apr 2020 11:48:38 -0400 Received: from paleale.coelho.fi ([176.9.41.70]:57932 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728481AbgDXPsh (ORCPT ); Fri, 24 Apr 2020 11:48:37 -0400 Received: from 91-156-6-193.elisa-laajakaista.fi ([91.156.6.193] helo=redipa.ger.corp.intel.com) by farmhouse.coelho.fi with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1jS0Z8-000OY2-Q8; Fri, 24 Apr 2020 18:48:35 +0300 From: Luca Coelho To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org Date: Fri, 24 Apr 2020 18:48:15 +0300 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200424154818.2657602-1-luca@coelho.fi> References: <20200424154818.2657602-1-luca@coelho.fi> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on farmhouse.coelho.fi X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, TVD_RCVD_IP autolearn=ham autolearn_force=no version=3.4.4 Subject: [PATCH 09/12] iwlwifi: avoid debug max amsdu config overwriting itself Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Mordechay Goodstein If we set amsdu_len one after another the second one overwrites the orig_amsdu_len so allow only moving from debug to non debug state. Also the TLC update check was wrong: it was checking that also the orig is smaller then the new updated size, which is not the case in debug amsdu mode. Signed-off-by: Mordechay Goodstein Fixes: af2984e9e625 ("iwlwifi: mvm: add a debugfs entry to set a fixed size AMSDU for all TX packets") Signed-off-by: Luca Coelho --- drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 11 +++++++---- drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c | 15 ++++++++------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c index 3beef8d077b8..8fae7e707374 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c @@ -5,10 +5,9 @@ * * GPL LICENSE SUMMARY * - * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH - * Copyright(c) 2018 - 2019 Intel Corporation + * Copyright(c) 2012 - 2014, 2018 - 2020 Intel Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as @@ -28,10 +27,9 @@ * * BSD LICENSE * - * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH - * Copyright(c) 2018 - 2019 Intel Corporation + * Copyright(c) 2012 - 2014, 2018 - 2020 Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -481,6 +479,11 @@ static ssize_t iwl_dbgfs_amsdu_len_write(struct ieee80211_sta *sta, if (kstrtou16(buf, 0, &amsdu_len)) return -EINVAL; + /* only change from debug set <-> debug unset */ + if ((amsdu_len && mvmsta->orig_amsdu_len) || + (!!amsdu_len && mvmsta->orig_amsdu_len)) + return -EBUSY; + if (amsdu_len) { mvmsta->orig_amsdu_len = sta->max_amsdu_len; sta->max_amsdu_len = amsdu_len; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c index 15d11fb72aca..6f4d241d47e9 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c @@ -369,14 +369,15 @@ void iwl_mvm_tlc_update_notif(struct iwl_mvm *mvm, u16 size = le32_to_cpu(notif->amsdu_size); int i; - /* - * In debug sta->max_amsdu_len < size - * so also check with orig_amsdu_len which holds the original - * data before debugfs changed the value - */ - if (WARN_ON(sta->max_amsdu_len < size && - mvmsta->orig_amsdu_len < size)) + if (sta->max_amsdu_len < size) { + /* + * In debug sta->max_amsdu_len < size + * so also check with orig_amsdu_len which holds the + * original data before debugfs changed the value + */ + WARN_ON(mvmsta->orig_amsdu_len < size); goto out; + } mvmsta->amsdu_enabled = le32_to_cpu(notif->amsdu_enabled); mvmsta->max_amsdu_len = size; -- 2.26.2