All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] net/i40e: Improved FDIR programming times
@ 2017-05-16 22:01 Michael Lilja
  2017-05-17  2:22 ` Xing, Beilei
  2017-05-17  9:12 ` [PATCH v4] net/i40e: improved " Michael Lilja
  0 siblings, 2 replies; 20+ messages in thread
From: Michael Lilja @ 2017-05-16 22:01 UTC (permalink / raw)
  To: dev; +Cc: Michael Lilja

Previously, the FDIR programming time is +11ms on i40e.
This patch will result in an average programming time of
22usec with a max of 60usec .

Signed-off-by: Michael Lilja <ml@napatech.com>

---
v3:
* Code style fix
---
 drivers/net/i40e/i40e_fdir.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 28cc554f5..2162443f5 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1296,23 +1296,28 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
        rte_wmb();
        I40E_PCI_REG_WRITE(txq->qtx_tail, txq->tx_tail);

-       for (i = 0; i < I40E_FDIR_WAIT_COUNT; i++) {
-               rte_delay_us(I40E_FDIR_WAIT_INTERVAL_US);
+       for (i = 0; i < (I40E_FDIR_WAIT_COUNT * I40E_FDIR_WAIT_INTERVAL_US); i++) {
                if ((txdp->cmd_type_offset_bsz &
-                               rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
-                               rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
+                       rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
+                       rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
                        break;
+               rte_delay_us(1);
        }
-       if (i >= I40E_FDIR_WAIT_COUNT) {
+       if (i >= (I40E_FDIR_WAIT_COUNT * I40E_FDIR_WAIT_INTERVAL_US)) {
                PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
-                           " time out to get DD on tx queue.");
+                       " time out to get DD on tx queue.");
                return -ETIMEDOUT;
        }
        /* totally delay 10 ms to check programming status*/
-       rte_delay_us((I40E_FDIR_WAIT_COUNT - i) * I40E_FDIR_WAIT_INTERVAL_US);
+       for (i = 0; i < (I40E_FDIR_WAIT_COUNT * I40E_FDIR_WAIT_INTERVAL_US); i++) {
+               if (i40e_check_fdir_programming_status(rxq) >= 0) {
+                       break;
+               }
+               rte_delay_us(1);
+       }
        if (i40e_check_fdir_programming_status(rxq) < 0) {
                PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
-                           " programming status reported.");
+                               " programming status reported.");
                return -ENOSYS;
        }

--
2.12.2

Disclaimer: This email and any files transmitted with it may contain confidential information intended for the addressee(s) only. The information is not to be surrendered or copied to unauthorized persons. If you have received this communication in error, please notify the sender immediately and delete this e-mail from your system.

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

* Re: [PATCH v3] net/i40e: Improved FDIR programming times
  2017-05-16 22:01 [PATCH v3] net/i40e: Improved FDIR programming times Michael Lilja
@ 2017-05-17  2:22 ` Xing, Beilei
  2017-05-17  8:44   ` Ferruh Yigit
  2017-05-17  9:12 ` [PATCH v4] net/i40e: improved " Michael Lilja
  1 sibling, 1 reply; 20+ messages in thread
From: Xing, Beilei @ 2017-05-17  2:22 UTC (permalink / raw)
  To: Michael Lilja, dev

Hi,

Seems my comments in v2 are not addressed, add the comments here again.

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Michael Lilja
> Sent: Wednesday, May 17, 2017 6:02 AM
> To: dev@dpdk.org
> Cc: Michael Lilja <ml@napatech.com>
> Subject: [dpdk-dev] [PATCH v3] net/i40e: Improved FDIR programming times
> 
> Previously, the FDIR programming time is +11ms on i40e.
> This patch will result in an average programming time of 22usec with a max of
> 60usec .
> 
> Signed-off-by: Michael Lilja <ml@napatech.com>
> 
> ---
> v3:
> * Code style fix
> ---
>  drivers/net/i40e/i40e_fdir.c | 21 +++++++++++++--------
>  1 file changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index
> 28cc554f5..2162443f5 100644
> --- a/drivers/net/i40e/i40e_fdir.c
> +++ b/drivers/net/i40e/i40e_fdir.c
> @@ -1296,23 +1296,28 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
>         rte_wmb();
>         I40E_PCI_REG_WRITE(txq->qtx_tail, txq->tx_tail);
> 
> -       for (i = 0; i < I40E_FDIR_WAIT_COUNT; i++) {
> -               rte_delay_us(I40E_FDIR_WAIT_INTERVAL_US);
> +       for (i = 0; i < (I40E_FDIR_WAIT_COUNT *
> + I40E_FDIR_WAIT_INTERVAL_US); i++) {
>                 if ((txdp->cmd_type_offset_bsz &
> -
> rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
> -
> rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
> +
> rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
> +
> rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
>                         break;
> +               rte_delay_us(1);
>         }
> -       if (i >= I40E_FDIR_WAIT_COUNT) {
> +       if (i >= (I40E_FDIR_WAIT_COUNT * I40E_FDIR_WAIT_INTERVAL_US))
> {
>                 PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
> -                           " time out to get DD on tx queue.");
> +                       " time out to get DD on tx queue.");
>                 return -ETIMEDOUT;
>         }
>         /* totally delay 10 ms to check programming status*/
> -       rte_delay_us((I40E_FDIR_WAIT_COUNT - i) *
> I40E_FDIR_WAIT_INTERVAL_US);
> +       for (i = 0; i < (I40E_FDIR_WAIT_COUNT *
> I40E_FDIR_WAIT_INTERVAL_US); i++) {
> +               if (i40e_check_fdir_programming_status(rxq) >= 0) {
> +                       break;

Braces {} should be removed here according to the coding style.
Besides, I think we can return 0 here directly.

> +               }
> +               rte_delay_us(1);
> +       }
>         if (i40e_check_fdir_programming_status(rxq) < 0) {

This condition can be removed, just keep the following error log.

>                 PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
> -                           " programming status reported.");
> +                               " programming status reported.");
>                 return -ENOSYS;
>         }
> 
> --
> 2.12.2
> 
> Disclaimer: This email and any files transmitted with it may contain confidential
> information intended for the addressee(s) only. The information is not to be
> surrendered or copied to unauthorized persons. If you have received this
> communication in error, please notify the sender immediately and delete this
> e-mail from your system.

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

* Re: [PATCH v3] net/i40e: Improved FDIR programming times
  2017-05-17  2:22 ` Xing, Beilei
@ 2017-05-17  8:44   ` Ferruh Yigit
  0 siblings, 0 replies; 20+ messages in thread
From: Ferruh Yigit @ 2017-05-17  8:44 UTC (permalink / raw)
  To: Michael Lilja; +Cc: Xing, Beilei, dev

On 5/17/2017 3:22 AM, Xing, Beilei wrote:
> Hi,
> 
> Seems my comments in v2 are not addressed, add the comments here again.

Hi Michael,

And can you please use "--in-reply-to" option of the git send-email when
sending the new version of the patch.
To make new version of the patch in same mail thread, as a reply to
previous version.

Thanks,
ferruh

> 
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Michael Lilja
>> Sent: Wednesday, May 17, 2017 6:02 AM
>> To: dev@dpdk.org
>> Cc: Michael Lilja <ml@napatech.com>
>> Subject: [dpdk-dev] [PATCH v3] net/i40e: Improved FDIR programming times
>>
>> Previously, the FDIR programming time is +11ms on i40e.
>> This patch will result in an average programming time of 22usec with a max of
>> 60usec .
>>
>> Signed-off-by: Michael Lilja <ml@napatech.com>
<...>

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

* [PATCH v4] net/i40e: improved FDIR programming times
  2017-05-16 22:01 [PATCH v3] net/i40e: Improved FDIR programming times Michael Lilja
  2017-05-17  2:22 ` Xing, Beilei
