From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 2/3] net/sfc: use locally stored data for logging
Date: Wed, 17 May 2017 13:25:07 +0100 [thread overview]
Message-ID: <1495023908-10977-2-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1495023908-10977-1-git-send-email-arybchenko@solarflare.com>
Required to be able to use logging in the secondary process
where Ethernet device pointer stored in sfc_adapter is invalid.
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
---
drivers/net/sfc/sfc.h | 2 ++
drivers/net/sfc/sfc_debug.h | 10 ++++------
drivers/net/sfc/sfc_ethdev.c | 3 +++
drivers/net/sfc/sfc_log.h | 14 ++++++--------
4 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index 7927678..772a713 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -179,6 +179,8 @@ struct sfc_adapter {
*/
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;
bool debug_init;
diff --git a/drivers/net/sfc/sfc_debug.h b/drivers/net/sfc/sfc_debug.h
index f4fe044..92eba9c 100644
--- a/drivers/net/sfc/sfc_debug.h
+++ b/drivers/net/sfc/sfc_debug.h
@@ -47,14 +47,12 @@
/* Log PMD message, automatically add prefix and \n */
#define sfc_panic(sa, fmt, args...) \
do { \
- const struct rte_eth_dev *_dev = (sa)->eth_dev; \
- const struct rte_pci_device *_pci_dev = \
- RTE_ETH_DEV_TO_PCI(_dev); \
+ const struct sfc_adapter *_sa = (sa); \
\
rte_panic("sfc " PCI_PRI_FMT " #%" PRIu8 ": " fmt "\n", \
- _pci_dev->addr.domain, _pci_dev->addr.bus, \
- _pci_dev->addr.devid, _pci_dev->addr.function,\
- _dev->data->port_id, ##args); \
+ _sa->pci_addr.domain, _sa->pci_addr.bus, \
+ _sa->pci_addr.devid, _sa->pci_addr.function, \
+ _sa->port_id, ##args); \
} while (0)
#endif /* _SFC_DEBUG_H_ */
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index e4f051a..d6bba1d 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -1513,6 +1513,9 @@ sfc_eth_dev_init(struct rte_eth_dev *dev)
sfc_register_dp();
/* Required for logging */
+ sa->pci_addr = pci_dev->addr;
+ sa->port_id = dev->data->port_id;
+
sa->eth_dev = dev;
/* Copy PCI device info to the dev->data */
diff --git a/drivers/net/sfc/sfc_log.h b/drivers/net/sfc/sfc_log.h
index d0f8921..6c43925 100644
--- a/drivers/net/sfc/sfc_log.h
+++ b/drivers/net/sfc/sfc_log.h
@@ -35,18 +35,16 @@
/* Log PMD message, automatically add prefix and \n */
#define SFC_LOG(sa, level, ...) \
do { \
- const struct rte_eth_dev *_dev = (sa)->eth_dev; \
- const struct rte_pci_device *_pci_dev = \
- RTE_ETH_DEV_TO_PCI(_dev); \
+ const struct sfc_adapter *_sa = (sa); \
\
RTE_LOG(level, PMD, \
RTE_FMT("sfc_efx " PCI_PRI_FMT " #%" PRIu8 ": " \
RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
- _pci_dev->addr.domain, \
- _pci_dev->addr.bus, \
- _pci_dev->addr.devid, \
- _pci_dev->addr.function, \
- _dev->data->port_id, \
+ _sa->pci_addr.domain, \
+ _sa->pci_addr.bus, \
+ _sa->pci_addr.devid, \
+ _sa->pci_addr.function, \
+ _sa->port_id, \
RTE_FMT_TAIL(__VA_ARGS__,))); \
} while (0)
--
2.9.4
next prev parent reply other threads:[~2017-05-17 12:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-17 12:25 [dpdk-dev] [PATCH 1/3] net/sfc: carefully cleanup on init failure and shutdown Andrew Rybchenko
2017-05-17 12:25 ` Andrew Rybchenko [this message]
2017-05-18 10:59 ` [dpdk-dev] [PATCH 2/3] net/sfc: use locally stored data for logging Ferruh Yigit
2017-05-18 14:01 ` Andrew Rybchenko
2017-05-17 12:25 ` [dpdk-dev] [PATCH 3/3] net/sfc: support multi-process Andrew Rybchenko
2017-05-18 14:00 ` [dpdk-dev] [PATCH v2 1/3] net/sfc: carefully cleanup on init failure and shutdown Andrew Rybchenko
2017-05-18 14:00 ` [dpdk-dev] [PATCH v2 2/3] net/sfc: use locally stored data for logging Andrew Rybchenko
2017-05-18 14:00 ` [dpdk-dev] [PATCH v2 3/3] net/sfc: support multi-process Andrew Rybchenko
2017-05-22 11:29 ` Ferruh Yigit
2017-05-22 12:07 ` Andrew Rybchenko
2017-05-22 12:36 ` Ferruh Yigit
2017-05-22 12:44 ` Andrew Rybchenko
2017-05-22 12:54 ` Ferruh Yigit
2017-05-22 15:18 ` Sergio Gonzalez Monroy
2017-05-22 15:42 ` [dpdk-dev] [PATCH v2 1/3] net/sfc: carefully cleanup on init failure and shutdown Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1495023908-10977-2-git-send-email-arybchenko@solarflare.com \
--to=arybchenko@solarflare.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).