Signed-off-by: Igor Russkikh <igor.russk...@aquantia.com> --- drivers/net/atlantic/atl_ethdev.c | 9 +++++++ drivers/net/atlantic/atl_logs.h | 55 +++++++++++++++++++++++++++++++++++++++ drivers/net/atlantic/atl_types.h | 34 ++++++++++++++++++++++++ 3 files changed, 98 insertions(+) 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 16080ef9e..31ff50f18 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -145,6 +145,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,9 +224,12 @@ atl_dev_start(struct rte_eth_dev *dev) dev->data->dev_conf.intr_conf.rxq != 0) { intr_vector = dev->data->nb_rx_queues; 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)) { + PMD_INIT_LOG(ERR, "rte_intr_efd_enable failed"); return -1; } } @@ -231,6 +238,8 @@ atl_dev_start(struct rte_eth_dev *dev) intr_handle->intr_vec = rte_zmalloc("intr_vec", dev->data->nb_rx_queues * sizeof(int), 0); 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; } } diff --git a/drivers/net/atlantic/atl_logs.h b/drivers/net/atlantic/atl_logs.h new file mode 100644 index 000000000..c5020c3e4 --- /dev/null +++ b/drivers/net/atlantic/atl_logs.h @@ -0,0 +1,55 @@ +/* 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 + + +#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..f1558b0a5 --- /dev/null +++ b/drivers/net/atlantic/atl_types.h @@ -0,0 +1,34 @@ +/* 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) + +#define wmb() rte_wmb() + +#endif -- 2.13.3.windows.1