DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
From: "Myers, Charles" <Charles.Myers@spirent.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: Yong Wang <yongwang@vmware.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v3] net/vmxnet3: Added mtu_set() function to allow setting MTU.
Date: Wed, 21 Aug 2019 05:19:22 +0000
Message-ID: <BYAPR10MB2664ADFBA8DDA8FA28560ED4EEAA0@BYAPR10MB2664.namprd10.prod.outlook.com> (raw)
In-Reply-To: <20190820214306.6ef7cd7f@hermes.lan>

MTU change is currently only allowed when device is stopped.

Current code in master branch already sets MTU in shared data correctly when starting the device:

static int
vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
{
        struct rte_eth_conf port_conf = dev->data->dev_conf;
        struct vmxnet3_hw *hw = dev->data->dev_private;
        uint32_t mtu = dev->data->mtu;
...
        devRead->misc.mtu = rte_le_to_cpu_32(mtu);
...
}

However current code in master branch does not implement a mtu_set() function so MTU in the dev->data is never changed from default of 1500:

int
rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu)
{
        int ret;
        struct rte_eth_dev_info dev_info;
        struct rte_eth_dev *dev;

        RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
        dev = &rte_eth_devices[port_id];
        RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mtu_set, -ENOTSUP);

        /*
         * Check if the device supports dev_infos_get, if it does not
         * skip min_mtu/max_mtu validation here as this requires values
         * that are populated within the call to rte_eth_dev_info_get()
         * which relies on dev->dev_ops->dev_infos_get.
         */
        if (*dev->dev_ops->dev_infos_get != NULL) {
                rte_eth_dev_info_get(port_id, &dev_info);
                if (mtu < dev_info.min_mtu || mtu > dev_info.max_mtu)
                        return -EINVAL;
        }

        ret = (*dev->dev_ops->mtu_set)(dev, mtu);
        if (!ret)
                dev->data->mtu = mtu;

        return eth_err(port_id, ret);
}

The vmxnet3 driver just needs to implement mtu_set() so that rte_eth_dev_set_mtu() allows changing the MTU and puts the value in dev->data->mtu .


-----Original Message-----
From: Stephen Hemminger <stephen@networkplumber.org> 
Sent: Tuesday, August 20, 2019 6:43 PM
To: Myers, Charles <Charles.Myers@spirent.com>
Cc: Yong Wang <yongwang@vmware.com>; dev@dpdk.org
Subject: Re: [PATCH v3] net/vmxnet3: Added mtu_set() function to allow setting MTU.

On Wed, 21 Aug 2019 02:16:58 +0000
"Myers, Charles" <Charles.Myers@spirent.com> wrote:

>  
>  static int
> +vmxnet3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) {
> +	if (dev->data->dev_started) {
> +		PMD_DRV_LOG(ERR, "Port %d must be stopped to configure MTU",
> +			    dev->data->port_id);
> +		return -EBUSY;
> +	}
> +
> +	return 0;
> +}
> +

Don't you need to reset the rx ring to change mtu on the fly?
At a minimum you need to communicate this value to host through the shared driver page.


  reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-17  4:53 [dpdk-dev] [PATCH] " Myers, Charles
2019-08-20  4:06 ` [dpdk-dev] [PATCH v2] " Myers, Charles
2019-08-20 15:12   ` Stephen Hemminger
2019-09-03 20:10   ` Yong Wang
2019-08-21  2:16 ` [dpdk-dev] [PATCH v3] " Myers, Charles
2019-08-21  4:43   ` Stephen Hemminger
2019-08-21  5:19     ` Myers, Charles [this message]
2019-09-13 18:47   ` Ferruh Yigit
2019-09-13 18:59     ` Ferruh Yigit

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BYAPR10MB2664ADFBA8DDA8FA28560ED4EEAA0@BYAPR10MB2664.namprd10.prod.outlook.com \
    --to=charles.myers@spirent.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=yongwang@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org dpdk-dev@archiver.kernel.org
	public-inbox-index dpdk-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox