From patchwork Fri Mar 4 10:22:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12768916 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B5F8C433F5 for ; Fri, 4 Mar 2022 10:22:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233070AbiCDKXk (ORCPT ); Fri, 4 Mar 2022 05:23:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232710AbiCDKXd (ORCPT ); Fri, 4 Mar 2022 05:23:33 -0500 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2098.outbound.protection.outlook.com [40.107.244.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2431239B81 for ; Fri, 4 Mar 2022 02:22:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VHQAiSFJsfrj3FkWGTTFHp03uXL2yRLKS7qXaxztIW02ZuFXtuKy4j4TC5aNfEPKKO1D+vnkGQPZv+qswMJQLDypqiXKJ94egAUAxW0Pcmf9Pf61wWfBf2scDMufCN05olobIUydYt9M3ioffnaXPSX/cUIjiIeH3qnhbmdaPWLlXu405s63AXck0TQLITeQt08vvqn94LqHZQTNuIHsPPPoILnxe+1sEvlP2f4pgcA9mwXxV9Nc/G/gAfpYkU5U7LvS5xTYT4hwcG6cvvnuqdgoTlqHrimRpkVeUAvKb9qAPqcIwZOkW7hapAJIqWFefi4vY6CtU1R53D82JyGA2w== 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=WGbZGa+38okN9YpcGXw8iSP6EbXWVMZs9a1GrXA1f0Y=; b=TAwr+4J6pKPf2FDZI2CXhPN7GmSoTXGKl0qJ/sLV1BL46fhjVS88QiNu+4hGWzKL8wQZaZ0ZabdeVhi2YFz2v9Bpd3UlInIeQyIJZq2cZ3V0tKAWapYtl4p6BV4pGJoEU1WN0xsvADNh0MD8AuB7P/FsBiY+17jAAN0swZr96tfoX0DPf+LD/PS9596ByDZP9GTq6LOaCgr3C17DjmeubOSl03umZ5U4GFJGR/iUkQZm8/0zKm4SzfEyo3hTbySNRSNrUiwupt32EDDtsZ+sGfIct/6cVKDBTlcvLzzYOj+P0NHPitDU+51GYbHPcciUlTaAsSo8Bsswor8CLSKPbg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WGbZGa+38okN9YpcGXw8iSP6EbXWVMZs9a1GrXA1f0Y=; b=B5As7X6WrrsbPY/vF9la6E8W960orxJvkz1ZsgtpPj17aU/2WKiEM8nyEbtzTGzI3qAiyDkjVbhrhPcMJaYHYMUpa7ibc3v/Tq6jhcRFM/oWCP9rqIQ1SMKU1at2PW8T5wRm7reKI/TnhFHcI1mxmXwF3UK11el52AUK9+H/D9I= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by DM6PR13MB4539.namprd13.prod.outlook.com (2603:10b6:5:36::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.7; Fri, 4 Mar 2022 10:22:41 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::d27:c7d9:8880:a73e]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::d27:c7d9:8880:a73e%2]) with mapi id 15.20.5038.017; Fri, 4 Mar 2022 10:22:41 +0000 From: Simon Horman To: David Miller , Jakub Kicinski , =?utf-8?q?Niklas_S=C3=B6derlund?= Cc: netdev@vger.kernel.org, oss-drivers@corigine.com Subject: [PATCH net-next 1/5] nfp: expose common functions to be used for AF_XDP Date: Fri, 4 Mar 2022 11:22:10 +0100 Message-Id: <20220304102214.25903-2-simon.horman@corigine.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220304102214.25903-1-simon.horman@corigine.com> References: <20220304102214.25903-1-simon.horman@corigine.com> X-ClientProxiedBy: AM8P190CA0012.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:219::17) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8e984a34-910c-4419-7162-08d9fdc8ea28 X-MS-TrafficTypeDiagnostic: DM6PR13MB4539:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VLhcs9XnOTIoPU6Lduuf9CY3mobFY2u3TnwoJdR75GYVNo2r2qVMsJCZPQQLJleIUViO02FWOgHS8G5OgHnx8l0wVByzAg2c8/PTsGAU6eFxvV4kOm+ZMkloYbaDqJniYcyRhLnn27UPltz6fi9DEsFSBpeTpHDhUPx36b0++31nd237ElJAzHIjd28Y4flR+V+TZDLGBt3sxvB1X5WAD4Y6Ykx714ARTaD+Fj8Ji/afi7PeZEuvgtm5K3dvNyghV+FCi7uIU9wuuzyZy/5ufjBaO988AK0muZf5ZygvnTp2PjcfxHjOoxVffQXvDCg5/4iQGOWhgCVNY+oCJeKeQDis6V/xYZ/ohsbcPTUpaH7NWBvUntu8PueiivsKlJ37LMNd0xPkCnwyhoEM3wHyjLDTv7AEd6f6WyJ+g48Ja3DxbFQY0WUhQdybd4t3BrlhJzlioGrqEBkf+6xObEGPBq7IreT7AAg9NIXIpo7+hQLcpxAH/6xD8HbpjNjNiX0RQ4LB1rWEHouGg9R0Fejzytcj8VJXhPn7BsqEKRQ+cNMkJPDrm0l5O/vOvCVT/Pw0d+S+bJpQJtkOw2C+KVi9z8CXYZs0sAn2d3FBlDkPDUueOVB7+8nxNzjIhtC4H7fTkN+xianZBJFRyDQpEyZ2Rw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(396003)(346002)(136003)(376002)(366004)(39830400003)(6486002)(6636002)(8936002)(110136005)(5660300002)(316002)(508600001)(66946007)(66556008)(66476007)(8676002)(4326008)(6506007)(6666004)(52116002)(86362001)(38100700002)(6512007)(83380400001)(66574015)(36756003)(2616005)(2906002)(107886003)(1076003)(44832011)(186003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?gF1A/BWRm/6UbrmRtiQZzTyKLrWm?= =?utf-8?q?xK59CO7ifcUUWuQzTMqICngt0HVGEZD4e7hgj5GqMcV21I9JuOpmkwvKYT2TYii2W?= =?utf-8?q?ipRIKfmk1p4gK/C67z3Hnm7oO+URAu7dpGPTMbW/JLW2VYWG8pD790XTlsrG28rVt?= =?utf-8?q?RGqbJbGLxzAY7MEKsET4V2zuIScRepogxDSqyl8es/XPJXHwEK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iDscLgWn6T50G?= =?utf-8?q?JHaoLquMgO46yf4JUn2NME6rjCjLTtGHkNJK/5Zm/6OKRQWe2THmKcYDyHenz5PJ3?= =?utf-8?q?PsmGFspkhqLma6oDgMaN5l/bQQ4noRMZKZVMBQcKU2lTgVaoYnjG6LUnPli4u8D9R?= =?utf-8?q?BGKUponCMdQQRwVQl/xDN65N5AZG7aMG8N8ri953xIYY6y8NTqLsi4nbqhk9hhCym?= =?utf-8?q?znADIeIRGb1Qlm1JI1V+gJuOmSdq8iHvh4/OsLGpsrtlNpgtdn+x0QzsopYZvO55W?= =?utf-8?q?Bo/FMSGjugL/JWZLy9vtQqkHjJYzBNc/3qTW7h8XYnSVQk/As30Z0ZoW8hWrsSpAR?= =?utf-8?q?ZhY7JDzZ+N02dL2sCF3QPckyV9FisYozWq6h9CdDYXAOfaqCWVjdMWHtXQqFWUjgj?= =?utf-8?q?gk+aPnQ3kdrpsLrmTpRj17Y45+cBEtRKqsA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8e984a34-910c-4419-7162-08d9fdc8ea28 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Mar 2022 10:22:41.5640 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ceRmXc6oZ9ugVOb4AgJN/8GZDZFJmBDdtvdbHdQ6SOj6/OT1vkYk1ErxlGjGAV1AHpOrW27Mv2r3cX+SfJIiDAFFQ0sZUqZV4yovmtg2s6s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB4539 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Niklas Söderlund There are some common functionality that can be reused in the upcoming AF_XDP support. Expose those functions in the header. While at it mark some arguments of nfp_net_rx_csum() as const. Signed-off-by: Niklas Söderlund Signed-off-by: Simon Horman --- drivers/net/ethernet/netronome/nfp/nfp_net.h | 14 ++++++++++++++ .../net/ethernet/netronome/nfp/nfp_net_common.c | 16 ++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net.h b/drivers/net/ethernet/netronome/nfp/nfp_net.h index 0b1865e9f0b5..fa40d339df8d 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net.h +++ b/drivers/net/ethernet/netronome/nfp/nfp_net.h @@ -965,6 +965,7 @@ int nfp_net_mbox_reconfig_and_unlock(struct nfp_net *nn, u32 mbox_cmd); void nfp_net_mbox_reconfig_post(struct nfp_net *nn, u32 update); int nfp_net_mbox_reconfig_wait_posted(struct nfp_net *nn); +void nfp_net_irq_unmask(struct nfp_net *nn, unsigned int entry_nr); unsigned int nfp_net_irqs_alloc(struct pci_dev *pdev, struct msix_entry *irq_entries, unsigned int min_irqs, unsigned int want_irqs); @@ -973,6 +974,19 @@ void nfp_net_irqs_assign(struct nfp_net *nn, struct msix_entry *irq_entries, unsigned int n); +void nfp_net_tx_xmit_more_flush(struct nfp_net_tx_ring *tx_ring); +void nfp_net_tx_complete(struct nfp_net_tx_ring *tx_ring, int budget); + +bool +nfp_net_parse_meta(struct net_device *netdev, struct nfp_meta_parsed *meta, + void *data, void *pkt, unsigned int pkt_len, int meta_len); + +void nfp_net_rx_csum(const struct nfp_net_dp *dp, + struct nfp_net_r_vector *r_vec, + const struct nfp_net_rx_desc *rxd, + const struct nfp_meta_parsed *meta, + struct sk_buff *skb); + struct nfp_net_dp *nfp_net_clone_dp(struct nfp_net *nn); int nfp_net_ring_reconfig(struct nfp_net *nn, struct nfp_net_dp *new, struct netlink_ext_ack *extack); diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c index 79257ec41987..edf7b8716a70 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c @@ -381,7 +381,7 @@ int nfp_net_mbox_reconfig_and_unlock(struct nfp_net *nn, u32 mbox_cmd) * * Clear the ICR for the IRQ entry. */ -static void nfp_net_irq_unmask(struct nfp_net *nn, unsigned int entry_nr) +void nfp_net_irq_unmask(struct nfp_net *nn, unsigned int entry_nr) { nn_writeb(nn, NFP_NET_CFG_ICR(entry_nr), NFP_NET_CFG_ICR_UNMASKED); nn_pci_flush(nn); @@ -923,7 +923,7 @@ static void nfp_net_tls_tx_undo(struct sk_buff *skb, u64 tls_handle) #endif } -static void nfp_net_tx_xmit_more_flush(struct nfp_net_tx_ring *tx_ring) +void nfp_net_tx_xmit_more_flush(struct nfp_net_tx_ring *tx_ring) { wmb(); nfp_qcp_wr_ptr_add(tx_ring->qcp_q, tx_ring->wr_ptr_add); @@ -1142,7 +1142,7 @@ static netdev_tx_t nfp_net_tx(struct sk_buff *skb, struct net_device *netdev) * @tx_ring: TX ring structure * @budget: NAPI budget (only used as bool to determine if in NAPI context) */ -static void nfp_net_tx_complete(struct nfp_net_tx_ring *tx_ring, int budget) +void nfp_net_tx_complete(struct nfp_net_tx_ring *tx_ring, int budget) { struct nfp_net_r_vector *r_vec = tx_ring->r_vec; struct nfp_net_dp *dp = &r_vec->nfp_net->dp; @@ -1587,10 +1587,10 @@ static int nfp_net_rx_csum_has_errors(u16 flags) * @meta: Parsed metadata prepend * @skb: Pointer to SKB */ -static void nfp_net_rx_csum(struct nfp_net_dp *dp, - struct nfp_net_r_vector *r_vec, - struct nfp_net_rx_desc *rxd, - struct nfp_meta_parsed *meta, struct sk_buff *skb) +void nfp_net_rx_csum(const struct nfp_net_dp *dp, + struct nfp_net_r_vector *r_vec, + const struct nfp_net_rx_desc *rxd, + const struct nfp_meta_parsed *meta, struct sk_buff *skb) { skb_checksum_none_assert(skb); @@ -1668,7 +1668,7 @@ nfp_net_set_hash_desc(struct net_device *netdev, struct nfp_meta_parsed *meta, &rx_hash->hash); } -static bool +bool nfp_net_parse_meta(struct net_device *netdev, struct nfp_meta_parsed *meta, void *data, void *pkt, unsigned int pkt_len, int meta_len) {