Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH v2 net-next] net: phy: improve definition of __ETHTOOL_LINK_MODE_MASK_NBITS
From: David Miller @ 2019-02-25  1:34 UTC (permalink / raw)
  To: hkallweit1; +Cc: andrew, f.fainelli, netdev
In-Reply-To: <3ae0478b-810f-904e-e128-7e0a57c7255c@gmail.com>

From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Fri, 22 Feb 2019 19:25:59 +0100

> The way to define __ETHTOOL_LINK_MODE_MASK_NBITS seems to be overly
> complicated, go with a standard approach instead.
> Whilst we're at it, move the comment to the right place.
> 
> v2:
> - rebased
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Applied, thanks Heiner.

^ permalink raw reply

* Re: [PATCH] net: dsa: lantiq: Add GPHY firmware files
From: David Miller @ 2019-02-25  1:35 UTC (permalink / raw)
  To: hauke; +Cc: netdev
In-Reply-To: <20190222191113.28167-1-hauke@hauke-m.de>

From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Fri, 22 Feb 2019 20:11:13 +0100

> This adds the file names of the FW files which this driver handles into
> the module description.
> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

Applied.

^ permalink raw reply

* Re: [PATCH] net: lantiq: Do not use eth_change_mtu()
From: David Miller @ 2019-02-25  1:35 UTC (permalink / raw)
  To: hauke; +Cc: netdev
In-Reply-To: <20190222191257.28273-1-hauke@hauke-m.de>

From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Fri, 22 Feb 2019 20:12:57 +0100

> eth_change_mtu() is not needed any more, the networking subsystem will
> call it automatically when this callback is not implemented.
> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

Applied to net-next.

^ permalink raw reply

* Re: [PATCH v2 bpf-next 0/9] bpf: Network Resource Manager (NRM)
From: David Ahern @ 2019-02-25  1:38 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: Eric Dumazet, brakmo, netdev, Martin Lau, Alexei Starovoitov,
	Daniel Borkmann, Kernel Team
In-Reply-To: <20190224044815.nqfr6szce7j7g3za@ast-mbp.dhcp.thefacebook.com>

On 2/23/19 11:48 PM, Alexei Starovoitov wrote:
> 'network resources' also include back bone and TOR capacity and
> this mechanism is going to help address that as well.

This appears to be the talk you are referring to:

http://vger.kernel.org/lpc_net2018_talks/LPC%20NRM.pdf

and from my reading it only references throttling at L4 - ie.,
bandwidth. hence my request for a better name than 'network resources'
in the commit logs and code references.

^ permalink raw reply

* Re: [PATCH net-next 0/2] net: switchdev.h inclusion removal
From: David Miller @ 2019-02-25  1:43 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev
In-Reply-To: <20190222203134.19508-1-f.fainelli@gmail.com>

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Fri, 22 Feb 2019 12:31:32 -0800

> This targets a few drivers that no longer to have net/switchdev.h
> included.

Series applied.

^ permalink raw reply

* Re: [PATCH net-next] net: phy: check PMAPMD link status only in genphy_c45_read_link
From: David Miller @ 2019-02-25  1:43 UTC (permalink / raw)
  To: hkallweit1; +Cc: andrew, f.fainelli, netdev
In-Reply-To: <9c7b68ea-ac30-a7ec-1c88-ae819dbbb7b4@gmail.com>

From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Fri, 22 Feb 2019 22:59:38 +0100

> The current code reports a link as up if all devices (except a few
> blacklisted ones) report the link as up. This breaks Aquantia AQCS109
> for lower speeds because on this PHY the PCS link status reflects a
> 10G link only. For Marvell there's a similar issue, therefore PHYXS
> device isn't checked.
> 
> There may be more PHYs where depending on the mode the link status
> of only selected devices is relevant.
> 
> For now it seems to be sufficient to check the link status of the
> PMAPMD device only. Leave the loop in the code to be prepared in
> case we have to add functionality to check more than one device,
> depending on the mode.
> 
> Successfully tested on a board with an AQCS109.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next v3 0/6] devlink: make ethtool compat reliable
From: David Miller @ 2019-02-25  1:43 UTC (permalink / raw)
  To: jakub.kicinski; +Cc: jiri, mkubecek, andrew, f.fainelli, netdev, oss-drivers
In-Reply-To: <20190222220758.7117-1-jakub.kicinski@netronome.com>


Jakub please address the feedback you were given.

Thanks.

^ permalink raw reply

* [PATCH net-next] mlxsw: spectrum: remove set but not used variable 'autoneg_status'
From: YueHaibing @ 2019-02-25  2:03 UTC (permalink / raw)
  To: Jiri Pirko, Ido Schimmel, davem
  Cc: YueHaibing, netdev, kernel-janitors, linux-kernel

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/ethernet/mellanox/mlxsw/spectrum.c: In function 'mlxsw_sp_port_get_link_ksettings':
drivers/net/ethernet/mellanox/mlxsw/spectrum.c:3062:5: warning:
 variable 'autoneg_status' set but not used [-Wunused-but-set-variable]

It's not used since commit 475b33cb66c9 ("mlxsw: spectrum: Remove unsupported
eth_proto_lp_advertise field in PTYS")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 40177b9834c4..b00f6f74f91a 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -3059,7 +3059,6 @@ static int mlxsw_sp_port_get_link_ksettings(struct net_device *dev,
 	const struct mlxsw_sp_port_type_speed_ops *ops;
 	char ptys_pl[MLXSW_REG_PTYS_LEN];
 	u8 connector_type;
