Message ID | 20230511152115.1355010-1-shenwei.wang@nxp.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp4462123vqo; Thu, 11 May 2023 08:25:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4jw0B+ey4dP8MPhxsrhpWDxOA5m4Vo2UYi+v4/c1OByjeFs5MsozjMmycVVGqleSGLmnXc X-Received: by 2002:a05:6a00:148b:b0:63b:7a55:ae89 with SMTP id v11-20020a056a00148b00b0063b7a55ae89mr30605234pfu.27.1683818727356; Thu, 11 May 2023 08:25:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1683818727; cv=pass; d=google.com; s=arc-20160816; b=ne0N0LbX5m0BR1JyoVeIWkD45uQ4SlnCaywpZyEKxxTtkx6qmllB0zYuxF4rFG2w5O BvKttPNkfdIN50d3V3+kFYEqvFpWccFhUjA3uEUynBZuUy6fJ7DBGeT0Cr1GXutE/uri WZcv4sicz2vVmy7zUqkGz1gk5tJ9DGmVM6BNvM/JFXjCGv52S3GOgobV5FviUCtL/P76 OdbxAe8bHGpvN9IBxt/lHeMq2QZHnWmGlWd72pdRCyEnWFvoWK/7edZSI5dgEwsX0GhM i0fIU/lsdglkwQMSRlYxAmVmaq3jDB8Lj+jEaEaup5nMHXhdiA3nDqNogqPQBYx5tfT9 IJ+A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=q5sUeZMnNsQcm3LajAujOtB5TursVNZTNcPqagCNQYQ=; b=lUDxHgBduKkvpyKodeb2M3NpiQl52KLXZcmlg+binNZiOGGQcH8IGvDYHiSFx19brQ iuGAeRX5bsWNVB+QqnaaiSi8M9lHdB9XUDqBDOZ8x0e2JBRsZPsAI/QsrglnO7PndB39 PTFWlCctoOjppwClrwzb2bm9CgYl9QG1pPHb0LSqXQ62CLRbBbZrYHqaxPsOYrkv4bdm amCj1jj1jdJFecQ/WW+KNSyY3ebDzMEhQrMy9m4165s14vaebYQsmxtfSab2efBY+mqZ BrHiIILNQ90ocFErusKpBEeDn0Wvufzj1FCUFdBgOkhickwZ+rIuz/Ltbb8kKbuPFGoT i+wg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Slb1tgYJ; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a24-20020aa794b8000000b006466d7b68afsi8166386pfl.19.2023.05.11.08.25.14; Thu, 11 May 2023 08:25:27 -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=Slb1tgYJ; 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 S238607AbjEKPVl (ORCPT <rfc822;peekingduck44@gmail.com> + 99 others); Thu, 11 May 2023 11:21:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238586AbjEKPVj (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 11 May 2023 11:21:39 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2089.outbound.protection.outlook.com [40.107.14.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CABE91BF8; Thu, 11 May 2023 08:21:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C1cIyZki8O1kJ8vRo4f8D2roHQGQauOftSn+DQYoQxHy7/BDbnZBoULLGYwfzSsGVkFtQQNtld7OQCkepqljCsjqOvqPA4CvLXckSgNdSxbHIND7CTTtzKMSR8XtyR7bAFRxAQdetd/l0yUeZUTfFc0HQHqvWmAx98enqbnEpVwSvQ28Z4n9QQE9p9l4g8cVdEeyTVVHCxh9KK1eev0oH3XrJd2P+jLehnsC2YowsdMeYfeDE56L0qRAe/x4rS63gYtY6wmUr+BIuoWYOEE+Nu62W96La/L1krpiy0J6Xo2gH+FcTJo1ms1VWECfRzMBBYGhoLuZjZMfhNY1SmIMyw== 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=q5sUeZMnNsQcm3LajAujOtB5TursVNZTNcPqagCNQYQ=; b=Co27qitpwokxj+Pcshq+e3k09fuDi3jgjtVVyytzRiLgXO0KQgvfaTN8GxjCYXMqovAxzMENRZploRpCFEIjZYGTtt0r0pOzOm82iWA/3qoRNUW5zxqJV98wVsubU+qCqPR8Xx2gqypskJ/OL/yiTTtf4714rK9E2mS8OgsC37wKpSbYeQRfels1tNLOqGt74PA1yk/RwdY3Ii8EU3u/Aa6k8tzdRIGtSn5SV2wfaycBNjAxZ1IQ+HKOALeI550aI4/kMI8uV+/YlNhmlDIzVB1ntwTG2XOsHfbVIoFwnCbXTCPx5VLIZg5Pi24KzBlgoNyop8WkIfaYMJcCrhpQ3A== 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=q5sUeZMnNsQcm3LajAujOtB5TursVNZTNcPqagCNQYQ=; b=Slb1tgYJV/GD/lrDjFkA2WYuX3osX7R1v8l2GgdiHIEvRB2yxMS1dVMjS+KwfQiwkG32c6aN146uSSjiJZi0ioq3rlSSAZJDHRlf6RB6Xn/Ztoh8On8czsKlMAwVaua0jW5Jd2EqqFym3SSnSU+8mHumRgW7DhXY0bTYoR22Y/0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) by AS8PR04MB8040.eurprd04.prod.outlook.com (2603:10a6:20b:2a9::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.21; Thu, 11 May 2023 15:21:35 +0000 Received: from PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::28fb:82ec:7a6:62f3]) by PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::28fb:82ec:7a6:62f3%5]) with mapi id 15.20.6387.020; Thu, 11 May 2023 15:21:34 +0000 From: Shenwei Wang <shenwei.wang@nxp.com> To: Wei Fang <wei.fang@nxp.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com> Cc: Shenwei Wang <shenwei.wang@nxp.com>, Clark Wang <xiaoning.wang@nxp.com>, NXP Linux Team <linux-imx@nxp.com>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Jesper Dangaard Brouer <hawk@kernel.org>, John Fastabend <john.fastabend@gmail.com>, Alexander Lobakin <alexandr.lobakin@intel.com>, Horatiu Vultur <horatiu.vultur@microchip.com>, Simon Horman <horms@kernel.org>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH v3 net-next] net: fec: using the standard return codes when xdp xmit errors Date: Thu, 11 May 2023 10:21:15 -0500 Message-Id: <20230511152115.1355010-1-shenwei.wang@nxp.com> X-Mailer: git-send-email 2.34.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BYAPR07CA0052.namprd07.prod.outlook.com (2603:10b6:a03:60::29) To PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9185:EE_|AS8PR04MB8040:EE_ X-MS-Office365-Filtering-Correlation-Id: 6ec2d9ee-d221-488b-edd3-08db523367ee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9nfFmPMWXjbAm34uEA8FXd1GZ9xCPUsjFwLRNrQDBVG9SN2P4eu5wkSbOpXkLrh0TsSPT5QXW82tPLALboTld2Cobb/WzX1kKv0zSITxtvFN4t1YeGw6iwxf7QxHvdvTV1Pk9O9MSQwD9HI+3ylFqSSlyvyZ+uCJ/FjXu6OBz6lKb8E4tIDn8rmz7Us/rJTlquMOBWSsMt4Dp0DAwbMR0OoHVmIstmLMHVhs8LEMTaQQRr97SlZkLCI0fc16HFyh+Otc9uHmoK9JLGeLVqYFyfV0Vw6RRx+aBY7NcpTgbBCs4opP8XV6WxjeemF1GILQn1Hc5saVpVgfMjevIl38w1sNkJsiBDzlinMx8X4WC3rtpUIpOg3KMAhmFFY7KRlsUaTt4yIEfA4Y1QH89wi2WwQ9av3fXVPaY+OfAx0IBE0e8p7De4eRhv2I1JTsGZJ3nRikklugMSf9BFIkr1HnShHG23oeR4+T8+QA3tk229GmLAbDSHe/4sQO93T5J8ryD+euGBXCvGQLfeAWYdcRa/z2MYr99TVZWvnErUecF/iyA4ryz4Wot/j9CHiQ0jPpVUg+hXStyofye5KhCPZBBTqrk5V/agGR3USjR1sDTarP/jwaCUFNlruOnGCdmcVI 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:(13230028)(4636009)(396003)(376002)(366004)(39860400002)(346002)(136003)(451199021)(6512007)(6506007)(26005)(1076003)(2616005)(83380400001)(38100700002)(38350700002)(41300700001)(52116002)(6666004)(6486002)(186003)(55236004)(478600001)(110136005)(54906003)(66476007)(4326008)(66556008)(66946007)(316002)(5660300002)(7416002)(8676002)(8936002)(86362001)(2906002)(36756003)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9xbZisAlUNx7LKwdDt8dw38LUbryw5QM7Rx5FA1zK2S5ciRdhbc5YmyUE9HCiImakxiYhBNfyjGxBic6t5oSiBgoyqP0migJu0avs6L+ld9Ldor89e6ZOiP6IkhA2KFcicMrFTUBe9oQp5ISH5Y515uR5EohQ9YsHhAj0VecU4OyE1+FcBrpOyM2ansdZUNJYuH4a+9TwGk+KsmuZWfghhGdduyRwVoMOFACeAhhb+NS51VWTLLYh2gRbd9yrF4VTgeBOKkQHp5PIjO4nike/pk+l4G8i9UbQcc/AMDDbn5jh25iH7KhzsQkqKBi+w79+MWCK791lsrszGm7qlLQKviIrxmZyZYEH6mZMhtBq02bA20cJOyG1PY9mG2+FgNfhpMD5JcNPCsHJz6027iWoGT2ZKPiUOKs3yiN32njt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Q+nij3MfKcTrFkRBXpYFKdO60+pKlhdJjld2uPRwHzNSL4TudhhPlJh0n9dZIshG+C/MWWq9B7vDN7LKkubrwb X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6ec2d9ee-d221-488b-edd3-08db523367ee X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9185.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2023 15:21:34.6791 (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: LgdInuFRtNhyNSbJsil0W4B25aLGNpRGn36K7ApIpF56i4ndwvNCvUp0e9K5rdgRkTRHZMpx05nxqlE+RunL6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8040 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,T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765539471028704057?= X-GMAIL-MSGID: =?utf-8?q?1765611905673196928?= |
Series |
[v3,net-next] net: fec: using the standard return codes when xdp xmit errors
|
|
Commit Message
Shenwei Wang
May 11, 2023, 3:21 p.m. UTC
This patch standardizes the inconsistent return values for unsuccessful
XDP transmits by using standardized error codes (-EBUSY or -ENOMEM).
Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
---
v3:
- remove the fix tag.
- resend to net-next
v2:
- focusing on code clean up per Simon's feedback.
drivers/net/ethernet/freescale/fec_main.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
--
2.34.1
Comments
On Thu, May 11, 2023 at 10:21:15AM -0500, Shenwei Wang wrote: > This patch standardizes the inconsistent return values for unsuccessful > XDP transmits by using standardized error codes (-EBUSY or -ENOMEM). > > Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com> Reviewed-by: Simon Horman <simon.horman@corigine.com>
On Thu, 11 May 2023 10:21:15 -0500 Shenwei Wang wrote: > This patch standardizes the inconsistent return values for unsuccessful > XDP transmits by using standardized error codes (-EBUSY or -ENOMEM). Let's split the return code cleanup from the double free fix. Please post a v4 patch with just the xdp_return_frame() removed, and none of the other changes. For net (rather than net-next), with the Fixes tag back.
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 42ec6ca3bf03..6a021fe24dfe 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -3798,8 +3798,7 @@ static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep, entries_free = fec_enet_get_free_txdesc_num(txq); if (entries_free < MAX_SKB_FRAGS + 1) { netdev_err(fep->netdev, "NOT enough BD for SG!\n"); - xdp_return_frame(frame); - return NETDEV_TX_BUSY; + return -EBUSY; } /* Fill in a Tx ring entry */ @@ -3813,7 +3812,7 @@ static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep, dma_addr = dma_map_single(&fep->pdev->dev, frame->data, frame->len, DMA_TO_DEVICE); if (dma_mapping_error(&fep->pdev->dev, dma_addr)) - return FEC_ENET_XDP_CONSUMED; + return -ENOMEM; status |= (BD_ENET_TX_INTR | BD_ENET_TX_LAST); if (fep->bufdesc_ex) @@ -3869,7 +3868,7 @@ static int fec_enet_xdp_xmit(struct net_device *dev, __netif_tx_lock(nq, cpu); for (i = 0; i < num_frames; i++) { - if (fec_enet_txq_xmit_frame(fep, txq, frames[i]) != 0) + if (fec_enet_txq_xmit_frame(fep, txq, frames[i]) < 0) break; sent_frames++; }