From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2E6C0A0471 for ; Wed, 17 Jul 2019 10:39:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1024D152A; Wed, 17 Jul 2019 10:39:28 +0200 (CEST) Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by dpdk.org (Postfix) with ESMTP id 3D1E51D7 for ; Wed, 17 Jul 2019 10:39:26 +0200 (CEST) Received: by mail-pf1-f195.google.com with SMTP id i189so10487977pfg.10 for ; Wed, 17 Jul 2019 01:39:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=0zjgo0qxzvuU2pSg2QPakDHCX09E0b27sQeFeairWF0=; b=m9osFUtEYQTRMm3BVtLnnb0qPL6xAMN2yZd8b92RCYGbVzAw2GR9z2rv9RjkXe3Sr6 KvKZbCmnC1U8DnDBMjCJJ3OKM8YHqt6FL4aRqfzR/guZfoKXVC2COjJMYzfUhm437TsV fbdF1Bmg4fb+ZpZ/gjcmNqkhmzAEcIm2zTK76Ofx+wN9hCEzfx0JHih0pMjNzswsx/t4 Wyj0w1aoipfRnvjYkb/FVH6mko9dyjUZ1+1OsdX3Thf+ImiiCAb7AGnXzHjJzQXDbCVu JxrVyKdj5j4joWXlWseWo+J0CfPpOJlmHAlwBSGmk6nTfd68nRHRSYK7pdVBXIVT0RM0 dG/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=0zjgo0qxzvuU2pSg2QPakDHCX09E0b27sQeFeairWF0=; b=CgAa+QlH2SzA5mWxqTVuwEnQsUhBY5iWotxj8AIPub0gFOIf94wuQ10yqkITaWrhcX y/swsnqDAU6CNOWl5iIqp2HuDY9T8rSecuLV/Ra+y5Di3uBLSiJHB9via/RJ0PQfz+WG B+NPFXSqWLvs7VWz3y5ceNDN+JemEy0vDNDmI0c/kSEFURsotJ3L37Dz6OLbMfbNWvU8 eKi8uxqSwB+EanXCyUwrgAphNK75GVXU2hTNFQNaBzPYXYPD75ULj8q3b2MeNwpJJ4Zk ALK96fl6y9nJA6Kse6TkNoxwnHj/JDDTYpvb4ZGPzgkmmEv44Ve/69Ivg5xzC2v1qaf4 aLpg== X-Gm-Message-State: APjAAAWjAcnEQFKoJVhWtpQRUCsC/4laWoOSzmFd7IYPJZlbDdQORiG4 Dq5q8qG65iZ4Gsu5ixB2dqxhIEiw X-Google-Smtp-Source: APXvYqxvoBKMrBQgEZ0nMFadlBX3s7UMHEh8UUu1IVK/i3H6BnVc4xMGA1S1x7cQ0MBZmX0ekQnBog== X-Received: by 2002:a63:c70d:: with SMTP id n13mr39184137pgg.171.1563352765248; Wed, 17 Jul 2019 01:39:25 -0700 (PDT) Received: from localhost.localdomain ([192.47.164.146]) by smtp.gmail.com with ESMTPSA id y128sm37068744pgy.41.2019.07.17.01.39.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jul 2019 01:39:24 -0700 (PDT) From: yasufum.o@gmail.com To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com Date: Wed, 17 Jul 2019 17:39:20 +0900 Message-Id: <20190717083920.39027-1-yasufum.o@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [spp] [PATCH] shared/sec: remove nof_rings from iface_info X-BeenThere: spp@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Soft Patch Panel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spp-bounces@dpdk.org Sender: "spp" From: Yasufumi Ogawa Struct `iface_info` is for containing the number of ports and port info itself for each of port types. However, members of the number of ports are scarcely used, only for initializing ring latency feature. As the result, three of `nof_phys`, `nof_vhosts` and `nof_rings` are not required. Former two are not referred from anywhere, and `nof_rings` can be counted with RTE libs. This patch is to remove it. Signed-off-by: Yasufumi Ogawa --- src/mirror/spp_mirror.c | 13 ++++++++++++- src/shared/secondary/spp_worker_th/cmd_utils.c | 4 ---- src/shared/secondary/spp_worker_th/cmd_utils.h | 6 ------ src/vf/spp_vf.c | 13 ++++++++++++- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/mirror/spp_mirror.c b/src/mirror/spp_mirror.c index b57dd57..5cee655 100644 --- a/src/mirror/spp_mirror.c +++ b/src/mirror/spp_mirror.c @@ -556,9 +556,20 @@ main(int argc, char *argv[]) break; #ifdef SPP_RINGLATENCYSTATS_ENABLE + int port_type, port_id; + char dev_name[RTE_DEV_NAME_MAX_LEN] = { 0 }; + int nof_rings = 0; + for (int i = 0; i < RTE_MAX_ETHPORTS; i++) { + if (!rte_eth_dev_is_valid_port(i)) + continue; + rte_eth_dev_get_name_by_port(i, dev_name); + ret = parse_dev_name(dev_name, &port_type, &port_id); + if (port_type == RING) + nof_rings++; + } int ret_ringlatency = spp_ringlatencystats_init( SPP_RING_LATENCY_STATS_SAMPLING_INTERVAL, - g_iface_info.nof_rings); + nof_rings); if (unlikely(ret_ringlatency != SPP_RET_OK)) break; #endif /* SPP_RINGLATENCYSTATS_ENABLE */ diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.c b/src/shared/secondary/spp_worker_th/cmd_utils.c index 7797a71..9180169 100644 --- a/src/shared/secondary/spp_worker_th/cmd_utils.c +++ b/src/shared/secondary/spp_worker_th/cmd_utils.c @@ -226,10 +226,6 @@ log_interface_info(const struct iface_info *iface_info) { const struct sppwk_port_info *port = NULL; int cnt = 0; - RTE_LOG(DEBUG, APP, "interface phy=%d, vhost=%d, ring=%d\n", - iface_info->nof_phys, - iface_info->nof_vhosts, - iface_info->nof_rings); for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) { port = &iface_info->phy[cnt]; if (port->iface_type == UNDEF) diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h index e1775b2..2d7c389 100644 --- a/src/shared/secondary/spp_worker_th/cmd_utils.h +++ b/src/shared/secondary/spp_worker_th/cmd_utils.h @@ -194,16 +194,10 @@ struct sppwk_comp_info { /* Manage number of interfaces and port information as global variable. */ /** - * TODO(yasufum) confirm why nof_phys, nof_vhosts and nof_rings are required - * not used in anywhere. - * * TODO(yasufum) confirm why having arrays of types. it seems OK having * just one array. */ struct iface_info { - int nof_phys; /* Number of phy ports */ - int nof_vhosts; /* Number of vhost ports */ - int nof_rings; /* Number of ring ports */ struct sppwk_port_info phy[RTE_MAX_ETHPORTS]; struct sppwk_port_info vhost[RTE_MAX_ETHPORTS]; struct sppwk_port_info ring[RTE_MAX_ETHPORTS]; diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c index 415d790..e2711d1 100644 --- a/src/vf/spp_vf.c +++ b/src/vf/spp_vf.c @@ -267,9 +267,20 @@ main(int argc, char *argv[]) break; #ifdef SPP_RINGLATENCYSTATS_ENABLE + int port_type, port_id; + char dev_name[RTE_DEV_NAME_MAX_LEN] = { 0 }; + int nof_rings = 0; + for (int i = 0; i < RTE_MAX_ETHPORTS; i++) { + if (!rte_eth_dev_is_valid_port(i)) + continue; + rte_eth_dev_get_name_by_port(i, dev_name); + ret = parse_dev_name(dev_name, &port_type, &port_id); + if (port_type == RING) + nof_rings++; + } int ret_ringlatency = spp_ringlatencystats_init( SPP_RING_LATENCY_STATS_SAMPLING_INTERVAL, - g_iface_info.nof_rings); + nof_rings); if (unlikely(ret_ringlatency != SPP_RET_OK)) break; #endif /* SPP_RINGLATENCYSTATS_ENABLE */ -- 2.17.1