3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs/*
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * CDDL HEADER START
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs *
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * The contents of this file are subject to the terms of the
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * Common Development and Distribution License (the "License").
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * You may not use this file except in compliance with the License.
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs *
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * or http://www.opensolaris.org/os/licensing.
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * See the License for the specific language governing permissions
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * and limitations under the License.
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs *
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * When distributing Covered Code, include this CDDL HEADER in each
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * If applicable, add the following below this CDDL HEADER, with the
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * fields enclosed by brackets "[]" replaced with your own identifying
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * information: Portions Copyright [yyyy] [name of copyright owner]
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs *
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * CDDL HEADER END
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs/*
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * Use is subject to license terms.
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#ifndef _SYS_HXGE_HXGE_FLOW_H
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define _SYS_HXGE_HXGE_FLOW_H
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#pragma ident "%Z%%M% %I% %E% SMI"
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#ifdef __cplusplus
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qsextern "C" {
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#endif
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#include <netinet/in.h>
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define S6_addr32 _S6_un._S6_u32
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qstypedef struct tcpip4_spec_s {
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs in_addr_t ip4src;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs in_addr_t ip4dst;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs in_port_t psrc;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs in_port_t pdst;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs} tcpip4_spec_t;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qstypedef struct tcpip6_spec_s {
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs struct in6_addr ip6src;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs struct in6_addr ip6dst;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs in_port_t psrc;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs in_port_t pdst;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs} tcpip6_spec_t;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qstypedef struct udpip4_spec_s {
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs in_addr_t ip4src;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs in_addr_t ip4dst;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs in_port_t psrc;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs in_port_t pdst;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs} udpip4_spec_t;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qstypedef struct udpip6_spec_s {
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs struct in6_addr ip6src;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs struct in6_addr ip6dst;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs in_port_t psrc;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs in_port_t pdst;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs} udpip6_spec_t;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qstypedef struct ahip4_spec_s {
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs in_addr_t ip4src;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs in_addr_t ip4dst;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs uint32_t spi;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs} ahip4_spec_t;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qstypedef struct ahip6_spec_s {
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs struct in6_addr ip6src;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs struct in6_addr ip6dst;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs uint32_t spi;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs} ahip6_spec_t;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qstypedef ahip4_spec_t espip4_spec_t;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qstypedef ahip6_spec_t espip6_spec_t;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qstypedef struct rawip4_spec_s {
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs struct in6_addr ip4src;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs struct in6_addr ip4dst;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs uint8_t hdata[64];
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs} rawip4_spec_t;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qstypedef struct rawip6_spec_s {
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs struct in6_addr ip6src;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs struct in6_addr ip6dst;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs uint8_t hdata[64];
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs} rawip6_spec_t;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qstypedef struct ether_spec_s {
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs uint16_t ether_type;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs uint8_t frame_size;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs uint8_t eframe[16];
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs} ether_spec_t;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qstypedef struct ip_user_spec_s {
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs uint8_t id;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs uint8_t ip_ver;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs uint8_t proto;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs uint8_t tos_mask;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs uint8_t tos;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs} ip_user_spec_t;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qstypedef ether_spec_t arpip_spec_t;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qstypedef ether_spec_t ether_user_spec_t;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qstypedef struct flow_spec_s {
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs uint32_t flow_type;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs union {
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs tcpip4_spec_t tcpip4spec;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs tcpip6_spec_t tcpip6spec;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs udpip4_spec_t udpip4spec;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs udpip6_spec_t udpip6spec;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs arpip_spec_t arpipspec;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs ahip4_spec_t ahip4spec;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs ahip6_spec_t ahip6spec;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs espip4_spec_t espip4spec;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs espip6_spec_t espip6spec;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs rawip4_spec_t rawip4spec;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs rawip6_spec_t rawip6spec;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs ether_spec_t etherspec;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs ip_user_spec_t ip_usr_spec;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs uint8_t hdata[64];
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs } uh, um; /* entry, mask */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs} flow_spec_t;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define FSPEC_TCPIP4 0x1 /* TCP/IPv4 Flow */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define FSPEC_TCPIP6 0x2 /* TCP/IPv6 */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define FSPEC_UDPIP4 0x3 /* UDP/IPv4 */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define FSPEC_UDPIP6 0x4 /* UDP/IPv6 */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define FSPEC_ARPIP 0x5 /* ARP/IPv4 */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define FSPEC_AHIP4 0x6 /* AH/IP4 */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define FSPEC_AHIP6 0x7 /* AH/IP6 */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define FSPEC_ESPIP4 0x8 /* ESP/IP4 */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define FSPEC_ESPIP6 0x9 /* ESP/IP6 */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define FSPEC_SCTPIP4 0xA /* ESP/IP4 */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define FSPEC_SCTPIP6 0xB /* ESP/IP6 */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define FSPEC_RAW4 0xC /* RAW/IP4 */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define FSPEC_RAW6 0xD /* RAW/IP6 */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define FSPEC_ETHER 0xE /* ETHER Programmable */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define FSPEC_IP_USR 0xF /* IP Programmable */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define FSPEC_HDATA 0x10 /* Pkt Headers eth-da,sa,etype,ip,tcp(Bitmap) */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define TCAM_IPV6_ADDR(m32, ip6addr) { \
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs m32[0] = ip6addr.S6_addr32[0]; \
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs m32[1] = ip6addr.S6_addr32[1]; \
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs m32[2] = ip6addr.S6_addr32[2]; \
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs m32[3] = ip6addr.S6_addr32[3]; \
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs }
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define TCAM_IPV4_ADDR(m32, ip4addr) (m32 = ip4addr)
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define TCAM_IP_PORTS(port32, dp, sp) (port32 = dp | (sp << 16))
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define TCAM_IP_CLASS(key, mask, class) { \
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs key = class; \
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs mask = 0x1f; \
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs }
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#define TCAM_IP_PROTO(key, mask, proto) { \
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs key = proto; \
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs mask = 0xff; \
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs }
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qstypedef struct flow_resource_s {
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs uint64_t channel_cookie;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs uint64_t flow_cookie;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs uint8_t tcam_location;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs flow_spec_t flow_spec;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs} flow_resource_t;
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#ifdef __cplusplus
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs}
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#endif
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#endif /* _SYS_HXGE_HXGE_FLOW_H */