From owner-svn-src-user@FreeBSD.ORG Thu Feb 4 05:07:21 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F2EB106566C; Thu, 4 Feb 2010 05:07:21 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2FA228FC12; Thu, 4 Feb 2010 05:07:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1457L9N016557; Thu, 4 Feb 2010 05:07:21 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1457Lov016554; Thu, 4 Feb 2010 05:07:21 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201002040507.o1457Lov016554@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Feb 2010 05:07:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203473 - user/kmacy/head_flowtable_v6/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2010 05:07:21 -0000 Author: kmacy Date: Thu Feb 4 05:07:20 2010 New Revision: 203473 URL: http://svn.freebsd.org/changeset/base/203473 Log: - remove proto arg - make kern_flowtable_insert handle v6 and v4 Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c user/kmacy/head_flowtable_v6/sys/net/flowtable.h Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/flowtable.c Thu Feb 4 03:30:31 2010 (r203472) +++ user/kmacy/head_flowtable_v6/sys/net/flowtable.c Thu Feb 4 05:07:20 2010 (r203473) @@ -350,9 +350,6 @@ flowtable_pcpu_unlock(struct flowtable * #define FL_STALE (1<<8) #define FL_IPV6 (1<<9) #define FL_OVERWRITE (1<<10) -#define FL_TCP (1<<11) -#define FL_SCTP (1<<12) -#define FL_UDP (1<<13) void flow_invalidate(struct flentry *fle) @@ -812,12 +809,13 @@ flowtable_set_hashkey(struct flentry *fl static int flowtable_insert(struct flowtable *ft, uint32_t hash, uint32_t *key, - uint8_t proto, uint32_t fibnum, struct route *ro, uint16_t flags) + uint32_t fibnum, struct route *ro, uint16_t flags) { struct flentry *fle, *fletail, *newfle, **flep; int depth; uma_zone_t flezone; bitstr_t *mask; + uint8_t proto; flezone = (flags & FL_IPV6) ? V_flow_ipv6_zone : V_flow_ipv4_zone; newfle = uma_zalloc(flezone, M_NOWAIT | M_ZERO); @@ -825,7 +823,8 @@ flowtable_insert(struct flowtable *ft, u return (ENOMEM); newfle->f_flags |= (flags & FL_IPV6); - + proto = flags_to_proto(flags); + FL_ENTRY_LOCK(ft, hash); mask = flowtable_mask(ft); flep = flowtable_entry(ft, hash); @@ -886,17 +885,25 @@ skip: int kern_flowtable_insert(struct flowtable *ft, struct sockaddr *ssa, - struct sockaddr *dsa, struct route *ro, uint32_t fibnum, int flags, - uint8_t proto) + struct sockaddr *dsa, struct route *ro, uint32_t fibnum, int flags) { uint32_t key[9], hash; flags = (ft->ft_flags | flags | FL_OVERWRITE); + hash = 0; - hash = ipv4_flow_lookup_hash_internal((struct sockaddr_in *)ssa, - (struct sockaddr_in *)dsa, key, flags); +#ifdef INET + if (ssa->sa_family == AF_INET) + hash = ipv4_flow_lookup_hash_internal((struct sockaddr_in *)ssa, + (struct sockaddr_in *)dsa, key, flags); +#endif +#ifdef INET6 + if (ssa->sa_family == AF_INET6) + hash = ipv6_flow_lookup_hash_internal((struct sockaddr_in6 *)ssa, + (struct sockaddr_in6 *)dsa, key, flags); +#endif - return (flowtable_insert(ft, hash, key, proto, fibnum, ro, flags)); + return (flowtable_insert(ft, hash, key, fibnum, ro, flags)); } static int @@ -1059,8 +1066,7 @@ uncached: ro->ro_rt = NULL; return (NULL); } - error = flowtable_insert(ft, hash, key, proto, fibnum, - ro, flags); + error = flowtable_insert(ft, hash, key, fibnum, ro, flags); if (error) { RTFREE(rt); Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.h ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/flowtable.h Thu Feb 4 03:30:31 2010 (r203472) +++ user/kmacy/head_flowtable_v6/sys/net/flowtable.h Thu Feb 4 05:07:20 2010 (r203473) @@ -38,6 +38,10 @@ $FreeBSD$ #define FL_PCPU (1<<1) /* pcpu cache */ #define FL_NOAUTO (1<<2) /* don't automatically add flentry on miss */ +#define FL_TCP (1<<11) +#define FL_SCTP (1<<12) +#define FL_UDP (1<<13) + struct flowtable; struct flentry; @@ -57,8 +61,7 @@ struct flentry *flowtable_lookup(struct struct sockaddr *dsa, uint32_t fibnum, int flags); int kern_flowtable_insert(struct flowtable *ft, struct sockaddr *ssa, - struct sockaddr *dsa, struct route *ro, uint32_t fibnum, int flags, - uint8_t proto); + struct sockaddr *dsa, struct route *ro, uint32_t fibnum, int flags); void flow_invalidate(struct flentry *fl);