[v7,6/8] net/gve: add support for dev info get and dev configure

Message ID 20221021091928.2674471-7-junfeng.guo@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series introduce GVE PMD |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Junfeng Guo Oct. 21, 2022, 9:19 a.m. UTC
  Add dev_ops dev_infos_get.
Complete dev_configure with RX offloads force enabling.

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
---
 doc/guides/nics/features/gve.ini |  2 ++
 doc/guides/nics/gve.rst          |  1 +
 drivers/net/gve/gve_ethdev.c     | 59 +++++++++++++++++++++++++++++++-
 drivers/net/gve/gve_ethdev.h     |  3 ++
 4 files changed, 64 insertions(+), 1 deletion(-)
  

Comments

Ferruh Yigit Oct. 21, 2022, 9:51 a.m. UTC | #1
On 10/21/2022 10:19 AM, Junfeng Guo wrote:

> 
> Add dev_ops dev_infos_get.
> Complete dev_configure with RX offloads force enabling.
> 
> Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
> Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>

<...>

> --- a/doc/guides/nics/gve.rst
> +++ b/doc/guides/nics/gve.rst
> @@ -62,6 +62,7 @@ In this release, the GVE PMD provides the basic functionality of packet
>   reception and transmission.
>   Supported features of the GVE PMD are:
> 
> +- Receiver Side Scaling (RSS)

[copy/paste from previous version]

I am not sure if driver can claim this, I can see a RSS hash is provided 
but is it possible to update which hash function to use or update key or 
RETA table to configure which queue packets goes?

Right now what is RSS calculated on?

Perpaps RSS support can be documented as limited?

And not sure if this update belongs this patch, it should be to the one 
that has the datapath.
  
Junfeng Guo Oct. 24, 2022, 5:04 a.m. UTC | #2
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@amd.com>
> Sent: Friday, October 21, 2022 17:51
> To: Guo, Junfeng <junfeng.guo@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>;
> ferruh.yigit@xilinx.com; Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Li, Xiaoyun <xiaoyun.li@intel.com>;
> awogbemila@google.com; Richardson, Bruce
> <bruce.richardson@intel.com>; hemant.agrawal@nxp.com;
> stephen@networkplumber.org; Xia, Chenbo <chenbo.xia@intel.com>;
> Zhang, Helin <helin.zhang@intel.com>
> Subject: Re: [PATCH v7 6/8] net/gve: add support for dev info get and dev
> configure
> 
> On 10/21/2022 10:19 AM, Junfeng Guo wrote:
> 
> >
> > Add dev_ops dev_infos_get.
> > Complete dev_configure with RX offloads force enabling.
> >
> > Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
> > Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
> 
> <...>
> 
> > --- a/doc/guides/nics/gve.rst
> > +++ b/doc/guides/nics/gve.rst
> > @@ -62,6 +62,7 @@ In this release, the GVE PMD provides the basic
> functionality of packet
> >   reception and transmission.
> >   Supported features of the GVE PMD are:
> >
> > +- Receiver Side Scaling (RSS)
> 
> [copy/paste from previous version]
> 
> I am not sure if driver can claim this, I can see a RSS hash is provided
> but is it possible to update which hash function to use or update key or
> RETA table to configure which queue packets goes?
> 
> Right now what is RSS calculated on?
> 
> Perpaps RSS support can be documented as limited?
> 
> And not sure if this update belongs this patch, it should be to the one
> that has the datapath.

Looks that the RSS is enabled by default, and there is no RSS init API.
So I just added back the force-enabled RSS offloading code with the
corresponding commit message. So the feature list remains unchaged.
Thanks!
  
Ferruh Yigit Oct. 24, 2022, 10:48 a.m. UTC | #3
On 10/24/2022 6:04 AM, Guo, Junfeng wrote:
> 
> 
>> -----Original Message-----
>> From: Ferruh Yigit <ferruh.yigit@amd.com>
>> Sent: Friday, October 21, 2022 17:51
>> To: Guo, Junfeng <junfeng.guo@intel.com>; Zhang, Qi Z
>> <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>;
>> ferruh.yigit@xilinx.com; Xing, Beilei <beilei.xing@intel.com>
>> Cc: dev@dpdk.org; Li, Xiaoyun <xiaoyun.li@intel.com>;
>> awogbemila@google.com; Richardson, Bruce
>> <bruce.richardson@intel.com>; hemant.agrawal@nxp.com;
>> stephen@networkplumber.org; Xia, Chenbo <chenbo.xia@intel.com>;
>> Zhang, Helin <helin.zhang@intel.com>
>> Subject: Re: [PATCH v7 6/8] net/gve: add support for dev info get and dev
>> configure
>>
>> On 10/21/2022 10:19 AM, Junfeng Guo wrote:
>>
>>>
>>> Add dev_ops dev_infos_get.
>>> Complete dev_configure with RX offloads force enabling.
>>>
>>> Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
>>> Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
>>
>> <...>
>>
>>> --- a/doc/guides/nics/gve.rst
>>> +++ b/doc/guides/nics/gve.rst
>>> @@ -62,6 +62,7 @@ In this release, the GVE PMD provides the basic
>> functionality of packet
>>>    reception and transmission.
>>>    Supported features of the GVE PMD are:
>>>
>>> +- Receiver Side Scaling (RSS)
>>
>> [copy/paste from previous version]
>>
>> I am not sure if driver can claim this, I can see a RSS hash is provided
>> but is it possible to update which hash function to use or update key or
>> RETA table to configure which queue packets goes?
>>
>> Right now what is RSS calculated on?
>>
>> Perpaps RSS support can be documented as limited?
>>
>> And not sure if this update belongs this patch, it should be to the one
>> that has the datapath.
> 
> Looks that the RSS is enabled by default, and there is no RSS init API.
> So I just added back the force-enabled RSS offloading code with the
> corresponding commit message. So the feature list remains unchaged.

