diff mbox

[dpdk-dev,8/9] mbuf: add a timestamp field

Message ID 1488966121-22853-9-git-send-email-olivier.matz@6wind.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Olivier Matz March 8, 2017, 9:42 a.m. UTC
The field itself is not fully described yet, but this commit reserves
the room in the mbuf.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 lib/librte_mbuf/rte_mbuf.c |  2 ++
 lib/librte_mbuf/rte_mbuf.h | 12 ++++++++++++
 2 files changed, 14 insertions(+)

Comments

Ananyev, Konstantin April 4, 2017, 10:29 a.m. UTC | #1
Pretty much the same as one from Bruce:
http://dpdk.org/ml/archives/dev/2017-April/062936.html
but now for ixgbe.
Based on Olivier's mbuf rework patchset, and makes some
improvement to the ixgbe driver taking account of the rework.
It also removes a build-time option that seems unnecessary.

Depends on: http://dpdk.org/ml/archives/dev/2017-March/059693.html

Konstantin Ananyev (2):
  net/ixgbe: eliminate mbuf write on rearm
  net/ixgbe: remove option to disable offload flags

 config/common_base                        |  1 -
 doc/guides/nics/ixgbe.rst                 | 18 ----------
 drivers/net/ixgbe/ixgbe_rxtx_vec_common.h |  7 ----
 drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c   | 11 ------
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c    | 58 +++++++++++++------------------
 5 files changed, 24 insertions(+), 71 deletions(-)
Ferruh Yigit April 7, 2017, 3:13 p.m. UTC | #2
On 4/4/2017 11:29 AM, Konstantin Ananyev wrote:
> Pretty much the same as one from Bruce:
> http://dpdk.org/ml/archives/dev/2017-April/062936.html
> but now for ixgbe.
> Based on Olivier's mbuf rework patchset, and makes some
> improvement to the ixgbe driver taking account of the rework.
> It also removes a build-time option that seems unnecessary.
> 
> Depends on: http://dpdk.org/ml/archives/dev/2017-March/059693.html
> 
> Konstantin Ananyev (2):
>   net/ixgbe: eliminate mbuf write on rearm
>   net/ixgbe: remove option to disable offload flags
> 
>  config/common_base                        |  1 -
>  doc/guides/nics/ixgbe.rst                 | 18 ----------
>  drivers/net/ixgbe/ixgbe_rxtx_vec_common.h |  7 ----
>  drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c   | 11 ------
>  drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c    | 58 +++++++++++++------------------
>  5 files changed, 24 insertions(+), 71 deletions(-)

Series applied to dpdk-next-net/master, thanks.
Ferruh Yigit April 7, 2017, 3:44 p.m. UTC | #3
On 4/7/2017 4:13 PM, Ferruh Yigit wrote:
> On 4/4/2017 11:29 AM, Konstantin Ananyev wrote:
>> Pretty much the same as one from Bruce:
>> http://dpdk.org/ml/archives/dev/2017-April/062936.html
>> but now for ixgbe.
>> Based on Olivier's mbuf rework patchset, and makes some
>> improvement to the ixgbe driver taking account of the rework.
>> It also removes a build-time option that seems unnecessary.
>>
>> Depends on: http://dpdk.org/ml/archives/dev/2017-March/059693.html
>>
>> Konstantin Ananyev (2):
>>   net/ixgbe: eliminate mbuf write on rearm
>>   net/ixgbe: remove option to disable offload flags
>>
>>  config/common_base                        |  1 -
>>  doc/guides/nics/ixgbe.rst                 | 18 ----------
>>  drivers/net/ixgbe/ixgbe_rxtx_vec_common.h |  7 ----
>>  drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c   | 11 ------
>>  drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c    | 58 +++++++++++++------------------
>>  5 files changed, 24 insertions(+), 71 deletions(-)
> 
> Series applied to dpdk-next-net/master, thanks.

Hi Konstantin,

I talked a little early, getting following build error [1] with
"default" machine type. Patches dropped from tree for now.

[1]
...drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c:217:11: error: implicit
declaration of function '_mm_blend_epi16' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
        rearm0 = _mm_blend_epi16(mbuf_init, _mm_slli_si128(vtag1, 8), 0x10);
                 ^
...drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c:217:9: error: assigning to
'__m128i' (vector of 2 'long long' values) from incompatible type 'int'
        rearm0 = _mm_blend_epi16(mbuf_init, _mm_slli_si128(vtag1, 8), 0x10);
               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c:218:9: error: assigning to
'__m128i' (vector of 2 'long long' values) from incompatible type 'int'
        rearm1 = _mm_blend_epi16(mbuf_init, _mm_slli_si128(vtag1, 6), 0x10);
               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c:219:9: error: assigning to
