From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail04.ics.ntt-tx.co.jp (mail05.ics.ntt-tx.co.jp [210.232.35.69]) by dpdk.org (Postfix) with ESMTP id DF8095942 for ; Wed, 21 Nov 2018 02:41:06 +0100 (CET) Received: from gwchk03.silk.ntt-tx.co.jp (gwchk03.silk.ntt-tx.co.jp [10.107.0.111]) by mail04.ics.ntt-tx.co.jp (unknown) with ESMTP id wAL1f5ip002629; Wed, 21 Nov 2018 10:41:05 +0900 Received: (from root@localhost) by gwchk03.silk.ntt-tx.co.jp (unknown) id wAL1f4Wr004385; Wed, 21 Nov 2018 10:41:04 +0900 Received: from gwchk.silk.ntt-tx.co.jp [10.107.0.110] by gwchk03.silk.ntt-tx.co.jp with ESMTP id LAA01731; Wed, 21 Nov 2018 10:35:59 +0900 Received: from imss03.silk.ntt-tx.co.jp (localhost [127.0.0.1]) by imss03.silk.ntt-tx.co.jp (unknown) with ESMTP id wAL1ZxEU009587; Wed, 21 Nov 2018 10:35:59 +0900 Received: from mgate02.silk.ntt-tx.co.jp (smtp02.silk.ntt-tx.co.jp [10.107.0.37]) by imss03.silk.ntt-tx.co.jp (unknown) with ESMTP id wAL1Zxm4009584; Wed, 21 Nov 2018 10:35:59 +0900 Message-Id: <201811210135.wAL1Zxm4009584@imss03.silk.ntt-tx.co.jp> Received: from localhost by mgate02.silk.ntt-tx.co.jp (unknown) id wAL1ZwWT008346 ; Wed, 21 Nov 2018 10:35:59 +0900 From: x-fn-spp@sl.ntt-tx.co.jp To: ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp Cc: spp@dpdk.org Date: Wed, 21 Nov 2018 10:35:36 +0900 X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181121013558.8869-1-x-fn-spp@sl.ntt-tx.co.jp> References: <20181121013558.8869-1-x-fn-spp@sl.ntt-tx.co.jp> X-TM-AS-MML: No Subject: [spp] [PATCH 01/23] spp_vf: fix invalid code for max chars 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: , X-List-Received-Date: Wed, 21 Nov 2018 01:41:07 -0000 From: Hideyuki Yamashita Refactor invalid code for the maximum 80 characters to apply with DPDK's coding style. Signed-off-by: Hideyuki Yamashita Signed-off-by: Naoki Takada --- src/vf/Makefile | 5 ++- src/vf/classifier_mac.c | 72 +++++++++++++++++++++-------------- src/vf/command_conn.c | 7 ++-- src/vf/command_conn.h | 2 +- src/vf/command_dec.c | 35 +++++++++-------- src/vf/command_dec.h | 2 +- src/vf/command_proc.c | 58 +++++++++++++++------------- src/vf/ringlatencystats.c | 10 +++-- src/vf/spp_forward.c | 18 ++++++--- src/vf/spp_port.c | 17 +++++---- src/vf/spp_vf.c | 79 ++++++++++++++++++++++++--------------- src/vf/spp_vf.h | 3 +- src/vf/string_buffer.c | 3 +- 13 files changed, 186 insertions(+), 125 deletions(-) diff --git a/src/vf/Makefile b/src/vf/Makefile index 43d3db0..88381be 100644 --- a/src/vf/Makefile +++ b/src/vf/Makefile @@ -12,7 +12,10 @@ include $(RTE_SDK)/mk/rte.vars.mk APP = spp_vf # all source are stored in SRCS-y -SRCS-y := spp_vf.c classifier_mac.c spp_forward.c string_buffer.c command_conn.c command_dec.c command_proc.c ringlatencystats.c spp_port.c ../shared/common.c +SRCS-y := spp_vf.c classifier_mac.c spp_forward.c +SRCS-y += string_buffer.c ringlatencystats.c spp_port.c +SRCS-y += command_conn.c command_dec.c command_proc.c +SRCS-y += ../shared/common.c CFLAGS += $(WERROR_FLAGS) -O3 CFLAGS += -I$(SRCDIR)/../shared diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c index 1ca788d..2a01f0e 100644 --- a/src/vf/classifier_mac.c +++ b/src/vf/classifier_mac.c @@ -45,7 +45,10 @@ /* interval that wait until change update index (micro second) */ #define CHANGE_UPDATE_INDEX_WAIT_INTERVAL SPP_CHANGE_UPDATE_INTERVAL -/* interval that transmit burst packet, if buffer is not filled (nano second) */ +/* + * interval that transmit burst packet, + * if buffer is not filled (nano second) + */ #define DRAIN_TX_PACKET_INTERVAL 100 /* VID of VLAN untagged */ @@ -190,7 +193,8 @@ log_packet(const char *name, struct rte_mbuf *pkt, ð->s_addr); RTE_LOG_DP(DEBUG, SPP_CLASSIFIER_MAC, - "[%s]Packet(%s:%d). d_addr=%s, s_addr=%s, vid=%hu, pktlen=%u\n", + "[%s]Packet(%s:%d). d_addr=%s, s_addr=%s, " + "vid=%hu, pktlen=%u\n", name, func_name, line_num, @@ -234,7 +238,8 @@ log_classification( clsd_data[clsd_idx].iface_no_global); RTE_LOG_DP(DEBUG, SPP_CLASSIFIER_MAC, - "[%s]Classification(%s:%d). d_addr=%s, s_addr=%s, vid=%hu, pktlen=%u, tx_iface=%s\n", + "[%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, @@ -335,7 +340,8 @@ create_mac_classification(void) /* create classifier mac table (hash table) */ *mac_cls_tab = rte_hash_create(&hash_params); if (unlikely(*mac_cls_tab == NULL)) { - RTE_LOG(ERR, SPP_CLASSIFIER_MAC, "Cannot create mac classification table. " + RTE_LOG(ERR, SPP_CLASSIFIER_MAC, + "Cannot create mac classification table. " "name=%s\n", hash_tab_name); rte_free(mac_cls); return NULL; @@ -396,8 +402,8 @@ init_component_info(struct component_info *cmp_info, /* if mac classification is NULL, make instance */ if (unlikely(cmp_info->mac_classifications[vid] == NULL)) { RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC, - "Mac classification is not registered. create." - "vid=%hu\n", vid); + "Mac classification is not registered." + " create. vid=%hu\n", vid); cmp_info->mac_classifications[vid] = create_mac_classification(); if (unlikely(cmp_info->mac_classifications[vid] == @@ -414,8 +420,10 @@ init_component_info(struct component_info *cmp_info, if (unlikely(tx_port->class_id.mac_addr == SPP_DEFAULT_CLASSIFIED_DMY_ADDR)) { mac_cls->default_classified = i; - RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "default classified. " - "vid=%hu, iface_type=%d, iface_no=%d, dpdk_port=%d\n", + RTE_LOG(INFO, SPP_CLASSIFIER_MAC, + "default classified. vid=%hu, " + "iface_type=%d, iface_no=%d, " + "dpdk_port=%d\n", vid, tx_port->iface_type, tx_port->iface_no, @@ -433,14 +441,17 @@ init_component_info(struct component_info *cmp_info, (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", + "Cannot add entry to classifier mac " + "table. ret=%d, vid=%hu, " + "mac_addr=%s\n", ret, vid, mac_addr_str); return -1; } - RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "Add entry to classifier mac table. " - "vid=%hu, mac_addr=%s, iface_type=%d, iface_no=%d, dpdk_port=%d\n", + RTE_LOG(INFO, SPP_CLASSIFIER_MAC, + "Add entry to classifier mac table. " + "vid=%hu, mac_addr=%s, iface_type=%d, " + "iface_no=%d, dpdk_port=%d\n", vid, mac_addr_str, tx_port->iface_type, @@ -472,7 +483,8 @@ init_classifier(struct management_info *mng_info) #ifdef RTE_MACHINE_CPUFLAG_SSE4_2 RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC, "Enabled SSE4.2. use CRC hash.\n"); #else - RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC, "Disabled SSE4.2. use Jenkins hash.\n"); + RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC, + "Disabled SSE4.2. use Jenkins hash.\n"); #endif /* populate the classifier information at reference */ @@ -480,8 +492,8 @@ init_classifier(struct management_info *mng_info) cmp_infos[mng_info->ref_index], &component_info); if (unlikely(ret != 0)) { RTE_LOG(ERR, SPP_CLASSIFIER_MAC, - "Cannot initialize classifier mac table. ret=%d\n", - ret); + "Cannot initialize classifier mac table. " + "ret=%d\n", ret); return -1; } @@ -604,8 +616,8 @@ get_general_default_classified_index(struct component_info *cmp_info) mac_cls = cmp_info->mac_classifications[VLAN_UNTAGGED_VID]; if (unlikely(mac_cls == NULL)) { - LOG_DBG(cmp_info->name, "Untagged's default is not set. vid=%d\n", - (int)VLAN_UNTAGGED_VID); + LOG_DBG(cmp_info->name, "Untagged's default is not set. " + "vid=%d\n", (int)VLAN_UNTAGGED_VID); return -1; } @@ -683,8 +695,8 @@ select_classified_index(const struct rte_mbuf *pkt, /* select mac address classification by vid */ mac_cls = cmp_info->mac_classifications[vid]; if (unlikely(mac_cls == NULL)) { - LOG_DBG(cmp_info->name, "Mac classification is not registered. vid=%hu\n", - vid); + LOG_DBG(cmp_info->name, "Mac classification is not " + "registered. vid=%hu\n", vid); return get_general_default_classified_index(cmp_info); } @@ -692,14 +704,14 @@ select_classified_index(const struct rte_mbuf *pkt, ret = rte_hash_lookup_data(mac_cls->classification_tab, (const void *)ð->d_addr, &lookup_data); if (ret >= 0) { - LOG_DBG(cmp_info->name, "Mac address is registered. ret=%d, vid=%hu\n", - ret, vid); + LOG_DBG(cmp_info->name, "Mac address is registered. " + "ret=%d, vid=%hu\n", ret, vid); return (int)(long)lookup_data; } LOG_DBG(cmp_info->name, - "Mac address is not registered. ret=%d, (EINVAL=%d, ENOENT=%d)\n", - ret, EINVAL, ENOENT); + "Mac address is not registered. ret=%d, " + "(EINVAL=%d, ENOENT=%d)\n", ret, EINVAL, ENOENT); /* check if packet is l2 multicast */ if (unlikely(is_multicast_ether_addr(ð->d_addr))) @@ -708,8 +720,8 @@ select_classified_index(const struct rte_mbuf *pkt, /* if default is not set, use untagged's default */ if (unlikely(mac_cls->default_classified < 0 && vid != VLAN_UNTAGGED_VID)) { - LOG_DBG(cmp_info->name, "Vid's default is not set. use general default. vid=%hu\n", - vid); + LOG_DBG(cmp_info->name, "Vid's default is not set. " + "use general default. vid=%hu\n", vid); return get_general_default_classified_index(cmp_info); } @@ -741,8 +753,8 @@ classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx, i); push_packet(rx_pkts[i], clsd_data + clsd_idx); } else if (unlikely(clsd_idx == -1)) { - LOG_DBG(cmp_info->name, "no destination. drop packet. i=%d\n", - i); + LOG_DBG(cmp_info->name, "no destination. " + "drop packet. i=%d\n", i); rte_pktmbuf_free(rx_pkts[i]); } else if (unlikely(clsd_idx == -2)) { LOG_DBG(cmp_info->name, "as multicast packet. i=%d\n", @@ -760,7 +772,8 @@ change_update_index(struct management_info *mng_info, int id) if (unlikely(mng_info->ref_index == mng_info->upd_index)) { /* Change reference index of port ability. */ - spp_port_ability_change_index(PORT_ABILITY_CHG_INDEX_REF, 0, 0); + spp_port_ability_change_index(PORT_ABILITY_CHG_INDEX_REF, + 0, 0); /* Transmit all packets for switching the using data. */ transmit_all_packet(mng_info->cmp_infos + @@ -924,7 +937,8 @@ spp_classifier_get_component_status( mng_info = g_mng_infos + id; if (!is_used_mng_info(mng_info)) { RTE_LOG(ERR, SPP_CLASSIFIER_MAC, - "Component[%d] Not used. (status)(core = %d, type = %d)\n", + "Component[%d] Not used. " + "(status)(core = %d, type = %d)\n", id, lcore_id, SPP_COMPONENT_CLASSIFIER_MAC); return -1; } diff --git a/src/vf/command_conn.c b/src/vf/command_conn.c index e81eda9..4c3de54 100644 --- a/src/vf/command_conn.c +++ b/src/vf/command_conn.c @@ -98,8 +98,8 @@ spp_receive_message(int *sock, char **strbuf) ret = recv(*sock, rx_buf, rx_buf_sz, 0); if (unlikely(ret <= 0)) { if (likely(ret == 0)) { - RTE_LOG(INFO, SPP_COMMAND_PROC, - "Controller has performed an shutdown."); + RTE_LOG(INFO, SPP_COMMAND_PROC, "Controller has " + "performed an shutdown."); } else if (unlikely(errno != EAGAIN && errno != EWOULDBLOCK)) { RTE_LOG(ERR, SPP_COMMAND_PROC, "Receive failure. errno=%d\n", errno); @@ -108,7 +108,8 @@ spp_receive_message(int *sock, char **strbuf) return 0; } - RTE_LOG(INFO, SPP_COMMAND_PROC, "Assume Server closed connection.\n"); + RTE_LOG(INFO, SPP_COMMAND_PROC, "Assume Server closed " + "connection.\n"); close(*sock); *sock = -1; return SPP_CONNERR_TEMPORARY; diff --git a/src/vf/command_conn.h b/src/vf/command_conn.h index 09b19c4..ce2f56c 100644 --- a/src/vf/command_conn.h +++ b/src/vf/command_conn.h @@ -56,7 +56,7 @@ int spp_connect_to_controller(int *sock); * @retval 0 < succeeded. number of bytes received. * @retval 0 no receive message. * @retval SPP_CONNERR_TEMPORARY temporary error. please reconnect. - * @retval SPP_CONNERR_FATAL fatal error occurred. should terminate process. + * @retval SPP_CONNERR_FATAL fatal error occurred. should terminate process. */ int spp_receive_message(int *sock, char **msgbuf); diff --git a/src/vf/command_dec.c b/src/vf/command_dec.c index 74b0c1d..204cb86 100644 --- a/src/vf/command_dec.c +++ b/src/vf/command_dec.c @@ -284,7 +284,8 @@ decode_component_type_value(void *output, const char *arg_val) org_type = spp_get_component_type_update(component->core); if ((org_type != SPP_COMPONENT_UNUSE) && (org_type != set_type)) { RTE_LOG(ERR, SPP_COMMAND_PROC, - "Component type does not match. val=%s (org=%d, new=%d)\n", + "Component type does not match. " + "val=%s (org=%d, new=%d)\n", arg_val, org_type, set_type); return -1; } @@ -383,8 +384,8 @@ decode_port_name_value(void *output, const char *arg_val) ret = spp_get_component_id(arg_val); if (unlikely(ret < 0)) { - RTE_LOG(ERR, SPP_COMMAND_PROC, "Unknown component name. val=%s\n", - arg_val); + RTE_LOG(ERR, SPP_COMMAND_PROC, + "Unknown component name. val=%s\n", arg_val); return -1; } @@ -457,8 +458,8 @@ decode_mac_addr_str_value(void *output, const char *arg_val) ret = spp_change_mac_str_to_int64(str_val); if (unlikely(ret < 0)) { - RTE_LOG(ERR, SPP_COMMAND_PROC, "Bad mac address string. val=%s\n", - str_val); + RTE_LOG(ERR, SPP_COMMAND_PROC, + "Bad mac address string. val=%s\n", str_val); return -1; } @@ -533,7 +534,8 @@ decode_classifier_port_value(void *output, const char *arg_val) if (ret < 0) return -1; - if (spp_check_added_port(tmp_port.iface_type, tmp_port.iface_no) == 0) { + if (spp_check_added_port(tmp_port.iface_type, + tmp_port.iface_no) == 0) { RTE_LOG(ERR, SPP_COMMAND_PROC, "Port not added. val=%s\n", arg_val); return -1; @@ -545,8 +547,8 @@ decode_classifier_port_value(void *output, const char *arg_val) if (unlikely(classifier_table->action == SPP_CMD_ACTION_ADD)) { if (!spp_check_classid_used_port(ETH_VLAN_ID_MAX, 0, tmp_port.iface_type, tmp_port.iface_no)) { - RTE_LOG(ERR, SPP_COMMAND_PROC, - "Port in used. (classifier_table command) val=%s\n", + RTE_LOG(ERR, SPP_COMMAND_PROC, "Port in used. " + "(classifier_table command) val=%s\n", arg_val); return -1; } @@ -558,8 +560,8 @@ decode_classifier_port_value(void *output, const char *arg_val) if (!spp_check_classid_used_port(classifier_table->vid, (uint64_t)mac_addr, tmp_port.iface_type, tmp_port.iface_no)) { - RTE_LOG(ERR, SPP_COMMAND_PROC, - "Port in used. (classifier_table command) val=%s\n", + RTE_LOG(ERR, SPP_COMMAND_PROC, "Port in used. " + "(classifier_table command) val=%s\n", arg_val); return -1; } @@ -581,7 +583,8 @@ struct decode_parameter_list { }; /* parameter list for each command */ -static struct decode_parameter_list parameter_list[][SPP_CMD_MAX_PARAMETERS] = { +static struct decode_parameter_list +parameter_list[][SPP_CMD_MAX_PARAMETERS] = { { /* classifier_table(mac) */ { .name = "action", @@ -728,7 +731,8 @@ decode_command_parameter_in_list(struct spp_command_request *request, argv[pi]); if (unlikely(ret < 0)) { RTE_LOG(ERR, SPP_COMMAND_PROC, - "Bad value. command=%s, name=%s, index=%d, value=%s\n", + "Bad value. command=%s, name=%s, " + "index=%d, value=%s\n", argv[0], list->name, pi, argv[pi]); return set_string_value_decode_error(error, argv[pi], list->name); @@ -742,8 +746,8 @@ struct decode_command_list { const char *name; /* Command name */ int param_min; /* Min number of parameters */ int param_max; /* Max number of parameters */ - int (*func)(struct spp_command_request *request, int argc, char *argv[], - struct spp_command_decode_error *error); + int (*func)(struct spp_command_request *request, int argc, + char *argv[], struct spp_command_decode_error *error); /* Pointer to command handling function */ }; @@ -833,7 +837,8 @@ spp_command_decode_request( request->num_command = 1; ret = decode_command_in_list(request, request_str, error); if (unlikely(ret != 0)) { - RTE_LOG(ERR, SPP_COMMAND_PROC, "Cannot decode command request. " + RTE_LOG(ERR, SPP_COMMAND_PROC, + "Cannot decode command request. " "ret=%d, request_str=%.*s\n", ret, (int)request_str_len, request_str); return ret; diff --git a/src/vf/command_dec.h b/src/vf/command_dec.h index 93444cb..281a8c4 100644 --- a/src/vf/command_dec.h +++ b/src/vf/command_dec.h @@ -146,7 +146,7 @@ struct spp_command_request { int num_command; /**< Number of accepted commands */ int num_valid_command; /**< Number of executed commands */ struct spp_command commands[SPP_CMD_MAX_COMMANDS]; - /**< Information of executed commands */ + /**spec.component.action, command->spec.component.name, @@ -415,8 +417,8 @@ append_interface_array(char **output, const enum port_type type) *output = spp_strbuf_append(*output, tmp_str, strlen(tmp_str)); if (unlikely(*output == NULL)) { RTE_LOG(ERR, SPP_COMMAND_PROC, - "Interface number failed to add. (type = %d)\n", - type); + "Interface number failed to add. " + "(type = %d)\n", type); return -1; } @@ -778,8 +780,8 @@ append_response_list_value(char **output, if (unlikely(ret < 0)) { spp_strbuf_free(tmp_buff); RTE_LOG(ERR, SPP_COMMAND_PROC, - "Failed to get reply string. (tag = %s)\n", - list[i].tag_name); + "Failed to get reply string. " + "(tag = %s)\n", list[i].tag_name); return -1; } @@ -791,7 +793,8 @@ append_response_list_value(char **output, if (unlikely(ret < 0)) { spp_strbuf_free(tmp_buff); RTE_LOG(ERR, SPP_COMMAND_PROC, - "Failed to add commas. (tag = %s)\n", + "Failed to add commas. " + "(tag = %s)\n", list[i].tag_name); return -1; } @@ -802,7 +805,8 @@ append_response_list_value(char **output, if (unlikely(*output == NULL)) { spp_strbuf_free(tmp_buff); RTE_LOG(ERR, SPP_COMMAND_PROC, - "Failed to add reply string. (tag = %s)\n", + "Failed to add reply string. " + "(tag = %s)\n", list[i].tag_name); return -1; } @@ -910,15 +914,16 @@ append_info_value(const char *name, char **output) /* send response for decode error */ static void -send_decode_error_response(int *sock, const struct spp_command_request *request, +send_decode_error_response(int *sock, + const struct spp_command_request *request, struct command_result *command_results) { int ret = -1; char *msg, *tmp_buff; tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE); if (unlikely(tmp_buff == NULL)) { - RTE_LOG(ERR, SPP_COMMAND_PROC, - "allocate error. (name = decode_error_response)\n"); + RTE_LOG(ERR, SPP_COMMAND_PROC, "allocate error. " + "(name = decode_error_response)\n"); return; } @@ -935,8 +940,8 @@ send_decode_error_response(int *sock, const struct spp_command_request *request, msg = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE); if (unlikely(msg == NULL)) { spp_strbuf_free(tmp_buff); - RTE_LOG(ERR, SPP_COMMAND_PROC, - "allocate error. (name = decode_error_response)\n"); + RTE_LOG(ERR, SPP_COMMAND_PROC, "allocate error. " + "(name = decode_error_response)\n"); return; } ret = append_json_block_brackets("", &msg, tmp_buff); @@ -993,8 +998,8 @@ send_command_result_response(int *sock, ret = append_client_id_value("client_id", &tmp_buff, NULL); if (unlikely(ret < 0)) { spp_strbuf_free(tmp_buff); - RTE_LOG(ERR, SPP_COMMAND_PROC, - "Failed to make client id response.\n"); + RTE_LOG(ERR, SPP_COMMAND_PROC, "Failed to make " + "client id response.\n"); return; } } @@ -1132,7 +1137,8 @@ spp_command_proc_do(void) msgbuf = spp_strbuf_allocate(CMD_REQ_BUF_INIT_SIZE); if (unlikely(msgbuf == NULL)) { RTE_LOG(ERR, SPP_COMMAND_PROC, - "Cannot allocate memory for receive data(init).\n"); + "Cannot allocate memory " + "for receive data(init).\n"); return -1; } } diff --git a/src/vf/ringlatencystats.c b/src/vf/ringlatencystats.c index 4ad469d..a0cc901 100644 --- a/src/vf/ringlatencystats.c +++ b/src/vf/ringlatencystats.c @@ -55,8 +55,8 @@ spp_ringlatencystats_init(uint64_t samp_intvl, uint16_t stats_count) sizeof(struct ring_latency_stats_info) * stats_count, 0); if (unlikely(g_stats_info == NULL)) { - RTE_LOG(ERR, SPP_RING_LATENCY_STATS, - "Cannot allocate memory for ring latency stats info\n"); + RTE_LOG(ERR, SPP_RING_LATENCY_STATS, "Cannot allocate memory " + "for ring latency stats info\n"); return -1; } @@ -65,7 +65,8 @@ spp_ringlatencystats_init(uint64_t samp_intvl, uint16_t stats_count) g_stats_count = stats_count; RTE_LOG(DEBUG, SPP_RING_LATENCY_STATS, - "g_samp_intvl=%lu, g_stats_count=%hu, cpns=%lu, NS_PER_SEC=%f\n", + "g_samp_intvl=%lu, g_stats_count=%hu, " + "cpns=%lu, NS_PER_SEC=%f\n", g_samp_intvl, g_stats_count, cycles_per_ns(), NS_PER_SEC); @@ -103,7 +104,8 @@ spp_ringlatencystats_add_time_stamp(int ring_id, /* set tsc to mbuf::timestamp */ if (unlikely(stats_info->timer_tsc >= g_samp_intvl)) { RTE_LOG(DEBUG, SPP_RING_LATENCY_STATS, - "Set timestamp. ring_id=%d, pkts_index=%u, timestamp=%lu\n", + "Set timestamp. ring_id=%d, " + "pkts_index=%u, timestamp=%lu\n", ring_id, i, now); pkts[i]->timestamp = now; stats_info->timer_tsc = 0; diff --git a/src/vf/spp_forward.c b/src/vf/spp_forward.c index 03bda10..b0846c6 100644 --- a/src/vf/spp_forward.c +++ b/src/vf/spp_forward.c @@ -80,7 +80,8 @@ spp_forward_update(struct spp_component_info *component) memset(path, 0x00, sizeof(struct forward_path)); RTE_LOG(INFO, FORWARD, - "Component[%d] Start update component. (name = %s, type = %d)\n", + "Component[%d] Start update component. " + "(name = %s, type = %d)\n", component->component_id, component->name, component->type); @@ -103,7 +104,8 @@ spp_forward_update(struct spp_component_info *component) rte_delay_us_block(SPP_CHANGE_UPDATE_INTERVAL); RTE_LOG(INFO, FORWARD, - "Component[%d] Complete update component. (name = %s, type = %d)\n", + "Component[%d] Complete update component. " + "(name = %s, type = %d)\n", component->component_id, component->name, component->type); @@ -118,7 +120,8 @@ change_forward_index(int id) struct forward_info *info = &g_forward_info[id]; if (info->ref_index == info->upd_index) { /* Change reference index of port ability. */ - spp_port_ability_change_index(PORT_ABILITY_CHG_INDEX_REF, 0, 0); + spp_port_ability_change_index(PORT_ABILITY_CHG_INDEX_REF, + 0, 0); info->ref_index = (info->upd_index+1)%SPP_INFO_AREA_MAX; } @@ -149,13 +152,15 @@ spp_forward(int id) tx = &path->ports[cnt].tx; /* Receive packets */ - nb_rx = spp_eth_rx_burst(rx->dpdk_port, 0, bufs, MAX_PKT_BURST); + nb_rx = spp_eth_rx_burst(rx->dpdk_port, 0, + bufs, MAX_PKT_BURST); if (unlikely(nb_rx == 0)) continue; /* Send packets */ if (tx->dpdk_port >= 0) - nb_tx = spp_eth_tx_burst(tx->dpdk_port, 0, bufs, nb_rx); + nb_tx = spp_eth_tx_burst(tx->dpdk_port, + 0, bufs, nb_rx); /* Discard remained packets to release mbuf */ if (unlikely(nb_tx < nb_rx)) { @@ -182,7 +187,8 @@ spp_forward_get_component_status( if (unlikely(path->type == SPP_COMPONENT_UNUSE)) { RTE_LOG(ERR, FORWARD, - "Component[%d] Not used. (status)(core = %d, type = %d)\n", + "Component[%d] Not used. " + "(status)(core = %d, type = %d)\n", id, lcore_id, path->type); return -1; } diff --git a/src/vf/spp_port.c b/src/vf/spp_port.c index 3b96df7..9a29f35 100644 --- a/src/vf/spp_port.c +++ b/src/vf/spp_port.c @@ -110,7 +110,8 @@ add_vlantag_packet( new_ether = (struct ether_hdr *)rte_pktmbuf_prepend(pkt, sizeof(struct vlan_hdr)); if (unlikely(new_ether == NULL)) { - RTE_LOG(ERR, PORT, "Failed to get additional header area.\n"); + RTE_LOG(ERR, PORT, "Failed to " + "get additional header area.\n"); return -1; } @@ -137,8 +138,8 @@ add_vlantag_all_packets( ret = add_vlantag_packet(pkts[cnt], data); if (unlikely(ret < 0)) { RTE_LOG(ERR, PORT, - "Failed to add VLAN tag.(pkts %d/%d)\n", - cnt, nb_pkts); + "Failed to add VLAN tag." + "(pkts %d/%d)\n", cnt, nb_pkts); break; } } @@ -161,7 +162,8 @@ del_vlantag_packet( new_ether = (struct ether_hdr *)rte_pktmbuf_adj(pkt, sizeof(struct vlan_hdr)); if (unlikely(new_ether == NULL)) { - RTE_LOG(ERR, PORT, "Failed to delete unnecessary header area.\n"); + RTE_LOG(ERR, PORT, "Failed to " + "delete unnecessary header area.\n"); return -1; } @@ -188,8 +190,8 @@ del_vlantag_all_packets( ret = del_vlantag_packet(pkts[cnt], data); if (unlikely(ret < 0)) { RTE_LOG(ERR, PORT, - "Failed to del VLAN tag.(pkts %d/%d)\n", - cnt, nb_pkts); + "Failed to del VLAN tag." + "(pkts %d/%d)\n", cnt, nb_pkts); break; } } @@ -251,7 +253,8 @@ port_ability_set_ability( { int in_cnt, out_cnt = 0; int port_id = port->dpdk_port; - struct port_ability_port_mng_info *port_mng = &g_port_mng_info[port_id]; + struct port_ability_port_mng_info *port_mng = + &g_port_mng_info[port_id]; struct port_ability_mng_info *mng = NULL; struct spp_port_ability *in_ability = port->ability; struct spp_port_ability *out_ability = NULL; diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c index e493980..96d331e 100644 --- a/src/vf/spp_vf.c +++ b/src/vf/spp_vf.c @@ -75,7 +75,8 @@ struct core_info { volatile enum spp_component_type type; /* Component type */ int num; /* The number of IDs below */ - int id[RTE_MAX_LCORE]; /* ID list of components executed on cpu core */ + int id[RTE_MAX_LCORE]; + /* ID list of components executed on cpu core */ }; /* Manage core status and component information as global variable */ @@ -139,7 +140,8 @@ usage(const char *progname) " -s SERVER_IP:SERVER_PORT" " [--vhost-client]\n" " --client-id CLIENT_ID : My client ID\n" - " -s SERVER_IP:SERVER_PORT : Access information to the server\n" + " -s SERVER_IP:SERVER_PORT :" + " Access information to the server\n" " --vhost-client : Run vhost on client\n" , progname); } @@ -211,8 +213,8 @@ add_vhost_pmd(int index, int client) mp = rte_mempool_lookup(PKTMBUF_POOL_NAME); if (unlikely(mp == NULL)) { - RTE_LOG(ERR, APP, "Cannot get mempool for mbufs. (name = %s)\n", - PKTMBUF_POOL_NAME); + RTE_LOG(ERR, APP, "Cannot get mempool for mbufs. " + "(name = %s)\n", PKTMBUF_POOL_NAME); return -1; } @@ -232,8 +234,8 @@ add_vhost_pmd(int index, int client) ret = rte_eth_dev_configure(vhost_port_id, nr_queues, nr_queues, &port_conf); if (unlikely(ret < 0)) { - RTE_LOG(ERR, APP, "rte_eth_dev_configure error. (ret = %d)\n", - ret); + RTE_LOG(ERR, APP, "rte_eth_dev_configure error. " + "(ret = %d)\n", ret); return ret; } @@ -264,7 +266,8 @@ add_vhost_pmd(int index, int client) /* Start the Ethernet port. */ ret = rte_eth_dev_start(vhost_port_id); if (unlikely(ret < 0)) { - RTE_LOG(ERR, APP, "rte_eth_dev_start error. (ret = %d)\n", ret); + RTE_LOG(ERR, APP, "rte_eth_dev_start error. (ret = %d)\n", + ret); return ret; } @@ -389,7 +392,8 @@ parse_app_server(const char *server_str, char *server_ip, int *server_port) return -1; port = strtol(&server_str[pos+1], &endptr, 0); - if (unlikely(&server_str[pos+1] == endptr) || unlikely(*endptr != '\0')) + if (unlikely(&server_str[pos+1] == endptr) || + unlikely(*endptr != '\0')) return -1; memcpy(server_ip, server_str, pos); @@ -466,7 +470,8 @@ parse_app_args(int argc, char *argv[]) return -1; } RTE_LOG(INFO, APP, - "app opts (client_id=%d,server=%s:%d,vhost_client=%d)\n", + "app opts (client_id=%d,server=%s:%d," + "vhost_client=%d)\n", g_startup_param.client_id, g_startup_param.server_ip, g_startup_param.server_port, @@ -509,11 +514,13 @@ dump_core_info(const struct core_mng_info *core_info) sprintf(str, "core[%d]-0 type=%d, num=%d", lcore_id, info->core[0].type, info->core[0].num); - dump_buff(str, info->core[0].id, sizeof(int)*info->core[0].num); + dump_buff(str, info->core[0].id, + sizeof(int)*info->core[0].num); sprintf(str, "core[%d]-1 type=%d, num=%d", lcore_id, info->core[1].type, info->core[1].num); - dump_buff(str, info->core[1].id, sizeof(int)*info->core[1].num); + dump_buff(str, info->core[1].id, + sizeof(int)*info->core[1].num); } } @@ -529,7 +536,8 @@ dump_component_info(const struct spp_component_info *component_info) if (component->type == SPP_COMPONENT_UNUSE) continue; - RTE_LOG(DEBUG, APP, "component[%d] name=%s, type=%d, core=%u, index=%d\n", + RTE_LOG(DEBUG, APP, "component[%d] name=%s, type=%d, " + "core=%u, index=%d\n", cnt, component->name, component->type, component->lcore_id, component->component_id); @@ -907,7 +915,8 @@ slave_main(void *arg __attribute__ ((unused))) break; } if (unlikely(ret != 0)) { - RTE_LOG(ERR, APP, "Core[%d] Component Error. (id = %d)\n", + RTE_LOG(ERR, APP, "Core[%d] Component Error. " + "(id = %d)\n", lcore_id, core->id[cnt]); break; } @@ -1165,7 +1174,8 @@ spp_update_classifier_table( int64_t ret_mac = 0; uint64_t mac_addr = 0; - RTE_LOG(DEBUG, APP, "update_classifier_table ( type = mac, mac addr = %s, port = %d:%d )\n", + RTE_LOG(DEBUG, APP, "update_classifier_table " + "( type = mac, mac addr = %s, port = %d:%d )\n", mac_addr_str, port->iface_type, port->iface_no); ret_mac = spp_change_mac_str_to_int64(mac_addr_str); @@ -1193,32 +1203,35 @@ spp_update_classifier_table( if ((port_info->class_id.vlantag.vid != 0) && unlikely(port_info->class_id.vlantag.vid != vid)) { - RTE_LOG(ERR, APP, "VLAN ID is different. ( vid = %d )\n", - vid); + RTE_LOG(ERR, APP, "VLAN ID is different. " + "( vid = %d )\n", vid); return SPP_RET_NG; } if ((port_info->class_id.mac_addr != 0) && unlikely(port_info->class_id.mac_addr != mac_addr)) { - RTE_LOG(ERR, APP, "MAC address is different. ( mac = %s )\n", - mac_addr_str); + RTE_LOG(ERR, APP, "MAC address is different. " + "( mac = %s )\n", mac_addr_str); return SPP_RET_NG; } port_info->class_id.vlantag.vid = ETH_VLAN_ID_MAX; port_info->class_id.mac_addr = 0; - memset(port_info->class_id.mac_addr_str, 0x00, SPP_MIN_STR_LEN); + memset(port_info->class_id.mac_addr_str, 0x00, + SPP_MIN_STR_LEN); } else if (action == SPP_CMD_ACTION_ADD) { /* Setting */ if (unlikely(port_info->class_id.vlantag.vid != ETH_VLAN_ID_MAX)) { - RTE_LOG(ERR, APP, "Port in used. ( port = %d:%d, vlan = %d != %d )\n", + RTE_LOG(ERR, APP, "Port in used. " + "( port = %d:%d, vlan = %d != %d )\n", port->iface_type, port->iface_no, port_info->class_id.vlantag.vid, vid); return SPP_RET_NG; } if (unlikely(port_info->class_id.mac_addr != 0)) { - RTE_LOG(ERR, APP, "Port in used. ( port = %d:%d, mac = %s != %s )\n", + RTE_LOG(ERR, APP, "Port in used. " + "( port = %d:%d, mac = %s != %s )\n", port->iface_type, port->iface_no, port_info->class_id.mac_addr_str, mac_addr_str); @@ -1437,8 +1450,8 @@ spp_update_port(enum spp_command_action action, component_id = spp_get_component_id(name); if (component_id < 0) { - RTE_LOG(ERR, APP, "Unknown component by port command. (component = %s)\n", - name); + RTE_LOG(ERR, APP, "Unknown component by port command. " + "(component = %s)\n", name); return SPP_RET_NG; } @@ -1470,7 +1483,8 @@ spp_update_port(enum spp_command_action action, cnt++; } if (cnt >= SPP_PORT_ABILITY_MAX) { - RTE_LOG(ERR, APP, "No space of port ability.\n"); + RTE_LOG(ERR, APP, + "No space of port ability.\n"); return SPP_RET_NG; } memcpy(&port_info->ability[cnt], ability, @@ -1592,7 +1606,8 @@ flush_component(void) ret = spp_forward_update(component_info); if (unlikely(ret < 0)) { - RTE_LOG(ERR, APP, "Flush error. ( component = %s, type = %d)\n", + RTE_LOG(ERR, APP, "Flush error. " + "( component = %s, type = %d)\n", component_info->name, component_info->type); return SPP_RET_NG; @@ -1641,7 +1656,8 @@ spp_iterate_core_info(struct spp_iterate_core_params *params) "", SPP_TYPE_UNUSE_STR, 0, NULL, 0, NULL); if (unlikely(ret != 0)) { - RTE_LOG(ERR, APP, "Cannot iterate core information. " + RTE_LOG(ERR, APP, "Cannot iterate core " + "information. " "(core = %d, type = %d)\n", lcore_id, SPP_COMPONENT_UNUSE); return SPP_RET_NG; @@ -1662,7 +1678,8 @@ spp_iterate_core_info(struct spp_iterate_core_params *params) params); } if (unlikely(ret != 0)) { - RTE_LOG(ERR, APP, "Cannot iterate core information. " + RTE_LOG(ERR, APP, "Cannot iterate core " + "information. " "(core = %d, type = %d)\n", lcore_id, core->type); return SPP_RET_NG; @@ -1712,7 +1729,9 @@ spp_get_dpdk_port(enum port_type iface_type, int iface_no) * For instance, 'ring:0' is separated to 'ring' and '0'. */ int -spp_get_iface_index(const char *port, enum port_type *iface_type, int *iface_no) +spp_get_iface_index(const char *port, + enum port_type *iface_type, + int *iface_no) { enum port_type type = UNDEF; const char *no_str = NULL; @@ -1809,8 +1828,8 @@ spp_change_mac_str_to_int64(const char *mac) /* Check for mal-formatted address */ if (unlikely(token_cnt >= ETHER_ADDR_LEN)) { - RTE_LOG(ERR, APP, "MAC address format error. (mac = %s)\n", - mac); + RTE_LOG(ERR, APP, "MAC address format error. " + "(mac = %s)\n", mac); return -1; } diff --git a/src/vf/spp_vf.h b/src/vf/spp_vf.h index 3491879..8bc5961 100644 --- a/src/vf/spp_vf.h +++ b/src/vf/spp_vf.h @@ -513,7 +513,8 @@ int spp_get_iface_index( * @retval 0 succeeded. * @retval -1 failed. */ -int spp_format_port_string(char *port, enum port_type iface_type, int iface_no); +int +spp_format_port_string(char *port, enum port_type iface_type, int iface_no); /** * Change component type from string to type value. diff --git a/src/vf/string_buffer.c b/src/vf/string_buffer.c index 3e1d9f5..acf0f81 100644 --- a/src/vf/string_buffer.c +++ b/src/vf/string_buffer.c @@ -62,7 +62,8 @@ spp_strbuf_free(char *strbuf) { if (likely(strbuf != NULL)) { RTE_LOG(DEBUG, SPP_STRING_BUFF, - ";free ; addr=%p; size=%lu; str=%s; len=%lu;\n", + ";free ; addr=%p; size=%lu; " + "str=%s; len=%lu;\n", strbuf, strbuf_get_capacity(strbuf), strbuf, strlen(strbuf)); free(strbuf - sizeof(size_t)); -- 2.18.0