Introduce iXD driver
Subsystems (7)
Tony Nguyen
maintainerLarysa Zaremba says:
This patch series adds the iXD driver, which supports the Intel(R) Control Plane PCI Function on Intel E2100 and later IPUs and FNICs. It facilitates a centralized control over multiple IDPF PFs/VFs/SFs exposed by the same card. The reason for the separation is to be able to offload the control plane to the host different from where the data plane is running.
This is the first phase in the release of this driver where we implement the initialization of the core PCI driver. Subsequent phases will implement advanced features like usage of idpf ethernet aux device, link management, NVM update via devlink, switchdev port representors, data and exception path, flow rule programming, etc.
The first phase entails the following aspects:
1. Additional libie functionalities:
Patches 1-5 introduce additional common library API for drivers to communicate with the control plane through mailbox communication. A control queue is a hardware interface which is used by the driver to interact with other subsystems (like firmware). The library APIs allow the driver to setup and configure the control queues to send and receive virtchnl messages. The library has an internal bookkeeping (XN API) mechanism to keep track of the send messages. It supports both synchronous as well as asynchronous way of handling the messages. The library also handles the timeout internally for synchronous messages using events. This reduces the driver's overhead in handling the timeout error cases.
The current patch series supports only APIs that are needed for device initialization. These include APIs in the libie_pci module:
* Allocating/freeing the DMA memory and mapping the MMIO regions for BAR0, read/write APIs for drivers to access the MMIO memory
and libie_cp module:
* Control queue initialization and configuration
* Transport initialization for bookkeeping
* Blocking and asynchronous mailbox transactions
Once the mailbox is initialized, the drivers can send and receive virtchnl messages to/from the control plane.
The modules above are not supposed to be linked with the main libie library, but do share the folder with it.
2. idpf:
Patches 6-11 refactor the idpf driver to use the libie APIs for control queue configuration, virtchnl transaction, device initialization and reset and adjust related code accordingly.
3. ixd:
Patches 12-15 add the ixd driver and implement multiple pieces of the initialization flow as follows:
* Add the ability to load
* A reset is issued to ensure a clean device state, followed by
initialization of the mailbox
* Device capabilities:
As part of initialization, the driver has to determine what the device is capable of (ex. max queues, vports, etc). This information is obtained from the firmware and stored by the driver.
* Enable initial support for the devlink interface
---
v8:
* validate BAR index against PCI_STD_NUM_BARS instead of PCI_NUM_RESOURCES.
* log BAR index and offset in the unmapped-MMIO WARN_ONCE().
* unlink before unmapping in libie_pci_unmap_fltr_regs()/libie_pci_unmap_all_mmio_regions().
* document variadic BAR-index arg on __libie_pci_map_mmio_region()/__libie_pci_get_mmio_addr().
* return real error from libie_ctlq_alloc_queue_res() instead of always -ENOMEM.
* add lockdep_assert_held() to libie_ctlq_send_desc_avail()/libie_ctlq_send().
* use atomic set_bit()/clear_bit() on xnm->free_xns_bm.
* skip reusing an Xn slot whose small-DMA buffer may still be in-flight; track it via new xn->tx_msg.
* drop unused write-only xn->ctlq field.
* fix __free()-goto mixing in idpf_send_get_rx_ptype_msg()
* use libie_find_ctlq() in ixd_adapter_fill_dflt_ctlqs() instead of open-coding
* name the 300ms/500ms delays as IXD_CTLQ_RX_TASK_DELAY_JIFFIES/IXD_INIT_TASK_DELAY_JIFFIES.
* expand kdoc for struct ixd_adapter's init_task/vc_ver fields.
* rename "virtchnl" info version to generic fw.mgmt.api in code and ixd.rst.
* sort ixd before ixgbe in devlink/index.rst.
v7: https://lore.kernel.org/netdev/[email protected]/
* alphabetize ixd entry in Ethernet driver docs (moved before ixgbe)
* remove redundant bool mapped = false initialization (idpf)
* remove unused adapter parameter from idpf_mb_clean() (idpf)
* add idpf_send_mb_msg_stack() macro with static_assert() to enforce on-stack buffer size limits (idpf)
* update kdocs for idpf_cfg_lan_memory_regions() and idpf_map_remaining_mmio_regs()
* remove premature LIBETH Kconfig dependency (ixd)
* remove untriggerable WARN_ON(ent->device != IXD_DEV_ID_CPF) check
* switch from system_unbound_wq to system_dfl_wq
* add error classification for retry logic: fail immediately on non-transient errors
* use LARGEST_ALIGN() instead of hardcoded 4K alignment for descriptor ring
* add !qinfo->len validation check, return -EINVAL for length errors
* clear TX tail register in libie_ctlq_init_regs() per spec
* clear DD bit after receiving messages, to reduce dependency on correct refills
* add new libie_ctlq_send_clean() API and refactor xn cleanup
* use dma_pool for small buffers instead of individual DMA allocations
* store small DMA memory directly in xn entry (small_dma_mem) instead of separate allocation
* use per-slot cookie increment instead of global counter
* use kvzalloc_obj()/kvfree() for xn manager allocation (large)
* add bar_idx bounds validation (< PCI_NUM_RESOURCES, >= 0)
* add pci_resource_is_mem() check
* improve libie kdoc
* add WARN_ONCE() when accessing unmapped MMIO regions
* move libie_cp_dma_mem.direction to an earlier commit
* adjust commit messages
v6: https://lore.kernel.org/netdev/[email protected]/
* use idpf_mmio_region_non_static() in idpf_idc_init_aux_core_dev() to avoid code duplication
* change LIBIE_CTLQ_TYPE_TX/RX from macros to enum libie_ctlq_type
* pull libie_ctlq_xn_shutdown() out of libie_ctlq_xn_deinit() for consistency and to avoid unlikely races with send queue force-cleaning
* remove unused send_ctx field from struct libie_ctlq_xn_clean_params
* add missing dma_wmb() before tail register update in libie_ctlq_post_rx_buffs()
* initialize mem->direction in libie_cp_alloc_dma_mem (purely cosmetic)
* remove unnecessary dma_mb() for coherent DMA in libie_ctlq_xn_send_clean()
* removed redundant list-init check
* fixed whitespaces not flagged by checkpatch
* improved documentation
v5: https://lore.kernel.org/netdev/[email protected]/
* Add length validation to libie_ctlq_add()
* Add memory barrier before writing tail in libie_ctlq_send()
* Reduce larger then needed size allocation in libie_ctlq_xn_init_dma()
* Clarify error message on dev init failure in idpf_probe()
* Nullify adapter->asq and adapter->arq on failure in idpf_init_dflt_mbx()
* Correct virtchnl version compatibility checks in ixd_handle_vc_ver()
* Misc documentation fixes
v4: https://lore.kernel.org/netdev/[email protected]/
* use check_add_overflow() for MMIO offset+size bounds check in libie_pci
* replace iounmap() with pci_iounmap() for MMIO regions in libie_pci
* fix missing rx_buf->offset when constructing ctlq Rx message address
* always zero Rx descriptor before reallocation
* do not call complete() inside spinlock, theoretical use-after-free
* reset async xn state to IDLE before freeing in libie_ctlq_xn_shutdown()
* zero control queue Tx descriptor before freeing memory
* remove unused ctx field from struct libie_ctlq_xn_clean_params
* roll back merging of idpf_deinit_dflt_mbx() and xnm shutdown,
those calls are separate again (so idpf refactoring becomes more trivial)
* introduce idpf_send_vf_reset_msg() for one-way VF reset message bypassing XN manager, which is shut down by now
* guard libie_ctlq_xn_shutdown() against NULL xnm in idpf_vc_event_task(), this is needed if reset fails and reschedules
* validate response sizes in idpf more
* fix MAINTAINERS glob pattern for include/linux/net/intel/
* roll back linux/{net/intel -> intel}/* change (1st patch)
* use pci_iomap_range() to map regions in libie_pci
* improve libie_pci commit message
* remove broken dead code for getting RSS from idpf (new patch!)
* use maximum alignment for control queue stack buffer in ixd
* fix ixd_ctlq_clean_sq() usage
* do not register ixd devlink prematurely
* improve receive buffer size validation in idpf
v3: https://lore.kernel.org/netdev/[email protected]/
- lock libie ctlq transaction earlier on Rx path
- improve ctlq Rx buffer size validation both in idpf and libie
- fix RSS LUT buf size (will also go to stable separately)
- improve xnm shutdown handling
- skip zero-sized BAR regions instread of returning error in idpf
- unify treatment of initialized and uninitialized ctlq messages
v2: https://lore.kernel.org/netdev/[email protected]/
- improved failure handling and input validation
- removed cp version from devlink in ixd
v1: https://lore.kernel.org/netdev/[email protected]/
The following are changes since commit ac155a26750a595703e7dadff84735456d75a479:
Merge branch 'mptcp-out-of-order-queue-pruning'
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue 200GbE
Amritha Nambiar (1):
ixd: add devlink support
Larysa Zaremba (6):
idpf: remove unused code for getting RSS info from device
idpf: make mbx_task queueing and cancelling more consistent
idpf: print a debug message and bail in case of non-event ctlq message
ixd: add basic driver framework for Intel(R) Control Plane Function
ixd: add reset checks and initialize the mailbox
ixd: add the core initialization
Pavan Kumar Linga (4):
libeth: allow to create fill queues without NAPI
idpf: remove 'vport_params_reqd' field
idpf: refactor idpf to use libie_pci APIs
idpf: refactor idpf to use libie control queues
Phani R Burra (3):
libie: add PCI device initialization helpers to libie
libie: add control queue support
libie: add bookkeeping support for control queue messages
Victor Raj (1):
virtchnl: move virtchnl and virtchnl2 headers to
'include/linux/net/intel'
.../device_drivers/ethernet/index.rst | 1 +
.../device_drivers/ethernet/intel/ixd.rst | 39 +
Documentation/networking/devlink/index.rst | 1 +
Documentation/networking/devlink/ixd.rst | 30 +
MAINTAINERS | 3 +-
drivers/net/ethernet/intel/Kconfig | 2 +
drivers/net/ethernet/intel/Makefile | 1 +
drivers/net/ethernet/intel/i40e/i40e.h | 2 +-
drivers/net/ethernet/intel/i40e/i40e_common.c | 2 +-
.../net/ethernet/intel/i40e/i40e_prototype.h | 2 +-
.../ethernet/intel/i40e/i40e_virtchnl_pf.h | 2 +-
drivers/net/ethernet/intel/iavf/iavf.h | 2 +-
drivers/net/ethernet/intel/iavf/iavf_common.c | 2 +-
.../net/ethernet/intel/iavf/iavf_prototype.h | 3 +-
drivers/net/ethernet/intel/iavf/iavf_types.h | 4 +-
drivers/net/ethernet/intel/ice/ice.h | 2 +-
drivers/net/ethernet/intel/ice/ice_common.h | 2 +-
drivers/net/ethernet/intel/ice/ice_vf_lib.h | 2 +-
.../net/ethernet/intel/ice/virt/virtchnl.h | 2 +-
drivers/net/ethernet/intel/idpf/Kconfig | 1 +
drivers/net/ethernet/intel/idpf/Makefile | 2 -
drivers/net/ethernet/intel/idpf/idpf.h | 99 +-
.../net/ethernet/intel/idpf/idpf_controlq.c | 621 ------
.../net/ethernet/intel/idpf/idpf_controlq.h | 144 --
.../ethernet/intel/idpf/idpf_controlq_api.h | 177 --
.../ethernet/intel/idpf/idpf_controlq_setup.c | 169 --
drivers/net/ethernet/intel/idpf/idpf_dev.c | 101 +-
.../net/ethernet/intel/idpf/idpf_ethtool.c | 28 +-
drivers/net/ethernet/intel/idpf/idpf_idc.c | 32 +-
drivers/net/ethernet/intel/idpf/idpf_lib.c | 69 +-
drivers/net/ethernet/intel/idpf/idpf_main.c | 115 +-
drivers/net/ethernet/intel/idpf/idpf_mem.h | 20 -
drivers/net/ethernet/intel/idpf/idpf_txrx.c | 4 +-
drivers/net/ethernet/intel/idpf/idpf_txrx.h | 4 +-
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c | 96 +-
.../net/ethernet/intel/idpf/idpf_virtchnl.c | 1901 +++++++----------
.../net/ethernet/intel/idpf/idpf_virtchnl.h | 127 +-
.../ethernet/intel/idpf/idpf_virtchnl_ptp.c | 310 ++-
drivers/net/ethernet/intel/ixd/Kconfig | 14 +
drivers/net/ethernet/intel/ixd/Makefile | 13 +
drivers/net/ethernet/intel/ixd/ixd.h | 67 +
drivers/net/ethernet/intel/ixd/ixd_ctlq.c | 141 ++
drivers/net/ethernet/intel/ixd/ixd_ctlq.h | 34 +
drivers/net/ethernet/intel/ixd/ixd_dev.c | 89 +
drivers/net/ethernet/intel/ixd/ixd_devlink.c | 99 +
drivers/net/ethernet/intel/ixd/ixd_devlink.h | 50 +
drivers/net/ethernet/intel/ixd/ixd_lan_regs.h | 68 +
drivers/net/ethernet/intel/ixd/ixd_lib.c | 173 ++
drivers/net/ethernet/intel/ixd/ixd_main.c | 144 ++
drivers/net/ethernet/intel/ixd/ixd_virtchnl.c | 190 ++
drivers/net/ethernet/intel/ixd/ixd_virtchnl.h | 12 +
drivers/net/ethernet/intel/libeth/rx.c | 12 +-
drivers/net/ethernet/intel/libie/Kconfig | 14 +
drivers/net/ethernet/intel/libie/Makefile | 8 +
drivers/net/ethernet/intel/libie/controlq.c | 1295 +++++++++++
drivers/net/ethernet/intel/libie/pci.c | 229 ++
include/linux/net/intel/libie/controlq.h | 436 ++++
include/linux/net/intel/libie/pci.h | 56 +
include/linux/{avf => net/intel}/virtchnl.h | 0
.../linux/net/intel}/virtchnl2.h | 0
.../linux/net/intel}/virtchnl2_lan_desc.h | 0
include/net/libeth/rx.h | 4 +-
62 files changed, 4366 insertions(+), 2906 deletions(-)
create mode 100644 Documentation/networking/device_drivers/ethernet/intel/ixd.rst
create mode 100644 Documentation/networking/devlink/ixd.rst
delete mode 100644 drivers/net/ethernet/intel/idpf/idpf_controlq.c
delete mode 100644 drivers/net/ethernet/intel/idpf/idpf_controlq.h
delete mode 100644 drivers/net/ethernet/intel/idpf/idpf_controlq_api.h
delete mode 100644 drivers/net/ethernet/intel/idpf/idpf_controlq_setup.c
delete mode 100644 drivers/net/ethernet/intel/idpf/idpf_mem.h
create mode 100644 drivers/net/ethernet/intel/ixd/Kconfig
create mode 100644 drivers/net/ethernet/intel/ixd/Makefile
create mode 100644 drivers/net/ethernet/intel/ixd/ixd.h
create mode 100644 drivers/net/ethernet/intel/ixd/ixd_ctlq.c
create mode 100644 drivers/net/ethernet/intel/ixd/ixd_ctlq.h
create mode 100644 drivers/net/ethernet/intel/ixd/ixd_dev.c
create mode 100644 drivers/net/ethernet/intel/ixd/ixd_devlink.c
create mode 100644 drivers/net/ethernet/intel/ixd/ixd_devlink.h
create mode 100644 drivers/net/ethernet/intel/ixd/ixd_lan_regs.h
create mode 100644 drivers/net/ethernet/intel/ixd/ixd_lib.c
create mode 100644 drivers/net/ethernet/intel/ixd/ixd_main.c
create mode 100644 drivers/net/ethernet/intel/ixd/ixd_virtchnl.c
create mode 100644 drivers/net/ethernet/intel/ixd/ixd_virtchnl.h
create mode 100644 drivers/net/ethernet/intel/libie/controlq.c
create mode 100644 drivers/net/ethernet/intel/libie/pci.c
create mode 100644 include/linux/net/intel/libie/controlq.h
create mode 100644 include/linux/net/intel/libie/pci.h
rename include/linux/{avf => net/intel}/virtchnl.h (100%)
rename {drivers/net/ethernet/intel/idpf => include/linux/net/intel}/virtchnl2.h (100%)
rename {drivers/net/ethernet/intel/idpf => include/linux/net/intel}/virtchnl2_lan_desc.h (100%)Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH v8 1/15 virtchnl: move virtchnl and virtchnl2 headers to 'include/linux/net/intel'
From: Victor Raj <[email protected]>
virtchnl2 headers will be used by both idpf and ixd drivers, so they have to be moved to an include directory. On top of that, it would be useful to place all iavf headers together with other intel networking headers.
Move abovementioned intel header files into 'include/linux/net/intel'.
While at it, remove the self-include from iavf_types.h.
---
MAINTAINERS | 3 +--
drivers/net/ethernet/intel/i40e/i40e.h | 2 +-
drivers/net/ethernet/intel/i40e/i40e_common.c | 2 +-
drivers/net/ethernet/intel/i40e/i40e_prototype.h | 2 +-
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 2 +-
drivers/net/ethernet/intel/iavf/iavf.h | 2 +-
drivers/net/ethernet/intel/iavf/iavf_common.c | 2 +-
drivers/net/ethernet/intel/iavf/iavf_prototype.h | 3 ++-
drivers/net/ethernet/intel/iavf/iavf_types.h | 4 +---
drivers/net/ethernet/intel/ice/ice.h | 2 +-
drivers/net/ethernet/intel/ice/ice_common.h | 2 +-
drivers/net/ethernet/intel/ice/ice_vf_lib.h | 2 +-
drivers/net/ethernet/intel/ice/virt/virtchnl.h | 2 +-
drivers/net/ethernet/intel/idpf/idpf.h | 2 +-
drivers/net/ethernet/intel/idpf/idpf_txrx.h | 2 +-
drivers/net/ethernet/intel/idpf/idpf_virtchnl.h | 2 +-
include/linux/{avf => net/intel}/virtchnl.h | 0
.../intel/idpf => include/linux/net/intel}/virtchnl2.h | 0
.../idpf => include/linux/net/intel}/virtchnl2_lan_desc.h | 0
19 files changed, 17 insertions(+), 19 deletions(-)
rename include/linux/{avf => net/intel}/virtchnl.h (100%)
rename {drivers/net/ethernet/intel/idpf => include/linux/net/intel}/virtchnl2.h (100%)
rename {drivers/net/ethernet/intel/idpf => include/linux/net/intel}/virtchnl2_lan_desc.h (100%)MAINTAINERS +1 -2
@@ -13033,8 +13033,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git F: Documentation/networking/device_drivers/ethernet/intel/ F: drivers/net/ethernet/intel/ F: drivers/net/ethernet/intel/*/ -F: include/linux/avf/virtchnl.h -F: include/linux/net/intel/*/ +F: include/linux/net/intel/ INTEL ETHERNET PROTOCOL DRIVER FOR RDMA M: Tatyana Nikolova <[email protected]>
drivers/net/ethernet/intel/i40e/i40e.h +1 -1
@@ -8,8 +8,8 @@#include <linux/pci.h> #include <linux/ptp_clock_kernel.h> #include <linux/types.h> -#include <linux/avf/virtchnl.h> #include <linux/net/intel/i40e_client.h> +#include <linux/net/intel/virtchnl.h> #include <net/devlink.h> #include <net/pkt_cls.h> #include <net/udp_tunnel.h>
drivers/net/ethernet/intel/i40e/i40e_common.c +1 -1
@@ -1,10 +1,10 @@// SPDX-License-Identifier: GPL-2.0 /* Copyright(c) 2013 - 2021 Intel Corporation. */ -#include <linux/avf/virtchnl.h> #include <linux/bitfield.h> #include <linux/delay.h> #include <linux/etherdevice.h> +#include <linux/net/intel/virtchnl.h> #include <linux/pci.h> #include "i40e_adminq_cmd.h" #include "i40e_devids.h"
drivers/net/ethernet/intel/i40e/i40e_prototype.h +1 -1
@@ -5,7 +5,7 @@#define _I40E_PROTOTYPE_H_#include <linux/ethtool.h> -#include <linux/avf/virtchnl.h> +#include <linux/net/intel/virtchnl.h> #include "i40e_debug.h" #include "i40e_type.h"
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +1 -1
@@ -4,7 +4,7 @@#ifndef _I40E_VIRTCHNL_PF_H_#define _I40E_VIRTCHNL_PF_H_ -#include <linux/avf/virtchnl.h> +#include <linux/net/intel/virtchnl.h> #include <linux/netdevice.h> #include "i40e_type.h"
drivers/net/ethernet/intel/iavf/iavf.h +1 -1
@@ -27,6 +27,7 @@#include <linux/etherdevice.h> #include <linux/socket.h> #include <linux/jiffies.h> +#include <linux/net/intel/virtchnl.h> #include <net/ip6_checksum.h> #include <net/pkt_cls.h> #include <net/pkt_sched.h>
@@ -37,7 +38,6 @@#include <net/net_shaper.h> #include "iavf_type.h" -#include <linux/avf/virtchnl.h> #include "iavf_txrx.h" #include "iavf_fdir.h" #include "iavf_adv_rss.h"
drivers/net/ethernet/intel/iavf/iavf_common.c +1 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0 /* Copyright(c) 2013 - 2018 Intel Corporation. */ -#include <linux/avf/virtchnl.h> +#include <linux/net/intel/virtchnl.h> #include <linux/bitfield.h> #include "iavf_type.h" #include "iavf_adminq.h"
drivers/net/ethernet/intel/iavf/iavf_prototype.h +2 -1
@@ -4,9 +4,10 @@#ifndef _IAVF_PROTOTYPE_H_#define _IAVF_PROTOTYPE_H_ +#include <linux/net/intel/virtchnl.h> +#include "iavf_type.h" #include "iavf_alloc.h" -#include <linux/avf/virtchnl.h> /* Prototypes for shared code functions that are not in * the standard function pointer structures. These are
drivers/net/ethernet/intel/iavf/iavf_types.h +1 -3
@@ -4,9 +4,7 @@#ifndef _IAVF_TYPES_H_#define _IAVF_TYPES_H_ -#include "iavf_types.h" - -#include <linux/avf/virtchnl.h> +#include <linux/net/intel/virtchnl.h> #include <linux/ptp_clock_kernel.h> /* structure used to queue PTP commands for processing */
drivers/net/ethernet/intel/ice/ice.h +1 -1
@@ -36,7 +36,7 @@#include <linux/bpf.h> #include <linux/btf.h> #include <linux/auxiliary_bus.h> -#include <linux/avf/virtchnl.h> +#include <linux/net/intel/virtchnl.h> #include <linux/cpu_rmap.h> #include <linux/dim.h> #include <linux/gnss.h>
drivers/net/ethernet/intel/ice/ice_common.h +1 -1
@@ -5,13 +5,13 @@#define _ICE_COMMON_H_#include <linux/bitfield.h> +#include <linux/net/intel/virtchnl.h> #include "ice.h" #include "ice_type.h" #include "ice_nvm.h" #include "ice_flex_pipe.h" #include "ice_parser.h" -#include <linux/avf/virtchnl.h> #include "ice_switch.h" #include "ice_fdir.h"
drivers/net/ethernet/intel/ice/ice_vf_lib.h +1 -1
@@ -8,9 +8,9 @@#include <linux/hashtable.h> #include <linux/bitmap.h> #include <linux/mutex.h> +#include <linux/net/intel/virtchnl.h> #include <linux/pci.h> #include <net/devlink.h> -#include <linux/avf/virtchnl.h> #include "ice_type.h" #include "ice_flow.h" #include "virt/fdir.h"
drivers/net/ethernet/intel/ice/virt/virtchnl.h +1 -1
@@ -7,7 +7,7 @@#include <linux/types.h> #include <linux/bitops.h> #include <linux/if_ether.h> -#include <linux/avf/virtchnl.h> +#include <linux/net/intel/virtchnl.h> #include "ice_vf_lib.h" /* Restrict number of MAC Addr and VLAN that non-trusted VF can programmed */
drivers/net/ethernet/intel/idpf/idpf.h +1 -1
@@ -23,8 +23,8 @@ struct idpf_rss_data;#include <linux/net/intel/iidc_rdma.h> #include <linux/net/intel/iidc_rdma_idpf.h> +#include <linux/net/intel/virtchnl2.h> -#include "virtchnl2.h" #include "idpf_txrx.h" #include "idpf_controlq.h"
drivers/net/ethernet/intel/idpf/idpf_txrx.h +1 -1
@@ -5,6 +5,7 @@#define _IDPF_TXRX_H_#include <linux/dim.h> +#include <linux/net/intel/virtchnl2_lan_desc.h> #include <net/libeth/cache.h> #include <net/libeth/types.h>
@@ -13,7 +14,6 @@#include <net/xdp.h> #include "idpf_lan_txrx.h" -#include "virtchnl2_lan_desc.h" #define IDPF_LARGE_MAX_Q 256#define IDPF_MAX_Q 16
drivers/net/ethernet/intel/idpf/idpf_virtchnl.h +1 -1
@@ -4,7 +4,7 @@#ifndef _IDPF_VIRTCHNL_H_#define _IDPF_VIRTCHNL_H_ -#include "virtchnl2.h" +#include <linux/net/intel/virtchnl2.h> #define IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC (60 * 1000)#define IDPF_VC_XN_IDX_M GENMASK(7, 0)
include/linux/net/intel/virtchnl.h renamed from include/linux/avf/virtchnl.h +0 -0
include/linux/net/intel/virtchnl2.h renamed from drivers/net/ethernet/intel/idpf/virtchnl2.h +0 -0
include/linux/net/intel/virtchnl2_lan_desc.h renamed from drivers/net/ethernet/intel/idpf/virtchnl2_lan_desc.h +0 -0
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH v8 2/15 libie: add PCI device initialization helpers to libie
In reply to Tony NguyenFrom: Phani R Burra <[email protected]>
idpf and ixd drivers serve different PCI functions on the same device, therefore their PCI configuration flow is very similar.
Add support functions for idpf and ixd to configure PCI functionality and access MMIO space. Add a mapping list which can be traversed by a driver, e.g. to pass certain I/O mappings to the auxbus devices. Such list is also traversed by the libie_pci_get_mmio_addr() helper, which allows for easier memory access.
--- drivers/net/ethernet/intel/libie/Kconfig | 6 + drivers/net/ethernet/intel/libie/Makefile | 4 + drivers/net/ethernet/intel/libie/pci.c | 229 ++++++++++++++++++++++ include/linux/net/intel/libie/pci.h | 56 ++++++ 4 files changed, 295 insertions(+) create mode 100644 drivers/net/ethernet/intel/libie/pci.c create mode 100644 include/linux/net/intel/libie/pci.h
drivers/net/ethernet/intel/libie/Kconfig +6 -0
@@ -23,3 +23,9 @@ config LIBIE_FWLOG for it. Firmware logging is using admin queue interface to communicate with the device. Debugfs is a user interface used to config logging and dump all collected logs. + +config LIBIE_PCI + tristate + help + Helper functions for management of PCI resources belonging + to networking devices.
drivers/net/ethernet/intel/libie/Makefile +4 -0
@@ -12,3 +12,7 @@ libie_adminq-y := adminq.o obj-$(CONFIG_LIBIE_FWLOG) += libie_fwlog.o libie_fwlog-y := fwlog.o + +obj-$(CONFIG_LIBIE_PCI) += libie_pci.o + +libie_pci-y := pci.o
drivers/net/ethernet/intel/libie/pci.c new file +229 -0
229 lines not on this page · raw message
include/linux/net/intel/libie/pci.h new file +56 -0
56 lines not on this page · raw message
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH v8 3/15 libeth: allow to create fill queues without NAPI
In reply to Tony NguyenFrom: Pavan Kumar Linga <[email protected]>
Control queues can utilize libeth_rx fill queues, despite working outside of NAPI context. The only problem is standard fill queues requiring NAPI that provides them with the device pointer.
Introduce a way to provide the device directly without using NAPI.
--- drivers/net/ethernet/intel/libeth/rx.c | 12 ++++++++---- include/net/libeth/rx.h | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/libeth/rx.c +8 -4
@@ -145,25 +145,29 @@ static bool libeth_rx_page_pool_params_zc(struct libeth_fq *fq,/** * libeth_rx_fq_create - create a PP with the default libeth settings * @fq: buffer queue struct to fill -* @napi: &napi_struct covering this PP (no usage outside its poll loops) +* @napi_dev: &napi_struct for NAPI (data) queues, &device for others * * Return: %0 on success, -%errno on failure. */ -int libeth_rx_fq_create (struct libeth_fq *fq,struct napi_struct *napi) +int libeth_rx_fq_create (struct libeth_fq *fq,void *napi_dev) { +struct napi_struct *napi = fq->no_napi ?NULL : napi_dev;struct page_pool_params pp = { .flags =PP_FLAG_DMA_MAP |PP_FLAG_DMA_SYNC_DEV , .order =LIBETH_RX_PAGE_ORDER , .pool_size = fq->count, .nid = fq->nid, - .dev = napi->dev->dev.parent, - .netdev = napi->dev, + .dev = napi ? napi->dev->dev.parent : napi_dev, + .netdev = napi ? napi->dev :NULL , .napi = napi, };struct libeth_fqe *fqes;struct page_pool *pool;int ret; +if (!pp.netdev && fq->type ==LIBETH_FQE_MTU ) +return -EINVAL ; + pp.dma_dir = fq->xdp ?DMA_BIDIRECTIONAL :DMA_FROM_DEVICE ;if (!fq->hsplit)
include/net/libeth/rx.h +3 -1
@@ -69,6 +69,7 @@ enum libeth_fqe_type {* @type: type of the buffers this queue has * @hsplit: flag whether header split is enabled * @xdp: flag indicating whether XDP is enabled +* @no_napi: the queue is not a data queue and does not have NAPI * @buf_len: HW-writeable length per each buffer * @nid: ID of the closest NUMA node with memory */
@@ -85,12 +86,13 @@ struct libeth_fq { enum libeth_fqe_type type:2; bool hsplit:1; bool xdp:1; + bool no_napi:1;u32 buf_len;int nid; }; -int libeth_rx_fq_create (struct libeth_fq *fq,struct napi_struct *napi); +int libeth_rx_fq_create (struct libeth_fq *fq,void *napi_dev);void libeth_rx_fq_destroy (struct libeth_fq *fq);/**
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH v8 4/15 libie: add control queue support
In reply to Tony NguyenFrom: Phani R Burra <[email protected]>
Libie will now support control queue setup and configuration APIs. These are mainly used for mailbox communication between drivers and control plane.
Make use of the libeth_rx page pool support for managing controlq buffers.
--- drivers/net/ethernet/intel/libie/Kconfig | 8 + drivers/net/ethernet/intel/libie/Makefile | 4 + drivers/net/ethernet/intel/libie/controlq.c | 672 ++++++++++++++++++++ include/linux/net/intel/libie/controlq.h | 276 ++++++++ 4 files changed, 960 insertions(+) create mode 100644 drivers/net/ethernet/intel/libie/controlq.c create mode 100644 include/linux/net/intel/libie/controlq.h
drivers/net/ethernet/intel/libie/Kconfig +8 -0
@@ -15,6 +15,14 @@ config LIBIE_ADMINQ Helper functions used by Intel Ethernet drivers for administration queue command interface (aka adminq). +config LIBIE_CP + tristate + select LIBETH + select LIBIE_PCI + help + Common helper routines to communicate with the device Control Plane + using virtchnl2 or related mailbox protocols. + config LIBIE_FWLOG tristate select LIBIE_ADMINQ
drivers/net/ethernet/intel/libie/Makefile +4 -0
@@ -9,6 +9,10 @@ obj-$(CONFIG_LIBIE_ADMINQ) += libie_adminq.o libie_adminq-y := adminq.o +obj-$(CONFIG_LIBIE_CP) += libie_cp.o + +libie_cp-y := controlq.o + obj-$(CONFIG_LIBIE_FWLOG) += libie_fwlog.o libie_fwlog-y := fwlog.o
drivers/net/ethernet/intel/libie/controlq.c new file +672 -0
672 lines not on this page · raw message
include/linux/net/intel/libie/controlq.h new file +276 -0
276 lines not on this page · raw message
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH v8 5/15 libie: add bookkeeping support for control queue messages
In reply to Tony NguyenFrom: Phani R Burra <[email protected]>
Small send control queue message buffers are managed and reused by libie itself, bigger send buffers are consumed. All are tracked with the unique transaction (Xn) ids until they receive response or time out.
Responses can be received out of order, therefore transactions are stored in an array and tracked though a bitmap. Rx buffers utilize page_pool.
Pre-allocated DMA memory is used where possible. It reduces the driver overhead in handling memory allocation/free and message timeouts.
--- drivers/net/ethernet/intel/libie/controlq.c | 623 ++++++++++++++++++++ include/linux/net/intel/libie/controlq.h | 160 +++++ 2 files changed, 783 insertions(+)
drivers/net/ethernet/intel/libie/controlq.c +623 -0
@@ -667,6 +667,629 @@ u32 libie_ctlq_recv(struct libie_ctlq_info *ctlq, struct libie_ctlq_msg *msg, }EXPORT_SYMBOL_NS_GPL (libie_ctlq_recv,"LIBIE_CP" ); +/** +* libie_ctlq_xn_pop_free - get a free Xn entry from the free list +* @xnm: Xn transaction manager +* +* Retrieve a free Xn entry from the free list. +* +* Return: valid Xn entry pointer or NULL if there are no free Xn entries. +*/ +static struct libie_ctlq_xn * +libie_ctlq_xn_pop_free (struct libie_ctlq_xn_manager *xnm) +{ +struct libie_ctlq_xn *xn; +u32 free_idx; + +guard (spinlock)(&xnm->free_xns_bm_lock); + +if (unlikely (xnm->shutdown)) +return NULL ; + +for_each_set_bit (free_idx, xnm->free_xns_bm, +LIBIE_CTLQ_MAX_XN_ENTRIES ) { + xn = &xnm->ring[free_idx]; + +/* Torn read of the physical address is possible, the worst case +* scenario is a transient spurious skip. If the physical +* address is dirty in any way, reuse is already safe. +*/ +if (xn->tx_msg && +data_race (xn->tx_msg->send_mem.pa) == xn->small_dma_mem.pa) +continue ; + +clear_bit (free_idx, xnm->free_xns_bm); + +return xn; + } + +return NULL ; +} + +/** +* __libie_ctlq_xn_push_free - unsafely push an xn entry into the free list +* @xnm: Xn transaction manager +* @xn: xn entry to be added into the free list +* +* Return: whether xnm destruction can be triggered by the caller +*/ +static bool __libie_ctlq_xn_push_free (struct libie_ctlq_xn_manager *xnm, +struct libie_ctlq_xn *xn) +{ + xn->cookie++; +set_bit (xn->index, xnm->free_xns_bm); + +if (unlikely (xnm->shutdown) && +bitmap_full (xnm->free_xns_bm,LIBIE_CTLQ_MAX_XN_ENTRIES )) +return true; + +return false; +} + +/** +* libie_ctlq_xn_push_free - push a Xn entry into the free list +* @xnm: Xn transaction manager +* @xn: xn entry to be added into the free list, not locked +* +* Safely add a used Xn entry back to the free list. +*/ +static void libie_ctlq_xn_push_free (struct libie_ctlq_xn_manager *xnm, +struct libie_ctlq_xn *xn) +{ +bool can_destroy; + + scoped_guard(spinlock, &xnm->free_xns_bm_lock) + can_destroy =__libie_ctlq_xn_push_free (xnm, xn); + +if (can_destroy) +complete (&xnm->can_destroy); +} + +/** +* libie_ctlq_xn_deinit_dma - free the DMA memory allocated for send messages +* @xnm: pointer to the transaction manager +* @num_entries: number of Xn entries to free the DMA for +*/ +static void libie_ctlq_xn_deinit_dma (struct libie_ctlq_xn_manager *xnm, +u32 num_entries) +{ +for (u32 i =0 ; i < num_entries; i++) { +struct libie_ctlq_xn *xn = &xnm->ring[i]; + +dma_pool_free (xnm->small_buff_pool, xn->small_dma_mem.va, + xn->small_dma_mem.pa); + } + +dma_pool_destroy (xnm->small_buff_pool); +} + +/** +* libie_ctlq_xn_init_dma - pre-allocate DMA memory for send messages that use +* stack variables +* @dev: device pointer +* @xnm: pointer to transaction manager +* +* Return: %0 on success or error if memory allocation fails +*/ +static int libie_ctlq_xn_init_dma (struct device *dev, +struct libie_ctlq_xn_manager *xnm) +{ +u32 i; + + xnm->small_buff_pool = +dma_pool_create ("libie_ctlq_xn_tx" , dev,LIBIE_CP_TX_COPYBREAK , +LIBIE_CP_TX_COPYBREAK ,0 ); +if (!xnm->small_buff_pool) +return -ENOMEM ; + +for (i =0 ; i <LIBIE_CTLQ_MAX_XN_ENTRIES ; i++) { +struct libie_cp_dma_mem *mem = &xnm->ring[i].small_dma_mem; + + mem->va =dma_pool_zalloc (xnm->small_buff_pool,GFP_KERNEL , + &mem->pa); +if (!mem->va) + goto dealloc_dma; + + mem->direction =DMA_BIDIRECTIONAL ; + mem->size =LIBIE_CP_TX_COPYBREAK ; + } + +return 0 ; + +dealloc_dma: +libie_ctlq_xn_deinit_dma (xnm, i); + +return -ENOMEM ; +} + +/** +* libie_ctlq_xn_process_recv - process Xn data in receive message +* @params: Xn receive param information to handle a receive message +* @ctlq_msg: received control queue message +* +* Process a control queue receive message and send a complete event +* notification. +* +* Return: true if a message has been processed, false otherwise. +*/ +static bool +libie_ctlq_xn_process_recv (struct libie_ctlq_xn_recv_params *params, +struct libie_ctlq_msg *ctlq_msg) +{ +struct libie_ctlq_xn_manager *xnm = params->xnm; +struct libie_ctlq_xn *xn; +u16 msg_cookie, xn_index; +struct kvec *response; +int status; +u16 data; + + data = ctlq_msg->sw_cookie; + xn_index =FIELD_GET (LIBIE_CTLQ_XN_INDEX_M , data); + msg_cookie =FIELD_GET (LIBIE_CTLQ_XN_COOKIE_M , data); + status = ctlq_msg->chnl_retval ? -EFAULT :0 ; + + xn = &xnm->ring[xn_index]; +spin_lock (&xn->xn_lock); +if (ctlq_msg->chnl_opcode != xn->virtchnl_opcode || + msg_cookie != xn->cookie) { +spin_unlock (&xn->xn_lock); +return false; + } + +if (xn->state !=LIBIE_CTLQ_XN_ASYNC && + xn->state !=LIBIE_CTLQ_XN_WAITING ) { +spin_unlock (&xn->xn_lock); +return false; + } + + response = &ctlq_msg->recv_mem; +if (xn->state ==LIBIE_CTLQ_XN_ASYNC ) { + xn->resp_cb (xn->send_ctx, response, status); +libie_ctlq_release_rx_buf (response); + xn->state =LIBIE_CTLQ_XN_IDLE ; +spin_unlock (&xn->xn_lock); +libie_ctlq_xn_push_free (xnm, xn); + +return true; + } + + xn->recv_mem = *response; + xn->state = status ?LIBIE_CTLQ_XN_COMPLETED_FAILED : +LIBIE_CTLQ_XN_COMPLETED_SUCCESS ; + +complete (&xn->cmd_completion_event); +spin_unlock (&xn->xn_lock); + +return true; +} + +/** +* libie_xn_check_async_timeout - Check for asynchronous message timeouts +* @xnm: Xn transaction manager +* +* Call the corresponding callback to notify the caller about the timeout. +* Iterates free_xns_bm locklessly, potential races are caught under +* xn->xn_lock. +*/ +static void libie_xn_check_async_timeout (struct libie_ctlq_xn_manager *xnm) +{ +u32 idx; + +for_each_clear_bit (idx, xnm->free_xns_bm,LIBIE_CTLQ_MAX_XN_ENTRIES ) { +struct libie_ctlq_xn *xn = &xnm->ring[idx]; +u64 timeout_ms; + +spin_lock (&xn->xn_lock); + + timeout_ms =ktime_ms_delta (ktime_get (), xn->timestamp); +if (xn->state !=LIBIE_CTLQ_XN_ASYNC || + timeout_ms < xn->timeout_ms) { +spin_unlock (&xn->xn_lock); +continue ; + } + + xn->resp_cb (xn->send_ctx,NULL , -ETIMEDOUT ); + xn->state =LIBIE_CTLQ_XN_IDLE ; +spin_unlock (&xn->xn_lock); +libie_ctlq_xn_push_free (xnm, xn); + } +} + +/** +* libie_ctlq_xn_recv - process control queue receive message +* @params: Xn receive param information to handle a receive message +* +* Process a receive message and update the receive queue buffer. +* Also terminates async transactions for which it failed to receive a response +* within a given timeframe. +* Function is intended to be called periodically from a single task. +* +* Return: remaining budget. +*/ +u32 libie_ctlq_xn_recv (struct libie_ctlq_xn_recv_params *params) +{ +struct libie_ctlq_msg ctlq_msg; +u32 budget = params->budget; + +while (budget &&libie_ctlq_recv (params->ctlq, &ctlq_msg,1 )) { + budget--; +if (!libie_ctlq_xn_process_recv (params, &ctlq_msg)) + params->ctlq_msg_handler (params->xnm->ctx, &ctlq_msg); + } + +libie_ctlq_post_rx_buffs (params->ctlq); +libie_xn_check_async_timeout (params->xnm); + +return budget; +} +EXPORT_SYMBOL_NS_GPL (libie_ctlq_xn_recv,"LIBIE_CP" ); + +/** +* libie_cp_map_dma_mem - map a given virtual address for DMA +* @dev: device information +* @va: virtual address to be mapped +* @size: size of the memory +* @direction: DMA direction either from/to device +* @dma_mem: memory for DMA information to be stored +* +* Return: true on success, false on DMA map failure. +*/ +static bool libie_cp_map_dma_mem (struct device *dev,void *va,size_t size, +int direction, +struct libie_cp_dma_mem *dma_mem) +{ + dma_mem->pa =dma_map_single (dev, va, size, direction); + +return dma_mapping_error (dev, dma_mem->pa) ? false : true; +} + +/** +* libie_cp_unmap_dma_mem - unmap previously mapped DMA address +* @dev: device information +* @dma_mem: DMA memory information +*/ +static void libie_cp_unmap_dma_mem (struct device *dev, +const struct libie_cp_dma_mem *dma_mem) +{ +dma_unmap_single (dev, dma_mem->pa, dma_mem->size, + dma_mem->direction); +} + +/** +* libie_ctlq_xn_process_send - process and send a control queue message +* @params: Xn send param information for sending a control queue message +* @xn: Assigned Xn entry for tracking the control queue message +* +* Return: %0 on success, -%errno on failure. +*/ +static +int libie_ctlq_xn_process_send (struct libie_ctlq_xn_send_params *params, +struct libie_ctlq_xn *xn) +{ +size_t buf_len = params->send_buf.iov_len; +struct device *dev = params->ctlq->dev; +void *buf = params->send_buf.iov_base; +struct libie_cp_dma_mem *dma_mem; +u16 cookie; + +if (!buf || !buf_len) +return -EOPNOTSUPP ; + +if (libie_cp_can_send_onstack (buf_len)) { + dma_mem = &xn->small_dma_mem; +memcpy (dma_mem->va, buf, buf_len); + }else { + dma_mem = &xn->send_dma_mem; + dma_mem->va = buf; + dma_mem->size = buf_len; + dma_mem->direction =DMA_TO_DEVICE ; + +if (!libie_cp_map_dma_mem (dev, buf, buf_len,DMA_TO_DEVICE , + dma_mem)) +return -ENOMEM ; + } + + cookie =FIELD_PREP (LIBIE_CTLQ_XN_COOKIE_M , xn->cookie) | +FIELD_PREP (LIBIE_CTLQ_XN_INDEX_M , xn->index); + + scoped_guard(spinlock, ¶ms->ctlq->lock) { +struct libie_ctlq_info *ctlq = params->ctlq; +struct libie_ctlq_msg *ctlq_msg; + +if (!libie_ctlq_send_desc_avail (ctlq)) { +if (!libie_cp_can_send_onstack (buf_len)) +libie_cp_unmap_dma_mem (dev, dma_mem); + +return -EBUSY ; + } + + ctlq_msg = ctlq->tx_msg[ctlq->next_to_use]; + xn->tx_msg = dma_mem == &xn->small_dma_mem ? ctlq_msg :NULL ; +if (params->ctlq_msg) + *ctlq_msg = *params->ctlq_msg; +else +/* Unused ctlq messages are already zeroed */ + ctlq_msg->opcode =LIBIE_CTLQ_SEND_MSG_TO_CP ; + + ctlq_msg->sw_cookie = cookie; + ctlq_msg->send_mem = *dma_mem; + ctlq_msg->data_len = buf_len; + ctlq_msg->chnl_opcode = params->chnl_opcode; +libie_ctlq_send (params->ctlq,1 ); + } + +return 0 ; +} + +/** +* libie_ctlq_xn_send - send a control queue message, initiating a transaction +* @params: Xn send param information for sending a control queue message +* +* Send a control queue (mailbox or config) message. +* Based on the params value, the call can be completed synchronously or +* asynchronously. +* +* Return: %0 on success, -%errno on failure. +*/ +int libie_ctlq_xn_send (struct libie_ctlq_xn_send_params *params) +{ +bool free_send = !libie_cp_can_send_onstack (params->send_buf.iov_len); +struct libie_ctlq_xn *xn; +int ret; + +if (params->send_buf.iov_len >LIBIE_CTLQ_MAX_BUF_LEN ) { + ret = -EINVAL ; + goto free_buf; + } + + xn =libie_ctlq_xn_pop_free (params->xnm); +/* no free transactions available */ +if (unlikely (!xn)) { + ret = -EAGAIN ; + goto free_buf; + } + +spin_lock (&xn->xn_lock); +if (xn->state ==LIBIE_CTLQ_XN_SHUTDOWN ) { + ret = -ENXIO ; + goto unlock_xn; + } + + xn->state = params->resp_cb ?LIBIE_CTLQ_XN_ASYNC : +LIBIE_CTLQ_XN_WAITING ; + xn->virtchnl_opcode = params->chnl_opcode; + +if (params->resp_cb) { + xn->send_ctx = params->send_ctx; + xn->resp_cb = params->resp_cb; + xn->timeout_ms = params->timeout_ms; + xn->timestamp =ktime_get (); + } + + ret =libie_ctlq_xn_process_send (params, xn); +if (ret) + goto release_xn; +else + free_send = false; + +spin_unlock (&xn->xn_lock); + +if (params->resp_cb) +return 0 ; + +wait_for_completion_timeout (&xn->cmd_completion_event, +msecs_to_jiffies (params->timeout_ms)); + +spin_lock (&xn->xn_lock); +switch (xn->state) { +case LIBIE_CTLQ_XN_WAITING : + ret = -ETIMEDOUT ; +break ; +case LIBIE_CTLQ_XN_COMPLETED_SUCCESS : + params->recv_mem = xn->recv_mem; +break ; +default : + ret = -EBADMSG ; +break ; + } + +/* Free the receive buffer in case of failure. On timeout, receive +* buffer is not allocated. +*/ +if (ret && ret != -ETIMEDOUT ) +libie_ctlq_release_rx_buf (&xn->recv_mem); + +release_xn: + xn->state =LIBIE_CTLQ_XN_IDLE ; +reinit_completion (&xn->cmd_completion_event); +unlock_xn: +spin_unlock (&xn->xn_lock); +libie_ctlq_xn_push_free (params->xnm, xn); +free_buf: +if (free_send) + params->rel_tx_buf (params->send_buf.iov_base); + +return ret; +} +EXPORT_SYMBOL_NS_GPL (libie_ctlq_xn_send,"LIBIE_CP" ); + +/** +* struct libie_ctlq_xn_rel_tx_ctx - context needed to release xn Tx message +* @dev: device for which DMA was mapped +* @rel_tx_buf: freeing function for non-small buffers +*/ +struct libie_ctlq_xn_rel_tx_ctx { +struct device *dev; +void (*rel_tx_buf)(const void *buf_va); +}; + +/** +* libie_ctlq_xn_rel_tx_buf - release xn-controlled Tx message buffer +* @ctx: context, namely DMA device and freeing function +* @dma_mem: DMA memory to reclaim/unmap +*/ +static void libie_ctlq_xn_rel_tx_buf (const void *ctx, +struct libie_cp_dma_mem *dma_mem) +{ +const struct libie_ctlq_xn_rel_tx_ctx *rel_ctx = ctx; + +if (!libie_cp_can_send_onstack (dma_mem->size)) { +libie_cp_unmap_dma_mem (rel_ctx->dev, dma_mem); + rel_ctx->rel_tx_buf (dma_mem->va); + } +} + +/** +* libie_ctlq_xn_send_clean - clean xn-controlled Tx messages +* @ctlq: control queue to clean +* @rel_tx_buf: driver callback to free the buffer +* @force: clean regardless of DD +* +* Return: number of completed/released messages. +*/ +u32 libie_ctlq_xn_send_clean (struct libie_ctlq_info *ctlq, +void (*rel_tx_buf)(const void *buf_va), +bool force) +{ +struct libie_ctlq_xn_rel_tx_ctx rel_ctx = { + .dev = ctlq->dev, + .rel_tx_buf = rel_tx_buf, + }; +struct libie_ctlq_clean_params params = { + .ctlq = ctlq, + .force = force, + .num_msgs = ctlq->ring_len, + .rel_ctx = &rel_ctx, + .rel_dma_mem = libie_ctlq_xn_rel_tx_buf, + }; + +return libie_ctlq_send_clean (¶ms); +} +EXPORT_SYMBOL_NS_GPL (libie_ctlq_xn_send_clean,"LIBIE_CP" ); + +/** +* libie_ctlq_xn_shutdown - terminate control queue transactions +* @xnm: pointer to the transaction manager +* +* Synchronously terminate existing transactions and stop accepting new ones. +* Async transactions are discarded without invoking resp_cb. +*/ +void libie_ctlq_xn_shutdown (struct libie_ctlq_xn_manager *xnm) +{ +bool must_wait = false; +u32 i; + +/* Should be no new clear bits after this */ +spin_lock (&xnm->free_xns_bm_lock); + xnm->shutdown = true; + +for_each_clear_bit (i, xnm->free_xns_bm,LIBIE_CTLQ_MAX_XN_ENTRIES ) { +struct libie_ctlq_xn *xn = &xnm->ring[i]; + +spin_lock (&xn->xn_lock); + +switch (xn->state) { +/* if an idle xn is not free, it is about to be either +* freed or initialized, prevent the latter and wait +*/ +case LIBIE_CTLQ_XN_IDLE : + xn->state =LIBIE_CTLQ_XN_SHUTDOWN ; + fallthrough; +/* waiting thread possibly needs a push to return the xn, +* transaction will be reported as timed out +*/ +case LIBIE_CTLQ_XN_WAITING : +complete (&xn->cmd_completion_event); + fallthrough; +/* these states will return the xn soon */ +case LIBIE_CTLQ_XN_COMPLETED_SUCCESS : +case LIBIE_CTLQ_XN_COMPLETED_FAILED : +case LIBIE_CTLQ_XN_SHUTDOWN : + must_wait = true; +break ; +/* no thread should reference async xns at this point */ +case LIBIE_CTLQ_XN_ASYNC : + xn->state =LIBIE_CTLQ_XN_IDLE ; +__libie_ctlq_xn_push_free (xnm, xn); +break ; + } + +spin_unlock (&xn->xn_lock); + } + +spin_unlock (&xnm->free_xns_bm_lock); + +if (must_wait) +wait_for_completion (&xnm->can_destroy); +} +EXPORT_SYMBOL_NS_GPL (libie_ctlq_xn_shutdown,"LIBIE_CP" ); + +/** +* libie_ctlq_xn_deinit - deallocate and free the transaction manager resources +* @xnm: pointer to the transaction manager +* @ctx: libie CP context information +* +* Rx processing must be stopped beforehand via cancelling tasks. +* Tx processing must be stopped beforehand via libie_ctlq_xn_shutdown(), +* all buffers must be force-cleaned from the send queue. +*/ +void libie_ctlq_xn_deinit (struct libie_ctlq_xn_manager *xnm, +struct libie_ctlq_ctx *ctx) +{ +libie_ctlq_xn_deinit_dma (xnm,LIBIE_CTLQ_MAX_XN_ENTRIES ); +kvfree (xnm); +libie_ctlq_deinit (ctx); +} +EXPORT_SYMBOL_NS_GPL (libie_ctlq_xn_deinit,"LIBIE_CP" ); + +/** +* libie_ctlq_xn_init - initialize the Xn transaction manager +* @params: Xn init param information for allocating Xn manager resources +* +* Return: %0 on success, -%errno on failure. +*/ +int libie_ctlq_xn_init (struct libie_ctlq_xn_init_params *params) +{ +struct libie_ctlq_xn_manager *xnm; +int ret; + + ret =libie_ctlq_init (params->ctx, params->cctlq_info, params->num_qs); +if (ret) +return ret; + + xnm =kvzalloc_obj (*xnm); +if (!xnm) + goto ctlq_deinit; + + ret =libie_ctlq_xn_init_dma (¶ms->ctx->mmio_info.pdev->dev, xnm); +if (ret) + goto free_xnm; + +spin_lock_init (&xnm->free_xns_bm_lock); +init_completion (&xnm->can_destroy); +bitmap_fill (xnm->free_xns_bm,LIBIE_CTLQ_MAX_XN_ENTRIES ); + +for (u32 i =0 ; i <LIBIE_CTLQ_MAX_XN_ENTRIES ; i++) { +struct libie_ctlq_xn *xn = &xnm->ring[i]; + + xn->index = i; +init_completion (&xn->cmd_completion_event); +spin_lock_init (&xn->xn_lock); + } + xnm->ctx = params->ctx; + params->xnm = xnm; + +return 0 ; + +free_xnm: +kvfree (xnm); +ctlq_deinit: +libie_ctlq_deinit (params->ctx); + +return -ENOMEM ; +} +EXPORT_SYMBOL_NS_GPL (libie_ctlq_xn_init,"LIBIE_CP" ); +MODULE_DESCRIPTION ("Control Plane communication API" );MODULE_IMPORT_NS ("LIBETH" );MODULE_LICENSE ("GPL" );
include/linux/net/intel/libie/controlq.h +160 -0
176 lines not on this page · raw message
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH v8 6/15 idpf: remove 'vport_params_reqd' field
In reply to Tony NguyenFrom: Pavan Kumar Linga <[email protected]>
While sending a create vport message to the device control plane, a create vport virtchnl message is prepared with all the required info to initialize the vport. This info is stored in the adapter struct but never used thereafter. So, remove the said field.
--- drivers/net/ethernet/intel/idpf/idpf.h | 2 -- drivers/net/ethernet/intel/idpf/idpf_lib.c | 2 -- .../net/ethernet/intel/idpf/idpf_virtchnl.c | 30 +++++++------------ 3 files changed, 10 insertions(+), 24 deletions(-)
drivers/net/ethernet/intel/idpf/idpf.h +0 -2
@@ -638,7 +638,6 @@ struct idpf_vc_xn_manager;* @avail_queues: Device given queue limits * @vports: Array to store vports created by the driver * @netdevs: Associated Vport netdevs -* @vport_params_reqd: Vport params requested * @vport_params_recvd: Vport params received * @vport_ids: Array of device given vport identifiers * @singleq_pt_lkup: Lookup table for singleq RX ptypes
@@ -697,7 +696,6 @@ struct idpf_adapter {struct idpf_avail_queue_info avail_queues;struct idpf_vport **vports;struct net_device **netdevs; -struct virtchnl2_create_vport **vport_params_reqd;struct virtchnl2_create_vport **vport_params_recvd;u32 *vport_ids;
drivers/net/ethernet/intel/idpf/idpf_lib.c +0 -2
@@ -1109,8 +1109,6 @@ static void idpf_vport_rel(struct idpf_vport *vport)kfree (adapter->vport_params_recvd[idx]); adapter->vport_params_recvd[idx] =NULL ; -kfree (adapter->vport_params_reqd[idx]); - adapter->vport_params_reqd[idx] =NULL ;kfree (vport); adapter->num_alloc_vports--;
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +10 -20
@@ -1558,14 +1558,10 @@ int idpf_send_create_vport_msg(struct idpf_adapter *adapter,ssize_t reply_sz; buf_size =sizeof (struct virtchnl2_create_vport ); -if (!adapter->vport_params_reqd[idx]) { - adapter->vport_params_reqd[idx] =kzalloc (buf_size, -GFP_KERNEL ); -if (!adapter->vport_params_reqd[idx]) -return -ENOMEM ; - } + vport_msg =kzalloc (buf_size,GFP_KERNEL ); +if (!vport_msg) +return -ENOMEM ; - vport_msg = adapter->vport_params_reqd[idx]; vport_msg->vport_type =cpu_to_le16 (VIRTCHNL2_VPORT_TYPE_DEFAULT ); vport_msg->vport_index =cpu_to_le16 (idx);
@@ -1582,8 +1578,7 @@ int idpf_send_create_vport_msg(struct idpf_adapter *adapter, err =idpf_vport_calc_total_qs (adapter, idx, vport_msg, max_q);if (err) {dev_err (&adapter->pdev->dev,"Enough queues are not available" ); - -return err; + goto rel_buf; }if (!adapter->vport_params_recvd[idx]) {
@@ -1591,7 +1586,7 @@ int idpf_send_create_vport_msg(struct idpf_adapter *adapter, GFP_KERNEL);if (!adapter->vport_params_recvd[idx]) { err = -ENOMEM ; - goto free_vport_params; + goto rel_buf; } }
@@ -1607,13 +1602,15 @@ int idpf_send_create_vport_msg(struct idpf_adapter *adapter, goto free_vport_params; } +kfree (vport_msg); +return 0 ; free_vport_params:kfree (adapter->vport_params_recvd[idx]); adapter->vport_params_recvd[idx] =NULL ; -kfree (adapter->vport_params_reqd[idx]); - adapter->vport_params_reqd[idx] =NULL ; +rel_buf: +kfree (vport_msg);return err; }
@@ -3419,8 +3416,6 @@ static void idpf_vport_params_buf_rel(struct idpf_adapter *adapter) {kfree (adapter->vport_params_recvd); adapter->vport_params_recvd =NULL ; -kfree (adapter->vport_params_reqd); - adapter->vport_params_reqd =NULL ;kfree (adapter->vport_ids); adapter->vport_ids =NULL ; }
@@ -3435,15 +3430,10 @@ static int idpf_vport_params_buf_alloc(struct idpf_adapter *adapter) {u16 num_max_vports =idpf_get_max_vports (adapter); - adapter->vport_params_reqd =kzalloc_objs (*adapter->vport_params_reqd, - num_max_vports); -if (!adapter->vport_params_reqd) -return -ENOMEM ; - adapter->vport_params_recvd =kzalloc_objs (*adapter->vport_params_recvd, num_max_vports);if (!adapter->vport_params_recvd) - goto err_mem; +return -ENOMEM ; adapter->vport_ids =kcalloc (num_max_vports,sizeof (u32),GFP_KERNEL );if (!adapter->vport_ids)
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH v8 7/15 idpf: remove unused code for getting RSS info from device
In reply to Tony NguyenFrom: Larysa Zaremba <[email protected]>
idpf_send_get_set_rss_lut_msg() and idpf_send_get_set_rss_key_msg() do not handle the get=true path properly. Response validation is insufficient, memcpy size is wrong, LE-to-CPU conversion is missing. Fortunately, those functions are never used with get=true. Given how broken this dead code is, it is unlikely to be useful in the future.
Rename idpf_send_get_set_rss_lut_msg() to idpf_send_set_rss_lut_msg(), idpf_send_get_set_rss_key_msg() to idpf_send_set_rss_key_msg(), remove the get parameter and remove all get=true cases from the function.
--- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 4 +- .../net/ethernet/intel/idpf/idpf_virtchnl.c | 107 +++--------------- .../net/ethernet/intel/idpf/idpf_virtchnl.h | 10 +- 3 files changed, 22 insertions(+), 99 deletions(-)
drivers/net/ethernet/intel/idpf/idpf_txrx.c +2 -2
@@ -4676,11 +4676,11 @@ int idpf_config_rss(struct idpf_vport *vport, struct idpf_rss_data *rss_data)u32 vport_id = vport->vport_id;int err; - err =idpf_send_get_set_rss_key_msg (adapter, rss_data, vport_id, false); + err =idpf_send_set_rss_key_msg (adapter, rss_data, vport_id);if (err)return err; -return idpf_send_get_set_rss_lut_msg (adapter, rss_data, vport_id, false); +return idpf_send_set_rss_lut_msg (adapter, rss_data, vport_id); }/**
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +16 -91
166 lines not on this page · raw message
drivers/net/ethernet/intel/idpf/idpf_virtchnl.h +4 -6
@@ -208,12 +208,10 @@ int idpf_send_ena_dis_loopback_msg(struct idpf_adapter *adapter, u32 vport_id,int idpf_send_get_stats_msg (struct idpf_netdev_priv *np,struct idpf_port_stats *port_stats);int idpf_send_set_sriov_vfs_msg (struct idpf_adapter *adapter,u16 num_vfs); -int idpf_send_get_set_rss_key_msg (struct idpf_adapter *adapter, -struct idpf_rss_data *rss_data, -u32 vport_id,bool get); -int idpf_send_get_set_rss_lut_msg (struct idpf_adapter *adapter, -struct idpf_rss_data *rss_data, -u32 vport_id,bool get); +int idpf_send_set_rss_key_msg (struct idpf_adapter *adapter, +struct idpf_rss_data *rss_data,u32 vport_id); +int idpf_send_set_rss_lut_msg (struct idpf_adapter *adapter, +struct idpf_rss_data *rss_data,u32 vport_id);void idpf_vc_xn_shutdown (struct idpf_vc_xn_manager *vcxn_mngr); int idpf_idc_rdma_vc_send_sync(struct iidc_rdma_core_dev_info *cdev_info, u8 *send_msg, u16 msg_size,
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH v8 8/15 idpf: refactor idpf to use libie_pci APIs
In reply to Tony NguyenFrom: Pavan Kumar Linga <[email protected]>
Use libie_pci init and MMIO APIs where possible, struct idpf_hw cannot be deleted for now as it also houses control queues that will be refactored later.
Memory regions are added and removed in layers, so e.g. mailbox and rstat are added first and not removed until teardown. libie_pci stores the regions in the order of addition, so no new locks/checks are required, despite the data structure change.
Use libie_cp header for libie_ctlq_ctx that contains mmio info from the start in order to not increase the diff later.
--- drivers/net/ethernet/intel/idpf/Kconfig | 1 + drivers/net/ethernet/intel/idpf/idpf.h | 70 +------ .../net/ethernet/intel/idpf/idpf_controlq.c | 26 ++- .../net/ethernet/intel/idpf/idpf_controlq.h | 2 - drivers/net/ethernet/intel/idpf/idpf_dev.c | 61 ++++--- drivers/net/ethernet/intel/idpf/idpf_idc.c | 32 +++- drivers/net/ethernet/intel/idpf/idpf_lib.c | 7 +- drivers/net/ethernet/intel/idpf/idpf_main.c | 114 ++++++------ drivers/net/ethernet/intel/idpf/idpf_vf_dev.c | 57 +++--- .../net/ethernet/intel/idpf/idpf_virtchnl.c | 171 +++++++++--------- .../net/ethernet/intel/idpf/idpf_virtchnl.h | 2 + .../ethernet/intel/idpf/idpf_virtchnl_ptp.c | 58 +++--- 12 files changed, 285 insertions(+), 316 deletions(-)
drivers/net/ethernet/intel/idpf/Kconfig +1 -0
@@ -6,6 +6,7 @@ config IDPF depends on PCI_MSI depends on PTP_1588_CLOCK_OPTIONAL select DIMLIB + select LIBIE_CP select LIBETH_XDP help This driver supports Intel(R) Infrastructure Data Path Function
drivers/net/ethernet/intel/idpf/idpf.h +5 -65
100 lines not on this page · raw message
drivers/net/ethernet/intel/idpf/idpf_controlq.c +18 -8
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only /* Copyright (C) 2023 Intel Corporation */ -#include "idpf_controlq.h" +#include "idpf.h" /** * idpf_ctlq_setup_regs - initialize control queue registers
@@ -34,21 +34,27 @@ static void idpf_ctlq_setup_regs(struct idpf_ctlq_info *cq,static void idpf_ctlq_init_regs (struct idpf_hw *hw,struct idpf_ctlq_info *cq,bool is_rxq) { +struct libie_mmio_info *mmio = &hw->back->ctlq_ctx.mmio_info; +/* Update tail to post pre-allocated buffers for rx queues */ if (is_rxq) -idpf_mbx_wr32 (hw, cq->reg.tail, (u32)(cq->ring_size -1 )); +writel ((u32)(cq->ring_size -1 ), +libie_pci_get_mmio_addr (mmio, cq->reg.tail));/* For non-Mailbox control queues only TAIL need to be set */ if (cq->q_id !=-1 )return ;/* Clear Head for both send or receive */ -idpf_mbx_wr32 (hw, cq->reg.head,0 ); +writel (0 ,libie_pci_get_mmio_addr (mmio, cq->reg.head));/* set starting point */ -idpf_mbx_wr32 (hw, cq->reg.bal,lower_32_bits (cq->desc_ring.pa)); -idpf_mbx_wr32 (hw, cq->reg.bah,upper_32_bits (cq->desc_ring.pa)); -idpf_mbx_wr32 (hw, cq->reg.len, (cq->ring_size | cq->reg.len_ena_mask)); +writel (lower_32_bits (cq->desc_ring.pa), +libie_pci_get_mmio_addr (mmio, cq->reg.bal)); +writel (upper_32_bits (cq->desc_ring.pa), +libie_pci_get_mmio_addr (mmio, cq->reg.bah)); +writel ((cq->ring_size | cq->reg.len_ena_mask), +libie_pci_get_mmio_addr (mmio, cq->reg.len)); }/**
@@ -326,7 +332,9 @@ int idpf_ctlq_send(struct idpf_hw *hw, struct idpf_ctlq_info *cq,*/ dma_wmb (); -idpf_mbx_wr32 (hw, cq->reg.tail, cq->next_to_use); +writel (cq->next_to_use, +libie_pci_get_mmio_addr (&hw->back->ctlq_ctx.mmio_info, + cq->reg.tail)); err_unlock:spin_unlock (&cq->cq_lock);
@@ -518,7 +526,9 @@ int idpf_ctlq_post_rx_buffs(struct idpf_hw *hw, struct idpf_ctlq_info *cq,dma_wmb (); -idpf_mbx_wr32 (hw, cq->reg.tail, cq->next_to_post); +writel (cq->next_to_post, +libie_pci_get_mmio_addr (&hw->back->ctlq_ctx.mmio_info, + cq->reg.tail)); }spin_unlock (&cq->cq_lock);
drivers/net/ethernet/intel/idpf/idpf_controlq.h +0 -2
@@ -109,8 +109,6 @@ struct idpf_mmio_reg {* Align to ctlq_hw_info */ struct idpf_hw { -struct idpf_mmio_reg mbx; -struct idpf_mmio_reg rstat;/* Array of remaining LAN BAR regions */ int num_lan_regs;struct idpf_mmio_reg *lan_regs;
drivers/net/ethernet/intel/idpf/idpf_dev.c +33 -28
135 lines not on this page · raw message
drivers/net/ethernet/intel/idpf/idpf_idc.c +22 -10
@@ -416,9 +416,12 @@ idpf_idc_init_msix_data(struct idpf_adapter *adapter)int idpf_idc_init_aux_core_dev (struct idpf_adapter *adapter,enum iidc_function_type ftype) { +struct libie_mmio_info *mmio = &adapter->ctlq_ctx.mmio_info;struct iidc_rdma_core_dev_info *cdev_info;struct iidc_rdma_priv_dev_info *privd; -int err, i; +struct libie_pci_mmio_region *mr; +size_t num_mem_regions; +int err, i =0 ; adapter->cdev_info =kzalloc_obj (*cdev_info);if (!adapter->cdev_info)
@@ -436,22 +439,31 @@ int idpf_idc_init_aux_core_dev(struct idpf_adapter *adapter, cdev_info->rdma_protocol =IIDC_RDMA_PROTOCOL_ROCEV2 ; privd->ftype = ftype; + num_mem_regions =list_count_nodes (&mmio->mmio_list); +if (num_mem_regions <=IDPF_MMIO_REG_NUM_STATIC ) { + err = -EINVAL ; + goto err_plug_aux_dev; + } + + num_mem_regions -=IDPF_MMIO_REG_NUM_STATIC ; privd->mapped_mem_regions = kzalloc_objs(struct iidc_rdma_lan_mapped_mem_region, - adapter->hw.num_lan_regs); + num_mem_regions);if (!privd->mapped_mem_regions) { err = -ENOMEM ; goto err_plug_aux_dev; } - privd->num_memory_regions =cpu_to_le16 (adapter->hw.num_lan_regs); -for (i =0 ; i < adapter->hw.num_lan_regs; i++) { - privd->mapped_mem_regions[i].region_addr = - adapter->hw.lan_regs[i].vaddr; - privd->mapped_mem_regions[i].size = -cpu_to_le64 (adapter->hw.lan_regs[i].addr_len); - privd->mapped_mem_regions[i].start_offset = -cpu_to_le64 (adapter->hw.lan_regs[i].addr_start); + privd->num_memory_regions =cpu_to_le16 (num_mem_regions); +list_for_each_entry (mr, &mmio->mmio_list, list) { +if (!idpf_mmio_region_non_static (&adapter->ctlq_ctx.mmio_info, + mr)) +continue ; + + privd->mapped_mem_regions[i].region_addr = mr->addr; + privd->mapped_mem_regions[i].size =cpu_to_le64 (mr->size); + privd->mapped_mem_regions[i++].start_offset = +cpu_to_le64 (mr->offset); }idpf_idc_init_msix_data (adapter);
drivers/net/ethernet/intel/idpf/idpf_lib.c +3 -4
@@ -1847,15 +1847,14 @@ void idpf_deinit_task(struct idpf_adapter *adapter)/** * idpf_check_reset_complete - check that reset is complete -* @hw: pointer to hw struct +* @adapter: adapter to check * @reset_reg: struct with reset registers * * Returns 0 if device is ready to use, or -EBUSY if it's in reset. **/ -static int idpf_check_reset_complete (struct idpf_hw *hw, +static int idpf_check_reset_complete (struct idpf_adapter *adapter,struct idpf_reset_reg *reset_reg) { -struct idpf_adapter *adapter = hw->back;int i;for (i =0 ; i <2000 ; i++) {
@@ -1918,7 +1917,7 @@ static void idpf_init_hard_reset(struct idpf_adapter *adapter) }/* Wait for reset to complete */ - err =idpf_check_reset_complete (&adapter->hw, &adapter->reset_reg); + err =idpf_check_reset_complete (adapter, &adapter->reset_reg);if (err) {dev_err (dev,"The driver was unable to contact the device's firmware. Check that the FW is running. Driver state= 0x%x\n" , adapter->state);
drivers/net/ethernet/intel/idpf/idpf_main.c +54 -60
199 lines not on this page · raw message
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +30 -27
123 lines not on this page · raw message
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +85 -86
285 lines not on this page · raw message
drivers/net/ethernet/intel/idpf/idpf_virtchnl.h +2 -0
@@ -127,6 +127,8 @@ unsigned int idpf_fsteer_max_rules(struct idpf_vport *vport);int idpf_recv_mb_msg (struct idpf_adapter *adapter,struct idpf_ctlq_info *arq);int idpf_send_mb_msg (struct idpf_adapter *adapter,struct idpf_ctlq_info *asq,u32 op,u16 msg_size,u8 *msg,u16 cookie); +bool idpf_mmio_region_non_static (struct libie_mmio_info *mmio_info, +struct libie_pci_mmio_region *reg);struct idpf_queue_ptr {enum virtchnl2_queue_type type;
drivers/net/ethernet/intel/idpf/idpf_virtchnl_ptp.c +32 -26
99 lines not on this page · raw message
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH v8 9/15 idpf: refactor idpf to use libie control queues
In reply to Tony NguyenFrom: Pavan Kumar Linga <[email protected]>
Support to initialize and configure controlqs, and manage their transactions was introduced in libie. As part of it, most of the existing controlq structures are renamed and modified. Use those APIs in idpf and make all the necessary changes.
Previously for the send and receive virtchnl messages, there used to be a memcpy involved in controlq code to copy the buffer info passed by the send function into the controlq specific buffers. There was no restriction to use automatic memory in that case. The new implementation in libie removed copying of the send buffer info and introduced DMA mapping of the send buffer itself. To accommodate it, use dynamic memory for the larger send buffers. For smaller ones (<= 128 bytes) libie still can copy them into the pre-allocated message memory. Those changes result in a pretty big diff, but the changes are fairly trivial and localized.
In case of receive, idpf receives a page pool buffer allocated by the libie and care should be taken to release it after use in the idpf.
idpf_idc_rdma_vc_send_sync() no longer truncates oversized responses or zeroes *recv_len on error, but this was confirmed to have no practical impact for any existing callers.
This refactoring introduces roughly additional 40KB of module storage used for systems that only run idpf, so idpf + libie_cp + libie_pci takes about 7% more storage than just idpf before refactoring.
We now pre-allocate small TX buffers, so that does increase the memory usage, but reduces the need to allocate. This results in additional 256 * 128B of memory permanently used, increasing the worst-case memory usage by 32KB but our ctlq RX buffers need to be of size 4096B anyway (not changed by the patchset), so this is hardly noticeable.
As for the timings, the fact that we are mostly limited by the HW response time which is far from instant, is not changed by this refactor.
--- drivers/net/ethernet/intel/idpf/Makefile | 2 - drivers/net/ethernet/intel/idpf/idpf.h | 28 +- .../net/ethernet/intel/idpf/idpf_controlq.c | 631 ------- .../net/ethernet/intel/idpf/idpf_controlq.h | 142 -- .../ethernet/intel/idpf/idpf_controlq_api.h | 177 -- .../ethernet/intel/idpf/idpf_controlq_setup.c | 169 -- drivers/net/ethernet/intel/idpf/idpf_dev.c | 60 +- .../net/ethernet/intel/idpf/idpf_ethtool.c | 28 +- drivers/net/ethernet/intel/idpf/idpf_lib.c | 51 +- drivers/net/ethernet/intel/idpf/idpf_main.c | 3 - drivers/net/ethernet/intel/idpf/idpf_mem.h | 20 - drivers/net/ethernet/intel/idpf/idpf_txrx.h | 2 +- drivers/net/ethernet/intel/idpf/idpf_vf_dev.c | 61 +- .../net/ethernet/intel/idpf/idpf_virtchnl.c | 1595 +++++++---------- .../net/ethernet/intel/idpf/idpf_virtchnl.h | 113 +- .../ethernet/intel/idpf/idpf_virtchnl_ptp.c | 252 ++- 16 files changed, 847 insertions(+), 2487 deletions(-) delete mode 100644 drivers/net/ethernet/intel/idpf/idpf_controlq.c delete mode 100644 drivers/net/ethernet/intel/idpf/idpf_controlq.h delete mode 100644 drivers/net/ethernet/intel/idpf/idpf_controlq_api.h delete mode 100644 drivers/net/ethernet/intel/idpf/idpf_controlq_setup.c delete mode 100644 drivers/net/ethernet/intel/idpf/idpf_mem.h
drivers/net/ethernet/intel/idpf/Makefile +0 -2
@@ -6,8 +6,6 @@ obj-$(CONFIG_IDPF) += idpf.o idpf-y := \ - idpf_controlq.o \ - idpf_controlq_setup.o \ idpf_dev.o \ idpf_ethtool.o \ idpf_idc.o \
drivers/net/ethernet/intel/idpf/idpf.h +13 -15
@@ -27,7 +27,6 @@ struct idpf_rss_data;#include <linux/net/intel/virtchnl2.h> #include "idpf_txrx.h" -#include "idpf_controlq.h" #define GETMAXVAL (num_bits) GENMASK((num_bits) - 1, 0)
@@ -37,11 +36,10 @@ struct idpf_rss_data;#define IDPF_NUM_FILTERS_PER_MSG 20#define IDPF_NUM_DFLT_MBX_Q 2/* includes both TX and RX */ #define IDPF_DFLT_MBX_Q_LEN 64 -#define IDPF_DFLT_MBX_ID -1/* maximum number of times to try before resetting mailbox */ #define IDPF_MB_MAX_ERR 20#define IDPF_NUM_CHUNKS_PER_MSG (struct_sz, chunk_sz) \ - ((IDPF_CTLQ_MAX_BUF_LEN - (struct_sz)) / (chunk_sz)) + ((LIBIE_CTLQ_MAX_BUF_LEN - (struct_sz)) / (chunk_sz))#define IDPF_WAIT_FOR_MARKER_TIMEO 500#define IDPF_MAX_WAIT 500
@@ -202,8 +200,8 @@ struct idpf_vport_max_q {* @ptp_reg_init: PTP register initialization */ struct idpf_reg_ops { -void (*ctlq_reg_init)(struct idpf_adapter *adapter, -struct idpf_ctlq_create_info *cq); +void (*ctlq_reg_init)(struct libie_mmio_info *mmio, +struct libie_ctlq_create_info *cctlq_info);int (*intr_reg_init)(struct idpf_vport *vport,struct idpf_q_vec_rsrc *rsrc);void (*mb_intr_reg_init)(struct idpf_adapter *adapter);
@@ -606,8 +604,6 @@ struct idpf_vport_config {DECLARE_BITMAP (flags,IDPF_VPORT_CONFIG_FLAGS_NBITS ); }; -struct idpf_vc_xn_manager ; -#define idpf_for_each_vport (adapter, iter) \ for (struct idpf_vport **__##iter = &(adapter)->vports[0], \ *iter = (adapter)->max_vports ? *__##iter : NULL; \
@@ -625,8 +621,10 @@ struct idpf_vc_xn_manager;* @state: Init state machine * @flags: See enum idpf_flags * @reset_reg: See struct idpf_reset_reg -* @hw: Device access data * @ctlq_ctx: controlq context +* @asq: Send control queue info +* @arq: Receive control queue info +* @xnm: Xn transaction manager * @num_avail_msix: Available number of MSIX vectors * @num_msix_entries: Number of entries in MSIX table * @msix_entries: MSIX table
@@ -659,7 +657,6 @@ struct idpf_vc_xn_manager;* @stats_task: Periodic statistics retrieval task * @stats_wq: Workqueue for statistics task * @caps: Negotiated capabilities with device -* @vcxn_mngr: Virtchnl transaction manager * @dev_ops: See idpf_dev_ops * @cdev_info: IDC core device info pointer * @num_vfs: Number of allocated VFs through sysfs. PF does not directly talk
@@ -683,8 +680,10 @@ struct idpf_adapter {enum idpf_state state;DECLARE_BITMAP (flags,IDPF_FLAGS_NBITS );struct idpf_reset_reg reset_reg; -struct idpf_hw hw;struct libie_ctlq_ctx ctlq_ctx; +struct libie_ctlq_info *asq; +struct libie_ctlq_info *arq; +struct libie_ctlq_xn_manager *xnm;u16 num_avail_msix;u16 num_msix_entries;struct msix_entry *msix_entries;
@@ -721,7 +720,6 @@ struct idpf_adapter {struct delayed_work stats_task;struct workqueue_struct *stats_wq;struct virtchnl2_get_capabilities caps; -struct idpf_vc_xn_manager *vcxn_mngr;struct idpf_dev_ops dev_ops;struct iidc_rdma_core_dev_info *cdev_info;
@@ -881,12 +879,12 @@ static inline u8 idpf_get_min_tx_pkt_len(struct idpf_adapter *adapter)*/ static inline bool idpf_is_reset_detected (struct idpf_adapter *adapter) { -if (!adapter->hw.arq) +struct libie_ctlq_info *arq = adapter->arq; + +if (!arq)return true; -return !(readl (libie_pci_get_mmio_addr (&adapter->ctlq_ctx.mmio_info, - adapter->hw.arq->reg.len)) & - adapter->hw.arq->reg.len_mask); +return !(readl (arq->reg.len) & arq->reg.len_mask); }/**
drivers/net/ethernet/intel/idpf/idpf_controlq.c deleted +0 -631
631 lines not on this page · raw message
drivers/net/ethernet/intel/idpf/idpf_controlq.h deleted +0 -142
142 lines not on this page · raw message
drivers/net/ethernet/intel/idpf/idpf_controlq_api.h deleted +0 -177
177 lines not on this page · raw message
drivers/net/ethernet/intel/idpf/idpf_controlq_setup.c deleted +0 -169
169 lines not on this page · raw message
drivers/net/ethernet/intel/idpf/idpf_dev.c +24 -36
68 lines not on this page · raw message
drivers/net/ethernet/intel/idpf/idpf_ethtool.c +10 -18
@@ -225,7 +225,7 @@ static int idpf_add_flow_steer(struct net_device *netdev,spin_unlock_bh (&vport_config->flow_steer_list_lock);if (err) - goto out; + goto out_free_fltr; rule->vport_id =cpu_to_le32 (vport->vport_id); rule->count =cpu_to_le32 (1 );
@@ -252,17 +252,15 @@ static int idpf_add_flow_steer(struct net_device *netdev,break ;default : err = -EINVAL ; - goto out; + goto out_free_fltr; } err =idpf_add_del_fsteer_filters (vport->adapter, rule,VIRTCHNL2_OP_ADD_FLOW_RULE ); -if (err) - goto out; - -if (info->status !=cpu_to_le32 (VIRTCHNL2_FLOW_RULE_SUCCESS )) { - err = -EIO ; - goto out; +if (err) { +/* virtchnl2 rule is already consumed */ +kfree (fltr); +return err; }/* Save a copy of the user's flow spec so ethtool can later retrieve it */
@@ -274,9 +272,10 @@ static int idpf_add_flow_steer(struct net_device *netdev, user_config->num_fsteer_fltrs++;spin_unlock_bh (&vport_config->flow_steer_list_lock); - goto out_free_rule; -out: +return 0 ; + +out_free_fltr:kfree (fltr); out_free_rule:kfree (rule);
@@ -319,12 +318,7 @@ static int idpf_del_flow_steer(struct net_device *netdev, err =idpf_add_del_fsteer_filters (vport->adapter, rule,VIRTCHNL2_OP_DEL_FLOW_RULE );if (err) - goto out; - -if (info->status !=cpu_to_le32 (VIRTCHNL2_FLOW_RULE_SUCCESS )) { - err = -EIO ; - goto out; - } +return err;spin_lock_bh (&vport_config->flow_steer_list_lock); list_for_each_entry_safe(f, iter,
@@ -340,8 +334,6 @@ static int idpf_del_flow_steer(struct net_device *netdev, out_unlock:spin_unlock_bh (&vport_config->flow_steer_list_lock); -out: -kfree (rule);return err; }
drivers/net/ethernet/intel/idpf/idpf_lib.c +11 -40
75 lines not on this page · raw message
drivers/net/ethernet/intel/idpf/idpf_main.c +0 -3
@@ -170,8 +170,6 @@ static void idpf_remove(struct pci_dev *pdev) adapter->vport_config =NULL ;kfree (adapter->netdevs); adapter->netdevs =NULL ; -kfree (adapter->vcxn_mngr); - adapter->vcxn_mngr =NULL ;mutex_destroy (&adapter->vport_ctrl_lock);mutex_destroy (&adapter->vector_lock);
@@ -239,7 +237,6 @@ static int idpf_cfg_device(struct idpf_adapter *adapter)pci_dbg (pdev,"PCIe PTM is not supported by PCIe bus/controller\n" );pci_set_drvdata (pdev, adapter); - adapter->hw.back = adapter;return 0 ; }
drivers/net/ethernet/intel/idpf/idpf_mem.h deleted +0 -20
@@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* Copyright (C) 2023 Intel Corporation */ - -#ifndef _IDPF_MEM_H_ -#define _IDPF_MEM_H_ - -#include <linux/io.h> - -struct idpf_dma_mem { -void *va; -dma_addr_t pa; -size_t size; -}; - -#define idpf_mbx_wr32 (a, reg, value) writel((value), ((a)->mbx.vaddr + (reg))) -#define idpf_mbx_rd32 (a, reg) readl((a)->mbx.vaddr + (reg)) -#define idpf_mbx_wr64 (a, reg, value) writeq((value), ((a)->mbx.vaddr + (reg))) -#define idpf_mbx_rd64 (a, reg) readq((a)->mbx.vaddr + (reg)) - -#endif /* _IDPF_MEM_H_ */
drivers/net/ethernet/intel/idpf/idpf_txrx.h +1 -1
@@ -236,7 +236,7 @@ enum idpf_tx_ctx_desc_eipt_offload { (sizeof(u16) * IDPF_RX_MAX_PTYPE_PROTO_IDS))#define IDPF_RX_PTYPE_HDR_SZ sizeof(struct virtchnl2_get_ptype_info)#define IDPF_RX_MAX_PTYPES_PER_BUF \ - DIV_ROUND_DOWN_ULL((IDPF_CTLQ_MAX_BUF_LEN - IDPF_RX_PTYPE_HDR_SZ), \ + DIV_ROUND_DOWN_ULL(LIBIE_CTLQ_MAX_BUF_LEN - IDPF_RX_PTYPE_HDR_SZ, \ IDPF_RX_MAX_PTYPE_SZ)#define IDPF_GET_PTYPE_SIZE (p) struct_size((p), proto_id, (p)->proto_id_count)
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +25 -36
75 lines not on this page · raw message
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +614 -981
1,460 lines not on this page · raw message
drivers/net/ethernet/intel/idpf/idpf_virtchnl.h +27 -86
113 lines not on this page · raw message
drivers/net/ethernet/intel/idpf/idpf_virtchnl_ptp.c +122 -130
252 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.47.1
Part of the diff is not shown here. View the raw message.
Tony Nguyen
maintainerPATCH v8 10/15 idpf: make mbx_task queueing and cancelling more consistent
In reply to Tony NguyenFrom: Larysa Zaremba <[email protected]>
One of the assumptions of libie_cp and pre-refactor idpf control queue handling is such that all Rx processing is handled by a single task, which is to be cancelled before the mailbox destruction. Aside from cancelling, it is also important to make sure that idpf_intr_rel() never reschedules it afterwards.
In order to comply, in the init path, do the first queueing of mbx_task in idpf_init_dflt_mbx(), and in deinit and reset, always cancel the task in idpf_deinit_dflt_mbx(), in every single flow call idpf_mb_intr_rel_irq() beforehand.
--- drivers/net/ethernet/intel/idpf/idpf.h | 1 + drivers/net/ethernet/intel/idpf/idpf_lib.c | 9 ++++----- drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 5 +++++ 3 files changed, 10 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/idpf/idpf.h +1 -0
@@ -984,6 +984,7 @@ void idpf_vc_event_task(struct work_struct *work);void idpf_dev_ops_init (struct idpf_adapter *adapter);void idpf_vf_dev_ops_init (struct idpf_adapter *adapter);int idpf_intr_req (struct idpf_adapter *adapter); +void idpf_mb_intr_rel_irq (struct idpf_adapter *adapter);void idpf_intr_rel (struct idpf_adapter *adapter);u16 idpf_get_max_tx_hdr_size (struct idpf_adapter *adapter); int idpf_initiate_soft_reset(struct idpf_vport *vport,
drivers/net/ethernet/intel/idpf/idpf_lib.c +4 -5
@@ -68,9 +68,11 @@ static void idpf_deinit_vector_stack(struct idpf_adapter *adapter)* This will also disable interrupt mode and queue up mailbox task. Mailbox * task will reschedule itself if not in interrupt mode. */ -static void idpf_mb_intr_rel_irq (struct idpf_adapter *adapter) +void idpf_mb_intr_rel_irq (struct idpf_adapter *adapter) { -clear_bit (IDPF_MB_INTR_MODE , adapter->flags); +if (!test_and_clear_bit (IDPF_MB_INTR_MODE , adapter->flags)) +return ; +kfree (free_irq (adapter->msix_entries[0 ].vector, adapter));queue_delayed_work (adapter->mbx_wq, &adapter->mbx_task,0 ); }
@@ -1939,14 +1941,11 @@ static void idpf_init_hard_reset(struct idpf_adapter *adapter) goto unlock_mutex; } -queue_delayed_work (adapter->mbx_wq, &adapter->mbx_task,0 ); -/* Initialize the state machine, also allocate memory and request * resources */ err =idpf_vc_core_init (adapter);if (err) { -cancel_delayed_work_sync (&adapter->mbx_task);idpf_deinit_dflt_mbx (adapter); goto unlock_mutex; }
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +5 -0
@@ -2931,6 +2931,8 @@ int idpf_init_dflt_mbx(struct idpf_adapter *adapter) adapter->xnm = params.xnm; adapter->state = __IDPF_VER_CHECK; +queue_delayed_work (adapter->mbx_wq, &adapter->mbx_task,0 ); +return 0 ; }
@@ -2940,6 +2942,9 @@ int idpf_init_dflt_mbx(struct idpf_adapter *adapter)*/ void idpf_deinit_dflt_mbx (struct idpf_adapter *adapter) { +idpf_mb_intr_rel_irq (adapter); +cancel_delayed_work_sync (&adapter->mbx_task); +if (adapter->xnm) {libie_ctlq_xn_shutdown (adapter->xnm);idpf_mb_clean (adapter->asq, true);
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH v8 11/15 idpf: print a debug message and bail in case of non-event ctlq message
In reply to Tony NguyenFrom: Larysa Zaremba <[email protected]>
Unlike previous internal idpf ctlq implementation, libie_cp calls the default message handler for all received messages that do not have a matching xn transaction, not only for VIRTCHNL2_OP_EVENT. This leads to many error messages printing garbage, because the parsing expected a valid event message, but got e.g. a delayed response for a timed-out transaction.
The information about timed-out transactions and otherwise unhandleable messages can still be valuable for developers, so print the information with dynamic debug and exit the function, so the following functions can parse valid events in peace.
--- drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +7 -0
@@ -84,6 +84,13 @@ void idpf_recv_event_msg(struct libie_ctlq_ctx *ctx,u32 event; adapter = container_of(ctx, struct idpf_adapter, ctlq_ctx); +if (ctlq_msg->chnl_opcode !=VIRTCHNL2_OP_EVENT ) { +dev_dbg (&adapter->pdev->dev, +"Unhandled message with opcode %u from CP\n" , + ctlq_msg->chnl_opcode); + goto free_rx_buf; + } +if (payload_size <sizeof (*v2e)) { dev_err_ratelimited(&adapter->pdev->dev, "Failed to receive valid payload for event msg (op %d len %d)\n", ctlq_msg->chnl_opcode,
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH v8 12/15 ixd: add basic driver framework for Intel(R) Control Plane Function
In reply to Tony NguyenFrom: Larysa Zaremba <[email protected]>
Add module register and probe functionality. Add the required support to register IXD PCI driver, as well as probe, remove and shutdown callbacks. Enable the PCI device and request to reserve the memory resources that will be used by the driver. Finally map the BAR0 address space.
For now, use devm_kzalloc() to allocate adapter, as it requires the least amount of code. In a later commit, it will be replaced with a devlink alternative.
--- .../device_drivers/ethernet/index.rst | 1 + .../device_drivers/ethernet/intel/ixd.rst | 39 ++++++ drivers/net/ethernet/intel/Kconfig | 2 + drivers/net/ethernet/intel/Makefile | 1 + drivers/net/ethernet/intel/ixd/Kconfig | 12 ++ drivers/net/ethernet/intel/ixd/Makefile | 8 ++ drivers/net/ethernet/intel/ixd/ixd.h | 28 +++++ drivers/net/ethernet/intel/ixd/ixd_lan_regs.h | 28 +++++ drivers/net/ethernet/intel/ixd/ixd_main.c | 112 ++++++++++++++++++ 9 files changed, 231 insertions(+) create mode 100644 Documentation/networking/device_drivers/ethernet/intel/ixd.rst create mode 100644 drivers/net/ethernet/intel/ixd/Kconfig create mode 100644 drivers/net/ethernet/intel/ixd/Makefile create mode 100644 drivers/net/ethernet/intel/ixd/ixd.h create mode 100644 drivers/net/ethernet/intel/ixd/ixd_lan_regs.h create mode 100644 drivers/net/ethernet/intel/ixd/ixd_main.c
Documentation/networking/device_drivers/ethernet/index.rst +1 -0
@@ -35,6 +35,7 @@ Contents: intel/idpf intel/igb intel/igbvf + intel/ixd intel/ixgbe intel/ixgbevf intel/i40e
Documentation/networking/device_drivers/ethernet/intel/ixd.rst new file +39 -0
@@ -0,0 +1,39 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +========================================================================== +iXD Linux* Base Driver for the Intel(R) Control Plane Function +========================================================================== + +Intel iXD Linux driver. +Copyright(C) 2025 Intel Corporation. + +.. contents:: + +For questions related to hardware requirements, refer to the documentation +supplied with your Intel adapter. All hardware requirements listed apply to use +with Linux. + + +Identifying Your Adapter +======================== +For information on how to identify your adapter, and for the latest Intel +network drivers, refer to the Intel Support website: +http://www.intel.com/support + + +Support +======= +For general information, go to the Intel support website at: +http://www.intel.com/support/ + +If an issue is identified with the released source code on a supported kernel +with a supported adapter, email the specific information related to the issue +to [email protected]. + + +Trademarks +========== +Intel is a trademark or registered trademark of Intel Corporation or its +subsidiaries in the United States and/or other countries. + +* Other names and brands may be claimed as the property of others.
drivers/net/ethernet/intel/Kconfig +2 -0
@@ -398,4 +398,6 @@ config IGC_LEDS source "drivers/net/ethernet/intel/idpf/Kconfig" +source "drivers/net/ethernet/intel/ixd/Kconfig" + endif # NET_VENDOR_INTEL
drivers/net/ethernet/intel/Makefile +1 -0
@@ -19,3 +19,4 @@ obj-$(CONFIG_IAVF) += iavf/ obj-$(CONFIG_FM10K) += fm10k/ obj-$(CONFIG_ICE) += ice/ obj-$(CONFIG_IDPF) += idpf/ +obj-$(CONFIG_IXD) += ixd/
drivers/net/ethernet/intel/ixd/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-only +# Copyright (C) 2025 Intel Corporation + +config IXD + tristate "Intel(R) Control Plane Function Support" + depends on PCI_MSI + select LIBIE_PCI + help + This driver supports Intel(R) Control Plane PCI Function + of Intel E2100 and later IPUs and FNICs. + It facilitates a centralized control over multiple IDPF PFs/VFs/SFs + exposed by the same card.
drivers/net/ethernet/intel/ixd/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0-only +# Copyright (C) 2025 Intel Corporation + +# Intel(R) Control Plane Function Linux Driver + +obj-$(CONFIG_IXD) += ixd.o + +ixd-y := ixd_main.o
drivers/net/ethernet/intel/ixd/ixd.h new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* Copyright (C) 2025 Intel Corporation */ + +#ifndef _IXD_H_ +#define _IXD_H_ + +#include <linux/net/intel/libie/pci.h> + +/** +* struct ixd_adapter - Data structure representing a CPF +* @hw: Device access data +*/ +struct ixd_adapter { +struct libie_mmio_info hw; +}; + +/** +* ixd_to_dev - Get the corresponding device struct from an adapter +* @adapter: PCI device driver-specific private data +* +* Return: struct device corresponding to the given adapter +*/ +static inline struct device *ixd_to_dev (struct ixd_adapter *adapter) +{ +return &adapter->hw.pdev->dev; +} + +#endif /* _IXD_H_ */
drivers/net/ethernet/intel/ixd/ixd_lan_regs.h new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* Copyright (C) 2025 Intel Corporation */ + +#ifndef _IXD_LAN_REGS_H_ +#define _IXD_LAN_REGS_H_ + +/* Control Plane Function PCI ID */ +#define IXD_DEV_ID_CPF 0x1efe + +/* Control Queue (Mailbox) */ +#define PF_FW_MBX_REG_LEN 4096 +#define PF_FW_MBX 0x08400000 + +/* Reset registers */ +#define PFGEN_RTRIG_REG_LEN 2048 +#define PFGEN_RTRIG 0x08407000/* Device resets */ + +/** +* struct ixd_bar_region - BAR region description +* @offset: BAR region offset +* @size: BAR region size +*/ +struct ixd_bar_region { +resource_size_t offset; +resource_size_t size; +}; + +#endif /* _IXD_LAN_REGS_H_ */
drivers/net/ethernet/intel/ixd/ixd_main.c new file +112 -0
112 lines not on this page · raw message
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH v8 13/15 ixd: add reset checks and initialize the mailbox
In reply to Tony NguyenFrom: Larysa Zaremba <[email protected]>
At the end of the probe, trigger hard reset, initialize and schedule the after-reset task. If the reset is complete in a pre-determined time, initialize the default mailbox, through which other resources will be negotiated.
--- drivers/net/ethernet/intel/ixd/Kconfig | 1 + drivers/net/ethernet/intel/ixd/Makefile | 2 + drivers/net/ethernet/intel/ixd/ixd.h | 32 ++++- drivers/net/ethernet/intel/ixd/ixd_dev.c | 89 ++++++++++++ drivers/net/ethernet/intel/ixd/ixd_lan_regs.h | 40 ++++++ drivers/net/ethernet/intel/ixd/ixd_lib.c | 136 ++++++++++++++++++ drivers/net/ethernet/intel/ixd/ixd_main.c | 31 +++- 7 files changed, 322 insertions(+), 9 deletions(-) create mode 100644 drivers/net/ethernet/intel/ixd/ixd_dev.c create mode 100644 drivers/net/ethernet/intel/ixd/ixd_lib.c
drivers/net/ethernet/intel/ixd/Kconfig +1 -0
@@ -4,6 +4,7 @@ config IXD tristate "Intel(R) Control Plane Function Support" depends on PCI_MSI + select LIBIE_CP select LIBIE_PCI help This driver supports Intel(R) Control Plane PCI Function
drivers/net/ethernet/intel/ixd/Makefile +2 -0
@@ -6,3 +6,5 @@ obj-$(CONFIG_IXD) += ixd.o ixd-y := ixd_main.o +ixd-y += ixd_dev.o +ixd-y += ixd_lib.o
drivers/net/ethernet/intel/ixd/ixd.h +28 -4
@@ -4,14 +4,29 @@#ifndef _IXD_H_#define _IXD_H_ -#include <linux/net/intel/libie/pci.h> +#include <linux/net/intel/libie/controlq.h> + +#define IXD_INIT_TASK_DELAY_JIFFIES msecs_to_jiffies(500)/** * struct ixd_adapter - Data structure representing a CPF -* @hw: Device access data +* @cp_ctx: Control plane communication context +* @init_task: Delayed initialization after reset +* @init_task.init_work: Delayed initialization work +* @init_task.reset_retries: How many times to check, whether reset is completed +* @xnm: virtchnl transaction manager +* @asq: Send control queue info +* @arq: Receive control queue info */ struct ixd_adapter { -struct libie_mmio_info hw; +struct libie_ctlq_ctx cp_ctx; +struct { +struct delayed_work init_work; +u8 reset_retries; + } init_task; +struct libie_ctlq_xn_manager *xnm; +struct libie_ctlq_info *asq; +struct libie_ctlq_info *arq; };/**
@@ -22,7 +37,16 @@ struct ixd_adapter {*/ static inline struct device *ixd_to_dev (struct ixd_adapter *adapter) { -return &adapter->hw.pdev->dev; +return &adapter->cp_ctx.mmio_info.pdev->dev; } +void ixd_ctlq_reg_init (struct ixd_adapter *adapter, +struct libie_ctlq_reg *ctlq_reg_tx, +struct libie_ctlq_reg *ctlq_reg_rx); +void ixd_trigger_reset (struct ixd_adapter *adapter); +bool ixd_check_reset_complete (struct ixd_adapter *adapter); +void ixd_init_task (struct work_struct *work); +int ixd_init_dflt_mbx (struct ixd_adapter *adapter); +void ixd_deinit_dflt_mbx (struct ixd_adapter *adapter); +#endif /* _IXD_H_ */
drivers/net/ethernet/intel/ixd/ixd_dev.c new file +89 -0
89 lines not on this page · raw message
drivers/net/ethernet/intel/ixd/ixd_lan_regs.h +40 -0
@@ -11,9 +11,33 @@#define PF_FW_MBX_REG_LEN 4096#define PF_FW_MBX 0x08400000 +#define PF_FW_ARQBAL (PF_FW_MBX) +#define PF_FW_ARQBAH (PF_FW_MBX + 0x4) +#define PF_FW_ARQLEN (PF_FW_MBX + 0x8) +#define PF_FW_ARQLEN_ARQLEN_M GENMASK(12, 0) +#define PF_FW_ARQLEN_ARQENABLE_S 31 +#define PF_FW_ARQLEN_ARQENABLE_M BIT(PF_FW_ARQLEN_ARQENABLE_S) +#define PF_FW_ARQH_ARQH_M GENMASK(12, 0) +#define PF_FW_ARQH (PF_FW_MBX + 0xC) +#define PF_FW_ARQT (PF_FW_MBX + 0x10) + +#define PF_FW_ATQBAL (PF_FW_MBX + 0x14) +#define PF_FW_ATQBAH (PF_FW_MBX + 0x18) +#define PF_FW_ATQLEN (PF_FW_MBX + 0x1C) +#define PF_FW_ATQLEN_ATQLEN_M GENMASK(9, 0) +#define PF_FW_ATQLEN_ATQENABLE_S 31 +#define PF_FW_ATQLEN_ATQENABLE_M BIT(PF_FW_ATQLEN_ATQENABLE_S) +#define PF_FW_ATQH_ATQH_M GENMASK(9, 0) +#define PF_FW_ATQH (PF_FW_MBX + 0x20) +#define PF_FW_ATQT (PF_FW_MBX + 0x24) +/* Reset registers */ #define PFGEN_RTRIG_REG_LEN 2048#define PFGEN_RTRIG 0x08407000/* Device resets */ +#define PFGEN_RSTAT 0x08407008/* PFR status */ +#define PFGEN_RSTAT_PFR_STATE_M GENMASK(1, 0) +#define PFGEN_CTRL 0x0840700C/* PFR trigger */ +#define PFGEN_CTRL_PFSWR BIT(0)/** * struct ixd_bar_region - BAR region description
@@ -25,4 +49,20 @@ struct ixd_bar_region { resource_size_t size; }; +/** +* struct ixd_reset_reg - structure for reset registers +* @rstat: offset of status in register +* @rstat_m: status mask +* @rstat_ok_v: value that indicates PFR completed status +* @rtrigger: offset of reset trigger in register +* @rtrigger_m: reset trigger mask +*/ +struct ixd_reset_reg { +u32 rstat; +u32 rstat_m; +u32 rstat_ok_v; +u32 rtrigger; +u32 rtrigger_m; +}; +#endif /* _IXD_LAN_REGS_H_ */
drivers/net/ethernet/intel/ixd/ixd_lib.c new file +136 -0
136 lines not on this page · raw message
drivers/net/ethernet/intel/ixd/ixd_main.c +26 -5
@@ -5,6 +5,7 @@#include "ixd_lan_regs.h" MODULE_DESCRIPTION ("Intel(R) Control Plane Function Device Driver" ); +MODULE_IMPORT_NS ("LIBIE_CP" );MODULE_IMPORT_NS ("LIBIE_PCI" );MODULE_LICENSE ("GPL" );
@@ -16,7 +17,15 @@ static void ixd_remove(struct pci_dev *pdev) {struct ixd_adapter *adapter =pci_get_drvdata (pdev); -libie_pci_unmap_all_mmio_regions (&adapter->hw); +/* Do not mix removal with (re)initialization */ +cancel_delayed_work_sync (&adapter->init_task.init_work); +/* Leave the device clean on exit */ +if (adapter->xnm) +libie_ctlq_xn_shutdown (adapter->xnm); +ixd_trigger_reset (adapter); +ixd_deinit_dflt_mbx (adapter); + +libie_pci_unmap_all_mmio_regions (&adapter->cp_ctx.mmio_info); }/**
@@ -51,7 +60,7 @@ static int ixd_iomap_regions(struct ixd_adapter *adapter) };for (int i =0 ; i <ARRAY_SIZE (regions); i++) { -struct libie_mmio_info *mmio_info = &adapter->hw; +struct libie_mmio_info *mmio_info = &adapter->cp_ctx.mmio_info;bool map_ok; map_ok = libie_pci_map_mmio_region(mmio_info,
@@ -84,8 +93,9 @@ static int ixd_probe(struct pci_dev *pdev, const struct pci_device_id *ent) adapter =devm_kzalloc (&pdev->dev,sizeof (*adapter),GFP_KERNEL );if (!adapter)return -ENOMEM ; - adapter->hw.pdev = pdev; -INIT_LIST_HEAD (&adapter->hw.mmio_list); + + adapter->cp_ctx.mmio_info.pdev = pdev; +INIT_LIST_HEAD (&adapter->cp_ctx.mmio_info.mmio_list); err =libie_pci_init_dev (pdev);if (err)
@@ -93,7 +103,18 @@ static int ixd_probe(struct pci_dev *pdev, const struct pci_device_id *ent)pci_set_drvdata (pdev, adapter); -return ixd_iomap_regions (adapter); + err =ixd_iomap_regions (adapter); +if (err) +return err; + +INIT_DELAYED_WORK (&adapter->init_task.init_work, + ixd_init_task); + +ixd_trigger_reset (adapter); +queue_delayed_work (system_dfl_wq, &adapter->init_task.init_work, +IXD_INIT_TASK_DELAY_JIFFIES ); + +return 0 ; }static const struct pci_device_id ixd_pci_tbl[] = {
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH v8 14/15 ixd: add the core initialization
In reply to Tony NguyenFrom: Larysa Zaremba <[email protected]>
As the mailbox is setup, initialize the core. This makes use of the send and receive mailbox message framework for virtchnl communication between the driver and device Control Plane (CP).
To start with, driver confirms the virtchnl version with the CP. Once that is done, it requests and gets the required capabilities and resources needed such as max vectors, queues, vports etc.
Use a unified way of handling the virtchnl messages, where a single function handles all related memory management and the caller only provides the callbacks to fill the send buffer and to handle the response.
Place generic control queue message handling separately to facilitate the addition of protocols other than virtchannel in the future.
--- drivers/net/ethernet/intel/ixd/Makefile | 2 + drivers/net/ethernet/intel/ixd/ixd.h | 13 ++ drivers/net/ethernet/intel/ixd/ixd_ctlq.c | 141 +++++++++++++ drivers/net/ethernet/intel/ixd/ixd_ctlq.h | 34 ++++ drivers/net/ethernet/intel/ixd/ixd_lib.c | 36 +++- drivers/net/ethernet/intel/ixd/ixd_main.c | 3 + drivers/net/ethernet/intel/ixd/ixd_virtchnl.c | 190 ++++++++++++++++++ drivers/net/ethernet/intel/ixd/ixd_virtchnl.h | 12 ++ 8 files changed, 430 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/intel/ixd/ixd_ctlq.c create mode 100644 drivers/net/ethernet/intel/ixd/ixd_ctlq.h create mode 100644 drivers/net/ethernet/intel/ixd/ixd_virtchnl.c create mode 100644 drivers/net/ethernet/intel/ixd/ixd_virtchnl.h
drivers/net/ethernet/intel/ixd/Makefile +2 -0
@@ -6,5 +6,7 @@ obj-$(CONFIG_IXD) += ixd.o ixd-y := ixd_main.o +ixd-y += ixd_ctlq.o ixd-y += ixd_dev.o ixd-y += ixd_lib.o +ixd-y += ixd_virtchnl.o
drivers/net/ethernet/intel/ixd/ixd.h +13 -0
@@ -14,19 +14,32 @@* @init_task: Delayed initialization after reset * @init_task.init_work: Delayed initialization work * @init_task.reset_retries: How many times to check, whether reset is completed +* @init_task.vc_retries: Number of retries to establish mailbox communication +* @mbx_task: Control queue Rx handling * @xnm: virtchnl transaction manager * @asq: Send control queue info * @arq: Receive control queue info +* @vc_ver: Negotiated virtchnl version +* @vc_ver.major: Negotiated major virtchnl version +* @vc_ver.minor: Negotiated minor virtchnl version +* @caps: Negotiated virtchnl capabilities */ struct ixd_adapter {struct libie_ctlq_ctx cp_ctx;struct {struct delayed_work init_work;u8 reset_retries; +u8 vc_retries; } init_task; +struct delayed_work mbx_task;struct libie_ctlq_xn_manager *xnm;struct libie_ctlq_info *asq;struct libie_ctlq_info *arq; +struct { +u32 major; +u32 minor; + } vc_ver; +struct virtchnl2_get_capabilities caps; };/**
drivers/net/ethernet/intel/ixd/ixd_ctlq.c new file +141 -0
141 lines not on this page · raw message
drivers/net/ethernet/intel/ixd/ixd_ctlq.h new file +34 -0
@@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* Copyright (C) 2025 Intel Corporation */ + +#ifndef _IXD_CTLQ_H_ +#define _IXD_CTLQ_H_ + +#include <linux/net/intel/virtchnl2.h> + +#define IXD_CTLQ_TIMEOUT 2000 + +/** +* struct ixd_ctlq_req - Standard virtchnl request description +* @opcode: protocol opcode, only virtchnl2 is needed for now +* @send_size: required length of the send buffer +* @send_buff_init: function to initialize the allocated send buffer +* @recv_process: function to handle the CP response +* @ctx: additional context for callbacks +*/ +struct ixd_ctlq_req { +enum virtchnl2_op opcode; +size_t send_size; +void (*send_buff_init)(struct ixd_adapter *adapter,void *send_buff, +void *ctx); +int (*recv_process)(struct ixd_adapter *adapter,void *recv_buff, +size_t recv_size,void *ctx); +void *ctx; +}; + +void ixd_ctlq_clean_sq (struct ixd_adapter *adapter,bool force); +int ixd_ctlq_do_req (struct ixd_adapter *adapter, +const struct ixd_ctlq_req *req); +void ixd_ctlq_rx_task (struct work_struct *work); + +#endif /* _IXD_CTLQ_H_ */
drivers/net/ethernet/intel/ixd/ixd_lib.c +35 -1
@@ -2,6 +2,8 @@/* Copyright (C) 2025 Intel Corporation */ #include "ixd.h" +#include "ixd_ctlq.h" +#include "ixd_virtchnl.h" #define IXD_DFLT_MBX_Q_LEN 64
@@ -60,6 +62,14 @@ static void ixd_adapter_fill_dflt_ctlqs(struct ixd_adapter *adapter)*/ void ixd_deinit_dflt_mbx (struct ixd_adapter *adapter) { +cancel_delayed_work_sync (&adapter->mbx_task); + +if (adapter->xnm) +libie_ctlq_xn_shutdown (adapter->xnm); + +if (adapter->asq) +ixd_ctlq_clean_sq (adapter, true); +if (adapter->xnm)libie_ctlq_xn_deinit (adapter->xnm, &adapter->cp_ctx);
@@ -101,6 +111,8 @@ int ixd_init_dflt_mbx(struct ixd_adapter *adapter)return -ENOENT ; } +queue_delayed_work (system_dfl_wq, &adapter->mbx_task,0 ); +return 0 ; }
@@ -129,8 +141,30 @@ void ixd_init_task(struct work_struct *work) adapter->init_task.reset_retries =0 ; err =ixd_init_dflt_mbx (adapter); -if (err) +if (err) {dev_err (ixd_to_dev (adapter),"Failed to initialize the default mailbox: %pe\n" ,ERR_PTR (err)); +return ; + } + + err =ixd_vc_dev_init (adapter); +if (!err) { + adapter->init_task.vc_retries =0 ; +return ; + } + +libie_ctlq_xn_shutdown (adapter->xnm); +ixd_trigger_reset (adapter); +ixd_deinit_dflt_mbx (adapter); +if (++adapter->init_task.vc_retries >5 || + (err != -ETIMEDOUT && err != -EAGAIN && err != -EBUSY )) { +dev_err (ixd_to_dev (adapter), +"Failed to establish mailbox communication with the hardware: %pe\n" , +ERR_PTR (err)); +return ; + } + +queue_delayed_work (system_dfl_wq, &adapter->init_task.init_work, +IXD_INIT_TASK_DELAY_JIFFIES ); }
drivers/net/ethernet/intel/ixd/ixd_main.c +3 -0
@@ -2,6 +2,7 @@/* Copyright (C) 2025 Intel Corporation */ #include "ixd.h" +#include "ixd_ctlq.h" #include "ixd_lan_regs.h" MODULE_DESCRIPTION ("Intel(R) Control Plane Function Device Driver" );
@@ -19,6 +20,7 @@ static void ixd_remove(struct pci_dev *pdev)/* Do not mix removal with (re)initialization */ cancel_delayed_work_sync (&adapter->init_task.init_work); +/* Leave the device clean on exit */ if (adapter->xnm)libie_ctlq_xn_shutdown (adapter->xnm);
@@ -109,6 +111,7 @@ static int ixd_probe(struct pci_dev *pdev, const struct pci_device_id *ent)INIT_DELAYED_WORK (&adapter->init_task.init_work, ixd_init_task); +INIT_DELAYED_WORK (&adapter->mbx_task, ixd_ctlq_rx_task);ixd_trigger_reset (adapter); queue_delayed_work(system_dfl_wq, &adapter->init_task.init_work,
drivers/net/ethernet/intel/ixd/ixd_virtchnl.c new file +190 -0
190 lines not on this page · raw message
drivers/net/ethernet/intel/ixd/ixd_virtchnl.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* Copyright (C) 2025 Intel Corporation */ + +#ifndef _IXD_VIRTCHNL_H_ +#define _IXD_VIRTCHNL_H_ + +int ixd_vc_dev_init (struct ixd_adapter *adapter); +bool ixd_vc_can_handle_msg (struct libie_ctlq_msg *ctlq_msg); +void ixd_vc_recv_event_msg (struct ixd_adapter *adapter, +struct libie_ctlq_msg *ctlq_msg); + +#endif /* _IXD_VIRTCHNL_H_ */
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH v8 15/15 ixd: add devlink support
In reply to Tony NguyenFrom: Amritha Nambiar <[email protected]>
Enable initial support for the devlink interface with the ixd driver. The ixd hardware is a single function PCIe device. So, the PCIe adapter gets its own devlink instance to manage device-wide resources or configuration.
$ devlink dev show pci/0000:83:00.6
$ devlink dev info pci/0000:83:00.6
pci/0000:83:00.6:
driver ixd
serial_number 00-a0-c9-ff-ff-23-45-67
versions:
fixed:
device.type MEV
running:
fw.mgmt.api 2.0--- Documentation/networking/devlink/index.rst | 1 + Documentation/networking/devlink/ixd.rst | 30 ++++++ drivers/net/ethernet/intel/ixd/Kconfig | 1 + drivers/net/ethernet/intel/ixd/Makefile | 1 + drivers/net/ethernet/intel/ixd/ixd.h | 2 + drivers/net/ethernet/intel/ixd/ixd_devlink.c | 99 ++++++++++++++++++++ drivers/net/ethernet/intel/ixd/ixd_devlink.h | 50 ++++++++++ drivers/net/ethernet/intel/ixd/ixd_lib.c | 3 + drivers/net/ethernet/intel/ixd/ixd_main.c | 14 ++- 9 files changed, 198 insertions(+), 3 deletions(-) create mode 100644 Documentation/networking/devlink/ixd.rst create mode 100644 drivers/net/ethernet/intel/ixd/ixd_devlink.c create mode 100644 drivers/net/ethernet/intel/ixd/ixd_devlink.h
Documentation/networking/devlink/index.rst +1 -0
@@ -87,6 +87,7 @@ parameters, info versions, and other features it supports. ice ionic iosm + ixd ixgbe kvaser_pciefd kvaser_usb
Documentation/networking/devlink/ixd.rst new file +30 -0
@@ -0,0 +1,30 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=================== +ixd devlink support +=================== + +This document describes the devlink features implemented by the ``ixd`` +device driver. + +Info versions +============= + +The ``ixd`` driver reports the following versions + +.. list-table:: devlink info versions implemented + :widths: 5 5 5 90 + + * - Name + - Type + - Example + - Description + * - ``device.type`` + - fixed + - MEV + - The hardware type for this device + * - ``fw.mgmt.api`` + - running + - 2.0 + - 2-digit version number (major.minor) of the communication channel + (virtchnl) used by the device.
drivers/net/ethernet/intel/ixd/Kconfig +1 -0
@@ -6,6 +6,7 @@ config IXD depends on PCI_MSI select LIBIE_CP select LIBIE_PCI + select NET_DEVLINK help This driver supports Intel(R) Control Plane PCI Function of Intel E2100 and later IPUs and FNICs.
drivers/net/ethernet/intel/ixd/Makefile +1 -0
@@ -8,5 +8,6 @@ obj-$(CONFIG_IXD) += ixd.o ixd-y := ixd_main.o ixd-y += ixd_ctlq.o ixd-y += ixd_dev.o +ixd-y += ixd_devlink.o ixd-y += ixd_lib.o ixd-y += ixd_virtchnl.o
drivers/net/ethernet/intel/ixd/ixd.h +2 -0
@@ -15,6 +15,7 @@* @init_task.init_work: Delayed initialization work * @init_task.reset_retries: How many times to check, whether reset is completed * @init_task.vc_retries: Number of retries to establish mailbox communication +* @init_task.success: init_work completion status * @mbx_task: Control queue Rx handling * @xnm: virtchnl transaction manager * @asq: Send control queue info
@@ -30,6 +31,7 @@ struct ixd_adapter {struct delayed_work init_work;u8 reset_retries;u8 vc_retries; +bool success; } init_task;struct delayed_work mbx_task;struct libie_ctlq_xn_manager *xnm;
drivers/net/ethernet/intel/ixd/ixd_devlink.c new file +99 -0
99 lines not on this page · raw message
drivers/net/ethernet/intel/ixd/ixd_devlink.h new file +50 -0
50 lines not on this page · raw message
drivers/net/ethernet/intel/ixd/ixd_lib.c +3 -0
@@ -3,6 +3,7 @@#include "ixd.h" #include "ixd_ctlq.h" +#include "ixd_devlink.h" #include "ixd_virtchnl.h" #define IXD_DFLT_MBX_Q_LEN 64
@@ -151,6 +152,8 @@ void ixd_init_task(struct work_struct *work) err =ixd_vc_dev_init (adapter);if (!err) { adapter->init_task.vc_retries =0 ; + adapter->init_task.success = true; +ixd_devlink_register (adapter);return ; }
drivers/net/ethernet/intel/ixd/ixd_main.c +11 -3
@@ -4,6 +4,7 @@#include "ixd.h" #include "ixd_ctlq.h" #include "ixd_lan_regs.h" +#include "ixd_devlink.h" MODULE_DESCRIPTION ("Intel(R) Control Plane Function Device Driver" );MODULE_IMPORT_NS ("LIBIE_CP" );
@@ -21,6 +22,8 @@ static void ixd_remove(struct pci_dev *pdev)/* Do not mix removal with (re)initialization */ cancel_delayed_work_sync (&adapter->init_task.init_work); +ixd_devlink_unregister (adapter); +/* Leave the device clean on exit */ if (adapter->xnm)libie_ctlq_xn_shutdown (adapter->xnm);
@@ -28,6 +31,7 @@ static void ixd_remove(struct pci_dev *pdev)ixd_deinit_dflt_mbx (adapter);libie_pci_unmap_all_mmio_regions (&adapter->cp_ctx.mmio_info); +ixd_devlink_free (adapter); }/**
@@ -92,7 +96,7 @@ static int ixd_probe(struct pci_dev *pdev, const struct pci_device_id *ent)struct ixd_adapter *adapter;int err; - adapter =devm_kzalloc (&pdev->dev,sizeof (*adapter),GFP_KERNEL ); + adapter =ixd_adapter_alloc (&pdev->dev);if (!adapter)return -ENOMEM ;
@@ -101,13 +105,13 @@ static int ixd_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err =libie_pci_init_dev (pdev);if (err) -return err; + goto free_adapter;pci_set_drvdata (pdev, adapter); err =ixd_iomap_regions (adapter);if (err) -return err; + goto free_adapter;INIT_DELAYED_WORK (&adapter->init_task.init_work, ixd_init_task);
@@ -118,6 +122,10 @@ static int ixd_probe(struct pci_dev *pdev, const struct pci_device_id *ent) IXD_INIT_TASK_DELAY_JIFFIES);return 0 ; + +free_adapter: +ixd_devlink_free (adapter); +return err; }static const struct pci_device_id ixd_pci_tbl[] = {
Signature · 1 line
2.47.1
This series was applied to netdev/net-next.git (main) by Tony Nguyen <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Tony Nguyen <[email protected]>:
Quoted 10 lines · On Wed, 12 Aug 2026 14:25:14 -0700 you wrote:
Larysa Zaremba says:
This patch series adds the iXD driver, which supports the Intel(R) Control Plane PCI Function on Intel E2100 and later IPUs and FNICs. It facilitates a centralized control over multiple IDPF PFs/VFs/SFs exposed by the same card. The reason for the separation is to be able to offload the control plane to the host different from where the data plane is running.
[...]
Here is the summary with links:
- [net-next,v8,01/15] virtchnl: move virtchnl and virtchnl2 headers to 'include/linux/net/intel'
https://git.kernel.org/netdev/net-next/c/e44908175d50 - [net-next,v8,02/15] libie: add PCI device initialization helpers to libie https://git.kernel.org/netdev/net-next/c/dbe9759c215a - [net-next,v8,03/15] libeth: allow to create fill queues without NAPI https://git.kernel.org/netdev/net-next/c/354c28830add - [net-next,v8,04/15] libie: add control queue support https://git.kernel.org/netdev/net-next/c/caed480f2991 - [net-next,v8,05/15] libie: add bookkeeping support for control queue messages https://git.kernel.org/netdev/net-next/c/b4ff4e626a7c - [net-next,v8,06/15] idpf: remove 'vport_params_reqd' field https://git.kernel.org/netdev/net-next/c/fb2bebcffbbd - [net-next,v8,07/15] idpf: remove unused code for getting RSS info from device https://git.kernel.org/netdev/net-next/c/8760a06e4553 - [net-next,v8,08/15] idpf: refactor idpf to use libie_pci APIs https://git.kernel.org/netdev/net-next/c/6b284aa2ddf3 - [net-next,v8,09/15] idpf: refactor idpf to use libie control queues https://git.kernel.org/netdev/net-next/c/deaada4f1807 - [net-next,v8,10/15] idpf: make mbx_task queueing and cancelling more consistent https://git.kernel.org/netdev/net-next/c/047cdea66752 - [net-next,v8,11/15] idpf: print a debug message and bail in case of non-event ctlq message https://git.kernel.org/netdev/net-next/c/1150ca4085af - [net-next,v8,12/15] ixd: add basic driver framework for Intel(R) Control Plane Function https://git.kernel.org/netdev/net-next/c/bea44e3892a0 - [net-next,v8,13/15] ixd: add reset checks and initialize the mailbox https://git.kernel.org/netdev/net-next/c/31ddf7965a92 - [net-next,v8,14/15] ixd: add the core initialization https://git.kernel.org/netdev/net-next/c/29735d99c383 - [net-next,v8,15/15] ixd: add devlink support https://git.kernel.org/netdev/net-next/c/f290d48f0299
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html