net/sfc: move main log type to process private data
authorAndrew Rybchenko <arybchenko@solarflare.com>
Thu, 7 Feb 2019 12:17:32 +0000 (12:17 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 7 Feb 2019 15:06:30 +0000 (16:06 +0100)
Dynamic log type value may differ in primary and secondary processes.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
drivers/net/sfc/sfc.h
drivers/net/sfc/sfc_ethdev.c
drivers/net/sfc/sfc_log.h

index 5c836b1..f04127b 100644 (file)
@@ -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;
index 46cd36f..bb53c7d 100644 (file)
@@ -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;
 
index b11fbfb..405cc2a 100644 (file)
@@ -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__,                               \