There is difference between RSS and RSS hash, what force enabled is "RSS 
hash" where device calculated hash value is shared with application in 
case application wants to reuse this value for some reasons.

But for RSS support, there is a set of configuration required by DPDK 
seems missing, as mentioned above, config RSS hash function (based on 
which part of the packet is the hash calculated), or RETA table update 
so app can select which packets goes to which queue, etc...

Is it at least possible to document what existing configuration is?

Because of missing configuration support, I don't think it is correct to 
document RSS as supported, can you please update it to say something 
like limited support exist with default config.
  
Junfeng Guo Oct. 24, 2022, 1:23 p.m. UTC | #4
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@amd.com>
> Sent: Monday, October 24, 2022 18:49
> To: Guo, Junfeng <junfeng.guo@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Xing,
> Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Li, Xiaoyun <xiaoyun.li@intel.com>;
> awogbemila@google.com; Richardson, Bruce
> <bruce.richardson@intel.com>; hemant.agrawal@nxp.com;
> stephen@networkplumber.org; Xia, Chenbo <chenbo.xia@intel.com>;
> Zhang, Helin <helin.zhang@intel.com>
> Subject: Re: [PATCH v7 6/8] net/gve: add support for dev info get and dev
> configure
> 
> On 10/24/2022 6:04 AM, Guo, Junfeng wrote:
> >
> >
> >> -----Original Message-----
> >> From: Ferruh Yigit <ferruh.yigit@amd.com>
> >> Sent: Friday, October 21, 2022 17:51
> >> To: Guo, Junfeng <junfeng.guo@intel.com>; Zhang, Qi Z
> >> <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>;
> >> ferruh.yigit@xilinx.com; Xing, Beilei <beilei.xing@intel.com>
> >> Cc: dev@dpdk.org; Li, Xiaoyun <xiaoyun.li@intel.com>;
> >> awogbemila@google.com; Richardson, Bruce
> >> <bruce.richardson@intel.com>; hemant.agrawal@nxp.com;
> >> stephen@networkplumber.org; Xia, Chenbo <chenbo.xia@intel.com>;
> >> Zhang, Helin <helin.zhang@intel.com>
> >> Subject: Re: [PATCH v7 6/8] net/gve: add support for dev info get and
> dev
> >> configure
> >>
> >> On 10/21/2022 10:19 AM, Junfeng Guo wrote:
> >>
> >>>
> >>> Add dev_ops dev_infos_get.
> >>> Complete dev_configure with RX offloads force enabling.
> >>>
> >>> Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
> >>> Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
> >>
> >> <...>
> >>
> >>> --- a/doc/guides/nics/gve.rst
> >>> +++ b/doc/guides/nics/gve.rst
> >>> @@ -62,6 +62,7 @@ In this release, the GVE PMD provides the basic
> >> functionality of packet
> >>>    reception and transmission.
> >>>    Supported features of the GVE PMD are:
> >>>
> >>> +- Receiver Side Scaling (RSS)
> >>
> >> [copy/paste from previous version]
> >>
> >> I am not sure if driver can claim this, I can see a RSS hash is provided
> >> but is it possible to update which hash function to use or update key or
> >> RETA table to configure which queue packets goes?
> >>
> >> Right now what is RSS calculated on?
> >>
> >> Perpaps RSS support can be documented as limited?
> >>
> >> And not sure if this update belongs this patch, it should be to the one
> >> that has the datapath.
> >
> > Looks that the RSS is enabled by default, and there is no RSS init API.
> > So I just added back the force-enabled RSS offloading code with the
> > corresponding commit message. So the feature list remains unchaged.
> 
> There is difference between RSS and RSS hash, what force enabled is "RSS
> hash" where device calculated hash value is shared with application in
> case application wants to reuse this value for some reasons.
> 
> But for RSS support, there is a set of configuration required by DPDK
> seems missing, as mentioned above, config RSS hash function (based on
> which part of the packet is the hash calculated), or RETA table update
> so app can select which packets goes to which queue, etc...
> 
> Is it at least possible to document what existing configuration is?
> 
> Because of missing configuration support, I don't think it is correct to
> document RSS as supported, can you please update it to say something
> like limited support exist with default config.

