Received: by 2002:a05:622a:1442:b0:3a5:28ea:c4b9 with SMTP id v2csp730069qtx; Mon, 31 Oct 2022 12:27:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4MUca5uHRSEmSOA4i8m1VAkLmfxPqwtx8bEJt0UP1qiD/T+YrMJaMiPsTIspUsZQIv3GZF X-Received: by 2002:a17:902:820a:b0:178:456e:138 with SMTP id x10-20020a170902820a00b00178456e0138mr15664891pln.145.1667244443114; Mon, 31 Oct 2022 12:27:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1667244443; cv=pass; d=google.com; s=arc-20160816; b=bLPhsUX5yNqHw4Qy2HTyF80OtS1/MkT5+gNi6x4VJamuEy0zwm0DWgm2opTXgYn9CV byBnrDhYEJLvE4n7enYl2YR4ft09giIpE03N4ZmG70V2zNwQ28svSHcIRxnnv7c1AtJF W/4g2COzrYXos49CpwzXNbPfVAgP6PKwH55r0f9pqbGRGTOl66hKc56sSJ0/Keit7ti0 XwbjEk92wWxMQsOcl0KUMEgfSKZquCRvHmA3bTP2O3+5cwrvx2+Csf8EIbOYw58VyiW+ HL1dE/2FkdYK5F0Aivel0MYmehAcMHKm4NHgORvVulzRQkzaRfmCUlem0/ZUA6H7Ztst XWAA== 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 :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=c/C4kifzUKKsES+cooWq4imyJ5Evnkf6Cdz7TJh2Tkw=; b=1CluRVtLifxlNwrOO6vg8VSg47sPzuovux4E/J85GsvTYcjsQoT/1DjhnwumFbw28Z z6wKGIN8KkzyQ6i1zOWcosgNPo9EIEXv183HendtBooMOFq6tReUgVMLD5EMppSWmzOb KGdRB1D2MJdwA1qH9La5PxH+x+56I7farv+JWG8KKv5Fu422VIWidgvxgvQkniNTqJiQ BH4kL2HVKLnlppegfzhl+YRKuGTPmG09x05A95mFTl4m5F9cDA+oM5o+XSTj0rDP4X+7 gU34x35f7xxj9UOuTy7AzLCylSRxwpVHRcL7bbgknzGy8ygGiCUjdz+xR5eoO5PV8tJp a8+Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="T/QGBbQw"; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pq5-20020a17090b3d8500b001fe1c9436b1si9760433pjb.86.2022.10.31.12.27.09; Mon, 31 Oct 2022 12:27:23 -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=@nxp.com header.s=selector2 header.b="T/QGBbQw"; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229961AbiJaSeI (ORCPT + 98 others); Mon, 31 Oct 2022 14:34:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229827AbiJaSeG (ORCPT ); Mon, 31 Oct 2022 14:34:06 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70054.outbound.protection.outlook.com [40.107.7.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41B3C12626; Mon, 31 Oct 2022 11:34:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ac5fLu2wTyu5ECP+ygv/bEWljQRZQX5IjHEelSsGGiMc94cItc0YaurnBoqC8sRbXcxXE8ekOwl0v0uU2pFka9Me49h89Bvk91laiq6YadvTd/ZXoMbAn6ehzVrNGotDkrXtD2b+Ig4fA3uOHCyCyGQLJ1jK7ytXrGvdJ03b7gC1O86JUn9pc+kM/Ip4Yp18ieKdnPHjGbNPhZl+ril7DRm4s3Pu1H3gqCvfnAmGvmtG9EI4WaFELhtghm3XrtKSFJscuBjrcyExarxq6gT8ngGbNp8tDH6R66sjJM+Uf5uipGwM+dobsNdLxhnCFX5Zav+RNapGtEXVDY+Tyn2isw== 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=c/C4kifzUKKsES+cooWq4imyJ5Evnkf6Cdz7TJh2Tkw=; b=Hsm1iaKoPNuumRBXiRpdTFbPAC9fCGqvEM4uK1qi1pH3NCJho0rnI0xge27Q9AbCmJ3bXwPUpI5v6xNBQ+5yavW6yLpF1JXPFGR2LhaVgq6sspi+P8y7PsNzJUKSinxYCfZJZsYO7gOo5KtgTNvP3yiyhmLUmPhBuTEmc7NZwNI9uMzGBSXcB/9D3YYWPVOAdonF+cSVAce0Iy8fzkFPnmwU2H4zyVTOQFQhzC9cAe/EyzDxtFJT/WPQnXEvnCaIyb1omtxzIpbAaXc2P6Hgbj/M9YEgjAV+HfEf0EsOL3HeVRo+gUEC8Lkhy1sqSliR4C0IJCr1Nll3CM2fK4bOaA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=c/C4kifzUKKsES+cooWq4imyJ5Evnkf6Cdz7TJh2Tkw=; b=T/QGBbQwe4F3YnY6Db4+hvpsPhEfBjAXcJ/LR3YK7doxiswWmbWyYrjbTLFSNEGa62i9XUVTpM+gyCTktKyruPJPTeW5hO3AZfUyEJ9ddbz4mvcsrQSCZkq9+qPDFS9naf/knFl9+o2JBB1beHnDlMeWpSUTwN+eRDrE7+uDLNk= Received: from PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) by AS4PR04MB9292.eurprd04.prod.outlook.com (2603:10a6:20b:4e7::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15; Mon, 31 Oct 2022 18:34:02 +0000 Received: from PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::b1ab:dd4f:9237:d9f8]) by PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::b1ab:dd4f:9237:d9f8%3]) with mapi id 15.20.5769.019; Mon, 31 Oct 2022 18:34:02 +0000 From: Shenwei Wang To: Andrew Lunn CC: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "imx@lists.linux.dev" , kernel test robot Subject: RE: [EXT] Re: [PATCH v2 1/1] net: fec: add initial XDP support Thread-Topic: [EXT] Re: [PATCH v2 1/1] net: fec: add initial XDP support Thread-Index: AQHY7UT3Rg7ikccfbkSHV941HzNcma4ovLaAgAAVGBA= Date: Mon, 31 Oct 2022 18:34:02 +0000 Message-ID: References: <20221031162200.1997788-1-shenwei.wang@nxp.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PAXPR04MB9185:EE_|AS4PR04MB9292:EE_ x-ms-office365-filtering-correlation-id: 633a0b81-c9d1-4f1b-30ea-08dabb6e7be7 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: lTU59zypKU1n1zI1uVBQ2BcdmsUvpPNkrsyJxsg5CM0yM9Qv8jwYgjnENTmA8tqJZTOgMRpleX1wgSNdQ1fhrLGhUnEYIilxkGGwR3TLA9o5Gow0qrX15vr2K+Bqd13HA2KlarmQKMDzP1BPkAwSlisS04gU27Alpw+lqk+hOvFbPafZm2katXDoaOjYUazPOKZ5wUt3d2PKpFJNGOK6dfgIXzVbyGVuXT+kaYV6r5kdTXPEC2BlYE/I3f0BwXQRA84ZFXwG++1Xmd+S3EgZsMwRwjM+inpIskYXs5z0BUcKZucGPB7MT+fnYSXFkTF3B4zrxqrvJORq4aONym/P2v/U0mS3wyXzGXyaO+TRPnGkYhjP4/+pEuJLaC2d/iyBMckYG8WnXLvAoYtl8iiEFtmTBknSeR/OFQ8wIacZI7gjWwHIcovdL+3MQYbI0vmgoEZsfY7tx1NPHvgPMsEM/R60TWqkqHm6FV+l1C4r0rPrVtQY4sLyKy7ey2r0N9O+2EbRer2XUf9Au80r3RwlgllcWzgnMC60Bz8ykyt2v1TOEX+yp+9Jk3/+bKpm/5EFuWM9UEI8NLq7hm0resyrKTB5Frc8IFlfUHie2S8qSsODMiApB7FBltvnWG1Z2o7Nva29Wz104eSJFBa/pvhxnNZ34kH0m3JXXM/5tIpp6nvZ0JTAZ1zODnFgGZMcqW3Dq/VP+XzcgEH/2HhkGA5XBrJWowOmYVWySFM2NlPxOvtPYnxgrsRE74Y43C72jbur14Bw+Rd8uvl9F22yUNd50Q== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9185.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(376002)(136003)(39860400002)(396003)(346002)(451199015)(86362001)(33656002)(38070700005)(38100700002)(122000001)(71200400001)(186003)(2906002)(9686003)(44832011)(55016003)(83380400001)(478600001)(7696005)(26005)(53546011)(6506007)(55236004)(41300700001)(66446008)(64756008)(66476007)(4326008)(8676002)(54906003)(6916009)(4744005)(66556008)(316002)(5660300002)(76116006)(7416002)(66946007)(8936002)(52536014);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?VPlZFQI2yZKGZikmsHWTT4yMhsZahKi8FquyHJGIuAp5aLJkkuDTk4kLJdPk?= =?us-ascii?Q?/Mm716wcEd8/Wi/2QMynXTaXhv0Am96g8YIGfiTmKetxywACcFAhwq8t8Ir4?= =?us-ascii?Q?bVS0YGJHTCTaO4bJ2WOrwPJGTXrrXLtXs8D8zQDn1RyyMZp0kpl7JXgt6he5?= =?us-ascii?Q?lpc9MNEUsIAPgAK1SlwLVMRklhsYpV0uMzipD+l8gYYhmAiciXKlD/X7yzgk?= =?us-ascii?Q?HCLJwYc3p0Soj0tg5H08/knZ9VySZ1DZTzZl+iaPUNhO8XTRjW0I+eHNqDp6?= =?us-ascii?Q?vO9vzh25dcZqrAbF8iPbDWFKnYs2ZB/SpmwfgfpWOmOPJtdorlgolZ/Yfzjn?= =?us-ascii?Q?kjXREZTu0mkBZsYW3Hn/P6iWEq+SyzmK85/5RhtdFoBWj5a+0ft8Zgr9ilPe?= =?us-ascii?Q?/lC2WBviErlhgnuM2R2G8ah4sp/vaenmwKUUxKtsEM7Iv5lv/VZuj88AsK/z?= =?us-ascii?Q?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qF7wBzUNkdvBFpaOE4SMHRn?= =?us-ascii?Q?DZOXJq8uojCUp6QAa7jdequCNuW9aeBQHgv/2mXUV4HWqIuyvrpgtJjk69SM?= =?us-ascii?Q?NrR9rwaZFFj8UAVhnrBUsDYlVcZOwhXYVJXs8EpkIlO6BnukeJ0LEqILwqlV?= =?us-ascii?Q?EZORf1C0G8GJGCH9Llt70cu9xKHO5aNOqgZGEy6ifdLsJY7zbPocIo27xJFy?= =?us-ascii?Q?jWY6HryaXbhQBefYMAr3sXJUqhSdn8SNKpdKw9xo?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9185.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 633a0b81-c9d1-4f1b-30ea-08dabb6e7be7 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Oct 2022 18:34:02.5423 (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: qRs5sMRvKUdyTV7vAbhNBlSn9gSi0DYT8tO8upzdrOfWZLEl0wkfGswC0CHn3I+EMV6Te6EY/E8MKRHOBu1aBw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9292 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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 > -----Original Message----- > From: Andrew Lunn > Sent: Monday, October 31, 2022 12:10 PM > To: Shenwei Wang > > + cbd_base =3D rxq->bd.base; > > + if (bpf->prog) > > + rxq->bd.ring_size =3D XDP_RX_RING_SIZE; > > + else > > + rxq->bd.ring_size =3D RX_RING_SIZE; > > + size =3D dsize * rxq->bd.ring_size; > > + cbd_base =3D (struct bufdesc *)(((void *)cbd_base= ) + size); > > + rxq->bd.last =3D (struct bufdesc *)(((void > > + *)cbd_base) - dsize); >=20 > This does not look safe. netif_tx_disable(dev) will stop new transmission= s, but > the hardware can be busy receiving, DMAing frames, using the descriptors,= etc. > Modifying rxq->bd.last in particular seems risky. I think you need to dis= able the > receiver, wait for it to indicate it really has stopped, and only then ma= ke these > modifications. >=20 Sounds reasonable. How about moving the codes of updating ring size to the = place right after the enet reset inside the fec_restart? This should clear those = risky corner cases. Thanks, Shenwei > Andrew