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 4A467A054F; Tue, 2 Mar 2021 12:51:07 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D02D44014E; Tue, 2 Mar 2021 12:51:06 +0100 (CET) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 63E4340142 for ; Tue, 2 Mar 2021 12:51:05 +0100 (CET) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 0DA957F521; Tue, 2 Mar 2021 14:51:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 0DA957F521 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1614685865; bh=CVAC8WTAEEhk0KrA/yzTmmPDVtWRhgyyBqWbzYgGPMo=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=KHHroBaunONX54HDU43gfRvkHG3JIivsrEXs66qftg3gCFw4uv2+ylJU/3GtvQbRy FQgHY+V13h/03CR5GBGL5V4WSG+acWymaOwIqJsjrb6IdJGLBrmyl7S1/gt6D7mPOv 9+2Ig7E1o68feZKgtwYWmEdOJ/oYK2hADcOfwNDo= To: Xueming Li Cc: dev@dpdk.org, Viacheslav Ovsiienko , Asaf Penso , Thomas Monjalon , Ferruh Yigit References: <1608303356-13089-2-git-send-email-xuemingl@nvidia.com> <20210302114250.1088-1-xuemingl@nvidia.com> From: Andrew Rybchenko Organization: OKTET Labs Message-ID: <42675b24-6d98-8085-099a-9d973d12c1bb@oktetlabs.ru> Date: Tue, 2 Mar 2021 14:51:04 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210302114250.1088-1-xuemingl@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v7 5/9] ethdev: support PF index in representor 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/2/21 2:42 PM, Xueming Li wrote: > With Kernel bonding, multiple underlying PFs are bonded, VFs come > from different PF, need to identify representor of VFs unambiguously by > adding PF index. > > This patch introduces optional 'pf' section to representor devargs > syntax, examples: > representor=pf0vf0 - single VF representor > representor=pf[0-1]sf[0-1023] - SF representors from 2 PFs > > PF type representor is supported by using standalone 'pf' section: > representor=pf1 - PF representor > > Signed-off-by: Xueming Li > Acked-by: Viacheslav Ovsiienko > Acked-by: Thomas Monjalon A nit below. Acked-by: Andrew Rybchenko > --- > doc/guides/prog_guide/poll_mode_drv.rst | 3 +++ > lib/librte_ethdev/ethdev_private.c | 19 +++++++++++++++++-- > lib/librte_ethdev/rte_ethdev.h | 1 + > 3 files changed, 21 insertions(+), 2 deletions(-) > > diff --git a/doc/guides/prog_guide/poll_mode_drv.rst b/doc/guides/prog_guide/poll_mode_drv.rst > index 063a4680df..0d4ac77a7c 100644 > --- a/doc/guides/prog_guide/poll_mode_drv.rst > +++ b/doc/guides/prog_guide/poll_mode_drv.rst > @@ -382,6 +382,9 @@ parameters to those ports. > -a DBDF,representor=sf[1,3,5] > -a DBDF,representor=sf[0-1023] > -a DBDF,representor=sf[0,2-4,7,9-11] > + -a DBDF,representor=pf1vf0 > + -a DBDF,representor=pf[0-1]sf[0-127] > + -a DBDF,representor=pf1 > > Note: PMDs are not required to support the standard device arguments and users > should consult the relevant PMD documentation to see support devargs. > diff --git a/lib/librte_ethdev/ethdev_private.c b/lib/librte_ethdev/ethdev_private.c > index 13c191192e..cd87add37f 100644 > --- a/lib/librte_ethdev/ethdev_private.c > +++ b/lib/librte_ethdev/ethdev_private.c > @@ -118,8 +118,9 @@ rte_eth_devargs_process_list(char *str, uint16_t *list, uint16_t *len_list, > * > * Representor format: > * #: range or single number of VF representor - legacy > - * vf#: VF port representor/s > - * sf#: SF port representor/s > + * [pf#]vf#: VF port representor/s > + * [pf#]sf#: SF port representor/s > + * pf#: PF port representor/s > * > * Examples of #: > * 2 - single > @@ -131,6 +132,14 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) > { > struct rte_eth_devargs *eth_da = data; > > + if (str[0] == 'p' && str[1] == 'f') { > + eth_da->type = RTE_ETH_REPRESENTOR_PF; > + str += 2; > + str = rte_eth_devargs_process_list(str, eth_da->ports, > + ð_da->nb_ports, RTE_DIM(eth_da->ports)); > + if (str == NULL || str[0] == '\0') > + goto err; 'err' label name is misleading here, since it is not always error as far as I can see. It is a normal path in the case of 'pfX'. May be rename it as 'done' or something like this. > + } > if (str[0] == 'v' && str[1] == 'f') { > eth_da->type = RTE_ETH_REPRESENTOR_VF; > str += 2; > @@ -138,11 +147,17 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) > eth_da->type = RTE_ETH_REPRESENTOR_SF; > str += 2; > } else { > + /* 'pf' must followed by 'vf' or 'sf'. */ > + if (eth_da->type == RTE_ETH_REPRESENTOR_PF) { > + str = NULL; > + goto err; > + } > eth_da->type = RTE_ETH_REPRESENTOR_VF; > } > str = rte_eth_devargs_process_list(str, eth_da->representor_ports, > ð_da->nb_representor_ports, > RTE_DIM(eth_da->representor_ports)); > +err: > if (str == NULL) > RTE_LOG(ERR, EAL, "wrong representor format: %s\n", str); > return str == NULL ? -1 : 0; > diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h > index 26b5e109c3..9cd519bf59 100644 > --- a/lib/librte_ethdev/rte_ethdev.h > +++ b/lib/librte_ethdev/rte_ethdev.h > @@ -1513,6 +1513,7 @@ enum rte_eth_representor_type { > RTE_ETH_REPRESENTOR_NONE, /**< not a representor. */ > RTE_ETH_REPRESENTOR_VF, /**< representor of Virtual Function. */ > RTE_ETH_REPRESENTOR_SF, /**< representor of Sub Function. */ > + RTE_ETH_REPRESENTOR_PF, /**< representor of Physical Function. */ > }; > > /** >