xref: /freebsd/sys/netinet/in_rss.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
17527624eSRobert Watson /*-
27527624eSRobert Watson  * Copyright (c) 2010-2011 Juniper Networks, Inc.
37527624eSRobert Watson  * All rights reserved.
47527624eSRobert Watson  *
57527624eSRobert Watson  * This software was developed by Robert N. M. Watson under contract
67527624eSRobert Watson  * to Juniper Networks, Inc.
77527624eSRobert Watson  *
87527624eSRobert Watson  * Redistribution and use in source and binary forms, with or without
97527624eSRobert Watson  * modification, are permitted provided that the following conditions
107527624eSRobert Watson  * are met:
117527624eSRobert Watson  * 1. Redistributions of source code must retain the above copyright
127527624eSRobert Watson  *    notice, this list of conditions and the following disclaimer.
137527624eSRobert Watson  * 2. Redistributions in binary form must reproduce the above copyright
147527624eSRobert Watson  *    notice, this list of conditions and the following disclaimer in the
157527624eSRobert Watson  *    documentation and/or other materials provided with the distribution.
167527624eSRobert Watson  *
177527624eSRobert Watson  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
187527624eSRobert Watson  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
197527624eSRobert Watson  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
207527624eSRobert Watson  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
217527624eSRobert Watson  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
227527624eSRobert Watson  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
237527624eSRobert Watson  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
247527624eSRobert Watson  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
257527624eSRobert Watson  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
267527624eSRobert Watson  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
277527624eSRobert Watson  * SUCH DAMAGE.
287527624eSRobert Watson  */
297527624eSRobert Watson 
307527624eSRobert Watson #ifndef _NETINET_IN_RSS_H_
317527624eSRobert Watson #define	_NETINET_IN_RSS_H_
327527624eSRobert Watson 
337527624eSRobert Watson #include <netinet/in.h>		/* in_addr_t */
347527624eSRobert Watson 
357527624eSRobert Watson /*
367527624eSRobert Watson  * Network stack interface to generate a hash for a protocol tuple.
377527624eSRobert Watson  */
387527624eSRobert Watson uint32_t	rss_hash_ip4_4tuple(struct in_addr src, u_short srcport,
397527624eSRobert Watson 		    struct in_addr dst, u_short dstport);
407527624eSRobert Watson uint32_t	rss_hash_ip4_2tuple(struct in_addr src, struct in_addr dst);
417527624eSRobert Watson 
4272d33245SAdrian Chadd /*
4372d33245SAdrian Chadd  * Functions to calculate a software RSS hash for a given mbuf or
4472d33245SAdrian Chadd  * packet detail.
4572d33245SAdrian Chadd  */
4672d33245SAdrian Chadd int		rss_mbuf_software_hash_v4(const struct mbuf *m, int dir,
4772d33245SAdrian Chadd 		    uint32_t *hashval, uint32_t *hashtype);
4872d33245SAdrian Chadd int		rss_proto_software_hash_v4(struct in_addr src,
4972d33245SAdrian Chadd 		    struct in_addr dst, u_short src_port, u_short dst_port,
5072d33245SAdrian Chadd 		    int proto, uint32_t *hashval,
5172d33245SAdrian Chadd 		    uint32_t *hashtype);
522527ccadSAdrian Chadd struct mbuf *	rss_soft_m2cpuid_v4(struct mbuf *m, uintptr_t source,
5372d33245SAdrian Chadd 		    u_int *cpuid);
54*0c325f53SAlexander V. Chernikov uint32_t	xps_proto_software_hash_v4(struct in_addr s, struct in_addr d,
55*0c325f53SAlexander V. Chernikov 		    u_short sp, u_short dp, int proto, uint32_t *hashtype);
5672d33245SAdrian Chadd 
577527624eSRobert Watson #endif /* !_NETINET_IN_RSS_H_ */
58