DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/sfc: add device state check to reta update operation
@ 2017-10-03  7:43 Andrew Rybchenko
  2017-10-03 22:04 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Rybchenko @ 2017-10-03  7:43 UTC (permalink / raw)
  To: dev; +Cc: Ivan Malov, stable

From: Ivan Malov <ivan.malov@oktetlabs.ru>

The callback must not attempt to program RSS table to the HW
in non-started state; the new table must be remembered and
applied on the next start

Fixes: 32bcfb0a50b1 ("net/sfc: update RSS redirection table")
Cc: stable@dpdk.org

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
---
 drivers/net/sfc/sfc_ethdev.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 9e65b6a..8650f87 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -1399,11 +1399,16 @@ sfc_dev_rss_reta_update(struct rte_eth_dev *dev,
 		}
 	}
 
-	rc = efx_rx_scale_tbl_set(sa->nic, EFX_RSS_CONTEXT_DEFAULT,
-				  rss_tbl_new, EFX_RSS_TBL_SIZE);
-	if (rc == 0)
-		rte_memcpy(sa->rss_tbl, rss_tbl_new, sizeof(sa->rss_tbl));
+	if (sa->state == SFC_ADAPTER_STARTED) {
+		rc = efx_rx_scale_tbl_set(sa->nic, EFX_RSS_CONTEXT_DEFAULT,
+					  rss_tbl_new, EFX_RSS_TBL_SIZE);
+		if (rc != 0)
+			goto fail_scale_tbl_set;
+	}
+
+	rte_memcpy(sa->rss_tbl, rss_tbl_new, sizeof(sa->rss_tbl));
 
+fail_scale_tbl_set:
 bad_reta_entry:
 	sfc_adapter_unlock(sa);
 
-- 
2.7.4

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

* Re: [dpdk-dev] [dpdk-stable] [PATCH] net/sfc: add device state check to reta update operation
  2017-10-03  7:43 [dpdk-dev] [PATCH] net/sfc: add device state check to reta update operation Andrew Rybchenko
@ 2017-10-03 22:04 ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2017-10-03 22:04 UTC (permalink / raw)
  To: Andrew Rybchenko, dev; +Cc: Ivan Malov, stable

On 10/3/2017 8:43 AM, Andrew Rybchenko wrote:
> From: Ivan Malov <ivan.malov@oktetlabs.ru>
> 
> The callback must not attempt to program RSS table to the HW
> in non-started state; the new table must be remembered and
> applied on the next start
> 
> Fixes: 32bcfb0a50b1 ("net/sfc: update RSS redirection table")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> Reviewed-by: Andy Moreton <amoreton@solarflare.com>
> ---
>  drivers/net/sfc/sfc_ethdev.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
> index 9e65b6a..8650f87 100644
> --- a/drivers/net/sfc/sfc_ethdev.c
> +++ b/drivers/net/sfc/sfc_ethdev.c
> @@ -1399,11 +1399,16 @@ sfc_dev_rss_reta_update(struct rte_eth_dev *dev,
>  		}
>  	}
>  
> -	rc = efx_rx_scale_tbl_set(sa->nic, EFX_RSS_CONTEXT_DEFAULT,
> -				  rss_tbl_new, EFX_RSS_TBL_SIZE);
> -	if (rc == 0)
> -		rte_memcpy(sa->rss_tbl, rss_tbl_new, sizeof(sa->rss_tbl));
> +	if (sa->state == SFC_ADAPTER_STARTED) {

This is causing a build error with clang:

.../dpdk/drivers/net/sfc/sfc_ethdev.c:1402:6: error: variable 'rc' is
used uninitialized whenever 'if' condition is false
[-Werror,-Wsometimes-uninitialized]
        if (sa->state == SFC_ADAPTER_STARTED) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../dpdk/drivers/net/sfc/sfc_ethdev.c:1418:10: note: uninitialized use
occurs here
        return -rc;
                ^~
.../dpdk/drivers/net/sfc/sfc_ethdev.c:1402:2: note: remove the 'if' if
its condition is always true
        if (sa->state == SFC_ADAPTER_STARTED) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../dpdk/drivers/net/sfc/sfc_ethdev.c:1357:8: note: initialize the
variable 'rc' to silence this warning
        int rc;
              ^
               = 0

> +		rc = efx_rx_scale_tbl_set(sa->nic, EFX_RSS_CONTEXT_DEFAULT,
> +					  rss_tbl_new, EFX_RSS_TBL_SIZE);
> +		if (rc != 0)
> +			goto fail_scale_tbl_set;
> +	}
> +
> +	rte_memcpy(sa->rss_tbl, rss_tbl_new, sizeof(sa->rss_tbl));
>  
> +fail_scale_tbl_set:
>  bad_reta_entry:
>  	sfc_adapter_unlock(sa);
>  
> 

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

end of thread, other threads:[~2017-10-03 22:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-03  7:43 [dpdk-dev] [PATCH] net/sfc: add device state check to reta update operation Andrew Rybchenko
2017-10-03 22:04 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit

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