On 10/24/2022 6:04 AM, Guo, Junfeng wrote:
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, October 21, 2022 17:50
To: Guo, Junfeng <[email protected]>; Zhang, Qi Z
<[email protected]>; Wu, Jingjing <[email protected]>; Xing,
Beilei <[email protected]>
Cc: [email protected]; Li, Xiaoyun <[email protected]>;
[email protected]; Richardson, Bruce
<[email protected]>; [email protected];
[email protected]; Xia, Chenbo <[email protected]>;
Zhang, Helin <[email protected]>
Subject: Re: [PATCH v7 5/8] net/gve: add support for MTU setting
On 10/21/2022 10:19 AM, Junfeng Guo wrote:
Support dev_ops mtu_set.
Signed-off-by: Xiaoyun Li <[email protected]>
Signed-off-by: Junfeng Guo <[email protected]>
<...>
+static int
+gve_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
+{
+ struct gve_priv *priv = dev->data->dev_private;
+ int err;
+
+ if (mtu < RTE_ETHER_MIN_MTU || mtu > priv->max_mtu) {
+ PMD_DRV_LOG(ERR, "MIN MTU is %u, MAX MTU is %u",
+ RTE_ETHER_MIN_MTU, priv->max_mtu);
+ return -EINVAL;
+ }
+
+ /* mtu setting is forbidden if port is start */
+ if (dev->data->dev_started) {
+ PMD_DRV_LOG(ERR, "Port must be stopped before
configuration");
+ return -EBUSY;
+ }
+
+ err = gve_adminq_set_mtu(priv, mtu);
+ if (err) {
+ PMD_DRV_LOG(ERR, "Failed to set mtu as %u err = %d", mtu,
err);
+ return err;
+ }
+
+ return 0;
+}
+
[copy/paste from previous version]
configure() (gve_dev_configure()) also get 'mtu' as user config
('eth_conf->rxmode.mtu') which is ignored right now,
since there is 'gve_adminq_set_mtu()' command already what do you
think
to use it within 'gve_dev_configure()'?
There may be issues to set mtu with ('eth_conf->rxmode.mtu').
So better to keep this ignored at this stage.
What do you mean by issues?
'eth_conf->rxmode.mtu' is user provided config parameter, so user may
prefer to provide this value and not call 'rte_eth_dev_set_mtu()' at all
and still can expect correct MTU value.