@@ -1737,8 +1737,13 @@ static int probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
dev->device = &pdev->dev;
dev->pdev = pdev;
+ /** TODO: don't maintain both coredev_type and has_mpf fields, just copy
+ * the value from id->driver_data into a new instance dev->driver_data
+ * and use it as is in the helper functions.
+ */
dev->coredev_type = id->driver_data & MLX5_PCI_DEV_IS_VF ?
MLX5_COREDEV_VF : MLX5_COREDEV_PF;
+ dev->priv.has_mpf = id->driver_data & MLX5_DD_HAS_MPF;
dev->priv.adev_idx = mlx5_adev_idx_alloc();
if (dev->priv.adev_idx < 0) {
@@ -2026,9 +2031,12 @@ static const struct pci_device_id mlx5_core_pci_table[] = {
{ PCI_VDEVICE(MELLANOX, 0x1023) }, /* ConnectX-8 */
{ PCI_VDEVICE(MELLANOX, 0xa2d2) }, /* BlueField integrated ConnectX-5 network controller */
{ PCI_VDEVICE(MELLANOX, 0xa2d3), MLX5_PCI_DEV_IS_VF}, /* BlueField integrated ConnectX-5 network controller VF */
- { PCI_VDEVICE(MELLANOX, 0xa2d6) }, /* BlueField-2 integrated ConnectX-6 Dx network controller */
- { PCI_VDEVICE(MELLANOX, 0xa2dc) }, /* BlueField-3 integrated ConnectX-7 network controller */
- { PCI_VDEVICE(MELLANOX, 0xa2df) }, /* BlueField-4 integrated ConnectX-8 network controller */
+ /* BlueField-2 integrated ConnectX-6 Dx network controller */
+ { PCI_VDEVICE(MELLANOX, 0xa2d6), MLX5_DD_HAS_MPF},
+ /* BlueField-3 integrated ConnectX-7 network controller */
+ { PCI_VDEVICE(MELLANOX, 0xa2dc), MLX5_DD_HAS_MPF},
+ /* BlueField-4 integrated ConnectX-8 network controller */
+ { PCI_VDEVICE(MELLANOX, 0xa2df), MLX5_DD_HAS_MPF},
{ 0, }
};
@@ -633,6 +633,7 @@ struct mlx5_priv {
struct mlx5_bfreg_data bfregs;
struct mlx5_uars_page *uar;
+ bool has_mpf; /* TODO: Merge with mdev->coredev_type */
#ifdef CONFIG_MLX5_SF
struct mlx5_vhca_state_notifier *vhca_state_notifier;
struct mlx5_sf_dev_table *sf_dev_table;
@@ -1197,8 +1198,9 @@ int mlx5_rdma_rn_get_params(struct mlx5_core_dev *mdev,
struct ib_device *device,
struct rdma_netdev_alloc_params *params);
-enum {
+enum { /* Per Device data */
MLX5_PCI_DEV_IS_VF = 1 << 0,
+ MLX5_DD_HAS_MPF = 1 << 1, /* Device has a management PF */
};
static inline bool mlx5_core_is_pf(const struct mlx5_core_dev *dev)
@@ -1213,6 +1215,9 @@ static inline bool mlx5_core_is_vf(const struct mlx5_core_dev *dev)
static inline bool mlx5_core_is_management_pf(const struct mlx5_core_dev *dev)
{
+ if (!dev->priv.has_mpf) /* This device can support management PF ? */
+ return false;
+ /* is this an MPF function ? */
return MLX5_CAP_GEN(dev, num_ports) == 1 && !MLX5_CAP_GEN(dev, native_port_num);
}