Finally change the mbuf to have its own fib field instead of stealing
4 flag bits. This was supposed to happen in 8.0, and again in 2012.. MFC after: never
This commit is contained in:
parent
50a31d452c
commit
329247aec2
@ -571,7 +571,8 @@ options HWPMC_HOOKS # Other necessary kernel hooks
|
||||
options INET #Internet communications protocols
|
||||
options INET6 #IPv6 communications protocols
|
||||
|
||||
options ROUTETABLES=2 # max 16. 1 is back compatible.
|
||||
options ROUTETABLES=2 # allocated fibs up to 65536. default is 1.
|
||||
# but that would be a bad idea as they are large.
|
||||
|
||||
options TCP_OFFLOAD # TCP offload support.
|
||||
|
||||
|
@ -68,8 +68,7 @@
|
||||
|
||||
#include <vm/uma.h>
|
||||
|
||||
/* We use 4 bits in the mbuf flags, thus we are limited to 16 FIBS. */
|
||||
#define RT_MAXFIBS 16
|
||||
#define RT_MAXFIBS UINT16_MAX
|
||||
|
||||
/* Kernel config default option. */
|
||||
#ifdef ROUTETABLES
|
||||
@ -86,17 +85,10 @@
|
||||
#define RT_NUMFIBS 1
|
||||
#endif
|
||||
|
||||
/* This is read-only.. */
|
||||
u_int rt_numfibs = RT_NUMFIBS;
|
||||
SYSCTL_UINT(_net, OID_AUTO, fibs, CTLFLAG_RD, &rt_numfibs, 0, "");
|
||||
/*
|
||||
* Allow the boot code to allow LESS than RT_MAXFIBS to be used.
|
||||
* We can't do more because storage is statically allocated for now.
|
||||
* (for compatibility reasons.. this will change. When this changes, code should
|
||||
* be refactored to protocol independent parts and protocol dependent parts,
|
||||
* probably hanging of domain(9) specific storage to not need the full
|
||||
* fib * af RNH allocation etc. but allow tuning the number of tables per
|
||||
* address family).
|
||||
*/
|
||||
/* and this can be set too big but will be fixed before it is used */
|
||||
TUNABLE_INT("net.fibs", &rt_numfibs);
|
||||
|
||||
/*
|
||||
|
@ -1126,7 +1126,7 @@ passout:
|
||||
IP6STAT_INC(ip6s_odropped);
|
||||
goto sendorfree;
|
||||
}
|
||||
m->m_flags = m0->m_flags & M_COPYFLAGS; /* incl. FIB */
|
||||
m->m_flags = m0->m_flags & M_COPYFLAGS;
|
||||
*mnext = m;
|
||||
mnext = &m->m_nextpkt;
|
||||
m->m_data += max_linkhdr;
|
||||
@ -1152,6 +1152,7 @@ passout:
|
||||
}
|
||||
m_cat(m, m_frgpart);
|
||||
m->m_pkthdr.len = len + hlen + sizeof(*ip6f);
|
||||
m->m_pkthdr.fibnum = m0->m_pkthdr.fibnum;
|
||||
m->m_pkthdr.rcvif = NULL;
|
||||
ip6f->ip6f_reserved = 0;
|
||||
ip6f->ip6f_ident = id;
|
||||
|
@ -129,6 +129,8 @@ struct pkthdr {
|
||||
u_int16_t vt_vtag; /* Ethernet 802.1p+q vlan tag */
|
||||
u_int16_t vt_nrecs; /* # of IGMPv3 records in this chain */
|
||||
} PH_vt;
|
||||
u_int16_t fibnum; /* this packet should use this fib */
|
||||
u_int16_t pad2; /* align to 32 bits */
|
||||
SLIST_HEAD(packet_tags, m_tag) tags; /* list of packet tags */
|
||||
};
|
||||
#define ether_vtag PH_vt.vt_vtag
|
||||
@ -171,6 +173,7 @@ struct mbuf {
|
||||
#define m_type m_hdr.mh_type
|
||||
#define m_flags m_hdr.mh_flags
|
||||
#define m_nextpkt m_hdr.mh_nextpkt
|
||||
#define m_fibnum m_hdr.mh_nextpkt
|
||||
#define m_act m_nextpkt
|
||||
#define m_pkthdr M_dat.MH.MH_pkthdr
|
||||
#define m_ext M_dat.MH.MH_dat.MH_ext
|
||||
@ -205,12 +208,6 @@ struct mbuf {
|
||||
#define M_FLOWID 0x00400000 /* deprecated: flowid is valid */
|
||||
#define M_HASHTYPEBITS 0x0F000000 /* mask of bits holding flowid hash type */
|
||||
|
||||
/*
|
||||
* For RELENG_{6,7} steal these flags for limited multiple routing table
|
||||
* support. In RELENG_8 and beyond, use just one flag and a tag.
|
||||
*/
|
||||
#define M_FIB 0xF0000000 /* steal some bits to store fib number. */
|
||||
|
||||
#define M_NOTIFICATION M_PROTO5 /* SCTP notification */
|
||||
|
||||
/*
|
||||
@ -258,7 +255,7 @@ struct mbuf {
|
||||
*/
|
||||
#define M_COPYFLAGS \
|
||||
(M_PKTHDR|M_EOR|M_RDONLY|M_PROTOFLAGS|M_SKIP_FIREWALL|M_BCAST|M_MCAST|\
|
||||
M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_VLANTAG|M_PROMISC|M_FIB|M_HASHTYPEBITS)
|
||||
M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_VLANTAG|M_PROMISC|M_HASHTYPEBITS)
|
||||
|
||||
/*
|
||||
* External buffer types: identify ext_buf type.
|
||||
@ -1010,17 +1007,18 @@ m_tag_find(struct mbuf *m, int type, struct m_tag *start)
|
||||
m_tag_locate(m, MTAG_ABI_COMPAT, type, start));
|
||||
}
|
||||
|
||||
/* XXX temporary FIB methods probably eventually use tags.*/
|
||||
#define M_FIBSHIFT 28
|
||||
#define M_FIBMASK 0x0F
|
||||
static int inline
|
||||
rt_m_getfib(struct mbuf *m)
|
||||
{
|
||||
KASSERT(m->m_flags & M_EXT , ("attempt to set FIB on non header mbuf"));
|
||||
return (m->m_pkthdr.fibnum);
|
||||
}
|
||||
|
||||
/* get the fib from an mbuf and if it is not set, return the default */
|
||||
#define M_GETFIB(_m) \
|
||||
((((_m)->m_flags & M_FIB) >> M_FIBSHIFT) & M_FIBMASK)
|
||||
#define M_GETFIB(_m) rt_m_getfib(_m)
|
||||
|
||||
#define M_SETFIB(_m, _fib) do { \
|
||||
_m->m_flags &= ~M_FIB; \
|
||||
_m->m_flags |= (((_fib) << M_FIBSHIFT) & M_FIB); \
|
||||
KASSERT((_m)->m_flags & M_EXT, ("No FIB on non header mbuf")); \
|
||||
((_m)->m_pkthdr.fibnum) = (_fib); \
|
||||
} while (0)
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
Loading…
x
Reference in New Issue
Block a user