summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mbuf.c
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2006-01-30 13:45:15 +0000
committerglebius <glebius@FreeBSD.org>2006-01-30 13:45:15 +0000
commit19f8b36e662bea1b79c01dab7717540417040328 (patch)
tree411b1579c38fee9f7f11cf8181e2190d0215dd36 /sys/kern/kern_mbuf.c
parenta388ebb962934fe140e9559cc12ca537afae2187 (diff)
downloadFreeBSD-src-19f8b36e662bea1b79c01dab7717540417040328.zip
FreeBSD-src-19f8b36e662bea1b79c01dab7717540417040328.tar.gz
Merge the //depot/user/yar/vlan branch into CVS. It contains some collective
work by yar, thompsa and myself. The checksum offloading part also involves work done by Mihail Balikov. The most important changes: o Instead of global linked list of all vlan softc use a per-trunk hash. The size of hash is dynamically adjusted, depending on number of entries. This changes struct ifnet, replacing counter of vlans with a pointer to trunk structure. This change is an improvement for setups with big number of VLANs, several interfaces and several CPUs. It is a small regression for a setup with a single VLAN interface. An alternative to dynamic hash is a per-trunk static array with 4096 entries, which is a compile time option - VLAN_ARRAY. In my experiments the array is not an improvement, probably because such a big trunk structure doesn't fit into CPU cache. o Introduce an UMA zone for VLAN tags. Since drivers depend on it, the zone is declared in kern_mbuf.c, not in optional vlan(4) driver. This change is a big improvement for any setup utilizing vlan(4). o Use rwlock(9) instead of mutex(9) for locking. We are the first ones to do this! :) o Some drivers can do hardware VLAN tagging + hardware checksum offloading. Add an infrastructure for this. Whenever vlan(4) is attached to a parent or parent configuration is changed, the flags on vlan(4) interface are updated. In collaboration with: yar, thompsa In collaboration with: Mihail Balikov <mihail.balikov interbgc.com>
Diffstat (limited to 'sys/kern/kern_mbuf.c')
-rw-r--r--sys/kern/kern_mbuf.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c
index 514eca4..8f5b919 100644
--- a/sys/kern/kern_mbuf.c
+++ b/sys/kern/kern_mbuf.c
@@ -133,6 +133,7 @@ uma_zone_t zone_jumbo4;
uma_zone_t zone_jumbo9;
uma_zone_t zone_jumbo16;
uma_zone_t zone_ext_refcnt;
+uma_zone_t zone_mtag_vlan;
/*
* Local prototypes.
@@ -145,6 +146,7 @@ static void mb_dtor_clust(void *, int, void *);
static void mb_dtor_pack(void *, int, void *);
static int mb_zinit_pack(void *, int, int);
static void mb_zfini_pack(void *, int);
+static int mt_zinit_vlan(void *, int, int);
static void mb_reclaim(void *);
static void mbuf_init(void *);
@@ -225,6 +227,12 @@ mbuf_init(void *dummy)
NULL, NULL,
UMA_ALIGN_PTR, UMA_ZONE_ZINIT);
+ zone_mtag_vlan = uma_zcreate("mtag_vlan",
+ sizeof(struct m_tag) + sizeof(u_int),
+ NULL, NULL,
+ mt_zinit_vlan, NULL,
+ UMA_ALIGN_INT, 0);
+
/* uma_prealloc() goes here... */
/*
@@ -511,6 +519,23 @@ mb_ctor_pack(void *mem, int size, void *arg, int how)
return (0);
}
+static void
+mt_vlan_free(struct m_tag *mtag)
+{
+ uma_zfree(zone_mtag_vlan, mtag);
+}
+
+static int
+mt_zinit_vlan(void *mem, int size, int how)
+{
+ struct m_tag *mtag = (struct m_tag *)mem;
+
+ m_tag_setup(mtag, MTAG_VLAN, MTAG_VLAN_TAG, sizeof(u_int));
+ mtag->m_tag_free = mt_vlan_free;
+
+ return (0);
+}
+
/*
* This is the protocol drain routine.
*
OpenPOWER on IntegriCloud