From patchwork Mon Feb 6 10:08:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 53125 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2150857wrn; Mon, 6 Feb 2023 02:10:43 -0800 (PST) X-Google-Smtp-Source: AK7set+61SIM9RqvHEy3I1qYlKoPDcj3BPahQRAGfVkyd2RTHY3EuZwpPXmC3+dNnR/av4CrSnWm X-Received: by 2002:a17:907:2d0d:b0:88e:d435:3fd6 with SMTP id gs13-20020a1709072d0d00b0088ed4353fd6mr19415160ejc.63.1675678242812; Mon, 06 Feb 2023 02:10:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675678242; cv=pass; d=google.com; s=arc-20160816; b=ZZoR51GcYc8Ry+YFb8VeBxTCGyXED4chPI8EXPTLM8GNs7xK88HrwmhIaV3X2/PnjH y/LFooNjDjKwxZjMyEomqTvlFbKt0gDUnBfNVPpsFcndcx6BtRwXO6M8VJrc81FbKBe4 ieygfvB0Oax+z8bvTjepBmIOZofYeJI/io6wOYBclxKtzlxGo7hPwBBVMWwamXM4BPBy XXT1hxJOeXScfIqLw9E8iNoRyfgvpJRxnn4dgUFip2TY/hNnYbygI7H27GqVWfVdpq9q 58wyclT9JsVIO1uAV55oes/60gw2SzFF20UA0ygsXS6ReItRsBO/x6IBwzFne1PleiVs vXDg== 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=lPq59rGGC+c3Ifsws733MDs1xtBkSxK0aDJ8bvKbcG0=; b=EYPk7Ud2UAhs8XQd2iu2oL7HORl5p4+cMfaCkGRu2lt4QVzm69jaLtaYhqJLELf4ac nw2/oaqL5ajgM6AoFRYrvbMmutZz2LT8p2HXJqKgNILGwKymxfEin4T85VAGCH2mn1Zt OYacBdnkZsQQV+EVy8CWQ8P3CkO8O0xWUhzdFqwOfyoyAm5LsEUp1otynQChkgQWCnAK NwjJZPIQ05x+WK2Bc5kn23bsX59LotSHQZ28fW4wDVNfgFOTtP/Y7SeEokpHFPB8pYLP 0x0D0ccCQOV8XmzAUwmfFjjrMrfSi7SavJRwywZi8qHhucWxZOT+k36rNnMb66j3ks0F j2jQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=TO2WAdJd; 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 e6-20020a17090658c600b0080f0493b9c8si17753013ejs.536.2023.02.06.02.10.19; Mon, 06 Feb 2023 02:10:42 -0800 (PST) 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=TO2WAdJd; 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 S229755AbjBFKJI (ORCPT + 99 others); Mon, 6 Feb 2023 05:09:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229632AbjBFKJD (ORCPT ); Mon, 6 Feb 2023 05:09:03 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2073.outbound.protection.outlook.com [40.107.21.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CC101043F; Mon, 6 Feb 2023 02:09:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n153ZOIKmtn4mnxsonP9uvBhq65N1P63PfPPUW9cn17Nud+SOxQLuotz9OBVb+0j6awtXlZ6X199WDVcNYi4M9PpYKoRicGCJlE1VYUzmWoX6YUFCHig2eeqHfN5WnTBISvmwjpWebEaSrNRx22U8bmjdk+L0jzRBKlvbtvvTFhvsflleCz0WUXnBx+H8D5BeRYIohLhMICMLzm6QlU0O1FzDC+nfoJ8OddHSAsfp3RNdPDnGlvH1ZhiWB7rz5xqg6FXWxsuJAW5engvop4BWRDC8NvU0Wr97yiuFZdDIdGO3PYsUfTo9zaJTzNt86bR3pITTwCxnWEZZ0nlGuzl8A== 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=lPq59rGGC+c3Ifsws733MDs1xtBkSxK0aDJ8bvKbcG0=; b=ObFcwBaxciJNPCDaPlhSd9JK399XqWuO17/Xe0/cLqji8OiE5tNTcRLzac3e2AhQy7FT8Hc4bCujHvIsOhiyvF6NS+DhKNznk/6UhDdat51pD4l3f/QQn30vHACrtyBK9Ittm3YDh0dBIgiXS7rL6d1405GA8lWhBjpZnN1KGftiLc7X6tIPXdEVGpPbZz28Q+Fnn3TK3d/t58z93qbGoi1c2SnOxfS1FqxZOgMRW7v9wSn0TJXQ63KyX4VZj4CHjQQvaICcOlAS+IIbbXTqxz8CL1ly3xNkOeEqr06Jc2wmq6A5/DJtAD/oL7pN0oI2pX7npkZ9MWFCD5UuQgc9Bg== 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=lPq59rGGC+c3Ifsws733MDs1xtBkSxK0aDJ8bvKbcG0=; b=TO2WAdJd75gDT0UHjskI/cpW8hz1Uw3UWXJVAlYMqp4V2d7gFwJQWmTrpZ3AjxS3UmQlKpWQxp9TOsFgXkXFzlC8ULzDVASTUPq8aRvFFTAuhdkpUuunSXKGoVxYbP+0YmXxSbt8DqchnHzfmBMcNmXaxumjca1tVKI52Ta7lG4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by AM9PR04MB8421.eurprd04.prod.outlook.com (2603:10a6:20b:3ee::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Mon, 6 Feb 2023 10:08:59 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%5]) with mapi id 15.20.6064.034; Mon, 6 Feb 2023 10:08:59 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Maciej Fijalkowski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 01/11] net: enetc: optimize struct enetc_rx_swbd layout Date: Mon, 6 Feb 2023 12:08:27 +0200 Message-Id: <20230206100837.451300-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230206100837.451300-1-vladimir.oltean@nxp.com> References: <20230206100837.451300-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4PR10CA0019.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5d8::19) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AM9PR04MB8421:EE_ X-MS-Office365-Filtering-Correlation-Id: 7262d67a-d98c-4aee-c057-08db082a29d8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: crxutald9Bwaaw8J4DP0wPY1yxMBZF+k2UySCeFu83uW83hCWxGgC5/5/IqHAj10pmv8iLcWQwvXSrDEBuvYzB5Gt10aEQtk/pFU8NJIGAnGHL4fgVrZWqsr8dFrEhOAnes9Q7UlkcqlFoy4iaPB7mpS0GLTIGWRwOZVLcHC21+CJJwH9z93Hx5TatZQDlK7Enn51Rva9L8ku5I+qg906PEh6VqM80/8cT8V7yYj5PLsylZWrmUe4rpGDojtuR7y1zm5R5gevC5qbyYWJxrhp1gvIZunAiq1FK2VeZFLGeM4G57lyAUB2LyW8YsYKReEcojTuhey81aAinDJ/EuLq4QWPiSnY630i/Npc9ZUbseCEtgD0ySHTTqMM3nOpwcTfEKow+2SFi5vJSOxJtnYHGK/NoCe+Gr4LQg7tKr5+020eUp1EGLW2PdEHlfS1bgxOthGyMeiA/LTtqAdPWjdKyLzjFi9tttlB8IBYqYWqQ7md9/6znbfg/DeM7QJtZp2smTFCxBMXl1gfxc/QIb0Ffnig7aOWujB39tIMzPpCefSbYN2c6UdaPdAlAS/mTYPoT+gFy5GN5lURHt1/jtRy07y4WWLU3o8QXX05HTxIRdXaV2zQN6ztyyxD2CKRhWAUvi4eK2J8Oq2YPE3egtuhrbUFHIYL8cVTcRTJoRYlrTN4g0qZFbsPjdtoRghPFMNa33L3WhuF2DHRF0Pn9b/x+KmI0X/c9TKM+3Zp1XjQYg= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(376002)(136003)(39860400002)(366004)(346002)(396003)(451199018)(86362001)(2906002)(36756003)(8676002)(66556008)(83380400001)(52116002)(1076003)(6512007)(6506007)(186003)(26005)(6666004)(2616005)(5660300002)(6486002)(8936002)(38100700002)(7416002)(38350700002)(41300700001)(478600001)(44832011)(54906003)(6916009)(66476007)(66946007)(4326008)(316002)(21314003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sZ/N7eaAcxFxcDocd85xFPpMLiDqGBrCL3RAf/6KRG4l76o0Rz+YfyqOFHIwoqHyEOzrCC+VRCx73A7BeI65QiBBJ36phU8ZfRVQso9+LaKQnxstz3jbfESVua8gpZMIx0nlU0RQzuehzgkNQxcxgnzfWk9XAdE413mN3HCc1xv9CaLlgnEx1SYTnjdgjah0RjGlRtCctQTeo0nS2VbJf6VcG50pKdsZGNLK8AHvLhmlZsLKvr659kWocAfcOYGFar4PpfLw5fCSkQHD8zshRWakBjEkth+QiZllIPR+XGybiHpatkBTuIPF57b7alFzshf9IPBAh0qye0NoPZkE/ZdxlKEYhi5U/jTS6a5xMF4kNLHtKNUPve1ChAhoGoFQ05M2AaR8jtSlk3EZQZV4RJSk2wcdnPk9BF3+qL1OpvwJZd6iS55KZz5k8H/CjGSQnXQZ6mJV1j25lxuVogCXCu+v/cZq9+zQ31fdT3nZj1/HIS1Ttyq63FHAfiKyJp7PWSSzgVN3DI5mKzE8am4FI8PERw7h3hqYa0McDY2vfkbsZiMn4MyLwgBU0lbpeeFNGCZJUsdoSEDw6qk3zD9HshuN/gZtsmBV4mkGvcdRqjti/oIC/Z38ZOgXgmF+/EzBZp6Ywxivqd0tUwxl8iRKJWbmt+mmnsahVAvlgZdno81CFEo28Bu5BQaftr8+wBXajQ62NqEPr5oql4e/d2dg37Gg9C8TMtk6dgLrdIZvr0bF5tD3vcZHXarlA3PwDfdxSjnyFHtSfzLhvmglZDJQ5l5Oe4+qE5Woc3eN2htp5jjTSlamH3ICoDLHfMnJPa3P9gWwCHQIDjIpeY2qG4a3qWK+sMOfXKjvobHuFcOEJlO5Hrb+iISO8kOuAYbS2KYbqbt6GoAt4l1TwMZF1acz5O1Au6/ojtwkCWDBHuGmH8ax/Pxa+Bh9BAxA0PcbTYQHcYIlf1Vad1SRJL7hcvvbfiJPe0JVN/ymRFR8fdKZtqmYkveqGnSnjNa2ZCWswkTRrOWF9HWNam4N2eGt9ekDnakBN9EyFEskCPcm/WSHR2sC7QaeERYQHsv5VXBxGs9ojdjlQ62aGQv4ZU0og9dxKGIbDu9Bl79+AZBkc/Vvp6TATLYXRqBcIh3rZ7b0Z9kjc7iqCrO0Tjbh5AXtPMYWKaeBu3CUBZG0WrGzQKvQwJ1hrv8r3DULpLgvWYh1KuW5piHJDP5EExF4FphdRl0/isgNa/q/mU2Bs8U8tBN/hyNmxoI7wc5baUJd+dNXlZD+ePbWvFR13YOr7kE6myRnx7M3Cma1q/nsjAnn8tsDRaVO6oZx4Wu02eQn90MuIeqxw/8A1/rmW6BGF5jyRQgyY3QC57/yCC0NrF980w6yM/0TYfmYkFpK4RF6SK1MA9v9Ag5vET3x+6faBTOC33jsdb0kwOz2p1NUQxo9zKVsC5MrUHT8CuQpLCBzVfQdzLYo2enceTrRfU5QgCkpnK47S/LowgbnwhyiQBJrCbTxZMj3wJ7DY2cgktAcDnMefJLlqRKQQCVVIz388qzU0fGeVxkh//VID/f1S8DiRGI7PJRMUqlA9QMPwMRoTvjuf4oCYn6R3xlNarF3m/zFZDYZSQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7262d67a-d98c-4aee-c057-08db082a29d8 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2023 10:08:58.9276 (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: gPg8DqD8JMLb0Nyrci37s6UUX/A62B2uiOBpfrVf3XKPaOzDa9qFY0WLf4ZyIMXdIsFKriO80KyxkQAe0LN8/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8421 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757075988905074405?= X-GMAIL-MSGID: =?utf-8?q?1757075988905074405?= Eliminate a 4 byte hole on arm64, to be able to introduce a new member to this structure in a future patch without increasing the overall structure size. Before: struct enetc_rx_swbd { struct page * page; /* 0 8 */ enum dma_data_direction dir; /* 8 4 */ /* XXX 4 bytes hole, try to pack */ dma_addr_t dma; /* 16 8 */ u16 page_offset; /* 24 2 */ u16 len; /* 26 2 */ /* size: 32, cachelines: 1, members: 5 */ /* sum members: 24, holes: 1, sum holes: 4 */ /* padding: 4 */ /* last cacheline: 32 bytes */ }; After: struct enetc_rx_swbd { struct page * page; /* 0 8 */ dma_addr_t dma; /* 8 8 */ enum dma_data_direction dir; /* 16 4 */ u16 page_offset; /* 20 2 */ u16 len; /* 22 2 */ /* size: 24, cachelines: 1, members: 5 */ /* last cacheline: 24 bytes */ }; Signed-off-by: Vladimir Oltean --- drivers/net/ethernet/freescale/enetc/enetc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h index e21d096c5a90..704aa1f9dfa3 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.h +++ b/drivers/net/ethernet/freescale/enetc/enetc.h @@ -48,10 +48,10 @@ struct enetc_tx_swbd { (SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - XDP_PACKET_HEADROOM) struct enetc_rx_swbd { - dma_addr_t dma; struct page *page; - u16 page_offset; + dma_addr_t dma; enum dma_data_direction dir; + u16 page_offset; u16 len; }; From patchwork Mon Feb 6 10:08:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 53128 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2151378wrn; Mon, 6 Feb 2023 02:12:05 -0800 (PST) X-Google-Smtp-Source: AK7set/eOHvpbjDYXjiLOl/Qzxe105cF7vMw4vv0W77gIChFpIcvpixtoCRb5qcuEmVIPnyB66MV X-Received: by 2002:a17:906:39cd:b0:878:5f8e:26c0 with SMTP id i13-20020a17090639cd00b008785f8e26c0mr9869065eje.7.1675678325153; Mon, 06 Feb 2023 02:12:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675678325; cv=pass; d=google.com; s=arc-20160816; b=QLWkFgPsGRoowhMq8L88CrbWeprBGJgBrXIyhvYIbM6pA8nWSAeNBCTFrnlElHM0U6 G+hfMYvkcl+aIjHQpG6bC7t7+CrvnTLziOOH1u2AYWFFOfrb8fJjsIOlpjoFdW2IeNd7 4TmC+j+mkEZmQ+2HWy+Gf+mVtJLmbkMv3/hjrmmFcsZ5pwiYZYhAmoGRWUidAS3uRB6S tfYKwSa2VC44Oj43++AGIHRGDkJqiu38PBGekdBvH3vjUAwrVAMnCjDtJMojCk9zlixQ W9eH5ASPCrG2vBUolftRgT56XHLbM4ItjtuDKRrFhmflBzmNAvRcboVAA8vgkbxfu43d fjKw== 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=bIBCodmMkWlrfFU+8j+8jCaLQuzjatIWWGgYjkYhOQE=; b=RntDNhltSiiAnarVjUBKjuRIlkSDaqRClkaWW8JOpXhxClLEdG4yIV/jhOr+a7C67E AnVkiqwXJ8gg0bZP1MbRNQI4vS2Vl9JdSA1n3FT++32lqmgoNCORXuMqBqBqONeij090 +Sdntf4aHGPD7nLEWQU8yvpAmKbsePtMw2Wae5LiGVxmE4D3W+jVXh6S9XucWrZrnLEO DT247q87bBo6kJ/s3NsVV5dCryn7j6F9Um4LByB5Fr4k9xVdMyzSbgwNuLmzoSEicM0Q b8d/UPWycOR7Bn4qm2A4UJEuSsYVfXbutP4wy1DFKRBd5+iu/3Qn1i+3kyzShAzMEP2E k5KQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=dB0eVoDk; 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 y22-20020aa7d516000000b004829afcc563si1019999edq.404.2023.02.06.02.11.42; Mon, 06 Feb 2023 02:12:05 -0800 (PST) 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=dB0eVoDk; 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 S229776AbjBFKJO (ORCPT + 99 others); Mon, 6 Feb 2023 05:09:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229680AbjBFKJF (ORCPT ); Mon, 6 Feb 2023 05:09:05 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2073.outbound.protection.outlook.com [40.107.21.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9934512F3A; Mon, 6 Feb 2023 02:09:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nxlk0SK/bhL4ti4enT5dxjzfx97LnPmjhag6zpfC9LwwDjWkWGxkDqHtCUfMPagWjKoyOfOIUf7AEK88PlKG7uVXdMwdFP1c970sJWZp1luDX1y8SSa4l7JeB/cdMDvRJBOglSoceXH7IITurVGHQl0NtS/HCKRuhTxltyynTR7Oy889JJxEeU0avGnZF5g7Fff/8QbKy+KSN4V4Wm4GD5dni/hyQNFOhaDGmKHPfaAUUa1sHx/+RBdYWPke66wgFHBoco6UKfgt7Ux/ZSAXWBwRgmtDNLAZOcwFCWGRcbCKosImnvGFQ0P1XwEitP6jzzxqwUmr6hOpm3PXXVflYQ== 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=bIBCodmMkWlrfFU+8j+8jCaLQuzjatIWWGgYjkYhOQE=; b=GeVHvuB6OrzsGnhnRg/KPYoaxQP19sc5aU7ZR5UsaRRm0htjHsOhh5F/IYxX6tq24/5gD8QQtdNhSNnTZ2OitJC3ukmkVTW4ItteHx0ooEZcdgva3iu2+nF0y2//wyTVjypUio2byFGUdmEZFysw7lhFurSSG5U5lh3zyjqAeO9NIGnAuI8aXQh/jgjHsRNWqIGUl52Y7oMrTy1oT7+Kd3vvLzD0nBP/tYYiJlzqJoopX2A0xPskeBPui4dE9Ia8JvP4ko2UBVMdL7lbL0tTx/egggXcgc0v3AbpQl/HTdpQRnkFnsl3PyKYXRmWVsSDqijwKdOWmitj8sL/5WqG3w== 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=bIBCodmMkWlrfFU+8j+8jCaLQuzjatIWWGgYjkYhOQE=; b=dB0eVoDkxiCqQ6JPKeiaaOvR7MG2cJ5sqgwJ8pCTFk0Xb4YfuLn+PSmnK92zAtyK8Pg1wGvvBv2Vk4E2m79bYkDX+OvshxQDAx/hMHYNRqSyVJIdgPo48LJoAk/yCXUoCsiDFpB7tgUQuzz/TH7AuqYwn4u99RqoOKmhKX3QLrU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by AM9PR04MB8421.eurprd04.prod.outlook.com (2603:10a6:20b:3ee::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Mon, 6 Feb 2023 10:09:00 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%5]) with mapi id 15.20.6064.034; Mon, 6 Feb 2023 10:09:00 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Maciej Fijalkowski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 02/11] net: enetc: perform XDP RX queue registration at enetc_setup_bpf() time Date: Mon, 6 Feb 2023 12:08:28 +0200 Message-Id: <20230206100837.451300-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230206100837.451300-1-vladimir.oltean@nxp.com> References: <20230206100837.451300-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4PR10CA0019.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5d8::19) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AM9PR04MB8421:EE_ X-MS-Office365-Filtering-Correlation-Id: db04e085-d975-441d-d74a-08db082a2ad7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HR4rvPUqxT/y/g365hkrPWz5EbP4aXvLGIG6ccmZmAO4D/BX/8ve9lWchIvxsXGRNoMP6ppEyPvegGyiLrFyQfz9PYFDW9PC7c8gEQ1y5nxA7SA3GRjDFyyPLQ63Bz2wYjFYFgG6uoF0drm/Y3V/nKMXTIhgdURESDOFnnQ5OEew+nQAiMQBU85KtZcU9ISxOPpunP1Ho83eSmtHmw0neivAxlivVZUDN6wTngvBDc6bQdBjQGOkAkTqLxb4ZiXuat64qogC7ZOO5CEldEY95F9Q8Q6PQLW+lDvTbBTtiptiNKtUXihQ488kG87oypXY0EfcJ7i6X7eq/81WVF4Ng6/yM3yS1kqZfE3Kkx6Kac1ZVd9vvSb5SOzaYRjYwIJsgIDdPNmgRhzAUYANRlLzc8/+B9mlHwve5H1LDiOVHUqItUBbuCvJZW8aqvmIrlCDiQpwNLcEFgvzFhF9ipgzX4UUio43tUwicG4/JmQZqnVLAxQn1lD3Z0AYIrQkBHwQ1TVM8OCPtbyik82sfwgGjhvhfKmJsT0pfSnEwD/dUjKaASMAWzpI3kHW7UIMER9jHYLcZgGtZ6fmcjezB6qKV5QOMtiZlHN8Ia+cHbvkfeEENWey6ToNaVFpl5frLrK4P5GEQ77oqG4FEEJh95x5hcUpd27YQFpapoHzbTAxJZaG1IglQ2cv7231bNrggyKetG+n2vjZmRgGWCWE0+Msig== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(376002)(136003)(39860400002)(366004)(346002)(396003)(451199018)(86362001)(2906002)(36756003)(8676002)(66556008)(83380400001)(52116002)(1076003)(6512007)(6506007)(186003)(26005)(6666004)(2616005)(5660300002)(6486002)(8936002)(38100700002)(7416002)(38350700002)(41300700001)(478600001)(44832011)(54906003)(6916009)(66476007)(66946007)(4326008)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UAoFRN3nhFf/J446qaYdIFh3ihsRGReIh8Yd90SXShV1X5mGdUD8D0UxVclinuAXG3/YBPBpcUza/07Zf03TmTLH6CRM7ZeZ3UyLm/eX3xceDQUrlJ95BIMz2QXnW4Xq3fqlXeY78Vg7ccQ6/dvl9BOZpdWDR7gnZul1DiNwU6Etz4wdwEcFG/SyGUGu4PX0d36X88F58zC7/UlYeaRGBEvN7bihEa0VLA+gMGw/apGpzYU4xHBu98a6GnHJYl89kKxgh2JMXvrN/8nIUNJpQ0Z4p569jFGUKZBgj2RPMrU3PVRY129nlLZ4KKFneRzvzMAnNOyjt+pcpatYxaJsG68L60J6r12KB4pnp4plp+Xp6jm0KmJ1cPYWP7yV0pN+YRmHbMMbBtx07Y+HF1kvfeIh4rrzsxqGnDP1xVfR6VAOv3GZzUtgGx576HVBSPA5z2oki9d1yt7WaNaYLq9Pk3/1+zyuUJ5HyB2Lfb6atZGbawOjWAicoTMLAG4Eoj1HqtC/xo5Gz7irqhEBQ+D3hxBUGfvicwnFo6pIUltFEGDaVueEy9dKFCJqvlTGEbsfAI06Fdro6QcXai4y9GIKcRiPKsdT8ktcfPlgkouHehu86mwyHZNBqQ/wkhCrAkKLdpuWvf6Mv7KUMUeOYhHCwOyKNkj0oNiNMQCVBT/8S1Uga5++n9298eQ2gUXG4mgjCYQREqu4zf8cVwhPSfIm8aR/Zlc4HzxXnezurDyFpm2K7+a3sCM3NAdESZSvEnFleAsOCryuKVXaeB3fP39Xhs9/NHqJjy36v2ZWDntd9/i+llESq87CnQQ7bCvNS66vAcR8p4hbievOCsr1XSyGvxVO/9BE6wZu0Z+MqbGBfNqHmt4ZL5dfcMrkl2gPznBeDZj49Y0lJxXYw23/T8NbMpYksqZHxOnkvGvDKtdK/v2k5I0NrCE1hytocFEldUZsWp8IFBkqQhrKq/RDOBPVL+qfktQWaggdOrKoP4CEq3GShP1EFaLynTzNvmwkTNSdlKFwshvx99b2xIl+O7facLDDsDlZIjktO7nwEu06iWivaf5iZ+i9L5qdaKXR54BrzDyCKse3UmfUuBu/DPzMa9pm5ZQubBvMkAwr8tyHwX+1b6boP/TYhkq6oqAJiQNfYmIc16wGSY1vV4qEiN6l6Lhl3pwYTvC8w7QcK1ckl8Ry27k9tXk3/u2udIgNhrnQRyAx1XD4pTB2lU9QhBHEMzVR6BLEjB595Ihcv9I/n7YCCWqtUixUkYxKLCoyrUVyVskImsxWErVvuNXxlbioGUzuOTmh/QQFHco/P9uE5x4AWtKu6zYLb/ghR9R1XIIDvTH4RBbKyX8/cfJVjMizutJ0DvZnGEl9a0dPGmY2IeGTQySskI8uuDQOdgDQjbfBTiu400rOP25iSO9AUzYvRUQdgBxhM6hd+QHId8/acf6TDAav8KdRIAc/wP4jWFztThMGdccif+RkGqwtz/oT3NHnM2ZJhtd/WuqgoKYLmrCXCqx400U6EjUKK95ezi2hDuzSnbkkOwuGA1ElNajUXBzmar6dM6q6VSpb/gwS+uOmfOcXF9Ym79xam2ZmSpqi8Uw68IwUVhKhkFKkZhMflA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: db04e085-d975-441d-d74a-08db082a2ad7 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2023 10:09:00.5212 (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: KY0By/5aCx5TEc02zL4fd0e3ArWSGuMfJKW/C4N19N+gPdhJ7gPDY++WLRWKUsWMoCw9Au8O20iuXBPqLt8erA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8421 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757076075434072060?= X-GMAIL-MSGID: =?utf-8?q?1757076075434072060?= In a future patch, the XDP RX queues will have to switch between exposing a shared page memory model or an XSK pool memory model. If we keep the RXQ registration where it currently is (enetc_pf_probe() -> enetc_alloc_msix()), we'll end up needing to unregister the existing RXQs and register new ones. But surprise, registering them can fail, and that can leave us in the unpleasant situation that we can't recover from two consecutive errors. Taking a quick look at net/core/xdp.c, I see that this information seems to only be used for xdp_buff :: rxq (and :: mem) and xdp_frame :: mem, essentially between xdp_init_buff() and xdp_release_frame(). While these 2 might not be under the same NAPI poll cycle, the enetc_reconfigure() procedure does make sure that any XDP buffers in flight are returned to the respective memory "allocator" prior to calling enetc_reconfigure_xdp_cb(). So it seems that the most logical way to place this is no earlier than when it is needed, and unregister no later than when it stops being needed. This also saves us from the impossible condition of two consecutive registration failures, because now there isn't anything to rollback on failure, we can just propagate the error to user space and we're in the same state as before. I don't really understand why don't more drivers do this. Signed-off-by: Vladimir Oltean --- drivers/net/ethernet/freescale/enetc/enetc.c | 89 +++++++++++++++----- 1 file changed, 68 insertions(+), 21 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index 1c0aeaa13cde..2d8f79ddb78f 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -2450,6 +2450,59 @@ void enetc_start(struct net_device *ndev) } EXPORT_SYMBOL_GPL(enetc_start); +static int enetc_xdp_rxq_mem_model_register(struct enetc_ndev_priv *priv, + int rxq) +{ + struct enetc_bdr *rx_ring = priv->rx_ring[rxq]; + int err; + + err = xdp_rxq_info_reg(&rx_ring->xdp.rxq, priv->ndev, rxq, 0); + if (err) + return err; + + err = xdp_rxq_info_reg_mem_model(&rx_ring->xdp.rxq, + MEM_TYPE_PAGE_SHARED, NULL); + if (err) + xdp_rxq_info_unreg(&rx_ring->xdp.rxq); + + return err; +} + +static void enetc_xdp_rxq_mem_model_unregister(struct enetc_ndev_priv *priv, + int rxq) +{ + struct enetc_bdr *rx_ring = priv->rx_ring[rxq]; + + xdp_rxq_info_unreg_mem_model(&rx_ring->xdp.rxq); + xdp_rxq_info_unreg(&rx_ring->xdp.rxq); +} + +static int enetc_xdp_mem_model_register(struct enetc_ndev_priv *priv) +{ + int i, err; + + for (i = 0; i < priv->num_rx_rings; i++) { + err = enetc_xdp_rxq_mem_model_register(priv, i); + if (err) + goto rollback; + } + + return 0; + +rollback: + for (; i >= 0; i--) + enetc_xdp_rxq_mem_model_unregister(priv, i); + return err; +} + +static void enetc_xdp_mem_model_unregister(struct enetc_ndev_priv *priv) +{ + int i; + + for (i = 0; i < priv->num_rx_rings; i++) + enetc_xdp_rxq_mem_model_unregister(priv, i); +} + int enetc_open(struct net_device *ndev) { struct enetc_ndev_priv *priv = netdev_priv(ndev); @@ -2675,13 +2728,19 @@ static int enetc_reconfigure_xdp_cb(struct enetc_ndev_priv *priv, void *ctx) int num_stack_tx_queues; int err, i; + if (prog) { + err = enetc_xdp_mem_model_register(priv); + if (err) + return err; + } + old_prog = xchg(&priv->xdp_prog, prog); num_stack_tx_queues = enetc_num_stack_tx_queues(priv); err = netif_set_real_num_tx_queues(priv->ndev, num_stack_tx_queues); if (err) { xchg(&priv->xdp_prog, old_prog); - return err; + goto err_xdp_mem_model_unreg; } if (old_prog) @@ -2698,7 +2757,15 @@ static int enetc_reconfigure_xdp_cb(struct enetc_ndev_priv *priv, void *ctx) rx_ring->buffer_offset = ENETC_RXB_PAD; } + if (!prog) + enetc_xdp_mem_model_unregister(priv); + return 0; + +err_xdp_mem_model_unreg: + if (prog) + enetc_xdp_mem_model_unregister(priv); + return err; } static int enetc_setup_xdp_prog(struct net_device *ndev, struct bpf_prog *prog, @@ -2954,20 +3021,6 @@ int enetc_alloc_msix(struct enetc_ndev_priv *priv) bdr->buffer_offset = ENETC_RXB_PAD; priv->rx_ring[i] = bdr; - err = xdp_rxq_info_reg(&bdr->xdp.rxq, priv->ndev, i, 0); - if (err) { - kfree(v); - goto fail; - } - - err = xdp_rxq_info_reg_mem_model(&bdr->xdp.rxq, - MEM_TYPE_PAGE_SHARED, NULL); - if (err) { - xdp_rxq_info_unreg(&bdr->xdp.rxq); - kfree(v); - goto fail; - } - /* init defaults for adaptive IC */ if (priv->ic_mode & ENETC_IC_RX_ADAPTIVE) { v->rx_ictt = 0x1; @@ -3011,10 +3064,7 @@ int enetc_alloc_msix(struct enetc_ndev_priv *priv) fail: while (i--) { struct enetc_int_vector *v = priv->int_vector[i]; - struct enetc_bdr *rx_ring = &v->rx_ring; - xdp_rxq_info_unreg_mem_model(&rx_ring->xdp.rxq); - xdp_rxq_info_unreg(&rx_ring->xdp.rxq); netif_napi_del(&v->napi); cancel_work_sync(&v->rx_dim.work); kfree(v); @@ -3032,10 +3082,7 @@ void enetc_free_msix(struct enetc_ndev_priv *priv) for (i = 0; i < priv->bdr_int_num; i++) { struct enetc_int_vector *v = priv->int_vector[i]; - struct enetc_bdr *rx_ring = &v->rx_ring; - xdp_rxq_info_unreg_mem_model(&rx_ring->xdp.rxq); - xdp_rxq_info_unreg(&rx_ring->xdp.rxq); netif_napi_del(&v->napi); cancel_work_sync(&v->rx_dim.work); } From patchwork Mon Feb 6 10:08:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 53127 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2151053wrn; Mon, 6 Feb 2023 02:11:17 -0800 (PST) X-Google-Smtp-Source: AK7set9sPhsVWEEDaqorUnG/9Vka6f81rvF9cHFZoBN8c8ed3jxSRdufct3WkrH8D6lyisVLLTD1 X-Received: by 2002:a50:f68a:0:b0:4aa:c354:a0e7 with SMTP id d10-20020a50f68a000000b004aac354a0e7mr584585edn.25.1675678276890; Mon, 06 Feb 2023 02:11:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675678276; cv=pass; d=google.com; s=arc-20160816; b=zKCwtrW01sAr/gXY6AU91/26PD7c0kJnexdR9GICqD/KmdNfrPQXRV2ylyCK2tqbSW lr1q80Df5DDqIs82kIXcDmPVW8/0vR2l9z2Ypuyfnt1+NtHYHdW5mNeR/aLKvKsBX1LZ A0zIKaDO+LMUXTLeBhAhitdYNU7SM9fA33LNhbcpxZNmEi3CxPIdBWjwGDO//sCszg3R hJFfWQxWe+DZjYxUoCoBOEzdCLLUkhh/mtp9LZ10GFSWOE2Y5ePdOQSoiGrOplXLV+xK q56mmGMMJtZmx2A0Qy8K7D1qJG/IMk0+ktinRh09ttVZKKDtbU3TPzL10IjmKyx910Pc v90Q== 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=8Oki15vmcIgJjBGTfklTBzJKOfHFRepAumEeMsAKh4M=; b=u+jcpUKxzar/V8xhc7uTL/En1WJX6t/AG2ffDNmkCCfUQcgCpNXbejZzzsbgz11BAU K7CuKNR0BrItQDL4tBVqvOkHNzgkkBunTxesLky6WfRhiKuWFjzzPV7Mn/KcMIV/+nO8 nrxBkooeZ7ulSWcUev4HYClUfdrVGQfCJhpBMfwLzKR2A5NFMvVCN/vAFXf+vHCkqMqm 49ylOhB4Q8vZZm3jmHpv3RkFpfdGF383U0KN/EnHAgoAvsK8Z/AFlMu8Yvb7iIBQnEGd D+Dp+KZqknXQYUCHPftVTCcCcosLsg7i3OJMzWc1eGLCpi3WN2PAtJdSGo1FzB26f66v BWpA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=NJRGLgoL; 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 j25-20020aa7c419000000b004a14cb2a5bcsi1790484edq.499.2023.02.06.02.10.53; Mon, 06 Feb 2023 02:11:16 -0800 (PST) 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=NJRGLgoL; 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 S229988AbjBFKJd (ORCPT + 99 others); Mon, 6 Feb 2023 05:09:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229823AbjBFKJZ (ORCPT ); Mon, 6 Feb 2023 05:09:25 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on0621.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0c::621]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E19B12F3A; Mon, 6 Feb 2023 02:09:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EE8yHemtFxMl5rYCpb1B8yaqVtGaZbr3aBERQXGfFLyaGp3wI1CUkuDIDwoQGJ5O+F/F+/RdGZcgrOjHsn0tLUlJeMXmWKPeAafzvl6/fgE9a+Qh/0IAjqgmSeDWMs2CExwON4rTxO6tuyl0jvd46QeZxxwJ4VO4l6MVPK9KrokO1sUBlCNK6ypkQurQMqL/jUs0rXxjbZbvifZMnwr9qULWCP0yRJx0B2J3GBkb4+QsPasnjEQV3Fp+lw6t26Mb9U+dBfoJ8jOaPVkeJN+FZbzW8t0nEoAyTncQ9FXrD/FSk40r65zKerqiaJAjaJWZMoXEImUsf9hFA2u7beh2Zg== 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=8Oki15vmcIgJjBGTfklTBzJKOfHFRepAumEeMsAKh4M=; b=DE+rWfmUOozDm2dlKPGvcnLhgOC2x5WVJlJ7xNuakR+S8v5d+nGYG1ZlDyNl9Amt3l8Fba2xk34iiWDGQBL9tTr2hiDRmVL66oGYpI1hFeVaDzJNt8gvXEozG1dtz1joRqd1ECEJec/d1DPTXr04++lgqVseWWg4IZ7A3/wasEkhHAGC0txrMyGrZNMjz/r1ALeI6+KQ0QzeK7saRkJosXOy5LU7+A3AMIq7ZKv2BXkhcsA30ADlZ2Vok7wgCgn3NZk287FXFRLXdwHSSN28552xNYiGhFhIcCCPgsl8LJ5v9Cz+DYRADEVYNzCLidHESyEquUXqKe+giQJLMIG7Ow== 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=8Oki15vmcIgJjBGTfklTBzJKOfHFRepAumEeMsAKh4M=; b=NJRGLgoLjQWoMrwRBhkqL2ZUXfKCFRW49rcD59/2VpEKG7VyUll8uMVdqJTnz7NYvE8IXOM9AcUUYec6Xw1pmauJXYHMlxplNYC3yx4FyG0mEm63iXNyipxPsg0tdA60GTJ3J1piGpFHSASMD1/0LWaxBZmvGgVoN+DcDZXr8xU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by AS8PR04MB7813.eurprd04.prod.outlook.com (2603:10a6:20b:2a4::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Mon, 6 Feb 2023 10:09:02 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%5]) with mapi id 15.20.6064.034; Mon, 6 Feb 2023 10:09:02 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Maciej Fijalkowski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 03/11] net: enetc: rename "cleaned_cnt" to "buffs_missing" Date: Mon, 6 Feb 2023 12:08:29 +0200 Message-Id: <20230206100837.451300-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230206100837.451300-1-vladimir.oltean@nxp.com> References: <20230206100837.451300-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4PR10CA0019.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5d8::19) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AS8PR04MB7813:EE_ X-MS-Office365-Filtering-Correlation-Id: d7d17353-7759-4a49-a080-08db082a2bc8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8IxLpDxOI2nxZCfHIIZM3eL0LK+lxt7+VeywuHkbyxK65wfdCHLiMtVoP+gOZgs+lL2aZZxAs60f5GQ5tfCIO2OcRGzmpVWsoQqzW8BcwKYfj+qY83OGeYU+uD0ixoJkBh2EUPUuzdzUNfWjEwzZHgqIJTmWGQKBw27ITdnSnfTmVcbkh7X6upk8VoBuiZrzss+mKdN6q1Qxwc/ardfqlX0Ka5e++DFgai9GAi+BEeNkkLqLmgXY8tYNFneIuOMib2CviU924NIWrr2Iz6PkPE6R+tEStKU9iGytM2x1kIzjCLc7y8TooLnyTyHkyQiSAhigjttP5HBtfcYq/L0HcDSd2saqk5N0+uuwc3dJlNWN4t2+5gnkec7+ifdu2XV6sF5O8YToWRArcaC5dXpdhAennYdR5gBN48EnDfL0aeEHWtukJDn1TC3JSi2SrCY/qLB/StzlzMsq4GpYt7CCoUdJt6Alf+MQiA3J87VyVsxUlVteaQZNO2dr6CnVU1wfQDrI+cbDWUmxlJbrPKw1cK88mqBiSJeSnRk7/hTj1N9QPjVGhieYSrgUo1Pa6/jL/BWrT9JpbTLnrzKrRQbX4QmBV3hbhN+6H1fqM4ooisp9TjMFkDW82j6vdAfDVT//nj1ydRFRgnt9Oz17/OSqbYWVYMFtjJvK68vT3CoDw4RUyVLJHXTi46M7rFezf9YMba99nMIiLgw0C3kZbXd65w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(366004)(376002)(136003)(39860400002)(346002)(396003)(451199018)(86362001)(2906002)(36756003)(83380400001)(52116002)(6506007)(1076003)(6512007)(2616005)(186003)(26005)(478600001)(6666004)(6486002)(5660300002)(8936002)(7416002)(38350700002)(41300700001)(38100700002)(44832011)(54906003)(66476007)(8676002)(6916009)(66946007)(4326008)(316002)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: etzV0fE7kM8SbvTaPh/m+aF/0iENuzTUFdW7S3Qms2tMHbbgz+b7udUMNwXeqIuB4tyjOpjkECviZnZYTDR1s5rrMIxIoYXMTabtGTWiKi14QSS0yqI6/ZM9Ged/OaDYj7oVknkh8Ks3HPj09xwU67XiVHCLGzQXGx4TVkmg4y3oHAWTMUhCrCfY7V3UC5g49mdMWyP7wFJ/CQbG8IZinCUdDYixOxfca948tguxbEUoSINo3rtrB/s3g8Wp/ewWvDqbpEw58m/foW/Xn1y0JTHJoTM7A7WguYN8QU9cR0+qoWss3RQju2nJiBeXz4DTAHqY2yU7bZjI8bj+5lEt8Ef3uGAk33BY6hhMcu0YZQWm9T+oZTtrMhffHAd9d7qsfzZPts6fpmlFMLLeXLPGrbxWaBFcLeZe/GUPUw2DJfVfChUeglivu/7fxapHxP6Bskr/Mwffbrjj2cTDyXe+EFZHZS6/m3bnFlN6JJxZXmvcWdhPesUilyBTBhZ3j/t9+DRyqzH5pfZPejaHgqij+4EYiztHU6CebtxkTeQlfIzmeHUozlUxCsZad1iC5OWkFYzUQ0wO2bGBOZ2X1nBPtybN59NXJcwox8xLqZIlgeYkcOF554NtkvItqs5IWuarWB3X1Jdzu9C5PMGSNxoEVu2C+LkaatYXqiFJSDd5yQxJz0+laIRnQUmS4fSZ9hHwtvHO7BedOdqLbCwak0OwuK33TyHt5buMkpwc3O1GS92V2potdQmnfBI2+JiGdp92vKNbNh+Numi1N1PLbKblK04zcT9btzmgosGWUodLujJi1fxYmS8sJXhy+DzRCMBzOWKmZwXDwj/yd6PPDZeED5b6r8TigfmG8U15UAPfoX2CehnTMm2HfjrkVNpNxb8DunNzZQBbDQu5oj0rsqUHkrSAKhptS3M1r1/VwsoS2FHVZjvC/piI+4DpZ8/qHI1pZlkkNmY3zODCIHiycRqNYp6S7jBw2quex126cLdG6d7wj8Yo8N/336t2Lkhv7GfhBzoEKeLBcyUJqVJzJrWJwZYQs7AOas69+OGtIYvqao0F0iuhyDl9S7hEGIxvM0qCagmInTn639V0ZTzYVVZiitFdvef+FcxB7m2rjfqSJwic+ZuXtS224UMCyb+hAZBv2VZHE5xA0o4Y8wVWJ33jZiKO0kPDgqRyHkXyb5pGUIeOXwDg9I6J8yJ+lEjDmHWAQIr5doKn4nhsgKZs0zRmHlXOuKGdzHIlUSaqIggPdY+47Xab2wbzSXj0v7YQ6FV2dxPGhBZzf2P4VLoF6LlsJE++QUuTsIy353N0Tcr8GAlQCg+d923CFyc6/fm3QLxrwJcJj1IbDZJ5aCb47Kj5lAR+gmYoK+0vabXjQTJQA3TPvLy5nUHHqsYdyUchFx14arPDqKsdj3Fc6SHNzjMAezFngQ8VMsyQ+aWLl70PDcXWlNQ5zMPdulrk2LEbZNP3TuPv+jvD4eOISVYvCdblcXl7bljCyP09hmjIzYYhfajBijM9CVNo8Yv9PwDAnIZwblUcGVrkrsaaLjrcDgcGRRlg79cqwQioPpqJjqdGnrpeyeneZJn+GZU36eo42Nc0lcvHCMAOkfVY7XUF/0ikAA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7d17353-7759-4a49-a080-08db082a2bc8 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2023 10:09:02.1305 (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: H4OJZcZNUjmtry94GgmWP6Xoc6LqOy0Q+CfmSalnCw6zaMuHnRIhcBZXFEL4YBxXO3SNXpkIyqT/OoYABoJCPg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7813 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,SPF_HELO_PASS,T_SPF_PERMERROR 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757076024625135819?= X-GMAIL-MSGID: =?utf-8?q?1757076024625135819?= Calling enetc_bd_unused() on an RX ring returns the number of descriptors necessary for the ring to be full with descriptors owned by hardware (for it to put packets in). Putting this value in a variable named "cleaned_cnt" is misleading to me, especially since we may start the NAPI poll routine (enetc_clean_rx_ring) with a non-zero cleaned_cnt. Signed-off-by: Vladimir Oltean --- drivers/net/ethernet/freescale/enetc/enetc.c | 41 ++++++++++---------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index 2d8f79ddb78f..4a81a23539fb 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -1145,7 +1145,8 @@ static bool enetc_check_bd_errors_and_consume(struct enetc_bdr *rx_ring, static struct sk_buff *enetc_build_skb(struct enetc_bdr *rx_ring, u32 bd_status, union enetc_rx_bd **rxbd, - int *i, int *cleaned_cnt, int buffer_size) + int *i, int *buffs_missing, + int buffer_size) { struct sk_buff *skb; u16 size; @@ -1157,7 +1158,7 @@ static struct sk_buff *enetc_build_skb(struct enetc_bdr *rx_ring, enetc_get_offloads(rx_ring, *rxbd, skb); - (*cleaned_cnt)++; + (*buffs_missing)++; enetc_rxbd_next(rx_ring, rxbd, i); @@ -1173,7 +1174,7 @@ static struct sk_buff *enetc_build_skb(struct enetc_bdr *rx_ring, enetc_add_rx_buff_to_skb(rx_ring, *i, size, skb); - (*cleaned_cnt)++; + (*buffs_missing)++; enetc_rxbd_next(rx_ring, rxbd, i); } @@ -1190,9 +1191,9 @@ static int enetc_clean_rx_ring(struct enetc_bdr *rx_ring, struct napi_struct *napi, int work_limit) { int rx_frm_cnt = 0, rx_byte_cnt = 0; - int cleaned_cnt, i; + int buffs_missing, i; - cleaned_cnt = enetc_bd_unused(rx_ring); + buffs_missing = enetc_bd_unused(rx_ring); /* next descriptor to process */ i = rx_ring->next_to_clean; @@ -1201,9 +1202,9 @@ static int enetc_clean_rx_ring(struct enetc_bdr *rx_ring, struct sk_buff *skb; u32 bd_status; - if (cleaned_cnt >= ENETC_RXBD_BUNDLE) - cleaned_cnt -= enetc_refill_rx_ring(rx_ring, - cleaned_cnt); + if (buffs_missing >= ENETC_RXBD_BUNDLE) + buffs_missing -= enetc_refill_rx_ring(rx_ring, + buffs_missing); rxbd = enetc_rxbd(rx_ring, i); bd_status = le32_to_cpu(rxbd->r.lstatus); @@ -1218,7 +1219,7 @@ static int enetc_clean_rx_ring(struct enetc_bdr *rx_ring, break; skb = enetc_build_skb(rx_ring, bd_status, &rxbd, &i, - &cleaned_cnt, ENETC_RXB_DMA_SIZE); + &buffs_missing, ENETC_RXB_DMA_SIZE); if (!skb) break; @@ -1447,14 +1448,14 @@ static void enetc_add_rx_buff_to_xdp(struct enetc_bdr *rx_ring, int i, static void enetc_build_xdp_buff(struct enetc_bdr *rx_ring, u32 bd_status, union enetc_rx_bd **rxbd, int *i, - int *cleaned_cnt, struct xdp_buff *xdp_buff) + int *buffs_missing, struct xdp_buff *xdp_buff) { u16 size = le16_to_cpu((*rxbd)->r.buf_len); xdp_init_buff(xdp_buff, ENETC_RXB_TRUESIZE, &rx_ring->xdp.rxq); enetc_map_rx_buff_to_xdp(rx_ring, *i, xdp_buff, size); - (*cleaned_cnt)++; + (*buffs_missing)++; enetc_rxbd_next(rx_ring, rxbd, i); /* not last BD in frame? */ @@ -1468,7 +1469,7 @@ static void enetc_build_xdp_buff(struct enetc_bdr *rx_ring, u32 bd_status, } enetc_add_rx_buff_to_xdp(rx_ring, *i, size, xdp_buff); - (*cleaned_cnt)++; + (*buffs_missing)++; enetc_rxbd_next(rx_ring, rxbd, i); } } @@ -1524,16 +1525,16 @@ static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring, struct enetc_ndev_priv *priv = netdev_priv(rx_ring->ndev); int rx_frm_cnt = 0, rx_byte_cnt = 0; struct enetc_bdr *tx_ring; - int cleaned_cnt, i; + int buffs_missing, i; u32 xdp_act; - cleaned_cnt = enetc_bd_unused(rx_ring); + buffs_missing = enetc_bd_unused(rx_ring); /* next descriptor to process */ i = rx_ring->next_to_clean; while (likely(rx_frm_cnt < work_limit)) { union enetc_rx_bd *rxbd, *orig_rxbd; - int orig_i, orig_cleaned_cnt; + int orig_i, orig_buffs_missing; struct xdp_buff xdp_buff; struct sk_buff *skb; u32 bd_status; @@ -1552,11 +1553,11 @@ static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring, break; orig_rxbd = rxbd; - orig_cleaned_cnt = cleaned_cnt; + orig_buffs_missing = buffs_missing; orig_i = i; enetc_build_xdp_buff(rx_ring, bd_status, &rxbd, &i, - &cleaned_cnt, &xdp_buff); + &buffs_missing, &xdp_buff); xdp_act = bpf_prog_run_xdp(prog, &xdp_buff); @@ -1572,11 +1573,11 @@ static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring, break; case XDP_PASS: rxbd = orig_rxbd; - cleaned_cnt = orig_cleaned_cnt; + buffs_missing = orig_buffs_missing; i = orig_i; skb = enetc_build_skb(rx_ring, bd_status, &rxbd, - &i, &cleaned_cnt, + &i, &buffs_missing, ENETC_RXB_DMA_SIZE_XDP); if (unlikely(!skb)) goto out; @@ -1640,7 +1641,7 @@ static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring, if (xdp_tx_frm_cnt) enetc_update_tx_ring_tail(tx_ring); - if (cleaned_cnt > rx_ring->xdp.xdp_tx_in_flight) + if (buffs_missing > rx_ring->xdp.xdp_tx_in_flight) enetc_refill_rx_ring(rx_ring, enetc_bd_unused(rx_ring) - rx_ring->xdp.xdp_tx_in_flight); From patchwork Mon Feb 6 10:08:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 53126 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2150963wrn; Mon, 6 Feb 2023 02:10:58 -0800 (PST) X-Google-Smtp-Source: AK7set9FtT4ftob8Ew/DubQ0g11boH9IP3CnfiWscqNnoxTUSbYEKE6zpAeBLYig/lkVNLe6LqLZ X-Received: by 2002:a17:906:140a:b0:88e:e498:109b with SMTP id p10-20020a170906140a00b0088ee498109bmr15682510ejc.5.1675678258798; Mon, 06 Feb 2023 02:10:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675678258; cv=pass; d=google.com; s=arc-20160816; b=CMXhO9a5djOmiFEMnmsSg99sl6pChnuMaKTBOfj2v9OdpqM4tk0w82M+1uJj/TIjUW AbqhbziFHfeaQkT2HinBJMFHdQD3OXkWYdPDvreppUEf/W8ol6A5hUZJQoR3fwRP592B P7ALULVDfHip7I3w/pYtIl3hut1Vbh8yEl4ft49nsT1CuBGUcqVq9S3Yd0zEUDGrwt19 seLxzC6jhjm3uUBpLzsKgVigXOh6JyYR5+Blg8BylMALZpy+2FlDIoCEhwZGGmyEDqqp GcUadCEdybosOMwRHAPx2U3o6Zk3FFyqGj2/eHWY9Nup8BnBmvab7zi+2ks7FreX4lmr 0+gA== 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=MOfkyJL3+6nEMBTw8M4VCm+QBKnjE07QI9vC7MKDIvQ=; b=bBXOVoZxdwfyL6EOZ6u8iw0JIZSTB5NFGy2XN3/ueRid+GNnlKoF+6PRWnL+yYtkA5 8tGvXd/z7CnE9IItW6bQkaOrdXfnprgNbk30QyskOhFx8ch5CPqQfdB9PgPhQebekGP1 vTAlDTZED/koRsqdwRmsMStEOVLqRfrS01o+K0O3bWZZ6qcbHBfYfCY/xZKYnLdN138v fB3aS1+3/0bEsY9ur0AXRTzXpbsuPqOdBaBxCF1xrvgsG/KiBiNHHXf2m4yzzrg5QX2i hcX7CDHe5zSBQ7USx3EfJ6yMomLip8BXL8bP1KOF8uiJkAenjvDoRNyiENGEHGpauoi/ HNIw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=irtWD1HP; 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 14-20020a170906004e00b00880f2099b12si17490676ejg.226.2023.02.06.02.10.34; Mon, 06 Feb 2023 02:10:58 -0800 (PST) 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=irtWD1HP; 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 S230123AbjBFKJ3 (ORCPT + 99 others); Mon, 6 Feb 2023 05:09:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229696AbjBFKJW (ORCPT ); Mon, 6 Feb 2023 05:09:22 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on0621.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0c::621]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CDB712F2D; Mon, 6 Feb 2023 02:09:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oNxxTIN365YiKfH2k3Vra052jzWBYvR/LUur4FLOWpNBVbweF8c/3CUkQkyUjUuK8kuq/eV/noR8Pvf2podEgH5gJaf1jCfMEu7r9kZLi1hlXG4V2GODTCSlzqJywhcQ+063C+OhqBYEm1Se/FK1Jv39elQcfiQxoE4lhrYaq93ohCBFi9xgyqgRXrM0mVIb9s60PFiLpPX1DTMAGvaS8lpcCyNQLqvXwX7fGYc3Lcoft6zlD2iT/NDxRkgWkkRL33VpvUnnrm8dcugt8ldTne0qhRZk4pc3Ng/+cqzxbayoWqeJ1KFMnDzDvgUCnrrEpWtFGvnqQ7SXlbHc6vecLQ== 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=MOfkyJL3+6nEMBTw8M4VCm+QBKnjE07QI9vC7MKDIvQ=; b=JEsqWMmJnrgeXvuMFvZHEVdjFOkaZZbYLuAAD+oLbIU/puJNy04H0B8KW4jhsJtyVeXnwu0oq6G9Rm3HU8yxFWCGgCXqv0084Q+OZxKRkypMLQ+Jafugj+i8lOi/VnBwHvr0yVTTriJQkWxMvnJqJgrLozs/F4uaHqJDMNvlrOMXdKW7+o9JzkkgD6jE+HLA1GSGp04quZDxar+k7KoZn1fB0Y5nLjmw4zFFadnbQlTSKU79ZgGFpDkg2o6m+JVYn4odXvtvB7+rm9y7quY1nzOE1n1ITKmseavc93IiGWMzDIWcBVUFMiFW3xG5TRHH25sWarewrkH7qtyodx6xeA== 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=MOfkyJL3+6nEMBTw8M4VCm+QBKnjE07QI9vC7MKDIvQ=; b=irtWD1HPX2gCYD8FvNH2KXnlp36+t+RjbilZAE1eOZS3dvOrf8ldw7KRhB8ULmXwxLBhkViAkCxgrOud7Rg0KuQWwClvo9/r9GZQxAiXege1S+hSzwTHwII6bwyVdLvYNRBMj9xpEFmZJMWITAnT+BhfBzvUEvbhERDqfb3BnEA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by AS8PR04MB7813.eurprd04.prod.outlook.com (2603:10a6:20b:2a4::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Mon, 6 Feb 2023 10:09:04 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%5]) with mapi id 15.20.6064.034; Mon, 6 Feb 2023 10:09:04 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Maciej Fijalkowski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 04/11] net: enetc: continue NAPI processing on frames with RX errors Date: Mon, 6 Feb 2023 12:08:30 +0200 Message-Id: <20230206100837.451300-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230206100837.451300-1-vladimir.oltean@nxp.com> References: <20230206100837.451300-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4PR10CA0019.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5d8::19) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AS8PR04MB7813:EE_ X-MS-Office365-Filtering-Correlation-Id: ec6f63fc-ca7f-4c93-2e31-08db082a2cbe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WMu69A56U3KUK9bATiQXR/5zcpTmbB5G3e9kT+r+6scA+RZ2vDiWbRWE+F9uVNljQPzs9b931MDdo+JnXg/wZJeF1xKmQXUTgclIjMDiB1yOlvJT5JUCKrUgN3ujf+WG6ANxPPZD5/9/Mg+ioFaUxSkUBKA4JQSM2sy9qY4dZYPlse8ivD5kYjmEu4jm+QkQiGEI4xnu5vVoT21FVld+7GgvXbwDhEke+DFe9pACUAWurA41Z81BC8nyC45vjDGg6hOiIqj7OTEMozjPNmlEjUiv9/Avk7jQCrXtxHixD8SbTsTJQRoxVOWpaD0HUVXfSBiK7hE0Qhm1zDF6Hdhe6uAc/+c9OFaB/b0uPV//OktQa3fYZVP1SgYhB8MaZgpPDdi+nn1VpW11YtoUkagY2oZMPJrvoQHh192Kz3GoX+Qu40n9mmpuU25IX9LLg+VgL//dDwziSrneHttR/XVcU9rcXBoUoI3/+HzCOougBCV6TjQl2ux6iKZE11XJzmj3o96GGvyNyXB+nTLI27qvAi7PQWauLurkTYlXn9RRqY79I2u1ntCidPhUmwuxLmWG0DvX9Yslwv2HFVslG4Fl8B29aIWHDztkZOH4SYckDXmp5qGD0K03HuF1dJH2Xl4jowubNu2NIUUGO5jcMRATMs8vt1zNH3wY6VUk5lA330qAaP/4z7V/z1mA1XsuhgnX95gPn+DeHJl6L5vgr2apRg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(366004)(376002)(136003)(39860400002)(346002)(396003)(451199018)(86362001)(2906002)(36756003)(83380400001)(52116002)(6506007)(1076003)(6512007)(2616005)(186003)(26005)(478600001)(6666004)(6486002)(5660300002)(8936002)(7416002)(38350700002)(41300700001)(38100700002)(44832011)(54906003)(66476007)(8676002)(6916009)(66946007)(4326008)(316002)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KBn2D2/m1hmoxzjxF5n2Fc9mVx2o6MhuoDkqiagxmpeao8AHiLDYchydir71dh+HaU06JU7681gx2sMNoyRjFUFPjY0DmoGw+0SLaJOpnISj+YBKV7xQHnsiZpZJDsR5qHiTQ3rIH8s/EdYN2wYRu+Q0vyOMlbLUEIluOcUojyLJLc06+/RJZvMq0utZqvtmIAfEPwQFgR+7lmzcFoW9hmRu2/3YsdSIHgVb32vE3ugE7diM6vayUFtvgx7/bIiLPgZWzlNWhvWvasvr3GqtXQm1K77Ox4+kCjs7ffs02cWuoiy3fIgy4tHJ2dlmg0ceSo3KTA3ILW/TR+1AAJAElZ4PEdpdvg5hkcP997uEzG675pN+XJx0f7HapT0/4y93ED/oWRqWdF3aqTJsK1SUf4Mv7KxpMnLeaNVTqc84E2iPhkvZ+bIZhlLopD+Rwcg5WMpdNrhJU3iC0Qd/2FsIENuV0nIQyKBGSrOfNlzwA/ZOhDG/B3WxjnPa5WGMcEjbbMZJItyasrFqv6U+6UG5ZtfASdDsPnenHWbpdYP8hGPhYcIZ/Lg1H2LTAQYPmjdd3RyOyQmBM1F5IZy9V3nTivlk0IsUu9bQGIBQsbUqXE3HFQ6/rnBEXfqvC8bwetPC8hQsLIcSxexgtuqJo2uvlXpnvxI2oaCZx6TXQCNlQik6dvFz7uBEG5HV908bVvNgaTL/5vyyge6KEPX0SUx7jIAHx1srkypAlRWt9RXZs8MLD8TS5i2lqlnQ73b3T7sCuiTOsnnLga53lXTpimOJTTg2GQnraNn38a2T5NWA1MRF9J6QP+cyEYxZVom3dp5XQ6JaPwrqlIWwSemUBuqdVxgLPK0jqwszEftfzYL0P/s0ckOZ8fHAuEr+IyK2BkWydl6jmYghtOb40YJCDDH6DXvMz96i0ZXCAzfboi1cTl//C1y0CqNMW1GVesZBcQhQdN7BpTmGCHJUlnGfu3IWww/rGaxl3vllDo7d1Oj67/o3laMeNXNyVs5cyL1tQ7AKc1sUXaC25AgE/zcVGAHxafKzA8bsnp6HPTWrYROyuWEtfXo9UF6dKAtLfLtFjwF+Ff3xaFTp+HeFpezp8ke6WLMGWoPztDVMy/fO8r3E1uf+446Wuw+4u9RMHCUv3Z4sk4mYv0fM5BRMZISyRTqglTtjrTOCoiJ+NdpB7HFrGR+qVBE/+p2Ov4D9Hv3/ysbQsZ3nTn82rqgLhggfxGwBNzYmdMnJJ5Cnh0MFjtfNwDsNLLYUM/P0WFtxTi6HC11Vhx6iTz0NeuFUf0NPGiakyikr+D0OWr1UohYMOyh4H/JHRGy75a4rrBd9Pg10nbpcSabpCYJlOI9VLiOSysYn1tK4Zu7LBpAD5Fd/jD1W8NBxwUFpSaLODtcZ01c9DOy1XxVHscAEk4oReBKpmvyrEil2GueLMUEP/FwqMvJaQFDgIpwLtymwn7KTCeqz3xydj95qw9UUbWCZQci5tppVxqtCR8gKmjTzTRF9pFSk4WH2Jjg8CcTo3x/jDsmWQrNWLWutlTNgGyFoUTnUO/fBMysbcHsMfEw0qzPl8M4JogEZga+6SL301+TSv+EaIXdFM4bfugSgihDT7Z2/yYneSw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec6f63fc-ca7f-4c93-2e31-08db082a2cbe X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2023 10:09:03.9272 (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: yZfFGnEnR8RrDyiaKsowEjrxdmUBpY2/wW7t2De1tusfygCIZkCo2BEUZFdYu7Ab4iVcZVlfUwtp8HM3K8Jcsg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7813 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,SPF_HELO_PASS,T_SPF_PERMERROR 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757076006289829001?= X-GMAIL-MSGID: =?utf-8?q?1757076006289829001?= If we see frames with RX errors, consume them, mark their buffers for refill, and go through the rest of the ring until the NAPI budget is done. Right now we exit and ask the softirq to be rescheduled. Signed-off-by: Vladimir Oltean --- drivers/net/ethernet/freescale/enetc/enetc.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index 4a81a23539fb..37d6ad0576e5 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -1121,12 +1121,14 @@ static void enetc_add_rx_buff_to_skb(struct enetc_bdr *rx_ring, int i, static bool enetc_check_bd_errors_and_consume(struct enetc_bdr *rx_ring, u32 bd_status, - union enetc_rx_bd **rxbd, int *i) + union enetc_rx_bd **rxbd, int *i, + int *buffs_missing) { if (likely(!(bd_status & ENETC_RXBD_LSTATUS(ENETC_RXBD_ERR_MASK)))) return false; enetc_put_rx_buff(rx_ring, &rx_ring->rx_swbd[*i]); + (*buffs_missing)++; enetc_rxbd_next(rx_ring, rxbd, i); while (!(bd_status & ENETC_RXBD_LSTATUS_F)) { @@ -1134,6 +1136,7 @@ static bool enetc_check_bd_errors_and_consume(struct enetc_bdr *rx_ring, bd_status = le32_to_cpu((*rxbd)->r.lstatus); enetc_put_rx_buff(rx_ring, &rx_ring->rx_swbd[*i]); + (*buffs_missing)++; enetc_rxbd_next(rx_ring, rxbd, i); } @@ -1215,8 +1218,9 @@ static int enetc_clean_rx_ring(struct enetc_bdr *rx_ring, dma_rmb(); /* for reading other rxbd fields */ if (enetc_check_bd_errors_and_consume(rx_ring, bd_status, - &rxbd, &i)) - break; + &rxbd, &i, + &buffs_missing)) + continue; skb = enetc_build_skb(rx_ring, bd_status, &rxbd, &i, &buffs_missing, ENETC_RXB_DMA_SIZE); @@ -1549,8 +1553,9 @@ static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring, dma_rmb(); /* for reading other rxbd fields */ if (enetc_check_bd_errors_and_consume(rx_ring, bd_status, - &rxbd, &i)) - break; + &rxbd, &i, + &buffs_missing)) + continue; orig_rxbd = rxbd; orig_buffs_missing = buffs_missing; From patchwork Mon Feb 6 10:08:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 53132 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2151841wrn; Mon, 6 Feb 2023 02:13:15 -0800 (PST) X-Google-Smtp-Source: AK7set/gvJPT6zxkusW6oov9GJiqNovNTR4SK6TDIXgj/TgrJwDczleodmAlPVzysFUN5oWoAgVZ X-Received: by 2002:a17:906:a3c6:b0:88d:9cf8:2dbb with SMTP id ca6-20020a170906a3c600b0088d9cf82dbbmr20104404ejb.12.1675678395488; Mon, 06 Feb 2023 02:13:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675678395; cv=pass; d=google.com; s=arc-20160816; b=kYAaarRsaWJyCV/uO59iWoF1J2cNa/mBAI1P9yFNjhnEWqYAOqXKWDIjhtrNiUfY3c sT/PjxtgMY3637hxdlgEsUmFujqsltCuhFznboEHsEYXsay1+7QKxLTxHP7ZiVXVDvB3 CwrQ7xjywOPBBlI1KfiWVbh9sH9AzWNpYXNJssMSgcXLSSLjWOAfiPCw2YbopEkbdqDY J/ZRhdTooApRMbXNeMlnL+AxylrPz6dMQZ2xg4Z0CTtMKqJ3BKdZuBYsjgMo+beUCcaE rqrVDuI07TP3n29AtmfLgm6yq/ueVRO69VvwLMmh7qve7Pgpc+2HO743AUD+wfoMu83t Q67Q== 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=IFheC66cT3tfPIpD57/N6f+31U8k5oUfW1jOh54W+R0=; b=tlg1M9VD/3Xh80YDCQKHwfZidM+LY+txXUN4XlZwK4pQqslW2TpKq03NzUy2bgAsZB TwiOUKud9AN9B5NAzAsuxZIYBU4yZGGOBR6V5mZVLlQuUdjFb3YtgfWCQb+/CqejlOO+ OAVrSx6kbfqSypwDKn7sron0OEvNngby6pm+C72nRix5QFDtA2lyARtRZIU5fj1xDIeP vATXdGidhoYx5L9yGFN1xcY/ElocpacMn/Ip9oupsWHHfVuPIXum0TOqqQicETo0/hDe HLNRg7eRkYet+iU5aWWaLYPG7OGLPlfI6D1y0fSQX15Zc9mHIPd94MWpn/jMXLuf43s9 mkZQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=KEcQK3SN; 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 zy7-20020a17090734c700b00889a77458fdsi5194416ejb.317.2023.02.06.02.12.52; Mon, 06 Feb 2023 02:13:15 -0800 (PST) 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=KEcQK3SN; 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 S230187AbjBFKJi (ORCPT + 99 others); Mon, 6 Feb 2023 05:09:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229834AbjBFKJZ (ORCPT ); Mon, 6 Feb 2023 05:09:25 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2076.outbound.protection.outlook.com [40.107.20.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ADFD14227; Mon, 6 Feb 2023 02:09:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E/oXj8fisPVvd9AmfoolXeoAPkhbkTHL6XbhiM+P6Li+O2BcCosv64qStLRxz+b0hUHjG9KtbZNxcnqGAst27u7UEKv6jFzJbaVwmwsG1NjRfZ9fOTrCE6yi8VqLzrZlsOpZg8+gslQj7sM2W/+zAmeMBp7XrxZjtVR211eozakmkkHuWht2LIlqmxQwzpC2RYIbtzwnETI163ISZSfxj4b/Wg7HbXuLrWjLO9kCxdnX7NVXvOAEvdR0f0xDvSfR/WQQJJjT69ExzgA4C/s/jADBV6DnDyEZqibZm5UkP7AErSNxZ2hXV6yrXzui9NOZ0NFgOSRbaAxfJkjLTBRHIQ== 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=IFheC66cT3tfPIpD57/N6f+31U8k5oUfW1jOh54W+R0=; b=Xc2Vqn+X3UeQs8Ok6uo/PtTdunFlqKagHy0H/3RHTQ+XMj4fPa/15nqg+jgDETgcDw3+DHS6z4YutV/ssPmZ8Fq+nPLxHs0KzMZrzozVCXFleaY6fzbsCG4uBWBzxUwzCwGD4PgUrAOaK2VLGxhwzdx/75a33mxuMxrlJIBdjUP2b/VR5ksHsIpPkaaZuzYbXAVjYI9r2UERq3aIKLmXngF2Pxol4QQ1ijOCFM/VwFcIOWi0z5n5p1BQDmUw3biRdCsHlYusMuCyLnKqGKzJ3szMFrnW66VIU71i+vl0wN/POc5jSQ57pMc/M821vh+97/lWpXL4cMBSGGd37vd1VA== 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=IFheC66cT3tfPIpD57/N6f+31U8k5oUfW1jOh54W+R0=; b=KEcQK3SNJ1qCFPjF9vARD6Q4KGFQae5RcYd4nLaiJJ4EZFar8yBn3c77o0UUPBTC42ISn+4odqkFgF3j1oBUXy24y2LK0MmPhOkiYJJD6wXfYJk0EFoTKRZ41HVn5k11Ugt0S5tY5whBUdLvjOKcgaMJqZgfn5bPop2U5L9gxOQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by AS8PR04MB7735.eurprd04.prod.outlook.com (2603:10a6:20b:2a5::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Mon, 6 Feb 2023 10:09:06 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%5]) with mapi id 15.20.6064.034; Mon, 6 Feb 2023 10:09:05 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Maciej Fijalkowski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 05/11] net: enetc: add support for ethtool --show-channels Date: Mon, 6 Feb 2023 12:08:31 +0200 Message-Id: <20230206100837.451300-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230206100837.451300-1-vladimir.oltean@nxp.com> References: <20230206100837.451300-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4PR10CA0019.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5d8::19) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AS8PR04MB7735:EE_ X-MS-Office365-Filtering-Correlation-Id: 78a4fc3c-c3fa-4791-2ec7-08db082a2de8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YXZ8JrJ+UTsmi7wi/m82BMAxRCQMpUtSNbxIxwMMYlqpjPEG22C7j9iBQTB+XgK6TlfbEuvla5GMUGM32xTO9NIm5ENVIbmHjRyOVqlx0QWOEPWTrGvPOfYUug5X4H30nodu87Yd1o63cGgXiobvfjzJZyfpV8fTxIXnjzqBYKzXhTiXY56fvmzjxZZ77tZMRiUW58i0GzMd3aqJhC1PMh7i0GxQO2UAqLCxhUjYqCXG7AJREwG8Uy/OlzUbIv9358O1o3frSS62XrVaoD1hg2KXCl4GrQISafyfpVTFXKngzRUCdEgQxw2QRkDmDioKZPNNu86uf39NxCdSg3A6lFcAxYkr7yEEY0RlMOB/bREx91mdJL4cYRD5WhmZixmL9h96q0cNHXCzpppWbgkuK1vVg0bEq1MwXY3183dObpIgoRYmpdP9G1E+UlGpOfKGSCRkun1uZF9uMy8pl775x9NiD8iy7SDWOhTLYf+26fv8jeRrgRkDzcf8sjwdkT+TB10jmFkteLHlX1ZZ+Mr2YP52/IQuAECyCAYT5wN0vCQYKqcTelwFzUoFX4NYvRamM3eCXU7BX12Lbpr/UH0QdwfGExWgF3RvEUu4uTAJemWEiZTd7ZC1YtHQ9EAT3Yf3feY2AHE7y5MQo+Oa8/srlUlW/9spQMQ7Mn+57NV0Z1WRnxLP0JgsF26nvb7H+DhxvU0lhqg9dxgq7SShTBGpyA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(366004)(376002)(346002)(396003)(39860400002)(451199018)(86362001)(36756003)(38100700002)(38350700002)(66946007)(66556008)(4326008)(6916009)(41300700001)(8936002)(8676002)(7416002)(5660300002)(54906003)(66476007)(2906002)(44832011)(2616005)(478600001)(6486002)(186003)(52116002)(6512007)(26005)(316002)(6506007)(6666004)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cNiCUmU7MmedTCDinnwDM9bF4z8cPLEZwQzKINoa8QLpM+CfqdlNfIto6B2YfekbELM5R5sAzfrYUazUPOhP2OAXnatR+obWf8q3cSwFF71xlH6cjcwQP81X8fcXS4UBVg75Py/oEXmod+KVvteP7PXW6cTePJA+ygPISxJ0yTFDTkdWpqsL8BXWJYILqpNeZ/ElOSBV9UdIUeNKZdB6c7y8y2IV/i822GJz5vrFQ49NK9ceCw3PiIBO491rdhOMoEEv57U9bb9ksLEqLbnU35cyEJe5Ac9NZvgn3cYy+Z0mhAXmAf03PidELrt80iypbbIw3zDfgoAoGfI9rhZPws1swUSGn+4GxakRwin5C2JYqq4W5CpfdLqMpyZSPEtqSyg4cmDjfA4Y+k3jm4tD/xZSUxEebYokpZyPrhcPgiAYgD7m23X/MXKE6OeiShqn3Oz0F+9ii3GqCneuJor7VN01ZPK+as+92hSeFg/KxyS5H31uP7qpk76t1e427dx12WzzN7E9XMVsMlZtff+n5g187AbrI3DP3lHiW8BiaD3DRG85pcTeI2njmzkwZA6EIBqnW9bCGTodSiJeB9rK5tjuaSB2qNSsLofQoU9VRRqPGAF1oFwaYR5538oTo6DRAD1tjS60Z85XPeuEAEA6Z/KAXku4Kr3OnEsmxybFA6ZbBmti7ilbFi0pbaljG/ZA6p3y4Qa1xbsaHlylqHb5chTXhD/hGyy+Ufkk/eTf1TonIqv6z1u/P6Pzwz1M8NqDibEKP4V0QP/bogl7pVTQCyBga+UeqJ5x98fvB6g/QqJYMCgz46TaaTZsKxmkKCjmKLnEOxQZWt4ffdOFxKwXbTit7KzHvTq1AQ+Lr20BRa/2JrBZVYaxVVR/ei+3NMPwRuHT16t+rngfiq2HJfai7+FviwpYrME9eF1nQO9z+Ekm/Hff5rtLfigVdYLwnRDYAM6QXEVnmHBU6m9XHnvhompDfI3ROWETzabUbPFhvOZ8nWdyu9Rtwli0F4hzJ8fLcXz5bEzxOaY67NosAagomrN2ilqxNqgBpQawpSpQIDnVRypizd8vXL0inSMSqt29H9DASiXYJlAljuVKEHoK7Yi+iFpSmCoSk0yCMaf42a26Knby/UiKAZPnZhycLAbmVT/9NJ9KI/G6xTYFPxPiAbxOGgoOhHD99JHkyKrqP/XbKx06wokO3mta1XVJodu4gr43zKaDjWzsxd65RSCpb2gUIhipdLfAPvRHt+blvr14KwRcw/hc8MoVHH2r/Ey/ICTyj/nvThNyiFv0HLCkb+bhkjcLPoc2Ck5JDqq1pkKlRn5wBQ6ZiJ72w3GgBeTmELWyuwqqWEqQ8v2WcYNoCU8N2HJy1CssVktVQnT59AGJTPxWUet44BXAg+qV1MPWx6g/138PCQWv9JJb5yAHXBrqnP/3xg0LcipDR+LV2yyZSf7jd3IbktQrGCq8d3T5jM+JvLPtfyQROlfpxzwlsPB/x1bO1W5MSgzkfEaQ5Henq3mR7p+HHRKkX0wFaP2n8o9VXD1rhaTEFrAEm/8MHrYLS1xN2xdMOyXOr/u/Ardae6dFlgOISSUH9ib8pBXgqUsw19wjFDbf09ZkOBUwQQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 78a4fc3c-c3fa-4791-2ec7-08db082a2de8 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2023 10:09:05.6615 (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: GNDDBUXi0MHUHDr3mAY+NsIaaRZCBA9NiiImGyGR4zdqwVC0KNn7TnwnzeWThR4Jmp+EQ4F+gB9C3t6dgCDqJw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7735 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757076149529507480?= X-GMAIL-MSGID: =?utf-8?q?1757076149529507480?= In a strange twist of events, some libraries such as libbpf perform an ETHTOOL_GCHANNELS ioctl to find out the max number of queues owned by a device, number which in turn is used for attaching XDP sockets to queues. To add compatibility with libbpf, it is therefore desirable to report something to this ethtool callback. According to the ethtool man page, "A channel is an IRQ and the set of queues that can trigger that IRQ". In enetc (embedded in NXP LS1028A, a dual core SoC, and LS1018A, a single core SoC), the enetc_alloc_msix() function allocates a number of MSI-X interrupt vectors equal to priv->bdr_int_num (which in turn is equal to the number of CPUs, 2 or 1). Each interrupt vector has 1 RX ring to process (there are more than 2 RX rings available on an ENETC port, but the driver only uses up to 2). In addition, the up to 8 TX rings are distributed in a round-robing manner between the up to 2 available interrupt vectors. Therefore, even if we have more resources than 2 RX rings, given the definitions, we can only report 2 combined channels. So do that. Signed-off-by: Vladimir Oltean --- drivers/net/ethernet/freescale/enetc/enetc_ethtool.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c index 05e2bad609c6..dda02f8d102a 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c @@ -863,6 +863,15 @@ static int enetc_set_link_ksettings(struct net_device *dev, return phylink_ethtool_ksettings_set(priv->phylink, cmd); } +static void enetc_get_channels(struct net_device *ndev, + struct ethtool_channels *chan) +{ + struct enetc_ndev_priv *priv = netdev_priv(ndev); + + chan->max_combined = priv->bdr_int_num; + chan->combined_count = priv->bdr_int_num; +} + static const struct ethtool_ops enetc_pf_ethtool_ops = { .supported_coalesce_params = ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_MAX_FRAMES | @@ -893,6 +902,7 @@ static const struct ethtool_ops enetc_pf_ethtool_ops = { .set_wol = enetc_set_wol, .get_pauseparam = enetc_get_pauseparam, .set_pauseparam = enetc_set_pauseparam, + .get_channels = enetc_get_channels, }; static const struct ethtool_ops enetc_vf_ethtool_ops = { From patchwork Mon Feb 6 10:08:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 53129 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2151387wrn; Mon, 6 Feb 2023 02:12:07 -0800 (PST) X-Google-Smtp-Source: AK7set9vBmyOoZ661Ig22T9Q8s2H5f9uzHs4ddCyt9YdiclQ4ElrTmyrdp+r0bqV9hjvsxziy1H3 X-Received: by 2002:a17:907:724b:b0:888:9bd6:34d2 with SMTP id ds11-20020a170907724b00b008889bd634d2mr25929978ejc.63.1675678327137; Mon, 06 Feb 2023 02:12:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675678327; cv=pass; d=google.com; s=arc-20160816; b=MHR0nLmovMYJLmeqn2UWuWT/2xlwoHKrKlOEyzMEL5N03dWFRxxpa+V7dVS/TaQZpZ 1y9hIMX4GXkLeOuQAPr+aPPGAJDYX6iUSx0+E/AiZTOr2YFEX22wj00te+7hKItKk793 9W3Y2VCMiO9GxQ7XSJcb77A1feFwZpSqXfaNDPb+C4Xs9Foq+klQoPtrFYOia5LPBq8M R7nr+2hvNuTxXIT/Uwo98MmIjADO85ojfxEyMEBSiHtio8cJ5LO+gOZJf51VTGkOpZtG 6g48PvxOuzcjObHChz484AcG+csXv7sYn3tz01Eyjpg/Q8Fp/Ae/5cqvY4/67QK+dwhF Tqxw== 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=E/v6lLmpQeYFlEtgAIe5Sc1tmdXZPd9iPKdGEgDMruc=; b=lIs24e32gT03TMfaKDFktoGONNr9OWl2lXcmhoLP+y6u+3rO1MdSKHge2upNNCf1nl gUkOumnmYuUI1FS/DEL1b4/uzHZ++JdySIDbyohcF1DaVF2qPQ6K5/K9gnh7jnI31CKE /LJxO+XbksuIB9OMwinTIITrYWzbwP6QeOpYu7MY5ko/Ifxf6Q98S1ZxkLDvdNm0V+uh YMJNFIy/sOA1sqh6mtl2Tuhb/Om9xGG03IYhHOoqwsP6hSP8KZeYOdsxyBV9cJdC/spD dgviixp+19dUtn2IXb9tIlEJpNF8274zlnpv6YVq9J2Pc7ow2KsxWspSPYNNmQ51YwEn pbiA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=DSdTuh6a; 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 c22-20020a17090620d600b0087784d21e5asi14205803ejc.721.2023.02.06.02.11.44; Mon, 06 Feb 2023 02:12:07 -0800 (PST) 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=DSdTuh6a; 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 S229916AbjBFKJk (ORCPT + 99 others); Mon, 6 Feb 2023 05:09:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229889AbjBFKJ0 (ORCPT ); Mon, 6 Feb 2023 05:09:26 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2076.outbound.protection.outlook.com [40.107.20.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37F1F13D45; Mon, 6 Feb 2023 02:09:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jfUC3k8oQxDSxkdGvFUFIgAH4WrcaAH6Cp7Tvv8XlgR6JiHeRc8qHZClh1GDRY1lOqXVYDKPE3QSVC8mLGx/1gGQtXd2DsVpNIo/bfzMBAwvdlEwu6m8xJZ77tZ5w6nGYc2le7yRDoAI8k3I9Ub3wAGAUDAt7HnVbv2JnunGCiQQxeKdqNx+1OErnWaVQ5YqOmvoEYDpIRzvmBPGr6qdF38UmAbRN1A5go4skGdIS7g7if3fm2qVl8wo32cbcMAxTBSluVZrDurb3731M2oVR/gbi0N7TXQt3dSDmazB/BT+8WAAu58kG77dXYMVgdMKZH35D+z+eHQs7A/WD8VSGw== 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=E/v6lLmpQeYFlEtgAIe5Sc1tmdXZPd9iPKdGEgDMruc=; b=CO/Kc30DH3wOMmt3SnILZI7ehfVApLNVo5NmpbkJvVbPlS6cVAydkLanxsRR9Z1WVBrTC3PSkKmLsocZVdrCxMz+qgs0KxV3uARPLc2kIsyAInWpvdW3pKGJzEwCaP6idCh0sBCzt6kFozpnqa1eEvd8jr7+EGEEjdLCLMQJog0uNIVLCG5lJpwSU/6rCu+a1U5pIi5bB4E2Kr6QLRyxqAjfDPsflLIheChMLqxyEY/x1apjlzrvUKG5SdProVXvx0qno47X12/5GEPE+jkPEXZp5Xsh14Q0CpxcIbBT8K5KJOKgERp25ta8AMtzYq9hvisnjAcSgxzj0fVPipp0uA== 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=E/v6lLmpQeYFlEtgAIe5Sc1tmdXZPd9iPKdGEgDMruc=; b=DSdTuh6a2gfP1hKTY2ASCBKqM9OT+ybXcHcGXuVi+tsbD9lHu1zEXzvxfFSc85lFtFXmOdjAyRYpGDfMsvC1aUTkYFWQdaXdRI4nmfd6hGjyUxapm+JcKFo6NN75u+6hULAhFtzsIbIKU6frA4DOsYn8m4nb+G7dv/S3R4s3F5Q= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by AS8PR04MB7735.eurprd04.prod.outlook.com (2603:10a6:20b:2a5::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Mon, 6 Feb 2023 10:09:07 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%5]) with mapi id 15.20.6064.034; Mon, 6 Feb 2023 10:09:07 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Maciej Fijalkowski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 06/11] net: enetc: consolidate rx_swbd freeing Date: Mon, 6 Feb 2023 12:08:32 +0200 Message-Id: <20230206100837.451300-7-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230206100837.451300-1-vladimir.oltean@nxp.com> References: <20230206100837.451300-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4PR10CA0019.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5d8::19) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AS8PR04MB7735:EE_ X-MS-Office365-Filtering-Correlation-Id: deea83af-e018-4c9f-f7da-08db082a2ed8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gw08D3GLmD8iGnfOsd6tzX0DQaJyNBlS3tmXRhzJhREKHIQm02vEyDLN/cMD3/SppckRJEiiP60/p+/1mcNhmBERv0PLrygr49UiUqJPHLgsoFZ4V7+8YxdwClNpcRUWgYUPeslPsnx9Lk7RczbuAAkPSparub7EU5QlJvQ07j5aear840Yzhi0D1W0zN6UiLrDb2Pov0QyYsMDn1NQI30/p+suFu0zHIWMcUmzwkO14o9z52blptTo48MIsYZM6KUfQMdj8kVmXYxZTvfZVpPIVh+S6+Gcsj/Z+JB4Y+cb4u/vfhTSviFF2S5ySH9+wTlzYEWZFB0vgYTrG6c7k7pvWIabiV78fOp5C4UOo6mmcowBT6D7js8u2sX4KscCOUwXWuAPSVcZrnt6htnaWbe4ezO03vSrPH9COANDhjo9PJZMNJEFHUN3NFAoix6lEiqD3S1luGacq6U2g+XBjH0sHpv7/VmlCq5jo6W4HHaVf/J7YqzSWt+f+yohqP4dhJjGwB+2NCVwR3SCDIQPaETPZCw+r4WV3F5kudg8oNr+4mH+cfd4CR+oednWJzd4nJWPe4EVLXoCpTUP/WHWkLMtyiceUrGvGt/gET/+RMYWPrUx3GBEaDKICxWppXct9OQ2ZzfbA5uGvtelq62EQ/F0w8rIw1MkrYdcUmFwiPjFkGXUIllp4ZUFUtgEfHbx680vTSYl5C3shvezLx0W+CA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(366004)(376002)(346002)(396003)(39860400002)(451199018)(86362001)(36756003)(38100700002)(38350700002)(66946007)(66556008)(4326008)(6916009)(41300700001)(8936002)(8676002)(7416002)(5660300002)(54906003)(66476007)(2906002)(44832011)(2616005)(83380400001)(478600001)(6486002)(186003)(52116002)(6512007)(26005)(316002)(6506007)(6666004)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0WtJX6tgoavvK4pO2jkDINkepJ98VhBXTcjYzA/QvNyMpKT/2Kb9aO7bl7jdDilSddDc9HDDUUgoQrj+gnxN4KXgbLRhO3HROATTUsvTtprbOkB0Zolqs+zjCbb+l7P6Zut8A2JT9c0GnfYtSmV3rE2ZKQJ9lVIPvY7EGqSoJBnjYJqdx9e6WCwOPrOR6eRdmR+YcT18coIrNuA5JrmnhLYKLgo+WQPy+2J0B4Vkq573ofd+UKIX0IcCrz13Kyx+dsEKGy/NbR/joZYUDbnH8rk+YuE8623i5f428DSBeNsa/RZUhd1ltduvQ1Cp4tDRmOAfIs0JqYDpdukDVt6rwch66LBp16B0sA8UjVXUIgBaq6fbC5X6iKaTNOc1unCQQ1RLMSj8CFkcXuQRPOUPXT6YUzP16bz5ywxZAI9hsQHwM3hJGxiVZ8oJLHYRvZXmCWSqw+OjIcek7R3uxAWUaYOr4s8G4z4JfRfzbDJzCqg80Wj0KBUogTsOgEShgRzgTCUO57mBnHKtDNgXsvn17EUdQ2UKAn5rOLDrGb5UOAvQtImbjyJ5Uil+atX3IOiUfYnydLHBY3u+k275w+wW65HOfEFHUGFY/4bVGL2ed07AiXM2EqBT8K3aOZMBAqOvLCO/g8dP+z3M/wmmftGUUetRZXWVMkQOth4BMnyDYhK0rOj+dS3oyi0ltp5nh50NNHmCklsq5aH9XnQhK2y4NVFUZ9yHGmn48YODAReh81jo97Oa12cHmo2Nzbh+x9zo+GyYdjU0OH8Le4Pmml6h798Nw+FiaILmW9fL4A2vnSC1C8YRhsseTT/UruDA6YbuiCQdf9vGrZvj4CtjzCQC9e75R/HK3dbUw/Yob3ri9Axf6dWKhBfy6/l+Cc/nZVrd085jZhdIUV8ftmcV63L2v8Is1UYPDJ0PPSMUL34c+yMfys8mNZ0xe2Vdf9e0xH4ePvzlwq+edgILSI71aDfEWozN/IkwbvUgGDFbpS1DTJCLFZGKTSozLUJzSShJpaGMf1MShQk8N3aPs5joM8E+2CLuzF1PeoUfOlKR2r3iRzGdLNZwucjvuqFcHTTR6z8Jc0zazv/cU69eR8HFVa8C5lU7kLngBAeT86t9AGOwvE5BxAtXii56YOv7PtyfxrhVzMjyvnwwDs+luR8oTGLy1TGgRX3ONM6kazxGEdAUGuCNkmzVUnDtSmRhwH4zkfRut9TZtIrE3FCLvnrxbYUiRsG7bSKqaNFewWofU3ExKSP8R2OPY+JL+9q0WJdmPExar1lXsugXac0xg6GWCbF2RbnDAehdXucxyus2GMJZYNydIKZTfxETFRQqGLbM1GmmFdt9ODhzoFh7j6f5a4f1Sn8qHq1PwcxlKNxJHIphX57qrSc1W4vSg7fLhSwE7AgRAXpF/wSte73inR1ThGYQuq+ik2f/VlEKxotESlogWAnQgTjkVMzHXqhNW8pXynNbR4KzFDaliYFE4YNnklYjQCmqO+fRp8Dha8J+CmusQfUEYpHFmDt08ODya0aHIqhw039E0eN3AQLcSkstImYSeysYvRVxz0G4QopJYrxnK0JTT9heNRQmp/1yLxLRM7zMAhAqNnZ17tTeGRlKgXjfnQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: deea83af-e018-4c9f-f7da-08db082a2ed8 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2023 10:09:07.2864 (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: Uili954G+ueKBVREPEZHOOwh/WsPpopmjEVxJYXdkP5URBPBKQdg1iJ7YDnNvuNWQm4r1KKwCKhNP3mAMTCdMg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7735 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757076077672147492?= X-GMAIL-MSGID: =?utf-8?q?1757076077672147492?= There are 2 code paths in the driver which DMA unmap and give back to the allocator the page held by the shadow copy of an RX buffer descriptor. One is on RX ring teardown, and the other on XDP_TX recycling failure. Refactor them to call the same helper function, which will make it easier to add support for one more RX software BD type in the future (XSK buffer). Signed-off-by: Vladimir Oltean --- drivers/net/ethernet/freescale/enetc/enetc.c | 28 ++++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index 37d6ad0576e5..33950c81e53c 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -95,6 +95,17 @@ static void enetc_free_tx_frame(struct enetc_bdr *tx_ring, } } +static void enetc_free_rx_swbd(struct enetc_bdr *rx_ring, + struct enetc_rx_swbd *rx_swbd) +{ + if (rx_swbd->page) { + dma_unmap_page(rx_ring->dev, rx_swbd->dma, PAGE_SIZE, + rx_swbd->dir); + __free_page(rx_swbd->page); + rx_swbd->page = NULL; + } +} + /* Let H/W know BD ring has been updated */ static void enetc_update_tx_ring_tail(struct enetc_bdr *tx_ring) { @@ -796,9 +807,7 @@ static void enetc_recycle_xdp_tx_buff(struct enetc_bdr *tx_ring, */ rx_ring->stats.recycle_failures++; - dma_unmap_page(rx_ring->dev, rx_swbd.dma, PAGE_SIZE, - rx_swbd.dir); - __free_page(rx_swbd.page); + enetc_free_rx_swbd(rx_ring, &rx_swbd); } rx_ring->xdp.xdp_tx_in_flight--; @@ -1988,17 +1997,8 @@ static void enetc_free_rx_ring(struct enetc_bdr *rx_ring) { int i; - for (i = 0; i < rx_ring->bd_count; i++) { - struct enetc_rx_swbd *rx_swbd = &rx_ring->rx_swbd[i]; - - if (!rx_swbd->page) - continue; - - dma_unmap_page(rx_ring->dev, rx_swbd->dma, PAGE_SIZE, - rx_swbd->dir); - __free_page(rx_swbd->page); - rx_swbd->page = NULL; - } + for (i = 0; i < rx_ring->bd_count; i++) + enetc_free_rx_swbd(rx_ring, &rx_ring->rx_swbd[i]); } static void enetc_free_rxtx_rings(struct enetc_ndev_priv *priv) From patchwork Mon Feb 6 10:08:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 53130 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2151451wrn; Mon, 6 Feb 2023 02:12:17 -0800 (PST) X-Google-Smtp-Source: AK7set/w6khnn+Eww2NH9Yhg8c0+nGvhNpIRl1N6oqa1wCytr9JDFWxPXQU6sbfjGRqjAXmXZad8 X-Received: by 2002:a17:907:c14:b0:890:4731:d1bc with SMTP id ga20-20020a1709070c1400b008904731d1bcmr12557395ejc.38.1675678337748; Mon, 06 Feb 2023 02:12:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675678337; cv=pass; d=google.com; s=arc-20160816; b=ln1lLe2s8hrKnRzyPWC7JJfD4/jbYYNLpeX4YZtZik725OuunVsjrq8/oAp5QBSXeX lD/RawZwL8O3PuYwd4zCJgsOBYDBOoNzGWF5keU1d+MV3nijsxm48lR5+0DbPfUmLRZ6 Hn6f5qeT4IlgJ0yeHd5OyWcHvoZCJHMdo6+ULuIBblRBaGPmGJz3W7o9Rh43Fx8bPypT DcivOsKJQUb1T1bVkmAmMn3cv3erwZPonh7K3ERN7VuWcHpTs96R3yrrKmtA8fkm6PyJ 3Ab0sbcwRiNhomtV0AY+ed7GykkxQVvJfAqVUuslfLY4ZuGl2LoHG6czNZntOZoGsQrc zKaQ== 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=8CjEZ3qPqjoAGnJWcglwbUA8p9Q13/ucOiN10ijM2Bs=; b=s+dRwP1bGec7rqUN8vkF3wpZ/Ttd8lyKSkSRfK80Q5mQTpc+eXdusESECC1L7CabT6 5FJ4yQQxNQNemuZ5WuL2GTQIUHAhyJOazFJmuE3FMso5syqeYqf9vtzZlJI3Ip/Kk5NH cJfuDhjPO/2pdxq9hmzXMllfK6tJwtZjWINZElBsrGwKXcP20Y3X7sk7Spn8utvRPcE+ u8XJarMgLaIgijM/cn7MMi0VhQqJx+t/EAHtoF1RLKRpxy8qFEuy/l3xZn3BUz0NLCUW E5WGM4p97tSqAS+2ctnbtKyWG59sjo0np1BAAnf/M2ru1LSmsuk1yh/cG+w0YXg/v9PU uRPA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=XWajIViR; 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 vz15-20020a17090704cf00b00889794debc4si11354286ejb.775.2023.02.06.02.11.55; Mon, 06 Feb 2023 02:12:17 -0800 (PST) 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=XWajIViR; 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 S230202AbjBFKJo (ORCPT + 99 others); Mon, 6 Feb 2023 05:09:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229899AbjBFKJ0 (ORCPT ); Mon, 6 Feb 2023 05:09:26 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2076.outbound.protection.outlook.com [40.107.20.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 525C71043F; Mon, 6 Feb 2023 02:09:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ioCCbDBbEyu2x4T2FTHriSS3KgMiLSTFvdNBS4GTF4kdYfcu1NN3dRhcNDAlWXSAWBWgH1OEUxjWIhqYww/9ksx2gzIY6i86kGnoQTyeFOsWbsA33wBLfw/FvVhsrWREsN9e6Nv7o3xMwDiMk9W3OyZqfm2n/qu7WmiHCpHd9LqAIaTwmZR+HDHjxd7Pw5WVUAsb7z7VZOdb6KHH+qSZLCLRBPwR4/iJ33yXq1wSjdHjl8AfLD5VlzjV1yia1peMM8rnRTK5UVhQBU7vlCp7xoDEpoYyZPdjnPIIOb+pOXD7NaKhfarWQZ5Z8h/klZ6bnNFp+HoZmIAx95702wYI6A== 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=8CjEZ3qPqjoAGnJWcglwbUA8p9Q13/ucOiN10ijM2Bs=; b=ipH4ZqU2b03EPUTCmtV+fW9fZDpB/vdKSG7TmFQabVwCUwXo/wr/A85EpNHB6ELEu5gRmgrfO1c66WOqrSzTwDXUKjIS/WCzW007xxBBpBRa/BtBJNB1RGAEF9mSRf6a7cDUC9C0mUZJQ8dzwy5gtt2LRYwkI7OpxlQri/ghXYqWalTZLLHal+vGUO/vWQgUmouZ9wMiqfEkLGYxuS+N8V3n/JqOHoRC+Gp0wAGL7amttK6FaECwOewmxOBXluscOaV+5uCZRu8I5Ab93mo0j2Z0HO8NWdTR/jbZPIWkrFmKWpSg/VHuBnntLWqELcNFYbGsAF82RWUY8e+7GgGvTA== 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=8CjEZ3qPqjoAGnJWcglwbUA8p9Q13/ucOiN10ijM2Bs=; b=XWajIViRiu9cm6DS2OA0xo9P/7sZoBuD0HewQ+FulspW2vNDgZy8LNxsucDsWtjJ1by3biDHjNxCXVvin6vne7In9gDcjLFtlJVrSV3Bu91rNRpcWoi8gGGixezz3/AyHy+LJT/TKk3JWMgHgyrsUha00mgsvLpwClQ5kR/beo8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by AS8PR04MB7735.eurprd04.prod.outlook.com (2603:10a6:20b:2a5::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Mon, 6 Feb 2023 10:09:09 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%5]) with mapi id 15.20.6064.034; Mon, 6 Feb 2023 10:09:09 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Maciej Fijalkowski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 07/11] net: enetc: rename enetc_free_tx_frame() to enetc_free_tx_swbd() Date: Mon, 6 Feb 2023 12:08:33 +0200 Message-Id: <20230206100837.451300-8-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230206100837.451300-1-vladimir.oltean@nxp.com> References: <20230206100837.451300-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4PR10CA0019.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5d8::19) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AS8PR04MB7735:EE_ X-MS-Office365-Filtering-Correlation-Id: dbb61087-c5c3-41c1-ac8b-08db082a2fd5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8DDQa73QHUqNWYPL9DizMsoHDRH+s1z3unOvxsY8As1DwZ2dAMeuCma0XSAg2TBQwb38d5iRvjIDovpORIfYOy+fdJOIZy/xa8rNIm+1TlwyY7DkCgAPQp5Z6MVtmJ3w9Q8kquNZPd0PEXnMbEQcyUDCz2xjB94/MYEbYLmk1ZeYAoynD4J2W2gDnhwiRIo31v9NWlAiNzjixvcSdUlSSAw8iyiFWTvAMDsuNygIi7WXw/j5ZHj6o1Y7hUch/WHpmQ+OWgewnNTCoMSBNZ5McVkTQn5J+LeCmf2V4/QQiG2mYYSXFiSc1TpXYCJIZgdD8mUV9oxUIzXKlrUDJkG52Ww3H3Y34pPn2FZzMVaUmuPBO9maXp1FSopWcARsEsg62BUZkVllFqjOpGTH8PmmuVjqHodNnBoJ/niYw2zvJIU3BZrUhNE9attVZyEVV9Z7QQAlpqygjC2V61D5X1nCc+NKQ2mbUkkQs7Vq0pc0oHQw3xjx+BMNJf4wvXp6ULnfxVZOq6mLHMDn0uIsEtwMcCECCSB67VHeW6S0OfXg+L322WPYBJnum7mv6l7+9tltLJNWyBE4Vn5H16oIws8i1MIVh1rH33UGq7Z8bkZu6iQlTVMQHS6dZ7KMR0f3mpIZ8d2JaDIO58JMBgzpB7bYjTitPWM2v51URyRT8wUdkHFqeM/AgvBPLLbHrRPcItCf1FOPYTzgjrePyNyeOTqObg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(366004)(376002)(346002)(396003)(39860400002)(451199018)(86362001)(36756003)(38100700002)(38350700002)(66946007)(66556008)(4326008)(6916009)(41300700001)(8936002)(8676002)(7416002)(5660300002)(54906003)(66476007)(2906002)(44832011)(2616005)(83380400001)(478600001)(6486002)(186003)(52116002)(6512007)(26005)(316002)(6506007)(6666004)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ihj5yC7QGVM4q2vo0/wvwU0/p50SjaD5sFDviuZIQJi9Kl51hcNj2Mo4NtJc3mToJ8MHM3EvM56qzb0iZC2yWFhj3LiSddFqjPKoyy1uzOdGsYCxJeehNV4cPMbArzBVzTL+FQEBUAu5yh5dj4LBRumdD6GnDnRQW64qMs1s3fmKRvvoGmxlc3BBnwiBMucU2BPjh+N1bBAQgZUlVsAigZTFm5BsMEOW6k4I3ADhe36kL7h/03AonXqHaRgkR87BLgqNY5NqZsIo44Ox8hQncrT52rt40NMG8bU5orWuop7IUeGdWZ+zoC2FzwtVbsnVb6padd64y94JrWZJ5xqyVxwu/+02nlkE+R+unDyQsRsCTlMiFlqc4LtxHKpQs+tjAGcd6iM3hL6HTs4y7nA/Ec9BkdKOxr2NPEVY6lLF5ACj3CfnC1QwHzS/O66BLB+Boo9kyjXKpG2Qabu4I2tADFEwssCnDZ65VgtlJn34VV380J3QQCGTXyl4R6LERkYvw2NRLWlU3R+Y2qRTvfftjBt4Q9yioGLhYT0XQupZblTmST+lUtaJPC/VHhC0ixIlDURFtQM4f5y9XPvWfCuQ3gxVukK7Ti/twt7xtLU5H8+jLK+MrBQnZD5bGc96DPyhVL6cw+3JE6rlG5BZzlJSO4YwduervTI/TrK6F0zpXslIkPhEz+2pX9ExnsagJ6jrdnlite5q+Am3bAXVwpA/hvyTUxOpvUY/rBIiAvTw2wDZkYdLAplE2WgH4Cyxc4qr2KIbkukTPY4In9CBpS1H/XC4ecqGLUxNDbCrgsUfZJqTz/sXdNBU2s7HUI8/0wybr6Q/IVe+WECtfkUFlNkuQKRlK5KZJ2nHlnnyjAgtQl5luHXVOmZMKZwwazZGmWH5kv58FtBhicGl5iTq4uGy+RC92kjN1zrNCQWC5vnRUPVic4dHfDxELDVp/KR4Z578xn4cjdIK6vXbbDevpxpifn6d1aqiUMtgg1bzD3QMh826s1oc5l9Epicg7tXfVXisHHzBdbKUnKeOsHjE70ncNSKQ3YEjEYO8a0OrqfkwWvHPhe3WAIkHcM4inBDfAiQ61yBbG3Hq17W0HRulZSw41YKaQZwvE+2IGqJejjOOx8cO/11Sqb1gza2cw7wd48IwEbHgNeTAKDWNEmmGb6KulT4vBl4wC90RD7BvmHoxhgZ5iQWylyjLivBLGQOfiIIK7TyaufAcL8Bhux++RqvfuamJWIkE3W7TE/B/m7bf7SkBQPgWnl3oH7ZTOtkj1rQPh0hC2XBCZIF38f5fl/lHsH7O0CPl9hujj8xCUq6pjRAEaf3mR4Sxj82sC8YwpQ4MxkBnm7Oegw/2V8UVzScO8d7qzj7y/P94LqcwvqHmrA1koel7SP9rYtNNzCAzZPwxpWG/Vvy09kufBXPrPP0nvNZ0SMyQoJMbHhkdXa1IwOxdl5btDEHuZaHhb37TzQblrwt9mKFuf2zZbQIfuf4B4EyR4Onuow59TSneh7G/T+fWrvz5lmxHcx7hph8v5+HxkIIz/ruIfXtLiGpPKo8+PQZ1PIdiFYybHoL4w2SQZ4/JMJQ2S0HSI5F51ELIL/EKJ+VQ3dNJnRMBAgJo9cSaEw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dbb61087-c5c3-41c1-ac8b-08db082a2fd5 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2023 10:09:08.9425 (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: ku7GWQ/pri5E3lFcRdB58Akh00shgqAYk6bMJBOHLW7ES/QE0phgn2910kHUoeikjXYcw9QkFB2n1mdtg+6ONQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7735 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757076088733872258?= X-GMAIL-MSGID: =?utf-8?q?1757076088733872258?= Create naming consistency between the free procedures for a TX and an RX software BD. Signed-off-by: Vladimir Oltean --- drivers/net/ethernet/freescale/enetc/enetc.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index 33950c81e53c..fe6a3a531a0a 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -77,8 +77,8 @@ static void enetc_unmap_tx_buff(struct enetc_bdr *tx_ring, tx_swbd->dma = 0; } -static void enetc_free_tx_frame(struct enetc_bdr *tx_ring, - struct enetc_tx_swbd *tx_swbd) +static void enetc_free_tx_swbd(struct enetc_bdr *tx_ring, + struct enetc_tx_swbd *tx_swbd) { struct xdp_frame *xdp_frame = enetc_tx_swbd_get_xdp_frame(tx_swbd); struct sk_buff *skb = enetc_tx_swbd_get_skb(tx_swbd); @@ -331,7 +331,7 @@ static int enetc_map_tx_buffs(struct enetc_bdr *tx_ring, struct sk_buff *skb) do { tx_swbd = &tx_ring->tx_swbd[i]; - enetc_free_tx_frame(tx_ring, tx_swbd); + enetc_free_tx_swbd(tx_ring, tx_swbd); if (i == 0) i = tx_ring->bd_count; i--; @@ -580,7 +580,7 @@ static int enetc_map_tx_tso_buffs(struct enetc_bdr *tx_ring, struct sk_buff *skb err_chained_bd: do { tx_swbd = &tx_ring->tx_swbd[i]; - enetc_free_tx_frame(tx_ring, tx_swbd); + enetc_free_tx_swbd(tx_ring, tx_swbd); if (i == 0) i = tx_ring->bd_count; i--; @@ -1986,11 +1986,8 @@ static void enetc_free_tx_ring(struct enetc_bdr *tx_ring) { int i; - for (i = 0; i < tx_ring->bd_count; i++) { - struct enetc_tx_swbd *tx_swbd = &tx_ring->tx_swbd[i]; - - enetc_free_tx_frame(tx_ring, tx_swbd); - } + for (i = 0; i < tx_ring->bd_count; i++) + enetc_free_tx_swbd(tx_ring, &tx_ring->tx_swbd[i]); } static void enetc_free_rx_ring(struct enetc_bdr *rx_ring) From patchwork Mon Feb 6 10:08:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 53133 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2151951wrn; Mon, 6 Feb 2023 02:13:33 -0800 (PST) X-Google-Smtp-Source: AK7set+72+9e9QuEBsi5ocCiA2wCTSk9jd+bnp+9suTyibA79FmYcWgYkFkg1p53k2EOnb1G0CSl X-Received: by 2002:a17:907:cb20:b0:885:2eb5:68a2 with SMTP id um32-20020a170907cb2000b008852eb568a2mr17620101ejc.16.1675678413461; Mon, 06 Feb 2023 02:13:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675678413; cv=pass; d=google.com; s=arc-20160816; b=d5gROs7yhfqKrljx6AbReK53VT0r23uZrwJ/ngoHbcac39dP5gX8qMJGCMRyxiL3Im 8PkuIMJZknOUnPHghV3PdTVieclOyFXip95CbE7Jbzrc79ioNlTsOBG229v7gFpF7ySO x4WFPJZhtJ2tyf38uE55uatvrfoA8UmhfspNSUM8cc9ITAojhdE5dA0+TqvpYIpnqX4P k9AQEsFzSGhPYYdLJVJeStvgTW1vHBDZGCWwYaKw67fQqIwhvpShsdWD59VNhyX47Xeb rl7q3z4q54j6C/dcf85vBSmW+sX+lt6kwYCqt1AZm9xFrJKde/gGZU4eEqg/cybRxDG4 E2HA== 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=6HX8adyx/UjrtrUQWVrKO7Rm2DDjXOlzD+nWeVmVxg0=; b=Gskpa44m3SrQW2nfLliP0LDWzwOgfCyFVkMhZPY3aMsjPf4zTseEPk13tHSsDz1PJg 4FmlTwTkV9+IYVVxWYWVYavyEfz7qxk+pUa5s341UNhWP9c9a1DD9/83MxMosmIS7QEn Fdhci01AR4QGBOnLd81fnUymMuCy4cx0iH2qoYf2qvkNSH0D561Mh2TTe9qbJB5NZOGY /cdRQgUgHAJ0qyZgqwwh3urpDrmEf+XhPnSFP0PK/C+AVQ42C00HWXGsrfNfveZXiagn i+gxq84e6+uEK0AnADEvGZV7PnWBqedMzm9r1Zqt+Wz1bwt+kF1kjaScFf1ldkVGeFR1 Hp2Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=TchqRMro; 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 c23-20020a17090620d700b008725c668f2asi15671530ejc.590.2023.02.06.02.13.10; Mon, 06 Feb 2023 02:13:33 -0800 (PST) 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=TchqRMro; 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 S230224AbjBFKKQ (ORCPT + 99 others); Mon, 6 Feb 2023 05:10:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229917AbjBFKJ1 (ORCPT ); Mon, 6 Feb 2023 05:09:27 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2076.outbound.protection.outlook.com [40.107.20.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E940616313; Mon, 6 Feb 2023 02:09:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QP36J9PAqdgiLNys2mwO4JXww+Viv8vCuVobQbSzCu9n0tru0lVoAk+88vEzZwbH+Olndc4kroPKsDfMxKpkP1g548NmSs92qi2aJU5PwdvRH6jRNQtKxiuHuz9AaOywr1wXqWOqBl7r+R/UUrQBBlp0F5qCww9Pc8cfhYEJT7KuBbe3eRGMQlU7upSrIxnw265TX9AG5rRxaQcRzQ/M0rymV193LLk0zIoc4cUVOA4EGJa4UHFpsAE4zZ15fj9wT4G1EhsGtC61S5z2//HCIYvQJpkKtaQOfGsonRLOhrRTkWC+9UvAYwwSwOMGEvlk6ZzJ5zMwwuI2Rwyk7DUOww== 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=6HX8adyx/UjrtrUQWVrKO7Rm2DDjXOlzD+nWeVmVxg0=; b=Th3qC3dZOAjCuWuNhVuW9dcjRZShqVbM2CrIuCFtjwJrnkD0nOyVodw+x9nQD4Ck5vjnpmM88L5jgLycQQ4yxqBXgFL5SDefhiVgW1nRYSS4yzJWDxr121fJmLaR6aKX0b2knKT3xhInhhWm4BU1vtuND7Fu4H7gd76UPoP3zftC1Im1jowRx6aNC3WXbW7n1WVWFpiU9NL8+H7vZ6n0aRYjSO9kO7MmDEptFVBJTaHQKXQs5N9NJILsIKZAsgf50qzFXb8pey3W7Z6wYy92L7lS4oqRbRUBiUzzekJ8f6JVVmhtJUqcViJUcrhhkoJwMX5JdRB3YZa/2PZJ90bgKA== 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=6HX8adyx/UjrtrUQWVrKO7Rm2DDjXOlzD+nWeVmVxg0=; b=TchqRMroc978EAtcMPY46z0LQWlIhBHEMnGfzQNFlqZrJHX3ETKFEJGuB2o+PXLYRM4JfbhUCuNMls1G2PTGUVck52ri4fG36bm3pCwl7xP9RxloGTaqRWnng2LDn3HTw3JVHBde1Q/BdevaZX2KqKKLtI9gu156+2ba+4DwAP4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by AS8PR04MB7735.eurprd04.prod.outlook.com (2603:10a6:20b:2a5::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Mon, 6 Feb 2023 10:09:10 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%5]) with mapi id 15.20.6064.034; Mon, 6 Feb 2023 10:09:10 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Maciej Fijalkowski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 08/11] net: enetc: increment rx_byte_cnt for XDP data path Date: Mon, 6 Feb 2023 12:08:34 +0200 Message-Id: <20230206100837.451300-9-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230206100837.451300-1-vladimir.oltean@nxp.com> References: <20230206100837.451300-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4PR10CA0019.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5d8::19) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AS8PR04MB7735:EE_ X-MS-Office365-Filtering-Correlation-Id: af5c78fa-d000-4a21-9c92-08db082a30cd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8+zJZ1QlQ2OH+hACfirICRvzooZFDhz3okMqBHVpFncf/3xL8mQfJzKJiBBmJII12TKEAakJjJkdS0xWeWOYoRtJrlAvPIDXlVwggnaIYJdm9oix/9KQanuhneYlEa3bU1TWwsbxBW0t28xFyX0bCpNfGgRAqxdFuVjibRu3MPU39bEDg3obnqrakJ6wMYTx0fq8+BgT5LP4BPaRJvSxck/aru1+ivq5hoRAkoiIPH/XAf1JSlmz4U8ojwVSOv62iFGAYTetJLNYawMvX4jv6JUmKx4beUd5TJHZS2kPtXS6uZR9o4PeolcHbtmxeOQRtXENJ1gDHhdOybOu73VN6vONJYrziSFmZ2cky+BDRxZTDhXQ6iB6y+6jkVHYqFpEI2sAFkPopAII5cb4AUzdxEYMfVOTiEDYlqQ0zvh+cTw4Ovv7HTnk/aocmWFkZyUt76CYmVTTB/p58l3q40u5inbId+ewvluW89P4lg9BMDhe3/MpN5rh+ptFho58vFeJO526AjanRwIF2Jc4V8WFC22FKucC+rKZVfXFjqjJ5Ykh2w3e7OmSh4UGVejA7AnQCiY/2z5Q32y+YFgKHsePBSg3ZuoIisfdIgEAPDKwboGKq15NjcVp5SwSeA2hwG5SxDur1d8mPfTzH4V2aUYDNj13b1OzuxaabyFJyAU1w9zEGSW8VBfFzf8/rFTc39LvWqSBmI76ep+41pOnULMAVQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(366004)(376002)(346002)(396003)(39860400002)(451199018)(86362001)(36756003)(38100700002)(38350700002)(66946007)(66556008)(4326008)(6916009)(41300700001)(8936002)(8676002)(7416002)(5660300002)(54906003)(66476007)(2906002)(44832011)(2616005)(83380400001)(478600001)(6486002)(186003)(52116002)(6512007)(26005)(316002)(6506007)(6666004)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uziW7g463TYMk/bNb0TDAEJm9xVQoW6+vzbhHKlm/CKSjdEboiFrRUBVRgAH6vjiBtHklID7pxjrIm67dNOMnO4x9FAdzUIaRSwh3sZzYRDHR1gWGQuKfcKmaGySuDqzI08jOT8n3S7g/x5UvMhbcQiKLShvPLhSTuzp2elREvk1rhiAtBiuPAnktOGheU7LMunVusGZINozxTiclA+dhdzVC0ICqi+bQs4rVo6uIq3URUxY4YL7Ykg75zxRlXUuOjLuzhQYXkvO5Fe1vRghOnUyQPvwnv4shv+IdxHQKECgRJWRXmLGX/59RuwvDEARxIwKl090Ci3uG8ArtoWSZ/6rTBAUnSLMSwW84qTH3ld0Tca6zwc6Htn/TrMdxP0pIhZMbqQhepxMbUsQRjRe8CeXxM+taB9cDN95iw+XfsLsMbE47YNogp3d4jw/aM3Re6+90/FheSXf93WtojcLa8llXqeyiIyPJXRv4OaESEI8I8gz7LoO9q9AzDX/gVMPI10CepfXxa4scFgdGgIqSesy/sC4eT78HiOSKwDlVsjTPHK55DjFFzBt90yaBu0g0cU5UYBzciIyJdzwLl9YFRB+UnQRyhCvWb4nZbFuPIjjPabgpW0lGgUQfJme5uxgSN4oLn/BmcgNe8xDs2BkYbiFkAymCQCAtpaX56X1d0Mdb90LXcEtcx0rXs6uqUJXA/6a+yP4eqR+98XSCLhhMUYTC8IaxFjcPn1fVpKvcJUiD0SSi5z8cCBiWDVy/+r29wpPK08FmFzMJT0G3cHuBadJ8f1MuUong7WxmfHouEnGrq3XXiIgtfwm5RA8YeNMvsebv/P93rFWspJsaylyXZHN4P0X5GBALjkkSgTgGl2g+w16UBjhwXK7Tauc80fvh30xxdu5kuWARHJ6dU8k50FfHnfC0tRMGYob31rpY0nMwhdH0KgU7DpAwKk65mj/ryuaA3lVOQpsiwkyTMNGG6zLaoQ1Gu+EwDNsWzJzg0zh+mhCXS4CaozSN6CezJeF4v0mCiJ70rsn/5A+NNCiX/9wWSlblHMkB7t8MBEji07Bu5D0V0YNvYhVs0dZ3LOSLYs82Ec/5An6+cj1Crnyi+ImYpTBxLEmB/P5PUfAEipzMcV3T3UCUZOWStglkCFj7biqnRp17ileoYL1SAz6vg87GSI05FhBBKkszN7QhCZJB+4D5xeBUJqrwRM3RbmdFUfMGXmCrdmLunEply1FDqzJ4H43H/keyujwE7dtOr7i14Ewd2Oz7RdSMNiWNaaxAjTvlJPwlVgO/tOTWj8sc0spo625WR0EH2unwMtjFFg2KjiB4BS6aiuX1QEFhxJhB4lO7zi/3qfoN3UV6IKQJzpfx49/2oSGee0XlptHXGXBYuy33g4OJoNJR74YOi3wGhBUpqDmpPILGcd9cftZxgtmcsevGZDwrTfpS4whG6cILvdk9WLEVVW68j6S6/XMViHdXk4r8AeWjRcuJ24qB6ImHKenKsKU23iEy0SD1Tl7Mz42eLhH9ifoqlHwZfEraFufnTYbaqO7vpvLBHlRcQqBsubmiwj5jdljg6mjP+DtiYtHi6ben/xPiCvsfScSNxIslXFcwPkpj+FvxTtQpA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: af5c78fa-d000-4a21-9c92-08db082a30cd X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2023 10:09:10.5518 (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: /wBWapCzUu+UfS/NPDKOAko4UyOd67Vjcl+Jx3XHhAN3QZSlK8zM5aM0UcspF0os1TwJsy9BSLtV5mpz7PTDlQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7735 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757076167978159195?= X-GMAIL-MSGID: =?utf-8?q?1757076167978159195?= v->rx_ring.stats.bytes is apparently only used for interrupt coalescing, not for printing to ethtool -S. I am unable to find a functional problem caused by the lack of updating this counter, but it is updated from the stack NAPI poll routine, so update it from the XDP one too. Signed-off-by: Vladimir Oltean --- drivers/net/ethernet/freescale/enetc/enetc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index fe6a3a531a0a..e4552acf762c 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -1461,7 +1461,8 @@ static void enetc_add_rx_buff_to_xdp(struct enetc_bdr *rx_ring, int i, static void enetc_build_xdp_buff(struct enetc_bdr *rx_ring, u32 bd_status, union enetc_rx_bd **rxbd, int *i, - int *buffs_missing, struct xdp_buff *xdp_buff) + int *buffs_missing, struct xdp_buff *xdp_buff, + int *rx_byte_cnt) { u16 size = le16_to_cpu((*rxbd)->r.buf_len); @@ -1469,6 +1470,7 @@ static void enetc_build_xdp_buff(struct enetc_bdr *rx_ring, u32 bd_status, enetc_map_rx_buff_to_xdp(rx_ring, *i, xdp_buff, size); (*buffs_missing)++; + (*rx_byte_cnt) += size; enetc_rxbd_next(rx_ring, rxbd, i); /* not last BD in frame? */ @@ -1483,6 +1485,7 @@ static void enetc_build_xdp_buff(struct enetc_bdr *rx_ring, u32 bd_status, enetc_add_rx_buff_to_xdp(rx_ring, *i, size, xdp_buff); (*buffs_missing)++; + (*rx_byte_cnt) += size; enetc_rxbd_next(rx_ring, rxbd, i); } } @@ -1571,7 +1574,7 @@ static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring, orig_i = i; enetc_build_xdp_buff(rx_ring, bd_status, &rxbd, &i, - &buffs_missing, &xdp_buff); + &buffs_missing, &xdp_buff, &rx_byte_cnt); xdp_act = bpf_prog_run_xdp(prog, &xdp_buff); From patchwork Mon Feb 6 10:08:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 53135 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2152141wrn; Mon, 6 Feb 2023 02:14:06 -0800 (PST) X-Google-Smtp-Source: AK7set9uM4reLZSvlYIvLlCCzkAU2ksIdvZrNNoVYLBaUlYAfZkyw8fBbydm6Sfe35WMhXlBwqkf X-Received: by 2002:a17:906:8d8d:b0:7c0:be5d:59a9 with SMTP id ry13-20020a1709068d8d00b007c0be5d59a9mr11625235ejc.20.1675678445935; Mon, 06 Feb 2023 02:14:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675678445; cv=pass; d=google.com; s=arc-20160816; b=d6Nb43Yv7M2jv8d1WeZ/EzweFToOekteFKNppzTWp2FCWsUf3XDJ5rzC/oqVLe7GQX Vu+/3LrZxbyoJhhqrTaT207V+cRbEPbsLIt4hElYk7KladIsCuZSGoyY4iaW39FBCpul oHvgmC9WijIbEcZ2rOYPQoDfIUgimkWGeWk4yulnLXAj4CwK5WoaleLvBCYp0+gDiDQY 4q+IboFlQypMg8jJsiSu4UTev18d3kPx5raaEyWqAjhuYiZ4IrykTjIca+aa3+rtUMy0 o9nPLeSixzupy8SLAIlhkmVE5B2a4GY9tIbwrBOYgALGirsoFktM9aqBElCLy71OLiNT /oag== 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=Y1VObVU7XtxZAbGlqMoizJddwCxMLHnrb49AzScRiWs=; b=JRQZmNVBx4bP45fzoSFtuWK0v5vjr3AD/pt32I1MCszwofCPH5vpIwLoo/2PJTsp1U Gcil8Zhx+3no8iEQbSIF400fl3Lk7tmd9zlyNfcg4yCetNC+qIFXTTyVoILvjl/slXIf ygc+hUCy0bVTQe8TMGPZqANtO2MKtWevZkhvXVO3ONvpI0n7udhl86vrkVtq8hYXvvRA nNhIXv8ozP1aXenjS75mfmwOT7ZJvmQANjZFazxFaRFnqgnXxby5rKCwpn3pThzPNyNC GGgHQOtzogw3Pb13yAtb+2BF6YlaCIGvBFdy6JQSHWxssKhFvGjd7ezmkKcDqlgmG5LW ljBw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=LC9PjKbF; 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 gg19-20020a170906899300b0087be1055f85si12074551ejc.388.2023.02.06.02.13.43; Mon, 06 Feb 2023 02:14:05 -0800 (PST) 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=LC9PjKbF; 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 S230353AbjBFKK0 (ORCPT + 99 others); Mon, 6 Feb 2023 05:10:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230054AbjBFKJ2 (ORCPT ); Mon, 6 Feb 2023 05:09:28 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2067.outbound.protection.outlook.com [40.107.20.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F8C716AF8; Mon, 6 Feb 2023 02:09:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H77ff68r96oC7ivfWN8wosaul5ojAdeBHpbmTiKJMuiCge5U83f+u5qoqAvI51XPwMpfeSeNmkuZ3zqd+M+hFXWCDCEs/qf1rjKAv9xAGIFZHJXp0LhAfNJDre6ILP++hLNXIHBsEw6AZXjAyGPaJ7bNlbFLbh3hC3t7YgU0O+HTQ4M93rnTVrQQOshqBLY5+79OU2v2nEQ02iDz0I9wb6Ln042XJU619Pxe7mnigHwS6p8XVK/fHmVnm8pI4LaZ+kUSUQ0qBCEbX/1ySDHnrw5Bk94TogtbWDbNC2yhbiIJ3Fpw7ETcxLCyDYikv/UKOtaKAOGnLksFi0mbSvy3lQ== 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=Y1VObVU7XtxZAbGlqMoizJddwCxMLHnrb49AzScRiWs=; b=AinfPQh363cz7aIKZFa0fcSBsLHb/j1z4v+oZFaXwLMUPM1hjNVGDJtNEmrqrVX0/wAqtK0jvmst2iAKNrAf3opkA9dhBN2thDL7ANvoWzxjjixknGoFBoZxQqQ5ByxietYpgsu1bhkkM71GznZKXqSihqBheQ7OdNWq8xFw4byWEhghzclnkOYrG8EFA3dJMx3s079/OMk+0vZfAikI8YBfrlcMmABqHzHQhE+ilxroDqLWY9VL5iGgVLTIoF5RxiYoYxahn3qUwWesZsNBhPmbEsMasDnDGEvlWMWcVaHBw3uB7NIOTiyqq9wnpWsMucI034BehiQUWoTAZ/TSgA== 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=Y1VObVU7XtxZAbGlqMoizJddwCxMLHnrb49AzScRiWs=; b=LC9PjKbFKm3O/H2nA4BNHLAotlnfvBz8ajrhG2o3/g1iICw0OAoajyrjbcgIxrgFYMmykMcwImxXYzcSEzZzX5q7Cbp30/iVEtjJxwUH4RC/oKjU+oCF7f1c2Gi3vKRBjGL0I4UvZqk+t7Y4RF/CkaUZp0cgeG/SD38pb/SFr9A= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by AS8PR04MB7735.eurprd04.prod.outlook.com (2603:10a6:20b:2a5::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Mon, 6 Feb 2023 10:09:12 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%5]) with mapi id 15.20.6064.034; Mon, 6 Feb 2023 10:09:12 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Maciej Fijalkowski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 09/11] net: enetc: move setting of ENETC_TXBD_FLAGS_F flag to enetc_xdp_map_tx_buff() Date: Mon, 6 Feb 2023 12:08:35 +0200 Message-Id: <20230206100837.451300-10-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230206100837.451300-1-vladimir.oltean@nxp.com> References: <20230206100837.451300-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4PR10CA0019.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5d8::19) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AS8PR04MB7735:EE_ X-MS-Office365-Filtering-Correlation-Id: f9e4edd8-a7e7-48de-8cba-08db082a31c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z8ARWbwn25g6t0PiWmM8/2eqeYUrWBHDDhaSGlWbtHdiMQSF8RVqpbpwnziRXWs9YHOnFJC9YeqmVKBrUoF+5ChAc7Aitn+NKu3I2f5BQRnpQs5JmCYqsXCHO1bW/8h74e8RS76M8rhJrQ7mgCDTNkfAKnedAPAUOGXzh9m8pOwUpaKddYLkIRz7DUUId3wFDT66HogOmpvxJAD2gvIP9kTtgUoPwYjpM+PChebUV8FWRZV523dExFM3N0r1KeJpng1WGi0hmPX/NZEQg+oT6NA8m6LZ8lkXcN1Z46+4OVgveEoKbxURwyqeekhZ8JyLlNvBU6ReiTxb0w1yJGRafCKhP2PXOp2T97RwMgiNiN3Pqqvz9hYKRrOizqdeTS8q5V+QQahP8p8SasL79MTtpCY0/dk7i4dWxp3nw2ksWCLNufc/dRGM7qnNzX8ielB4SyKgqsuzZLtuMvLFmRoH5M0AEQw+o65DuO62y2a45AGeugB0PcsVXbdMVPv6aIV9gXofrZM8MbyZiIrkNFTNl7NbYvMgatDF4YtYTrauJG+XmhIPTi2QAeAk5Ubzz92l+vcoEy77gYrXHSzpniXJ3obosXNYjKJL19TRdxqKaXS621LNd8xwdqviJ4EQKQyphAYzs5upqXTKxj9MHqgso/DzWKda8LNASNLNbAi5kF1M0cbQWCi8D5NPeEXbXfLCmHOpO8jCVxkGNRGQ04x+vA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(366004)(376002)(346002)(396003)(39860400002)(451199018)(86362001)(36756003)(38100700002)(38350700002)(66946007)(66556008)(4326008)(6916009)(41300700001)(8936002)(8676002)(7416002)(5660300002)(54906003)(66476007)(2906002)(44832011)(2616005)(83380400001)(478600001)(6486002)(186003)(52116002)(6512007)(26005)(316002)(6506007)(6666004)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pxzn3+oYfllVWGtm9cynO9oj5nn/Acj1SlO67KIHwfYbrnUv8ALGXqmjczzco65l2P5LyFXjdtW6obbXgStsjUdIWv8ss7asaxuUDwqwAqL6Nc3KR90U8MLcVWlyFXpTsyIXFNqjsOGZxngKH5CLrns5zsviE93MIOH8tZ6cXPsusCxS2atpzcB0k41turKRMuTz29f9wLpqbbo/x5pAG97f7ddyMAqlEV7Jvf8pj8F8x4A8BMqL+kULol8CUvaUzjAUAooOaaLSGufgwWdXL16SzjopcOLur92wHV2ZRt+5eOiDZqMfp6JffcqCVFCXTtWZ7SUU7nZtRwXT+LiGJQSi8k3xpsQDb8Yc6zOAisj4vcy5xDw16LEbNmSxwbRVmeaLqPVOEhY0yJtBUh9STwsdKK7lFBEpK1cw3oxgzcDX11Y1PYbk4EHr5uSCM03pa53nSa/cswiV16z6uI1gxga8Du6OPs6pGkT0sZU5+m69WdxnPB3/bnN9YGW9ASHGe8+GO4N7nlgEX9ETySOUzjB6w69k6YMl3YMeKLaeIoRc2b1Zjhu7S064i0B38DVvofTFlUiR352K6LmDHThRr9BGpmZ6JrD2pR1WUSTWX65zMDi62NqweqQ/DOjX8yrD6TPTcCQSo5+mYKXwJwGm8Jm2v1psd913Z9pL/7kQXOPOx3sjGcL7Ga1hYdqrtV/JI2w2pqthQTKkYGtYA9oMWTF0vbjjpklgM14jAdil0ZvY4lb/NtMpnwqXxrZnmPntYnEJ4YQxtUrRRu6JLhDdk8GwCLZX3xpYXId4YPbE6Z63Dlt/2xoGsdn4YLZGkYUrvUvx18h3B/dzJ71aXDu0ra5xf9iQlLvj4QaryLhx1UvFbU9UlPHXK0q2PFP16z2oHNYj/UTc3R1yo0a21l4yfRm5wB/cI8wa5Z3SAySYk19ksreN4NkJ0i27D9XIuVh7hNEAmI+bgGtpFIZ6anBa/pk45e0Ykw8b5HXRwV69QzNoYFaFk77hTXBg4ieMv+DB4UuaiHI8fbklyuv/SOu1rHjsYc/JBM8sQ6yXel1fNLxR5mxyrNRNhTHS5lszzd/y5Viwxpji6aylFxx9kiHO3TdiiRxIlxgitYetfJpnwtRJ9NZoIJdQRMF3MfqpMLsSsAW6/u3bvZD7dw0fyyy+aOvfLu4LyFIGD35PPalf1s6vENnDOkiv7n0Mk3Uq9UdCC7Tv2ksLiV2YV0ueSSvjWaYYm6k/KSXgiC07Jm2kpZ7b/EgECq44F5wXlIQJ41W1udc6Eu6ZGPbflYt6up+7ENBuzHeRU5tF+jtwQpw6IRvCk3jmnQEyAJMBsZP6aX0sCKTgDhnjT+tGaTuNSIu6fVSqUGj26ajorZN7FT9Vf4QmDA5x+p1mOZxIY/UqKngrydUHAVVZh5N5y5NImpg0i90zMF18CjPbzmWrx1YeOhLd1i9E0/D12oH1FeOgNZ/kpavrkadXxJTwPsmhp03tV4lyhqqUsurvXGaHW2GPmShQdQVJI8aTWaFRoVAbg9ma5ZPbYLy65/yKtM5UgmHRMyuP/JXXcdLzpCJkGxgtQnAj9ZkL3L1jFFdJGp273Uf4xMnOtUU5LSeDLezrLxED/g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f9e4edd8-a7e7-48de-8cba-08db082a31c5 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2023 10:09:12.2235 (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: ze3xSJhzW5OWB7ni0eWP9IJwWAYADi2sWegZOUDfsJ6PB/lMLtbpq1huMty3E9vzEP4YUAToWWT7OmoJHMLXFg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7735 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757076201810728475?= X-GMAIL-MSGID: =?utf-8?q?1757076201810728475?= XSK transmission will reuse this procedure, and will also need the logic for setting the "final" bit of a TX BD, based on tx_swbd->is_eof. Not sure why this was left to be done by the caller of enetc_xdp_map_tx_buff(), but move it inside. Signed-off-by: Vladimir Oltean --- drivers/net/ethernet/freescale/enetc/enetc.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index e4552acf762c..dee432cacf85 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -1263,6 +1263,10 @@ static void enetc_xdp_map_tx_buff(struct enetc_bdr *tx_ring, int i, txbd->buf_len = cpu_to_le16(tx_swbd->len); txbd->frm_len = cpu_to_le16(frm_len); + /* last BD needs 'F' bit set */ + if (tx_swbd->is_eof) + txbd->flags = ENETC_TXBD_FLAGS_F; + memcpy(&tx_ring->tx_swbd[i], tx_swbd, sizeof(*tx_swbd)); } @@ -1286,17 +1290,7 @@ static bool enetc_xdp_tx(struct enetc_bdr *tx_ring, i = tx_ring->next_to_use; for (k = 0; k < num_tx_swbd; k++) { - struct enetc_tx_swbd *xdp_tx_swbd = &xdp_tx_arr[k]; - - enetc_xdp_map_tx_buff(tx_ring, i, xdp_tx_swbd, frm_len); - - /* last BD needs 'F' bit set */ - if (xdp_tx_swbd->is_eof) { - union enetc_tx_bd *txbd = ENETC_TXBD(*tx_ring, i); - - txbd->flags = ENETC_TXBD_FLAGS_F; - } - + enetc_xdp_map_tx_buff(tx_ring, i, &xdp_tx_arr[k], frm_len); enetc_bdr_idx_inc(tx_ring, &i); } From patchwork Mon Feb 6 10:08:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 53134 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2151973wrn; Mon, 6 Feb 2023 02:13:37 -0800 (PST) X-Google-Smtp-Source: AK7set80D1Oh+rWFrDzviZVEqObTFJngBJMpmu0iKcqylG/6IitZ/QXtv++7g59UD2gKOBlP+Q6S X-Received: by 2002:a17:907:9724:b0:88d:d76d:8527 with SMTP id jg36-20020a170907972400b0088dd76d8527mr25047202ejc.47.1675678416894; Mon, 06 Feb 2023 02:13:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675678416; cv=pass; d=google.com; s=arc-20160816; b=dDuQceI32bKbTxpf6If4LyKUXHPy/2R2r9Xg+yq1vQat+AuGAqYkKE+RStUWpJjN8k 20OCush9v7kGQXjc0nmwvSyKEGiMPUDMx5JobVNpUheaAyPn2QRLJCA64dPNx6sgHQsB WofrAThUqS0jrsK21Oa3PCSzuqSm2IxCj3FbaJFlXG+4Jfji3wPJaZaE3IGAQ0nIM8eI lP1Dwq6LnLQWkSFnaT+/6+peOZT8/e/pqkmHnIvXOFrh/+O+7rKW2zi/5R5rNDi1/dL4 5aN+oBmTn9Y6LxUnfB6bzrDi30UZm08gYVzmbK+4oKY4PxlMdRMoXuKbL3qYv3XlGpKs QUsw== 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=rvFRLxAHIsvmhIumtEp1stztHsxSWFojF8TsKxtM7KM=; b=QaHfoSlGfRWxnZOLyIR8RDGFmf1LrQW0anrFjekz74x6u6g2/qkQG8qc5w/37zSyx9 IxJUS7HsjVegm/Qh72SU3ZizaVJTeE8VKf6yhZv4Lvz5au46ZVRWt3nWcwJn0urLOXYw sVEAvaMY+AT9Kwmd0mhpHg0lEO7JyS8bffTfxuBjuGLvy56BdMelJvjjA7PPip/1kV4p Zrc4sNAIt1UPXUsI82t8YzZhmHCiERREK/509ZpBN0XdfwxW/gcfKNuZj/X8gtX7zFZP HK1anaR+nsqdRpQZwhV6oU8oU4mxcL6U0vwtStVhKqnCn3Vxts7RVzXLqIHCm2d5HdUD Gw5Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=SNMx0+Jv; 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 18-20020a170906209200b0088e24bc1556si18299172ejq.315.2023.02.06.02.13.14; Mon, 06 Feb 2023 02:13:36 -0800 (PST) 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=SNMx0+Jv; 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 S230246AbjBFKKX (ORCPT + 99 others); Mon, 6 Feb 2023 05:10:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230194AbjBFKJl (ORCPT ); Mon, 6 Feb 2023 05:09:41 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2067.outbound.protection.outlook.com [40.107.20.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9B9B1353F; Mon, 6 Feb 2023 02:09:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z/qsobdgXHllO2jV+UFNy9zgGmkzgKy1QMuBBAGlrv2qFTncI2gK8fSvY0/kHg5a4p83LG+bZod6+P+vWaoIlIED0Oz0V+OhCZg/8nfv57YG8vcRvu7ei2sZc41/cKNOBQK8GzcuuvyLUWrMLxy1hqBRldR1nyZriWATDyJBuPC+EiwE3LyWIjjbX7PrCu251FZcbxWnPz+XQnM+Ia8XuY7eYoKYNFvFLpj5TMQCb2/aa8BWD1MlW8QV/QXlQQslcSWR1dtm5GM4qfco2EW8gXq2+EK77ezY16OGuWZFh18ihFn7fuDj7thKuDWvmrpl7/O/vNVptBthRaHul21XZA== 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=rvFRLxAHIsvmhIumtEp1stztHsxSWFojF8TsKxtM7KM=; b=HH/DmL1iJSFDriMe2O87k3gjo95/YfQzPgAJhb6SYHBK5d7s0eOoeMK8+/F5uhOYy27D9/Hpg8ltUAGaiJHhsiLvh22ZhwYquPmXqSVq4j2YGZncXExLJHXbJ5lfbFLTt6pouHhmeXUoSLn/ThbYGYYYfTrNq6BNxZOTRY8LKw5FT23hE3/eVGAE4Y8iyPb9th0RVN/qZFFRq0GUKV0CJ9TBaavzBm5AU4/bR2lLSl0k5AoT6j8X9upuWt2OaW3KC+ASSGsQ4+tlvEPGidCPuo45EDN8jnsfd0NzjVCDFOEZvf7jUwyomUWoikhijGALZAg2PLsf4VKx0AbtB3Wnxg== 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=rvFRLxAHIsvmhIumtEp1stztHsxSWFojF8TsKxtM7KM=; b=SNMx0+Jvh7kD3ustQKQSAnghxhA//u1qtnBU4kI54NI0l6Roncuo3PcMq5aLczBTQno3E3gCpAOqTPOCuSmW4iz19WIiQjnCgwII7uQFui9yyn3QC9U4qWqRFj2okFAusq95bwEF6CfLj824TLYkLVwtJzXtG1sZbAjoi2GMLso= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by AS8PR04MB7735.eurprd04.prod.outlook.com (2603:10a6:20b:2a5::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Mon, 6 Feb 2023 10:09:15 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%5]) with mapi id 15.20.6064.034; Mon, 6 Feb 2023 10:09:14 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Maciej Fijalkowski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 10/11] net: enetc: add RX support for zero-copy XDP sockets Date: Mon, 6 Feb 2023 12:08:36 +0200 Message-Id: <20230206100837.451300-11-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230206100837.451300-1-vladimir.oltean@nxp.com> References: <20230206100837.451300-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4PR10CA0019.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5d8::19) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AS8PR04MB7735:EE_ X-MS-Office365-Filtering-Correlation-Id: 51017d7d-b089-4ef0-2ce3-08db082a32ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BM3rm04AJAvk470TVyWRKRhgOYC3FVfARZo40xwK8tk/jyXfACSKJyxIU+ICil2O9aqn2wW5zGtHE5BtrB2EO2/o3Zs8SsGwOjMj3OfLrkAK6RA0BM2067azT6TXVN4uxvnx0ISptNHQG/LqSswnUStg4XCwxi/jGqrPIu7qGX/rvs2hNmP0J7UxDt11HhMhFSgvwQX2CBrR0iZKFUXz4gwbs1cDpWRkpN5Ae8wVODak0N9XStMT99Y46eS59oYLC2HQkaeApQSzK+LK+vKS/kTMvznfuOK5dqt3bfdfxOKZD7GVry0dqS41INdaOTv0GTq1fe0BZUsHtf95YuZm+oMDKcLWXSmy2YlNRqCeA4mi8NEzqlnG/YwRQjVqF7Z2cHBlxsXMvTbZfZZV8Aa7SmLoygWtGWagYOH8uPQwAdRgsT9ZvWMjNbg9hxZxJi2ZwVvsx2jtcfXGLyQiAu09AgTvxYqHB6qP56TbXg/6HgKspOE0XUyfVhaJ1GG2bBGwb645PXkwsfWo5DR8Pd6oZApBV3pSp7Sn2OSsgbN01w4mHnq0PJhIr0QqRV25Ks3wsFz0PFzzB4yET+wCRAVFGhurBl4oszttGc07T3+dRc1r3Ln+46RP4cMVnPyHhqa50MjS4rI/s1HK1c6DSVR2xEJmjenMG6yOivcTvBr12JHtxzs6sJy1NBgeXGywi7hb2/lBlECUtmkyxpbuuzWBzbtMMTEU2yUBazlv44ZHKYg= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(366004)(376002)(346002)(396003)(39860400002)(451199018)(86362001)(36756003)(38100700002)(38350700002)(66946007)(66556008)(4326008)(6916009)(41300700001)(8936002)(8676002)(7416002)(5660300002)(54906003)(66476007)(2906002)(30864003)(44832011)(2616005)(83380400001)(478600001)(6486002)(186003)(52116002)(6512007)(26005)(316002)(6506007)(6666004)(1076003)(309714004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WeHwi5J0kk4U9eQOT3Ip8APKGNPCfBMKqcSmbQUBmiI+fzVecZ/7KA+1gS8AsyCJfyv47Rpk0rk6XwKz/20yUq0mF1Jx47WfqbM4Ab3PZRlhIf9f2x3TMAYR/Ozv6TRHm4glNqhiwovaOi2RfnCmo2rOmGGqGrILgQTOdEMheW/lP0zryX87K8K+OY0YvANP7EUulPSOjZkCHE7NdT2TtEirhjuFCS79moRrmLZINcWl3XvfbWOOQJ6RO/k87549XHNX/dJzdFvSQ/R1YnMLTTLuc4Ez2858f6Kgm+NRJsObjvw3QnpLz3F2G5sNC58/zt5Pk5YVAbrC9/aoNgI/A21HZXzwpSvCuoZPxsWS4WaLDeSzd1gQRKKCL/d1uNDSvZzTVjo+1JPMlImkwRFT7pSRqoKYGQA5WLd9LZnqwQqbm62EhofUz/ZFmwO33gI7sFzIIsptC3ziZ0sDciS03qkfBLe3LXOi7M81NH1GprQTN6iPv51hhT/LwHi/aOFSPaeqV5MgzJWY2nTFlceYrWT3K7Q2iJg+j2NhzIlZj+jNsCw9H3Huz7K+DR2mSumVZ1erFk5/ztLELqM6BbEwpTh1CNFNzkqu8+DZRUxZ23592LD9kQj5DzvKgKtoHBr7NjcSUVhZX7E5FKTnwkSQevVFj3jvEfc/hminEkp0LrxJs49J7hZvEaxLQaLnRS/TEjMWbpUWkqivhCIhrOF5t0DIr48HCpRHtoH41s6dLv0+c2cdj685MRhfzdT8HY9OHx31mIl03iSmg/RYAVmcogZQgZxAIxq+97ZH9ZSsNwYOOm/zvmtxGZtIs4Og5hlTAzecNsStDKDpXvQT6ayuIn4WGpHokayOxatDQ04f71gY9yWoYjtknU3im2rXqA7y5Bj0ARA4S9M9M8WEw771xh3WYS0lgmR35ZwLxzxmTPQi0mlB74Q8Dzhxywrb/28EYhv5WOdhMFm+LprufNxV8XY46C7VbnY/9HGYHkoIV5VH+A3VPTF4ij9fuG127bCmrOldpBKudIoUeRQzexXsUvdxv+3QVU+hYEY4feG0DHioWgXbk6g+WEOv+giu3+PYjdScuTWHl7wlPvZQpIgCPDZJ9aEh6z9ha1Uof8GDdFO8xQL0c0D3/25U7fQsTthgcvJKTaipmjV6W6pDcd0YqlVSET3EDHCKJ8KMxPbEaeeOw6y5LiBCv/oQWH7XVf/BBO3j5dgmFU05XUHNhc911KWtMhmkstQ24umx77W3hm5WzqxoEX6/y6WtxKMcdemcJXJPdAEFZejAjd81rA8SCq6F6hf3V0GctzMUfJzwbTkniPvh/v0pFnPXqMRj3yg66ln7W1YsLFMv82rJxN74XgxZaWtm4E3C6aV8PSpZM9JnbmkNaAhEyFsZYT4JnWN5Kq8Mm0y73GTKoziqLe5UOdzW9VyyPceIhnFSNuo79VR4uKyzhtXL75/cS4ONOWBxU1gSPMnxgNTCU5sKJUf0DJVEhGqAmdi2nUcD5trPHUCSp8PZXsG4DYtrwQdttFGxgoIrOV1ojeWTjy7rycTGTfw2vC8vxXPLT1rGkleT+QVNS4XC1ge+a5oWkrG3EfmQ7gYw0GFwRWDy7Y8e0GGf7Q== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 51017d7d-b089-4ef0-2ce3-08db082a32ce X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2023 10:09:13.9109 (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: jQ3wOGn7O/d870LdfO7rI/InnZUXucBAiduW9RGPnXoLZW+aFrks+KNjaCkKeIgimc7ULImOFOrRBtqXC6QmKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7735 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757076171411301716?= X-GMAIL-MSGID: =?utf-8?q?1757076171411301716?= Add support for filling an RX ring with buffers coming from an XSK umem. Although enetc has up to 8 RX rings, we still use one of the 2 per-CPU RX rings for XSK. To set up an XSK pool on one of the RX queues, we use the reconfiguration procedure which temporarily stops the rings. Since the RX procedure in the NAPI poll function is completely different (both the API for creating an xdp_buff, as well as refilling the ring with memory from user space), create a separate enetc_clean_rx_ring_xsk() function which gets called when we have both an XSK pool and an XDK program on this RX queue. Signed-off-by: Vladimir Oltean --- drivers/net/ethernet/freescale/enetc/enetc.c | 377 +++++++++++++++++- drivers/net/ethernet/freescale/enetc/enetc.h | 3 + .../net/ethernet/freescale/enetc/enetc_pf.c | 1 + 3 files changed, 373 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index dee432cacf85..3990c006c011 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -10,6 +10,7 @@ #include #include #include +#include u32 enetc_port_mac_rd(struct enetc_si *si, u32 reg) { @@ -103,6 +104,9 @@ static void enetc_free_rx_swbd(struct enetc_bdr *rx_ring, rx_swbd->dir); __free_page(rx_swbd->page); rx_swbd->page = NULL; + } else if (rx_swbd->xsk_buff) { + xsk_buff_free(rx_swbd->xsk_buff); + rx_swbd->xsk_buff = NULL; } } @@ -979,6 +983,44 @@ static int enetc_refill_rx_ring(struct enetc_bdr *rx_ring, const int buff_cnt) return j; } +static int enetc_refill_rx_ring_xsk(struct enetc_bdr *rx_ring, int buff_cnt) +{ + struct xsk_buff_pool *pool = rx_ring->xdp.xsk_pool; + struct enetc_rx_swbd *rx_swbd; + struct xdp_buff *xsk_buff; + union enetc_rx_bd *rxbd; + int i, j; + + i = rx_ring->next_to_use; + rxbd = enetc_rxbd(rx_ring, i); + + for (j = 0; j < buff_cnt; j++) { + xsk_buff = xsk_buff_alloc(pool); // TODO use _batch? + if (!xsk_buff) + break; + + rx_swbd = &rx_ring->rx_swbd[i]; + rx_swbd->xsk_buff = xsk_buff; + rx_swbd->dma = xsk_buff_xdp_get_dma(xsk_buff); + + /* update RxBD */ + rxbd->w.addr = cpu_to_le64(rx_swbd->dma); + /* clear 'R" as well */ + rxbd->r.lstatus = 0; + + enetc_rxbd_next(rx_ring, &rxbd, &i); + } + + if (likely(j)) { + rx_ring->next_to_use = i; + + /* update ENETC's consumer index */ + enetc_wr_reg_hot(rx_ring->rcir, rx_ring->next_to_use); + } + + return j; +} + #ifdef CONFIG_FSL_ENETC_PTP_CLOCK static void enetc_get_rx_tstamp(struct net_device *ndev, union enetc_rx_bd *rxbd, @@ -1128,6 +1170,18 @@ static void enetc_add_rx_buff_to_skb(struct enetc_bdr *rx_ring, int i, enetc_flip_rx_buff(rx_ring, rx_swbd); } +static void enetc_put_rx_swbd(struct enetc_bdr *rx_ring, int i) +{ + struct enetc_rx_swbd *rx_swbd = &rx_ring->rx_swbd[i]; + + if (rx_swbd->xsk_buff) { + xsk_buff_free(rx_swbd->xsk_buff); + rx_swbd->xsk_buff = NULL; + } else { + enetc_put_rx_buff(rx_ring, rx_swbd); + } +} + static bool enetc_check_bd_errors_and_consume(struct enetc_bdr *rx_ring, u32 bd_status, union enetc_rx_bd **rxbd, int *i, @@ -1136,7 +1190,7 @@ static bool enetc_check_bd_errors_and_consume(struct enetc_bdr *rx_ring, if (likely(!(bd_status & ENETC_RXBD_LSTATUS(ENETC_RXBD_ERR_MASK)))) return false; - enetc_put_rx_buff(rx_ring, &rx_ring->rx_swbd[*i]); + enetc_put_rx_swbd(rx_ring, *i); (*buffs_missing)++; enetc_rxbd_next(rx_ring, rxbd, i); @@ -1144,7 +1198,7 @@ static bool enetc_check_bd_errors_and_consume(struct enetc_bdr *rx_ring, dma_rmb(); bd_status = le32_to_cpu((*rxbd)->r.lstatus); - enetc_put_rx_buff(rx_ring, &rx_ring->rx_swbd[*i]); + enetc_put_rx_swbd(rx_ring, *i); (*buffs_missing)++; enetc_rxbd_next(rx_ring, rxbd, i); } @@ -1484,6 +1538,43 @@ static void enetc_build_xdp_buff(struct enetc_bdr *rx_ring, u32 bd_status, } } +static struct xdp_buff *enetc_build_xsk_buff(struct xsk_buff_pool *pool, + struct enetc_bdr *rx_ring, + u32 bd_status, + union enetc_rx_bd **rxbd, int *i, + int *buffs_missing, int *rx_byte_cnt) +{ + struct enetc_rx_swbd *rx_swbd = &rx_ring->rx_swbd[*i]; + u16 size = le16_to_cpu((*rxbd)->r.buf_len); + struct xdp_buff *xsk_buff; + + /* Multi-buffer frames are not supported in XSK mode */ + if (unlikely(!(bd_status & ENETC_RXBD_LSTATUS_F))) { + while (!(bd_status & ENETC_RXBD_LSTATUS_F)) { + enetc_put_rx_swbd(rx_ring, *i); + + (*buffs_missing)++; + enetc_rxbd_next(rx_ring, rxbd, i); + dma_rmb(); + bd_status = le32_to_cpu((*rxbd)->r.lstatus); + } + + return NULL; + } + + xsk_buff = rx_swbd->xsk_buff; + xsk_buff_set_size(xsk_buff, size); + xsk_buff_dma_sync_for_cpu(xsk_buff, pool); + + rx_swbd->xsk_buff = NULL; + + (*buffs_missing)++; + (*rx_byte_cnt) += size; + enetc_rxbd_next(rx_ring, rxbd, i); + + return xsk_buff; +} + /* Convert RX buffer descriptors to TX buffer descriptors. These will be * recycled back into the RX ring in enetc_clean_tx_ring. */ @@ -1659,11 +1750,136 @@ static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring, return rx_frm_cnt; } +static void enetc_xsk_buff_to_skb(struct xdp_buff *xsk_buff, + struct enetc_bdr *rx_ring, + union enetc_rx_bd *rxbd, + struct napi_struct *napi) +{ + size_t len = xdp_get_buff_len(xsk_buff); + struct sk_buff *skb; + + skb = napi_alloc_skb(napi, len); + if (unlikely(!skb)) { + rx_ring->stats.rx_alloc_errs++; + goto out; + } + + skb_put_data(skb, xsk_buff->data, len); + + enetc_get_offloads(rx_ring, rxbd, skb); + + skb_record_rx_queue(skb, rx_ring->index); + skb->protocol = eth_type_trans(skb, rx_ring->ndev); + + rx_ring->stats.packets += skb->len; + rx_ring->stats.bytes++; + + napi_gro_receive(napi, skb); +out: + xsk_buff_free(xsk_buff); +} + +static int enetc_clean_rx_ring_xsk(struct enetc_bdr *rx_ring, + struct napi_struct *napi, int work_limit, + struct bpf_prog *prog, + struct xsk_buff_pool *pool) +{ + struct net_device *ndev = rx_ring->ndev; + union enetc_rx_bd *rxbd, *orig_rxbd; + int rx_frm_cnt = 0, rx_byte_cnt = 0; + int xdp_redirect_frm_cnt = 0; + struct xdp_buff *xsk_buff; + int buffs_missing, err, i; + bool wakeup_xsk = false; + u32 bd_status, xdp_act; + + buffs_missing = enetc_bd_unused(rx_ring); + /* next descriptor to process */ + i = rx_ring->next_to_clean; + + while (likely(rx_frm_cnt < work_limit)) { + if (buffs_missing >= ENETC_RXBD_BUNDLE) { + buffs_missing -= enetc_refill_rx_ring_xsk(rx_ring, + buffs_missing); + wakeup_xsk |= (buffs_missing != 0); + } + + rxbd = enetc_rxbd(rx_ring, i); + bd_status = le32_to_cpu(rxbd->r.lstatus); + if (!bd_status) + break; + + enetc_wr_reg_hot(rx_ring->idr, BIT(rx_ring->index)); + dma_rmb(); /* for reading other rxbd fields */ + + if (enetc_check_bd_errors_and_consume(rx_ring, bd_status, + &rxbd, &i, + &buffs_missing)) + continue; + + orig_rxbd = rxbd; + + xsk_buff = enetc_build_xsk_buff(pool, rx_ring, bd_status, + &rxbd, &i, &buffs_missing, + &rx_byte_cnt); + if (!xsk_buff) + continue; + + xdp_act = bpf_prog_run_xdp(prog, xsk_buff); + switch (xdp_act) { + default: + bpf_warn_invalid_xdp_action(ndev, prog, xdp_act); + fallthrough; + case XDP_ABORTED: + trace_xdp_exception(ndev, prog, xdp_act); + fallthrough; + case XDP_DROP: + xsk_buff_free(xsk_buff); + break; + case XDP_PASS: + enetc_xsk_buff_to_skb(xsk_buff, rx_ring, orig_rxbd, + napi); + break; + case XDP_REDIRECT: + err = xdp_do_redirect(ndev, xsk_buff, prog); + if (unlikely(err)) { + if (err == -ENOBUFS) + wakeup_xsk = true; + xsk_buff_free(xsk_buff); + rx_ring->stats.xdp_redirect_failures++; + } else { + xdp_redirect_frm_cnt++; + rx_ring->stats.xdp_redirect++; + } + } + + rx_frm_cnt++; + } + + rx_ring->next_to_clean = i; + + rx_ring->stats.packets += rx_frm_cnt; + rx_ring->stats.bytes += rx_byte_cnt; + + if (xdp_redirect_frm_cnt) + xdp_do_flush_map(); + + if (xsk_uses_need_wakeup(pool)) { + if (wakeup_xsk) + xsk_set_rx_need_wakeup(pool); + else + xsk_clear_rx_need_wakeup(pool); + } + + return rx_frm_cnt; +} + static int enetc_poll(struct napi_struct *napi, int budget) { struct enetc_int_vector *v = container_of(napi, struct enetc_int_vector, napi); struct enetc_bdr *rx_ring = &v->rx_ring; + struct xsk_buff_pool *pool; struct bpf_prog *prog; bool complete = true; int work_done; @@ -1676,10 +1892,15 @@ static int enetc_poll(struct napi_struct *napi, int budget) complete = false; prog = rx_ring->xdp.prog; - if (prog) + pool = rx_ring->xdp.xsk_pool; + if (prog && pool) + work_done = enetc_clean_rx_ring_xsk(rx_ring, napi, budget, prog, + pool); + else if (prog) work_done = enetc_clean_rx_ring_xdp(rx_ring, napi, budget, prog); else work_done = enetc_clean_rx_ring(rx_ring, napi, budget); + if (work_done == budget) complete = false; if (work_done) @@ -2168,7 +2389,16 @@ static void enetc_setup_rxbdr(struct enetc_hw *hw, struct enetc_bdr *rx_ring, rx_ring->next_to_alloc = 0; enetc_lock_mdio(); - enetc_refill_rx_ring(rx_ring, enetc_bd_unused(rx_ring)); + /* The XSK buffer pool and the BPF program are set up through different + * syscalls. From the moment the pool has been DMA mapped and until the + * XDP program is attached, we still need to use normal RX buffers, + * because we still use the normal NAPI poll routine. Only use buffers + * from the XSK pool when both conditions are fulfilled. + */ + if (rx_ring->xdp.prog && rx_ring->xdp.xsk_pool) + enetc_refill_rx_ring_xsk(rx_ring, enetc_bd_unused(rx_ring)); + else + enetc_refill_rx_ring(rx_ring, enetc_bd_unused(rx_ring)); enetc_unlock_mdio(); enetc_rxbdr_wr(hw, idx, ENETC_RBMR, rbmr); @@ -2454,18 +2684,27 @@ static int enetc_xdp_rxq_mem_model_register(struct enetc_ndev_priv *priv, int rxq) { struct enetc_bdr *rx_ring = priv->rx_ring[rxq]; + struct xsk_buff_pool *pool; + enum xdp_mem_type type; int err; err = xdp_rxq_info_reg(&rx_ring->xdp.rxq, priv->ndev, rxq, 0); if (err) return err; - err = xdp_rxq_info_reg_mem_model(&rx_ring->xdp.rxq, - MEM_TYPE_PAGE_SHARED, NULL); - if (err) + pool = rx_ring->xdp.xsk_pool; + type = !!pool ? MEM_TYPE_XSK_BUFF_POOL : MEM_TYPE_PAGE_SHARED; + + err = xdp_rxq_info_reg_mem_model(&rx_ring->xdp.rxq, type, NULL); + if (err) { xdp_rxq_info_unreg(&rx_ring->xdp.rxq); + return err; + } - return err; + if (pool) + xsk_pool_set_rxq_info(pool, &rx_ring->xdp.rxq); + + return 0; } static void enetc_xdp_rxq_mem_model_unregister(struct enetc_ndev_priv *priv, @@ -2768,6 +3007,125 @@ static int enetc_reconfigure_xdp_cb(struct enetc_ndev_priv *priv, void *ctx) return err; } +struct enetc_xsk_reconfig_ctx { + struct enetc_bdr *rx_ring; + struct xsk_buff_pool *pool; +}; + +static int enetc_enable_xsk_cb(struct enetc_ndev_priv *priv, void *ctx) +{ + struct enetc_xsk_reconfig_ctx *data = ctx; + struct enetc_bdr *rx_ring = data->rx_ring; + struct xsk_buff_pool *pool = data->pool; + int err; + + err = xsk_pool_dma_map(pool, priv->dev, 0); + if (err) + return err; + + rx_ring->xdp.xsk_pool = pool; + + return 0; +} + +static int enetc_disable_xsk_cb(struct enetc_ndev_priv *priv, void *ctx) +{ + struct enetc_xsk_reconfig_ctx *data = ctx; + struct enetc_bdr *rx_ring = data->rx_ring; + struct xsk_buff_pool *pool = data->pool; + + rx_ring->xdp.xsk_pool = NULL; + xsk_pool_dma_unmap(pool, 0); + + return 0; +} + +static int enetc_enable_xsk_pool(struct net_device *ndev, + struct xsk_buff_pool *pool, u16 queue_id) +{ + struct enetc_ndev_priv *priv = netdev_priv(ndev); + struct enetc_xsk_reconfig_ctx ctx; + struct enetc_int_vector *v; + struct enetc_bdr *rx_ring; + bool extended; + + if (queue_id >= priv->bdr_int_num) { + netdev_err(ndev, "QID %d exceeds the %d channels available\n", + queue_id, priv->bdr_int_num); + return -ERANGE; + } + + v = priv->int_vector[queue_id]; + rx_ring = &v->rx_ring; + if (rx_ring->xdp.xsk_pool) { + netdev_err(ndev, "QID %d already has an XSK pool attached\n", + rx_ring->index); + return -EBUSY; + } + + /* Ensure enetc_setup_xdp_prog() won't be called before + * enetc_setup_xsk_pool(), because enetc_xdp_rxq_mem_model_register() + * depends on call ordering. + */ + if (rx_ring->xdp.prog) { + netdev_err(ndev, + "Cannot use XSK if there is an XDP program already attached\n"); + return -EINVAL; + } + + extended = !!(priv->active_offloads & ENETC_F_RX_TSTAMP); + ctx.rx_ring = rx_ring; + ctx.pool = pool; + + return enetc_reconfigure(priv, extended, enetc_enable_xsk_cb, &ctx); +} + +static int enetc_disable_xsk_pool(struct net_device *ndev, u16 queue_id) +{ + struct enetc_ndev_priv *priv = netdev_priv(ndev); + struct enetc_xsk_reconfig_ctx ctx; + struct enetc_int_vector *v; + struct xsk_buff_pool *pool; + struct enetc_bdr *rx_ring; + bool extended; + + if (queue_id >= priv->bdr_int_num) { + netdev_err(ndev, "QID %d exceeds the %d channels available\n", + queue_id, priv->bdr_int_num); + return -ERANGE; + } + + v = priv->int_vector[queue_id]; + rx_ring = &v->rx_ring; + + pool = rx_ring->xdp.xsk_pool; + if (!pool) { + netdev_err(ndev, "QID %d does not have an XSK pool attached\n", + rx_ring->index); + return -ENOENT; + } + + extended = !!(priv->active_offloads & ENETC_F_RX_TSTAMP); + ctx.rx_ring = rx_ring; + ctx.pool = pool; + + return enetc_reconfigure(priv, extended, enetc_disable_xsk_cb, &ctx); +} + +static int enetc_setup_xsk_pool(struct net_device *ndev, + struct xsk_buff_pool *pool, + u16 queue_id) +{ + return pool ? enetc_enable_xsk_pool(ndev, pool, queue_id) : + enetc_disable_xsk_pool(ndev, queue_id); +} + +int enetc_xsk_wakeup(struct net_device *ndev, u32 queue_id, u32 flags) +{ + /* xp_assign_dev() wants this; nothing needed for RX */ + return 0; +} + static int enetc_setup_xdp_prog(struct net_device *ndev, struct bpf_prog *prog, struct netlink_ext_ack *extack) { @@ -2798,6 +3156,9 @@ int enetc_setup_bpf(struct net_device *ndev, struct netdev_bpf *bpf) switch (bpf->command) { case XDP_SETUP_PROG: return enetc_setup_xdp_prog(ndev, bpf->prog, bpf->extack); + case XDP_SETUP_XSK_POOL: + return enetc_setup_xsk_pool(ndev, bpf->xsk.pool, + bpf->xsk.queue_id); default: return -EINVAL; } diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h index 704aa1f9dfa3..e1a746e37c9a 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.h +++ b/drivers/net/ethernet/freescale/enetc/enetc.h @@ -48,6 +48,7 @@ struct enetc_tx_swbd { (SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - XDP_PACKET_HEADROOM) struct enetc_rx_swbd { + struct xdp_buff *xsk_buff; struct page *page; dma_addr_t dma; enum dma_data_direction dir; @@ -77,6 +78,7 @@ struct enetc_ring_stats { struct enetc_xdp_data { struct xdp_rxq_info rxq; + struct xsk_buff_pool *xsk_pool; struct bpf_prog *prog; int xdp_tx_in_flight; }; @@ -424,6 +426,7 @@ int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data); int enetc_setup_bpf(struct net_device *ndev, struct netdev_bpf *bpf); int enetc_xdp_xmit(struct net_device *ndev, int num_frames, struct xdp_frame **frames, u32 flags); +int enetc_xsk_wakeup(struct net_device *dev, u32 queue, u32 flags); /* ethtool */ void enetc_set_ethtool_ops(struct net_device *ndev); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c index 7facc7d5261e..1a95d213683b 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -773,6 +773,7 @@ static const struct net_device_ops enetc_ndev_ops = { .ndo_setup_tc = enetc_pf_setup_tc, .ndo_bpf = enetc_setup_bpf, .ndo_xdp_xmit = enetc_xdp_xmit, + .ndo_xsk_wakeup = enetc_xsk_wakeup, }; static void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, From patchwork Mon Feb 6 10:08:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 53131 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2151557wrn; Mon, 6 Feb 2023 02:12:30 -0800 (PST) X-Google-Smtp-Source: AK7set+VaCU/pOVUzEwx1a5fQMiNSOkH84MSzFk99nkmczR1AGonU4xio2RyujmP5D/ODPaGDJ4p X-Received: by 2002:a17:906:eb99:b0:878:8249:bef6 with SMTP id mh25-20020a170906eb9900b008788249bef6mr18595888ejb.59.1675678350096; Mon, 06 Feb 2023 02:12:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675678350; cv=pass; d=google.com; s=arc-20160816; b=HlKN7fLul8yBQ+GnM/3B+kScwHAbc+fp0/Ar7ih4d1FxVlyJUxLJ8zOW6R9PLQ3WqE 7ugf6IPaFR0nQni6XuacSZbiw3eD3i9WhNGbo4RLoGmAN/AaeLorLyYDNeQlRWYZifAu 8L2PHPqlBhgLH5IALkyMwSY4UAySwpd8uTxiValSvgmoXIxKEPM4sriZ3TsmQgjDnWDC HnjQ94frLNo569RiESNwUauBLIEfWAgySeGD4BgsGjn3g0mpBnye4JGV50od0Ju6/fK/ 4QAl6aAVrzmkcOY1Wv67E2gz77KlkO9tUfnCzLba1xyDTXGpx7OeQYSLo3bxb9wB0zXq 2IFA== 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=iZRjZzSov683JeYNCQDpyIqDuzmh07GzJ9EMtycOdho=; b=k1BcjPKIChwEGAEv1pPaoKrSpt5zi34ZjoeYU1mvyVCgM5+UG+cqDB+SkfDn6HWlr9 b/XH3+48TmRPLyxtEoqAMspgFtF20af4Nqj4R2pcg28bl/uGjrmZZxahG8/Qb2Wq6W/x d5aiXbepN95Oojg1sLNbWSilFD2GntSuCNDUNNoiDwXHk+k4Kj1Gn5jO9vOVaH64DNqW 3kAiP/hqy5uTM9drI3AbrX18oTqS+aj1PCjbYZcl7dBJkJ0t+F/ACXJOYh9J/DltMW+w qREe1dLuAzc66njHJqpIm4Vc3TiWexaqG0A4xNBTYUwbNMoHkJrEZYfGWPRzh8YcdPxv hQ2w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=HyvgDWMQ; 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 zu21-20020a17090708d500b0088037f97209si11388866ejb.566.2023.02.06.02.12.07; Mon, 06 Feb 2023 02:12:30 -0800 (PST) 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=HyvgDWMQ; 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 S229959AbjBFKKJ (ORCPT + 99 others); Mon, 6 Feb 2023 05:10:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbjBFKJl (ORCPT ); Mon, 6 Feb 2023 05:09:41 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2067.outbound.protection.outlook.com [40.107.20.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5FDF13539; Mon, 6 Feb 2023 02:09:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nIBZy1z4pNqFQmxycnVyVFqnWmwSDzYSVniEZbN7j3P/HLNmRFDxDDVGLVmQvac5xheWt438Z8mz4gQyV3zqS1P5dnyqohQxzOcfWk69tyPxwN1GqW9hQkQZ/5zUG9tT7PlJTQvn5N1NrI+G/PqFqL19hedqq6PBbOkZaWyF+FoyhRmhmPf+zrEp1aE9D6+iU0wWzXGEJN62cmJJMZgB06HySiHUMcyyKKCaTK9FPiKu2shbD1NHcpvokZpsEUDkQTT8I0Nlsf1uNIKFfP2pjQ2XpW+jL5QUwR7bpJmDTtJ8RdYeENB6wfxLvykR4zhC6ZbaqCxV1sZWfesmPN0QwA== 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=iZRjZzSov683JeYNCQDpyIqDuzmh07GzJ9EMtycOdho=; b=DNJbZXnbUCGfhcUQXAsoBYqUBBcwiln76+nhZYMkOqJ2AyXTLG0rVha54ckv0MzgL1zm+tD6P6G2D0OiYz4OMWEQq0YYSKyBUtphRPzbwHRNsrj0fiqdCOHHHP+dpR0I4vACJg8kf3zvpaAd/wqk+xqNAFgdY3Gks6BBUltuosZSYID77sfR/hu9cgs1bH4GfkBpf+CrRf739pkizwQBGvUvisgGuJCJb+8lbBcUf0xSu7SV20sj7yOXWUYAiwRQUy5+jjdu78IulDHFqnR7F3301iwUP2kM9OFUEgpWmiaKd1W9hx6EYP5cE3Jbab2zqEeZBdUYrE0VD+7Z9XD6DA== 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=iZRjZzSov683JeYNCQDpyIqDuzmh07GzJ9EMtycOdho=; b=HyvgDWMQ07qGQBI3EiO1/iWJcdhH5iMXWN+QgXxmj5lhYH5pAWHcyp7WrKNvKmKetZVXSCBl1/ikhu6lyr7LN7KWZPB5YqPHwNhcbqhqtRypZS8VT+jm0qzE/TpiMpdkTITwg1MSuUtxB5ynN7Mr+xONukWf/1mSiAoAqs7e6vY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by AS8PR04MB7735.eurprd04.prod.outlook.com (2603:10a6:20b:2a5::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Mon, 6 Feb 2023 10:09:16 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%5]) with mapi id 15.20.6064.034; Mon, 6 Feb 2023 10:09:16 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Maciej Fijalkowski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 11/11] net: enetc: add TX support for zero-copy XDP sockets Date: Mon, 6 Feb 2023 12:08:37 +0200 Message-Id: <20230206100837.451300-12-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230206100837.451300-1-vladimir.oltean@nxp.com> References: <20230206100837.451300-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4PR10CA0019.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5d8::19) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AS8PR04MB7735:EE_ X-MS-Office365-Filtering-Correlation-Id: cfaedb37-f894-44f0-baab-08db082a33c3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ck36N+AbtTiYwYrjMn80LLaqqZAiwZoIAYcYyhcN9JMQLBIEc45WKLJO9isRou/F4//Mb4vgH98Y5CX4w74w0YGwVuwD7JdslDd2qkMTH5O8+MuFFBoZlS84pZEaNnBC/A1XxSixLvAp8h9SIuWng6SGPhR9r3c+lc4m73ugNUKiKzzA2fIJS3iAuf4E7NR4qyrhHf7H/rKch9g8zYPBsXLCxpxnFJX12OpSIZrp/QZL84wH0373vJrkJER7GH1hqhFQDoLEX6UUFG0eRM1KCev7KchFlMT+Pki31V8cvgrqEi/1hegh8at0ClhchCt4cLe9sujA7pZSgM9X5mUq362J30OUVTAep/S7LvDa5Rpu6drYwSWfEaobGo2kPUBRqAJ/F18A8T9+gw6UDyHPJ7f/tNo4ByLjCFurCHI/UvJ0W0hRZY7JsrOZ8LCm0kamXDaZHSKqufucCjagjQ9sbi6KkJvUQeWF4cXUjti9qhH5N/KWwqkKWb2lnG/LVzYXptMbi0OHyuBQx/Fkd8aFvLL6nag7oohIUyI2Yq3xd+5y6zr7M7SLbvB1AWdjxn3L0w6j0IXaVSw1BeKeTRevWV8dx0QfCWHdINvPgyOm7aQRCElX2LoPTkvGvbgGQBqqG3v5w5c96oLbbZKrHuAR+NSOCA4YotZF4F2H8rRWV7cvHLd3yuvdMx7MmfvMJlz8Iqbr2ywhcmcZ6c6j70dqEQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(366004)(376002)(346002)(396003)(39860400002)(451199018)(86362001)(36756003)(38100700002)(38350700002)(66946007)(66556008)(4326008)(6916009)(41300700001)(8936002)(8676002)(7416002)(5660300002)(54906003)(66476007)(2906002)(44832011)(2616005)(83380400001)(478600001)(6486002)(186003)(52116002)(6512007)(26005)(316002)(6506007)(6666004)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: h0lvIiW+XLk7srarxFeCds48D2OdPd5YYN9EACnOWtq912jI2lbQ9eT3yc6xusnZgpAIBKvwfbBmja1XCVLptnxKX0agpawShP3ax9zhHjEt7U3HeFW8f77f6JbK9/jB+iNnNxcUMB56Et9H2XWIfYG4NFRxe12T8GokYPANpehJeYUJ4cThdv9q0+4nIPWlCR/H7m+/rwAzwVnPns88t+xzKChNgeTaxASkEDU5D1yAHEk/1l3IJ1rabo0WDtJJPX3gLnDgQC7emky5oNydqqav+eEi85SwkFwbyAaBVVSPeh/eyNZ62B33zv82fzBDHyL1MQ3Nkiym+vx62n0Bvd9fr85UKkN7B+5d9tSv4/fZJQveK2wA9i4ELSAA3u39/Dls6HKrkX/Q4sT6zJmT/vVgi5h8wdwc0F0JeQWqBp6J+Gm5S40DY3tggRlXxfelJzvq9/WzLCxPZucNvoxwKUGJ9N0V2S/dNjO2aNHgvZlXU+dO5yfvhMmnM3zwC3DmGZWE5EOPVcgNLgk85dYcK21CIFApvDs6mZZNCOQcUU4iJ0rP/QkzLwagITYj+6szNYRmwiC2e8Ji0BE33KtBMNybsEPjQz1evon2LnFBNDN9XCZILHN61evS8m4L6X3mBhd/nPdfi5za9yw6kIgry/cV3r/pLuIrS5J0mGQG8gGDz+RPVqeS2JSPPzgVCPnIniWobqLmGbxV8jhd8gjjcQg+Kxy5rn5ME2PXfUwHOAPzcnH/WeFGWuf4CxCIO+4aIPTv5ObrF02cR6X+jdib6XEoZ75eo0cmytisMsWh+I3H4Hhd2ArHj4GBSSYdgmQrw1dq5eWcLwin4Agrbf6r/puYfc1OvPv9fITX7ThFbSVmgv6fiHk70Z0j4xEDWLZYvvSeP1bka3JQBvCKr4g0OW1hHBCyKP+9KIg1Dt3SgG+QN15rk49c5B3JHUif/oO3/zrMjhpoVIQRCWWcwthd/fx3HJEXfH0xC504DNBVHs2Va2aCktzD83bGW+0lN4xibdlSU90V3tMyGYHLTTQjGzh5995VULmwwnGxxMwc28Ot6bDezieKa/2QrIDkkjuMFPgd1y34ZiT4q8V45KY9J+1CoDz4CyXrKpuI10/vmT5zWfjjQ/vdNaTWy8TFhc6UhuvuKJNxFgwVhbJDOkxq+LM2xTBHxI1oHhGAjU2H5R+f9cUzgwHGV/yf97eMWTiJPx3ftXVDjtbIrRk+7Q/ONkb3UewWS5NOP0Ctrt1KpmfIljHnKH/i8IpSsaldJsi0sDUeKO7KmKo4SsBz0q3bzJdCET3hwQNfOtHX3Qw78nfqIH+Rb9PeaiG5EYyKjE8YjpvlgARXpndGCY8ihKpv5Qcr8AnXcYs0EF01FpErQiC2OO8a1SnkWx8tPKwZ1/nj6BCvU9+FtaFC2E7QhHzAt7mQOPLu2sFJ+LQhOG/Fngx3NsIo74a6oGXfvC/5n0vIDNSTSeJ9Ppqwi2oCMwGsZHIEZQfdDT5R6K00yVFUu5FgxunU9Q1rVwe7lmX+Uz0aJsYPMDtGKODEnZidZSAjxmXEOIy+vOLzZNkOjASHsbbeJRXp6+POeDjLpylW5PEloaTPUofqEKFoldE4u/5YQg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cfaedb37-f894-44f0-baab-08db082a33c3 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2023 10:09:15.5045 (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: tFZWl0ar8O4FagS4wxTDltUJ5qOLx6Ba4PEVs4LW9LyvEIlTprB/dlIS05hJQS1lB8P2RB+NvGDkJtN6uO02kQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7735 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757076101380275878?= X-GMAIL-MSGID: =?utf-8?q?1757076101380275878?= Schedule NAPI by hand from enetc_xsk_wakeup(), and send frames from the XSK TX queue from NAPI context. Add them to the completion queue from the enetc_clean_tx_ring() procedure which is common for all kinds of traffic. We reuse one of the TX rings for XDP (XDP_TX/XDP_REDIRECT) for XSK as well. They are already cropped from the TX rings that the network stack can use when XDP is enabled (with or without AF_XDP). As for XDP_REDIRECT calling enetc's ndo_xdp_xmit, I'm not sure if that can run simultaneously with enetc_poll() (on different CPUs, but towards the same TXQ). I guess it probably can, but idk what to do about it. The problem is that enetc_xdp_xmit() sends to priv->xdp_tx_ring[smp_processor_id()], while enetc_xsk_xmit() and XDP_TX send to priv->xdp_tx_ring[NAPI instance]. So when the NAPI instance runs on a different CPU that the one it is numerically equal to, we should have a lock that serializes XDP_REDIRECT with the others. Signed-off-by: Vladimir Oltean Signed-off-by: Vladimir Oltean --- drivers/net/ethernet/freescale/enetc/enetc.c | 102 ++++++++++++++++++- drivers/net/ethernet/freescale/enetc/enetc.h | 2 + 2 files changed, 99 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index 3990c006c011..bc0db788afc7 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -84,7 +84,7 @@ static void enetc_free_tx_swbd(struct enetc_bdr *tx_ring, struct xdp_frame *xdp_frame = enetc_tx_swbd_get_xdp_frame(tx_swbd); struct sk_buff *skb = enetc_tx_swbd_get_skb(tx_swbd); - if (tx_swbd->dma) + if (!tx_swbd->is_xsk && tx_swbd->dma) enetc_unmap_tx_buff(tx_ring, tx_swbd); if (xdp_frame) { @@ -817,7 +817,8 @@ static void enetc_recycle_xdp_tx_buff(struct enetc_bdr *tx_ring, rx_ring->xdp.xdp_tx_in_flight--; } -static bool enetc_clean_tx_ring(struct enetc_bdr *tx_ring, int napi_budget) +static bool enetc_clean_tx_ring(struct enetc_bdr *tx_ring, int napi_budget, + int *xsk_confirmed) { int tx_frm_cnt = 0, tx_byte_cnt = 0, tx_win_drop = 0; struct net_device *ndev = tx_ring->ndev; @@ -854,7 +855,9 @@ static bool enetc_clean_tx_ring(struct enetc_bdr *tx_ring, int napi_budget) tx_win_drop++; } - if (tx_swbd->is_xdp_tx) + if (tx_swbd->is_xsk) + (*xsk_confirmed)++; + else if (tx_swbd->is_xdp_tx) enetc_recycle_xdp_tx_buff(tx_ring, tx_swbd); else if (likely(tx_swbd->dma)) enetc_unmap_tx_buff(tx_ring, tx_swbd); @@ -1465,6 +1468,58 @@ int enetc_xdp_xmit(struct net_device *ndev, int num_frames, } EXPORT_SYMBOL_GPL(enetc_xdp_xmit); +static void enetc_xsk_map_tx_desc(struct enetc_tx_swbd *tx_swbd, + const struct xdp_desc *xsk_desc, + struct xsk_buff_pool *pool) +{ + dma_addr_t dma; + + dma = xsk_buff_raw_get_dma(pool, xsk_desc->addr); + xsk_buff_raw_dma_sync_for_device(pool, dma, xsk_desc->len); + + tx_swbd->dma = dma; + tx_swbd->len = xsk_desc->len; + tx_swbd->is_xsk = true; + tx_swbd->is_eof = true; +} + +static bool enetc_xsk_xmit(struct net_device *ndev, struct xsk_buff_pool *pool, + u32 queue_id) +{ + struct enetc_ndev_priv *priv = netdev_priv(ndev); + struct xdp_desc *xsk_descs = pool->tx_descs; + struct enetc_tx_swbd tx_swbd = {0}; + struct enetc_bdr *tx_ring; + u32 budget, batch; + int i, k; + + tx_ring = priv->xdp_tx_ring[queue_id]; + + /* Shouldn't race with anyone because we are running in the softirq + * of the only CPU that sends packets to this TX ring + */ + budget = min(enetc_bd_unused(tx_ring) - 1, ENETC_XSK_TX_BATCH); + + batch = xsk_tx_peek_release_desc_batch(pool, budget); + if (!batch) + return true; + + i = tx_ring->next_to_use; + + for (k = 0; k < batch; k++) { + enetc_xsk_map_tx_desc(&tx_swbd, &xsk_descs[k], pool); + enetc_xdp_map_tx_buff(tx_ring, i, &tx_swbd, tx_swbd.len); + enetc_bdr_idx_inc(tx_ring, &i); + } + + tx_ring->next_to_use = i; + + xsk_tx_release(pool); + enetc_update_tx_ring_tail(tx_ring); + + return budget != batch; +} + static void enetc_map_rx_buff_to_xdp(struct enetc_bdr *rx_ring, int i, struct xdp_buff *xdp_buff, u16 size) { @@ -1881,6 +1936,7 @@ static int enetc_poll(struct napi_struct *napi, int budget) struct enetc_bdr *rx_ring = &v->rx_ring; struct xsk_buff_pool *pool; struct bpf_prog *prog; + int xsk_confirmed = 0; bool complete = true; int work_done; int i; @@ -1888,7 +1944,8 @@ static int enetc_poll(struct napi_struct *napi, int budget) enetc_lock_mdio(); for (i = 0; i < v->count_tx_rings; i++) - if (!enetc_clean_tx_ring(&v->tx_ring[i], budget)) + if (!enetc_clean_tx_ring(&v->tx_ring[i], budget, + &xsk_confirmed)) complete = false; prog = rx_ring->xdp.prog; @@ -1901,6 +1958,17 @@ static int enetc_poll(struct napi_struct *napi, int budget) else work_done = enetc_clean_rx_ring(rx_ring, napi, budget); + if (pool) { + if (xsk_confirmed) + xsk_tx_completed(pool, xsk_confirmed); + + if (xsk_uses_need_wakeup(pool)) + xsk_set_tx_need_wakeup(pool); + + if (!enetc_xsk_xmit(rx_ring->ndev, pool, rx_ring->index)) + complete = false; + } + if (work_done == budget) complete = false; if (work_done) @@ -3122,7 +3190,31 @@ static int enetc_setup_xsk_pool(struct net_device *ndev, int enetc_xsk_wakeup(struct net_device *ndev, u32 queue_id, u32 flags) { - /* xp_assign_dev() wants this; nothing needed for RX */ + struct enetc_ndev_priv *priv = netdev_priv(ndev); + struct enetc_int_vector *v; + struct enetc_bdr *rx_ring; + + if (!netif_running(ndev) || !netif_carrier_ok(ndev)) + return -ENETDOWN; + + if (queue_id >= priv->bdr_int_num) + return -ERANGE; + + v = priv->int_vector[queue_id]; + rx_ring = &v->rx_ring; + + if (!rx_ring->xdp.xsk_pool || !rx_ring->xdp.prog) + return -EINVAL; + + /* No way to kick TX by triggering a hardirq right away => + * raise softirq. This might schedule NAPI on a CPU different than the + * smp_affinity of its IRQ would suggest, but that would happen anyway + * if, say, we change that affinity under heavy traffic. + * So enetc_poll() has to be prepared for it anyway. + */ + if (!napi_if_scheduled_mark_missed(&v->napi)) + napi_schedule(&v->napi); + return 0; } diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h index e1a746e37c9a..403f40473b52 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.h +++ b/drivers/net/ethernet/freescale/enetc/enetc.h @@ -36,6 +36,7 @@ struct enetc_tx_swbd { u8 is_eof:1; u8 is_xdp_tx:1; u8 is_xdp_redirect:1; + u8 is_xsk:1; u8 qbv_en:1; }; @@ -86,6 +87,7 @@ struct enetc_xdp_data { #define ENETC_RX_RING_DEFAULT_SIZE 2048 #define ENETC_TX_RING_DEFAULT_SIZE 2048 #define ENETC_DEFAULT_TX_WORK (ENETC_TX_RING_DEFAULT_SIZE / 2) +#define ENETC_XSK_TX_BATCH ENETC_DEFAULT_TX_WORK struct enetc_bdr_resource { /* Input arguments saved for teardown */