Dynamic log type value may differ in primary and secondary processes.

Signed-off-by: Andrew Rybchenko <arybche...@solarflare.com>
---
 drivers/net/sfc/sfc.h        |  2 +-
 drivers/net/sfc/sfc_ethdev.c |  4 +++-
 drivers/net/sfc/sfc_log.h    | 10 +++++-----
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index 5c836b1c3..f04127bbc 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -175,6 +175,7 @@ struct sfc_rss {
 struct sfc_adapter_priv {
        const struct sfc_dp_rx          *dp_rx;
        const struct sfc_dp_tx          *dp_tx;
+       uint32_t                        logtype_main;
 };
 
 static inline struct sfc_adapter_priv *
@@ -207,7 +208,6 @@ struct sfc_adapter {
        uint16_t                        port_id;
        struct rte_eth_dev              *eth_dev;
        struct rte_kvargs               *kvargs;
-       uint32_t                        logtype_main;
        int                             socket_id;
        efsys_bar_t                     mem_bar;
        efx_family_t                    family;
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 46cd36fa5..bb53c7d53 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -1905,6 +1905,8 @@ sfc_eth_dev_secondary_init(struct rte_eth_dev *dev, 
uint32_t logtype_main)
                goto fail_alloc_priv;
        }
 
+       sap->logtype_main = logtype_main;
+
        dp_rx = sfc_dp_find_rx_by_name(&sfc_dp_head, sa->dp_rx_name);
        if (dp_rx == NULL) {
                SFC_LOG(sa, RTE_LOG_ERR, logtype_main,
@@ -2011,7 +2013,7 @@ sfc_eth_dev_init(struct rte_eth_dev *dev)
        /* Required for logging */
        sa->pci_addr = pci_dev->addr;
        sa->port_id = dev->data->port_id;
-       sa->logtype_main = logtype_main;
+       sa->priv.logtype_main = logtype_main;
 
        sa->eth_dev = dev;
 
diff --git a/drivers/net/sfc/sfc_log.h b/drivers/net/sfc/sfc_log.h
index b11fbfb0a..405cc2a26 100644
--- a/drivers/net/sfc/sfc_log.h
+++ b/drivers/net/sfc/sfc_log.h
@@ -52,7 +52,7 @@ extern uint32_t sfc_logtype_driver;
        do {                                                            \
                const struct sfc_adapter *_sa = (sa);                   \
                                                                        \
-               SFC_LOG(_sa, RTE_LOG_ERR, _sa->logtype_main,            \
+               SFC_LOG(_sa, RTE_LOG_ERR, _sa->priv.logtype_main,       \
                        __VA_ARGS__);                                   \
        } while (0)
 
@@ -60,7 +60,7 @@ extern uint32_t sfc_logtype_driver;
        do {                                                            \
                const struct sfc_adapter *_sa = (sa);                   \
                                                                        \
-               SFC_LOG(_sa, RTE_LOG_WARNING, _sa->logtype_main,        \
+               SFC_LOG(_sa, RTE_LOG_WARNING, _sa->priv.logtype_main,   \
                        __VA_ARGS__);                                   \
        } while (0)
 
@@ -68,7 +68,7 @@ extern uint32_t sfc_logtype_driver;
        do {                                                            \
                const struct sfc_adapter *_sa = (sa);                   \
                                                                        \
-               SFC_LOG(_sa, RTE_LOG_NOTICE, _sa->logtype_main,         \
+               SFC_LOG(_sa, RTE_LOG_NOTICE, _sa->priv.logtype_main,    \
                        __VA_ARGS__);                                   \
        } while (0)
 
@@ -76,7 +76,7 @@ extern uint32_t sfc_logtype_driver;
        do {                                                            \
                const struct sfc_adapter *_sa = (sa);                   \
                                                                        \
-               SFC_LOG(_sa, RTE_LOG_INFO, _sa->logtype_main,           \
+               SFC_LOG(_sa, RTE_LOG_INFO, _sa->priv.logtype_main,      \
                        __VA_ARGS__);                                   \
        } while (0)
 
@@ -84,7 +84,7 @@ extern uint32_t sfc_logtype_driver;
        do {                                                            \
                const struct sfc_adapter *_sa = (sa);                   \
                                                                        \
-               SFC_LOG(_sa, RTE_LOG_INFO, _sa->logtype_main,           \
+               SFC_LOG(_sa, RTE_LOG_INFO, _sa->priv.logtype_main,      \
                        RTE_FMT("%s(): "                                \
                                RTE_FMT_HEAD(__VA_ARGS__ ,),            \
                                __func__,                               \
-- 
2.17.1

Reply via email to