1 /****************************************************************************** 2 3 Copyright (c) 2013-2018, Intel Corporation 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 9 1. Redistributions of source code must retain the above copyright notice, 10 this list of conditions and the following disclaimer. 11 12 2. Redistributions in binary form must reproduce the above copyright 13 notice, this list of conditions and the following disclaimer in the 14 documentation and/or other materials provided with the distribution. 15 16 3. Neither the name of the Intel Corporation nor the names of its 17 contributors may be used to endorse or promote products derived from 18 this software without specific prior written permission. 19 20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 POSSIBILITY OF SUCH DAMAGE. 31 32 ******************************************************************************/ 33 /*$FreeBSD$*/ 34 35 #ifndef _IXL_DEBUG_H_ 36 #define _IXL_DEBUG_H_ 37 38 #define MAC_FORMAT "%02x:%02x:%02x:%02x:%02x:%02x" 39 #define MAC_FORMAT_ARGS(mac_addr) \ 40 (mac_addr)[0], (mac_addr)[1], (mac_addr)[2], (mac_addr)[3], \ 41 (mac_addr)[4], (mac_addr)[5] 42 #define ON_OFF_STR(is_set) ((is_set) ? "On" : "Off") 43 44 #ifdef IXL_DEBUG 45 46 #define _DBG_PRINTF(S, ...) printf("%s: " S "\n", __func__, ##__VA_ARGS__) 47 #define _DEV_DBG_PRINTF(dev, S, ...) device_printf(dev, "%s: " S "\n", __func__, ##__VA_ARGS__) 48 #define _IF_DBG_PRINTF(ifp, S, ...) if_printf(ifp, "%s: " S "\n", __func__, ##__VA_ARGS__) 49 50 /* Defines for printing generic debug information */ 51 #define DPRINTF(...) _DBG_PRINTF(__VA_ARGS__) 52 #define DDPRINTF(...) _DEV_DBG_PRINTF(__VA_ARGS__) 53 #define IDPRINTF(...) _IF_DBG_PRINTF(__VA_ARGS__) 54 55 /* Defines for printing specific debug information */ 56 #define DEBUG_INIT 1 57 #define DEBUG_IOCTL 1 58 #define DEBUG_HW 1 59 60 #define INIT_DEBUGOUT(...) if (DEBUG_INIT) _DBG_PRINTF(__VA_ARGS__) 61 #define INIT_DBG_DEV(...) if (DEBUG_INIT) _DEV_DBG_PRINTF(__VA_ARGS__) 62 #define INIT_DBG_IF(...) if (DEBUG_INIT) _IF_DBG_PRINTF(__VA_ARGS__) 63 64 #define IOCTL_DEBUGOUT(...) if (DEBUG_IOCTL) _DBG_PRINTF(__VA_ARGS__) 65 #define IOCTL_DBG_IF2(ifp, S, ...) if (DEBUG_IOCTL) \ 66 if_printf(ifp, S "\n", ##__VA_ARGS__) 67 #define IOCTL_DBG_IF(...) if (DEBUG_IOCTL) _IF_DBG_PRINTF(__VA_ARGS__) 68 69 #define HW_DEBUGOUT(...) if (DEBUG_HW) _DBG_PRINTF(__VA_ARGS__) 70 71 #else /* no IXL_DEBUG */ 72 #define DEBUG_INIT 0 73 #define DEBUG_IOCTL 0 74 #define DEBUG_HW 0 75 76 #define DPRINTF(...) 77 #define DDPRINTF(...) 78 #define IDPRINTF(...) 79 80 #define INIT_DEBUGOUT(...) 81 #define INIT_DBG_DEV(...) 82 #define INIT_DBG_IF(...) 83 #define IOCTL_DEBUGOUT(...) 84 #define IOCTL_DBG_IF2(...) 85 #define IOCTL_DBG_IF(...) 86 #define HW_DEBUGOUT(...) 87 #endif /* IXL_DEBUG */ 88 89 enum ixl_dbg_mask { 90 IXL_DBG_INFO = 0x00000001, 91 IXL_DBG_EN_DIS = 0x00000002, 92 IXL_DBG_AQ = 0x00000004, 93 IXL_DBG_NVMUPD = 0x00000008, 94 95 IXL_DBG_IOCTL_KNOWN = 0x00000010, 96 IXL_DBG_IOCTL_UNKNOWN = 0x00000020, 97 IXL_DBG_IOCTL_ALL = 0x00000030, 98 99 I40E_DEBUG_RSS = 0x00000100, 100 101 IXL_DBG_IOV = 0x00001000, 102 IXL_DBG_IOV_VC = 0x00002000, 103 104 IXL_DBG_SWITCH_INFO = 0x00010000, 105 IXL_DBG_I2C = 0x00020000, 106 107 IXL_DBG_ALL = 0xFFFFFFFF 108 }; 109 110 #endif /* _IXL_DEBUG_H_ */ 111