Thanks for the detailed explanations!
Yes, you are right. The RSS cannot be configured by this user at this time.
So it should be commented as an limitation here. Will update this in the 
coming version. Really thanks for your time and efforts to review!
  

Patch

diff --git a/doc/guides/nics/features/gve.ini b/doc/guides/nics/features/gve.ini
index d1703d8dab..986df7f94a 100644
--- a/doc/guides/nics/features/gve.ini
+++ b/doc/guides/nics/features/gve.ini
@@ -4,8 +4,10 @@ 
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
+Speed capabilities   = Y
 Link status          = Y
 MTU update           = Y
+RSS hash             = Y
 Linux                = Y
 x86-32               = Y
 x86-64               = Y
diff --git a/doc/guides/nics/gve.rst b/doc/guides/nics/gve.rst
index c42ff23841..8c09a5a7fa 100644
--- a/doc/guides/nics/gve.rst
+++ b/doc/guides/nics/gve.rst
@@ -62,6 +62,7 @@  In this release, the GVE PMD provides the basic functionality of packet
 reception and transmission.
 Supported features of the GVE PMD are:
 
+- Receiver Side Scaling (RSS)
 - Link state information
 
 Currently, only GQI_QPL and GQI_RDA queue format are supported in PMD.
diff --git a/drivers/net/gve/gve_ethdev.c b/drivers/net/gve/gve_ethdev.c
index 554f58640d..7fbe0c78c9 100644
--- a/drivers/net/gve/gve_ethdev.c
+++ b/drivers/net/gve/gve_ethdev.c
@@ -29,8 +29,16 @@  gve_write_version(uint8_t *driver_version_register)
 }
 
 static int
-gve_dev_configure(__rte_unused struct rte_eth_dev *dev)
+gve_dev_configure(struct rte_eth_dev *dev)
 {
+	struct gve_priv *priv = dev->data->dev_private;
+
+	if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
+		dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
+
+	if (dev->data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_TCP_LRO)
+		priv->enable_rsc = 1;
+
 	return 0;
 }
 
@@ -96,6 +104,54 @@  gve_dev_close(struct rte_eth_dev *dev)
 	return err;
 }
 
+static int
+gve_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
+{
+	struct gve_priv *priv = dev->data->dev_private;
+
+	dev_info->device = dev->device;
+	dev_info->max_mac_addrs = 1;
+	dev_info->max_rx_queues = priv->max_nb_rxq;
+	dev_info->max_tx_queues = priv->max_nb_txq;
+	dev_info->min_rx_bufsize = GVE_MIN_BUF_SIZE;
+	dev_info->max_rx_pktlen = GVE_MAX_RX_PKTLEN;
+	dev_info->max_mtu = GVE_MAX_MTU;
+	dev_info->min_mtu = GVE_MIN_MTU;
+
+	dev_info->rx_offload_capa = 0;
+	dev_info->tx_offload_capa = 0;
+
+	if (priv->queue_format == GVE_DQO_RDA_FORMAT)
+		dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_TCP_LRO;
+
+	dev_info->default_rxconf = (struct rte_eth_rxconf) {
+		.rx_free_thresh = GVE_DEFAULT_RX_FREE_THRESH,
+		.rx_drop_en = 0,
+		.offloads = 0,
+	};
+
+	dev_info->default_txconf = (struct rte_eth_txconf) {
+		.tx_free_thresh = GVE_DEFAULT_TX_FREE_THRESH,
+		.offloads = 0,
+	};
+
+	dev_info->default_rxportconf.ring_size = priv->rx_desc_cnt;
+	dev_info->rx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = priv->rx_desc_cnt,
+		.nb_min = priv->rx_desc_cnt,
+		.nb_align = 1,
+	};
+
+	dev_info->default_txportconf.ring_size = priv->tx_desc_cnt;
+	dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = priv->tx_desc_cnt,
+		.nb_min = priv->tx_desc_cnt,
+		.nb_align = 1,
+	};
+
+	return 0;
+}
+
 static int
 gve_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 {
@@ -128,6 +184,7 @@  static const struct eth_dev_ops gve_eth_dev_ops = {
 	.dev_start            = gve_dev_start,
 	.dev_stop             = gve_dev_stop,
 	.dev_close            = gve_dev_close,
+	.dev_infos_get        = gve_dev_info_get,
 	.link_update          = gve_link_update,
 	.mtu_set              = gve_dev_mtu_set,
 };
diff --git a/drivers/net/gve/gve_ethdev.h b/drivers/net/gve/gve_ethdev.h
index 2ac2a46ac1..57c29374b5 100644
--- a/drivers/net/gve/gve_ethdev.h
+++ b/drivers/net/gve/gve_ethdev.h
@@ -18,6 +18,9 @@ 
 #define GVE_MIN_BUF_SIZE	    1024
 #define GVE_MAX_RX_PKTLEN	    65535
 
+#define GVE_MAX_MTU	RTE_ETHER_MTU
+#define GVE_MIN_MTU	RTE_ETHER_MIN_MTU
+
 /* A list of pages registered with the device during setup and used by a queue
  * as buffers
  */