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 B5A47424E7; Mon, 4 Sep 2023 06:59:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7203740C35; Mon, 4 Sep 2023 06:57:58 +0200 (CEST) Received: from VLXDG1SPAM1.ramaxel.com (email.unionmem.com [221.4.138.186]) by mails.dpdk.org (Postfix) with ESMTP id BC86F402ED for ; Mon, 4 Sep 2023 06:57:53 +0200 (CEST) Received: from V12DG1MBS03.ramaxel.local ([172.26.18.33]) by VLXDG1SPAM1.ramaxel.com with ESMTP id 3844vGXH054274; Mon, 4 Sep 2023 12:57:16 +0800 (GMT-8) (envelope-from wanry@3snic.com) Received: from localhost.localdomain (10.64.136.151) by V12DG1MBS03.ramaxel.local (172.26.18.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.17; Mon, 4 Sep 2023 12:57:15 +0800 From: To: CC: , Renyong Wan , Steven Song Subject: [PATCH v5 20/32] net/sssnic: support dev close and reset Date: Mon, 4 Sep 2023 12:56:46 +0800 Message-ID: <20230904045658.238185-21-wanry@3snic.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230904045658.238185-1-wanry@3snic.com> References: <20230904045658.238185-1-wanry@3snic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Originating-IP: [10.64.136.151] X-ClientProxiedBy: V12DG1MBS03.ramaxel.local (172.26.18.33) To V12DG1MBS03.ramaxel.local (172.26.18.33) X-DNSRBL: X-SPAM-SOURCE-CHECK: pass X-MAIL: VLXDG1SPAM1.ramaxel.com 3844vGXH054274 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 From: Renyong Wan Signed-off-by: Steven Song Signed-off-by: Renyong Wan --- drivers/net/sssnic/sssnic_ethdev.c | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/net/sssnic/sssnic_ethdev.c b/drivers/net/sssnic/sssnic_ethdev.c index 8201a1e3c4..b59c4fd3ad 100644 --- a/drivers/net/sssnic/sssnic_ethdev.c +++ b/drivers/net/sssnic/sssnic_ethdev.c @@ -13,6 +13,8 @@ #include "sssnic_ethdev_rx.h" #include "sssnic_ethdev_tx.h" +static int sssnic_ethdev_init(struct rte_eth_dev *ethdev); + static int sssnic_ethdev_infos_get(struct rte_eth_dev *ethdev, struct rte_eth_dev_info *devinfo) @@ -622,9 +624,39 @@ sssnic_ethdev_stop(struct rte_eth_dev *ethdev) return 0; } +static int +sssnic_ethdev_close(struct rte_eth_dev *ethdev) +{ + sssnic_ethdev_release(ethdev); + + PMD_DRV_LOG(INFO, "Port %u is closed", ethdev->data->port_id); + + return 0; +} + +static int +sssnic_ethdev_reset(struct rte_eth_dev *ethdev) +{ + int ret; + + sssnic_ethdev_release(ethdev); + + ret = sssnic_ethdev_init(ethdev); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Failed to initialize sssnic ethdev"); + return ret; + } + + PMD_DRV_LOG(INFO, "Port %u is reset", ethdev->data->port_id); + + return 0; +} + static const struct eth_dev_ops sssnic_ethdev_ops = { .dev_start = sssnic_ethdev_start, .dev_stop = sssnic_ethdev_stop, + .dev_close = sssnic_ethdev_close, + .dev_reset = sssnic_ethdev_reset, .dev_set_link_up = sssnic_ethdev_set_link_up, .dev_set_link_down = sssnic_ethdev_set_link_down, .link_update = sssnic_ethdev_link_update, -- 2.27.0