summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/handle_master.h
diff options
context:
space:
mode:
authorXavier Simonart <xavier.simonart@intel.com>2020-05-11 21:00:33 +0200
committerXavier Simonart <xavier.simonart@intel.com>2020-05-29 23:45:09 +0200
commitc871c361f9d69a93429ae385e7dbf21a46aa6857 (patch)
tree957ec8a53d2cd0a9b5676e163c22e8a3ae8f6f3e /VNFs/DPPD-PROX/handle_master.h
parent7c4601f23c526b14a67674782b303663dfaa95af (diff)
Added initial support for NDP (IPv6)
Following messages are now handled by PROX - router_solicitation - neighbour_solicitation - router_advertisement - neighbour_advertisement The following parameters are supported (through the PROX config file) - sub mode=ndp This will enable handling of router and neighbour solicitation and advertisement. - local ipv6=xxxx:xxxx:xxxxx:xxxx:xxxx:xxxx:xxxx:xxxx This will configure the local IPv6 address of the port. This parameter is optional. If not specified, the local IPv6 will be calculated from the EUI. - global ipv6=xxxx:xxxx:xxxxx:xxxx:xxxx:xxxx:xxxx:xxxx This will configure the global IPv6 address of the port. This parameter is optional. If not specified, the global IPv6 will be calculated from the EUI and the router prefix received from the router. - ipv6 router=yes This will cause the core to behave as an IPv6 router i.e. it will generate Router Advertisement messages This is only useful in back to back cases, when no real IPv6 router is present in the setup. - router prefix=xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx The router prefix usedin the router advertisement The prefix will be used by the node to build an IPv6 global address in cases none were configured. "Unsollicited NA" parameter has been added within the core/task section. If set to yes (Unsollicited NA=yes), then an unsollicited neighbour Advertisement is sent at startup A same core/task cannot support both l3 and ndp mode. Those messages will be generated or handled when submode is set to "ndp": - neighbour sollicitation - neighbour advertisement - router sollicitation - router advertisement An example configuration is provided: config/ipv6.cfg in which port 0 / core 1 plays the role of the generator and port 1 / core 2 plays the role of the swap. Change-Id: Id0ab32d384448b4cf767fb4a1c486fc023f4f395 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/handle_master.h')
-rw-r--r--VNFs/DPPD-PROX/handle_master.h91
1 files changed, 75 insertions, 16 deletions
diff --git a/VNFs/DPPD-PROX/handle_master.h b/VNFs/DPPD-PROX/handle_master.h
index fc8706a8..518906ed 100644
--- a/VNFs/DPPD-PROX/handle_master.h
+++ b/VNFs/DPPD-PROX/handle_master.h
@@ -14,30 +14,91 @@
// limitations under the License.
*/
+#include <poll.h>
#include "task_base.h"
#include "task_init.h"
enum arp_actions {
- UPDATE_FROM_CTRL,
- ROUTE_ADD_FROM_CTRL,
- ROUTE_DEL_FROM_CTRL,
- ARP_REQ_FROM_CTRL,
- ARP_REPLY_FROM_CTRL,
- ICMP_FROM_CTRL,
- BGP_FROM_CTRL,
- ARP_TO_CTRL,
- ICMP_TO_CTRL,
- BGP_TO_CTRL,
- REQ_MAC_TO_CTRL,
+ MAC_INFO_FROM_MASTER,
+ MAC_INFO_FROM_MASTER_FOR_IPV6,
+ IPV6_INFO_FROM_MASTER,
+ ROUTE_ADD_FROM_MASTER,
+ ROUTE_DEL_FROM_MASTER,
+ SEND_ARP_REQUEST_FROM_MASTER,
+ SEND_ARP_REPLY_FROM_MASTER,
+ SEND_NDP_FROM_MASTER,
+ SEND_ICMP_FROM_MASTER,
+ SEND_BGP_FROM_MASTER,
+ ARP_PKT_FROM_NET_TO_MASTER,
+ NDP_PKT_FROM_NET_TO_MASTER,
+ ICMP_TO_MASTER,
+ BGP_TO_MASTER,
+ IP4_REQ_MAC_TO_MASTER,
+ IP6_REQ_MAC_TO_MASTER,
PKT_FROM_TAP,
MAX_ACTIONS
};
-#define HANDLE_RANDOM_IP_FLAG 1
+#define PROX_MAX_ARP_REQUESTS 32 // Maximum number of tasks requesting the same MAC address
+
+#define HANDLE_RANDOM_IP_FLAG 1
+#define HANDLE_RANDOM_LOCAL_IP_FLAG 2
+#define HANDLE_RANDOM_GLOBAL_IP_FLAG 4
+#define IPV6_ROUTER 8
#define RANDOM_IP 0xffffffff
#define PROX_PSEUDO_PKT_PORT 0xdead
+struct port_table {
+ prox_rte_ether_addr mac;
+ struct rte_ring *ring;
+ uint32_t ip;
+ uint8_t port;
+ uint8_t flags;
+ struct ipv6_addr local_ipv6_addr;
+ struct ipv6_addr global_ipv6_addr;
+ struct ipv6_addr router_prefix;
+ uint64_t last_echo_req_rcvd_tsc;
+ uint64_t last_echo_rep_rcvd_tsc;
+ uint32_t n_echo_req;
+ uint32_t n_echo_rep;
+};
+
+struct ip_table {
+ prox_rte_ether_addr mac;
+ struct rte_ring *ring;
+};
+
+struct external_ip_table {
+ prox_rte_ether_addr mac;
+ struct rte_ring *rings[PROX_MAX_ARP_REQUESTS];
+ uint16_t nb_requests;
+};
+
+struct vdev {
+ int port_id;
+ struct rte_ring *ring;
+};
+
+struct task_master {
+ struct task_base base;
+ struct rte_ring *ctrl_rx_ring;
+ struct rte_ring **ctrl_tx_rings;
+ struct ip_table *internal_ip_table; // Store mac address from our IP
+ struct external_ip_table *external_ip_table; // Store mac address from external systems
+ struct ip_table *internal_ip6_table; // Store mac address from our IP
+ struct external_ip_table *external_ip6_table; // Store mac address from external systems
+ struct rte_hash *external_ip_hash;
+ struct rte_hash *external_ip6_hash;
+ struct rte_hash *internal_ip_hash;
+ struct rte_hash *internal_ip6_hash;
+ struct port_table internal_port_table[PROX_MAX_PORTS];
+ struct vdev all_vdev[PROX_MAX_PORTS];
+ int max_vdev_id;
+ struct pollfd arp_fds;
+ struct pollfd route_fds;
+};
+
const char *actions_string[MAX_ACTIONS];
void init_ctrl_plane(struct task_base *tbase);
@@ -49,9 +110,7 @@ static inline void tx_drop(struct rte_mbuf *mbuf)
rte_pktmbuf_free(mbuf);
}
-struct vdev {
- int port_id;
- struct rte_ring *ring;
-};
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);
void master_init_vdev(struct task_base *task, uint8_t port_id, uint8_t core_id, uint8_t task_id);
+void register_router_to_ctrl_plane(struct task_base *tbase, uint8_t port_id, uint8_t core_id, uint8_t task_id, struct ipv6_addr *local_ipv6_addr, struct ipv6_addr *global_ipv6_addr, struct ipv6_addr *router_prefix);
+void register_node_to_ctrl_plane(struct task_base *tbase, struct ipv6_addr *local_ipv6_addr, struct ipv6_addr *global_ipv6_addr, uint8_t port_id, uint8_t core_id, uint8_t task_id);