From: Andrew Rybchenko Date: Thu, 7 Feb 2019 12:17:49 +0000 (+0000) Subject: net/sfc: move RSS config to adapter shared X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=e295f175bf503b011b2634023dd0f20f47763ed8;p=dpdk.git net/sfc: move RSS config to adapter shared RSS get requests are supported in secondary process. Prepare to make sfc_adapter primary process private data. Signed-off-by: Andrew Rybchenko --- diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c index 4e4c4e445d..8526a84b57 100644 --- a/drivers/net/sfc/sfc.c +++ b/drivers/net/sfc/sfc.c @@ -642,7 +642,7 @@ static const uint8_t default_rss_key[EFX_RSS_KEY_SIZE] = { static int sfc_rss_attach(struct sfc_adapter *sa) { - struct sfc_rss *rss = &sa->rss; + struct sfc_rss *rss = &sfc_sa2shared(sa)->rss; int rc; rc = efx_intr_init(sa->nic, sa->intr.type, NULL); diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index 2c67150277..72992d68b1 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -182,6 +182,8 @@ struct sfc_adapter_shared { unsigned int txq_count; struct sfc_txq_info *txq_info; + struct sfc_rss rss; + struct rte_pci_addr pci_addr; uint16_t port_id; @@ -283,8 +285,6 @@ struct sfc_adapter { boolean_t tso; uint32_t rxd_wait_timeout_ns; - - struct sfc_rss rss; }; static inline struct sfc_adapter_shared * diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 6572aa1a0d..034229f373 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -85,8 +85,9 @@ static void sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { const struct sfc_adapter_priv *sap = sfc_adapter_priv_by_eth_dev(dev); + struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev); struct sfc_adapter *sa = dev->data->dev_private; - struct sfc_rss *rss = &sa->rss; + struct sfc_rss *rss = &sas->rss; uint64_t txq_offloads_def = 0; sfc_log_init(sa, "entry"); @@ -1419,8 +1420,9 @@ static int sfc_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf) { + struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev); struct sfc_adapter *sa = dev->data->dev_private; - struct sfc_rss *rss = &sa->rss; + struct sfc_rss *rss = &sas->rss; if (rss->context_type != EFX_RX_SCALE_EXCLUSIVE) return -ENOTSUP; @@ -1433,7 +1435,7 @@ sfc_dev_rss_hash_conf_get(struct rte_eth_dev *dev, * flags which corresponds to the active EFX configuration stored * locally in 'sfc_adapter' and kept up-to-date */ - rss_conf->rss_hf = sfc_rx_hf_efx_to_rte(sa, rss->hash_types); + rss_conf->rss_hf = sfc_rx_hf_efx_to_rte(rss, rss->hash_types); rss_conf->rss_key_len = EFX_RSS_KEY_SIZE; if (rss_conf->rss_key != NULL) rte_memcpy(rss_conf->rss_key, rss->key, EFX_RSS_KEY_SIZE); @@ -1448,7 +1450,7 @@ sfc_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf) { struct sfc_adapter *sa = dev->data->dev_private; - struct sfc_rss *rss = &sa->rss; + struct sfc_rss *rss = &sfc_sa2shared(sa)->rss; struct sfc_port *port = &sa->port; unsigned int efx_hash_types; int rc = 0; @@ -1524,8 +1526,9 @@ sfc_dev_rss_reta_query(struct rte_eth_dev *dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) { + struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev); struct sfc_adapter *sa = dev->data->dev_private; - struct sfc_rss *rss = &sa->rss; + struct sfc_rss *rss = &sas->rss; struct sfc_port *port = &sa->port; int entry; @@ -1559,7 +1562,7 @@ sfc_dev_rss_reta_update(struct rte_eth_dev *dev, uint16_t reta_size) { struct sfc_adapter *sa = dev->data->dev_private; - struct sfc_rss *rss = &sa->rss; + struct sfc_rss *rss = &sfc_sa2shared(sa)->rss; struct sfc_port *port = &sa->port; unsigned int *rss_tbl_new; uint16_t entry; diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c index ab5f24f51e..201c6cd060 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -1255,7 +1255,8 @@ sfc_flow_parse_rss(struct sfc_adapter *sa, const struct rte_flow_action_rss *action_rss, struct rte_flow *flow) { - struct sfc_rss *rss = &sa->rss; + struct sfc_adapter_shared * const sas = sfc_sa2shared(sa); + struct sfc_rss *rss = &sas->rss; unsigned int rxq_sw_index; struct sfc_rxq *rxq; unsigned int rxq_hw_index_min; @@ -1400,7 +1401,8 @@ static int sfc_flow_filter_insert(struct sfc_adapter *sa, struct rte_flow *flow) { - struct sfc_rss *rss = &sa->rss; + struct sfc_adapter_shared * const sas = sfc_sa2shared(sa); + struct sfc_rss *rss = &sas->rss; struct sfc_flow_rss *flow_rss = &flow->rss_conf; uint32_t efs_rss_context = EFX_RSS_CONTEXT_DEFAULT; unsigned int i; diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index 8af9d21482..3b4b65f6e6 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -618,7 +618,7 @@ sfc_rx_qflush(struct sfc_adapter *sa, unsigned int sw_index) static int sfc_rx_default_rxq_set_filter(struct sfc_adapter *sa, struct sfc_rxq *rxq) { - struct sfc_rss *rss = &sa->rss; + struct sfc_rss *rss = &sfc_sa2shared(sa)->rss; boolean_t need_rss = (rss->channels > 0) ? B_TRUE : B_FALSE; struct sfc_port *port = &sa->port; int rc; @@ -961,7 +961,7 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index, struct rte_mempool *mb_pool) { const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); - struct sfc_rss *rss = &sa->rss; + struct sfc_rss *rss = &sfc_sa2shared(sa)->rss; int rc; unsigned int rxq_entries; unsigned int evq_entries; @@ -1176,7 +1176,7 @@ sfc_rx_hash_types_mask_supp(efx_rx_hash_type_t hash_type, int sfc_rx_hash_init(struct sfc_adapter *sa) { - struct sfc_rss *rss = &sa->rss; + struct sfc_rss *rss = &sfc_sa2shared(sa)->rss; const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); uint32_t alg_mask = encp->enc_rx_scale_hash_alg_mask; efx_rx_hash_alg_t alg; @@ -1232,7 +1232,7 @@ sfc_rx_hash_init(struct sfc_adapter *sa) void sfc_rx_hash_fini(struct sfc_adapter *sa) { - struct sfc_rss *rss = &sa->rss; + struct sfc_rss *rss = &sfc_sa2shared(sa)->rss; rte_free(rss->hf_map); } @@ -1241,7 +1241,7 @@ int sfc_rx_hf_rte_to_efx(struct sfc_adapter *sa, uint64_t rte, efx_rx_hash_type_t *efx) { - struct sfc_rss *rss = &sa->rss; + struct sfc_rss *rss = &sfc_sa2shared(sa)->rss; efx_rx_hash_type_t hash_types = 0; unsigned int i; @@ -1265,9 +1265,8 @@ sfc_rx_hf_rte_to_efx(struct sfc_adapter *sa, uint64_t rte, } uint64_t -sfc_rx_hf_efx_to_rte(struct sfc_adapter *sa, efx_rx_hash_type_t efx) +sfc_rx_hf_efx_to_rte(struct sfc_rss *rss, efx_rx_hash_type_t efx) { - struct sfc_rss *rss = &sa->rss; uint64_t rte = 0; unsigned int i; @@ -1285,9 +1284,9 @@ static int sfc_rx_process_adv_conf_rss(struct sfc_adapter *sa, struct rte_eth_rss_conf *conf) { - struct sfc_rss *rss = &sa->rss; + struct sfc_rss *rss = &sfc_sa2shared(sa)->rss; efx_rx_hash_type_t efx_hash_types = rss->hash_types; - uint64_t rss_hf = sfc_rx_hf_efx_to_rte(sa, efx_hash_types); + uint64_t rss_hf = sfc_rx_hf_efx_to_rte(rss, efx_hash_types); int rc; if (rss->context_type != EFX_RX_SCALE_EXCLUSIVE) { @@ -1319,7 +1318,7 @@ sfc_rx_process_adv_conf_rss(struct sfc_adapter *sa, static int sfc_rx_rss_config(struct sfc_adapter *sa) { - struct sfc_rss *rss = &sa->rss; + struct sfc_rss *rss = &sfc_sa2shared(sa)->rss; int rc = 0; if (rss->channels > 0) { @@ -1418,9 +1417,10 @@ sfc_rx_qinit_info(struct sfc_adapter *sa, unsigned int sw_index) static int sfc_rx_check_mode(struct sfc_adapter *sa, struct rte_eth_rxmode *rxmode) { + struct sfc_adapter_shared * const sas = sfc_sa2shared(sa); uint64_t offloads_supported = sfc_rx_get_dev_offload_caps(sa) | sfc_rx_get_queue_offload_caps(sa); - struct sfc_rss *rss = &sa->rss; + struct sfc_rss *rss = &sas->rss; int rc = 0; switch (rxmode->mq_mode) { @@ -1492,7 +1492,7 @@ int sfc_rx_configure(struct sfc_adapter *sa) { struct sfc_adapter_shared * const sas = sfc_sa2shared(sa); - struct sfc_rss *rss = &sa->rss; + struct sfc_rss *rss = &sas->rss; struct rte_eth_conf *dev_conf = &sa->eth_dev->data->dev_conf; const unsigned int nb_rx_queues = sa->eth_dev->data->nb_rx_queues; int rc; @@ -1603,7 +1603,7 @@ fail_check_mode: void sfc_rx_close(struct sfc_adapter *sa) { - struct sfc_rss *rss = &sa->rss; + struct sfc_rss *rss = &sfc_sa2shared(sa)->rss; sfc_rx_fini_queues(sa, 0); diff --git a/drivers/net/sfc/sfc_rx.h b/drivers/net/sfc/sfc_rx.h index 73b70249c5..ee1402022e 100644 --- a/drivers/net/sfc/sfc_rx.h +++ b/drivers/net/sfc/sfc_rx.h @@ -141,8 +141,7 @@ int sfc_rx_hash_init(struct sfc_adapter *sa); void sfc_rx_hash_fini(struct sfc_adapter *sa); int sfc_rx_hf_rte_to_efx(struct sfc_adapter *sa, uint64_t rte, efx_rx_hash_type_t *efx); -uint64_t sfc_rx_hf_efx_to_rte(struct sfc_adapter *sa, - efx_rx_hash_type_t efx); +uint64_t sfc_rx_hf_efx_to_rte(struct sfc_rss *rss, efx_rx_hash_type_t efx); #ifdef __cplusplus }