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 04DC2A0471 for ; Thu, 18 Jul 2019 07:00:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F00502082; Thu, 18 Jul 2019 07:00:37 +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 630372082 for ; Thu, 18 Jul 2019 07:00:37 +0200 (CEST) Received: by mail-pf1-f195.google.com with SMTP id q10so11985764pff.9 for ; Wed, 17 Jul 2019 22:00:37 -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=l5txc8qwt2ETKLsXpaBw4ihRrene4nCE9MmrK6nCjvn6QlaYgE/tE28ThdoE5/Jc/V fJfBf+M+ENxNRj5NwHZECSI+tbgr86R1QOhOLyhKTzHKRdv2zmCU7aBgk4YyhkbPNra6 3U9HPpwLWC1pI25KEb1A6H61sRccZIWntMOEOQxTGSPOuH4hZcz5BzqcWqV2xFrGWGkd Ya/70HRba9TUzRu2fWF9ju2ljyBBxtyIL0yho7wRCQpcDIyRxTUwb+ho8ErmRKkPokiY xDbDnhg5217vumkf+aKqNttN+HXMc3qDDAStUi0UFEeSZFkdiSz61kSGyiEZbxkoej/Q /pYg== 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=O5QNZxNXBrfgpdei0Df0Pc9mnlrghc/bHT3P+693weBdyDl8ANoIxmdmbkA8UqgjMc ow1N6Cha8ozenFx1Bcj2c680h6Dgco/EDtm+4lvERpGB5xlOP9eh/Z3W1plwVHZWQjWK aJAZQNgs2Q8Am6bnOcF8A+0jhvQYBrzq2IXe+oK+1wODJO4L/eUZQ+gYzpcLXlmkW6Yg J0hO3cZDvgTNYWcADgmZiTvL1h6AfyXrSuuCJkV4cUIqhmiSwSaW+0Kr894EJgA/rNuE 6alu57bhso626odEkGmELy6hfQ/ekRnRpnVGLm4a32VI/F2tdMUb+gIYPudD6qj/pWe3 ARNQ== X-Gm-Message-State: APjAAAXOn09g69dBFCn5xggbcQAEJPDKKHcI4XJ2x3IDl9StA8i/Qu9g CQG5NrcgvdUy7ViEd6kJD4yYMlGf X-Google-Smtp-Source: APXvYqxfeZRBA4XFOh4giFceMCQ+DqiW8XjV6Mw2btfC/jLmyeRighwsTMdWA1LA3/rRDPDixpH56Q== X-Received: by 2002:a63:520f:: with SMTP id g15mr41918131pgb.28.1563426036283; Wed, 17 Jul 2019 22:00:36 -0700 (PDT) Received: from localhost.localdomain ([192.47.164.146]) by smtp.gmail.com with ESMTPSA id z13sm22157755pjn.32.2019.07.17.22.00.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jul 2019 22:00:35 -0700 (PDT) From: yasufum.o@gmail.com To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com Date: Thu, 18 Jul 2019 14:00:29 +0900 Message-Id: <20190718050029.6693-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