* [spp] [PATCH 0/2] Fix compile errors of ring latency stats
@ 2019-07-01 4:12 yasufum.o
2019-07-01 4:12 ` [spp] [PATCH 1/2] shared/sec: fix compile error of ringlatencystats yasufum.o
2019-07-01 4:12 ` [spp] [PATCH 2/2] shared/sec: remove source and header of spp_port yasufum.o
0 siblings, 2 replies; 3+ messages in thread
From: yasufum.o @ 2019-07-01 4:12 UTC (permalink / raw)
To: spp, ferruh.yigit, yasufum.o
From: Yasufumi Ogawa <yasufum.o@gmail.com>
For adding burst functions and changing dir structure, it causes compile
errors if CFLAG DSPP_RINGLATENCYSTATS_ENABLE is activated in each of
Makefiles. This update is to fix this issue.
Yasufumi Ogawa (2):
shared/sec: fix compile error of ringlatencystats
shared/sec: remove source and header of spp_port
src/mirror/Makefile | 1 -
src/mirror/spp_mirror.c | 37 +++++++--
src/pcap/Makefile | 1 -
src/pcap/spp_pcap.c | 13 ++-
.../spp_worker_th/cmd_res_formatter.c | 1 -
.../secondary/spp_worker_th/cmd_runner.c | 1 -
.../secondary/spp_worker_th/cmd_utils.c | 41 ----------
.../secondary/spp_worker_th/cmd_utils.h | 5 --
.../secondary/spp_worker_th/port_capability.c | 60 ++++++++++----
.../secondary/spp_worker_th/port_capability.h | 4 +-
.../spp_worker_th/ringlatencystats.c | 81 +++++++++++++++++++
.../spp_worker_th/ringlatencystats.h | 65 +++++++++++++++
src/shared/secondary/spp_worker_th/spp_port.c | 57 -------------
src/shared/secondary/spp_worker_th/spp_port.h | 34 --------
src/vf/Makefile | 2 +-
src/vf/classifier_mac.c | 16 ++++
src/vf/forwarder.c | 18 ++++-
src/vf/spp_vf.c | 9 ++-
18 files changed, 272 insertions(+), 174 deletions(-)
delete mode 100644 src/shared/secondary/spp_worker_th/spp_port.c
delete mode 100644 src/shared/secondary/spp_worker_th/spp_port.h
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [spp] [PATCH 1/2] shared/sec: fix compile error of ringlatencystats
2019-07-01 4:12 [spp] [PATCH 0/2] Fix compile errors of ring latency stats yasufum.o
@ 2019-07-01 4:12 ` yasufum.o
2019-07-01 4:12 ` [spp] [PATCH 2/2] shared/sec: remove source and header of spp_port yasufum.o
1 sibling, 0 replies; 3+ messages in thread
From: yasufum.o @ 2019-07-01 4:12 UTC (permalink / raw)
To: spp, ferruh.yigit, yasufum.o
From: Yasufumi Ogawa <yasufum.o@gmail.com>
As refactored each of burst functions of SPP workers in previous
patches, it causes compile errors if `DSPP_RINGLATENCYSTATS_ENABLE` is
activated in each of Makefiles.
This update is to fix this issue. Both of burst functions for
supporting ring latency statistics are moved to `ringlatencystats.c`.
Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
src/mirror/spp_mirror.c | 36 +++++++--
src/pcap/spp_pcap.c | 12 ++-
.../secondary/spp_worker_th/cmd_utils.c | 40 ---------
.../secondary/spp_worker_th/cmd_utils.h | 5 --
.../secondary/spp_worker_th/port_capability.c | 60 ++++++++++----
.../secondary/spp_worker_th/port_capability.h | 4 +-
.../spp_worker_th/ringlatencystats.c | 81 +++++++++++++++++++
.../spp_worker_th/ringlatencystats.h | 65 +++++++++++++++
src/shared/secondary/spp_worker_th/spp_port.c | 45 -----------
src/shared/secondary/spp_worker_th/spp_port.h | 24 ------
src/vf/Makefile | 3 +-
src/vf/classifier_mac.c | 17 ++++
src/vf/forwarder.c | 17 +++-
src/vf/spp_vf.c | 8 +-
14 files changed, 274 insertions(+), 143 deletions(-)
diff --git a/src/mirror/spp_mirror.c b/src/mirror/spp_mirror.c
index 37327c7..aefb4f5 100644
--- a/src/mirror/spp_mirror.c
+++ b/src/mirror/spp_mirror.c
@@ -21,6 +21,10 @@
#include "shared/secondary/spp_worker_th/spp_port.h"
#include "shared/secondary/spp_worker_th/port_capability.h"
+#ifdef SPP_RINGLATENCYSTATS_ENABLE
+#include "shared/secondary/spp_worker_th/ringlatencystats.h"
+#endif
+
/* Declare global variables */
#define RTE_LOGTYPE_MIRROR RTE_LOGTYPE_USER1
@@ -323,8 +327,14 @@ mirror_proc(int id)
return SPP_RET_OK;
rx = &path->ports[0].rx;
- /* Receive packets */
- nb_rx = sppwk_eth_rx_burst(rx->ethdev_port_id, 0, bufs, MAX_PKT_BURST);
+
+#ifdef SPP_RINGLATENCYSTATS_ENABLE
+ nb_rx = sppwk_eth_ring_stats_rx_burst(rx->ethdev_port_id,
+ rx->iface_type, rx->iface_no, 0, bufs, MAX_PKT_BURST);
+#else
+ nb_rx = rte_eth_rx_burst(rx->ethdev_port_id, 0, bufs, MAX_PKT_BURST);
+#endif
+
if (unlikely(nb_rx == 0))
return SPP_RET_OK;
@@ -378,15 +388,27 @@ mirror_proc(int id)
#endif /* SPP_MIRROR_SHALLOWCOPY */
}
+
if (cnt != 0)
- nb_tx2 = sppwk_eth_tx_burst(
- tx->ethdev_port_id, 0, copybufs, cnt);
+#ifdef SPP_RINGLATENCYSTATS_ENABLE
+ nb_tx2 = sppwk_eth_ring_stats_tx_burst(
+ tx->ethdev_port_id, tx->iface_type,
+ tx->iface_no, 0, copybufs, cnt);
+#else
+ nb_tx2 = rte_eth_tx_burst(tx->ethdev_port_id, 0,
+ copybufs, cnt);
+#endif
}
/* orginal */
tx = &path->ports[0].tx;
if (tx->ethdev_port_id >= 0)
- nb_tx1 = sppwk_eth_tx_burst(tx->ethdev_port_id, 0, bufs, nb_rx);
+#ifdef SPP_RINGLATENCYSTATS_ENABLE
+ nb_tx1 = sppwk_eth_ring_stats_tx_burst(tx->ethdev_port_id,
+ tx->iface_type, tx->iface_no, 0, bufs, nb_rx);
+#else
+ nb_tx1 = rte_eth_tx_burst(tx->ethdev_port_id, 0, bufs, nb_rx);
+#endif
nb_tx = nb_tx1;
if (nb_tx1 != nb_tx2)
@@ -533,7 +555,7 @@ main(int argc, char *argv[])
#ifdef SPP_RINGLATENCYSTATS_ENABLE
int ret_ringlatency = spp_ringlatencystats_init(
SPP_RING_LATENCY_STATS_SAMPLING_INTERVAL,
- g_iface_info.num_ring);
+ g_iface_info.nof_rings);
if (unlikely(ret_ringlatency != SPP_RET_OK))
break;
#endif /* SPP_RINGLATENCYSTATS_ENABLE */
@@ -583,7 +605,7 @@ main(int argc, char *argv[])
usleep(100);
#ifdef SPP_RINGLATENCYSTATS_ENABLE
- print_ring_latency_stats();
+ print_ring_latency_stats(&g_iface_info);
#endif /* SPP_RINGLATENCYSTATS_ENABLE */
}
diff --git a/src/pcap/spp_pcap.c b/src/pcap/spp_pcap.c
index bcce13f..909787d 100644
--- a/src/pcap/spp_pcap.c
+++ b/src/pcap/spp_pcap.c
@@ -21,6 +21,10 @@
#include "shared/secondary/spp_worker_th/spp_port.h"
#include "shared/secondary/spp_worker_th/port_capability.h"
+#ifdef SPP_RINGLATENCYSTATS_ENABLE
+#include "shared/secondary/spp_worker_th/ringlatencystats.h"
+#endif
+
/* Declare global variables */
#define RTE_LOGTYPE_SPP_PCAP RTE_LOGTYPE_USER2
@@ -750,8 +754,12 @@ static int pcap_proc_receive(int lcore_id)
/* Receive packets */
rx = &g_pcap_option.port_cap;
- nb_rx = sppwk_eth_rx_burst(rx->ethdev_port_id, 0, bufs,
- MAX_PCAP_BURST);
+#ifdef SPP_RINGLATENCYSTATS_ENABLE
+ nb_rx = sppwk_eth_ring_stats_rx_burst(rx->ethdev_port_id,
+ rx->iface_type, rx->iface_no, 0, bufs, MAX_PCAP_BURST);
+#else
+ nb_rx = rte_eth_rx_burst(rx->ethdev_port_id, 0, bufs, MAX_PCAP_BURST);
+#endif
if (unlikely(nb_rx == 0))
return SPPWK_RET_OK;
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.c b/src/shared/secondary/spp_worker_th/cmd_utils.c
index a4d8031..338054f 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.c
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.c
@@ -441,46 +441,6 @@ init_mng_data(void)
return SPP_RET_OK;
}
-#ifdef SPP_RINGLATENCYSTATS_ENABLE
-/* Print statistics of time for packet processing in ring interface */
-static void
-print_ring_latency_stats(void)
-{
- /* Clear screen and move cursor to top left */
- const char topLeft[] = { 27, '[', '1', ';', '1', 'H', '\0' };
- const char clr[] = { 27, '[', '2', 'J', '\0' };
- printf("%s%s", clr, topLeft);
-
- int ring_cnt, stats_cnt;
- struct spp_ringlatencystats_ring_latency_stats stats[RTE_MAX_ETHPORTS];
- memset(&stats, 0x00, sizeof(stats));
-
- struct iface_info *p_iface_info = g_mng_data_addr.p_iface_info;
- printf("RING Latency\n");
- printf(" RING");
- for (ring_cnt = 0; ring_cnt < RTE_MAX_ETHPORTS; ring_cnt++) {
- if (p_iface_info->ring[ring_cnt].iface_type == UNDEF)
- continue;
-
- spp_ringlatencystats_get_stats(ring_cnt, &stats[ring_cnt]);
- printf(", %-18d", ring_cnt);
- }
- printf("\n");
-
- for (stats_cnt = 0; stats_cnt < SPP_RINGLATENCYSTATS_STATS_SLOT_COUNT;
- stats_cnt++) {
- printf("%3dns", stats_cnt);
- for (ring_cnt = 0; ring_cnt < RTE_MAX_ETHPORTS; ring_cnt++) {
- if (p_iface_info->ring[ring_cnt].iface_type == UNDEF)
- continue;
-
- printf(", 0x%-16lx", stats[ring_cnt].slot[stats_cnt]);
- }
- printf("\n");
- }
-}
-#endif /* SPP_RINGLATENCYSTATS_ENABLE */
-
/* Remove sock file if spp is not running */
void
del_vhost_sockfile(struct sppwk_port_info *vhost)
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h
index 1d32228..6578cb8 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.h
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.h
@@ -378,11 +378,6 @@ void backup_mng_info(struct cancel_backup_info *backup);
/* 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 */
-void print_ring_latency_stats(void);
-#endif /* SPP_RINGLATENCYSTATS_ENABLE */
-
/* Remove sock file if spp is not running */
void del_vhost_sockfile(struct sppwk_port_info *vhost);
diff --git a/src/shared/secondary/spp_worker_th/port_capability.c b/src/shared/secondary/spp_worker_th/port_capability.c
index db12f0c..917d5fc 100644
--- a/src/shared/secondary/spp_worker_th/port_capability.c
+++ b/src/shared/secondary/spp_worker_th/port_capability.c
@@ -10,7 +10,10 @@
#include "port_capability.h"
#include "shared/secondary/return_codes.h"
+
+#ifdef SPP_RINGLATENCYSTATS_ENABLE
#include "ringlatencystats.h"
+#endif
/**
* TODO(yasufum) This `port capability` is intended to be used mainly for VLAN
@@ -372,7 +375,6 @@ vlan_operation(uint16_t port_id, struct rte_mbuf **pkts, const uint16_t nb_pkts,
return ok_pkts;
}
-/* TODO(yasufum) move to outside of this file. */
/* Wrapper function for rte_eth_rx_burst() with VLAN feature. */
uint16_t
sppwk_eth_vlan_rx_burst(uint16_t port_id,
@@ -384,22 +386,53 @@ sppwk_eth_vlan_rx_burst(uint16_t port_id,
if (unlikely(nb_rx == 0))
return SPP_RET_OK;
+ /* Add or delete VLAN tag. */
+ return vlan_operation(port_id, rx_pkts, nb_rx, SPPWK_PORT_DIR_RX);
+}
+
+/* Wrapper function for rte_eth_tx_burst() with VLAN feature. */
+uint16_t
+sppwk_eth_vlan_tx_burst(uint16_t port_id,
+ uint16_t queue_id __attribute__ ((unused)),
+ struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
+{
+ uint16_t nb_tx;
+
+ /* Add or delete VLAN tag. */
+ nb_tx = vlan_operation(port_id, tx_pkts, nb_pkts, SPPWK_PORT_DIR_TX);
+
+ if (unlikely(nb_tx == 0))
+ return SPP_RET_OK;
+
+ return rte_eth_tx_burst(port_id, 0, tx_pkts, nb_tx);
+}
+
#ifdef SPP_RINGLATENCYSTATS_ENABLE
- if (g_port_mng_info[port_id].iface_type == RING)
- spp_ringlatencystats_calculate_latency(
- g_port_mng_info[port_id].iface_no,
+
+/* Wrapper function for rte_eth_rx_burst() with VLAN feature. */
+uint16_t
+sppwk_eth_vlan_ring_stats_rx_burst(uint16_t port_id,
+ enum port_type iface_type, int iface_no,
+ uint16_t queue_id __attribute__ ((unused)),
+ struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
+{
+ uint16_t nb_rx;
+ nb_rx = rte_eth_rx_burst(port_id, 0, rx_pkts, nb_pkts);
+ if (unlikely(nb_rx == 0))
+ return SPP_RET_OK;
+
+ if (iface_type == RING)
+ spp_ringlatencystats_calculate_latency(iface_no,
rx_pkts, nb_pkts);
-#endif /* SPP_RINGLATENCYSTATS_ENABLE */
/* Add or delete VLAN tag. */
return vlan_operation(port_id, rx_pkts, nb_rx, SPPWK_PORT_DIR_RX);
}
-
-/* TODO(yasufum) move to outside of this file. */
/* Wrapper function for rte_eth_tx_burst() with VLAN feature. */
uint16_t
-sppwk_eth_vlan_tx_burst(uint16_t port_id,
+sppwk_eth_vlan_ring_stats_tx_burst(uint16_t port_id,
+ enum port_type iface_type, int iface_no,
uint16_t queue_id __attribute__ ((unused)),
struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
{
@@ -411,12 +444,11 @@ sppwk_eth_vlan_tx_burst(uint16_t port_id,
if (unlikely(nb_tx == 0))
return SPP_RET_OK;
-#ifdef SPP_RINGLATENCYSTATS_ENABLE
- if (g_port_mng_info[port_id].iface_type == RING)
- spp_ringlatencystats_add_time_stamp(
- g_port_mng_info[port_id].iface_no,
- tx_pkts, nb_pkts);
-#endif /* SPP_RINGLATENCYSTATS_ENABLE */
+ if (iface_type == RING) {
+ spp_ringlatencystats_add_time_stamp(iface_no, tx_pkts, nb_pkts);
+ }
return rte_eth_tx_burst(port_id, 0, tx_pkts, nb_tx);
}
+
+#endif /* SPP_RINGLATENCYSTATS_ENABLE */
diff --git a/src/shared/secondary/spp_worker_th/port_capability.h b/src/shared/secondary/spp_worker_th/port_capability.h
index 0593f10..284ba30 100644
--- a/src/shared/secondary/spp_worker_th/port_capability.h
+++ b/src/shared/secondary/spp_worker_th/port_capability.h
@@ -59,7 +59,7 @@ void sppwk_swap_two_sides(
void sppwk_update_port_dir(const struct sppwk_comp_info *comp);
/**
- * Wrapper function for rte_eth_rx_burst() with ring latency feature.
+ * Wrapper function for rte_eth_rx_burst() with VLAN feature.
*
* @param[in] port_id Etherdev ID.
* @param[in] queue_id RX queue ID, but fixed value 0 in SPP.
@@ -71,7 +71,7 @@ uint16_t sppwk_eth_vlan_rx_burst(uint16_t port_id, uint16_t queue_id,
struct rte_mbuf **rx_pkts, const uint16_t nb_pkts);
/**
- * Wrapper function for rte_eth_tx_burst() with ring latency feature.
+ * Wrapper function for rte_eth_tx_burst() with VLAN feature.
*
* @param port_id Etherdev ID.
* @param[in] queue_id TX queue ID, but fixed value 0 in SPP.
diff --git a/src/shared/secondary/spp_worker_th/ringlatencystats.c b/src/shared/secondary/spp_worker_th/ringlatencystats.c
index e0cc1aa..5678e37 100644
--- a/src/shared/secondary/spp_worker_th/ringlatencystats.c
+++ b/src/shared/secondary/spp_worker_th/ringlatencystats.c
@@ -16,6 +16,8 @@
#include "ringlatencystats.h"
#include "cmd_utils.h"
+#include "port_capability.h"
+#include "../return_codes.h"
#define NS_PER_SEC 1E9
@@ -160,4 +162,83 @@ spp_ringlatencystats_get_stats(int ring_id,
sizeof(struct spp_ringlatencystats_ring_latency_stats));
}
+/* Print statistics of time for packet processing in ring interface */
+void
+print_ring_latency_stats(struct iface_info *if_info)
+{
+ /* Clear screen and move cursor to top left */
+ const char topLeft[] = { 27, '[', '1', ';', '1', 'H', '\0' };
+ const char clr[] = { 27, '[', '2', 'J', '\0' };
+ printf("%s%s", clr, topLeft);
+
+ int ring_cnt, stats_cnt;
+ struct spp_ringlatencystats_ring_latency_stats stats[RTE_MAX_ETHPORTS];
+ memset(&stats, 0x00, sizeof(stats));
+
+ printf("RING Latency\n");
+ printf(" RING");
+ for (ring_cnt = 0; ring_cnt < RTE_MAX_ETHPORTS; ring_cnt++) {
+ if (if_info->ring[ring_cnt].iface_type == UNDEF)
+ continue;
+
+ spp_ringlatencystats_get_stats(ring_cnt, &stats[ring_cnt]);
+ printf(", %-18d", ring_cnt);
+ }
+ printf("\n");
+
+ for (stats_cnt = 0; stats_cnt < SPP_RINGLATENCYSTATS_STATS_SLOT_COUNT;
+ stats_cnt++) {
+ printf("%3dns", stats_cnt);
+ for (ring_cnt = 0; ring_cnt < RTE_MAX_ETHPORTS; ring_cnt++) {
+ if (if_info->ring[ring_cnt].iface_type == UNDEF)
+ continue;
+
+ printf(", 0x%-16lx", stats[ring_cnt].slot[stats_cnt]);
+ }
+ printf("\n");
+ }
+}
+
+/* Wrapper function for rte_eth_rx_burst() with ring latency feature. */
+uint16_t
+sppwk_eth_ring_stats_rx_burst(uint16_t port_id,
+ enum port_type iface_type,
+ int iface_no,
+ uint16_t queue_id __attribute__ ((unused)),
+ struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
+{
+ uint16_t nb_rx;
+
+ nb_rx = rte_eth_rx_burst(port_id, 0, rx_pkts, nb_pkts);
+
+ /* TODO(yasufum) confirm why it returns SPP_RET_OK. */
+ if (unlikely(nb_rx == 0))
+ return SPP_RET_OK;
+
+ if (iface_type == RING)
+ spp_ringlatencystats_calculate_latency(
+ iface_no,
+ rx_pkts, nb_pkts);
+ return nb_rx;
+}
+
+/* Wrapper function for rte_eth_tx_burst() with ring latency feature. */
+uint16_t
+sppwk_eth_ring_stats_tx_burst(uint16_t port_id,
+ enum port_type iface_type,
+ int iface_no,
+ uint16_t queue_id __attribute__ ((unused)),
+ struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
+{
+ uint16_t nb_tx;
+
+ nb_tx = rte_eth_tx_burst(port_id, 0, tx_pkts, nb_pkts);
+
+ if (iface_type == RING)
+ spp_ringlatencystats_add_time_stamp(
+ iface_no,
+ tx_pkts, nb_pkts);
+ return nb_tx;
+}
+
#endif /* SPP_RINGLATENCYSTATS_ENABLE */
diff --git a/src/shared/secondary/spp_worker_th/ringlatencystats.h b/src/shared/secondary/spp_worker_th/ringlatencystats.h
index b919c62..33c456d 100644
--- a/src/shared/secondary/spp_worker_th/ringlatencystats.h
+++ b/src/shared/secondary/spp_worker_th/ringlatencystats.h
@@ -13,6 +13,7 @@
*/
#include <rte_mbuf.h>
+#include "cmd_utils.h"
/** number of slots to save latency. 0ns~99ns and 100ns over */
#define SPP_RINGLATENCYSTATS_STATS_SLOT_COUNT 101
@@ -93,6 +94,65 @@ int spp_ringlatencystats_get_count(void);
void spp_ringlatencystats_get_stats(int ring_id,
struct spp_ringlatencystats_ring_latency_stats *stats);
+/* Print statistics of time for packet processing in ring interface */
+void print_ring_latency_stats(struct iface_info *if_info);
+
+/**
+ * Wrapper function for rte_eth_rx_burst() with ring latency feature.
+ *
+ * @param[in] port_id Etherdev ID.
+ * @param[in] queue_id RX queue ID, but fixed value 0 in SPP.
+ * @param[in] rx_pkts Pointers to mbuf should be enough to store nb_pkts.
+ * @param nb_pkts Maximum number of RX packets.
+ * @return Number of RX packets as number of pointers to mbuf.
+ */
+uint16_t sppwk_eth_ring_stats_rx_burst(uint16_t port_id,
+ enum port_type iface_type,
+ int iface_no, uint16_t queue_id,
+ struct rte_mbuf **rx_pkts, const uint16_t nb_pkts);
+
+/**
+ * Wrapper function for rte_eth_tx_burst() with ring latency feature.
+ *
+ * @param port_id Etherdev ID.
+ * @param[in] queue_id TX queue ID, but fixed value 0 in SPP.
+ * @param[in] tx_pkts Pointers to mbuf should be enough to store nb_pkts.
+ * @param nb_pkts Maximum number of TX packets.
+ * @return Number of TX packets as number of pointers to mbuf.
+ */
+uint16_t sppwk_eth_ring_stats_tx_burst(uint16_t port_id,
+ enum port_type iface_type,
+ int iface_no, uint16_t queue_id,
+ struct rte_mbuf **tx_pkts, uint16_t nb_pkts);
+
+/**
+ * Wrapper function for rte_eth_rx_burst() with VLAN and ring latency feature.
+ *
+ * @param[in] port_id Etherdev ID.
+ * @param[in] queue_id RX queue ID, but fixed value 0 in SPP.
+ * @param[in] rx_pkts Pointers to mbuf should be enough to store nb_pkts.
+ * @param nb_pkts Maximum number of RX packets.
+ * @return Number of RX packets as number of pointers to mbuf.
+ */
+uint16_t sppwk_eth_vlan_ring_stats_rx_burst(uint16_t port_id,
+ enum port_type iface_type,
+ int iface_no, uint16_t queue_id,
+ struct rte_mbuf **rx_pkts, const uint16_t nb_pkts);
+
+/**
+ * Wrapper function for rte_eth_tx_burst() with VLAN and ring latency feature.
+ *
+ * @param port_id Etherdev ID.
+ * @param[in] queue_id TX queue ID, but fixed value 0 in SPP.
+ * @param[in] tx_pkts Pointers to mbuf should be enough to store nb_pkts.
+ * @param nb_pkts Maximum number of TX packets.
+ * @return Number of TX packets as number of pointers to mbuf.
+ */
+uint16_t sppwk_eth_vlan_ring_stats_tx_burst(uint16_t port_id,
+ enum port_type iface_type,
+ int iface_no, uint16_t queue_id,
+ struct rte_mbuf **tx_pkts, uint16_t nb_pkts);
+
#else
#define spp_ringlatencystats_init(arg1, arg2) 0
@@ -101,6 +161,11 @@ void spp_ringlatencystats_get_stats(int ring_id,
#define spp_ringlatencystats_calculate_latency(arg1, arg2, arg3)
#define spp_ringlatencystats_get_count() 0
#define spp_ringlatencystats_get_stats(arg1, arg2)
+#define print_ringlatencystats_stats(arg)
+#define sppwk_eth_ring_stats_rx_burst(arg1, arg2, arg3, arg4, arg5, arg6)
+#define sppwk_eth_ring_stats_tx_burst(arg1, arg2, arg3, arg4, arg5, arg6)
+#define sppwk_eth_vlan_ring_stats_rx_burst(arg1, arg2, arg3, arg4, arg5, arg6)
+#define sppwk_eth_vlan_ring_stats_tx_burst(arg1, arg2, arg3, arg4, arg5, arg6)
#endif /* SPP_RINGLATENCYSTATS_ENABLE */
diff --git a/src/shared/secondary/spp_worker_th/spp_port.c b/src/shared/secondary/spp_worker_th/spp_port.c
index 0c7df2b..66f73df 100644
--- a/src/shared/secondary/spp_worker_th/spp_port.c
+++ b/src/shared/secondary/spp_worker_th/spp_port.c
@@ -10,48 +10,3 @@
#include "spp_port.h"
#include "shared/secondary/return_codes.h"
-#include "ringlatencystats.h"
-
-/* Wrapper function for rte_eth_rx_burst() with ring latency feature. */
-uint16_t
-sppwk_eth_rx_burst(uint16_t port_id,
- uint16_t queue_id __attribute__ ((unused)),
- struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
-{
- uint16_t nb_rx;
-
- nb_rx = rte_eth_rx_burst(port_id, 0, rx_pkts, nb_pkts);
-
- /* TODO(yasufum) confirm why it returns SPP_RET_OK. */
- if (unlikely(nb_rx == 0))
- return SPP_RET_OK;
-
-#ifdef SPP_RINGLATENCYSTATS_ENABLE
- if (g_port_mng_info[port_id].iface_type == RING)
- spp_ringlatencystats_calculate_latency(
- g_port_mng_info[port_id].iface_no,
- rx_pkts, nb_pkts);
-#endif /* SPP_RINGLATENCYSTATS_ENABLE */
-
- return nb_rx;
-}
-
-/* Wrapper function for rte_eth_tx_burst() with ring latency feature. */
-uint16_t
-sppwk_eth_tx_burst(uint16_t port_id,
- uint16_t queue_id __attribute__ ((unused)),
- struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
-{
- uint16_t nb_tx;
-
- nb_tx = rte_eth_tx_burst(port_id, 0, tx_pkts, nb_pkts);
-
-#ifdef SPP_RINGLATENCYSTATS_ENABLE
- if (g_port_mng_info[port_id].iface_type == RING)
- spp_ringlatencystats_add_time_stamp(
- g_port_mng_info[port_id].iface_no,
- tx_pkts, nb_pkts);
-#endif /* SPP_RINGLATENCYSTATS_ENABLE */
-
- return nb_tx;
-}
diff --git a/src/shared/secondary/spp_worker_th/spp_port.h b/src/shared/secondary/spp_worker_th/spp_port.h
index eaeaea5..9b6132b 100644
--- a/src/shared/secondary/spp_worker_th/spp_port.h
+++ b/src/shared/secondary/spp_worker_th/spp_port.h
@@ -7,28 +7,4 @@
#include "cmd_utils.h"
-/**
- * Wrapper function for rte_eth_rx_burst() with ring latency feature.
- *
- * @param[in] port_id Etherdev ID.
- * @param[in] queue_id RX queue ID, but fixed value 0 in SPP.
- * @param[in] rx_pkts Pointers to mbuf should be enough to store nb_pkts.
- * @param nb_pkts Maximum number of RX packets.
- * @return Number of RX packets as number of pointers to mbuf.
- */
-uint16_t sppwk_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
- struct rte_mbuf **rx_pkts, const uint16_t nb_pkts);
-
-/**
- * Wrapper function for rte_eth_tx_burst() with ring latency feature.
- *
- * @param port_id Etherdev ID.
- * @param[in] queue_id TX queue ID, but fixed value 0 in SPP.
- * @param[in] tx_pkts Pointers to mbuf should be enough to store nb_pkts.
- * @param nb_pkts Maximum number of TX packets.
- * @return Number of TX packets as number of pointers to mbuf.
- */
-uint16_t sppwk_eth_tx_burst(uint16_t port_id, uint16_t queue_id,
- struct rte_mbuf **tx_pkts, uint16_t nb_pkts);
-
#endif /* __WK_SPP_PORT_H__ */
diff --git a/src/vf/Makefile b/src/vf/Makefile
index 35f13e5..07870ac 100644
--- a/src/vf/Makefile
+++ b/src/vf/Makefile
@@ -19,14 +19,15 @@ SRCS-y := spp_vf.c classifier_mac.c forwarder.c
SRCS-y += $(SPP_SEC_DIR)/string_buffer.c
SRCS-y += $(SPP_SEC_DIR)/json_helper.c
SRCS-y += $(SPP_SEC_DIR)/utils.c $(SPP_SEC_DIR)/add_port.c
+SRCS-y += $(SPP_WKT_DIR)/spp_port.c
SRCS-y += $(SPP_WKT_DIR)/ringlatencystats.c
SRCS-y += $(SPP_WKT_DIR)/port_capability.c
SRCS-y += $(SPP_WKT_DIR)/conn_spp_ctl.c
SRCS-y += $(SPP_WKT_DIR)/cmd_parser.c
-SRCS-y += ../shared/common.c
SRCS-y += $(SPP_WKT_DIR)/cmd_runner.c
SRCS-y += $(SPP_WKT_DIR)/cmd_utils.c
SRCS-y += $(SPP_WKT_DIR)/cmd_res_formatter.c
+SRCS-y += ../shared/common.c
SRCS-y += vf_cmd_runner.c
CFLAGS += -DALLOW_EXPERIMENTAL_API
diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index e41c65a..893f01d 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -28,8 +28,13 @@
#include "shared/secondary/json_helper.h"
#include "shared/secondary/spp_worker_th/cmd_res_formatter.h"
#include "shared/secondary/spp_worker_th/vf_deps.h"
+#include "shared/secondary/spp_worker_th/spp_port.h"
#include "shared/secondary/spp_worker_th/port_capability.h"
+#ifdef SPP_RINGLATENCYSTATS_ENABLE
+#include "shared/secondary/spp_worker_th/ringlatencystats.h"
+#endif
+
#define RTE_LOGTYPE_SPP_CLASSIFIER_MAC RTE_LOGTYPE_USER1
#ifdef RTE_MACHINE_CPUFLAG_SSE4_2
@@ -460,8 +465,14 @@ transmit_packet(struct cls_port_info *clsd_data)
uint16_t n_tx;
/* transmit packets */
+#ifdef SPP_RINGLATENCYSTATS_ENABLE
+ n_tx = sppwk_eth_vlan_ring_stats_tx_burst(clsd_data->ethdev_port_id,
+ clsd_data->iface_type, clsd_data->iface_no,
+ 0, clsd_data->pkts, clsd_data->nof_pkts);
+#else
n_tx = sppwk_eth_vlan_tx_burst(clsd_data->ethdev_port_id, 0,
clsd_data->pkts, clsd_data->nof_pkts);
+#endif
/* free cannot transmit packets */
if (unlikely(n_tx != clsd_data->nof_pkts)) {
@@ -796,8 +807,14 @@ spp_classifier_mac_do(int id)
return SPP_RET_OK;
/* retrieve packets */
+#ifdef SPP_RINGLATENCYSTATS_ENABLE
+ n_rx = sppwk_eth_vlan_ring_stats_rx_burst(clsd_data_rx->ethdev_port_id,
+ clsd_data_rx->iface_type, clsd_data_rx->iface_no,
+ 0, rx_pkts, MAX_PKT_BURST);
+#else
n_rx = sppwk_eth_vlan_rx_burst(clsd_data_rx->ethdev_port_id, 0,
rx_pkts, MAX_PKT_BURST);
+#endif
if (unlikely(n_rx == 0))
return SPP_RET_OK;
diff --git a/src/vf/forwarder.c b/src/vf/forwarder.c
index cd28a58..5a061ad 100644
--- a/src/vf/forwarder.c
+++ b/src/vf/forwarder.c
@@ -11,6 +11,10 @@
#include "shared/secondary/spp_worker_th/spp_port.h"
#include "shared/secondary/spp_worker_th/port_capability.h"
+#ifdef SPP_RINGLATENCYSTATS_ENABLE
+#include "shared/secondary/spp_worker_th/ringlatencystats.h"
+#endif
+
#define RTE_LOGTYPE_FORWARD RTE_LOGTYPE_USER1
/* A set of port info of rx and tx */
@@ -211,16 +215,27 @@ forward_packets(int id)
rx = &path->ports[cnt].rx;
tx = &path->ports[cnt].tx;
- /* Receive packets */
+#ifdef SPP_RINGLATENCYSTATS_ENABLE
+ nb_rx = sppwk_eth_vlan_ring_stats_rx_burst(rx->ethdev_port_id,
+ rx->iface_type, rx->iface_no, 0,
+ bufs, MAX_PKT_BURST);
+#else
nb_rx = sppwk_eth_vlan_rx_burst(rx->ethdev_port_id, 0,
bufs, MAX_PKT_BURST);
+#endif
if (unlikely(nb_rx == 0))
continue;
/* Send packets */
if (tx->ethdev_port_id >= 0)
+#ifdef SPP_RINGLATENCYSTATS_ENABLE
+ nb_tx = sppwk_eth_vlan_ring_stats_tx_burst(
+ tx->ethdev_port_id, tx->iface_type,
+ tx->iface_no, 0, bufs, nb_rx);
+#else
nb_tx = sppwk_eth_vlan_tx_burst(tx->ethdev_port_id,
0, bufs, nb_rx);
+#endif
/* Discard remained packets to release mbuf */
if (unlikely(nb_tx < nb_rx)) {
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index dbd47bf..1ef8e4f 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -18,6 +18,10 @@
#include "shared/secondary/spp_worker_th/spp_port.h"
#include "shared/secondary/spp_worker_th/port_capability.h"
+#ifdef SPP_RINGLATENCYSTATS_ENABLE
+#include "shared/secondary/spp_worker_th/ringlatencystats.h"
+#endif
+
/* Declare global variables */
/* Interface management information */
static struct iface_info g_iface_info;
@@ -260,7 +264,7 @@ main(int argc, char *argv[])
#ifdef SPP_RINGLATENCYSTATS_ENABLE
int ret_ringlatency = spp_ringlatencystats_init(
SPP_RING_LATENCY_STATS_SAMPLING_INTERVAL,
- g_iface_info.num_ring);
+ g_iface_info.nof_rings);
if (unlikely(ret_ringlatency != SPP_RET_OK))
break;
#endif /* SPP_RINGLATENCYSTATS_ENABLE */
@@ -304,7 +308,7 @@ main(int argc, char *argv[])
usleep(100);
#ifdef SPP_RINGLATENCYSTATS_ENABLE
- print_ring_latency_stats();
+ print_ring_latency_stats(&g_iface_info);
#endif /* SPP_RINGLATENCYSTATS_ENABLE */
}
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [spp] [PATCH 2/2] shared/sec: remove source and header of spp_port
2019-07-01 4:12 [spp] [PATCH 0/2] Fix compile errors of ring latency stats yasufum.o
2019-07-01 4:12 ` [spp] [PATCH 1/2] shared/sec: fix compile error of ringlatencystats yasufum.o
@ 2019-07-01 4:12 ` yasufum.o
1 sibling, 0 replies; 3+ messages in thread
From: yasufum.o @ 2019-07-01 4:12 UTC (permalink / raw)
To: spp, ferruh.yigit, yasufum.o
From: Yasufumi Ogawa <yasufum.o@gmail.com>
This update is to remove `spp_port.c` and `spp_port.h` because burst
functions define in these files are moved to others and no needed
anymore.
Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
src/mirror/Makefile | 1 -
src/mirror/spp_mirror.c | 1 -
src/pcap/Makefile | 1 -
src/pcap/spp_pcap.c | 1 -
.../secondary/spp_worker_th/cmd_res_formatter.c | 1 -
src/shared/secondary/spp_worker_th/cmd_runner.c | 1 -
src/shared/secondary/spp_worker_th/cmd_utils.c | 1 -
src/shared/secondary/spp_worker_th/spp_port.c | 12 ------------
src/shared/secondary/spp_worker_th/spp_port.h | 10 ----------
src/vf/Makefile | 1 -
src/vf/classifier_mac.c | 1 -
src/vf/forwarder.c | 1 -
src/vf/spp_vf.c | 1 -
13 files changed, 33 deletions(-)
delete mode 100644 src/shared/secondary/spp_worker_th/spp_port.c
delete mode 100644 src/shared/secondary/spp_worker_th/spp_port.h
diff --git a/src/mirror/Makefile b/src/mirror/Makefile
index 69ff91e..af9667e 100644
--- a/src/mirror/Makefile
+++ b/src/mirror/Makefile
@@ -21,7 +21,6 @@ SRCS-y += $(SPP_SEC_DIR)/utils.c $(SPP_SEC_DIR)/add_port.c
SRCS-y += $(SPP_SEC_DIR)/json_helper.c
SRCS-y += $(SPP_SEC_DIR)/string_buffer.c
SRCS-y += $(SPP_WKT_DIR)/cmd_utils.c
-SRCS-y += $(SPP_WKT_DIR)/spp_port.c
SRCS-y += $(SPP_WKT_DIR)/port_capability.c
SRCS-y += $(SPP_WKT_DIR)/conn_spp_ctl.c
SRCS-y += $(SPP_WKT_DIR)/cmd_parser.c
diff --git a/src/mirror/spp_mirror.c b/src/mirror/spp_mirror.c
index aefb4f5..e6352cf 100644
--- a/src/mirror/spp_mirror.c
+++ b/src/mirror/spp_mirror.c
@@ -18,7 +18,6 @@
#include "shared/secondary/spp_worker_th/cmd_runner.h"
#include "shared/secondary/spp_worker_th/cmd_parser.h"
#include "shared/secondary/spp_worker_th/cmd_utils.h"
-#include "shared/secondary/spp_worker_th/spp_port.h"
#include "shared/secondary/spp_worker_th/port_capability.h"
#ifdef SPP_RINGLATENCYSTATS_ENABLE
diff --git a/src/pcap/Makefile b/src/pcap/Makefile
index 640c0d3..6273b41 100644
--- a/src/pcap/Makefile
+++ b/src/pcap/Makefile
@@ -22,7 +22,6 @@ SRCS-y += ../shared/common.c
SRCS-y += $(SPP_SEC_DIR)/utils.c
SRCS-y += $(SPP_SEC_DIR)/string_buffer.c
SRCS-y += $(SPP_WKT_DIR)/conn_spp_ctl.c
-SRCS-y += $(SPP_WKT_DIR)/spp_port.c
SRCS-y += $(SPP_WKT_DIR)/port_capability.c
SRCS-y += $(SPP_WKT_DIR)/ringlatencystats.c
diff --git a/src/pcap/spp_pcap.c b/src/pcap/spp_pcap.c
index 909787d..79d155c 100644
--- a/src/pcap/spp_pcap.c
+++ b/src/pcap/spp_pcap.c
@@ -18,7 +18,6 @@
#include "cmd_runner.h"
#include "cmd_parser.h"
#include "shared/secondary/utils.h"
-#include "shared/secondary/spp_worker_th/spp_port.h"
#include "shared/secondary/spp_worker_th/port_capability.h"
#ifdef SPP_RINGLATENCYSTATS_ENABLE
diff --git a/src/shared/secondary/spp_worker_th/cmd_res_formatter.c b/src/shared/secondary/spp_worker_th/cmd_res_formatter.c
index 1485533..00d9466 100644
--- a/src/shared/secondary/spp_worker_th/cmd_res_formatter.c
+++ b/src/shared/secondary/spp_worker_th/cmd_res_formatter.c
@@ -3,7 +3,6 @@
*/
#include "cmd_res_formatter.h"
-#include "spp_port.h"
#include "port_capability.h"
#include "cmd_utils.h"
#include "shared/secondary/json_helper.h"
diff --git a/src/shared/secondary/spp_worker_th/cmd_runner.c b/src/shared/secondary/spp_worker_th/cmd_runner.c
index 4e43fe6..d11dfc9 100644
--- a/src/shared/secondary/spp_worker_th/cmd_runner.c
+++ b/src/shared/secondary/spp_worker_th/cmd_runner.c
@@ -9,7 +9,6 @@
#include <rte_branch_prediction.h>
#include "cmd_runner.h"
-#include "spp_port.h"
#include "cmd_res_formatter.h"
#include "conn_spp_ctl.h"
#include "cmd_parser.h"
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.c b/src/shared/secondary/spp_worker_th/cmd_utils.c
index 338054f..e77dbe7 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.c
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.c
@@ -12,7 +12,6 @@
#include <rte_branch_prediction.h>
#include "cmd_utils.h"
-#include "spp_port.h"
#include "shared/secondary/add_port.h"
#include "shared/secondary/return_codes.h"
diff --git a/src/shared/secondary/spp_worker_th/spp_port.c b/src/shared/secondary/spp_worker_th/spp_port.c
deleted file mode 100644
index 66f73df..0000000
--- a/src/shared/secondary/spp_worker_th/spp_port.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2017-2018 Nippon Telegraph and Telephone Corporation
- */
-
-#include <rte_ether.h>
-#include <rte_ip.h>
-#include <rte_udp.h>
-#include <rte_tcp.h>
-#include <rte_net_crc.h>
-
-#include "spp_port.h"
-#include "shared/secondary/return_codes.h"
diff --git a/src/shared/secondary/spp_worker_th/spp_port.h b/src/shared/secondary/spp_worker_th/spp_port.h
deleted file mode 100644
index 9b6132b..0000000
--- a/src/shared/secondary/spp_worker_th/spp_port.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2017-2018 Nippon Telegraph and Telephone Corporation
- */
-
-#ifndef __WK_SPP_PORT_H__
-#define __WK_SPP_PORT_H__
-
-#include "cmd_utils.h"
-
-#endif /* __WK_SPP_PORT_H__ */
diff --git a/src/vf/Makefile b/src/vf/Makefile
index 07870ac..92d2854 100644
--- a/src/vf/Makefile
+++ b/src/vf/Makefile
@@ -19,7 +19,6 @@ SRCS-y := spp_vf.c classifier_mac.c forwarder.c
SRCS-y += $(SPP_SEC_DIR)/string_buffer.c
SRCS-y += $(SPP_SEC_DIR)/json_helper.c
SRCS-y += $(SPP_SEC_DIR)/utils.c $(SPP_SEC_DIR)/add_port.c
-SRCS-y += $(SPP_WKT_DIR)/spp_port.c
SRCS-y += $(SPP_WKT_DIR)/ringlatencystats.c
SRCS-y += $(SPP_WKT_DIR)/port_capability.c
SRCS-y += $(SPP_WKT_DIR)/conn_spp_ctl.c
diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index 893f01d..8273726 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -28,7 +28,6 @@
#include "shared/secondary/json_helper.h"
#include "shared/secondary/spp_worker_th/cmd_res_formatter.h"
#include "shared/secondary/spp_worker_th/vf_deps.h"
-#include "shared/secondary/spp_worker_th/spp_port.h"
#include "shared/secondary/spp_worker_th/port_capability.h"
#ifdef SPP_RINGLATENCYSTATS_ENABLE
diff --git a/src/vf/forwarder.c b/src/vf/forwarder.c
index 5a061ad..ba93df5 100644
--- a/src/vf/forwarder.c
+++ b/src/vf/forwarder.c
@@ -8,7 +8,6 @@
#include "spp_vf.h"
#include "shared/secondary/return_codes.h"
#include "shared/secondary/spp_worker_th/vf_deps.h"
-#include "shared/secondary/spp_worker_th/spp_port.h"
#include "shared/secondary/spp_worker_th/port_capability.h"
#ifdef SPP_RINGLATENCYSTATS_ENABLE
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index 1ef8e4f..d7dd5d0 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -15,7 +15,6 @@
#include "shared/secondary/add_port.h"
#include "shared/secondary/spp_worker_th/cmd_runner.h"
#include "shared/secondary/spp_worker_th/cmd_parser.h"
-#include "shared/secondary/spp_worker_th/spp_port.h"
#include "shared/secondary/spp_worker_th/port_capability.h"
#ifdef SPP_RINGLATENCYSTATS_ENABLE
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-01 4:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-01 4:12 [spp] [PATCH 0/2] Fix compile errors of ring latency stats yasufum.o
2019-07-01 4:12 ` [spp] [PATCH 1/2] shared/sec: fix compile error of ringlatencystats yasufum.o
2019-07-01 4:12 ` [spp] [PATCH 2/2] shared/sec: remove source and header of spp_port 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).