lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20161114140303.GM26710@lunn.ch>
Date:   Mon, 14 Nov 2016 15:03:03 +0100
From:   Andrew Lunn <andrew@...n.ch>
To:     "Allan W. Nielsen" <allan.nielsen@...rosemi.com>
Cc:     netdev@...r.kernel.org, raju.lakkaraju@...rosemi.com
Subject: Re: [PATCH ethtool v2 2/2] Ethtool: Implements
 ETHTOOL_PHY_GTUNABLE/ETHTOOL_PHY_STUNABLE and PHY downshift

> +.B \-\-get\-phy\-tunable
> +Gets the PHY tunable parameters.
> +.RS 4
> +.TP
> +.B downshift
> +For operation in cabling environments that are incompatible with 1000BAST-T,

BASE

> +PHY device provides an automatic link speed downshift operation.
> +Link speed downshift after N failed 1000BASE-T auto-negotiation attempts.
> +
> +Gets the PHY downshift count/status.
> +.RE
>  .SH BUGS
>  Not supported (in part or whole) on all network drivers.
>  .SH AUTHOR
> diff --git a/ethtool.c b/ethtool.c
> index 49ac94e..3b7ea4e 100644
> --- a/ethtool.c
> +++ b/ethtool.c
> @@ -4520,6 +4520,146 @@ static int do_seee(struct cmd_context *ctx)
>  	return 0;
>  }
>  
> +static int do_get_phy_tunable(struct cmd_context *ctx)
> +{
> +	int argc = ctx->argc;
> +	char **argp = ctx->argp;
> +	int err, i;
> +	u8 downshift_changed = 0;
> +
> +	if (argc < 1)
> +		exit_bad_args();
> +	for (i = 0; i < argc; i++) {
> +		if (!strcmp(argp[i], "downshift")) {
> +			downshift_changed = 1;
> +			i += 1;
> +		} else  {
> +			exit_bad_args();
> +		}
> +	}
> +
> +	if (downshift_changed) {
> +		struct ethtool_tunable ds;
> +		u8 count = 0;
> +
> +		ds.cmd = ETHTOOL_PHY_GTUNABLE;
> +		ds.id = ETHTOOL_PHY_DOWNSHIFT;
> +		ds.type_id = ETHTOOL_TUNABLE_U8;
> +		ds.len = 1;
> +		ds.data[0] = &count;
> +		err = send_ioctl(ctx, &ds);
> +		if (err < 0) {
> +			perror("Cannot Get PHY downshift count");
> +			err = 87;
> +		}
> +		count = *((u8 *)&ds.data[0]);
> +		if (count)
> +			fprintf(stdout, "  Downshift count: %d\n",
> +				count);
> +		else
> +			fprintf(stdout, " Downshift disabled\n");

Please be consistent with the spaces.

Also, if send_ioctl() returns an error, you print the error message,
and then still print the value of count. You look to be missing a
return or an else.

       Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