From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E21B0A0C43; Wed, 12 May 2021 12:14:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9914C4110D; Wed, 12 May 2021 12:14:28 +0200 (CEST) Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by mails.dpdk.org (Postfix) with ESMTP id 2A45741101 for ; Wed, 12 May 2021 12:14:26 +0200 (CEST) Received: by mail-lf1-f44.google.com with SMTP id z9so32914269lfu.8 for ; Wed, 12 May 2021 03:14:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zXVF+/KbOhijn7v5lqZhi77ZQrLqzfMWOdW86frxinE=; b=w9nPhXBAA27WsljJ3m3VzNa02Ldc2lH+WTAlL3Jufd6Fdp8Tyvom9Hs/VMmQ6cUmJL 9gmf2I37/5K+S2c4qAYI5PA33iPK/zsfR/PQ7099CLJptKaddIN1wGlxGcdTOnrnzmu6 SLZO3iolYe4Hpw8/AO4uqntd9CZwp+4MU94MixGcCZcxWwcJnMwJQ+eBttVXScp9wDRs v2v59gNhyEnF4/p7qGERpRD71O3vicN0z3mmF8VH2FsGsrqv0aka28nfrodUwfkbTlt6 egCxGqpeyQBALfB2rGSAo04pa/og2TycJr0CHq7p7weH+gAuDvixIyGpwz5Y5h3HDmPT Byfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zXVF+/KbOhijn7v5lqZhi77ZQrLqzfMWOdW86frxinE=; b=ZlnxIbVNCTkWkzvU5rte5paDHu83RJHqnlm/CtkM1tLgRrtbGGjpydwC0NYYjn3Pwt 9uA7r9uEEf5H5aKOQwfMGE+qqAR6fR4HHDmCLwcUL4WDbkYRh44i2pfQK/cuk28ovYHG TCSwR9RNclFkO5cLqigEOGVMILR+lbsLJq4T0gYJpUdmsg7bHrTj6av0TKwLyJ3Qg43y DLh9biYVPM9bHyZyfersJqC13eAxv2ILuxcHxvw3q/5MtFxEQHmgkVu8l8o0VGmXWH76 c5mkWa5f22xQUkjFSaMcXsaTsEChoc/bOiuY1A/kBmfotW4UEuUNJL5UETSx0Yp/f79V JQBA== X-Gm-Message-State: AOAM530sNHj4C/GxXKw9KRL759W+/Tw3kr3XgpPOFhcW4Te9L/QvrX5z g+SvwukO71kzVcuVuM/HEFw+agT6XfhdDbnq X-Google-Smtp-Source: ABdhPJwQGNYqaN4T3Mbaq39RbMiF0yDj/3BWGaDV1iJOEv0intd0QJcGKlu+LB96ccdhDBC9HHNAbA== X-Received: by 2002:a05:6512:3d20:: with SMTP id d32mr23896192lfv.648.1620814465857; Wed, 12 May 2021 03:14:25 -0700 (PDT) Received: from DESKTOP-U5LNN3J.localdomain (89-79-189-199.dynamic.chello.pl. [89.79.189.199]) by smtp.gmail.com with ESMTPSA id d26sm2892244lfa.118.2021.05.12.03.14.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 May 2021 03:14:25 -0700 (PDT) From: Michal Krawczyk To: ferruh.yigit@intel.com Cc: dev@dpdk.org, ndagan@amazon.com, gtzalik@amazon.com, igorch@amazon.com, upstream@semihalf.com, Stanislaw Kardach , Michal Krawczyk , Shay Agroskin Date: Wed, 12 May 2021 12:13:46 +0200 Message-Id: <20210512101346.24803-4-mk@semihalf.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210512101346.24803-1-mk@semihalf.com> References: <20210512101346.24803-1-mk@semihalf.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 3/3] net/ena: disable dev ops not supported by secondary process X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" From: Stanislaw Kardach For dev_ops not supported by the secondary process, either return -EPERM or return without doing anything. In both cases log a warning. It's still application's responsibility to avoid calls like that and those changes are for debugging/informational purposes. Signed-off-by: Stanislaw Kardach Reviewed-by: Michal Krawczyk Reviewed-by: Igor Chauskin Reviewed-by: Shay Agroskin --- v5: * Fix commit log. v4: * Fix commit heading style. drivers/net/ena/ena_ethdev.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index e310e7ae8c..dfe68279fa 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -535,6 +535,12 @@ ena_dev_reset(struct rte_eth_dev *dev) { int rc = 0; + /* Cannot release memory in secondary process */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { + PMD_DRV_LOG(WARNING, "dev_reset not supported in secondary.\n"); + return -EPERM; + } + ena_destroy_device(dev); rc = eth_ena_dev_init(dev); if (rc) @@ -1059,6 +1065,12 @@ static int ena_start(struct rte_eth_dev *dev) uint64_t ticks; int rc = 0; + /* Cannot allocate memory in secondary process */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { + PMD_DRV_LOG(WARNING, "dev_start not supported in secondary.\n"); + return -EPERM; + } + rc = ena_check_valid_conf(adapter); if (rc) return rc; @@ -1105,6 +1117,12 @@ static int ena_stop(struct rte_eth_dev *dev) struct ena_com_dev *ena_dev = &adapter->ena_dev; int rc; + /* Cannot free memory in secondary process */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { + PMD_DRV_LOG(WARNING, "dev_stop not supported in secondary.\n"); + return -EPERM; + } + rte_timer_stop_sync(&adapter->timer_wd); ena_queue_stop_all(dev, ENA_RING_TYPE_TX); ena_queue_stop_all(dev, ENA_RING_TYPE_RX); -- 2.25.1