summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.h
diff options
context:
space:
mode:
authorAlex Vesker2018-06-28 14:05:58 +0200
committerSaeed Mahameed2019-06-13 22:23:17 +0200
commitb25bbc2f24dcab9cd186ef4003c39bf51ad0454c (patch)
tree52c2fce61d25929e74c966605147f88a8e23d3e1 /drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.h
parentnet/mlx5: Move all devlink related functions calls to devlink.c (diff)
downloadkernel-qcow2-linux-b25bbc2f24dcab9cd186ef4003c39bf51ad0454c.tar.gz
kernel-qcow2-linux-b25bbc2f24dcab9cd186ef4003c39bf51ad0454c.tar.xz
kernel-qcow2-linux-b25bbc2f24dcab9cd186ef4003c39bf51ad0454c.zip
net/mlx5: Add Vendor Specific Capability access gateway
The Vendor Specific Capability (VSC) is used to activate a gateway interfacing with the device. The gateway is used to read or write device configurations, which are organized in different domains (spaces). A configuration access may result in multiple actions, reads, writes. Example usages are accessing the Crspace domain to read the crspace or locking a device semaphore using the Semaphore domain. The configuration access use pci_cfg_access to prevent parallel access to the VSC space by the driver and userspace calls. Signed-off-by: Alex Vesker <valex@mellanox.com> Signed-off-by: Feras Daoud <ferasda@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.h')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.h b/drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.h
new file mode 100644
index 000000000000..28ea6bfa439f
--- /dev/null
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.h
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
+/* Copyright (c) 2019 Mellanox Technologies */
+
+#ifndef __MLX5_PCI_VSC_H__
+#define __MLX5_PCI_VSC_H__
+
+enum {
+ MLX5_VSC_SPACE_SCAN_CRSPACE = 0x7,
+};
+
+void mlx5_pci_vsc_init(struct mlx5_core_dev *dev);
+int mlx5_vsc_gw_lock(struct mlx5_core_dev *dev);
+int mlx5_vsc_gw_unlock(struct mlx5_core_dev *dev);
+int mlx5_vsc_gw_set_space(struct mlx5_core_dev *dev, u16 space,
+ u32 *ret_space_size);
+int mlx5_vsc_gw_read_block_fast(struct mlx5_core_dev *dev, u32 *data,
+ int length);
+
+static inline bool mlx5_vsc_accessible(struct mlx5_core_dev *dev)
+{
+ return !!dev->vsc_addr;
+}
+
+#endif /* __MLX5_PCI_VSC_H__ */