>-----Original Message-----
>From: Ferruh Yigit <ferruh.yi...@intel.com>
>Sent: Tuesday, March 9, 2021 12:19 AM
>To: Xueming(Steven) Li <xuemi...@nvidia.com>; Andrew Rybchenko 
><andrew.rybche...@oktetlabs.ru>
>Cc: dev@dpdk.org; Slava Ovsiienko <viachesl...@nvidia.com>; Asaf Penso 
><as...@nvidia.com>; NBU-Contact-Thomas Monjalon
><tho...@monjalon.net>; Ray Kinsella <m...@ashroe.eu>; Neil Horman 
><nhor...@tuxdriver.com>
>Subject: Re: [PATCH v8 8/9] ethdev: representor iterator compare complete info
>
>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 <xuemi...@nvidia.com>
>
><...>
>
>> +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?

Good suggestion, thanks

>
>> +            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;
>> +            }
>> +    }
>
>
><...>

Reply via email to