From: Ivan Malov Date: Wed, 4 Oct 2017 07:34:26 +0000 (+0100) Subject: net/sfc: add device state check to reta update X-Git-Tag: spdx-start~1805 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=73332ab85ef64324aa944789e714450a0b3fb8a8;p=dpdk.git net/sfc: add device state check to reta update 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 Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 9e65b6a330..7a5747282d 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -1354,7 +1354,7 @@ sfc_dev_rss_reta_update(struct rte_eth_dev *dev, struct sfc_port *port = &sa->port; unsigned int *rss_tbl_new; uint16_t entry; - int rc; + int rc = 0; if (port->isolated) @@ -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);