Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp215869pxb; Wed, 23 Mar 2022 16:40:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/DwE7S7WgVrIj0INvxePzPPqpovUo5irhMMkeiUvWstImwZzOdC6C/k4LkOlFmJe+t0Z5 X-Received: by 2002:a17:906:5011:b0:6cf:82ff:f1bf with SMTP id s17-20020a170906501100b006cf82fff1bfmr2816128ejj.69.1648078801764; Wed, 23 Mar 2022 16:40:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1648078801; cv=pass; d=google.com; s=arc-20160816; b=lIMP2Yd0nzkzZAxkFeZFD4ZDl4Ati15BKJiamrgtoI2/PNLpsb5OD0eY9IQ6PjNkhE OHsL3ScMW/b8E1jJbMGzN0EPUJtklTkCnoV0CFjjVTTUx+ctUQbCAh3W+aDHS0YeeJNy redT1jvT75WJUaeldwVe+r+MrLZKajEfeFbqCvK0zeCWasfpax3pQ4P2u7AK29SpFpEH DfeIWp+ggCPYG56R6phXge97ACFCp64szcD/fR9dBKbJ6o/xPV2/li5MVlrY/hLtw7Lz eV3KL3RlOIdO+mCx9nPfsxjFrovXRl3kN0eJlUFC4pDtaIO6SSgvgbO3gGI7TtAYtlt1 MPwg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=e66uONHHP7E0l2fzL84Zuc6NN9BsE6jSqD1zwpciaz0=; b=WzEi154Pugo5nDJmtk3zxrbHFU2wPtwU79MvvtzInSQDXtRDJidS9dG8YEyXDHriN2 Yw4s2D7ZJ4fWx5odr4WagUeJ2BhmPBgCGkpdl6E/2dzTsJ/zMUpWhp7NzhZnsPwjV05j TaDIdn/yy8js5tfiIPAFdtTzwnt8VUk/OWoW0kue7AgJC7N1jOoWeVtJVrjh5OJxg+ou ErtLT+hGq+WYQ0a37cGuUbr0Nrm7dVOMZXnQ48bdHS1VbXBsyd3y9pCtydBGqTq/dx96 ICCEU+2N7V8jk9aW/yKHMMMo2i+voapoVdo4I6TkWTF8J0Z5PgDbDN3VIUTnFTawvyQW N8Fw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vaisala.com header.s=selector1 header.b=qzSG7zg8; arc=pass (i=1 spf=pass spfdomain=vaisala.com dkim=pass dkdomain=vaisala.com dmarc=pass fromdomain=vaisala.com); 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=vaisala.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p15-20020a50cd8f000000b00418c2b5bdafsi16926527edi.145.2022.03.23.16.39.37; Wed, 23 Mar 2022 16:40:01 -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=@vaisala.com header.s=selector1 header.b=qzSG7zg8; arc=pass (i=1 spf=pass spfdomain=vaisala.com dkim=pass dkdomain=vaisala.com dmarc=pass fromdomain=vaisala.com); 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=vaisala.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233510AbiCWIKe (ORCPT + 99 others); Wed, 23 Mar 2022 04:10:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242450AbiCWIKa (ORCPT ); Wed, 23 Mar 2022 04:10:30 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60049.outbound.protection.outlook.com [40.107.6.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68E2E74DF6; Wed, 23 Mar 2022 01:08:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dfXflOG9BClWulugzAdZUXNMc0NyGVhbhkUENBP5lOiNxxwwVDe7Gqu6Pmg5XC151fxy1pyuhkSAz7iRjolntfmlDQHo0nlUgtM0DUH1raMhhdt3RYdLhQrljkgNVfa4/zY25wpG6tpyjo6xo4xMckz8ah0TySHZv6TW3Q/kUNwy434cdbfAR95zvbHggwvvF+dEOvejluHW2WTnL33ecOFHWPqmKXNqNIVjW4FuPxEdPfxAxC5fpqpr+eAJrvLj4O5/bULQss2IIktMblsnGXyxZuAtPpV2xcOIGxYFANef8ylD/jqilWC0JYxK9pFEIxqAYbNJ+0iYoWu+xD1XnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=e66uONHHP7E0l2fzL84Zuc6NN9BsE6jSqD1zwpciaz0=; b=QDOj4WVJdUe9j662R+4zON4fsERA9ZhJWQ5JHOn8Dy84lqYPbBHbRdj9W+6kaG+T1h83dvtUhqqWYtsBVEegIQPOZSHWs7mTLO8xAGyp0XEN7cxbxcrp5wp2UfAYg3NpMKKwe1ibJoBaREqefRsCp2TiS9C4Zk/MPopliVzkHjSY05YlKVSkNzuKG4KKSIqAP3Yvv1AnYyByAE+2ZDAHD61MnhuX+niv94LFxNzs61DE7bU/tBGrk6hVi9Jsw2pODcWlDrCprafGHD+XVv7nifjjyg4hhogHNHfEP/q+zxxzJAQbSq7+j1BO9eSmCj+5G70dCNyLqTjmSPsDu+Nsyw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vaisala.com; dmarc=pass action=none header.from=vaisala.com; dkim=pass header.d=vaisala.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vaisala.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=e66uONHHP7E0l2fzL84Zuc6NN9BsE6jSqD1zwpciaz0=; b=qzSG7zg85UZkHHQoB0MqO9LkK/TGaFK+J3Ai8adsCoMRii5iV2b843JamFzzHNeo9jj2Y+l3QMZ7CV3kH2gzpEold/vPtqRFJOjfN05BSs4XiTrcXevEvZuB6wtGTZf8vmuKpIqQ9zGgWi+HDBCobYJOvZJ4DcF67f1RWVdqeAIsmKpzAYQlHPxfP532w0JPIjFejwi48B7lTKp2lpLrwjMCyNi7A9aD6zIEEuWE++M+XIH/s5+i0E3v1VH5ECc3H/0rP/Y2ohbiDkpVzF5OIYt2kd5Ucn8nB7S9AbIYg9jbWpnrmDD3sEWjWPJ15U65FYtTmglKYS9FRviUKeQkmg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vaisala.com; Received: from HE1PR0602MB3625.eurprd06.prod.outlook.com (2603:10a6:7:81::18) by AS8PR06MB8214.eurprd06.prod.outlook.com (2603:10a6:20b:3d0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.17; Wed, 23 Mar 2022 08:08:55 +0000 Received: from HE1PR0602MB3625.eurprd06.prod.outlook.com ([fe80::c8bc:3aa9:eab3:99e8]) by HE1PR0602MB3625.eurprd06.prod.outlook.com ([fe80::c8bc:3aa9:eab3:99e8%7]) with mapi id 15.20.5081.022; Wed, 23 Mar 2022 08:08:55 +0000 From: Tomas Melin To: claudiu.beznea@microchip.com Cc: Nicolas.Ferre@microchip.com, davem@davemloft.net, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH v3] net: macb: restart tx after tx used bit read Date: Wed, 23 Mar 2022 10:08:20 +0200 Message-Id: <20220323080820.137579-1-tomas.melin@vaisala.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <1545040937-6583-1-git-send-email-claudiu.beznea@microchip.com> References: <1545040937-6583-1-git-send-email-claudiu.beznea@microchip.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: GV3P280CA0006.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:b::6) To HE1PR0602MB3625.eurprd06.prod.outlook.com (2603:10a6:7:81::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b8fbc32c-8ccb-4236-2702-08da0ca45ffa X-MS-TrafficTypeDiagnostic: AS8PR06MB8214:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KK7K7TbmzpW4Lii/a3v6kBxRTT67HU+f/HvaabMs4asNlKHNOzvHR+RGSxx85nHrakFR8ZKzTTw8RQQRL2TzxsM/ytPAJguzd3mObP3t3BPBCLqbru7eEo7omPCKWDYbtp9Qx5OuSPlIk7hSYk31UEF5t6MujYZnjtGmNWHRppjmFf5Ma3HKyscTohzneApaFi9sTJUdljH9HqdyytgvgWYiFaqDk9o7UTZmlk2kQWbslvxs0FuuRzBZTrKm2ermcqRclOX8QsHh+qvTvsA7P0S8oqjOD8MXTE5DSjIeTf67LSSdRbrjJNNDK+llrGj25oU0YIO//TDDz8xYUXg+hFhvY1MTuheofNqMjshKLq257wPwU3IwY3tSWaF0NFoj1cD5BC0laPM07spSgmeoQwBvGtmHFIYvdPDKQiiYtv4mE9cQI9+U4WGWnpq9Oi6B84wGF2YK3y3WYtvO2xftA7Tab6U/GNGiHpOGzRLu9wm4wLxemWhPxNKJhr35nZDeiGA/7XoXXOcAeuMtSFiQuAqqKvMTLAD1ODg9LQQ6uHt8XDFNp/e4wBZow5PTo0zaF+/JR7eMLbYI0jXQ7a8HbyjTfWgW++KJjMfkrnQLBLVN0ovz7hkBK39U8cMybakajZt5rSxqEmTB1l60BkQlmL8mwdW8wppw6KWcATAA+SFVhVfLZfsqcgDilNN3YzjwuTr9fofSn2hNQKCNA/iiPg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0602MB3625.eurprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(8676002)(2906002)(38350700002)(38100700002)(6486002)(6666004)(6512007)(6506007)(52116002)(36756003)(508600001)(6916009)(66946007)(2616005)(4326008)(66476007)(66556008)(186003)(1076003)(86362001)(83380400001)(316002)(26005)(8936002)(44832011)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?tZjl4Y2dSo1P4ECI5xAcAVjBWduZEdhIX717BoCEomQAKio3V74ncDzY2GbV?= =?us-ascii?Q?GITt772ZeiN26Jtr9bnwAiwQt3EILWywROUjzuIn1lM1d5hpGkKfHykmIbw3?= =?us-ascii?Q?oU2K9YvNhVhpJqSPwDOt5JqybJqXHMCaMcZ6b21o9RfzzmZ30WewCR2wqZ2W?= =?us-ascii?Q?X6W8yUvX+e32Qg5sxFlVivTKe5Dx24jEuEiWtMkUyRI0PxgQr/frQn06xeeF?= =?us-ascii?Q?hCgwuNXuL3RB3cNhfQunl5FMOW3MGZZKGFc3b7eT8g4dT3Z70j4wsygVvtyh?= =?us-ascii?Q?s8RY0eN8Y7AsXoEi1GB5Y/WJtzel7FTClSLoyCzngW/tyPIXmGOLHOTaAMla?= =?us-ascii?Q?C1JappW4UG/JnrKZuGknMrHm13/L4S1B5Puk7HiL5z0+PXzg/BJo3Sf9jwoO?= =?us-ascii?Q?t+kLLCR12EjhqWtYKyu47678E7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?= =?us-ascii?Q?w5tfH3HXlWx5A5kHEFMSaZt4/rbcyxPFN1n+uGREfaixtt0BLIX6A3iGX5/H?= =?us-ascii?Q?67ysZdmy7I/XyccdhN3IMDpRl80aE74izqCnbtETcT/f65zbblq5eoc8YfcU?= =?us-ascii?Q?O4X9S0vvhaJti+9gB+D6K9awlAd/wz8sJrjs0L6ASxGtReVuO5Hhsw=3D=3D?= X-OriginatorOrg: vaisala.com X-MS-Exchange-CrossTenant-Network-Message-Id: b8fbc32c-8ccb-4236-2702-08da0ca45ffa X-MS-Exchange-CrossTenant-AuthSource: HE1PR0602MB3625.eurprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Mar 2022 08:08:55.3089 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 6d7393e0-41f5-4c2e-9b12-4c2be5da5c57 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6tsxSxyWbIFt5zRY3PsAJIAVspmHP7H3FhwugircE8fB1pTWYzkGPgYQrUPM9GCsjNYb7d67FPFwTFt57WQgCQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR06MB8214 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, T_SCC_BODY_TEXT_LINE,T_SPF_TEMPERROR autolearn=no 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 Hi, > From: > To: , > Cc: , , > > Subject: [PATCH v3] net: macb: restart tx after tx used bit read > Date: Mon, 17 Dec 2018 10:02:42 +0000 [thread overview] > Message-ID: <1545040937-6583-1-git-send-email-claudiu.beznea@microchip.com> (raw) > > From: Claudiu Beznea > > On some platforms (currently detected only on SAMA5D4) TX might stuck > even the pachets are still present in DMA memories and TX start was > issued for them. This happens due to race condition between MACB driver > updating next TX buffer descriptor to be used and IP reading the same > descriptor. In such a case, the "TX USED BIT READ" interrupt is asserted. > GEM/MACB user guide specifies that if a "TX USED BIT READ" interrupt > is asserted TX must be restarted. Restart TX if used bit is read and > packets are present in software TX queue. Packets are removed from software > TX queue if TX was successful for them (see macb_tx_interrupt()). > > Signed-off-by: Claudiu Beznea On Xilinx Zynq the above change can cause infinite interrupt loop leading to CPU stall. Seems timing/load needs to be appropriate for this to happen, and currently with 1G ethernet this can be triggered normally within minutes when running stress tests on the network interface. The events leading up to the interrupt looping are similar as the issue described in the commit message. However in our case, restarting TX does not help at all. Instead the controller is stuck on the queue end descriptor generating endless TX_USED interrupts, never breaking out of interrupt routine. Any chance you remember more details about in which situation restarting TX helped for your use case? was tx_qbar at the end of frame or stopped in middle of frame? thanks, Tomas Melin > --- > > Changes in v3: > - remove "inline" keyword > > Changes in v2: > - use "static inline" instead of "inline static" for macb_tx_restart() > > drivers/net/ethernet/cadence/macb_main.c | 21 ++++++++++++++++++++- > 1 file changed, 20 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c > index 1d86b4d5645a..f920230386ee 100644 > --- a/drivers/net/ethernet/cadence/macb_main.c > +++ b/drivers/net/ethernet/cadence/macb_main.c > @@ -61,7 +61,8 @@ > #define MACB_TX_ERR_FLAGS (MACB_BIT(ISR_TUND) \ > | MACB_BIT(ISR_RLE) \ > | MACB_BIT(TXERR)) > -#define MACB_TX_INT_FLAGS (MACB_TX_ERR_FLAGS | MACB_BIT(TCOMP)) > +#define MACB_TX_INT_FLAGS (MACB_TX_ERR_FLAGS | MACB_BIT(TCOMP) \ > + | MACB_BIT(TXUBR)) > > /* Max length of transmit frame must be a multiple of 8 bytes */ > #define MACB_TX_LEN_ALIGN 8 > @@ -1312,6 +1313,21 @@ static void macb_hresp_error_task(unsigned long data) > netif_tx_start_all_queues(dev); > } > > +static void macb_tx_restart(struct macb_queue *queue) > +{ > + unsigned int head = queue->tx_head; > + unsigned int tail = queue->tx_tail; > + struct macb *bp = queue->bp; > + > + if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) > + queue_writel(queue, ISR, MACB_BIT(TXUBR)); > + > + if (head == tail) > + return; > + > + macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART)); > +} > + > static irqreturn_t macb_interrupt(int irq, void *dev_id) > { > struct macb_queue *queue = dev_id; > @@ -1369,6 +1385,9 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) > if (status & MACB_BIT(TCOMP)) > macb_tx_interrupt(queue); > > + if (status & MACB_BIT(TXUBR)) > + macb_tx_restart(queue); > + > /* Link change detection isn't possible with RMII, so we'll > * add that if/when we get our hands on a full-blown MII PHY. > */ > -- > 2.7.4 >