1/*
2 * Copyright (C) 2015, Broadcom Corporation. All Rights Reserved.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 *
16 * $Id: $
17 */
18
19#ifndef _CTF_CFG_H_
20#define _CTF_CFG_H_
21
22#define NETLINK_CTF   20
23
24#define SUCCESS                     0
25#define FAILURE                     -1
26
27#define CTFCFG_MAX_SIZE		    sizeof(ctf_cfg_request_t)
28#define CTFCFG_MAX_ARG_SIZE         1024
29
30#define CTFCFG_CMD_SUSPEND	    1
31#define CTFCFG_CMD_RESUME	    2
32#define CTFCFG_CMD_TUPLE_VALID	    3
33#define CTFCFG_CMD_DEFAULT_FWD_GET  4
34#define CTFCFG_CMD_DEFAULT_FWD_SET  5
35#define CTFCFG_CMD_UPD_MARK	    6
36#define CTFCFG_CMD_CHANGE_TXIF_TO_BR	7
37
38#define CTFCFG_STATUS_SUCCESS			1
39#define CTFCFG_STATUS_FAILURE			2
40#define CTFCFG_STATUS_TUPLE_INVALID		3
41#define CTFCFG_STATUS_FLOW_ALREADY_SUSPENDED	4
42#define CTFCFG_STATUS_FLOW_NOT_SUSPENDED	5
43#define CTFCFG_STATUS_DEFAULT_FWD_INVALID	6
44#define CTFCFG_STATUS_PROTOCOL_NOT_SUPPORTED	7
45
46typedef union
47{
48	struct in_addr ip_v4;
49	struct in6_addr ip_v6;
50} ip_address_t;
51
52typedef struct
53{
54	int family;
55
56	ip_address_t src_addr;
57	ip_address_t dst_addr;
58
59	uint16_t src_port;
60	uint16_t dst_port;
61
62	uint8_t protocol;
63} ctf_tuple_t;
64
65typedef enum {
66	CTF_FWD_FASTPATH,
67	CTF_FWD_HOST,	/* i.e. send to network stack */
68} ctf_fwd_t;
69
70typedef struct ctf_cfg_request
71{
72	uint32_t command_id;
73	uint32_t status;		/* Command status */
74	uint32_t size;			/* Size of the argument */
75	uint8_t	 arg[CTFCFG_MAX_ARG_SIZE];
76} ctf_cfg_request_t;
77
78#endif /* _CTF_CFG_H_ */
79