2 * Copyright (c) 2003-2009 RMI Corporation
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of RMI Corporation, nor the names of its contributors,
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 #include <machine/atomic.h>
50 NETIF_TX_COMPLETE_CYCLES,
57 REPLENISH_ENTER_COUNT,
75 USER_MAC_TX_FAIL_GMAC_CREDITS = 32,
76 USER_MAC_DO_PAGE_FAULT,
78 USER_MAC_UPDATE_BIGTLB,
79 USER_MAC_UPDATE_TLB_PFN0,
80 USER_MAC_UPDATE_TLB_PFN1,
84 extern int xlr_counters[MAXCPU][XLR_MAX_COUNTERS];
85 extern __uint32_t msgrng_msg_cycles;
88 #define xlr_inc_counter(x) atomic_add_int(&xlr_counters[PCPU_GET(cpuid)][(x)], 1)
89 #define xlr_dec_counter(x) atomic_subtract_int(&xlr_counters[PCPU_GET(cpuid)][(x)], 1)
90 #define xlr_set_counter(x, value) atomic_set_int(&xlr_counters[PCPU_GET(cpuid)][(x)], (value))
91 #define xlr_get_counter(x) (&xlr_counters[0][(x)])
93 #else /* default mode */
95 #define xlr_inc_counter(x)
96 #define xlr_dec_counter(x)
97 #define xlr_set_counter(x, value)
98 #define xlr_get_counter(x)
102 #define dbg_msg(fmt, args...) printf(fmt, ##args)
103 #define dbg_panic(fmt, args...) panic(fmt, ##args)