patches for DPDK stable branches
 help / color / mirror / Atom feed
From: "Zhang, Qi Z" <qi.z.zhang@intel.com>
To: "Qiao, Wenjing" <wenjing.qiao@intel.com>,
	"Wu, Jingjing" <jingjing.wu@intel.com>,
	"Xing, Beilei" <beilei.xing@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "stable@dpdk.org" <stable@dpdk.org>
Subject: RE: [PATCH v2 2/7] net/idpf: save main time by alarm
Date: Fri, 28 Apr 2023 02:46:35 +0000	[thread overview]
Message-ID: <DM4PR11MB59942961BAC5CA55989DB950D76B9@DM4PR11MB5994.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230421071603.55680-3-wenjing.qiao@intel.com>



> -----Original Message-----
> From: Qiao, Wenjing <wenjing.qiao@intel.com>
> Sent: Friday, April 21, 2023 3:16 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Qiao, Wenjing <wenjing.qiao@intel.com>;
> stable@dpdk.org
> Subject: [PATCH v2 2/7] net/idpf: save main time by alarm
> 
> Using alarm to save main time from registers every 1 second.
> 
> Fixes: 8c6098afa075 ("common/idpf: add Rx/Tx data path")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wenjing Qiao <wenjing.qiao@intel.com>
> ---
>  drivers/net/idpf/idpf_ethdev.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
> index e02ec2ec5a..3f33ffbc78 100644
> --- a/drivers/net/idpf/idpf_ethdev.c
> +++ b/drivers/net/idpf/idpf_ethdev.c
> @@ -761,6 +761,12 @@ idpf_dev_start(struct rte_eth_dev *dev)
>  		goto err_vec;
>  	}
> 
> +	if (dev->data->dev_conf.rxmode.offloads &
> RTE_ETH_RX_OFFLOAD_TIMESTAMP) {
> +		rte_eal_alarm_set(1000 * 1000,

Please use a macro for easy read.

> +				  &idpf_dev_read_time_hw,
> +				  (void *)base);

It seems that the alarm logic in the driver/idpf is being continued in common/idpf, which can make the code messy. It would be better to wrap this as internal logic and expose API like "idpf_rx_timestamp_start/stop" in common/idpf for better organization and maintainability.

> +	}
> +
>  	ret = idpf_vc_vectors_alloc(vport, req_vecs_num);
>  	if (ret != 0) {
>  		PMD_DRV_LOG(ERR, "Failed to allocate interrupt vectors");
> @@ -810,6 +816,7 @@ static int  idpf_dev_stop(struct rte_eth_dev *dev)  {
>  	struct idpf_vport *vport = dev->data->dev_private;
> +	struct idpf_adapter *base = vport->adapter;
> 
>  	if (vport->stopped == 1)
>  		return 0;
> @@ -822,6 +829,11 @@ idpf_dev_stop(struct rte_eth_dev *dev)
> 
>  	idpf_vc_vectors_dealloc(vport);
> 
> +	if (dev->data->dev_conf.rxmode.offloads &
> RTE_ETH_RX_OFFLOAD_TIMESTAMP) {
> +		rte_eal_alarm_cancel(idpf_dev_read_time_hw,
> +				     base);
> +	}
> +
>  	vport->stopped = 1;
> 
>  	return 0;
> --
> 2.25.1


  reply	other threads:[~2023-04-28  2:46 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230420091935.43116-1-wenjing.qiao@intel.com>
2023-04-20  9:19 ` [PATCH 1/7] common/idpf: fix 64b timestamp roll over issue Wenjing Qiao
     [not found]   ` <20230421071603.55680-1-wenjing.qiao@intel.com>
2023-04-21  7:15     ` [PATCH v2 " Wenjing Qiao
     [not found]       ` <20230424091707.488045-1-wenjing.qiao@intel.com>
2023-04-24  9:17         ` [PATCH v3 " Wenjing Qiao
     [not found]           ` <20230519083110.809913-1-wenjing.qiao@intel.com>
2023-05-19  8:31             ` [PATCH v4 " Wenjing Qiao
2023-05-24  8:36               ` Liu, Mingxia
2023-05-19  8:31             ` [PATCH v4 2/7] net/idpf: save main time by alarm Wenjing Qiao
2023-05-19  8:31             ` [PATCH v4 3/7] net/cpfl: " Wenjing Qiao
2023-05-19  8:31             ` [PATCH v4 4/7] common/idpf: enhance timestamp offload feature for ACC Wenjing Qiao
2023-05-19  8:31             ` [PATCH v4 5/7] common/idpf: add timestamp enable flag for rxq Wenjing Qiao
2023-05-19  8:31             ` [PATCH v4 6/7] net/cpfl: adjust timestamp mbuf register Wenjing Qiao
2023-05-19  8:31             ` [PATCH v4 7/7] net/idpf: " Wenjing Qiao
2023-04-24  9:17         ` [PATCH v3 2/7] net/idpf: save main time by alarm Wenjing Qiao
2023-04-24  9:17         ` [PATCH v3 3/7] net/cpfl: " Wenjing Qiao
2023-04-24  9:17         ` [PATCH v3 4/7] common/idpf: enhance timestamp offload feature for ACC Wenjing Qiao
2023-04-24  9:17         ` [PATCH v3 5/7] common/idpf: add timestamp enable flag for rxq Wenjing Qiao
2023-04-24  9:17         ` [PATCH v3 6/7] net/cpfl: register timestamp mbuf when starting dev Wenjing Qiao
2023-04-28  3:24           ` Zhang, Qi Z
2023-04-24  9:17         ` [PATCH v3 7/7] net/idpf: " Wenjing Qiao
2023-04-21  7:15     ` [PATCH v2 2/7] net/idpf: save main time by alarm Wenjing Qiao
2023-04-28  2:46       ` Zhang, Qi Z [this message]
2023-04-21  7:15     ` [PATCH v2 3/7] net/cpfl: " Wenjing Qiao
2023-04-21  7:16     ` [PATCH v2 5/7] common/idpf: add timestamp enable flag for rxq Wenjing Qiao
2023-04-21  7:16     ` [PATCH v2 6/7] net/cpfl: register timestamp mbuf when starting dev Wenjing Qiao
2023-04-21  7:16     ` [PATCH v2 7/7] net/idpf: " Wenjing Qiao
2023-04-20  9:19 ` [PATCH 2/7] net/idpf: save master time by alarm Wenjing Qiao
2023-04-20  9:19 ` [PATCH 3/7] net/cpfl: " Wenjing Qiao
2023-04-20  9:19 ` [PATCH 5/7] common/idpf: add timestamp enable flag for rxq Wenjing Qiao
2023-04-20  9:19 ` [PATCH 6/7] net/cpfl: register timestamp mbuf when starting dev Wenjing Qiao
2023-04-20  9:19 ` [PATCH 7/7] net/idpf: " Wenjing Qiao

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=DM4PR11MB59942961BAC5CA55989DB950D76B9@DM4PR11MB5994.namprd11.prod.outlook.com \
    --to=qi.z.zhang@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=stable@dpdk.org \
    --cc=wenjing.qiao@intel.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).