examples/l2fwd-event: move structures to common header
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 3/39 examples/l2fwd-event: move structures to common header
--- examples/l2fwd-event/l2fwd_common.h | 12 ++++++++++++ examples/l2fwd-event/main.c | 10 ---------- 2 files changed, 12 insertions(+), 10 deletions(-)
examples/l2fwd-event/l2fwd_common.h +12 -0
@@ -22,4 +22,16 @@#define MAX_TIMER_PERIOD 86400/* 1 day max */ +struct lcore_queue_conf { +unsigned int n_rx_port; +unsigned int rx_port_list[MAX_RX_QUEUE_PER_LCORE ]; +} __rte_cache_aligned; + +/* Per-port statistics struct */ +struct l2fwd_port_statistics { +uint64_t tx; +uint64_t rx; +uint64_t dropped; +} __rte_cache_aligned; +#endif /* _L2FWD_COMMON_H_ */
examples/l2fwd-event/main.c +0 -10
@@ -61,10 +61,6 @@ static uint32_t l2fwd_dst_ports[RTE_MAX_ETHPORTS];static unsigned int l2fwd_rx_queue_per_lcore =1 ; -struct lcore_queue_conf { -unsigned int n_rx_port; -unsigned int rx_port_list[MAX_RX_QUEUE_PER_LCORE ]; -} __rte_cache_aligned;struct lcore_queue_conf lcore_queue_conf[RTE_MAX_LCORE ];static struct rte_eth_dev_tx_buffer *tx_buffer[RTE_MAX_ETHPORTS ];
@@ -80,12 +76,6 @@ static struct rte_eth_conf port_conf = {struct rte_mempool *l2fwd_pktmbuf_pool; -/* Per-port statistics struct */ -struct l2fwd_port_statistics { -uint64_t tx; -uint64_t rx; -uint64_t dropped; -} __rte_cache_aligned;struct l2fwd_port_statistics port_statistics[RTE_MAX_ETHPORTS ];/* A tsc-based timer responsible for triggering statistics printout */
Signature · 1 line
2.7.4
PATCH 4/39 examples/l2fwd-event: move global vars to common header
In reply to a message not in the archive--- examples/l2fwd-event/l2fwd_common.h | 26 +++++++++++++++++++++++ examples/l2fwd-event/main.c | 41 +++++++++++++++---------------------- 2 files changed, 43 insertions(+), 24 deletions(-)
examples/l2fwd-event/l2fwd_common.h +26 -0
@@ -5,6 +5,10 @@#ifndef _L2FWD_COMMON_H_#define _L2FWD_COMMON_H_ +#include <stdbool.h> + +#include <rte_common.h> +#define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1#define MAX_PKT_BURST 32
@@ -34,4 +38,26 @@ struct l2fwd_port_statistics { uint64_t dropped; } __rte_cache_aligned; +volatile bool force_quit; + +int mac_updating; + +/* ethernet addresses of ports */ +static struct rte_ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS ]; + +/* mask of enabled ports */ +static uint32_t l2fwd_enabled_port_mask; + +/* list of enabled ports */ +static uint32_t l2fwd_dst_ports[RTE_MAX_ETHPORTS ]; + +struct lcore_queue_conf lcore_queue_conf[RTE_MAX_LCORE ]; + +struct rte_eth_dev_tx_buffer *tx_buffer[RTE_MAX_ETHPORTS ]; + +struct l2fwd_port_statistics port_statistics[RTE_MAX_ETHPORTS ]; + +/* A tsc-based timer responsible for triggering statistics printout */ +uint64_t timer_period; +#endif /* _L2FWD_COMMON_H_ */
examples/l2fwd-event/main.c +17 -24
76 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 5/39 examples/l2fwd-event: move dataplane code to new file
In reply to a message not in the archive--- examples/l2fwd-event/Makefile | 1 + examples/l2fwd-event/l2fwd_worker.c | 231 ++++++++++++++++++++++++++++++++++++ examples/l2fwd-event/l2fwd_worker.h | 10 ++ examples/l2fwd-event/main.c | 189 +---------------------------- examples/l2fwd-event/meson.build | 1 + 5 files changed, 244 insertions(+), 188 deletions(-) create mode 100644 examples/l2fwd-event/l2fwd_worker.c create mode 100644 examples/l2fwd-event/l2fwd_worker.h
examples/l2fwd-event/Makefile +1 -0
@@ -6,6 +6,7 @@ APP = l2fwd-event # all source are stored in SRCS-y SRCS-y := main.c +SRCS-y += l2fwd_worker.c # Build using pkg-config variables if possible $(shell pkg-config --exists libdpdk)
examples/l2fwd-event/l2fwd_worker.c new file +231 -0
231 lines not on this page · raw message
examples/l2fwd-event/l2fwd_worker.h new file +10 -0
@@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C) 2019 Marvell International Ltd. +*/ +#ifndef _L2FWD_WORKER_H_ +#define _L2FWD_WORKER_H_ + +int +l2fwd_launch_one_lcore (__attribute__((unused))void *dummy); + +#endif /* _L2FWD_WORKER_H_ */
examples/l2fwd-event/main.c +1 -188
201 lines not on this page · raw message
examples/l2fwd-event/meson.build +1 -0
@@ -7,5 +7,6 @@ # DPDK instance, use 'make' sources = files( + 'l2fwd_worker.c', 'main.c' )
Signature · 1 line
2.7.4
PATCH 6/39 examples/l2fwd-event: remove unused header includes
In reply to a message not in the archive--- examples/l2fwd-event/l2fwd_worker.c | 12 ------------ 1 file changed, 12 deletions(-)
examples/l2fwd-event/l2fwd_worker.c +0 -12
@@ -13,30 +13,18 @@#include <setjmp.h> #include <stdarg.h> #include <ctype.h> -#include <errno.h> -#include <getopt.h> -#include <signal.h> #include <stdbool.h> #include <rte_common.h> #include <rte_log.h> -#include <rte_malloc.h> -#include <rte_memory.h> #include <rte_memcpy.h> -#include <rte_eal.h> -#include <rte_launch.h> #include <rte_atomic.h> #include <rte_cycles.h> #include <rte_prefetch.h> #include <rte_lcore.h> -#include <rte_per_lcore.h> #include <rte_branch_prediction.h> -#include <rte_interrupts.h> -#include <rte_random.h> -#include <rte_debug.h> #include <rte_ether.h> #include <rte_ethdev.h> -#include <rte_mempool.h> #include <rte_mbuf.h> #include "l2fwd_common.h"
Signature · 1 line
2.7.4
PATCH 7/39 examples/l2fwd-event: move drain buffers to new function
In reply to a message not in the archive--- examples/l2fwd-event/l2fwd_worker.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-)
examples/l2fwd-event/l2fwd_worker.c +20 -14
@@ -76,6 +76,24 @@ print_stats(void)printf ("\n====================================================\n" ); } +static inline void +l2fwd_drain_buffers (struct lcore_queue_conf *qconf) +{ +unsigned int i, sent; +unsigned int portid; +struct rte_eth_dev_tx_buffer *buffer; + +for (i =0 ; i < qconf->n_rx_port; i++) { + + portid = l2fwd_dst_ports[qconf->rx_port_list[i]]; + buffer = tx_buffer[portid]; + + sent =rte_eth_tx_buffer_flush (portid,0 , buffer); +if (sent) + port_statistics[portid].tx += sent; + } +} +static void l2fwd_mac_updating (struct rte_mbuf *m,unsigned int dest_portid) {
@@ -116,14 +134,12 @@ l2fwd_main_loop(void) {struct rte_mbuf *pkts_burst[MAX_PKT_BURST ];struct rte_mbuf *m; -int sent;unsigned int lcore_id;uint64_t prev_tsc, diff_tsc, cur_tsc, timer_tsc;unsigned int i, j, portid, nb_rx;struct lcore_queue_conf *qconf;const uint64_t drain_tsc = (rte_get_tsc_hz () +US_PER_S -1 ) /US_PER_S *BURST_TX_DRAIN_US ; -struct rte_eth_dev_tx_buffer *buffer; prev_tsc =0 ; timer_tsc =0 ;
@@ -156,18 +172,8 @@ l2fwd_main_loop(void) diff_tsc = cur_tsc - prev_tsc;if (unlikely (diff_tsc > drain_tsc)) { -for (i =0 ; i < qconf->n_rx_port; i++) { - - portid = - l2fwd_dst_ports[qconf->rx_port_list[i]]; - buffer = tx_buffer[portid]; - - sent =rte_eth_tx_buffer_flush (portid,0 , - buffer); -if (sent) - port_statistics[portid].tx += sent; - - } +/* Drain buffers */ +l2fwd_drain_buffers (qconf);/* if timer is enabled */ if (timer_period >0 ) {
Signature · 1 line
2.7.4
PATCH 8/39 examples/l2fwd-event: optimize check for master core
In reply to a message not in the archiveReplacing the check for lcore_id & mastercore_id with the check for a flag.
--- examples/l2fwd-event/l2fwd_worker.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
examples/l2fwd-event/l2fwd_worker.c +5 -2
@@ -140,6 +140,7 @@ l2fwd_main_loop(void)struct lcore_queue_conf *qconf;const uint64_t drain_tsc = (rte_get_tsc_hz () +US_PER_S -1 ) /US_PER_S *BURST_TX_DRAIN_US ; +int is_master_core; prev_tsc =0 ; timer_tsc =0 ;
@@ -162,6 +163,9 @@ l2fwd_main_loop(void) } +/* Set the flag if master core */ + is_master_core = (lcore_id ==rte_get_master_lcore ()) ?1 :0 ; +while (!force_quit) { cur_tsc =rte_rdtsc ();
@@ -185,8 +189,7 @@ l2fwd_main_loop(void)if (unlikely (timer_tsc >= timer_period)) {/* do this only on master core */ -if (lcore_id == -rte_get_master_lcore ()) { +if (is_master_core) {print_stats ();/* reset the timer */ timer_tsc =0 ;
Signature · 1 line
2.7.4
PATCH 9/39 examples/l2fwd-event: move periodic tasks to new func
In reply to a message not in the archiveMove the periodic operations (stats flush and drain buffers) to a new function.
--- examples/l2fwd-event/l2fwd_worker.c | 83 ++++++++++++++++++++----------------- examples/l2fwd-event/l2fwd_worker.h | 6 +++ 2 files changed, 52 insertions(+), 37 deletions(-)
examples/l2fwd-event/l2fwd_worker.c +46 -37
@@ -94,6 +94,45 @@ l2fwd_drain_buffers(struct lcore_queue_conf *qconf) } } +static inline void +l2fwd_periodic_drain_stats_monitor (struct lcore_queue_conf *qconf, +struct tsc_tracker *t,int is_master_core) +{ +uint64_t diff_tsc, cur_tsc; + + cur_tsc =rte_rdtsc (); + +/* +* TX burst queue drain +*/ + diff_tsc = cur_tsc - t->prev_tsc; +if (unlikely (diff_tsc > t->drain_tsc)) { + +/* Drain buffers */ +l2fwd_drain_buffers (qconf); + +/* if timer is enabled */ +if (timer_period >0 ) { + +/* advance the timer */ + t->timer_tsc += diff_tsc; + +/* if timer has reached its timeout */ +if (unlikely (t->timer_tsc >= timer_period)) { + +/* do this only on master core */ +if (is_master_core) { +print_stats (); +/* reset the timer */ + t->timer_tsc =0 ; + } + } + } + + t->prev_tsc = cur_tsc; + } +} +static void l2fwd_mac_updating (struct rte_mbuf *m,unsigned int dest_portid) {
@@ -135,19 +174,18 @@ l2fwd_main_loop(void)struct rte_mbuf *pkts_burst[MAX_PKT_BURST ];struct rte_mbuf *m;unsigned int lcore_id; -uint64_t prev_tsc, diff_tsc, cur_tsc, timer_tsc;unsigned int i, j, portid, nb_rx;struct lcore_queue_conf *qconf; -const uint64_t drain_tsc = (rte_get_tsc_hz () +US_PER_S -1 ) - /US_PER_S *BURST_TX_DRAIN_US ;int is_master_core; - - prev_tsc =0 ; - timer_tsc =0 ; +struct tsc_tracker tsc = {0 }; lcore_id =rte_lcore_id (); qconf = &lcore_queue_conf[lcore_id]; +/* Set drain tsc */ + tsc.drain_tsc = (rte_get_tsc_hz () +US_PER_S -1 ) / +US_PER_S *BURST_TX_DRAIN_US ; +if (qconf->n_rx_port ==0 ) {RTE_LOG (INFO ,L2FWD ,"lcore %u has nothing to do\n" , lcore_id);return ;
@@ -168,37 +206,8 @@ l2fwd_main_loop(void)while (!force_quit) { - cur_tsc =rte_rdtsc (); - -/* -* TX burst queue drain -*/ - diff_tsc = cur_tsc - prev_tsc; -if (unlikely (diff_tsc > drain_tsc)) { - -/* Drain buffers */ -l2fwd_drain_buffers (qconf); - -/* if timer is enabled */ -if (timer_period >0 ) { - -/* advance the timer */ - timer_tsc += diff_tsc; - -/* if timer has reached its timeout */ -if (unlikely (timer_tsc >= timer_period)) { - -/* do this only on master core */ -if (is_master_core) { -print_stats (); -/* reset the timer */ - timer_tsc =0 ; - } - } - } - - prev_tsc = cur_tsc; - } +/* Do periodic operations (buffer drain & stats monitor) */ +l2fwd_periodic_drain_stats_monitor (qconf, &tsc, is_master_core);/* * Read packet from RX queues
examples/l2fwd-event/l2fwd_worker.h +6 -0
@@ -4,6 +4,12 @@#ifndef _L2FWD_WORKER_H_#define _L2FWD_WORKER_H_ +struct tsc_tracker { +uint64_t prev_tsc; +uint64_t timer_tsc; +uint64_t drain_tsc; +}; +int l2fwd_launch_one_lcore (__attribute__((unused))void *dummy);
Signature · 1 line
2.7.4
PATCH 10/39 examples/l2fwd-event: do timer updates only on master
In reply to a message not in the archiveThe timer updates and checks are required only for stats printing by the master core. This can be entirely skipped for other cores.
--- examples/l2fwd-event/l2fwd_worker.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
examples/l2fwd-event/l2fwd_worker.c +13 -8
@@ -111,6 +111,14 @@ l2fwd_periodic_drain_stats_monitor(struct lcore_queue_conf *qconf,/* Drain buffers */ l2fwd_drain_buffers (qconf); + t->prev_tsc = cur_tsc; + +/* Skip the timer based stats prints if not master core */ +if (!is_master_core) +return ; + +/* On master core */ +/* if timer is enabled */ if (timer_period >0 ) {
@@ -120,16 +128,13 @@ l2fwd_periodic_drain_stats_monitor(struct lcore_queue_conf *qconf,/* if timer has reached its timeout */ if (unlikely (t->timer_tsc >= timer_period)) { -/* do this only on master core */ -if (is_master_core) { -print_stats (); -/* reset the timer */ - t->timer_tsc =0 ; - } +/* Print stats */ +print_stats (); + +/* reset the timer */ + t->timer_tsc =0 ; } } - - t->prev_tsc = cur_tsc; } }
Signature · 1 line
2.7.4
PATCH 11/39 examples/l2fwd-event: move pkt send code to a new func
In reply to a message not in the archive--- examples/l2fwd-event/l2fwd_worker.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
examples/l2fwd-event/l2fwd_worker.c +14 -6
@@ -154,22 +154,30 @@ l2fwd_mac_updating(struct rte_mbuf *m, unsigned int dest_portid)rte_ether_addr_copy (&l2fwd_ports_eth_addr[dest_portid], ð->s_addr); } +static inline void +l2fwd_send_pkt (struct rte_mbuf *tx_pkt,unsigned int port_id) +{ +int sent; +struct rte_eth_dev_tx_buffer *buffer; + + buffer = tx_buffer[port_id]; + sent =rte_eth_tx_buffer (port_id,0 , buffer, tx_pkt); +if (sent) + port_statistics[port_id].tx += sent; +} +static void l2fwd_simple_forward (struct rte_mbuf *m,unsigned int portid) {unsigned int dst_port; -int sent; -struct rte_eth_dev_tx_buffer *buffer; dst_port = l2fwd_dst_ports[portid];if (mac_updating)l2fwd_mac_updating (m, dst_port); - buffer = tx_buffer[dst_port]; - sent =rte_eth_tx_buffer (dst_port,0 , buffer, m); -if (sent) - port_statistics[dst_port].tx += sent; +/* Send packet */ +l2fwd_send_pkt (m, dst_port); }/* main processing loop */
Signature · 1 line
2.7.4
PATCH 12/39 examples/l2fwd-event: use fprintf in usage print
In reply to a message not in the archiveFollowing the convention of l3fwd, using fprintf instead of printf for printing usage.
--- examples/l2fwd-event/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
examples/l2fwd-event/main.c +3 -1
@@ -63,7 +63,9 @@ struct rte_mempool *l2fwd_pktmbuf_pool;static void l2fwd_usage (const char *prgname) { -printf ("%s [EAL options] -- -p PORTMASK [-q NQ]\n" +fprintf (stderr,"%s [EAL options] --" +" -p PORTMASK" +" [-q NQ]\n" " -p PORTMASK: hexadecimal bitmask of ports to configure\n" " -q NQ: number of queue (=ports) per lcore (default is 1)\n" " -T PERIOD: statistics will be refreshed each PERIOD seconds (0 to disable, 10 default, 86400 maximum)\n"
Signature · 1 line
2.7.4
PATCH 13/39 examples/l2fwd-event: improvements to the usage print
In reply to a message not in the archiveFixed alignment and split the usage print to aid easy addition of eventmode usage prints.
--- examples/l2fwd-event/main.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
examples/l2fwd-event/main.c +14 -9
@@ -65,15 +65,20 @@ l2fwd_usage(const char *prgname) {fprintf (stderr,"%s [EAL options] --" " -p PORTMASK" -" [-q NQ]\n" -" -p PORTMASK: hexadecimal bitmask of ports to configure\n" -" -q NQ: number of queue (=ports) per lcore (default is 1)\n" -" -T PERIOD: statistics will be refreshed each PERIOD seconds (0 to disable, 10 default, 86400 maximum)\n" -" --[no-]mac-updating: Enable or disable MAC addresses updating (enabled by default)\n" -" When enabled:\n" -" - The source MAC address is replaced by the TX port MAC address\n" -" - The destination MAC address is replaced by 02:00:00:00:00:TX_PORT_ID\n" , - prgname); +" [-q NQ]" , + prgname); + +fprintf (stderr,"\n\n" ); + +fprintf (stderr, +" -p PORTMASK: hexadecimal bitmask of ports to configure\n" +" -q NQ: number of queue (=ports) per lcore (default is 1)\n" +" -T PERIOD: statistics will be refreshed each PERIOD seconds (0 to disable, 10 default, 86400 maximum)\n" +" --[no-]mac-updating: Enable or disable MAC addresses updating (enabled by default)\n" +" When enabled:\n" +" - The source MAC address is replaced by the TX port MAC address\n" +" - The destination MAC address is replaced by 02:00:00:00:00:TX_PORT_ID\n" +"\n" ); } static int
Signature · 1 line
2.7.4
PATCH 14/39 eventdev: add files for eventmode helper
In reply to a message not in the archive--- lib/librte_eventdev/Makefile | 5 +++-- lib/librte_eventdev/meson.build | 2 ++ lib/librte_eventdev/rte_eventmode_helper.c | 7 +++++++ lib/librte_eventdev/rte_eventmode_helper.h | 15 +++++++++++++++ lib/librte_eventdev/rte_eventmode_helper_internal.h | 6 ++++++ 5 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 lib/librte_eventdev/rte_eventmode_helper.c create mode 100644 lib/librte_eventdev/rte_eventmode_helper.h create mode 100644 lib/librte_eventdev/rte_eventmode_helper_internal.h
lib/librte_eventdev/Makefile +3 -2
@@ -1,6 +1,5 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2016 Cavium, Inc -# +# Copyright (C) 2019 Marvell International Ltd. include $(RTE_SDK)/mk/rte.vars.mk
@@ -24,6 +23,7 @@ LDLIBS += -lrte_mbuf -lrte_cryptodev -lpthread # library source files SRCS-y += rte_eventdev.c +SRCS-y += rte_eventmode_helper.c SRCS-y += rte_event_ring.c SRCS-y += rte_event_eth_rx_adapter.c SRCS-y += rte_event_timer_adapter.c
@@ -35,6 +35,7 @@ SYMLINK-y-include += rte_eventdev.h SYMLINK-y-include += rte_eventdev_pmd.h SYMLINK-y-include += rte_eventdev_pmd_pci.h SYMLINK-y-include += rte_eventdev_pmd_vdev.h +SYMLINK-y-include += rte_eventmode_helper.h SYMLINK-y-include += rte_event_ring.h SYMLINK-y-include += rte_event_eth_rx_adapter.h SYMLINK-y-include += rte_event_timer_adapter.h
lib/librte_eventdev/meson.build +2 -0
@@ -11,6 +11,7 @@ else endif sources = files('rte_eventdev.c', + 'rte_eventmode_helper.c', 'rte_event_ring.c', 'rte_event_eth_rx_adapter.c', 'rte_event_timer_adapter.c',
@@ -20,6 +21,7 @@ headers = files('rte_eventdev.h', 'rte_eventdev_pmd.h', 'rte_eventdev_pmd_pci.h', 'rte_eventdev_pmd_vdev.h', + 'rte_eventmode_helper.h', 'rte_event_ring.h', 'rte_event_eth_rx_adapter.h', 'rte_event_timer_adapter.h',
lib/librte_eventdev/rte_eventmode_helper.c new file +7 -0
@@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C) 2019 Marvell International Ltd. +*/ + +#include <rte_eventmode_helper.h> + +#include "rte_eventmode_helper_internal.h"
lib/librte_eventdev/rte_eventmode_helper.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C) 2019 Marvell International Ltd. +*/ +#ifndef _RTE_EVENTMODE_HELPER_H_ +#define _RTE_EVENTMODE_HELPER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _RTE_EVENTMODE_HELPER_H_ */
lib/librte_eventdev/rte_eventmode_helper_internal.h new file +6 -0
@@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C) 2019 Marvell International Ltd. +*/ +#ifndef _RTE_EVENTMODE_HELPER_INTERNAL_H_ +#define _RTE_EVENTMODE_HELPER_INTERNAL_H_ +#endif /* _RTE_EVENTMODE_HELPER_INTERNAL_H_ */
Signature · 1 line
2.7.4
PATCH 15/39 eventdev: add routines for logging eventmode helper
In reply to a message not in the archive--- config/common_base | 1 + lib/librte_eal/common/eal_common_log.c | 1 + lib/librte_eal/common/include/rte_log.h | 1 + .../rte_eventmode_helper_internal.h | 29 ++++++++++++++++++++++ 4 files changed, 32 insertions(+)
config/common_base +1 -0
@@ -685,6 +685,7 @@ CONFIG_RTE_LIBRTE_PMD_ZLIB=n # CONFIG_RTE_LIBRTE_EVENTDEV=y CONFIG_RTE_LIBRTE_EVENTDEV_DEBUG=n +CONFIG_RTE_LIBRTE_EVENTMODE_HELPER_DEBUG=n CONFIG_RTE_EVENT_MAX_DEVS=16 CONFIG_RTE_EVENT_MAX_QUEUES_PER_DEV=64 CONFIG_RTE_EVENT_TIMER_ADAPTER_NUM_MAX=32
lib/librte_eal/common/eal_common_log.c +1 -0
@@ -324,6 +324,7 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EFD, "lib.efd"}, {RTE_LOGTYPE_EVENTDEV, "lib.eventdev"}, {RTE_LOGTYPE_GSO, "lib.gso"}, + {RTE_LOGTYPE_EVENTMODE, "lib.eventmode"}, {RTE_LOGTYPE_USER1, "user1"}, {RTE_LOGTYPE_USER2, "user2"}, {RTE_LOGTYPE_USER3, "user3"},
lib/librte_eal/common/include/rte_log.h +1 -0
@@ -62,6 +62,7 @@ extern struct rte_logs rte_logs;#define RTE_LOGTYPE_EFD 18/**< Log related to EFD. */ #define RTE_LOGTYPE_EVENTDEV 19/**< Log related to eventdev. */ #define RTE_LOGTYPE_GSO 20/**< Log related to GSO. */ +#define RTE_LOGTYPE_EVENTMODE 21/**< Log related to eventmode. */ /* these log types can be used in an application */ #define RTE_LOGTYPE_USER1 24/**< User-defined log type 1. */
lib/librte_eventdev/rte_eventmode_helper_internal.h +29 -0
@@ -3,4 +3,33 @@*/ #ifndef _RTE_EVENTMODE_HELPER_INTERNAL_H_#define _RTE_EVENTMODE_HELPER_INTERNAL_H_ + +#include <rte_log.h> + +/* Logging macros */ + +#define RTE_EM_HLPR_LOG_ERR (...) \ + RTE_LOG(ERR, EVENTMODE, \ + RTE_FMT("%s(): " RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \ + __func__, RTE_FMT_TAIL(__VA_ARGS__ ,))) + +#define RTE_EM_HLPR_LOG_WARNING (...) \ + RTE_LOG(WARNING, EVENTMODE, \ + RTE_FMT("%s(): " RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \ + __func__, RTE_FMT_TAIL(__VA_ARGS__ ,))) + +#define RTE_EM_HLPR_LOG_INFO (...) \ + RTE_LOG(INFO, EVENTMODE, \ + RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \ + RTE_FMT_TAIL(__VA_ARGS__ ,))) + +#ifdef RTE_LIBRTE_EVENTMODE_HELPER_DEBUG +#define RTE_EM_HLPR_LOG_DEBUG (...) \ + RTE_LOG(DEBUG, EVENTMODE, \ + RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \ + __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,))) +#else +#define RTE_EM_HLPR_LOG_DEBUG (...) (void)0 +#endif +#endif /* _RTE_EVENTMODE_HELPER_INTERNAL_H_ */
Signature · 1 line
2.7.4
PATCH 16/39 eventdev: add eventmode CL options framework
In reply to a message not in the archiveAdding usage prints and CL parsing routines for eventmode. Option to select packet transfer mode is also added.
--- lib/librte_eventdev/rte_eventdev_version.map | 2 + lib/librte_eventdev/rte_eventmode_helper.c | 128 +++++++++++++++++++++++++++ lib/librte_eventdev/rte_eventmode_helper.h | 51 +++++++++++ 3 files changed, 181 insertions(+)
lib/librte_eventdev/rte_eventdev_version.map +2 -0
@@ -128,4 +128,6 @@ EXPERIMENTAL { rte_event_eth_rx_adapter_cb_register; rte_event_eth_rx_adapter_stats_get; + rte_eventmode_helper_print_options_list; + rte_eventmode_helper_print_options_description; };
lib/librte_eventdev/rte_eventmode_helper.c +128 -0
135 lines not on this page · raw message
lib/librte_eventdev/rte_eventmode_helper.h +51 -0
57 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 17/39 eventdev: allow application to set ethernet portmask
In reply to a message not in the archiveApplication would be required to restrict helper functions to use only certain ports. The field eth_portmask field in the conf could be used for this.
--- lib/librte_eventdev/rte_eventmode_helper.c | 3 +++ lib/librte_eventdev/rte_eventmode_helper.h | 6 ++++++ 2 files changed, 9 insertions(+)
lib/librte_eventdev/rte_eventmode_helper.c +3 -0
@@ -87,6 +87,9 @@ em_initialize_helper_conf(struct rte_eventmode_helper_conf *conf)/* Packet transfer mode: poll */ conf->mode =RTE_EVENTMODE_HELPER_PKT_TRANSFER_MODE_POLL ; + +/* Keep all ethernet ports enabled by default */ + conf->eth_portmask =-1 ; } struct rte_eventmode_helper_conf *
lib/librte_eventdev/rte_eventmode_helper.h +6 -0
@@ -8,6 +8,7 @@extern "C" {#endif +#include <rte_common.h> #include <rte_compat.h> /* Packet transfer mode of the application */
@@ -19,6 +20,11 @@ enum rte_eventmode_helper_pkt_transfer_mode {struct rte_eventmode_helper_conf {enum rte_eventmode_helper_pkt_transfer_mode mode;/**< Packet transfer mode of the application */ +uint32_t eth_portmask; +/**< +* Mask of the eth ports to be used. This portmask would be +* checked while initializing devices using helper routines. +*/ void *mode_params;/**< Mode specific parameters */ };
Signature · 1 line
2.7.4
PATCH 18/39 eventdev: add framework for eventmode conf
In reply to a message not in the archiveAdding eventmode conf which would have all required configuration for the event mode.
--- lib/librte_eventdev/rte_eventmode_helper.c | 16 ++++++++++++++++ lib/librte_eventdev/rte_eventmode_helper_internal.h | 5 +++++ 2 files changed, 21 insertions(+)
lib/librte_eventdev/rte_eventmode_helper.c +16 -0
@@ -97,6 +97,7 @@ rte_eventmode_helper_parse_args(int argc, char **argv) {int32_t opt, ret;struct rte_eventmode_helper_conf *conf =NULL ; +struct eventmode_conf *em_conf =NULL ;/* Allocate memory for conf */ conf = rte_zmalloc("eventmode-helper-conf",
@@ -108,9 +109,21 @@ rte_eventmode_helper_parse_args(int argc, char **argv) goto err; } +/* Allocate memory for event mode params */ + conf->mode_params =rte_zmalloc ("eventmode-helper-mode-params" , +sizeof (struct eventmode_conf ), +RTE_CACHE_LINE_SIZE ); +if (conf->mode_params ==NULL ) { +RTE_EM_HLPR_LOG_ERR ( +"Failed allocating memory for event mode params" ); + goto err; + } +/* Initialize conf with default values */ em_initialize_helper_conf (conf); + em_conf = (struct eventmode_conf *)(conf->mode_params); +while ((opt =getopt_long (argc, argv, short_options, lgopts,NULL )) !=EOF ) {switch (opt) {
@@ -131,6 +144,9 @@ rte_eventmode_helper_parse_args(int argc, char **argv)return conf; err: +if (em_conf !=NULL ) +rte_free (em_conf); +if (conf !=NULL )rte_free (conf);
lib/librte_eventdev/rte_eventmode_helper_internal.h +5 -0
@@ -32,4 +32,9 @@#define RTE_EM_HLPR_LOG_DEBUG (...) (void)0#endif +/* Eventmode conf data */ +struct eventmode_conf { +uint64_t dummy; +}; +#endif /* _RTE_EVENTMODE_HELPER_INTERNAL_H_ */
Signature · 1 line
2.7.4
PATCH 19/39 eventdev: add common initialize routine for eventmode devs
In reply to a message not in the archiveAdding framework for common initialization routine for event mode. Event mode would involve initialization of multiple devices, like eventdev, ethdev etc and this routine would be the placeholder for all initialization to come in.
--- lib/librte_eventdev/rte_eventdev_version.map | 2 ++ lib/librte_eventdev/rte_eventmode_helper.c | 51 +++++++++++++++++++++++++++- lib/librte_eventdev/rte_eventmode_helper.h | 26 +++++++++++++- 3 files changed, 77 insertions(+), 2 deletions(-)
lib/librte_eventdev/rte_eventdev_version.map +2 -0
@@ -130,4 +130,6 @@ EXPERIMENTAL { rte_event_eth_rx_adapter_stats_get; rte_eventmode_helper_print_options_list; rte_eventmode_helper_print_options_description; + rte_eventmode_helper_parse_args; + rte_eventmode_helper_initialize_devs; };
lib/librte_eventdev/rte_eventmode_helper.c +50 -1
66 lines not on this page · raw message
lib/librte_eventdev/rte_eventmode_helper.h +25 -1
@@ -62,9 +62,33 @@ rte_eventmode_helper_print_options_description(void);* @return * Configuration generated by parsing the event mode args. */ -struct rte_eventmode_helper_conf * +struct rte_eventmode_helper_conf * __rte_experimentalrte_eventmode_helper_parse_args (int argc,char **argv); +/* Helper functions for initialization, & launching workers */ + +/** +* Initialize event mode devices +* +* Application could call this function to get the event device, eth device +* and eth rx adapter initialized according to the conf populated using the +* command line args. +* +* Application is expected to initialize the eth device and then the eventmode +* helper subsystem will stop & start eth device according to it's requirement. +* So call to this function should be done after the eth device is successfully +* initialized. +* +* @param mode_conf +* Configuration of the mode in which app is doing packet handling +* @return +* - 0 on success. +* - (<0) on failure. +*/ +int32_t __rte_experimental +rte_eventmode_helper_initialize_devs ( +struct rte_eventmode_helper_conf *mode_conf); + #ifdef __cplusplus }#endif
Signature · 1 line
2.7.4
PATCH 20/39 eventdev: add eventdevice init for eventmode
In reply to a message not in the archiveAdding routines to initialize event devs. The internal conf structure would be used to track device configuration.
--- lib/librte_eventdev/rte_eventmode_helper.c | 131 +++++++++++++++++++++ .../rte_eventmode_helper_internal.h | 16 ++- 2 files changed, 146 insertions(+), 1 deletion(-)
lib/librte_eventdev/rte_eventmode_helper.c +131 -0
@@ -4,6 +4,7 @@#include <getopt.h> #include <rte_ethdev.h> +#include <rte_eventdev.h> #include <rte_eventmode_helper.h> #include <rte_malloc.h>
@@ -154,12 +155,134 @@ rte_eventmode_helper_parse_args(int argc, char **argv)return NULL ; } +/* Setup eventmode devs */ + +static int +rte_eventmode_helper_initialize_eventdev (struct eventmode_conf *em_conf) +{ +int ret =-1 ; +uint8_t i, j; +struct rte_event_dev_config eventdev_conf; +struct rte_event_dev_info evdev_default_conf; +struct rte_event_queue_conf eventq_conf = {0 }; +struct eventdev_params *eventdev_config; +int nb_eventdev = em_conf->nb_eventdev; +int nb_eventqueue; +uint8_t eventdev_id; + +for (i =0 ; i < nb_eventdev; i++) { + +/* Get eventdev config */ + eventdev_config = &(em_conf->eventdev_config[i]); + +/* Get event dev ID */ + eventdev_id = eventdev_config->eventdev_id; + +/* Get the number of queues */ + nb_eventqueue = eventdev_config->nb_eventqueue; + +/* One queue is reserved for the final stage (doing eth tx) */ +/* TODO handles only one Tx adapter. Fix this */ + nb_eventqueue +=1 ; + +/* Reset the default conf */ +memset (&evdev_default_conf,0 , +sizeof (struct rte_event_dev_info )); + +/* Get default conf of eventdev */ + ret =rte_event_dev_info_get (eventdev_id, &evdev_default_conf); +if (ret <0 ) { +RTE_EM_HLPR_LOG_ERR ( +"Error in getting event device info[devID:%d]" , + eventdev_id); +return ret; + } + +memset (&eventdev_conf,0 ,sizeof (struct rte_event_dev_config )); + eventdev_conf.nb_events_limit = + evdev_default_conf.max_num_events; + eventdev_conf.nb_event_queues = nb_eventqueue; + eventdev_conf.nb_event_ports = + eventdev_config->nb_eventport; + eventdev_conf.nb_event_queue_flows = + evdev_default_conf.max_event_queue_flows; + eventdev_conf.nb_event_port_dequeue_depth = + evdev_default_conf.max_event_port_dequeue_depth; + eventdev_conf.nb_event_port_enqueue_depth = + evdev_default_conf.max_event_port_enqueue_depth; + +/* Configure event device */ + ret =rte_event_dev_configure (eventdev_id, &eventdev_conf); +if (ret <0 ) { +RTE_EM_HLPR_LOG_ERR ( +"Error in configuring event device" ); +return ret; + } + +/* Configure event queues */ +for (j =0 ; j < nb_eventqueue; j++) { + +memset (&eventq_conf,0 , +sizeof (struct rte_event_queue_conf )); + +/* Read the requested conf */ + +/* Per event dev queues can be ATQ or SINGLE LINK */ + eventq_conf.event_queue_cfg = + eventdev_config->ev_queue_mode; + +/* Set schedule type as ATOMIC */ + eventq_conf.schedule_type =RTE_SCHED_TYPE_ATOMIC ; + +/* Set max atomic flows to 1024 */ + eventq_conf.nb_atomic_flows =1024 ; + eventq_conf.nb_atomic_order_sequences =1024 ; + +/* Setup the queue */ + ret =rte_event_queue_setup (eventdev_id, j, + &eventq_conf); +if (ret <0 ) { +RTE_EM_HLPR_LOG_ERR ( +"Error in event queue setup" ); +return ret; + } + } + +/* Configure event ports */ +for (j =0 ; j < eventdev_config->nb_eventport; j++) { + ret =rte_event_port_setup (eventdev_id, j,NULL ); +if (ret <0 ) { +RTE_EM_HLPR_LOG_ERR ( +"Error setting up event port" ); +return ret; + } + } + } + +/* Start event devices */ +for (i =0 ; i < nb_eventdev; i++) { + +/* Get eventdev config */ + eventdev_config = &(em_conf->eventdev_config[i]); + + ret =rte_event_dev_start (eventdev_config->eventdev_id); +if (ret <0 ) { +RTE_EM_HLPR_LOG_ERR ( +"Error in starting event device[devID: %d]" , + eventdev_config->eventdev_id); +return ret; + } + } +return 0 ; +} + int32_t __rte_experimentalrte_eventmode_helper_initialize_devs (struct rte_eventmode_helper_conf *mode_conf) {int ret;uint16_t portid; +struct eventmode_conf *em_conf;if (mode_conf ==NULL ) {RTE_EM_HLPR_LOG_ERR ("Invalid conf" );
@@ -174,6 +297,9 @@ rte_eventmode_helper_initialize_devs(return -1 ; } +/* Get eventmode conf */ + em_conf = (struct eventmode_conf *)(mode_conf->mode_params); +/* Stop eth devices before setting up adapter */ RTE_ETH_FOREACH_DEV (portid) {
@@ -184,6 +310,11 @@ rte_eventmode_helper_initialize_devs(rte_eth_dev_stop (portid); } +/* Setup eventdev */ + ret =rte_eventmode_helper_initialize_eventdev (em_conf); +if (ret !=0 ) +return ret; +/* Start eth devices after setting up adapter */ RTE_ETH_FOREACH_DEV (portid) {
lib/librte_eventdev/rte_eventmode_helper_internal.h +15 -1
@@ -32,9 +32,23 @@#define RTE_EM_HLPR_LOG_DEBUG (...) (void)0#endif +/* Max event devices supported */ +#define EVENT_MODE_MAX_EVENT_DEVS RTE_EVENT_MAX_DEVS + +/* Event dev params */ +struct eventdev_params { +uint8_t eventdev_id; +uint8_t nb_eventqueue; +uint8_t nb_eventport; +uint8_t ev_queue_mode; +}; +/* Eventmode conf data */ struct eventmode_conf { -uint64_t dummy; +int nb_eventdev; +/**< No of event devs */ +struct eventdev_params eventdev_config[EVENT_MODE_MAX_EVENT_DEVS ]; +/**< Per event dev conf */ };#endif /* _RTE_EVENTMODE_HELPER_INTERNAL_H_ */
Signature · 1 line
2.7.4
PATCH 21/39 eventdev: add eventdev port-lcore link
In reply to a message not in the archiveAdding eventdev port-lcore link. In addition, this will also specify which event queue need to be connected to the event port.
--- lib/librte_eventdev/rte_eventmode_helper.c | 22 ++++++++++++++++++++++ lib/librte_eventdev/rte_eventmode_helper.h | 12 ++++++++++++ .../rte_eventmode_helper_internal.h | 12 ++++++++++++ 3 files changed, 46 insertions(+)
lib/librte_eventdev/rte_eventmode_helper.c +22 -0
@@ -165,10 +165,12 @@ rte_eventmode_helper_initialize_eventdev(struct eventmode_conf *em_conf)struct rte_event_dev_config eventdev_conf;struct rte_event_dev_info evdev_default_conf;struct rte_event_queue_conf eventq_conf = {0 }; +struct rte_eventmode_helper_event_link_info *link;struct eventdev_params *eventdev_config;int nb_eventdev = em_conf->nb_eventdev;int nb_eventqueue;uint8_t eventdev_id; +uint8_t *queue =NULL ;for (i =0 ; i < nb_eventdev; i++) {
@@ -259,6 +261,26 @@ rte_eventmode_helper_initialize_eventdev(struct eventmode_conf *em_conf) } } +/* Make event queue - event port link */ +for (j =0 ; j < em_conf->nb_link; j++) { + +/* Get link info */ + link = &(em_conf->link[j]); + +/* Get event dev ID */ + eventdev_id = link->eventdev_id; + + queue = &(link->eventq_id); + +/* Link queue to port */ + ret =rte_event_port_link (eventdev_id, link->event_portid, + queue,NULL ,1 ); +if (ret <0 ) { +RTE_EM_HLPR_LOG_ERR ("Error in event port linking" ); +return ret; + } + } +/* Start event devices */ for (i =0 ; i < nb_eventdev; i++) {
lib/librte_eventdev/rte_eventmode_helper.h +12 -0
@@ -29,6 +29,18 @@ struct rte_eventmode_helper_conf {/**< Mode specific parameters */ }; +/* Event-lcore link conf */ +struct rte_eventmode_helper_event_link_info { +uint8_t eventdev_id; +/**< Event device ID */ +uint8_t event_portid; +/**< Event port ID */ +uint8_t eventq_id; +/**< Event queue to be linked to the port */ +uint8_t lcore_id; +/**< Lcore to be polling on this port */ +}; +/* Common helper functions for command line parsing */ /**
lib/librte_eventdev/rte_eventmode_helper_internal.h +12 -0
@@ -35,6 +35,13 @@/* Max event devices supported */ #define EVENT_MODE_MAX_EVENT_DEVS RTE_EVENT_MAX_DEVS +/* Max event queues supported per event device */ +#define EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV RTE_EVENT_MAX_QUEUES_PER_DEV + +/* Max event-lcore links */ +#define EVENT_MODE_MAX_LCORE_LINKS \ + (EVENT_MODE_MAX_EVENT_DEVS * EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV) +/* Event dev params */ struct eventdev_params {uint8_t eventdev_id;
@@ -49,6 +56,11 @@ struct eventmode_conf {/**< No of event devs */ struct eventdev_params eventdev_config[EVENT_MODE_MAX_EVENT_DEVS ];/**< Per event dev conf */ +uint8_t nb_link; +/**< No of links */ +struct rte_eventmode_helper_event_link_info + link[EVENT_MODE_MAX_LCORE_LINKS ]; + /**< Per link conf */ };#endif /* _RTE_EVENTMODE_HELPER_INTERNAL_H_ */
Signature · 1 line
2.7.4
PATCH 22/39 eventdev: add option to specify schedule mode for app stage
In reply to a message not in the archiveScheduling mode for each event queue is dependent on the same of app stage. Configure event queue taking this also into account.
--- lib/librte_eventdev/rte_eventmode_helper.c | 24 ++++++++++++++++++++-- .../rte_eventmode_helper_internal.h | 8 ++++++++ 2 files changed, 30 insertions(+), 2 deletions(-)
lib/librte_eventdev/rte_eventmode_helper.c +22 -2
@@ -85,6 +85,8 @@ em_parse_transfer_mode(struct rte_eventmode_helper_conf *conf,static void em_initialize_helper_conf (struct rte_eventmode_helper_conf *conf) { +struct eventmode_conf *em_conf =NULL ; +/* Set default conf */ /* Packet transfer mode: poll */
@@ -92,6 +94,13 @@ em_initialize_helper_conf(struct rte_eventmode_helper_conf *conf)/* Keep all ethernet ports enabled by default */ conf->eth_portmask =-1 ; + +/* Get eventmode conf */ + em_conf = (struct eventmode_conf *)(conf->mode_params); + +/* Schedule type: ordered */ +/* FIXME */ + em_conf->ext_params.sched_type =RTE_SCHED_TYPE_ORDERED ; }struct rte_eventmode_helper_conf * __rte_experimental
@@ -233,8 +242,19 @@ rte_eventmode_helper_initialize_eventdev(struct eventmode_conf *em_conf) eventq_conf.event_queue_cfg = eventdev_config->ev_queue_mode; -/* Set schedule type as ATOMIC */ - eventq_conf.schedule_type =RTE_SCHED_TYPE_ATOMIC ; +/* +* All queues need to be set with sched_type as +* schedule type for the application stage. One queue +* would be reserved for the final eth tx stage. This +* will be an atomic queue. +*/ +if (j == nb_eventqueue-1 ) { + eventq_conf.schedule_type = +RTE_SCHED_TYPE_ATOMIC ; + }else { + eventq_conf.schedule_type = + em_conf->ext_params.sched_type; + }/* Set max atomic flows to 1024 */ eventq_conf.nb_atomic_flows =1024 ;
lib/librte_eventdev/rte_eventmode_helper_internal.h +8 -0
@@ -61,6 +61,14 @@ struct eventmode_conf {struct rte_eventmode_helper_event_link_info link[EVENT_MODE_MAX_LCORE_LINKS ];/**< Per link conf */ +union { +struct { +uint64_t sched_type :2 ; +/**< Schedule type */ + }; +uint64_t u64; + } ext_params; + /**< 64 bit field to specify extended params */ };#endif /* _RTE_EVENTMODE_HELPER_INTERNAL_H_ */
Signature · 1 line
2.7.4
PATCH 23/39 eventdev: add placeholder for ethdev init
In reply to a message not in the archivePresently, all the applications would do ethdev init and then pass control to eventmode helper init. So not doing any "real" initialization. But this would be expanded once applications are modified to pass the eth init task also to the helper routine.
--- lib/librte_eventdev/rte_eventmode_helper.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
lib/librte_eventdev/rte_eventmode_helper.c +13 -0
@@ -318,6 +318,14 @@ rte_eventmode_helper_initialize_eventdev(struct eventmode_conf *em_conf)return 0 ; } +static int +rte_eventmode_helper_initialize_ethdev (struct eventmode_conf *em_conf) +{ +RTE_SET_USED (em_conf); + +return 0 ; +} + int32_t __rte_experimentalrte_eventmode_helper_initialize_devs (struct rte_eventmode_helper_conf *mode_conf)
@@ -357,6 +365,11 @@ rte_eventmode_helper_initialize_devs(if (ret !=0 )return ret; +/* Setup ethdev */ + ret =rte_eventmode_helper_initialize_ethdev (em_conf); +if (ret !=0 ) +return ret; +/* Start eth devices after setting up adapter */ RTE_ETH_FOREACH_DEV (portid) {
Signature · 1 line
2.7.4
PATCH 24/39 eventdev: add Rx adapter init in eventmode
In reply to a message not in the archiveAdding rx adapter conf. The helper init routine would be initializing the rx adapter according to the conf.
--- lib/librte_eventdev/rte_eventmode_helper.c | 123 +++++++++++++++++++++ .../rte_eventmode_helper_internal.h | 27 +++++ 2 files changed, 150 insertions(+)
lib/librte_eventdev/rte_eventmode_helper.c +123 -0
@@ -6,6 +6,7 @@#include <rte_ethdev.h> #include <rte_eventdev.h> #include <rte_eventmode_helper.h> +#include <rte_event_eth_rx_adapter.h> #include <rte_malloc.h> #include "rte_eventmode_helper_internal.h"
@@ -326,6 +327,123 @@ rte_eventmode_helper_initialize_ethdev(struct eventmode_conf *em_conf)return 0 ; } +static int +rx_adapter_configure (struct eventmode_conf *em_conf, +struct rx_adapter_conf *adapter) +{ +int j; +int ret; +uint8_t eventdev_id; +uint32_t service_id; +struct adapter_connection_info *conn; +struct rte_event_port_conf port_conf = {0 }; +struct rte_event_eth_rx_adapter_queue_conf queue_conf = {0 }; +struct rte_event_dev_info evdev_default_conf = {0 }; + +/* Get event dev ID */ + eventdev_id = adapter->eventdev_id; + +/* Create rx_adapter */ + +/* Get default configuration of event dev */ + ret =rte_event_dev_info_get (eventdev_id, &evdev_default_conf); +if (ret <0 ) { +RTE_EM_HLPR_LOG_ERR ( +"Error in getting event device info[devID:%d]" , + eventdev_id); +return ret; + } + +/* Setup port conf */ + port_conf.new_event_threshold =1200 ; + port_conf.dequeue_depth = + evdev_default_conf.max_event_port_dequeue_depth; + port_conf.enqueue_depth = + evdev_default_conf.max_event_port_enqueue_depth; + +/* Create Rx adapter */ + ret =rte_event_eth_rx_adapter_create (adapter->adapter_id, + adapter->eventdev_id, + &port_conf); +if (ret <0 ) { +RTE_EM_HLPR_LOG_ERR ("Error in rx adapter creation" ); +return ret; + } + +/* Setup various connections in the adapter */ + + queue_conf.rx_queue_flags = +RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID ; + +for (j =0 ; j < adapter->nb_connections; j++) { +/* Get connection */ + conn = &(adapter->conn[j]); + +/* Setup queue conf */ + queue_conf.ev.queue_id = conn->eventq_id; + queue_conf.ev.sched_type = em_conf->ext_params.sched_type; + +/* Set flow ID as ethdev ID */ + queue_conf.ev.flow_id = conn->ethdev_id; + +/* Add queue to the adapter */ + ret =rte_event_eth_rx_adapter_queue_add ( + adapter->adapter_id, + conn->ethdev_id, + conn->ethdev_rx_qid, + &queue_conf); +if (ret <0 ) { +RTE_EM_HLPR_LOG_ERR ( +"Error in adding eth queue in Rx adapter" ); +return ret; + } + } + +/* Get the service ID used by rx adapter */ + ret =rte_event_eth_rx_adapter_service_id_get (adapter->adapter_id, + &service_id); +if (ret != -ESRCH && ret !=0 ) { +RTE_EM_HLPR_LOG_ERR ( +"Error getting service ID used by Rx adapter" ); +return ret; + } + +/* +* TODO +* Rx core will invoke the service when required. The runstate check +* is not required. +* +*/ +rte_service_set_runstate_mapped_check (service_id,0 ); + +/* Start adapter */ + ret =rte_event_eth_rx_adapter_start (adapter->adapter_id); +if (ret) { +RTE_EM_HLPR_LOG_ERR ("Error in starting rx adapter" ); +return ret; + } + +return 0 ; +} + +static int +rte_eventmode_helper_initialize_rx_adapter (struct eventmode_conf *em_conf) +{ +int i, ret; +struct rx_adapter_conf *adapter; + +/* Configure rx adapters */ +for (i =0 ; i < em_conf->nb_rx_adapter; i++) { + adapter = &(em_conf->rx_adapter[i]); + ret =rx_adapter_configure (em_conf, adapter); +if (ret <0 ) { +RTE_EM_HLPR_LOG_ERR ("Rx adapter configuration failed" ); +return ret; + } + } +return 0 ; +} + int32_t __rte_experimentalrte_eventmode_helper_initialize_devs (struct rte_eventmode_helper_conf *mode_conf)
@@ -370,6 +488,11 @@ rte_eventmode_helper_initialize_devs(if (ret !=0 )return ret; +/* Setup Rx adapter */ + ret =rte_eventmode_helper_initialize_rx_adapter (em_conf); +if (ret !=0 ) +return ret; +/* Start eth devices after setting up adapter */ RTE_ETH_FOREACH_DEV (portid) {
lib/librte_eventdev/rte_eventmode_helper_internal.h +27 -0
@@ -35,6 +35,12 @@/* Max event devices supported */ #define EVENT_MODE_MAX_EVENT_DEVS RTE_EVENT_MAX_DEVS +/* Max Rx adapters supported */ +#define EVENT_MODE_MAX_RX_ADAPTERS RTE_EVENT_MAX_DEVS + +/* Max Rx adapter connections */ +#define EVENT_MODE_MAX_CONNECTIONS_PER_ADAPTER 16 +/* Max event queues supported per event device */ #define EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV RTE_EVENT_MAX_QUEUES_PER_DEV
@@ -50,12 +56,33 @@ struct eventdev_params {uint8_t ev_queue_mode; }; +/* Rx adapter connection info */ +struct adapter_connection_info { +uint8_t ethdev_id; +uint8_t eventq_id; +int32_t ethdev_rx_qid; +}; + +/* Rx adapter conf */ +struct rx_adapter_conf { +int32_t eventdev_id; +int32_t adapter_id; +uint32_t rx_core_id; +uint8_t nb_connections; +struct adapter_connection_info + conn[EVENT_MODE_MAX_CONNECTIONS_PER_ADAPTER ]; +}; +/* Eventmode conf data */ struct eventmode_conf {int nb_eventdev;/**< No of event devs */ struct eventdev_params eventdev_config[EVENT_MODE_MAX_EVENT_DEVS ];/**< Per event dev conf */ +uint8_t nb_rx_adapter; +/**< No of Rx adapters */ +struct rx_adapter_conf rx_adapter[EVENT_MODE_MAX_RX_ADAPTERS ]; +/**< Rx adapter conf */ uint8_t nb_link;/**< No of links */ struct rte_eventmode_helper_event_link_info
Signature · 1 line
2.7.4
Re: [dpdk-dev] [EXT] [PATCH 24/39] eventdev: add Rx adapter init in eventmode
Regards
Sunil Kumar Kori
Quoted 166 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Anoob Joseph
Sent: Monday, June 3, 2019 10:19 PM
To: Jerin Jacob Kollanukkaran <[email protected]>; Nikhil Rao <[email protected]>; Erik Gabriel Carrillo <[email protected]>; Abhinandan Gujjar <[email protected]>; Bruce Richardson <[email protected]>; Pablo de Lara <[email protected]>
Cc: Narayana Prasad Raju Athreya <[email protected]>; [email protected]; Lukas Bartosik <[email protected]>; Pavan Nikhilesh Bhagavatula <[email protected]>; Hemant Agrawal <[email protected]>; Nipun Gupta <[email protected]>; Harry van Haaren <[email protected]>; Mattias Rönnblom <[email protected]>; Liang Ma <[email protected]>; Anoob Joseph <[email protected]>
Subject: [EXT] [dpdk-dev] [PATCH 24/39] eventdev: add Rx adapter init in eventmodeExternal Email
----------------------------------------------------------------------
Adding rx adapter conf. The helper init routine would be initializing the rx adapter according to the conf.Signed-off-by Anoob Joseph <[email protected]>Signed-off-by Lukasz Bartosik <[email protected]>---
lib/librte_eventdev/rte_eventmode_helper.c| 123
+++++++++++++++++++++.../rte_eventmode_helper_internal.h| 27 +++++2 files changed, 150 insertions(+)lib/librte_eventdev/rte_eventmode_helper.c +48
-0@@ -6,6 +6,7 @@#include <rte_ethdev.h> #include <rte_eventdev.h> #include <rte_eventmode_helper.h> +#include <rte_event_eth_rx_adapter.h> #include <rte_malloc.h> #include "rte_eventmode_helper_internal.h" @@ -326,6 +327,123 @@ rte_eventmode_helper_initialize_ethdev(struct eventmode_conf *em_conf)return 0 ; } +static int +rx_adapter_configure (struct eventmode_conf *em_conf, +struct rx_adapter_conf *adapter) +{ +int j; +int ret; +uint8_t eventdev_id; +uint32_t service_id; +struct adapter_connection_info *conn; +struct rte_event_port_conf port_conf = {0 }; +struct rte_event_eth_rx_adapter_queue_conf queue_conf = {0 }; +struct rte_event_dev_info evdev_default_conf = {0 }; + +/* Get event dev ID */ + eventdev_id = adapter->eventdev_id; + +/* Create rx_adapter */ + +/* Get default configuration of event dev */ + ret =rte_event_dev_info_get (eventdev_id, &evdev_default_conf); +if (ret <0 ) { +RTE_EM_HLPR_LOG_ERR ( +"Error in getting event device info[devID:%d]" , + eventdev_id); +return ret; + } + +/* Setup port conf */ + port_conf.new_event_threshold =1200 ; + port_conf.dequeue_depth = + evdev_default_conf.max_event_port_dequeue_depth; + port_conf.enqueue_depth = + evdev_default_conf.max_event_port_enqueue_depth; + +/* Create Rx adapter */ + ret =rte_event_eth_rx_adapter_create (adapter->adapter_id, + adapter->eventdev_id, + &port_conf); +if (ret <0 ) { +RTE_EM_HLPR_LOG_ERR ("Error in rx adapter creation" ); +return ret; + } + +/* Setup various connections in the adapter */ + + queue_conf.rx_queue_flags = +RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;lib/librte_eventdev/rte_eventmode_helper.c +8
-0+ +for (j =0 ; j < adapter->nb_connections; j++) { +/* Get connection */ + conn = &(adapter->conn[j]); + +/* Setup queue conf */ + queue_conf.ev.queue_id = conn->eventq_id; + queue_conf.ev.sched_type = em_conf-Quoted 1 line
ext_params.sched_type;
lib/librte_eventdev/rte_eventmode_helper.c +56
-0+ +/* Set flow ID as ethdev ID */ + queue_conf.ev.flow_id = conn->ethdev_id; + +/* Add queue to the adapter */ + ret =rte_event_eth_rx_adapter_queue_add ( + adapter->adapter_id, + conn->ethdev_id, + conn->ethdev_rx_qid, + &queue_conf); +if (ret <0 ) { +RTE_EM_HLPR_LOG_ERR ( +"Error in adding eth queue in Rx adapter" ); +return ret; + } + } + +/* Get the service ID used by rx adapter */ + ret =rte_event_eth_rx_adapter_service_id_get (adapter->adapter_id, + &service_id); +if (ret != -ESRCH && ret !=0 ) { +RTE_EM_HLPR_LOG_ERR ( +"Error getting service ID used by Rx adapter" ); +return ret; + } + +/* +* TODO +* Rx core will invoke the service when required. The runstate check +* is not required. +* +*/ +rte_service_set_runstate_mapped_check (service_id,0 ); + +/* Start adapter */ + ret =rte_event_eth_rx_adapter_start (adapter->adapter_id); +if (ret) { +RTE_EM_HLPR_LOG_ERR ("Error in starting rx adapter" ); +return ret; + } + +return 0 ; +} + +static int +rte_eventmode_helper_initialize_rx_adapter (struct eventmode_conf +*em_conf) { +int i, ret; +struct rx_adapter_conf *adapter; + +/* Configure rx adapters */ +for (i =0 ; i < em_conf->nb_rx_adapter; i++) { + adapter = &(em_conf->rx_adapter[i]); + ret =rx_adapter_configure (em_conf, adapter); +if (ret <0 ) { + RTE_EM_HLPR_LOG_ERR("Rx adapter configurationfailed");
lib/librte_eventdev/rte_eventmode_helper.c
Quoted 1 line
lib/librte_eventdev/rte_eventmode_helper.c +1
-0+return ret;
If rx_adapter_configure gets failed for second adapter (say em_conf->nb_rx_adapter = 2) then cleanup for first adapter is required or not ? What will be application's view in this case ? Check for others components too.
Quoted 78 lines
lib/librte_eventdev/rte_eventmode_helper.c +5
-0+ } + } +return 0 ; +} +
int32_t__rte_experimental
rte_eventmode_helper_initialize_devs(struct rte_eventmode_helper_conf *mode_conf) @@ -370,6 +488,11 @@ rte_eventmode_helper_initialize_devs( if (ret != 0) return ret;lib/librte_eventdev/rte_eventmode_helper.c +5
-0+/* Setup Rx adapter */ + ret =rte_eventmode_helper_initialize_rx_adapter (em_conf); +if (ret !=0 ) +return ret; +/* Start eth devices after setting up adapter */ RTE_ETH_FOREACH_DEV(portid) {lib/librte_eventdev/rte_eventmode_helper_internal.h +6
-0@@ -35,6 +35,12 @@/* Max event devices supported */ #define EVENT_MODE_MAX_EVENT_DEVS RTE_EVENT_MAX_DEVS +/* Max Rx adapters supported */ +#define EVENT_MODE_MAX_RX_ADAPTERS RTE_EVENT_MAX_DEVS + +/* Max Rx adapter connections */ +#define EVENT_MODE_MAX_CONNECTIONS_PER_ADAPTER 16 + /* Max event queues supported per event device */ #define
EVENT_MODE_MAX_EVENT_QUEUES_PER_DEVRTE_EVENT_MAX_QUEUES_PER_DEVlib/librte_eventdev/rte_eventmode_helper_internal.h +21
-0@@ -50,12 +56,33 @@ struct eventdev_params {uint8_t ev_queue_mode; }; +/* Rx adapter connection info */ +struct adapter_connection_info { +uint8_t ethdev_id; +uint8_t eventq_id; +int32_t ethdev_rx_qid; +}; + +/* Rx adapter conf */ +struct rx_adapter_conf { +int32_t eventdev_id; +int32_t adapter_id; +uint32_t rx_core_id; +uint8_t nb_connections; +struct adapter_connection_info + conn[EVENT_MODE_MAX_CONNECTIONS_PER_ADAPTER ]; +}; +/* Eventmode conf data */ struct eventmode_conf {int nb_eventdev;/**< No of event devs */ struct eventdev_params eventdev_config[EVENT_MODE_MAX_EVENT_DEVS ];/**< Per event dev conf */ +uint8_t nb_rx_adapter; +/**< No of Rx adapters */ +struct rx_adapter_conf rx_adapter[EVENT_MODE_MAX_RX_ADAPTERS ]; +/**< Rx adapter conf */ uint8_t nb_link; /**< No of links */ struct rte_eventmode_helper_event_link_info--
2.7.4
PATCH 25/39 eventdev: add routine to validate conf
In reply to a message not in the archiveAdding routine to validate event mode conf. This function will verify the conf requested by the user and would populate other fields with default values. Presently, the function acts as placeholder for the above mentioned actions.
--- lib/librte_eventdev/rte_eventmode_helper.c | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
lib/librte_eventdev/rte_eventmode_helper.c +33 -0
@@ -165,6 +165,32 @@ rte_eventmode_helper_parse_args(int argc, char **argv)return NULL ; } +/* Pre-process conf before using for init*/ + +static int +rte_eventmode_validate_user_params (struct eventmode_conf *em_conf) +{ +/* TODO */ +/* Check sanity of the conf requested by user */ + +RTE_SET_USED (em_conf); + +return 0 ; +} + +static int +rte_eventmode_helper_validate_conf (struct eventmode_conf *em_conf) +{ +int ret; + +/* After parsing all args, verify that the conf can be allowed */ + ret =rte_eventmode_validate_user_params (em_conf); +if (ret !=0 ) +return ret; + +return 0 ; +} +/* Setup eventmode devs */ static int
@@ -468,6 +494,13 @@ rte_eventmode_helper_initialize_devs(/* Get eventmode conf */ em_conf = (struct eventmode_conf *)(mode_conf->mode_params); +/* Validate the conf requested */ +if (rte_eventmode_helper_validate_conf (em_conf) !=0 ) { +RTE_EM_HLPR_LOG_ERR ( +"Failed while validating the conf requested" ); +return -1 ; + } +/* Stop eth devices before setting up adapter */ RTE_ETH_FOREACH_DEV (portid) {
Signature · 1 line
2.7.4
PATCH 26/39 eventdev: add default conf for event devs field in conf
In reply to a message not in the archiveGenerate a default conf for event devs, if it's not specified in the conf. This routine will check the available event devices and it's properties and sets the conf accordingly.
--- lib/librte_eventdev/rte_eventmode_helper.c | 67 ++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+)
lib/librte_eventdev/rte_eventmode_helper.c +67 -0
@@ -179,6 +179,63 @@ rte_eventmode_validate_user_params(struct eventmode_conf *em_conf) }static int +rte_eventmode_helper_set_default_conf_eventdev (struct eventmode_conf *em_conf) +{ +int i, ret; +int nb_eventdev; +struct eventdev_params *eventdev_config; +struct rte_event_dev_info dev_info; + +/* Get the number of event devices */ + nb_eventdev =rte_event_dev_count (); + +if (nb_eventdev ==0 ) { +RTE_EM_HLPR_LOG_ERR ("No event devices detected" ); +return -1 ; + } + +for (i =0 ; i < nb_eventdev; i++) { + +/* Get the event dev conf */ + eventdev_config = &(em_conf->eventdev_config[i]); + +/* Read event device info */ + ret =rte_event_dev_info_get (i, &dev_info); + +if (ret <0 ) { +RTE_EM_HLPR_LOG_ERR ( +"Failed reading event device info (err:%d)" , + ret); +return ret; + } + +/* Check if enough ports are available */ +if (dev_info.max_event_ports <2 ) { +RTE_EM_HLPR_LOG_ERR ("Not enough ports available" ); +return -1 ; + } + +/* Save number of queues & ports available */ + eventdev_config->eventdev_id = i; + eventdev_config->nb_eventqueue = dev_info.max_event_queues; + eventdev_config->nb_eventport = dev_info.max_event_ports; + eventdev_config->ev_queue_mode = +RTE_EVENT_QUEUE_CFG_SINGLE_LINK ; + +/* One port is required for eth Rx adapter */ + eventdev_config->nb_eventport -=1 ; + +/* One port is reserved for eth Tx adapter */ + eventdev_config->nb_eventport -=1 ; + +/* Update the number of eventdevs */ + em_conf->nb_eventdev++; + } + +return 0 ; +} + +static int rte_eventmode_helper_validate_conf (struct eventmode_conf *em_conf) {int ret;
@@ -188,6 +245,16 @@ rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf)if (ret !=0 )return ret; +/* +* See if event devs are specified. Else probe the event devices +* and initialize the conf with all ports & queues available +*/ +if (em_conf->nb_eventdev ==0 ) { + ret =rte_eventmode_helper_set_default_conf_eventdev (em_conf); +if (ret !=0 ) +return ret; + } +return 0 ; }
Signature · 1 line
2.7.4
Re: [dpdk-dev] [EXT] [PATCH 26/39] eventdev: add default conf for event devs field in conf
Regards
Sunil Kumar Kori
Quoted 74 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Anoob Joseph
Sent: Monday, June 3, 2019 10:20 PM
To: Jerin Jacob Kollanukkaran <[email protected]>; Nikhil Rao <[email protected]>; Erik Gabriel Carrillo <[email protected]>; Abhinandan Gujjar <[email protected]>; Bruce Richardson <[email protected]>; Pablo de Lara <[email protected]>
Cc: Narayana Prasad Raju Athreya <[email protected]>; [email protected]; Lukas Bartosik <[email protected]>; Pavan Nikhilesh Bhagavatula <[email protected]>; Hemant Agrawal <[email protected]>; Nipun Gupta <[email protected]>; Harry van Haaren <[email protected]>; Mattias Rönnblom <[email protected]>; Liang Ma <[email protected]>; Anoob Joseph <[email protected]>
Subject: [EXT] [dpdk-dev] [PATCH 26/39] eventdev: add default conf for event devs field in confExternal Email
----------------------------------------------------------------------
Generate a default conf for event devs, if it's not specified in the conf. This routine will check the available event devices and it's properties and sets the conf accordingly.Signed-off-by Anoob Joseph <[email protected]>Signed-off-by Lukasz Bartosik <[email protected]>---
lib/librte_eventdev/rte_eventmode_helper.c| 67
++++++++++++++++++++++++++++++1 file changed, 67 insertions(+)lib/librte_eventdev/rte_eventmode_helper.c +0
-0@@ -179,6 +179,63 @@ rte_eventmode_validate_user_params(struct eventmode_conf *em_conf) }static int
lib/librte_eventdev/rte_eventmode_helper.c +33
-0+rte_eventmode_helper_set_default_conf_eventdev (struct eventmode_conf +*em_conf) { +int i, ret; +int nb_eventdev; +struct eventdev_params *eventdev_config; +struct rte_event_dev_info dev_info; + +/* Get the number of event devices */ + nb_eventdev =rte_event_dev_count (); + +if (nb_eventdev ==0 ) { +RTE_EM_HLPR_LOG_ERR ("No event devices detected" ); +return -1 ; + } + +for (i =0 ; i < nb_eventdev; i++) { + +/* Get the event dev conf */ + eventdev_config = &(em_conf->eventdev_config[i]); + +/* Read event device info */ + ret =rte_event_dev_info_get (i, &dev_info); + +if (ret <0 ) { +RTE_EM_HLPR_LOG_ERR ( +"Failed reading event device info (err:%d)" , + ret); +return ret; + } + +/* Check if enough ports are available */ +if (dev_info.max_event_ports <2 ) { + RTE_EM_HLPR_LOG_ERR("Not enough ports
Quoted 1 line
available");
"Not Enough event ports available" instead of "Not enough ports available". Otherwise it looks confusing with eth ports.
Quoted 48 lines
lib/librte_eventdev/rte_eventmode_helper.c +6
-0+return -1 ; + } + +/* Save number of queues & ports available */ + eventdev_config->eventdev_id = i; + eventdev_config->nb_eventqueue =dev_info.max_event_queues;
lib/librte_eventdev/rte_eventmode_helper.c +18
-0+ eventdev_config->nb_eventport = dev_info.max_event_ports; + eventdev_config->ev_queue_mode = +RTE_EVENT_QUEUE_CFG_SINGLE_LINK ; + +/* One port is required for eth Rx adapter */ + eventdev_config->nb_eventport -=1 ; + +/* One port is reserved for eth Tx adapter */ + eventdev_config->nb_eventport -=1 ; + +/* Update the number of eventdevs */ + em_conf->nb_eventdev++; + } + +return 0 ; +} + +static intrte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf) { int ret;lib/librte_eventdev/rte_eventmode_helper.c +10
-0@@ -188,6 +245,16 @@ rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf)if (ret !=0 )return ret; +/* +* See if event devs are specified. Else probe the event devices +* and initialize the conf with all ports & queues available +*/ +if (em_conf->nb_eventdev ==0 ) { + ret =rte_eventmode_helper_set_default_conf_eventdev (em_conf); +if (ret !=0 ) +return ret; + } +return 0 ;}
--
2.7.4
PATCH 27/39 eventdev: add default conf for Rx adapter conf
In reply to a message not in the archiveGenerate a default conf for Rx adapter, if not specified in the conf. This routine will check the available eth ports and event queues, and maps them 1:1. So one eth port will be connected to one event queue. This way, event queue ID could be used to figure out the port on which the packet came in.
--- lib/librte_eventdev/rte_eventmode_helper.c | 127 +++++++++++++++++++++ .../rte_eventmode_helper_internal.h | 4 + 2 files changed, 131 insertions(+)
lib/librte_eventdev/rte_eventmode_helper.c +127 -0
@@ -47,6 +47,30 @@ internal_parse_decimal(const char *str)return num; } +static inline unsigned int +internal_get_next_rx_core (struct eventmode_conf *em_conf, +unsigned int prev_core) +{ +unsigned int next_core; + +get_next_core: +/* Get the next core */ + next_core =rte_get_next_lcore (prev_core,0 ,0 ); + +/* Check if we have reached max lcores */ +if (next_core ==RTE_MAX_LCORE ) +return next_core; + +/* Only some cores would be marked as rx cores. Skip others */ +if (!(em_conf->eth_core_mask & (1 << next_core))) { + prev_core = next_core; + goto get_next_core; + } + +return next_core; +} + +/* Global functions */ void __rte_experimental
@@ -87,6 +111,7 @@ static void em_initialize_helper_conf(struct rte_eventmode_helper_conf *conf) {struct eventmode_conf *em_conf =NULL ; +unsigned int rx_core_id;/* Set default conf */
@@ -102,6 +127,12 @@ em_initialize_helper_conf(struct rte_eventmode_helper_conf *conf)/* Schedule type: ordered */ /* FIXME */ em_conf->ext_params.sched_type =RTE_SCHED_TYPE_ORDERED ; +/* Set rx core. Use first core other than master core as Rx core */ + rx_core_id =rte_get_next_lcore (0 ,/* curr core */ +1 ,/* skip master core */ +0 /* wrap */ ); + + em_conf->eth_core_mask = (1 << rx_core_id); }struct rte_eventmode_helper_conf * __rte_experimental
@@ -236,6 +267,89 @@ rte_eventmode_helper_set_default_conf_eventdev(struct eventmode_conf *em_conf) }static int +rte_eventmode_helper_set_default_conf_rx_adapter (struct eventmode_conf *em_conf) +{ +int nb_eth_dev; +int i; +int adapter_id; +int eventdev_id; +int conn_id; +struct rx_adapter_conf *adapter; +struct adapter_connection_info *conn; +struct eventdev_params *eventdev_config; + +/* Create one adapter with all eth queues mapped to event queues 1:1 */ + +if (em_conf->nb_eventdev ==0 ) { +RTE_EM_HLPR_LOG_ERR ("No event devs registered" ); +return -1 ; + } + +/* Get the number of eth devs */ + nb_eth_dev =rte_eth_dev_count_avail (); + +/* Use the first event dev */ + eventdev_config = &(em_conf->eventdev_config[0 ]); + +/* Get eventdev ID */ + eventdev_id = eventdev_config->eventdev_id; + adapter_id =0 ; + +/* Get adapter conf */ + adapter = &(em_conf->rx_adapter[adapter_id]); + +/* Set adapter conf */ + adapter->eventdev_id = eventdev_id; + adapter->adapter_id = adapter_id; + adapter->rx_core_id =internal_get_next_rx_core (em_conf,-1 ); + +/* +* All queues of one eth device (port) will be mapped to one event +* queue. Each port will have an individual connection. +* +*/ + +/* Make sure there is enough event queues for 1:1 mapping */ +if (nb_eth_dev > eventdev_config->nb_eventqueue) { +RTE_EM_HLPR_LOG_ERR ( +"Not enough event queues for 1:1 mapping " +"[eth devs: %d, event queues: %d]\n" , + nb_eth_dev, + eventdev_config->nb_eventqueue); +return -1 ; + } + +for (i =0 ; i < nb_eth_dev; i++) { + +/* Use only the ports enabled */ +if ((em_conf->eth_portmask & (1 << i)) ==0 ) +continue ; + +/* Get the connection id */ + conn_id = adapter->nb_connections; + +/* Get the connection */ + conn = &(adapter->conn[conn_id]); + +/* Set 1:1 mapping between eth ports & event queues*/ + conn->ethdev_id = i; + conn->eventq_id = i; + +/* Add all eth queues of one eth port to one event queue */ + conn->ethdev_rx_qid =-1 ; + +/* Update no of connections */ + adapter->nb_connections++; + + } + +/* We have setup one adapter */ + em_conf->nb_rx_adapter =1 ; + +return 0 ; +} + +static int rte_eventmode_helper_validate_conf (struct eventmode_conf *em_conf) {int ret;
@@ -255,6 +369,16 @@ rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf)return ret; } +/* +* See if rx adapters are specified. Else generate a default conf +* with one rx adapter and all eth queue - event queue mapped. +*/ +if (em_conf->nb_rx_adapter ==0 ) { + ret =rte_eventmode_helper_set_default_conf_rx_adapter (em_conf); +if (ret !=0 ) +return ret; + } +return 0 ; }
@@ -561,6 +685,9 @@ rte_eventmode_helper_initialize_devs(/* Get eventmode conf */ em_conf = (struct eventmode_conf *)(mode_conf->mode_params); +/* Eventmode conf would need eth portmask */ + em_conf->eth_portmask = mode_conf->eth_portmask; +/* Validate the conf requested */ if (rte_eventmode_helper_validate_conf (em_conf) !=0 ) { RTE_EM_HLPR_LOG_ERR(
lib/librte_eventdev/rte_eventmode_helper_internal.h +4 -0
@@ -88,6 +88,10 @@ struct eventmode_conf {struct rte_eventmode_helper_event_link_info link[EVENT_MODE_MAX_LCORE_LINKS ];/**< Per link conf */ +uint32_t eth_core_mask; +/**< Core mask of cores to be used for software Rx and Tx */ +uint32_t eth_portmask; +/**< Mask of the eth ports to be used */ union { struct { uint64_t sched_type : 2;
Signature · 1 line
2.7.4
PATCH 28/39 eventdev: add default conf for event port-lcore link
In reply to a message not in the archiveGenerate a default conf for event port-lcore link, if not specified in the conf. This routine will check the number of available ports and then create links according to the number of cores available.
This patch also adds a new entry in the eventmode conf to denote that all queues is to be linked with every port. This enables one core to receive packets from every port.
--- lib/librte_eventdev/rte_eventmode_helper.c | 109 ++++++++++++++++++++- .../rte_eventmode_helper_internal.h | 5 + 2 files changed, 113 insertions(+), 1 deletion(-)
lib/librte_eventdev/rte_eventmode_helper.c +108 -1
@@ -70,6 +70,28 @@ internal_get_next_rx_core(struct eventmode_conf *em_conf,return next_core; } +static inline unsigned int +internal_get_next_active_core (struct eventmode_conf *em_conf, +unsigned int prev_core) +{ +unsigned int next_core; + +get_next_core: +/* Get the next core */ + next_core =rte_get_next_lcore (prev_core,0 ,0 ); + +/* Check if we have reached max lcores */ +if (next_core ==RTE_MAX_LCORE ) +return next_core; + +/* Some cores would be reserved as rx cores. Skip them */ +if (em_conf->eth_core_mask & (1 << next_core)) { + prev_core = next_core; + goto get_next_core; + } + +return next_core; +}/* Global functions */
@@ -350,6 +372,74 @@ rte_eventmode_helper_set_default_conf_rx_adapter(struct eventmode_conf *em_conf) }static int +rte_eventmode_helper_set_default_conf_link (struct eventmode_conf *em_conf) +{ +int i, j; +struct eventdev_params *eventdev_config; +unsigned int lcore_id =-1 ; +int link_index; +struct rte_eventmode_helper_event_link_info *link; + +/* +* Create a 1:1 mapping from event ports to cores. If the number +* of event ports is lesser than the cores, some cores won't +* execute worker. If event ports are more, then some ports won't +* be used. +* +*/ + +/* +* The event queue-port mapping is done according to the link. Since +* we are falling back to the default link conf, enabling +* "all_ev_queue_to_ev_port" mode flag. This will map all queues to the +* port. +*/ + em_conf->ext_params.all_ev_queue_to_ev_port =1 ; + +for (i =0 ; i < em_conf->nb_eventdev; i++) { + +/* Get event dev conf */ + eventdev_config = &(em_conf->eventdev_config[i]); + +/* Loop through the ports */ +for (j =0 ; j < eventdev_config->nb_eventport; j++) { + +/* Get next active core id */ + lcore_id =internal_get_next_active_core (em_conf, + lcore_id); + +if (lcore_id ==RTE_MAX_LCORE ) { +/* Reached max cores */ +return 0 ; + } + +/* Save the current combination as one link */ + +/* Get the index */ + link_index = em_conf->nb_link; + +/* Get the corresponding link */ + link = &(em_conf->link[link_index]); + +/* Save link */ + link->eventdev_id = eventdev_config->eventdev_id; + link->event_portid = j; + link->lcore_id = lcore_id; + +/* +* Not setting eventq_id as by default all queues +* need to be mapped to the port, and is controlled +* by the operating mode. +*/ + +/* Update number of links */ + em_conf->nb_link++; + } + } +return 0 ; +} + +static int rte_eventmode_helper_validate_conf (struct eventmode_conf *em_conf) {int ret;
@@ -379,6 +469,16 @@ rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf)return ret; } +/* +* See if links are specified. Else generate a default conf for +* the event ports used. +*/ +if (em_conf->nb_link ==0 ) { + ret =rte_eventmode_helper_set_default_conf_link (em_conf); +if (ret !=0 ) +return ret; + } +return 0 ; }
@@ -508,7 +608,14 @@ rte_eventmode_helper_initialize_eventdev(struct eventmode_conf *em_conf)/* Get event dev ID */ eventdev_id = link->eventdev_id; - queue = &(link->eventq_id); +/* +* If "all_ev_queue_to_ev_port" params flag is selected, all +* queues need to be mapped to the port. +*/ +if (em_conf->ext_params.all_ev_queue_to_ev_port) + queue =NULL ; +else + queue = &(link->eventq_id);/* Link queue to port */ ret = rte_event_port_link(eventdev_id, link->event_portid,
lib/librte_eventdev/rte_eventmode_helper_internal.h +5 -0
@@ -96,6 +96,11 @@ struct eventmode_conf {struct {uint64_t sched_type :2 ;/**< Schedule type */ +uint64_t all_ev_queue_to_ev_port :1 ; +/**< +* When enabled, all event queues need to be mapped to +* each event port +*/ };uint64_t u64; } ext_params;
Signature · 1 line
2.7.4
PATCH 29/39 eventdev: add routines to display the eventmode conf
In reply to a message not in the archive--- lib/librte_eventdev/Makefile | 1 + lib/librte_eventdev/meson.build | 1 + lib/librte_eventdev/rte_eventdev_version.map | 1 + lib/librte_eventdev/rte_eventmode_helper.c | 3 + lib/librte_eventdev/rte_eventmode_helper.h | 11 ++ lib/librte_eventdev/rte_eventmode_helper_prints.c | 161 ++++++++++++++++++++++ 6 files changed, 178 insertions(+) create mode 100644 lib/librte_eventdev/rte_eventmode_helper_prints.c
lib/librte_eventdev/Makefile +1 -0
@@ -24,6 +24,7 @@ LDLIBS += -lrte_mbuf -lrte_cryptodev -lpthread # library source files SRCS-y += rte_eventdev.c SRCS-y += rte_eventmode_helper.c +SRCS-y += rte_eventmode_helper_prints.c SRCS-y += rte_event_ring.c SRCS-y += rte_event_eth_rx_adapter.c SRCS-y += rte_event_timer_adapter.c
lib/librte_eventdev/meson.build +1 -0
@@ -12,6 +12,7 @@ endif sources = files('rte_eventdev.c', 'rte_eventmode_helper.c', + 'rte_eventmode_helper_prints.c', 'rte_event_ring.c', 'rte_event_eth_rx_adapter.c', 'rte_event_timer_adapter.c',
lib/librte_eventdev/rte_eventdev_version.map +1 -0
@@ -132,4 +132,5 @@ EXPERIMENTAL { rte_eventmode_helper_print_options_description; rte_eventmode_helper_parse_args; rte_eventmode_helper_initialize_devs; + rte_eventmode_helper_display_conf; };
lib/librte_eventdev/rte_eventmode_helper.c +3 -0
@@ -802,6 +802,9 @@ rte_eventmode_helper_initialize_devs(return -1 ; } +/* Display the current conf */ +rte_eventmode_helper_display_conf (mode_conf); +/* Stop eth devices before setting up adapter */ RTE_ETH_FOREACH_DEV (portid) {
lib/librte_eventdev/rte_eventmode_helper.h +11 -0
@@ -101,6 +101,17 @@ int32_t __rte_experimentalrte_eventmode_helper_initialize_devs ( struct rte_eventmode_helper_conf *mode_conf); +/** +* Display event mode conf +* +* Parse the conf and display the current configuration. +* +* @param mode_conf +* Configuration of the mode in which app is doing packet handling +*/ +void __rte_experimental +rte_eventmode_helper_display_conf (struct rte_eventmode_helper_conf *mode_conf); + #ifdef __cplusplus }#endif
lib/librte_eventdev/rte_eventmode_helper_prints.c new file +161 -0
161 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 30/39 eventdev: add routine to access eventmode link info
In reply to a message not in the archiveWhen the application is drafted for single stage eventmode, it will be efficient to have the loop in the application space, rather than passing it on to the helper. But application would need to have info on the links to be able to do that efficiently. This function exposes the links to that application.
--- lib/librte_eventdev/rte_eventdev_version.map | 1 + lib/librte_eventdev/rte_eventmode_helper.c | 80 ++++++++++++++++++++++++++++ lib/librte_eventdev/rte_eventmode_helper.h | 24 +++++++++ 3 files changed, 105 insertions(+)
lib/librte_eventdev/rte_eventdev_version.map +1 -0
@@ -133,4 +133,5 @@ EXPERIMENTAL { rte_eventmode_helper_parse_args; rte_eventmode_helper_initialize_devs; rte_eventmode_helper_display_conf; + rte_eventmode_helper_get_event_lcore_links; };
lib/librte_eventdev/rte_eventmode_helper.c +80 -0
83 lines not on this page · raw message
lib/librte_eventdev/rte_eventmode_helper.h +24 -0
@@ -112,6 +112,30 @@ rte_eventmode_helper_initialize_devs( void __rte_experimentalrte_eventmode_helper_display_conf (struct rte_eventmode_helper_conf *mode_conf); +/** +* Get event dev - lcore links +* +* Since the execution loop is in the application, the application would need +* the info on which event port to be polled by an lcore etc. This helper +* function would help the application in doing so. The 'links' would point +* to the memory allocated for the links list, and the application should +* release this, once the use is over. +* +* @param lcore_id +* ID of the lcore for which the links list need to be populated +* @param mode_conf +* Configuration of the mode in which app is doing packet handling +* @param links +* Used to pass the pointer of the memory allocated by the helper to the +* application +* @return +* Number of links found for the lcore +*/ +uint8_t __rte_experimental +rte_eventmode_helper_get_event_lcore_links (uint32_t lcore_id, +struct rte_eventmode_helper_conf *mode_conf, +struct rte_eventmode_helper_event_link_info **links); + #ifdef __cplusplus }#endif
Signature · 1 line
2.7.4
PATCH 31/39 eventdev: add routine to access event queue for eth Tx
In reply to a message not in the archiveWhen the application is drafted for single stage eventmode, it will be efficient to have the loop in the application space, rather than passing it on to the helper.
When the application's stage is in ORDERED sched mode, the application will have to change the sched type of the event to ATOMIC before sending it, to ensure ingress ordering is maintained. Since, it is application who would do the tx, this info is required in it's space.
--- lib/librte_eventdev/rte_eventdev_version.map | 1 + lib/librte_eventdev/rte_eventmode_helper.c | 53 ++++++++++++++++++++++++++++ lib/librte_eventdev/rte_eventmode_helper.h | 21 +++++++++++ 3 files changed, 75 insertions(+)
lib/librte_eventdev/rte_eventdev_version.map +1 -0
@@ -134,4 +134,5 @@ EXPERIMENTAL { rte_eventmode_helper_initialize_devs; rte_eventmode_helper_display_conf; rte_eventmode_helper_get_event_lcore_links; + rte_eventmode_helper_get_tx_queue; };
lib/librte_eventdev/rte_eventmode_helper.c +53 -0
62 lines not on this page · raw message
lib/librte_eventdev/rte_eventmode_helper.h +21 -0
@@ -136,6 +136,27 @@ rte_eventmode_helper_get_event_lcore_links(uint32_t lcore_id,struct rte_eventmode_helper_conf *mode_conf, struct rte_eventmode_helper_event_link_info **links); +/** +* Get eventdev tx queue +* +* If the application uses event device which does not support internal port +* then it needs to submit the events to an atomic Tx queue before final +* transmission. The Tx queue will be atomic to make sure that ingress order of +* the packets is maintained. This Tx queue will be created internally by the +* eventmode helper subsystem, and application will need it's queue ID when it +* is running the execution loop. +* +* @param mode_conf +* Configuration of the mode in which app is doing packet handling +* @param eventdev_id +* Event device ID +* @return +* Tx queue ID +*/ +uint8_t __rte_experimental +rte_eventmode_helper_get_tx_queue (struct rte_eventmode_helper_conf *mode_conf, +uint8_t eventdev_id); + #ifdef __cplusplus }#endif
Signature · 1 line
2.7.4
PATCH 32/39 eventdev: add routine to launch eventmode workers
In reply to a message not in the archiveWith eventmode, workers could be drafted differently according to the capabilities of the underlying event device. The added function would receive an array of such workers and probes the eventmode properties to choose the worker.
--- lib/librte_eventdev/rte_eventdev_version.map | 1 + lib/librte_eventdev/rte_eventmode_helper.c | 240 +++++++++++++++++++++ lib/librte_eventdev/rte_eventmode_helper.h | 49 +++++ .../rte_eventmode_helper_internal.h | 3 + 4 files changed, 293 insertions(+)
lib/librte_eventdev/rte_eventdev_version.map +1 -0
@@ -135,4 +135,5 @@ EXPERIMENTAL { rte_eventmode_helper_display_conf; rte_eventmode_helper_get_event_lcore_links; rte_eventmode_helper_get_tx_queue; + rte_eventmode_helper_launch_worker; };
lib/librte_eventdev/rte_eventmode_helper.c +240 -0
261 lines not on this page · raw message
lib/librte_eventdev/rte_eventmode_helper.h +49 -0
67 lines not on this page · raw message
lib/librte_eventdev/rte_eventmode_helper_internal.h +3 -0
@@ -48,6 +48,9 @@#define EVENT_MODE_MAX_LCORE_LINKS \ (EVENT_MODE_MAX_EVENT_DEVS * EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV) +/* Max adapters that one Rx core can handle */ +#define EVENT_MODE_MAX_ADAPTERS_PER_RX_CORE EVENT_MODE_MAX_RX_ADAPTERS +/* Event dev params */ struct eventdev_params {uint8_t eventdev_id;
Signature · 1 line
2.7.4
PATCH 33/39 eventdev: add Tx adapter support
In reply to a message not in the archive--- lib/librte_eventdev/rte_eventmode_helper.c | 349 ++++++++++++++++++++- lib/librte_eventdev/rte_eventmode_helper.h | 24 ++ .../rte_eventmode_helper_internal.h | 30 ++ lib/librte_eventdev/rte_eventmode_helper_prints.c | 9 + 4 files changed, 399 insertions(+), 13 deletions(-)
lib/librte_eventdev/rte_eventmode_helper.c +336 -13
@@ -8,6 +8,7 @@#include <rte_eventdev.h> #include <rte_eventmode_helper.h> #include <rte_event_eth_rx_adapter.h> +#include <rte_event_eth_tx_adapter.h> #include <rte_malloc.h> #include "rte_eventmode_helper_internal.h"
@@ -50,25 +51,51 @@ internal_parse_decimal(const char *str)return num; } +static int +internal_get_enabled_cores (unsigned int core_mask) +{ +int i; +int count =0 ; + +RTE_LCORE_FOREACH (i) { +/* Check if this core is enabled in core_mask*/ +if (core_mask & (1 << i)) { +/* We have enabled core */ + count++; + } + } +return count; +} +static inline unsigned int -internal_get_next_rx_core (struct eventmode_conf *em_conf, -unsigned int prev_core) +internal_get_next_eth_core (struct eventmode_conf *em_conf) {unsigned int next_core; +static unsigned int prev_core =-1 ; + +/* +* Make sure we have atleast one eth core running, else the following +* logic would lead to an infinite loop. +*/ +if (internal_get_enabled_cores (em_conf->eth_core_mask) ==0 ) { +RTE_EM_HLPR_LOG_INFO ("No enabled eth core found" ); +return RTE_MAX_LCORE ; + } get_next_core:/* Get the next core */ - next_core =rte_get_next_lcore (prev_core,0 ,0 ); + next_core =rte_get_next_lcore (prev_core,0 ,1 );/* Check if we have reached max lcores */ if (next_core ==RTE_MAX_LCORE )return next_core; +/* Update prev_core */ + prev_core = next_core; +/* Only some cores would be marked as rx cores. Skip others */ -if (!(em_conf->eth_core_mask & (1 << next_core))) { - prev_core = next_core; +if (!(em_conf->eth_core_mask & (1 << next_core))) goto get_next_core; - }return next_core; }
@@ -164,7 +191,7 @@ static void em_initialize_helper_conf(struct rte_eventmode_helper_conf *conf) {struct eventmode_conf *em_conf =NULL ; -unsigned int rx_core_id; +unsigned int eth_core_id;/* Set default conf */
@@ -180,12 +207,21 @@ em_initialize_helper_conf(struct rte_eventmode_helper_conf *conf)/* Schedule type: ordered */ /* FIXME */ em_conf->ext_params.sched_type =RTE_SCHED_TYPE_ORDERED ; -/* Set rx core. Use first core other than master core as Rx core */ - rx_core_id =rte_get_next_lcore (0 ,/* curr core */ -1 ,/* skip master core */ -0 /* wrap */ ); +/* Set two cores as eth cores for Rx & Tx */ + +/* Use first core other than master core as Rx core */ + eth_core_id =rte_get_next_lcore (0 ,/* curr core */ +1 ,/* skip master core */ +0 /* wrap */ ); - em_conf->eth_core_mask = (1 << rx_core_id); + em_conf->eth_core_mask = (1 << eth_core_id); + +/* Use next core as Tx core */ + eth_core_id =rte_get_next_lcore (eth_core_id,/* curr core */ +1 ,/* skip master core */ +0 /* wrap */ ); + + em_conf->eth_core_mask |= (1 << eth_core_id); }struct rte_eventmode_helper_conf * __rte_experimental
@@ -354,7 +390,7 @@ rte_eventmode_helper_set_default_conf_rx_adapter(struct eventmode_conf *em_conf)/* Set adapter conf */ adapter->eventdev_id = eventdev_id; adapter->adapter_id = adapter_id; - adapter->rx_core_id =internal_get_next_rx_core (em_conf,-1 ); + adapter->rx_core_id =internal_get_next_eth_core (em_conf);/* * All queues of one eth device (port) will be mapped to one event
@@ -403,6 +439,100 @@ rte_eventmode_helper_set_default_conf_rx_adapter(struct eventmode_conf *em_conf) }static int +rte_eventmode_helper_set_default_conf_tx_adapter (struct eventmode_conf *em_conf) +{ +int nb_eth_dev; +int eventdev_id; +int adapter_id; +int i; +int conn_id; +struct eventdev_params *eventdev_config; +struct tx_adapter_conf *tx_adapter; +struct tx_adapter_connection_info *conn; + +/* +* Create one Tx adapter with all eth queues mapped to event queues +* 1:1. +*/ + +if (em_conf->nb_eventdev ==0 ) { +RTE_EM_HLPR_LOG_ERR ("No event devs registered" ); +return -1 ; + } + +/* Get the number of eth devs */ + nb_eth_dev =rte_eth_dev_count_avail (); + +/* Use the first event dev */ + eventdev_config = &(em_conf->eventdev_config[0 ]); + +/* Get eventdev ID */ + eventdev_id = eventdev_config->eventdev_id; + adapter_id =0 ; + +/* Get adapter conf */ + tx_adapter = &(em_conf->tx_adapter[adapter_id]); + +/* Set adapter conf */ + tx_adapter->eventdev_id = eventdev_id; + tx_adapter->adapter_id = adapter_id; + +/* TODO: Tx core is required only when internal port is not present */ + + tx_adapter->tx_core_id =internal_get_next_eth_core (em_conf); + +/* +* Application would need to use one event queue per adapter for +* submitting packets for Tx. Reserving the last queue available +* and decrementing the total available event queues for this +*/ + +/* Queue numbers start at 0 */ + tx_adapter->tx_ev_queue = eventdev_config->nb_eventqueue -1 ; + +/* Update the number of event queues available in eventdev */ + eventdev_config->nb_eventqueue--; + +/* +* All Tx queues of the eth device (port) will be mapped to the event +* device. +*/ + +/* Set defaults for connections */ + +/* +* One eth device (port) would be one connection. All Tx queues of +* the device would be mapped to the Tx adapter. +*/ + +for (i =0 ; i < nb_eth_dev; i++) { + +/* Use only the ports enabled */ +if ((em_conf->eth_portmask & (1 << i)) ==0 ) +continue ; + +/* Get the connection id */ + conn_id = tx_adapter->nb_connections; + +/* Get the connection */ + conn = &(tx_adapter->conn[conn_id]); + +/* Add ethdev to connections */ + conn->ethdev_id = i; + +/* Add all eth tx queues to adapter */ + conn->ethdev_tx_qid =-1 ; + +/* Update no of connections */ + tx_adapter->nb_connections++; + } + +/* We have setup one adapter */ + em_conf->nb_tx_adapter =1 ; +return 0 ; +} + +static int rte_eventmode_helper_set_default_conf_link (struct eventmode_conf *em_conf) {int i, j;
@@ -501,6 +631,16 @@ rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf) }/* +* See if tx adapters are specified. Else generate a default conf +* with one tx adapter. +*/ +if (em_conf->nb_tx_adapter ==0 ) { + ret =rte_eventmode_helper_set_default_conf_tx_adapter (em_conf); +if (ret !=0 ) +return ret; + } + +/* * See if links are specified. Else generate a default conf for * the event ports used. */
@@ -799,6 +939,150 @@ rte_eventmode_helper_initialize_rx_adapter(struct eventmode_conf *em_conf)return 0 ; } +static int +tx_adapter_configure (struct eventmode_conf *em_conf, +struct tx_adapter_conf *adapter) +{ +int ret, j; +uint8_t tx_port_id =0 ; +uint8_t eventdev_id; +uint32_t service_id; +struct rte_event_port_conf port_conf = {0 }; +struct rte_event_dev_info evdev_default_conf = {0 }; +struct tx_adapter_connection_info *conn; +struct eventdev_params *eventdev_config; + +/* Get event dev ID */ + eventdev_id = adapter->eventdev_id; + +/* Get event device conf */ + eventdev_config =internal_get_eventdev_params (em_conf, eventdev_id); + +/* Create Tx adapter */ + +/* Get default configuration of event dev */ + ret =rte_event_dev_info_get (eventdev_id, &evdev_default_conf); +if (ret <0 ) { +RTE_EM_HLPR_LOG_ERR ( +"Error in getting event device info[devID:%d]" , + eventdev_id); +return ret; + } + +/* Setup port conf */ + port_conf.new_event_threshold = + evdev_default_conf.max_num_events; + port_conf.dequeue_depth = + evdev_default_conf.max_event_port_dequeue_depth; + port_conf.enqueue_depth = + evdev_default_conf.max_event_port_enqueue_depth; + +/* Create Tx adapter */ + ret =rte_event_eth_tx_adapter_create (adapter->adapter_id, + adapter->eventdev_id, + &port_conf); +if (ret <0 ) { +RTE_EM_HLPR_LOG_ERR ("Error in Tx adapter creation" ); +return ret; + } + +/* Setup various connections in the adapter */ +for (j =0 ; j < adapter->nb_connections; j++) { + +/* Get connection */ + conn = &(adapter->conn[j]); + +/* Add queue to the adapter */ + ret =rte_event_eth_tx_adapter_queue_add ( + adapter->adapter_id, + conn->ethdev_id, + conn->ethdev_tx_qid); +if (ret <0 ) { +RTE_EM_HLPR_LOG_ERR ( +"Error in adding eth queue in Tx adapter" ); +return ret; + } + } + +/* Get event port used by the adapter */ + ret =rte_event_eth_tx_adapter_event_port_get ( + adapter->adapter_id, + &tx_port_id); +if (ret) { +RTE_EM_HLPR_LOG_ERR ("Failed to get Tx adapter port ID" ); +return ret; + } + +/* +* TODO: event queue for Tx adapter is required only if the +* INTERNAL PORT is not present. +*/ + +/* +* Tx event queue would be reserved for Tx adapter. Need to unlink +* this queue from all other ports +* +*/ +for (j =0 ; j < eventdev_config->nb_eventport; j++) { +rte_event_port_unlink (eventdev_id, j, + &(adapter->tx_ev_queue),1 ); + } + + ret =rte_event_port_link ( + eventdev_id, + tx_port_id, + &(adapter->tx_ev_queue), +NULL ,1 ); +if (ret !=1 ) { +RTE_EM_HLPR_LOG_ERR ("Failed to link event queue to port" ); +return ret; + } + +/* Get the service ID used by Tx adapter */ + ret =rte_event_eth_tx_adapter_service_id_get (adapter->adapter_id, + &service_id); +if (ret != -ESRCH && ret !=0 ) { +RTE_EM_HLPR_LOG_ERR ( +"Error getting service ID used by adapter" ); +return ret; + } + +/* +* TODO +* Tx core will invoke the service when required. The runstate check +* is not required. +* +*/ +rte_service_set_runstate_mapped_check (service_id,0 ); + +/* Start adapter */ + ret =rte_event_eth_tx_adapter_start (adapter->adapter_id); +if (ret) { +RTE_EM_HLPR_LOG_ERR ("Error in starting Tx adapter" ); +return ret; + } + +return 0 ; +} + +static int +rte_eventmode_helper_initialize_tx_adapter (struct eventmode_conf *em_conf) +{ +int i, ret; +struct tx_adapter_conf *adapter; + +/* Configure Tx adapters */ +for (i =0 ; i < em_conf->nb_tx_adapter; i++) { + adapter = &(em_conf->tx_adapter[i]); + ret =tx_adapter_configure (em_conf, adapter); +if (ret <0 ) { +RTE_EM_HLPR_LOG_ERR ("Tx adapter configuration failed" ); +return ret; + } + } +return 0 ; +} + int32_t __rte_experimentalrte_eventmode_helper_initialize_devs (struct rte_eventmode_helper_conf *mode_conf)
@@ -861,6 +1145,11 @@ rte_eventmode_helper_initialize_devs(if (ret !=0 )return ret; +/* Setup Tx adapter */ + ret =rte_eventmode_helper_initialize_tx_adapter (em_conf); +if (ret !=0 ) +return ret; +/* Start eth devices after setting up adapter */ RTE_ETH_FOREACH_DEV (portid) {
@@ -1001,6 +1290,7 @@ rte_eventmode_helper_start_worker_eth_core(struct eventmode_conf *em_conf, {uint32_t service_id[EVENT_MODE_MAX_ADAPTERS_PER_RX_CORE ];struct rx_adapter_conf *rx_adapter; +struct tx_adapter_conf *tx_adapter;int service_count =0 ;int adapter_id;int32_t ret;
@@ -1042,6 +1332,39 @@ rte_eventmode_helper_start_worker_eth_core(struct eventmode_conf *em_conf, service_count++; } +/* +* Need to parse adapter conf to see which all Tx adapters need to be +* handled this core. +*/ +for (i =0 ; i < em_conf->nb_tx_adapter; i++) { +/* Check if we have exceeded the max allowed */ +if (service_count >EVENT_MODE_MAX_ADAPTERS_PER_TX_CORE ) { +RTE_EM_HLPR_LOG_ERR ( +"Exceeded the max allowed adapters per Tx core" ); +break ; + } + + tx_adapter = &(em_conf->tx_adapter[i]); +if (tx_adapter->tx_core_id != lcore_id) +continue ; + +/* Adapter need to be handled by this core */ + adapter_id = tx_adapter->adapter_id; + +/* Get the service ID for the adapters */ + ret =rte_event_eth_tx_adapter_service_id_get (adapter_id, + &(service_id[service_count])); + +if (ret != -ESRCH && ret !=0 ) { +RTE_EM_HLPR_LOG_ERR ( +"Error getting service ID used by Tx adapter" ); +return ret; + } + +/* Update service count */ + service_count++; + } + eth_core_running = true;while (eth_core_running) {
lib/librte_eventdev/rte_eventmode_helper.h +24 -0
@@ -10,6 +10,14 @@ extern "C" {#include <rte_common.h> #include <rte_compat.h> +#include <rte_config.h> +#include <rte_event_eth_tx_adapter.h> + +/* Flag to indicate that the event device used by all adapters is same */ +#define RTE_EM_HELPER_TX_EV_LINK_COMMON_EVENT_DEV (1 << 0) + +/* Flag to indicate that the event queue to be used for all adapters is same */ +#define RTE_EM_HELPER_TX_EV_LINK_COMMON_EVENT_QUEUE (1 << 1)/* Packet transfer mode of the application */ enum rte_eventmode_helper_pkt_transfer_mode {
@@ -55,6 +63,22 @@ struct rte_eventmode_helper_event_link_info {/**< Lcore to be polling on this port */ }; +/* +* Tx event queue - port link conf +* +* Application would need to know which event queue would correspond to which +* eth port, so that it can send out accordingly. +*/ +struct rte_eventmode_helper_tx_ev_link_conf { +uint8_t flags; +struct { +uint8_t eventdev_id; +/**< Event device ID */ +uint8_t tx_ev_queue; +/**< Tx event queue */ + } ports[RTE_MAX_ETHPORTS ]; +}; +/* Workers registered by the application */ struct rte_eventmode_helper_app_worker_params { union {
lib/librte_eventdev/rte_eventmode_helper_internal.h +30 -0
@@ -38,9 +38,15 @@/* Max Rx adapters supported */ #define EVENT_MODE_MAX_RX_ADAPTERS RTE_EVENT_MAX_DEVS +/* Max Tx adapters supported */ +#define EVENT_MODE_MAX_TX_ADAPTERS RTE_EVENT_MAX_DEVS +/* Max Rx adapter connections */ #define EVENT_MODE_MAX_CONNECTIONS_PER_ADAPTER 16 +/* Max Tx adapter connections */ +#define EVENT_MODE_MAX_CONNECTIONS_PER_TX_ADAPTER 16 +/* Max event queues supported per event device */ #define EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV RTE_EVENT_MAX_QUEUES_PER_DEV
@@ -51,6 +57,9 @@/* Max adapters that one Rx core can handle */ #define EVENT_MODE_MAX_ADAPTERS_PER_RX_CORE EVENT_MODE_MAX_RX_ADAPTERS +/* Max adapters that one Tx core can handle */ +#define EVENT_MODE_MAX_ADAPTERS_PER_TX_CORE EVENT_MODE_MAX_TX_ADAPTERS +/* Event dev params */ struct eventdev_params {uint8_t eventdev_id;
@@ -76,6 +85,23 @@ struct rx_adapter_conf { conn[EVENT_MODE_MAX_CONNECTIONS_PER_ADAPTER ]; }; +/* Tx adapter connection info */ +struct tx_adapter_connection_info { +uint8_t ethdev_id; +int32_t ethdev_tx_qid; +}; + +/* Tx adapter conf */ +struct tx_adapter_conf { +int32_t eventdev_id; +int32_t adapter_id; +uint32_t tx_core_id; +uint8_t nb_connections; +struct tx_adapter_connection_info + conn[EVENT_MODE_MAX_CONNECTIONS_PER_TX_ADAPTER ]; +uint8_t tx_ev_queue; +}; +/* Eventmode conf data */ struct eventmode_conf {int nb_eventdev;
@@ -86,6 +112,10 @@ struct eventmode_conf {/**< No of Rx adapters */ struct rx_adapter_conf rx_adapter[EVENT_MODE_MAX_RX_ADAPTERS ];/**< Rx adapter conf */ +uint8_t nb_tx_adapter; +/**< No of Tx adapters */ +struct tx_adapter_conf tx_adapter[EVENT_MODE_MAX_TX_ADAPTERS ]; +/** Tx adapter conf */ uint8_t nb_link;/**< No of links */ struct rte_eventmode_helper_event_link_info
lib/librte_eventdev/rte_eventmode_helper_prints.c +9 -0
@@ -95,6 +95,12 @@ rte_eventmode_display_rx_adapter_conf(struct eventmode_conf *em_conf) }static void +rte_eventmode_display_tx_adapter_conf (struct eventmode_conf *em_conf) +{ +RTE_SET_USED (em_conf); +} + +static void rte_eventmode_display_link_conf (struct eventmode_conf *em_conf) {int i;
@@ -155,6 +161,9 @@ rte_eventmode_helper_display_conf(struct rte_eventmode_helper_conf *mode_conf)/* Display Rx adapter conf */ rte_eventmode_display_rx_adapter_conf (em_conf); +/* Display Tx adapter conf */ +rte_eventmode_display_tx_adapter_conf (em_conf); +/* Display event-lcore link */ rte_eventmode_display_link_conf (em_conf); }
Signature · 1 line
2.7.4
PATCH 34/39 eventdev: add support for internal ports
In reply to a message not in the archive--- lib/librte_eventdev/rte_eventmode_helper.c | 213 +++++++++++++++++---- lib/librte_eventdev/rte_eventmode_helper.h | 4 + .../rte_eventmode_helper_internal.h | 1 + lib/librte_eventdev/rte_eventmode_helper_prints.c | 19 +- 4 files changed, 192 insertions(+), 45 deletions(-)
lib/librte_eventdev/rte_eventmode_helper.c +173 -40
@@ -142,6 +142,38 @@ internal_get_eventdev_params(struct eventmode_conf *em_conf, }static inline bool +internal_dev_has_rx_internal_port (uint8_t eventdev_id) +{ +int j; +bool flag = true; + +RTE_ETH_FOREACH_DEV (j) { +uint32_t caps =0 ; + +rte_event_eth_rx_adapter_caps_get (eventdev_id, j, &caps); +if (!(caps &RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT )) + flag = false; + } +return flag; +} + +static inline bool +internal_dev_has_tx_internal_port (uint8_t eventdev_id) +{ +int j; +bool flag = true; + +RTE_ETH_FOREACH_DEV (j) { +uint32_t caps =0 ; + +rte_event_eth_tx_adapter_caps_get (eventdev_id, j, &caps); +if (!(caps &RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT )) + flag = false; + } +return flag; +} + +static inline bool internal_dev_has_burst_mode (uint8_t dev_id) {struct rte_event_dev_info dev_info;
@@ -303,6 +335,8 @@ rte_eventmode_helper_set_default_conf_eventdev(struct eventmode_conf *em_conf) {int i, ret;int nb_eventdev; +int nb_eth_dev; +int lcore_count;struct eventdev_params *eventdev_config;struct rte_event_dev_info dev_info;
@@ -314,6 +348,17 @@ rte_eventmode_helper_set_default_conf_eventdev(struct eventmode_conf *em_conf)return -1 ; } +/* Get the number of eth devs */ + nb_eth_dev =rte_eth_dev_count_avail (); + +if (nb_eth_dev ==0 ) { +RTE_EM_HLPR_LOG_ERR ("No eth devices detected" ); +return -1 ; + } + +/* Get the number of lcores */ + lcore_count =rte_lcore_count (); +for (i =0 ; i < nb_eventdev; i++) {/* Get the event dev conf */
@@ -340,13 +385,19 @@ rte_eventmode_helper_set_default_conf_eventdev(struct eventmode_conf *em_conf) eventdev_config->nb_eventqueue = dev_info.max_event_queues; eventdev_config->nb_eventport = dev_info.max_event_ports; eventdev_config->ev_queue_mode = -RTE_EVENT_QUEUE_CFG_SINGLE_LINK ; +RTE_EVENT_QUEUE_CFG_ALL_TYPES ; -/* One port is required for eth Rx adapter */ - eventdev_config->nb_eventport -=1 ; +/* Check if there are more queues than required */ +if (eventdev_config->nb_eventqueue > nb_eth_dev +1 ) { +/* One queue is reserved for Tx */ + eventdev_config->nb_eventqueue = nb_eth_dev +1 ; + } -/* One port is reserved for eth Tx adapter */ - eventdev_config->nb_eventport -=1 ; +/* Check if there are more ports than required */ +if (eventdev_config->nb_eventport > lcore_count) { +/* One port per lcore is enough */ + eventdev_config->nb_eventport = lcore_count; + }/* Update the number of eventdevs */ em_conf->nb_eventdev++;
@@ -355,6 +406,37 @@ rte_eventmode_helper_set_default_conf_eventdev(struct eventmode_conf *em_conf)return 0 ; } +static void +rte_eventmode_helper_do_capability_check (struct eventmode_conf *em_conf) +{ +struct eventdev_params *eventdev_config; +uint32_t eventdev_id; +int all_internal_ports =1 ; +int i; + +for (i =0 ; i < em_conf->nb_eventdev; i++) { + +/* Get the event dev conf */ + eventdev_config = &(em_conf->eventdev_config[i]); + eventdev_id = eventdev_config->eventdev_id; + +/* Check if event device has internal port for Rx & Tx */ +if (internal_dev_has_rx_internal_port (eventdev_id) && +internal_dev_has_tx_internal_port (eventdev_id)) { + eventdev_config->all_internal_ports =1 ; + }else { + all_internal_ports =0 ; + } + } + +/* +* If Rx & Tx internal ports are supported by all event devices then +* eth cores won't be required. Override the eth core mask requested. +*/ +if (all_internal_ports) + em_conf->eth_core_mask =0 ; +} +static int rte_eventmode_helper_set_default_conf_rx_adapter (struct eventmode_conf *em_conf) {
@@ -363,9 +445,12 @@ rte_eventmode_helper_set_default_conf_rx_adapter(struct eventmode_conf *em_conf)int adapter_id;int eventdev_id;int conn_id; +int nb_eventqueue;struct rx_adapter_conf *adapter;struct adapter_connection_info *conn;struct eventdev_params *eventdev_config; +bool rx_internal_port = true; +uint32_t caps =0 ;/* Create one adapter with all eth queues mapped to event queues 1:1 */
@@ -390,7 +475,14 @@ rte_eventmode_helper_set_default_conf_rx_adapter(struct eventmode_conf *em_conf)/* Set adapter conf */ adapter->eventdev_id = eventdev_id; adapter->adapter_id = adapter_id; - adapter->rx_core_id =internal_get_next_eth_core (em_conf); + +/* +* If event device does not have internal ports for passing +* packets then one queue is reserved for Tx path +*/ + nb_eventqueue = eventdev_config->all_internal_ports ? + eventdev_config->nb_eventqueue : + eventdev_config->nb_eventqueue -1 ;/* * All queues of one eth device (port) will be mapped to one event
@@ -399,12 +491,11 @@ rte_eventmode_helper_set_default_conf_rx_adapter(struct eventmode_conf *em_conf)*/ /* Make sure there is enough event queues for 1:1 mapping */ -if (nb_eth_dev > eventdev_config->nb_eventqueue) { +if (nb_eth_dev > nb_eventqueue) {RTE_EM_HLPR_LOG_ERR ("Not enough event queues for 1:1 mapping " "[eth devs: %d, event queues: %d]\n" , - nb_eth_dev, - eventdev_config->nb_eventqueue); + nb_eth_dev, nb_eventqueue);return -1 ; }
@@ -427,11 +518,24 @@ rte_eventmode_helper_set_default_conf_rx_adapter(struct eventmode_conf *em_conf)/* Add all eth queues of one eth port to one event queue */ conn->ethdev_rx_qid =-1 ; +/* Get Rx adapter capabilities */ +rte_event_eth_rx_adapter_caps_get (eventdev_id, i, &caps); +if (!(caps &RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT )) + rx_internal_port = false; +/* Update no of connections */ adapter->nb_connections++; } +if (rx_internal_port) { +/* Rx core is not required */ + adapter->rx_core_id =-1 ; + }else { +/* Rx core is required */ + adapter->rx_core_id =internal_get_next_eth_core (em_conf); + } +/* We have setup one adapter */ em_conf->nb_rx_adapter =1 ;
@@ -449,6 +553,8 @@ rte_eventmode_helper_set_default_conf_tx_adapter(struct eventmode_conf *em_conf)struct eventdev_params *eventdev_config;struct tx_adapter_conf *tx_adapter;struct tx_adapter_connection_info *conn; +bool tx_internal_port = true; +uint32_t caps =0 ;/* * Create one Tx adapter with all eth queues mapped to event queues
@@ -477,22 +583,6 @@ rte_eventmode_helper_set_default_conf_tx_adapter(struct eventmode_conf *em_conf) tx_adapter->eventdev_id = eventdev_id; tx_adapter->adapter_id = adapter_id; -/* TODO: Tx core is required only when internal port is not present */ - - tx_adapter->tx_core_id =internal_get_next_eth_core (em_conf); - -/* -* Application would need to use one event queue per adapter for -* submitting packets for Tx. Reserving the last queue available -* and decrementing the total available event queues for this -*/ - -/* Queue numbers start at 0 */ - tx_adapter->tx_ev_queue = eventdev_config->nb_eventqueue -1 ; - -/* Update the number of event queues available in eventdev */ - eventdev_config->nb_eventqueue--; -/* * All Tx queues of the eth device (port) will be mapped to the event * device.
@@ -523,10 +613,30 @@ rte_eventmode_helper_set_default_conf_tx_adapter(struct eventmode_conf *em_conf)/* Add all eth tx queues to adapter */ conn->ethdev_tx_qid =-1 ; +/* Get Rx adapter capabilities */ +rte_event_eth_tx_adapter_caps_get (eventdev_id, i, &caps); +if (!(caps &RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT )) + tx_internal_port = false; +/* Update no of connections */ tx_adapter->nb_connections++; } +if (tx_internal_port) { +/* Tx core is not required */ + tx_adapter->tx_core_id =-1 ; + }else { +/* Tx core is required */ + tx_adapter->tx_core_id =internal_get_next_eth_core (em_conf); + +/* +* Application would need to use one event queue per adapter for +* submitting packets for Tx. Reserving the last queue available +*/ +/* Queue numbers start at 0 */ + tx_adapter->tx_ev_queue = eventdev_config->nb_eventqueue -1 ; + } +/* We have setup one adapter */ em_conf->nb_tx_adapter =1 ;return 0 ;
@@ -620,6 +730,9 @@ rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf)return ret; } +/* Perform capability check for the selected event devices*/ +rte_eventmode_helper_do_capability_check (em_conf); +/* * See if rx adapters are specified. Else generate a default conf * with one rx adapter and all eth queue - event queue mapped.
@@ -681,10 +794,6 @@ rte_eventmode_helper_initialize_eventdev(struct eventmode_conf *em_conf)/* Get the number of queues */ nb_eventqueue = eventdev_config->nb_eventqueue; -/* One queue is reserved for the final stage (doing eth tx) */ -/* TODO handles only one Tx adapter. Fix this */ - nb_eventqueue +=1 ; -/* Reset the default conf */ memset (&evdev_default_conf,0 ,sizeof (struct rte_event_dev_info ));
@@ -730,14 +839,15 @@ rte_eventmode_helper_initialize_eventdev(struct eventmode_conf *em_conf)/* Per event dev queues can be ATQ or SINGLE LINK */ eventq_conf.event_queue_cfg = eventdev_config->ev_queue_mode; -/* * All queues need to be set with sched_type as -* schedule type for the application stage. One queue -* would be reserved for the final eth tx stage. This -* will be an atomic queue. +* schedule type for the application stage. One +* queue would be reserved for the final eth tx +* stage if event device does not have internal +* ports. This will be an atomic queue. */ -if (j == nb_eventqueue-1 ) { +if (!eventdev_config->all_internal_ports && + j == nb_eventqueue-1 ) { eventq_conf.schedule_type =RTE_SCHED_TYPE_ATOMIC ; }else {
@@ -867,8 +977,10 @@ rx_adapter_configure(struct eventmode_conf *em_conf,/* Setup various connections in the adapter */ +#ifdef UNSELECT queue_conf.rx_queue_flags =RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID ; +#endif /* UNSELECT */ for (j =0 ; j < adapter->nb_connections; j++) {/* Get connection */
@@ -877,9 +989,12 @@ rx_adapter_configure(struct eventmode_conf *em_conf,/* Setup queue conf */ queue_conf.ev.queue_id = conn->eventq_id; queue_conf.ev.sched_type = em_conf->ext_params.sched_type; + queue_conf.ev.event_type =RTE_EVENT_TYPE_ETHDEV ; +#ifdef UNSELECT /* Set flow ID as ethdev ID */ queue_conf.ev.flow_id = conn->ethdev_id; +#endif /* UNSELECT */ /* Add queue to the adapter */ ret = rte_event_eth_rx_adapter_queue_add(
@@ -945,8 +1060,8 @@ tx_adapter_configure(struct eventmode_conf *em_conf, {int ret, j;uint8_t tx_port_id =0 ; -uint8_t eventdev_id;uint32_t service_id; +uint8_t eventdev_id;struct rte_event_port_conf port_conf = {0 };struct rte_event_dev_info evdev_default_conf = {0 };struct tx_adapter_connection_info *conn;
@@ -1004,6 +1119,18 @@ tx_adapter_configure(struct eventmode_conf *em_conf, } } +/* +* Check if Tx core is assigned. If Tx core is not assigned, then +* the adapter would be having internal port for submitting packets +* for Tx and so Tx event queue & port setup is not required +*/ +if (adapter->tx_core_id == (uint32_t ) (-1 )) { +/* Internal port is present */ + goto skip_tx_queue_port_setup; + } + +/* Setup Tx queue & port */ +/* Get event port used by the adapter */ ret = rte_event_eth_tx_adapter_event_port_get( adapter->adapter_id,
@@ -1014,11 +1141,6 @@ tx_adapter_configure(struct eventmode_conf *em_conf, }/* -* TODO: event queue for Tx adapter is required only if the -* INTERNAL PORT is not present. -*/ - -/* * Tx event queue would be reserved for Tx adapter. Need to unlink * this queue from all other ports *
@@ -1028,6 +1150,7 @@ tx_adapter_configure(struct eventmode_conf *em_conf, &(adapter->tx_ev_queue), 1); } +/* Link Tx event queue to Tx port */ ret = rte_event_port_link( eventdev_id, tx_port_id,
@@ -1055,6 +1178,8 @@ tx_adapter_configure(struct eventmode_conf *em_conf,*/ rte_service_set_runstate_mapped_check (service_id,0 ); +skip_tx_queue_port_setup: +/* Start adapter */ ret =rte_event_eth_tx_adapter_start (adapter->adapter_id);if (ret) {
@@ -1437,6 +1562,14 @@ rte_eventmode_helper_find_worker(uint32_t lcore_id,else curr_conf.cap.burst =RTE_EVENTMODE_HELPER_RX_TYPE_NON_BURST ; +/* Check for Tx internal port */ +if (internal_dev_has_tx_internal_port (eventdev_id)) + curr_conf.cap.tx_internal_port = +RTE_EVENTMODE_HELPER_TX_TYPE_INTERNAL_PORT ; +else + curr_conf.cap.tx_internal_port = +RTE_EVENTMODE_HELPER_TX_TYPE_NO_INTERNAL_PORT ; +/* Now parse the passed list and see if we have matching capabilities */ /* Initialize the pointer used to traverse the list */
lib/librte_eventdev/rte_eventmode_helper.h +4 -0
@@ -36,6 +36,8 @@ enum rte_eventmode_helper_rx_types {/* Event mode packet tx types */ enum rte_eventmode_helper_tx_types {RTE_EVETNMODE_HELPER_TX_TYPE_INVALID =0 , +RTE_EVENTMODE_HELPER_TX_TYPE_INTERNAL_PORT , +RTE_EVENTMODE_HELPER_TX_TYPE_NO_INTERNAL_PORT ,RTE_EVENTMODE_HELPER_TX_TYPE_MAX =16 };
@@ -85,6 +87,8 @@ struct rte_eventmode_helper_app_worker_params {struct {uint64_t burst :4 ;/**< Specify status of rx type burst */ +uint64_t tx_internal_port :4 ; +/**< Specify whether tx internal port is available */ };uint64_t u64; } cap;
lib/librte_eventdev/rte_eventmode_helper_internal.h +1 -0
@@ -66,6 +66,7 @@ struct eventdev_params {uint8_t nb_eventqueue;uint8_t nb_eventport;uint8_t ev_queue_mode; +uint8_t all_internal_ports; };/* Rx adapter connection info */
lib/librte_eventdev/rte_eventmode_helper_prints.c +14 -5
@@ -64,13 +64,22 @@ rte_eventmode_display_rx_adapter_conf(struct eventmode_conf *em_conf)for (i =0 ; i < nb_rx_adapter; i++) { adapter = &(em_conf->rx_adapter[i]); -RTE_EM_HLPR_LOG_INFO ( -"\tRx adaper ID: %-2d\tConnections: %-2d\tEvent dev ID: %-2d" -"\tRx core: %-2d" , +sprintf (print_buf, +"\tRx adaper ID: %-2d\tConnections: %-2d\tEvent dev ID: %-2d" , adapter->adapter_id, adapter->nb_connections, - adapter->eventdev_id, - adapter->rx_core_id); + adapter->eventdev_id); +if (adapter->rx_core_id == (uint32_t )-1 ) +sprintf (print_buf +strlen (print_buf), +"\tRx core: %-2s" ,"[INTERNAL PORT]" ); +else if (adapter->rx_core_id ==RTE_MAX_LCORE ) +sprintf (print_buf +strlen (print_buf), +"\tRx core: %-2s" ,"[NONE]" ); +else +sprintf (print_buf +strlen (print_buf), +"\tRx core: %-2d" , adapter->rx_core_id); + +RTE_EM_HLPR_LOG_INFO ("%s" , print_buf);for (j =0 ; j < adapter->nb_connections; j++) { conn = &(adapter->conn[j]);
Signature · 1 line
2.7.4
PATCH 35/39 eventdev: display Tx adapter conf
In reply to a message not in the archive--- lib/librte_eventdev/rte_eventmode_helper_prints.c | 46 ++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-)
lib/librte_eventdev/rte_eventmode_helper_prints.c +45 -1
@@ -106,7 +106,51 @@ rte_eventmode_display_rx_adapter_conf(struct eventmode_conf *em_conf)static void rte_eventmode_display_tx_adapter_conf (struct eventmode_conf *em_conf) { -RTE_SET_USED (em_conf); +int i, j; +int nb_tx_adapter = em_conf->nb_tx_adapter; +struct tx_adapter_conf *adapter; +struct tx_adapter_connection_info *conn; +char print_buf[256 ] = {0 }; + +RTE_EM_HLPR_LOG_INFO ("Tx adapters configured: %d" , nb_tx_adapter); + +for (i =0 ; i < nb_tx_adapter; i++) { + adapter = &(em_conf->tx_adapter[i]); +sprintf (print_buf, +"\tTx adapter ID: %-2d\tConnections: %-2d\tEvent dev ID: %-2d" , + adapter->adapter_id, + adapter->nb_connections, + adapter->eventdev_id); +if (adapter->tx_core_id == (uint32_t )-1 ) +sprintf (print_buf +strlen (print_buf), +"\tTx core: %-2s" ,"[INTERNAL PORT]" ); +else if (adapter->tx_core_id ==RTE_MAX_LCORE ) +sprintf (print_buf +strlen (print_buf), +"\tTx core: %-2s" ,"[NONE]" ); +else +sprintf (print_buf +strlen (print_buf), +"\tTx core: %-2d,\tInput event queue: %-2d" , + adapter->tx_core_id, adapter->tx_ev_queue); + +RTE_EM_HLPR_LOG_INFO ("%s" , print_buf); + +for (j =0 ; j < adapter->nb_connections; j++) { + conn = &(adapter->conn[j]); + +sprintf (print_buf, +"\t\tEthdev ID: %-2d" , conn->ethdev_id); + +if (conn->ethdev_tx_qid ==-1 ) +sprintf (print_buf +strlen (print_buf), +"\tEth tx queue: %-2s" ,"ALL" ); +else +sprintf (print_buf +strlen (print_buf), +"\tEth tx queue: %-2d" , + conn->ethdev_tx_qid); +RTE_EM_HLPR_LOG_INFO ("%s" , print_buf); + } + } +RTE_EM_HLPR_LOG_INFO ("" ); } static void
Signature · 1 line
2.7.4
PATCH 36/39 examples/l2fwd-event: add eventmode for l2fwd
In reply to a message not in the archiveAdding eventmode support in l2fwd. This uses rte_eventmode_helper APIs to setup and use the eventmode capabilties.
Adding non-burst no Tx internal-port eventmode worker.
--- examples/l2fwd-event/Makefile | 1 + examples/l2fwd-event/l2fwd_worker.c | 314 ++++++++++++++++++++++++++++++++++-- examples/l2fwd-event/main.c | 64 ++++++-- examples/l2fwd-event/meson.build | 2 + 4 files changed, 360 insertions(+), 21 deletions(-)
examples/l2fwd-event/Makefile +1 -0
@@ -49,6 +49,7 @@ RTE_TARGET ?= x86_64-native-linuxapp-gcc include $(RTE_SDK)/mk/rte.vars.mk +CFLAGS += -DALLOW_EXPERIMENTAL_API CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS)
examples/l2fwd-event/l2fwd_worker.c +304 -10
362 lines not on this page · raw message
examples/l2fwd-event/main.c +53 -11
119 lines not on this page · raw message
examples/l2fwd-event/meson.build +2 -0
@@ -6,6 +6,8 @@ # To build this example as a standalone application with an already-installed # DPDK instance, use 'make' +allow_experimental_apis = true +deps += ['eventdev'] sources = files( 'l2fwd_worker.c', 'main.c'
Signature · 1 line
2.7.4
PATCH 37/39 examples/l2fwd-event: add eventmode worker
In reply to a message not in the archiveAdding non-burst Tx internal-port eventmode worker.
--- examples/l2fwd-event/l2fwd_worker.c | 164 +++++++++++++++++++++++++++++++++++- 1 file changed, 163 insertions(+), 1 deletion(-)
examples/l2fwd-event/l2fwd_worker.c +163 -1
@@ -315,7 +315,7 @@ l2fwd_poll_mode_worker(void)*/ /* Workers registered */ -#define L2FWD_EVENTMODE_WORKERS 1 +#define L2FWD_EVENTMODE_WORKERS 2/* * Event mode worker
@@ -486,6 +486,159 @@ l2fwd_eventmode_non_burst_no_internal_port(void *args)rte_free (links); } +/* +* Event mode worker +* Operating mode : non-burst tx internal port +*/ +static void +l2fwd_eventmode_non_burst_tx_internal_port (void *args) +{ +struct rte_event ev; +struct rte_mbuf *pkt; +struct rte_eventmode_helper_conf *mode_conf; +struct rte_eventmode_helper_event_link_info *links =NULL ; +unsigned int lcore_nb_link =0 ; +uint32_t lcore_id; +unsigned int i, nb_rx =0 ; +unsigned int portid; +struct lcore_queue_conf *qconf; +int is_master_core; +struct tsc_tracker tsc = {0 }; + +/* Get core ID */ + lcore_id =rte_lcore_id (); + +RTE_LOG (INFO ,L2FWD , +"Launching event mode non-burst worker internal port " +"on lcore %d\n" , lcore_id); + +/* Set the flag if master core */ + is_master_core = (lcore_id ==rte_get_master_lcore ()) ?1 :0 ; + +/* Get qconf for this core */ + qconf = &lcore_queue_conf[lcore_id]; + +/* Set drain tsc */ + tsc.drain_tsc = (rte_get_tsc_hz () +US_PER_S -1 ) / +US_PER_S *BURST_TX_DRAIN_US ; + +/* Mode conf will be passed as args */ + mode_conf = (struct rte_eventmode_helper_conf *)args; + +/* Get the links configured for this lcore */ + lcore_nb_link =rte_eventmode_helper_get_event_lcore_links (lcore_id, + mode_conf, &links); + +/* Check if we have links registered for this lcore */ +if (lcore_nb_link ==0 ) { +/* No links registered. The core could do periodic drains */ +l2fwd_drain_loop (qconf, &tsc, is_master_core); + goto clean_and_exit; + } + +/* We have valid links */ + +/* Reset stats before proceeding */ +reset_eth_stats (is_master_core); + +/* See if it's single link */ +if (lcore_nb_link ==1 ) + goto single_link_loop; +else + goto multi_link_loop; + +single_link_loop: + +RTE_LOG (INFO ,L2FWD ," -- lcoreid=%u event_port_id=%u\n" , lcore_id, + links[0 ].event_portid); + +while (!force_quit) { + +/* Do periodic operations (buffer drain & stats monitor) */ +l2fwd_periodic_drain_stats_monitor (qconf, &tsc, is_master_core); + +/* Read packet from event queues */ + nb_rx =rte_event_dequeue_burst (links[0 ].eventdev_id, + links[0 ].event_portid, + &ev,/* events */ +1 ,/* nb_events */ +0 /* timeout_ticks */ ); + +if (nb_rx ==0 ) +continue ; + + portid = ev.queue_id; + port_statistics[portid].rx++; + pkt = ev.mbuf; + +rte_prefetch0 (rte_pktmbuf_mtod(pkt ,void *)); + +/* Process packet */ +l2fwd_event_pre_forward (&ev, portid); + +/* +* Since tx internal port is available, events can be +* directly enqueued to the adapter and it would be +* internally submitted to the eth device. +*/ +rte_event_eth_tx_adapter_enqueue (links[0 ].eventdev_id, + links[0 ].event_portid, + &ev,/* events */ +1 /* nb_events */ ); + } + goto clean_and_exit; + +multi_link_loop: + +for (i =0 ; i < lcore_nb_link; i++) { +RTE_LOG (INFO ,L2FWD ," -- lcoreid=%u event_port_id=%u\n" , + lcore_id, links[i].event_portid); + } + +while (!force_quit) { + +/* Do periodic operations (buffer drain & stats monitor) */ +l2fwd_periodic_drain_stats_monitor (qconf, &tsc, is_master_core); + +for (i =0 ; i < lcore_nb_link; i++) { +/* Read packet from event queues */ + nb_rx =rte_event_dequeue_burst (links[i].eventdev_id, + links[i].event_portid, + &ev,/* events */ +1 ,/* nb_events */ +0 /* timeout_ticks */ ); + +if (nb_rx ==0 ) +continue ; + + portid = ev.queue_id; + port_statistics[portid].rx++; + pkt = ev.mbuf; + +rte_prefetch0 (rte_pktmbuf_mtod(pkt ,void *)); + +/* Process packet */ +l2fwd_event_pre_forward (&ev, portid); + +/* +* Since tx internal port is available, events can be +* directly enqueued to the adapter and it would be +* internally submitted to the eth device. +*/ +rte_event_eth_tx_adapter_enqueue (links[i].eventdev_id, + links[i].event_portid, + &ev,/* events */ +1 /* nb_events */ ); + + } + } + goto clean_and_exit; + +clean_and_exit: +if (links !=NULL ) +rte_free (links); +} +static uint8_t l2fwd_eventmode_populate_wrkr_params (struct rte_eventmode_helper_app_worker_params *wrkrs)
@@ -503,6 +656,15 @@ l2fwd_eventmode_populate_wrkr_params( wrkr->worker_thread = l2fwd_eventmode_non_burst_no_internal_port; nb_wrkr_param++; + wrkr++; + +/* Non-burst tx internal port */ + wrkr->cap.burst =RTE_EVENTMODE_HELPER_RX_TYPE_NON_BURST ; + wrkr->cap.tx_internal_port = +RTE_EVENTMODE_HELPER_TX_TYPE_INTERNAL_PORT ; + wrkr->worker_thread = l2fwd_eventmode_non_burst_tx_internal_port; + + nb_wrkr_param++;return nb_wrkr_param; }
Signature · 1 line
2.7.4
PATCH 38/39 examples/l2fwd-event: add eventmode worker
In reply to a message not in the archiveAdding burst no Tx internal-port eventmode worker
--- examples/l2fwd-event/l2fwd_worker.c | 219 +++++++++++++++++++++++++++++++++++- 1 file changed, 218 insertions(+), 1 deletion(-)
examples/l2fwd-event/l2fwd_worker.c +218 -1
@@ -315,7 +315,7 @@ l2fwd_poll_mode_worker(void)*/ /* Workers registered */ -#define L2FWD_EVENTMODE_WORKERS 2 +#define L2FWD_EVENTMODE_WORKERS 3/* * Event mode worker
@@ -639,6 +639,214 @@ l2fwd_eventmode_non_burst_tx_internal_port(void *args)rte_free (links); } +/* +* Event mode worker +* Operating mode : burst no internal port (regular tx worker) +*/ +static void +l2fwd_eventmode_burst_no_internal_port (void *args) +{ +struct rte_event ev[MAX_PKT_BURST ]; +struct rte_mbuf *pkt; +struct rte_eventmode_helper_conf *mode_conf; +struct rte_eventmode_helper_event_link_info *links =NULL ; +unsigned int lcore_nb_link =0 ; +uint32_t lcore_id; +unsigned int i, j, left, nb_rx =0 ; +unsigned int portid; +struct lcore_queue_conf *qconf; +int is_master_core; +struct rte_event_port_conf event_port_conf; +uint16_t deq_len =0 , enq_len =0 ; +uint8_t tx_queue; +struct tsc_tracker tsc = {0 }; + +/* Get core ID */ + lcore_id =rte_lcore_id (); + +RTE_LOG (INFO ,L2FWD , +"Launching event mode burst worker no internal port " +"(regular tx worker) on lcore %d\n" , lcore_id); + +/* Set the flag if master core */ + is_master_core = (lcore_id ==rte_get_master_lcore ()) ?1 :0 ; + +/* Get qconf for this core */ + qconf = &lcore_queue_conf[lcore_id]; + +/* Set drain tsc */ + tsc.drain_tsc = (rte_get_tsc_hz () +US_PER_S -1 ) / +US_PER_S *BURST_TX_DRAIN_US ; + +/* Mode conf will be passed as args */ + mode_conf = (struct rte_eventmode_helper_conf *)args; + +/* Get the links configured for this lcore */ + lcore_nb_link =rte_eventmode_helper_get_event_lcore_links (lcore_id, + mode_conf, &links); + +/* Check if we have links registered for this lcore */ +if (lcore_nb_link ==0 ) { +/* No links registered. The core could do periodic drains */ +l2fwd_drain_loop (qconf, &tsc, is_master_core); + goto clean_and_exit; + } + +/* We have valid links */ + +/* Reset stats before proceeding */ +reset_eth_stats (is_master_core); + +/* +* There is no internal port between ethdev and eventdev. So the worker +* thread needs to submit event to a designated tx queue. Internally +* eth core would receive events from multiple worker threads and send +* out packets on wire. +*/ + tx_queue =rte_eventmode_helper_get_tx_queue (mode_conf, + links[0 ].eventdev_id); + +/* Get the burst size of the event device */ + +/* Get the default conf of the first link */ +rte_event_port_default_conf_get (links[0 ].eventdev_id, + links[0 ].event_portid, + &event_port_conf); + +/* Save the burst size */ + deq_len = event_port_conf.dequeue_depth; + enq_len = event_port_conf.enqueue_depth; + +/* Dequeue and enqueue length should not exceed MAX_PKT_BURST */ +if (deq_len >MAX_PKT_BURST ) + deq_len =MAX_PKT_BURST ; +if (enq_len >MAX_PKT_BURST ) + enq_len =MAX_PKT_BURST ; + +/* See if it's single link */ +if (lcore_nb_link ==1 ) + goto single_link_loop; +else + goto multi_link_loop; + +single_link_loop: + +RTE_LOG (INFO ,L2FWD ," -- lcoreid=%u event_port_id=%u\n" , lcore_id, + links[0 ].event_portid); + +while (!force_quit) { + +/* Do periodic operations (buffer drain & stats monitor) */ +l2fwd_periodic_drain_stats_monitor (qconf, &tsc, is_master_core); + +/* Read packet from event queues */ + nb_rx =rte_event_dequeue_burst (links[0 ].eventdev_id, + links[0 ].event_portid, + ev,/* events */ + deq_len,/* nb_events */ +0 /* timeout_ticks */ ); + +if (nb_rx ==0 ) +continue ; + +for (j =0 ; j < nb_rx; j++) { + + portid = ev[j].queue_id; + port_statistics[portid].rx++; + pkt = ev[j].mbuf; + +rte_prefetch0 (rte_pktmbuf_mtod(pkt ,void *)); + +/* Process packet */ +l2fwd_event_pre_forward (&(ev[j]), portid); + +/* +* Internal port is not available, the packet needs +* to be enqueued to the designated event queue. +*/ + +/* Prepare event for submission to tx event queue */ +l2fwd_event_switch_to_tx_queue (&(ev[j]), tx_queue); + } + +for (j =0 , left = nb_rx; + j < (nb_rx + enq_len -1 )/enq_len; j++) { + +/* Submit the updated events for tx stage */ + left -=rte_event_enqueue_burst (links[0 ].eventdev_id, + links[0 ].event_portid, + &(ev[j*enq_len]),/* events */ + left > enq_len ? + enq_len : left/* nb_events */ ); + } + } + goto clean_and_exit; + +multi_link_loop: + +for (i =0 ; i < lcore_nb_link; i++) { +RTE_LOG (INFO ,L2FWD ," -- lcoreid=%u event_port_id=%u\n" , + lcore_id, links[i].event_portid); + } + +while (!force_quit) { + +/* Do periodic operations (buffer drain & stats monitor) */ +l2fwd_periodic_drain_stats_monitor (qconf, &tsc, is_master_core); + +for (i =0 ; i < lcore_nb_link; i++) { +/* Read packet from event queues */ + nb_rx =rte_event_dequeue_burst (links[i].eventdev_id, + links[i].event_portid, + ev,/* events */ + deq_len,/* nb_events */ +0 /* timeout_ticks */ ); + +if (nb_rx ==0 ) +continue ; + +for (j =0 ; j < nb_rx; j++) { + + portid = ev[j].queue_id; + port_statistics[portid].rx++; + pkt = ev[j].mbuf; + +rte_prefetch0 (rte_pktmbuf_mtod(pkt ,void *)); + +/* Process packet */ +l2fwd_event_pre_forward (&(ev[j]), portid); + +/* +* Internal port is not available, the packet +* needs to be enqueued to the designated event +* queue. +*/ + +/* Update the scheduling type for tx stage */ +l2fwd_event_switch_to_tx_queue (&(ev[j]), + tx_queue); + } + +for (j =0 , left = nb_rx; + j < (nb_rx + enq_len -1 )/enq_len; j++) { + +/* Submit the updated events for tx stage */ + left -=rte_event_enqueue_burst ( + links[i].eventdev_id, + links[i].event_portid, + &(ev[j*enq_len]),/* events */ + left > enq_len ? + enq_len : left/* nb_events */ ); + } + } + } + goto clean_and_exit; + +clean_and_exit: +if (links !=NULL ) +rte_free (links); +} +static uint8_t l2fwd_eventmode_populate_wrkr_params (struct rte_eventmode_helper_app_worker_params *wrkrs)
@@ -665,6 +873,15 @@ l2fwd_eventmode_populate_wrkr_params( wrkr->worker_thread = l2fwd_eventmode_non_burst_tx_internal_port; nb_wrkr_param++; + wrkr++; + +/* Burst no internal port (regular tx worker) */ + wrkr->cap.burst =RTE_EVENTMODE_HELPER_RX_TYPE_BURST ; + wrkr->cap.tx_internal_port = +RTE_EVENTMODE_HELPER_TX_TYPE_NO_INTERNAL_PORT ; + wrkr->worker_thread = l2fwd_eventmode_burst_no_internal_port; + + nb_wrkr_param++;return nb_wrkr_param; }
Signature · 1 line
2.7.4
PATCH 39/39 examples/l2fwd-event: add eventmode worker
In reply to a message not in the archiveAdding burst Tx internal port eventmode worker.
--- examples/l2fwd-event/l2fwd_worker.c | 200 +++++++++++++++++++++++++++++++++++- 1 file changed, 199 insertions(+), 1 deletion(-)
examples/l2fwd-event/l2fwd_worker.c +199 -1
@@ -315,7 +315,7 @@ l2fwd_poll_mode_worker(void)*/ /* Workers registered */ -#define L2FWD_EVENTMODE_WORKERS 3 +#define L2FWD_EVENTMODE_WORKERS 4/* * Event mode worker
@@ -847,6 +847,195 @@ l2fwd_eventmode_burst_no_internal_port(void *args)rte_free (links); } +/* +* Event mode worker +* Operating mode : burst tx internal port +*/ +static void +l2fwd_eventmode_burst_tx_internal_port (void *args) +{ +struct rte_event ev[MAX_PKT_BURST ]; +struct rte_mbuf *pkt; +struct rte_eventmode_helper_conf *mode_conf; +struct rte_eventmode_helper_event_link_info *links =NULL ; +unsigned int lcore_nb_link =0 ; +uint32_t lcore_id; +unsigned int i, j, left, nb_rx =0 ; +unsigned int portid; +struct lcore_queue_conf *qconf; +int is_master_core; +struct rte_event_port_conf event_port_conf; +uint16_t deq_len =0 , enq_len =0 ; +struct tsc_tracker tsc = {0 }; + +/* Get core ID */ + lcore_id =rte_lcore_id (); + +RTE_LOG (INFO ,L2FWD , +"Launching event mode burst worker internal port " +"lcore %d\n" , lcore_id); + +/* Set the flag if master core */ + is_master_core = (lcore_id ==rte_get_master_lcore ()) ?1 :0 ; + +/* Get qconf for this core */ + qconf = &lcore_queue_conf[lcore_id]; + +/* Set drain tsc */ + tsc.drain_tsc = (rte_get_tsc_hz () +US_PER_S -1 ) / +US_PER_S *BURST_TX_DRAIN_US ; + +/* Mode conf will be passed as args */ + mode_conf = (struct rte_eventmode_helper_conf *)args; + +/* Get the links configured for this lcore */ + lcore_nb_link =rte_eventmode_helper_get_event_lcore_links (lcore_id, + mode_conf, &links); + +/* Check if we have links registered for this lcore */ +if (lcore_nb_link ==0 ) { +/* No links registered. The core could do periodic drains */ +l2fwd_drain_loop (qconf, &tsc, is_master_core); + goto clean_and_exit; + } + +/* We have valid links */ + +/* Reset stats before proceeding */ +reset_eth_stats (is_master_core); + +/* Get the burst size of the event device */ + +/* Get the default conf of the first link */ +rte_event_port_default_conf_get (links[0 ].eventdev_id, + links[0 ].event_portid, + &event_port_conf); + +/* Save the burst size */ + deq_len = event_port_conf.dequeue_depth; + enq_len = event_port_conf.enqueue_depth; + +/* Dequeue and enqueue length should not exceed MAX_PKT_BURST */ +if (deq_len >MAX_PKT_BURST ) + deq_len =MAX_PKT_BURST ; +if (enq_len >MAX_PKT_BURST ) + enq_len =MAX_PKT_BURST ; + +/* See if it's single link */ +if (lcore_nb_link ==1 ) + goto single_link_loop; +else + goto multi_link_loop; + +single_link_loop: + +RTE_LOG (INFO ,L2FWD ," -- lcoreid=%u event_port_id=%u\n" , lcore_id, + links[0 ].event_portid); + +while (!force_quit) { + +/* Do periodic operations (buffer drain & stats monitor) */ +l2fwd_periodic_drain_stats_monitor (qconf, &tsc, is_master_core); + +/* Read packet from event queues */ + nb_rx =rte_event_dequeue_burst (links[0 ].eventdev_id, + links[0 ].event_portid, + ev,/* events */ + deq_len,/* nb_events */ +0 /* timeout_ticks */ ); + +if (nb_rx ==0 ) +continue ; + +for (j =0 ; j < nb_rx; j++) { + + portid = ev[j].queue_id; + port_statistics[portid].rx++; + pkt = ev[j].mbuf; + +rte_prefetch0 (rte_pktmbuf_mtod(pkt ,void *)); + +/* Process packet */ +l2fwd_event_pre_forward (&(ev[j]), portid); + } + +/* +* Since tx internal port is available, events can be +* directly enqueued to the adapter and it would be +* internally submitted to the eth device. +*/ +for (j =0 , left = nb_rx; + j < (nb_rx + enq_len -1 )/enq_len; j++) { + + left -=rte_event_eth_tx_adapter_enqueue ( + links[0 ].eventdev_id, + links[0 ].event_portid, + &ev[j*enq_len],/* events */ + left > enq_len ? + enq_len : left/* nb_events */ ); + } + } + goto clean_and_exit; + +multi_link_loop: + +for (i =0 ; i < lcore_nb_link; i++) { +RTE_LOG (INFO ,L2FWD ," -- lcoreid=%u event_port_id=%u\n" , + lcore_id, links[i].event_portid); + } + +while (!force_quit) { + +/* Do periodic operations (buffer drain & stats monitor) */ +l2fwd_periodic_drain_stats_monitor (qconf, &tsc, is_master_core); + +for (i =0 ; i < lcore_nb_link; i++) { +/* Read packet from event queues */ + nb_rx =rte_event_dequeue_burst (links[i].eventdev_id, + links[i].event_portid, + ev,/* events */ + deq_len,/* nb_events */ +0 /* timeout_ticks */ ); + +if (nb_rx ==0 ) +continue ; + +for (j =0 ; j < nb_rx; j++) { + + portid = ev[j].queue_id; + port_statistics[portid].rx++; + pkt = ev[j].mbuf; + +rte_prefetch0 (rte_pktmbuf_mtod(pkt ,void *)); + +/* Process packet */ +l2fwd_event_pre_forward (&(ev[j]), portid); + } + +/* +* Since tx internal port is available, events can be +* directly enqueued to the adapter and it would be +* internally submitted to the eth device. +*/ +for (j =0 , left = nb_rx; + j < (nb_rx + enq_len -1 )/enq_len; j++) { + + left -=rte_event_eth_tx_adapter_enqueue ( + links[i].eventdev_id, + links[i].event_portid, + &ev[j*enq_len],/* events */ + left > enq_len ? + enq_len : left/* nb_events */ ); + } + } + } + goto clean_and_exit; + +clean_and_exit: +if (links !=NULL ) +rte_free (links); +} +static uint8_t l2fwd_eventmode_populate_wrkr_params (struct rte_eventmode_helper_app_worker_params *wrkrs)
@@ -882,6 +1071,15 @@ l2fwd_eventmode_populate_wrkr_params( wrkr->worker_thread = l2fwd_eventmode_burst_no_internal_port; nb_wrkr_param++; + wrkr++; + +/* Burst tx internal port */ + wrkr->cap.burst =RTE_EVENTMODE_HELPER_RX_TYPE_BURST ; + wrkr->cap.tx_internal_port = +RTE_EVENTMODE_HELPER_TX_TYPE_INTERNAL_PORT ; + wrkr->worker_thread = l2fwd_eventmode_burst_tx_internal_port; + + nb_wrkr_param++;return nb_wrkr_param; }
Signature · 1 line
2.7.4