<commit_before>/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright(c) 2010-2014 Intel Corporation
 */

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

#include "test.h"

#include <rte_cycles.h>
#include <rte_ether.h>
#include <rte_ip.h>
#include <rte_byteorder.h>
#include <rte_sched.h>


#define SUBPORT         0
#define PIPE            1
#define TC              2
#define QUEUE           3

static struct rte_sched_subport_params subport_param[] = {
	{
		.tb_rate = 1250000000,
		.tb_size = 1000000,

		.tc_rate = {1250000000, 1250000000, 1250000000, 1250000000},
		.tc_period = 10,
	},
};

static struct rte_sched_pipe_params pipe_profile[] = {
	{ /* Profile #0 */
		.tb_rate = 305175,
		.tb_size = 1000000,

		.tc_rate = {305175, 305175, 305175, 305175},
		.tc_period = 40,

		.wrr_weights = {1, 1, 1, 1},
	},
};

static struct rte_sched_port_params port_param = {
	.socket = 0, /* computed */
	.rate = 0, /* computed */
	.mtu = 1522,
	.frame_overhead = RTE_SCHED_FRAME_OVERHEAD_DEFAULT,
	.n_subports_per_port = 1,
	.n_pipes_per_subport = 1024,
	.qsize = {32, 32, 32, 32},
	.pipe_profiles = pipe_profile,
	.n_pipe_profiles = 1,
};

#define NB_MBUF          32
#define MBUF_DATA_SZ     (2048 + RTE_PKTMBUF_HEADROOM)
#define MEMPOOL_CACHE_SZ 0
#define SOCKET           0


static struct rte_mempool *
create_mempool(void)
{
	struct rte_mempool * mp;

	mp = rte_mempool_lookup("test_sched");
	if (!mp)
		mp = rte_pktmbuf_pool_create("test_sched", NB_MBUF,
			MEMPOOL_CACHE_SZ, 0, MBUF_DATA_SZ, SOCKET);

	return mp;
}

static void
prepare_pkt(struct rte_sched_port *port, struct rte_mbuf *mbuf)<commit_msg>test/sched: modify for config flexibility<commit_after>/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright(c) 2010-2014 Intel Corporation
 */

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

#include "test.h"

#include <rte_cycles.h>
#include <rte_ether.h>
#include <rte_ip.h>
#include <rte_byteorder.h>
#include <rte_sched.h>


#define SUBPORT         0
#define PIPE            1
#define TC              2
#define QUEUE           0

static struct rte_sched_subport_params subport_param[] = {
	{
		.tb_rate = 1250000000,
		.tb_size = 1000000,

		.tc_rate = {1250000000, 1250000000, 1250000000, 1250000000,
			1250000000, 1250000000, 1250000000, 1250000000, 1250000000,
			1250000000, 1250000000, 1250000000, 1250000000},
		.tc_period = 10,
	},
};

static struct rte_sched_pipe_params pipe_profile[] = {
	{ /* Profile #0 */
		.tb_rate = 305175,
		.tb_size = 1000000,

		.tc_rate = {305175, 305175, 305175, 305175, 305175, 305175,
			305175, 305175, 305175, 305175, 305175, 305175, 305175},
		.tc_period = 40,
		.tc_ov_weight = 1,

		.wrr_weights = {1, 1, 1, 1},
	},
};

static struct rte_sched_port_params port_param = {
	.socket = 0, /* computed */
	.rate = 0, /* computed */
	.mtu = 1522,
	.frame_overhead = RTE_SCHED_FRAME_OVERHEAD_DEFAULT,
	.n_subports_per_port = 1,
	.n_pipes_per_subport = 1024,
	.qsize = {32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32},
	.pipe_profiles = pipe_profile,
	.n_pipe_profiles = 1,
	.n_max_pipe_profiles = 1,
};

#define NB_MBUF          32
#define MBUF_DATA_SZ     (2048 + RTE_PKTMBUF_HEADROOM)
#define MEMPOOL_CACHE_SZ 0
#define SOCKET           0


static struct rte_mempool *
create_mempool(void)
{
	struct rte_mempool * mp;

	mp = rte_mempool_lookup("test_sched");
	if (!mp)
		mp = rte_pktmbuf_pool_create("test_sched", NB_MBUF,
			MEMPOOL_CACHE_SZ, 0, MBUF_DATA_SZ, SOCKET);

	return mp;
}

static void
prepare_pkt(struct rte_sched_port *port, struct rte_mbuf *mbuf)
{'fraction_non_alphanumeric': 0.12717241379310346, 'fraction_numerical': 0.12524137931034482, 'mean_word_length': 3.727509778357236, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 19, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4514017', 'n_tokens_mistral': 1903, 'n_tokens_neox': 1459, 'n_words': 326}