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 0A39843B45; Sat, 17 Feb 2024 02:54:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8906040282; Sat, 17 Feb 2024 02:54:36 +0100 (CET) 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 180EC400D7 for ; Sat, 17 Feb 2024 02:54:35 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GILT+Q7Uuxw0ouCTzCZPBiZ+EQNNmxhn3B+DeYd62UM3UlrGDa62p4CBWMcENCxsf+RBVZTkjioDykuH4PsMMHPJzeoP1MIRMWpmOHZpHnNs+qz1B5ppA6VI8tN4H1zRUuiDyRNJ//qvTRuG14pqnwAf2b1u6MyiBLPODs6mOKyrLmdp16i04Taa5lFOxbD/80EV+U/HOv2s9dcaV/UbLRn/lLwJ/Qj2WiyLSqeAmwKCtSDxBsZy1S2qmuu4vtXz++gD6ldBSoHFWbpaPUlAWyjahlGKEWXX1g6orwDpQ0TP4uq2DI/xThIc3G8zh7r2pJADODlHEZUjCQuvLPx3jQ== 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=CYc155w9sph+eAUHgZ1An+dCCkpe16piutO8hj7sVrU=; b=baJdb5WRl9OfW+VlGKt6bMZUgMVNrwsUTcBGSGXI7dyeWk3/k2wFpCeYK1ukAgBAt3SGwD+SK5qammbX4S6swRJsBMiQD7axIHVqNMwgPQyWVRbUf5/jfGPrUkhQzOTYirLy0Kg3UUYDMV8o4+BOl4BOTOoinM3xg3jVUCij6BwhnLoAw67BoanD+Nq5nh444ktdlXuOlJBdXjTUvSBqfvlIWEVW6e9BiI9RiLZm9PsRzsu2psBsIov7l9VEDGghWSpktkSA/eLp4KjDgrh8gPvC43hmgpzXzLLAWAfDjvhI0AppoowC3Ll2aAjb4dlAcEnHNKou0HtGTGTRtUwK9w== 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=CYc155w9sph+eAUHgZ1An+dCCkpe16piutO8hj7sVrU=; b=nSTygxLOe8m5TQuj0D2jePb9Fd6z3oqKDjq24kOT+XXxTU2z1v/cG6XDK3tBLazl14Eokr+jlql3d11vqv8QNmTJbsEj2suPQuCZlcKH3+0myhaaFsPcaqx19phCdTPJ4CLNJ4oev0uU91fgSrF/41gzWwvKvdVz7GgefLzrOJA= 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 MW5PR13MB5926.namprd13.prod.outlook.com (2603:10b6:303:1cf::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.29; Sat, 17 Feb 2024 01:54:32 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::8e02:f738:570a:f8aa]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::8e02:f738:570a:f8aa%7]) with mapi id 15.20.7292.029; Sat, 17 Feb 2024 01:54:31 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH] net/nfp: add support of UDP fragmentation offload Date: Sat, 17 Feb 2024 09:54:10 +0800 Message-Id: <20240217015410.2163102-1-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BY5PR17CA0010.namprd17.prod.outlook.com (2603:10b6:a03:1b8::23) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MW5PR13MB5926:EE_ X-MS-Office365-Filtering-Correlation-Id: be504e69-c985-44ab-0132-08dc2f5b621f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lPeEwFo/YQM43Xc/3JXoL2sF+DpTWOUs9nNk6JWKz34qBXSKAoBnRIRWjoCVnp6bILvmm9HpLhXl9kzN7A+WpvrKzJg54lz2IlxpO8Xmze55WlKzukG+Bj6NiluoDt4j3f2SCReZBiJqyHWSWod4oyLtNl8RJpv6YdYxyCMmLJUXyF/x8TWeiyJPDvBnsnpHN6vZ2/oGUOov9IRpPMXpNWzZI5rxHG2XrhWSm4UHCFNdO8hpu30gUelVXQYcSFzZ5aDbYzcGaOKylj6dGksexU/xb8kflTeRl8i4h4tGEI+GlvAI5R7MXahkThUuLb1xJxqVM0t0ZlYYwPWWPCKCc90U2dhplYtqKLloJ9UvHDqcItj3e4J28VROqQEo7HRjaaJlEi6TgKUEC5ffJoM5b40/BfNEc0uho3FRdbXUiMRjvXX00TEoXyWUPZuu86OlDNLvfmu7iLY+QhRcZLwckzEK4WwxOtE24QptYDWXreCVCKqT6yH+JamFeBc3020j5oBfVKzM/otkQSfRCnGH5dBYYbxJCPHF5QUuNgUpdjg62UO2YuQA8IozIsjxyw/e+CYiohh1ptAoIjxwoxsnyx0+P6STHcKCRI8AffVi5Wn7bj+drgG1VJr6j+6Edpbc X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(346002)(366004)(376002)(39830400003)(136003)(230922051799003)(186009)(1800799012)(64100799003)(451199024)(86362001)(38100700002)(41300700001)(36756003)(66946007)(316002)(2906002)(38350700005)(5660300002)(44832011)(83380400001)(8676002)(6666004)(6506007)(107886003)(52116002)(54906003)(66556008)(6916009)(8936002)(4326008)(66476007)(1076003)(6512007)(478600001)(6486002)(26005)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?6Pi5K6vcKvA7U+PmU79N1YH0Z84VaRrju7KyaqYgbJ7ekixP4Lt3PmxghDT4?= =?us-ascii?Q?gH77JJ3r23IcjrXMbz81Ou7Q6TKjyUidjlFI2UEgUTe+X8g9h+frZcwuaPgI?= =?us-ascii?Q?exQB31lp44o5114WL69fPFybihrv6lndDW5O1whIDVDxm5zp3QV9vcqUVkes?= =?us-ascii?Q?QKS511fyw5N+1sTH4bkKMn1N1k9gaCk7o95VXy7NkjuyBbL8ZJ7iiWH6R0Ir?= =?us-ascii?Q?+FDeUYMQdiA9xlBf8oNz0+n5pi0y9b+nLalJY8layepxffRdNK+VZBDIzU7E?= =?us-ascii?Q?2f0KsA4IdRtQ8PwKvnoVms1UhecdZzESM2o4bx64kVo+aAzVLf3u/LXL8VJF?= =?us-ascii?Q?VKq+bCTjU37tf3toTDXC5L6x7tm7rq9L2aRRCV+mJqqdOOE8dqxj/6qXOVuf?= =?us-ascii?Q?ZJ6wq3ApiGk6WRMXmiU0n819s1Vj4rQm/NIhyWnnI1yCfacW2mseLaM/HFyU?= =?us-ascii?Q?b+Ktir04qPiFMB7eQF8Xd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us-ascii?Q?NRSWaV0FgtUWGFEuePtXlw0v2dB5HPIaFDq7in/SNCjCxs2fAYZS0Jz4alQ2?= =?us-ascii?Q?Pylqz3ZmAOu5ZhG44hdUE+mSHGkQONL2rHrtcNaP4BlfpbvJcxqepZiuY+r5?= =?us-ascii?Q?IyeGUZGkcBObM1ZZZ4Pl8271p1in+wX1NKYQwXPNokacmc6jRY7S2dMAnfZQ?= =?us-ascii?Q?HelC3OrD6v0H95tWbMkAy3mgymmyjeSC7OpEPfg15qpDnsgFdagghe9enXm0?= =?us-ascii?Q?Hw=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: be504e69-c985-44ab-0132-08dc2f5b621f X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2024 01:54:31.7390 (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: uP7fHmPd24CF28LZhkkwuCr+7yqkkgyH4SeweABIDBrQ739D14O1Fn40ExoZCrt7RqeWk3JWBKB6lpnJNle2C/8r/yF+tKR0QFpgsHQdCvY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR13MB5926 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 Add the support of UDP fragmentation offload feature. Signed-off-by: Chaoyong He Reviewed-by: Long Wu Reviewed-by: Peng Zhang --- drivers/common/nfp/nfp_common_ctrl.h | 1 + drivers/net/nfp/nfd3/nfp_nfd3_dp.c | 7 ++++++- drivers/net/nfp/nfdk/nfp_nfdk_dp.c | 8 +++++--- drivers/net/nfp/nfp_net_common.c | 8 ++++++-- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/common/nfp/nfp_common_ctrl.h b/drivers/common/nfp/nfp_common_ctrl.h index d65fcd17cb..93722bc350 100644 --- a/drivers/common/nfp/nfp_common_ctrl.h +++ b/drivers/common/nfp/nfp_common_ctrl.h @@ -226,6 +226,7 @@ struct nfp_net_fw_ver { #define NFP_NET_CFG_CTRL_MULTI_PF (0x1 << 5) #define NFP_NET_CFG_CTRL_FLOW_STEER (0x1 << 8) /**< Flow Steering */ #define NFP_NET_CFG_CTRL_IN_ORDER (0x1 << 11) /**< Virtio in-order flag */ +#define NFP_NET_CFG_CTRL_USO (0x1 << 16) /**< UDP segmentation offload */ #define NFP_NET_CFG_CAP_WORD1 0x00a4 diff --git a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c index fbc2dbedf4..ee120f55ab 100644 --- a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c +++ b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c @@ -34,7 +34,8 @@ nfp_net_nfd3_tx_tso(struct nfp_net_txq *txq, goto clean_txd; ol_flags = mb->ol_flags; - if ((ol_flags & RTE_MBUF_F_TX_TCP_SEG) == 0) + if ((ol_flags & RTE_MBUF_F_TX_TCP_SEG) == 0 && + (ol_flags & RTE_MBUF_F_TX_UDP_SEG) == 0) goto clean_txd; txd->l3_offset = mb->l2_len; @@ -78,6 +79,10 @@ nfp_net_nfd3_tx_cksum(struct nfp_net_txq *txq, if ((ol_flags & RTE_MBUF_F_TX_TCP_SEG) != 0) txd->flags |= NFD3_DESC_TX_TCP_CSUM; + /* Set UDP csum offload if UFO enabled. */ + if ((ol_flags & RTE_MBUF_F_TX_UDP_SEG) != 0) + txd->flags |= NFD3_DESC_TX_UDP_CSUM; + /* IPv6 does not need checksum */ if ((ol_flags & RTE_MBUF_F_TX_IP_CKSUM) != 0) txd->flags |= NFD3_DESC_TX_IP4_CSUM; diff --git a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c index 72efbffb42..a1c6ecdfe5 100644 --- a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c +++ b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c @@ -28,8 +28,9 @@ nfp_net_nfdk_tx_cksum(struct nfp_net_txq *txq, ol_flags = mb->ol_flags; - /* Set TCP csum offload if TSO enabled. */ - if ((ol_flags & RTE_MBUF_F_TX_TCP_SEG) != 0) + /* 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) @@ -61,7 +62,8 @@ nfp_net_nfdk_tx_tso(struct nfp_net_txq *txq, return txd.raw; ol_flags = mb->ol_flags; - if ((ol_flags & RTE_MBUF_F_TX_TCP_SEG) == 0) + if ((ol_flags & RTE_MBUF_F_TX_TCP_SEG) == 0 && + (ol_flags & RTE_MBUF_F_TX_UDP_SEG) == 0) return txd.raw; txd.l3_offset = mb->l2_len; diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index 72c9a41b00..99c319eb2d 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -312,7 +312,7 @@ nfp_net_log_device_information(const struct nfp_net_hw *hw) hw->ver.major, hw->ver.minor, hw->max_mtu); PMD_INIT_LOG(INFO, "CAP: %#x", cap); - PMD_INIT_LOG(INFO, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", + PMD_INIT_LOG(INFO, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", cap & NFP_NET_CFG_CTRL_ENABLE ? "ENABLE " : "", cap & NFP_NET_CFG_CTRL_PROMISC ? "PROMISC " : "", cap & NFP_NET_CFG_CTRL_L2BC ? "L2BCFILT " : "", @@ -340,7 +340,8 @@ nfp_net_log_device_information(const struct nfp_net_hw *hw) cap & NFP_NET_CFG_CTRL_LSO2 ? "TSOv2 " : "", cap & NFP_NET_CFG_CTRL_RSS2 ? "RSSv2 " : "", cap & NFP_NET_CFG_CTRL_CSUM_COMPLETE ? "CSUM " : "", - cap & NFP_NET_CFG_CTRL_LIVE_ADDR ? "LIVE_ADDR " : ""); + cap & NFP_NET_CFG_CTRL_LIVE_ADDR ? "LIVE_ADDR " : "", + cap & NFP_NET_CFG_CTRL_USO ? "USO" : ""); PMD_INIT_LOG(INFO, "CAP_WORD1: %#x", cap_ext); PMD_INIT_LOG(INFO, "%s%s%s%s%s%s%s", @@ -537,6 +538,7 @@ nfp_check_offloads(struct rte_eth_dev *dev) /* LSO offload */ if ((tx_offload & RTE_ETH_TX_OFFLOAD_TCP_TSO) != 0 || + (tx_offload & RTE_ETH_TX_OFFLOAD_UDP_TSO) != 0 || (tx_offload & RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO) != 0) { if ((cap & NFP_NET_CFG_CTRL_LSO) != 0) ctrl |= NFP_NET_CFG_CTRL_LSO; @@ -1214,6 +1216,8 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) if ((cap & NFP_NET_CFG_CTRL_LSO_ANY) != 0) { dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_TCP_TSO; + if ((cap & NFP_NET_CFG_CTRL_USO) != 0) + dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_UDP_TSO; if ((cap & NFP_NET_CFG_CTRL_VXLAN) != 0) dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO; } -- 2.39.1