[spp] [PATCH 2/9] spp_vf: refactor comments and variable names
x-fn-spp at sl.ntt-tx.co.jp
x-fn-spp at sl.ntt-tx.co.jp
Thu Feb 8 06:55:31 CET 2018
From: Kentaro Watanabe <watanabe.kentaro.z01 at as.ntt-tx.co.jp>
* Add description, such as definition and structure members.
* Change abbreviation of variable name and function name.
(if->iface, manage->mng)
* Delete unnecessary function.(ut_main())
Signed-off-by: Kentaro Watanabe <watanabe.kentaro.z01 at as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki at lab.ntt.co.jp>
---
src/vf/classifier_mac.c | 94 ++++++++--------
src/vf/command_dec.c | 40 ++++---
src/vf/command_dec.h | 51 ++++++---
src/vf/command_proc.c | 14 ++-
src/vf/spp_forward.c | 21 ++--
src/vf/spp_vf.c | 293 +++++++++++++++++++++++++-----------------------
src/vf/spp_vf.h | 47 ++++----
7 files changed, 306 insertions(+), 254 deletions(-)
diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index 939f8c9..cd186a2 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -61,18 +61,16 @@ static const size_t HASH_TABLE_NAME_BUF_SZ =
static const size_t ETHER_ADDR_STR_BUF_SZ =
ETHER_ADDR_LEN * 2 + (ETHER_ADDR_LEN - 1) + 1;
-/* TODO(yasufum) add explanation of data structure of classifier and mng info */
-
/* classified data (destination port, target packets, etc) */
struct classified_data {
/* interface type (see "enum port_type") */
- enum port_type if_type;
+ enum port_type iface_type;
/* index of ports handled by classifier */
- int if_no;
+ int iface_no;
/* id for interface generated by spp_vf */
- int if_no_global;
+ int iface_no_global;
/* port id generated by DPDK */
uint16_t port;
@@ -113,8 +111,13 @@ struct classifier_mac_info {
/* classifier management information */
struct classifier_mac_mng_info {
+ /* classifier information */
struct classifier_mac_info info[NUM_CLASSIFIER_MAC_INFO];
+
+ /* Reference index number for classifier information */
volatile int ref_index;
+
+ /* Update index number for classifier information */
volatile int upd_index;
};
@@ -156,17 +159,17 @@ init_classifier_info(struct classifier_mac_info *classifier_info,
classifier_info->default_classified = -1;
classifier_info->n_classified_data_tx = component_info->num_tx_port;
if (component_info->num_rx_port == 0) {
- classified_data_rx->if_type = UNDEF;
- classified_data_rx->if_no = 0;
- classified_data_rx->if_no_global = 0;
+ classified_data_rx->iface_type = UNDEF;
+ classified_data_rx->iface_no = 0;
+ classified_data_rx->iface_no_global = 0;
classified_data_rx->port = 0;
classified_data_rx->num_pkt = 0;
} else {
- classified_data_rx->if_type =
- component_info->rx_ports[0]->if_type;
- classified_data_rx->if_no = 0;
- classified_data_rx->if_no_global =
- component_info->rx_ports[0]->if_no;
+ classified_data_rx->iface_type =
+ component_info->rx_ports[0]->iface_type;
+ classified_data_rx->iface_no = 0;
+ classified_data_rx->iface_no_global =
+ component_info->rx_ports[0]->iface_no;
classified_data_rx->port =
component_info->rx_ports[0]->dpdk_port;
classified_data_rx->num_pkt = 0;
@@ -176,9 +179,9 @@ init_classifier_info(struct classifier_mac_info *classifier_info,
tx_port = component_info->tx_ports[i];
/* store ports information */
- classified_data_tx[i].if_type = tx_port->if_type;
- classified_data_tx[i].if_no = i;
- classified_data_tx[i].if_no_global = tx_port->if_no;
+ classified_data_tx[i].iface_type = tx_port->iface_type;
+ classified_data_tx[i].iface_no = i;
+ classified_data_tx[i].iface_no_global = tx_port->iface_no;
classified_data_tx[i].port = tx_port->dpdk_port;
classified_data_tx[i].num_pkt = 0;
@@ -194,9 +197,9 @@ init_classifier_info(struct classifier_mac_info *classifier_info,
SPP_DEFAULT_CLASSIFIED_DMY_ADDR)) {
classifier_info->default_classified = i;
RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "default classified. "
- "if_type=%d, if_no=%d, dpdk_port=%d\n",
- tx_port->if_type,
- tx_port->if_no,
+ "iface_type=%d, iface_no=%d, dpdk_port=%d\n",
+ tx_port->iface_type,
+ tx_port->iface_no,
tx_port->dpdk_port);
continue;
}
@@ -219,10 +222,10 @@ init_classifier_info(struct classifier_mac_info *classifier_info,
}
RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "Add entry to classifier mac table. "
- "mac_addr=%s, if_type=%d, if_no=%d, dpdk_port=%d\n",
+ "mac_addr=%s, iface_type=%d, iface_no=%d, dpdk_port=%d\n",
mac_addr_str,
- tx_port->if_type,
- tx_port->if_no,
+ tx_port->iface_type,
+ tx_port->iface_no,
tx_port->dpdk_port);
}
@@ -331,9 +334,9 @@ transmit_packet(struct classified_data *classified_data)
uint16_t n_tx;
#ifdef SPP_RINGLATENCYSTATS_ENABLE
- if (classified_data->if_type == RING)
+ if (classified_data->iface_type == RING)
/* if tx-if is ring, set ringlatencystats */
- spp_ringlatencystats_add_time_stamp(classified_data->if_no,
+ spp_ringlatencystats_add_time_stamp(classified_data->iface_no,
classified_data->pkts,
classified_data->num_pkt);
#endif
@@ -386,10 +389,10 @@ push_packet(struct rte_mbuf *pkt, struct classified_data *classified_data)
if (unlikely(classified_data->num_pkt == MAX_PKT_BURST)) {
RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
"transmit packets (buffer is filled). "
- "if_type=%d, if_no={%d,%d}, tx_port=%hu, num_pkt=%hu\n",
- classified_data->if_type,
- classified_data->if_no_global,
- classified_data->if_no,
+ "iface_type=%d, iface_no={%d,%d}, tx_port=%hu, num_pkt=%hu\n",
+ classified_data->iface_type,
+ classified_data->iface_no_global,
+ classified_data->iface_no,
classified_data->port,
classified_data->num_pkt);
transmit_packet(classified_data);
@@ -611,7 +614,7 @@ spp_classifier_mac_do(int id)
prev_tsc = cur_tsc;
}
- if (classified_data_rx->if_type == UNDEF)
+ if (classified_data_rx->iface_type == UNDEF)
continue;
/* retrieve packets */
@@ -621,9 +624,9 @@ spp_classifier_mac_do(int id)
continue;
#ifdef SPP_RINGLATENCYSTATS_ENABLE
- if (classified_data_rx->if_type == RING)
+ if (classified_data_rx->iface_type == RING)
spp_ringlatencystats_calculate_latency(
- classified_data_rx->if_no,
+ classified_data_rx->iface_no,
rx_pkts, n_rx);
#endif
@@ -669,19 +672,19 @@ spp_classifier_get_component_status(
classified_data = classifier_info->classified_data_tx;
memset(rx_ports, 0x00, sizeof(rx_ports));
- if (classifier_info->classified_data_rx.if_type != UNDEF) {
+ if (classifier_info->classified_data_rx.iface_type != UNDEF) {
num_rx = 1;
- rx_ports[0].if_type = classifier_info->
- classified_data_rx.if_type;
- rx_ports[0].if_no = classifier_info->
- classified_data_rx.if_no_global;
+ rx_ports[0].iface_type = classifier_info->
+ classified_data_rx.iface_type;
+ rx_ports[0].iface_no = classifier_info->
+ classified_data_rx.iface_no_global;
}
memset(tx_ports, 0x00, sizeof(tx_ports));
num_tx = classifier_info->n_classified_data_tx;
for (i = 0; i < num_tx; i++) {
- tx_ports[i].if_type = classified_data[i].if_type;
- tx_ports[i].if_no = classified_data[i].if_no_global;
+ tx_ports[i].iface_type = classified_data[i].iface_type;
+ tx_ports[i].iface_no = classified_data[i].iface_no_global;
}
/* Set the information with the function specified by the command. */
@@ -724,12 +727,12 @@ spp_classifier_mac_iterate_table(
"Core[%u] Start iterate classifier table.\n", i);
if (classifier_info->default_classified >= 0) {
- port.if_type = (classified_data +
+ port.iface_type = (classified_data +
classifier_info->default_classified)->
- if_type;
- port.if_no = (classified_data +
+ iface_type;
+ port.iface_no = (classified_data +
classifier_info->default_classified)->
- if_no_global;
+ iface_no_global;
(*params->element_proc)(
params,
@@ -750,9 +753,10 @@ spp_classifier_mac_iterate_table(
ether_format_addr(mac_addr_str, sizeof(mac_addr_str),
(const struct ether_addr *)key);
- port.if_type = (classified_data + (long)data)->if_type;
- port.if_no = (classified_data + (long)data)->
- if_no_global;
+ port.iface_type = (classified_data + (long)data)->
+ iface_type;
+ port.iface_no = (classified_data + (long)data)->
+ iface_no_global;
(*params->element_proc)(
params,
diff --git a/src/vf/command_dec.c b/src/vf/command_dec.c
index 8e82f1f..59e825c 100644
--- a/src/vf/command_dec.c
+++ b/src/vf/command_dec.c
@@ -140,7 +140,7 @@ decode_port_value(void *output, const char *arg_val)
{
int ret = 0;
struct spp_port_index *port = output;
- ret = spp_get_if_info(arg_val, &port->if_type, &port->if_no);
+ ret = spp_get_iface_index(arg_val, &port->iface_type, &port->iface_no);
if (unlikely(ret != 0)) {
RTE_LOG(ERR, SPP_COMMAND_PROC, "Bad port. val=%s\n", arg_val);
return -1;
@@ -292,9 +292,11 @@ decode_port_port_value(void *output, const char *arg_val)
return -1;
if ((port->action == SPP_CMD_ACTION_ADD) &&
- (spp_check_used_port(tmp_port.if_type, tmp_port.if_no,
+ (spp_check_used_port(tmp_port.iface_type,
+ tmp_port.iface_no,
SPP_PORT_RXTX_RX) >= 0) &&
- (spp_check_used_port(tmp_port.if_type, tmp_port.if_no,
+ (spp_check_used_port(tmp_port.iface_type,
+ tmp_port.iface_no,
SPP_PORT_RXTX_TX) >= 0)) {
RTE_LOG(ERR, SPP_COMMAND_PROC,
"Port in used. (port command) val=%s\n",
@@ -302,8 +304,8 @@ decode_port_port_value(void *output, const char *arg_val)
return -1;
}
- port->port.if_type = tmp_port.if_type;
- port->port.if_no = tmp_port.if_no;
+ port->port.iface_type = tmp_port.iface_type;
+ port->port.iface_no = tmp_port.iface_no;
return 0;
}
@@ -322,8 +324,8 @@ decode_port_rxtx_value(void *output, const char *arg_val)
}
if ((port->action == SPP_CMD_ACTION_ADD) &&
- (spp_check_used_port(port->port.if_type,
- port->port.if_no, ret) >= 0)) {
+ (spp_check_used_port(port->port.iface_type,
+ port->port.iface_no, ret) >= 0)) {
RTE_LOG(ERR, SPP_COMMAND_PROC,
"Port in used. (port command) val=%s\n",
arg_val);
@@ -442,15 +444,15 @@ decode_classifier_port_value(void *output, const char *arg_val)
if (ret < 0)
return -1;
- if (spp_check_added_port(tmp_port.if_type, tmp_port.if_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;
}
if (unlikely(classifier_table->action == SPP_CMD_ACTION_ADD)) {
- if (!spp_check_mac_used_port(0, tmp_port.if_type,
- tmp_port.if_no)) {
+ if (!spp_check_mac_used_port(0, tmp_port.iface_type,
+ tmp_port.iface_no)) {
RTE_LOG(ERR, SPP_COMMAND_PROC,
"Port in used. (classifier_table command) val=%s\n",
arg_val);
@@ -462,7 +464,7 @@ decode_classifier_port_value(void *output, const char *arg_val)
return -1;
if (!spp_check_mac_used_port((uint64_t)mac_addr,
- tmp_port.if_type, tmp_port.if_no)) {
+ tmp_port.iface_type, tmp_port.iface_no)) {
RTE_LOG(ERR, SPP_COMMAND_PROC,
"Port in used. (classifier_table command) val=%s\n",
arg_val);
@@ -470,8 +472,8 @@ decode_classifier_port_value(void *output, const char *arg_val)
}
}
- classifier_table->port.if_type = tmp_port.if_type;
- classifier_table->port.if_no = tmp_port.if_no;
+ classifier_table->port.iface_type = tmp_port.iface_type;
+ classifier_table->port.iface_no = tmp_port.iface_no;
return 0;
}
@@ -479,9 +481,10 @@ decode_classifier_port_value(void *output, const char *arg_val)
/* parameter list for decoding */
struct decode_parameter_list {
- const char *name;
- size_t offset;
+ const char *name; /* Parameter name */
+ size_t offset; /* Offset value of struct spp_command */
int (*func)(void *output, const char *arg_val);
+ /* Pointer to parameter handling function */
};
/* parameter list for each command */
@@ -597,11 +600,12 @@ decode_command_parameter_in_list(struct spp_command_request *request,
/* command list for decoding */
struct decode_command_list {
- const char *name;
- int param_min;
- int param_max;
+ 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);
+ /* Pointer to command handling function */
};
/* command list */
diff --git a/src/vf/command_dec.h b/src/vf/command_dec.h
index 7fc5f66..77cae87 100644
--- a/src/vf/command_dec.h
+++ b/src/vf/command_dec.h
@@ -31,7 +31,7 @@ enum spp_command_decode_error_code {
*
* @attention This enumerated type must have the same order of command_list
* defined in command_dec.c
-*/
+ */
enum spp_command_type {
SPP_CMDTYPE_CLASSIFIER_TABLE,
SPP_CMDTYPE_FLUSH,
@@ -45,9 +45,16 @@ enum spp_command_type {
/* "classifier_table" command specific parameters */
struct spp_command_classifier_table {
+ /* Action identifier (add or del) */
enum spp_command_action action;
+
+ /* Classify type (currently only for mac) */
enum spp_classifier_type type;
+
+ /* Value to be classified */
char value[SPP_CMD_VALUE_BUFSZ];
+
+ /* Destination port type and number */
struct spp_port_index port;
};
@@ -58,48 +65,56 @@ struct spp_command_flush {
/* "component" command parameters */
struct spp_command_component {
- enum spp_command_action action;
- char name[SPP_CMD_NAME_BUFSZ];
- unsigned int core;
- enum spp_component_type type;
+ enum spp_command_action action; /* Action identifier (start or stop) */
+ char name[SPP_CMD_NAME_BUFSZ]; /* Component name */
+ unsigned int core; /* Logical core number */
+ enum spp_component_type type; /* Component type */
};
/* "port" command parameters */
struct spp_command_port {
- enum spp_command_action action;
- struct spp_port_index port;
- enum spp_port_rxtx rxtx;
- char name[SPP_CMD_NAME_BUFSZ];
+ enum spp_command_action action; /* Action identifier (add or del) */
+ struct spp_port_index port; /* Port type and number */
+ enum spp_port_rxtx rxtx; /* rx/tx identifier */
+ char name[SPP_CMD_NAME_BUFSZ]; /* Attached component name */
};
/* command parameters */
struct spp_command {
- enum spp_command_type type;
+ enum spp_command_type type; /* Command type */
union {
+ /* Structured data for classifier_table command */
struct spp_command_classifier_table classifier_table;
+
+ /* Structured data for flush command */
struct spp_command_flush flush;
+
+ /* Structured data for component command */
struct spp_command_component component;
+
+ /* Structured data for port command */
struct spp_command_port port;
} spec;
};
/* request parameters */
struct spp_command_request {
- int num_command;
- int num_valid_command;
+ 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 */
- int is_requested_client_id;
- int is_requested_status;
- int is_requested_exit;
+ int is_requested_client_id; /* Id for get_client_id command */
+ int is_requested_status; /* Id for status command */
+ int is_requested_exit; /* Id for exit command */
};
/* decode error information */
struct spp_command_decode_error {
- int code;
- char value_name[SPP_CMD_NAME_BUFSZ];
- char value[SPP_CMD_VALUE_BUFSZ];
+ int code; /* Error code */
+ char value_name[SPP_CMD_NAME_BUFSZ]; /* Error value name */
+ char value[SPP_CMD_VALUE_BUFSZ]; /* Error value */
};
/* decode request from no-null-terminated string */
diff --git a/src/vf/command_proc.c b/src/vf/command_proc.c
index b06ed27..f51c800 100644
--- a/src/vf/command_proc.c
+++ b/src/vf/command_proc.c
@@ -36,14 +36,22 @@ enum command_result_code {
/* command execution result information */
struct command_result {
+ /* Response code */
int code;
+
+ /* Response message */
char result[SPP_CMD_NAME_BUFSZ];
+
+ /* Detailed response message */
char error_message[CMD_RES_ERR_MSG_SIZE];
};
/* command response list control structure */
struct command_response_list {
+ /* Tag name */
char tag_name[SPP_CMD_NAME_BUFSZ];
+
+ /* Pointer to handling function */
int (*func)(const char *name, char **output, void *tmp);
};
@@ -432,8 +440,8 @@ apeend_port_array(const char *name, char **output,
}
for (i = 0; i < num; i++) {
- spp_format_port_string(port_str, ports[i].if_type,
- ports[i].if_no);
+ spp_format_port_string(port_str, ports[i].iface_type,
+ ports[i].iface_no);
sprintf(append_str, "%s\"%s\"", JSON_APPEND_COMMA(i), port_str);
@@ -552,7 +560,7 @@ append_classifier_element_value(
return ret;
}
- spp_format_port_string(port_str, port->if_type, port->if_no);
+ spp_format_port_string(port_str, port->iface_type, port->iface_no);
ret = append_json_str_value("type", &tmp_buff, "mac");
if (unlikely(ret < 0))
diff --git a/src/vf/spp_forward.c b/src/vf/spp_forward.c
index b2a3728..c5c0e3c 100644
--- a/src/vf/spp_forward.c
+++ b/src/vf/spp_forward.c
@@ -8,8 +8,8 @@
/* A set of port info of rx and tx */
struct forward_rxtx {
- struct spp_port_info rx;
- struct spp_port_info tx;
+ struct spp_port_info rx; /* rx port */
+ struct spp_port_info tx; /* tx port */
};
/* Information on the path used for forward. */
@@ -27,6 +27,7 @@ struct forward_info {
volatile int ref_index; /* index to reference area */
volatile int upd_index; /* index to update area */
struct forward_path path[SPP_INFO_AREA_MAX];
+ /* Information of data path */
};
struct forward_info g_forward_info[RTE_MAX_LCORE];
@@ -151,12 +152,12 @@ spp_forward(int id)
continue;
#ifdef SPP_RINGLATENCYSTATS_ENABLE
- if (rx->if_type == RING)
- spp_ringlatencystats_calculate_latency(rx->if_no,
+ if (rx->iface_type == RING)
+ spp_ringlatencystats_calculate_latency(rx->iface_no,
bufs, nb_rx);
- if (tx->if_type == RING)
- spp_ringlatencystats_add_time_stamp(tx->if_no,
+ if (tx->iface_type == RING)
+ spp_ringlatencystats_add_time_stamp(tx->iface_no,
bufs, nb_rx);
#endif /* SPP_RINGLATENCYSTATS_ENABLE */
@@ -201,14 +202,14 @@ spp_forward_get_component_status(
memset(rx_ports, 0x00, sizeof(rx_ports));
for (cnt = 0; cnt < path->num; cnt++) {
- rx_ports[cnt].if_type = path->ports[cnt].rx.if_type;
- rx_ports[cnt].if_no = path->ports[cnt].rx.if_no;
+ rx_ports[cnt].iface_type = path->ports[cnt].rx.iface_type;
+ rx_ports[cnt].iface_no = path->ports[cnt].rx.iface_no;
}
memset(tx_ports, 0x00, sizeof(tx_ports));
num_tx = (path->num > 0)?1:0;
- tx_ports[0].if_type = path->ports[0].tx.if_type;
- tx_ports[0].if_no = path->ports[0].tx.if_no;
+ tx_ports[0].iface_type = path->ports[0].tx.iface_type;
+ tx_ports[0].iface_no = path->ports[0].tx.iface_no;
/* Set the information with the function specified by the command. */
ret = (*params->element_proc)(
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index 1756326..49c56e3 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -13,10 +13,13 @@
#include "spp_forward.h"
#include "command_proc.h"
-/* TODO(yasufum) add desc how there are used */
+/* Max number of core status check */
#define SPP_CORE_STATUS_CHECK_MAX 5
+
+/* Sampling interval timer for latency evaluation */
#define SPP_RING_LATENCY_STATS_SAMPLING_INTERVAL 1000000
+/* Name string for each component */
#define CORE_TYPE_CLASSIFIER_MAC_STR "classifier_mac"
#define CORE_TYPE_MERGE_STR "merge"
#define CORE_TYPE_FORWARD_STR "forward"
@@ -25,10 +28,12 @@
enum SPP_LONGOPT_RETVAL {
SPP_LONGOPT_RETVAL__ = 127,
- /* add below */
- /* TODO(yasufum) add description what and why add below */
- SPP_LONGOPT_RETVAL_CLIENT_ID,
- SPP_LONGOPT_RETVAL_VHOST_CLIENT
+ /*
+ * Return value definition for getopt_long()
+ * Only for long option
+ */
+ SPP_LONGOPT_RETVAL_CLIENT_ID, /* --client-id */
+ SPP_LONGOPT_RETVAL_VHOST_CLIENT /* --vhost-client */
};
/* Flag of processing type to copy management information */
@@ -40,60 +45,84 @@ enum copy_mng_flg {
/* Manage given options as global variable */
struct startup_param {
- int client_id;
+ int client_id; /* Client ID of spp_vf */
char server_ip[INET_ADDRSTRLEN];
- int server_port;
- int vhost_client;
+ /* IP address sting of spp controller */
+ int server_port; /* Port Number of spp controller */
+ int vhost_client; /* Flag for --vhost-client option */
};
/* Manage number of interfaces and port information as global variable */
-/* TODO(yasufum) refactor, change if to iface */
-struct if_info {
- int num_nic;
- int num_vhost;
- int num_ring;
+struct iface_info {
+ int num_nic; /* The number of phy */
+ int num_vhost; /* The number of vhost */
+ int num_ring; /* The number of ring */
struct spp_port_info nic[RTE_MAX_ETHPORTS];
+ /* Port information of phy */
struct spp_port_info vhost[RTE_MAX_ETHPORTS];
+ /* Port information of vhost */
struct spp_port_info ring[RTE_MAX_ETHPORTS];
+ /* Port information of ring */
};
/* Manage component running in core as global variable */
struct core_info {
volatile enum spp_component_type type;
- int num;
- int id[RTE_MAX_LCORE];
+ /* Component type */
+ int num; /* The number of IDs below */
+ int id[RTE_MAX_LCORE]; /* ID list of components executed on cpu core */
};
/* Manage core status and component information as global variable */
struct core_mng_info {
+ /* Status of cpu core */
volatile enum spp_core_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];
};
/* Manage data to be backup */
struct cancel_backup_info {
+ /* Backup data of core information */
struct core_mng_info core[RTE_MAX_LCORE];
+
+ /* Backup data of component information */
struct spp_component_info component[RTE_MAX_LCORE];
- struct if_info interface;
+
+ /* Backup data of interface information */
+ struct iface_info interface;
};
/* Declare global variables */
-static unsigned int g_main_lcore_id = 0xffffffff;
+/* Logical core ID for main process */
+static unsigned int g_main_lcore_id = 0xffffffff;
+
+/* Execution parameter of spp_vf */
static struct startup_param g_startup_param;
-static struct if_info g_if_info;
+/* Interface management information */
+static struct iface_info g_iface_info;
+
+/* Component management information */
static struct spp_component_info g_component_info[RTE_MAX_LCORE];
-static struct core_mng_info g_core_info[RTE_MAX_LCORE];
-/*
- * TODO(yasufum) add desc how it is used
- * and why changed component is kept
- */
+/* Core management information */
+static struct core_mng_info g_core_info[RTE_MAX_LCORE];
+
+/* Array of update indicator for core management information */
static int g_change_core[RTE_MAX_LCORE];
+
+/* Array of update indicator for component management information */
static int g_change_component[RTE_MAX_LCORE];
+/* Backup information for cancel command */
static struct cancel_backup_info g_backup_info;
/* Print help message */
@@ -444,20 +473,17 @@ parse_app_args(int argc, char *argv[])
* Return port info of given type and num of interface
*
* It returns NULL value if given type is invalid.
- *
- * TODO(yasufum) refactor name of func to be more understandable (area?)
- * TODO(yasufum) refactor, change if to iface.
*/
static struct spp_port_info *
-get_if_area(enum port_type if_type, int if_no)
+get_iface_info(enum port_type iface_type, int iface_no)
{
- switch (if_type) {
+ switch (iface_type) {
case PHY:
- return &g_if_info.nic[if_no];
+ return &g_iface_info.nic[iface_no];
case VHOST:
- return &g_if_info.vhost[if_no];
+ return &g_iface_info.vhost[iface_no];
case RING:
- return &g_if_info.ring[if_no];
+ return &g_iface_info.ring[iface_no];
default:
return NULL;
}
@@ -516,44 +542,44 @@ dump_component_info(const struct spp_component_info *component_info)
/* Dump of interface information */
static void
-dump_interface_info(const struct if_info *if_info)
+dump_interface_info(const struct iface_info *iface_info)
{
const struct spp_port_info *port = NULL;
int cnt = 0;
RTE_LOG(DEBUG, APP, "interface phy=%d, vhost=%d, ring=%d\n",
- if_info->num_nic,
- if_info->num_vhost,
- if_info->num_ring);
+ iface_info->num_nic,
+ iface_info->num_vhost,
+ iface_info->num_ring);
for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
- port = &if_info->nic[cnt];
- if (port->if_type == UNDEF)
+ port = &iface_info->nic[cnt];
+ if (port->iface_type == UNDEF)
continue;
RTE_LOG(DEBUG, APP, "phy [%d] type=%d, no=%d, port=%d, "
"mac=%08lx(%s)\n",
- cnt, port->if_type, port->if_no,
+ cnt, port->iface_type, port->iface_no,
port->dpdk_port,
port->mac_addr, port->mac_addr_str);
}
for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
- port = &if_info->vhost[cnt];
- if (port->if_type == UNDEF)
+ port = &iface_info->vhost[cnt];
+ if (port->iface_type == UNDEF)
continue;
RTE_LOG(DEBUG, APP, "vhost[%d] type=%d, no=%d, port=%d, "
"mac=%08lx(%s)\n",
- cnt, port->if_type, port->if_no,
+ cnt, port->iface_type, port->iface_no,
port->dpdk_port,
port->mac_addr, port->mac_addr_str);
}
for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
- port = &if_info->ring[cnt];
- if (port->if_type == UNDEF)
+ port = &iface_info->ring[cnt];
+ if (port->iface_type == UNDEF)
continue;
RTE_LOG(DEBUG, APP, "ring [%d] type=%d, no=%d, port=%d, "
"mac=%08lx(%s)\n",
- cnt, port->if_type, port->if_no,
+ cnt, port->iface_type, port->iface_no,
port->dpdk_port,
port->mac_addr, port->mac_addr_str);
}
@@ -564,7 +590,7 @@ static void
dump_all_mng_info(
const struct core_mng_info *core,
const struct spp_component_info *component,
- const struct if_info *interface)
+ const struct iface_info *interface)
{
if (rte_log_get_global_level() < RTE_LOG_DEBUG)
return;
@@ -579,10 +605,10 @@ static void
copy_mng_info(
struct core_mng_info *dst_core,
struct spp_component_info *dst_component,
- struct if_info *dst_interface,
+ struct iface_info *dst_interface,
const struct core_mng_info *src_core,
const struct spp_component_info *src_component,
- const struct if_info *src_interface,
+ const struct iface_info *src_interface,
enum copy_mng_flg flg)
{
int upd_index = 0;
@@ -611,16 +637,16 @@ copy_mng_info(
memcpy(dst_component, src_component,
sizeof(struct spp_component_info)*RTE_MAX_LCORE);
memcpy(dst_interface, src_interface,
- sizeof(struct if_info));
+ sizeof(struct iface_info));
}
/* Backup the management information */
static void
backup_mng_info(struct cancel_backup_info *backup)
{
- dump_all_mng_info(g_core_info, g_component_info, &g_if_info);
+ dump_all_mng_info(g_core_info, g_component_info, &g_iface_info);
copy_mng_info(backup->core, backup->component, &backup->interface,
- g_core_info, g_component_info, &g_if_info,
+ g_core_info, g_component_info, &g_iface_info,
COPY_MNG_FLG_ALLCOPY);
dump_all_mng_info(backup->core, backup->component, &backup->interface);
memset(g_change_core, 0x00, sizeof(g_change_core));
@@ -632,35 +658,34 @@ static void
cancel_mng_info(struct cancel_backup_info *backup)
{
dump_all_mng_info(backup->core, backup->component, &backup->interface);
- copy_mng_info(g_core_info, g_component_info, &g_if_info,
+ copy_mng_info(g_core_info, g_component_info, &g_iface_info,
backup->core, backup->component, &backup->interface,
COPY_MNG_FLG_ALLCOPY);
- dump_all_mng_info(g_core_info, g_component_info, &g_if_info);
+ dump_all_mng_info(g_core_info, g_component_info, &g_iface_info);
memset(g_change_core, 0x00, sizeof(g_change_core));
memset(g_change_component, 0x00, sizeof(g_change_component));
}
/**
- * Initialize g_if_info
+ * Initialize g_iface_info
*
- * Clear g_if_info and set initial value.
- * TODO(yasufum) refactor, change if to iface.
+ * Clear g_iface_info and set initial value.
*/
static void
-init_if_info(void)
+init_iface_info(void)
{
int port_cnt; /* increment ether ports */
- memset(&g_if_info, 0x00, sizeof(g_if_info));
+ memset(&g_iface_info, 0x00, sizeof(g_iface_info));
for (port_cnt = 0; port_cnt < RTE_MAX_ETHPORTS; port_cnt++) {
- g_if_info.nic[port_cnt].if_type = UNDEF;
- g_if_info.nic[port_cnt].if_no = port_cnt;
- g_if_info.nic[port_cnt].dpdk_port = -1;
- g_if_info.vhost[port_cnt].if_type = UNDEF;
- g_if_info.vhost[port_cnt].if_no = port_cnt;
- g_if_info.vhost[port_cnt].dpdk_port = -1;
- g_if_info.ring[port_cnt].if_type = UNDEF;
- g_if_info.ring[port_cnt].if_no = port_cnt;
- g_if_info.ring[port_cnt].dpdk_port = -1;
+ g_iface_info.nic[port_cnt].iface_type = UNDEF;
+ g_iface_info.nic[port_cnt].iface_no = port_cnt;
+ g_iface_info.nic[port_cnt].dpdk_port = -1;
+ g_iface_info.vhost[port_cnt].iface_type = UNDEF;
+ g_iface_info.vhost[port_cnt].iface_no = port_cnt;
+ g_iface_info.vhost[port_cnt].dpdk_port = -1;
+ g_iface_info.ring[port_cnt].iface_type = UNDEF;
+ g_iface_info.ring[port_cnt].iface_no = port_cnt;
+ g_iface_info.ring[port_cnt].dpdk_port = -1;
}
}
@@ -695,8 +720,6 @@ init_core_info(void)
/**
* Setup port info of port on host
- *
- * TODO(yasufum) refactor, change if to iface.
*/
static int
set_nic_interface(void)
@@ -704,13 +727,13 @@ set_nic_interface(void)
int nic_cnt = 0;
/* NIC Setting */
- g_if_info.num_nic = rte_eth_dev_count();
- if (g_if_info.num_nic > RTE_MAX_ETHPORTS)
- g_if_info.num_nic = RTE_MAX_ETHPORTS;
+ g_iface_info.num_nic = rte_eth_dev_count();
+ if (g_iface_info.num_nic > RTE_MAX_ETHPORTS)
+ g_iface_info.num_nic = RTE_MAX_ETHPORTS;
- for (nic_cnt = 0; nic_cnt < g_if_info.num_nic; nic_cnt++) {
- g_if_info.nic[nic_cnt].if_type = PHY;
- g_if_info.nic[nic_cnt].dpdk_port = nic_cnt;
+ for (nic_cnt = 0; nic_cnt < g_iface_info.num_nic; nic_cnt++) {
+ g_iface_info.nic[nic_cnt].iface_type = PHY;
+ g_iface_info.nic[nic_cnt].dpdk_port = nic_cnt;
}
return 0;
@@ -718,15 +741,12 @@ set_nic_interface(void)
/**
* Setup management info for spp_vf
- *
- * TODO(yasufum) refactor, change if to iface.
- * TODO(yasufum) refactor, change function name from manage to mng or management
*/
static int
-init_manage_data(void)
+init_mng_data(void)
{
/* Initialize interface and core information */
- init_if_info();
+ init_iface_info();
init_core_info();
init_component_info();
@@ -740,8 +760,6 @@ init_manage_data(void)
#ifdef SPP_RINGLATENCYSTATS_ENABLE
/**
* Print statistics of time for packet processing in ring interface
- *
- * TODO(yasufum) refactor, change if to iface.
*/
static void
print_ring_latency_stats(void)
@@ -758,7 +776,7 @@ print_ring_latency_stats(void)
printf("RING Latency\n");
printf(" RING");
for (ring_cnt = 0; ring_cnt < RTE_MAX_ETHPORTS; ring_cnt++) {
- if (g_if_info.ring[ring_cnt].if_type == UNDEF)
+ if (g_iface_info.ring[ring_cnt].iface_type == UNDEF)
continue;
spp_ringlatencystats_get_stats(ring_cnt, &stats[ring_cnt]);
@@ -770,7 +788,7 @@ print_ring_latency_stats(void)
stats_cnt++) {
printf("%3dns", stats_cnt);
for (ring_cnt = 0; ring_cnt < RTE_MAX_ETHPORTS; ring_cnt++) {
- if (g_if_info.ring[ring_cnt].if_type == UNDEF)
+ if (g_iface_info.ring[ring_cnt].iface_type == UNDEF)
continue;
printf(", 0x%-16lx", stats[ring_cnt].slot[stats_cnt]);
@@ -793,7 +811,7 @@ del_vhost_sockfile(struct spp_port_info *vhost)
return;
for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
- if (likely(vhost[cnt].if_type == UNDEF)) {
+ if (likely(vhost[cnt].iface_type == UNDEF)) {
/* Skip removing if it is not using vhost */
continue;
}
@@ -896,18 +914,13 @@ slave_main(void *arg __attribute__ ((unused)))
return ret;
}
-/* TODO(yasufum) refactor, change if to iface. */
-/*
- * TODO(yasufum) change test using ut_main(),
- * or add description for what and why use it
+/**
+ * Main function
+ *
+ * Return -1 explicitly if error is occurred.
*/
-/* TODO(yasufum) change to return -1 explicitly if error is occurred. */
int
-#ifndef USE_UT_SPP_VF
main(int argc, char *argv[])
-#else /* ifndef USE_UT_SPP_VF */
-ut_main(int argc, char *argv[])
-#endif /* ifndef USE_UT_SPP_VF */
{
int ret = -1;
#ifdef SPP_DEMONIZE
@@ -943,8 +956,8 @@ ut_main(int argc, char *argv[])
/* Get lcore id of main thread to set its status after */
g_main_lcore_id = rte_lcore_id();
- int ret_manage = init_manage_data();
- if (unlikely(ret_manage != 0))
+ int ret_mng = init_mng_data();
+ if (unlikely(ret_mng != 0))
break;
int ret_classifier_mac_init = spp_classifier_mac_init();
@@ -963,7 +976,7 @@ ut_main(int argc, char *argv[])
#ifdef SPP_RINGLATENCYSTATS_ENABLE
int ret_ringlatency = spp_ringlatencystats_init(
SPP_RING_LATENCY_STATS_SAMPLING_INTERVAL,
- g_if_info.num_ring);
+ g_iface_info.num_ring);
if (unlikely(ret_ringlatency != 0))
break;
#endif /* SPP_RINGLATENCYSTATS_ENABLE */
@@ -1028,7 +1041,7 @@ ut_main(int argc, char *argv[])
* Remove vhost sock file if it is not running
* in vhost-client mode
*/
- del_vhost_sockfile(g_if_info.vhost);
+ del_vhost_sockfile(g_iface_info.vhost);
}
#ifdef SPP_RINGLATENCYSTATS_ENABLE
@@ -1047,13 +1060,14 @@ spp_get_client_id(void)
/**
* Check mac address used on the port for registering or removing
- *
- * TODO(yasufum) refactor, change if to iface.
*/
int
-spp_check_mac_used_port(uint64_t mac_addr, enum port_type if_type, int if_no)
+spp_check_mac_used_port(
+ uint64_t mac_addr,
+ enum port_type iface_type,
+ int iface_no)
{
- struct spp_port_info *port_info = get_if_area(if_type, if_no);
+ struct spp_port_info *port_info = get_iface_info(iface_type, iface_no);
return (mac_addr == port_info->mac_addr);
}
@@ -1061,19 +1075,19 @@ spp_check_mac_used_port(uint64_t mac_addr, enum port_type if_type, int if_no)
* Check if port has been added.
*/
int
-spp_check_added_port(enum port_type if_type, int if_no)
+spp_check_added_port(enum port_type iface_type, int iface_no)
{
- struct spp_port_info *port = get_if_area(if_type, if_no);
- return port->if_type != UNDEF;
+ struct spp_port_info *port = get_iface_info(iface_type, iface_no);
+ return port->iface_type != UNDEF;
}
/*
* Check if port has been flushed.
*/
int
-spp_check_flush_port(enum port_type if_type, int if_no)
+spp_check_flush_port(enum port_type iface_type, int iface_no)
{
- struct spp_port_info *port = get_if_area(if_type, if_no);
+ struct spp_port_info *port = get_iface_info(iface_type, iface_no);
return port->dpdk_port >= 0;
}
@@ -1081,12 +1095,15 @@ spp_check_flush_port(enum port_type if_type, int if_no)
* Check if component is using port.
*/
int
-spp_check_used_port(enum port_type if_type, int if_no, enum spp_port_rxtx rxtx)
+spp_check_used_port(
+ enum port_type iface_type,
+ int iface_no,
+ enum spp_port_rxtx rxtx)
{
int cnt, port_cnt, max = 0;
struct spp_component_info *component = NULL;
struct spp_port_info **port_array = NULL;
- struct spp_port_info *port = get_if_area(if_type, if_no);
+ struct spp_port_info *port = get_iface_info(iface_type, iface_no);
if (port == NULL)
return SPP_RET_NG;
@@ -1120,14 +1137,14 @@ set_component_change_port(struct spp_port_info *port, enum spp_port_rxtx rxtx)
{
int ret = 0;
if ((rxtx == SPP_PORT_RXTX_RX) || (rxtx == SPP_PORT_RXTX_ALL)) {
- ret = spp_check_used_port(port->if_type, port->if_no,
+ ret = spp_check_used_port(port->iface_type, port->iface_no,
SPP_PORT_RXTX_RX);
if (ret >= 0)
g_change_component[ret] = 1;
}
if ((rxtx == SPP_PORT_RXTX_TX) || (rxtx == SPP_PORT_RXTX_ALL)) {
- ret = spp_check_used_port(port->if_type, port->if_no,
+ ret = spp_check_used_port(port->iface_type, port->iface_no,
SPP_PORT_RXTX_TX);
if (ret >= 0)
g_change_component[ret] = 1;
@@ -1147,7 +1164,7 @@ spp_update_classifier_table(
if (type == SPP_CLASSIFIER_TYPE_MAC) {
RTE_LOG(DEBUG, APP, "update_classifier_table ( type = mac, data = %s, port = %d:%d )\n",
- data, port->if_type, port->if_no);
+ data, port->iface_type, port->iface_no);
ret_mac = spp_change_mac_str_to_int64(data);
if (unlikely(ret_mac == -1)) {
@@ -1157,15 +1174,15 @@ spp_update_classifier_table(
}
mac_addr = (uint64_t)ret_mac;
- port_info = get_if_area(port->if_type, port->if_no);
+ port_info = get_iface_info(port->iface_type, port->iface_no);
if (unlikely(port_info == NULL)) {
RTE_LOG(ERR, APP, "No port. ( port = %d:%d )\n",
- port->if_type, port->if_no);
+ port->iface_type, port->iface_no);
return SPP_RET_NG;
}
- if (unlikely(port_info->if_type == UNDEF)) {
+ if (unlikely(port_info->iface_type == UNDEF)) {
RTE_LOG(ERR, APP, "Port not added. ( port = %d:%d )\n",
- port->if_type, port->if_no);
+ port->iface_type, port->iface_no);
return SPP_RET_NG;
}
@@ -1185,7 +1202,8 @@ spp_update_classifier_table(
/* Setting */
if (unlikely(port_info->mac_addr != 0)) {
RTE_LOG(ERR, APP, "Port in used. ( port = %d:%d )\n",
- port->if_type, port->if_no);
+ port->iface_type,
+ port->iface_no);
return SPP_RET_NG;
}
@@ -1194,7 +1212,6 @@ spp_update_classifier_table(
}
}
- /* TODO(yasufum) add desc how it is used and why changed core is kept */
set_component_change_port(port_info, SPP_PORT_RXTX_TX);
return SPP_RET_OK;
}
@@ -1406,7 +1423,7 @@ spp_update_port(enum spp_command_action action,
}
component = &g_component_info[component_id];
- port_info = get_if_area(port->if_type, port->if_no);
+ port_info = get_iface_info(port->iface_type, port->iface_no);
if (rxtx == SPP_PORT_RXTX_RX) {
num = &component->num_rx_port;
ports = component->rx_ports;
@@ -1426,7 +1443,7 @@ spp_update_port(enum spp_command_action action,
break;
}
- port_info->if_type = port->if_type;
+ port_info->iface_type = port->iface_type;
ports[*num] = port_info;
(*num)++;
@@ -1457,9 +1474,9 @@ flush_port(void)
/* Initialize added vhost. */
for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
- port = &g_if_info.vhost[cnt];
- if ((port->if_type != UNDEF) && (port->dpdk_port < 0)) {
- ret = add_vhost_pmd(port->if_no,
+ port = &g_iface_info.vhost[cnt];
+ if ((port->iface_type != UNDEF) && (port->dpdk_port < 0)) {
+ ret = add_vhost_pmd(port->iface_no,
g_startup_param.vhost_client);
if (ret < 0)
return SPP_RET_NG;
@@ -1469,9 +1486,9 @@ flush_port(void)
/* Initialize added ring. */
for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
- port = &g_if_info.ring[cnt];
- if ((port->if_type != UNDEF) && (port->dpdk_port < 0)) {
- ret = add_ring_pmd(port->if_no);
+ port = &g_iface_info.ring[cnt];
+ if ((port->iface_type != UNDEF) && (port->dpdk_port < 0)) {
+ ret = add_ring_pmd(port->iface_no);
if (ret < 0)
return SPP_RET_NG;
port->dpdk_port = ret;
@@ -1634,14 +1651,12 @@ spp_iterate_classifier_table(
/**
* Separate port id of combination of iface type and number and
- * assign to given argument, if_type and if_no.
+ * assign to given argument, iface_type and iface_no.
*
* For instance, 'ring:0' is separated to 'ring' and '0'.
- *
- * TODO(yasufum) change if to iface
*/
int
-spp_get_if_info(const char *port, enum port_type *if_type, int *if_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;
@@ -1678,11 +1693,11 @@ spp_get_if_info(const char *port, enum port_type *if_type, int *if_no)
return -1;
}
- *if_type = type;
- *if_no = ret_no;
+ *iface_type = type;
+ *iface_no = ret_no;
RTE_LOG(DEBUG, APP, "Port = %s => Type = %d No = %d\n",
- port, *if_type, *if_no);
+ port, *iface_type, *iface_no);
return 0;
}
@@ -1690,25 +1705,25 @@ spp_get_if_info(const char *port, enum port_type *if_type, int *if_no)
* Generate a formatted string of combination from interface type and
* number and assign to given 'port'
*/
-int spp_format_port_string(char *port, enum port_type if_type, int if_no)
+int spp_format_port_string(char *port, enum port_type iface_type, int iface_no)
{
- const char *if_type_str;
+ const char *iface_type_str;
- switch (if_type) {
+ switch (iface_type) {
case PHY:
- if_type_str = SPP_IFTYPE_NIC_STR;
+ iface_type_str = SPP_IFTYPE_NIC_STR;
break;
case RING:
- if_type_str = SPP_IFTYPE_RING_STR;
+ iface_type_str = SPP_IFTYPE_RING_STR;
break;
case VHOST:
- if_type_str = SPP_IFTYPE_VHOST_STR;
+ iface_type_str = SPP_IFTYPE_VHOST_STR;
break;
default:
return -1;
}
- sprintf(port, "%s:%d", if_type_str, if_no);
+ sprintf(port, "%s:%d", iface_type_str, iface_no);
return 0;
}
diff --git a/src/vf/spp_vf.h b/src/vf/spp_vf.h
index 4ab9afe..07f2e2a 100644
--- a/src/vf/spp_vf.h
+++ b/src/vf/spp_vf.h
@@ -82,33 +82,35 @@ enum spp_command_action {
* Interface information structure
*/
struct spp_port_index {
- enum port_type if_type;
- int if_no;
+ enum port_type iface_type; /* Interface type (phy/vhost/ring) */
+ int iface_no; /* Interface number */
};
/*
* Port info
*/
struct spp_port_info {
- enum port_type if_type;
- int if_no;
- int dpdk_port;
- uint64_t mac_addr;
- char mac_addr_str[SPP_MIN_STR_LEN];
+ enum port_type iface_type; /* Interface type (phy/vhost/ring) */
+ int iface_no; /* Interface number */
+ int dpdk_port; /* DPDK port number */
+ uint64_t mac_addr; /* Mac address for classifying */
+ char mac_addr_str[SPP_MIN_STR_LEN]; /* Mac address */
};
/*
* Component info
*/
struct spp_component_info {
- char name[SPP_NAME_STR_LEN];
- enum spp_component_type type;
- unsigned int lcore_id;
- int component_id;
- int num_rx_port;
- int num_tx_port;
+ char name[SPP_NAME_STR_LEN]; /* Component name */
+ enum spp_component_type type; /* Component type */
+ unsigned int lcore_id; /* Logical core ID for component */
+ int component_id; /* Component ID */
+ int num_rx_port; /* The number of rx ports */
+ int num_tx_port; /* The number of tx ports */
struct spp_port_info *rx_ports[RTE_MAX_ETHPORTS];
+ /* Array of pointers to rx ports */
struct spp_port_info *tx_ports[RTE_MAX_ETHPORTS];
+ /* Array of pointers to tx ports */
};
/*
@@ -236,20 +238,20 @@ int spp_get_component_id(const char *name);
*/
int spp_check_mac_used_port(
uint64_t mac_addr,
- enum port_type if_type,
- int if_no);
+ enum port_type iface_type,
+ int iface_no);
/*
* Check if port has been added.
* RETURN : True if port has been added.
*/
-int spp_check_added_port(enum port_type if_type, int if_no);
+int spp_check_added_port(enum port_type iface_type, int iface_no);
/*
* Check if port has been flushed.
* RETURN : True if port has been flushed.
*/
-int spp_check_flush_port(enum port_type if_type, int if_no);
+int spp_check_flush_port(enum port_type iface_type, int iface_no);
/*
* Check if component is using port.
@@ -257,8 +259,8 @@ int spp_check_flush_port(enum port_type if_type, int if_no);
* NG : SPP_RET_NG
*/
int spp_check_used_port(
- enum port_type if_type,
- int if_no,
+ enum port_type iface_type,
+ int iface_no,
enum spp_port_rxtx rxtx);
/*
@@ -274,7 +276,10 @@ int64_t spp_change_mac_str_to_int64(const char *mac);
* OK : 0
* NG : -1
*/
-int spp_get_if_info(const char *port, enum port_type *if_type, int *if_no);
+int spp_get_iface_index(
+ const char *port,
+ enum port_type *iface_type,
+ int *iface_no);
/*
* Format port string form if-type/if-number
@@ -282,7 +287,7 @@ int spp_get_if_info(const char *port, enum port_type *if_type, int *if_no);
* OK : 0
* NG : -1
*/
-int spp_format_port_string(char *port, enum port_type if_type, int if_no);
+int spp_format_port_string(char *port, enum port_type iface_type, int iface_no);
/*
* Change component type from string to type value.
--
1.9.1
More information about the spp
mailing list