From patchwork Wed Nov 16 20:52:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Schneider-Pargmann X-Patchwork-Id: 21260 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp56862wrr; Wed, 16 Nov 2022 12:55:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf5rOC9QgI6QmRGZ4Xpxq9fvAZ4oyRxhQJuh0fe4ibbg2JOBkxdjir5n4dYEnLIGhHeoK5jJ X-Received: by 2002:a17:906:2354:b0:7ad:c8d6:bc7f with SMTP id m20-20020a170906235400b007adc8d6bc7fmr18806808eja.118.1668632116083; Wed, 16 Nov 2022 12:55:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668632116; cv=none; d=google.com; s=arc-20160816; b=nqjL4kEhWKU4G3KaF99WM/aybcPAfX3G7qnGiND2d/E+yV/621kma6UmXPlBU2AoQM aY4yfZlUS9LxYosMVTGj7bwGAUdpv8iaDPIpCAKJI1d2u7PU92sGsjA3HETYZIgo2oKg bDqAh5PCR8zyptUr6Qms3tXrPSow5QgcNeNQoCJ7uMpv30vl9bveS2jWni/m/Qic4jdG qp4aBPtsok3vjD2b8lJt2xk2s1PXx3rfjGMUVIDjcCkBzLbe3wpfcHW819xWw7qUeL9z Rk0mdRTDmMBWKCtmCLuKdcZjT7cGRivB5LhkbbH4N/BMmNhe2hOHvzkNyIGxQijyUmYJ bTEg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ajsZbX3+twaGsWlZnthQH+DJqMTcB864bD+ktj1XJi8=; b=ExUmeBvNWXR+viXEgmakMc4H8ZUJGdos/N6GuyCxfff9h/SPZ9kus0Z39yxHElHLzF YS+p65G61zqV7glMw9hiVldPWXezr1kf/sOSld2mpKc9pX8wR/nQ/IoqKQf+E5kdPyP9 7vPhD+HtMj3Tx3ORZqZ1Dd/Z4UgQUdLVftix2p7/t84Y3NXZJPkvE7/rtf5yTxLJWrje WGp43LvlpvBJfBrCSY7G9OO2Y/mzXgeVD7NC9pd+VJxHjSJ5Zof8gXg8OZH67jwwYv2T O7YhBbDQ2W/cAKBP0n4B0wdJzsD/GY9ieVgTYpBL+jjBW9YwhGibkmAyeVvBLp9U4mXU rKMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=cGyV6iSy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k16-20020a17090666d000b00787abcb1ce0si13792674ejp.679.2022.11.16.12.54.52; Wed, 16 Nov 2022 12:55:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=cGyV6iSy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237236AbiKPUyV (ORCPT + 99 others); Wed, 16 Nov 2022 15:54:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234040AbiKPUxq (ORCPT ); Wed, 16 Nov 2022 15:53:46 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5752E27 for ; Wed, 16 Nov 2022 12:53:27 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id z18so28438557edb.9 for ; Wed, 16 Nov 2022 12:53:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ajsZbX3+twaGsWlZnthQH+DJqMTcB864bD+ktj1XJi8=; b=cGyV6iSyzBue0i5l97tQs1F/+bVMjgHav1MAY5Sp3ebIBKAF7rtEZUC/JmhiwCz45R rRQmwP4+vYFx1HAHkCDFG483CrsfEqHCo+WCCTFlJMKBWpByz9CHRlXEaEQXB15nQPg4 dVsPlUsn/h1qq8jjY1MBSrqbPNamW8aseozcmaPGAq5PLnSUxm1OYs1RIplM/W+npToS w+3jyD1we20/rAh/289ilWSbioDeGmbslRMCVMzHBoPyp6ZqDInmObMZhFFeJfhVg5b/ iuEhPle4TOpHkI0KN4kdg09gqWy6Y6GZf3f7H+fUL6eCG+EP6tv6oKJnBQ1vawL2Zg8+ FgpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ajsZbX3+twaGsWlZnthQH+DJqMTcB864bD+ktj1XJi8=; b=Iugrfh0fgXKug1UE6XoItx5uTaWQxWS8k+OXT+OjeOfbLTojaUwKLqBIXzFbEf8fk9 CjFLZuJnQ5wEtPqt55x9W2dCh3XFz6uBcoIKazI3VrdTT7uBOj3i57xmLG3/wJdimRuu KtJ/cMosNnT1kE5amh0lUxLFY4+z8tTt4vSZGj0bOB2LekioOI2ojG4lece9ArZENngF zwRHzkWWakr5JSariphkRQZ0D1Jfekl2i5/DyJNwoZUoFEB+ObjiCkXxZh5GR1vkQ0Ci l6eUPKJjCKVy1fMaOxIMXmcSZtITtDw5Y0/8lqjebNQe1jwabpFEUnGQiGe/2DFqSsA+ /oIg== X-Gm-Message-State: ANoB5pnEOtnatlGQWDmg1FL1pUl8DZIGT/DjXUQaXd5gEDF6dHWmAarL AKhUZHb+gQhEWhlBFobZmg1h9Q== X-Received: by 2002:aa7:d6cb:0:b0:467:e2dd:b593 with SMTP id x11-20020aa7d6cb000000b00467e2ddb593mr12985138edr.378.1668632005445; Wed, 16 Nov 2022 12:53:25 -0800 (PST) Received: from blmsp.fritz.box ([2001:4090:a244:804b:353b:565:addf:3aa7]) by smtp.gmail.com with ESMTPSA id kv17-20020a17090778d100b007aece68483csm6782828ejc.193.2022.11.16.12.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 12:53:24 -0800 (PST) From: Markus Schneider-Pargmann To: Chandrasekar Ramakrishnan , Marc Kleine-Budde , Wolfgang Grandegger Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Markus Schneider-Pargmann Subject: [PATCH 02/15] can: m_can: Wakeup net queue once tx was issued Date: Wed, 16 Nov 2022 21:52:55 +0100 Message-Id: <20221116205308.2996556-3-msp@baylibre.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116205308.2996556-1-msp@baylibre.com> References: <20221116205308.2996556-1-msp@baylibre.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749687589428357681?= X-GMAIL-MSGID: =?utf-8?q?1749687589428357681?= Currently the driver waits to wakeup the queue until the interrupt for the transmit event is received and acknowledged. If we want to use the hardware FIFO, this is too late. Instead release the queue as soon as the transmit was transferred into the hardware FIFO. We are then ready for the next transmit to be transferred. Signed-off-by: Markus Schneider-Pargmann --- drivers/net/can/m_can/m_can.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index 2c01e3f7b23f..4adf03111782 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -1097,10 +1097,9 @@ static irqreturn_t m_can_isr(int irq, void *dev_id) /* New TX FIFO Element arrived */ if (m_can_echo_tx_event(dev) != 0) goto out_fail; - - if (netif_queue_stopped(dev) && - !m_can_tx_fifo_full(cdev)) + if (!cdev->tx_skb && netif_queue_stopped(dev)) netif_wake_queue(dev); + } } @@ -1705,6 +1704,8 @@ static netdev_tx_t m_can_tx_handler(struct m_can_classdev *cdev) if (m_can_tx_fifo_full(cdev) || m_can_next_echo_skb_occupied(dev, putidx)) netif_stop_queue(dev); + else if (cdev->is_peripheral && !cdev->tx_skb && netif_queue_stopped(dev)) + netif_wake_queue(dev); } return NETDEV_TX_OK;