DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/2] add VXLAN inner TSO with noudpcsum support for NFP cards
@ 2023-02-03  7:05 Chaoyong He
  2023-02-03  7:05 ` [PATCH 1/2] net/nfp: update macro definitions in Tx flag Chaoyong He
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chaoyong He @ 2023-02-03  7:05 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, Chaoyong He

This patch series mainly add the VXLAN inner TSO support with noudpcsum
for NFP cards, includes:
- Update related macrio definitions in Tx flag 
- Add the support for VXLAN inner TSO with noudpcsum

Fei Qin (2):
  net/nfp: update macro definitions in Tx flag
  net/nfp: add support for VXLAN inner TSO with noudpcsum

 drivers/net/nfp/nfp_common.c |  8 ++++++--
 drivers/net/nfp/nfp_ethdev.c |  6 ++++--
 drivers/net/nfp/nfp_rxtx.c   | 13 +++++++++++++
 drivers/net/nfp/nfp_rxtx.h   | 19 +++++++++++++++++--
 4 files changed, 40 insertions(+), 6 deletions(-)

-- 
2.29.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] net/nfp: update macro definitions in Tx flag
  2023-02-03  7:05 [PATCH 0/2] add VXLAN inner TSO with noudpcsum support for NFP cards Chaoyong He
@ 2023-02-03  7:05 ` Chaoyong He
  2023-02-03  7:05 ` [PATCH 2/2] net/nfp: add support for VXLAN inner TSO with noudpcsum Chaoyong He
  2023-02-14 15:23 ` [PATCH 0/2] add VXLAN inner TSO with noudpcsum support for NFP cards Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: Chaoyong He @ 2023-02-03  7:05 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, Fei Qin, Chaoyong He

From: Fei Qin <fei.qin@corigine.com>

In firmware, bit 0 and bit 1 in Tx descriptor flag are defined
as "PCIE_DESC_TX_ENCAP" and "PCIE_DESC_TX_O_IP4_CSUM". Meanwhile,
bit 0 is used to mark tunnel packets and bit 1 is used to set
outer ip cusm offload. Thus, update the macro definitions as
same as the ones in firmware.

