2 // Copyright (c) 2010-2017 Intel Corporation
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef _PACKET_UTILS_H_
17 #define _PACKET_UTILS_H_
21 #include "prox_malloc.h"
26 #define FLAG_DST_MAC_KNOWN 1
27 #define MAX_ARP_ENTRIES 65536
29 #define IP4(x) x & 0xff, (x >> 8) & 0xff, (x >> 16) & 0xff, x >> 24
34 uint64_t arp_update_time;
37 struct ether_addr mac;
40 struct rte_ring *ctrl_plane_ring;
41 struct task_base *tmaster;
44 uint8_t reachable_port_id;
48 struct arp_table optimized_arp_table[4];
49 struct rte_hash *ip_hash;
50 struct arp_table *arp_table;
53 void task_init_l3(struct task_base *tbase, struct task_args *targ);
54 void task_start_l3(struct task_base *tbase, struct task_args *targ);
55 int write_dst_mac(struct task_base *tbase, struct rte_mbuf *mbuf, uint32_t *ip_dst);
56 void task_set_gateway_ip(struct task_base *tbase, uint32_t ip);
57 void task_set_local_ip(struct task_base *tbase, uint32_t ip);
58 void handle_ctrl_plane_pkts(struct task_base *tbase, struct rte_mbuf **mbufs, uint16_t n_pkts);
60 #endif /* _PACKET_UTILS_H_ */