After inpcb route caching was put back in place there is no need for

flowtable anymore (as flowtable was never considered to be useful in
the forwarding path).

Reviewed by:		np
Differential Revision:	https://reviews.freebsd.org/D11448
This commit is contained in:
Bjoern A. Zeeb 2017-07-27 13:03:36 +00:00
parent 6d2909f6a0
commit ae69ad884d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=321618
11 changed files with 1 additions and 1433 deletions

View file

@ -646,9 +646,6 @@ options LIBMCHAIN
# libalias library, performing NAT
options LIBALIAS
# flowtable cache
options FLOWTABLE
#
# SCTP is a NEW transport protocol defined by
# RFC2960 updated by RFC3309 and RFC3758.. and

View file

@ -454,8 +454,6 @@ TCP_RFC7413_MAX_KEYS opt_inet.h
TCP_SIGNATURE opt_ipsec.h
VLAN_ARRAY opt_vlan.h
XBONEHACK
FLOWTABLE opt_route.h
FLOWTABLE_HASH_ALL opt_route.h
#
# SCTP

File diff suppressed because it is too large Load diff

View file

@ -1,56 +0,0 @@
/*-
* Copyright (c) 2014 Gleb Smirnoff <glebius@FreeBSD.org>
* Copyright (c) 2008-2010, BitGravity Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Neither the name of the BitGravity Corporation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*
*/
#ifndef _NET_FLOWTABLE_H_
#define _NET_FLOWTABLE_H_
struct flowtable_stat {
uint64_t ft_collisions;
uint64_t ft_misses;
uint64_t ft_free_checks;
uint64_t ft_frees;
uint64_t ft_hits;
uint64_t ft_lookups;
uint64_t ft_fail_lle_invalid;
uint64_t ft_inserts;
};
#ifdef _KERNEL
/*
* Given a flow table, look up the L3 and L2 information
* and return it in the route.
*/
int flowtable_lookup(sa_family_t, struct mbuf *, struct route *);
void flowtable_route_flush(sa_family_t, struct rtentry *);
#endif /* _KERNEL */
#endif /* !_NET_FLOWTABLE_H_ */

View file

