DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
From: Yong Wang <yongwang@vmware.com>
To: "Myers, Charles" <Charles.Myers@spirent.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2] net/vmxnet3: Added mtu_set() function to allow setting MTU.
Date: Tue, 3 Sep 2019 20:10:40 +0000
Message-ID: <8BE692ED-BBA9-41EA-8D3A-CAE640D780CF@vmware.com> (raw)
In-Reply-To: <1566273996-24368-1-git-send-email-charles.myers@spirent.com>

-----Original Message-----
From: "Myers, Charles" <Charles.Myers@spirent.com>
Date: Monday, August 19, 2019 at 9:07 PM
To: Yong Wang <yongwang@vmware.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "Myers, Charles" <Charles.Myers@spirent.com>
Subject: [PATCH v2] net/vmxnet3: Added mtu_set() function to allow setting MTU.

    From: Charles Myers <charles.myers@spirent.com>
    
    When the mtu_set() function is not implemented, rte_eth_dev_set_mtu()
    fails with -ENOTSUP and mtu is not stored in the mtu field in the
    rte_eth_dev_data.  This causes the mtu in Vmxnet3_MiscConf which is
    shared with hypervisor to always be set to 1500.
    
    This may cause issues receiving jumbo frames on Enhanced Data Path
    N-VDS.
    
    Signed-off-by: Charles Myers <charles.myers@spirent.com>
    ---
    SMTP server overwrote the From address display name in previous e-mail.
    Hopefully this resubmission fixes it.
    
     drivers/net/vmxnet3/vmxnet3_ethdev.c | 22 ++++++++++++++++++++++
     1 file changed, 22 insertions(+)
    
    diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
    index 57feb37..c32c92d 100644
    --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
    +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
    @@ -88,6 +88,7 @@ static void vmxnet3_dev_info_get(struct rte_eth_dev *dev,
     				 struct rte_eth_dev_info *dev_info);
     static const uint32_t *
     vmxnet3_dev_supported_ptypes_get(struct rte_eth_dev *dev);
    +static int vmxnet3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
     static int vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev,
     				       uint16_t vid, int on);
     static int vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask);
    @@ -125,6 +126,7 @@ static const struct eth_dev_ops vmxnet3_eth_dev_ops = {
     	.mac_addr_set         = vmxnet3_mac_addr_set,
     	.dev_infos_get        = vmxnet3_dev_info_get,
     	.dev_supported_ptypes_get = vmxnet3_dev_supported_ptypes_get,
    +	.mtu_set              = vmxnet3_dev_mtu_set,
     	.vlan_filter_set      = vmxnet3_dev_vlan_filter_set,
     	.vlan_offload_set     = vmxnet3_dev_vlan_offload_set,
     	.rx_queue_setup       = vmxnet3_dev_rx_queue_setup,
    @@ -1161,6 +1163,8 @@ vmxnet3_dev_info_get(struct rte_eth_dev *dev __rte_unused,
     	dev_info->max_tx_queues = VMXNET3_MAX_TX_QUEUES;
     	dev_info->min_rx_bufsize = 1518 + RTE_PKTMBUF_HEADROOM;
     	dev_info->max_rx_pktlen = 16384; /* includes CRC, cf MAXFRS register */
    +	dev_info->min_mtu = VMXNET3_MIN_MTU;
    +	dev_info->max_mtu = VMXNET3_MAX_MTU;
     	dev_info->speed_capa = ETH_LINK_SPEED_10G;
     	dev_info->max_mac_addrs = VMXNET3_MAX_MAC_ADDRS;
     
    @@ -1205,6 +1209,24 @@ vmxnet3_dev_supported_ptypes_get(struct rte_eth_dev *dev)
     }
     
     static int
    +vmxnet3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
    +{
    +	if (mtu < VMXNET3_MIN_MTU || mtu > VMXNET3_MAX_MTU) {
    +		PMD_DRV_LOG(ERR, "MTU should be between %d and %d",
    +			     VMXNET3_MIN_MTU, VMXNET3_MAX_MTU);
    +		return -EINVAL;
    +	}
    +

It looks like the above check is redundant as rte_eth_dev_set_mtu() already checks the same based on dev_info->min_mtu and max_mtu.  But seems many other drivers are doing the same check so probably a separate patch to clean this up.

    +	if (dev->data->dev_started) {
    +		PMD_DRV_LOG(ERR, "Port %d must be stopped to configure MTU",
    +			    dev->data->port_id);
    +		return -EBUSY;
    +	}
    +

Can you add the following for the vmxnet3 backend to see the change:

	dev->data->mtu = mtu;  /* this is needed because vmxnet3_dev_start use this to update the backend but  rte_eth_dev_set_mtu() set it after the driver callback */

	/* changing mtu for vmxnet3 pmd does not require a restart                                                                                                                                               
	 * We stop and restart the device here                                                                                                                                              
	 * just to pass the mtu info to the backend. */                                                                                                                                                          
	vmxnet3_dev_stop(dev);                                                                                                                                                                                   
	vmxnet3_dev_start(dev);      

    +	return 0;
    +}
    +
    +static int
     vmxnet3_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr)
     {
     	struct vmxnet3_hw *hw = dev->data->dev_private;
    -- 
    2.7.4
    
    


  parent 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 [this message]
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
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=8BE692ED-BBA9-41EA-8D3A-CAE640D780CF@vmware.com \
    --to=yongwang@vmware.com \
    --cc=Charles.Myers@spirent.com \
    --cc=dev@dpdk.org \
    /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