On 10/10/2022 11:17 AM, Junfeng Guo wrote:


Support dev_ops mtu_set.

Signed-off-by: Xiaoyun Li <xiaoyun...@intel.com>
Signed-off-by: Junfeng Guo <junfeng....@intel.com>

<...>


+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;
+       }
+
+       dev->data->dev_conf.rxmode.mtu = mtu + RTE_ETHER_HDR_LEN;

it is 'dev->data->mtu' that holds latest MTU value.

'dev_conf.rxmode.mtu' is the config requested from user, no need to update that.

And since 'dev->data->mtu' already updated by 'rte_eth_dev_set_mtu()', can drop above line.

Reply via email to