diff options
author | glebius <glebius@FreeBSD.org> | 2006-01-30 13:45:15 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2006-01-30 13:45:15 +0000 |
commit | 19f8b36e662bea1b79c01dab7717540417040328 (patch) | |
tree | 411b1579c38fee9f7f11cf8181e2190d0215dd36 /sys/net/if_vlan_var.h | |
parent | a388ebb962934fe140e9559cc12ca537afae2187 (diff) | |
download | FreeBSD-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/net/if_vlan_var.h')
-rw-r--r-- | sys/net/if_vlan_var.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/net/if_vlan_var.h b/sys/net/if_vlan_var.h index b1fecf6..d4a2448 100644 --- a/sys/net/if_vlan_var.h +++ b/sys/net/if_vlan_var.h @@ -93,8 +93,6 @@ struct vlanreq { * Note that a driver must indicate it supports hardware VLAN * tagging by marking IFCAP_VLAN_HWTAGGING in if_capabilities. */ -#define MTAG_VLAN 1035328035 -#define MTAG_VLAN_TAG 0 /* tag of VLAN interface */ /* * This macro must expand to a lvalue so that it can be used @@ -103,9 +101,8 @@ struct vlanreq { #define VLAN_TAG_VALUE(_mt) (*(u_int *)((_mt) + 1)) #define VLAN_INPUT_TAG(_ifp, _m, _t) do { \ - struct m_tag *mtag; \ - mtag = m_tag_alloc(MTAG_VLAN, MTAG_VLAN_TAG, \ - sizeof (u_int), M_NOWAIT); \ + struct m_tag *mtag = (struct m_tag *) \ + uma_zalloc(zone_mtag_vlan, M_NOWAIT); \ if (mtag != NULL) { \ VLAN_TAG_VALUE(mtag) = (_t); \ m_tag_prepend((_m), mtag); \ @@ -120,6 +117,13 @@ struct vlanreq { #define VLAN_OUTPUT_TAG(_ifp, _m) \ ((_m)->m_flags & M_VLANTAG ? \ m_tag_locate((_m), MTAG_VLAN, MTAG_VLAN_TAG, NULL) : NULL) + +#define VLAN_CAPABILITIES(_ifp) do { \ + if ((_ifp)->if_vlantrunk != NULL) \ + (*vlan_trunk_cap_p)(_ifp); \ +} while (0) + +extern void (*vlan_trunk_cap_p)(struct ifnet *); #endif /* _KERNEL */ #endif /* _NET_IF_VLAN_VAR_H_ */ |