[PATCH v4 04/18] net/r8169: implement core logic for Tx/Rx
Add RX/TX function prototypes for further datapath development. Signed-off-by: Howard Wang --- drivers/net/r8169/meson.build| 1 + drivers/net/r8169/r8169_ethdev.c | 17 ++ drivers/net/r8169/r8169_ethdev.h | 3 ++ drivers/net/r8169/r8169_rxtx.c | 56 4 files changed, 77 insertions(+) create mode 100644 drivers/net/r8169/r8169_rxtx.c diff --git a/drivers/net/r8169/meson.build b/drivers/net/r8169/meson.build index 918156fbc8..08c3858387 100644 --- a/drivers/net/r8169/meson.build +++ b/drivers/net/r8169/meson.build @@ -4,4 +4,5 @@ sources = files( 'r8169_ethdev.c', 'r8169_hw.c', + 'r8169_rxtx.c', ) diff --git a/drivers/net/r8169/r8169_ethdev.c b/drivers/net/r8169/r8169_ethdev.c index a5de322c9a..50bab46f8e 100644 --- a/drivers/net/r8169/r8169_ethdev.c +++ b/drivers/net/r8169/r8169_ethdev.c @@ -27,6 +27,8 @@ #include "r8169_ethdev.h" #include "r8169_base.h" +#include "r8169_logs.h" +#include "r8169_hw.h" static int rtl_dev_configure(struct rte_eth_dev *dev __rte_unused); static int rtl_dev_start(struct rte_eth_dev *dev); @@ -68,10 +70,23 @@ rtl_dev_start(struct rte_eth_dev *dev) { struct rtl_adapter *adapter = RTL_DEV_PRIVATE(dev); struct rtl_hw *hw = &adapter->hw; + int err; + + /* Initialize transmission unit */ + rtl_tx_init(dev); + + /* This can fail when allocating mbufs for descriptor rings */ + err = rtl_rx_init(dev); + if (err) { + PMD_INIT_LOG(ERR, "Unable to initialize RX hardware"); + goto error; + } hw->adapter_stopped = 0; return 0; +error: + return -EIO; } /* @@ -117,6 +132,8 @@ rtl_dev_init(struct rte_eth_dev *dev) struct rtl_hw *hw = &adapter->hw; dev->dev_ops = &rtl_eth_dev_ops; + dev->tx_pkt_burst = &rtl_xmit_pkts; + dev->rx_pkt_burst = &rtl_recv_pkts; /* For secondary processes, the primary process has done all the work */ if (rte_eal_process_type() != RTE_PROC_PRIMARY) diff --git a/drivers/net/r8169/r8169_ethdev.h b/drivers/net/r8169/r8169_ethdev.h index 0639bb0230..6979a50970 100644 --- a/drivers/net/r8169/r8169_ethdev.h +++ b/drivers/net/r8169/r8169_ethdev.h @@ -35,6 +35,9 @@ struct rtl_adapter { #define RTL_DEV_PRIVATE(eth_dev) \ ((struct rtl_adapter *)((eth_dev)->data->dev_private)) +int rtl_rx_init(struct rte_eth_dev *dev); +int rtl_tx_init(struct rte_eth_dev *dev); + uint16_t rtl_xmit_pkts(void *txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); uint16_t rtl_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts); diff --git a/drivers/net/r8169/r8169_rxtx.c b/drivers/net/r8169/r8169_rxtx.c new file mode 100644 index 00..f370d8e349 --- /dev/null +++ b/drivers/net/r8169/r8169_rxtx.c @@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Realtek Corporation. All rights reserved + */ + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "r8169_ethdev.h" +#include "r8169_hw.h" +#include "r8169_logs.h" + +/* -RX-- */ +int +rtl_rx_init(struct rte_eth_dev *dev) +{ + return 0; +} + +uint16_t +rtl_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) +{ + return 0; +} + +/* -TX-- */ +int +rtl_tx_init(struct rte_eth_dev *dev) +{ + return 0; +} + +uint16_t +rtl_xmit_pkts(void *txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) +{ + return 0; +} -- 2.34.1
Re: [PATCH] event/cnxk: fix getwork write data on reconfig
On Tue, Oct 22, 2024 at 9:29 PM wrote: > > From: Pavan Nikhilesh > > Update getwork write data on device reconfiguration > to avoid working with stale configuration. > > Fixes: acc65ee307f7 ("eventdev: introduce event pre-scheduling") > > Signed-off-by: Pavan Nikhilesh Applied to dpdk-next-net-eventdev/for-main. Thanks
Re: [PATCH v4 01/22] event/cnxk: use stdatomic API
On Wed, Oct 23, 2024 at 1:05 AM wrote: > > From: Pavan Nikhilesh > > Replace gcc inbuilt __atomic_xxx intrinsics with rte_atomic_xxx API. > > Signed-off-by: Pavan Nikhilesh > --- > Depends-on: series-33602 ("event/cnxk: fix getwork write data on reconfig") Some reason CI not ran due to this depends. Merged this this patch, Please resend to make CI run. Furthermore, in the release note update, please cnxk update after DSW PMD.
[PATCH 3/6] common/dpaax: use prefetch macros
Prefer EAL macros over __builtin_ helpers. Signed-off-by: David Marchand --- drivers/common/dpaax/compat.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/common/dpaax/compat.h b/drivers/common/dpaax/compat.h index cbabc1588b..7c8d82c2b2 100644 --- a/drivers/common/dpaax/compat.h +++ b/drivers/common/dpaax/compat.h @@ -30,6 +30,7 @@ #include #include #include + #include #include #include @@ -37,6 +38,7 @@ #include #include #include +#include /* The following definitions are primarily to allow the single-source driver * interfaces to be included by arbitrary program code. Ie. for interfaces that @@ -142,8 +144,8 @@ static inline void out_be32(volatile void *__p, u32 val) #define hwsync() rte_rmb() #define lwsync() rte_wmb() -#define dcbt_ro(p) __builtin_prefetch(p, 0) -#define dcbt_rw(p) __builtin_prefetch(p, 1) +#define dcbt_ro(p) rte_prefetch0(p) +#define dcbt_rw(p) rte_prefetch0_write(p) #if defined(RTE_ARCH_ARM) #if defined(RTE_ARCH_64) -- 2.46.2
[PATCH v28 05/13] eal: do not duplicate rte_init_alert() messages
The message already goes through logging, and does not need to be printed on stderr. Message level should be ALERT to match function name. Signed-off-by: Stephen Hemminger Acked-by: Tyler Retzlaff Acked-by: Morten Brørup Acked-by: Bruce Richardson Acked-by: Chengwen Feng --- lib/eal/freebsd/eal.c | 3 +-- lib/eal/linux/eal.c | 3 +-- lib/eal/windows/eal.c | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c index d3b40e81d8..7b974608e4 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -529,8 +529,7 @@ rte_eal_iopl_init(void) static void rte_eal_init_alert(const char *msg) { - fprintf(stderr, "EAL: FATAL: %s\n", msg); - EAL_LOG(ERR, "%s", msg); + EAL_LOG(ALERT, "%s", msg); } /* Launch threads, called at application init(). */ diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index 40d750ed0d..c53a051405 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -830,8 +830,7 @@ rte_eal_iopl_init(void) static void rte_eal_init_alert(const char *msg) { - fprintf(stderr, "EAL: FATAL: %s\n", msg); - EAL_LOG(ERR, "%s", msg); + EAL_LOG(ALERT, "%s", msg); } /* diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c index a77e590a72..93f099a968 100644 --- a/lib/eal/windows/eal.c +++ b/lib/eal/windows/eal.c @@ -181,7 +181,6 @@ sync_func(void *arg __rte_unused) static void rte_eal_init_alert(const char *msg) { - fprintf(stderr, "EAL: FATAL: %s\n", msg); EAL_LOG(ERR, "%s", msg); } -- 2.45.2
[PATCH v28 09/13] log: add hook for printing log messages
This is useful for when decorating log output for console or journal. Provide basic version in this patch. Signed-off-by: Stephen Hemminger Acked-by: Morten Brørup Acked-by: Bruce Richardson Acked-by: Chengwen Feng --- lib/log/log.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/log/log.c b/lib/log/log.c index feadcd6848..5e1eeb25c7 100644 --- a/lib/log/log.c +++ b/lib/log/log.c @@ -30,16 +30,21 @@ struct rte_log_dynamic_type { uint32_t loglevel; }; +/* Note: same as vfprintf() */ +typedef int (*log_print_t)(FILE *f, const char *fmt, va_list ap); + /** The rte_log structure. */ static struct rte_logs { uint32_t type; /**< Bitfield with enabled logs. */ uint32_t level; /**< Log level. */ FILE *file; /**< Output file set by rte_openlog_stream, or NULL. */ + log_print_t print_func; size_t dynamic_types_len; struct rte_log_dynamic_type *dynamic_types; } rte_logs = { .type = UINT32_MAX, .level = RTE_LOG_DEBUG, + .print_func = vfprintf, }; struct rte_eal_opt_loglevel { @@ -76,6 +81,7 @@ int rte_openlog_stream(FILE *f) { rte_logs.file = f; + rte_logs.print_func = vfprintf; return 0; } @@ -472,7 +478,7 @@ rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap) RTE_PER_LCORE(log_cur_msg).loglevel = level; RTE_PER_LCORE(log_cur_msg).logtype = logtype; - ret = vfprintf(f, format, ap); + ret = (*rte_logs.print_func)(f, format, ap); fflush(f); return ret; } -- 2.45.2
[PATCH v2] net/ice: fix incorrect reading of PHY timestamp
In ICE PMD, previously the ready bitmap checking before reading PHY timestamp was not present. This caused incorrect Tx timestamping. The ready bitmap checking is enabled and PHY timestamp is read once the ready bitmap gives positive value. Fixes: 881169950d80 ("net/ice/base: implement initial PTP support for E830") Cc: sta...@dpdk.org Signed-off-by: Soumyadeep Hore --- drivers/net/ice/ice_ethdev.c | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 7b1bd163a2..e0db47cf28 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -6517,12 +6517,28 @@ ice_timesync_read_tx_timestamp(struct rte_eth_dev *dev, struct ice_adapter *ad = ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); uint8_t lport; - uint64_t ts_ns, ns, tstamp; + uint64_t ts_ns, ns, tstamp, tstamp_ready = 0; + uint64_t start_time, curr_time; const uint64_t mask = 0x; int ret; lport = hw->port_info->lport; + start_time = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000); + + while (!(tstamp_ready & BIT_ULL(0))) { + ret = ice_get_phy_tx_tstamp_ready(hw, lport, &tstamp_ready); + if (ret) { + PMD_DRV_LOG(ERR, "Failed to get phy ready for timestamp"); + return -1; + } + curr_time = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000); + if (curr_time - start_time > 1000) { + PMD_DRV_LOG(ERR, "Timeout to get phy ready for timestamp"); + return -1; + } + } + ret = ice_read_phy_tstamp(hw, lport, 0, &tstamp); if (ret) { PMD_DRV_LOG(ERR, "Failed to read phy timestamp"); -- 2.43.0
[PATCH v3 1/6] vhost: fix VDUSE device creation error handling
This patch fixes missing reconnection log unmapping miss in the error path at VDUSE creation time. Coverity issue: 445525 Fixes: da79cc7fda76 ("vhost: add reconnection support to VDUSE") Signed-off-by: Maxime Coquelin --- lib/vhost/vduse.c | 27 +++ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c index f9ac317438..4bb309e441 100644 --- a/lib/vhost/vduse.c +++ b/lib/vhost/vduse.c @@ -485,10 +485,9 @@ vduse_device_create(const char *path, bool compliant_ol_flags) struct virtio_net_config vnet_config = {{ 0 }}; uint64_t ver = VHOST_VDUSE_API_VERSION; uint64_t features; - struct vduse_dev_config *dev_config = NULL; const char *name = path + strlen("/dev/vduse/"); char reconnect_file[PATH_MAX]; - struct vhost_reconnect_data *reconnect_log = NULL; + struct vhost_reconnect_data *reconnect_log = MAP_FAILED; bool reconnect = false; if (vduse.fdset == NULL) { @@ -530,13 +529,13 @@ vduse_device_create(const char *path, bool compliant_ol_flags) ret = rte_vhost_driver_get_features(path, &features); if (ret < 0) { VHOST_CONFIG_LOG(name, ERR, "Failed to get backend features"); - goto out_free; + goto out_ctrl_close; } ret = rte_vhost_driver_get_queue_num(path, &max_queue_pairs); if (ret < 0) { VHOST_CONFIG_LOG(name, ERR, "Failed to get max queue pairs"); - goto out_free; + goto out_ctrl_close; } VHOST_CONFIG_LOG(path, INFO, "VDUSE max queue pairs: %u", max_queue_pairs); @@ -584,7 +583,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags) "Features mismatch between backend (0x%" PRIx64 ") & reconnection file (0x%" PRIx64 ")", features, reconnect_log->features); ret = -1; - goto out_ctrl_close; + goto out_log_unmap; } if (reconnect_log->nr_vrings != total_queues) { @@ -592,9 +591,11 @@ vduse_device_create(const char *path, bool compliant_ol_flags) "Queues number mismatch between backend (%u) and reconnection file (%u)", total_queues, reconnect_log->nr_vrings); ret = -1; - goto out_ctrl_close; + goto out_log_unmap; } } else { + struct vduse_dev_config *dev_config; + reco_fd = open(reconnect_file, O_CREAT | O_EXCL | O_RDWR, 0600); if (reco_fd < 0) { if (errno == EEXIST) { @@ -633,7 +634,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags) if (!dev_config) { VHOST_CONFIG_LOG(name, ERR, "Failed to allocate VDUSE config"); ret = -1; - goto out_ctrl_close; + goto out_log_unmap; } vnet_config.max_virtqueue_pairs = max_queue_pairs; @@ -649,16 +650,16 @@ vduse_device_create(const char *path, bool compliant_ol_flags) memcpy(dev_config->config, &vnet_config, sizeof(vnet_config)); ret = ioctl(control_fd, VDUSE_CREATE_DEV, dev_config); + free(dev_config); + dev_config = NULL; if (ret < 0) { VHOST_CONFIG_LOG(name, ERR, "Failed to create VDUSE device: %s", strerror(errno)); - goto out_free; + goto out_log_unmap; } memcpy(&reconnect_log->config, &vnet_config, sizeof(vnet_config)); reconnect_log->nr_vrings = total_queues; - free(dev_config); - dev_config = NULL; } dev_fd = open(path, O_RDWR); @@ -693,6 +694,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags) dev->vduse_ctrl_fd = control_fd; dev->vduse_dev_fd = dev_fd; dev->reconnect_log = reconnect_log; + reconnect_log = MAP_FAILED; if (reconnect) dev->status = dev->reconnect_log->status; @@ -768,8 +770,9 @@ vduse_device_create(const char *path, bool compliant_ol_flags) if (dev_fd >= 0) close(dev_fd); ioctl(control_fd, VDUSE_DESTROY_DEV, name); -out_free: - free(dev_config); +out_log_unmap: + if (reconnect_log != MAP_FAILED) + munmap(reconnect_log, sizeof(*reconnect_log)); out_ctrl_close: close(control_fd); -- 2.46.2
Re: [PATCH] ixgbe: Removed FreeBSD forcing wait in ixgbe_dev_link_update_share()
On Tue, Oct 22, 2024 at 09:16:55AM -0700, Stephen Hemminger wrote: > On Tue, 22 Oct 2024 09:42:05 -0500 > l...@perftech.com wrote: > > > From: Lewis Donzis > > > > Forcing wait true prevents checking link status without delay, because the > > function will wait more than 10 seconds for link status to be true. > > > > Signed-off-by: Lewis Donzis > > Looks correct, driver seems to be trying to work around slow SFP link > detection. > > Acked-by: Stephen Hemminger Applied to dpdk-next-net-intel Thanks, /Bruce
RE: [PATCH v4] ethdev: TEST support single queue per port
> From: Stephen Hemminger [mailto:step...@networkplumber.org] > Sent: Thursday, 24 October 2024 18.42 > > On Thu, 24 Oct 2024 14:55:50 + > Morten Brørup wrote: > > > diff --git a/drivers/net/bnxt/bnxt_ethdev.c > b/drivers/net/bnxt/bnxt_ethdev.c > > index 1f7c0d77d5..f34a953ecd 100644 > > --- a/drivers/net/bnxt/bnxt_ethdev.c > > +++ b/drivers/net/bnxt/bnxt_ethdev.c > > @@ -842,6 +842,8 @@ static int bnxt_alloc_prev_ring_stats(struct bnxt > *bp) > > return -ENOMEM; > > } > > > > +#pragma GCC push_options > > +#pragma GCC optimize("no-peel-loops") > > static int bnxt_start_nic(struct bnxt *bp) > > { > > struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(bp->eth_dev); > > @@ -1006,6 +1008,7 @@ static int bnxt_start_nic(struct bnxt *bp) > > > > return rc; > > } > > +#pragma GCC pop_options > > What is the warning, The warning is about access at offset beyond the array. It seems the optimizer loop unrolls or something similar, not realizing the array only has one entry. And then it warns when it realizes afterwards. > I hate pragma's they are technical debt. Me too. The CI shows that clang doesn't have this problem, only GCC. But we should to be able to build DPDK with only one queue per port, to conserve memory.
Re: [PATCH] net/ixgbe: fix per-queue stats for less queues
On Thu, Oct 24, 2024 at 06:28:27PM +0200, Morten Brørup wrote: > > > > - for (i = 0; i < IXGBE_QUEUE_STAT_COUNTERS; i++) { > > > > + for (i = 0; i < RTE_MIN(IXGBE_QUEUE_STAT_COUNTERS, > > > > + > > > > (typeof(IXGBE_QUEUE_STAT_COUNTERS))RTE_ETHDEV_QUEUE_STAT_CNTRS); > > > > i++) { > > > > The big cast using "typeof" is awkward-looking but is probably the best > > way > > to do this! > > Yes. It fixes a signed/unsigned comparison warning. > > RTE_ETHDEV_QUEUE_STAT_CNTRS is int, "i" is unsigned, and > IXGBE_QUEUE_STAT_COUNTERS is size_t. > > Not easy choosing a good common type without adding an explanation. The > typeof() seemed like an acceptable compromise. > If I may suggest it, "typeof(i)" is shorter :-)
Re: [PATCH v3] bus/pci: don't open uio device in secondary process
On Fri, Oct 11, 2024 at 1:17 PM Konrad Sztyber wrote: > > The uio_pci_generic driver clears the bus master bit when the device > file is closed. So, when the secondary process terminates after probing > a device, that device becomes unusable in the primary process. > > To avoid that, the device file is now opened only in the primary process > and the secondary gets it over UNIX domain socket via SCM_RIGHTS. > > Fixes: 847d78fb9530 ("bus/pci: fix FD in secondary process") > Cc: sta...@dpdk.org > > Signed-off-by: Konrad Sztyber Recheck-request: rebase=main,iol-compile-amd64-testing -- David Marchand
Re: [PATCH] eal: support including mapped memory in core dump
2024-10-24 23:54 (UTC+0300), Dmitry Kozlyuk: > 2024-10-24 09:38 (UTC-0700), Stephen Hemminger: > > Having a process set a system global value like coredump_filter via an > > internal > > call seems like a potential problem. What about other processes on the > > system? > > It may not even be allowed if using a hardened kernel. > > > > I would prefer that madvise() be used, and document the required change to > > coredump_filter. > > /proc/self/coredump_filter affects only the process and its children. > madvise() done on hugepages will be ignored unless this bit is set. > So this must be done, and it seems convenient to require no user interaction. > If changing /proc/self/coredump_filter is disallowed, > EAL startup will fail and the user will have to go the way you described. > So the current solution: > - is convenient for a typical case > - is still usable in a hypothetical hardening case > > On FreeBSD, including hugepages in core dump will require a global setting. > There I've been planning to go your way and have the user configure it, > because it is impossible to restrict to one process. On the second thought, why block or enforce anything at startup; it is more flexible if we allow the user to enable dumping hugepages at whatever moment they wish, including prior to startup. This series would then become purely documentation for Linux and similar + a bit of code for FreeBSD.
[PATCH v4 10/18] net/r8169: add link status and interrupt management
Signed-off-by: Howard Wang --- drivers/net/r8169/r8169_base.h | 5 +- drivers/net/r8169/r8169_ethdev.c | 278 ++- drivers/net/r8169/r8169_ethdev.h | 3 + drivers/net/r8169/r8169_hw.c | 8 +- drivers/net/r8169/r8169_hw.h | 3 + drivers/net/r8169/r8169_phy.c| 121 ++ drivers/net/r8169/r8169_phy.h| 3 + 7 files changed, 412 insertions(+), 9 deletions(-) diff --git a/drivers/net/r8169/r8169_base.h b/drivers/net/r8169/r8169_base.h index cf95dd7061..69c769db7f 100644 --- a/drivers/net/r8169/r8169_base.h +++ b/drivers/net/r8169/r8169_base.h @@ -380,6 +380,7 @@ enum RTL_register_content { /* PHY status */ PowerSaveStatus = 0x80, + _5000bpsF = 0x1000, _2500bpsF = 0x400, TxFlowCtrl = 0x40, RxFlowCtrl = 0x20, @@ -553,10 +554,6 @@ enum RTL_chipset_name { #define ADVERTISE_5000_HALF 0x0100 /* NOT used, just FYI */ #define ADVERTISE_5000_FULL 0x0200 -#define RTL8126_ALL_SPEED_DUPLEX (ADVERTISE_10_HALF | ADVERTISE_10_FULL | \ - ADVERTISE_100_HALF | ADVERTISE_100_FULL | ADVERTISE_1000_FULL | \ - ADVERTISE_2500_FULL | ADVERTISE_5000_FULL) - #define MAC_ADDR_LENRTE_ETHER_ADDR_LEN static inline u32 diff --git a/drivers/net/r8169/r8169_ethdev.c b/drivers/net/r8169/r8169_ethdev.c index ea8d855ef0..85781f70e4 100644 --- a/drivers/net/r8169/r8169_ethdev.c +++ b/drivers/net/r8169/r8169_ethdev.c @@ -35,6 +35,9 @@ static int rtl_dev_start(struct rte_eth_dev *dev); static int rtl_dev_stop(struct rte_eth_dev *dev); static int rtl_dev_reset(struct rte_eth_dev *dev); static int rtl_dev_close(struct rte_eth_dev *dev); +static int rtl_dev_link_update(struct rte_eth_dev *dev, int wait __rte_unused); +static int rtl_dev_set_link_up(struct rte_eth_dev *dev); +static int rtl_dev_set_link_down(struct rte_eth_dev *dev); /* * The set of PCI devices this driver supports @@ -53,6 +56,10 @@ static const struct eth_dev_ops rtl_eth_dev_ops = { .dev_stop = rtl_dev_stop, .dev_close= rtl_dev_close, .dev_reset= rtl_dev_reset, + .dev_set_link_up = rtl_dev_set_link_up, + .dev_set_link_down= rtl_dev_set_link_down, + + .link_update = rtl_dev_link_update, }; static int @@ -61,6 +68,118 @@ rtl_dev_configure(struct rte_eth_dev *dev __rte_unused) return 0; } +static void +rtl_disable_intr(struct rtl_hw *hw) +{ + PMD_INIT_FUNC_TRACE(); + RTL_W32(hw, IMR0_8125, 0x); + RTL_W32(hw, ISR0_8125, RTL_R32(hw, ISR0_8125)); +} + +static void +rtl_enable_intr(struct rtl_hw *hw) +{ + PMD_INIT_FUNC_TRACE(); + RTL_W32(hw, IMR0_8125, LinkChg); +} + +static int +_rtl_setup_link(struct rte_eth_dev *dev) +{ + struct rtl_adapter *adapter = RTL_DEV_PRIVATE(dev); + struct rtl_hw *hw = &adapter->hw; + u64 adv = 0; + u32 *link_speeds = &dev->data->dev_conf.link_speeds; + + /* Setup link speed and duplex */ + if (*link_speeds == RTE_ETH_LINK_SPEED_AUTONEG) { + rtl_set_link_option(hw, AUTONEG_ENABLE, SPEED_5000, DUPLEX_FULL, rtl_fc_full); + } else if (*link_speeds != 0) { + if (*link_speeds & ~(RTE_ETH_LINK_SPEED_10M_HD | RTE_ETH_LINK_SPEED_10M | +RTE_ETH_LINK_SPEED_100M_HD | RTE_ETH_LINK_SPEED_100M | +RTE_ETH_LINK_SPEED_1G | RTE_ETH_LINK_SPEED_2_5G | +RTE_ETH_LINK_SPEED_5G | RTE_ETH_LINK_SPEED_FIXED)) + goto error_invalid_config; + + if (*link_speeds & RTE_ETH_LINK_SPEED_10M_HD) { + hw->speed = SPEED_10; + hw->duplex = DUPLEX_HALF; + adv |= ADVERTISE_10_HALF; + } + if (*link_speeds & RTE_ETH_LINK_SPEED_10M) { + hw->speed = SPEED_10; + hw->duplex = DUPLEX_FULL; + adv |= ADVERTISE_10_FULL; + } + if (*link_speeds & RTE_ETH_LINK_SPEED_100M_HD) { + hw->speed = SPEED_100; + hw->duplex = DUPLEX_HALF; + adv |= ADVERTISE_100_HALF; + } + if (*link_speeds & RTE_ETH_LINK_SPEED_100M) { + hw->speed = SPEED_100; + hw->duplex = DUPLEX_FULL; + adv |= ADVERTISE_100_FULL; + } + if (*link_speeds & RTE_ETH_LINK_SPEED_1G) { + hw->speed = SPEED_1000; + hw->duplex = DUPLEX_FULL; + adv |= ADVERTISE_1000_FULL; + } + if (*link_speeds & RTE_ETH_LINK_SPEED_2_5G) { + hw->speed = SPEED_2500; + hw->duplex = DUPLEX_FULL; + adv |= ADVERTISE_2500_FULL; +
Re: [PATCH v5 2/9] raw/cnxk_rvu_lf: add API to get NPA/SSO pffunc
On Thu, Oct 24, 2024 at 7:00 PM Akhil Goyal wrote: > For all patches, please change subject to raw/cnxk_rvu_lf: support ... > + > +#include > + > +/** > + * @file cnxk_rvu_lf_driver.h > + * > + * Marvell RVU LF raw PMD specific structures and interface > + * > + * This API allows external driver/application to manage RVU LF device > + * in user space along with installing interrupt handlers for low latency > signal processing. I think, we can change as “This API allows out of tree driver to manage RVU LF device”
[PATCH v28 03/13] windows: update os shim
Windows does not have localtime_r but it does have a similar function that can be used instead. Use rte_os_shim.h in lib/log instead of redefine of strdup. Signed-off-by: Stephen Hemminger Acked-by: Tyler Retzlaff Acked-by: Morten Brørup Acked-by: Bruce Richardson Acked-by: Chengwen Feng --- lib/eal/windows/include/rte_os_shim.h | 10 ++ lib/log/log.c | 7 +++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/eal/windows/include/rte_os_shim.h b/lib/eal/windows/include/rte_os_shim.h index eda8113662..665c9ac93b 100644 --- a/lib/eal/windows/include/rte_os_shim.h +++ b/lib/eal/windows/include/rte_os_shim.h @@ -110,4 +110,14 @@ rte_clock_gettime(clockid_t clock_id, struct timespec *tp) } #define clock_gettime(clock_id, tp) rte_clock_gettime(clock_id, tp) +static inline struct tm * +rte_localtime_r(const time_t *timep, struct tm *result) +{ + if (localtime_s(result, timep) == 0) + return result; + else + return NULL; +} +#define localtime_r(timep, result) rte_localtime_r(timep, result) + #endif /* _RTE_OS_SHIM_ */ diff --git a/lib/log/log.c b/lib/log/log.c index 255f757d94..7416c82b34 100644 --- a/lib/log/log.c +++ b/lib/log/log.c @@ -14,13 +14,12 @@ #include #include - -#include "log_internal.h" - #ifdef RTE_EXEC_ENV_WINDOWS -#define strdup _strdup +#include #endif +#include "log_internal.h" + struct rte_log_dynamic_type { const char *name; uint32_t loglevel; -- 2.45.2
[PATCH] net/ixgbe: fix per-queue stats for less queues
Remove the requirement that the configured number of queues to provide statistics for (RTE_ETHDEV_QUEUE_STAT_CNTRS) cannot be less than the driver's max supported number of the same (IXGBE_QUEUE_STAT_COUNTERS). Signed-off-by: Morten Brørup --- drivers/net/ixgbe/ixgbe_ethdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index ab37c37469..895d6e7169 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -3385,7 +3385,8 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) stats->opackets = hw_stats->gptc; stats->obytes = hw_stats->gotc; - for (i = 0; i < IXGBE_QUEUE_STAT_COUNTERS; i++) { + for (i = 0; i < RTE_MIN(IXGBE_QUEUE_STAT_COUNTERS, + (typeof(IXGBE_QUEUE_STAT_COUNTERS))RTE_ETHDEV_QUEUE_STAT_CNTRS); i++) { stats->q_ipackets[i] = hw_stats->qprc[i]; stats->q_opackets[i] = hw_stats->qptc[i]; stats->q_ibytes[i] = hw_stats->qbrc[i]; -- 2.43.0
Re: [PATCH v2 4/6] vhost: refactor VDUSE reconnection log mapping
On Thu, Oct 24, 2024 at 9:54 AM Maxime Coquelin wrote: > - goto out_ctrl_close; > - } > - > - reconnect_log = mmap(NULL, sizeof(*reconnect_log), PROT_READ > | PROT_WRITE, > - MAP_SHARED, reco_fd, 0); > - close(reco_fd); > - if (reconnect_log == MAP_FAILED) { > - VHOST_CONFIG_LOG(name, ERR, "Failed to mmap reconnect > file %s (%s)", > - reconnect_file, strerror(errno)); > - ret = -1; > + VHOST_CONFIG_LOG(name, ERR, "Failed to create > reconnect log file"); You missed removing this one. That's just a rebase issue, since patch 6 will remove it. > goto out_ctrl_close; > } -- David Marchand
Re: [PATCH v2 1/1] dma/cnxk: support dma queue priority configuration
On Mon, Oct 21, 2024 at 6:29 PM Vamsi Krishna wrote: > > From: Vamsi Attunuru > > Allow configuration of DPI DMA queue priority through > mailbox request. > > Signed-off-by: Vamsi Attunuru Please update the release note for this new feature in the PMD section.
Re: [PATCH] test/event: fix device stop
On Tue, Oct 22, 2024 at 5:33 PM wrote: > > From: Pavan Nikhilesh > > Fix missing event device stop after finishing the > test case. > > Fixes: acc65ee307f7 ("eventdev: introduce event pre-scheduling") > > Signed-off-by: Pavan Nikhilesh Applied to dpdk-next-net-eventdev/for-main. Thanks
[PATCH v4 8/9] raw/cnxk_rvu_lf: add API to get BAR addresses
Added rte_pmd_rvu_lf_bar_get() API to get BAR address for application to configure hardware. Signed-off-by: Akhil Goyal --- doc/guides/rawdevs/cnxk_rvu_lf.rst | 7 ++ drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c| 24 drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h | 18 +++ drivers/raw/cnxk_rvu_lf/version.map | 1 + 4 files changed, 50 insertions(+) diff --git a/doc/guides/rawdevs/cnxk_rvu_lf.rst b/doc/guides/rawdevs/cnxk_rvu_lf.rst index 51e1c58b69..a972654f82 100644 --- a/doc/guides/rawdevs/cnxk_rvu_lf.rst +++ b/doc/guides/rawdevs/cnxk_rvu_lf.rst @@ -73,3 +73,10 @@ and provides an opaque pointer for a response and its length. PF and VF application can define its own request and response based on the message id of the mailbox. For sample usage of the APIs, please refer to ``rvu_lf_rawdev_selftest()``. + +Get BAR addresses +- + +Application can retrieve PCI BAR addresses of the device using the API +``rte_pmd_rvu_lf_bar_get()``. This helps application to configure the +registers of the hardware device. diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c index 156b9460c1..3a3971ecd3 100644 --- a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c +++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c @@ -103,6 +103,30 @@ rte_pmd_rvu_lf_irq_unregister(uint8_t dev_id, unsigned int irq, return roc_rvu_lf_irq_unregister(roc_rvu_lf, irq, (roc_rvu_lf_intr_cb_fn)cb, data); } +int +rte_pmd_rvu_lf_bar_get(uint8_t dev_id, uint8_t bar_num, size_t *va, size_t *mask) +{ + struct roc_rvu_lf *roc_rvu_lf; + struct rte_rawdev *rawdev; + + rawdev = rte_rawdev_pmd_get_dev(dev_id); + if (rawdev == NULL) + return -EINVAL; + + roc_rvu_lf = (struct roc_rvu_lf *)rawdev->dev_private; + + if (bar_num > PCI_MAX_RESOURCE || + (roc_rvu_lf->pci_dev->mem_resource[bar_num].addr == NULL)) { + *va = 0; + *mask = 0; + return -ENOTSUP; + } + *va = (size_t)(roc_rvu_lf->pci_dev->mem_resource[bar_num].addr); + *mask = (size_t)(roc_rvu_lf->pci_dev->mem_resource[bar_num].len - 1); + + return 0; +} + uint16_t rte_pmd_rvu_lf_npa_pf_func_get(void) { diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h index 22978f89af..922c852592 100644 --- a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h +++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h @@ -191,6 +191,24 @@ __rte_internal int rte_pmd_rvu_lf_msg_process(uint8_t dev_id, uint16_t vf, uint16_t msg_id, void *req, uint16_t req_len, void *rsp, uint16_t rsp_len); +/** + * Get BAR addresses for the RVU LF device. + * + * @param dev_id + * device id of RVU LF device + * @param bar_num + * BAR number for which address is required + * @param[out] va + *Virtual address of the BAR. 0 if not mapped + * @param[out] mask + *BAR address mask, 0 if not mapped + * + * @return + * Returns 0 on success, negative error code otherwise + */ +__rte_internal +int rte_pmd_rvu_lf_bar_get(uint8_t dev_id, uint8_t bar_num, size_t *va, size_t *mask); + #ifdef __cplusplus } #endif diff --git a/drivers/raw/cnxk_rvu_lf/version.map b/drivers/raw/cnxk_rvu_lf/version.map index aa974f629e..012f05d1e4 100644 --- a/drivers/raw/cnxk_rvu_lf/version.map +++ b/drivers/raw/cnxk_rvu_lf/version.map @@ -1,6 +1,7 @@ INTERNAL { global: + rte_pmd_rvu_lf_bar_get; rte_pmd_rvu_lf_irq_register; rte_pmd_rvu_lf_irq_unregister; rte_pmd_rvu_lf_msg_handler_register; -- 2.25.1
Tech Board Meeting Minutes - Sept. 23, 2024
Attendees - Aaron Conole Bruce Richardson David Marchand Hemant Agrawal Honnappa Nagarahalli Kevin Traynor Konstantin Ananyev Maxime Coquelin Morten Brorup Robin Jarry Stephen Hemminger Thomas Monjalon Notes - The Tech Board met at a f2f session in Montreal, prior to the DPDK Summit. This meeting went much longer than a typical Tech Board meeting. Agenda -- * Prep. for the summit ** Make sure people helping to monitor live stream know what they are doing ** Discussion about board q&a ** Discussion about workshops ** Will need people to help do leading at the workshop sessions * Code challenge ** Idea: identify and promote tools to help detect issues early *** Tech board needs to give some guidance for this effort, since it isn't well known how to move forward. *** Does it have some CI component? Can't just turn it on unless everything is passing, otherwise it will put expected failures. ** Idea: offer some rewards for these efforts *** What kinds of rewards to offer? ** Idea: can we also hire someone? * Events discussion ** Techboard doesn't have much transparency on how the decision for venue, location, etc. is chosen. *** Ex: reasoning for venues and locations isn't well known *** Ex: Montreal had difficult visa process which resulted in some missed in-person attendance. ** Techboard would like to be able to give some input on the process *** Ex: hotels for the events have been costly ** We would like some of the maintainers to also be sponsored for attendance: *** David Marchand *** Akhil Goyal *** Ferruh Yigit ** Remote / hybrid speaking is going to have to be a way of life. We should reconsider the remote spoeaker statuses. We needed to scramble at the last minute to accommodate remote speakers. *** We also want to continue to give preference to in-person. ** Awards, gifts, etc. *** We used to give awards for different areas, and we would like to return to doing that. *** We want to give speaker gifts, if possible. *** Maybe also do some recognition Thomas to do slides for 'hall of fame' kind of recognition to contributors. * Marketing discussion ** We aren't sure what the marketing goals are ** We feel that the marketing for the events was quite good ** Maybe we can have a session with marketing to understand what the other goals of marketing are. ** Is there a way to have marketing show the value of investing in DPDK to the users (ie: rather than just taking DPDK code and disappearing)? ** Reminder to interview with Ben during the conference * Testing ** Intel lab having issues *** Need to sync with John McNamara and others about the system *** Seems that the Intel CI is in a barely maintained state. Ex: Testing old OSes, but not newer ones, etc. *** Bruce will send a message. ** Ask for the lab to test grout *** Aaron to sync with Patrick about it ** DTS *** Basic testing for ethdev to complete by the end of this year *** What are we targeting next? Ex: maybe rte_flow? *** Need guides for how to run DTS. Maybe youtube videos? Presentation at the conference might cover some of this. More should be done - blog posts, documentation, etc. ** Testing gaps we might have *** Kernel has Syzbot fuzzer that just randomly hits APIs with garbage data to try and break things Can we have something like this in DPDK? Needs to be automated Do we need reference implementations on the behavior to test against? At least if there aren't crashes that is good. How can we implement it? ** Can we add some kind of testing initiatives to the code challenge? * Gov. Board ** We haven't gotten many meeting minutes ** We like the rotating tech board representative ** Gov. board gives initiative requests to tech board, but there aren't any kind of resources attached. *** would be good to have guarantees about spending time on these initiatives. ** Need more transparency where possible. * Tech board ** Need to do more outreach for contributions. * Feature / Bug tracking ** Make sure maintainers are on the bug database and getting mails *** They are supposed to be ** Kevin will push on bugs to come to resolution. ** Roadmap on the website is out of date *** Goal is to avoid duplicating work across organizations *** The roadmap shouldn't be used to have some feature requests, but should really show what someone is working on. *** Work needs to be tied to specific individuals. *** Need to remove any outdated details / rework the roadmap display. ** Feature requests *** are they useful? who will work on them? *** Formal feature request process might give a false hope that someone will work on something. *** Better to be on the mailing list rather than bugzilla so that others can have involvement wi
Re: [PATCH] mbuf: add transport mode ESP packet type
>>And we definitely need RTE_PTYPE_INNER_L4_ESP for ESP over UDP support. >Isn't this already taken care when mbuf->packet_type = >(RTE_PTYPE_L4_UDP | RTE_PTYPE_TUNNEL_ESP) ? This is ambigous. And both UDP and ESP are L4 headers, which can lead to the undefined behavior when we specify both of them. They are mutually exclusive in our hardware, for example. That is why we have RTE_PTYPE_TUNNEL_MPLS_IN_GRE and RTE_PTYPE_TUNNEL_MPLS_IN_UDP for MPLS. We could go and indroduce RTE_PTYPE_TUNNEL_ESP_IN_UDP to resolve the ambiguity, or have RTE_PTYPE_INNER_L4_ESP. I choose the second variant to have a generic way for ESP packets over any type of encapsulation.
Re: [PATCH] common/cnxk: allow enabling IOVA field in mbuf
On Mon, Oct 14, 2024 at 4:37 PM Shijith Thotton wrote: > > Value of RTE_IOVA_IN_MBUF was always disabled on cnxk platforms, as IOVA > in the mbuf is not required. This change modifies that behavior, > allowing RTE_IOVA_IN_MBUF to be enabled if the build option > -Denable_iova_as_pa=true is explicitly specified. > > Signed-off-by: Shijith Thotton > --- > > diff --git a/config/arm/meson.build b/config/arm/meson.build > index 012935d5d7..ca54524376 100644 > --- a/config/arm/meson.build > +++ b/config/arm/meson.build > @@ -439,10 +439,7 @@ soc_cn9k = { > 'description': 'Marvell OCTEON 9', > 'implementer': '0x43', > 'part_number': '0xb2', > -'numa': false, > -'flags': [ > -['RTE_IOVA_IN_MBUF', 0] > -] > +'numa': false > } > > soc_cn10k = { > @@ -451,8 +448,7 @@ soc_cn10k = { > 'flags': [ > ['RTE_MAX_LCORE', 24], > ['RTE_MAX_NUMA_NODES', 1], > -['RTE_MEMPOOL_ALIGN', 128], > -['RTE_IOVA_IN_MBUF', 0] > +['RTE_MEMPOOL_ALIGN', 128] > ], > 'part_number': '0xd49', > 'extra_march_features': ['crypto'], > diff --git a/drivers/common/cnxk/meson.build b/drivers/common/cnxk/meson.build > index dc2ddf1f20..bba780e750 100644 > --- a/drivers/common/cnxk/meson.build > +++ b/drivers/common/cnxk/meson.build > @@ -108,4 +108,13 @@ deps += ['bus_pci', 'net', 'telemetry'] > > require_iova_in_mbuf = false > > +cnxk_socs = ['cn9k', 'cn10k', 'cn20k'] > + > +# Enable RTE_IOVA_IN_MBUF only if enable_iova_as_pa is set explicitly, else > disable it > +if meson.version().version_compare('>=1.1.0') > +if '-Denable_iova_as_pa' not in meson.build_options() and soc_type in > cnxk_socs > +dpdk_conf.set10('RTE_IOVA_IN_MBUF', false) > +endif > +endif Since this is added in driver/common/cnxk, it will be late to decide. For example, Following PMDs will have mis match: common - cpt, dpaax, idpf, ionic bus - cdx, dpaa, fslmc, ifpga, uacce I think, this check needs to move up in the chain. @Richardson, Bruce Any thoughts on cleanly adding this kind of check in top-level meson objects? > + > annotate_locks = false > -- > 2.25.1 >
[PATCH] net/vmxnet3: support per-queue stats for less queues
Remove the requirement that the configured number of queues to provide statistics for (RTE_ETHDEV_QUEUE_STAT_CNTRS) cannot be less than the driver's max number of supported transmit queues (VMXNET3_MAX_TX_QUEUES). Signed-off-by: Morten Brørup --- drivers/net/vmxnet3/vmxnet3_ethdev.c | 32 +--- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 78fac63ab6..8a9bb452c6 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -1470,42 +1470,52 @@ vmxnet3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) struct vmxnet3_hw *hw = dev->data->dev_private; struct UPT1_TxStats txStats; struct UPT1_RxStats rxStats; + uint64_t packets, bytes; VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS); for (i = 0; i < hw->num_tx_queues; i++) { vmxnet3_tx_stats_get(hw, i, &txStats); - stats->q_opackets[i] = txStats.ucastPktsTxOK + + packets = txStats.ucastPktsTxOK + txStats.mcastPktsTxOK + txStats.bcastPktsTxOK; - stats->q_obytes[i] = txStats.ucastBytesTxOK + + bytes = txStats.ucastBytesTxOK + txStats.mcastBytesTxOK + txStats.bcastBytesTxOK; - stats->opackets += stats->q_opackets[i]; - stats->obytes += stats->q_obytes[i]; + stats->opackets += packets; + stats->obytes += bytes; stats->oerrors += txStats.pktsTxError + txStats.pktsTxDiscard; + + if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) { + stats->q_opackets[i] = packets; + stats->q_obytes[i] = bytes; + } } for (i = 0; i < hw->num_rx_queues; i++) { vmxnet3_rx_stats_get(hw, i, &rxStats); - stats->q_ipackets[i] = rxStats.ucastPktsRxOK + + packets = rxStats.ucastPktsRxOK + rxStats.mcastPktsRxOK + rxStats.bcastPktsRxOK; - stats->q_ibytes[i] = rxStats.ucastBytesRxOK + + bytes = rxStats.ucastBytesRxOK + rxStats.mcastBytesRxOK + rxStats.bcastBytesRxOK; - stats->ipackets += stats->q_ipackets[i]; - stats->ibytes += stats->q_ibytes[i]; - - stats->q_errors[i] = rxStats.pktsRxError; + stats->ipackets += packets; + stats->ibytes += bytes; stats->ierrors += rxStats.pktsRxError; stats->imissed += rxStats.pktsRxOutOfBuf; + + if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) { + stats->q_ipackets[i] = packets; + stats->q_ibytes[i] = bytes; + stats->q_errors[i] = rxStats.pktsRxError; + } } return 0; @@ -1521,8 +1531,6 @@ vmxnet3_dev_stats_reset(struct rte_eth_dev *dev) VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS); - RTE_BUILD_BUG_ON(RTE_ETHDEV_QUEUE_STAT_CNTRS < VMXNET3_MAX_TX_QUEUES); - for (i = 0; i < hw->num_tx_queues; i++) { vmxnet3_hw_tx_stats_get(hw, i, &txStats); memcpy(&hw->snapshot_tx_stats[i], &txStats, -- 2.43.0
[PATCH v28 00/13] Logging subsystem improvements
Improvements and unification of logging library. This version works on all platforms: Linux, Windows and FreeBSD. This is update to rework patch set. It adds several new features to the console log output. * Putting a timestamp on console output which is useful for analyzing performance of startup codes. Timestamp is optional and must be enabled on command line. * Displaying console output with colors. It uses the standard conventions used by many other Linux commands for colorized display. The default is to enable color if the console output is going to a terminal. But it can be always on or disabled by command line flag. This default was chosen based on what dmesg(1) command does. Color is used by many tools (vi, iproute2, git) because it is helpful; DPDK drivers and libraries print lots of not very useful messages. And having error messages highlighted in bold face helps. This might also get users to pay more attention to error messages. Many bug reports have earlier messages that are lost because there are so many info messages. * Add support for automatic detection of systemd journal protocol. If running as systemd service will get enhanced logging. * Use of syslog is optional and the meaning of the --syslog flag has changed. The default is *not* to use unless requested. Add myself as maintainer for log because by now have added more than previous authors. v28 - fix windows build fixup documentation around syslog consolidate syslog patches Stephen Hemminger (13): maintainers: add for log library windows: make getopt functions have const properties windows: update os shim eal: make eal_log_level_parse common eal: do not duplicate rte_init_alert() messages eal: change rte_exit() output to match rte_log() log: rework syslog handling eal: initialize log before everything else log: add hook for printing log messages log: add timestamp option log: add support for systemd journal log: colorize log output doc: add release note about log library MAINTAINERS | 1 + app/test/test_eal_flags.c | 66 - .../freebsd_gsg/freebsd_eal_parameters.rst| 27 ++ .../prog_guide/env_abstraction_layer.rst | 6 +- doc/guides/prog_guide/log_lib.rst | 57 - doc/guides/rel_notes/release_24_11.rst| 19 ++ lib/eal/common/eal_common_debug.c | 6 +- lib/eal/common/eal_common_options.c | 122 + lib/eal/common/eal_internal_cfg.h | 1 - lib/eal/common/eal_options.h | 5 + lib/eal/freebsd/eal.c | 65 ++--- lib/eal/linux/eal.c | 68 + lib/eal/windows/eal.c | 50 +--- lib/eal/windows/getopt.c | 23 +- lib/eal/windows/include/getopt.h | 8 +- lib/eal/windows/include/rte_os_shim.h | 10 + lib/log/log.c | 76 -- lib/log/log_color.c | 214 lib/log/log_freebsd.c | 12 - lib/log/log_internal.h| 22 +- lib/log/log_journal.c | 154 +++ lib/log/log_linux.c | 61 - lib/log/log_private.h | 53 lib/log/log_syslog.c | 109 lib/log/log_timestamp.c | 240 ++ lib/log/log_windows.c | 18 -- lib/log/meson.build | 12 +- lib/log/version.map | 5 +- 28 files changed, 1158 insertions(+), 352 deletions(-) create mode 100644 lib/log/log_color.c delete mode 100644 lib/log/log_freebsd.c create mode 100644 lib/log/log_journal.c delete mode 100644 lib/log/log_linux.c create mode 100644 lib/log/log_private.h create mode 100644 lib/log/log_syslog.c create mode 100644 lib/log/log_timestamp.c delete mode 100644 lib/log/log_windows.c -- 2.45.2
[PATCH v28 10/13] log: add timestamp option
When debugging driver or startup issues, it is useful to have a timestamp on each message printed. The messages in syslog already have a timestamp, but often syslog is not available during testing. There are multiple timestamp formats similar to Linux dmesg. The default is time relative since startup (when first step of logging initialization is done by constructor). Other alternative formats are delta, ctime, reltime and iso formats. Example: $ dpdk-testpmd --log-timestamp -- -i [ 0.008610] EAL: Detected CPU lcores: 8 [ 0.008634] EAL: Detected NUMA nodes: 1 [ 0.008792] EAL: Detected static linkage of DPDK [ 0.010620] EAL: Multi-process socket /var/run/dpdk/rte/mp_socket [ 0.012618] EAL: Selected IOVA mode 'VA' [ 0.016675] testpmd: No probed ethernet devices Interactive-mode selected Signed-off-by: Stephen Hemminger Acked-by: Morten Brørup Acked-by: Bruce Richardson --- app/test/test_eal_flags.c | 26 +++ doc/guides/prog_guide/log_lib.rst | 30 +++- lib/eal/common/eal_common_options.c | 14 +- lib/eal/common/eal_options.h| 2 + lib/eal/freebsd/eal.c | 6 +- lib/eal/linux/eal.c | 4 +- lib/eal/windows/eal.c | 4 +- lib/log/log.c | 5 + lib/log/log_internal.h | 9 ++ lib/log/log_private.h | 6 + lib/log/log_timestamp.c | 240 lib/log/meson.build | 1 + lib/log/version.map | 1 + 13 files changed, 341 insertions(+), 7 deletions(-) create mode 100644 lib/log/log_timestamp.c diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c index 9fcf0d56e6..e24630edde 100644 --- a/app/test/test_eal_flags.c +++ b/app/test/test_eal_flags.c @@ -1055,6 +1055,19 @@ test_misc_flags(void) const char * const argv22[] = {prgname, prefix, mp_flag, "--huge-worker-stack=512"}; + /* Try running with --log-timestamp */ + const char * const argv23[] = {prgname, prefix, mp_flag, + "--log-timestamp" }; + + /* Try running with --log-timestamp=iso */ + const char * const argv24[] = {prgname, prefix, mp_flag, + "--log-timestamp=iso" }; + + /* Try running with invalid timestamp */ + const char * const argv25[] = {prgname, prefix, mp_flag, + "--log-timestamp=invalid" }; + + /* run all tests also applicable to FreeBSD first */ if (launch_proc(argv0) == 0) { @@ -1162,6 +1175,19 @@ test_misc_flags(void) printf("Error - process did not run ok with --huge-worker-stack=size parameter\n"); goto fail; } + if (launch_proc(argv23) != 0) { + printf("Error - process did not run ok with --log-timestamp parameter\n"); + goto fail; + } + if (launch_proc(argv24) != 0) { + printf("Error - process did not run ok with --log-timestamp=iso parameter\n"); + goto fail; + } + if (launch_proc(argv25) == 0) { + printf("Error - process did run ok with --log-timestamp=invalid parameter\n"); + goto fail; + } + rmdir(hugepath_dir3); rmdir(hugepath_dir2); diff --git a/doc/guides/prog_guide/log_lib.rst b/doc/guides/prog_guide/log_lib.rst index c87830ac00..82d3b7be2b 100644 --- a/doc/guides/prog_guide/log_lib.rst +++ b/doc/guides/prog_guide/log_lib.rst @@ -57,7 +57,6 @@ For example:: Within an application, the same result can be got using the ``rte_log_set_level_pattern()`` or ``rte_log_set_level_regex()`` APIs. - Using Logging APIs to Generate Log Messages --- @@ -109,3 +108,32 @@ Throughout the cfgfile library, all logging calls are therefore of the form: CFG_LOG(ERR, "invalid comment characters %c", params->comment_character); + +Log timestamp +~ + +An optional timestamp can be added before each message +by adding the ``--log-timestamp`` option. +For example:: + + /path/to/app --log-level=lib.*:debug --log-timestamp + +Multiple timestamp alternative timestamp formats are available: + +.. csv-table:: Log time stamp format + :header: "Format", "Description", "Example" + :widths: 6, 30, 32 + + "ctime", "Unix ctime", "``[Wed Mar 20 07:26:12 2024]``" + "delta", "Offset since last", "``[<3.162373>]``" + "reltime", "Seconds since last or time if minute changed", "``[ +3.001791]`` or ``[Mar20 07:26:12]``" + "iso", "ISO-8601", "``[2024-03-20T07:26:12−07:00]``" + +To prefix all console messages with ISO format time the syntax is:: + + /path/to/app --log-timestamp=iso + +.. note:: + + Timestamp option has no effect if using syslog because the ``syslog()`` + service already does timestamping internally. diff --git a/lib/eal/comm
Re: [PATCH v4 22/42] net/af_xdp: use rte strerror
The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: sta...@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng Acked-by: Morten Brørup Acked-by: Maryam Tahhan
Re: [PATCH v2 0/7] DTS external DPDK build
Ah okay, that makes sense. Yes I'll review that ASAP On Tue, Oct 22, 2024 at 10:56 AM Luca Vizzarro wrote: > On 21/10/2024 23:39, Dean Marx wrote: > > Hi Luca, > > > > I noticed in the new version of this series the "improve statistics" > > patch was taken out, was there any reason for this? I believe Juraj > > wanted to create a feature that wrote all of the test suite/case > > summaries in a JSON/text output file, is this going to be implemented > > later or in a different format? > > Hi Dean, > > Sorry for causing confusion! Like Paul mentioned, this was split in a > different patchset by Tomáš himself in the non-RFC patchset. I haven't > had a chance to give it a good look. Once I download it, rebase, solve > merge conflicts and apply any changes (review) needed, I'll send it out. > > In the meantime do you mind providing a review to the patch that Paul > linked, so that I could also apply your comments if you have any. > > Thanks, > Luca >
Re: [PATCH v5 9/9] raw/cnxk_rvu_lf: add selftest
On Thu, 24 Oct 2024 18:47:59 +0530 Akhil Goyal wrote: > Added raw device selftest for cnxk_rvu_lf to verify > various PMD APIs. > > Signed-off-by: Akhil Goyal Missing include of rte_common.h?? ---BEGIN LOGS [Begin job log] "ubuntu-22.04-gcc-debug+doc+examples+tests" at step Build and test /home/runner/work/dpdk/dpdk/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h:162:15: error: expected ‘;’ before ‘int’ 162 | __rte_internal | ^ | ; 163 | int rte_pmd_rvu_lf_msg_id_range_set(uint8_t dev_id, uint16_t from, uint16_t to); | ~~~ /home/runner/work/dpdk/dpdk/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h:190:15: error: expected ‘;’ before ‘int’ 190 | __rte_internal | ^ | ; 191 | int rte_pmd_rvu_lf_msg_process(uint8_t dev_id, uint16_t vf, uint16_t msg_id, | ~~~ /home/runner/work/dpdk/dpdk/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h:209:15: error: expected ‘;’ before ‘int’ 209 | __rte_internal | ^ | ; 210 | int rte_pmd_rvu_lf_bar_get(uint8_t dev_id, uint8_t bar_num, size_t *va, size_t *mask); | ~~~ [3663/6471] Generating 'buildtools/chkincs/chkincs-exp.p/rte_uuid.c'. [3664/6471] Compiling C object buildtools/chkincs/chkincs.p/meson-generated_bus_uacce_driver.c.o [3665/6471] Compiling C object buildtools/chkincs/chkincs.p/meson-generated_rte_node_ip6_api.c.o [3666/6471] Compiling C object buildtools/chkincs/chkincs.p/meson-generated_bus_ifpga_driver.c.o [3667/6471] Compiling C object buildtools/chkincs/chkincs.p/meson-generated_cnxk_dma_event_dp.c.o
RE: [PATCH] net/ixgbe: fix per-queue stats for less queues
> > > - for (i = 0; i < IXGBE_QUEUE_STAT_COUNTERS; i++) { > > > + for (i = 0; i < RTE_MIN(IXGBE_QUEUE_STAT_COUNTERS, > > > + > > > (typeof(IXGBE_QUEUE_STAT_COUNTERS))RTE_ETHDEV_QUEUE_STAT_CNTRS); > > > i++) { > > The big cast using "typeof" is awkward-looking but is probably the best > way > to do this! Yes. It fixes a signed/unsigned comparison warning. RTE_ETHDEV_QUEUE_STAT_CNTRS is int, "i" is unsigned, and IXGBE_QUEUE_STAT_COUNTERS is size_t. Not easy choosing a good common type without adding an explanation. The typeof() seemed like an acceptable compromise.
RE: [PATCH v12 2/3] examples/l3fwd-power: fix data overflow when parse command line
> Many variables are 'uint32_t', like, 'pause_duration', 'scale_freq_min' > and so on. They use parse_int() to parse it from command line. > But overflow problem occurs when this function return. > > Fixes: 59f2853c4cae ("examples/l3fwd_power: add configuration options") > Cc: sta...@dpdk.org > > Signed-off-by: Huisong Li > --- Acked-by: Konstantin Ananyev > 2.22.0
[PATCH 2/4] crypto/dpaa_sec: enabling diffserv and ECN support
Enabling DIFFSERV and ECN in IPSEC proto offload descriptor. Signed-off-by: Hemant Agrawal --- drivers/crypto/dpaa_sec/dpaa_sec.c | 14 -- drivers/crypto/dpaa_sec/dpaa_sec.h | 8 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index e6ca0e6f0e..881435fdb6 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -3023,18 +3023,28 @@ dpaa_sec_set_ipsec_session(__rte_unused struct rte_cryptodev *dev, session->encap_pdb.seq_num = conf->ipsec.esn.low; } + if (ipsec_xform->options.ecn) + session->encap_pdb.options |= PDBOPTS_ESP_TECN; } else if (ipsec_xform->direction == RTE_SECURITY_IPSEC_SA_DIR_INGRESS) { - if (ipsec_xform->tunnel.type == RTE_SECURITY_IPSEC_TUNNEL_IPV4) + if (ipsec_xform->tunnel.type == RTE_SECURITY_IPSEC_TUNNEL_IPV4) { session->decap_pdb.options = sizeof(struct ip) << 16; - else + if (ipsec_xform->options.copy_df) + session->decap_pdb.options |= PDBHMO_ESP_DFV; + } else { session->decap_pdb.options = sizeof(struct rte_ipv6_hdr) << 16; + } if (ipsec_xform->options.esn) { session->decap_pdb.options |= PDBOPTS_ESP_ESN; session->decap_pdb.seq_num_ext_hi = conf->ipsec.esn.hi; session->decap_pdb.seq_num = conf->ipsec.esn.low; } + if (ipsec_xform->options.copy_dscp) + session->decap_pdb.options |= PDBHMO_ESP_DIFFSERV; + if (ipsec_xform->options.ecn) + session->decap_pdb.options |= PDBOPTS_ESP_TECN; + if (ipsec_xform->replay_win_sz) { uint32_t win_sz; win_sz = rte_align32pow2(ipsec_xform->replay_win_sz); diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.h b/drivers/crypto/dpaa_sec/dpaa_sec.h index 02e5307660..603a7d8f38 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.h +++ b/drivers/crypto/dpaa_sec/dpaa_sec.h @@ -990,6 +990,10 @@ static const struct rte_security_capability dpaa_sec_security_cap[] = { .mode = RTE_SECURITY_IPSEC_SA_MODE_TUNNEL, .direction = RTE_SECURITY_IPSEC_SA_DIR_EGRESS, .options = { + .copy_df = 1, + .copy_dscp = 1, + .dec_ttl = 1, + .ecn = 1, .esn = 1, }, .replay_win_sz_max = 128 @@ -1004,6 +1008,10 @@ static const struct rte_security_capability dpaa_sec_security_cap[] = { .mode = RTE_SECURITY_IPSEC_SA_MODE_TUNNEL, .direction = RTE_SECURITY_IPSEC_SA_DIR_INGRESS, .options = { + .copy_df = 1, + .copy_dscp = 1, + .dec_ttl = 1, + .ecn = 1, .esn = 1, }, .replay_win_sz_max = 128 -- 2.25.1
[PATCH v3] ethdev: TEST support single queue per port
Configuring one queue per port fails compilation on my system. Test to see how much it fails in CI. Signed-off-by: Morten Brørup --- v3: * Fix net/ixgbe driver. v2: * Fix net/vmxnet3 driver. --- config/rte_config.h | 4 ++-- drivers/net/ixgbe/ixgbe_ethdev.c | 3 ++- drivers/net/vmxnet3/vmxnet3_ethdev.c | 32 +--- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/config/rte_config.h b/config/rte_config.h index fd6f8a2f1a..924192c71c 100644 --- a/config/rte_config.h +++ b/config/rte_config.h @@ -65,8 +65,8 @@ #define RTE_MBUF_DEFAULT_MEMPOOL_OPS "ring_mp_mc" /* ether defines */ -#define RTE_MAX_QUEUES_PER_PORT 1024 -#define RTE_ETHDEV_QUEUE_STAT_CNTRS 16 /* max 256 */ +#define RTE_MAX_QUEUES_PER_PORT 1 /* default 1024 */ +#define RTE_ETHDEV_QUEUE_STAT_CNTRS 1 /* max 256, default 16 */ #define RTE_ETHDEV_RXTX_CALLBACKS 1 #define RTE_MAX_MULTI_HOST_CTRLS 4 diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index ab37c37469..895d6e7169 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -3385,7 +3385,8 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) stats->opackets = hw_stats->gptc; stats->obytes = hw_stats->gotc; - for (i = 0; i < IXGBE_QUEUE_STAT_COUNTERS; i++) { + for (i = 0; i < RTE_MIN(IXGBE_QUEUE_STAT_COUNTERS, + (typeof(IXGBE_QUEUE_STAT_COUNTERS))RTE_ETHDEV_QUEUE_STAT_CNTRS); i++) { stats->q_ipackets[i] = hw_stats->qprc[i]; stats->q_opackets[i] = hw_stats->qptc[i]; stats->q_ibytes[i] = hw_stats->qbrc[i]; diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 78fac63ab6..8a9bb452c6 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -1470,42 +1470,52 @@ vmxnet3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) struct vmxnet3_hw *hw = dev->data->dev_private; struct UPT1_TxStats txStats; struct UPT1_RxStats rxStats; + uint64_t packets, bytes; VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS); for (i = 0; i < hw->num_tx_queues; i++) { vmxnet3_tx_stats_get(hw, i, &txStats); - stats->q_opackets[i] = txStats.ucastPktsTxOK + + packets = txStats.ucastPktsTxOK + txStats.mcastPktsTxOK + txStats.bcastPktsTxOK; - stats->q_obytes[i] = txStats.ucastBytesTxOK + + bytes = txStats.ucastBytesTxOK + txStats.mcastBytesTxOK + txStats.bcastBytesTxOK; - stats->opackets += stats->q_opackets[i]; - stats->obytes += stats->q_obytes[i]; + stats->opackets += packets; + stats->obytes += bytes; stats->oerrors += txStats.pktsTxError + txStats.pktsTxDiscard; + + if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) { + stats->q_opackets[i] = packets; + stats->q_obytes[i] = bytes; + } } for (i = 0; i < hw->num_rx_queues; i++) { vmxnet3_rx_stats_get(hw, i, &rxStats); - stats->q_ipackets[i] = rxStats.ucastPktsRxOK + + packets = rxStats.ucastPktsRxOK + rxStats.mcastPktsRxOK + rxStats.bcastPktsRxOK; - stats->q_ibytes[i] = rxStats.ucastBytesRxOK + + bytes = rxStats.ucastBytesRxOK + rxStats.mcastBytesRxOK + rxStats.bcastBytesRxOK; - stats->ipackets += stats->q_ipackets[i]; - stats->ibytes += stats->q_ibytes[i]; - - stats->q_errors[i] = rxStats.pktsRxError; + stats->ipackets += packets; + stats->ibytes += bytes; stats->ierrors += rxStats.pktsRxError; stats->imissed += rxStats.pktsRxOutOfBuf; + + if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) { + stats->q_ipackets[i] = packets; + stats->q_ibytes[i] = bytes; + stats->q_errors[i] = rxStats.pktsRxError; + } } return 0; @@ -1521,8 +1531,6 @@ vmxnet3_dev_stats_reset(struct rte_eth_dev *dev) VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS); - RTE_BUILD_BUG_ON(RTE_ETHDEV_QUEUE_STAT_CNTRS < VMXNET3_MAX_TX_QUEUES); - for (i = 0; i < hw->num_tx_queues; i++) { vmxnet3_hw_tx_stats_get(hw, i, &txStats); memcpy(&hw->snapshot_tx_stats[i], &txStats, -- 2.43.0
Re: [PATCH v1 1/2] baseband/acc: FFT support in VRB2 PRQ device
On 10/15/24 00:30, Nicolas Chautru wrote: Supporting recent change in the device to extend FFT capability processing in latest stepping. Also including cosmetic change to VRB2 register definition. Signed-off-by: Nicolas Chautru --- drivers/baseband/acc/acc_common.h | 2 +- drivers/baseband/acc/rte_vrb_pmd.c | 30 + drivers/baseband/acc/vrb2_vf_enum.h | 4 ++-- 3 files changed, 29 insertions(+), 7 deletions(-) With suggested commit reword I'll do Thanks, Maxime
RE: [PATCH 6/6] drivers: use bitops API instead of compiler builtins
> From: David Marchand [mailto:david.march...@redhat.com] > Sent: Thursday, 24 October 2024 14.06 > > Stop using directly __builtin_ bit operations, > prefer existing DPDK wrappers. > > Note: this is a brute sed all over drivers (skipping base drivers) > for __builtin_* that have a direct replacement in EAL bitops. There could be differences between 32 and 64 bit architectures. Simple search-replace might not cut it. Didn't review in detail, just speculating. > There is more work to do, like adding some missing macros inspired from > kernel (FIELD_*) macros but this is left for later. > > Signed-off-by: David Marchand > ---
[PATCH v5 3/9] raw/cnxk_rvu_lf: register/unregister interrupt handler
Added API rte_pmd_rvu_lf_irq_register() and rte_pmd_rvu_lf_irq_unregister() to register/unregister interrupt handlers for rvu lf raw device. Signed-off-by: Akhil Goyal --- doc/guides/rawdevs/cnxk_rvu_lf.rst | 8 drivers/common/cnxk/roc_rvu_lf.c | 26 +++ drivers/common/cnxk/roc_rvu_lf.h | 5 +++ drivers/common/cnxk/version.map | 2 + drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c| 30 + drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h | 46 drivers/raw/cnxk_rvu_lf/version.map | 2 + 7 files changed, 119 insertions(+) diff --git a/doc/guides/rawdevs/cnxk_rvu_lf.rst b/doc/guides/rawdevs/cnxk_rvu_lf.rst index 13184ad4dc..52e4f12e3c 100644 --- a/doc/guides/rawdevs/cnxk_rvu_lf.rst +++ b/doc/guides/rawdevs/cnxk_rvu_lf.rst @@ -45,3 +45,11 @@ Get NPA and SSO PF FUNC APIs ``rte_pmd_rvu_lf_npa_pf_func_get()`` and ``rte_pmd_rvu_lf_sso_pf_func_get()`` can be used to get the cnxk NPA PF func and SSO PF func which application can use for NPA/SSO specific configuration. + +Register or remove interrupt handler + + +Application can register interrupt handlers using ``rte_pmd_rvu_lf_irq_register()`` +or remove interrupt handler using ``rte_pmd_rvu_lf_irq_unregister()``. +The irq numbers for which the interrupts are registered is negotiated separately +and is not in scope of the driver. diff --git a/drivers/common/cnxk/roc_rvu_lf.c b/drivers/common/cnxk/roc_rvu_lf.c index 1ae39e746e..63bc149f2a 100644 --- a/drivers/common/cnxk/roc_rvu_lf.c +++ b/drivers/common/cnxk/roc_rvu_lf.c @@ -61,3 +61,29 @@ roc_rvu_lf_dev_fini(struct roc_rvu_lf *roc_rvu_lf) return dev_fini(&rvu->dev, rvu->pci_dev); } + +int +roc_rvu_lf_irq_register(struct roc_rvu_lf *roc_rvu_lf, unsigned int irq, + roc_rvu_lf_intr_cb_fn cb, void *data) +{ + struct rvu_lf *rvu = roc_rvu_lf_to_rvu_priv(roc_rvu_lf); + struct plt_intr_handle *handle; + + handle = rvu->pci_dev->intr_handle; + + return dev_irq_register(handle, (plt_intr_callback_fn)cb, data, irq); +} + +int +roc_rvu_lf_irq_unregister(struct roc_rvu_lf *roc_rvu_lf, unsigned int irq, + roc_rvu_lf_intr_cb_fn cb, void *data) +{ + struct rvu_lf *rvu = roc_rvu_lf_to_rvu_priv(roc_rvu_lf); + struct plt_intr_handle *handle; + + handle = rvu->pci_dev->intr_handle; + + dev_irq_unregister(handle, (plt_intr_callback_fn)cb, data, irq); + + return 0; +} diff --git a/drivers/common/cnxk/roc_rvu_lf.h b/drivers/common/cnxk/roc_rvu_lf.h index 7ce8065a8b..800bf4e674 100644 --- a/drivers/common/cnxk/roc_rvu_lf.h +++ b/drivers/common/cnxk/roc_rvu_lf.h @@ -21,4 +21,9 @@ TAILQ_HEAD(roc_rvu_lf_head, roc_rvu_lf); int __roc_api roc_rvu_lf_dev_init(struct roc_rvu_lf *roc_rvu_lf); int __roc_api roc_rvu_lf_dev_fini(struct roc_rvu_lf *roc_rvu_lf); +typedef void (*roc_rvu_lf_intr_cb_fn)(void *cb_arg); +int __roc_api roc_rvu_lf_irq_register(struct roc_rvu_lf *roc_rvu_lf, unsigned int irq, + roc_rvu_lf_intr_cb_fn cb, void *cb_arg); +int __roc_api roc_rvu_lf_irq_unregister(struct roc_rvu_lf *roc_rvu_lf, unsigned int irq, + roc_rvu_lf_intr_cb_fn cb, void *cb_arg); #endif /* _ROC_RVU_LF_H_ */ diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index d4c3e6c425..4e687c1cb8 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -551,5 +551,7 @@ INTERNAL { roc_ree_rule_db_prog; roc_rvu_lf_dev_fini; roc_rvu_lf_dev_init; + roc_rvu_lf_irq_register; + roc_rvu_lf_irq_unregister; local: *; }; diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c index c8490ccbab..c108931f97 100644 --- a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c +++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c @@ -16,6 +16,36 @@ #include "cnxk_rvu_lf.h" #include "cnxk_rvu_lf_driver.h" +int +rte_pmd_rvu_lf_irq_register(uint8_t dev_id, unsigned int irq, + rte_pmd_rvu_lf_intr_callback_fn cb, void *data) +{ + struct rte_rawdev *rawdev = rte_rawdev_pmd_get_dev(dev_id); + struct roc_rvu_lf *roc_rvu_lf; + + if (rawdev == NULL) + return -EINVAL; + + roc_rvu_lf = (struct roc_rvu_lf *)rawdev->dev_private; + + return roc_rvu_lf_irq_register(roc_rvu_lf, irq, (roc_rvu_lf_intr_cb_fn)cb, data); +} + +int +rte_pmd_rvu_lf_irq_unregister(uint8_t dev_id, unsigned int irq, + rte_pmd_rvu_lf_intr_callback_fn cb, void *data) +{ + struct rte_rawdev *rawdev = rte_rawdev_pmd_get_dev(dev_id); + struct roc_rvu_lf *roc_rvu_lf; + + if (rawdev == NULL) + return -EINVAL; + + roc_rvu_lf = (struct roc_rvu_lf *)rawdev->dev_private; + + return roc_rvu_lf_irq_unregister(roc_rvu_lf, irq, (roc_rvu_lf_intr_cb_fn)cb, da
[PATCH v5 5/9] raw/cnxk_rvu_lf: set message ID range
Added API rte_pmd_rvu_lf_msg_id_range_set() to set RVU mailbox message id range. Signed-off-by: Akhil Goyal --- doc/guides/rawdevs/cnxk_rvu_lf.rst | 12 drivers/common/cnxk/roc_mbox.h | 1 + drivers/common/cnxk/roc_rvu_lf.c | 30 drivers/common/cnxk/roc_rvu_lf.h | 3 ++ drivers/common/cnxk/version.map | 2 ++ drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c| 14 + drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h | 15 ++ drivers/raw/cnxk_rvu_lf/version.map | 1 + 8 files changed, 78 insertions(+) diff --git a/doc/guides/rawdevs/cnxk_rvu_lf.rst b/doc/guides/rawdevs/cnxk_rvu_lf.rst index 52e4f12e3c..7622b19217 100644 --- a/doc/guides/rawdevs/cnxk_rvu_lf.rst +++ b/doc/guides/rawdevs/cnxk_rvu_lf.rst @@ -53,3 +53,15 @@ Application can register interrupt handlers using ``rte_pmd_rvu_lf_irq_register( or remove interrupt handler using ``rte_pmd_rvu_lf_irq_unregister()``. The irq numbers for which the interrupts are registered is negotiated separately and is not in scope of the driver. + +RVU LF RAW MESSAGE PROCESSING +- + +Once a RVU LF raw device is probed, a range of message ids can be configured for +which mailboxes will be sent using the API ``rte_pmd_rvu_lf_msg_id_range_set``. + +For processing of mailboxes received on PF/VF application, application +can register callbacks using ``rte_pmd_rvu_lf_msg_handler_register()`` +and fill required responses as per the request and message id received. +Application can also unregister already registered message callbacks using +``rte_pmd_rvu_lf_msg_handler_unregister()``. diff --git a/drivers/common/cnxk/roc_mbox.h b/drivers/common/cnxk/roc_mbox.h index dd65946e9e..f8791e9f84 100644 --- a/drivers/common/cnxk/roc_mbox.h +++ b/drivers/common/cnxk/roc_mbox.h @@ -54,6 +54,7 @@ struct mbox_msghdr { #define MBOX_MSG_MASK 0x #define MBOX_MSG_INVALID 0xFFFE #define MBOX_MSG_MAX0x +#define MBOX_MSG_GENERIC_MAX_ID 0x1FF #define MBOX_MESSAGES \ /* Generic mbox IDs (range 0x000 - 0x1FF) */ \ diff --git a/drivers/common/cnxk/roc_rvu_lf.c b/drivers/common/cnxk/roc_rvu_lf.c index 2e1be81e52..1026ccc125 100644 --- a/drivers/common/cnxk/roc_rvu_lf.c +++ b/drivers/common/cnxk/roc_rvu_lf.c @@ -62,6 +62,36 @@ roc_rvu_lf_dev_fini(struct roc_rvu_lf *roc_rvu_lf) return dev_fini(&rvu->dev, rvu->pci_dev); } +int +roc_rvu_lf_msg_id_range_set(struct roc_rvu_lf *roc_rvu_lf, uint16_t from, uint16_t to) +{ + struct rvu_lf *rvu = roc_rvu_lf_to_rvu_priv(roc_rvu_lf); + + if (from <= MBOX_MSG_GENERIC_MAX_ID || from > to) + return -EINVAL; + + rvu->msg_id_from = from; + rvu->msg_id_to = to; + + return 0; +} + +bool +roc_rvu_lf_msg_id_range_check(struct roc_rvu_lf *roc_rvu_lf, uint16_t msg_id) +{ + struct rvu_lf *rvu; + + if (roc_rvu_lf == NULL) + return 0; + + rvu = roc_rvu_lf_to_rvu_priv(roc_rvu_lf); + + if (msg_id > rvu->msg_id_from && msg_id < rvu->msg_id_to) + return 1; + + return 0; +} + int roc_rvu_lf_irq_register(struct roc_rvu_lf *roc_rvu_lf, unsigned int irq, roc_rvu_lf_intr_cb_fn cb, void *data) diff --git a/drivers/common/cnxk/roc_rvu_lf.h b/drivers/common/cnxk/roc_rvu_lf.h index 90a0b5690a..7243e170b9 100644 --- a/drivers/common/cnxk/roc_rvu_lf.h +++ b/drivers/common/cnxk/roc_rvu_lf.h @@ -21,6 +21,9 @@ TAILQ_HEAD(roc_rvu_lf_head, roc_rvu_lf); int __roc_api roc_rvu_lf_dev_init(struct roc_rvu_lf *roc_rvu_lf); int __roc_api roc_rvu_lf_dev_fini(struct roc_rvu_lf *roc_rvu_lf); +int __roc_api roc_rvu_lf_msg_id_range_set(struct roc_rvu_lf *roc_rvu_lf, + uint16_t from, uint16_t to); +bool __roc_api roc_rvu_lf_msg_id_range_check(struct roc_rvu_lf *roc_rvu_lf, uint16_t msg_id); typedef void (*roc_rvu_lf_intr_cb_fn)(void *cb_arg); typedef int (*roc_rvu_lf_msg_handler_cb_fn)(uint16_t vf, uint16_t msg_id, void *req, uint16_t req_len, diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 964c53f819..e38da19956 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -555,5 +555,7 @@ INTERNAL { roc_rvu_lf_irq_unregister; roc_rvu_lf_msg_handler_register; roc_rvu_lf_msg_handler_unregister; + roc_rvu_lf_msg_id_range_check; + roc_rvu_lf_msg_id_range_set; local: *; }; diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c index 29ab738392..82439cf9f8 100644 --- a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c +++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c @@ -16,6 +16,20 @@ #include "cnxk_rvu_lf.h" #include "cnxk_rvu_lf_driver.h" +int +rte_pmd_rvu_lf_msg_id_range_set(uint8_t dev_id, uint16_t fr
Re: [PATCH 4/6] crypto/openssl: fix 3DES-CTR with big endian CPUs
On Thu, Oct 24, 2024 at 3:10 PM David Marchand wrote: > > There may be an alignment bug too; the way it is used in > > process_openssl_cipher_des3ctr(), "ctr" is not guaranteed to be uint64_t > > aligned. > > > > How about this instead: > > > > ctr_inc(void *ctr) > > { > > uint64_t ctr64 = rte_be_to_cpu_64(*(unaligned_uint64_t *)ctr); > > ctr64++; > > *(unaligned_uint64_t *)ctr = rte_cpu_to_be_64(ctr64); > > } > > > > Or this: > > > > ctr_inc(void *ctr) > > { > > uint64_t ctr64; > > > > memcpy(&ctr64, ctr, sizeof(uint64_t)); > > ctr64 = rte_be_to_cpu_64(ctr64); > > ctr64++; > > ctr64 = rte_cpu_to_be_64(ctr64); > > memcpy(ctr, &ctr64, sizeof(uint64_t)); > > } > > > > Or use a union in process_openssl_cipher_des3ctr() to ensure it's uint64_t > > aligned. > > Or declare ctr as a uint64_t in process_openssl_cipher_des3ctr > directly, and remove this casting. Like: diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c index 9657b70c7a..8e193759b7 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -99,22 +99,6 @@ digest_name_get(enum rte_crypto_auth_algorithm algo) static int cryptodev_openssl_remove(struct rte_vdev_device *vdev); -/**/ - -/** - * Increment counter by 1 - * Counter is 64 bit array, big-endian - */ -static void -ctr_inc(uint8_t *ctr) -{ - uint64_t *ctr64 = (uint64_t *)ctr; - - *ctr64 = __builtin_bswap64(*ctr64); - (*ctr64)++; - *ctr64 = __builtin_bswap64(*ctr64); -} - /* *-- * Session Prepare @@ -1192,7 +1176,9 @@ static int process_openssl_cipher_des3ctr(struct rte_mbuf *mbuf_src, uint8_t *dst, int offset, uint8_t *iv, int srclen, EVP_CIPHER_CTX *ctx) { - uint8_t ebuf[8], ctr[8]; + uint8_t ebuf[8]; + uint64_t host_ctr; + uint64_t ctr; int unused, n; struct rte_mbuf *m; uint8_t *src; @@ -1209,14 +1195,16 @@ process_openssl_cipher_des3ctr(struct rte_mbuf *mbuf_src, uint8_t *dst, l = rte_pktmbuf_data_len(m) - offset; memcpy(ctr, iv, 8); + host_ctr = rte_be_64_to_cpu(ctr); for (n = 0; n < srclen; n++) { if (n % 8 == 0) { + ctr = rte_cpu_to_be_64(host_ctr); if (EVP_EncryptUpdate(ctx, (unsigned char *)&ebuf, &unused, (const unsigned char *)&ctr, 8) <= 0) goto process_cipher_des3ctr_err; - ctr_inc(ctr); + host_ctr++; } dst[n] = *(src++) ^ ebuf[n % 8]; -- David Marchand
[PATCH v4 1/9] drivers/raw: introduce cnxk rvu lf device driver
CNXK product families can have a use case to allow PF and VF applications to communicate using mailboxes and also get notified of any interrupt that may occur on the device. Hence, a new raw device driver is added for such RVU LF devices. These devices can map to a PF or a VF which can send mailboxes to each other. Signed-off-by: Akhil Goyal --- MAINTAINERS | 6 ++ doc/guides/rawdevs/cnxk_rvu_lf.rst| 40 + doc/guides/rawdevs/index.rst | 1 + drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_api.h | 3 + drivers/common/cnxk/roc_constants.h | 3 + drivers/common/cnxk/roc_dev_priv.h| 1 + drivers/common/cnxk/roc_idev.c| 46 ++ drivers/common/cnxk/roc_idev.h| 4 + drivers/common/cnxk/roc_idev_priv.h | 1 + drivers/common/cnxk/roc_priv.h| 2 + drivers/common/cnxk/roc_rvu_lf.c | 63 + drivers/common/cnxk/roc_rvu_lf.h | 24 + drivers/common/cnxk/roc_rvu_lf_priv.h | 32 +++ drivers/common/cnxk/roc_utils.c | 2 + drivers/common/cnxk/version.map | 5 ++ drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c | 123 ++ drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.h | 24 + drivers/raw/cnxk_rvu_lf/meson.build | 9 ++ drivers/raw/meson.build | 1 + 20 files changed, 391 insertions(+) create mode 100644 doc/guides/rawdevs/cnxk_rvu_lf.rst create mode 100644 drivers/common/cnxk/roc_rvu_lf.c create mode 100644 drivers/common/cnxk/roc_rvu_lf.h create mode 100644 drivers/common/cnxk/roc_rvu_lf_priv.h create mode 100644 drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c create mode 100644 drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.h create mode 100644 drivers/raw/cnxk_rvu_lf/meson.build diff --git a/MAINTAINERS b/MAINTAINERS index cd78bc7db1..fe1464d06a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1503,6 +1503,12 @@ T: git://dpdk.org/next/dpdk-next-net-mrvl F: doc/guides/rawdevs/cnxk_gpio.rst F: drivers/raw/cnxk_gpio/ +Marvell CNXK RVU LF +M: Akhil Goyal +T: git://dpdk.org/next/dpdk-next-net-mrvl +F: doc/guides/rawdevs/cnxk_rvu_lf.rst +F: drivers/raw/cnxk_rvu_lf/ + NTB M: Jingjing Wu F: drivers/raw/ntb/ diff --git a/doc/guides/rawdevs/cnxk_rvu_lf.rst b/doc/guides/rawdevs/cnxk_rvu_lf.rst new file mode 100644 index 00..8a0bc22dd5 --- /dev/null +++ b/doc/guides/rawdevs/cnxk_rvu_lf.rst @@ -0,0 +1,40 @@ +.. SPDX-License-Identifier: BSD-3-Clause +Copyright(c) 2024 Marvell. + +Marvell CNXK RVU LF Driver +== + +CNXK product families can have a use case to allow PF and VF +applications to communicate using mailboxes and also get notified +of any interrupt that may occur on the device. +Hence, a new raw device driver is added for such RVU LF devices. +These devices can map to a PF or a VF which can send mailboxes to +each other. + +Features + + +The RVU LF device implements following features in the rawdev API: + +- Register mailbox callbacks for the other side to process mailboxes. +- Register interrupt handler callbacks. +- Process mailbox. +- Set range of message IDs allowed for communication. + +Limitations +--- + +In multiprocess mode user-space application must ensure +no resources sharing takes place. +Otherwise, user-space application should ensure synchronization. + +Device Setup + + +The RVU LF devices will need to be bound to a user-space IO driver for use. +The script ``dpdk-devbind.py`` included with DPDK can be used to +view the state of the devices and to bind them to a suitable DPDK-supported +kernel driver. When querying the status of the devices, they will appear under +the category of "Misc (rawdev) devices", i.e. the command +``dpdk-devbind.py --status-dev misc`` can be used to see the state of those +devices alone. diff --git a/doc/guides/rawdevs/index.rst b/doc/guides/rawdevs/index.rst index f34315f051..8e07cf4d6c 100644 --- a/doc/guides/rawdevs/index.rst +++ b/doc/guides/rawdevs/index.rst @@ -13,6 +13,7 @@ application through rawdev API. cnxk_bphy cnxk_gpio +cnxk_rvu_lf dpaa2_cmdif ifpga ntb diff --git a/drivers/common/cnxk/meson.build b/drivers/common/cnxk/meson.build index abb0f6f01f..cb0ffd5d40 100644 --- a/drivers/common/cnxk/meson.build +++ b/drivers/common/cnxk/meson.build @@ -71,6 +71,7 @@ sources = files( 'roc_tim_irq.c', 'roc_utils.c', 'roc_ree.c', +'roc_rvu_lf.c', ) # Security common code diff --git a/drivers/common/cnxk/roc_api.h b/drivers/common/cnxk/roc_api.h index 6a86863c57..93e7bf11bb 100644 --- a/drivers/common/cnxk/roc_api.h +++ b/drivers/common/cnxk/roc_api.h @@ -120,4 +120,7 @@ /* Eswitch */ #include "roc_eswitch.h" +/* RVU LF */ +#include "roc_rvu_lf.h" + #endif /* _ROC_API_H_ */ diff --git a/drivers/common/cnxk/roc_constants.h b/drivers/common/cnxk/roc_constants.h index 0e7495a37c..67cd74b28a 100644 --- a/drivers/common/cnxk/roc_constants.h +++ b/dr
[PATCH v5 8/9] raw/cnxk_rvu_lf: add API to get BAR addresses
Added rte_pmd_rvu_lf_bar_get() API to get BAR address for application to configure hardware. Signed-off-by: Akhil Goyal --- doc/guides/rawdevs/cnxk_rvu_lf.rst | 7 ++ drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c| 24 drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h | 18 +++ drivers/raw/cnxk_rvu_lf/version.map | 1 + 4 files changed, 50 insertions(+) diff --git a/doc/guides/rawdevs/cnxk_rvu_lf.rst b/doc/guides/rawdevs/cnxk_rvu_lf.rst index 51e1c58b69..a972654f82 100644 --- a/doc/guides/rawdevs/cnxk_rvu_lf.rst +++ b/doc/guides/rawdevs/cnxk_rvu_lf.rst @@ -73,3 +73,10 @@ and provides an opaque pointer for a response and its length. PF and VF application can define its own request and response based on the message id of the mailbox. For sample usage of the APIs, please refer to ``rvu_lf_rawdev_selftest()``. + +Get BAR addresses +- + +Application can retrieve PCI BAR addresses of the device using the API +``rte_pmd_rvu_lf_bar_get()``. This helps application to configure the +registers of the hardware device. diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c index 156b9460c1..3a3971ecd3 100644 --- a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c +++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c @@ -103,6 +103,30 @@ rte_pmd_rvu_lf_irq_unregister(uint8_t dev_id, unsigned int irq, return roc_rvu_lf_irq_unregister(roc_rvu_lf, irq, (roc_rvu_lf_intr_cb_fn)cb, data); } +int +rte_pmd_rvu_lf_bar_get(uint8_t dev_id, uint8_t bar_num, size_t *va, size_t *mask) +{ + struct roc_rvu_lf *roc_rvu_lf; + struct rte_rawdev *rawdev; + + rawdev = rte_rawdev_pmd_get_dev(dev_id); + if (rawdev == NULL) + return -EINVAL; + + roc_rvu_lf = (struct roc_rvu_lf *)rawdev->dev_private; + + if (bar_num > PCI_MAX_RESOURCE || + (roc_rvu_lf->pci_dev->mem_resource[bar_num].addr == NULL)) { + *va = 0; + *mask = 0; + return -ENOTSUP; + } + *va = (size_t)(roc_rvu_lf->pci_dev->mem_resource[bar_num].addr); + *mask = (size_t)(roc_rvu_lf->pci_dev->mem_resource[bar_num].len - 1); + + return 0; +} + uint16_t rte_pmd_rvu_lf_npa_pf_func_get(void) { diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h index 22978f89af..922c852592 100644 --- a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h +++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h @@ -191,6 +191,24 @@ __rte_internal int rte_pmd_rvu_lf_msg_process(uint8_t dev_id, uint16_t vf, uint16_t msg_id, void *req, uint16_t req_len, void *rsp, uint16_t rsp_len); +/** + * Get BAR addresses for the RVU LF device. + * + * @param dev_id + * device id of RVU LF device + * @param bar_num + * BAR number for which address is required + * @param[out] va + *Virtual address of the BAR. 0 if not mapped + * @param[out] mask + *BAR address mask, 0 if not mapped + * + * @return + * Returns 0 on success, negative error code otherwise + */ +__rte_internal +int rte_pmd_rvu_lf_bar_get(uint8_t dev_id, uint8_t bar_num, size_t *va, size_t *mask); + #ifdef __cplusplus } #endif diff --git a/drivers/raw/cnxk_rvu_lf/version.map b/drivers/raw/cnxk_rvu_lf/version.map index aa974f629e..012f05d1e4 100644 --- a/drivers/raw/cnxk_rvu_lf/version.map +++ b/drivers/raw/cnxk_rvu_lf/version.map @@ -1,6 +1,7 @@ INTERNAL { global: + rte_pmd_rvu_lf_bar_get; rte_pmd_rvu_lf_irq_register; rte_pmd_rvu_lf_irq_unregister; rte_pmd_rvu_lf_msg_handler_register; -- 2.25.1
[PATCH v5 6/9] raw/cnxk_rvu_lf: process mailbox message
Added API rte_pmd_rvu_lf_msg_process() to process mailbox messages between rvu_lf devices. Signed-off-by: Akhil Goyal --- doc/guides/rawdevs/cnxk_rvu_lf.rst | 8 ++ doc/guides/rel_notes/release_24_11.rst | 5 + drivers/common/cnxk/roc_dev.c| 118 ++- drivers/common/cnxk/roc_mbox.h | 1 + drivers/common/cnxk/roc_rvu_lf.c | 58 + drivers/common/cnxk/roc_rvu_lf.h | 5 + drivers/common/cnxk/roc_rvu_lf_priv.h| 5 + drivers/common/cnxk/version.map | 2 + drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c| 15 +++ drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h | 29 + drivers/raw/cnxk_rvu_lf/version.map | 1 + 11 files changed, 241 insertions(+), 6 deletions(-) diff --git a/doc/guides/rawdevs/cnxk_rvu_lf.rst b/doc/guides/rawdevs/cnxk_rvu_lf.rst index 7622b19217..51e1c58b69 100644 --- a/doc/guides/rawdevs/cnxk_rvu_lf.rst +++ b/doc/guides/rawdevs/cnxk_rvu_lf.rst @@ -65,3 +65,11 @@ can register callbacks using ``rte_pmd_rvu_lf_msg_handler_register()`` and fill required responses as per the request and message id received. Application can also unregister already registered message callbacks using ``rte_pmd_rvu_lf_msg_handler_unregister()``. + +A PMD API ``rte_pmd_rvu_lf_msg_process()`` is created to send a request and +receive corresponding response from the other side(PF/VF). +It accepts an opaque pointer of a request and its size which can be defined by application +and provides an opaque pointer for a response and its length. +PF and VF application can define its own request and response based on the message id +of the mailbox. +For sample usage of the APIs, please refer to ``rvu_lf_rawdev_selftest()``. diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst index fa4822d928..3f50545a2e 100644 --- a/doc/guides/rel_notes/release_24_11.rst +++ b/doc/guides/rel_notes/release_24_11.rst @@ -247,6 +247,11 @@ New Features Added ability for node to advertise and update multiple xstat counters, that can be retrieved using ``rte_graph_cluster_stats_get``. +* **Added Marvell cnxk RVU LF rawdev driver.** + + Added a new raw device driver for Marvell cnxk based devices to allow + applications to communicate using mailboxes and notify for the interrupts. + Removed Items - diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c index c905d35ea6..cb8d5d03fd 100644 --- a/drivers/common/cnxk/roc_dev.c +++ b/drivers/common/cnxk/roc_dev.c @@ -218,6 +218,51 @@ af_pf_wait_msg(struct dev *dev, uint16_t vf, int num_msg) return req_hdr->num_msgs; } +static int +process_rvu_lf_msgs(struct dev *dev, uint16_t vf, struct mbox_msghdr *msg, size_t size) +{ + uint16_t max_bits = sizeof(dev->active_vfs[0]) * 8; + uint8_t req[MBOX_MSG_REQ_SIZE_MAX]; + struct msg_rsp *rsp; + uint16_t rsp_len; + void *resp; + int rc = 0; + + /* Handle BPHY mailbox message in PF */ + dev->active_vfs[vf / max_bits] |= BIT_ULL(vf % max_bits); + + if ((size - sizeof(struct mbox_msghdr)) > MBOX_MSG_REQ_SIZE_MAX) { + plt_err("MBOX request size greater than %d", MBOX_MSG_REQ_SIZE_MAX); + return -1; + } + mbox_memcpy(req, (uint8_t *)msg + sizeof(struct mbox_msghdr), + size - sizeof(struct mbox_msghdr)); + + rc = dev->ops->msg_process_cb(dev_get_vf(msg->pcifunc), msg->id, req, + size - sizeof(struct mbox_msghdr), &resp, &rsp_len); + if (rc < 0) { + plt_err("Failed to process VF%d message", vf); + return -1; + } + + rsp = (struct msg_rsp *)mbox_alloc_msg(&dev->mbox_vfpf, vf, + rsp_len + sizeof(struct mbox_msghdr)); + if (!rsp) { + plt_err("Failed to alloc VF%d response message", vf); + return -1; + } + + mbox_rsp_init(msg->id, rsp); + + mbox_memcpy((uint8_t *)rsp + sizeof(struct mbox_msghdr), resp, rsp_len); + free(resp); + /* PF/VF function ID */ + rsp->hdr.pcifunc = msg->pcifunc; + rsp->hdr.rc = 0; + + return 0; +} + /* PF receives mbox DOWN messages from VF and forwards to AF */ static int vf_pf_process_msgs(struct dev *dev, uint16_t vf) @@ -264,6 +309,9 @@ vf_pf_process_msgs(struct dev *dev, uint16_t vf) /* PF/VF function ID */ rsp->hdr.pcifunc = msg->pcifunc; rsp->hdr.rc = 0; + } else if (roc_rvu_lf_msg_id_range_check(dev->roc_rvu_lf, msg->id)) { + if (process_rvu_lf_msgs(dev, vf, msg, size) < 0) + continue; } else { struct mbox_msghdr *af_req; /* Reserve AF/PF mbox message */ @@ -342,8 +390,13 @@ vf_pf_p
[PATCH v5 1/9] drivers/raw: introduce cnxk rvu lf device driver
CNXK product families can have a use case to allow PF and VF applications to communicate using mailboxes and also get notified of any interrupt that may occur on the device. Hence, a new raw device driver is added for such RVU LF devices. These devices can map to a PF or a VF which can send mailboxes to each other. Signed-off-by: Akhil Goyal --- MAINTAINERS | 6 ++ doc/guides/rawdevs/cnxk_rvu_lf.rst| 40 + doc/guides/rawdevs/index.rst | 1 + drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_api.h | 3 + drivers/common/cnxk/roc_constants.h | 3 + drivers/common/cnxk/roc_dev_priv.h| 1 + drivers/common/cnxk/roc_idev.c| 46 ++ drivers/common/cnxk/roc_idev.h| 4 + drivers/common/cnxk/roc_idev_priv.h | 1 + drivers/common/cnxk/roc_priv.h| 2 + drivers/common/cnxk/roc_rvu_lf.c | 63 + drivers/common/cnxk/roc_rvu_lf.h | 24 + drivers/common/cnxk/roc_rvu_lf_priv.h | 32 +++ drivers/common/cnxk/roc_utils.c | 2 + drivers/common/cnxk/version.map | 5 ++ drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c | 123 ++ drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.h | 24 + drivers/raw/cnxk_rvu_lf/meson.build | 9 ++ drivers/raw/meson.build | 1 + 20 files changed, 391 insertions(+) create mode 100644 doc/guides/rawdevs/cnxk_rvu_lf.rst create mode 100644 drivers/common/cnxk/roc_rvu_lf.c create mode 100644 drivers/common/cnxk/roc_rvu_lf.h create mode 100644 drivers/common/cnxk/roc_rvu_lf_priv.h create mode 100644 drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c create mode 100644 drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.h create mode 100644 drivers/raw/cnxk_rvu_lf/meson.build diff --git a/MAINTAINERS b/MAINTAINERS index cd78bc7db1..fe1464d06a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1503,6 +1503,12 @@ T: git://dpdk.org/next/dpdk-next-net-mrvl F: doc/guides/rawdevs/cnxk_gpio.rst F: drivers/raw/cnxk_gpio/ +Marvell CNXK RVU LF +M: Akhil Goyal +T: git://dpdk.org/next/dpdk-next-net-mrvl +F: doc/guides/rawdevs/cnxk_rvu_lf.rst +F: drivers/raw/cnxk_rvu_lf/ + NTB M: Jingjing Wu F: drivers/raw/ntb/ diff --git a/doc/guides/rawdevs/cnxk_rvu_lf.rst b/doc/guides/rawdevs/cnxk_rvu_lf.rst new file mode 100644 index 00..8a0bc22dd5 --- /dev/null +++ b/doc/guides/rawdevs/cnxk_rvu_lf.rst @@ -0,0 +1,40 @@ +.. SPDX-License-Identifier: BSD-3-Clause +Copyright(c) 2024 Marvell. + +Marvell CNXK RVU LF Driver +== + +CNXK product families can have a use case to allow PF and VF +applications to communicate using mailboxes and also get notified +of any interrupt that may occur on the device. +Hence, a new raw device driver is added for such RVU LF devices. +These devices can map to a PF or a VF which can send mailboxes to +each other. + +Features + + +The RVU LF device implements following features in the rawdev API: + +- Register mailbox callbacks for the other side to process mailboxes. +- Register interrupt handler callbacks. +- Process mailbox. +- Set range of message IDs allowed for communication. + +Limitations +--- + +In multiprocess mode user-space application must ensure +no resources sharing takes place. +Otherwise, user-space application should ensure synchronization. + +Device Setup + + +The RVU LF devices will need to be bound to a user-space IO driver for use. +The script ``dpdk-devbind.py`` included with DPDK can be used to +view the state of the devices and to bind them to a suitable DPDK-supported +kernel driver. When querying the status of the devices, they will appear under +the category of "Misc (rawdev) devices", i.e. the command +``dpdk-devbind.py --status-dev misc`` can be used to see the state of those +devices alone. diff --git a/doc/guides/rawdevs/index.rst b/doc/guides/rawdevs/index.rst index f34315f051..8e07cf4d6c 100644 --- a/doc/guides/rawdevs/index.rst +++ b/doc/guides/rawdevs/index.rst @@ -13,6 +13,7 @@ application through rawdev API. cnxk_bphy cnxk_gpio +cnxk_rvu_lf dpaa2_cmdif ifpga ntb diff --git a/drivers/common/cnxk/meson.build b/drivers/common/cnxk/meson.build index abb0f6f01f..cb0ffd5d40 100644 --- a/drivers/common/cnxk/meson.build +++ b/drivers/common/cnxk/meson.build @@ -71,6 +71,7 @@ sources = files( 'roc_tim_irq.c', 'roc_utils.c', 'roc_ree.c', +'roc_rvu_lf.c', ) # Security common code diff --git a/drivers/common/cnxk/roc_api.h b/drivers/common/cnxk/roc_api.h index 6a86863c57..93e7bf11bb 100644 --- a/drivers/common/cnxk/roc_api.h +++ b/drivers/common/cnxk/roc_api.h @@ -120,4 +120,7 @@ /* Eswitch */ #include "roc_eswitch.h" +/* RVU LF */ +#include "roc_rvu_lf.h" + #endif /* _ROC_API_H_ */ diff --git a/drivers/common/cnxk/roc_constants.h b/drivers/common/cnxk/roc_constants.h index 0e7495a37c..67cd74b28a 100644 --- a/drivers/common/cnxk/roc_constants.h +++ b/dr
Re: [PATCH 4/6] crypto/openssl: fix 3DES-CTR with big endian CPUs
On Thu, Oct 24, 2024 at 2:55 PM Morten Brørup wrote: > > > From: David Marchand [mailto:david.march...@redhat.com] > > Sent: Thursday, 24 October 2024 14.06 > > > > Caught by code review. > > > > Don't byte swap unconditionally (assuming that CPU is little endian is > > wrong). Instead, convert from big endian to cpu and vice versa. > > Yes looks like a bug. > I wonder if this PMD has more similar bugs... > grep bswap drivers/crypto/openssl/* says no. > > > @@ -110,9 +111,9 @@ ctr_inc(uint8_t *ctr) > > { > > uint64_t *ctr64 = (uint64_t *)ctr; > > > > - *ctr64 = __builtin_bswap64(*ctr64); > > + *ctr64 = rte_be_to_cpu_64(*ctr64); > > (*ctr64)++; > > - *ctr64 = __builtin_bswap64(*ctr64); > > + *ctr64 = rte_cpu_to_be_64(*ctr64); > > } > > But that's not all. > > There may be an alignment bug too; the way it is used in > process_openssl_cipher_des3ctr(), "ctr" is not guaranteed to be uint64_t > aligned. > > How about this instead: > > ctr_inc(void *ctr) > { > uint64_t ctr64 = rte_be_to_cpu_64(*(unaligned_uint64_t *)ctr); > ctr64++; > *(unaligned_uint64_t *)ctr = rte_cpu_to_be_64(ctr64); > } > > Or this: > > ctr_inc(void *ctr) > { > uint64_t ctr64; > > memcpy(&ctr64, ctr, sizeof(uint64_t)); > ctr64 = rte_be_to_cpu_64(ctr64); > ctr64++; > ctr64 = rte_cpu_to_be_64(ctr64); > memcpy(ctr, &ctr64, sizeof(uint64_t)); > } > > Or use a union in process_openssl_cipher_des3ctr() to ensure it's uint64_t > aligned. Or declare ctr as a uint64_t in process_openssl_cipher_des3ctr directly, and remove this casting. -- David Marchand
[PATCH v5 9/9] raw/cnxk_rvu_lf: add selftest
Added raw device selftest for cnxk_rvu_lf to verify various PMD APIs. Signed-off-by: Akhil Goyal --- doc/guides/rawdevs/cnxk_rvu_lf.rst| 18 ++ drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c | 4 +- drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.h | 2 + .../raw/cnxk_rvu_lf/cnxk_rvu_lf_selftest.c| 166 ++ drivers/raw/cnxk_rvu_lf/meson.build | 1 + 5 files changed, 188 insertions(+), 3 deletions(-) create mode 100644 drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_selftest.c diff --git a/doc/guides/rawdevs/cnxk_rvu_lf.rst b/doc/guides/rawdevs/cnxk_rvu_lf.rst index a972654f82..41fd2d1b42 100644 --- a/doc/guides/rawdevs/cnxk_rvu_lf.rst +++ b/doc/guides/rawdevs/cnxk_rvu_lf.rst @@ -80,3 +80,21 @@ Get BAR addresses Application can retrieve PCI BAR addresses of the device using the API ``rte_pmd_rvu_lf_bar_get()``. This helps application to configure the registers of the hardware device. + +Self test +- + +On EAL initialization RVU_LF devices will be probed and populated into +the raw devices. The rawdev ID of the device can be obtained using invocation +of ``rte_rawdev_get_dev_id("NAME:x")`` from the test application, where: + +- NAME is the desired subsystem: use "RVU_LF". +- x is the device's bus id specified in "bus:device.func" (BDF) format. BDF follows convention + used by lspci i.e bus, device and func are specified using respectively two, two and one hex + digit(s). + +Use this identifier for further rawdev function calls. + +Selftest rawdev API can be used to verify the mailbox communication between +PF and VF devices based applications. There can be multiple VFs for a particular PF. +Each VF can send mailboxes to PF and PF can broadcast message to all VFs. diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c index 3a3971ecd3..516fc896b9 100644 --- a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c +++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c @@ -5,8 +5,6 @@ #include #include #include -#include -#include #include #include #include @@ -155,7 +153,7 @@ rte_pmd_rvu_lf_pf_func_get(uint8_t dev_id) } static const struct rte_rawdev_ops rvu_lf_rawdev_ops = { - .dev_selftest = NULL, + .dev_selftest = rvu_lf_rawdev_selftest, }; static void diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.h b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.h index 65cc1bb64d..e64643dcee 100644 --- a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.h +++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.h @@ -21,4 +21,6 @@ extern int cnxk_logtype_rvu_lf; #define CNXK_RVU_LF_LOG(level, ...) \ RTE_LOG_LINE_PREFIX(level, CNXK_RVU_LF, "%s(): ", __func__, __VA_ARGS__) +int rvu_lf_rawdev_selftest(uint16_t dev_id); + #endif /* _CNXK_RVU_LF_H_ */ diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_selftest.c b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_selftest.c new file mode 100644 index 00..e33973f24b --- /dev/null +++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_selftest.c @@ -0,0 +1,166 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2024 Marvell. + */ + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "cnxk_rvu_lf.h" +#include "cnxk_rvu_lf_driver.h" + +#define PF 0 +#define VF 0 +#define RSP_LEN64 +#define REQ_LEN64 +#define MSG_ID_FROM0x3000 +#define MSG_ID_TO 0x4000 +#define MAX_BAR6 + +static int +msg_process_notify_cb(uint16_t vf, uint16_t msg_id, + void *req, uint16_t req_len, void **rsp, uint16_t *rsp_len) +{ + uint8_t *resp; + int i; + + printf("\nReceived message(0x%x) from VF0x%x\n", msg_id, vf); + rte_hexdump(stdout, "req_data received", req, req_len); + + resp = malloc(RSP_LEN); + if (resp == NULL) + return -ENOMEM; + for (i = 0; i < RSP_LEN; i++) + resp[i] = 0xB0; + *rsp = resp; + *rsp_len = RSP_LEN; + rte_hexdump(stdout, "rsp_data_filled", *rsp, RSP_LEN); + + return 0; +} + +int +rvu_lf_rawdev_selftest(uint16_t dev_id) +{ + char *dev_name = rte_rawdevs[dev_id].name; + uint8_t req[REQ_LEN] = {0}; + uint8_t rsp[RSP_LEN] = {0}; + size_t bar_mask = 0; + size_t bar_va = 0; + unsigned int i, j; + uint16_t pf_func; + char *token[2]; + int func, ret; + + token[0] = strtok_r(dev_name, ".", &dev_name); + token[1] = strtok_r(dev_name, ".", &dev_name); + func = atoi(token[1]); + + ret = rte_rawdev_start(dev_id); + if (ret) + return ret; + + pf_func = rte_pmd_rvu_lf_npa_pf_func_get(); + if (pf_func == 0) + CNXK_RVU_LF_LOG(WARNING, "NPA pf_func is invalid"); + + pf_func = rte_pmd_rvu_lf_sso_pf_func_get(); + if (pf_func == 0) + CNXK_RVU_LF_LOG(WARNING, "SSO pf_func is invalid"); + + pf_func = rte_pmd_rvu_lf_pf_func_get(dev_id); + if (p
[PATCH v5 0/9] drivers/raw: introduce cnxk rvu lf device driver
CNXK product families can have a use case to allow PF and VF applications to communicate using mailboxes and also get notified of any interrupt that may occur on the device. Hence, a new raw device driver is added for such RVU LF devices. These devices can map to a PF or a VF which can send mailboxes to each other. The RVU LF device implements following features in the rawdev API: - Register mailbox callbacks for the other side to process mailboxes. - Register interrupt handler callbacks. - Process mailbox. - Set range of message IDs allowed for communication. Changes in v5: - fixed checkpatch Changes in v4: - moved all PMD APIs to internal APIs to be exposed via enable_driver_sdk meson option. - added missing version.map entries as internal APIs. - separate out selftest in a separate file - fixed logs Changes in v3: - fix internal/external header files. Changes in v2: - removed library patch from series - removed PMD logs from external PMD header. - updated doc/api/doxy-api-index.md - Added release notes Akhil Goyal (9): drivers/raw: introduce cnxk rvu lf device driver raw/cnxk_rvu_lf: add API to get NPA/SSO pffunc raw/cnxk_rvu_lf: register/unregister interrupt handler raw/cnxk_rvu_lf: register/unregister msg handler raw/cnxk_rvu_lf: set message ID range raw/cnxk_rvu_lf: process mailbox message raw/cnxk_rvu_lf: add API to get device pffunc raw/cnxk_rvu_lf: add API to get BAR addresses raw/cnxk_rvu_lf: add selftest MAINTAINERS | 6 + doc/guides/rawdevs/cnxk_rvu_lf.rst| 100 +++ doc/guides/rawdevs/index.rst | 1 + doc/guides/rel_notes/release_24_11.rst| 5 + drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_api.h | 3 + drivers/common/cnxk/roc_constants.h | 3 + drivers/common/cnxk/roc_dev.c | 118 +++- drivers/common/cnxk/roc_dev_priv.h| 7 + drivers/common/cnxk/roc_idev.c| 46 drivers/common/cnxk/roc_idev.h| 4 + drivers/common/cnxk/roc_idev_priv.h | 1 + drivers/common/cnxk/roc_mbox.h| 2 + drivers/common/cnxk/roc_npa.c | 6 + drivers/common/cnxk/roc_npa.h | 3 + drivers/common/cnxk/roc_priv.h| 2 + drivers/common/cnxk/roc_rvu_lf.c | 202 ++ drivers/common/cnxk/roc_rvu_lf.h | 46 drivers/common/cnxk/roc_rvu_lf_priv.h | 37 +++ drivers/common/cnxk/roc_sso.c | 6 + drivers/common/cnxk/roc_sso.h | 3 + drivers/common/cnxk/roc_utils.c | 2 + drivers/common/cnxk/version.map | 16 ++ drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c | 260 ++ drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.h | 26 ++ drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h | 216 +++ .../raw/cnxk_rvu_lf/cnxk_rvu_lf_selftest.c| 166 +++ drivers/raw/cnxk_rvu_lf/meson.build | 11 + drivers/raw/cnxk_rvu_lf/version.map | 16 ++ drivers/raw/meson.build | 1 + 30 files changed, 1310 insertions(+), 6 deletions(-) create mode 100644 doc/guides/rawdevs/cnxk_rvu_lf.rst create mode 100644 drivers/common/cnxk/roc_rvu_lf.c create mode 100644 drivers/common/cnxk/roc_rvu_lf.h create mode 100644 drivers/common/cnxk/roc_rvu_lf_priv.h create mode 100644 drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c create mode 100644 drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.h create mode 100644 drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h create mode 100644 drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_selftest.c create mode 100644 drivers/raw/cnxk_rvu_lf/meson.build create mode 100644 drivers/raw/cnxk_rvu_lf/version.map -- 2.25.1
[PATCH v3 1/5] net/mlx5/hws: introduce new matcher type
From: Hamdan Igbaria introduce STE array matcher, where this matcher can only be isolated under a parent table and not chained to the table matchers chain. Signed-off-by: Hamdan Igbaria --- drivers/net/mlx5/hws/mlx5dr.h | 13 +- drivers/net/mlx5/hws/mlx5dr_debug.c | 12 +- drivers/net/mlx5/hws/mlx5dr_matcher.c | 58 +++-- drivers/net/mlx5/hws/mlx5dr_matcher.h | 6 +++ drivers/net/mlx5/hws/mlx5dr_rule.c| 2 +- drivers/net/mlx5/hws/mlx5dr_table.c | 61 +++ drivers/net/mlx5/hws/mlx5dr_table.h | 8 +++- drivers/net/mlx5/mlx5_flow_hw.c | 2 + 8 files changed, 135 insertions(+), 27 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h index 0fe39e9c76..8a1a389a3f 100644 --- a/drivers/net/mlx5/hws/mlx5dr.h +++ b/drivers/net/mlx5/hws/mlx5dr.h @@ -130,6 +130,14 @@ enum mlx5dr_matcher_distribute_mode { MLX5DR_MATCHER_DISTRIBUTE_BY_LINEAR = 0x1, }; +/* Match mode describes the behavior of the matcher STE's when a packet arrives */ +enum mlx5dr_matcher_match_mode { + /* Packet arriving at this matcher STE's will match according it's tag and match definer */ + MLX5DR_MATCHER_MATCH_MODE_DEFAULT = 0x0, + /* Packet arriving at this matcher STE's will always hit and perform the actions */ + MLX5DR_MATCHER_MATCH_MODE_ALWAYS_HIT = 0x1, +}; + enum mlx5dr_rule_hash_calc_mode { MLX5DR_RULE_HASH_CALC_MODE_RAW, MLX5DR_RULE_HASH_CALC_MODE_IDX, @@ -144,11 +152,14 @@ 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 */ + /* Define the insertion, distribution and match modes for this matcher */ enum mlx5dr_matcher_insert_mode insert_mode; enum mlx5dr_matcher_distribute_mode distribute_mode; + enum mlx5dr_matcher_match_mode match_mode; /* Define whether the created matcher supports resizing into a bigger matcher */ bool resizable; + /* This will imply that this matcher is not part of the matchers chain of parent table */ + bool isolated; union { struct { uint8_t sz_row_log; diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.c b/drivers/net/mlx5/hws/mlx5dr_debug.c index 741a725842..f15ad96598 100644 --- a/drivers/net/mlx5/hws/mlx5dr_debug.c +++ b/drivers/net/mlx5/hws/mlx5dr_debug.c @@ -182,7 +182,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,%d,%d\n", + ret = fprintf(f, "%d,0x%" PRIx64 ",%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n", MLX5DR_DEBUG_RES_TYPE_MATCHER_ATTR, (uint64_t)(uintptr_t)matcher, attr->priority, @@ -192,7 +192,9 @@ mlx5dr_debug_dump_matcher_attr(FILE *f, struct mlx5dr_matcher *matcher) attr->optimize_using_rule_idx, attr->optimize_flow_src, attr->insert_mode, - attr->distribute_mode); + attr->distribute_mode, + attr->match_mode, + attr->isolated); if (ret < 0) { rte_errno = EINVAL; return rte_errno; @@ -377,6 +379,12 @@ static int mlx5dr_debug_dump_table(FILE *f, struct mlx5dr_table *tbl) return ret; } + LIST_FOREACH(matcher, &tbl->isolated_matchers, next) { + ret = mlx5dr_debug_dump_matcher(f, matcher); + if (ret) + return ret; + } + return 0; out_err: diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c index dfa2cd435c..54460cc82b 100644 --- a/drivers/net/mlx5/hws/mlx5dr_matcher.c +++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c @@ -198,6 +198,18 @@ static int mlx5dr_matcher_connect(struct mlx5dr_matcher *matcher) struct mlx5dr_matcher *tmp_matcher; int ret; + if (matcher->attr.isolated) { + LIST_INSERT_HEAD(&tbl->isolated_matchers, matcher, next); + ret = mlx5dr_table_connect_src_ft_to_miss_table(tbl, matcher->end_ft, + tbl->default_miss.miss_tbl); + if (ret) { + DR_LOG(ERR, "Failed to connect the new matcher to the miss_tbl"); + goto remove_from_list; + } + + return 0; + } + /* Find location in matcher list */ if (LIST_EMPTY(&tbl->head)) { LIST_INSERT_HEAD(&tbl->head, matcher, next); @@ -230,7 +242,7 @@ static int mlx5dr_
[PATCH v5] ethdev: TEST support single queue per port
Configuring one queue per port fails compilation on my system. Test to see how much it fails in CI. Signed-off-by: Morten Brørup --- v5: * Wrap GCC optimizer pragmas in if defined(RTE_TOOLCHAIN_GCC). v4: * Workaound GCC optimizer incorrectly throwing a warning in these network drivers: * bnxt * e1000 * failsafe * hns3 v3: * Fix net/ixgbe driver. v2: * Fix net/vmxnet3 driver. --- config/rte_config.h | 4 ++-- drivers/net/bnxt/bnxt_ethdev.c | 7 ++ drivers/net/e1000/igb_rxtx.c | 7 ++ drivers/net/failsafe/failsafe_ops.c | 14 drivers/net/hns3/hns3_rxtx.c | 7 ++ drivers/net/ixgbe/ixgbe_ethdev.c | 3 ++- drivers/net/vmxnet3/vmxnet3_ethdev.c | 32 +--- 7 files changed, 59 insertions(+), 15 deletions(-) diff --git a/config/rte_config.h b/config/rte_config.h index fd6f8a2f1a..924192c71c 100644 --- a/config/rte_config.h +++ b/config/rte_config.h @@ -65,8 +65,8 @@ #define RTE_MBUF_DEFAULT_MEMPOOL_OPS "ring_mp_mc" /* ether defines */ -#define RTE_MAX_QUEUES_PER_PORT 1024 -#define RTE_ETHDEV_QUEUE_STAT_CNTRS 16 /* max 256 */ +#define RTE_MAX_QUEUES_PER_PORT 1 /* default 1024 */ +#define RTE_ETHDEV_QUEUE_STAT_CNTRS 1 /* max 256, default 16 */ #define RTE_ETHDEV_RXTX_CALLBACKS 1 #define RTE_MAX_MULTI_HOST_CTRLS 4 diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 1f7c0d77d5..855c3aff2d 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -842,6 +842,10 @@ static int bnxt_alloc_prev_ring_stats(struct bnxt *bp) return -ENOMEM; } +#if defined(RTE_TOOLCHAIN_GCC) +#pragma GCC push_options +#pragma GCC optimize("no-peel-loops") +#endif static int bnxt_start_nic(struct bnxt *bp) { struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(bp->eth_dev); @@ -1006,6 +1010,9 @@ static int bnxt_start_nic(struct bnxt *bp) return rc; } +#if defined(RTE_TOOLCHAIN_GCC) +#pragma GCC pop_options +#endif static int bnxt_shutdown_nic(struct bnxt *bp) { diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index d61eaad2de..e6bb4846ae 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -1860,6 +1860,10 @@ eth_igb_tx_descriptor_status(void *tx_queue, uint16_t offset) return RTE_ETH_TX_DESC_FULL; } +#if defined(RTE_TOOLCHAIN_GCC) +#pragma GCC push_options +#pragma GCC optimize("no-peel-loops") +#endif void igb_dev_clear_queues(struct rte_eth_dev *dev) { @@ -1885,6 +1889,9 @@ igb_dev_clear_queues(struct rte_eth_dev *dev) } } } +#if defined(RTE_TOOLCHAIN_GCC) +#pragma GCC pop_options +#endif void igb_dev_free_queues(struct rte_eth_dev *dev) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index 9c013e0419..eda8734844 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -103,6 +103,10 @@ fs_dev_configure(struct rte_eth_dev *dev) return 0; } +#if defined(RTE_TOOLCHAIN_GCC) +#pragma GCC push_options +#pragma GCC optimize("no-peel-loops") +#endif static void fs_set_queues_state_start(struct rte_eth_dev *dev) { @@ -123,6 +127,9 @@ fs_set_queues_state_start(struct rte_eth_dev *dev) RTE_ETH_QUEUE_STATE_STARTED; } } +#if defined(RTE_TOOLCHAIN_GCC) +#pragma GCC pop_options +#endif static int fs_dev_start(struct rte_eth_dev *dev) @@ -171,6 +178,10 @@ fs_dev_start(struct rte_eth_dev *dev) return 0; } +#if defined(RTE_TOOLCHAIN_GCC) +#pragma GCC push_options +#pragma GCC optimize("no-peel-loops") +#endif static void fs_set_queues_state_stop(struct rte_eth_dev *dev) { @@ -185,6 +196,9 @@ fs_set_queues_state_stop(struct rte_eth_dev *dev) dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; } +#if defined(RTE_TOOLCHAIN_GCC) +#pragma GCC pop_options +#endif static int fs_dev_stop(struct rte_eth_dev *dev) diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c index 5941b966e0..23e507af8e 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -1299,6 +1299,10 @@ hns3_init_queues(struct hns3_adapter *hns, bool reset_queue) return ret; } +#if defined(RTE_TOOLCHAIN_GCC) +#pragma GCC push_options +#pragma GCC optimize("no-peel-loops") +#endif void hns3_start_tqps(struct hns3_hw *hw) { @@ -1322,6 +1326,9 @@ hns3_start_tqps(struct hns3_hw *hw) RTE_ETH_QUEUE_STATE_STARTED; } } +#if defined(RTE_TOOLCHAIN_GCC) +#pragma GCC pop_options +#endif void hns3_stop_tqps(struct hns3_hw *hw) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index ab37c37469..895d6e7169 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -3385,7 +3385,8 @@ ixgbe_dev_stats_get(struct r
[PATCH dpdk 2/2] net/ipv6: fix out-of-bounds read
Fix the following out-of-bounds read in rte_ipv6_addr_mask() reported by Coverity: 83 static inline void 84 rte_ipv6_addr_mask(struct rte_ipv6_addr *ip, uint8_t depth) 85 { 1. Condition depth < 128 /* 16 * 8 */, taking true branch. 2. cond_at_most: Checking depth < 128 implies that depth may be up to 127 on the true branch. 86if (depth < RTE_IPV6_MAX_DEPTH) { 3. assignment: Assigning: d = depth / 8. The value of d may now be up to 15. 87uint8_t d = depth / 8; 88uint8_t mask = ~(UINT8_MAX >> (depth % 8)); 89ip->a[d] &= mask; 4. incr: Incrementing d. The value of d may now be up to 16. 90d++; CID 446754: (#1 of 1): Out-of-bounds read (OVERRUN) 5. overrun-local: Overrunning array of 16 bytes at byte offset 16 by dereferencing pointer &ip->a[d]. 91memset(&ip->a[d], 0, sizeof(*ip) - d); 92} 93 } Use a simple loop instead of memset. Coverity issue: 446754 Fixes: ca786def84ca ("net: add IPv6 address structure and utils") Signed-off-by: Robin Jarry --- lib/net/rte_ip6.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/net/rte_ip6.h b/lib/net/rte_ip6.h index c015c977573d..3843fb7c2fd6 100644 --- a/lib/net/rte_ip6.h +++ b/lib/net/rte_ip6.h @@ -88,7 +88,8 @@ rte_ipv6_addr_mask(struct rte_ipv6_addr *ip, uint8_t depth) uint8_t mask = ~(UINT8_MAX >> (depth % CHAR_BIT)); ip->a[d] &= mask; d++; - memset(&ip->a[d], 0, sizeof(*ip) - d); + while (d < sizeof(*ip)) + ip->a[d++] = 0; } } -- 2.47.0
[PATCH v3 4/5] net/mlx5: add flow rule insertion by index with pattern
Implement rte_flow_async_create_by_index_with_pattern() function. Rework the driver implementation to reduce code duplication by providing a single flow insertion routine, that can be called with different parameters depending on the insertion type. Signed-off-by: Alexander Kozyrev --- doc/guides/rel_notes/release_24_11.rst | 2 + drivers/net/mlx5/mlx5_flow_hw.c| 281 +++-- 2 files changed, 83 insertions(+), 200 deletions(-) diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst index fa4822d928..07a8435b19 100644 --- a/doc/guides/rel_notes/release_24_11.rst +++ b/doc/guides/rel_notes/release_24_11.rst @@ -247,6 +247,8 @@ New Features Added ability for node to advertise and update multiple xstat counters, that can be retrieved using ``rte_graph_cluster_stats_get``. +* **Updated NVIDIA MLX5 net driver.** + * Added rte_flow_async_create_by_index_with_pattern() support. Removed Items - diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index c236831e21..412d927efb 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -335,18 +335,13 @@ static __rte_always_inline uint32_t flow_hw_tx_tag_regc_value(struct rte_eth_dev static int flow_hw_async_create_validate(struct rte_eth_dev *dev, const uint32_t queue, const struct rte_flow_template_table *table, +enum rte_flow_table_insertion_type insertion_type, +const uint32_t rule_index, const struct rte_flow_item items[], const uint8_t pattern_template_index, const struct rte_flow_action actions[], const uint8_t action_template_index, struct rte_flow_error *error); -static int flow_hw_async_create_by_index_validate(struct rte_eth_dev *dev, - const uint32_t queue, - const struct rte_flow_template_table *table, - const uint32_t rule_index, - const struct rte_flow_action actions[], - const uint8_t action_template_index, - struct rte_flow_error *error); static int flow_hw_async_update_validate(struct rte_eth_dev *dev, const uint32_t queue, const struct rte_flow_hw *flow, @@ -3884,6 +3879,12 @@ flow_hw_get_rule_items(struct rte_eth_dev *dev, * The queue to create the flow. * @param[in] attr * Pointer to the flow operation attributes. + * @param[in] table + * Pointer to the template table. + * @param[in] insertion_type + * Insertion type for flow rules. + * @param[in] rule_index + * The item pattern flow follows from the table. * @param[in] items * Items with flow spec value. * @param[in] pattern_template_index @@ -3900,17 +3901,19 @@ flow_hw_get_rule_items(struct rte_eth_dev *dev, * @return *Flow pointer on success, NULL otherwise and rte_errno is set. */ -static struct rte_flow * -flow_hw_async_flow_create(struct rte_eth_dev *dev, - uint32_t queue, - const struct rte_flow_op_attr *attr, - struct rte_flow_template_table *table, - const struct rte_flow_item items[], - uint8_t pattern_template_index, - const struct rte_flow_action actions[], - uint8_t action_template_index, - void *user_data, - struct rte_flow_error *error) +static __rte_always_inline struct rte_flow * +flow_hw_async_flow_create_generic(struct rte_eth_dev *dev, + uint32_t queue, + const struct rte_flow_op_attr *attr, + struct rte_flow_template_table *table, + enum rte_flow_table_insertion_type insertion_type, + uint32_t rule_index, + const struct rte_flow_item items[], + uint8_t pattern_template_index, + const struct rte_flow_action actions[], + uint8_t action_template_index, + void *user_data, + struct rte_flow_error *error) { struct mlx5_priv *priv = dev->data->dev_private; struct mlx5dr_rule_attr rule_attr = { @@ -3
[PATCH v3 2/5] net/mlx5/hws: introduce jump to matcher action
From: Hamdan Igbaria Introduce jump to matcher action, this action will allow jumping to another matcher. For now this jump restricted to STE array matchers and matchers of size 1. Signed-off-by: Hamdan Igbaria --- drivers/net/mlx5/hws/mlx5dr.h| 29 ++ drivers/net/mlx5/hws/mlx5dr_action.c | 87 +++- drivers/net/mlx5/hws/mlx5dr_action.h | 3 + drivers/net/mlx5/hws/mlx5dr_debug.c | 1 + 4 files changed, 117 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h index 8a1a389a3f..1b58eeb2c7 100644 --- a/drivers/net/mlx5/hws/mlx5dr.h +++ b/drivers/net/mlx5/hws/mlx5dr.h @@ -52,6 +52,7 @@ enum mlx5dr_action_type { MLX5DR_ACTION_TYP_POP_IPV6_ROUTE_EXT, MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT, MLX5DR_ACTION_TYP_NAT64, + MLX5DR_ACTION_TYP_JUMP_TO_MATCHER, MLX5DR_ACTION_TYP_MAX, }; @@ -287,6 +288,10 @@ struct mlx5dr_rule_action { uint32_t offset; enum mlx5dr_action_aso_ct_flags direction; } aso_ct; + + struct { + uint32_t offset; + } jump_to_matcher; }; }; @@ -304,6 +309,15 @@ struct mlx5dr_action_dest_attr { } reformat; }; +enum mlx5dr_action_jump_to_matcher_type { + MLX5DR_ACTION_JUMP_TO_MATCHER_BY_INDEX, +}; + +struct mlx5dr_action_jump_to_matcher_attr { + enum mlx5dr_action_jump_to_matcher_type type; + struct mlx5dr_matcher *matcher; +}; + union mlx5dr_crc_encap_entropy_hash_ip_field { uint8_t ipv6_addr[16]; struct { @@ -938,6 +952,21 @@ mlx5dr_action_create_nat64(struct mlx5dr_context *ctx, struct mlx5dr_action_nat64_attr *attr, uint32_t flags); +/* Create direct rule jump to matcher action. + * + * @param[in] ctx + * The context in which the new action will be created. + * @param[in] attr + * The relevant attribute of the action. + * @param[in] flags + * Action creation flags. (enum mlx5dr_action_flags) + * @return pointer to mlx5dr_action on success NULL otherwise. + */ +struct mlx5dr_action * +mlx5dr_action_create_jump_to_matcher(struct mlx5dr_context *ctx, +struct mlx5dr_action_jump_to_matcher_attr *attr, +uint32_t flags); + /* Destroy direct rule action. * * @param[in] action diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c index 3fceb96de2..3412a96894 100644 --- a/drivers/net/mlx5/hws/mlx5dr_action.c +++ b/drivers/net/mlx5/hws/mlx5dr_action.c @@ -42,7 +42,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_ BIT(MLX5DR_ACTION_TYP_TIR) | BIT(MLX5DR_ACTION_TYP_DROP) | BIT(MLX5DR_ACTION_TYP_DEST_ROOT) | - BIT(MLX5DR_ACTION_TYP_DEST_ARRAY), + BIT(MLX5DR_ACTION_TYP_DEST_ARRAY) | + BIT(MLX5DR_ACTION_TYP_JUMP_TO_MATCHER), BIT(MLX5DR_ACTION_TYP_LAST), }, [MLX5DR_TABLE_TYPE_NIC_TX] = { @@ -62,7 +63,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_ BIT(MLX5DR_ACTION_TYP_TBL) | BIT(MLX5DR_ACTION_TYP_MISS) | BIT(MLX5DR_ACTION_TYP_DROP) | - BIT(MLX5DR_ACTION_TYP_DEST_ROOT), + BIT(MLX5DR_ACTION_TYP_DEST_ROOT) | + BIT(MLX5DR_ACTION_TYP_JUMP_TO_MATCHER), BIT(MLX5DR_ACTION_TYP_LAST), }, [MLX5DR_TABLE_TYPE_FDB] = { @@ -88,7 +90,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_ BIT(MLX5DR_ACTION_TYP_VPORT) | BIT(MLX5DR_ACTION_TYP_DROP) | BIT(MLX5DR_ACTION_TYP_DEST_ROOT) | - BIT(MLX5DR_ACTION_TYP_DEST_ARRAY), + BIT(MLX5DR_ACTION_TYP_DEST_ARRAY) | + BIT(MLX5DR_ACTION_TYP_JUMP_TO_MATCHER), BIT(MLX5DR_ACTION_TYP_LAST), }, }; @@ -1091,6 +1094,13 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action, attr->action_offset = MLX5DR_ACTION_OFFSET_DW5; attr->reparse_mode = MLX5_IFC_STC_REPARSE_ALWAYS; break; + case MLX5DR_ACTION_TYP_JUMP_TO_MATCHER: + attr->action_type = MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_STE_TABLE; + attr->action_offset = MLX5DR_ACTION_OFFSET_HIT; + attr->ste_table.ste = action->jump_to_matcher.matcher->match_ste.ste; + attr->ste_table.ste_pool = action->jump_to_matcher.matcher->match_ste.pool; + attr->ste_table.match_definer_id = action->ctx->caps->trivial_match_definer; + break; default: DR_LOG(ERR, "Invalid action type %d", action->type); assert(false); @@ -3078,6 +3088,57 @@
Re: [PATCH] net/ixgbe: fix per-queue stats for less queues
On Thu, Oct 24, 2024 at 05:15:10PM +0200, Morten Brørup wrote: > Forwarding to the now official maintainers for review. :-) > > Thank you for updating the MAINTAINERS file, Bruce. > > PS: Please correct "fix"->"support" in the subject when merging, it was a > typo. > > > From: Morten Brørup [mailto:m...@smartsharesystems.com] > > Sent: Thursday, 24 October 2024 13.18 > > > > Remove the requirement that the configured number of queues to provide > > statistics for (RTE_ETHDEV_QUEUE_STAT_CNTRS) cannot be less than the > > driver's max supported number of the same (IXGBE_QUEUE_STAT_COUNTERS). > > > > Signed-off-by: Morten Brørup > > --- > > drivers/net/ixgbe/ixgbe_ethdev.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c > > b/drivers/net/ixgbe/ixgbe_ethdev.c > > index ab37c37469..895d6e7169 100644 > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > > @@ -3385,7 +3385,8 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, > > struct rte_eth_stats *stats) > > stats->opackets = hw_stats->gptc; > > stats->obytes = hw_stats->gotc; > > > > - for (i = 0; i < IXGBE_QUEUE_STAT_COUNTERS; i++) { > > + for (i = 0; i < RTE_MIN(IXGBE_QUEUE_STAT_COUNTERS, > > + > > (typeof(IXGBE_QUEUE_STAT_COUNTERS))RTE_ETHDEV_QUEUE_STAT_CNTRS); > > i++) { The big cast using "typeof" is awkward-looking but is probably the best way to do this! Thanks. Acked-by: Bruce Richardson > > stats->q_ipackets[i] = hw_stats->qprc[i]; > > stats->q_opackets[i] = hw_stats->qptc[i]; > > stats->q_ibytes[i] = hw_stats->qbrc[i]; > > -- > > 2.43.0 >
[PATCH v4 2/4] hash: add dynamic polynomial calculation
Current polynomial table has the following limitations: 1. It has polynomials up to degree 16 2. For each degree there are only 4 polynomials The above results in less entropy when generating Toeplitz hash key subsequences. This patch replaces the current static table approach with dynamic polynomial calculation for polynomials of degree 7 or higher, resulting in better entropy of generated RSS hash key. Signed-off-by: Vladimir Medvedkin --- lib/hash/meson.build | 1 + lib/hash/rte_thash.c | 44 + lib/hash/rte_thash.h | 13 ++ lib/hash/rte_thash_gf2_poly_math.c | 260 + lib/hash/version.map | 1 + 5 files changed, 280 insertions(+), 39 deletions(-) create mode 100644 lib/hash/rte_thash_gf2_poly_math.c diff --git a/lib/hash/meson.build b/lib/hash/meson.build index 277eb9fa93..7ce504ee8b 100644 --- a/lib/hash/meson.build +++ b/lib/hash/meson.build @@ -23,6 +23,7 @@ sources = files( 'rte_fbk_hash.c', 'rte_thash.c', 'rte_thash_gfni.c', +'rte_thash_gf2_poly_math.c', ) deps += ['net'] diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c index 463992368a..da35aec860 100644 --- a/lib/hash/rte_thash.c +++ b/lib/hash/rte_thash.c @@ -31,33 +31,6 @@ static struct rte_tailq_elem rte_thash_tailq = { }; EAL_REGISTER_TAILQ(rte_thash_tailq) -/** - * Table of some irreducible polinomials over GF(2). - * For lfsr they are represented in BE bit order, and - * x^0 is masked out. - * For example, poly x^5 + x^2 + 1 will be represented - * as (101001b & 1b) = 01001b = 0x9 - */ -static const uint32_t irreducible_poly_table[][4] = { - {0, 0, 0, 0}, /** < degree 0 */ - {1, 1, 1, 1}, /** < degree 1 */ - {0x3, 0x3, 0x3, 0x3}, /** < degree 2 and so on... */ - {0x5, 0x3, 0x5, 0x3}, - {0x9, 0x3, 0x9, 0x3}, - {0x9, 0x1b, 0xf, 0x5}, - {0x21, 0x33, 0x1b, 0x2d}, - {0x41, 0x11, 0x71, 0x9}, - {0x71, 0xa9, 0xf5, 0x8d}, - {0x21, 0xd1, 0x69, 0x1d9}, - {0x81, 0x2c1, 0x3b1, 0x185}, - {0x201, 0x541, 0x341, 0x461}, - {0x941, 0x609, 0xe19, 0x45d}, - {0x1601, 0x1f51, 0x1171, 0x359}, - {0x2141, 0x2111, 0x2db1, 0x2109}, - {0x4001, 0x801, 0x101, 0x7301}, - {0x7781, 0xa011, 0x4211, 0x86d9}, -}; - struct thash_lfsr { uint32_tref_cnt; uint32_tpoly; @@ -159,13 +132,6 @@ get_rev_bit_lfsr(struct thash_lfsr *lfsr) return ret; } -static inline uint32_t -thash_get_rand_poly(uint32_t poly_degree) -{ - return irreducible_poly_table[poly_degree][rte_rand() % - RTE_DIM(irreducible_poly_table[poly_degree])]; -} - static inline uint32_t get_rev_poly(uint32_t poly, int degree) { @@ -191,19 +157,19 @@ get_rev_poly(uint32_t poly, int degree) } static struct thash_lfsr * -alloc_lfsr(struct rte_thash_ctx *ctx) +alloc_lfsr(uint32_t poly_degree) { struct thash_lfsr *lfsr; uint32_t i; - if (ctx == NULL) + if ((poly_degree > 32) || (poly_degree == 0)) return NULL; lfsr = rte_zmalloc(NULL, sizeof(struct thash_lfsr), 0); if (lfsr == NULL) return NULL; - lfsr->deg = ctx->reta_sz_log; + lfsr->deg = poly_degree; lfsr->poly = thash_get_rand_poly(lfsr->deg); do { lfsr->state = rte_rand() & ((1 << lfsr->deg) - 1); @@ -484,7 +450,7 @@ insert_before(struct rte_thash_ctx *ctx, int ret; if (end < cur_ent->offset) { - ent->lfsr = alloc_lfsr(ctx); + ent->lfsr = alloc_lfsr(ctx->reta_sz_log); if (ent->lfsr == NULL) { rte_free(ent); return -ENOMEM; @@ -637,7 +603,7 @@ rte_thash_add_helper(struct rte_thash_ctx *ctx, const char *name, uint32_t len, continue; } - ent->lfsr = alloc_lfsr(ctx); + ent->lfsr = alloc_lfsr(ctx->reta_sz_log); if (ent->lfsr == NULL) { rte_free(ent); return -ENOMEM; diff --git a/lib/hash/rte_thash.h b/lib/hash/rte_thash.h index 80313705a1..a8fda72896 100644 --- a/lib/hash/rte_thash.h +++ b/lib/hash/rte_thash.h @@ -108,6 +108,19 @@ union rte_thash_tuple { struct rte_ipv6_tuple v6; }; +/** @internal + * @brief Generates a random polynomial + * + * @param poly_degree + * degree of the polynomial + * + * @return + * random polynomial + */ +__rte_internal +uint32_t +thash_get_rand_poly(uint32_t poly_degree); + /** * Prepare special converted key to use with rte_softrss_be() * @param orig diff --git a/lib/hash/rte_thash_gf2_poly_math.c b/lib/hash/rte_thash_gf2_poly_math.c new file mode 100644 index 00..1c62974e71 --- /dev/null +++ b/lib/hash/rte_thash_gf2_poly_math.c @@ -0,0 +1,260 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Intel Corporation + */ +#include +#include +#include +#include
[PATCH v4 0/4] RSS hash key generation
Currently there are 2 methods to get the RSS hash key. The first method is to randomly generate it. The second one is to use well known RSS hash keys. Both methods have drawbacks. The first method not always provides a good hash distribution. The second one does, but not for all ReTa sizes and not for all traffic types. Additionaly, since these RSS hash keys are well known, they could potentially be vulnerable to hash-collision DoS attacks. The proposed API could be used to address both of these issues - the key can be randomy generated and tailored to specific traffic profile distribution. For example, if we know that we are receiving flows where source/destination addresses are fixed or limited to a small quantity, but source port has good distribution, we could generate an RSS key that will give us good distribution across our ReTa. v4 - address some comments - update release notes - rebase to current version v3 - change rte_thash_gen_key() arguments types v2 - fix some minor issues Vladimir Medvedkin (4): thash: add RSS hash key generation API hash: add dynamic polynomial calculation hash: implement RSS hash key generation API test/thash: add tests for RSS key generation API app/test/test_thash.c | 108 ++ doc/guides/rel_notes/release_24_11.rst | 3 + lib/hash/meson.build | 1 + lib/hash/rte_thash.c | 70 +++ lib/hash/rte_thash.h | 37 lib/hash/rte_thash_gf2_poly_math.c | 260 + lib/hash/version.map | 3 + 7 files changed, 443 insertions(+), 39 deletions(-) create mode 100644 lib/hash/rte_thash_gf2_poly_math.c -- 2.43.0
[PATCH v4 4/4] test/thash: add tests for RSS key generation API
This patch adds tests for RSS key generation. In this test we measure distribution of hash LSBs for a given random tuple where only some part of bits is variable. At first we generate random hash key and measure the worst distribution for a given ReTa size value (RETA_SZ_LOG). Then we adjust the key with the new API and run the test again, noting the new distribution. Finally, we also measure said distribution for some well known RSS hash key which is used in some PMDs. Signed-off-by: Vladimir Medvedkin --- app/test/test_thash.c | 108 ++ 1 file changed, 108 insertions(+) diff --git a/app/test/test_thash.c b/app/test/test_thash.c index 0ad6943cf8..b9c6e9118e 100644 --- a/app/test/test_thash.c +++ b/app/test/test_thash.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "test.h" @@ -923,6 +924,112 @@ test_adjust_tuple_mult_reta(void) return TEST_SUCCESS; } +#define RETA_SZ_LOG11 +#define RSS_KEY_SZ 40 +#define RETA_SZ(1 << RETA_SZ_LOG) +#define NB_HASH_ITER RETA_SZ +#define NB_TEST_ITER 10 + +static inline void +run_hash_calc_loop(uint8_t *key, union rte_thash_tuple *tuple, + unsigned int *rss_reta_hits) +{ + uint32_t rss_hash; + int i; + + for (i = 0; i < NB_HASH_ITER; i++) { + /* variable part starts from the most significant bit */ + tuple->v4.dport = (i << (sizeof(tuple->v4.dport) * CHAR_BIT - + RETA_SZ_LOG)); + /* +* swap sport and dport on LE arch since rte_softrss() +* works with host byte order uint32_t values +*/ + tuple->v4.dport = rte_cpu_to_be_16(tuple->v4.dport); + tuple->v4.sctp_tag = rte_be_to_cpu_32(tuple->v4.sctp_tag); + rss_hash = rte_softrss((uint32_t *)tuple, + RTE_THASH_V4_L4_LEN, key); + /* unroll swap, required only for sport */ + tuple->v4.sctp_tag = rte_cpu_to_be_32(tuple->v4.sctp_tag); + rss_reta_hits[rss_hash & (RETA_SZ - 1)]++; + } +} + +static int +hash_calc_iteration(unsigned int *min_before, unsigned int *max_before, + unsigned int *min_after, unsigned int *max_after, + unsigned int *min_default, unsigned int *max_default) +{ + uint8_t key[RSS_KEY_SZ] = {0}; + union rte_thash_tuple tuple; + unsigned int rss_reta_hits_before_adjust[RETA_SZ] = {0}; + unsigned int rss_reta_hits_after_adjust[RETA_SZ] = {0}; + unsigned int rss_reta_hits_default_key[RETA_SZ] = {0}; + int i; + + for (i = 0; i < RSS_KEY_SZ; i++) + key[i] = rte_rand(); + + tuple.v4.src_addr = rte_rand(); + tuple.v4.dst_addr = rte_rand(); + tuple.v4.sport = rte_rand(); + + run_hash_calc_loop(key, &tuple, rss_reta_hits_before_adjust); + + int ret = rte_thash_gen_key(key, RSS_KEY_SZ, RETA_SZ_LOG, + offsetof(union rte_thash_tuple, v4.dport)*CHAR_BIT, + RETA_SZ_LOG); + + if (ret) { + printf("Can't generate key\n"); + return -1; + } + + run_hash_calc_loop(key, &tuple, rss_reta_hits_after_adjust); + + run_hash_calc_loop(default_rss_key, &tuple, rss_reta_hits_default_key); + + for (i = 0; i < RETA_SZ; i++) { + *min_before = RTE_MIN(*min_before, rss_reta_hits_before_adjust[i]); + *max_before = RTE_MAX(*max_before, rss_reta_hits_before_adjust[i]); + *min_after = RTE_MIN(*min_after, rss_reta_hits_after_adjust[i]); + *max_after = RTE_MAX(*max_after, rss_reta_hits_after_adjust[i]); + *min_default = RTE_MIN(*min_default, rss_reta_hits_default_key[i]); + *max_default = RTE_MAX(*max_default, rss_reta_hits_default_key[i]); + } + + return 0; +} + +static int +test_keygen(void) +{ + int i, ret; + unsigned int min_before = UINT32_MAX; + unsigned int min_after = UINT32_MAX; + unsigned int min_default = UINT32_MAX; + unsigned int max_before = 0; + unsigned int max_after = 0; + unsigned int max_default = 0; + + for (i = 0; i < NB_TEST_ITER; i++) { + /* calculates the worst distribution for each key */ + ret = hash_calc_iteration(&min_before, &max_before, &min_after, + &max_after, &min_default, &max_default); + if (ret) + return ret; + } + + printf("RSS before key adjustment: min=%d, max=%d\n", + min_before, max_before); + printf("RSS after key adjustment: min=%d, max=%d\n", + min_after, max_after); + printf("RSS default key: min=%d, max=%d\n", + min_default, max_default); + + return TEST_SUCCESS; +} + static struct unit_test_suite t
[PATCH v4 3/4] hash: implement RSS hash key generation API
This patch implements Toeplitz hash key generation function using the new polynomial generation function. Signed-off-by: Vladimir Medvedkin --- doc/guides/rel_notes/release_24_11.rst | 3 +++ lib/hash/rte_thash.c | 23 ++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst index fa4822d928..9d00a2e1c2 100644 --- a/doc/guides/rel_notes/release_24_11.rst +++ b/doc/guides/rel_notes/release_24_11.rst @@ -247,6 +247,9 @@ New Features Added ability for node to advertise and update multiple xstat counters, that can be retrieved using ``rte_graph_cluster_stats_get``. +* **Added RSS hash key generating API.** + A new function ``rte_thash_gen_key`` is provided to modify the RSS hash key + to achieve better traffic distribution with RSS. Removed Items - diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c index da35aec860..336c228e64 100644 --- a/lib/hash/rte_thash.c +++ b/lib/hash/rte_thash.c @@ -827,11 +827,24 @@ int rte_thash_gen_key(uint8_t *key, size_t key_len, size_t reta_sz_log, uint32_t entropy_start, size_t entropy_sz) { - RTE_SET_USED(key); - RTE_SET_USED(key_len); - RTE_SET_USED(reta_sz_log); - RTE_SET_USED(entropy_start); - RTE_SET_USED(entropy_sz); + size_t i, end, start; + + /* define lfsr sequence range*/ + end = entropy_start + entropy_sz + TOEPLITZ_HASH_LEN - 1; + start = end - (entropy_sz + reta_sz_log - 1); + + if ((key == NULL) || (key_len * CHAR_BIT < entropy_start + entropy_sz) || + (entropy_sz < reta_sz_log) || (reta_sz_log > TOEPLITZ_HASH_LEN)) + return -EINVAL; + + struct thash_lfsr *lfsr = alloc_lfsr(reta_sz_log); + if (lfsr == NULL) + return -ENOMEM; + + for (i = start; i < end; i++) + set_bit(key, get_bit_lfsr(lfsr), i); + + free_lfsr(lfsr); return 0; } -- 2.43.0
[PATCH v2] net/ixgbe: support per-queue stats for fewer queues
Remove the requirement that the configured number of queues to provide statistics for (RTE_ETHDEV_QUEUE_STAT_CNTRS) cannot be less than the driver's max supported number of the same (IXGBE_QUEUE_STAT_COUNTERS). Signed-off-by: Morten Brørup --- v2: * Fix subject. (Bruce Richardson) * Simplify type cast. (Bruce Richardson, Stephen Hemminger) --- drivers/net/ixgbe/ixgbe_ethdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index ab37c37469..09d648af6d 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -3385,7 +3385,8 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) stats->opackets = hw_stats->gptc; stats->obytes = hw_stats->gotc; - for (i = 0; i < IXGBE_QUEUE_STAT_COUNTERS; i++) { + for (i = 0; i < RTE_MIN_T(IXGBE_QUEUE_STAT_COUNTERS, + RTE_ETHDEV_QUEUE_STAT_CNTRS, typeof(i)); i++) { stats->q_ipackets[i] = hw_stats->qprc[i]; stats->q_opackets[i] = hw_stats->qptc[i]; stats->q_ibytes[i] = hw_stats->qbrc[i]; -- 2.43.0
Re: [PATCH v4 1/4] thash: add RSS hash key generation API
On Thu, 24 Oct 2024 18:46:53 + Vladimir Medvedkin wrote: > Currently the only way to have non static Toeplitz hash key is to > generate it randomly. Such a key may not guarantee good packets > distribution, especially if there are small number of flows. > > This patch adds stub implementation of the Toeplitz hash key generation > function, which may improve Toeplitz hash key with respect to hash values > distribution. > > Signed-off-by: Vladimir Medvedkin Acked-by: Stephen Hemminger
[PATCH v28 07/13] log: rework syslog handling
Refactor how syslog is handled, make it common to Linux and FreeBSD The syslog facility property is better handled in lib/log rather than in eal. This also add syslog support to FreeBSD. Log to syslog only if option is specified. If no --syslog is given then use console only. Signed-off-by: Stephen Hemminger Acked-by: Morten Brørup Acked-by: Bruce Richardson Acked-by: Chengwen Feng --- app/test/test_eal_flags.c | 16 +-- .../freebsd_gsg/freebsd_eal_parameters.rst| 27 + .../prog_guide/env_abstraction_layer.rst | 6 +- doc/guides/prog_guide/log_lib.rst | 5 +- lib/eal/common/eal_common_options.c | 57 ++ lib/eal/common/eal_internal_cfg.h | 1 - lib/eal/freebsd/eal.c | 5 +- lib/eal/linux/eal.c | 12 +-- lib/eal/windows/eal.c | 6 +- lib/log/log.c | 45 lib/log/log_freebsd.c | 12 --- lib/log/log_internal.h| 11 +- lib/log/log_linux.c | 61 --- lib/log/log_private.h | 25 + lib/log/log_syslog.c | 100 ++ lib/log/log_windows.c | 18 lib/log/meson.build | 6 +- lib/log/version.map | 2 +- 18 files changed, 211 insertions(+), 204 deletions(-) delete mode 100644 lib/log/log_freebsd.c delete mode 100644 lib/log/log_linux.c create mode 100644 lib/log/log_private.h create mode 100644 lib/log/log_syslog.c delete mode 100644 lib/log/log_windows.c diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c index 71d8dba731..9fcf0d56e6 100644 --- a/app/test/test_eal_flags.c +++ b/app/test/test_eal_flags.c @@ -985,12 +985,12 @@ test_misc_flags(void) /* With -v */ const char *argv2[] = {prgname, prefix, mp_flag, "-v"}; /* With valid --syslog */ - const char *argv3[] = {prgname, prefix, mp_flag, - "--syslog", "syslog"}; - /* With empty --syslog (should fail) */ + const char *argv3[] = {prgname, prefix, mp_flag, "--syslog=user"}; + /* With empty --syslog (now defaults) */ const char *argv4[] = {prgname, prefix, mp_flag, "--syslog"}; /* With invalid --syslog */ - const char *argv5[] = {prgname, prefix, mp_flag, "--syslog", "error"}; + const char *argv5[] = {prgname, prefix, mp_flag, "--syslog=invalid"}; + /* With no-sh-conf, also use no-huge to ensure this test runs on BSD */ const char *argv6[] = {prgname, "-m", DEFAULT_MEM_SIZE, no_shconf, nosh_prefix, no_huge}; @@ -1080,15 +1080,15 @@ test_misc_flags(void) #endif if (launch_proc(argv3) != 0) { - printf("Error - process did not run ok with --syslog flag\n"); + printf("Error - process did not run ok with --syslog=user flag\n"); goto fail; } - if (launch_proc(argv4) == 0) { - printf("Error - process run ok with empty --syslog flag\n"); + if (launch_proc(argv4) != 0) { + printf("Error - process did not run ok with --syslog flag\n"); goto fail; } if (launch_proc(argv5) == 0) { - printf("Error - process run ok with invalid --syslog flag\n"); + printf("Error - process run ok with --syslog=invalid flag\n"); goto fail; } if (launch_proc(argv7) != 0) { diff --git a/doc/guides/freebsd_gsg/freebsd_eal_parameters.rst b/doc/guides/freebsd_gsg/freebsd_eal_parameters.rst index fba467a2ce..9270d9fa3b 100644 --- a/doc/guides/freebsd_gsg/freebsd_eal_parameters.rst +++ b/doc/guides/freebsd_gsg/freebsd_eal_parameters.rst @@ -18,3 +18,30 @@ FreeBSD-specific EAL parameters --- There are currently no FreeBSD-specific EAL command-line parameters available. + +Other options +~ + +* ``--syslog `` + +Set syslog facility. Valid syslog facilities are:: + +auth +cron +daemon +ftp +kern +lpr +mail +news +syslog +user +uucp +local0 +local1 +local2 +local3 +local4 +local5 +local6 +local7 diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst index b9fac1839d..9bafa30a0e 100644 --- a/doc/guides/prog_guide/env_abstraction_layer.rst +++ b/doc/guides/prog_guide/env_abstraction_layer.rst @@ -851,9 +851,9 @@ Signal Safety Other functions are not signal safe because they use one or more library routines that are not themselves signal safe. For example, calling ``rte_panic()`` is not safe in a signal handler - because it uses ``rte_log()`` and ``rte_log()`` calls
[PATCH v28 04/13] eal: make eal_log_level_parse common
The code to parse for log-level option should be same on all OS variants. Signed-off-by: Stephen Hemminger Acked-by: Tyler Retzlaff Acked-by: Morten Brørup Acked-by: Bruce Richardson --- lib/eal/common/eal_common_options.c | 40 +++ lib/eal/common/eal_options.h| 1 + lib/eal/freebsd/eal.c | 42 - lib/eal/linux/eal.c | 39 --- lib/eal/windows/eal.c | 35 5 files changed, 41 insertions(+), 116 deletions(-) diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c index f1a5e329a5..eb079a65a9 100644 --- a/lib/eal/common/eal_common_options.c +++ b/lib/eal/common/eal_common_options.c @@ -1640,6 +1640,46 @@ eal_parse_huge_unlink(const char *arg, struct hugepage_file_discipline *out) return -1; } +/* Parse the all arguments looking for log related ones */ +int +eal_log_level_parse(int argc, char * const argv[]) +{ + struct internal_config *internal_conf = eal_get_internal_configuration(); + int option_index, opt; + const int old_optind = optind; + const int old_optopt = optopt; + const int old_opterr = opterr; + char *old_optarg = optarg; +#ifdef RTE_EXEC_ENV_FREEBSD + const int old_optreset = optreset; + optreset = 1; +#endif + + optind = 1; + opterr = 0; + + while ((opt = getopt_long(argc, argv, eal_short_options, + eal_long_options, &option_index)) != EOF) { + + switch (opt) { + case OPT_LOG_LEVEL_NUM: + if (eal_parse_common_option(opt, optarg, internal_conf) < 0) + return -1; + break; + } + } + + /* restore getopt lib */ + optind = old_optind; + optopt = old_optopt; + optarg = old_optarg; + opterr = old_opterr; +#ifdef RTE_EXEC_ENV_FREEBSD + optreset = old_optreset; +#endif + return 0; +} + int eal_parse_common_option(int opt, const char *optarg, struct internal_config *conf) diff --git a/lib/eal/common/eal_options.h b/lib/eal/common/eal_options.h index 3cc9cb6412..f3f2e104f6 100644 --- a/lib/eal/common/eal_options.h +++ b/lib/eal/common/eal_options.h @@ -96,6 +96,7 @@ enum { extern const char eal_short_options[]; extern const struct option eal_long_options[]; +int eal_log_level_parse(int argc, char * const argv[]); int eal_parse_common_option(int opt, const char *argv, struct internal_config *conf); int eal_option_device_parse(void); diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c index 1229230063..d3b40e81d8 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -363,48 +363,6 @@ eal_get_hugepage_mem_size(void) return (size < SIZE_MAX) ? (size_t)(size) : SIZE_MAX; } -/* Parse the arguments for --log-level only */ -static void -eal_log_level_parse(int argc, char **argv) -{ - int opt; - char **argvopt; - int option_index; - const int old_optind = optind; - const int old_optopt = optopt; - const int old_optreset = optreset; - char * const old_optarg = optarg; - struct internal_config *internal_conf = - eal_get_internal_configuration(); - - argvopt = argv; - optind = 1; - optreset = 1; - - while ((opt = getopt_long(argc, argvopt, eal_short_options, - eal_long_options, &option_index)) != EOF) { - - int ret; - - /* getopt is not happy, stop right now */ - if (opt == '?') - break; - - ret = (opt == OPT_LOG_LEVEL_NUM) ? - eal_parse_common_option(opt, optarg, internal_conf) : 0; - - /* common parser is not happy */ - if (ret < 0) - break; - } - - /* restore getopt lib */ - optind = old_optind; - optopt = old_optopt; - optreset = old_optreset; - optarg = old_optarg; -} - /* Parse the argument given in the command line of the application */ static int eal_parse_args(int argc, char **argv) diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index 54577b7718..40d750ed0d 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -546,45 +546,6 @@ eal_parse_vfio_vf_token(const char *vf_token) return -1; } -/* Parse the arguments for --log-level only */ -static void -eal_log_level_parse(int argc, char **argv) -{ - int opt; - char **argvopt; - int option_index; - const int old_optind = optind; - const int old_optopt = optopt; - char * const old_optarg = optarg; - struct internal_config *internal_conf = - eal_get_internal_configuration(); - - argvopt = argv; - optind = 1; - - while ((opt =
RE: [PATCH] net/ixgbe: fix per-queue stats for less queues
Forgot the --in-reply-to, so here's the link to the V2 patch: https://inbox.dpdk.org/dev/20241024185352.987356-1...@smartsharesystems.com/
RE: [PATCH 4/6] crypto/openssl: fix 3DES-CTR with big endian CPUs
> From: David Marchand [mailto:david.march...@redhat.com] > Sent: Thursday, 24 October 2024 15.30 > > On Thu, Oct 24, 2024 at 3:17 PM David Marchand > wrote: > > @@ -1209,14 +1195,16 @@ process_openssl_cipher_des3ctr(struct > rte_mbuf > > *mbuf_src, uint8_t *dst, > > l = rte_pktmbuf_data_len(m) - offset; > > > > memcpy(ctr, iv, 8); > > + host_ctr = rte_be_64_to_cpu(ctr); > > > > for (n = 0; n < srclen; n++) { > > if (n % 8 == 0) { > > + ctr = rte_cpu_to_be_64(host_ctr); > > Moving this here adds one uneeded extra conversion on the first > iteration. > So I would keep the conversion around the host_ctr variable increment, > if you get the idea. > > > > if (EVP_EncryptUpdate(ctx, > > (unsigned char *)&ebuf, > &unused, > > (const unsigned char *)&ctr, > 8) <= 0) > > goto process_cipher_des3ctr_err; > > - ctr_inc(ctr); > > + host_ctr++; > > } > > dst[n] = *(src++) ^ ebuf[n % 8]; > > -- > David Marchand LGTM. For the next version, Acked-by: Morten Brørup
RE: [EXTERNAL] Re: [PATCH] common/cnxk: allow enabling IOVA field in mbuf
>On Thu, Oct 24, 2024 at 04:40:40PM +0530, Jerin Jacob wrote: >> On Mon, Oct 14, 2024 at 4:37 PM Shijith Thotton >wrote: >> > >> > Value of RTE_IOVA_IN_MBUF was always disabled on cnxk platforms, as >IOVA >> > in the mbuf is not required. This change modifies that behavior, >> > allowing RTE_IOVA_IN_MBUF to be enabled if the build option >> > -Denable_iova_as_pa=true is explicitly specified. >> > >> > Signed-off-by: Shijith Thotton >> > --- >> > >> > diff --git a/config/arm/meson.build b/config/arm/meson.build >> > index 012935d5d7..ca54524376 100644 >> > --- a/config/arm/meson.build >> > +++ b/config/arm/meson.build >> > @@ -439,10 +439,7 @@ soc_cn9k = { >> > 'description': 'Marvell OCTEON 9', >> > 'implementer': '0x43', >> > 'part_number': '0xb2', >> > -'numa': false, >> > -'flags': [ >> > -['RTE_IOVA_IN_MBUF', 0] >> > -] >> > +'numa': false >> > } >> > >> > soc_cn10k = { >> > @@ -451,8 +448,7 @@ soc_cn10k = { >> > 'flags': [ >> > ['RTE_MAX_LCORE', 24], >> > ['RTE_MAX_NUMA_NODES', 1], >> > -['RTE_MEMPOOL_ALIGN', 128], >> > -['RTE_IOVA_IN_MBUF', 0] >> > +['RTE_MEMPOOL_ALIGN', 128] >> > ], >> > 'part_number': '0xd49', >> > 'extra_march_features': ['crypto'], >> > diff --git a/drivers/common/cnxk/meson.build >b/drivers/common/cnxk/meson.build >> > index dc2ddf1f20..bba780e750 100644 >> > --- a/drivers/common/cnxk/meson.build >> > +++ b/drivers/common/cnxk/meson.build >> > @@ -108,4 +108,13 @@ deps += ['bus_pci', 'net', 'telemetry'] >> > >> > require_iova_in_mbuf = false >> > >> > +cnxk_socs = ['cn9k', 'cn10k', 'cn20k'] >> > + >> > +# Enable RTE_IOVA_IN_MBUF only if enable_iova_as_pa is set explicitly, >else disable it >> > +if meson.version().version_compare('>=1.1.0') >> > +if '-Denable_iova_as_pa' not in meson.build_options() and soc_type in >cnxk_socs >> > +dpdk_conf.set10('RTE_IOVA_IN_MBUF', false) >> > +endif >> > +endif >> >> Since this is added in driver/common/cnxk, it will be late to decide. >> For example, >> >> Following PMDs will have mis match: >> common - cpt, dpaax, idpf, ionic >> bus - cdx, dpaa, fslmc, ifpga, uacce >> >> I think, this check needs to move up in the chain. @Richardson, Bruce >> Any thoughts on cleanly adding this kind of check in top-level meson >> objects? >> >Can you explain what you mean by a mismatch? > >Can I assume that the common/cnxk is processed before any of these other >drivers? If so, then whatever values or variables set by that meson.build >file can be queried by all the others. > The goal is to change the default value of enable_iova_as_pa to false on CNXK platforms. Jerin pointed out the following issue with the current patch, which causes a mismatch during the default build (enable_iova_as_pa not specified): 1. The configuration initially sets RTE_IOVA_IN_MBUF to 1. 2. Meson proceeds through the lib and driver directories, enabling the build of drivers that require IOVA. 3. When Meson reaches the common/cnxk folder, it sets RTE_IOVA_IN_MBUF to 0. 4. The remaining configuration then disables the build of drivers that depend on IOVA. The problem arises due to the extra PMDs being enabled during step 2. We could avoid this issue by moving the check added in this patch to a top-level Meson file, such as config/arm/meson.build. We would like your feedback on this approach or suggestions for a better alternative. Thanks, Shijith
[PATCH v4] ethdev: TEST support single queue per port
Configuring one queue per port fails compilation on my system. Test to see how much it fails in CI. Signed-off-by: Morten Brørup --- v4: * Workaound GCC optimizer incorrectly throwing a warning in these network drivers: * bnxt * e1000 * failsafe * hns3 v3: * Fix net/ixgbe driver. v2: * Fix net/vmxnet3 driver. --- config/rte_config.h | 4 ++-- drivers/net/bnxt/bnxt_ethdev.c | 3 +++ drivers/net/e1000/igb_rxtx.c | 3 +++ drivers/net/failsafe/failsafe_ops.c | 6 ++ drivers/net/hns3/hns3_rxtx.c | 3 +++ drivers/net/ixgbe/ixgbe_ethdev.c | 3 ++- drivers/net/vmxnet3/vmxnet3_ethdev.c | 32 +--- 7 files changed, 39 insertions(+), 15 deletions(-) diff --git a/config/rte_config.h b/config/rte_config.h index fd6f8a2f1a..924192c71c 100644 --- a/config/rte_config.h +++ b/config/rte_config.h @@ -65,8 +65,8 @@ #define RTE_MBUF_DEFAULT_MEMPOOL_OPS "ring_mp_mc" /* ether defines */ -#define RTE_MAX_QUEUES_PER_PORT 1024 -#define RTE_ETHDEV_QUEUE_STAT_CNTRS 16 /* max 256 */ +#define RTE_MAX_QUEUES_PER_PORT 1 /* default 1024 */ +#define RTE_ETHDEV_QUEUE_STAT_CNTRS 1 /* max 256, default 16 */ #define RTE_ETHDEV_RXTX_CALLBACKS 1 #define RTE_MAX_MULTI_HOST_CTRLS 4 diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 1f7c0d77d5..f34a953ecd 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -842,6 +842,8 @@ static int bnxt_alloc_prev_ring_stats(struct bnxt *bp) return -ENOMEM; } +#pragma GCC push_options +#pragma GCC optimize("no-peel-loops") static int bnxt_start_nic(struct bnxt *bp) { struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(bp->eth_dev); @@ -1006,6 +1008,7 @@ static int bnxt_start_nic(struct bnxt *bp) return rc; } +#pragma GCC pop_options static int bnxt_shutdown_nic(struct bnxt *bp) { diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index d61eaad2de..bcc62011cb 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -1860,6 +1860,8 @@ eth_igb_tx_descriptor_status(void *tx_queue, uint16_t offset) return RTE_ETH_TX_DESC_FULL; } +#pragma GCC push_options +#pragma GCC optimize("no-peel-loops") void igb_dev_clear_queues(struct rte_eth_dev *dev) { @@ -1885,6 +1887,7 @@ igb_dev_clear_queues(struct rte_eth_dev *dev) } } } +#pragma GCC pop_options void igb_dev_free_queues(struct rte_eth_dev *dev) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index 9c013e0419..70862420b8 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -103,6 +103,8 @@ fs_dev_configure(struct rte_eth_dev *dev) return 0; } +#pragma GCC push_options +#pragma GCC optimize("no-peel-loops") static void fs_set_queues_state_start(struct rte_eth_dev *dev) { @@ -123,6 +125,7 @@ fs_set_queues_state_start(struct rte_eth_dev *dev) RTE_ETH_QUEUE_STATE_STARTED; } } +#pragma GCC pop_options static int fs_dev_start(struct rte_eth_dev *dev) @@ -171,6 +174,8 @@ fs_dev_start(struct rte_eth_dev *dev) return 0; } +#pragma GCC push_options +#pragma GCC optimize("no-peel-loops") static void fs_set_queues_state_stop(struct rte_eth_dev *dev) { @@ -185,6 +190,7 @@ fs_set_queues_state_stop(struct rte_eth_dev *dev) dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; } +#pragma GCC pop_options static int fs_dev_stop(struct rte_eth_dev *dev) diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c index 5941b966e0..ad03dcc108 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -1299,6 +1299,8 @@ hns3_init_queues(struct hns3_adapter *hns, bool reset_queue) return ret; } +#pragma GCC push_options +#pragma GCC optimize("no-peel-loops") void hns3_start_tqps(struct hns3_hw *hw) { @@ -1322,6 +1324,7 @@ hns3_start_tqps(struct hns3_hw *hw) RTE_ETH_QUEUE_STATE_STARTED; } } +#pragma GCC pop_options void hns3_stop_tqps(struct hns3_hw *hw) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index ab37c37469..895d6e7169 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -3385,7 +3385,8 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) stats->opackets = hw_stats->gptc; stats->obytes = hw_stats->gotc; - for (i = 0; i < IXGBE_QUEUE_STAT_COUNTERS; i++) { + for (i = 0; i < RTE_MIN(IXGBE_QUEUE_STAT_COUNTERS, + (typeof(IXGBE_QUEUE_STAT_COUNTERS))RTE_ETHDEV_QUEUE_STAT_CNTRS); i++) { stats->q_ipackets[i] = hw_stats->qprc[i]; stats->q_opackets[i] = hw_stats->qptc[i]; stats->q_i
Re: [PATCH v1 1/3] uapi: introduce kernel uAPI headers import
On Thu, 24 Oct 2024 14:45:10 +0200 Maxime Coquelin wrote: > >> > >> > >> Rather than copy-pasting headers_install.sh, could you use it directly? > >> > >> The copy/paste from GPL-2.0 concerns me. > >> And the potential upstream change as well. > >> > > > > The downside I see by calling directly the headers_install.sh script is > > that it could trigger some false positives if the version used for > > import is different from the one used to check. > > > > What we could do it to just do our own sed command if that's really an > > issue, that we would tailor based on our needs. > > > > Others, any thoughts? > > Following the discussion during the DPDK Release status meeting this > morning, I will propose a new version implementing our own sed command, > tailored to only our needs. Or you can just ask original author of the headers_install.sh script. Have done that many times and gotten approval every time when taking stuff out of kernel infrastructure for DPDK.
[PATCH v7] ethdev: TEST support single queue per port
Configuring one queue per port (#define RTE_MAX_QUEUES_PER_PORT 1) fails compilation with e.g.: ../drivers/net/bnxt/bnxt_rxq.c: In function 'bnxt_rx_queue_stop': ../drivers/net/bnxt/bnxt_rxq.c:587:34: error: array subscript 1 is above array bounds of 'uint8_t[1]' {aka 'unsigned char[1]'} [-Werror=array-bounds=] 587 | dev->data->rx_queue_state[q_id] = RTE_ETH_QUEUE_STATE_STOPPED; | ~^~ In file included from ../drivers/net/bnxt/bnxt.h:16, from ../drivers/net/bnxt/bnxt_rxq.c:10: ../lib/ethdev/ethdev_driver.h:168:17: note: while referencing 'rx_queue_state' 168 | uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT]; | ^~ Use the CI to test my ideas to fix this. Signed-off-by: Morten Brørup --- v7: * Introduce __rte_assume(e) in rte_common.h, and use this instead. v6: * Use __attribute__((assume(i < RTE_MAX_QUEUES_PER_PORT))) where the indexing warning occurs, instead of pragma GCC optimize("no-peel-loops") for the entire function. v5: * Wrap GCC optimizer pragmas in if defined(RTE_TOOLCHAIN_GCC). v4: * Workaound GCC optimizer incorrectly throwing a warning in these network drivers: * bnxt * e1000 * failsafe * hns3 v3: * Fix net/ixgbe driver. v2: * Fix net/vmxnet3 driver. --- config/rte_config.h | 4 ++-- drivers/net/bnxt/bnxt_ethdev.c | 2 ++ drivers/net/bnxt/bnxt_rxq.c | 1 + drivers/net/e1000/igb_rxtx.c | 2 ++ drivers/net/failsafe/failsafe_ops.c | 10 +++-- drivers/net/hns3/hns3_rxtx.c | 2 ++ drivers/net/ixgbe/ixgbe_ethdev.c | 3 ++- drivers/net/mana/tx.c| 1 + drivers/net/vmxnet3/vmxnet3_ethdev.c | 32 +--- lib/eal/include/rte_common.h | 11 ++ 10 files changed, 51 insertions(+), 17 deletions(-) diff --git a/config/rte_config.h b/config/rte_config.h index fd6f8a2f1a..924192c71c 100644 --- a/config/rte_config.h +++ b/config/rte_config.h @@ -65,8 +65,8 @@ #define RTE_MBUF_DEFAULT_MEMPOOL_OPS "ring_mp_mc" /* ether defines */ -#define RTE_MAX_QUEUES_PER_PORT 1024 -#define RTE_ETHDEV_QUEUE_STAT_CNTRS 16 /* max 256 */ +#define RTE_MAX_QUEUES_PER_PORT 1 /* default 1024 */ +#define RTE_ETHDEV_QUEUE_STAT_CNTRS 1 /* max 256, default 16 */ #define RTE_ETHDEV_RXTX_CALLBACKS 1 #define RTE_MAX_MULTI_HOST_CTRLS 4 diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 1f7c0d77d5..136e308437 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -910,6 +910,7 @@ static int bnxt_start_nic(struct bnxt *bp) struct bnxt_rx_queue *rxq = bp->rx_queues[j]; if (!rxq->rx_deferred_start) { + __rte_assume(j < RTE_MAX_QUEUES_PER_PORT); bp->eth_dev->data->rx_queue_state[j] = RTE_ETH_QUEUE_STATE_STARTED; rxq->rx_started = true; @@ -930,6 +931,7 @@ static int bnxt_start_nic(struct bnxt *bp) struct bnxt_tx_queue *txq = bp->tx_queues[j]; if (!txq->tx_deferred_start) { + __rte_assume(j < RTE_MAX_QUEUES_PER_PORT); bp->eth_dev->data->tx_queue_state[j] = RTE_ETH_QUEUE_STATE_STARTED; txq->tx_started = true; diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c index 1c25c57ca6..1651c26545 100644 --- a/drivers/net/bnxt/bnxt_rxq.c +++ b/drivers/net/bnxt/bnxt_rxq.c @@ -584,6 +584,7 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id) return -EINVAL; } + __rte_assume(q_id < RTE_MAX_QUEUES_PER_PORT); dev->data->rx_queue_state[q_id] = RTE_ETH_QUEUE_STATE_STOPPED; rxq->rx_started = false; PMD_DRV_LOG_LINE(DEBUG, "Rx queue stopped"); diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index d61eaad2de..4276bb6d31 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -1868,6 +1868,7 @@ igb_dev_clear_queues(struct rte_eth_dev *dev) struct igb_rx_queue *rxq; for (i = 0; i < dev->data->nb_tx_queues; i++) { + __rte_assume(i < RTE_MAX_QUEUES_PER_PORT); txq = dev->data->tx_queues[i]; if (txq != NULL) { igb_tx_queue_release_mbufs(txq); @@ -1877,6 +1878,7 @@ igb_dev_clear_queues(struct rte_eth_dev *dev) } for (i = 0; i < dev->data->nb_rx_queues; i++) { + __rte_assume(i < RTE_MAX_QUEUES_PER_PORT); rxq = dev->data->rx_queues[i]; if (rxq != NULL) { igb_rx_queue_release_mbufs(rxq); diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index 9c013e0419..5321c3385c 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsaf
Re: [v7,9/9] net/zxdh: add zxdh dev configure ops
If you have time, hope you can check if the zxdh driver still needs to be modified. Best regards!
[PATCH 2/6] devtools: forbid use of builtin helpers
Warn on use of any __builtin helpers, but leave it open for EAL (as it is where the abstractions for OS and compiler differences are), and some drivers base code. Signed-off-by: David Marchand --- devtools/checkpatches.sh | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh index d860f19045..4a8591be22 100755 --- a/devtools/checkpatches.sh +++ b/devtools/checkpatches.sh @@ -177,11 +177,12 @@ check_forbidden_additions() { # -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ "$1" || res=1 - # forbid use of non abstracted bit count operations + # forbid use of compiler __builtin_* awk -v FOLDERS="lib drivers app examples" \ - -v EXPRESSIONS='\\<__builtin_(clz|ctz|ffs|popcount)(ll)?\\>' \ + -v SKIP_FILES='lib/eal/ drivers/.*/base/ drivers/.*osdep.h$' \ + -v EXPRESSIONS='\\<__builtin_' \ -v RET_ON_FAIL=1 \ - -v MESSAGE='Using __builtin helpers for bit count operations' \ + -v MESSAGE='Using __builtin helpers, prefer EAL macros' \ -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ "$1" || res=1 -- 2.46.2
[PATCH 0/6] Clean up many __builtin_* in drivers.
Here is a series cleaning up most of uses of __builtin_* helpers in drivers when they have a direct replacement in EAL. checkpatch is extended to forbid new additions. -- David Marchand David Marchand (6): devtools: handle multiple pattern for skipping files devtools: forbid use of builtin helpers common/dpaax: use prefetch macros crypto/openssl: fix 3DES-CTR with big endian CPUs drivers: use branch prediction macros drivers: use bitops API instead of compiler builtins devtools/check-forbidden-tokens.awk | 21 +++-- devtools/checkpatches.sh | 7 --- drivers/bus/fslmc/qbman/include/compat.h | 6 ++ drivers/common/dpaax/compat.h| 6 -- drivers/common/nfp/nfp_platform.h| 4 +++- drivers/crypto/openssl/rte_openssl_pmd.c | 5 +++-- drivers/dma/hisilicon/hisi_dmadev.h | 3 ++- drivers/ml/cnxk/cn10k_ml_ocm.c | 7 --- drivers/net/bnxt/bnxt_rxtx_vec_neon.c| 4 ++-- drivers/net/bnxt/tf_ulp/ulp_flow_db.c| 6 -- drivers/net/bnxt/tf_ulp/ulp_gen_hash.c | 4 +++- drivers/net/bonding/rte_eth_bond_pmd.c | 3 ++- drivers/net/cpfl/cpfl_flow_engine_fxp.c | 5 - drivers/net/enetfec/enet_ethdev.c| 5 +++-- drivers/net/enetfec/enet_ethdev.h| 6 -- drivers/net/hns3/hns3_rxtx_vec_neon.h| 4 +++- drivers/net/i40e/i40e_rxtx_vec_neon.c| 4 +++- drivers/net/iavf/iavf_rxtx_vec_neon.c| 4 +++- drivers/net/mlx5/hws/mlx5dr_definer.c| 8 +--- drivers/net/mlx5/mlx5_flow_dv.c | 3 ++- drivers/net/mlx5/mlx5_rxtx_vec_neon.h| 12 ++-- drivers/net/mlx5/mlx5_tx.c | 2 +- drivers/net/qede/base/bcm_osal.h | 4 +++- drivers/net/vmxnet3/base/vmxnet3_osdep.h | 4 +++- 24 files changed, 84 insertions(+), 53 deletions(-) -- 2.46.2
[PATCH 5/6] drivers: use branch prediction macros
Prefer EAL macros over __builtin_ helpers. Signed-off-by: David Marchand --- drivers/bus/fslmc/qbman/include/compat.h | 6 ++ drivers/net/qede/base/bcm_osal.h | 4 +++- drivers/net/vmxnet3/base/vmxnet3_osdep.h | 4 +++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/bus/fslmc/qbman/include/compat.h b/drivers/bus/fslmc/qbman/include/compat.h index ece5da5906..4ac3254bc7 100644 --- a/drivers/bus/fslmc/qbman/include/compat.h +++ b/drivers/bus/fslmc/qbman/include/compat.h @@ -16,7 +16,9 @@ #include #include #include + #include +#include /* The following definitions are primarily to allow the single-source driver * interfaces to be included by arbitrary program code. Ie. for interfaces that @@ -24,10 +26,6 @@ * with certain attributes and types used in those interfaces. */ -/* Required compiler attributes */ -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x)__builtin_expect(!!(x), 0) - /* Required types */ typedef uint64_t dma_addr_t; diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h index 7869103c63..357981f63d 100644 --- a/drivers/net/qede/base/bcm_osal.h +++ b/drivers/net/qede/base/bcm_osal.h @@ -10,7 +10,9 @@ #include #include #include + #include +#include #include #include #include @@ -442,7 +444,7 @@ u32 qede_osal_log2(u32); #define OSAL_CACHE_LINE_SIZE RTE_CACHE_LINE_SIZE #define OSAL_IOMEM volatile #define OSAL_UNUSED__rte_unused -#define OSAL_UNLIKELY(x) __builtin_expect(!!(x), 0) +#define OSAL_UNLIKELY(x) unlikely(x) #define OSAL_MIN_T(type, __min1, __min2) RTE_MIN_T(__min1, __min2, type) #define OSAL_MAX_T(type, __max1, __max2) RTE_MAX_T(__max1, __max2, type) diff --git a/drivers/net/vmxnet3/base/vmxnet3_osdep.h b/drivers/net/vmxnet3/base/vmxnet3_osdep.h index 381a68db69..b1cd9ed056 100644 --- a/drivers/net/vmxnet3/base/vmxnet3_osdep.h +++ b/drivers/net/vmxnet3/base/vmxnet3_osdep.h @@ -7,13 +7,15 @@ #include +#include + typedef uint64_t uint64; typedef uint32_t uint32; typedef uint16_t uint16; typedef uint8_tuint8; #ifndef UNLIKELY -#define UNLIKELY(x) __builtin_expect((x),0) +#define UNLIKELY(x) unlikely(x) #endif /* unlikely */ #endif /* _VMXNET3_OSDEP_H */ -- 2.46.2
Re: [PATCH v3 0/6] VDUSE reconnection fixes and cleanup
On 10/24/24 11:44, Maxime Coquelin wrote: This series provides various fixes for VDUSE reconnection introduced in -rc1, some of them being reported by Coverity. The series also takes the opportunity to refactor reconnection to make it more self-contained to simplify readability and error path handling. Changes in v2: == - Avoid superluous error logging (David) - VDUSE in capital letter in commit title 1 (David) - Declare dev_config in the code block it is used (David) - Fix wrong goto in intermediate patch (Maxime) Maxime Coquelin (6): vhost: fix VDUSE device creation error handling vhost: fix possible TOCTOU in VDUSE dev creation vhost: fix VDUSE reconnect device start failure vhost: refactor VDUSE reconnection log mapping vhost: fix and refactor VDUSE reconnect log check vhost: move VDUSE reconnection after device is created lib/vhost/vduse.c | 322 ++ 1 file changed, 181 insertions(+), 141 deletions(-) Applied to next-virtio/for-next-net Thanks, Maxime
Re: [PATCH v2] net/ixgbe: support per-queue stats for fewer queues
On Thu, 24 Oct 2024 18:53:52 + Morten Brørup wrote: > Remove the requirement that the configured number of queues to provide > statistics for (RTE_ETHDEV_QUEUE_STAT_CNTRS) cannot be less than the > driver's max supported number of the same (IXGBE_QUEUE_STAT_COUNTERS). > > Signed-off-by: Morten Brørup Acked-by: Stephen Hemminger
[PATCH v28 12/13] log: colorize log output
Like dmesg, colorize the log output (unless redirected to file). Timestamp is green, the subsystem is in yellow and the message is red if urgent, boldface if an error, and normal for info and debug messages. The default is to not use color since it may disturb automatic tests and other embedded usage. Signed-off-by: Stephen Hemminger Acked-by: Morten Brørup Acked-by: Bruce Richardson Acked-by: Chengwen Feng --- app/test/test_eal_flags.c | 24 doc/guides/prog_guide/log_lib.rst | 24 lib/eal/common/eal_common_options.c | 11 ++ lib/eal/common/eal_options.h| 2 + lib/log/log.c | 20 ++- lib/log/log_color.c | 214 lib/log/log_internal.h | 5 + lib/log/log_private.h | 8 ++ lib/log/meson.build | 1 + lib/log/version.map | 1 + 10 files changed, 306 insertions(+), 4 deletions(-) create mode 100644 lib/log/log_color.c diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c index e24630edde..cd73711da6 100644 --- a/app/test/test_eal_flags.c +++ b/app/test/test_eal_flags.c @@ -1067,6 +1067,18 @@ test_misc_flags(void) const char * const argv25[] = {prgname, prefix, mp_flag, "--log-timestamp=invalid" }; + /* Try running with --log-color */ + const char * const argv26[] = {prgname, prefix, mp_flag, + "--log-color" }; + + /* Try running with --log-color=never */ + const char * const argv27[] = {prgname, prefix, mp_flag, + "--log-color=never" }; + + /* Try running with --log-color=invalid */ + const char * const argv28[] = {prgname, prefix, mp_flag, + "--log-color=invalid" }; + /* run all tests also applicable to FreeBSD first */ @@ -1187,6 +1199,18 @@ test_misc_flags(void) printf("Error - process did run ok with --log-timestamp=invalid parameter\n"); goto fail; } + if (launch_proc(argv26) != 0) { + printf("Error - process did not run ok with --log-color parameter\n"); + goto fail; + } + if (launch_proc(argv27) != 0) { + printf("Error - process did not run ok with --log-color=none parameter\n"); + goto fail; + } + if (launch_proc(argv28) == 0) { + printf("Error - process did run ok with --log-timestamp=invalid parameter\n"); + goto fail; + } rmdir(hugepath_dir3); diff --git a/doc/guides/prog_guide/log_lib.rst b/doc/guides/prog_guide/log_lib.rst index 82d3b7be2b..a4f880037b 100644 --- a/doc/guides/prog_guide/log_lib.rst +++ b/doc/guides/prog_guide/log_lib.rst @@ -57,6 +57,7 @@ For example:: Within an application, the same result can be got using the ``rte_log_set_level_pattern()`` or ``rte_log_set_level_regex()`` APIs. + Using Logging APIs to Generate Log Messages --- @@ -137,3 +138,26 @@ To prefix all console messages with ISO format time the syntax is:: Timestamp option has no effect if using syslog because the ``syslog()`` service already does timestamping internally. + + +Color output + + +The log library will highlight important messages. +This is controlled by the ``--log-color`` option. +The optional argument describes when color is enabled: + +:never: Do not enable color. This is the default behavior. + +:auto: Enable color only when printing to a terminal. + This is the same as ``--log-color`` with no argument + +:always: Always print color + +For example to enable color in logs if using terminal:: + + /path/to/app --log-color + +.. note:: + + Color output is never used for syslog or systemd journal logging. diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c index a70d63479a..6965666a7c 100644 --- a/lib/eal/common/eal_common_options.c +++ b/lib/eal/common/eal_common_options.c @@ -73,6 +73,7 @@ eal_long_options[] = { {OPT_HUGE_UNLINK, 2, NULL, OPT_HUGE_UNLINK_NUM }, {OPT_IOVA_MODE, 1, NULL, OPT_IOVA_MODE_NUM}, {OPT_LCORES,1, NULL, OPT_LCORES_NUM }, + {OPT_LOG_COLOR, 2, NULL, OPT_LOG_COLOR_NUM}, {OPT_LOG_LEVEL, 1, NULL, OPT_LOG_LEVEL_NUM}, {OPT_LOG_TIMESTAMP, 2, NULL, OPT_LOG_TIMESTAMP_NUM}, {OPT_TRACE, 1, NULL, OPT_TRACE_NUM}, @@ -1620,6 +1621,7 @@ eal_log_level_parse(int argc, char * const argv[]) case OPT_LOG_LEVEL_NUM: case OPT_SYSLOG_NUM: case OPT_LOG_TIMESTAMP_NUM: + case OPT_LOG_COLOR_NUM: if (eal_parse_common_option(opt, optarg, internal_conf) < 0)
[PATCH 1/6] devtools: handle multiple pattern for skipping files
We may want to skip multiple patterns when forbidding use of some expression. Signed-off-by: David Marchand --- devtools/check-forbidden-tokens.awk | 21 +++-- 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/devtools/check-forbidden-tokens.awk b/devtools/check-forbidden-tokens.awk index 59b1121090..28d32fc086 100755 --- a/devtools/check-forbidden-tokens.awk +++ b/devtools/check-forbidden-tokens.awk @@ -10,6 +10,7 @@ BEGIN { split(FOLDERS,deny_folders," "); split(EXPRESSIONS,deny_expr," "); + split(SKIP_FILES,skip_files," "); in_file=0; in_comment=0; count=0; @@ -56,14 +57,22 @@ BEGIN { } count = 0 for (i in deny_folders) { - re = "^\\+\\+\\+ b/" deny_folders[i]; - if ($0 ~ re) { - # Check only if the files are not part of SKIP_FILES - if (!(length(SKIP_FILES) && ($re ~ SKIP_FILES))) { - in_file = 1 - last_file = $0 + if (!($0 ~ "^\\+\\+\\+ b/" deny_folders[i])) { + continue + } + skip = 0 + for (j in skip_files) { + if (!($0 ~ "^\\+\\+\\+ b/" skip_files[j])) { + continue } + skip = 1 + break + } + if (skip == 0) { + in_file = 1 + last_file = $0 } + break } } END { -- 2.46.2
[PATCH v3 1/1] dma/cnxk: support dma queue priority configuration
From: Vamsi Attunuru Allow configuration of DPI DMA queue priority through mailbox request. Signed-off-by: Vamsi Attunuru --- V3 changes: * Updated release notes. V2 changes: * Rebased to tot. v1 changes: * Addressed v0 comments. doc/guides/rel_notes/release_24_11.rst | 4 drivers/common/cnxk/roc_dpi.c | 2 ++ drivers/common/cnxk/roc_dpi.h | 1 + drivers/common/cnxk/roc_dpi_priv.h | 2 ++ drivers/common/cnxk/roc_features.h | 6 ++ drivers/dma/cnxk/cnxk_dmadev.c | 6 ++ drivers/dma/cnxk/cnxk_dmadev.h | 1 + 7 files changed, 22 insertions(+) diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst index fa4822d928..7f08ab372c 100644 --- a/doc/guides/rel_notes/release_24_11.rst +++ b/doc/guides/rel_notes/release_24_11.rst @@ -231,6 +231,10 @@ New Features * Added independent enqueue feature. +* **Updated Marvell CNXK DMA driver.** + + Added support for DMA queue priority configuration. + * **Added IPv4 network order lookup in the FIB library.** A new flag field is introduced in ``rte_fib_conf`` structure. diff --git a/drivers/common/cnxk/roc_dpi.c b/drivers/common/cnxk/roc_dpi.c index 892685d185..71edfcbf9b 100644 --- a/drivers/common/cnxk/roc_dpi.c +++ b/drivers/common/cnxk/roc_dpi.c @@ -95,6 +95,7 @@ roc_dpi_configure(struct roc_dpi *roc_dpi, uint32_t chunk_sz, uint64_t aura, uin mbox_msg.u[1] = 0; /* DPI PF driver expects vfid starts from index 0 */ mbox_msg.s.vfid = roc_dpi->vfid; + mbox_msg.s.pri = roc_dpi->priority; mbox_msg.s.cmd = DPI_QUEUE_OPEN; mbox_msg.s.csize = chunk_sz; mbox_msg.s.aura = aura; @@ -137,6 +138,7 @@ roc_dpi_configure_v2(struct roc_dpi *roc_dpi, uint32_t chunk_sz, uint64_t aura, mbox_msg.u[1] = 0; /* DPI PF driver expects vfid starts from index 0 */ mbox_msg.s.vfid = roc_dpi->vfid; + mbox_msg.s.pri = roc_dpi->priority; mbox_msg.s.cmd = DPI_QUEUE_OPEN_V2; mbox_msg.s.csize = chunk_sz / 8; mbox_msg.s.aura = aura; diff --git a/drivers/common/cnxk/roc_dpi.h b/drivers/common/cnxk/roc_dpi.h index 7b4f9d4f4f..3a11559df9 100644 --- a/drivers/common/cnxk/roc_dpi.h +++ b/drivers/common/cnxk/roc_dpi.h @@ -9,6 +9,7 @@ struct roc_dpi { struct plt_pci_device *pci_dev; uint8_t *rbase; uint16_t vfid; + uint8_t priority; } __plt_cache_aligned; int __roc_api roc_dpi_dev_init(struct roc_dpi *roc_dpi, uint8_t offset); diff --git a/drivers/common/cnxk/roc_dpi_priv.h b/drivers/common/cnxk/roc_dpi_priv.h index 844e5f37ee..1f975915f7 100644 --- a/drivers/common/cnxk/roc_dpi_priv.h +++ b/drivers/common/cnxk/roc_dpi_priv.h @@ -38,6 +38,8 @@ typedef union dpi_mbox_msg_t { uint64_t wqecs : 1; /* WQE queue DMA completion status offset */ uint64_t wqecsoff : 8; + /* Priority */ + uint64_t pri : 1; } s; } dpi_mbox_msg_t; diff --git a/drivers/common/cnxk/roc_features.h b/drivers/common/cnxk/roc_features.h index 6abb35c296..0002a7b5c3 100644 --- a/drivers/common/cnxk/roc_features.h +++ b/drivers/common/cnxk/roc_features.h @@ -96,4 +96,10 @@ roc_feature_nix_has_second_pass_drop(void) return 0; } +static inline bool +roc_feature_dpi_has_priority(void) +{ + return roc_model_is_cn10k(); +} + #endif diff --git a/drivers/dma/cnxk/cnxk_dmadev.c b/drivers/dma/cnxk/cnxk_dmadev.c index 2d5307b22e..e7be3767b2 100644 --- a/drivers/dma/cnxk/cnxk_dmadev.c +++ b/drivers/dma/cnxk/cnxk_dmadev.c @@ -20,6 +20,10 @@ cnxk_dmadev_info_get(const struct rte_dma_dev *dev, struct rte_dma_info *dev_inf RTE_DMA_CAPA_DEV_TO_MEM | RTE_DMA_CAPA_DEV_TO_DEV | RTE_DMA_CAPA_OPS_COPY | RTE_DMA_CAPA_OPS_COPY_SG | RTE_DMA_CAPA_M2D_AUTO_FREE; + if (roc_feature_dpi_has_priority()) { + dev_info->dev_capa |= RTE_DMA_CAPA_PRI_POLICY_SP; + dev_info->nb_priorities = CN10K_DPI_MAX_PRI; + } dev_info->max_desc = CNXK_DPI_MAX_DESC; dev_info->min_desc = CNXK_DPI_MIN_DESC; dev_info->max_sges = CNXK_DPI_MAX_POINTER; @@ -107,6 +111,8 @@ cnxk_dmadev_configure(struct rte_dma_dev *dev, const struct rte_dma_conf *conf, */ cnxk_dmadev_vchan_free(dpivf, RTE_DMA_ALL_VCHAN); dpivf->num_vchans = conf->nb_vchans; + if (roc_feature_dpi_has_priority()) + dpivf->rdpi.priority = conf->priority; return 0; } diff --git a/drivers/dma/cnxk/cnxk_dmadev.h b/drivers/dma/cnxk/cnxk_dmadev.h index 15af1d64dc..39fd6afbe9 100644 --- a/drivers/dma/cnxk/cnxk_dmadev.h +++ b/drivers/dma/cnxk/cnxk_dmadev.h @@ -28,6 +28,7 @@ ((s).var - 1)) #define CNXK_DPI_MAX_DESC 32768 #define CNXK_DPI_MIN_DESC 2 +#define CN10K_DPI_MAX_PRI 2 #define C
[PATCH 6/6] drivers: use bitops API instead of compiler builtins
Stop using directly __builtin_ bit operations, prefer existing DPDK wrappers. Note: this is a brute sed all over drivers (skipping base drivers) for __builtin_* that have a direct replacement in EAL bitops. There is more work to do, like adding some missing macros inspired from kernel (FIELD_*) macros but this is left for later. Signed-off-by: David Marchand --- drivers/common/nfp/nfp_platform.h | 4 +++- drivers/dma/hisilicon/hisi_dmadev.h | 3 ++- drivers/ml/cnxk/cn10k_ml_ocm.c | 7 --- drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 4 ++-- drivers/net/bnxt/tf_ulp/ulp_flow_db.c | 6 -- drivers/net/bnxt/tf_ulp/ulp_gen_hash.c | 4 +++- drivers/net/bonding/rte_eth_bond_pmd.c | 3 ++- drivers/net/cpfl/cpfl_flow_engine_fxp.c | 5 - drivers/net/enetfec/enet_ethdev.c | 5 +++-- drivers/net/enetfec/enet_ethdev.h | 6 -- drivers/net/hns3/hns3_rxtx_vec_neon.h | 4 +++- drivers/net/i40e/i40e_rxtx_vec_neon.c | 4 +++- drivers/net/iavf/iavf_rxtx_vec_neon.c | 4 +++- drivers/net/mlx5/hws/mlx5dr_definer.c | 8 +--- drivers/net/mlx5/mlx5_flow_dv.c | 3 ++- drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 12 ++-- drivers/net/mlx5/mlx5_tx.c | 2 +- 17 files changed, 50 insertions(+), 34 deletions(-) diff --git a/drivers/common/nfp/nfp_platform.h b/drivers/common/nfp/nfp_platform.h index 1687942e41..0b02fcf1e8 100644 --- a/drivers/common/nfp/nfp_platform.h +++ b/drivers/common/nfp/nfp_platform.h @@ -8,6 +8,8 @@ #include +#include + #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) #define DMA_BIT_MASK(n)((1ULL << (n)) - 1) @@ -21,7 +23,7 @@ #define GENMASK_ULL(h, l) \ ((~0ULL << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - (h) - 1))) -#define __bf_shf(x) (__builtin_ffsll(x) - 1) +#define __bf_shf(x) rte_bsf64(x) #define FIELD_GET(_mask, _reg) \ (__extension__ ({ \ diff --git a/drivers/dma/hisilicon/hisi_dmadev.h b/drivers/dma/hisilicon/hisi_dmadev.h index a57b5c759a..786fe3cc0e 100644 --- a/drivers/dma/hisilicon/hisi_dmadev.h +++ b/drivers/dma/hisilicon/hisi_dmadev.h @@ -5,6 +5,7 @@ #ifndef HISI_DMADEV_H #define HISI_DMADEV_H +#include #include #include #include @@ -14,7 +15,7 @@ #define BITS_PER_LONG (__SIZEOF_LONG__ * 8) #define GENMASK(h, l) \ (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h -#define BF_SHF(x) (__builtin_ffsll(x) - 1) +#define BF_SHF(x) rte_bsf64(x) #define FIELD_GET(mask, reg) \ ((typeof(mask))(((reg) & (mask)) >> BF_SHF(mask))) diff --git a/drivers/ml/cnxk/cn10k_ml_ocm.c b/drivers/ml/cnxk/cn10k_ml_ocm.c index 749ddeb344..0032fe82da 100644 --- a/drivers/ml/cnxk/cn10k_ml_ocm.c +++ b/drivers/ml/cnxk/cn10k_ml_ocm.c @@ -2,6 +2,7 @@ * Copyright (c) 2022 Marvell. */ +#include #include #include @@ -203,11 +204,11 @@ cn10k_ml_ocm_tilecount(uint64_t tilemask, int *start, int *end) PLT_ASSERT(tilemask != 0); - *start = __builtin_ctzl(tilemask); - *end = 64 - __builtin_clzl(tilemask) - 1; + *start = rte_ctz64(tilemask); + *end = 64 - rte_clz64(tilemask) - 1; count = *end - *start + 1; - PLT_ASSERT(count == __builtin_popcountl(tilemask)); + PLT_ASSERT(count == rte_popcount64(tilemask)); return count; } diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c index 355d41bbd3..840b21cef9 100644 --- a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c +++ b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include #include @@ -290,7 +290,7 @@ recv_burst_vec_neon(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) if (valid == 0) num_valid = 4; else - num_valid = __builtin_ctzl(valid) / 16; + num_valid = rte_ctz64(valid) / 16; if (num_valid == 0) break; diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c index 2e6ea43ac1..aac974a970 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c +++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c @@ -3,7 +3,9 @@ * All rights reserved. */ +#include #include + #include "bnxt.h" #include "bnxt_tf_common.h" #include "ulp_utils.h" @@ -938,7 +940,7 @@ ulp_flow_db_next_entry_get(struct bnxt_ulp_flow_db *flow_db, */ if (s_idx == idx) bs &= (-1UL >> mod_fid); - lfid = (idx * ULP_INDEX_BITMAP_SIZE) + __builtin_clzl(bs); + lfid = (idx * ULP_INDEX_BITMAP_SIZE) + rte_clz64(bs); if (*fid >= lfid) { BNXT_TF_DBG(ERR, "Flow Database is corrupt\n"); return -ENOENT; @@ -1480,7 +1482,7 @@ ulp_flow_db_parent_child_flow_next_entry_get(struct bnxt_ulp_flow_db *flow_db, */
[PATCH 4/6] crypto/openssl: fix 3DES-CTR with big endian CPUs
Caught by code review. Don't byte swap unconditionally (assuming that CPU is little endian is wrong). Instead, convert from big endian to cpu and vice versa. Fixes: d61f70b4c918 ("crypto/libcrypto: add driver for OpenSSL library") Cc: sta...@dpdk.org Signed-off-by: David Marchand --- drivers/crypto/openssl/rte_openssl_pmd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c index 9657b70c7a..9f5f3cda7d 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -2,6 +2,7 @@ * Copyright(c) 2016-2017 Intel Corporation */ +#include #include #include #include @@ -110,9 +111,9 @@ ctr_inc(uint8_t *ctr) { uint64_t *ctr64 = (uint64_t *)ctr; - *ctr64 = __builtin_bswap64(*ctr64); + *ctr64 = rte_be_to_cpu_64(*ctr64); (*ctr64)++; - *ctr64 = __builtin_bswap64(*ctr64); + *ctr64 = rte_cpu_to_be_64(*ctr64); } /* -- 2.46.2
[PATCH v3 4/6] vhost: refactor VDUSE reconnection log mapping
This patch moves the VDUSE reconnection log mapping, as well as creation if needed, into a dedicated function. This is a preliminary rework to simplify VDUSE device creation. Signed-off-by: Maxime Coquelin --- lib/vhost/vduse.c | 138 -- 1 file changed, 73 insertions(+), 65 deletions(-) diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c index 346e6795f4..aae20dfc55 100644 --- a/lib/vhost/vduse.c +++ b/lib/vhost/vduse.c @@ -431,6 +431,9 @@ vduse_reconnect_path_init(void) const char *directory; int ret; + if (vduse_reconnect_path_set == true) + return 0; + /* from RuntimeDirectory= see systemd.exec */ directory = getenv("RUNTIME_DIRECTORY"); if (directory == NULL) { @@ -462,9 +465,74 @@ vduse_reconnect_path_init(void) VHOST_CONFIG_LOG("vduse", INFO, "Created VDUSE reconnect directory in %s", vduse_reconnect_dir); + vduse_reconnect_path_set = true; + return 0; } +static int +vduse_reconnect_log_map(const char *dev_name, struct vhost_reconnect_data **reco_log, bool create) +{ + char reco_file[PATH_MAX]; + int fd, ret; + + if (vduse_reconnect_path_init() < 0) { + VHOST_CONFIG_LOG(dev_name, ERR, "Failed to initialize reconnect path"); + return -1; + } + + ret = snprintf(reco_file, sizeof(reco_file), "%s/%s", vduse_reconnect_dir, dev_name); + if (ret < 0 || ret == sizeof(reco_file)) { + VHOST_CONFIG_LOG(dev_name, ERR, "Failed to create vduse reconnect path name"); + return -1; + } + + if (create) { + fd = open(reco_file, O_CREAT | O_EXCL | O_RDWR, 0600); + if (fd < 0) { + if (errno == EEXIST) { + VHOST_CONFIG_LOG(dev_name, ERR, "Reconnect file %s exists but not the device", + reco_file); + } else { + VHOST_CONFIG_LOG(dev_name, ERR, "Failed to open reconnect file %s (%s)", + reco_file, strerror(errno)); + } + return -1; + } + + ret = ftruncate(fd, sizeof(**reco_log)); + if (ret < 0) { + VHOST_CONFIG_LOG(dev_name, ERR, "Failed to truncate reconnect file %s (%s)", + reco_file, strerror(errno)); + goto out_close; + } + } else { + fd = open(reco_file, O_RDWR, 0600); + if (fd < 0) { + if (errno == ENOENT) + VHOST_CONFIG_LOG(dev_name, ERR, "Missing reconnect file (%s)", reco_file); + else + VHOST_CONFIG_LOG(dev_name, ERR, "Failed to open reconnect file %s (%s)", + reco_file, strerror(errno)); + return -1; + } + } + + *reco_log = mmap(NULL, sizeof(**reco_log), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (*reco_log == MAP_FAILED) { + VHOST_CONFIG_LOG(dev_name, ERR, "Failed to mmap reconnect file %s (%s)", + reco_file, strerror(errno)); + ret = -1; + goto out_close; + } + ret = 0; + +out_close: + close(fd); + + return ret; +} + static void vduse_reconnect_handler(int fd, void *arg, int *remove) { @@ -519,14 +587,13 @@ vduse_reconnect_start_device(struct virtio_net *dev) int vduse_device_create(const char *path, bool compliant_ol_flags) { - int control_fd, dev_fd, vid, ret, reco_fd; + int control_fd, dev_fd, vid, ret; uint32_t i, max_queue_pairs, total_queues; struct virtio_net *dev; struct virtio_net_config vnet_config = {{ 0 }}; uint64_t ver = VHOST_VDUSE_API_VERSION; uint64_t features; const char *name = path + strlen("/dev/vduse/"); - char reconnect_file[PATH_MAX]; struct vhost_reconnect_data *reconnect_log = MAP_FAILED; bool reconnect = false; @@ -538,20 +605,6 @@ vduse_device_create(const char *path, bool compliant_ol_flags) } } - if (vduse_reconnect_path_set == false) { - if (vduse_reconnect_path_init() < 0) { - VHOST_CONFIG_LOG(path, ERR, "failed to initialize reconnect path"); - return -1; - } - vduse_reconnect_path_set = true; - } - - ret = snprintf(reconnect_file, sizeof(reconnect_file), "%s/%s", vduse_reconnect_dir, name); - if (ret < 0 || ret == sizeof(reconnect_file)) { - VHOST_CONFIG_LOG(name, ERR, "Failed to create vduse reconnect path name"); - return
[PATCH v14 03/12] common/zsda: add some common functions
Introduce common functions and logging macros. Signed-off-by: Hanxiao Li --- drivers/common/zsda/meson.build | 14 ++ drivers/common/zsda/zsda_common.c | 240 ++ drivers/common/zsda/zsda_common.h | 331 ++ drivers/common/zsda/zsda_logs.c | 19 ++ drivers/common/zsda/zsda_logs.h | 27 +++ drivers/meson.build | 1 + 6 files changed, 632 insertions(+) create mode 100644 drivers/common/zsda/meson.build create mode 100644 drivers/common/zsda/zsda_common.c create mode 100644 drivers/common/zsda/zsda_common.h create mode 100644 drivers/common/zsda/zsda_logs.c create mode 100644 drivers/common/zsda/zsda_logs.h diff --git a/drivers/common/zsda/meson.build b/drivers/common/zsda/meson.build new file mode 100644 index 00..8971289080 --- /dev/null +++ b/drivers/common/zsda/meson.build @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2024 ZTE Corporation + +if is_windows +build = false +reason = 'not supported on Windows' +subdir_done() +endif + +deps += ['bus_pci'] +sources += files( + 'zsda_common.c', + 'zsda_logs.c', + ) diff --git a/drivers/common/zsda/zsda_common.c b/drivers/common/zsda/zsda_common.c new file mode 100644 index 00..8ad5972697 --- /dev/null +++ b/drivers/common/zsda/zsda_common.c @@ -0,0 +1,240 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 ZTE Corporation + */ + +#include "zsda_common.h" + +#include "bus_pci_driver.h" + +#define MAGIC_SEND 0xab +#define MAGIC_RECV 0xcd +#define ADMIN_VER 1 + +static const uint8_t crc8_table[256] = { + 0x00, 0x41, 0x13, 0x52, 0x26, 0x67, 0x35, 0x74, 0x4c, 0x0d, 0x5f, 0x1e, + 0x6a, 0x2b, 0x79, 0x38, 0x09, 0x48, 0x1a, 0x5b, 0x2f, 0x6e, 0x3c, 0x7d, + 0x45, 0x04, 0x56, 0x17, 0x63, 0x22, 0x70, 0x31, 0x12, 0x53, 0x01, 0x40, + 0x34, 0x75, 0x27, 0x66, 0x5e, 0x1f, 0x4d, 0x0c, 0x78, 0x39, 0x6b, 0x2a, + 0x1b, 0x5a, 0x08, 0x49, 0x3d, 0x7c, 0x2e, 0x6f, 0x57, 0x16, 0x44, 0x05, + 0x71, 0x30, 0x62, 0x23, 0x24, 0x65, 0x37, 0x76, 0x02, 0x43, 0x11, 0x50, + 0x68, 0x29, 0x7b, 0x3a, 0x4e, 0x0f, 0x5d, 0x1c, 0x2d, 0x6c, 0x3e, 0x7f, + 0x0b, 0x4a, 0x18, 0x59, 0x61, 0x20, 0x72, 0x33, 0x47, 0x06, 0x54, 0x15, + 0x36, 0x77, 0x25, 0x64, 0x10, 0x51, 0x03, 0x42, 0x7a, 0x3b, 0x69, 0x28, + 0x5c, 0x1d, 0x4f, 0x0e, 0x3f, 0x7e, 0x2c, 0x6d, 0x19, 0x58, 0x0a, 0x4b, + 0x73, 0x32, 0x60, 0x21, 0x55, 0x14, 0x46, 0x07, 0x48, 0x09, 0x5b, 0x1a, + 0x6e, 0x2f, 0x7d, 0x3c, 0x04, 0x45, 0x17, 0x56, 0x22, 0x63, 0x31, 0x70, + 0x41, 0x00, 0x52, 0x13, 0x67, 0x26, 0x74, 0x35, 0x0d, 0x4c, 0x1e, 0x5f, + 0x2b, 0x6a, 0x38, 0x79, 0x5a, 0x1b, 0x49, 0x08, 0x7c, 0x3d, 0x6f, 0x2e, + 0x16, 0x57, 0x05, 0x44, 0x30, 0x71, 0x23, 0x62, 0x53, 0x12, 0x40, 0x01, + 0x75, 0x34, 0x66, 0x27, 0x1f, 0x5e, 0x0c, 0x4d, 0x39, 0x78, 0x2a, 0x6b, + 0x6c, 0x2d, 0x7f, 0x3e, 0x4a, 0x0b, 0x59, 0x18, 0x20, 0x61, 0x33, 0x72, + 0x06, 0x47, 0x15, 0x54, 0x65, 0x24, 0x76, 0x37, 0x43, 0x02, 0x50, 0x11, + 0x29, 0x68, 0x3a, 0x7b, 0x0f, 0x4e, 0x1c, 0x5d, 0x7e, 0x3f, 0x6d, 0x2c, + 0x58, 0x19, 0x4b, 0x0a, 0x32, 0x73, 0x21, 0x60, 0x14, 0x55, 0x07, 0x46, + 0x77, 0x36, 0x64, 0x25, 0x51, 0x10, 0x42, 0x03, 0x3b, 0x7a, 0x28, 0x69, + 0x1d, 0x5c, 0x0e, 0x4f}; + +static uint8_t +zsda_crc8(const uint8_t *message, const int length) +{ + uint8_t crc = 0; + int i; + + for (i = 0; i < length; i++) + crc = crc8_table[crc ^ message[i]]; + return crc; +} + +uint32_t +zsda_set_reg_8(void *addr, const uint8_t val0, const uint8_t val1, + const uint8_t val2, const uint8_t val3) +{ + uint8_t val[4]; + + val[0] = val0; + val[1] = val1; + val[2] = val2; + val[3] = val3; + ZSDA_CSR_WRITE32(addr, *(uint32_t *)val); + return *(uint32_t *)val; +} + +uint8_t +zsda_get_reg_8(void *addr, const int offset) +{ + uint32_t val = ZSDA_CSR_READ32(addr); + + return *(((uint8_t *)&val) + offset); +} + +int +zsda_admin_msg_init(const struct rte_pci_device *pci_dev) +{ + uint8_t *mmio_base = pci_dev->mem_resource[0].addr; + + zsda_set_reg_8(mmio_base + ZSDA_ADMIN_WQ_BASE7, 0, 0, MAGIC_RECV, 0); + zsda_set_reg_8(mmio_base + ZSDA_ADMIN_CQ_BASE7, 0, 0, MAGIC_RECV, 0); + return 0; +} + +int +zsda_send_admin_msg(const struct rte_pci_device *pci_dev, void *req, + const uint32_t len) +{ + uint8_t *mmio_base = pci_dev->mem_resource[0].addr; + uint8_t wq_flag; + uint8_t crc; + uint16_t admin_db; + uint32_t retry = ZSDA_TIME_NUM; + int i; + uint16_t db; + int repeat = sizeof(struct zsda_admin_req) / sizeof(uint32_t); + + if (len > ADMIN_BUF_DATA_LEN) + return -EINVAL; + + for (i = 0; i < repeat; i++) { + ZSDA_CSR_WRITE32(((uint32_t *)(mmio_base + ZSDA_ADMIN_WQ) + i), +
[PATCH v4 4/5] net/mlx5: add flow rule insertion by index with pattern
Implement rte_flow_async_create_by_index_with_pattern() function. Rework the driver implementation to reduce code duplication by providing a single flow insertion routine, that can be called with different parameters depending on the insertion type. Signed-off-by: Alexander Kozyrev --- doc/guides/rel_notes/release_24_11.rst | 2 + drivers/net/mlx5/mlx5_flow_hw.c| 281 +++-- 2 files changed, 83 insertions(+), 200 deletions(-) diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst index fa4822d928..07a8435b19 100644 --- a/doc/guides/rel_notes/release_24_11.rst +++ b/doc/guides/rel_notes/release_24_11.rst @@ -247,6 +247,8 @@ New Features Added ability for node to advertise and update multiple xstat counters, that can be retrieved using ``rte_graph_cluster_stats_get``. +* **Updated NVIDIA MLX5 net driver.** + * Added rte_flow_async_create_by_index_with_pattern() support. Removed Items - diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index c236831e21..412d927efb 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -335,18 +335,13 @@ static __rte_always_inline uint32_t flow_hw_tx_tag_regc_value(struct rte_eth_dev static int flow_hw_async_create_validate(struct rte_eth_dev *dev, const uint32_t queue, const struct rte_flow_template_table *table, +enum rte_flow_table_insertion_type insertion_type, +const uint32_t rule_index, const struct rte_flow_item items[], const uint8_t pattern_template_index, const struct rte_flow_action actions[], const uint8_t action_template_index, struct rte_flow_error *error); -static int flow_hw_async_create_by_index_validate(struct rte_eth_dev *dev, - const uint32_t queue, - const struct rte_flow_template_table *table, - const uint32_t rule_index, - const struct rte_flow_action actions[], - const uint8_t action_template_index, - struct rte_flow_error *error); static int flow_hw_async_update_validate(struct rte_eth_dev *dev, const uint32_t queue, const struct rte_flow_hw *flow, @@ -3884,6 +3879,12 @@ flow_hw_get_rule_items(struct rte_eth_dev *dev, * The queue to create the flow. * @param[in] attr * Pointer to the flow operation attributes. + * @param[in] table + * Pointer to the template table. + * @param[in] insertion_type + * Insertion type for flow rules. + * @param[in] rule_index + * The item pattern flow follows from the table. * @param[in] items * Items with flow spec value. * @param[in] pattern_template_index @@ -3900,17 +3901,19 @@ flow_hw_get_rule_items(struct rte_eth_dev *dev, * @return *Flow pointer on success, NULL otherwise and rte_errno is set. */ -static struct rte_flow * -flow_hw_async_flow_create(struct rte_eth_dev *dev, - uint32_t queue, - const struct rte_flow_op_attr *attr, - struct rte_flow_template_table *table, - const struct rte_flow_item items[], - uint8_t pattern_template_index, - const struct rte_flow_action actions[], - uint8_t action_template_index, - void *user_data, - struct rte_flow_error *error) +static __rte_always_inline struct rte_flow * +flow_hw_async_flow_create_generic(struct rte_eth_dev *dev, + uint32_t queue, + const struct rte_flow_op_attr *attr, + struct rte_flow_template_table *table, + enum rte_flow_table_insertion_type insertion_type, + uint32_t rule_index, + const struct rte_flow_item items[], + uint8_t pattern_template_index, + const struct rte_flow_action actions[], + uint8_t action_template_index, + void *user_data, + struct rte_flow_error *error) { struct mlx5_priv *priv = dev->data->dev_private; struct mlx5dr_rule_attr rule_attr = { @@ -3
[PATCH v4 2/5] net/mlx5/hws: introduce jump to matcher action
From: Hamdan Igbaria Introduce jump to matcher action, this action will allow jumping to another matcher. For now this jump restricted to STE array matchers and matchers of size 1. Signed-off-by: Hamdan Igbaria --- drivers/net/mlx5/hws/mlx5dr.h| 29 ++ drivers/net/mlx5/hws/mlx5dr_action.c | 87 +++- drivers/net/mlx5/hws/mlx5dr_action.h | 3 + drivers/net/mlx5/hws/mlx5dr_debug.c | 1 + 4 files changed, 117 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h index 8a1a389a3f..1b58eeb2c7 100644 --- a/drivers/net/mlx5/hws/mlx5dr.h +++ b/drivers/net/mlx5/hws/mlx5dr.h @@ -52,6 +52,7 @@ enum mlx5dr_action_type { MLX5DR_ACTION_TYP_POP_IPV6_ROUTE_EXT, MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT, MLX5DR_ACTION_TYP_NAT64, + MLX5DR_ACTION_TYP_JUMP_TO_MATCHER, MLX5DR_ACTION_TYP_MAX, }; @@ -287,6 +288,10 @@ struct mlx5dr_rule_action { uint32_t offset; enum mlx5dr_action_aso_ct_flags direction; } aso_ct; + + struct { + uint32_t offset; + } jump_to_matcher; }; }; @@ -304,6 +309,15 @@ struct mlx5dr_action_dest_attr { } reformat; }; +enum mlx5dr_action_jump_to_matcher_type { + MLX5DR_ACTION_JUMP_TO_MATCHER_BY_INDEX, +}; + +struct mlx5dr_action_jump_to_matcher_attr { + enum mlx5dr_action_jump_to_matcher_type type; + struct mlx5dr_matcher *matcher; +}; + union mlx5dr_crc_encap_entropy_hash_ip_field { uint8_t ipv6_addr[16]; struct { @@ -938,6 +952,21 @@ mlx5dr_action_create_nat64(struct mlx5dr_context *ctx, struct mlx5dr_action_nat64_attr *attr, uint32_t flags); +/* Create direct rule jump to matcher action. + * + * @param[in] ctx + * The context in which the new action will be created. + * @param[in] attr + * The relevant attribute of the action. + * @param[in] flags + * Action creation flags. (enum mlx5dr_action_flags) + * @return pointer to mlx5dr_action on success NULL otherwise. + */ +struct mlx5dr_action * +mlx5dr_action_create_jump_to_matcher(struct mlx5dr_context *ctx, +struct mlx5dr_action_jump_to_matcher_attr *attr, +uint32_t flags); + /* Destroy direct rule action. * * @param[in] action diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c index 3fceb96de2..3412a96894 100644 --- a/drivers/net/mlx5/hws/mlx5dr_action.c +++ b/drivers/net/mlx5/hws/mlx5dr_action.c @@ -42,7 +42,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_ BIT(MLX5DR_ACTION_TYP_TIR) | BIT(MLX5DR_ACTION_TYP_DROP) | BIT(MLX5DR_ACTION_TYP_DEST_ROOT) | - BIT(MLX5DR_ACTION_TYP_DEST_ARRAY), + BIT(MLX5DR_ACTION_TYP_DEST_ARRAY) | + BIT(MLX5DR_ACTION_TYP_JUMP_TO_MATCHER), BIT(MLX5DR_ACTION_TYP_LAST), }, [MLX5DR_TABLE_TYPE_NIC_TX] = { @@ -62,7 +63,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_ BIT(MLX5DR_ACTION_TYP_TBL) | BIT(MLX5DR_ACTION_TYP_MISS) | BIT(MLX5DR_ACTION_TYP_DROP) | - BIT(MLX5DR_ACTION_TYP_DEST_ROOT), + BIT(MLX5DR_ACTION_TYP_DEST_ROOT) | + BIT(MLX5DR_ACTION_TYP_JUMP_TO_MATCHER), BIT(MLX5DR_ACTION_TYP_LAST), }, [MLX5DR_TABLE_TYPE_FDB] = { @@ -88,7 +90,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_ BIT(MLX5DR_ACTION_TYP_VPORT) | BIT(MLX5DR_ACTION_TYP_DROP) | BIT(MLX5DR_ACTION_TYP_DEST_ROOT) | - BIT(MLX5DR_ACTION_TYP_DEST_ARRAY), + BIT(MLX5DR_ACTION_TYP_DEST_ARRAY) | + BIT(MLX5DR_ACTION_TYP_JUMP_TO_MATCHER), BIT(MLX5DR_ACTION_TYP_LAST), }, }; @@ -1091,6 +1094,13 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action, attr->action_offset = MLX5DR_ACTION_OFFSET_DW5; attr->reparse_mode = MLX5_IFC_STC_REPARSE_ALWAYS; break; + case MLX5DR_ACTION_TYP_JUMP_TO_MATCHER: + attr->action_type = MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_STE_TABLE; + attr->action_offset = MLX5DR_ACTION_OFFSET_HIT; + attr->ste_table.ste = action->jump_to_matcher.matcher->match_ste.ste; + attr->ste_table.ste_pool = action->jump_to_matcher.matcher->match_ste.pool; + attr->ste_table.match_definer_id = action->ctx->caps->trivial_match_definer; + break; default: DR_LOG(ERR, "Invalid action type %d", action->type); assert(false); @@ -3078,6 +3088,57 @@
[PATCH v4 5/5] net/mlx5: implement jump to table index action
Implement RTE_FLOW_ACTION_TYPE_JUMP_TO_TABLE_INDEX action. Create the hardware steering jump to matcher action, associated with the template matcher. Use this action and provide the rule index as an offset in the matcher. Note that it is only supported by the isolated matcher, i.e. the table insertion type is by index with pattern. Signed-off-by: Alexander Kozyrev --- doc/guides/nics/features/default.ini | 1 + doc/guides/nics/features/mlx5.ini | 1 + doc/guides/prog_guide/ethdev/flow_offload.rst | 24 +++ doc/guides/rel_notes/release_24_11.rst| 1 + drivers/net/mlx5/mlx5_flow.h | 8 +- drivers/net/mlx5/mlx5_flow_hw.c | 145 ++ 6 files changed, 178 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini index 1e9a156a2a..a730365a16 100644 --- a/doc/guides/nics/features/default.ini +++ b/doc/guides/nics/features/default.ini @@ -221,3 +221,4 @@ skip_cman= vf = vxlan_decap = vxlan_encap = +jump_to_table_index = diff --git a/doc/guides/nics/features/mlx5.ini b/doc/guides/nics/features/mlx5.ini index 056e04275b..55bc52c666 100644 --- a/doc/guides/nics/features/mlx5.ini +++ b/doc/guides/nics/features/mlx5.ini @@ -150,3 +150,4 @@ set_tp_src = Y set_ttl = Y vxlan_decap = Y vxlan_encap = Y +jump_to_table_index = Y diff --git a/doc/guides/prog_guide/ethdev/flow_offload.rst b/doc/guides/prog_guide/ethdev/flow_offload.rst index 2d6187ed11..bff0b5a794 100644 --- a/doc/guides/prog_guide/ethdev/flow_offload.rst +++ b/doc/guides/prog_guide/ethdev/flow_offload.rst @@ -3535,6 +3535,30 @@ Send packets to the kernel, without going to userspace at all. The packets will be received by the kernel driver sharing the same device as the DPDK port on which this action is configured. +Action: ``JUMP_TO_TABLE_INDEX`` +^^^ + +Redirects packets to a particular index in a flow table. + +Bypassing a hierarchy of groups, this action redirects the matched flow to +the specified index in the particular template table on the device. + +If a matched flow is redirected to a non-existing template table or +the table which doesn't contain a rule at the specified index, +then the behavior is undefined and the resulting behavior is up to driver. + +.. _table_rte_flow_action_jump_to_table_index: + +.. table:: JUMP_TO_TABLE_INDEX + + +---+---+ + | Field | Value | + +===+===+ + | ``table`` | Template table to redirect packets to | + +---+---+ + | ``index`` | Index in the table to redirect packets to | + +---+---+ + Negative types ~~ diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst index 07a8435b19..dbef29706c 100644 --- a/doc/guides/rel_notes/release_24_11.rst +++ b/doc/guides/rel_notes/release_24_11.rst @@ -249,6 +249,7 @@ New Features * **Updated NVIDIA MLX5 net driver.** * Added rte_flow_async_create_by_index_with_pattern() support. + * Added RTE_FLOW_ACTION_TYPE_JUMP_TO_TABLE_INDEX support. Removed Items - diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index db56ae051d..90ad23c94a 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -398,6 +398,7 @@ enum mlx5_feature_name { #define MLX5_FLOW_ACTION_IPV6_ROUTING_REMOVE (1ull << 48) #define MLX5_FLOW_ACTION_IPV6_ROUTING_PUSH (1ull << 49) #define MLX5_FLOW_ACTION_NAT64 (1ull << 50) +#define MLX5_FLOW_ACTION_JUMP_TO_TABLE_INDEX (1ull << 51) #define MLX5_FLOW_DROP_INCLUSIVE_ACTIONS \ (MLX5_FLOW_ACTION_COUNT | MLX5_FLOW_ACTION_SAMPLE | MLX5_FLOW_ACTION_AGE) @@ -408,12 +409,14 @@ enum mlx5_feature_name { MLX5_FLOW_ACTION_DEFAULT_MISS | \ MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY | \ MLX5_FLOW_ACTION_SEND_TO_KERNEL | \ -MLX5_FLOW_ACTION_PORT_REPRESENTOR) +MLX5_FLOW_ACTION_PORT_REPRESENTOR | \ +MLX5_FLOW_ACTION_JUMP_TO_TABLE_INDEX) #define MLX5_FLOW_FATE_ESWITCH_ACTIONS \ (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_PORT_ID | \ MLX5_FLOW_ACTION_SEND_TO_KERNEL | \ -MLX5_FLOW_ACTION_JUMP | MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY) +MLX5_FLOW_ACTION_JUMP | MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY | \ +MLX5_FLOW_ACTION_JUMP_TO_TABLE_INDEX) #define MLX5_FLOW_MODIFY_HDR_ACTIONS (MLX5_FLOW_ACTION_SET_IPV4_SRC | \ MLX5_FLOW_ACTION_SET_IPV4_DST | \ @@ -1704,6 +1707,7 @@ struct mlx5_flow_template_table_cfg { struct mlx5_matcher_info { struct mlx5dr_matcher *matcher; /* Template matcher.
[PATCH v4 0/5] jump to table index support in mlx5
Support the new Flow API JUMP_TO_TABLE_INDEX action in mlx5. Seried-acked-by: Dariusz Sosnowski Alexander Kozyrev (3): net/mlx5: create array ste matcher net/mlx5: add flow rule insertion by index with pattern net/mlx5: implement jump to table index action Hamdan Igbaria (2): net/mlx5/hws: introduce new matcher type net/mlx5/hws: introduce jump to matcher action doc/guides/nics/features/default.ini | 1 + doc/guides/nics/features/mlx5.ini | 1 + doc/guides/prog_guide/ethdev/flow_offload.rst | 24 + doc/guides/rel_notes/release_24_11.rst| 3 + drivers/net/mlx5/hws/mlx5dr.h | 42 +- drivers/net/mlx5/hws/mlx5dr_action.c | 87 +++- drivers/net/mlx5/hws/mlx5dr_action.h | 3 + drivers/net/mlx5/hws/mlx5dr_debug.c | 13 +- drivers/net/mlx5/hws/mlx5dr_matcher.c | 58 ++- drivers/net/mlx5/hws/mlx5dr_matcher.h | 6 + drivers/net/mlx5/hws/mlx5dr_rule.c| 2 +- drivers/net/mlx5/hws/mlx5dr_table.c | 61 ++- drivers/net/mlx5/hws/mlx5dr_table.h | 8 +- drivers/net/mlx5/mlx5_flow.h | 8 +- drivers/net/mlx5/mlx5_flow_hw.c | 435 ++ 15 files changed, 520 insertions(+), 232 deletions(-) -- 2.43.5
[PATCH] ethdev: TEST support single queue per port
Configuring one queue per port fails compilation on my system. Test to see how much it fails in CI. Signed-off-by: Morten Brørup --- config/rte_config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/rte_config.h b/config/rte_config.h index fd6f8a2f1a..924192c71c 100644 --- a/config/rte_config.h +++ b/config/rte_config.h @@ -65,8 +65,8 @@ #define RTE_MBUF_DEFAULT_MEMPOOL_OPS "ring_mp_mc" /* ether defines */ -#define RTE_MAX_QUEUES_PER_PORT 1024 -#define RTE_ETHDEV_QUEUE_STAT_CNTRS 16 /* max 256 */ +#define RTE_MAX_QUEUES_PER_PORT 1 /* default 1024 */ +#define RTE_ETHDEV_QUEUE_STAT_CNTRS 1 /* max 256, default 16 */ #define RTE_ETHDEV_RXTX_CALLBACKS 1 #define RTE_MAX_MULTI_HOST_CTRLS 4 -- 2.43.0
[PATCH v3 3/6] vhost: fix VDUSE reconnect device start failure
This patch fixes a FD leak in the VDUSE device reconnect code fails to start the device. Also take the opportunity to refactor the related code into a dedicated function. Fixes: da79cc7fda76 ("vhost: add reconnection support to VDUSE") Signed-off-by: Maxime Coquelin --- lib/vhost/vduse.c | 65 ++- 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c index a98b33dddf..346e6795f4 100644 --- a/lib/vhost/vduse.c +++ b/lib/vhost/vduse.c @@ -476,6 +476,46 @@ vduse_reconnect_handler(int fd, void *arg, int *remove) *remove = 1; } +static int +vduse_reconnect_start_device(struct virtio_net *dev) +{ + int fd, ret; + + /* +* Make vduse_device_start() being executed in the same +* context for both reconnection and fresh startup. +*/ + fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); + if (fd < 0) { + VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to create reconnect efd: %s", + strerror(errno)); + ret = -1; + goto out_err; + } + + ret = fdset_add(vduse.fdset, fd, vduse_reconnect_handler, NULL, dev); + if (ret) { + VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to add reconnect efd %d to vduse fdset", + fd); + goto out_err_close; + } + + ret = eventfd_write(fd, (eventfd_t)1); + if (ret < 0) { + VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to write to reconnect eventfd"); + goto out_err_fdset; + } + + return 0; + +out_err_fdset: + fdset_del(vduse.fdset, fd); +out_err_close: + close(fd); +out_err: + return ret; +} + int vduse_device_create(const char *path, bool compliant_ol_flags) { @@ -742,30 +782,9 @@ vduse_device_create(const char *path, bool compliant_ol_flags) } if (reconnect && dev->status & VIRTIO_DEVICE_STATUS_DRIVER_OK) { - /* -* Make vduse_device_start() being executed in the same -* context for both reconnection and fresh startup. -*/ - reco_fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); - if (reco_fd < 0) { - VHOST_CONFIG_LOG(name, ERR, "Failed to create reco_fd: %s", - strerror(errno)); - ret = -1; + ret = vduse_reconnect_start_device(dev); + if (ret) goto out_dev_destroy; - } - - ret = fdset_add(vduse.fdset, reco_fd, vduse_reconnect_handler, NULL, dev); - if (ret) { - VHOST_CONFIG_LOG(name, ERR, "Failed to add reconnect fd %d to vduse fdset", - reco_fd); - goto out_dev_destroy; - } - - ret = eventfd_write(reco_fd, (eventfd_t)1); - if (ret < 0) { - VHOST_CONFIG_LOG(name, ERR, "Failed to write to reconnect eventfd"); - goto out_dev_destroy; - } } return 0; -- 2.46.2
[PATCH v2] ethdev: TEST support single queue per port
Configuring one queue per port fails compilation on my system. Test to see how much it fails in CI. Signed-off-by: Morten Brørup --- v2: * Fix vmxnet3 driver. --- config/rte_config.h | 4 ++-- drivers/net/vmxnet3/vmxnet3_ethdev.c | 32 +--- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/config/rte_config.h b/config/rte_config.h index fd6f8a2f1a..924192c71c 100644 --- a/config/rte_config.h +++ b/config/rte_config.h @@ -65,8 +65,8 @@ #define RTE_MBUF_DEFAULT_MEMPOOL_OPS "ring_mp_mc" /* ether defines */ -#define RTE_MAX_QUEUES_PER_PORT 1024 -#define RTE_ETHDEV_QUEUE_STAT_CNTRS 16 /* max 256 */ +#define RTE_MAX_QUEUES_PER_PORT 1 /* default 1024 */ +#define RTE_ETHDEV_QUEUE_STAT_CNTRS 1 /* max 256, default 16 */ #define RTE_ETHDEV_RXTX_CALLBACKS 1 #define RTE_MAX_MULTI_HOST_CTRLS 4 diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 78fac63ab6..8a9bb452c6 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -1470,42 +1470,52 @@ vmxnet3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) struct vmxnet3_hw *hw = dev->data->dev_private; struct UPT1_TxStats txStats; struct UPT1_RxStats rxStats; + uint64_t packets, bytes; VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS); for (i = 0; i < hw->num_tx_queues; i++) { vmxnet3_tx_stats_get(hw, i, &txStats); - stats->q_opackets[i] = txStats.ucastPktsTxOK + + packets = txStats.ucastPktsTxOK + txStats.mcastPktsTxOK + txStats.bcastPktsTxOK; - stats->q_obytes[i] = txStats.ucastBytesTxOK + + bytes = txStats.ucastBytesTxOK + txStats.mcastBytesTxOK + txStats.bcastBytesTxOK; - stats->opackets += stats->q_opackets[i]; - stats->obytes += stats->q_obytes[i]; + stats->opackets += packets; + stats->obytes += bytes; stats->oerrors += txStats.pktsTxError + txStats.pktsTxDiscard; + + if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) { + stats->q_opackets[i] = packets; + stats->q_obytes[i] = bytes; + } } for (i = 0; i < hw->num_rx_queues; i++) { vmxnet3_rx_stats_get(hw, i, &rxStats); - stats->q_ipackets[i] = rxStats.ucastPktsRxOK + + packets = rxStats.ucastPktsRxOK + rxStats.mcastPktsRxOK + rxStats.bcastPktsRxOK; - stats->q_ibytes[i] = rxStats.ucastBytesRxOK + + bytes = rxStats.ucastBytesRxOK + rxStats.mcastBytesRxOK + rxStats.bcastBytesRxOK; - stats->ipackets += stats->q_ipackets[i]; - stats->ibytes += stats->q_ibytes[i]; - - stats->q_errors[i] = rxStats.pktsRxError; + stats->ipackets += packets; + stats->ibytes += bytes; stats->ierrors += rxStats.pktsRxError; stats->imissed += rxStats.pktsRxOutOfBuf; + + if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) { + stats->q_ipackets[i] = packets; + stats->q_ibytes[i] = bytes; + stats->q_errors[i] = rxStats.pktsRxError; + } } return 0; @@ -1521,8 +1531,6 @@ vmxnet3_dev_stats_reset(struct rte_eth_dev *dev) VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS); - RTE_BUILD_BUG_ON(RTE_ETHDEV_QUEUE_STAT_CNTRS < VMXNET3_MAX_TX_QUEUES); - for (i = 0; i < hw->num_tx_queues; i++) { vmxnet3_hw_tx_stats_get(hw, i, &txStats); memcpy(&hw->snapshot_tx_stats[i], &txStats, -- 2.43.0
[DPDK/ethdev Bug 1570] Bonding mode 4 DMA errors
https://bugs.dpdk.org/show_bug.cgi?id=1570 Bug ID: 1570 Summary: Bonding mode 4 DMA errors Product: DPDK Version: 22.11 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: major Priority: Normal Component: ethdev Assignee: dev@dpdk.org Reporter: elmedin.zild...@ericsson.com Target Milestone: --- Created attachment 293 --> https://bugs.dpdk.org/attachment.cgi?id=293&action=edit dma-error-backtrace When trying to configure bonding mode 4 using members with iavf driver (for intel 700 series NICs) we see these DMA errors: "EAL: Cannot set up DMA remapping, error 12 (Cannot allocate memory)" When this happens we also see TX errors on the devices, so I tried dumping DMA vaddrs and enabling TX descriptor dumps for iavf and saw the following: DMA errors occuring at: iova=0x235120, len=2097152 iova=0x235140, len=2097152 iova=0x235160, len=2097152 iova=0x235180, len=2097152 iova=0x2351a0, len=2097152 iova=0x2351c0, len=2097152 TX descriptor dumps: Queue 0 Tx_data_desc 0: QW0: 0x00235137f8c0 QW1: 0x01f00040 Queue 0 Tx_data_desc 0: QW0: 0x00235137f8c0 QW1: 0x01f00050 Queue 0 Tx_data_desc 1: QW0: 0x00235137fb00 QW1: 0x01f00040 Queue 0 Tx_data_desc 1: QW0: 0x00235137fb00 QW1: 0x01f00050 Queue 0 Tx_data_desc 0: QW0: 0x00235197f8c0 QW1: 0x01f00040 Queue 0 Tx_data_desc 0: QW0: 0x00235197f8c0 QW1: 0x01f00050 Queue 0 Tx_data_desc 2: QW0: 0x00235137fd40 QW1: 0x01f00040 Queue 0 Tx_data_desc 2: QW0: 0x00235137fd40 QW1: 0x01f00050 Queue 0 Tx_data_desc 1: QW0: 0x00235197fb00 QW1: 0x01f00040 Queue 0 Tx_data_desc 1: QW0: 0x00235197fb00 QW1: 0x01f00050 So DMA errors are probably the root cause for the TX errors. I tried figuring out why DMA errors occur so I added an abort on DMA error to generate a coredump. I've attached the backtrace of the interesting threads. Looking at the backtrace, it looks like LSC callback is called at the same time as we're starting the iavf member devices, and this seems to cause the DMA errors. The reason I say that is because I tried synchronizing the threads and the DMA errors disappeared. So far we have two workarounds for this problem: 1. Synchronize threads with locks 2. Pre-allocate more memory, hence no need to expand heap and do DMA remapping. Maybe someone can explain why these DMA errors occur when the threads are not synched? What would be the proper fix for this? -- You are receiving this mail because: You are the assignee for the bug.
Re: [PATCH] eal: support including mapped memory in core dump
2024-10-24 09:22 (UTC+0200), Morten Brørup: > > From: Dmitry Kozlyuk [mailto:dmitry.kozl...@gmail.com] > > Sent: Thursday, 24 October 2024 01.19 [...] > > Add `--huge-dump` EAL command-line option to include in core dump > > all mapped hugepages and also non-hugepage memory > > allocated with `--no-huge` (as it substitutes for hugepages). > > I agree with the behavior of also dumping --no-huge mapped. > Perhaps because of this, the option should be named differently; something > like --dump-verbose, --dump-all, --dump-mapped. Or one may interpret "huge dump" as "the dump will be huge" :) I'll use "--dump-mapped" as the most precise, thanks. > > Linux requires /proc/self/coredump_filter adjustment > > to include hugepages mapped with MAP_SHARED in core dump. > > Windows EAL requires no change since it automatically > > excludes reserved memory and includes committed memory. > > The above O/S specific information should also be included as notes in the > documentation. [...] > If there are any notes about FreeBSD, like the notes about Linux and > Windows above, it should also be included in the documentation. "Linux requires..." here explains what DPDK code in the patch is doing and "Windows EAL requires no change" explains why there are no code changes. No OS-specific user action is required for --huge-dump to work. I'll rephrase that comment and add a release note about the new option, but I think documentation already contains everything users need.
[DPDK/other Bug 1562] dumpcap captures all available network interfaces when specifying any PCI network interface
https://bugs.dpdk.org/show_bug.cgi?id=1562 Kevin Traynor (ktray...@redhat.com) changed: What|Removed |Added Resolution|--- |WONTFIX Status|UNCONFIRMED |RESOLVED --- Comment #4 from Kevin Traynor (ktray...@redhat.com) --- Thanks for reporting. It is fixed in main branch, but Stephen says it is not worth to backport to older releases. If it is important for you and you want to send a patch for 22.11 and 23.11 branches, it could be accepted. -- You are receiving this mail because: You are the assignee for the bug.
[PATCH v4 2/9] raw/cnxk_rvu_lf: add API to get NPA/SSO pffunc
Added rte_pmd_rvu_lf_npa_pf_func_get and rte_pmd_rvu_lf_sso_pf_func_get APIs to get NPA and SSO pffunc for the application/external driver use. Signed-off-by: Akhil Goyal --- doc/guides/rawdevs/cnxk_rvu_lf.rst | 7 +++ drivers/common/cnxk/roc_npa.c| 6 +++ drivers/common/cnxk/roc_npa.h| 3 ++ drivers/common/cnxk/roc_sso.c| 6 +++ drivers/common/cnxk/roc_sso.h| 3 ++ drivers/common/cnxk/version.map | 2 + drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c| 13 ++ drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h | 47 drivers/raw/cnxk_rvu_lf/meson.build | 1 + drivers/raw/cnxk_rvu_lf/version.map | 8 10 files changed, 96 insertions(+) create mode 100644 drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h create mode 100644 drivers/raw/cnxk_rvu_lf/version.map diff --git a/doc/guides/rawdevs/cnxk_rvu_lf.rst b/doc/guides/rawdevs/cnxk_rvu_lf.rst index 8a0bc22dd5..13184ad4dc 100644 --- a/doc/guides/rawdevs/cnxk_rvu_lf.rst +++ b/doc/guides/rawdevs/cnxk_rvu_lf.rst @@ -38,3 +38,10 @@ kernel driver. When querying the status of the devices, they will appear under the category of "Misc (rawdev) devices", i.e. the command ``dpdk-devbind.py --status-dev misc`` can be used to see the state of those devices alone. + +Get NPA and SSO PF FUNC +--- + +APIs ``rte_pmd_rvu_lf_npa_pf_func_get()`` and ``rte_pmd_rvu_lf_sso_pf_func_get()`` +can be used to get the cnxk NPA PF func and SSO PF func which application +can use for NPA/SSO specific configuration. diff --git a/drivers/common/cnxk/roc_npa.c b/drivers/common/cnxk/roc_npa.c index 934d7361a9..a33f9a8499 100644 --- a/drivers/common/cnxk/roc_npa.c +++ b/drivers/common/cnxk/roc_npa.c @@ -17,6 +17,12 @@ roc_npa_lf_init_cb_register(roc_npa_lf_init_cb_t cb) return 0; } +uint16_t +roc_npa_pf_func_get(void) +{ + return idev_npa_pffunc_get(); +} + void roc_npa_pool_op_range_set(uint64_t aura_handle, uint64_t start_iova, uint64_t end_iova) diff --git a/drivers/common/cnxk/roc_npa.h b/drivers/common/cnxk/roc_npa.h index fbf75b2fca..f7cb4460e7 100644 --- a/drivers/common/cnxk/roc_npa.h +++ b/drivers/common/cnxk/roc_npa.h @@ -820,6 +820,9 @@ int __roc_api roc_npa_aura_bp_configure(uint64_t aura_id, uint16_t bpid, uint8_t typedef int (*roc_npa_lf_init_cb_t)(struct plt_pci_device *pci_dev); int __roc_api roc_npa_lf_init_cb_register(roc_npa_lf_init_cb_t cb); +/* Utility functions */ +uint16_t __roc_api roc_npa_pf_func_get(void); + /* Debug */ int __roc_api roc_npa_ctx_dump(void); int __roc_api roc_npa_dump(void); diff --git a/drivers/common/cnxk/roc_sso.c b/drivers/common/cnxk/roc_sso.c index 2e3b134bfc..aed8819a1b 100644 --- a/drivers/common/cnxk/roc_sso.c +++ b/drivers/common/cnxk/roc_sso.c @@ -319,6 +319,12 @@ roc_sso_hwgrp_base_get(struct roc_sso *roc_sso, uint16_t hwgrp) return dev->bar2 + (RVU_BLOCK_ADDR_SSO << 20 | hwgrp << 12); } +uint16_t +roc_sso_pf_func_get(void) +{ + return idev_sso_pffunc_get(); +} + uint64_t roc_sso_ns_to_gw(uint64_t base, uint64_t ns) { diff --git a/drivers/common/cnxk/roc_sso.h b/drivers/common/cnxk/roc_sso.h index 4ac901762e..3e293a0a69 100644 --- a/drivers/common/cnxk/roc_sso.h +++ b/drivers/common/cnxk/roc_sso.h @@ -103,6 +103,9 @@ int __roc_api roc_sso_hwgrp_stash_config(struct roc_sso *roc_sso, void __roc_api roc_sso_hws_gwc_invalidate(struct roc_sso *roc_sso, uint8_t *hws, uint8_t nb_hws); +/* Utility function */ +uint16_t __roc_api roc_sso_pf_func_get(void); + /* Debug */ void __roc_api roc_sso_dump(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t hwgrp, FILE *f); diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 777e260731..d4c3e6c425 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -452,6 +452,7 @@ INTERNAL { roc_npa_dev_unlock; roc_npa_dump; roc_npa_lf_init_cb_register; + roc_npa_pf_func_get; roc_npa_pool_create; roc_npa_pool_destroy; roc_npa_pool_op_pc_reset; @@ -519,6 +520,7 @@ INTERNAL { roc_sso_hws_gwc_invalidate; roc_sso_hws_unlink; roc_sso_ns_to_gw; + roc_sso_pf_func_get; roc_sso_rsrc_fini; roc_sso_rsrc_init; roc_tim_fini; diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c index 1ed12d6979..c8490ccbab 100644 --- a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c +++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c @@ -14,6 +14,19 @@ #include #include "cnxk_rvu_lf.h" +#include "cnxk_rvu_lf_driver.h" + +uint16_t +rte_pmd_rvu_lf_npa_pf_func_get(void) +{ + return roc_npa_pf_func_get(); +} + +uint16_t +rte_pmd_rvu_lf_sso_pf_func_get(void) +{ + return roc_sso_pf_func_get(); +} static const struct rte_rawdev_ops rvu_lf_rawdev_ops
[PATCH v4 3/9] raw/cnxk_rvu_lf: register/unregister interrupt handler
Added API rte_pmd_rvu_lf_irq_register() and rte_pmd_rvu_lf_irq_unregister() to register/unregister interrupt handlers for rvu lf raw device. Signed-off-by: Akhil Goyal --- doc/guides/rawdevs/cnxk_rvu_lf.rst | 8 drivers/common/cnxk/roc_rvu_lf.c | 26 +++ drivers/common/cnxk/roc_rvu_lf.h | 5 +++ drivers/common/cnxk/version.map | 2 + drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c| 30 + drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h | 46 drivers/raw/cnxk_rvu_lf/version.map | 2 + 7 files changed, 119 insertions(+) diff --git a/doc/guides/rawdevs/cnxk_rvu_lf.rst b/doc/guides/rawdevs/cnxk_rvu_lf.rst index 13184ad4dc..52e4f12e3c 100644 --- a/doc/guides/rawdevs/cnxk_rvu_lf.rst +++ b/doc/guides/rawdevs/cnxk_rvu_lf.rst @@ -45,3 +45,11 @@ Get NPA and SSO PF FUNC APIs ``rte_pmd_rvu_lf_npa_pf_func_get()`` and ``rte_pmd_rvu_lf_sso_pf_func_get()`` can be used to get the cnxk NPA PF func and SSO PF func which application can use for NPA/SSO specific configuration. + +Register or remove interrupt handler + + +Application can register interrupt handlers using ``rte_pmd_rvu_lf_irq_register()`` +or remove interrupt handler using ``rte_pmd_rvu_lf_irq_unregister()``. +The irq numbers for which the interrupts are registered is negotiated separately +and is not in scope of the driver. diff --git a/drivers/common/cnxk/roc_rvu_lf.c b/drivers/common/cnxk/roc_rvu_lf.c index 1ae39e746e..63bc149f2a 100644 --- a/drivers/common/cnxk/roc_rvu_lf.c +++ b/drivers/common/cnxk/roc_rvu_lf.c @@ -61,3 +61,29 @@ roc_rvu_lf_dev_fini(struct roc_rvu_lf *roc_rvu_lf) return dev_fini(&rvu->dev, rvu->pci_dev); } + +int +roc_rvu_lf_irq_register(struct roc_rvu_lf *roc_rvu_lf, unsigned int irq, + roc_rvu_lf_intr_cb_fn cb, void *data) +{ + struct rvu_lf *rvu = roc_rvu_lf_to_rvu_priv(roc_rvu_lf); + struct plt_intr_handle *handle; + + handle = rvu->pci_dev->intr_handle; + + return dev_irq_register(handle, (plt_intr_callback_fn)cb, data, irq); +} + +int +roc_rvu_lf_irq_unregister(struct roc_rvu_lf *roc_rvu_lf, unsigned int irq, + roc_rvu_lf_intr_cb_fn cb, void *data) +{ + struct rvu_lf *rvu = roc_rvu_lf_to_rvu_priv(roc_rvu_lf); + struct plt_intr_handle *handle; + + handle = rvu->pci_dev->intr_handle; + + dev_irq_unregister(handle, (plt_intr_callback_fn)cb, data, irq); + + return 0; +} diff --git a/drivers/common/cnxk/roc_rvu_lf.h b/drivers/common/cnxk/roc_rvu_lf.h index 7ce8065a8b..800bf4e674 100644 --- a/drivers/common/cnxk/roc_rvu_lf.h +++ b/drivers/common/cnxk/roc_rvu_lf.h @@ -21,4 +21,9 @@ TAILQ_HEAD(roc_rvu_lf_head, roc_rvu_lf); int __roc_api roc_rvu_lf_dev_init(struct roc_rvu_lf *roc_rvu_lf); int __roc_api roc_rvu_lf_dev_fini(struct roc_rvu_lf *roc_rvu_lf); +typedef void (*roc_rvu_lf_intr_cb_fn)(void *cb_arg); +int __roc_api roc_rvu_lf_irq_register(struct roc_rvu_lf *roc_rvu_lf, unsigned int irq, + roc_rvu_lf_intr_cb_fn cb, void *cb_arg); +int __roc_api roc_rvu_lf_irq_unregister(struct roc_rvu_lf *roc_rvu_lf, unsigned int irq, + roc_rvu_lf_intr_cb_fn cb, void *cb_arg); #endif /* _ROC_RVU_LF_H_ */ diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index d4c3e6c425..4e687c1cb8 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -551,5 +551,7 @@ INTERNAL { roc_ree_rule_db_prog; roc_rvu_lf_dev_fini; roc_rvu_lf_dev_init; + roc_rvu_lf_irq_register; + roc_rvu_lf_irq_unregister; local: *; }; diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c index c8490ccbab..c108931f97 100644 --- a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c +++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c @@ -16,6 +16,36 @@ #include "cnxk_rvu_lf.h" #include "cnxk_rvu_lf_driver.h" +int +rte_pmd_rvu_lf_irq_register(uint8_t dev_id, unsigned int irq, + rte_pmd_rvu_lf_intr_callback_fn cb, void *data) +{ + struct rte_rawdev *rawdev = rte_rawdev_pmd_get_dev(dev_id); + struct roc_rvu_lf *roc_rvu_lf; + + if (rawdev == NULL) + return -EINVAL; + + roc_rvu_lf = (struct roc_rvu_lf *)rawdev->dev_private; + + return roc_rvu_lf_irq_register(roc_rvu_lf, irq, (roc_rvu_lf_intr_cb_fn)cb, data); +} + +int +rte_pmd_rvu_lf_irq_unregister(uint8_t dev_id, unsigned int irq, + rte_pmd_rvu_lf_intr_callback_fn cb, void *data) +{ + struct rte_rawdev *rawdev = rte_rawdev_pmd_get_dev(dev_id); + struct roc_rvu_lf *roc_rvu_lf; + + if (rawdev == NULL) + return -EINVAL; + + roc_rvu_lf = (struct roc_rvu_lf *)rawdev->dev_private; + + return roc_rvu_lf_irq_unregister(roc_rvu_lf, irq, (roc_rvu_lf_intr_cb_fn)cb, da
[PATCH v4 9/9] raw/cnxk_rvu_lf: add selftest
Added raw device selftest for cnxk_rvu_lf to verify various PMD APIs. Signed-off-by: Akhil Goyal --- doc/guides/rawdevs/cnxk_rvu_lf.rst| 18 ++ drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c | 4 +- drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.h | 2 + .../raw/cnxk_rvu_lf/cnxk_rvu_lf_selftest.c| 164 ++ drivers/raw/cnxk_rvu_lf/meson.build | 1 + 5 files changed, 186 insertions(+), 3 deletions(-) create mode 100644 drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_selftest.c diff --git a/doc/guides/rawdevs/cnxk_rvu_lf.rst b/doc/guides/rawdevs/cnxk_rvu_lf.rst index a972654f82..41fd2d1b42 100644 --- a/doc/guides/rawdevs/cnxk_rvu_lf.rst +++ b/doc/guides/rawdevs/cnxk_rvu_lf.rst @@ -80,3 +80,21 @@ Get BAR addresses Application can retrieve PCI BAR addresses of the device using the API ``rte_pmd_rvu_lf_bar_get()``. This helps application to configure the registers of the hardware device. + +Self test +- + +On EAL initialization RVU_LF devices will be probed and populated into +the raw devices. The rawdev ID of the device can be obtained using invocation +of ``rte_rawdev_get_dev_id("NAME:x")`` from the test application, where: + +- NAME is the desired subsystem: use "RVU_LF". +- x is the device's bus id specified in "bus:device.func" (BDF) format. BDF follows convention + used by lspci i.e bus, device and func are specified using respectively two, two and one hex + digit(s). + +Use this identifier for further rawdev function calls. + +Selftest rawdev API can be used to verify the mailbox communication between +PF and VF devices based applications. There can be multiple VFs for a particular PF. +Each VF can send mailboxes to PF and PF can broadcast message to all VFs. diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c index 3a3971ecd3..516fc896b9 100644 --- a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c +++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c @@ -5,8 +5,6 @@ #include #include #include -#include -#include #include #include #include @@ -155,7 +153,7 @@ rte_pmd_rvu_lf_pf_func_get(uint8_t dev_id) } static const struct rte_rawdev_ops rvu_lf_rawdev_ops = { - .dev_selftest = NULL, + .dev_selftest = rvu_lf_rawdev_selftest, }; static void diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.h b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.h index 65cc1bb64d..e64643dcee 100644 --- a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.h +++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.h @@ -21,4 +21,6 @@ extern int cnxk_logtype_rvu_lf; #define CNXK_RVU_LF_LOG(level, ...) \ RTE_LOG_LINE_PREFIX(level, CNXK_RVU_LF, "%s(): ", __func__, __VA_ARGS__) +int rvu_lf_rawdev_selftest(uint16_t dev_id); + #endif /* _CNXK_RVU_LF_H_ */ diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_selftest.c b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_selftest.c new file mode 100644 index 00..79439b2b72 --- /dev/null +++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_selftest.c @@ -0,0 +1,164 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2024 Marvell. + */ + +#include + +#include +#include +#include +#include + +#include +#include + +#include "cnxk_rvu_lf.h" +#include "cnxk_rvu_lf_driver.h" + +#define PF 0 +#define VF 0 +#define RSP_LEN64 +#define REQ_LEN64 +#define MSG_ID_FROM0x3000 +#define MSG_ID_TO 0x4000 +#define MAX_BAR6 + +static int +msg_process_notify_cb(uint16_t vf, uint16_t msg_id, + void *req, uint16_t req_len, void **rsp, uint16_t *rsp_len) +{ + uint8_t *resp; + int i; + + printf("\nReceived message(0x%x) from VF0x%x\n", msg_id, vf); + rte_hexdump(stdout, "req_data received", req, req_len); + + resp = malloc(RSP_LEN); + if (resp == NULL) + return -ENOMEM; + for (i = 0; i < RSP_LEN; i++) + resp[i] = 0xB0; + *rsp = resp; + *rsp_len = RSP_LEN; + rte_hexdump(stdout, "rsp_data_filled", *rsp, RSP_LEN); + + return 0; +} + +int +rvu_lf_rawdev_selftest(uint16_t dev_id) +{ + char *dev_name = rte_rawdevs[dev_id].name; + uint8_t req[REQ_LEN] = {0}; + uint8_t rsp[RSP_LEN] = {0}; + size_t bar_mask = 0; + size_t bar_va = 0; + unsigned int i, j; + uint16_t pf_func; + char *token[2]; + int func, ret; + + token[0] = strtok_r(dev_name, ".", &dev_name); + token[1] = strtok_r(dev_name, ".", &dev_name); + func = atoi(token[1]); + + ret = rte_rawdev_start(dev_id); + if (ret) + return ret; + + pf_func = rte_pmd_rvu_lf_npa_pf_func_get(); + if (pf_func == 0) + CNXK_RVU_LF_LOG(WARNING, "NPA pf_func is invalid"); + + pf_func = rte_pmd_rvu_lf_sso_pf_func_get(); + if (pf_func == 0) + CNXK_RVU_LF_LOG(WARNING, "SSO pf_func is invalid"); + + pf_func = rte_pmd_rvu_lf_pf_func_get(dev_id); + if (pf_func == 0
[PATCH v4 5/9] raw/cnxk_rvu_lf: set message ID range
Added API rte_pmd_rvu_lf_msg_id_range_set() to set RVU mailbox message id range. Signed-off-by: Akhil Goyal --- doc/guides/rawdevs/cnxk_rvu_lf.rst | 12 drivers/common/cnxk/roc_mbox.h | 1 + drivers/common/cnxk/roc_rvu_lf.c | 30 drivers/common/cnxk/roc_rvu_lf.h | 3 ++ drivers/common/cnxk/version.map | 2 ++ drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c| 14 + drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h | 15 ++ drivers/raw/cnxk_rvu_lf/version.map | 1 + 8 files changed, 78 insertions(+) diff --git a/doc/guides/rawdevs/cnxk_rvu_lf.rst b/doc/guides/rawdevs/cnxk_rvu_lf.rst index 52e4f12e3c..7622b19217 100644 --- a/doc/guides/rawdevs/cnxk_rvu_lf.rst +++ b/doc/guides/rawdevs/cnxk_rvu_lf.rst @@ -53,3 +53,15 @@ Application can register interrupt handlers using ``rte_pmd_rvu_lf_irq_register( or remove interrupt handler using ``rte_pmd_rvu_lf_irq_unregister()``. The irq numbers for which the interrupts are registered is negotiated separately and is not in scope of the driver. + +RVU LF RAW MESSAGE PROCESSING +- + +Once a RVU LF raw device is probed, a range of message ids can be configured for +which mailboxes will be sent using the API ``rte_pmd_rvu_lf_msg_id_range_set``. + +For processing of mailboxes received on PF/VF application, application +can register callbacks using ``rte_pmd_rvu_lf_msg_handler_register()`` +and fill required responses as per the request and message id received. +Application can also unregister already registered message callbacks using +``rte_pmd_rvu_lf_msg_handler_unregister()``. diff --git a/drivers/common/cnxk/roc_mbox.h b/drivers/common/cnxk/roc_mbox.h index dd65946e9e..f8791e9f84 100644 --- a/drivers/common/cnxk/roc_mbox.h +++ b/drivers/common/cnxk/roc_mbox.h @@ -54,6 +54,7 @@ struct mbox_msghdr { #define MBOX_MSG_MASK 0x #define MBOX_MSG_INVALID 0xFFFE #define MBOX_MSG_MAX0x +#define MBOX_MSG_GENERIC_MAX_ID 0x1FF #define MBOX_MESSAGES \ /* Generic mbox IDs (range 0x000 - 0x1FF) */ \ diff --git a/drivers/common/cnxk/roc_rvu_lf.c b/drivers/common/cnxk/roc_rvu_lf.c index 2e1be81e52..1026ccc125 100644 --- a/drivers/common/cnxk/roc_rvu_lf.c +++ b/drivers/common/cnxk/roc_rvu_lf.c @@ -62,6 +62,36 @@ roc_rvu_lf_dev_fini(struct roc_rvu_lf *roc_rvu_lf) return dev_fini(&rvu->dev, rvu->pci_dev); } +int +roc_rvu_lf_msg_id_range_set(struct roc_rvu_lf *roc_rvu_lf, uint16_t from, uint16_t to) +{ + struct rvu_lf *rvu = roc_rvu_lf_to_rvu_priv(roc_rvu_lf); + + if (from <= MBOX_MSG_GENERIC_MAX_ID || from > to) + return -EINVAL; + + rvu->msg_id_from = from; + rvu->msg_id_to = to; + + return 0; +} + +bool +roc_rvu_lf_msg_id_range_check(struct roc_rvu_lf *roc_rvu_lf, uint16_t msg_id) +{ + struct rvu_lf *rvu; + + if (roc_rvu_lf == NULL) + return 0; + + rvu = roc_rvu_lf_to_rvu_priv(roc_rvu_lf); + + if (msg_id > rvu->msg_id_from && msg_id < rvu->msg_id_to) + return 1; + + return 0; +} + int roc_rvu_lf_irq_register(struct roc_rvu_lf *roc_rvu_lf, unsigned int irq, roc_rvu_lf_intr_cb_fn cb, void *data) diff --git a/drivers/common/cnxk/roc_rvu_lf.h b/drivers/common/cnxk/roc_rvu_lf.h index 90a0b5690a..7243e170b9 100644 --- a/drivers/common/cnxk/roc_rvu_lf.h +++ b/drivers/common/cnxk/roc_rvu_lf.h @@ -21,6 +21,9 @@ TAILQ_HEAD(roc_rvu_lf_head, roc_rvu_lf); int __roc_api roc_rvu_lf_dev_init(struct roc_rvu_lf *roc_rvu_lf); int __roc_api roc_rvu_lf_dev_fini(struct roc_rvu_lf *roc_rvu_lf); +int __roc_api roc_rvu_lf_msg_id_range_set(struct roc_rvu_lf *roc_rvu_lf, + uint16_t from, uint16_t to); +bool __roc_api roc_rvu_lf_msg_id_range_check(struct roc_rvu_lf *roc_rvu_lf, uint16_t msg_id); typedef void (*roc_rvu_lf_intr_cb_fn)(void *cb_arg); typedef int (*roc_rvu_lf_msg_handler_cb_fn)(uint16_t vf, uint16_t msg_id, void *req, uint16_t req_len, diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 964c53f819..e38da19956 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -555,5 +555,7 @@ INTERNAL { roc_rvu_lf_irq_unregister; roc_rvu_lf_msg_handler_register; roc_rvu_lf_msg_handler_unregister; + roc_rvu_lf_msg_id_range_check; + roc_rvu_lf_msg_id_range_set; local: *; }; diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c index 29ab738392..82439cf9f8 100644 --- a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c +++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c @@ -16,6 +16,20 @@ #include "cnxk_rvu_lf.h" #include "cnxk_rvu_lf_driver.h" +int +rte_pmd_rvu_lf_msg_id_range_set(uint8_t dev_id, uint16_t fr
Re: [PATCH] eal: support including mapped memory in core dump
- On Oct 23, 2024, at 6:18 PM, Dmitry Kozlyuk dmitry.kozl...@gmail.com wrote: > Lewis, testing on FreeBSD would be appreciated. Well, unfortunately, it's not working very well... The contigmem memory was not included in the core dump. I added logging just before the madvise() call to prove that it's calling madvise() properly, and it looks good. I then tried forcing all madvise() calls to use EAL_DODUMP. And finally, I tried removing the call to madvise() altogether. None of those things changed the size of the core dump from what it was, and my test of trying to access an mbuf in the debugger still says the memory is inaccessible. What's even worse is, it appears that I had already tried the above work-arounds back on May 28th and mentioned that in an e-mail to you. Apparently I totally forgot about those experiments! At the time, I wondered if it was just something fundamental about FreeBSD and contigmem. It may take some digging through the FreeBSD source code to see how the dumper works. So I apologize for not remembering that this wasn't entirely a DPDK issue. That said, it's nice that this is available on Linux and maybe we'll find a way to make it work on FreeBSD. Thanks again for the efforts, lew
[PATCH v5 7/9] raw/cnxk_rvu_lf: add API to get device pffunc
Added ``rte_pmd_rvu_lf_pf_func_get`` API to get RVU LF device pffunc for the application use. Signed-off-by: Akhil Goyal --- drivers/common/cnxk/roc_rvu_lf.c | 2 +- drivers/common/cnxk/roc_rvu_lf.h | 2 ++ drivers/common/cnxk/version.map | 1 + drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c| 15 +++ drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h | 12 drivers/raw/cnxk_rvu_lf/version.map | 1 + 6 files changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/common/cnxk/roc_rvu_lf.c b/drivers/common/cnxk/roc_rvu_lf.c index 471dfa7a46..862a201135 100644 --- a/drivers/common/cnxk/roc_rvu_lf.c +++ b/drivers/common/cnxk/roc_rvu_lf.c @@ -62,7 +62,7 @@ roc_rvu_lf_dev_fini(struct roc_rvu_lf *roc_rvu_lf) return dev_fini(&rvu->dev, rvu->pci_dev); } -static uint16_t +uint16_t roc_rvu_lf_pf_func_get(struct roc_rvu_lf *roc_rvu_lf) { struct rvu_lf *rvu = roc_rvu_lf_to_rvu_priv(roc_rvu_lf); diff --git a/drivers/common/cnxk/roc_rvu_lf.h b/drivers/common/cnxk/roc_rvu_lf.h index 6b4819666a..8c71876cbc 100644 --- a/drivers/common/cnxk/roc_rvu_lf.h +++ b/drivers/common/cnxk/roc_rvu_lf.h @@ -21,6 +21,8 @@ TAILQ_HEAD(roc_rvu_lf_head, roc_rvu_lf); int __roc_api roc_rvu_lf_dev_init(struct roc_rvu_lf *roc_rvu_lf); int __roc_api roc_rvu_lf_dev_fini(struct roc_rvu_lf *roc_rvu_lf); +uint16_t __roc_api roc_rvu_lf_pf_func_get(struct roc_rvu_lf *roc_rvu_lf); + int __roc_api roc_rvu_lf_msg_process(struct roc_rvu_lf *roc_rvu_lf, uint16_t vf, uint16_t msg_id, void *req_data, uint16_t req_len, diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 1b33421d3d..f8028ee4e6 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -558,6 +558,7 @@ INTERNAL { roc_rvu_lf_msg_id_range_check; roc_rvu_lf_msg_id_range_set; roc_rvu_lf_msg_process; + roc_rvu_lf_pf_func_get; local: *; }; diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c index 17917532cd..156b9460c1 100644 --- a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c +++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c @@ -115,6 +115,21 @@ rte_pmd_rvu_lf_sso_pf_func_get(void) return roc_sso_pf_func_get(); } +uint16_t +rte_pmd_rvu_lf_pf_func_get(uint8_t dev_id) +{ + struct roc_rvu_lf *roc_rvu_lf; + struct rte_rawdev *rawdev; + + rawdev = rte_rawdev_pmd_get_dev(dev_id); + if (rawdev == NULL) + return 0; + + roc_rvu_lf = (struct roc_rvu_lf *)rawdev->dev_private; + + return roc_rvu_lf_pf_func_get(roc_rvu_lf); +} + static const struct rte_rawdev_ops rvu_lf_rawdev_ops = { .dev_selftest = NULL, }; diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h index 981d297aba..22978f89af 100644 --- a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h +++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h @@ -40,6 +40,18 @@ uint16_t rte_pmd_rvu_lf_npa_pf_func_get(void); __rte_internal uint16_t rte_pmd_rvu_lf_sso_pf_func_get(void); +/** + * Obtain RVU LF device PF func + * + * @param dev_id + * device id of RVU LF device + * + * @return + * Returns RVU LF pf_func on success, 0 in case of invalid pf_func. + */ +__rte_internal +uint16_t rte_pmd_rvu_lf_pf_func_get(uint8_t dev_id); + /** * Signature of callback function called when an interrupt is received on RVU LF device. * diff --git a/drivers/raw/cnxk_rvu_lf/version.map b/drivers/raw/cnxk_rvu_lf/version.map index 7896a8f777..aa974f629e 100644 --- a/drivers/raw/cnxk_rvu_lf/version.map +++ b/drivers/raw/cnxk_rvu_lf/version.map @@ -8,6 +8,7 @@ INTERNAL { rte_pmd_rvu_lf_msg_id_range_set; rte_pmd_rvu_lf_msg_process; rte_pmd_rvu_lf_npa_pf_func_get; + rte_pmd_rvu_lf_pf_func_get; rte_pmd_rvu_lf_sso_pf_func_get; local: *; -- 2.25.1
DPDK Release Status Meeting 2024-10-17
Release status meeting minutes 2024-10-17 = Agenda: * Release Dates * Subtrees * Roadmaps * LTS * Defects * Opens Participants: * ARM * Debian/Microsoft * Intel * Marvell * Nvidia * Red Hat Release Dates - The following are the current/updated working dates for 24.11: - Proposal deadline (RFC/v1 patches): 7 September 2024 - API freeze (-rc1): 19 October 2024 - PMD features freeze (-rc2): 6 November 2024 - Builtin applications features freeze (-rc3): 4 November 2024 - Release: 18 November 2023 https://core.dpdk.org/roadmap/#dates Subtrees * next-net * Most ethdev merged for RC1 * Most driver patches merged apart from new ones which will be merged post RC1 * 2 New PMD: net/sxe, net/xsc - under review * 2 Updating: net/r8169, net/zxdh. Also Napatech: net/ntnic. * Bonding needs a maintainer * next-net-intel * 5 base code updates merged into RC1 * Some patchsets pending for RC2 * Fixed needed for Ubuntu build error: https://build.opensuse.org/package/live_build_log/home:bluca:dpdk/dpdk/Ubuntu_24.04/x86_64 * next-net-mlx * 30 patches on list for RC2. * next-net-mvl * 15 patches in queue for RC2. * next-eventdev * 20 patches in queue for RC2. * next-baseband * Looking at series for ACC. * next-virtio * One series under review. Should be ready for merge this week. * next-crypto * Will target RC2 merge next week. * next-dts * Working on doc patch and large merge. * main * RC1 released on 19 October * Please note: all subtree maintainers should rebase to RC1 due to some CI fixes. * Thomas will be out of office next week, please merge to the subtrees as much as possible this week. * Power library needs review. * RC2 targeting 6 November 2024 **Note**: We will look to move this meeting to a US friendly time slot at the start of November. LTS --- Status of the current LTSes * 23.11.2 - Released. * 22.11.6 - Released. * 21.11.8 - Released. * 20.11.10 - Will only be updated with CVE and critical fixes. * 19.11.15 - Will only be updated with CVE and critical fixes. * Distros * Debian 12 contains DPDK v22.11 * Ubuntu 24.04 contains DPDK v23.11 * Ubuntu 23.04 contains DPDK v22.11 * RHEL 8/9 contains DPDK 23.11 Defects --- * Bugzilla links, 'Bugs', added for hosted projects * https://www.dpdk.org/hosted-projects/ DPDK Release Status Meetings The DPDK Release Status Meeting is intended for DPDK Committers to discuss the status of the master tree and sub-trees, and for project managers to track progress or milestone dates. The meeting occurs on every Thursday at 9:30 DST over Jitsi on https://meet.jit.si/DPDK You don't need an invite to join the meeting but if you want a calendar reminder just send an email to "John McNamara john.mcnam...@intel.com" for the invite.
RE: [RFC v2] ethdev: an API for cache stashing hints
> If we had a hwtopo API in DPDK, we could just use a node id in such a graph > (of CPUs and caches) to describe were the data ideally would land. > In such a case, you could have a node id for DDR as well, and thus you could > drop the notion of "stashing". Just a "drop off the data here, please, if you > can" API. > > I don't think this API and its documentation should talk about what the "CPU" > needs, since it's somewhat misleading. > > For example, you can imagine you want the packet payload to land in the LLC, > even though it's not for any CPU to consume, in case you know with some > certaintly that the packet will soon be transmitted (and thus consumed by the > NIC). > > The same scenario can happen, the consumer is an accelerator (e.g., a crypto > engine). > > Likewise, you may know that the whole packet will be read by some CPU core, > but you also know the system tends to buffer packets before they are being > processed. In such a case, it's better to go to DRAM right away, to avoid > trashing the LLC (or some other cache). > > Also, why do you need to use the word "host"? Seems like a PCI thing. > This may be implemented in PCI, but surely can be done (and has been > done) without PCI. > Thanks, Mattias. V2 is outdated, please provide feedback on V3.
[PATCH 4/4] crypto/dpaa2_sec: add support for IPv6 UDP encap
This patch enables support for NAT-T traversal in IPSEC ESP protocol offload mode for IPv6 Signed-off-by: Hemant Agrawal --- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 68 + 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index b34183d594..3814f954ce 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -50,6 +50,7 @@ #define FSL_SUBSYSTEM_SEC 1 #define FSL_MC_DPSECI_DEVID 3 +#define DPAA2_DEFAULT_NAT_T_PORT 4500 #define NO_PREFETCH 0 #define DRIVER_DUMP_MODE "drv_dump_mode" @@ -3164,6 +3165,7 @@ dpaa2_sec_set_ipsec_session(struct rte_cryptodev *dev, uint8_t hdr[48] = {}; struct rte_ipv4_hdr *ip4_hdr; struct rte_ipv6_hdr *ip6_hdr; + struct rte_udp_hdr *uh = NULL; struct ipsec_encap_pdb encap_pdb; flc->dhr = SEC_FLC_DHR_OUTBOUND; @@ -3235,29 +3237,10 @@ dpaa2_sec_set_ipsec_session(struct rte_cryptodev *dev, memcpy(&ip4_hdr->dst_addr, &ipsec_xform->tunnel.ipv4.dst_ip, sizeof(struct in_addr)); if (ipsec_xform->options.udp_encap) { - uint16_t sport, dport; - struct rte_udp_hdr *uh = - (struct rte_udp_hdr *) (hdr + - sizeof(struct rte_ipv4_hdr)); - - sport = ipsec_xform->udp.sport ? - ipsec_xform->udp.sport : 4500; - dport = ipsec_xform->udp.dport ? - ipsec_xform->udp.dport : 4500; - uh->src_port = rte_cpu_to_be_16(sport); - uh->dst_port = rte_cpu_to_be_16(dport); - uh->dgram_len = 0; - uh->dgram_cksum = 0; - ip4_hdr->next_proto_id = IPPROTO_UDP; - ip4_hdr->total_length = - rte_cpu_to_be_16( + ip4_hdr->total_length = rte_cpu_to_be_16( sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_udp_hdr)); - encap_pdb.ip_hdr_len += - sizeof(struct rte_udp_hdr); - encap_pdb.options |= - PDBOPTS_ESP_NAT | PDBOPTS_ESP_NUC; } else { ip4_hdr->total_length = rte_cpu_to_be_16( @@ -3284,14 +3267,39 @@ dpaa2_sec_set_ipsec_session(struct rte_cryptodev *dev, ip6_hdr->payload_len = 0; ip6_hdr->hop_limits = ipsec_xform->tunnel.ipv6.hlimit ? ipsec_xform->tunnel.ipv6.hlimit : 0x40; - ip6_hdr->proto = (ipsec_xform->proto == - RTE_SECURITY_IPSEC_SA_PROTO_ESP) ? - IPPROTO_ESP : IPPROTO_AH; memcpy(&ip6_hdr->src_addr, &ipsec_xform->tunnel.ipv6.src_addr, 16); memcpy(&ip6_hdr->dst_addr, &ipsec_xform->tunnel.ipv6.dst_addr, 16); encap_pdb.ip_hdr_len = sizeof(struct rte_ipv6_hdr); + if (ipsec_xform->options.udp_encap) + ip6_hdr->proto = IPPROTO_UDP; + else + ip6_hdr->proto = (ipsec_xform->proto == + RTE_SECURITY_IPSEC_SA_PROTO_ESP) ? + IPPROTO_ESP : IPPROTO_AH; + } + if (ipsec_xform->options.udp_encap) { + uint16_t sport, dport; + + if (ipsec_xform->tunnel.type == RTE_SECURITY_IPSEC_TUNNEL_IPV4) + uh = (struct rte_udp_hdr *) (hdr + + sizeof(struct rte_ipv4_hdr)); + else + uh = (struct rte_udp_hdr *) (hdr + + sizeof(struct rte_ipv6_hdr)); + + sport = ipsec_xform->udp.sport ? + ipsec_xform->udp.sport : DPAA2_DEFAULT_NAT_T_PORT; + dport = ipsec_xform->udp.dport ? + ipsec_xform->udp.dport : DPAA2_DEFAULT_NAT_T_PORT; + uh->src_port = rte_cpu_to_be_16(sport); +
[PATCH 3/4] crypto/dpaa_sec: add support for UDP-encapsulated ESP
From: Barry Cao This patch enables support for NAT-T traversal in IPSEC ESP protocol offload mode. Signed-off-by: Hemant Agrawal Signed-off-by: Barry Cao --- drivers/crypto/dpaa_sec/dpaa_sec.c | 63 -- drivers/crypto/dpaa_sec/dpaa_sec.h | 14 +++ 2 files changed, 66 insertions(+), 11 deletions(-) diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index 881435fdb6..3fa88ca968 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -46,6 +47,7 @@ #include #define DRIVER_DUMP_MODE "drv_dump_mode" +#define DPAA_DEFAULT_NAT_T_PORT 4500 /* DPAA_SEC_DP_DUMP levels */ enum dpaa_sec_dump_levels { @@ -2961,15 +2963,22 @@ dpaa_sec_set_ipsec_session(__rte_unused struct rte_cryptodev *dev, RTE_SECURITY_IPSEC_TUNNEL_IPV4) { session->ip4_hdr.ip_v = IPVERSION; session->ip4_hdr.ip_hl = 5; - session->ip4_hdr.ip_len = rte_cpu_to_be_16( - sizeof(session->ip4_hdr)); + if (ipsec_xform->options.udp_encap) + session->ip4_hdr.ip_len = rte_cpu_to_be_16( + sizeof(session->ip4_hdr) + sizeof(struct rte_udp_hdr)); + else + session->ip4_hdr.ip_len = rte_cpu_to_be_16( + sizeof(session->ip4_hdr)); session->ip4_hdr.ip_tos = ipsec_xform->tunnel.ipv4.dscp; session->ip4_hdr.ip_id = 0; session->ip4_hdr.ip_off = 0; session->ip4_hdr.ip_ttl = ipsec_xform->tunnel.ipv4.ttl; - session->ip4_hdr.ip_p = (ipsec_xform->proto == - RTE_SECURITY_IPSEC_SA_PROTO_ESP) ? - IPPROTO_ESP : IPPROTO_AH; + if (ipsec_xform->options.udp_encap) + session->ip4_hdr.ip_p = IPPROTO_UDP; + else + session->ip4_hdr.ip_p = (ipsec_xform->proto == + RTE_SECURITY_IPSEC_SA_PROTO_ESP) ? + IPPROTO_ESP : IPPROTO_AH; session->ip4_hdr.ip_sum = 0; session->ip4_hdr.ip_src = ipsec_xform->tunnel.ipv4.src_ip; @@ -2993,9 +3002,12 @@ dpaa_sec_set_ipsec_session(__rte_unused struct rte_cryptodev *dev, session->ip6_hdr.payload_len = 0; session->ip6_hdr.hop_limits = ipsec_xform->tunnel.ipv6.hlimit; - session->ip6_hdr.proto = (ipsec_xform->proto == - RTE_SECURITY_IPSEC_SA_PROTO_ESP) ? - IPPROTO_ESP : IPPROTO_AH; + if (ipsec_xform->options.udp_encap) + session->ip6_hdr.proto = IPPROTO_UDP; + else + session->ip6_hdr.proto = (ipsec_xform->proto == + RTE_SECURITY_IPSEC_SA_PROTO_ESP) ? + IPPROTO_ESP : IPPROTO_AH; memcpy(&session->ip6_hdr.src_addr, &ipsec_xform->tunnel.ipv6.src_addr, 16); memcpy(&session->ip6_hdr.dst_addr, @@ -3022,18 +3034,47 @@ dpaa_sec_set_ipsec_session(__rte_unused struct rte_cryptodev *dev, session->encap_pdb.seq_num_ext_hi = conf->ipsec.esn.hi; session->encap_pdb.seq_num = conf->ipsec.esn.low; } + if (ipsec_xform->options.udp_encap) { + struct rte_udp_hdr *udp_hdr; + + if (ipsec_xform->tunnel.type == RTE_SECURITY_IPSEC_TUNNEL_IPV4) + udp_hdr = (struct rte_udp_hdr *)(&session->udp4.udp_hdr); + else + udp_hdr = (struct rte_udp_hdr *)(&session->udp6.udp_hdr); + + if (ipsec_xform->udp.sport) + udp_hdr->src_port = rte_cpu_to_be_16(ipsec_xform->udp.sport); + else + udp_hdr->src_port = rte_cpu_to_be_16(DPAA_DEFAULT_NAT_T_PORT); + + if (ipsec_xform->udp.dport) + udp_hdr->dst_port = rte_cpu_to_be_16(ipsec_xform->udp.dport); + else + udp_hdr->dst_port = rte_cpu_to_be_16(DPAA_DEFAULT_NAT_T_PORT); +
[PATCH] MAINTAINERS: add maintainers for Intel NIC drivers
The ixgbe, i40e, iavf and ice NIC drivers are all actively maintained and receiving updates. Add official maintainer names for these drivers in the MAINTAINERS file. Signed-off-by: Bruce Richardson --- MAINTAINERS | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index cd78bc7db1..f8eecb4527 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -770,6 +770,8 @@ F: doc/guides/nics/features/e1000.ini F: doc/guides/nics/features/igb*.ini Intel ixgbe +M: Anatoly Burakov +M: Vladimir Medvedkin T: git://dpdk.org/next/dpdk-next-net-intel F: drivers/net/ixgbe/ F: doc/guides/nics/ixgbe.rst @@ -777,6 +779,8 @@ F: doc/guides/nics/intel_vf.rst F: doc/guides/nics/features/ixgbe*.ini Intel i40e +M: Ian Stokes +M: Bruce Richardson T: git://dpdk.org/next/dpdk-next-net-intel F: drivers/net/i40e/ F: doc/guides/nics/i40e.rst @@ -790,13 +794,16 @@ F: doc/guides/nics/fm10k.rst F: doc/guides/nics/features/fm10k*.ini Intel iavf -M: Jingjing Wu +M: Vladimir Medvedkin +M: Ian Stokes T: git://dpdk.org/next/dpdk-next-net-intel F: drivers/net/iavf/ F: drivers/common/iavf/ F: doc/guides/nics/features/iavf*.ini Intel ice +M: Bruce Richardson +M: Anatoly Burakov T: git://dpdk.org/next/dpdk-next-net-intel F: drivers/net/ice/ F: doc/guides/nics/ice.rst -- 2.43.0