From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH 8/9] spp_pcap: rename struct spp_port_info
Date: Fri, 31 May 2019 17:51:38 +0900 [thread overview]
Message-ID: <1559292699-26940-9-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <1559292699-26940-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp>
From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
This update is to rename struct `spp_port_info` to `sppwk_port_info` to
be more specific, and its member `dpdk_port` to `ethdev_port_id`
correctly.
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
src/pcap/cmd_utils.c | 8 ++++----
src/pcap/cmd_utils.h | 18 +++++++++---------
src/pcap/spp_pcap.c | 17 +++++++++--------
3 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/src/pcap/cmd_utils.c b/src/pcap/cmd_utils.c
index 05f9da1..08e4c98 100644
--- a/src/pcap/cmd_utils.c
+++ b/src/pcap/cmd_utils.c
@@ -146,7 +146,7 @@ stop_process(int signal)
*
* It returns NULL value if given type is invalid.
*/
-struct spp_port_info *
+struct sppwk_port_info *
get_iface_info(enum port_type iface_type, int iface_no)
{
struct iface_info *iface_info = g_mng_data_addr.p_iface_info;
@@ -175,12 +175,12 @@ init_iface_info(void)
for (port_cnt = 0; port_cnt < RTE_MAX_ETHPORTS; port_cnt++) {
p_iface_info->nic[port_cnt].iface_type = UNDEF;
p_iface_info->nic[port_cnt].iface_no = port_cnt;
- p_iface_info->nic[port_cnt].dpdk_port = -1;
+ p_iface_info->nic[port_cnt].ethdev_port_id = -1;
p_iface_info->nic[port_cnt].class_id.vlantag.vid =
ETH_VLAN_ID_MAX;
p_iface_info->ring[port_cnt].iface_type = UNDEF;
p_iface_info->ring[port_cnt].iface_no = port_cnt;
- p_iface_info->ring[port_cnt].dpdk_port = -1;
+ p_iface_info->ring[port_cnt].ethdev_port_id = -1;
p_iface_info->ring[port_cnt].class_id.vlantag.vid =
ETH_VLAN_ID_MAX;
}
@@ -212,7 +212,7 @@ set_nic_interface(void)
for (nic_cnt = 0; nic_cnt < p_iface_info->num_nic; nic_cnt++) {
p_iface_info->nic[nic_cnt].iface_type = PHY;
- p_iface_info->nic[nic_cnt].dpdk_port = nic_cnt;
+ p_iface_info->nic[nic_cnt].ethdev_port_id = nic_cnt;
}
return SPPWK_RET_OK;
diff --git a/src/pcap/cmd_utils.h b/src/pcap/cmd_utils.h
index 2bd1100..862eb27 100644
--- a/src/pcap/cmd_utils.h
+++ b/src/pcap/cmd_utils.h
@@ -139,11 +139,11 @@ struct spp_port_class_identifier {
struct spp_vlantag_info vlantag; /**< VLAN tag information */
};
-/* Port info */
-struct spp_port_info {
- enum port_type iface_type; /**< Interface type (phy/vhost/ring) */
- int iface_no; /**< Interface number */
- int dpdk_port; /**< DPDK port number */
+/* Define detailed port params in addition to `sppwk_port_idx`. */
+struct sppwk_port_info {
+ enum port_type iface_type; /**< phy, vhost or ring */
+ int iface_no;
+ int ethdev_port_id; /**< Consistent ID of ethdev */
struct spp_port_class_identifier class_id;
/**< Port class identifier */
struct spp_port_ability ability[SPP_PORT_ABILITY_MAX];
@@ -175,9 +175,9 @@ struct startup_param {
struct iface_info {
int num_nic; /* The number of phy */
int num_ring; /* The number of ring */
- struct spp_port_info nic[RTE_MAX_ETHPORTS];
+ struct sppwk_port_info nic[RTE_MAX_ETHPORTS];
/* Port information of phy */
- struct spp_port_info ring[RTE_MAX_ETHPORTS];
+ struct sppwk_port_info ring[RTE_MAX_ETHPORTS];
/* Port information of ring */
};
@@ -289,10 +289,10 @@ void stop_process(int signal);
* @param iface_no
* Interface number to be validated.
*
- * @retval !NULL spp_port_info.
+ * @retval !NULL sppwk_port_info.
* @retval NULL failed.
*/
-struct spp_port_info *
+struct sppwk_port_info *
get_iface_info(enum port_type iface_type, int iface_no);
/**
diff --git a/src/pcap/spp_pcap.c b/src/pcap/spp_pcap.c
index 2aad0ad..ee89b0a 100644
--- a/src/pcap/spp_pcap.c
+++ b/src/pcap/spp_pcap.c
@@ -115,7 +115,7 @@ struct pcap_option {
uint64_t fsize_limit; /* file size limit */
char compress_file_path[PCAP_FPATH_STRLEN]; /* file path */
char compress_file_date[PCAP_FDATE_STRLEN]; /* file name date */
- struct spp_port_info port_cap; /* capture port */
+ struct sppwk_port_info port_cap; /* capture port */
struct rte_ring *cap_ring; /* RTE ring structure */
};
@@ -766,7 +766,7 @@ static int pcap_proc_receive(int lcore_id)
int buf;
int nb_rx = 0;
int nb_tx = 0;
- struct spp_port_info *rx;
+ struct sppwk_port_info *rx;
struct rte_mbuf *bufs[MAX_PCAP_BURST];
struct pcap_mng_info *info = &g_pcap_info[lcore_id];
struct rte_ring *write_ring = g_pcap_option.cap_ring;
@@ -816,7 +816,7 @@ static int pcap_proc_receive(int lcore_id)
/* Receive packets */
rx = &g_pcap_option.port_cap;
- nb_rx = spp_eth_rx_burst(rx->dpdk_port, 0, bufs, MAX_PCAP_BURST);
+ nb_rx = spp_eth_rx_burst(rx->ethdev_port_id, 0, bufs, MAX_PCAP_BURST);
if (unlikely(nb_rx == 0))
return SPPWK_RET_OK;
@@ -1017,8 +1017,8 @@ main(int argc, char *argv[])
break;
/* capture port setup */
- struct spp_port_info *port_cap = &g_pcap_option.port_cap;
- struct spp_port_info *port_info = get_iface_info(
+ struct sppwk_port_info *port_cap = &g_pcap_option.port_cap;
+ struct sppwk_port_info *port_info = get_iface_info(
port_cap->iface_type,
port_cap->iface_no);
if (port_info == NULL) {
@@ -1027,7 +1027,8 @@ main(int argc, char *argv[])
}
if (port_cap->iface_type == PHY) {
if (port_info->iface_type != UNDEF)
- port_cap->dpdk_port = port_info->dpdk_port;
+ port_cap->ethdev_port_id =
+ port_info->ethdev_port_id;
else {
RTE_LOG(ERR, SPP_PCAP,
"caputre port undefined.(phy:%d)\n",
@@ -1043,7 +1044,7 @@ main(int argc, char *argv[])
port_cap->iface_no);
break;
}
- port_cap->dpdk_port = ret;
+ port_cap->ethdev_port_id = ret;
} else {
RTE_LOG(ERR, SPP_PCAP, "caputre port "
"undefined.(ring:%d)\n",
@@ -1054,7 +1055,7 @@ main(int argc, char *argv[])
RTE_LOG(DEBUG, SPP_PCAP,
"Recv port type=%d, no=%d, port_id=%d\n",
port_cap->iface_type, port_cap->iface_no,
- port_cap->dpdk_port);
+ port_cap->ethdev_port_id);
/* create ring */
char ring_name[PORT_STR_SIZE];
--
2.17.1
next prev parent reply other threads:[~2019-05-31 8:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-31 8:51 [spp] [PATCH 0/9] Refactor func and struct for spp_pcap resources ogawa.yasufumi
2019-05-31 8:51 ` [spp] [PATCH 1/9] spp_pcap: rename enum spp_core_status ogawa.yasufumi
2019-05-31 8:51 ` [spp] [PATCH 2/9] spp_pcap: rename file of util libs ogawa.yasufumi
2019-05-31 8:51 ` [spp] [PATCH 3/9] spp_pcap: refactor parse error code ogawa.yasufumi
2019-05-31 8:51 ` [spp] [PATCH 4/9] spp_pcap: rename define starts from SPP_CMD_MAX ogawa.yasufumi
2019-05-31 8:51 ` [spp] [PATCH 5/9] spp_pcap: rename define of buffer size for cmds ogawa.yasufumi
2019-05-31 8:51 ` [spp] [PATCH 6/9] spp_pcap: revise name of error message object ogawa.yasufumi
2019-05-31 8:51 ` [spp] [PATCH 7/9] spp_pcap: revise return codes ogawa.yasufumi
2019-05-31 8:51 ` ogawa.yasufumi [this message]
2019-05-31 8:51 ` [spp] [PATCH 9/9] spp_pcap: rename struct spp_port_index ogawa.yasufumi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1559292699-26940-9-git-send-email-ogawa.yasufumi@lab.ntt.co.jp \
--to=ogawa.yasufumi@lab.ntt.co.jp \
--cc=ferruh.yigit@intel.com \
--cc=spp@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).