DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] eventdev: update rx timestamp in mbuf using mbuf dynamic field
@ 2021-09-14  7:14 Ganapati Kundapura
  2021-09-16  4:50 ` Jerin Jacob
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Ganapati Kundapura @ 2021-09-14  7:14 UTC (permalink / raw)
  To: jay.jayatheerthan, jerinjacobk; +Cc: dev

Add support to register timestamp dynamic field in mbuf.

Update the timestamp in mbuf for each packet before enqueuing
to event device if the timestamp is not already set.

Adding the timestamp in Rx adapter avoids additional latency
due to the event device.

Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
---
 lib/eventdev/rte_event_eth_rx_adapter.c | 35 +++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index de8ab05..9cb2550 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -17,6 +17,7 @@
 #include <rte_service_component.h>
 #include <rte_thash.h>
 #include <rte_interrupts.h>
+#include <rte_mbuf_dyn.h>
 
 #include "rte_eventdev.h"
 #include "eventdev_pmd.h"
@@ -240,6 +241,17 @@ struct eth_rx_queue_info {
 
 static struct rte_event_eth_rx_adapter **event_eth_rx_adapter;
 
+/* Enable dynamic timestamp field in mbuf */
+uint64_t event_eth_rx_timestamp_dynflag;
+int event_eth_rx_timestamp_dynfield_offset = -1;
+
+static inline rte_mbuf_timestamp_t *
+rte_event_eth_rx_timestamp_dynfield(struct rte_mbuf *mbuf)
+{
+	return RTE_MBUF_DYNFIELD(mbuf,
+		event_eth_rx_timestamp_dynfield_offset, rte_mbuf_timestamp_t *);
+}
+
 static inline int
 rxa_validate_id(uint8_t id)
 {
@@ -890,8 +902,18 @@ rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
 	int do_rss;
 	uint16_t nb_cb;
 	uint16_t dropped;
+	uint64_t ts, ts_mask;
 
 	if (!eth_rx_queue_info->ena_vector) {
+		ts = m->ol_flags & event_eth_rx_timestamp_dynflag ?
+						0 : rte_get_tsc_cycles();
+
+		/* 0xffff ffff ffff ffff if PKT_RX_TIMESTAMP is set,
+		 * otherwise 0
+		 */
+		ts_mask = (uint64_t)(!(m->ol_flags &
+				       event_eth_rx_timestamp_dynflag)) - 1ULL;
+
 		/* 0xffff ffff if PKT_RX_RSS_HASH is set, otherwise 0 */
 		rss_mask = ~(((m->ol_flags & PKT_RX_RSS_HASH) != 0) - 1);
 		do_rss = !rss_mask && !eth_rx_queue_info->flow_id_mask;
@@ -899,6 +921,11 @@ rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
 			struct rte_event *ev;
 
 			m = mbufs[i];
+			*rte_event_eth_rx_timestamp_dynfield(m) =
+				ts |
+				(*rte_event_eth_rx_timestamp_dynfield(m) &
+				ts_mask);
+
 			ev = &buf->events[new_tail];
 
 			rss = do_rss ? rxa_do_softrss(m, rx_adapter->rss_key_be)
@@ -2256,6 +2283,14 @@ rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
 	event_eth_rx_adapter[id] = rx_adapter;
 	if (conf_cb == rxa_default_conf_cb)
 		rx_adapter->default_cb_arg = 1;
+
+	if (rte_mbuf_dyn_rx_timestamp_register(
+			&event_eth_rx_timestamp_dynfield_offset,
+			&event_eth_rx_timestamp_dynflag) != 0) {
+		RTE_EDEV_LOG_ERR("Error registering timestamp field in mbuf\n");
+		return -rte_errno;
+	}
+
 	rte_eventdev_trace_eth_rx_adapter_create(id, dev_id, conf_cb,
 		conf_arg);
 	return 0;
-- 
2.6.4


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

* Re: [dpdk-dev] [PATCH v1] eventdev: update rx timestamp in mbuf using mbuf dynamic field
  2021-09-14  7:14 [dpdk-dev] [PATCH v1] eventdev: update rx timestamp in mbuf using mbuf dynamic field Ganapati Kundapura
@ 2021-09-16  4:50 ` Jerin Jacob
  2021-09-16  8:33   ` Kundapura, Ganapati
  2021-09-16  7:21 ` [dpdk-dev] [PATCH v2] " Ganapati Kundapura
  2021-09-16  9:15 ` Ganapati Kundapura
  2 siblings, 1 reply; 13+ messages in thread
From: Jerin Jacob @ 2021-09-16  4:50 UTC (permalink / raw)
  To: Ganapati Kundapura, Ferruh Yigit; +Cc: Jayatheerthan, Jay, dpdk-dev

On Tue, Sep 14, 2021 at 12:44 PM Ganapati Kundapura
<ganapati.kundapura@intel.com> wrote:
>
> Add support to register timestamp dynamic field in mbuf.
>
> Update the timestamp in mbuf for each packet before enqueuing
> to event device if the timestamp is not already set.
>
> Adding the timestamp in Rx adapter avoids additional latency
> due to the event device.
>
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> ---
>  lib/eventdev/rte_event_eth_rx_adapter.c | 35 +++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
>
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
> index de8ab05..9cb2550 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> @@ -17,6 +17,7 @@
>  #include <rte_service_component.h>
>  #include <rte_thash.h>
>  #include <rte_interrupts.h>
> +#include <rte_mbuf_dyn.h>
>
>  #include "rte_eventdev.h"
>  #include "eventdev_pmd.h"
> @@ -240,6 +241,17 @@ struct eth_rx_queue_info {
>
>  static struct rte_event_eth_rx_adapter **event_eth_rx_adapter;
>
> +/* Enable dynamic timestamp field in mbuf */
> +uint64_t event_eth_rx_timestamp_dynflag;
> +int event_eth_rx_timestamp_dynfield_offset = -1;
> +
> +static inline rte_mbuf_timestamp_t *
> +rte_event_eth_rx_timestamp_dynfield(struct rte_mbuf *mbuf)

Internal functions, please avoid using rte_

Rest looks good to me. Please send v2 as there are some patchwork failures too.
I have rebased the next-eventdev tree. So v2 should be pass and we can merge it.

Cc: @Ferruh Yigit


> +{
> +       return RTE_MBUF_DYNFIELD(mbuf,
> +               event_eth_rx_timestamp_dynfield_offset, rte_mbuf_timestamp_t *);
> +}
> +
>  static inline int
>  rxa_validate_id(uint8_t id)
>  {
> @@ -890,8 +902,18 @@ rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
>         int do_rss;
>         uint16_t nb_cb;
>         uint16_t dropped;
> +       uint64_t ts, ts_mask;
>
>         if (!eth_rx_queue_info->ena_vector) {
> +               ts = m->ol_flags & event_eth_rx_timestamp_dynflag ?
> +                                               0 : rte_get_tsc_cycles();
> +
> +               /* 0xffff ffff ffff ffff if PKT_RX_TIMESTAMP is set,
> +                * otherwise 0
> +                */
> +               ts_mask = (uint64_t)(!(m->ol_flags &
> +                                      event_eth_rx_timestamp_dynflag)) - 1ULL;
> +
>                 /* 0xffff ffff if PKT_RX_RSS_HASH is set, otherwise 0 */
>                 rss_mask = ~(((m->ol_flags & PKT_RX_RSS_HASH) != 0) - 1);
>                 do_rss = !rss_mask && !eth_rx_queue_info->flow_id_mask;
> @@ -899,6 +921,11 @@ rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
>                         struct rte_event *ev;
>
>                         m = mbufs[i];
> +                       *rte_event_eth_rx_timestamp_dynfield(m) =
> +                               ts |
> +                               (*rte_event_eth_rx_timestamp_dynfield(m) &
> +                               ts_mask);
> +
>                         ev = &buf->events[new_tail];
>
>                         rss = do_rss ? rxa_do_softrss(m, rx_adapter->rss_key_be)
> @@ -2256,6 +2283,14 @@ rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
>         event_eth_rx_adapter[id] = rx_adapter;
>         if (conf_cb == rxa_default_conf_cb)
>                 rx_adapter->default_cb_arg = 1;
> +
> +       if (rte_mbuf_dyn_rx_timestamp_register(
> +                       &event_eth_rx_timestamp_dynfield_offset,
> +                       &event_eth_rx_timestamp_dynflag) != 0) {
> +               RTE_EDEV_LOG_ERR("Error registering timestamp field in mbuf\n");
> +               return -rte_errno;
> +       }
> +
>         rte_eventdev_trace_eth_rx_adapter_create(id, dev_id, conf_cb,
>                 conf_arg);
>         return 0;
> --
> 2.6.4
>

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

* [dpdk-dev] [PATCH v2] eventdev: update rx timestamp in mbuf using mbuf dynamic field
  2021-09-14  7:14 [dpdk-dev] [PATCH v1] eventdev: update rx timestamp in mbuf using mbuf dynamic field Ganapati Kundapura
  2021-09-16  4:50 ` Jerin Jacob
