#include "rte_eth_softnic_internals.h"
/**
- * Master thread: data plane thread init
+ * Main thread: data plane thread init
*/
void
softnic_thread_free(struct pmd_internals *softnic)
{
uint32_t i;
- RTE_LCORE_FOREACH_SLAVE(i) {
+ RTE_LCORE_FOREACH_WORKER(i) {
struct softnic_thread *t = &softnic->thread[i];
/* MSGQs */
return -1;
}
- /* Master thread records */
+ /* Main thread records */
t->msgq_req = msgq_req;
t->msgq_rsp = msgq_rsp;
t->service_id = UINT32_MAX;
static inline int
thread_is_valid(struct pmd_internals *softnic, uint32_t thread_id)
{
- struct rte_config *cfg = rte_eal_get_configuration();
- enum rte_lcore_role_t role;
-
- if ((thread_id >= RTE_MAX_LCORE) ||
- (thread_id == cfg->master_lcore))
+ if (thread_id == rte_get_main_lcore())
return 0; /* FALSE */
- role = cfg->lcore_role[thread_id];
-
- if ((softnic->params.sc && (role == ROLE_SERVICE)) ||
- (!softnic->params.sc && (role == ROLE_RTE)))
+ if (softnic->params.sc && rte_lcore_has_role(thread_id, ROLE_SERVICE))
+ return 1; /* TRUE */
+ if (!softnic->params.sc && rte_lcore_has_role(thread_id, ROLE_RTE))
return 1; /* TRUE */
return 0; /* FALSE */
uint16_t port_id;
/* service params */
- rte_eth_dev_get_port_by_name(softnic->params.name, &port_id);
+ status = rte_eth_dev_get_port_by_name(softnic->params.name, &port_id);
+ if (status)
+ return status;
+
dev = &rte_eth_devices[port_id];
snprintf(service_params.name, sizeof(service_params.name), "%s_%u",
softnic->params.name,
}
/**
- * Master thread & data plane threads: message passing
+ * Main thread & data plane threads: message passing
*/
enum thread_req_type {
THREAD_REQ_PIPELINE_ENABLE = 0,
};
/**
- * Master thread
+ * Main thread
*/
static struct thread_msg_req *
thread_msg_alloc(void)
/* Send request and wait for response */
rsp = thread_msg_send_recv(softnic, thread_id, req);
- if (rsp == NULL)
- return -1;
/* Read response */
status = rsp->status;
/* Send request and wait for response */
rsp = thread_msg_send_recv(softnic, thread_id, req);
- if (rsp == NULL)
- return -1;
/* Read response */
status = rsp->status;
}
/**
- * Master thread & data plane threads: message passing
+ * Main thread & data plane threads: message passing
*/
enum pipeline_req_type {
/* Port IN */
};
/**
- * Master thread
+ * Main thread
*/
static struct pipeline_msg_req *
pipeline_msg_alloc(void)
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
- if (rsp == NULL)
- return -1;
/* Read response */
status = rsp->status;
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
- if (rsp == NULL)
- return -1;
/* Read response */
status = rsp->status;
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
- if (rsp == NULL)
- return -1;
/* Read response */
status = rsp->status;
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
- if (rsp == NULL)
- return -1;
/* Read response */
status = rsp->status;
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
- if (rsp == NULL)
- return -1;
/* Read response */
status = rsp->status;
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
- if (rsp == NULL)
- return -1;
/* Read response */
status = rsp->status;
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
- if (rsp == NULL)
- return -1;
/* Read response */
status = rsp->status;
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
- if (rsp == NULL)
- return -1;
/* Read response */
status = rsp->status;
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
- if (rsp == NULL)
- return -1;
/* Read response */
status = rsp->status;
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
- if (rsp == NULL)
- return -1;
/* Read response */
status = rsp->status;
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
- if (rsp == NULL)
- return -1;
/* Read response */
status = rsp->status;
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
- if (rsp == NULL) {
- free(mp);
- return -1;
- }
/* Read response */
status = rsp->status;
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
- if (rsp == NULL)
- return -1;
/* Read response */
status = rsp->status;
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
- if (rsp == NULL)
- return -1;
/* Read response */
status = rsp->status;
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
- if (rsp == NULL)
- return -1;
/* Read response */
status = rsp->status;
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
- if (rsp == NULL)
- return -1;
/* Read response */
status = rsp->status;