Re: [dpdk-dev] [dpdk-dev v21.11] [PATCH v5 8/8] eventdev: simplify Rx adapter event vector config
> -Original Message- > From: Pavan Nikhilesh Bhagavatula > Sent: Thursday, March 25, 2021 7:25 PM > To: Jayatheerthan, Jay ; Jerin Jacob > Kollanukkaran ; Carrillo, Erik G > ; Gujjar, Abhinandan S > ; McDaniel, Timothy > ; hemant.agra...@nxp.com; Van Haaren, Harry > ; mattias.ronnblom > ; Ma, Liang J ; Ray > Kinsella ; Neil Horman > > Cc: dev@dpdk.org > Subject: RE: [dpdk-dev v21.11] [PATCH v5 8/8] eventdev: simplify Rx adapter > event vector config > > >> From: pbhagavat...@marvell.com > >> Sent: Wednesday, March 24, 2021 10:35 AM > >> To: jer...@marvell.com; Jayatheerthan, Jay > >; Carrillo, Erik G > >; Gujjar, > >> Abhinandan S ; McDaniel, Timothy > >; hemant.agra...@nxp.com; Van > >> Haaren, Harry ; mattias.ronnblom > >; Ma, Liang J > >> ; Ray Kinsella ; Neil Horman > > > >> Cc: dev@dpdk.org; Pavan Nikhilesh > >> Subject: [dpdk-dev v21.11] [PATCH v5 8/8] eventdev: simplify Rx > >adapter event vector config > >> > >> From: Pavan Nikhilesh > >> > >> Include vector configuration into the structure > >> ``rte_event_eth_rx_adapter_queue_conf`` used when configuring rest > >> of the Rx adapter ethernet device Rx queue parameters. > >> This simplifies event vector configuration as it avoids splitting > >> configuration per Rx queue. > >> > >> Signed-off-by: Pavan Nikhilesh > >> --- > >> app/test-eventdev/test_pipeline_common.c | 16 +- > >> lib/librte_eventdev/eventdev_pmd.h| 29 --- > >> .../rte_event_eth_rx_adapter.c| 168 ++ > >> .../rte_event_eth_rx_adapter.h| 27 --- > >> lib/librte_eventdev/version.map | 1 - > >> 5 files changed, 57 insertions(+), 184 deletions(-) > >> > >> diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test- > >eventdev/test_pipeline_common.c > >> index d5ef90500..76aee254b 100644 > >> --- a/app/test-eventdev/test_pipeline_common.c > >> +++ b/app/test-eventdev/test_pipeline_common.c > >> @@ -331,7 +331,6 @@ pipeline_event_rx_adapter_setup(struct > >evt_options *opt, uint8_t stride, > >>uint16_t prod; > >>struct rte_mempool *vector_pool = NULL; > >>struct rte_event_eth_rx_adapter_queue_conf queue_conf; > >> - struct rte_event_eth_rx_adapter_event_vector_config > >vec_conf; > >> > >>memset(&queue_conf, 0, > >>sizeof(struct > >rte_event_eth_rx_adapter_queue_conf)); > >> @@ -397,8 +396,12 @@ pipeline_event_rx_adapter_setup(struct > >evt_options *opt, uint8_t stride, > >>} > >> > >>if (cap & > >RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR) { > >> + queue_conf.vector_sz = opt- > >>vector_size; > >> + queue_conf.vector_timeout_ns = > >> + opt->vector_tmo_nsec; > >>queue_conf.rx_queue_flags |= > >> > > RTE_EVENT_ETH_RX_ADAPTER_QUEUE_EVENT_VECTOR; > >> + queue_conf.vector_mp = vector_pool; > >>} else { > >>evt_err("Rx adapter doesn't support > >event vector"); > >>return -EINVAL; > >> @@ -418,17 +421,6 @@ pipeline_event_rx_adapter_setup(struct > >evt_options *opt, uint8_t stride, > >>return ret; > >>} > >> > >> - if (opt->ena_vector) { > >> - vec_conf.vector_sz = opt->vector_size; > >> - vec_conf.vector_timeout_ns = opt- > >>vector_tmo_nsec; > >> - vec_conf.vector_mp = vector_pool; > >> - if > >(rte_event_eth_rx_adapter_queue_event_vector_config( > >> - prod, prod, -1, &vec_conf) < 0) { > >> - evt_err("Failed to configure event > >vectorization for Rx adapter"); > >> - return -EINVAL; > >> - } > >> - } > >> - > >>if (!(cap & > >RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT)) { > >>uint32_t service_id = -1U; > >> > >> diff --git a/lib/librte_eventdev/eventdev_pmd.h > >b/lib/librte_eventdev/eventdev_pmd.h > >> index 0f724ac85..63b3bc4b5 100644 > >> --- a/lib/librte_eventdev/eventdev_pmd.h > >> +++ b/lib/librte_eventdev/eventdev_pmd.h > >> @@ -667,32 +667,6 @@ typedef int > >(*eventdev_eth_rx_adapter_vector_limits_get_t)( > >>const struct rte_eventdev *dev, const struct rte_eth_dev > >*eth_dev, > >>struct rte_event_eth_rx_adapter_vector_limits *limits); > >> > >> -struct rte_event_eth_rx_adapter_event_vector_config; > >> -/** > >> - * Enable event vector on an given Rx queue of a ethernet devices > >belonging to > >> - * the Rx adapter. > >> - * > >> - * @param dev > >> - * Event device pointer > >> - * > >> - * @param eth_dev > >> - * Ethernet device pointer > >> - * > >> - * @param rx_queue_id > >> - * The Rx queue identifier > >> - * > >> - * @param config > >> - * Pointer to the event vector configuration structure. > >> - * > >> - * @ret
[dpdk-dev] [PATCH v3] meson: remove unnecessary explicit link to libpcap
libpcap is already found and registered as a dependency by meson, and the dependency is already correctly used in librte_port. This line is just unnecessary. It also has the side effect of messing with the meson link line: dpdk link will be declared twice: manually and then through pkg-config. If you configure meson to prefer static linking over dynamic, this will cause the build to fail on librte_port, since the pcap deps are not yet seen by the linker. Signed-off-by: Gabriel Ganne --- config/meson.build | 1 - 1 file changed, 1 deletion(-) diff --git a/config/meson.build b/config/meson.build index 66a2edcc47f5..95777cf33169 100644 --- a/config/meson.build +++ b/config/meson.build @@ -183,7 +183,6 @@ if not pcap_dep.found() endif if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep) dpdk_conf.set('RTE_PORT_PCAP', 1) - dpdk_extra_ldflags += '-lpcap' endif # for clang 32-bit compiles we need libatomic for 64-bit atomic ops -- 2.29.2
[dpdk-dev] [PATCH] telemetry: cleanup internal header
The experimental banner can be removed. Every in-tree file is compiled with _GNU_SOURCE, so RTE_HAS_CPUSET is unneeded for an internal header. Fixes: 0e64ae618e10 ("telemetry: move init function to internal header") Signed-off-by: David Marchand --- lib/librte_telemetry/rte_telemetry.h | 1 - lib/librte_telemetry/telemetry_internal.h | 9 ++--- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/librte_telemetry/rte_telemetry.h b/lib/librte_telemetry/rte_telemetry.h index fd57718c26..031db9e968 100644 --- a/lib/librte_telemetry/rte_telemetry.h +++ b/lib/librte_telemetry/rte_telemetry.h @@ -6,7 +6,6 @@ #include #include -#include #ifndef _RTE_TELEMETRY_H_ #define _RTE_TELEMETRY_H_ diff --git a/lib/librte_telemetry/telemetry_internal.h b/lib/librte_telemetry/telemetry_internal.h index 6c52006040..d085c492dc 100644 --- a/lib/librte_telemetry/telemetry_internal.h +++ b/lib/librte_telemetry/telemetry_internal.h @@ -6,13 +6,12 @@ #define _RTE_TELEMETRY_INTERNAL_H_ #include +#include #include "rte_telemetry.h" /** * @internal - * @warning - * @b EXPERIMENTAL: this API may change without prior notice - + * * @file * RTE Telemetry Legacy and internal definitions * @@ -84,8 +83,6 @@ rte_telemetry_legacy_register(const char *cmd, enum rte_telemetry_legacy_data_req data_req, telemetry_legacy_cb fn); -#ifdef RTE_HAS_CPUSET - /** * @internal * Log function type, to allow passing as parameter if necessary @@ -115,6 +112,4 @@ int rte_telemetry_init(const char *runtime_dir, const char *rte_version, rte_cpuset_t *cpuset, rte_log_fn log_fn, uint32_t registered_logtype); -#endif /* RTE_HAS_CPUSET */ - #endif -- 2.23.0
Re: [dpdk-dev] [PATCH v6 0/2] EAL Thread TLS API enhancements
16/03/2021 14:28, Tal Shnaiderman: > --- > v6: fix misalignment in comment fix from v5 and missing NL in RN [Thomas] > v5: shorten docu comment on rte_errno and add ABI change info to release note > [Thomas] > v4: replace errno EOTHER with ENOEXEC as EOTHER is undefined in unix. > v3: -Unify rte_errno values to a generic errno for OS compatibility [DmitryK] > -Rename the TLS function to avoid redundancy[MortenB]. > v2: Rename key to avoid redundancy[MortenB]. > --- > > Tal Shnaiderman (2): > eal: error number enhancement for thread TLS API > eal: rename key opaque pointer and functions in TLS API Applied, thanks
Re: [dpdk-dev] Handling missing export functions in MSVC linkage
08/06/2020 10:33, David Marchand: > On Mon, Jun 8, 2020 at 2:09 AM Dmitry Kozlyuk > wrote: > > On Sun, 7 Jun 2020 12:26:56 + > > If you create a .def manually, it will override the generation from .map. Of > > cause, this adds manual work and ideally all .def files should be generated. > > On this topic, I just noticed that a patch of mine, that removed > rte_eal_get_configuration() from the stable ABI, missed the > declaration in rte_eal_exports.def. > Probably worth adding a check in devtools/, to avoid further misalignment. The .def file keeps being out of sync. We need a script to avoid forgetting the sync, or/and we must generate this .def from the .map. Ideally the full EAL API (except VFIO) should be implemented for Windows. This situation is waiting for a solution for too much time. Windows maintainers, please solve it.
[dpdk-dev] [PATCH v7] app/testpmd: support multi-process
From: Lijun Ou This patch adds multi-process support for testpmd. The test cmd example as follows: the primary cmd: ./dpdk-testpmd -a xxx --proc-type=auto -l 0-1 -- -i \ --rxq=4 --txq=4 --num-procs=2 --proc-id=0 the secondary cmd: ./dpdk-testpmd -a xxx --proc-type=auto -l 2-3 -- -i \ --rxq=4 --txq=4 --num-procs=2 --proc-id=1 Signed-off-by: Min Hu (Connor) Signed-off-by: Lijun Ou --- v7: * Fixed compiling error for unexpected unindent. v6: * Add rte flow description for multiple process. v5: * Fixed run_app.rst for multiple process description. * Fix compiling error. v4: * Fixed minimum vlaue of Rxq or Txq in doc. v3: * Fixed compiling error using gcc10.0. v2: * Added document for this patch. --- app/test-pmd/cmdline.c| 12 +++- app/test-pmd/config.c | 9 ++- app/test-pmd/parameters.c | 11 +++ app/test-pmd/testpmd.c| 127 ++ app/test-pmd/testpmd.h| 7 ++ doc/guides/testpmd_app_ug/run_app.rst | 99 ++ 6 files changed, 219 insertions(+), 46 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 14110eb..287d7a0 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -71,8 +71,6 @@ #include "cmdline_tm.h" #include "bpf_cmd.h" -static struct cmdline *testpmd_cl; - static void cmd_reconfig_device_queue(portid_t id, uint8_t dev, uint8_t queue); /* *** Help command with introduction. *** */ @@ -5351,6 +5349,12 @@ cmd_set_flush_rx_parsed(void *parsed_result, __rte_unused void *data) { struct cmd_set_flush_rx *res = parsed_result; + + if (num_procs > 1 && (strcmp(res->mode, "on") == 0)) { + printf("multi-process doesn't support to flush rx queues.\n"); + return; + } + no_flush_rx = (uint8_t)((strcmp(res->mode, "on") == 0) ? 0 : 1); } @@ -17227,6 +17231,10 @@ prompt(void) printf("Cannot set exit function for cmdline\n"); cmdline_interact(testpmd_cl); + if (unlikely(f_quit == 1)) { + dup2(testpmd_fd_copy, testpmd_cl->s_in); + close(testpmd_fd_copy); + } if (ret != 0) cmdline_stdin_exit(testpmd_cl); } diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index ef0b978..e48cbd9 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2827,6 +2827,8 @@ rss_fwd_config_setup(void) queueid_t rxq; queueid_t nb_q; streamid_t sm_id; + int start; + int end; nb_q = nb_rxq; if (nb_q > nb_txq) @@ -2844,7 +2846,10 @@ rss_fwd_config_setup(void) init_fwd_streams(); setup_fwd_config_of_each_lcore(&cur_fwd_config); - rxp = 0; rxq = 0; + start = proc_id * nb_q / num_procs; + end = start + nb_q / num_procs; + rxp = 0; + rxq = start; for (sm_id = 0; sm_id < cur_fwd_config.nb_fwd_streams; sm_id++) { struct fwd_stream *fs; @@ -2861,6 +2866,8 @@ rss_fwd_config_setup(void) continue; rxp = 0; rxq++; + if (rxq >= end) + rxq = start; } } diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index a326c8c..ec3bc62 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -45,6 +45,8 @@ #include #include "testpmd.h" +#define PARAM_PROC_ID "proc-id" +#define PARAM_NUM_PROCS "num-procs" static void usage(char* progname) @@ -644,6 +646,8 @@ launch_args_parse(int argc, char** argv) { "rx-mq-mode", 1, 0, 0 }, { "record-core-cycles", 0, 0, 0 }, { "record-burst-stats", 0, 0, 0 }, + { PARAM_NUM_PROCS, 1, 0, 0 }, + { PARAM_PROC_ID,1, 0, 0 }, { 0, 0, 0, 0 }, }; @@ -1410,6 +1414,13 @@ launch_args_parse(int argc, char** argv) record_core_cycles = 1; if (!strcmp(lgopts[opt_idx].name, "record-burst-stats")) record_burst_stats = 1; + + if (strncmp(lgopts[opt_idx].name, + PARAM_NUM_PROCS, 8) == 0) + num_procs = atoi(optarg); + if (strncmp(lgopts[opt_idx].name, + PARAM_PROC_ID, 7) == 0) + proc_id = atoi(optarg); break; case 'h': usage(argv[0]); diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 96d2e0f..c31234e 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -63,6 +63,9 @@ #include "testpmd.h" +int testpmd_fd_copy; /* the copy of STDIN_FILENO */ +struct cmdline *testpmd_cl; + #ifndef MAP_HUGETLB /* FreeBS
[dpdk-dev] [PATCH 1/2] net/hns3: fix code check warning
This patch fixed cyclomatic complexity about MTU in device configure process. Fixes: 1f5ca0b460cd ("net/hns3: support some device operations") Cc: sta...@dpdk.org Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_ethdev.c | 61 +- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index b7bfac8..b985447 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -2373,6 +2373,40 @@ hns3_init_ring_with_vector(struct hns3_hw *hw) } static int +hns3_refresh_mtu(struct rte_eth_dev *dev, struct rte_eth_conf *conf) +{ + struct hns3_adapter *hns = dev->data->dev_private; + struct hns3_hw *hw = &hns->hw; + uint32_t max_rx_pkt_len; + uint16_t mtu; + int ret; + + if (!(conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME)) + return 0; + + /* +* If jumbo frames are enabled, MTU needs to be refreshed +* according to the maximum RX packet length. +*/ + max_rx_pkt_len = conf->rxmode.max_rx_pkt_len; + if (max_rx_pkt_len > HNS3_MAX_FRAME_LEN || + max_rx_pkt_len <= HNS3_DEFAULT_FRAME_LEN) { + hns3_err(hw, "maximum Rx packet length must be greater than %u " +"and no more than %u when jumbo frame enabled.", +(uint16_t)HNS3_DEFAULT_FRAME_LEN, +(uint16_t)HNS3_MAX_FRAME_LEN); + return -EINVAL; + } + + mtu = (uint16_t)HNS3_PKTLEN_TO_MTU(max_rx_pkt_len); + ret = hns3_dev_mtu_set(dev, mtu); + if (ret) + return ret; + dev->data->mtu = mtu; + + return 0; +} +static int hns3_dev_configure(struct rte_eth_dev *dev) { struct hns3_adapter *hns = dev->data->dev_private; @@ -2382,8 +2416,6 @@ hns3_dev_configure(struct rte_eth_dev *dev) uint16_t nb_rx_q = dev->data->nb_rx_queues; uint16_t nb_tx_q = dev->data->nb_tx_queues; struct rte_eth_rss_conf rss_conf; - uint32_t max_rx_pkt_len; - uint16_t mtu; bool gro_en; int ret; @@ -2431,28 +2463,9 @@ hns3_dev_configure(struct rte_eth_dev *dev) goto cfg_err; } - /* -* If jumbo frames are enabled, MTU needs to be refreshed -* according to the maximum RX packet length. -*/ - if (conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { - max_rx_pkt_len = conf->rxmode.max_rx_pkt_len; - if (max_rx_pkt_len > HNS3_MAX_FRAME_LEN || - max_rx_pkt_len <= HNS3_DEFAULT_FRAME_LEN) { - hns3_err(hw, "maximum Rx packet length must be greater " -"than %u and less than %u when jumbo frame enabled.", -(uint16_t)HNS3_DEFAULT_FRAME_LEN, -(uint16_t)HNS3_MAX_FRAME_LEN); - ret = -EINVAL; - goto cfg_err; - } - - mtu = (uint16_t)HNS3_PKTLEN_TO_MTU(max_rx_pkt_len); - ret = hns3_dev_mtu_set(dev, mtu); - if (ret) - goto cfg_err; - dev->data->mtu = mtu; - } + ret = hns3_refresh_mtu(dev, conf); + if (ret) + goto cfg_err; ret = hns3_dev_configure_vlan(dev); if (ret) -- 2.7.4
[dpdk-dev] [PATCH 0/2] Support PTP for hns3 PMD
This set includes two patches, one patch is to fix cyclomatic complexity, the other patch is to support PTP, but depends on the first patch. So the two forms one set of patches. Min Hu (Connor) (2): net/hns3: fix code check warning net/hns3: support IEEE 1588 PTP doc/guides/nics/features/hns3.ini | 2 + doc/guides/nics/hns3.rst | 1 + drivers/net/hns3/hns3_cmd.h | 33 + drivers/net/hns3/hns3_ethdev.c| 120 drivers/net/hns3/hns3_ethdev.h| 25 drivers/net/hns3/hns3_ptp.c | 294 ++ drivers/net/hns3/hns3_regs.h | 25 drivers/net/hns3/hns3_rxtx.c | 56 +++- drivers/net/hns3/hns3_rxtx.h | 12 ++ drivers/net/hns3/hns3_rxtx_vec.c | 19 ++- drivers/net/hns3/meson.build | 3 +- 11 files changed, 553 insertions(+), 37 deletions(-) create mode 100644 drivers/net/hns3/hns3_ptp.c -- 2.7.4
[dpdk-dev] [PATCH 2/2] net/hns3: support IEEE 1588 PTP
Add hns3 support for new ethdev APIs to enable and read IEEE1588/ 802.1AS PTP timestamps. Signed-off-by: Min Hu (Connor) --- doc/guides/nics/features/hns3.ini | 2 + doc/guides/nics/hns3.rst | 1 + drivers/net/hns3/hns3_cmd.h | 33 + drivers/net/hns3/hns3_ethdev.c| 59 +++- drivers/net/hns3/hns3_ethdev.h| 25 drivers/net/hns3/hns3_ptp.c | 294 ++ drivers/net/hns3/hns3_regs.h | 25 drivers/net/hns3/hns3_rxtx.c | 56 +++- drivers/net/hns3/hns3_rxtx.h | 12 ++ drivers/net/hns3/hns3_rxtx_vec.c | 19 ++- drivers/net/hns3/meson.build | 3 +- 11 files changed, 516 insertions(+), 13 deletions(-) create mode 100644 drivers/net/hns3/hns3_ptp.c diff --git a/doc/guides/nics/features/hns3.ini b/doc/guides/nics/features/hns3.ini index 3988be4..502bfe7 100644 --- a/doc/guides/nics/features/hns3.ini +++ b/doc/guides/nics/features/hns3.ini @@ -43,6 +43,8 @@ Stats per queue = Y FW version = Y Registers dump = Y Module EEPROM dump = Y +Timesync = Y +Timestamp offload= Y Multiprocess aware = Y Linux= Y ARMv8= Y diff --git a/doc/guides/nics/hns3.rst b/doc/guides/nics/hns3.rst index ccd2f6f..3366562 100644 --- a/doc/guides/nics/hns3.rst +++ b/doc/guides/nics/hns3.rst @@ -37,6 +37,7 @@ Features of the HNS3 PMD are: - MTU update - NUMA support - Generic flow API +- IEEE1588/802.1AS timestamping Prerequisites - diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h index e704d0c..abc853b 100644 --- a/drivers/net/hns3/hns3_cmd.h +++ b/drivers/net/hns3/hns3_cmd.h @@ -123,6 +123,12 @@ enum hns3_opcode_type { HNS3_OPC_CLEAR_MAC_TNL_INT = 0x0312, HNS3_OPC_CONFIG_FEC_MODE= 0x031A, +#ifdef RTE_LIBRTE_IEEE1588 + /* PTP command */ + HNS3_OPC_PTP_INT_EN = 0x0501, + HNS3_OPC_CFG_PTP_MODE = 0x0507, +#endif + /* PFC/Pause commands */ HNS3_OPC_CFG_MAC_PAUSE_EN = 0x0701, HNS3_OPC_CFG_PFC_PAUSE_EN = 0x0702, @@ -969,6 +975,33 @@ struct hns3_query_ssu_cmd { uint32_t oq_drop_cnt; uint32_t rev1[2]; }; +#ifdef RTE_LIBRTE_IEEE1588 +#define HNS3_PTP_ENABLE_B 0 +#define HNS3_PTP_TX_ENABLE_B1 +#define HNS3_PTP_RX_ENABLE_B2 + +#define HNS3_PTP_TYPE_S 0 +#define HNS3_PTP_TYPE_M(0x3 << HNS3_PTP_TYPE_S) + +#define ALL_PTP_V2_TYPE 0xF +#define HNS3_PTP_MESSAGE_TYPE_S 0 +#define HNS3_PTP_MESSAGE_TYPE_M(0xF << HNS3_PTP_MESSAGE_TYPE_S) + +#define PTP_TYPE_L2_V2_TYPE 0 + +struct hns3_ptp_mode_cfg_cmd { + uint8_t enable; + uint8_t ptp_type; + uint8_t v2_message_type_1; + uint8_t v2_message_type_0; + uint8_t rsv[20]; +}; + +struct hns3_ptp_int_cmd { + uint8_t int_en; + uint8_t rsvd[23]; +}; +#endif #define HNS3_MAX_TQP_NUM_HIP08_PF 64 #define HNS3_DEFAULT_TX_BUF0x4000/* 16k bytes */ diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index b985447..11b9065 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -58,6 +58,10 @@ enum hns3_evt_cause { HNS3_VECTOR0_EVENT_RST, HNS3_VECTOR0_EVENT_MBX, HNS3_VECTOR0_EVENT_ERR, + +#ifdef RTE_LIBRTE_IEEE1588 + HNS3_VECTOR0_EVENT_PTP, +#endif HNS3_VECTOR0_EVENT_OTHER, }; @@ -202,6 +206,14 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) goto out; } +#ifdef RTE_LIBRTE_IEEE1588 + /* Check for vector0 1588 event source */ + if (BIT(HNS3_VECTOR0_1588_INT_B) & vector0_int_stats) { + val = BIT(HNS3_VECTOR0_1588_INT_B); + ret = HNS3_VECTOR0_EVENT_PTP; + goto out; + } +#endif /* check for vector0 msix event source */ if (vector0_int_stats & HNS3_VECTOR0_REG_MSIX_MASK || hw_err_src_reg & HNS3_RAS_REG_NFE_MASK) { @@ -227,10 +239,22 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) return ret; } +static bool +hns3_is_1588_event_type(uint32_t event_type) +{ +#ifdef RTE_LIBRTE_IEEE1588 + return (event_type == HNS3_VECTOR0_EVENT_PTP); +#else + RTE_SET_USED(event_type); + return false; +#endif +} + static void hns3_clear_event_cause(struct hns3_hw *hw, uint32_t event_type, uint32_t regclr) { - if (event_type == HNS3_VECTOR0_EVENT_RST) + if (event_type == HNS3_VECTOR0_EVENT_RST || + hns3_is_1588_event_type(event_type)) hns3_write_dev(hw, HNS3_MISC_RESET_STS_REG, regclr); else if (event_type == HNS3_VECTOR0_EVENT_MBX) hns3_write_dev(hw, HNS3_VECTOR0_CMDQ_SRC_REG, regclr); @@ -253,6 +277,11 @@ hns3_clear_all_event_cause(struct hns3_hw *hw)
Re: [dpdk-dev] [PATCH v3 3/7] net/txgbe: update link setup process of backplane NICs
On 3/26/2021 2:02 AM, Jiawen Wu wrote: On March 25, 2021 6:20 PM, Ferruh Yigit wrote: On 3/25/2021 5:51 AM, Jiawen Wu wrote: Add device arguments to support runtime options. And use these configuration to control the link setup flow, to adapt to different NIC's construction. Use firmware version to control the impact of firmware update. And fix some left bugs. Signed-off-by: Jiawen Wu <...> +#define TXGBE_DEBUG_BP +#ifdef TXGBE_DEBUG_BP +#define BP_LOG(fmt, ...) \ + RTE_LOG(CRIT, PMD, "[%lu.%lu]%s(%d): " fmt, \ + usec_stamp() / 100, usec_stamp() % 100, \ + __func__, __LINE__, ## __VA_ARGS__) #else #define BP_LOG(fmt, ...) +do { } while (0) #endif + #endif /* _TXGBE_LOGS_H_ */ The 'BP_LOG' looks like used for developer debug prints, if so I suggest removing them completely, but if not can you please convert it dynamic logging, or using existing dynamic logs 'txgbe_logtype_init', 'txgbe_logtype_driver'? Thanks, ferruh I think it should not be removed, since the user needs to adjust 'ffe' parameters according to the logs. I considered converting it to dynamic logging. But when the log level is 'debug', it will result in the printing of other logs, which I don't need. Should I lower the log level of 'BP_LOG', to avoid the above situation? You can create a new logtype for it, and it can be controlled without affecting other logs, user need to get those logs can enable/disable them in runtime on demand, does this work for you?
Re: [dpdk-dev] [PATCH v5 4/8] eventdev: add Rx adapter event vector support
>> From: Pavan Nikhilesh Bhagavatula >> Sent: Thursday, March 25, 2021 6:44 PM >> To: Jayatheerthan, Jay ; Jerin Jacob >Kollanukkaran ; Carrillo, Erik G >> ; Gujjar, Abhinandan S >; McDaniel, Timothy >> ; hemant.agra...@nxp.com; Van >Haaren, Harry ; mattias.ronnblom >> ; Ma, Liang J > >> Cc: dev@dpdk.org >> Subject: RE: [dpdk-dev] [PATCH v5 4/8] eventdev: add Rx adapter >event vector support >> >> >> >> >-Original Message- >> >From: Jayatheerthan, Jay >> >Sent: Thursday, March 25, 2021 4:07 PM >> >To: Pavan Nikhilesh Bhagavatula ; >Jerin >> >Jacob Kollanukkaran ; Carrillo, Erik G >> >; Gujjar, Abhinandan S >> >; McDaniel, Timothy >> >; hemant.agra...@nxp.com; Van >> >Haaren, Harry ; mattias.ronnblom >> >; Ma, Liang J >> > >> >Cc: dev@dpdk.org >> >Subject: [EXT] RE: [dpdk-dev] [PATCH v5 4/8] eventdev: add Rx >adapter >> >event vector support >> > >> >External Email >> > >> >-- >> >> -Original Message- >> >> From: pbhagavat...@marvell.com >> >> Sent: Wednesday, March 24, 2021 10:35 AM >> >> To: jer...@marvell.com; Jayatheerthan, Jay >> >; Carrillo, Erik G >> >; Gujjar, >> >> Abhinandan S ; McDaniel, Timothy >> >; hemant.agra...@nxp.com; Van >> >> Haaren, Harry ; mattias.ronnblom >> >; Ma, Liang J >> >> >> >> Cc: dev@dpdk.org; Pavan Nikhilesh >> >> Subject: [dpdk-dev] [PATCH v5 4/8] eventdev: add Rx adapter >event >> >vector support >> >> >> >> From: Pavan Nikhilesh >> >> >> >> Add event vector support for event eth Rx adapter, the >> >implementation >> >> creates vector flows based on port and queue identifier of the >> >received >> >> mbufs. >> >> >> >> Signed-off-by: Pavan Nikhilesh >> >> --- >> >> lib/librte_eventdev/eventdev_pmd.h| 7 +- >> >> .../rte_event_eth_rx_adapter.c| 257 - >- >> >> lib/librte_eventdev/rte_eventdev.c| 6 +- >> >> 3 files changed, 250 insertions(+), 20 deletions(-) >> >> >> >> diff --git a/lib/librte_eventdev/eventdev_pmd.h >> >b/lib/librte_eventdev/eventdev_pmd.h >> >> index 9297f1433..0f724ac85 100644 >> >> --- a/lib/librte_eventdev/eventdev_pmd.h >> >> +++ b/lib/librte_eventdev/eventdev_pmd.h >> >> @@ -69,9 +69,10 @@ extern "C" { >> >> } \ >> >> } while (0) >> >> >> >> -#define RTE_EVENT_ETH_RX_ADAPTER_SW_CAP \ >> >> - >> >((RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID) | >> >\ >> >> - >> >(RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ)) >> >> +#define RTE_EVENT_ETH_RX_ADAPTER_SW_CAP >> >\ >> >> + ((RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID) | >> >\ >> >> + (RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ) | >> >\ >> >> + (RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR)) >> >> >> >> #define RTE_EVENT_CRYPTO_ADAPTER_SW_CAP \ >> >> >> >RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA >> >> diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c >> >b/lib/librte_eventdev/rte_event_eth_rx_adapter.c >> >> index ac8ba5bf0..c71990078 100644 >> >> --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c >> >> +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c >> >> @@ -26,6 +26,10 @@ >> >> #define BATCH_SIZE 32 >> >> #define BLOCK_CNT_THRESHOLD 10 >> >> #define ETH_EVENT_BUFFER_SIZE(4*BATCH_SIZE) >> >> +#define MAX_VECTOR_SIZE 1024 >> >> +#define MIN_VECTOR_SIZE 4 >> >> +#define MAX_VECTOR_NS1E9 >> >> +#define MIN_VECTOR_NS1E5 >> >> >> >> #define ETH_RX_ADAPTER_SERVICE_NAME_LEN 32 >> >> #define ETH_RX_ADAPTER_MEM_NAME_LEN 32 >> >> @@ -59,6 +63,20 @@ struct eth_rx_poll_entry { >> >> uint16_t eth_rx_qid; >> >> }; >> >> >> >> +struct eth_rx_vector_data { >> >> + TAILQ_ENTRY(eth_rx_vector_data) next; >> >> + uint16_t port; >> >> + uint16_t queue; >> >> + uint16_t max_vector_count; >> >> + uint64_t event; >> >> + uint64_t ts; >> >> + uint64_t vector_timeout_ticks; >> >> + struct rte_mempool *vector_pool; >> >> + struct rte_event_vector *vector_ev; >> >> +} __rte_cache_aligned; >> >> + >> >> +TAILQ_HEAD(eth_rx_vector_data_list, eth_rx_vector_data); >> >> + >> >> /* Instance per adapter */ >> >> struct rte_eth_event_enqueue_buffer { >> >> /* Count of events in this buffer */ >> >> @@ -92,6 +110,14 @@ struct rte_event_eth_rx_adapter { >> >> uint32_t wrr_pos; >> >> /* Event burst buffer */ >> >> struct rte_eth_event_enqueue_buffer event_enqueue_buffer; >> >> + /* Vector enable flag */ >> >> + uint8_t ena_vector; >> >> + /* Timestamp of previous vector expiry list traversal */ >> >> + uint64_t prev_expiry_ts; >> >> + /* Minimum ticks to wait before traversing expiry list */ >> >> + uint64_t vector_tmo_ticks; >> >> + /* vector list */ >> >> + struct eth_rx_vector_data_list vector_list; >> >> /* Per adapter stats */ >> >> struct rte_event_eth_rx_adapter_stats stats; >> >> /* Block count, counts up to BLOCK_CNT_THRESHOLD */ >> >> @@ -198,9 +224,11 @@ struct eth_device_info { >> >> struct eth_rx_queue_info { >> >> int queue_enabled; /* Tr
Re: [dpdk-dev] [PATCH v6 2/5] eal/windows: hide asprintf() shim
20/03/2021 14:05, Dmitry Kozlyuk: > Make asprintf(3) implementation for Windows private to EAL, so that it's > hidden from external consumers. It is not exposed to internal consumers > either, because they don't need asprintf() and also because callers from > other modules would have no reliable way to free allocated memory. > > Signed-off-by: Dmitry Kozlyuk > Acked-by: Khoa To > --- > lib/librte_eal/common/eal_private.h | 11 +++ > lib/librte_eal/windows/eal.c| 30 + > 2 files changed, 41 insertions(+) It would be logic to remove the asprintf implementation from rte_os.h in this patch.
Re: [dpdk-dev] [PATCH v6 3/5] eal: make OS shims internal
20/03/2021 14:05, Dmitry Kozlyuk: > DPDK code often relies on functions and macros that are not standard C, > but are found on all platforms, even if by slightly different names. > Windows provided macros or inline definitions for such symbols. > However, when placed in public header, these symbols were unnecessarily > exposed, breaking consumer POSIX compatibility code. > > Move all shims to , a header to be used instead of > by internal code. Include it in libraries and PMDs that > previously imported shims from . This shim could have been convenient for applications. If not named "internal", we could export the header file and allow apps including it. Otherwise the app can recreate this file on its side, it is not a big deal. Opinions?
[dpdk-dev] [PATCH v1 0/2] Enhancements to crypto adapter forward mode
This series proposes a new event device enqueue operation if crypto adapter forward mode is supported. Second patch in the series is the implementation of the same in PMD. Test application changes for the usage of new API is yet to add. v1: - Added crypto adapter forward mode support for octeontx2. Akhil Goyal (1): eventdev: introduce crypto adapter enqueue API Shijith Thotton (1): event/octeontx2: support crypto adapter forward mode .../prog_guide/event_crypto_adapter.rst | 69 ++-- drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 34 +--- drivers/event/octeontx2/otx2_evdev.c | 5 +- .../event/octeontx2/otx2_evdev_crypto_adptr.c | 3 +- ...dptr_dp.h => otx2_evdev_crypto_adptr_rx.h} | 6 +- .../octeontx2/otx2_evdev_crypto_adptr_tx.h| 82 +++ drivers/event/octeontx2/otx2_worker.h | 2 +- drivers/event/octeontx2/otx2_worker_dual.h| 2 +- lib/librte_eventdev/eventdev_trace_points.c | 3 + .../rte_event_crypto_adapter.h| 66 +++ lib/librte_eventdev/rte_eventdev.c| 10 +++ lib/librte_eventdev/rte_eventdev.h| 8 +- lib/librte_eventdev/rte_eventdev_trace_fp.h | 10 +++ lib/librte_eventdev/version.map | 3 + 14 files changed, 259 insertions(+), 44 deletions(-) rename drivers/event/octeontx2/{otx2_evdev_crypto_adptr_dp.h => otx2_evdev_crypto_adptr_rx.h} (93%) create mode 100644 drivers/event/octeontx2/otx2_evdev_crypto_adptr_tx.h -- 2.25.1
[dpdk-dev] [PATCH v1 1/2] eventdev: introduce crypto adapter enqueue API
From: Akhil Goyal In case an event from a previous stage is required to be forwarded to a crypto adapter and PMD supports internal event port in crypto adapter, exposed via capability RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD, we do not have a way to check in the API rte_event_enqueue_burst(), whether it is for crypto adapter or for eth tx adapter. Hence we need a new API similar to rte_event_eth_tx_adapter_enqueue(), which can send to a crypto adapter. Note that RTE_EVENT_TYPE_* cannot be used to make that decision, as it is meant for event source and not event destination. And event port designated for crypto adapter is designed to be used for OP_NEW mode. Hence, in order to support an event PMD which has an internal event port in crypto adapter (RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD mode), exposed via capability RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD, application should use rte_event_crypto_adapter_enqueue() API to enqueue events. When internal port is not available(RTE_EVENT_CRYPTO_ADAPTER_OP_NEW mode), application can use API rte_event_enqueue_burst() as it was doing earlier, i.e. retrieve event port used by crypto adapter and bind its event queues to that port and enqueue events using the API rte_event_enqueue_burst(). Signed-off-by: Akhil Goyal --- .../prog_guide/event_crypto_adapter.rst | 69 --- lib/librte_eventdev/eventdev_trace_points.c | 3 + .../rte_event_crypto_adapter.h| 66 ++ lib/librte_eventdev/rte_eventdev.c| 10 +++ lib/librte_eventdev/rte_eventdev.h| 8 ++- lib/librte_eventdev/rte_eventdev_trace_fp.h | 10 +++ lib/librte_eventdev/version.map | 3 + 7 files changed, 142 insertions(+), 27 deletions(-) diff --git a/doc/guides/prog_guide/event_crypto_adapter.rst b/doc/guides/prog_guide/event_crypto_adapter.rst index 1e3eb7139..4fb5c688e 100644 --- a/doc/guides/prog_guide/event_crypto_adapter.rst +++ b/doc/guides/prog_guide/event_crypto_adapter.rst @@ -55,21 +55,22 @@ which is needed to enqueue an event after the crypto operation is completed. RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD mode -In the RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD mode, if HW supports -RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD capability the application -can directly submit the crypto operations to the cryptodev. -If not, application retrieves crypto adapter's event port using -rte_event_crypto_adapter_event_port_get() API. Then, links its event -queue to this port and starts enqueuing crypto operations as events -to the eventdev. The adapter then dequeues the events and submits the -crypto operations to the cryptodev. After the crypto completions, the -adapter enqueues events to the event device. -Application can use this mode, when ingress packet ordering is needed. -In this mode, events dequeued from the adapter will be treated as -forwarded events. The application needs to specify the cryptodev ID -and queue pair ID (request information) needed to enqueue a crypto -operation in addition to the event information (response information) -needed to enqueue an event after the crypto operation has completed. +In the ``RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD`` mode, if the event PMD and crypto +PMD supports internal event port +(``RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD``), the application should +use ``rte_event_crypto_adapter_enqueue()`` API to enqueue crypto operations as +events to crypto adapter. If not, application retrieves crypto adapter's event +port using ``rte_event_crypto_adapter_event_port_get()`` API, links its event +queue to this port and starts enqueuing crypto operations as events to eventdev +using ``rte_event_enqueue_burst()``. The adapter then dequeues the events and +submits the crypto operations to the cryptodev. After the crypto operation is +complete, the adapter enqueues events to the event device. The application can +use this mode when ingress packet ordering is needed. In this mode, events +dequeued from the adapter will be treated as forwarded events. The application +needs to specify the cryptodev ID and queue pair ID (request information) needed +to enqueue a crypto operation in addition to the event information (response +information) needed to enqueue an event after the crypto operation has +completed. .. _figure_event_crypto_adapter_op_forward: @@ -120,28 +121,44 @@ service function and needs to create an event port for it. The callback is expected to fill the ``struct rte_event_crypto_adapter_conf`` structure passed to it. -For RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD mode, the event port created by adapter -can be retrieved using ``rte_event_crypto_adapter_event_port_get()`` API. -Application can use this event port to link with event queue on which it -enqueues events towards the crypto adapter. +In the ``RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD`` mode, if the event PMD and crypto +PMD supports internal eve
[dpdk-dev] [PATCH v1 2/2] event/octeontx2: support crypto adapter forward mode
Advertise crypto adapter forward mode capability and set crypto adapter enqueue function in driver. Signed-off-by: Shijith Thotton --- drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 34 +--- drivers/event/octeontx2/otx2_evdev.c | 5 +- .../event/octeontx2/otx2_evdev_crypto_adptr.c | 3 +- ...dptr_dp.h => otx2_evdev_crypto_adptr_rx.h} | 6 +- .../octeontx2/otx2_evdev_crypto_adptr_tx.h| 82 +++ drivers/event/octeontx2/otx2_worker.h | 2 +- drivers/event/octeontx2/otx2_worker_dual.h| 2 +- 7 files changed, 117 insertions(+), 17 deletions(-) rename drivers/event/octeontx2/{otx2_evdev_crypto_adptr_dp.h => otx2_evdev_crypto_adptr_rx.h} (93%) create mode 100644 drivers/event/octeontx2/otx2_evdev_crypto_adptr_tx.h diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c index cec20b5c6..a72285892 100644 --- a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c +++ b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "otx2_cryptodev.h" #include "otx2_cryptodev_capabilities.h" @@ -438,11 +439,23 @@ static __rte_always_inline void __rte_hot otx2_ca_enqueue_req(const struct otx2_cpt_qp *qp, struct cpt_request_info *req, void *lmtline, + struct rte_crypto_op *op, uint64_t cpt_inst_w7) { + union rte_event_crypto_metadata *m_data; union cpt_inst_s inst; uint64_t lmt_status; + if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) + m_data = rte_cryptodev_sym_session_get_user_data( + op->sym->session); + else if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS && +op->private_data_offset) + m_data = (union rte_event_crypto_metadata *) +((uint8_t *)op + + op->private_data_offset); + + inst.u[0] = 0; inst.s9x.res_addr = req->comp_baddr; inst.u[2] = 0; @@ -453,12 +466,11 @@ otx2_ca_enqueue_req(const struct otx2_cpt_qp *qp, inst.s9x.ei2 = req->ist.ei2; inst.s9x.ei3 = cpt_inst_w7; - inst.s9x.qord = 1; - inst.s9x.grp = qp->ev.queue_id; - inst.s9x.tt = qp->ev.sched_type; - inst.s9x.tag = (RTE_EVENT_TYPE_CRYPTODEV << 28) | - qp->ev.flow_id; - inst.s9x.wq_ptr = (uint64_t)req >> 3; + inst.u[2] = (((RTE_EVENT_TYPE_CRYPTODEV << 28) | + m_data->response_info.flow_id) | +((uint64_t)m_data->response_info.sched_type << 32) | +((uint64_t)m_data->response_info.queue_id << 34)); + inst.u[3] = 1 | (((uint64_t)req >> 3) << 3); req->qp = qp; do { @@ -481,6 +493,7 @@ static __rte_always_inline int32_t __rte_hot otx2_cpt_enqueue_req(const struct otx2_cpt_qp *qp, struct pending_queue *pend_q, struct cpt_request_info *req, +struct rte_crypto_op *op, uint64_t cpt_inst_w7) { void *lmtline = qp->lmtline; @@ -488,7 +501,7 @@ otx2_cpt_enqueue_req(const struct otx2_cpt_qp *qp, uint64_t lmt_status; if (qp->ca_enable) { - otx2_ca_enqueue_req(qp, req, lmtline, cpt_inst_w7); + otx2_ca_enqueue_req(qp, req, lmtline, op, cpt_inst_w7); return 0; } @@ -594,7 +607,8 @@ otx2_cpt_enqueue_asym(struct otx2_cpt_qp *qp, goto req_fail; } - ret = otx2_cpt_enqueue_req(qp, pend_q, params.req, sess->cpt_inst_w7); + ret = otx2_cpt_enqueue_req(qp, pend_q, params.req, op, + sess->cpt_inst_w7); if (unlikely(ret)) { CPT_LOG_DP_ERR("Could not enqueue crypto req"); @@ -638,7 +652,7 @@ otx2_cpt_enqueue_sym(struct otx2_cpt_qp *qp, struct rte_crypto_op *op, return ret; } - ret = otx2_cpt_enqueue_req(qp, pend_q, req, sess->cpt_inst_w7); + ret = otx2_cpt_enqueue_req(qp, pend_q, req, op, sess->cpt_inst_w7); if (unlikely(ret)) { /* Free buffer allocated by fill params routines */ @@ -707,7 +721,7 @@ otx2_cpt_enqueue_sec(struct otx2_cpt_qp *qp, struct rte_crypto_op *op, return ret; } - ret = otx2_cpt_enqueue_req(qp, pend_q, req, sess->cpt_inst_w7); + ret = otx2_cpt_enqueue_req(qp, pend_q, req, op, sess->cpt_inst_w7); if (winsz && esn) { seq_in_sa = ((uint64_t)esn_hi << 32) | esn_low; diff --git a/drivers/event/octeontx2/otx2_evdev.c b/drivers/event/octeontx2/otx2_evdev.c index 770a801c4..59450521a 100644 --- a/drivers/event/octeontx2/otx2_evdev.c +++ b/drivers/event/octeontx2/otx2_evdev.c @@ -12,8 +12,9 @@ #include #include -#include "otx2_evdev_stats.h" #include "otx2_evdev.h" +#include "otx2_evdev_crypto_adp
[dpdk-dev] [PATCH] doc: update limitations of OCTEON TX crypto PMDs
Update known limitations of OCTEON TX crypto PMDs. Signed-off-by: Anoob Joseph --- doc/guides/cryptodevs/octeontx.rst | 6 ++ doc/guides/cryptodevs/octeontx2.rst | 6 ++ 2 files changed, 12 insertions(+) diff --git a/doc/guides/cryptodevs/octeontx.rst b/doc/guides/cryptodevs/octeontx.rst index a39f3f3..21ddd57 100644 --- a/doc/guides/cryptodevs/octeontx.rst +++ b/doc/guides/cryptodevs/octeontx.rst @@ -135,3 +135,9 @@ application: ./dpdk-test RTE>>cryptodev_octeontx_asym_autotest + +Limitations +--- + +Multiple lcores may not operate on the same crypto queue pair. The lcore that +enqueues to a queueu pair is the one that must dequeue from it. diff --git a/doc/guides/cryptodevs/octeontx2.rst b/doc/guides/cryptodevs/octeontx2.rst index d312eeb..8c7df06 100644 --- a/doc/guides/cryptodevs/octeontx2.rst +++ b/doc/guides/cryptodevs/octeontx2.rst @@ -184,3 +184,9 @@ Features supported * AES-128/192/256-GCM * AES-128/192/256-CBC-SHA1-HMAC * AES-128/192/256-CBC-SHA256-128-HMAC + +Limitations +--- + +Multiple lcores may not operate on the same crypto queue pair. The lcore that +enqueues to a queue pair is the one that must dequeue from it. -- 2.7.4
Re: [dpdk-dev] [PATCH v3 3/7] net/txgbe: update link setup process of backplane NICs
On March 26, 2021 4:56 PM, Ferruh Yigit wrote: > On 3/26/2021 2:02 AM, Jiawen Wu wrote: > > On March 25, 2021 6:20 PM, Ferruh Yigit wrote: > >> On 3/25/2021 5:51 AM, Jiawen Wu wrote: > >>> Add device arguments to support runtime options. > >>> And use these configuration to control the link setup flow, to adapt > >>> to different NIC's construction. Use firmware version to control the > >>> impact of firmware update. And fix some left bugs. > >>> > >>> Signed-off-by: Jiawen Wu > >> > >> <...> > >> > >>> +#define TXGBE_DEBUG_BP > >>> +#ifdef TXGBE_DEBUG_BP > >>> +#define BP_LOG(fmt, ...) \ > >>> + RTE_LOG(CRIT, PMD, "[%lu.%lu]%s(%d): " fmt, \ > >>> + usec_stamp() / 100, usec_stamp() % 100, \ > >>> + __func__, __LINE__, ## __VA_ARGS__) #else #define > >> BP_LOG(fmt, ...) > >>> +do { } while (0) #endif > >>> + > >>>#endif /* _TXGBE_LOGS_H_ */ > >>> > >> > >> The 'BP_LOG' looks like used for developer debug prints, if so I > >> suggest removing them completely, but if not can you please convert > >> it dynamic logging, or using existing dynamic logs 'txgbe_logtype_init', > 'txgbe_logtype_driver'? > >> > >> Thanks, > >> ferruh > > > > I think it should not be removed, since the user needs to adjust 'ffe' > > parameters according to the logs. I considered converting it to > > dynamic logging. But when the log level is 'debug', it will result in the > > printing > of other logs, which I don't need. > > Should I lower the log level of 'BP_LOG', to avoid the above situation? > > > > You can create a new logtype for it, and it can be controlled without > affecting > other logs, user need to get those logs can enable/disable them in runtime on > demand, does this work for you? Got it, thanks!
Re: [dpdk-dev] [PATCH v6 4/5] net: provide IP-related API on any OS
20/03/2021 14:05, Dmitry Kozlyuk: > Users of relied on it to provide IP-related defines, > like IPPROTO_* constatns, but still had to include POSIX headers typo: constants > for inet_pton() and other standard IP-related facilities. > > Extend so that it is a single header to gain access > to IP-related facilities on any OS. Use it to replace POSIX include > in components enabled on Windows. > > Signed-off-by: Dmitry Kozlyuk [...] > --- a/drivers/net/mlx5/mlx5.h > +++ b/drivers/net/mlx5/mlx5.h > @@ -10,7 +10,7 @@ > #include > #include > #include > -#include > + > #include No need of blank space between system includes. (same comments for other files) > --- a/lib/librte_net/rte_ip.h > +++ b/lib/librte_net/rte_ip.h > #include > + That's an unneeded blank line. > +#include > #include > +#include > #include > #include The benefit is not obvious because the removal of Windows code is done in another patch. Please could you re-arrange the patch to be more atomic?
Re: [dpdk-dev] [PATCH v6 5/5] net: replace Windows networking shim
20/03/2021 14:05, Dmitry Kozlyuk: > Remove networking shim from Windows EAL. > > Replace it with system headers with two workarounds: > > 1. Windows Sockets headers contain `#define s_addr S_un.S_addr`, which >conflicts with `s_addr` field of `struct rte_ether_hdr`. Undefining >this macro in had been breaking some usages of DPDK >and Windows headers in one file. I don't understand this last sentence. > >Renaming is planned: >https://mails.dpdk.org/archives/dev/2021-March/201444.html > >Temporarily disable `s_addr` macro around `struct rte_ether_hdr` >definition to avoid conflict. Place source MAC address in both >`s_addr` and `S_un.S_addr` fields, so that access works either >directly or through the macro. It could be a patch in itself. > > 2. Provide some IPPROTO_* constants and IPVERSION, missing on Windows. I think it belongs to previous patch about extending the IP-related API. > --- a/drivers/net/i40e/i40e_fdir.c > +++ b/drivers/net/i40e/i40e_fdir.c > @@ -22,6 +22,7 @@ > #include > #include > #include > +#include Why is it needed? [...] > --- a/lib/librte_net/rte_ip.h > +++ b/lib/librte_net/rte_ip.h > @@ -17,11 +17,15 @@ > > #include > > +#ifdef RTE_EXEC_ENV_WINDOWS > +#include > +#else > #include > #include > #include > #include > #include > +#endif Should be in previous patch about extending IP API to any OS. > --- a/lib/librte_net/rte_net.c > +++ b/lib/librte_net/rte_net.c > @@ -15,6 +15,7 @@ > #include > #include > #include > +#include Why is it needed?
Re: [dpdk-dev] [PATCH v3] meson: remove unnecessary explicit link to libpcap
26/03/2021 09:22, Gabriel Ganne: > libpcap is already found and registered as a dependency by meson, and > the dependency is already correctly used in librte_port. This line is > just unnecessary. > > It also has the side effect of messing with the meson link line: dpdk > link will be declared twice: manually and then through pkg-config. If > you configure meson to prefer static linking over dynamic, this will > cause the build to fail on librte_port, since the pcap deps are not yet > seen by the linker. > > Signed-off-by: Gabriel Ganne When sending a new revision of a patch, please add a changelog below "---" and use --in-reply-to for threading, thanks. > --- > config/meson.build | 1 - > 1 file changed, 1 deletion(-)
Re: [dpdk-dev] [PATCH] telemetry: cleanup internal header
26/03/2021 09:24, David Marchand: > The experimental banner can be removed. > Every in-tree file is compiled with _GNU_SOURCE, so RTE_HAS_CPUSET is > unneeded for an internal header. > > Fixes: 0e64ae618e10 ("telemetry: move init function to internal header") > > Signed-off-by: David Marchand good catches, thank you Acked-by: Thomas Monjalon
[dpdk-dev] [PATCH] net/mlx5: fix using flow tunnel before null check
From: Yunjian Wang Coverity flags that 'ctx->tunnel' variable is used before it's checked for NULL. This patch fixes this issue. Coverity issue: 366201 Fixes: 868d2e342cf3 ("net/mlx5: fix tunnel offload hub multi-thread protection") Signed-off-by: Yunjian Wang --- drivers/net/mlx5/mlx5_flow.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index d46fc333d1..bb8d09cdef 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -7899,10 +7899,11 @@ static void get_tunnel_miss(struct rte_eth_dev *dev, void *x) rte_spinlock_unlock(&thub->sl); ctx->tunnel = mlx5_flow_tunnel_allocate(dev, ctx->app_tunnel); - ctx->tunnel->refctn = 1; rte_spinlock_lock(&thub->sl); - if (ctx->tunnel) + if (ctx->tunnel) { + ctx->tunnel->refctn = 1; LIST_INSERT_HEAD(&thub->tunnels, ctx->tunnel, chain); + } } -- 2.23.0
[dpdk-dev] [PATCH] net/sfc: fix error path inconsistency
At the fail label, there's a statement to set general errno and error message. However, before the label is reached, a custom error message can be set by the code which parses actions. This custom (action-specific) message, when present, must not be replaced by the general one. Fixes: 662286ae61d2 ("net/sfc: add actions parsing stub to MAE backend") Cc: sta...@dpdk.org Signed-off-by: Ivan Malov Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/net/sfc/sfc_mae.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c index 8afa09341..4dafe3dcd 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -2634,6 +2634,8 @@ sfc_mae_rule_parse_actions(struct sfc_adapter *sa, efx_mae_actions_t *spec; int rc; + rte_errno = 0; + if (actions == NULL) { return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION_NUM, NULL, @@ -2690,7 +2692,7 @@ sfc_mae_rule_parse_actions(struct sfc_adapter *sa, efx_mae_action_set_spec_fini(sa->nic, spec); fail_action_set_spec_init: - if (rc > 0) { + if (rc > 0 && rte_errno == 0) { rc = rte_flow_error_set(error, rc, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "Failed to process the action"); -- 2.20.1
Re: [dpdk-dev] [dpdk-dev v21.11] [PATCH v5 8/8] eventdev: simplify Rx adapter event vector config
>> -Original Message- >> From: Pavan Nikhilesh Bhagavatula >> Sent: Thursday, March 25, 2021 7:25 PM >> To: Jayatheerthan, Jay ; Jerin Jacob >Kollanukkaran ; Carrillo, Erik G >> ; Gujjar, Abhinandan S >; McDaniel, Timothy >> ; hemant.agra...@nxp.com; Van >Haaren, Harry ; mattias.ronnblom >> ; Ma, Liang J >; Ray Kinsella ; Neil Horman >> >> Cc: dev@dpdk.org >> Subject: RE: [dpdk-dev v21.11] [PATCH v5 8/8] eventdev: simplify Rx >adapter event vector config >> >> >> From: pbhagavat...@marvell.com >> >> Sent: Wednesday, March 24, 2021 10:35 AM >> >> To: jer...@marvell.com; Jayatheerthan, Jay >> >; Carrillo, Erik G >> >; Gujjar, >> >> Abhinandan S ; McDaniel, Timothy >> >; hemant.agra...@nxp.com; Van >> >> Haaren, Harry ; mattias.ronnblom >> >; Ma, Liang J >> >> ; Ray Kinsella ; Neil >Horman >> > >> >> Cc: dev@dpdk.org; Pavan Nikhilesh >> >> Subject: [dpdk-dev v21.11] [PATCH v5 8/8] eventdev: simplify Rx >> >adapter event vector config >> >> >> >> From: Pavan Nikhilesh >> >> >> >> Include vector configuration into the structure >> >> ``rte_event_eth_rx_adapter_queue_conf`` used when configuring >rest >> >> of the Rx adapter ethernet device Rx queue parameters. >> >> This simplifies event vector configuration as it avoids splitting >> >> configuration per Rx queue. >> >> >> >> Signed-off-by: Pavan Nikhilesh >> >> --- >> >> app/test-eventdev/test_pipeline_common.c | 16 +- >> >> lib/librte_eventdev/eventdev_pmd.h| 29 --- >> >> .../rte_event_eth_rx_adapter.c| 168 ++ >> >> .../rte_event_eth_rx_adapter.h| 27 --- >> >> lib/librte_eventdev/version.map | 1 - >> >> 5 files changed, 57 insertions(+), 184 deletions(-) >> >> >> >> diff --git a/app/test-eventdev/test_pipeline_common.c >b/app/test- >> >eventdev/test_pipeline_common.c >> >> index d5ef90500..76aee254b 100644 >> >> --- a/app/test-eventdev/test_pipeline_common.c >> >> +++ b/app/test-eventdev/test_pipeline_common.c >> >> @@ -331,7 +331,6 @@ pipeline_event_rx_adapter_setup(struct >> >evt_options *opt, uint8_t stride, >> >> uint16_t prod; >> >> struct rte_mempool *vector_pool = NULL; >> >> struct rte_event_eth_rx_adapter_queue_conf queue_conf; >> >> - struct rte_event_eth_rx_adapter_event_vector_config >> >vec_conf; >> >> >> >> memset(&queue_conf, 0, >> >> sizeof(struct >> >rte_event_eth_rx_adapter_queue_conf)); >> >> @@ -397,8 +396,12 @@ pipeline_event_rx_adapter_setup(struct >> >evt_options *opt, uint8_t stride, >> >> } >> >> >> >> if (cap & >> >RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR) { >> >> + queue_conf.vector_sz = opt- >> >>vector_size; >> >> + queue_conf.vector_timeout_ns = >> >> + opt->vector_tmo_nsec; >> >> queue_conf.rx_queue_flags |= >> >> >> >RTE_EVENT_ETH_RX_ADAPTER_QUEUE_EVENT_VECTOR; >> >> + queue_conf.vector_mp = vector_pool; >> >> } else { >> >> evt_err("Rx adapter doesn't support >> >event vector"); >> >> return -EINVAL; >> >> @@ -418,17 +421,6 @@ pipeline_event_rx_adapter_setup(struct >> >evt_options *opt, uint8_t stride, >> >> return ret; >> >> } >> >> >> >> - if (opt->ena_vector) { >> >> - vec_conf.vector_sz = opt->vector_size; >> >> - vec_conf.vector_timeout_ns = opt- >> >>vector_tmo_nsec; >> >> - vec_conf.vector_mp = vector_pool; >> >> - if >> >(rte_event_eth_rx_adapter_queue_event_vector_config( >> >> - prod, prod, -1, &vec_conf) < 0) { >> >> - evt_err("Failed to configure event >> >vectorization for Rx adapter"); >> >> - return -EINVAL; >> >> - } >> >> - } >> >> - >> >> if (!(cap & >> >RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT)) { >> >> uint32_t service_id = -1U; >> >> >> >> diff --git a/lib/librte_eventdev/eventdev_pmd.h >> >b/lib/librte_eventdev/eventdev_pmd.h >> >> index 0f724ac85..63b3bc4b5 100644 >> >> --- a/lib/librte_eventdev/eventdev_pmd.h >> >> +++ b/lib/librte_eventdev/eventdev_pmd.h >> >> @@ -667,32 +667,6 @@ typedef int >> >(*eventdev_eth_rx_adapter_vector_limits_get_t)( >> >> const struct rte_eventdev *dev, const struct rte_eth_dev >> >*eth_dev, >> >> struct rte_event_eth_rx_adapter_vector_limits *limits); >> >> >> >> -struct rte_event_eth_rx_adapter_event_vector_config; >> >> -/** >> >> - * Enable event vector on an given Rx queue of a ethernet devices >> >belonging to >> >> - * the Rx adapter. >> >> - * >> >> - * @param dev >> >> - * Event device pointer >> >> - * >> >> - * @param eth_dev >> >> - * Ethernet device pointer >> >> - * >> >> - * @param rx_queue_id >> >> - * The Rx queue identifier >> >> - * >> >> - * @param config
[dpdk-dev] [PATCH v1] net/octeontx2: support flow action port id
From: Smadar Fuks Action port_id was not supported until now. In this patch the action port_id supports passing from input port PF to output port which is one of input port respective VF Signed-off-by: Smadar Fuks --- doc/guides/nics/octeontx2.rst | 6 +++ drivers/net/octeontx2/otx2_ethdev.c | 6 +-- drivers/net/octeontx2/otx2_ethdev.h | 5 +++ drivers/net/octeontx2/otx2_ethdev_devargs.c | 2 +- drivers/net/octeontx2/otx2_flow_parse.c | 47 - 5 files changed, 61 insertions(+), 5 deletions(-) diff --git a/doc/guides/nics/octeontx2.rst b/doc/guides/nics/octeontx2.rst index cca7f7fc7..258c1693f 100644 --- a/doc/guides/nics/octeontx2.rst +++ b/doc/guides/nics/octeontx2.rst @@ -401,6 +401,12 @@ Actions: ++-+ | 11 | RTE_FLOW_ACTION_TYPE_OF_POP_VLAN| ++-+ + | 12 | RTE_FLOW_ACTION_TYPE_PORT_ID| + ++-+ + +.. note:: + + ``RTE_FLOW_ACTION_TYPE_PORT_ID`` is only supported between PF and its VFs. .. _table_octeontx2_supported_egress_action_types: diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c index 389b66d03..4f95917e7 100644 --- a/drivers/net/octeontx2/otx2_ethdev.c +++ b/drivers/net/octeontx2/otx2_ethdev.c @@ -2802,6 +2802,6 @@ static struct rte_pci_driver pci_nix = { .remove = nix_remove, }; -RTE_PMD_REGISTER_PCI(net_octeontx2, pci_nix); -RTE_PMD_REGISTER_PCI_TABLE(net_octeontx2, pci_nix_map); -RTE_PMD_REGISTER_KMOD_DEP(net_octeontx2, "vfio-pci"); +RTE_PMD_REGISTER_PCI(OCTEONTX2_PMD, pci_nix); +RTE_PMD_REGISTER_PCI_TABLE(OCTEONTX2_PMD, pci_nix_map); +RTE_PMD_REGISTER_KMOD_DEP(OCTEONTX2_PMD, "vfio-pci"); diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h index 99f0469d8..5a9dc9be0 100644 --- a/drivers/net/octeontx2/otx2_ethdev.h +++ b/drivers/net/octeontx2/otx2_ethdev.h @@ -164,6 +164,11 @@ /* Additional timesync values. */ #define OTX2_CYCLECOUNTER_MASK 0xULL +#define OCTEONTX2_PMD net_octeontx2 + +#define otx2_ethdev_is_same_driver(dev) \ + (strcmp((dev)->device->driver->name, RTE_STR(OCTEONTX2_PMD)) == 0) + enum nix_q_size_e { nix_q_size_16, /* 16 entries */ nix_q_size_64, /* 64 entries */ diff --git a/drivers/net/octeontx2/otx2_ethdev_devargs.c b/drivers/net/octeontx2/otx2_ethdev_devargs.c index 8d9feb3a8..83f905315 100644 --- a/drivers/net/octeontx2/otx2_ethdev_devargs.c +++ b/drivers/net/octeontx2/otx2_ethdev_devargs.c @@ -201,7 +201,7 @@ otx2_ethdev_parse_devargs(struct rte_devargs *devargs, struct otx2_eth_dev *dev) return -EINVAL; } -RTE_PMD_REGISTER_PARAM_STRING(net_octeontx2, +RTE_PMD_REGISTER_PARAM_STRING(OCTEONTX2_PMD, OTX2_RSS_RETA_SIZE "=<64|128|256>" OTX2_IPSEC_IN_MAX_SPI "=<1-65535>" OTX2_SCL_ENABLE "=1" diff --git a/drivers/net/octeontx2/otx2_flow_parse.c b/drivers/net/octeontx2/otx2_flow_parse.c index bbb845811..63a33142a 100644 --- a/drivers/net/octeontx2/otx2_flow_parse.c +++ b/drivers/net/octeontx2/otx2_flow_parse.c @@ -900,14 +900,17 @@ otx2_flow_parse_actions(struct rte_eth_dev *dev, { struct otx2_eth_dev *hw = dev->data->dev_private; struct otx2_npc_flow_info *npc = &hw->npc_flow; + const struct rte_flow_action_port_id *port_act; const struct rte_flow_action_count *act_count; const struct rte_flow_action_mark *act_mark; const struct rte_flow_action_queue *act_q; const struct rte_flow_action_vf *vf_act; + uint16_t pf_func, vf_id, port_id, pf_id; + char if_name[RTE_ETH_NAME_MAX_LEN]; bool vlan_insert_action = false; + struct rte_eth_dev *eth_dev; const char *errmsg = NULL; int sel_act, req_act = 0; - uint16_t pf_func, vf_id; int errcode = 0; int mark = 0; int rq = 0; @@ -983,6 +986,48 @@ otx2_flow_parse_actions(struct rte_eth_dev *dev, } break; + case RTE_FLOW_ACTION_TYPE_PORT_ID: + port_act = (const struct rte_flow_action_port_id *) + actions->conf; + port_id = port_act->id; + if (rte_eth_dev_get_name_by_port(port_id, if_name)) { + errmsg = "Name not found for output port id"; + errcode = EINVAL; + goto err_exit; + } + eth_dev = rte_eth_dev_allocated(if_name); + if (!eth_dev) { + errmsg = "eth_dev not found for output port id"; + errcode = EINVAL; + goto err_exit; +
Re: [dpdk-dev] [PATCH] doc: fix formatting in testpmd user guide
On 3/9/2021 10:00 PM, Ajit Khaparde wrote: On Tue, Mar 9, 2021 at 4:52 AM Ferruh Yigit wrote: On 3/8/2021 10:34 PM, Ajit Khaparde wrote: Fix formatting in testpmd user guide for hairpin operation. Fixes: 01817b10d27c ("app/testpmd: change hairpin queues setup") Cc:sta...@dpdk.org Signed-off-by: Ajit Khaparde Cc: Bing Zhao Cc: Ori Kam --- doc/guides/testpmd_app_ug/run_app.rst | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst index 3035118cdc..8ec2300ee5 100644 --- a/doc/guides/testpmd_app_ug/run_app.rst +++ b/doc/guides/testpmd_app_ug/run_app.rst @@ -531,11 +531,13 @@ The command line options are: * ``--hairpin-mode=0xXX`` -Set the hairpin port mode with bitmask, only valid when hairpin queues number is set. -bit 4 - explicit Tx flow rule -bit 1 - two hairpin ports paired -bit 0 - two hairpin ports loop -The default value is 0. Hairpin will use single port mode and implicit Tx flow mode. +Set the hairpin port mode with bitmask, only valid when hairpin queues number is set:: + + bit 4 - explicit Tx flow rule + bit 1 - two hairpin ports paired + bit 0 - two hairpin ports loop + The default value is 0. + Hairpin will use single port mode and implicit Tx flow mode. Not sure if the last line intended to be part of the list, what do you think only keep bit descriptions in the box but left the last sentences as regular paragraph. Ori please correct me if I am wrong with the original intention. Ori, Not just indentation. How about this modified text as well? - bit 0 - two hairpin ports loop - The default value is 0. - Hairpin will use single port mode and implicit Tx flow mode. + bit 0 - two hairpin ports loop (default) + +.. Note:: + + When hairpin is used in single port mode, Tx flow rule will be implicit. Does this statement look right? Ping
Re: [dpdk-dev] [dpdk-stable] [PATCH v2 1/1] net/hinic: fix coredump when in secondary process
On 3/23/2021 1:17 PM, Guoyang Zhou wrote: Some apps, such as fstack, will use secondary process to access the memory of eth_dev_ops, and they want to get the info of dev, but hinic driver does not initialized it when in secondary process. Fixes: 66f64dd6dc86 ("net/hinic: fix secondary process") Cc: sta...@dpdk.org Signed-off-by: Guoyang Zhou Some comments from previous versions seems outstanding, can you please check/comment on them please: http://inbox.dpdk.org/dev/c3ceb0c3-4d35-c14e-ea6b-cd4b31165...@intel.com/ Also can you please send a new version as reply to previous version? This keeps different versions in same email thread and helps to find the comments/discussing to previous versions easier. You can do this via "git send-email", '--in-reply-to' argument.
Re: [dpdk-dev] [PATCH] telemetry: cleanup internal header
On Fri, Mar 26, 2021 at 10:32:03AM +0100, Thomas Monjalon wrote: > 26/03/2021 09:24, David Marchand: > > The experimental banner can be removed. > > Every in-tree file is compiled with _GNU_SOURCE, so RTE_HAS_CPUSET is > > unneeded for an internal header. > > > > Fixes: 0e64ae618e10 ("telemetry: move init function to internal header") > > > > Signed-off-by: David Marchand > > good catches, thank you > > Acked-by: Thomas Monjalon > +1 thanks. Acked-by: Bruce Richardson
[dpdk-dev] [PATCH 0/2] Fix unit tests execution for ENA PMD
Hi, ENA PMD uses timer service to implement various periodic device status check routine. Because of that, it already initializes the timer subsystem. As unit tests also initalizes the timer subsystem, return value is equal to -EAGAIN, as it was already done by the ENA PMD. This patch set adds missing documentation that this kind of return code may appear and this is not a failure and also changes unit tests tool, to do not fail if timer subsystem was already initialized. Stanislaw Kardach (2): timer: clarify subsystem_init return value test: proceed if timer subsystem was initialized app/test/test.c | 11 ++- lib/librte_timer/rte_timer.h | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) -- 2.25.1
[dpdk-dev] [PATCH 1/2] timer: clarify subsystem_init return value
From: Stanislaw Kardach rte_timer_subsystem_init() may return -EALREADY if it has been already initialized. Therefore put explicitly into doxygen that this is not a failure for the application. Signed-off-by: Stanislaw Kardach Reviewed-by: Michal Krawczyk --- lib/librte_timer/rte_timer.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_timer/rte_timer.h b/lib/librte_timer/rte_timer.h index 22a27aa08d..0f820555c0 100644 --- a/lib/librte_timer/rte_timer.h +++ b/lib/librte_timer/rte_timer.h @@ -171,6 +171,7 @@ int rte_timer_data_dealloc(uint32_t id); * - 0: Success * - -ENOMEM: Unable to allocate memory needed to initialize timer * subsystem + * - -EALREADY: timer subsystem was already initialized. Not an error. */ int rte_timer_subsystem_init(void); -- 2.25.1
[dpdk-dev] [PATCH 2/2] test: proceed if timer subsystem was initialized
From: Stanislaw Kardach rte_timer_subsystem_init() may return -EALREADY if the timer subsystem was already initialized. This can happen i.e. in PMD code (see eth_ena_dev_init). This is not an error, rather a notification as the initialization function simply returns without any action taken. Signed-off-by: Stanislaw Kardach Reviewed-by: Michal Krawczyk --- app/test/test.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/test/test.c b/app/test/test.c index 624dd48042..864523ed61 100644 --- a/app/test/test.c +++ b/app/test/test.c @@ -134,8 +134,13 @@ main(int argc, char **argv) goto out; } + argv += ret; + + prgname = argv[0]; + #ifdef RTE_LIB_TIMER - if (rte_timer_subsystem_init() < 0) { + ret = rte_timer_subsystem_init(); + if (ret < 0 && ret != -EALREADY) { ret = -1; goto out; } @@ -146,10 +151,6 @@ main(int argc, char **argv) goto out; } - argv += ret; - - prgname = argv[0]; - recursive_call = getenv(RECURSIVE_ENV_VAR); if (recursive_call != NULL) { ret = do_recursive_call(); -- 2.25.1
Re: [dpdk-dev] [PATCH 1/7] common/octeontx: enable build only on 64bit Linux
On Thu, Mar 25, 2021 at 6:32 PM Kinsella, Ray wrote: > > > > On 25/03/2021 12:58, Jerin Jacob wrote: > > On Thu, Mar 25, 2021 at 6:17 PM Kinsella, Ray wrote: > >> > >> > >> > >> On 25/03/2021 12:46, Jerin Jacob wrote: > >>> On Thu, Mar 25, 2021 at 4:33 PM Thomas Monjalon > >>> wrote: > > 25/03/2021 11:58, Kinsella, Ray: > > On 25/03/2021 10:46, Thomas Monjalon wrote: > >> 25/03/2021 11:42, Thomas Monjalon: > >>> 24/03/2021 11:55, Jerin Jacob: > On Thu, Feb 25, 2021 at 10:33 PM wrote: > > > > From: Pavan Nikhilesh > > > > Due to Linux kernel dependency, only enable build for 64bit Linux. > > > > Signed-off-by: Pavan Nikhilesh > > Series Acked-by: Jerin Jacob > >>> > >>> I've reorganized the commits per family of drivers, > >>> so it makes more sense than grouping per driver class > >>> with "common/octeontx" for title for all: > >>> > >>> net/thunderx: enable build only on 64-bit Linux > >>> common/octeontx: enable build only on 64-bit Linux > >>> common/octeontx2: enable build only on 64-bit Linux > >>> > >>> and applied. > >> > >> Actually not applied yet. > >> I'm not sure what to do for the ABI check which is broken > >> because some drivers are not compiled anymore in 32-bit build. > >> I've workarounded locally by removing the dump files in the reference > >> build. > >> Should we add an exception in libabigail.abignore? > >> > > In the past we said that depreciating HW support would be considered to > > be same as an ABI Breakage. > > > > From the policy ... > > "Updates to the minimum hardware requirements, which drop support for > > hardware which was previously supported, should be treated as an ABI > > change." > > So the patches should wait 21.11. > Everybody agree? > >>> > >>> Looks good to me to postpone. > >>> > >>> @Ray Kinsella @Thomas Monjalon @McDaniel, Timothy @David Marchand @Neil > >>> Horman > >>> > >>> Currently, I merged DLB v1 driver removal patch to next-eventdev. Is > >>> this ABI breakge[1]? > >>> > >>> http://patches.dpdk.org/project/dpdk/patch/20210316210812.15614-1-timothy.mcdan...@intel.com/ > >>> > >>> [1] > >>> From the policy ... > >>> "Updates to the minimum hardware requirements, which drop support for > >>> hardware which was previously supported, should be treated as an ABI > >>> change." > >> > >> +1 > > > > Is +1 for not to remove the dlb driver or remove it? > > > > You'll note the original reply pointing at the ABI Policy was from myself. > So I would be in favor of retention until 21.11. > > Thats said... > > We should think about making the rules less strict for 32bit in future, from > 21.11 onwards perhaps. > How many OS Vendors are shipping 32bit OSs these days for example? Agree on 32bit. The DLB driver removal patch from @McDaniel, Timothy http://patches.dpdk.org/project/dpdk/patch/20210316210812.15614-1-timothy.mcdan...@intel.com/ is deleting the complete driver. So it does not look like it is updating the minimum HW requirements as mentioned in the policy. So IMO, it is OK to accept his patch for 21.05(ie. remove the driver). Let me know if there is any objection on this?
Re: [dpdk-dev] [PATCH 01/25] event/dlb2: add dlb v2.5 probe
On Thu, Mar 25, 2021 at 1:01 AM McDaniel, Timothy wrote: > > > > > -Original Message- > > From: Jerin Jacob > > Sent: Sunday, March 21, 2021 4:48 AM > > To: McDaniel, Timothy > > Cc: dpdk-dev ; Jerin Jacob ; Van Haaren, > > Harry ; Ray Kinsella ; Neil > > Horman ; Rao, Nikhil ; > > Carrillo, Erik G ; Gujjar, Abhinandan S > > ; Pavan Nikhilesh > > ; Hemant Agrawal ; > > mattias.ronnblom ; Mccarthy, Peter > > > > Subject: Re: [dpdk-dev] [PATCH 01/25] event/dlb2: add dlb v2.5 probe > > > > On Wed, Mar 17, 2021 at 3:49 AM Timothy McDaniel > > wrote: > > > > > > This commit adds dlb v2.5 probe support, and updates > > > parameter parsing. > > > > > > The dlb v2.5 device differs from dlb v2, in that the > > > number of resources (ports, queues, ...) is different, > > > so macros have been added to take the device version > > > into account. > > > > > > This commit also cleans up a few issues in the original > > > dlb2 source: > > > - eliminate duplicate constant definitions > > > - removed unused constant definitions > > > > > > Signed-off-by: Timothy McDaniel > > > --- > > > > > > > > -#define EVDEV_DLB2_NAME_PMD dlb2_event > > > +#define EVDEV_DLB2_NAME_PMD dlb_event > > > > Is this an intended change? why change the driver's name. > > Yes, This is an intentional change. We will be using the same driver name > going forward, regardless of the hardware version. > Internally, we know which version of the hardware is present. Since the driver name is still driver/event/dlb2. Keep it as same prefix scheme with other drivers. > > Thanks, > Tim >
[dpdk-dev] [PATCH v2 1/7] net/qede: remove flags from Tx entry
Each sw_tx_ring entry was of type struct qede_tx_entry: struct qede_tx_entry { struct rte_mbuf *mbuf; uint8_t flags; }; Leaving the unused flags member here has a few performance implications. First, each qede_tx_entry takes up more memory which has caching implications as less entries fit in a cache line while multiple entries are frequently handled in batches. Second, an array of qede_tx_entry entries is incompatible with existing APIs that expect an array of rte_mbuf pointers. Consequently, an extra array need to be allocated before calling such APIs and each entry needs to be copied over. This patch omits the flags field and replaces the qede_tx_entry entry by a simple rte_mbuf pointer. Signed-off-by: Balazs Nemeth Reviewed-by: Igor Russkikh --- drivers/net/qede/qede_rxtx.c | 22 -- drivers/net/qede/qede_rxtx.h | 10 +- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 87f52d725..d2f77ed2e 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -393,6 +393,7 @@ qede_alloc_tx_queue_mem(struct rte_eth_dev *dev, struct ecore_dev *edev = &qdev->edev; struct qede_tx_queue *txq; int rc; + size_t sw_tx_ring_size; txq = rte_zmalloc_socket("qede_tx_queue", sizeof(struct qede_tx_queue), RTE_CACHE_LINE_SIZE, socket_id); @@ -425,9 +426,9 @@ qede_alloc_tx_queue_mem(struct rte_eth_dev *dev, } /* Allocate software ring */ + sw_tx_ring_size = sizeof(txq->sw_tx_ring) * txq->nb_tx_desc; txq->sw_tx_ring = rte_zmalloc_socket("txq->sw_tx_ring", -(sizeof(struct qede_tx_entry) * - txq->nb_tx_desc), +sw_tx_ring_size, RTE_CACHE_LINE_SIZE, socket_id); if (!txq->sw_tx_ring) { @@ -523,9 +524,9 @@ static void qede_tx_queue_release_mbufs(struct qede_tx_queue *txq) if (txq->sw_tx_ring) { for (i = 0; i < txq->nb_tx_desc; i++) { - if (txq->sw_tx_ring[i].mbuf) { - rte_pktmbuf_free(txq->sw_tx_ring[i].mbuf); - txq->sw_tx_ring[i].mbuf = NULL; + if (txq->sw_tx_ring[i]) { + rte_pktmbuf_free(txq->sw_tx_ring[i]); + txq->sw_tx_ring[i] = NULL; } } } @@ -889,10 +890,11 @@ qede_free_tx_pkt(struct qede_tx_queue *txq) uint16_t idx; idx = TX_CONS(txq); - mbuf = txq->sw_tx_ring[idx].mbuf; + mbuf = txq->sw_tx_ring[idx]; if (mbuf) { nb_segs = mbuf->nb_segs; PMD_TX_LOG(DEBUG, txq, "nb_segs to free %u\n", nb_segs); + while (nb_segs) { /* It's like consuming rxbuf in recv() */ ecore_chain_consume(&txq->tx_pbl); @@ -900,7 +902,7 @@ qede_free_tx_pkt(struct qede_tx_queue *txq) nb_segs--; } rte_pktmbuf_free(mbuf); - txq->sw_tx_ring[idx].mbuf = NULL; + txq->sw_tx_ring[idx] = NULL; txq->sw_tx_cons++; PMD_TX_LOG(DEBUG, txq, "Freed tx packet\n"); } else { @@ -2243,7 +2245,7 @@ qede_xmit_pkts_regular(void *p_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) struct eth_tx_3rd_bd *bd3; struct rte_mbuf *m_seg = NULL; struct rte_mbuf *mbuf; - struct qede_tx_entry *sw_tx_ring; + struct rte_mbuf **sw_tx_ring; uint16_t nb_tx_pkts; uint16_t bd_prod; uint16_t idx; @@ -2306,7 +2308,7 @@ qede_xmit_pkts_regular(void *p_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) /* Fill the entry in the SW ring and the BDs in the FW ring */ idx = TX_PROD(txq); - sw_tx_ring[idx].mbuf = mbuf; + sw_tx_ring[idx] = mbuf; /* BD1 */ bd1 = (struct eth_tx_1st_bd *)ecore_chain_produce(&txq->tx_pbl); @@ -2612,7 +2614,7 @@ qede_xmit_pkts(void *p_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) /* Fill the entry in the SW ring and the BDs in the FW ring */ idx = TX_PROD(txq); - txq->sw_tx_ring[idx].mbuf = mbuf; + txq->sw_tx_ring[idx] = mbuf; /* BD1 */ bd1 = (struct eth_tx_1st_bd *)ecore_chain_produce(&txq->tx_pbl); diff --git a/drivers/net/qede/qede_rxtx.h b/drivers/net/qede/qede_rxtx.h index fcb564a1b..335016847 100644 --- a/drivers/net/qede/qede_rxtx.h +++ b/drivers/net/qede/qede_rxtx.h @@ -203,14 +203,6 @@ struct qede_rx_queue { void *handle; }; -/* - * TX BD descriptor ring - */ -struct qede_tx_entry { -
[dpdk-dev] [PATCH v2 0/7] Optimize qede use of Rx/Tx entries
This patch set optimizes qede_{rx,tx}_entry and introduces rte_pktmbuf_free_bulk in qede_process_tx_compl. The overall performance improvement depends on the use-case; in a physical-virtual-physical test on a ThunderX2 99xx system with two SMT threads used in ovs, and two cores used in a vm, an improvement of around 2.55% is observed due to this patch set. Changes in v2: - Fix checkpatches.sh warnings - Fix check-git-log.sh warnings - Add Reviewed-by: Igor Russkikh Balazs Nemeth (7): net/qede: remove flags from Tx entry net/qede: get consumer index once net/qede: assume mbuf to free is never null net/qede: free packets in bulk instead of one by one net/qede: prefetch hardware consumer net/qede: prefetch next packet to free net/qede: remove unnecessary field in Rx entry and simplify drivers/net/qede/qede_rxtx.c | 154 +++ drivers/net/qede/qede_rxtx.h | 21 + 2 files changed, 87 insertions(+), 88 deletions(-) -- 2.30.2
[dpdk-dev] [PATCH v2 2/7] net/qede: get consumer index once
Calling ecore_chain_get_cons_idx repeatedly is slower than calling it once and using the result for the remainder of qede_process_tx_compl. Signed-off-by: Balazs Nemeth Reviewed-by: Igor Russkikh --- drivers/net/qede/qede_rxtx.c | 22 ++ 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index d2f77ed2e..0002e2c1e 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -882,12 +882,13 @@ qede_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id) return rc; } -static inline void +static inline uint16_t qede_free_tx_pkt(struct qede_tx_queue *txq) { struct rte_mbuf *mbuf; uint16_t nb_segs; uint16_t idx; + uint16_t ret; idx = TX_CONS(txq); mbuf = txq->sw_tx_ring[idx]; @@ -895,20 +896,22 @@ qede_free_tx_pkt(struct qede_tx_queue *txq) nb_segs = mbuf->nb_segs; PMD_TX_LOG(DEBUG, txq, "nb_segs to free %u\n", nb_segs); + ret = nb_segs; while (nb_segs) { /* It's like consuming rxbuf in recv() */ ecore_chain_consume(&txq->tx_pbl); - txq->nb_tx_avail++; nb_segs--; } + rte_pktmbuf_free(mbuf); txq->sw_tx_ring[idx] = NULL; txq->sw_tx_cons++; PMD_TX_LOG(DEBUG, txq, "Freed tx packet\n"); } else { ecore_chain_consume(&txq->tx_pbl); - txq->nb_tx_avail++; + ret = 1; } + return ret; } static inline void @@ -916,19 +919,22 @@ qede_process_tx_compl(__rte_unused struct ecore_dev *edev, struct qede_tx_queue *txq) { uint16_t hw_bd_cons; -#ifdef RTE_LIBRTE_QEDE_DEBUG_TX uint16_t sw_tx_cons; -#endif + uint16_t remaining; rte_compiler_barrier(); + sw_tx_cons = ecore_chain_get_cons_idx(&txq->tx_pbl); hw_bd_cons = rte_le_to_cpu_16(*txq->hw_cons_ptr); #ifdef RTE_LIBRTE_QEDE_DEBUG_TX - sw_tx_cons = ecore_chain_get_cons_idx(&txq->tx_pbl); PMD_TX_LOG(DEBUG, txq, "Tx Completions = %u\n", abs(hw_bd_cons - sw_tx_cons)); #endif - while (hw_bd_cons != ecore_chain_get_cons_idx(&txq->tx_pbl)) - qede_free_tx_pkt(txq); + + remaining = hw_bd_cons - sw_tx_cons; + txq->nb_tx_avail += remaining; + + while (remaining) + remaining -= qede_free_tx_pkt(txq); } static int qede_drain_txq(struct qede_dev *qdev, -- 2.30.2
[dpdk-dev] [PATCH v2 3/7] net/qede: assume mbuf to free is never null
The ring txq->sw_tx_ring is managed with txq->sw_tx_cons. As long as txq->sw_tx_cons is correct, there is no need to check if txq->sw_tx_ring[idx] is null explicitly. Signed-off-by: Balazs Nemeth Reviewed-by: Igor Russkikh --- drivers/net/qede/qede_rxtx.c | 59 +++- 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 0002e2c1e..9294f79eb 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -882,38 +882,6 @@ qede_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id) return rc; } -static inline uint16_t -qede_free_tx_pkt(struct qede_tx_queue *txq) -{ - struct rte_mbuf *mbuf; - uint16_t nb_segs; - uint16_t idx; - uint16_t ret; - - idx = TX_CONS(txq); - mbuf = txq->sw_tx_ring[idx]; - if (mbuf) { - nb_segs = mbuf->nb_segs; - PMD_TX_LOG(DEBUG, txq, "nb_segs to free %u\n", nb_segs); - - ret = nb_segs; - while (nb_segs) { - /* It's like consuming rxbuf in recv() */ - ecore_chain_consume(&txq->tx_pbl); - nb_segs--; - } - - rte_pktmbuf_free(mbuf); - txq->sw_tx_ring[idx] = NULL; - txq->sw_tx_cons++; - PMD_TX_LOG(DEBUG, txq, "Freed tx packet\n"); - } else { - ecore_chain_consume(&txq->tx_pbl); - ret = 1; - } - return ret; -} - static inline void qede_process_tx_compl(__rte_unused struct ecore_dev *edev, struct qede_tx_queue *txq) @@ -921,6 +889,10 @@ qede_process_tx_compl(__rte_unused struct ecore_dev *edev, uint16_t hw_bd_cons; uint16_t sw_tx_cons; uint16_t remaining; + uint16_t mask; + struct rte_mbuf *mbuf; + uint16_t nb_segs; + uint16_t idx; rte_compiler_barrier(); sw_tx_cons = ecore_chain_get_cons_idx(&txq->tx_pbl); @@ -930,11 +902,30 @@ qede_process_tx_compl(__rte_unused struct ecore_dev *edev, abs(hw_bd_cons - sw_tx_cons)); #endif + mask = NUM_TX_BDS(txq); + idx = txq->sw_tx_cons & mask; + remaining = hw_bd_cons - sw_tx_cons; txq->nb_tx_avail += remaining; - while (remaining) - remaining -= qede_free_tx_pkt(txq); + while (remaining) { + mbuf = txq->sw_tx_ring[idx]; + RTE_ASSERT(mbuf); + nb_segs = mbuf->nb_segs; + remaining -= nb_segs; + + PMD_TX_LOG(DEBUG, txq, "nb_segs to free %u\n", nb_segs); + + while (nb_segs) { + ecore_chain_consume(&txq->tx_pbl); + nb_segs--; + } + + rte_pktmbuf_free(mbuf); + idx = (idx + 1) & mask; + PMD_TX_LOG(DEBUG, txq, "Freed tx packet\n"); + } + txq->sw_tx_cons = idx; } static int qede_drain_txq(struct qede_dev *qdev, -- 2.30.2
[dpdk-dev] [PATCH v2 4/7] net/qede: free packets in bulk instead of one by one
rte_pktmbuf_free_bulk calls rte_mempool_put_bulk with the number of pending packets to return to the mempool. In contrast, rte_pktmbuf_free calls rte_mempool_put that calls rte_mempool_put_bulk with one object. An important performance related downside of adding one packet at a time to the mempool is that on each call, the per-core cache pointer needs to be read from tls while a single rte_mempool_put_bulk only reads from the tls once. Signed-off-by: Balazs Nemeth Reviewed-by: Igor Russkikh --- drivers/net/qede/qede_rxtx.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 9294f79eb..f439ee056 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -893,6 +893,7 @@ qede_process_tx_compl(__rte_unused struct ecore_dev *edev, struct rte_mbuf *mbuf; uint16_t nb_segs; uint16_t idx; + uint16_t first_idx; rte_compiler_barrier(); sw_tx_cons = ecore_chain_get_cons_idx(&txq->tx_pbl); @@ -907,6 +908,7 @@ qede_process_tx_compl(__rte_unused struct ecore_dev *edev, remaining = hw_bd_cons - sw_tx_cons; txq->nb_tx_avail += remaining; + first_idx = idx; while (remaining) { mbuf = txq->sw_tx_ring[idx]; @@ -921,11 +923,19 @@ qede_process_tx_compl(__rte_unused struct ecore_dev *edev, nb_segs--; } - rte_pktmbuf_free(mbuf); idx = (idx + 1) & mask; PMD_TX_LOG(DEBUG, txq, "Freed tx packet\n"); } txq->sw_tx_cons = idx; + + if (first_idx > idx) { + rte_pktmbuf_free_bulk(&txq->sw_tx_ring[first_idx], + mask - first_idx + 1); + rte_pktmbuf_free_bulk(&txq->sw_tx_ring[0], idx); + } else { + rte_pktmbuf_free_bulk(&txq->sw_tx_ring[first_idx], + idx - first_idx); + } } static int qede_drain_txq(struct qede_dev *qdev, -- 2.30.2
[dpdk-dev] [PATCH v2 5/7] net/qede: prefetch hardware consumer
Ensure that, while ecore_chain_get_cons_idx is running, txq->hw_cons_ptr is prefetched. This shows a slight performance improvement. Signed-off-by: Balazs Nemeth Reviewed-by: Igor Russkikh --- drivers/net/qede/qede_rxtx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index f439ee056..4f58abfbf 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -896,6 +896,7 @@ qede_process_tx_compl(__rte_unused struct ecore_dev *edev, uint16_t first_idx; rte_compiler_barrier(); + rte_prefetch0(txq->hw_cons_ptr); sw_tx_cons = ecore_chain_get_cons_idx(&txq->tx_pbl); hw_bd_cons = rte_le_to_cpu_16(*txq->hw_cons_ptr); #ifdef RTE_LIBRTE_QEDE_DEBUG_TX -- 2.30.2
[dpdk-dev] [PATCH v2 6/7] net/qede: prefetch next packet to free
While handling the current mbuf, pull the next mbuf into the cache. Note that the last four mbufs pulled into the cache are not handled, but that doesn't matter. Signed-off-by: Balazs Nemeth Reviewed-by: Igor Russkikh --- drivers/net/qede/qede_rxtx.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 4f58abfbf..ed3617160 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -917,6 +917,12 @@ qede_process_tx_compl(__rte_unused struct ecore_dev *edev, nb_segs = mbuf->nb_segs; remaining -= nb_segs; + /* Prefetch the next mbuf. Note that at least the last 4 mbufs +* that are prefetched will not be used in the current call. +*/ + rte_mbuf_prefetch_part1(txq->sw_tx_ring[(idx + 4) & mask]); + rte_mbuf_prefetch_part2(txq->sw_tx_ring[(idx + 4) & mask]); + PMD_TX_LOG(DEBUG, txq, "nb_segs to free %u\n", nb_segs); while (nb_segs) { -- 2.30.2
[dpdk-dev] [PATCH v2 7/7] net/qede: remove unnecessary field in Rx entry and simplify
The member page_offset is always zero. Having this in the qede_rx_entry makes it larger than it needs to be and this has cache performance implications so remove that field. In addition, since qede_rx_entry only has an rte_mbuf*, remove the definition of qede_rx_entry. Signed-off-by: Balazs Nemeth Reviewed-by: Igor Russkikh --- drivers/net/qede/qede_rxtx.c | 56 ++-- drivers/net/qede/qede_rxtx.h | 11 +-- 2 files changed, 29 insertions(+), 38 deletions(-) diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index ed3617160..298f4e3e4 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -24,8 +24,7 @@ static inline int qede_alloc_rx_buffer(struct qede_rx_queue *rxq) rte_mempool_in_use_count(rxq->mb_pool)); return -ENOMEM; } - rxq->sw_rx_ring[idx].mbuf = new_mb; - rxq->sw_rx_ring[idx].page_offset = 0; + rxq->sw_rx_ring[idx] = new_mb; mapping = rte_mbuf_data_iova_default(new_mb); /* Advance PROD and get BD pointer */ rx_bd = (struct eth_rx_bd *)ecore_chain_produce(&rxq->rx_bd_ring); @@ -39,17 +38,24 @@ static inline int qede_alloc_rx_buffer(struct qede_rx_queue *rxq) static inline int qede_alloc_rx_bulk_mbufs(struct qede_rx_queue *rxq, int count) { - void *obj_p[QEDE_MAX_BULK_ALLOC_COUNT] __rte_cache_aligned; struct rte_mbuf *mbuf = NULL; struct eth_rx_bd *rx_bd; dma_addr_t mapping; int i, ret = 0; uint16_t idx; + uint16_t mask = NUM_RX_BDS(rxq); if (count > QEDE_MAX_BULK_ALLOC_COUNT) count = QEDE_MAX_BULK_ALLOC_COUNT; - ret = rte_mempool_get_bulk(rxq->mb_pool, obj_p, count); + idx = rxq->sw_rx_prod & NUM_RX_BDS(rxq); + + if (count > mask - idx + 1) + count = mask - idx + 1; + + ret = rte_mempool_get_bulk(rxq->mb_pool, (void **)&rxq->sw_rx_ring[idx], + count); + if (unlikely(ret)) { PMD_RX_LOG(ERR, rxq, "Failed to allocate %d rx buffers " @@ -63,20 +69,17 @@ static inline int qede_alloc_rx_bulk_mbufs(struct qede_rx_queue *rxq, int count) } for (i = 0; i < count; i++) { - mbuf = obj_p[i]; - if (likely(i < count - 1)) - rte_prefetch0(obj_p[i + 1]); + rte_prefetch0(rxq->sw_rx_ring[(idx + 1) & NUM_RX_BDS(rxq)]); + mbuf = rxq->sw_rx_ring[idx & NUM_RX_BDS(rxq)]; - idx = rxq->sw_rx_prod & NUM_RX_BDS(rxq); - rxq->sw_rx_ring[idx].mbuf = mbuf; - rxq->sw_rx_ring[idx].page_offset = 0; mapping = rte_mbuf_data_iova_default(mbuf); rx_bd = (struct eth_rx_bd *) ecore_chain_produce(&rxq->rx_bd_ring); rx_bd->addr.hi = rte_cpu_to_le_32(U64_HI(mapping)); rx_bd->addr.lo = rte_cpu_to_le_32(U64_LO(mapping)); - rxq->sw_rx_prod++; + idx++; } + rxq->sw_rx_prod = idx; return 0; } @@ -309,9 +312,9 @@ static void qede_rx_queue_release_mbufs(struct qede_rx_queue *rxq) if (rxq->sw_rx_ring) { for (i = 0; i < rxq->nb_rx_desc; i++) { - if (rxq->sw_rx_ring[i].mbuf) { - rte_pktmbuf_free(rxq->sw_rx_ring[i].mbuf); - rxq->sw_rx_ring[i].mbuf = NULL; + if (rxq->sw_rx_ring[i]) { + rte_pktmbuf_free(rxq->sw_rx_ring[i]); + rxq->sw_rx_ring[i] = NULL; } } } @@ -1318,18 +1321,15 @@ static inline void qede_rx_bd_ring_consume(struct qede_rx_queue *rxq) static inline void qede_reuse_page(__rte_unused struct qede_dev *qdev, - struct qede_rx_queue *rxq, struct qede_rx_entry *curr_cons) + struct qede_rx_queue *rxq, struct rte_mbuf *curr_cons) { struct eth_rx_bd *rx_bd_prod = ecore_chain_produce(&rxq->rx_bd_ring); uint16_t idx = rxq->sw_rx_prod & NUM_RX_BDS(rxq); - struct qede_rx_entry *curr_prod; dma_addr_t new_mapping; - curr_prod = &rxq->sw_rx_ring[idx]; - *curr_prod = *curr_cons; + rxq->sw_rx_ring[idx] = curr_cons; - new_mapping = rte_mbuf_data_iova_default(curr_prod->mbuf) + - curr_prod->page_offset; + new_mapping = rte_mbuf_data_iova_default(curr_cons); rx_bd_prod->addr.hi = rte_cpu_to_le_32(U64_HI(new_mapping)); rx_bd_prod->addr.lo = rte_cpu_to_le_32(U64_LO(new_mapping)); @@ -1341,10 +1341,10 @@ static inline void qede_recycle_rx_bd_ring(struct qede_rx_queue *rxq, struct qede_dev *qdev, uint8_t count) { - struct qede_rx_entry *curr_cons; + struct rte_mbuf *curr_cons; for (; count > 0
Re: [dpdk-dev] [PATCH] telemetry: cleanup internal header
>-Original Message- >From: Richardson, Bruce >Sent: Friday 26 March 2021 10:32 >To: Thomas Monjalon >Cc: David Marchand ; dev@dpdk.org; Power, >Ciara >Subject: Re: [dpdk-dev] [PATCH] telemetry: cleanup internal header > >On Fri, Mar 26, 2021 at 10:32:03AM +0100, Thomas Monjalon wrote: >> 26/03/2021 09:24, David Marchand: >> > The experimental banner can be removed. >> > Every in-tree file is compiled with _GNU_SOURCE, so RTE_HAS_CPUSET >> > is unneeded for an internal header. >> > >> > Fixes: 0e64ae618e10 ("telemetry: move init function to internal >> > header") >> > >> > Signed-off-by: David Marchand >> >> good catches, thank you >> >> Acked-by: Thomas Monjalon >> >+1 thanks. >Acked-by: Bruce Richardson Thanks David, Acked-by: Ciara Power
Re: [dpdk-dev] [PATCH v2 1/3] build: enable iavf base code to build on windows
On 3/11/2021 1:58 AM, Pallavi Kadam wrote: Enable IAVF driver to build on Windows as it is required to build ice PMD. Disable all other drivers from common directory. This patch also includes fix for a macro redefinition warning in the IAVF driver. Signed-off-by: Pallavi Kadam Reviewed-by: Ranjit Menon <...> index 6cb9f0737..a2dfed0ec 100644 --- a/drivers/common/sfc_efx/meson.build +++ b/drivers/common/sfc_efx/meson.build @@ -5,6 +5,12 @@ # This software was jointly developed between OKTET Labs (under contract # for Solarflare) and Solarflare Communications, Inc. +if is_windows + build = false + reason = 'not supported on Windows' + subdir_done() +endif + 'common/sfc_efx/meson.build' already has similar update in the upstream, can you please rebase on latest head of the repo.
Re: [dpdk-dev] [PATCH v2 2/3] net/ice: build on Windows
On 3/11/2021 1:58 AM, Pallavi Kadam wrote: - Add Intel ice PMD support on Windows. - Remove #include sys/ioctl header file as it is not needed. - Replace x86intrin.h with rte_vect.h to avoid __m_prefetchw conflicting types. - Replace POSIX usleep() API with rte API. - Add a new macro for the access() API as the original function has been deprecated on Windows. - Add extra cflags '-fno-asynchronous-unwind-tables' to avoid MinGW build error: Error: invalid register for .seh_savexmm - Add documentation to support ice PMD on Windows. Update the release notes and features list for the same. Signed-off-by: Pallavi Kadam Reviewed-by: Ranjit Menon <...> --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -6684,7 +6684,7 @@ ice_fill_valid_words(struct ice_adv_lkup_elem *rule, for (j = 0; j < sizeof(rule->m_u) / sizeof(u16); j++) if (((u16 *)&rule->m_u)[j] && - rule->type < ARRAY_SIZE(ice_prot_ext)) { + (unsigned long long)rule->type < ARRAY_SIZE(ice_prot_ext)) { isn't 'ARRAY_SIZE' return type is 'size_t', if 'size_t' is supported in Windows why not cast to it, instead of "unsigned long long". <...> index b82d05fe7..01f8f409d 100644 --- a/drivers/net/ice/base/meson.build +++ b/drivers/net/ice/base/meson.build @@ -29,6 +29,10 @@ foreach flag: error_cflags endif endforeach +if is_windows and cc.get_id() != 'clang' + cflags += ['-fno-asynchronous-unwind-tables'] +endif + This seems not having affect [1], may be because 'cflags' is not used for build but 'c_args', moving the block above "c_args = cflags" assignment may work. [1] http://mails.dpdk.org/archives/test-report/2021-March/182218.html
Re: [dpdk-dev] [PATCH v2 3/3] net/ice: disable ice DDP package on Windows
On 3/11/2021 1:58 AM, Pallavi Kadam wrote: Disable loading of external DDP package as it is not supported on Windows. Should this be documented in driver documentation as Windows support limitation? Signed-off-by: Pallavi Kadam Reviewed-by: Ranjit Menon <...>
Re: [dpdk-dev] [PATCH v2 2/3] net/ice: build on Windows
On 3/11/2021 1:58 AM, Pallavi Kadam wrote: - Add Intel ice PMD support on Windows. - Remove #include sys/ioctl header file as it is not needed. - Replace x86intrin.h with rte_vect.h to avoid __m_prefetchw conflicting types. - Replace POSIX usleep() API with rte API. - Add a new macro for the access() API as the original function has been deprecated on Windows. - Add extra cflags '-fno-asynchronous-unwind-tables' to avoid MinGW build error: Error: invalid register for .seh_savexmm - Add documentation to support ice PMD on Windows. Update the release notes and features list for the same. Signed-off-by: Pallavi Kadam Reviewed-by: Ranjit Menon <...> index 23f7f0bff..15b812ac5 100644 --- a/doc/guides/rel_notes/release_21_05.rst +++ b/doc/guides/rel_notes/release_21_05.rst @@ -70,6 +70,10 @@ New Features * Added command to display Rx queue used descriptor count. ``show port (port_id) rxq (queue_id) desc used count`` +* **Updated Intel ice driver.** + + * Added Intel ice support on Windows. + Can you please move the update just after 'Hisilicon' PMD update, we are trying to keep PMD updates in order base on vendor alphabetical order. Overall the release note update order is described more in the section comment of the document.
Re: [dpdk-dev] [PATCH v2] ethdev: introduce enable_driver_sdk to install driver headers
On 3/24/2021 4:24 PM, Tyler Retzlaff wrote: On Wed, Mar 24, 2021 at 12:30:36PM +0100, Thomas Monjalon wrote: 24/03/2021 12:27, Ferruh Yigit: But not sure how to manage the same problem for whole project, if install all headers in one patch, or add them gradually via separate patches by time ... We did a cleanup in ethdev but not in other driver classes. When the cleanup will be done gradually, the headers must move in this new category driver_sdk_headers. yes, some headers are not installed now. so they need only to have their api marked __rte_internal and installed (since there should be no external consumer as a function of not being installed) the more difficult case is where headers were installed but the api were not marked __rte_internal and appear in the stable version.map. for those i guess deprecation notice has to be issued before marking as internal. Are you referring to any specific APIs, can you share list of them?
Re: [dpdk-dev] [PATCH v2] mem: fix cleanup when multi-process is disabled
On 24-Mar-21 7:32 PM, Dmitry Kozlyuk wrote: rte_eal_memory_detach() did not account for cases where multi-process mode is disabled: --in-memory and --no-shconf. This resulted in unmapping memory that had not been mapped, which caused errors: EAL: Could not unmap memory: No error (Windows) EAL: Cannot munmap(0x1d47f40, 0x7000): Invalid argument (Linux) Confusing "No error" was caused by using errno instead of rte_errno set by rte_mem_unmap(). Skip detaching memory altogether when --in-memory is specified. Skip unmapping configuration when it's not shared. Fix and add error handling to produce proper log messages. Fixes: dfbc61a2f9a6 ("mem: detach memsegs on cleanup") Cc: Anatoly Burakov Reported-by: Jie Zhou Suggested-by: David Marchand Signed-off-by: Dmitry Kozlyuk --- LGTM Acked-by: Anatoly Burakov -- Thanks, Anatoly
Re: [dpdk-dev] [PATCH V2 1/4] config/arm: add Hisilicon kunpeng920 implementer
On Wed, Mar 10, 2021 at 7:05 AM Lijun Ou wrote: > > Here addes Kunpeng920 config back which was deleted. Please fix the commit message. With commit message update: Acked-by: Jerin Jacob > > Fixes: 91c730fd4e09 ("config/arm: remove unused or superfluous variables") > > Signed-off-by: Chengchang Tang > Signed-off-by: Lijun Ou > --- > V1->V2: > - rewrite patch title. > - split the patch into two. > --- > config/arm/meson.build | 20 > 1 file changed, 20 insertions(+) > > diff --git a/config/arm/meson.build b/config/arm/meson.build > index 00bc461..3826900 100644 > --- a/config/arm/meson.build > +++ b/config/arm/meson.build > @@ -133,6 +133,25 @@ implementer_cavium = { > } > } > > +implementer_hisilicon = { > + 'description': 'Hisilicon', > + 'flags': [ > + ['RTE_USE_C11_MEM_MODEL', true], > + ['RTE_CACHE_LINE_SIZE', 128], > + ['RTE_MAX_NUMA_NODES', 4] > + ], > + 'part_number_config': { > + '0xd01': { > + 'machine_args': ['-march=armv8.2-a+crypto', > +'-mtune=tsv110'], > + 'flag': [['RTE_MACHINE', '"kunpeng920"'], > +['RTE_MAX_LCORE', 128], > +['RTE_ARM_FEATURE_ATOMICS', true] > + ] > + } > + } > +} > + > implementer_ampere = { > 'description': 'Ampere Computing', > 'flags': [ > @@ -190,6 +209,7 @@ implementers = { > 'generic': implementer_generic, > '0x41': implementer_arm, > '0x43': implementer_cavium, > + '0x48': implementer_hisilicon, > '0x50': implementer_ampere, > '0x51': implementer_qualcomm, > '0x56': implementer_marvell, > -- > 2.7.4 >
Re: [dpdk-dev] [PATCH V2 2/4] config/arm: add Hisilicon kunpeng930 implementer
On Wed, Mar 10, 2021 at 7:05 AM Lijun Ou wrote: > > Here add Hisilicon kunpeng930 config back which was deleted. Please fix the commit message. I think, 1/4 and 2/4 cab squashed. With above change: Acked-by: Jerin Jacob > > Fixes: 91c730fd4e09 ("config/arm: remove unused or superfluous variables") > > Signed-off-by: Chengchang Tang > Signed-off-by: Lijun Ou > --- > -rewrite the patch title. > -split the patch into two. > --- > config/arm/meson.build | 7 +++ > 1 file changed, 7 insertions(+) > > diff --git a/config/arm/meson.build b/config/arm/meson.build > index 3826900..a3f42c3 100644 > --- a/config/arm/meson.build > +++ b/config/arm/meson.build > @@ -148,6 +148,13 @@ implementer_hisilicon = { > ['RTE_MAX_LCORE', 128], > ['RTE_ARM_FEATURE_ATOMICS', true] > ] > + }, > + '0xd02': { > + 'machine_args': ['-march=armv8.2-a+crypto+sve'], > + 'flag': [['RTE_MACHINE', '"kunpeng930"'], > +['RTE_MAX_LCORE', 256], > +['RTE_ARM_FEATURE_ATOMICS', true] > + ] > } > } > } > -- > 2.7.4 >
Re: [dpdk-dev] [PATCH V2 3/4] config/arm: add kunpeng920 meson cross compile target
On Thu, Mar 25, 2021 at 1:18 PM Ruifeng Wang wrote: > > > -Original Message- > > From: dev On Behalf Of Lijun Ou > > Sent: Wednesday, March 10, 2021 9:36 AM > > To: tho...@monjalon.net; ferruh.yi...@intel.com > > Cc: dev@dpdk.org; linux...@openeuler.org > > Subject: [dpdk-dev] [PATCH V2 3/4] config/arm: add kunpeng920 meson > > cross compile target Suggested title: config/arm: add kunpeng920 cross target > > > > Here add arm64 cross compile support for Hisilicon kunpeng920. Suggested change: Add support for Hisilicon kunpeng920 cross target. With the above change: Acked-by: Jerin Jacob > > > > Signed-off-by: Chengchang Tang > > Signed-off-by: Lijun Ou > > --- > > config/arm/arm64_kunpeng920_linux_gcc | 19 > > +++ > > doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst | 4 > > 2 files changed, 23 insertions(+) > > create mode 100644 config/arm/arm64_kunpeng920_linux_gcc > > > > diff --git a/config/arm/arm64_kunpeng920_linux_gcc > > b/config/arm/arm64_kunpeng920_linux_gcc > > new file mode 100644 > > index 000..3eeb2e9 > > --- /dev/null > > +++ b/config/arm/arm64_kunpeng920_linux_gcc > > @@ -0,0 +1,19 @@ > > +[binaries] > > +c = 'aarch64-linux-gnu-gcc' > > +cpp = 'aarch64-linux-gnu-cpp' > > +ar = 'aarch64-linux-gnu-gcc-ar' > > +strip = 'aarch64-linux-gnu-strip' > > +pkgconfig = 'aarch64-linux-gnu-pkg-config' > > +pcap-config = '' > > + > > +[host_machine] > > +system = 'linux' > > +cpu_family = 'aarch64' > > +cpu = 'armv8-a' > > +endian = 'little' > > + > > +[properties] > > +implementer_id = '0x48' > > +part_number = '0xd01' > > +max_lcores = 128 > > +max_numa_nodes = 4 > > diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst > > b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst > > index faaf24b..afe4f8e 100644 > > --- a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst > > +++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst > > @@ -197,6 +197,7 @@ you may use various combinations of > > implementer/part number:: > >'generic': Generic armv8 > >'0x41':Arm > >'0x43':Cavium > > + '0x48':Hisilicon > >'0x50':Ampere Computing > >'0x56':Marvell ARMADA > >'dpaa':NXP DPAA > > @@ -219,6 +220,9 @@ you may use various combinations of > > implementer/part number:: > >'0xaf':thunderx2t99 > >'0xb2':octeontx2 > > > > + Supported part_numbers for 0x48: > > + '0xd01':kunpeng920 > > + > > Supported part_numbers for 0x50: > >'0x0': emag > > > > -- > > 2.7.4 > > Reviewed-by: Ruifeng Wang >
Re: [dpdk-dev] [PATCH V2 4/4] config/arm: add kunpeng930 meson cross compile target
On Wed, Mar 10, 2021 at 7:05 AM Lijun Ou wrote: > > Here add arm64 cross compile support for Hisilicon kunpeng930. > > Signed-off-by: Chengchang Tang > Signed-off-by: Lijun Ou Similar comments to 3/4 patch. With change: Acked-by: Jerin Jacob > --- > config/arm/arm64_kunpeng930_linux_gcc | 19 +++ > doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst | 1 + > 2 files changed, 20 insertions(+) > create mode 100644 config/arm/arm64_kunpeng930_linux_gcc > > diff --git a/config/arm/arm64_kunpeng930_linux_gcc > b/config/arm/arm64_kunpeng930_linux_gcc > new file mode 100644 > index 000..464e44a > --- /dev/null > +++ b/config/arm/arm64_kunpeng930_linux_gcc > @@ -0,0 +1,19 @@ > +[binaries] > +c = 'aarch64-linux-gnu-gcc' > +cpp = 'aarch64-linux-gnu-cpp' > +ar = 'aarch64-linux-gnu-gcc-ar' > +strip = 'aarch64-linux-gnu-strip' > +pkgconfig = 'aarch64-linux-gnu-pkg-config' > +pcap-config = '' > + > +[host_machine] > +system = 'linux' > +cpu_family = 'aarch64' > +cpu = 'armv8-a' > +endian = 'little' > + > +[properties] > +implementer_id = '0x48' > +part_number = '0xd02' > +max_lcores = 256 > +max_numa_nodes = 4 > diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst > b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst > index afe4f8e..1a54436 100644 > --- a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst > +++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst > @@ -222,6 +222,7 @@ you may use various combinations of implementer/part > number:: > > Supported part_numbers for 0x48: >'0xd01':kunpeng920 > + '0xd02':kunpeng930 > > Supported part_numbers for 0x50: >'0x0': emag > -- > 2.7.4 >
Re: [dpdk-dev] [PATCH] ethdev: update qfi definition
On 3/23/2021 12:11 PM, Raslan Darawsheh wrote: qfi field is 8 bits which represent single bit for PPP (paging Policy Presence) single bit for RQI (Reflective QoS Indicator) and 6 bits for qfi (QoS Flow Identifier) Can you please put a reference for above information? This update the doxygen format and the mask for qfi to properly identify the full 8 bits of the field. note: changing the default mask would cause different patterns generated by testpmd. Fixes: 346553db5bd1 ("ethdev: add GTP extension header to flow API") Cc: ying.a.w...@intel.com Cc: sta...@dpdk.org Signed-off-by: Raslan Darawsheh --- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 3 ++- lib/librte_ethdev/rte_flow.h| 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index f59eb8a27d..dd39c4c3c2 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3742,7 +3742,8 @@ This section lists supported pattern items and their attributes, if any. - ``gtp_psc``: match GTP PDU extension header with type 0x85. - ``pdu_type {unsigned}``: PDU type. - - ``qfi {unsigned}``: QoS flow identifier. + + - ``qfi {unsigned}``: PPP, RQI and QoS flow identifier. - ``pppoes``, ``pppoed``: match PPPoE header. diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 669e677e91..79106e0246 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -1392,14 +1392,14 @@ static const struct rte_flow_item_meta rte_flow_item_meta_mask = { */ struct rte_flow_item_gtp_psc { uint8_t pdu_type; /**< PDU type. */ - uint8_t qfi; /**< QoS flow identifier. */ + uint8_t qfi; /**< PPP, RQI, QoS flow identifier. */ }; By design requirement, rte_flow_item_* should start with the relevant protocol header. There is already a deprecation notice for using protocol header directly in the rte_flow_item* [1] and Adrew/Ivan already fixed a few of them [2]. Your patch is not directly related on this, but since you are touching to the flow_item, would you mind create a protocol struct for it first, and use it in the "struct rte_flow_item_gtp_psc"? So the protocol related update can be done in the protocol header, instead of rte_flow struct. [1] https://git.dpdk.org/dpdk/tree/doc/guides/rel_notes/deprecation.rst?h=v21.02#n99 [2] https://git.dpdk.org/next/dpdk-next-net/commit/?id=4a061a7bd70bfa023de23e8e654e
Re: [dpdk-dev] [PATCH] net/mlx5: fix using flow tunnel before null check
> -Original Message- > From: wangyunjian > Sent: Friday, March 26, 2021 12:37 > To: dev@dpdk.org > Cc: Matan Azrad ; Shahaf Shuler > ; Slava Ovsiienko ; > jerry.lili...@huawei.com; chenchan...@huawei.com; Yunjian Wang > > Subject: [dpdk-dev] [PATCH] net/mlx5: fix using flow tunnel before null > check > > From: Yunjian Wang > > Coverity flags that 'ctx->tunnel' variable is used before it's checked for > NULL. > This patch fixes this issue. > > Coverity issue: 366201 > Fixes: 868d2e342cf3 ("net/mlx5: fix tunnel offload hub multi-thread > protection") > > Signed-off-by: Yunjian Wang Acked-by: Viacheslav Ovsiienko Thank you for the patch. I suppose, this one should be the part of 20.11LTS either. Could you, please, add "cc: sta...@dpdk.org" and send v2? With best regards, Slava > --- > drivers/net/mlx5/mlx5_flow.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c > index d46fc333d1..bb8d09cdef 100644 > --- a/drivers/net/mlx5/mlx5_flow.c > +++ b/drivers/net/mlx5/mlx5_flow.c > @@ -7899,10 +7899,11 @@ static void get_tunnel_miss(struct rte_eth_dev > *dev, void *x) > > rte_spinlock_unlock(&thub->sl); > ctx->tunnel = mlx5_flow_tunnel_allocate(dev, ctx->app_tunnel); > - ctx->tunnel->refctn = 1; > rte_spinlock_lock(&thub->sl); > - if (ctx->tunnel) > + if (ctx->tunnel) { > + ctx->tunnel->refctn = 1; > LIST_INSERT_HEAD(&thub->tunnels, ctx->tunnel, chain); > + } > } > > > -- > 2.23.0
Re: [dpdk-dev] [PATCH 01/52] config/arm: add support for Marvell CN10K
On Fri, Mar 5, 2021 at 7:09 PM Nithin Dabilpuram wrote: > > From: Pavan Nikhilesh > > Add config support to cross compile for Marvell CN10K SoC. > > Signed-off-by: Nithin Dabilpuram > Signed-off-by: Pavan Nikhilesh Please move this patch from this series and send a separate patch and CC arm maintainers. Also, mention the SoC is based on ARM's N2 core in thi git commit. > --- > config/arm/arm64_cn10k_linux_gcc | 20 > 1 file changed, 20 insertions(+) > create mode 100644 config/arm/arm64_cn10k_linux_gcc > > diff --git a/config/arm/arm64_cn10k_linux_gcc > b/config/arm/arm64_cn10k_linux_gcc > new file mode 100644 > index 000..4f8e7cb > --- /dev/null > +++ b/config/arm/arm64_cn10k_linux_gcc > @@ -0,0 +1,20 @@ > +[binaries] > +c = 'aarch64-linux-gnu-gcc' > +cpp = 'aarch64-linux-gnu-cpp' > +ar = 'aarch64-linux-gnu-gcc-ar' > +strip = 'aarch64-linux-gnu-strip' > +pkgconfig = 'aarch64-linux-gnu-pkg-config' > +pcap-config = '' > + > +[host_machine] > +system = 'linux' > +cpu_family = 'aarch64' > +cpu = 'armv8.6-a' > +endian = 'little' > + > +[properties] > +implementer_id = '0x41' > +part_number = '0xd49' > +max_lcores = 36 > +max_numa_nodes = 1 > +numa = false > -- > 2.8.4 >
Re: [dpdk-dev] [PATCH 03/52] common/cnxk: add model init and IO handling API
On Fri, Mar 5, 2021 at 7:10 PM Nithin Dabilpuram wrote: > > From: Jerin Jacob > > Add routines for SoC model identification and HW IO handling > routines specific to CN9K and CN10K Marvell SoC's. > These are based on arm64 ISA and behaviour specific to > Marvell SoC's. > > Signed-off-by: Jerin Jacob > --- > drivers/common/cnxk/meson.build | 4 +- > drivers/common/cnxk/roc_api.h| 13 +++ > drivers/common/cnxk/roc_io.h | 187 > +++ > drivers/common/cnxk/roc_io_generic.h | 122 +++ > drivers/common/cnxk/roc_model.c | 148 +++ > drivers/common/cnxk/roc_model.h | 103 +++ > drivers/common/cnxk/roc_platform.c | 21 > drivers/common/cnxk/roc_platform.h | 10 ++ > drivers/common/cnxk/roc_priv.h | 11 +++ > drivers/common/cnxk/roc_util_priv.h | 14 +++ > drivers/common/cnxk/roc_utils.c | 35 +++ > drivers/common/cnxk/roc_utils.h | 13 +++ > drivers/common/cnxk/version.map | 5 + > 13 files changed, 685 insertions(+), 1 deletion(-) > + > +#endif /* _ROC_UTIL_PRIV_H_ */ > diff --git a/drivers/common/cnxk/roc_utils.c b/drivers/common/cnxk/roc_utils.c > new file mode 100644 > index 000..bcba7b2 > --- /dev/null > +++ b/drivers/common/cnxk/roc_utils.c > @@ -0,0 +1,35 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(C) 2020 Marvell. Please update the year to 2021 in all the files. > +#endif /* _ROC_UTILS_H_ */ > diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map > index dc012a1..227f2ce 100644 > --- a/drivers/common/cnxk/version.map > +++ b/drivers/common/cnxk/version.map > @@ -1,4 +1,9 @@ > INTERNAL { > + global: > + > + plt_init; plt_init() is internal one. We dont need to expose that. > + roc_error_msg_get; > + roc_model; > > local: *; > }; > -- > 2.8.4 >
Re: [dpdk-dev] [PATCH 09/52] common/cnxk: add base npa device support
On Fri, Mar 5, 2021 at 7:11 PM Nithin Dabilpuram wrote: > > From: Ashwin Sekhar T K > > Add NPA init and fini functions. Please add a few line git commit messagee on what is NPA. > > Signed-off-by: Ashwin Sekhar T K > --- > drivers/common/cnxk/meson.build | 1 + > drivers/common/cnxk/roc_api.h | 3 + > drivers/common/cnxk/roc_dev.c | 11 ++ > drivers/common/cnxk/roc_dev_priv.h | 6 + > drivers/common/cnxk/roc_idev.c | 67 > drivers/common/cnxk/roc_idev.h | 3 + > drivers/common/cnxk/roc_idev_priv.h | 12 ++ > drivers/common/cnxk/roc_npa.c | 318 > > drivers/common/cnxk/roc_npa.h | 20 +++ > drivers/common/cnxk/roc_npa_priv.h | 59 +++ > drivers/common/cnxk/roc_platform.c | 1 + > drivers/common/cnxk/roc_platform.h | 2 + > drivers/common/cnxk/roc_priv.h | 3 + > drivers/common/cnxk/roc_utils.c | 22 +++ > drivers/common/cnxk/version.map | 5 + > 15 files changed, 533 insertions(+) > create mode 100644 drivers/common/cnxk/roc_npa.c > create mode 100644 drivers/common/cnxk/roc_npa.h > create mode 100644 drivers/common/cnxk/roc_npa_priv.h > > diff --git a/drivers/common/cnxk/meson.build b/drivers/common/cnxk/meson.build > index 735d3f8..c684e1d 100644 > --- a/drivers/common/cnxk/meson.build > +++ b/drivers/common/cnxk/meson.build > @@ -16,6 +16,7 @@ sources = files('roc_dev.c', > 'roc_irq.c', > 'roc_mbox.c', > 'roc_model.c', > + 'roc_npa.c', > 'roc_platform.c', > 'roc_utils.c') > includes += include_directories('../../bus/pci') > diff --git a/drivers/common/cnxk/roc_api.h b/drivers/common/cnxk/roc_api.h > index 83aa4f6..f2c5225 100644 > --- a/drivers/common/cnxk/roc_api.h > +++ b/drivers/common/cnxk/roc_api.h > @@ -79,6 +79,9 @@ > /* Mbox */ > #include "roc_mbox.h" > > +/* NPA */ > +#include "roc_npa.h" > + > /* Utils */ > #include "roc_utils.h" > > diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c > index 1fe1371..157c155 100644 > --- a/drivers/common/cnxk/roc_dev.c > +++ b/drivers/common/cnxk/roc_dev.c > @@ -1125,6 +1125,10 @@ dev_init(struct dev *dev, struct plt_pci_device > *pci_dev) > } > dev->mbox_active = 1; > > + rc = npa_lf_init(dev, pci_dev); > + if (rc) > + goto iounmap; > + > /* Setup LMT line base */ > rc = dev_lmt_setup(pci_dev, dev); > if (rc) > @@ -1150,6 +1154,13 @@ dev_fini(struct dev *dev, struct plt_pci_device > *pci_dev) > struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; > struct mbox *mbox; > > + /* Check if this dev hosts npalf and has 1+ refs */ > + if (idev_npa_lf_active(dev) > 1) > + return -EAGAIN; > + > + /* Clear references to this pci dev */ > + npa_lf_fini(); > + > mbox_unregister_irq(pci_dev, dev); > > if (!dev_is_vf(dev)) > diff --git a/drivers/common/cnxk/roc_dev_priv.h > b/drivers/common/cnxk/roc_dev_priv.h > index 0996ec4..ac00e08 100644 > --- a/drivers/common/cnxk/roc_dev_priv.h > +++ b/drivers/common/cnxk/roc_dev_priv.h > @@ -78,6 +78,7 @@ struct dev { > dev_intr_t intr; > int timer_set; /* ~0 : no alarm handling */ > uint64_t hwcap; > + struct npa_lf npa; > struct mbox *mbox; > uint16_t maxvf; > struct dev_ops *ops; > @@ -85,6 +86,11 @@ struct dev { > bool disable_shared_lmt; /* false(default): shared lmt mode enabled */ > } __plt_cache_aligned; > > +struct npa { > + struct plt_pci_device *pci_dev; > + struct dev dev; > +} __plt_cache_aligned; > + > extern uint16_t dev_rclk_freq; > extern uint16_t dev_sclk_freq; > > diff --git a/drivers/common/cnxk/roc_idev.c b/drivers/common/cnxk/roc_idev.c > index be762c5..dd03b2a 100644 > --- a/drivers/common/cnxk/roc_idev.c > +++ b/drivers/common/cnxk/roc_idev.c > @@ -29,9 +29,76 @@ idev_get_cfg(void) > void > idev_set_defaults(struct idev_cfg *idev) > { > + idev->npa = NULL; > + idev->npa_pf_func = 0; > + idev->max_pools = 128; > idev->lmt_pf_func = 0; > idev->lmt_base_addr = 0; > idev->num_lmtlines = 0; > + __atomic_store_n(&idev->npa_refcnt, 0, __ATOMIC_RELEASE); > +} > + > +uint16_t > +idev_npa_pffunc_get(void) > +{ > + struct idev_cfg *idev; > + uint16_t npa_pf_func; > + > + idev = idev_get_cfg(); > + npa_pf_func = 0; > + if (idev != NULL) > + npa_pf_func = idev->npa_pf_func; > + > + return npa_pf_func; > +} > + > +struct npa_lf * > +idev_npa_obj_get(void) > +{ > + struct idev_cfg *idev; > + > + idev = idev_get_cfg(); > + if (idev && __atomic_load_n(&idev->npa_refcnt, __ATOMIC_ACQUIRE)) > + return idev->npa; > + > + return NULL; > +} > + > +uint32_t > +roc_idev_npa_maxpools_get(void) > +{ > + struct idev_cf
Re: [dpdk-dev] [PATCH 01/25] event/dlb2: add dlb v2.5 probe
> -Original Message- > From: Jerin Jacob > Sent: Friday, March 26, 2021 6:01 AM > To: McDaniel, Timothy > Cc: dpdk-dev ; Jerin Jacob ; Van Haaren, > Harry ; Ray Kinsella ; Neil > Horman ; Rao, Nikhil ; > Carrillo, Erik G ; Gujjar, Abhinandan S > ; Pavan Nikhilesh > ; Hemant Agrawal ; > mattias.ronnblom ; Mccarthy, Peter > > Subject: Re: [dpdk-dev] [PATCH 01/25] event/dlb2: add dlb v2.5 probe > > On Thu, Mar 25, 2021 at 1:01 AM McDaniel, Timothy > wrote: > > > > > > > > > -Original Message- > > > From: Jerin Jacob > > > Sent: Sunday, March 21, 2021 4:48 AM > > > To: McDaniel, Timothy > > > Cc: dpdk-dev ; Jerin Jacob ; Van > Haaren, > > > Harry ; Ray Kinsella ; Neil > > > Horman ; Rao, Nikhil ; > > > Carrillo, Erik G ; Gujjar, Abhinandan S > > > ; Pavan Nikhilesh > > > ; Hemant Agrawal > ; > > > mattias.ronnblom ; Mccarthy, Peter > > > > > > Subject: Re: [dpdk-dev] [PATCH 01/25] event/dlb2: add dlb v2.5 probe > > > > > > On Wed, Mar 17, 2021 at 3:49 AM Timothy McDaniel > > > wrote: > > > > > > > > This commit adds dlb v2.5 probe support, and updates > > > > parameter parsing. > > > > > > > > The dlb v2.5 device differs from dlb v2, in that the > > > > number of resources (ports, queues, ...) is different, > > > > so macros have been added to take the device version > > > > into account. > > > > > > > > This commit also cleans up a few issues in the original > > > > dlb2 source: > > > > - eliminate duplicate constant definitions > > > > - removed unused constant definitions > > > > > > > > Signed-off-by: Timothy McDaniel > > > > --- > > > > > > > > > > > -#define EVDEV_DLB2_NAME_PMD dlb2_event > > > > +#define EVDEV_DLB2_NAME_PMD dlb_event > > > > > > Is this an intended change? why change the driver's name. > > > > Yes, This is an intentional change. We will be using the same driver name > going forward, regardless of the hardware version. > > Internally, we know which version of the hardware is present. > > Since the driver name is still driver/event/dlb2. Keep it as same > prefix scheme with other drivers. > > > > > > Thanks, > > Tim > > Would it be acceptable to rename drivers/event/dlb2 to drivers/event/dlb? We may have additional dlb devices in the pipeline, such as v3, and we would really like to have them all use a common name.
[dpdk-dev] [PATCH v8 0/8] Introduce event vectorization
From: Pavan Nikhilesh In traditional event programming model, events are identified by a flow-id and a uintptr_t. The flow-id uniquely identifies a given event and determines the order of scheduling based on schedule type, the uintptr_t holds a single object. Event devices also support burst mode with configurable dequeue depth, i.e. each dequeue call would return multiple events and each event might be at a different stage of the pipeline. Having a burst of events belonging to different stages in a dequeue burst is not only difficult to vectorize but also increases the scheduler overhead and application overhead of pipelining events further. Using event vectors we see a performance gain of ~742.3% as shown in [1]. By introducing event vectorization, each event will be capable of holding multiple uintptr_t of the same flow thereby allowing applications to vectorize their pipeline and reduce the complexity of pipelining events across multiple stages. This also reduces the complexity of handling enqueue and dequeue on an event device. Since event devices are transparent to the events they are scheduling so the event producers such as eth_rx_adapter, crypto_adapter , etc.. are responsible for vectorizing the buffers of the same flow into a single event. The series also breaks ABI in the patch [8/8] which is targetted to the v21.11 release. The dpdk-test-eventdev application has been updated with options to test multiple vector sizes and timeouts. [1] As for performance improvement, with a ARM Cortex-A72 equivalent processer, software event device (--vdev=event_sw0), single worker core, single stage and using one service core for Rx adapter, Tx adapter, Scheduling. Without this patchset applied: ./build/app/dpdk-test-eventdev -l 7-23 -s 0x700 --vdev="event_sw0" -- --prod_type_ethdev --nb_pkts=0 --verbose 2 --test=pipeline_queue --stlist=a --wlcores=20 Port[0] using Rx adapter[0] configured Port[0] using Tx adapter[0] Configured 5.071 mpps With the patchset applied and Without event vectorization: ./build/app/dpdk-test-eventdev -l 7-23 -s 0x700 --vdev="event_sw0" -- --prod_type_ethdev --nb_pkts=0 --verbose 2 --test=pipeline_queue --stlist=a --wlcores=20 Port[0] using Rx adapter[0] configured Port[0] using Tx adapter[0] Configured 5.123 mpps With event vectorization: ./build/app/dpdk-test-eventdev -l 7-23 -s 0x700 --vdev="event_sw0" -- --prod_type_ethdev --nb_pkts=0 --verbose 2 --test=pipeline_queue --stlist=a --wlcores=20 --enable_vector --nb_eth_queues 1 --vector_size 256 Port[0] using Rx adapter[0] configured Port[0] using Tx adapter[0] Configured 42.715 mpps Having dedicated service cores for each Rx queues and tweaking the vector, dequeue burst size would further improve performance. API usage is shown below: Configuration: struct rte_event_eth_rx_adapter_event_vector_config vec_conf; vector_pool = rte_event_vector_pool_create("vector_pool", nb_elem, 0, vector_size, socket_id); rte_event_eth_rx_adapter_create(id, event_id, &adptr_conf); rte_event_eth_rx_adapter_queue_add(id, eth_id, -1, &queue_conf); if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR) { vec_conf.vector_sz = vector_size; vec_conf.vector_timeout_ns = vector_tmo_nsec; vec_conf.vector_mp = vector_pool; rte_event_eth_rx_adapter_queue_event_vector_config(id, eth_id, -1, &vec_conf); } Fastpath: num = rte_event_dequeue_burst(event_id, port_id, &ev, 1, 0); if (!num) continue; if (ev.event_type & RTE_EVENT_TYPE_VECTOR) { switch (ev.event_type) { case RTE_EVENT_TYPE_ETHDEV_VECTOR: case RTE_EVENT_TYPE_ETH_RX_ADAPTER_VECTOR: struct rte_mbuf **mbufs; mbufs = ev.vector_ev->mbufs; for (i = 0; i < ev.vector_ev->nb_elem; i++) //Process mbufs. break; case ... } } ... v8 Changes: - Fix incorrect shift for vector timeout interval.(Jay) - Code reallocation.(Jay) v7 Changes: - More doxygen fixes.(Jay) - Reduce code duplication in 4/8.(Jay) v6 Changes: - Make rte_errno sign consistant.(Jay) - Gramatical and doxygen fixes. (Jay) v5 Changes: - Make `rte_event_vector_pool_create non-inline` to ease ABI stability.(Ray) - Move `rte_event_eth_rx_adapter_queue_event_vector_config` and `rte_event_eth_rx_adapter_vector_limits_get` implementation to the patch where they are initially defined.(Ray) - Multiple gramatical and style fixes.(Jerin) - Add missing release notes.(Jerin) v4 Changes: - Fix missing event vector structure in event structure.(Jay) v3 Changes: - Fix unintended formatting changes. v2 Changes: -
[dpdk-dev] [PATCH v8 1/8] eventdev: introduce event vector capability
From: Pavan Nikhilesh Introduce rte_event_vector datastructure which is capable of holding multiple uintptr_t of the same flow thereby allowing applications to vectorize their pipeline and reducing the complexity of pipelining the events across multiple stages. This approach also reduces the scheduling overhead on a event device. Add a event vector mempool create handler to create mempools based on the best mempool ops available on a given platform. Signed-off-by: Pavan Nikhilesh Acked-by: Jerin Jacob Acked-by: Ray Kinsella --- doc/guides/prog_guide/eventdev.rst | 36 ++- doc/guides/rel_notes/release_21_05.rst | 8 +++ lib/librte_eventdev/rte_eventdev.c | 42 + lib/librte_eventdev/rte_eventdev.h | 82 +- lib/librte_eventdev/version.map| 3 + 5 files changed, 168 insertions(+), 3 deletions(-) diff --git a/doc/guides/prog_guide/eventdev.rst b/doc/guides/prog_guide/eventdev.rst index ccde086f6..fda9c3743 100644 --- a/doc/guides/prog_guide/eventdev.rst +++ b/doc/guides/prog_guide/eventdev.rst @@ -63,13 +63,45 @@ the actual event being scheduled is. The payload is a union of the following: * ``uint64_t u64`` * ``void *event_ptr`` * ``struct rte_mbuf *mbuf`` +* ``struct rte_event_vector *vec`` -These three items in a union occupy the same 64 bits at the end of the rte_event +These four items in a union occupy the same 64 bits at the end of the rte_event structure. The application can utilize the 64 bits directly by accessing the -u64 variable, while the event_ptr and mbuf are provided as convenience +u64 variable, while the event_ptr, mbuf, vec are provided as a convenience variables. For example the mbuf pointer in the union can used to schedule a DPDK packet. +Event Vector + + +The rte_event_vector struct contains a vector of elements defined by the event +type specified in the ``rte_event``. The event_vector structure contains the +following data: + +* ``nb_elem`` - The number of elements held within the vector. + +Similar to ``rte_event`` the payload of event vector is also a union, allowing +flexibility in what the actual vector is. + +* ``struct rte_mbuf *mbufs[0]`` - An array of mbufs. +* ``void *ptrs[0]`` - An array of pointers. +* ``uint64_t *u64s[0]`` - An array of uint64_t elements. + +The size of the event vector is related to the total number of elements it is +configured to hold, this is achieved by making `rte_event_vector` a variable +length structure. +A helper function is provided to create a mempool that holds event vector, which +takes name of the pool, total number of required ``rte_event_vector``, +cache size, number of elements in each ``rte_event_vector`` and socket id. + +.. code-block:: c + +rte_event_vector_pool_create("vector_pool", nb_event_vectors, cache_sz, + nb_elements_per_vector, socket_id); + +The function ``rte_event_vector_pool_create`` creates mempool with the best +platform mempool ops. + Queues ~~ diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst index 8a601e0a7..aeb56533a 100644 --- a/doc/guides/rel_notes/release_21_05.rst +++ b/doc/guides/rel_notes/release_21_05.rst @@ -106,6 +106,14 @@ New Features * Added support for periodic timer mode in eventdev timer adapter. * Added support for periodic timer mode in octeontx2 event device driver. +* **Add Event device vector capability.** + + * Added ``rte_event_vector`` data structure which is capable of holding +multiple ``uintptr_t`` of the same flow thereby allowing applications +to vectorize their pipelines and also reduce the complexity of pipelining +the events across multiple stages. + * This also reduces the scheduling overhead on a event device. + Removed Items - diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index b57363f80..be0499c52 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -1266,6 +1266,48 @@ int rte_event_dev_selftest(uint8_t dev_id) return -ENOTSUP; } +struct rte_mempool * +rte_event_vector_pool_create(const char *name, unsigned int n, +unsigned int cache_size, uint16_t nb_elem, +int socket_id) +{ + const char *mp_ops_name; + struct rte_mempool *mp; + unsigned int elt_sz; + int ret; + + if (!nb_elem) { + RTE_LOG(ERR, EVENTDEV, + "Invalid number of elements=%d requested\n", nb_elem); + rte_errno = EINVAL; + return NULL; + } + + elt_sz = + sizeof(struct rte_event_vector) + (nb_elem * sizeof(uintptr_t)); + mp = rte_mempool_create_empty(name, n, elt_sz, cache_size, 0, socket_id, + 0); + if (mp == NULL) + return NULL; + + mp_ops_name = rte_mbuf_best_
[dpdk-dev] [PATCH v8 4/8] eventdev: add Rx adapter event vector support
From: Pavan Nikhilesh Add event vector support for event eth Rx adapter, the implementation creates vector flows based on port and queue identifier of the received mbufs. The flow id for SW Rx event vectorization will use 12-bits of queue identifier and 8-bits port identifier when custom flow id is not set for simplicity. Signed-off-by: Pavan Nikhilesh --- lib/librte_eventdev/eventdev_pmd.h| 7 +- .../rte_event_eth_rx_adapter.c| 269 -- lib/librte_eventdev/rte_eventdev.c| 6 +- 3 files changed, 258 insertions(+), 24 deletions(-) diff --git a/lib/librte_eventdev/eventdev_pmd.h b/lib/librte_eventdev/eventdev_pmd.h index 9297f1433..0f724ac85 100644 --- a/lib/librte_eventdev/eventdev_pmd.h +++ b/lib/librte_eventdev/eventdev_pmd.h @@ -69,9 +69,10 @@ extern "C" { } \ } while (0) -#define RTE_EVENT_ETH_RX_ADAPTER_SW_CAP \ - ((RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID) | \ - (RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ)) +#define RTE_EVENT_ETH_RX_ADAPTER_SW_CAP \ + ((RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID) | \ +(RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ) | \ +(RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR)) #define RTE_EVENT_CRYPTO_ADAPTER_SW_CAP \ RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c index ac8ba5bf0..fba3b5ec3 100644 --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c @@ -26,6 +26,10 @@ #define BATCH_SIZE 32 #define BLOCK_CNT_THRESHOLD10 #define ETH_EVENT_BUFFER_SIZE (4*BATCH_SIZE) +#define MAX_VECTOR_SIZE1024 +#define MIN_VECTOR_SIZE4 +#define MAX_VECTOR_NS 1E9 +#define MIN_VECTOR_NS 1E5 #define ETH_RX_ADAPTER_SERVICE_NAME_LEN32 #define ETH_RX_ADAPTER_MEM_NAME_LEN32 @@ -59,6 +63,20 @@ struct eth_rx_poll_entry { uint16_t eth_rx_qid; }; +struct eth_rx_vector_data { + TAILQ_ENTRY(eth_rx_vector_data) next; + uint16_t port; + uint16_t queue; + uint16_t max_vector_count; + uint64_t event; + uint64_t ts; + uint64_t vector_timeout_ticks; + struct rte_mempool *vector_pool; + struct rte_event_vector *vector_ev; +} __rte_cache_aligned; + +TAILQ_HEAD(eth_rx_vector_data_list, eth_rx_vector_data); + /* Instance per adapter */ struct rte_eth_event_enqueue_buffer { /* Count of events in this buffer */ @@ -92,6 +110,14 @@ struct rte_event_eth_rx_adapter { uint32_t wrr_pos; /* Event burst buffer */ struct rte_eth_event_enqueue_buffer event_enqueue_buffer; + /* Vector enable flag */ + uint8_t ena_vector; + /* Timestamp of previous vector expiry list traversal */ + uint64_t prev_expiry_ts; + /* Minimum ticks to wait before traversing expiry list */ + uint64_t vector_tmo_ticks; + /* vector list */ + struct eth_rx_vector_data_list vector_list; /* Per adapter stats */ struct rte_event_eth_rx_adapter_stats stats; /* Block count, counts up to BLOCK_CNT_THRESHOLD */ @@ -198,9 +224,11 @@ struct eth_device_info { struct eth_rx_queue_info { int queue_enabled; /* True if added */ int intr_enabled; + uint8_t ena_vector; uint16_t wt;/* Polling weight */ uint32_t flow_id_mask; /* Set to ~0 if app provides flow id else 0 */ uint64_t event; + struct eth_rx_vector_data vector_data; }; static struct rte_event_eth_rx_adapter **event_eth_rx_adapter; @@ -722,6 +750,9 @@ rxa_flush_event_buffer(struct rte_event_eth_rx_adapter *rx_adapter) &rx_adapter->event_enqueue_buffer; struct rte_event_eth_rx_adapter_stats *stats = &rx_adapter->stats; + if (!buf->count) + return 0; + uint16_t n = rte_event_enqueue_new_burst(rx_adapter->eventdev_id, rx_adapter->event_port_id, buf->events, @@ -742,6 +773,77 @@ rxa_flush_event_buffer(struct rte_event_eth_rx_adapter *rx_adapter) return n; } +static inline void +rxa_init_vector(struct rte_event_eth_rx_adapter *rx_adapter, + struct eth_rx_vector_data *vec) +{ + vec->vector_ev->nb_elem = 0; + vec->vector_ev->port = vec->port; + vec->vector_ev->queue = vec->queue; + vec->vector_ev->attr_valid = true; + TAILQ_INSERT_TAIL(&rx_adapter->vector_list, vec, next); +} + +static inline uint16_t +rxa_create_event_vector(struct rte_event_eth_rx_adapter *rx_adapter, + struct eth_rx_queue_info *queue_info, + struct rte_eth_event_enqueue_buffer *buf, +
[dpdk-dev] [PATCH v8 3/8] eventdev: introduce event vector Tx capability
From: Pavan Nikhilesh Introduce event vector transmit capability for event eth tx adapter. The capability indicates that the Tx adapter is capable of transmitting event vectors. When rte_event_vector::union_valid is set, the Tx adapter should transmit all the packets to the rte_event_vector::port using the rte_event_vector::queue. If rte_event_vector::union_valid is not set then the Tx adapter should peek into each mbuf to get the destination port and queue pair. Signed-off-by: Pavan Nikhilesh Acked-by: Jerin Jacob Acked-by: Jay Jayatheerthan --- doc/guides/prog_guide/event_ethernet_tx_adapter.rst | 12 lib/librte_eventdev/rte_eventdev.h | 8 +++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst index a8c13e136..f80d22621 100644 --- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst +++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst @@ -164,3 +164,15 @@ The ``rte_event_eth_tx_adapter_stats_get()`` function reports counters defined in struct ``rte_event_eth_tx_adapter_stats``. The counter values are the sum of the counts from the eventdev PMD callback if the callback is supported, and the counts maintained by the service function, if one exists. + +Tx event vectorization +~~ + +The event device, ethernet device pairs which support the capability +``RTE_EVENT_ETH_TX_ADAPTER_CAP_EVENT_VECTOR`` can process event vector of mbufs. +Additionally, application can provide a hint to the Tx adapter that all the +mbufs are destined to the same ethernet port and queue by setting the bit +``rte_event_vector::attr_valid`` and filling `rte_event_vector::port`` and +``rte_event_vector::queue``. +If ``rte_event_vector::attr_valid`` is not set then the Tx adapter should peek +into each mbuf and transmit them to the requested ethernet port and queue pair. diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h index 936c97cc2..5f1f544cc 100644 --- a/lib/librte_eventdev/rte_eventdev.h +++ b/lib/librte_eventdev/rte_eventdev.h @@ -927,11 +927,13 @@ struct rte_event_vector { /**< Indicates that the below union attributes have valid information. */ union { - /* Used by Rx adapter. + /* Used by Rx/Tx adapter. * Indicates that all the elements in this vector belong to the * same port and queue pair when originating from Rx adapter, * valid only when event type is ETHDEV_VECTOR or * ETH_RX_ADAPTER_VECTOR. +* Can also be used to indicate the Tx adapter the destination +* port and queue of the mbufs in the vector */ struct { uint16_t port; @@ -1296,6 +1298,10 @@ rte_event_crypto_adapter_caps_get(uint8_t dev_id, uint8_t cdev_id, #define RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT 0x1 /**< This flag is sent when the PMD supports a packet transmit callback */ +#define RTE_EVENT_ETH_TX_ADAPTER_CAP_EVENT_VECTOR 0x2 +/**< Indicates that the Tx adapter is capable of handling event vector of + * mbufs. + */ /** * Retrieve the event device's eth Tx adapter capabilities -- 2.17.1
[dpdk-dev] [PATCH v8 2/8] eventdev: introduce event vector Rx capability
From: Pavan Nikhilesh Introduce event ethernet Rx adapter event vector capability. If an event eth Rx adapter has the capability of RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR then a given Rx queue can be configured to enable event vectorization by passing the flag RTE_EVENT_ETH_RX_ADAPTER_QUEUE_EVENT_VECTOR to rte_event_eth_rx_adapter_queue_conf::rx_queue_flags while configuring Rx adapter through rte_event_eth_rx_adapter_queue_add(). The max vector size, vector timeout define the vector size and mempool used for allocating vector event are configured through rte_event_eth_rx_adapter_queue_add. The element size of the element in the vector pool should be equal to sizeof(struct rte_event_vector) + (vector_sz * sizeof(uintptr_t)) Application can use `rte_event_vector_pool_create` to create the vector mempool used for rte_event_eth_rx_adapter_queue_conf::vector_mp. The Rx adapter would be responsible for vectorizing the mbufs based on the flow, the vector limits configured by the application and add the vector event of mbufs to the event queue set via rte_event_eth_rx_adapter_queue_conf::ev::queue_id. It should also mark rte_event_vector::union_valid and fill rte_event_vector::port, rte_event_vector::queue. Signed-off-by: Pavan Nikhilesh Acked-by: Jerin Jacob Acked-by: Ray Kinsella Acked-by: Jay Jayatheerthan --- .../prog_guide/event_ethernet_rx_adapter.rst | 38 ++ lib/librte_eventdev/eventdev_pmd.h| 53 .../rte_event_eth_rx_adapter.c| 114 ++ .../rte_event_eth_rx_adapter.h| 105 lib/librte_eventdev/rte_eventdev.h| 30 - lib/librte_eventdev/version.map | 2 + 6 files changed, 340 insertions(+), 2 deletions(-) diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst index cb44ce0e4..5eefef355 100644 --- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst +++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst @@ -186,3 +186,41 @@ the event buffer fill level is low. The ``rte_event_eth_rx_adapter_cb_register()`` function allow the application to register a callback that selects which packets to enqueue to the event device. + +Rx event vectorization +~~ + +The event devices, ethernet device pairs which support the capability +``RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR`` can aggregate packets based on +flow characteristics and generate a ``rte_event`` containing ``rte_event_vector`` +whose event type is either ``RTE_EVENT_TYPE_ETHDEV_VECTOR`` or +``RTE_EVENT_TYPE_ETH_RX_ADAPTER_VECTOR``. +The aggregation size and timeout are configurable at a queue level and the +maximum, minimum vector sizes and timeouts vary based on the device capability +and can be queried using ``rte_event_eth_rx_adapter_vector_limits_get``. +The Rx adapter additionally might include useful data such as ethernet device +port and queue identifier in the ``rte_event_vector::port`` and +``rte_event_vector::queue`` and mark ``rte_event_vector::attr_valid`` as true. + +A loop processing ``rte_event_vector`` containing mbufs is shown below. + +.. code-block:: c + +event = rte_event_dequeue_burst(event_dev, event_port, &event, +1, 0); +if (!event) +continue; + +switch (ev.event_type) { +case RTE_EVENT_TYPE_ETH_RX_ADAPTER_VECTOR: +case RTE_EVENT_TYPE_ETHDEV_VECTOR: +struct rte_mbufs **mbufs; + +mbufs = (struct rte_mbufs **)ev[i].vec->mbufs; +for (i = 0; i < ev.vec->nb_elem; i++) { +/* Process each mbuf. */ +} +break; +case ... +... +} diff --git a/lib/librte_eventdev/eventdev_pmd.h b/lib/librte_eventdev/eventdev_pmd.h index 7eb9a7739..9297f1433 100644 --- a/lib/librte_eventdev/eventdev_pmd.h +++ b/lib/librte_eventdev/eventdev_pmd.h @@ -645,6 +645,53 @@ typedef int (*eventdev_eth_rx_adapter_stats_reset) */ typedef int (*eventdev_selftest)(void); +struct rte_event_eth_rx_adapter_vector_limits; +/** + * Get event vector limits for a given event, ethernet device pair. + * + * @param dev + * Event device pointer + * + * @param eth_dev + * Ethernet device pointer + * + * @param[out] limits + * Pointer to the limits structure to be filled. + * + * @return + * - 0: Success. + * - <0: Error code returned by the driver function. + */ +typedef int (*eventdev_eth_rx_adapter_vector_limits_get_t)( + const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev, + struct rte_event_eth_rx_adapter_vector_limits *limits); + +struct rte_event_eth_rx_adapter_event_vector_config; +/** + * Enable event vector on an given Rx queue of a ethernet devices belonging to + * the Rx adapter. + * + * @param dev + * Event device pointer + * + * @param eth_dev + * Ethernet device pointer + * + * @param r
[dpdk-dev] [PATCH v8 5/8] eventdev: add Tx adapter event vector support
From: Pavan Nikhilesh Add event vector support for event eth Tx adapter, the implementation receives events from the single linked queue and based on rte_event_vector::attr_valid transmits the vector of mbufs to a given port, queue pair. Signed-off-by: Pavan Nikhilesh Acked-by: Jay Jayatheerthan --- .../rte_event_eth_tx_adapter.c| 66 --- lib/librte_eventdev/rte_eventdev.c| 5 +- 2 files changed, 60 insertions(+), 11 deletions(-) diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.c b/lib/librte_eventdev/rte_event_eth_tx_adapter.c index 5b4c42dcf..db260bfb6 100644 --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.c +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.c @@ -510,6 +510,47 @@ txa_service_buffer_retry(struct rte_mbuf **pkts, uint16_t unsent, stats->tx_dropped += unsent - sent; } +static uint16_t +txa_process_event_vector(struct txa_service_data *txa, +struct rte_event_vector *vec) +{ + struct txa_service_queue_info *tqi; + uint16_t port, queue, nb_tx = 0; + struct rte_mbuf **mbufs; + int i; + + mbufs = (struct rte_mbuf **)vec->mbufs; + if (vec->attr_valid) { + port = vec->port; + queue = vec->queue; + tqi = txa_service_queue(txa, port, queue); + if (unlikely(tqi == NULL || !tqi->added)) { + rte_pktmbuf_free_bulk(mbufs, vec->nb_elem); + rte_mempool_put(rte_mempool_from_obj(vec), vec); + return 0; + } + for (i = 0; i < vec->nb_elem; i++) { + nb_tx += rte_eth_tx_buffer(port, queue, tqi->tx_buf, + mbufs[i]); + } + } else { + for (i = 0; i < vec->nb_elem; i++) { + port = mbufs[i]->port; + queue = rte_event_eth_tx_adapter_txq_get(mbufs[i]); + tqi = txa_service_queue(txa, port, queue); + if (unlikely(tqi == NULL || !tqi->added)) { + rte_pktmbuf_free(mbufs[i]); + continue; + } + nb_tx += rte_eth_tx_buffer(port, queue, tqi->tx_buf, + mbufs[i]); + } + } + rte_mempool_put(rte_mempool_from_obj(vec), vec); + + return nb_tx; +} + static void txa_service_tx(struct txa_service_data *txa, struct rte_event *ev, uint32_t n) @@ -522,22 +563,27 @@ txa_service_tx(struct txa_service_data *txa, struct rte_event *ev, nb_tx = 0; for (i = 0; i < n; i++) { - struct rte_mbuf *m; uint16_t port; uint16_t queue; struct txa_service_queue_info *tqi; - m = ev[i].mbuf; - port = m->port; - queue = rte_event_eth_tx_adapter_txq_get(m); + if (!(ev[i].event_type & RTE_EVENT_TYPE_VECTOR)) { + struct rte_mbuf *m; - tqi = txa_service_queue(txa, port, queue); - if (unlikely(tqi == NULL || !tqi->added)) { - rte_pktmbuf_free(m); - continue; - } + m = ev[i].mbuf; + port = m->port; + queue = rte_event_eth_tx_adapter_txq_get(m); - nb_tx += rte_eth_tx_buffer(port, queue, tqi->tx_buf, m); + tqi = txa_service_queue(txa, port, queue); + if (unlikely(tqi == NULL || !tqi->added)) { + rte_pktmbuf_free(m); + continue; + } + + nb_tx += rte_eth_tx_buffer(port, queue, tqi->tx_buf, m); + } else { + nb_tx += txa_process_event_vector(txa, ev[i].vec); + } } stats->tx_packets += nb_tx; diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index 62824654b..c9bb5d227 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -196,7 +196,10 @@ rte_event_eth_tx_adapter_caps_get(uint8_t dev_id, uint16_t eth_port_id, if (caps == NULL) return -EINVAL; - *caps = 0; + if (dev->dev_ops->eth_tx_adapter_caps_get == NULL) + *caps = RTE_EVENT_ETH_TX_ADAPTER_CAP_EVENT_VECTOR; + else + *caps = 0; return dev->dev_ops->eth_tx_adapter_caps_get ? (*dev->dev_ops->eth_tx_adapter_caps_get)(dev, -- 2.17.1
[dpdk-dev] [PATCH v8 6/8] app/eventdev: add event vector mode in pipeline test
From: Pavan Nikhilesh Add event vector support in pipeline tests. By default this mode is disabled, it can be enabled by using the option --enable_vector. example: dpdk-test-eventdev -l 7-23 -s 0xff00 -- --prod_type_ethdev --nb_pkts=0 --verbose 2 --test=pipeline_atq --stlist=a --wlcores=20-23 --enable_vector Additional options to configure vector size and vector timeout are also implemented and can be used by specifying --vector_size and --vector_tmo_ns This patch also adds a new option to set the number of Rx queues configured per event eth rx adapter. example: dpdk-test-eventdev -l 7-23 -s 0xff00 -- --prod_type_ethdev --nb_pkts=0 --verbose 2 --test=pipeline_atq --stlist=a --wlcores=20-23 --nb_eth_queues 4 Signed-off-by: Pavan Nikhilesh Acked-by: Jerin Jacob --- app/test-eventdev/evt_common.h | 4 + app/test-eventdev/evt_options.c | 52 app/test-eventdev/evt_options.h | 4 + app/test-eventdev/test_pipeline_atq.c| 310 -- app/test-eventdev/test_pipeline_common.c | 113 +++- app/test-eventdev/test_pipeline_common.h | 18 ++ app/test-eventdev/test_pipeline_queue.c | 320 +-- doc/guides/tools/testeventdev.rst| 45 +++- 8 files changed, 811 insertions(+), 55 deletions(-) diff --git a/app/test-eventdev/evt_common.h b/app/test-eventdev/evt_common.h index a1da1cf11..0e228258e 100644 --- a/app/test-eventdev/evt_common.h +++ b/app/test-eventdev/evt_common.h @@ -58,16 +58,20 @@ struct evt_options { uint8_t sched_type_list[EVT_MAX_STAGES]; uint16_t mbuf_sz; uint16_t wkr_deq_dep; + uint16_t vector_size; + uint16_t eth_queues; uint32_t nb_flows; uint32_t tx_first; uint32_t max_pkt_sz; uint32_t deq_tmo_nsec; uint32_t q_priority:1; uint32_t fwd_latency:1; + uint32_t ena_vector : 1; uint64_t nb_pkts; uint64_t nb_timers; uint64_t expiry_nsec; uint64_t max_tmo_nsec; + uint64_t vector_tmo_nsec; uint64_t timer_tick_nsec; uint64_t optm_timer_tick_nsec; enum evt_prod_type prod_type; diff --git a/app/test-eventdev/evt_options.c b/app/test-eventdev/evt_options.c index 0d04ea9f8..0d5540574 100644 --- a/app/test-eventdev/evt_options.c +++ b/app/test-eventdev/evt_options.c @@ -34,6 +34,9 @@ evt_options_default(struct evt_options *opt) opt->max_tmo_nsec = 1E5; /* 10ns ~100us */ opt->expiry_nsec = 1E4; /* 1ns ~10us */ opt->prod_type = EVT_PROD_TYPE_SYNT; + opt->eth_queues = 1; + opt->vector_size = 64; + opt->vector_tmo_nsec = 100E3; } typedef int (*option_parser_t)(struct evt_options *opt, @@ -257,6 +260,43 @@ evt_parse_max_pkt_sz(struct evt_options *opt, const char *arg) return ret; } +static int +evt_parse_ena_vector(struct evt_options *opt, const char *arg __rte_unused) +{ + opt->ena_vector = 1; + return 0; +} + +static int +evt_parse_vector_size(struct evt_options *opt, const char *arg) +{ + int ret; + + ret = parser_read_uint16(&(opt->vector_size), arg); + + return ret; +} + +static int +evt_parse_vector_tmo_ns(struct evt_options *opt, const char *arg) +{ + int ret; + + ret = parser_read_uint64(&(opt->vector_tmo_nsec), arg); + + return ret; +} + +static int +evt_parse_eth_queues(struct evt_options *opt, const char *arg) +{ + int ret; + + ret = parser_read_uint16(&(opt->eth_queues), arg); + + return ret; +} + static void usage(char *program) { @@ -289,6 +329,10 @@ usage(char *program) "\t--expiry_nsec : event timer expiry ns.\n" "\t--mbuf_sz : packet mbuf size.\n" "\t--max_pkt_sz : max packet size.\n" + "\t--nb_eth_queues: number of ethernet Rx queues.\n" + "\t--enable_vector: enable event vectorization.\n" + "\t--vector_size : Max vector size.\n" + "\t--vector_tmo_ns: Max vector timeout in nanoseconds\n" ); printf("available tests:\n"); evt_test_dump_names(); @@ -360,6 +404,10 @@ static struct option lgopts[] = { { EVT_EXPIRY_NSEC, 1, 0, 0 }, { EVT_MBUF_SZ, 1, 0, 0 }, { EVT_MAX_PKT_SZ, 1, 0, 0 }, + { EVT_NB_ETH_QUEUES, 1, 0, 0 }, + { EVT_ENA_VECTOR, 0, 0, 0 }, + { EVT_VECTOR_SZ, 1, 0, 0 }, + { EVT_VECTOR_TMO, 1, 0, 0 }, { EVT_HELP,0, 0, 0 }, { NULL,0, 0, 0 } }; @@ -394,6 +442,10 @@ evt_opts_parse_long(int opt_idx, struct evt_options *opt) { EVT_EXPIRY_NSEC, evt_parse_expiry_nsec}, { EVT_MBUF_SZ, evt_parse_mbuf_sz}, { EVT_MAX_PKT_SZ, evt_parse_max_pkt_sz}, + { EVT_NB_ETH_QUEUES, evt_parse_eth_queues},
[dpdk-dev] [PATCH v8 7/8] doc: announce event Rx adapter config changes
From: Pavan Nikhilesh The Rx adapter event vector configuration will be merged into Rx adapter queue configuration to simplify enabling event vectorization. Signed-off-by: Pavan Nikhilesh Acked-by: Ray Kinsella --- doc/guides/rel_notes/deprecation.rst | 9 + 1 file changed, 9 insertions(+) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 64629e064..ef6d1bb18 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -130,3 +130,12 @@ Deprecation Notices * cmdline: ``cmdline`` structure will be made opaque to hide platform-specific content. On Linux and FreeBSD, supported prior to DPDK 20.11, original structure will be kept until DPDK 21.11. + +* eventdev: The structure ``rte_event_eth_rx_adapter_queue_conf`` will be + extended to include ``rte_event_eth_rx_adapter_event_vector_config`` elements + and the function ``rte_event_eth_rx_adapter_queue_event_vector_config`` will + be removed in DPDK 21.11. + + An application can enable event vectorization by passing the desired vector + values to the function ``rte_event_eth_rx_adapter_queue_add`` using + the structure ``rte_event_eth_rx_adapter_queue_add``. -- 2.17.1
[dpdk-dev] [dpdk-dev v21.11] [PATCH v8 8/8] eventdev: simplify Rx adapter event vector config
From: Pavan Nikhilesh Include vector configuration into the structure ``rte_event_eth_rx_adapter_queue_conf`` used when configuring rest of the Rx adapter ethernet device Rx queue parameters. This simplifies event vector configuration as it avoids splitting configuration per Rx queue. Signed-off-by: Pavan Nikhilesh --- app/test-eventdev/test_pipeline_common.c | 16 +- lib/librte_eventdev/eventdev_pmd.h| 29 --- .../rte_event_eth_rx_adapter.c| 179 ++ .../rte_event_eth_rx_adapter.h| 27 --- lib/librte_eventdev/version.map | 1 - 5 files changed, 63 insertions(+), 189 deletions(-) diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c index d5ef90500..76aee254b 100644 --- a/app/test-eventdev/test_pipeline_common.c +++ b/app/test-eventdev/test_pipeline_common.c @@ -331,7 +331,6 @@ pipeline_event_rx_adapter_setup(struct evt_options *opt, uint8_t stride, uint16_t prod; struct rte_mempool *vector_pool = NULL; struct rte_event_eth_rx_adapter_queue_conf queue_conf; - struct rte_event_eth_rx_adapter_event_vector_config vec_conf; memset(&queue_conf, 0, sizeof(struct rte_event_eth_rx_adapter_queue_conf)); @@ -397,8 +396,12 @@ pipeline_event_rx_adapter_setup(struct evt_options *opt, uint8_t stride, } if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR) { + queue_conf.vector_sz = opt->vector_size; + queue_conf.vector_timeout_ns = + opt->vector_tmo_nsec; queue_conf.rx_queue_flags |= RTE_EVENT_ETH_RX_ADAPTER_QUEUE_EVENT_VECTOR; + queue_conf.vector_mp = vector_pool; } else { evt_err("Rx adapter doesn't support event vector"); return -EINVAL; @@ -418,17 +421,6 @@ pipeline_event_rx_adapter_setup(struct evt_options *opt, uint8_t stride, return ret; } - if (opt->ena_vector) { - vec_conf.vector_sz = opt->vector_size; - vec_conf.vector_timeout_ns = opt->vector_tmo_nsec; - vec_conf.vector_mp = vector_pool; - if (rte_event_eth_rx_adapter_queue_event_vector_config( - prod, prod, -1, &vec_conf) < 0) { - evt_err("Failed to configure event vectorization for Rx adapter"); - return -EINVAL; - } - } - if (!(cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT)) { uint32_t service_id = -1U; diff --git a/lib/librte_eventdev/eventdev_pmd.h b/lib/librte_eventdev/eventdev_pmd.h index 0f724ac85..63b3bc4b5 100644 --- a/lib/librte_eventdev/eventdev_pmd.h +++ b/lib/librte_eventdev/eventdev_pmd.h @@ -667,32 +667,6 @@ typedef int (*eventdev_eth_rx_adapter_vector_limits_get_t)( const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev, struct rte_event_eth_rx_adapter_vector_limits *limits); -struct rte_event_eth_rx_adapter_event_vector_config; -/** - * Enable event vector on an given Rx queue of a ethernet devices belonging to - * the Rx adapter. - * - * @param dev - * Event device pointer - * - * @param eth_dev - * Ethernet device pointer - * - * @param rx_queue_id - * The Rx queue identifier - * - * @param config - * Pointer to the event vector configuration structure. - * - * @return - * - 0: Success. - * - <0: Error code returned by the driver function. - */ -typedef int (*eventdev_eth_rx_adapter_event_vector_config_t)( - const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev, - int32_t rx_queue_id, - const struct rte_event_eth_rx_adapter_event_vector_config *config); - typedef uint32_t rte_event_pmd_selftest_seqn_t; extern int rte_event_pmd_selftest_seqn_dynfield_offset; @@ -1118,9 +1092,6 @@ struct rte_eventdev_ops { eventdev_eth_rx_adapter_vector_limits_get_t eth_rx_adapter_vector_limits_get; /**< Get event vector limits for the Rx adapter */ - eventdev_eth_rx_adapter_event_vector_config_t - eth_rx_adapter_event_vector_config; - /**< Configure Rx adapter with event vector */ eventdev_timer_adapter_caps_get_t timer_adapter_caps_get; /**< Get timer adapter capabilities */ diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c index fba3b5ec3..e4e1f3c7d 100644 --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c @@ -1887,6 +1887,24 @@ rxa_add_queue(struct rte_event_eth_rx_
Re: [dpdk-dev] [PATCH 27/52] common/cnxk: add support for nix extended stats
On Fri, Mar 5, 2021 at 7:14 PM Nithin Dabilpuram wrote: > > From: Satha Rao > > Add support for retrieving NIX extended stats that are > per NIX LF and per LMAC. > > Signed-off-by: Satha Rao Please check http://mails.dpdk.org/archives/test-report/2021-March/181016.html > --- > drivers/common/cnxk/roc_nix.h| 18 > drivers/common/cnxk/roc_nix_stats.c | 172 + > drivers/common/cnxk/roc_nix_xstats.h | 204 > +++ > drivers/common/cnxk/version.map | 3 + > 4 files changed, 397 insertions(+) > create mode 100644 drivers/common/cnxk/roc_nix_xstats.h > > diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h > index ee9e78b..37f84fc 100644 > --- a/drivers/common/cnxk/roc_nix.h > +++ b/drivers/common/cnxk/roc_nix.h > @@ -153,6 +153,18 @@ struct roc_nix_link_info { > uint64_t port : 8; > }; > > +/** Maximum name length for extended statistics counters */ > +#define ROC_NIX_XSTATS_NAME_SIZE 64 > + > +struct roc_nix_xstat { > + uint64_t id;/**< The index in xstats name array. */ > + uint64_t value; /**< The statistic counter value. */ > +}; > + > +struct roc_nix_xstat_name { > + char name[ROC_NIX_XSTATS_NAME_SIZE]; > +}; > + > struct roc_nix_ipsec_cfg { > uint32_t sa_size; > uint32_t tag_const; > @@ -284,6 +296,12 @@ int __roc_api roc_nix_stats_queue_get(struct roc_nix > *roc_nix, uint16_t qid, > struct roc_nix_stats_queue *qstats); > int __roc_api roc_nix_stats_queue_reset(struct roc_nix *roc_nix, uint16_t > qid, > bool is_rx); > +int __roc_api roc_nix_num_xstats_get(struct roc_nix *roc_nix); > +int __roc_api roc_nix_xstats_get(struct roc_nix *roc_nix, > +struct roc_nix_xstat *xstats, unsigned int > n); > +int __roc_api roc_nix_xstats_names_get(struct roc_nix *roc_nix, > + struct roc_nix_xstat_name > *xstats_names, > + unsigned int limit); > > /* Queue */ > int __roc_api roc_nix_rq_init(struct roc_nix *roc_nix, struct roc_nix_rq *rq, > diff --git a/drivers/common/cnxk/roc_nix_stats.c > b/drivers/common/cnxk/roc_nix_stats.c > index dce496c..1f11799 100644 > --- a/drivers/common/cnxk/roc_nix_stats.c > +++ b/drivers/common/cnxk/roc_nix_stats.c > @@ -5,12 +5,24 @@ > #include > > #include "roc_api.h" > +#include "roc_nix_xstats.h" > #include "roc_priv.h" > > #define NIX_RX_STATS(val) plt_read64(nix->base + NIX_LF_RX_STATX(val)) > #define NIX_TX_STATS(val) plt_read64(nix->base + NIX_LF_TX_STATX(val)) > > int > +roc_nix_num_xstats_get(struct roc_nix *roc_nix) > +{ > + if (roc_nix_is_vf_or_sdp(roc_nix)) > + return CNXK_NIX_NUM_XSTATS_REG; > + else if (roc_model_is_cn9k()) > + return CNXK_NIX_NUM_XSTATS_CGX; > + > + return CNXK_NIX_NUM_XSTATS_RPM; > +} > + > +int > roc_nix_stats_get(struct roc_nix *roc_nix, struct roc_nix_stats *stats) > { > struct nix *nix = roc_nix_to_nix_priv(roc_nix); > @@ -237,3 +249,163 @@ roc_nix_stats_queue_reset(struct roc_nix *roc_nix, > uint16_t qid, bool is_rx) > fail: > return rc; > } > + > +int > +roc_nix_xstats_get(struct roc_nix *roc_nix, struct roc_nix_xstat *xstats, > + unsigned int n) > +{ > + struct nix *nix = roc_nix_to_nix_priv(roc_nix); > + struct mbox *mbox = (&nix->dev)->mbox; > + struct cgx_stats_rsp *cgx_resp; > + struct rpm_stats_rsp *rpm_resp; > + unsigned long int i, count = 0; > + unsigned int xstat_cnt; > + struct msg_req *req; > + int rc; > + > + xstat_cnt = roc_nix_num_xstats_get(roc_nix); > + if (n < xstat_cnt) > + return xstat_cnt; > + > + if (xstats == NULL) > + return -EINVAL; > + > + memset(xstats, 0, (xstat_cnt * sizeof(*xstats))); > + for (i = 0; i < CNXK_NIX_NUM_TX_XSTATS; i++) { > + xstats[count].value = NIX_TX_STATS(nix_tx_xstats[i].offset); > + xstats[count].id = count; > + count++; > + } > + > + for (i = 0; i < CNXK_NIX_NUM_RX_XSTATS; i++) { > + xstats[count].value = NIX_RX_STATS(nix_rx_xstats[i].offset); > + xstats[count].id = count; > + count++; > + } > + > + for (i = 0; i < nix->nb_rx_queues; i++) > + xstats[count].value += > + qstat_read(nix, i, nix_q_xstats[0].offset); > + > + xstats[count].id = count; > + count++; > + > + if (roc_nix_is_vf_or_sdp(roc_nix)) > + return count; > + > + if (roc_model_is_cn9k()) { > + req = mbox_alloc_msg_cgx_stats(mbox); > + req->hdr.pcifunc = roc_nix_get_pf_func(roc_nix); > + > + rc = mbox_process_msg(mbox, (void *)&cgx_resp); > + if (rc) > +
Re: [dpdk-dev] [PATCH 40/52] common/cnxk: add npc support
On Fri, Mar 5, 2021 at 7:16 PM Nithin Dabilpuram wrote: > > From: Kiran Kumar K > > Adding initial npc support. Please add multiple lines of comments on what is NPC. > > Signed-off-by: Kiran Kumar K > --- > drivers/common/cnxk/roc_api.h | 3 + > drivers/common/cnxk/roc_npc.h | 129 + > drivers/common/cnxk/roc_npc_priv.h | 381 > + > drivers/common/cnxk/roc_platform.c | 1 + > drivers/common/cnxk/roc_platform.h | 2 + > drivers/common/cnxk/roc_priv.h | 3 + > drivers/common/cnxk/roc_utils.c| 24 +++ > drivers/common/cnxk/version.map| 1 + > 8 files changed, 544 insertions(+) > create mode 100644 drivers/common/cnxk/roc_npc.h > create mode 100644 drivers/common/cnxk/roc_npc_priv.h > > diff --git a/drivers/common/cnxk/roc_api.h b/drivers/common/cnxk/roc_api.h > index b805425..44bed9a 100644 > --- a/drivers/common/cnxk/roc_api.h > +++ b/drivers/common/cnxk/roc_api.h > @@ -82,6 +82,9 @@ > /* NPA */ > #include "roc_npa.h" > > +/* NPC */ > +#include "roc_npc.h" > + > /* NIX */ > #include "roc_nix.h" > > diff --git a/drivers/common/cnxk/roc_npc.h b/drivers/common/cnxk/roc_npc.h > new file mode 100644 > index 000..f273976 > --- /dev/null > +++ b/drivers/common/cnxk/roc_npc.h > @@ -0,0 +1,129 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(C) 2020 Marvell. > + */ > + > +#ifndef _ROC_NPC_H_ > +#define _ROC_NPC_H_ > + > +#include > + > +enum roc_npc_item_type { > + ROC_NPC_ITEM_TYPE_VOID, > + ROC_NPC_ITEM_TYPE_ANY, > + ROC_NPC_ITEM_TYPE_ETH, > + ROC_NPC_ITEM_TYPE_VLAN, > + ROC_NPC_ITEM_TYPE_E_TAG, > + ROC_NPC_ITEM_TYPE_IPV4, > + ROC_NPC_ITEM_TYPE_IPV6, > + ROC_NPC_ITEM_TYPE_ARP_ETH_IPV4, > + ROC_NPC_ITEM_TYPE_MPLS, > + ROC_NPC_ITEM_TYPE_ICMP, > + ROC_NPC_ITEM_TYPE_IGMP, > + ROC_NPC_ITEM_TYPE_UDP, > + ROC_NPC_ITEM_TYPE_TCP, > + ROC_NPC_ITEM_TYPE_SCTP, > + ROC_NPC_ITEM_TYPE_ESP, > + ROC_NPC_ITEM_TYPE_GRE, > + ROC_NPC_ITEM_TYPE_NVGRE, > + ROC_NPC_ITEM_TYPE_VXLAN, > + ROC_NPC_ITEM_TYPE_GTPC, > + ROC_NPC_ITEM_TYPE_GTPU, > + ROC_NPC_ITEM_TYPE_GENEVE, > + ROC_NPC_ITEM_TYPE_VXLAN_GPE, > + ROC_NPC_ITEM_TYPE_IPV6_EXT, > + ROC_NPC_ITEM_TYPE_GRE_KEY, > + ROC_NPC_ITEM_TYPE_HIGIG2, > + ROC_NPC_ITEM_TYPE_CPT_HDR, > + ROC_NPC_ITEM_TYPE_L3_CUSTOM, > + ROC_NPC_ITEM_TYPE_QINQ, > + ROC_NPC_ITEM_TYPE_END, > +}; > + > +struct roc_npc_item_info { > + enum roc_npc_item_type type; /* Item type */ > + uint32_t size; /* item size */ > + const void *spec; /**< Pointer to item specification structure. */ > + const void *mask; /**< Bit-mask applied to spec and last. */ > + const void *last; /* For range */ > +}; > + > +#define ROC_NPC_MAX_ACTION_COUNT 12 > + > +enum roc_npc_action_type { > + ROC_NPC_ACTION_TYPE_END = (1 << 0), > + ROC_NPC_ACTION_TYPE_VOID = (1 << 1), > + ROC_NPC_ACTION_TYPE_MARK = (1 << 2), > + ROC_NPC_ACTION_TYPE_FLAG = (1 << 3), > + ROC_NPC_ACTION_TYPE_DROP = (1 << 4), > + ROC_NPC_ACTION_TYPE_QUEUE = (1 << 5), > + ROC_NPC_ACTION_TYPE_RSS = (1 << 6), > + ROC_NPC_ACTION_TYPE_DUP = (1 << 7), > + ROC_NPC_ACTION_TYPE_SEC = (1 << 8), > + ROC_NPC_ACTION_TYPE_COUNT = (1 << 9), > + ROC_NPC_ACTION_TYPE_PF = (1 << 10), > + ROC_NPC_ACTION_TYPE_VF = (1 << 11), > +}; > + > +struct roc_npc_action { > + enum roc_npc_action_type type; /**< Action type. */ > + const void *conf; /**< Pointer to action configuration object. */ > +}; > + > +struct roc_npc_action_mark { > + uint32_t id; /**< Integer value to return with packets. */ > +}; > + > +struct roc_npc_action_vf { > + uint32_t original : 1; /**< Use original VF ID if possible. */ > + uint32_t reserved : 31; /**< Reserved, must be zero. */ > + uint32_t id;/**< VF ID. */ > +}; > + > +struct roc_npc_action_queue { > + uint16_t index; /**< Queue index to use. */ > +}; > + > +struct roc_npc_attr { > + uint32_t priority; /**< Rule priority level within group. */ > + uint32_t ingress : 1; /**< Rule applies to ingress traffic. */ > + uint32_t egress : 1;/**< Rule applies to egress traffic. */ > + uint32_t reserved : 30; /**< Reserved, must be zero. */ > +}; > + > +struct roc_npc_flow { > + uint8_t nix_intf; > + uint8_t enable; > + uint32_t mcam_id; > + int32_t ctr_id; > + uint32_t priority; > +#define ROC_NPC_MAX_MCAM_WIDTH_DWORDS 7 > + /* Contiguous match string */ > + uint64_t mcam_data[ROC_NPC_MAX_MCAM_WIDTH_DWORDS]; > + uint64_t mcam_mask[ROC_NPC_MAX_MCAM_WIDTH_DWORDS]; > + uint64_t npc_action; > + uint64_t vtag_action; > + > + TAILQ_ENTRY(roc_npc_flow) next; > +}; > + > +enum roc_npc_intf { > + ROC_NPC_INTF_RX = 0, > + ROC_NPC_INTF_TX
Re: [dpdk-dev] [PATCH 01/25] event/dlb2: add dlb v2.5 probe
On Fri, Mar 26, 2021 at 7:33 PM McDaniel, Timothy wrote: > > > > > -Original Message- > > From: Jerin Jacob > > Sent: Friday, March 26, 2021 6:01 AM > > To: McDaniel, Timothy > > Cc: dpdk-dev ; Jerin Jacob ; Van Haaren, > > Harry ; Ray Kinsella ; Neil > > Horman ; Rao, Nikhil ; > > Carrillo, Erik G ; Gujjar, Abhinandan S > > ; Pavan Nikhilesh > > ; Hemant Agrawal ; > > mattias.ronnblom ; Mccarthy, Peter > > > > Subject: Re: [dpdk-dev] [PATCH 01/25] event/dlb2: add dlb v2.5 probe > > > > On Thu, Mar 25, 2021 at 1:01 AM McDaniel, Timothy > > wrote: > > > > > > > > > > > > > -Original Message- > > > > From: Jerin Jacob > > > > Sent: Sunday, March 21, 2021 4:48 AM > > > > To: McDaniel, Timothy > > > > Cc: dpdk-dev ; Jerin Jacob ; Van > > Haaren, > > > > Harry ; Ray Kinsella ; Neil > > > > Horman ; Rao, Nikhil ; > > > > Carrillo, Erik G ; Gujjar, Abhinandan S > > > > ; Pavan Nikhilesh > > > > ; Hemant Agrawal > > ; > > > > mattias.ronnblom ; Mccarthy, Peter > > > > > > > > Subject: Re: [dpdk-dev] [PATCH 01/25] event/dlb2: add dlb v2.5 probe > > > > > > > > On Wed, Mar 17, 2021 at 3:49 AM Timothy McDaniel > > > > wrote: > > > > > > > > > > This commit adds dlb v2.5 probe support, and updates > > > > > parameter parsing. > > > > > > > > > > The dlb v2.5 device differs from dlb v2, in that the > > > > > number of resources (ports, queues, ...) is different, > > > > > so macros have been added to take the device version > > > > > into account. > > > > > > > > > > This commit also cleans up a few issues in the original > > > > > dlb2 source: > > > > > - eliminate duplicate constant definitions > > > > > - removed unused constant definitions > > > > > > > > > > Signed-off-by: Timothy McDaniel > > > > > --- > > > > > > > > > > > > > > -#define EVDEV_DLB2_NAME_PMD dlb2_event > > > > > +#define EVDEV_DLB2_NAME_PMD dlb_event > > > > > > > > Is this an intended change? why change the driver's name. > > > > > > Yes, This is an intentional change. We will be using the same driver name > > going forward, regardless of the hardware version. > > > Internally, we know which version of the hardware is present. > > > > Since the driver name is still driver/event/dlb2. Keep it as same > > prefix scheme with other drivers. > > > > > > > > > > Thanks, > > > Tim > > > > > Would it be acceptable to rename drivers/event/dlb2 to drivers/event/dlb? > We may have additional dlb devices in the pipeline, such as v3, and we would > really like > to have them all use a common name. Makes sense to change to drivers/event/dlb. I think, we can make to dlb when you add v3 support. Now there is no need. >
Re: [dpdk-dev] [PATCH v8 7/8] doc: announce event Rx adapter config changes
On Fri, Mar 26, 2021 at 7:41 PM wrote: > > From: Pavan Nikhilesh > > The Rx adapter event vector configuration will be merged into > Rx adapter queue configuration to simplify enabling event > vectorization. > > Signed-off-by: Pavan Nikhilesh > Acked-by: Ray Kinsella Acked-by: Jerin Jacob @Jayatheerthan, Jay Any comment on this? > --- > doc/guides/rel_notes/deprecation.rst | 9 + > 1 file changed, 9 insertions(+) > > diff --git a/doc/guides/rel_notes/deprecation.rst > b/doc/guides/rel_notes/deprecation.rst > index 64629e064..ef6d1bb18 100644 > --- a/doc/guides/rel_notes/deprecation.rst > +++ b/doc/guides/rel_notes/deprecation.rst > @@ -130,3 +130,12 @@ Deprecation Notices > * cmdline: ``cmdline`` structure will be made opaque to hide > platform-specific >content. On Linux and FreeBSD, supported prior to DPDK 20.11, >original structure will be kept until DPDK 21.11. > + > +* eventdev: The structure ``rte_event_eth_rx_adapter_queue_conf`` will be > + extended to include ``rte_event_eth_rx_adapter_event_vector_config`` > elements > + and the function ``rte_event_eth_rx_adapter_queue_event_vector_config`` > will > + be removed in DPDK 21.11. > + > + An application can enable event vectorization by passing the desired vector > + values to the function ``rte_event_eth_rx_adapter_queue_add`` using > + the structure ``rte_event_eth_rx_adapter_queue_add``. > -- > 2.17.1 >
Re: [dpdk-dev] [PATCH 1/4] vhost: fix uninitialized vhost queue
On 3/17/21 1:56 PM, Jiayu Hu wrote: > This patch allocates vhost queue by rte_zmalloc() to avoid > undefined values. > > Fixes: 8acd7c213353 ("vhost: fix virtqueues metadata allocation") This is not the right commit. rte_malloc was used prior to it. > Signed-off-by: Jiayu Hu > --- > lib/librte_vhost/vhost.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c > index 52ab93d..f6fd001 100644 > --- a/lib/librte_vhost/vhost.c > +++ b/lib/librte_vhost/vhost.c > @@ -598,7 +598,7 @@ alloc_vring_queue(struct virtio_net *dev, uint32_t > vring_idx) > if (dev->virtqueue[i]) > continue; > > - vq = rte_malloc(NULL, sizeof(struct vhost_virtqueue), 0); > + vq = rte_zmalloc(NULL, sizeof(struct vhost_virtqueue), 0); > if (vq == NULL) { > VHOST_LOG_CONFIG(ERR, > "Failed to allocate memory for vring:%u.\n", i); >
Re: [dpdk-dev] [PATCH v3 2/2] drivers/net: remove explicit include of legacy filtering
On 3/25/2021 10:20 AM, Thomas Monjalon wrote: 25/03/2021 11:00, Ferruh Yigit: On 3/25/2021 5:53 AM, Andrew Rybchenko wrote: On 3/24/21 11:00 PM, Thomas Monjalon wrote: 24/03/2021 19:08, Ferruh Yigit: On 3/21/2021 9:00 AM, Thomas Monjalon wrote: The header file rte_eth_ctrl.h should not be needed because this legacy filtering API is completely replaced with the rte_flow API. However some definitions from this file are still used by some drivers, but such usage is already covered by an implicit include via rte_ethdev.h. Signed-off-by: Thomas Monjalon Acked-by: Rosen Xu Acked-by: Hemant Agrawal --- drivers/net/dpaa2/dpaa2_ptp.c | 1 - drivers/net/iavf/iavf_hash.c| 1 - drivers/net/ice/ice_acl_filter.c| 1 - drivers/net/ice/ice_hash.c | 1 - drivers/net/ice/ice_switch_filter.c | 1 - drivers/net/igc/igc_filter.h| 1 - drivers/net/ipn3ke/ipn3ke_flow.c| 1 - Although this will work, if the above drives are using the defines from the header file, isn't it better to include it explicitly? What is the benefit of including the header implicitly? The benefit is to progressively remove rte_eth_ctrl.h. I want it to disappear. +1 This is just hiding its usage, the patch is not making it less used as a step forward to remove it. Yes you're right. The only step forward is esthetic: hiding something which should be removed. And maybe some of these files don't need the include at all. But anyway I guess it doesn't worth spending more time to discuss it ... Feel free to reject if you feel it is not a good step. What do you think doing exact opposite, remove "#include " from 'rte_ethdev.h', and include 'rte_eth_ctrl.h' explicitly where ever it is required, this can make more clear what components use the 'rte_eth_ctrl.h' and why, which may help clearing them to remove the header. Plus it highlights if a new PMD wants to use the header, we can catch it easier. When I tried above approach, it highlighted that not only drivers, libraries also using this header, 'librte_ehtdev' & 'librte_flow_classify'. And for 'ethdev', the structs defined in the 'rte_eth_ctrl.h' are part of public structs, so it is hard to remove them. Some PMD specific APIs also needs 'rte_eth_ctrl.h' header, but that is hidden because of the implicit include, but again some structs in the 'rte_eth_ctrl.h' are part of public APIs (although they are experimental). Also, it turned out that same required headers in the drivers are hidden because of this implicit include in 'rte_ethdev.h', I will send a fix for it soon.
Re: [dpdk-dev] [PATCH v2] mem: fix cleanup when multi-process is disabled
On Wed, Mar 24, 2021 at 8:32 PM Dmitry Kozlyuk wrote: > > rte_eal_memory_detach() did not account for cases where multi-process > mode is disabled: --in-memory and --no-shconf. This resulted > in unmapping memory that had not been mapped, which caused errors: > > EAL: Could not unmap memory: No error (Windows) > EAL: Cannot munmap(0x1d47f40, 0x7000): Invalid argument (Linux) > > Confusing "No error" was caused by using errno instead of rte_errno > set by rte_mem_unmap(). > > Skip detaching memory altogether when --in-memory is specified. > Skip unmapping configuration when it's not shared. > Fix and add error handling to produce proper log messages. > > Fixes: dfbc61a2f9a6 ("mem: detach memsegs on cleanup") > Cc: Anatoly Burakov > > Reported-by: Jie Zhou > Suggested-by: David Marchand > Signed-off-by: Dmitry Kozlyuk Acked-by: Ranjit Menon Acked-by: Anatoly Burakov Applied, thanks Dmitry. -- David Marchand
Re: [dpdk-dev] [PATCH] telemetry: cleanup internal header
On Fri, Mar 26, 2021 at 9:25 AM David Marchand wrote: > > The experimental banner can be removed. > Every in-tree file is compiled with _GNU_SOURCE, so RTE_HAS_CPUSET is > unneeded for an internal header. > > Fixes: 0e64ae618e10 ("telemetry: move init function to internal header") > > Signed-off-by: David Marchand Acked-by: Thomas Monjalon Acked-by: Bruce Richardson Acked-by: Ciara Power Applied. -- David Marchand
Re: [dpdk-dev] [PATCH] examples/l3fwd: fix TX burst queue drain edge case
> -Original Message- > From: Thomas Monjalon > Sent: Wednesday, March 24, 2021 1:16 PM > To: Kathleen Capella > Cc: dev@dpdk.org; nd ; Honnappa Nagarahalli > > Subject: Re: [dpdk-dev] [PATCH] examples/l3fwd: fix TX burst queue drain edge > case > > 23/02/2021 19:23, Kathleen Capella: > > Initialize prev_tsc to cur_tsc. This avoids running the TX queue drain > > in the first iteration of the packet processing loop. > > Is it really a fix? What was broken? > Isn't it an optimization? It could be considered an optimization since effectively it prevents entering the if statement on the first iteration of the loop. I will remove the "fixes" line and reword the subject line. > > > Fixes: af75078fece3 ("first public release") > > If it's really a fix, we should probably backport it, so > Cc: sta...@dpdk.org [Kathleen Capella] It is not really a significant problem to be fixed in previous releases so it does not need to be backported. > > > Signed-off-by: Kathleen Capella > > Reviewed-by: Honnappa Nagarahalli > >
Re: [dpdk-dev] [EXT] [PATCH 02/25] event/dlb2: add DLB v2.5 probe-time hardware init
> -Original Message- > From: Jerin Jacob Kollanukkaran > Sent: Sunday, March 21, 2021 5:30 AM > To: McDaniel, Timothy ; dev@dpdk.org > Cc: Van Haaren, Harry ; m...@ashroe.eu; > nhor...@tuxdriver.com; Rao, Nikhil ; Carrillo, Erik G > ; Gujjar, Abhinandan S > ; Pavan Nikhilesh Bhagavatula > ; hemant.agra...@nxp.com; mattias.ronnblom > ; Mccarthy, Peter > > Subject: RE: [EXT] [PATCH 02/25] event/dlb2: add DLB v2.5 probe-time hardware > init > > > -Original Message- > > From: Timothy McDaniel > > Sent: Wednesday, March 17, 2021 3:49 AM > > To: dev@dpdk.org > > Cc: Jerin Jacob Kollanukkaran ; > > harry.van.haa...@intel.com; m...@ashroe.eu; nhor...@tuxdriver.com; > > nikhil@intel.com; erik.g.carri...@intel.com; > > abhinandan.guj...@intel.com; > > Pavan Nikhilesh Bhagavatula ; > > hemant.agra...@nxp.com; mattias.ronnb...@ericsson.com; > > peter.mccar...@intel.com > > Subject: [EXT] [PATCH 02/25] event/dlb2: add DLB v2.5 probe-time hardware > > init > > > Please simplify subject in all the patches like > event/dlb2: add v2.5 HW init > Will do > > > -- > > This commit adds support for DLB v2.5 probe-time hardware init, > > and sets up a framework for incorporating the remaining > > changes required to support DLB v2.5. > > > > DLB v2.0 and DLB v2.5 are similar in many respects, but their > > register offsets and definitions are different. As a result of these, > > differences, the low level hardware functions must take the devicei > > > s/devicei/device > fixed > > version into consideration. This requires that the hardware version be > > passed to many of the low level functions, so that the PMD can > > take the appropriate action based on the device version. > > > > To ease the transition and keep the individual patches small, three > > temporary files are added in this commit. These files have "new" > > in their names. The files with "new" contain changes specific to a > > consolidated PMD that supports both DLB v2.0 and DLB 2.5. Their sister > > files of the same name (minus "new") contain the old DLB v2.0 specific > > code. The intent is to remove code from the original files as that code > > is ported to the combined DLB 2.0/2.5 PMD model and added to the "new" > > files in a series of commits. At end of the patch series, the old files > > will be empty and the "new" files will have the logic needed > > to implement a single PMD that supports both DLB v2.0 and DLB v2.5. > > At that time, the original DLB v2.0 specific files will be deleted, > > and the "new" files will be renamed and replace them. > > > > Signed-off-by: Timothy McDaniel > > --- > > drivers/event/dlb2/dlb2_priv.h|5 + > > drivers/event/dlb2/meson.build|1 + > > .../event/dlb2/pf/base/dlb2_hw_types_new.h| 362 ++ > > drivers/event/dlb2/pf/base/dlb2_mbox.h|1 - > > drivers/event/dlb2/pf/base/dlb2_osdep.h |4 + > > drivers/event/dlb2/pf/base/dlb2_regs_new.h| 4412 + > > drivers/event/dlb2/pf/base/dlb2_resource.c| 180 +- > > drivers/event/dlb2/pf/base/dlb2_resource.h| 36 - > > .../event/dlb2/pf/base/dlb2_resource_new.c| 271 + > > .../event/dlb2/pf/base/dlb2_resource_new.h| 73 + > > drivers/event/dlb2/pf/dlb2_main.c | 41 +- > > drivers/event/dlb2/pf/dlb2_main.h |4 + > > drivers/event/dlb2/pf/dlb2_pf.c |6 +- > > 13 files changed, 5165 insertions(+), 231 deletions(-) > > create mode 100644 drivers/event/dlb2/pf/base/dlb2_hw_types_new.h > > create mode 100644 drivers/event/dlb2/pf/base/dlb2_regs_new.h > > create mode 100644 drivers/event/dlb2/pf/base/dlb2_resource_new.c > > create mode 100644 drivers/event/dlb2/pf/base/dlb2_resource_new.h > > > > +#ifdef FPGA > > Don't do this. Either detect the FPGA presence or make it devargs > > > +#define DLB2_HZ200 > > +#else > > +#define DLB2_HZ8 > > +#endif > > + > > + > > +/* TEMPORARY inclusion of both headers for merge */ > fixed > > Please make sure to remove this comments in sub sequent patches. > will do > > b/drivers/event/dlb2/pf/dlb2_main.h > > index f3bee71fb..01a24e8a4 100644 > > --- a/drivers/event/dlb2/pf/dlb2_main.h > > +++ b/drivers/event/dlb2/pf/dlb2_main.h > > @@ -15,7 +15,11 @@ > > #define PAGE_SIZE (sysconf(_SC_PAGESIZE)) > > Please use DPDK APIs for this. > done > > #endif
[dpdk-dev] [PATCH] drivers: add missing headers
These headers are used but not included explicitly, including them. "arpa/inet.h" is included for 'htons' and friends. "netinet/in.h" is included for 'IPPROTO_IP'. Signed-off-by: Ferruh Yigit --- drivers/crypto/dpaa_sec/dpaa_sec.c| 1 + drivers/event/octeontx/ssovf_worker.h | 2 ++ drivers/net/bnx2x/bnx2x.c | 1 + drivers/net/igc/igc_ethdev.h | 1 + drivers/net/igc/igc_txrx.c| 1 + drivers/net/netvsc/hn_ethdev.c| 1 + drivers/net/nfb/nfb_rx.h | 1 + drivers/net/pcap/rte_eth_pcap.c | 1 + drivers/net/pfe/pfe_hal.c | 2 ++ drivers/net/pfe/pfe_hif.c | 1 + drivers/net/sfc/sfc_tso.h | 2 ++ drivers/net/vmxnet3/vmxnet3_ethdev.h | 1 + 12 files changed, 15 insertions(+) diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index a4c4b094bbfa..43363ba6badd 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -20,6 +20,7 @@ #endif #include #include +#include #include #include #include diff --git a/drivers/event/octeontx/ssovf_worker.h b/drivers/event/octeontx/ssovf_worker.h index 6b2fb9b81741..4354f007d7e0 100644 --- a/drivers/event/octeontx/ssovf_worker.h +++ b/drivers/event/octeontx/ssovf_worker.h @@ -2,6 +2,8 @@ * Copyright(c) 2017 Cavium, Inc */ +#include + #include #include diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index 8eb6d609bdc3..654878d9dee8 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -23,6 +23,7 @@ #include #include +#include #include #include #include diff --git a/drivers/net/igc/igc_ethdev.h b/drivers/net/igc/igc_ethdev.h index a09debfb40c7..c1f0d057c9a7 100644 --- a/drivers/net/igc/igc_ethdev.h +++ b/drivers/net/igc/igc_ethdev.h @@ -6,6 +6,7 @@ #define _IGC_ETHDEV_H_ #include +#include #include "base/igc_osdep.h" #include "base/igc_hw.h" diff --git a/drivers/net/igc/igc_txrx.c b/drivers/net/igc/igc_txrx.c index c0a5d5e84f7b..9f73ab006f98 100644 --- a/drivers/net/igc/igc_txrx.c +++ b/drivers/net/igc/igc_txrx.c @@ -3,6 +3,7 @@ */ #include +#include #include #include #include diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index 04904b151441..eadae6fcbb35 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include diff --git a/drivers/net/nfb/nfb_rx.h b/drivers/net/nfb/nfb_rx.h index 27a2888a75c5..c9708259af17 100644 --- a/drivers/net/nfb/nfb_rx.h +++ b/drivers/net/nfb/nfb_rx.h @@ -11,6 +11,7 @@ #include #include +#include #include #define NFB_TIMESTAMP_FLAG (1 << 0) diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 28a5027315e2..ef50d088f354 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include diff --git a/drivers/net/pfe/pfe_hal.c b/drivers/net/pfe/pfe_hal.c index 0d25ec05232b..41d783dbfff2 100644 --- a/drivers/net/pfe/pfe_hal.c +++ b/drivers/net/pfe/pfe_hal.c @@ -2,6 +2,8 @@ * Copyright 2018-2019 NXP */ +#include + #include "pfe_logs.h" #include "pfe_mod.h" diff --git a/drivers/net/pfe/pfe_hif.c b/drivers/net/pfe/pfe_hif.c index be5b2ada16d1..c4a7154ba732 100644 --- a/drivers/net/pfe/pfe_hif.c +++ b/drivers/net/pfe/pfe_hif.c @@ -7,6 +7,7 @@ #include #include #include +#include static int pfe_hif_alloc_descr(struct pfe_hif *hif) diff --git a/drivers/net/sfc/sfc_tso.h b/drivers/net/sfc/sfc_tso.h index cfc09d1645fc..f081e856e1b1 100644 --- a/drivers/net/sfc/sfc_tso.h +++ b/drivers/net/sfc/sfc_tso.h @@ -10,6 +10,8 @@ #ifndef _SFC_TSO_H #define _SFC_TSO_H +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.h b/drivers/net/vmxnet3/vmxnet3_ethdev.h index 9d00f5d1279d..f93bb474b2cc 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.h +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.h @@ -6,6 +6,7 @@ #define _VMXNET3_ETHDEV_H_ #include +#include #define VMXNET3_MAX_MAC_ADDRS 1 -- 2.30.2
Re: [dpdk-dev] [PATCH v3] pflock: implementation of phase-fair reader writer locks
On Wed, 3 Mar 2021 11:19:45 -0800 Stephen Hemminger wrote: > This is a new type of reader-writer lock that provides better fairness > guarantees which makes it better for typical DPDK applications. > They lock internally uses two ticket pools, one for readers and one > for writers. > > Phase fair reader writer locks ensure that neither reader or writer will be > starved. Neither reader or writer are preferred, they execute in > alternating phases. All operations of the same time (reader or writer) > that try to acquire the lock are handled in FIFO order. Write > operations are exclusive, and multiple read operations can be run > together (until a write arrives). > > A similar implementation is in Concurrency Kit package in FreeBSD. > For more information see: >"Reader-Writer Synchronization for Shared-Memory Multiprocessor > Real-Time Systems", > http://www.cs.unc.edu/~anderson/papers/ecrts09b.pdf > > Signed-off-by: Stephen Hemminger Why has there been no review of this patch? The only complaint in patchwork is a bogus checkpatch warning about possible spelling error.
Re: [dpdk-dev] [PATCH v3 1/2] ethdev: replace callback getting filter operations
On 3/24/2021 6:05 PM, Ferruh Yigit wrote: On 3/21/2021 9:00 AM, Thomas Monjalon wrote: Since rte_flow is the only API for filtering operations, the legacy driver interface filter_ctrl was too much complicated for the simple task of getting the struct rte_flow_ops. The filter type RTE_ETH_FILTER_GENERIC and the filter operarion RTE_ETH_FILTER_GET are removed. The new driver callback flow_ops_get replaces filter_ctrl. Signed-off-by: Thomas Monjalon Acked-by: Ajit Khaparde Acked-by: Haiyue Wang Acked-by: Rosen Xu Acked-by: Hemant Agrawal Except from following minor issue, Reviewed-by: Ferruh Yigit --- a/drivers/net/dpaa2/dpaa2_flow.c +++ b/drivers/net/dpaa2/dpaa2_flow.c @@ -89,8 +89,6 @@ enum rte_flow_action_type dpaa2_supported_action_type[] = { /* Max of enum rte_flow_item_type + 1, for both IPv4 and IPv6*/ #define DPAA2_FLOW_ITEM_TYPE_GENERIC_IP (RTE_FLOW_ITEM_TYPE_META + 1) -enum rte_filter_type dpaa2_filter_type = RTE_ETH_FILTER_NONE; - Need to remove the 'dpaa2_filter_type' extern from 'dpaa2_ethdev.h' too. Applied to dpdk-next-net/main, thanks. (extern from 'dpaa2_ethdev.h' removed while merging) Only 1/2 merged, 2/2 can be discussed more or merged later.
[dpdk-dev] [PATCH] table: relax requirements for table entry action data
From: Churchill Khangar Currently, the table entry action data is required to be NULL when the action data size is zero. We now require that action data is ignored when the action data size is zero. This is to allow for a table entry instance to be allocated once with max action data size for the table and reused repeteadly for actions of different sizes, including zero. Signed-off-by: Cristian Dumitrescu Signed-off-by: Churchill Khangar --- lib/librte_pipeline/rte_swx_ctl.c | 3 +-- lib/librte_table/rte_swx_table.h | 9 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/librte_pipeline/rte_swx_ctl.c b/lib/librte_pipeline/rte_swx_ctl.c index 2e4538bd0..ca30767ef 100644 --- a/lib/librte_pipeline/rte_swx_ctl.c +++ b/lib/librte_pipeline/rte_swx_ctl.c @@ -338,8 +338,7 @@ table_entry_check(struct rte_swx_ctl_pipeline *ctl, /* action_data. */ a = &ctl->actions[entry->action_id]; - CHECK((a->data_size && entry->action_data) || - (!a->data_size && !entry->action_data), EINVAL); + CHECK(!(a->data_size && !entry->action_data), EINVAL); } return 0; diff --git a/lib/librte_table/rte_swx_table.h b/lib/librte_table/rte_swx_table.h index 00446718f..e23f2304c 100644 --- a/lib/librte_table/rte_swx_table.h +++ b/lib/librte_table/rte_swx_table.h @@ -101,10 +101,11 @@ struct rte_swx_table_entry { /** Action ID for the current entry. */ uint64_t action_id; - /** Action data for the current entry. Its size is defined by the action -* specified by the *action_id*. It must be NULL when the action data -* size of the *action_id* action is NULL. It must never exceed the -* *action_data_size* of the table. + /** Action data for the current entry. Considering S as the action data +* size of the *action_id* action, which must be less than or equal to +* the table *action_data_size*, the *action_data* field must point to +* an array of S bytes when S is non-zero. The *action_data* field is +* ignored when S is zero. */ uint8_t *action_data; }; -- 2.17.1
[dpdk-dev] [PATCH v2] table: relax requirements for table entry action data
From: Churchill Khangar Currently, the table entry action data is required to be NULL when the action data size is zero. We now require that action data is ignored when the action data size is zero. This is to allow for a table entry instance to be allocated once with max action data size for the table and reused repeatedly for actions of different sizes, including zero. Signed-off-by: Cristian Dumitrescu Signed-off-by: Churchill Khangar --- lib/librte_pipeline/rte_swx_ctl.c | 3 +-- lib/librte_table/rte_swx_table.h | 9 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/librte_pipeline/rte_swx_ctl.c b/lib/librte_pipeline/rte_swx_ctl.c index 2e4538bd0..ca30767ef 100644 --- a/lib/librte_pipeline/rte_swx_ctl.c +++ b/lib/librte_pipeline/rte_swx_ctl.c @@ -338,8 +338,7 @@ table_entry_check(struct rte_swx_ctl_pipeline *ctl, /* action_data. */ a = &ctl->actions[entry->action_id]; - CHECK((a->data_size && entry->action_data) || - (!a->data_size && !entry->action_data), EINVAL); + CHECK(!(a->data_size && !entry->action_data), EINVAL); } return 0; diff --git a/lib/librte_table/rte_swx_table.h b/lib/librte_table/rte_swx_table.h index 00446718f..e23f2304c 100644 --- a/lib/librte_table/rte_swx_table.h +++ b/lib/librte_table/rte_swx_table.h @@ -101,10 +101,11 @@ struct rte_swx_table_entry { /** Action ID for the current entry. */ uint64_t action_id; - /** Action data for the current entry. Its size is defined by the action -* specified by the *action_id*. It must be NULL when the action data -* size of the *action_id* action is NULL. It must never exceed the -* *action_data_size* of the table. + /** Action data for the current entry. Considering S as the action data +* size of the *action_id* action, which must be less than or equal to +* the table *action_data_size*, the *action_data* field must point to +* an array of S bytes when S is non-zero. The *action_data* field is +* ignored when S is zero. */ uint8_t *action_data; }; -- 2.17.1
[dpdk-dev] [PATCH] pipeline: validate header on emit
Enhance the behavior of the emit instruction to ignore invalid headers, as mandated by the P4 language specification. Signed-off-by: Cristian Dumitrescu --- lib/librte_pipeline/rte_swx_pipeline.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/librte_pipeline/rte_swx_pipeline.c b/lib/librte_pipeline/rte_swx_pipeline.c index 4455d9135..6a19b1450 100644 --- a/lib/librte_pipeline/rte_swx_pipeline.c +++ b/lib/librte_pipeline/rte_swx_pipeline.c @@ -3024,10 +3024,11 @@ __instr_hdr_emit_exec(struct rte_swx_pipeline *p, uint32_t n_emit) { struct thread *t = &p->threads[p->thread_id]; struct instruction *ip = t->ip; + uint64_t valid_headers = t->valid_headers; uint32_t n_headers_out = t->n_headers_out; struct header_out_runtime *ho = &t->headers_out[n_headers_out - 1]; uint8_t *ho_ptr = NULL; - uint32_t ho_nbytes = 0, i; + uint32_t ho_nbytes = 0, first = 1, i; for (i = 0; i < n_emit; i++) { uint32_t header_id = ip->io.hdr.header_id[i]; @@ -3037,12 +3038,17 @@ __instr_hdr_emit_exec(struct rte_swx_pipeline *p, uint32_t n_emit) struct header_runtime *hi = &t->headers[header_id]; uint8_t *hi_ptr = t->structs[struct_id]; + if (!MASK64_BIT_GET(valid_headers, header_id)) + continue; + TRACE("[Thread %2u]: emit header %u\n", p->thread_id, header_id); /* Headers. */ - if (!i) { + if (first) { + first = 0; + if (!t->n_headers_out) { ho = &t->headers_out[0]; -- 2.17.1
[dpdk-dev] [PATCH] app/test: fix IPv6 header initialization
Fix two issues found when writing PMD unit tests for HW ptype and L4 checksum offload: - The version field in the IPv6 header was being set to zero, which prevented hardware from recognizing it as IPv6. The IP version field is now set to six. - The payload_len field was being initialized using host byte order, which (among other things) resulted in incorrect L4 checksum computation. The payload_len field is now set using network (big-endian) byte order. Fixes: 92073ef961ee ("bond: unit tests") Cc: sta...@dpdk.org Signed-off-by: Lance Richardson --- app/test/packet_burst_generator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index f203f9d09e..8b390853a2 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -141,8 +141,8 @@ uint16_t initialize_ipv6_header(struct rte_ipv6_hdr *ip_hdr, uint8_t *src_addr, uint8_t *dst_addr, uint16_t pkt_data_len) { - ip_hdr->vtc_flow = 0; - ip_hdr->payload_len = pkt_data_len; + ip_hdr->vtc_flow = rte_cpu_to_be_32(0x6000); /* Set version to 6. */ + ip_hdr->payload_len = rte_cpu_to_be_16(pkt_data_len); ip_hdr->proto = IPPROTO_UDP; ip_hdr->hop_limits = IP_DEFTTL; -- 2.25.1
Re: [dpdk-dev] [PATCH v2] ethdev: introduce enable_driver_sdk to install driver headers
On Fri, Mar 26, 2021 at 12:02:55PM +, Ferruh Yigit wrote: > On 3/24/2021 4:24 PM, Tyler Retzlaff wrote: > >On Wed, Mar 24, 2021 at 12:30:36PM +0100, Thomas Monjalon wrote: > >>24/03/2021 12:27, Ferruh Yigit: > >>> > >>>But not sure how to manage the same problem for whole project, if install > >>>all > >>>headers in one patch, or add them gradually via separate patches by time > >>>... > >> > >>We did a cleanup in ethdev but not in other driver classes. > >>When the cleanup will be done gradually, the headers > >>must move in this new category driver_sdk_headers. > > > >yes, some headers are not installed now. so they need only to have > >their api marked __rte_internal and installed (since there should be no > >external consumer as a function of not being installed) > > > >the more difficult case is where headers were installed but the api were > >not marked __rte_internal and appear in the stable version.map. for > >those i guess deprecation notice has to be issued before marking as > >internal. > > > > Are you referring to any specific APIs, can you share list of them? i can't remember the whole list but Thomas originally indicated the following candidate list. baseband/ -> librte_bbdev/rte_bbdev_pmd.h bus/ -> rte_bus.h common/ -> no interface crypto/ -> librte_cryptodev/rte_cryptodev_pmd.h event/ -> librte_eventdev/ mempool/ -> librte_mempool/ net/ -> librte_ethdev/ raw/ -> librte_rawdev/rte_rawdev_pmd.h regex/ -> librte_regexdev/rte_regexdev_driver.h vdpa/ -> librte_vhost/rte_vdpa_dev.h some of these headers are not published, some are.
Re: [dpdk-dev] [PATCH v3 2/2] drivers/net: remove explicit include of legacy filtering
26/03/2021 16:37, Ferruh Yigit: > On 3/25/2021 10:20 AM, Thomas Monjalon wrote: > > 25/03/2021 11:00, Ferruh Yigit: > >> On 3/25/2021 5:53 AM, Andrew Rybchenko wrote: > >>> On 3/24/21 11:00 PM, Thomas Monjalon wrote: > 24/03/2021 19:08, Ferruh Yigit: > > On 3/21/2021 9:00 AM, Thomas Monjalon wrote: > >> The header file rte_eth_ctrl.h should not be needed because > >> this legacy filtering API is completely replaced with the rte_flow API. > >> However some definitions from this file are still used by some drivers, > >> but such usage is already covered by an implicit include via > >> rte_ethdev.h. > >> > >> Signed-off-by: Thomas Monjalon > >> Acked-by: Rosen Xu > >> Acked-by: Hemant Agrawal > >> --- > >> drivers/net/dpaa2/dpaa2_ptp.c | 1 - > >> drivers/net/iavf/iavf_hash.c| 1 - > >> drivers/net/ice/ice_acl_filter.c| 1 - > >> drivers/net/ice/ice_hash.c | 1 - > >> drivers/net/ice/ice_switch_filter.c | 1 - > >> drivers/net/igc/igc_filter.h| 1 - > >> drivers/net/ipn3ke/ipn3ke_flow.c| 1 - > > > > Although this will work, if the above drives are using the defines from > > the > > header file, isn't it better to include it explicitly? > > > > What is the benefit of including the header implicitly? > > The benefit is to progressively remove rte_eth_ctrl.h. > I want it to disappear. > > >>> > >>> +1 > >>> > >> > >> This is just hiding its usage, the patch is not making it less used as a > >> step > >> forward to remove it. > > > > Yes you're right. The only step forward is esthetic: > > hiding something which should be removed. > > And maybe some of these files don't need the include at all. > > > >> But anyway I guess it doesn't worth spending more time to discuss it ... > > > > Feel free to reject if you feel it is not a good step. > > > > What do you think doing exact opposite, > > remove "#include " from 'rte_ethdev.h', > and include 'rte_eth_ctrl.h' explicitly where ever it is required, > > this can make more clear what components use the 'rte_eth_ctrl.h' and why, > which > may help clearing them to remove the header. Plus it highlights if a new PMD > wants to use the header, we can catch it easier. > > When I tried above approach, it highlighted that not only drivers, libraries > also using this header, 'librte_ehtdev' & 'librte_flow_classify'. > And for 'ethdev', the structs defined in the 'rte_eth_ctrl.h' are part of > public > structs, so it is hard to remove them. > Some PMD specific APIs also needs 'rte_eth_ctrl.h' header, but that is hidden > because of the implicit include, but again some structs in the > 'rte_eth_ctrl.h' > are part of public APIs (although they are experimental). > > Also, it turned out that same required headers in the drivers are hidden > because > of this implicit include in 'rte_ethdev.h', I will send a fix for it soon. OK thanks
[dpdk-dev] [PATCH] pipeline: add drop instruction to the SWX pipeline
Enabled the TX instruction to accept an immediate value for the output port argument. The drop instruction is simply an alias to the TX instruction for the last output port of the pipeline. Signed-off-by: Cristian Dumitrescu --- examples/pipeline/examples/vxlan.spec | 3 +- lib/librte_pipeline/rte_swx_pipeline.c | 109 + 2 files changed, 96 insertions(+), 16 deletions(-) diff --git a/examples/pipeline/examples/vxlan.spec b/examples/pipeline/examples/vxlan.spec index b3f28630d..347dca29d 100644 --- a/examples/pipeline/examples/vxlan.spec +++ b/examples/pipeline/examples/vxlan.spec @@ -134,8 +134,7 @@ action vxlan_encap args instanceof vxlan_encap_args_t { } action drop args none { - mov m.port_out 4 - tx m.port_out + drop } // diff --git a/lib/librte_pipeline/rte_swx_pipeline.c b/lib/librte_pipeline/rte_swx_pipeline.c index 6a19b1450..48ac250c1 100644 --- a/lib/librte_pipeline/rte_swx_pipeline.c +++ b/lib/librte_pipeline/rte_swx_pipeline.c @@ -281,8 +281,11 @@ enum instruction_type { /* rx m.port_in */ INSTR_RX, - /* tx m.port_out */ - INSTR_TX, + /* tx port_out +* port_out = MI +*/ + INSTR_TX, /* port_out = M */ + INSTR_TX_I, /* port_out = I */ /* extract h.header */ INSTR_HDR_EXTRACT, @@ -582,9 +585,15 @@ struct instr_operand { struct instr_io { struct { - uint8_t offset; - uint8_t n_bits; - uint8_t pad[2]; + union { + struct { + uint8_t offset; + uint8_t n_bits; + uint8_t pad[2]; + }; + + uint32_t val; + }; } io; struct { @@ -2490,6 +2499,19 @@ metadata_free(struct rte_swx_pipeline *p) /* * Instruction. */ +static int +instruction_is_tx(enum instruction_type type) +{ + switch (type) { + case INSTR_TX: + case INSTR_TX_I: + return 1; + + default: + return 0; + } +} + static int instruction_is_jmp(struct instruction *instr) { @@ -2732,16 +2754,42 @@ instr_tx_translate(struct rte_swx_pipeline *p, struct instruction *instr, struct instruction_data *data __rte_unused) { + char *port = tokens[1]; struct field *f; + uint32_t port_val; CHECK(n_tokens == 2, EINVAL); - f = metadata_field_parse(p, tokens[1]); - CHECK(f, EINVAL); + f = metadata_field_parse(p, port); + if (f) { + instr->type = INSTR_TX; + instr->io.io.offset = f->offset / 8; + instr->io.io.n_bits = f->n_bits; + return 0; + } - instr->type = INSTR_TX; - instr->io.io.offset = f->offset / 8; - instr->io.io.n_bits = f->n_bits; + /* TX_I. */ + port_val = strtoul(port, &port, 0); + CHECK(!port[0], EINVAL); + + instr->type = INSTR_TX_I; + instr->io.io.val = port_val; + return 0; +} + +static int +instr_drop_translate(struct rte_swx_pipeline *p, +struct action *action __rte_unused, +char **tokens __rte_unused, +int n_tokens, +struct instruction *instr, +struct instruction_data *data __rte_unused) +{ + CHECK(n_tokens == 1, EINVAL); + + /* TX_I. */ + instr->type = INSTR_TX_I; + instr->io.io.val = p->n_ports_out - 1; return 0; } @@ -2829,6 +2877,30 @@ instr_tx_exec(struct rte_swx_pipeline *p) instr_rx_exec(p); } +static inline void +instr_tx_i_exec(struct rte_swx_pipeline *p) +{ + struct thread *t = &p->threads[p->thread_id]; + struct instruction *ip = t->ip; + uint64_t port_id = ip->io.io.val; + struct port_out_runtime *port = &p->out[port_id]; + struct rte_swx_pkt *pkt = &t->pkt; + + TRACE("[Thread %2u]: tx (i) 1 pkt to port %u\n", + p->thread_id, + (uint32_t)port_id); + + /* Headers. */ + emit_handler(t); + + /* Packet. */ + port->pkt_tx(port->obj, pkt); + + /* Thread. */ + thread_ip_reset(p, t); + instr_rx_exec(p); +} + /* * extract. */ @@ -7308,6 +7380,14 @@ instr_translate(struct rte_swx_pipeline *p, instr, data); + if (!strcmp(tokens[tpos], "drop")) + return instr_drop_translate(p, + action, + &tokens[tpos], + n_tokens - tpos, + instr, + data); + if (!strcmp(tokens[tpos], "extract")) return instr_hdr_extract_t
[dpdk-dev] [PATCH v4 00/10] eal: Add new API for threading
From: Narcisa Vasile EAL thread API **Problem Statement** DPDK currently uses the pthread interface to create and manage threads. Windows does not support the POSIX thread programming model, so it currently relies on a header file that hides the Windows calls under pthread matched interfaces. Given that EAL should isolate the environment specifics from the applications and libraries and mediate all the communication with the operating systems, a new EAL interface is needed for thread management. **Goals** * Introduce a generic EAL API for threading support that will remove the current Windows pthread.h shim. * Replace references to pthread_* across the DPDK codebase with the new RTE_THREAD_* API. * Allow users to choose between using the RTE_THREAD_* API or a 3rd party thread library through a configuration option. **Design plan** New API main files: * rte_thread.h (librte_eal/include) * rte_thread_types.h (librte_eal/include) * rte_thread_windows_types.h (librte_eal/windows/include) * rte_thread.c (librte_eal/windows) * rte_thread.c (librte_eal/common) For flexibility, the user is offered the option of either using the RTE_THREAD_* API or a 3rd party thread library, through a meson flag “use_external_thread_lib”. By default, this flag is set to FALSE, which means Windows libraries and applications will use the RTE_THREAD_* API for managing threads. If compiling on Windows and the “use_external_thread_lib” is *not* set, the following files will be parsed: * include/rte_thread.h * windows/include/rte_thread_windows_types.h * windows/rte_thread.c In all other cases, the compilation/parsing includes the following files: * include/rte_thread.h * include/rte_thread_types.h * common/rte_thread.c **A schematic example of the design** -- lib/librte_eal/include/rte_thread.h int rte_thread_create(); lib/librte_eal/common/rte_thread.c int rte_thread_create() { return pthread_create(); } lib/librte_eal/windows/rte_thread.c int rte_thread_create() { return CreateThread(); } lib/librte_eal/windows/meson.build if get_option('use_external_thread_lib') sources += 'librte_eal/common/rte_thread.c' else sources += 'librte_eal/windows/rte_thread.c' endif - **Thread attributes** When or after a thread is created, specific characteristics of the thread can be adjusted. Given that the thread characteristics that are of interest for DPDK applications are affinity and priority, the following structure that represents thread attributes has been defined: typedef struct { enum rte_thread_priority priority; rte_cpuset_t cpuset; } rte_thread_attr_t; The *rte_thread_create()* function can optionally receive an rte_thread_attr_t object that will cause the thread to be created with the affinity and priority described by the attributes object. If no rte_thread_attr_t is passed (parameter is NULL), the default affinity and priority are used. An rte_thread_attr_t object can also be set to the default values by calling *rte_thread_attr_init()*. *Priority* is represented through an enum that currently advertises two values for priority: - RTE_THREAD_PRIORITY_NORMAL - RTE_THREAD_PRIORITY_REALTIME_CRITICAL The enum can be extended to allow for multiple priority levels. rte_thread_set_priority - sets the priority of a thread rte_thread_attr_set_priority - updates an rte_thread_attr_t object with a new value for priority The user can choose thread priority through an EAL parameter, when starting an application. The two options above are available: --thread-prio normal --thread-prio realtime Example: ./dpdk-l2fwd -l 0-3 -n 4 –thread-prio normal -- -q 8 -p *Affinity* is described by the already known “rte_cpuset_t” type. rte_thread_attr_set/get_affinity - sets/gets the affinity field in a rte_thread_attr_t object rte_thread_set/get_affinity – sets/gets the affinity of a thread **Errors** A translation function that maps Windows error codes to errno-style error codes is provided. **Future work** Note that this patchset was focused on introducing new API that will remove the Windows pthread.h shim. In DPDK, there are still a few references to pthread_* that were not implemented in the shim. The long term plan is for EAL to provide full threading support: * Adding support for conditional variables * Additional functionality offered by pthread_* (such as pthread_setname_np, etc.) * Static mutex initializers are not used on Windows. If we must continue using them, they need to be platform dependent and an implementation will need to be provided for Windows. v4: - fix function description - rebase v3: - rebase v2: - revert changes that break ABI - break up changes into smaller patches - fix coding style issues - fix issues with errors - fix parameter type in examples/kn
[dpdk-dev] [PATCH v4 02/10] eal: add thread attributes
From: Narcisa Vasile Implement thread attributes for: * thread affinity * thread priority Implement functions for managing thread attributes. Signed-off-by: Narcisa Vasile --- lib/librte_eal/common/rte_thread.c| 53 lib/librte_eal/include/rte_thread.h | 82 +++ lib/librte_eal/include/rte_thread_types.h | 3 + .../include/rte_windows_thread_types.h| 3 + lib/librte_eal/windows/rte_thread.c | 56 + 5 files changed, 197 insertions(+) diff --git a/lib/librte_eal/common/rte_thread.c b/lib/librte_eal/common/rte_thread.c index 5ec382949..0bd1b115d 100644 --- a/lib/librte_eal/common/rte_thread.c +++ b/lib/librte_eal/common/rte_thread.c @@ -29,6 +29,59 @@ rte_thread_equal(rte_thread_t t1, rte_thread_t t2) return pthread_equal(t1, t2); } +int +rte_thread_attr_init(rte_thread_attr_t *attr) +{ + if (attr == NULL) { + RTE_LOG(DEBUG, EAL, "Invalid thread attributes parameter\n"); + return EINVAL; + } + + CPU_ZERO(&attr->cpuset); + attr->priority = RTE_THREAD_PRIORITY_NORMAL; + + return 0; +} + +int +rte_thread_attr_set_affinity(rte_thread_attr_t *thread_attr, +rte_cpuset_t *cpuset) +{ + if (thread_attr == NULL || cpuset == NULL) { + RTE_LOG(DEBUG, EAL, "Invalid thread attributes parameter\n"); + return EINVAL; + } + thread_attr->cpuset = *cpuset; + return 0; +} + +int +rte_thread_attr_get_affinity(rte_thread_attr_t *thread_attr, +rte_cpuset_t *cpuset) +{ + if ((thread_attr == NULL) || (cpuset == NULL)) { + RTE_LOG(DEBUG, EAL, "Invalid thread attributes parameter\n"); + return EINVAL; + } + + *cpuset = thread_attr->cpuset; + return 0; +} + +int +rte_thread_attr_set_priority(rte_thread_attr_t *thread_attr, +enum rte_thread_priority priority) +{ + if (thread_attr == NULL) { + RTE_LOG(DEBUG, EAL, + "Unable to set priority attribute, invalid parameter\n"); + return EINVAL; + } + + thread_attr->priority = priority; + return 0; +} + int rte_thread_key_create(rte_thread_key *key, void (*destructor)(void *)) { diff --git a/lib/librte_eal/include/rte_thread.h b/lib/librte_eal/include/rte_thread.h index cbc07f739..bfdd8e1b1 100644 --- a/lib/librte_eal/include/rte_thread.h +++ b/lib/librte_eal/include/rte_thread.h @@ -28,6 +28,19 @@ extern "C" { #include #endif +enum rte_thread_priority { + RTE_THREAD_PRIORITY_NORMAL= EAL_THREAD_PRIORITY_NORMAL, + RTE_THREAD_PRIORITY_REALTIME_CRITICAL = EAL_THREAD_PRIORITY_REALTIME_CIRTICAL, + /* +* This enum can be extended to allow more priority levels. +*/ +}; + +typedef struct { + enum rte_thread_priority priority; + rte_cpuset_t cpuset; +} rte_thread_attr_t; + /** * TLS key type, an opaque pointer. */ @@ -60,6 +73,75 @@ rte_thread_t rte_thread_self(void); __rte_experimental int rte_thread_equal(rte_thread_t t1, rte_thread_t t2); +/** + * Initialize the attributes of a thread. + * These attributes can be passed to the rte_thread_create() function + * that will create a new thread and set its attributes according to attr; + * + * @param attr + * Thread attributes to initialize. + * + * @return + * On success, return 0. + * On failure, return a positive errno-style error number. + */ +__rte_experimental +int rte_thread_attr_init(rte_thread_attr_t *attr); + +/** + * Set the CPU affinity value in the thread attributes pointed to + * by 'thread_attr'. + * + * @param thread_attr + * Points to the thread attributes in which affinity will be updated. + * + * @param cpuset + * Points to the value of the affinity to be set. + * + * @return + * On success, return 0. + * On failure, return a positive errno-style error number. + */ +__rte_experimental +int rte_thread_attr_set_affinity(rte_thread_attr_t *thread_attr, +rte_cpuset_t *cpuset); + +/** + * Get the value of CPU affinity that is set in the thread attributes pointed + * to by 'thread_attr'. + * + * @param thread_attr + * Points to the thread attributes from which affinity will be retrieved. + * + * @param cpuset + * Pointer to the memory that will store the affinity. + * + * @return + * On success, return 0. + * On failure, return a positive errno-style error number. + */ +__rte_experimental +int rte_thread_attr_get_affinity(rte_thread_attr_t *thread_attr, +rte_cpuset_t *cpuset); + +/** + * Set the thread priority value in the thread attributes pointed to + * by 'thread_attr'. + * + * @param thread_attr + * Points to the thread attributes in which priority will be updated. + * + * @param priority + * Points to the value of the priority to be set. + * + * @return + *
[dpdk-dev] [PATCH v4 04/10] eal: implement functions for thread affinity management
From: Narcisa Vasile Implement functions for getting/setting thread affinity. Signed-off-by: Narcisa Vasile Signed-off-by: Dmitry Malloy --- lib/librte_eal/common/rte_thread.c | 13 ++ lib/librte_eal/include/rte_thread.h | 41 +++ lib/librte_eal/windows/eal_lcore.c | 170 +++ lib/librte_eal/windows/eal_windows.h | 10 ++ lib/librte_eal/windows/rte_thread.c | 132 - 5 files changed, 318 insertions(+), 48 deletions(-) diff --git a/lib/librte_eal/common/rte_thread.c b/lib/librte_eal/common/rte_thread.c index 0bd1b115d..4f93e3ff1 100644 --- a/lib/librte_eal/common/rte_thread.c +++ b/lib/librte_eal/common/rte_thread.c @@ -29,6 +29,19 @@ rte_thread_equal(rte_thread_t t1, rte_thread_t t2) return pthread_equal(t1, t2); } +int +rte_thread_set_affinity_by_id(rte_thread_t thread_id, size_t cpuset_size, + const rte_cpuset_t *cpuset) +{ + return pthread_setaffinity_np(thread_id, cpuset_size, cpuset); +} + +int rte_thread_get_affinity_by_id(rte_thread_t threadid, size_t cpuset_size, + rte_cpuset_t *cpuset) +{ + return pthread_getaffinity_np(threadid, cpuset_size, cpuset); +} + int rte_thread_attr_init(rte_thread_attr_t *attr) { diff --git a/lib/librte_eal/include/rte_thread.h b/lib/librte_eal/include/rte_thread.h index bfdd8e1b1..ed8330f81 100644 --- a/lib/librte_eal/include/rte_thread.h +++ b/lib/librte_eal/include/rte_thread.h @@ -73,6 +73,47 @@ rte_thread_t rte_thread_self(void); __rte_experimental int rte_thread_equal(rte_thread_t t1, rte_thread_t t2); +/** + * Set the affinity of thread 'thread_id' to the cpu set + * specified by 'cpuset'. + * + * @param thread_id + *Id of the thread for which to set the affinity. + * + * @param cpuset_size + * + * @param cpuset + * Pointer to CPU affinity to set. + * + * @return + * On success, return 0. + * On failure, return a positive errno-style error number. + */ +__rte_experimental +int rte_thread_set_affinity_by_id(rte_thread_t thread_id, size_t cpuset_size, + const rte_cpuset_t *cpuset); + +/** + * Get the affinity of thread 'thread_id' and store it + * in 'cpuset'. + * + * @param thread_id + *Id of the thread for which to get the affinity. + * + * @param cpuset_size + *Size of the cpu set. + * + * @param cpuset + * Pointer for storing the affinity value. + * + * @return + * On success, return 0. + * On failure, return a positive errno-style error number. + */ +__rte_experimental +int rte_thread_get_affinity_by_id(rte_thread_t thread_id, size_t cpuset_size, + rte_cpuset_t *cpuset); + /** * Initialize the attributes of a thread. * These attributes can be passed to the rte_thread_create() function diff --git a/lib/librte_eal/windows/eal_lcore.c b/lib/librte_eal/windows/eal_lcore.c index a85149be9..023c5c895 100644 --- a/lib/librte_eal/windows/eal_lcore.c +++ b/lib/librte_eal/windows/eal_lcore.c @@ -2,7 +2,6 @@ * Copyright(c) 2019 Intel Corporation */ -#include #include #include @@ -28,13 +27,15 @@ struct socket_map { }; struct cpu_map { - unsigned int socket_count; unsigned int lcore_count; + unsigned int socket_count; + unsigned int cpu_count; struct lcore_map lcores[RTE_MAX_LCORE]; struct socket_map sockets[RTE_MAX_NUMA_NODES]; + GROUP_AFFINITY cpus[CPU_SETSIZE]; }; -static struct cpu_map cpu_map = { 0 }; +static struct cpu_map cpu_map; /* eal_create_cpu_map() is called before logging is initialized */ static void @@ -48,13 +49,111 @@ log_early(const char *format, ...) va_end(va); } +static int +eal_query_group_affinity(void) +{ + SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *infos = NULL; + DWORD infos_size = 0; + int ret = 0; + + if (!GetLogicalProcessorInformationEx(RelationGroup, NULL, + &infos_size)) { + DWORD error = GetLastError(); + if (error != ERROR_INSUFFICIENT_BUFFER) { + log_early("Cannot get group information size, " + "error %lu\n", error); + rte_errno = EINVAL; + ret = -1; + goto cleanup; + } + } + + infos = malloc(infos_size); + if (infos == NULL) { + log_early("Cannot allocate memory for NUMA node information\n"); + rte_errno = ENOMEM; + ret = -1; + goto cleanup; + } + + if (!GetLogicalProcessorInformationEx(RelationGroup, infos, + &infos_size)) { + log_early("Cannot get group information, error %lu\n", + GetLastError()); + rte_errno = EINVAL; + ret = -1; + goto cleanup; + } + + cpu_map.cpu_count = 0; + USHO
[dpdk-dev] [PATCH v4 01/10] eal: add thread id and simple thread functions
From: Narcisa Vasile Add the thread identifier type. Add functions for comparing thread ids and obtaining the thread id for the current thread. Signed-off-by: Narcisa Vasile --- lib/librte_eal/common/rte_thread.c| 101 ++ lib/librte_eal/include/rte_thread.h | 45 ++-- lib/librte_eal/include/rte_thread_types.h | 12 +++ .../include/rte_windows_thread_types.h| 12 +++ lib/librte_eal/windows/rte_thread.c | 13 +++ 5 files changed, 174 insertions(+), 9 deletions(-) create mode 100644 lib/librte_eal/common/rte_thread.c create mode 100644 lib/librte_eal/include/rte_thread_types.h create mode 100644 lib/librte_eal/windows/include/rte_windows_thread_types.h diff --git a/lib/librte_eal/common/rte_thread.c b/lib/librte_eal/common/rte_thread.c new file mode 100644 index 0..5ec382949 --- /dev/null +++ b/lib/librte_eal/common/rte_thread.c @@ -0,0 +1,101 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2021 Mellanox Technologies, Ltd + * Copyright(c) 2021 Microsoft Corporation + */ + +#include +#include +#include +#include + +#include +#include +#include +#include + +struct eal_tls_key { + pthread_key_t thread_index; +}; + +rte_thread_t +rte_thread_self(void) +{ + return pthread_self(); +} + +int +rte_thread_equal(rte_thread_t t1, rte_thread_t t2) +{ + return pthread_equal(t1, t2); +} + +int +rte_thread_key_create(rte_thread_key *key, void (*destructor)(void *)) +{ + int err; + rte_thread_key k; + + k = malloc(sizeof(*k)); + if (k == NULL) { + RTE_LOG(DEBUG, EAL, "Cannot allocate TLS key.\n"); + return EINVAL; + } + err = pthread_key_create(&(k->thread_index), destructor); + if (err != 0) { + RTE_LOG(DEBUG, EAL, "pthread_key_create failed: %s\n", +strerror(err)); + free(k); + return err; + } + *key = k; + return 0; +} + +int +rte_thread_key_delete(rte_thread_key key) +{ + int err; + + if (key == NULL) { + RTE_LOG(DEBUG, EAL, "Invalid TLS key.\n"); + return EINVAL; + } + err = pthread_key_delete(key->thread_index); + if (err != 0) { + RTE_LOG(DEBUG, EAL, "pthread_key_delete failed: %s\n", +strerror(err)); + free(key); + return err; + } + free(key); + return 0; +} + +int +rte_thread_value_set(rte_thread_key key, const void *value) +{ + int err; + + if (key == NULL) { + RTE_LOG(DEBUG, EAL, "Invalid TLS key.\n"); + return EINVAL; + } + err = pthread_setspecific(key->thread_index, value); + if (err != 0) { + RTE_LOG(DEBUG, EAL, "pthread_setspecific failed: %s\n", + strerror(err)); + return err; + } + return 0; +} + +void * +rte_thread_value_get(rte_thread_key key) +{ + if (key == NULL) { + RTE_LOG(DEBUG, EAL, "Invalid TLS key.\n"); + rte_errno = EINVAL; + return NULL; + } + return pthread_getspecific(key->thread_index); +} diff --git a/lib/librte_eal/include/rte_thread.h b/lib/librte_eal/include/rte_thread.h index 8be8ed8f3..cbc07f739 100644 --- a/lib/librte_eal/include/rte_thread.h +++ b/lib/librte_eal/include/rte_thread.h @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2021 Mellanox Technologies, Ltd + * Copyright(c) 2021 Microsoft Corporation */ #include @@ -20,6 +21,13 @@ extern "C" { #endif +#include +#if defined(RTE_USE_WINDOWS_THREAD_TYPES) +#include +#else +#include +#endif + /** * TLS key type, an opaque pointer. */ @@ -27,6 +35,31 @@ typedef struct eal_tls_key *rte_thread_key; #ifdef RTE_HAS_CPUSET +/** + * Get the id of the calling thread. + * + * @return + * Return the thread id of the calling thread. + */ +__rte_experimental +rte_thread_t rte_thread_self(void); + +/** + * Check if 2 thread ids are equal. + * + * @param t1 + * First thread id. + * + * @param t2 + * Second thread id. + * + * @return + * If the ids are equal, return nonzero. + * Otherwise, return 0. + */ +__rte_experimental +int rte_thread_equal(rte_thread_t t1, rte_thread_t t2); + /** * Set core affinity of the current thread. * Support both EAL and non-EAL thread and update TLS. @@ -63,9 +96,7 @@ void rte_thread_get_affinity(rte_cpuset_t *cpusetp); * * @return * On success, zero. - * On failure, a negative number and an error number is set in rte_errno. - * rte_errno can be: ENOMEM - Memory allocation error. - * ENOEXEC - Specific OS error. + * On failure, return a positive errno-style error number. */ __rte_experimental @@ -80,9 +111,7 @@ int rte_thread_key_create(rte_thread_key *key, * * @return * On success, zero. - * On failure, a negative nu
[dpdk-dev] [PATCH v4 03/10] windows/eal: translate Windows errors to errno-style errors
From: Narcisa Vasile Add function to translate Windows error codes to errno-style error codes. Signed-off-by: Narcisa Vasile --- lib/librte_eal/windows/rte_thread.c | 65 ++--- 1 file changed, 50 insertions(+), 15 deletions(-) diff --git a/lib/librte_eal/windows/rte_thread.c b/lib/librte_eal/windows/rte_thread.c index b29336cbd..e9181b47f 100644 --- a/lib/librte_eal/windows/rte_thread.c +++ b/lib/librte_eal/windows/rte_thread.c @@ -12,6 +12,47 @@ struct eal_tls_key { DWORD thread_index; }; +/* Translates the most common error codes related to threads */ +static int rte_thread_translate_win32_error(DWORD error) +{ + switch (error) { + case ERROR_SUCCESS: + return 0; + + case ERROR_INVALID_PARAMETER: + return EINVAL; + + case ERROR_INVALID_HANDLE: + return EFAULT; + + case ERROR_NOT_ENOUGH_MEMORY: + /* FALLTHROUGH */ + case ERROR_NO_SYSTEM_RESOURCES: + return ENOMEM; + + case ERROR_PRIVILEGE_NOT_HELD: + /* FALLTHROUGH */ + case ERROR_ACCESS_DENIED: + return EACCES; + + case ERROR_ALREADY_EXISTS: + return EEXIST; + + case ERROR_POSSIBLE_DEADLOCK: + return EDEADLK; + + case ERROR_INVALID_FUNCTION: + /* FALLTHROUGH */ + case ERROR_CALL_NOT_IMPLEMENTED: + return ENOSYS; + + default: + return EINVAL; + } + + return EINVAL; +} + rte_thread_t rte_thread_self(void) { @@ -87,15 +128,13 @@ rte_thread_key_create(rte_thread_key *key, *key = malloc(sizeof(**key)); if ((*key) == NULL) { RTE_LOG(DEBUG, EAL, "Cannot allocate TLS key.\n"); - rte_errno = ENOMEM; - return -1; + return ENOMEM; } (*key)->thread_index = TlsAlloc(); if ((*key)->thread_index == TLS_OUT_OF_INDEXES) { RTE_LOG_WIN32_ERR("TlsAlloc()"); free(*key); - rte_errno = ENOEXEC; - return -1; + return rte_thread_translate_win32_error(GetLastError()); } return 0; } @@ -103,16 +142,14 @@ rte_thread_key_create(rte_thread_key *key, int rte_thread_key_delete(rte_thread_key key) { - if (!key) { + if (key == NULL) { RTE_LOG(DEBUG, EAL, "Invalid TLS key.\n"); - rte_errno = EINVAL; - return -1; + return EINVAL; } if (!TlsFree(key->thread_index)) { RTE_LOG_WIN32_ERR("TlsFree()"); free(key); - rte_errno = ENOEXEC; - return -1; + return rte_thread_translate_win32_error(GetLastError()); } free(key); return 0; @@ -123,17 +160,15 @@ rte_thread_value_set(rte_thread_key key, const void *value) { char *p; - if (!key) { + if (key == NULL) { RTE_LOG(DEBUG, EAL, "Invalid TLS key.\n"); - rte_errno = EINVAL; - return -1; + return EINVAL; } /* discard const qualifier */ p = (char *) (uintptr_t) value; if (!TlsSetValue(key->thread_index, p)) { RTE_LOG_WIN32_ERR("TlsSetValue()"); - rte_errno = ENOEXEC; - return -1; + return rte_thread_translate_win32_error(GetLastError()); } return 0; } @@ -143,7 +178,7 @@ rte_thread_value_get(rte_thread_key key) { void *output; - if (!key) { + if (key == NULL) { RTE_LOG(DEBUG, EAL, "Invalid TLS key.\n"); rte_errno = EINVAL; return NULL; -- 2.30.0.vfs.0.2
[dpdk-dev] [PATCH v4 05/10] eal: implement thread priority management functions
From: Narcisa Vasile Add function for setting the priority for a thread. Signed-off-by: Narcisa Vasile --- lib/librte_eal/common/rte_thread.c | 25 ++ lib/librte_eal/include/rte_thread.h | 17 +++ lib/librte_eal/windows/rte_thread.c | 76 + 3 files changed, 118 insertions(+) diff --git a/lib/librte_eal/common/rte_thread.c b/lib/librte_eal/common/rte_thread.c index 4f93e3ff1..26c5b1f3c 100644 --- a/lib/librte_eal/common/rte_thread.c +++ b/lib/librte_eal/common/rte_thread.c @@ -42,6 +42,31 @@ int rte_thread_get_affinity_by_id(rte_thread_t threadid, size_t cpuset_size, return pthread_getaffinity_np(threadid, cpuset_size, cpuset); } +int +rte_thread_set_priority(rte_thread_t thread_id, + enum rte_thread_priority priority) +{ + int policy; + struct sched_param param = { + .sched_priority = 0, + }; + + + if (priority == RTE_THREAD_PRIORITY_REALTIME_CRITICAL) { + policy = SCHED_RR; + param.sched_priority = priority; + } else if (priority == RTE_THREAD_PRIORITY_NORMAL) { + policy = SCHED_OTHER; + param.sched_priority = priority; + } else { + RTE_LOG(DEBUG, EAL, "Invalid priority to set." + "Defaulting to priority 'normal'.\n"); + policy = SCHED_OTHER; + } + + return pthread_setschedparam(thread_id, policy, ¶m); +} + int rte_thread_attr_init(rte_thread_attr_t *attr) { diff --git a/lib/librte_eal/include/rte_thread.h b/lib/librte_eal/include/rte_thread.h index ed8330f81..34948dd90 100644 --- a/lib/librte_eal/include/rte_thread.h +++ b/lib/librte_eal/include/rte_thread.h @@ -114,6 +114,23 @@ __rte_experimental int rte_thread_get_affinity_by_id(rte_thread_t thread_id, size_t cpuset_size, rte_cpuset_t *cpuset); +/** + * Set the priority of a thread. + * + * @param thread_id + *Id of the thread for which to set priority. + * + * @param priority + * Priority value to be set. + * + * @return + * On success, return 0. + * On failure, return a positive errno-style error number. + */ +__rte_experimental +int rte_thread_set_priority(rte_thread_t thread_id, + enum rte_thread_priority priority); + /** * Initialize the attributes of a thread. * These attributes can be passed to the rte_thread_create() function diff --git a/lib/librte_eal/windows/rte_thread.c b/lib/librte_eal/windows/rte_thread.c index d60a3ded5..544aaf33d 100644 --- a/lib/librte_eal/windows/rte_thread.c +++ b/lib/librte_eal/windows/rte_thread.c @@ -193,6 +193,82 @@ rte_thread_get_affinity_by_id(rte_thread_t thread_id, size_t cpuset_size, return ret; } +static HANDLE +get_process_handle_from_thread_handle(HANDLE thread_handle) +{ + DWORD process_id = 0; + + process_id = GetProcessIdOfThread(thread_handle); + if (process_id == 0) { + RTE_LOG_WIN32_ERR("GetProcessIdOfThread()"); + return NULL; + } + + return OpenProcess(PROCESS_SET_INFORMATION, FALSE, process_id); +} + +int +rte_thread_set_priority(rte_thread_t thread_id, + enum rte_thread_priority priority) +{ + HANDLE thread_handle = NULL; + HANDLE process_handle = NULL; + DWORD priority_class = NORMAL_PRIORITY_CLASS; + int ret = 0; + + thread_handle = OpenThread(THREAD_SET_INFORMATION | + THREAD_QUERY_INFORMATION, FALSE, thread_id); + if (thread_handle == NULL) { + ret = rte_thread_translate_win32_error(GetLastError()); + RTE_LOG_WIN32_ERR("OpenThread()"); + goto cleanup; + } + + switch (priority) { + + case RTE_THREAD_PRIORITY_REALTIME_CRITICAL: + priority_class = REALTIME_PRIORITY_CLASS; + break; + + case RTE_THREAD_PRIORITY_NORMAL: + /* FALLTHROUGH */ + default: + priority_class = NORMAL_PRIORITY_CLASS; + priority = RTE_THREAD_PRIORITY_NORMAL; + break; + } + + process_handle = get_process_handle_from_thread_handle(thread_handle); + if (process_handle == NULL) { + ret = rte_thread_translate_win32_error(GetLastError()); + RTE_LOG_WIN32_ERR("get_process_handle_from_thread_handle()"); + goto cleanup; + } + + if (!SetPriorityClass(process_handle, priority_class)) { + ret = rte_thread_translate_win32_error(GetLastError()); + RTE_LOG_WIN32_ERR("SetPriorityClass()"); + goto cleanup; + } + + if (!SetThreadPriority(thread_handle, priority)) { + ret = rte_thread_translate_win32_error(GetLastError()); + RTE_LOG_WIN32_ERR("SetThreadPriority()"); + goto cleanup; + } + +cleanup: + if (thread_handle != NULL) { +
[dpdk-dev] [PATCH v4 07/10] eal: implement functions for mutex management
From: Narcisa Vasile Add functions for mutex init, destroy, lock, unlock. Signed-off-by: Narcisa Vasile --- lib/librte_eal/common/rte_thread.c| 24 + lib/librte_eal/include/rte_thread.h | 53 +++ lib/librte_eal/include/rte_thread_types.h | 3 ++ .../include/rte_windows_thread_types.h| 1 + lib/librte_eal/windows/rte_thread.c | 28 ++ 5 files changed, 109 insertions(+) diff --git a/lib/librte_eal/common/rte_thread.c b/lib/librte_eal/common/rte_thread.c index 29d38d193..8e963ed65 100644 --- a/lib/librte_eal/common/rte_thread.c +++ b/lib/librte_eal/common/rte_thread.c @@ -220,6 +220,30 @@ rte_thread_join(rte_thread_t thread_id, int *value_ptr) return 0; } +int +rte_thread_mutex_init(rte_thread_mutex_t *mutex) +{ + return pthread_mutex_init(mutex, NULL); +} + +int +rte_thread_mutex_lock(rte_thread_mutex_t *mutex) +{ + return pthread_mutex_lock(mutex); +} + +int +rte_thread_mutex_unlock(rte_thread_mutex_t *mutex) +{ + return pthread_mutex_unlock(mutex); +} + +int +rte_thread_mutex_destroy(rte_thread_mutex_t *mutex) +{ + return pthread_mutex_destroy(mutex); +} + int rte_thread_cancel(rte_thread_t thread_id) { /* diff --git a/lib/librte_eal/include/rte_thread.h b/lib/librte_eal/include/rte_thread.h index 24dc186f1..2b8d81005 100644 --- a/lib/librte_eal/include/rte_thread.h +++ b/lib/librte_eal/include/rte_thread.h @@ -240,6 +240,58 @@ int rte_thread_create(rte_thread_t *thread_id, __rte_experimental int rte_thread_join(rte_thread_t thread_id, int *value_ptr); +/** + * Initializes a mutex. + * + * @param mutex + *The mutex to be initialized. + * + * @return + * On success, return 0. + * On failure, return a positive errno-style error number. + */ +__rte_experimental +int rte_thread_mutex_init(rte_thread_mutex_t *mutex); + +/** + * Locks a mutex. + * + * @param mutex + *The mutex to be locked. + * + * @return + * On success, return 0. + * On failure, return a positive errno-style error number. + */ +__rte_experimental +int rte_thread_mutex_lock(rte_thread_mutex_t *mutex); + +/** + * Unlocks a mutex. + * + * @param mutex + *The mutex to be unlocked. + * + * @return + * On success, return 0. + * On failure, return a positive errno-style error number. + */ +__rte_experimental +int rte_thread_mutex_unlock(rte_thread_mutex_t *mutex); + +/** + * Releases all resources associated with a mutex. + * + * @param mutex + *The mutex to be uninitialized. + * + * @return + * On success, return 0. + * On failure, return a positive errno-style error number. + */ +__rte_experimental +int rte_thread_mutex_destroy(rte_thread_mutex_t *mutex); + /** * Terminates a thread. * @@ -259,6 +311,7 @@ int rte_thread_cancel(rte_thread_t thread_id); * * @param cpusetp * Pointer to CPU affinity to set. + * * @return * On success, return 0; otherwise return -1; */ diff --git a/lib/librte_eal/include/rte_thread_types.h b/lib/librte_eal/include/rte_thread_types.h index a884daf17..37bc7af2b 100644 --- a/lib/librte_eal/include/rte_thread_types.h +++ b/lib/librte_eal/include/rte_thread_types.h @@ -7,9 +7,12 @@ #include +#define RTE_THREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER + #define EAL_THREAD_PRIORITY_NORMAL 0 #define EAL_THREAD_PRIORITY_REALTIME_CIRTICAL99 typedef pthread_t rte_thread_t; +typedef pthread_mutex_t rte_thread_mutex_t; #endif /* _RTE_THREAD_TYPES_H_ */ diff --git a/lib/librte_eal/windows/include/rte_windows_thread_types.h b/lib/librte_eal/windows/include/rte_windows_thread_types.h index 8cb4b3856..47c6b2664 100644 --- a/lib/librte_eal/windows/include/rte_windows_thread_types.h +++ b/lib/librte_eal/windows/include/rte_windows_thread_types.h @@ -11,5 +11,6 @@ #define EAL_THREAD_PRIORITY_REALTIME_CIRTICAL THREAD_PRIORITY_TIME_CRITICAL typedef DWORD rte_thread_t; +typedef CRITICAL_SECTIONrte_thread_mutex_t; #endif /* _RTE_THREAD_TYPES_H_ */ diff --git a/lib/librte_eal/windows/rte_thread.c b/lib/librte_eal/windows/rte_thread.c index 85b11c5f5..a26b8c08f 100644 --- a/lib/librte_eal/windows/rte_thread.c +++ b/lib/librte_eal/windows/rte_thread.c @@ -417,6 +417,34 @@ rte_thread_join(rte_thread_t thread_id, int *value_ptr) return ret; } +int +rte_thread_mutex_init(rte_thread_mutex_t *mutex) +{ + InitializeCriticalSection(mutex); + return 0; +} + +int +rte_thread_mutex_lock(rte_thread_mutex_t *mutex) +{ + EnterCriticalSection(mutex); + return 0; +} + +int +rte_thread_mutex_unlock(rte_thread_mutex_t *mutex) +{ + LeaveCriticalSection(mutex); + return 0; +} + +int +rte_thread_mutex_destroy(rte_thread_mutex_t *mutex) +{ + DeleteCriticalSection(mutex); + return 0; +} + int rte_thread_cancel(rte_thread_t thread_id) { -- 2.30.0.vfs.0.2
[dpdk-dev] [PATCH v4 06/10] eal: add thread lifetime management
From: Narcisa Vasile Add function for thread creation, join, canceling. Signed-off-by: Narcisa Vasile --- lib/librte_eal/common/rte_thread.c | 110 lib/librte_eal/include/rte_thread.h | 53 lib/librte_eal/windows/rte_thread.c | 125 3 files changed, 288 insertions(+) diff --git a/lib/librte_eal/common/rte_thread.c b/lib/librte_eal/common/rte_thread.c index 26c5b1f3c..29d38d193 100644 --- a/lib/librte_eal/common/rte_thread.c +++ b/lib/librte_eal/common/rte_thread.c @@ -120,6 +120,116 @@ rte_thread_attr_set_priority(rte_thread_attr_t *thread_attr, return 0; } +int +rte_thread_create(rte_thread_t *thread_id, + const rte_thread_attr_t *thread_attr, + void *(*thread_func)(void *), void *args) +{ + int ret = 0; + pthread_attr_t attr; + pthread_attr_t *attrp = NULL; + struct sched_param param = { + .sched_priority = 0, + }; + int policy = SCHED_OTHER; + + if (thread_attr != NULL) { + ret = pthread_attr_init(&attr); + if (ret != 0) { + RTE_LOG(DEBUG, EAL, "pthread_attr_init failed\n"); + goto cleanup; + } + + attrp = &attr; + + /* +* Set the inherit scheduler parameter to explicit, +* otherwise the priority attribute is ignored. +*/ + ret = pthread_attr_setinheritsched(attrp, + PTHREAD_EXPLICIT_SCHED); + if (ret != 0) { + RTE_LOG(DEBUG, EAL, "pthread_attr_setinheritsched failed\n"); + goto cleanup; + } + + /* +* In case a realtime scheduling policy is requested, +* the sched_priority parameter is set to the value stored in +* thread_attr. Otherwise, for the default scheduling policy +* (SCHED_OTHER) sched_priority needs to be initialized to 0. +*/ + if (thread_attr->priority == RTE_THREAD_PRIORITY_REALTIME_CRITICAL) { + policy = SCHED_RR; + param.sched_priority = thread_attr->priority; + } + + ret = pthread_attr_setschedpolicy(attrp, policy); + if (ret != 0) { + RTE_LOG(DEBUG, EAL, "pthread_attr_setschedpolicy failed\n"); + goto cleanup; + } + + ret = pthread_attr_setschedparam(attrp, ¶m); + if (ret != 0) { + RTE_LOG(DEBUG, EAL, "pthread_attr_setschedparam failed\n"); + goto cleanup; + } + + ret = pthread_attr_setaffinity_np(attrp, + sizeof(thread_attr->cpuset), + &thread_attr->cpuset); + if (ret != 0) { + RTE_LOG(DEBUG, EAL, "pthread_attr_setaffinity_np failed\n"); + goto cleanup; + } + } + + ret = pthread_create(thread_id, attrp, thread_func, args); + if (ret != 0) { + RTE_LOG(DEBUG, EAL, "pthread_create failed\n"); + goto cleanup; + } + +cleanup: + if (attrp != NULL) + pthread_attr_destroy(&attr); + + return ret; +} + +int +rte_thread_join(rte_thread_t thread_id, int *value_ptr) +{ + int ret = 0; + void *res = NULL; + void **pres = NULL; + + if (value_ptr != NULL) + pres = &res; + + ret = pthread_join(thread_id, pres); + if (ret != 0) { + RTE_LOG(DEBUG, EAL, "pthread_join failed\n"); + return ret; + } + + if (pres != NULL) + *value_ptr = *(int *)(*pres); + + return 0; +} + +int rte_thread_cancel(rte_thread_t thread_id) +{ + /* +* TODO: Behavior is different between POSIX and Windows threads. +* POSIX threads wait for a cancellation point. +* Current Windows emulation kills thread at any point. +*/ + return pthread_cancel(thread_id); +} + int rte_thread_key_create(rte_thread_key *key, void (*destructor)(void *)) { diff --git a/lib/librte_eal/include/rte_thread.h b/lib/librte_eal/include/rte_thread.h index 34948dd90..24dc186f1 100644 --- a/lib/librte_eal/include/rte_thread.h +++ b/lib/librte_eal/include/rte_thread.h @@ -200,6 +200,59 @@ __rte_experimental int rte_thread_attr_set_priority(rte_thread_attr_t *thread_attr, enum rte_thread_priority priority); +/** + * Create a new thread that will invoke the 'thread_func' routine. + * + * @param thread_id + *A pointer that will store the id of the newly created thread. + * + * @param thread_attr + *Attributes that
[dpdk-dev] [PATCH v4 08/10] eal: implement functions for thread barrier management
From: Narcisa Vasile Add functions for barrier init, destroy, wait. Signed-off-by: Narcisa Vasile --- lib/librte_eal/common/rte_thread.c| 16 +++ lib/librte_eal/include/rte_thread.h | 46 +++ lib/librte_eal/include/rte_thread_types.h | 2 + .../include/rte_windows_thread_types.h| 3 ++ lib/librte_eal/windows/rte_thread.c | 27 +++ 5 files changed, 94 insertions(+) diff --git a/lib/librte_eal/common/rte_thread.c b/lib/librte_eal/common/rte_thread.c index 8e963ed65..d23d3b868 100644 --- a/lib/librte_eal/common/rte_thread.c +++ b/lib/librte_eal/common/rte_thread.c @@ -244,6 +244,22 @@ rte_thread_mutex_destroy(rte_thread_mutex_t *mutex) return pthread_mutex_destroy(mutex); } +int +rte_thread_barrier_init(rte_thread_barrier_t *barrier, int count) +{ + return pthread_barrier_init(barrier, NULL, count); +} + +int rte_thread_barrier_wait(rte_thread_barrier_t *barrier) +{ + return pthread_barrier_wait(barrier); +} + +int rte_thread_barrier_destroy(rte_thread_barrier_t *barrier) +{ + return pthread_barrier_destroy(barrier); +} + int rte_thread_cancel(rte_thread_t thread_id) { /* diff --git a/lib/librte_eal/include/rte_thread.h b/lib/librte_eal/include/rte_thread.h index 2b8d81005..5b4da8053 100644 --- a/lib/librte_eal/include/rte_thread.h +++ b/lib/librte_eal/include/rte_thread.h @@ -292,6 +292,52 @@ int rte_thread_mutex_unlock(rte_thread_mutex_t *mutex); __rte_experimental int rte_thread_mutex_destroy(rte_thread_mutex_t *mutex); +/** + * Initializes a synchronization barrier. + * + * @param barrier + *A pointer that references the newly created 'barrier' object. + * + * @param count + *The number of threads that must enter the barrier before + *the threads can continue execution. + * + * @return + * On success, return 0. + * On failure, return a positive errno-style error number. + */ +__rte_experimental +int rte_thread_barrier_init(rte_thread_barrier_t *barrier, int count); + +/** + * Causes the calling thread to wait at the synchronization barrier 'barrier'. + * + * @param barrier + *The barrier used for synchronizing the threads. + * + * @return + * Return RTE_THREAD_BARRIER_SERIAL_THREAD for the thread synchronized + * at the barrier. + * Return 0 for all other threads. + * Return a positive errno-style error number, in case of failure. + */ +__rte_experimental +int rte_thread_barrier_wait(rte_thread_barrier_t *barrier); + +/** + * Releases all resources used by a synchronization barrier + * and uninitializes it. + * + * @param barrier + *The barrier to be destroyed. + * + * @return + * On success, return 0. + * On failure, return a positive errno-style error number. + */ +__rte_experimental +int rte_thread_barrier_destroy(rte_thread_barrier_t *barrier); + /** * Terminates a thread. * diff --git a/lib/librte_eal/include/rte_thread_types.h b/lib/librte_eal/include/rte_thread_types.h index 37bc7af2b..b055bbf67 100644 --- a/lib/librte_eal/include/rte_thread_types.h +++ b/lib/librte_eal/include/rte_thread_types.h @@ -7,6 +7,7 @@ #include +#define RTE_THREAD_BARRIER_SERIAL_THREAD PTHREAD_BARRIER_SERIAL_THREAD #define RTE_THREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER #define EAL_THREAD_PRIORITY_NORMAL 0 @@ -14,5 +15,6 @@ typedef pthread_t rte_thread_t; typedef pthread_mutex_t rte_thread_mutex_t; +typedef pthread_barrier_t rte_thread_barrier_t; #endif /* _RTE_THREAD_TYPES_H_ */ diff --git a/lib/librte_eal/windows/include/rte_windows_thread_types.h b/lib/librte_eal/windows/include/rte_windows_thread_types.h index 47c6b2664..b6209e6eb 100644 --- a/lib/librte_eal/windows/include/rte_windows_thread_types.h +++ b/lib/librte_eal/windows/include/rte_windows_thread_types.h @@ -7,10 +7,13 @@ #include +#define RTE_THREAD_BARRIER_SERIAL_THREAD TRUE + #define EAL_THREAD_PRIORITY_NORMAL THREAD_PRIORITY_NORMAL #define EAL_THREAD_PRIORITY_REALTIME_CIRTICAL THREAD_PRIORITY_TIME_CRITICAL typedef DWORD rte_thread_t; typedef CRITICAL_SECTIONrte_thread_mutex_t; +typedef SYNCHRONIZATION_BARRIER rte_thread_barrier_t; #endif /* _RTE_THREAD_TYPES_H_ */ diff --git a/lib/librte_eal/windows/rte_thread.c b/lib/librte_eal/windows/rte_thread.c index a26b8c08f..c3c198663 100644 --- a/lib/librte_eal/windows/rte_thread.c +++ b/lib/librte_eal/windows/rte_thread.c @@ -445,6 +445,33 @@ rte_thread_mutex_destroy(rte_thread_mutex_t *mutex) return 0; } +int +rte_thread_barrier_init(rte_thread_barrier_t *barrier, int count) +{ + int ret = 0; + + if (!InitializeSynchronizationBarrier(barrier, count, -1)) { + ret = rte_thread_translate_win32_error(GetLastError()); + RTE_LOG_WIN32_ERR("InitializeSynchronizationBarrier()"); + return ret; + } + return 0; +} + +int
[dpdk-dev] [PATCH v4 09/10] eal: add EAL argument for setting thread priority
From: Narcisa Vasile Allow the user to choose the thread priority through an EAL command line argument. The user can select the thread priority to be either 'normal' or 'critical': --thread-prio normal --thread-prio realtime Signed-off-by: Narcisa Vasile --- lib/librte_eal/common/eal_common_options.c | 28 +- lib/librte_eal/common/eal_internal_cfg.h | 2 ++ lib/librte_eal/common/eal_options.h| 2 ++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index 622c7bc42..287a89a75 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -106,6 +106,7 @@ eal_long_options[] = { {OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM}, {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM }, {OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, OPT_FORCE_MAX_SIMD_BITWIDTH_NUM}, + {OPT_THREAD_PRIORITY, 1, NULL, OPT_THREAD_PRIORITY_NUM}, /* legacy options that will be removed in future */ {OPT_PCI_BLACKLIST, 1, NULL, OPT_PCI_BLACKLIST_NUM}, @@ -1383,6 +1384,24 @@ eal_parse_simd_bitwidth(const char *arg) return 0; } +static int +eal_parse_thread_priority(const char *arg) +{ + struct internal_config *internal_conf = + eal_get_internal_configuration(); + enum rte_thread_priority priority; + + if (!strncmp("normal", arg, sizeof("normal"))) + priority = RTE_THREAD_PRIORITY_NORMAL; + else if (!strncmp("realtime", arg, sizeof("realtime"))) + priority = RTE_THREAD_PRIORITY_REALTIME_CRITICAL; + else + return -1; + + internal_conf->thread_priority = priority; + return 0; +} + static int eal_parse_base_virtaddr(const char *arg) { @@ -1796,7 +1815,13 @@ eal_parse_common_option(int opt, const char *optarg, return -1; } break; - + case OPT_THREAD_PRIORITY_NUM: + if (eal_parse_thread_priority(optarg) < 0) { + RTE_LOG(ERR, EAL, "invalid parameter for --" + OPT_THREAD_PRIORITY "\n"); + return -1; + } + break; /* don't know what to do, leave this to caller */ default: return 1; @@ -2059,6 +2084,7 @@ eal_common_usage(void) " (can be used multiple times)\n" " --"OPT_VMWARE_TSC_MAP"Use VMware TSC map instead of native RDTSC\n" " --"OPT_PROC_TYPE" Type of this process (primary|secondary|auto)\n" + " --"OPT_THREAD_PRIORITY" Set threads priority (normal|realtime)\n" #ifndef RTE_EXEC_ENV_WINDOWS " --"OPT_SYSLOG"Set syslog facility\n" #endif diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h index 51dbe86e2..7ab1d0008 100644 --- a/lib/librte_eal/common/eal_internal_cfg.h +++ b/lib/librte_eal/common/eal_internal_cfg.h @@ -93,6 +93,8 @@ struct internal_config { unsigned int no_telemetry; /**< true to disable Telemetry */ struct simd_bitwidth max_simd_bitwidth; /**< max simd bitwidth path to use */ + enum rte_thread_priority thread_priority; + /**< thread priority to configure */ }; void eal_reset_internal_config(struct internal_config *internal_cfg); diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h index 7b348e707..9f5b209f6 100644 --- a/lib/librte_eal/common/eal_options.h +++ b/lib/librte_eal/common/eal_options.h @@ -93,6 +93,8 @@ enum { OPT_NO_TELEMETRY_NUM, #define OPT_FORCE_MAX_SIMD_BITWIDTH "force-max-simd-bitwidth" OPT_FORCE_MAX_SIMD_BITWIDTH_NUM, +#define OPT_THREAD_PRIORITY "thread-prio" + OPT_THREAD_PRIORITY_NUM, /* legacy option that will be removed in future */ #define OPT_PCI_BLACKLIST "pci-blacklist" -- 2.30.0.vfs.0.2
[dpdk-dev] [PATCH V3 1/3] config/arm: add Hisilicon kunpeng implementer
Here adds configs for Kunpeng server. Fixes: 91c730fd4e09 ("config/arm: remove unused or superfluous variables") Signed-off-by: Chengchang Tang Signed-off-by: Lijun Ou Acked-by: Jerin Jacob Reviewed-by: Ruifeng Wang --- V2->V3: - refined the commit - merge [1/4] and [2/4] into one. V1->V2: - rewrite patch title. - split the patch into two. --- config/arm/meson.build | 27 +++ 1 file changed, 27 insertions(+) diff --git a/config/arm/meson.build b/config/arm/meson.build index 00bc461..a3f42c3 100644 --- a/config/arm/meson.build +++ b/config/arm/meson.build @@ -133,6 +133,32 @@ implementer_cavium = { } } +implementer_hisilicon = { + 'description': 'Hisilicon', + 'flags': [ + ['RTE_USE_C11_MEM_MODEL', true], + ['RTE_CACHE_LINE_SIZE', 128], + ['RTE_MAX_NUMA_NODES', 4] + ], + 'part_number_config': { + '0xd01': { + 'machine_args': ['-march=armv8.2-a+crypto', +'-mtune=tsv110'], + 'flag': [['RTE_MACHINE', '"kunpeng920"'], +['RTE_MAX_LCORE', 128], +['RTE_ARM_FEATURE_ATOMICS', true] + ] + }, + '0xd02': { + 'machine_args': ['-march=armv8.2-a+crypto+sve'], + 'flag': [['RTE_MACHINE', '"kunpeng930"'], +['RTE_MAX_LCORE', 256], +['RTE_ARM_FEATURE_ATOMICS', true] + ] + } + } +} + implementer_ampere = { 'description': 'Ampere Computing', 'flags': [ @@ -190,6 +216,7 @@ implementers = { 'generic': implementer_generic, '0x41': implementer_arm, '0x43': implementer_cavium, + '0x48': implementer_hisilicon, '0x50': implementer_ampere, '0x51': implementer_qualcomm, '0x56': implementer_marvell, -- 2.7.4
[dpdk-dev] [PATCH V3 2/3] config/arm: add kunpeng920 cross target
Add support for Hisilicon kunpeng920 cross target. Signed-off-by: Chengchang Tang Signed-off-by: Lijun Ou Acked-by: Jerin Jacob Reviewed-by: Ruifeng Wang --- V2->V3: - rewrite title - rewrite commit log - add Acked-by and Reviewed-by --- config/arm/arm64_kunpeng920_linux_gcc | 19 +++ doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst | 4 2 files changed, 23 insertions(+) create mode 100644 config/arm/arm64_kunpeng920_linux_gcc diff --git a/config/arm/arm64_kunpeng920_linux_gcc b/config/arm/arm64_kunpeng920_linux_gcc new file mode 100644 index 000..3eeb2e9 --- /dev/null +++ b/config/arm/arm64_kunpeng920_linux_gcc @@ -0,0 +1,19 @@ +[binaries] +c = 'aarch64-linux-gnu-gcc' +cpp = 'aarch64-linux-gnu-cpp' +ar = 'aarch64-linux-gnu-gcc-ar' +strip = 'aarch64-linux-gnu-strip' +pkgconfig = 'aarch64-linux-gnu-pkg-config' +pcap-config = '' + +[host_machine] +system = 'linux' +cpu_family = 'aarch64' +cpu = 'armv8-a' +endian = 'little' + +[properties] +implementer_id = '0x48' +part_number = '0xd01' +max_lcores = 128 +max_numa_nodes = 4 diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst index faaf24b..afe4f8e 100644 --- a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst +++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst @@ -197,6 +197,7 @@ you may use various combinations of implementer/part number:: 'generic': Generic armv8 '0x41':Arm '0x43':Cavium + '0x48':Hisilicon '0x50':Ampere Computing '0x56':Marvell ARMADA 'dpaa':NXP DPAA @@ -219,6 +220,9 @@ you may use various combinations of implementer/part number:: '0xaf':thunderx2t99 '0xb2':octeontx2 + Supported part_numbers for 0x48: + '0xd01':kunpeng920 + Supported part_numbers for 0x50: '0x0': emag -- 2.7.4