From owner-freebsd-net@FreeBSD.ORG Mon May 20 06:59:34 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 4D26C420 for ; Mon, 20 May 2013 06:59:34 +0000 (UTC) (envelope-from havenster@gmail.com) Received: from mail-la0-x236.google.com (mail-la0-x236.google.com [IPv6:2a00:1450:4010:c03::236]) by mx1.freebsd.org (Postfix) with ESMTP id AFD27FC9 for ; Mon, 20 May 2013 06:59:33 +0000 (UTC) Received: by mail-la0-f54.google.com with SMTP id eg20so3380512lab.41 for ; Sun, 19 May 2013 23:59:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=jJjX0pPTIWNGrwvZF3aRFM0N36tlfPlWYnsQormj5ZQ=; b=ufaNNkNZ5WjG/nXFY3e0qOvu65QJwpsJbKjlI4GuBGQ8DflLPXe5sfes4uhq0vBy4s LAYKqC+ncxINMS0YMjGBlarS7fjBWGbPcLrXrqF/DwCALoWfAOZ9tOBW5ks5rPdB5XB5 UsACcDekus3a9IjrNBIzNOTeHYVwbFntBHNPikCLdSjnLc9tF+fBndNeqBkgYwtsKIcE JocQkxInoDIK5Bub4PgEkNhXJBQjvkg3ybUdkVcgGDsDqAD7x3vLavfesTPgHMLzrXcR VqKnIEVxnfk10GAnz+EFcKq1pOxjdhRgTlOk3ejQalptdOLttSk+ti+Q4O07zK22DfUk duJA== MIME-Version: 1.0 X-Received: by 10.152.30.103 with SMTP id r7mr5958680lah.25.1369033172468; Sun, 19 May 2013 23:59:32 -0700 (PDT) Received: by 10.112.159.166 with HTTP; Sun, 19 May 2013 23:59:32 -0700 (PDT) In-Reply-To: <201305161156.r4GBu0HQ018200@vps1.elischer.org> References: <201305161156.r4GBu0HQ018200@vps1.elischer.org> Date: Sun, 19 May 2013 23:59:32 -0700 Message-ID: Subject: Re: more FIBs patch for review From: Haven Hash To: Julian Elischer Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: 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 06:59:34 -0000 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). 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" >