netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxim Mikityanskiy <maximmi@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>,
	Michal Kubecek <mkubecek@suse.cz>, Andrew Lunn <andrew@lunn.ch>
Cc: Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, Maxim Mikityanskiy <maximmi@mellanox.com>
Subject: [PATCH ethtool 1/2] netlink: Fix the condition for displaying actual changes
Date: Fri, 14 Aug 2020 16:17:44 +0300	[thread overview]
Message-ID: <20200814131745.32215-2-maximmi@mellanox.com> (raw)
In-Reply-To: <20200814131745.32215-1-maximmi@mellanox.com>

This comment in the code:

    /* result is not exactly as requested, show differences */

implies that the "Actual changes" output should be displayed only if the
result is not as requested, which matches the legacy ethtool behavior.
However, in fact, ethtool-netlink displays "actual changes" even when
the changes are expected (e.g., one bit was requested, and it was
changed as requested).

This commit fixes the condition above to make the behavior match the
description in the comment and the behavior of the legacy ethtool. The
new condition excludes the req_mask bits from active_mask to avoid
reacting on bit changes that we asked for. The new condition now
matches the ifs in the loop above that print "[requested on/off]" and
"[not requested]".

Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com>
---
 netlink/features.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/netlink/features.c b/netlink/features.c
index 8b5b858..133529d 100644
--- a/netlink/features.c
+++ b/netlink/features.c
@@ -413,7 +413,7 @@ static void show_feature_changes(struct nl_context *nlctx,
 
 	diff = false;
 	for (i = 0; i < words; i++)
-		if (wanted_mask[i] || active_mask[i])
+		if (wanted_mask[i] || (active_mask[i] & ~sfctx->req_mask[i]))
 			diff = true;
 	if (!diff)
 		return;
-- 
2.21.0


  reply	other threads:[~2020-08-14 13:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-14 13:17 [PATCH ethtool 0/2] ethtool-netlink compatibility fixes Maxim Mikityanskiy
2020-08-14 13:17 ` Maxim Mikityanskiy [this message]
2020-08-23 15:55   ` [PATCH ethtool 1/2] netlink: Fix the condition for displaying actual changes Michal Kubecek
2020-08-14 13:17 ` [PATCH ethtool 2/2] netlink: Print and return an error when features weren't changed Maxim Mikityanskiy
2020-08-23 16:03   ` Michal Kubecek

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=20200814131745.32215-2-maximmi@mellanox.com \
    --to=maximmi@mellanox.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.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).