};
#define DPDK_HELPER_TRACE(_name) \
- DEBUG("%s:%s:%d pid=%ld", _name, __FUNCTION__, __LINE__, (long)getpid())
+ DEBUG("%s:%s:%d pid=%ld", _name, __func__, __LINE__, (long)getpid())
struct dpdk_helper_ctx_s {
size_t shm_size = sizeof(dpdk_helper_ctx_t) + data_size;
if (pphc == NULL) {
- ERROR("%s:Invalid argument(pphc)", __FUNCTION__);
+ ERROR("%s:Invalid argument(pphc)", __func__);
return -EINVAL;
}
if (name == NULL) {
- ERROR("%s:Invalid argument(name)", __FUNCTION__);
+ ERROR("%s:Invalid argument(name)", __func__);
return -EINVAL;
}
static int dpdk_helper_exit(dpdk_helper_ctx_t *phc,
enum DPDK_HELPER_STATUS status) {
- DPDK_CHILD_LOG("%s:%s:%d %s\n", phc->shm_name, __FUNCTION__, __LINE__,
+ DPDK_CHILD_LOG("%s:%s:%d %s\n", phc->shm_name, __func__, __LINE__,
dpdk_helper_status_str(status));
close(phc->pipes[1]);
if (phc->status == DPDK_HELPER_ALIVE_SENDING_EVENTS) {
phc->status = status;
- DEBUG("%s:%s:%d %s", phc->shm_name, __FUNCTION__, __LINE__,
+ DEBUG("%s:%s:%d %s", phc->shm_name, __func__, __LINE__,
dpdk_helper_status_str(status));
int ret = dpdk_helper_command(phc, DPDK_CMD_QUIT, NULL, 0);
if (ret != 0) {
- DEBUG("%s:%s:%d kill helper (pid=%lu)", phc->shm_name, __FUNCTION__,
- __LINE__, (long)phc->pid);
+ DEBUG("%s:%s:%d kill helper (pid=%lu)", phc->shm_name, __func__, __LINE__,
+ (long)phc->pid);
int err = kill(phc->pid, SIGKILL);
if (err) {
- ERROR("%s error sending kill to helper: %s", __FUNCTION__, STRERRNO);
+ ERROR("%s error sending kill to helper: %s", __func__, STRERRNO);
}
}
} else {
- DEBUG("%s:%s:%d kill helper (pid=%lu)", phc->shm_name, __FUNCTION__,
- __LINE__, (long)phc->pid);
+ DEBUG("%s:%s:%d kill helper (pid=%lu)", phc->shm_name, __func__, __LINE__,
+ (long)phc->pid);
int err = kill(phc->pid, SIGKILL);
if (err) {
- ERROR("%s error sending kill to helper: %s", __FUNCTION__, STRERRNO);
+ ERROR("%s error sending kill to helper: %s", __func__, STRERRNO);
}
}
static int dpdk_helper_eal_init(dpdk_helper_ctx_t *phc) {
phc->status = DPDK_HELPER_INITIALIZING_EAL;
DPDK_CHILD_LOG("%s:%s:%d DPDK_HELPER_INITIALIZING_EAL (start)\n",
- phc->shm_name, __FUNCTION__, __LINE__);
+ phc->shm_name, __func__, __LINE__);
char *argp[DPDK_EAL_ARGC * 2 + 1];
int argc = 0;
phc->eal_initialized = 1;
DPDK_CHILD_LOG("%s:%s:%d DPDK_HELPER_INITIALIZING_EAL (done)\n",
- phc->shm_name, __FUNCTION__, __LINE__);
+ phc->shm_name, __func__, __LINE__);
return 0;
}
int ret = sem_timedwait(&phc->sema_cmd_start, &ts);
DPDK_CHILD_LOG("%s:%s:%d pid=%lu got sema_cmd_start (ret=%d, errno=%d)\n",
- phc->shm_name, __FUNCTION__, __LINE__, (long)getpid(), ret,
- errno);
+ phc->shm_name, __func__, __LINE__, (long)getpid(), ret, errno);
if (phc->cmd == DPDK_CMD_QUIT) {
- DPDK_CHILD_LOG("%s:%s:%d pid=%lu exiting\n", phc->shm_name, __FUNCTION__,
+ DPDK_CHILD_LOG("%s:%s:%d pid=%lu exiting\n", phc->shm_name, __func__,
__LINE__, (long)getpid());
exit(0);
} else if (ret == -1 && errno == ETIMEDOUT) {
int val = 0;
if (sem_getvalue(&phc->sema_cmd_start, &val) == 0)
DPDK_CHILD_LOG("%s:%s:%d pid=%lu wait sema_cmd_start (value=%d)\n",
- phc->shm_name, __FUNCTION__, __LINE__, (long)getpid(), val);
+ phc->shm_name, __func__, __LINE__, (long)getpid(), val);
#endif
/* Parent PID change means collectd died so quit the helper process. */
phc->status = DPDK_HELPER_WAITING_ON_PRIMARY;
DPDK_CHILD_LOG("%s:%s:%d DPDK_HELPER_WAITING_ON_PRIMARY\n", phc->shm_name,
- __FUNCTION__, __LINE__);
+ __func__, __LINE__);
return -1;
}
}
phc->status = DPDK_HELPER_ALIVE_SENDING_EVENTS;
DPDK_CHILD_LOG("%s:%s:%d DPDK_HELPER_ALIVE_SENDING_EVENTS\n", phc->shm_name,
- __FUNCTION__, __LINE__);
+ __func__, __LINE__);
return -1;
}
while (1) {
if (dpdk_helper_cmd_wait(phc, ppid) == 0) {
DPDK_CHILD_LOG("%s:%s:%d DPDK command handle (cmd=%d, pid=%lu)\n",
- phc->shm_name, __FUNCTION__, __LINE__, phc->cmd,
+ phc->shm_name, __func__, __LINE__, phc->cmd,
(long)getpid());
phc->cmd_result = dpdk_helper_command_handler(phc, phc->cmd);
} else {
/* now kick collectd to get results */
int err = sem_post(&phc->sema_cmd_complete);
DPDK_CHILD_LOG("%s:%s:%d post sema_cmd_complete (pid=%lu)\n", phc->shm_name,
- __FUNCTION__, __LINE__, (long)getpid());
+ __func__, __LINE__, (long)getpid());
if (err) {
DPDK_CHILD_LOG("dpdk_helper_worker: error posting sema_cmd_complete "
"semaphore (%s)\n",
int val = 0;
if (sem_getvalue(&phc->sema_cmd_complete, &val) == 0)
DPDK_CHILD_LOG("%s:%s:%d pid=%lu sema_cmd_complete (value=%d)\n",
- phc->shm_name, __FUNCTION__, __LINE__, (long)getpid(),
- val);
+ phc->shm_name, __func__, __LINE__, (long)getpid(), val);
#endif
} /* while(1) */
}
static int dpdk_helper_status_check(dpdk_helper_ctx_t *phc) {
- DEBUG("%s:%s:%d pid=%u %s", phc->shm_name, __FUNCTION__, __LINE__, getpid(),
+ DEBUG("%s:%s:%d pid=%u %s", phc->shm_name, __func__, __LINE__, getpid(),
dpdk_helper_status_str(phc->status));
if (phc->status == DPDK_HELPER_GRACEFUL_QUIT) {
return 0;
} else if (phc->status == DPDK_HELPER_NOT_INITIALIZED) {
phc->status = DPDK_HELPER_INITIALIZING;
- DEBUG("%s:%s:%d DPDK_HELPER_INITIALIZING", phc->shm_name, __FUNCTION__,
+ DEBUG("%s:%s:%d DPDK_HELPER_INITIALIZING", phc->shm_name, __func__,
__LINE__);
int err = dpdk_helper_spawn(phc);
if (err) {
pid_t ws = waitpid(phc->pid, NULL, WNOHANG);
if (ws != 0) {
phc->status = DPDK_HELPER_INITIALIZING;
- DEBUG("%s:%s:%d DPDK_HELPER_INITIALIZING", phc->shm_name, __FUNCTION__,
+ DEBUG("%s:%s:%d DPDK_HELPER_INITIALIZING", phc->shm_name, __func__,
__LINE__);
int err = dpdk_helper_spawn(phc);
if (err) {
return -EINVAL;
}
- DEBUG("%s:%s:%d pid=%lu, cmd=%d", phc->shm_name, __FUNCTION__, __LINE__,
+ DEBUG("%s:%s:%d pid=%lu, cmd=%d", phc->shm_name, __func__, __LINE__,
(long)getpid(), cmd);
phc->cmd_wait_time = cmd_wait_time;
val = strtoull(str, &endptr, 16);
if (*endptr) {
- ERROR("%s Failed to parse the value %s, endptr=%c", __FUNCTION__, str,
- *endptr);
+ ERROR("%s Failed to parse the value %s, endptr=%c", __func__, str, *endptr);
res = -EINVAL;
}
if (err != NULL)
memset(&lcore_mask, 0, sizeof(lcore_mask));
if (len <= 2 || strncmp(str, "0x", 2) != 0) {
- ERROR("%s Value %s should be represened in hexadecimal format",
- __FUNCTION__, str);
+ ERROR("%s Value %s should be represened in hexadecimal format", __func__,
+ str);
return lcore_mask;
}
/* If str is <= 64 bit long ('0x' + 16 chars = 18 chars) then
if (ports == 0) {
ERROR(
"%s:%d: No DPDK ports available. Check bound devices to DPDK driver.\n",
- __FUNCTION__, __LINE__);
+ __func__, __LINE__);
return ports;
}
if (ports > RTE_MAX_ETHPORTS) {
ERROR("%s:%d: Number of DPDK ports (%u) is greater than "
"RTE_MAX_ETHPORTS=%d. Ignoring extra ports\n",
- __FUNCTION__, __LINE__, ports, RTE_MAX_ETHPORTS);
+ __func__, __LINE__, ports, RTE_MAX_ETHPORTS);
ports = RTE_MAX_ETHPORTS;
}