DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pascal Mazon <pascal.mazon@6wind.com>
To: keith.wiles@intel.com, ferruh.yigit@intel.com
Cc: dev@dpdk.org, Pascal Mazon <pascal.mazon@6wind.com>
Subject: [dpdk-dev] [PATCH v5 4/8] net/tap: add MTU management
Date: Wed, 15 Mar 2017 15:48:15 +0100	[thread overview]
Message-ID: <ede6f0f5ba9d470962477fb433c35c4ddec873eb.1489589167.git.pascal.mazon@6wind.com> (raw)
In-Reply-To: <cover.1489589167.git.pascal.mazon@6wind.com>

The MTU is assigned to the tap netdevice according to the argument, but
packet transmission and reception just write/read on an fd with the
default limit being the socket buffer size.

As a new rte_eth_dev_data is allocated during tap device init, ensure it
is set again dev->data->mtu.
Once the actual netdevice is created via tun_alloc(), make sure to apply
the desired MTU to the netdevice.

Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 doc/guides/nics/features/tap.ini |  1 +
 drivers/net/tap/rte_eth_tap.c    | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/doc/guides/nics/features/tap.ini b/doc/guides/nics/features/tap.ini
index d9b47a003654..b80577753240 100644
--- a/doc/guides/nics/features/tap.ini
+++ b/doc/guides/nics/features/tap.ini
@@ -9,6 +9,7 @@ Jumbo frame          = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Basic stats          = Y
+MTU update           = Y
 Unicast MAC filter   = Y
 Other kdrv           = Y
 ARMv7                = Y
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 2cf8203ba24e..b14bbabb84cb 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -350,6 +350,7 @@ tap_ioctl(struct pmd_internals *pmd, unsigned long request,
 		break;
 	case SIOCGIFHWADDR:
 	case SIOCSIFHWADDR:
+	case SIOCSIFMTU:
 		break;
 	default:
 		RTE_LOG(WARNING, PMD, "%s: ioctl() called with wrong arg\n",
@@ -595,6 +596,15 @@ tap_setup_queue(struct rte_eth_dev *dev,
 					pmd->name, qid);
 				return -1;
 			}
+			if (qid == 0) {
+				struct ifreq ifr;
+
+				ifr.ifr_mtu = dev->data->mtu;
+				if (tap_ioctl(pmd, SIOCSIFMTU, &ifr, 1) < 0) {
+					close(fd);
+					return -1;
+				}
+			}
 		}
 	}
 
@@ -691,6 +701,20 @@ tap_tx_queue_setup(struct rte_eth_dev *dev,
 	return 0;
 }
 
