move lwip heap from rolling to mcache
@@ -217,17 +217,13 @@ static heap lwip_heap;
void *lwip_allocate(u64 size)
{
- ///xxxxxxx
- return allocate_zero(lwip_heap, size+4);
+ return allocate_zero(lwip_heap, size);
}
-// this doesn't have the size, do we have to prepend it? put it in the
-// ignore bits?
void lwip_deallocate(void *x)
{
- // well, sadly, we know that rolling doesn't care about the size - except
- // potentially for multipage allocations
- deallocate(lwip_heap, x, 0);
+ /* no size info; mcache won't care */
+ deallocate(lwip_heap, x, -1ull);
}
extern void lwip_init();
@@ -243,7 +239,8 @@ static void init_vnet(heap general, heap page_allocator, heap page_allocator_2M,
vtpci dev = attach_vtpci(general, page_allocator, bus, slot, function, VIRTIO_NET_F_MAC);
vnet vn = allocate(dev->general, sizeof(struct vnet));
vn->n = allocate(dev->general, sizeof(struct netif));
- lwip_heap = allocate_rolling_heap(page_allocator, 8);
+ bytes mcache_sizes[] = {8, 16, 32, 64, 128, 256, 512, 1024, -1};
+ lwip_heap = allocate_mcache(dev->general, page_allocator, mcache_sizes);
vn->rxbuflen = 1500;
vn->rxbuffers = wrap_freelist(dev->general, dev->general, vn->rxbuflen + sizeof(struct xpbuf));
vn->rxbuffers = allocate_objcache(dev->general, page_allocator_2M,