'__m128i' (vector of 2 'long long' values) from incompatible type 'int'
        rearm2 = _mm_blend_epi16(mbuf_init, _mm_slli_si128(vtag1, 4), 0x10);
               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c:220:9: error: assigning to
'__m128i' (vector of 2 'long long' values) from incompatible type 'int'
        rearm3 = _mm_blend_epi16(mbuf_init, _mm_slli_si128(vtag1, 2), 0x10);
               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ananyev, Konstantin April 9, 2017, 10:56 p.m. UTC | #4
Hi Ferruh,

> 
> Hi Konstantin,
> 
> I talked a little early, getting following build error [1] with
> "default" machine type. Patches dropped from tree for now.

My bad, forgot to check with 'default'
Thanks for flagging that, will update and resend v2.
Konstantin 

> 
> [1]
> ...drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c:217:11: error: implicit
> declaration of function '_mm_blend_epi16' is invalid in C99
> [-Werror,-Wimplicit-function-declaration]
>         rearm0 = _mm_blend_epi16(mbuf_init, _mm_slli_si128(vtag1, 8), 0x10);
>                  ^
> ...drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c:217:9: error: assigning to
> '__m128i' (vector of 2 'long long' values) from incompatible type 'int'
>         rearm0 = _mm_blend_epi16(mbuf_init, _mm_slli_si128(vtag1, 8), 0x10);
>                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ...drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c:218:9: error: assigning to
> '__m128i' (vector of 2 'long long' values) from incompatible type 'int'
>         rearm1 = _mm_blend_epi16(mbuf_init, _mm_slli_si128(vtag1, 6), 0x10);
>                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ...drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c:219:9: error: assigning to
> '__m128i' (vector of 2 'long long' values) from incompatible type 'int'
>         rearm2 = _mm_blend_epi16(mbuf_init, _mm_slli_si128(vtag1, 4), 0x10);
>                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ...drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c:220:9: error: assigning to
> '__m128i' (vector of 2 'long long' values) from incompatible type 'int'
>         rearm3 = _mm_blend_epi16(mbuf_init, _mm_slli_si128(vtag1, 2), 0x10);
>                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
>
diff mbox

Patch

diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 0acc810..f679bce 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -322,6 +322,7 @@  const char *rte_get_rx_ol_flag_name(uint64_t mask)
 	case PKT_RX_IEEE1588_TMST: return "PKT_RX_IEEE1588_TMST";
 	case PKT_RX_QINQ_STRIPPED: return "PKT_RX_QINQ_STRIPPED";
 	case PKT_RX_LRO: return "PKT_RX_LRO";
+	case PKT_RX_TIMESTAMP: return "PKT_RX_TIMESTAMP";
 	default: return NULL;
 	}
 }
@@ -356,6 +357,7 @@  rte_get_rx_ol_flag_list(uint64_t mask, char *buf, size_t buflen)
 		{ PKT_RX_IEEE1588_TMST, PKT_RX_IEEE1588_TMST, NULL },
 		{ PKT_RX_QINQ_STRIPPED, PKT_RX_QINQ_STRIPPED, NULL },
 		{ PKT_RX_LRO, PKT_RX_LRO, NULL },
+		{ PKT_RX_TIMESTAMP, PKT_RX_TIMESTAMP, NULL },
 	};
 	const char *name;
 	unsigned int i;
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index c75a62a..fd97bd3 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -177,6 +177,11 @@  extern "C" {
  */
 #define PKT_RX_LRO           (1ULL << 16)
 
+/**
+ * Indicate that the timestamp field in the mbuf is valid.
+ */
+#define PKT_RX_TIMESTAMP     (1ULL << 17)
+
 /* add new RX flags here */
 
 /* add new TX flags here */
@@ -474,6 +479,12 @@  struct rte_mbuf {
 	uint16_t vlan_tci_outer;
 
 	uint16_t buf_len;         /**< Length of segment buffer. */
+
+	/** Valid if PKT_RX_TIMESTAMP is set. The unit and time reference
+	 * are not normalized but are always the same for a given port.
+	 */
+	uint64_t timestamp;
+
 	/* second cache line - fields only used in slow path or on TX */
 	MARKER cacheline1 __rte_cache_min_aligned;
 
@@ -1201,6 +1212,7 @@  static inline void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *m)
 	mi->nb_segs = 1;
 	mi->ol_flags = m->ol_flags | IND_ATTACHED_MBUF;
 	mi->packet_type = m->packet_type;
+	mi->timestamp = m->timestamp;
 
 	__rte_mbuf_sanity_check(mi, 1);
 	__rte_mbuf_sanity_check(m, 0);