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 44C0AA0C41; Thu, 18 Nov 2021 18:36:23 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C35EA40687; Thu, 18 Nov 2021 18:36:22 +0100 (CET) Received: from mail-ot1-f99.google.com (mail-ot1-f99.google.com [209.85.210.99]) by mails.dpdk.org (Postfix) with ESMTP id 9040140395 for ; Thu, 18 Nov 2021 18:36:21 +0100 (CET) Received: by mail-ot1-f99.google.com with SMTP id w6-20020a9d77c6000000b0055e804fa524so12203928otl.3 for ; Thu, 18 Nov 2021 09:36:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:date:to:subject:message-id; bh=xmx0a4ZbRwCLakrTZXdS+WPj9XY9KYg9PNOSoGkvz1k=; b=H/hbwvPtF3zFF/uK35W0LObF3St625+3SXQ75vKBMosMQxE3zxSwfxhZSHIyBVmea5 YHdqQQPYPGYAq1bHC2SUqEws17mRKaS95bWozVaphN7nVTGI9QpUu/0fXKvLvURpKC/h svHo9fPnhA9ZNdsZQtBRmuvubiDKQ5fVVfZ/mkFLOxqYBcXDBuyg/DTI2MAP+gpbk8+A sPJuuBef0/vStW0k7PJCeXHS2nCGdC/NRqtic9utcwT8Z9TvZLPGQWIqKjaFqe8vdx/V ddcDwgiyrYticJxWIUHehZ6FSaDERzU/X7qYw+fAgAvxps4lVs87hRPhR5gYPDh54ECc cuJA== X-Gm-Message-State: AOAM5300fl3MIjGcu7VqfSXXFKdj1oUZGCLRXbrHyTlD7miArcDXH17R yqgxHd723wUZ8+yNhKm3KJGzcc2KMyV3hoQ6fH2Iu8ZvbtM6gA== X-Google-Smtp-Source: ABdhPJzP4hSNR16mPUINFeKjHYXF2RcXN1PX6M3Ux/XFjzBSUDplTMqYRMT0VttXgQqe8RJAgsUHC+HjmAYs X-Received: by 2002:a9d:2077:: with SMTP id n110mr21810679ota.261.1637256980436; Thu, 18 Nov 2021 09:36:20 -0800 (PST) Received: from optima.cs.arizona.edu (optima.cs.arizona.edu. [192.12.69.5]) by smtp-relay.gmail.com with ESMTPS id t1sm118513oth.5.2021.11.18.09.36.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Nov 2021 09:36:20 -0800 (PST) X-Relaying-Domain: cs.arizona.edu Received: from cs.arizona.edu (lectura.cs.arizona.edu [192.12.69.186]) by optima.cs.arizona.edu (8.14.4/8.14.4/Debian-2ubuntu2.1) with ESMTP id 1AIHaJ8e005265 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Nov 2021 10:36:19 -0700 Received: from localhost (cs.arizona.edu [local]) by cs.arizona.edu (OpenSMTPD) with ESMTPA id b712bba8; Thu, 18 Nov 2021 17:36:06 +0000 (UTC) From: Junxiao Shi Date: Thu, 18 Nov 2021 17:33:46 +0000 To: dev@dpdk.org Subject: [PATCH] net/memif: allow stopping and closing device Message-ID: <119df28c7cc9d267@cs.arizona.edu> 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 Bugzilla ID: 888 Fixes: febc855b358e ("ethdev: forbid closing started device") Signed-off-by: Junxiao Shi --- drivers/net/memif/rte_eth_memif.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c index 43d7378329..e3d523af57 100644 --- a/drivers/net/memif/rte_eth_memif.c +++ b/drivers/net/memif/rte_eth_memif.c @@ -1260,6 +1260,13 @@ memif_dev_start(struct rte_eth_dev *dev) return ret; } +static int +memif_dev_stop(struct rte_eth_dev *dev) +{ + memif_disconnect(dev); + return 0; +} + static int memif_dev_close(struct rte_eth_dev *dev) { @@ -1268,7 +1275,6 @@ memif_dev_close(struct rte_eth_dev *dev) if (rte_eal_process_type() == RTE_PROC_PRIMARY) { memif_msg_enq_disconnect(pmd->cc, "Device closed", 0); - memif_disconnect(dev); for (i = 0; i < dev->data->nb_rx_queues; i++) (*dev->dev_ops->rx_queue_release)(dev, i); @@ -1276,8 +1282,6 @@ memif_dev_close(struct rte_eth_dev *dev) (*dev->dev_ops->tx_queue_release)(dev, i); memif_socket_remove_device(dev); - } else { - memif_disconnect(dev); } rte_free(dev->process_private); @@ -1515,6 +1519,7 @@ memif_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t qid __rte_unused) static const struct eth_dev_ops ops = { .dev_start = memif_dev_start, + .dev_stop = memif_dev_stop, .dev_close = memif_dev_close, .dev_infos_get = memif_dev_info, .dev_configure = memif_dev_configure, -- 2.17.1