aboutsummaryrefslogtreecommitdiffstats
path: root/extras/vpp_config/data/80-vpp.conf.template
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2019-10-29 22:58:50 -0400
committerDave Wallace <dwallacelf@gmail.com>2019-10-30 20:17:12 +0000
commit35b037fd7f7ff1842f8d72a969c8415aa6f60d4d (patch)
tree2cdb223fa47db99793435fdf6244698319c158bf /extras/vpp_config/data/80-vpp.conf.template
parentb101058890d66c960713fc7c203094fb54643755 (diff)
vpp_config: fix typos in templates
Type: style Change-Id: Ia435604c8c48a78054848095567f1e54d028227e Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'extras/vpp_config/data/80-vpp.conf.template')
-rw-r--r--extras/vpp_config/data/80-vpp.conf.template2
1 files changed, 1 insertions, 1 deletions
diff --git a/extras/vpp_config/data/80-vpp.conf.template b/extras/vpp_config/data/80-vpp.conf.template
index 8fdf184cf83..539cbb704dc 100644
--- a/extras/vpp_config/data/80-vpp.conf.template
+++ b/extras/vpp_config/data/80-vpp.conf.template
@@ -7,7 +7,7 @@ vm.max_map_count=3096
# All groups allowed to access hugepages
vm.hugetlb_shm_group=0
-# Shared Memory Max must be greator or equal to the total size of hugepages.
+# Shared Memory Max must be greater or equal to the total size of hugepages.
# For 2MB pages, TotalHugepageSize = vm.nr_hugepages * 2 * 1024 * 1024
# If the existing kernel.shmmax setting (cat /sys/proc/kernel/shmmax)
# is greater than the calculated TotalHugepageSize then set this parameter
id='n227' href='#n227'>227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422
/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright(c) 2010-2018 Intel Corporation
 */

#include <stdint.h>
#include <stdlib.h>
#include <string.h>

#include <rte_string_fns.h>
#include <rte_table_hash_func.h>

#include "rte_eth_softnic_internals.h"

/**
 * Input port
 */
int
softnic_port_in_action_profile_init(struct pmd_internals *p)
{
	TAILQ_INIT(&p->port_in_action_profile_list);

	return 0;
}

void
softnic_port_in_action_profile_free(struct pmd_internals *p)
{
	for ( ; ; ) {
		struct softnic_port_in_action_profile *profile;

		profile = TAILQ_FIRST(&p->port_in_action_profile_list);
		if (profile == NULL)
			break;

		TAILQ_REMOVE(&p->port_in_action_profile_list, profile, node);
		free(profile);
	}
}

struct softnic_port_in_action_profile *
softnic_port_in_action_profile_find(struct pmd_internals *p,
	const char *name)
{
	struct softnic_port_in_action_profile *profile;

	if (name == NULL)
		return NULL;

	TAILQ_FOREACH(profile, &p->port_in_action_profile_list, node)
		if (strcmp(profile->name, name) == 0)
			return profile;

	return NULL;
}

struct softnic_port_in_action_profile *
softnic_port_in_action_profile_create(struct pmd_internals *p,
	const char *name,
	struct softnic_port_in_action_profile_params *params)
{
	struct softnic_port_in_action_profile *profile;
	struct rte_port_in_action_profile *ap;
	int status;

	/* Check input params */
	if (name == NULL ||
		softnic_port_in_action_profile_find(p, name) ||
		params == NULL)
		return NULL;

	if ((params->action_mask & (1LLU << RTE_PORT_IN_ACTION_LB)) &&
		params->lb.f_hash == NULL) {
		switch (params->lb.key_size) {
		case  8:
			params->lb.f_hash = rte_table_hash_crc_key8;
			break;

		case 16:
			params->lb.f_hash = rte_table_hash_crc_key16;
			break;

		case 24:
			params->lb.f_hash = rte_table_hash_crc_key24;
			break;

		case 32:
			params->lb.f_hash = rte_table_hash_crc_key32;
			break;

		case 40:
			params->lb.f_hash = rte_table_hash_crc_key40;
			break;

		case 48:
			params->lb.f_hash = rte_table_hash_crc_key48;
			break;

		case 56:
			params->lb.f_hash = rte_table_hash_crc_key56;
			break;

		case 64:
			params->lb.f_hash = rte_table_hash_crc_key64;
			break;

		default:
			return NULL;
		}

		params->lb.seed = 0;
	}

