From patchwork Thu Feb 28 18:02:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 50667 X-Patchwork-Delegate: shahafs@mellanox.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C9A793421; Thu, 28 Feb 2019 19:03:20 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 3A0213421 for ; Thu, 28 Feb 2019 19:03:19 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from viacheslavo@mellanox.com) with ESMTPS (AES256-SHA encrypted); 28 Feb 2019 20:03:18 +0200 Received: from pegasus12.mtr.labs.mlnx. (pegasus12.mtr.labs.mlnx [10.210.17.40]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x1SI3Gn3000409; Thu, 28 Feb 2019 20:03:18 +0200 From: Viacheslav Ovsiienko To: dev@dpdk.org Cc: shahafs@mellanox.com Date: Thu, 28 Feb 2019 18:02:56 +0000 Message-Id: <1551376985-11096-2-git-send-email-viacheslavo@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551376985-11096-1-git-send-email-viacheslavo@mellanox.com> References: <1551376985-11096-1-git-send-email-viacheslavo@mellanox.com> Subject: [dpdk-dev] [RFC 01/10] net/mlx5: add multiport IB device port structure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The Mellanox NICs support SR-IOV and have E-Switch feature. When SR-IOV is set up in switchdev mode and E-Switch is enabled we have so called VF representors in the system. All representors belonging to the same E-Switch are created on the basis of the single PCI function and with current implementation each representor has its own dedicated Infiniband device and operates within its own Infiniband context. It is proposed to provide representors as ports of the single Infiniband device and operate on the shared Infiniband context saving various resources. This patch introduces appropriate structures. Signed-off-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 5384453..3487eed 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -186,10 +186,36 @@ struct mlx5_drop { struct mlx5_flow_tcf_context; +/* Per port data of shared IB device. */ +struct mlx5_ibv_shared_port { + uint32_t port_id; +}; + +/* + * Shared Infiniband device context for Master/Representors + * which belong to same IB device with multiple IB ports. + **/ +struct mlx5_ibv_shared { + LIST_ENTRY(mlx5_ibv_shared) next; + uint32_t refcnt; + uint32_t devx:1; /* Opened with DV. */ + uint32_t secondary:1; /* Temporary spawned by secondary process. */ + uint32_t max_port; /* Maximal IB device port index. */ + struct ibv_context *ctx; /* Verbs/DV context. */ + struct ibv_pd *pd; /* Protection Domain. */ + char ibdev_name[IBV_SYSFS_NAME_MAX]; /* IB device name. */ + char ibdev_path[IBV_SYSFS_PATH_MAX]; /* IB device path for secondary */ + struct ibv_device_attr_ex device_attr; /* Device properties. */ + struct rte_intr_handle intr_handle; /* Interrupt handler for device. */ + struct mlx5_ibv_shared_port port[]; /* per device port data array. */ +}; + struct mlx5_priv { LIST_ENTRY(mlx5_priv) mem_event_cb; /**< Called by memory event callback. */ struct rte_eth_dev_data *dev_data; /* Pointer to device data. */ + struct mlx5_ibv_shared *sh; /* Shared IB device context. */ + uint32_t ibv_port; /* IB device port number. */ struct ibv_context *ctx; /* Verbs context. */ struct ibv_device_attr_ex device_attr; /* Device properties. */ struct ibv_pd *pd; /* Protection Domain. */