7915445805b5ac9c3c025887cda81122d6e2b4ab
[samplevnf.git] / VNFs / DPPD-PROX / handle_master.h
1 /*
2 // Copyright (c) 2010-2020 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 */
16
17 #include "task_base.h"
18 #include "task_init.h"
19
20 enum arp_actions {
21         UPDATE_FROM_CTRL,
22         ROUTE_ADD_FROM_CTRL,
23         ROUTE_DEL_FROM_CTRL,
24         ARP_REQ_FROM_CTRL,
25         ARP_REPLY_FROM_CTRL,
26         ICMP_FROM_CTRL,
27         BGP_FROM_CTRL,
28         ARP_TO_CTRL,
29         ICMP_TO_CTRL,
30         BGP_TO_CTRL,
31         REQ_MAC_TO_CTRL,
32         PKT_FROM_TAP,
33         MAX_ACTIONS
34 };
35
36 #define HANDLE_RANDOM_IP_FLAG   1
37 #define RANDOM_IP               0xffffffff
38
39 const char *actions_string[MAX_ACTIONS];
40
41 void init_ctrl_plane(struct task_base *tbase);
42
43 int (*handle_ctrl_plane)(struct task_base *tbase, struct rte_mbuf **mbuf, uint16_t n_pkts);
44
45 static inline void tx_drop(struct rte_mbuf *mbuf)
46 {
47         rte_pktmbuf_free(mbuf);
48 }
49
50 struct vdev {
51         int port_id;
52         struct rte_ring *ring;
53 };
54 void register_ip_to_ctrl_plane(struct task_base *task, uint32_t ip, uint8_t port_id, uint8_t core_id, uint8_t task_id);
55 void master_init_vdev(struct task_base *task, uint8_t port_id, uint8_t core_id, uint8_t task_id);