Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7824455rwr; Wed, 10 May 2023 13:12:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Qrt49OVER0w6BFheCUzEmWd3FjnaYSO5Otxp6ob4/MJLuPTPUAoSBiw7bJA/nESz6hKVK X-Received: by 2002:a05:6a00:1828:b0:63b:8dcc:84de with SMTP id y40-20020a056a00182800b0063b8dcc84demr21534944pfa.4.1683749562041; Wed, 10 May 2023 13:12:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1683749562; cv=pass; d=google.com; s=arc-20160816; b=rntlXffK4a3hl1pvVtzEKIrjC/EwX7CwuatrHuBDQ93AGb6LaYyFG0s2nb1gs+xKPj 1t7CT0QC/cSPjS/3wn3umflpDzdABRV0o2zPWcUUrfQQdWm7So2LEGUZvNOUAiEAy1xw Fe6yA3V3sKnGfx6nW4xUD3MrvroCX+rSnrM1aLQRvRERprwZ13bc7BALpYWC/KYwRff0 jOHRdLFuEpXN5NPqKzuwHuOZP/UEfwbiVmTCcK6zuIwWCCJxHM/v2r1vp9sjxHPJQBar d95JVDQvyPWQ7j4gnAb2rvGQdls2uWiJNv+91pbwDY/IDR2qKnVL8gw+c/tl6xq1lF9N fXbg== 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=L+lBEg+dBLko0PB35HiDXVZuSacoYvd4clpEPpLDoyM=; b=ZwxJDcY9DmgtwUcXxmWqZHZLQAAYJ4A/I6dGT/Sp61sTl03BRRSIINw+USrTH6c02S IErNjGCMmSHBW2HOCu5PZ7Z6iKbv51zoEeNm6A6XiaKU9S6fUobxemApH6cNDTiJTV+9 ot1YN4KDxoY/Lz+VJXcyiF1QmwLLHPU5qMfeRW34WItqV36H1z070fVQVM+fucqFogXa 1cd95Lsow5HnWwAsGGkJDDShz4VJaXkM9HTgHUp8ha7sBrSk5G/GfQ3MpKueOuBorYow HlUTiBhCyWBear/hQY4RjHO3iTge+6piWiJKVJjfn/yZhpMpbOlmqqal+H84o/6HkvOb +r7g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=PGTtSqIQ; 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 i17-20020aa796f1000000b0063788e7589dsi5811937pfq.95.2023.05.10.13.12.14; Wed, 10 May 2023 13:12:42 -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=PGTtSqIQ; 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 S231468AbjEJUFo (ORCPT + 99 others); Wed, 10 May 2023 16:05:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbjEJUFn (ORCPT ); Wed, 10 May 2023 16:05:43 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2056.outbound.protection.outlook.com [40.107.20.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C56513C38; Wed, 10 May 2023 13:05:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H4xJitITL/pD8mj4ZCyW/hsxcqEa5UoGJCrnAY3tegqG5ZQBVsyKV+rTv0jUYGzEuGFafJl+uANMdqWVEo5pAMdIzGRxwA06BCcQYX2+s/fihEL6QR+UlXpC1ztY5BAr/G1gzcgx+U5KIrmW+S+DihF0ee76JZYqYpuXI9/w7bTdRw2uB9/M5eNXe+qdlhPZEyjQEDhJdrhlypUCxTbx7OaABPupS+YZRb0IPccWbSahPrnxoSiVo3b/y1eW7D4q8Ollg3qTtj/vR7cMaag9ejsPhzGonqAoVs/HW7Bi6jm6/dVznLQun5FRpA19YWVJmb+P+ttkBKOkEUxhOIbAig== 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=L+lBEg+dBLko0PB35HiDXVZuSacoYvd4clpEPpLDoyM=; b=bjemSVH8KyXFzi5TKbJsNrjo1m1Ow+nLYcRt6MuQZEMG+bNE5ilGun6KtNCxi7TZ8gqYRXraxMCkixpYqzjQzyvv8y9Fzow6BxqEIcEAgULNUae1HKZVCzCOBVksSQM2QvUXEPFTfW/ZKWb3LETDPZBgZG+xCWJIIpkOY3Q3mR0rFNDR+t8NtitIBEpMYBtixBKBGKTe1kDiua5VjaFIii9uYFjFXLtNkfEI4S+EIeIpBEpFAU790/EaBLI6kp8FI9ePG9DiYqEJ6FWe0HAvM6LkTVq7sIox/PmKIF7xgtxnIxxVxUOTubt4Ms/GuNNMqvhbXIOxz4m+MkQqxXJRtQ== 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=L+lBEg+dBLko0PB35HiDXVZuSacoYvd4clpEPpLDoyM=; b=PGTtSqIQ5Tvo6XGfLEDslYigfFnBBF4jJb+8pnHhHq3H0yl47Ri5W5HWF2oYzMMhappWx9RXzf39UJ3oWxpwbaKrNxBjsKJxSDOqQ1I3f7lWIaf1kwlOmZyWURvfobtbfSup60H9jcgDADX5wPYCRnc4IbmLcGYQGMAiu57AwLw= 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 DU0PR04MB9419.eurprd04.prod.outlook.com (2603:10a6:10:35a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.33; Wed, 10 May 2023 20:05:37 +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; Wed, 10 May 2023 20:05:37 +0000 From: Shenwei Wang To: Wei Fang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Shenwei Wang , Clark Wang , NXP Linux Team , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Alexander Lobakin , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH v2 net 1/1] net: fec: using the standard return codes when xdp xmit errors Date: Wed, 10 May 2023 15:05:23 -0500 Message-Id: <20230510200523.1352951-1-shenwei.wang@nxp.com> X-Mailer: git-send-email 2.34.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR13CA0035.namprd13.prod.outlook.com (2603:10b6:a03:2c2::10) To PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9185:EE_|DU0PR04MB9419:EE_ X-MS-Office365-Filtering-Correlation-Id: 01dc9724-b7f4-4df2-457a-08db5191ebb2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DBAe7HorieiW8cAlknOny//p0nUGE6w2aOxnGmM5o7lyjB1iGksLsgjlcvKzlrWh5gl987dTE+2VC678uO1ANV7nSWl/1ht5TYJWmJjiZ/bdOKa/onQ0IVd6D3uwAOYGDJVaPA4C4qZLsmRgVFyZfXrnjiMhQk6ruSkwBjol8XwfzAaOl/y9SEIK3cmx9oibpG05CZeZpm2A9eTVVa2gBTPVyGFOz4iMODAM42sGDbvqfK/55wsWOc71qmdJcpN2zcb4XupiTiPP9/+eRgmXnkp/DfGgID0G0/JQLZ6LI9Tpy6e4ZItVpcljOnfp8A1DJAVFhaqlAmhgoEXszZkFi8OlZMXEpVi9BTHYLILA4KVVLD6iRGR0dolWgOQOkjVOIKjbyOZBha5A5+Phroh3TTLmPucvfzLOaKgYWQzLO3pGaESLyRjyDMQB97Zi64UGGh4/yTEqq7lbXymQQYYJiC1i0oRew/vWDiNZXKFDRvTK3CMcJ84Q35gy2ZAFuXSrWzHAIB7dBWF4W+yUcS9RfJCCbCEbdVL3dqtFvZCnpuPAq35gmGUqqjOXFAdW+ukfs80cNW+wpXh06FCfYUq1IGwoZsK/hv5nrzSVWDL4AkDwX6SWzqk5Sq3SkvL4bGzr 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)(366004)(346002)(136003)(376002)(396003)(39860400002)(451199021)(36756003)(6666004)(41300700001)(86362001)(2906002)(8676002)(38100700002)(44832011)(38350700002)(8936002)(7416002)(5660300002)(4326008)(66946007)(478600001)(6486002)(66476007)(54906003)(316002)(83380400001)(66556008)(186003)(6512007)(55236004)(6506007)(26005)(1076003)(2616005)(110136005)(52116002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ZMwYX53Pcn8EiY2TCx3xuP6wme1/vnQId9uTmufdftsg/KQN3vmjH8UCal0C?= =?us-ascii?Q?aAB26G1m0lsKRYFvIJmJJ1fLTfwk+oERqMr0q3987jJc9Yq/w7UQvGPtXMBu?= =?us-ascii?Q?g3NhC4+O78cpW4mRaF7ABWCNk4BPZTyh15gdRJBEzSN0eI7YwWsiqxUBaUip?= =?us-ascii?Q?z7VDVPYlQy7V8gB8JJX3GGADKsBwpTthq574Bg3aKYt3MZKWMUZqtGMo6uPy?= =?us-ascii?Q?aExBOWINigrqclDmoaXcpqvnqLPdoyFPi7gr6IFRUVd/3NGa9HIeRkvcd1m7?= =?us-ascii?Q?oO/RjDlx1voltv/6PiEFApBBYVu+mUeIRAxfsIq1kNai16JhmzhnJi0BGIgK?= =?us-ascii?Q?cDXFQEf4+KU16Y8aVcCnMt2VIy/DC2ZVKO9lGFfMS8DlhAz8OyR1LwBDT/Jl?= =?us-ascii?Q?/taHNodXwx1tDg+eavnSUWPV7qC9u1AWSEBwge3wTjCOZ1Biw3mnhOE/qaon?= =?us-ascii?Q?edxqtHZwWRyJuQM4r5UUiUpnCLG9oXia6WibkJJyFLs0o2UC4PjNHDdbAlCG?= =?us-ascii?Q?3wb+HMEr4/8eF7g3s/7849zjhE8NbzuUggQw7BXaihRg162746Ei6Pgvg9CN?= =?us-ascii?Q?IYUt7gKNde851bop3XROq7EW1mvk3N6xBoXbvbj1+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MgjGbZONpRE53ZlzmYQtYwoMjLV1QZELAhC1btt?= =?us-ascii?Q?O5CiPpWmeohwMuFYSNYQUeTKr/rBGDWC+nAG7ReC?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01dc9724-b7f4-4df2-457a-08db5191ebb2 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9185.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2023 20:05:37.2663 (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: uEe/akf1cNWtMhIoe4nc+7uJDP0p1QhlCAxQ3ldjhiG5zVSH7Y67OEzU/pv6Nh2cxDG7RQbms9PiWBwL7Ud0Tg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9419 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, 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 This patch standardizes the inconsistent return values for unsuccessful XDP transmits by using standardized error codes (-EBUSY or -ENOMEM). Fixes: 26312c685ae0 ("net: fec: correct the counting of XDP sent frames") Signed-off-by: Shenwei Wang --- 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(-) 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++; } -- 2.34.1