@ 2017-05-17  9:12 ` Michael Lilja
  2017-05-17  9:39   ` Xing, Beilei
  2017-05-17 10:38   ` [PATCH v5] " Michael Lilja
  1 sibling, 2 replies; 20+ messages in thread
From: Michael Lilja @ 2017-05-17  9:12 UTC (permalink / raw)
  To: dev; +Cc: Michael Lilja

Previously, the FDIR programming time is +11ms on i40e.
This patch will result in an average programming time of
22usec with a max of 60usec .

Signed-off-by: Michael Lilja <ml@napatech.com>

---
v4:
* Code style fix
---
---
 drivers/net/i40e/i40e_fdir.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 28cc554f5..32f6aeafb 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1296,27 +1296,27 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
 	rte_wmb();
 	I40E_PCI_REG_WRITE(txq->qtx_tail, txq->tx_tail);
 
-	for (i = 0; i < I40E_FDIR_WAIT_COUNT; i++) {
-		rte_delay_us(I40E_FDIR_WAIT_INTERVAL_US);
+	for (i = 0; i < (I40E_FDIR_WAIT_COUNT * I40E_FDIR_WAIT_INTERVAL_US); i++) {
 		if ((txdp->cmd_type_offset_bsz &
 				rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
 				rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
 			break;
+		rte_delay_us(1);
 	}
-	if (i >= I40E_FDIR_WAIT_COUNT) {
+	if (i >= (I40E_FDIR_WAIT_COUNT * I40E_FDIR_WAIT_INTERVAL_US)) {
 		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
 			    " time out to get DD on tx queue.");
 		return -ETIMEDOUT;
 	}
 	/* totally delay 10 ms to check programming status*/
-	rte_delay_us((I40E_FDIR_WAIT_COUNT - i) * I40E_FDIR_WAIT_INTERVAL_US);
-	if (i40e_check_fdir_programming_status(rxq) < 0) {
-		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
-			    " programming status reported.");
-		return -ENOSYS;
+	for (i = 0; i < (I40E_FDIR_WAIT_COUNT * I40E_FDIR_WAIT_INTERVAL_US); i++) {
+		if (i40e_check_fdir_programming_status(rxq) >= 0)
+			return 0;
+		rte_delay_us(1);
 	}
-
-	return 0;
+	PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
+		" programming status reported.");
+	return -ENOSYS;
 }
 
 /*
-- 
2.12.2

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

* Re: [PATCH v4] net/i40e: improved FDIR programming times
  2017-05-17  9:12 ` [PATCH v4] net/i40e: improved " Michael Lilja
@ 2017-05-17  9:39   ` Xing, Beilei
  2017-05-17 10:38   ` [PATCH v5] " Michael Lilja
  1 sibling, 0 replies; 20+ messages in thread
From: Xing, Beilei @ 2017-05-17  9:39 UTC (permalink / raw)
  To: Michael Lilja, dev

