[PATCH 3/4] vhost: use imported VDUSE uAPI header
This patch makes use of the imported VDUSE uAPI header, and remove VDUSE build dependency on the presence of the VDUSE header on the system. Signed-off-by: Maxime Coquelin --- lib/vhost/meson.build | 5 + lib/vhost/vduse.c | 2 +- lib/vhost/vduse.h | 22 -- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/lib/vhost/meson.build b/lib/vhost/meson.build index 33773b6d21..9c6325aa0e 100644 --- a/lib/vhost/meson.build +++ b/lib/vhost/meson.build @@ -33,16 +33,13 @@ sources = files( 'iotlb.c', 'socket.c', 'vdpa.c', +'vduse.c', 'vhost.c', 'vhost_crypto.c', 'vhost_user.c', 'virtio_net.c', 'virtio_net_ctrl.c', ) -if cc.has_header('linux/vduse.h') -sources += files('vduse.c') -cflags += '-DVHOST_HAS_VDUSE' -endif headers = files( 'rte_vdpa.h', 'rte_vhost.h', diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c index 801674be42..a2a7d73388 100644 --- a/lib/vhost/vduse.c +++ b/lib/vhost/vduse.c @@ -8,7 +8,7 @@ #include -#include +#include #include #include diff --git a/lib/vhost/vduse.h b/lib/vhost/vduse.h index 0d8f3f1205..47ca97a064 100644 --- a/lib/vhost/vduse.h +++ b/lib/vhost/vduse.h @@ -9,29 +9,7 @@ #define VDUSE_NET_SUPPORTED_FEATURES VIRTIO_NET_SUPPORTED_FEATURES -#ifdef VHOST_HAS_VDUSE - int vduse_device_create(const char *path, bool compliant_ol_flags); int vduse_device_destroy(const char *path); -#else - -static inline int -vduse_device_create(const char *path, bool compliant_ol_flags) -{ - RTE_SET_USED(compliant_ol_flags); - - VHOST_CONFIG_LOG(path, ERR, "VDUSE support disabled at build time"); - return -1; -} - -static inline int -vduse_device_destroy(const char *path) -{ - VHOST_CONFIG_LOG(path, ERR, "VDUSE support disabled at build time"); - return -1; -} - -#endif /* VHOST_HAS_VDUSE */ - #endif /* _VDUSE_H */ -- 2.49.0
[PATCH 2/4] uapi: import VDUSE header from v6.14 kernel
This header will be used by the Vhost library. Signed-off-by: Maxime Coquelin --- kernel/linux/uapi/linux/vduse.h | 353 kernel/linux/uapi/version | 2 +- 2 files changed, 354 insertions(+), 1 deletion(-) create mode 100644 kernel/linux/uapi/linux/vduse.h diff --git a/kernel/linux/uapi/linux/vduse.h b/kernel/linux/uapi/linux/vduse.h new file mode 100644 index 00..68a627d04a --- /dev/null +++ b/kernel/linux/uapi/linux/vduse.h @@ -0,0 +1,353 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ +#ifndef _UAPI_VDUSE_H_ +#define _UAPI_VDUSE_H_ + +#include + +#define VDUSE_BASE 0x81 + +/* The ioctls for control device (/dev/vduse/control) */ + +#define VDUSE_API_VERSION 0 + +/* + * Get the version of VDUSE API that kernel supported (VDUSE_API_VERSION). + * This is used for future extension. + */ +#define VDUSE_GET_API_VERSION _IOR(VDUSE_BASE, 0x00, __u64) + +/* Set the version of VDUSE API that userspace supported. */ +#define VDUSE_SET_API_VERSION _IOW(VDUSE_BASE, 0x01, __u64) + +/** + * struct vduse_dev_config - basic configuration of a VDUSE device + * @name: VDUSE device name, needs to be NUL terminated + * @vendor_id: virtio vendor id + * @device_id: virtio device id + * @features: virtio features + * @vq_num: the number of virtqueues + * @vq_align: the allocation alignment of virtqueue's metadata + * @reserved: for future use, needs to be initialized to zero + * @config_size: the size of the configuration space + * @config: the buffer of the configuration space + * + * Structure used by VDUSE_CREATE_DEV ioctl to create VDUSE device. + */ +struct vduse_dev_config { +#define VDUSE_NAME_MAX 256 + char name[VDUSE_NAME_MAX]; + __u32 vendor_id; + __u32 device_id; + __u64 features; + __u32 vq_num; + __u32 vq_align; + __u32 reserved[13]; + __u32 config_size; + __u8 config[]; +}; + +/* Create a VDUSE device which is represented by a char device (/dev/vduse/$NAME) */ +#define VDUSE_CREATE_DEV _IOW(VDUSE_BASE, 0x02, struct vduse_dev_config) + +/* + * Destroy a VDUSE device. Make sure there are no more references + * to the char device (/dev/vduse/$NAME). + */ +#define VDUSE_DESTROY_DEV _IOW(VDUSE_BASE, 0x03, char[VDUSE_NAME_MAX]) + +/* The ioctls for VDUSE device (/dev/vduse/$NAME) */ + +/** + * struct vduse_iotlb_entry - entry of IOTLB to describe one IOVA region [start, last] + * @offset: the mmap offset on returned file descriptor + * @start: start of the IOVA region + * @last: last of the IOVA region + * @perm: access permission of the IOVA region + * + * Structure used by VDUSE_IOTLB_GET_FD ioctl to find an overlapped IOVA region. + */ +struct vduse_iotlb_entry { + __u64 offset; + __u64 start; + __u64 last; +#define VDUSE_ACCESS_RO 0x1 +#define VDUSE_ACCESS_WO 0x2 +#define VDUSE_ACCESS_RW 0x3 + __u8 perm; +}; + +/* + * Find the first IOVA region that overlaps with the range [start, last] + * and return the corresponding file descriptor. Return -EINVAL means the + * IOVA region doesn't exist. Caller should set start and last fields. + */ +#define VDUSE_IOTLB_GET_FD _IOWR(VDUSE_BASE, 0x10, struct vduse_iotlb_entry) + +/* + * Get the negotiated virtio features. It's a subset of the features in + * struct vduse_dev_config which can be accepted by virtio driver. It's + * only valid after FEATURES_OK status bit is set. + */ +#define VDUSE_DEV_GET_FEATURES _IOR(VDUSE_BASE, 0x11, __u64) + +/** + * struct vduse_config_data - data used to update configuration space + * @offset: the offset from the beginning of configuration space + * @length: the length to write to configuration space + * @buffer: the buffer used to write from + * + * Structure used by VDUSE_DEV_SET_CONFIG ioctl to update device + * configuration space. + */ +struct vduse_config_data { + __u32 offset; + __u32 length; + __u8 buffer[]; +}; + +/* Set device configuration space */ +#define VDUSE_DEV_SET_CONFIG _IOW(VDUSE_BASE, 0x12, struct vduse_config_data) + +/* + * Inject a config interrupt. It's usually used to notify virtio driver + * that device configuration space has changed. + */ +#define VDUSE_DEV_INJECT_CONFIG_IRQ_IO(VDUSE_BASE, 0x13) + +/** + * struct vduse_vq_config - basic configuration of a virtqueue + * @index: virtqueue index + * @max_size: the max size of virtqueue + * @reserved: for future use, needs to be initialized to zero + * + * Structure used by VDUSE_VQ_SETUP ioctl to setup a virtqueue. + */ +struct vduse_vq_config { + __u32 index; + __u16 max_size; + __u16 reserved[13]; +}; + +/* + * Setup the specified virtqueue. Make sure all virtqueues have been + * configured before the device is attached to vDPA bus. + */ +#define VDUSE_VQ_SETUP _IOW(VDUSE_BASE, 0x14, struct vduse_vq_config) + +/** + * struct vduse_vq_state_split - split virtqueue state + * @avail_index: available index + */ +struct v
[PATCH 4/4] ci: check licenses
From: David Marchand Call check-spdx.tag.sh so that all committed files are checked. Signed-off-by: David Marchand Acked-by: Aaron Conole --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7a6b679fe5..1e289979e3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,6 +31,7 @@ jobs: failed= devtools/check-doc-vs-code.sh upstream/${{ env.REF_GIT_BRANCH }} || failed=true devtools/check-meson.py || failed=true +devtools/check-spdx-tag.sh || failed=true [ -z "$failed" ] ubuntu-vm-builds: name: ${{ join(matrix.config.*, '-') }} -- 2.49.0
[PATCH 1/4] license: add exception for Linux Kernel uAPI headers
As approved by both Technical and Governing boards, Linux Kernel uAPI header files can now be imported into the kernel/linux/uapi directory. This patch also fix the SPDX tags checker script to take into account dual-licensed files. The process to import such headers is documented in doc/guides/contributing/linux_uapi.rst Signed-off-by: Maxime Coquelin --- devtools/check-spdx-tag.sh | 2 +- license/Linux-syscall-note | 25 + license/exceptions.txt | 17 + 3 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 license/Linux-syscall-note diff --git a/devtools/check-spdx-tag.sh b/devtools/check-spdx-tag.sh index 1fd0d579d3..984825026e 100755 --- a/devtools/check-spdx-tag.sh +++ b/devtools/check-spdx-tag.sh @@ -48,7 +48,7 @@ check_licenses() { fi exceptions=$(build_exceptions_list) git grep -l SPDX-License-Identifier: -- $no_license_list $exceptions | -xargs grep -L -E 'SPDX-License-Identifier:[[:space:]]*\(?BSD-3-Clause' > $tmpfile +xargs grep -L -E 'SPDX-License-Identifier:[[:space:]]*(\(?|.* OR )BSD-3-Clause' > $tmpfile wrong_license=$(wc -l < $tmpfile) $quiet || cat $tmpfile diff --git a/license/Linux-syscall-note b/license/Linux-syscall-note new file mode 100644 index 00..9abdad71fa --- /dev/null +++ b/license/Linux-syscall-note @@ -0,0 +1,25 @@ +SPDX-Exception-Identifier: Linux-syscall-note +SPDX-URL: https://spdx.org/licenses/Linux-syscall-note.html +SPDX-Licenses: GPL-2.0, GPL-2.0+, GPL-1.0+, LGPL-2.0, LGPL-2.0+, LGPL-2.1, LGPL-2.1+, GPL-2.0-only, GPL-2.0-or-later +Usage-Guide: + This exception is used together with one of the above SPDX-Licenses + to mark user space API (uapi) header files so they can be included + into non GPL compliant user space application code. + To use this exception add it with the keyword WITH to one of the + identifiers in the SPDX-Licenses tag: +SPDX-License-Identifier: WITH Linux-syscall-note +License-Text: + + NOTE! This copyright does *not* cover user programs that use kernel + services by normal system calls - this is merely considered normal use + of the kernel, and does *not* fall under the heading of "derived work". + Also note that the GPL below is copyrighted by the Free Software + Foundation, but the instance of code that it refers to (the Linux + kernel) is copyrighted by me and others who actually wrote it. + + Also note that the only valid version of the GPL as far as the kernel + is concerned is _this_ particular version of the license (ie v2, not + v2.2 or v3.x or whatever), unless explicitly otherwise stated. + + Linus Torvalds + diff --git a/license/exceptions.txt b/license/exceptions.txt index d12fac2034..cf2034747d 100644 --- a/license/exceptions.txt +++ b/license/exceptions.txt @@ -9,11 +9,12 @@ Note that following licenses are not exceptions:- - BSD-3-Clause OR LGPL-2.1 - GPL-2.0 (*Only for kernel code*) -SPDX Identifier | TB Approval Date | GB Approval Date | File name -MIT | 10/23/2019 | 02/10/2020 | lib/eal/windows/include/dirent.h -BSD-2-Clause | 10/23/2019 | 12/18/2019 | lib/eal/windows/include/getopt.h -ISC AND BSD-2-Clause | 10/23/2019 | 12/18/2019 | lib/eal/windows/getopt.c -MIT | 10/19/2022 | 10/18/2022 | drivers/net/gve/base/* +- +SPDX Identifier | TB Approval Date | GB Approval Date | File name +- +MIT | 10/23/2019 | 02/10/2020 | lib/eal/windows/include/dirent.h +BSD-2-Clause| 10/23/2019 | 12/18/2019 | lib/eal/windows/include/getopt.h +ISC AND BSD-2-Clause| 10/23/2019 | 12/18/2019 | lib/eal/windows/getopt.c +MIT | 10/19/2022 | 10/18/2022 | drivers/net/gve/base/* +GPL-2.0 WITH Linux-syscall-note | 12/11/2024 | 04/14/2025 | kernel/linux/uapi/linux/* +- -- 2.49.0
[PATCH 0/4] Linux Kernel uAPI headers import
This series documents the license exception granted by both the technical and governing boards to import uAPI header files. It also imports VDUSE uAPI header file from Kernel v6.14. David Marchand (1): ci: check licenses Maxime Coquelin (3): license: add exception for Linux Kernel uAPI headers uapi: import VDUSE header from v6.14 kernel vhost: use imported VDUSE uAPI header .github/workflows/build.yml | 1 + devtools/check-spdx-tag.sh | 2 +- kernel/linux/uapi/linux/vduse.h | 353 kernel/linux/uapi/version | 2 +- lib/vhost/meson.build | 5 +- lib/vhost/vduse.c | 2 +- lib/vhost/vduse.h | 22 -- license/Linux-syscall-note | 25 +++ license/exceptions.txt | 17 +- 9 files changed, 392 insertions(+), 37 deletions(-) create mode 100644 kernel/linux/uapi/linux/vduse.h create mode 100644 license/Linux-syscall-note -- 2.49.0
[patch v6 5/6] bus/vmbus: add rte_vmbus_device to all functions accessing vmbus
From: Long Li The secondary process can access its vmbus device through device private region. Add and pass it on all call chains leading to vmbus code. Signed-off-by: Long Li --- Change log. v5: rebased to the latest net-next drivers/bus/vmbus/linux/vmbus_uio.c | 2 +- drivers/bus/vmbus/private.h | 2 +- drivers/bus/vmbus/rte_bus_vmbus.h | 16 ++- drivers/bus/vmbus/vmbus_channel.c | 32 + drivers/net/netvsc/hn_nvs.c | 18 drivers/net/netvsc/hn_nvs.h | 15 +++--- drivers/net/netvsc/hn_rndis.c | 11 +- drivers/net/netvsc/hn_rxtx.c| 16 +++ 8 files changed, 63 insertions(+), 49 deletions(-) diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c index 33edc151f6..8edec869ac 100644 --- a/drivers/bus/vmbus/linux/vmbus_uio.c +++ b/drivers/bus/vmbus/linux/vmbus_uio.c @@ -27,7 +27,7 @@ static void *vmbus_map_addr; /* Control interrupts */ -void vmbus_uio_irq_control(struct rte_vmbus_device *dev, int32_t onoff) +void vmbus_uio_irq_control(const struct rte_vmbus_device *dev, int32_t onoff) { if ((rte_intr_fd_get(dev->intr_handle) < 0) || write(rte_intr_fd_get(dev->intr_handle), &onoff, diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h index abee1b29f0..25b8a27fcf 100644 --- a/drivers/bus/vmbus/private.h +++ b/drivers/bus/vmbus/private.h @@ -110,7 +110,7 @@ void vmbus_insert_device(struct rte_vmbus_device *exist_vmbus_dev, struct rte_vmbus_device *new_vmbus_dev); void vmbus_remove_device(struct rte_vmbus_device *vmbus_device); -void vmbus_uio_irq_control(struct rte_vmbus_device *dev, int32_t onoff); +void vmbus_uio_irq_control(const struct rte_vmbus_device *dev, int32_t onoff); int vmbus_uio_irq_read(struct rte_vmbus_device *dev); int vmbus_uio_map_resource(struct rte_vmbus_device *dev); diff --git a/drivers/bus/vmbus/rte_bus_vmbus.h b/drivers/bus/vmbus/rte_bus_vmbus.h index fd18bca73c..2e9898ed7f 100644 --- a/drivers/bus/vmbus/rte_bus_vmbus.h +++ b/drivers/bus/vmbus/rte_bus_vmbus.h @@ -176,7 +176,8 @@ bool rte_vmbus_chan_rx_empty(const struct vmbus_channel *channel); * * Sends data in buffer directly to hyper-v via the vmbus */ -int rte_vmbus_chan_send(struct vmbus_channel *channel, uint16_t type, +int rte_vmbus_chan_send(struct rte_vmbus_device *dev, + struct vmbus_channel *channel, uint16_t type, void *data, uint32_t dlen, uint64_t xact, uint32_t flags, bool *need_sig); @@ -189,7 +190,8 @@ int rte_vmbus_chan_send(struct vmbus_channel *channel, uint16_t type, * Used when batching multiple sends and only signaling host * after the last send. */ -void rte_vmbus_chan_signal_tx(const struct vmbus_channel *channel); +void rte_vmbus_chan_signal_tx(struct rte_vmbus_device *dev, + const struct vmbus_channel *channel); /* Structure for scatter/gather I/O */ struct iova_list { @@ -223,7 +225,8 @@ struct iova_list { * * Sends data in buffer directly to hyper-v via the vmbus */ -int rte_vmbus_chan_send_sglist(struct vmbus_channel *channel, +int rte_vmbus_chan_send_sglist(struct rte_vmbus_device *dev, + struct vmbus_channel *channel, struct vmbus_gpa gpa[], uint32_t gpacnt, void *data, uint32_t dlen, uint64_t xact, bool *need_sig); @@ -243,7 +246,8 @@ int rte_vmbus_chan_send_sglist(struct vmbus_channel *channel, * On success, returns 0 * On failure, returns negative errno. */ -int rte_vmbus_chan_recv(struct vmbus_channel *chan, +int rte_vmbus_chan_recv(struct rte_vmbus_device *dev, + struct vmbus_channel *chan, void *data, uint32_t *len, uint64_t *request_id); @@ -273,7 +277,9 @@ int rte_vmbus_chan_recv_raw(struct vmbus_channel *chan, * @param bytes_read * Number of bytes read since last signal */ -void rte_vmbus_chan_signal_read(struct vmbus_channel *chan, uint32_t bytes_read); +void rte_vmbus_chan_signal_read(struct rte_vmbus_device *dev, + struct vmbus_channel *chan, + uint32_t bytes_read); /** * Determine sub channel index of the given channel diff --git a/drivers/bus/vmbus/vmbus_channel.c b/drivers/bus/vmbus/vmbus_channel.c index e7807abac3..d066e3288d 100644 --- a/drivers/bus/vmbus/vmbus_channel.c +++ b/drivers/bus/vmbus/vmbus_channel.c @@ -40,7 +40,8 @@ vmbus_set_monitor(const struct vmbus_channel *channel, uint32_t monitor_id) } static void -vmbus_set_event(const struct vmbus_channel *chan) +vmbus_set_event(struct rte_vmbus_device *dev __rte_unused, + const struct vmbus_channel *chan) { vmbus_set_monitor(chan, chan->monitor_id); } @@ -83,7 +84,7 @@ r
Re: [PATCH v1 04/12] node: add process callback for IP4 FIB
Hi Ankur, On 15/04/2025 13:10, Ankur Dwivedi wrote: Adds the process callback function for ip4_lookup_fib node. Signed-off-by: Ankur Dwivedi --- lib/node/ip4_lookup_fib.c | 164 ++ 1 file changed, 164 insertions(+) diff --git a/lib/node/ip4_lookup_fib.c b/lib/node/ip4_lookup_fib.c index e87864e672..c535b191f8 100644 --- a/lib/node/ip4_lookup_fib.c +++ b/lib/node/ip4_lookup_fib.c @@ -40,6 +40,169 @@ static struct ip4_lookup_fib_node_main ip4_lookup_fib_nm; #define IP4_LOOKUP_NODE_PRIV1_OFF(ctx) \ (((struct ip4_lookup_fib_node_ctx *)ctx)->mbuf_priv1_off) +static uint16_t +ip4_lookup_fib_node_process(struct rte_graph *graph, struct rte_node *node, void **objs, + uint16_t nb_objs) +{ + struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3, **pkts; + struct rte_fib *fib = IP4_LOOKUP_NODE_FIB(node->ctx); + const int dyn = IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx); + struct rte_ipv4_hdr *ipv4_hdr; + uint64_t next_hop[nb_objs]; + uint16_t lookup_err = 0; + void **to_next, **from; + uint16_t last_spec = 0; + rte_edge_t next_index; + uint16_t n_left_from; + uint32_t ip[nb_objs]; + uint16_t held = 0; + uint32_t drop_nh; + uint16_t next; + int i, rc; + + /* Speculative next */ + next_index = RTE_NODE_IP4_LOOKUP_NEXT_REWRITE; + /* Drop node */ + drop_nh = ((uint32_t)RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP) << 16; + + pkts = (struct rte_mbuf **)objs; + from = objs; + n_left_from = nb_objs; + + /* Get stream for the speculated next node */ + to_next = rte_node_next_stream_get(graph, node, next_index, nb_objs); + + for (i = OBJS_PER_CLINE; i < RTE_GRAPH_BURST_SIZE; i += OBJS_PER_CLINE) + rte_prefetch0(&objs[i]); Does this prefetching loop make any sense? Unless objs are not passed across threads this array likely to be in the cache already. And if objs are passed across threads, then why do you start prefetching from the next cache line instead of the first, and why don't you stop at nb_objs? + +#if RTE_GRAPH_BURST_SIZE > 64 + for (i = 0; i < 4 && i < n_left_from; i++) { + rte_prefetch0(pkts[i]); + rte_prefetch0(rte_pktmbuf_mtod_offset(pkts[i], void *, + sizeof(struct rte_ether_hdr))); This construction does not make sense to me. Same as similar constructions below The second prefetch has memory dependency of the data, that will be prefetched by the first one. Does removing this prefetch affects performance? + } +#endif + + i = 0; + while (n_left_from >= 4) { +#if RTE_GRAPH_BURST_SIZE > 64 + if (likely(n_left_from > 7)) { + rte_prefetch0(pkts[4]); + rte_prefetch0(rte_pktmbuf_mtod_offset(pkts[4], void *, + sizeof(struct rte_ether_hdr))); + rte_prefetch0(pkts[5]); + rte_prefetch0(rte_pktmbuf_mtod_offset(pkts[5], void *, + sizeof(struct rte_ether_hdr))); + rte_prefetch0(pkts[6]); + rte_prefetch0(rte_pktmbuf_mtod_offset(pkts[6], void *, + sizeof(struct rte_ether_hdr))); + rte_prefetch0(pkts[7]); + rte_prefetch0(rte_pktmbuf_mtod_offset(pkts[7], void *, + sizeof(struct rte_ether_hdr))); + } +#endif + + mbuf0 = pkts[0]; + mbuf1 = pkts[1]; + mbuf2 = pkts[2]; + mbuf3 = pkts[3]; + pkts += 4; + n_left_from -= 4; + /* Extract DIP of mbuf0 */ + ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf0, struct rte_ipv4_hdr *, + sizeof(struct rte_ether_hdr)); + /* Extract cksum, ttl as ipv4 hdr is in cache */ + node_mbuf_priv1(mbuf0, dyn)->cksum = ipv4_hdr->hdr_checksum; + node_mbuf_priv1(mbuf0, dyn)->ttl = ipv4_hdr->time_to_live; + + ip[i++] = rte_be_to_cpu_32(ipv4_hdr->dst_addr); + + /* Extract DIP of mbuf1 */ + ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf1, struct rte_ipv4_hdr *, + sizeof(struct rte_ether_hdr)); + /* Extract cksum, ttl as ipv4 hdr is in cache */ + node_mbuf_priv1(mbuf1, dyn)->cksum = ipv4_hdr->hdr_checksum; + node_mbuf_priv1(mbuf1, dyn)->ttl = ipv4_hdr->time_to_live; + + ip[i++] = rte_be_to_cpu_32(ipv4_hdr->dst_addr); + + /* Extract DIP of mbuf2 */ + ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf2, struct rte_ipv4_hdr *, + sizeof(struct rte_ether_hdr)); + /* Extract cksum, ttl as ipv4
Re: [PATCH 00/46] Support AMD Solarflare X45xx adaptors
On Wed, 16 Apr 2025 17:59:30 +0400 Ivan Malov wrote: > New X4522 (dual port SFP56) and X4542 (dual port QSFP56) adaptors are > Medford4 (X4) chips that are based on EF10 architecture. An X4 NIC > supports multiple network engine types. This series provides support > only for the Medford2-alike, 'full-feature' (FF) network engine. This > shall not be confused with the concept of 'datapath FW variants': the > FF network engine supports both 'full-feature' and 'ultra-low-latency' > datapath FW variants, with corresponding Medford2-alike feature sets. > > The first part of the series provides general support for the adaptors, > whilst the second one adds support for the new management controller > interface for configuration of network port features (netport MCDI). > > For now, only support for physical functions (PFs) is concerned. There > is a small number of TODO and FIXME markings in the code. Those are > normal at this development stage and will be removed by future patches > when VF support has fleshed out. > > > Andy Moreton (3): > common/sfc_efx/base: update X4 BAR layout and PCI IDs > net/sfc: add Medford4 with only full feature datapath engine > common/sfc_efx/base: add port mode for 8 port hardware > > Denis Pryazhennikov (15): > common/sfc_efx/base: add Medford4 PCI IDs to common code > common/sfc_efx/base: add efsys option for Medford4 > common/sfc_efx/base: add Medford4 support to NIC module > common/sfc_efx/base: add Medford4 support to EV module > common/sfc_efx/base: add Medford4 support to FILTER module > common/sfc_efx/base: add Medford4 support to INTR module > common/sfc_efx/base: add Medford4 support to MAC module > common/sfc_efx/base: add Medford4 support to PHY module > common/sfc_efx/base: add Medford4 support to TUNNEL module > common/sfc_efx/base: add Medford4 support to MCDI module > common/sfc_efx/base: add Medford4 support to Rx module > common/sfc_efx/base: add Medford4 support to Tx module > drivers: enable support for AMD Solarflare X4 adapter family > common/sfc_efx/base: add new X4 port mode > common/sfc_efx/base: extend list of supported X4 port modes > > Ivan Malov (28): > common/sfc_efx/base: update MCDI headers > common/sfc_efx/base: provide a stub for basic netport attach > common/sfc_efx/base: provide defaults on netport attach path > common/sfc_efx/base: obtain assigned netport handle from NIC > common/sfc_efx/base: allow for const in MCDI struct accessor > common/sfc_efx/base: get netport fixed capabilities on probe > common/sfc_efx/base: decode netport link state on probe path > common/sfc_efx/base: fill in loopback modes on netport probe > common/sfc_efx/base: introduce Medford4 stub for PHY methods > common/sfc_efx/base: refactor EF10 link mode decoding helper > common/sfc_efx/base: provide PHY link get method on Medford4 > common/sfc_efx/base: implement PHY link control for Medford4 > common/sfc_efx/base: introduce Medford4 stub for MAC methods > common/sfc_efx/base: add MAC reconfigure method for Medford4 > common/sfc_efx/base: fill in software LUT for MAC statistics > common/sfc_efx/base: fill in MAC statistics mask on Medford4 > common/sfc_efx/base: support MAC statistics on Medford4 NICs > common/sfc_efx/base: implement MAC PDU controls for Medford4 > common/sfc_efx/base: correct MAC PDU calculation on Medford4 > net/sfc: make use of generic EFX MAC PDU calculation helpers > common/sfc_efx/base: ignore legacy link events on new boards > common/sfc_efx/base: add link event processing on new boards > net/sfc: query link status on link change events on new NICs > common/sfc_efx/base: subscribe to netport link change events > net/sfc: offer support for 200G link ability on new adaptors > common/sfc_efx/base: support controls for netport lane count > net/sfc: add support for control of physical port lane count > doc: advertise support for AMD Solarflare X45xx adapters > > .mailmap |3 +- > doc/guides/nics/sfc_efx.rst |9 +- > doc/guides/rel_notes/release_25_07.rst|4 + > drivers/common/sfc_efx/base/ef10_ev.c | 39 + > drivers/common/sfc_efx/base/ef10_impl.h | 19 + > drivers/common/sfc_efx/base/ef10_nic.c| 98 +- > drivers/common/sfc_efx/base/ef10_phy.c| 43 +- > drivers/common/sfc_efx/base/ef10_tlv_layout.h |9 +- > drivers/common/sfc_efx/base/efx.h | 98 +- > drivers/common/sfc_efx/base/efx_check.h | 24 +- > drivers/common/sfc_efx/base/efx_ev.c |6 + > drivers/common/sfc_efx/base/efx_filter.c |6 + > drivers/common/sfc_efx/base/efx_impl.h| 115 +- > drivers/common/sfc_efx/base/efx_intr.c|6 + > drivers/common/sfc_efx/base/efx_mac.c | 56 +- > drivers/common/sfc_efx/base/efx_mcdi.c| 18 +- > drivers/common/sfc_efx/base/efx_mcdi.h|2 +- > drivers/common
[PATCH v2] net/ixgbe: support Rx/Tx burst mode info
Return burst mode according to the selected Rx/Tx burst function name. Update 25.07 release notes with this information. Signed-off-by: Roger Melton --- doc/guides/rel_notes/release_25_07.rst| 3 + drivers/net/intel/ixgbe/ixgbe_ethdev.c| 4 ++ drivers/net/intel/ixgbe/ixgbe_ethdev.h| 4 ++ drivers/net/intel/ixgbe/ixgbe_rxtx.c | 70 +++ drivers/net/intel/ixgbe/ixgbe_rxtx.h | 4 ++ .../net/intel/ixgbe/ixgbe_vf_representor.c| 4 +- 6 files changed, 87 insertions(+), 2 deletions(-) diff --git a/doc/guides/rel_notes/release_25_07.rst b/doc/guides/rel_notes/release_25_07.rst index 093b85d206..30bc9622ee 100644 --- a/doc/guides/rel_notes/release_25_07.rst +++ b/doc/guides/rel_notes/release_25_07.rst @@ -55,6 +55,9 @@ New Features Also, make sure to start the actual text at the margin. === +* **Updated Intel ixgbe driver.** + + * Added support for rx_burst_mode_get and tx_burst_mode_get. Removed Items - diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.c b/drivers/net/intel/ixgbe/ixgbe_ethdev.c index 0fa4898aba..f1fd271a0a 100644 --- a/drivers/net/intel/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.c @@ -532,6 +532,8 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .rx_queue_release = ixgbe_dev_rx_queue_release, .tx_queue_setup = ixgbe_dev_tx_queue_setup, .tx_queue_release = ixgbe_dev_tx_queue_release, + .rx_burst_mode_get= ixgbe_rx_burst_mode_get, + .tx_burst_mode_get= ixgbe_tx_burst_mode_get, .dev_led_on = ixgbe_dev_led_on, .dev_led_off = ixgbe_dev_led_off, .flow_ctrl_get= ixgbe_flow_ctrl_get, @@ -605,6 +607,8 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = { .tx_queue_release = ixgbe_dev_tx_queue_release, .rx_queue_intr_enable = ixgbevf_dev_rx_queue_intr_enable, .rx_queue_intr_disable = ixgbevf_dev_rx_queue_intr_disable, + .rx_burst_mode_get= ixgbe_rx_burst_mode_get, + .tx_burst_mode_get= ixgbe_tx_burst_mode_get, .mac_addr_add = ixgbevf_add_mac_addr, .mac_addr_remove = ixgbevf_remove_mac_addr, .set_mc_addr_list = ixgbe_dev_set_mc_addr_list, diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.h b/drivers/net/intel/ixgbe/ixgbe_ethdev.h index 8ad841ea2c..7b1cfe0ea4 100644 --- a/drivers/net/intel/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.h @@ -523,6 +523,10 @@ struct ixgbe_vf_representor { int ixgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params); int ixgbe_vf_representor_uninit(struct rte_eth_dev *ethdev); +uint16_t ixgbe_vf_representor_rx_burst(__rte_unused void *rx_queue, + __rte_unused struct rte_mbuf **rx_pkts, __rte_unused uint16_t nb_pkts); +uint16_t ixgbe_vf_representor_tx_burst(__rte_unused void *tx_queue, + __rte_unused struct rte_mbuf **tx_pkts, __rte_unused uint16_t nb_pkts); #define IXGBE_DEV_FDIR_CONF(dev) \ (&((struct ixgbe_adapter *)(dev)->data->dev_private)->fdir_conf) diff --git a/drivers/net/intel/ixgbe/ixgbe_rxtx.c b/drivers/net/intel/ixgbe/ixgbe_rxtx.c index 3d56ef..209dbe6685 100644 --- a/drivers/net/intel/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/intel/ixgbe/ixgbe_rxtx.c @@ -2626,6 +2626,39 @@ static const struct ixgbe_txq_ops def_txq_ops = { .reset = ixgbe_reset_tx_queue, }; +static const struct { + eth_tx_burst_t pkt_burst; + const char *info; +} ixgbe_tx_burst_info[] = { + { ixgbe_xmit_pkts, "Scalar"}, + { ixgbe_xmit_pkts_simple, "Scalar simple"}, + { ixgbe_vf_representor_tx_burst, "Scalar representor"}, +#ifdef RTE_ARCH_X86 + { ixgbe_xmit_pkts_vec, "Vector SSE"}, +#elif defined(RTE_ARCH_ARM) + { ixgbe_xmit_pkts_vec, "Vector NEON"}, +#endif +}; + +int +ixgbe_tx_burst_mode_get(struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode) +{ + eth_tx_burst_t pkt_burst = dev->tx_pkt_burst; + size_t i; + + for (i = 0; i < RTE_DIM(ixgbe_tx_burst_info); i++) { + if (pkt_burst == ixgbe_tx_burst_info[i].pkt_burst) { + snprintf(mode->info, sizeof(mode->info), "%s", +ixgbe_tx_burst_info[i].info); + return 0; + } + } + + return -EINVAL; +} + /* Takes an ethdev and a queue and sets up the tx function to be used based on * the queue parameters. Used in tx_queue_setup by primary process and then * in dev_init by secondary process when attaching to an existing ethdev. @@ -4939,6 +4972,43 @@ ixgbe_set_ivar(struct rte_eth_dev *dev, u8 entry, u8 vector, s8 type) } } +static const struct { + eth_rx_burst_t pkt_burst; + const char
[PATCH v3] net/ixgbe: support Rx/Tx burst mode info
Return burst mode according to the selected Rx/Tx burst function name. Update 25.07 release notes with this information. Signed-off-by: Roger Melton --- doc/guides/rel_notes/release_25_07.rst| 3 + drivers/net/intel/ixgbe/ixgbe_ethdev.c| 4 ++ drivers/net/intel/ixgbe/ixgbe_ethdev.h| 4 ++ drivers/net/intel/ixgbe/ixgbe_rxtx.c | 70 +++ drivers/net/intel/ixgbe/ixgbe_rxtx.h | 4 ++ .../net/intel/ixgbe/ixgbe_vf_representor.c| 4 +- 6 files changed, 87 insertions(+), 2 deletions(-) diff --git a/doc/guides/rel_notes/release_25_07.rst b/doc/guides/rel_notes/release_25_07.rst index 093b85d206..30bc9622ee 100644 --- a/doc/guides/rel_notes/release_25_07.rst +++ b/doc/guides/rel_notes/release_25_07.rst @@ -55,6 +55,9 @@ New Features Also, make sure to start the actual text at the margin. === +* **Updated Intel ixgbe driver.** + + * Added support for rx_burst_mode_get and tx_burst_mode_get. Removed Items - diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.c b/drivers/net/intel/ixgbe/ixgbe_ethdev.c index 0fa4898aba..f1fd271a0a 100644 --- a/drivers/net/intel/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.c @@ -532,6 +532,8 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .rx_queue_release = ixgbe_dev_rx_queue_release, .tx_queue_setup = ixgbe_dev_tx_queue_setup, .tx_queue_release = ixgbe_dev_tx_queue_release, + .rx_burst_mode_get= ixgbe_rx_burst_mode_get, + .tx_burst_mode_get= ixgbe_tx_burst_mode_get, .dev_led_on = ixgbe_dev_led_on, .dev_led_off = ixgbe_dev_led_off, .flow_ctrl_get= ixgbe_flow_ctrl_get, @@ -605,6 +607,8 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = { .tx_queue_release = ixgbe_dev_tx_queue_release, .rx_queue_intr_enable = ixgbevf_dev_rx_queue_intr_enable, .rx_queue_intr_disable = ixgbevf_dev_rx_queue_intr_disable, + .rx_burst_mode_get= ixgbe_rx_burst_mode_get, + .tx_burst_mode_get= ixgbe_tx_burst_mode_get, .mac_addr_add = ixgbevf_add_mac_addr, .mac_addr_remove = ixgbevf_remove_mac_addr, .set_mc_addr_list = ixgbe_dev_set_mc_addr_list, diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.h b/drivers/net/intel/ixgbe/ixgbe_ethdev.h index 8ad841ea2c..7b1cfe0ea4 100644 --- a/drivers/net/intel/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.h @@ -523,6 +523,10 @@ struct ixgbe_vf_representor { int ixgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params); int ixgbe_vf_representor_uninit(struct rte_eth_dev *ethdev); +uint16_t ixgbe_vf_representor_rx_burst(__rte_unused void *rx_queue, + __rte_unused struct rte_mbuf **rx_pkts, __rte_unused uint16_t nb_pkts); +uint16_t ixgbe_vf_representor_tx_burst(__rte_unused void *tx_queue, + __rte_unused struct rte_mbuf **tx_pkts, __rte_unused uint16_t nb_pkts); #define IXGBE_DEV_FDIR_CONF(dev) \ (&((struct ixgbe_adapter *)(dev)->data->dev_private)->fdir_conf) diff --git a/drivers/net/intel/ixgbe/ixgbe_rxtx.c b/drivers/net/intel/ixgbe/ixgbe_rxtx.c index 3d56ef..209dbe6685 100644 --- a/drivers/net/intel/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/intel/ixgbe/ixgbe_rxtx.c @@ -2626,6 +2626,39 @@ static const struct ixgbe_txq_ops def_txq_ops = { .reset = ixgbe_reset_tx_queue, }; +static const struct { + eth_tx_burst_t pkt_burst; + const char *info; +} ixgbe_tx_burst_info[] = { + { ixgbe_xmit_pkts, "Scalar"}, + { ixgbe_xmit_pkts_simple, "Scalar simple"}, + { ixgbe_vf_representor_tx_burst, "Scalar representor"}, +#ifdef RTE_ARCH_X86 + { ixgbe_xmit_pkts_vec, "Vector SSE"}, +#elif defined(RTE_ARCH_ARM) + { ixgbe_xmit_pkts_vec, "Vector NEON"}, +#endif +}; + +int +ixgbe_tx_burst_mode_get(struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode) +{ + eth_tx_burst_t pkt_burst = dev->tx_pkt_burst; + size_t i; + + for (i = 0; i < RTE_DIM(ixgbe_tx_burst_info); i++) { + if (pkt_burst == ixgbe_tx_burst_info[i].pkt_burst) { + snprintf(mode->info, sizeof(mode->info), "%s", +ixgbe_tx_burst_info[i].info); + return 0; + } + } + + return -EINVAL; +} + /* Takes an ethdev and a queue and sets up the tx function to be used based on * the queue parameters. Used in tx_queue_setup by primary process and then * in dev_init by secondary process when attaching to an existing ethdev. @@ -4939,6 +4972,43 @@ ixgbe_set_ivar(struct rte_eth_dev *dev, u8 entry, u8 vector, s8 type) } } +static const struct { + eth_rx_burst_t pkt_burst; + const char
[PATCH 02/46] common/sfc_efx/base: add efsys option for Medford4
From: Denis Pryazhennikov Later patches will use this to implement support for Medford4. Signed-off-by: Denis Pryazhennikov Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/efx_check.h | 24 ++-- drivers/common/sfc_efx/efsys.h | 2 ++ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/common/sfc_efx/base/efx_check.h b/drivers/common/sfc_efx/base/efx_check.h index 66b38eeae0..0b9f4fb516 100644 --- a/drivers/common/sfc_efx/base/efx_check.h +++ b/drivers/common/sfc_efx/base/efx_check.h @@ -32,7 +32,8 @@ /* Check family options for EF10 architecture controllers. */ #defineEFX_OPTS_EF10() \ - (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2) + (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 || \ + EFSYS_OPT_MEDFORD4) #ifdef EFSYS_OPT_FALCON # error "FALCON is obsolete and is not supported." @@ -197,7 +198,7 @@ #if EFSYS_OPT_IMAGE_LAYOUT /* Support signed image layout handling */ -# if !(EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2) +# if !(EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 || EFSYS_OPT_MEDFORD4) # error "IMAGE_LAYOUT requires MEDFORD or MEDFORD2" # endif #endif /* EFSYS_OPT_IMAGE_LAYOUT */ @@ -338,8 +339,10 @@ #if EFSYS_OPT_ALLOW_UNCONFIGURED_NIC /* Support adapters with missing static config (for factory use only) */ -# if !(EFSYS_OPT_RIVERHEAD || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2) -# error "ALLOW_UNCONFIGURED_NIC requires RIVERHEAD or MEDFORD or MEDFORD2" +# if !(EFSYS_OPT_RIVERHEAD || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 || \ + EFSYS_OPT_MEDFORD4) +# error "ALLOW_UNCONFIGURED_NIC requires RIVERHEAD or MEDFORD or MEDFORD2 " \ + "or MEDFORD4" # endif #endif /* EFSYS_OPT_ALLOW_UNCONFIGURED_NIC */ @@ -352,22 +355,23 @@ #if EFSYS_OPT_RX_ES_SUPER_BUFFER /* Support equal stride super-buffer mode */ -# if !(EFSYS_OPT_MEDFORD2) -# error "ES_SUPER_BUFFER requires MEDFORD2" +# if !(EFSYS_OPT_MEDFORD2 || EFSYS_OPT_MEDFORD4) +# error "ES_SUPER_BUFFER requires MEDFORD2 or MEDFORD4" # endif #endif /* Support hardware assistance for tunnels */ #if EFSYS_OPT_TUNNEL -# if !(EFSYS_OPT_RIVERHEAD || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2) -# error "TUNNEL requires RIVERHEAD or MEDFORD or MEDFORD2" +# if !(EFSYS_OPT_RIVERHEAD || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 || \ + EFSYS_OPT_MEDFORD4) +# error "TUNNEL requires RIVERHEAD or MEDFORD or MEDFORD2 or MEDFORD4" # endif #endif /* EFSYS_OPT_TUNNEL */ #if EFSYS_OPT_FW_SUBVARIANT_AWARE /* Advertise that the driver is firmware subvariant aware */ -# if !(EFSYS_OPT_MEDFORD2) -# error "FW_SUBVARIANT_AWARE requires MEDFORD2" +# if !(EFSYS_OPT_MEDFORD2 || EFSYS_OPT_MEDFORD4) +# error "FW_SUBVARIANT_AWARE requires MEDFORD2 or MEDFORD4" # endif #endif diff --git a/drivers/common/sfc_efx/efsys.h b/drivers/common/sfc_efx/efsys.h index 41fa3da762..e63cbdbe8f 100644 --- a/drivers/common/sfc_efx/efsys.h +++ b/drivers/common/sfc_efx/efsys.h @@ -125,6 +125,8 @@ prefetch_read_once(const volatile void *addr) #define EFSYS_OPT_MEDFORD2 1 /* Enable Riverhead support */ #define EFSYS_OPT_RIVERHEAD 1 +/* Disable Medford4 support (not supported yet) */ +#define EFSYS_OPT_MEDFORD4 0 #ifdef RTE_DEBUG_COMMON_SFC_EFX #define EFSYS_OPT_CHECK_REG 1 -- 2.39.5
[PATCH 03/46] common/sfc_efx/base: add Medford4 support to NIC module
From: Denis Pryazhennikov Implement NIC family discovery and minimum probe support. Signed-off-by: Denis Pryazhennikov Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/ef10_nic.c | 33 - drivers/common/sfc_efx/base/efx.h | 1 + drivers/common/sfc_efx/base/efx_impl.h | 7 +++- drivers/common/sfc_efx/base/efx_nic.c | 50 ++ 4 files changed, 89 insertions(+), 2 deletions(-) diff --git a/drivers/common/sfc_efx/base/ef10_nic.c b/drivers/common/sfc_efx/base/ef10_nic.c index 79d596b5ef..77c97217ee 100644 --- a/drivers/common/sfc_efx/base/ef10_nic.c +++ b/drivers/common/sfc_efx/base/ef10_nic.c @@ -1422,7 +1422,7 @@ ef10_get_datapath_caps( /* * Check if firmware reports the VI window mode. -* Medford2 has a variable VI window size (8K, 16K or 64K). +* Medford2 and Medford4 have a variable VI window size (8K, 16K or 64K). * Medford and Huntington have a fixed 8K VI window size. */ if (req.emr_out_length_used >= MC_CMD_GET_CAPABILITIES_V3_OUT_LEN) { @@ -1479,6 +1479,7 @@ ef10_get_datapath_caps( switch (enp->en_family) { case EFX_FAMILY_MEDFORD2: + case EFX_FAMILY_MEDFORD4: encp->enc_rx_scale_hash_alg_mask = (1U << EFX_RX_HASHALG_TOEPLITZ); break; @@ -1922,6 +1923,36 @@ static struct ef10_external_port_map_s { (1U << TLV_PORT_MODE_1x1_1x1), /* mode 2 */ { 0, 1, EFX_EXT_PORT_NA, EFX_EXT_PORT_NA } }, + /* +* Modes that on Medford4 allocate 2 adjacent port numbers to cage 1 +* and the rest to cage 2. +* port 0 -> cage 1 +* port 1 -> cage 1 +* port 2 -> cage 2 +* port 3 -> cage 2 +*/ + { + EFX_FAMILY_MEDFORD4, + (1U << TLV_PORT_MODE_2x1_2x1) | /* mode 5 */ + (1U << TLV_PORT_MODE_2x1_1x4) | /* mode 7 */ + (1U << TLV_PORT_MODE_2x2_NA) | /* mode 13 */ + (1U << TLV_PORT_MODE_2x1_1x2), /* mode 18 */ + { 0, 2, EFX_EXT_PORT_NA, EFX_EXT_PORT_NA } + }, + /* +* Modes that on Medford4 allocate up to 4 adjacent port numbers +* to cage 1. +* port 0 -> cage 1 +* port 1 -> cage 1 +* port 2 -> cage 1 +* port 3 -> cage 1 +*/ + { + EFX_FAMILY_MEDFORD4, + (1U << TLV_PORT_MODE_4x1_NA), /* mode 4 */ + { 0, EFX_EXT_PORT_NA, EFX_EXT_PORT_NA, EFX_EXT_PORT_NA } + }, + /* FIXME: review Medford4 port modes */ }; static __checkReturn efx_rc_t diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index dabf2e0e0b..442dfa0830 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -190,6 +190,7 @@ efx_family_probe_bar( /* FIXME Fix it when memory bar is fixed in FPGA image. It must be 0. */ #defineEFX_MEM_BAR_RIVERHEAD 2 +#defineEFX_MEM_BAR_MEDFORD40 /* Error codes */ diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index 662a21e90c..9d1f361c5d 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -972,7 +972,8 @@ struct efx_nic_s { }; #defineEFX_FAMILY_IS_EF10(_enp) \ - ((_enp)->en_family == EFX_FAMILY_MEDFORD2 || \ + ((_enp)->en_family == EFX_FAMILY_MEDFORD4 || \ +(_enp)->en_family == EFX_FAMILY_MEDFORD2 || \ (_enp)->en_family == EFX_FAMILY_MEDFORD || \ (_enp)->en_family == EFX_FAMILY_HUNTINGTON) @@ -1128,6 +1129,10 @@ struct efx_txq_s { rev = 'G'; \ break; \ \ + case EFX_FAMILY_MEDFORD4: \ + rev = 'H'; \ + break; \ + \ default:\ rev = '?'; \ break; \ diff --git a/drivers/common/sfc_efx/base/efx_nic.c b/drivers/common/sfc_efx/base/efx_nic.c index 172488e083..5bcc0a04ff 100644 --- a/drivers/common/sfc_efx/base/efx_nic.c +++ b/drivers/common/sfc_efx/base/efx_nic.c @@ -79,6 +79,19 @@ efx_family( return (0); #endif /* EFSYS_OPT_MEDFORD2 */ +#if
[PATCH 04/46] common/sfc_efx/base: add Medford4 support to EV module
From: Denis Pryazhennikov Use common EF10 method table for that. Signed-off-by: Denis Pryazhennikov Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/efx_ev.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/common/sfc_efx/base/efx_ev.c b/drivers/common/sfc_efx/base/efx_ev.c index 4808f8ddfc..13159a10f4 100644 --- a/drivers/common/sfc_efx/base/efx_ev.c +++ b/drivers/common/sfc_efx/base/efx_ev.c @@ -173,6 +173,12 @@ efx_ev_init( break; #endif /* EFSYS_OPT_RIVERHEAD */ +#if EFSYS_OPT_MEDFORD4 + case EFX_FAMILY_MEDFORD4: + eevop = &__efx_ev_ef10_ops; + break; +#endif /* EFSYS_OPT_MEDFORD4 */ + default: EFSYS_ASSERT(0); rc = ENOTSUP; -- 2.39.5
[PATCH 01/46] common/sfc_efx/base: add Medford4 PCI IDs to common code
From: Denis Pryazhennikov Later patches will use this to implement support for Medford4. Signed-off-by: Denis Pryazhennikov Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/efx.h | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index 5773cb00b3..dabf2e0e0b 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -64,6 +64,7 @@ typedef enum efx_family_e { EFX_FAMILY_MEDFORD, EFX_FAMILY_MEDFORD2, EFX_FAMILY_RIVERHEAD, + EFX_FAMILY_MEDFORD4, EFX_FAMILY_NTYPES } efx_family_t; @@ -172,6 +173,10 @@ efx_family_probe_bar( #defineEFX_PCI_DEVID_RIVERHEAD 0x0100 #defineEFX_PCI_DEVID_RIVERHEAD_VF 0x1100 +#defineEFX_PCI_DEVID_MEDFORD4_PF_UNINIT0x0C13 +#defineEFX_PCI_DEVID_MEDFORD4 0x0C03 +#defineEFX_PCI_DEVID_MEDFORD4_VF 0x1C03 + #defineEFX_MEM_BAR_SIENA 2 #defineEFX_MEM_BAR_HUNTINGTON_PF 2 -- 2.39.5
[PATCH 05/46] common/sfc_efx/base: add Medford4 support to FILTER module
From: Denis Pryazhennikov Use common EF10 method table for that. Signed-off-by: Denis Pryazhennikov Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/efx_filter.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/common/sfc_efx/base/efx_filter.c b/drivers/common/sfc_efx/base/efx_filter.c index 2c8c7bdc33..551db58fdd 100644 --- a/drivers/common/sfc_efx/base/efx_filter.c +++ b/drivers/common/sfc_efx/base/efx_filter.c @@ -201,6 +201,12 @@ efx_filter_init( break; #endif /* EFSYS_OPT_RIVERHEAD */ +#if EFSYS_OPT_MEDFORD4 + case EFX_FAMILY_MEDFORD4: + efop = &__efx_filter_ef10_ops; + break; +#endif /* EFSYS_OPT_MEDFORD4 */ + default: EFSYS_ASSERT(0); rc = ENOTSUP; -- 2.39.5
[PATCH 06/46] common/sfc_efx/base: add Medford4 support to INTR module
From: Denis Pryazhennikov Use common EF10 method table for that. Signed-off-by: Denis Pryazhennikov Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/efx_intr.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/common/sfc_efx/base/efx_intr.c b/drivers/common/sfc_efx/base/efx_intr.c index 792302f540..8fdef839db 100644 --- a/drivers/common/sfc_efx/base/efx_intr.c +++ b/drivers/common/sfc_efx/base/efx_intr.c @@ -158,6 +158,12 @@ efx_intr_init( break; #endif /* EFSYS_OPT_RIVERHEAD */ +#if EFSYS_OPT_MEDFORD4 + case EFX_FAMILY_MEDFORD4: + eiop = &__efx_intr_ef10_ops; + break; +#endif /* EFSYS_OPT_MEDFORD4 */ + default: EFSYS_ASSERT(B_FALSE); rc = ENOTSUP; -- 2.39.5
DPDK Release Status Meeting 2025-04-15
Release status meeting minutes 2025-04-15 = Agenda: * Release Dates * Subtrees * Roadmaps * LTS * Defects * Opens Participants: * Broadcom * ARM * Debian * Intel * Marvell * Microsoft * Nvidia * Red Hat Release Dates - The following are the proposed working dates for 27.03: - Proposal deadline (RFC/v1 patches): 20 April 2025 - API freeze (-rc1): 30 May 2025 - Moving to June 4 - PMD features freeze (-rc2): 20 June 2025 - Moving to 25 - Builtin applications features freeze (-rc3): 27 June 2025 - Moving to July 2 - Release: 11 July 2025 See https://core.dpdk.org/roadmap/ Subtrees * next-net * ~70 patches pending and around 16 waiting for review. * next-net-intel * ~10 patches, mainly deferred from last release. * 2-3 new features * next-net-broadcom * Gathering patches for this release. * next-net-mlx * No updates this week. * next-net-mvl * Anticipate 20-30 patches * Review and merge in progress. * next-eventdev * ~20 patches * Review and merge in progress. * next-baseband * No patches at the moment. * next-virtio * 1 fix and some patch series pending. * next-crypto * 20+ patches pending. * New crypto driver for ZTE * New Algorithm: Snow 5G * next-dts * 20+ patches. * main * Testpmd now builds in the CI with MSVC * License check approved. * Merged symbol export series. This will affect all patches that aren't merged yet and which touch the version map files. Please rebase your patches and resubmit. David Marchand can help. * Looking for updates to the roadmap file. * The following milestone dates will move by a few days: - (-rc1): 30 May 2025 - Moving to 4 June - (-rc2): 20 June 2025 - Moving to 25 June - (-rc3): 27 June 2025 - Moving to 2 July Other - - DPDK Summit 2025 will be in Prague in May 8-9: - https://events.linuxfoundation.org/dpdk-summit/ - https://www.dpdk.org/event/dpdk-summit-2025-prague/ LTS --- Testing in progress. Ongoing LTS versions: * 24.11.2 * 23.11.4 * 22.11.8 - Released Test results are coming in. Still waiting for some validation. See https://core.dpdk.org/roadmap/#dates * 20.11.10 - Will only be updated with CVE and critical fixes. * 19.11.14 - 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 Tuesday at 14: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 " for the invite.
[PATCH] net/ixgbe: support Rx/Tx burst mode info
Return burst mode according to the selected Rx/Tx burst function name. Update 25.07 release notes with this information. Signed-off-by: Roger Melton --- doc/guides/rel_notes/release_25_07.rst| 4 ++ drivers/net/intel/ixgbe/ixgbe_ethdev.c| 4 ++ drivers/net/intel/ixgbe/ixgbe_ethdev.h| 4 ++ drivers/net/intel/ixgbe/ixgbe_rxtx.c | 70 +++ drivers/net/intel/ixgbe/ixgbe_rxtx.h | 4 ++ .../net/intel/ixgbe/ixgbe_vf_representor.c| 4 +- 6 files changed, 88 insertions(+), 2 deletions(-) diff --git a/doc/guides/rel_notes/release_25_07.rst b/doc/guides/rel_notes/release_25_07.rst index b83f911121..7e546a792b 100644 --- a/doc/guides/rel_notes/release_25_07.rst +++ b/doc/guides/rel_notes/release_25_07.rst @@ -59,6 +59,10 @@ New Features * Added support for rx_burst_mode_get and tx_burst_mode_get. +* **Updated Intel ixgbe driver.** + + * Added support for rx_burst_mode_get and tx_burst_mode_get. + Removed Items - diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.c b/drivers/net/intel/ixgbe/ixgbe_ethdev.c index 0fa4898aba..f1fd271a0a 100644 --- a/drivers/net/intel/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.c @@ -532,6 +532,8 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .rx_queue_release = ixgbe_dev_rx_queue_release, .tx_queue_setup = ixgbe_dev_tx_queue_setup, .tx_queue_release = ixgbe_dev_tx_queue_release, + .rx_burst_mode_get= ixgbe_rx_burst_mode_get, + .tx_burst_mode_get= ixgbe_tx_burst_mode_get, .dev_led_on = ixgbe_dev_led_on, .dev_led_off = ixgbe_dev_led_off, .flow_ctrl_get= ixgbe_flow_ctrl_get, @@ -605,6 +607,8 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = { .tx_queue_release = ixgbe_dev_tx_queue_release, .rx_queue_intr_enable = ixgbevf_dev_rx_queue_intr_enable, .rx_queue_intr_disable = ixgbevf_dev_rx_queue_intr_disable, + .rx_burst_mode_get= ixgbe_rx_burst_mode_get, + .tx_burst_mode_get= ixgbe_tx_burst_mode_get, .mac_addr_add = ixgbevf_add_mac_addr, .mac_addr_remove = ixgbevf_remove_mac_addr, .set_mc_addr_list = ixgbe_dev_set_mc_addr_list, diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.h b/drivers/net/intel/ixgbe/ixgbe_ethdev.h index 8ad841ea2c..7b1cfe0ea4 100644 --- a/drivers/net/intel/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.h @@ -523,6 +523,10 @@ struct ixgbe_vf_representor { int ixgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params); int ixgbe_vf_representor_uninit(struct rte_eth_dev *ethdev); +uint16_t ixgbe_vf_representor_rx_burst(__rte_unused void *rx_queue, + __rte_unused struct rte_mbuf **rx_pkts, __rte_unused uint16_t nb_pkts); +uint16_t ixgbe_vf_representor_tx_burst(__rte_unused void *tx_queue, + __rte_unused struct rte_mbuf **tx_pkts, __rte_unused uint16_t nb_pkts); #define IXGBE_DEV_FDIR_CONF(dev) \ (&((struct ixgbe_adapter *)(dev)->data->dev_private)->fdir_conf) diff --git a/drivers/net/intel/ixgbe/ixgbe_rxtx.c b/drivers/net/intel/ixgbe/ixgbe_rxtx.c index 3d56ef..209dbe6685 100644 --- a/drivers/net/intel/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/intel/ixgbe/ixgbe_rxtx.c @@ -2626,6 +2626,39 @@ static const struct ixgbe_txq_ops def_txq_ops = { .reset = ixgbe_reset_tx_queue, }; +static const struct { + eth_tx_burst_t pkt_burst; + const char *info; +} ixgbe_tx_burst_info[] = { + { ixgbe_xmit_pkts, "Scalar"}, + { ixgbe_xmit_pkts_simple, "Scalar simple"}, + { ixgbe_vf_representor_tx_burst, "Scalar representor"}, +#ifdef RTE_ARCH_X86 + { ixgbe_xmit_pkts_vec, "Vector SSE"}, +#elif defined(RTE_ARCH_ARM) + { ixgbe_xmit_pkts_vec, "Vector NEON"}, +#endif +}; + +int +ixgbe_tx_burst_mode_get(struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode) +{ + eth_tx_burst_t pkt_burst = dev->tx_pkt_burst; + size_t i; + + for (i = 0; i < RTE_DIM(ixgbe_tx_burst_info); i++) { + if (pkt_burst == ixgbe_tx_burst_info[i].pkt_burst) { + snprintf(mode->info, sizeof(mode->info), "%s", +ixgbe_tx_burst_info[i].info); + return 0; + } + } + + return -EINVAL; +} + /* Takes an ethdev and a queue and sets up the tx function to be used based on * the queue parameters. Used in tx_queue_setup by primary process and then * in dev_init by secondary process when attaching to an existing ethdev. @@ -4939,6 +4972,43 @@ ixgbe_set_ivar(struct rte_eth_dev *dev, u8 entry, u8 vector, s8 type) } } +static const struct { + eth_rx_burst_t pkt_burst; + const char *info; +} ixgbe_rx_burst_info[] = { + { ix
[PATCH] net/iavf: support Rx/Tx burst mode info
Return burst mode according to the selected Rx/Tx burst function name. Update 25.07 release notes with this information. Signed-off-by: Roger Melton --- doc/guides/rel_notes/release_25_07.rst | 3 + drivers/net/intel/iavf/iavf.h | 2 + drivers/net/intel/iavf/iavf_ethdev.c | 2 + drivers/net/intel/iavf/iavf_rxtx.c | 168 ++--- drivers/net/intel/iavf/iavf_rxtx.h | 7 +- 5 files changed, 135 insertions(+), 47 deletions(-) diff --git a/doc/guides/rel_notes/release_25_07.rst b/doc/guides/rel_notes/release_25_07.rst index 093b85d206..b83f911121 100644 --- a/doc/guides/rel_notes/release_25_07.rst +++ b/doc/guides/rel_notes/release_25_07.rst @@ -55,6 +55,9 @@ New Features Also, make sure to start the actual text at the margin. === +* **Updated Intel iavf driver.** + + * Added support for rx_burst_mode_get and tx_burst_mode_get. Removed Items - diff --git a/drivers/net/intel/iavf/iavf.h b/drivers/net/intel/iavf/iavf.h index 956c60ef45..97e6b243fb 100644 --- a/drivers/net/intel/iavf/iavf.h +++ b/drivers/net/intel/iavf/iavf.h @@ -321,6 +321,7 @@ struct iavf_devargs { struct iavf_security_ctx; enum iavf_rx_burst_type { + IAVF_RX_DISABLED, IAVF_RX_DEFAULT, IAVF_RX_FLEX_RXD, IAVF_RX_BULK_ALLOC, @@ -349,6 +350,7 @@ enum iavf_rx_burst_type { }; enum iavf_tx_burst_type { + IAVF_TX_DISABLED, IAVF_TX_DEFAULT, IAVF_TX_SSE, IAVF_TX_AVX2, diff --git a/drivers/net/intel/iavf/iavf_ethdev.c b/drivers/net/intel/iavf/iavf_ethdev.c index 2335746f04..b3dacbef84 100644 --- a/drivers/net/intel/iavf/iavf_ethdev.c +++ b/drivers/net/intel/iavf/iavf_ethdev.c @@ -239,6 +239,8 @@ static const struct eth_dev_ops iavf_eth_dev_ops = { .rss_hash_conf_get = iavf_dev_rss_hash_conf_get, .rxq_info_get = iavf_dev_rxq_info_get, .txq_info_get = iavf_dev_txq_info_get, + .rx_burst_mode_get = iavf_rx_burst_mode_get, + .tx_burst_mode_get = iavf_tx_burst_mode_get, .mtu_set= iavf_dev_mtu_set, .rx_queue_intr_enable = iavf_dev_rx_queue_intr_enable, .rx_queue_intr_disable = iavf_dev_rx_queue_intr_disable, diff --git a/drivers/net/intel/iavf/iavf_rxtx.c b/drivers/net/intel/iavf/iavf_rxtx.c index 533e0c78a2..5411eb6897 100644 --- a/drivers/net/intel/iavf/iavf_rxtx.c +++ b/drivers/net/intel/iavf/iavf_rxtx.c @@ -3688,66 +3688,142 @@ iavf_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, return i; } -static -const eth_rx_burst_t iavf_rx_pkt_burst_ops[] = { - [IAVF_RX_DEFAULT] = iavf_recv_pkts, - [IAVF_RX_FLEX_RXD] = iavf_recv_pkts_flex_rxd, - [IAVF_RX_BULK_ALLOC] = iavf_recv_pkts_bulk_alloc, - [IAVF_RX_SCATTERED] = iavf_recv_scattered_pkts, - [IAVF_RX_SCATTERED_FLEX_RXD] = iavf_recv_scattered_pkts_flex_rxd, +static uint16_t +iavf_recv_pkts_no_poll(void *rx_queue, struct rte_mbuf **rx_pkts, + uint16_t nb_pkts); +static uint16_t +iavf_xmit_pkts_no_poll(void *tx_queue, struct rte_mbuf **tx_pkts, + uint16_t nb_pkts); + +static const struct { + eth_rx_burst_t pkt_burst; + const char *info; +} iavf_rx_pkt_burst_ops[] = { + [IAVF_RX_DISABLED] = {iavf_recv_pkts_no_poll, "Disabled"}, + [IAVF_RX_DEFAULT] = {iavf_recv_pkts, "Scalar"}, + [IAVF_RX_FLEX_RXD] = {iavf_recv_pkts_flex_rxd, "Scalar Flex"}, + [IAVF_RX_BULK_ALLOC] = {iavf_recv_pkts_bulk_alloc, + "Scalar Bulk Alloc"}, + [IAVF_RX_SCATTERED] = {iavf_recv_scattered_pkts, + "Scalar Scattered"}, + [IAVF_RX_SCATTERED_FLEX_RXD] = {iavf_recv_scattered_pkts_flex_rxd, + "Scalar Scattered Flex"}, #ifdef RTE_ARCH_X86 - [IAVF_RX_SSE] = iavf_recv_pkts_vec, - [IAVF_RX_AVX2] = iavf_recv_pkts_vec_avx2, - [IAVF_RX_AVX2_OFFLOAD] = iavf_recv_pkts_vec_avx2_offload, - [IAVF_RX_SSE_FLEX_RXD] = iavf_recv_pkts_vec_flex_rxd, - [IAVF_RX_AVX2_FLEX_RXD] = iavf_recv_pkts_vec_avx2_flex_rxd, - [IAVF_RX_AVX2_FLEX_RXD_OFFLOAD] = + [IAVF_RX_SSE] = {iavf_recv_pkts_vec, "Vector SSE"}, + [IAVF_RX_AVX2] = {iavf_recv_pkts_vec_avx2, "Vector AVX2"}, + [IAVF_RX_AVX2_OFFLOAD] = {iavf_recv_pkts_vec_avx2_offload, + "Vector AVX2 Offload"}, + [IAVF_RX_SSE_FLEX_RXD] = {iavf_recv_pkts_vec_flex_rxd, + "Vector Flex SSE"}, + [IAVF_RX_AVX2_FLEX_RXD] = {iavf_recv_pkts_vec_avx2_flex_rxd, + "Vector AVX2 Flex"}, + [IAVF_RX_AVX2_FLEX_RXD_OFFLOAD] = { iavf_recv_pkts_vec_avx2_flex_rxd_offload, - [IAVF_RX_SSE_SCATTERED] = iavf_recv_scattered_pkts_vec, - [IAVF_RX_AVX2_SCATTERED] = iavf_recv_scattered_pkts_vec_avx2, - [IAVF_RX_AVX2_SCATTERED_OFFLOAD] = + "Vector AVX2 F
Re: [PATCH v6 0/3] net/macb: updated net macb driver.
On Tue, 8 Apr 2025 06:19:07 + liwencheng wrote: > v6: > - Fixed build failures across different OS. > > v5: > - Putting __rte_unused after the declaration. > - Correct RX-bytes and TX-bytes statistics. > - Initialize the mbuf_initializer. > - Add driver based on 25.07. > - Fixed some code style issues. > > v4: > - Fix tab errors in meson.build file. > - Use RTE_LOG_LINE instead of rte_log. > - Replace %l with %PRI*64. > - Replace rte_smp_[r/w]mb with rte_[r/w]mb. > - Do not use variadic arguments in macros. > - Do not use variable-length array pkts[nb_bufs]. > - Use __rte_cache_aligned only for struct or union types alignment. > - Support hardware Rx/Tx checksum offload. > - Fixed some code style issues. > v3: > - Changed functions that always return 0 and whose return value > is unused to void type, improving code simplicity and readability. > - Fixed the implicit conversion issues in the > macb_usxgmii_pcs_check_for_link and > macb_usxgmii_pcs_check_for_link functions. > - Added the missing SPDX license tags. > - Added the missing mailmap entry. > - Updated the MAINTAINERS file to include the missing information. > > v2: > - Split the driver into three logically independent patches, > rather than one large patch. > - Added conditional compilation to address the issue of > macb_rxtx_vec_neon.c failing to compile in certain modes. > - Fixed some code style issues. > > v1: > - updated net macb driver. > > *** BLURB HERE *** > > Wencheng Li (3): > net/macb: add new poll mode driver > net/macb: add NEON vectorized Rx/Tx > net/macb: add necessary docs and update related files > > .mailmap |1 + > MAINTAINERS|6 + > doc/guides/nics/features/macb.ini | 27 + > doc/guides/nics/index.rst |1 + > doc/guides/nics/macb.rst | 26 + > doc/guides/rel_notes/release_25_07.rst |4 + > drivers/net/macb/base/generic_phy.c| 271 + > drivers/net/macb/base/generic_phy.h| 202 > drivers/net/macb/base/macb_common.c| 670 > drivers/net/macb/base/macb_common.h| 253 + > drivers/net/macb/base/macb_errno.h | 58 + > drivers/net/macb/base/macb_hw.h| 1138 +++ > drivers/net/macb/base/macb_type.h | 23 + > drivers/net/macb/base/macb_uio.c | 351 ++ > drivers/net/macb/base/macb_uio.h | 50 + > drivers/net/macb/base/meson.build | 25 + > drivers/net/macb/macb_ethdev.c | 1861 > > drivers/net/macb/macb_ethdev.h | 91 ++ > drivers/net/macb/macb_log.h| 19 + > drivers/net/macb/macb_rxtx.c | 1394 > drivers/net/macb/macb_rxtx.h | 325 ++ > drivers/net/macb/macb_rxtx_vec_neon.c | 675 > drivers/net/macb/meson.build | 22 + > drivers/net/meson.build|1 + > 24 files changed, 7494 insertions(+) > create mode 100644 doc/guides/nics/features/macb.ini > create mode 100644 doc/guides/nics/macb.rst > create mode 100644 drivers/net/macb/base/generic_phy.c > create mode 100644 drivers/net/macb/base/generic_phy.h > create mode 100644 drivers/net/macb/base/macb_common.c > create mode 100644 drivers/net/macb/base/macb_common.h > create mode 100644 drivers/net/macb/base/macb_errno.h > create mode 100644 drivers/net/macb/base/macb_hw.h > create mode 100644 drivers/net/macb/base/macb_type.h > create mode 100644 drivers/net/macb/base/macb_uio.c > create mode 100644 drivers/net/macb/base/macb_uio.h > create mode 100644 drivers/net/macb/base/meson.build > create mode 100644 drivers/net/macb/macb_ethdev.c > create mode 100644 drivers/net/macb/macb_ethdev.h > create mode 100644 drivers/net/macb/macb_log.h > create mode 100644 drivers/net/macb/macb_rxtx.c > create mode 100644 drivers/net/macb/macb_rxtx.h > create mode 100644 drivers/net/macb/macb_rxtx_vec_neon.c > create mode 100644 drivers/net/macb/meson.build > When using Developer's Certificate of Origin, it is important to use you legal name rather just the mail alias. If you send a follow up use: Signed-off-by: Wencheng Li not: Signed-off-by: liwencheng That is what is causing some check-git-log.sh warnings.
Re: [PATCH v4 2/4] net/macb: add new poll mode driver
On Wed, 2 Apr 2025 06:58:56 + liwencheng wrote: > + > +struct __rte_cache_aligned macb_rx_queue_stats { > + union { > + unsigned long first; > + unsigned long rx_packets; > + }; > + unsigned long rx_bytes; > + unsigned long rx_dropped; > +}; > + > +struct __rte_cache_aligned macb_tx_queue_stats { > + unsigned long tx_packets; > + unsigned long tx_bytes; > + unsigned long tx_dropped; > + unsigned long tx_start_packets; > + unsigned long tx_start_bytes; > +}; > + Doesn't really matter, but most drivers use uint64_t for stats.
Re: Flow API Test Suite Inquiry
Hi, 15/04/2025 20:21, Dean Marx: > The flow API allows for an extremely broad set of rules to be created. > My understanding from my first pass at writing the test suite is that > there is a small subset of those rules that are “core functionality” > that the flow API aims to support, and there are also rules which > technically can be created, but may not be supported by the main PMDs > and/or may not be useful rules that people want to see tested. > > For instance, I am pretty confident that a rule like the one below is > one which the community will care about, and which PMDs will support: > > flow create 0 ingress pattern eth / ipv4 src is 192.168.0.1 / end > actions drop / end > > But I do not know what is the full set of rules that I should be > validating from a DTS testsuite. Is it possible for you (or anyone > else on this mailing list) to provide some feedback on what rules are > most important and I should include in my test suite? If I can get > that feedback, I will draft a test plan and share it back on this > thread for community approval before I write up and submit the DTS > patch. Ultimately it would be nice to test all flow items and actions. As this is the first step of this long journey, I agree we should focus on the minimum. We can focus on the simple synchronous API for now, and leave the template asynchronous API for a next step. Let's talk about basic items and actions to test simple forwarding rules. Items are describing protocols. The most common ones are: - RTE_FLOW_ITEM_TYPE_ETH - RTE_FLOW_ITEM_TYPE_IPV4 / RTE_FLOW_ITEM_TYPE_IPV6 - RTE_FLOW_ITEM_TYPE_UDP - RTE_FLOW_ITEM_TYPE_TCP - RTE_FLOW_ITEM_TYPE_VLAN Some header field values may be specified as well in the rule. You probably want to test matching each field of these items, except checksums, lengths, offsets. The traffic direction can be specified with: - rte_flow_attr.ingress - rte_flow_attr.egress The most basic actions are to specify where to forward a flow: - RTE_FLOW_ACTION_TYPE_QUEUE - RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT - RTE_FLOW_ACTION_TYPE_RSS - RTE_FLOW_ACTION_TYPE_DROP Next we want to create flow rules in groups: - rte_flow_attr.group - rte_flow_attr.priority and connect groups with - RTE_FLOW_ACTION_TYPE_JUMP The most versatile action is to modify packets (like TTL or src/dest) with - RTE_FLOW_ACTION_TYPE_MODIFY_FIELD I believe you should play with that first. Any other opinions?
Re: [PATCH v4 4/4] net/macb: add necessary docs and update related files
On Wed, 2 Apr 2025 06:59:31 + liwencheng wrote: > +Features of the MACB PMD are: > + > +* Speed capabilities > +* Link status > +* Tx Queue start/stop > +* Multiple queues for TX and RX > +* CRC offload > +* Jumbo frames supported I see no operations functions for Tx queue/start stop in macb_ops. Obviously not tested. int rte_eth_dev_tx_queue_start(uint16_t port_id, uint16_t tx_queue_id) { struct rte_eth_dev *dev; int ret; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; if (!dev->data->dev_started) { RTE_ETHDEV_LOG_LINE(ERR, "Port %u must be started before start any queue", port_id); return -EINVAL; } ret = eth_dev_validate_tx_queue(dev, tx_queue_id); if (ret != 0) return ret; if (dev->dev_ops->tx_queue_start == NULL) return -ENOTSUP;
[PATCH 37/46] common/sfc_efx/base: correct MAC PDU calculation on Medford4
For managing MAC PDU (max. frame size), client drivers apply EFX macros to switch between PDU and SDU forms. These macros include a workaround for a bug that dates back to Siena NICs. Starting with Medford4, the bug is no longer there and it is wrong to use the macros, so provide users with a replacement. The new APIs will either include the said workaround or omit it, depending on whether support for netport MCDI is present. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/efx.h | 25 +++ drivers/common/sfc_efx/base/efx_mac.c | 19 +++-- drivers/common/sfc_efx/base/efx_nic.c | 3 +++ drivers/common/sfc_efx/sfc_base_symbols.c | 1 + 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index 6ca108cffe..73dc38f84e 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -668,24 +668,45 @@ typedef enum efx_link_mode_e { #defineEFX_MAC_SDU_MAX 9202 +/* + * NOTE: the PDU macros implement an obsolete workaround that is needed for + * MC_CMD_SET_MAC; do not use the PDU macros for the netport MCDI commands, + * which do not use the workaround. + */ + #defineEFX_MAC_PDU_ADJUSTMENT \ (/* EtherII */ 14 \ + /* VLAN */ 4 \ + /* CRC */ 4 \ + /* bug16011 */ 16)\ +/* NOTE: this macro is deprecated; use efx_mac_pdu_from_sdu(). */ #defineEFX_MAC_PDU(_sdu) \ EFX_P2ROUNDUP(size_t, (_sdu) + EFX_MAC_PDU_ADJUSTMENT, 8) /* * Due to the EFX_P2ROUNDUP in EFX_MAC_PDU(), EFX_MAC_SDU_FROM_PDU() may give * the SDU rounded up slightly. + * + * NOTE: do not use this macro in new code as it is + * incorrect for the netport MCDI commands. */ #defineEFX_MAC_SDU_FROM_PDU(_pdu) ((_pdu) - EFX_MAC_PDU_ADJUSTMENT) #defineEFX_MAC_PDU_MIN 60 + +/* NOTE: this macro is deprecated; use encp->enc_mac_pdu_max. */ #defineEFX_MAC_PDU_MAX EFX_MAC_PDU(EFX_MAC_SDU_MAX) +/* + * For use with efx_mac_pdu_set(), convert the given SDU value to its PDU form. + */ +LIBEFX_API +extern size_t +efx_mac_pdu_from_sdu( + __inefx_nic_t *enp, + __insize_t sdu); + LIBEFX_API extern __checkReturn efx_rc_t efx_mac_pdu_get( @@ -1729,6 +1750,10 @@ typedef struct efx_nic_cfg_s { efx_nic_dma_mapping_t enc_dma_mapping; /* Physical ports shared by PFs */ efx_port_usage_tenc_port_usage; + /* Minimum MAC PDU value to use with efx_mac_pdu_set() */ + uint32_tenc_mac_pdu_min; + /* Maximum MAC PDU value to use with efx_mac_pdu_set() */ + uint32_tenc_mac_pdu_max; } efx_nic_cfg_t; #defineEFX_PCI_VF_INVALID 0x diff --git a/drivers/common/sfc_efx/base/efx_mac.c b/drivers/common/sfc_efx/base/efx_mac.c index 8712d7c5ef..606164bcf9 100644 --- a/drivers/common/sfc_efx/base/efx_mac.c +++ b/drivers/common/sfc_efx/base/efx_mac.c @@ -114,6 +114,20 @@ static const efx_mac_ops_t __efx_mac_medford4_ops = { }; #endif /* EFSYS_OPT_MEDFORD4 */ + size_t +efx_mac_pdu_from_sdu( + __inefx_nic_t *enp, + __insize_t sdu) +{ + if (efx_np_supported(enp) != B_FALSE) { + /* PDU size for netport MCDI capable adaptors. */ + return sdu + 14 /* ETH */ + 4 /* VLAN */ + 4 /* FCS */; + } else { + /* PDU size for legacy MC_CMD_SET_MAC command. */ + return EFX_MAC_PDU(sdu); + } +} + __checkReturn efx_rc_t efx_mac_pdu_set( __inefx_nic_t *enp, @@ -121,6 +135,7 @@ efx_mac_pdu_set( { efx_port_t *epp = &(enp->en_port); const efx_mac_ops_t *emop = epp->ep_emop; + efx_nic_cfg_t *encp = &(enp->en_nic_cfg); uint32_t old_pdu; efx_rc_t rc; @@ -128,12 +143,12 @@ efx_mac_pdu_set( EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT); EFSYS_ASSERT(emop != NULL); - if (pdu < EFX_MAC_PDU_MIN) { + if (pdu < encp->enc_mac_pdu_min) { rc = EINVAL; goto fail1; } - if (pdu > EFX_MAC_PDU_MAX) { + if (pdu > encp->enc_mac_pdu_max) { rc = EINVAL; goto fail2; } diff --git a/drivers/common/sfc_efx/base/efx_nic.c b/drivers/common/sfc_efx/base/efx_nic.c index 1ec684da40..1c25270792 100644 --- a/drivers/common/sfc_efx/base/efx_nic.c +++ b/drivers/common/sfc_efx/base/efx_nic.c @@ -491,6 +491,9 @@ efx_nic_probe( encp->enc_features = enp->en_features;
[PATCH 39/46] common/sfc_efx/base: ignore legacy link events on new boards
New adaptors (for instance, Medford4) come with netport MCDI and also support new link change events, however, older ones can also be generated. For consistency, ignore legacy events. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/ef10_ev.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/common/sfc_efx/base/ef10_ev.c b/drivers/common/sfc_efx/base/ef10_ev.c index 011ef49de7..82a2284f2b 100644 --- a/drivers/common/sfc_efx/base/ef10_ev.c +++ b/drivers/common/sfc_efx/base/ef10_ev.c @@ -907,6 +907,16 @@ ef10_ev_mcdi( #endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */ case MCDI_EVENT_CODE_LINKCHANGE_V2: + if (efx_np_supported(enp) != B_FALSE) { + /* +* Netport MCDI capable NICs support new link change +* events, but legacy LINKCHANGE_V2 events may still +* show up should the firmware support them. For the +* sake of consistency, ignore LINKCHANGE_V2 events. +*/ + break; + } + ev_is_v2 = B_TRUE; /* Fallthrough */ case MCDI_EVENT_CODE_LINKCHANGE: { -- 2.39.5
[PATCH 44/46] common/sfc_efx/base: support controls for netport lane count
On netport MCDI capable adaptors, link modes exported by libefx can be backed by different technologies with different lane counts. Allow the client drivers to get and set the lane count and query possible values. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/ef10_phy.c | 2 + drivers/common/sfc_efx/base/efx.h | 29 drivers/common/sfc_efx/base/efx_impl.h | 4 + drivers/common/sfc_efx/base/efx_np.c | 192 +++-- drivers/common/sfc_efx/base/efx_phy.c | 62 ++- drivers/common/sfc_efx/base/efx_port.c | 1 + drivers/common/sfc_efx/base/medford4_phy.c | 5 +- drivers/common/sfc_efx/sfc_base_symbols.c | 1 + 8 files changed, 280 insertions(+), 16 deletions(-) diff --git a/drivers/common/sfc_efx/base/ef10_phy.c b/drivers/common/sfc_efx/base/ef10_phy.c index 114543e156..aaad105735 100644 --- a/drivers/common/sfc_efx/base/ef10_phy.c +++ b/drivers/common/sfc_efx/base/ef10_phy.c @@ -338,6 +338,8 @@ ef10_phy_get_link( fec, &elsp->epls.epls_link_mode, &elsp->epls.epls_fcntl, &elsp->epls.epls_fec); + elsp->epls.epls_lane_count = EFX_PHY_LANE_COUNT_DEFAULT; + if (req.emr_out_length_used < MC_CMD_GET_LINK_OUT_V2_LEN) { elsp->epls.epls_ld_cap_mask = 0; } else { diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index 7b43a89551..8958f1b170 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -1266,6 +1266,28 @@ efx_phy_lp_cap_get( __inefx_nic_t *enp, __out uint32_t *maskp); +typedef enum efx_phy_lane_count_e { + EFX_PHY_LANE_COUNT_DEFAULT = 0, + EFX_PHY_LANE_COUNT_1 = 1, + EFX_PHY_LANE_COUNT_2 = 2, + EFX_PHY_LANE_COUNT_4 = 4, + EFX_PHY_LANE_COUNT_10 = 10, + EFX_PHY_LANE_COUNT_NTYPES, +} efx_phy_lane_count_t; + +/* + * Instruct the port to use the specified lane count. For this to work, the + * active subset of advertised link modes must include at least one mode that + * supports this value. This API works only on netport MCDI capable adaptors. + * + * To query the current lane count, use efx_phy_link_state_get(). + */ +LIBEFX_API +extern __checkReturn efx_rc_t +efx_phy_lane_count_set( + __inefx_nic_t *enp, + __inefx_phy_lane_count_t lane_count); + LIBEFX_API extern __checkReturn efx_rc_t efx_phy_oui_get( @@ -1760,6 +1782,12 @@ typedef struct efx_nic_cfg_s { * to have exact speed/duplex, efx_port_poll() needs to be invoked. */ boolean_t enc_link_ev_need_poll; + /* +* An array of masks to tell which link mode supports which lane counts. +* For bit definitions, see 'efx_phy_lane_count_t'. It is only filled in +* on netport MCDI capable adaptors. +*/ + efx_dword_t enc_phy_lane_counts[EFX_LINK_NMODES]; } efx_nic_cfg_t; #defineEFX_PCI_VF_INVALID 0x @@ -4072,6 +4100,7 @@ typedef struct efx_phy_link_state_s { unsigned intepls_fcntl; efx_phy_fec_type_t epls_fec; efx_link_mode_t epls_link_mode; + efx_phy_lane_count_tepls_lane_count; } efx_phy_link_state_t; LIBEFX_API diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index 43964ccdba..69268546d2 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -396,6 +396,8 @@ typedef struct efx_port_s { uint8_t ep_np_cap_data_raw[MC_CMD_ETH_AN_FIELDS_LEN]; /* Lookup table providing DMA buffer field IDs by EFX statistic IDs. */ efx_np_stat_t ep_np_mac_stat_lut[EFX_MAC_NSTATS]; + /* Client-requested lane count for the physical link. */ + efx_phy_lane_count_tep_np_lane_count_req; } efx_port_t; typedef struct efx_mon_ops_s { @@ -1916,6 +1918,7 @@ efx_np_detach( typedef struct efx_np_link_state_s { uint32_tenls_adv_cap_mask; uint32_tenls_lp_cap_mask; + efx_phy_lane_count_tenls_lane_count; efx_loopback_type_t enls_loopback; uint32_tenls_speed; uint8_t enls_fec; @@ -1953,6 +1956,7 @@ efx_np_link_ctrl( __inconst uint8_t *cap_mask_sup_raw, __inefx_link_mode_t loopback_link_mode, __inefx_loopback_type_t loopback_mode, + __inefx_phy_lane_count_t lane_count, __inuint32_t cap_mask_sw, __inboolean_t fcntl_an); diff --git a/drivers/common/sfc_efx/base/efx_np.c b/drivers/common/sfc_efx/base/efx_np.c index 73b022ac21..35ae07a9a0 100644 --- a/drivers/common/sfc_efx/base/efx_np.c +++ b/drivers/common/sfc_efx/base/efx_np.
[PATCH 41/46] net/sfc: query link status on link change events on new NICs
Link events signaled on new adaptors (Medford4 and later) do not carry any specifics, so query the link status separately. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/net/sfc/sfc.h| 2 ++ drivers/net/sfc/sfc_ethdev.c | 2 ++ drivers/net/sfc/sfc_ev.c | 51 +++- 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index 2432a2307e..819ce52529 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -309,6 +309,8 @@ struct sfc_adapter { uint32_trxd_wait_timeout_ns; boolswitchdev; + + boollink_ev_need_poll; }; static inline struct sfc_adapter_shared * diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index bd0061f557..05933b1d39 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -3252,6 +3252,8 @@ sfc_eth_dev_init(struct rte_eth_dev *dev, void *init_params) if (rc != 0) goto fail_nic_dma_attach; + sa->link_ev_need_poll = encp->enc_link_ev_need_poll; + sfc_adapter_unlock(sa); sfc_log_init(sa, "done"); diff --git a/drivers/net/sfc/sfc_ev.c b/drivers/net/sfc/sfc_ev.c index c0d58c9554..1d1ee0671f 100644 --- a/drivers/net/sfc/sfc_ev.c +++ b/drivers/net/sfc/sfc_ev.c @@ -467,9 +467,58 @@ sfc_ev_link_change(void *arg, efx_link_mode_t link_mode) { struct sfc_evq *evq = arg; struct sfc_adapter *sa = evq->sa; - struct rte_eth_link new_link; + struct rte_eth_link new_link = {0}; + if (sa->link_ev_need_poll) { + efx_link_mode_t new_mode; + bool poll_done = false; + + /* +* The event provides only the general status. When the link is +* up, poll the port to get the speed, but it is not compulsory. +*/ + if (link_mode != EFX_LINK_DOWN) { + int ret = 0; + + if (sfc_adapter_trylock(sa)) { + /* Never poll when the adaptor is going down. */ + if (sa->state == SFC_ETHDEV_STARTED) { + ret = efx_port_poll(sa->nic, &new_mode); + poll_done = true; + } + + sfc_adapter_unlock(sa); + } + + if (ret != 0) { + sfc_warn(sa, "port poll failed on link event"); + poll_done = false; + } + } + + if (poll_done) { + link_mode = new_mode; + goto decode_comprehensive; + } + + new_link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX; + new_link.link_autoneg = RTE_ETH_LINK_AUTONEG; + + if (link_mode == EFX_LINK_DOWN) { + new_link.link_speed = RTE_ETH_SPEED_NUM_NONE; + new_link.link_status = RTE_ETH_LINK_DOWN; + } else { + new_link.link_speed = RTE_ETH_SPEED_NUM_UNKNOWN; + new_link.link_status = RTE_ETH_LINK_UP; + } + + goto set; + } + +decode_comprehensive: sfc_port_link_mode_to_info(link_mode, &new_link); + +set: if (rte_eth_linkstatus_set(sa->eth_dev, &new_link) == 0) evq->sa->port.lsc_seq++; -- 2.39.5
[PATCH 43/46] net/sfc: offer support for 200G link ability on new adaptors
New adaptors (for instance, Medford4) can support 200G speed. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/net/sfc/sfc.c| 5 - drivers/net/sfc/sfc_ethdev.c | 15 +++ drivers/net/sfc/sfc_port.c | 6 ++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c index 938c967430..69747e49ae 100644 --- a/drivers/net/sfc/sfc.c +++ b/drivers/net/sfc/sfc.c @@ -126,7 +126,8 @@ sfc_phy_cap_from_link_speeds(uint32_t speeds) (1 << EFX_PHY_CAP_25000FDX) | (1 << EFX_PHY_CAP_4FDX) | (1 << EFX_PHY_CAP_5FDX) | - (1 << EFX_PHY_CAP_10FDX); + (1 << EFX_PHY_CAP_10FDX) | + (1 << EFX_PHY_CAP_20FDX); } if (speeds & RTE_ETH_LINK_SPEED_1G) phy_caps |= (1 << EFX_PHY_CAP_1000FDX); @@ -140,6 +141,8 @@ sfc_phy_cap_from_link_speeds(uint32_t speeds) phy_caps |= (1 << EFX_PHY_CAP_5FDX); if (speeds & RTE_ETH_LINK_SPEED_100G) phy_caps |= (1 << EFX_PHY_CAP_10FDX); + if (speeds & RTE_ETH_LINK_SPEED_200G) + phy_caps |= (1 << EFX_PHY_CAP_20FDX); return phy_caps; } diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 05933b1d39..80eb39e58d 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -117,6 +117,8 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->speed_capa |= RTE_ETH_LINK_SPEED_50G; if (sa->port.phy_adv_cap_mask & (1u << EFX_PHY_CAP_10FDX)) dev_info->speed_capa |= RTE_ETH_LINK_SPEED_100G; + if (sa->port.phy_adv_cap_mask & (1u << EFX_PHY_CAP_20FDX)) + dev_info->speed_capa |= RTE_ETH_LINK_SPEED_200G; dev_info->max_rx_queues = sa->rxq_max; dev_info->max_tx_queues = sa->txq_max; @@ -2442,6 +2444,19 @@ sfc_fec_get_capa_speed_to_fec(uint32_t supported_caps, } num++; } + if (supported_caps & (1u << EFX_PHY_CAP_20FDX)) { + if (speed_fec_capa != NULL) { + speed_fec_capa[num].speed = RTE_ETH_SPEED_NUM_200G; + speed_fec_capa[num].capa = + RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC) | + RTE_ETH_FEC_MODE_CAPA_MASK(AUTO); + if (rs) { + speed_fec_capa[num].capa |= + RTE_ETH_FEC_MODE_CAPA_MASK(RS); + } + } + num++; + } return num; } diff --git a/drivers/net/sfc/sfc_port.c b/drivers/net/sfc/sfc_port.c index 5e80003ca1..0a31a394d5 100644 --- a/drivers/net/sfc/sfc_port.c +++ b/drivers/net/sfc/sfc_port.c @@ -144,6 +144,8 @@ sfc_port_init_dev_link(struct sfc_adapter *sa) static efx_link_mode_t sfc_port_phy_caps_to_max_link_speed(uint32_t phy_caps) { + if (phy_caps & (1u << EFX_PHY_CAP_20FDX)) + return EFX_LINK_20FDX; if (phy_caps & (1u << EFX_PHY_CAP_10FDX)) return EFX_LINK_10FDX; if (phy_caps & (1u << EFX_PHY_CAP_5FDX)) @@ -649,6 +651,10 @@ sfc_port_link_mode_to_info(efx_link_mode_t link_mode, link_info->link_speed = RTE_ETH_SPEED_NUM_100G; link_info->link_duplex = RTE_ETH_LINK_FULL_DUPLEX; break; + case EFX_LINK_20FDX: + link_info->link_speed = RTE_ETH_SPEED_NUM_200G; + link_info->link_duplex = RTE_ETH_LINK_FULL_DUPLEX; + break; default: SFC_ASSERT(B_FALSE); /* FALLTHROUGH */ -- 2.39.5
[PATCH 38/46] net/sfc: make use of generic EFX MAC PDU calculation helpers
To make sure that MAC PDU values do not come with legacy bug workaround baked in when running on newer Medford4 NICs, use generic replacement APIs from EFX in place of MAC PDU macros. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/net/sfc/sfc_dp_tx.h | 3 +++ drivers/net/sfc/sfc_ef10_tx.c | 13 - drivers/net/sfc/sfc_ethdev.c | 17 ++--- drivers/net/sfc/sfc_port.c| 2 +- drivers/net/sfc/sfc_repr.c| 7 ++- drivers/net/sfc/sfc_repr.h| 1 + drivers/net/sfc/sfc_tx.c | 2 ++ 7 files changed, 31 insertions(+), 14 deletions(-) diff --git a/drivers/net/sfc/sfc_dp_tx.h b/drivers/net/sfc/sfc_dp_tx.h index aad3b06595..0baf8c7dd6 100644 --- a/drivers/net/sfc/sfc_dp_tx.h +++ b/drivers/net/sfc/sfc_dp_tx.h @@ -84,6 +84,9 @@ struct sfc_dp_tx_qcreate_info { /** NIC's DMA mapping information */ const struct sfc_nic_dma_info *nic_dma_info; + + /** Maximum MAC PDU (frame size) */ + unsigned intmax_pdu; }; /** diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c index 116229382b..5543dc495f 100644 --- a/drivers/net/sfc/sfc_ef10_tx.c +++ b/drivers/net/sfc/sfc_ef10_tx.c @@ -65,6 +65,7 @@ struct sfc_ef10_txq { unsigned intmax_fill_level; unsigned intfree_thresh; unsigned intevq_read_ptr; + unsigned intmax_pdu; struct sfc_ef10_tx_sw_desc *sw_ring; efx_qword_t *txq_hw_ring; volatile void *doorbell; @@ -252,7 +253,7 @@ sfc_ef10_tx_qpush(struct sfc_ef10_txq *txq, unsigned int added, } static unsigned int -sfc_ef10_tx_pkt_descs_max(const struct rte_mbuf *m) +sfc_ef10_tx_pkt_descs_max(const struct rte_mbuf *m, unsigned int max_pdu) { unsigned int extra_descs_per_seg; unsigned int extra_descs_per_pkt; @@ -290,8 +291,7 @@ sfc_ef10_tx_pkt_descs_max(const struct rte_mbuf *m) * maximum PDU size. */ extra_descs_per_pkt = - (RTE_MIN((unsigned int)EFX_MAC_PDU_MAX, -SFC_MBUF_PKT_LEN_MAX) - 1) / + (RTE_MIN(max_pdu, SFC_MBUF_PKT_LEN_MAX) - 1) / SFC_EF10_TX_DMA_DESC_LEN_MAX; return m->nb_segs + RTE_MIN(m->nb_segs * extra_descs_per_seg, @@ -672,7 +672,8 @@ sfc_ef10_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) goto dma_desc_space_update; } - if (sfc_ef10_tx_pkt_descs_max(m_seg) > dma_desc_space) { + if (sfc_ef10_tx_pkt_descs_max(m_seg, txq->max_pdu) > + dma_desc_space) { if (reap_done) break; @@ -686,7 +687,8 @@ sfc_ef10_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) reap_done = true; dma_desc_space = txq->max_fill_level - (added - txq->completed); - if (sfc_ef10_tx_pkt_descs_max(m_seg) > dma_desc_space) + if (sfc_ef10_tx_pkt_descs_max(m_seg, txq->max_pdu) > + dma_desc_space) break; } @@ -986,6 +988,7 @@ sfc_ef10_tx_qcreate(uint16_t port_id, uint16_t queue_id, (info->hw_index << info->vi_window_shift); txq->evq_hw_ring = info->evq_hw_ring; txq->tso_tcp_header_offset_limit = info->tso_tcp_header_offset_limit; + txq->max_pdu = info->max_pdu; sfc_ef10_tx_info(&txq->dp.dpq, "TxQ doorbell is %p", txq->doorbell); diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 05194918f9..bd0061f557 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -90,6 +90,7 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) const struct sfc_adapter_priv *sap = sfc_adapter_priv_by_eth_dev(dev); struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev); struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); + const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); struct sfc_rss *rss = &sas->rss; struct sfc_mae *mae = &sa->mae; @@ -98,7 +99,7 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->min_mtu = RTE_ETHER_MIN_MTU; dev_info->max_mtu = EFX_MAC_SDU_MAX; - dev_info->max_rx_pktlen = EFX_MAC_PDU_MAX; + dev_info->max_rx_pktlen = encp->enc_mac_pdu_max; dev_info->max_vfs = sa->sriov.num_vfs; @@ -1112,23 +1113,24 @@ static int sfc_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) { struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); - size_t pdu = EFX_MAC_PDU(mtu); + const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->ni
[PATCH 40/46] common/sfc_efx/base: add link event processing on new boards
Link change events on netport MCDI capable NICs do not carry any specifics of the new link state. Such need to be queried separately. Add processing of the events, with an indication to the client driver telling it to collect the status itself. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/ef10_ev.c | 29 +++ drivers/common/sfc_efx/base/efx.h | 6 ++ drivers/common/sfc_efx/base/efx_nic.c | 5 + 3 files changed, 40 insertions(+) diff --git a/drivers/common/sfc_efx/base/ef10_ev.c b/drivers/common/sfc_efx/base/ef10_ev.c index 82a2284f2b..a97c1bf43e 100644 --- a/drivers/common/sfc_efx/base/ef10_ev.c +++ b/drivers/common/sfc_efx/base/ef10_ev.c @@ -866,6 +866,7 @@ ef10_ev_mcdi( __in_optvoid *arg) { efx_nic_t *enp = eep->ee_enp; + efx_port_t *epp = &(enp->en_port); unsigned int code; boolean_t should_abort = B_FALSE; boolean_t ev_is_v2 = B_FALSE; @@ -906,6 +907,34 @@ ef10_ev_mcdi( break; #endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */ + case MCDI_EVENT_CODE_PORT_LINKCHANGE: + /* +* These events are generated on netport MCDI capable +* boards. They supersede legacy LINKCHANGE_V2 events. +*/ + if (MCDI_EV_FIELD(eqp, PORT_LINKCHANGE_PORT_HANDLE) == + epp->ep_np_handle) { + efx_link_mode_t mode; + + if (MCDI_EV_FIELD(eqp, PORT_LINKCHANGE_LINK_UP) == 1) + mode = EFX_LINK_UNKNOWN; + else + mode = EFX_LINK_DOWN; + + /* +* The event does not contain full link state details. +* +* Either notify the client driver with a dummy link +* mode value (UNKNOWN), just to say the link is up, +* or, in case the link is not up, pass DOWN value. +* +* The client driver will need to poll for link state +* in order to get full details like speed and duplex. +*/ + should_abort = eecp->eec_link_change(arg, mode); + } + break; + case MCDI_EVENT_CODE_LINKCHANGE_V2: if (efx_np_supported(enp) != B_FALSE) { /* diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index 73dc38f84e..7b43a89551 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -1754,6 +1754,12 @@ typedef struct efx_nic_cfg_s { uint32_tenc_mac_pdu_min; /* Maximum MAC PDU value to use with efx_mac_pdu_set() */ uint32_tenc_mac_pdu_max; + /* +* When true, the link mode value passed from eec_link_change() is +* either UNKNOWN (merely saying the link is up) or DOWN. In order +* to have exact speed/duplex, efx_port_poll() needs to be invoked. +*/ + boolean_t enc_link_ev_need_poll; } efx_nic_cfg_t; #defineEFX_PCI_VF_INVALID 0x diff --git a/drivers/common/sfc_efx/base/efx_nic.c b/drivers/common/sfc_efx/base/efx_nic.c index 1c25270792..ab2bb1c160 100644 --- a/drivers/common/sfc_efx/base/efx_nic.c +++ b/drivers/common/sfc_efx/base/efx_nic.c @@ -494,6 +494,11 @@ efx_nic_probe( encp->enc_mac_pdu_max = efx_mac_pdu_from_sdu(enp, EFX_MAC_SDU_MAX); encp->enc_mac_pdu_min = EFX_MAC_PDU_MIN; + if (efx_np_supported(enp) == B_FALSE) + encp->enc_link_ev_need_poll = B_FALSE; + else + encp->enc_link_ev_need_poll = B_TRUE; + if ((rc = efx_phy_probe(enp)) != 0) goto fail2; -- 2.39.5
[PATCH 42/46] common/sfc_efx/base: subscribe to netport link change events
Subscribe to the new link events on netport MCDI attach path. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/efx_np.c | 56 1 file changed, 56 insertions(+) diff --git a/drivers/common/sfc_efx/base/efx_np.c b/drivers/common/sfc_efx/base/efx_np.c index 88e13f0df9..73b022ac21 100644 --- a/drivers/common/sfc_efx/base/efx_np.c +++ b/drivers/common/sfc_efx/base/efx_np.c @@ -809,6 +809,48 @@ efx_np_stats_assign( } #endif /* EFSYS_OPT_MAC_STATS */ +static __checkReturn efx_rc_t +efx_np_set_event_mask( + __inefx_nic_t *enp, + __inefx_np_handle_t nph, + __inboolean_t want_linkchange_events) +{ + EFX_MCDI_DECLARE_BUF(payload, + MC_CMD_SET_NETPORT_EVENTS_MASK_IN_LEN, + MC_CMD_SET_NETPORT_EVENTS_MASK_OUT_LEN); + efx_mcdi_req_t req; + efx_dword_t dword; + efx_rc_t rc; + + req.emr_out_length = MC_CMD_SET_NETPORT_EVENTS_MASK_OUT_LEN; + req.emr_in_length = MC_CMD_SET_NETPORT_EVENTS_MASK_IN_LEN; + req.emr_cmd = MC_CMD_SET_NETPORT_EVENTS_MASK; + req.emr_out_buf = payload; + req.emr_in_buf = payload; + + EFX_ZERO_DWORD(dword); + + if (want_linkchange_events != B_FALSE) + EFX_SET_DWORD_BIT(dword, EVENT_MASK_PORT_LINKCHANGE); + + MCDI_IN_SET_DWORD(req, SET_NETPORT_EVENTS_MASK_IN_PORT_HANDLE, nph); + MCDI_IN_SET_DWORD(req, SET_NETPORT_EVENTS_MASK_IN_EVENT_MASK, + dword.ed_u32[0]); + + efx_mcdi_execute(enp, &req); + + if (req.emr_rc != 0) { + rc = req.emr_rc; + goto fail1; + } + + return (0); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + return (rc); +} + __checkReturn efx_rc_t efx_np_attach( __inefx_nic_t *enp) @@ -873,8 +915,17 @@ efx_np_attach( goto fail5; epp->ep_mac_pdu = ms.enms_pdu; + + /* Subscribe to link change events. */ + rc = efx_np_set_event_mask(enp, epp->ep_np_handle, B_TRUE); + if (rc != 0) + goto fail6; + return (0); +fail6: + EFSYS_PROBE(fail6); + fail5: EFSYS_PROBE(fail5); @@ -898,8 +949,13 @@ efx_np_attach( efx_np_detach( __inefx_nic_t *enp) { + efx_port_t *epp = &(enp->en_port); + if (efx_np_supported(enp) == B_FALSE) return; + + /* Unsubscribe from link change events. */ + (void) efx_np_set_event_mask(enp, epp->ep_np_handle, B_FALSE); } __checkReturn efx_rc_t -- 2.39.5
[PATCH 30/46] common/sfc_efx/base: implement PHY link control for Medford4
Use new MCDI to select loopback, speed, flow control and FEC. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/ef10_impl.h | 6 + drivers/common/sfc_efx/base/ef10_phy.c | 2 +- drivers/common/sfc_efx/base/efx_impl.h | 11 + drivers/common/sfc_efx/base/efx_np.c| 277 drivers/common/sfc_efx/base/efx_phy.c | 2 +- drivers/common/sfc_efx/base/medford4_impl.h | 5 + drivers/common/sfc_efx/base/medford4_phy.c | 65 + 7 files changed, 366 insertions(+), 2 deletions(-) diff --git a/drivers/common/sfc_efx/base/ef10_impl.h b/drivers/common/sfc_efx/base/ef10_impl.h index b872ec626c..df4fd77833 100644 --- a/drivers/common/sfc_efx/base/ef10_impl.h +++ b/drivers/common/sfc_efx/base/ef10_impl.h @@ -814,6 +814,12 @@ mcdi_phy_decode_link_mode( __out unsigned int *fcntlp, __out efx_phy_fec_type_t *fecp); +LIBEFX_INTERNAL +extern __checkReturn efx_rc_t +efx_mcdi_phy_set_led( + __inefx_nic_t *enp, + __inefx_phy_led_mode_t phy_led_mode); + #if EFSYS_OPT_BIST LIBEFX_INTERNAL diff --git a/drivers/common/sfc_efx/base/ef10_phy.c b/drivers/common/sfc_efx/base/ef10_phy.c index 8c3de273b4..114543e156 100644 --- a/drivers/common/sfc_efx/base/ef10_phy.c +++ b/drivers/common/sfc_efx/base/ef10_phy.c @@ -473,7 +473,7 @@ efx_mcdi_phy_set_link( return (rc); } -static __checkReturn efx_rc_t + __checkReturn efx_rc_t efx_mcdi_phy_set_led( __inefx_nic_t *enp, __inefx_phy_led_mode_t phy_led_mode) diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index 63ff112194..15cf62506e 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -1936,6 +1936,17 @@ efx_np_mac_state( __inefx_np_handle_t nph, __out efx_np_mac_state_t *msp); +LIBEFX_INTERNAL +extern __checkReturn efx_rc_t +efx_np_link_ctrl( + __inefx_nic_t *enp, + __inefx_np_handle_t nph, + __inconst uint8_t *cap_mask_sup_raw, + __inefx_link_mode_t loopback_link_mode, + __inefx_loopback_type_t loopback_mode, + __inuint32_t cap_mask_sw, + __inboolean_t fcntl_an); + #ifdef __cplusplus } #endif diff --git a/drivers/common/sfc_efx/base/efx_np.c b/drivers/common/sfc_efx/base/efx_np.c index 1b67fd16aa..03d49b9c78 100644 --- a/drivers/common/sfc_efx/base/efx_np.c +++ b/drivers/common/sfc_efx/base/efx_np.c @@ -650,3 +650,280 @@ efx_np_mac_state( return (rc); } + +static void +efx_np_cap_mask_sw_to_hw( + __in_ecount(hw_sw_map_nentries) const struct efx_np_cap_map *hw_sw_map, + __inunsigned int hw_sw_map_nentries, + __in_bcount(hw_cap_data_nbytes) const uint8_t *hw_cap_data, + __insize_t hw_cap_data_nbytes, + __inuint32_t mask_sw, + __out uint8_t *mask_hwp) +{ + FOREACH_SUP_CAP(hw_sw_map, hw_sw_map_nentries, + hw_cap_data, hw_cap_data_nbytes) { + uint32_t flag_sw = 1U << hw_sw_map->encm_sw; + + if ((mask_sw & flag_sw) != flag_sw) + continue; + + mask_hwp[CAP_BYTE(hw_sw_map)] |= CAP_FLAG(hw_sw_map); + mask_sw &= ~(flag_sw); + } +} + +/* + * Convert the given EFX PHY capability mask to the HW representation. + * + * The mapping of a capability from EFX to HW can be one to many. Use + * the given fraction of raw HW netport capability data to choose the + * first supported HW capability bit encountered for a particular EFX + * one and proceed with handling the next EFX bit, if any, afterwards. + * + * Do not check the input mask for leftover bits (unknown to EFX), as + * inputs should have been validated by efx_phy_adv_cap_set() already. + */ +#defineEFX_NP_CAP_MASK_SW_TO_HW( \ + _hw_sw_cap_map, _hw_cap_section, _hw_cap_data, \ + _mask_sw, _mask_hwp)\ + efx_np_cap_mask_sw_to_hw((_hw_sw_cap_map), \ + EFX_ARRAY_SIZE(_hw_sw_cap_map), \ + MCDI_STRUCT_MEMBER((_hw_cap_data), const uint8_t, \ + MC_CMD_##_hw_cap_section), \ + MC_CMD_##_hw_cap_section##_LEN, \ + (_mask_sw), (_mask_hwp)) + +static void +efx_np_cap_sw_mask_to_hw_enum( + __in_ecount(hw_sw_map_nentries) const struct efx_np_cap_map *hw_sw_map, + __inunsigned int
[PATCH 33/46] common/sfc_efx/base: fill in software LUT for MAC statistics
To support MAC statistics, it is required to fill in a table which will be used by EFX to get DMA field IDs (offsets into the DMA buffer where MC FW uploads the data) by software IDs. Fill in the lookup table by parsing HW statistic descriptors. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/efx_impl.h | 8 + drivers/common/sfc_efx/base/efx_np.c | 291 + 2 files changed, 299 insertions(+) diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index ac1cd5292b..aafb2bf998 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -341,6 +341,12 @@ typedef struct efx_virtio_ops_s { typedef uint32_t efx_np_handle_t; +typedef struct efx_np_stat_s { + uint32_tens_hw_id; + uint16_tens_dma_fld; + boolean_t ens_valid; +} efx_np_stat_t; + typedef struct efx_port_s { efx_mac_type_t ep_mac_type; uint32_tep_phy_type; @@ -388,6 +394,8 @@ typedef struct efx_port_s { efx_np_handle_t ep_np_handle; efx_qword_t ep_np_loopback_cap_mask; uint8_t ep_np_cap_data_raw[MC_CMD_ETH_AN_FIELDS_LEN]; + /* Lookup table providing DMA buffer field IDs by EFX statistic IDs. */ + efx_np_stat_t ep_np_mac_stat_lut[EFX_MAC_NSTATS]; } efx_port_t; typedef struct efx_mon_ops_s { diff --git a/drivers/common/sfc_efx/base/efx_np.c b/drivers/common/sfc_efx/base/efx_np.c index 826ee93f0f..d4ee17ffb4 100644 --- a/drivers/common/sfc_efx/base/efx_np.c +++ b/drivers/common/sfc_efx/base/efx_np.c @@ -529,6 +529,286 @@ efx_np_assign_loopback_props( } #endif /* EFSYS_OPT_LOOPBACK */ +#if EFSYS_OPT_MAC_STATS +/* HW statistic IDs, as per MC_CMD_MAC_STATISTICS_DESCRIPTOR format. */ +#defineEFX_NP_HW_STAT_ID(_src, _idx) \ + (((MC_CMD_STAT_ID_##_src) << MC_CMD_STAT_ID_SOURCE_ID_LBN) |\ + ((uint32_t)(MC_CMD_STAT_ID_##_idx) << \ + MC_CMD_STAT_ID_MAC_STAT_ID_LBN)) + +/* + * Mapping between EFX statistic IDs (array indices) and their HW counterparts. + * + * This is used in conjunction with HW statistic descriptors bearing DMA field + * IDs (offsets into the DMA buffer) to provide a SW lookup table for readings. + * + * From the HW perspective, statistics come from MAC and PHY, hence two macros. + */ +static const efx_np_stat_t efx_np_mac_stat_map[] = { +#defineEFX_NP_STAT_MAC(_hw, _sw) \ + [EFX_MAC_##_sw] = { \ + .ens_hw_id = EFX_NP_HW_STAT_ID(MAC, _hw), \ + .ens_valid = B_TRUE,\ + } + + EFX_NP_STAT_MAC(TX_PKTS, TX_PKTS), + EFX_NP_STAT_MAC(TX_PAUSE_PKTS, TX_PAUSE_PKTS), + /* TODO: TX_CONTROL_PKTS */ + EFX_NP_STAT_MAC(TX_UNICAST_PKTS, TX_UNICST_PKTS), + EFX_NP_STAT_MAC(TX_MULTICAST_PKTS, TX_MULTICST_PKTS), + EFX_NP_STAT_MAC(TX_BROADCAST_PKTS, TX_BRDCST_PKTS), + EFX_NP_STAT_MAC(TX_BYTES, TX_OCTETS), + /* FIXME: TX_64_PKTS; TODO: TX_BAD_BYTES, TX_GOOD_BYTES, TX_LT64_PKTS */ + EFX_NP_STAT_MAC(TX_64_PKTS, TX_LE_64_PKTS), + EFX_NP_STAT_MAC(TX_65_TO_127_PKTS, TX_65_TO_127_PKTS), + EFX_NP_STAT_MAC(TX_128_TO_255_PKTS, TX_128_TO_255_PKTS), + EFX_NP_STAT_MAC(TX_256_TO_511_PKTS, TX_256_TO_511_PKTS), + EFX_NP_STAT_MAC(TX_512_TO_1023_PKTS, TX_512_TO_1023_PKTS), + EFX_NP_STAT_MAC(TX_1024_TO_15XX_PKTS, TX_1024_TO_15XX_PKTS), + /* FIXME: TX_15XX_TO_JUMBO_PKTS; TODO: TX_GTJUMBO_PKTS */ + EFX_NP_STAT_MAC(TX_15XX_TO_JUMBO_PKTS, TX_GE_15XX_PKTS), + /* TODO: TX_BAD_FCS_PKTS, TX_GOOD_FCS_PKTS */ + EFX_NP_STAT_MAC(RX_PKTS, RX_PKTS), + EFX_NP_STAT_MAC(RX_PAUSE_PKTS, RX_PAUSE_PKTS), + /* TODO: RX_GOOD_PKTS, RX_BAD_PKTS, RX_CONTROL_PKTS */ + EFX_NP_STAT_MAC(RX_UNICAST_PKTS, RX_UNICST_PKTS), + EFX_NP_STAT_MAC(RX_MULTICAST_PKTS, RX_MULTICST_PKTS), + EFX_NP_STAT_MAC(RX_BROADCAST_PKTS, RX_BRDCST_PKTS), + EFX_NP_STAT_MAC(RX_BYTES, RX_OCTETS), + /* TODO: RX_BAD_BYTES, RX_GOOD_BYTES */ + /* FIXME: RX_64_PKTS; TODO: RX_UNDERSIZE_PKTS */ + EFX_NP_STAT_MAC(RX_64_PKTS, RX_LE_64_PKTS), + EFX_NP_STAT_MAC(RX_65_TO_127_PKTS, RX_65_TO_127_PKTS), + EFX_NP_STAT_MAC(RX_128_TO_255_PKTS, RX_128_TO_255_PKTS), + EFX_NP_STAT_MAC(RX_256_TO_511_PKTS, RX_256_TO_511_PKTS), + EFX_NP_STAT_MAC(RX_512_TO_1023_PKTS, RX_512_TO_1023_PKTS), + EFX_NP_STAT_MAC(RX_1024_TO_15XX_PKTS, RX_1024_TO_15XX_PKTS), + /* FIXME: RX_15XX_TO_JUMBO_PKTS; TODO: RX_GTJUMBO_PKTS */ + EFX_NP_STAT_MAC(RX_15XX_TO_JUMBO_PKTS, RX_GE_15XX_PKTS), + EFX_NP_STAT_MAC(RX_BAD_FCS_PKTS, RX_FCS_ERRORS), + /* TODO: RX_GOOD_FCS_PKTS, RX_OVERFLOW_
[PATCH 35/46] common/sfc_efx/base: support MAC statistics on Medford4 NICs
Supply Medford4-specific methods to clear, upload and update MAC statistics, as well as the method to toggle periodic DMA updates. All of these leverage the same netport MCDI command. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/ef10_nic.c | 4 +- drivers/common/sfc_efx/base/efx_impl.h | 11 ++ drivers/common/sfc_efx/base/efx_mac.c | 8 +- drivers/common/sfc_efx/base/efx_mcdi.c | 12 +- drivers/common/sfc_efx/base/efx_np.c| 89 + drivers/common/sfc_efx/base/medford4_impl.h | 27 drivers/common/sfc_efx/base/medford4_mac.c | 138 7 files changed, 282 insertions(+), 7 deletions(-) diff --git a/drivers/common/sfc_efx/base/ef10_nic.c b/drivers/common/sfc_efx/base/ef10_nic.c index eb1b68b17e..31fcb361f2 100644 --- a/drivers/common/sfc_efx/base/ef10_nic.c +++ b/drivers/common/sfc_efx/base/ef10_nic.c @@ -2523,7 +2523,9 @@ ef10_nic_probe( #if EFSYS_OPT_MAC_STATS /* Wipe the MAC statistics */ - if ((rc = efx_mcdi_mac_stats_clear(enp)) != 0) + + rc = efx_mcdi_mac_stats_clear(enp); + if (rc != 0) goto fail6; #endif diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index aafb2bf998..7dbad601ff 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -1968,6 +1968,17 @@ efx_np_mac_ctrl( __inefx_np_handle_t nph, __inconst efx_np_mac_ctrl_t *mc); +#if EFSYS_OPT_MAC_STATS +LIBEFX_INTERNAL +extern __checkReturn efx_rc_t +efx_np_mac_stats( + __inefx_nic_t *enp, + __inefx_np_handle_t nph, + __inefx_stats_action_t action, + __in_optconst efsys_mem_t *esmp, + __inuint16_t period_ms); +#endif /* EFSYS_OPT_MAC_STATS */ + #ifdef __cplusplus } #endif diff --git a/drivers/common/sfc_efx/base/efx_mac.c b/drivers/common/sfc_efx/base/efx_mac.c index 6abe2046e8..f002cb838e 100644 --- a/drivers/common/sfc_efx/base/efx_mac.c +++ b/drivers/common/sfc_efx/base/efx_mac.c @@ -106,10 +106,10 @@ static const efx_mac_ops_t__efx_mac_medford4_ops = { #endif /* EFSYS_OPT_LOOPBACK */ #if EFSYS_OPT_MAC_STATS medford4_mac_stats_get_mask,/* emo_stats_get_mask */ - efx_mcdi_mac_stats_clear, /* emo_stats_clear */ - efx_mcdi_mac_stats_upload, /* emo_stats_upload */ - efx_mcdi_mac_stats_periodic,/* emo_stats_periodic */ - ef10_mac_stats_update /* emo_stats_update */ + medford4_mac_stats_clear, /* emo_stats_clear */ + medford4_mac_stats_upload, /* emo_stats_upload */ + medford4_mac_stats_periodic,/* emo_stats_periodic */ + medford4_mac_stats_update /* emo_stats_update */ #endif /* EFSYS_OPT_MAC_STATS */ }; #endif /* EFSYS_OPT_MEDFORD4 */ diff --git a/drivers/common/sfc_efx/base/efx_mcdi.c b/drivers/common/sfc_efx/base/efx_mcdi.c index 0bd56dd84d..20051c7da9 100644 --- a/drivers/common/sfc_efx/base/efx_mcdi.c +++ b/drivers/common/sfc_efx/base/efx_mcdi.c @@ -2244,10 +2244,18 @@ efx_mcdi_mac_stats( efx_mcdi_mac_stats_clear( __inefx_nic_t *enp) { + efx_port_t *epp = &(enp->en_port); efx_rc_t rc; - if ((rc = efx_mcdi_mac_stats(enp, enp->en_vport_id, NULL, - EFX_STATS_CLEAR, 0)) != 0) + if (efx_np_supported(enp) != B_FALSE) { + rc = efx_np_mac_stats(enp, epp->ep_np_handle, + EFX_STATS_CLEAR, NULL, 0); + } else { + rc = efx_mcdi_mac_stats(enp, enp->en_vport_id, NULL, + EFX_STATS_CLEAR, 0); + } + + if (rc != 0) goto fail1; return (0); diff --git a/drivers/common/sfc_efx/base/efx_np.c b/drivers/common/sfc_efx/base/efx_np.c index d4ee17ffb4..df836f09a6 100644 --- a/drivers/common/sfc_efx/base/efx_np.c +++ b/drivers/common/sfc_efx/base/efx_np.c @@ -1291,3 +1291,92 @@ efx_np_mac_ctrl( EFSYS_PROBE1(fail1, efx_rc_t, rc); return (rc); } + +#if EFSYS_OPT_MAC_STATS + __checkReturn efx_rc_t +efx_np_mac_stats( + __inefx_nic_t *enp, + __inefx_np_handle_t nph, + __inefx_stats_action_t action, + __in_optconst efsys_mem_t *esmp, + __inuint16_t period_ms) +{ + EFX_MCDI_DECLARE_BUF(payload, + MC_CMD_GET_NETPORT_STATISTICS_IN_LEN, + MC_CMD_GET_NETPORT_STATISTICS_OUT_LENMIN); + int enable = (action == EFX_STATS_ENABLE_NOEVENTS); + int events = (action == EFX_STATS_ENABLE_EVENTS); + int disable = (action == EFX_STATS_DISABLE); + int upload = (action == EFX_STATS_UPLOAD); + int clear = (action == EFX_STATS_CLEAR);
[PATCH 36/46] common/sfc_efx/base: implement MAC PDU controls for Medford4
Leverage new netport MCDI to implement support for such APIs. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/efx_impl.h | 4 ++ drivers/common/sfc_efx/base/efx_mac.c | 4 +- drivers/common/sfc_efx/base/efx_np.c| 17 drivers/common/sfc_efx/base/medford4_impl.h | 11 ++ drivers/common/sfc_efx/base/medford4_mac.c | 44 + 5 files changed, 78 insertions(+), 2 deletions(-) diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index 7dbad601ff..43964ccdba 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -1934,6 +1934,7 @@ efx_np_link_state( typedef struct efx_np_mac_state_s { uint32_tenms_fcntl; + uint32_tenms_pdu; boolean_t enms_up; } efx_np_mac_state_t; @@ -1956,9 +1957,12 @@ efx_np_link_ctrl( __inboolean_t fcntl_an); typedef struct efx_np_mac_ctrl_s { + boolean_t enmc_set_pdu_only; + boolean_t enmc_fcntl_autoneg; boolean_t enmc_include_fcs; uint32_tenmc_fcntl; + uint32_tenmc_pdu; } efx_np_mac_ctrl_t; LIBEFX_INTERNAL diff --git a/drivers/common/sfc_efx/base/efx_mac.c b/drivers/common/sfc_efx/base/efx_mac.c index f002cb838e..8712d7c5ef 100644 --- a/drivers/common/sfc_efx/base/efx_mac.c +++ b/drivers/common/sfc_efx/base/efx_mac.c @@ -94,8 +94,8 @@ static const efx_mac_ops_t__efx_mac_medford4_ops = { medford4_mac_poll, /* emo_poll */ medford4_mac_up,/* emo_up */ ef10_mac_addr_set, /* emo_addr_set */ - ef10_mac_pdu_set, /* emo_pdu_set */ - ef10_mac_pdu_get, /* emo_pdu_get */ + medford4_mac_pdu_set, /* emo_pdu_set */ + medford4_mac_pdu_get, /* emo_pdu_get */ medford4_mac_reconfigure, /* emo_reconfigure */ ef10_mac_multicast_list_set,/* emo_multicast_list_set */ ef10_mac_filter_default_rxq_set,/* emo_filter_default_rxq_set */ diff --git a/drivers/common/sfc_efx/base/efx_np.c b/drivers/common/sfc_efx/base/efx_np.c index df836f09a6..88e13f0df9 100644 --- a/drivers/common/sfc_efx/base/efx_np.c +++ b/drivers/common/sfc_efx/base/efx_np.c @@ -816,6 +816,7 @@ efx_np_attach( efx_nic_cfg_t *encp = &(enp->en_nic_cfg); efx_port_t *epp = &(enp->en_port); efx_np_link_state_t ls; + efx_np_mac_state_t ms; efx_rc_t rc; if (efx_np_supported(enp) == B_FALSE) @@ -867,8 +868,16 @@ efx_np_attach( goto fail4; #endif /* EFSYS_OPT_MAC_STATS */ + rc = efx_np_mac_state(enp, epp->ep_np_handle, &ms); + if (rc != 0) + goto fail5; + + epp->ep_mac_pdu = ms.enms_pdu; return (0); +fail5: + EFSYS_PROBE(fail5); + #if EFSYS_OPT_MAC_STATS fail4: EFSYS_PROBE(fail4); @@ -930,6 +939,7 @@ efx_np_mac_state( if (MCDI_OUT_DWORD(req, MAC_STATE_OUT_MAC_FAULT_FLAGS) == 0) msp->enms_up = B_TRUE; + msp->enms_pdu = MCDI_OUT_DWORD(req, MAC_STATE_OUT_MAX_FRAME_LEN); msp->enms_fcntl = MCDI_OUT_DWORD(req, MAC_STATE_OUT_FCNTL); return (0); @@ -1242,6 +1252,12 @@ efx_np_mac_ctrl( MCDI_IN_SET_DWORD(req, MAC_CTRL_IN_PORT_HANDLE, nph); + MCDI_IN_SET_DWORD(req, MAC_CTRL_IN_MAX_FRAME_LEN, mc->enmc_pdu); + cfg |= 1U << MC_CMD_MAC_CONFIG_OPTIONS_CFG_MAX_FRAME_LEN; + + if (mc->enmc_set_pdu_only != B_FALSE) + goto skip_full_reconfigure; + cfg |= 1U << MC_CMD_MAC_CONFIG_OPTIONS_CFG_INCLUDE_FCS; if (mc->enmc_include_fcs != B_FALSE) flags |= 1U << MC_CMD_MAC_FLAGS_FLAG_INCLUDE_FCS; @@ -1273,6 +1289,7 @@ efx_np_mac_ctrl( cfg |= 1U << MC_CMD_MAC_CONFIG_OPTIONS_CFG_FCNTL; MCDI_IN_SET_DWORD(req, MAC_CTRL_IN_FCNTL, fcntl); +skip_full_reconfigure: MCDI_IN_SET_DWORD(req, MAC_CTRL_IN_V2_CONTROL_FLAGS, cfg); efx_mcdi_execute(enp, &req); diff --git a/drivers/common/sfc_efx/base/medford4_impl.h b/drivers/common/sfc_efx/base/medford4_impl.h index cc45431a81..b9be5e4e82 100644 --- a/drivers/common/sfc_efx/base/medford4_impl.h +++ b/drivers/common/sfc_efx/base/medford4_impl.h @@ -51,6 +51,17 @@ medford4_mac_up( __inefx_nic_t *enp, __out boolean_t *mac_upp); +LIBEFX_INTERNAL +extern __checkReturn efx_rc_t +medford4_mac_pdu_set( + __inefx_nic_t *enp); + +LIBEFX_INTERNAL +extern __checkReturn efx_rc_t +medford4_mac_pdu_get( + __inefx_nic_t *enp, + __out size_t *pdup); + LIBEFX_INTERNAL extern __checkReturn efx_rc_t medford4_mac_reconfigure( diff --git a/drivers/common/sfc_efx/base/medford4_m
[PATCH 32/46] common/sfc_efx/base: add MAC reconfigure method for Medford4
That leverages MAC control functionality of new netport MCDI. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/efx_impl.h | 13 drivers/common/sfc_efx/base/efx_mac.c | 2 +- drivers/common/sfc_efx/base/efx_np.c| 73 + drivers/common/sfc_efx/base/medford4_impl.h | 5 ++ drivers/common/sfc_efx/base/medford4_mac.c | 32 + 5 files changed, 124 insertions(+), 1 deletion(-) diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index 15cf62506e..ac1cd5292b 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -1947,6 +1947,19 @@ efx_np_link_ctrl( __inuint32_t cap_mask_sw, __inboolean_t fcntl_an); +typedef struct efx_np_mac_ctrl_s { + boolean_t enmc_fcntl_autoneg; + boolean_t enmc_include_fcs; + uint32_tenmc_fcntl; +} efx_np_mac_ctrl_t; + +LIBEFX_INTERNAL +extern __checkReturn efx_rc_t +efx_np_mac_ctrl( + __inefx_nic_t *enp, + __inefx_np_handle_t nph, + __inconst efx_np_mac_ctrl_t *mc); + #ifdef __cplusplus } #endif diff --git a/drivers/common/sfc_efx/base/efx_mac.c b/drivers/common/sfc_efx/base/efx_mac.c index dde0e5ab87..3c29db0016 100644 --- a/drivers/common/sfc_efx/base/efx_mac.c +++ b/drivers/common/sfc_efx/base/efx_mac.c @@ -96,7 +96,7 @@ static const efx_mac_ops_t__efx_mac_medford4_ops = { ef10_mac_addr_set, /* emo_addr_set */ ef10_mac_pdu_set, /* emo_pdu_set */ ef10_mac_pdu_get, /* emo_pdu_get */ - ef10_mac_reconfigure, /* emo_reconfigure */ + medford4_mac_reconfigure, /* emo_reconfigure */ ef10_mac_multicast_list_set,/* emo_multicast_list_set */ ef10_mac_filter_default_rxq_set,/* emo_filter_default_rxq_set */ ef10_mac_filter_default_rxq_clear, diff --git a/drivers/common/sfc_efx/base/efx_np.c b/drivers/common/sfc_efx/base/efx_np.c index 03d49b9c78..826ee93f0f 100644 --- a/drivers/common/sfc_efx/base/efx_np.c +++ b/drivers/common/sfc_efx/base/efx_np.c @@ -923,6 +923,79 @@ efx_np_link_ctrl( fail2: EFSYS_PROBE(fail2); +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + return (rc); +} + + __checkReturn efx_rc_t +efx_np_mac_ctrl( + __inefx_nic_t *enp, + __inefx_np_handle_t nph, + __inconst efx_np_mac_ctrl_t *mc) +{ + EFX_MCDI_DECLARE_BUF(payload, + MC_CMD_MAC_CTRL_IN_LEN, + MC_CMD_MAC_CTRL_OUT_LEN); + efx_mcdi_req_t req; + uint32_t flags = 0; + uint32_t cfg = 0; + uint32_t fcntl; + efx_rc_t rc; + + req.emr_out_length = MC_CMD_MAC_CTRL_OUT_LEN; + req.emr_in_length = MC_CMD_MAC_CTRL_IN_LEN; + req.emr_cmd = MC_CMD_MAC_CTRL; + req.emr_out_buf = payload; + req.emr_in_buf = payload; + + MCDI_IN_SET_DWORD(req, MAC_CTRL_IN_PORT_HANDLE, nph); + + cfg |= 1U << MC_CMD_MAC_CONFIG_OPTIONS_CFG_INCLUDE_FCS; + if (mc->enmc_include_fcs != B_FALSE) + flags |= 1U << MC_CMD_MAC_FLAGS_FLAG_INCLUDE_FCS; + + MCDI_IN_SET_DWORD(req, MAC_CTRL_IN_FLAGS, flags); + + if (mc->enmc_fcntl_autoneg != B_FALSE) { + fcntl = MC_CMD_FCNTL_AUTO; + } else { + switch (mc->enmc_fcntl) { + case 0: + fcntl = MC_CMD_FCNTL_OFF; + break; + case EFX_FCNTL_RESPOND: + fcntl = MC_CMD_FCNTL_RESPOND; + break; + case EFX_FCNTL_GENERATE: + fcntl = MC_CMD_FCNTL_GENERATE; + break; + case EFX_FCNTL_RESPOND | EFX_FCNTL_GENERATE: + fcntl = MC_CMD_FCNTL_BIDIR; + break; + default: + rc = EINVAL; + goto fail1; + } + } + + cfg |= 1U << MC_CMD_MAC_CONFIG_OPTIONS_CFG_FCNTL; + MCDI_IN_SET_DWORD(req, MAC_CTRL_IN_FCNTL, fcntl); + + MCDI_IN_SET_DWORD(req, MAC_CTRL_IN_V2_CONTROL_FLAGS, cfg); + + efx_mcdi_execute(enp, &req); + + if (req.emr_rc != 0) { + rc = req.emr_rc; + goto fail2; + } + + return (0); + +fail2: + EFSYS_PROBE(fail2); + fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); return (rc); diff --git a/drivers/common/sfc_efx/base/medford4_impl.h b/drivers/common/sfc_efx/base/medford4_impl.h index 6aa065c730..8b232c516a 100644 --- a/drivers/common/sfc_efx/base/medford4_impl.h +++ b/drivers/common/sfc_efx/base/medford4_impl.h @@ -51,6 +51,11 @@ medford4_mac_up( __inefx_nic_t *enp, __out
[PATCH 31/46] common/sfc_efx/base: introduce Medford4 stub for MAC methods
Provide only a small subset of methods for now. Next patches will augment the file with more, based on newer netport MCDI. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/efx_mac.c | 32 +++- drivers/common/sfc_efx/base/medford4_impl.h | 12 + drivers/common/sfc_efx/base/medford4_mac.c | 54 + drivers/common/sfc_efx/base/meson.build | 1 + 4 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 drivers/common/sfc_efx/base/medford4_mac.c diff --git a/drivers/common/sfc_efx/base/efx_mac.c b/drivers/common/sfc_efx/base/efx_mac.c index a2cbf02b46..dde0e5ab87 100644 --- a/drivers/common/sfc_efx/base/efx_mac.c +++ b/drivers/common/sfc_efx/base/efx_mac.c @@ -89,6 +89,31 @@ static const efx_mac_ops_t __efx_mac_rhead_ops = { }; #endif /* EFSYS_OPT_RIVERHEAD */ +#if EFSYS_OPT_MEDFORD4 +static const efx_mac_ops_t __efx_mac_medford4_ops = { + medford4_mac_poll, /* emo_poll */ + medford4_mac_up,/* emo_up */ + ef10_mac_addr_set, /* emo_addr_set */ + ef10_mac_pdu_set, /* emo_pdu_set */ + ef10_mac_pdu_get, /* emo_pdu_get */ + ef10_mac_reconfigure, /* emo_reconfigure */ + ef10_mac_multicast_list_set,/* emo_multicast_list_set */ + ef10_mac_filter_default_rxq_set,/* emo_filter_default_rxq_set */ + ef10_mac_filter_default_rxq_clear, + /* emo_filter_default_rxq_clear */ +#if EFSYS_OPT_LOOPBACK + ef10_mac_loopback_set, /* emo_loopback_set */ +#endif /* EFSYS_OPT_LOOPBACK */ +#if EFSYS_OPT_MAC_STATS + ef10_mac_stats_get_mask,/* emo_stats_get_mask */ + efx_mcdi_mac_stats_clear, /* emo_stats_clear */ + efx_mcdi_mac_stats_upload, /* emo_stats_upload */ + efx_mcdi_mac_stats_periodic,/* emo_stats_periodic */ + ef10_mac_stats_update /* emo_stats_update */ +#endif /* EFSYS_OPT_MAC_STATS */ +}; +#endif /* EFSYS_OPT_MEDFORD4 */ + __checkReturn efx_rc_t efx_mac_pdu_set( __inefx_nic_t *enp, @@ -271,6 +296,11 @@ efx_mac_drain( EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT); EFSYS_ASSERT(emop != NULL); + if (efx_np_supported(enp) != B_FALSE) { + /* Only pre-Medford4 boards have supported MAC drain control. */ + return (0); + } + if (epp->ep_mac_drain == enabled) return (0); @@ -955,7 +985,7 @@ efx_mac_select( #if EFSYS_OPT_MEDFORD4 case EFX_FAMILY_MEDFORD4: - emop = &__efx_mac_ef10_ops; + emop = &__efx_mac_medford4_ops; type = EFX_MAC_MEDFORD4; break; #endif /* EFSYS_OPT_MEDFORD4 */ diff --git a/drivers/common/sfc_efx/base/medford4_impl.h b/drivers/common/sfc_efx/base/medford4_impl.h index 795fd45bd4..6aa065c730 100644 --- a/drivers/common/sfc_efx/base/medford4_impl.h +++ b/drivers/common/sfc_efx/base/medford4_impl.h @@ -39,6 +39,18 @@ extern __checkReturn efx_rc_t medford4_phy_reconfigure( __inefx_nic_t *enp); +LIBEFX_INTERNAL +extern __checkReturn efx_rc_t +medford4_mac_poll( + __inefx_nic_t *enp, + __out efx_link_mode_t *link_modep); + +LIBEFX_INTERNAL +extern __checkReturn efx_rc_t +medford4_mac_up( + __inefx_nic_t *enp, + __out boolean_t *mac_upp); + #ifdef __cplusplus } #endif diff --git a/drivers/common/sfc_efx/base/medford4_mac.c b/drivers/common/sfc_efx/base/medford4_mac.c new file mode 100644 index 00..57ddbecfaa --- /dev/null +++ b/drivers/common/sfc_efx/base/medford4_mac.c @@ -0,0 +1,54 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * + * Copyright(c) 2025 Advanced Micro Devices, Inc. + */ +#include "efx.h" +#include "efx_impl.h" +#include "medford4_impl.h" + +#if EFSYS_OPT_MEDFORD4 + __checkReturn efx_rc_t +medford4_mac_poll( + __inefx_nic_t *enp, + __out efx_link_mode_t *link_modep) +{ + efx_port_t *epp = &(enp->en_port); + ef10_link_state_t els; + efx_rc_t rc; + + rc = medford4_phy_get_link(enp, &els); + if (rc != 0) + goto fail1; + + epp->ep_adv_cap_mask = els.epls.epls_adv_cap_mask; + epp->ep_fcntl = els.epls.epls_fcntl; + + *link_modep = els.epls.epls_link_mode; + return (0); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + *link_modep = EFX_LINK_UNKNOWN; + return (rc); +} + + __checkReturn efx_rc_t +medford4_mac_up( + __inefx_nic_t *enp, + __out boolean_t *mac_upp) +{ + ef10_link_state_t els; +
[PATCH 34/46] common/sfc_efx/base: fill in MAC statistics mask on Medford4
Let client drivers know which MAC statistics can be accessed. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/efx_mac.c | 2 +- drivers/common/sfc_efx/base/medford4_impl.h | 9 ++ drivers/common/sfc_efx/base/medford4_mac.c | 31 + 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/drivers/common/sfc_efx/base/efx_mac.c b/drivers/common/sfc_efx/base/efx_mac.c index 3c29db0016..6abe2046e8 100644 --- a/drivers/common/sfc_efx/base/efx_mac.c +++ b/drivers/common/sfc_efx/base/efx_mac.c @@ -105,7 +105,7 @@ static const efx_mac_ops_t __efx_mac_medford4_ops = { ef10_mac_loopback_set, /* emo_loopback_set */ #endif /* EFSYS_OPT_LOOPBACK */ #if EFSYS_OPT_MAC_STATS - ef10_mac_stats_get_mask,/* emo_stats_get_mask */ + medford4_mac_stats_get_mask,/* emo_stats_get_mask */ efx_mcdi_mac_stats_clear, /* emo_stats_clear */ efx_mcdi_mac_stats_upload, /* emo_stats_upload */ efx_mcdi_mac_stats_periodic,/* emo_stats_periodic */ diff --git a/drivers/common/sfc_efx/base/medford4_impl.h b/drivers/common/sfc_efx/base/medford4_impl.h index 8b232c516a..2fbf1495d1 100644 --- a/drivers/common/sfc_efx/base/medford4_impl.h +++ b/drivers/common/sfc_efx/base/medford4_impl.h @@ -56,6 +56,15 @@ extern __checkReturn efx_rc_t medford4_mac_reconfigure( __inefx_nic_t *enp); +#if EFSYS_OPT_MAC_STATS +LIBEFX_INTERNAL +extern __checkReturn efx_rc_t +medford4_mac_stats_get_mask( + __inefx_nic_t *enp, + __inout_bcount(sz) uint32_t *maskp, + __insize_t sz); +#endif /* EFSYS_OPT_MAC_STATS */ + #ifdef __cplusplus } #endif diff --git a/drivers/common/sfc_efx/base/medford4_mac.c b/drivers/common/sfc_efx/base/medford4_mac.c index c037c29b92..b8a5aade16 100644 --- a/drivers/common/sfc_efx/base/medford4_mac.c +++ b/drivers/common/sfc_efx/base/medford4_mac.c @@ -83,4 +83,35 @@ medford4_mac_reconfigure( EFSYS_PROBE1(fail1, efx_rc_t, rc); return (rc); } + +#if EFSYS_OPT_MAC_STATS + __checkReturn efx_rc_t +medford4_mac_stats_get_mask( + __inefx_nic_t *enp, + __inout_bcount(sz) uint32_t *maskp, + __insize_t sz) +{ + efx_port_t *epp = &(enp->en_port); + unsigned int i; + efx_rc_t rc; + + for (i = 0; i < EFX_ARRAY_SIZE(epp->ep_np_mac_stat_lut); ++i) { + const struct efx_mac_stats_range rng[] = { { i, i } }; + + if (epp->ep_np_mac_stat_lut[i].ens_valid == B_FALSE) + continue; + + rc = efx_mac_stats_mask_add_ranges(maskp, sz, rng, 1); + if (rc != 0) + goto fail1; + } + + /* TODO: care about VADAPTOR statistics */ + return (0); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + return (rc); +} +#endif /* EFSYS_OPT_MAC_STATS */ #endif /* EFSYS_OPT_MEDFORD4 */ -- 2.39.5
[PATCH 07/46] common/sfc_efx/base: add Medford4 support to MAC module
From: Denis Pryazhennikov Use common EF10 method table for that. Signed-off-by: Denis Pryazhennikov Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/efx_impl.h | 1 + drivers/common/sfc_efx/base/efx_mac.c | 7 +++ 2 files changed, 8 insertions(+) diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index 9d1f361c5d..89b7e0292e 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -79,6 +79,7 @@ typedef enum efx_mac_type_e { EFX_MAC_MEDFORD, EFX_MAC_MEDFORD2, EFX_MAC_RIVERHEAD, + EFX_MAC_MEDFORD4, EFX_MAC_NTYPES } efx_mac_type_t; diff --git a/drivers/common/sfc_efx/base/efx_mac.c b/drivers/common/sfc_efx/base/efx_mac.c index 13cac5a751..a2cbf02b46 100644 --- a/drivers/common/sfc_efx/base/efx_mac.c +++ b/drivers/common/sfc_efx/base/efx_mac.c @@ -953,6 +953,13 @@ efx_mac_select( break; #endif /* EFSYS_OPT_RIVERHEAD */ +#if EFSYS_OPT_MEDFORD4 + case EFX_FAMILY_MEDFORD4: + emop = &__efx_mac_ef10_ops; + type = EFX_MAC_MEDFORD4; + break; +#endif /* EFSYS_OPT_MEDFORD4 */ + default: rc = EINVAL; goto fail1; -- 2.39.5
[PATCH 08/46] common/sfc_efx/base: add Medford4 support to PHY module
From: Denis Pryazhennikov Use common EF10 method table for that. Signed-off-by: Denis Pryazhennikov Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/efx_phy.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/common/sfc_efx/base/efx_phy.c b/drivers/common/sfc_efx/base/efx_phy.c index d55becae18..3d792f20b8 100644 --- a/drivers/common/sfc_efx/base/efx_phy.c +++ b/drivers/common/sfc_efx/base/efx_phy.c @@ -114,6 +114,12 @@ efx_phy_probe( break; #endif /* EFSYS_OPT_MEDFORD2 */ +#if EFSYS_OPT_MEDFORD4 + case EFX_FAMILY_MEDFORD4: + epop = &__efx_phy_ef10_ops; + break; +#endif /* EFSYS_OPT_MEDFORD4 */ + default: rc = ENOTSUP; goto fail1; -- 2.39.5
[PATCH 12/46] common/sfc_efx/base: add Medford4 support to Tx module
From: Denis Pryazhennikov Define and use Medford4 specific method table. Signed-off-by: Denis Pryazhennikov Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/efx_tx.c | 33 1 file changed, 33 insertions(+) diff --git a/drivers/common/sfc_efx/base/efx_tx.c b/drivers/common/sfc_efx/base/efx_tx.c index 6f61f937a1..d1021dea82 100644 --- a/drivers/common/sfc_efx/base/efx_tx.c +++ b/drivers/common/sfc_efx/base/efx_tx.c @@ -233,6 +233,33 @@ static const efx_tx_ops_t __efx_tx_rhead_ops = { #endif /* EFSYS_OPT_RIVERHEAD */ +#if EFSYS_OPT_MEDFORD4 +static const efx_tx_ops_t __efx_tx_medford4_ops = { + ef10_tx_init, /* etxo_init */ + ef10_tx_fini, /* etxo_fini */ + ef10_tx_qcreate,/* etxo_qcreate */ + ef10_tx_qdestroy, /* etxo_qdestroy */ + ef10_tx_qpost, /* etxo_qpost */ + ef10_tx_qpush, /* etxo_qpush */ + ef10_tx_qpace, /* etxo_qpace */ + ef10_tx_qflush, /* etxo_qflush */ + ef10_tx_qenable,/* etxo_qenable */ + NULL, /* etxo_qpio_enable */ + NULL, /* etxo_qpio_disable */ + NULL, /* etxo_qpio_write */ + NULL, /* etxo_qpio_post */ + ef10_tx_qdesc_post, /* etxo_qdesc_post */ + ef10_tx_qdesc_dma_create, /* etxo_qdesc_dma_create */ + NULL, /* etxo_qdesc_tso_create */ + ef10_tx_qdesc_tso2_create, /* etxo_qdesc_tso2_create */ + ef10_tx_qdesc_vlantci_create, /* etxo_qdesc_vlantci_create */ + ef10_tx_qdesc_checksum_create, /* etxo_qdesc_checksum_create */ +#if EFSYS_OPT_QSTATS + ef10_tx_qstats_update, /* etxo_qstats_update */ +#endif +}; +#endif /* EFSYS_OPT_MEDFORD4 */ + __checkReturn efx_rc_t efx_tx_init( __inefx_nic_t *enp) @@ -284,6 +311,12 @@ efx_tx_init( break; #endif /* EFSYS_OPT_RIVERHEAD */ +#if EFSYS_OPT_MEDFORD4 + case EFX_FAMILY_MEDFORD4: + etxop = &__efx_tx_medford4_ops; + break; +#endif /* EFSYS_OPT_MEDFORD4 */ + default: EFSYS_ASSERT(0); rc = ENOTSUP; -- 2.39.5
[PATCH 11/46] common/sfc_efx/base: add Medford4 support to Rx module
From: Denis Pryazhennikov Use common EF10 method table for that. Signed-off-by: Denis Pryazhennikov Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/efx_rx.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/common/sfc_efx/base/efx_rx.c b/drivers/common/sfc_efx/base/efx_rx.c index dce9ada55d..86dfc89ba4 100644 --- a/drivers/common/sfc_efx/base/efx_rx.c +++ b/drivers/common/sfc_efx/base/efx_rx.c @@ -261,6 +261,12 @@ efx_rx_init( break; #endif /* EFSYS_OPT_RIVERHEAD */ +#if EFSYS_OPT_MEDFORD4 + case EFX_FAMILY_MEDFORD4: + erxop = &__efx_rx_ef10_ops; + break; +#endif /* EFSYS_OPT_MEDFORD4 */ + default: EFSYS_ASSERT(0); rc = ENOTSUP; -- 2.39.5
[PATCH 10/46] common/sfc_efx/base: add Medford4 support to MCDI module
From: Denis Pryazhennikov Use common EF10 method table for that. Signed-off-by: Denis Pryazhennikov Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/efx_mcdi.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/common/sfc_efx/base/efx_mcdi.c b/drivers/common/sfc_efx/base/efx_mcdi.c index acf7f02246..0bd56dd84d 100644 --- a/drivers/common/sfc_efx/base/efx_mcdi.c +++ b/drivers/common/sfc_efx/base/efx_mcdi.c @@ -119,6 +119,12 @@ efx_mcdi_init( break; #endif /* EFSYS_OPT_RIVERHEAD */ +#if EFSYS_OPT_MEDFORD4 + case EFX_FAMILY_MEDFORD4: + emcop = &__efx_mcdi_ef10_ops; + break; +#endif /* EFSYS_OPT_MEDFORD4 */ + default: EFSYS_ASSERT(0); rc = ENOTSUP; -- 2.39.5
[PATCH 09/46] common/sfc_efx/base: add Medford4 support to TUNNEL module
From: Denis Pryazhennikov Use common EF10 method table for that. Signed-off-by: Denis Pryazhennikov Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/efx_tunnel.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/common/sfc_efx/base/efx_tunnel.c b/drivers/common/sfc_efx/base/efx_tunnel.c index d63f9176e4..75968a0b4f 100644 --- a/drivers/common/sfc_efx/base/efx_tunnel.c +++ b/drivers/common/sfc_efx/base/efx_tunnel.c @@ -47,7 +47,7 @@ #if EFSYS_OPT_TUNNEL -#if EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 +#if EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 || EFSYS_OPT_MEDFORD4 static __checkReturn boolean_t ef10_udp_encap_supported( __inefx_nic_t *enp); @@ -59,7 +59,7 @@ ef10_tunnel_reconfigure( static void ef10_tunnel_fini( __inefx_nic_t *enp); -#endif /* EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */ +#endif /* EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 || EFSYS_OPT_MEDFORD4 */ #if EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON static const efx_tunnel_ops_t __efx_tunnel_dummy_ops = { @@ -68,12 +68,12 @@ static const efx_tunnel_ops_t __efx_tunnel_dummy_ops = { }; #endif /* EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON */ -#if EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 +#if EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 || EFSYS_OPT_MEDFORD4 static const efx_tunnel_ops_t __efx_tunnel_ef10_ops = { ef10_tunnel_reconfigure,/* eto_reconfigure */ ef10_tunnel_fini, /* eto_fini */ }; -#endif /* EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */ +#endif /* EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 || EFSYS_OPT_MEDFORD4 */ #if EFSYS_OPT_RIVERHEAD static const efx_tunnel_ops_t __efx_tunnel_rhead_ops = { @@ -254,6 +254,12 @@ efx_tunnel_init( break; #endif /* EFSYS_OPT_RIVERHEAD */ +#if EFSYS_OPT_MEDFORD4 + case EFX_FAMILY_MEDFORD4: + etop = &__efx_tunnel_ef10_ops; + break; +#endif /* EFSYS_OPT_MEDFORD4 */ + default: EFSYS_ASSERT(0); rc = ENOTSUP; @@ -637,7 +643,7 @@ efx_tunnel_reconfigure( return (rc); } -#if EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 +#if EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 || EFSYS_OPT_MEDFORD4 static __checkReturn boolean_t ef10_udp_encap_supported( __inefx_nic_t *enp) @@ -724,6 +730,6 @@ ef10_tunnel_fini( &resetting); } } -#endif /* EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */ +#endif /* EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 || EFSYS_OPT_MEDFORD4 */ #endif /* EFSYS_OPT_TUNNEL */ -- 2.39.5
[PATCH 21/46] common/sfc_efx/base: provide defaults on netport attach path
Fill in some port information, including legacy Siena fields. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/efx_np.c | 44 1 file changed, 44 insertions(+) diff --git a/drivers/common/sfc_efx/base/efx_np.c b/drivers/common/sfc_efx/base/efx_np.c index 432185f311..3200bc0a90 100644 --- a/drivers/common/sfc_efx/base/efx_np.c +++ b/drivers/common/sfc_efx/base/efx_np.c @@ -12,13 +12,57 @@ efx_np_supported( return (enp->en_family >= EFX_FAMILY_MEDFORD4) ? B_TRUE : B_FALSE; } +static void +efx_np_assign_legacy_props( + __inefx_nic_t *enp) +{ + efx_nic_cfg_t *encp = &(enp->en_nic_cfg); + + memset(encp->enc_phy_revision, 0, sizeof (encp->enc_phy_revision)); + encp->enc_phy_type = 0; + +#if EFSYS_OPT_NAMES + memset(encp->enc_phy_name, 0, sizeof (encp->enc_phy_name)); +#endif /* EFSYS_OPT_NAMES */ + +#if EFSYS_OPT_PHY_STATS + encp->enc_mcdi_phy_stat_mask = 0; +#endif /* EFSYS_OPT_PHY_STATS */ + +#if EFSYS_OPT_PHY_FLAGS + encp->enc_phy_flags_mask = 0; +#endif /* EFSYS_OPT_PHY_FLAGS */ + +#if EFSYS_OPT_BIST + encp->enc_bist_mask = 0; +#endif /* EFSYS_OPT_BIST */ + + encp->enc_mcdi_mdio_channel = 0; + encp->enc_port = 0; +} + __checkReturn efx_rc_t efx_np_attach( __inefx_nic_t *enp) { + efx_nic_cfg_t *encp = &(enp->en_nic_cfg); + efx_port_t *epp = &(enp->en_port); + if (efx_np_supported(enp) == B_FALSE) return (0); + /* +* Some EFX properties are mostly leftover from Siena era +* and we prefer to initialise those to harmless defaults. +*/ + efx_np_assign_legacy_props(enp); + +#if EFSYS_OPT_PHY_LED_CONTROL + encp->enc_led_mask = 1U << EFX_PHY_LED_DEFAULT; +#endif /* EFSYS_OPT_PHY_LED_CONTROL */ + + epp->ep_fixed_port_type = EFX_PHY_MEDIA_INVALID; + epp->ep_module_type = EFX_PHY_MEDIA_INVALID; return (0); } -- 2.39.5
[PATCH 13/46] drivers: enable support for AMD Solarflare X4 adapter family
From: Denis Pryazhennikov Enable support for Medford4 (X4) adapters X4522 and X4542. Signed-off-by: Denis Pryazhennikov Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/efsys.h | 4 ++-- drivers/net/sfc/sfc_ethdev.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/common/sfc_efx/efsys.h b/drivers/common/sfc_efx/efsys.h index e63cbdbe8f..ea68d3bd1a 100644 --- a/drivers/common/sfc_efx/efsys.h +++ b/drivers/common/sfc_efx/efsys.h @@ -125,8 +125,8 @@ prefetch_read_once(const volatile void *addr) #define EFSYS_OPT_MEDFORD2 1 /* Enable Riverhead support */ #define EFSYS_OPT_RIVERHEAD 1 -/* Disable Medford4 support (not supported yet) */ -#define EFSYS_OPT_MEDFORD4 0 +/* Enable Medford4 support */ +#define EFSYS_OPT_MEDFORD4 1 #ifdef RTE_DEBUG_COMMON_SFC_EFX #define EFSYS_OPT_CHECK_REG 1 diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 82fbdbae9c..3e57c902df 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -2829,6 +2829,7 @@ sfc_eth_dev_set_ops(struct rte_eth_dev *dev) case EFX_FAMILY_HUNTINGTON: case EFX_FAMILY_MEDFORD: case EFX_FAMILY_MEDFORD2: + case EFX_FAMILY_MEDFORD4: avail_caps |= SFC_DP_HW_FW_CAP_EF10; avail_caps |= SFC_DP_HW_FW_CAP_RX_EFX; avail_caps |= SFC_DP_HW_FW_CAP_TX_EFX; @@ -3301,6 +3302,8 @@ static const struct rte_pci_id pci_id_sfc_efx_map[] = { { RTE_PCI_DEVICE(EFX_PCI_VENID_SFC, EFX_PCI_DEVID_MEDFORD_VF) }, { RTE_PCI_DEVICE(EFX_PCI_VENID_SFC, EFX_PCI_DEVID_MEDFORD2) }, { RTE_PCI_DEVICE(EFX_PCI_VENID_SFC, EFX_PCI_DEVID_MEDFORD2_VF) }, + { RTE_PCI_DEVICE(EFX_PCI_VENID_SFC, EFX_PCI_DEVID_MEDFORD4) }, + { RTE_PCI_DEVICE(EFX_PCI_VENID_SFC, EFX_PCI_DEVID_MEDFORD4_VF) }, { RTE_PCI_DEVICE(EFX_PCI_VENID_XILINX, EFX_PCI_DEVID_RIVERHEAD) }, { RTE_PCI_DEVICE(EFX_PCI_VENID_XILINX, EFX_PCI_DEVID_RIVERHEAD_VF) }, { .vendor_id = 0 /* sentinel */ } -- 2.39.5
[PATCH 14/46] common/sfc_efx/base: update X4 BAR layout and PCI IDs
From: Andy Moreton The BAR layout on X4 has changed to put MSI-X (and CXL) in BAR0/1, and moved the main memory BAR to be BAR2/3. Update definitions to match the updated hardware and cmodel. Also add PCI IDs used for functions which only have the full feature (X2 style) datapath engines, and do not support the low latency datapath engine. Signed-off-by: Andy Moreton Reviewed-by: Ivan Malov --- drivers/common/sfc_efx/base/efx.h | 12 +--- drivers/common/sfc_efx/base/efx_nic.c | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index 442dfa0830..a9ed3f423f 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -173,9 +173,15 @@ efx_family_probe_bar( #defineEFX_PCI_DEVID_RIVERHEAD 0x0100 #defineEFX_PCI_DEVID_RIVERHEAD_VF 0x1100 +/* + * Medford4 has low latency (LL) and full feature (FF) datapath engines. + * Some Medford4 functions have FF and LL datapath, others only have FF. + */ #defineEFX_PCI_DEVID_MEDFORD4_PF_UNINIT0x0C13 -#defineEFX_PCI_DEVID_MEDFORD4 0x0C03 -#defineEFX_PCI_DEVID_MEDFORD4_VF 0x1C03 +#defineEFX_PCI_DEVID_MEDFORD4 0x0C03 /* X4 PF, FF+LL */ +#defineEFX_PCI_DEVID_MEDFORD4_VF 0x1C03 /* X4 VF, FF+LL */ +#defineEFX_PCI_DEVID_MEDFORD4_NO_LL0x2C03 /* X4 PF, FF only */ +#defineEFX_PCI_DEVID_MEDFORD4_NO_LL_VF 0x3C03 /* X4 VF, FF only */ #defineEFX_MEM_BAR_SIENA 2 @@ -190,7 +196,7 @@ efx_family_probe_bar( /* FIXME Fix it when memory bar is fixed in FPGA image. It must be 0. */ #defineEFX_MEM_BAR_RIVERHEAD 2 -#defineEFX_MEM_BAR_MEDFORD40 +#defineEFX_MEM_BAR_MEDFORD42 /* Error codes */ diff --git a/drivers/common/sfc_efx/base/efx_nic.c b/drivers/common/sfc_efx/base/efx_nic.c index 5bcc0a04ff..1ec684da40 100644 --- a/drivers/common/sfc_efx/base/efx_nic.c +++ b/drivers/common/sfc_efx/base/efx_nic.c @@ -87,6 +87,8 @@ efx_family( */ case EFX_PCI_DEVID_MEDFORD4: case EFX_PCI_DEVID_MEDFORD4_VF: + case EFX_PCI_DEVID_MEDFORD4_NO_LL: + case EFX_PCI_DEVID_MEDFORD4_NO_LL_VF: *efp = EFX_FAMILY_MEDFORD4; *membarp = EFX_MEM_BAR_MEDFORD4; return (0); -- 2.39.5
[PATCH 20/46] common/sfc_efx/base: provide a stub for basic netport attach
New NICs (for instance, Medford4) offer new netport MCDI for managing physical ports, which will supersede the legacy one. Scope out the new interface initialisation on NIC probe path. That will be augmented with the actual code by later patches. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/ef10_nic.c | 30 ++-- drivers/common/sfc_efx/base/efx_impl.h | 15 drivers/common/sfc_efx/base/efx_np.c| 31 + drivers/common/sfc_efx/base/meson.build | 1 + 4 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 drivers/common/sfc_efx/base/efx_np.c diff --git a/drivers/common/sfc_efx/base/ef10_nic.c b/drivers/common/sfc_efx/base/ef10_nic.c index e1e8de5396..eb1b68b17e 100644 --- a/drivers/common/sfc_efx/base/ef10_nic.c +++ b/drivers/common/sfc_efx/base/ef10_nic.c @@ -2221,6 +2221,9 @@ efx_mcdi_nic_board_cfg( encp->enc_board_type = board_type; + if (efx_np_supported(enp) != B_FALSE) + goto skip_phy_props; + /* Fill out fields in enp->en_port and enp->en_nic_cfg from MCDI */ if ((rc = efx_mcdi_get_phy_cfg(enp)) != 0) goto fail8; @@ -2246,6 +2249,7 @@ efx_mcdi_nic_board_cfg( epp->ep_default_adv_cap_mask = els.epls.epls_adv_cap_mask; epp->ep_adv_cap_mask = els.epls.epls_adv_cap_mask; +skip_phy_props: /* Check capabilities of running datapath firmware */ if ((rc = ef10_get_datapath_caps(enp)) != 0) goto fail10; @@ -2499,6 +2503,10 @@ ef10_nic_probe( if ((rc = ef10_nic_board_cfg(enp)) != 0) goto fail4; + rc = efx_np_attach(enp); + if (rc != 0) + goto fail5; + /* * Set default driver config limits (based on board config). * @@ -2516,36 +2524,41 @@ ef10_nic_probe( #if EFSYS_OPT_MAC_STATS /* Wipe the MAC statistics */ if ((rc = efx_mcdi_mac_stats_clear(enp)) != 0) - goto fail5; + goto fail6; #endif #if EFSYS_OPT_LOOPBACK - if ((rc = efx_mcdi_get_loopback_modes(enp)) != 0) - goto fail6; + if (efx_np_supported(enp) == B_FALSE) { + rc = efx_mcdi_get_loopback_modes(enp); + if (rc != 0) + goto fail7; + } #endif #if EFSYS_OPT_MON_STATS if ((rc = mcdi_mon_cfg_build(enp)) != 0) { /* Unprivileged functions do not have access to sensors */ if (rc != EACCES) - goto fail7; + goto fail8; } #endif return (0); #if EFSYS_OPT_MON_STATS +fail8: + EFSYS_PROBE(fail8); +#endif +#if EFSYS_OPT_LOOPBACK fail7: EFSYS_PROBE(fail7); #endif -#if EFSYS_OPT_LOOPBACK +#if EFSYS_OPT_MAC_STATS fail6: EFSYS_PROBE(fail6); #endif -#if EFSYS_OPT_MAC_STATS fail5: EFSYS_PROBE(fail5); -#endif fail4: EFSYS_PROBE(fail4); fail3: @@ -3005,6 +3018,9 @@ ef10_nic_unprobe( #if EFSYS_OPT_MON_STATS mcdi_mon_cfg_free(enp); #endif /* EFSYS_OPT_MON_STATS */ + + efx_np_detach(enp); + (void) efx_mcdi_drv_attach(enp, B_FALSE); } diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index 89b7e0292e..9ad973ded7 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -1880,6 +1880,21 @@ struct efx_virtio_vq_s { #endif /* EFSYS_OPT_VIRTIO */ +LIBEFX_INTERNAL +extern boolean_t +efx_np_supported( + __inefx_nic_t *enp); + +LIBEFX_INTERNAL +extern __checkReturn efx_rc_t +efx_np_attach( + __inefx_nic_t *enp); + +LIBEFX_INTERNAL +extern void +efx_np_detach( + __inefx_nic_t *enp); + #ifdef __cplusplus } #endif diff --git a/drivers/common/sfc_efx/base/efx_np.c b/drivers/common/sfc_efx/base/efx_np.c new file mode 100644 index 00..432185f311 --- /dev/null +++ b/drivers/common/sfc_efx/base/efx_np.c @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * + * Copyright(c) 2025 Advanced Micro Devices, Inc. + */ +#include "efx.h" +#include "efx_impl.h" + + boolean_t +efx_np_supported( + __inefx_nic_t *enp) +{ + return (enp->en_family >= EFX_FAMILY_MEDFORD4) ? B_TRUE : B_FALSE; +} + + __checkReturn efx_rc_t +efx_np_attach( + __inefx_nic_t *enp) +{ + if (efx_np_supported(enp) == B_FALSE) + return (0); + + return (0); +} + + void +efx_np_detach( + __inefx_nic_t *enp) +{ + if (efx_np_supported(enp) == B_FALSE) + return; +} diff --git a/drivers/common/sfc_efx/base/meson.build b/drivers/common/sfc_efx/base/meson.build index c8deb4555e..02d5b2fbb9 100644 --- a/drivers/common/sfc_efx/base/meson.build +++ b/drivers/common/sfc_efx/base/me
[PATCH 16/46] common/sfc_efx/base: add port mode for 8 port hardware
From: Andy Moreton Add support for 8 port mode and adjust the bus bandwidth computation and external port mapping table. Signed-off-by: Andy Moreton Reviewed-by: Ivan Malov --- drivers/common/sfc_efx/base/ef10_nic.c| 20 +++ drivers/common/sfc_efx/base/ef10_tlv_layout.h | 9 ++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/drivers/common/sfc_efx/base/ef10_nic.c b/drivers/common/sfc_efx/base/ef10_nic.c index 77c97217ee..0e00ff64d4 100644 --- a/drivers/common/sfc_efx/base/ef10_nic.c +++ b/drivers/common/sfc_efx/base/ef10_nic.c @@ -176,6 +176,9 @@ ef10_nic_get_port_mode_bandwidth( case TLV_PORT_MODE_2x1_2x1: /* mode 5 */ bandwidth = (2 * single_lane) + (2 * single_lane); break; + case TLV_PORT_MODE_4x1_4x1: /* mode 26 */ + bandwidth = (4 * single_lane) + (4 * single_lane); + break; case TLV_PORT_MODE_1x2_1x2: /* mode 12 */ bandwidth = dual_lane + dual_lane; break; @@ -1952,6 +1955,23 @@ static struct ef10_external_port_map_s { (1U << TLV_PORT_MODE_4x1_NA), /* mode 4 */ { 0, EFX_EXT_PORT_NA, EFX_EXT_PORT_NA, EFX_EXT_PORT_NA } }, + /* +* Modes that on Medford4 allocate up to 4 adjacent port numbers +* to cage 1 and 4 port numbers to cage 2. +* port 0 -> cage 1 +* port 1 -> cage 1 +* port 2 -> cage 1 +* port 3 -> cage 1 +* port 4 -> cage 2 +* port 5 -> cage 2 +* port 6 -> cage 2 +* port 7 -> cage 2 +*/ + { + EFX_FAMILY_MEDFORD4, + (1U << TLV_PORT_MODE_4x1_4x1), /* mode 26 */ + { 0, 4, EFX_EXT_PORT_NA, EFX_EXT_PORT_NA } + }, /* FIXME: review Medford4 port modes */ }; diff --git a/drivers/common/sfc_efx/base/ef10_tlv_layout.h b/drivers/common/sfc_efx/base/ef10_tlv_layout.h index 9ac50f1df6..712a1c7d26 100644 --- a/drivers/common/sfc_efx/base/ef10_tlv_layout.h +++ b/drivers/common/sfc_efx/base/ef10_tlv_layout.h @@ -7,7 +7,7 @@ /* * This is NOT the original source file. Do NOT edit it. * To update the tlv layout, please edit the copy in - * the sfregistry repo and then, in that repo, + * the smartnic_registry repo and then, in that repo, * "make tlv_headers" or "make export" to * regenerate and export all types of headers. */ @@ -635,7 +635,10 @@ struct tlv_global_port_mode { #define TLV_PORT_MODE_1x1_NA_LL (23) /* Single 10G/25G on mdi0, low-latency PCS */ #define TLV_PORT_MODE_1x1_1x1_LL (24) /* Single 10G/25G on mdi0, single 10G/25G on mdi1, low-latency PCS */ #define TLV_PORT_MODE_BUG63720_DO_NOT_USE(9) /* bug63720: Do not use */ -#define TLV_PORT_MODE_MAX TLV_PORT_MODE_1x1_1x1_LL + +/* X4 */ + +#define TLV_PORT_MODE_4x1_4x1(25) /* Quad 10G/25G on mdi0, quad 10G/25G on mdi1 */ /* Deprecated Medford aliases - DO NOT USE IN NEW CODE */ #define TLV_PORT_MODE_10G_10G_10G_10G_Q (5) @@ -643,7 +646,7 @@ struct tlv_global_port_mode { #define TLV_PORT_MODE_10G_10G_10G_10G_Q2 (8) #define TLV_PORT_MODE_10G_10G_10G_10G_Q1_Q2 (9) -#define TLV_PORT_MODE_MAX TLV_PORT_MODE_1x1_1x1_LL +#define TLV_PORT_MODE_MAX TLV_PORT_MODE_4x1_4x1 }; /* Type of the v-switch created implicitly by the firmware */ -- 2.39.5
[PATCH 18/46] common/sfc_efx/base: extend list of supported X4 port modes
From: Denis Pryazhennikov Add X4 port mode that allocates two 10G/25G/50G ports to separate cages. Signed-off-by: Denis Pryazhennikov Reviewed-by: Andy Moreton Reviewed-by: Richard Houldsworth Reviewed-by: Ivan Malov --- drivers/common/sfc_efx/base/ef10_nic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/common/sfc_efx/base/ef10_nic.c b/drivers/common/sfc_efx/base/ef10_nic.c index e28978e4cc..e1e8de5396 100644 --- a/drivers/common/sfc_efx/base/ef10_nic.c +++ b/drivers/common/sfc_efx/base/ef10_nic.c @@ -1979,6 +1979,7 @@ static struct ef10_external_port_map_s { */ { EFX_FAMILY_MEDFORD4, + (1U << TLV_PORT_MODE_1x1_1x1) | /* mode 2 */ (1U << TLV_PORT_MODE_1x4_1x4), /* mode 3 */ { 0, 1, EFX_EXT_PORT_NA, EFX_EXT_PORT_NA } }, -- 2.39.5
[PATCH 17/46] common/sfc_efx/base: add new X4 port mode
From: Denis Pryazhennikov Add handling for the port mode in the Medford4 driver logic, enabling support for two single network ports. Signed-off-by: Denis Pryazhennikov Reviewed-by: Andy Moreton Reviewed-by: Richard Houldsworth Reviewed-by: Ivan Malov --- .mailmap | 2 +- drivers/common/sfc_efx/base/ef10_nic.c | 10 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index afebbb32e6..1fbad1e1ae 100644 --- a/.mailmap +++ b/.mailmap @@ -1295,7 +1295,7 @@ Ricardo Salveti Richael Zhuang Richard Donkin Richard Eklycke -Richard Houldsworth +Richard Houldsworth Richard Walsh Rich Lane Ricky Li diff --git a/drivers/common/sfc_efx/base/ef10_nic.c b/drivers/common/sfc_efx/base/ef10_nic.c index 0e00ff64d4..e28978e4cc 100644 --- a/drivers/common/sfc_efx/base/ef10_nic.c +++ b/drivers/common/sfc_efx/base/ef10_nic.c @@ -1972,6 +1972,16 @@ static struct ef10_external_port_map_s { (1U << TLV_PORT_MODE_4x1_4x1), /* mode 26 */ { 0, 4, EFX_EXT_PORT_NA, EFX_EXT_PORT_NA } }, + /* +* Modes that on Medford4 allocate each port number to a separate cage. +* port 0 -> cage 1 +* port 1 -> cage 2 +*/ + { + EFX_FAMILY_MEDFORD4, + (1U << TLV_PORT_MODE_1x4_1x4), /* mode 3 */ + { 0, 1, EFX_EXT_PORT_NA, EFX_EXT_PORT_NA } + }, /* FIXME: review Medford4 port modes */ }; -- 2.39.5
[PATCH 15/46] net/sfc: add Medford4 with only full feature datapath engine
From: Andy Moreton Add PCI IDs for Medford4 functions that only have the full feature datapath engine (no support for low latency datapath engine). Signed-off-by: Andy Moreton Reviewed-by: Ivan Malov --- drivers/net/sfc/sfc_ethdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 3e57c902df..05194918f9 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -3304,6 +3304,8 @@ static const struct rte_pci_id pci_id_sfc_efx_map[] = { { RTE_PCI_DEVICE(EFX_PCI_VENID_SFC, EFX_PCI_DEVID_MEDFORD2_VF) }, { RTE_PCI_DEVICE(EFX_PCI_VENID_SFC, EFX_PCI_DEVID_MEDFORD4) }, { RTE_PCI_DEVICE(EFX_PCI_VENID_SFC, EFX_PCI_DEVID_MEDFORD4_VF) }, + { RTE_PCI_DEVICE(EFX_PCI_VENID_SFC, EFX_PCI_DEVID_MEDFORD4_NO_LL) }, + { RTE_PCI_DEVICE(EFX_PCI_VENID_SFC, EFX_PCI_DEVID_MEDFORD4_NO_LL_VF) }, { RTE_PCI_DEVICE(EFX_PCI_VENID_XILINX, EFX_PCI_DEVID_RIVERHEAD) }, { RTE_PCI_DEVICE(EFX_PCI_VENID_XILINX, EFX_PCI_DEVID_RIVERHEAD_VF) }, { .vendor_id = 0 /* sentinel */ } -- 2.39.5
[PATCH 25/46] common/sfc_efx/base: decode netport link state on probe path
Retrieved properties form the advertised PHY capability mask. The new code also helps to check support for autonegotiation. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/efx_impl.h | 12 + drivers/common/sfc_efx/base/efx_np.c | 67 ++ 2 files changed, 79 insertions(+) diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index 4952f45121..a3e60fd19b 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -1899,6 +1899,18 @@ extern void efx_np_detach( __inefx_nic_t *enp); +typedef struct efx_np_link_state_s { + uint32_tenls_adv_cap_mask; + boolean_t enls_an_supported; +} efx_np_link_state_t; + +LIBEFX_INTERNAL +extern __checkReturn efx_rc_t +efx_np_link_state( + __inefx_nic_t *enp, + __inefx_np_handle_t nph, + __out efx_np_link_state_t *lsp); + #ifdef __cplusplus } #endif diff --git a/drivers/common/sfc_efx/base/efx_np.c b/drivers/common/sfc_efx/base/efx_np.c index 6a36abf5c9..4d69e620d9 100644 --- a/drivers/common/sfc_efx/base/efx_np.c +++ b/drivers/common/sfc_efx/base/efx_np.c @@ -273,6 +273,61 @@ efx_np_get_fixed_port_props( fail2: EFSYS_PROBE(fail2); +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + return (rc); +} + + __checkReturn efx_rc_t +efx_np_link_state( + __inefx_nic_t *enp, + __inefx_np_handle_t nph, + __out efx_np_link_state_t *lsp) +{ + EFX_MCDI_DECLARE_BUF(payload, + MC_CMD_LINK_STATE_IN_LEN, + MC_CMD_LINK_STATE_OUT_V3_LEN); + efx_mcdi_req_t req; + efx_rc_t rc; + + req.emr_out_length = MC_CMD_LINK_STATE_OUT_V3_LEN; + req.emr_in_length = MC_CMD_LINK_STATE_IN_LEN; + req.emr_cmd = MC_CMD_LINK_STATE; + req.emr_out_buf = payload; + req.emr_in_buf = payload; + + MCDI_IN_SET_DWORD(req, LINK_STATE_IN_PORT_HANDLE, nph); + + efx_mcdi_execute(enp, &req); + + if (req.emr_rc != 0) { + rc = req.emr_rc; + goto fail1; + } + + if (req.emr_out_length_used < MC_CMD_LINK_STATE_OUT_V3_LEN) { + rc = EMSGSIZE; + goto fail2; + } + + memset(lsp, 0, sizeof (*lsp)); + + if (MCDI_OUT_DWORD(req, LINK_STATE_OUT_V2_LOCAL_AN_SUPPORT) != + MC_CMD_AN_NONE) + lsp->enls_an_supported = B_TRUE; + + if (lsp->enls_an_supported != B_FALSE) + lsp->enls_adv_cap_mask |= 1U << EFX_PHY_CAP_AN; + + efx_np_cap_hw_data_to_sw_mask( + MCDI_OUT2(req, const uint8_t, LINK_STATE_OUT_ADVERTISED_ABILITIES), + &lsp->enls_adv_cap_mask); + + return (0); + +fail2: + EFSYS_PROBE(fail2); + fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); return (rc); @@ -284,6 +339,7 @@ efx_np_attach( { efx_nic_cfg_t *encp = &(enp->en_nic_cfg); efx_port_t *epp = &(enp->en_port); + efx_np_link_state_t ls; efx_rc_t rc; if (efx_np_supported(enp) == B_FALSE) @@ -315,8 +371,19 @@ efx_np_attach( if (rc != 0) goto fail2; + rc = efx_np_link_state(enp, epp->ep_np_handle, &ls); + if (rc != 0) + goto fail3; + + if (ls.enls_an_supported != B_FALSE) + epp->ep_phy_cap_mask |= 1U << EFX_PHY_CAP_AN; + + epp->ep_adv_cap_mask = ls.enls_adv_cap_mask; return (0); +fail3: + EFSYS_PROBE(fail3); + fail2: EFSYS_PROBE(fail2); -- 2.39.5
[PATCH 26/46] common/sfc_efx/base: fill in loopback modes on netport probe
Indicate support for some of the loopback modes known to EFX. Such have been technology-dependent, but, on netport capable NICs, they are backed by new generic modes, that are tied to the stages in the processing chain where loopback can happen. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/efx.h | 1 + drivers/common/sfc_efx/base/efx_impl.h | 2 + drivers/common/sfc_efx/base/efx_np.c | 159 - 3 files changed, 160 insertions(+), 2 deletions(-) diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index 2c6af5f6b5..7ffa1f4cbd 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -655,6 +655,7 @@ typedef enum efx_link_mode_e { EFX_LINK_25000FDX, EFX_LINK_5FDX, EFX_LINK_10FDX, + EFX_LINK_20FDX, EFX_LINK_NMODES } efx_link_mode_t; diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index a3e60fd19b..3a9c6fe3fd 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -382,6 +382,8 @@ typedef struct efx_port_s { const efx_phy_ops_t *ep_epop; efx_np_handle_t ep_np_handle; + efx_qword_t ep_np_loopback_cap_mask; + uint8_t ep_np_cap_data_raw[MC_CMD_ETH_AN_FIELDS_LEN]; } efx_port_t; typedef struct efx_mon_ops_s { diff --git a/drivers/common/sfc_efx/base/efx_np.c b/drivers/common/sfc_efx/base/efx_np.c index 4d69e620d9..2e4cdcf863 100644 --- a/drivers/common/sfc_efx/base/efx_np.c +++ b/drivers/common/sfc_efx/base/efx_np.c @@ -232,7 +232,9 @@ static __checkReturn efx_rc_t efx_np_get_fixed_port_props( __inefx_nic_t *enp, __inefx_np_handle_t nph, - __out_opt uint32_t *sup_cap_maskp) + __out_opt uint8_t *sup_cap_rawp, + __out_opt uint32_t *sup_cap_maskp, + __out_opt efx_qword_t *loopback_cap_maskp) { EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_FIXED_PORT_PROPERTIES_IN_LEN, @@ -268,6 +270,18 @@ efx_np_get_fixed_port_props( if (sup_cap_maskp != NULL) efx_np_cap_hw_data_to_sw_mask(cap_data, sup_cap_maskp); + if (sup_cap_rawp != NULL) { + memcpy(sup_cap_rawp, + MCDI_OUT2(req, const uint8_t, + GET_FIXED_PORT_PROPERTIES_OUT_ABILITIES), + MC_CMD_GET_FIXED_PORT_PROPERTIES_OUT_ABILITIES_LEN); + } + + if (loopback_cap_maskp != NULL) { + *loopback_cap_maskp = *MCDI_OUT2(req, efx_qword_t, + GET_FIXED_PORT_PROPERTIES_OUT_V2_LOOPBACK_MODES_MASK_V2); + } + return (0); fail2: @@ -333,6 +347,141 @@ efx_np_link_state( return (rc); } +#if EFSYS_OPT_LOOPBACK +static __checkReturn efx_rc_t +efx_np_sw_link_mode_to_cap( + __inefx_link_mode_t link_mode, + __out uint16_t *capp) +{ + switch (link_mode) { + case EFX_LINK_1000FDX: + *capp = EFX_PHY_CAP_1000FDX; + break; + case EFX_LINK_1FDX: + *capp = EFX_PHY_CAP_1FDX; + break; + case EFX_LINK_4FDX: + *capp = EFX_PHY_CAP_4FDX; + break; + case EFX_LINK_25000FDX: + *capp = EFX_PHY_CAP_25000FDX; + break; + case EFX_LINK_5FDX: + *capp = EFX_PHY_CAP_5FDX; + break; + case EFX_LINK_10FDX: + *capp = EFX_PHY_CAP_10FDX; + break; + case EFX_LINK_20FDX: + *capp = EFX_PHY_CAP_20FDX; + break; + default: + return (EINVAL); + } + + return (0); +} + +static void +efx_np_cap_enum_sw_to_hw( + __in_ecount(hw_sw_map_nentries) const struct efx_np_cap_map *hw_sw_map, + __inunsigned int hw_sw_map_nentries, + __in_bcount(hw_cap_data_nbytes) const uint8_t *hw_cap_data, + __insize_t hw_cap_data_nbytes, + __inuint16_t enum_sw, + __out boolean_t *supportedp, + __out_opt uint16_t *enum_hwp) +{ + FOREACH_SUP_CAP(hw_sw_map, hw_sw_map_nentries, + hw_cap_data, hw_cap_data_nbytes) { + if (hw_sw_map->encm_sw != enum_sw) + continue; + + if (enum_hwp != NULL) + *enum_hwp = hw_sw_map->encm_hw; + + *supportedp = B_TRUE; + return; + } + + *supportedp = B_FALSE; +} + +/* + * Convert the given EFX PHY capability enu
[PATCH 28/46] common/sfc_efx/base: refactor EF10 link mode decoding helper
Future patches will use this change for netport MCDI support. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/ef10_impl.h | 13 +++ drivers/common/sfc_efx/base/ef10_phy.c | 31 ++--- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/drivers/common/sfc_efx/base/ef10_impl.h b/drivers/common/sfc_efx/base/ef10_impl.h index 3476f274ce..b872ec626c 100644 --- a/drivers/common/sfc_efx/base/ef10_impl.h +++ b/drivers/common/sfc_efx/base/ef10_impl.h @@ -801,6 +801,19 @@ ef10_phy_stats_update( #endif /* EFSYS_OPT_PHY_STATS */ +LIBEFX_INTERNAL +extern void +mcdi_phy_decode_link_mode( + __inefx_nic_t *enp, + __inboolean_t fd, + __inboolean_t up, + __inunsigned int speed, + __inunsigned int fcntl, + __inuint32_t fec, + __out efx_link_mode_t *link_modep, + __out unsigned int *fcntlp, + __out efx_phy_fec_type_t *fecp); + #if EFSYS_OPT_BIST LIBEFX_INTERNAL diff --git a/drivers/common/sfc_efx/base/ef10_phy.c b/drivers/common/sfc_efx/base/ef10_phy.c index 49babdecd5..d458199c7a 100644 --- a/drivers/common/sfc_efx/base/ef10_phy.c +++ b/drivers/common/sfc_efx/base/ef10_phy.c @@ -92,10 +92,21 @@ mcdi_phy_decode_cap( *maskp = mask; } -static void +static void +mcdi_phy_decode_link_up_duplex( + __inuint32_t link_flags, + __out boolean_t *fdp, + __out boolean_t *upp) +{ + *fdp = !!(link_flags & (1U << MC_CMD_GET_LINK_OUT_FULL_DUPLEX_LBN)); + *upp = !!(link_flags & (1U << MC_CMD_GET_LINK_OUT_LINK_UP_LBN)); +} + + void mcdi_phy_decode_link_mode( __inefx_nic_t *enp, - __inuint32_t link_flags, + __inboolean_t fd, + __inboolean_t up, __inunsigned int speed, __inunsigned int fcntl, __inuint32_t fec, @@ -103,11 +114,6 @@ mcdi_phy_decode_link_mode( __out unsigned int *fcntlp, __out efx_phy_fec_type_t *fecp) { - boolean_t fd = !!(link_flags & - (1 << MC_CMD_GET_LINK_OUT_FULL_DUPLEX_LBN)); - boolean_t up = !!(link_flags & - (1 << MC_CMD_GET_LINK_OUT_LINK_UP_LBN)); - _NOTE(ARGUNUSED(enp)) if (!up) @@ -179,6 +185,8 @@ ef10_phy_link_ev( unsigned int ev_fcntl; unsigned int ev_speed; uint32_t lp_cap_mask; + boolean_t fd; + boolean_t up; if (ev_is_v2) { link_flags = (1 << MC_CMD_GET_LINK_OUT_FULL_DUPLEX_LBN); @@ -226,7 +234,8 @@ ef10_phy_link_ev( break; } - mcdi_phy_decode_link_mode(enp, link_flags, speed, ev_fcntl, + mcdi_phy_decode_link_up_duplex(link_flags, &fd, &up); + mcdi_phy_decode_link_mode(enp, fd, up, speed, ev_fcntl, MC_CMD_FEC_NONE, &link_mode, &fcntl, &fec); mcdi_phy_decode_cap(ev_lp_cap, &lp_cap_mask); @@ -281,6 +290,8 @@ ef10_phy_get_link( uint32_t fec; EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_LINK_IN_LEN, MC_CMD_GET_LINK_OUT_V2_LEN); + boolean_t fd; + boolean_t up; efx_rc_t rc; req.emr_cmd = MC_CMD_GET_LINK; @@ -311,7 +322,9 @@ ef10_phy_get_link( else fec = MCDI_OUT_DWORD(req, GET_LINK_OUT_V2_FEC_TYPE); - mcdi_phy_decode_link_mode(enp, MCDI_OUT_DWORD(req, GET_LINK_OUT_FLAGS), + mcdi_phy_decode_link_up_duplex(MCDI_OUT_DWORD(req, GET_LINK_OUT_FLAGS), + &fd, &up); + mcdi_phy_decode_link_mode(enp, fd, up, MCDI_OUT_DWORD(req, GET_LINK_OUT_LINK_SPEED), MCDI_OUT_DWORD(req, GET_LINK_OUT_FCNTL), fec, &elsp->epls.epls_link_mode, -- 2.39.5
[PATCH 29/46] common/sfc_efx/base: provide PHY link get method on Medford4
To do so, make use of new netport MCDI supported by Medford4. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/ef10_phy.c | 8 ++ drivers/common/sfc_efx/base/efx.h | 4 +- drivers/common/sfc_efx/base/efx_impl.h | 19 drivers/common/sfc_efx/base/efx_np.c| 98 - drivers/common/sfc_efx/base/efx_phy.c | 2 +- drivers/common/sfc_efx/base/medford4_impl.h | 12 +++ drivers/common/sfc_efx/base/medford4_phy.c | 62 + 7 files changed, 202 insertions(+), 3 deletions(-) diff --git a/drivers/common/sfc_efx/base/ef10_phy.c b/drivers/common/sfc_efx/base/ef10_phy.c index d458199c7a..8c3de273b4 100644 --- a/drivers/common/sfc_efx/base/ef10_phy.c +++ b/drivers/common/sfc_efx/base/ef10_phy.c @@ -118,6 +118,8 @@ mcdi_phy_decode_link_mode( if (!up) *link_modep = EFX_LINK_DOWN; + else if (speed == 20 && fd) + *link_modep = EFX_LINK_20FDX; else if (speed == 10 && fd) *link_modep = EFX_LINK_10FDX; else if (speed == 5 && fd) @@ -160,6 +162,12 @@ mcdi_phy_decode_link_mode( case MC_CMD_FEC_RS: *fecp = EFX_PHY_FEC_RS; break; + case MC_CMD_FEC_IEEE_RS_INT: + *fecp = EFX_PHY_FEC_IEEE_RS_INT; + break; + case MC_CMD_FEC_ETCS_RS_LL: + *fecp = EFX_PHY_FEC_ETCS_RS_LL; + break; default: EFSYS_PROBE1(mc_pcol_error, int, fec); *fecp = EFX_PHY_FEC_NONE; diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index 7ffa1f4cbd..6ca108cffe 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -4010,7 +4010,9 @@ efx_nic_set_fw_subvariant( typedef enum efx_phy_fec_type_e { EFX_PHY_FEC_NONE = 0, EFX_PHY_FEC_BASER, - EFX_PHY_FEC_RS + EFX_PHY_FEC_RS, + EFX_PHY_FEC_IEEE_RS_INT, + EFX_PHY_FEC_ETCS_RS_LL, } efx_phy_fec_type_t; #define EFX_PHY_CAP_FEC_BIT(_fec_bit) (1U << EFX_PHY_CAP_##_fec_bit) diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index 16b7f7640d..63ff112194 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -1907,7 +1907,14 @@ efx_np_detach( typedef struct efx_np_link_state_s { uint32_tenls_adv_cap_mask; + uint32_tenls_lp_cap_mask; + efx_loopback_type_t enls_loopback; + uint32_tenls_speed; + uint8_t enls_fec; + boolean_t enls_an_supported; + boolean_t enls_fd; + boolean_t enls_up; } efx_np_link_state_t; LIBEFX_INTERNAL @@ -1917,6 +1924,18 @@ efx_np_link_state( __inefx_np_handle_t nph, __out efx_np_link_state_t *lsp); +typedef struct efx_np_mac_state_s { + uint32_tenms_fcntl; + boolean_t enms_up; +} efx_np_mac_state_t; + +LIBEFX_INTERNAL +extern __checkReturn efx_rc_t +efx_np_mac_state( + __inefx_nic_t *enp, + __inefx_np_handle_t nph, + __out efx_np_mac_state_t *msp); + #ifdef __cplusplus } #endif diff --git a/drivers/common/sfc_efx/base/efx_np.c b/drivers/common/sfc_efx/base/efx_np.c index 2e4cdcf863..1b67fd16aa 100644 --- a/drivers/common/sfc_efx/base/efx_np.c +++ b/drivers/common/sfc_efx/base/efx_np.c @@ -301,7 +301,9 @@ efx_np_link_state( EFX_MCDI_DECLARE_BUF(payload, MC_CMD_LINK_STATE_IN_LEN, MC_CMD_LINK_STATE_OUT_V3_LEN); + uint32_t status_flags; efx_mcdi_req_t req; + uint32_t v3_flags; efx_rc_t rc; req.emr_out_length = MC_CMD_LINK_STATE_OUT_V3_LEN; @@ -324,12 +326,44 @@ efx_np_link_state( goto fail2; } + status_flags = MCDI_OUT_DWORD(req, LINK_STATE_OUT_STATUS_FLAGS_LO); + v3_flags = MCDI_OUT_DWORD(req, LINK_STATE_OUT_V3_FLAGS); memset(lsp, 0, sizeof (*lsp)); - if (MCDI_OUT_DWORD(req, LINK_STATE_OUT_V2_LOCAL_AN_SUPPORT) != + if (status_flags & (1U << MC_CMD_LINK_STATUS_FLAGS_AN_ABLE) && + MCDI_OUT_DWORD(req, LINK_STATE_OUT_V2_LOCAL_AN_SUPPORT) != MC_CMD_AN_NONE) lsp->enls_an_supported = B_TRUE; + if (v3_flags & (1U << MC_CMD_LINK_STATE_OUT_V3_FULL_DUPLEX_LBN)) + lsp->enls_fd = B_TRUE; + + if (status_flags & (1U << MC_CMD_LINK_STATUS_FLAGS_LINK_UP)) + lsp->enls_up = B_TRUE; + + lsp->enls_speed = MCDI_OUT_DWORD(req, LINK_STATE_OUT_V3_LINK_SPEED); + lsp->enls_fec = MCDI_OUT_BYTE(req, LINK_STATE_OUT_FEC_MODE); + +#if EFSYS_OPT_LOOPBACK + /* FIXME: correct this if need be and augment with more modes. */ + switch (MCDI_OUT_BYTE(req,
[PATCH 24/46] common/sfc_efx/base: get netport fixed capabilities on probe
These make the basic subset of PHY capabilities known to EFX Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/efx.h| 21 ++- drivers/common/sfc_efx/base/efx_np.c | 209 +++ 2 files changed, 224 insertions(+), 6 deletions(-) diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index a9ed3f423f..2c6af5f6b5 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -1212,6 +1212,11 @@ typedef enum efx_phy_cap_type_e { EFX_PHY_CAP_RS_FEC_REQUESTED, EFX_PHY_CAP_25G_BASER_FEC, EFX_PHY_CAP_25G_BASER_FEC_REQUESTED, + EFX_PHY_CAP_20FDX, + EFX_PHY_CAP_IEEE_RS_INT_FEC, + EFX_PHY_CAP_IEEE_RS_INT_FEC_REQUESTED, + EFX_PHY_CAP_ETCS_RS_LL_FEC, + EFX_PHY_CAP_ETCS_RS_LL_FEC_REQUESTED, EFX_PHY_CAP_NTYPES } efx_phy_cap_type_t; @@ -4009,12 +4014,16 @@ typedef enum efx_phy_fec_type_e { #define EFX_PHY_CAP_FEC_BIT(_fec_bit) (1U << EFX_PHY_CAP_##_fec_bit) #define EFX_PHY_CAP_FEC_MASK \ - (EFX_PHY_CAP_FEC_BIT(BASER_FEC) | \ -EFX_PHY_CAP_FEC_BIT(25G_BASER_FEC) | \ -EFX_PHY_CAP_FEC_BIT(BASER_FEC_REQUESTED) | \ -EFX_PHY_CAP_FEC_BIT(25G_BASER_FEC_REQUESTED) | \ -EFX_PHY_CAP_FEC_BIT(RS_FEC) | \ -EFX_PHY_CAP_FEC_BIT(RS_FEC_REQUESTED)) + (EFX_PHY_CAP_FEC_BIT(BASER_FEC) | \ +EFX_PHY_CAP_FEC_BIT(25G_BASER_FEC) | \ +EFX_PHY_CAP_FEC_BIT(BASER_FEC_REQUESTED) | \ +EFX_PHY_CAP_FEC_BIT(25G_BASER_FEC_REQUESTED) | \ +EFX_PHY_CAP_FEC_BIT(RS_FEC) | \ +EFX_PHY_CAP_FEC_BIT(RS_FEC_REQUESTED) |\ +EFX_PHY_CAP_FEC_BIT(IEEE_RS_INT_FEC) | \ +EFX_PHY_CAP_FEC_BIT(IEEE_RS_INT_FEC_REQUESTED) | \ +EFX_PHY_CAP_FEC_BIT(ETCS_RS_LL_FEC) | \ +EFX_PHY_CAP_FEC_BIT(ETCS_RS_LL_FEC_REQUESTED)) LIBEFX_API extern __checkReturn efx_rc_t diff --git a/drivers/common/sfc_efx/base/efx_np.c b/drivers/common/sfc_efx/base/efx_np.c index ec6a432623..6a36abf5c9 100644 --- a/drivers/common/sfc_efx/base/efx_np.c +++ b/drivers/common/sfc_efx/base/efx_np.c @@ -76,6 +76,203 @@ efx_np_get_assigned_handle( fail2: EFSYS_PROBE(fail2); +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + return (rc); +} + +struct efx_np_cap_map { + uint16_tencm_hw; + uint16_tencm_sw; +}; + +static const struct efx_np_cap_map efx_np_cap_map_tech[] = { + /* 1G */ + { MC_CMD_ETH_TECH_1000BASEKX, EFX_PHY_CAP_1000FDX }, + { MC_CMD_ETH_TECH_1000BASEX, EFX_PHY_CAP_1000FDX }, + + /* 10G */ + { MC_CMD_ETH_TECH_10GBASE_KR, EFX_PHY_CAP_1FDX }, + { MC_CMD_ETH_TECH_10GBASE_CR, EFX_PHY_CAP_1FDX }, + { MC_CMD_ETH_TECH_10GBASE_SR, EFX_PHY_CAP_1FDX }, + { MC_CMD_ETH_TECH_10GBASE_LR, EFX_PHY_CAP_1FDX }, + { MC_CMD_ETH_TECH_10GBASE_LRM, EFX_PHY_CAP_1FDX }, + { MC_CMD_ETH_TECH_10GBASE_ER, EFX_PHY_CAP_1FDX }, + + /* 25GBASE */ + { MC_CMD_ETH_TECH_25GBASE_CR, EFX_PHY_CAP_25000FDX }, + { MC_CMD_ETH_TECH_25GBASE_KR, EFX_PHY_CAP_25000FDX }, + { MC_CMD_ETH_TECH_25GBASE_SR, EFX_PHY_CAP_25000FDX }, + { MC_CMD_ETH_TECH_25GBASE_LR_ER, EFX_PHY_CAP_25000FDX }, + + /* 40G */ + { MC_CMD_ETH_TECH_40GBASE_KR4, EFX_PHY_CAP_4FDX }, + { MC_CMD_ETH_TECH_40GBASE_CR4, EFX_PHY_CAP_4FDX }, + { MC_CMD_ETH_TECH_40GBASE_SR4, EFX_PHY_CAP_4FDX }, + { MC_CMD_ETH_TECH_40GBASE_LR4, EFX_PHY_CAP_4FDX }, + + /* 50G */ + { MC_CMD_ETH_TECH_50GBASE_CR2, EFX_PHY_CAP_5FDX }, + { MC_CMD_ETH_TECH_50GBASE_KR2, EFX_PHY_CAP_5FDX }, + { MC_CMD_ETH_TECH_50GBASE_SR2, EFX_PHY_CAP_5FDX }, + { MC_CMD_ETH_TECH_50GBASE_KR, EFX_PHY_CAP_5FDX }, + { MC_CMD_ETH_TECH_50GBASE_SR, EFX_PHY_CAP_5FDX }, + { MC_CMD_ETH_TECH_50GBASE_CR, EFX_PHY_CAP_5FDX }, + { MC_CMD_ETH_TECH_50GBASE_LR_ER_FR, EFX_PHY_CAP_5FDX }, + { MC_CMD_ETH_TECH_50GBASE_DR, EFX_PHY_CAP_5FDX }, + + /* 100G */ + { MC_CMD_ETH_TECH_100GBASE_KR4, EFX_PHY_CAP_10FDX }, + { MC_CMD_ETH_TECH_100GBASE_SR4, EFX_PHY_CAP_10FDX }, + { MC_CMD_ETH_TECH_100GBASE_CR4, EFX_PHY_CAP_10FDX }, + { MC_CMD_ETH_TECH_100GBASE_LR4_ER4, EFX_PHY_CAP_10FDX }, + { MC_CMD_ETH_TECH_100GBASE_KR2, EFX_PHY_CAP_10FDX }, + { MC_CMD_ETH_TECH_100GBASE_SR2, EFX_PHY_CAP_10FDX }, + { MC_CMD_ETH_TECH_100GBASE_CR2, EFX_PHY_CAP_10FDX }, + { MC_CMD_ETH_TECH_100GBASE_LR2_ER2_FR2, EFX_PHY_CAP_10FDX }, + { MC_CMD_ETH_TECH_100GBASE_DR2, EFX_PHY_CAP_10FDX }, + { MC_CMD_ETH_TECH_100GBASE_KR, EFX_PHY_CAP_10FDX }, + { MC_CMD_ETH_TECH_1
[PATCH 22/46] common/sfc_efx/base: obtain assigned netport handle from NIC
Get an 'assigned' netport handle for the current MCDI entity. This handle will be used when sending other netport commands. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/efx_impl.h | 4 +++ drivers/common/sfc_efx/base/efx_np.c | 50 ++ 2 files changed, 54 insertions(+) diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index 9ad973ded7..4952f45121 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -335,6 +335,8 @@ typedef struct efx_virtio_ops_s { } efx_virtio_ops_t; #endif /* EFSYS_OPT_VIRTIO */ +typedef uint32_t efx_np_handle_t; + typedef struct efx_port_s { efx_mac_type_t ep_mac_type; uint32_tep_phy_type; @@ -378,6 +380,8 @@ typedef struct efx_port_s { #endif const efx_mac_ops_t *ep_emop; const efx_phy_ops_t *ep_epop; + + efx_np_handle_t ep_np_handle; } efx_port_t; typedef struct efx_mon_ops_s { diff --git a/drivers/common/sfc_efx/base/efx_np.c b/drivers/common/sfc_efx/base/efx_np.c index 3200bc0a90..ec6a432623 100644 --- a/drivers/common/sfc_efx/base/efx_np.c +++ b/drivers/common/sfc_efx/base/efx_np.c @@ -41,12 +41,53 @@ efx_np_assign_legacy_props( encp->enc_port = 0; } +static __checkReturn efx_rc_t +efx_np_get_assigned_handle( + __inefx_nic_t *enp, + __out efx_np_handle_t *nphp) +{ + EFX_MCDI_DECLARE_BUF(payload, + MC_CMD_GET_ASSIGNED_PORT_HANDLE_IN_LEN, + MC_CMD_GET_ASSIGNED_PORT_HANDLE_OUT_LEN); + efx_mcdi_req_t req; + efx_rc_t rc; + + req.emr_out_length = MC_CMD_GET_ASSIGNED_PORT_HANDLE_OUT_LEN; + req.emr_in_length = MC_CMD_GET_ASSIGNED_PORT_HANDLE_IN_LEN; + req.emr_cmd = MC_CMD_GET_ASSIGNED_PORT_HANDLE; + req.emr_out_buf = payload; + req.emr_in_buf = payload; + + efx_mcdi_execute(enp, &req); + + if (req.emr_rc != 0) { + rc = req.emr_rc; + goto fail1; + } + + if (req.emr_out_length_used < MC_CMD_GET_ASSIGNED_PORT_HANDLE_OUT_LEN) { + rc = EMSGSIZE; + goto fail2; + } + + *nphp = MCDI_OUT_DWORD(req, GET_ASSIGNED_PORT_HANDLE_OUT_PORT_HANDLE); + return (0); + +fail2: + EFSYS_PROBE(fail2); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + return (rc); +} + __checkReturn efx_rc_t efx_np_attach( __inefx_nic_t *enp) { efx_nic_cfg_t *encp = &(enp->en_nic_cfg); efx_port_t *epp = &(enp->en_port); + efx_rc_t rc; if (efx_np_supported(enp) == B_FALSE) return (0); @@ -63,7 +104,16 @@ efx_np_attach( epp->ep_fixed_port_type = EFX_PHY_MEDIA_INVALID; epp->ep_module_type = EFX_PHY_MEDIA_INVALID; + + rc = efx_np_get_assigned_handle(enp, &epp->ep_np_handle); + if (rc != 0) + goto fail1; + return (0); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + return (rc); } void -- 2.39.5
[PATCH 27/46] common/sfc_efx/base: introduce Medford4 stub for PHY methods
Provide only a couple of no-op methods for now. Next patches will augment the file with more, based on newer netport MCDI. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/efx_impl.h | 4 +++ drivers/common/sfc_efx/base/efx_phy.c | 22 +++- drivers/common/sfc_efx/base/medford4_impl.h | 29 + drivers/common/sfc_efx/base/medford4_phy.c | 28 drivers/common/sfc_efx/base/meson.build | 1 + 5 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 drivers/common/sfc_efx/base/medford4_impl.h create mode 100644 drivers/common/sfc_efx/base/medford4_phy.c diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index 3a9c6fe3fd..16b7f7640d 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -45,6 +45,10 @@ #include "rhead_impl.h" #endif /* EFSYS_OPT_RIVERHEAD */ +#if EFSYS_OPT_MEDFORD4 +#include "medford4_impl.h" +#endif /* EFSYS_OPT_MEDFORD4 */ + #ifdef __cplusplus extern "C" { #endif diff --git a/drivers/common/sfc_efx/base/efx_phy.c b/drivers/common/sfc_efx/base/efx_phy.c index 3d792f20b8..537865767a 100644 --- a/drivers/common/sfc_efx/base/efx_phy.c +++ b/drivers/common/sfc_efx/base/efx_phy.c @@ -68,6 +68,26 @@ static const efx_phy_ops_t __efx_phy_rhead_ops = { }; #endif /* EFSYS_OPT_RIVERHEAD */ +#if EFSYS_OPT_MEDFORD4 +static const efx_phy_ops_t __efx_phy_medford4_ops = { + medford4_phy_power, /* epo_power */ + NULL, /* epo_reset */ + ef10_phy_reconfigure, /* epo_reconfigure */ + medford4_phy_verify,/* epo_verify */ + ef10_phy_oui_get, /* epo_oui_get */ + ef10_phy_link_state_get,/* epo_link_state_get */ +#if EFSYS_OPT_PHY_STATS + ef10_phy_stats_update, /* epo_stats_update */ +#endif /* EFSYS_OPT_PHY_STATS */ +#if EFSYS_OPT_BIST + ef10_bist_enable_offline, /* epo_bist_enable_offline */ + ef10_bist_start,/* epo_bist_start */ + ef10_bist_poll, /* epo_bist_poll */ + ef10_bist_stop, /* epo_bist_stop */ +#endif /* EFSYS_OPT_BIST */ +}; +#endif /* EFSYS_OPT_MEDFORD4 */ + __checkReturn efx_rc_t efx_phy_probe( __inefx_nic_t *enp) @@ -116,7 +136,7 @@ efx_phy_probe( #if EFSYS_OPT_MEDFORD4 case EFX_FAMILY_MEDFORD4: - epop = &__efx_phy_ef10_ops; + epop = &__efx_phy_medford4_ops; break; #endif /* EFSYS_OPT_MEDFORD4 */ diff --git a/drivers/common/sfc_efx/base/medford4_impl.h b/drivers/common/sfc_efx/base/medford4_impl.h new file mode 100644 index 00..ec8b3cec86 --- /dev/null +++ b/drivers/common/sfc_efx/base/medford4_impl.h @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * + * Copyright(c) 2025 Advanced Micro Devices, Inc. + */ +#ifndef_SYS_MEDFORD4_IMPL_H +#define_SYS_MEDFORD4_IMPL_H + +#include "efx.h" + +#ifdef __cplusplus +extern "C" { +#endif + +LIBEFX_INTERNAL +extern __checkReturn efx_rc_t +medford4_phy_power( + __inefx_nic_t *enp, + __inboolean_t power); + +LIBEFX_INTERNAL +extern __checkReturn efx_rc_t +medford4_phy_verify( + __inefx_nic_t *enp); + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_MEDFORD4_IMPL_H */ diff --git a/drivers/common/sfc_efx/base/medford4_phy.c b/drivers/common/sfc_efx/base/medford4_phy.c new file mode 100644 index 00..3e6080b4de --- /dev/null +++ b/drivers/common/sfc_efx/base/medford4_phy.c @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * + * Copyright(c) 2025 Advanced Micro Devices, Inc. + */ +#include "efx.h" +#include "efx_impl.h" +#include "medford4_impl.h" + +#if EFSYS_OPT_MEDFORD4 + __checkReturn efx_rc_t +medford4_phy_power( + __inefx_nic_t *enp, + __inboolean_t power) +{ + if (power) + enp->en_reset_flags |= EFX_RESET_PHY; + + return (0); +} + + __checkReturn efx_rc_t +medford4_phy_verify( + __inefx_nic_t *enp) +{ + _NOTE(ARGUNUSED(enp)) + return (0); +} +#endif /* EFSYS_OPT_MEDFORD4 */ diff --git a/drivers/common/sfc_efx/base/meson.build b/drivers/common/sfc_efx/base/meson.build index 02d5b2fbb9..937e3820a0 100644 --- a/drivers/common/sfc_efx/base/meson.build +++ b/drivers/common/sfc_efx/base/meson.build @@ -57,6 +57,7 @@ sources = [ 'hunt_nic.c', 'medford_nic.c', 'medford2_nic.c', +'medford4_phy.c', 'rhead_ev.c', 'rhead_intr.c', 'rhead_nic.c', -- 2.39.5
[PATCH 23/46] common/sfc_efx/base: allow for const in MCDI struct accessor
The existing code is fine, however, future patches will need to use this macro on buffers that are passed by callers with const qualifier. With 'cast-qual' enabled, this macro causes compile warnings in such cases. Rework it to allow for const. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/common/sfc_efx/base/efx_mcdi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/common/sfc_efx/base/efx_mcdi.h b/drivers/common/sfc_efx/base/efx_mcdi.h index f13bf43da6..4e82717015 100644 --- a/drivers/common/sfc_efx/base/efx_mcdi.h +++ b/drivers/common/sfc_efx/base/efx_mcdi.h @@ -536,7 +536,7 @@ efx_mcdi_set_nic_addr_regions( EFX_DWORD_1) << 32) #define MCDI_STRUCT_MEMBER(_buf, _type, _ofst) \ - ((_type *)((char *)_buf + _ofst ## _OFST)) \ + ((_type *)((char *)(uintptr_t)(_buf) + _ofst ## _OFST)) #define MCDI_STRUCT_BYTE(_buf, _ofst) \ EFX_BYTE_FIELD(*MCDI_STRUCT_MEMBER(_buf, efx_byte_t, _ofst),\ -- 2.39.5
Re: [PATCH 00/46] Support AMD Solarflare X45xx adaptors
On Wed, 16 Apr 2025 19:38:58 +0400 (+04) Ivan Malov wrote: > On Wed, 16 Apr 2025, Stephen Hemminger wrote: > > > On Wed, 16 Apr 2025 17:59:30 +0400 > > Ivan Malov wrote: > > > >> New X4522 (dual port SFP56) and X4542 (dual port QSFP56) adaptors are > >> Medford4 (X4) chips that are based on EF10 architecture. An X4 NIC > >> supports multiple network engine types. This series provides support > >> only for the Medford2-alike, 'full-feature' (FF) network engine. This > >> shall not be confused with the concept of 'datapath FW variants': the > >> FF network engine supports both 'full-feature' and 'ultra-low-latency' > >> datapath FW variants, with corresponding Medford2-alike feature sets. > >> > >> The first part of the series provides general support for the adaptors, > >> whilst the second one adds support for the new management controller > >> interface for configuration of network port features (netport MCDI). > >> > >> For now, only support for physical functions (PFs) is concerned. There > >> is a small number of TODO and FIXME markings in the code. Those are > >> normal at this development stage and will be removed by future patches > >> when VF support has fleshed out. > >> > >> > >> Andy Moreton (3): > >> common/sfc_efx/base: update X4 BAR layout and PCI IDs > >> net/sfc: add Medford4 with only full feature datapath engine > >> common/sfc_efx/base: add port mode for 8 port hardware > >> > >> Denis Pryazhennikov (15): > >> common/sfc_efx/base: add Medford4 PCI IDs to common code > >> common/sfc_efx/base: add efsys option for Medford4 > >> common/sfc_efx/base: add Medford4 support to NIC module > >> common/sfc_efx/base: add Medford4 support to EV module > >> common/sfc_efx/base: add Medford4 support to FILTER module > >> common/sfc_efx/base: add Medford4 support to INTR module > >> common/sfc_efx/base: add Medford4 support to MAC module > >> common/sfc_efx/base: add Medford4 support to PHY module > >> common/sfc_efx/base: add Medford4 support to TUNNEL module > >> common/sfc_efx/base: add Medford4 support to MCDI module > >> common/sfc_efx/base: add Medford4 support to Rx module > >> common/sfc_efx/base: add Medford4 support to Tx module > >> drivers: enable support for AMD Solarflare X4 adapter family > >> common/sfc_efx/base: add new X4 port mode > >> common/sfc_efx/base: extend list of supported X4 port modes > >> > >> Ivan Malov (28): > >> common/sfc_efx/base: update MCDI headers > >> common/sfc_efx/base: provide a stub for basic netport attach > >> common/sfc_efx/base: provide defaults on netport attach path > >> common/sfc_efx/base: obtain assigned netport handle from NIC > >> common/sfc_efx/base: allow for const in MCDI struct accessor > >> common/sfc_efx/base: get netport fixed capabilities on probe > >> common/sfc_efx/base: decode netport link state on probe path > >> common/sfc_efx/base: fill in loopback modes on netport probe > >> common/sfc_efx/base: introduce Medford4 stub for PHY methods > >> common/sfc_efx/base: refactor EF10 link mode decoding helper > >> common/sfc_efx/base: provide PHY link get method on Medford4 > >> common/sfc_efx/base: implement PHY link control for Medford4 > >> common/sfc_efx/base: introduce Medford4 stub for MAC methods > >> common/sfc_efx/base: add MAC reconfigure method for Medford4 > >> common/sfc_efx/base: fill in software LUT for MAC statistics > >> common/sfc_efx/base: fill in MAC statistics mask on Medford4 > >> common/sfc_efx/base: support MAC statistics on Medford4 NICs > >> common/sfc_efx/base: implement MAC PDU controls for Medford4 > >> common/sfc_efx/base: correct MAC PDU calculation on Medford4 > >> net/sfc: make use of generic EFX MAC PDU calculation helpers > >> common/sfc_efx/base: ignore legacy link events on new boards > >> common/sfc_efx/base: add link event processing on new boards > >> net/sfc: query link status on link change events on new NICs > >> common/sfc_efx/base: subscribe to netport link change events > >> net/sfc: offer support for 200G link ability on new adaptors > >> common/sfc_efx/base: support controls for netport lane count > >> net/sfc: add support for control of physical port lane count > >> doc: advertise support for AMD Solarflare X45xx adapters > >> > >> .mailmap |3 +- > >> doc/guides/nics/sfc_efx.rst |9 +- > >> doc/guides/rel_notes/release_25_07.rst|4 + > >> drivers/common/sfc_efx/base/ef10_ev.c | 39 + > >> drivers/common/sfc_efx/base/ef10_impl.h | 19 + > >> drivers/common/sfc_efx/base/ef10_nic.c| 98 +- > >> drivers/common/sfc_efx/base/ef10_phy.c| 43 +- > >> drivers/common/sfc_efx/base/ef10_tlv_layout.h |9 +- > >> drivers/common/sfc_efx/base/efx.h | 98 +- > >> drivers/common/sfc_efx/base/efx_check.h | 24 +- > >> drivers/common/sfc_efx/base/efx_ev.c |6 + > >> dr
Re: [PATCH v6 1/3] net/macb: add new poll mode driver
On Tue, 8 Apr 2025 06:20:01 + liwencheng wrote: > + > + dev_num = rte_kvargs_count(kvlist, MACB_DEVICE_NAME_ARG); > + > + /* compatibility support */ > + if (!strcmp(vdev_name, "net_macb")) { > + if (dev_num > MACB_MAX_PORT_NUM) { > + ret = -EINVAL; > + MACB_LOG(ERR, "number of devices exceeded. Maximum > value: %d.", > + MACB_MAX_PORT_NUM); > + goto out_free_kvlist; > + } > + } else { > + if (dev_num != 1) { > + ret = -EINVAL; > + MACB_LOG(ERR, "Error args: one vdev to one device."); > + goto out_free_kvlist; > + } > + } > + Since this is to first merged version of the driver, confused about what compatibility means in this context? Does the driver require devargs to work? Isn't it a hardware driver.
[PATCH 00/46] Support AMD Solarflare X45xx adaptors
New X4522 (dual port SFP56) and X4542 (dual port QSFP56) adaptors are Medford4 (X4) chips that are based on EF10 architecture. An X4 NIC supports multiple network engine types. This series provides support only for the Medford2-alike, 'full-feature' (FF) network engine. This shall not be confused with the concept of 'datapath FW variants': the FF network engine supports both 'full-feature' and 'ultra-low-latency' datapath FW variants, with corresponding Medford2-alike feature sets. The first part of the series provides general support for the adaptors, whilst the second one adds support for the new management controller interface for configuration of network port features (netport MCDI). For now, only support for physical functions (PFs) is concerned. There is a small number of TODO and FIXME markings in the code. Those are normal at this development stage and will be removed by future patches when VF support has fleshed out. Andy Moreton (3): common/sfc_efx/base: update X4 BAR layout and PCI IDs net/sfc: add Medford4 with only full feature datapath engine common/sfc_efx/base: add port mode for 8 port hardware Denis Pryazhennikov (15): common/sfc_efx/base: add Medford4 PCI IDs to common code common/sfc_efx/base: add efsys option for Medford4 common/sfc_efx/base: add Medford4 support to NIC module common/sfc_efx/base: add Medford4 support to EV module common/sfc_efx/base: add Medford4 support to FILTER module common/sfc_efx/base: add Medford4 support to INTR module common/sfc_efx/base: add Medford4 support to MAC module common/sfc_efx/base: add Medford4 support to PHY module common/sfc_efx/base: add Medford4 support to TUNNEL module common/sfc_efx/base: add Medford4 support to MCDI module common/sfc_efx/base: add Medford4 support to Rx module common/sfc_efx/base: add Medford4 support to Tx module drivers: enable support for AMD Solarflare X4 adapter family common/sfc_efx/base: add new X4 port mode common/sfc_efx/base: extend list of supported X4 port modes Ivan Malov (28): common/sfc_efx/base: update MCDI headers common/sfc_efx/base: provide a stub for basic netport attach common/sfc_efx/base: provide defaults on netport attach path common/sfc_efx/base: obtain assigned netport handle from NIC common/sfc_efx/base: allow for const in MCDI struct accessor common/sfc_efx/base: get netport fixed capabilities on probe common/sfc_efx/base: decode netport link state on probe path common/sfc_efx/base: fill in loopback modes on netport probe common/sfc_efx/base: introduce Medford4 stub for PHY methods common/sfc_efx/base: refactor EF10 link mode decoding helper common/sfc_efx/base: provide PHY link get method on Medford4 common/sfc_efx/base: implement PHY link control for Medford4 common/sfc_efx/base: introduce Medford4 stub for MAC methods common/sfc_efx/base: add MAC reconfigure method for Medford4 common/sfc_efx/base: fill in software LUT for MAC statistics common/sfc_efx/base: fill in MAC statistics mask on Medford4 common/sfc_efx/base: support MAC statistics on Medford4 NICs common/sfc_efx/base: implement MAC PDU controls for Medford4 common/sfc_efx/base: correct MAC PDU calculation on Medford4 net/sfc: make use of generic EFX MAC PDU calculation helpers common/sfc_efx/base: ignore legacy link events on new boards common/sfc_efx/base: add link event processing on new boards net/sfc: query link status on link change events on new NICs common/sfc_efx/base: subscribe to netport link change events net/sfc: offer support for 200G link ability on new adaptors common/sfc_efx/base: support controls for netport lane count net/sfc: add support for control of physical port lane count doc: advertise support for AMD Solarflare X45xx adapters .mailmap |3 +- doc/guides/nics/sfc_efx.rst |9 +- doc/guides/rel_notes/release_25_07.rst|4 + drivers/common/sfc_efx/base/ef10_ev.c | 39 + drivers/common/sfc_efx/base/ef10_impl.h | 19 + drivers/common/sfc_efx/base/ef10_nic.c| 98 +- drivers/common/sfc_efx/base/ef10_phy.c| 43 +- drivers/common/sfc_efx/base/ef10_tlv_layout.h |9 +- drivers/common/sfc_efx/base/efx.h | 98 +- drivers/common/sfc_efx/base/efx_check.h | 24 +- drivers/common/sfc_efx/base/efx_ev.c |6 + drivers/common/sfc_efx/base/efx_filter.c |6 + drivers/common/sfc_efx/base/efx_impl.h| 115 +- drivers/common/sfc_efx/base/efx_intr.c|6 + drivers/common/sfc_efx/base/efx_mac.c | 56 +- drivers/common/sfc_efx/base/efx_mcdi.c| 18 +- drivers/common/sfc_efx/base/efx_mcdi.h|2 +- drivers/common/sfc_efx/base/efx_nic.c | 60 + drivers/common/sfc_efx/base/efx_np.c | 1625 + drivers/common/sfc_efx/base/efx_phy.c | 88 +- drivers/common/sfc_efx/base/efx_port.c|1 + drivers/common/s
[PATCH 45/46] net/sfc: add support for control of physical port lane count
Since 24.11, DPDK has supported APIs to control lane count of the physical link. Provide driver-level support for that on adaptors that are netport MCDI capabale (Medford4, for instance). Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Pieter Jansen Van Vuuren --- drivers/net/sfc/sfc.h| 2 + drivers/net/sfc/sfc_ethdev.c | 147 +++ drivers/net/sfc/sfc_port.c | 19 + 3 files changed, 168 insertions(+) diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index 819ce52529..af32ccfaa3 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -67,6 +67,8 @@ struct sfc_dp_rx; struct sfc_port { unsigned intlsc_seq; + efx_phy_lane_count_tphy_lane_count_active; + efx_phy_lane_count_tphy_lane_count_req; uint32_tphy_adv_cap_mask; uint32_tphy_adv_cap; uint32_tfec_cfg; diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 80eb39e58d..b38fc79d62 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -291,6 +291,150 @@ sfc_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete) return ret; } +static int +sfc_dev_speed_lanes_get(struct rte_eth_dev *dev, uint32_t *lane_countp) +{ + struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); + struct sfc_port *port; + int rc = 0; + + if (lane_countp == NULL) + return -EINVAL; + + sfc_adapter_lock(sa); + port = &sa->port; + + if (sa->state != SFC_ETHDEV_STARTED) { + /* The API wants 'active' lanes, so it is safe to indicate 0. */ + *lane_countp = 0; + goto unlock; + } + + if (port->phy_lane_count_active == EFX_PHY_LANE_COUNT_DEFAULT) { + rc = ENOTSUP; + goto unlock; + } + + *lane_countp = port->phy_lane_count_active; + +unlock: + sfc_adapter_unlock(sa); + return -rc; +} + +static int +sfc_dev_speed_lanes_set(struct rte_eth_dev *dev, uint32_t lane_count) +{ + struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); + int rc = 0; + + sfc_adapter_lock(sa); + + if (sa->state == SFC_ETHDEV_STARTED) { + rc = EBUSY; + goto unlock; + } + + if (lane_count == 0) { + rc = EINVAL; + goto unlock; + } + + sa->port.phy_lane_count_req = lane_count; + +unlock: + sfc_adapter_unlock(sa); + return -rc; +} + +static int +sfc_dev_speed_lane_cap_handle(const efx_nic_cfg_t *encp, + efx_link_mode_t link_mode, + unsigned int *nb_caps_to_fillp, + struct rte_eth_speed_lanes_capa **capp) +{ + uint32_t lane_counts = encp->enc_phy_lane_counts[link_mode].ed_u32[0]; + struct rte_eth_speed_lanes_capa *cap = *capp; + uint32_t speed; + + if (lane_counts == 0) { + /* +* The mask of supported lane counts for this link mode is +* empty. Do not waste output entries for such link modes. +*/ + return 0; + } + + switch (link_mode) { + case EFX_LINK_1000FDX: + speed = RTE_ETH_SPEED_NUM_1G; + break; + case EFX_LINK_1FDX: + speed = RTE_ETH_SPEED_NUM_10G; + break; + case EFX_LINK_25000FDX: + speed = RTE_ETH_SPEED_NUM_25G; + break; + case EFX_LINK_4FDX: + speed = RTE_ETH_SPEED_NUM_40G; + break; + case EFX_LINK_5FDX: + speed = RTE_ETH_SPEED_NUM_50G; + break; + case EFX_LINK_10FDX: + speed = RTE_ETH_SPEED_NUM_100G; + break; + case EFX_LINK_20FDX: + speed = RTE_ETH_SPEED_NUM_200G; + break; + default: + /* No lane counts for this link mode. */ + return 0; + } + + if (*nb_caps_to_fillp == 0) { + if (cap == NULL) { + /* Dry run. Indicate that an entry is available. */ + return 1; + } + + /* We have run out of space in the user output buffer. */ + return 0; + } + + cap->capa = lane_counts; + cap->speed = speed; + + --(*nb_caps_to_fillp); + ++(*capp); + return 1; +} + +static int +sfc_dev_speed_lanes_get_capa(struct rte_eth_dev *dev, +struct rte_eth_speed_lanes_capa *caps, +unsigned int nb_caps) +{ + struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); + const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); + efx_link_mode_t i; + int ret = 0; + +
[PATCH 46/46] doc: advertise support for AMD Solarflare X45xx adapters
The two NICs, X4522 and X4542, are based on EF10 architecture. Signed-off-by: Ivan Malov --- doc/guides/nics/sfc_efx.rst| 9 - doc/guides/rel_notes/release_25_07.rst | 4 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index eafb88191a..4bd9f8c441 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -10,7 +10,8 @@ Solarflare libefx-based Poll Mode Driver The SFC EFX PMD (**librte_net_sfc_efx**) provides poll mode driver support for **Solarflare SFN7xxx and SFN8xxx** family of 10/40 Gbps adapters, -**Solarflare XtremeScale X2xxx** family of 10/25/40/50/100 Gbps adapters and +**Solarflare XtremeScale X2xxx** family of 10/25/40/50/100 Gbps adapters, +**Solarflare X45xx** family of 10/25/40/50/100 Gbps adapters and **Alveo SN1000 SmartNICs** family of 10/25/40/50/100 Gbps adapters. SFC EFX PMD has support for the latest Linux and FreeBSD operating systems. @@ -21,6 +22,12 @@ More information can be found at `Solarflare Communications website Supported NICs -- +- AMD Solarflare Adapters: + + - AMD Solarflare X4522 Dual Port SFP56 Adapter + + - AMD Solarflare X4542 Dual Port QSFP56 Adapter + - Xilinx Adapters: - Alveo SN1022 SmartNIC diff --git a/doc/guides/rel_notes/release_25_07.rst b/doc/guides/rel_notes/release_25_07.rst index b8b56510f8..467536fe05 100644 --- a/doc/guides/rel_notes/release_25_07.rst +++ b/doc/guides/rel_notes/release_25_07.rst @@ -60,6 +60,10 @@ New Features Added a new network PMD which supports Mucse 10 Gigabit Ethernet NICs. See the :doc:`../nics/rnp` for more details. +* **Updated Solarflare network PMD.** + + Added support for AMD Solarflare X45xx adapters. + Removed Items - -- 2.39.5
Re: [PATCH 00/46] Support AMD Solarflare X45xx adaptors
On Wed, 16 Apr 2025, Stephen Hemminger wrote: On Wed, 16 Apr 2025 17:59:30 +0400 Ivan Malov wrote: New X4522 (dual port SFP56) and X4542 (dual port QSFP56) adaptors are Medford4 (X4) chips that are based on EF10 architecture. An X4 NIC supports multiple network engine types. This series provides support only for the Medford2-alike, 'full-feature' (FF) network engine. This shall not be confused with the concept of 'datapath FW variants': the FF network engine supports both 'full-feature' and 'ultra-low-latency' datapath FW variants, with corresponding Medford2-alike feature sets. The first part of the series provides general support for the adaptors, whilst the second one adds support for the new management controller interface for configuration of network port features (netport MCDI). For now, only support for physical functions (PFs) is concerned. There is a small number of TODO and FIXME markings in the code. Those are normal at this development stage and will be removed by future patches when VF support has fleshed out. Andy Moreton (3): common/sfc_efx/base: update X4 BAR layout and PCI IDs net/sfc: add Medford4 with only full feature datapath engine common/sfc_efx/base: add port mode for 8 port hardware Denis Pryazhennikov (15): common/sfc_efx/base: add Medford4 PCI IDs to common code common/sfc_efx/base: add efsys option for Medford4 common/sfc_efx/base: add Medford4 support to NIC module common/sfc_efx/base: add Medford4 support to EV module common/sfc_efx/base: add Medford4 support to FILTER module common/sfc_efx/base: add Medford4 support to INTR module common/sfc_efx/base: add Medford4 support to MAC module common/sfc_efx/base: add Medford4 support to PHY module common/sfc_efx/base: add Medford4 support to TUNNEL module common/sfc_efx/base: add Medford4 support to MCDI module common/sfc_efx/base: add Medford4 support to Rx module common/sfc_efx/base: add Medford4 support to Tx module drivers: enable support for AMD Solarflare X4 adapter family common/sfc_efx/base: add new X4 port mode common/sfc_efx/base: extend list of supported X4 port modes Ivan Malov (28): common/sfc_efx/base: update MCDI headers common/sfc_efx/base: provide a stub for basic netport attach common/sfc_efx/base: provide defaults on netport attach path common/sfc_efx/base: obtain assigned netport handle from NIC common/sfc_efx/base: allow for const in MCDI struct accessor common/sfc_efx/base: get netport fixed capabilities on probe common/sfc_efx/base: decode netport link state on probe path common/sfc_efx/base: fill in loopback modes on netport probe common/sfc_efx/base: introduce Medford4 stub for PHY methods common/sfc_efx/base: refactor EF10 link mode decoding helper common/sfc_efx/base: provide PHY link get method on Medford4 common/sfc_efx/base: implement PHY link control for Medford4 common/sfc_efx/base: introduce Medford4 stub for MAC methods common/sfc_efx/base: add MAC reconfigure method for Medford4 common/sfc_efx/base: fill in software LUT for MAC statistics common/sfc_efx/base: fill in MAC statistics mask on Medford4 common/sfc_efx/base: support MAC statistics on Medford4 NICs common/sfc_efx/base: implement MAC PDU controls for Medford4 common/sfc_efx/base: correct MAC PDU calculation on Medford4 net/sfc: make use of generic EFX MAC PDU calculation helpers common/sfc_efx/base: ignore legacy link events on new boards common/sfc_efx/base: add link event processing on new boards net/sfc: query link status on link change events on new NICs common/sfc_efx/base: subscribe to netport link change events net/sfc: offer support for 200G link ability on new adaptors common/sfc_efx/base: support controls for netport lane count net/sfc: add support for control of physical port lane count doc: advertise support for AMD Solarflare X45xx adapters .mailmap |3 +- doc/guides/nics/sfc_efx.rst |9 +- doc/guides/rel_notes/release_25_07.rst|4 + drivers/common/sfc_efx/base/ef10_ev.c | 39 + drivers/common/sfc_efx/base/ef10_impl.h | 19 + drivers/common/sfc_efx/base/ef10_nic.c| 98 +- drivers/common/sfc_efx/base/ef10_phy.c| 43 +- drivers/common/sfc_efx/base/ef10_tlv_layout.h |9 +- drivers/common/sfc_efx/base/efx.h | 98 +- drivers/common/sfc_efx/base/efx_check.h | 24 +- drivers/common/sfc_efx/base/efx_ev.c |6 + drivers/common/sfc_efx/base/efx_filter.c |6 + drivers/common/sfc_efx/base/efx_impl.h| 115 +- drivers/common/sfc_efx/base/efx_intr.c|6 + drivers/common/sfc_efx/base/efx_mac.c | 56 +- drivers/common/sfc_efx/base/efx_mcdi.c| 18 +- drivers/common/sfc_efx/base/efx_mcdi.h|2 +- drivers/common/sfc_efx/base/efx_nic.c | 60 + drivers/common/sfc_efx/base/efx_np.c | 1625 + drivers/common/sfc_efx/b
Re: [PATCH] pci: define more standard register offsets
On Wed, Apr 16, 2025 at 4:37 PM Stephen Hemminger wrote: > > On Wed, 16 Apr 2025 08:10:34 +0200 > David Marchand wrote: > > > The PCI standard defines registers for: > > - subsystem id, > > - revision id, > > - status of the device, > > - vital product data, > > > > Add them to rte_pci.h and use in existing drivers. > > > > Signed-off-by: David Marchand > > --- > > Makes sense and aligns with > > Acked-by: Stephen Hemminger Thanks for the review and merging it. @Joshua Washington The gve patch https://patchwork.dpdk.org/project/dpdk/patch/20250416024421.722135-1-joshw...@google.com/ should now use RTE_PCI_REVISION_ID. -- David Marchand
[PATCH] net/e1000: support Rx/Tx burst mode info
Return burst mode according to the selected Rx/Tx burst function name. Update 25.07 release notes with this information. Signed-off-by: Roger Melton --- doc/guides/rel_notes/release_25_07.rst | 3 ++ drivers/net/intel/e1000/igb_ethdev.c | 64 ++ 2 files changed, 67 insertions(+) diff --git a/doc/guides/rel_notes/release_25_07.rst b/doc/guides/rel_notes/release_25_07.rst index 093b85d206..794ebbee5e 100644 --- a/doc/guides/rel_notes/release_25_07.rst +++ b/doc/guides/rel_notes/release_25_07.rst @@ -55,6 +55,9 @@ New Features Also, make sure to start the actual text at the margin. === +* **Updated Intel e1000 driver.** + + * Added support for rx_burst_mode_get and tx_burst_mode_get. Removed Items - diff --git a/drivers/net/intel/e1000/igb_ethdev.c b/drivers/net/intel/e1000/igb_ethdev.c index cbd2f15f5f..7250e99af1 100644 --- a/drivers/net/intel/e1000/igb_ethdev.c +++ b/drivers/net/intel/e1000/igb_ethdev.c @@ -237,6 +237,10 @@ static void eth_igb_configure_msix_intr(struct rte_eth_dev *dev); static void eth_igbvf_interrupt_handler(void *param); static void igbvf_mbx_process(struct rte_eth_dev *dev); static int igb_filter_restore(struct rte_eth_dev *dev); +static int igb_tx_burst_mode_get(struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, struct rte_eth_burst_mode *mode); +static int igb_rx_burst_mode_get(struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, struct rte_eth_burst_mode *mode); /* * Define VF Stats MACRO for Non "cleared on read" register @@ -367,6 +371,8 @@ static const struct eth_dev_ops eth_igb_ops = { .tx_queue_setup = eth_igb_tx_queue_setup, .tx_queue_release = eth_igb_tx_queue_release, .tx_done_cleanup = eth_igb_tx_done_cleanup, + .rx_burst_mode_get= igb_rx_burst_mode_get, + .tx_burst_mode_get= igb_tx_burst_mode_get, .dev_led_on = eth_igb_led_on, .dev_led_off = eth_igb_led_off, .flow_ctrl_get= eth_igb_flow_ctrl_get, @@ -425,6 +431,8 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = { .tx_queue_setup = eth_igb_tx_queue_setup, .tx_queue_release = eth_igb_tx_queue_release, .tx_done_cleanup = eth_igb_tx_done_cleanup, + .rx_burst_mode_get= igb_rx_burst_mode_get, + .tx_burst_mode_get= igb_tx_burst_mode_get, .set_mc_addr_list = eth_igb_set_mc_addr_list, .rxq_info_get = igb_rxq_info_get, .txq_info_get = igb_txq_info_get, @@ -715,6 +723,62 @@ static int igb_flex_filter_uninit(struct rte_eth_dev *eth_dev) return 0; } +static const struct { + eth_tx_burst_t pkt_burst; + const char *info; +} igb_tx_burst_info[] = { + { eth_igb_xmit_pkts, "Scalar igb"}, + { eth_em_xmit_pkts, "Scalar em"}, +}; + +int +igb_tx_burst_mode_get(struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode) +{ + eth_tx_burst_t pkt_burst = dev->tx_pkt_burst; + size_t i; + + for (i = 0; i < RTE_DIM(igb_tx_burst_info); i++) { + if (pkt_burst == igb_tx_burst_info[i].pkt_burst) { + snprintf(mode->info, sizeof(mode->info), "%s", +igb_tx_burst_info[i].info); + return 0; + } + } + + return -EINVAL; +} + +static const struct { + eth_rx_burst_t pkt_burst; + const char *info; +} igb_rx_burst_info[] = { + { eth_igb_recv_pkts, "Scalar igb"}, + { eth_igb_recv_scattered_pkts, "Scalar igb scattered"}, + { eth_em_recv_pkts, "Scalar em"}, + { eth_em_recv_scattered_pkts, "Scalar em scattered"}, +}; + +int +igb_rx_burst_mode_get(struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode) +{ + eth_rx_burst_t pkt_burst = dev->rx_pkt_burst; + size_t i; + + for (i = 0; i < RTE_DIM(igb_rx_burst_info); i++) { + if (pkt_burst == igb_rx_burst_info[i].pkt_burst) { + snprintf(mode->info, sizeof(mode->info), "%s", +igb_rx_burst_info[i].info); + return 0; + } + } + + return -EINVAL; +} + static int eth_igb_dev_init(struct rte_eth_dev *eth_dev) { -- 2.35.6
[PATCH] net/virtio: support Rx/Tx burst mode info
Return burst mode according to the selected Rx/Tx burst function name. Update 25.07 release notes with this information. Signed-off-by: Roger Melton --- doc/guides/rel_notes/release_25_07.rst | 3 + drivers/net/virtio/virtio_ethdev.c | 76 ++ 2 files changed, 79 insertions(+) diff --git a/doc/guides/rel_notes/release_25_07.rst b/doc/guides/rel_notes/release_25_07.rst index 093b85d206..ff2d81b400 100644 --- a/doc/guides/rel_notes/release_25_07.rst +++ b/doc/guides/rel_notes/release_25_07.rst @@ -55,6 +55,9 @@ New Features Also, make sure to start the actual text at the margin. === +* **Updated virtio driver.** + + * Added support for rx_burst_mode_get and tx_burst_mode_get. Removed Items - diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 1d7d10575c..2d2635b669 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -98,6 +98,11 @@ static int virtio_dev_queue_stats_mapping_set( static void virtio_notify_peers(struct rte_eth_dev *dev); static void virtio_ack_link_announce(struct rte_eth_dev *dev); +static int virtio_rx_burst_mode_get(struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, struct rte_eth_burst_mode *mode); +static int virtio_tx_burst_mode_get(struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, struct rte_eth_burst_mode *mode); + struct rte_virtio_xstats_name_off { char name[RTE_ETH_XSTATS_NAME_SIZE]; unsigned offset; @@ -636,6 +641,8 @@ static const struct eth_dev_ops virtio_eth_dev_ops = { .rx_queue_intr_enable= virtio_dev_rx_queue_intr_enable, .rx_queue_intr_disable = virtio_dev_rx_queue_intr_disable, .tx_queue_setup = virtio_dev_tx_queue_setup, + .rx_burst_mode_get = virtio_rx_burst_mode_get, + .tx_burst_mode_get = virtio_tx_burst_mode_get, .rss_hash_update = virtio_dev_rss_hash_update, .rss_hash_conf_get = virtio_dev_rss_hash_conf_get, .reta_update = virtio_dev_rss_reta_update, @@ -1242,6 +1249,75 @@ virtio_interrupt_handler(void *param) } } +static const struct { + eth_tx_burst_t pkt_burst; + const char *info; +} virtio_tx_burst_info[] = { + { virtio_xmit_pkts, "Scalar"}, + { virtio_xmit_pkts_packed, "Scalar packed ring"}, + { virtio_xmit_pkts_inorder, "Scalar in order"}, + { virtio_xmit_pkts_packed_vec, "Vector packed ring"}, +}; + +static int +virtio_tx_burst_mode_get(struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode) +{ + eth_tx_burst_t pkt_burst = dev->tx_pkt_burst; + size_t i; + + for (i = 0; i < RTE_DIM(virtio_tx_burst_info); i++) { + if (pkt_burst == virtio_tx_burst_info[i].pkt_burst) { + snprintf(mode->info, sizeof(mode->info), "%s", +virtio_tx_burst_info[i].info); + return 0; + } + } + + return -EINVAL; +} + +static const struct { + eth_rx_burst_t pkt_burst; + const char *info; +} virtio_rx_burst_info[] = { + { virtio_recv_pkts, "Scalar"}, + { virtio_recv_pkts_packed, "Scalar standard packed ring"}, + { virtio_recv_pkts_inorder, "Scalar"}, + { virtio_recv_mergeable_pkts, "Scalar mergeable"}, + { virtio_recv_mergeable_pkts_packed, "Scalar mergeable packed ring"}, +#ifdef RTE_ARCH_x86 + { virtio_recv_pkts_vec, "Vector SSE"}, + { virtio_recv_pkts_packed_vec, "Vector AVX512 packed ring"}, +#elif defined(RTE_ARCH_ARM) + { virtio_recv_pkts_vec, "Vector NEON"}, + { virtio_recv_pkts_packed_vec, "Vector NEON packed ring"}, +#elif defined(RTE_ARCH_PPC_64) + { virtio_recv_pkts_vec, "Vector Altivec"}, + { virtio_recv_pkts_packed_vec, "Vector Altivec packed ring"}, +#endif +}; + +static int +virtio_rx_burst_mode_get(struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode) +{ + eth_tx_burst_t pkt_burst = dev->rx_pkt_burst; + size_t i; + + for (i = 0; i < RTE_DIM(virtio_rx_burst_info); i++) { + if (pkt_burst == virtio_rx_burst_info[i].pkt_burst) { + snprintf(mode->info, sizeof(mode->info), "%s", +virtio_rx_burst_info[i].info); + return 0; + } + } + + return -EINVAL; +} + /* set rx and tx handlers according to what is supported */ static void set_rxtx_funcs(struct rte_eth_dev *eth_dev) -- 2.35.6
Re: [PATCH 00/46] Support AMD Solarflare X45xx adaptors
On Wed, 16 Apr 2025, Stephen Hemminger wrote: On Wed, 16 Apr 2025 19:38:58 +0400 (+04) Ivan Malov wrote: On Wed, 16 Apr 2025, Stephen Hemminger wrote: On Wed, 16 Apr 2025 17:59:30 +0400 Ivan Malov wrote: New X4522 (dual port SFP56) and X4542 (dual port QSFP56) adaptors are Medford4 (X4) chips that are based on EF10 architecture. An X4 NIC supports multiple network engine types. This series provides support only for the Medford2-alike, 'full-feature' (FF) network engine. This shall not be confused with the concept of 'datapath FW variants': the FF network engine supports both 'full-feature' and 'ultra-low-latency' datapath FW variants, with corresponding Medford2-alike feature sets. The first part of the series provides general support for the adaptors, whilst the second one adds support for the new management controller interface for configuration of network port features (netport MCDI). For now, only support for physical functions (PFs) is concerned. There is a small number of TODO and FIXME markings in the code. Those are normal at this development stage and will be removed by future patches when VF support has fleshed out. Andy Moreton (3): common/sfc_efx/base: update X4 BAR layout and PCI IDs net/sfc: add Medford4 with only full feature datapath engine common/sfc_efx/base: add port mode for 8 port hardware Denis Pryazhennikov (15): common/sfc_efx/base: add Medford4 PCI IDs to common code common/sfc_efx/base: add efsys option for Medford4 common/sfc_efx/base: add Medford4 support to NIC module common/sfc_efx/base: add Medford4 support to EV module common/sfc_efx/base: add Medford4 support to FILTER module common/sfc_efx/base: add Medford4 support to INTR module common/sfc_efx/base: add Medford4 support to MAC module common/sfc_efx/base: add Medford4 support to PHY module common/sfc_efx/base: add Medford4 support to TUNNEL module common/sfc_efx/base: add Medford4 support to MCDI module common/sfc_efx/base: add Medford4 support to Rx module common/sfc_efx/base: add Medford4 support to Tx module drivers: enable support for AMD Solarflare X4 adapter family common/sfc_efx/base: add new X4 port mode common/sfc_efx/base: extend list of supported X4 port modes Ivan Malov (28): common/sfc_efx/base: update MCDI headers common/sfc_efx/base: provide a stub for basic netport attach common/sfc_efx/base: provide defaults on netport attach path common/sfc_efx/base: obtain assigned netport handle from NIC common/sfc_efx/base: allow for const in MCDI struct accessor common/sfc_efx/base: get netport fixed capabilities on probe common/sfc_efx/base: decode netport link state on probe path common/sfc_efx/base: fill in loopback modes on netport probe common/sfc_efx/base: introduce Medford4 stub for PHY methods common/sfc_efx/base: refactor EF10 link mode decoding helper common/sfc_efx/base: provide PHY link get method on Medford4 common/sfc_efx/base: implement PHY link control for Medford4 common/sfc_efx/base: introduce Medford4 stub for MAC methods common/sfc_efx/base: add MAC reconfigure method for Medford4 common/sfc_efx/base: fill in software LUT for MAC statistics common/sfc_efx/base: fill in MAC statistics mask on Medford4 common/sfc_efx/base: support MAC statistics on Medford4 NICs common/sfc_efx/base: implement MAC PDU controls for Medford4 common/sfc_efx/base: correct MAC PDU calculation on Medford4 net/sfc: make use of generic EFX MAC PDU calculation helpers common/sfc_efx/base: ignore legacy link events on new boards common/sfc_efx/base: add link event processing on new boards net/sfc: query link status on link change events on new NICs common/sfc_efx/base: subscribe to netport link change events net/sfc: offer support for 200G link ability on new adaptors common/sfc_efx/base: support controls for netport lane count net/sfc: add support for control of physical port lane count doc: advertise support for AMD Solarflare X45xx adapters .mailmap |3 +- doc/guides/nics/sfc_efx.rst |9 +- doc/guides/rel_notes/release_25_07.rst|4 + drivers/common/sfc_efx/base/ef10_ev.c | 39 + drivers/common/sfc_efx/base/ef10_impl.h | 19 + drivers/common/sfc_efx/base/ef10_nic.c| 98 +- drivers/common/sfc_efx/base/ef10_phy.c| 43 +- drivers/common/sfc_efx/base/ef10_tlv_layout.h |9 +- drivers/common/sfc_efx/base/efx.h | 98 +- drivers/common/sfc_efx/base/efx_check.h | 24 +- drivers/common/sfc_efx/base/efx_ev.c |6 + drivers/common/sfc_efx/base/efx_filter.c |6 + drivers/common/sfc_efx/base/efx_impl.h| 115 +- drivers/common/sfc_efx/base/efx_intr.c|6 + drivers/common/sfc_efx/base/efx_mac.c | 56 +- drivers/common/sfc_efx/base/efx_mcdi.c| 18 +- drivers/common/sfc_efx/base/efx_mcdi.h|2 +- drivers/common/sfc_efx/base/ef
[patch v6 6/6] bus/vmbus: set event for channel without monitoring support
From: Long Li For vmbus channels without monitoring support, use kernel UIO interface to indicate packet through interrupt page and UIO file handle. Signed-off-by: Long Li --- Changes: v4: replace RTE_ATOMIC(uint32_t) * with RTE_ATOMIC(uint32_t *) for declaring variable v6: revert the v4 version back to v3 as it generates a warning under clang with enable_stdatomic=true drivers/bus/vmbus/vmbus_channel.c | 22 +++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/bus/vmbus/vmbus_channel.c b/drivers/bus/vmbus/vmbus_channel.c index d066e3288d..6887fbad46 100644 --- a/drivers/bus/vmbus/vmbus_channel.c +++ b/drivers/bus/vmbus/vmbus_channel.c @@ -25,6 +25,19 @@ vmbus_sync_set_bit(volatile RTE_ATOMIC(uint32_t) *addr, uint32_t mask) rte_atomic_fetch_or_explicit(addr, mask, rte_memory_order_seq_cst); } +static inline void +vmbus_send_interrupt(const struct rte_vmbus_device *dev, uint32_t relid) +{ + RTE_ATOMIC(uint32_t) *int_addr; + uint32_t int_mask; + + int_addr = (RTE_ATOMIC(uint32_t) *) (dev->int_page + relid / 32); + int_mask = 1u << (relid % 32); + vmbus_sync_set_bit(int_addr, int_mask); + + vmbus_uio_irq_control(dev, 1); +} + static inline void vmbus_set_monitor(const struct vmbus_channel *channel, uint32_t monitor_id) { @@ -40,10 +53,13 @@ vmbus_set_monitor(const struct vmbus_channel *channel, uint32_t monitor_id) } static void -vmbus_set_event(struct rte_vmbus_device *dev __rte_unused, - const struct vmbus_channel *chan) +vmbus_set_event(struct rte_vmbus_device *dev, const struct vmbus_channel *chan) { - vmbus_set_monitor(chan, chan->monitor_id); + /* Use monitored bit if supported, otherwise use interrupt/Hypercall */ + if (chan->monitor_id != UINT8_MAX) + vmbus_set_monitor(chan, chan->monitor_id); + else + vmbus_send_interrupt(dev, chan->relid); } /* -- 2.34.1
[patch v6 1/6] net/netvsc: introduce private data for storing vmbus device for secondary process
From: Long Li To prepare for supporting to set hyperv event from secondary process when the channel has monitoring disable, introduce a private data region for storing the vmbus device. The secondary process will get access to its vmbus device in case it needs to signal the host. Signed-off-by: Long Li --- drivers/net/netvsc/hn_ethdev.c | 44 +++--- drivers/net/netvsc/hn_nvs.h| 4 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index f848157b49..e5b052d569 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -1427,7 +1427,8 @@ static int eth_hn_probe(struct rte_vmbus_driver *drv __rte_unused, struct rte_vmbus_device *dev) { struct rte_eth_dev *eth_dev; - int ret; + struct hn_nvs_process_priv *process_priv; + int ret = 0; PMD_INIT_FUNC_TRACE(); @@ -1438,16 +1439,37 @@ static int eth_hn_probe(struct rte_vmbus_driver *drv __rte_unused, } eth_dev = eth_dev_vmbus_allocate(dev, sizeof(struct hn_data)); - if (!eth_dev) - return -ENOMEM; + if (!eth_dev) { + ret = -ENOMEM; + goto vmbus_alloc_failed; + } - ret = eth_hn_dev_init(eth_dev); - if (ret) { - eth_dev_vmbus_release(eth_dev); - rte_dev_event_monitor_stop(); - } else { - rte_eth_dev_probing_finish(eth_dev); + process_priv = rte_zmalloc_socket("netvsc_proc_priv", + sizeof(struct hn_nvs_process_priv), + RTE_CACHE_LINE_SIZE, + dev->device.numa_node); + if (!process_priv) { + ret = -ENOMEM; + goto priv_alloc_failed; } + process_priv->vmbus_dev = dev; + eth_dev->process_private = process_priv; + + ret = eth_hn_dev_init(eth_dev); + if (ret) + goto dev_init_failed; + + rte_eth_dev_probing_finish(eth_dev); + return ret; + +dev_init_failed: + rte_free(process_priv); + +priv_alloc_failed: + eth_dev_vmbus_release(eth_dev); + +vmbus_alloc_failed: + rte_dev_event_monitor_stop(); return ret; } @@ -1455,6 +1477,7 @@ static int eth_hn_probe(struct rte_vmbus_driver *drv __rte_unused, static int eth_hn_remove(struct rte_vmbus_device *dev) { struct rte_eth_dev *eth_dev; + struct hn_nvs_process_priv *process_priv; int ret; PMD_INIT_FUNC_TRACE(); @@ -1467,6 +1490,9 @@ static int eth_hn_remove(struct rte_vmbus_device *dev) if (ret) return ret; + process_priv = eth_dev->process_private; + rte_free(process_priv); + eth_dev_vmbus_release(eth_dev); rte_dev_event_monitor_stop(); return 0; diff --git a/drivers/net/netvsc/hn_nvs.h b/drivers/net/netvsc/hn_nvs.h index 2843ef7b96..3950749359 100644 --- a/drivers/net/netvsc/hn_nvs.h +++ b/drivers/net/netvsc/hn_nvs.h @@ -65,6 +65,10 @@ #define NVS_TYPE_SUBCH_RESP133 /* same as SUBCH_REQ */ #define NVS_TYPE_TXTBL_NOTE134 /* notification */ +/* Private data for primary/secondary processes */ +struct hn_nvs_process_priv { + struct rte_vmbus_device *vmbus_dev; +}; /* NVS message common header */ struct __rte_packed_begin hn_nvs_hdr { -- 2.34.1
[patch v6 0/6] Support VMBUS channels without monitoring enabled
From: Long Li Hyperv may expose VMBUS channels without monitoring enabled. In this case, it programs almost all the data traffic to VF. This patchset enabled vmbus/netvsc to use channels without monitoring enabled. This needs to change the APIs exposed by drivers/bus/vmbus. Because those APIs are used only by NetVSC PMD and not feasible for use by a DPDK application, all VMBUS APIs are set to deprecate in upcoming 25.11 release. The notice for deprecation is accepted in the following patch: https://patchwork.dpdk.org/project/dpdk/patch/1742242184-19600-1-git-send-email-lon...@linuxonhyperv.com/ Change log: v3: Add in the comment on the VMBUS API deprecation notice Long Li (6): net/netvsc: introduce private data for storing vmbus device for secondary process net/netvsc: introduce get_vmbus_device to get the vmbus device bus/vmbus: store UIO fd for secondary process bus/vmbus: support channels without monitoring enabled bus/vmbus: add rte_vmbus_device to all functions accessing vmbus bus/vmbus: set event for channel without monitoring support drivers/bus/vmbus/linux/vmbus_bus.c | 9 +++-- drivers/bus/vmbus/linux/vmbus_uio.c | 6 ++-- drivers/bus/vmbus/private.h | 2 +- drivers/bus/vmbus/rte_bus_vmbus.h| 16 ++--- drivers/bus/vmbus/vmbus_channel.c| 53 drivers/bus/vmbus/vmbus_common_uio.c | 9 +++-- drivers/net/netvsc/hn_ethdev.c | 44 ++- drivers/net/netvsc/hn_nvs.c | 33 - drivers/net/netvsc/hn_nvs.h | 21 +++ drivers/net/netvsc/hn_rndis.c| 11 +++--- drivers/net/netvsc/hn_rxtx.c | 16 - 11 files changed, 153 insertions(+), 67 deletions(-) -- 2.34.1
[patch v6 3/6] bus/vmbus: store UIO fd for secondary process
From: Long Li Secondary process will get access to vmbus device and this UIO fd for signaling hyperv host on channels without monitoring support. Signed-off-by: Long Li --- drivers/bus/vmbus/vmbus_common_uio.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/bus/vmbus/vmbus_common_uio.c b/drivers/bus/vmbus/vmbus_common_uio.c index 4d4613513c..d55aee6537 100644 --- a/drivers/bus/vmbus/vmbus_common_uio.c +++ b/drivers/bus/vmbus/vmbus_common_uio.c @@ -86,8 +86,11 @@ vmbus_uio_map_secondary(struct rte_vmbus_device *dev) return -1; } - /* fd is not needed in secondary process, close it */ - close(fd); + if (rte_intr_fd_set(dev->intr_handle, fd)) + return -1; + + if (rte_intr_type_set(dev->intr_handle, RTE_INTR_HANDLE_UIO_INTX)) + return -1; /* Create and map primary channel */ if (vmbus_chan_create(dev, dev->relid, 0, @@ -256,7 +259,7 @@ vmbus_uio_unmap_resource(struct rte_vmbus_device *dev) /* free uio resource */ rte_free(uio_res); - /* close fd if in primary process */ + /* close fd */ if (rte_intr_fd_get(dev->intr_handle) >= 0) close(rte_intr_fd_get(dev->intr_handle)); -- 2.34.1
RE: [EXTERNAL] Re: [Patch v3 6/6] bus/vmbus: set event for channel without monitoring support
> Subject: RE: [EXTERNAL] Re: [Patch v3 6/6] bus/vmbus: set event for channel > without monitoring support > > > Subject: [EXTERNAL] Re: [Patch v3 6/6] bus/vmbus: set event for > > channel without monitoring support > > > > On Fri, 4 Apr 2025 17:35:38 -0700 > > lon...@linuxonhyperv.com wrote: > > > > > diff --git a/drivers/bus/vmbus/vmbus_channel.c > > > b/drivers/bus/vmbus/vmbus_channel.c > > > index bccef168d3..81e8096190 100644 > > > --- a/drivers/bus/vmbus/vmbus_channel.c > > > +++ b/drivers/bus/vmbus/vmbus_channel.c > > > @@ -24,6 +24,19 @@ vmbus_sync_set_bit(volatile RTE_ATOMIC(uint32_t) > > *addr, uint32_t mask) > > > rte_atomic_fetch_or_explicit(addr, mask, > > > rte_memory_order_seq_cst); } > > > > > > +static inline void > > > +vmbus_send_interrupt(const struct rte_vmbus_device *dev, uint32_t > > > +relid) { > > > + RTE_ATOMIC(uint32_t) *int_addr; > > > + uint32_t int_mask; > > > + > > > + int_addr = (RTE_ATOMIC(uint32_t)*) (dev->int_page + relid / 32); > > > + int_mask = 1u << (relid % 32); > > > + vmbus_sync_set_bit(int_addr, int_mask); > > > + > > > + vmbus_uio_irq_control(dev, 1); > > > +} > > > + > > > > This part doesn't look right. RTE_ATOMIC() is just a macro to add the > > _Atomic attribute. > > > > Can it be simplified like this? > > > > > > static inline void > > vmbus_sync_set_bit(RTE_ATOMIC(uint32_t *) addr, uint32_t mask) { > > rte_atomic_fetch_or_explicit(addr, mask, rte_memory_order_seq_cst); } > > > > static inline void > > vmbus_send_interrupt(const struct rte_vmbus_device *dev, uint32_t relid) { > > RTE_ATOMIC(uint32_t *) int_addr; > > uint32_t int_mask; > > > > int_addr = dev->int_page + relid / 32; > > int_mask = 1u << (relid % 32); > > vmbus_sync_set_bit(int_addr, int_mask); > > > > vmbus_uio_irq_control(dev, 1); > > } > > Hi Stephen, > > I need to go back to this version of the patch, as v5 doesn't compile > successfully > under clang with the following error: > > [459/3553] Compiling C object drivers/libtmp_rte_bus_vmbus.a.p/bus_vmbus > ccache gcc -Idrivers/libtmp_rte_bus_vmbus.a.p -Idrivers -I../drivers - > Idrivers/bus/vmbus -I../drivers/bus/vmbus -I../drivers/bus/vmbus/linux - > Ilib/eal/common -I../lib/eal/common -I. -I.. -Iconfig -I../config > -Ilib/eal/include - > I../lib/eal/include -Ilib/eal/linux/include -I../lib/eal/linux/include - > Ilib/eal/x86/include -I../lib/eal/x86/include -I../kernel/linux -Ilib/eal > -I../lib/eal - > Ilib/kvargs -I../lib/kvargs -Ilib/log -I../lib/log -Ilib/metrics > -I../lib/metrics - > Ilib/telemetry -I../lib/telemetry -fdiagnostics-color=always -pipe - > D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c11 -O2 -g - > include rte_config.h -Wvla -Wcast-qual -Wdeprecated -Wformat -Wformat- > nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes - > Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare - > Wstrict-prototypes -Wundef -Wwrite-strings -Wno-packed-not-aligned -Wno- > missing-field-initializers -D_GNU_SOURCE -fPIC -march=corei7 -mrtm - > DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -Wno-format-truncation > -Wno-address-of-packed-member -DRTE_LOG_DEFAULT_LOGTYPE=bus.vmbus - > MD -MQ drivers/libtmp_rte_bus_vmbus.a.p/bus_vmbus_vmbus_channel.c.o -MF > drivers/libtmp_rte_bus_vmbus.a.p/bus_vmbus_vmbus_channel.c.o.d -o > drivers/libtmp_rte_bus_vmbus.a.p/bus_vmbus_vmbus_channel.c.o - > c ../drivers/bus/vmbus/vmbus_channel.c > ../drivers/bus/vmbus/vmbus_channel.c: In function 'vmbus_set_monitor': > ../drivers/bus/vmbus/vmbus_channel.c:51:22: error: assignment to 'uint32_t *' > {aka 'unsigned int *'} from incompatible pointer type '_Atomic uint32_t *' > {aka > '_Atomic unsigned int *'} [-Werror=incompatible-pointer-types] >51 | monitor_addr = &channel->monitor_page- > >trigs[trigger_index].pending; > | ^ > cc1: all warnings being treated as errors > > I think it's okay to define those pointers as "RTE_ATOMIC(uint32_t) *". The > pointers themselves are not atomic, but data in the addresses they point to > are > atomic. > > Do you think it is okay to proceed with this patch? > > Thanks, > Long I sent out v6 reverting the patch to this version. This compiles okay with clang and stdatomic flags. Thanks, Long
Re: [RFC 01/13] app/testpmd: revert auto attach/detach
在 2025/4/16 8:06, Stephen Hemminger 写道: On Tue, 15 Apr 2025 21:28:07 +0800 "lihuisong (C)" wrote: Hi Stephen, The main cause of cpfl driver attach failure is the added alarm in new event callback to setup port automatically. It's a question of when to set up the new port. Please see the discussion[1]. I have a stupid method, but I'm not very willing to do that. For the Bugzilla id1695, I'll take a look at it. [1] https://bugs.dpdk.org/show_bug.cgi?id=1671 For now I am going to revert the testpmd change. Come back when you have something that works without breaking pdump application. ok
Re: [PATCH v1 02/12] node: add IP4 lookup FIB node
Hi Ankur, On 15/04/2025 13:10, Ankur Dwivedi wrote: Adds a lookup FIB node for IP4. Signed-off-by: Ankur Dwivedi --- lib/node/ip4_lookup_fib.c | 127 ++ lib/node/meson.build | 3 +- 2 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 lib/node/ip4_lookup_fib.c diff --git a/lib/node/ip4_lookup_fib.c b/lib/node/ip4_lookup_fib.c new file mode 100644 index 00..9c71610718 --- /dev/null +++ b/lib/node/ip4_lookup_fib.c @@ -0,0 +1,127 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2025 Marvell. + */ + +#include +#include +#include +#include +#include +#include + +#include "rte_node_ip4_api.h" + +#include "node_private.h" + +/* IP4 Lookup global data struct */ +struct ip4_lookup_fib_node_main { + struct rte_fib *fib[RTE_MAX_NUMA_NODES]; +}; + +struct ip4_lookup_fib_node_ctx { + /* Socket's FIB */ + struct rte_fib *fib; + /* Dynamic offset to mbuf priv1 */ + int mbuf_priv1_off; +}; + +static struct ip4_lookup_fib_node_main ip4_lookup_fib_nm; + +#define FIB_MAX_ROUTES (1 << 16) why only 64k routes? Modern BGP full view has about 1M prefixes +#define FIB_NUM_TBL8 (1 << 15) +#define FIB_DEFAULT_NH 999 why this particular value? It is ok to use magic values in examples, but not for libs. Consider something like 0 or UINT{8,16,32,64}MAX or some meaningful value within graph infra + +#define IP4_LOOKUP_NODE_FIB(ctx) \ + (((struct ip4_lookup_fib_node_ctx *)ctx)->fib) + +#define IP4_LOOKUP_NODE_PRIV1_OFF(ctx) \ + (((struct ip4_lookup_fib_node_ctx *)ctx)->mbuf_priv1_off) + +static int +setup_fib(unsigned int socket) +{ + struct ip4_lookup_fib_node_main *nm = &ip4_lookup_fib_nm; + struct rte_fib_conf conf; + char s[RTE_FIB_NAMESIZE]; + + /* One fib per socket */ + if (nm->fib[socket]) + return 0; + + conf.type = RTE_FIB_DIR24_8; + conf.default_nh = FIB_DEFAULT_NH; + conf.max_routes = FIB_MAX_ROUTES; + conf.rib_ext_sz = 0; + conf.dir24_8.nh_sz = RTE_FIB_DIR24_8_4B; + conf.dir24_8.num_tbl8 = FIB_NUM_TBL8; + conf.flags = 0; + snprintf(s, sizeof(s), "IPV4_LOOKUP_FIB_%d", socket); + nm->fib[socket] = rte_fib_create(s, socket, &conf); + if (nm->fib[socket] == NULL) + return -rte_errno; + + return 0; +} + +static int +ip4_lookup_fib_node_init(const struct rte_graph *graph, struct rte_node *node) +{ + static uint8_t init_once; + unsigned int socket; + uint16_t lcore_id; + int rc; + + RTE_BUILD_BUG_ON(sizeof(struct ip4_lookup_fib_node_ctx) > RTE_NODE_CTX_SZ); + + if (!init_once) { + node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register( + &node_mbuf_priv1_dynfield_desc); + if (node_mbuf_priv1_dynfield_offset < 0) + return -rte_errno; + + /* Setup FIB for all sockets */ + RTE_LCORE_FOREACH(lcore_id) + { + socket = rte_lcore_to_socket_id(lcore_id); + rc = setup_fib(socket); + if (rc) { + node_err("ip4_lookup_fib", +"Failed to setup fib for sock %u, rc=%d", +socket, rc); + return rc; + } + } + init_once = 1; + } + + /* Update socket's FIB and mbuf dyn priv1 offset in node ctx */ + IP4_LOOKUP_NODE_FIB(node->ctx) = ip4_lookup_fib_nm.fib[graph->socket]; + IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx) = node_mbuf_priv1_dynfield_offset; + + node_dbg("ip4_lookup_fib", "Initialized ip4_lookup_fib node"); + + return 0; +} + +static struct rte_node_xstats ip4_lookup_fib_xstats = { + .nb_xstats = 1, + .xstat_desc = { + [0] = "ip4_lookup_fib_error", + }, +}; + +static struct rte_node_register ip4_lookup_fib_node = { + .name = "ip4_lookup_fib", + + .init = ip4_lookup_fib_node_init, + .xstats = &ip4_lookup_fib_xstats, + + .nb_edges = RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP + 1, + .next_nodes = { + [RTE_NODE_IP4_LOOKUP_NEXT_IP4_LOCAL] = "ip4_local", + [RTE_NODE_IP4_LOOKUP_NEXT_REWRITE] = "ip4_rewrite", + [RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP] = "pkt_drop", + }, +}; + +RTE_NODE_REGISTER(ip4_lookup_fib_node); diff --git a/lib/node/meson.build b/lib/node/meson.build index 0bed97a96c..d2011c8f56 100644 --- a/lib/node/meson.build +++ b/lib/node/meson.build @@ -13,6 +13,7 @@ sources = files( 'ethdev_tx.c', 'ip4_local.c', 'ip4_lookup.c', +'ip4_lookup_fib.c', 'ip4_reassembly.c', 'ip4_rewrite.c', 'ip6_lookup.c', @@ -34,4 +35,4 @@ headers = files( # Strict-aliasing rules are violat
Re: [PATCH v1 04/12] node: add process callback for IP4 FIB
Hi Ankur, Same comments apply to IPv6 nodes as well. See for ip4 lookup comments Thanks, Nitin On Tue, Apr 15, 2025 at 6:20 PM Ankur Dwivedi wrote: > > Adds the process callback function for ip4_lookup_fib node. > > Signed-off-by: Ankur Dwivedi > --- > lib/node/ip4_lookup_fib.c | 164 ++ > 1 file changed, 164 insertions(+) > > diff --git a/lib/node/ip4_lookup_fib.c b/lib/node/ip4_lookup_fib.c > index e87864e672..c535b191f8 100644 > --- a/lib/node/ip4_lookup_fib.c > +++ b/lib/node/ip4_lookup_fib.c > @@ -40,6 +40,169 @@ static struct ip4_lookup_fib_node_main ip4_lookup_fib_nm; > #define IP4_LOOKUP_NODE_PRIV1_OFF(ctx) \ > (((struct ip4_lookup_fib_node_ctx *)ctx)->mbuf_priv1_off) > > +static uint16_t > +ip4_lookup_fib_node_process(struct rte_graph *graph, struct rte_node *node, > void **objs, > + uint16_t nb_objs) > +{ > + struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3, **pkts; > + struct rte_fib *fib = IP4_LOOKUP_NODE_FIB(node->ctx); > + const int dyn = IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx); > + struct rte_ipv4_hdr *ipv4_hdr; > + uint64_t next_hop[nb_objs]; > + uint16_t lookup_err = 0; > + void **to_next, **from; > + uint16_t last_spec = 0; > + rte_edge_t next_index; > + uint16_t n_left_from; > + uint32_t ip[nb_objs]; > + uint16_t held = 0; > + uint32_t drop_nh; > + uint16_t next; > + int i, rc; > + > + /* Speculative next */ > + next_index = RTE_NODE_IP4_LOOKUP_NEXT_REWRITE; Is it possible if we add next_edge in node->ctx? Save next_index in node->init() function and at the end of process() function for better speculative performance Also in general, this function is assuming packets are being forwarded to rewrite node but there be can other paths as well like - LOCAL - PUNT etc. So let next_hop returned from rte_fib_lookup_bulk() determine the next_edge (even pkt_drop node). Control plane feeds next_edge in 8B next_hop which I defined in other patch and also below (rte_ip4_lookup_fib_next_hop_t) > + /* Drop node */ > + drop_nh = ((uint32_t)RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP) << 16; Let drop be determined from next_hop returned from rte_ip4_lookup_fib_next_hop_t Control plane feeds default next_hop as part of setup_fib() as follows struct { struct { uint32_t next_hop_od; uint16_t next_edge; uint16_t reserved; }; uint64_t u4; } rte_ip4_lookpu_fib_next_hop_t; default_nh = {,next = RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP}; which is programmed in setup_fib > + > + pkts = (struct rte_mbuf **)objs; > + from = objs; > + n_left_from = nb_objs; > + > + /* Get stream for the speculated next node */ > + to_next = rte_node_next_stream_get(graph, node, next_index, nb_objs); > + > + for (i = OBJS_PER_CLINE; i < RTE_GRAPH_BURST_SIZE; i += > OBJS_PER_CLINE) > + rte_prefetch0(&objs[i]); > + > +#if RTE_GRAPH_BURST_SIZE > 64 > + for (i = 0; i < 4 && i < n_left_from; i++) { > + rte_prefetch0(pkts[i]); > + rte_prefetch0(rte_pktmbuf_mtod_offset(pkts[i], void *, > + sizeof(struct rte_ether_hdr))); > + } > +#endif > + > + i = 0; > + while (n_left_from >= 4) { > +#if RTE_GRAPH_BURST_SIZE > 64 > + if (likely(n_left_from > 7)) { > + rte_prefetch0(pkts[4]); > + rte_prefetch0(rte_pktmbuf_mtod_offset(pkts[4], void *, > + sizeof(struct rte_ether_hdr))); > + rte_prefetch0(pkts[5]); > + rte_prefetch0(rte_pktmbuf_mtod_offset(pkts[5], void *, > + sizeof(struct rte_ether_hdr))); > + rte_prefetch0(pkts[6]); > + rte_prefetch0(rte_pktmbuf_mtod_offset(pkts[6], void *, > + sizeof(struct rte_ether_hdr))); > + rte_prefetch0(pkts[7]); > + rte_prefetch0(rte_pktmbuf_mtod_offset(pkts[7], void *, > + sizeof(struct rte_ether_hdr))); > + } > +#endif > + > + mbuf0 = pkts[0]; > + mbuf1 = pkts[1]; > + mbuf2 = pkts[2]; > + mbuf3 = pkts[3]; > + pkts += 4; > + n_left_from -= 4; > + /* Extract DIP of mbuf0 */ > + ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf0, struct rte_ipv4_hdr > *, > + sizeof(struct rte_ether_hdr)); > + /* Extract cksum, ttl as ipv4 hdr is in cache */ > + node_mbuf_priv1(mbuf0, dyn)->cksum = ipv4_hdr->hdr_checksum; > + node_mbuf_priv1(mbuf0, dyn)->ttl = ipv4_hdr->time_to_live; > + > + ip[i++] = rte_be_to_cpu_32(ipv4_hdr->dst_addr); > + > + /* Ex
[PATCH] doc: announce DMA configuration structure changes
From: Pavan Nikhilesh Deprecate rte_dma_conf structure to allow for a more flexible configuration of DMA devices. The new structure will have a flags field instead of multiple boolean fields for each feature. Signed-off-by: Pavan Nikhilesh --- doc/guides/rel_notes/deprecation.rst | 6 ++ 1 file changed, 6 insertions(+) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 36489f6e68..854db96c08 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -142,3 +142,9 @@ Deprecation Notices * bus/vmbus: Starting DPDK 25.11, all the vmbus API defined in ``drivers/bus/vmbus/rte_bus_vmbus.h`` will become internal to DPDK. Those API functions are used internally by DPDK core and netvsc PMD. + +* dmadev: The ``rte_dma_conf`` structure is updated to include a new field + ``rte_dma_conf::flags`` that should be used to configure dmadev features. + The existing field ``rte_dma_conf::enable_silent`` is removed and replaced + with the new flag ``RTE_DMA_CFG_FLAG_SILENT``, to configure silent mode + the flag should be set in ``rte_dma_conf::flags`` during device configuration. -- 2.43.0
Re: [PATCH v1 02/12] node: add IP4 lookup FIB node
Hi Ankur, Please see my comments inline below Thanks, Nitin On Tue, Apr 15, 2025 at 5:41 PM Ankur Dwivedi wrote: > > Adds a lookup FIB node for IP4. > > Signed-off-by: Ankur Dwivedi > --- > lib/node/ip4_lookup_fib.c | 127 ++ > lib/node/meson.build | 3 +- > 2 files changed, 129 insertions(+), 1 deletion(-) > create mode 100644 lib/node/ip4_lookup_fib.c > > diff --git a/lib/node/ip4_lookup_fib.c b/lib/node/ip4_lookup_fib.c > new file mode 100644 > index 00..9c71610718 > --- /dev/null > +++ b/lib/node/ip4_lookup_fib.c > @@ -0,0 +1,127 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(C) 2025 Marvell. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "rte_node_ip4_api.h" > + > +#include "node_private.h" > + > +/* IP4 Lookup global data struct */ > +struct ip4_lookup_fib_node_main { > + struct rte_fib *fib[RTE_MAX_NUMA_NODES]; > +}; > + > +struct ip4_lookup_fib_node_ctx { > + /* Socket's FIB */ > + struct rte_fib *fib; > + /* Dynamic offset to mbuf priv1 */ > + int mbuf_priv1_off; > +}; > + > +static struct ip4_lookup_fib_node_main ip4_lookup_fib_nm; > + > +#define FIB_MAX_ROUTES (1 << 16) > +#define FIB_NUM_TBL8 (1 << 15) > +#define FIB_DEFAULT_NH 999 These macros may not be required if we expose public setup_api() with arguments. See below > + > +#define IP4_LOOKUP_NODE_FIB(ctx) \ > + (((struct ip4_lookup_fib_node_ctx *)ctx)->fib) > + > +#define IP4_LOOKUP_NODE_PRIV1_OFF(ctx) \ > + (((struct ip4_lookup_fib_node_ctx *)ctx)->mbuf_priv1_off) > + > +static int > +setup_fib(unsigned int socket) Should we add public API to allow applications to control MAX_ROUTES? In a typical stack multiple fibs can be set up for each VRF (~~ port_id). A public API: int rte_ip4_lookup_fib_setup(int fib_index, int port_id, uint32_t max_routes) where For now we can assume fib_index == 0, is global fib table (can be extended to VRF later). Socket_id can be determined from port_Id > +{ > + struct ip4_lookup_fib_node_main *nm = &ip4_lookup_fib_nm; > + struct rte_fib_conf conf; > + char s[RTE_FIB_NAMESIZE]; > + > + /* One fib per socket */ > + if (nm->fib[socket]) > + return 0; > + > + conf.type = RTE_FIB_DIR24_8; > + conf.default_nh = FIB_DEFAULT_NH; FIB_DEFAULT_NH can be defined in such a way, fast path can decode next_edge from return of rte_fib_lookup_bulk() Like union { struct u64; struct { uint32_t next_hop_id; uint16_t next_edge; uint16_t. reserved; }; } rte_ip4_lookup_fib_nexthop_t; FIB_DEFAULT_NH should be set as rte_ip4_lookup_fib_nexthop_t default_next_hop = {.next_edge = IP4_FIB_LOOKUP_NEXT_DROP} This way in fast path a return from fib_bulk() can be directly used to send packet to pkt_drop node > + conf.max_routes = FIB_MAX_ROUTES; > + conf.rib_ext_sz = 0; > + conf.dir24_8.nh_sz = RTE_FIB_DIR24_8_4B; > + conf.dir24_8.num_tbl8 = FIB_NUM_TBL8; > + conf.flags = 0; > + snprintf(s, sizeof(s), "IPV4_LOOKUP_FIB_%d", socket); > + nm->fib[socket] = rte_fib_create(s, socket, &conf); > + if (nm->fib[socket] == NULL) > + return -rte_errno; > + > + return 0; > +} > + > +static int > +ip4_lookup_fib_node_init(const struct rte_graph *graph, struct rte_node > *node) > +{ > + static uint8_t init_once; > + unsigned int socket; > + uint16_t lcore_id; > + int rc; > + > + RTE_BUILD_BUG_ON(sizeof(struct ip4_lookup_fib_node_ctx) > > RTE_NODE_CTX_SZ); > + > + if (!init_once) { > + node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register( > + &node_mbuf_priv1_dynfield_desc); > + if (node_mbuf_priv1_dynfield_offset < 0) > + return -rte_errno; You may need to rebase this patch on top of https://patches.dpdk.org/project/dpdk/patch/20250409135554.2180390-2-nsax...@marvell.com/ for using global mbuf field > + > + /* Setup FIB for all sockets */ > + RTE_LCORE_FOREACH(lcore_id) Instead can be use rte_socket_count() which allow to loop for socket instead of port? Ideally we may need to add fib for virtual interfaces or VRF (later) > + { > + socket = rte_lcore_to_socket_id(lcore_id); > + rc = setup_fib(socket); > + if (rc) { > + node_err("ip4_lookup_fib", > +"Failed to setup fib for sock %u, > rc=%d", > +socket, rc); > + return rc; > + } > + } > + init_once = 1; > + } > + > + /* Update socket's FIB and mbuf dyn priv1 offset in node ctx */ > + IP4_LOOKUP_NODE_FIB(node->ctx) = ip4_lookup_fib_n
[RFC] add Rust API for basic port operations
This RFC proposes Rust API for basic DPDK port management and IO operations. ```rust /// Configuration details for a DPDK port. /// /// # Overview /// /// `DpdkPortConf` is used to initialize and configure ports in a DPDK environment. It includes: /// - Device information (`dev_info`) pulled from DPDK. /// - Transmit and receive configurations, including queue settings and memory pools. /// - Details about the number of queues and descriptors for transmission and reception. /// /// This struct is typically instantiated using the [`DpdkPortConf::new_from`] method. /// /// # Example /// /// ``` /// let conf = DpdkPortConf::new_from( /// port_id, /// dev_conf, /// tx_conf, /// rx_conf, /// 8, // Number of RX queues /// 8, // Number of TX queues /// 512, // RX descriptors /// 512, // TX descriptors /// 0, // RX queue socket ID /// 0, // TX queue socket ID /// Some(rx_mempool) // RX queue mempool /// ).unwrap(); /// ``` /// #[derive(Clone)] pub struct DpdkPortConf { /// Information about the DPDK Ethernet device (e.g., driver, capabilities, etc.). pub dev_info: rte_eth_dev_info, /// Configuration for the Ethernet device. Determines the overall behavior of the device. pub dev_conf: rte_eth_conf, /// Configuration for transmitting (Tx) packets on the Ethernet device. pub tx_conf: rte_eth_txconf, /// Configuration for receiving (Rx) packets on the Ethernet device. pub rx_conf: rte_eth_rxconf, /// Number of receive (Rx) queues configured on this port. pub rxq_num: u16, /// Number of transmit (Tx) queues configured on this port. pub txq_num: u16, /// Number of descriptors for each transmit (Tx) queue. /// Descriptors represent items in a queue to handle packets. pub tx_desc_num: u16, /// Number of descriptors for each receive (Rx) queue. pub rx_desc_num: u16, /// NUMA socket ID associated with the memory used by receive (Rx) queues. pub rxq_socket_id: u32, /// NUMA socket ID associated with the memory used by transmit (Tx) queues. pub txq_socket_id: u32, /// Memory pool associated with receive (Rx) queues. /// This manages the buffers used for storing incoming packets. pub rxq_mempool: Option>, } /// A trait defining basic operations for managing and interacting with a DPDK port. /// /// # Overview /// /// The `DpdkPort` trait standardizes how to operate on DPDK ports, making it possible to: /// - Configure the Ethernet device using [`configure`]. /// - Start the device using [`start`]. /// - Handle Rx and Tx bursts of packets using [`rx_burst`] and [`tx_burst`]. /// pub trait DpdkPort: Send + Sync { /// Returns the port ID of the DPDK port. /// /// # Return Value /// A `u16` that uniquely identifies the DPDK port. /// /// # Example /// ``` /// let port_id = dpdk_port.port_id(); /// println!("DPDK port ID: {}", port_id); /// ``` fn port_id(&self) -> u16; /// Returns a reference to the configuration object of the DPDK port. /// /// # Return Value /// A reference to [`DpdkPortConf`], which contains various settings like Rx/Tx queue configurations, /// memory pools, and NUMA socket IDs. /// /// # Example /// ``` /// let port_config = dpdk_port.port_conf(); /// println!("Rx queues: {}", port_config.rxq_num); /// ``` fn port_conf(&self) -> &DpdkPortConf; /// Configures the DPDK Ethernet device with the settings specified in the port configuration. /// /// This method is typically called before starting the port to ensure it is prepared for Rx and Tx operations. /// /// # Return Value /// - `Ok(())` if the configuration was applied successfully. /// - `Err(String)` with a descriptive error message if the configuration failed. /// /// # Example /// ``` /// let result = dpdk_port.configure(); /// if let Err(err) = result { /// eprintln!("Failed to configure the port: {}", err); /// } /// ``` fn configure(&mut self) -> Result<(), String>; /// Starts the DPDK Ethernet device. /// /// This method initializes the Rx and Tx queues, making the port ready for data transmission /// and reception. /// /// # Return Value /// - `Ok(())` if the port was started successfully. /// - `Err(String)` if the startup process failed, with a descriptive error message. /// /// # Example /// ``` /// let result = dpdk_port.start(); /// if let Err(err) = result { /// eprintln!("Failed to start the port: {}", err); /// } /// ``` fn start(&mut self) -> Result<(), String>; /// Receives a burst of packets on the specified Rx queue. /// /// # Parameters /// - `queue_id`: The ID of the Rx queue to receive packets from. /// - `pkts`: A mutable reference to an ar
RE: [EXTERNAL] Re: [PATCH v1 02/12] node: add IP4 lookup FIB node
Hi Nitin, >> lib/node/ip4_lookup_fib.c | 127 >++ >> lib/node/meson.build | 3 +- >> 2 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 >> lib/node/ip4_lookup_fib.c >> >> diff --git a/lib/node/ip4_lookup_fib.c b/lib/node/ip4_lookup_fib.c new >> file mode 100644 index 00..9c71610718 >> --- /dev/null >> +++ b/lib/node/ip4_lookup_fib.c >> @@ -0,0 +1,127 @@ >> +/* SPDX-License-Identifier: BSD-3-Clause >> + * Copyright(C) 2025 Marvell. >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#include "rte_node_ip4_api.h" >> + >> +#include "node_private.h" >> + >> +/* IP4 Lookup global data struct */ >> +struct ip4_lookup_fib_node_main { >> + struct rte_fib *fib[RTE_MAX_NUMA_NODES]; }; >> + >> +struct ip4_lookup_fib_node_ctx { >> + /* Socket's FIB */ >> + struct rte_fib *fib; >> + /* Dynamic offset to mbuf priv1 */ >> + int mbuf_priv1_off; >> +}; >> + >> +static struct ip4_lookup_fib_node_main ip4_lookup_fib_nm; >> + >> +#define FIB_MAX_ROUTES (1 << 16) >> +#define FIB_NUM_TBL8 (1 << 15) >> +#define FIB_DEFAULT_NH 999 > >These macros may not be required if we expose public setup_api() with >arguments. See below > >> + >> +#define IP4_LOOKUP_NODE_FIB(ctx) \ >> + (((struct ip4_lookup_fib_node_ctx *)ctx)->fib) >> + >> +#define IP4_LOOKUP_NODE_PRIV1_OFF(ctx) \ >> + (((struct ip4_lookup_fib_node_ctx *)ctx)->mbuf_priv1_off) >> + >> +static int >> +setup_fib(unsigned int socket) > >Should we add public API to allow applications to control MAX_ROUTES? >In a typical stack multiple fibs can be set up for each VRF (~~ port_id). > >A public API: > >int rte_ip4_lookup_fib_setup(int fib_index, int port_id, uint32_t >max_routes) where If a public API is used, then apart from max_routes other config values can also come from application. > >For now we can assume fib_index == 0, is global fib table (can be extended to >VRF later). Socket_id can be determined from port_Id > >> +{ >> + struct ip4_lookup_fib_node_main *nm = &ip4_lookup_fib_nm; >> + struct rte_fib_conf conf; >> + char s[RTE_FIB_NAMESIZE]; >> + >> + /* One fib per socket */ >> + if (nm->fib[socket]) >> + return 0; >> + >> + conf.type = RTE_FIB_DIR24_8; >> + conf.default_nh = FIB_DEFAULT_NH; > >FIB_DEFAULT_NH can be defined in such a way, fast path can decode next_edge >from return of rte_fib_lookup_bulk() Like union { > struct u64; > struct { > uint32_t next_hop_id; > uint16_t next_edge; > uint16_t. reserved; > }; >} rte_ip4_lookup_fib_nexthop_t; > >FIB_DEFAULT_NH should be set as > >rte_ip4_lookup_fib_nexthop_t default_next_hop = {.next_edge = >IP4_FIB_LOOKUP_NEXT_DROP} > >This way in fast path a return from fib_bulk() can be directly used to send >packet to pkt_drop node > >> + conf.max_routes = FIB_MAX_ROUTES; >> + conf.rib_ext_sz = 0; >> + conf.dir24_8.nh_sz = RTE_FIB_DIR24_8_4B; >> + conf.dir24_8.num_tbl8 = FIB_NUM_TBL8; >> + conf.flags = 0; >> + snprintf(s, sizeof(s), "IPV4_LOOKUP_FIB_%d", socket); >> + nm->fib[socket] = rte_fib_create(s, socket, &conf); >> + if (nm->fib[socket] == NULL) >> + return -rte_errno; >> + >> + return 0; >> +} >> + >> +static int >> +ip4_lookup_fib_node_init(const struct rte_graph *graph, struct >> +rte_node *node) { >> + static uint8_t init_once; >> + unsigned int socket; >> + uint16_t lcore_id; >> + int rc; >> + >> + RTE_BUILD_BUG_ON(sizeof(struct ip4_lookup_fib_node_ctx) > >> + RTE_NODE_CTX_SZ); >> + >> + if (!init_once) { >> + node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register( >> + &node_mbuf_priv1_dynfield_desc); >> + if (node_mbuf_priv1_dynfield_offset < 0) >> + return -rte_errno; > >You may need to rebase this patch on top of >https://urldefense.proofpoint.com/v2/url?u=https- >3A__patches.dpdk.org_project_dpdk_patch_20250409135554.2180390- >2D2-2Dnsaxena- >40marvell.com_&d=DwIFaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=ILjiNF3GF25y6 >QdHZUxMl6JrStU0MIuCtO5dMzn3Ybk&m=1hUHMoAkw- >1lUlg8qgybA7IfcnVOlVLxtms8KdhzsGpHV4vAjS2o5n7g-rJ- >0xLu&s=OAkNegP6hCJA0d3swI7FZ34IzVXE8DN5QHkNj15_S38&e= >for using global mbuf field Ok. > >> + >> + /* Setup FIB for all sockets */ >> + RTE_LCORE_FOREACH(lcore_id) > >Instead can be use rte_socket_count() which allow to loop for socket instead of >port? Ideally we may need to add fib for virtual interfaces or VRF (later) Ok. > >> + { >> + socket = rte_lcore_to_socket_id(lcore_id); >> + rc = setup_fib(socket); >> + if (rc) { >> + node_err("ip4_lookup_fib", >> +"Failed to setup fib for sock %u, >> rc=%d", >> +
RE: [EXTERNAL] Re: [PATCH v1 02/12] node: add IP4 lookup FIB node
Hi Vladimir, >On 15/04/2025 13:10, Ankur Dwivedi wrote: >> Adds a lookup FIB node for IP4. >> >> Signed-off-by: Ankur Dwivedi >> --- >> lib/node/ip4_lookup_fib.c | 127 >++ >> lib/node/meson.build | 3 +- >> 2 files changed, 129 insertions(+), 1 deletion(-) >> create mode 100644 lib/node/ip4_lookup_fib.c >> >> diff --git a/lib/node/ip4_lookup_fib.c b/lib/node/ip4_lookup_fib.c new >> file mode 100644 index 00..9c71610718 >> --- /dev/null >> +++ b/lib/node/ip4_lookup_fib.c >> @@ -0,0 +1,127 @@ >> +/* SPDX-License-Identifier: BSD-3-Clause >> + * Copyright(C) 2025 Marvell. >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#include "rte_node_ip4_api.h" >> + >> +#include "node_private.h" >> + >> +/* IP4 Lookup global data struct */ >> +struct ip4_lookup_fib_node_main { >> +struct rte_fib *fib[RTE_MAX_NUMA_NODES]; }; >> + >> +struct ip4_lookup_fib_node_ctx { >> +/* Socket's FIB */ >> +struct rte_fib *fib; >> +/* Dynamic offset to mbuf priv1 */ >> +int mbuf_priv1_off; >> +}; >> + >> +static struct ip4_lookup_fib_node_main ip4_lookup_fib_nm; >> + >> +#define FIB_MAX_ROUTES (1 << 16) >why only 64k routes? Modern BGP full view has about 1M prefixes >> +#define FIB_NUM_TBL8 (1 << 15) >> +#define FIB_DEFAULT_NH 999 >why this particular value? It is ok to use magic values in examples, but not >for >libs. Consider something like 0 or UINT{8,16,32,64}MAX or some meaningful >value within graph infra UINT{8,16,32,64}MAX should be fine. Also, I am thinking about taking the values in fib conf as input from application. >> + >> +#define IP4_LOOKUP_NODE_FIB(ctx) \ >> +(((struct ip4_lookup_fib_node_ctx *)ctx)->fib) >> + >> +#define IP4_LOOKUP_NODE_PRIV1_OFF(ctx) \ >> +(((struct ip4_lookup_fib_node_ctx *)ctx)->mbuf_priv1_off) >> + >> +static int >> +setup_fib(unsigned int socket) >> +{ >> +struct ip4_lookup_fib_node_main *nm = &ip4_lookup_fib_nm; >> +struct rte_fib_conf conf; >> +char s[RTE_FIB_NAMESIZE]; >> + >> +/* One fib per socket */ >> +if (nm->fib[socket]) >> +return 0; >> + >> +conf.type = RTE_FIB_DIR24_8; >> +conf.default_nh = FIB_DEFAULT_NH; >> +conf.max_routes = FIB_MAX_ROUTES; >> +conf.rib_ext_sz = 0; >> +conf.dir24_8.nh_sz = RTE_FIB_DIR24_8_4B; >> +conf.dir24_8.num_tbl8 = FIB_NUM_TBL8; >> +conf.flags = 0; >> +snprintf(s, sizeof(s), "IPV4_LOOKUP_FIB_%d", socket); >> +nm->fib[socket] = rte_fib_create(s, socket, &conf); >> +if (nm->fib[socket] == NULL) >> +return -rte_errno; >> + >> +return 0; >> +} >> + >> +static int >> +ip4_lookup_fib_node_init(const struct rte_graph *graph, struct >> +rte_node *node) { >> +static uint8_t init_once; >> +unsigned int socket; >> +uint16_t lcore_id; >> +int rc; >> + >> +RTE_BUILD_BUG_ON(sizeof(struct ip4_lookup_fib_node_ctx) > >> +RTE_NODE_CTX_SZ); >> + >> +if (!init_once) { >> +node_mbuf_priv1_dynfield_offset = >rte_mbuf_dynfield_register( >> +&node_mbuf_priv1_dynfield_desc); >> +if (node_mbuf_priv1_dynfield_offset < 0) >> +return -rte_errno; >> + >> +/* Setup FIB for all sockets */ >> +RTE_LCORE_FOREACH(lcore_id) >> +{ >> +socket = rte_lcore_to_socket_id(lcore_id); >> +rc = setup_fib(socket); >> +if (rc) { >> +node_err("ip4_lookup_fib", >> + "Failed to setup fib for sock %u, >rc=%d", >> + socket, rc); >> +return rc; >> +} >> +} >> +init_once = 1; >> +} >> + >> +/* Update socket's FIB and mbuf dyn priv1 offset in node ctx */ >> +IP4_LOOKUP_NODE_FIB(node->ctx) = ip4_lookup_fib_nm.fib[graph- >>socket]; >> +IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx) = >> +node_mbuf_priv1_dynfield_offset; >> + >> +node_dbg("ip4_lookup_fib", "Initialized ip4_lookup_fib node"); >> + >> +return 0; >> +} >> + >> +static struct rte_node_xstats ip4_lookup_fib_xstats = { >> +.nb_xstats = 1, >> +.xstat_desc = { >> +[0] = "ip4_lookup_fib_error", >> +}, >> +}; >> + >> +static struct rte_node_register ip4_lookup_fib_node = { >> +.name = "ip4_lookup_fib", >> + >> +.init = ip4_lookup_fib_node_init, >> +.xstats = &ip4_lookup_fib_xstats, >> + >> +.nb_edges = RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP + 1, >> +.next_nodes = { >> +[RTE_NODE_IP4_LOOKUP_NEXT_IP4_LOCAL] = "ip4_local", >> +[RTE_NODE_IP4_LOOKUP_NEXT_REWRITE] = "ip4_rewrite", >> +[RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP] = "pkt_drop", >> +}, >> +}; >> + >> +RTE_NODE_REGISTER(ip4_lookup_fib_node); >> diff --git a/lib/node/meson.build b/lib/node/meson.build index >> 0bed97a96c..d2011c8f56 100
[25.11 PATCH 1/3] dmadev: add enqueue dequeue operations
From: Pavan Nikhilesh Add enqueue/dequeue operations that use struct rte_dma_op to communicate with the dma device. These operations need to be enabled at dma device configuration time by setting the flag rte_dma_conf::enable_enq_deq if the device supports RTE_DMA_CAPA_OPS_ENQ_DEQ capability. The enqueue dequeue operations are not compatible with rte_dma_copy, rte_dma_copy_sg, rte_dma_fill, rte_dma_submit, rte_dma_completed, rte_dma_completed_status range of APIs. Signed-off-by: Pavan Nikhilesh --- app/test/test_dmadev.c | 160 +++ app/test/test_dmadev_api.c | 78 +++-- doc/guides/prog_guide/dmadev.rst | 34 ++ drivers/dma/dpaa/dpaa_qdma.c | 2 +- drivers/dma/dpaa2/dpaa2_qdma.c | 2 +- lib/dmadev/rte_dmadev.c | 30 - lib/dmadev/rte_dmadev.h | 155 -- lib/dmadev/rte_dmadev_core.h | 10 ++ lib/dmadev/rte_dmadev_trace.h| 2 +- lib/dmadev/rte_dmadev_trace_fp.h | 20 lib/dmadev/rte_dmadev_trace_points.c | 6 + 11 files changed, 477 insertions(+), 22 deletions(-) diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c index 9cbb9a6552..e9a62a0ddf 100644 --- a/app/test/test_dmadev.c +++ b/app/test/test_dmadev.c @@ -1052,6 +1052,147 @@ prepare_m2d_auto_free(int16_t dev_id, uint16_t vchan) return 0; } +static int +test_enq_deq_ops(int16_t dev_id, uint16_t vchan) +{ +#define BURST_SIZE 16 +#define ROUNDS2E7 +#define CPY_LEN 64 + struct rte_mempool *ops_pool, *pkt_pool; + struct rte_mbuf *mbufs[BURST_SIZE * 2]; + struct rte_dma_op *ops[BURST_SIZE]; + uint64_t enq_lat, deq_lat, start; + int ret, i, j, enq, deq, n, max; + struct rte_dma_sge ssg, dsg; + struct rte_dma_info info; + uint64_t tenq, tdeq; + + memset(&info, 0, sizeof(info)); + ret = rte_dma_info_get(dev_id, &info); + if (ret != 0) + ERR_RETURN("Error with rte_dma_info_get()\n"); + + pkt_pool = rte_pktmbuf_pool_create("pkt_pool", info.max_desc * 2, 0, 0, + CPY_LEN + RTE_PKTMBUF_HEADROOM, rte_socket_id()); + if (pkt_pool == NULL) + ERR_RETURN("Error creating pkt pool\n"); + + ops_pool = rte_mempool_create("ops_pool", info.max_desc, + sizeof(struct rte_dma_op) + (sizeof(struct rte_dma_sge) * 2), + 0, 0, NULL, NULL, NULL, NULL, rte_socket_id(), 0); + if (ops_pool == NULL) + ERR_RETURN("Error creating ops pool\n"); + + max = info.max_desc - BURST_SIZE; + tenq = 0; + tdeq = 0; + enq_lat = 0; + deq_lat = 0; + + for (i = 0; i < ROUNDS / max; i++) { + n = 0; + while (n != max) { + if (rte_mempool_get_bulk(ops_pool, (void **)ops, BURST_SIZE) != 0) + continue; + + if (rte_pktmbuf_alloc_bulk(pkt_pool, mbufs, BURST_SIZE * 2) != 0) + ERR_RETURN("Error allocating mbufs %d\n", n); + + for (j = 0; j < BURST_SIZE; j++) { + ops[j]->src_dst_seg[0].addr = rte_pktmbuf_iova(mbufs[j]); + ops[j]->src_dst_seg[1].addr = + rte_pktmbuf_iova(mbufs[j + BURST_SIZE]); + ops[j]->src_dst_seg[0].length = CPY_LEN; + ops[j]->src_dst_seg[1].length = CPY_LEN; + + ops[j]->nb_src = 1; + ops[j]->nb_dst = 1; + ops[j]->user_meta = (uint64_t)mbufs[j]; + ops[j]->event_meta = (uint64_t)mbufs[j + BURST_SIZE]; + + memset((void *)(uintptr_t)ops[j]->src_dst_seg[0].addr, + rte_rand() & 0xFF, CPY_LEN); + memset((void *)(uintptr_t)ops[j]->src_dst_seg[1].addr, 0, CPY_LEN); + } + + start = rte_rdtsc_precise(); + enq = rte_dma_enqueue_ops(dev_id, vchan, ops, BURST_SIZE); + while (enq != BURST_SIZE) { + enq += rte_dma_enqueue_ops(dev_id, vchan, ops + enq, + BURST_SIZE - enq); + } + + enq_lat += rte_rdtsc_precise() - start; + n += enq; + } + tenq += n; + + memset(ops, 0, sizeof(ops)); + n = 0; + while (n != max) { + start = rte_rdtsc_precise(); + deq = rte_dma_dequeue_ops(dev_id, vchan, ops, BURST_SIZE); + while (deq != BURST_SIZE) { +
[25.11 PATCH 2/3] dma/cnxk: implement enqueue dequeue ops
From: Pavan Nikhilesh Implement DMA enqueue/dequeue operations when application enables it via configuration. Signed-off-by: Pavan Nikhilesh --- drivers/dma/cnxk/cnxk_dmadev.c| 58 ++--- drivers/dma/cnxk/cnxk_dmadev.h| 7 ++ drivers/dma/cnxk/cnxk_dmadev_fp.c | 140 ++ 3 files changed, 191 insertions(+), 14 deletions(-) diff --git a/drivers/dma/cnxk/cnxk_dmadev.c b/drivers/dma/cnxk/cnxk_dmadev.c index 90bb69011f..3e45ef7d02 100644 --- a/drivers/dma/cnxk/cnxk_dmadev.c +++ b/drivers/dma/cnxk/cnxk_dmadev.c @@ -7,6 +7,7 @@ #include static int cnxk_stats_reset(struct rte_dma_dev *dev, uint16_t vchan); +static void cnxk_set_fp_ops(struct rte_dma_dev *dev, uint8_t enable_enq_deq); static int cnxk_dmadev_info_get(const struct rte_dma_dev *dev, struct rte_dma_info *dev_info, uint32_t size) @@ -19,7 +20,7 @@ cnxk_dmadev_info_get(const struct rte_dma_dev *dev, struct rte_dma_info *dev_inf dev_info->dev_capa = RTE_DMA_CAPA_MEM_TO_MEM | RTE_DMA_CAPA_MEM_TO_DEV | 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; +RTE_DMA_CAPA_M2D_AUTO_FREE | RTE_DMA_CAPA_OPS_ENQ_DEQ; if (roc_feature_dpi_has_priority()) { dev_info->dev_capa |= RTE_DMA_CAPA_PRI_POLICY_SP; dev_info->nb_priorities = CN10K_DPI_MAX_PRI; @@ -114,6 +115,8 @@ cnxk_dmadev_configure(struct rte_dma_dev *dev, const struct rte_dma_conf *conf, if (roc_feature_dpi_has_priority()) dpivf->rdpi.priority = conf->priority; + cnxk_set_fp_ops(dev, conf->flags & RTE_DMA_CFG_FLAG_ENQ_DEQ); + return 0; } @@ -270,6 +273,14 @@ cnxk_dmadev_vchan_setup(struct rte_dma_dev *dev, uint16_t vchan, return -ENOMEM; } + size = (max_desc * sizeof(struct rte_dma_op *)); + dpi_conf->c_desc.ops = rte_zmalloc(NULL, size, RTE_CACHE_LINE_SIZE); + if (dpi_conf->c_desc.ops == NULL) { + plt_err("Failed to allocate for ops array"); + rte_free(dpi_conf->c_desc.compl_ptr); + return -ENOMEM; + } + for (i = 0; i < max_desc; i++) dpi_conf->c_desc.compl_ptr[i * CNXK_DPI_COMPL_OFFSET] = CNXK_DPI_REQ_CDATA; @@ -528,6 +539,37 @@ cnxk_stats_reset(struct rte_dma_dev *dev, uint16_t vchan) return 0; } +static void +cnxk_set_fp_ops(struct rte_dma_dev *dev, uint8_t ena_enq_deq) +{ + + dev->fp_obj->copy = cnxk_dmadev_copy; + dev->fp_obj->copy_sg = cnxk_dmadev_copy_sg; + dev->fp_obj->submit = cnxk_dmadev_submit; + dev->fp_obj->completed = cnxk_dmadev_completed; + dev->fp_obj->completed_status = cnxk_dmadev_completed_status; + dev->fp_obj->burst_capacity = cnxk_damdev_burst_capacity; + + if (roc_model_is_cn10k()) { + dev->fp_obj->copy = cn10k_dmadev_copy; + dev->fp_obj->copy_sg = cn10k_dmadev_copy_sg; + } + + if (ena_enq_deq) { + dev->fp_obj->copy = NULL; + dev->fp_obj->copy_sg = NULL; + dev->fp_obj->submit = NULL; + dev->fp_obj->completed = NULL; + dev->fp_obj->completed_status = NULL; + + dev->fp_obj->enqueue = cnxk_dma_ops_enqueue; + dev->fp_obj->dequeue = cnxk_dma_ops_dequeue; + + if (roc_model_is_cn10k()) + dev->fp_obj->enqueue = cn10k_dma_ops_enqueue; + } +} + static const struct rte_dma_dev_ops cnxk_dmadev_ops = { .dev_close = cnxk_dmadev_close, .dev_configure = cnxk_dmadev_configure, @@ -571,19 +613,7 @@ cnxk_dmadev_probe(struct rte_pci_driver *pci_drv __rte_unused, struct rte_pci_de dmadev->fp_obj->dev_private = dpivf; dmadev->dev_ops = &cnxk_dmadev_ops; - dmadev->fp_obj->copy = cnxk_dmadev_copy; - dmadev->fp_obj->copy_sg = cnxk_dmadev_copy_sg; - dmadev->fp_obj->submit = cnxk_dmadev_submit; - dmadev->fp_obj->completed = cnxk_dmadev_completed; - dmadev->fp_obj->completed_status = cnxk_dmadev_completed_status; - dmadev->fp_obj->burst_capacity = cnxk_damdev_burst_capacity; - - if (roc_model_is_cn10k()) { - dpivf->is_cn10k = true; - dmadev->fp_obj->copy = cn10k_dmadev_copy; - dmadev->fp_obj->copy_sg = cn10k_dmadev_copy_sg; - } - + dpivf->is_cn10k = roc_model_is_cn10k(); dpivf->mcs_lock = NULL; rdpi = &dpivf->rdpi; diff --git a/drivers/dma/cnxk/cnxk_dmadev.h b/drivers/dma/cnxk/cnxk_dmadev.h index 9a232a5464..18039e43fb 100644 --- a/drivers/dma/cnxk/cnxk_dmadev.h +++ b/drivers/dma/cnxk/cnxk_dmadev.h @@ -93,6 +93,7 @@ struct cnxk_dpi_cdesc_data_s { uint16_t head; uint16_t tail; uint8_t *compl_ptr; + struct rte_dma_op **ops; }; struct cnxk_dpi_co
[25.11 PATCH 0/3] Introduce DMA enqueue/dequeue operations
From: Pavan Nikhilesh Introduce DMA enqueue/dequeue operations to the DMA device library. Add configuration flags to rte_dma_config instead of boolean for individual features. The enqueue/dequeue operations allow applications to communicate with the DMA device using the rte_dma_op structure, providing a more flexible and efficient way to manage DMA operations. The programming model for the enqueue/dequeue operations is as follows: * Query DMA devices capability for RTE_DMA_CAPA_OPS_ENQ_DEQ through rte_dma_info::dev_capa. * Enable enqueue/dequeue operations on DMA device by enabling the flag RTE_DMA_CFG_FLAG_ENQ_DEQ in rte_dma_config::flags during device configuration. * Allocate a mempool for rte_dma_ops with object size of rte_dma_op + (sizeof(struct rte_dma_sge) * rte_dma_info::max_sges * 2). * Configure vchans and start the dma device. * Get an rte_dma_op from the mempool, fill it with the necessary information and use rte_dma_enqueue() to enqueue the operation. * Call rte_dma_dequeue() operation to get the array of finished operations. * Free the rte_dma_op back to the mempool. The enqueue dequeue operations are not compatible with rte_dma_copy, rte_dma_copy_sg, rte_dma_fill, rte_dma_submit, rte_dma_completed and rte_dma_completed_status range of APIs. Pavan Nikhilesh (3): dmadev: add enqueue dequeue operations dma/cnxk: implement enqueue dequeue ops eventdev: refactor DMA adapter ops app/test-eventdev/test_perf_common.c | 6 +- app/test-eventdev/test_perf_common.h | 4 +- app/test/test_dmadev.c| 160 ++ app/test/test_dmadev_api.c| 78 - app/test/test_event_dma_adapter.c | 6 +- doc/guides/prog_guide/dmadev.rst | 34 .../prog_guide/eventdev/event_dma_adapter.rst | 6 +- drivers/dma/cnxk/cnxk_dmadev.c| 60 +-- drivers/dma/cnxk/cnxk_dmadev.h| 7 + drivers/dma/cnxk/cnxk_dmadev_fp.c | 152 - drivers/dma/dpaa/dpaa_qdma.c | 2 +- drivers/dma/dpaa2/dpaa2_qdma.c| 2 +- lib/dmadev/rte_dmadev.c | 30 +++- lib/dmadev/rte_dmadev.h | 155 - lib/dmadev/rte_dmadev_core.h | 10 ++ lib/dmadev/rte_dmadev_trace.h | 2 +- lib/dmadev/rte_dmadev_trace_fp.h | 20 +++ lib/dmadev/rte_dmadev_trace_points.c | 6 + lib/eventdev/rte_event_dma_adapter.c | 18 +- lib/eventdev/rte_event_dma_adapter.h | 57 --- 20 files changed, 695 insertions(+), 120 deletions(-) -- 2.43.0
[25.11 PATCH 3/3] eventdev: refactor DMA adapter ops
From: Pavan Nikhilesh Migrate all invocations of rte_event_dma_adapter_op API to rte_dma_op. Signed-off-by: Pavan Nikhilesh Acked-by: Amit Prakash Shukla --- app/test-eventdev/test_perf_common.c | 6 +- app/test-eventdev/test_perf_common.h | 4 +- app/test/test_event_dma_adapter.c | 6 +- .../prog_guide/eventdev/event_dma_adapter.rst | 6 +- drivers/dma/cnxk/cnxk_dmadev.c| 2 +- drivers/dma/cnxk/cnxk_dmadev_fp.c | 12 ++-- lib/eventdev/rte_event_dma_adapter.c | 18 +++--- lib/eventdev/rte_event_dma_adapter.h | 57 --- 8 files changed, 27 insertions(+), 84 deletions(-) diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c index 627f07caa1..4e0109db52 100644 --- a/app/test-eventdev/test_perf_common.c +++ b/app/test-eventdev/test_perf_common.c @@ -562,11 +562,11 @@ crypto_adapter_enq_op_fwd(struct prod_data *p) static inline void dma_adapter_enq_op_fwd(struct prod_data *p) { - struct rte_event_dma_adapter_op *ops[BURST_SIZE] = {NULL}; + struct rte_dma_op *ops[BURST_SIZE] = {NULL}; struct test_perf *t = p->t; const uint32_t nb_flows = t->nb_flows; const uint64_t nb_pkts = t->nb_pkts; - struct rte_event_dma_adapter_op op; + struct rte_dma_op op; struct rte_event evts[BURST_SIZE]; const uint8_t dev_id = p->dev_id; struct evt_options *opt = t->opt; @@ -2114,7 +2114,7 @@ perf_mempool_setup(struct evt_test *test, struct evt_options *opt) } else if (opt->prod_type == EVT_PROD_TYPE_EVENT_DMA_ADPTR) { t->pool = rte_mempool_create(test->name, /* mempool name */ opt->pool_sz, /* number of elements*/ -sizeof(struct rte_event_dma_adapter_op) + +sizeof(struct rte_dma_op) + (sizeof(struct rte_dma_sge) * 2), cache_sz, /* cache size*/ 0, NULL, NULL, NULL, /* obj constructor */ diff --git a/app/test-eventdev/test_perf_common.h b/app/test-eventdev/test_perf_common.h index d7333ad390..63078b0ee2 100644 --- a/app/test-eventdev/test_perf_common.h +++ b/app/test-eventdev/test_perf_common.h @@ -139,7 +139,7 @@ perf_mark_fwd_latency(enum evt_prod_type prod_type, struct rte_event *const ev) } pe->timestamp = rte_get_timer_cycles(); } else if (prod_type == EVT_PROD_TYPE_EVENT_DMA_ADPTR) { - struct rte_event_dma_adapter_op *op = ev->event_ptr; + struct rte_dma_op *op = ev->event_ptr; op->user_meta = rte_get_timer_cycles(); } else { @@ -297,7 +297,7 @@ perf_process_last_stage_latency(struct rte_mempool *const pool, enum evt_prod_ty tstamp = pe->timestamp; rte_crypto_op_free(op); } else if (prod_type == EVT_PROD_TYPE_EVENT_DMA_ADPTR) { - struct rte_event_dma_adapter_op *op = ev->event_ptr; + struct rte_dma_op *op = ev->event_ptr; to_free_in_bulk = op; tstamp = op->user_meta; diff --git a/app/test/test_event_dma_adapter.c b/app/test/test_event_dma_adapter.c index 9988d4fc7b..7f72a4e81d 100644 --- a/app/test/test_event_dma_adapter.c +++ b/app/test/test_event_dma_adapter.c @@ -234,7 +234,7 @@ test_op_forward_mode(void) { struct rte_mbuf *src_mbuf[TEST_MAX_OP]; struct rte_mbuf *dst_mbuf[TEST_MAX_OP]; - struct rte_event_dma_adapter_op *op; + struct rte_dma_op *op; struct rte_event ev[TEST_MAX_OP]; int ret, i; @@ -266,7 +266,7 @@ test_op_forward_mode(void) op->vchan = TEST_DMA_VCHAN_ID; op->event_meta = dma_response_info.event; - /* Fill in event info and update event_ptr with rte_event_dma_adapter_op */ + /* Fill in event info and update event_ptr with rte_dma_op */ memset(&ev[i], 0, sizeof(struct rte_event)); ev[i].event = 0; ev[i].op = RTE_EVENT_OP_NEW; @@ -396,7 +396,7 @@ configure_dmadev(void) rte_socket_id()); RTE_TEST_ASSERT_NOT_NULL(params.dst_mbuf_pool, "Can't create DMA_DST_MBUFPOOL\n"); - elt_size = sizeof(struct rte_event_dma_adapter_op) + (sizeof(struct rte_dma_sge) * 2); + elt_size = sizeof(struct rte_dma_op) + (sizeof(struct rte_dma_sge) * 2); params.op_mpool = rte_mempool_create("EVENT_DMA_OP_POOL", DMA_OP_POOL_SIZE, elt_size, 0, 0, NULL, NULL, NULL, NULL, rte_socket_id(), 0); RTE_TEST_ASSERT_NOT_NULL(params.op_mpool, "Can't create DMA_OP_POOL\n"); diff --git a/doc/guides/prog_guide/eventdev/event_dma_ada
Re: [RFC PATCH 1/4] ethdev: add support to provide link type
On Wed, Apr 16, 2025 at 5:33 AM Stephen Hemminger wrote: > > On Tue, 15 Apr 2025 12:38:18 +0530 > Nithin Dabilpuram wrote: > > > On Fri, Apr 4, 2025 at 6:16 AM Stephen Hemminger > > wrote: > > > > > > On Thu, 3 Apr 2025 12:38:34 +0530 > > > Nithin Dabilpuram wrote: > > > > > > > /** > > > > * A structure used to retrieve link-level information of an Ethernet > > > > port. > > > > */ > > > > @@ -341,6 +354,7 @@ struct rte_eth_link { > > > > uint16_t link_duplex : 1; /**< > > > > RTE_ETH_LINK_[HALF/FULL]_DUPLEX */ > > > > uint16_t link_autoneg : 1; /**< > > > > RTE_ETH_LINK_[AUTONEG/FIXED] */ > > > > uint16_t link_status : 1; /**< > > > > RTE_ETH_LINK_[DOWN/UP] */ > > > > + uint16_t link_type: 5; /**< > > > > RTE_ETH_LINK_TYPE_* */ > > > > }; > > > > }; > > > > }; > > > > > > Seems like an ABI break, and not sure that all drivers will fill those > > > bits with zero now. > > > > Generally ABI is between APP and all DPDK libraries/PMD and not > > between DPDK libraries and PMD ? > > The problem is rte_eth_link is returne by rte_eth_link_get which is exposed > to the application. Which scenario you are talking about here ?
Re: [PATCH 4/4] ci: check licenses
On 4/16/25 2:34 PM, Maxime Coquelin wrote: From: David Marchand Call check-spdx.tag.sh so that all committed files are checked. Signed-off-by: David Marchand Acked-by: Aaron Conole --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7a6b679fe5..1e289979e3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,6 +31,7 @@ jobs: failed= devtools/check-doc-vs-code.sh upstream/${{ env.REF_GIT_BRANCH }} || failed=true devtools/check-meson.py || failed=true +devtools/check-spdx-tag.sh || failed=true [ -z "$failed" ] ubuntu-vm-builds: name: ${{ join(matrix.config.*, '-') }} Please ignore this patch, I used it for testing purpose and missed to remove it before posting.
Re: [PATCH 00/46] Support AMD Solarflare X45xx adaptors
On Wed, 16 Apr 2025 21:37:09 +0400 (+04) Ivan Malov wrote: > On Wed, 16 Apr 2025, Stephen Hemminger wrote: > > > On Wed, 16 Apr 2025 19:38:58 +0400 (+04) > > Ivan Malov wrote: > > > >> On Wed, 16 Apr 2025, Stephen Hemminger wrote: > >> > >>> On Wed, 16 Apr 2025 17:59:30 +0400 > >>> Ivan Malov wrote: > >>> > New X4522 (dual port SFP56) and X4542 (dual port QSFP56) adaptors are > Medford4 (X4) chips that are based on EF10 architecture. An X4 NIC > supports multiple network engine types. This series provides support > only for the Medford2-alike, 'full-feature' (FF) network engine. This > shall not be confused with the concept of 'datapath FW variants': the > FF network engine supports both 'full-feature' and 'ultra-low-latency' > datapath FW variants, with corresponding Medford2-alike feature sets. > > The first part of the series provides general support for the adaptors, > whilst the second one adds support for the new management controller > interface for configuration of network port features (netport MCDI). > > For now, only support for physical functions (PFs) is concerned. There > is a small number of TODO and FIXME markings in the code. Those are > normal at this development stage and will be removed by future patches > when VF support has fleshed out. > > > Andy Moreton (3): > common/sfc_efx/base: update X4 BAR layout and PCI IDs > net/sfc: add Medford4 with only full feature datapath engine > common/sfc_efx/base: add port mode for 8 port hardware > > Denis Pryazhennikov (15): > common/sfc_efx/base: add Medford4 PCI IDs to common code > common/sfc_efx/base: add efsys option for Medford4 > common/sfc_efx/base: add Medford4 support to NIC module > common/sfc_efx/base: add Medford4 support to EV module > common/sfc_efx/base: add Medford4 support to FILTER module > common/sfc_efx/base: add Medford4 support to INTR module > common/sfc_efx/base: add Medford4 support to MAC module > common/sfc_efx/base: add Medford4 support to PHY module > common/sfc_efx/base: add Medford4 support to TUNNEL module > common/sfc_efx/base: add Medford4 support to MCDI module > common/sfc_efx/base: add Medford4 support to Rx module > common/sfc_efx/base: add Medford4 support to Tx module > drivers: enable support for AMD Solarflare X4 adapter family > common/sfc_efx/base: add new X4 port mode > common/sfc_efx/base: extend list of supported X4 port modes > > Ivan Malov (28): > common/sfc_efx/base: update MCDI headers > common/sfc_efx/base: provide a stub for basic netport attach > common/sfc_efx/base: provide defaults on netport attach path > common/sfc_efx/base: obtain assigned netport handle from NIC > common/sfc_efx/base: allow for const in MCDI struct accessor > common/sfc_efx/base: get netport fixed capabilities on probe > common/sfc_efx/base: decode netport link state on probe path > common/sfc_efx/base: fill in loopback modes on netport probe > common/sfc_efx/base: introduce Medford4 stub for PHY methods > common/sfc_efx/base: refactor EF10 link mode decoding helper > common/sfc_efx/base: provide PHY link get method on Medford4 > common/sfc_efx/base: implement PHY link control for Medford4 > common/sfc_efx/base: introduce Medford4 stub for MAC methods > common/sfc_efx/base: add MAC reconfigure method for Medford4 > common/sfc_efx/base: fill in software LUT for MAC statistics > common/sfc_efx/base: fill in MAC statistics mask on Medford4 > common/sfc_efx/base: support MAC statistics on Medford4 NICs > common/sfc_efx/base: implement MAC PDU controls for Medford4 > common/sfc_efx/base: correct MAC PDU calculation on Medford4 > net/sfc: make use of generic EFX MAC PDU calculation helpers > common/sfc_efx/base: ignore legacy link events on new boards > common/sfc_efx/base: add link event processing on new boards > net/sfc: query link status on link change events on new NICs > common/sfc_efx/base: subscribe to netport link change events > net/sfc: offer support for 200G link ability on new adaptors > common/sfc_efx/base: support controls for netport lane count > net/sfc: add support for control of physical port lane count > doc: advertise support for AMD Solarflare X45xx adapters > > .mailmap |3 +- > doc/guides/nics/sfc_efx.rst |9 +- > doc/guides/rel_notes/release_25_07.rst|4 + > drivers/common/sfc_efx/base/ef10_ev.c | 39 + > drivers/common/sfc_efx/base/ef10_impl.h | 19 + > drivers/common/sfc_efx/base/ef10_nic.c| 98 +- > drivers/common/sfc_
[PATCH v4 0/4] allow pmdinfo to be inserted and parsed using MSVC
DPDK uses GCC attribute "used" through macro __rte_used to indicate that a variable not referenced in the code should be assumed being used and therefore not be optimized away. This technique is used to embed information in the binaries, by having crafted information stored in them. MSVC offers similar functionality, but it differs significantly: MSVC requires a pragma to be used to send a command to the linker telling it explicitly the name of the symbol that should be included (even if not referenced). As a side-effect, variables called out to be included cannot be static, otherwise their symbols are not "seen" by the linker. This restriction requires some DPDK code to be refactored. Macro RTE_INCLUDE is used in this patch to ensure these special variables make it to the final binaries. The elimination of "static" for some of these variables caused name clashes when __COUNTER__ predefined macro was used. As a workaround, predefined macro __LINE__ was used instead. However, when __COUNTER__ was used directly from a header file, __LINE__ had to be used from the .c files, otherwise it would also not result in a unique symbol. This required a parameter to be added to some macros so that the __LINE__ could be passed from the .c file to the macro defined in the header (which was originally using __COUNTER__). With this patchset commands like the one below provide the same JSON output as would be obtained on Linux. python usertools\dpdk-pmdinfo.py build\app\dpdk-testpmd.exe v4: - limited the use of __LINE__ to the header files, reducing number of changes made in previous versions of this patchset. v3: - ge-pmdinfo-cfile.py: fixed archiver's syntax to extract object from library - dpdk-pmdinfo.py: removed is_windows() and replaced with os.name == "nt" v2: - dpdk-pmdinfo.py: not importing elftools on Windows - not requiring "pefile" Python module during build - gen-pmdinfo-cfile.py: renamed "ar" to "archiver" Andre Muezerie (4): eal: add macro to embed information in binaries buildtools: use macro to embed information in binaries usertools: parse strings from PE images drivers: use macro to embed information in binaries buildtools/gen-pmdinfo-cfile.py | 24 +++-- buildtools/meson.build | 4 +- buildtools/pmdinfogen.py | 11 ++-- drivers/bus/auxiliary/bus_auxiliary_driver.h | 2 +- drivers/bus/cdx/bus_cdx_driver.h | 5 +- drivers/bus/dpaa/bus_dpaa_driver.h | 2 +- drivers/bus/fslmc/bus_fslmc_driver.h | 4 +- drivers/bus/ifpga/bus_ifpga_driver.h | 2 +- drivers/bus/pci/bus_pci_driver.h | 2 +- drivers/bus/platform/bus_platform_driver.h | 2 +- drivers/bus/uacce/bus_uacce_driver.h | 2 +- drivers/bus/vdev/bus_vdev_driver.h | 2 +- drivers/bus/vmbus/bus_vmbus_driver.h | 2 +- drivers/common/mlx5/mlx5_common.c| 2 +- drivers/common/mlx5/mlx5_common_pci.c| 2 +- drivers/common/nitrox/nitrox_device.c| 1 + drivers/compress/mlx5/mlx5_compress.c| 2 +- drivers/crypto/mlx5/mlx5_crypto.c| 2 +- drivers/event/octeontx/ssovf_evdev.c | 1 + drivers/net/mlx4/mlx4.c | 2 +- drivers/net/mlx5/mlx5.c | 2 +- drivers/net/virtio/virtio_pci_ethdev.c | 2 +- drivers/regex/mlx5/mlx5_regex.c | 2 +- drivers/vdpa/mlx5/mlx5_vdpa.c| 2 +- lib/eal/common/eal_common_options.c | 2 +- lib/eal/include/rte_common.h | 6 +++ lib/eal/include/rte_dev.h| 14 ++ usertools/dpdk-pmdinfo.py| 53 28 files changed, 106 insertions(+), 53 deletions(-) -- 2.49.0.vfs.0.0
[PATCH v4 2/4] buildtools: use macro to embed information in binaries
The archiver tool from the MSVC toolset is lib.exe. It has different parameters then it's GNU counterpart "ar". buildtools\meson.build was updated to use lib.exe when MSVC compiler is used. This is to allow the code to be built without requiring GNU "ar" to be installed in that scenario. Script gen-pmdinfo-cfile.py was updated to use the correct parameters when using lib.exe. Signed-off-by: Andre Muezerie --- buildtools/gen-pmdinfo-cfile.py | 24 +++- buildtools/meson.build | 4 +++- buildtools/pmdinfogen.py| 11 ++- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/buildtools/gen-pmdinfo-cfile.py b/buildtools/gen-pmdinfo-cfile.py index 5fbd51658a..3a078ab6d1 100644 --- a/buildtools/gen-pmdinfo-cfile.py +++ b/buildtools/gen-pmdinfo-cfile.py @@ -7,15 +7,29 @@ import sys import tempfile -_, tmp_root, ar, archive, output, *pmdinfogen = sys.argv +_, tmp_root, archiver, archive, output, *pmdinfogen = sys.argv with tempfile.TemporaryDirectory(dir=tmp_root) as temp: paths = [] -for name in subprocess.run([ar, "t", archive], stdout=subprocess.PIPE, - check=True).stdout.decode().splitlines(): +if archiver == "lib": +archiver_options = ["/LIST", "/NOLOGO"] +else: +archiver_options = ["t"] +for name in ( +subprocess.run( +[archiver] + archiver_options + [archive], +stdout=subprocess.PIPE, +check=True, +) +.stdout.decode() +.splitlines() +): if os.path.exists(name): paths.append(name) else: -subprocess.run([ar, "x", os.path.abspath(archive), name], - check=True, cwd=temp) +if archiver == "lib": +run_args = [archiver, f"/EXTRACT:{name}", os.path.abspath(archive)] +else: +run_args = [archiver, "x", os.path.abspath(archive), name] +subprocess.run(run_args, check=True, cwd=temp) paths.append(os.path.join(temp, name)) subprocess.run(pmdinfogen + paths + [output], check=True) diff --git a/buildtools/meson.build b/buildtools/meson.build index 1cd1ce02fd..11221f02ea 100644 --- a/buildtools/meson.build +++ b/buildtools/meson.build @@ -37,7 +37,9 @@ install_data([ pmdinfo = py3 + files('gen-pmdinfo-cfile.py') + [meson.current_build_dir()] pmdinfogen = py3 + files('pmdinfogen.py') if host_machine.system() == 'windows' -if cc.get_id() == 'gcc' +if cc.get_id() == 'msvc' +pmdinfo += 'lib' +elif cc.get_id() == 'gcc' pmdinfo += 'ar' else pmdinfo += 'llvm-ar' diff --git a/buildtools/pmdinfogen.py b/buildtools/pmdinfogen.py index dfb89500c0..710913083f 100755 --- a/buildtools/pmdinfogen.py +++ b/buildtools/pmdinfogen.py @@ -87,7 +87,7 @@ def get_value(self, offset, size): @property def string_value(self): value = self._symbol.get_value(0) -return coff.decode_asciiz(value) if value else '' +return coff.decode_asciiz(value) if value else "" class COFFImage: @@ -192,7 +192,7 @@ def dump(self, file): dumped = json.dumps(self.__dict__) escaped = dumped.replace('"', '\\"') print( -'const char %s_pmd_info[] __attribute__((used)) = "PMD_INFO_STRING= %s";' +'RTE_INCLUDE(const char, %s_pmd_info)[] = "PMD_INFO_STRING= %s";' % (self.name, escaped), file=file, ) @@ -215,7 +215,7 @@ def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("format", help="object file format, 'elf' or 'coff'") parser.add_argument( -"input", nargs='+', help="input object file path or '-' for stdin" +"input", nargs="+", help="input object file path or '-' for stdin" ) parser.add_argument("output", help="output C file path or '-' for stdout") return parser.parse_args() @@ -252,13 +252,14 @@ def open_output(path): def write_header(output): output.write( -"static __attribute__((unused)) const char *generator = \"%s\";\n" % sys.argv[0] +"#include \n" +'static __rte_unused const char *generator = "%s";\n' % sys.argv[0] ) def main(): args = parse_args() -if args.input.count('-') > 1: +if args.input.count("-") > 1: raise Exception("'-' input cannot be used multiple times") if args.format == "elf" and "ELFFile" not in globals(): raise Exception("elftools module not found") -- 2.49.0.vfs.0.0
[PATCH v4 3/4] usertools: parse strings from PE images
Script usertools\dpdk-pmdinfo.py was enhanced to also be able to parse symbols from sections in PE images. Signed-off-by: Andre Muezerie --- usertools/dpdk-pmdinfo.py | 53 +++ 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/usertools/dpdk-pmdinfo.py b/usertools/dpdk-pmdinfo.py index 9189a2fdbc..9251c69db9 100755 --- a/usertools/dpdk-pmdinfo.py +++ b/usertools/dpdk-pmdinfo.py @@ -37,8 +37,11 @@ from pathlib import Path from typing import Iterable, Iterator, List, Union -import elftools -from elftools.elf.elffile import ELFError, ELFFile +if os.name == "nt": +import pefile +else: +import elftools +from elftools.elf.elffile import ELFError, ELFFile # @@ -114,18 +117,23 @@ def parse_pmdinfo(paths: Iterable[Path], search_plugins: bool) -> List[dict]: A list of DPDK drivers info dictionaries. """ binaries = set(paths) -for p in paths: -binaries.update(get_needed_libs(p)) -if search_plugins: -# cast to list to avoid errors with update while iterating -binaries.update(list(get_plugin_libs(binaries))) + +if os.name == "nt": +section_name = ".rdata" +else: +section_name = ".rodata" +for p in paths: +binaries.update(get_needed_libs(p)) +if search_plugins: +# cast to list to avoid errors with update while iterating +binaries.update(list(get_plugin_libs(binaries))) drivers = [] for b in binaries: logging.debug("analyzing %s", b) try: -for s in get_elf_strings(b, ".rodata", "PMD_INFO_STRING="): +for s in get_section_strings(b, section_name, "PMD_INFO_STRING="): try: info = json.loads(s) scrub_pci_ids(info) @@ -214,7 +222,7 @@ def find_strings(buf: bytes, prefix: str) -> Iterator[str]: # end of string s = view[start:i].tobytes().decode("ascii") if s.startswith(prefix): -yield s[len(prefix):] +yield s[len(prefix) :] # There can be byte sequences where a non-printable byte # follows a printable one. Ignore that. start = None @@ -233,7 +241,8 @@ def elftools_version(): return (int(match[1]), int(match[2])) -ELFTOOLS_VERSION = elftools_version() +if os.name != "nt": +ELFTOOLS_VERSION = elftools_version() def from_elftools(s: Union[bytes, str]) -> str: @@ -269,6 +278,30 @@ def get_elf_strings(path: Path, section: str, prefix: str) -> Iterator[str]: yield from find_strings(sec.data(), prefix) +# +def get_pe_strings(path: Path, section: str, prefix: str) -> Iterator[str]: +""" +Extract strings from a named PE section in a file. +""" +pe = pefile.PE(path) +for sec in pe.sections: +section_name = sec.Name.decode().strip("\x00") +if section_name != section: +continue +yield from find_strings(sec.get_data(), prefix) + + +# +def get_section_strings(path: Path, section: str, prefix: str) -> Iterator[str]: +""" +Extract strings from a named section in an ELF or PE file. +""" +if os.name == "nt": +yield from get_pe_strings(path, section, prefix) +else: +yield from get_elf_strings(path, section, prefix) + + # LDD_LIB_RE = re.compile( r""" -- 2.49.0.vfs.0.0
[PATCH v4 1/4] eal: add macro to embed information in binaries
DPDK uses GCC attribute "used" through macro __rte_used to indicate that a variable not referenced in the code should be assumed being used and therefore not be optimized away. This technique is used to embed information in the binaries, by having crafted information stored in them. MSVC offers similar functionality, but it differs significantly: MSVC requires a pragma to be used to send a command to the linker telling it explicitly the name of the symbol that should be included (even if not referenced). As a side-effect, variables called out to be included cannot be static, otherwise their symbols are not "seen" by the linker. This restriction requires some DPDK code to be refactored. To assimilate these requirements/restrictions, macro RTE_INCLUDE is introduced in this patch. Signed-off-by: Andre Muezerie --- lib/eal/common/eal_common_options.c | 2 +- lib/eal/include/rte_common.h| 6 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c index b6fff7ec05..8d115a5bd7 100644 --- a/lib/eal/common/eal_common_options.c +++ b/lib/eal/common/eal_common_options.c @@ -135,7 +135,7 @@ static const char *default_solib_dir = RTE_EAL_PMD_PATH; * Note: PLEASE DO NOT ALTER THIS without making a corresponding * change to usertools/dpdk-pmdinfo.py */ -static const char dpdk_solib_path[] __rte_used = +RTE_INCLUDE(const char, dpdk_solib_path)[] = "DPDK_PLUGIN_PATH=" RTE_EAL_PMD_PATH; TAILQ_HEAD(device_option_list, device_option); diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index a6085dce27..4c5a3b668f 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -231,6 +231,12 @@ typedef uint16_t unaligned_uint16_t; /** * Force symbol to be generated even if it appears to be unused. */ +#ifdef RTE_TOOLCHAIN_MSVC +#define RTE_INCLUDE(type, name) __pragma(comment(linker, "/include:" RTE_STR(name))) type name +#else +#define RTE_INCLUDE(type, name) __attribute__((used)) type name +#endif + #ifdef RTE_TOOLCHAIN_MSVC #define __rte_used #else -- 2.49.0.vfs.0.0