Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp16314876rwd; Mon, 26 Jun 2023 08:24:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5vuv88TBWpFb4MZszezwXhazwYigPT/I3LUgSFV7HD7CFkG2/3AjjY4cvdrrgWelceFk2g X-Received: by 2002:a17:902:e844:b0:1b1:f617:d184 with SMTP id t4-20020a170902e84400b001b1f617d184mr4275787plg.11.1687793080221; Mon, 26 Jun 2023 08:24:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687793080; cv=none; d=google.com; s=arc-20160816; b=dttyYUjvochwl6O46PjiMs2dsG2L+rERgdMPYo3QRNcrEWbhy8YZDcuapDkIFepnJt 0kcA9lHAm9SE8H16IJbnPKbGCRjla6/rSfFaV+78KaMshLJIUlv2uIpb7eQ13CVjMj1A 6jwXHxcAPvxjme9at/y4Y85wdPoxCjMgvOAdzV/WHfVlmgTPK56q4U/cZfNop2iIoz6+ soL9MCLtNOi0fZaTP6+gcUhOEJu1C37PuqbXariGIRjQqaXCC0mzJYnW7rHz1ZGhi3q4 oKG0Y1K9Gw4CmXSxeioU3mP68AG7kXtPnjK1fwXPvdoa1yLKPZF+UB+m7MAl48CFfUkJ D+Dg== 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=nHZNBg1lY2fHaMT5s/DQ6RfZqCnQitRSQzp7idkVQUs=; fh=BnILszgCJyWcb3K7WG3TE9K5XgKwfdDNxTJXcDnfIKU=; b=iyu3YYDt0sAyFUTQ/AMROVqtjAamlUaYwOCMSVOTzjDRFnJEGH8fO7W2QvawzRdyU0 dPSNomoN4Njnirg+vhgHtAeQl0cLIPTjNUE6vuIDcLw/Fxwehz0wucghKZ+mIhU6Ii07 qFrV6ZuhH1+eOVz6ZB6URfZRRu8IUoAD+xlWEBkduVnDiaKLs9Ea37gVHT98pc1mklwY 7AhGZNghECDs3rTda4XM8L6lbpOFsctTMZiVt1IXsELKipEkH0veXsx+kvXcydfRIg11 fGItZLLlk9ZG3Ul4oNlA7jyRBwiQSitBrBgE/e6VLQozzUUoEXd6jou47mS+jKGaVFcq ay3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=I8aR1Nk1; 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 t18-20020a170902b21200b001adb857fc79si4951450plr.105.2023.06.26.08.24.07; Mon, 26 Jun 2023 08:24:40 -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=I8aR1Nk1; 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 S230394AbjFZPQo (ORCPT + 58 others); Mon, 26 Jun 2023 11:16:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229939AbjFZPQn (ORCPT ); Mon, 26 Jun 2023 11:16:43 -0400 Received: from forward103c.mail.yandex.net (forward103c.mail.yandex.net [178.154.239.214]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2B54D3 for ; Mon, 26 Jun 2023 08:16:40 -0700 (PDT) Received: from mail-nwsmtp-smtp-production-main-29.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-29.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:3faf:0:640:537b:0]) by forward103c.mail.yandex.net (Yandex) with ESMTP id 8AEF960065; Mon, 26 Jun 2023 18:16:38 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-29.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id bGM21E2WuSw0-15Sexy6X; Mon, 26 Jun 2023 18:16:38 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1687792598; bh=nHZNBg1lY2fHaMT5s/DQ6RfZqCnQitRSQzp7idkVQUs=; h=Message-ID:Date:Cc:Subject:To:From; b=I8aR1Nk1UNwA1erbBBrIrJriksKH6xbphOh6pn7NSkGN2ZnODVp3TdA/ty9A7LMAg wa6xE5wOS0SdfBOlSH1lmjsTOfN76mm6r4Iz4F1c5+olnXqyMdfHKtEZ8VJYQozJ9i aamt/5NNPtHsuc3hnv8y9TJ8ypJRbTDrbXWGmrVI= Authentication-Results: mail-nwsmtp-smtp-production-main-29.myt.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Kalle Valo Cc: linux-wireless@vger.kernel.org, Dmitry Antipov Subject: [PATCH] wifi: ath10k: convert msecs to jiffies where needed Date: Mon, 26 Jun 2023 18:14:29 +0300 Message-ID: <20230626151636.314868-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_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()' assumes expire time in jiffies and not milliseconds, 'msecs_to_jiffies()' should be used in 'ath10k_pci_rx_post_pipe()' and 'ath10k_snoc_rx_post_pipe()'. This patch also introduces a minor refactoring and fixes number of loop iterations in 'ath10k_pci_rx_post_pipe()' (I assume that the number of calls of '__ath10k_pci_rx_post_buf()' should be equal to number of buffers returned by '__ath10k_ce_rx_num_free_bufs()' and not plus one). Fixes: a6e149a9ff03 ("ath10k: add hif start/stop methods for wcn3990 snoc layer") Fixes: 728f95eef523 ("ath10k: rework posting pci rx buffers") Signed-off-by: Dmitry Antipov --- drivers/net/wireless/ath/ath10k/pci.c | 20 ++++++++++---------- drivers/net/wireless/ath/ath10k/snoc.c | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index a7f44f6335fb..18eca7a2154a 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -818,17 +818,17 @@ 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); - break; - } - num--; + if (unlikely(ret)) + goto err; + } + return; +err: + 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..9d180d02cc7c 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -544,16 +544,18 @@ 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); - break; - } + if (unlikely(ret)) + goto err; + } + return; +err: + if (ret != -ENOSPC) { + ath10k_warn(ar, "failed to post 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