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

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

#include <rte_ethdev_driver.h>
#include <rte_ethdev_vdev.h>
#include <rte_malloc.h>
#include <rte_bus_vdev.h>
#include <rte_kvargs.h>
#include <rte_errno.h>
#include <rte_ring.h>
#include <rte_tm_driver.h>
#include <rte_mtr_driver.h>

#include "rte_eth_softnic.h"
#include "rte_eth_softnic_internals.h"

#define PMD_PARAM_FIRMWARE                                 "firmware"
#define PMD_PARAM_CONN_PORT                                "conn_port"
#define PMD_PARAM_CPU_ID                                   "cpu_id"
#define PMD_PARAM_TM_N_QUEUES                              "tm_n_queues"
#define PMD_PARAM_TM_QSIZE0                                "tm_qsize0"
#define PMD_PARAM_TM_QSIZE1                                "tm_qsize1"
#define PMD_PARAM_TM_QSIZE2                                "tm_qsize2"
#define PMD_PARAM_TM_QSIZE3                                "tm_qsize3"

static const char * const pmd_valid_args[] = {
	PMD_PARAM_FIRMWARE,
	PMD_PARAM_CONN_PORT,
	PMD_PARAM_CPU_ID,
	PMD_PARAM_TM_N_QUEUES,
	PMD_PARAM_TM_QSIZE0,
	PMD_PARAM_TM_QSIZE1,
	PMD_PARAM_TM_QSIZE2,
	PMD_PARAM_TM_QSIZE3,
	NULL
};

static const char welcome[] =
	"\n"
	"Welcome to Soft NIC!\n"
	"\n";

static const char prompt[] = "softnic> ";

static const struct softnic_conn_params conn_params_default = {
	.welcome = welcome,
	.prompt = prompt,
	.addr = "0.0.0.0",
	.port = 0,
	.buf_size = 1024 * 1024,
	.msg_in_len_max = 1024,
	.msg_out_len_max = 1024 * 1024,
	.msg_handle = softnic_cli_process,
	.msg_handle_arg = NULL,
};

static const struct rte_eth_dev_info pmd_dev_info = {
	.min_rx_bufsize = 0,
	.max_rx_pktlen = UINT32_MAX,
	.max_rx_queues = UINT16_MAX,
	.max_tx_queues = UINT16_MAX,
	.rx_desc_lim = {
		.nb_max = UINT16_MAX,
		.nb_min = 0,
		.nb_align = 1,
	},
	.tx_desc_lim = {
		.nb_max = UINT16_MAX,
		.nb_min = 0,
		.nb_align = 1,
	},
};

static int pmd_softnic_logtype;

#define PMD_LOG(level, fmt, args...) \
	rte_log(RTE_LOG_ ## level, pmd_softnic_logtype, \
		"%s(): " fmt "\n", __func__, ##args)

static void
pmd_dev_infos_get(struct rte_eth_dev *dev __rte_unused,
	struct rte_eth_dev_info *dev_info)
{
	memcpy(dev_info, &pmd_dev_info, sizeof(*dev_info));
}
<commit_msg>net/softnic: fix undefined device info fields<commit_after>/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright(c) 2017 Intel Corporation
 */

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

#include <rte_ethdev_driver.h>
#include <rte_ethdev_vdev.h>
#include <rte_malloc.h>
#include <rte_bus_vdev.h>
#include <rte_kvargs.h>
#include <rte_errno.h>
#include <rte_ring.h>
#include <rte_tm_driver.h>
#include <rte_mtr_driver.h>

#include "rte_eth_softnic.h"
#include "rte_eth_softnic_internals.h"

#define PMD_PARAM_FIRMWARE                                 "firmware"
#define PMD_PARAM_CONN_PORT                                "conn_port"
#define PMD_PARAM_CPU_ID                                   "cpu_id"
#define PMD_PARAM_TM_N_QUEUES                              "tm_n_queues"
#define PMD_PARAM_TM_QSIZE0                                "tm_qsize0"
#define PMD_PARAM_TM_QSIZE1                                "tm_qsize1"
#define PMD_PARAM_TM_QSIZE2                                "tm_qsize2"
#define PMD_PARAM_TM_QSIZE3                                "tm_qsize3"

static const char * const pmd_valid_args[] = {
	PMD_PARAM_FIRMWARE,
	PMD_PARAM_CONN_PORT,
	PMD_PARAM_CPU_ID,
	PMD_PARAM_TM_N_QUEUES,
	PMD_PARAM_TM_QSIZE0,
	PMD_PARAM_TM_QSIZE1,
	PMD_PARAM_TM_QSIZE2,
	PMD_PARAM_TM_QSIZE3,
	NULL
};

static const char welcome[] =
	"\n"
	"Welcome to Soft NIC!\n"
	"\n";

static const char prompt[] = "softnic> ";

static const struct softnic_conn_params conn_params_default = {
	.welcome = welcome,
	.prompt = prompt,
	.addr = "0.0.0.0",
	.port = 0,
	.buf_size = 1024 * 1024,
	.msg_in_len_max = 1024,
	.msg_out_len_max = 1024 * 1024,
	.msg_handle = softnic_cli_process,
	.msg_handle_arg = NULL,
};

static int pmd_softnic_logtype;

#define PMD_LOG(level, fmt, args...) \
	rte_log(RTE_LOG_ ## level, pmd_softnic_logtype, \
		"%s(): " fmt "\n", __func__, ##args)

static void
pmd_dev_infos_get(struct rte_eth_dev *dev __rte_unused,
	struct rte_eth_dev_info *dev_info)
{
	dev_info->max_rx_pktlen = UINT32_MAX;
	dev_info->max_rx_queues = UINT16_MAX;
	dev_info->max_tx_queues = UINT16_MAX;
}

{'fraction_non_alphanumeric': 0.10846920289855072, 'fraction_numerical': 0.02377717391304348, 'mean_word_length': 3.0337899543378994, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5308815', 'n_tokens_mistral': 1897, 'n_tokens_neox': 1817, 'n_words': 315}