Hi Michael,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Michael Lilja
> Sent: Wednesday, May 17, 2017 5:12 PM
> To: dev@dpdk.org
> Cc: Michael Lilja <ml@napatech.com>
> Subject: [dpdk-dev] [PATCH v4] net/i40e: improved FDIR programming times
> 
> Previously, the FDIR programming time is +11ms on i40e.
> This patch will result in an average programming time of 22usec with a max of
> 60usec .
> 
> Signed-off-by: Michael Lilja <ml@napatech.com>
> 
> ---
> v4:
> * Code style fix
> ---
> ---
>  drivers/net/i40e/i40e_fdir.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index
> 28cc554f5..32f6aeafb 100644
> --- a/drivers/net/i40e/i40e_fdir.c
> +++ b/drivers/net/i40e/i40e_fdir.c
> @@ -1296,27 +1296,27 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
>  	rte_wmb();
>  	I40E_PCI_REG_WRITE(txq->qtx_tail, txq->tx_tail);
> 
> -	for (i = 0; i < I40E_FDIR_WAIT_COUNT; i++) {
> -		rte_delay_us(I40E_FDIR_WAIT_INTERVAL_US);
> +	for (i = 0; i < (I40E_FDIR_WAIT_COUNT *
> I40E_FDIR_WAIT_INTERVAL_US);
> +i++) {
>  		if ((txdp->cmd_type_offset_bsz &
> 
> 	rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
> 
> 	rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
>  			break;
> +		rte_delay_us(1);
>  	}
> -	if (i >= I40E_FDIR_WAIT_COUNT) {
> +	if (i >= (I40E_FDIR_WAIT_COUNT * I40E_FDIR_WAIT_INTERVAL_US))
> {
>  		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
>  			    " time out to get DD on tx queue.");
>  		return -ETIMEDOUT;
>  	}
>  	/* totally delay 10 ms to check programming status*/
> -	rte_delay_us((I40E_FDIR_WAIT_COUNT - i) *
> I40E_FDIR_WAIT_INTERVAL_US);
> -	if (i40e_check_fdir_programming_status(rxq) < 0) {
> -		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
> -			    " programming status reported.");
> -		return -ENOSYS;
> +	for (i = 0; i < (I40E_FDIR_WAIT_COUNT *
> I40E_FDIR_WAIT_INTERVAL_US); i++) {

To keep the original intention, "i" shouldn't be set to 0 again but keep above value.
Please refer to " rte_delay_us((I40E_FDIR_WAIT_COUNT - i) *> I40E_FDIR_WAIT_INTERVAL_US)".
Sorry for missing it before.

Overall it's OK for me, thanks.

Beilei

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

* [PATCH v5] net/i40e: improved FDIR programming times
  2017-05-17  9:12 ` [PATCH v4] net/i40e: improved " Michael Lilja
  2017-05-17  9:39   ` Xing, Beilei
@ 2017-05-17 10:38   ` Michael Lilja
  2017-05-17 10:43     ` Xing, Beilei
                       ` (4 more replies)
  1 sibling, 5 replies; 20+ messages in thread
From: Michael Lilja @ 2017-05-17 10:38 UTC (permalink / raw)
  To: dev; +Cc: Michael Lilja

Previously, the FDIR programming time is +11ms on i40e.
This patch will result in an average programming time of
22usec with a max of 60usec .

Signed-off-by: Michael Lilja <ml@napatech.com>

---
v5:
* Reinitialization of "i" inconsistent with original intent
---
---
 drivers/net/i40e/i40e_fdir.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 28cc554f5..85fd827e1 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1296,27 +1296,27 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
 	rte_wmb();
 	I40E_PCI_REG_WRITE(txq->qtx_tail, txq->tx_tail);
 
-	for (i = 0; i < I40E_FDIR_WAIT_COUNT; i++) {
-		rte_delay_us(I40E_FDIR_WAIT_INTERVAL_US);
+	for (i = 0; i < (I40E_FDIR_WAIT_COUNT * I40E_FDIR_WAIT_INTERVAL_US); i++) {
 		if ((txdp->cmd_type_offset_bsz &
 				rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
 				rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
 			break;
+		rte_delay_us(1);
 	}
-	if (i >= I40E_FDIR_WAIT_COUNT) {
+	if (i >= (I40E_FDIR_WAIT_COUNT * I40E_FDIR_WAIT_INTERVAL_US)) {
 		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
 			    " time out to get DD on tx queue.");
 		return -ETIMEDOUT;
 	}
 	/* totally delay 10 ms to check programming status*/
-	rte_delay_us((I40E_FDIR_WAIT_COUNT - i) * I40E_FDIR_WAIT_INTERVAL_US);
-	if (i40e_check_fdir_programming_status(rxq) < 0) {
-		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
-			    " programming status reported.");
-		return -ENOSYS;
+	for (; i < (I40E_FDIR_WAIT_COUNT * I40E_FDIR_WAIT_INTERVAL_US); i++) {
+		if (i40e_check_fdir_programming_status(rxq) >= 0)
+			return 0;
+		rte_delay_us(1);
 	}
-
-	return 0;
+	PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
+		" programming status reported.");
+	return -ENOSYS;
 }
 
 /*
-- 
2.12.2

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

* Re: [PATCH v5] net/i40e: improved FDIR programming times
  2017-05-17 10:38   ` [PATCH v5] " Michael Lilja
@ 2017-05-17 10:43     ` Xing, Beilei
  2017-05-17 11:21     ` Ferruh Yigit
                       ` (3 subsequent siblings)
  4 siblings, 0 replies; 20+ messages in thread
From: Xing, Beilei @ 2017-05-17 10:43 UTC (permalink / raw)
  To: Michael Lilja, dev

Hi,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Michael Lilja
> Sent: Wednesday, May 17, 2017 6:38 PM
> To: dev@dpdk.org
> Cc: Michael Lilja <ml@napatech.com>
> Subject: [dpdk-dev] [PATCH v5] net/i40e: improved FDIR programming times
> 
> Previously, the FDIR programming time is +11ms on i40e.
> This patch will result in an average programming time of 22usec with a max of
> 60usec .
> 
> Signed-off-by: Michael Lilja <ml@napatech.com>

Acked-by: Beilei Xing <beilei.xing@intel.com>

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

* Re: [PATCH v5] net/i40e: improved FDIR programming times
  2017-05-17 10:38   ` [PATCH v5] " Michael Lilja
  2017-05-17 10:43     ` Xing, Beilei
@ 2017-05-17 11:21     ` Ferruh Yigit
  2017-05-17 13:45     ` [PATCH v6] " Michael Lilja
                       ` (2 subsequent siblings)
  4 siblings, 0 replies; 20+ messages in thread
From: Ferruh Yigit @ 2017-05-17 11:21 UTC (permalink / raw)
  To: Michael Lilja, dev; +Cc: Beilei Xing, Jingjing Wu

On 5/17/2017 11:38 AM, Michael Lilja wrote:
> Previously, the FDIR programming time is +11ms on i40e.
> This patch will result in an average programming time of
> 22usec with a max of 60usec .
> 
> Signed-off-by: Michael Lilja <ml@napatech.com>

Please keeps maintainers in CC while sending patches.

> 
> ---
> v5:
> * Reinitialization of "i" inconsistent with original intent

It can be useful to keep history about older versions.

> ---

There are two checkpatch warnings, can you please fix them [1], you can
keep Beilei's ack in next version.

[1]
WARNING:LONG_LINE: line over 80 characters
#39: FILE: drivers/net/i40e/i40e_fdir.c:1299:
+       for (i = 0; i < (I40E_FDIR_WAIT_COUNT *
I40E_FDIR_WAIT_INTERVAL_US); i++) {

WARNING:ENOSYS: ENOSYS means 'invalid syscall nr' and nothing else
#67: FILE: drivers/net/i40e/i40e_fdir.c:1319:
+       return -ENOSYS;

<...>

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

* [PATCH v6] net/i40e: improved FDIR programming times
  2017-05-17 10:38   ` [PATCH v5] " Michael Lilja
  2017-05-17 10:43     ` Xing, Beilei
  2017-05-17 11:21     ` Ferruh Yigit
@ 2017-05-17 13:45     ` Michael Lilja
  2017-05-17 14:10       ` Ferruh Yigit
  2017-05-17 14:31     ` [PATCH v7] " Michael Lilja
  2017-05-17 14:57     ` [PATCH v8] " Michael Lilja
  4 siblings, 1 reply; 20+ messages in thread
From: Michael Lilja @ 2017-05-17 13:45 UTC (permalink / raw)
  To: dev; +Cc: Michael Lilja

Previously, the FDIR programming time is +11ms on i40e.
This patch will result in an average programming time of
22usec with a max of 60usec .

Signed-off-by: Michael Lilja <ml@napatech.com>

---
v6:
* Fixed code style issues

v5:
* Reinitialization of "i" inconsistent with original intent

v4:
* Code style fix

v3:
* Replaced commit message

v2:
*  Code style fix

v1:
* Initial version
---
---
 drivers/net/i40e/i40e_fdir.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 28cc554f5..16cb963ce 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1295,28 +1295,28 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
 	/* Update the tx tail register */
 	rte_wmb();
 	I40E_PCI_REG_WRITE(txq->qtx_tail, txq->tx_tail);
-
-	for (i = 0; i < I40E_FDIR_WAIT_COUNT; i++) {
-		rte_delay_us(I40E_FDIR_WAIT_INTERVAL_US);
+	i = 0;
+	for (; i < (I40E_FDIR_WAIT_COUNT * I40E_FDIR_WAIT_INTERVAL_US); i++) {
 		if ((txdp->cmd_type_offset_bsz &
-				rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
-				rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
+			rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
+			rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
 			break;
+		rte_delay_us(1);
 	}
-	if (i >= I40E_FDIR_WAIT_COUNT) {
+	if (i >= (I40E_FDIR_WAIT_COUNT * I40E_FDIR_WAIT_INTERVAL_US)) {
 		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
 			    " time out to get DD on tx queue.");
 		return -ETIMEDOUT;
 	}
 	/* totally delay 10 ms to check programming status*/
-	rte_delay_us((I40E_FDIR_WAIT_COUNT - i) * I40E_FDIR_WAIT_INTERVAL_US);
-	if (i40e_check_fdir_programming_status(rxq) < 0) {
-		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
-			    " programming status reported.");
-		return -ENOSYS;
+	for (; i < (I40E_FDIR_WAIT_COUNT * I40E_FDIR_WAIT_INTERVAL_US); i++) {
+		if (i40e_check_fdir_programming_status(rxq) >= 0)
+			return 0;
+		rte_delay_us(1);
 	}
-
-	return 0;
+	PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
+		" programming status reported.");
+	return -ETIMEDOUT;
 }
 
 /*
-- 
2.12.2

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

* Re: [PATCH v6] net/i40e: improved FDIR programming times
  2017-05-17 13:45     ` [PATCH v6] " Michael Lilja
@ 2017-05-17 14:10       ` Ferruh Yigit
  0 siblings, 0 replies; 20+ messages in thread
From: Ferruh Yigit @ 2017-05-17 14:10 UTC (permalink / raw)
  To: Michael Lilja, dev

On 5/17/2017 2:45 PM, Michael Lilja wrote:
> Previously, the FDIR programming time is +11ms on i40e.
> This patch will result in an average programming time of
> 22usec with a max of 60usec .
> 
> Signed-off-by: Michael Lilja <ml@napatech.com>

Please cc maintainers in the patch.

> 
> ---
> v6:
> * Fixed code style issues
> 
> v5:
> * Reinitialization of "i" inconsistent with original intent
> 
> v4:
> * Code style fix
> 
> v3:
> * Replaced commit message
> 
> v2:
> *  Code style fix
> 
> v1:
> * Initial version
> ---
> ---
>  drivers/net/i40e/i40e_fdir.c | 26 +++++++++++++-------------
>  1 file changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
> index 28cc554f5..16cb963ce 100644
> --- a/drivers/net/i40e/i40e_fdir.c
> +++ b/drivers/net/i40e/i40e_fdir.c
> @@ -1295,28 +1295,28 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
>  	/* Update the tx tail register */
>  	rte_wmb();
>  	I40E_PCI_REG_WRITE(txq->qtx_tail, txq->tx_tail);
> -
> -	for (i = 0; i < I40E_FDIR_WAIT_COUNT; i++) {
> -		rte_delay_us(I40E_FDIR_WAIT_INTERVAL_US);
> +	i = 0;

This is extracted out of "for" to stay in 80 columns limit, but instead
what do you think:

Create a variable, something like "wait_us_count":
wait_us_count = I40E_FDIR_WAIT_COUNT * I40E_FDIR_WAIT_INTERVAL_US;

and used it below three times, and lines will stay in limit.

> +	for (; i < (I40E_FDIR_WAIT_COUNT * I40E_FDIR_WAIT_INTERVAL_US); i++) {
>  		if ((txdp->cmd_type_offset_bsz &
> -				rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
> -				rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
> +			rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
> +			rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))

Old indentation was correct I think, that is to differentiate the code
in below line easily.

>  			break;
> +		rte_delay_us(1);
>  	}
> -	if (i >= I40E_FDIR_WAIT_COUNT) {
> +	if (i >= (I40E_FDIR_WAIT_COUNT * I40E_FDIR_WAIT_INTERVAL_US)) {
>  		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
>  			    " time out to get DD on tx queue.");
>  		return -ETIMEDOUT;
>  	}
>  	/* totally delay 10 ms to check programming status*/
> -	rte_delay_us((I40E_FDIR_WAIT_COUNT - i) * I40E_FDIR_WAIT_INTERVAL_US);
> -	if (i40e_check_fdir_programming_status(rxq) < 0) {
> -		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
> -			    " programming status reported.");
> -		return -ENOSYS;
> +	for (; i < (I40E_FDIR_WAIT_COUNT * I40E_FDIR_WAIT_INTERVAL_US); i++) {
> +		if (i40e_check_fdir_programming_status(rxq) >= 0)
> +			return 0;
> +		rte_delay_us(1);
>  	}
> -
> -	return 0;
> +	PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
> +		" programming status reported.");
> +	return -ETIMEDOUT;
>  }
>  
>  /*
> 

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

* [PATCH v7] net/i40e: improved FDIR programming times
  2017-05-17 10:38   ` [PATCH v5] " Michael Lilja
                       ` (2 preceding siblings ...)
  2017-05-17 13:45     ` [PATCH v6] " Michael Lilja
@ 2017-05-17 14:31     ` Michael Lilja
  2017-05-17 14:43       ` Ferruh Yigit
  2017-05-17 14:57     ` [PATCH v8] " Michael Lilja
  4 siblings, 1 reply; 20+ messages in thread
From: Michael Lilja @ 2017-05-17 14:31 UTC (permalink / raw)
  To: helin.zhang, jingjing.wu; +Cc: dev, Michael Lilja

Previously, the FDIR programming time is +11ms on i40e.
This patch will result in an average programming time of
22usec with a max of 60usec .

Signed-off-by: Michael Lilja <ml@napatech.com>

---
v7:
* Code style changes

v6:
* Fixed code style issues

v5:
* Reinitialization of "i" inconsistent with original intent

v4:
* Code style fix

v3:
* Replaced commit message

v2:
*  Code style fix

v1:
* Initial version
---
---
 drivers/net/i40e/i40e_fdir.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 28cc554f5..1192d5831 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -76,6 +76,7 @@
 /* Wait count and interval for fdir filter programming */
 #define I40E_FDIR_WAIT_COUNT       10
 #define I40E_FDIR_WAIT_INTERVAL_US 1000
+#define I40E_FDIR_MAX_WAIT (I40E_FDIR_WAIT_COUNT * I40E_FDIR_WAIT_INTERVAL_US)
 
 /* Wait count and interval for fdir filter flush */
 #define I40E_FDIR_FLUSH_RETRY       50
@@ -1295,28 +1296,27 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
 	/* Update the tx tail register */
 	rte_wmb();
 	I40E_PCI_REG_WRITE(txq->qtx_tail, txq->tx_tail);
-
-	for (i = 0; i < I40E_FDIR_WAIT_COUNT; i++) {
-		rte_delay_us(I40E_FDIR_WAIT_INTERVAL_US);
+	for (i = 0; i < I40E_FDIR_MAX_WAIT; i++) {
 		if ((txdp->cmd_type_offset_bsz &
 				rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
 				rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
 			break;
+		rte_delay_us(1);
 	}
-	if (i >= I40E_FDIR_WAIT_COUNT) {
+	if (i >= I40E_FDIR_MAX_WAIT) {
 		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
 			    " time out to get DD on tx queue.");
 		return -ETIMEDOUT;
 	}
 	/* totally delay 10 ms to check programming status*/
-	rte_delay_us((I40E_FDIR_WAIT_COUNT - i) * I40E_FDIR_WAIT_INTERVAL_US);
-	if (i40e_check_fdir_programming_status(rxq) < 0) {
-		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
-			    " programming status reported.");
-		return -ENOSYS;
+	for (; i < I40E_FDIR_MAX_WAIT; i++) {
+		if (i40e_check_fdir_programming_status(rxq) >= 0)
+			return 0;
+		rte_delay_us(1);
 	}
-
-	return 0;
+	PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
+		" programming status reported.");
+	return -ETIMEDOUT;
 }
 
 /*
-- 
2.12.2

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

* Re: [PATCH v7] net/i40e: improved FDIR programming times
  2017-05-17 14:31     ` [PATCH v7] " Michael Lilja
@ 2017-05-17 14:43       ` Ferruh Yigit
  2017-05-17 14:46         ` Michael Lilja
  0 siblings, 1 reply; 20+ messages in thread
From: Ferruh Yigit @ 2017-05-17 14:43 UTC (permalink / raw)
  To: Michael Lilja, helin.zhang, jingjing.wu; +Cc: dev

On 5/17/2017 3:31 PM, Michael Lilja wrote:
> Previously, the FDIR programming time is +11ms on i40e.
> This patch will result in an average programming time of
> 22usec with a max of 60usec .
> 
> Signed-off-by: Michael Lilja <ml@napatech.com>

Sorry for multiple, minor change requests ...

> 
> ---
> v7:
> * Code style changes
> 
> v6:
> * Fixed code style issues
> 
> v5:
> * Reinitialization of "i" inconsistent with original intent
> 
> v4:
> * Code style fix
> 
> v3:
> * Replaced commit message
> 
> v2:
> *  Code style fix
> 
> v1:
> * Initial version
> ---
> ---
>  drivers/net/i40e/i40e_fdir.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
> index 28cc554f5..1192d5831 100644
> --- a/drivers/net/i40e/i40e_fdir.c
> +++ b/drivers/net/i40e/i40e_fdir.c
> @@ -76,6 +76,7 @@
>  /* Wait count and interval for fdir filter programming */
>  #define I40E_FDIR_WAIT_COUNT       10
>  #define I40E_FDIR_WAIT_INTERVAL_US 1000
> +#define I40E_FDIR_MAX_WAIT (I40E_FDIR_WAIT_COUNT * I40E_FDIR_WAIT_INTERVAL_US)

It looks like I40E_FDIR_WAIT_COUNT and I40E_FDIR_WAIT_INTERVAL_US not
used anywhere else, is there any value to keep them?

why not:
#define I40E_FDIR_MAX_WAIT_US 10000 /* 10 ms */

>  
>  /* Wait count and interval for fdir filter flush */
>  #define I40E_FDIR_FLUSH_RETRY       50
> @@ -1295,28 +1296,27 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
>  	/* Update the tx tail register */
>  	rte_wmb();
>  	I40E_PCI_REG_WRITE(txq->qtx_tail, txq->tx_tail);
> -
> -	for (i = 0; i < I40E_FDIR_WAIT_COUNT; i++) {
> -		rte_delay_us(I40E_FDIR_WAIT_INTERVAL_US);
> +	for (i = 0; i < I40E_FDIR_MAX_WAIT; i++) {
>  		if ((txdp->cmd_type_offset_bsz &
>  				rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
>  				rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
>  			break;
> +		rte_delay_us(1);
>  	}
> -	if (i >= I40E_FDIR_WAIT_COUNT) {
> +	if (i >= I40E_FDIR_MAX_WAIT) {
>  		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
>  			    " time out to get DD on tx queue.");
>  		return -ETIMEDOUT;
>  	}
>  	/* totally delay 10 ms to check programming status*/
> -	rte_delay_us((I40E_FDIR_WAIT_COUNT - i) * I40E_FDIR_WAIT_INTERVAL_US);
> -	if (i40e_check_fdir_programming_status(rxq) < 0) {
> -		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
> -			    " programming status reported.");
> -		return -ENOSYS;
> +	for (; i < I40E_FDIR_MAX_WAIT; i++) {
> +		if (i40e_check_fdir_programming_status(rxq) >= 0)
> +			return 0;
> +		rte_delay_us(1);
>  	}
> -
> -	return 0;
> +	PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
> +		" programming status reported.");
> +	return -ETIMEDOUT;
>  }
>  
>  /*
> 

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

* Re: [PATCH v7] net/i40e: improved FDIR programming times
  2017-05-17 14:43       ` Ferruh Yigit
@ 2017-05-17 14:46         ` Michael Lilja
  2017-05-17 14:50           ` Ferruh Yigit
  0 siblings, 1 reply; 20+ messages in thread
From: Michael Lilja @ 2017-05-17 14:46 UTC (permalink / raw)
  To: Ferruh Yigit, helin.zhang, jingjing.wu; +Cc: dev

It's ok. I didn't write the original code so I cannot tell why the two defines were made in the initial case. It make sense to remove them, but the maintainers must have had a reason, maybe they are needed in a future version of the code?

/Michael

-----Original Message-----
From: Ferruh Yigit [mailto:ferruh.yigit@intel.com] 
Sent: 17 May 2017 16:44
To: Michael Lilja <ml@napatech.com>; helin.zhang@intel.com; jingjing.wu@intel.com
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v7] net/i40e: improved FDIR programming times

On 5/17/2017 3:31 PM, Michael Lilja wrote:
> Previously, the FDIR programming time is +11ms on i40e.
> This patch will result in an average programming time of 22usec with a 
> max of 60usec .
> 
> Signed-off-by: Michael Lilja <ml@napatech.com>

Sorry for multiple, minor change requests ...

> 
> ---
> v7:
> * Code style changes
> 
> v6:
> * Fixed code style issues
> 
> v5:
> * Reinitialization of "i" inconsistent with original intent
> 
> v4:
> * Code style fix
> 
> v3:
> * Replaced commit message
> 
> v2:
> *  Code style fix
> 
> v1:
> * Initial version
> ---
> ---
>  drivers/net/i40e/i40e_fdir.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_fdir.c 
> b/drivers/net/i40e/i40e_fdir.c index 28cc554f5..1192d5831 100644
> --- a/drivers/net/i40e/i40e_fdir.c
> +++ b/drivers/net/i40e/i40e_fdir.c
> @@ -76,6 +76,7 @@
>  /* Wait count and interval for fdir filter programming */
>  #define I40E_FDIR_WAIT_COUNT       10
>  #define I40E_FDIR_WAIT_INTERVAL_US 1000
> +#define I40E_FDIR_MAX_WAIT (I40E_FDIR_WAIT_COUNT * 
> +I40E_FDIR_WAIT_INTERVAL_US)

It looks like I40E_FDIR_WAIT_COUNT and I40E_FDIR_WAIT_INTERVAL_US not used anywhere else, is there any value to keep them?

why not:
#define I40E_FDIR_MAX_WAIT_US 10000 /* 10 ms */

>  
>  /* Wait count and interval for fdir filter flush */
>  #define I40E_FDIR_FLUSH_RETRY       50
> @@ -1295,28 +1296,27 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
>  	/* Update the tx tail register */
>  	rte_wmb();
>  	I40E_PCI_REG_WRITE(txq->qtx_tail, txq->tx_tail);
> -
> -	for (i = 0; i < I40E_FDIR_WAIT_COUNT; i++) {
> -		rte_delay_us(I40E_FDIR_WAIT_INTERVAL_US);
> +	for (i = 0; i < I40E_FDIR_MAX_WAIT; i++) {
>  		if ((txdp->cmd_type_offset_bsz &
>  				rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
>  				rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
>  			break;
> +		rte_delay_us(1);
>  	}
> -	if (i >= I40E_FDIR_WAIT_COUNT) {
> +	if (i >= I40E_FDIR_MAX_WAIT) {
>  		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
>  			    " time out to get DD on tx queue.");
>  		return -ETIMEDOUT;
>  	}
>  	/* totally delay 10 ms to check programming status*/
> -	rte_delay_us((I40E_FDIR_WAIT_COUNT - i) * I40E_FDIR_WAIT_INTERVAL_US);
> -	if (i40e_check_fdir_programming_status(rxq) < 0) {
> -		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
> -			    " programming status reported.");
> -		return -ENOSYS;
> +	for (; i < I40E_FDIR_MAX_WAIT; i++) {
> +		if (i40e_check_fdir_programming_status(rxq) >= 0)
> +			return 0;
> +		rte_delay_us(1);
>  	}
> -
> -	return 0;
> +	PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
> +		" programming status reported.");
> +	return -ETIMEDOUT;
>  }
>  
>  /*
> 


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

* Re: [PATCH v7] net/i40e: improved FDIR programming times
  2017-05-17 14:46         ` Michael Lilja
@ 2017-05-17 14:50           ` Ferruh Yigit
  2017-05-17 14:52             ` Michael Lilja
  0 siblings, 1 reply; 20+ messages in thread
From: Ferruh Yigit @ 2017-05-17 14:50 UTC (permalink / raw)
  To: Michael Lilja, helin.zhang, jingjing.wu; +Cc: dev

On 5/17/2017 3:46 PM, Michael Lilja wrote:
> It's ok. I didn't write the original code so I cannot tell why the two defines were made in the initial case. It make sense to remove them, but the maintainers must have had a reason, maybe they are needed in a future version of the code?

In original code, they have a meaning:
for (i = 0; i < I40E_FDIR_WAIT_COUNT; i++)
	rte_delay_us(I40E_FDIR_WAIT_INTERVAL_US);

wait step is I40E_FDIR_WAIT_INTERVAL_US.

But you changed to fixes 1us stepping. So WAIT_COUNT and
WAIT_INTERVAL_US are no more meaningful. And since they are not used
anywhere else, I think they can go away.

And we can wait from maintainers ack for any "plan to use in the future"
case.

Thanks,
ferruh

> 
> /Michael
> 
> -----Original Message-----
> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]
> Sent: 17 May 2017 16:44
> To: Michael Lilja <ml@napatech.com>; helin.zhang@intel.com; jingjing.wu@intel.com
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v7] net/i40e: improved FDIR programming times
> 
> On 5/17/2017 3:31 PM, Michael Lilja wrote:
>> Previously, the FDIR programming time is +11ms on i40e.
>> This patch will result in an average programming time of 22usec with a
>> max of 60usec .
>>
>> Signed-off-by: Michael Lilja <ml@napatech.com>
> 
> Sorry for multiple, minor change requests ...
> 
>>
>> ---
>> v7:
>> * Code style changes
>>
>> v6:
>> * Fixed code style issues
>>
>> v5:
>> * Reinitialization of "i" inconsistent with original intent
>>
>> v4:
>> * Code style fix
>>
>> v3:
>> * Replaced commit message
>>
>> v2:
>> *  Code style fix
>>
>> v1:
>> * Initial version
>> ---
>> ---
>>  drivers/net/i40e/i40e_fdir.c | 22 +++++++++++-----------
>>  1 file changed, 11 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/net/i40e/i40e_fdir.c
>> b/drivers/net/i40e/i40e_fdir.c index 28cc554f5..1192d5831 100644
>> --- a/drivers/net/i40e/i40e_fdir.c
>> +++ b/drivers/net/i40e/i40e_fdir.c
>> @@ -76,6 +76,7 @@
>>  /* Wait count and interval for fdir filter programming */
>>  #define I40E_FDIR_WAIT_COUNT       10
>>  #define I40E_FDIR_WAIT_INTERVAL_US 1000
>> +#define I40E_FDIR_MAX_WAIT (I40E_FDIR_WAIT_COUNT *
>> +I40E_FDIR_WAIT_INTERVAL_US)
> 
> It looks like I40E_FDIR_WAIT_COUNT and I40E_FDIR_WAIT_INTERVAL_US not used anywhere else, is there any value to keep them?
> 
> why not:
> #define I40E_FDIR_MAX_WAIT_US 10000 /* 10 ms */
> 
>>
>>  /* Wait count and interval for fdir filter flush */
>>  #define I40E_FDIR_FLUSH_RETRY       50
>> @@ -1295,28 +1296,27 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
>>  /* Update the tx tail register */
>>  rte_wmb();
>>  I40E_PCI_REG_WRITE(txq->qtx_tail, txq->tx_tail);
>> -
>> -for (i = 0; i < I40E_FDIR_WAIT_COUNT; i++) {
>> -rte_delay_us(I40E_FDIR_WAIT_INTERVAL_US);
>> +for (i = 0; i < I40E_FDIR_MAX_WAIT; i++) {
>>  if ((txdp->cmd_type_offset_bsz &
>>  rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
>>  rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
>>  break;
>> +rte_delay_us(1);
>>  }
>> -if (i >= I40E_FDIR_WAIT_COUNT) {
>> +if (i >= I40E_FDIR_MAX_WAIT) {
>>  PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
>>      " time out to get DD on tx queue.");
>>  return -ETIMEDOUT;
>>  }
>>  /* totally delay 10 ms to check programming status*/
>> -rte_delay_us((I40E_FDIR_WAIT_COUNT - i) * I40E_FDIR_WAIT_INTERVAL_US);
>> -if (i40e_check_fdir_programming_status(rxq) < 0) {
>> -PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
>> -    " programming status reported.");
>> -return -ENOSYS;
>> +for (; i < I40E_FDIR_MAX_WAIT; i++) {
>> +if (i40e_check_fdir_programming_status(rxq) >= 0)
>> +return 0;
>> +rte_delay_us(1);
>>  }
>> -
>> -return 0;
>> +PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
>> +" programming status reported.");
>> +return -ETIMEDOUT;
>>  }
>>
>>  /*
>>
> 
> Disclaimer: This email and any files transmitted with it may contain confidential information intended for the addressee(s) only. The information is not to be surrendered or copied to unauthorized persons. If you have received this communication in error, please notify the sender immediately and delete this e-mail from your system.
> 

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

* Re: [PATCH v7] net/i40e: improved FDIR programming times
  2017-05-17 14:50           ` Ferruh Yigit
@ 2017-05-17 14:52             ` Michael Lilja
  0 siblings, 0 replies; 20+ messages in thread
From: Michael Lilja @ 2017-05-17 14:52 UTC (permalink / raw)
  To: Ferruh Yigit, helin.zhang, jingjing.wu; +Cc: dev

Ok, I'll make a v8 removing the define.

/Michael

-----Original Message-----
From: Ferruh Yigit [mailto:ferruh.yigit@intel.com] 
Sent: 17 May 2017 16:50
To: Michael Lilja <ml@napatech.com>; helin.zhang@intel.com; jingjing.wu@intel.com
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v7] net/i40e: improved FDIR programming times

On 5/17/2017 3:46 PM, Michael Lilja wrote:
> It's ok. I didn't write the original code so I cannot tell why the two defines were made in the initial case. It make sense to remove them, but the maintainers must have had a reason, maybe they are needed in a future version of the code?

In original code, they have a meaning:
for (i = 0; i < I40E_FDIR_WAIT_COUNT; i++)
	rte_delay_us(I40E_FDIR_WAIT_INTERVAL_US);

wait step is I40E_FDIR_WAIT_INTERVAL_US.

But you changed to fixes 1us stepping. So WAIT_COUNT and WAIT_INTERVAL_US are no more meaningful. And since they are not used anywhere else, I think they can go away.

And we can wait from maintainers ack for any "plan to use in the future"
case.

Thanks,
ferruh

> 
> /Michael
> 
> -----Original Message-----
> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]
> Sent: 17 May 2017 16:44
> To: Michael Lilja <ml@napatech.com>; helin.zhang@intel.com; 
> jingjing.wu@intel.com
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v7] net/i40e: improved FDIR programming 
> times
> 
> On 5/17/2017 3:31 PM, Michael Lilja wrote:
>> Previously, the FDIR programming time is +11ms on i40e.
>> This patch will result in an average programming time of 22usec with 
>> a max of 60usec .
>>
>> Signed-off-by: Michael Lilja <ml@napatech.com>
> 
> Sorry for multiple, minor change requests ...
> 
>>
>> ---
>> v7:
>> * Code style changes
>>
>> v6:
>> * Fixed code style issues
>>
>> v5:
>> * Reinitialization of "i" inconsistent with original intent
>>
>> v4:
>> * Code style fix
>>
>> v3:
>> * Replaced commit message
>>
>> v2:
>> *  Code style fix
>>
>> v1:
>> * Initial version
>> ---
>> ---
>>  drivers/net/i40e/i40e_fdir.c | 22 +++++++++++-----------
>>  1 file changed, 11 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/net/i40e/i40e_fdir.c 
>> b/drivers/net/i40e/i40e_fdir.c index 28cc554f5..1192d5831 100644
>> --- a/drivers/net/i40e/i40e_fdir.c
>> +++ b/drivers/net/i40e/i40e_fdir.c
>> @@ -76,6 +76,7 @@
>>  /* Wait count and interval for fdir filter programming */
>>  #define I40E_FDIR_WAIT_COUNT       10
>>  #define I40E_FDIR_WAIT_INTERVAL_US 1000
>> +#define I40E_FDIR_MAX_WAIT (I40E_FDIR_WAIT_COUNT *
>> +I40E_FDIR_WAIT_INTERVAL_US)
> 
> It looks like I40E_FDIR_WAIT_COUNT and I40E_FDIR_WAIT_INTERVAL_US not used anywhere else, is there any value to keep them?
> 
> why not:
> #define I40E_FDIR_MAX_WAIT_US 10000 /* 10 ms */
> 
>>
>>  /* Wait count and interval for fdir filter flush */
>>  #define I40E_FDIR_FLUSH_RETRY       50
>> @@ -1295,28 +1296,27 @@ i40e_fdir_filter_programming(struct i40e_pf 
>> *pf,
>>  /* Update the tx tail register */
>>  rte_wmb();
>>  I40E_PCI_REG_WRITE(txq->qtx_tail, txq->tx_tail);
>> -
>> -for (i = 0; i < I40E_FDIR_WAIT_COUNT; i++) { 
>> -rte_delay_us(I40E_FDIR_WAIT_INTERVAL_US);
>> +for (i = 0; i < I40E_FDIR_MAX_WAIT; i++) {
>>  if ((txdp->cmd_type_offset_bsz &
>>  rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
>>  rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
>>  break;
>> +rte_delay_us(1);
>>  }
>> -if (i >= I40E_FDIR_WAIT_COUNT) {
>> +if (i >= I40E_FDIR_MAX_WAIT) {
>>  PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
>>      " time out to get DD on tx queue.");  return -ETIMEDOUT;  }
>>  /* totally delay 10 ms to check programming status*/ 
>> -rte_delay_us((I40E_FDIR_WAIT_COUNT - i) * 
>> I40E_FDIR_WAIT_INTERVAL_US); -if 
>> (i40e_check_fdir_programming_status(rxq) < 0) { -PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
>> -    " programming status reported.");
>> -return -ENOSYS;
>> +for (; i < I40E_FDIR_MAX_WAIT; i++) { if 
>> +(i40e_check_fdir_programming_status(rxq) >= 0) return 0; 
>> +rte_delay_us(1);
>>  }
>> -
>> -return 0;
>> +PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
>> +" programming status reported.");
>> +return -ETIMEDOUT;
>>  }
>>
>>  /*
>>
> 
> Disclaimer: This email and any files transmitted with it may contain confidential information intended for the addressee(s) only. The information is not to be surrendered or copied to unauthorized persons. If you have received this communication in error, please notify the sender immediately and delete this e-mail from your system.
> 


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

* [PATCH v8] net/i40e: improved FDIR programming times
  2017-05-17 10:38   ` [PATCH v5] " Michael Lilja
                       ` (3 preceding siblings ...)
  2017-05-17 14:31     ` [PATCH v7] " Michael Lilja
@ 2017-05-17 14:57     ` Michael Lilja
  2017-05-17 15:16       ` Ferruh Yigit
  2017-05-18  1:38       ` Xing, Beilei
  4 siblings, 2 replies; 20+ messages in thread
From: Michael Lilja @ 2017-05-17 14:57 UTC (permalink / raw)
  To: helin.zhang, jingjing.wu; +Cc: dev, Michael Lilja

Previously, the FDIR programming time is +11ms on i40e.
This patch will result in an average programming time of
22usec with a max of 60usec .

Signed-off-by: Michael Lilja <ml@napatech.com>

---
v8:
* Merged two defines into one handling max wait time

v7:
* Code style changes

v6:
* Fixed code style issues

v5:
* Reinitialization of "i" inconsistent with original intent

v4:
* Code style fix

v3:
* Replaced commit message

v2:
*  Code style fix

v1:
* Initial version
---
---
 drivers/net/i40e/i40e_fdir.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 28cc554f5..f94e1c3b8 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -73,9 +73,8 @@
 #define I40E_FDIR_IPv6_PAYLOAD_LEN          380
 #define I40E_FDIR_UDP_DEFAULT_LEN           400
 
-/* Wait count and interval for fdir filter programming */
-#define I40E_FDIR_WAIT_COUNT       10
-#define I40E_FDIR_WAIT_INTERVAL_US 1000
+/* Wait time for fdir filter programming */
+#define I40E_FDIR_MAX_WAIT_US 10000
 
 /* Wait count and interval for fdir filter flush */
 #define I40E_FDIR_FLUSH_RETRY       50
@@ -1295,28 +1294,27 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
 	/* Update the tx tail register */
 	rte_wmb();
 	I40E_PCI_REG_WRITE(txq->qtx_tail, txq->tx_tail);
-
-	for (i = 0; i < I40E_FDIR_WAIT_COUNT; i++) {
-		rte_delay_us(I40E_FDIR_WAIT_INTERVAL_US);
+	for (i = 0; i < I40E_FDIR_MAX_WAIT_US; i++) {
 		if ((txdp->cmd_type_offset_bsz &
 				rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
 				rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
 			break;
+		rte_delay_us(1);
 	}
-	if (i >= I40E_FDIR_WAIT_COUNT) {
+	if (i >= I40E_FDIR_MAX_WAIT_US) {
 		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
 			    " time out to get DD on tx queue.");
 		return -ETIMEDOUT;
 	}
 	/* totally delay 10 ms to check programming status*/
-	rte_delay_us((I40E_FDIR_WAIT_COUNT - i) * I40E_FDIR_WAIT_INTERVAL_US);
-	if (i40e_check_fdir_programming_status(rxq) < 0) {
-		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
-			    " programming status reported.");
-		return -ENOSYS;
+	for (; i < I40E_FDIR_MAX_WAIT_US; i++) {
+		if (i40e_check_fdir_programming_status(rxq) >= 0)
+			return 0;
+		rte_delay_us(1);
 	}
-
-	return 0;
+	PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
+		" programming status reported.");
+	return -ETIMEDOUT;
 }
 
 /*
-- 
2.12.2

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

* Re: [PATCH v8] net/i40e: improved FDIR programming times
  2017-05-17 14:57     ` [PATCH v8] " Michael Lilja
@ 2017-05-17 15:16       ` Ferruh Yigit
  2017-05-17 15:33         ` Michael Lilja
  2017-05-18  1:38       ` Xing, Beilei
  1 sibling, 1 reply; 20+ messages in thread
From: Ferruh Yigit @ 2017-05-17 15:16 UTC (permalink / raw)
  To: Michael Lilja, helin.zhang, jingjing.wu; +Cc: dev

On 5/17/2017 3:57 PM, Michael Lilja wrote:
> Previously, the FDIR programming time is +11ms on i40e.
> This patch will result in an average programming time of
> 22usec with a max of 60usec .
> 
> Signed-off-by: Michael Lilja <ml@napatech.com>

<...>

>  	/* totally delay 10 ms to check programming status*/
> -	rte_delay_us((I40E_FDIR_WAIT_COUNT - i) * I40E_FDIR_WAIT_INTERVAL_US);
> -	if (i40e_check_fdir_programming_status(rxq) < 0) {
> -		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
> -			    " programming status reported.");
> -		return -ENOSYS;
> +	for (; i < I40E_FDIR_MAX_WAIT_US; i++) {
> +		if (i40e_check_fdir_programming_status(rxq) >= 0)
> +			return 0;
> +		rte_delay_us(1);
>  	}
> -
> -	return 0;
> +	PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
> +		" programming status reported."
I am aware that you just moved this log, but since you have touched to
it, can you please fix it too [1]:

PMD_DRV_LOG(ERR,
	"Failed to program FDIR filter: programming status reported.");

[1] Or if you prefer please let me know, so I can fix it while applying.

> +	return -ETIMEDOUT;
>  }
>  
>  /*
> 

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

* Re: [PATCH v8] net/i40e: improved FDIR programming times
  2017-05-17 15:16       ` Ferruh Yigit
@ 2017-05-17 15:33         ` Michael Lilja
  0 siblings, 0 replies; 20+ messages in thread
From: Michael Lilja @ 2017-05-17 15:33 UTC (permalink / raw)
  To: Ferruh Yigit, helin.zhang, jingjing.wu; +Cc: dev

Please fix while applying.

-----Original Message-----
From: Ferruh Yigit [mailto:ferruh.yigit@intel.com] 
Sent: 17 May 2017 17:17
To: Michael Lilja <ml@napatech.com>; helin.zhang@intel.com; jingjing.wu@intel.com
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v8] net/i40e: improved FDIR programming times

On 5/17/2017 3:57 PM, Michael Lilja wrote:
> Previously, the FDIR programming time is +11ms on i40e.
> This patch will result in an average programming time of 22usec with a 
> max of 60usec .
> 
> Signed-off-by: Michael Lilja <ml@napatech.com>

<...>

>  	/* totally delay 10 ms to check programming status*/
> -	rte_delay_us((I40E_FDIR_WAIT_COUNT - i) * I40E_FDIR_WAIT_INTERVAL_US);
> -	if (i40e_check_fdir_programming_status(rxq) < 0) {
> -		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
> -			    " programming status reported.");
> -		return -ENOSYS;
> +	for (; i < I40E_FDIR_MAX_WAIT_US; i++) {
> +		if (i40e_check_fdir_programming_status(rxq) >= 0)
> +			return 0;
> +		rte_delay_us(1);
>  	}
> -
> -	return 0;
> +	PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
> +		" programming status reported."
I am aware that you just moved this log, but since you have touched to it, can you please fix it too [1]:

PMD_DRV_LOG(ERR,
	"Failed to program FDIR filter: programming status reported.");

[1] Or if you prefer please let me know, so I can fix it while applying.

> +	return -ETIMEDOUT;
>  }
>  
>  /*
> 


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

* Re: [PATCH v8] net/i40e: improved FDIR programming times
  2017-05-17 14:57     ` [PATCH v8] " Michael Lilja
  2017-05-17 15:16       ` Ferruh Yigit
@ 2017-05-18  1:38       ` Xing, Beilei
  2017-05-18  8:52         ` Ferruh Yigit
  1 sibling, 1 reply; 20+ messages in thread
From: Xing, Beilei @ 2017-05-18  1:38 UTC (permalink / raw)
  To: Michael Lilja, Zhang, Helin, Wu, Jingjing; +Cc: dev

Hi,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Michael Lilja
> Sent: Wednesday, May 17, 2017 10:58 PM
> To: Zhang, Helin <helin.zhang@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>
> Cc: dev@dpdk.org; Michael Lilja <ml@napatech.com>
> Subject: [dpdk-dev] [PATCH v8] net/i40e: improved FDIR programming times
> 
> Previously, the FDIR programming time is +11ms on i40e.
> This patch will result in an average programming time of 22usec with a max of
> 60usec .
> 
> Signed-off-by: Michael Lilja <ml@napatech.com>
> 
> ---
> v8:
> * Merged two defines into one handling max wait time
> 
> v7:
> * Code style changes
> 
> v6:
> * Fixed code style issues
> 
> v5:
> * Reinitialization of "i" inconsistent with original intent
> 
> v4:
> * Code style fix
> 
> v3:
> * Replaced commit message
> 
> v2:
> *  Code style fix
> 
> v1:
> * Initial version
> ---
> ---
>  drivers/net/i40e/i40e_fdir.c | 26 ++++++++++++--------------
>  1 file changed, 12 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index
> 28cc554f5..f94e1c3b8 100644
> --- a/drivers/net/i40e/i40e_fdir.c
> +++ b/drivers/net/i40e/i40e_fdir.c
> @@ -73,9 +73,8 @@
>  #define I40E_FDIR_IPv6_PAYLOAD_LEN          380
>  #define I40E_FDIR_UDP_DEFAULT_LEN           400
> 
> -/* Wait count and interval for fdir filter programming */
> -#define I40E_FDIR_WAIT_COUNT       10
> -#define I40E_FDIR_WAIT_INTERVAL_US 1000
> +/* Wait time for fdir filter programming */ #define
> +I40E_FDIR_MAX_WAIT_US 10000
> 
>  /* Wait count and interval for fdir filter flush */
>  #define I40E_FDIR_FLUSH_RETRY       50
> @@ -1295,28 +1294,27 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
>  	/* Update the tx tail register */
>  	rte_wmb();
>  	I40E_PCI_REG_WRITE(txq->qtx_tail, txq->tx_tail);
> -
> -	for (i = 0; i < I40E_FDIR_WAIT_COUNT; i++) {
> -		rte_delay_us(I40E_FDIR_WAIT_INTERVAL_US);
> +	for (i = 0; i < I40E_FDIR_MAX_WAIT_US; i++) {
>  		if ((txdp->cmd_type_offset_bsz &
> 
> 	rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
> 
> 	rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
>  			break;
> +		rte_delay_us(1);
>  	}
> -	if (i >= I40E_FDIR_WAIT_COUNT) {
> +	if (i >= I40E_FDIR_MAX_WAIT_US) {
>  		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
>  			    " time out to get DD on tx queue.");
>  		return -ETIMEDOUT;
>  	}
>  	/* totally delay 10 ms to check programming status*/
> -	rte_delay_us((I40E_FDIR_WAIT_COUNT - i) *
> I40E_FDIR_WAIT_INTERVAL_US);
> -	if (i40e_check_fdir_programming_status(rxq) < 0) {
> -		PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
> -			    " programming status reported.");
> -		return -ENOSYS;
> +	for (; i < I40E_FDIR_MAX_WAIT_US; i++) {
> +		if (i40e_check_fdir_programming_status(rxq) >= 0)
> +			return 0;
> +		rte_delay_us(1);
>  	}
> -
> -	return 0;
> +	PMD_DRV_LOG(ERR, "Failed to program FDIR filter:"
> +		" programming status reported.");
> +	return -ETIMEDOUT;
>  }
> 
>  /*
> --
> 2.12.2

Acked-by: Beilei Xing <beilei.xing@intel.com>

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

* Re: [PATCH v8] net/i40e: improved FDIR programming times
  2017-05-18  1:38       ` Xing, Beilei
@ 2017-05-18  8:52         ` Ferruh Yigit
  0 siblings, 0 replies; 20+ messages in thread
From: Ferruh Yigit @ 2017-05-18  8:52 UTC (permalink / raw)
  To: Xing, Beilei, Michael Lilja, Zhang, Helin, Wu, Jingjing; +Cc: dev

On 5/18/2017 2:38 AM, Xing, Beilei wrote:
> Hi,
> 
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Michael Lilja
>> Sent: Wednesday, May 17, 2017 10:58 PM
>> To: Zhang, Helin <helin.zhang@intel.com>; Wu, Jingjing
>> <jingjing.wu@intel.com>
>> Cc: dev@dpdk.org; Michael Lilja <ml@napatech.com>
>> Subject: [dpdk-dev] [PATCH v8] net/i40e: improved FDIR programming times
>>
>> Previously, the FDIR programming time is +11ms on i40e.
>> This patch will result in an average programming time of 22usec with a max of
>> 60usec .
>>
>> Signed-off-by: Michael Lilja <ml@napatech.com>

> Acked-by: Beilei Xing <beilei.xing@intel.com>

Applied to dpdk-next-net/master, thanks.

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

end of thread, other threads:[~2017-05-18  8:52 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-16 22:01 [PATCH v3] net/i40e: Improved FDIR programming times Michael Lilja
2017-05-17  2:22 ` Xing, Beilei
2017-05-17  8:44   ` Ferruh Yigit
2017-05-17  9:12 ` [PATCH v4] net/i40e: improved " Michael Lilja
2017-05-17  9:39   ` Xing, Beilei
2017-05-17 10:38   ` [PATCH v5] " Michael Lilja
2017-05-17 10:43     ` Xing, Beilei
2017-05-17 11:21     ` Ferruh Yigit
2017-05-17 13:45     ` [PATCH v6] " Michael Lilja
2017-05-17 14:10       ` Ferruh Yigit
2017-05-17 14:31     ` [PATCH v7] " Michael Lilja
2017-05-17 14:43       ` Ferruh Yigit
2017-05-17 14:46         ` Michael Lilja
2017-05-17 14:50           ` Ferruh Yigit
2017-05-17 14:52             ` Michael Lilja
2017-05-17 14:57     ` [PATCH v8] " Michael Lilja
2017-05-17 15:16       ` Ferruh Yigit
2017-05-17 15:33         ` Michael Lilja
2017-05-18  1:38       ` Xing, Beilei
2017-05-18  8:52         ` Ferruh Yigit

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.