static int
sfc_eth_dev_secondary_init(struct rte_eth_dev *dev, uint32_t logtype_main)
{
- /*
- * Device private data has really many process-local pointers.
- * Below code should be extremely careful to use data located
- * 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;
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,
+ SFC_LOG(sas, RTE_LOG_ERR, logtype_main,
"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,
+ SFC_LOG(sas, RTE_LOG_ERR, logtype_main,
"%s Rx datapath does not support multi-process",
sas->dp_rx_name);
rc = EINVAL;
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,
+ SFC_LOG(sas, RTE_LOG_ERR, logtype_main,
"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,
+ SFC_LOG(sas, RTE_LOG_ERR, logtype_main,
"%s Tx datapath does not support multi-process",
sas->dp_tx_name);
rc = EINVAL;
#define SFC_LOG_LEVEL_MCDI RTE_LOG_INFO
/* Log PMD message, automatically add prefix and \n */
-#define SFC_LOG(sa, level, type, ...) \
+#define SFC_LOG(sas, level, type, ...) \
do { \
- const struct sfc_adapter_shared *_sas; \
+ const struct sfc_adapter_shared *_sas = (sas); \
\
- _sas = (sa)->priv.shared; \
rte_log(level, type, \
RTE_FMT("PMD: sfc_efx " \
PCI_PRI_FMT " #%" PRIu16 \
do { \
const struct sfc_adapter *_sa = (sa); \
\
- SFC_LOG(_sa, RTE_LOG_ERR, _sa->priv.logtype_main, \
- __VA_ARGS__); \
+ SFC_LOG(_sa->priv.shared, RTE_LOG_ERR, \
+ _sa->priv.logtype_main, __VA_ARGS__); \
} while (0)
#define sfc_warn(sa, ...) \
do { \
const struct sfc_adapter *_sa = (sa); \
\
- SFC_LOG(_sa, RTE_LOG_WARNING, _sa->priv.logtype_main, \
- __VA_ARGS__); \
+ SFC_LOG(_sa->priv.shared, RTE_LOG_WARNING, \
+ _sa->priv.logtype_main, __VA_ARGS__); \
} while (0)
#define sfc_notice(sa, ...) \
do { \
const struct sfc_adapter *_sa = (sa); \
\
- SFC_LOG(_sa, RTE_LOG_NOTICE, _sa->priv.logtype_main, \
- __VA_ARGS__); \
+ SFC_LOG(_sa->priv.shared, RTE_LOG_NOTICE, \
+ _sa->priv.logtype_main, __VA_ARGS__); \
} while (0)
#define sfc_info(sa, ...) \
do { \
const struct sfc_adapter *_sa = (sa); \
\
- SFC_LOG(_sa, RTE_LOG_INFO, _sa->priv.logtype_main, \
- __VA_ARGS__); \
+ SFC_LOG(_sa->priv.shared, RTE_LOG_INFO, \
+ _sa->priv.logtype_main, __VA_ARGS__); \
} while (0)
#define sfc_log_init(sa, ...) \
do { \
const struct sfc_adapter *_sa = (sa); \
\
- SFC_LOG(_sa, RTE_LOG_INFO, _sa->priv.logtype_main, \
+ SFC_LOG(_sa->priv.shared, RTE_LOG_INFO, \
+ _sa->priv.logtype_main, \
RTE_FMT("%s(): " \
RTE_FMT_HEAD(__VA_ARGS__ ,), \
__func__, \
do { \
const struct sfc_adapter *_sa = (sa); \
\
- SFC_LOG(_sa, SFC_LOG_LEVEL_MCDI, _sa->mcdi.logtype, \
- __VA_ARGS__); \
+ SFC_LOG(_sa->priv.shared, SFC_LOG_LEVEL_MCDI, \
+ _sa->mcdi.logtype, __VA_ARGS__); \
} while (0)