Author: colin Date: 2009-12-01 21:28:51 +0100 (Tue, 01 Dec 2009) New Revision: 34429 Changeset: http://dev.haiku-os.org/changeset/34429/haiku Ticket: http://dev.haiku-os.org/ticket/5063 Modified: haiku/trunk/src/libs/compat/freebsd_network/compat/sys/mbuf.h haiku/trunk/src/libs/compat/freebsd_network/mbuf.c Log: * Adding another mbuf cache for handling MJUMPAGESIZE sized clusters. * This should fix ticket #5063. Modified: haiku/trunk/src/libs/compat/freebsd_network/compat/sys/mbuf.h =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/compat/sys/mbuf.h 2009-12-01 19:36:33 UTC (rev 34428) +++ haiku/trunk/src/libs/compat/freebsd_network/compat/sys/mbuf.h 2009-12-01 20:28:51 UTC (rev 34429) @@ -116,7 +116,8 @@ #define EXT_CLUSTER 1 #define EXT_PACKET 3 -#define EXT_JUMBO9 4 +#define EXT_JUMBOP 4 +#define EXT_JUMBO9 5 #define EXT_NET_DRV 100 #define CSUM_IP 0x0001 Modified: haiku/trunk/src/libs/compat/freebsd_network/mbuf.c =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/mbuf.c 2009-12-01 19:36:33 UTC (rev 34428) +++ haiku/trunk/src/libs/compat/freebsd_network/mbuf.c 2009-12-01 20:28:51 UTC (rev 34429) @@ -19,6 +19,7 @@ static object_cache *sMBufCache; static object_cache *sChunkCache; static object_cache *sJumbo9ChunkCache; +static object_cache *sJumboPageSizeCache; int max_linkhdr = 16; @@ -67,16 +68,20 @@ { object_cache *cache; int extType; - if (size != MCLBYTES && size != MJUM9BYTES) + if (size != MCLBYTES && size != MJUM9BYTES && size != MJUMPAGESIZE) panic("unsupported size"); if (size == MCLBYTES) { cache = sChunkCache; extType = EXT_CLUSTER; - } else { + } else if (size == MJUM9BYTES) { cache = sJumbo9ChunkCache; extType = EXT_JUMBO9; + } else { + cache = sJumboPageSizeCache; + extType = EXT_JUMBOP; } + memoryBuffer->m_ext.ext_buf = object_cache_alloc(cache, m_to_oc_flags(how)); if (memoryBuffer->m_ext.ext_buf == NULL) return B_NO_MEMORY; @@ -119,6 +124,8 @@ cache = sChunkCache; else if ((memoryBuffer->m_ext.ext_type & EXT_JUMBO9) != 0) cache = sJumbo9ChunkCache; + else if ((memoryBuffer->m_ext.ext_type & EXT_JUMBOP) != 0) + cache = sJumboPageSizeCache; else { panic("unknown cache"); return; @@ -289,9 +296,15 @@ NULL, NULL, NULL); if (sJumbo9ChunkCache == NULL) goto clean; + sJumboPageSizeCache = create_object_cache("mbuf jumbo page size chunks", + MJUMPAGESIZE, 0, NULL, NULL, NULL); + if (sJumboPageSizeCache == NULL) + goto clean; return B_OK; clean: + if (sJumbo9ChunkCache != NULL) + delete_object_cache(sJumbo9ChunkCache); if (sChunkCache != NULL) delete_object_cache(sChunkCache); if (sMBufCache != NULL) @@ -306,4 +319,5 @@ delete_object_cache(sMBufCache); delete_object_cache(sChunkCache); delete_object_cache(sJumbo9ChunkCache); + delete_object_cache(sJumboPageSizeCache); }