@ 2021-09-16  7:21 ` Ganapati Kundapura
  2021-09-16  7:37   ` Jayatheerthan, Jay
  2021-09-16  9:15 ` Ganapati Kundapura
  2 siblings, 1 reply; 13+ messages in thread
From: Ganapati Kundapura @ 2021-09-16  7:21 UTC (permalink / raw)
  To: jay.jayatheerthan, jerinjacobk; +Cc: dev, ferruh.yigit

Add support to register timestamp dynamic field in mbuf.

Update the timestamp in mbuf for each packet before enqueuing
to event device if the timestamp is not already set.

Adding the timestamp in Rx adapter avoids additional latency
due to the event device.

Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>

---
v2:
* Removed rte_ prefix from the internal function

v1:
* Add support to register timestamp dynamic field in mbuf
---
---
 lib/eventdev/rte_event_eth_rx_adapter.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index f2dc695..fd79b28 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -17,6 +17,7 @@
 #include <rte_service_component.h>
 #include <rte_thash.h>
 #include <rte_interrupts.h>
+#include <rte_mbuf_dyn.h>
 
 #include "rte_eventdev.h"
 #include "eventdev_pmd.h"
@@ -240,6 +241,17 @@ struct eth_rx_queue_info {
 
 static struct rte_event_eth_rx_adapter **event_eth_rx_adapter;
 
+/* Enable dynamic timestamp field in mbuf */
+uint64_t event_eth_rx_timestamp_dynflag;
+int event_eth_rx_timestamp_dynfield_offset = -1;
+
+static inline rte_mbuf_timestamp_t *
+rxa_timestamp_dynfield(struct rte_mbuf *mbuf)
+{
+	return RTE_MBUF_DYNFIELD(mbuf,
+		event_eth_rx_timestamp_dynfield_offset, rte_mbuf_timestamp_t *);
+}
+
 static inline int
 rxa_validate_id(uint8_t id)
 {
@@ -890,8 +902,18 @@ rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
 	int do_rss;
 	uint16_t nb_cb;
 	uint16_t dropped;
+	uint64_t ts, ts_mask;
 
 	if (!eth_rx_queue_info->ena_vector) {
+		ts = m->ol_flags & event_eth_rx_timestamp_dynflag ?
+						0 : rte_get_tsc_cycles();
+
+		/* 0xffff ffff ffff ffff if PKT_RX_TIMESTAMP is set,
+		 * otherwise 0
+		 */
+		ts_mask = (uint64_t)(!(m->ol_flags &
+				       event_eth_rx_timestamp_dynflag)) - 1ULL;
+
 		/* 0xffff ffff if PKT_RX_RSS_HASH is set, otherwise 0 */
 		rss_mask = ~(((m->ol_flags & PKT_RX_RSS_HASH) != 0) - 1);
 		do_rss = !rss_mask && !eth_rx_queue_info->flow_id_mask;
@@ -899,6 +921,9 @@ rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
 			struct rte_event *ev;
 
 			m = mbufs[i];
+			*rxa_timestamp_dynfield(m) = ts |
+					(*rxa_timestamp_dynfield(m) & ts_mask);
+
 			ev = &buf->events[new_tail];
 
 			rss = do_rss ? rxa_do_softrss(m, rx_adapter->rss_key_be)
@@ -2238,6 +2263,14 @@ rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
 	event_eth_rx_adapter[id] = rx_adapter;
 	if (conf_cb == rxa_default_conf_cb)
 		rx_adapter->default_cb_arg = 1;
+
+	if (rte_mbuf_dyn_rx_timestamp_register(
+			&event_eth_rx_timestamp_dynfield_offset,
+			&event_eth_rx_timestamp_dynflag) != 0) {
+		RTE_EDEV_LOG_ERR("Error registering timestamp field in mbuf\n");
+		return -rte_errno;
+	}
+
 	rte_eventdev_trace_eth_rx_adapter_create(id, dev_id, conf_cb,
 		conf_arg);
 	return 0;
-- 
2.6.4


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

* Re: [dpdk-dev] [PATCH v2] eventdev: update rx timestamp in mbuf using mbuf dynamic field
  2021-09-16  7:21 ` [dpdk-dev] [PATCH v2] " Ganapati Kundapura
@ 2021-09-16  7:37   ` Jayatheerthan, Jay
  0 siblings, 0 replies; 13+ messages in thread
From: Jayatheerthan, Jay @ 2021-09-16  7:37 UTC (permalink / raw)
  To: Kundapura, Ganapati, jerinjacobk; +Cc: dev, Yigit, Ferruh

> -----Original Message-----
> From: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Sent: Thursday, September 16, 2021 12:52 PM
> To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; jerinjacobk@gmail.com
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: [PATCH v2] eventdev: update rx timestamp in mbuf using mbuf dynamic field
> 
> Add support to register timestamp dynamic field in mbuf.
> 
> Update the timestamp in mbuf for each packet before enqueuing
> to event device if the timestamp is not already set.
> 
> Adding the timestamp in Rx adapter avoids additional latency
> due to the event device.
> 
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> 
> ---
> v2:
> * Removed rte_ prefix from the internal function
> 
> v1:
> * Add support to register timestamp dynamic field in mbuf
> ---
> ---
>  lib/eventdev/rte_event_eth_rx_adapter.c | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
> index f2dc695..fd79b28 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> @@ -17,6 +17,7 @@
>  #include <rte_service_component.h>
>  #include <rte_thash.h>
>  #include <rte_interrupts.h>
> +#include <rte_mbuf_dyn.h>
> 
>  #include "rte_eventdev.h"
>  #include "eventdev_pmd.h"
> @@ -240,6 +241,17 @@ struct eth_rx_queue_info {
> 
>  static struct rte_event_eth_rx_adapter **event_eth_rx_adapter;
> 
> +/* Enable dynamic timestamp field in mbuf */
> +uint64_t event_eth_rx_timestamp_dynflag;
> +int event_eth_rx_timestamp_dynfield_offset = -1;
> +
> +static inline rte_mbuf_timestamp_t *
> +rxa_timestamp_dynfield(struct rte_mbuf *mbuf)
> +{
> +	return RTE_MBUF_DYNFIELD(mbuf,
> +		event_eth_rx_timestamp_dynfield_offset, rte_mbuf_timestamp_t *);
> +}
> +
>  static inline int
>  rxa_validate_id(uint8_t id)
>  {
> @@ -890,8 +902,18 @@ rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
>  	int do_rss;
>  	uint16_t nb_cb;
>  	uint16_t dropped;
> +	uint64_t ts, ts_mask;
> 
>  	if (!eth_rx_queue_info->ena_vector) {
> +		ts = m->ol_flags & event_eth_rx_timestamp_dynflag ?
> +						0 : rte_get_tsc_cycles();
> +
> +		/* 0xffff ffff ffff ffff if PKT_RX_TIMESTAMP is set,
> +		 * otherwise 0
> +		 */
> +		ts_mask = (uint64_t)(!(m->ol_flags &
> +				       event_eth_rx_timestamp_dynflag)) - 1ULL;
> +
>  		/* 0xffff ffff if PKT_RX_RSS_HASH is set, otherwise 0 */
>  		rss_mask = ~(((m->ol_flags & PKT_RX_RSS_HASH) != 0) - 1);
>  		do_rss = !rss_mask && !eth_rx_queue_info->flow_id_mask;
> @@ -899,6 +921,9 @@ rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
>  			struct rte_event *ev;
> 
>  			m = mbufs[i];
> +			*rxa_timestamp_dynfield(m) = ts |
> +					(*rxa_timestamp_dynfield(m) & ts_mask);
> +
>  			ev = &buf->events[new_tail];
> 
>  			rss = do_rss ? rxa_do_softrss(m, rx_adapter->rss_key_be)
> @@ -2238,6 +2263,14 @@ rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
>  	event_eth_rx_adapter[id] = rx_adapter;
>  	if (conf_cb == rxa_default_conf_cb)
>  		rx_adapter->default_cb_arg = 1;
> +
> +	if (rte_mbuf_dyn_rx_timestamp_register(
> +			&event_eth_rx_timestamp_dynfield_offset,
> +			&event_eth_rx_timestamp_dynflag) != 0) {
> +		RTE_EDEV_LOG_ERR("Error registering timestamp field in mbuf\n");
> +		return -rte_errno;
> +	}
> +
>  	rte_eventdev_trace_eth_rx_adapter_create(id, dev_id, conf_cb,
>  		conf_arg);
>  	return 0;
> --
> 2.6.4

Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>


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

* Re: [dpdk-dev] [PATCH v1] eventdev: update rx timestamp in mbuf using mbuf dynamic field
  2021-09-16  4:50 ` Jerin Jacob
