DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] fm10k: enable TSO support
@ 2015-09-25  8:09 Wang Xiao W
  2015-10-07 12:23 ` Thomas Monjalon
  2015-10-12  6:37 ` [dpdk-dev] [PATCH v2 0/2] " Wang Xiao W
  0 siblings, 2 replies; 7+ messages in thread
From: Wang Xiao W @ 2015-09-25  8:09 UTC (permalink / raw)
  To: dev

This patch enables fm10k TSO feature for both non-tunneling packet
and tunneling packet.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_osdep.h |  5 +++++
 drivers/net/fm10k/fm10k_ethdev.c     |  3 ++-
 drivers/net/fm10k/fm10k_rxtx.c       | 21 ++++++++++++++++++---
 3 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_osdep.h b/drivers/net/fm10k/base/fm10k_osdep.h
index 53c433c..a1bfa09 100644
--- a/drivers/net/fm10k/base/fm10k_osdep.h
+++ b/drivers/net/fm10k/base/fm10k_osdep.h
@@ -145,4 +145,9 @@ typedef int        bool;
 #define fm10k_read_reg FM10K_READ_REG
 #endif
 
+#define FM10K_TSO_MINMSS \
+	(FM10K_DMA_CTRL_MINMSS_64 >> FM10K_DMA_CTRL_MINMSS_SHIFT)
+#define FM10K_TSO_MIN_HEADERLEN			54
+#define FM10K_TSO_MAX_HEADERLEN			192
+
 #endif /* _FM10K_OSDEP_H_ */
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index a69c990..b104fc2 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -937,7 +937,8 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev,
 		DEV_TX_OFFLOAD_VLAN_INSERT |
 		DEV_TX_OFFLOAD_IPV4_CKSUM  |
 		DEV_TX_OFFLOAD_UDP_CKSUM   |
-		DEV_TX_OFFLOAD_TCP_CKSUM;
+		DEV_TX_OFFLOAD_TCP_CKSUM   |
+		DEV_TX_OFFLOAD_TCP_TSO;
 
 	dev_info->hash_key_size = FM10K_RSSRK_SIZE * sizeof(uint32_t);
 	dev_info->reta_size = FM10K_MAX_RSS_INDICES;
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index b5fa2e6..aed3e92 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -410,7 +410,7 @@ static inline void tx_free_descriptors(struct fm10k_tx_queue *q)
 static inline void tx_xmit_pkt(struct fm10k_tx_queue *q, struct rte_mbuf *mb)
 {
 	uint16_t last_id;
-	uint8_t flags;
+	uint8_t flags, hdrlen;
 
 	/* always set the LAST flag on the last descriptor used to
 	 * transmit the packet */
@@ -435,7 +435,7 @@ static inline void tx_xmit_pkt(struct fm10k_tx_queue *q, struct rte_mbuf *mb)
 	/* set checksum flags on first descriptor of packet. SCTP checksum
 	 * offload is not supported, but we do not explicitly check for this
 	 * case in favor of greatly simplified processing. */
-	if (mb->ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK))
+	if (mb->ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK | PKT_TX_TCP_SEG))
 		q->hw_ring[q->next_free].flags |= FM10K_TXD_FLAG_CSUM;
 
 	/* set vlan if requested */
@@ -447,6 +447,21 @@ static inline void tx_xmit_pkt(struct fm10k_tx_queue *q, struct rte_mbuf *mb)
 			rte_cpu_to_le_64(MBUF_DMA_ADDR(mb));
 	q->hw_ring[q->next_free].buflen =
 			rte_cpu_to_le_16(rte_pktmbuf_data_len(mb));
