New upstream version 18.02
[deb_dpdk.git] / examples / ip_pipeline / pipeline / pipeline_firewall_be.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2015 Intel Corporation
3  */
4
5 #ifndef __INCLUDE_PIPELINE_FIREWALL_BE_H__
6 #define __INCLUDE_PIPELINE_FIREWALL_BE_H__
7
8 #include "pipeline_common_be.h"
9
10 enum pipeline_firewall_key_type {
11         PIPELINE_FIREWALL_IPV4_5TUPLE,
12 };
13
14 struct pipeline_firewall_key_ipv4_5tuple {
15         uint32_t src_ip;
16         uint32_t src_ip_mask;
17         uint32_t dst_ip;
18         uint32_t dst_ip_mask;
19         uint16_t src_port_from;
20         uint16_t src_port_to;
21         uint16_t dst_port_from;
22         uint16_t dst_port_to;
23         uint8_t proto;
24         uint8_t proto_mask;
25 };
26
27 struct pipeline_firewall_key {
28         enum pipeline_firewall_key_type type;
29         union {
30                 struct pipeline_firewall_key_ipv4_5tuple ipv4_5tuple;
31         } key;
32 };
33
34 enum pipeline_firewall_msg_req_type {
35         PIPELINE_FIREWALL_MSG_REQ_ADD = 0,
36         PIPELINE_FIREWALL_MSG_REQ_DEL,
37         PIPELINE_FIREWALL_MSG_REQ_ADD_BULK,
38         PIPELINE_FIREWALL_MSG_REQ_DEL_BULK,
39         PIPELINE_FIREWALL_MSG_REQ_ADD_DEFAULT,
40         PIPELINE_FIREWALL_MSG_REQ_DEL_DEFAULT,
41         PIPELINE_FIREWALL_MSG_REQS
42 };
43
44 /*
45  * MSG ADD
46  */
47 struct pipeline_firewall_add_msg_req {
48         enum pipeline_msg_req_type type;
49         enum pipeline_firewall_msg_req_type subtype;
50
51         /* key */
52         struct pipeline_firewall_key key;
53
54         /* data */
55         int32_t priority;
56         uint32_t port_id;
57 };
58
59 struct pipeline_firewall_add_msg_rsp {
60         int status;
61         int key_found;
62         void *entry_ptr;
63 };
64
65 /*
66  * MSG DEL
67  */
68 struct pipeline_firewall_del_msg_req {
69         enum pipeline_msg_req_type type;
70         enum pipeline_firewall_msg_req_type subtype;
71
72         /* key */
73         struct pipeline_firewall_key key;
74 };
75
76 struct pipeline_firewall_del_msg_rsp {
77         int status;
78         int key_found;
79 };
80
81 /*
82  * MSG ADD BULK
83  */
84 struct pipeline_firewall_add_bulk_msg_req {
85         enum pipeline_msg_req_type type;
86         enum pipeline_firewall_msg_req_type subtype;
87
88         struct pipeline_firewall_key *keys;
89         uint32_t n_keys;
90
91         uint32_t *priorities;
92         uint32_t *port_ids;
93         int *keys_found;
94         void **entries_ptr;
95 };
96 struct pipeline_firewall_add_bulk_msg_rsp {
97         int status;
98 };
99
100 /*
101  * MSG DEL BULK
102  */
103 struct pipeline_firewall_del_bulk_msg_req {
104         enum pipeline_msg_req_type type;
105         enum pipeline_firewall_msg_req_type subtype;
106
107         /* key */
108         struct pipeline_firewall_key *keys;
109         uint32_t n_keys;
110         int *keys_found;
111 };
112
113 struct pipeline_firewall_del_bulk_msg_rsp {
114         int status;
115 };
116
117 /*
118  * MSG ADD DEFAULT
119  */
120 struct pipeline_firewall_add_default_msg_req {
121         enum pipeline_msg_req_type type;
122         enum pipeline_firewall_msg_req_type subtype;
123
124         /* data */
125         uint32_t port_id;
126 };
127
128 struct pipeline_firewall_add_default_msg_rsp {
129         int status;
130         void *entry_ptr;
131 };
132
133 /*
134  * MSG DEL DEFAULT
135  */
136 struct pipeline_firewall_del_default_msg_req {
137         enum pipeline_msg_req_type type;
138         enum pipeline_firewall_msg_req_type subtype;
139 };
140
141 struct pipeline_firewall_del_default_msg_rsp {
142         int status;
143 };
144
145 extern struct pipeline_be_ops pipeline_firewall_be_ops;
146
147 #endif