	/* Resource */
	ap = rte_port_in_action_profile_create(0);
	if (ap == NULL)
		return NULL;

	if (params->action_mask & (1LLU << RTE_PORT_IN_ACTION_FLTR)) {
		status = rte_port_in_action_profile_action_register(ap,
			RTE_PORT_IN_ACTION_FLTR,
			&params->fltr);

		if (status) {
			rte_port_in_action_profile_free(ap);
			return NULL;
		}
	}

	if (params->action_mask & (1LLU << RTE_PORT_IN_ACTION_LB)) {
		status = rte_port_in_action_profile_action_register(ap,
			RTE_PORT_IN_ACTION_LB,
			&params->lb);

		if (status) {
			rte_port_in_action_profile_free(ap);
			return NULL;
		}
	}

	status = rte_port_in_action_profile_freeze(ap);
	if (status) {
		rte_port_in_action_profile_free(ap);
		return NULL;
	}

	/* Node allocation */
	profile = calloc(1, sizeof(struct softnic_port_in_action_profile));
	if (profile == NULL) {
		rte_port_in_action_profile_free(ap);
		return NULL;
	}

	/* Node fill in */
	strlcpy(profile->name, name, sizeof(profile->name));
	memcpy(&profile->params, params, sizeof(*params));
	profile->ap = ap;

	/* Node add to list */
	TAILQ_INSERT_TAIL(&p->port_in_action_profile_list, profile, node);

	return profile;
}

/**
 * Table
 */
int
softnic_table_action_profile_init(struct pmd_internals *p)
{
	TAILQ_INIT(&p->table_action_profile_list);

	return 0;
}

void
softnic_table_action_profile_free(struct pmd_internals *p)
{
	for ( ; ; ) {
		struct softnic_table_action_profile *profile;

		profile = TAILQ_FIRST(&p->table_action_profile_list);
		if (profile == NULL)
			break;

		TAILQ_REMOVE(&p->table_action_profile_list, profile, node);
		free(profile);
	}
}

struct softnic_table_action_profile *
softnic_table_action_profile_find(struct pmd_internals *p,
	const char *name)
{
	struct softnic_table_action_profile *profile;

	if (name == NULL)
		return NULL;

	TAILQ_FOREACH(profile, &p->table_action_profile_list, node)
		if (strcmp(profile->name, name) == 0)
			return profile;

	return NULL;
}

struct softnic_table_action_profile *
softnic_table_action_profile_create(struct pmd_internals *p,
	const char *name,
	struct softnic_table_action_profile_params *params)
{
	struct softnic_table_action_profile *profile;
	struct rte_table_action_profile *ap;
	int status;

	/* Check input params */
	if (name == NULL ||
		softnic_table_action_profile_find(p, name) ||
		params == NULL ||
		((params->action_mask & (1LLU << RTE_TABLE_ACTION_FWD)) == 0))
		return NULL;

	if ((params->action_mask & (1LLU << RTE_TABLE_ACTION_LB)) &&
		params->lb.f_hash == NULL) {
		switch (params->lb.key_size) {
		case 8:
			params->lb.f_hash = rte_table_hash_crc_key8;
			break;

		case 16:
			params->lb.f_hash = rte_table_hash_crc_key16;
			break;

		case 24:
			params->lb.f_hash = rte_table_hash_crc_key24;
			break;

		case 32:
			params->lb.f_hash = rte_table_hash_crc_key32;
			break;

		case 40:
			params->lb.f_hash = rte_table_hash_crc_key40;
			break;

		case 48:
			params->lb.f_hash = rte_table_hash_crc_key48;
			break;

		case 56:
			params->lb.f_hash = rte_table_hash_crc_key56;
			break;

		case 64:
			params->lb.f_hash = rte_table_hash_crc_key64;
			break;

		default:
			return NULL;
		}

		params->lb.seed = 0;
	}

	/* Resource */
	ap = rte_table_action_profile_create(&params->common);
	if (ap == NULL)
		return NULL;

