netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: Amir Vadai <amirv@mellanox.com>
Cc: netdev@vger.kernel.org, Or Gerlitz <ogerlitz@mellanox.com>,
	Yevgeny Petrilin <yevgenyp@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>,
	Eyal Perry <eyalpe@mellanox.com>,
	Eyal Grossman <eyalgr@mellanox.com>
Subject: Re: [PATCH ethtool 3/5] ethtool: Return bad status when send_ioctl fails
Date: Sun, 05 Apr 2015 02:48:56 +0100	[thread overview]
Message-ID: <1428198536.11260.128.camel@decadent.org.uk> (raw)
In-Reply-To: <1422193883-30504-4-git-send-email-amirv@mellanox.com>

[-- Attachment #1: Type: text/plain, Size: 1354 bytes --]

On Sun, 2015-01-25 at 15:51 +0200, Amir Vadai wrote:
> From: Eyal Grossman <eyalgr@mellanox.com>
> 
> Added to ethtool return code(rc != 0) when an error occurs after send_ioctl has fails.
> 
> Signed-off-by: Eyal Grossman <eyalgr@mellanox.com>
> Signed-off-by: Amir Vadai <amirv@mellanox.com>

I wish we could do this, but it's been returning 0 on failure for as
long as git history lasts (10 years) and I would expect this change to
break some scripts.

Maybe we could provide some way to opt-in to this behaviour?

[..]
> @@ -2654,17 +2661,20 @@ static int do_sset(struct cmd_context *ctx)
>  		err = send_ioctl(ctx, &edata);
>  		if (err < 0) {
>  			perror("Cannot get msglvl");
> +			status += err;
>  		} else {
>  			edata.cmd = ETHTOOL_SMSGLVL;
>  			edata.data = ((edata.data & ~msglvl_mask) |
>  				      msglvl_wanted);
>  			err = send_ioctl(ctx, &edata);
> -			if (err < 0)
> +			if (err < 0) {
>  				perror("Cannot set new msglvl");
> +				status += err;
> +			}
>  		}
>  	}
>  
> -	return 0;
> +	return status;

This is going to be a negative number on error, which is not a valid
exit code.  We should generally return 1 on error.

Ben.

>  }
>  
>  static int do_gregs(struct cmd_context *ctx)

-- 
Ben Hutchings
Quantity is no substitute for quality, but it's the only one we've got.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

  reply	other threads:[~2015-04-05  1:49 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-25 13:51 [PATCH ethtool 0/5] RSS improvements + new speeds Amir Vadai
2015-01-25 13:51 ` [PATCH ethtool 1/5] ethtool-copy.h: sync with net Amir Vadai
2015-04-05  1:00   ` Ben Hutchings
2015-04-08 18:40     ` Amir Vadai
2015-04-14 14:34     ` Amir Vadai
2015-04-14 14:58       ` Ben Hutchings
2015-01-25 13:51 ` [PATCH ethtool 2/5] ethtool: Add missing Advertised speeds Amir Vadai
2015-04-05  1:37   ` Ben Hutchings
2015-04-05  2:13     ` Ben Hutchings
2015-04-05  2:29     ` Ben Hutchings
2015-01-25 13:51 ` [PATCH ethtool 3/5] ethtool: Return bad status when send_ioctl fails Amir Vadai
2015-04-05  1:48   ` Ben Hutchings [this message]
2015-01-25 13:51 ` [PATCH ethtool 4/5] ethtool: Prettify RX flow hash indirection table print Amir Vadai
2015-04-05  2:00   ` Ben Hutchings
2015-04-05  2:14     ` [PATCH ethtool] Fix formatting of RX flow hash indirection table when size % 8 != 0 Ben Hutchings
2015-04-19 10:40       ` Amir Vadai
2015-01-25 13:51 ` [PATCH ethtool 5/5] ethtool: Support for configurable RSS hash function Amir Vadai
2015-04-05  2:55   ` Ben Hutchings
2015-04-14 15:37     ` Amir Vadai
2015-03-19 14:17 ` [PATCH ethtool 0/5] RSS improvements + new speeds Or Gerlitz
2015-03-26  9:56   ` Amir Vadai

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=1428198536.11260.128.camel@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=amirv@mellanox.com \
    --cc=eyalgr@mellanox.com \
    --cc=eyalpe@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=saeedm@mellanox.com \
    --cc=yevgenyp@mellanox.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).