struct sfc_adapter_shared {
struct rte_pci_addr pci_addr;
uint16_t port_id;
+
+ char *dp_rx_name;
+ char *dp_tx_name;
};
/* Adapter process private data */
uint32_t rxd_wait_timeout_ns;
struct sfc_rss rss;
+};
- /*
- * Shared memory copy of the Rx datapath name to be used by
- * the secondary process to find Rx datapath to be used.
- */
- char *dp_rx_name;
+static inline struct sfc_adapter_shared *
+sfc_adapter_shared_by_eth_dev(struct rte_eth_dev *eth_dev)
+{
+ struct sfc_adapter *sa = eth_dev->data->dev_private;
- /*
- * Shared memory copy of the Tx datapath name to be used by
- * the secondary process to find Tx datapath to be used.
- */
- char *dp_tx_name;
-};
+ return sa->priv.shared;
+}
/*
* Add wrapper functions to acquire/release lock to be able to remove or
sfc_eth_dev_set_ops(struct rte_eth_dev *dev)
{
struct sfc_adapter *sa = dev->data->dev_private;
+ struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev);
const struct sfc_dp_rx *dp_rx;
const struct sfc_dp_tx *dp_tx;
const efx_nic_cfg_t *encp;
}
}
- sa->dp_rx_name = sfc_strdup(dp_rx->dp.name);
- if (sa->dp_rx_name == NULL) {
+ sas->dp_rx_name = sfc_strdup(dp_rx->dp.name);
+ if (sas->dp_rx_name == NULL) {
rc = ENOMEM;
goto fail_dp_rx_name;
}
- sfc_notice(sa, "use %s Rx datapath", sa->dp_rx_name);
+ sfc_notice(sa, "use %s Rx datapath", sas->dp_rx_name);
rc = sfc_kvargs_process(sa, SFC_KVARG_TX_DATAPATH,
sfc_kvarg_string_handler, &tx_name);
}
}
- sa->dp_tx_name = sfc_strdup(dp_tx->dp.name);
- if (sa->dp_tx_name == NULL) {
+ sas->dp_tx_name = sfc_strdup(dp_tx->dp.name);
+ if (sas->dp_tx_name == NULL) {
rc = ENOMEM;
goto fail_dp_tx_name;
}
- sfc_notice(sa, "use %s Tx datapath", sa->dp_tx_name);
+ sfc_notice(sa, "use %s Tx datapath", sas->dp_tx_name);
sa->priv.dp_rx = dp_rx;
sa->priv.dp_tx = dp_tx;
fail_dp_tx_caps:
fail_dp_tx:
fail_kvarg_tx_datapath:
- rte_free(sa->dp_rx_name);
- sa->dp_rx_name = NULL;
+ rte_free(sas->dp_rx_name);
+ sas->dp_rx_name = NULL;
fail_dp_rx_name:
fail_dp_rx_caps:
sfc_eth_dev_clear_ops(struct rte_eth_dev *dev)
{
struct sfc_adapter *sa = dev->data->dev_private;
+ struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev);
dev->dev_ops = NULL;
dev->rx_pkt_burst = NULL;
dev->tx_pkt_burst = NULL;
- rte_free(sa->dp_tx_name);
- sa->dp_tx_name = NULL;
+ rte_free(sas->dp_tx_name);
+ sas->dp_tx_name = NULL;
sa->priv.dp_tx = NULL;
- rte_free(sa->dp_rx_name);
- sa->dp_rx_name = NULL;
+ rte_free(sas->dp_rx_name);
+ sas->dp_rx_name = NULL;
sa->priv.dp_rx = NULL;
}
* in shared memory only.
*/
struct sfc_adapter *sa = dev->data->dev_private;
+ struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev);
struct sfc_adapter_priv *sap;
const struct sfc_dp_rx *dp_rx;
const struct sfc_dp_tx *dp_tx;
sap->logtype_main = logtype_main;
- dp_rx = sfc_dp_find_rx_by_name(&sfc_dp_head, sa->dp_rx_name);
+ dp_rx = sfc_dp_find_rx_by_name(&sfc_dp_head, sas->dp_rx_name);
if (dp_rx == NULL) {
SFC_LOG(sa, RTE_LOG_ERR, logtype_main,
- "cannot find %s Rx datapath", sa->dp_rx_name);
+ "cannot find %s Rx datapath", sas->dp_rx_name);
rc = ENOENT;
goto fail_dp_rx;
}
if (~dp_rx->features & SFC_DP_RX_FEAT_MULTI_PROCESS) {
SFC_LOG(sa, RTE_LOG_ERR, logtype_main,
"%s Rx datapath does not support multi-process",
- sa->dp_rx_name);
+ sas->dp_rx_name);
rc = EINVAL;
goto fail_dp_rx_multi_process;
}
- dp_tx = sfc_dp_find_tx_by_name(&sfc_dp_head, sa->dp_tx_name);
+ dp_tx = sfc_dp_find_tx_by_name(&sfc_dp_head, sas->dp_tx_name);
if (dp_tx == NULL) {
SFC_LOG(sa, RTE_LOG_ERR, logtype_main,
- "cannot find %s Tx datapath", sa->dp_tx_name);
+ "cannot find %s Tx datapath", sas->dp_tx_name);
rc = ENOENT;
goto fail_dp_tx;
}
if (~dp_tx->features & SFC_DP_TX_FEAT_MULTI_PROCESS) {
SFC_LOG(sa, RTE_LOG_ERR, logtype_main,
"%s Tx datapath does not support multi-process",
- sa->dp_tx_name);
+ sas->dp_tx_name);
rc = EINVAL;
goto fail_dp_tx_multi_process;
}