	if (params->action_mask & (1LLU << RTE_TABLE_ACTION_FWD)) {
		status = rte_table_action_profile_action_register(ap,
			RTE_TABLE_ACTION_FWD,
			NULL);

		if (status) {
			rte_table_action_profile_free(ap);
			return NULL;
		}
	}

	if (params->action_mask & (1LLU << RTE_TABLE_ACTION_LB)) {
		status = rte_table_action_profile_action_register(ap,
			RTE_TABLE_ACTION_LB,
			&params->lb);

		if (status) {
			rte_table_action_profile_free(ap);
			return NULL;
		}
	}

	if (params->action_mask & (1LLU << RTE_TABLE_ACTION_MTR)) {
		status = rte_table_action_profile_action_register(ap,
			RTE_TABLE_ACTION_MTR,
			&params->mtr);

		if (status) {
			rte_table_action_profile_free(ap);
			return NULL;
		}
	}

	if (params->action_mask & (1LLU << RTE_TABLE_ACTION_TM)) {
		status = rte_table_action_profile_action_register(ap,
			RTE_TABLE_ACTION_TM,
			&params->tm);

		if (status) {
			rte_table_action_profile_free(ap);
			return NULL;
		}
	}

	if (params->action_mask & (1LLU << RTE_TABLE_ACTION_ENCAP)) {
		status = rte_table_action_profile_action_register(ap,
			RTE_TABLE_ACTION_ENCAP,
			&params->encap);

		if (status) {
			rte_table_action_profile_free(ap);
			return NULL;
		}
	}

	if (params->action_mask & (1LLU << RTE_TABLE_ACTION_NAT)) {
		status = rte_table_action_profile_action_register(ap,
			RTE_TABLE_ACTION_NAT,
			&params->nat);

		if (status) {
			rte_table_action_profile_free(ap);
			return NULL;
		}
	}

	if (params->action_mask & (1LLU << RTE_TABLE_ACTION_TTL)) {
		status = rte_table_action_profile_action_register(ap,
			RTE_TABLE_ACTION_TTL,
			&params->ttl);

		if (status) {
			rte_table_action_profile_free(ap);
			return NULL;
		}
	}

	if (params->action_mask & (1LLU << RTE_TABLE_ACTION_STATS)) {
		status = rte_table_action_profile_action_register(ap,
			RTE_TABLE_ACTION_STATS,
			&params->stats);

		if (status) {
			rte_table_action_profile_free(ap);
			return NULL;
		}
	}
	if (params->action_mask & (1LLU << RTE_TABLE_ACTION_TIME)) {
		status = rte_table_action_profile_action_register(ap,
			RTE_TABLE_ACTION_TIME,
			NULL);

		if (status) {
			rte_table_action_profile_free(ap);
			return NULL;
		}
	}

	if (params->action_mask & (1LLU << RTE_TABLE_ACTION_TAG)) {
		status = rte_table_action_profile_action_register(ap,
			RTE_TABLE_ACTION_TAG,
			NULL);

		if (status) {
			rte_table_action_profile_free(ap);
			return NULL;
		}
	}

	if (params->action_mask & (1LLU << RTE_TABLE_ACTION_DECAP)) {
		status = rte_table_action_profile_action_register(ap,
			RTE_TABLE_ACTION_DECAP,
			NULL);

		if (status) {
			rte_table_action_profile_free(ap);
			return NULL;
		}
	}

	if (params->action_mask & (1LLU << RTE_TABLE_ACTION_SYM_CRYPTO)) {
		status = rte_table_action_profile_action_register(ap,
			RTE_TABLE_ACTION_SYM_CRYPTO,
			&params->sym_crypto);

		if (status) {
			rte_table_action_profile_free(ap);
			return NULL;
		}
	}

	status = rte_table_action_profile_freeze(ap);
	if (status) {
		rte_table_action_profile_free(ap);
		return NULL;
	}

	/* Node allocation */
	profile = calloc(1, sizeof(struct softnic_table_action_profile));
	if (profile == NULL) {
		rte_table_action_profile_free(ap);
		return NULL;
	}

	/* Node fill in */
	strlcpy(profile->name, name, sizeof(profile->name));
	memcpy(&profile->params, params, sizeof(*params));
	profile->ap = ap;

	/* Node add to list */
	TAILQ_INSERT_TAIL(&p->table_action_profile_list, profile, node);

	return profile;
}