sfc_adapter structure will become primary process only private data.
Start to factor out shared data into dedicated structure which will
become separate structure finally.
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
uint8_t key[EFX_RSS_KEY_SIZE];
};
+/* Adapter private data shared by primary and secondary processes */
+struct sfc_adapter_shared {
+ struct rte_pci_addr pci_addr;
+ uint16_t port_id;
+};
+
/* Adapter process private data */
struct sfc_adapter_priv {
+ struct sfc_adapter_shared *shared;
const struct sfc_dp_rx *dp_rx;
const struct sfc_dp_tx *dp_tx;
uint32_t logtype_main;
*/
struct sfc_adapter_priv priv;
+ /*
+ * Temporary placeholder for multi-process shared data for
+ * transition.
+ */
+ struct sfc_adapter_shared _shared;
+
/*
* PMD setup and configuration is not thread safe. Since it is not
* performance sensitive, it is better to guarantee thread-safety
*/
rte_spinlock_t lock;
enum sfc_adapter_state state;
- struct rte_pci_addr pci_addr;
- uint16_t port_id;
struct rte_eth_dev *eth_dev;
struct rte_kvargs *kvargs;
int socket_id;
/* Log PMD message, automatically add prefix and \n */
#define sfc_panic(sa, fmt, args...) \
do { \
- const struct sfc_adapter *_sa = (sa); \
+ const struct sfc_adapter_shared *_sas; \
\
+ _sas = (sa)->priv.shared; \
rte_panic("sfc " PCI_PRI_FMT \
" #%" PRIu16 ": " fmt "\n", \
- _sa->pci_addr.domain, _sa->pci_addr.bus, \
- _sa->pci_addr.devid, _sa->pci_addr.function, \
- _sa->port_id, ##args); \
+ _sas->pci_addr.domain, _sas->pci_addr.bus, \
+ _sas->pci_addr.devid, _sas->pci_addr.function,\
+ _sas->port_id, ##args); \
} while (0)
#endif /* _SFC_DEBUG_H_ */
sfc_eth_dev_init(struct rte_eth_dev *dev)
{
struct sfc_adapter *sa = dev->data->dev_private;
+ struct sfc_adapter_shared *sas;
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
uint32_t logtype_main;
int rc;
SFC_LOGTYPE_MAIN_STR,
RTE_LOG_NOTICE);
+ sa->priv.shared = &sa->_shared;
+ sas = sa->priv.shared;
+
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return -sfc_eth_dev_secondary_init(dev, logtype_main);
dev->process_private = sa;
/* Required for logging */
- sa->pci_addr = pci_dev->addr;
- sa->port_id = dev->data->port_id;
+ sas->pci_addr = pci_dev->addr;
+ sas->port_id = dev->data->port_id;
sa->priv.logtype_main = logtype_main;
sa->eth_dev = dev;
/* Log PMD message, automatically add prefix and \n */
#define SFC_LOG(sa, level, type, ...) \
do { \
- const struct sfc_adapter *__sa = (sa); \
+ const struct sfc_adapter_shared *_sas; \
\
+ _sas = (sa)->priv.shared; \
rte_log(level, type, \
RTE_FMT("PMD: sfc_efx " \
PCI_PRI_FMT " #%" PRIu16 \
": " RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
- __sa->pci_addr.domain, \
- __sa->pci_addr.bus, \
- __sa->pci_addr.devid, \
- __sa->pci_addr.function, \
- __sa->port_id, \
+ _sas->pci_addr.domain, \
+ _sas->pci_addr.bus, \
+ _sas->pci_addr.devid, \
+ _sas->pci_addr.function, \
+ _sas->port_id, \
RTE_FMT_TAIL(__VA_ARGS__,))); \
} while (0)
if (rc != 0)
goto fail_dma_alloc;
- mcdi->logtype = sfc_register_logtype(&sa->pci_addr,
+ mcdi->logtype = sfc_register_logtype(&sa->priv.shared->pci_addr,
SFC_LOGTYPE_MCDI_STR,
RTE_LOG_NOTICE);