-	u8 autoneg_status;
 	bool autoneg;
 	int err;
 
@@ -3079,8 +3078,6 @@ static int mlxsw_sp_port_get_link_ksettings(struct net_device *dev,
 	mlxsw_sp_port_get_link_advertise(mlxsw_sp, eth_proto_admin, autoneg,
 					 cmd);
 
-	autoneg_status = mlxsw_reg_ptys_an_status_get(ptys_pl);
-
 	cmd->base.autoneg = autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE;
 	connector_type = mlxsw_reg_ptys_connector_type_get(ptys_pl);
 	cmd->base.port = mlxsw_sp_port_connector_port(connector_type);




^ permalink raw reply related

* Re: [PATCH net-next v3 3/6] nfp: add .ndo_get_devlink
From: Florian Fainelli @ 2019-02-25  2:05 UTC (permalink / raw)
  To: Jakub Kicinski, davem, jiri; +Cc: mkubecek, andrew, netdev, oss-drivers
In-Reply-To: <20190222220758.7117-4-jakub.kicinski@netronome.com>

Le 2/22/19 à 2:07 PM, Jakub Kicinski a écrit :
> Support getting devlink instance from a new NDO.
> 
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply

* Re: [PATCH net-next v3 4/6] nfp: remove ethtool flashing fallback
From: Florian Fainelli @ 2019-02-25  2:06 UTC (permalink / raw)
  To: Jakub Kicinski, davem, jiri; +Cc: mkubecek, andrew, netdev, oss-drivers
In-Reply-To: <20190222220758.7117-5-jakub.kicinski@netronome.com>

Le 2/22/19 à 2:07 PM, Jakub Kicinski a écrit :
> Now that devlink fallback will be called reliably, we can remove
> the ethtool flashing code.
> 
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply

* Re: [PATCH net-next v2 2/2] net: phy: aquantia: add hwmon support
From: Florian Fainelli @ 2019-02-25  2:17 UTC (permalink / raw)
  To: Heiner Kallweit, Andrew Lunn, David Miller; +Cc: netdev@vger.kernel.org
In-Reply-To: <2b46ac62-db6f-b72c-e81b-c6fbf063ab4b@gmail.com>

Le 2/24/19 à 1:36 PM, Heiner Kallweit a écrit :
> This adds HWMON support for the temperature sensor and the related
> alarms on the 107/108/109 chips. This patch is based on work from
> Nikita and Andrew. I added:
> - support for changing alarm thresholds via sysfs
> - move HWMON code to a separate source file to improve maintainability
> - smaller changes like using IS_REACHABLE instead of ifdef
>   (avoids problems if PHY driver is built in and HWMON is a module)
> 
> v2:
> - remove struct aqr_priv
> - rename header file to aquantia.h
> 
> Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>

Should not Nikita be the author for that patch? Some minor nits below:

> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/net/phy/Makefile         |   2 +-
>  drivers/net/phy/aquantia.h       |  16 ++
>  drivers/net/phy/aquantia_hwmon.c | 245 +++++++++++++++++++++++++++++++
>  drivers/net/phy/aquantia_main.c  |   4 +
>  4 files changed, 266 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/net/phy/aquantia.h
>  create mode 100644 drivers/net/phy/aquantia_hwmon.c
> 
> diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
> index b0845adaf..c48596626 100644
> --- a/drivers/net/phy/Makefile
> +++ b/drivers/net/phy/Makefile
> @@ -45,7 +45,7 @@ sfp-obj-$(CONFIG_SFP)		+= sfp-bus.o
>  obj-y				+= $(sfp-obj-y) $(sfp-obj-m)
>  
>  obj-$(CONFIG_AMD_PHY)		+= amd.o
> -aquantia-objs			+= aquantia_main.o
> +aquantia-objs			+= aquantia_main.o aquantia_hwmon.o

Since you are adding a stub if CONFIG_HWMON is not reachable, does not
that mean you would want to do something like:

ifdef CONFIG_HWMON
aquanti-objs	+= aquantia_hwmon.o
endif

in this makefile?

[snip]

> +static int aqr_hwmon_get(struct phy_device *phydev, int reg, long *value)
> +{
> +	int temp = phy_read_mmd(phydev, MDIO_MMD_VEND1, reg);
> +
> +	if (temp < 0)
> +		return temp;
> +
> +	/* register value is 2's complement with LSB = 1/256th degree Celsius */
> +	if (temp > 0x8000)
> +		temp -= 0x10000;

Would decimal or BIT() notation be easier to use/read here?

> +
> +	*value = temp * 1000 / 256;
> +
> +	return 0;
> +}
> +
> +static int aqr_hwmon_set(struct phy_device *phydev, int reg, long value)
> +{
> +	int temp;
> +
> +	if (value >= 128000 || value < -128000)
> +		return -ERANGE;
> +
> +	temp = value * 256 / 1000;
> +
> +	if (temp < 0)
> +		temp += 0x10000;

Likewise

> +
> +	return phy_write_mmd(phydev, MDIO_MMD_VEND1, reg, temp);
> +}
> +
> +static int aqr_hwmon_status1(struct phy_device *phydev, int bit, long *value)
> +{
> +	int reg = phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_GENERAL_STAT1);
> +
> +	if (reg < 0)
> +		return reg;
> +
> +	*value = !!(reg & bit);
> +
> +	return 0;
> +}

Can you also make this function take a register offset as parameter such
that you can eliminate open coding that in the case hwmon_temp_input below?

