From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 76FF7455D7; Tue, 9 Jul 2024 09:29:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2AF7742EB1; Tue, 9 Jul 2024 09:29:51 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2109.outbound.protection.outlook.com [40.107.94.109]) by mails.dpdk.org (Postfix) with ESMTP id F2F0F42EAD for ; Tue, 9 Jul 2024 09:29:47 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sK44u4XbTO8NCKkJKeQPDbOgT5OtRhjFkz0wW/pZXVAPNoRw+d3URNSaE1f1BaLG2I4osWQRbPG+2PgFfhB9kD6Hk+jChbcpGEXSPtx2Ek6H/Qi2diBHIL6BKw+B5CS7i6KmKQl5JHviKiK0YaxCO+RESnreTQpy46f8UkWu7qXr30PKGCYLJqlI//bYy4j6zDyndS5DgiaQWOcpw64xcVyu1P1QgvDfzJLHM10UF8UsQc/FKxcBabwwqeFQEjSSUVj9LEuv/Kw8zT+hxTSBrQtVZw6nSN0limGp8/c9+glxHmZRLQCiJEBcM6l/eyVXlaZAohXpA5a+WEB7HX/mdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=/YHnSUZEU46GqXL23kg1z70eGyV0lm5d0UZHOvyYa6k=; b=lHDMCDT4fNGgc+fIBt4bKwciURZCMUncqzwyhwTz2l+4oJFyM7ySoFoZ3hdFv7lUU75hJzr2OUt/v/ZdZ0C/ucS56wm091xDlv8DF1HEZuHP+tr3aBBETeFJImL+cbaieu6PTyNYMKTe0QaVNbTAo8zx3mh/wg/oB3Umjx63E+jYu+JXGOs1YzxKf64e/qvp35LQWNMqrrDG7GJWy0vblO9YLjd3S6fmRhwr5N2wkNJOFYk78ZJeRB3mbnY378WA/TLLVSaRA8dIMXcMVybZau+YUHSdWs6jc52LWVk6kbmlm4+TC2m9DVHbhvJ5oPeHxSxrS7X8qvVk6urHJ7axKg== 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=/YHnSUZEU46GqXL23kg1z70eGyV0lm5d0UZHOvyYa6k=; b=Zi6PqoJERgNLMiNN0PAJVSy3JnFD6fBujkCEp9mPC61YnREj+mwX7gv9ZpflIdYzdM+KHCDLTDuXkc2lsIpdTrpkFYYdbbyQsFZMPrM/vLj8GGAXIxxaFsh38PQM9rz+XqXA1T78R1qXPG/5k5/e+iPJf9KaTGRImC2hOHirziA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by SA1PR13MB4958.namprd13.prod.outlook.com (2603:10b6:806:189::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36; Tue, 9 Jul 2024 07:29:44 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833%4]) with mapi id 15.20.7741.033; Tue, 9 Jul 2024 07:29:44 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He Subject: [PATCH v3 1/4] net/nfp: export more interfaces of NFDk Date: Tue, 9 Jul 2024 15:29:18 +0800 Message-Id: <20240709072921.246520-2-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240709072921.246520-1-chaoyong.he@corigine.com> References: <20240708055854.107739-1-chaoyong.he@corigine.com> <20240709072921.246520-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR13CA0232.namprd13.prod.outlook.com (2603:10b6:a03:2c1::27) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SA1PR13MB4958:EE_ X-MS-Office365-Filtering-Correlation-Id: 867bb5b1-0bd0-4f3d-1206-08dc9fe8e774 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|52116014|366016|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ccKCsXb23VBBQ/1XCFWpEV3fVUTAvLYAtBslQ3i0JZU1cr8hgA3+ODC3hB2k?= =?us-ascii?Q?byvPBmVboS45sqifwwrfBUtMbmm0FZl3y5gCkW/EBpA3Q9GoyofFTMyKgmVH?= =?us-ascii?Q?0B5wbvIkniWCgjLgSpCMkArbxAC4VVvDwLVWGLR88HMNZWNVE4uFrJFp+/EJ?= =?us-ascii?Q?n8/Qmvodm2WxJhofjbrEj2vSo+BTq/a+i4K6uOdWyJsY2hkb1/EifgAYEGg5?= =?us-ascii?Q?UqGGmaipsCTu89/PnQTiMKdZryvaGH+Xv/DyrzFaKnS7ojGWf8oJO6ASzSLb?= =?us-ascii?Q?xZ2SyLr8pqFpxU1Vm3csblUDPlE5iHeXEK0sGB11MZZuwLux2HW9PztOJ9gg?= =?us-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C+v84F59n/qSs8vxIlGCjo1Q26gRvt?= =?us-ascii?Q?jTyIvW42hGPOld7sA6hxq4dbJVfveba3JK7S8WjybJrkheAVOJYTYYgOblAY?= =?us-ascii?Q?nfgYGAS6wfmzgvuihIv7vQxinENy8wfWQxKd0fnxZ4AkS7SyN7T9yzhUGAyV?= =?us-ascii?Q?c27WjXtlmucZ/JCmqDKmfZg4GWMhWsd0hULJUlsoBqz+sD8VIA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(52116014)(366016)(376014)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?2oVBRMhHsRlP71MnLPO2pn0sKyKMSXKhQSBGcMX0phb2ENTU2coTFs3VI6se?= =?us-ascii?Q?RKZVO2fd6IuGc3poytnN+74YHxlz9CQwGF67ZUgNsGNzh16ul2SlC+z4+V3L?= =?us-ascii?Q?cyFEGym7kx5bxdhATemc5pUvCzUhxNSopbaOq6vdb8ySgN3foBvZbiqlaMU8?= =?us-ascii?Q?q4MavoMbcLkO+nzW2irMKfEWiLa2Y+230wMw1hm61tuJ5hbr142WxJ5yPOs5?= =?us-ascii?Q?wQM7SbNuXsLmAcmMhFlNEQd0HX7dr9BcB/sjAyODdZYBblhrVoZMPcta2TTg?= =?us-ascii?Q?vtzmy2IsTc2hbCy3iwLuD5JUIyOjRPzIPVW2SbHmp9EU99C5sxyKXI6lt4p3?= =?us-ascii?Q?jVTG8e55XqfD/VpADOMANtAcLaCFQrL72F0dXQMrGLun/Y6vQQWg1Y2nsupr?= =?us-ascii?Q?AowCo9xrqcvXqrMBKSmKo6VXjSN6Rte+OiIK4O1DZqxotN00PH46eG3Ybrho?= =?us-ascii?Q?AzJzd+CO5tdl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?= =?us-ascii?Q?/zbRHGJr08HjT/akorS60zmRh5fRo3LhQfX83XHd832d4EeDG/FQ2yd+utEu?= =?us-ascii?Q?5E0cDW9IGQvhYXMvRbqaPWbLbH1dENCbuLaK/WOwxeECnLpGw7vNRer2E53q?= =?us-ascii?Q?dWsN6qTOrr0JIaEIc1lJIjrswZnkllkvQa1PmqFkguW82fGPt7JI3COChSy0?= =?us-ascii?Q?TDI1TuLp04z0ZybxTPUwgm5kd2Y449wyCy2e05jHvcdzeWFE0blO7YDV4no9?= =?us-ascii?Q?cg=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 867bb5b1-0bd0-4f3d-1206-08dc9fe8e774 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2024 07:29:44.7454 (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: hYJy2xI5lW7viGZYT/BCBN4cJRQWGQLXKGyIsAEbQYAanTvPTld3KmoXaNZNonG6e1An5tK8uu3cm9dAfsCr42LSTtru2B2DhOOs1vHuYB8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR13MB4958 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Long Wu NFP will support NFDk vector Tx function, so move some functions to header file for use by vector Tx function. Signed-off-by: Long Wu Reviewed-by: Chaoyong He --- drivers/net/nfp/nfdk/nfp_nfdk.h | 45 ++++++++++++++++++++++++++++++ drivers/net/nfp/nfdk/nfp_nfdk_dp.c | 43 +--------------------------- 2 files changed, 46 insertions(+), 42 deletions(-) diff --git a/drivers/net/nfp/nfdk/nfp_nfdk.h b/drivers/net/nfp/nfdk/nfp_nfdk.h index 2767fd51cd..89a98d13f3 100644 --- a/drivers/net/nfp/nfdk/nfp_nfdk.h +++ b/drivers/net/nfp/nfdk/nfp_nfdk.h @@ -6,7 +6,10 @@ #ifndef __NFP_NFDK_H__ #define __NFP_NFDK_H__ +#include + #include "../nfp_rxtx.h" +#include "nfp_net_common.h" #define NFDK_TX_DESC_PER_SIMPLE_PKT 2 @@ -161,6 +164,45 @@ nfp_net_nfdk_txq_full(struct nfp_net_txq *txq) return (nfp_net_nfdk_free_tx_desc(txq) < txq->tx_free_thresh); } +static inline uint16_t +nfp_net_nfdk_headlen_to_segs(uint16_t headlen) +{ + /* First descriptor fits less data, so adjust for that */ + return DIV_ROUND_UP(headlen + NFDK_TX_MAX_DATA_PER_DESC - NFDK_TX_MAX_DATA_PER_HEAD, + NFDK_TX_MAX_DATA_PER_DESC); +} + +/* Set TX CSUM offload flags in TX descriptor of nfdk */ +static inline uint64_t +nfp_net_nfdk_tx_cksum(struct nfp_net_txq *txq, + struct rte_mbuf *mb, + uint64_t flags) +{ + uint64_t ol_flags; + struct nfp_net_hw *hw = txq->hw; + + if ((hw->super.cap & NFP_NET_CFG_CTRL_TXCSUM) == 0) + return flags; + + ol_flags = mb->ol_flags; + + /* Set TCP csum offload if TSO enabled. */ + if ((ol_flags & RTE_MBUF_F_TX_TCP_SEG) != 0) + flags |= NFDK_DESC_TX_L4_CSUM; + + if ((ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) != 0) + flags |= NFDK_DESC_TX_ENCAP; + + /* IPv6 does not need checksum */ + if ((ol_flags & RTE_MBUF_F_TX_IP_CKSUM) != 0) + flags |= NFDK_DESC_TX_L3_CSUM; + + if ((ol_flags & RTE_MBUF_F_TX_L4_MASK) != 0) + flags |= NFDK_DESC_TX_L4_CSUM; + + return flags; +} + uint32_t nfp_flower_nfdk_pkt_add_metadata(struct rte_mbuf *mbuf, uint32_t port_id); uint16_t nfp_net_nfdk_xmit_pkts_common(void *tx_queue, @@ -177,5 +219,8 @@ int nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev, const struct rte_eth_txconf *tx_conf); int nfp_net_nfdk_tx_maybe_close_block(struct nfp_net_txq *txq, struct rte_mbuf *pkt); +int nfp_net_nfdk_set_meta_data(struct rte_mbuf *pkt, + struct nfp_net_txq *txq, + uint64_t *metadata); #endif /* __NFP_NFDK_H__ */ diff --git a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c index 8b8c191b82..173aabf0b9 100644 --- a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c +++ b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c @@ -6,7 +6,6 @@ #include "nfp_nfdk.h" #include -#include #include #include "../flower/nfp_flower.h" @@ -15,38 +14,6 @@ #define NFDK_TX_DESC_GATHER_MAX 17 -/* Set TX CSUM offload flags in TX descriptor of nfdk */ -static uint64_t -nfp_net_nfdk_tx_cksum(struct nfp_net_txq *txq, - struct rte_mbuf *mb, - uint64_t flags) -{ - uint64_t ol_flags; - struct nfp_net_hw *hw = txq->hw; - - if ((hw->super.ctrl & NFP_NET_CFG_CTRL_TXCSUM) == 0) - return flags; - - ol_flags = mb->ol_flags; - - /* Set L4 csum offload if TSO/UFO enabled. */ - if ((ol_flags & RTE_MBUF_F_TX_TCP_SEG) != 0 || - (ol_flags & RTE_MBUF_F_TX_UDP_SEG) != 0) - flags |= NFDK_DESC_TX_L4_CSUM; - - if ((ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) != 0) - flags |= NFDK_DESC_TX_ENCAP; - - /* IPv6 does not need checksum */ - if ((ol_flags & RTE_MBUF_F_TX_IP_CKSUM) != 0) - flags |= NFDK_DESC_TX_L3_CSUM; - - if ((ol_flags & RTE_MBUF_F_TX_L4_MASK) != 0) - flags |= NFDK_DESC_TX_L4_CSUM; - - return flags; -} - /* Set TX descriptor for TSO of nfdk */ static uint64_t nfp_net_nfdk_tx_tso(struct nfp_net_txq *txq, @@ -100,14 +67,6 @@ nfp_flower_nfdk_pkt_add_metadata(struct rte_mbuf *mbuf, return FLOWER_PKT_DATA_OFFSET; } -static inline uint16_t -nfp_net_nfdk_headlen_to_segs(uint16_t headlen) -{ - /* First descriptor fits less data, so adjust for that */ - return DIV_ROUND_UP(headlen + NFDK_TX_MAX_DATA_PER_DESC - NFDK_TX_MAX_DATA_PER_HEAD, - NFDK_TX_MAX_DATA_PER_DESC); -} - static inline void nfp_net_nfdk_tx_close_block(struct nfp_net_txq *txq, uint32_t nop_slots) @@ -170,7 +129,7 @@ nfp_net_nfdk_tx_maybe_close_block(struct nfp_net_txq *txq, return nop_slots; } -static int +int nfp_net_nfdk_set_meta_data(struct rte_mbuf *pkt, struct nfp_net_txq *txq, uint64_t *metadata) -- 2.39.1