Merge "lw_AFTR: IP Checksum required on generated packet."
[samplevnf.git] / VNFs / DPPD-PROX / packet_utils.h
1 /*
2 // Copyright (c) 2010-2017 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 "arp.h"
18 #include "quit.h"
19 #include "prox_malloc.h"
20 #include "defaults.h"
21 #include "prox_cfg.h"
22 #include "etypes.h"
23
24 #define FLAG_DST_MAC_KNOWN      1
25 #define MAX_ARP_ENTRIES 65536
26
27 struct task_base;
28 struct task_args;
29 struct arp_table {
30         uint64_t arp_update_time;
31         uint64_t arp_timeout;
32         uint32_t ip;
33         struct ether_addr mac;
34 };
35 struct l3_base {
36         struct rte_ring *ctrl_plane_ring;
37         struct task_base *tmaster;
38         uint32_t flags;
39         uint32_t n_pkts;
40         uint8_t reachable_port_id;
41         uint8_t core_id;
42         uint8_t task_id;
43         struct arp_table gw;
44         struct arp_table optimized_arp_table[4];
45         struct rte_hash *ip_hash;
46         struct arp_table *arp_table;
47 };
48
49 void task_init_l3(struct task_base *tbase, struct task_args *targ);
50 void task_start_l3(struct task_base *tbase, struct task_args *targ);
51 int write_dst_mac(struct task_base *tbase, struct rte_mbuf *mbuf, uint32_t *ip_dst);
52 void task_set_gateway_ip(struct task_base *tbase, uint32_t ip);
53 void task_set_local_ip(struct task_base *tbase, uint32_t ip);
54 void handle_ctrl_plane_pkts(struct task_base *tbase, struct rte_mbuf **mbufs, uint16_t n_pkts);