From 3d845eddc1df3c28460f8d197980ccad027fb44b Mon Sep 17 00:00:00 2001 From: Andrew Boyer Date: Wed, 16 Dec 2020 13:12:51 -0800 Subject: [PATCH] net/ionic: preserve RSS state unless RETA size changes This preserves settings across a LIF stop/start. This will become important when link toggling is tied to LIF stop/start. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_lif.c | 44 ++++++++++++++++------------------- drivers/net/ionic/ionic_lif.h | 1 + 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 28ae9dc8a9..646c921b2f 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -962,8 +962,6 @@ ionic_lif_rss_config(struct ionic_lif *lif, static int ionic_lif_rss_setup(struct ionic_lif *lif) { - size_t tbl_size = sizeof(*lif->rss_ind_tbl) * - lif->adapter->ident.lif.eth.rss_ind_tbl_sz; static const uint8_t toeplitz_symmetric_key[] = { 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, @@ -971,34 +969,35 @@ ionic_lif_rss_setup(struct ionic_lif *lif) 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, }; - uint32_t socket_id = rte_socket_id(); uint32_t i; - int err; + uint16_t tbl_sz = lif->adapter->ident.lif.eth.rss_ind_tbl_sz; IONIC_PRINT_CALL(); - lif->rss_ind_tbl_z = rte_eth_dma_zone_reserve(lif->eth_dev, - "rss_ind_tbl", - 0 /* queue_idx*/, tbl_size, IONIC_ALIGN, socket_id); - if (!lif->rss_ind_tbl_z) { - IONIC_PRINT(ERR, "OOM"); - return -ENOMEM; - } + lif->rss_ind_tbl_z = rte_eth_dma_zone_reserve(lif->eth_dev, + "rss_ind_tbl", 0 /* queue_idx */, + sizeof(*lif->rss_ind_tbl) * tbl_sz, + IONIC_ALIGN, rte_socket_id()); + if (!lif->rss_ind_tbl_z) { + IONIC_PRINT(ERR, "OOM"); + return -ENOMEM; + } - lif->rss_ind_tbl = lif->rss_ind_tbl_z->addr; - lif->rss_ind_tbl_pa = lif->rss_ind_tbl_z->iova; + lif->rss_ind_tbl = lif->rss_ind_tbl_z->addr; + lif->rss_ind_tbl_pa = lif->rss_ind_tbl_z->iova; + } - /* Fill indirection table with 'default' values */ - for (i = 0; i < lif->adapter->ident.lif.eth.rss_ind_tbl_sz; i++) - lif->rss_ind_tbl[i] = i % lif->nrxqcqs; + if (lif->rss_ind_tbl_nrxqcqs != lif->nrxqcqs) { + lif->rss_ind_tbl_nrxqcqs = lif->nrxqcqs; - err = ionic_lif_rss_config(lif, IONIC_RSS_OFFLOAD_ALL, - toeplitz_symmetric_key, NULL); - if (err) - return err; + /* Fill indirection table with 'default' values */ + for (i = 0; i < tbl_sz; i++) + lif->rss_ind_tbl[i] = i % lif->nrxqcqs; + } - return 0; + return ionic_lif_rss_config(lif, IONIC_RSS_OFFLOAD_ALL, + toeplitz_symmetric_key, NULL); } static void @@ -1578,9 +1577,6 @@ ionic_lif_start(struct ionic_lif *lif) uint32_t i; int err; - IONIC_PRINT(DEBUG, "Setting RSS configuration on port %u", - lif->port_id); - err = ionic_lif_rss_setup(lif); if (err) return err; diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index 8e2b42443b..b80931c614 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -108,6 +108,7 @@ struct ionic_lif { uint8_t *rss_ind_tbl; rte_iova_t rss_ind_tbl_pa; const struct rte_memzone *rss_ind_tbl_z; + uint32_t rss_ind_tbl_nrxqcqs; uint32_t info_sz; struct ionic_lif_info *info; rte_iova_t info_pa; -- 2.20.1