@ 2021-09-16  8:33   ` Kundapura, Ganapati
  2021-09-16  8:37     ` Jerin Jacob
  0 siblings, 1 reply; 13+ messages in thread
From: Kundapura, Ganapati @ 2021-09-16  8:33 UTC (permalink / raw)
  To: Jerin Jacob, Yigit, Ferruh; +Cc: Jayatheerthan, Jay, dpdk-dev

Hi Jerrin,

> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: 16 September 2021 10:20
> To: Kundapura, Ganapati <ganapati.kundapura@intel.com>; Yigit, Ferruh
> <ferruh.yigit@intel.com>
> Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> <dev@dpdk.org>
> Subject: Re: [PATCH v1] eventdev: update rx timestamp in mbuf using mbuf
> dynamic field
> 
> On Tue, Sep 14, 2021 at 12:44 PM Ganapati Kundapura
> <ganapati.kundapura@intel.com> wrote:
> >
> > Add support to register timestamp dynamic field in mbuf.
> >
> > Update the timestamp in mbuf for each packet before enqueuing to event
> > device if the timestamp is not already set.
> >
> > Adding the timestamp in Rx adapter avoids additional latency due to
> > the event device.
> >
> > Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> > ---
> >  lib/eventdev/rte_event_eth_rx_adapter.c | 35
> > +++++++++++++++++++++++++++++++++
> >  1 file changed, 35 insertions(+)
> >
> > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c
> > b/lib/eventdev/rte_event_eth_rx_adapter.c
> > index de8ab05..9cb2550 100644
> > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > @@ -17,6 +17,7 @@
> >  #include <rte_service_component.h>
> >  #include <rte_thash.h>
> >  #include <rte_interrupts.h>
> > +#include <rte_mbuf_dyn.h>
> >
> >  #include "rte_eventdev.h"
> >  #include "eventdev_pmd.h"
> > @@ -240,6 +241,17 @@ struct eth_rx_queue_info {
> >
> >  static struct rte_event_eth_rx_adapter **event_eth_rx_adapter;
> >
> > +/* Enable dynamic timestamp field in mbuf */ uint64_t
> > +event_eth_rx_timestamp_dynflag; int
> > +event_eth_rx_timestamp_dynfield_offset = -1;
> > +
> > +static inline rte_mbuf_timestamp_t *
> > +rte_event_eth_rx_timestamp_dynfield(struct rte_mbuf *mbuf)
> 
> Internal functions, please avoid using rte_
> 
> Rest looks good to me. Please send v2 as there are some patchwork failures
> too.
> I have rebased the next-eventdev tree. So v2 should be pass and we can
> merge it.
> 
> Cc: @Ferruh Yigit
Looks like rebased next-eventdev tree is not having the latest commits in the tree.
Patch V2 also failed to apply cleanly. V2 changes are after circular buffer changes but 
in rebased next-eventdev tree is having commit before circular buffer patch
> 
> 
> > +{
> > +       return RTE_MBUF_DYNFIELD(mbuf,
> > +               event_eth_rx_timestamp_dynfield_offset,
> > +rte_mbuf_timestamp_t *); }
> > +
> >  static inline int
> >  rxa_validate_id(uint8_t id)
> >  {
> > @@ -890,8 +902,18 @@ rxa_buffer_mbufs(struct
> rte_event_eth_rx_adapter *rx_adapter,
> >         int do_rss;
> >         uint16_t nb_cb;
> >         uint16_t dropped;
> > +       uint64_t ts, ts_mask;
> >
> >         if (!eth_rx_queue_info->ena_vector) {
> > +               ts = m->ol_flags & event_eth_rx_timestamp_dynflag ?
> > +                                               0 :
> > + rte_get_tsc_cycles();
> > +
> > +               /* 0xffff ffff ffff ffff if PKT_RX_TIMESTAMP is set,
> > +                * otherwise 0
> > +                */
> > +               ts_mask = (uint64_t)(!(m->ol_flags &
> > +
> > + event_eth_rx_timestamp_dynflag)) - 1ULL;
> > +
> >                 /* 0xffff ffff if PKT_RX_RSS_HASH is set, otherwise 0 */
> >                 rss_mask = ~(((m->ol_flags & PKT_RX_RSS_HASH) != 0) - 1);
> >                 do_rss = !rss_mask &&
> > !eth_rx_queue_info->flow_id_mask; @@ -899,6 +921,11 @@
> rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
> >                         struct rte_event *ev;
> >
> >                         m = mbufs[i];
> > +                       *rte_event_eth_rx_timestamp_dynfield(m) =
> > +                               ts |
> > +                               (*rte_event_eth_rx_timestamp_dynfield(m) &
> > +                               ts_mask);
> > +
> >                         ev = &buf->events[new_tail];
> >
> >                         rss = do_rss ? rxa_do_softrss(m,
> > rx_adapter->rss_key_be) @@ -2256,6 +2283,14 @@
> rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
> >         event_eth_rx_adapter[id] = rx_adapter;
> >         if (conf_cb == rxa_default_conf_cb)
> >                 rx_adapter->default_cb_arg = 1;
> > +
> > +       if (rte_mbuf_dyn_rx_timestamp_register(
> > +                       &event_eth_rx_timestamp_dynfield_offset,
> > +                       &event_eth_rx_timestamp_dynflag) != 0) {
> > +               RTE_EDEV_LOG_ERR("Error registering timestamp field in
> mbuf\n");
> > +               return -rte_errno;
> > +       }
> > +
> >         rte_eventdev_trace_eth_rx_adapter_create(id, dev_id, conf_cb,
> >                 conf_arg);
> >         return 0;
> > --
> > 2.6.4
> >

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

* Re: [dpdk-dev] [PATCH v1] eventdev: update rx timestamp in mbuf using mbuf dynamic field
  2021-09-16  8:33   ` Kundapura, Ganapati
@ 2021-09-16  8:37     ` Jerin Jacob
  2021-09-16  9:11       ` Kundapura, Ganapati
  0 siblings, 1 reply; 13+ messages in thread
From: Jerin Jacob @ 2021-09-16  8:37 UTC (permalink / raw)
  To: Kundapura, Ganapati; +Cc: Yigit, Ferruh, Jayatheerthan, Jay, dpdk-dev

On Thu, Sep 16, 2021 at 2:03 PM Kundapura, Ganapati
<ganapati.kundapura@intel.com> wrote:
>
> Hi Jerrin,
>
> > -----Original Message-----
> > From: Jerin Jacob <jerinjacobk@gmail.com>
> > Sent: 16 September 2021 10:20
> > To: Kundapura, Ganapati <ganapati.kundapura@intel.com>; Yigit, Ferruh
> > <ferruh.yigit@intel.com>
> > Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> > <dev@dpdk.org>
> > Subject: Re: [PATCH v1] eventdev: update rx timestamp in mbuf using mbuf
> > dynamic field
> >
> > On Tue, Sep 14, 2021 at 12:44 PM Ganapati Kundapura
> > <ganapati.kundapura@intel.com> wrote:
> > >
> > > Add support to register timestamp dynamic field in mbuf.
> > >
> > > Update the timestamp in mbuf for each packet before enqueuing to event
> > > device if the timestamp is not already set.
> > >
> > > Adding the timestamp in Rx adapter avoids additional latency due to
> > > the event device.
> > >
> > > Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> > > ---
> > >  lib/eventdev/rte_event_eth_rx_adapter.c | 35
> > > +++++++++++++++++++++++++++++++++
> > >  1 file changed, 35 insertions(+)
> > >
> > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > index de8ab05..9cb2550 100644
> > > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > @@ -17,6 +17,7 @@
> > >  #include <rte_service_component.h>
> > >  #include <rte_thash.h>
> > >  #include <rte_interrupts.h>
> > > +#include <rte_mbuf_dyn.h>
> > >
> > >  #include "rte_eventdev.h"
> > >  #include "eventdev_pmd.h"
> > > @@ -240,6 +241,17 @@ struct eth_rx_queue_info {
> > >
> > >  static struct rte_event_eth_rx_adapter **event_eth_rx_adapter;
> > >
> > > +/* Enable dynamic timestamp field in mbuf */ uint64_t
> > > +event_eth_rx_timestamp_dynflag; int
> > > +event_eth_rx_timestamp_dynfield_offset = -1;
> > > +
> > > +static inline rte_mbuf_timestamp_t *
> > > +rte_event_eth_rx_timestamp_dynfield(struct rte_mbuf *mbuf)
> >
> > Internal functions, please avoid using rte_
> >
> > Rest looks good to me. Please send v2 as there are some patchwork failures
> > too.
> > I have rebased the next-eventdev tree. So v2 should be pass and we can
> > merge it.
> >
> > Cc: @Ferruh Yigit
> Looks like rebased next-eventdev tree is not having the latest commits in the tree.
> Patch V2 also failed to apply cleanly. V2 changes are after circular buffer changes but
> in rebased next-eventdev tree is having commit before circular buffer patch

Could you share the circular buffer patch? Also, delegate to me the
eventdev patches.
Also, Please add dependencies like the following in the patch to track.

Depends-on: series-18612 ("net/cnxk: support for inline ipsec")

> >
> >
> > > +{
> > > +       return RTE_MBUF_DYNFIELD(mbuf,
> > > +               event_eth_rx_timestamp_dynfield_offset,
> > > +rte_mbuf_timestamp_t *); }
> > > +
> > >  static inline int
> > >  rxa_validate_id(uint8_t id)
> > >  {
> > > @@ -890,8 +902,18 @@ rxa_buffer_mbufs(struct
> > rte_event_eth_rx_adapter *rx_adapter,
> > >         int do_rss;
> > >         uint16_t nb_cb;
> > >         uint16_t dropped;
> > > +       uint64_t ts, ts_mask;
> > >
> > >         if (!eth_rx_queue_info->ena_vector) {
> > > +               ts = m->ol_flags & event_eth_rx_timestamp_dynflag ?
> > > +                                               0 :
> > > + rte_get_tsc_cycles();
> > > +
> > > +               /* 0xffff ffff ffff ffff if PKT_RX_TIMESTAMP is set,
> > > +                * otherwise 0
> > > +                */
> > > +               ts_mask = (uint64_t)(!(m->ol_flags &
> > > +
> > > + event_eth_rx_timestamp_dynflag)) - 1ULL;
> > > +
> > >                 /* 0xffff ffff if PKT_RX_RSS_HASH is set, otherwise 0 */
> > >                 rss_mask = ~(((m->ol_flags & PKT_RX_RSS_HASH) != 0) - 1);
> > >                 do_rss = !rss_mask &&
> > > !eth_rx_queue_info->flow_id_mask; @@ -899,6 +921,11 @@
> > rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
> > >                         struct rte_event *ev;
> > >
> > >                         m = mbufs[i];
> > > +                       *rte_event_eth_rx_timestamp_dynfield(m) =
> > > +                               ts |
> > > +                               (*rte_event_eth_rx_timestamp_dynfield(m) &
> > > +                               ts_mask);
> > > +
> > >                         ev = &buf->events[new_tail];
> > >
> > >                         rss = do_rss ? rxa_do_softrss(m,
> > > rx_adapter->rss_key_be) @@ -2256,6 +2283,14 @@
> > rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
> > >         event_eth_rx_adapter[id] = rx_adapter;
> > >         if (conf_cb == rxa_default_conf_cb)
> > >                 rx_adapter->default_cb_arg = 1;
> > > +
> > > +       if (rte_mbuf_dyn_rx_timestamp_register(
> > > +                       &event_eth_rx_timestamp_dynfield_offset,
> > > +                       &event_eth_rx_timestamp_dynflag) != 0) {
> > > +               RTE_EDEV_LOG_ERR("Error registering timestamp field in
> > mbuf\n");
> > > +               return -rte_errno;
> > > +       }
> > > +
> > >         rte_eventdev_trace_eth_rx_adapter_create(id, dev_id, conf_cb,
> > >                 conf_arg);
> > >         return 0;
> > > --
> > > 2.6.4
> > >

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

* Re: [dpdk-dev] [PATCH v1] eventdev: update rx timestamp in mbuf using mbuf dynamic field
  2021-09-16  8:37     ` Jerin Jacob
@ 2021-09-16  9:11       ` Kundapura, Ganapati
  2021-09-16  9:23         ` Jerin Jacob
  0 siblings, 1 reply; 13+ messages in thread
From: Kundapura, Ganapati @ 2021-09-16  9:11 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: Yigit, Ferruh, Jayatheerthan, Jay, dpdk-dev

Hi Jerin,

> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: 16 September 2021 14:08
> To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; Jayatheerthan, Jay
> <jay.jayatheerthan@intel.com>; dpdk-dev <dev@dpdk.org>
> Subject: Re: [PATCH v1] eventdev: update rx timestamp in mbuf using mbuf
> dynamic field
> 
> On Thu, Sep 16, 2021 at 2:03 PM Kundapura, Ganapati
> <ganapati.kundapura@intel.com> wrote:
> >
> > Hi Jerrin,
> >
> > > -----Original Message-----
> > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > Sent: 16 September 2021 10:20
> > > To: Kundapura, Ganapati <ganapati.kundapura@intel.com>; Yigit,
> > > Ferruh <ferruh.yigit@intel.com>
> > > Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> > > <dev@dpdk.org>
> > > Subject: Re: [PATCH v1] eventdev: update rx timestamp in mbuf using
> > > mbuf dynamic field
> > >
> > > On Tue, Sep 14, 2021 at 12:44 PM Ganapati Kundapura
> > > <ganapati.kundapura@intel.com> wrote:
> > > >
> > > > Add support to register timestamp dynamic field in mbuf.
> > > >
> > > > Update the timestamp in mbuf for each packet before enqueuing to
> > > > event device if the timestamp is not already set.
> > > >
> > > > Adding the timestamp in Rx adapter avoids additional latency due
> > > > to the event device.
> > > >
> > > > Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> > > > ---
> > > >  lib/eventdev/rte_event_eth_rx_adapter.c | 35
> > > > +++++++++++++++++++++++++++++++++
> > > >  1 file changed, 35 insertions(+)
> > > >
> > > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > index de8ab05..9cb2550 100644
> > > > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > @@ -17,6 +17,7 @@
> > > >  #include <rte_service_component.h>  #include <rte_thash.h>
> > > > #include <rte_interrupts.h>
> > > > +#include <rte_mbuf_dyn.h>
> > > >
> > > >  #include "rte_eventdev.h"
> > > >  #include "eventdev_pmd.h"
> > > > @@ -240,6 +241,17 @@ struct eth_rx_queue_info {
> > > >
> > > >  static struct rte_event_eth_rx_adapter **event_eth_rx_adapter;
> > > >
> > > > +/* Enable dynamic timestamp field in mbuf */ uint64_t
> > > > +event_eth_rx_timestamp_dynflag; int
> > > > +event_eth_rx_timestamp_dynfield_offset = -1;
> > > > +
> > > > +static inline rte_mbuf_timestamp_t *
> > > > +rte_event_eth_rx_timestamp_dynfield(struct rte_mbuf *mbuf)
> > >
> > > Internal functions, please avoid using rte_
> > >
> > > Rest looks good to me. Please send v2 as there are some patchwork
> > > failures too.
> > > I have rebased the next-eventdev tree. So v2 should be pass and we
> > > can merge it.
> > >
> > > Cc: @Ferruh Yigit
> > Looks like rebased next-eventdev tree is not having the latest commits in
> the tree.
> > Patch V2 also failed to apply cleanly. V2 changes are after circular
> > buffer changes but in rebased next-eventdev tree is having commit
> > before circular buffer patch
> 
> Could you share the circular buffer patch? Also, delegate to me the eventdev
> patches.
> Also, Please add dependencies like the following in the patch to track.
> 
> Depends-on: series-18612 ("net/cnxk: support for inline ipsec")
Circular buffer patch: https://patches.dpdk.org/project/dpdk/patch/20210830130625.1892399-1-ganapati.kundapura@intel.com/
Added dependency in the updated patch and delegated to you
> 
> > >
> > >
> > > > +{
> > > > +       return RTE_MBUF_DYNFIELD(mbuf,
> > > > +               event_eth_rx_timestamp_dynfield_offset,
> > > > +rte_mbuf_timestamp_t *); }
> > > > +
> > > >  static inline int
> > > >  rxa_validate_id(uint8_t id)
> > > >  {
> > > > @@ -890,8 +902,18 @@ rxa_buffer_mbufs(struct
> > > rte_event_eth_rx_adapter *rx_adapter,
> > > >         int do_rss;
> > > >         uint16_t nb_cb;
> > > >         uint16_t dropped;
> > > > +       uint64_t ts, ts_mask;
> > > >
> > > >         if (!eth_rx_queue_info->ena_vector) {
> > > > +               ts = m->ol_flags & event_eth_rx_timestamp_dynflag ?
> > > > +                                               0 :
> > > > + rte_get_tsc_cycles();
> > > > +
> > > > +               /* 0xffff ffff ffff ffff if PKT_RX_TIMESTAMP is set,
> > > > +                * otherwise 0
> > > > +                */
> > > > +               ts_mask = (uint64_t)(!(m->ol_flags &
> > > > +
> > > > + event_eth_rx_timestamp_dynflag)) - 1ULL;
> > > > +
> > > >                 /* 0xffff ffff if PKT_RX_RSS_HASH is set, otherwise 0 */
> > > >                 rss_mask = ~(((m->ol_flags & PKT_RX_RSS_HASH) != 0) - 1);
> > > >                 do_rss = !rss_mask &&
> > > > !eth_rx_queue_info->flow_id_mask; @@ -899,6 +921,11 @@
> > > rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
> > > >                         struct rte_event *ev;
> > > >
> > > >                         m = mbufs[i];
> > > > +                       *rte_event_eth_rx_timestamp_dynfield(m) =
> > > > +                               ts |
> > > > +                               (*rte_event_eth_rx_timestamp_dynfield(m) &
> > > > +                               ts_mask);
> > > > +
> > > >                         ev = &buf->events[new_tail];
> > > >
> > > >                         rss = do_rss ? rxa_do_softrss(m,
> > > > rx_adapter->rss_key_be) @@ -2256,6 +2283,14 @@
> > > rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
> > > >         event_eth_rx_adapter[id] = rx_adapter;
> > > >         if (conf_cb == rxa_default_conf_cb)
> > > >                 rx_adapter->default_cb_arg = 1;
> > > > +
> > > > +       if (rte_mbuf_dyn_rx_timestamp_register(
> > > > +                       &event_eth_rx_timestamp_dynfield_offset,
> > > > +                       &event_eth_rx_timestamp_dynflag) != 0) {
> > > > +               RTE_EDEV_LOG_ERR("Error registering timestamp
> > > > + field in
> > > mbuf\n");
> > > > +               return -rte_errno;
> > > > +       }
> > > > +
> > > >         rte_eventdev_trace_eth_rx_adapter_create(id, dev_id, conf_cb,
> > > >                 conf_arg);
> > > >         return 0;
> > > > --
> > > > 2.6.4
> > > >

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

* [dpdk-dev] [PATCH v2] eventdev: update rx timestamp in mbuf using mbuf dynamic field
  2021-09-14  7:14 [dpdk-dev] [PATCH v1] eventdev: update rx timestamp in mbuf using mbuf dynamic field Ganapati Kundapura
  2021-09-16  4:50 ` Jerin Jacob
  2021-09-16  7:21 ` [dpdk-dev] [PATCH v2] " Ganapati Kundapura
@ 2021-09-16  9:15 ` Ganapati Kundapura
  2021-09-28 14:24   ` Jerin Jacob
  2021-09-28 16:38   ` [dpdk-dev] [PATCH v3] eventdev: add Rx " Ganapati Kundapura
  2 siblings, 2 replies; 13+ messages in thread
From: Ganapati Kundapura @ 2021-09-16  9:15 UTC (permalink / raw)
  To: jay.jayatheerthan, jerinjacobk; +Cc: dev, ferruh.yigit

Add support to register timestamp dynamic field in mbuf.

Update the timestamp in mbuf for each packet before enqueuing
to event device if the timestamp is not already set.

Adding the timestamp in Rx adapter avoids additional latency
due to the event device.

Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>

---
Depends-on: patch-97549(make Rx-adapter enqueue buffer as circular buffer)

v2:
* Removed rte_ prefix from the internal function

v1:
* Add support to register timestamp dynamic field in mbuf
---
---
 lib/eventdev/rte_event_eth_rx_adapter.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index f2dc695..fd79b28 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -17,6 +17,7 @@
 #include <rte_service_component.h>
 #include <rte_thash.h>
 #include <rte_interrupts.h>
+#include <rte_mbuf_dyn.h>
 
 #include "rte_eventdev.h"
 #include "eventdev_pmd.h"
@@ -240,6 +241,17 @@ struct eth_rx_queue_info {
 
 static struct rte_event_eth_rx_adapter **event_eth_rx_adapter;
 
+/* Enable dynamic timestamp field in mbuf */
+uint64_t event_eth_rx_timestamp_dynflag;
+int event_eth_rx_timestamp_dynfield_offset = -1;
+
+static inline rte_mbuf_timestamp_t *
+rxa_timestamp_dynfield(struct rte_mbuf *mbuf)
+{
+	return RTE_MBUF_DYNFIELD(mbuf,
+		event_eth_rx_timestamp_dynfield_offset, rte_mbuf_timestamp_t *);
+}
+
 static inline int
 rxa_validate_id(uint8_t id)
 {
@@ -890,8 +902,18 @@ rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
 	int do_rss;
 	uint16_t nb_cb;
 	uint16_t dropped;
+	uint64_t ts, ts_mask;
 
 	if (!eth_rx_queue_info->ena_vector) {
+		ts = m->ol_flags & event_eth_rx_timestamp_dynflag ?
+						0 : rte_get_tsc_cycles();
+
+		/* 0xffff ffff ffff ffff if PKT_RX_TIMESTAMP is set,
+		 * otherwise 0
+		 */
+		ts_mask = (uint64_t)(!(m->ol_flags &
+				       event_eth_rx_timestamp_dynflag)) - 1ULL;
+
 		/* 0xffff ffff if PKT_RX_RSS_HASH is set, otherwise 0 */
 		rss_mask = ~(((m->ol_flags & PKT_RX_RSS_HASH) != 0) - 1);
 		do_rss = !rss_mask && !eth_rx_queue_info->flow_id_mask;
@@ -899,6 +921,9 @@ rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
 			struct rte_event *ev;
 
 			m = mbufs[i];
+			*rxa_timestamp_dynfield(m) = ts |
+					(*rxa_timestamp_dynfield(m) & ts_mask);
+
 			ev = &buf->events[new_tail];
 
 			rss = do_rss ? rxa_do_softrss(m, rx_adapter->rss_key_be)
@@ -2238,6 +2263,14 @@ rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
 	event_eth_rx_adapter[id] = rx_adapter;
 	if (conf_cb == rxa_default_conf_cb)
 		rx_adapter->default_cb_arg = 1;
+
+	if (rte_mbuf_dyn_rx_timestamp_register(
+			&event_eth_rx_timestamp_dynfield_offset,
+			&event_eth_rx_timestamp_dynflag) != 0) {
+		RTE_EDEV_LOG_ERR("Error registering timestamp field in mbuf\n");
+		return -rte_errno;
+	}
+
 	rte_eventdev_trace_eth_rx_adapter_create(id, dev_id, conf_cb,
 		conf_arg);
 	return 0;
-- 
2.6.4


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

* Re: [dpdk-dev] [PATCH v1] eventdev: update rx timestamp in mbuf using mbuf dynamic field
  2021-09-16  9:11       ` Kundapura, Ganapati
@ 2021-09-16  9:23         ` Jerin Jacob
  0 siblings, 0 replies; 13+ messages in thread
From: Jerin Jacob @ 2021-09-16  9:23 UTC (permalink / raw)
  To: Kundapura, Ganapati; +Cc: Yigit, Ferruh, Jayatheerthan, Jay, dpdk-dev

On Thu, Sep 16, 2021 at 2:42 PM Kundapura, Ganapati
<ganapati.kundapura@intel.com> wrote:
>
> Hi Jerin,
>
> > -----Original Message-----
> > From: Jerin Jacob <jerinjacobk@gmail.com>
> > Sent: 16 September 2021 14:08
> > To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; Jayatheerthan, Jay
> > <jay.jayatheerthan@intel.com>; dpdk-dev <dev@dpdk.org>
> > Subject: Re: [PATCH v1] eventdev: update rx timestamp in mbuf using mbuf
> > dynamic field
> >
> > On Thu, Sep 16, 2021 at 2:03 PM Kundapura, Ganapati
> > <ganapati.kundapura@intel.com> wrote:
> > >
> > > Hi Jerrin,
> > >
> > > > -----Original Message-----
> > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > Sent: 16 September 2021 10:20
> > > > To: Kundapura, Ganapati <ganapati.kundapura@intel.com>; Yigit,
> > > > Ferruh <ferruh.yigit@intel.com>
> > > > Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> > > > <dev@dpdk.org>
> > > > Subject: Re: [PATCH v1] eventdev: update rx timestamp in mbuf using
> > > > mbuf dynamic field
> > > >
> > > > On Tue, Sep 14, 2021 at 12:44 PM Ganapati Kundapura
> > > > <ganapati.kundapura@intel.com> wrote:
> > > > >
> > > > > Add support to register timestamp dynamic field in mbuf.
> > > > >
> > > > > Update the timestamp in mbuf for each packet before enqueuing to
> > > > > event device if the timestamp is not already set.
> > > > >
> > > > > Adding the timestamp in Rx adapter avoids additional latency due
> > > > > to the event device.
> > > > >
> > > > > Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> > > > > ---
> > > > >  lib/eventdev/rte_event_eth_rx_adapter.c | 35
> > > > > +++++++++++++++++++++++++++++++++
> > > > >  1 file changed, 35 insertions(+)
> > > > >
> > > > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > > b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > > index de8ab05..9cb2550 100644
> > > > > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > > @@ -17,6 +17,7 @@
> > > > >  #include <rte_service_component.h>  #include <rte_thash.h>
> > > > > #include <rte_interrupts.h>
> > > > > +#include <rte_mbuf_dyn.h>
> > > > >
> > > > >  #include "rte_eventdev.h"
> > > > >  #include "eventdev_pmd.h"
> > > > > @@ -240,6 +241,17 @@ struct eth_rx_queue_info {
> > > > >
> > > > >  static struct rte_event_eth_rx_adapter **event_eth_rx_adapter;
> > > > >
> > > > > +/* Enable dynamic timestamp field in mbuf */ uint64_t
> > > > > +event_eth_rx_timestamp_dynflag; int
> > > > > +event_eth_rx_timestamp_dynfield_offset = -1;
> > > > > +
> > > > > +static inline rte_mbuf_timestamp_t *
> > > > > +rte_event_eth_rx_timestamp_dynfield(struct rte_mbuf *mbuf)
> > > >
> > > > Internal functions, please avoid using rte_
> > > >
> > > > Rest looks good to me. Please send v2 as there are some patchwork
> > > > failures too.
> > > > I have rebased the next-eventdev tree. So v2 should be pass and we
> > > > can merge it.
> > > >
> > > > Cc: @Ferruh Yigit
> > > Looks like rebased next-eventdev tree is not having the latest commits in
> > the tree.
> > > Patch V2 also failed to apply cleanly. V2 changes are after circular
> > > buffer changes but in rebased next-eventdev tree is having commit
> > > before circular buffer patch
> >
> > Could you share the circular buffer patch? Also, delegate to me the eventdev
> > patches.
> > Also, Please add dependencies like the following in the patch to track.
> >
> > Depends-on: series-18612 ("net/cnxk: support for inline ipsec")
> Circular buffer patch: https://patches.dpdk.org/project/dpdk/patch/20210830130625.1892399-1-ganapati.kundapura@intel.com/
> Added dependency in the updated patch and delegated to you


I see. Which already merged. Some issue CI infra then.

Cc: @Ferruh Yigit


> >
> > > >
> > > >
> > > > > +{
> > > > > +       return RTE_MBUF_DYNFIELD(mbuf,
> > > > > +               event_eth_rx_timestamp_dynfield_offset,
> > > > > +rte_mbuf_timestamp_t *); }
> > > > > +
> > > > >  static inline int
> > > > >  rxa_validate_id(uint8_t id)
> > > > >  {
> > > > > @@ -890,8 +902,18 @@ rxa_buffer_mbufs(struct
> > > > rte_event_eth_rx_adapter *rx_adapter,
> > > > >         int do_rss;
> > > > >         uint16_t nb_cb;
> > > > >         uint16_t dropped;
> > > > > +       uint64_t ts, ts_mask;
> > > > >
> > > > >         if (!eth_rx_queue_info->ena_vector) {
> > > > > +               ts = m->ol_flags & event_eth_rx_timestamp_dynflag ?
> > > > > +                                               0 :
> > > > > + rte_get_tsc_cycles();
> > > > > +
> > > > > +               /* 0xffff ffff ffff ffff if PKT_RX_TIMESTAMP is set,
> > > > > +                * otherwise 0
> > > > > +                */
> > > > > +               ts_mask = (uint64_t)(!(m->ol_flags &
> > > > > +
> > > > > + event_eth_rx_timestamp_dynflag)) - 1ULL;
> > > > > +
> > > > >                 /* 0xffff ffff if PKT_RX_RSS_HASH is set, otherwise 0 */
> > > > >                 rss_mask = ~(((m->ol_flags & PKT_RX_RSS_HASH) != 0) - 1);
> > > > >                 do_rss = !rss_mask &&
> > > > > !eth_rx_queue_info->flow_id_mask; @@ -899,6 +921,11 @@
> > > > rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
> > > > >                         struct rte_event *ev;
> > > > >
> > > > >                         m = mbufs[i];
> > > > > +                       *rte_event_eth_rx_timestamp_dynfield(m) =
> > > > > +                               ts |
> > > > > +                               (*rte_event_eth_rx_timestamp_dynfield(m) &
> > > > > +                               ts_mask);
> > > > > +
> > > > >                         ev = &buf->events[new_tail];
> > > > >
> > > > >                         rss = do_rss ? rxa_do_softrss(m,
> > > > > rx_adapter->rss_key_be) @@ -2256,6 +2283,14 @@
> > > > rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
> > > > >         event_eth_rx_adapter[id] = rx_adapter;
> > > > >         if (conf_cb == rxa_default_conf_cb)
> > > > >                 rx_adapter->default_cb_arg = 1;
> > > > > +
> > > > > +       if (rte_mbuf_dyn_rx_timestamp_register(
> > > > > +                       &event_eth_rx_timestamp_dynfield_offset,
> > > > > +                       &event_eth_rx_timestamp_dynflag) != 0) {
> > > > > +               RTE_EDEV_LOG_ERR("Error registering timestamp
> > > > > + field in
> > > > mbuf\n");
> > > > > +               return -rte_errno;
> > > > > +       }
> > > > > +
> > > > >         rte_eventdev_trace_eth_rx_adapter_create(id, dev_id, conf_cb,
> > > > >                 conf_arg);
> > > > >         return 0;
> > > > > --
> > > > > 2.6.4
> > > > >

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

* Re: [dpdk-dev] [PATCH v2] eventdev: update rx timestamp in mbuf using mbuf dynamic field
  2021-09-16  9:15 ` Ganapati Kundapura
@ 2021-09-28 14:24   ` Jerin Jacob
  2021-09-28 15:47     ` Kundapura, Ganapati
  2021-09-28 16:38   ` [dpdk-dev] [PATCH v3] eventdev: add Rx " Ganapati Kundapura
  1 sibling, 1 reply; 13+ messages in thread
From: Jerin Jacob @ 2021-09-28 14:24 UTC (permalink / raw)
  To: Ganapati Kundapura; +Cc: Jayatheerthan, Jay, dpdk-dev, Ferruh Yigit

On Thu, Sep 16, 2021 at 2:45 PM Ganapati Kundapura
<ganapati.kundapura@intel.com> wrote:
>
> Add support to register timestamp dynamic field in mbuf.
>
> Update the timestamp in mbuf for each packet before enqueuing
> to event device if the timestamp is not already set.
>
> Adding the timestamp in Rx adapter avoids additional latency
> due to the event device.
>
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
>
> ---
> Depends-on: patch-97549(make Rx-adapter enqueue buffer as circular buffer)
>
> v2:
> * Removed rte_ prefix from the internal function
>
> v1:
> * Add support to register timestamp dynamic field in mbuf
> ---
> ---
>  lib/eventdev/rte_event_eth_rx_adapter.c | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
>
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
> index f2dc695..fd79b28 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> @@ -17,6 +17,7 @@
>  #include <rte_service_component.h>
>  #include <rte_thash.h>
>  #include <rte_interrupts.h>
> +#include <rte_mbuf_dyn.h>
>
>  #include "rte_eventdev.h"
>  #include "eventdev_pmd.h"
> @@ -240,6 +241,17 @@ struct eth_rx_queue_info {
>
>  static struct rte_event_eth_rx_adapter **event_eth_rx_adapter;
>
> +/* Enable dynamic timestamp field in mbuf */
> +uint64_t event_eth_rx_timestamp_dynflag;
> +int event_eth_rx_timestamp_dynfield_offset = -1;

# If the scope is only this file. Please make both as "static"
# Please fix the following check path and git log issue.


Wrong headline case:
                        "eventdev: update rx timestamp in mbuf using
mbuf dynamic field": rx --> Rx
Headline too long:
        eventdev: update rx timestamp in mbuf using mbuf dynamic field


Feel free to add my Acked-By in the next version.

> +
> +static inline rte_mbuf_timestamp_t *
> +rxa_timestamp_dynfield(struct rte_mbuf *mbuf)
> +{
> +       return RTE_MBUF_DYNFIELD(mbuf,
> +               event_eth_rx_timestamp_dynfield_offset, rte_mbuf_timestamp_t *);
> +}
> +
>  static inline int
>  rxa_validate_id(uint8_t id)
>  {
> @@ -890,8 +902,18 @@ rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
>         int do_rss;
>         uint16_t nb_cb;
>         uint16_t dropped;
> +       uint64_t ts, ts_mask;
>
>         if (!eth_rx_queue_info->ena_vector) {
> +               ts = m->ol_flags & event_eth_rx_timestamp_dynflag ?
> +                                               0 : rte_get_tsc_cycles();
> +
> +               /* 0xffff ffff ffff ffff if PKT_RX_TIMESTAMP is set,
> +                * otherwise 0
> +                */
> +               ts_mask = (uint64_t)(!(m->ol_flags &
> +                                      event_eth_rx_timestamp_dynflag)) - 1ULL;
> +
>                 /* 0xffff ffff if PKT_RX_RSS_HASH is set, otherwise 0 */
>                 rss_mask = ~(((m->ol_flags & PKT_RX_RSS_HASH) != 0) - 1);
>                 do_rss = !rss_mask && !eth_rx_queue_info->flow_id_mask;
> @@ -899,6 +921,9 @@ rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
>                         struct rte_event *ev;
>
>                         m = mbufs[i];
> +                       *rxa_timestamp_dynfield(m) = ts |
> +                                       (*rxa_timestamp_dynfield(m) & ts_mask);
> +
>                         ev = &buf->events[new_tail];
>
>                         rss = do_rss ? rxa_do_softrss(m, rx_adapter->rss_key_be)
> @@ -2238,6 +2263,14 @@ rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
>         event_eth_rx_adapter[id] = rx_adapter;
>         if (conf_cb == rxa_default_conf_cb)
>                 rx_adapter->default_cb_arg = 1;
> +
> +       if (rte_mbuf_dyn_rx_timestamp_register(
> +                       &event_eth_rx_timestamp_dynfield_offset,
> +                       &event_eth_rx_timestamp_dynflag) != 0) {
> +               RTE_EDEV_LOG_ERR("Error registering timestamp field in mbuf\n");
> +               return -rte_errno;
> +       }
> +
>         rte_eventdev_trace_eth_rx_adapter_create(id, dev_id, conf_cb,
>                 conf_arg);
>         return 0;
> --
> 2.6.4
>

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

* Re: [dpdk-dev] [PATCH v2] eventdev: update rx timestamp in mbuf using mbuf dynamic field
  2021-09-28 14:24   ` Jerin Jacob
@ 2021-09-28 15:47     ` Kundapura, Ganapati
  0 siblings, 0 replies; 13+ messages in thread
From: Kundapura, Ganapati @ 2021-09-28 15:47 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: Jayatheerthan, Jay, dpdk-dev, Yigit, Ferruh

Hi Jerin,

> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: 28 September 2021 19:55
> To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> <dev@dpdk.org>; Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: Re: [PATCH v2] eventdev: update rx timestamp in mbuf using mbuf
> dynamic field
> 
> On Thu, Sep 16, 2021 at 2:45 PM Ganapati Kundapura
> <ganapati.kundapura@intel.com> wrote:
> >
> > Add support to register timestamp dynamic field in mbuf.
> >
> > Update the timestamp in mbuf for each packet before enqueuing to event
> > device if the timestamp is not already set.
> >
> > Adding the timestamp in Rx adapter avoids additional latency due to
> > the event device.
> >
> > Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> >
> > ---
> > Depends-on: patch-97549(make Rx-adapter enqueue buffer as circular
> > buffer)
> >
> > v2:
> > * Removed rte_ prefix from the internal function
> >
> > v1:
> > * Add support to register timestamp dynamic field in mbuf
> > ---
> > ---
> >  lib/eventdev/rte_event_eth_rx_adapter.c | 33
> > +++++++++++++++++++++++++++++++++
> >  1 file changed, 33 insertions(+)
> >
> > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c
> > b/lib/eventdev/rte_event_eth_rx_adapter.c
> > index f2dc695..fd79b28 100644
> > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > @@ -17,6 +17,7 @@
> >  #include <rte_service_component.h>
> >  #include <rte_thash.h>
> >  #include <rte_interrupts.h>
> > +#include <rte_mbuf_dyn.h>
> >
> >  #include "rte_eventdev.h"
> >  #include "eventdev_pmd.h"
> > @@ -240,6 +241,17 @@ struct eth_rx_queue_info {
> >
> >  static struct rte_event_eth_rx_adapter **event_eth_rx_adapter;
> >
> > +/* Enable dynamic timestamp field in mbuf */ uint64_t
> > +event_eth_rx_timestamp_dynflag; int
> > +event_eth_rx_timestamp_dynfield_offset = -1;
> 
> # If the scope is only this file. Please make both as "static"
> # Please fix the following check path and git log issue.
> 
Updated timestamp variables to static

> 
> Wrong headline case:
>                         "eventdev: update rx timestamp in mbuf using mbuf dynamic
> field": rx --> Rx Headline too long:
>         eventdev: update rx timestamp in mbuf using mbuf dynamic field
> 
/workspace/sw/gkundap/LINUX/linux/scripts $ ./checkpatch.pl --version
Usage: ./checkpatch.pl [OPTION]... [FILE]...
Version: 0.32

/workspace/sw/gkundap/dpdk-upstream/dpdk-next-eventdev $ ./devtools/checkpatches.sh v3-0001-eventdev-update-Rx-timestamp-in-mbuf-using-mbuf-d.patch

1/1 valid patch
/workspace/sw/gkundap/dpdk-upstream/dpdk-next-eventdev $

/workspace/sw/gkundap/dpdk-upstream/dpdk-next-eventdev $ ./devtools/check-git-log.sh v3-0001-eventdev-update-Rx-timestamp-in-mbuf-using-mbuf-d.patch

1/1 valid patch
/workspace/sw/gkundap/dpdk-upstream/dpdk-next-eventdev $

> 
> Feel free to add my Acked-By in the next version.
Added in v3
> 
> > +
> > +static inline rte_mbuf_timestamp_t *
> > +rxa_timestamp_dynfield(struct rte_mbuf *mbuf) {
> > +       return RTE_MBUF_DYNFIELD(mbuf,
> > +               event_eth_rx_timestamp_dynfield_offset,
> > +rte_mbuf_timestamp_t *); }
> > +
> >  static inline int
> >  rxa_validate_id(uint8_t id)
> >  {
> > @@ -890,8 +902,18 @@ rxa_buffer_mbufs(struct
> rte_event_eth_rx_adapter *rx_adapter,
> >         int do_rss;
> >         uint16_t nb_cb;
> >         uint16_t dropped;
> > +       uint64_t ts, ts_mask;
> >
> >         if (!eth_rx_queue_info->ena_vector) {
> > +               ts = m->ol_flags & event_eth_rx_timestamp_dynflag ?
> > +                                               0 :
> > + rte_get_tsc_cycles();
> > +
> > +               /* 0xffff ffff ffff ffff if PKT_RX_TIMESTAMP is set,
> > +                * otherwise 0
> > +                */
> > +               ts_mask = (uint64_t)(!(m->ol_flags &
> > +
> > + event_eth_rx_timestamp_dynflag)) - 1ULL;
> > +
> >                 /* 0xffff ffff if PKT_RX_RSS_HASH is set, otherwise 0 */
> >                 rss_mask = ~(((m->ol_flags & PKT_RX_RSS_HASH) != 0) - 1);
> >                 do_rss = !rss_mask &&
> > !eth_rx_queue_info->flow_id_mask; @@ -899,6 +921,9 @@
> rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
> >                         struct rte_event *ev;
> >
> >                         m = mbufs[i];
> > +                       *rxa_timestamp_dynfield(m) = ts |
> > +                                       (*rxa_timestamp_dynfield(m) &
> > + ts_mask);
> > +
> >                         ev = &buf->events[new_tail];
> >
> >                         rss = do_rss ? rxa_do_softrss(m,
> > rx_adapter->rss_key_be) @@ -2238,6 +2263,14 @@
> rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
> >         event_eth_rx_adapter[id] = rx_adapter;
> >         if (conf_cb == rxa_default_conf_cb)
> >                 rx_adapter->default_cb_arg = 1;
> > +
> > +       if (rte_mbuf_dyn_rx_timestamp_register(
> > +                       &event_eth_rx_timestamp_dynfield_offset,
> > +                       &event_eth_rx_timestamp_dynflag) != 0) {
> > +               RTE_EDEV_LOG_ERR("Error registering timestamp field in
> mbuf\n");
> > +               return -rte_errno;
> > +       }
> > +
> >         rte_eventdev_trace_eth_rx_adapter_create(id, dev_id, conf_cb,
> >                 conf_arg);
> >         return 0;
> > --
> > 2.6.4
> >

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

* [dpdk-dev] [PATCH v3] eventdev: add Rx timestamp in mbuf using mbuf dynamic field
  2021-09-16  9:15 ` Ganapati Kundapura
  2021-09-28 14:24   ` Jerin Jacob
@ 2021-09-28 16:38   ` Ganapati Kundapura
  2021-09-29  5:51     ` Jerin Jacob
  1 sibling, 1 reply; 13+ messages in thread
From: Ganapati Kundapura @ 2021-09-28 16:38 UTC (permalink / raw)
  To: jerinjacobk, dev; +Cc: jay.jayatheerthan, Jerin Jacob

Add support to register timestamp dynamic field in mbuf.

Update the timestamp in mbuf for each packet before enqueuing
to event device if the timestamp is not already set.

Adding the timestamp in Rx adapter avoids additional latency
due to the event device.

Acked-by: Jerin Jacob <jerinj@marvell.com>

Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>

---
Depends-on: patch-97549(make Rx-adapter enqueue buffer as circular buffer)

v3:
* updated timestamp variables to static
* corrected wrong headline case: rx --> Rx
* corrected headline too long git log issue

v2:
* Removed rte_ prefix from the internal function

v1:
* Add support to register timestamp dynamic field in mbuf
---

diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index f2dc695..e7595b2 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -17,6 +17,7 @@
 #include <rte_service_component.h>
 #include <rte_thash.h>
 #include <rte_interrupts.h>
+#include <rte_mbuf_dyn.h>
 
 #include "rte_eventdev.h"
 #include "eventdev_pmd.h"
@@ -240,6 +241,17 @@ struct eth_rx_queue_info {
 
 static struct rte_event_eth_rx_adapter **event_eth_rx_adapter;
 
+/* Enable dynamic timestamp field in mbuf */
+static uint64_t event_eth_rx_timestamp_dynflag;
+static int event_eth_rx_timestamp_dynfield_offset = -1;
+
+static inline rte_mbuf_timestamp_t *
+rxa_timestamp_dynfield(struct rte_mbuf *mbuf)
+{
+	return RTE_MBUF_DYNFIELD(mbuf,
+		event_eth_rx_timestamp_dynfield_offset, rte_mbuf_timestamp_t *);
+}
+
 static inline int
 rxa_validate_id(uint8_t id)
 {
@@ -890,8 +902,18 @@ rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
 	int do_rss;
 	uint16_t nb_cb;
 	uint16_t dropped;
+	uint64_t ts, ts_mask;
 
 	if (!eth_rx_queue_info->ena_vector) {
+		ts = m->ol_flags & event_eth_rx_timestamp_dynflag ?
+						0 : rte_get_tsc_cycles();
+
+		/* 0xffff ffff ffff ffff if PKT_RX_TIMESTAMP is set,
+		 * otherwise 0
+		 */
+		ts_mask = (uint64_t)(!(m->ol_flags &
+				       event_eth_rx_timestamp_dynflag)) - 1ULL;
+
 		/* 0xffff ffff if PKT_RX_RSS_HASH is set, otherwise 0 */
 		rss_mask = ~(((m->ol_flags & PKT_RX_RSS_HASH) != 0) - 1);
 		do_rss = !rss_mask && !eth_rx_queue_info->flow_id_mask;
@@ -899,6 +921,9 @@ rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
 			struct rte_event *ev;
 
 			m = mbufs[i];
+			*rxa_timestamp_dynfield(m) = ts |
+					(*rxa_timestamp_dynfield(m) & ts_mask);
+
 			ev = &buf->events[new_tail];
 
 			rss = do_rss ? rxa_do_softrss(m, rx_adapter->rss_key_be)
@@ -2238,6 +2263,14 @@ rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
 	event_eth_rx_adapter[id] = rx_adapter;
 	if (conf_cb == rxa_default_conf_cb)
 		rx_adapter->default_cb_arg = 1;
+
+	if (rte_mbuf_dyn_rx_timestamp_register(
+			&event_eth_rx_timestamp_dynfield_offset,
+			&event_eth_rx_timestamp_dynflag) != 0) {
+		RTE_EDEV_LOG_ERR("Error registering timestamp field in mbuf\n");
+		return -rte_errno;
+	}
+
 	rte_eventdev_trace_eth_rx_adapter_create(id, dev_id, conf_cb,
 		conf_arg);
 	return 0;
-- 
2.6.4


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

* Re: [dpdk-dev] [PATCH v3] eventdev: add Rx timestamp in mbuf using mbuf dynamic field
  2021-09-28 16:38   ` [dpdk-dev] [PATCH v3] eventdev: add Rx " Ganapati Kundapura
@ 2021-09-29  5:51     ` Jerin Jacob
  0 siblings, 0 replies; 13+ messages in thread
From: Jerin Jacob @ 2021-09-29  5:51 UTC (permalink / raw)
  To: Ganapati Kundapura; +Cc: dpdk-dev, Jayatheerthan, Jay, Jerin Jacob

On Tue, Sep 28, 2021 at 10:09 PM Ganapati Kundapura
<ganapati.kundapura@intel.com> wrote:
>
> Add support to register timestamp dynamic field in mbuf.
>
> Update the timestamp in mbuf for each packet before enqueuing
> to event device if the timestamp is not already set.
>
> Adding the timestamp in Rx adapter avoids additional latency
> due to the event device.
>
> Acked-by: Jerin Jacob <jerinj@marvell.com>
>
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>


Changed the subject as eventdev/rx_adapter: use Rx timestamp as
dynamic mbuf field

Applied to dpdk-next-net-eventdev/for-main. Thanks



>
> ---
> Depends-on: patch-97549(make Rx-adapter enqueue buffer as circular buffer)
>
> v3:
> * updated timestamp variables to static
> * corrected wrong headline case: rx --> Rx
> * corrected headline too long git log issue
>
> v2:
> * Removed rte_ prefix from the internal function
>
> v1:
> * Add support to register timestamp dynamic field in mbuf
> ---
>
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
> index f2dc695..e7595b2 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> @@ -17,6 +17,7 @@
>  #include <rte_service_component.h>
>  #include <rte_thash.h>
>  #include <rte_interrupts.h>
> +#include <rte_mbuf_dyn.h>
>
>  #include "rte_eventdev.h"
>  #include "eventdev_pmd.h"
> @@ -240,6 +241,17 @@ struct eth_rx_queue_info {
>
>  static struct rte_event_eth_rx_adapter **event_eth_rx_adapter;
>
> +/* Enable dynamic timestamp field in mbuf */
> +static uint64_t event_eth_rx_timestamp_dynflag;
> +static int event_eth_rx_timestamp_dynfield_offset = -1;
> +
> +static inline rte_mbuf_timestamp_t *
> +rxa_timestamp_dynfield(struct rte_mbuf *mbuf)
> +{
> +       return RTE_MBUF_DYNFIELD(mbuf,
> +               event_eth_rx_timestamp_dynfield_offset, rte_mbuf_timestamp_t *);
> +}
> +
>  static inline int
>  rxa_validate_id(uint8_t id)
>  {
> @@ -890,8 +902,18 @@ rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
>         int do_rss;
>         uint16_t nb_cb;
>         uint16_t dropped;
> +       uint64_t ts, ts_mask;
>
>         if (!eth_rx_queue_info->ena_vector) {
> +               ts = m->ol_flags & event_eth_rx_timestamp_dynflag ?
> +                                               0 : rte_get_tsc_cycles();
> +
> +               /* 0xffff ffff ffff ffff if PKT_RX_TIMESTAMP is set,
> +                * otherwise 0
> +                */
> +               ts_mask = (uint64_t)(!(m->ol_flags &
> +                                      event_eth_rx_timestamp_dynflag)) - 1ULL;
> +
>                 /* 0xffff ffff if PKT_RX_RSS_HASH is set, otherwise 0 */
>                 rss_mask = ~(((m->ol_flags & PKT_RX_RSS_HASH) != 0) - 1);
>                 do_rss = !rss_mask && !eth_rx_queue_info->flow_id_mask;
> @@ -899,6 +921,9 @@ rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
>                         struct rte_event *ev;
>
>                         m = mbufs[i];
> +                       *rxa_timestamp_dynfield(m) = ts |
> +                                       (*rxa_timestamp_dynfield(m) & ts_mask);
> +
>                         ev = &buf->events[new_tail];
>
>                         rss = do_rss ? rxa_do_softrss(m, rx_adapter->rss_key_be)
> @@ -2238,6 +2263,14 @@ rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
>         event_eth_rx_adapter[id] = rx_adapter;
>         if (conf_cb == rxa_default_conf_cb)
>                 rx_adapter->default_cb_arg = 1;
> +
> +       if (rte_mbuf_dyn_rx_timestamp_register(
> +                       &event_eth_rx_timestamp_dynfield_offset,
> +                       &event_eth_rx_timestamp_dynflag) != 0) {
> +               RTE_EDEV_LOG_ERR("Error registering timestamp field in mbuf\n");
> +               return -rte_errno;
> +       }
> +
>         rte_eventdev_trace_eth_rx_adapter_create(id, dev_id, conf_cb,
>                 conf_arg);
>         return 0;
> --
> 2.6.4
>

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

end of thread, other threads:[~2021-09-29  5:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14  7:14 [dpdk-dev] [PATCH v1] eventdev: update rx timestamp in mbuf using mbuf dynamic field Ganapati Kundapura
2021-09-16  4:50 ` Jerin Jacob
2021-09-16  8:33   ` Kundapura, Ganapati
2021-09-16  8:37     ` Jerin Jacob
2021-09-16  9:11       ` Kundapura, Ganapati
2021-09-16  9:23         ` Jerin Jacob
2021-09-16  7:21 ` [dpdk-dev] [PATCH v2] " Ganapati Kundapura
2021-09-16  7:37   ` Jayatheerthan, Jay
2021-09-16  9:15 ` Ganapati Kundapura
2021-09-28 14:24   ` Jerin Jacob
2021-09-28 15:47     ` Kundapura, Ganapati
2021-09-28 16:38   ` [dpdk-dev] [PATCH v3] eventdev: add Rx " Ganapati Kundapura
2021-09-29  5:51     ` Jerin Jacob

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