Added support for netlink
[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         ARP_REQ_FROM_CTRL,
23         ARP_REPLY_FROM_CTRL,
24         ICMP_FROM_CTRL,
25         ARP_TO_CTRL,
26         ICMP_TO_CTRL,
27         REQ_MAC_TO_CTRL,
28         PKT_FROM_TAP,
29         MAX_ACTIONS
30 };
31
32 #define HANDLE_RANDOM_IP_FLAG   1
33 #define RANDOM_IP               0xffffffff
34
35 const char *actions_string[MAX_ACTIONS];
36
37 void init_ctrl_plane(struct task_base *tbase);
38
39 int (*handle_ctrl_plane)(struct task_base *tbase, struct rte_mbuf **mbuf, uint16_t n_pkts);
40
41 static inline void tx_drop(struct rte_mbuf *mbuf)
42 {
43         rte_pktmbuf_free(mbuf);
44 }
45
46 struct vdev {
47         int port_id;
48         struct rte_ring *ring;
49 };
50 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);
51 void master_init_vdev(struct task_base *task, uint8_t port_id, uint8_t core_id, uint8_t task_id);