1*9da57d7bSbt150084 /* 2*9da57d7bSbt150084 * CDDL HEADER START 3*9da57d7bSbt150084 * 4*9da57d7bSbt150084 * Copyright(c) 2007-2008 Intel Corporation. All rights reserved. 5*9da57d7bSbt150084 * The contents of this file are subject to the terms of the 6*9da57d7bSbt150084 * Common Development and Distribution License (the "License"). 7*9da57d7bSbt150084 * You may not use this file except in compliance with the License. 8*9da57d7bSbt150084 * 9*9da57d7bSbt150084 * You can obtain a copy of the license at: 10*9da57d7bSbt150084 * http://www.opensolaris.org/os/licensing. 11*9da57d7bSbt150084 * See the License for the specific language governing permissions 12*9da57d7bSbt150084 * and limitations under the License. 13*9da57d7bSbt150084 * 14*9da57d7bSbt150084 * When using or redistributing this file, you may do so under the 15*9da57d7bSbt150084 * License only. No other modification of this header is permitted. 16*9da57d7bSbt150084 * 17*9da57d7bSbt150084 * If applicable, add the following below this CDDL HEADER, with the 18*9da57d7bSbt150084 * fields enclosed by brackets "[]" replaced with your own identifying 19*9da57d7bSbt150084 * information: Portions Copyright [yyyy] [name of copyright owner] 20*9da57d7bSbt150084 * 21*9da57d7bSbt150084 * CDDL HEADER END 22*9da57d7bSbt150084 */ 23*9da57d7bSbt150084 24*9da57d7bSbt150084 /* 25*9da57d7bSbt150084 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 26*9da57d7bSbt150084 * Use is subject to license terms of the CDDL. 27*9da57d7bSbt150084 */ 28*9da57d7bSbt150084 29*9da57d7bSbt150084 #pragma ident "%Z%%M% %I% %E% SMI" 30*9da57d7bSbt150084 31*9da57d7bSbt150084 #include "ixgbe_sw.h" 32*9da57d7bSbt150084 33*9da57d7bSbt150084 #define LOG_BUF_LEN 128 34*9da57d7bSbt150084 35*9da57d7bSbt150084 /* 36*9da57d7bSbt150084 * ixgbe_notice - Report a run-time event (CE_NOTE, to console & log) 37*9da57d7bSbt150084 */ 38*9da57d7bSbt150084 void 39*9da57d7bSbt150084 ixgbe_notice(void *arg, const char *fmt, ...) 40*9da57d7bSbt150084 { 41*9da57d7bSbt150084 ixgbe_t *ixgbep = (ixgbe_t *)arg; 42*9da57d7bSbt150084 char buf[LOG_BUF_LEN]; 43*9da57d7bSbt150084 va_list ap; 44*9da57d7bSbt150084 45*9da57d7bSbt150084 va_start(ap, fmt); 46*9da57d7bSbt150084 (void) vsnprintf(buf, sizeof (buf), fmt, ap); 47*9da57d7bSbt150084 va_end(ap); 48*9da57d7bSbt150084 49*9da57d7bSbt150084 if (ixgbep != NULL) 50*9da57d7bSbt150084 cmn_err(CE_NOTE, "%s%d: %s", MODULE_NAME, ixgbep->instance, 51*9da57d7bSbt150084 buf); 52*9da57d7bSbt150084 else 53*9da57d7bSbt150084 cmn_err(CE_NOTE, "%s: %s", MODULE_NAME, buf); 54*9da57d7bSbt150084 } 55*9da57d7bSbt150084 56*9da57d7bSbt150084 /* 57*9da57d7bSbt150084 * ixgbe_log - Log a run-time event (CE_NOTE, to log only) 58*9da57d7bSbt150084 */ 59*9da57d7bSbt150084 void 60*9da57d7bSbt150084 ixgbe_log(void *arg, const char *fmt, ...) 61*9da57d7bSbt150084 { 62*9da57d7bSbt150084 ixgbe_t *ixgbep = (ixgbe_t *)arg; 63*9da57d7bSbt150084 char buf[LOG_BUF_LEN]; 64*9da57d7bSbt150084 va_list ap; 65*9da57d7bSbt150084 66*9da57d7bSbt150084 va_start(ap, fmt); 67*9da57d7bSbt150084 (void) vsnprintf(buf, sizeof (buf), fmt, ap); 68*9da57d7bSbt150084 va_end(ap); 69*9da57d7bSbt150084 70*9da57d7bSbt150084 if (ixgbep != NULL) 71*9da57d7bSbt150084 cmn_err(CE_NOTE, "!%s%d: %s", MODULE_NAME, ixgbep->instance, 72*9da57d7bSbt150084 buf); 73*9da57d7bSbt150084 else 74*9da57d7bSbt150084 cmn_err(CE_NOTE, "!%s: %s", MODULE_NAME, buf); 75*9da57d7bSbt150084 } 76*9da57d7bSbt150084 77*9da57d7bSbt150084 /* 78*9da57d7bSbt150084 * ixgbe_error - Log a run-time problem (CE_WARN, to log only) 79*9da57d7bSbt150084 */ 80*9da57d7bSbt150084 void 81*9da57d7bSbt150084 ixgbe_error(void *arg, const char *fmt, ...) 82*9da57d7bSbt150084 { 83*9da57d7bSbt150084 ixgbe_t *ixgbep = (ixgbe_t *)arg; 84*9da57d7bSbt150084 char buf[LOG_BUF_LEN]; 85*9da57d7bSbt150084 va_list ap; 86*9da57d7bSbt150084 87*9da57d7bSbt150084 va_start(ap, fmt); 88*9da57d7bSbt150084 (void) vsnprintf(buf, sizeof (buf), fmt, ap); 89*9da57d7bSbt150084 va_end(ap); 90*9da57d7bSbt150084 91*9da57d7bSbt150084 if (ixgbep != NULL) 92*9da57d7bSbt150084 cmn_err(CE_WARN, "!%s%d: %s", MODULE_NAME, ixgbep->instance, 93*9da57d7bSbt150084 buf); 94*9da57d7bSbt150084 else 95*9da57d7bSbt150084 cmn_err(CE_WARN, "!%s: %s", MODULE_NAME, buf); 96*9da57d7bSbt150084 } 97