Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 May 2013 23:59:32 -0700
From:      Haven Hash <havenster@gmail.com>
To:        Julian Elischer <julian@vps1.elischer.org>
Cc:        freebsd-net@freebsd.org
Subject:   Re: more FIBs patch for review
Message-ID:  <CAMUJtRPtUYAOY_sOROHeaEfyWsDarEwtayR5uCaGjqi8Z-dLNA@mail.gmail.com>
In-Reply-To: <201305161156.r4GBu0HQ018200@vps1.elischer.org>
References:  <201305161156.r4GBu0HQ018200@vps1.elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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
<julian@vps1.elischer.org>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 <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);
>
>  /*
> 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"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMUJtRPtUYAOY_sOROHeaEfyWsDarEwtayR5uCaGjqi8Z-dLNA>