* Adding another mbuf cache for handling MJUMPAGESIZE sized clusters.
* This should fix ticket #5063. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34429 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -116,7 +116,8 @@ struct mbuf {
|
|||||||
|
|
||||||
#define EXT_CLUSTER 1
|
#define EXT_CLUSTER 1
|
||||||
#define EXT_PACKET 3
|
#define EXT_PACKET 3
|
||||||
#define EXT_JUMBO9 4
|
#define EXT_JUMBOP 4
|
||||||
|
#define EXT_JUMBO9 5
|
||||||
#define EXT_NET_DRV 100
|
#define EXT_NET_DRV 100
|
||||||
|
|
||||||
#define CSUM_IP 0x0001
|
#define CSUM_IP 0x0001
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
static object_cache *sMBufCache;
|
static object_cache *sMBufCache;
|
||||||
static object_cache *sChunkCache;
|
static object_cache *sChunkCache;
|
||||||
static object_cache *sJumbo9ChunkCache;
|
static object_cache *sJumbo9ChunkCache;
|
||||||
|
static object_cache *sJumboPageSizeCache;
|
||||||
|
|
||||||
|
|
||||||
int max_linkhdr = 16;
|
int max_linkhdr = 16;
|
||||||
@@ -67,16 +68,20 @@ construct_ext_sized_mbuf(struct mbuf *memoryBuffer, int how, int size)
|
|||||||
{
|
{
|
||||||
object_cache *cache;
|
object_cache *cache;
|
||||||
int extType;
|
int extType;
|
||||||
if (size != MCLBYTES && size != MJUM9BYTES)
|
if (size != MCLBYTES && size != MJUM9BYTES && size != MJUMPAGESIZE)
|
||||||
panic("unsupported size");
|
panic("unsupported size");
|
||||||
|
|
||||||
if (size == MCLBYTES) {
|
if (size == MCLBYTES) {
|
||||||
cache = sChunkCache;
|
cache = sChunkCache;
|
||||||
extType = EXT_CLUSTER;
|
extType = EXT_CLUSTER;
|
||||||
} else {
|
} else if (size == MJUM9BYTES) {
|
||||||
cache = sJumbo9ChunkCache;
|
cache = sJumbo9ChunkCache;
|
||||||
extType = EXT_JUMBO9;
|
extType = EXT_JUMBO9;
|
||||||
|
} else {
|
||||||
|
cache = sJumboPageSizeCache;
|
||||||
|
extType = EXT_JUMBOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
memoryBuffer->m_ext.ext_buf = object_cache_alloc(cache, m_to_oc_flags(how));
|
memoryBuffer->m_ext.ext_buf = object_cache_alloc(cache, m_to_oc_flags(how));
|
||||||
if (memoryBuffer->m_ext.ext_buf == NULL)
|
if (memoryBuffer->m_ext.ext_buf == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
@@ -119,6 +124,8 @@ destruct_pkt_mbuf(struct mbuf *memoryBuffer)
|
|||||||
cache = sChunkCache;
|
cache = sChunkCache;
|
||||||
else if ((memoryBuffer->m_ext.ext_type & EXT_JUMBO9) != 0)
|
else if ((memoryBuffer->m_ext.ext_type & EXT_JUMBO9) != 0)
|
||||||
cache = sJumbo9ChunkCache;
|
cache = sJumbo9ChunkCache;
|
||||||
|
else if ((memoryBuffer->m_ext.ext_type & EXT_JUMBOP) != 0)
|
||||||
|
cache = sJumboPageSizeCache;
|
||||||
else {
|
else {
|
||||||
panic("unknown cache");
|
panic("unknown cache");
|
||||||
return;
|
return;
|
||||||
@@ -289,9 +296,15 @@ init_mbufs()
|
|||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
if (sJumbo9ChunkCache == NULL)
|
if (sJumbo9ChunkCache == NULL)
|
||||||
goto clean;
|
goto clean;
|
||||||
|
sJumboPageSizeCache = create_object_cache("mbuf jumbo page size chunks",
|
||||||
|
MJUMPAGESIZE, 0, NULL, NULL, NULL);
|
||||||
|
if (sJumboPageSizeCache == NULL)
|
||||||
|
goto clean;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
if (sJumbo9ChunkCache != NULL)
|
||||||
|
delete_object_cache(sJumbo9ChunkCache);
|
||||||
if (sChunkCache != NULL)
|
if (sChunkCache != NULL)
|
||||||
delete_object_cache(sChunkCache);
|
delete_object_cache(sChunkCache);
|
||||||
if (sMBufCache != NULL)
|
if (sMBufCache != NULL)
|
||||||
@@ -306,4 +319,5 @@ uninit_mbufs()
|
|||||||
delete_object_cache(sMBufCache);
|
delete_object_cache(sMBufCache);
|
||||||
delete_object_cache(sChunkCache);
|
delete_object_cache(sChunkCache);
|
||||||
delete_object_cache(sJumbo9ChunkCache);
|
delete_object_cache(sJumbo9ChunkCache);
|
||||||
|
delete_object_cache(sJumboPageSizeCache);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user