@ -59,7 +59,6 @@
#include <net/route.h>
#include <net/route_var.h>
#include <net/vnet.h>
#include <net/flowtable.h>
#ifdef RADIX_MPATH
#include <net/radix_mpath.h>
@ -1504,79 +1503,12 @@ rt_mpath_unlink(struct rib_head *rnh, struct rt_addrinfo *info,
}
#endif
#ifdef FLOWTABLE
static struct rtentry *
rt_flowtable_check_route(struct rib_head *rnh, struct rt_addrinfo *info)
{
#if defined(INET6) || defined(INET)
struct radix_node *rn;
#endif
struct rtentry *rt0;
rt0 = NULL;
/* "flow-table" only supports IPv6 and IPv4 at the moment. */
switch (dst->sa_family) {
#ifdef INET6
case AF_INET6:
#endif
#ifdef INET
case AF_INET:
#endif
#if defined(INET6) || defined(INET)
rn = rnh->rnh_matchaddr(dst, &rnh->head);
if (rn && ((rn->rn_flags & RNF_ROOT) == 0)) {
struct sockaddr *mask;
u_char *m, *n;
int len;
/*
* compare mask to see if the new route is
* more specific than the existing one
*/
rt0 = RNTORT(rn);
RT_LOCK(rt0);
RT_ADDREF(rt0);
RT_UNLOCK(rt0);
/*
* A host route is already present, so
* leave the flow-table entries as is.
*/
if (rt0->rt_flags & RTF_HOST) {
RTFREE(rt0);
rt0 = NULL;
} else if (!(flags & RTF_HOST) && netmask) {
mask = rt_mask(rt0);
len = mask->sa_len;
m = (u_char *)mask;
n = (u_char *)netmask;
while (len-- > 0) {
if (*n != *m)
break;
n++;
m++;
}
if (len == 0 || (*n < *m)) {
RTFREE(rt0);
rt0 = NULL;
}
}
}
#endif/* INET6 || INET */
}
return (rt0);
}
#endif
int
rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
u_int fibnum)
{
int error = 0;
struct rtentry *rt, *rt_old;
#ifdef FLOWTABLE
struct rtentry *rt0;
#endif
struct radix_node *rn;
struct rib_head *rnh;
struct ifaddr *ifa;
@ -1710,10 +1642,6 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
}
#endif
#ifdef FLOWTABLE
rt0 = rt_flowtable_check_route(rnh, info);
#endif /* FLOWTABLE */
/* XXX mtu manipulation will be done in rnh_addaddr -- itojun */
rn = rnh->rnh_addaddr(ndst, netmask, &rnh->head, rt->rt_nodes);
@ -1748,18 +1676,8 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
ifa_free(rt->rt_ifa);
R_Free(rt_key(rt));
uma_zfree(V_rtzone, rt);
#ifdef FLOWTABLE
if (rt0 != NULL)
RTFREE(rt0);
#endif
return (EEXIST);
}
#ifdef FLOWTABLE
else if (rt0 != NULL) {
flowtable_route_flush(dst->sa_family, rt0);
RTFREE(rt0);
}
#endif
if (rt_old != NULL) {
rt_notifydelete(rt_old, info);

View file

@ -63,7 +63,6 @@ __FBSDID("$FreeBSD$");
#include <net/netisr.h>
#include <net/pfil.h>
#include <net/route.h>
#include <net/flowtable.h>
#ifdef RADIX_MPATH
#include <net/radix_mpath.h>
#endif
@ -244,11 +243,6 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags,
bzero(ro, sizeof (*ro));
}
#ifdef FLOWTABLE
if (ro->ro_rt == NULL)
(void )flowtable_lookup(AF_INET, m, ro);
#endif
if (opt) {
int len = 0;
m = ip_insertoptions(m, opt, &len);

View file

@ -117,10 +117,6 @@ __FBSDID("$FreeBSD$");
#include <netinet6/ip6protosw.h>
#include <netinet6/scope6_var.h>
#ifdef FLOWTABLE
#include <net/flowtable.h>
#endif
extern int in6_mcast_loop;
struct ip6_exthdrs {
@ -502,10 +498,6 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
if (opt && opt->ip6po_rthdr)
ro = &opt->ip6po_route;
dst = (struct sockaddr_in6 *)&ro->ro_dst;
#ifdef FLOWTABLE
if (ro->ro_rt == NULL)
(void )flowtable_lookup(AF_INET6, m, (struct route *)ro);
#endif
fibnum = (inp != NULL) ? inp->inp_inc.inc_fibnum : M_GETFIB(m);
again:
/*

View file

@ -6,7 +6,7 @@
PROG= netstat
SRCS= if.c inet.c main.c mbuf.c mroute.c netisr.c nl_symbols.c route.c \
unix.c mroute6.c ipsec.c bpf.c pfkey.c sctp.c \
flowtable.c nl_defs.h
nl_defs.h
nl_symbols.c: nlist_symbols
awk '\

View file

@ -1,88 +0,0 @@
/*-
* Copyright (c) 2014 Gleb Smirnoff <glebius@FreeBSD.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <net/flowtable.h>
#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>
#include "netstat.h"
/*
* Print flowtable statistics.
*/
static void
print_stats(struct flowtable_stat *stat)
{
#define p(f, m) if (stat->f || sflag <= 1) \
printf(m, (uintmax_t)stat->f, plural(stat->f))
#define p2(f, m) if (stat->f || sflag <= 1) \
printf(m, (uintmax_t)stat->f, plurales(stat->f))
p(ft_lookups, "\t%ju lookup%s\n");
p(ft_hits, "\t%ju hit%s\n");
p2(ft_misses, "\t%ju miss%s\n");
p(ft_inserts, "\t%ju insert%s\n");
p(ft_collisions, "\t%ju collision%s\n");
p(ft_free_checks, "\t%ju free check%s\n");
p(ft_frees, "\t%ju free%s\n");
p(ft_fail_lle_invalid,
"\t%ju lookup%s with not resolved Layer 2 address\n");
#undef p2
#undef p
}
void
flowtable_stats(void)
{
struct flowtable_stat stat;
if (!live)
return;
if (fetch_stats("net.flowtable.ip4.stat", 0, &stat,
sizeof(stat), NULL) == 0) {
printf("flowtable for IPv4:\n");
print_stats(&stat);
}
if (fetch_stats("net.flowtable.ip6.stat", 0, &stat,
sizeof(stat), NULL) == 0) {
printf("flowtable for IPv6:\n");
print_stats(&stat);
}
}

View file

@ -480,7 +480,6 @@ main(int argc, char *argv[])
xo_open_container("statistics");
if (sflag) {
rt_stats();
flowtable_stats();
} else
routepr(fib, af);
xo_close_container("statistics");

View file

@ -140,7 +140,6 @@ void intpr(void (*)(char *), int);
void pr_family(int);
void rt_stats(void);
void flowtable_stats(void);
char *routename(struct sockaddr *, int);
const char *netname(struct sockaddr *, struct sockaddr *);