From: Pascal Mazon <pascal.mazon@6wind.com>
To: keith.wiles@intel.com
Cc: dev@dpdk.org, Pascal Mazon <pascal.mazon@6wind.com>
Subject: [dpdk-dev] [PATCH v3 4/4] net/tap: set MTU on the remote
Date: Wed, 8 Mar 2017 11:06:47 +0100 [thread overview]
Message-ID: <23f0a8ec6f15c87e0fbc2956e07a2cd2a7202498.1488967463.git.pascal.mazon@6wind.com> (raw)
In-Reply-To: <cover.1488967463.git.pascal.mazon@6wind.com>
Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
---
drivers/net/tap/rte_eth_tap.c | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 05ed0a131d63..9edf6b355a47 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -839,9 +839,8 @@ tap_set_mc_addr_list(struct rte_eth_dev *dev __rte_unused,
}
static int
-tap_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
+tap_netdev_mtu_set(const char *iface, uint16_t mtu)
{
- struct pmd_internals *pmd = dev->data->dev_private;
struct ifreq ifr;
int err, s;
@@ -849,15 +848,15 @@ tap_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
if (s < 0) {
RTE_LOG(ERR, PMD,
"Unable to get a socket for %s to set flags: %s\n",
- pmd->name, strerror(errno));
+ iface, strerror(errno));
return -1;
}
memset(&ifr, 0, sizeof(ifr));
- snprintf(ifr.ifr_name, IFNAMSIZ, "%s", pmd->name);
+ snprintf(ifr.ifr_name, IFNAMSIZ, "%s", iface);
err = ioctl(s, SIOCGIFMTU, &ifr);
if (err < 0) {
RTE_LOG(WARNING, PMD, "Unable to get %s device MTU: %s\n",
- pmd->name, strerror(errno));
+ iface, strerror(errno));
close(s);
return -1;
}
@@ -865,11 +864,29 @@ tap_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
err = ioctl(s, SIOCSIFMTU, &ifr);
if (err < 0) {
RTE_LOG(WARNING, PMD, "Unable to set %s mtu %d: %s\n",
- pmd->name, mtu, strerror(errno));
+ iface, mtu, strerror(errno));
close(s);
return -1;
}
close(s);
+ return 0;
+}
+
+static int
+tap_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
+{
+ struct pmd_internals *pmd = dev->data->dev_private;
+ int err;
+
+ /* First try to set mtu on the remote */
+ if (pmd->remote_if_index) {
+ err = tap_netdev_mtu_set(pmd->remote_iface, mtu);
+ if (err < 0)
+ return err;
+ }
+ err = tap_netdev_mtu_set(pmd->name, mtu);
+ if (err < 0)
+ return err;
dev->data->mtu = mtu;
return 0;
}
--
2.8.0.rc0
next prev parent reply other threads:[~2017-03-08 10:07 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-03 12:27 [dpdk-dev] [PATCH 0/4] net/tap: remote netdevice traffic capture Pascal Mazon
2017-03-03 12:27 ` [dpdk-dev] [PATCH 1/4] net/tap: add " Pascal Mazon
2017-03-03 12:27 ` [dpdk-dev] [PATCH 2/4] net/tap: reflect tap flags on the remote Pascal Mazon
2017-03-03 12:27 ` [dpdk-dev] [PATCH 3/4] net/tap: use the remote MAC address if available Pascal Mazon
2017-03-03 12:27 ` [dpdk-dev] [PATCH 4/4] net/tap: set MTU on the remote Pascal Mazon
2017-03-03 15:54 ` [dpdk-dev] [PATCH 0/4] net/tap: remote netdevice traffic capture Wiles, Keith
2017-03-07 16:38 ` [dpdk-dev] [PATCH v2 0/4] " Pascal Mazon
2017-03-07 16:38 ` [dpdk-dev] [PATCH v2 1/4] net/tap: add " Pascal Mazon
2017-03-07 16:38 ` [dpdk-dev] [PATCH v2 2/4] net/tap: reflect tap flags on the remote Pascal Mazon
2017-03-07 16:38 ` [dpdk-dev] [PATCH v2 3/4] net/tap: use the remote MAC address if available Pascal Mazon
2017-03-07 16:38 ` [dpdk-dev] [PATCH v2 4/4] net/tap: set MTU on the remote Pascal Mazon
2017-03-08 10:06 ` [dpdk-dev] [PATCH v3 0/4] net/tap: remote netdevice traffic capture Pascal Mazon
2017-03-08 10:06 ` [dpdk-dev] [PATCH v3 1/4] net/tap: add " Pascal Mazon
2017-03-08 10:06 ` [dpdk-dev] [PATCH v3 2/4] net/tap: reflect tap flags on the remote Pascal Mazon
2017-03-08 10:06 ` [dpdk-dev] [PATCH v3 3/4] net/tap: use the remote MAC address if available Pascal Mazon
2017-03-08 10:06 ` Pascal Mazon [this message]
2017-03-14 8:34 ` [dpdk-dev] [PATCH v4] net/tap: remote netdevice traffic capture Pascal Mazon
2017-03-14 8:34 ` [dpdk-dev] [PATCH v4] net/tap: add " Pascal Mazon
2017-03-14 14:00 ` Wiles, Keith
2017-03-15 15:03 ` [dpdk-dev] [PATCH v5] net/tap: " Pascal Mazon
2017-03-15 15:03 ` [dpdk-dev] [PATCH v5] net/tap: add " Pascal Mazon
2017-03-23 8:42 ` [dpdk-dev] [PATCH v6 0/1] net/tap: " Pascal Mazon
2017-03-23 8:42 ` [dpdk-dev] [PATCH v6 1/1] net/tap: add " Pascal Mazon
2017-03-24 15:48 ` Ferruh Yigit
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=23f0a8ec6f15c87e0fbc2956e07a2cd2a7202498.1488967463.git.pascal.mazon@6wind.com \
--to=pascal.mazon@6wind.com \
--cc=dev@dpdk.org \
--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).