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