+
+	if (mb->ol_flags & PKT_TX_TCP_SEG) {
+		hdrlen = mb->outer_l2_len + mb->outer_l3_len + mb->l2_len +
+			mb->l3_len + mb->l4_len;
+		if (q->hw_ring[q->next_free].flags & FM10K_TXD_FLAG_FTAG)
+			hdrlen += sizeof(struct fm10k_ftag);
+
+		if ((hdrlen >= FM10K_TSO_MIN_HEADERLEN) &&
+				(hdrlen <= FM10K_TSO_MAX_HEADERLEN) &&
+				(mb->tso_segsz >= FM10K_TSO_MINMSS)) {
+			q->hw_ring[q->next_free].mss = mb->tso_segsz;
+			q->hw_ring[q->next_free].hdrlen = hdrlen;
+		}
+	}
+
 	if (++q->next_free == q->nb_desc)
 		q->next_free = 0;
 
@@ -462,7 +477,7 @@ static inline void tx_xmit_pkt(struct fm10k_tx_queue *q, struct rte_mbuf *mb)
 			q->next_free = 0;
 	}
 
-	q->hw_ring[last_id].flags = flags;
+	q->hw_ring[last_id].flags |= flags;
 }
 
 uint16_t
-- 
1.9.3

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

* Re: [dpdk-dev] [PATCH] fm10k: enable TSO support
  2015-09-25  8:09 [dpdk-dev] [PATCH] fm10k: enable TSO support Wang Xiao W
@ 2015-10-07 12:23 ` Thomas Monjalon
  2015-10-12  6:37 ` [dpdk-dev] [PATCH v2 0/2] " Wang Xiao W
  1 sibling, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2015-10-07 12:23 UTC (permalink / raw)
  To: Jing Chen; +Cc: dev

2015-09-25 16:09, Wang Xiao W:
> This patch enables fm10k TSO feature for both non-tunneling packet
> and tunneling packet.
> 
> Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>

Please Jing, a review is required.
First comment: the release notes is not updated accordingly.

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

* [dpdk-dev] [PATCH v2 0/2] fm10k: enable TSO support
  2015-09-25  8:09 [dpdk-dev] [PATCH] fm10k: enable TSO support Wang Xiao W
  2015-10-07 12:23 ` Thomas Monjalon
@ 2015-10-12  6:37 ` Wang Xiao W
  2015-10-12  6:37   ` [dpdk-dev] [PATCH v2 1/2] " Wang Xiao W
                     ` (2 more replies)
  1 sibling, 3 replies; 7+ messages in thread
From: Wang Xiao W @ 2015-10-12  6:37 UTC (permalink / raw)
  To: dev

v2:
* Updated release note for the new feature.

* Added "likely" in TSO parameters checking.

v1:
* Initial version for fm10k TSO feature.

Wang Xiao W (2):
  fm10k: enable TSO support
  doc: update release note for fm10k TSO support

 doc/guides/rel_notes/release_2_2.rst |  4 ++++
 drivers/net/fm10k/base/fm10k_osdep.h |  5 +++++
 drivers/net/fm10k/fm10k_ethdev.c     |  3 ++-
 drivers/net/fm10k/fm10k_rxtx.c       | 21 ++++++++++++++++++---
 4 files changed, 29 insertions(+), 4 deletions(-)

