Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp11967032rwd; Thu, 22 Jun 2023 22:46:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7eagIhvvd4NOeJ5k9Z21MCHsUjCB3DJxRohAZFgxJdqOpV0gVjIFnuUpijwXZAJZiPay5c X-Received: by 2002:a9d:7c8f:0:b0:6b5:e151:baef with SMTP id q15-20020a9d7c8f000000b006b5e151baefmr6657515otn.22.1687499205499; Thu, 22 Jun 2023 22:46:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687499205; cv=none; d=google.com; s=arc-20160816; b=rxg7bSlhVu31uLlkzY7f4iiBtE2ytJV+9ZNTO4c9CucFsqLvE8ZAb6HBHs5Up+KJ0d icR3tkWTtx7ZQl5fzgg3rE+WlZhq/6z2cXu6+V4SxVvWK+KMTkep7/qZt7y4HAoVK6w7 kvLm3o7y5RYGVe5Ske0RkoYr6Bzqciafc9GOJgRy8KfoMshZ9WSJCDNLvpFNLJkdNnM/ +9oZXYI1bkqDJuTFIIP6EiYtTyYNtEpafB6I7sG4baq4b4mo+rpS1DEkMy0uvOHuQ2/2 zERkdcLk6bgjxCq01efiYlbE6821EvDs7zYVQJjo/Hh76eCiQMGsi0/Gj4qsL9Tnr3fo 5P6w== 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=LOcDqJCt9IVuH/eP9KnNPhUu5ERsr+/jY3ag3wM1nL0=; b=UeBTVQ+kumNfaBEZEegzySKt1sxAj5XgWTNIQhjGpxhqUA8zRAiRLd1JTZK89istBl /6JrAIF4NdikjqbPkA4h4bV5NSlpcvDYbxbLMFQtzOQ4+jPgmtUPDlDiqqdH0Iqr8RZf XIKPDRfFwSdeyG2VowsYh+RP45gOVMx5jL2OZU47+ndsVrd6i4zPV8Er7Vvem1vCCGDh nHjuz7pY0x6W9tptjxzH4sTfLd+pxoF1Z7WObLR5G0/sGMkyjh19k3XunGnKt315NziS UacA23i/9j/nCKuavmFMPxoROCoa6Jg6nBxSXIpSzZPE9RAUbVENn2FW/H1IYsvVZdi4 xvqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="BOm/Y9VP"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v4-20020a637a04000000b005533c55dc3esi8342708pgc.573.2023.06.22.22.46.32; Thu, 22 Jun 2023 22:46:45 -0700 (PDT) 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=@intel.com header.s=Intel header.b="BOm/Y9VP"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231287AbjFWFL5 (ORCPT + 99 others); Fri, 23 Jun 2023 01:11:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229607AbjFWFLz (ORCPT ); Fri, 23 Jun 2023 01:11:55 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9160D1FE1; Thu, 22 Jun 2023 22:11:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687497113; x=1719033113; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=HWj1VSHjeQifGegDV6SwXxM3IwTPiL+2f0IbuRC5FmI=; b=BOm/Y9VP8j83tSpDB1+ZqUn4azyckgJJi5kw3VNoHWGytbUMqAO3qZHA 7lVqV7JozlIbW0CK10VIKk5sFXd2be4MaPj76j310EhXPa3T3gxdWPbmp /X2ESiIpJbsg+ncq8QkxHL8qHiwiFmAFoTfN/3DMBfVOOO9Eqh94FlfDZ a+zJyp2F52zLMHroCjXrBOoYDsaz5oP98Nc3mjdL4v9PuXG9zcXSfIDUe X8QLzQRIKfPfNoerZU5CsGCD/LgBRkhLKapcZjdaQnKw1HJGUr/uccb2O 4bRmkztZaMEnVFDyRntdgwGE/kL/NeWzNIaQkL8MhJfXfD5uYlHbwEGoT g==; X-IronPort-AV: E=McAfee;i="6600,9927,10749"; a="426671641" X-IronPort-AV: E=Sophos;i="6.01,151,1684825200"; d="scan'208";a="426671641" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2023 22:11:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10749"; a="665353763" X-IronPort-AV: E=Sophos;i="6.01,151,1684825200"; d="scan'208";a="665353763" Received: from inesxmail01.iind.intel.com ([10.223.154.20]) by orsmga003.jf.intel.com with ESMTP; 22 Jun 2023 22:11:49 -0700 Received: from inlubt0246.localdomain (inlubt0246.iind.intel.com [10.67.198.165]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id 4A5F715B53; Fri, 23 Jun 2023 10:41:48 +0530 (IST) Received: by inlubt0246.localdomain (Postfix, from userid 12088949) id 3E86D5F772; Fri, 23 Jun 2023 10:41:48 +0530 (IST) From: Kumari Pallavi To: rcsekar@samsung.com, wg@grandegger.com, mkl@pengutronix.de, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mallikarjunappa.sangannavar@intel.com, linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kumari Pallavi , Srikanth Thokala Subject: [PATCH 1/1] can: m_can: Control tx and rx flow to avoid communication stall Date: Fri, 23 Jun 2023 10:41:24 +0530 Message-Id: <20230623051124.64132-1-kumari.pallavi@intel.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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-kernel@vger.kernel.org In bi-directional CAN transfer using M_CAN IP, with the frame gap being set to '0', it leads to Protocol error in Arbitration phase resulting in communication stall. Discussed with Bosch M_CAN IP team and the stall issue can only be overcome by controlling the tx and rx packets flow as done by the patch. Rx packets would also be serviced when there is a tx interrupt. The solution has been tested extensively for more than 10 days, and no issues has been observed. Setup that is used to reproduce the issue: +---------------------+ +----------------------+ |Intel ElkhartLake | |Intel ElkhartLake | | +--------+ | | +--------+ | | |m_can 0 | |<=======>| |m_can 0 | | | +--------+ | | +--------+ | +---------------------+ +----------------------+ Steps to be run on the two Elkhartlake HW: 1. ip link set can0 type can bitrate 1000000 2. ip link set can0 txqueuelen 2048 3. ip link set can0 up 4. cangen -g 0 can0 5. candump can0 cangen -g 0 can0 & candump can0 commands are used for transmit and receive on both the m_can HW simultaneously where -g is the frame gap between two frames. Signed-off-by: Kumari Pallavi Signed-off-by: Srikanth Thokala --- drivers/net/can/m_can/m_can.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index a5003435802b..94aa0ba89202 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -1118,7 +1118,7 @@ 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; - + m_can_write(cdev, M_CAN_IE, IR_ALL_INT & ~(IR_TEFN)); if (netif_queue_stopped(dev) && !m_can_tx_fifo_full(cdev)) netif_wake_queue(dev); @@ -1787,6 +1787,7 @@ static netdev_tx_t m_can_start_xmit(struct sk_buff *skb, } } else { cdev->tx_skb = skb; + m_can_write(cdev, M_CAN_IE, IR_ALL_INT & (IR_TEFN)); return m_can_tx_handler(cdev); } -- 2.17.1