DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Chaoyong He <chaoyong.he@corigine.com>,
	Long Wu <long.wu@corigine.com>,
	Peng Zhang <peng.zhang@corigine.com>
Subject: [PATCH] net/nfp: add support of UDP fragmentation offload
Date: Sat, 17 Feb 2024 09:54:10 +0800	[thread overview]
Message-ID: <20240217015410.2163102-1-chaoyong.he@corigine.com> (raw)

Add the support of UDP fragmentation offload feature.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 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


             reply	other threads:[~2024-02-17  1:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-17  1:54 Chaoyong He [this message]
2024-02-17 16:47 ` Stephen Hemminger
2024-02-17 18:02   ` Morten Brørup
2024-02-17 18:11     ` Stephen Hemminger
2024-02-18 10:05       ` Morten Brørup
2024-02-19 10:26         ` Bruce Richardson
2024-02-19 10:28           ` Ferruh Yigit
2024-02-19 13:30   ` Ferruh Yigit
2024-02-19 13:41 ` Ferruh Yigit
2024-02-20  7:54   ` Chaoyong He
2024-02-19 14:20 ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240217015410.2163102-1-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=long.wu@corigine.com \
    --cc=oss-drivers@corigine.com \
    --cc=peng.zhang@corigine.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).