-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 1/2] fm10k: enable TSO support
  2015-10-12  6:37 ` [dpdk-dev] [PATCH v2 0/2] " Wang Xiao W
@ 2015-10-12  6:37   ` Wang Xiao W
  2015-10-13  8:35     ` Qiu, Michael
  2015-10-12  6:37   ` [dpdk-dev] [PATCH v2 2/2] doc: update release note for fm10k " Wang Xiao W
  2015-10-29 22:26   ` [dpdk-dev] [PATCH v2 0/2] fm10k: enable " Thomas Monjalon
  2 siblings, 1 reply; 7+ messages in thread
From: Wang Xiao W @ 2015-10-12  6:37 UTC (permalink / raw)
  To: dev

This patch enables fm10k TSO feature for both non-tunneling packet
and tunneling packet.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_osdep.h |  5 +++++
 drivers/net/fm10k/fm10k_ethdev.c     |  3 ++-
 drivers/net/fm10k/fm10k_rxtx.c       | 21 ++++++++++++++++++---
 3 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_osdep.h b/drivers/net/fm10k/base/fm10k_osdep.h
index 64f09dc..d8f3da4 100644
--- a/drivers/net/fm10k/base/fm10k_osdep.h
+++ b/drivers/net/fm10k/base/fm10k_osdep.h
@@ -146,4 +146,9 @@ typedef int        bool;
 #define fm10k_read_reg FM10K_READ_REG
 #endif
 
+#define FM10K_TSO_MINMSS \
+	(FM10K_DMA_CTRL_MINMSS_64 >> FM10K_DMA_CTRL_MINMSS_SHIFT)
+#define FM10K_TSO_MIN_HEADERLEN			54
+#define FM10K_TSO_MAX_HEADERLEN			192
+
 #endif /* _FM10K_OSDEP_H_ */
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index a69c990..b104fc2 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -937,7 +937,8 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev,
 		DEV_TX_OFFLOAD_VLAN_INSERT |
 		DEV_TX_OFFLOAD_IPV4_CKSUM  |
 		DEV_TX_OFFLOAD_UDP_CKSUM   |
-		DEV_TX_OFFLOAD_TCP_CKSUM;
+		DEV_TX_OFFLOAD_TCP_CKSUM   |
+		DEV_TX_OFFLOAD_TCP_TSO;
 
 	dev_info->hash_key_size = FM10K_RSSRK_SIZE * sizeof(uint32_t);
 	dev_info->reta_size = FM10K_MAX_RSS_INDICES;
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index d3f7b89..1bac28d 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -395,7 +395,7 @@ static inline void tx_free_descriptors(struct fm10k_tx_queue *q)
 static inline void tx_xmit_pkt(struct fm10k_tx_queue *q, struct rte_mbuf *mb)
 {
 	uint16_t last_id;
-	uint8_t flags;
+	uint8_t flags, hdrlen;
 
 	/* always set the LAST flag on the last descriptor used to
 	 * transmit the packet */
@@ -420,7 +420,7 @@ static inline void tx_xmit_pkt(struct fm10k_tx_queue *q, struct rte_mbuf *mb)
 	/* set checksum flags on first descriptor of packet. SCTP checksum
 	 * offload is not supported, but we do not explicitly check for this
 	 * case in favor of greatly simplified processing. */
-	if (mb->ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK))
+	if (mb->ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK | PKT_TX_TCP_SEG))
 		q->hw_ring[q->next_free].flags |= FM10K_TXD_FLAG_CSUM;
 
 	/* set vlan if requested */
@@ -432,6 +432,21 @@ static inline void tx_xmit_pkt(struct fm10k_tx_queue *q, struct rte_mbuf *mb)
 			rte_cpu_to_le_64(MBUF_DMA_ADDR(mb));
 	q->hw_ring[q->next_free].buflen =
 			rte_cpu_to_le_16(rte_pktmbuf_data_len(mb));
+
+	if (mb->ol_flags & PKT_TX_TCP_SEG) {
+		hdrlen = mb->outer_l2_len + mb->outer_l3_len + mb->l2_len +
+			mb->l3_len + mb->l4_len;
+		if (q->hw_ring[q->next_free].flags & FM10K_TXD_FLAG_FTAG)
+			hdrlen += sizeof(struct fm10k_ftag);
+
+		if (likely((hdrlen >= FM10K_TSO_MIN_HEADERLEN) &&
+				(hdrlen <= FM10K_TSO_MAX_HEADERLEN) &&
+				(mb->tso_segsz >= FM10K_TSO_MINMSS))) {
+			q->hw_ring[q->next_free].mss = mb->tso_segsz;
+			q->hw_ring[q->next_free].hdrlen = hdrlen;
+		}
+	}
+
 	if (++q->next_free == q->nb_desc)
 		q->next_free = 0;
 
@@ -447,7 +462,7 @@ static inline void tx_xmit_pkt(struct fm10k_tx_queue *q, struct rte_mbuf *mb)
 			q->next_free = 0;
 	}
 
-	q->hw_ring[last_id].flags = flags;
+	q->hw_ring[last_id].flags |= flags;
 }
 
 uint16_t
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 2/2] doc: update release note for fm10k TSO support
  2015-10-12  6:37 ` [dpdk-dev] [PATCH v2 0/2] " Wang Xiao W
  2015-10-12  6:37   ` [dpdk-dev] [PATCH v2 1/2] " Wang Xiao W
@ 2015-10-12  6:37   ` Wang Xiao W
  2015-10-29 22:26   ` [dpdk-dev] [PATCH v2 0/2] fm10k: enable " Thomas Monjalon
  2 siblings, 0 replies; 7+ messages in thread
From: Wang Xiao W @ 2015-10-12  6:37 UTC (permalink / raw)
  To: dev

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 doc/guides/rel_notes/release_2_2.rst | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst
index 5687676..ab01ebb 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -4,6 +4,10 @@ DPDK Release 2.2
 New Features
 ------------
 
+* **fm10k: Added TSO support.**
+
+  Added TSO support for both PF and VF.
+
 
 Resolved Issues
 ---------------
-- 
1.9.3

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

* Re: [dpdk-dev] [PATCH v2 1/2] fm10k: enable TSO support
  2015-10-12  6:37   ` [dpdk-dev] [PATCH v2 1/2] " Wang Xiao W
