* [spp] [PATCH 0/5] Revising logs and comments in shared
@ 2019-06-24 2:23 yasufum.o
2019-06-24 2:23 ` [spp] [PATCH 1/5] shared/sec: revise comments in cmd_utils.h yasufum.o
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: yasufum.o @ 2019-06-24 2:23 UTC (permalink / raw)
To: spp, ferruh.yigit, yasufum.o
From: Yasufumi Ogawa <yasufum.o@gmail.com>
This series of patches is to refactor log messages and comments for
code maintenance.
* Rename functions start with `dump_` used for not dumping messages but
logging.
* Revise ambiguous variables start with `num_` used for "Number of" or
exact number. Former one is renamed as starts with `nof_`.
* Revise terms of funcs and vars which are not correct meaning for
usages.
Yasufumi Ogawa (5):
shared/sec: revise comments in cmd_utils.h
shared/sec: rename funcs start with dump
shared/sec: revise member of struct for interface
shared/sec: rename defines for length of str
shared/sec: add prefix to defines of worker types
src/mirror/spp_mirror.c | 6 +-
.../secondary/spp_worker_th/cmd_parser.c | 4 +-
.../secondary/spp_worker_th/cmd_runner.c | 11 +-
.../secondary/spp_worker_th/cmd_utils.c | 88 ++---
.../secondary/spp_worker_th/cmd_utils.h | 352 +++++++-----------
src/shared/secondary/spp_worker_th/vf_deps.h | 15 +-
src/vf/classifier_mac.c | 18 +-
src/vf/spp_forward.c | 8 +-
8 files changed, 196 insertions(+), 306 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [spp] [PATCH 1/5] shared/sec: revise comments in cmd_utils.h
2019-06-24 2:23 [spp] [PATCH 0/5] Revising logs and comments in shared yasufum.o
@ 2019-06-24 2:23 ` yasufum.o
2019-06-24 2:23 ` [spp] [PATCH 2/5] shared/sec: rename funcs start with dump yasufum.o
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: yasufum.o @ 2019-06-24 2:23 UTC (permalink / raw)
To: spp, ferruh.yigit, yasufum.o
From: Yasufumi Ogawa <yasufum.o@gmail.com>
This patch is to revise comments in `cmd_utils.h` by removing
redundant comments to the file becomes easier to be maintained.
Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
.../secondary/spp_worker_th/cmd_utils.h | 296 ++++++------------
1 file changed, 102 insertions(+), 194 deletions(-)
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h
index 7a31da6..4cecfdd 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.h
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.h
@@ -132,12 +132,9 @@ enum sppwk_port_abl_ops {
enum SPP_LONGOPT_RETVAL {
SPP_LONGOPT_RETVAL__ = 127,
- /*
- * Return value definition for getopt_long()
- * Only for long option
- */
- SPP_LONGOPT_RETVAL_CLIENT_ID, /* --client-id */
- SPP_LONGOPT_RETVAL_VHOST_CLIENT /* --vhost-client */
+ /* Return value definition for getopt_long(). Only for long option. */
+ SPP_LONGOPT_RETVAL_CLIENT_ID, /* For `--client-id` */
+ SPP_LONGOPT_RETVAL_VHOST_CLIENT /* For `--vhost-client` */
};
/* Flag of processing type to copy management information */
@@ -162,23 +159,20 @@ struct spp_vlantag_info {
int tci; /**< Tag Control Information */
};
-/**
- * Data for each port ability which indicates vlantag related information
- * for the port
- */
+/* Ability for vlantag for a port. */
union spp_ability_data {
/** VLAN tag information */
struct spp_vlantag_info vlantag;
};
-/** Port ability information */
+/* Port ability information. */
struct spp_port_ability {
enum sppwk_port_abl_ops ops; /**< Port ability Operations */
enum spp_port_rxtx rxtx; /**< rx/tx identifier */
union spp_ability_data data; /**< Port ability data */
};
-/* Attributes for classifying . */
+/* Attributes for classifying. */
struct sppwk_cls_attrs {
uint64_t mac_addr; /**< Mac address (binary) */
char mac_addr_str[SPP_MIN_STR_LEN]; /**< Mac address (text) */
@@ -217,67 +211,49 @@ struct sppwk_comp_info {
/* Manage given options as global variable */
struct startup_param {
- int client_id; /* Client ID */
- char server_ip[INET_ADDRSTRLEN];
- /* IP address stiring of spp-ctl */
- int server_port; /* Port Number of spp-ctl */
- int vhost_client; /* Flag for --vhost-client option */
+ int client_id; /* Client ID */
+ char server_ip[INET_ADDRSTRLEN]; /* IP address of spp-ctl */
+ int server_port; /* Port Number of spp-ctl */
+ int vhost_client; /* Flag for --vhost-client option */
enum secondary_type secondary_type;
- /* secondary type */
};
-/* Manage number of interfaces and port information as global variable */
+/* Manage number of interfaces and port information as global variable. */
struct iface_info {
- int num_nic; /* The number of phy */
- int num_vhost; /* The number of vhost */
- int num_ring; /* The number of ring */
+ int num_nic; /* The number of phy */
+ int num_vhost; /* The number of vhost */
+ int num_ring; /* The number of ring */
struct sppwk_port_info nic[RTE_MAX_ETHPORTS];
- /* Port information of phy */
struct sppwk_port_info vhost[RTE_MAX_ETHPORTS];
- /* Port information of vhost */
struct sppwk_port_info ring[RTE_MAX_ETHPORTS];
- /* Port information of ring */
};
-/* Manage component running in core as global variable */
+/* Manage component running in core as global variable. */
struct core_info {
- int num; /* The number of IDs below */
- int id[RTE_MAX_LCORE]; /* ID list of components executed on cpu core */
+ int num; /* Number of IDs below */
+ int id[RTE_MAX_LCORE]; /* IDs of components run on the lcore. */
};
-/* Manage core status and component information as global variable */
+/* Manage core status and component info as global variable. */
struct core_mng_info {
- /* Status of cpu core */
volatile enum sppwk_lcore_status status;
-
- /* Index number of core information for reference */
- volatile int ref_index;
-
- /* Index number of core information for updating */
- volatile int upd_index;
-
- /* Core information of each cpu core */
- struct core_info core[SPP_INFO_AREA_MAX];
+ volatile int ref_index; /* index for reference */
+ volatile int upd_index; /* index for update */
+ struct core_info core[SPP_INFO_AREA_MAX]; /* info of each core */
};
-/* Manage data to be backup */
+/* Manage data used for backup. */
struct cancel_backup_info {
- /* Backup data of core information */
struct core_mng_info core[RTE_MAX_LCORE];
-
- /* Backup data of component information */
struct sppwk_comp_info component[RTE_MAX_LCORE];
-
- /* Backup data of interface information */
struct iface_info interface;
};
+/* TODO(yasufum) revise using term `iterate`, or comments. */
struct spp_iterate_core_params;
/**
- * definition of iterated core element procedure function
- * which is member of spp_iterate_core_params structure.
- * Above structure is used when listing core information
- * (e.g) create resonse to status command.
+ * Define func to iterate lcore to list core information for showing status
+ * or so, as a member of struct `spp_iterate_core_params`.
*/
typedef int (*spp_iterate_core_element_proc)(
struct spp_iterate_core_params *params,
@@ -290,24 +266,19 @@ typedef int (*spp_iterate_core_element_proc)(
const struct sppwk_port_idx *tx_ports);
/**
- * iterate core table parameters which is
- * used when listing core table content
- * (e.g.) create response to status command.
+ * iterate core table parameters used to list content of lcore table for.
+ * showing status or so.
*/
struct spp_iterate_core_params {
- /** Output buffer */
- char *output;
-
+ char *output; /* Buffer used for output */
/** The function for creating core information */
spp_iterate_core_element_proc element_proc;
};
struct spp_iterate_classifier_table_params;
/**
- * definition of iterated classifier element procedure function
- * which is member of spp_iterate_classifier_table_params structure.
- * Above structure is used when listing classifier table information
- * (e.g) create resonse to status command.
+ * Define func to iterate classifier for showing status or so, as a member
+ * member of struct `spp_iterate_classifier_table_params`.
*/
typedef int (*spp_iterate_classifier_element_proc)(
struct spp_iterate_classifier_table_params *params,
@@ -316,14 +287,11 @@ typedef int (*spp_iterate_classifier_element_proc)(
const struct sppwk_port_idx *port);
/**
- * iterate classifier table parameters which is
- * used when listing classifier table content
- * (e.g.) create response to status command.
+ * iterate classifier table parameters which is used when listing classifier
+ * table content for status command or so.
*/
struct spp_iterate_classifier_table_params {
- /* Output buffer */
- void *output;
-
+ void *output; /* Buffer used for output */
/* The function for creating classifier table information */
spp_iterate_classifier_element_proc element_proc;
};
@@ -331,100 +299,76 @@ struct spp_iterate_classifier_table_params {
/**
* Make a hexdump of an array data in every 4 byte
*
- * @param name
- * dump name.
- * @param addr
- * dump address.
- * @param size
- * dump byte size.
- *
+ * @param name Dumped name.
+ * @param addr Dumped address.
+ * @param size Dumped byte size.
*/
void dump_buff(const char *name, const void *addr, const size_t size);
/**
- * added ring_pmd
+ * Add ring pmd for owned proccess or thread.
*
- * @param ring_id
- * added ring id.
- *
- * @retval 0~ ring_port_id.
- * @retval -1 failed.
+ * @param[in] ring_id added ring id.
+ * @return ring port ID, or -1 if failed.
*/
int spp_vf_add_ring_pmd(int ring_id);
/**
- * added vhost_pmd
- *
- * @param index
- * add vohst id.
- * @param client
- * add client id.
+ * Add ring pmd for owned proccess or thread.
*
- * @retval 0~ vhost_port_id.
- * @retval -1 failed.
+ * @param[in] index Vohst port id.
+ * @param[in] client Client id.
+ * @return Vhost port ID, or -1 if failed.
*/
int spp_vf_add_vhost_pmd(int index, int client);
/**
* Get core status
*
- * @param lcore_id
- * Logical core ID.
- *
- * @return
- * Status of specified logical core.
+ * @param[in] lcore_id Logical core ID.
+ * @return Status of specified logical core.
*/
enum sppwk_lcore_status spp_get_core_status(unsigned int lcore_id);
/**
* Get component type of target component_info
*
- * @param id
- * component ID.
- *
- * @return
- * Type of component executed
+ * @param id Component ID.
+ * @return Type of component executed
*/
enum sppwk_worker_type spp_get_component_type(int id);
+/* TODO(yasufum) revise the name of func. */
/**
- * Run check_core_status() for SPP_CORE_STATUS_CHECK_MAX times with
- * interval time (1sec)
- *
- * @param status
- * wait check status.
+ * Run check_core_status() several times with interval, up to
+ * SPP_CORE_STATUS_CHECK_MAX times.
*
- * @retval 0 succeeded.
- * @retval -1 failed.
+ * @param[in] status Status for checking.
+ * @retval 0 If succeeded.
+ * @retval -1 If failed.
*/
int check_core_status_wait(enum sppwk_lcore_status status);
/**
* Set core status
*
- * @param lcore_id
- * Logical core ID.
- * @param status
- * set status.
+ * @param lcore_id Lcore ID.
+ * @param status Status to be set.
*
*/
void set_core_status(unsigned int lcore_id, enum sppwk_lcore_status status);
/**
- * Set all core status to given
- *
- * @param status
- * set status.
+ * Set all core status to given one.
*
+ * @param status status to be set.
*/
void set_all_core_status(enum sppwk_lcore_status status);
/**
- * Set all of component status to SPP_CORE_STOP_REQUEST if received signal
- * is SIGTERM or SIGINT
+ * Set all comp status to SPP_CORE_STOP_REQUEST if received SIGTERM or SIGINT.
*
- * @param signl
- * received signal.
+ * @param[in] signal Received signal.
*/
void stop_process(int signal);
@@ -460,15 +404,11 @@ void copy_mng_info(
/* Backup the management information */
void backup_mng_info(struct cancel_backup_info *backup);
-/**
- * Setup management info for spp_vf
- */
+/* Setup management info for spp_vf */
int init_mng_data(void);
#ifdef SPP_RINGLATENCYSTATS_ENABLE
-/**
- * Print statistics of time for packet processing in ring interface
- */
+/* Print statistics of time for packet processing in ring interface */
void print_ring_latency_stats(void);
#endif /* SPP_RINGLATENCYSTATS_ENABLE */
@@ -478,11 +418,8 @@ void del_vhost_sockfile(struct sppwk_port_info *vhost);
/**
* Get core ID of target component
*
- * @param component_id
- * unique component ID.
- *
- * @return
- * Logical core id of specified component.
+ * @param component_id Unique component ID.
+ * @return Logical core id of specified component.
*/
unsigned int spp_get_component_core(int component_id);
@@ -492,27 +429,20 @@ struct core_info *get_core_info(unsigned int lcore_id);
/**
* Check core index change
*
- * @param lcore_id
- * Logical core ID.
- *
- * True if index has changed.
- * @retval SPP_RET_OK index has changed.
- * @retval SPP_RET_NG index not changed.
+ * @param lcore_id Lcore ID.
+ * @retval SPP_RET_OK If index is updated.
+ * @retval SPP_RET_NG If index is not updated.
*/
int spp_check_core_update(unsigned int lcore_id);
/**
* Check if component is using port.
*
- * @param iface_type
- * Interface type to be validated.
- * @param iface_no
- * Interface number to be validated.
- * @param rxtx
- * tx/rx type to be validated.
- *
- * @retval 0~127 match component ID
- * @retval SPP_RET_NG failed.
+ * @param iface_type Interface type to be validated.
+ * @param iface_no Interface number to be validated.
+ * @param rxtx Value of spp_port_rxtx to be validated.
+ * @retval 0~127 If match component ID
+ * @retval SPP_RET_NG If failed.
*/
int spp_check_used_port(
enum port_type iface_type,
@@ -605,60 +535,45 @@ void update_lcore_info(void);
/**
* Activate temporarily stored component info while flushing.
*
- * @retval SPP_RET_OK if succeeded.
- * @retval SPP_RET_NG if failed.
+ * @retval SPP_RET_OK If succeeded.
+ * @retval SPP_RET_NG If failed.
*/
int update_comp_info(void);
/**
- * Port type to string
- *
- * @param port
- * Character string of Port type to be converted.
- * @param iface_type
- * port interface type
- * @param iface_no
- * interface no
+ * Port type to string.
*
- * @retval SPP_RET_OK succeeded.
- * @retval SPP_RET_NG failed.
+ * @param port String of port type to be converted.
+ * @param iface_type Interface type.
+ * @param iface_no Interface number.
+ * @retval SPP_RET_OK If succeeded.
+ * @retval SPP_RET_NG If failed.
*/
int
spp_format_port_string(char *port, enum port_type iface_type, int iface_no);
/**
- * Change mac address string to int64
+ * Change string of MAC address to int64.
*
- * @param mac
- * Character string of MAC address to be converted.
- *
- * @retval 0< int64 that store mac address
- * @retval SPP_RET_NG
+ * @param macaddr String of MAC address to be converted.
+ * @retval 0~N MAC address in int64 format.
+ * @retval SPP_RET_NG if invalid.
*/
int64_t sppwk_convert_mac_str_to_int64(const char *macaddr);
/**
- * Set mange data address
- *
- * @param startup_param_p
- * g_startup_param address
- * @param iface_p
- * g_iface_info address
- * @param component_p
- * g_component_info address
- * @param core_mng_p
- * g_core_info address
- * @param change_core_p
- * g_change_core address
- * @param change_component_p
- * g_change_component address
- * @param backup_info_p
- * g_backup_info address
- * @param main_lcore_id
- * main_lcore_id mask
+ * Set mange data address.
*
- * @retval SPP_RET_OK succeeded.
- * @retval SPP_RET_NG failed.
+ * @param startup_param_p Pointer to g_startup_param address.
+ * @param iface_p Pointer to g_iface_info address.
+ * @param component_p Pointer to g_component_info address.
+ * @param core_mng_p Pointer to g_core_info address.
+ * @param change_core_p Pointer to g_change_core address.
+ * @param change_component_p Pointer to g_change_component address.
+ * @param backup_info_p Pointer to g_backup_info address.
+ * @param main_lcore_id Lcore ID of main thread.
+ * @retval SPP_RET_OK If succeeded.
+ * @retval SPP_RET_NG If failed.
*/
int sppwk_set_mng_data(struct startup_param *startup_param_p,
struct iface_info *iface_p,
@@ -670,22 +585,15 @@ int sppwk_set_mng_data(struct startup_param *startup_param_p,
unsigned int main_lcore_id);
/**
- * Get mange data address
+ * Get mange data address.
*
- * @param startup_param_p
- * g_startup_param write address
- * @param iface_addr
- * g_iface_info write address
- * @param component_addr
- * g_component_info write address
- * @param core_mng_addr
- * g_core_mng_info write address
- * @param change_core_addr
- * g_change_core write address
- * @param change_component_addr
- * g_change_component write address
- * @param backup_info_addr
- * g_backup_info write address
+ * @param startup_param_p Pointer to startup params.
+ * @param iface_addr Pointer to g_iface_info.
+ * @param component_addr Pointer to g_component_info.
+ * @param core_mng_addr Pointer to g_core_mng_info.
+ * @param change_core_addr Pointer to change_core_addr.
+ * @param change_component_addr Pointer to g_change_component.
+ * @param backup_info_addr Pointer to g_backup_info.
*/
void sppwk_get_mng_data(struct startup_param **startup_param_p,
struct iface_info **iface_p,
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [spp] [PATCH 2/5] shared/sec: rename funcs start with dump
2019-06-24 2:23 [spp] [PATCH 0/5] Revising logs and comments in shared yasufum.o
2019-06-24 2:23 ` [spp] [PATCH 1/5] shared/sec: revise comments in cmd_utils.h yasufum.o
@ 2019-06-24 2:23 ` yasufum.o
2019-06-24 2:23 ` [spp] [PATCH 3/5] shared/sec: revise member of struct for interface yasufum.o
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: yasufum.o @ 2019-06-24 2:23 UTC (permalink / raw)
To: spp, ferruh.yigit, yasufum.o
From: Yasufumi Ogawa <yasufum.o@gmail.com>
Functions have prefix `dump_` do DEBUG logging actually, so the term
of prefix is vague and not describing the feature exactly. This update
is to change the prefix to `log_` to be explicitly doing just logging.
Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
.../secondary/spp_worker_th/cmd_utils.c | 66 +++++++++----------
.../secondary/spp_worker_th/cmd_utils.h | 27 ++++----
2 files changed, 44 insertions(+), 49 deletions(-)
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.c b/src/shared/secondary/spp_worker_th/cmd_utils.c
index 07d6a2a..7f0a1ce 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.c
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.c
@@ -34,38 +34,30 @@ struct mng_data_info {
unsigned int main_lcore_id;
};
-/* Declare global variables */
/* Logical core ID for main process */
static struct mng_data_info g_mng_data;
-/**
- * Make a hexdump of an array data in every 4 byte.
- * This function is used to dump core_info or component info.
- */
+/* Hexdump `addr` for logging, used for core_info or component info. */
void
-dump_buff(const char *name, const void *addr, const size_t size)
+log_hexdumped(const char *obj_name, const void *obj_addr, const size_t size)
{
- size_t cnt = 0;
- size_t max = (size / sizeof(unsigned int)) +
+ size_t cnt;
+ size_t max_cnt = (size / sizeof(unsigned int)) +
((size % sizeof(unsigned int)) != 0);
- const uint32_t *buff = addr;
+ const uint32_t *buf = obj_addr;
- if ((name != NULL) && (name[0] != '\0'))
- RTE_LOG(DEBUG, APP, "dump buff. (%s)\n", name);
+ if ((obj_name != NULL) && (obj_name[0] != '\0'))
+ RTE_LOG(DEBUG, APP, "Name of dumped buf: %s.\n", obj_name);
- for (cnt = 0; cnt < max; cnt += 16) {
+ for (cnt = 0; cnt < max_cnt; cnt += 16) {
RTE_LOG(DEBUG, APP, "[%p]"
- " %08x %08x %08x %08x %08x %08x %08x %08x"
- " %08x %08x %08x %08x %08x %08x %08x %08x",
- &buff[cnt],
- buff[cnt+0], buff[cnt+1],
- buff[cnt+2], buff[cnt+3],
- buff[cnt+4], buff[cnt+5],
- buff[cnt+6], buff[cnt+7],
- buff[cnt+8], buff[cnt+9],
- buff[cnt+10], buff[cnt+11],
- buff[cnt+12], buff[cnt+13],
- buff[cnt+14], buff[cnt+15]);
+ " %08x %08x %08x %08x %08x %08x %08x %08x"
+ " %08x %08x %08x %08x %08x %08x %08x %08x",
+ &buf[cnt],
+ buf[cnt+0], buf[cnt+1], buf[cnt+2], buf[cnt+3],
+ buf[cnt+4], buf[cnt+5], buf[cnt+6], buf[cnt+7],
+ buf[cnt+8], buf[cnt+9], buf[cnt+10], buf[cnt+11],
+ buf[cnt+12], buf[cnt+13], buf[cnt+14], buf[cnt+15]);
}
}
@@ -288,7 +280,7 @@ get_sppwk_port(enum port_type iface_type, int iface_no)
/* Dump of core information */
void
-dump_core_info(const struct core_mng_info *core_info)
+log_core_info(const struct core_mng_info *core_info)
{
char str[SPP_NAME_STR_LEN];
const struct core_mng_info *info = NULL;
@@ -300,16 +292,18 @@ dump_core_info(const struct core_mng_info *core_info)
info->ref_index, info->upd_index);
memset(str, 0x00, SPP_NAME_STR_LEN);
- dump_buff(str, info->core[0].id, sizeof(int)*info->core[0].num);
+ log_hexdumped(str, info->core[0].id,
+ sizeof(int)*info->core[0].num);
sprintf(str, "core[%d]-1 num=%d", lcore_id, info->core[1].num);
- dump_buff(str, info->core[1].id, sizeof(int)*info->core[1].num);
+ log_hexdumped(str, info->core[1].id,
+ sizeof(int)*info->core[1].num);
}
}
/* Dump of component information */
void
-dump_component_info(const struct sppwk_comp_info *comp_info)
+log_component_info(const struct sppwk_comp_info *comp_info)
{
char str[SPP_NAME_STR_LEN];
const struct sppwk_comp_info *tmp_ci = NULL;
@@ -326,19 +320,19 @@ dump_component_info(const struct sppwk_comp_info *comp_info)
sprintf(str, "component[%d] rx=%d", cnt,
tmp_ci->nof_rx);
- dump_buff(str, tmp_ci->rx_ports,
+ log_hexdumped(str, tmp_ci->rx_ports,
sizeof(struct sppwk_port_info *)*tmp_ci->nof_rx);
sprintf(str, "component[%d] tx=%d", cnt,
tmp_ci->nof_tx);
- dump_buff(str, tmp_ci->tx_ports,
+ log_hexdumped(str, tmp_ci->tx_ports,
sizeof(struct sppwk_port_info *)*tmp_ci->nof_tx);
}
}
/* Dump of interface information */
void
-dump_interface_info(const struct iface_info *iface_info)
+log_interface_info(const struct iface_info *iface_info)
{
const struct sppwk_port_info *port = NULL;
int cnt = 0;
@@ -389,7 +383,7 @@ dump_interface_info(const struct iface_info *iface_info)
/* Dump of all management information */
void
-dump_all_mng_info(
+log_all_mng_info(
const struct core_mng_info *core,
const struct sppwk_comp_info *component,
const struct iface_info *interface)
@@ -397,9 +391,9 @@ dump_all_mng_info(
if (rte_log_get_global_level() < RTE_LOG_DEBUG)
return;
- dump_core_info(core);
- dump_component_info(component);
- dump_interface_info(interface);
+ log_core_info(core);
+ log_component_info(component);
+ log_interface_info(interface);
}
/* Copy management information */
@@ -446,7 +440,7 @@ copy_mng_info(
void
backup_mng_info(struct cancel_backup_info *backup)
{
- dump_all_mng_info(g_mng_data.p_core_info,
+ log_all_mng_info(g_mng_data.p_core_info,
g_mng_data.p_component_info,
g_mng_data.p_iface_info);
copy_mng_info(backup->core, backup->component, &backup->interface,
@@ -454,7 +448,7 @@ backup_mng_info(struct cancel_backup_info *backup)
g_mng_data.p_component_info,
g_mng_data.p_iface_info,
COPY_MNG_FLG_ALLCOPY);
- dump_all_mng_info(backup->core, backup->component, &backup->interface);
+ log_all_mng_info(backup->core, backup->component, &backup->interface);
memset(g_mng_data.p_change_core, 0x00,
sizeof(int)*RTE_MAX_LCORE);
memset(g_mng_data.p_change_component, 0x00,
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h
index 4cecfdd..65a66b8 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.h
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.h
@@ -297,13 +297,14 @@ struct spp_iterate_classifier_table_params {
};
/**
- * Make a hexdump of an array data in every 4 byte
+ * Hexdump `addr` for logging, used for core_info or component info.
*
- * @param name Dumped name.
- * @param addr Dumped address.
- * @param size Dumped byte size.
+ * @param name Name of object to be dumped.
+ * @param addr Address of dumped value.
+ * @param size Size of dumped value.
*/
-void dump_buff(const char *name, const void *addr, const size_t size);
+void log_hexdumped(const char *obj_name, const void *obj_addr,
+ const size_t size);
/**
* Add ring pmd for owned proccess or thread.
@@ -376,17 +377,17 @@ void stop_process(int signal);
struct sppwk_port_info *
get_sppwk_port(enum port_type iface_type, int iface_no);
-/* Dump of core information */
-void dump_core_info(const struct core_mng_info *core_info);
+/* Output log message for core information */
+void log_core_info(const struct core_mng_info *core_info);
-/* Dump of component information */
-void dump_component_info(const struct sppwk_comp_info *component_info);
+/* Output log message for component information */
+void log_component_info(const struct sppwk_comp_info *component_info);
-/* Dump of interface information */
-void dump_interface_info(const struct iface_info *iface_info);
+/* Output log message for interface information */
+void log_interface_info(const struct iface_info *iface_info);
-/* Dump of all management information */
-void dump_all_mng_info(
+/* Output log message for all management information */
+void log_all_mng_info(
const struct core_mng_info *core,
const struct sppwk_comp_info *component,
const struct iface_info *interface);
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [spp] [PATCH 3/5] shared/sec: revise member of struct for interface
2019-06-24 2:23 [spp] [PATCH 0/5] Revising logs and comments in shared yasufum.o
2019-06-24 2:23 ` [spp] [PATCH 1/5] shared/sec: revise comments in cmd_utils.h yasufum.o
2019-06-24 2:23 ` [spp] [PATCH 2/5] shared/sec: rename funcs start with dump yasufum.o
@ 2019-06-24 2:23 ` yasufum.o
2019-06-24 2:23 ` [spp] [PATCH 4/5] shared/sec: rename defines for length of str yasufum.o
2019-06-24 2:23 ` [spp] [PATCH 5/5] shared/sec: add prefix to defines of worker types yasufum.o
4 siblings, 0 replies; 6+ messages in thread
From: yasufum.o @ 2019-06-24 2:23 UTC (permalink / raw)
To: spp, ferruh.yigit, yasufum.o
From: Yasufumi Ogawa <yasufum.o@gmail.com>
This update is to revise names of structs for describing features of
interface, for example, change `num_nic` to `nof_phys` to become
explixitly that it is not a number in a range of phy NICs but the total
number itself.
Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
src/shared/secondary/spp_worker_th/cmd_utils.c | 14 +++++++-------
src/shared/secondary/spp_worker_th/cmd_utils.h | 14 +++++++-------
src/vf/classifier_mac.c | 10 +++++-----
3 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.c b/src/shared/secondary/spp_worker_th/cmd_utils.c
index 7f0a1ce..c519624 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.c
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.c
@@ -337,9 +337,9 @@ 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->num_nic,
- iface_info->num_vhost,
- iface_info->num_ring);
+ iface_info->nof_phys,
+ iface_info->nof_vhosts,
+ iface_info->nof_rings);
for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
port = &iface_info->nic[cnt];
if (port->iface_type == UNDEF)
@@ -522,11 +522,11 @@ set_nic_interface(void)
struct iface_info *p_iface_info = g_mng_data.p_iface_info;
/* NIC Setting */
- p_iface_info->num_nic = rte_eth_dev_count_avail();
- if (p_iface_info->num_nic > RTE_MAX_ETHPORTS)
- p_iface_info->num_nic = RTE_MAX_ETHPORTS;
+ p_iface_info->nof_phys = rte_eth_dev_count_avail();
+ if (p_iface_info->nof_phys > RTE_MAX_ETHPORTS)
+ p_iface_info->nof_phys = RTE_MAX_ETHPORTS;
- for (nic_cnt = 0; nic_cnt < p_iface_info->num_nic; nic_cnt++) {
+ for (nic_cnt = 0; nic_cnt < p_iface_info->nof_phys; nic_cnt++) {
p_iface_info->nic[nic_cnt].iface_type = PHY;
p_iface_info->nic[nic_cnt].ethdev_port_id = nic_cnt;
}
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h
index 65a66b8..b6c2542 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.h
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.h
@@ -220,9 +220,9 @@ struct startup_param {
/* Manage number of interfaces and port information as global variable. */
struct iface_info {
- int num_nic; /* The number of phy */
- int num_vhost; /* The number of vhost */
- int num_ring; /* The number of ring */
+ 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 nic[RTE_MAX_ETHPORTS];
struct sppwk_port_info vhost[RTE_MAX_ETHPORTS];
struct sppwk_port_info ring[RTE_MAX_ETHPORTS];
@@ -258,11 +258,11 @@ struct spp_iterate_core_params;
typedef int (*spp_iterate_core_element_proc)(
struct spp_iterate_core_params *params,
const unsigned int lcore_id,
- const char *name,
- const char *type,
- const int num_rx,
+ const char *wk_name, /* Name of worker named as component. */
+ const char *wk_type, /* Type of worker named as component. */
+ const int nof_rx, /* Number of RX ports */
const struct sppwk_port_idx *rx_ports,
- const int num_tx,
+ const int nof_tx, /* Number of TX ports */
const struct sppwk_port_idx *tx_ports);
/**
diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index c8cc7df..b5260b0 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -812,7 +812,7 @@ spp_classifier_get_component_status(
struct spp_iterate_core_params *params)
{
int ret = SPP_RET_NG;
- int i, num_tx, num_rx = 0;
+ int i, nof_tx, nof_rx = 0; /* Num of RX and TX ports. */
struct management_info *mng_info;
struct component_info *cmp_info;
struct classified_data *clsd_data;
@@ -833,7 +833,7 @@ spp_classifier_get_component_status(
memset(rx_ports, 0x00, sizeof(rx_ports));
if (cmp_info->classified_data_rx.iface_type != UNDEF) {
- num_rx = 1;
+ nof_rx = 1;
rx_ports[0].iface_type = cmp_info->
classified_data_rx.iface_type;
rx_ports[0].iface_no = cmp_info->
@@ -841,8 +841,8 @@ spp_classifier_get_component_status(
}
memset(tx_ports, 0x00, sizeof(tx_ports));
- num_tx = cmp_info->n_classified_data_tx;
- for (i = 0; i < num_tx; i++) {
+ nof_tx = cmp_info->n_classified_data_tx;
+ 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;
}
@@ -851,7 +851,7 @@ spp_classifier_get_component_status(
ret = (*params->element_proc)(
params, lcore_id,
cmp_info->name, SPP_TYPE_CLASSIFIER_MAC_STR,
- num_rx, rx_ports, num_tx, tx_ports);
+ nof_rx, rx_ports, nof_tx, tx_ports);
if (unlikely(ret != SPP_RET_OK))
return SPP_RET_NG;
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [spp] [PATCH 4/5] shared/sec: rename defines for length of str
2019-06-24 2:23 [spp] [PATCH 0/5] Revising logs and comments in shared yasufum.o
` (2 preceding siblings ...)
2019-06-24 2:23 ` [spp] [PATCH 3/5] shared/sec: revise member of struct for interface yasufum.o
@ 2019-06-24 2:23 ` yasufum.o
2019-06-24 2:23 ` [spp] [PATCH 5/5] shared/sec: add prefix to defines of worker types yasufum.o
4 siblings, 0 replies; 6+ messages in thread
From: yasufum.o @ 2019-06-24 2:23 UTC (permalink / raw)
To: spp, ferruh.yigit, yasufum.o
From: Yasufumi Ogawa <yasufum.o@gmail.com>
This update is to rename `SPP_MIN_STR_LEN` to `STR_LEN_SHORT` because it
is used not for the minimum length but for just comparably short length
of strings. It also renames `SPP_NAME_STR_LEN` to `STR_LEN_NAME` used
for size of names of component or interfaces.
Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
src/mirror/spp_mirror.c | 4 ++--
src/shared/secondary/spp_worker_th/cmd_runner.c | 7 +++----
src/shared/secondary/spp_worker_th/cmd_utils.c | 8 ++++----
src/shared/secondary/spp_worker_th/cmd_utils.h | 17 ++++++-----------
src/shared/secondary/spp_worker_th/vf_deps.h | 15 ++++-----------
src/vf/classifier_mac.c | 6 +++---
src/vf/spp_forward.c | 4 ++--
7 files changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/mirror/spp_mirror.c b/src/mirror/spp_mirror.c
index d5abf7b..b68eccc 100644
--- a/src/mirror/spp_mirror.c
+++ b/src/mirror/spp_mirror.c
@@ -35,7 +35,7 @@ struct mirror_rxtx {
/* Information on the path used for mirror. */
struct mirror_path {
- char name[SPP_NAME_STR_LEN]; /* component name */
+ char name[STR_LEN_NAME]; /* component name */
volatile enum sppwk_worker_type wk_type;
int nof_rx; /* number of receive ports */
int nof_tx; /* number of mirror ports */
@@ -310,7 +310,7 @@ spp_mirror_update(struct sppwk_comp_info *component)
component->name,
component->wk_type);
- memcpy(&path->name, component->name, SPP_NAME_STR_LEN);
+ memcpy(&path->name, component->name, STR_LEN_NAME);
path->wk_type = component->wk_type;
path->nof_rx = component->nof_rx;
path->nof_tx = component->nof_tx;
diff --git a/src/shared/secondary/spp_worker_th/cmd_runner.c b/src/shared/secondary/spp_worker_th/cmd_runner.c
index 1d1ec49..9235857 100644
--- a/src/shared/secondary/spp_worker_th/cmd_runner.c
+++ b/src/shared/secondary/spp_worker_th/cmd_runner.c
@@ -174,8 +174,7 @@ update_cls_table(enum sppwk_action wk_action,
/* Initialize deleted attributes again. */
port_info->cls_attrs.vlantag.vid = ETH_VLAN_ID_MAX;
port_info->cls_attrs.mac_addr = 0;
- memset(port_info->cls_attrs.mac_addr_str, 0x00,
- SPP_MIN_STR_LEN);
+ memset(port_info->cls_attrs.mac_addr_str, 0x00, STR_LEN_SHORT);
} else if (wk_action == SPPWK_ACT_ADD) {
if (unlikely(port_info->cls_attrs.vlantag.vid !=
ETH_VLAN_ID_MAX)) {
@@ -1236,7 +1235,7 @@ append_classifier_element_value(
int ret = SPP_RET_NG;
char *buff, *tmp_buff;
char port_str[CMD_TAG_APPEND_SIZE];
- char value_str[SPP_MIN_STR_LEN];
+ char value_str[STR_LEN_SHORT];
buff = params->output;
tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
if (unlikely(tmp_buff == NULL)) {
@@ -1253,7 +1252,7 @@ append_classifier_element_value(
if (unlikely(ret < SPP_RET_OK))
return ret;
- memset(value_str, 0x00, SPP_MIN_STR_LEN);
+ memset(value_str, 0x00, STR_LEN_SHORT);
switch (type) {
case SPP_CLASSIFIER_TYPE_MAC:
sprintf(value_str, "%s", mac);
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.c b/src/shared/secondary/spp_worker_th/cmd_utils.c
index c519624..ae6be1a 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.c
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.c
@@ -282,7 +282,7 @@ get_sppwk_port(enum port_type iface_type, int iface_no)
void
log_core_info(const struct core_mng_info *core_info)
{
- char str[SPP_NAME_STR_LEN];
+ char str[STR_LEN_NAME];
const struct core_mng_info *info = NULL;
unsigned int lcore_id = 0;
RTE_LCORE_FOREACH_SLAVE(lcore_id) {
@@ -291,7 +291,7 @@ log_core_info(const struct core_mng_info *core_info)
lcore_id, info->status,
info->ref_index, info->upd_index);
- memset(str, 0x00, SPP_NAME_STR_LEN);
+ memset(str, 0x00, STR_LEN_NAME);
log_hexdumped(str, info->core[0].id,
sizeof(int)*info->core[0].num);
@@ -305,7 +305,7 @@ log_core_info(const struct core_mng_info *core_info)
void
log_component_info(const struct sppwk_comp_info *comp_info)
{
- char str[SPP_NAME_STR_LEN];
+ char str[STR_LEN_NAME];
const struct sppwk_comp_info *tmp_ci = NULL;
int cnt = 0;
for (cnt = 0; cnt < RTE_MAX_LCORE; cnt++) {
@@ -945,7 +945,7 @@ sppwk_convert_mac_str_to_int64(const char *macaddr)
int64_t ret_mac = 0;
int64_t token_val = 0;
int token_cnt = 0;
- char tmp_mac[SPP_MIN_STR_LEN];
+ char tmp_mac[STR_LEN_SHORT];
char *str = tmp_mac;
char *saveptr = NULL;
char *endptr = NULL;
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h
index b6c2542..ed46370 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.h
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.h
@@ -33,17 +33,12 @@
/** Update wait timer (micro sec) */
#define SPP_CHANGE_UPDATE_INTERVAL 10
-/** The max number of buffer for management */
-#define SPP_INFO_AREA_MAX 2
+#define SPP_INFO_AREA_MAX 2 /* The max number of buffer for management */
-/** The length of shortest character string */
-#define SPP_MIN_STR_LEN 32
+#define STR_LEN_SHORT 32 /* Size of short string. */
+#define STR_LEN_NAME 128 /* Size of string for names. */
-/** The length of NAME string */
-#define SPP_NAME_STR_LEN 128
-
-/** Maximum number of port abilities available */
-#define SPP_PORT_ABILITY_MAX 4
+#define SPP_PORT_ABILITY_MAX 4 /* Max num of port abilities. */
/** Number of VLAN ID */
#define SPP_NUM_VLAN_VID 4096
@@ -175,7 +170,7 @@ struct spp_port_ability {
/* Attributes for classifying. */
struct sppwk_cls_attrs {
uint64_t mac_addr; /**< Mac address (binary) */
- char mac_addr_str[SPP_MIN_STR_LEN]; /**< Mac address (text) */
+ char mac_addr_str[STR_LEN_SHORT]; /**< Mac address (text) */
struct spp_vlantag_info vlantag; /**< VLAN tag information */
};
@@ -199,7 +194,7 @@ struct sppwk_port_info {
/* Attributes of SPP worker thread named as `component`. */
struct sppwk_comp_info {
- char name[SPP_NAME_STR_LEN]; /**< Component name */
+ char name[STR_LEN_NAME]; /**< Component name */
enum sppwk_worker_type wk_type; /**< Type of worker thread */
unsigned int lcore_id;
int comp_id; /**< Component ID */
diff --git a/src/shared/secondary/spp_worker_th/vf_deps.h b/src/shared/secondary/spp_worker_th/vf_deps.h
index 6d857d2..fe03490 100644
--- a/src/shared/secondary/spp_worker_th/vf_deps.h
+++ b/src/shared/secondary/spp_worker_th/vf_deps.h
@@ -50,21 +50,14 @@ struct classified_data {
/* classifier component information */
struct component_info {
- /* component name */
- char name[SPP_NAME_STR_LEN];
-
- /* mac address entry flag */
- int mac_addr_entry;
+ char name[STR_LEN_NAME]; /* component name */
+ int mac_addr_entry; /* mac address entry flag */
/* mac address classification per vlan-id */
struct mac_classification *mac_classifications[SPP_NUM_VLAN_VID];
- /* number of transmission ports */
- int n_classified_data_tx;
-
- /* receive port handled by classifier */
- struct classified_data classified_data_rx;
-
+ int n_classified_data_tx; /* number of transmission ports */
+ struct classified_data classified_data_rx; /* RX handled by cls */
/* transmission ports handled by classifier */
struct classified_data classified_data_tx[RTE_MAX_ETHPORTS];
};
diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index b5260b0..8f9c0f5 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -187,7 +187,7 @@ log_classification(
struct ether_hdr *eth;
uint16_t vid;
char mac_addr_str[2][ETHER_ADDR_STR_BUF_SZ];
- char iface_str[SPP_NAME_STR_LEN];
+ char iface_str[STR_LEN_NAME];
eth = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
vid = get_vid(pkt);
@@ -232,7 +232,7 @@ log_entry(
const char *func_name,
int line_num)
{
- char iface_str[SPP_NAME_STR_LEN];
+ char iface_str[STR_LEN_NAME];
if (clsd_idx < 0)
snprintf(iface_str, sizeof(iface_str), "%ld", clsd_idx);
@@ -720,7 +720,7 @@ spp_classifier_mac_update(struct sppwk_comp_info *component_info)
"Cannot update classifier mac. ret=%d\n", ret);
return ret;
}
- memcpy(cmp_info->name, component_info->name, SPP_NAME_STR_LEN);
+ memcpy(cmp_info->name, component_info->name, STR_LEN_NAME);
/* change index of reference side */
mng_info->upd_index = mng_info->ref_index;
diff --git a/src/vf/spp_forward.c b/src/vf/spp_forward.c
index 71859e6..668b31c 100644
--- a/src/vf/spp_forward.c
+++ b/src/vf/spp_forward.c
@@ -19,7 +19,7 @@ struct forward_rxtx {
/* Information on the path used for forward. */
struct forward_path {
- char name[SPP_NAME_STR_LEN]; /* component name */
+ char name[STR_LEN_NAME]; /* component name */
volatile enum sppwk_worker_type wk_type;
int num_rx; /* number of receive ports */
int num_tx; /* number of trans ports */
@@ -86,7 +86,7 @@ spp_forward_update(struct sppwk_comp_info *component)
component->name,
component->wk_type);
- memcpy(&path->name, component->name, SPP_NAME_STR_LEN);
+ memcpy(&path->name, component->name, STR_LEN_NAME);
path->wk_type = component->wk_type;
path->num_rx = component->nof_rx;
path->num_tx = component->nof_tx;
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [spp] [PATCH 5/5] shared/sec: add prefix to defines of worker types
2019-06-24 2:23 [spp] [PATCH 0/5] Revising logs and comments in shared yasufum.o
` (3 preceding siblings ...)
2019-06-24 2:23 ` [spp] [PATCH 4/5] shared/sec: rename defines for length of str yasufum.o
@ 2019-06-24 2:23 ` yasufum.o
4 siblings, 0 replies; 6+ messages in thread
From: yasufum.o @ 2019-06-24 2:23 UTC (permalink / raw)
To: spp, ferruh.yigit, yasufum.o
From: Yasufumi Ogawa <yasufum.o@gmail.com>
This update is to prefix `SPPWK_` to defines of strings of worker types
such as `classifier_mac`, `merge` or so.
Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
src/mirror/spp_mirror.c | 2 +-
src/shared/secondary/spp_worker_th/cmd_parser.c | 4 ++--
src/shared/secondary/spp_worker_th/cmd_runner.c | 4 ++--
src/shared/secondary/spp_worker_th/cmd_utils.h | 10 +++++-----
src/vf/classifier_mac.c | 2 +-
src/vf/spp_forward.c | 4 ++--
6 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/mirror/spp_mirror.c b/src/mirror/spp_mirror.c
index b68eccc..f62ae7e 100644
--- a/src/mirror/spp_mirror.c
+++ b/src/mirror/spp_mirror.c
@@ -485,7 +485,7 @@ spp_mirror_get_component_status(
return SPP_RET_NG;
}
- component_type = SPP_TYPE_MIRROR_STR;
+ component_type = SPPWK_TYPE_MIR_STR;
memset(rx_ports, 0x00, sizeof(rx_ports));
for (cnt = 0; cnt < path->nof_rx; cnt++) {
diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.c b/src/shared/secondary/spp_worker_th/cmd_parser.c
index 9fc88dd..55fc1d2 100644
--- a/src/shared/secondary/spp_worker_th/cmd_parser.c
+++ b/src/shared/secondary/spp_worker_th/cmd_parser.c
@@ -197,8 +197,8 @@ get_comp_type_from_str(const char *type_str)
#endif /* SPP_VF_MODULE */
#ifdef SPP_MIRROR_MODULE
- if (strncmp(type_str, SPP_TYPE_MIRROR_STR,
- strlen(SPP_TYPE_MIRROR_STR)+1) == 0)
+ if (strncmp(type_str, SPPWK_TYPE_MIR_STR,
+ strlen(SPPWK_TYPE_MIR_STR)+1) == 0)
return SPPWK_TYPE_MIR;
#endif /* SPP_MIRROR_MODULE */
diff --git a/src/shared/secondary/spp_worker_th/cmd_runner.c b/src/shared/secondary/spp_worker_th/cmd_runner.c
index 9235857..a768575 100644
--- a/src/shared/secondary/spp_worker_th/cmd_runner.c
+++ b/src/shared/secondary/spp_worker_th/cmd_runner.c
@@ -514,7 +514,7 @@ spp_iterate_core_info(struct spp_iterate_core_params *params)
if (core->num == 0) {
ret = (*params->element_proc)(
params, lcore_id,
- "", SPP_TYPE_UNUSE_STR,
+ "", SPPWK_TYPE_NONE_STR,
0, NULL, 0, NULL);
if (unlikely(ret != 0)) {
RTE_LOG(ERR, WK_CMD_RUNNER, "Cannot iterate core "
@@ -1145,7 +1145,7 @@ append_core_element_value(
}
/* there is unnecessary data when "unuse" by type */
- unuse_flg = strcmp(type, SPP_TYPE_UNUSE_STR);
+ unuse_flg = strcmp(type, SPPWK_TYPE_NONE_STR);
/**
* TODO(yasufum) change ambiguous "core" to more specific one such as
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h
index ed46370..ee44cee 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.h
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.h
@@ -19,11 +19,11 @@
* "merge" -> "merger", "forward" -> "forwarder".
*/
/** Identifier string for each component (status command) */
-#define SPP_TYPE_CLASSIFIER_MAC_STR "classifier_mac"
-#define SPP_TYPE_MERGE_STR "merge"
-#define SPP_TYPE_FORWARD_STR "forward"
-#define SPP_TYPE_MIRROR_STR "mirror"
-#define SPP_TYPE_UNUSE_STR "unuse"
+#define SPPWK_TYPE_CLS_STR "classifier_mac"
+#define SPPWK_TYPE_MRG_STR "merge"
+#define SPPWK_TYPE_FWD_STR "forward"
+#define SPPWK_TYPE_MIR_STR "mirror"
+#define SPPWK_TYPE_NONE_STR "unuse"
/** Identifier string for each interface */
#define SPP_IFTYPE_NIC_STR "phy"
diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index 8f9c0f5..b3a6cba 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -850,7 +850,7 @@ spp_classifier_get_component_status(
/* Set the information with the function specified by the command. */
ret = (*params->element_proc)(
params, lcore_id,
- cmp_info->name, SPP_TYPE_CLASSIFIER_MAC_STR,
+ cmp_info->name, SPPWK_TYPE_CLS_STR,
nof_rx, rx_ports, nof_tx, tx_ports);
if (unlikely(ret != SPP_RET_OK))
return SPP_RET_NG;
diff --git a/src/vf/spp_forward.c b/src/vf/spp_forward.c
index 668b31c..909f084 100644
--- a/src/vf/spp_forward.c
+++ b/src/vf/spp_forward.c
@@ -205,9 +205,9 @@ spp_forward_get_component_status(
}
if (path->wk_type == SPPWK_TYPE_MRG)
- component_type = SPP_TYPE_MERGE_STR;
+ component_type = SPPWK_TYPE_MRG_STR;
else
- component_type = SPP_TYPE_FORWARD_STR;
+ component_type = SPPWK_TYPE_FWD_STR;
memset(rx_ports, 0x00, sizeof(rx_ports));
for (cnt = 0; cnt < path->num_rx; cnt++) {
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-06-24 2:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-24 2:23 [spp] [PATCH 0/5] Revising logs and comments in shared yasufum.o
2019-06-24 2:23 ` [spp] [PATCH 1/5] shared/sec: revise comments in cmd_utils.h yasufum.o
2019-06-24 2:23 ` [spp] [PATCH 2/5] shared/sec: rename funcs start with dump yasufum.o
2019-06-24 2:23 ` [spp] [PATCH 3/5] shared/sec: revise member of struct for interface yasufum.o
2019-06-24 2:23 ` [spp] [PATCH 4/5] shared/sec: rename defines for length of str yasufum.o
2019-06-24 2:23 ` [spp] [PATCH 5/5] shared/sec: add prefix to defines of worker types yasufum.o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).