From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 9AD38A05D3 for ; Thu, 25 Apr 2019 14:45:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 99A5C1B5B0; Thu, 25 Apr 2019 14:45:34 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 3CFD81B59C for ; Thu, 25 Apr 2019 14:45:27 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Apr 2019 05:45:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,393,1549958400"; d="scan'208";a="153666987" Received: from silpixa00399498.ir.intel.com (HELO silpixa00399498.ger.corp.intel.com) ([10.237.223.125]) by orsmga002.jf.intel.com with ESMTP; 25 Apr 2019 05:45:25 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Matan Azrad , Shahaf Shuler , Yongseok Koh , herakliusz.lipiec@intel.com Date: Thu, 25 Apr 2019 13:45:18 +0100 Message-Id: <434b9157813b280d73c213b4d934a6c12dbebe0e.1556195691.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH 19.08 5/6] ipc: handle unsupported ipc in sync request X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190425124518.HQFthzfEawQcVqwFy_Mx27XuPgp63-5RxUM7NjrphNs@z> 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 --- 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