@ 2015-10-13  8:35     ` Qiu, Michael
  0 siblings, 0 replies; 7+ messages in thread
From: Qiu, Michael @ 2015-10-13  8:35 UTC (permalink / raw)
  To: Wang, Xiao W, dev

On 2015/10/12 14:38, Wang Xiao W wrote:
> This patch enables fm10k TSO feature for both non-tunneling packet
> and tunneling packet.
>
> Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
> ---

Acked-by: Michael Qiu <michael.qiu@intel.com>



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

* Re: [dpdk-dev] [PATCH v2 0/2] fm10k: enable TSO support
  2015-10-12  6:37 ` [dpdk-dev] [PATCH v2 0/2] " Wang Xiao W
  2015-10-12  6:37   ` [dpdk-dev] [PATCH v2 1/2] " Wang Xiao W
  2015-10-12  6:37   ` [dpdk-dev] [PATCH v2 2/2] doc: update release note for fm10k " Wang Xiao W
@ 2015-10-29 22:26   ` Thomas Monjalon
  2 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2015-10-29 22:26 UTC (permalink / raw)
  To: Wang Xiao W; +Cc: dev

2015-10-12 14:37, Wang Xiao W:
> v2:
> * Updated release note for the new feature.
> 
> * Added "likely" in TSO parameters checking.
> 
> v1:
> * Initial version for fm10k TSO feature.
> 
> Wang Xiao W (2):
>   fm10k: enable TSO support
>   doc: update release note for fm10k TSO support

Applied, thanks

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

end of thread, other threads:[~2015-10-29 22:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-25  8:09 [dpdk-dev] [PATCH] fm10k: enable TSO support Wang Xiao W
2015-10-07 12:23 ` Thomas Monjalon
2015-10-12  6:37 ` [dpdk-dev] [PATCH v2 0/2] " Wang Xiao W
2015-10-12  6:37   ` [dpdk-dev] [PATCH v2 1/2] " Wang Xiao W
2015-10-13  8:35     ` Qiu, Michael
2015-10-12  6:37   ` [dpdk-dev] [PATCH v2 2/2] doc: update release note for fm10k " Wang Xiao W
2015-10-29 22:26   ` [dpdk-dev] [PATCH v2 0/2] fm10k: enable " Thomas Monjalon

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