10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 23*1184Skrgopi * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 280Sstevel@tonic-gate 290Sstevel@tonic-gate /* 300Sstevel@tonic-gate * The intent of this file is to contain any data that must remain 310Sstevel@tonic-gate * resident in the kernel. 320Sstevel@tonic-gate * 330Sstevel@tonic-gate * space_store(), space_fetch(), and space_free() have been added to 340Sstevel@tonic-gate * easily store and retrieve kernel resident data. 350Sstevel@tonic-gate * These functions are recommended rather than adding new variables to 360Sstevel@tonic-gate * this file. 370Sstevel@tonic-gate * 380Sstevel@tonic-gate * Note that it's possible for name collisions to occur. In order to 390Sstevel@tonic-gate * prevent collisions, it's recommended that the convention in 400Sstevel@tonic-gate * PSARC/1997/389 be used. If a collision occurs, then space_store will 410Sstevel@tonic-gate * fail. 420Sstevel@tonic-gate */ 430Sstevel@tonic-gate 440Sstevel@tonic-gate #include <sys/types.h> 450Sstevel@tonic-gate #include <sys/param.h> 460Sstevel@tonic-gate #include <sys/var.h> 470Sstevel@tonic-gate #include <sys/proc.h> 480Sstevel@tonic-gate #include <sys/signal.h> 490Sstevel@tonic-gate #include <sys/utsname.h> 500Sstevel@tonic-gate #include <sys/buf.h> 510Sstevel@tonic-gate #include <sys/cred.h> 520Sstevel@tonic-gate #include <sys/vfs.h> 530Sstevel@tonic-gate #include <sys/vnode.h> 540Sstevel@tonic-gate #include <sys/sysinfo.h> 550Sstevel@tonic-gate #include <sys/t_lock.h> 560Sstevel@tonic-gate #include <sys/vmem.h> 570Sstevel@tonic-gate #include <sys/modhash.h> 580Sstevel@tonic-gate #include <sys/cmn_err.h> 590Sstevel@tonic-gate 600Sstevel@tonic-gate #include <sys/strredir.h> 610Sstevel@tonic-gate #include <sys/kbio.h> 620Sstevel@tonic-gate 630Sstevel@tonic-gate struct buf bfreelist; /* Head of the free list of buffers */ 640Sstevel@tonic-gate 650Sstevel@tonic-gate sysinfo_t sysinfo; 660Sstevel@tonic-gate vminfo_t vminfo; /* VM stats protected by sysinfolock mutex */ 670Sstevel@tonic-gate 680Sstevel@tonic-gate #ifdef lint 690Sstevel@tonic-gate int __lintzero; /* Alway zero for shutting up lint */ 700Sstevel@tonic-gate #endif 710Sstevel@tonic-gate 720Sstevel@tonic-gate /* 730Sstevel@tonic-gate * The following describe the physical memory configuration. 740Sstevel@tonic-gate * 750Sstevel@tonic-gate * physmem - The amount of physical memory configured 760Sstevel@tonic-gate * in pages. ptob(physmem) is the amount 770Sstevel@tonic-gate * of physical memory in bytes. Defined in 780Sstevel@tonic-gate * .../os/startup.c. 790Sstevel@tonic-gate * 800Sstevel@tonic-gate * physmax - The highest numbered physical page in memory. 810Sstevel@tonic-gate * 820Sstevel@tonic-gate * maxmem - Maximum available memory, in pages. Defined 830Sstevel@tonic-gate * in main.c. 840Sstevel@tonic-gate * 850Sstevel@tonic-gate * physinstalled 860Sstevel@tonic-gate * - Pages of physical memory installed; 870Sstevel@tonic-gate * includes use by PROM/boot not counted in 880Sstevel@tonic-gate * physmem. 890Sstevel@tonic-gate */ 900Sstevel@tonic-gate 910Sstevel@tonic-gate pfn_t physmax; 920Sstevel@tonic-gate pgcnt_t physinstalled; 930Sstevel@tonic-gate 940Sstevel@tonic-gate struct var v; 950Sstevel@tonic-gate 960Sstevel@tonic-gate #include <sys/systm.h> 970Sstevel@tonic-gate #include <sys/conf.h> 980Sstevel@tonic-gate #include <sys/kmem.h> 990Sstevel@tonic-gate #include <sys/sysmacros.h> 1000Sstevel@tonic-gate #include <sys/bootconf.h> 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate /* 1030Sstevel@tonic-gate * Data from swapgeneric.c that must be resident. 1040Sstevel@tonic-gate */ 1050Sstevel@tonic-gate struct vnode *rootvp; /* vnode of the root device */ 1060Sstevel@tonic-gate dev_t rootdev; /* dev_t of the root device */ 1070Sstevel@tonic-gate int root_is_svm; /* root is a mirrored device flag */ 1080Sstevel@tonic-gate 1090Sstevel@tonic-gate int netboot; 1100Sstevel@tonic-gate int obpdebug; 1110Sstevel@tonic-gate char *dhcack; /* Used to cache ascii form of DHCPACK handed up by boot */ 1120Sstevel@tonic-gate char *netdev_path; /* Used to cache the netdev_path handed up by boot */ 1130Sstevel@tonic-gate 1140Sstevel@tonic-gate /* 1150Sstevel@tonic-gate * Data from arp.c that must be resident. 1160Sstevel@tonic-gate */ 1170Sstevel@tonic-gate #include <sys/socket.h> 1180Sstevel@tonic-gate #include <sys/errno.h> 1190Sstevel@tonic-gate #include <sys/sockio.h> 1200Sstevel@tonic-gate #include <sys/stream.h> 1210Sstevel@tonic-gate #include <sys/stropts.h> 1220Sstevel@tonic-gate #include <sys/dlpi.h> 1230Sstevel@tonic-gate #include <net/if.h> 1240Sstevel@tonic-gate #include <net/if_arp.h> 1250Sstevel@tonic-gate #include <netinet/in.h> 1260Sstevel@tonic-gate #include <netinet/in_var.h> 1270Sstevel@tonic-gate #include <netinet/if_ether.h> 1280Sstevel@tonic-gate 1290Sstevel@tonic-gate ether_addr_t etherbroadcastaddr = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; 1300Sstevel@tonic-gate 1310Sstevel@tonic-gate /* 1320Sstevel@tonic-gate * Data from timod that must be resident 1330Sstevel@tonic-gate */ 1340Sstevel@tonic-gate 1350Sstevel@tonic-gate /* 1360Sstevel@tonic-gate * state transition table for TI interface 1370Sstevel@tonic-gate */ 1380Sstevel@tonic-gate #include <sys/tihdr.h> 1390Sstevel@tonic-gate 1400Sstevel@tonic-gate #define nr 127 /* not reachable */ 1410Sstevel@tonic-gate 1420Sstevel@tonic-gate char ti_statetbl[TE_NOEVENTS][TS_NOSTATES] = { 1430Sstevel@tonic-gate /* STATES */ 1440Sstevel@tonic-gate /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ 1450Sstevel@tonic-gate 1460Sstevel@tonic-gate { 1, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1470Sstevel@tonic-gate {nr, nr, nr, 2, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1480Sstevel@tonic-gate {nr, nr, nr, 4, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1490Sstevel@tonic-gate {nr, 3, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1500Sstevel@tonic-gate {nr, nr, nr, nr, 3, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1510Sstevel@tonic-gate {nr, 0, 3, nr, 3, 3, nr, nr, 7, nr, nr, nr, 6, 7, 9, 10, 11}, 1520Sstevel@tonic-gate {nr, nr, 0, nr, nr, 6, nr, nr, nr, nr, nr, nr, 3, nr, 3, 3, 3}, 1530Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, 9, nr, nr, nr, nr, 3, nr, nr, nr}, 1540Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, 3, nr, nr, nr, nr, 3, nr, nr, nr}, 1550Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, 7, nr, nr, nr, nr, 7, nr, nr, nr}, 1560Sstevel@tonic-gate {nr, nr, nr, 5, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1570Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, 8, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1580Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, 12, 13, nr, 14, 15, 16, nr, nr, nr, nr, nr}, 1590Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, nr, 9, nr, 11, nr, nr, nr, nr, nr}, 1600Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, nr, 9, nr, 11, nr, nr, nr, nr, nr}, 1610Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, nr, 10, nr, 3, nr, nr, nr, nr, nr}, 1620Sstevel@tonic-gate {nr, nr, nr, 7, nr, nr, nr, 7, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1630Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, 9, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1640Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, nr, 9, 10, nr, nr, nr, nr, nr, nr}, 1650Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, nr, 9, 10, nr, nr, nr, nr, nr, nr}, 1660Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, nr, 11, 3, nr, nr, nr, nr, nr, nr}, 1670Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, 3, nr, nr, 3, 3, 3, nr, nr, nr, nr, nr}, 1680Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, 3, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1690Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, 7, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1700Sstevel@tonic-gate {nr, nr, nr, 9, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1710Sstevel@tonic-gate {nr, nr, nr, 3, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1720Sstevel@tonic-gate {nr, nr, nr, 3, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1730Sstevel@tonic-gate {nr, nr, nr, 3, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1740Sstevel@tonic-gate }; 1750Sstevel@tonic-gate 1760Sstevel@tonic-gate 1770Sstevel@tonic-gate #include <sys/sad.h> 1780Sstevel@tonic-gate #include <sys/tty.h> 1790Sstevel@tonic-gate #include <sys/ptyvar.h> 1800Sstevel@tonic-gate 1810Sstevel@tonic-gate static void store_fetch_initspace(); 1820Sstevel@tonic-gate 1830Sstevel@tonic-gate /* 1840Sstevel@tonic-gate * Allocate tunable structures at runtime. 1850Sstevel@tonic-gate */ 1860Sstevel@tonic-gate void 1870Sstevel@tonic-gate space_init(void) 1880Sstevel@tonic-gate { 1890Sstevel@tonic-gate sad_initspace(); 1900Sstevel@tonic-gate pty_initspace(); 1910Sstevel@tonic-gate store_fetch_initspace(); 1920Sstevel@tonic-gate } 1930Sstevel@tonic-gate 1940Sstevel@tonic-gate int ts_dispatch_extended = -1; /* set in ts_getdptbl or set_platform_default */ 1950Sstevel@tonic-gate 1960Sstevel@tonic-gate /* 1970Sstevel@tonic-gate * Previously defined in consmsconf.c ... 1980Sstevel@tonic-gate */ 1990Sstevel@tonic-gate dev_t kbddev = NODEV; 2000Sstevel@tonic-gate dev_t mousedev = NODEV; 2010Sstevel@tonic-gate dev_t stdindev = NODEV; 2020Sstevel@tonic-gate struct vnode *wsconsvp; 2030Sstevel@tonic-gate 2040Sstevel@tonic-gate dev_t fbdev = NODEV; 2050Sstevel@tonic-gate struct vnode *fbvp; 2060Sstevel@tonic-gate dev_info_t *fbdip; 2070Sstevel@tonic-gate 2080Sstevel@tonic-gate /* 2090Sstevel@tonic-gate * moved from cons.c because they must be resident in the kernel. 2100Sstevel@tonic-gate */ 2110Sstevel@tonic-gate vnode_t *rconsvp; 2120Sstevel@tonic-gate dev_t rconsdev; 2130Sstevel@tonic-gate dev_t uconsdev = NODEV; 2140Sstevel@tonic-gate 2150Sstevel@tonic-gate /* 2160Sstevel@tonic-gate * This flag, when set marks rconsvp in a transition state. 2170Sstevel@tonic-gate */ 2180Sstevel@tonic-gate 2190Sstevel@tonic-gate int cn_conf; 2200Sstevel@tonic-gate 2210Sstevel@tonic-gate /* 2220Sstevel@tonic-gate * Moved from sad_conf.c because of the usual in loadable modules 2230Sstevel@tonic-gate */ 2240Sstevel@tonic-gate 2250Sstevel@tonic-gate #ifndef NSTRPHASH 2260Sstevel@tonic-gate #define NSTRPHASH 128 2270Sstevel@tonic-gate #endif 2280Sstevel@tonic-gate struct autopush **strpcache; 2290Sstevel@tonic-gate int strpmask = NSTRPHASH - 1; 2300Sstevel@tonic-gate 2310Sstevel@tonic-gate /* 2320Sstevel@tonic-gate * Moved here from wscons.c 2330Sstevel@tonic-gate * Package the redirection-related routines into an ops vector of the form 2340Sstevel@tonic-gate * that the redirecting driver expects. 2350Sstevel@tonic-gate */ 2360Sstevel@tonic-gate extern int wcvnget(); 2370Sstevel@tonic-gate extern void wcvnrele(); 2380Sstevel@tonic-gate srvnops_t wscons_srvnops = { 2390Sstevel@tonic-gate wcvnget, 2400Sstevel@tonic-gate wcvnrele 2410Sstevel@tonic-gate }; 2420Sstevel@tonic-gate 2430Sstevel@tonic-gate /* 2440Sstevel@tonic-gate * consconfig() in autoconf.c sets this; it's the vnode of the distinguished 2450Sstevel@tonic-gate * keyboard/frame buffer combination, aka the workstation console. 2460Sstevel@tonic-gate */ 2470Sstevel@tonic-gate 2480Sstevel@tonic-gate vnode_t *rwsconsvp; 2490Sstevel@tonic-gate dev_t rwsconsdev; 2500Sstevel@tonic-gate 2510Sstevel@tonic-gate /* 2520Sstevel@tonic-gate * Platform console abort policy. 2530Sstevel@tonic-gate * Platforms may override the default software policy, if such hardware 2540Sstevel@tonic-gate * (e.g. keyswitches with a secure position) exists. 2550Sstevel@tonic-gate */ 2560Sstevel@tonic-gate int abort_enable = KIOCABORTENABLE; 2570Sstevel@tonic-gate 2580Sstevel@tonic-gate /* from iwscons.c */ 2590Sstevel@tonic-gate 2600Sstevel@tonic-gate kthread_id_t iwscn_thread; /* thread that is allowed to push redirm */ 2610Sstevel@tonic-gate wcm_data_t *iwscn_wcm_data; /* allocated data for redirm */ 2620Sstevel@tonic-gate 2630Sstevel@tonic-gate /* from cpc.c */ 2640Sstevel@tonic-gate uint_t kcpc_key; /* TSD key for CPU performance counter context */ 2650Sstevel@tonic-gate 2660Sstevel@tonic-gate /* 2670Sstevel@tonic-gate * storing and retrieving data by string key 2680Sstevel@tonic-gate * 2690Sstevel@tonic-gate * this mechanism allows a consumer to store and retrieve by name a pointer 2700Sstevel@tonic-gate * to some space maintained by the consumer. 2710Sstevel@tonic-gate * For example, a driver or module may want to have persistent data 2720Sstevel@tonic-gate * over unloading/loading cycles. The pointer is typically to some 2730Sstevel@tonic-gate * kmem_alloced space and it should not be pointing to data that will 2740Sstevel@tonic-gate * be destroyed when the module is unloaded. 2750Sstevel@tonic-gate */ 2760Sstevel@tonic-gate static mod_hash_t *space_hash; 2770Sstevel@tonic-gate static char *space_hash_name = "space_hash"; 2780Sstevel@tonic-gate static size_t space_hash_nchains = 8; 2790Sstevel@tonic-gate 2800Sstevel@tonic-gate static void 2810Sstevel@tonic-gate store_fetch_initspace() 2820Sstevel@tonic-gate { 2830Sstevel@tonic-gate space_hash = mod_hash_create_strhash(space_hash_name, 2840Sstevel@tonic-gate space_hash_nchains, mod_hash_null_valdtor); 2850Sstevel@tonic-gate ASSERT(space_hash); 2860Sstevel@tonic-gate } 2870Sstevel@tonic-gate 2880Sstevel@tonic-gate int 2890Sstevel@tonic-gate space_store(char *key, uintptr_t ptr) 2900Sstevel@tonic-gate { 2910Sstevel@tonic-gate char *s; 2920Sstevel@tonic-gate int rval; 2930Sstevel@tonic-gate size_t l; 2940Sstevel@tonic-gate 2950Sstevel@tonic-gate /* some sanity checks first */ 2960Sstevel@tonic-gate if (key == NULL) { 2970Sstevel@tonic-gate return (-1); 2980Sstevel@tonic-gate } 2990Sstevel@tonic-gate l = (size_t)strlen(key); 3000Sstevel@tonic-gate if (l == 0) { 3010Sstevel@tonic-gate return (-1); 3020Sstevel@tonic-gate } 3030Sstevel@tonic-gate 3040Sstevel@tonic-gate /* increment for null terminator */ 3050Sstevel@tonic-gate l++; 3060Sstevel@tonic-gate 3070Sstevel@tonic-gate /* alloc space for the string, mod_hash_insert will deallocate */ 3080Sstevel@tonic-gate s = kmem_alloc(l, KM_SLEEP); 3090Sstevel@tonic-gate bcopy(key, s, l); 3100Sstevel@tonic-gate 3110Sstevel@tonic-gate rval = mod_hash_insert(space_hash, 3120Sstevel@tonic-gate (mod_hash_key_t)s, (mod_hash_val_t)ptr); 3130Sstevel@tonic-gate 3140Sstevel@tonic-gate switch (rval) { 3150Sstevel@tonic-gate case 0: 3160Sstevel@tonic-gate break; 3170Sstevel@tonic-gate #ifdef DEBUG 3180Sstevel@tonic-gate case MH_ERR_DUPLICATE: 3190Sstevel@tonic-gate cmn_err(CE_WARN, "space_store: duplicate key %s", key); 3200Sstevel@tonic-gate rval = -1; 3210Sstevel@tonic-gate break; 3220Sstevel@tonic-gate case MH_ERR_NOMEM: 3230Sstevel@tonic-gate cmn_err(CE_WARN, "space_store: no mem for key %s", key); 3240Sstevel@tonic-gate rval = -1; 3250Sstevel@tonic-gate break; 3260Sstevel@tonic-gate default: 3270Sstevel@tonic-gate cmn_err(CE_WARN, "space_store: unspecified error for key %s", 3280Sstevel@tonic-gate key); 3290Sstevel@tonic-gate rval = -1; 3300Sstevel@tonic-gate break; 3310Sstevel@tonic-gate #else 3320Sstevel@tonic-gate default: 3330Sstevel@tonic-gate rval = -1; 3340Sstevel@tonic-gate break; 3350Sstevel@tonic-gate #endif 3360Sstevel@tonic-gate } 3370Sstevel@tonic-gate 3380Sstevel@tonic-gate return (rval); 3390Sstevel@tonic-gate } 3400Sstevel@tonic-gate 3410Sstevel@tonic-gate uintptr_t 3420Sstevel@tonic-gate space_fetch(char *key) 3430Sstevel@tonic-gate { 3440Sstevel@tonic-gate uintptr_t ptr = 0; 3450Sstevel@tonic-gate mod_hash_val_t val; 3460Sstevel@tonic-gate int rval; 3470Sstevel@tonic-gate 3480Sstevel@tonic-gate if (key) { 3490Sstevel@tonic-gate rval = mod_hash_find(space_hash, (mod_hash_key_t)key, &val); 3500Sstevel@tonic-gate if (rval == 0) { 3510Sstevel@tonic-gate ptr = (uintptr_t)val; 3520Sstevel@tonic-gate } 3530Sstevel@tonic-gate } 3540Sstevel@tonic-gate 3550Sstevel@tonic-gate return (ptr); 3560Sstevel@tonic-gate } 3570Sstevel@tonic-gate 3580Sstevel@tonic-gate void 3590Sstevel@tonic-gate space_free(char *key) 3600Sstevel@tonic-gate { 3610Sstevel@tonic-gate if (key) { 3620Sstevel@tonic-gate (void) mod_hash_destroy(space_hash, (mod_hash_key_t)key); 3630Sstevel@tonic-gate } 3640Sstevel@tonic-gate } 3650Sstevel@tonic-gate 3660Sstevel@tonic-gate /* 3670Sstevel@tonic-gate * Support for CRC32. At present all calculations are done in simple 3680Sstevel@tonic-gate * macros, so all we need is somewhere to declare the global lookup table. 3690Sstevel@tonic-gate */ 3700Sstevel@tonic-gate 3710Sstevel@tonic-gate #include <sys/crc32.h> 3720Sstevel@tonic-gate 3730Sstevel@tonic-gate const uint32_t crc32_table[256] = { CRC32_TABLE }; 374*1184Skrgopi 375*1184Skrgopi 376*1184Skrgopi /* 377*1184Skrgopi * We need to fanout load from NIC which can overwhelm a single 378*1184Skrgopi * CPU. A 10Gb NIC interrupting a single CPU is a good example. 379*1184Skrgopi * Instead of fanning out to random CPUs, it a big performance 380*1184Skrgopi * win if you can fanout to the threads on the same core (niagara) 381*1184Skrgopi * that is taking interrupts. 382*1184Skrgopi * 383*1184Skrgopi * We need a better mechanism to figure out the other threads on 384*1184Skrgopi * the same core or cores on the same chip which share caches etc. 385*1184Skrgopi * but for time being, this will suffice. 386*1184Skrgopi */ 387*1184Skrgopi #define NUMBER_OF_THREADS_PER_CPU 4 388*1184Skrgopi uint_t ip_threads_per_cpu = NUMBER_OF_THREADS_PER_CPU; 389*1184Skrgopi 390*1184Skrgopi /* Global flag to enable/disable soft ring facility */ 391*1184Skrgopi boolean_t ip_squeue_soft_ring = B_FALSE; 392