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 93414A00E6 for ; Mon, 5 Aug 2019 09:05:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7C4DE1BE45; Mon, 5 Aug 2019 09:05:50 +0200 (CEST) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id C62461BE45 for ; Mon, 5 Aug 2019 09:05:48 +0200 (CEST) Received: by mail-pf1-f196.google.com with SMTP id t16so39113536pfe.11 for ; Mon, 05 Aug 2019 00:05:48 -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=Uo4v16WnzEp9vv5tQHqyc2k97fWCx/wBlp/Xf8UEkk0=; b=U4D5EXz0fVBcdG29nhOz3GP2D0oWE8Bk/7Yhr+DUXhBhYip4jFqw3e2H7wa7L01r7i YkWF3HwOjhRXLHYPkhTZ6Z6jyoAhXqXDlNBo6y/JvDojuzJsIy9YCQgXrnitw/0DSplE /DjUesjsUnI+Y0OSzBCHArUL+hZVrMxvgpcPYnLpcr+G7Aor2F6A6wm/acsHUvOMoWXo Wnf42Nnx75eeiXhhlwW+wZyzbvq/pzOTRzDcZ5voWn+T/W87Ofp5sWlDOo+azASvJP7W BLFkeyiQxmBea9qE1P88kPHBROdXynW8KS803+U9WkPINSe+qkZjYWqQ3dJ7VZhdIgbj EgAA== 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=Uo4v16WnzEp9vv5tQHqyc2k97fWCx/wBlp/Xf8UEkk0=; b=Tg02Oig/bIl88N750rOSLJ8Kk9XhPRhxHMJNKvjUUewR3g9rRGUhOm7gNMiZvinhbv K4G2ctADC+65Vkutg3kwVnVwL1y8Nsrt+JPQ91N0KAuS4aRO3UurBYeY8oc8om9cJ96s XaIVgWcnSxDuqMe9P+KRk3T3QhwFlun+rN/hE1ExMdXx8xMlX0D0+yIFnmTzAuMeqRuK qecbQHYVAzlvXuE+f+gwYQmKd5ZRWthanCRQV1IjIDu0pfZaOZgkXWV8vzh6EWP6L/Py YWUijRU5EE5R7bI1BCKy/PZyTOGvyBqkwcw0EnR21nl1MT4UZbzfzlwD8fEKyvQ7bixo HqZg== X-Gm-Message-State: APjAAAWlGGrCcFuFeqsgjukfO8aG4nOCs3SsHWtE77FsT1fRFHJgIaEH RP3kY5tXqurWM0/gARNnuFOZzj0a X-Google-Smtp-Source: APXvYqy/J+BK8aS3W5upbpoVo9bBCNiuMrYcAYMf/2ftoEadBzH29TR+56R/QuKZAmk4gSJsHhAqoA== X-Received: by 2002:a63:6205:: with SMTP id w5mr17188276pgb.199.1564988747497; Mon, 05 Aug 2019 00:05:47 -0700 (PDT) Received: from localhost.localdomain ([2400:4050:c8c2:de00:cd92:ac7b:868d:7d45]) by smtp.gmail.com with ESMTPSA id 14sm81606000pfy.40.2019.08.05.00.05.45 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 05 Aug 2019 00:05:46 -0700 (PDT) From: Yasufumi Ogawa To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com Date: Mon, 5 Aug 2019 16:05:42 +0900 Message-Id: <20190805070542.21388-1-yasufum.o@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [spp] [PATCH] spp_vf: rename log label SPP_CLASSIFIER_MAC 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" This update is to rename SPP_CLASSIFIER_MAC to VF_CLS. Signed-off-by: Yasufumi Ogawa --- src/vf/classifier.c | 149 +++++++++++++++++--------------------------- src/vf/classifier.h | 6 +- 2 files changed, 61 insertions(+), 94 deletions(-) diff --git a/src/vf/classifier.c b/src/vf/classifier.c index efaecb9..375f710 100644 --- a/src/vf/classifier.c +++ b/src/vf/classifier.c @@ -33,7 +33,7 @@ #include "shared/secondary/spp_worker_th/ringlatencystats.h" #endif -#define RTE_LOGTYPE_SPP_CLASSIFIER_MAC RTE_LOGTYPE_USER1 +#define RTE_LOGTYPE_VF_CLS RTE_LOGTYPE_USER1 #ifdef RTE_MACHINE_CPUFLAG_SSE4_2 #include @@ -43,14 +43,11 @@ #define DEFAULT_HASH_FUNC rte_jhash #endif -/* number of classifier mac table entry */ +/* Number of classifier table entry */ #define NOF_CLS_TABLE_ENTRIES 128 -/* - * interval that transmit burst packet, - * if buffer is not filled (nano second) - */ -#define DRAIN_TX_PACKET_INTERVAL 100 +/* Interval transmit burst packet if buffer is not filled. */ +#define DRAIN_TX_PACKET_INTERVAL 100 /* nano sec */ /* VID of VLAN untagged */ #define VLAN_UNTAGGED_VID 0x0fff @@ -60,7 +57,7 @@ /* classifier management information */ struct cls_mng_info { - struct cls_comp_info cmp_infos[TWO_SIDES]; + struct cls_comp_info comp_list[TWO_SIDES]; volatile int ref_index; /* Flag for ref side */ volatile int upd_index; /* Flag for update side */ volatile int is_used; @@ -88,7 +85,7 @@ clean_classifier(struct cls_mng_info *mng_info) mng_info->is_used = 0; for (i = 0; i < TWO_SIDES; ++i) - clean_component_info(mng_info->cmp_infos + (long)i); + clean_component_info(mng_info->comp_list + (long)i); memset(mng_info, 0, sizeof(struct cls_mng_info)); } @@ -147,10 +144,9 @@ get_vid(const struct rte_mbuf *pkt) #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG -#define LOG_DBG(name, fmt, ...) \ - RTE_LOG_DP(DEBUG, SPP_CLASSIFIER_MAC, \ - "[%s]Log(%s:%d):"fmt, \ - name, __func__, __LINE__, __VA_ARGS__) +#define LOG_DBG(name, fmt, ...) \ + RTE_LOG_DP(DEBUG, VF_CLS, "[%s]Log(%s:%d):"fmt, name, \ + __func__, __LINE__, __VA_ARGS__) static void log_packet(const char *name, struct rte_mbuf *pkt, @@ -168,15 +164,11 @@ log_packet(const char *name, struct rte_mbuf *pkt, ether_format_addr(mac_addr_str[1], sizeof(mac_addr_str), ð->s_addr); - RTE_LOG_DP(DEBUG, SPP_CLASSIFIER_MAC, + RTE_LOG_DP(DEBUG, VF_CLS, "[%s]Packet(%s:%d). d_addr=%s, s_addr=%s, " "vid=%hu, pktlen=%u\n", - name, - func_name, - line_num, - mac_addr_str[0], - mac_addr_str[1], - vid, + name, func_name, line_num, + mac_addr_str[0], mac_addr_str[1], vid, rte_pktmbuf_pkt_len(pkt)); } @@ -184,13 +176,10 @@ log_packet(const char *name, struct rte_mbuf *pkt, log_packet(name, pkt, __func__, __LINE__) static void -log_classification( - long clsd_idx, - struct rte_mbuf *pkt, +log_classification(long clsd_idx, struct rte_mbuf *pkt, struct cls_comp_info *cmp_info, struct cls_port_info *clsd_data, - const char *func_name, - int line_num) + const char *func_name, int line_num) { struct ether_hdr *eth; uint16_t vid; @@ -212,17 +201,12 @@ log_classification( clsd_data[clsd_idx].iface_type, clsd_data[clsd_idx].iface_no_global); - RTE_LOG_DP(DEBUG, SPP_CLASSIFIER_MAC, + RTE_LOG_DP(DEBUG, VF_CLS, "[%s]Classification(%s:%d). d_addr=%s, " "s_addr=%s, vid=%hu, pktlen=%u, tx_iface=%s\n", - cmp_info->name, - func_name, - line_num, - mac_addr_str[0], - mac_addr_str[1], - vid, - rte_pktmbuf_pkt_len(pkt), - iface_str); + cmp_info->name, func_name, line_num, + mac_addr_str[0], mac_addr_str[1], vid, + rte_pktmbuf_pkt_len(pkt), iface_str); } #define LOG_CLS(clsd_idx, pkt, cmp_info, clsd_data) \ @@ -231,14 +215,10 @@ log_classification( /* Log DEBUG message for classified MAC and VLAN info. */ static void -log_entry( - long clsd_idx, - uint16_t vid, - const char *mac_addr_str, +log_entry(long clsd_idx, uint16_t vid, const char *mac_addr_str, struct cls_comp_info *cmp_info, struct cls_port_info *clsd_data, - const char *func_name, - int line_num) + const char *func_name, int line_num) { char iface_str[STR_LEN_NAME]; @@ -249,13 +229,9 @@ log_entry( clsd_data[clsd_idx].iface_type, clsd_data[clsd_idx].iface_no_global); - RTE_LOG_DP(DEBUG, SPP_CLASSIFIER_MAC, + RTE_LOG_DP(DEBUG, VF_CLS, "[%s]Entry(%s:%d). vid=%hu, mac_addr=%s, iface=%s\n", - cmp_info->name, - func_name, - line_num, - vid, - mac_addr_str, + cmp_info->name, func_name, line_num, vid, mac_addr_str, iface_str); } #define LOG_ENT(clsd_idx, vid, mac_addr_str, cmp_info, clsd_data) \ @@ -295,11 +271,10 @@ create_mac_classification(void) mac_cls_tab = &mac_cls->cls_tbl; /* make hash table name(require uniqueness between processes) */ - sprintf(hash_tab_name, "cmtab_%07x%02hx", - getpid(), + sprintf(hash_tab_name, "cmtab_%07x%02hx", getpid(), rte_atomic16_add_return(&g_hash_table_count, 1)); - RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "Create table. name=%s, bufsz=%lu\n", + RTE_LOG(INFO, VF_CLS, "Create table. name=%s, bufsz=%lu\n", hash_tab_name, HASH_TABLE_NAME_BUF_SZ); /* set hash creating parameters */ @@ -312,10 +287,10 @@ create_mac_classification(void) .socket_id = rte_socket_id(), }; - /* create classifier mac table (hash table) */ + /* Create classifier table. */ *mac_cls_tab = rte_hash_create(&hash_params); if (unlikely(*mac_cls_tab == NULL)) { - RTE_LOG(ERR, SPP_CLASSIFIER_MAC, + RTE_LOG(ERR, VF_CLS, "Cannot create mac classification table. " "name=%s\n", hash_tab_name); rte_free(mac_cls); @@ -378,7 +353,7 @@ init_component_info(struct cls_comp_info *cmp_info, /* if mac classification is NULL, make instance */ if (unlikely(cmp_info->mac_clfs[vid] == NULL)) { - RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC, + RTE_LOG(DEBUG, VF_CLS, "Mac classification is not registered." " create. vid=%hu\n", vid); cmp_info->mac_clfs[vid] = @@ -397,18 +372,17 @@ init_component_info(struct cls_comp_info *cmp_info, /* store default classified */ if (unlikely(tx_port->cls_attrs.mac_addr == CLS_DUMMY_ADDR)) { mac_cls->default_cls_idx = i; - RTE_LOG(INFO, SPP_CLASSIFIER_MAC, + RTE_LOG(INFO, VF_CLS, "default classified. vid=%hu, " "iface_type=%d, iface_no=%d, " "ethdev_port_id=%d\n", - vid, - tx_port->iface_type, + vid, tx_port->iface_type, tx_port->iface_no, tx_port->ethdev_port_id); continue; } - /* add entry to classifier mac table */ + /* Add entry to classifier table. */ rte_memcpy(ð_addr, &tx_port->cls_attrs.mac_addr, ETHER_ADDR_LEN); ether_format_addr(mac_addr_str, sizeof(mac_addr_str), @@ -417,23 +391,19 @@ init_component_info(struct cls_comp_info *cmp_info, ret = rte_hash_add_key_data(mac_cls->cls_tbl, (void *)ð_addr, (void *)(long)i); if (unlikely(ret < 0)) { - RTE_LOG(ERR, SPP_CLASSIFIER_MAC, - "Cannot add entry to classifier mac " - "table. ret=%d, vid=%hu, " - "mac_addr=%s\n", + RTE_LOG(ERR, VF_CLS, + "Cannot add to classifier table. " + "ret=%d, vid=%hu, mac_addr=%s\n", ret, vid, mac_addr_str); return SPPWK_RET_NG; } - RTE_LOG(INFO, SPP_CLASSIFIER_MAC, - "Add entry to classifier mac table. " + RTE_LOG(INFO, VF_CLS, + "Add entry to classifier table. " "vid=%hu, mac_addr=%s, iface_type=%d, " "iface_no=%d, ethdev_port_id=%d\n", - vid, - mac_addr_str, - tx_port->iface_type, - tx_port->iface_no, - tx_port->ethdev_port_id); + vid, mac_addr_str, tx_port->iface_type, + tx_port->iface_no, tx_port->ethdev_port_id); } return SPPWK_RET_OK; @@ -460,7 +430,7 @@ transmit_packets(struct cls_port_info *clsd_data) if (unlikely(n_tx != clsd_data->nof_pkts)) { for (i = n_tx; i < clsd_data->nof_pkts; i++) rte_pktmbuf_free(clsd_data->pkts[i]); - RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC, + RTE_LOG(DEBUG, VF_CLS, "drop packets(tx). num=%hu, ethdev_port_id=%hu\n", (uint16_t)(clsd_data->nof_pkts - n_tx), clsd_data->ethdev_port_id); @@ -478,12 +448,10 @@ transmit_all_packet(struct cls_comp_info *cmp_info) 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, + RTE_LOG(INFO, VF_CLS, "transmit all packets (drain). " - "index=%d, " - "nof_pkts=%hu\n", - i, - clsd_data_tx[i].nof_pkts); + "index=%d, nof_pkts=%hu\n", + i, clsd_data_tx[i].nof_pkts); transmit_packets(&clsd_data_tx[i]); } } @@ -497,7 +465,7 @@ push_packet(struct rte_mbuf *pkt, struct cls_port_info *clsd_data) /* transmit packet, if buffer is filled */ if (unlikely(clsd_data->nof_pkts == MAX_PKT_BURST)) { - RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC, + RTE_LOG(DEBUG, VF_CLS, "transmit packets (buffer is filled). " "iface_type=%d, iface_no={%d,%d}, " "tx_port=%hu, nof_pkts=%hu\n", @@ -547,7 +515,7 @@ handle_l2multicast_packet(struct rte_mbuf *pkt, */ if (unlikely(gen_def_clsd_idx < 0)) { /* untagged's default is not registered too */ - RTE_LOG(ERR, SPP_CLASSIFIER_MAC, + RTE_LOG(ERR, VF_CLS, "No entry.(l2 multicast packet)\n"); rte_pktmbuf_free(pkt); return; @@ -672,9 +640,9 @@ change_classifier_index(struct cls_mng_info *mng_info, int id) sppwk_swap_two_sides(SPPWK_SWAP_REF, 0, 0); /* Transmit all packets for switching the using data. */ - transmit_all_packet(mng_info->cmp_infos + mng_info->ref_index); + transmit_all_packet(mng_info->comp_list + mng_info->ref_index); - RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC, + RTE_LOG(DEBUG, VF_CLS, "Core[%u] Change update index.\n", id); mng_info->ref_index = (mng_info->upd_index + 1) % TWO_SIDES; @@ -698,16 +666,16 @@ update_classifier(struct sppwk_comp_info *wk_comp_info) struct cls_mng_info *mng_info = cls_mng_info_list + wk_id; struct cls_comp_info *cls_info = NULL; - RTE_LOG(INFO, SPP_CLASSIFIER_MAC, + RTE_LOG(INFO, VF_CLS, "Start updating classifier, id=%u.\n", wk_id); /* TODO(yasufum) rename `infos`. */ - cls_info = mng_info->cmp_infos + mng_info->upd_index; + cls_info = mng_info->comp_list + mng_info->upd_index; /* initialize update side classifier information */ ret = init_component_info(cls_info, wk_comp_info); if (unlikely(ret != SPPWK_RET_OK)) { - RTE_LOG(ERR, SPP_CLASSIFIER_MAC, + RTE_LOG(ERR, VF_CLS, "Cannot update classifier, ret=%d.\n", ret); return ret; } @@ -723,9 +691,9 @@ update_classifier(struct sppwk_comp_info *wk_comp_info) rte_delay_us_block(SPPWK_UPDATE_INTERVAL); /* Clean old one. */ - clean_component_info(mng_info->cmp_infos + mng_info->upd_index); + clean_component_info(mng_info->comp_list + mng_info->upd_index); - RTE_LOG(INFO, SPP_CLASSIFIER_MAC, + RTE_LOG(INFO, VF_CLS, "Done update classifier, id=%u.\n", wk_id); return SPPWK_RET_OK; @@ -751,7 +719,7 @@ classify_packets(int comp_id) /* change index of update classifier management information */ change_classifier_index(mng_info, comp_id); - cmp_info = mng_info->cmp_infos + mng_info->ref_index; + cmp_info = mng_info->comp_list + mng_info->ref_index; clsd_data_rx = &cmp_info->rx_port_i; clsd_data_tx = cmp_info->tx_ports_i; @@ -767,7 +735,7 @@ classify_packets(int comp_id) if (likely(clsd_data_tx[i].nof_pkts == 0)) continue; - RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC, + RTE_LOG(DEBUG, VF_CLS, "transmit packets (drain). index=%d, " "nof_pkts=%hu, interval=%lu\n", i, clsd_data_tx[i].nof_pkts, @@ -813,14 +781,14 @@ get_classifier_status(unsigned int lcore_id, int id, mng_info = cls_mng_info_list + id; if (!is_used_mng_info(mng_info)) { - RTE_LOG(ERR, SPP_CLASSIFIER_MAC, + RTE_LOG(ERR, VF_CLS, "Classifier is not used " "(comp_id=%d, lcore_id=%d, type=%d).\n", id, lcore_id, SPPWK_TYPE_CLS); return SPPWK_RET_NG; } - cmp_info = mng_info->cmp_infos + mng_info->ref_index; + cmp_info = mng_info->comp_list + mng_info->ref_index; port_info = cmp_info->tx_ports_i; memset(rx_ports, 0x00, sizeof(rx_ports)); @@ -902,8 +870,7 @@ add_mac_entry(struct classifier_table_params *params, * Append each entry of MAC address. `tbl_proc` is function * pointer to append_classifier_element_value(). */ - (*params->tbl_proc)(params, cls_type, vid, mac_addr_str, - &port); + (*params->tbl_proc)(params, cls_type, vid, mac_addr_str, &port); } } @@ -921,10 +888,10 @@ _add_classifier_table(struct classifier_table_params *params) if (!is_used_mng_info(mng_info)) continue; - cmp_info = mng_info->cmp_infos + mng_info->ref_index; + cmp_info = mng_info->comp_list + mng_info->ref_index; port_info = cmp_info->tx_ports_i; - RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC, + RTE_LOG(DEBUG, VF_CLS, "Parse MAC entries for status on lcore %u.\n", i); for (vlan_id = 0; vlan_id < NOF_VLAN; ++vlan_id) { @@ -950,7 +917,7 @@ add_classifier_table(const char *name, char **output, char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE); if (unlikely(tmp_buff == NULL)) { - RTE_LOG(ERR, SPP_CLASSIFIER_MAC, "Failed to alloc buff.\n"); + RTE_LOG(ERR, VF_CLS, "Failed to alloc buff.\n"); return SPPWK_RET_NG; } diff --git a/src/vf/classifier.h b/src/vf/classifier.h index 2f1eb91..ce77d70 100644 --- a/src/vf/classifier.h +++ b/src/vf/classifier.h @@ -2,8 +2,8 @@ * Copyright(c) 2017-2019 Nippon Telegraph and Telephone Corporation */ -#ifndef _CLASSIFIER_MAC_H_ -#define _CLASSIFIER_MAC_H_ +#ifndef __CLASSIFIER_H__ +#define __CLASSIFIER_H__ #include "shared/secondary/spp_worker_th/cmd_utils.h" @@ -102,4 +102,4 @@ int classify_packets(int comp_id); int get_classifier_status(unsigned int lcore_id, int id, struct sppwk_lcore_params *params); -#endif /* _CLASSIFIER_MAC_H_ */ +#endif /* __CLASSIFIER_H__ */ -- 2.17.1