DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
To: dev@dpdk.org
Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Subject: [dpdk-dev] [PATCH 2/7] mlx: ensure MTU update is effective
Date: Wed,  8 Jun 2016 11:43:26 +0200	[thread overview]
Message-ID: <1465379011-24646-3-git-send-email-nelio.laranjeiro@6wind.com> (raw)
In-Reply-To: <1465379011-24646-1-git-send-email-nelio.laranjeiro@6wind.com>

From: Adrien Mazarguil <adrien.mazarguil@6wind.com>

There is no guarantee that the new MTU is effective after writing its value
to sysfs. Retrieve it to be sure.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 drivers/net/mlx4/mlx4.c        | 10 +++++++++-
 drivers/net/mlx5/mlx5_ethdev.c | 10 +++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 661c49f..6174e4b 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -659,7 +659,15 @@ priv_get_mtu(struct priv *priv, uint16_t *mtu)
 static int
 priv_set_mtu(struct priv *priv, uint16_t mtu)
 {
-	return priv_set_sysfs_ulong(priv, "mtu", mtu);
+	uint16_t new_mtu;
+
+	if (priv_set_sysfs_ulong(priv, "mtu", mtu) ||
+	    priv_get_mtu(priv, &new_mtu))
+		return -1;
+	if (new_mtu == mtu)
+		return 0;
+	errno = EINVAL;
+	return -1;
 }
 
 /**
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 36b369e..25926cb 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -398,7 +398,15 @@ priv_get_mtu(struct priv *priv, uint16_t *mtu)
 static int
 priv_set_mtu(struct priv *priv, uint16_t mtu)
 {
-	return priv_set_sysfs_ulong(priv, "mtu", mtu);
+	uint16_t new_mtu;
+
+	if (priv_set_sysfs_ulong(priv, "mtu", mtu) ||
+	    priv_get_mtu(priv, &new_mtu))
+		return -1;
+	if (new_mtu == mtu)
+		return 0;
+	errno = EINVAL;
+	return -1;
 }
 
 /**
-- 
2.1.4

  parent reply	other threads:[~2016-06-08  9:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-08  9:43 [dpdk-dev] [PATCH 0/7] Miscellaneous fixes for mlx4 and mlx5 Nelio Laranjeiro
2016-06-08  9:43 ` [dpdk-dev] [PATCH 1/7] mlx: remove unused memory region property Nelio Laranjeiro
2016-06-08  9:43 ` Nelio Laranjeiro [this message]
2016-06-08  9:43 ` [dpdk-dev] [PATCH 3/7] mlx: retrieve mbuf size through proper API Nelio Laranjeiro
2016-06-08  9:43 ` [dpdk-dev] [PATCH 4/7] mlx5: fix RX VLAN stripping capability check Nelio Laranjeiro
2016-06-08  9:43 ` [dpdk-dev] [PATCH 5/7] mlx5: cosmetic changes (coding style) Nelio Laranjeiro
2016-06-08  9:43 ` [dpdk-dev] [PATCH 6/7] mlx5: enhance SR-IOV detection Nelio Laranjeiro
2016-06-08  9:43 ` [dpdk-dev] [PATCH 7/7] mlx5: update documentation part related to features and limitations Nelio Laranjeiro
2016-06-08 16:39   ` Mcnamara, John
2016-06-13 16:04 ` [dpdk-dev] [PATCH 0/7] Miscellaneous fixes for mlx4 and mlx5 Bruce Richardson

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=1465379011-24646-3-git-send-email-nelio.laranjeiro@6wind.com \
    --to=nelio.laranjeiro@6wind.com \
    --cc=adrien.mazarguil@6wind.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
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).