[PATCH v3] net/ice: add devargs for disabling default mac
From: "ke1x.zhang" Add the feature that support to disable default mac which will be used by ice driver when setting dpdk_devargs config field. Default mac is not disabled in default, user can choose to disable the default mac by setting ``devargs`` parameter ``default-mac-disable``, for example:: -a 80:00.0,default-mac-disable=1 Signed-off-by: ke1x.zhang --- doc/guides/nics/ice.rst | 11 +++ drivers/net/ice/ice_ethdev.c | 21 ++--- drivers/net/ice/ice_ethdev.h | 1 + 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst index ce075e067c..860ed1430d 100644 --- a/doc/guides/nics/ice.rst +++ b/doc/guides/nics/ice.rst @@ -105,6 +105,17 @@ Runtime Config Options -a 80:00.0,pipeline-mode-support=1 +- ``Default Mac Disable`` (default ``0``) + + Add the feature that support to disable default mac which will be used by ice driver + when setting dpdk_devargs config field. + + Default mac is not disabled in default, user can choose to disable the default mac + by setting ``devargs`` parameter ``default-mac-disable``, + for example:: + +-a 80:00.0,default-mac-disable=1 + - ``Protocol extraction for per queue`` Configure the RX queues to do protocol extraction into mbuf for protocol diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 0bc739daf0..0d011bbffa 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -28,6 +28,7 @@ /* devargs */ #define ICE_SAFE_MODE_SUPPORT_ARG "safe-mode-support" #define ICE_PIPELINE_MODE_SUPPORT_ARG "pipeline-mode-support" +#define ICE_DEFAULT_MAC_DISABLE "default-mac-disable" #define ICE_PROTO_XTR_ARG "proto_xtr" #define ICE_FIELD_OFFS_ARG "field_offs" #define ICE_FIELD_NAME_ARG "field_name" @@ -49,6 +50,7 @@ static const char * const ice_valid_args[] = { ICE_HW_DEBUG_MASK_ARG, ICE_ONE_PPS_OUT_ARG, ICE_RX_LOW_LATENCY_ARG, + ICE_DEFAULT_MAC_DISABLE, NULL }; @@ -916,6 +918,7 @@ static int ice_init_mac_address(struct rte_eth_dev *dev) { struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct ice_adapter *ad = (struct ice_adapter *)hw->back; if (!rte_is_unicast_ether_addr ((struct rte_ether_addr *)hw->port_info[0].mac.lan_addr)) { @@ -935,9 +938,9 @@ ice_init_mac_address(struct rte_eth_dev *dev) return -ENOMEM; } /* store it to dev data */ - rte_ether_addr_copy( - (struct rte_ether_addr *)hw->port_info[0].mac.perm_addr, - &dev->data->mac_addrs[0]); + if (ad->devargs.default_mac_disable != 1) + rte_ether_addr_copy((struct rte_ether_addr *)hw->port_info[0].mac.perm_addr, + &dev->data->mac_addrs[0]); return 0; } @@ -962,8 +965,14 @@ ice_add_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *mac_addr) struct ice_mac_filter *f; struct LIST_HEAD_TYPE list_head; struct ice_hw *hw = ICE_VSI_TO_HW(vsi); + struct ice_adapter *ad = (struct ice_adapter *)hw->back; int ret = 0; + if (ad->devargs.default_mac_disable == 1 && rte_is_same_ether_addr(mac_addr, + (struct rte_ether_addr *)hw->port_info[0].mac.perm_addr)) { + PMD_DRV_LOG(ERR, "This Default MAC filter is disabled."); + return 0; + } /* If it's added and configured, return */ f = ice_find_mac_filter(vsi, mac_addr); if (f) { @@ -2075,6 +2084,11 @@ static int ice_parse_devargs(struct rte_eth_dev *dev) if (ret) goto bail; + ret = rte_kvargs_process(kvlist, ICE_DEFAULT_MAC_DISABLE, + &parse_bool, &ad->devargs.default_mac_disable); + if (ret) + goto bail; + ret = rte_kvargs_process(kvlist, ICE_HW_DEBUG_MASK_ARG, &parse_u64, &ad->hw.debug_mask); if (ret) @@ -6050,6 +6064,7 @@ RTE_PMD_REGISTER_PARAM_STRING(net_ice, ICE_PROTO_XTR_ARG "=[queue:]" ICE_SAFE_MODE_SUPPORT_ARG "=<0|1>" ICE_PIPELINE_MODE_SUPPORT_ARG "=<0|1>" + ICE_DEFAULT_MAC_DISABLE "=<0|1>" ICE_RX_LOW_LATENCY_ARG "=<0|1>"); RTE_LOG_REGISTER_SUFFIX(ice_logtype_init, init, NOTICE); diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index c8311be179..9140f3af79 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -563,6 +563,7 @@ struct ice_devargs { int safe_mode_support; uint8_t proto_xtr_dflt; int pipe_mode_support; + uint8_t default_mac_disable; uint8_t proto_xtr[ICE_MAX_QUEUE_NUM]; uint8_t pin_idx; uint8_t pps_out_ena; -- 2.34.1
RE: [RFC PATCH 0/7] support vfio platform PMD
Hi Chenbo, >-Original Message- >From: Xia, Chenbo >Sent: Friday, December 23, 2022 8:05 AM >To: Tomasz Duszynski ; dev@dpdk.org >Cc: tho...@monjalon.net; Jerin Jacob Kollanukkaran >Subject: [EXT] RE: [RFC PATCH 0/7] support vfio platform PMD > >External Email > >-- >> -Original Message- >> From: Tomasz Duszynski >> Sent: Friday, December 23, 2022 7:24 AM >> To: dev@dpdk.org >> Cc: tho...@monjalon.net; jer...@marvell.com; Tomasz Duszynski >> >> Subject: [RFC PATCH 0/7] support vfio platform PMD >> >> This series aims to add support for managing vfio platform devices >> from userspace application conveniently i.e without going through the >> configuration required by vfio and opencoding everything. Instead >> convenience helpers are provided. >> >> vfio platform devices, from the kernel standpoint, are ones that do >> not have built-in discovery capabilities and are behind an IOMMU. >> >> This PMD is backed by both vfio-platform and vfio kernel drivers and >> ideally should give access to all vfio capabilities. As of now, access >> to memory maps and DMA are supported. >> >> PMD requires platform bus support [1]. >> >> [1] >> https://urldefense.proofpoint.com/v2/url?u=https-3A__lore.kernel.org_d >> pdk-2Ddev_20221222000106.270619-2D1-2D&d=DwIFAg&c=nKjWec2b6R0mOyPaz7xt >> fQ&r=PZNXgrbjdlXxVEEGYkxIxRndyEUwWU_ad5ce22YI6Is&m=D9rwjUu4gMDK-DA_YvF >> eU6OBKRUXqZVQ7Nfg3O4xldhUMqQsXQx4AM9La3PpF1Bd&s=L93CKF1oLmgSm7z50nWbVf >> 4FFDww_noCSxOENlbfXGY&e= >> tduszyn...@marvell.com/ > >I have not looked into all details. But just wondering: why not making this >part of the platform >bus. This seems generic and then vendors can have their own platform drivers. > Valid point. I'll rethink current approach. >Thanks, >Chenbo
Re: [PATCH v3 0/1] baseband/acc: changes for 23.03
Hi Hernan, On 1/11/23 17:57, Hernan Vargas wrote: v3: Remove unused mempool header. v2: Reordered commits and added one more fix. v1: Upstreaming ACC100 changes for 23.03. Hernan Vargas (1): baseband/acc: acc100 ignore missing mempools drivers/baseband/acc/rte_acc100_pmd.c | 9 - 1 file changed, 9 deletions(-) Please resend the full series, including the R-by I gave on other patches. Regards, Maxime
Re: [PATCH v3 1/4] ethdev: add trace points
15/12/2022 07:49, Jerin Jacob: > On Wed, Dec 14, 2022 at 5:40 PM Ferruh Yigit wrote: > > > > On 12/14/2022 10:40 AM, Jerin Jacob wrote: > > > On Wed, Dec 14, 2022 at 1:37 AM Ferruh Yigit wrote: > > >> 4) Why we need to export trace point variables in the .map files, > > >> like '__rte_eth_trace_allmulticast_disable' one... > > > > > > If you see app/test/test_trace.c example > > > > > > There are two-way to operate on trace point, We need to export symbol > > > iff we need option 1 > > > > > > option1: > > > rte_trace_point_enable(&__app_dpdk_test_tp); > > > > > > option2: > > > rte_trace_point_t *trace = rte_trace_point_lookup("app.dpdk.test.tp"); > > > rte_trace_point_enable(trace); > > > > > > > got it, do we really need direct access to trace point (option 1), I > > would be OK to remove that option to not expose all these trace point > > objects. > > Looks good to me. I would like to see a policy regarding trace symbols. If we decide option 1 is not so useful, then we should not export trace symbols at all and document this policy. Also there are some trace symbols which could be cleaned up.
[PATCH] lib/net: support UDP pseudo-header for UFO
Add UDP pseudo-header processing for UDP segmentation offload by adding the UDP_SEG flag. Signed-off-by: Zhichao Zeng --- lib/net/rte_ip.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h index 9c8e8206f0..4761ede747 100644 --- a/lib/net/rte_ip.h +++ b/lib/net/rte_ip.h @@ -345,7 +345,7 @@ rte_ipv4_phdr_cksum(const struct rte_ipv4_hdr *ipv4_hdr, uint64_t ol_flags) psd_hdr.dst_addr = ipv4_hdr->dst_addr; psd_hdr.zero = 0; psd_hdr.proto = ipv4_hdr->next_proto_id; - if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) { + if (ol_flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG)) { psd_hdr.len = 0; } else { l3_len = rte_be_to_cpu_16(ipv4_hdr->total_length); -- 2.25.1
[PATCH] net/iavf: fix building data desc
Build correct data desc for UFO pkt by adding UDP_SEG flag, and disable L4 checksum offload when TSO/UFO is enabled to prevent the MDD. Fixes: 1e728b01120c ("net/iavf: rework Tx path") Cc: sta...@dpdk.org Signed-off-by: Zhichao Zeng --- drivers/net/iavf/iavf_rxtx.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 8d49967538..3d9224b38d 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -2619,10 +2619,21 @@ iavf_build_data_desc_cmd_offset_fields(volatile uint64_t *qw1, offset |= (m->l3_len >> 2) << IAVF_TX_DESC_LENGTH_IPLEN_SHIFT; } - if (m->ol_flags & RTE_MBUF_F_TX_TCP_SEG) { - command |= IAVF_TX_DESC_CMD_L4T_EOFT_TCP; + if (m->ol_flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG)) { + if (m->ol_flags & RTE_MBUF_F_TX_TCP_SEG) + command |= IAVF_TX_DESC_CMD_L4T_EOFT_TCP; + else + command |= IAVF_TX_DESC_CMD_L4T_EOFT_UDP; offset |= (m->l4_len >> 2) << IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; + + *qw1 = rte_cpu_to_le_64uint64_t)command << + IAVF_TXD_DATA_QW1_CMD_SHIFT) & IAVF_TXD_DATA_QW1_CMD_MASK) | + (((uint64_t)offset << IAVF_TXD_DATA_QW1_OFFSET_SHIFT) & + IAVF_TXD_DATA_QW1_OFFSET_MASK) | + ((uint64_t)l2tag1 << IAVF_TXD_DATA_QW1_L2TAG1_SHIFT)); + + return; } /* Enable L4 checksum offloads */ -- 2.25.1
trace point symbols
> From: Thomas Monjalon [mailto:tho...@monjalon.net] > Sent: Thursday, 12 January 2023 10.11 > > 15/12/2022 07:49, Jerin Jacob: > > On Wed, Dec 14, 2022 at 5:40 PM Ferruh Yigit > wrote: > > > > > > On 12/14/2022 10:40 AM, Jerin Jacob wrote: > > > > On Wed, Dec 14, 2022 at 1:37 AM Ferruh Yigit > wrote: > > > >> 4) Why we need to export trace point variables in the .map > files, > > > >> like '__rte_eth_trace_allmulticast_disable' one... > > > > > > > > If you see app/test/test_trace.c example > > > > > > > > There are two-way to operate on trace point, We need to export > symbol > > > > iff we need option 1 > > > > > > > > option1: > > > > rte_trace_point_enable(&__app_dpdk_test_tp); > > > > > > > > option2: > > > > rte_trace_point_t *trace = > rte_trace_point_lookup("app.dpdk.test.tp"); > > > > rte_trace_point_enable(trace); rte_trace_point_enable() allows passing a NULL pointer, so enabling a trace point can still be a one-liner: rte_trace_point_enable(rte_trace_point_lookup("app.dpdk.test.tp")); With option2, we lose the build-time error if trying to enable a non-existing trace point. But it's an acceptable tradeoff. > > > > > > > > > > got it, do we really need direct access to trace point (option 1), > I > > > would be OK to remove that option to not expose all these trace > point > > > objects. > > > > Looks good to me. > > I would like to see a policy regarding trace symbols. > If we decide option 1 is not so useful, > then we should not export trace symbols at all and document this > policy. > Also there are some trace symbols which could be cleaned up. +1 for not exposing trace point symbols at all. The trace point symbols are only used internally by DPDK, so they should not be part of DPDK's public API. It might also make it easier for Bruce to move the trace library out of EAL. I'm not familiar with the CTF format, but I assume that if we don't expose the trace point symbols, the trace points can still be identified when parsing the trace file.
RE: [EXT] Re: [PATCH v2 2/3] graph: pcap capture for graph nodes
Hi Stephen, > -Original Message- > From: Stephen Hemminger > Sent: Wednesday, January 11, 2023 9:37 PM > To: Amit Prakash Shukla > Cc: Jerin Jacob Kollanukkaran ; Kiran Kumar > Kokkilagadda ; Nithin Kumar Dabilpuram > ; dev@dpdk.org > Subject: [EXT] Re: [PATCH v2 2/3] graph: pcap capture for graph nodes > > External Email > > -- > On Wed, 11 Jan 2023 14:23:41 +0530 > Amit Prakash Shukla wrote: > > > + > > +#define PCAP_DUMP_DATA(dbuf, buf_size, cur_len, sbuf, len) > > \ > > +do { > > \ > > + if ((cur_len + len) >= buf_size) \ > > + break; \ > > + rte_memcpy(dbuf + cur_len, sbuf, len); \ > > + cur_len += len; \ > > +} while (0) > > + > > Why do you need this to be a macro. > Macro's are evil, have side effects and hide code. I had added macro for future, if lot of custom data is to be added to pcapng. Anyways I will remove it in next version of patch. > > > +uint16_t > > +rte_graph_pcap_trace_dispatch(struct rte_graph *graph __rte_unused, > > + struct rte_node *node, void **objs, > > + uint16_t nb_objs) > > +{ > > + uint64_t i, num_packets; > > + struct rte_mbuf *mbuf_clones[RTE_GRAPH_BURST_SIZE] = { }; > > + char buffer[GRAPH_PCAP_BUF_SZ] = {0}; > > The initialization probably is not needed here. > > Couldn't you just do: > rte_strlcpy(buffer, node->name, GRAPH_PCAP_BUF_SZ); > > > + for (i = 0; i < num_packets; i++) { > > + struct rte_mbuf *mc; > > + mbuf = (struct rte_mbuf *)objs[i]; > > + > > + mc = rte_pcapng_copy(port_id, 0, mbuf, mp, mbuf->pkt_len, > > +rte_get_tsc_cycles(), 0, buffer); > > + if (mc == NULL) > > + goto done; > > The code will leak mbuf's if pcapng_copy() fails. > Suppose packet #2 caused the pool to get exhausted. > That copy would fail, but the mbuf for packets 0 and 1 would already be > sitting in mbuf_clones. My bad. Thanks for catching the issue. I will correct it in next version of the patch. > > + > > + mbuf_clones[i] = mc; > > + }
[PATCH v3 1/3] pcapng: comment option support for epb
This change enhances rte_pcapng_copy to have comment in enhanced packet block. Signed-off-by: Amit Prakash Shukla --- v2: - Fixed code style issue - Fixed CI compilation issue on github-robot v3: - Code review suggestion from Stephen - Fixed potential memory leak app/test/test_pcapng.c | 4 ++-- lib/pcapng/rte_pcapng.c | 10 +- lib/pcapng/rte_pcapng.h | 4 +++- lib/pdump/rte_pdump.c | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/test/test_pcapng.c b/app/test/test_pcapng.c index a7acbdc058..303d3d66f9 100644 --- a/app/test/test_pcapng.c +++ b/app/test/test_pcapng.c @@ -139,7 +139,7 @@ test_write_packets(void) struct rte_mbuf *mc; mc = rte_pcapng_copy(port_id, 0, orig, mp, pkt_len, - rte_get_tsc_cycles(), 0); + rte_get_tsc_cycles(), 0, NULL); if (mc == NULL) { fprintf(stderr, "Cannot copy packet\n"); return -1; @@ -255,7 +255,7 @@ test_write_over_limit_iov_max(void) struct rte_mbuf *mc; mc = rte_pcapng_copy(port_id, 0, orig, mp, pkt_len, - rte_get_tsc_cycles(), 0); + rte_get_tsc_cycles(), 0, NULL); if (mc == NULL) { fprintf(stderr, "Cannot copy packet\n"); return -1; diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c index 80d08e1a3b..acb31a9d93 100644 --- a/lib/pcapng/rte_pcapng.c +++ b/lib/pcapng/rte_pcapng.c @@ -450,7 +450,8 @@ rte_pcapng_copy(uint16_t port_id, uint32_t queue, const struct rte_mbuf *md, struct rte_mempool *mp, uint32_t length, uint64_t cycles, - enum rte_pcapng_direction direction) + enum rte_pcapng_direction direction, + const char *comment) { struct pcapng_enhance_packet_block *epb; uint32_t orig_len, data_len, padding, flags; @@ -511,6 +512,9 @@ rte_pcapng_copy(uint16_t port_id, uint32_t queue, if (rss_hash) optlen += pcapng_optlen(sizeof(uint8_t) + sizeof(uint32_t)); + if (comment) + optlen += pcapng_optlen(strlen(comment)); + /* reserve trailing options and block length */ opt = (struct pcapng_option *) rte_pktmbuf_append(mc, optlen + sizeof(uint32_t)); @@ -548,6 +552,10 @@ rte_pcapng_copy(uint16_t port_id, uint32_t queue, &hash_opt, sizeof(hash_opt)); } + if (comment) + opt = pcapng_add_option(opt, PCAPNG_OPT_COMMENT, comment, + strlen(comment)); + /* Note: END_OPT necessary here. Wireshark doesn't do it. */ /* Add PCAPNG packet header */ diff --git a/lib/pcapng/rte_pcapng.h b/lib/pcapng/rte_pcapng.h index 7d2697c647..6d286cda41 100644 --- a/lib/pcapng/rte_pcapng.h +++ b/lib/pcapng/rte_pcapng.h @@ -100,6 +100,8 @@ enum rte_pcapng_direction { * The timestamp in TSC cycles. * @param direction * The direction of the packer: receive, transmit or unknown. + * @param comment + * Packet comment. * * @return * - The pointer to the new mbuf formatted for pcapng_write @@ -111,7 +113,7 @@ struct rte_mbuf * rte_pcapng_copy(uint16_t port_id, uint32_t queue, const struct rte_mbuf *m, struct rte_mempool *mp, uint32_t length, uint64_t timestamp, - enum rte_pcapng_direction direction); + enum rte_pcapng_direction direction, const char *comment); /** diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c index a81544cb57..9bc4bab4f2 100644 --- a/lib/pdump/rte_pdump.c +++ b/lib/pdump/rte_pdump.c @@ -122,7 +122,7 @@ pdump_copy(uint16_t port_id, uint16_t queue, if (cbs->ver == V2) p = rte_pcapng_copy(port_id, queue, pkts[i], mp, cbs->snaplen, - ts, direction); + ts, direction, NULL); else p = rte_pktmbuf_copy(pkts[i], mp, 0, cbs->snaplen); -- 2.25.1
[PATCH v3 2/3] graph: pcap capture for graph nodes
Implementation adds support to capture packets at each node with packet metadata and node name. Signed-off-by: Amit Prakash Shukla --- v2: - Fixed code style issue - Fixed CI compilation issue on github-robot v3: - Code review suggestion from Stephen - Fixed potential memory leak lib/graph/graph_pcap_trace.c | 155 +++ lib/graph/graph_populate.c | 6 +- lib/graph/graph_private.h| 21 + lib/graph/meson.build| 5 +- lib/graph/rte_graph_pcap_trace.h | 96 +++ lib/graph/rte_graph_worker.h | 3 + lib/graph/version.map| 7 ++ 7 files changed, 290 insertions(+), 3 deletions(-) create mode 100644 lib/graph/graph_pcap_trace.c create mode 100644 lib/graph/rte_graph_pcap_trace.h diff --git a/lib/graph/graph_pcap_trace.c b/lib/graph/graph_pcap_trace.c new file mode 100644 index 00..f7b81a7ad1 --- /dev/null +++ b/lib/graph/graph_pcap_trace.c @@ -0,0 +1,155 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2022 Marvell International Ltd. + */ + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "rte_graph_worker.h" +#include "graph_private.h" + +#define GRAPH_PCAP_BUF_SZ 128 +#define GRAPH_PCAP_NUM_PACKETS 1024 +#define GRAPH_PCAP_FILE_NAME_SZ128 +#define GRAPH_PCAP_FILE_NAME "/tmp/graph_pcap_capture.pcapng" + +static char file_name[GRAPH_PCAP_FILE_NAME_SZ]; +static uint32_t pkt_buf_sz = RTE_MBUF_DEFAULT_BUF_SIZE; +static uint64_t packet_to_capture = GRAPH_PCAP_NUM_PACKETS; +static rte_pcapng_t *pcapng_fd; +static struct rte_mempool *mp; +static uint16_t port_id; +static uint64_t packet_captured[RTE_MAX_LCORE]; +static int pcap_trace_enable; + +void +rte_num_pkt_to_capture(uint64_t val) +{ + packet_to_capture = val; +} + +void +rte_pcap_trace_enable(int val) +{ + pcap_trace_enable = val; +} + +int +rte_pcap_trace_is_enable(void) +{ + return pcap_trace_enable; +} + +void +rte_filename_to_capture_pkt(const char *filename) +{ + if (filename[0] == '\0') + rte_strscpy(file_name, GRAPH_PCAP_FILE_NAME, + GRAPH_PCAP_FILE_NAME_SZ); + else + rte_strscpy(file_name, filename, GRAPH_PCAP_FILE_NAME_SZ); +} + +void +rte_graph_pcap_trace_exit(void) +{ + rte_pcapng_close(pcapng_fd); +} + +int +rte_graph_pcap_trace_init(void) +{ + int fd; + + port_id = rte_eth_find_next(0); + if (port_id >= RTE_MAX_ETHPORTS) { + fprintf(stderr, "No valid Ether port\n"); + return -1; + } + + if (file_name[0] == '\0') + rte_strscpy(file_name, GRAPH_PCAP_FILE_NAME, + GRAPH_PCAP_FILE_NAME_SZ); + + fd = open(file_name, O_CREAT | O_TRUNC | O_WRONLY, 0664); + if (fd < 0) { + perror("pcap file open failure"); + return -1; + } + + fprintf(stdout, "pcapng: output file %s\n", file_name); + + /* open a test capture file */ + pcapng_fd = rte_pcapng_fdopen(fd, NULL, NULL, "Graph pcap tracer", NULL); + if (pcapng_fd == NULL) { + fprintf(stderr, "Graph rte_pcapng_fdopen failed\n"); + close(fd); + return -1; + } + + /* Make a pool for cloned packets */ + mp = rte_pktmbuf_pool_create_by_ops("pcapng_graph_pool", + IOV_MAX + RTE_GRAPH_BURST_SIZE, + 0, 0, rte_pcapng_mbuf_size(pkt_buf_sz), + SOCKET_ID_ANY, "ring_mp_sc"); + if (mp == NULL) { + fprintf(stderr, "Cannot create mempool for graph pcap capture\n"); + rte_pcapng_close(pcapng_fd); + return -1; + } + + return 0; +} + +uint16_t +rte_graph_pcap_trace_dispatch(struct rte_graph *graph, + struct rte_node *node, void **objs, + uint16_t nb_objs) +{ + uint64_t i, num_packets; + struct rte_mbuf *mbuf_clones[RTE_GRAPH_BURST_SIZE]; + char buffer[GRAPH_PCAP_BUF_SZ]; + struct rte_mbuf *mbuf; + ssize_t len; + uint16_t gid = graph->id; + + if (!nb_objs || (packet_captured[gid] >= packet_to_capture)) + goto done; + + num_packets = packet_to_capture - packet_captured[gid]; + /* nb_objs will never be greater than RTE_GRAPH_BURST_SIZE */ + if (num_packets > nb_objs) + num_packets = nb_objs; + + rte_strlcpy(buffer, node->name, GRAPH_PCAP_BUF_SZ); + + for (i = 0; i < num_packets; i++) { + struct rte_mbuf *mc; + mbuf = (struct rte_mbuf *)objs[i]; + + mc = rte_pcapng_copy(port_id, 0, mbuf, mp, mbuf->pkt_len, +rte_get_tsc_cycles(), 0, buffer); + if (mc == NULL) + break; + + mbuf_clones[i] = mc; + } + + /* write it to
[PATCH v3 3/3] l3fwd-graph: changes to configure pcap capture
Added support to configure pcap capture. Signed-off-by: Amit Prakash Shukla --- v2: - Fixed code style issue - Fixed CI compilation issue on github-robot v3: - Code review suggestion from Stephen - Fixed potential memory leak doc/guides/sample_app_ug/l3_forward_graph.rst | 9 +++ examples/l3fwd-graph/main.c | 58 ++- 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/doc/guides/sample_app_ug/l3_forward_graph.rst b/doc/guides/sample_app_ug/l3_forward_graph.rst index 0a3e0d44ec..e0935eaae3 100644 --- a/doc/guides/sample_app_ug/l3_forward_graph.rst +++ b/doc/guides/sample_app_ug/l3_forward_graph.rst @@ -51,6 +51,9 @@ The application has a number of command line options similar to l3fwd:: [--max-pkt-len PKTLEN] [--no-numa] [--per-port-pool] + [--pcap-enable] + [--num-pkt-cap] + [--pcap-file-name] Where, @@ -69,6 +72,12 @@ Where, * ``--per-port-pool:`` Optional, set to use independent buffer pools per port. Without this option, single buffer pool is used for all ports. +* ``--pcap-enable:`` Optional, Enables packet capture in pcap format on each node with mbuf and node metadata. + +* ``--num-pkt-cap:`` Optional, Number of packets to be captured per core. + +* ``--pcap-file-name:`` Optional, Pcap filename to capture packets in. + For example, consider a dual processor socket platform with 8 physical cores, where cores 0-7 and 16-23 appear on socket 0, while cores 8-15 and 24-31 appear on socket 1. diff --git a/examples/l3fwd-graph/main.c b/examples/l3fwd-graph/main.c index 6dcb6ee92b..0b30ebbd83 100644 --- a/examples/l3fwd-graph/main.c +++ b/examples/l3fwd-graph/main.c @@ -261,7 +261,8 @@ print_usage(const char *prgname) " [--eth-dest=X,MM:MM:MM:MM:MM:MM]" " [--max-pkt-len PKTLEN]" " [--no-numa]" - " [--per-port-pool]\n\n" + " [--per-port-pool]" + " [--num-pkt-cap]\n\n" " -p PORTMASK: Hexadecimal bitmask of ports to configure\n" " -P : Enable promiscuous mode\n" @@ -270,10 +271,30 @@ print_usage(const char *prgname) "port X\n" " --max-pkt-len PKTLEN: maximum packet length in decimal (64-9600)\n" " --no-numa: Disable numa awareness\n" - " --per-port-pool: Use separate buffer pool per port\n\n", + " --per-port-pool: Use separate buffer pool per port\n" + " --pcap-enable: Enables pcap capture\n" + " --num-pkt-cap NUMPKT: Number of packets to capture\n" + " --pcap-file-name NAME: Pcap file name\n\n", prgname); } +static uint64_t +parse_num_pkt_cap(const char *num_pkt_cap) +{ + uint64_t num_pkt; + char *end = NULL; + + /* Parse decimal string */ + num_pkt = strtoull(num_pkt_cap, &end, 10); + if ((num_pkt_cap[0] == '\0') || (end == NULL) || (*end != '\0')) + return 0; + + if (num_pkt == 0) + return 0; + + return num_pkt; +} + static int parse_max_pkt_len(const char *pktlen) { @@ -404,6 +425,9 @@ static const char short_options[] = "p:" /* portmask */ #define CMD_LINE_OPT_NO_NUMA "no-numa" #define CMD_LINE_OPT_MAX_PKT_LEN "max-pkt-len" #define CMD_LINE_OPT_PER_PORT_POOL "per-port-pool" +#define CMD_LINE_OPT_PCAP_ENABLE "pcap-enable" +#define CMD_LINE_OPT_NUM_PKT_CAP "num-pkt-cap" +#define CMD_LINE_OPT_PCAP_FILENAME "pcap-file-name" enum { /* Long options mapped to a short option */ @@ -416,6 +440,9 @@ enum { CMD_LINE_OPT_NO_NUMA_NUM, CMD_LINE_OPT_MAX_PKT_LEN_NUM, CMD_LINE_OPT_PARSE_PER_PORT_POOL, + CMD_LINE_OPT_PARSE_PCAP_ENABLE, + CMD_LINE_OPT_PARSE_NUM_PKT_CAP, + CMD_LINE_OPT_PCAP_FILENAME_CAP, }; static const struct option lgopts[] = { @@ -424,6 +451,9 @@ static const struct option lgopts[] = { {CMD_LINE_OPT_NO_NUMA, 0, 0, CMD_LINE_OPT_NO_NUMA_NUM}, {CMD_LINE_OPT_MAX_PKT_LEN, 1, 0, CMD_LINE_OPT_MAX_PKT_LEN_NUM}, {CMD_LINE_OPT_PER_PORT_POOL, 0, 0, CMD_LINE_OPT_PARSE_PER_PORT_POOL}, + {CMD_LINE_OPT_PCAP_ENABLE, 0, 0, CMD_LINE_OPT_PARSE_PCAP_ENABLE}, + {CMD_LINE_OPT_NUM_PKT_CAP, 1, 0, CMD_LINE_OPT_PARSE_NUM_PKT_CAP}, + {CMD_LINE_OPT_PCAP_FILENAME, 1, 0, CMD_LINE_OPT_PCAP_FILENAME_CAP}, {NULL, 0, 0, 0}, }; @@ -448,6 +478,7 @@ parse_args(int argc, char **argv) int option_index; char **argvopt; int opt, ret; + uint64_t num_pkt; argvopt = argv; @@ -498,6 +529,23 @@ parse_args(int argc, char **argv) per_port_pool = 1; break; + case CMD_LINE_OPT_PARSE_PCAP_ENABLE: +
RE: [PATCH] crypto/qat: fix build
Ok, a long story short, this issue should only occurred when RTE_QAT_LIBIPSECMB is enabled. It was intend to remove Openssl lib dependency in QAT replaced with ipsec_mb lib, but the work was partially done due to limitation of ipsec_mb by the time (FIPS certification) I'm happy with current fix and please cc: sta...@dpdk.org The fully removal of Openssl dependency is already ongoing, I will take a note to fix this properly Regards Kai > -Original Message- > From: Thomas Monjalon > Sent: Wednesday, January 11, 2023 11:21 PM > To: Ji, Kai ; De Lara Guarch, Pablo > ; Akhil Goyal > Cc: dev@dpdk.org; Tyler Retzlaff ; > dev@dpdk.org; David Marchand ; Dooley, Brian > ; Power, Ciara ; Mcnamara, > John > Subject: Re: [PATCH] crypto/qat: fix build > > Waiting for an answer here. > The commit log is not supposed to stay like this with questions. > > > 11/01/2023 10:03, Thomas Monjalon: > > 04/01/2023 12:56, Akhil Goyal: > > > > On Fri, Dec 30, 2022 at 10:07:28PM +0100, Thomas Monjalon wrote: > > > > > When trying to compile on a fresh system, I hit this error: > > > > > > > > > > intel-ipsec-mb.h:333: error: "AES_BLOCK_SIZE" redefined > > > > > 333 | #define AES_BLOCK_SIZE IMB_AES_BLOCK_SIZE > > > > > In file included from drivers/crypto/qat/qat_sym_session.c:8: > > > > > /usr/include/openssl/aes.h:26: previous definition > > > > >26 | # define AES_BLOCK_SIZE 16 > > > > > > > > > > I don't know why it was not seen before. > > > > > Is it because of a change in intel-ipsec-mb.h or in OpenSSL? > > > > > > > > > > Signed-off-by: Thomas Monjalon > > > > > --- > > > > > > > > owners of intel-ipsec-mb.h should guard against the namespace > > > > conflict... > > > > > > > > Acked-by: Tyler Retzlaff > > > > > > Applied to dpdk-next-crypto > > If there is no better fix, we should at least add Cc: sta...@dpdk.org > assuming it could be reproduced with an older DPDK. > > > > > > > Thanks. > > > > I'm concerned to have no answer from Pablo and Kai. > > It is real design problem. Is there any plan to have a protected > namespace? > >
Re: [PATCH] crypto/qat: fix build
12/01/2023 11:32, Ji, Kai: > Ok, a long story short, this issue should only occurred when > RTE_QAT_LIBIPSECMB is enabled. > It was intend to remove Openssl lib dependency in QAT replaced with ipsec_mb > lib, but the work was partially done due to limitation of ipsec_mb by the > time (FIPS certification) > > I'm happy with current fix and please cc: sta...@dpdk.org I'm not happy with this fix. It is a dirty workaround. It would be better to have an #ifdef in ipsec_mb. Also I would like an answer to the question below. What triggered this error? Is it a new thing in the lib ipsec_mb? Why defining AES_BLOCK_SIZE while IMB_AES_BLOCK_SIZE can be used and have a proper prefix? > The fully removal of Openssl dependency is already ongoing, I will take a > note to fix this properly > > Regards > > Kai > > > From: Thomas Monjalon > > Subject: Re: [PATCH] crypto/qat: fix build > > > > Waiting for an answer here. > > The commit log is not supposed to stay like this with questions. > > > > > > 11/01/2023 10:03, Thomas Monjalon: > > > 04/01/2023 12:56, Akhil Goyal: > > > > > On Fri, Dec 30, 2022 at 10:07:28PM +0100, Thomas Monjalon wrote: > > > > > > When trying to compile on a fresh system, I hit this error: > > > > > > > > > > > > intel-ipsec-mb.h:333: error: "AES_BLOCK_SIZE" redefined > > > > > > 333 | #define AES_BLOCK_SIZE IMB_AES_BLOCK_SIZE > > > > > > In file included from drivers/crypto/qat/qat_sym_session.c:8: > > > > > > /usr/include/openssl/aes.h:26: previous definition > > > > > >26 | # define AES_BLOCK_SIZE 16 > > > > > > > > > > > > I don't know why it was not seen before. > > > > > > Is it because of a change in intel-ipsec-mb.h or in OpenSSL? > > > > > > > > > > > > Signed-off-by: Thomas Monjalon > > > > > > --- > > > > > > > > > > owners of intel-ipsec-mb.h should guard against the namespace > > > > > conflict... > > > > > > > > > > Acked-by: Tyler Retzlaff > > > > > > > > Applied to dpdk-next-crypto > > > > If there is no better fix, we should at least add Cc: sta...@dpdk.org > > assuming it could be reproduced with an older DPDK. > > > > > > > > > > Thanks. > > > > > > I'm concerned to have no answer from Pablo and Kai. > > > It is real design problem. Is there any plan to have a protected > > namespace?
[PATCH v2 0/3] Add support for SHAKE
This series defines new enums for SHAKE128 and SHAKE256 authentication algorithms and implements support for CNXK crypto PMD. v2: - rebased for dpdk-next-crypto Volodymyr Fialko (3): cryptodev: add SHAKE algorithm app/test: add SHAKE test cases crypto/cnxk: add support for SHAKE hash app/test/test_cryptodev_hash_test_vectors.h | 66 +++ doc/guides/cryptodevs/cnxk.rst| 2 + doc/guides/cryptodevs/features/cn10k.ini | 2 + doc/guides/cryptodevs/features/cn9k.ini | 2 + doc/guides/cryptodevs/features/default.ini| 2 + drivers/common/cnxk/roc_se.h | 4 +- drivers/crypto/cnxk/cnxk_cryptodev.h | 2 +- .../crypto/cnxk/cnxk_cryptodev_capabilities.c | 40 +++ drivers/crypto/cnxk/cnxk_se.h | 15 + lib/cryptodev/rte_crypto_sym.h| 7 +- lib/cryptodev/rte_cryptodev.c | 5 +- 11 files changed, 142 insertions(+), 5 deletions(-) -- 2.34.1
[PATCH v2 1/3] cryptodev: add SHAKE algorithm
Add SHAKE to enum of auth algorithms. Signed-off-by: Volodymyr Fialko --- doc/guides/cryptodevs/features/default.ini | 2 ++ lib/cryptodev/rte_crypto_sym.h | 7 ++- lib/cryptodev/rte_cryptodev.c | 5 - 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/guides/cryptodevs/features/default.ini b/doc/guides/cryptodevs/features/default.ini index d51d80ff80..523da0cfa8 100644 --- a/doc/guides/cryptodevs/features/default.ini +++ b/doc/guides/cryptodevs/features/default.ini @@ -99,6 +99,8 @@ SHA3_384 HMAC = SHA3_512= SHA3_512 HMAC = SM3 = +SHAKE_128 = +SHAKE_256 = ; ; Supported AEAD algorithms of a default crypto driver. diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h index dc847da7b8..2cfe66530c 100644 --- a/lib/cryptodev/rte_crypto_sym.h +++ b/lib/cryptodev/rte_crypto_sym.h @@ -374,8 +374,13 @@ enum rte_crypto_auth_algorithm { /**< 512 bit SHA3 algorithm. */ RTE_CRYPTO_AUTH_SHA3_512_HMAC, /**< HMAC using 512 bit SHA3 algorithm. */ - RTE_CRYPTO_AUTH_SM3 + RTE_CRYPTO_AUTH_SM3, /**< ShangMi 3 (SM3) algorithm */ + + RTE_CRYPTO_AUTH_SHAKE_128, + /**< 128 bit SHAKE algorithm. */ + RTE_CRYPTO_AUTH_SHAKE_256, + /**< 256 bit SHAKE algorithm. */ }; /** Authentication algorithm name strings */ diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c index 742a4c512e..17c70023ef 100644 --- a/lib/cryptodev/rte_cryptodev.c +++ b/lib/cryptodev/rte_cryptodev.c @@ -226,7 +226,10 @@ crypto_auth_algorithm_strings[] = { [RTE_CRYPTO_AUTH_KASUMI_F9] = "kasumi-f9", [RTE_CRYPTO_AUTH_SNOW3G_UIA2] = "snow3g-uia2", [RTE_CRYPTO_AUTH_ZUC_EIA3] = "zuc-eia3", - [RTE_CRYPTO_AUTH_SM3] = "sm3" + [RTE_CRYPTO_AUTH_SM3] = "sm3", + + [RTE_CRYPTO_AUTH_SHAKE_128] = "shake-128", + [RTE_CRYPTO_AUTH_SHAKE_256] = "shake-256", }; /** -- 2.34.1
[PATCH v2 2/3] app/test: add SHAKE test cases
Add test cases for SHAKE hash algorithm for Digest and Digest-Verify. Signed-off-by: Volodymyr Fialko --- app/test/test_cryptodev_hash_test_vectors.h | 66 + 1 file changed, 66 insertions(+) diff --git a/app/test/test_cryptodev_hash_test_vectors.h b/app/test/test_cryptodev_hash_test_vectors.h index 4b57286fa5..fa9986a4da 100644 --- a/app/test/test_cryptodev_hash_test_vectors.h +++ b/app/test/test_cryptodev_hash_test_vectors.h @@ -538,6 +538,52 @@ hmac_sha3_512_test_vector = { } }; +static const struct blockcipher_test_data +shake_128_test_vector = { + .auth_algo = RTE_CRYPTO_AUTH_SHAKE_128, + .ciphertext = { + .data = plaintext_hash, + .len = 512 + }, + .digest = { + .data = { + 0x69, 0xBD, 0xD5, 0x14, 0x85, 0xE0, 0x44, 0xA4, + 0x25, 0xE6, 0x9F, 0x81, 0xC8, 0x18, 0x58, 0x3E, + 0xFE, 0xC9, 0x0B, 0xAD, 0x27, 0x98, 0x14, 0x3F, + 0xB9, 0x7D, 0x68, 0x4D, 0x60, 0x77, 0x82, 0x64, + 0x6D, 0x64, 0x66, 0x67, 0xFA, 0xBC, 0x4F, 0xAC, + 0x9C, 0x75, 0x8D, 0x63, 0xBA, 0xBD, 0x2B, 0x03, + 0x0F, 0x2F, 0x46, 0x15, 0x88, 0xF0, 0x8C, 0x09, + 0xAC, 0x87, 0x84, 0x5B, 0xCA, 0x65, 0xA1, 0x14 + }, + .len = 64, + .truncated_len = 64 + } +}; + +static const struct blockcipher_test_data +shake_256_test_vector = { + .auth_algo = RTE_CRYPTO_AUTH_SHAKE_256, + .ciphertext = { + .data = plaintext_hash, + .len = 512 + }, + .digest = { + .data = { + 0x9E, 0xA2, 0x1B, 0x84, 0x15, 0x0E, 0xF0, 0x46, + 0xD9, 0xA9, 0x11, 0x02, 0x11, 0x67, 0x9A, 0xDC, + 0x62, 0x95, 0x8C, 0xD6, 0xEF, 0x89, 0x35, 0x8C, + 0xBF, 0x41, 0x5F, 0x23, 0x16, 0xBD, 0x0C, 0xDE, + 0xEC, 0x1D, 0x47, 0x90, 0xA4, 0xD9, 0x18, 0x63, + 0xE1, 0x60, 0xF8, 0xAF, 0x0F, 0x57, 0xBA, 0xCA, + 0x5D, 0x97, 0x58, 0xF5, 0xFF, 0xE4, 0x85, 0x40, + 0xCA, 0x7D, 0xB8, 0x35, 0x3B, 0x89, 0xCA, 0x34 + }, + .len = 64, + .truncated_len = 64 + } +}; + static const struct blockcipher_test_data cmac_test_vector = { .auth_algo = RTE_CRYPTO_AUTH_AES_CMAC, @@ -853,6 +899,26 @@ static const struct blockcipher_test_case hash_test_cases[] = { .test_data = &hmac_sha3_512_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, }, + { + .test_descr = "SHAKE_128 Digest", + .test_data = &shake_128_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, + }, + { + .test_descr = "SHAKE_128 Digest Verify", + .test_data = &shake_128_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, + }, + { + .test_descr = "SHAKE_256 Digest", + .test_data = &shake_256_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, + }, + { + .test_descr = "SHAKE_256 Digest Verify", + .test_data = &shake_256_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, + }, { .test_descr = "CMAC Digest 12B", .test_data = &cmac_test_vector_12, -- 2.34.1
[PATCH v2 3/3] crypto/cnxk: add support for SHAKE hash
Add support for SHAKE hash and hmac operations Signed-off-by: Volodymyr Fialko --- doc/guides/cryptodevs/cnxk.rst| 2 + doc/guides/cryptodevs/features/cn10k.ini | 2 + doc/guides/cryptodevs/features/cn9k.ini | 2 + drivers/common/cnxk/roc_se.h | 4 +- drivers/crypto/cnxk/cnxk_cryptodev.h | 2 +- .../crypto/cnxk/cnxk_cryptodev_capabilities.c | 40 +++ drivers/crypto/cnxk/cnxk_se.h | 15 +++ 7 files changed, 64 insertions(+), 3 deletions(-) diff --git a/doc/guides/cryptodevs/cnxk.rst b/doc/guides/cryptodevs/cnxk.rst index 9b01e04e5f..3c2e38fefd 100644 --- a/doc/guides/cryptodevs/cnxk.rst +++ b/doc/guides/cryptodevs/cnxk.rst @@ -67,6 +67,8 @@ Hash algorithms: * ``RTE_CRYPTO_AUTH_SHA3_384_HMAC`` * ``RTE_CRYPTO_AUTH_SHA3_512`` * ``RTE_CRYPTO_AUTH_SHA3_512_HMAC`` +* ``RTE_CRYPTO_AUTH_SHAKE_128`` +* ``RTE_CRYPTO_AUTH_SHAKE_256`` * ``RTE_CRYPTO_AUTH_SNOW3G_UIA2`` * ``RTE_CRYPTO_AUTH_ZUC_EIA3`` * ``RTE_CRYPTO_AUTH_AES_CMAC`` diff --git a/doc/guides/cryptodevs/features/cn10k.ini b/doc/guides/cryptodevs/features/cn10k.ini index 44b61663fc..162d1a25ca 100644 --- a/doc/guides/cryptodevs/features/cn10k.ini +++ b/doc/guides/cryptodevs/features/cn10k.ini @@ -71,6 +71,8 @@ SHA3_384= Y SHA3_384 HMAC = Y SHA3_512= Y SHA3_512 HMAC = Y +SHAKE_128 = Y +SHAKE_256 = Y ; ; Supported AEAD algorithms of 'cn10k' crypto driver. diff --git a/doc/guides/cryptodevs/features/cn9k.ini b/doc/guides/cryptodevs/features/cn9k.ini index e7b287db26..bbed4b2e23 100644 --- a/doc/guides/cryptodevs/features/cn9k.ini +++ b/doc/guides/cryptodevs/features/cn9k.ini @@ -72,6 +72,8 @@ SHA3_384= Y SHA3_384 HMAC = Y SHA3_512= Y SHA3_512 HMAC = Y +SHAKE_128 = Y +SHAKE_256 = Y ; ; Supported AEAD algorithms of 'cn9k' crypto driver. diff --git a/drivers/common/cnxk/roc_se.h b/drivers/common/cnxk/roc_se.h index e9415f21a5..6758142214 100644 --- a/drivers/common/cnxk/roc_se.h +++ b/drivers/common/cnxk/roc_se.h @@ -85,8 +85,8 @@ typedef enum { ROC_SE_SHA3_SHA256 = 11, ROC_SE_SHA3_SHA384 = 12, ROC_SE_SHA3_SHA512 = 13, - ROC_SE_SHA3_SHAKE256 = 14, - ROC_SE_SHA3_SHAKE512 = 15, + ROC_SE_SHA3_SHAKE128 = 14, + ROC_SE_SHA3_SHAKE256 = 15, /* These are only for software use */ ROC_SE_ZUC_EIA3 = 0x90, diff --git a/drivers/crypto/cnxk/cnxk_cryptodev.h b/drivers/crypto/cnxk/cnxk_cryptodev.h index 8241ee67d0..dd7dd3bc3a 100644 --- a/drivers/crypto/cnxk/cnxk_cryptodev.h +++ b/drivers/crypto/cnxk/cnxk_cryptodev.h @@ -10,7 +10,7 @@ #include "roc_cpt.h" -#define CNXK_CPT_MAX_CAPS 45 +#define CNXK_CPT_MAX_CAPS 47 #define CNXK_SEC_CRYPTO_MAX_CAPS 16 #define CNXK_SEC_MAX_CAPS 9 #define CNXK_AE_EC_ID_MAX 8 diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c index b2197a12be..d2ae4b5bff 100644 --- a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c +++ b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c @@ -498,6 +498,46 @@ static const struct rte_cryptodev_capabilities caps_sha3[] = { }, } }, } }, + { /* SHAKE_128 */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, + {.auth = { + .algo = RTE_CRYPTO_AUTH_SHAKE_128, + .block_size = 168, + .key_size = { + .min = 0, + .max = 0, + .increment = 0 + }, + .digest_size = { + .min = 1, + .max = 255, + .increment = 1 + }, + }, } + }, } + }, + { /* SHAKE_256 */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, + {.auth = { + .algo = RTE_CRYPTO_AUTH_SHAKE_256, + .block_size = 136, + .key_size = { + .min = 0, + .max = 0, + .increment = 0 + }, + .digest_size = { + .min = 1, + .max = 255, + .increment = 1 + }, + }, } + }, } + },
Re: [PATCH v4] devtools: parallelize ABI check
On Wed, Jan 11, 2023 at 8:53 PM Thomas Monjalon wrote: > > Generation and comparison of ABI dumps are done on multiple cores > thanks to xargs -P0. > It can accelerate this long step by 5 in my tests. > > xargs reports a global error if one of the process has an error. > > Running a shell function with xargs requires to export it. > POSIX shell does not support function export except using an "eval trick". > Required variables are also exported. > > Signed-off-by: Thomas Monjalon > Tested-by: Ferruh Yigit > diff --git a/devtools/check-abi.sh b/devtools/check-abi.sh > index c583eae2fd..31eceb42e6 100755 > --- a/devtools/check-abi.sh > +++ b/devtools/check-abi.sh > @@ -34,20 +34,18 @@ else > ABIDIFF_OPTIONS="$ABIDIFF_OPTIONS --headers-dir2 $incdir2" > fi > > -error= > -for dump in $(find $refdir -name "*.dump"); do > +export newdir ABIDIFF_OPTIONS > +export diff_func='run_diff() { > + dump=$1 > name=$(basename $dump) > dump2=$(find $newdir -name $name) > if [ -z "$dump2" ] || [ ! -e "$dump2" ]; then > echo "Error: cannot find $name in $newdir" >&2 > - error=1 > - continue > - fi > + return 1 > + fi; No need for ; here. This can be fixed when applying (I tested both your patch and with this small fix). > abidiff $ABIDIFF_OPTIONS $dump $dump2 || { > abiret=$? > - echo "Error: ABI issue reported for 'abidiff $ABIDIFF_OPTIONS > $dump $dump2'" >&2 > - error=1 > - echo > + echo "Error: ABI issue reported for abidiff $ABIDIFF_OPTIONS > $dump $dump2" >&2 > if [ $(($abiret & 3)) -ne 0 ]; then > echo "ABIDIFF_ERROR|ABIDIFF_USAGE_ERROR, this could > be a script or environment issue." >&2 > fi > @@ -57,8 +55,13 @@ for dump in $(find $refdir -name "*.dump"); do > if [ $(($abiret & 8)) -ne 0 ]; then > echo "ABIDIFF_ABI_INCOMPATIBLE_CHANGE, this change > breaks the ABI." >&2 > fi > - echo > + return 1 > } > -done > +}' > + > +error= > +find $refdir -name "*.dump" | > +xargs -n1 -P0 sh -c 'eval "$diff_func"; run_diff $0' || > +error=1 > > [ -z "$error" ] || [ -n "$warnonly" ] For the record, on my system, calling this script is ~5 times faster: - before real0m5,447s user0m4,497s sys0m0,937s - after real0m1,202s user0m10,784s sys0m2,027s > diff --git a/devtools/gen-abi.sh b/devtools/gen-abi.sh > index f15a3b9aaf..61f7510ea1 100755 > --- a/devtools/gen-abi.sh > +++ b/devtools/gen-abi.sh > @@ -22,5 +22,6 @@ for f in $(find $installdir -name "*.so.*"); do > fi > > libname=$(basename $f) > - abidw --out-file $dumpdir/${libname%.so*}.dump $f > -done > + echo $dumpdir/${libname%.so*}.dump $f > +done | > +xargs -n2 -P0 abidw --out-file > -- > 2.39.0 > - before real0m8,237s user0m7,704s sys0m0,504s - after real0m2,517s user0m14,145s sys0m0,766s Ferruh, I am seeing quite different numbers for running those scripts (clearly not of the minute order). I switched to testing/building in tmpfs some time ago. It requires a good amount of memory (I empirically allocated 40G), but maybe worth a try for you? In any case, this patch lgtm. Acked-by: David Marchand -- David Marchand
[PATCH v2 1/9] telemetry: remove RTE prefix from internal enum values
To better distinguish which values are public and which are internal remove the "RTE_" prefix off the internal enum defining the container types. Signed-off-by: Bruce Richardson Acked-by: Morten Brørup Acked-by: Tyler Retzlaff --- lib/ethdev/sff_telemetry.c | 2 +- lib/telemetry/telemetry.c | 36 +++--- lib/telemetry/telemetry_data.c | 40 +- lib/telemetry/telemetry_data.h | 14 ++-- 4 files changed, 46 insertions(+), 46 deletions(-) diff --git a/lib/ethdev/sff_telemetry.c b/lib/ethdev/sff_telemetry.c index ca6d196560..5923350424 100644 --- a/lib/ethdev/sff_telemetry.c +++ b/lib/ethdev/sff_telemetry.c @@ -96,7 +96,7 @@ ssf_add_dict_string(struct rte_tel_data *d, const char *name_str, const char *va { struct tel_dict_entry *e = &d->data.dict[d->data_len]; - if (d->type != RTE_TEL_DICT) + if (d->type != TEL_DICT) return; if (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES) { RTE_ETHDEV_LOG(ERR, "data_len has exceeded the maximum number of inserts\n"); diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c index 8fbb4f3060..792b4e12b6 100644 --- a/lib/telemetry/telemetry.c +++ b/lib/telemetry/telemetry.c @@ -167,27 +167,27 @@ container_to_json(const struct rte_tel_data *d, char *out_buf, size_t buf_len) size_t used = 0; unsigned int i; - if (d->type != RTE_TEL_DICT && d->type != RTE_TEL_ARRAY_U64 && - d->type != RTE_TEL_ARRAY_INT && d->type != RTE_TEL_ARRAY_STRING) + if (d->type != TEL_DICT && d->type != TEL_ARRAY_U64 && + d->type != TEL_ARRAY_INT && d->type != TEL_ARRAY_STRING) return snprintf(out_buf, buf_len, "null"); used = rte_tel_json_empty_array(out_buf, buf_len, 0); - if (d->type == RTE_TEL_ARRAY_U64) + if (d->type == TEL_ARRAY_U64) for (i = 0; i < d->data_len; i++) used = rte_tel_json_add_array_u64(out_buf, buf_len, used, d->data.array[i].u64val); - if (d->type == RTE_TEL_ARRAY_INT) + if (d->type == TEL_ARRAY_INT) for (i = 0; i < d->data_len; i++) used = rte_tel_json_add_array_int(out_buf, buf_len, used, d->data.array[i].ival); - if (d->type == RTE_TEL_ARRAY_STRING) + if (d->type == TEL_ARRAY_STRING) for (i = 0; i < d->data_len; i++) used = rte_tel_json_add_array_string(out_buf, buf_len, used, d->data.array[i].sval); - if (d->type == RTE_TEL_DICT) + if (d->type == TEL_DICT) for (i = 0; i < d->data_len; i++) { const struct tel_dict_entry *v = &d->data.dict[i]; switch (v->type) { @@ -245,15 +245,15 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) buf_len = sizeof(out_buf) - prefix_used - 1; /* space for '}' */ switch (d->type) { - case RTE_TEL_NULL: + case TEL_NULL: used = strlcpy(cb_data_buf, "null", buf_len); break; - case RTE_TEL_STRING: + case TEL_STRING: used = rte_tel_json_str(cb_data_buf, buf_len, 0, d->data.str); break; - case RTE_TEL_DICT: + case TEL_DICT: used = rte_tel_json_empty_obj(cb_data_buf, buf_len, 0); for (i = 0; i < d->data_len; i++) { const struct tel_dict_entry *v = &d->data.dict[i]; @@ -291,26 +291,26 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) } break; - case RTE_TEL_ARRAY_STRING: - case RTE_TEL_ARRAY_INT: - case RTE_TEL_ARRAY_U64: - case RTE_TEL_ARRAY_CONTAINER: + case TEL_ARRAY_STRING: + case TEL_ARRAY_INT: + case TEL_ARRAY_U64: + case TEL_ARRAY_CONTAINER: used = rte_tel_json_empty_array(cb_data_buf, buf_len, 0); for (i = 0; i < d->data_len; i++) - if (d->type == RTE_TEL_ARRAY_STRING) + if (d->type == TEL_ARRAY_STRING) used = rte_tel_json_add_array_string( cb_data_buf, buf_len, used, d->data.array[i].sval); - else if (d->type == RTE_TEL_ARRAY_INT) + else if (d->type == TEL_ARRAY_INT) used = rte_tel_json_add_array_int(cb_data_buf, buf_len, used, d->data.array[i].ival); - else if (d->type == RTE
[PATCH v2 0/9] Standardize telemetry int types
Rather than having 64-bit unsigned types and 32-bit signed types supported by the telemetry lib, we should support 64-bit values for both types. On the naming side, since both are 64-bit, we should no longer call the unsigned value u64 - "uint" is better. This patchset implements these changes as far as is possible while still keeping API and ABI compatibility. * Internal structures and functions are updated to use 64-bit ints * Internal functions are renamed from u64 to uint * Public enum values are renamed from u64 to uint, and a macro is added to ensure that older code still compiles * The public add_*_int functions are changed to take a 64-bit value rather than a 32-bit one. Since this would be an ABI break, we use function versioning to ensure older code still calls into a wrapper function which takes a 32-bit value. The patchset also contains a couple of other small cleanups to the telemetry code that were seen in passing when making these changes - removing RTE_ prefix on internal enums, and simplifying the init of the the array of data types. NOTE: the renaming of the u64 functions to uint is split across 3 patches in this set - patches 4,5 and 6. This is to make it easier to review and to avoid warnings about new functions not being marked initially as experimental. Some/all of these 3 can be combined on merge if so desired. V2: - added additional patches to replace the old function calls within DPDK code, something missed in RFC version - added new patch to make the renamed/new functions immediately public allowing us to mark the original named versions as deprecated - re-ordered patches within the sit, so the extra cleanup changes come first Bruce Richardson (9): telemetry: remove RTE prefix from internal enum values telemetry: make array initialization more robust telemetry: rename unsigned 64-bit enum value to uint telemetry: add uint type as alias for u64 global: rename telemetry functions to newer versions telemetry: mark old names of renamed fns as deprecated telemetry: update json functions to use int/uint in names telemetry: make internal int representation 64-bits telemetry: change public API to use 64-bit signed values app/test/test_telemetry_data.c | 22 ++--- app/test/test_telemetry_json.c | 9 +- doc/guides/rel_notes/deprecation.rst | 5 ++ drivers/common/cnxk/roc_platform.h | 2 +- drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c | 24 ++--- drivers/net/cnxk/cnxk_ethdev_telemetry.c | 6 +- examples/ipsec-secgw/ipsec-secgw.c | 72 +++ examples/l3fwd-power/main.c | 4 +- lib/cryptodev/rte_cryptodev.c| 6 +- lib/dmadev/rte_dmadev.c | 2 +- lib/eal/common/eal_common_memory.c | 19 ++-- lib/ethdev/rte_ethdev.c | 12 +-- lib/ethdev/sff_telemetry.c | 2 +- lib/eventdev/rte_event_eth_rx_adapter.c | 22 ++--- lib/eventdev/rte_event_timer_adapter.c | 38 lib/eventdev/rte_eventdev.c | 5 +- lib/ipsec/ipsec_telemetry.c | 32 +++ lib/rawdev/rte_rawdev.c | 4 +- lib/security/rte_security.c | 8 +- lib/telemetry/meson.build| 1 + lib/telemetry/rte_telemetry.h| 51 +-- lib/telemetry/telemetry.c| 56 ++-- lib/telemetry/telemetry_data.c | 95 ++-- lib/telemetry/telemetry_data.h | 24 +++-- lib/telemetry/telemetry_json.h | 16 ++-- lib/telemetry/version.map| 9 ++ 26 files changed, 323 insertions(+), 223 deletions(-) -- 2.37.2
[PATCH v2 2/9] telemetry: make array initialization more robust
Rather than relying on a specific ordering of elements in the array matching that of elements in the enum definition, we can explicitly mark each array entry using the equivalent enum value as an index. Signed-off-by: Bruce Richardson Acked-by: Morten Brørup Acked-by: Tyler Retzlaff --- lib/telemetry/telemetry_data.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c index 76fae720e3..3f5ef3979b 100644 --- a/lib/telemetry/telemetry_data.c +++ b/lib/telemetry/telemetry_data.c @@ -16,10 +16,10 @@ int rte_tel_data_start_array(struct rte_tel_data *d, enum rte_tel_value_type type) { enum tel_container_types array_types[] = { - TEL_ARRAY_STRING, /* RTE_TEL_STRING_VAL = 0 */ - TEL_ARRAY_INT,/* RTE_TEL_INT_VAL = 1 */ - TEL_ARRAY_U64,/* RTE_TEL_U64_VAL = 2 */ - TEL_ARRAY_CONTAINER, /* RTE_TEL_CONTAINER = 3 */ + [RTE_TEL_STRING_VAL] = TEL_ARRAY_STRING, + [RTE_TEL_INT_VAL] = TEL_ARRAY_INT, + [RTE_TEL_U64_VAL] = TEL_ARRAY_U64, + [RTE_TEL_CONTAINER] = TEL_ARRAY_CONTAINER, }; d->type = array_types[type]; d->data_len = 0; -- 2.37.2
[PATCH v2 3/9] telemetry: rename unsigned 64-bit enum value to uint
For telemetry data, rather than having unsigned 64-bit values and signed 32-bit values, we want to just have unsigned and signed values, each stored with the max bit-width i.e. 64-bits. To that end, we rename the U64 enum entry to "UINT" to have a more generic name For backward API-level compatibility, we can use a macro to alias the old name to the new. Suggested-by: Morten Brørup Signed-off-by: Bruce Richardson Acked-by: Morten Brørup Acked-by: Tyler Retzlaff --- app/test/test_telemetry_data.c | 10 +- drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c | 4 ++-- drivers/net/cnxk/cnxk_ethdev_telemetry.c | 2 +- lib/cryptodev/rte_cryptodev.c| 2 +- lib/ethdev/rte_ethdev.c | 2 +- lib/ipsec/ipsec_telemetry.c | 2 +- lib/security/rte_security.c | 4 ++-- lib/telemetry/rte_telemetry.h| 6 -- lib/telemetry/telemetry.c| 4 ++-- lib/telemetry/telemetry_data.c | 4 ++-- 10 files changed, 21 insertions(+), 19 deletions(-) diff --git a/app/test/test_telemetry_data.c b/app/test/test_telemetry_data.c index d92667a527..24a2035b61 100644 --- a/app/test/test_telemetry_data.c +++ b/app/test/test_telemetry_data.c @@ -283,7 +283,7 @@ test_case_array_u64(void) { int i; - rte_tel_data_start_array(&response_data, RTE_TEL_U64_VAL); + rte_tel_data_start_array(&response_data, RTE_TEL_UINT_VAL); for (i = 0; i < 5; i++) rte_tel_data_add_array_u64(&response_data, i); return CHECK_OUTPUT("[0,1,2,3,4]"); @@ -310,10 +310,10 @@ test_dict_with_array_u64_values(void) int i; struct rte_tel_data *child_data = rte_tel_data_alloc(); - rte_tel_data_start_array(child_data, RTE_TEL_U64_VAL); + rte_tel_data_start_array(child_data, RTE_TEL_UINT_VAL); struct rte_tel_data *child_data2 = rte_tel_data_alloc(); - rte_tel_data_start_array(child_data2, RTE_TEL_U64_VAL); + rte_tel_data_start_array(child_data2, RTE_TEL_UINT_VAL); rte_tel_data_start_dict(&response_data); @@ -336,10 +336,10 @@ test_array_with_array_u64_values(void) int i; struct rte_tel_data *child_data = rte_tel_data_alloc(); - rte_tel_data_start_array(child_data, RTE_TEL_U64_VAL); + rte_tel_data_start_array(child_data, RTE_TEL_UINT_VAL); struct rte_tel_data *child_data2 = rte_tel_data_alloc(); - rte_tel_data_start_array(child_data2, RTE_TEL_U64_VAL); + rte_tel_data_start_array(child_data2, RTE_TEL_UINT_VAL); rte_tel_data_start_array(&response_data, RTE_TEL_CONTAINER); diff --git a/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c b/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c index 8e6277cbcd..59f0cce5ab 100644 --- a/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c +++ b/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c @@ -94,7 +94,7 @@ copy_outb_sa_10k(struct rte_tel_data *d, uint32_t i, void *sa) return -ENOMEM; } - rte_tel_data_start_array(outer_hdr, RTE_TEL_U64_VAL); + rte_tel_data_start_array(outer_hdr, RTE_TEL_UINT_VAL); for (j = 0; j < RTE_DIM(out_sa->outer_hdr.ipv6.src_addr); j++) rte_tel_data_add_array_u64(outer_hdr, @@ -167,7 +167,7 @@ copy_inb_sa_10k(struct rte_tel_data *d, uint32_t i, void *sa) return -ENOMEM; } - rte_tel_data_start_array(outer_hdr, RTE_TEL_U64_VAL); + rte_tel_data_start_array(outer_hdr, RTE_TEL_UINT_VAL); for (j = 0; j < RTE_DIM(in_sa->outer_hdr.ipv6.src_addr); j++) rte_tel_data_add_array_u64(outer_hdr, diff --git a/drivers/net/cnxk/cnxk_ethdev_telemetry.c b/drivers/net/cnxk/cnxk_ethdev_telemetry.c index 180108ab9c..5db973d620 100644 --- a/drivers/net/cnxk/cnxk_ethdev_telemetry.c +++ b/drivers/net/cnxk/cnxk_ethdev_telemetry.c @@ -52,7 +52,7 @@ ethdev_tel_handle_info(const char *cmd __rte_unused, i_data = rte_tel_data_alloc(); if (i_data == NULL) return -ENOMEM; - rte_tel_data_start_array(i_data, RTE_TEL_U64_VAL); + rte_tel_data_start_array(i_data, RTE_TEL_UINT_VAL); for (i = 0; i < RTE_MAX_ETHPORTS; i++) { /* Skip if port is unused */ diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c index 2165a0688c..79ea958db4 100644 --- a/lib/cryptodev/rte_cryptodev.c +++ b/lib/cryptodev/rte_cryptodev.c @@ -2744,7 +2744,7 @@ crypto_caps_array(struct rte_tel_data *d, uint64_t caps_val[CRYPTO_CAPS_SZ]; unsigned int i = 0, j; - rte_tel_data_start_array(d, RTE_TEL_U64_VAL); + rte_tel_data_start_array(d, RTE_TEL_UINT_VAL); while ((dev_caps = &capabilities[i++])->op != RTE_CRYPTO_OP_TYPE_UNDEFINED) { diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 5d5e18db1e..28028e5de5 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -5818,7 +
[PATCH v2 4/9] telemetry: add uint type as alias for u64
To match the "_int" suffix for telemetry data functions taking signed values, we can add new functions with the "_uint" suffix for unsigned ones. While later patches will deprecate the old public functions, for now we can just add the new functions as aliases or duplicates of the older ones with the "u64" suffix. Internal functions can be directly renamed, without any need for aliasing or deprecation. Suggested-by: Morten Brørup Signed-off-by: Bruce Richardson Acked-by: Morten Brørup Acked-by: Tyler Retzlaff --- NOTE: To avoid excessive checkpatch warnings, these functions are added initially as experimental. A later patch marks them as stable as part of the deprecation process for the old ones. --- lib/telemetry/rte_telemetry.h | 37 ++ lib/telemetry/telemetry.c | 16 +++ lib/telemetry/telemetry_data.c | 28 + lib/telemetry/telemetry_data.h | 4 ++-- lib/telemetry/version.map | 7 +++ 5 files changed, 74 insertions(+), 18 deletions(-) diff --git a/lib/telemetry/rte_telemetry.h b/lib/telemetry/rte_telemetry.h index c2ad65effe..73a0511807 100644 --- a/lib/telemetry/rte_telemetry.h +++ b/lib/telemetry/rte_telemetry.h @@ -8,6 +8,8 @@ #ifndef _RTE_TELEMETRY_H_ #define _RTE_TELEMETRY_H_ +#include + #ifdef __cplusplus extern "C" { #endif @@ -121,6 +123,22 @@ int rte_tel_data_add_array_int(struct rte_tel_data *d, int x); /** + * Add an unsigned value to an array. + * The array must have been started by rte_tel_data_start_array() with + * RTE_TEL_UINT_VAL as the type parameter. + * + * @param d + * The data structure passed to the callback + * @param x + * The number to be returned in the array + * @return + * 0 on success, negative errno on error + */ +__rte_experimental +int +rte_tel_data_add_array_uint(struct rte_tel_data *d, uint64_t x); + + /** * Add a uint64_t to an array. * The array must have been started by rte_tel_data_start_array() with * RTE_TEL_UINT_VAL as the type parameter. @@ -193,6 +211,25 @@ int rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int val); /** + * Add an unsigned value to a dictionary. + * The dict must have been started by rte_tel_data_start_dict(). + * + * @param d + * The data structure passed to the callback + * @param name + * The name the value is to be stored under in the dict + * Must contain only alphanumeric characters or the symbols: '_' or '/' + * @param val + * The number to be stored in the dict + * @return + * 0 on success, negative errno on error, E2BIG on string truncation of name. + */ +__rte_experimental +int +rte_tel_data_add_dict_uint(struct rte_tel_data *d, + const char *name, uint64_t val); + + /** * Add a uint64_t value to a dictionary. * The dict must have been started by rte_tel_data_start_dict(). * diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c index 916a0a4604..89bdde8422 100644 --- a/lib/telemetry/telemetry.c +++ b/lib/telemetry/telemetry.c @@ -167,16 +167,16 @@ container_to_json(const struct rte_tel_data *d, char *out_buf, size_t buf_len) size_t used = 0; unsigned int i; - if (d->type != TEL_DICT && d->type != TEL_ARRAY_U64 && + if (d->type != TEL_DICT && d->type != TEL_ARRAY_UINT && d->type != TEL_ARRAY_INT && d->type != TEL_ARRAY_STRING) return snprintf(out_buf, buf_len, "null"); used = rte_tel_json_empty_array(out_buf, buf_len, 0); - if (d->type == TEL_ARRAY_U64) + if (d->type == TEL_ARRAY_UINT) for (i = 0; i < d->data_len; i++) used = rte_tel_json_add_array_u64(out_buf, buf_len, used, - d->data.array[i].u64val); + d->data.array[i].uval); if (d->type == TEL_ARRAY_INT) for (i = 0; i < d->data_len; i++) used = rte_tel_json_add_array_int(out_buf, @@ -204,7 +204,7 @@ container_to_json(const struct rte_tel_data *d, char *out_buf, size_t buf_len) case RTE_TEL_UINT_VAL: used = rte_tel_json_add_obj_u64(out_buf, buf_len, used, - v->name, v->value.u64val); + v->name, v->value.uval); break; case RTE_TEL_CONTAINER: { @@ -271,7 +271,7 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) case RTE_TEL_UINT_VAL: used = rte_tel_json_add_obj_u64(cb_data_buf, buf_len, used, - v->name, v->value.u64val); + v->name, v->value.uval);
[PATCH v2 5/9] global: rename telemetry functions to newer versions
Within the DPDK code-base, replace all occurances of "rte_tel_data_add_array_u64" with "rte_tel_data_add_array_uint", and similarly replace all occurances of "rte_tel_data_add_dict_u64" with "rte_tel_data_add_dict_uint". This allows us to later mark the older functions as deprecated without hitting warnings. Signed-off-by: Bruce Richardson --- app/test/test_telemetry_data.c | 12 ++-- drivers/common/cnxk/roc_platform.h | 2 +- drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c | 20 +++--- drivers/net/cnxk/cnxk_ethdev_telemetry.c | 4 +- examples/ipsec-secgw/ipsec-secgw.c | 72 +--- examples/l3fwd-power/main.c | 4 +- lib/cryptodev/rte_cryptodev.c| 4 +- lib/dmadev/rte_dmadev.c | 2 +- lib/eal/common/eal_common_memory.c | 19 +++--- lib/ethdev/rte_ethdev.c | 10 +-- lib/eventdev/rte_event_eth_rx_adapter.c | 22 +++--- lib/eventdev/rte_event_timer_adapter.c | 38 +++ lib/eventdev/rte_eventdev.c | 5 +- lib/ipsec/ipsec_telemetry.c | 30 lib/rawdev/rte_rawdev.c | 4 +- lib/security/rte_security.c | 4 +- 16 files changed, 128 insertions(+), 124 deletions(-) diff --git a/app/test/test_telemetry_data.c b/app/test/test_telemetry_data.c index 24a2035b61..b00c148a57 100644 --- a/app/test/test_telemetry_data.c +++ b/app/test/test_telemetry_data.c @@ -285,7 +285,7 @@ test_case_array_u64(void) rte_tel_data_start_array(&response_data, RTE_TEL_UINT_VAL); for (i = 0; i < 5; i++) - rte_tel_data_add_array_u64(&response_data, i); + rte_tel_data_add_array_uint(&response_data, i); return CHECK_OUTPUT("[0,1,2,3,4]"); } @@ -299,7 +299,7 @@ test_case_add_dict_u64(void) for (i = 0; i < 5; i++) { sprintf(name_of_value, "dict_%d", i); - rte_tel_data_add_dict_u64(&response_data, name_of_value, i); + rte_tel_data_add_dict_uint(&response_data, name_of_value, i); } return CHECK_OUTPUT("{\"dict_0\":0,\"dict_1\":1,\"dict_2\":2,\"dict_3\":3,\"dict_4\":4}"); } @@ -318,8 +318,8 @@ test_dict_with_array_u64_values(void) rte_tel_data_start_dict(&response_data); for (i = 0; i < 10; i++) { - rte_tel_data_add_array_u64(child_data, i); - rte_tel_data_add_array_u64(child_data2, i); + rte_tel_data_add_array_uint(child_data, i); + rte_tel_data_add_array_uint(child_data2, i); } rte_tel_data_add_dict_container(&response_data, "dict_0", @@ -344,8 +344,8 @@ test_array_with_array_u64_values(void) rte_tel_data_start_array(&response_data, RTE_TEL_CONTAINER); for (i = 0; i < 5; i++) { - rte_tel_data_add_array_u64(child_data, i); - rte_tel_data_add_array_u64(child_data2, i); + rte_tel_data_add_array_uint(child_data, i); + rte_tel_data_add_array_uint(child_data2, i); } rte_tel_data_add_array_container(&response_data, child_data, 0); rte_tel_data_add_array_container(&response_data, child_data2, 0); diff --git a/drivers/common/cnxk/roc_platform.h b/drivers/common/cnxk/roc_platform.h index 1a48ff3db4..b29f3e06f1 100644 --- a/drivers/common/cnxk/roc_platform.h +++ b/drivers/common/cnxk/roc_platform.h @@ -224,7 +224,7 @@ #define plt_tel_data_start_dict rte_tel_data_start_dict #define plt_tel_data_add_dict_intrte_tel_data_add_dict_int #define plt_tel_data_add_dict_ptr(d, n, v) \ - rte_tel_data_add_dict_u64(d, n, (uint64_t)v) + rte_tel_data_add_dict_uint(d, n, (uint64_t)v) #define plt_tel_data_add_dict_string rte_tel_data_add_dict_string #define plt_tel_data_add_dict_u64rte_tel_data_add_dict_u64 #define plt_telemetry_register_cmd rte_telemetry_register_cmd diff --git a/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c b/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c index 59f0cce5ab..386278cfc9 100644 --- a/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c +++ b/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c @@ -53,10 +53,10 @@ copy_inb_sa_9k(struct rte_tel_data *d, uint32_t i, void *sa) rte_tel_data_add_dict_string(d, str, strw0); snprintf(str, sizeof(str), "insa_esnh_%u", i); - rte_tel_data_add_dict_u64(d, str, in_sa->common_sa.seq_t.th); + rte_tel_data_add_dict_uint(d, str, in_sa->common_sa.seq_t.th); snprintf(str, sizeof(str), "insa_esnl_%u", i); - rte_tel_data_add_dict_u64(d, str, in_sa->common_sa.seq_t.tl); + rte_tel_data_add_dict_uint(d, str, in_sa->common_sa.seq_t.tl); return 0; } @@ -97,12 +97,12 @@ copy_outb_sa_10k(struct rte_tel_data *d, uint32_t i, void *sa) rte_tel_data_start_array(outer_hdr, RTE_TEL_UINT_VAL); for (j = 0; j < RTE_DIM(out_sa->outer_hdr.ipv6.src_addr); j++) -
[PATCH v2 6/9] telemetry: mark old names of renamed fns as deprecated
Add a deprecation notice for the renaming of the telemetry data u64/uint functions, and point users to the newer versions of them when building. To do this, we also need to mark the renamed versions as stable, rather than experimental. Signed-off-by: Bruce Richardson --- Note: This patch adds the deprecation macro *after* the function prototype rather than before, as adding it before - as with the experimental tag - causes doxygen to get confused and give errors: .../lib/telemetry/rte_telemetry.h:141: warning: argument 'd' of command @param is not found in the argument list of __rte_deprecated_msg("use 'rte_tel_data_add_array_uint' instead") .../lib/telemetry/rte_telemetry.h:141: warning: argument 'x' of command @param is not found in the argument list of __rte_deprecated_msg("use 'rte_tel_data_add_array_uint' instead") --- doc/guides/rel_notes/deprecation.rst | 5 + lib/telemetry/rte_telemetry.h| 10 +- lib/telemetry/version.map| 9 ++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index b9b02dcef0..98ad6baed5 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -11,6 +11,11 @@ here. Deprecation Notices --- +* telemetry: The functions ``rte_tel_data_add_array_u64`` and ``rte_tel_data_add_dict_u64``, + used by telemetry callbacks for adding unsigned integer values to be returned to the user, + are renamed to ``rte_tel_data_add_array_uint`` and ``rte_tel_data_add_dict_uint`` respectively. + As such, the old function names are deprecated and will be removed in a future release. + * kvargs: The function ``rte_kvargs_process`` will get a new parameter for returning key match count. It will ease handling of no-match case. diff --git a/lib/telemetry/rte_telemetry.h b/lib/telemetry/rte_telemetry.h index 73a0511807..4598303d5d 100644 --- a/lib/telemetry/rte_telemetry.h +++ b/lib/telemetry/rte_telemetry.h @@ -8,7 +8,7 @@ #ifndef _RTE_TELEMETRY_H_ #define _RTE_TELEMETRY_H_ -#include +#include #ifdef __cplusplus extern "C" { @@ -134,7 +134,6 @@ rte_tel_data_add_array_int(struct rte_tel_data *d, int x); * @return * 0 on success, negative errno on error */ -__rte_experimental int rte_tel_data_add_array_uint(struct rte_tel_data *d, uint64_t x); @@ -151,7 +150,8 @@ rte_tel_data_add_array_uint(struct rte_tel_data *d, uint64_t x); * 0 on success, negative errno on error */ int -rte_tel_data_add_array_u64(struct rte_tel_data *d, uint64_t x); +rte_tel_data_add_array_u64(struct rte_tel_data *d, uint64_t x) + __rte_deprecated_msg("use 'rte_tel_data_add_array_uint' instead"); /** * Add a container to an array. A container is an existing telemetry data @@ -224,7 +224,6 @@ rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int val); * @return * 0 on success, negative errno on error, E2BIG on string truncation of name. */ -__rte_experimental int rte_tel_data_add_dict_uint(struct rte_tel_data *d, const char *name, uint64_t val); @@ -245,7 +244,8 @@ rte_tel_data_add_dict_uint(struct rte_tel_data *d, */ int rte_tel_data_add_dict_u64(struct rte_tel_data *d, - const char *name, uint64_t val); + const char *name, uint64_t val) + __rte_deprecated_msg("use 'rte_tel_data_add_dict_uint' instead"); /** * Add a container to a dictionary. A container is an existing telemetry data diff --git a/lib/telemetry/version.map b/lib/telemetry/version.map index 0f70d82dfc..d661180317 100644 --- a/lib/telemetry/version.map +++ b/lib/telemetry/version.map @@ -5,10 +5,12 @@ DPDK_23 { rte_tel_data_add_array_int; rte_tel_data_add_array_string; rte_tel_data_add_array_u64; + rte_tel_data_add_array_uint; rte_tel_data_add_dict_container; rte_tel_data_add_dict_int; rte_tel_data_add_dict_string; rte_tel_data_add_dict_u64; + rte_tel_data_add_dict_uint; rte_tel_data_alloc; rte_tel_data_free; rte_tel_data_start_array; @@ -19,13 +21,6 @@ DPDK_23 { local: *; }; -EXPERIMENTAL { - global: - - rte_tel_data_add_array_uint; - rte_tel_data_add_dict_uint; -}; - INTERNAL { rte_telemetry_legacy_register; rte_telemetry_init; -- 2.37.2
[PATCH v2 7/9] telemetry: update json functions to use int/uint in names
Since we are standardizing on using uint in place of u64, and expanding the int values to 64-bit, we can update the internal json functions to use the new names and expanded signed type. Suggested-by: Morten Brørup Signed-off-by: Bruce Richardson Acked-by: Morten Brørup Acked-by: Tyler Retzlaff --- app/test/test_telemetry_json.c | 9 - lib/telemetry/telemetry.c | 8 lib/telemetry/telemetry_json.h | 16 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/app/test/test_telemetry_json.c b/app/test/test_telemetry_json.c index 184c3ba9f1..e81e3a8a98 100644 --- a/app/test/test_telemetry_json.c +++ b/app/test/test_telemetry_json.c @@ -37,9 +37,9 @@ test_basic_obj(void) char buf[1024]; int used = 0; - used = rte_tel_json_add_obj_u64(buf, sizeof(buf), used, + used = rte_tel_json_add_obj_uint(buf, sizeof(buf), used, "weddings", 4); - used = rte_tel_json_add_obj_u64(buf, sizeof(buf), used, + used = rte_tel_json_add_obj_uint(buf, sizeof(buf), used, "funerals", 1); printf("%s: buf = '%s', expected = '%s'\n", __func__, buf, expected); @@ -80,8 +80,7 @@ test_overflow_obj(void) int i, used = 0; for (i = 0; i < (int)RTE_DIM(names); i++) - used = rte_tel_json_add_obj_u64(buf, sizeof(buf), used, - names[i], vals[i]); + used = rte_tel_json_add_obj_uint(buf, sizeof(buf), used, names[i], vals[i]); printf("%s: buf = '%s', expected = '%s'\n", __func__, buf, expected); if (buf[used - 1] != '}') @@ -117,7 +116,7 @@ test_large_obj_element(void) char buf[sizeof(str) - 5] = "XYZ"; int used = 0; - used = rte_tel_json_add_obj_u64(buf, sizeof(buf), used, str, 0); + used = rte_tel_json_add_obj_uint(buf, sizeof(buf), used, str, 0); printf("%s: buf = '%s', expected = '%s'\n", __func__, buf, expected); if (used != 0) return -1; diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c index 89bdde8422..655191bcf1 100644 --- a/lib/telemetry/telemetry.c +++ b/lib/telemetry/telemetry.c @@ -174,7 +174,7 @@ container_to_json(const struct rte_tel_data *d, char *out_buf, size_t buf_len) used = rte_tel_json_empty_array(out_buf, buf_len, 0); if (d->type == TEL_ARRAY_UINT) for (i = 0; i < d->data_len; i++) - used = rte_tel_json_add_array_u64(out_buf, + used = rte_tel_json_add_array_uint(out_buf, buf_len, used, d->data.array[i].uval); if (d->type == TEL_ARRAY_INT) @@ -202,7 +202,7 @@ container_to_json(const struct rte_tel_data *d, char *out_buf, size_t buf_len) v->name, v->value.ival); break; case RTE_TEL_UINT_VAL: - used = rte_tel_json_add_obj_u64(out_buf, + used = rte_tel_json_add_obj_uint(out_buf, buf_len, used, v->name, v->value.uval); break; @@ -269,7 +269,7 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) v->name, v->value.ival); break; case RTE_TEL_UINT_VAL: - used = rte_tel_json_add_obj_u64(cb_data_buf, + used = rte_tel_json_add_obj_uint(cb_data_buf, buf_len, used, v->name, v->value.uval); break; @@ -307,7 +307,7 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) buf_len, used, d->data.array[i].ival); else if (d->type == TEL_ARRAY_UINT) - used = rte_tel_json_add_array_u64(cb_data_buf, + used = rte_tel_json_add_array_uint(cb_data_buf, buf_len, used, d->data.array[i].uval); else if (d->type == TEL_ARRAY_CONTAINER) { diff --git a/lib/telemetry/telemetry_json.h b/lib/telemetry/telemetry_json.h index e3fae7c30d..744bbfe053 100644 --- a/lib/telemetry/telemetry_json.h +++ b/lib/telemetry/telemetry_json.h @@ -136,19 +136,19 @@ rte_tel_json_add_array_string(char *buf, const int len, const int used, /* Appends an integer into the JSON array in the provided buffer. */ static inline int -rte_tel_json_add_array_int(char *buf, const int len, const int used, int val) +rte_tel_json_add_array_int(ch
[PATCH v2 8/9] telemetry: make internal int representation 64-bits
The internal storage for int values can be expanded from 32-bit to 64-bit without affecting the external ABI. Suggested-by: Morten Brørup Signed-off-by: Bruce Richardson Acked-by: Morten Brørup Acked-by: Tyler Retzlaff --- lib/telemetry/telemetry_data.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/telemetry/telemetry_data.h b/lib/telemetry/telemetry_data.h index 8db6875a81..205509c5a2 100644 --- a/lib/telemetry/telemetry_data.h +++ b/lib/telemetry/telemetry_data.h @@ -28,7 +28,7 @@ struct container { */ union tel_value { char sval[RTE_TEL_MAX_STRING_LEN]; - int ival; + int64_t ival; uint64_t uval; struct container container; }; -- 2.37.2
[PATCH v2 9/9] telemetry: change public API to use 64-bit signed values
While the unsigned values added to telemetry dicts/arrays were up to 64-bits in size, the sized values were only up to 32-bits. We can standardize the API by having both int and uint functions take 64-bit values. For ABI compatibility, we use function versioning to ensure older binaries can still use the older functions taking a 32-bit parameter. Suggested-by: Morten Brørup Signed-off-by: Bruce Richardson Acked-by: Morten Brørup Acked-by: Tyler Retzlaff --- lib/telemetry/meson.build | 1 + lib/telemetry/rte_telemetry.h | 4 ++-- lib/telemetry/telemetry_data.c | 33 + lib/telemetry/telemetry_data.h | 6 ++ lib/telemetry/version.map | 7 +++ 5 files changed, 45 insertions(+), 6 deletions(-) diff --git a/lib/telemetry/meson.build b/lib/telemetry/meson.build index f84c9aa3be..73750d9ef4 100644 --- a/lib/telemetry/meson.build +++ b/lib/telemetry/meson.build @@ -6,3 +6,4 @@ includes = [global_inc] sources = files('telemetry.c', 'telemetry_data.c', 'telemetry_legacy.c') headers = files('rte_telemetry.h') includes += include_directories('../metrics') +use_function_versioning = true diff --git a/lib/telemetry/rte_telemetry.h b/lib/telemetry/rte_telemetry.h index 4598303d5d..b481c112dd 100644 --- a/lib/telemetry/rte_telemetry.h +++ b/lib/telemetry/rte_telemetry.h @@ -120,7 +120,7 @@ rte_tel_data_add_array_string(struct rte_tel_data *d, const char *str); * 0 on success, negative errno on error */ int -rte_tel_data_add_array_int(struct rte_tel_data *d, int x); +rte_tel_data_add_array_int(struct rte_tel_data *d, int64_t x); /** * Add an unsigned value to an array. @@ -208,7 +208,7 @@ rte_tel_data_add_dict_string(struct rte_tel_data *d, const char *name, * 0 on success, negative errno on error, E2BIG on string truncation of name. */ int -rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int val); +rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int64_t val); /** * Add an unsigned value to a dictionary. diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c index 9a180937fd..ac7be795df 100644 --- a/lib/telemetry/telemetry_data.c +++ b/lib/telemetry/telemetry_data.c @@ -8,6 +8,7 @@ #undef RTE_USE_LIBBSD #include +#include #include #include "telemetry_data.h" @@ -58,8 +59,8 @@ rte_tel_data_add_array_string(struct rte_tel_data *d, const char *str) return bytes < RTE_TEL_MAX_STRING_LEN ? 0 : E2BIG; } -int -rte_tel_data_add_array_int(struct rte_tel_data *d, int x) +int __vsym +rte_tel_data_add_array_int_v24(struct rte_tel_data *d, int64_t x) { if (d->type != TEL_ARRAY_INT) return -EINVAL; @@ -69,6 +70,18 @@ rte_tel_data_add_array_int(struct rte_tel_data *d, int x) return 0; } +int __vsym +rte_tel_data_add_array_int_v23(struct rte_tel_data *d, int x) +{ + return rte_tel_data_add_array_int_v24(d, x); +} + +/* mark the v23 function as the older version, and v24 as the default version */ +VERSION_SYMBOL(rte_tel_data_add_array_int, _v23, 23); +BIND_DEFAULT_SYMBOL(rte_tel_data_add_array_int, _v24, 24); +MAP_STATIC_SYMBOL(int rte_tel_data_add_array_int(struct rte_tel_data *d, + int64_t x), rte_tel_data_add_array_int_v24); + int rte_tel_data_add_array_uint(struct rte_tel_data *d, uint64_t x) { @@ -146,8 +159,8 @@ rte_tel_data_add_dict_string(struct rte_tel_data *d, const char *name, return 0; } -int -rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int val) +int __vsym +rte_tel_data_add_dict_int_v24(struct rte_tel_data *d, const char *name, int64_t val) { struct tel_dict_entry *e = &d->data.dict[d->data_len]; if (d->type != TEL_DICT) @@ -165,6 +178,18 @@ rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int val) return bytes < RTE_TEL_MAX_STRING_LEN ? 0 : E2BIG; } +int __vsym +rte_tel_data_add_dict_int_v23(struct rte_tel_data *d, const char *name, int val) +{ + return rte_tel_data_add_dict_int_v24(d, name, val); +} + +/* mark the v23 function as the older version, and v24 as the default version */ +VERSION_SYMBOL(rte_tel_data_add_dict_int, _v23, 23); +BIND_DEFAULT_SYMBOL(rte_tel_data_add_dict_int, _v24, 24); +MAP_STATIC_SYMBOL(int rte_tel_data_add_dict_int(struct rte_tel_data *d, + const char *name, int64_t val), rte_tel_data_add_dict_int_v24); + int rte_tel_data_add_dict_uint(struct rte_tel_data *d, const char *name, uint64_t val) diff --git a/lib/telemetry/telemetry_data.h b/lib/telemetry/telemetry_data.h index 205509c5a2..53e4cabea5 100644 --- a/lib/telemetry/telemetry_data.h +++ b/lib/telemetry/telemetry_data.h @@ -49,4 +49,10 @@ struct rte_tel_data { } data; /* data container */ }; +/* versioned functions */ +int rte_tel_data_add_array_int_v23(struct rte_tel_data *d, int val); +int rte_tel_data_add_array_int_v24(struct rte_tel_data *d, int64_t val); +int rte_tel_data_add
Re: [PATCH] bus/vdev: automatically add eth alias for net drivers
On Wed, Oct 19, 2022 at 02:11:18PM +0100, Bruce Richardson wrote: > For historical reasons, a number of net vdev drivers also add a driver > alias using the "eth_" prefix. Since this is done on a per-driver basis, > the use of the alias in inconsistent and is spread across multiple > files. We can remove the per-driver aliases by just adding the alias > automatically at the vdev bus level. > > Signed-off-by: Bruce Richardson > --- > drivers/bus/vdev/vdev.c | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c > index f5b43f1930..bfd7ce60c1 100644 > --- a/drivers/bus/vdev/vdev.c > +++ b/drivers/bus/vdev/vdev.c > @@ -54,6 +54,12 @@ static rte_spinlock_t vdev_custom_scan_lock = > RTE_SPINLOCK_INITIALIZER; > void > rte_vdev_register(struct rte_vdev_driver *driver) > { > + /* For net driver vdevs, add an automatic alias using "eth" prefix */ > + if (strncmp(driver->driver.name, "net_", 4) == 0 && > driver->driver.alias == NULL) { > + char *alias = strdup(driver->driver.name); > + memcpy(alias, "eth_", 4); > + driver->driver.alias = alias; > + } > TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next); > } > Just to close this off... Following the discussion in the thread, it seems a fix is not needed/wanted here, so dropping patch and marked "rejected" in patchwork.
[PATCH v5 0/6] add trace points in ethdev library
This series adds trace points for functions in the ethdev library. The trace points are added in ethdev, flow, mtr and tm files. v5: - The rte_trace_point_emit_char_array function is renamed to rte_trace_point_emit_blob. With this function an array of any length upto 65535 bytes can be captured. For example, the following is the ctf metadata created to display a mac addr array in rte_eth_trace_macaddr_get(): struct { ... uint16_t len; uint8_t mac_addr_addr_bytes[len]; }; - Added additional test cases for rte_eal_trace_generic_blob test case. - Capturing of return value of a function is added to tracepoint for flow, mtr and tm patches. - In ehdev patch (1/6), removed extra line. Also added rx_pkts and tx_pkts pointer in trace point. v4: - Adds tracepoint function to emit char array. Also adds the test case. - Resolved review comments on "ethdev: add trace point" patch. This patch is divided into 2 patches to minimize per patch size. - From the earlier version (v3), few tracepoints in ethdev, flow, mtr, tm are made as fast path tracepoints. For the tracepoint which i was unsure, i have made it as fastpath. All the fast path tracepoints can be found in rte_ethdev_trace_fp.h and rte_ethdev_trace_fp_burst.h. All the slow path tracepoints can be found in rte_ethdev_trace.h. - Capturing of return value is added to tracepoint in ethdev. For flow, mtr and tm these changes are still yet to bde done. Will do it in the next versions. - Moved the trace functions from INTERNAL to EXPERIMENTAL in version.map. v3: - Moved the trace functions from EXPERIMENTAL to INTERNAL in version.map. - Moved trace functions call to the end, in ethdev and flow trace. - Added code to print the input value of features in rte_eth_trace_rx_metadata_negotiate(). - Added code to capture return value in flow trace. Ankur Dwivedi (6): eal: trace: add trace point emit for blob ethdev: add trace points for ethdev ethdev: add trace points for remaining functions ethdev: add trace points for flow ethdev: add trace points for mtr ethdev: add trace points for tm app/test/test_trace.c |5 + lib/eal/common/eal_common_trace_points.c |2 + lib/eal/include/rte_eal_trace.h|6 + lib/eal/include/rte_trace_point.h | 17 + lib/eal/include/rte_trace_point_register.h |7 + lib/eal/version.map|3 + lib/ethdev/ethdev_private.c|5 + lib/ethdev/ethdev_trace_points.c | 715 ++ lib/ethdev/meson.build |1 + lib/ethdev/rte_ethdev.c| 711 -- lib/ethdev/rte_ethdev.h|2 +- lib/ethdev/rte_ethdev_cman.c | 30 +- lib/ethdev/rte_ethdev_trace.h | 1450 lib/ethdev/rte_ethdev_trace_fp.h | 1005 +- lib/ethdev/rte_ethdev_trace_fp_burst.h | 44 + lib/ethdev/rte_flow.c | 314 - lib/ethdev/rte_mtr.c | 156 ++- lib/ethdev/rte_tm.c| 247 +++- lib/ethdev/version.map | 235 19 files changed, 4719 insertions(+), 236 deletions(-) create mode 100644 lib/ethdev/rte_ethdev_trace_fp_burst.h -- 2.25.1
[PATCH v5 1/6] eal: trace: add trace point emit for blob
Adds a trace point emit function for emitting a blob. The maximum blob bytes which can be captured is maximum value contained in uint16_t, which is 65535. Also adds test case for emit array tracepoint function. Signed-off-by: Ankur Dwivedi --- app/test/test_trace.c | 5 + lib/eal/common/eal_common_trace_points.c | 2 ++ lib/eal/include/rte_eal_trace.h| 6 ++ lib/eal/include/rte_trace_point.h | 17 + lib/eal/include/rte_trace_point_register.h | 7 +++ lib/eal/version.map| 3 +++ 6 files changed, 40 insertions(+) diff --git a/app/test/test_trace.c b/app/test/test_trace.c index 6bedf14024..cf781dc25b 100644 --- a/app/test/test_trace.c +++ b/app/test/test_trace.c @@ -4,6 +4,7 @@ #include #include +#include #include #include "test.h" @@ -177,6 +178,7 @@ test_fp_trace_points(void) static int test_generic_trace_points(void) { + uint8_t arr[32] = {0}; int tmp; rte_eal_trace_generic_void(); @@ -195,6 +197,9 @@ test_generic_trace_points(void) rte_eal_trace_generic_ptr(&tmp); rte_eal_trace_generic_str("my string"); rte_eal_trace_generic_size_t(sizeof(void *)); + rte_eal_trace_generic_blob(arr, 17); + rte_eal_trace_generic_blob(arr, 32); + rte_eal_trace_generic_blob(arr, rte_rand() % 32); RTE_EAL_TRACE_GENERIC_FUNC; return TEST_SUCCESS; diff --git a/lib/eal/common/eal_common_trace_points.c b/lib/eal/common/eal_common_trace_points.c index 0b0b254615..051f89809c 100644 --- a/lib/eal/common/eal_common_trace_points.c +++ b/lib/eal/common/eal_common_trace_points.c @@ -40,6 +40,8 @@ RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_size_t, lib.eal.generic.size_t) RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_func, lib.eal.generic.func) +RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_blob, + lib.eal.generic.blob) RTE_TRACE_POINT_REGISTER(rte_eal_trace_alarm_set, lib.eal.alarm.set) diff --git a/lib/eal/include/rte_eal_trace.h b/lib/eal/include/rte_eal_trace.h index 5ef4398230..02e3a564a1 100644 --- a/lib/eal/include/rte_eal_trace.h +++ b/lib/eal/include/rte_eal_trace.h @@ -143,6 +143,12 @@ RTE_TRACE_POINT( rte_trace_point_emit_string(func); ) +RTE_TRACE_POINT( + rte_eal_trace_generic_blob, + RTE_TRACE_POINT_ARGS(void *in, uint16_t len), + rte_trace_point_emit_blob(in, len); +) + #define RTE_EAL_TRACE_GENERIC_FUNC rte_eal_trace_generic_func(__func__) /* Interrupt */ diff --git a/lib/eal/include/rte_trace_point.h b/lib/eal/include/rte_trace_point.h index 0f8700974f..21b6bf7bf6 100644 --- a/lib/eal/include/rte_trace_point.h +++ b/lib/eal/include/rte_trace_point.h @@ -144,6 +144,8 @@ _tp _args \ #define rte_trace_point_emit_ptr(val) /** Tracepoint function payload for string datatype */ #define rte_trace_point_emit_string(val) +/** Tracepoint function payload for char array */ +#define rte_trace_point_emit_blob(val, len) #endif /* __DOXYGEN__ */ @@ -374,12 +376,27 @@ do { \ mem = RTE_PTR_ADD(mem, __RTE_TRACE_EMIT_STRING_LEN_MAX); \ } while (0) +#define rte_trace_point_emit_blob(in, len) \ +do { \ + if (unlikely(in == NULL)) \ + return; \ + __rte_trace_point_emit(len, uint16_t); \ + memcpy(mem, in, len); \ + mem = RTE_PTR_ADD(mem, len); \ +} while (0) + #else #define __rte_trace_point_emit_header_generic(t) RTE_SET_USED(t) #define __rte_trace_point_emit_header_fp(t) RTE_SET_USED(t) #define __rte_trace_point_emit(in, type) RTE_SET_USED(in) #define rte_trace_point_emit_string(in) RTE_SET_USED(in) +#define rte_trace_point_emit_blob(in, len) \ +do { \ + RTE_SET_USED(in); \ + RTE_SET_USED(len); \ +} while (0) + #endif /* ALLOW_EXPERIMENTAL_API */ #endif /* _RTE_TRACE_POINT_REGISTER_H_ */ diff --git a/lib/eal/include/rte_trace_point_register.h b/lib/eal/include/rte_trace_point_register.h index a32f4d731b..a54f9769da 100644 --- a/lib/eal/include/rte_trace_point_register.h +++ b/lib/eal/include/rte_trace_point_register.h @@ -47,6 +47,13 @@ do { \ RTE_STR(in)"[32]", "string_bounded_t"); \ } while (0) +#define rte_trace_point_emit_blob(in, len) \ +do { \ + RTE_SET_USED(in); \ + __rte_trace_point_emit(len, uint16_t); \ + __rte_trace_point_emit_field(len, RTE_STR(in)"["#len"]", RTE_STR(uint8_t)); \ +} while (0) + #ifdef __cplusplus } #endif diff --git a/lib/eal/version.map b/lib/eal/version.map index 7ad12a7dc9..67be24686a 100644 --- a/lib/eal/version.map +++ b/lib/eal/version.map @@ -440,6 +440,9 @@ EXPERIMENTAL { rte_thread_detach; rte_thread_equal; rte_thread_join; + + # added in 23.03 + __rte_eal_trace_generic_blob; }; INTERNAL { -- 2.25.1
[PATCH v5 2/6] ethdev: add trace points for ethdev
Adds trace points for ethdev functions. Moved the rte_ethdev_trace_rx_burst and rte_ethdev_trace_tx_burst to a new file rte_ethdev_trace_fp_burst.h. This is needed to resolve cyclic dependency between rte_ethdev.h and rte_ethdev_trace_fp.h. Signed-off-by: Ankur Dwivedi --- lib/ethdev/ethdev_private.c| 5 + lib/ethdev/ethdev_trace_points.c | 193 + lib/ethdev/meson.build | 1 + lib/ethdev/rte_ethdev.c| 235 +--- lib/ethdev/rte_ethdev.h| 2 +- lib/ethdev/rte_ethdev_trace.h | 285 + lib/ethdev/rte_ethdev_trace_fp.h | 279 +++- lib/ethdev/rte_ethdev_trace_fp_burst.h | 44 lib/ethdev/version.map | 66 ++ 9 files changed, 1075 insertions(+), 35 deletions(-) create mode 100644 lib/ethdev/rte_ethdev_trace_fp_burst.h diff --git a/lib/ethdev/ethdev_private.c b/lib/ethdev/ethdev_private.c index 48090c879a..fd16b25e55 100644 --- a/lib/ethdev/ethdev_private.c +++ b/lib/ethdev/ethdev_private.c @@ -5,6 +5,7 @@ #include #include "rte_ethdev.h" +#include "rte_ethdev_trace_fp.h" #include "ethdev_driver.h" #include "ethdev_private.h" @@ -297,6 +298,8 @@ rte_eth_call_rx_callbacks(uint16_t port_id, uint16_t queue_id, cb = cb->next; } + rte_eth_trace_call_rx_callbacks(port_id, queue_id, rx_pkts, nb_rx, nb_pkts); + return nb_rx; } @@ -312,6 +315,8 @@ rte_eth_call_tx_callbacks(uint16_t port_id, uint16_t queue_id, cb = cb->next; } + rte_eth_trace_call_tx_callbacks(port_id, queue_id, tx_pkts, nb_pkts); + return nb_pkts; } diff --git a/lib/ethdev/ethdev_trace_points.c b/lib/ethdev/ethdev_trace_points.c index 2919409a15..4fea76e0ff 100644 --- a/lib/ethdev/ethdev_trace_points.c +++ b/lib/ethdev/ethdev_trace_points.c @@ -5,6 +5,7 @@ #include #include +#include RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_configure, lib.ethdev.configure) @@ -29,3 +30,195 @@ RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_rx_burst, RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_tx_burst, lib.ethdev.tx.burst) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_call_rx_callbacks, + lib.ethdev.call_rx_callbacks) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_call_tx_callbacks, + lib.ethdev.call_tx_callbacks) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_iterator_init, + lib.ethdev.iterator_init) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_iterator_next, + lib.ethdev.iterator_next) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_iterator_cleanup, + lib.ethdev.iterator_cleanup) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_find_next, + lib.ethdev.find_next) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_find_next_of, + lib.ethdev.find_next_of) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_find_next_sibling, + lib.ethdev.find_next_sibling) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_is_valid_port, + lib.ethdev.is_valid_port) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_find_next_owned_by, + lib.ethdev.find_next_owned_by) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_owner_new, + lib.ethdev.owner_new) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_owner_set, + lib.ethdev.owner_set) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_owner_unset, + lib.ethdev.owner_unset) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_owner_delete, + lib.ethdev.owner_delete) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_owner_get, + lib.ethdev.owner_get) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_socket_id, + lib.ethdev.socket_id) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_get_sec_ctx, + lib.ethdev.get_sec_ctx) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_count_avail, + lib.ethdev.count_avail) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_count_total, + lib.ethdev.count_total) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_get_name_by_port, + lib.ethdev.get_name_by_port) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_get_port_by_name, + lib.ethdev.get_port_by_name) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_rx_queue_start, + lib.ethdev.rx_queue_start) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_rx_queue_stop, + lib.ethdev.rx_queue_stop) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_tx_queue_start, + lib.ethdev.tx_queue_start) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_tx_queue_stop, + lib.ethdev.tx_queue_stop) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_speed_bitflag, + lib.ethdev.speed_bitflag) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_rx_offload_name, + lib.ethdev.rx_offload_name) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_tx_offload_name, + lib.ethdev.tx_offload_name) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_capability_name, + lib.ethdev.capability_name) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_set_link_up, + lib.ethdev.set_link_up) + +R
[PATCH v5 3/6] ethdev: add trace points for remaining functions
Adds trace points for remaining ethdev functions. Signed-off-by: Ankur Dwivedi --- lib/ethdev/ethdev_trace_points.c | 252 +++ lib/ethdev/rte_ethdev.c | 476 ++- lib/ethdev/rte_ethdev_cman.c | 30 +- lib/ethdev/rte_ethdev_trace.h| 529 +++ lib/ethdev/rte_ethdev_trace_fp.h | 342 lib/ethdev/version.map | 81 + 6 files changed, 1622 insertions(+), 88 deletions(-) diff --git a/lib/ethdev/ethdev_trace_points.c b/lib/ethdev/ethdev_trace_points.c index 4fea76e0ff..102a18fcc1 100644 --- a/lib/ethdev/ethdev_trace_points.c +++ b/lib/ethdev/ethdev_trace_points.c @@ -222,3 +222,255 @@ RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_set_rx_queue_stats_mapping, RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_fw_version_get, lib.ethdev.fw_version_get) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_info_get, + lib.ethdev.info_get) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_conf_get, + lib.ethdev.conf_get) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_get_supported_ptypes, + lib.ethdev.get_supported_ptypes) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_set_ptypes, + lib.ethdev.set_ptypes) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_macaddrs_get, + lib.ethdev.macaddrs_get) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_macaddr_get, + lib.ethdev.macaddr_get) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_get_mtu, + lib.ethdev.get_mtu) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_set_mtu, + lib.ethdev.set_mtu) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_vlan_filter, + lib.ethdev.vlan_filter) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_set_vlan_strip_on_queue, + lib.ethdev.set_vlan_strip_on_queue) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_set_vlan_ether_type, + lib.ethdev.set_vlan_ether_type) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_set_vlan_offload, + lib.ethdev.set_vlan_offload) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_get_vlan_offload, + lib.ethdev.get_vlan_offload) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_set_vlan_pvid, + lib.ethdev.set_vlan_pvid) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_flow_ctrl_get, + lib.ethdev.flow_ctrl_get) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_flow_ctrl_set, + lib.ethdev.flow_ctrl_set) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_priority_flow_ctrl_set, + lib.ethdev.priority_flow_ctrl_set) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_priority_flow_ctrl_queue_info_get, + lib.ethdev.priority_flow_ctrl_queue_info_get) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_priority_flow_ctrl_queue_configure, + lib.ethdev.priority_flow_ctrl_queue_configure) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_rss_reta_update, + lib.ethdev.rss_reta_update) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_rss_reta_query, + lib.ethdev.rss_reta_query) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_rss_hash_update, + lib.ethdev.rss_hash_update) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_rss_hash_conf_get, + lib.ethdev.rss_hash_conf_get) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_udp_tunnel_port_add, + lib.ethdev.udp_tunnel_port_add) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_udp_tunnel_port_delete, + lib.ethdev.udp_tunnel_port_delete) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_led_on, + lib.ethdev.led_on) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_led_off, + lib.ethdev.led_off) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_fec_get_capability, + lib.ethdev.fec_get_capability) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_fec_get, + lib.ethdev.fec_get) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_fec_set, + lib.ethdev.fec_set) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_mac_addr_add, + lib.ethdev.mac_addr_add) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_mac_addr_remove, + lib.ethdev.mac_addr_remove) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_default_mac_addr_set, + lib.ethdev.default_mac_addr_set) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_uc_hash_table_set, + lib.ethdev.uc_hash_table_set) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_uc_all_hash_table_set, + lib.ethdev.uc_all_hash_table_set) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_set_queue_rate_limit, + lib.ethdev.set_queue_rate_limit) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_rx_avail_thresh_set, + lib.ethdev.rx_avail_thresh_set) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_rx_avail_thresh_query, + lib.ethdev.rx_avail_thresh_query) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_callback_register, + lib.ethdev.callback_register) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_callback_unregister, + lib.ethdev.callback_unregister) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_rx_intr_ctl, + lib.ethdev.rx_intr_ctl) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_rx_intr_ctl_q_get_fd, + lib.ethdev.rx_intr_ctl_q_g
[PATCH v5 4/6] ethdev: add trace points for flow
Adds trace points for rte_flow specific functions in ethdev lib. Signed-off-by: Ankur Dwivedi --- lib/ethdev/ethdev_trace_points.c | 117 ++ lib/ethdev/rte_ethdev_trace.h| 383 +++ lib/ethdev/rte_ethdev_trace_fp.h | 113 + lib/ethdev/rte_flow.c| 314 +++-- lib/ethdev/version.map | 37 +++ 5 files changed, 898 insertions(+), 66 deletions(-) diff --git a/lib/ethdev/ethdev_trace_points.c b/lib/ethdev/ethdev_trace_points.c index 102a18fcc1..1953d90a5a 100644 --- a/lib/ethdev/ethdev_trace_points.c +++ b/lib/ethdev/ethdev_trace_points.c @@ -474,3 +474,120 @@ RTE_TRACE_POINT_REGISTER(rte_eth_trace_cman_config_set, RTE_TRACE_POINT_REGISTER(rte_eth_trace_cman_config_get, lib.ethdev.cman_config_get) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_copy, + lib.ethdev.flow.copy) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_create, + lib.ethdev.flow.create) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_destroy, + lib.ethdev.flow.destroy) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_flush, + lib.ethdev.flow.flush) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_isolate, + lib.ethdev.flow.isolate) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_query, + lib.ethdev.flow.query) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_validate, + lib.ethdev.flow.validate) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_conv, + lib.ethdev.flow.conv) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_dynf_metadata_register, + lib.ethdev.dynf_metadata_register) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_get_aged_flows, + lib.ethdev.flow.get_aged_flows) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_get_q_aged_flows, + lib.ethdev.flow.get_q_aged_flows) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_tunnel_decap_set, + lib.ethdev.flow.tunnel_decap_set) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_tunnel_match, + lib.ethdev.flow.tunnel_match) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_get_restore_info, + lib.ethdev.flow.get_restore_info) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_tunnel_action_decap_release, + lib.ethdev.flow.tunnel_action_decap_release) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_tunnel_item_release, + lib.ethdev.flow.tunnel_item_release) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_action_handle_create, + lib.ethdev.flow.action_handle_create) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_action_handle_destroy, + lib.ethdev.flow.action_handle_destroy) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_action_handle_update, + lib.ethdev.flow.action_handle_update) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_action_handle_query, + lib.ethdev.flow.action_handle_query) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_flex_item_create, + lib.ethdev.flow.flex_item_create) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_flex_item_release, + lib.ethdev.flow.flex_item_release) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_pick_transfer_proxy, + lib.ethdev.flow.pick_transfer_proxy) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_info_get, + lib.ethdev.flow.info_get) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_configure, + lib.ethdev.flow.configure) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_pattern_template_create, + lib.ethdev.flow.pattern_template_create) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_pattern_template_destroy, + lib.ethdev.flow.pattern_template_destroy) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_actions_template_create, + lib.ethdev.flow.actions_template_create) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_actions_template_destroy, + lib.ethdev.flow.actions_template_destroy) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_template_table_create, + lib.ethdev.flow.template_table_create) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_template_table_destroy, + lib.ethdev.flow.template_table_destroy) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_async_create, + lib.ethdev.flow.async_create) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_async_destroy, + lib.ethdev.flow.async_destroy) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_push, + lib.ethdev.flow.push) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_pull, + lib.ethdev.flow.pull) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_async_action_handle_create, + lib.ethdev.flow.async_action_handle_create) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_async_action_handle_destroy, + lib.ethdev.flow.async_action_handle_destroy) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_async_action_handle_update, + lib.ethdev.flow.async_action_handle_update) + +RTE_TRACE_POINT_REGISTER(rte_flow_trace_async_action_handle_query, + lib.ethdev.flow.async.action.handle.query) diff --git a/lib/ethdev/rte_ethdev_trace.h b/lib/ethdev/rte_ethdev_trace.h index 4c66834290..5bf7ffec6c 100644 --- a/lib/ethdev/rte_ethdev_trace.h +++ b/lib/ethdev/rte_ethdev_trace.h @@ -902,6 +902,389 @@ RTE
[PATCH v5 5/6] ethdev: add trace points for mtr
Adds trace points for rte_mtr specific functions in ethdev lib. Signed-off-by: Ankur Dwivedi --- lib/ethdev/ethdev_trace_points.c | 63 + lib/ethdev/rte_ethdev_trace.h| 112 ++ lib/ethdev/rte_ethdev_trace_fp.h | 100 lib/ethdev/rte_mtr.c | 156 +++ lib/ethdev/version.map | 21 + 5 files changed, 434 insertions(+), 18 deletions(-) diff --git a/lib/ethdev/ethdev_trace_points.c b/lib/ethdev/ethdev_trace_points.c index 1953d90a5a..067e5fdab4 100644 --- a/lib/ethdev/ethdev_trace_points.c +++ b/lib/ethdev/ethdev_trace_points.c @@ -591,3 +591,66 @@ RTE_TRACE_POINT_REGISTER(rte_flow_trace_async_action_handle_update, RTE_TRACE_POINT_REGISTER(rte_flow_trace_async_action_handle_query, lib.ethdev.flow.async.action.handle.query) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_capabilities_get, + lib.ethdev.mtr.capabilities_get) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_create, + lib.ethdev.mtr.create) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_destroy, + lib.ethdev.mtr.destroy) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_disable, + lib.ethdev.mtr.meter_disable) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_dscp_table_update, + lib.ethdev.mtr.meter_dscp_table_update) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_enable, + lib.ethdev.mtr.meter_enable) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_profile_add, + lib.ethdev.mtr.meter_profile_add) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_profile_delete, + lib.ethdev.mtr.meter_profile_delete) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_profile_get, + lib.ethdev.mtr.meter_profile_get) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_profile_update, + lib.ethdev.mtr.meter_profile_update) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_stats_read, + lib.ethdev.mtr.stats_read) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_stats_update, + lib.ethdev.mtr.stats_update) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_policy_add, + lib.ethdev.mtr.meter_policy_add) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_policy_delete, + lib.ethdev.mtr.meter_policy_delete) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_policy_get, + lib.ethdev.mtr.meter_policy_get) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_policy_update, + lib.ethdev.mtr.meter_policy_update) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_policy_validate, + lib.ethdev.mtr.meter_policy_validate) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_vlan_table_update, + lib.ethdev.mtr.meter_vlan_table_update) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_color_in_protocol_get, + lib.ethdev.mtr.color_in_protocol_get) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_color_in_protocol_priority_get, + lib.ethdev.mtr.color_in_protocol_priority_get) + +RTE_TRACE_POINT_REGISTER(rte_mtr_trace_color_in_protocol_set, + lib.ethdev.mtr.color_in_protocol_set) diff --git a/lib/ethdev/rte_ethdev_trace.h b/lib/ethdev/rte_ethdev_trace.h index 5bf7ffec6c..71994a9ab4 100644 --- a/lib/ethdev/rte_ethdev_trace.h +++ b/lib/ethdev/rte_ethdev_trace.h @@ -18,6 +18,7 @@ extern "C" { #include #include "rte_ethdev.h" +#include "rte_mtr.h" RTE_TRACE_POINT( rte_ethdev_trace_configure, @@ -1285,6 +1286,117 @@ RTE_TRACE_POINT( rte_trace_point_emit_int(ret); ) +RTE_TRACE_POINT( + rte_mtr_trace_capabilities_get, + RTE_TRACE_POINT_ARGS(uint16_t port_id, + struct rte_mtr_capabilities *cap, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_ptr(cap); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_mtr_trace_create, + RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t mtr_id, + struct rte_mtr_params *params, int shared, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u32(mtr_id); + rte_trace_point_emit_ptr(params); + rte_trace_point_emit_u32(params->meter_profile_id); + rte_trace_point_emit_int(params->use_prev_mtr_color); + rte_trace_point_emit_int(params->meter_enable); + rte_trace_point_emit_u64(params->stats_mask); + rte_trace_point_emit_u32(params->meter_policy_id); + rte_trace_point_emit_int(params->default_input_color); + rte_trace_point_emit_int(shared); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_mtr_trace_destroy, + RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t mtr_id, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u32(mtr_id); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_mtr_trace_meter_disable, + RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t mtr_id, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u32(mtr_id); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_PO
[PATCH v5 6/6] ethdev: add trace points for tm
Adds trace points for rte_tm specific functions in ethdev lib. Signed-off-by: Ankur Dwivedi --- lib/ethdev/ethdev_trace_points.c | 90 +++ lib/ethdev/rte_ethdev_trace.h| 141 ++ lib/ethdev/rte_ethdev_trace_fp.h | 171 + lib/ethdev/rte_tm.c | 247 +++ lib/ethdev/version.map | 30 5 files changed, 650 insertions(+), 29 deletions(-) diff --git a/lib/ethdev/ethdev_trace_points.c b/lib/ethdev/ethdev_trace_points.c index 067e5fdab4..af66a139df 100644 --- a/lib/ethdev/ethdev_trace_points.c +++ b/lib/ethdev/ethdev_trace_points.c @@ -654,3 +654,93 @@ RTE_TRACE_POINT_REGISTER(rte_mtr_trace_color_in_protocol_priority_get, RTE_TRACE_POINT_REGISTER(rte_mtr_trace_color_in_protocol_set, lib.ethdev.mtr.color_in_protocol_set) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_capabilities_get, + lib.ethdev.tm.capabilities_get) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_get_number_of_leaf_nodes, + lib.ethdev.tm.get_number_of_leaf_nodes) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_hierarchy_commit, + lib.ethdev.tm.hierarchy_commit) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_level_capabilities_get, + lib.ethdev.tm.level_capabilities_get) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_mark_ip_dscp, + lib.ethdev.tm.mark_ip_dscp) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_mark_ip_ecn, + lib.ethdev.tm.mark_ip_ecn) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_mark_vlan_dei, + lib.ethdev.tm.mark_vlan_dei) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_add, + lib.ethdev.tm.node_add) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_capabilities_get, + lib.ethdev.tm.node_capabilities_get) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_cman_update, + lib.ethdev.tm.node_cman_update) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_delete, + lib.ethdev.tm.node_delete) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_parent_update, + lib.ethdev.tm.node_parent_update) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_resume, + lib.ethdev.tm.node_resume) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_shaper_update, + lib.ethdev.tm.node_shaper_update) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_shared_shaper_update, + lib.ethdev.tm.node_shared_shaper_update) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_shared_wred_context_update, + lib.ethdev.tm.node_shared_wred_context_update) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_stats_read, + lib.ethdev.tm.node_stats_read) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_stats_update, + lib.ethdev.tm.node_stats_update) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_suspend, + lib.ethdev.tm.node_suspend) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_type_get, + lib.ethdev.tm.node_type_get) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_wfq_weight_mode_update, + lib.ethdev.tm.node_wfq_weight_mode_update) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_wred_context_update, + lib.ethdev.tm.node_wred_context_update) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_shaper_profile_add, + lib.ethdev.tm.shaper_profile_add) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_shaper_profile_delete, + lib.ethdev.tm.shaper_profile_delete) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_shared_shaper_add_update, + lib.ethdev.tm.shared_shaper_add_update) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_shared_shaper_delete, + lib.ethdev.tm.shared_shaper_delete) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_shared_wred_context_add_update, + lib.ethdev.tm.shared_wred_context_add_update) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_shared_wred_context_delete, + lib.ethdev.tm.shared_wred_context_delete) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_wred_profile_add, + lib.ethdev.tm.wred_profile_add) + +RTE_TRACE_POINT_REGISTER(rte_tm_trace_wred_profile_delete, + lib.ethdev.tm.wred_profile_delete) diff --git a/lib/ethdev/rte_ethdev_trace.h b/lib/ethdev/rte_ethdev_trace.h index 71994a9ab4..fd14e86d13 100644 --- a/lib/ethdev/rte_ethdev_trace.h +++ b/lib/ethdev/rte_ethdev_trace.h @@ -19,6 +19,7 @@ extern "C" { #include "rte_ethdev.h" #include "rte_mtr.h" +#include "rte_tm.h" RTE_TRACE_POINT( rte_ethdev_trace_configure, @@ -1397,6 +1398,146 @@ RTE_TRACE_POINT( rte_trace_point_emit_int(ret); ) +RTE_TRACE_POINT( + rte_tm_trace_capabilities_get, + RTE_TRACE_POINT_ARGS(uint16_t port_id, + struct rte_tm_capabilities *cap, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_ptr(cap); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_tm_trace_hierarchy_commit, + RTE_TRACE_POINT_ARGS(uint16_t port_id, int clear_on_fail, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_int(clear_on_fail); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_tm_trace_level_capabiliti
[RFC PATCH 0/1] Specify C-standard requirement for DPDK builds
Traditionally, DPDK has never specified a minimum C standard used either in DPDK builds or for applications using DPDK. Following discussion on-list about C standards, this RFC attempts to start the process of codifying what our standards expectations are. No code changes are made by this RFC, instead only the build parameters are changed to explicitly specify: * C99 standard is used to build DPDK itself. This is supported by all supported compiler versions of GCC and Clang. * The headers are checked for compatibility with gcc89 standard, which was the default standard used by the oldest supported version of GCC. DPDK headers do not build with the official C89 standard, and, to the best of my knowledge, have never done so. Bruce Richardson (1): build: increase minimum C standard for DPDK builds buildtools/chkincs/meson.build | 1 + meson.build| 1 + 2 files changed, 2 insertions(+) -- 2.37.2
[RFC PATCH 1/1] build: increase minimum C standard for DPDK builds
Set the default C language standard to be used for DPDK builds to C99. This requires no actual code changes to build successfully. To ensure compatibility is kept for external apps using DPDK headers, we explicitly set the build parameters for the chkincs binary to the old minimum standard of "gnu89". [NOTE: DPDK code does not compile and has previously not compiled for pure c89 standard, so that stricter requirement need not be checked.] By adding this additional check, we can separately manage C standards used internally in DPDK builds and that required in the build flags for external apps using DPDK. Signed-off-by: Bruce Richardson --- buildtools/chkincs/meson.build | 1 + meson.build| 1 + 2 files changed, 2 insertions(+) diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build index 378c2f19ef..322ac775ce 100644 --- a/buildtools/chkincs/meson.build +++ b/buildtools/chkincs/meson.build @@ -30,6 +30,7 @@ executable('chkincs', sources, c_args: cflags, include_directories: includes, dependencies: deps, +override_options: 'c_std=gnu89', install: false) # run tests for c++ builds also diff --git a/meson.build b/meson.build index f91d652bc5..9a2963cc16 100644 --- a/meson.build +++ b/meson.build @@ -9,6 +9,7 @@ project('DPDK', 'C', license: 'BSD', default_options: [ 'buildtype=release', +'c_std=c99', 'default_library=static', 'warning_level=2', ], -- 2.37.2
Re: [PATCH v3 2/3] graph: pcap capture for graph nodes
On Thu, Jan 12, 2023 at 3:31 PM Amit Prakash Shukla wrote: > > Implementation adds support to capture packets at each node with > packet metadata and node name. > > Signed-off-by: Amit Prakash Shukla > --- > v2: > - Fixed code style issue > - Fixed CI compilation issue on github-robot > > > diff --git a/lib/graph/graph_pcap_trace.c b/lib/graph/graph_pcap_trace.c > new file mode 100644 > index 00..f7b81a7ad1 > --- /dev/null > +++ b/lib/graph/graph_pcap_trace.c > @@ -0,0 +1,155 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(C) 2022 Marvell International Ltd. 2023 > + > +#define GRAPH_PCAP_BUF_SZ 128 > +#define GRAPH_PCAP_NUM_PACKETS 1024 > +#define GRAPH_PCAP_FILE_NAME_SZ128 > +#define GRAPH_PCAP_FILE_NAME "/tmp/graph_pcap_capture.pcapng" Expecting the filename from application. So no need to define here. > + > +static char file_name[GRAPH_PCAP_FILE_NAME_SZ]; > +static uint32_t pkt_buf_sz = RTE_MBUF_DEFAULT_BUF_SIZE; > +static uint64_t packet_to_capture = GRAPH_PCAP_NUM_PACKETS; > +static rte_pcapng_t *pcapng_fd; > +static struct rte_mempool *mp; > +static uint16_t port_id; > +static uint64_t packet_captured[RTE_MAX_LCORE]; > +static int pcap_trace_enable; See what it takes for multiprocess. If anything needs to be available in graph walk(which runs on secondary process) needs to be part of huge page. i.e part of rte_graph structure. > > + rte_node_process_t original_process; /**< Pcap enabled node callback > */ Add comment like, "Used to store the original process when pcap is enabled" or so > + > /* Fast path area */ > #define RTE_NODE_CTX_SZ 16 > uint8_t ctx[RTE_NODE_CTX_SZ] __rte_cache_aligned; /**< Node Context. > */ > diff --git a/lib/graph/version.map b/lib/graph/version.map > index 13b838752d..36153a75b2 100644 > --- a/lib/graph/version.map > +++ b/lib/graph/version.map > @@ -43,5 +43,12 @@ EXPERIMENTAL { > rte_node_next_stream_put; > rte_node_next_stream_move; > > + rte_pcap_trace_is_enable; > + rte_pcap_trace_enable; > + rte_graph_pcap_trace_init; > + rte_num_pkt_to_capture; > + rte_filename_to_capture_pkt; > + rte_graph_pcap_trace_exit; All of these public APIs are not needed. Since rte_graph is still experimental to make it clean, please add file name and number of packet to capture in struct rte_graph_param and update doc/guides/rel_notes/release_23_03.rst. See following example in doc/guides/rel_notes/release_22_07.rst API Changes --- * Experimental structures ``struct rte_mtr_params`` and ``struct rte_mtr_capabilities`` were updated to support protocol based input color for meter. > + > local: *; > }; > -- > 2.25.1 >
RE: [PATCH v2 0/4] crypto/ccp cleanup
[AMD Official Use Only - General] Hi David, Please find the below update. Thanks Sunil -Original Message- From: David Marchand Sent: Wednesday, January 11, 2023 8:44 PM To: Uttarwar, Sunil Prakashrao Cc: Yigit, Ferruh ; Akhil Goyal ; Namburu, Chandu-babu ; Sebastian, Selwin ; dev ; Thomas Monjalon Subject: Re: [PATCH v2 0/4] crypto/ccp cleanup Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding. On Fri, Nov 18, 2022 at 12:58 PM Uttarwar, Sunil Prakashrao wrote: > Hi David, > > Please find the below update > > - only one DPDK application can use ccp crypto engines (PCI bus > allow/blocklist is not respected, right?), Yes, only one crypto device can be > used in a DPDK application for the crypto operations. This is introduced from > the patch crypto/ccp: convert driver from vdev to PCI. This is implemented as > per community suggestion. Community suggested to have this driver a standard PCI driver, not a vdev one. I don't remember anything about the limitation. Can you point at the discussion that leaded to this? Sunil -> Please find the discussion about CCP driver as a PCI driver @ https://patches.dpdk.org/project/dpdk/patch/20201225080358.366162-1-asoma...@amd.com/ > > - since only one crypto device is exposed, there is no way for the > application to dedicate/decide how to distribute crypto operations over the > different ccp crypto engines available on the system. > > When there is no ccp device passed from the application > dpdk-test-crypto-perf, it tries to probe all CCP devices present on a system > and only one device can be used. It seems this is bug in the patch > implemented for crypto/ccp: convert driver from vdev to PCI and we are > looking into this. Indeed. So how should we proceed? Patches 1 to 3 are ready and can be merged. I don't mind dropping patch 4 if you have a better solution/alternative. Sunil-> As mentioned earlier, there is some issue with the patch https://patches.dpdk.org/project/dpdk/patch/20221004095132.198777-5-david.march...@redhat.com/. I worked on this patch and found issue. Did change in this patch and observing no issues. Still need some more time test, confirm changes and will share. For now, we can merge below changes, I will ack it. https://patches.dpdk.org/project/dpdk/patch/20221004095132.198777-2-david.march...@redhat.com/ https://patches.dpdk.org/project/dpdk/patch/20221004095132.198777-3-david.march...@redhat.com/ https://patches.dpdk.org/project/dpdk/patch/20221004095132.198777-4-david.march...@redhat.com/ We will merge the below patch once we fix it with modifications https://patches.dpdk.org/project/dpdk/patch/20221004095132.198777-5-david.march...@redhat.com/ Please let me know if any suggestions. -- David Marchand
RE: [PATCH v5 1/6] eal: trace: add trace point emit for blob
> From: Ankur Dwivedi [mailto:adwiv...@marvell.com] > Sent: Thursday, 12 January 2023 12.22 > > Adds a trace point emit function for emitting a blob. The maximum blob > bytes which can be captured is maximum value contained in uint16_t, > which is 65535. > > Also adds test case for emit array tracepoint function. > > Signed-off-by: Ankur Dwivedi > --- Excellent, thank you. [...] > +#define rte_trace_point_emit_blob(in, len) \ > +do { \ > + if (unlikely(in == NULL)) \ > + return; \ > + __rte_trace_point_emit(len, uint16_t); \ > + memcpy(mem, in, len); \ > + mem = RTE_PTR_ADD(mem, len); \ > +} while (0) I am somewhat unsure about my concerns here, so please forgive me if they are invalid... Is rte_trace_point_emit_blob() always called with "len" being a variable, then this is OK. If "len" can be a non-constant formula (e.g. len++), you need a temporary variable: #define rte_trace_point_emit_blob(in, len) \ do { \ uint16_t _len = len; \ if (unlikely(in == NULL)) \ return; \ __rte_trace_point_emit(_len, uint16_t); \ memcpy(mem, in, _len); \ mem = RTE_PTR_ADD(_mem, _len); \ } while (0) But I don't think this can ever happen. However, if "len" can be a constant (e.g. 6), does __rte_trace_point_emit(len, uint16_t) accept it? (The __rte_trace_point_emit() macro is shown below.) A constant has no pointer to it (i.e. &6 does not exist). Looking deeper at it, I'm afraid this question can be generalized to all the existing macros/functions calling __rte_trace_point_emit(). And now that I have hijacked your patch with a generalized question, I wonder if the existing __rte_trace_point_emit() has a bug? It uses sizeof(in), but I think it should use sizeof(type). It looks like this: #define __rte_trace_point_emit(in, type) \ do { \ memcpy(mem, &(in), sizeof(in)); \ mem = RTE_PTR_ADD(mem, sizeof(in)); \ } while (0) Alternatively, __rte_trace_point_emit() should RTE_BUILD_BUG_ON(typeof(in) != type). If my concerns above are invalid, then: Acked-by: Morten Brørup
RE: [RFC PATCH 1/1] build: increase minimum C standard for DPDK builds
> From: Bruce Richardson [mailto:bruce.richard...@intel.com] > Sent: Thursday, 12 January 2023 12.36 > > Set the default C language standard to be used for DPDK builds to C99. > This requires no actual code changes to build successfully. Great! > > To ensure compatibility is kept for external apps using DPDK headers, > we > explicitly set the build parameters for the chkincs binary to the old > minimum standard of "gnu89". [NOTE: DPDK code does not compile and has > previously not compiled for pure c89 standard, so that stricter > requirement need not be checked.] By adding this additional check, we > can separately manage C standards used internally in DPDK builds and > that required in the build flags for external apps using DPDK. It seems I have to accept this techboard decision for now. ;-) > > Signed-off-by: Bruce Richardson > --- Acked-by: Morten Brørup
Re: [RFC PATCH 1/1] build: increase minimum C standard for DPDK builds
On Thu, Jan 12, 2023 at 01:42:48PM +0100, Morten Brørup wrote: > > From: Bruce Richardson [mailto:bruce.richard...@intel.com] > > Sent: Thursday, 12 January 2023 12.36 > > > > Set the default C language standard to be used for DPDK builds to C99. > > This requires no actual code changes to build successfully. > > Great! > > > > > To ensure compatibility is kept for external apps using DPDK headers, > > we > > explicitly set the build parameters for the chkincs binary to the old > > minimum standard of "gnu89". [NOTE: DPDK code does not compile and has > > previously not compiled for pure c89 standard, so that stricter > > requirement need not be checked.] By adding this additional check, we > > can separately manage C standards used internally in DPDK builds and > > that required in the build flags for external apps using DPDK. > > It seems I have to accept this techboard decision for now. ;-) > There is no techboard decision here - certainly not yet. There is plenty of discussion still to be had. However, for now this RFC is being very conservative - perhaps overly so. /Bruce
Re: [PATCH v3 5/5] eventdev/crypto: fix failed events
On Wed, Dec 7, 2022 at 12:26 PM Gujjar, Abhinandan S wrote: > > Acked-by: Abhinandan Gujjar > > > -Original Message- > > From: Kundapura, Ganapati > > Sent: Wednesday, December 7, 2022 12:20 PM > > To: dev@dpdk.org; jer...@marvell.com; Naga Harish K, S V > > ; Gujjar, Abhinandan S > > > > Cc: Jayatheerthan, Jay ; vfia...@marvell.com > > Subject: [PATCH v3 5/5] eventdev/crypto: fix failed events > > > > Circular buffer stores events failed to enqueue to eventdev for retrying > > later. > > Current implementation adds the same crypto op to circular buffer instead of > > pointing all the ops in a batch. > > > > This fix updates the pointer to pointing to correct ops in the batch. > > > > Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation") > > > > Signed-off-by: Ganapati Kundapura Updated the git commit as follows and series applied to dpdk-next-net-eventdev/for-main. Thanks ommit 948973d20dbd465f8fcc502f9e3af3b0de3db1e6 (HEAD -> for-main) Author: Ganapati Kundapura Date: Wed Dec 7 00:49:45 2022 -0600 eventdev/crypto: fix failed events Circular buffer stores events failed to enqueue to eventdev for retrying later. Current implementation adds the same crypto op to circular buffer instead of pointing all the ops in a batch. This fix updates the pointer to pointing to correct ops in the batch. Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation") Cc: sta...@dpdk.org Signed-off-by: Ganapati Kundapura Acked-by: Abhinandan Gujjar commit 32fb46e8e37e4cd6f965c9e577243693b99c02d4 Author: Ganapati Kundapura Date: Wed Dec 7 00:49:44 2022 -0600 eventdev/crypto: fix overflow in circular buffer In case of crypto enqueue failures, even though back pressure flag is set to stop further dequeue from eventdev, the current logic does not stop dequeueing events for max_nb events. This is fixed by checking the back pressure just before dequeuing events from event device. Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation") Cc: sta...@dpdk.org Signed-off-by: Ganapati Kundapura Acked-by: Abhinandan Gujjar commit 74bf35c7b2510e9d3da409607a13b5887ceeb590 Author: Ganapati Kundapura Date: Wed Dec 7 00:49:43 2022 -0600 eventdev/crypto: fix wrong offset used while flushing events Events enqueued to eventdev from the beginning of the circular buffer. This leads to invalid or already freed events getting enqueued to eventdev from the circular buffer. Fixed by enqueuing the events to eventdev from the head pointer of circular buffer. Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation") Cc: sta...@dpdk.org Signed-off-by: Ganapati Kundapura Acked-by: Abhinandan Gujjar commit 1597b6602c3d90887c2ec65031377c2dba0aacf1 Author: Ganapati Kundapura Date: Wed Dec 7 00:49:42 2022 -0600 eventdev/crypto: fix wrong crypto enqueue count stats crypto_enq_count is updated on failure to enqueue ops to cryptodev. Updated crypto_enq_count on successful enqueue of ops to cryptodev. Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation") Cc: sta...@dpdk.org Signed-off-by: Ganapati Kundapura Acked-by: Abhinandan Gujjar commit 2b3049e5e61cff02488e402358854ae5e9b0279d Author: Ganapati Kundapura Date: Wed Dec 7 00:49:41 2022 -0600 eventdev/crypto: select enqueue mode based on implicit release capability In the current implementation adapter queries event device's capability for implicit release support. This information is used to decide whether events are enqueued back as NEW or FWD events. This patch updates the adapter to query the port caps for implicit release to decide on events enqueuing back as NEW/FWD events. Signed-off-by: Ganapati Kundapura Acked-by: Abhinandan Gujjar > > --- > > v3: > > * Updated commit message > > > > v2: > > * Updated subject line commit message > > > > diff --git a/lib/eventdev/rte_event_crypto_adapter.c > > b/lib/eventdev/rte_event_crypto_adapter.c > > index 31b8255..5d962a1 100644 > > --- a/lib/eventdev/rte_event_crypto_adapter.c > > +++ b/lib/eventdev/rte_event_crypto_adapter.c > > @@ -753,7 +753,7 @@ eca_crypto_adapter_deq_run(struct > > event_crypto_adapter *adapter, > > for (i = nb_enqueued; i < n; i++) > > eca_circular_buffer_add( > > &adapter->ebuf, > > - ops[nb_enqueued]); > > + ops[i]); > > > > check: > > nb_deq += n; > > -- > > 2.6.4 >
RE: [PATCH] crypto/qat: fix build
Hi Thomas, > -Original Message- > From: Thomas Monjalon > Sent: Thursday, January 12, 2023 10:41 AM > To: De Lara Guarch, Pablo ; Akhil Goyal > ; Ji, Kai > Cc: dev@dpdk.org; Tyler Retzlaff ; > dev@dpdk.org; David Marchand ; Dooley, > Brian ; Power, Ciara ; > Mcnamara, John > Subject: Re: [PATCH] crypto/qat: fix build > > 12/01/2023 11:32, Ji, Kai: > > Ok, a long story short, this issue should only occurred when > RTE_QAT_LIBIPSECMB is enabled. > > It was intend to remove Openssl lib dependency in QAT replaced with > > ipsec_mb lib, but the work was partially done due to limitation of > > ipsec_mb by the time (FIPS certification) > > > > I'm happy with current fix and please cc: sta...@dpdk.org > > I'm not happy with this fix. It is a dirty workaround. > It would be better to have an #ifdef in ipsec_mb. > > Also I would like an answer to the question below. What triggered this error? > Is it a new thing in the lib ipsec_mb? > Why defining AES_BLOCK_SIZE while IMB_AES_BLOCK_SIZE can be used and > have a proper prefix? Apologies for the late response. This macro was renamed to IMB_AES_BLOCK_SIZE, as you already know. The problem is that, for compatibility reasons, we had to keep the old macro as well. However, we added a compile time flag to remove these legacy macros, for exactly this reason (NO_COMPAT_IMB_API_053). I think a solution could be to use this flag in QAT, so the legacy macros are not defined. I will send a patch to fix this. Thanks, Pablo >
RE: [PATCH v5 1/6] eal: trace: add trace point emit for blob
Hi Morten, My comments are inline. >-Original Message- >From: Morten Brørup >Sent: Thursday, January 12, 2023 6:09 PM >To: Ankur Dwivedi ; dev@dpdk.org >Cc: tho...@monjalon.net; david.march...@redhat.com; m...@ashroe.eu; >or...@nvidia.com; ferruh.yi...@amd.com; ch...@att.com; >humi...@huawei.com; linvi...@tuxdriver.com; ciara.lof...@intel.com; >qi.z.zh...@intel.com; m...@semihalf.com; m...@semihalf.com; >shaib...@amazon.com; evge...@amazon.com; igo...@amazon.com; >cha...@amd.com; Igor Russkikh ; >shepard.sie...@atomicrules.com; ed.cz...@atomicrules.com; >john.mil...@atomicrules.com; ajit.khapa...@broadcom.com; >somnath.ko...@broadcom.com; Jerin Jacob Kollanukkaran >; Maciej Czekaj [C] ; Shijith >Thotton ; Srisivasubramanian Srinivasan >; Harman Kalra ; >rahul.lakkire...@chelsio.com; johnd...@cisco.com; hyon...@cisco.com; >liudongdo...@huawei.com; yisen.zhu...@huawei.com; >xuanziya...@huawei.com; cloud.wangxiao...@huawei.com; >zhouguoy...@huawei.com; simei...@intel.com; wenjun1...@intel.com; >qiming.y...@intel.com; yuying.zh...@intel.com; beilei.x...@intel.com; >xiao.w.w...@intel.com; jingjing...@intel.com; junfeng@intel.com; >rosen...@intel.com; Nithin Kumar Dabilpuram ; >Kiran Kumar Kokkilagadda ; Sunil Kumar Kori >; Satha Koteswara Rao Kottidi >; Liron Himi ; >z...@semihalf.com; Radha Chintakuntla ; >Veerasenareddy Burru ; Sathesh B Edara >; ma...@nvidia.com; viachesl...@nvidia.com; >lon...@microsoft.com; spin...@cesnet.cz; chaoyong...@corigine.com; >niklas.soderl...@corigine.com; hemant.agra...@nxp.com; >sachin.sax...@oss.nxp.com; g.si...@nxp.com; apeksha.gu...@nxp.com; >sachin.sax...@nxp.com; abo...@pensando.io; Rasesh Mody >; Shahed Shaikh ; Devendra >Singh Rawat ; andrew.rybche...@oktetlabs.ru; >jiawe...@trustnetic.com; jianw...@trustnetic.com; jbehr...@vmware.com; >maxime.coque...@redhat.com; chenbo@intel.com; >steven.webs...@windriver.com; matt.pet...@windriver.com; >bruce.richard...@intel.com; mtetsu...@gmail.com; gr...@u256.net; >jasvinder.si...@intel.com; cristian.dumitre...@intel.com; jgraj...@cisco.com >Subject: [EXT] RE: [PATCH v5 1/6] eal: trace: add trace point emit for blob > >External Email > >-- >> From: Ankur Dwivedi [mailto:adwiv...@marvell.com] >> Sent: Thursday, 12 January 2023 12.22 >> >> Adds a trace point emit function for emitting a blob. The maximum blob >> bytes which can be captured is maximum value contained in uint16_t, >> which is 65535. >> >> Also adds test case for emit array tracepoint function. >> >> Signed-off-by: Ankur Dwivedi >> --- > >Excellent, thank you. > >[...] > >> +#define rte_trace_point_emit_blob(in, len) \ do { \ >> +if (unlikely(in == NULL)) \ >> +return; \ >> +__rte_trace_point_emit(len, uint16_t); \ >> +memcpy(mem, in, len); \ >> +mem = RTE_PTR_ADD(mem, len); \ >> +} while (0) > >I am somewhat unsure about my concerns here, so please forgive me if they are >invalid... > >Is rte_trace_point_emit_blob() always called with "len" being a variable, then >this is OK. Yes rte_trace_point_emit_blob is always called with len being a variable. > >If "len" can be a non-constant formula (e.g. len++), you need a temporary >variable: > >#define rte_trace_point_emit_blob(in, len) \ do { \ > uint16_t _len = len; \ > if (unlikely(in == NULL)) \ > return; \ > __rte_trace_point_emit(_len, uint16_t); \ > memcpy(mem, in, _len); \ > mem = RTE_PTR_ADD(_mem, _len); \ >} while (0) > >But I don't think this can ever happen. Yes, I think the same. > >However, if "len" can be a constant (e.g. 6), does __rte_trace_point_emit(len, >uint16_t) accept it? (The __rte_trace_point_emit() macro is shown below.) A >constant has no pointer to it (i.e. &6 does not exist). > >Looking deeper at it, I'm afraid this question can be generalized to all the >existing macros/functions calling __rte_trace_point_emit(). > >And now that I have hijacked your patch with a generalized question, I wonder >if the existing __rte_trace_point_emit() has a bug? It uses sizeof(in), but I >think >it should use sizeof(type). > >It looks like this: > >#define __rte_trace_point_emit(in, type) \ do { \ > memcpy(mem, &(in), sizeof(in)); \ > mem = RTE_PTR_ADD(mem, sizeof(in)); \ >} while (0) > >Alternatively, __rte_trace_point_emit() should RTE_BUILD_BUG_ON(typeof(in) >!= type). Yes there would be compilation error if typeof(in) is not same as type. > > >If my concerns above are invalid, then: > >Acked-by: Morten Brørup
Re: [dpdk-dev] [PATCH] common/cnxk: fix issue with IPv6 ext matching
On Thu, Jan 12, 2023 at 12:06 PM wrote: > > From: Kiran Kumar K > > While configuring ipv6 flow, ipv6 ext ltype should be > matched along with ipv6. Adding changes to fix this issue. > > Fixes: 474e275b1bc6 ("common/cnxk: support extensions attributes in IPv6 > item") > Cc: sta...@dpdk.org > > Signed-off-by: Kiran Kumar K > Reviewed-by: Satheesh Paul Updated the git commit as follows and applied to dpdk-next-net-mrvl/for-next-net. Thanks common/cnxk: fix issue with IPv6 ext matching While configuring IPv6 flow, IPv6 ext ltype should be matched along with IPv6. Adding changes to fix this issue. Fixes: 474e275b1bc6 ("common/cnxk: support extensions attributes in IPv6 item") Cc: sta...@dpdk.org Signed-off-by: Kiran Kumar K Reviewed-by: Satheesh Paul > --- > drivers/common/cnxk/roc_npc_mcam.c | 19 ++- > 1 file changed, 10 insertions(+), 9 deletions(-) > > diff --git a/drivers/common/cnxk/roc_npc_mcam.c > b/drivers/common/cnxk/roc_npc_mcam.c > index c419ce3a4c..0abd8872b1 100644 > --- a/drivers/common/cnxk/roc_npc_mcam.c > +++ b/drivers/common/cnxk/roc_npc_mcam.c > @@ -727,15 +727,16 @@ npc_set_ipv6ext_ltype_mask(struct npc_parse_state *pst) > * because for AH and ESP, LC LFLAG is zero and we don't want to match > * zero in LFLAG. > */ > - lcflag_offset = > - __builtin_popcount(pst->npc->keyx_supp_nmask[pst->nix_intf] & > - ((1ULL << NPC_LFLAG_LC_OFFSET) - 1)); > - lcflag_offset *= 4; > - > - mask = (0xfULL << lcflag_offset); > - val = pst->flow->mcam_data[0] & mask; > - if (val) > - pst->flow->mcam_mask[0] |= mask; > + if (pst->npc->keyx_supp_nmask[pst->nix_intf] & (1ULL << > NPC_LFLAG_LC_OFFSET)) { > + lcflag_offset = > __builtin_popcount(pst->npc->keyx_supp_nmask[pst->nix_intf] & > + ((1ULL << > NPC_LFLAG_LC_OFFSET) - 1)); > + lcflag_offset *= 4; > + > + mask = (0xfULL << lcflag_offset); > + val = pst->flow->mcam_data[0] & mask; > + if (val) > + pst->flow->mcam_mask[0] |= mask; > + } > } > > int > -- > 2.35.3 >
[PATCH 1/4] net/mlx5/hws: definitions for Hash Split/Linear Lookup tbls
Added PRM bits for new RTC types: Hash Split and Linear Lookup tables, as well as for HASH_RESULT field that contains hash result of the Hash Split table calculation. Signed-off-by: Yevgeny Kliteynik --- drivers/common/mlx5/mlx5_prm.h| 26 +++--- drivers/net/mlx5/hws/mlx5dr_cmd.c | 2 ++ drivers/net/mlx5/hws/mlx5dr_cmd.h | 2 ++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h index 3790dc84b8..9294f65e24 100644 --- a/drivers/common/mlx5/mlx5_prm.h +++ b/drivers/common/mlx5/mlx5_prm.h @@ -759,6 +759,7 @@ enum mlx5_modification_field { MLX5_MODI_OUT_IP_ECN = 0x73, MLX5_MODI_TUNNEL_HDR_DW_1 = 0x75, MLX5_MODI_GTPU_FIRST_EXT_DW_0 = 0x76, + MLX5_MODI_HASH_RESULT = 0x81, }; /* Total number of metadata reg_c's. */ @@ -2043,7 +2044,9 @@ struct mlx5_ifc_ft_fields_support_bits { * Table 1872 - Flow Table Fields Supported 2 Format */ struct mlx5_ifc_ft_fields_support_2_bits { - u8 reserved_at_0[0xf]; + u8 reserved_at_0[0xd]; + u8 hash_result[0x1]; + u8 reserved_at_e[0x1]; u8 tunnel_header_2_3[0x1]; u8 tunnel_header_0_1[0x1]; u8 macsec_syndrome[0x1]; @@ -2178,7 +2181,9 @@ struct mlx5_ifc_wqe_based_flow_table_cap_bits { u8 log_max_num_rtc[0x5]; u8 reserved_at_18[0x3]; u8 log_max_num_header_modify_pattern[0x5]; - u8 reserved_at_20[0x3]; + u8 rtc_hash_split_table[0x1]; + u8 rtc_linear_lookup_table[0x1]; + u8 reserved_at_22[0x1]; u8 stc_alloc_log_granularity[0x5]; u8 reserved_at_28[0x3]; u8 stc_alloc_log_max[0x5]; @@ -2198,6 +2203,11 @@ struct mlx5_ifc_wqe_based_flow_table_cap_bits { u8 header_insert_type[0x10]; u8 header_remove_type[0x10]; u8 trivial_match_definer[0x20]; + u8 reserved_at_140[0x20]; + u8 reserved_at_160[0x18]; + u8 access_index_mode[0x8]; + u8 reserved_at_180[0x20]; + u8 linear_match_definer_reg_c3[0x20]; }; union mlx5_ifc_hca_cap_union_bits { @@ -3215,6 +3225,11 @@ enum mlx5_ifc_rtc_update_mode { MLX5_IFC_RTC_STE_UPDATE_MODE_BY_OFFSET = 0x1, }; +enum mlx5_ifc_rtc_access_mode { + MLX5_IFC_RTC_STE_ACCESS_MODE_BY_HASH = 0x0, + MLX5_IFC_RTC_STE_ACCESS_MODE_LINEAR = 0x1, +}; + enum mlx5_ifc_rtc_ste_format { MLX5_IFC_RTC_STE_FORMAT_8DW = 0x4, MLX5_IFC_RTC_STE_FORMAT_11DW = 0x5, @@ -3225,6 +3240,8 @@ enum mlx5_ifc_rtc_reparse_mode { MLX5_IFC_RTC_REPARSE_ALWAYS = 0x1, }; +#define MLX5_IFC_RTC_LINEAR_LOOKUP_TBL_LOG_MAX 16 + struct mlx5_ifc_rtc_bits { u8 modify_field_select[0x40]; u8 reserved_at_40[0x40]; @@ -3232,7 +3249,10 @@ struct mlx5_ifc_rtc_bits { u8 reparse_mode[0x2]; u8 reserved_at_84[0x4]; u8 pd[0x18]; - u8 reserved_at_a0[0x13]; + u8 reserved_at_a0[0x9]; + u8 access_index_mode[0x3]; + u8 num_hash_definer[0x4]; + u8 reserved_at_b0[0x3]; u8 log_depth[0x5]; u8 log_hash_size[0x8]; u8 ste_format[0x8]; diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.c b/drivers/net/mlx5/hws/mlx5dr_cmd.c index 754a424bd7..c64f127de8 100644 --- a/drivers/net/mlx5/hws/mlx5dr_cmd.c +++ b/drivers/net/mlx5/hws/mlx5dr_cmd.c @@ -264,6 +264,8 @@ mlx5dr_cmd_rtc_create(struct ibv_context *ctx, MLX5_IFC_RTC_STE_FORMAT_8DW); MLX5_SET(rtc, attr, pd, rtc_attr->pd); MLX5_SET(rtc, attr, update_index_mode, rtc_attr->update_index_mode); + MLX5_SET(rtc, attr, access_index_mode, rtc_attr->access_index_mode); + MLX5_SET(rtc, attr, num_hash_definer, rtc_attr->num_hash_definer); MLX5_SET(rtc, attr, log_depth, rtc_attr->log_depth); MLX5_SET(rtc, attr, log_hash_size, rtc_attr->log_size); MLX5_SET(rtc, attr, table_type, rtc_attr->table_type); diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.h b/drivers/net/mlx5/hws/mlx5dr_cmd.h index 9fe493a8f9..5d8d779708 100644 --- a/drivers/net/mlx5/hws/mlx5dr_cmd.h +++ b/drivers/net/mlx5/hws/mlx5dr_cmd.h @@ -41,6 +41,8 @@ struct mlx5dr_cmd_rtc_create_attr { uint32_t ste_offset; uint32_t miss_ft_id; uint8_t update_index_mode; + uint8_t access_index_mode; + uint8_t num_hash_definer; uint8_t log_depth; uint8_t log_size; uint8_t table_type; -- 2.27.0
[PATCH 2/4] net/mlx5/hws: read capabilities for Split/Linear tables
Read device capabilities that describe the support for Hash Split table and Linear RTC table. Signed-off-by: Yevgeny Kliteynik --- drivers/net/mlx5/hws/mlx5dr_cmd.c | 16 drivers/net/mlx5/hws/mlx5dr_cmd.h | 4 2 files changed, 20 insertions(+) diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.c b/drivers/net/mlx5/hws/mlx5dr_cmd.c index c64f127de8..32378673cf 100644 --- a/drivers/net/mlx5/hws/mlx5dr_cmd.c +++ b/drivers/net/mlx5/hws/mlx5dr_cmd.c @@ -970,6 +970,22 @@ int mlx5dr_cmd_query_caps(struct ibv_context *ctx, caps->stc_alloc_log_gran = MLX5_GET(query_hca_cap_out, out, capability.wqe_based_flow_table_cap. stc_alloc_log_granularity); + + caps->rtc_hash_split_table = MLX5_GET(query_hca_cap_out, out, + capability.wqe_based_flow_table_cap. + rtc_hash_split_table); + + caps->rtc_linear_lookup_table = MLX5_GET(query_hca_cap_out, out, + capability.wqe_based_flow_table_cap. + rtc_linear_lookup_table); + + caps->access_index_mode = MLX5_GET(query_hca_cap_out, out, + capability.wqe_based_flow_table_cap. + access_index_mode); + + caps->linear_match_definer = MLX5_GET(query_hca_cap_out, out, + capability.wqe_based_flow_table_cap. + linear_match_definer_reg_c3); } if (caps->eswitch_manager) { diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.h b/drivers/net/mlx5/hws/mlx5dr_cmd.h index 5d8d779708..468557ba16 100644 --- a/drivers/net/mlx5/hws/mlx5dr_cmd.h +++ b/drivers/net/mlx5/hws/mlx5dr_cmd.h @@ -170,7 +170,11 @@ struct mlx5dr_cmd_query_caps { uint8_t format_select_gtpu_dw_1; uint8_t format_select_gtpu_dw_2; uint8_t format_select_gtpu_ext_dw_0; + uint32_t linear_match_definer; + uint8_t access_index_mode; bool full_dw_jumbo_support; + bool rtc_hash_split_table; + bool rtc_linear_lookup_table; struct mlx5dr_cmd_query_ft_caps nic_ft; struct mlx5dr_cmd_query_ft_caps fdb_ft; bool eswitch_manager; -- 2.27.0
[PATCH 3/4] net/mlx5/hws: support insert/distribute RTC properties
Added support for RTC with insertion by hash/index and distribution by normal/linear hash. Supported modes are: - INSERT_BY_HASH + DISTRIBUTE_BY_HASH: what we had until now - INSERT_BY_INDEX + DISTRIBUTE_BY_HASH: Hash Split table, can also be used to calculate hash, in which case the result can be read from the hash_result meta-field (MLX5_MODI_HASH_RESULT) - INSERT_BY_INDEX + DISTRIBUTE_BY_LINEAR: Linear Lookup table, supported only for metadata_reg_c3[31:16] bits When setting INSERT_BY_INDEX mode, you can still provide number of rules both through 'rule' and 'table' fields of matcher attributes, but if 'table' is used, then 'table.sz_col_log' has to be 0. When providing rule with index, this index is used both in rule creation and deletion. Signed-off-by: Yevgeny Kliteynik --- drivers/net/mlx5/hws/mlx5dr.h | 17 ++- drivers/net/mlx5/hws/mlx5dr_debug.c | 6 +- drivers/net/mlx5/hws/mlx5dr_matcher.c | 211 +- drivers/net/mlx5/hws/mlx5dr_matcher.h | 6 + drivers/net/mlx5/hws/mlx5dr_rule.c| 23 ++- drivers/net/mlx5/hws/mlx5dr_rule.h| 2 +- 6 files changed, 217 insertions(+), 48 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h index c0f9a5e984..b3b2bf34f2 100644 --- a/drivers/net/mlx5/hws/mlx5dr.h +++ b/drivers/net/mlx5/hws/mlx5dr.h @@ -111,6 +111,16 @@ enum mlx5dr_matcher_flow_src { MLX5DR_MATCHER_FLOW_SRC_VPORT = 0x2, }; +enum mlx5dr_matcher_insert_mode { + MLX5DR_MATCHER_INSERT_BY_HASH = 0x0, + MLX5DR_MATCHER_INSERT_BY_INDEX = 0x1, +}; + +enum mlx5dr_matcher_distribute_mode { + MLX5DR_MATCHER_DISTRIBUTE_BY_HASH = 0x0, + MLX5DR_MATCHER_DISTRIBUTE_BY_LINEAR = 0x1, +}; + struct mlx5dr_matcher_attr { /* Processing priority inside table */ uint32_t priority; @@ -120,6 +130,9 @@ struct mlx5dr_matcher_attr { enum mlx5dr_matcher_resource_mode mode; /* Optimize insertion in case packet origin is the same for all rules */ enum mlx5dr_matcher_flow_src optimize_flow_src; + /* Define the insertion and distribution modes for this matcher */ + enum mlx5dr_matcher_insert_mode insert_mode; + enum mlx5dr_matcher_distribute_mode distribute_mode; union { struct { uint8_t sz_row_log; @@ -135,7 +148,9 @@ struct mlx5dr_matcher_attr { struct mlx5dr_rule_attr { uint16_t queue_id; void *user_data; - /* Valid if matcher optimize_using_rule_idx is set */ + /* Valid if matcher optimize_using_rule_idx is set or +* if matcher is configured to insert rules by index. +*/ uint32_t rule_idx; uint32_t burst:1; }; diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.c b/drivers/net/mlx5/hws/mlx5dr_debug.c index 239dfcae46..0815327b18 100644 --- a/drivers/net/mlx5/hws/mlx5dr_debug.c +++ b/drivers/net/mlx5/hws/mlx5dr_debug.c @@ -158,7 +158,7 @@ mlx5dr_debug_dump_matcher_attr(FILE *f, struct mlx5dr_matcher *matcher) struct mlx5dr_matcher_attr *attr = &matcher->attr; int ret; - ret = fprintf(f, "%d,0x%" PRIx64 ",%d,%d,%d,%d,%d,%d\n", + ret = fprintf(f, "%d,0x%" PRIx64 ",%d,%d,%d,%d,%d,%d,%d,%d\n", MLX5DR_DEBUG_RES_TYPE_MATCHER_ATTR, (uint64_t)(uintptr_t)matcher, attr->priority, @@ -166,7 +166,9 @@ mlx5dr_debug_dump_matcher_attr(FILE *f, struct mlx5dr_matcher *matcher) attr->table.sz_row_log, attr->table.sz_col_log, attr->optimize_using_rule_idx, - attr->optimize_flow_src); + attr->optimize_flow_src, + attr->insert_mode, + attr->distribute_mode); if (ret < 0) { rte_errno = EINVAL; return rte_errno; diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c index 46217b2ab3..60865bf562 100644 --- a/drivers/net/mlx5/hws/mlx5dr_matcher.c +++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c @@ -4,6 +4,25 @@ #include "mlx5dr_internal.h" +enum mlx5dr_matcher_rtc_type { + DR_MATCHER_RTC_TYPE_MATCH, + DR_MATCHER_RTC_TYPE_STE_ARRAY, + DR_MATCHER_RTC_TYPE_MAX, +}; + +static const char * const mlx5dr_matcher_rtc_type_str[] = { + [DR_MATCHER_RTC_TYPE_MATCH] = "MATCH", + [DR_MATCHER_RTC_TYPE_STE_ARRAY] = "STE_ARRAY", + [DR_MATCHER_RTC_TYPE_MAX] = "UNKNOWN", +}; + +static const char *mlx5dr_matcher_rtc_type_to_str(enum mlx5dr_matcher_rtc_type rtc_type) +{ + if (rtc_type > DR_MATCHER_RTC_TYPE_MAX) + rtc_type = DR_MATCHER_RTC_TYPE_MAX; + return mlx5dr_matcher_rtc_type_str[rtc_type]; +} + static bool mlx5dr_matcher_requires_col_tbl(uint8_t log_num_of_rules) { /* Collision table concatenation is done only for large rule tables */ @@ -320,10 +339,11 @@ static int mlx5dr_matcher_disconnect(str
[PATCH 4/4] net/mlx5/hws: handle collision matcher for linear RTC
No need to create/destroy collision matcher for linear RTC, because it has a constant depth of 1 STE - packets reaching any STE in the array will always match and perform the specified actions. Signed-off-by: Yevgeny Kliteynik --- drivers/net/mlx5/hws/mlx5dr_matcher.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c index 60865bf562..d509a2f0e1 100644 --- a/drivers/net/mlx5/hws/mlx5dr_matcher.c +++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c @@ -925,7 +925,8 @@ mlx5dr_matcher_create_col_matcher(struct mlx5dr_matcher *matcher) struct mlx5dr_matcher *col_matcher; int ret; - if (matcher->attr.mode != MLX5DR_MATCHER_RESOURCE_MODE_RULE) + if (matcher->attr.mode != MLX5DR_MATCHER_RESOURCE_MODE_RULE || + matcher->attr.insert_mode == MLX5DR_MATCHER_INSERT_BY_INDEX) return 0; if (!mlx5dr_matcher_requires_col_tbl(matcher->attr.rule.num_log)) @@ -972,7 +973,8 @@ mlx5dr_matcher_create_col_matcher(struct mlx5dr_matcher *matcher) static void mlx5dr_matcher_destroy_col_matcher(struct mlx5dr_matcher *matcher) { - if (matcher->attr.mode != MLX5DR_MATCHER_RESOURCE_MODE_RULE) + if (matcher->attr.mode != MLX5DR_MATCHER_RESOURCE_MODE_RULE || + matcher->attr.insert_mode == MLX5DR_MATCHER_INSERT_BY_INDEX) return; if (matcher->col_matcher) { -- 2.27.0
Re: [PATCH v4] devtools: parallelize ABI check
On 1/12/2023 10:53 AM, David Marchand wrote: > On Wed, Jan 11, 2023 at 8:53 PM Thomas Monjalon wrote: >> >> Generation and comparison of ABI dumps are done on multiple cores >> thanks to xargs -P0. >> It can accelerate this long step by 5 in my tests. >> >> xargs reports a global error if one of the process has an error. >> >> Running a shell function with xargs requires to export it. >> POSIX shell does not support function export except using an "eval trick". >> Required variables are also exported. >> >> Signed-off-by: Thomas Monjalon >> Tested-by: Ferruh Yigit >> diff --git a/devtools/check-abi.sh b/devtools/check-abi.sh >> index c583eae2fd..31eceb42e6 100755 >> --- a/devtools/check-abi.sh >> +++ b/devtools/check-abi.sh >> @@ -34,20 +34,18 @@ else >> ABIDIFF_OPTIONS="$ABIDIFF_OPTIONS --headers-dir2 $incdir2" >> fi >> >> -error= >> -for dump in $(find $refdir -name "*.dump"); do >> +export newdir ABIDIFF_OPTIONS >> +export diff_func='run_diff() { >> + dump=$1 >> name=$(basename $dump) >> dump2=$(find $newdir -name $name) >> if [ -z "$dump2" ] || [ ! -e "$dump2" ]; then >> echo "Error: cannot find $name in $newdir" >&2 >> - error=1 >> - continue >> - fi >> + return 1 >> + fi; > > No need for ; here. > This can be fixed when applying (I tested both your patch and with > this small fix). > > >> abidiff $ABIDIFF_OPTIONS $dump $dump2 || { >> abiret=$? >> - echo "Error: ABI issue reported for 'abidiff >> $ABIDIFF_OPTIONS $dump $dump2'" >&2 >> - error=1 >> - echo >> + echo "Error: ABI issue reported for abidiff $ABIDIFF_OPTIONS >> $dump $dump2" >&2 >> if [ $(($abiret & 3)) -ne 0 ]; then >> echo "ABIDIFF_ERROR|ABIDIFF_USAGE_ERROR, this could >> be a script or environment issue." >&2 >> fi >> @@ -57,8 +55,13 @@ for dump in $(find $refdir -name "*.dump"); do >> if [ $(($abiret & 8)) -ne 0 ]; then >> echo "ABIDIFF_ABI_INCOMPATIBLE_CHANGE, this change >> breaks the ABI." >&2 >> fi >> - echo >> + return 1 >> } >> -done >> +}' >> + >> +error= >> +find $refdir -name "*.dump" | >> +xargs -n1 -P0 sh -c 'eval "$diff_func"; run_diff $0' || >> +error=1 >> >> [ -z "$error" ] || [ -n "$warnonly" ] > > For the record, on my system, calling this script is ~5 times faster: > - before > real0m5,447s > user0m4,497s > sys0m0,937s > > - after > real0m1,202s > user0m10,784s > sys0m2,027s > > >> diff --git a/devtools/gen-abi.sh b/devtools/gen-abi.sh >> index f15a3b9aaf..61f7510ea1 100755 >> --- a/devtools/gen-abi.sh >> +++ b/devtools/gen-abi.sh >> @@ -22,5 +22,6 @@ for f in $(find $installdir -name "*.so.*"); do >> fi >> >> libname=$(basename $f) >> - abidw --out-file $dumpdir/${libname%.so*}.dump $f >> -done >> + echo $dumpdir/${libname%.so*}.dump $f >> +done | >> +xargs -n2 -P0 abidw --out-file >> -- >> 2.39.0 >> > > - before > real0m8,237s > user0m7,704s > sys0m0,504s > > - after > real0m2,517s > user0m14,145s > sys0m0,766s > > > Ferruh, I am seeing quite different numbers for running those scripts > (clearly not of the minute order). > I switched to testing/building in tmpfs some time ago. > It requires a good amount of memory (I empirically allocated 40G), but > maybe worth a try for you? > I run 'test-meson-builds.sh' script directly and yes I am getting different numbers although there is still improvement, not in scale with what you are getting, with v4 I have following: - before real10m3.248s user39m8.664s sys 14m52.870s - after real7m49.086s user39m59.507s sys 15m0.598s What I am running exactly is: time DPDK_ABI_REF_VERSION=v22.11.1 DPDK_ABI_REF_DIR=/tmp/dpdk-abiref DPDK_ABI_REF_SRC=.../dpdk-stable/ ./devtools/test-meson-builds.sh > > In any case, this patch lgtm. > Acked-by: David Marchand > >
Re: [PATCH] crypto/qat: fix build
12/01/2023 14:22, De Lara Guarch, Pablo: > Hi Thomas, > > From: Thomas Monjalon > > 12/01/2023 11:32, Ji, Kai: > > > Ok, a long story short, this issue should only occurred when > > RTE_QAT_LIBIPSECMB is enabled. > > > It was intend to remove Openssl lib dependency in QAT replaced with > > > ipsec_mb lib, but the work was partially done due to limitation of > > > ipsec_mb by the time (FIPS certification) > > > > > > I'm happy with current fix and please cc: sta...@dpdk.org > > > > I'm not happy with this fix. It is a dirty workaround. > > It would be better to have an #ifdef in ipsec_mb. > > > > Also I would like an answer to the question below. What triggered this > > error? > > Is it a new thing in the lib ipsec_mb? > > Why defining AES_BLOCK_SIZE while IMB_AES_BLOCK_SIZE can be used and > > have a proper prefix? > > Apologies for the late response. > > This macro was renamed to IMB_AES_BLOCK_SIZE, as you already know. > The problem is that, for compatibility reasons, we had to keep the old macro > as well. > However, we added a compile time flag to remove these legacy macros, for > exactly this reason > (NO_COMPAT_IMB_API_053). > > I think a solution could be to use this flag in QAT, so the legacy macros are > not defined. > > I will send a patch to fix this. OK good, so we can reject this patch?
[PATCH] Update mailmap file
Signed-off-by: Yevgeny Kliteynik --- .mailmap | 1 + 1 file changed, 1 insertion(+) diff --git a/.mailmap b/.mailmap index 75884b6fe2..8b48f41ca8 100644 --- a/.mailmap +++ b/.mailmap @@ -1495,6 +1495,7 @@ Yash Sharma Yasufumi Ogawa Yelena Krivosheev Yerden Zhumabekov +Yevgeny Kliteynik Yicai Lu Yiding Zhou Yi Li -- 2.18.1
RE: [RFC PATCH 1/1] build: increase minimum C standard for DPDK builds
> From: Bruce Richardson [mailto:bruce.richard...@intel.com] > Sent: Thursday, 12 January 2023 13.47 > > On Thu, Jan 12, 2023 at 01:42:48PM +0100, Morten Brørup wrote: > > > From: Bruce Richardson [mailto:bruce.richard...@intel.com] > > > Sent: Thursday, 12 January 2023 12.36 > > > > > > Set the default C language standard to be used for DPDK builds to > C99. > > > This requires no actual code changes to build successfully. > > > > Great! > > > > > > > > To ensure compatibility is kept for external apps using DPDK > headers, > > > we > > > explicitly set the build parameters for the chkincs binary to the > old > > > minimum standard of "gnu89". [NOTE: DPDK code does not compile and > has > > > previously not compiled for pure c89 standard, so that stricter > > > requirement need not be checked.] By adding this additional check, > we > > > can separately manage C standards used internally in DPDK builds > and > > > that required in the build flags for external apps using DPDK. > > > > It seems I have to accept this techboard decision for now. ;-) > > > There is no techboard decision here - certainly not yet. There is > plenty of > discussion still to be had. However, for now this RFC is being very > conservative - perhaps overly so. Yeah, perhaps I was phrasing that somewhat emotionally loaded. :-) I didn't mean to cause confusion on the mailing list. Thanks for clarifying, Bruce.
[PATCH V3 00/11] pipeline: add IPsec support
This patch set introduces a companion block for the SWX pipeline for IPsec support. The IPsec block is external to the pipeline, hence it needs to be explicitly instantiated by the user and connected to a pipeline instance through the pipeline I/O ports. Main features: * IPsec inbound (encrypted input packets -> clear text output packets) and outbound (clear text input packets -> encrypted output packets) processing support for tunnel and transport modes. Interaction of the IPsec block with the pipeline: * Each IPsec block instance has its own set of Security Associations (SAs) used to process the input packets. Each SA is identified by its unique SA ID. The IPsec inbound and outbound SAs share the same ID space. * Each input packet is first mapped to one of the existing SAs by using the SA ID and then processed according to the identified SA. The SA ID is read from input packet. The SA ID field is typically written by the pipeline before sending the packet to the IPsec block. Change log: V3: Rebase on top of main latest. V2: Fix minor style issues. Cristian Dumitrescu (11): pipeline: add IPsec support examples/pipeline: rework memory pool support examples/pipeline: streamline ring support examples/pipeline: streamline the Ethernet device support examples/pipeline: support crypto devices examples/pipeline: add CLI command for crypto device examples/pipeline: add IPsec CLI commands examples/pipeline: rework the thread configuration updates examples/pipeline: support blocks other than pipelines examples/pipeline: add block enable/disable CLI commands examples/pipeline: add IPsec example examples/pipeline/cli.c | 896 ++-- examples/pipeline/examples/fib.cli|4 +- examples/pipeline/examples/hash_func.cli |4 +- examples/pipeline/examples/ipsec.cli | 57 + examples/pipeline/examples/ipsec.io | 23 + examples/pipeline/examples/ipsec.spec | 138 ++ examples/pipeline/examples/ipsec_sa.txt | 216 ++ examples/pipeline/examples/l2fwd.cli |4 +- examples/pipeline/examples/l2fwd_macswp.cli |4 +- .../pipeline/examples/l2fwd_macswp_pcap.cli |4 +- examples/pipeline/examples/l2fwd_pcap.cli |4 +- examples/pipeline/examples/learner.cli|4 +- examples/pipeline/examples/meter.cli |4 +- examples/pipeline/examples/mirroring.cli |4 +- examples/pipeline/examples/recirculation.cli |4 +- examples/pipeline/examples/registers.cli |4 +- examples/pipeline/examples/selector.cli |4 +- examples/pipeline/examples/varbit.cli |4 +- examples/pipeline/examples/vxlan.cli |4 +- examples/pipeline/examples/vxlan_pcap.cli |4 +- examples/pipeline/main.c | 12 +- examples/pipeline/obj.c | 359 +--- examples/pipeline/obj.h | 100 +- examples/pipeline/thread.c| 655 +++--- examples/pipeline/thread.h| 24 +- lib/pipeline/meson.build |4 +- lib/pipeline/rte_swx_ipsec.c | 1821 + lib/pipeline/rte_swx_ipsec.h | 383 lib/pipeline/version.map |9 + 29 files changed, 3739 insertions(+), 1018 deletions(-) create mode 100644 examples/pipeline/examples/ipsec.cli create mode 100644 examples/pipeline/examples/ipsec.io create mode 100644 examples/pipeline/examples/ipsec.spec create mode 100644 examples/pipeline/examples/ipsec_sa.txt create mode 100644 lib/pipeline/rte_swx_ipsec.c create mode 100644 lib/pipeline/rte_swx_ipsec.h -- 2.34.1
[PATCH V3 01/11] pipeline: add IPsec support
This block is providing IPsec support to the SWX pipeline. The IPsec block is external to the pipeline, so it needs to be explicitly instantiated and connected to a pipeline through the I/O ports. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- lib/pipeline/meson.build |4 +- lib/pipeline/rte_swx_ipsec.c | 1821 ++ lib/pipeline/rte_swx_ipsec.h | 383 +++ lib/pipeline/version.map |9 + 4 files changed, 2216 insertions(+), 1 deletion(-) create mode 100644 lib/pipeline/rte_swx_ipsec.c create mode 100644 lib/pipeline/rte_swx_ipsec.h diff --git a/lib/pipeline/meson.build b/lib/pipeline/meson.build index 3ca98ed194..aa3fd0c2b8 100644 --- a/lib/pipeline/meson.build +++ b/lib/pipeline/meson.build @@ -11,6 +11,7 @@ sources = files( 'rte_pipeline.c', 'rte_port_in_action.c', 'rte_table_action.c', + 'rte_swx_ipsec.c', 'rte_swx_pipeline.c', 'rte_swx_pipeline_spec.c', 'rte_swx_ctl.c', @@ -19,8 +20,9 @@ headers = files( 'rte_pipeline.h', 'rte_port_in_action.h', 'rte_table_action.h', + 'rte_swx_ipsec.h', 'rte_swx_pipeline.h', 'rte_swx_extern.h', 'rte_swx_ctl.h', ) -deps += ['port', 'table', 'meter', 'sched', 'cryptodev'] +deps += ['port', 'table', 'meter', 'sched', 'cryptodev', 'ipsec'] diff --git a/lib/pipeline/rte_swx_ipsec.c b/lib/pipeline/rte_swx_ipsec.c new file mode 100644 index 00..b23056e23e --- /dev/null +++ b/lib/pipeline/rte_swx_ipsec.c @@ -0,0 +1,1821 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2022 Intel Corporation + */ +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "rte_swx_ipsec.h" + +#ifndef RTE_SWX_IPSEC_HUGE_PAGES_DISABLE + +#include + +static void * +env_calloc(size_t size, size_t alignment, int numa_node) +{ + return rte_zmalloc_socket(NULL, size, alignment, numa_node); +} + +static void +env_free(void *start, size_t size __rte_unused) +{ + rte_free(start); +} + +#else + +#include + +static void * +env_calloc(size_t size, size_t alignment __rte_unused, int numa_node) +{ + void *start; + + if (numa_available() == -1) + return NULL; + + start = numa_alloc_onnode(size, numa_node); + if (!start) + return NULL; + + memset(start, 0, size); + return start; +} + +static void +env_free(void *start, size_t size) +{ + if ((numa_available() == -1) || !start) + return; + + numa_free(start, size); +} + +#endif + +#ifndef RTE_SWX_IPSEC_POOL_CACHE_SIZE +#define RTE_SWX_IPSEC_POOL_CACHE_SIZE 256 +#endif + +/* The two crypto device mempools have their size set to the number of SAs. The mempool API requires + * the mempool size to be at least 1.5 times the size of the mempool cache. + */ +#define N_SA_MIN (RTE_SWX_IPSEC_POOL_CACHE_SIZE * 1.5) + +struct ipsec_sa { + struct rte_ipsec_session s; + int valid; +}; + +struct ipsec_pkts_in { + struct rte_mbuf *pkts[RTE_SWX_IPSEC_BURST_SIZE_MAX]; + struct ipsec_sa *sa[RTE_SWX_IPSEC_BURST_SIZE_MAX]; + struct rte_ipsec_group groups[RTE_SWX_IPSEC_BURST_SIZE_MAX]; + struct rte_crypto_op *group_cops[RTE_SWX_IPSEC_BURST_SIZE_MAX]; + struct rte_crypto_op *cops[RTE_SWX_IPSEC_BURST_SIZE_MAX]; + uint32_t n_cops; +}; + +struct ipsec_pkts_out { + struct rte_crypto_op *cops[RTE_SWX_IPSEC_BURST_SIZE_MAX]; + struct rte_mbuf *group_pkts[RTE_SWX_IPSEC_BURST_SIZE_MAX]; + struct rte_ipsec_group groups[RTE_SWX_IPSEC_BURST_SIZE_MAX]; + struct rte_mbuf *pkts[RTE_SWX_IPSEC_BURST_SIZE_MAX]; + uint32_t n_pkts; +}; + +struct rte_swx_ipsec { + /* +* Parameters. +*/ + + /* IPsec instance name. */ + char name[RTE_SWX_IPSEC_NAME_SIZE]; + + /* Input packet queue. */ + struct rte_ring *ring_in; + + /* Output packet queue. */ + struct rte_ring *ring_out; + + /* Crypto device ID. */ + uint8_t dev_id; + + /* Crypto device queue pair ID. */ + uint16_t qp_id; + + /* Burst sizes. */ + struct rte_swx_ipsec_burst_size bsz; + + /* SA table size. */ + size_t n_sa_max; + + /* +* Internals. +*/ + /* Crypto device buffer pool for sessions. */ + struct rte_mempool *mp_session; + + /* Pre-crypto packets. */ + struct ipsec_pkts_in in; + + /* Post-crypto packets. */ + struct ipsec_pkts_out out; + + /* Crypto device enqueue threshold. */ + uint32_t crypto_wr_threshold; + + /* Packets currently under crypto device processing. */ + uint32_t n_pkts_crypto; + + /* List of free SADB positions. */ + uint32_t *sa_free_id; + + /* Number of elements in the SADB list of free positions. */ + size_t n_sa_free_id; + + /* Allo
[PATCH V3 02/11] examples/pipeline: rework memory pool support
Rework the memory pool CLI command to accommodate the MBUF private meta-data area size parameter. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/cli.c | 72 ++--- examples/pipeline/examples/fib.cli| 2 +- examples/pipeline/examples/hash_func.cli | 2 +- examples/pipeline/examples/l2fwd.cli | 2 +- examples/pipeline/examples/l2fwd_macswp.cli | 2 +- .../pipeline/examples/l2fwd_macswp_pcap.cli | 2 +- examples/pipeline/examples/l2fwd_pcap.cli | 2 +- examples/pipeline/examples/learner.cli| 2 +- examples/pipeline/examples/meter.cli | 2 +- examples/pipeline/examples/mirroring.cli | 2 +- examples/pipeline/examples/recirculation.cli | 2 +- examples/pipeline/examples/registers.cli | 2 +- examples/pipeline/examples/selector.cli | 2 +- examples/pipeline/examples/varbit.cli | 2 +- examples/pipeline/examples/vxlan.cli | 2 +- examples/pipeline/examples/vxlan_pcap.cli | 2 +- examples/pipeline/obj.c | 80 +-- examples/pipeline/obj.h | 27 --- 18 files changed, 63 insertions(+), 146 deletions(-) diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index e1e7aaddc1..14f1cfa47e 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -192,72 +192,88 @@ parse_table_entry(struct rte_swx_ctl_pipeline *p, } static const char cmd_mempool_help[] = -"mempool \n" -" buffer \n" -" pool \n" -" cache \n" -" cpu \n"; +"mempool " +"meta " +"pkt " +"pool " +"cache " +"numa \n"; static void cmd_mempool(char **tokens, - uint32_t n_tokens, - char *out, - size_t out_size, - void *obj) + uint32_t n_tokens, + char *out, + size_t out_size, + void *obj __rte_unused) { - struct mempool_params p; - char *name; - struct mempool *mempool; + struct rte_mempool *mp; + char *mempool_name; + uint32_t mbuf_private_size, pkt_buffer_size, pool_size, cache_size, numa_node; - if (n_tokens != 10) { + if (n_tokens != 12) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); return; } - name = tokens[1]; + mempool_name = tokens[1]; + + if (strcmp(tokens[2], "meta")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "meta"); + return; + } - if (strcmp(tokens[2], "buffer") != 0) { - snprintf(out, out_size, MSG_ARG_NOT_FOUND, "buffer"); + if (parser_read_uint32(&mbuf_private_size, tokens[3])) { + snprintf(out, out_size, MSG_ARG_INVALID, "mbuf_private_size"); return; } - if (parser_read_uint32(&p.buffer_size, tokens[3]) != 0) { - snprintf(out, out_size, MSG_ARG_INVALID, "buffer_size"); + if (strcmp(tokens[4], "pkt")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "pkt"); return; } - if (strcmp(tokens[4], "pool") != 0) { + if (parser_read_uint32(&pkt_buffer_size, tokens[5])) { + snprintf(out, out_size, MSG_ARG_INVALID, "pkt_buffer_size"); + return; + } + + if (strcmp(tokens[6], "pool")) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "pool"); return; } - if (parser_read_uint32(&p.pool_size, tokens[5]) != 0) { + if (parser_read_uint32(&pool_size, tokens[7])) { snprintf(out, out_size, MSG_ARG_INVALID, "pool_size"); return; } - if (strcmp(tokens[6], "cache") != 0) { + if (strcmp(tokens[8], "cache")) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cache"); return; } - if (parser_read_uint32(&p.cache_size, tokens[7]) != 0) { + if (parser_read_uint32(&cache_size, tokens[9])) { snprintf(out, out_size, MSG_ARG_INVALID, "cache_size"); return; } - if (strcmp(tokens[8], "cpu") != 0) { - snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cpu"); + if (strcmp(tokens[10], "numa")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "numa"); return; } - if (parser_read_uint32(&p.cpu_id, tokens[9]) != 0) { - snprintf(out, out_size, MSG_ARG_INVALID, "cpu_id"); + if (parser_read_uint32(&numa_node, tokens[11])) { + snprintf(out, out_size, MSG_ARG_INVALID, "numa_node"); return; } - mempool = mempool_create(obj, name, &p); - if (mempool == NULL) { + mp = rte_pktmbuf_pool_create(mempool_name, +pool_size, +cache_size, +mbuf_private_size, +
[PATCH V3 03/11] examples/pipeline: streamline ring support
Remove redundant ring related code. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/cli.c | 24 ++-- examples/pipeline/obj.c | 63 - examples/pipeline/obj.h | 21 -- 3 files changed, 15 insertions(+), 93 deletions(-) diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index 14f1cfa47e..517682f7c9 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -491,11 +492,11 @@ cmd_ring(char **tokens, uint32_t n_tokens, char *out, size_t out_size, - void *obj) + void *obj __rte_unused) { - struct ring_params p; + struct rte_ring *r; char *name; - struct ring *ring; + uint32_t size, numa_node; if (n_tokens != 6) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); @@ -504,28 +505,32 @@ cmd_ring(char **tokens, name = tokens[1]; - if (strcmp(tokens[2], "size") != 0) { + if (strcmp(tokens[2], "size")) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "size"); return; } - if (parser_read_uint32(&p.size, tokens[3]) != 0) { + if (parser_read_uint32(&size, tokens[3])) { snprintf(out, out_size, MSG_ARG_INVALID, "size"); return; } - if (strcmp(tokens[4], "numa") != 0) { + if (strcmp(tokens[4], "numa")) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "numa"); return; } - if (parser_read_uint32(&p.numa_node, tokens[5]) != 0) { + if (parser_read_uint32(&numa_node, tokens[5])) { snprintf(out, out_size, MSG_ARG_INVALID, "numa_node"); return; } - ring = ring_create(obj, name, &p); - if (!ring) { + r = rte_ring_create( + name, + size, + (int)numa_node, + RING_F_SP_ENQ | RING_F_SC_DEQ); + if (!r) { snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]); return; } @@ -2999,6 +3004,7 @@ cmd_help(char **tokens, "List of commands:\n" "\tmempool\n" "\tethdev\n" + "\tring\n" "\tpipeline codegen\n" "\tpipeline libbuild\n" "\tpipeline build\n" diff --git a/examples/pipeline/obj.c b/examples/pipeline/obj.c index 697d14a901..3614b99d28 100644 --- a/examples/pipeline/obj.c +++ b/examples/pipeline/obj.c @@ -24,17 +24,11 @@ */ TAILQ_HEAD(link_list, link); -/* - * ring - */ -TAILQ_HEAD(ring_list, ring); - /* * obj */ struct obj { struct link_list link_list; - struct ring_list ring_list; }; /* @@ -282,62 +276,6 @@ link_next(struct obj *obj, struct link *link) TAILQ_FIRST(&obj->link_list) : TAILQ_NEXT(link, node); } -/* - * ring - */ -struct ring * -ring_create(struct obj *obj, const char *name, struct ring_params *params) -{ - struct ring *ring; - struct rte_ring *r; - unsigned int flags = RING_F_SP_ENQ | RING_F_SC_DEQ; - - /* Check input params */ - if (!name || ring_find(obj, name) || !params || !params->size) - return NULL; - - /** -* Resource create -*/ - r = rte_ring_create( - name, - params->size, - params->numa_node, - flags); - if (!r) - return NULL; - - /* Node allocation */ - ring = calloc(1, sizeof(struct ring)); - if (!ring) { - rte_ring_free(r); - return NULL; - } - - /* Node fill in */ - strlcpy(ring->name, name, sizeof(ring->name)); - - /* Node add to list */ - TAILQ_INSERT_TAIL(&obj->ring_list, ring, node); - - return ring; -} - -struct ring * -ring_find(struct obj *obj, const char *name) -{ - struct ring *ring; - - if (!obj || !name) - return NULL; - - TAILQ_FOREACH(ring, &obj->ring_list, node) - if (strcmp(ring->name, name) == 0) - return ring; - - return NULL; -} - /* * obj */ @@ -351,7 +289,6 @@ obj_init(void) return NULL; TAILQ_INIT(&obj->link_list); - TAILQ_INIT(&obj->ring_list); return obj; } diff --git a/examples/pipeline/obj.h b/examples/pipeline/obj.h index 4ea610ceed..dbbc6d39a0 100644 --- a/examples/pipeline/obj.h +++ b/examples/pipeline/obj.h @@ -73,25 +73,4 @@ link_find(struct obj *obj, const char *name); struct link * link_next(struct obj *obj, struct link *link); -/* - * ring - */ -struct ring_params { - uint32_t size; - uint32_t numa_node; -}; - -struct ring { - TAILQ_ENTRY(ring) node; - char
[PATCH V3 04/11] examples/pipeline: streamline the Ethernet device support
Streamline the Ethernet device support code and remove redundant code. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/cli.c | 175 ++-- examples/pipeline/main.c | 12 +-- examples/pipeline/obj.c | 186 +-- examples/pipeline/obj.h | 51 ++- 4 files changed, 136 insertions(+), 288 deletions(-) diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index 517682f7c9..f4c8300ea7 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -292,16 +292,14 @@ cmd_ethdev(char **tokens, uint32_t n_tokens, char *out, size_t out_size, - void *obj) + void *obj __rte_unused) { - struct link_params p; - struct link_params_rss rss; - struct link *link; + struct ethdev_params p = {0}; + struct ethdev_params_rss rss = {0}; char *name; + int status; - memset(&p, 0, sizeof(p)); - - if ((n_tokens < 11) || (n_tokens > 12 + LINK_RXQ_RSS_MAX)) { + if (n_tokens < 11 || n_tokens > 12 + ETHDEV_RXQ_RSS_MAX) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); return; } @@ -377,111 +375,98 @@ cmd_ethdev(char **tokens, } } - link = link_create(obj, name, &p); - if (link == NULL) { + status = ethdev_config(name, &p); + if (status) { snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]); return; } } -/* Print the link stats and info */ static void -print_link_info(struct link *link, char *out, size_t out_size) +ethdev_show(uint16_t port_id, char **out, size_t *out_size) { - struct rte_eth_stats stats; - struct rte_ether_addr mac_addr; - struct rte_eth_link eth_link; - uint16_t mtu; - int ret; - - memset(&stats, 0, sizeof(stats)); - rte_eth_stats_get(link->port_id, &stats); - - ret = rte_eth_macaddr_get(link->port_id, &mac_addr); - if (ret != 0) { - snprintf(out, out_size, "\n%s: MAC address get failed: %s", -link->name, rte_strerror(-ret)); - return; - } - - ret = rte_eth_link_get(link->port_id, ð_link); - if (ret < 0) { - snprintf(out, out_size, "\n%s: link get failed: %s", -link->name, rte_strerror(-ret)); - return; - } - - rte_eth_dev_get_mtu(link->port_id, &mtu); - - snprintf(out, out_size, - "\n" - "%s: flags=<%s> mtu %u\n" - "\tether " RTE_ETHER_ADDR_PRT_FMT " rxqueues %u txqueues %u\n" - "\tport# %u speed %s\n" - "\tRX packets %" PRIu64" bytes %" PRIu64"\n" - "\tRX errors %" PRIu64" missed %" PRIu64" no-mbuf %" PRIu64"\n" - "\tTX packets %" PRIu64" bytes %" PRIu64"\n" - "\tTX errors %" PRIu64"\n", - link->name, - eth_link.link_status == 0 ? "DOWN" : "UP", - mtu, - RTE_ETHER_ADDR_BYTES(&mac_addr), - link->n_rxq, - link->n_txq, - link->port_id, - rte_eth_link_speed_to_str(eth_link.link_speed), - stats.ipackets, - stats.ibytes, - stats.ierrors, - stats.imissed, - stats.rx_nombuf, - stats.opackets, - stats.obytes, - stats.oerrors); + char name[RTE_ETH_NAME_MAX_LEN] = {0}; + struct rte_eth_dev_info info = {0}; + struct rte_eth_stats stats = {0}; + struct rte_ether_addr addr = {0}; + struct rte_eth_link link = {0}; + uint32_t length; + uint16_t mtu = 0; + + if (!rte_eth_dev_is_valid_port(port_id)) + return; + + rte_eth_dev_get_name_by_port(port_id, name); + rte_eth_dev_info_get(port_id, &info); + rte_eth_stats_get(port_id, &stats); + rte_eth_macaddr_get(port_id, &addr); + rte_eth_link_get(port_id, &link); + rte_eth_dev_get_mtu(port_id, &mtu); + + snprintf(*out, *out_size, +"%s: flags=<%s> mtu %u\n" +"\tether " RTE_ETHER_ADDR_PRT_FMT " rxqueues %u txqueues %u\n" +"\tport# %u speed %s\n" +"\tRX packets %" PRIu64" bytes %" PRIu64"\n" +"\tRX errors %" PRIu64" missed %" PRIu64" no-mbuf %" PRIu64"\n" +"\tTX packets %" PRIu64" bytes %" PRIu64"\n" +"\tTX errors %" PRIu64"\n\n", +name, +link.link_status ? "UP" : "DOWN", +mtu, +RTE_ETHER_ADDR_BYTES(&addr), +info.nb_rx_queues, +info.nb_tx_queues, +port_id, +rte_eth_link_speed_to_str(link.link_speed), +stats.ipackets, +stats.ib
[PATCH V3 05/11] examples/pipeline: support crypto devices
Add support for crypto devices in the application. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/obj.c | 60 + examples/pipeline/obj.h | 11 2 files changed, 71 insertions(+) diff --git a/examples/pipeline/obj.c b/examples/pipeline/obj.c index 143b968472..25bfd2da4f 100644 --- a/examples/pipeline/obj.c +++ b/examples/pipeline/obj.c @@ -7,6 +7,7 @@ #include #include +#include #include "obj.h" @@ -190,3 +191,62 @@ ethdev_config(const char *name, struct ethdev_params *params) return 0; } + +/* + * cryptodev + */ +int +cryptodev_config(const char *name, struct cryptodev_params *params) +{ + struct rte_cryptodev_info dev_info; + struct rte_cryptodev_config dev_conf = {0}; + struct rte_cryptodev_qp_conf queue_conf = {0}; + uint8_t dev_id; + uint32_t socket_id, i; + int status; + + /* Check input parameters. */ + if (!name || + !params->n_queue_pairs || + !params->queue_size) + return -EINVAL; + + /* Find the crypto device. */ + status = rte_cryptodev_get_dev_id(name); + if (status < 0) + return -EINVAL; + + dev_id = (uint8_t)status; + + rte_cryptodev_info_get(dev_id, &dev_info); + if (params->n_queue_pairs > dev_info.max_nb_queue_pairs) + return -EINVAL; + + socket_id = rte_cryptodev_socket_id(dev_id); + + /* Configure the crypto device. */ + dev_conf.socket_id = socket_id; + dev_conf.nb_queue_pairs = params->n_queue_pairs; + dev_conf.ff_disable = 0; + + status = rte_cryptodev_configure(dev_id, &dev_conf); + if (status) + return status; + + /* Configure the crypto device queue pairs. */ + queue_conf.nb_descriptors = params->queue_size; + queue_conf.mp_session = NULL; + + for (i = 0; i < params->n_queue_pairs; i++) { + status = rte_cryptodev_queue_pair_setup(dev_id, i, &queue_conf, socket_id); + if (status) + return status; + } + + /* Start the crypto device. */ + status = rte_cryptodev_start(dev_id); + if (status) + return status; + + return 0; +} diff --git a/examples/pipeline/obj.h b/examples/pipeline/obj.h index fb091f4ba7..0f103be6a7 100644 --- a/examples/pipeline/obj.h +++ b/examples/pipeline/obj.h @@ -38,4 +38,15 @@ struct ethdev_params { int ethdev_config(const char *name, struct ethdev_params *params); +/* + * cryptodev + */ +struct cryptodev_params { + uint32_t n_queue_pairs; + uint32_t queue_size; +}; + +int +cryptodev_config(const char *name, struct cryptodev_params *params); + #endif /* _INCLUDE_OBJ_H_ */ -- 2.34.1
[PATCH V3 06/11] examples/pipeline: add CLI command for crypto device
Add CLI command for the configuration of crypto devices. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/cli.c | 63 + 1 file changed, 63 insertions(+) diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index f4c8300ea7..6b5d5a3370 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -521,6 +521,58 @@ cmd_ring(char **tokens, } } +static const char cmd_cryptodev_help[] = +"cryptodev queues qsize \n"; + +static void +cmd_cryptodev(char **tokens, + uint32_t n_tokens, + char *out, + size_t out_size, + void *obj __rte_unused) +{ + struct cryptodev_params params; + char *cryptodev_name; + int status; + + if (n_tokens != 6) { + snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); + return; + } + + if (strcmp(tokens[0], "cryptodev")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cryptodev"); + return; + } + + cryptodev_name = tokens[1]; + + if (strcmp(tokens[2], "queues")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "queues"); + return; + } + + if (parser_read_uint32(¶ms.n_queue_pairs, tokens[3])) { + snprintf(out, out_size, MSG_ARG_INVALID, "n_queue_pairs"); + return; + } + + if (strcmp(tokens[4], "qsize")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "qsize"); + return; + } + + + if (parser_read_uint32(¶ms.queue_size, tokens[5])) { + snprintf(out, out_size, MSG_ARG_INVALID, "queue_size"); + return; + } + + status = cryptodev_config(cryptodev_name, ¶ms); + if (status) + snprintf(out, out_size, "Crypto device configuration failed (%d).\n", status); +} + static const char cmd_pipeline_codegen_help[] = "pipeline codegen \n"; @@ -2991,6 +3043,7 @@ cmd_help(char **tokens, "\tethdev\n" "\tethdev show\n" "\tring\n" + "\tcryptodev\n" "\tpipeline codegen\n" "\tpipeline libbuild\n" "\tpipeline build\n" @@ -3042,6 +3095,11 @@ cmd_help(char **tokens, return; } + if (!strcmp(tokens[0], "cryptodev")) { + snprintf(out, out_size, "\n%s\n", cmd_cryptodev_help); + return; + } + if ((strcmp(tokens[0], "pipeline") == 0) && (n_tokens == 2) && (strcmp(tokens[1], "codegen") == 0)) { snprintf(out, out_size, "\n%s\n", cmd_pipeline_codegen_help); @@ -3297,6 +3355,11 @@ cli_process(char *in, char *out, size_t out_size, void *obj) return; } + if (!strcmp(tokens[0], "cryptodev")) { + cmd_cryptodev(tokens, n_tokens, out, out_size, obj); + return; + } + if (strcmp(tokens[0], "pipeline") == 0) { if ((n_tokens >= 3) && (strcmp(tokens[1], "codegen") == 0)) { -- 2.34.1
[PATCH V3 07/11] examples/pipeline: add IPsec CLI commands
Add CLI commands for IPsec block configuration. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/cli.c | 298 1 file changed, 298 insertions(+) diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index 6b5d5a3370..92ec0fd8e3 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "cli.h" @@ -2910,6 +2911,263 @@ cmd_pipeline_mirror_session(char **tokens, } } +static const char cmd_ipsec_create_help[] = +"ipsec create " +"in out " +"cryptodev cryptoq " +"bsz " +"samax " +"numa \n"; + +static void +cmd_ipsec_create(char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size, +void *obj __rte_unused) +{ + struct rte_swx_ipsec_params p; + struct rte_swx_ipsec *ipsec; + char *ipsec_instance_name; + uint32_t numa_node; + int status; + + if (n_tokens != 20) { + snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); + return; + } + + ipsec_instance_name = tokens[1]; + + if (strcmp(tokens[2], "create")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "create"); + return; + } + + if (strcmp(tokens[3], "in")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "in"); + return; + } + + p.ring_in_name = tokens[4]; + + if (strcmp(tokens[5], "out")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "out"); + return; + } + + p.ring_out_name = tokens[6]; + + if (strcmp(tokens[7], "cryptodev")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cryptodev"); + return; + } + + p.crypto_dev_name = tokens[8]; + + if (strcmp(tokens[9], "cryptoq")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cryptoq"); + return; + } + + if (parser_read_uint32(&p.crypto_dev_queue_pair_id, tokens[10])) { + snprintf(out, out_size, MSG_ARG_INVALID, "crypto_dev_queue_pair_id"); + return; + } + + if (strcmp(tokens[11], "bsz")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "bsz"); + return; + } + + if (parser_read_uint32(&p.bsz.ring_rd, tokens[12])) { + snprintf(out, out_size, MSG_ARG_INVALID, "ring_rd_bsz"); + return; + } + + if (parser_read_uint32(&p.bsz.ring_wr, tokens[13])) { + snprintf(out, out_size, MSG_ARG_INVALID, "ring_wr_bsz"); + return; + } + + if (parser_read_uint32(&p.bsz.crypto_wr, tokens[14])) { + snprintf(out, out_size, MSG_ARG_INVALID, "crypto_wr_bsz"); + return; + } + + if (parser_read_uint32(&p.bsz.crypto_rd, tokens[15])) { + snprintf(out, out_size, MSG_ARG_INVALID, "crypto_rd_bsz"); + return; + } + + if (strcmp(tokens[16], "samax")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "samax"); + return; + } + + if (parser_read_uint32(&p.n_sa_max, tokens[17])) { + snprintf(out, out_size, MSG_ARG_INVALID, "n_sa_max"); + return; + } + + if (strcmp(tokens[18], "numa")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "numa"); + return; + } + + if (parser_read_uint32(&numa_node, tokens[19])) { + snprintf(out, out_size, MSG_ARG_INVALID, "numa_node"); + return; + } + + status = rte_swx_ipsec_create(&ipsec, + ipsec_instance_name, + &p, + (int)numa_node); + if (status) + snprintf(out, out_size, "IPsec instance creation failed (%d).\n", status); +} + +static const char cmd_ipsec_sa_add_help[] = +"ipsec sa add \n"; + +static void +cmd_ipsec_sa_add(char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size, +void *obj __rte_unused) +{ + struct rte_swx_ipsec *ipsec; + char *ipsec_instance_name, *file_name, *line = NULL; + FILE *file = NULL; + uint32_t line_id = 0; + + if (n_tokens != 5) { + snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); + return; + } + + ipsec_instance_name = tokens[1]; + ipsec = rte_swx_ipsec_find(ipsec_instance_name); + if (!ipsec) { + snprintf(out, out_size, MSG_ARG_INVALID, "ipsec_instance_name"); + goto free; + } + + if (strcmp(tokens[2], "sa")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "sa"); + goto free; + } + + if (str
[PATCH V3 08/11] examples/pipeline: rework the thread configuration updates
Previously, the configuration updates for the data plane threads were performed through message queues. Now, this mechanism is replaced by the control thread updating the mirror copy of the data plane thread configuration followed by pointer swapping. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/cli.c | 154 ++--- examples/pipeline/examples/fib.cli| 2 +- examples/pipeline/examples/hash_func.cli | 2 +- examples/pipeline/examples/l2fwd.cli | 2 +- examples/pipeline/examples/l2fwd_macswp.cli | 2 +- .../pipeline/examples/l2fwd_macswp_pcap.cli | 2 +- examples/pipeline/examples/l2fwd_pcap.cli | 2 +- examples/pipeline/examples/learner.cli| 2 +- examples/pipeline/examples/meter.cli | 2 +- examples/pipeline/examples/mirroring.cli | 2 +- examples/pipeline/examples/recirculation.cli | 2 +- examples/pipeline/examples/registers.cli | 2 +- examples/pipeline/examples/selector.cli | 2 +- examples/pipeline/examples/varbit.cli | 2 +- examples/pipeline/examples/vxlan.cli | 2 +- examples/pipeline/examples/vxlan_pcap.cli | 2 +- examples/pipeline/thread.c| 586 -- examples/pipeline/thread.h| 17 +- 18 files changed, 217 insertions(+), 570 deletions(-) diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index 92ec0fd8e3..68bb93a46c 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -3168,119 +3168,86 @@ cmd_ipsec_sa_delete(char **tokens, rte_swx_ipsec_sa_delete(ipsec, sa_id); } -static const char cmd_thread_pipeline_enable_help[] = -"thread pipeline enable [ period ]\n"; - -#ifndef TIMER_PERIOD_MS_DEFAULT -#define TIMER_PERIOD_MS_DEFAULT 10 -#endif +static const char cmd_pipeline_enable_help[] = +"pipeline enable thread \n"; static void -cmd_thread_pipeline_enable(char **tokens, - uint32_t n_tokens, - char *out, - size_t out_size, - void *obj __rte_unused) +cmd_pipeline_enable(char **tokens, + uint32_t n_tokens, + char *out, + size_t out_size, + void *obj __rte_unused) { char *pipeline_name; struct rte_swx_pipeline *p; - uint32_t thread_id, timer_period_ms = TIMER_PERIOD_MS_DEFAULT; + uint32_t thread_id; int status; - if ((n_tokens != 5) && (n_tokens != 7)) { + if (n_tokens != 5) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); return; } - if (parser_read_uint32(&thread_id, tokens[1]) != 0) { - snprintf(out, out_size, MSG_ARG_INVALID, "thread_id"); - return; - } - - if (strcmp(tokens[2], "pipeline") != 0) { - snprintf(out, out_size, MSG_ARG_NOT_FOUND, "pipeline"); - return; - } - - pipeline_name = tokens[3]; + pipeline_name = tokens[1]; p = rte_swx_pipeline_find(pipeline_name); if (!p) { snprintf(out, out_size, MSG_ARG_INVALID, "pipeline_name"); return; } - if (strcmp(tokens[4], "enable") != 0) { + if (strcmp(tokens[2], "enable") != 0) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "enable"); return; } - if (n_tokens == 7) { - if (strcmp(tokens[5], "period") != 0) { - snprintf(out, out_size, MSG_ARG_NOT_FOUND, "period"); - return; - } + if (strcmp(tokens[3], "thread") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "thread"); + return; + } - if (parser_read_uint32(&timer_period_ms, tokens[6]) != 0) { - snprintf(out, out_size, MSG_ARG_INVALID, "timer_period_ms"); - return; - } + if (parser_read_uint32(&thread_id, tokens[4]) != 0) { + snprintf(out, out_size, MSG_ARG_INVALID, "thread_id"); + return; } - status = thread_pipeline_enable(thread_id, p, timer_period_ms); + status = pipeline_enable(p, thread_id); if (status) { - snprintf(out, out_size, MSG_CMD_FAIL, "thread pipeline enable"); + snprintf(out, out_size, MSG_CMD_FAIL, "pipeline enable"); return; } } -static const char cmd_thread_pipeline_disable_help[] = -"thread pipeline disable\n"; +static const char cmd_pipeline_disable_help[] = +"pipeline disable\n"; static void -cmd_thread_pipeline_disable(char **tokens, - uint32_t n_tokens, - char *out, - size_t out_size, - void *obj __rte_unused) +cmd_pipeline_disable(char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size, +
[PATCH V3 09/11] examples/pipeline: support blocks other than pipelines
Previously, the data plane threads only supported the execution of pipelines assigned to them through configuration updates. Now, the data plane threads also support running blocks such as IPsec. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/thread.c | 143 + examples/pipeline/thread.h | 9 +++ 2 files changed, 152 insertions(+) diff --git a/examples/pipeline/thread.c b/examples/pipeline/thread.c index 3001bc0858..dc3ea73fbf 100644 --- a/examples/pipeline/thread.c +++ b/examples/pipeline/thread.c @@ -16,6 +16,10 @@ #define THREAD_PIPELINES_MAX 256 #endif +#ifndef THREAD_BLOCKS_MAX +#define THREAD_BLOCKS_MAX 256 +#endif + /* Pipeline instruction quanta: Needs to be big enough to do some meaningful * work, but not too big to avoid starving any other pipelines mapped to the * same thread. For a pipeline that executes 10 instructions per packet, a @@ -38,9 +42,16 @@ * - Read-write by the CP thread; * - Read-only by the DP thread. */ +struct block { + block_run_f block_func; + void *block; +}; + struct thread { struct rte_swx_pipeline *pipelines[THREAD_PIPELINES_MAX]; + struct block *blocks[THREAD_BLOCKS_MAX]; volatile uint64_t n_pipelines; + volatile uint64_t n_blocks; int enabled; } __rte_cache_aligned; @@ -53,14 +64,43 @@ int thread_init(void) { uint32_t thread_id; + int status = 0; RTE_LCORE_FOREACH_WORKER(thread_id) { struct thread *t = &threads[thread_id]; + uint32_t i; t->enabled = 1; + + for (i = 0; i < THREAD_BLOCKS_MAX; i++) { + struct block *b; + + b = calloc(1, sizeof(struct block)); + if (!b) { + status = -ENOMEM; + goto error; + } + + t->blocks[i] = b; + } } return 0; + +error: + RTE_LCORE_FOREACH_WORKER(thread_id) { + struct thread *t = &threads[thread_id]; + uint32_t i; + + t->enabled = 0; + + for (i = 0; i < THREAD_BLOCKS_MAX; i++) { + free(t->blocks[i]); + t->blocks[i] = NULL; + } + } + + return status; } static uint32_t @@ -83,6 +123,26 @@ pipeline_find(struct rte_swx_pipeline *p) return thread_id; } +static uint32_t +block_find(void *b) +{ + uint32_t thread_id; + + for (thread_id = 0; thread_id < RTE_MAX_LCORE; thread_id++) { + struct thread *t = &threads[thread_id]; + uint32_t i; + + if (!t->enabled) + continue; + + for (i = 0; i < t->n_blocks; i++) + if (t->blocks[i]->block == b) + break; + } + + return thread_id; +} + /** * Enable a given pipeline to run on a specific DP thread. * @@ -201,9 +261,85 @@ pipeline_disable(struct rte_swx_pipeline *p) return; } +int +block_enable(block_run_f block_func, void *block, uint32_t thread_id) +{ + struct thread *t; + uint64_t n_blocks; + + /* Check input params */ + if (!block_func || !block || thread_id >= RTE_MAX_LCORE) + return -EINVAL; + + if (block_find(block) < RTE_MAX_LCORE) + return -EEXIST; + + t = &threads[thread_id]; + if (!t->enabled) + return -EINVAL; + + n_blocks = t->n_blocks; + + /* Check there is room for at least one more block. */ + if (n_blocks >= THREAD_BLOCKS_MAX) + return -ENOSPC; + + /* Install the new block. */ + t->blocks[n_blocks]->block_func = block_func; + t->blocks[n_blocks]->block = block; + + rte_wmb(); + t->n_blocks = n_blocks + 1; + + return 0; +} + +void +block_disable(void *block) +{ + struct thread *t; + uint64_t n_blocks; + uint32_t thread_id, i; + + /* Check input params */ + if (!block) + return; + + /* Find the thread that runs this block. */ + thread_id = block_find(block); + if (thread_id == RTE_MAX_LCORE) + return; + + t = &threads[thread_id]; + n_blocks = t->n_blocks; + + for (i = 0; i < n_blocks; i++) { + struct block *b = t->blocks[i]; + + if (block != b->block) + continue; + + if (i < n_blocks - 1) { + struct block *block_last = t->blocks[n_blocks - 1]; + + t->blocks[i] = block_last; + } + + rte_wmb(); + t->n_blocks = n_blocks - 1; + + rte_wmb(); + t->blocks[n_blocks - 1] = b; + +
[PATCH V3 10/11] examples/pipeline: add block enable/disable CLI commands
Add CLI commands to enable/disable block execution on data plane threads. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/cli.c | 154 1 file changed, 154 insertions(+) diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index 68bb93a46c..37250b7072 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -3250,6 +3250,134 @@ cmd_pipeline_disable(char **tokens, pipeline_disable(p); } +static const char cmd_block_enable_help[] = +"block type instance enable thread \n"; + +static void +cmd_block_enable(char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size, +void *obj __rte_unused) +{ + char *block_type, *block_name; + block_run_f block_func = NULL; + void *block = NULL; + uint32_t thread_id; + int status; + + if (n_tokens != 8) { + snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); + return; + } + + if (strcmp(tokens[1], "type") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "type"); + return; + } + + block_type = tokens[2]; + + if (strcmp(tokens[3], "instance") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "instance"); + return; + } + + block_name = tokens[4]; + + if (strcmp(tokens[5], "enable") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "enable"); + return; + } + + if (strcmp(tokens[6], "thread") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "thread"); + return; + } + + if (parser_read_uint32(&thread_id, tokens[7]) != 0) { + snprintf(out, out_size, MSG_ARG_INVALID, "thread_id"); + return; + } + + if (!strcmp(block_type, "ipsec")) { + struct rte_swx_ipsec *ipsec; + + ipsec = rte_swx_ipsec_find(block_name); + if (!ipsec) { + snprintf(out, out_size, MSG_ARG_INVALID, "block_name"); + return; + } + + block_func = (block_run_f)rte_swx_ipsec_run; + block = (void *)ipsec; + } else { + snprintf(out, out_size, MSG_ARG_INVALID, "block_type"); + return; + } + + status = block_enable(block_func, block, thread_id); + if (status) { + snprintf(out, out_size, MSG_CMD_FAIL, "block enable"); + return; + } +} + +static const char cmd_block_disable_help[] = +"block type instance disable\n"; + +static void +cmd_block_disable(char **tokens, + uint32_t n_tokens, + char *out, + size_t out_size, + void *obj __rte_unused) +{ + char *block_type, *block_name; + void *block = NULL; + + if (n_tokens != 6) { + snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); + return; + } + + if (strcmp(tokens[1], "type") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "type"); + return; + } + + block_type = tokens[2]; + + if (strcmp(tokens[3], "instance") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "instance"); + return; + } + + block_name = tokens[4]; + + if (strcmp(tokens[5], "disable") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "disable"); + return; + } + + if (!strcmp(block_type, "ipsec")) { + struct rte_swx_ipsec *ipsec; + + ipsec = rte_swx_ipsec_find(block_name); + if (!ipsec) { + snprintf(out, out_size, MSG_ARG_INVALID, "block_name"); + return; + } + + block = (void *)ipsec; + } else { + snprintf(out, out_size, MSG_ARG_INVALID, "block_type"); + return; + } + + block_disable(block); +} + static void cmd_help(char **tokens, uint32_t n_tokens, @@ -3298,6 +3426,8 @@ cmd_help(char **tokens, "\tipsec create\n" "\tipsec sa add\n" "\tipsec sa delete\n" + "\tblock enable\n" + "\tblock disable\n" ); return; } @@ -3553,6 +3683,18 @@ cmd_help(char **tokens, return; } + if (!strcmp(tokens[0], "block") && + (n_tokens == 2) && !strcmp(tokens[1], "enable")) { + snprintf(out, out_size, "\n%s\n", cmd_block_enable_help); + return; + } + + if (!strcmp(tokens[0], "block") && + (n_tokens == 2) && !strcmp(tokens[1], "disable")) { +
[PATCH V3 11/11] examples/pipeline: add IPsec example
Add example files to illustrate the pipeline IPsec support. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/examples/ipsec.cli| 57 +++ examples/pipeline/examples/ipsec.io | 23 +++ examples/pipeline/examples/ipsec.spec | 138 +++ examples/pipeline/examples/ipsec_sa.txt | 216 4 files changed, 434 insertions(+) create mode 100644 examples/pipeline/examples/ipsec.cli create mode 100644 examples/pipeline/examples/ipsec.io create mode 100644 examples/pipeline/examples/ipsec.spec create mode 100644 examples/pipeline/examples/ipsec_sa.txt diff --git a/examples/pipeline/examples/ipsec.cli b/examples/pipeline/examples/ipsec.cli new file mode 100644 index 00..8cb5bf4239 --- /dev/null +++ b/examples/pipeline/examples/ipsec.cli @@ -0,0 +1,57 @@ +; SPDX-License-Identifier: BSD-3-Clause +; Copyright(c) 2022 Intel Corporation + +# Example command line: +# ./build/examples/dpdk-pipeline -l0-1 --vdev crypto_aesni_mb0 -- -s ./examples/pipeline/examples/ipsec.cli +# +# Once the application has started, the command to get the CLI prompt is: +# telnet 0.0.0.0 8086 + +; +; Pipeline code generation & shared object library build. +; +pipeline codegen ./examples/pipeline/examples/ipsec.spec /tmp/ipsec.c +pipeline libbuild /tmp/ipsec.c /tmp/ipsec.so + +; +; List of DPDK devices. +; +; Note: Customize the parameters below to match your setup. +; +mempool MEMPOOL0 meta 128 pkt 2176 pool 32K cache 256 numa 0 +ethdev :18:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on +ethdev :18:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on +ethdev :3b:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on +ethdev :3b:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on + +cryptodev crypto_aesni_mb0 queues 1 qsize 128 +ring RING0 size 1024 numa 0 +ring RING1 size 1024 numa 0 + +; +; List of pipelines. +; +pipeline PIPELINE0 build lib /tmp/ipsec.so io ./examples/pipeline/examples/ipsec.io numa 0 + +; +; List of IPsec devices. +; +ipsec IPSEC0 create in RING0 out RING1 cryptodev crypto_aesni_mb0 cryptoq 0 bsz 32 32 32 32 samax 512 numa 0 + +; +; Initial set of table entries. +; +; The table entries can later be updated at run-time through the CLI commands. +; +//pipeline PIPELINE0 table policy_table add ./examples/pipeline/examples/ipsec_policy_table.txt +//pipeline PIPELINE0 table routing_table add ./examples/pipeline/examples/ipsec_routing_table.txt +//pipeline PIPELINE0 table nexthop_table add ./examples/pipeline/examples/ipsec_nexthop_table.txt +//pipeline PIPELINE0 commit + +ipsec IPSEC0 sa add ./examples/pipeline/examples/ipsec_sa.txt + +; +; Pipelines and blocks mapping to CPU threads. +; +pipeline PIPELINE0 enable thread 1 +block type ipsec instance IPSEC0 enable thread 1 diff --git a/examples/pipeline/examples/ipsec.io b/examples/pipeline/examples/ipsec.io new file mode 100644 index 00..f5a3fcf961 --- /dev/null +++ b/examples/pipeline/examples/ipsec.io @@ -0,0 +1,23 @@ +; SPDX-License-Identifier: BSD-3-Clause +; Copyright(c) 2022 Intel Corporation + +; +; Pipeline packet mirroring. +; +mirroring slots 4 sessions 64 + +; +; Pipeline input ports. +; +; Note: Customize the parameters below to match your setup. +; +port in 0 ethdev :18:00.0 rxq 0 bsz 32 +port in 1 ring RING1 bsz 32 + +; +; Pipeline output ports. +; +; Note: Customize the parameters below to match your setup. +; +port out 0 ethdev :18:00.0 txq 0 bsz 32 +port out 1 ring RING0 bsz 32 diff --git a/examples/pipeline/examples/ipsec.spec b/examples/pipeline/examples/ipsec.spec new file mode 100644 index 00..09aa831881 --- /dev/null +++ b/examples/pipeline/examples/ipsec.spec @@ -0,0 +1,138 @@ +; SPDX-License-Identifier: BSD-3-Clause +; Copyright(c) 2020 Intel Corporation + +// +// Headers +// +struct ethernet_h { + bit<48> dst_addr + bit<48> src_addr + bit<16> ethertype +} + +struct ipv4_h { + bit<8> ver_ihl + bit<8> diffserv + bit<16> total_len + bit<16> identification + bit<16> flags_offset + bit<8> ttl + bit<8> protocol + bit<16> hdr_checksum + bit<32> src_addr + bit<32> dst_addr +} + +struct udp_h { + bit<16> src_port + bit<16> dst_port + bit<16> length + bit<16> checksum +} + +struct ipsec_internal_h { + bit<32> sa_id +} + +header ethernet instanceof ethernet_h +header ipv4 instanceof ipv4_h +header udp instanceof udp_h +header ipsec_internal instanceof ipsec_internal_h + +// +// Meta-data +// +struct metadata_t { + bit<32> port_in + bit<32> port_out + + bit<32> src_addr + bit<32> dst_addr + bit<8> protocol + bit<16> src_port + bit<16> dst_port +} + +metadata instanceof metadata_t + +// +// Actions +// +struct encrypt_args_t { + bit<32> sa_id +} + +action encrypt args instanceof encrypt_args_t { + //Set the IPsec internal header. + validate h.ipsec_internal
[PATCH V3 00/11] pipeline: add IPsec support
This patch set introduces a companion block for the SWX pipeline for IPsec support. The IPsec block is external to the pipeline, hence it needs to be explicitly instantiated by the user and connected to a pipeline instance through the pipeline I/O ports. Main features: * IPsec inbound (encrypted input packets -> clear text output packets) and outbound (clear text input packets -> encrypted output packets) processing support for tunnel and transport modes. Interaction of the IPsec block with the pipeline: * Each IPsec block instance has its own set of Security Associations (SAs) used to process the input packets. Each SA is identified by its unique SA ID. The IPsec inbound and outbound SAs share the same ID space. * Each input packet is first mapped to one of the existing SAs by using the SA ID and then processed according to the identified SA. The SA ID is read from input packet. The SA ID field is typically written by the pipeline before sending the packet to the IPsec block. Change log: V3: Rebase on top of main latest. V2: Fix minor style issues. Cristian Dumitrescu (11): pipeline: add IPsec support examples/pipeline: rework memory pool support examples/pipeline: streamline ring support examples/pipeline: streamline the Ethernet device support examples/pipeline: support crypto devices examples/pipeline: add CLI command for crypto device examples/pipeline: add IPsec CLI commands examples/pipeline: rework the thread configuration updates examples/pipeline: support blocks other than pipelines examples/pipeline: add block enable/disable CLI commands examples/pipeline: add IPsec example examples/pipeline/cli.c | 896 ++-- examples/pipeline/examples/fib.cli|4 +- examples/pipeline/examples/hash_func.cli |4 +- examples/pipeline/examples/ipsec.cli | 57 + examples/pipeline/examples/ipsec.io | 23 + examples/pipeline/examples/ipsec.spec | 138 ++ examples/pipeline/examples/ipsec_sa.txt | 216 ++ examples/pipeline/examples/l2fwd.cli |4 +- examples/pipeline/examples/l2fwd_macswp.cli |4 +- .../pipeline/examples/l2fwd_macswp_pcap.cli |4 +- examples/pipeline/examples/l2fwd_pcap.cli |4 +- examples/pipeline/examples/learner.cli|4 +- examples/pipeline/examples/meter.cli |4 +- examples/pipeline/examples/mirroring.cli |4 +- examples/pipeline/examples/recirculation.cli |4 +- examples/pipeline/examples/registers.cli |4 +- examples/pipeline/examples/selector.cli |4 +- examples/pipeline/examples/varbit.cli |4 +- examples/pipeline/examples/vxlan.cli |4 +- examples/pipeline/examples/vxlan_pcap.cli |4 +- examples/pipeline/main.c | 12 +- examples/pipeline/obj.c | 359 +--- examples/pipeline/obj.h | 100 +- examples/pipeline/thread.c| 655 +++--- examples/pipeline/thread.h| 24 +- lib/pipeline/meson.build |4 +- lib/pipeline/rte_swx_ipsec.c | 1821 + lib/pipeline/rte_swx_ipsec.h | 383 lib/pipeline/version.map |9 + 29 files changed, 3739 insertions(+), 1018 deletions(-) create mode 100644 examples/pipeline/examples/ipsec.cli create mode 100644 examples/pipeline/examples/ipsec.io create mode 100644 examples/pipeline/examples/ipsec.spec create mode 100644 examples/pipeline/examples/ipsec_sa.txt create mode 100644 lib/pipeline/rte_swx_ipsec.c create mode 100644 lib/pipeline/rte_swx_ipsec.h -- 2.34.1
[PATCH V3 01/11] pipeline: add IPsec support
This block is providing IPsec support to the SWX pipeline. The IPsec block is external to the pipeline, so it needs to be explicitly instantiated and connected to a pipeline through the I/O ports. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- lib/pipeline/meson.build |4 +- lib/pipeline/rte_swx_ipsec.c | 1821 ++ lib/pipeline/rte_swx_ipsec.h | 383 +++ lib/pipeline/version.map |9 + 4 files changed, 2216 insertions(+), 1 deletion(-) create mode 100644 lib/pipeline/rte_swx_ipsec.c create mode 100644 lib/pipeline/rte_swx_ipsec.h diff --git a/lib/pipeline/meson.build b/lib/pipeline/meson.build index 3ca98ed194..aa3fd0c2b8 100644 --- a/lib/pipeline/meson.build +++ b/lib/pipeline/meson.build @@ -11,6 +11,7 @@ sources = files( 'rte_pipeline.c', 'rte_port_in_action.c', 'rte_table_action.c', + 'rte_swx_ipsec.c', 'rte_swx_pipeline.c', 'rte_swx_pipeline_spec.c', 'rte_swx_ctl.c', @@ -19,8 +20,9 @@ headers = files( 'rte_pipeline.h', 'rte_port_in_action.h', 'rte_table_action.h', + 'rte_swx_ipsec.h', 'rte_swx_pipeline.h', 'rte_swx_extern.h', 'rte_swx_ctl.h', ) -deps += ['port', 'table', 'meter', 'sched', 'cryptodev'] +deps += ['port', 'table', 'meter', 'sched', 'cryptodev', 'ipsec'] diff --git a/lib/pipeline/rte_swx_ipsec.c b/lib/pipeline/rte_swx_ipsec.c new file mode 100644 index 00..b23056e23e --- /dev/null +++ b/lib/pipeline/rte_swx_ipsec.c @@ -0,0 +1,1821 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2022 Intel Corporation + */ +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "rte_swx_ipsec.h" + +#ifndef RTE_SWX_IPSEC_HUGE_PAGES_DISABLE + +#include + +static void * +env_calloc(size_t size, size_t alignment, int numa_node) +{ + return rte_zmalloc_socket(NULL, size, alignment, numa_node); +} + +static void +env_free(void *start, size_t size __rte_unused) +{ + rte_free(start); +} + +#else + +#include + +static void * +env_calloc(size_t size, size_t alignment __rte_unused, int numa_node) +{ + void *start; + + if (numa_available() == -1) + return NULL; + + start = numa_alloc_onnode(size, numa_node); + if (!start) + return NULL; + + memset(start, 0, size); + return start; +} + +static void +env_free(void *start, size_t size) +{ + if ((numa_available() == -1) || !start) + return; + + numa_free(start, size); +} + +#endif + +#ifndef RTE_SWX_IPSEC_POOL_CACHE_SIZE +#define RTE_SWX_IPSEC_POOL_CACHE_SIZE 256 +#endif + +/* The two crypto device mempools have their size set to the number of SAs. The mempool API requires + * the mempool size to be at least 1.5 times the size of the mempool cache. + */ +#define N_SA_MIN (RTE_SWX_IPSEC_POOL_CACHE_SIZE * 1.5) + +struct ipsec_sa { + struct rte_ipsec_session s; + int valid; +}; + +struct ipsec_pkts_in { + struct rte_mbuf *pkts[RTE_SWX_IPSEC_BURST_SIZE_MAX]; + struct ipsec_sa *sa[RTE_SWX_IPSEC_BURST_SIZE_MAX]; + struct rte_ipsec_group groups[RTE_SWX_IPSEC_BURST_SIZE_MAX]; + struct rte_crypto_op *group_cops[RTE_SWX_IPSEC_BURST_SIZE_MAX]; + struct rte_crypto_op *cops[RTE_SWX_IPSEC_BURST_SIZE_MAX]; + uint32_t n_cops; +}; + +struct ipsec_pkts_out { + struct rte_crypto_op *cops[RTE_SWX_IPSEC_BURST_SIZE_MAX]; + struct rte_mbuf *group_pkts[RTE_SWX_IPSEC_BURST_SIZE_MAX]; + struct rte_ipsec_group groups[RTE_SWX_IPSEC_BURST_SIZE_MAX]; + struct rte_mbuf *pkts[RTE_SWX_IPSEC_BURST_SIZE_MAX]; + uint32_t n_pkts; +}; + +struct rte_swx_ipsec { + /* +* Parameters. +*/ + + /* IPsec instance name. */ + char name[RTE_SWX_IPSEC_NAME_SIZE]; + + /* Input packet queue. */ + struct rte_ring *ring_in; + + /* Output packet queue. */ + struct rte_ring *ring_out; + + /* Crypto device ID. */ + uint8_t dev_id; + + /* Crypto device queue pair ID. */ + uint16_t qp_id; + + /* Burst sizes. */ + struct rte_swx_ipsec_burst_size bsz; + + /* SA table size. */ + size_t n_sa_max; + + /* +* Internals. +*/ + /* Crypto device buffer pool for sessions. */ + struct rte_mempool *mp_session; + + /* Pre-crypto packets. */ + struct ipsec_pkts_in in; + + /* Post-crypto packets. */ + struct ipsec_pkts_out out; + + /* Crypto device enqueue threshold. */ + uint32_t crypto_wr_threshold; + + /* Packets currently under crypto device processing. */ + uint32_t n_pkts_crypto; + + /* List of free SADB positions. */ + uint32_t *sa_free_id; + + /* Number of elements in the SADB list of free positions. */ + size_t n_sa_free_id; + + /* Allo
[PATCH V3 02/11] examples/pipeline: rework memory pool support
Rework the memory pool CLI command to accommodate the MBUF private meta-data area size parameter. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/cli.c | 72 ++--- examples/pipeline/examples/fib.cli| 2 +- examples/pipeline/examples/hash_func.cli | 2 +- examples/pipeline/examples/l2fwd.cli | 2 +- examples/pipeline/examples/l2fwd_macswp.cli | 2 +- .../pipeline/examples/l2fwd_macswp_pcap.cli | 2 +- examples/pipeline/examples/l2fwd_pcap.cli | 2 +- examples/pipeline/examples/learner.cli| 2 +- examples/pipeline/examples/meter.cli | 2 +- examples/pipeline/examples/mirroring.cli | 2 +- examples/pipeline/examples/recirculation.cli | 2 +- examples/pipeline/examples/registers.cli | 2 +- examples/pipeline/examples/selector.cli | 2 +- examples/pipeline/examples/varbit.cli | 2 +- examples/pipeline/examples/vxlan.cli | 2 +- examples/pipeline/examples/vxlan_pcap.cli | 2 +- examples/pipeline/obj.c | 80 +-- examples/pipeline/obj.h | 27 --- 18 files changed, 63 insertions(+), 146 deletions(-) diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index e1e7aaddc1..14f1cfa47e 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -192,72 +192,88 @@ parse_table_entry(struct rte_swx_ctl_pipeline *p, } static const char cmd_mempool_help[] = -"mempool \n" -" buffer \n" -" pool \n" -" cache \n" -" cpu \n"; +"mempool " +"meta " +"pkt " +"pool " +"cache " +"numa \n"; static void cmd_mempool(char **tokens, - uint32_t n_tokens, - char *out, - size_t out_size, - void *obj) + uint32_t n_tokens, + char *out, + size_t out_size, + void *obj __rte_unused) { - struct mempool_params p; - char *name; - struct mempool *mempool; + struct rte_mempool *mp; + char *mempool_name; + uint32_t mbuf_private_size, pkt_buffer_size, pool_size, cache_size, numa_node; - if (n_tokens != 10) { + if (n_tokens != 12) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); return; } - name = tokens[1]; + mempool_name = tokens[1]; + + if (strcmp(tokens[2], "meta")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "meta"); + return; + } - if (strcmp(tokens[2], "buffer") != 0) { - snprintf(out, out_size, MSG_ARG_NOT_FOUND, "buffer"); + if (parser_read_uint32(&mbuf_private_size, tokens[3])) { + snprintf(out, out_size, MSG_ARG_INVALID, "mbuf_private_size"); return; } - if (parser_read_uint32(&p.buffer_size, tokens[3]) != 0) { - snprintf(out, out_size, MSG_ARG_INVALID, "buffer_size"); + if (strcmp(tokens[4], "pkt")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "pkt"); return; } - if (strcmp(tokens[4], "pool") != 0) { + if (parser_read_uint32(&pkt_buffer_size, tokens[5])) { + snprintf(out, out_size, MSG_ARG_INVALID, "pkt_buffer_size"); + return; + } + + if (strcmp(tokens[6], "pool")) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "pool"); return; } - if (parser_read_uint32(&p.pool_size, tokens[5]) != 0) { + if (parser_read_uint32(&pool_size, tokens[7])) { snprintf(out, out_size, MSG_ARG_INVALID, "pool_size"); return; } - if (strcmp(tokens[6], "cache") != 0) { + if (strcmp(tokens[8], "cache")) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cache"); return; } - if (parser_read_uint32(&p.cache_size, tokens[7]) != 0) { + if (parser_read_uint32(&cache_size, tokens[9])) { snprintf(out, out_size, MSG_ARG_INVALID, "cache_size"); return; } - if (strcmp(tokens[8], "cpu") != 0) { - snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cpu"); + if (strcmp(tokens[10], "numa")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "numa"); return; } - if (parser_read_uint32(&p.cpu_id, tokens[9]) != 0) { - snprintf(out, out_size, MSG_ARG_INVALID, "cpu_id"); + if (parser_read_uint32(&numa_node, tokens[11])) { + snprintf(out, out_size, MSG_ARG_INVALID, "numa_node"); return; } - mempool = mempool_create(obj, name, &p); - if (mempool == NULL) { + mp = rte_pktmbuf_pool_create(mempool_name, +pool_size, +cache_size, +mbuf_private_size, +
[PATCH V3 03/11] examples/pipeline: streamline ring support
Remove redundant ring related code. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/cli.c | 24 ++-- examples/pipeline/obj.c | 63 - examples/pipeline/obj.h | 21 -- 3 files changed, 15 insertions(+), 93 deletions(-) diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index 14f1cfa47e..517682f7c9 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -491,11 +492,11 @@ cmd_ring(char **tokens, uint32_t n_tokens, char *out, size_t out_size, - void *obj) + void *obj __rte_unused) { - struct ring_params p; + struct rte_ring *r; char *name; - struct ring *ring; + uint32_t size, numa_node; if (n_tokens != 6) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); @@ -504,28 +505,32 @@ cmd_ring(char **tokens, name = tokens[1]; - if (strcmp(tokens[2], "size") != 0) { + if (strcmp(tokens[2], "size")) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "size"); return; } - if (parser_read_uint32(&p.size, tokens[3]) != 0) { + if (parser_read_uint32(&size, tokens[3])) { snprintf(out, out_size, MSG_ARG_INVALID, "size"); return; } - if (strcmp(tokens[4], "numa") != 0) { + if (strcmp(tokens[4], "numa")) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "numa"); return; } - if (parser_read_uint32(&p.numa_node, tokens[5]) != 0) { + if (parser_read_uint32(&numa_node, tokens[5])) { snprintf(out, out_size, MSG_ARG_INVALID, "numa_node"); return; } - ring = ring_create(obj, name, &p); - if (!ring) { + r = rte_ring_create( + name, + size, + (int)numa_node, + RING_F_SP_ENQ | RING_F_SC_DEQ); + if (!r) { snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]); return; } @@ -2999,6 +3004,7 @@ cmd_help(char **tokens, "List of commands:\n" "\tmempool\n" "\tethdev\n" + "\tring\n" "\tpipeline codegen\n" "\tpipeline libbuild\n" "\tpipeline build\n" diff --git a/examples/pipeline/obj.c b/examples/pipeline/obj.c index 697d14a901..3614b99d28 100644 --- a/examples/pipeline/obj.c +++ b/examples/pipeline/obj.c @@ -24,17 +24,11 @@ */ TAILQ_HEAD(link_list, link); -/* - * ring - */ -TAILQ_HEAD(ring_list, ring); - /* * obj */ struct obj { struct link_list link_list; - struct ring_list ring_list; }; /* @@ -282,62 +276,6 @@ link_next(struct obj *obj, struct link *link) TAILQ_FIRST(&obj->link_list) : TAILQ_NEXT(link, node); } -/* - * ring - */ -struct ring * -ring_create(struct obj *obj, const char *name, struct ring_params *params) -{ - struct ring *ring; - struct rte_ring *r; - unsigned int flags = RING_F_SP_ENQ | RING_F_SC_DEQ; - - /* Check input params */ - if (!name || ring_find(obj, name) || !params || !params->size) - return NULL; - - /** -* Resource create -*/ - r = rte_ring_create( - name, - params->size, - params->numa_node, - flags); - if (!r) - return NULL; - - /* Node allocation */ - ring = calloc(1, sizeof(struct ring)); - if (!ring) { - rte_ring_free(r); - return NULL; - } - - /* Node fill in */ - strlcpy(ring->name, name, sizeof(ring->name)); - - /* Node add to list */ - TAILQ_INSERT_TAIL(&obj->ring_list, ring, node); - - return ring; -} - -struct ring * -ring_find(struct obj *obj, const char *name) -{ - struct ring *ring; - - if (!obj || !name) - return NULL; - - TAILQ_FOREACH(ring, &obj->ring_list, node) - if (strcmp(ring->name, name) == 0) - return ring; - - return NULL; -} - /* * obj */ @@ -351,7 +289,6 @@ obj_init(void) return NULL; TAILQ_INIT(&obj->link_list); - TAILQ_INIT(&obj->ring_list); return obj; } diff --git a/examples/pipeline/obj.h b/examples/pipeline/obj.h index 4ea610ceed..dbbc6d39a0 100644 --- a/examples/pipeline/obj.h +++ b/examples/pipeline/obj.h @@ -73,25 +73,4 @@ link_find(struct obj *obj, const char *name); struct link * link_next(struct obj *obj, struct link *link); -/* - * ring - */ -struct ring_params { - uint32_t size; - uint32_t numa_node; -}; - -struct ring { - TAILQ_ENTRY(ring) node; - char
[PATCH V3 04/11] examples/pipeline: streamline the Ethernet device support
Streamline the Ethernet device support code and remove redundant code. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/cli.c | 175 ++-- examples/pipeline/main.c | 12 +-- examples/pipeline/obj.c | 186 +-- examples/pipeline/obj.h | 51 ++- 4 files changed, 136 insertions(+), 288 deletions(-) diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index 517682f7c9..f4c8300ea7 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -292,16 +292,14 @@ cmd_ethdev(char **tokens, uint32_t n_tokens, char *out, size_t out_size, - void *obj) + void *obj __rte_unused) { - struct link_params p; - struct link_params_rss rss; - struct link *link; + struct ethdev_params p = {0}; + struct ethdev_params_rss rss = {0}; char *name; + int status; - memset(&p, 0, sizeof(p)); - - if ((n_tokens < 11) || (n_tokens > 12 + LINK_RXQ_RSS_MAX)) { + if (n_tokens < 11 || n_tokens > 12 + ETHDEV_RXQ_RSS_MAX) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); return; } @@ -377,111 +375,98 @@ cmd_ethdev(char **tokens, } } - link = link_create(obj, name, &p); - if (link == NULL) { + status = ethdev_config(name, &p); + if (status) { snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]); return; } } -/* Print the link stats and info */ static void -print_link_info(struct link *link, char *out, size_t out_size) +ethdev_show(uint16_t port_id, char **out, size_t *out_size) { - struct rte_eth_stats stats; - struct rte_ether_addr mac_addr; - struct rte_eth_link eth_link; - uint16_t mtu; - int ret; - - memset(&stats, 0, sizeof(stats)); - rte_eth_stats_get(link->port_id, &stats); - - ret = rte_eth_macaddr_get(link->port_id, &mac_addr); - if (ret != 0) { - snprintf(out, out_size, "\n%s: MAC address get failed: %s", -link->name, rte_strerror(-ret)); - return; - } - - ret = rte_eth_link_get(link->port_id, ð_link); - if (ret < 0) { - snprintf(out, out_size, "\n%s: link get failed: %s", -link->name, rte_strerror(-ret)); - return; - } - - rte_eth_dev_get_mtu(link->port_id, &mtu); - - snprintf(out, out_size, - "\n" - "%s: flags=<%s> mtu %u\n" - "\tether " RTE_ETHER_ADDR_PRT_FMT " rxqueues %u txqueues %u\n" - "\tport# %u speed %s\n" - "\tRX packets %" PRIu64" bytes %" PRIu64"\n" - "\tRX errors %" PRIu64" missed %" PRIu64" no-mbuf %" PRIu64"\n" - "\tTX packets %" PRIu64" bytes %" PRIu64"\n" - "\tTX errors %" PRIu64"\n", - link->name, - eth_link.link_status == 0 ? "DOWN" : "UP", - mtu, - RTE_ETHER_ADDR_BYTES(&mac_addr), - link->n_rxq, - link->n_txq, - link->port_id, - rte_eth_link_speed_to_str(eth_link.link_speed), - stats.ipackets, - stats.ibytes, - stats.ierrors, - stats.imissed, - stats.rx_nombuf, - stats.opackets, - stats.obytes, - stats.oerrors); + char name[RTE_ETH_NAME_MAX_LEN] = {0}; + struct rte_eth_dev_info info = {0}; + struct rte_eth_stats stats = {0}; + struct rte_ether_addr addr = {0}; + struct rte_eth_link link = {0}; + uint32_t length; + uint16_t mtu = 0; + + if (!rte_eth_dev_is_valid_port(port_id)) + return; + + rte_eth_dev_get_name_by_port(port_id, name); + rte_eth_dev_info_get(port_id, &info); + rte_eth_stats_get(port_id, &stats); + rte_eth_macaddr_get(port_id, &addr); + rte_eth_link_get(port_id, &link); + rte_eth_dev_get_mtu(port_id, &mtu); + + snprintf(*out, *out_size, +"%s: flags=<%s> mtu %u\n" +"\tether " RTE_ETHER_ADDR_PRT_FMT " rxqueues %u txqueues %u\n" +"\tport# %u speed %s\n" +"\tRX packets %" PRIu64" bytes %" PRIu64"\n" +"\tRX errors %" PRIu64" missed %" PRIu64" no-mbuf %" PRIu64"\n" +"\tTX packets %" PRIu64" bytes %" PRIu64"\n" +"\tTX errors %" PRIu64"\n\n", +name, +link.link_status ? "UP" : "DOWN", +mtu, +RTE_ETHER_ADDR_BYTES(&addr), +info.nb_rx_queues, +info.nb_tx_queues, +port_id, +rte_eth_link_speed_to_str(link.link_speed), +stats.ipackets, +stats.ib
[PATCH V3 05/11] examples/pipeline: support crypto devices
Add support for crypto devices in the application. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/obj.c | 60 + examples/pipeline/obj.h | 11 2 files changed, 71 insertions(+) diff --git a/examples/pipeline/obj.c b/examples/pipeline/obj.c index 143b968472..25bfd2da4f 100644 --- a/examples/pipeline/obj.c +++ b/examples/pipeline/obj.c @@ -7,6 +7,7 @@ #include #include +#include #include "obj.h" @@ -190,3 +191,62 @@ ethdev_config(const char *name, struct ethdev_params *params) return 0; } + +/* + * cryptodev + */ +int +cryptodev_config(const char *name, struct cryptodev_params *params) +{ + struct rte_cryptodev_info dev_info; + struct rte_cryptodev_config dev_conf = {0}; + struct rte_cryptodev_qp_conf queue_conf = {0}; + uint8_t dev_id; + uint32_t socket_id, i; + int status; + + /* Check input parameters. */ + if (!name || + !params->n_queue_pairs || + !params->queue_size) + return -EINVAL; + + /* Find the crypto device. */ + status = rte_cryptodev_get_dev_id(name); + if (status < 0) + return -EINVAL; + + dev_id = (uint8_t)status; + + rte_cryptodev_info_get(dev_id, &dev_info); + if (params->n_queue_pairs > dev_info.max_nb_queue_pairs) + return -EINVAL; + + socket_id = rte_cryptodev_socket_id(dev_id); + + /* Configure the crypto device. */ + dev_conf.socket_id = socket_id; + dev_conf.nb_queue_pairs = params->n_queue_pairs; + dev_conf.ff_disable = 0; + + status = rte_cryptodev_configure(dev_id, &dev_conf); + if (status) + return status; + + /* Configure the crypto device queue pairs. */ + queue_conf.nb_descriptors = params->queue_size; + queue_conf.mp_session = NULL; + + for (i = 0; i < params->n_queue_pairs; i++) { + status = rte_cryptodev_queue_pair_setup(dev_id, i, &queue_conf, socket_id); + if (status) + return status; + } + + /* Start the crypto device. */ + status = rte_cryptodev_start(dev_id); + if (status) + return status; + + return 0; +} diff --git a/examples/pipeline/obj.h b/examples/pipeline/obj.h index fb091f4ba7..0f103be6a7 100644 --- a/examples/pipeline/obj.h +++ b/examples/pipeline/obj.h @@ -38,4 +38,15 @@ struct ethdev_params { int ethdev_config(const char *name, struct ethdev_params *params); +/* + * cryptodev + */ +struct cryptodev_params { + uint32_t n_queue_pairs; + uint32_t queue_size; +}; + +int +cryptodev_config(const char *name, struct cryptodev_params *params); + #endif /* _INCLUDE_OBJ_H_ */ -- 2.34.1
[PATCH V3 06/11] examples/pipeline: add CLI command for crypto device
Add CLI command for the configuration of crypto devices. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/cli.c | 63 + 1 file changed, 63 insertions(+) diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index f4c8300ea7..6b5d5a3370 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -521,6 +521,58 @@ cmd_ring(char **tokens, } } +static const char cmd_cryptodev_help[] = +"cryptodev queues qsize \n"; + +static void +cmd_cryptodev(char **tokens, + uint32_t n_tokens, + char *out, + size_t out_size, + void *obj __rte_unused) +{ + struct cryptodev_params params; + char *cryptodev_name; + int status; + + if (n_tokens != 6) { + snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); + return; + } + + if (strcmp(tokens[0], "cryptodev")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cryptodev"); + return; + } + + cryptodev_name = tokens[1]; + + if (strcmp(tokens[2], "queues")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "queues"); + return; + } + + if (parser_read_uint32(¶ms.n_queue_pairs, tokens[3])) { + snprintf(out, out_size, MSG_ARG_INVALID, "n_queue_pairs"); + return; + } + + if (strcmp(tokens[4], "qsize")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "qsize"); + return; + } + + + if (parser_read_uint32(¶ms.queue_size, tokens[5])) { + snprintf(out, out_size, MSG_ARG_INVALID, "queue_size"); + return; + } + + status = cryptodev_config(cryptodev_name, ¶ms); + if (status) + snprintf(out, out_size, "Crypto device configuration failed (%d).\n", status); +} + static const char cmd_pipeline_codegen_help[] = "pipeline codegen \n"; @@ -2991,6 +3043,7 @@ cmd_help(char **tokens, "\tethdev\n" "\tethdev show\n" "\tring\n" + "\tcryptodev\n" "\tpipeline codegen\n" "\tpipeline libbuild\n" "\tpipeline build\n" @@ -3042,6 +3095,11 @@ cmd_help(char **tokens, return; } + if (!strcmp(tokens[0], "cryptodev")) { + snprintf(out, out_size, "\n%s\n", cmd_cryptodev_help); + return; + } + if ((strcmp(tokens[0], "pipeline") == 0) && (n_tokens == 2) && (strcmp(tokens[1], "codegen") == 0)) { snprintf(out, out_size, "\n%s\n", cmd_pipeline_codegen_help); @@ -3297,6 +3355,11 @@ cli_process(char *in, char *out, size_t out_size, void *obj) return; } + if (!strcmp(tokens[0], "cryptodev")) { + cmd_cryptodev(tokens, n_tokens, out, out_size, obj); + return; + } + if (strcmp(tokens[0], "pipeline") == 0) { if ((n_tokens >= 3) && (strcmp(tokens[1], "codegen") == 0)) { -- 2.34.1
[PATCH V3 07/11] examples/pipeline: add IPsec CLI commands
Add CLI commands for IPsec block configuration. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/cli.c | 298 1 file changed, 298 insertions(+) diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index 6b5d5a3370..92ec0fd8e3 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "cli.h" @@ -2910,6 +2911,263 @@ cmd_pipeline_mirror_session(char **tokens, } } +static const char cmd_ipsec_create_help[] = +"ipsec create " +"in out " +"cryptodev cryptoq " +"bsz " +"samax " +"numa \n"; + +static void +cmd_ipsec_create(char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size, +void *obj __rte_unused) +{ + struct rte_swx_ipsec_params p; + struct rte_swx_ipsec *ipsec; + char *ipsec_instance_name; + uint32_t numa_node; + int status; + + if (n_tokens != 20) { + snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); + return; + } + + ipsec_instance_name = tokens[1]; + + if (strcmp(tokens[2], "create")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "create"); + return; + } + + if (strcmp(tokens[3], "in")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "in"); + return; + } + + p.ring_in_name = tokens[4]; + + if (strcmp(tokens[5], "out")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "out"); + return; + } + + p.ring_out_name = tokens[6]; + + if (strcmp(tokens[7], "cryptodev")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cryptodev"); + return; + } + + p.crypto_dev_name = tokens[8]; + + if (strcmp(tokens[9], "cryptoq")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cryptoq"); + return; + } + + if (parser_read_uint32(&p.crypto_dev_queue_pair_id, tokens[10])) { + snprintf(out, out_size, MSG_ARG_INVALID, "crypto_dev_queue_pair_id"); + return; + } + + if (strcmp(tokens[11], "bsz")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "bsz"); + return; + } + + if (parser_read_uint32(&p.bsz.ring_rd, tokens[12])) { + snprintf(out, out_size, MSG_ARG_INVALID, "ring_rd_bsz"); + return; + } + + if (parser_read_uint32(&p.bsz.ring_wr, tokens[13])) { + snprintf(out, out_size, MSG_ARG_INVALID, "ring_wr_bsz"); + return; + } + + if (parser_read_uint32(&p.bsz.crypto_wr, tokens[14])) { + snprintf(out, out_size, MSG_ARG_INVALID, "crypto_wr_bsz"); + return; + } + + if (parser_read_uint32(&p.bsz.crypto_rd, tokens[15])) { + snprintf(out, out_size, MSG_ARG_INVALID, "crypto_rd_bsz"); + return; + } + + if (strcmp(tokens[16], "samax")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "samax"); + return; + } + + if (parser_read_uint32(&p.n_sa_max, tokens[17])) { + snprintf(out, out_size, MSG_ARG_INVALID, "n_sa_max"); + return; + } + + if (strcmp(tokens[18], "numa")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "numa"); + return; + } + + if (parser_read_uint32(&numa_node, tokens[19])) { + snprintf(out, out_size, MSG_ARG_INVALID, "numa_node"); + return; + } + + status = rte_swx_ipsec_create(&ipsec, + ipsec_instance_name, + &p, + (int)numa_node); + if (status) + snprintf(out, out_size, "IPsec instance creation failed (%d).\n", status); +} + +static const char cmd_ipsec_sa_add_help[] = +"ipsec sa add \n"; + +static void +cmd_ipsec_sa_add(char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size, +void *obj __rte_unused) +{ + struct rte_swx_ipsec *ipsec; + char *ipsec_instance_name, *file_name, *line = NULL; + FILE *file = NULL; + uint32_t line_id = 0; + + if (n_tokens != 5) { + snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); + return; + } + + ipsec_instance_name = tokens[1]; + ipsec = rte_swx_ipsec_find(ipsec_instance_name); + if (!ipsec) { + snprintf(out, out_size, MSG_ARG_INVALID, "ipsec_instance_name"); + goto free; + } + + if (strcmp(tokens[2], "sa")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "sa"); + goto free; + } + + if (str
[PATCH V3 09/11] examples/pipeline: support blocks other than pipelines
Previously, the data plane threads only supported the execution of pipelines assigned to them through configuration updates. Now, the data plane threads also support running blocks such as IPsec. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/thread.c | 143 + examples/pipeline/thread.h | 9 +++ 2 files changed, 152 insertions(+) diff --git a/examples/pipeline/thread.c b/examples/pipeline/thread.c index 3001bc0858..dc3ea73fbf 100644 --- a/examples/pipeline/thread.c +++ b/examples/pipeline/thread.c @@ -16,6 +16,10 @@ #define THREAD_PIPELINES_MAX 256 #endif +#ifndef THREAD_BLOCKS_MAX +#define THREAD_BLOCKS_MAX 256 +#endif + /* Pipeline instruction quanta: Needs to be big enough to do some meaningful * work, but not too big to avoid starving any other pipelines mapped to the * same thread. For a pipeline that executes 10 instructions per packet, a @@ -38,9 +42,16 @@ * - Read-write by the CP thread; * - Read-only by the DP thread. */ +struct block { + block_run_f block_func; + void *block; +}; + struct thread { struct rte_swx_pipeline *pipelines[THREAD_PIPELINES_MAX]; + struct block *blocks[THREAD_BLOCKS_MAX]; volatile uint64_t n_pipelines; + volatile uint64_t n_blocks; int enabled; } __rte_cache_aligned; @@ -53,14 +64,43 @@ int thread_init(void) { uint32_t thread_id; + int status = 0; RTE_LCORE_FOREACH_WORKER(thread_id) { struct thread *t = &threads[thread_id]; + uint32_t i; t->enabled = 1; + + for (i = 0; i < THREAD_BLOCKS_MAX; i++) { + struct block *b; + + b = calloc(1, sizeof(struct block)); + if (!b) { + status = -ENOMEM; + goto error; + } + + t->blocks[i] = b; + } } return 0; + +error: + RTE_LCORE_FOREACH_WORKER(thread_id) { + struct thread *t = &threads[thread_id]; + uint32_t i; + + t->enabled = 0; + + for (i = 0; i < THREAD_BLOCKS_MAX; i++) { + free(t->blocks[i]); + t->blocks[i] = NULL; + } + } + + return status; } static uint32_t @@ -83,6 +123,26 @@ pipeline_find(struct rte_swx_pipeline *p) return thread_id; } +static uint32_t +block_find(void *b) +{ + uint32_t thread_id; + + for (thread_id = 0; thread_id < RTE_MAX_LCORE; thread_id++) { + struct thread *t = &threads[thread_id]; + uint32_t i; + + if (!t->enabled) + continue; + + for (i = 0; i < t->n_blocks; i++) + if (t->blocks[i]->block == b) + break; + } + + return thread_id; +} + /** * Enable a given pipeline to run on a specific DP thread. * @@ -201,9 +261,85 @@ pipeline_disable(struct rte_swx_pipeline *p) return; } +int +block_enable(block_run_f block_func, void *block, uint32_t thread_id) +{ + struct thread *t; + uint64_t n_blocks; + + /* Check input params */ + if (!block_func || !block || thread_id >= RTE_MAX_LCORE) + return -EINVAL; + + if (block_find(block) < RTE_MAX_LCORE) + return -EEXIST; + + t = &threads[thread_id]; + if (!t->enabled) + return -EINVAL; + + n_blocks = t->n_blocks; + + /* Check there is room for at least one more block. */ + if (n_blocks >= THREAD_BLOCKS_MAX) + return -ENOSPC; + + /* Install the new block. */ + t->blocks[n_blocks]->block_func = block_func; + t->blocks[n_blocks]->block = block; + + rte_wmb(); + t->n_blocks = n_blocks + 1; + + return 0; +} + +void +block_disable(void *block) +{ + struct thread *t; + uint64_t n_blocks; + uint32_t thread_id, i; + + /* Check input params */ + if (!block) + return; + + /* Find the thread that runs this block. */ + thread_id = block_find(block); + if (thread_id == RTE_MAX_LCORE) + return; + + t = &threads[thread_id]; + n_blocks = t->n_blocks; + + for (i = 0; i < n_blocks; i++) { + struct block *b = t->blocks[i]; + + if (block != b->block) + continue; + + if (i < n_blocks - 1) { + struct block *block_last = t->blocks[n_blocks - 1]; + + t->blocks[i] = block_last; + } + + rte_wmb(); + t->n_blocks = n_blocks - 1; + + rte_wmb(); + t->blocks[n_blocks - 1] = b; + +
[PATCH V3 08/11] examples/pipeline: rework the thread configuration updates
Previously, the configuration updates for the data plane threads were performed through message queues. Now, this mechanism is replaced by the control thread updating the mirror copy of the data plane thread configuration followed by pointer swapping. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/cli.c | 154 ++--- examples/pipeline/examples/fib.cli| 2 +- examples/pipeline/examples/hash_func.cli | 2 +- examples/pipeline/examples/l2fwd.cli | 2 +- examples/pipeline/examples/l2fwd_macswp.cli | 2 +- .../pipeline/examples/l2fwd_macswp_pcap.cli | 2 +- examples/pipeline/examples/l2fwd_pcap.cli | 2 +- examples/pipeline/examples/learner.cli| 2 +- examples/pipeline/examples/meter.cli | 2 +- examples/pipeline/examples/mirroring.cli | 2 +- examples/pipeline/examples/recirculation.cli | 2 +- examples/pipeline/examples/registers.cli | 2 +- examples/pipeline/examples/selector.cli | 2 +- examples/pipeline/examples/varbit.cli | 2 +- examples/pipeline/examples/vxlan.cli | 2 +- examples/pipeline/examples/vxlan_pcap.cli | 2 +- examples/pipeline/thread.c| 586 -- examples/pipeline/thread.h| 17 +- 18 files changed, 217 insertions(+), 570 deletions(-) diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index 92ec0fd8e3..68bb93a46c 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -3168,119 +3168,86 @@ cmd_ipsec_sa_delete(char **tokens, rte_swx_ipsec_sa_delete(ipsec, sa_id); } -static const char cmd_thread_pipeline_enable_help[] = -"thread pipeline enable [ period ]\n"; - -#ifndef TIMER_PERIOD_MS_DEFAULT -#define TIMER_PERIOD_MS_DEFAULT 10 -#endif +static const char cmd_pipeline_enable_help[] = +"pipeline enable thread \n"; static void -cmd_thread_pipeline_enable(char **tokens, - uint32_t n_tokens, - char *out, - size_t out_size, - void *obj __rte_unused) +cmd_pipeline_enable(char **tokens, + uint32_t n_tokens, + char *out, + size_t out_size, + void *obj __rte_unused) { char *pipeline_name; struct rte_swx_pipeline *p; - uint32_t thread_id, timer_period_ms = TIMER_PERIOD_MS_DEFAULT; + uint32_t thread_id; int status; - if ((n_tokens != 5) && (n_tokens != 7)) { + if (n_tokens != 5) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); return; } - if (parser_read_uint32(&thread_id, tokens[1]) != 0) { - snprintf(out, out_size, MSG_ARG_INVALID, "thread_id"); - return; - } - - if (strcmp(tokens[2], "pipeline") != 0) { - snprintf(out, out_size, MSG_ARG_NOT_FOUND, "pipeline"); - return; - } - - pipeline_name = tokens[3]; + pipeline_name = tokens[1]; p = rte_swx_pipeline_find(pipeline_name); if (!p) { snprintf(out, out_size, MSG_ARG_INVALID, "pipeline_name"); return; } - if (strcmp(tokens[4], "enable") != 0) { + if (strcmp(tokens[2], "enable") != 0) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "enable"); return; } - if (n_tokens == 7) { - if (strcmp(tokens[5], "period") != 0) { - snprintf(out, out_size, MSG_ARG_NOT_FOUND, "period"); - return; - } + if (strcmp(tokens[3], "thread") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "thread"); + return; + } - if (parser_read_uint32(&timer_period_ms, tokens[6]) != 0) { - snprintf(out, out_size, MSG_ARG_INVALID, "timer_period_ms"); - return; - } + if (parser_read_uint32(&thread_id, tokens[4]) != 0) { + snprintf(out, out_size, MSG_ARG_INVALID, "thread_id"); + return; } - status = thread_pipeline_enable(thread_id, p, timer_period_ms); + status = pipeline_enable(p, thread_id); if (status) { - snprintf(out, out_size, MSG_CMD_FAIL, "thread pipeline enable"); + snprintf(out, out_size, MSG_CMD_FAIL, "pipeline enable"); return; } } -static const char cmd_thread_pipeline_disable_help[] = -"thread pipeline disable\n"; +static const char cmd_pipeline_disable_help[] = +"pipeline disable\n"; static void -cmd_thread_pipeline_disable(char **tokens, - uint32_t n_tokens, - char *out, - size_t out_size, - void *obj __rte_unused) +cmd_pipeline_disable(char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size, +
[PATCH V3 10/11] examples/pipeline: add block enable/disable CLI commands
Add CLI commands to enable/disable block execution on data plane threads. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/cli.c | 154 1 file changed, 154 insertions(+) diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index 68bb93a46c..37250b7072 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -3250,6 +3250,134 @@ cmd_pipeline_disable(char **tokens, pipeline_disable(p); } +static const char cmd_block_enable_help[] = +"block type instance enable thread \n"; + +static void +cmd_block_enable(char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size, +void *obj __rte_unused) +{ + char *block_type, *block_name; + block_run_f block_func = NULL; + void *block = NULL; + uint32_t thread_id; + int status; + + if (n_tokens != 8) { + snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); + return; + } + + if (strcmp(tokens[1], "type") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "type"); + return; + } + + block_type = tokens[2]; + + if (strcmp(tokens[3], "instance") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "instance"); + return; + } + + block_name = tokens[4]; + + if (strcmp(tokens[5], "enable") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "enable"); + return; + } + + if (strcmp(tokens[6], "thread") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "thread"); + return; + } + + if (parser_read_uint32(&thread_id, tokens[7]) != 0) { + snprintf(out, out_size, MSG_ARG_INVALID, "thread_id"); + return; + } + + if (!strcmp(block_type, "ipsec")) { + struct rte_swx_ipsec *ipsec; + + ipsec = rte_swx_ipsec_find(block_name); + if (!ipsec) { + snprintf(out, out_size, MSG_ARG_INVALID, "block_name"); + return; + } + + block_func = (block_run_f)rte_swx_ipsec_run; + block = (void *)ipsec; + } else { + snprintf(out, out_size, MSG_ARG_INVALID, "block_type"); + return; + } + + status = block_enable(block_func, block, thread_id); + if (status) { + snprintf(out, out_size, MSG_CMD_FAIL, "block enable"); + return; + } +} + +static const char cmd_block_disable_help[] = +"block type instance disable\n"; + +static void +cmd_block_disable(char **tokens, + uint32_t n_tokens, + char *out, + size_t out_size, + void *obj __rte_unused) +{ + char *block_type, *block_name; + void *block = NULL; + + if (n_tokens != 6) { + snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); + return; + } + + if (strcmp(tokens[1], "type") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "type"); + return; + } + + block_type = tokens[2]; + + if (strcmp(tokens[3], "instance") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "instance"); + return; + } + + block_name = tokens[4]; + + if (strcmp(tokens[5], "disable") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "disable"); + return; + } + + if (!strcmp(block_type, "ipsec")) { + struct rte_swx_ipsec *ipsec; + + ipsec = rte_swx_ipsec_find(block_name); + if (!ipsec) { + snprintf(out, out_size, MSG_ARG_INVALID, "block_name"); + return; + } + + block = (void *)ipsec; + } else { + snprintf(out, out_size, MSG_ARG_INVALID, "block_type"); + return; + } + + block_disable(block); +} + static void cmd_help(char **tokens, uint32_t n_tokens, @@ -3298,6 +3426,8 @@ cmd_help(char **tokens, "\tipsec create\n" "\tipsec sa add\n" "\tipsec sa delete\n" + "\tblock enable\n" + "\tblock disable\n" ); return; } @@ -3553,6 +3683,18 @@ cmd_help(char **tokens, return; } + if (!strcmp(tokens[0], "block") && + (n_tokens == 2) && !strcmp(tokens[1], "enable")) { + snprintf(out, out_size, "\n%s\n", cmd_block_enable_help); + return; + } + + if (!strcmp(tokens[0], "block") && + (n_tokens == 2) && !strcmp(tokens[1], "disable")) { +
[PATCH V3 11/11] examples/pipeline: add IPsec example
Add example files to illustrate the pipeline IPsec support. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/examples/ipsec.cli| 57 +++ examples/pipeline/examples/ipsec.io | 23 +++ examples/pipeline/examples/ipsec.spec | 138 +++ examples/pipeline/examples/ipsec_sa.txt | 216 4 files changed, 434 insertions(+) create mode 100644 examples/pipeline/examples/ipsec.cli create mode 100644 examples/pipeline/examples/ipsec.io create mode 100644 examples/pipeline/examples/ipsec.spec create mode 100644 examples/pipeline/examples/ipsec_sa.txt diff --git a/examples/pipeline/examples/ipsec.cli b/examples/pipeline/examples/ipsec.cli new file mode 100644 index 00..8cb5bf4239 --- /dev/null +++ b/examples/pipeline/examples/ipsec.cli @@ -0,0 +1,57 @@ +; SPDX-License-Identifier: BSD-3-Clause +; Copyright(c) 2022 Intel Corporation + +# Example command line: +# ./build/examples/dpdk-pipeline -l0-1 --vdev crypto_aesni_mb0 -- -s ./examples/pipeline/examples/ipsec.cli +# +# Once the application has started, the command to get the CLI prompt is: +# telnet 0.0.0.0 8086 + +; +; Pipeline code generation & shared object library build. +; +pipeline codegen ./examples/pipeline/examples/ipsec.spec /tmp/ipsec.c +pipeline libbuild /tmp/ipsec.c /tmp/ipsec.so + +; +; List of DPDK devices. +; +; Note: Customize the parameters below to match your setup. +; +mempool MEMPOOL0 meta 128 pkt 2176 pool 32K cache 256 numa 0 +ethdev :18:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on +ethdev :18:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on +ethdev :3b:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on +ethdev :3b:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on + +cryptodev crypto_aesni_mb0 queues 1 qsize 128 +ring RING0 size 1024 numa 0 +ring RING1 size 1024 numa 0 + +; +; List of pipelines. +; +pipeline PIPELINE0 build lib /tmp/ipsec.so io ./examples/pipeline/examples/ipsec.io numa 0 + +; +; List of IPsec devices. +; +ipsec IPSEC0 create in RING0 out RING1 cryptodev crypto_aesni_mb0 cryptoq 0 bsz 32 32 32 32 samax 512 numa 0 + +; +; Initial set of table entries. +; +; The table entries can later be updated at run-time through the CLI commands. +; +//pipeline PIPELINE0 table policy_table add ./examples/pipeline/examples/ipsec_policy_table.txt +//pipeline PIPELINE0 table routing_table add ./examples/pipeline/examples/ipsec_routing_table.txt +//pipeline PIPELINE0 table nexthop_table add ./examples/pipeline/examples/ipsec_nexthop_table.txt +//pipeline PIPELINE0 commit + +ipsec IPSEC0 sa add ./examples/pipeline/examples/ipsec_sa.txt + +; +; Pipelines and blocks mapping to CPU threads. +; +pipeline PIPELINE0 enable thread 1 +block type ipsec instance IPSEC0 enable thread 1 diff --git a/examples/pipeline/examples/ipsec.io b/examples/pipeline/examples/ipsec.io new file mode 100644 index 00..f5a3fcf961 --- /dev/null +++ b/examples/pipeline/examples/ipsec.io @@ -0,0 +1,23 @@ +; SPDX-License-Identifier: BSD-3-Clause +; Copyright(c) 2022 Intel Corporation + +; +; Pipeline packet mirroring. +; +mirroring slots 4 sessions 64 + +; +; Pipeline input ports. +; +; Note: Customize the parameters below to match your setup. +; +port in 0 ethdev :18:00.0 rxq 0 bsz 32 +port in 1 ring RING1 bsz 32 + +; +; Pipeline output ports. +; +; Note: Customize the parameters below to match your setup. +; +port out 0 ethdev :18:00.0 txq 0 bsz 32 +port out 1 ring RING0 bsz 32 diff --git a/examples/pipeline/examples/ipsec.spec b/examples/pipeline/examples/ipsec.spec new file mode 100644 index 00..09aa831881 --- /dev/null +++ b/examples/pipeline/examples/ipsec.spec @@ -0,0 +1,138 @@ +; SPDX-License-Identifier: BSD-3-Clause +; Copyright(c) 2020 Intel Corporation + +// +// Headers +// +struct ethernet_h { + bit<48> dst_addr + bit<48> src_addr + bit<16> ethertype +} + +struct ipv4_h { + bit<8> ver_ihl + bit<8> diffserv + bit<16> total_len + bit<16> identification + bit<16> flags_offset + bit<8> ttl + bit<8> protocol + bit<16> hdr_checksum + bit<32> src_addr + bit<32> dst_addr +} + +struct udp_h { + bit<16> src_port + bit<16> dst_port + bit<16> length + bit<16> checksum +} + +struct ipsec_internal_h { + bit<32> sa_id +} + +header ethernet instanceof ethernet_h +header ipv4 instanceof ipv4_h +header udp instanceof udp_h +header ipsec_internal instanceof ipsec_internal_h + +// +// Meta-data +// +struct metadata_t { + bit<32> port_in + bit<32> port_out + + bit<32> src_addr + bit<32> dst_addr + bit<8> protocol + bit<16> src_port + bit<16> dst_port +} + +metadata instanceof metadata_t + +// +// Actions +// +struct encrypt_args_t { + bit<32> sa_id +} + +action encrypt args instanceof encrypt_args_t { + //Set the IPsec internal header. + validate h.ipsec_internal
RE: [PATCH] crypto/qat: fix build
> -Original Message- > From: Thomas Monjalon > Sent: Thursday, January 12, 2023 3:00 PM > To: Akhil Goyal ; Ji, Kai ; De Lara > Guarch, Pablo > Cc: dev@dpdk.org; Tyler Retzlaff ; > dev@dpdk.org; David Marchand ; Dooley, > Brian ; Power, Ciara ; > Mcnamara, John > Subject: Re: [PATCH] crypto/qat: fix build > > 12/01/2023 14:22, De Lara Guarch, Pablo: > > Hi Thomas, > > > > From: Thomas Monjalon > > > 12/01/2023 11:32, Ji, Kai: > > > > Ok, a long story short, this issue should only occurred when > > > RTE_QAT_LIBIPSECMB is enabled. > > > > It was intend to remove Openssl lib dependency in QAT replaced > > > > with ipsec_mb lib, but the work was partially done due to > > > > limitation of ipsec_mb by the time (FIPS certification) > > > > > > > > I'm happy with current fix and please cc: sta...@dpdk.org > > > > > > I'm not happy with this fix. It is a dirty workaround. > > > It would be better to have an #ifdef in ipsec_mb. > > > > > > Also I would like an answer to the question below. What triggered this > error? > > > Is it a new thing in the lib ipsec_mb? > > > Why defining AES_BLOCK_SIZE while IMB_AES_BLOCK_SIZE can be used > and > > > have a proper prefix? > > > > Apologies for the late response. > > > > This macro was renamed to IMB_AES_BLOCK_SIZE, as you already know. > > The problem is that, for compatibility reasons, we had to keep the old > macro as well. > > However, we added a compile time flag to remove these legacy macros, > > for exactly this reason (NO_COMPAT_IMB_API_053). > > > > I think a solution could be to use this flag in QAT, so the legacy macros > > are > not defined. > > > > I will send a patch to fix this. > > OK good, so we can reject this patch? > Well, this patch is merged already, but mine will revert it and add the new flag (pointing at the other commit to be fixed), so that should be OK, right?
Re: [PATCH] Update mailmap file
12/01/2023 16:03, Yevgeny Kliteynik: > +Yevgeny Kliteynik Your nvidia.com email should be enough. Please update this file in your first patch, it's enough.
Re: [PATCH] crypto/qat: fix build
12/01/2023 17:16, De Lara Guarch, Pablo: > From: Thomas Monjalon > > 12/01/2023 14:22, De Lara Guarch, Pablo: > > > Hi Thomas, > > > > > > From: Thomas Monjalon > > > > 12/01/2023 11:32, Ji, Kai: > > > > > Ok, a long story short, this issue should only occurred when > > > > RTE_QAT_LIBIPSECMB is enabled. > > > > > It was intend to remove Openssl lib dependency in QAT replaced > > > > > with ipsec_mb lib, but the work was partially done due to > > > > > limitation of ipsec_mb by the time (FIPS certification) > > > > > > > > > > I'm happy with current fix and please cc: sta...@dpdk.org > > > > > > > > I'm not happy with this fix. It is a dirty workaround. > > > > It would be better to have an #ifdef in ipsec_mb. > > > > > > > > Also I would like an answer to the question below. What triggered this > > error? > > > > Is it a new thing in the lib ipsec_mb? > > > > Why defining AES_BLOCK_SIZE while IMB_AES_BLOCK_SIZE can be used > > and > > > > have a proper prefix? > > > > > > Apologies for the late response. > > > > > > This macro was renamed to IMB_AES_BLOCK_SIZE, as you already know. > > > The problem is that, for compatibility reasons, we had to keep the old > > macro as well. > > > However, we added a compile time flag to remove these legacy macros, > > > for exactly this reason (NO_COMPAT_IMB_API_053). > > > > > > I think a solution could be to use this flag in QAT, so the legacy macros > > > are > > not defined. > > > > > > I will send a patch to fix this. > > > > OK good, so we can reject this patch? > > > > Well, this patch is merged already, but mine will revert it and add the new > flag > (pointing at the other commit to be fixed), so that should be OK, right? The patch was merged in the crypto tree but we can discard it. Akhil, please remove this patch from your tree, thanks.
Re: [EXT] Re: [PATCH v2 2/3] graph: pcap capture for graph nodes
On Thu, 12 Jan 2023 09:57:50 + Amit Prakash Shukla wrote: > Hi Stephen, > > > -Original Message- > > From: Stephen Hemminger > > Sent: Wednesday, January 11, 2023 9:37 PM > > To: Amit Prakash Shukla > > Cc: Jerin Jacob Kollanukkaran ; Kiran Kumar > > Kokkilagadda ; Nithin Kumar Dabilpuram > > ; dev@dpdk.org > > Subject: [EXT] Re: [PATCH v2 2/3] graph: pcap capture for graph nodes > > > > External Email > > > > -- > > On Wed, 11 Jan 2023 14:23:41 +0530 > > Amit Prakash Shukla wrote: > > > > > + > > > +#define PCAP_DUMP_DATA(dbuf, buf_size, cur_len, sbuf, len) > > > \ > > > +do { > > > \ > > > + if ((cur_len + len) >= buf_size) \ > > > + break; \ > > > + rte_memcpy(dbuf + cur_len, sbuf, len); \ > > > + cur_len += len; \ > > > +} while (0) > > > + > > > > Why do you need this to be a macro. > > Macro's are evil, have side effects and hide code. > > I had added macro for future, if lot of custom data is to be added to pcapng. > Anyways I will remove it > in next version of patch. One other option is to add a new custom block type or options in pcapng. Keep comment as a string, since that is what wireshark etc no how to handle. Also, packet id data might be useful for graph. https://pcapng.github.io/pcapng/draft-tuexen-opsawg-pcapng.html
[PATCH v7 1/4] eventdev/eth_rx: change eventdev reconfig logic
When rte_event_eth_rx_adapter_create() or rte_event_eth_rx_adapter_create_with_params() is used for creating adapter instance, eventdev is reconfigured with additional ``rte_event_dev_config::nb_event_ports`` parameter. This eventdev reconfig logic is enhanced to increment the ``rte_event_dev_config::nb_single_link_event_port_queues`` parameter if the adapter event port config is of type ``RTE_EVENT_PORT_CFG_SINGLE_LINK``. With this change the application no longer need to configure the eventdev with ``rte_event_dev_config::nb_single_link_event_port_queues`` parameter required for eth_rx adapter when the adapter is created using above mentioned apis. Signed-off-by: Naga Harish K S V Acked-by: Abhinandan Gujjar --- v2: * Fix build error v3: * update doxygen v5: * update doxygen as per review comments v6: * no update in rxa --- --- .../prog_guide/event_ethernet_rx_adapter.rst | 19 +++ lib/eventdev/rte_event_eth_rx_adapter.c | 3 +++ lib/eventdev/rte_event_eth_rx_adapter.h | 14 ++ 3 files changed, 36 insertions(+) diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst index 116c0a27c6..bbe278f7db 100644 --- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst +++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst @@ -71,6 +71,25 @@ set to true. The function is passed the event device to be associated with the adapter and port configuration for the adapter to setup an event port if the adapter needs to use a service function. +Event device configuration for service based adapter + + +When rte_event_eth_rx_adapter_create() or +rte_event_eth_rx_adapter_create_with_params() is used for creating +adapter instance, ``rte_event_dev_config::nb_event_ports`` is +automatically incremented and the event device is reconfigured with +the additional event port during service initialization. This event +device reconfigure logic also increments the +``rte_event_dev_config::nb_single_link_event_port_queues`` +parameter if the adapter event port config is of type +``RTE_EVENT_PORT_CFG_SINGLE_LINK``. + +Application no longer needs to account for the +``rte_event_dev_config::nb_event_ports`` and +``rte_event_dev_config::nb_single_link_event_port_queues`` +parameters required for eth Rx adapter in the event device configuration, +when the adapter is created using the above-mentioned APIs. + Adding Rx Queues to the Adapter Instance diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c index cf7bbd4d69..34aa87379e 100644 --- a/lib/eventdev/rte_event_eth_rx_adapter.c +++ b/lib/eventdev/rte_event_eth_rx_adapter.c @@ -1532,6 +1532,9 @@ rxa_default_conf_cb(uint8_t id, uint8_t dev_id, rte_event_dev_stop(dev_id); port_id = dev_conf.nb_event_ports; dev_conf.nb_event_ports += 1; + if (port_conf->event_port_cfg & RTE_EVENT_PORT_CFG_SINGLE_LINK) + dev_conf.nb_single_link_event_port_queues += 1; + ret = rte_event_dev_configure(dev_id, &dev_conf); if (ret) { RTE_EDEV_LOG_ERR("failed to configure event dev %u\n", diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h index d0e7d0092c..f4652f40e8 100644 --- a/lib/eventdev/rte_event_eth_rx_adapter.h +++ b/lib/eventdev/rte_event_eth_rx_adapter.h @@ -382,6 +382,20 @@ int rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id, * control in configuration of the service, it should use the * rte_event_eth_rx_adapter_create_ext() version. * + * When this API is used for creating adapter instance, + * ``rte_event_dev_config::nb_event_ports`` is automatically incremented, + * and event device is reconfigured with additional event port during service + * initialization. This event device reconfigure logic also increments the + * ``rte_event_dev_config::nb_single_link_event_port_queues`` + * parameter if the adapter event port config is of type + * ``RTE_EVENT_PORT_CFG_SINGLE_LINK``. + * + * Application no longer needs to account for + * ``rte_event_dev_config::nb_event_ports`` and + * ``rte_event_dev_config::nb_single_link_event_port_queues`` + * parameters required for eth Rx adapter in the event device configuration + * when the adapter is created with this API. + * * @param id * The identifier of the ethernet Rx event adapter. * -- 2.25.1
[PATCH v7 2/4] eventdev/eth_tx: change eventdev reconfig logic
When rte_event_eth_tx_adapter_create() is used for creating adapter instance, eventdev is reconfigured with additional ``rte_event_dev_config::nb_event_ports`` parameter. This eventdev reconfig logic is enhanced to increment the ``rte_event_dev_config::nb_single_link_event_port_queues`` parameter if the adapter event port config is of type ``RTE_EVENT_PORT_CFG_SINGLE_LINK``. With this change the application is no longer need to configure the eventdev with ``rte_event_dev_config::nb_single_link_event_port_queues`` parameter required for eth_tx adapter when the adapter is created using above mentioned api. Signed-off-by: Naga Harish K S V Acked-by: Abhinandan Gujjar --- v2: * fix build error in doc/prog_guide v3: * update doxygen v5: * update doxygen as per review comments v6: * no update in txa --- --- .../prog_guide/event_ethernet_tx_adapter.rst| 17 + lib/eventdev/rte_event_eth_tx_adapter.c | 2 ++ lib/eventdev/rte_event_eth_tx_adapter.h | 14 ++ 3 files changed, 33 insertions(+) diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst index 905cb445e0..711ecb7441 100644 --- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst +++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst @@ -56,6 +56,23 @@ and needs to create an event port for it. The callback is expected to fill the err = rte_event_eth_tx_adapter_create(id, dev_id, &tx_p_conf); +Event device configuration for service based adapter + + +When rte_event_eth_tx_adapter_create() is used for creating +adapter instance, ``rte_event_dev_config::nb_event_ports`` is +automatically incremented, and the event device is reconfigured with additional +event port during service initialization. This event device reconfigure logic +also increments the ``rte_event_dev_config::nb_single_link_event_port_queues`` +parameter if the adapter event port config is of type +``RTE_EVENT_PORT_CFG_SINGLE_LINK``. + +Application no longer needs to configure the event device with +``rte_event_dev_config::nb_event_ports`` and +``rte_event_dev_config::nb_single_link_event_port_queues`` +parameters required for eth Tx adapter when the adapter is created +using the above-mentioned API. + Adding Tx Queues to the Adapter Instance diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c index 88309d2aaa..c780ee1264 100644 --- a/lib/eventdev/rte_event_eth_tx_adapter.c +++ b/lib/eventdev/rte_event_eth_tx_adapter.c @@ -316,6 +316,8 @@ txa_service_conf_cb(uint8_t __rte_unused id, uint8_t dev_id, port_id = dev_conf.nb_event_ports; dev_conf.nb_event_ports += 1; + if (pc->event_port_cfg & RTE_EVENT_PORT_CFG_SINGLE_LINK) + dev_conf.nb_single_link_event_port_queues += 1; ret = rte_event_dev_configure(dev_id, &dev_conf); if (ret) { diff --git a/lib/eventdev/rte_event_eth_tx_adapter.h b/lib/eventdev/rte_event_eth_tx_adapter.h index 645b87b78a..cd539af7ef 100644 --- a/lib/eventdev/rte_event_eth_tx_adapter.h +++ b/lib/eventdev/rte_event_eth_tx_adapter.h @@ -142,6 +142,20 @@ struct rte_event_eth_tx_adapter_stats { /** * Create a new ethernet Tx adapter with the specified identifier. * + * When this API is used for creating adapter instance, + * ``rte_event_dev_config::nb_event_ports`` is automatically incremented, + * and event device is reconfigured with additional event port during service + * initialization. This event device reconfigure logic also increments the + * ``rte_event_dev_config::nb_single_link_event_port_queues`` + * parameter if the adapter event port config is of type + * ``RTE_EVENT_PORT_CFG_SINGLE_LINK``. + * + * Application no longer needs to account for the + * ``rte_event_dev_config::nb_event_ports`` and + * ``rte_event_dev_config::nb_single_link_event_port_queues`` + * parameters required for eth Tx adapter in event device configure when + * the adapter is created with this API. + * * @param id * The identifier of the ethernet Tx adapter. * @param dev_id -- 2.25.1
[PATCH v7 3/4] eventdev/crypto: change eventdev reconfig logic
When rte_event_crypto_adapter_create() is used for creating adapter instance, eventdev is reconfigured with additional ``rte_event_dev_config::nb_event_ports`` parameter. This eventdev reconfig logic is enhanced to increment the ``rte_event_dev_config::nb_single_link_event_port_queues`` parameter if the adapter event port config is of type ``RTE_EVENT_PORT_CFG_SINGLE_LINK``. With this change the application is no longer need to configure the eventdev with ``rte_event_dev_config::nb_single_link_event_port_queues`` parameter required for crypto adapter when the adapter is created using above mentioned api. Signed-off-by: Naga Harish K S V Acked-by: Abhinandan Gujjar --- v2: * fix build error in documentation v3: * update doxygen v5: * update doxygen as per review comments v6: * no update in crypto adapter --- --- doc/guides/prog_guide/event_crypto_adapter.rst | 17 + lib/eventdev/rte_event_crypto_adapter.c| 3 +++ lib/eventdev/rte_event_crypto_adapter.h| 14 ++ 3 files changed, 34 insertions(+) diff --git a/doc/guides/prog_guide/event_crypto_adapter.rst b/doc/guides/prog_guide/event_crypto_adapter.rst index 554df7e358..7c409176d1 100644 --- a/doc/guides/prog_guide/event_crypto_adapter.rst +++ b/doc/guides/prog_guide/event_crypto_adapter.rst @@ -159,6 +159,23 @@ which it enqueues events towards the crypto adapter using nb_events); } +Event device configuration for service based adapter + + +When rte_event_crypto_adapter_create() is used for creating +adapter instance, ``rte_event_dev_config::nb_event_ports`` is +automatically incremented, and event device is reconfigured with additional +event port during service initialization. This event device reconfigure +logic also increments the +``rte_event_dev_config::nb_single_link_event_port_queues`` +parameter if the adapter event port config is of type +``RTE_EVENT_PORT_CFG_SINGLE_LINK``. + +Application no longer needs to configure the +event device with ``rte_event_dev_config::nb_event_ports`` and +``rte_event_dev_config::nb_single_link_event_port_queues`` +parameters required for crypto adapter when the adapter is created +using the above-mentioned API. Querying adapter capabilities ~ diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c index 3c585d7b0d..5620a36dd3 100644 --- a/lib/eventdev/rte_event_crypto_adapter.c +++ b/lib/eventdev/rte_event_crypto_adapter.c @@ -287,6 +287,9 @@ eca_default_config_cb(uint8_t id, uint8_t dev_id, rte_event_dev_stop(dev_id); port_id = dev_conf.nb_event_ports; dev_conf.nb_event_ports += 1; + if (port_conf->event_port_cfg & RTE_EVENT_PORT_CFG_SINGLE_LINK) + dev_conf.nb_single_link_event_port_queues += 1; + ret = rte_event_dev_configure(dev_id, &dev_conf); if (ret) { RTE_EDEV_LOG_ERR("failed to configure event dev %u\n", dev_id); diff --git a/lib/eventdev/rte_event_crypto_adapter.h b/lib/eventdev/rte_event_crypto_adapter.h index 83d154a6ce..0c610b8e04 100644 --- a/lib/eventdev/rte_event_crypto_adapter.h +++ b/lib/eventdev/rte_event_crypto_adapter.h @@ -414,6 +414,20 @@ rte_event_crypto_adapter_create_ext(uint8_t id, uint8_t dev_id, * control in configuration of the service, it should use the * rte_event_crypto_adapter_create_ext() version. * + * When this API is used for creating adapter instance, + * ``rte_event_dev_config::nb_event_ports`` is automatically incremented, + * and the event device is reconfigured with additional event port during + * service initialization. This event device reconfigure logic also increments + * the ``rte_event_dev_config::nb_single_link_event_port_queues`` + * parameter if the adapter event port config is of type + * ``RTE_EVENT_PORT_CFG_SINGLE_LINK``. + * + * Application no longer needs to account for + * ``rte_event_dev_config::nb_event_ports`` and + * ``rte_event_dev_config::nb_single_link_event_port_queues`` + * parameters required for crypto adapter in event device configuration + * when the adapter is created with this API. + * * @param id * Adapter identifier. * -- 2.25.1
[PATCH v7 4/4] eventdev/timer: change eventdev reconfig logic
When rte_event_timer_adapter_create() is used for creating adapter instance, eventdev is reconfigured with additional ``rte_event_dev_config::nb_event_ports`` parameter. This eventdev reconfig logic is enhanced to increment the ``rte_event_dev_config::nb_single_link_event_port_queues`` parameter if the adapter event port config is of type ``RTE_EVENT_PORT_CFG_SINGLE_LINK``. With this change the application is no longer need to configure the eventdev with ``rte_event_dev_config::nb_single_link_event_port_queues`` parameter required for timer adapter when the adapter is created using above mentioned api. Signed-off-by: Naga Harish K S V Acked-by: Abhinandan Gujjar --- v2: * fix build error in documentation v3: * update doxygen v4: * fix programmer guide v5: * update doxygen as per review comments v6: * fix adapter cretae logic with correct event port id v7: * updated 23.03 release notes --- --- doc/guides/prog_guide/event_timer_adapter.rst | 18 +++ doc/guides/rel_notes/release_23_03.rst| 10 lib/eventdev/rte_event_timer_adapter.c| 23 +++ lib/eventdev/rte_event_timer_adapter.h| 14 +++ 4 files changed, 55 insertions(+), 10 deletions(-) diff --git a/doc/guides/prog_guide/event_timer_adapter.rst b/doc/guides/prog_guide/event_timer_adapter.rst index d7307a29bb..b5cd95fef1 100644 --- a/doc/guides/prog_guide/event_timer_adapter.rst +++ b/doc/guides/prog_guide/event_timer_adapter.rst @@ -139,6 +139,24 @@ This function is passed a callback function that will be invoked if the adapter needs to create an event port, giving the application the opportunity to control how it is done. +Event device configuration for service based adapter + + +When rte_event_timer_adapter_create() is used for creating +adapter instance, ``rte_event_dev_config::nb_event_ports`` is +automatically incremented, and the event device is reconfigured with +additional event port during service initialization. +This event device reconfigure logic also increments the +``rte_event_dev_config::nb_single_link_event_port_queues`` +parameter if the adapter event port config is of type +``RTE_EVENT_PORT_CFG_SINGLE_LINK``. + +Application no longer needs to account for the +``rte_event_dev_config::nb_event_ports`` and +``rte_event_dev_config::nb_single_link_event_port_queues`` +parameters required for timer adapter in event device configuration, +when the adapter is created using the above-mentioned API. + Adapter modes ^ An event timer adapter can be configured in either periodic or non-periodic mode diff --git a/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst index b8c5b68d6c..1815604598 100644 --- a/doc/guides/rel_notes/release_23_03.rst +++ b/doc/guides/rel_notes/release_23_03.rst @@ -55,6 +55,16 @@ New Features Also, make sure to start the actual text at the margin. === +* **Updated the eventdev reconfigure logic for service based adapters.** + + * This eventdev reconfig logic is enhanced to increment the +``rte_event_dev_config::nb_single_link_event_port_queues`` +parameter if event port config is of type +``RTE_EVENT_PORT_CFG_SINGLE_LINK``. + * With this change, the application no longer needs to account for the +``rte_event_dev_config::nb_single_link_event_port_queues`` parameter +required for adapters. + * This change is added for eth_rx, eth_tx, crypto and timer eventdev adapters. Removed Items - diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c index a0f14bf861..66554f13fc 100644 --- a/lib/eventdev/rte_event_timer_adapter.c +++ b/lib/eventdev/rte_event_timer_adapter.c @@ -88,7 +88,20 @@ default_port_conf_cb(uint16_t id, uint8_t event_dev_id, uint8_t *event_port_id, rte_event_dev_stop(dev_id); port_id = dev_conf.nb_event_ports; + if (conf_arg != NULL) + port_conf = conf_arg; + else { + port_conf = &def_port_conf; + ret = rte_event_port_default_conf_get(dev_id, (port_id - 1), + port_conf); + if (ret < 0) + return ret; + } + dev_conf.nb_event_ports += 1; + if (port_conf->event_port_cfg & RTE_EVENT_PORT_CFG_SINGLE_LINK) + dev_conf.nb_single_link_event_port_queues += 1; + ret = rte_event_dev_configure(dev_id, &dev_conf); if (ret < 0) { EVTIM_LOG_ERR("failed to configure event dev %u\n", dev_id); @@ -99,16 +112,6 @@ default_port_conf_cb(uint16_t id, uint8_t event_dev_id, uint8_t *event_port_id, return ret; } - if (conf_arg != NULL) - port_conf = conf_arg; - else { - port_conf = &def_port_conf; - ret = rte_event_po
Re: [PATCH v3] net/ice: add devargs for disabling default mac
On Thu, 12 Jan 2023 15:55:38 +0800 Ke Zhang wrote: > From: "ke1x.zhang" > > Add the feature that support to disable default mac which > will be used by ice driver when setting dpdk_devargs config > field. > > Default mac is not disabled in default, user can > choose to disable the default mac > by setting ``devargs`` parameter ``default-mac-disable``, > > for example:: > -a 80:00.0,default-mac-disable=1 > > Signed-off-by: ke1x.zhang Why is the driver specific option needed? Can't it be handled more generally by the application.
RE: [PATCH v5 1/6] eal: trace: add trace point emit for blob
> -Original Message- > From: Ankur Dwivedi > Sent: Thursday, January 12, 2023 4:52 PM > To: dev@dpdk.org > Cc: tho...@monjalon.net; david.march...@redhat.com; m...@ashroe.eu; > or...@nvidia.com; ferruh.yi...@amd.com; ch...@att.com; > humi...@huawei.com; linvi...@tuxdriver.com; ciara.lof...@intel.com; > qi.z.zh...@intel.com; m...@semihalf.com; m...@semihalf.com; > shaib...@amazon.com; evge...@amazon.com; igo...@amazon.com; > cha...@amd.com; Igor Russkikh ; > shepard.sie...@atomicrules.com; ed.cz...@atomicrules.com; > john.mil...@atomicrules.com; ajit.khapa...@broadcom.com; > somnath.ko...@broadcom.com; Jerin Jacob Kollanukkaran > ; Maciej Czekaj [C] ; Shijith > Thotton ; Srisivasubramanian Srinivasan > ; Harman Kalra ; > rahul.lakkire...@chelsio.com; johnd...@cisco.com; hyon...@cisco.com; > liudongdo...@huawei.com; yisen.zhu...@huawei.com; > xuanziya...@huawei.com; cloud.wangxiao...@huawei.com; > zhouguoy...@huawei.com; simei...@intel.com; wenjun1...@intel.com; > qiming.y...@intel.com; yuying.zh...@intel.com; beilei.x...@intel.com; > xiao.w.w...@intel.com; jingjing...@intel.com; junfeng@intel.com; > rosen...@intel.com; Nithin Kumar Dabilpuram > ; Kiran Kumar Kokkilagadda > ; Sunil Kumar Kori ; Satha > Koteswara Rao Kottidi ; Liron Himi > ; z...@semihalf.com; Radha Chintakuntla > ; Veerasenareddy Burru ; > Sathesh B Edara ; ma...@nvidia.com; > viachesl...@nvidia.com; lon...@microsoft.com; spin...@cesnet.cz; > chaoyong...@corigine.com; niklas.soderl...@corigine.com; > hemant.agra...@nxp.com; sachin.sax...@oss.nxp.com; g.si...@nxp.com; > apeksha.gu...@nxp.com; sachin.sax...@nxp.com; abo...@pensando.io; > Rasesh Mody ; Shahed Shaikh > ; Devendra Singh Rawat > ; andrew.rybche...@oktetlabs.ru; > jiawe...@trustnetic.com; jianw...@trustnetic.com; > jbehr...@vmware.com; maxime.coque...@redhat.com; > chenbo@intel.com; steven.webs...@windriver.com; > matt.pet...@windriver.com; bruce.richard...@intel.com; > mtetsu...@gmail.com; gr...@u256.net; jasvinder.si...@intel.com; > cristian.dumitre...@intel.com; jgraj...@cisco.com; > m...@smartsharesystems.com; Ankur Dwivedi > Subject: [PATCH v5 1/6] eal: trace: add trace point emit for blob > > Adds a trace point emit function for emitting a blob. The maximum blob > bytes which can be captured is maximum value contained in uint16_t, which > is 65535. > > Also adds test case for emit array tracepoint function. > > Signed-off-by: Ankur Dwivedi > --- > app/test/test_trace.c | 5 + > lib/eal/common/eal_common_trace_points.c | 2 ++ > lib/eal/include/rte_eal_trace.h| 6 ++ > lib/eal/include/rte_trace_point.h | 17 + > lib/eal/include/rte_trace_point_register.h | 7 +++ > lib/eal/version.map| 3 +++ > 6 files changed, 40 insertions(+) > > diff --git a/app/test/test_trace.c b/app/test/test_trace.c index > 6bedf14024..cf781dc25b 100644 > --- a/app/test/test_trace.c > +++ b/app/test/test_trace.c > @@ -4,6 +4,7 @@ > > #include > #include > +#include > #include > > #include "test.h" > @@ -177,6 +178,7 @@ test_fp_trace_points(void) static int > test_generic_trace_points(void) > { > + uint8_t arr[32] = {0}; > int tmp; > > rte_eal_trace_generic_void(); > @@ -195,6 +197,9 @@ test_generic_trace_points(void) > rte_eal_trace_generic_ptr(&tmp); > rte_eal_trace_generic_str("my string"); > rte_eal_trace_generic_size_t(sizeof(void *)); > + rte_eal_trace_generic_blob(arr, 17); Do we need this test case now as (rte_rand % 32) will make sure to validate array of valid size only i.e. 0-31 ? > + rte_eal_trace_generic_blob(arr, 32); > + rte_eal_trace_generic_blob(arr, rte_rand() % 32); When executed trace_autotest then I didn't find 3rd generic.blob trace point. Can you please explain the behavior ? > RTE_EAL_TRACE_GENERIC_FUNC; > > return TEST_SUCCESS; > diff --git a/lib/eal/common/eal_common_trace_points.c > b/lib/eal/common/eal_common_trace_points.c > index 0b0b254615..051f89809c 100644 > --- a/lib/eal/common/eal_common_trace_points.c > +++ b/lib/eal/common/eal_common_trace_points.c > @@ -40,6 +40,8 @@ > RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_size_t, > lib.eal.generic.size_t) > RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_func, > lib.eal.generic.func) > +RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_blob, > + lib.eal.generic.blob) > > RTE_TRACE_POINT_REGISTER(rte_eal_trace_alarm_set, > lib.eal.alarm.set) > diff --git a/lib/eal/include/rte_eal_trace.h b/lib/eal/include/rte_eal_trace.h > index 5ef4398230..02e3a564a1 100644 > --- a/lib/eal/include/rte_eal_trace.h > +++ b/lib/eal/include/rte_eal_trace.h > @@ -143,6 +143,12 @@ RTE_TRACE_POINT( > rte_trace_point_emit_string(func); > ) > > +RTE_TRACE_POINT( > + rte_eal_trace_generic_blob, > + RTE_TRACE_POINT_ARGS(void *in, uint16_t len), > + rte_trace_point_emit_blob(in, len); > +) > + > #define RTE_EAL_TR
RE: [PATCH v6 4/4] eventdev/timer: change eventdev reconfig logic
Hi Jerin, > -Original Message- > From: Jerin Jacob > Sent: Thursday, January 12, 2023 12:36 PM > To: Naga Harish K, S V > Cc: jer...@marvell.com; Carrillo, Erik G ; Gujjar, > Abhinandan S ; dev@dpdk.org; > Jayatheerthan, Jay > Subject: Re: [PATCH v6 4/4] eventdev/timer: change eventdev reconfig logic > > On Wed, Jan 4, 2023 at 12:12 PM Naga Harish K S V > wrote: > > > > When rte_event_timer_adapter_create() is used for creating adapter > > instance, eventdev is reconfigured with additional > > ``rte_event_dev_config::nb_event_ports`` parameter. > > > > This eventdev reconfig logic is enhanced to increment the > > ``rte_event_dev_config::nb_single_link_event_port_queues`` > > parameter if the adapter event port config is of type > > ``RTE_EVENT_PORT_CFG_SINGLE_LINK``. > > In general, the change is OK. Some comments, > > > > With this change the application is no longer need to configure the > > What happens to existing application? Will it > a) Fail at runtime > b) Fail at compile time > c) Need to change application code to make existing application working > d) Change the application code to get this enhancement > > This is to understand what need to be updated in > doc/guides/rel_notes/release_23_03.rst > > If it is (d), Please update doc/guides/rel_notes/release_23_03.rst to make > sure end user know this enhancement is added. > If not (d), it is kind of application breaking scenario and make it as (d). > If the existing application is using rte_event_ <>_adapter_create() for creating service based adapter instance and requires event_port with ``RTE_EVENT_PORT_CFG_SINGLE_LINK`` configuration, may fail at runtime. Updated the doc/guides/rel_notes/release_23_03.rst with this info in V7 patchset. > > eventdev with > > ``rte_event_dev_config::nb_single_link_event_port_queues`` > > > > parameter required for timer adapter when the adapter is created using > > above mentioned api. > > > > Signed-off-by: Naga Harish K S V > > Acked-by: Abhinandan Gujjar > > --- > > v2: > > * fix build error in documentation > > v3: > > * update doxygen > > v4: > > * fix programmer guide > > v5: > > * update doxygen as per review comments > > v6: > > * fix adapter cretae logic with correct event port id > > --- > > --- > > doc/guides/prog_guide/event_timer_adapter.rst | 18 +++ > > lib/eventdev/rte_event_timer_adapter.c| 23 +++ > > lib/eventdev/rte_event_timer_adapter.h| 14 +++ > > 3 files changed, 45 insertions(+), 10 deletions(-) > > > > diff --git a/doc/guides/prog_guide/event_timer_adapter.rst > > b/doc/guides/prog_guide/event_timer_adapter.rst > > index d7307a29bb..b5cd95fef1 100644 > > --- a/doc/guides/prog_guide/event_timer_adapter.rst > > +++ b/doc/guides/prog_guide/event_timer_adapter.rst > > @@ -139,6 +139,24 @@ This function is passed a callback function that > > will be invoked if the adapter needs to create an event port, giving > > the application the opportunity to control how it is done. > > > > +Event device configuration for service based adapter > > + > > + > > +When rte_event_timer_adapter_create() is used for creating adapter > > +instance, ``rte_event_dev_config::nb_event_ports`` is automatically > > +incremented, and the event device is reconfigured with additional > > +event port during service initialization. > > +This event device reconfigure logic also increments the > > +``rte_event_dev_config::nb_single_link_event_port_queues`` > > +parameter if the adapter event port config is of type > > +``RTE_EVENT_PORT_CFG_SINGLE_LINK``. > > + > > +Application no longer needs to account for the > > +``rte_event_dev_config::nb_event_ports`` and > > +``rte_event_dev_config::nb_single_link_event_port_queues`` > > +parameters required for timer adapter in event device configuration, > > +when the adapter is created using the above-mentioned API. > > + > > Adapter modes > > ^ > > An event timer adapter can be configured in either periodic or > > non-periodic mode diff --git a/lib/eventdev/rte_event_timer_adapter.c > > b/lib/eventdev/rte_event_timer_adapter.c > > index a0f14bf861..66554f13fc 100644 > > --- a/lib/eventdev/rte_event_timer_adapter.c > > +++ b/lib/eventdev/rte_event_timer_adapter.c > > @@ -88,7 +88,20 @@ default_port_conf_cb(uint16_t id, uint8_t > event_dev_id, uint8_t *event_port_id, > > rte_event_dev_stop(dev_id); > > > > port_id = dev_conf.nb_event_ports; > > + if (conf_arg != NULL) > > + port_conf = conf_arg; > > + else { > > + port_conf = &def_port_conf; > > + ret = rte_event_port_default_conf_get(dev_id, (port_id - 1), > > + port_conf); > > + if (ret < 0) > > + return ret; > > + } > > + > > dev_conf.nb_event_ports += 1; > > + if (port_conf->event_port_cfg & > RTE
Re: [PATCH] crypto/qat: fix build
On Thu, Jan 12, 2023 at 01:22:09PM +, De Lara Guarch, Pablo wrote: > Hi Thomas, > > > -Original Message- > > From: Thomas Monjalon > > Sent: Thursday, January 12, 2023 10:41 AM > > To: De Lara Guarch, Pablo ; Akhil Goyal > > ; Ji, Kai > > Cc: dev@dpdk.org; Tyler Retzlaff ; > > dev@dpdk.org; David Marchand ; Dooley, > > Brian ; Power, Ciara ; > > Mcnamara, John > > Subject: Re: [PATCH] crypto/qat: fix build > > > > 12/01/2023 11:32, Ji, Kai: > > > Ok, a long story short, this issue should only occurred when > > RTE_QAT_LIBIPSECMB is enabled. > > > It was intend to remove Openssl lib dependency in QAT replaced with > > > ipsec_mb lib, but the work was partially done due to limitation of > > > ipsec_mb by the time (FIPS certification) > > > > > > I'm happy with current fix and please cc: sta...@dpdk.org > > > > I'm not happy with this fix. It is a dirty workaround. > > It would be better to have an #ifdef in ipsec_mb. > > > > Also I would like an answer to the question below. What triggered this > > error? > > Is it a new thing in the lib ipsec_mb? > > Why defining AES_BLOCK_SIZE while IMB_AES_BLOCK_SIZE can be used and > > have a proper prefix? > > Apologies for the late response. > > This macro was renamed to IMB_AES_BLOCK_SIZE, as you already know. > The problem is that, for compatibility reasons, we had to keep the old macro > as well. doesn't this mean the compat could have been retained with a simple check? #ifndef AES_BLOCK_SIZE #define AES_BLOCK_SIZE IMB_AES_BLOCK_SIZE #endif anyway, you can ignore this comment if you already worked out a solution on the mail thread.
RE: [PATCH v5 2/6] ethdev: add trace points for ethdev
> -Original Message- > From: Ankur Dwivedi > Sent: Thursday, January 12, 2023 4:52 PM > To: dev@dpdk.org > Cc: tho...@monjalon.net; david.march...@redhat.com; m...@ashroe.eu; > or...@nvidia.com; ferruh.yi...@amd.com; ch...@att.com; > humi...@huawei.com; linvi...@tuxdriver.com; ciara.lof...@intel.com; > qi.z.zh...@intel.com; m...@semihalf.com; m...@semihalf.com; > shaib...@amazon.com; evge...@amazon.com; igo...@amazon.com; > cha...@amd.com; Igor Russkikh ; > shepard.sie...@atomicrules.com; ed.cz...@atomicrules.com; > john.mil...@atomicrules.com; ajit.khapa...@broadcom.com; > somnath.ko...@broadcom.com; Jerin Jacob Kollanukkaran > ; Maciej Czekaj [C] ; Shijith > Thotton ; Srisivasubramanian Srinivasan > ; Harman Kalra ; > rahul.lakkire...@chelsio.com; johnd...@cisco.com; hyon...@cisco.com; > liudongdo...@huawei.com; yisen.zhu...@huawei.com; > xuanziya...@huawei.com; cloud.wangxiao...@huawei.com; > zhouguoy...@huawei.com; simei...@intel.com; wenjun1...@intel.com; > qiming.y...@intel.com; yuying.zh...@intel.com; beilei.x...@intel.com; > xiao.w.w...@intel.com; jingjing...@intel.com; junfeng@intel.com; > rosen...@intel.com; Nithin Kumar Dabilpuram > ; Kiran Kumar Kokkilagadda > ; Sunil Kumar Kori ; Satha > Koteswara Rao Kottidi ; Liron Himi > ; z...@semihalf.com; Radha Chintakuntla > ; Veerasenareddy Burru ; > Sathesh B Edara ; ma...@nvidia.com; > viachesl...@nvidia.com; lon...@microsoft.com; spin...@cesnet.cz; > chaoyong...@corigine.com; niklas.soderl...@corigine.com; > hemant.agra...@nxp.com; sachin.sax...@oss.nxp.com; g.si...@nxp.com; > apeksha.gu...@nxp.com; sachin.sax...@nxp.com; abo...@pensando.io; > Rasesh Mody ; Shahed Shaikh > ; Devendra Singh Rawat > ; andrew.rybche...@oktetlabs.ru; > jiawe...@trustnetic.com; jianw...@trustnetic.com; > jbehr...@vmware.com; maxime.coque...@redhat.com; > chenbo@intel.com; steven.webs...@windriver.com; > matt.pet...@windriver.com; bruce.richard...@intel.com; > mtetsu...@gmail.com; gr...@u256.net; jasvinder.si...@intel.com; > cristian.dumitre...@intel.com; jgraj...@cisco.com; > m...@smartsharesystems.com; Ankur Dwivedi > Subject: [PATCH v5 2/6] ethdev: add trace points for ethdev > > Adds trace points for ethdev functions. > Moved the rte_ethdev_trace_rx_burst and rte_ethdev_trace_tx_burst to > a new file rte_ethdev_trace_fp_burst.h. This is needed to resolve > cyclic dependency between rte_ethdev.h and rte_ethdev_trace_fp.h. > > Signed-off-by: Ankur Dwivedi > --- > lib/ethdev/ethdev_private.c| 5 + > lib/ethdev/ethdev_trace_points.c | 193 + > lib/ethdev/meson.build | 1 + > lib/ethdev/rte_ethdev.c| 235 +--- > lib/ethdev/rte_ethdev.h| 2 +- > lib/ethdev/rte_ethdev_trace.h | 285 + > lib/ethdev/rte_ethdev_trace_fp.h | 279 +++- > lib/ethdev/rte_ethdev_trace_fp_burst.h | 44 > lib/ethdev/version.map | 66 ++ > 9 files changed, 1075 insertions(+), 35 deletions(-) > create mode 100644 lib/ethdev/rte_ethdev_trace_fp_burst.h > Acked-by: Sunil Kumar Kori > diff --git a/lib/ethdev/ethdev_private.c b/lib/ethdev/ethdev_private.c > index 48090c879a..fd16b25e55 100644 > --- a/lib/ethdev/ethdev_private.c > +++ b/lib/ethdev/ethdev_private.c > @@ -5,6 +5,7 @@ > #include > > #include "rte_ethdev.h" > +#include "rte_ethdev_trace_fp.h" > #include "ethdev_driver.h" > #include "ethdev_private.h" > > @@ -297,6 +298,8 @@ rte_eth_call_rx_callbacks(uint16_t port_id, uint16_t > queue_id, > cb = cb->next; > } > > + rte_eth_trace_call_rx_callbacks(port_id, queue_id, rx_pkts, nb_rx, > nb_pkts); > + > return nb_rx; > } > > @@ -312,6 +315,8 @@ rte_eth_call_tx_callbacks(uint16_t port_id, uint16_t > queue_id, > cb = cb->next; > } > > + rte_eth_trace_call_tx_callbacks(port_id, queue_id, tx_pkts, nb_pkts); > + > return nb_pkts; > } > > diff --git a/lib/ethdev/ethdev_trace_points.c > b/lib/ethdev/ethdev_trace_points.c > index 2919409a15..4fea76e0ff 100644 > --- a/lib/ethdev/ethdev_trace_points.c > +++ b/lib/ethdev/ethdev_trace_points.c > @@ -5,6 +5,7 @@ > #include > > #include > +#include > > RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_configure, > lib.ethdev.configure) > @@ -29,3 +30,195 @@ > RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_rx_burst, > > RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_tx_burst, > lib.ethdev.tx.burst) > + > +RTE_TRACE_POINT_REGISTER(rte_eth_trace_call_rx_callbacks, > + lib.ethdev.call_rx_callbacks) > + > +RTE_TRACE_POINT_REGISTER(rte_eth_trace_call_tx_callbacks, > + lib.ethdev.call_tx_callbacks) > + > +RTE_TRACE_POINT_REGISTER(rte_eth_trace_iterator_init, > + lib.ethdev.iterator_init) > + > +RTE_TRACE_POINT_REGISTER(rte_eth_trace_iterator_next, > + lib.ethdev.iterator_next) > + > +RTE_TRACE_POINT_REGISTER(rte_eth_trace_iterator_cleanup, > + lib.ethdev.iterator_
RE: [PATCH v5 3/6] ethdev: add trace points for remaining functions
> -Original Message- > From: Ankur Dwivedi > Sent: Thursday, January 12, 2023 4:52 PM > To: dev@dpdk.org > Cc: tho...@monjalon.net; david.march...@redhat.com; m...@ashroe.eu; > or...@nvidia.com; ferruh.yi...@amd.com; ch...@att.com; > humi...@huawei.com; linvi...@tuxdriver.com; ciara.lof...@intel.com; > qi.z.zh...@intel.com; m...@semihalf.com; m...@semihalf.com; > shaib...@amazon.com; evge...@amazon.com; igo...@amazon.com; > cha...@amd.com; Igor Russkikh ; > shepard.sie...@atomicrules.com; ed.cz...@atomicrules.com; > john.mil...@atomicrules.com; ajit.khapa...@broadcom.com; > somnath.ko...@broadcom.com; Jerin Jacob Kollanukkaran > ; Maciej Czekaj [C] ; Shijith > Thotton ; Srisivasubramanian Srinivasan > ; Harman Kalra ; > rahul.lakkire...@chelsio.com; johnd...@cisco.com; hyon...@cisco.com; > liudongdo...@huawei.com; yisen.zhu...@huawei.com; > xuanziya...@huawei.com; cloud.wangxiao...@huawei.com; > zhouguoy...@huawei.com; simei...@intel.com; wenjun1...@intel.com; > qiming.y...@intel.com; yuying.zh...@intel.com; beilei.x...@intel.com; > xiao.w.w...@intel.com; jingjing...@intel.com; junfeng@intel.com; > rosen...@intel.com; Nithin Kumar Dabilpuram > ; Kiran Kumar Kokkilagadda > ; Sunil Kumar Kori ; Satha > Koteswara Rao Kottidi ; Liron Himi > ; z...@semihalf.com; Radha Chintakuntla > ; Veerasenareddy Burru ; > Sathesh B Edara ; ma...@nvidia.com; > viachesl...@nvidia.com; lon...@microsoft.com; spin...@cesnet.cz; > chaoyong...@corigine.com; niklas.soderl...@corigine.com; > hemant.agra...@nxp.com; sachin.sax...@oss.nxp.com; g.si...@nxp.com; > apeksha.gu...@nxp.com; sachin.sax...@nxp.com; abo...@pensando.io; > Rasesh Mody ; Shahed Shaikh > ; Devendra Singh Rawat > ; andrew.rybche...@oktetlabs.ru; > jiawe...@trustnetic.com; jianw...@trustnetic.com; > jbehr...@vmware.com; maxime.coque...@redhat.com; > chenbo@intel.com; steven.webs...@windriver.com; > matt.pet...@windriver.com; bruce.richard...@intel.com; > mtetsu...@gmail.com; gr...@u256.net; jasvinder.si...@intel.com; > cristian.dumitre...@intel.com; jgraj...@cisco.com; > m...@smartsharesystems.com; Ankur Dwivedi > Subject: [PATCH v5 3/6] ethdev: add trace points for remaining functions > > Adds trace points for remaining ethdev functions. > > Signed-off-by: Ankur Dwivedi > --- > lib/ethdev/ethdev_trace_points.c | 252 +++ > lib/ethdev/rte_ethdev.c | 476 ++- > lib/ethdev/rte_ethdev_cman.c | 30 +- > lib/ethdev/rte_ethdev_trace.h| 529 +++ > lib/ethdev/rte_ethdev_trace_fp.h | 342 > lib/ethdev/version.map | 81 + > 6 files changed, 1622 insertions(+), 88 deletions(-) > Why can't this patch be part of [PATCH v5 2/6] ? > diff --git a/lib/ethdev/ethdev_trace_points.c > b/lib/ethdev/ethdev_trace_points.c > index 4fea76e0ff..102a18fcc1 100644 > --- a/lib/ethdev/ethdev_trace_points.c > +++ b/lib/ethdev/ethdev_trace_points.c > @@ -222,3 +222,255 @@ > RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_set_rx_queue_stats_mappin > g, > > RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_fw_version_get, > lib.ethdev.fw_version_get) > + > +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_info_get, > + lib.ethdev.info_get) > + > +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_conf_get, > + lib.ethdev.conf_get) > + > +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_get_supported_ptypes, > + lib.ethdev.get_supported_ptypes) > + > +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_set_ptypes, > + lib.ethdev.set_ptypes) > + > +RTE_TRACE_POINT_REGISTER(rte_eth_trace_macaddrs_get, > + lib.ethdev.macaddrs_get) > + > +RTE_TRACE_POINT_REGISTER(rte_eth_trace_macaddr_get, > + lib.ethdev.macaddr_get) > + > +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_get_mtu, > + lib.ethdev.get_mtu) > + > +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_set_mtu, > + lib.ethdev.set_mtu) > + > +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_vlan_filter, > + lib.ethdev.vlan_filter) > + > +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_set_vlan_strip_on_queue, > + lib.ethdev.set_vlan_strip_on_queue) > + > +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_set_vlan_ether_type, > + lib.ethdev.set_vlan_ether_type) > + > +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_set_vlan_offload, > + lib.ethdev.set_vlan_offload) > + > +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_get_vlan_offload, > + lib.ethdev.get_vlan_offload) > + > +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_set_vlan_pvid, > + lib.ethdev.set_vlan_pvid) > + > +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_flow_ctrl_get, > + lib.ethdev.flow_ctrl_get) > + > +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_flow_ctrl_set, > + lib.ethdev.flow_ctrl_set) > + > +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_priority_flow_ctrl_set, > + lib.ethdev.priority_flow_ctrl_set) > + > +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_priority_flow_ctrl_queue_i > nfo_get, > + lib.ethdev.priority_flow_ctrl_queue_info_get) > + > +RTE_TRACE_POINT_REGISTER(r
RE: [PATCH v5 1/6] eal: trace: add trace point emit for blob
One more observation that the size of lib.eal.generic.blob trace point is 31962 bytes. Is this trace point this much big or some bug ? > -Original Message- > From: Sunil Kumar Kori > Sent: Thursday, January 12, 2023 10:00 PM > To: Ankur Dwivedi ; dev@dpdk.org > Cc: tho...@monjalon.net; david.march...@redhat.com; m...@ashroe.eu; > or...@nvidia.com; ferruh.yi...@amd.com; ch...@att.com; > humi...@huawei.com; linvi...@tuxdriver.com; ciara.lof...@intel.com; > qi.z.zh...@intel.com; m...@semihalf.com; m...@semihalf.com; > shaib...@amazon.com; evge...@amazon.com; igo...@amazon.com; > cha...@amd.com; Igor Russkikh ; > shepard.sie...@atomicrules.com; ed.cz...@atomicrules.com; > john.mil...@atomicrules.com; ajit.khapa...@broadcom.com; > somnath.ko...@broadcom.com; Jerin Jacob Kollanukkaran > ; Maciej Czekaj [C] ; Shijith > Thotton ; Srisivasubramanian Srinivasan > ; Harman Kalra ; > rahul.lakkire...@chelsio.com; johnd...@cisco.com; hyon...@cisco.com; > liudongdo...@huawei.com; yisen.zhu...@huawei.com; > xuanziya...@huawei.com; cloud.wangxiao...@huawei.com; > zhouguoy...@huawei.com; simei...@intel.com; wenjun1...@intel.com; > qiming.y...@intel.com; yuying.zh...@intel.com; beilei.x...@intel.com; > xiao.w.w...@intel.com; jingjing...@intel.com; junfeng@intel.com; > rosen...@intel.com; Nithin Kumar Dabilpuram > ; Kiran Kumar Kokkilagadda > ; Satha Koteswara Rao Kottidi > ; Liron Himi ; > z...@semihalf.com; Radha Chintakuntla ; > Veerasenareddy Burru ; Sathesh B Edara > ; ma...@nvidia.com; viachesl...@nvidia.com; > lon...@microsoft.com; spin...@cesnet.cz; chaoyong...@corigine.com; > niklas.soderl...@corigine.com; hemant.agra...@nxp.com; > sachin.sax...@oss.nxp.com; g.si...@nxp.com; apeksha.gu...@nxp.com; > sachin.sax...@nxp.com; abo...@pensando.io; Rasesh Mody > ; Shahed Shaikh ; Devendra > Singh Rawat ; andrew.rybche...@oktetlabs.ru; > jiawe...@trustnetic.com; jianw...@trustnetic.com; > jbehr...@vmware.com; maxime.coque...@redhat.com; > chenbo@intel.com; steven.webs...@windriver.com; > matt.pet...@windriver.com; bruce.richard...@intel.com; > mtetsu...@gmail.com; gr...@u256.net; jasvinder.si...@intel.com; > cristian.dumitre...@intel.com; jgraj...@cisco.com; > m...@smartsharesystems.com; Ankur Dwivedi > Subject: RE: [PATCH v5 1/6] eal: trace: add trace point emit for blob > > > -Original Message- > > From: Ankur Dwivedi > > Sent: Thursday, January 12, 2023 4:52 PM > > To: dev@dpdk.org > > Cc: tho...@monjalon.net; david.march...@redhat.com; > m...@ashroe.eu; > > or...@nvidia.com; ferruh.yi...@amd.com; ch...@att.com; > > humi...@huawei.com; linvi...@tuxdriver.com; ciara.lof...@intel.com; > > qi.z.zh...@intel.com; m...@semihalf.com; m...@semihalf.com; > > shaib...@amazon.com; evge...@amazon.com; igo...@amazon.com; > > cha...@amd.com; Igor Russkikh ; > > shepard.sie...@atomicrules.com; ed.cz...@atomicrules.com; > > john.mil...@atomicrules.com; ajit.khapa...@broadcom.com; > > somnath.ko...@broadcom.com; Jerin Jacob Kollanukkaran > > ; Maciej Czekaj [C] ; Shijith > > Thotton ; Srisivasubramanian Srinivasan > > ; Harman Kalra ; > > rahul.lakkire...@chelsio.com; johnd...@cisco.com; hyon...@cisco.com; > > liudongdo...@huawei.com; yisen.zhu...@huawei.com; > > xuanziya...@huawei.com; cloud.wangxiao...@huawei.com; > > zhouguoy...@huawei.com; simei...@intel.com; wenjun1...@intel.com; > > qiming.y...@intel.com; yuying.zh...@intel.com; beilei.x...@intel.com; > > xiao.w.w...@intel.com; jingjing...@intel.com; junfeng@intel.com; > > rosen...@intel.com; Nithin Kumar Dabilpuram > ; > > Kiran Kumar Kokkilagadda ; Sunil Kumar Kori > > ; Satha Koteswara Rao Kottidi > > ; Liron Himi ; > > z...@semihalf.com; Radha Chintakuntla ; > > Veerasenareddy Burru ; Sathesh B Edara > > ; ma...@nvidia.com; viachesl...@nvidia.com; > > lon...@microsoft.com; spin...@cesnet.cz; chaoyong...@corigine.com; > > niklas.soderl...@corigine.com; hemant.agra...@nxp.com; > > sachin.sax...@oss.nxp.com; g.si...@nxp.com; apeksha.gu...@nxp.com; > > sachin.sax...@nxp.com; abo...@pensando.io; Rasesh Mody > > ; Shahed Shaikh ; > Devendra > > Singh Rawat ; > andrew.rybche...@oktetlabs.ru; > > jiawe...@trustnetic.com; jianw...@trustnetic.com; > jbehr...@vmware.com; > > maxime.coque...@redhat.com; chenbo@intel.com; > > steven.webs...@windriver.com; matt.pet...@windriver.com; > > bruce.richard...@intel.com; mtetsu...@gmail.com; gr...@u256.net; > > jasvinder.si...@intel.com; cristian.dumitre...@intel.com; > > jgraj...@cisco.com; m...@smartsharesystems.com; Ankur Dwivedi > > > > Subject: [PATCH v5 1/6] eal: trace: add trace point emit for blob > > > > Adds a trace point emit function for emitting a blob. The maximum blob > > bytes which can be captured is maximum value contained in uint16_t, > > which is 65535. > > > > Also adds test case for emit array tracepoint function. > > > > Signed-off-by: Ankur Dwivedi > > --- > > app/test/test_trace.c | 5 + > > lib/eal/common/eal_common_trace_points.c | 2 ++ > > lib/eal/incl
RE: [EXT] Re: [PATCH] crypto/qat: fix build
> 12/01/2023 17:16, De Lara Guarch, Pablo: > > From: Thomas Monjalon > > > 12/01/2023 14:22, De Lara Guarch, Pablo: > > > > Hi Thomas, > > > > > > > > From: Thomas Monjalon > > > > > 12/01/2023 11:32, Ji, Kai: > > > > > > Ok, a long story short, this issue should only occurred when > > > > > RTE_QAT_LIBIPSECMB is enabled. > > > > > > It was intend to remove Openssl lib dependency in QAT replaced > > > > > > with ipsec_mb lib, but the work was partially done due to > > > > > > limitation of ipsec_mb by the time (FIPS certification) > > > > > > > > > > > > I'm happy with current fix and please cc: sta...@dpdk.org > > > > > > > > > > I'm not happy with this fix. It is a dirty workaround. > > > > > It would be better to have an #ifdef in ipsec_mb. > > > > > > > > > > Also I would like an answer to the question below. What triggered this > > > error? > > > > > Is it a new thing in the lib ipsec_mb? > > > > > Why defining AES_BLOCK_SIZE while IMB_AES_BLOCK_SIZE can be used > > > and > > > > > have a proper prefix? > > > > > > > > Apologies for the late response. > > > > > > > > This macro was renamed to IMB_AES_BLOCK_SIZE, as you already know. > > > > The problem is that, for compatibility reasons, we had to keep the old > > > macro as well. > > > > However, we added a compile time flag to remove these legacy macros, > > > > for exactly this reason (NO_COMPAT_IMB_API_053). > > > > > > > > I think a solution could be to use this flag in QAT, so the legacy > > > > macros are > > > not defined. > > > > > > > > I will send a patch to fix this. > > > > > > OK good, so we can reject this patch? > > > > > > > Well, this patch is merged already, but mine will revert it and add the new > > flag > > (pointing at the other commit to be fixed), so that should be OK, right? > > The patch was merged in the crypto tree but we can discard it. > Akhil, please remove this patch from your tree, thanks. > Done.
Re: [PATCH v5 0/6] add trace points in ethdev library
On 1/12/2023 11:21 AM, Ankur Dwivedi wrote: > This series adds trace points for functions in the ethdev library. > The trace points are added in ethdev, flow, mtr and tm files. > > v5: > - The rte_trace_point_emit_char_array function is renamed to >rte_trace_point_emit_blob. With this function an array of >any length upto 65535 bytes can be captured. >For example, the following is the ctf metadata created to display >a mac addr array in rte_eth_trace_macaddr_get(): >struct { > ... > uint16_t len; > uint8_t mac_addr_addr_bytes[len]; >}; > - Added additional test cases for rte_eal_trace_generic_blob >test case. > - Capturing of return value of a function is added to tracepoint >for flow, mtr and tm patches. > - In ehdev patch (1/6), removed extra line. Also added rx_pkts and >tx_pkts pointer in trace point. > > v4: > - Adds tracepoint function to emit char array. Also adds the >test case. > - Resolved review comments on "ethdev: add trace point" patch. >This patch is divided into 2 patches to minimize per patch >size. > - From the earlier version (v3), few tracepoints in ethdev, >flow, mtr, tm are made as fast path tracepoints. For the >tracepoint which i was unsure, i have made it as fastpath. >All the fast path tracepoints can be found in >rte_ethdev_trace_fp.h and rte_ethdev_trace_fp_burst.h. >All the slow path tracepoints can be found in rte_ethdev_trace.h. > - Capturing of return value is added to tracepoint in ethdev. >For flow, mtr and tm these changes are still yet to bde done. >Will do it in the next versions. > - Moved the trace functions from INTERNAL to EXPERIMENTAL in >version.map. > > v3: > - Moved the trace functions from EXPERIMENTAL to INTERNAL in >version.map. > - Moved trace functions call to the end, in ethdev and flow trace. > - Added code to print the input value of features in >rte_eth_trace_rx_metadata_negotiate(). > - Added code to capture return value in flow trace. > > Ankur Dwivedi (6): > eal: trace: add trace point emit for blob > ethdev: add trace points for ethdev > ethdev: add trace points for remaining functions > ethdev: add trace points for flow > ethdev: add trace points for mtr > ethdev: add trace points for tm Hi Ankur, Build seems failing with set, can you please check: https://mails.dpdk.org/archives/test-report/2023-January/339696.html I can reproduce build failures via 32bit and debugoptimized builds.
Re: [RFC PATCH 1/1] build: increase minimum C standard for DPDK builds
On Thu, Jan 12, 2023 at 11:35:56AM +, Bruce Richardson wrote: > Set the default C language standard to be used for DPDK builds to C99. > This requires no actual code changes to build successfully. > > To ensure compatibility is kept for external apps using DPDK headers, we > explicitly set the build parameters for the chkincs binary to the old > minimum standard of "gnu89". [NOTE: DPDK code does not compile and has > previously not compiled for pure c89 standard, so that stricter > requirement need not be checked.] By adding this additional check, we > can separately manage C standards used internally in DPDK builds and > that required in the build flags for external apps using DPDK. > > Signed-off-by: Bruce Richardson > --- > buildtools/chkincs/meson.build | 1 + > meson.build| 1 + > 2 files changed, 2 insertions(+) > > diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build > index 378c2f19ef..322ac775ce 100644 > --- a/buildtools/chkincs/meson.build > +++ b/buildtools/chkincs/meson.build > @@ -30,6 +30,7 @@ executable('chkincs', sources, > c_args: cflags, > include_directories: includes, > dependencies: deps, > +override_options: 'c_std=gnu89', > install: false) > > # run tests for c++ builds also > diff --git a/meson.build b/meson.build > index f91d652bc5..9a2963cc16 100644 > --- a/meson.build > +++ b/meson.build > @@ -9,6 +9,7 @@ project('DPDK', 'C', > license: 'BSD', > default_options: [ > 'buildtype=release', > +'c_std=c99', > 'default_library=static', > 'warning_level=2', > ], subject to the atomics abstraction proposal where a meson option is provided enable_stdatomics=true we'll want to be able to upgrade to -std=c11 / c_std=c11 (as a minimum). is there a meson mechanism that will let us evaluate that condition and specify the higher required standard version in default_options or is it a matter of some post project() or is this just done by adding -std=c11 using add_project_arguments() after project()? second, i think you will run into a build break with this change on some platform / compiler combinations. somewhere we are using strerror_r where the required posix versions are not specified in the translation unit worked around by using c_std=gnu99 or by adding appropriate undef GNUC etc.. in the place where strerror_r is used. (just something i noticed when testing a similar change during prototyping i think ubuntu 22.04?) going one step further i'd just ask that the default options be "portable" i.e. they work with ! gcc and ! clang to help me with future work. though i know that contradicts with my advice in the previous paragraph, maybe we can set c_std=xxx subject to toolchain/platform? Acked-by: Tyler Retzlaff
[PATCH v3 0/9] Standardize telemetry int types
Rather than having 64-bit unsigned types and 32-bit signed types supported by the telemetry lib, we should support 64-bit values for both types. On the naming side, since both are 64-bit, we should no longer call the unsigned value u64 - "uint" is better. This patchset implements these changes as far as is possible while still keeping API and ABI compatibility. * Internal structures and functions are updated to use 64-bit ints * Internal functions are renamed from u64 to uint * Public enum values are renamed from u64 to uint, and a macro is added to ensure that older code still compiles * The public add_*_int functions are changed to take a 64-bit value rather than a 32-bit one. Since this would be an ABI break, we use function versioning to ensure older code still calls into a wrapper function which takes a 32-bit value. The patchset also contains a couple of other small cleanups to the telemetry code that were seen in passing when making these changes - removing RTE_ prefix on internal enums, and simplifying the init of the the array of data types. NOTE: the renaming of the u64 functions to uint is split across 3 patches in this set - patches 4,5 and 6. This is to make it easier to review and to avoid warnings about new functions not being marked initially as experimental. Some/all of these 3 can be combined on merge if so desired. V3: - fix build issues due to missing a driver code change - fix spelling issue flagged by checkpatch V2: - added additional patches to replace the old function calls within DPDK code, something missed in RFC version - added new patch to make the renamed/new functions immediately public allowing us to mark the original named versions as deprecated - re-ordered patches within the sit, so the extra cleanup changes come first Bruce Richardson (9): telemetry: remove RTE prefix from internal enum values telemetry: make array initialization more robust telemetry: rename unsigned 64-bit enum value to uint telemetry: add uint type as alias for u64 global: rename telemetry functions to newer versions telemetry: mark old names of renamed fns as deprecated telemetry: update json functions to use int/uint in names telemetry: make internal int representation 64-bits telemetry: change public API to use 64-bit signed values app/test/test_telemetry_data.c | 22 ++--- app/test/test_telemetry_json.c | 9 +- doc/guides/rel_notes/deprecation.rst | 5 ++ drivers/common/cnxk/roc_platform.h | 4 +- drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c | 24 ++--- drivers/net/cnxk/cnxk_ethdev_telemetry.c | 6 +- examples/ipsec-secgw/ipsec-secgw.c | 72 +++ examples/l3fwd-power/main.c | 4 +- lib/cryptodev/rte_cryptodev.c| 6 +- lib/dmadev/rte_dmadev.c | 2 +- lib/eal/common/eal_common_memory.c | 19 ++-- lib/ethdev/rte_ethdev.c | 12 +-- lib/ethdev/sff_telemetry.c | 2 +- lib/eventdev/rte_event_eth_rx_adapter.c | 22 ++--- lib/eventdev/rte_event_timer_adapter.c | 38 lib/eventdev/rte_eventdev.c | 5 +- lib/ipsec/ipsec_telemetry.c | 33 +++ lib/rawdev/rte_rawdev.c | 4 +- lib/security/rte_security.c | 8 +- lib/telemetry/meson.build| 1 + lib/telemetry/rte_telemetry.h| 51 +-- lib/telemetry/telemetry.c| 56 ++-- lib/telemetry/telemetry_data.c | 95 ++-- lib/telemetry/telemetry_data.h | 24 +++-- lib/telemetry/telemetry_json.h | 16 ++-- lib/telemetry/version.map| 9 ++ 26 files changed, 325 insertions(+), 224 deletions(-) -- 2.37.2
[PATCH v3 1/9] telemetry: remove RTE prefix from internal enum values
To better distinguish which values are public and which are internal remove the "RTE_" prefix off the internal enum defining the container types. Signed-off-by: Bruce Richardson Acked-by: Morten Brørup Acked-by: Tyler Retzlaff --- lib/ethdev/sff_telemetry.c | 2 +- lib/telemetry/telemetry.c | 36 +++--- lib/telemetry/telemetry_data.c | 40 +- lib/telemetry/telemetry_data.h | 14 ++-- 4 files changed, 46 insertions(+), 46 deletions(-) diff --git a/lib/ethdev/sff_telemetry.c b/lib/ethdev/sff_telemetry.c index ca6d196560..5923350424 100644 --- a/lib/ethdev/sff_telemetry.c +++ b/lib/ethdev/sff_telemetry.c @@ -96,7 +96,7 @@ ssf_add_dict_string(struct rte_tel_data *d, const char *name_str, const char *va { struct tel_dict_entry *e = &d->data.dict[d->data_len]; - if (d->type != RTE_TEL_DICT) + if (d->type != TEL_DICT) return; if (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES) { RTE_ETHDEV_LOG(ERR, "data_len has exceeded the maximum number of inserts\n"); diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c index 8fbb4f3060..792b4e12b6 100644 --- a/lib/telemetry/telemetry.c +++ b/lib/telemetry/telemetry.c @@ -167,27 +167,27 @@ container_to_json(const struct rte_tel_data *d, char *out_buf, size_t buf_len) size_t used = 0; unsigned int i; - if (d->type != RTE_TEL_DICT && d->type != RTE_TEL_ARRAY_U64 && - d->type != RTE_TEL_ARRAY_INT && d->type != RTE_TEL_ARRAY_STRING) + if (d->type != TEL_DICT && d->type != TEL_ARRAY_U64 && + d->type != TEL_ARRAY_INT && d->type != TEL_ARRAY_STRING) return snprintf(out_buf, buf_len, "null"); used = rte_tel_json_empty_array(out_buf, buf_len, 0); - if (d->type == RTE_TEL_ARRAY_U64) + if (d->type == TEL_ARRAY_U64) for (i = 0; i < d->data_len; i++) used = rte_tel_json_add_array_u64(out_buf, buf_len, used, d->data.array[i].u64val); - if (d->type == RTE_TEL_ARRAY_INT) + if (d->type == TEL_ARRAY_INT) for (i = 0; i < d->data_len; i++) used = rte_tel_json_add_array_int(out_buf, buf_len, used, d->data.array[i].ival); - if (d->type == RTE_TEL_ARRAY_STRING) + if (d->type == TEL_ARRAY_STRING) for (i = 0; i < d->data_len; i++) used = rte_tel_json_add_array_string(out_buf, buf_len, used, d->data.array[i].sval); - if (d->type == RTE_TEL_DICT) + if (d->type == TEL_DICT) for (i = 0; i < d->data_len; i++) { const struct tel_dict_entry *v = &d->data.dict[i]; switch (v->type) { @@ -245,15 +245,15 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) buf_len = sizeof(out_buf) - prefix_used - 1; /* space for '}' */ switch (d->type) { - case RTE_TEL_NULL: + case TEL_NULL: used = strlcpy(cb_data_buf, "null", buf_len); break; - case RTE_TEL_STRING: + case TEL_STRING: used = rte_tel_json_str(cb_data_buf, buf_len, 0, d->data.str); break; - case RTE_TEL_DICT: + case TEL_DICT: used = rte_tel_json_empty_obj(cb_data_buf, buf_len, 0); for (i = 0; i < d->data_len; i++) { const struct tel_dict_entry *v = &d->data.dict[i]; @@ -291,26 +291,26 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) } break; - case RTE_TEL_ARRAY_STRING: - case RTE_TEL_ARRAY_INT: - case RTE_TEL_ARRAY_U64: - case RTE_TEL_ARRAY_CONTAINER: + case TEL_ARRAY_STRING: + case TEL_ARRAY_INT: + case TEL_ARRAY_U64: + case TEL_ARRAY_CONTAINER: used = rte_tel_json_empty_array(cb_data_buf, buf_len, 0); for (i = 0; i < d->data_len; i++) - if (d->type == RTE_TEL_ARRAY_STRING) + if (d->type == TEL_ARRAY_STRING) used = rte_tel_json_add_array_string( cb_data_buf, buf_len, used, d->data.array[i].sval); - else if (d->type == RTE_TEL_ARRAY_INT) + else if (d->type == TEL_ARRAY_INT) used = rte_tel_json_add_array_int(cb_data_buf, buf_len, used, d->data.array[i].ival); - else if (d->type == RTE
[PATCH v3 2/9] telemetry: make array initialization more robust
Rather than relying on a specific ordering of elements in the array matching that of elements in the enum definition, we can explicitly mark each array entry using the equivalent enum value as an index. Signed-off-by: Bruce Richardson Acked-by: Morten Brørup Acked-by: Tyler Retzlaff --- lib/telemetry/telemetry_data.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c index 76fae720e3..3f5ef3979b 100644 --- a/lib/telemetry/telemetry_data.c +++ b/lib/telemetry/telemetry_data.c @@ -16,10 +16,10 @@ int rte_tel_data_start_array(struct rte_tel_data *d, enum rte_tel_value_type type) { enum tel_container_types array_types[] = { - TEL_ARRAY_STRING, /* RTE_TEL_STRING_VAL = 0 */ - TEL_ARRAY_INT,/* RTE_TEL_INT_VAL = 1 */ - TEL_ARRAY_U64,/* RTE_TEL_U64_VAL = 2 */ - TEL_ARRAY_CONTAINER, /* RTE_TEL_CONTAINER = 3 */ + [RTE_TEL_STRING_VAL] = TEL_ARRAY_STRING, + [RTE_TEL_INT_VAL] = TEL_ARRAY_INT, + [RTE_TEL_U64_VAL] = TEL_ARRAY_U64, + [RTE_TEL_CONTAINER] = TEL_ARRAY_CONTAINER, }; d->type = array_types[type]; d->data_len = 0; -- 2.37.2