return -1;
}
socket_id = (uint8_t)int_fld[FLD_SOCKET];
- if(socket_id >= MAX_SOCKET) {
+ if(socket_id >= max_socket) {
printf("Invalid socket id, range is [0, %d]\n",
- MAX_SOCKET - 1);
+ max_socket - 1);
return -1;
}
port_numa[port_id] = socket_id;
return -1;
}
socket_id = (uint8_t)int_fld[FLD_SOCKET];
- if (socket_id >= MAX_SOCKET) {
+ if (socket_id >= max_socket) {
printf("Invalid socket id, range is [0, %d]\n",
- MAX_SOCKET - 1);
+ max_socket - 1);
return -1;
}
ring_flag = (uint8_t)int_fld[FLD_FLAG];
"invalid ring-numa configuration\n");
if (!strcmp(lgopts[opt_idx].name, "socket-num")) {
n = atoi(optarg);
- if(n < MAX_SOCKET)
+ if((uint8_t)n < max_socket)
socket_num = (uint8_t)n;
else
rte_exit(EXIT_FAILURE,
"The socket number should be < %d\n",
- MAX_SOCKET);
+ max_socket);
}
if (!strcmp(lgopts[opt_idx].name, "mbuf-size")) {
n = atoi(optarg);
uint16_t nb_tx_queue_stats_mappings = 0;
uint16_t nb_rx_queue_stats_mappings = 0;
+unsigned max_socket = 0;
+
/* Forward function declarations */
static void map_port_queue_stats_mapping_registers(uint8_t pi, struct rte_port *port);
static void check_all_ports_link_status(uint32_t port_mask);
{
unsigned int i;
unsigned int nb_lc;
+ unsigned int sock_num;
nb_lc = 0;
for (i = 0; i < RTE_MAX_LCORE; i++) {
if (i == rte_get_master_lcore())
continue;
fwd_lcores_cpuids[nb_lc++] = i;
+ sock_num = rte_lcore_to_socket_id(i) + 1;
+ if (sock_num > max_socket) {
+ if (sock_num > RTE_MAX_NUMA_NODES)
+ rte_exit(EXIT_FAILURE, "Total sockets greater than %u\n", RTE_MAX_NUMA_NODES);
+ max_socket = sock_num;
+ }
}
nb_lcores = (lcoreid_t) nb_lc;
nb_cfg_lcores = nb_lcores;
{
static int warning_once = 0;
- if (socket_id >= MAX_SOCKET) {
+ if (socket_id >= max_socket) {
if (!warning_once && numa_support)
printf("Warning: NUMA should be configured manually by"
" using --port-numa-config and"
struct rte_mempool *mbp;
unsigned int nb_mbuf_per_pool;
lcoreid_t lc_id;
- uint8_t port_per_socket[MAX_SOCKET];
+ uint8_t port_per_socket[RTE_MAX_NUMA_NODES];
- memset(port_per_socket,0,MAX_SOCKET);
+ memset(port_per_socket,0,RTE_MAX_NUMA_NODES);
/* Configuration of logical cores. */
fwd_lcores = rte_zmalloc("testpmd: fwd_lcores",
sizeof(struct fwd_lcore *) * nb_lcores,
if (param_total_num_mbufs)
nb_mbuf_per_pool = nb_mbuf_per_pool/nb_ports;
- for (i = 0; i < MAX_SOCKET; i++) {
+ for (i = 0; i < max_socket; i++) {
nb_mbuf = (nb_mbuf_per_pool * RTE_MAX_ETHPORTS);
if (nb_mbuf)
mbuf_pool_create(mbuf_data_size,
extern uint32_t bypass_timeout; /**< Store the NIC bypass watchdog timeout */
#endif
-#define MAX_SOCKET 2 /*MAX SOCKET:currently, it is 2 */
-
/*
* Store specified sockets on which memory pool to be used by ports
* is allocated.
extern lcoreid_t nb_cfg_lcores; /**< Number of configured logical cores. */
extern lcoreid_t nb_fwd_lcores; /**< Number of forwarding logical cores. */
extern unsigned int fwd_lcores_cpuids[RTE_MAX_LCORE];
+extern unsigned max_socket;
/*
* Configuration of Ethernet ports: