1263198Srwatson/*-
2263198Srwatson * Copyright (c) 2010-2011 Juniper Networks, Inc.
3263198Srwatson * All rights reserved.
4263198Srwatson *
5263198Srwatson * This software was developed by Robert N. M. Watson under contract
6263198Srwatson * to Juniper Networks, Inc.
7263198Srwatson *
8263198Srwatson * Redistribution and use in source and binary forms, with or without
9263198Srwatson * modification, are permitted provided that the following conditions
10263198Srwatson * are met:
11263198Srwatson * 1. Redistributions of source code must retain the above copyright
12263198Srwatson *    notice, this list of conditions and the following disclaimer.
13263198Srwatson * 2. Redistributions in binary form must reproduce the above copyright
14263198Srwatson *    notice, this list of conditions and the following disclaimer in the
15263198Srwatson *    documentation and/or other materials provided with the distribution.
16263198Srwatson *
17263198Srwatson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18263198Srwatson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19263198Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20263198Srwatson * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21263198Srwatson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22263198Srwatson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23263198Srwatson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24263198Srwatson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25263198Srwatson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26263198Srwatson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27263198Srwatson * SUCH DAMAGE.
28263198Srwatson *
29263198Srwatson * $FreeBSD$
30263198Srwatson */
31263198Srwatson
32263198Srwatson#ifndef _NETINET_IN_RSS_H_
33263198Srwatson#define	_NETINET_IN_RSS_H_
34263198Srwatson
35263198Srwatson#include <netinet/in.h>		/* in_addr_t */
36263198Srwatson
37263198Srwatson/*
38263198Srwatson * Network stack interface to generate a hash for a protocol tuple.
39263198Srwatson */
40263198Srwatsonuint32_t	rss_hash_ip4_4tuple(struct in_addr src, u_short srcport,
41263198Srwatson		    struct in_addr dst, u_short dstport);
42263198Srwatsonuint32_t	rss_hash_ip4_2tuple(struct in_addr src, struct in_addr dst);
43263198Srwatson
44263198Srwatson/*
45271297Sadrian * Functions to calculate a software RSS hash for a given mbuf or
46271297Sadrian * packet detail.
47271297Sadrian */
48271297Sadrianint		rss_mbuf_software_hash_v4(const struct mbuf *m, int dir,
49271297Sadrian		    uint32_t *hashval, uint32_t *hashtype);
50271297Sadrianint		rss_proto_software_hash_v4(struct in_addr src,
51271297Sadrian		    struct in_addr dst, u_short src_port, u_short dst_port,
52271297Sadrian		    int proto, uint32_t *hashval,
53271297Sadrian		    uint32_t *hashtype);
54287277Sadrianstruct mbuf *	rss_soft_m2cpuid_v4(struct mbuf *m, uintptr_t source,
55271297Sadrian		    u_int *cpuid);
56271297Sadrian
57263198Srwatson#endif /* !_NETINET_IN_RSS_H_ */
58