From: Stephen Hemminger <shemminger@vyatta.com>
To: Ramachandra K <ramachandra.kuchimanchi@qlogic.com>
Cc: netdev@vger.kernel.org, rdreier@cisco.com,
poornima.kamath@qlogic.com, general@lists.openfabrics.org,
amar.mudrankit@qlogic.com
Subject: [ofa-general] Re: [PATCH 11/13] QLogic VNIC: Driver utility file - implements various utility macros
Date: Thu, 1 May 2008 07:58:16 -0700 [thread overview]
Message-ID: <20080501075816.1010ec3a@extreme> (raw)
In-Reply-To: <20080430172126.31725.48554.stgit@localhost.localdomain>
On Wed, 30 Apr 2008 22:51:26 +0530
Ramachandra K <ramachandra.kuchimanchi@qlogic.com> wrote:
> From: Poornima Kamath <poornima.kamath@qlogic.com>
>
> This patch adds the driver utility file which mainly contains utility
> macros for debugging of QLogic VNIC driver.
>
> Signed-off-by: Ramachandra K <ramachandra.kuchimanchi@qlogic.com>
> Signed-off-by: Amar Mudrankit <amar.mudrankit@qlogic.com>
> ---
>
> drivers/infiniband/ulp/qlgc_vnic/vnic_util.h | 251 ++++++++++++++++++++++++++
> 1 files changed, 251 insertions(+), 0 deletions(-)
> create mode 100644 drivers/infiniband/ulp/qlgc_vnic/vnic_util.h
>
> diff --git a/drivers/infiniband/ulp/qlgc_vnic/vnic_util.h b/drivers/infiniband/ulp/qlgc_vnic/vnic_util.h
> new file mode 100644
> index 0000000..4d7d540
> --- /dev/null
> +++ b/drivers/infiniband/ulp/qlgc_vnic/vnic_util.h
> @@ -0,0 +1,251 @@
> +/*
> + * Copyright (c) 2006 QLogic, Inc. All rights reserved.
> + *
> + * This software is available to you under a choice of one of two
> + * licenses. You may choose to be licensed under the terms of the GNU
> + * General Public License (GPL) Version 2, available from the file
> + * COPYING in the main directory of this source tree, or the
> + * OpenIB.org BSD license below:
> + *
> + * Redistribution and use in source and binary forms, with or
> + * without modification, are permitted provided that the following
> + * conditions are met:
> + *
> + * - Redistributions of source code must retain the above
> + * copyright notice, this list of conditions and the following
> + * disclaimer.
> + *
> + * - Redistributions in binary form must reproduce the above
> + * copyright notice, this list of conditions and the following
> + * disclaimer in the documentation and/or other materials
> + * provided with the distribution.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
> + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
> + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> + * SOFTWARE.
> + */
> +
> +#ifndef VNIC_UTIL_H_INCLUDED
> +#define VNIC_UTIL_H_INCLUDED
> +
> +#define MODULE_NAME "QLGC_VNIC"
> +
> +#define VNIC_MAJORVERSION 1
> +#define VNIC_MINORVERSION 1
> +
> +#define is_power_of2(value) (((value) & ((value - 1))) == 0)
> +#define ALIGN_DOWN(x, a) ((x)&(~((a)-1)))
In kernel.h already
> +extern u32 vnic_debug;
Use msg level macros instead?
> +
> +enum {
> + DEBUG_IB_INFO = 0x00000001,
> + DEBUG_IB_FUNCTION = 0x00000002,
> + DEBUG_IB_FSTATUS = 0x00000004,
> + DEBUG_IB_ASSERTS = 0x00000008,
> + DEBUG_CONTROL_INFO = 0x00000010,
> + DEBUG_CONTROL_FUNCTION = 0x00000020,
> + DEBUG_CONTROL_PACKET = 0x00000040,
> + DEBUG_CONFIG_INFO = 0x00000100,
> + DEBUG_DATA_INFO = 0x00001000,
> + DEBUG_DATA_FUNCTION = 0x00002000,
> + DEBUG_NETPATH_INFO = 0x00010000,
> + DEBUG_VIPORT_INFO = 0x00100000,
> + DEBUG_VIPORT_FUNCTION = 0x00200000,
> + DEBUG_LINK_STATE = 0x00400000,
> + DEBUG_VNIC_INFO = 0x01000000,
> + DEBUG_VNIC_FUNCTION = 0x02000000,
> + DEBUG_MCAST_INFO = 0x04000000,
> + DEBUG_MCAST_FUNCTION = 0x08000000,
> + DEBUG_SYS_INFO = 0x10000000,
> + DEBUG_SYS_VERBOSE = 0x40000000
> +};
> +
> +#ifdef CONFIG_INFINIBAND_QLGC_VNIC_DEBUG
> +#define PRINT(level, x, fmt, arg...) \
> + printk(level "%s: %s: %s, line %d: " fmt, \
> + MODULE_NAME, x, __FILE__, __LINE__, ##arg)
> +
> +#define PRINT_CONDITIONAL(level, x, condition, fmt, arg...) \
> + do { \
> + if (condition) \
> + printk(level "%s: %s: %s, line %d: " fmt, \
> + MODULE_NAME, x, __FILE__, __LINE__, \
> + ##arg); \
> + } while (0)
> +#else
> +#define PRINT(level, x, fmt, arg...) \
> + printk(level "%s: " fmt, MODULE_NAME, ##arg)
> +
> +#define PRINT_CONDITIONAL(level, x, condition, fmt, arg...) \
> + do { \
> + if (condition) \
> + printk(level "%s: %s: " fmt, \
> + MODULE_NAME, x, ##arg); \
> + } while (0)
> +#endif /*CONFIG_INFINIBAND_QLGC_VNIC_DEBUG*/
> +
> +#define IB_PRINT(fmt, arg...) \
> + PRINT(KERN_INFO, "IB", fmt, ##arg)
> +#define IB_ERROR(fmt, arg...) \
> + PRINT(KERN_ERR, "IB", fmt, ##arg)
> +
> +#define IB_FUNCTION(fmt, arg...) \
> + PRINT_CONDITIONAL(KERN_INFO, \
> + "IB", \
> + (vnic_debug & DEBUG_IB_FUNCTION), \
> + fmt, ##arg)
> +
> +#define IB_INFO(fmt, arg...) \
> + PRINT_CONDITIONAL(KERN_INFO, \
> + "IB", \
> + (vnic_debug & DEBUG_IB_INFO), \
> + fmt, ##arg)
> +
> +#define IB_ASSERT(x) \
> + do { \
> + if ((vnic_debug & DEBUG_IB_ASSERTS) && !(x)) \
> + panic("%s assertion failed, file: %s," \
> + " line %d: ", \
> + MODULE_NAME, __FILE__, __LINE__) \
> + } while (0)
> +
> +#define CONTROL_PRINT(fmt, arg...) \
> + PRINT(KERN_INFO, "CONTROL", fmt, ##arg)
> +#define CONTROL_ERROR(fmt, arg...) \
> + PRINT(KERN_ERR, "CONTROL", fmt, ##arg)
> +
> +#define CONTROL_INFO(fmt, arg...) \
> + PRINT_CONDITIONAL(KERN_INFO, \
> + "CONTROL", \
> + (vnic_debug & DEBUG_CONTROL_INFO), \
> + fmt, ##arg)
> +
> +#define CONTROL_FUNCTION(fmt, arg...) \
> + PRINT_CONDITIONAL(KERN_INFO, \
> + "CONTROL", \
> + (vnic_debug & DEBUG_CONTROL_FUNCTION), \
> + fmt, ##arg)
> +
> +#define CONTROL_PACKET(pkt) \
> + do { \
> + if (vnic_debug & DEBUG_CONTROL_PACKET) \
> + control_log_control_packet(pkt); \
> + } while (0)
> +
> +#define CONFIG_PRINT(fmt, arg...) \
> + PRINT(KERN_INFO, "CONFIG", fmt, ##arg)
> +#define CONFIG_ERROR(fmt, arg...) \
> + PRINT(KERN_ERR, "CONFIG", fmt, ##arg)
> +
> +#define CONFIG_INFO(fmt, arg...) \
> + PRINT_CONDITIONAL(KERN_INFO, \
> + "CONFIG", \
> + (vnic_debug & DEBUG_CONFIG_INFO), \
> + fmt, ##arg)
> +
> +#define DATA_PRINT(fmt, arg...) \
> + PRINT(KERN_INFO, "DATA", fmt, ##arg)
> +#define DATA_ERROR(fmt, arg...) \
> + PRINT(KERN_ERR, "DATA", fmt, ##arg)
> +
> +#define DATA_INFO(fmt, arg...) \
> + PRINT_CONDITIONAL(KERN_INFO, \
> + "DATA", \
> + (vnic_debug & DEBUG_DATA_INFO), \
> + fmt, ##arg)
> +
> +#define DATA_FUNCTION(fmt, arg...) \
> + PRINT_CONDITIONAL(KERN_INFO, \
> + "DATA", \
> + (vnic_debug & DEBUG_DATA_FUNCTION), \
> + fmt, ##arg)
> +
> +
> +#define MCAST_PRINT(fmt, arg...) \
> + PRINT(KERN_INFO, "MCAST", fmt, ##arg)
> +#define MCAST_ERROR(fmt, arg...) \
> + PRINT(KERN_ERR, "MCAST", fmt, ##arg)
> +
> +#define MCAST_INFO(fmt, arg...) \
> + PRINT_CONDITIONAL(KERN_INFO, \
> + "MCAST", \
> + (vnic_debug & DEBUG_MCAST_INFO), \
> + fmt, ##arg)
> +
> +#define MCAST_FUNCTION(fmt, arg...) \
> + PRINT_CONDITIONAL(KERN_INFO, \
> + "MCAST", \
> + (vnic_debug & DEBUG_MCAST_FUNCTION), \
> + fmt, ##arg)
> +
> +#define NETPATH_PRINT(fmt, arg...) \
> + PRINT(KERN_INFO, "NETPATH", fmt, ##arg)
> +#define NETPATH_ERROR(fmt, arg...) \
> + PRINT(KERN_ERR, "NETPATH", fmt, ##arg)
> +
> +#define NETPATH_INFO(fmt, arg...) \
> + PRINT_CONDITIONAL(KERN_INFO, \
> + "NETPATH", \
> + (vnic_debug & DEBUG_NETPATH_INFO), \
> + fmt, ##arg)
> +
> +#define VIPORT_PRINT(fmt, arg...) \
> + PRINT(KERN_INFO, "VIPORT", fmt, ##arg)
> +#define VIPORT_ERROR(fmt, arg...) \
> + PRINT(KERN_ERR, "VIPORT", fmt, ##arg)
> +
> +#define VIPORT_INFO(fmt, arg...) \
> + PRINT_CONDITIONAL(KERN_INFO, \
> + "VIPORT", \
> + (vnic_debug & DEBUG_VIPORT_INFO), \
> + fmt, ##arg)
> +
> +#define VIPORT_FUNCTION(fmt, arg...) \
> + PRINT_CONDITIONAL(KERN_INFO, \
> + "VIPORT", \
> + (vnic_debug & DEBUG_VIPORT_FUNCTION), \
> + fmt, ##arg)
> +
> +#define LINK_STATE(fmt, arg...) \
> + PRINT_CONDITIONAL(KERN_INFO, \
> + "LINK", \
> + (vnic_debug & DEBUG_LINK_STATE), \
> + fmt, ##arg)
> +
> +#define VNIC_PRINT(fmt, arg...) \
> + PRINT(KERN_INFO, "NIC", fmt, ##arg)
> +#define VNIC_ERROR(fmt, arg...) \
> + PRINT(KERN_ERR, "NIC", fmt, ##arg)
> +#define VNIC_INIT(fmt, arg...) \
> + PRINT(KERN_INFO, "NIC", fmt, ##arg)
> +
> +#define VNIC_INFO(fmt, arg...) \
> + PRINT_CONDITIONAL(KERN_INFO, \
> + "NIC", \
> + (vnic_debug & DEBUG_VNIC_INFO), \
> + fmt, ##arg)
> +
> +#define VNIC_FUNCTION(fmt, arg...) \
> + PRINT_CONDITIONAL(KERN_INFO, \
> + "NIC", \
> + (vnic_debug & DEBUG_VNIC_FUNCTION), \
> + fmt, ##arg)
> +
> +#define SYS_PRINT(fmt, arg...) \
> + PRINT(KERN_INFO, "SYS", fmt, ##arg)
> +#define SYS_ERROR(fmt, arg...) \
> + PRINT(KERN_ERR, "SYS", fmt, ##arg)
> +
> +#define SYS_INFO(fmt, arg...) \
> + PRINT_CONDITIONAL(KERN_INFO, \
> + "SYS", \
> + (vnic_debug & DEBUG_SYS_INFO), \
> + fmt, ##arg)
> +
> +#endif /* VNIC_UTIL_H_INCLUDED */
Many of these are already in standard macros pr_info, pr_err etc.
next prev parent reply other threads:[~2008-05-01 14:58 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-30 17:15 [ofa-general] [PATCH 00/13] QLogic Virtual NIC (VNIC) Driver Ramachandra K
2008-04-30 17:16 ` [ofa-general] [PATCH 01/13] QLogic VNIC: Driver - netdev implementation Ramachandra K
2008-05-02 18:15 ` Roland Dreier
2008-05-05 15:36 ` [ofa-general] " Ramachandra K
2008-05-05 20:42 ` Roland Dreier
2008-04-30 17:16 ` [ofa-general] [PATCH 02/13] QLogic VNIC: Netpath - abstraction of connection to EVIC/VEx Ramachandra K
2008-04-30 17:17 ` [ofa-general] [PATCH 03/13] QLogic VNIC: Implementation of communication protocol with EVIC/VEx Ramachandra K
2008-04-30 17:17 ` [ofa-general] [PATCH 04/13] QLogic VNIC: Implementation of Control path of communication protocol Ramachandra K
2008-04-30 17:18 ` [ofa-general] [PATCH 05/13] QLogic VNIC: Implementation of Data " Ramachandra K
2008-04-30 17:18 ` [ofa-general] [PATCH 06/13] QLogic VNIC: IB core stack interaction Ramachandra K
2008-05-13 20:40 ` [ofa-general] " Roland Dreier
2008-04-30 17:19 ` [ofa-general] [PATCH 07/13] QLogic VNIC: Handling configurable parameters of the driver Ramachandra K
2008-05-13 20:41 ` Roland Dreier
2008-04-30 17:19 ` [ofa-general] [PATCH 08/13] QLogic VNIC: sysfs interface implementation for " Ramachandra K
2008-05-01 14:56 ` Stephen Hemminger
2008-05-01 16:02 ` [ofa-general] " Kuchimanchi, Ramachandra (Contractor - )
2008-05-01 16:43 ` [ofa-general] [RESEND] " Ramachandra K
2008-05-01 18:22 ` [ofa-general] " Stephen Hemminger
2008-04-30 17:20 ` [ofa-general] [PATCH 09/13] QLogic VNIC: IB Multicast for Ethernet broadcast/multicast Ramachandra K
2008-05-15 22:38 ` Roland Dreier
2008-04-30 17:20 ` [ofa-general] [PATCH 10/13] QLogic VNIC: Driver Statistics collection Ramachandra K
2008-05-15 22:33 ` Roland Dreier
2008-05-20 16:52 ` [ofa-general] " Ramachandra K
2008-04-30 17:21 ` [PATCH 11/13] QLogic VNIC: Driver utility file - implements various utility macros Ramachandra K
2008-05-01 14:58 ` Stephen Hemminger [this message]
2008-05-01 16:18 ` [ofa-general] " Kuchimanchi, Ramachandra (Contractor - )
2008-05-01 17:01 ` Ramachandra K
2008-05-01 18:26 ` Stephen Hemminger
2008-04-30 17:21 ` [ofa-general] [PATCH 12/13] QLogic VNIC: Driver Kconfig and Makefile Ramachandra K
2008-05-15 22:31 ` Roland Dreier
2008-04-30 17:22 ` [ofa-general] [PATCH 13/13] QLogic VNIC: Modifications to IB " Ramachandra K
2008-04-30 22:25 ` [ofa-general] Re: [PATCH 00/13] QLogic Virtual NIC (VNIC) Driver Roland Dreier
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=20080501075816.1010ec3a@extreme \
--to=shemminger@vyatta.com \
--cc=amar.mudrankit@qlogic.com \
--cc=general@lists.openfabrics.org \
--cc=netdev@vger.kernel.org \
--cc=poornima.kamath@qlogic.com \
--cc=ramachandra.kuchimanchi@qlogic.com \
--cc=rdreier@cisco.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.