> +
> +static int aqr_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
> +			  u32 attr, int channel, long *value)
> +{
> +	struct phy_device *phydev = dev_get_drvdata(dev);
> +	int reg;
> +
> +	if (type != hwmon_temp)
> +		return -EOPNOTSUPP;
> +
> +	switch (attr) {
> +	case hwmon_temp_input:
> +		reg = phy_read_mmd(phydev, MDIO_MMD_VEND1,
> +				   VEND1_THERMAL_STAT2);
> +		if (reg < 0)
> +			return reg;
> +		if (!(reg & VEND1_THERMAL_STAT2_VALID))
> +			return -EIO;

And use that helper here.

> +
> +		return aqr_hwmon_get(phydev, VEND1_THERMAL_STAT1, value);
> +

[snip]

> +	hwmon_name = devm_kstrdup(dev, dev_name(dev), GFP_KERNEL);
> +	if (!hwmon_name)
> +		return -ENOMEM;
> +
> +	for (i = j = 0; hwmon_name[i]; i++) {
> +		if (isalnum(hwmon_name[i])) {
> +			if (i != j)
> +				hwmon_name[j] = hwmon_name[i];
> +			j++;
> +		}
> +	}
> +	hwmon_name[j] = '\0';

I am always baffled that drivers need to take care of these details...
but that seems to be the way to go.
-- 
Florian

^ permalink raw reply

* Re: [PATCH 1/3] net: ethernet: add support for PCS and 2.5G speed
From: Florian Fainelli @ 2019-02-25  2:31 UTC (permalink / raw)
  To: Parshuram Thombare, nicolas.ferre, davem, netdev, andrew,
	hkallweit1, linux-kernel, rafalc, piotrs, jank
In-Reply-To: <20190222201225.GA15633@lvlogina.cadence.com>

Le 2/22/19 à 12:12 PM, Parshuram Thombare a écrit :
> This patch add support for PCS (for SGMII interface) and 2.5Gbps MAC
> in Cadence ethernet controller driver.

At a high level you don't seem to be making use of PHYLINK so which
2.5Gbps interfaces do you actually support?

> 
> Signed-off-by: Parshuram Thombare <pthombar@cadence.com>
> ---

[snip]

> @@ -361,26 +361,50 @@ static int macb_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
>   * macb_set_tx_clk() - Set a clock to a new frequency
>   * @clk		Pointer to the clock to change
>   * @rate	New frequency in Hz
> + * @interafce	Phy interface

Typo: @interface and this is an unrelated change.

>   * @dev		Pointer to the struct net_device
>   */
> -static void macb_set_tx_clk(struct clk *clk, int speed, struct net_device *dev)
> +static void macb_set_tx_clk(struct clk *clk, int speed,
> +			    phy_interface_t interface, struct net_device *dev)
>  {
>  	long ferr, rate, rate_rounded;
>  
>  	if (!clk)
>  		return;
>  
> -	switch (speed) {
> -	case SPEED_10:
> +	if (interface == PHY_INTERFACE_MODE_GMII ||
> +	    interface == PHY_INTERFACE_MODE_MII) {
> +		switch (speed) {
> +		case SPEED_10:>  		rate = 2500000;

You need to add one tab to align rate and break.

>  		break;
> -	case SPEED_100:
> +		case SPEED_100:
>  		rate = 25000000;
>  		break;
> -	case SPEED_1000:
> +		case SPEED_1000:
>  		rate = 125000000;
>  		break;
> -	default:
> +		default:
> +		return;
> +		}
> +	} else if (interface == PHY_INTERFACE_MODE_SGMII) {
> +		switch (speed) {
> +		case SPEED_10:
> +		rate = 1250000;
> +		break;
> +		case SPEED_100:
> +		rate = 12500000;
> +		break;
> +		case SPEED_1000:
> +		rate = 125000000;
> +		break;
> +		case SPEED_2500:
> +		rate = 312500000;
> +		break;
> +		default:
> +		return;

The indentation is broken here and you can greatly simplify this with a
simple function that returns speed * 1250 and does an initial check for
unsupported speeds.

> +		}
> +	} else {
>  		return;
>  	}
>  
> @@ -410,30 +434,49 @@ static void macb_handle_link_change(struct net_device *dev)
>  
>  	spin_lock_irqsave(&bp->lock, flags);
>  
> -	if (phydev->link) {
> -		if ((bp->speed != phydev->speed) ||
> -		    (bp->duplex != phydev->duplex)) {
> -			u32 reg;
> -
> -			reg = macb_readl(bp, NCFGR);
> -			reg &= ~(MACB_BIT(SPD) | MACB_BIT(FD));
> -			if (macb_is_gem(bp))
> -				reg &= ~GEM_BIT(GBE);
> +	if (phydev->link && (bp->speed != phydev->speed ||
> +			     bp->duplex != phydev->duplex)) {
> +		u32 reg;
>  
> -			if (phydev->duplex)
> -				reg |= MACB_BIT(FD);
> +		reg = macb_readl(bp, NCFGR);
> +		reg &= ~(MACB_BIT(SPD) | MACB_BIT(FD));
> +		if (macb_is_gem(bp))
> +			reg &= ~GEM_BIT(GBE);
> +		if (phydev->duplex)
> +			reg |= MACB_BIT(FD);
> +		macb_or_gem_writel(bp, NCFGR, reg);
> +
> +		if (bp->phy_interface == PHY_INTERFACE_MODE_SGMII &&
> +		    (phydev->speed == SPEED_1000 ||
> +		     phydev->speed == SPEED_2500)) {
> +			if (bp->caps & MACB_CAPS_TWO_PT_FIVE_GIG_SPEED) {
> +				reg = gem_readl(bp, NCR) &
> +					~GEM_BIT(TWO_PT_FIVE_GIG);
> +				gem_writel(bp, NCR, reg);
> +			}

If you are making correct use of the capabilities then there is no point
in re-checking them here. If you allowed the MAC to advertise 2.5Gbps
then it is de-facto SGMII capable.

> +			gem_writel(bp, NCFGR, GEM_BIT(GBE) |
> +					gem_readl(bp, NCFGR));
> +			if (bp->caps & MACB_CAPS_TWO_PT_FIVE_GIG_SPEED &&
> +			    phydev->speed == SPEED_2500)
> +				gem_writel(bp, NCR, gem_readl(bp, NCR) |
> +						GEM_BIT(TWO_PT_FIVE_GIG));
> +		} else if (phydev->speed == SPEED_1000) {
> +			gem_writel(bp, NCFGR, GEM_BIT(GBE) |
> +					gem_readl(bp, NCFGR));
> +		} else {
> +			if (bp->phy_interface == PHY_INTERFACE_MODE_SGMII) {
> +				reg = gem_readl(bp, NCFGR);
> +				reg &= ~(GEM_BIT(SGMIIEN) | GEM_BIT(PCSSEL));
> +				gem_writel(bp, NCFGR, reg);
> +			}
>  			if (phydev->speed == SPEED_100)
> -				reg |= MACB_BIT(SPD);
> -			if (phydev->speed == SPEED_1000 &&
> -			    bp->caps & MACB_CAPS_GIGABIT_MODE_AVAILABLE)
> -				reg |= GEM_BIT(GBE);
> -
> -			macb_or_gem_writel(bp, NCFGR, reg);
> -
> -			bp->speed = phydev->speed;
> -			bp->duplex = phydev->duplex;
> -			status_change = 1;
> +				macb_writel(bp, NCFGR, MACB_BIT(SPD) |
> +					macb_readl(bp, NCFGR));
>  		}

There is a lot of repetition while setting the GBE bit which always set
based on speed == 1000 irrespective of the mode, so take that part out
of the if () else if () else () clauses.

> +
> +		bp->speed = phydev->speed;
> +		bp->duplex = phydev->duplex;
> +		status_change = 1;
>  	}
>  
>  	if (phydev->link != bp->link) {
> @@ -453,7 +496,8 @@ static void macb_handle_link_change(struct net_device *dev)
>  			/* Update the TX clock rate if and only if the link is
>  			 * up and there has been a link change.
>  			 */
> -			macb_set_tx_clk(bp->tx_clk, phydev->speed, dev);
> +			macb_set_tx_clk(bp->tx_clk, phydev->speed,
> +					bp->phy_interface, dev);
>  
>  			netif_carrier_on(dev);
>  			netdev_info(dev, "link up (%d/%s)\n",
> @@ -543,10 +587,16 @@ static int macb_mii_probe(struct net_device *dev)
>  	}
>  
>  	/* mask with MAC supported features */
> -	if (macb_is_gem(bp) && bp->caps & MACB_CAPS_GIGABIT_MODE_AVAILABLE)
> -		phy_set_max_speed(phydev, SPEED_1000);
> -	else
> -		phy_set_max_speed(phydev, SPEED_100);
> +	if (macb_is_gem(bp)) {

You have changed the previous logic that also checked for
MACB_CAPS_GIGABIT_MODE_AVAILABLE, why?

> +		linkmode_copy(phydev->supported, PHY_GBIT_FEATURES);
> +		if (bp->caps & MACB_CAPS_TWO_PT_FIVE_GIG_SPEED)
> +			linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
> +					 phydev->supported);
> +	} else {
> +		linkmode_copy(phydev->supported, PHY_BASIC_FEATURES);
> +	}
> +
> +	linkmode_copy(phydev->advertising, phydev->supported);
>  
>  	if (bp->caps & MACB_CAPS_NO_GIGABIT_HALF)
>  		phy_remove_link_mode(phydev,
> @@ -2217,8 +2267,6 @@ static void macb_init_hw(struct macb *bp)
>  	macb_set_hwaddr(bp);
>  
>  	config = macb_mdc_clk_div(bp);
> -	if (bp->phy_interface == PHY_INTERFACE_MODE_SGMII)
> -		config |= GEM_BIT(SGMIIEN) | GEM_BIT(PCSSEL);
>  	config |= MACB_BF(RBOF, NET_IP_ALIGN);	/* Make eth data aligned */
>  	config |= MACB_BIT(PAE);		/* PAuse Enable */
>  	config |= MACB_BIT(DRFCS);		/* Discard Rx FCS */
> @@ -3255,6 +3303,23 @@ static void macb_configure_caps(struct macb *bp,
>  		dcfg = gem_readl(bp, DCFG1);
>  		if (GEM_BFEXT(IRQCOR, dcfg) == 0)
>  			bp->caps |= MACB_CAPS_ISR_CLEAR_ON_WRITE;
> +		if (GEM_BFEXT(NO_PCS, dcfg) == 0)
> +			bp->caps |= MACB_CAPS_PCS;
> +		switch (MACB_BFEXT(IDNUM, macb_readl(bp, MID))) {
> +		case MACB_GEM7016_IDNUM:
> +		case MACB_GEM7017_IDNUM:
> +		case MACB_GEM7017A_IDNUM:
> +		case MACB_GEM7020_IDNUM:
> +		case MACB_GEM7021_IDNUM:
> +		case MACB_GEM7021A_IDNUM:
> +		case MACB_GEM7022_IDNUM:
> +		if (bp->caps & MACB_CAPS_PCS)
> +			bp->caps |= MACB_CAPS_TWO_PT_FIVE_GIG_SPEED;
> +		break;
> +
> +		default:
> +		break;
> +		}
>  		dcfg = gem_readl(bp, DCFG2);
>  		if ((dcfg & (GEM_BIT(RX_PKT_BUFF) | GEM_BIT(TX_PKT_BUFF))) == 0)
>  			bp->caps |= MACB_CAPS_FIFO_MODE;
> @@ -4110,7 +4175,28 @@ static int macb_probe(struct platform_device *pdev)
>  		else
>  			bp->phy_interface = PHY_INTERFACE_MODE_MII;
>  	} else {
> +		switch (err) {
> +		case PHY_INTERFACE_MODE_SGMII:
> +		if (bp->caps & MACB_CAPS_PCS) {
> +			bp->phy_interface = PHY_INTERFACE_MODE_SGMII;
> +			break;
> +		}

If SGMII was selected on a version of the IP that does not support it,
then falling back to GMII or MII does not sound correct, this is a hard
error that must be handled as such.
-- 
Florian

^ permalink raw reply

* [PATCH net-next] switchdev: Complete removal of switchdev_port_attr_get()
From: Florian Fainelli @ 2019-02-25  2:39 UTC (permalink / raw)
  To: netdev
  Cc: idosch, Florian Fainelli, Jiri Pirko, Ivan Vecera,
	David S. Miller, open list

We have no more in tree users of switchdev_port_attr_get() after
d0e698d57a94 ("Merge branch 'net-Get-rid-of-switchdev_port_attr_get'")
so completely remove the function signature and body.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 include/net/switchdev.h   |  4 ----
 net/switchdev/switchdev.c | 42 ---------------------------------------
 2 files changed, 46 deletions(-)

diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index 45310ddf2d7e..be4b13e66668 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -115,13 +115,9 @@ typedef int switchdev_obj_dump_cb_t(struct switchdev_obj *obj);
 /**
  * struct switchdev_ops - switchdev operations
  *
- * @switchdev_port_attr_get: Get a port attribute (see switchdev_attr).
- *
  * @switchdev_port_attr_set: Set a port attribute (see switchdev_attr).
  */
 struct switchdev_ops {
-	int	(*switchdev_port_attr_get)(struct net_device *dev,
-					   struct switchdev_attr *attr);
 	int	(*switchdev_port_attr_set)(struct net_device *dev,
 					   const struct switchdev_attr *attr,
 					   struct switchdev_trans *trans);
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index 7e1357db33d7..362413c9b389 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -174,48 +174,6 @@ static int switchdev_deferred_enqueue(struct net_device *dev,
 	return 0;
 }
 
-/**
- *	switchdev_port_attr_get - Get port attribute
- *
- *	@dev: port device
- *	@attr: attribute to get
- */
-int switchdev_port_attr_get(struct net_device *dev, struct switchdev_attr *attr)
-{
-	const struct switchdev_ops *ops = dev->switchdev_ops;
-	struct net_device *lower_dev;
-	struct list_head *iter;
-	struct switchdev_attr first = {
-		.id = SWITCHDEV_ATTR_ID_UNDEFINED
-	};
-	int err = -EOPNOTSUPP;
-
-	if (ops && ops->switchdev_port_attr_get)
-		return ops->switchdev_port_attr_get(dev, attr);
-
-	if (attr->flags & SWITCHDEV_F_NO_RECURSE)
-		return err;
-
-	/* Switch device port(s) may be stacked under
-	 * bond/team/vlan dev, so recurse down to get attr on
-	 * each port.  Return -ENODATA if attr values don't
-	 * compare across ports.
-	 */
-
-	netdev_for_each_lower_dev(dev, lower_dev, iter) {
-		err = switchdev_port_attr_get(lower_dev, attr);
-		if (err)
-			break;
-		if (first.id == SWITCHDEV_ATTR_ID_UNDEFINED)
-			first = *attr;
-		else if (memcmp(&first, attr, sizeof(*attr)))
-			return -ENODATA;
-	}
-
-	return err;
-}
-EXPORT_SYMBOL_GPL(switchdev_port_attr_get);
-
 static int __switchdev_port_attr_set(struct net_device *dev,
 				     const struct switchdev_attr *attr,
 				     struct switchdev_trans *trans)
-- 
2.19.1


^ permalink raw reply related

* [PATCH][net-next] net: Use RCU_POINTER_INITIALIZER() to init static variable
From: Li RongQing @ 2019-02-25  2:43 UTC (permalink / raw)
  To: netdev

This pointer is RCU protected, so proper primitives should be used.

Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 net/sched/sch_generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 38e5add14fab..7bcee8b8f803 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -559,7 +559,7 @@ struct Qdisc_ops noop_qdisc_ops __read_mostly = {
 };
 
 static struct netdev_queue noop_netdev_queue = {
-	.qdisc		=	&noop_qdisc,
+	RCU_POINTER_INITIALIZER(qdisc, &noop_qdisc),
 	.qdisc_sleeping	=	&noop_qdisc,
 };
 
-- 
2.16.2


^ permalink raw reply related

* [PATCH] ath9k: remove set but not used variable 'acq'
From: YueHaibing @ 2019-02-25  3:32 UTC (permalink / raw)
  To: QCA ath9k Development, Kalle Valo
  Cc: YueHaibing, linux-wireless, netdev, kernel-janitors

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/wireless/ath/ath9k/recv.c: In function 'ath_rx_count_airtime':
drivers/net/wireless/ath/ath9k/recv.c:1010:18: warning:
 variable 'acq' set but not used [-Wunused-but-set-variable]

It's not used after 89cea7493a34 ("ath9k: Switch to mac80211 TXQ scheduling
and airtime APIs"). Also remove related variables.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/net/wireless/ath/ath9k/recv.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 285a62d3019d..4e97f7f3b2a3 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -1006,9 +1006,6 @@ static void ath_rx_count_airtime(struct ath_softc *sc,
 				 struct ath_rx_status *rs,
 				 struct sk_buff *skb)
 {
-	struct ath_node *an;
-	struct ath_acq *acq;
-	struct ath_vif *avp;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
 	struct ath_hw *ah = sc->sc_ah;
 	struct ath_common *common = ath9k_hw_common(ah);
@@ -1019,7 +1016,7 @@ static void ath_rx_count_airtime(struct ath_softc *sc,
 	int phy;
 	u16 len = rs->rs_datalen;
 	u32 airtime = 0;
-	u8 tidno, acno;
+	u8 tidno;
 
 	if (!ieee80211_is_data(hdr->frame_control))
 		return;
@@ -1029,11 +1026,7 @@ static void ath_rx_count_airtime(struct ath_softc *sc,
 	sta = ieee80211_find_sta_by_ifaddr(sc->hw, hdr->addr2, NULL);
 	if (!sta)
 		goto exit;
-	an = (struct ath_node *) sta->drv_priv;
-	avp = (struct ath_vif *) an->vif->drv_priv;
 	tidno = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
-	acno = TID_TO_WME_AC(tidno);
-	acq = &avp->chanctx->acq[acno];
 
 	rxs = IEEE80211_SKB_RXCB(skb);




^ permalink raw reply related

* [RFC] nasty corner case in unix_dgram_sendmsg()
From: Al Viro @ 2019-02-25  3:51 UTC (permalink / raw)
  To: netdev

	Consider the following scenario: sendmsg() with explicit ->msg_name
on unconnected SOCK_DGRAM AF_UNIX socket finds the recepient just about to
die.  We go through
        sk_locked = 0;
        unix_state_lock(other);
restart_locked:
        err = -EPERM;
        if (!unix_may_send(sk, other))
                goto out_unlock;
OK, since other->peer is already NULL
        if (unlikely(sock_flag(other, SOCK_DEAD))) {
Yes, it is.
                /*
                 *      Check with 1003.1g - what should
                 *      datagram error
                 */
                unix_state_unlock(other);
no locks held now...
                sock_put(other);
... and there goes the last reference to other.  We get preempted (to make
the window wider - the race would still exist without preempt, but it
would be much harder to hit).

Memory that used to hold *other gets reused for another AF_UNIX socket,
which gets bound to the same address *and* another thread does connect()
to that address on our socket.  Now unix_peer(sk) is equal to other.
Our thread gets to run again, and
                if (!sk_locked)
                        unix_state_lock(sk);
grabs sk->lock
                err = 0;
                if (unix_peer(sk) == other) {
... yes, it is.  Not the same object, though
                        unix_peer(sk) = NULL;
... and it gets disconnected
                        unix_dgram_peer_wake_disconnect_wakeup(sk, other);

                        unix_state_unlock(sk);

                        unix_dgram_disconnected(sk, other);
... with receive queue purged.

AFAICS, that's bogus.  And easily prevented - all we need here is do
the first sock_put() *after* the "have we just found the peer dead?"
logics, avoiding the memory reuse.

Objections?

PS: unix_dgram_sendmsg() is really much too subtle for its own good -
AFAICS, it *does* avoid blocking operations under sk->lock, but proof
is considerably more complex than one would like it to be...  And
I'm still not convinced that no codepath in it could end up doing
something unpleasant to SOCK_SEQPACKET sockets ;-/

^ permalink raw reply

* [net v3 1/1] tipc: fix race condition causing hung sendto
From: Tung Nguyen @ 2019-02-25  3:57 UTC (permalink / raw)
  To: davem, netdev; +Cc: tipc-discussion
In-Reply-To: <20190221033121.4220-1-tung.q.nguyen@dektech.com.au>

When sending multicast messages via blocking socket,
if sending link is congested (tsk->cong_link_cnt is set to 1),
the sending thread will be put into sleeping state. However,
tipc_sk_filter_rcv() is called under socket spin lock but
tipc_wait_for_cond() is not. So, there is no guarantee that
the setting of tsk->cong_link_cnt to 0 in tipc_sk_proto_rcv() in
CPU-1 will be perceived by CPU-0. If that is the case, the sending
thread in CPU-0 after being waken up, will continue to see
tsk->cong_link_cnt as 1 and put the sending thread into sleeping
state again. The sending thread will sleep forever.

CPU-0                                | CPU-1
tipc_wait_for_cond()                 |
{                                    |
 // condition_ = !tsk->cong_link_cnt |
 while ((rc_ = !(condition_))) {     |
  ...                                |
  release_sock(sk_);                 |
  wait_woken();                      |
                                     | if (!sock_owned_by_user(sk))
                                     |  tipc_sk_filter_rcv()
                                     |  {
                                     |   ...
                                     |   tipc_sk_proto_rcv()
                                     |   {
                                     |    ...
                                     |    tsk->cong_link_cnt--;
                                     |    ...
                                     |    sk->sk_write_space(sk);
                                     |    ...
                                     |   }
                                     |   ...
                                     |  }
  sched_annotate_sleep();            |
  lock_sock(sk_);                    |
  remove_wait_queue();               |
 }                                   |
}                                    |

This commit fixes it by adding memory barrier to tipc_sk_proto_rcv()
and tipc_wait_for_cond().

Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Tung Nguyen <tung.q.nguyen@dektech.com.au>
---
 net/tipc/socket.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 684f2125fc6b..70343ac448b1 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -379,11 +379,13 @@ static int tipc_sk_sock_err(struct socket *sock, long *timeout)
 
 #define tipc_wait_for_cond(sock_, timeo_, condition_)			       \
 ({                                                                             \
+	DEFINE_WAIT_FUNC(wait_, woken_wake_function);                          \
 	struct sock *sk_;						       \
 	int rc_;							       \
 									       \
 	while ((rc_ = !(condition_))) {					       \
-		DEFINE_WAIT_FUNC(wait_, woken_wake_function);	               \
+		/* coupled with smp_wmb() in tipc_sk_proto_rcv() */            \
+		smp_rmb();                                                     \
 		sk_ = (sock_)->sk;					       \
 		rc_ = tipc_sk_sock_err((sock_), timeo_);		       \
 		if (rc_)						       \
@@ -1983,6 +1985,8 @@ static void tipc_sk_proto_rcv(struct sock *sk,
 		return;
 	case SOCK_WAKEUP:
 		tipc_dest_del(&tsk->cong_links, msg_orignode(hdr), 0);
+		/* coupled with smp_rmb() in tipc_wait_for_cond() */
+		smp_wmb();
 		tsk->cong_link_cnt--;
 		wakeup = true;
 		break;
-- 
2.17.1


^ permalink raw reply related

* Re: [PATCH net-next v2 2/2] net: phy: aquantia: add hwmon support
From: Andrew Lunn @ 2019-02-25  4:02 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: Heiner Kallweit, David Miller, netdev@vger.kernel.org
In-Reply-To: <5e9c1d9f-4c9f-10fd-439e-26f7f2cc467e@gmail.com>

On Sun, Feb 24, 2019 at 06:17:49PM -0800, Florian Fainelli wrote:
> Le 2/24/19 à 1:36 PM, Heiner Kallweit a écrit :
> > This adds HWMON support for the temperature sensor and the related
> > alarms on the 107/108/109 chips. This patch is based on work from
> > Nikita and Andrew. I added:
> > - support for changing alarm thresholds via sysfs
> > - move HWMON code to a separate source file to improve maintainability
> > - smaller changes like using IS_REACHABLE instead of ifdef
> >   (avoids problems if PHY driver is built in and HWMON is a module)
> > 
> > v2:
> > - remove struct aqr_priv
> > - rename header file to aquantia.h
> > 
> > Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
> 
> Should not Nikita be the author for that patch? Some minor nits below:
> 
> > Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> > Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Hi Florian

The history is convoluted. I did the initial implementation, but at
the time i did not have the hardware. So it got passed to Nikita who
did. He made it actually work, and passed patches back. I then passed
it onto Heiner who has done all the work on the driver and core for
C45.

	Andrew

^ permalink raw reply

* [PATCH net] sit: use ipv6_mod_enabled to check if ipv6 is disabled
From: Hangbin Liu @ 2019-02-25  4:12 UTC (permalink / raw)
  To: netdev; +Cc: Stefano Brivio, David S . Miller, David Ahern, Hangbin Liu

ipv6_mod_enabled() is more safe and gentle to check if ipv6 is disabled
at running time.

Fixes: 173656accaf5 ("sit: check if IPv6 enabled before calling ip6_err_gen_icmpv6_unreach()")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 net/ipv6/sit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index e8a1dabef803..eea1f19985a7 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -546,7 +546,7 @@ static int ipip6_err(struct sk_buff *skb, u32 info)
 	}
 
 	err = 0;
-	if (__in6_dev_get(skb->dev) &&
+	if (ipv6_mod_enabled() &&
 	    !ip6_err_gen_icmpv6_unreach(skb, iph->ihl * 4, type, data_len))
 		goto out;
 
-- 
2.19.2


^ permalink raw reply related

* [PATCH net] geneve: use ipv6_mod_enabled to check if ipv6 is disabled
From: Hangbin Liu @ 2019-02-25  4:13 UTC (permalink / raw)
  To: netdev; +Cc: Stefano Brivio, David S . Miller, David Ahern, Hangbin Liu

ipv6_mod_enabled() is more safe and gentle to check if ipv6 is disabled
at running time.

Fixes: c0a47e44c098 ("geneve: should not call rt6_lookup() when ipv6 was disabled")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 drivers/net/geneve.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 3377ac66a347..42c5e43ece68 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -1514,7 +1514,7 @@ static void geneve_link_config(struct net_device *dev,
 	case AF_INET6: {
 		struct rt6_info *rt;
 
-		if (!__in6_dev_get(dev))
+		if (!ipv6_mod_enabled())
 			break;
 
 		rt = rt6_lookup(geneve->net, &info->key.u.ipv6.dst, NULL, 0,
-- 
2.19.2


^ permalink raw reply related

* Re: [PATCH net-next v2 0/7] net: phy: marvell10g: Add 2.5GBaseT support
From: David Miller @ 2019-02-25  1:45 UTC (permalink / raw)
  To: maxime.chevallier
  Cc: netdev, linux-kernel, andrew, f.fainelli, hkallweit1, linux,
	linux-arm-kernel, antoine.tenart, thomas.petazzoni,
	gregory.clement, miquel.raynal, nadavh, stefanc, mw
In-Reply-To: <20190222233744.25735-1-maxime.chevallier@bootlin.com>

From: Maxime Chevallier <maxime.chevallier@bootlin.com>
Date: Sat, 23 Feb 2019 00:37:37 +0100

> This series adds the missing bits necessary to fully support 2.5GBaseT
> in the Marvell Alaska PHYs.
> 
> The main points for that support are :
> 
>  - Making use of the .get_features call, recently introduced by Heiner
>    and Andrew, that allows having a fully populated list of supported
>    modes, including 2500BaseT.  
> 
>  - Configuring the MII to 2500BaseX when establishing a link at 2.5G
> 
>  - Adding a small quirk to take into account the fact that some PHYs in
>    the family won't report the correct supported abilities
> 
> The rest of the series consists of small cosmetic improvements such as
> using the correct helper to set a linkmode bit and adding macros for the
> PHY ids.
> 
> We also add support for the 88E2110 PHY, which doesn't require the
> quirk, and support for 2500BaseT in the PPv2 driver, in order to have a
> fully working setup on the MacchiatoBin board.
> 
> Changes since V1 : Fixed formatting issue in patch 01, rebased.

Series applied, thank you.

^ permalink raw reply

* Re: [PATCH v4 net-next 0/4] net: dsa: microchip: add MIB counters support
From: David Miller @ 2019-02-25  1:50 UTC (permalink / raw)
  To: Tristram.Ha
  Cc: sergio.paracuellos, andrew, f.fainelli, pavel, UNGLinuxDriver,
	netdev
In-Reply-To: <1550882211-10381-1-git-send-email-Tristram.Ha@microchip.com>

From: <Tristram.Ha@microchip.com>
Date: Fri, 22 Feb 2019 16:36:46 -0800

> This series of patches is to modify the KSZ9477 DSA driver to read MIB
> counters periodically to avoid overflow.

Series applied.

^ permalink raw reply

* Re: [PATCH net] sit: use ipv6_mod_enabled to check if ipv6 is disabled
From: Eric Dumazet @ 2019-02-25  4:24 UTC (permalink / raw)
  To: Hangbin Liu, netdev; +Cc: Stefano Brivio, David S . Miller, David Ahern
In-Reply-To: <20190225041243.9753-1-liuhangbin@gmail.com>



On 02/24/2019 08:12 PM, Hangbin Liu wrote:
> ipv6_mod_enabled() is more safe and gentle to check if ipv6 is disabled
> at running time.
> 


Why is it better exactly ?

IPv6 can be enabled on the host, but disabled per device

/proc/sys/net/ipv6/conf/{name}/disable_ipv6


> Fixes: 173656accaf5 ("sit: check if IPv6 enabled before calling ip6_err_gen_icmpv6_unreach()")
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
>  net/ipv6/sit.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
> index e8a1dabef803..eea1f19985a7 100644
> --- a/net/ipv6/sit.c
> +++ b/net/ipv6/sit.c
> @@ -546,7 +546,7 @@ static int ipip6_err(struct sk_buff *skb, u32 info)
>  	}
>  
>  	err = 0;
> -	if (__in6_dev_get(skb->dev) &&
> +	if (ipv6_mod_enabled() &&
>  	    !ip6_err_gen_icmpv6_unreach(skb, iph->ihl * 4, type, data_len))
>  		goto out;
>  
> 

^ permalink raw reply

* Re: [PATCH net-next 00/15] mlxsw: spectrum_acl: Don't take rtnl mutex for region rehash
From: David Miller @ 2019-02-25  4:26 UTC (permalink / raw)
  To: idosch; +Cc: netdev, jiri, mlxsw
In-Reply-To: <20190224064525.14913-1-idosch@mellanox.com>

From: Ido Schimmel <idosch@mellanox.com>
Date: Sun, 24 Feb 2019 06:46:21 +0000

> Jiri says:
> 
> During region rehash, a new region is created with a more optimized set
> of masks (ERPs). When transitioning to the new region, all the rules
> from the old region are copied one-by-one to the new region. This
> transition can be time consuming and currently done under RTNL lock.
> 
> In order to remove RTNL lock dependency during region rehash, introduce
> multiple smaller locks guarding dedicated structures or parts of them.
> That is the vast majority of this patchset. Only patch #1 is simple
> cleanup and patches 12-15 are improving or introducing new selftests.

Series applied, thanks.

^ permalink raw reply

* Re: [PATCH net-next] net/sched: act_tunnel_key: Add dst_cache support
From: David Miller @ 2019-02-25  5:52 UTC (permalink / raw)
  To: wenxu; +Cc: jhs, netdev
In-Reply-To: <1550822292-14980-1-git-send-email-wenxu@ucloud.cn>

From: wenxu@ucloud.cn
Date: Fri, 22 Feb 2019 15:58:12 +0800

> From: wenxu <wenxu@ucloud.cn>
> 
> The metadata_dst is not init the dst_cache which make the
> ip_md_tunnel_xmit can't use the dst_cache. It will lookup
> route table every packets.
> 
> Signed-off-by: wenxu <wenxu@ucloud.cn>

Applied.

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox