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] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 26 Aug 2010 08:40:22 -0700
From:	Stephen Hemminger <shemminger@...tta.com>
To:	Masayuki Ohtake <masa-korg@....okisemi.com>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	ML netdev <netdev@...r.kernel.org>,
	Greg Rose <gregory.v.rose@...el.com>,
	Maxime Bizon <mbizon@...ebox.fr>,
	Kristoffer Glembo <kristoffer@...sler.com>,
	Ralf Baechle <ralf@...ux-mips.org>,
	John Linn <john.linn@...inx.com>,
	Randy Dunlap <randy.dunlap@...cle.com>,
	"David S. Miller" <davem@...emloft.net>,
	MeeGo <meego-dev@...go.com>, "Wang, Qi" <qi.wang@...el.com>,
	"Wang, Yong Y" <yong.y.wang@...el.com>,
	Andrew <andrew.chih.howe.khor@...el.com>,
	Intel OTC <joel.clark@...el.com>,
	"Foster, Margie" <margie.foster@...el.com>,
	Toshiharu Okada <okada533@....okisemi.com>,
	Tomoya Morinaga <morinaga526@....okisemi.com>,
	Takahiro Shimizu <shimizu394@....okisemi.com>
Subject: Re: [PATCH] Gigabit Ethernet driver of Topcliff PCH

On Thu, 26 Aug 2010 18:56:55 +0900
Masayuki Ohtake <masa-korg@....okisemi.com> wrote:

> +static int pch_gbe_get_settings(struct net_device *netdev,
> +				 struct ethtool_cmd *ecmd)
> +{
> +	struct pch_gbe_adapter *adapter = netdev_priv(netdev);
> +	int ret;
> +
> +	PCH_GBE_DEBUG("ethtool: %s\n", __func__);
> +
> +	ret = mii_ethtool_gset(&adapter->mii, ecmd);
> +	ecmd->supported &= (u32) (~SUPPORTED_TP);
> +	ecmd->supported &= (u32) (~SUPPORTED_1000baseT_Half);
> +	ecmd->advertising &= (u32) (~ADVERTISED_TP);
> +	ecmd->advertising &= (u32) (~ADVERTISED_1000baseT_Half);
> +
> +	if (netif_carrier_ok(adapter->netdev)) {
> +		;
> +	} else {
> +		ecmd->speed = 0xFFFF;
> +		ecmd->duplex = 0xFF;
> +	}
> +	return ret;
> +}

No need for cast to u32 on the masking:
        ecmd->supported &= ~(SUPPORTED_TP | SUPPORTED_1000baseT_Half);
	ecmd->advertising &= ~(ADVERTISED_TP | ADVERTISED_1000baseT_Half);



Awkward use of if, and don't set other bits in duplex
       if (!netif_carrier_ok(adapter->netdev))
                ecmd->speed = -1;
            

-- 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