[v2,15/16] net/pfe: reduce driver initialization time

Message ID 20211227161645.24359-16-nipun.gupta@nxp.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series features and fixes on NXP eth devices |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Nipun Gupta Dec. 27, 2021, 4:16 p.m. UTC
  From: Gagandeep Singh <g.singh@nxp.com>

This patch reduces the delay in the device init.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/net/pfe/pfe_hif.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Stephen Hemminger Dec. 27, 2021, 5:57 p.m. UTC | #1
On Mon, 27 Dec 2021 21:46:44 +0530
nipun.gupta@nxp.com wrote:

> From: Gagandeep Singh <g.singh@nxp.com>
> 
> This patch reduces the delay in the device init.
> 
> Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> ---
>  drivers/net/pfe/pfe_hif.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/pfe/pfe_hif.c b/drivers/net/pfe/pfe_hif.c
> index c4a7154ba7..eade726b2e 100644
> --- a/drivers/net/pfe/pfe_hif.c
> +++ b/drivers/net/pfe/pfe_hif.c
> @@ -1,5 +1,5 @@
>  /* SPDX-License-Identifier: BSD-3-Clause
> - * Copyright 2018-2019 NXP
> + * Copyright 2018-2020 NXP
>   */
>  
>  #include "pfe_logs.h"
> @@ -9,6 +9,8 @@
>  #include <sys/eventfd.h>
>  #include <arpa/inet.h>
>  
> +#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
> +#define msleep(x) rte_delay_us(1000 * (x))
>  static int
>  pfe_hif_alloc_descr(struct pfe_hif *hif)
>  {
> @@ -766,7 +768,7 @@ pfe_hif_rx_idle(struct pfe_hif *hif)
>  		if (rx_status & BDP_CSR_RX_DMA_ACTV)
>  			send_dummy_pkt_to_hif();
>  
> -		sleep(1);
> +		msleep(DIV_ROUND_UP(100, 1000));

Why not just
	rte_delay_ms(1);
  
Nipun Gupta Jan. 3, 2022, 5:45 a.m. UTC | #2
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: 27 December 2021 23:28
> To: Nipun Gupta <nipun.gupta@nxp.com>
> Cc: dev@dpdk.org; thomas@monjalon.net; ferruh.yigit@intel.com; Hemant
> Agrawal <hemant.agrawal@nxp.com>; Gagandeep Singh <G.Singh@nxp.com>
> Subject: Re: [PATCH v2 15/16] net/pfe: reduce driver initialization time
> 
> On Mon, 27 Dec 2021 21:46:44 +0530
> nipun.gupta@nxp.com wrote:
> 
> > From: Gagandeep Singh <g.singh@nxp.com>
> >
> > This patch reduces the delay in the device init.
> >
> > Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> > ---
> >  drivers/net/pfe/pfe_hif.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/pfe/pfe_hif.c b/drivers/net/pfe/pfe_hif.c
> > index c4a7154ba7..eade726b2e 100644
> > --- a/drivers/net/pfe/pfe_hif.c
> > +++ b/drivers/net/pfe/pfe_hif.c
> > @@ -1,5 +1,5 @@
> >  /* SPDX-License-Identifier: BSD-3-Clause
> > - * Copyright 2018-2019 NXP
> > + * Copyright 2018-2020 NXP
> >   */
> >
> >  #include "pfe_logs.h"
> > @@ -9,6 +9,8 @@
> >  #include <sys/eventfd.h>
> >  #include <arpa/inet.h>
> >
> > +#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
> > +#define msleep(x) rte_delay_us(1000 * (x))
> >  static int
> >  pfe_hif_alloc_descr(struct pfe_hif *hif)
> >  {
> > @@ -766,7 +768,7 @@ pfe_hif_rx_idle(struct pfe_hif *hif)
> >  		if (rx_status & BDP_CSR_RX_DMA_ACTV)
> >  			send_dummy_pkt_to_hif();
> >
> > -		sleep(1);
> > +		msleep(DIV_ROUND_UP(100, 1000));
> 
> Why not just
> 	rte_delay_ms(1);

Will update.
  

Patch

diff --git a/drivers/net/pfe/pfe_hif.c b/drivers/net/pfe/pfe_hif.c
index c4a7154ba7..eade726b2e 100644
--- a/drivers/net/pfe/pfe_hif.c
+++ b/drivers/net/pfe/pfe_hif.c
@@ -1,5 +1,5 @@ 
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018-2019 NXP
+ * Copyright 2018-2020 NXP
  */
 
 #include "pfe_logs.h"
@@ -9,6 +9,8 @@ 
 #include <sys/eventfd.h>
 #include <arpa/inet.h>
 
+#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+#define msleep(x) rte_delay_us(1000 * (x))
 static int
 pfe_hif_alloc_descr(struct pfe_hif *hif)
 {
@@ -766,7 +768,7 @@  pfe_hif_rx_idle(struct pfe_hif *hif)
 		if (rx_status & BDP_CSR_RX_DMA_ACTV)
 			send_dummy_pkt_to_hif();
 
-		sleep(1);
+		msleep(DIV_ROUND_UP(100, 1000));
 	} while (--hif_stop_loop);
 
 	if (readl(HIF_RX_STATUS) & BDP_CSR_RX_DMA_ACTV)