summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/io/idm
diff options
context:
space:
mode:
authorPeter Dunlap <Peter.Dunlap@Sun.COM>2009-03-31 16:02:50 -0600
committerPeter Dunlap <Peter.Dunlap@Sun.COM>2009-03-31 16:02:50 -0600
commitcf8c0ebaf84c824d8f14486e47457119c138ce3c (patch)
tree23f23da3494ca28f129b635996263013cdb672b8 /usr/src/uts/common/io/idm
parent984a131b733dcb12000748fcfcda5cac286ac00a (diff)
downloadillumos-gate-cf8c0ebaf84c824d8f14486e47457119c138ce3c.tar.gz
6748643 IDM sockets code should allocate buffers from one or more kmem caches
6818594 panic assertion failed: ist->ist_ffp_conn_count >= 1, file: ../../common/io/comstar/port/iscsit/iscs 6821084 SUNWiscsitr/SUNWiscsitu package issues 6821999 BAD TRAP: type=d (#gp General protection) rp=ffffff000fdf5460 addr=ffffff02f2564 c58
Diffstat (limited to 'usr/src/uts/common/io/idm')
-rw-r--r--usr/src/uts/common/io/idm/idm_so.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/usr/src/uts/common/io/idm/idm_so.c b/usr/src/uts/common/io/idm/idm_so.c
index 376d2162bf..04353496b2 100644
--- a/usr/src/uts/common/io/idm/idm_so.c
+++ b/usr/src/uts/common/io/idm/idm_so.c
@@ -167,6 +167,10 @@ idm_so_init(idm_transport_t *it)
sizeof (idm_pdu_t) + IDM_SORX_CACHE_HDRLEN, 8,
&idm_sorx_pdu_constructor, NULL, NULL, NULL, NULL, KM_SLEEP);
+ /* 128k buffer cache */
+ idm.idm_so_128k_buf_cache = kmem_cache_create("idm_128k_buf_cache",
+ IDM_SO_BUF_CACHE_UB, 8, NULL, NULL, NULL, NULL, NULL, KM_SLEEP);
+
/* Set the sockets transport ops */
it->it_ops = &idm_so_transport_ops;
}
@@ -178,6 +182,7 @@ idm_so_init(idm_transport_t *it)
void
idm_so_fini(void)
{
+ kmem_cache_destroy(idm.idm_so_128k_buf_cache);
kmem_cache_destroy(idm.idm_sotx_pdu_cache);
kmem_cache_destroy(idm.idm_sorx_pdu_cache);
}
@@ -2146,12 +2151,21 @@ idm_so_buf_rx_from_ini(idm_task_t *idt, idm_buf_t *idb)
static idm_status_t
idm_so_buf_alloc(idm_buf_t *idb, uint64_t buflen)
{
- idb->idb_buf = kmem_alloc(buflen, KM_NOSLEEP);
+ if ((buflen > IDM_SO_BUF_CACHE_LB) && (buflen <= IDM_SO_BUF_CACHE_UB)) {
+ idb->idb_buf = kmem_cache_alloc(idm.idm_so_128k_buf_cache,
+ KM_NOSLEEP);
+ idb->idb_buf_private = idm.idm_so_128k_buf_cache;
+ } else {
+ idb->idb_buf = kmem_alloc(buflen, KM_NOSLEEP);
+ idb->idb_buf_private = NULL;
+ }
+
if (idb->idb_buf == NULL) {
IDM_CONN_LOG(CE_NOTE,
"idm_so_buf_alloc: failed buffer allocation");
return (IDM_STATUS_FAIL);
}
+
return (IDM_STATUS_SUCCESS);
}
@@ -2175,7 +2189,11 @@ idm_so_buf_teardown(idm_buf_t *idb)
static void
idm_so_buf_free(idm_buf_t *idb)
{
- kmem_free(idb->idb_buf, idb->idb_buflen);
+ if (idb->idb_buf_private == NULL) {
+ kmem_free(idb->idb_buf, idb->idb_buflen);
+ } else {
+ kmem_cache_free(idb->idb_buf_private, idb->idb_buf);
+ }
}
static void