[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1371818385.8771.21.camel@deadeye.wl.decadent.org.uk>
Date: Fri, 21 Jun 2013 13:39:45 +0100
From: Ben Hutchings <ben@...adent.org.uk>
To: Johannes Berg <johannes@...solutions.net>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH 6/6] alx: fix ethtool support code
On Fri, 2013-06-21 at 00:14 +0200, Johannes Berg wrote:
> A number of places treated features wrongly, listing not-supported
> features instead of supported ones. Also, the get_drvinfo ethtool
> callback isn't needed, and alx_get_pauseparam can be simplified.
>
> Reported-by: Ben Hutchings <ben@...adent.org.uk>
> Signed-off-by: Johannes Berg <johannes.berg@...el.com>
> ---
> drivers/net/ethernet/atheros/alx/ethtool.c | 62 +++++++++++++-----------------
> 1 file changed, 26 insertions(+), 36 deletions(-)
>
> diff --git a/drivers/net/ethernet/atheros/alx/ethtool.c b/drivers/net/ethernet/atheros/alx/ethtool.c
> index 2170b61..0f4c79e 100644
> --- a/drivers/net/ethernet/atheros/alx/ethtool.c
> +++ b/drivers/net/ethernet/atheros/alx/ethtool.c
> @@ -46,22 +46,35 @@
> #include "reg.h"
> #include "hw.h"
>
> +static u32 alx_get_supported_speeds(struct alx_hw *hw)
> +{
> + u32 supported = SUPPORTED_10baseT_Half |
> + SUPPORTED_10baseT_Full |
> + SUPPORTED_100baseT_Half |
> + SUPPORTED_100baseT_Full;
> +
> + if (alx_hw_giga(hw))
> + supported |= SUPPORTED_1000baseT_Full;
> +
> + BUILD_BUG_ON(SUPPORTED_10baseT_Half != ADVERTISED_10baseT_Half);
> + BUILD_BUG_ON(SUPPORTED_10baseT_Full != ADVERTISED_10baseT_Full);
> + BUILD_BUG_ON(SUPPORTED_100baseT_Half != ADVERTISED_100baseT_Half);
> + BUILD_BUG_ON(SUPPORTED_100baseT_Full != ADVERTISED_100baseT_Full);
> + BUILD_BUG_ON(SUPPORTED_1000baseT_Full != ADVERTISED_1000baseT_Full);
> +
> + return supported;
> +}
[...]
> @@ -102,7 +115,7 @@ static int alx_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
> ASSERT_RTNL();
>
> if (ecmd->autoneg == AUTONEG_ENABLE) {
> - if (ecmd->advertising & ADVERTISED_1000baseT_Half)
> + if (ecmd->advertising & ~alx_get_supported_speeds(hw))
[...]
This means that Pause/Asym_Pause advertising can't be directly
controlled. It's a pain to implement that properly, though, so I
suppose this can be deferred.
Ben.
--
Ben Hutchings
Klipstein's 4th Law of Prototyping and Production:
A fail-safe circuit will destroy others.
Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)
Powered by blists - more mailing lists