lc = find_initilized_lcore(cfg, prt->lcore[j]);
if (lc == NULL) {
- NETBE_REALLOC(cfg->cpu, cfg->cpu_num + 1);
lc = &cfg->cpu[cfg->cpu_num];
lc->id = prt->lcore[j];
cfg->cpu_num++;
int32_t rc;
uint32_t i, n, sid, j;
struct netbe_port *prt;
+ rte_cpuset_t cpuset;
+ uint32_t nc;
n = (uint32_t)argc;
+ cfg->prt = rte_zmalloc(NULL, sizeof(struct netbe_port) * n,
+ RTE_CACHE_LINE_SIZE);
+ cfg->prt_num = n;
rc = 0;
for (i = 0; i != n; i++) {
- NETBE_REALLOC(cfg->prt, cfg->prt_num + 1);
- rc = parse_netbe_arg(cfg->prt + i, argv[i]);
+ rc = parse_netbe_arg(cfg->prt + i, argv[i], &cpuset);
if (rc != 0) {
RTE_LOG(ERR, USER1,
"%s: processing of \"%s\" failed with error code: %d\n",
__func__, argv[i], rc);
return rc;
}
- cfg->prt_num++;
}
+ for (i = 0, nc = 0; i < RTE_MAX_LCORE; i++)
+ nc += CPU_ISSET(i, &cpuset);
+ cfg->cpu = rte_zmalloc(NULL, sizeof(struct netbe_lcore) * nc,
+ RTE_CACHE_LINE_SIZE);
+
/* calculate number of queues per lcore. */
rc = calculate_nb_prtq(cfg);
if (rc != 0) {
* limitations under the License.
*/
-#include <sched.h>
#include "netbe.h"
#include "parse.h"
}
int
-parse_netbe_arg(struct netbe_port *prt, const char *arg)
+parse_netbe_arg(struct netbe_port *prt, const char *arg, rte_cpuset_t *cpuset)
{
int32_t rc;
uint32_t i, j, nc;
for (i = 0, j = 0; i < RTE_MAX_LCORE; i++)
if (CPU_ISSET(i, &val[1].cpuset))
prt->lcore[j++] = i;
+ CPU_OR(cpuset, cpuset, &val[1].cpuset);
prt->mtu = val[2].u64;
prt->rx_offload = val[3].u64;
#ifndef __PARSE_H__
#define __PARSE_H__
+#include <sched.h>
+
#define PARSE_LIST_DELIM "-"
union parse_val {
return inet_ntop(sp->ss_family, addr, buf, len);
}
-int parse_netbe_arg(struct netbe_port *prt, const char *arg);
+int parse_netbe_arg(struct netbe_port *prt, const char *arg,
+ rte_cpuset_t *cpuset);
int netbe_parse_dest(const char *fname, struct netbe_dest_prm *prm);