DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Jayatheerthan, Jay" <jay.jayatheerthan@intel.com>
To: "Kundapura, Ganapati" <ganapati.kundapura@intel.com>,
	"jerinjacobk@gmail.com" <jerinjacobk@gmail.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "Yigit, Ferruh" <ferruh.yigit@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2] eventdev: update rx timestamp in mbuf using mbuf dynamic field
Date: Thu, 16 Sep 2021 07:37:23 +0000	[thread overview]
Message-ID: <SN6PR11MB3117C8F43BE26017A310E43AFDDC9@SN6PR11MB3117.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210916072143.1475159-1-ganapati.kundapura@intel.com>

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


  reply	other threads:[~2021-09-16  7:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-14  7:14 [dpdk-dev] [PATCH v1] " 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 [this message]
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

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=SN6PR11MB3117C8F43BE26017A310E43AFDDC9@SN6PR11MB3117.namprd11.prod.outlook.com \
    --to=jay.jayatheerthan@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=ganapati.kundapura@intel.com \
    --cc=jerinjacobk@gmail.com \
    /path/to/YOUR_REPLY

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

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