From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id E0EC6A046B for ; Mon, 24 Jun 2019 04:25:34 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D15B11BF42; Mon, 24 Jun 2019 04:25:34 +0200 (CEST) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id 96F861BF6F for ; Mon, 24 Jun 2019 04:25:32 +0200 (CEST) Received: by mail-pf1-f194.google.com with SMTP id c85so6611166pfc.1 for ; Sun, 23 Jun 2019 19:25:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=W+sTMqginMOnVVZukgEaoxyT4vCaT27jZt3OI+irFEc=; b=jsVm4UOngbUhOIidBpJe6hJUUeBv12fDXC1R30ANQep3g57Oq7jDijrjGnShiGVvEo VWxitUP7i6H4x0YFAAc0Z1m+BlffNCJdw3unqGR4AkYGhgiTUn+cAh4e928zxOdd7bTa hSxwIYk4WsfBNe0syK+lw5iT2S5F45ODx3czrak37irOL6RmJXUsWIiU+D9zMyw3OKo1 87sepUMujw0Ty8/vNdOzWGfknLLyjXvQpoft6rtz+wrR3CQbbpPaInyxqQZx+WfoEB2U T7qysZTl2SKDAz2b4BQwRZbxHp72Bl4TqhMoXUwcB0f70E4prpmyASKbBqfpPqJ8G13J s+Qw== 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:in-reply-to :references; bh=W+sTMqginMOnVVZukgEaoxyT4vCaT27jZt3OI+irFEc=; b=G5Ehxe5H3bCn0l8/r7TqDm4MjRU+KyaFOW0uRMBWk8AJKqUIGFDYTXAJ3iJqj0DXkV Bf7LlLBYXq595M+Ty666aDePQ5LTtIwKIWo5w9L7+vykwKZisATFpZKwgI+Xv6zXY/4K fDd+oxMZqOCO04l5yhh7sgBLbS6duz0Y3A0aYcDRDj7Fb4I2PgTCHohpi3gnjsDMCvKh yU4+RxnFVLHcuVxQM7CJlTXdqPU+hUFAP55+17MuAqUdukRCmJ/2M/B6CtnGwBb2xD1N +VElSKnKnze1MO6fXJaOfv4yO/5p1BZqXs1wyRI6XCRMMgs0wVAmWqI7cbiF+AAhNdVw nvzQ== X-Gm-Message-State: APjAAAW1c8cXo4w6EkO+Pd+VnoOHxTuVPQomIxqGiH39rYIlkCg8BcB8 1Kvg5NozKXqOdDtN1hDW8y+zeS+Q X-Google-Smtp-Source: APXvYqw8ieFSIkJEqpXgNG6Urs50N+7Ru8mmGSP30mlSBdNJkwrvky+KFxTjNePVFGV0/CFZ/coMFA== X-Received: by 2002:a65:404a:: with SMTP id h10mr31231101pgp.262.1561343131626; Sun, 23 Jun 2019 19:25:31 -0700 (PDT) Received: from localhost.localdomain ([192.47.164.146]) by smtp.gmail.com with ESMTPSA id a3sm9927461pje.3.2019.06.23.19.25.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Jun 2019 19:25:31 -0700 (PDT) From: yasufum.o@gmail.com To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com Date: Mon, 24 Jun 2019 11:24:59 +0900 Message-Id: <20190624022504.18752-7-yasufum.o@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190624022504.18752-1-yasufum.o@gmail.com> References: <20190624022504.18752-1-yasufum.o@gmail.com> Subject: [spp] [PATCH 06/11] shared/sec: revise members of struct cls_port_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 To refactor, revise members of struct `cls_port_info` in which struct of information of port is name as "classified data" and it is not describing the feature. Signed-off-by: Yasufumi Ogawa --- src/shared/secondary/spp_worker_th/vf_deps.h | 10 +-- src/vf/classifier_mac.c | 65 ++++++++++---------- 2 files changed, 37 insertions(+), 38 deletions(-) diff --git a/src/shared/secondary/spp_worker_th/vf_deps.h b/src/shared/secondary/spp_worker_th/vf_deps.h index 8364a13..79e2abb 100644 --- a/src/shared/secondary/spp_worker_th/vf_deps.h +++ b/src/shared/secondary/spp_worker_th/vf_deps.h @@ -20,7 +20,7 @@ struct mac_classifier { int default_cls_idx; /* Default index for classification. */ }; -/* Set of attirbutes of port for classification. */ +/* Attirbutes of port for classification. */ /* TODO(yasufum) confirm what is `iface_no_global`. */ struct cls_port_info { enum port_type iface_type; @@ -36,10 +36,10 @@ struct cls_comp_info { char name[STR_LEN_NAME]; /* component name */ int mac_addr_entry; /* mac address entry flag */ struct mac_classifier *mac_clfs[NOF_VLAN]; /* classifiers per VLAN. */ - int n_classified_data_tx; /* number of transmission ports */ - struct cls_port_info classified_data_rx; /* RX handled by cls */ - /* transmission ports handled by classifier */ - struct cls_port_info classified_data_tx[RTE_MAX_ETHPORTS]; + int nof_tx_ports; /* Number of TX ports info entries. */ + /* Classifier has one RX port and several TX ports. */ + struct cls_port_info rx_port_i; /* RX port info classified. */ + struct cls_port_info tx_ports_i[RTE_MAX_ETHPORTS]; /* TX info. */ }; /* free mac classification instance. */ diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c index 8edad6d..4213372 100644 --- a/src/vf/classifier_mac.c +++ b/src/vf/classifier_mac.c @@ -330,42 +330,43 @@ init_component_info(struct cls_comp_info *cmp_info, struct mac_classifier *mac_cls; struct ether_addr eth_addr; char mac_addr_str[ETHER_ADDR_STR_BUF_SZ]; - struct cls_port_info *clsd_data_rx = &cmp_info->classified_data_rx; - struct cls_port_info *clsd_data_tx = cmp_info->classified_data_tx; + /* Classifier has one RX port and several TX ports. */ + struct cls_port_info *cls_rx_port_info = &cmp_info->rx_port_i; + struct cls_port_info *cls_tx_ports_info = cmp_info->tx_ports_i; struct sppwk_port_info *tx_port = NULL; uint16_t vid; /* set rx */ if (wk_comp_info->nof_rx == 0) { - clsd_data_rx->iface_type = UNDEF; - clsd_data_rx->iface_no = 0; - clsd_data_rx->iface_no_global = 0; - clsd_data_rx->ethdev_port_id = 0; - clsd_data_rx->nof_pkts = 0; + cls_rx_port_info->iface_type = UNDEF; + cls_rx_port_info->iface_no = 0; + cls_rx_port_info->iface_no_global = 0; + cls_rx_port_info->ethdev_port_id = 0; + cls_rx_port_info->nof_pkts = 0; } else { - clsd_data_rx->iface_type = + cls_rx_port_info->iface_type = wk_comp_info->rx_ports[0]->iface_type; - clsd_data_rx->iface_no = 0; - clsd_data_rx->iface_no_global = + cls_rx_port_info->iface_no = 0; + cls_rx_port_info->iface_no_global = wk_comp_info->rx_ports[0]->iface_no; - clsd_data_rx->ethdev_port_id = + cls_rx_port_info->ethdev_port_id = wk_comp_info->rx_ports[0]->ethdev_port_id; - clsd_data_rx->nof_pkts = 0; + cls_rx_port_info->nof_pkts = 0; } /* set tx */ - cmp_info->n_classified_data_tx = wk_comp_info->nof_tx; + cmp_info->nof_tx_ports = wk_comp_info->nof_tx; cmp_info->mac_addr_entry = 0; for (i = 0; i < wk_comp_info->nof_tx; i++) { tx_port = wk_comp_info->tx_ports[i]; vid = tx_port->cls_attrs.vlantag.vid; /* store ports information */ - clsd_data_tx[i].iface_type = tx_port->iface_type; - clsd_data_tx[i].iface_no = i; - clsd_data_tx[i].iface_no_global = tx_port->iface_no; - clsd_data_tx[i].ethdev_port_id = tx_port->ethdev_port_id; - clsd_data_tx[i].nof_pkts = 0; + cls_tx_ports_info[i].iface_type = tx_port->iface_type; + cls_tx_ports_info[i].iface_no = i; + cls_tx_ports_info[i].iface_no_global = tx_port->iface_no; + cls_tx_ports_info[i].ethdev_port_id = tx_port->ethdev_port_id; + cls_tx_ports_info[i].nof_pkts = 0; if (tx_port->cls_attrs.mac_addr == 0) continue; @@ -475,9 +476,9 @@ static inline void transmit_all_packet(struct cls_comp_info *cmp_info) { int i; - struct cls_port_info *clsd_data_tx = cmp_info->classified_data_tx; + struct cls_port_info *clsd_data_tx = cmp_info->tx_ports_i; - for (i = 0; i < cmp_info->n_classified_data_tx; i++) { + for (i = 0; i < cmp_info->nof_tx_ports; i++) { if (unlikely(clsd_data_tx[i].nof_pkts != 0)) { RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "transmit all packets (drain). " @@ -756,8 +757,8 @@ spp_classifier_mac_do(int id) change_classifier_index(mng_info, id); cmp_info = mng_info->cmp_infos + mng_info->ref_index; - clsd_data_rx = &cmp_info->classified_data_rx; - clsd_data_tx = cmp_info->classified_data_tx; + clsd_data_rx = &cmp_info->rx_port_i; + clsd_data_tx = cmp_info->tx_ports_i; /** * decide classifier information of the current cycle If at least, @@ -765,14 +766,14 @@ spp_classifier_mac_do(int id) * classifying. If not, stop classifying. */ if (!(clsd_data_rx->iface_type != UNDEF && - cmp_info->n_classified_data_tx >= 1 && - cmp_info->mac_addr_entry == 1)) + cmp_info->nof_tx_ports >= 1 && + cmp_info->mac_addr_entry == 1)) return SPP_RET_OK; /* drain tx packets, if buffer is not filled for interval */ cur_tsc = rte_rdtsc(); if (unlikely(cur_tsc - prev_tsc > drain_tsc)) { - for (i = 0; i < cmp_info->n_classified_data_tx; i++) { + for (i = 0; i < cmp_info->nof_tx_ports; i++) { if (likely(clsd_data_tx[i].nof_pkts == 0)) continue; @@ -825,19 +826,17 @@ spp_classifier_get_component_status( } cmp_info = mng_info->cmp_infos + mng_info->ref_index; - clsd_data = cmp_info->classified_data_tx; + clsd_data = cmp_info->tx_ports_i; memset(rx_ports, 0x00, sizeof(rx_ports)); - if (cmp_info->classified_data_rx.iface_type != UNDEF) { + if (cmp_info->rx_port_i.iface_type != UNDEF) { nof_rx = 1; - rx_ports[0].iface_type = cmp_info-> - classified_data_rx.iface_type; - rx_ports[0].iface_no = cmp_info-> - classified_data_rx.iface_no_global; + rx_ports[0].iface_type = cmp_info->rx_port_i.iface_type; + rx_ports[0].iface_no = cmp_info->rx_port_i.iface_no_global; } memset(tx_ports, 0x00, sizeof(tx_ports)); - nof_tx = cmp_info->n_classified_data_tx; + nof_tx = cmp_info->nof_tx_ports; for (i = 0; i < nof_tx; i++) { tx_ports[i].iface_type = clsd_data[i].iface_type; tx_ports[i].iface_no = clsd_data[i].iface_no_global; @@ -925,7 +924,7 @@ spp_classifier_mac_iterate_table( continue; cmp_info = mng_info->cmp_infos + mng_info->ref_index; - clsd_data = cmp_info->classified_data_tx; + clsd_data = cmp_info->tx_ports_i; RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC, "Core[%u] Start iterate classifier table.\n", i); -- 2.17.1