From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nelio Laranjeiro Subject: [PATCH 1/5] net/mlx5: add VF information in configuration Date: Tue, 13 Mar 2018 13:50:35 +0100 Message-ID: <753252b906fbabad7095a1b2e18e035a59f51594.1520944256.git.nelio.laranjeiro@6wind.com> References: Cc: dev@dpdk.org To: Adrien Mazarguil , Yongseok Koh Return-path: Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by dpdk.org (Postfix) with ESMTP id C21902A66 for ; Tue, 13 Mar 2018 13:51:58 +0100 (CET) Received: by mail-wr0-f194.google.com with SMTP id v65so22324121wrc.11 for ; Tue, 13 Mar 2018 05:51:58 -0700 (PDT) In-Reply-To: In-Reply-To: References: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: Nelio Laranjeiro --- drivers/net/mlx5/mlx5.c | 10 ++++++++++ drivers/net/mlx5/mlx5.h | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 95dd49420..d5cc85d19 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -597,6 +597,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, int err = 0; struct ibv_context *attr_ctx = NULL; struct ibv_device_attr_ex device_attr; + unsigned int vf; unsigned int mps; unsigned int cqe_comp; unsigned int tunnel_en = 0; @@ -646,6 +647,14 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, continue; DRV_LOG(INFO, "PCI information matches, using device \"%s\"", list[i]->name); + vf = ((pci_dev->id.device_id == + PCI_DEVICE_ID_MELLANOX_CONNECTX4VF) || + (pci_dev->id.device_id == + PCI_DEVICE_ID_MELLANOX_CONNECTX4LXVF) || + (pci_dev->id.device_id == + PCI_DEVICE_ID_MELLANOX_CONNECTX5VF) || + (pci_dev->id.device_id == + PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF)); attr_ctx = mlx5_glue->open_device(list[i]); rte_errno = errno; err = rte_errno; @@ -871,6 +880,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, DRV_LOG(DEBUG, "hardware Rx end alignment padding is %ssupported", (config.hw_padding ? "" : "not ")); + config.vf = vf; config.tso = ((device_attr_ex.tso_caps.max_tso > 0) && (device_attr_ex.tso_caps.supported_qpts & (1 << IBV_QPT_RAW_PACKET))); diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index faacfd9d6..9191b2949 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -78,6 +78,7 @@ struct mlx5_dev_config { unsigned int hw_vlan_strip:1; /* VLAN stripping is supported. */ unsigned int hw_fcs_strip:1; /* FCS stripping is supported. */ unsigned int hw_padding:1; /* End alignment padding is supported. */ + unsigned int vf:1; /* This is a VF. */ unsigned int mps:2; /* Multi-packet send supported mode. */ unsigned int tunnel_en:1; /* Whether tunnel stateless offloads are supported. */ -- 2.11.0