Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp1341323rwp; Thu, 13 Jul 2023 09:23:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlHaYCc5tKILM3Ys1cGvcfIKft4MmiUsHVG+ZMpLxpLjXsXkX1y2NK6sSSGrbEvNSum4A8Ot X-Received: by 2002:a5d:4244:0:b0:314:172b:a75a with SMTP id s4-20020a5d4244000000b00314172ba75amr1909506wrr.26.1689265410852; Thu, 13 Jul 2023 09:23:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689265410; cv=none; d=google.com; s=arc-20160816; b=HMD9LBpJWh7o8Gzu9q4P+tnN61pCbQXnZB879dw1iqYRACMjEdU0A24g4kso+y1Us6 MHv+aaiYaqy3xlvWMCJIXJkI6pAnfMHus4Fc2GFxjHQBHrEPgDV7pzKCi6gK7aYiqrxt dMgx5BM//4qfEhAwFnT6FV4N1ED7BkfKRudeAU1YG6hRRzGwDeStjgk7oyoFQ0OmY7I2 COvd60kt4+n3R22dxgWW6y3QqzKXPUVMRKLaHBYA0HpdPeNvjrEh0Jy1yXjZvzz7b5by Fx7EDDXp/rpNOWDohBqPNN9MQNcj+KwgW4UO5VM7bnKXL9pvZBTQ9QuaAy8hCjxWenMR wLTA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=hPPMmiKwY1oM20k4fidTnyeo0kqVYkehCNjEfUoLMkI=; fh=a6ow1kcDKEPpZULfyskCFg4jHWi8feAWh8OAYRABMtE=; b=DdLitZEPbXlfbitz3brGq/VzJG1X9KNfdu8Gm9/lk9x789d/ZlUe1qpqvwmMraWQ6K 04/RFKb7I9XXdRrbWp0WBwkBHHNBlH1WF7rzagRKhsm9op9lYy024kReqPjN8+tWjoUZ eYCyO+0G6G8zwn87TYAYBhX+WZ5q4r/9qsDaweASfpd6sPWLn0d/4spXULtNUCm+TQbX ddm+tFi0IwNrQpsgZlmyZ50a6pZqkm9AoF8PXsJNkaxbt8cU5XkyNnU8D1DoRTJMGB8f Y7DEP5zQBXsgXDhRsGagAzH4vjZ1LZsd5j0t/HUwBdHwsLYnLXzT9M76pymo4Wue9xtg 8LWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=J8JdN0Tv; 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=yandex.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r17-20020a1709067fd100b0098859d239dfsi8129959ejs.796.2023.07.13.09.23.15; Thu, 13 Jul 2023 09:23:30 -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=@yandex.ru header.s=mail header.b=J8JdN0Tv; 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=yandex.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229464AbjGMQC0 (ORCPT + 59 others); Thu, 13 Jul 2023 12:02:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235146AbjGMQCU (ORCPT ); Thu, 13 Jul 2023 12:02:20 -0400 Received: from forward102c.mail.yandex.net (forward102c.mail.yandex.net [178.154.239.213]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 899A8271F for ; Thu, 13 Jul 2023 09:02:18 -0700 (PDT) Received: from mail-nwsmtp-smtp-production-main-69.iva.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-69.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:3c81:0:640:d488:0]) by forward102c.mail.yandex.net (Yandex) with ESMTP id 43E3A60021; Thu, 13 Jul 2023 19:02:16 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-69.iva.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id F2eqB42Wn8c0-kKnLUxVr; Thu, 13 Jul 2023 19:02:15 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1689264135; bh=hPPMmiKwY1oM20k4fidTnyeo0kqVYkehCNjEfUoLMkI=; h=Message-ID:Date:Cc:Subject:To:From; b=J8JdN0TvzfVqOr1qWFkyWacVyaNWgMNqD3UeNN5G9SMBOKHpwC/8CXqHB7KUajfA4 sPLtZpAU7OdjpNhhdSl33sTUgYhrGX76dlgKFV88k1uIchWr+ME8lD5+WS7lAYigJ3 UNa4sNz+gEkjathesJ+W2HK9xHfFrgIGvWx2GHok= Authentication-Results: mail-nwsmtp-smtp-production-main-69.iva.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Kalle Valo Cc: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Arnd Bergmann , linux-wireless@vger.kernel.org, Dmitry Antipov Subject: [PATCH] wifi: ath10k: fix PCI and SNOC RX pipe operations Date: Thu, 13 Jul 2023 19:00:57 +0300 Message-ID: <20230713160101.333483-1-dmantipov@yandex.ru> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Since 'mod_timer()' expects expiration time in jiffies, add missing 'msecs_to_jiffies()' in 'ath10k_pci_rx_post_pipe()' and 'ath10k_snoc_rx_post_pipe()'. Also simplify the loops and fix number of loop iterations in the former (it should be equal to 'num' (i.e. number of buffers) and not 'num + 1'. Fixes: 728f95eef523 ("ath10k: rework posting pci rx buffers") Fixes: a6e149a9ff03 ("ath10k: add hif start/stop methods for wcn3990 snoc layer") Signed-off-by: Dmitry Antipov --- drivers/net/wireless/ath/ath10k/pci.c | 16 +++++++--------- drivers/net/wireless/ath/ath10k/snoc.c | 14 +++++++------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index a7f44f6335fb..c004c87d3211 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -818,17 +818,15 @@ static void ath10k_pci_rx_post_pipe(struct ath10k_pci_pipe *pipe) num = __ath10k_ce_rx_num_free_bufs(ce_pipe); spin_unlock_bh(&ce->ce_lock); - while (num >= 0) { + while (num--) { ret = __ath10k_pci_rx_post_buf(pipe); - if (ret) { - if (ret == -ENOSPC) - break; - ath10k_warn(ar, "failed to post pci rx buf: %d\n", ret); - mod_timer(&ar_pci->rx_post_retry, jiffies + - ATH10K_PCI_RX_POST_RETRY_MS); + if (ret) break; - } - num--; + } + if (ret != -ENOSPC) { + ath10k_warn(ar, "failed to post PCI rx buf: %d\n", ret); + mod_timer(&ar_pci->rx_post_retry, jiffies + + msecs_to_jiffies(ATH10K_PCI_RX_POST_RETRY_MS)); } } diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c index 26214c00cd0d..9ced24b1b177 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -544,16 +544,16 @@ static void ath10k_snoc_rx_post_pipe(struct ath10k_snoc_pipe *pipe) spin_lock_bh(&ce->ce_lock); num = __ath10k_ce_rx_num_free_bufs(ce_pipe); spin_unlock_bh(&ce->ce_lock); + while (num--) { ret = __ath10k_snoc_rx_post_buf(pipe); - if (ret) { - if (ret == -ENOSPC) - break; - ath10k_warn(ar, "failed to post rx buf: %d\n", ret); - mod_timer(&ar_snoc->rx_post_retry, jiffies + - ATH10K_SNOC_RX_POST_RETRY_MS); + if (ret) break; - } + } + if (ret != -ENOSPC) { + ath10k_warn(ar, "failed to post SNOC rx buf: %d\n", ret); + mod_timer(&ar_snoc->rx_post_retry, jiffies + + msecs_to_jiffies(ATH10K_SNOC_RX_POST_RETRY_MS)); } } -- 2.41.0