From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 59E65A0566; Mon, 8 Mar 2021 17:18:48 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1E81D22A3F5; Mon, 8 Mar 2021 17:18:48 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 96BDD22A3EC for ; Mon, 8 Mar 2021 17:18:46 +0100 (CET) IronPort-SDR: JZTjkKf0WJbVayeJPyq7wX+VIcx2SNInofWXkm6KJAJ7NiC+EYYBaRHuLJPK5VsVz26+2XueSn dZiXcneM8loQ== X-IronPort-AV: E=McAfee;i="6000,8403,9917"; a="167970577" X-IronPort-AV: E=Sophos;i="5.81,232,1610438400"; d="scan'208";a="167970577" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2021 08:18:45 -0800 IronPort-SDR: I9Q+YqmzQzcloflEKEkiccPwwN03ZgiJNTru4p2P8wGeS26Jt3/FIW6F/FnNtAvATYIK9iUcqr MYYGzcAdqdaA== X-IronPort-AV: E=Sophos;i="5.81,232,1610438400"; d="scan'208";a="409355309" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.195.201]) ([10.213.195.201]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2021 08:18:43 -0800 To: Xueming Li , Andrew Rybchenko Cc: dev@dpdk.org, Viacheslav Ovsiienko , Asaf Penso , Thomas Monjalon , Ray Kinsella , Neil Horman References: <1608303356-13089-2-git-send-email-xuemingl@nvidia.com> <1614868228-13685-9-git-send-email-xuemingl@nvidia.com> From: Ferruh Yigit X-User: ferruhy Message-ID: <65993d5e-1467-f8ad-c2a3-bebcc176a0b0@intel.com> Date: Mon, 8 Mar 2021 16:18:39 +0000 MIME-Version: 1.0 In-Reply-To: <1614868228-13685-9-git-send-email-xuemingl@nvidia.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v8 8/9] ethdev: representor iterator compare complete info X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" On 3/4/2021 2:30 PM, Xueming Li wrote: > The NIC can have multiple PCIe links and can be attached to multiple > hosts, for example the same single NIC can be shared for multiple server > units in the rack. On each PCIe link NIC can provide multiple PFs and > VFs/SFs based on these ones. The full representor identifier consists of > three indices - controller index, PF index, and VF or SF index (if any). > > SR-IOV and SubFunction are created on top of PF. PF index is introduced > because there might be multiple PFs in the bonding configuration and > only bonding device is probed. > > In eth representor comparator callback, ethdev representor ID was > compared with devarg. Since controller index and PF index not compared, > callback returned representor from other PF or controller. > > This patch adds new API to get representor ID from controller, pf and > vf/sf index. Representor comparer callback get representor ID then > compare with device representor ID. > > Signed-off-by: Xueming Li <...> > +int > +rte_eth_representor_id_get(const struct rte_eth_dev *ethdev, > + enum rte_eth_representor_type type, > + int controller, int pf, int representor_port, > + uint16_t *repr_id) > +{ > + int ret, n, i, count; > + struct rte_eth_representor_info *info = NULL; > + size_t size; > + > + if (type == RTE_ETH_REPRESENTOR_NONE) > + return 0; > + if (repr_id == NULL) > + return -EINVAL; > + > + /* Get PMD representor range info. */ > + ret = rte_eth_representor_info_get(ethdev->data->port_id, NULL); > + if (ret < 0) { This seems to support the legacy format, should the return value checked explicitly against the '-ENOTSUP', instead of any error? > + if (type == RTE_ETH_REPRESENTOR_VF && controller == -1 && > + pf == -1) { > + /* Direct mapping for legacy VF representor. */ > + *repr_id = representor_port; > + return 0; > + } else { > + return ret; > + } > + } <...>