+static int
+tap_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
+{
+	struct pmd_internals *pmd = dev->data->dev_private;
+	struct ifreq ifr = { .ifr_mtu = mtu };
+	int err = 0;
+
+	err = tap_ioctl(pmd, SIOCSIFMTU, &ifr, 1);
+	if (!err)
+		dev->data->mtu = mtu;
+
+	return err;
+}
+
 static const struct eth_dev_ops ops = {
 	.dev_start              = tap_dev_start,
 	.dev_stop               = tap_dev_stop,
@@ -709,6 +733,7 @@ static const struct eth_dev_ops ops = {
 	.allmulticast_enable    = tap_allmulti_enable,
 	.allmulticast_disable   = tap_allmulti_disable,
 	.mac_addr_set           = tap_mac_set,
+	.mtu_set                = tap_mtu_set,
 	.stats_get              = tap_stats_get,
 	.stats_reset            = tap_stats_reset,
 };
@@ -759,6 +784,7 @@ eth_dev_tap_create(const char *name, char *tap_name)
 	/* Setup some default values */
 	data->dev_private = pmd;
 	data->port_id = dev->data->port_id;
+	data->mtu = dev->data->mtu;
 	data->dev_flags = RTE_ETH_DEV_DETACHABLE;
 	data->kdrv = RTE_KDRV_NONE;
 	data->drv_name = pmd_tap_drv.driver.name;
-- 
2.8.0.rc0

  parent reply	other threads:[~2017-03-15 14:51 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03  9:46 [dpdk-dev] [PATCH 0/6] net/tap: add additional management ops Pascal Mazon
2017-03-03  9:46 ` [dpdk-dev] [PATCH 1/6] net/tap: add MAC address " Pascal Mazon
2017-03-03  9:46 ` [dpdk-dev] [PATCH 2/6] net/tap: add speed capabilities Pascal Mazon
2017-03-03 15:27   ` Wiles, Keith
2017-03-06 13:58     ` Pascal Mazon
2017-03-06 14:38       ` Wiles, Keith
2017-03-03  9:46 ` [dpdk-dev] [PATCH 3/6] net/tap: add multicast addresses management Pascal Mazon
2017-03-03  9:46 ` [dpdk-dev] [PATCH 4/6] net/tap: add MTU management Pascal Mazon
2017-03-03 15:23   ` Wiles, Keith
2017-03-06 13:59     ` Pascal Mazon
2017-03-03  9:46 ` [dpdk-dev] [PATCH 5/6] net/tap: add packet type management Pascal Mazon
2017-03-03 15:31   ` Wiles, Keith
2017-03-06 14:10     ` Pascal Mazon
2017-03-06 14:46       ` Wiles, Keith
2017-03-03  9:46 ` [dpdk-dev] [PATCH 6/6] net/tap: add flow control management Pascal Mazon
2017-03-06 16:31 ` [dpdk-dev] [PATCH v2 0/6] net/tap: add additional management ops Pascal Mazon
2017-03-06 16:31   ` [dpdk-dev] [PATCH v2 1/6] net/tap: add MAC address " Pascal Mazon
2017-03-06 16:31   ` [dpdk-dev] [PATCH v2 2/6] net/tap: add speed capabilities Pascal Mazon
2017-03-06 16:31   ` [dpdk-dev] [PATCH v2 3/6] net/tap: add multicast addresses management Pascal Mazon
2017-03-06 16:31   ` [dpdk-dev] [PATCH v2 4/6] net/tap: add MTU management Pascal Mazon
2017-03-06 16:31   ` [dpdk-dev] [PATCH v2 5/6] net/tap: add packet type management Pascal Mazon
2017-03-06 16:31   ` [dpdk-dev] [PATCH v2 6/6] net/tap: add flow control management Pascal Mazon
2017-03-07 16:31   ` [dpdk-dev] [PATCH v3 0/6] net/tap: add additional management ops Pascal Mazon
2017-03-14  8:22     ` [dpdk-dev] [PATCH v4 0/8] " Pascal Mazon
2017-03-14  8:22       ` [dpdk-dev] [PATCH v4 1/8] net/tap: remove wrong IFF_NOARP flags Pascal Mazon
2017-03-14  8:22       ` [dpdk-dev] [PATCH v4 2/8] net/tap: refactor ioctl calls Pascal Mazon
2017-03-14  8:22       ` [dpdk-dev] [PATCH v4 3/8] net/tap: add MAC address management Pascal Mazon
2017-03-14  8:22       ` [dpdk-dev] [PATCH v4 4/8] net/tap: add MTU management Pascal Mazon
2017-03-14  8:22       ` [dpdk-dev] [PATCH v4 5/8] net/tap: add speed capabilities Pascal Mazon
2017-03-14  8:22       ` [dpdk-dev] [PATCH v4 6/8] net/tap: add multicast addresses management Pascal Mazon
2017-03-14  8:22       ` [dpdk-dev] [PATCH v4 7/8] net/tap: add packet type management Pascal Mazon
2017-03-15 13:35         ` Ferruh Yigit
2017-03-15 13:44           ` Pascal Mazon
2017-03-15 14:31             ` Ferruh Yigit
2017-03-15 13:42         ` Ferruh Yigit
2017-03-14  8:22       ` [dpdk-dev] [PATCH v4 8/8] net/tap: add flow control management Pascal Mazon
2017-03-15 13:43       ` [dpdk-dev] [PATCH v4 0/8] net/tap: add additional management ops Ferruh Yigit
2017-03-15 14:48     ` [dpdk-dev] [PATCH v5 " Pascal Mazon
2017-03-15 14:48       ` [dpdk-dev] [PATCH v5 1/8] net/tap: remove wrong IFF_NOARP flags Pascal Mazon
2017-03-15 21:37         ` Wiles, Keith
2017-03-15 14:48       ` [dpdk-dev] [PATCH v5 2/8] net/tap: refactor ioctl calls Pascal Mazon
2017-03-15 14:48       ` [dpdk-dev] [PATCH v5 3/8] net/tap: add MAC address management Pascal Mazon
2017-03-15 14:48       ` Pascal Mazon [this message]
2017-03-15 14:48       ` [dpdk-dev] [PATCH v5 5/8] net/tap: add speed capabilities Pascal Mazon
2017-03-15 14:48       ` [dpdk-dev] [PATCH v5 6/8] net/tap: add multicast addresses management Pascal Mazon
2017-03-15 14:48       ` [dpdk-dev] [PATCH v5 7/8] net/tap: add packet type management Pascal Mazon
2017-03-15 14:48       ` [dpdk-dev] [PATCH v5 8/8] net/tap: add flow control management Pascal Mazon
2017-03-15 16:46       ` [dpdk-dev] [PATCH v5 0/8] net/tap: add additional management ops Ferruh Yigit
2017-03-15 21:44         ` Wiles, Keith
2017-03-07 16:31   ` [dpdk-dev] [PATCH v3 1/6] net/tap: add MAC address " Pascal Mazon
2017-03-09 14:05     ` Ferruh Yigit
2017-03-10  9:01       ` Pascal Mazon
2017-03-07 16:31   ` [dpdk-dev] [PATCH v3 2/6] net/tap: add speed capabilities Pascal Mazon
2017-03-09 14:18     ` Ferruh Yigit
2017-03-09 14:36       ` Wiles, Keith
2017-03-09 16:05         ` Ferruh Yigit
2017-03-10  9:03           ` Pascal Mazon
2017-03-10  9:11             ` Pascal Mazon
2017-03-07 16:31   ` [dpdk-dev] [PATCH v3 3/6] net/tap: add multicast addresses management Pascal Mazon
2017-03-07 16:31   ` [dpdk-dev] [PATCH v3 4/6] net/tap: add MTU management Pascal Mazon
2017-03-07 16:31   ` [dpdk-dev] [PATCH v3 5/6] net/tap: add packet type management Pascal Mazon
2017-03-09 14:26     ` Ferruh Yigit
2017-03-10 12:34       ` Pascal Mazon
2017-03-07 16:31   ` [dpdk-dev] [PATCH v3 6/6] net/tap: add flow control management Pascal Mazon

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=ede6f0f5ba9d470962477fb433c35c4ddec873eb.1489589167.git.pascal.mazon@6wind.com \
    --to=pascal.mazon@6wind.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=keith.wiles@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).