Signed-off-by: Fei Qin <fei.qin@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
 drivers/net/nfp/nfp_rxtx.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index 8a29adbd73..f9223b8912 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -108,8 +108,8 @@ struct nfp_meta_parsed {
 #define PCIE_DESC_TX_VLAN               (1 << 3)
 #define PCIE_DESC_TX_LSO                (1 << 2)
 #define PCIE_DESC_TX_ENCAP_NONE         (0)
-#define PCIE_DESC_TX_ENCAP_VXLAN        (1 << 1)
-#define PCIE_DESC_TX_ENCAP_GRE          (1 << 0)
+#define PCIE_DESC_TX_ENCAP              (1 << 1)
+#define PCIE_DESC_TX_O_IP4_CSUM         (1 << 0)
 
 #define NFDK_TX_MAX_DATA_PER_HEAD       0x00001000
 #define NFDK_DESC_TX_DMA_LEN_HEAD       0x0fff
-- 
2.29.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] net/nfp: add support for VXLAN inner TSO with noudpcsum
  2023-02-03  7:05 [PATCH 0/2] add VXLAN inner TSO with noudpcsum support for NFP cards Chaoyong He
  2023-02-03  7:05 ` [PATCH 1/2] net/nfp: update macro definitions in Tx flag Chaoyong He
@ 2023-02-03  7:05 ` Chaoyong He
  2023-02-14 15:23 ` [PATCH 0/2] add VXLAN inner TSO with noudpcsum support for NFP cards Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: Chaoyong He @ 2023-02-03  7:05 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, Fei Qin, Chaoyong He

From: Fei Qin <fei.qin@corigine.com>

The device doesn't support outer udp csum offload. Add the support
for VXLAN inner TSO with noudpcsum.

Signed-off-by: Fei Qin <fei.qin@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
 drivers/net/nfp/nfp_common.c |  8 ++++++--
 drivers/net/nfp/nfp_ethdev.c |  6 ++++--
 drivers/net/nfp/nfp_rxtx.c   | 13 +++++++++++++
 drivers/net/nfp/nfp_rxtx.h   | 15 +++++++++++++++
 4 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 4f21d9978d..ddf5f131dd 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -440,7 +440,8 @@ nfp_check_offloads(struct rte_eth_dev *dev)
 		ctrl |= NFP_NET_CFG_CTRL_TXCSUM;
 
 	/* LSO offload */
-	if (txmode->offloads & RTE_ETH_TX_OFFLOAD_TCP_TSO) {
+	if (txmode->offloads & RTE_ETH_TX_OFFLOAD_TCP_TSO ||
+	    txmode->offloads & RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO) {
 		if (hw->cap & NFP_NET_CFG_CTRL_LSO)
 			ctrl |= NFP_NET_CFG_CTRL_LSO;
 		else
@@ -881,8 +882,11 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 					     RTE_ETH_TX_OFFLOAD_UDP_CKSUM |
 					     RTE_ETH_TX_OFFLOAD_TCP_CKSUM;
 
-	if (hw->cap & NFP_NET_CFG_CTRL_LSO_ANY)
+	if (hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) {
 		dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_TCP_TSO;
+		if (hw->cap & NFP_NET_CFG_CTRL_VXLAN)
+			dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO;
+	}
 
 	if (hw->cap & NFP_NET_CFG_CTRL_GATHER)
 		dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 31201c0197..a0d12600a3 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -146,8 +146,10 @@ nfp_net_start(struct rte_eth_dev *dev)
 	update |= NFP_NET_CFG_UPDATE_GEN | NFP_NET_CFG_UPDATE_RING;
 
 	/* Enable vxlan */
-	new_ctrl |= NFP_NET_CFG_CTRL_VXLAN;
-	update |= NFP_NET_CFG_UPDATE_VXLAN;
+	if (hw->cap & NFP_NET_CFG_CTRL_VXLAN) {
+		new_ctrl |= NFP_NET_CFG_CTRL_VXLAN;
+		update |= NFP_NET_CFG_UPDATE_VXLAN;
+	}
 
 	if (hw->cap & NFP_NET_CFG_CTRL_RINGCFG)
 		new_ctrl |= NFP_NET_CFG_CTRL_RINGCFG;
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 4a7574fd65..ca146d5cfe 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -1368,6 +1368,13 @@ nfp_net_nfdk_tx_cksum(struct nfp_net_txq *txq, struct rte_mbuf *mb,
 
 	ol_flags = mb->ol_flags;
 
+	/* Set TCP csum offload if TSO enabled. */
+	if (ol_flags & RTE_MBUF_F_TX_TCP_SEG)
+		flags |= NFDK_DESC_TX_L4_CSUM;
+
+	if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK)
+		flags |= NFDK_DESC_TX_ENCAP;
+
 	/* IPv6 does not need checksum */
 	if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM)
 		flags |= NFDK_DESC_TX_L3_CSUM;
@@ -1400,6 +1407,12 @@ nfp_net_nfdk_tx_tso(struct nfp_net_txq *txq, struct rte_mbuf *mb)
 	txd.lso_hdrlen = mb->l2_len + mb->l3_len + mb->l4_len;
 	txd.lso_totsegs = (mb->pkt_len + mb->tso_segsz) / mb->tso_segsz;
 
+	if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) {
+		txd.l3_offset += mb->outer_l2_len + mb->outer_l3_len;
+		txd.l4_offset += mb->outer_l2_len + mb->outer_l3_len;
+		txd.lso_hdrlen += mb->outer_l2_len + mb->outer_l3_len;
+	}
+
 	return txd.raw;
 
 clean_txd:
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index f9223b8912..c90bd13267 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -122,6 +122,7 @@ struct nfp_meta_parsed {
 #define NFDK_DESC_TX_TYPE_GATHER        1
 #define NFDK_DESC_TX_EOP                BIT(14)
 #define NFDK_DESC_TX_CHAIN_META         BIT(3)
+#define NFDK_DESC_TX_ENCAP              BIT(2)
 #define NFDK_DESC_TX_L4_CSUM            BIT(1)
 #define NFDK_DESC_TX_L3_CSUM            BIT(0)
 
@@ -468,6 +469,13 @@ nfp_net_nfd3_tx_tso(struct nfp_net_txq *txq,
 	txd->l3_offset = mb->l2_len;
 	txd->l4_offset = mb->l2_len + mb->l3_len;
 	txd->lso_hdrlen = mb->l2_len + mb->l3_len + mb->l4_len;
+
+	if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) {
+		txd->l3_offset += mb->outer_l2_len + mb->outer_l3_len;
+		txd->l4_offset += mb->outer_l2_len + mb->outer_l3_len;
+		txd->lso_hdrlen += mb->outer_l2_len + mb->outer_l3_len;
+	}
+
 	txd->mss = rte_cpu_to_le_16(mb->tso_segsz);
 	txd->flags = PCIE_DESC_TX_LSO;
 	return;
@@ -493,10 +501,17 @@ nfp_net_nfd3_tx_cksum(struct nfp_net_txq *txq, struct nfp_net_nfd3_tx_desc *txd,
 
 	ol_flags = mb->ol_flags;
 
+	/* Set TCP csum offload if TSO enabled. */
+	if (ol_flags & RTE_MBUF_F_TX_TCP_SEG)
+		txd->flags |= PCIE_DESC_TX_TCP_CSUM;
+
 	/* IPv6 does not need checksum */
 	if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM)
 		txd->flags |= PCIE_DESC_TX_IP4_CSUM;
 
+	if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK)
+		txd->flags |= PCIE_DESC_TX_ENCAP;
+
 	switch (ol_flags & RTE_MBUF_F_TX_L4_MASK) {
 	case RTE_MBUF_F_TX_UDP_CKSUM:
 		txd->flags |= PCIE_DESC_TX_UDP_CSUM;
-- 
2.29.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] add VXLAN inner TSO with noudpcsum support for NFP cards
  2023-02-03  7:05 [PATCH 0/2] add VXLAN inner TSO with noudpcsum support for NFP cards Chaoyong He
  2023-02-03  7:05 ` [PATCH 1/2] net/nfp: update macro definitions in Tx flag Chaoyong He
  2023-02-03  7:05 ` [PATCH 2/2] net/nfp: add support for VXLAN inner TSO with noudpcsum Chaoyong He
@ 2023-02-14 15:23 ` Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2023-02-14 15:23 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers, niklas.soderlund

On 2/3/2023 7:05 AM, Chaoyong He wrote:
> This patch series mainly add the VXLAN inner TSO support with noudpcsum
> for NFP cards, includes:
> - Update related macrio definitions in Tx flag 
> - Add the support for VXLAN inner TSO with noudpcsum
> 
> Fei Qin (2):
>   net/nfp: update macro definitions in Tx flag
>   net/nfp: add support for VXLAN inner TSO with noudpcsum

Series applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-14 15:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-03  7:05 [PATCH 0/2] add VXLAN inner TSO with noudpcsum support for NFP cards Chaoyong He
2023-02-03  7:05 ` [PATCH 1/2] net/nfp: update macro definitions in Tx flag Chaoyong He
2023-02-03  7:05 ` [PATCH 2/2] net/nfp: add support for VXLAN inner TSO with noudpcsum Chaoyong He
2023-02-14 15:23 ` [PATCH 0/2] add VXLAN inner TSO with noudpcsum support for NFP cards Ferruh Yigit

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).