From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by dpdk.org (Postfix) with ESMTP id 63A619ABA for ; Wed, 8 Jun 2016 11:44:39 +0200 (CEST) Received: by mail-wm0-f47.google.com with SMTP id n184so173043896wmn.1 for ; Wed, 08 Jun 2016 02:44:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pBXbSTWrzHYTzQLeieyy9NNL2idX+QEHqRmsCCs/6f4=; b=ajqw76C6cQmWPgRex6vhNRoqB4FQE00M5cn6FH6mk2IJJ3M2IO0KrjKjODRq/e6Q9Q 9kB0K8Jy9qDMJZVXmg8Sba9IBT4+9ZVwL1u4YwP6uw66U9vkjRsuJuy9Rb8emPmdjHwn 2P7BC4xV6KcJbnmzSk8D80AfMhhorh3M+V1KHZG3Bx30gGjogLX3SoP4f7OXjBF9FZ+Y wHnhUmzq83T3P6cEmpO+H9hi4IHQ1/o+MeQhpsCSMWh/wZfJXilwUxupPzQ68S5POKRf QvN7YgodkBggwAZmTs5jxjio7ogW4RoYAn2ZCf1oh3Z6W+bq9eNPCwh9a/+7bnJDsVKn AFew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pBXbSTWrzHYTzQLeieyy9NNL2idX+QEHqRmsCCs/6f4=; b=Qip25yTaR3D/jt3TVYTsdN6O8V2uBJsNEVVWaTqsCUWnuncp1//J/w0ZN2FDaLy8Wg Hn5VXmQj0ROPCMM0Rdtcq87TnczV1q62exGXN+FJOoTNrH/COoEQaqHPBZc1khCWE9Hy fM1ly8bJ3Xh8UXEM80MwcuNzUk9FMHdW00r7+zkq1GjJ7q12TPxrJc9WpUPP7dRZRhQH 5dQfNHZG2PDFA/HmhVphYevTsF1b1pHFrXUPYb6jc9H2H15HJRRIMqDUPTT6p1vSLe0b LHYAWYJWJNdWKAwUoMDqq04M8o+fNatVqr2wjAH6FdTDOyQl6aTaOQ+Je4Z2urPgSClE x6KA== X-Gm-Message-State: ALyK8tLQqbSqn5W1+ufWs2oywREZVqq6n2pYwwj9wHKixiAi4R05oDDEC/UzfGj/PyU/BIWk X-Received: by 10.28.142.82 with SMTP id q79mr7262755wmd.88.1465379078924; Wed, 08 Jun 2016 02:44:38 -0700 (PDT) Received: from ping.vm.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id xw8sm479085wjb.30.2016.06.08.02.44.38 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 08 Jun 2016 02:44:38 -0700 (PDT) From: Nelio Laranjeiro To: dev@dpdk.org Cc: Adrien Mazarguil Date: Wed, 8 Jun 2016 11:43:26 +0200 Message-Id: <1465379011-24646-3-git-send-email-nelio.laranjeiro@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1465379011-24646-1-git-send-email-nelio.laranjeiro@6wind.com> References: <1465379011-24646-1-git-send-email-nelio.laranjeiro@6wind.com> Subject: [dpdk-dev] [PATCH 2/7] mlx: ensure MTU update is effective X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jun 2016 09:44:39 -0000 From: Adrien Mazarguil 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 --- 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