* [dpdk-dev] [PATCH 19.08 1/6] ipc: handle unsupported ipc in init
2019-04-25 12:45 [dpdk-dev] [PATCH 19.08 1/6] ipc: handle unsupported ipc in init Anatoly Burakov
@ 2019-04-25 12:45 ` Anatoly Burakov
2019-04-25 12:45 ` [dpdk-dev] [PATCH 19.08 2/6] ipc: handle unsupported ipc in action register Anatoly Burakov
` (5 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Anatoly Burakov @ 2019-04-25 12:45 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, herakliusz.lipiec
Currently, IPC API will silently ignore unsupported IPC.
Fix the API call and its callers to explicitly handle
unsupported IPC cases.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/common/eal_common_proc.c | 3 ++-
lib/librte_eal/freebsd/eal/eal.c | 2 +-
lib/librte_eal/linux/eal/eal.c | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c
index b46d644b3..a4581e3b4 100644
--- a/lib/librte_eal/common/eal_common_proc.c
+++ b/lib/librte_eal/common/eal_common_proc.c
@@ -568,7 +568,8 @@ rte_mp_channel_init(void)
*/
if (internal_config.no_shconf) {
RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC will be disabled\n");
- return 0;
+ rte_errno = ENOTSUP;
+ return -1;
}
/* create filter path */
diff --git a/lib/librte_eal/freebsd/eal/eal.c b/lib/librte_eal/freebsd/eal/eal.c
index c6ac9028f..4eaa53195 100644
--- a/lib/librte_eal/freebsd/eal/eal.c
+++ b/lib/librte_eal/freebsd/eal/eal.c
@@ -671,7 +671,7 @@ rte_eal_init(int argc, char **argv)
/* Put mp channel init before bus scan so that we can init the vdev
* bus through mp channel in the secondary process before the bus scan.
*/
- if (rte_mp_channel_init() < 0) {
+ if (rte_mp_channel_init() < 0 && rte_errno != ENOTSUP) {
rte_eal_init_alert("failed to init mp channel");
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
rte_errno = EFAULT;
diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c
index 161399619..3e1d6eb6a 100644
--- a/lib/librte_eal/linux/eal/eal.c
+++ b/lib/librte_eal/linux/eal/eal.c
@@ -1014,7 +1014,7 @@ rte_eal_init(int argc, char **argv)
/* Put mp channel init before bus scan so that we can init the vdev
* bus through mp channel in the secondary process before the bus scan.
*/
- if (rte_mp_channel_init() < 0) {
+ if (rte_mp_channel_init() < 0 && rte_errno != ENOTSUP) {
rte_eal_init_alert("failed to init mp channel");
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
rte_errno = EFAULT;
--
2.17.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH 19.08 2/6] ipc: handle unsupported ipc in action register
2019-04-25 12:45 [dpdk-dev] [PATCH 19.08 1/6] ipc: handle unsupported ipc in init Anatoly Burakov
2019-04-25 12:45 ` Anatoly Burakov
@ 2019-04-25 12:45 ` Anatoly Burakov
2019-04-25 12:45 ` Anatoly Burakov
2019-04-25 12:45 ` [dpdk-dev] [PATCH 19.08 3/6] ipc: don't unregister action if ipc unsupported Anatoly Burakov
` (4 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Anatoly Burakov @ 2019-04-25 12:45 UTC (permalink / raw)
To: dev
Cc: Matan Azrad, Shahaf Shuler, Yongseok Koh, Keith Wiles,
Reshma Pattan, herakliusz.lipiec
Currently, IPC API will silently ignore unsupported IPC.
Fix the API call and its callers to explicitly handle
unsupported IPC cases.
For primary processes, it is OK to not have IPC because
there may not be any secondary processes in the first place,
and there are valid use cases that disable IPC support, so
all primary process usages are fixed up to ignore IPC
failures.
For secondary processes, IPC will be crucial, so leave all
of the error handling as is.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
drivers/bus/vdev/vdev.c | 5 +++++
drivers/net/mlx4/mlx4.c | 12 +++++++++---
drivers/net/mlx4/mlx4.h | 4 ++--
drivers/net/mlx4/mlx4_mp.c | 15 +++++++++++----
drivers/net/mlx5/mlx5.c | 12 +++++++++---
drivers/net/mlx5/mlx5.h | 4 ++--
drivers/net/mlx5/mlx5_mp.c | 15 +++++++++++----
drivers/net/tap/rte_eth_tap.c | 2 +-
lib/librte_eal/common/eal_common_proc.c | 6 ++++++
lib/librte_eal/common/hotplug_mp.c | 4 +++-
lib/librte_eal/common/include/rte_eal.h | 3 +++
lib/librte_eal/common/malloc_mp.c | 4 +++-
lib/librte_eal/linux/eal/eal_vfio_mp_sync.c | 8 ++++++--
lib/librte_pdump/rte_pdump.c | 5 ++++-
14 files changed, 75 insertions(+), 24 deletions(-)
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 04f76a63f..a89ea2353 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -409,6 +409,10 @@ vdev_scan(void)
if (rte_mp_action_register(VDEV_MP_KEY, vdev_action) < 0 &&
rte_errno != EEXIST) {
+ /* for primary, unsupported IPC is not an error */
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY &&
+ rte_errno == ENOTSUP)
+ goto scan;
VDEV_LOG(ERR, "Failed to add vdev mp action");
return -1;
}
@@ -436,6 +440,7 @@ vdev_scan(void)
/* Fall through to allow private vdevs in secondary process */
}
+scan:
/* call custom scan callbacks if any */
rte_spinlock_lock(&vdev_custom_scan_lock);
TAILQ_FOREACH(custom_scan, &vdev_custom_scans, next) {
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 17dfcd5a3..3cfa07de3 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -693,6 +693,7 @@ mlx4_init_once(void)
{
struct mlx4_shared_data *sd;
struct mlx4_local_data *ld = &mlx4_local_data;
+ int ret = 0;
if (mlx4_init_shared_data())
return -rte_errno;
@@ -707,21 +708,26 @@ mlx4_init_once(void)
rte_rwlock_init(&sd->mem_event_rwlock);
rte_mem_event_callback_register("MLX4_MEM_EVENT_CB",
mlx4_mr_mem_event_cb, NULL);
- mlx4_mp_init_primary();
+ ret = mlx4_mp_init_primary();
+ if (ret)
+ goto out;
sd->init_done = true;
break;
case RTE_PROC_SECONDARY:
if (ld->init_done)
break;
- mlx4_mp_init_secondary();
+ ret = mlx4_mp_init_secondary();
+ if (ret)
+ goto out;
++sd->secondary_cnt;
ld->init_done = true;
break;
default:
break;
}
+out:
rte_spinlock_unlock(&sd->lock);
- return 0;
+ return ret;
}
/**
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h
index 6224b3be1..d0769bbc9 100644
--- a/drivers/net/mlx4/mlx4.h
+++ b/drivers/net/mlx4/mlx4.h
@@ -239,9 +239,9 @@ void mlx4_mp_req_start_rxtx(struct rte_eth_dev *dev);
void mlx4_mp_req_stop_rxtx(struct rte_eth_dev *dev);
int mlx4_mp_req_mr_create(struct rte_eth_dev *dev, uintptr_t addr);
int mlx4_mp_req_verbs_cmd_fd(struct rte_eth_dev *dev);
-void mlx4_mp_init_primary(void);
+int mlx4_mp_init_primary(void);
void mlx4_mp_uninit_primary(void);
-void mlx4_mp_init_secondary(void);
+int mlx4_mp_init_secondary(void);
void mlx4_mp_uninit_secondary(void);
#endif /* RTE_PMD_MLX4_H_ */
diff --git a/drivers/net/mlx4/mlx4_mp.c b/drivers/net/mlx4/mlx4_mp.c
index 183622453..ebc57a99e 100644
--- a/drivers/net/mlx4/mlx4_mp.c
+++ b/drivers/net/mlx4/mlx4_mp.c
@@ -316,11 +316,18 @@ mlx4_mp_req_verbs_cmd_fd(struct rte_eth_dev *dev)
/**
* Initialize by primary process.
*/
-void
+int
mlx4_mp_init_primary(void)
{
+ int ret;
+
assert(rte_eal_process_type() == RTE_PROC_PRIMARY);
- rte_mp_action_register(MLX4_MP_NAME, mp_primary_handle);
+
+ /* primary is allowed to not support IPC */
+ ret = rte_mp_action_register(MLX4_MP_NAME, mp_primary_handle);
+ if (ret && rte_errno != ENOTSUP)
+ return -1;
+ return 0;
}
/**
@@ -336,11 +343,11 @@ mlx4_mp_uninit_primary(void)
/**
* Initialize by secondary process.
*/
-void
+int
mlx4_mp_init_secondary(void)
{
assert(rte_eal_process_type() == RTE_PROC_SECONDARY);
- rte_mp_action_register(MLX4_MP_NAME, mp_secondary_handle);
+ return rte_mp_action_register(MLX4_MP_NAME, mp_secondary_handle);
}
/**
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 46ca08a4d..271d79d8f 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -990,6 +990,7 @@ mlx5_init_once(void)
{
struct mlx5_shared_data *sd;
struct mlx5_local_data *ld = &mlx5_local_data;
+ int ret = 0;
if (mlx5_init_shared_data())
return -rte_errno;
@@ -1004,21 +1005,26 @@ mlx5_init_once(void)
rte_rwlock_init(&sd->mem_event_rwlock);
rte_mem_event_callback_register("MLX5_MEM_EVENT_CB",
mlx5_mr_mem_event_cb, NULL);
- mlx5_mp_init_primary();
+ ret = mlx5_mp_init_primary();
+ if (ret)
+ goto out;
sd->init_done = true;
break;
case RTE_PROC_SECONDARY:
if (ld->init_done)
break;
- mlx5_mp_init_secondary();
+ ret = mlx5_mp_init_secondary();
+ if (ret)
+ goto out;
++sd->secondary_cnt;
ld->init_done = true;
break;
default:
break;
}
+out:
rte_spinlock_unlock(&sd->lock);
- return 0;
+ return ret;
}
/**
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 0a6d7f1d5..0b3418b4a 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -540,9 +540,9 @@ void mlx5_mp_req_start_rxtx(struct rte_eth_dev *dev);
void mlx5_mp_req_stop_rxtx(struct rte_eth_dev *dev);
int mlx5_mp_req_mr_create(struct rte_eth_dev *dev, uintptr_t addr);
int mlx5_mp_req_verbs_cmd_fd(struct rte_eth_dev *dev);
-void mlx5_mp_init_primary(void);
+int mlx5_mp_init_primary(void);
void mlx5_mp_uninit_primary(void);
-void mlx5_mp_init_secondary(void);
+int mlx5_mp_init_secondary(void);
void mlx5_mp_uninit_secondary(void);
/* mlx5_nl.c */
diff --git a/drivers/net/mlx5/mlx5_mp.c b/drivers/net/mlx5/mlx5_mp.c
index cea74adb6..dc99231fe 100644
--- a/drivers/net/mlx5/mlx5_mp.c
+++ b/drivers/net/mlx5/mlx5_mp.c
@@ -320,11 +320,18 @@ mlx5_mp_req_verbs_cmd_fd(struct rte_eth_dev *dev)
/**
* Initialize by primary process.
*/
-void
+int
mlx5_mp_init_primary(void)
{
+ int ret;
+
assert(rte_eal_process_type() == RTE_PROC_PRIMARY);
- rte_mp_action_register(MLX5_MP_NAME, mp_primary_handle);
+
+ /* primary is allowed to not support IPC */
+ ret = rte_mp_action_register(MLX5_MP_NAME, mp_primary_handle);
+ if (ret && rte_errno != ENOTSUP)
+ return -1;
+ return 0;
}
/**
@@ -340,11 +347,11 @@ mlx5_mp_uninit_primary(void)
/**
* Initialize by secondary process.
*/
-void
+int
mlx5_mp_init_secondary(void)
{
assert(rte_eal_process_type() == RTE_PROC_SECONDARY);
- rte_mp_action_register(MLX5_MP_NAME, mp_secondary_handle);
+ return rte_mp_action_register(MLX5_MP_NAME, mp_secondary_handle);
}
/**
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 7f74b5dc9..3e82f5138 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -2273,7 +2273,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
/* Register IPC feed callback */
if (!tap_devices_count) {
ret = rte_mp_action_register(TAP_MP_KEY, tap_mp_sync_queues);
- if (ret < 0) {
+ if (ret < 0 && rte_errno != ENOTSUP) {
TAP_LOG(ERR, "tap: Failed to register IPC callback: %s",
strerror(rte_errno));
goto leave;
diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c
index a4581e3b4..a40aa2c1b 100644
--- a/lib/librte_eal/common/eal_common_proc.c
+++ b/lib/librte_eal/common/eal_common_proc.c
@@ -205,6 +205,12 @@ rte_mp_action_register(const char *name, rte_mp_t action)
if (validate_action_name(name))
return -1;
+ if (internal_config.no_shconf) {
+ RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC is disabled\n");
+ rte_errno = ENOTSUP;
+ return -1;
+ }
+
entry = malloc(sizeof(struct action_entry));
if (entry == NULL) {
rte_errno = ENOMEM;
diff --git a/lib/librte_eal/common/hotplug_mp.c b/lib/librte_eal/common/hotplug_mp.c
index 4052a5c7f..60cd1402d 100644
--- a/lib/librte_eal/common/hotplug_mp.c
+++ b/lib/librte_eal/common/hotplug_mp.c
@@ -4,6 +4,7 @@
#include <string.h>
#include <rte_eal.h>
+#include <rte_errno.h>
#include <rte_alarm.h>
#include <rte_string_fns.h>
#include <rte_devargs.h>
@@ -440,7 +441,8 @@ int rte_mp_dev_hotplug_init(void)
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
ret = rte_mp_action_register(EAL_DEV_MP_ACTION_REQUEST,
handle_secondary_request);
- if (ret != 0) {
+ /* primary is allowed to not support IPC */
+ if (ret != 0 && rte_errno != ENOTSUP) {
RTE_LOG(ERR, EAL, "Couldn't register '%s' action\n",
EAL_DEV_MP_ACTION_REQUEST);
return ret;
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index f9288666e..7f807aa8e 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -248,6 +248,9 @@ typedef int (*rte_mp_async_reply_t)(const struct rte_mp_msg *request,
* to response the messages from the corresponding component in its primary
* process or secondary processes.
*
+ * @note IPC may be unsupported in certain circumstances, so caller should check
+ * for ENOTSUP error.
+ *
* @param name
* The name argument plays as the nonredundant key to find the action.
*
diff --git a/lib/librte_eal/common/malloc_mp.c b/lib/librte_eal/common/malloc_mp.c
index b470565e0..1374eabc2 100644
--- a/lib/librte_eal/common/malloc_mp.c
+++ b/lib/librte_eal/common/malloc_mp.c
@@ -722,7 +722,9 @@ int
register_mp_requests(void)
{
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
- if (rte_mp_action_register(MP_ACTION_REQUEST, handle_request)) {
+ /* it's OK for primary to not support IPC */
+ if (rte_mp_action_register(MP_ACTION_REQUEST, handle_request) &&
+ rte_errno != ENOTSUP) {
RTE_LOG(ERR, EAL, "Couldn't register '%s' action\n",
MP_ACTION_REQUEST);
return -1;
diff --git a/lib/librte_eal/linux/eal/eal_vfio_mp_sync.c b/lib/librte_eal/linux/eal/eal_vfio_mp_sync.c
index 2a47f29d5..5f2a5fc1d 100644
--- a/lib/librte_eal/linux/eal/eal_vfio_mp_sync.c
+++ b/lib/librte_eal/linux/eal/eal_vfio_mp_sync.c
@@ -6,6 +6,7 @@
#include <string.h>
#include <rte_compat.h>
+#include <rte_errno.h>
#include <rte_log.h>
#include <rte_vfio.h>
#include <rte_eal.h>
@@ -110,8 +111,11 @@ vfio_mp_primary(const struct rte_mp_msg *msg, const void *peer)
int
vfio_mp_sync_setup(void)
{
- if (rte_eal_process_type() == RTE_PROC_PRIMARY)
- return rte_mp_action_register(EAL_VFIO_MP, vfio_mp_primary);
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+ int ret = rte_mp_action_register(EAL_VFIO_MP, vfio_mp_primary);
+ if (ret && rte_errno != ENOTSUP)
+ return -1;
+ }
return 0;
}
diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c
index 14744b9ff..cd24dd010 100644
--- a/lib/librte_pdump/rte_pdump.c
+++ b/lib/librte_pdump/rte_pdump.c
@@ -408,7 +408,10 @@ pdump_server(const struct rte_mp_msg *mp_msg, const void *peer)
int
rte_pdump_init(void)
{
- return rte_mp_action_register(PDUMP_MP, pdump_server);
+ int ret = rte_mp_action_register(PDUMP_MP, pdump_server);
+ if (ret && rte_errno != ENOTSUP)
+ return -1;
+ return 0;
}
int
--
2.17.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH 19.08 2/6] ipc: handle unsupported ipc in action register
2019-04-25 12:45 ` [dpdk-dev] [PATCH 19.08 2/6] ipc: handle unsupported ipc in action register Anatoly Burakov
@ 2019-04-25 12:45 ` Anatoly Burakov
0 siblings, 0 replies; 13+ messages in thread
From: Anatoly Burakov @ 2019-04-25 12:45 UTC (permalink / raw)
To: dev
Cc: Matan Azrad, Shahaf Shuler, Yongseok Koh, Keith Wiles,
Reshma Pattan, herakliusz.lipiec
Currently, IPC API will silently ignore unsupported IPC.
Fix the API call and its callers to explicitly handle
unsupported IPC cases.
For primary processes, it is OK to not have IPC because
there may not be any secondary processes in the first place,
and there are valid use cases that disable IPC support, so
all primary process usages are fixed up to ignore IPC
failures.
For secondary processes, IPC will be crucial, so leave all
of the error handling as is.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
| 5 +++++
| 12 +++++++++---
| 4 ++--
| 15 +++++++++++----
| 12 +++++++++---
| 4 ++--
| 15 +++++++++++----
| 2 +-
| 6 ++++++
| 4 +++-
| 3 +++
| 4 +++-
| 8 ++++++--
| 5 ++++-
14 files changed, 75 insertions(+), 24 deletions(-)
--git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 04f76a63f..a89ea2353 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -409,6 +409,10 @@ vdev_scan(void)
if (rte_mp_action_register(VDEV_MP_KEY, vdev_action) < 0 &&
rte_errno != EEXIST) {
+ /* for primary, unsupported IPC is not an error */
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY &&
+ rte_errno == ENOTSUP)
+ goto scan;
VDEV_LOG(ERR, "Failed to add vdev mp action");
return -1;
}
@@ -436,6 +440,7 @@ vdev_scan(void)
/* Fall through to allow private vdevs in secondary process */
}
+scan:
/* call custom scan callbacks if any */
rte_spinlock_lock(&vdev_custom_scan_lock);
TAILQ_FOREACH(custom_scan, &vdev_custom_scans, next) {
--git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 17dfcd5a3..3cfa07de3 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -693,6 +693,7 @@ mlx4_init_once(void)
{
struct mlx4_shared_data *sd;
struct mlx4_local_data *ld = &mlx4_local_data;
+ int ret = 0;
if (mlx4_init_shared_data())
return -rte_errno;
@@ -707,21 +708,26 @@ mlx4_init_once(void)
rte_rwlock_init(&sd->mem_event_rwlock);
rte_mem_event_callback_register("MLX4_MEM_EVENT_CB",
mlx4_mr_mem_event_cb, NULL);
- mlx4_mp_init_primary();
+ ret = mlx4_mp_init_primary();
+ if (ret)
+ goto out;
sd->init_done = true;
break;
case RTE_PROC_SECONDARY:
if (ld->init_done)
break;
- mlx4_mp_init_secondary();
+ ret = mlx4_mp_init_secondary();
+ if (ret)
+ goto out;
++sd->secondary_cnt;
ld->init_done = true;
break;
default:
break;
}
+out:
rte_spinlock_unlock(&sd->lock);
- return 0;
+ return ret;
}
/**
--git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h
index 6224b3be1..d0769bbc9 100644
--- a/drivers/net/mlx4/mlx4.h
+++ b/drivers/net/mlx4/mlx4.h
@@ -239,9 +239,9 @@ void mlx4_mp_req_start_rxtx(struct rte_eth_dev *dev);
void mlx4_mp_req_stop_rxtx(struct rte_eth_dev *dev);
int mlx4_mp_req_mr_create(struct rte_eth_dev *dev, uintptr_t addr);
int mlx4_mp_req_verbs_cmd_fd(struct rte_eth_dev *dev);
-void mlx4_mp_init_primary(void);
+int mlx4_mp_init_primary(void);
void mlx4_mp_uninit_primary(void);
-void mlx4_mp_init_secondary(void);
+int mlx4_mp_init_secondary(void);
void mlx4_mp_uninit_secondary(void);
#endif /* RTE_PMD_MLX4_H_ */
--git a/drivers/net/mlx4/mlx4_mp.c b/drivers/net/mlx4/mlx4_mp.c
index 183622453..ebc57a99e 100644
--- a/drivers/net/mlx4/mlx4_mp.c
+++ b/drivers/net/mlx4/mlx4_mp.c
@@ -316,11 +316,18 @@ mlx4_mp_req_verbs_cmd_fd(struct rte_eth_dev *dev)
/**
* Initialize by primary process.
*/
-void
+int
mlx4_mp_init_primary(void)
{
+ int ret;
+
assert(rte_eal_process_type() == RTE_PROC_PRIMARY);
- rte_mp_action_register(MLX4_MP_NAME, mp_primary_handle);
+
+ /* primary is allowed to not support IPC */
+ ret = rte_mp_action_register(MLX4_MP_NAME, mp_primary_handle);
+ if (ret && rte_errno != ENOTSUP)
+ return -1;
+ return 0;
}
/**
@@ -336,11 +343,11 @@ mlx4_mp_uninit_primary(void)
/**
* Initialize by secondary process.
*/
-void
+int
mlx4_mp_init_secondary(void)
{
assert(rte_eal_process_type() == RTE_PROC_SECONDARY);
- rte_mp_action_register(MLX4_MP_NAME, mp_secondary_handle);
+ return rte_mp_action_register(MLX4_MP_NAME, mp_secondary_handle);
}
/**
--git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 46ca08a4d..271d79d8f 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -990,6 +990,7 @@ mlx5_init_once(void)
{
struct mlx5_shared_data *sd;
struct mlx5_local_data *ld = &mlx5_local_data;
+ int ret = 0;
if (mlx5_init_shared_data())
return -rte_errno;
@@ -1004,21 +1005,26 @@ mlx5_init_once(void)
rte_rwlock_init(&sd->mem_event_rwlock);
rte_mem_event_callback_register("MLX5_MEM_EVENT_CB",
mlx5_mr_mem_event_cb, NULL);
- mlx5_mp_init_primary();
+ ret = mlx5_mp_init_primary();
+ if (ret)
+ goto out;
sd->init_done = true;
break;
case RTE_PROC_SECONDARY:
if (ld->init_done)
break;
- mlx5_mp_init_secondary();
+ ret = mlx5_mp_init_secondary();
+ if (ret)
+ goto out;
++sd->secondary_cnt;
ld->init_done = true;
break;
default:
break;
}
+out:
rte_spinlock_unlock(&sd->lock);
- return 0;
+ return ret;
}
/**
--git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 0a6d7f1d5..0b3418b4a 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -540,9 +540,9 @@ void mlx5_mp_req_start_rxtx(struct rte_eth_dev *dev);
void mlx5_mp_req_stop_rxtx(struct rte_eth_dev *dev);
int mlx5_mp_req_mr_create(struct rte_eth_dev *dev, uintptr_t addr);
int mlx5_mp_req_verbs_cmd_fd(struct rte_eth_dev *dev);
-void mlx5_mp_init_primary(void);
+int mlx5_mp_init_primary(void);
void mlx5_mp_uninit_primary(void);
-void mlx5_mp_init_secondary(void);
+int mlx5_mp_init_secondary(void);
void mlx5_mp_uninit_secondary(void);
/* mlx5_nl.c */
--git a/drivers/net/mlx5/mlx5_mp.c b/drivers/net/mlx5/mlx5_mp.c
index cea74adb6..dc99231fe 100644
--- a/drivers/net/mlx5/mlx5_mp.c
+++ b/drivers/net/mlx5/mlx5_mp.c
@@ -320,11 +320,18 @@ mlx5_mp_req_verbs_cmd_fd(struct rte_eth_dev *dev)
/**
* Initialize by primary process.
*/
-void
+int
mlx5_mp_init_primary(void)
{
+ int ret;
+
assert(rte_eal_process_type() == RTE_PROC_PRIMARY);
- rte_mp_action_register(MLX5_MP_NAME, mp_primary_handle);
+
+ /* primary is allowed to not support IPC */
+ ret = rte_mp_action_register(MLX5_MP_NAME, mp_primary_handle);
+ if (ret && rte_errno != ENOTSUP)
+ return -1;
+ return 0;
}
/**
@@ -340,11 +347,11 @@ mlx5_mp_uninit_primary(void)
/**
* Initialize by secondary process.
*/
-void
+int
mlx5_mp_init_secondary(void)
{
assert(rte_eal_process_type() == RTE_PROC_SECONDARY);
- rte_mp_action_register(MLX5_MP_NAME, mp_secondary_handle);
+ return rte_mp_action_register(MLX5_MP_NAME, mp_secondary_handle);
}
/**
--git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 7f74b5dc9..3e82f5138 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -2273,7 +2273,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
/* Register IPC feed callback */
if (!tap_devices_count) {
ret = rte_mp_action_register(TAP_MP_KEY, tap_mp_sync_queues);
- if (ret < 0) {
+ if (ret < 0 && rte_errno != ENOTSUP) {
TAP_LOG(ERR, "tap: Failed to register IPC callback: %s",
strerror(rte_errno));
goto leave;
--git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c
index a4581e3b4..a40aa2c1b 100644
--- a/lib/librte_eal/common/eal_common_proc.c
+++ b/lib/librte_eal/common/eal_common_proc.c
@@ -205,6 +205,12 @@ rte_mp_action_register(const char *name, rte_mp_t action)
if (validate_action_name(name))
return -1;
+ if (internal_config.no_shconf) {
+ RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC is disabled\n");
+ rte_errno = ENOTSUP;
+ return -1;
+ }
+
entry = malloc(sizeof(struct action_entry));
if (entry == NULL) {
rte_errno = ENOMEM;
--git a/lib/librte_eal/common/hotplug_mp.c b/lib/librte_eal/common/hotplug_mp.c
index 4052a5c7f..60cd1402d 100644
--- a/lib/librte_eal/common/hotplug_mp.c
+++ b/lib/librte_eal/common/hotplug_mp.c
@@ -4,6 +4,7 @@
#include <string.h>
#include <rte_eal.h>
+#include <rte_errno.h>
#include <rte_alarm.h>
#include <rte_string_fns.h>
#include <rte_devargs.h>
@@ -440,7 +441,8 @@ int rte_mp_dev_hotplug_init(void)
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
ret = rte_mp_action_register(EAL_DEV_MP_ACTION_REQUEST,
handle_secondary_request);
- if (ret != 0) {
+ /* primary is allowed to not support IPC */
+ if (ret != 0 && rte_errno != ENOTSUP) {
RTE_LOG(ERR, EAL, "Couldn't register '%s' action\n",
EAL_DEV_MP_ACTION_REQUEST);
return ret;
--git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index f9288666e..7f807aa8e 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -248,6 +248,9 @@ typedef int (*rte_mp_async_reply_t)(const struct rte_mp_msg *request,
* to response the messages from the corresponding component in its primary
* process or secondary processes.
*
+ * @note IPC may be unsupported in certain circumstances, so caller should check
+ * for ENOTSUP error.
+ *
* @param name
* The name argument plays as the nonredundant key to find the action.
*
--git a/lib/librte_eal/common/malloc_mp.c b/lib/librte_eal/common/malloc_mp.c
index b470565e0..1374eabc2 100644
--- a/lib/librte_eal/common/malloc_mp.c
+++ b/lib/librte_eal/common/malloc_mp.c
@@ -722,7 +722,9 @@ int
register_mp_requests(void)
{
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
- if (rte_mp_action_register(MP_ACTION_REQUEST, handle_request)) {
+ /* it's OK for primary to not support IPC */
+ if (rte_mp_action_register(MP_ACTION_REQUEST, handle_request) &&
+ rte_errno != ENOTSUP) {
RTE_LOG(ERR, EAL, "Couldn't register '%s' action\n",
MP_ACTION_REQUEST);
return -1;
--git a/lib/librte_eal/linux/eal/eal_vfio_mp_sync.c b/lib/librte_eal/linux/eal/eal_vfio_mp_sync.c
index 2a47f29d5..5f2a5fc1d 100644
--- a/lib/librte_eal/linux/eal/eal_vfio_mp_sync.c
+++ b/lib/librte_eal/linux/eal/eal_vfio_mp_sync.c
@@ -6,6 +6,7 @@
#include <string.h>
#include <rte_compat.h>
+#include <rte_errno.h>
#include <rte_log.h>
#include <rte_vfio.h>
#include <rte_eal.h>
@@ -110,8 +111,11 @@ vfio_mp_primary(const struct rte_mp_msg *msg, const void *peer)
int
vfio_mp_sync_setup(void)
{
- if (rte_eal_process_type() == RTE_PROC_PRIMARY)
- return rte_mp_action_register(EAL_VFIO_MP, vfio_mp_primary);
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+ int ret = rte_mp_action_register(EAL_VFIO_MP, vfio_mp_primary);
+ if (ret && rte_errno != ENOTSUP)
+ return -1;
+ }
return 0;
}
--git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c
index 14744b9ff..cd24dd010 100644
--- a/lib/librte_pdump/rte_pdump.c
+++ b/lib/librte_pdump/rte_pdump.c
@@ -408,7 +408,10 @@ pdump_server(const struct rte_mp_msg *mp_msg, const void *peer)
int
rte_pdump_init(void)
{
- return rte_mp_action_register(PDUMP_MP, pdump_server);
+ int ret = rte_mp_action_register(PDUMP_MP, pdump_server);
+ if (ret && rte_errno != ENOTSUP)
+ return -1;
+ return 0;
}
int
--
2.17.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH 19.08 3/6] ipc: don't unregister action if ipc unsupported
2019-04-25 12:45 [dpdk-dev] [PATCH 19.08 1/6] ipc: handle unsupported ipc in init Anatoly Burakov
2019-04-25 12:45 ` Anatoly Burakov
2019-04-25 12:45 ` [dpdk-dev] [PATCH 19.08 2/6] ipc: handle unsupported ipc in action register Anatoly Burakov
@ 2019-04-25 12:45 ` Anatoly Burakov
2019-04-25 12:45 ` Anatoly Burakov
2019-04-25 12:45 ` [dpdk-dev] [PATCH 19.08 4/6] ipc: handle unsupported ipc in sendmsg Anatoly Burakov
` (3 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Anatoly Burakov @ 2019-04-25 12:45 UTC (permalink / raw)
To: dev; +Cc: herakliusz.lipiec
Currently, unregister will be attempted even if IPC wasn't
supported in the first place. It is harmless, but for
consistency reasons, update the unregister API call to
exit early when IPC is not supported.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/common/eal_common_proc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c
index a40aa2c1b..4c062a306 100644
--- a/lib/librte_eal/common/eal_common_proc.c
+++ b/lib/librte_eal/common/eal_common_proc.c
@@ -239,6 +239,11 @@ rte_mp_action_unregister(const char *name)
if (validate_action_name(name))
return;
+ if (internal_config.no_shconf) {
+ RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC is disabled\n");
+ return;
+ }
+
pthread_mutex_lock(&mp_mutex_action);
entry = find_action_entry_by_name(name);
if (entry == NULL) {
--
2.17.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH 19.08 3/6] ipc: don't unregister action if ipc unsupported
2019-04-25 12:45 ` [dpdk-dev] [PATCH 19.08 3/6] ipc: don't unregister action if ipc unsupported Anatoly Burakov
@ 2019-04-25 12:45 ` Anatoly Burakov
0 siblings, 0 replies; 13+ messages in thread
From: Anatoly Burakov @ 2019-04-25 12:45 UTC (permalink / raw)
To: dev; +Cc: herakliusz.lipiec
Currently, unregister will be attempted even if IPC wasn't
supported in the first place. It is harmless, but for
consistency reasons, update the unregister API call to
exit early when IPC is not supported.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/common/eal_common_proc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c
index a40aa2c1b..4c062a306 100644
--- a/lib/librte_eal/common/eal_common_proc.c
+++ b/lib/librte_eal/common/eal_common_proc.c
@@ -239,6 +239,11 @@ rte_mp_action_unregister(const char *name)
if (validate_action_name(name))
return;
+ if (internal_config.no_shconf) {
+ RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC is disabled\n");
+ return;
+ }
+
pthread_mutex_lock(&mp_mutex_action);
entry = find_action_entry_by_name(name);
if (entry == NULL) {
--
2.17.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH 19.08 4/6] ipc: handle unsupported ipc in sendmsg
2019-04-25 12:45 [dpdk-dev] [PATCH 19.08 1/6] ipc: handle unsupported ipc in init Anatoly Burakov
` (2 preceding siblings ...)
2019-04-25 12:45 ` [dpdk-dev] [PATCH 19.08 3/6] ipc: don't unregister action if ipc unsupported Anatoly Burakov
@ 2019-04-25 12:45 ` Anatoly Burakov
2019-04-25 12:45 ` Anatoly Burakov
2019-04-25 12:45 ` [dpdk-dev] [PATCH 19.08 5/6] ipc: handle unsupported ipc in sync request Anatoly Burakov
` (2 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Anatoly Burakov @ 2019-04-25 12:45 UTC (permalink / raw)
To: dev; +Cc: herakliusz.lipiec
Currently, IPC API will silently ignore unsupported IPC.
Fix the API call and its callers to explicitly handle
unsupported IPC cases.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/common/eal_common_proc.c | 6 ++++++
lib/librte_eal/common/include/rte_eal.h | 3 +++
2 files changed, 9 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c
index 4c062a306..0db842f84 100644
--- a/lib/librte_eal/common/eal_common_proc.c
+++ b/lib/librte_eal/common/eal_common_proc.c
@@ -792,6 +792,12 @@ rte_mp_sendmsg(struct rte_mp_msg *msg)
if (!check_input(msg))
return -1;
+ if (internal_config.no_shconf) {
+ RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC is disabled\n");
+ rte_errno = ENOTSUP;
+ return -1;
+ }
+
RTE_LOG(DEBUG, EAL, "sendmsg: %s\n", msg->name);
return mp_send(msg, NULL, MP_MSG);
}
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index 7f807aa8e..d47cb2440 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -290,6 +290,9 @@ rte_mp_action_unregister(const char *name);
* This function will send a message which will be responsed by the action
* identified by name in the peer process.
*
+ * @note IPC may be unsupported in certain circumstances, so caller should check
+ * for ENOTSUP error.
+ *
* @param msg
* The msg argument contains the customized message.
*
--
2.17.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH 19.08 4/6] ipc: handle unsupported ipc in sendmsg
2019-04-25 12:45 ` [dpdk-dev] [PATCH 19.08 4/6] ipc: handle unsupported ipc in sendmsg Anatoly Burakov
@ 2019-04-25 12:45 ` Anatoly Burakov
0 siblings, 0 replies; 13+ messages in thread
From: Anatoly Burakov @ 2019-04-25 12:45 UTC (permalink / raw)
To: dev; +Cc: herakliusz.lipiec
Currently, IPC API will silently ignore unsupported IPC.
Fix the API call and its callers to explicitly handle
unsupported IPC cases.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/common/eal_common_proc.c | 6 ++++++
lib/librte_eal/common/include/rte_eal.h | 3 +++
2 files changed, 9 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c
index 4c062a306..0db842f84 100644
--- a/lib/librte_eal/common/eal_common_proc.c
+++ b/lib/librte_eal/common/eal_common_proc.c
@@ -792,6 +792,12 @@ rte_mp_sendmsg(struct rte_mp_msg *msg)
if (!check_input(msg))
return -1;
+ if (internal_config.no_shconf) {
+ RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC is disabled\n");
+ rte_errno = ENOTSUP;
+ return -1;
+ }
+
RTE_LOG(DEBUG, EAL, "sendmsg: %s\n", msg->name);
return mp_send(msg, NULL, MP_MSG);
}
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index 7f807aa8e..d47cb2440 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -290,6 +290,9 @@ rte_mp_action_unregister(const char *name);
* This function will send a message which will be responsed by the action
* identified by name in the peer process.
*
+ * @note IPC may be unsupported in certain circumstances, so caller should check
+ * for ENOTSUP error.
+ *
* @param msg
* The msg argument contains the customized message.
*
--
2.17.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH 19.08 5/6] ipc: handle unsupported ipc in sync request
2019-04-25 12:45 [dpdk-dev] [PATCH 19.08 1/6] ipc: handle unsupported ipc in init Anatoly Burakov
` (3 preceding siblings ...)
2019-04-25 12:45 ` [dpdk-dev] [PATCH 19.08 4/6] ipc: handle unsupported ipc in sendmsg Anatoly Burakov
@ 2019-04-25 12:45 ` Anatoly Burakov
2019-04-25 12:45 ` Anatoly Burakov
2019-04-25 12:45 ` [dpdk-dev] [PATCH 19.08 6/6] ipc: handle unsupported ipc in async request Anatoly Burakov
2019-06-05 9:29 ` [dpdk-dev] [PATCH 19.08 1/6] ipc: handle unsupported ipc in init Thomas Monjalon
6 siblings, 1 reply; 13+ messages in thread
From: Anatoly Burakov @ 2019-04-25 12:45 UTC (permalink / raw)
To: dev; +Cc: Matan Azrad, Shahaf Shuler, Yongseok Koh, herakliusz.lipiec
Currently, IPC API will silently ignore unsupported IPC.
Fix the API call and its callers to explicitly handle
unsupported IPC cases.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
drivers/net/mlx4/mlx4_mp.c | 5 +++--
drivers/net/mlx5/mlx5_mp.c | 5 +++--
lib/librte_eal/common/eal_common_proc.c | 3 ++-
lib/librte_eal/common/hotplug_mp.c | 6 +++++-
lib/librte_eal/common/include/rte_eal.h | 3 +++
lib/librte_eal/common/malloc_mp.c | 13 ++++++-------
6 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/drivers/net/mlx4/mlx4_mp.c b/drivers/net/mlx4/mlx4_mp.c
index ebc57a99e..cdb648517 100644
--- a/drivers/net/mlx4/mlx4_mp.c
+++ b/drivers/net/mlx4/mlx4_mp.c
@@ -178,8 +178,9 @@ mp_req_on_rxtx(struct rte_eth_dev *dev, enum mlx4_mp_req_type type)
mp_init_msg(dev, &mp_req, type);
ret = rte_mp_request_sync(&mp_req, &mp_rep, &ts);
if (ret) {
- ERROR("port %u failed to request stop/start Rx/Tx (%d)",
- dev->data->port_id, type);
+ if (rte_errno != ENOTSUP)
+ ERROR("port %u failed to request stop/start Rx/Tx (%d)",
+ dev->data->port_id, type);
goto exit;
}
if (mp_rep.nb_sent != mp_rep.nb_received) {
diff --git a/drivers/net/mlx5/mlx5_mp.c b/drivers/net/mlx5/mlx5_mp.c
index dc99231fe..37f26cc71 100644
--- a/drivers/net/mlx5/mlx5_mp.c
+++ b/drivers/net/mlx5/mlx5_mp.c
@@ -180,8 +180,9 @@ mp_req_on_rxtx(struct rte_eth_dev *dev, enum mlx5_mp_req_type type)
mp_init_msg(dev, &mp_req, type);
ret = rte_mp_request_sync(&mp_req, &mp_rep, &ts);
if (ret) {
- DRV_LOG(ERR, "port %u failed to request stop/start Rx/Tx (%d)",
- dev->data->port_id, type);
+ if (rte_errno != ENOTSUP)
+ DRV_LOG(ERR, "port %u failed to request stop/start Rx/Tx (%d)",
+ dev->data->port_id, type);
goto exit;
}
if (mp_rep.nb_sent != mp_rep.nb_received) {
diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c
index 0db842f84..c6aa80bfc 100644
--- a/lib/librte_eal/common/eal_common_proc.c
+++ b/lib/librte_eal/common/eal_common_proc.c
@@ -954,7 +954,8 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply,
if (internal_config.no_shconf) {
RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC is disabled\n");
- return 0;
+ rte_errno = ENOTSUP;
+ return -1;
}
if (gettimeofday(&now, NULL) < 0) {
diff --git a/lib/librte_eal/common/hotplug_mp.c b/lib/librte_eal/common/hotplug_mp.c
index 60cd1402d..5731834d1 100644
--- a/lib/librte_eal/common/hotplug_mp.c
+++ b/lib/librte_eal/common/hotplug_mp.c
@@ -405,7 +405,11 @@ int eal_dev_hotplug_request_to_secondary(struct eal_dev_mp_req *req)
ret = rte_mp_request_sync(&mp_req, &mp_reply, &ts);
if (ret != 0) {
- RTE_LOG(ERR, EAL, "rte_mp_request_sync failed\n");
+ /* if IPC is not supported, behave as if the call succeeded */
+ if (rte_errno != ENOTSUP)
+ RTE_LOG(ERR, EAL, "rte_mp_request_sync failed\n");
+ else
+ ret = 0;
return ret;
}
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index d47cb2440..4460ea14a 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -314,6 +314,9 @@ rte_mp_sendmsg(struct rte_mp_msg *msg);
*
* @note The caller is responsible to free reply->replies.
*
+ * @note IPC may be unsupported in certain circumstances, so caller should check
+ * for ENOTSUP error.
+ *
* @param req
* The req argument contains the customized request message.
*
diff --git a/lib/librte_eal/common/malloc_mp.c b/lib/librte_eal/common/malloc_mp.c
index 1374eabc2..7c6112c4e 100644
--- a/lib/librte_eal/common/malloc_mp.c
+++ b/lib/librte_eal/common/malloc_mp.c
@@ -573,7 +573,7 @@ request_sync(void)
struct rte_mp_reply reply;
struct malloc_mp_req *req = (struct malloc_mp_req *)msg.param;
struct timespec ts;
- int i, ret;
+ int i, ret = -1;
memset(&msg, 0, sizeof(msg));
memset(&reply, 0, sizeof(reply));
@@ -596,14 +596,16 @@ request_sync(void)
ret = rte_mp_request_sync(&msg, &reply, &ts);
} while (ret != 0 && rte_errno == EEXIST);
if (ret != 0) {
- RTE_LOG(ERR, EAL, "Could not send sync request to secondary process\n");
- ret = -1;
+ /* if IPC is unsupported, behave as if the call succeeded */
+ if (rte_errno != ENOTSUP)
+ RTE_LOG(ERR, EAL, "Could not send sync request to secondary process\n");
+ else
+ ret = 0;
goto out;
}
if (reply.nb_received != reply.nb_sent) {
RTE_LOG(ERR, EAL, "Not all secondaries have responded\n");
- ret = -1;
goto out;
}
@@ -612,17 +614,14 @@ request_sync(void)
(struct malloc_mp_req *)reply.msgs[i].param;
if (resp->t != REQ_TYPE_SYNC) {
RTE_LOG(ERR, EAL, "Unexpected response from secondary\n");
- ret = -1;
goto out;
}
if (resp->id != req->id) {
RTE_LOG(ERR, EAL, "Wrong request ID\n");
- ret = -1;
goto out;
}
if (resp->result != REQ_RESULT_SUCCESS) {
RTE_LOG(ERR, EAL, "Secondary process failed to synchronize\n");
- ret = -1;
goto out;
}
}
--
2.17.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH 19.08 5/6] ipc: handle unsupported ipc in sync request
2019-04-25 12:45 ` [dpdk-dev] [PATCH 19.08 5/6] ipc: handle unsupported ipc in sync request Anatoly Burakov
@ 2019-04-25 12:45 ` Anatoly Burakov
0 siblings, 0 replies; 13+ messages in thread
From: Anatoly Burakov @ 2019-04-25 12:45 UTC (permalink / raw)
To: dev; +Cc: Matan Azrad, Shahaf Shuler, Yongseok Koh, herakliusz.lipiec
Currently, IPC API will silently ignore unsupported IPC.
Fix the API call and its callers to explicitly handle
unsupported IPC cases.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
drivers/net/mlx4/mlx4_mp.c | 5 +++--
drivers/net/mlx5/mlx5_mp.c | 5 +++--
lib/librte_eal/common/eal_common_proc.c | 3 ++-
lib/librte_eal/common/hotplug_mp.c | 6 +++++-
lib/librte_eal/common/include/rte_eal.h | 3 +++
lib/librte_eal/common/malloc_mp.c | 13 ++++++-------
6 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/drivers/net/mlx4/mlx4_mp.c b/drivers/net/mlx4/mlx4_mp.c
index ebc57a99e..cdb648517 100644
--- a/drivers/net/mlx4/mlx4_mp.c
+++ b/drivers/net/mlx4/mlx4_mp.c
@@ -178,8 +178,9 @@ mp_req_on_rxtx(struct rte_eth_dev *dev, enum mlx4_mp_req_type type)
mp_init_msg(dev, &mp_req, type);
ret = rte_mp_request_sync(&mp_req, &mp_rep, &ts);
if (ret) {
- ERROR("port %u failed to request stop/start Rx/Tx (%d)",
- dev->data->port_id, type);
+ if (rte_errno != ENOTSUP)
+ ERROR("port %u failed to request stop/start Rx/Tx (%d)",
+ dev->data->port_id, type);
goto exit;
}
if (mp_rep.nb_sent != mp_rep.nb_received) {
diff --git a/drivers/net/mlx5/mlx5_mp.c b/drivers/net/mlx5/mlx5_mp.c
index dc99231fe..37f26cc71 100644
--- a/drivers/net/mlx5/mlx5_mp.c
+++ b/drivers/net/mlx5/mlx5_mp.c
@@ -180,8 +180,9 @@ mp_req_on_rxtx(struct rte_eth_dev *dev, enum mlx5_mp_req_type type)
mp_init_msg(dev, &mp_req, type);
ret = rte_mp_request_sync(&mp_req, &mp_rep, &ts);
if (ret) {
- DRV_LOG(ERR, "port %u failed to request stop/start Rx/Tx (%d)",
- dev->data->port_id, type);
+ if (rte_errno != ENOTSUP)
+ DRV_LOG(ERR, "port %u failed to request stop/start Rx/Tx (%d)",
+ dev->data->port_id, type);
goto exit;
}
if (mp_rep.nb_sent != mp_rep.nb_received) {
diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c
index 0db842f84..c6aa80bfc 100644
--- a/lib/librte_eal/common/eal_common_proc.c
+++ b/lib/librte_eal/common/eal_common_proc.c
@@ -954,7 +954,8 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply,
if (internal_config.no_shconf) {
RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC is disabled\n");
- return 0;
+ rte_errno = ENOTSUP;
+ return -1;
}
if (gettimeofday(&now, NULL) < 0) {
diff --git a/lib/librte_eal/common/hotplug_mp.c b/lib/librte_eal/common/hotplug_mp.c
index 60cd1402d..5731834d1 100644
--- a/lib/librte_eal/common/hotplug_mp.c
+++ b/lib/librte_eal/common/hotplug_mp.c
@@ -405,7 +405,11 @@ int eal_dev_hotplug_request_to_secondary(struct eal_dev_mp_req *req)
ret = rte_mp_request_sync(&mp_req, &mp_reply, &ts);
if (ret != 0) {
- RTE_LOG(ERR, EAL, "rte_mp_request_sync failed\n");
+ /* if IPC is not supported, behave as if the call succeeded */
+ if (rte_errno != ENOTSUP)
+ RTE_LOG(ERR, EAL, "rte_mp_request_sync failed\n");
+ else
+ ret = 0;
return ret;
}
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index d47cb2440..4460ea14a 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -314,6 +314,9 @@ rte_mp_sendmsg(struct rte_mp_msg *msg);
*
* @note The caller is responsible to free reply->replies.
*
+ * @note IPC may be unsupported in certain circumstances, so caller should check
+ * for ENOTSUP error.
+ *
* @param req
* The req argument contains the customized request message.
*
diff --git a/lib/librte_eal/common/malloc_mp.c b/lib/librte_eal/common/malloc_mp.c
index 1374eabc2..7c6112c4e 100644
--- a/lib/librte_eal/common/malloc_mp.c
+++ b/lib/librte_eal/common/malloc_mp.c
@@ -573,7 +573,7 @@ request_sync(void)
struct rte_mp_reply reply;
struct malloc_mp_req *req = (struct malloc_mp_req *)msg.param;
struct timespec ts;
- int i, ret;
+ int i, ret = -1;
memset(&msg, 0, sizeof(msg));
memset(&reply, 0, sizeof(reply));
@@ -596,14 +596,16 @@ request_sync(void)
ret = rte_mp_request_sync(&msg, &reply, &ts);
} while (ret != 0 && rte_errno == EEXIST);
if (ret != 0) {
- RTE_LOG(ERR, EAL, "Could not send sync request to secondary process\n");
- ret = -1;
+ /* if IPC is unsupported, behave as if the call succeeded */
+ if (rte_errno != ENOTSUP)
+ RTE_LOG(ERR, EAL, "Could not send sync request to secondary process\n");
+ else
+ ret = 0;
goto out;
}
if (reply.nb_received != reply.nb_sent) {
RTE_LOG(ERR, EAL, "Not all secondaries have responded\n");
- ret = -1;
goto out;
}
@@ -612,17 +614,14 @@ request_sync(void)
(struct malloc_mp_req *)reply.msgs[i].param;
if (resp->t != REQ_TYPE_SYNC) {
RTE_LOG(ERR, EAL, "Unexpected response from secondary\n");
- ret = -1;
goto out;
}
if (resp->id != req->id) {
RTE_LOG(ERR, EAL, "Wrong request ID\n");
- ret = -1;
goto out;
}
if (resp->result != REQ_RESULT_SUCCESS) {
RTE_LOG(ERR, EAL, "Secondary process failed to synchronize\n");
- ret = -1;
goto out;
}
}
--
2.17.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH 19.08 6/6] ipc: handle unsupported ipc in async request
2019-04-25 12:45 [dpdk-dev] [PATCH 19.08 1/6] ipc: handle unsupported ipc in init Anatoly Burakov
` (4 preceding siblings ...)
2019-04-25 12:45 ` [dpdk-dev] [PATCH 19.08 5/6] ipc: handle unsupported ipc in sync request Anatoly Burakov
@ 2019-04-25 12:45 ` Anatoly Burakov
2019-04-25 12:45 ` Anatoly Burakov
2019-06-05 9:29 ` [dpdk-dev] [PATCH 19.08 1/6] ipc: handle unsupported ipc in init Thomas Monjalon
6 siblings, 1 reply; 13+ messages in thread
From: Anatoly Burakov @ 2019-04-25 12:45 UTC (permalink / raw)
To: dev; +Cc: herakliusz.lipiec
Currently, IPC API will silently ignore unsupported IPC.
Fix the API call to explicitly handle unsupported IPC cases.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/common/eal_common_proc.c | 3 ++-
lib/librte_eal/common/include/rte_eal.h | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c
index c6aa80bfc..3a876e021 100644
--- a/lib/librte_eal/common/eal_common_proc.c
+++ b/lib/librte_eal/common/eal_common_proc.c
@@ -1041,7 +1041,8 @@ rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts,
if (internal_config.no_shconf) {
RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC is disabled\n");
- return 0;
+ rte_errno = ENOTSUP;
+ return -1;
}
if (gettimeofday(&now, NULL) < 0) {
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index 4460ea14a..9acf85664 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -344,6 +344,9 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply,
* This function sends a request message to the peer process, and will not
* block. Instead, reply will be received in a separate callback.
*
+ * @note IPC may be unsupported in certain circumstances, so caller should check
+ * for ENOTSUP error.
+ *
* @param req
* The req argument contains the customized request message.
*
--
2.17.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH 19.08 6/6] ipc: handle unsupported ipc in async request
2019-04-25 12:45 ` [dpdk-dev] [PATCH 19.08 6/6] ipc: handle unsupported ipc in async request Anatoly Burakov
@ 2019-04-25 12:45 ` Anatoly Burakov
0 siblings, 0 replies; 13+ messages in thread
From: Anatoly Burakov @ 2019-04-25 12:45 UTC (permalink / raw)
To: dev; +Cc: herakliusz.lipiec
Currently, IPC API will silently ignore unsupported IPC.
Fix the API call to explicitly handle unsupported IPC cases.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/common/eal_common_proc.c | 3 ++-
lib/librte_eal/common/include/rte_eal.h | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c
index c6aa80bfc..3a876e021 100644
--- a/lib/librte_eal/common/eal_common_proc.c
+++ b/lib/librte_eal/common/eal_common_proc.c
@@ -1041,7 +1041,8 @@ rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts,
if (internal_config.no_shconf) {
RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC is disabled\n");
- return 0;
+ rte_errno = ENOTSUP;
+ return -1;
}
if (gettimeofday(&now, NULL) < 0) {
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index 4460ea14a..9acf85664 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -344,6 +344,9 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply,
* This function sends a request message to the peer process, and will not
* block. Instead, reply will be received in a separate callback.
*
+ * @note IPC may be unsupported in certain circumstances, so caller should check
+ * for ENOTSUP error.
+ *
* @param req
* The req argument contains the customized request message.
*
--
2.17.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [dpdk-dev] [PATCH 19.08 1/6] ipc: handle unsupported ipc in init
2019-04-25 12:45 [dpdk-dev] [PATCH 19.08 1/6] ipc: handle unsupported ipc in init Anatoly Burakov
` (5 preceding siblings ...)
2019-04-25 12:45 ` [dpdk-dev] [PATCH 19.08 6/6] ipc: handle unsupported ipc in async request Anatoly Burakov
@ 2019-06-05 9:29 ` Thomas Monjalon
6 siblings, 0 replies; 13+ messages in thread
From: Thomas Monjalon @ 2019-06-05 9:29 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, Bruce Richardson, herakliusz.lipiec
25/04/2019 14:45, Anatoly Burakov:
> Currently, IPC API will silently ignore unsupported IPC.
> Fix the API call and its callers to explicitly handle
> unsupported IPC cases.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Series applied thanks.
Note that title is changed to have IPC uppercase
while "ipc:" module name is kept lowercase.
^ permalink raw reply [flat|nested] 13+ messages in thread