From patchwork Tue Nov 23 18:54:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yannick Vignon X-Patchwork-Id: 12635181 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EAFEC433F5 for ; Tue, 23 Nov 2021 18:55:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231582AbhKWS6s (ORCPT ); Tue, 23 Nov 2021 13:58:48 -0500 Received: from mail-eopbgr80047.outbound.protection.outlook.com ([40.107.8.47]:24470 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230026AbhKWS6r (ORCPT ); Tue, 23 Nov 2021 13:58:47 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cpgqdB9GbsOZhsp9k6MQUTg4Cw87N9FH1/OpcKnPkFbe7qmk9WTIDTTmIH+vraNH4eg6ZJJ/JcR9laYExU3JnUM8CFkCmg/x7j3XHEcWsRYzhWVWdwPA1/QL60VTXuFWsmO3tRXhZiAuExTj2bKjl7AlV9hoqts+lC+lAjAzA1FT7WLR2Ap4cj3qlaNpqA9APu3beh/Eyd2HSIfSxgg2iD/zMGcbfugKaG//Tii8/M24keaH6TM7rMx2dqab1DyBwoO6xj3z4+2cm4BvX9Bmf6UxhQDkmfzrlKC7k43T1kCbbnSz5e/amb3lFwi4nazQPAPABevzcoHtSjR37hYklg== 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=v14jD8CoKx/WexifwqMs2n3CVqxyMvz8fsI8O9THTps=; b=LE3pAfquWvN2lNIUp0UhoOSSj6NK61sKzmRkyAaqaoSkVdf14WfCo2GsgA9xir1zvlF4/YYdqldYOXULXebFLuuK8ytGU5cIU9MXkK7OkMo/p8e4oh5XjSnR2AFjcHzaY/RqpKAn9FoZJQm0powur6HWss8KFhwXXi/Yh4gGIgCwM6gqgu/BGNvNdQDzzdsFxXu64qJ6smhRYt201R0zQToEwNZ4yfGtkKw5ma1Hk6+s9EKK1BeIxP9WUTCq0gAiOPkcXxZhYapznHzgDDFFkku7UZjtwRJ0G3J8SwzMxtP4i66LgceMsg59hSlZeY6TrgO06kMTcA1IcWaLR91Mhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v14jD8CoKx/WexifwqMs2n3CVqxyMvz8fsI8O9THTps=; b=SEuyCAJfPAYQdRSxO4/4Z5CuZWcGeCEVwNhL7SorBpk4lpKaFqSJKpouQqNxExtpJ/gPoG9Yb9/WHCR1WdMuANovgdNM6C7+Jc87KG+Ts7fOfEP27+SndH6HpivUiTsOA8RUO+C9Sgj03YV+OmUOQNnQQOUbk3MIS87H4inYcm0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU2PR04MB8807.eurprd04.prod.outlook.com (2603:10a6:10:2e2::23) by DB9PR04MB9451.eurprd04.prod.outlook.com (2603:10a6:10:368::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.22; Tue, 23 Nov 2021 18:55:36 +0000 Received: from DU2PR04MB8807.eurprd04.prod.outlook.com ([fe80::59d5:83c8:cb6a:a115]) by DU2PR04MB8807.eurprd04.prod.outlook.com ([fe80::59d5:83c8:cb6a:a115%5]) with mapi id 15.20.4713.026; Tue, 23 Nov 2021 18:55:36 +0000 From: Yannick Vignon To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Maxime Coquelin , netdev@vger.kernel.org, Xiaoliang Yang , Kurt Kanzenbach , Vladimir Oltean , Ong Boon Leong , Joakim Zhang , sebastien.laveze@oss.nxp.com Cc: Yannick Vignon Subject: [PATCH net] net: stmmac: Disable Tx queues when reconfiguring the interface Date: Tue, 23 Nov 2021 19:54:48 +0100 Message-Id: <20211123185448.335924-1-yannick.vignon@oss.nxp.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: AM3PR05CA0145.eurprd05.prod.outlook.com (2603:10a6:207:3::23) To DU2PR04MB8807.eurprd04.prod.outlook.com (2603:10a6:10:2e2::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sopdpuats09.ea.freescale.net (81.1.10.98) by AM3PR05CA0145.eurprd05.prod.outlook.com (2603:10a6:207:3::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.22 via Frontend Transport; Tue, 23 Nov 2021 18:55:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 38c364de-166c-4909-3a6c-08d9aeb2d557 X-MS-TrafficTypeDiagnostic: DB9PR04MB9451: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sX26wpPrp8No++OywKn+FL960Hem3WM+9TO7cN9FeKKO9G+kgUW7QOkbCAAH+1Bcas3zZBagfxhcoWf169uAziyiAwad/wMGaUHJxr17zeV8gaC24JLbYAkSgbZ/YFLZJD/t7m+m9ronvPhduExovUN0EVdKi6If1NP6oll6HoXy5NV6AyHa5YuWnXTI5WQ3k8W6f+W4VfY+kKM1cd3wDoKDZSD5sXjoMH+sPlRj8vQnU4M5/JdYvIORVi0NDm9yh+/s3hsJIoaAi+qfMf3k0JVJujdwC1nCekESA3OSLXe839+99OxBbnldf9CHgnpqfMt85bp0NU+A953RJbE7T/Rcax4TJDiFqL8JSegVx4EHhm2YNLF5Z8e8dyVOaR5/9M1IPwu47PL3EobqnOT0ZK7Gh2Q+9Bl8hNK1cqqmig5Fjmo/mUDWPYL5Mhbzx1yR9K57jPy41zE1KVVSZ2wqVz0O86NaBHOyAbOjplb60QELyZvsZcPSYX/iMP9gJkrYRzuAY/GRhbqA9nuCgKOcCGW6E465ubJXvtOrv4YqjGvsHvJK9wMvCn1eCHPXoFEOyx28V8mbW/ohYPCBOLq2eDZryYb+mvZKcHinc5+TvizMKePyKyKOT7YSDwydDT+Z90Skxad/hOrCvyQs7oo9pfAp3oNHAdTwnkeXYUzg/6b9SdANOdopT26sdHQfwlUEOlomjGwZokefVdcdeUYxkuColstkeBzAVwMHFpAlPk4= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8807.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6506007)(316002)(26005)(4326008)(508600001)(38350700002)(186003)(8676002)(52116002)(1076003)(110136005)(38100700002)(44832011)(6512007)(6636002)(8936002)(66476007)(66556008)(2906002)(83380400001)(5660300002)(86362001)(6486002)(6666004)(956004)(2616005)(921005)(66946007);DIR:OUT;SFP:1101; X-MS-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Ush7pCx3uKKIggqd8J8NQiDFMpudAocMDpe847/0gDIuITUbqeGISOqfXmxy3FiokXc3Fopi0vpnfugHxNLzjpWIXvhkvQ4NoyvBbv8+Q5u7bnW2ZcN1sdF11QNRhPtEQQ1JPp4l70A9L3dMXg1KWzuLr3EdVx3G0hQ056psfdg6cqn+wSiEpVHlGWCtIURPgN4vqhODmj/Ypc3LlOfR1ZELKVUIYNTnarvPB+PnT5A7sQVVRUiopZciS6h2EF2MQ82ruJS/flj6jNDs2/7YsvA/XBNHRFdxmUklBSjIAVzR77iMKVcIZUc9VSlumkZqJ2GQD7V38GHCC+CrzFEyFW31/WH9FwgzhWlFmGkYAA9AEyQ3Rpli29ApMaXKwpubXY6MyN8f3JU0uZ0hFAHXU9nXiJ/0gxywPLs7fktJI/9r7BHXIWTGdd7k3nk0qBURrIhBmSTZ2NBpGH8VU6WvguNT/Z0T6rFxTxotYnilzgbixB24FG4JF8QvFJ66BgN4CBB8RRtom4UOMwQuAZtXPXIx6j/t8IsmQQRw9YyMdiq4+73GsgDDPsYr+QAc+VWGnDjsSj/o0vb4gLEULQXgAjQLlowgFBgC6sKVYd4qneW74= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 38c364de-166c-4909-3a6c-08d9aeb2d557 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8807.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Nov 2021 18:55:35.8083 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: R9/S8Obdz32SKEL0Fd5CiHQyCyTcnv7qwCe5vEOQdFuNvULa3abi5YhGTaPEhXF45PKasL1JKfFcrWwi6mt4CQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9451 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Yannick Vignon The Tx queues were not disabled in cases where the driver needed to stop the interface to apply a new configuration. This could result in a kernel panic when doing any of the 3 following actions: * reconfiguring the number of queues (ethtool -L) * reconfiguring the size of the ring buffers (ethtool -G) * installing/removing an XDP program (ip l set dev ethX xdp) Prevent the panic by making sure netif_tx_disable is called when stopping an interface. Without this patch, the following kernel panic can be observed when loading an XDP program: Unable to handle kernel paging request at virtual address ffff80001238d040 [....] Call trace: dwmac4_set_addr+0x8/0x10 dev_hard_start_xmit+0xe4/0x1ac sch_direct_xmit+0xe8/0x39c __dev_queue_xmit+0x3ec/0xaf0 dev_queue_xmit+0x14/0x20 [...] [ end trace 0000000000000002 ]--- Fixes: 78cb988d36b6 ("net: stmmac: Add initial XDP support") Signed-off-by: Yannick Vignon --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index f12097c8a485..748195697e5a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3802,6 +3802,8 @@ int stmmac_release(struct net_device *dev) struct stmmac_priv *priv = netdev_priv(dev); u32 chan; + netif_tx_disable(dev); + if (device_may_wakeup(priv->device)) phylink_speed_down(priv->phylink, false); /* Stop and disconnect the PHY */