DPDK patches and discussions
 help / color / mirror / Atom feed
From: souvikdey33 <sodey@sonusnet.com>
To: <huawei.xie@intel.com>, <yuanhan.liu@linux.intel.com>
Cc: <dev@dpdk.org>, souvikdey33 <sodey@sonusnet.com>
Subject: [dpdk-dev] [PATCH v1] add mtu set in virtio
Date: Fri, 26 Aug 2016 20:54:28 -0400	[thread overview]
Message-ID: <20160827005428.16556-1-sodey@sonusnet.com> (raw)

This functionality is required mostly in the cloud infrastructure.
For example, if we use gre or vxlan network between compute and
controller, then we should not use 1500 mtu in the guest as with
encapsulation the sixe of the packet will be more and will get 
dropped in the infrastructure. So, in that case we should honor
the mtu size sent by the dhcp server and configure the same on 
the virtual interfaces in the guest. This will also keep a 
consistent mtu through out the infrastructure.

souvikdey33 (1):
  Signed-off-by: Souvik Dey <sodey@sonusnet.com>

 drivers/net/virtio/virtio_ethdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

-- 
>From 2e4b391fe90ba5e617611e341a7d260dd3dd9144 Mon Sep 17 00:00:00 2001
From: souvikdey33 <sodey@sonusnet.com>
Date: Fri, 26 Aug 2016 20:46:21 -0400
Subject: [PATCH v1] Signed-off-by: Souvik Dey <sodey@sonusnet.com>

Fixes: 1fb8e8896ca8 ("Signed-off-by: Souvik Dey <sodey@sonusnet.com>")

Virtio interfaces should also support setting of mtu, as in case of cloud
it is expected to have the consistent mtu across the infrastructure that
the dhcp server sends and not hardcoded to 1500(default).
---
 drivers/net/virtio/virtio_ethdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 07d6449..da16ad4 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -92,6 +92,7 @@ static void virtio_mac_addr_add(struct rte_eth_dev *dev,
 static void virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index);
 static void virtio_mac_addr_set(struct rte_eth_dev *dev,
 				struct ether_addr *mac_addr);
+static int  virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
 
 static int virtio_dev_queue_stats_mapping_set(
 	__rte_unused struct rte_eth_dev *eth_dev,
@@ -652,6 +653,16 @@ virtio_dev_allmulticast_disable(struct rte_eth_dev *dev)
 		PMD_INIT_LOG(ERR, "Failed to disable allmulticast");
 }
 
+static int 
+virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) 
+{
+   struct virtio_hw *hw = dev->data->dev_private;
+   if (unlikely(mtu < (uint32_t)hw->vtnet_hdr_size + ETHER_HDR_LEN)) {
+       return -1;
+   }
+   return 0;
+}
+
 /*
  * dev_ops for virtio, bare necessities for basic operation
  */
@@ -664,6 +675,7 @@ static const struct eth_dev_ops virtio_eth_dev_ops = {
 	.promiscuous_disable     = virtio_dev_promiscuous_disable,
 	.allmulticast_enable     = virtio_dev_allmulticast_enable,
 	.allmulticast_disable    = virtio_dev_allmulticast_disable,
+	.mtu_set                 = virtio_mtu_set,
 
 	.dev_infos_get           = virtio_dev_info_get,
 	.stats_get               = virtio_dev_stats_get,
-- 
2.9.3.windows.1

             reply	other threads:[~2016-08-27  0:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-27  0:54 souvikdey33 [this message]
2016-08-28  0:15 ` Stephen Hemminger
2016-08-28 22:43   ` Dey, Souvik
2016-08-29 19:33     ` Stephen Hemminger
2016-08-29 22:49       ` Dey, Souvik

Reply instructions:

You may reply publicly 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=20160827005428.16556-1-sodey@sonusnet.com \
    --to=sodey@sonusnet.com \
    --cc=dev@dpdk.org \
    --cc=huawei.xie@intel.com \
    --cc=yuanhan.liu@linux.intel.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).