From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id C2E822C06 for ; Mon, 4 Jul 2016 10:25:20 +0200 (CEST) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 4DBFB27DBE; Mon, 4 Jul 2016 10:25:20 +0200 (CEST) From: Olivier Matz To: adrien.mazarguil@6wind.com, dev@dpdk.org Cc: bruce.richardson@intel.com, fengtian.guo@6wind.com Date: Mon, 4 Jul 2016 10:24:17 +0200 Message-Id: <1467620659-23122-2-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1467620659-23122-1-git-send-email-olivier.matz@6wind.com> References: <1467620659-23122-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH 1/3] net/mlx: fix setting of interface flags 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: Mon, 04 Jul 2016 08:25:20 -0000 According to the documentation, the function priv_set_flags(priv, keep, flags) should not modify the flags in "keep" mask. So 'flags' argument should be masked with '~keep' before ORing it with the previous flags value. This avoids to mess the kernel interface flags when calling priv_set_flags(priv, ~IFF_UP, ~IFF_UP) in priv_set_link(): $ ip link 26: eth0: BROADCAST,MULTICAST,NOARP,ALLMULTI,PROMISC,DEBUG,\ DYNAMIC,AUTOMEDIA,PORTSEL,NOTRAILERS Fixes: 7fae69eeff13 ("mlx4: new poll mode driver") Fixes: 771fa900b73a ("mlx5: introduce new driver for Mellanox ConnectX-4 adapters") Reported-by: Fengtian Guo Signed-off-by: Olivier Matz --- drivers/net/mlx4/mlx4.c | 2 +- drivers/net/mlx5/mlx5_ethdev.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index f8ed42b..1dd14f4 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -689,7 +689,7 @@ priv_set_flags(struct priv *priv, unsigned int keep, unsigned int flags) if (priv_get_sysfs_ulong(priv, "flags", &tmp) == -1) return -1; tmp &= keep; - tmp |= flags; + tmp |= (flags & (~keep)); return priv_set_sysfs_ulong(priv, "flags", tmp); } diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index 0e7ed01..6fef902 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -461,7 +461,7 @@ priv_set_flags(struct priv *priv, unsigned int keep, unsigned int flags) if (priv_get_sysfs_ulong(priv, "flags", &tmp) == -1) return -1; tmp &= keep; - tmp |= flags; + tmp |= (flags & (~keep)); return priv_set_sysfs_ulong(priv, "flags", tmp); } -- 2.8.1