From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 0D5C6C2FC for ; Fri, 12 Jun 2015 14:00:25 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 12 Jun 2015 05:00:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,601,1427785200"; d="scan'208";a="709791584" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 12 Jun 2015 05:00:14 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t5CBSHxM013686; Fri, 12 Jun 2015 12:28:17 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id t5CBSGkl002048; Fri, 12 Jun 2015 12:28:16 +0100 Received: (from bricha3@localhost) by sivswdev01.ir.intel.com with id t5CBSGP8002044; Fri, 12 Jun 2015 12:28:16 +0100 From: Bruce Richardson To: dev@dpdk.org Date: Fri, 12 Jun 2015 12:28:14 +0100 Message-Id: <1434108496-1993-3-git-send-email-bruce.richardson@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1434108496-1993-1-git-send-email-bruce.richardson@intel.com> References: <1434108496-1993-1-git-send-email-bruce.richardson@intel.com> Subject: [dpdk-dev] [PATCH 2/4] ethdev: move RTE_ETH_FPTR_OR_ERR macros to header X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jun 2015 12:00:26 -0000 Move the RTE_ETH_FPTR_OR_ERR, and RTE_PMD_DEBUG_TRACE macros to the header file, so that they can be used in the static inline functions there. In doxygen comments, mark them as for internal use only. Signed-off-by: Bruce Richardson --- lib/librte_ether/rte_ethdev.c | 22 ---------------------- lib/librte_ether/rte_ethdev.h | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 89471f1..7720a8e 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -69,14 +69,6 @@ #include "rte_ether.h" #include "rte_ethdev.h" -#ifdef RTE_LIBRTE_ETHDEV_DEBUG -#define RTE_PMD_DEBUG_TRACE(fmt, args...) do { \ - RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args); \ - } while (0) -#else -#define RTE_PMD_DEBUG_TRACE(fmt, args...) -#endif - /* Macros for checking for restricting functions to primary instance only */ #define PROC_PRIMARY_OR_ERR_RET(retval) do { \ if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \ @@ -91,20 +83,6 @@ } \ } while(0) -/* Macros to check for invlaid function pointers in dev_ops structure */ -#define RTE_ETH_FPTR_OR_ERR_RET(func, retval) do { \ - if ((func) == NULL) { \ - RTE_PMD_DEBUG_TRACE("Function not supported\n"); \ - return (retval); \ - } \ -} while(0) -#define RTE_ETH_FPTR_OR_RET(func) do { \ - if ((func) == NULL) { \ - RTE_PMD_DEBUG_TRACE("Function not supported\n"); \ - return; \ - } \ -} while(0) - static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data"; struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS]; static struct rte_eth_dev_data *rte_eth_dev_data = NULL; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index b640e5b..b1c1a31 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -948,6 +948,39 @@ struct rte_eth_dev_callback; /** @internal Structure to keep track of registered callbacks */ TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback); +/** + * @internal + * Macro to print a message if in debugging mode + */ +#ifdef RTE_LIBRTE_ETHDEV_DEBUG +#define RTE_PMD_DEBUG_TRACE(fmt, args...) do { \ + RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args); \ + } while (0) +#else +#define RTE_PMD_DEBUG_TRACE(fmt, args...) +#endif + +/** + * @internal + * Macro to check for invalid function pointer in dev_ops structure + */ +#define RTE_ETH_FPTR_OR_ERR_RET(func, retval) do { \ + if ((func) == NULL) { \ + RTE_PMD_DEBUG_TRACE("Function not supported\n"); \ + return (retval); \ + } \ +} while(0) +/** + * @internal + * Macro to check for invalid function pointer in dev_ops structure + */ +#define RTE_ETH_FPTR_OR_RET(func) do { \ + if ((func) == NULL) { \ + RTE_PMD_DEBUG_TRACE("Function not supported\n"); \ + return; \ + } \ +} while(0) + /* * Definitions of all functions exported by an Ethernet driver through the * the generic structure of type *eth_dev_ops* supplied in the *rte_eth_dev* -- 2.4.2