summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/handle_qinq_encap4.h
blob: 639135e05b4dfe5776fbe1208c0865439ef92aee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
// Copyright (c) 2010-2017 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
*/

#ifndef _HANDLE_QINQ_ENCAP4_H_
#define _HANDLE_QINQ_ENCAP4_H_

#include <rte_ip.h>
#include <rte_ether.h>

#include "log.h"
#include "prox_assert.h"
#include "etypes.h"
#include "mpls.h"
#include "task_init.h"

struct task_qinq_encap4 {
        struct task_base base;
        struct rte_table_hash  *cpe_table;
	uint16_t         qinq_tag;
	uint64_t         src_mac[PROX_MAX_PORTS];
	int              offload_crc;
        uint8_t          runtime_flags;
        uint8_t          *dscp;
        uint64_t         keys[64];
        struct rte_mbuf* fake_packets[64];
        uint64_t         cpe_timeout;
#ifdef ENABLE_EXTRA_USER_STATISTICS
        uint32_t        *stats_per_user;
	uint32_t 	n_users;
#endif
};

struct qinq_gre_entry {
	uint16_t svlan;
	uint16_t cvlan;
	uint32_t gre_id;
	uint32_t user;
	uint32_t rss; // RSS based on Toeplitz_hash(svlan and cvlan)
};

struct qinq_gre_map {
	uint32_t              count;
	struct qinq_gre_entry entries[0];
};

struct qinq_gre_map *get_qinq_gre_map(struct task_args *targ);

struct task_args;
struct prox_shared;

void init_qinq_gre_table(struct task_args *targ, struct qinq_gre_map *qinq_gre_map);
void init_qinq_gre_hash(struct task_args *targ, struct qinq_gre_map *qinq_gre_map);
void init_cpe4_table(struct task_args *targ);
void init_cpe4_hash(struct task_args *targ);

static inline uint8_t mpls_untag(struct rte_mbuf *mbuf)
{
	struct ether_hdr *peth = rte_pktmbuf_mtod(mbuf, struct ether_hdr *);
	const uint16_t eth_type = peth->ether_type;

	if (eth_type == ETYPE_MPLSU) {
		struct ether_hdr *pneweth = (struct ether_hdr *)rte_pktmbuf_adj(mbuf, 4);
		const struct mpls_hdr *mpls = (const struct mpls_hdr *)(peth + 1);

		if (mpls->bos == 0) {
			// Double MPLS tag
			pneweth = (struct ether_hdr *)rte_pktmbuf_adj(mbuf, 4);
			PROX_ASSERT(pneweth);
		}

		const struct ipv4_hdr *pip = (const struct ipv4_hdr *)(pneweth + 1);
		if ((pip->version_ihl >> 4) == 4) {
			pneweth->ether_type = ETYPE_IPv4;
			return 1;
		}
		else if ((pip->version_ihl >> 4) == 6) {
			pneweth->ether_type = ETYPE_IPv6;
			return 1;
		}

		plog_info("Error removing MPLS: unexpected IP version: %d\n", pip->version_ihl >> 4);
		return 0;
	}
	if (eth_type != ETYPE_LLDP) {
		plog_info("Error Removing MPLS: ether_type = %#06x\n", eth_type);
	}
	return 0;
}

#endif /* _HANDLE_QINQ_ENCAP4_H_ */
lass="p">::network::neutron include ::neutron include ::neutron::config # If the value of core plugin is set to 'nuage', # include nuage agent, # If the value of core plugin is set to 'midonet', # include midonet agent, # else use the default value of 'ml2' if hiera('neutron::core_plugin') == 'neutron.plugins.nuage.plugin.NuagePlugin' { include ::nuage::vrs include ::nova::compute::neutron class { '::nuage::metadataagent': nova_os_tenant_name => hiera('nova::api::admin_tenant_name'), nova_os_password => hiera('nova_password'), nova_metadata_ip => hiera('nova_metadata_node_ips'), nova_auth_ip => hiera('keystone_public_api_virtual_ip'), } } elsif hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' { # TODO(devvesa) provide non-controller ips for these services $zookeeper_node_ips = hiera('neutron_api_node_ips') $cassandra_node_ips = hiera('neutron_api_node_ips') class {'::tripleo::network::midonet::agent': zookeeper_servers => $zookeeper_node_ips, cassandra_seeds => $cassandra_node_ips } } elsif hiera('neutron::core_plugin') == 'neutron_plugin_contrail.plugins.opencontrail.contrail_plugin.NeutronPluginContrailCoreV2' { include ::contrail::vrouter # NOTE: it's not possible to use this class without a functional # contrail controller up and running #class {'::contrail::vrouter::provision_vrouter': # require => Class['contrail::vrouter'], #} } else { include ::neutron::plugins::ml2 include ::neutron::agents::ml2::ovs if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') { class { '::neutron::agents::n1kv_vem': n1kv_source => hiera('n1kv_vem_source', undef), n1kv_version => hiera('n1kv_vem_version', undef), } } if 'bsn_ml2' in hiera('neutron::plugins::ml2::mechanism_drivers') { include ::neutron::agents::bigswitch } } neutron_config { 'DEFAULT/host': value => $fqdn; } include ::ceilometer include ::ceilometer::config include ::ceilometer::agent::compute include ::ceilometer::agent::auth $snmpd_user = hiera('snmpd_readonly_user_name') snmp::snmpv3_user { $snmpd_user: authtype => 'MD5', authpass => hiera('snmpd_readonly_user_password'), } class { '::snmp': agentaddress => ['udp:161','udp6:[::1]:161'], snmpd_config => [ join(['createUser ', hiera('snmpd_readonly_user_name'), ' MD5 "', hiera('snmpd_readonly_user_password'), '"']), join(['rouser ', hiera('snmpd_readonly_user_name')]), 'proc cron', 'includeAllDisks 10%', 'master agentx', 'trapsink localhost public', 'iquerySecName internalUser', 'rouser internalUser', 'defaultMonitors yes', 'linkUpDownNotifications yes' ], } hiera_include('compute_classes') package_manifest{'/var/lib/tripleo/installed-packages/overcloud_compute': ensure => present}