From patchwork Thu May 6 03:46:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 92979 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 82F13A0524; Thu, 6 May 2021 05:46:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E077F410F5; Thu, 6 May 2021 05:46:16 +0200 (CEST) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by mails.dpdk.org (Postfix) with ESMTP id EA6EA410DB for ; Thu, 6 May 2021 05:46:13 +0200 (CEST) Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FbKDm5fWyzkWmJ; Thu, 6 May 2021 11:43:36 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.498.0; Thu, 6 May 2021 11:46:09 +0800 From: "Min Hu (Connor)" To: CC: , Date: Thu, 6 May 2021 11:46:07 +0800 Message-ID: <1620272768-42421-2-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1620272768-42421-1-git-send-email-humin29@huawei.com> References: <1617876888-63458-1-git-send-email-humin29@huawei.com> <1620272768-42421-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v2 1/2] examples/ethtool: fix Rx/Tx queue setup with rte socket id 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: Chengwen Feng In DPDK, 'rte_socket_id' means the running socket while 'rte_eth_dev_socket_id' is the device socket. For better performance, memory which queue setup used and device should be in the same socket. This patch make sure it calls rte_eth_dev_socket_id API to get device socket_id when setting ringparam. Fixes: bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Min Hu (Connor) --- examples/ethtool/lib/rte_ethtool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c index 4132516..b2e45f5 100644 --- a/examples/ethtool/lib/rte_ethtool.c +++ b/examples/ethtool/lib/rte_ethtool.c @@ -465,12 +465,12 @@ rte_ethtool_set_ringparam(uint16_t port_id, return stat; stat = rte_eth_tx_queue_setup(port_id, 0, ring_param->tx_pending, - rte_socket_id(), NULL); + rte_eth_dev_socket_id(port_id), NULL); if (stat != 0) return stat; stat = rte_eth_rx_queue_setup(port_id, 0, ring_param->rx_pending, - rte_socket_id(), NULL, rx_qinfo.mp); + rte_eth_dev_socket_id(port_id), NULL, rx_qinfo.mp); if (stat != 0) return stat; From patchwork Thu May 6 03:46:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 92980 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 632F8A0524; Thu, 6 May 2021 05:46:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0E981410FC; Thu, 6 May 2021 05:46:18 +0200 (CEST) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by mails.dpdk.org (Postfix) with ESMTP id F1ACA410EE for ; Thu, 6 May 2021 05:46:13 +0200 (CEST) Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FbKDm5qyPzkWmQ; Thu, 6 May 2021 11:43:36 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.498.0; Thu, 6 May 2021 11:46:10 +0800 From: "Min Hu (Connor)" To: CC: , Date: Thu, 6 May 2021 11:46:08 +0800 Message-ID: <1620272768-42421-3-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1620272768-42421-1-git-send-email-humin29@huawei.com> References: <1617876888-63458-1-git-send-email-humin29@huawei.com> <1620272768-42421-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v2 2/2] examples/ethtool: add closing port operation 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: Huisong Li Currently, ethtool directly ends the process after 'quit' cmd. In this case, software resources are not released and hardware resources of the device are not uninstalled. This patch adds closing port operation to release resources. Fixes: bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Min Hu (Connor) --- examples/ethtool/ethtool-app/main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/examples/ethtool/ethtool-app/main.c b/examples/ethtool/ethtool-app/main.c index 21ed85c..9ac0a44 100644 --- a/examples/ethtool/ethtool-app/main.c +++ b/examples/ethtool/ethtool-app/main.c @@ -256,6 +256,22 @@ static int worker_main(__rte_unused void *ptr_data) return 0; } +static void close_ports(void) +{ + uint16_t portid; + int ret; + + for (portid = 0; portid < app_cfg.cnt_ports; portid++) { + printf("Closing port %d...", portid); + ret = rte_eth_dev_stop(portid); + if (ret != 0) + rte_exit(EXIT_FAILURE, "rte_eth_dev_stop: err=%s, port=%u\n", + strerror(-ret), portid); + rte_eth_dev_close(portid); + printf(" Done\n"); + } +} + int main(int argc, char **argv) { int cnt_args_parsed; @@ -299,6 +315,8 @@ int main(int argc, char **argv) return -1; } + close_ports(); + /* clean up the EAL */ rte_eal_cleanup();