From: Igor Russkikh <igor.russkikh@aquantia.com>
To: dev@dpdk.org
Cc: pavel.belous@aquantia.com, igor.russkikh@aquantia.com
Subject: [dpdk-dev] [PATCH v2 03/21] net/atlantic: logging macroes and some typedefs
Date: Thu, 13 Sep 2018 14:35:10 +0300 [thread overview]
Message-ID: <1536838528-11800-3-git-send-email-igor.russkikh@aquantia.com> (raw)
In-Reply-To: <1536838528-11800-1-git-send-email-igor.russkikh@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
drivers/net/atlantic/atl_ethdev.c | 18 +++++++++--
drivers/net/atlantic/atl_logs.h | 68 +++++++++++++++++++++++++++++++++++++++
drivers/net/atlantic/atl_types.h | 35 ++++++++++++++++++++
3 files changed, 118 insertions(+), 3 deletions(-)
create mode 100644 drivers/net/atlantic/atl_logs.h
create mode 100644 drivers/net/atlantic/atl_types.h
diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c
index a1b1002ec..951e0f386 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -146,6 +146,8 @@ eth_atl_dev_init(struct rte_eth_dev *eth_dev)
struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
int err = 0;
+ PMD_INIT_FUNC_TRACE();
+
eth_dev->dev_ops = &atl_eth_dev_ops;
eth_dev->rx_pkt_burst = &atl_recv_pkts;
eth_dev->tx_pkt_burst = &atl_xmit_pkts;
@@ -165,6 +167,8 @@ eth_atl_dev_uninit(struct rte_eth_dev *eth_dev)
struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
struct aq_hw_s *hw;
+ PMD_INIT_FUNC_TRACE();
+
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return -EPERM;
@@ -220,17 +224,25 @@ atl_dev_start(struct rte_eth_dev *dev)
!RTE_ETH_DEV_SRIOV(dev).active) &&
dev->data->dev_conf.intr_conf.rxq != 0) {
intr_vector = dev->data->nb_rx_queues;
- if (intr_vector > ATL_MAX_INTR_QUEUE_NUM)
+ if (intr_vector > ATL_MAX_INTR_QUEUE_NUM) {
+ PMD_INIT_LOG(ERR, "At most %d intr queues supported",
+ ATL_MAX_INTR_QUEUE_NUM);
return -ENOTSUP;
- if (rte_intr_efd_enable(intr_handle, intr_vector))
+ }
+ if (rte_intr_efd_enable(intr_handle, intr_vector)) {
+ PMD_INIT_LOG(ERR, "rte_intr_efd_enable failed");
return -1;
+ }
}
if (rte_intr_dp_is_en(intr_handle) && !intr_handle->intr_vec) {
intr_handle->intr_vec = rte_zmalloc("intr_vec",
dev->data->nb_rx_queues * sizeof(int), 0);
- if (intr_handle->intr_vec == NULL)
+ if (intr_handle->intr_vec == NULL) {
+ PMD_INIT_LOG(ERR, "Failed to allocate %d rx_queues"
+ " intr_vec", dev->data->nb_rx_queues);
return -ENOMEM;
+ }
}
return 0;
diff --git a/drivers/net/atlantic/atl_logs.h b/drivers/net/atlantic/atl_logs.h
new file mode 100644
index 000000000..b6e566190
--- /dev/null
+++ b/drivers/net/atlantic/atl_logs.h
@@ -0,0 +1,68 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Aquantia Corporation
+ */
+#ifndef ATL_LOGS_H
+#define ATL_LOGS_H
+
+#include <rte_log.h>
+
+extern int atl_logtype_init;
+
+#ifndef RTE_LIBRTE_ATLANTIC_DEBUG
+#define RTE_LIBRTE_ATLANTIC_DEBUG 0
+#endif
+
+#ifndef RTE_LIBRTE_ATLANTIC_DEBUG_RX
+#define RTE_LIBRTE_ATLANTIC_DEBUG_RX 0
+#endif
+
+#ifndef RTE_LIBRTE_ATLANTIC_DEBUG_TX
+#define RTE_LIBRTE_ATLANTIC_DEBUG_TX 0
+#endif
+
+#ifndef RTE_LIBRTE_ATLANTIC_DEBUG_TX_FREE
+#define RTE_LIBRTE_ATLANTIC_DEBUG_TX_FREE 0
+#endif
+
+
+
+#if RTE_LIBRTE_ATLANTIC_DEBUG
+#define PMD_INIT_LOG(level, fmt, args...) \
+ rte_log(RTE_LOG_ ## level, atl_logtype_init, \
+ "%s(): " fmt "\n", __func__, ##args)
+#else
+#define PMD_INIT_LOG(level, fmt, args...) do { } while (0)
+#endif
+
+#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
+
+#if RTE_LIBRTE_ATLANTIC_DEBUG_RX
+#define PMD_RX_LOG(level, fmt, args...) \
+ RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+#else
+#define PMD_RX_LOG(level, fmt, args...) do { } while (0)
+#endif
+
+#if RTE_LIBRTE_ATLANTIC_DEBUG_TX
+#define PMD_TX_LOG(level, fmt, args...) \
+ RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+#else
+#define PMD_TX_LOG(level, fmt, args...) do { } while (0)
+#endif
+
+#if RTE_LIBRTE_ATLANTIC_DEBUG_TX_FREE
+#define PMD_TX_FREE_LOG(level, fmt, args...) \
+ RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+#else
+#define PMD_TX_FREE_LOG(level, fmt, args...) do { } while (0)
+#endif
+
+extern int atl_logtype_driver;
+#define PMD_DRV_LOG_RAW(level, fmt, args...) \
+ rte_log(RTE_LOG_ ## level, atl_logtype_driver, "%s(): " fmt, \
+ __func__, ## args)
+
+#define PMD_DRV_LOG(level, fmt, args...) \
+ PMD_DRV_LOG_RAW(level, fmt "\n", ## args)
+
+#endif
diff --git a/drivers/net/atlantic/atl_types.h b/drivers/net/atlantic/atl_types.h
new file mode 100644
index 000000000..1684c8cd8
--- /dev/null
+++ b/drivers/net/atlantic/atl_types.h
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Aquantia Corporation
+ */
+#ifndef ATL_TYPES_H
+#define ATL_TYPES_H
+
+#include <stdint.h>
+#include <stddef.h>
+#include <inttypes.h>
+#include <string.h>
+#include <netinet/in.h>
+
+typedef uint8_t u8;
+typedef int8_t s8;
+typedef uint16_t u16;
+typedef int16_t s16;
+typedef uint32_t u32;
+typedef int32_t s32;
+typedef uint64_t u64;
+#ifndef __cplusplus
+typedef int bool;
+#endif
+
+#define FALSE 0
+#define TRUE 1
+
+#define false 0
+#define true 1
+#define min(a, b) RTE_MIN(a, b)
+#define max(a, b) RTE_MAX(a, b)
+
+/* Memory barrier */
+#define wmb() rte_wmb()
+
+#endif
--
2.13.3.windows.1
next prev parent reply other threads:[~2018-09-13 11:35 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-13 11:35 [dpdk-dev] [PATCH v2 01/21] net/atlantic: atlantic PMD driver skeleton Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 02/21] net/atlantic: documentation and rel notes Igor Russkikh
2018-09-13 11:35 ` Igor Russkikh [this message]
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 04/21] net/atlantic: hw_atl register declarations Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 05/21] net/atlantic: b0 hardware layer main logic Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 06/21] net/atlantic: firmware operations layer Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 07/21] net/atlantic: hardware register access routines Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 08/21] net/atlantic: rte device start, stop, initial configuration Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 09/21] net/atlantic: link status and interrupt management Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 10/21] net/atlantic: add hw adapter structures and defines Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 11/21] net/atlantic: RSS and RETA manipulation API Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 12/21] net/atlantic: flow control configuration Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 13/21] net/atlantic: MAC address manipulations Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 14/21] net/atlantic: eeprom and register manipulation routines Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 15/21] net/atlantic: LED control DPDK and private APIs Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 16/21] net/atlantic: promisc and allmulti configuration Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 17/21] net/atlantic: device statistics, xstats Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 18/21] net/atlantic: VLAN filters and offloads Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 19/21] net/atlantic: device MTU and statuses Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 20/21] net/atlantic: RX side structures and implementation Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 21/21] net/atlantic: TX " Igor Russkikh
2018-09-21 14:21 ` [dpdk-dev] [PATCH v2 01/21] net/atlantic: atlantic PMD driver skeleton Ferruh Yigit
2018-09-21 15:35 ` Igor Russkikh
2018-09-21 17:04 ` 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=1536838528-11800-3-git-send-email-igor.russkikh@aquantia.com \
--to=igor.russkikh@aquantia.com \
--cc=dev@dpdk.org \
--cc=pavel.belous@aquantia.com \
/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).