From owner-freebsd-net@FreeBSD.ORG Mon May 20 20:05:42 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A64A5452 for ; Mon, 20 May 2013 20:05:42 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id 63BB31AD7 for ; Mon, 20 May 2013 20:05:42 +0000 (UTC) Received: from Julian-MBP3.local (50-196-156-133-static.hfc.comcastbusiness.net [50.196.156.133]) (authenticated bits=0) by vps1.elischer.org (8.14.5/8.14.5) with ESMTP id r4KK5eg1060709 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Mon, 20 May 2013 13:05:41 -0700 (PDT) (envelope-from julian@freebsd.org) Message-ID: <519A820F.10807@freebsd.org> Date: Mon, 20 May 2013 13:05:35 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: Haven Hash Subject: Re: more FIBs patch for review References: <201305161156.r4GBu0HQ018200@vps1.elischer.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Julian Elischer , freebsd-net@freebsd.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 May 2013 20:05:42 -0000 On 5/19/13 11:59 PM, Haven Hash wrote: > Was m_fibnum being defined to m_hdr.mh_nextpkt intended? (it doesn't appear > to be used here and it seemed an odd mapping to me). it is wrong and unused it was not supposed to get committed I plan to remove it > > Thanks, > > > On Thu, May 16, 2013 at 4:56 AM, Julian Elischer > wrote: > >> Index: sys/conf/NOTES >> =================================================================== >> --- sys/conf/NOTES (revision 250696) >> +++ sys/conf/NOTES (working copy) >> @@ -571,7 +571,8 @@ >> 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. >> >> Index: sys/net/route.c >> =================================================================== >> --- sys/net/route.c (revision 250696) >> +++ sys/net/route.c (working copy) >> @@ -68,8 +68,7 @@ >> >> #include >> >> -/* 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); >> >> /* >> Index: sys/netinet6/ip6_output.c >> =================================================================== >> --- sys/netinet6/ip6_output.c (revision 250696) >> +++ sys/netinet6/ip6_output.c (working copy) >> @@ -1126,7 +1126,7 @@ >> 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 @@ >> } >> 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; >> Index: sys/sys/mbuf.h >> =================================================================== >> --- sys/sys/mbuf.h (revision 250696) >> +++ sys/sys/mbuf.h (working copy) >> @@ -129,6 +129,8 @@ >> 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 @@ >> #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 @@ >> #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 @@ >> */ >> #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_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 */ >> _______________________________________________ >> freebsd-net@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-net >> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" >> > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" > >