Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 2/3] net: hns: add Hisilicon RoCE support
From: Yankejian (Hackim Yim) @ 2016-03-14  1:12 UTC (permalink / raw)
  To: Lijun Ou, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	sean.hefty-ral2JQCrhuEAvxtiuMwx3w,
	hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q,
	jeffrey.t.kirsher-ral2JQCrhuEAvxtiuMwx3w,
	jiri-VPRAkNaXOzVWk0Htik3J/w, ogerlitz-VPRAkNaXOzVWk0Htik3J/w,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	gongyangming-hv44wF8Li93QT0dZR+AlfA,
	xiaokun-hv44wF8Li93QT0dZR+AlfA,
	tangchaofei-hv44wF8Li93QT0dZR+AlfA,
	haifeng.wei-hv44wF8Li93QT0dZR+AlfA,
	yisen.zhuang-hv44wF8Li93QT0dZR+AlfA,
	lisheng011-hv44wF8Li93QT0dZR+AlfA,
	charles.chenxin-hv44wF8Li93QT0dZR+AlfA,
	linuxarm-hv44wF8Li93QT0dZR+AlfA
In-Reply-To: <20160312104301.GB15703-2ukJVAZIZ/Y@public.gmane.org>



On 2016/3/12 18:43, Leon Romanovsky wrote:
> On Fri, Mar 11, 2016 at 06:37:10PM +0800, Lijun Ou wrote:
>> It added hns_dsaf_roce_reset routine for roce driver.
>> RoCE is a feature of hns.
>> In hip06 SOC, in roce reset process, it's needed to configure
>> dsaf channel reset,port and sl map info.
>>
>> Signed-off-by: Lijun Ou <oulijun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
>> Signed-off-by: Wei Hu(Xavier) <xavier.huwei-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
>> Signed-off-by: Lisheng <lisheng011-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
>> ---
>>  drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 84 ++++++++++++++++++++++
>>  drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h | 14 ++++
>>  drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c | 62 +++++++++++++---
>>  drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h  | 13 ++++
>>  4 files changed, 163 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
>> index 38fc5be..a0f0d4f 100644
>> --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
>> +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
>> @@ -12,6 +12,7 @@
>>  #include <linux/init.h>
>>  #include <linux/interrupt.h>
>>  #include <linux/netdevice.h>
>> +#include <linux/of_platform.h>
>>  #include <linux/platform_device.h>
>>  #include <linux/of.h>
>>  #include <linux/of_address.h>
>> @@ -2593,6 +2594,89 @@ static struct platform_driver g_dsaf_driver = {
>>  
>>  module_platform_driver(g_dsaf_driver);
>>  
>> +/**
>> + * hns_dsaf_roce_reset - reset dsaf and roce
>> + * @dsaf_fwnode: Pointer to framework node for the dasf
>> + * @val: 0 - request reset , 1 - drop reset
>> + * retuen 0 - success , negative --fail
>> + */
>> +int hns_dsaf_roce_reset(struct fwnode_handle *dsaf_fwnode, u32 val)
>> +{
>> +	struct dsaf_device *dsaf_dev;
>> +	struct platform_device *pdev;
>> +	unsigned int mp;
>> +	unsigned int sl;
>> +	unsigned int credit;
>> +	int i;
>> +	const u32 port_map[DSAF_ROCE_CREDIT_CHN][DSAF_ROCE_CHAN_MODE] = {
>> +		{0, 0, 0},
>> +		{1, 0, 0},
>> +		{2, 1, 0},
>> +		{3, 1, 0},
>> +		{4, 2, 1},
>> +		{4, 2, 1},
>> +		{5, 3, 1},
>> +		{5, 3, 1},
>> +	};
>> +	const u32 sl_map[DSAF_ROCE_CREDIT_CHN][DSAF_ROCE_CHAN_MODE] = {
>> +		{0, 0, 0},
>> +		{0, 1, 1},
>> +		{0, 0, 2},
>> +		{0, 1, 3},
>> +		{0, 0, 0},
>> +		{1, 1, 1},
>> +		{0, 0, 2},
>> +		{1, 1, 3},
>> +	};
> Do you have a plan to send a version with enums/defines for this
> numbers? Especially for _CHAN_MODE.
>
> .

Hi leon,

    it seems the enums is added in hns_dsaf_main.h, as belows:

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
index 5fea226..c917b9a 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
@@ -40,6 +40,16 @@ struct hns_mac_cb;
 #define DSAF_DUMP_REGS_NUM 504
 #define DSAF_STATIC_NUM 28
 
+#define DSAF_ROCE_CREDIT_CHN 8
+#define DSAF_ROCE_CHAN_MODE 3
+
+enum dsaf_roce_port_port_mode {
+	DSAF_ROCE_6PORT_MODE,
+	DSAF_ROCE_4PORT_MODE,
+	DSAF_ROCE_2PORT_MODE,
+	DSAF_ROCE_CHAN_MODE_NUM
+};
+

MBR, Kejian






--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH net-next] ethtool: Set cmd field in ETHTOOL_GLINKSETTINGS response to wrong nwords
From: Ben Hutchings @ 2016-03-14  1:05 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

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

When the ETHTOOL_GLINKSETTINGS implementation finds that userland is
using the wrong number of words of link mode bitmaps (or is trying to
find out the right numbers) it sets the cmd field to 0 in the response
structure.

This is inconsistent with the implementation of every other ethtool
command, so let's remove that inconsistency before it gets into a
stable release.

Fixes: 3f1ac7a700d03 ("net: ethtool: add new ETHTOOL_xLINKSETTINGS API")
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
David, please can you include this in changes for 4.6?

Ben.

 net/core/ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 2966cd0d7c93..f426c5ad6149 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -655,7 +655,7 @@ static int ethtool_get_link_ksettings(struct net_device *dev,
 	    != link_ksettings.base.link_mode_masks_nwords) {
 		/* wrong link mode nbits requested */
 		memset(&link_ksettings, 0, sizeof(link_ksettings));
-		/* keep cmd field reset to 0 */
+		link_ksettings.base.cmd = ETHTOOL_GLINKSETTINGS;
 		/* send back number of words required as negative val */
 		compiletime_assert(__ETHTOOL_LINK_MODE_MASK_NU32 <= S8_MAX,
 				   "need too many bits for link modes!");

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply related

* Re: [PATCHv3 (net.git) 2/2] stmmac: fix MDIO settings
From: Phil Reid @ 2016-03-14  0:50 UTC (permalink / raw)
  To: Giuseppe CAVALLARO, netdev
  Cc: gabriel.fernandez, afaerber, fschaefer.oss, dinh.linux, davem
In-Reply-To: <56E2E51D.7030103@st.com>

G'day Giuseppe,

On 11/03/2016 11:32 PM, Giuseppe CAVALLARO wrote:
> On 3/11/2016 4:14 PM, Phil Reid wrote:
>> G'day Giuseppe,
>>
>> I wont be able to test until Monday.
>> Concept looks ok to me except for comment below.
>>
>> On 11/03/2016 9:33 PM, Giuseppe Cavallaro wrote:
>>> Initially the phy_bus_name was added to manipulate the
>>> driver name but It was recently just used to manage the
>>> fixed-link and then to take some decision at run-time
>>> inside the main (for example to skip EEE).
>>> So the patch uses the is_pseudo_fixed_link and removes
>>> removes the phy_bus_name variable not necessary anymore.
>>>
>>> The driver can manage the mdio registration by using phy-handle,
>>> dwmac-mdio and own parameter e.g. snps,phy-addr.
>>> This patch takes care about all these possible configurations
>>> and fixes the mdio registration in case of there is a real
>>> transceiver or a switch (that needs to be managed by using
>>> fixed-link).
>>>
>>> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
>>> Reviewed-by: Andreas Färber <afaerber@suse.de>
>>> Tested-by: Frank Schäfer <fschaefer.oss@googlemail.com>
>>> Cc: Gabriel Fernandez <gabriel.fernandez@linaro.org>
>>> Cc: Dinh Nguyen <dinh.linux@gmail.com>
>>> Cc: David S. Miller <davem@davemloft.net>
>>> Cc: Phil Reid <preid@electromag.com.au>
>>> ---
>>>
>>> V2: use is_pseudo_fixed_link
>>> V3: parse device-tree driver parameters to allocate PHY resources
>>> considering
>>>      DSA case (+ fixed-link).
>>>
>>>   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |   11 +--
>>>   drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c  |   19 +-----
>>>   .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |   77
>>> ++++++++++++++++----
>>>   include/linux/stmmac.h                             |    2 +-
>>>   4 files changed, 68 insertions(+), 41 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>>> b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>>> index c21015b..389d7d0 100644
>>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>>> @@ -271,7 +271,6 @@ static void stmmac_eee_ctrl_timer(unsigned long arg)
>>>    */
>>>   bool stmmac_eee_init(struct stmmac_priv *priv)
>>>   {
>>> -    char *phy_bus_name = priv->plat->phy_bus_name;
>>>       unsigned long flags;
>>>       bool ret = false;
>>>
>>> @@ -283,7 +282,7 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
>>>           goto out;
>>>
>>>       /* Never init EEE in case of a switch is attached */
>>> -    if (phy_bus_name && (!strcmp(phy_bus_name, "fixed")))
>>> +    if (priv->phydev->is_pseudo_fixed_link)
>>>           goto out;
>>>
>>>       /* MAC core supports the EEE feature. */
>>> @@ -820,12 +819,8 @@ static int stmmac_init_phy(struct net_device *dev)
>>>           phydev = of_phy_connect(dev, priv->plat->phy_node,
>>>                       &stmmac_adjust_link, 0, interface);
>>>       } else {
>>> -        if (priv->plat->phy_bus_name)
>>> -            snprintf(bus_id, MII_BUS_ID_SIZE, "%s-%x",
>>> -                 priv->plat->phy_bus_name, priv->plat->bus_id);
>>> -        else
>>> -            snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x",
>>> -                 priv->plat->bus_id);
>>> +        snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x",
>>> +             priv->plat->bus_id);
>>>
>>>           snprintf(phy_id_fmt, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, bus_id,
>>>                priv->plat->phy_addr);
>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
>>> b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
>>> index 0faf163..3f5512f 100644
>>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
>>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
>>> @@ -198,29 +198,12 @@ int stmmac_mdio_register(struct net_device *ndev)
>>>       struct mii_bus *new_bus;
>>>       struct stmmac_priv *priv = netdev_priv(ndev);
>>>       struct stmmac_mdio_bus_data *mdio_bus_data =
>>> priv->plat->mdio_bus_data;
>>> +    struct device_node *mdio_node = priv->plat->mdio_node;
>>>       int addr, found;
>>> -    struct device_node *mdio_node = NULL;
>>> -    struct device_node *child_node = NULL;
>>>
>>>       if (!mdio_bus_data)
>>>           return 0;
>>>
>>> -    if (IS_ENABLED(CONFIG_OF)) {
>>> -        for_each_child_of_node(priv->device->of_node, child_node) {
>>> -            if (of_device_is_compatible(child_node,
>>> -                            "snps,dwmac-mdio")) {
>>> -                mdio_node = child_node;
>>> -                break;
>>> -            }
>>> -        }
>>> -
>>> -        if (mdio_node) {
>>> -            netdev_dbg(ndev, "FOUND MDIO subnode\n");
>>> -        } else {
>>> -            netdev_warn(ndev, "No MDIO subnode found\n");
>>> -        }
>>> -    }
>>> -
>>>       new_bus = mdiobus_alloc();
>>>       if (new_bus == NULL)
>>>           return -ENOMEM;
>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>>> b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>>> index 6a52fa1..d2322e9 100644
>>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>>> @@ -96,6 +96,66 @@ static int dwmac1000_validate_ucast_entries(int
>>> ucast_entries)
>>>   }
>>>
>>>   /**
>>> + * stmmac_dt_phy - parse device-tree driver parameters to allocate
>>> PHY resources
>>> + * @plat: driver data platform structure
>>> + * @np: device tree node
>>> + * @dev: device pointer
>>> + * Description:
>>> + * The mdio bus will be allocated in case of a phy transceiver is on
>>> board;
>>> + * it will be NULL if the fixed-link is configured.
>>> + * If there is the "snps,dwmac-mdio" sub-node the mdio will be allocated
>>> + * in any case (for DSA, mdio must be registered even if fixed-link).
>>> + * The table below sums the supported configurations:
>>> + *    -------------------------------
>>> + *    snps,phy-addr    |     Y
>>> + *    -------------------------------
>>> + *    phy-handle    |     Y
>>> + *    -------------------------------
>>> + *    fixed-link    |     N
>>> + *    -------------------------------
>>> + *    snps,dwmac-mdio    |
>>> + *      even if    |     Y
>>> + *    fixed-link    |
>>> + *    -------------------------------
>>> + *
>>> + * It returns true in case of the mdio needs to be registered in the
>>> main.
>>> + */
>>> +static bool stmmac_dt_phy(struct plat_stmmacenet_data *plat,
>>> +              struct device_node *np, struct device *dev)
>>> +{
>>> +    bool ret = true;
>>> +
>>> +    /* If phy-handle property is passed from DT, use it as the PHY */
>>> +    plat->phy_node = of_parse_phandle(np, "phy-handle", 0);
>>> +    if (plat->phy_node)
>>> +        dev_dbg(dev, "Found phy-handle subnode\n");
>>> +
>>> +    /* If phy-handle is not specified, check if we have a fixed-phy */
>>> +    if (!plat->phy_node && of_phy_is_fixed_link(np)) {
>>> +        if ((of_phy_register_fixed_link(np) < 0))
>>> +            return -ENODEV;
>>> +
>>> +        dev_dbg(dev, "Found fixed-link subnode\n");
>>> +        plat->phy_node = of_node_get(np);
>>> +
>>> +        ret = false;
>>> +    }
>>> +
>>> +    /* If snps,dwmac-mdio is passed from DT, always register the MDIO */
>>> +    for_each_child_of_node(np, plat->mdio_node) {
>>> +        if (of_device_is_compatible(plat->mdio_node, "snps,dwmac-mdio"))
>>> +            break;
>>> +    }
>>> +
>>
>> Won't this always result in plat->mdio_node being assigned to something
>> if np has a child.
>> Regardless of the compatible string.
>> Which is why I had the child_node temp.
>> Still learning so may be missing something.
>
> hmm, i think so, let me know as soon as you test it so I can
> rework the patch and send a v4.
>

Tested-by: Phil Reid <preid@electromag.com.au>

Ignore my comment above. This works fine.
Test with / without compatible flag and it works as expected.

At the end of the loop for_each_child_of_node sets the node to NULL.


>
>>
>>> +    if (plat->mdio_node) {
>>> +        dev_dbg(dev, "Found MDIO subnode\n");
>>> +        ret = true;
>>> +    }
>>> +
>>> +    return ret;
>>> +}
>>> +
>>> +/**
>>>    * stmmac_probe_config_dt - parse device-tree driver parameters
>>>    * @pdev: platform_device structure
>>>    * @plat: driver data platform structure
>>> @@ -129,30 +189,19 @@ stmmac_probe_config_dt(struct platform_device
>>> *pdev, const char **mac)
>>>       /* Default to phy auto-detection */
>>>       plat->phy_addr = -1;
>>>
>>> -    /* If we find a phy-handle property, use it as the PHY */
>>> -    plat->phy_node = of_parse_phandle(np, "phy-handle", 0);
>>> -
>>> -    /* If phy-handle is not specified, check if we have a fixed-phy */
>>> -    if (!plat->phy_node && of_phy_is_fixed_link(np)) {
>>> -        if ((of_phy_register_fixed_link(np) < 0))
>>> -            return ERR_PTR(-ENODEV);
>>> -
>>> -        plat->phy_node = of_node_get(np);
>>> -    }
>>> -
>>>       /* "snps,phy-addr" is not a standard property. Mark it as
>>> deprecated
>>>        * and warn of its use. Remove this when phy node support is added.
>>>        */
>>>       if (of_property_read_u32(np, "snps,phy-addr", &plat->phy_addr)
>>> == 0)
>>>           dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n");
>>>
>>> -    if ((plat->phy_node && !of_phy_is_fixed_link(np)) ||
>>> plat->phy_bus_name)
>>> -        plat->mdio_bus_data = NULL;
>>> -    else
>>> +    /* To Configure PHY by using all device-tree supported properties */
>>> +    if (stmmac_dt_phy(plat, np, &pdev->dev)) {
>>>           plat->mdio_bus_data =
>>>               devm_kzalloc(&pdev->dev,
>>>                        sizeof(struct stmmac_mdio_bus_data),
>>>                        GFP_KERNEL);
>>> +    }
>>>
>>>       of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size);
>>>
>>> diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
>>> index eead8ab..8b1ff2b 100644
>>> --- a/include/linux/stmmac.h
>>> +++ b/include/linux/stmmac.h
>>> @@ -94,12 +94,12 @@ struct stmmac_dma_cfg {
>>>   };
>>>
>>>   struct plat_stmmacenet_data {
>>> -    char *phy_bus_name;
>>>       int bus_id;
>>>       int phy_addr;
>>>       int interface;
>>>       struct stmmac_mdio_bus_data *mdio_bus_data;
>>>       struct device_node *phy_node;
>>> +    struct device_node *mdio_node;
>>>       struct stmmac_dma_cfg *dma_cfg;
>>>       int clk_csr;
>>>       int has_gmac;
>>>
>>
>>
>
>
>


-- 
Regards
Phil Reid

^ permalink raw reply

* Re: [PATCH net 3/6] net: hns: fixed portid bug in sending manage pkt
From: Daode Huang @ 2016-03-14  0:45 UTC (permalink / raw)
  To: Sergei Shtylyov, davem
  Cc: liguozhu, Yisen.Zhuang, linux-kernel, linux-arm-kernel, netdev,
	linuxarm, salil.mehta, kenneth-lee-2012, xuwei5, lisheng011,
	yankejian
In-Reply-To: <56E2C839.4000700@cogentembedded.com>



On 2016/3/11 21:29, Sergei Shtylyov wrote:
> Hello.
>
> On 3/11/2016 4:53 AM, Daode Huang wrote:
>
>>>> In V2 chip, when sending mamagement packets, the driver should
>>>> config the port id to BD descs.
>>>>
>>>> Signed-off-by: Daode Huang <huangdaode@hisilicon.com>
>>>> Signed-off-by: Lisheng <lisheng011@huawei.com>
>>>> ---
>>>>   drivers/net/ethernet/hisilicon/hns/hnae.h         | 3 +++
>>>>   drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c | 1 +
>>>>   drivers/net/ethernet/hisilicon/hns/hns_enet.c     | 4 ++++
>>>>   3 files changed, 8 insertions(+)
>>>>
>>>> diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.h
>>>> b/drivers/net/ethernet/hisilicon/hns/hnae.h
>>>> index 1cbcb9f..11a3f97 100644
>>>> --- a/drivers/net/ethernet/hisilicon/hns/hnae.h
>>>> +++ b/drivers/net/ethernet/hisilicon/hns/hnae.h
>>> [...]
>>>> @@ -516,6 +518,7 @@ struct hnae_handle {
>>>>       int q_num;
>>>>       int vf_id;
>>>>       u32 eport_id;
>>>> +    u32 dport_id;    /*v2 tx bd should fill the dport_id*/
>>>
>>>    Please add spaces after /* and before */ (like it's done in other 
>>> places
>>> in this driver).
>>>
>>
>> Hi MBR, Sergei,
>
>    Just in case: MBR stands for "my best regards", Sergei is my name. :-)
hi Sergei,

So sorry for my misunderstanding.
thanks for your reminding.

Best Regards
Daode.

>
>> Daode.
>
> MBR, Sergei
>
>
> .
>

^ permalink raw reply

* [RFC PATCH 0/8] Add irq controller support to Marvell switches
From: Andrew Lunn @ 2016-03-14  0:33 UTC (permalink / raw)
  To: netdev, Florian Fainelli, Jason Cooper, Vivien Didelot; +Cc: Andrew Lunn

The Marvell switches contain one or two interrupt controllers,
depending on switch features. If the switch contains embedded PHYs,
one of these controllers contains the interrupts from these PHYs. In
order that the phylib can make use of these interrupts, they need to
be exported from the driver so a phandle can be used to reference
them. So this patchset make use of the core interrupt infrastructure
to implement one or two interrupt drivers within the switch
driver. The device controller, which contains the PHY interrupts, has
a IRQ domain associated to it, so it can be accessed outside of the
switch driver.

I have a further patch to a dts file to make use of this, but that
board has not yet been accepted into arm-soc.

It would be good if somebody with core IRQ knowledge could review
the second patch. Hi Jason :-)

    Andrew

Andrew Lunn (8):
  net: dsa: Add parsing of an interrupt property
  dsa: mv88e6xxx: Add support for switch and device interrupts
  dsa: mv88e6352: Wire up the mv88e6xxx interrupt code
  dsa: mv88e6171: Wire up the mv88e6xxx interrupt code
  dsa: mv88e6123_61_65: Wire up the mv88e6xxx interrupt code
  dsa: mv88e6131: Wire up the mv88e6xxx interrupt code
  net: dsa: Support phy interrupt property for switch ports.
  net: phy: Use threaded IRQ, to allow IRQ from sleeping devices

 Documentation/devicetree/bindings/net/dsa/dsa.txt |  10 +-
 drivers/net/dsa/mv88e6123_61_65.c                 |   6 +-
 drivers/net/dsa/mv88e6131.c                       |   7 +-
 drivers/net/dsa/mv88e6171.c                       |   6 +-
 drivers/net/dsa/mv88e6352.c                       |   6 +-
 drivers/net/dsa/mv88e6xxx.c                       | 312 ++++++++++++++++++++++
 drivers/net/dsa/mv88e6xxx.h                       |  22 ++
 drivers/net/phy/phy.c                             |   5 +-
 include/net/dsa.h                                 |   6 +
 net/dsa/dsa.c                                     |   8 +
 net/dsa/dsa_priv.h                                |   1 +
 net/dsa/slave.c                                   |  11 +-
 12 files changed, 389 insertions(+), 11 deletions(-)

-- 
2.7.0

^ permalink raw reply

* [RFC PATCH 1/8] net: dsa: Add parsing of an interrupt property
From: Andrew Lunn @ 2016-03-14  0:33 UTC (permalink / raw)
  To: netdev, Florian Fainelli, Jason Cooper, Vivien Didelot; +Cc: Andrew Lunn
In-Reply-To: <1457915631-16696-1-git-send-email-andrew@lunn.ch>

Some switch chips have an interrupt line, which can be connected to
a GPIO line and used to indicate interrupts. Add parsing of such
an interrupt to the DSA framework.

Also, update the binding, which already listed an interrupt.  However,
interrupts are a property of the chip, not the cluster, so move it
into the chip level of the hierarchy.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 Documentation/devicetree/bindings/net/dsa/dsa.txt | 7 +++----
 include/net/dsa.h                                 | 6 ++++++
 net/dsa/dsa.c                                     | 8 ++++++++
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.txt b/Documentation/devicetree/bindings/net/dsa/dsa.txt
index 5fdbbcdf8c4b..90a4fe115e50 100644
--- a/Documentation/devicetree/bindings/net/dsa/dsa.txt
+++ b/Documentation/devicetree/bindings/net/dsa/dsa.txt
@@ -10,10 +10,6 @@ Required properties:
 - dsa,ethernet		: Should be a phandle to a valid Ethernet device node
 - dsa,mii-bus		: Should be a phandle to a valid MDIO bus device node
 
-Optional properties:
-- interrupts		: property with a value describing the switch
-			  interrupt number (not supported by the driver)
-
 A DSA node can contain multiple switch chips which are therefore child nodes of
 the parent DSA node. The maximum number of allowed child nodes is 4
 (DSA_MAX_SWITCHES).
@@ -34,6 +30,9 @@ A switch child node has the following optional property:
 - reset-gpios		: phandle and specifier to a gpio line connected to
 			  reset pin of the switch chip.
 
+- interrupts		: property with a value describing the switch
+			  interrupt number
+
 A switch may have multiple "port" children nodes
 
 Each port children node must have the following mandatory properties:
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 26c0a3fa009a..ff737781cf8f 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -59,6 +59,12 @@ struct dsa_chip_data {
 	struct device_node *port_dn[DSA_MAX_PORTS];
 
 	/*
+	 * The switch may have an interrupt line, which can be used
+	 * to indicate events have occurred in the switch.
+	 */
+	int irq;
+
+	/*
 	 * An array (with nr_chips elements) of which element [a]
 	 * indicates which port on this switch should be used to
 	 * send packets to that are destined for switch a.  Can be
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index d8fb47fcad05..980aa10fc3a1 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -20,6 +20,7 @@
 #include <linux/of.h>
 #include <linux/of_mdio.h>
 #include <linux/of_platform.h>
+#include <linux/of_irq.h>
 #include <linux/of_net.h>
 #include <linux/of_gpio.h>
 #include <linux/sysfs.h>
@@ -667,6 +668,7 @@ static int dsa_of_probe(struct device *dev)
 	unsigned long flags;
 	u32 eeprom_len;
 	int ret;
+	int irq;
 
 	mdio = of_parse_phandle(np, "dsa,mii-bus", 0);
 	if (!mdio)
@@ -728,6 +730,12 @@ static int dsa_of_probe(struct device *dev)
 		if (!of_property_read_u32(child, "eeprom-length", &eeprom_len))
 			cd->eeprom_len = eeprom_len;
 
+		irq = of_irq_get(child, 0);
+		if (irq == -EPROBE_DEFER)
+			goto out_free_chip;
+		if (irq > 0)
+			cd->irq = irq;
+
 		mdio = of_parse_phandle(child, "mii-bus", 0);
 		if (mdio) {
 			mdio_bus_switch = of_mdio_find_bus(mdio);
-- 
2.7.0

^ permalink raw reply related

* [RFC PATCH 2/8] dsa: mv88e6xxx: Add support for switch and device interrupts
From: Andrew Lunn @ 2016-03-14  0:33 UTC (permalink / raw)
  To: netdev, Florian Fainelli, Jason Cooper, Vivien Didelot; +Cc: Andrew Lunn
In-Reply-To: <1457915631-16696-1-git-send-email-andrew@lunn.ch>

The switch contains an interrupt controller. This then has a chained
device interrupt controller, which contains interrupts from the
embedded PHYs. Add support for these interrupt controllers.
---
 drivers/net/dsa/mv88e6xxx.c | 312 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/net/dsa/mv88e6xxx.h |  22 ++++
 2 files changed, 334 insertions(+)

diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index 5f07524083c3..2301dfbc3582 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -21,6 +21,9 @@
 #include <linux/netdevice.h>
 #include <linux/gpio/consumer.h>
 #include <linux/phy.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
 #include <net/dsa.h>
 #include <net/switchdev.h>
 #include "mv88e6xxx.h"
@@ -2536,6 +2539,315 @@ int mv88e6xxx_setup_ports(struct dsa_switch *ds)
 	return 0;
 }
 
+static int mv88e6xxx_nirqs(struct dsa_switch *ds)
+{
+	int nirqs = 8;
+
+	if (mv88e6xxx_6165_family(ds) ||
+	    mv88e6xxx_6351_family(ds) ||
+	    mv88e6xxx_6352_family(ds))
+		nirqs = 9;
+
+	return nirqs;
+}
+
+static void mv88e6xxx_switch_irq_mask(struct irq_data *d)
+{
+	struct dsa_switch *ds = irq_data_get_irq_chip_data(d);
+	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+	unsigned int n = d->hwirq;
+
+	ps->switch_irq_masked |= (1 << n);
+}
+
+static void mv88e6xxx_switch_irq_unmask(struct irq_data *d)
+{
+	struct dsa_switch *ds = irq_data_get_irq_chip_data(d);
+	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+	unsigned int n = d->hwirq;
+
+	ps->switch_irq_masked &= ~(1 << n);
+}
+
+static irqreturn_t mv88e6xxx_switch_irq_thread_fn(int irq, void *dev_id)
+{
+	struct dsa_switch *ds = (struct dsa_switch *)dev_id;
+	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+	unsigned nhandled = 0;
+	unsigned sub_irq;
+	unsigned n;
+	int val;
+
+	val = _mv88e6xxx_reg_read(ds, REG_GLOBAL, GLOBAL_STATUS);
+	if (val < 0)
+		goto out;
+
+	for (n = 0; n < ps->switch_nirqs; ++n) {
+		if (val & (1 << n)) {
+			sub_irq = irq_find_mapping(ps->switch_irq_domain, n);
+			handle_nested_irq(sub_irq);
+			++nhandled;
+		}
+	}
+out:
+	return (nhandled > 0 ? IRQ_HANDLED : IRQ_NONE);
+}
+
+static void mv88e6xxx_switch_irq_bus_lock(struct irq_data *d)
+{
+	struct dsa_switch *ds = irq_data_get_irq_chip_data(d);
+	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+
+	mutex_lock(&ps->smi_mutex);
+}
+
+static void mv88e6xxx_switch_irq_bus_sync_unlock(struct irq_data *d)
+{
+	struct dsa_switch *ds = irq_data_get_irq_chip_data(d);
+	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+	u16 mask = GENMASK(ps->switch_nirqs, 0);
+	int reg, ret;
+
+	reg = _mv88e6xxx_reg_read(ds, REG_GLOBAL, GLOBAL_CONTROL);
+	if (reg < 0)
+		goto out;
+
+	reg &= ~mask;
+	reg |= (~ps->switch_irq_masked & mask);
+
+	ret = _mv88e6xxx_reg_write(ds, REG_GLOBAL, GLOBAL_CONTROL, reg);
+	if (ret < 0)
+		goto out;
+
+out:
+	mutex_unlock(&ps->smi_mutex);
+}
+
+static struct irq_chip mv88e6xxx_switch_irq_chip = {
+	.name			= "mv88e6xxx-switch",
+	.irq_mask		= mv88e6xxx_switch_irq_mask,
+	.irq_unmask		= mv88e6xxx_switch_irq_unmask,
+	.irq_bus_lock		= mv88e6xxx_switch_irq_bus_lock,
+	.irq_bus_sync_unlock	= mv88e6xxx_switch_irq_bus_sync_unlock,
+};
+
+static int mv88e6xxx_switch_irq_domain_map(struct irq_domain *d,
+					   unsigned int irq,
+					   irq_hw_number_t hwirq)
+{
+	struct dsa_switch *ds = d->host_data;
+	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+
+	irq_set_chip_data(irq, d->host_data);
+	irq_set_chip_and_handler(irq, &ps->switch_irq_chip, handle_level_irq);
+	irq_set_noprobe(irq);
+
+	return 0;
+}
+
+static const struct irq_domain_ops mv88e6xxx_switch_irq_domain_ops = {
+	.map	= mv88e6xxx_switch_irq_domain_map,
+	.xlate	= irq_domain_xlate_twocell,
+};
+
+int mv88e6xxx_setup_switch_irq(struct dsa_switch *ds)
+{
+	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+	u16 mask = GENMASK(ps->switch_nirqs, 0);
+	int err, irq, reg;
+
+	ps->switch_nirqs = mv88e6xxx_nirqs(ds);
+	ps->switch_irq_domain = irq_domain_add_simple(
+		NULL, ps->switch_nirqs, 0,
+		&mv88e6xxx_switch_irq_domain_ops, ds);
+	if (!ps->switch_irq_domain)
+		return -ENOMEM;
+
+	for (irq = 0; irq < ps->switch_nirqs; irq++)
+		irq_create_mapping(ps->switch_irq_domain, irq);
+
+	ps->switch_irq_chip = mv88e6xxx_switch_irq_chip;
+	ps->switch_irq_masked = ~0;
+
+	reg = _mv88e6xxx_reg_read(ds, REG_GLOBAL, GLOBAL_CONTROL);
+	if (reg < 0) {
+		err = reg;
+		goto out;
+	}
+
+	reg &= ~mask;
+
+	err = _mv88e6xxx_reg_write(ds, REG_GLOBAL, GLOBAL_CONTROL, reg);
+	if (err < 0)
+		goto out;
+
+	/* Reading the interrupt status clears (most of) them */
+	reg = _mv88e6xxx_reg_read(ds, REG_GLOBAL, GLOBAL_STATUS);
+	if (reg < 0) {
+		err = reg;
+		goto out;
+	}
+
+	err = request_threaded_irq(ds->pd->irq, NULL,
+				   mv88e6xxx_switch_irq_thread_fn,
+				   IRQF_ONESHOT | IRQF_TRIGGER_FALLING,
+				   "mv88e6xxx-switch", ds);
+
+	if (err)
+		goto out;
+
+	return 0;
+
+out:
+	irq_domain_remove(ps->switch_irq_domain);
+	return err;
+}
+
+static void mv88e6xxx_device_irq_mask(struct irq_data *d)
+{
+	struct dsa_switch *ds = irq_data_get_irq_chip_data(d);
+	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+	unsigned int n = d->hwirq;
+
+	ps->device_irq_masked |= (1 << n);
+}
+
+static void mv88e6xxx_device_irq_unmask(struct irq_data *d)
+{
+	struct dsa_switch *ds = irq_data_get_irq_chip_data(d);
+	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+	unsigned int n = d->hwirq;
+
+	ps->device_irq_masked &= ~(1 << n);
+}
+
+static irqreturn_t mv88e6xxx_device_irq_thread_fn(int irq, void *dev_id)
+{
+	struct dsa_switch *ds = (struct dsa_switch *)dev_id;
+	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+	unsigned nhandled = 0;
+	unsigned sub_irq;
+	unsigned n;
+	int val;
+
+	val = _mv88e6xxx_reg_read(ds, REG_GLOBAL2, GLOBAL2_INT_SOURCE);
+	if (val < 0)
+		goto out;
+
+	for (n = 0; n < 16; ++n) {
+		if (val & (1 << n)) {
+			sub_irq = irq_find_mapping(ps->device_irq_domain, n);
+			handle_nested_irq(sub_irq);
+			++nhandled;
+		}
+	}
+out:
+	return (nhandled > 0 ? IRQ_HANDLED : IRQ_NONE);
+}
+
+static void mv88e6xxx_device_irq_bus_lock(struct irq_data *d)
+{
+	struct dsa_switch *ds = irq_data_get_irq_chip_data(d);
+	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+
+	mutex_lock(&ps->smi_mutex);
+}
+
+static void mv88e6xxx_device_irq_bus_sync_unlock(struct irq_data *d)
+{
+	struct dsa_switch *ds = irq_data_get_irq_chip_data(d);
+	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+	int ret;
+
+	ret = _mv88e6xxx_reg_write(ds, REG_GLOBAL2, GLOBAL2_INT_MASK,
+				   ~ps->device_irq_masked);
+	if (ret < 0)
+		goto out;
+
+out:
+	mutex_unlock(&ps->smi_mutex);
+}
+
+static struct irq_chip mv88e6xxx_device_irq_chip = {
+	.name			= "mv88e6xxx-device",
+	.irq_mask		= mv88e6xxx_device_irq_mask,
+	.irq_unmask		= mv88e6xxx_device_irq_unmask,
+	.irq_bus_lock		= mv88e6xxx_device_irq_bus_lock,
+	.irq_bus_sync_unlock	= mv88e6xxx_device_irq_bus_sync_unlock,
+};
+
+static int mv88e6xxx_device_irq_domain_map(struct irq_domain *d,
+					   unsigned int irq,
+					   irq_hw_number_t hwirq)
+{
+	struct dsa_switch *ds = d->host_data;
+	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+
+	irq_set_chip_data(irq, d->host_data);
+	irq_set_chip_and_handler(irq, &ps->device_irq_chip, handle_level_irq);
+	irq_set_noprobe(irq);
+
+	return 0;
+}
+
+static const struct irq_domain_ops mv88e6xxx_device_irq_domain_ops = {
+	.map	= mv88e6xxx_device_irq_domain_map,
+	.xlate	= irq_domain_xlate_twocell,
+};
+
+int mv88e6xxx_setup_device_irq(struct dsa_switch *ds)
+{
+	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+	struct device_node *np = ds->pd->of_node;
+	int device_irq;
+	int err, irq;
+
+	ps->device_irq_domain = irq_domain_add_simple(
+		np, 16, 0, &mv88e6xxx_device_irq_domain_ops, ds);
+	if (!ps->device_irq_domain)
+		return -ENOMEM;
+
+	for (irq = 0; irq < 16; irq++)
+		irq_create_mapping(ps->device_irq_domain, irq);
+
+	ps->device_irq_chip = mv88e6xxx_device_irq_chip;
+	ps->device_irq_masked = ~0;
+
+	device_irq = irq_find_mapping(ps->switch_irq_domain,
+				      GLOBAL_STATUS_IRQ_DEVICE);
+	if (device_irq < 0) {
+		err = device_irq;
+		goto out;
+	}
+
+	err = request_threaded_irq(device_irq, NULL,
+				   mv88e6xxx_device_irq_thread_fn,
+				   IRQF_ONESHOT, "mv88e6xxx-device", ds);
+	if (err)
+		goto out;
+
+	return 0;
+out:
+	irq_domain_remove(ps->device_irq_domain);
+	return err;
+}
+
+int mv88e6xxx_setup_irqs(struct dsa_switch *ds)
+{
+	int err;
+
+	if (ds->pd->irq) {
+		err = mv88e6xxx_setup_switch_irq(ds);
+		if (err)
+			return err;
+
+		if (mv88e6xxx_6165_family(ds) || mv88e6xxx_6351_family(ds) ||
+		    mv88e6xxx_6352_family(ds))
+			return mv88e6xxx_setup_device_irq(ds);
+	}
+	return 0;
+}
+
 int mv88e6xxx_setup_common(struct dsa_switch *ds)
 {
 	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
diff --git a/drivers/net/dsa/mv88e6xxx.h b/drivers/net/dsa/mv88e6xxx.h
index 3425616987ed..bb97fdc21e0e 100644
--- a/drivers/net/dsa/mv88e6xxx.h
+++ b/drivers/net/dsa/mv88e6xxx.h
@@ -12,6 +12,7 @@
 #define __MV88E6XXX_H
 
 #include <linux/if_vlan.h>
+#include <linux/irq.h>
 
 #ifndef UINT64_MAX
 #define UINT64_MAX		(u64)(~((u64)0))
@@ -185,6 +186,15 @@
 #define GLOBAL_STATUS_PPU_INITIALIZING	(0x1 << 14)
 #define GLOBAL_STATUS_PPU_DISABLED	(0x2 << 14)
 #define GLOBAL_STATUS_PPU_POLLING	(0x3 << 14)
+#define GLOBAL_STATUS_IRQ_AVB		8
+#define GLOBAL_STATUS_IRQ_DEVICE	7
+#define GLOBAL_STATUS_IRQ_STATS		6
+#define GLOBAL_STATUS_IRQ_VTU_PROBLEM	5
+#define GLOBAL_STATUS_IRQ_VTU_DONE	4
+#define GLOBAL_STATUS_IRQ_ATU_PROBLEM	3
+#define GLOBAL_STATUS_IRQ_ATU_DONE	2
+#define GLOBAL_STATUS_IRQ_TCAM_DONE	1
+#define GLOBAL_STATUS_IRQ_EEPROM_DONE	0
 #define GLOBAL_MAC_01		0x01
 #define GLOBAL_MAC_23		0x02
 #define GLOBAL_MAC_45		0x03
@@ -428,6 +438,17 @@ struct mv88e6xxx_priv_state {
 
 	DECLARE_BITMAP(port_state_update_mask, DSA_MAX_PORTS);
 
+	/* Main switch interrupt controller */
+	u16 switch_irq_masked;
+	struct irq_chip switch_irq_chip;
+	struct irq_domain *switch_irq_domain;
+	unsigned switch_nirqs;
+
+	/* Device interrupt controller */
+	u16 device_irq_masked;
+	struct irq_chip device_irq_chip;
+	struct irq_domain *device_irq_domain;
+
 	struct work_struct bridge_work;
 };
 
@@ -451,6 +472,7 @@ char *mv88e6xxx_lookup_name(struct device *host_dev, int sw_addr,
 int mv88e6xxx_setup_ports(struct dsa_switch *ds);
 int mv88e6xxx_setup_common(struct dsa_switch *ds);
 int mv88e6xxx_setup_global(struct dsa_switch *ds);
+int mv88e6xxx_setup_irqs(struct dsa_switch *ds);
 int mv88e6xxx_reg_read(struct dsa_switch *ds, int addr, int reg);
 int mv88e6xxx_reg_write(struct dsa_switch *ds, int addr, int reg, u16 val);
 int mv88e6xxx_set_addr_direct(struct dsa_switch *ds, u8 *addr);
-- 
2.7.0

^ permalink raw reply related

* [RFC PATCH 8/8] net: phy: Use threaded IRQ, to allow IRQ from sleeping devices
From: Andrew Lunn @ 2016-03-14  0:33 UTC (permalink / raw)
  To: netdev, Florian Fainelli, Jason Cooper, Vivien Didelot; +Cc: Andrew Lunn
In-Reply-To: <1457915631-16696-1-git-send-email-andrew@lunn.ch>

The interrupt lines from PHYs maybe connected to I2C bus expanders, or
from switches on MDIO busses. Such interrupts are sourced from devices
which sleep, so use threaded interrupts. Threaded require that the
interrupt requester also uses the threaded API. Change the phylib to
use the threaded API, which is backwards compatible with none-threaded
IRQs.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/phy/phy.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 5590b9c182c9..54a623c93e49 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -641,8 +641,9 @@ phy_err:
 int phy_start_interrupts(struct phy_device *phydev)
 {
 	atomic_set(&phydev->irq_disable, 0);
-	if (request_irq(phydev->irq, phy_interrupt, 0, "phy_interrupt",
-			phydev) < 0) {
+	if (request_threaded_irq(phydev->irq, NULL, phy_interrupt,
+				 IRQF_ONESHOT, "phy_interrupt",
+				 phydev) < 0) {
 		pr_warn("%s: Can't get IRQ %d (PHY)\n",
 			phydev->mdio.bus->name, phydev->irq);
 		phydev->irq = PHY_POLL;
-- 
2.7.0

^ permalink raw reply related

* [RFC PATCH 5/8] dsa: mv88e6123_61_65: Wire up the mv88e6xxx interrupt code
From: Andrew Lunn @ 2016-03-14  0:33 UTC (permalink / raw)
  To: netdev, Florian Fainelli, Jason Cooper, Vivien Didelot; +Cc: Andrew Lunn
In-Reply-To: <1457915631-16696-1-git-send-email-andrew@lunn.ch>

Make use of the shared interrupt code, so for example phy interrupts
can be passed onto the phylib.
---
 drivers/net/dsa/mv88e6123_61_65.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/mv88e6123_61_65.c b/drivers/net/dsa/mv88e6123_61_65.c
index d4fcf4570d95..c8111007ef24 100644
--- a/drivers/net/dsa/mv88e6123_61_65.c
+++ b/drivers/net/dsa/mv88e6123_61_65.c
@@ -97,7 +97,11 @@ static int mv88e6123_61_65_setup(struct dsa_switch *ds)
 	if (ret < 0)
 		return ret;
 
-	return mv88e6xxx_setup_ports(ds);
+	ret = mv88e6xxx_setup_ports(ds);
+	if (ret < 0)
+		return ret;
+
+	return mv88e6xxx_setup_irqs(ds);
 }
 
 struct dsa_switch_driver mv88e6123_61_65_switch_driver = {
-- 
2.7.0

^ permalink raw reply related

* [RFC PATCH 7/8] net: dsa: Support phy interrupt property for switch ports.
From: Andrew Lunn @ 2016-03-14  0:33 UTC (permalink / raw)
  To: netdev, Florian Fainelli, Jason Cooper, Vivien Didelot; +Cc: Andrew Lunn
In-Reply-To: <1457915631-16696-1-git-send-email-andrew@lunn.ch>

Switch ports can be connected to phys. These phys can support
interrupts when the link goes up/down. Allow the phy interrupt to be
expressed in device tree, and pass it to the phylib when the phy is
bound to the switch port.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 Documentation/devicetree/bindings/net/dsa/dsa.txt |  3 +++
 net/dsa/dsa_priv.h                                |  1 +
 net/dsa/slave.c                                   | 11 ++++++++++-
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.txt b/Documentation/devicetree/bindings/net/dsa/dsa.txt
index 90a4fe115e50..780c96f37508 100644
--- a/Documentation/devicetree/bindings/net/dsa/dsa.txt
+++ b/Documentation/devicetree/bindings/net/dsa/dsa.txt
@@ -55,6 +55,9 @@ Optionnal property:
 			  Documentation/devicetree/bindings/net/ethernet.txt
 			  for details.
 
+- interrupt-parent	: property with a value describing the phy
+- interrupts		  interrupt number. See Documentation/devicetree/bindings/net/phy.txt
+
 - phy-mode		: String representing the connection to the designated
 			  PHY node specified by the 'phy-handle' property. See
 			  Documentation/devicetree/bindings/net/ethernet.txt
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 1d1a54687e4a..5ce368ea0464 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -46,6 +46,7 @@ struct dsa_slave_priv {
 	int			old_link;
 	int			old_pause;
 	int			old_duplex;
+	int			phy_irq;
 
 	struct net_device	*bridge_dev;
 #ifdef CONFIG_NET_POLL_CONTROLLER
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 27bf03d11670..155bddc43624 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -13,6 +13,7 @@
 #include <linux/netdevice.h>
 #include <linux/phy.h>
 #include <linux/phy_fixed.h>
+#include <linux/of_irq.h>
 #include <linux/of_net.h>
 #include <linux/of_mdio.h>
 #include <linux/mdio.h>
@@ -921,6 +922,10 @@ static int dsa_slave_phy_connect(struct dsa_slave_priv *p,
 	/* Use already configured phy mode */
 	if (p->phy_interface == PHY_INTERFACE_MODE_NA)
 		p->phy_interface = p->phy->interface;
+
+	if (p->phy_irq)
+		p->phy->irq = p->phy_irq;
+
 	phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link,
 			   p->phy_interface);
 
@@ -935,7 +940,7 @@ static int dsa_slave_phy_setup(struct dsa_slave_priv *p,
 	struct device_node *phy_dn, *port_dn;
 	bool phy_is_fixed = false;
 	u32 phy_flags = 0;
-	int mode, ret;
+	int mode, ret, irq;
 
 	port_dn = cd->port_dn[p->port];
 	mode = of_get_phy_mode(port_dn);
@@ -943,6 +948,10 @@ static int dsa_slave_phy_setup(struct dsa_slave_priv *p,
 		mode = PHY_INTERFACE_MODE_NA;
 	p->phy_interface = mode;
 
+	irq = irq_of_parse_and_map(port_dn, 0);
+	if (irq > 0)
+		p->phy_irq = irq;
+
 	phy_dn = of_parse_phandle(port_dn, "phy-handle", 0);
 	if (of_phy_is_fixed_link(port_dn)) {
 		/* In the case of a fixed PHY, the DT node associated
-- 
2.7.0

^ permalink raw reply related

* [RFC PATCH 6/8] dsa: mv88e6131: Wire up the mv88e6xxx interrupt code
From: Andrew Lunn @ 2016-03-14  0:33 UTC (permalink / raw)
  To: netdev, Florian Fainelli, Jason Cooper, Vivien Didelot; +Cc: Andrew Lunn
In-Reply-To: <1457915631-16696-1-git-send-email-andrew@lunn.ch>

Make use of the shared interrupt code, so for example phy interrupts
can be passed onto the phylib.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/dsa/mv88e6131.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/mv88e6131.c b/drivers/net/dsa/mv88e6131.c
index a92ca651c399..03031afbcb10 100644
--- a/drivers/net/dsa/mv88e6131.c
+++ b/drivers/net/dsa/mv88e6131.c
@@ -121,7 +121,12 @@ static int mv88e6131_setup(struct dsa_switch *ds)
 	if (ret < 0)
 		return ret;
 
-	return mv88e6xxx_setup_ports(ds);
+	ret = mv88e6xxx_setup_ports(ds);
+
+	if (ret < 0)
+		return ret;
+
+	return mv88e6xxx_setup_irqs(ds);
 }
 
 static int mv88e6131_port_to_phy_addr(struct dsa_switch *ds, int port)
-- 
2.7.0

^ permalink raw reply related

* [RFC PATCH 4/8] dsa: mv88e6171: Wire up the mv88e6xxx interrupt code
From: Andrew Lunn @ 2016-03-14  0:33 UTC (permalink / raw)
  To: netdev, Florian Fainelli, Jason Cooper, Vivien Didelot; +Cc: Andrew Lunn
In-Reply-To: <1457915631-16696-1-git-send-email-andrew@lunn.ch>

Make use of the shared interrupt code, so for example phy interrupts
can be passed onto the phylib.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/dsa/mv88e6171.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/mv88e6171.c b/drivers/net/dsa/mv88e6171.c
index d72ccbdf53ec..5ed174ff533f 100644
--- a/drivers/net/dsa/mv88e6171.c
+++ b/drivers/net/dsa/mv88e6171.c
@@ -83,7 +83,11 @@ static int mv88e6171_setup(struct dsa_switch *ds)
 	if (ret < 0)
 		return ret;
 
-	return mv88e6xxx_setup_ports(ds);
+	ret = mv88e6xxx_setup_ports(ds);
+	if (ret < 0)
+		return ret;
+
+	return mv88e6xxx_setup_irqs(ds);
 }
 
 struct dsa_switch_driver mv88e6171_switch_driver = {
-- 
2.7.0

^ permalink raw reply related

* [RFC PATCH 3/8] dsa: mv88e6352: Wire up the mv88e6xxx interrupt code
From: Andrew Lunn @ 2016-03-14  0:33 UTC (permalink / raw)
  To: netdev, Florian Fainelli, Jason Cooper, Vivien Didelot; +Cc: Andrew Lunn
In-Reply-To: <1457915631-16696-1-git-send-email-andrew@lunn.ch>

Make use of the shared interrupt code, so for example phy interrupts
can be passed onto the phylib.
---
 drivers/net/dsa/mv88e6352.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/mv88e6352.c b/drivers/net/dsa/mv88e6352.c
index a41fa5043d77..7f83013a61f6 100644
--- a/drivers/net/dsa/mv88e6352.c
+++ b/drivers/net/dsa/mv88e6352.c
@@ -97,7 +97,11 @@ static int mv88e6352_setup(struct dsa_switch *ds)
 	if (ret < 0)
 		return ret;
 
-	return mv88e6xxx_setup_ports(ds);
+	ret = mv88e6xxx_setup_ports(ds);
+	if (ret < 0)
+		return ret;
+
+	return mv88e6xxx_setup_irqs(ds);
 }
 
 static int mv88e6352_read_eeprom_word(struct dsa_switch *ds, int addr)
-- 
2.7.0

^ permalink raw reply related

* Re: [ethtool PATCH v4 00/11] add support for new ETHTOOL_xLINKSETTINGS ioctls
From: Ben Hutchings @ 2016-03-14  0:27 UTC (permalink / raw)
  To: David Decotigny, netdev
  Cc: Jeff Garzik, David Miller, Vidya Sagar Ravipati, Joe Perches,
	David Decotigny
In-Reply-To: <1457890220.3331.41.camel@decadent.org.uk>

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

On Sun, 2016-03-13 at 17:30 +0000, Ben Hutchings wrote:
[...]
> Patch 11: you need to answer my question about this.

[This is about why/whether there should be a fallback from creating an
AF_INET socket to issue SIOCETHTOOL on.]

I looked a little further, and found:
- The only address/protocol family that is always present in the kernel
  (assuming CONFIG_NET=y) is netlink
- Netlink sockets don't support ioctl at all

So there seems to be no right answer to 'which family of socket should
I create to perform device ioctls'.  There really ought to be!

Ben.

-- 
Ben Hutchings
If at first you don't succeed, you're doing about average.

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

^ permalink raw reply

* Re: [PATCH v2.1 3/9] net: arc_emac: support the phy reset for emac driver
From: Caesar Wang @ 2016-03-14  0:21 UTC (permalink / raw)
  To: David Miller
  Cc: wxt, heiko, sergei.shtylyov, netdev, linux-kernel, linux-rockchip,
	robh+dt
In-Reply-To: <20160313.140231.1768726602233933637.davem@davemloft.net>



在 2016年03月14日 02:02, David Miller 写道:
> When you submit a new version of a patch that's part of a series,
> you must submit the entire series anew, not just the patch which is
> changing.

Thanks for reminding me.

I think it's not good to respin-respin since the build error.
So that just send a bit fixes before the other patches are reviewed.
)

Anyway, you said that's right.


>
> Thanks.
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip


-- 
Thanks,
Caesar

^ permalink raw reply

* Re: [PATCH next v2 0/7] Introduce l3_dev pointer for L3 processing
From: Mahesh Bandewar @ 2016-03-14  0:01 UTC (permalink / raw)
  To: Cong Wang
  Cc: Nicolas Dichtel, Mahesh Bandewar, David Miller, Eric Dumazet,
	netdev, Eric W. Biederman, Cong Wang
In-Reply-To: <CAM_iQpUFB4TO=nByzT-8ZESKL8ecLJKYRdCcYRPWBqQ10_Dtnw@mail.gmail.com>

>> If I understand correctly (and as Cong already said), information are
>> leaking
>> between netns during the input phase. On the tx side, skb_scrub_packet() is
>> called, but not on the rx side. I think it's wrong. There should be an
>> explicit
>> boundary.
>
> That is not what I am complaining about.
>
> I dislike the trick of switching skb->dev pointer with skb->dev->l3_dev.
> This is not how we switch netns, nor the way how netns works.
>
How it is different from what we are doing currently?

Current: Use skb->dev for L3 processing and derive netns from skb->dev
Proposal: use skb->dev->l3_dev for L3 processing and derive netns from
skb->dev->l3_dev

> Look at veth pair or dev_change_net_namespace(), each time when we
> switch netns, we need to do a full reregistration or a full reentrance, we
> never just switch some pointers to switch netns. This is why I said it breaks
> isolation.
>
> Also, it is ugly to hide such a ipvlan-specific pointer for half of the RX code
> path.
I think I have already mentioned, I'm adding RX code now and later
I'll add TX code to use
l3_dev to make it symmetric. This way all L3 (Tx/Rx) will use this
device reference
always.

^ permalink raw reply

* Re: [PATCH next v2 0/7] Introduce l3_dev pointer for L3 processing
From: Mahesh Bandewar @ 2016-03-13 23:44 UTC (permalink / raw)
  To: nicolas.dichtel
  Cc: Mahesh Bandewar, David Miller, Eric Dumazet, netdev,
	Eric W. Biederman, Cong Wang
In-Reply-To: <56E14296.5010103@6wind.com>

> If I understand correctly (and as Cong already said), information are
> leaking
> between netns during the input phase. On the tx side, skb_scrub_packet() is
> called, but not on the rx side. I think it's wrong. There should be an
> explicit
> boundary.
>
I think we used to do dev_forward_skb() in the RX path which used to
do skb_scrub_packet().
When we added the optimization to avoid queuing second time just to
deliver packet to the
slave (by doing RX_HANDLER_ANOTHER), we lost the skb_scrub_packet()
which we used to
get automatically. I believe we can add that! Thanks for pointing it out.

> Another small comment: maybe finding another name than l3_dev could help to
> avoid confusion with the existing l3mdev.
I have absolutely no preference for the name. I used it to indicate
this is the *L3 device*.
Please suggest.

^ permalink raw reply

* Re: [PATCH v6 net-next 0/2] tcp: Redundant Data Bundling (RDB)
From: Bendik Rønning Opstad @ 2016-03-13 23:18 UTC (permalink / raw)
  To: Yuchung Cheng
  Cc: David S. Miller, netdev, Eric Dumazet, Neal Cardwell,
	Andreas Petlund, Carsten Griwodz, Pål Halvorsen,
	Jonas Markussen, Kristian Evensen, Kenneth Klette Jonassen
In-Reply-To: <CAK6E8=eKu_0ReSDLYdyajxMyX2MaN=wDLHvq=u_tyNnMRS31sw@mail.gmail.com>

On 03/10/2016 01:20 AM, Yuchung Cheng wrote:
> I read the paper. I think the underlying idea is neat. but the
> implementation is little heavy-weight that requires changes on fast
> path (tcp_write_xmit) and space in skb control blocks.

Yuchung, thank you for taking the time to review the patch submission
and read the paper.

I must admit I was not particularly happy about the extra if-test on the
fast path, and I fully understand the wish to keep the fast path as
simple and clean as possible.
However, is the performance hit that significant considering the branch
prediction hint for the non-RDB path?

The extra variable needed in the SKB CB does not require increasing the
CB buffer size due to the "tcp: refactor struct tcp_skb_cb" patch:
http://patchwork.ozlabs.org/patch/510674 and uses only some of the space
made available in the outgoing SKBs' CB. Therefore I hoped the extra
variable would be acceptable.

> ultimately this
> patch is meant for a small set of specific applications.

Yes, the RDB mechanism is aimed at a limited set of applications,
specifically time-dependent applications that produce non-greedy,
application limited (thin) flows. However, our hope is that RDB may
greatly improve TCP's position as a viable alternative for applications
transmitting latency sensitive data.

> In my mental model (please correct me if I am wrong), losses on these
> thin streams would mostly resort to RTOs instead of fast recovery, due
> to the bursty nature of Internet losses.

This depends on the transmission pattern of the applications, which
varies to a great deal, also between the different types of
time-dependent applications that produce thin streams. For short flows,
(bursty) loss at the end will result in an RTO (if TLP does not probe),
but the thin streams are often long lived, and the applications
producing them continue to write small data segments to the socket at
intervals of tens to hundreds of milliseconds.

What controls if an RTO and not fast retransmit will resend the packet,
is the number of PIFs, which directly correlates to how often the
application writes data to the socket in relation to the RTT. As long as
the number of packets successfully completing a round trip before the
RTO is >= the dupACK threshold, they will not depend on RTOs (not
considering TLP). Early retransmit and the TCP_THIN_DUPACK socket option
will also affect the likelihood of RTOs vs fast retransmits.

> The HOLB comes from RTO only
> retransmit the first (tiny) unacked packet while a small of new data is
> readily available. But since Linux congestion control is packet-based,
> and loss cwnd is 1, the new data needs to wait until the 1st packet is
> acked which is for another RTT.

If I understand you correctly, you are referring to HOLB on the sender
side, which is the extra delay on new data that is held back when the
connection is CWND-limited. In the paper, we refer to this extra delay
as increased sojourn times for the outgoing data segments.

We do not include this additional sojourn time for the segments on the
sender side in the ACK Latency plots (Fig. 4 in the paper). This is
simply because the pcap traces contain the timestamps when the packets
are sent, and not when the segments are added to the output queue.

When we refer to the HOLB effect in the paper as well as the thesis, we
refer to the extra delays (sojourn times) on the receiver side where
segments are held back (not made available to user space) due to gaps in
the sequence range when packets are lost (we had no reordering).

So, when considering the increased delays due to HOLB on the receiver
side, HOLB is not at all limited to RTOs. Actually, it's mostly not due
to RTOs in the tests we've run, however, this also depends very much on
the transmission pattern of the application as well as loss levels.
In general, HOLB on the receiver side will affect any flow that
transmits a packet with new data after a packet is lost (sender may not
know yet), where the lost packet has not already been retransmitted.

Consider a sender application that performs write calls every 30 ms on a
150 ms RTT link. It will need a CWND that allows 5-6 PIFs to be able to
transmit all new data segments with no extra sojourn times on the sender
side.
When one packet is lost, the next 5 packets that are sent will be held
back on the receiver side due to the missing segment (HOLB). In the best
case scenario, the first dupACK triggers a fast retransmit around the
same time as the fifth packet (after the lost packet) is sent. In that
case, the first segment sent after the lost segment is held back on the
receiver for 150 ms (the time it takes for the dupACK to reach the
sender, and the fast retrans to arrive at the receiver). The second is
held back 120 ms, the third 90 ms, the fourth 60 ms, an the fifth 30 ms.

All of this extra delay is added before the sender even knows there was
a loss. How it decides to react to the loss signal (dupACKs) will
further decide how much extra delays will be added in addition to the
delays already inflicted on the segments by the HOLB.

> Instead what if we only perform RDB on the (first and recurring) RTO
> retransmission?

That will change RDB from being a proactive mechanism, to being
reactive, i.e. change how the sender responds to the loss signal. The
problem is that by this point (when the sender has received the loss
signal), the HOLB on the receiver side has already caused significant
increases to the application layer latency.

The reason the RDB streams (in red) in fig. 4 in the paper get such low
latencies is because there are almost no retransmissions. With 10%
uniform loss, the latency for 90% of the packets is not affected at all.
The latency for most of the lost segments is only increased by 30 ms,
which is when the next RDB packet arrives at the receiver with the lost
segment bundled in the payload.
For the regular TCP streams (blue), the latency for 40% of the segments
is affected, where almost 30% of the segments have additional delays of
150 ms or more.
It is important to note that the increases to the latencies for the
regular TCP streams compared to the RDB streams are solely due to HOLB
on the receiver side.

The longer the RTT, the greater the gains are by using RDB, considering
the best case scenario of minimum one RTT required for a retransmission.
As such, RDB will reduce the latencies the most for those that also need
it the most.

However, even with an RTT of 20 ms, an application writing a data
segment every 10 ms will still get significant latency reductions simply
because a retransmission will require a minimum of 20 ms, compared to
the 10 ms it takes for the next RDB packet to arrive at the receiver.


Bendik

^ permalink raw reply

* Re: [v6, 5/5] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0
From: Arnd Bergmann @ 2016-03-13 22:26 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Yangbo Lu, devicetree, linux-arm-kernel, linux-kernel, linux-clk,
	linux-i2c, iommu, netdev, linux-mmc, ulf.hansson, Zhao Qiang,
	Russell King, Bhupesh Sharma, Joerg Roedel, Santosh Shilimkar,
	scott.wood, Rob Herring, Claudiu Manoil, Kumar Gala, leoyang.li,
	xiaobo.xie
In-Reply-To: <1457518131-11339-6-git-send-email-yangbo.lu@nxp.com>

On Wednesday 09 March 2016 18:08:51 Yangbo Lu wrote:
> @@ -567,10 +580,20 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)
>         struct sdhci_pltfm_host *pltfm_host;
>         struct sdhci_esdhc *esdhc;
>         u16 host_ver;
> +       u32 svr;
>  
>         pltfm_host = sdhci_priv(host);
>         esdhc = sdhci_pltfm_priv(pltfm_host);
>  
> +       fsl_guts_init();
> +       svr = fsl_guts_get_svr();
> +       if (svr) {
> +               esdhc->soc_ver = SVR_SOC_VER(svr);
> +               esdhc->soc_rev = SVR_REV(svr);
> +       } else {
> +               dev_err(&pdev->dev, "Failed to get SVR value!\n");
> +       }
> +

This makes the driver non-portable. Better identify the specific workarounds
based on the compatible string for this device, or add a boolean DT property
for the quirk.

	Arnd

^ permalink raw reply

* Re: [PATCH v2 2/3] of_mdio: use IS_ERR_OR_NULL()
From: Arnd Bergmann @ 2016-03-13 22:22 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: grant.likely-QSEj5FYQhm4dnm+yROfE0A,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, devicetree-u79uwXL29TY76Z2rM5mHXA,
	f.fainelli-Re5JQEeQqe8AvxtiuMwx3w, netdev-u79uwXL29TY76Z2rM5mHXA,
	frowand.list-Re5JQEeQqe8AvxtiuMwx3w
In-Reply-To: <2638820.ej0i0xi4Er-gHKXc3Y1Z8zGSmamagVegGFoWSdPRAKMAL8bYrjMMd8@public.gmane.org>

On Sunday 13 March 2016 00:34:02 Sergei Shtylyov wrote:
> IS_ERR_OR_NULL() is open coded in of_mdiobus_register_phy(), so just call
> it directly...
> 
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
> Reviewed-by: Florian Fainelli <f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> ---
> Changes in version 2:
> - removed the of_mdiobus_register_device() hunk;
> - added the "Reviewed-by:" tag.
> 
>  drivers/of/of_mdio.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Index: net-next/drivers/of/of_mdio.c
> ===================================================================
> --- net-next.orig/drivers/of/of_mdio.c
> +++ net-next/drivers/of/of_mdio.c
> @@ -56,7 +56,7 @@ static int of_mdiobus_register_phy(struc
>                 phy = phy_device_create(mdio, addr, phy_id, 0, NULL);
>         else
>                 phy = get_phy_device(mdio, addr, is_c45);
> -       if (!phy || IS_ERR(phy))
> +       if (IS_ERR_OR_NULL(phy))
>                 return 1;
>  
>         rc = irq_of_parse_and_map(child, 0);
> 
> 

IS_ERR_OR_NULL() usually indicates that the code is wrong, or that
an API has been misdesigned.

Can you clarify in the changelog which one it is, or (better) change
it so that 'phy' in this function is either NULL or IS_ERR() in case
of an error but not both?

I think moving the 'if (problem) return 1' into the two if/else
is a correct transformation that also makes it very clear what
is going on here.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH] sh_eth: do not call netif_start_queue() from sh_eth_dev_init()
From: Sergei Shtylyov @ 2016-03-13 22:09 UTC (permalink / raw)
  To: netdev, linux-renesas-soc

Iff  sh_eth_phy_start() call fails in sh_eth_open(), the netif_start_queue()
call done by sh_eth_dev_init()  is not undone.  In order to deal with that,
stop calling netif_start_queue()  from there, so that it can be called only
when the device is fully opened and sh_eth_dev_init() only deals with the
hardware initialization, symmetrically to sh_eth_dev_exit()...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
DaveM, I'm not sure whether it's a bug to leave TX queue started when the
device opening fails... anyway since  the 'net,git' repo is closed,  this
patch  is against your 'net-next.git' repo.

 drivers/net/ethernet/renesas/sh_eth.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net-next/drivers/net/ethernet/renesas/sh_eth.c
@@ -1312,8 +1312,6 @@ static int sh_eth_dev_init(struct net_de
 	if (start) {
 		/* Setting the Rx mode will start the Rx process. */
 		sh_eth_write(ndev, EDRRR_R, EDRRR);
-
-		netif_start_queue(ndev);
 	}
 
 	return ret;
@@ -2261,6 +2259,8 @@ static int sh_eth_open(struct net_device
 	if (ret)
 		goto out_free_irq;
 
+	netif_start_queue(ndev);
+
 	mdp->is_opened = 1;
 
 	return ret;
@@ -2304,6 +2304,8 @@ static void sh_eth_tx_timeout(struct net
 
 	/* device init */
 	sh_eth_dev_init(ndev, true);
+
+	netif_start_queue(ndev);
 }
 
 /* Packet transmit function */

^ permalink raw reply

* Re: [PATCH net-next 3/3] net: dsa: refine netdev event notifier
From: Jiri Pirko @ 2016-03-13 20:57 UTC (permalink / raw)
  To: Vivien Didelot
  Cc: netdev, linux-kernel, kernel, David S. Miller, Florian Fainelli,
	Andrew Lunn, Ido Schimmel, Kevin Smith
In-Reply-To: <1457900494-10266-4-git-send-email-vivien.didelot@savoirfairelinux.com>

Sun, Mar 13, 2016 at 09:21:34PM CET, vivien.didelot@savoirfairelinux.com wrote:
>Rework the netdev event handler, similar to what the Mellanox Spectrum
>driver does, to easily welcome more events later (for example
>NETDEV_PRECHANGEUPPER) and use netdev helpers (such as
>netif_is_bridge_master).
>
>Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>

Acked-by: Jiri Pirko <jiri@mellanox.com>

^ permalink raw reply

* Re: [PATCH net-next 2/3] net: dsa: make port_bridge_leave return void
From: Jiri Pirko @ 2016-03-13 20:56 UTC (permalink / raw)
  To: Vivien Didelot
  Cc: netdev, linux-kernel, kernel, David S. Miller, Florian Fainelli,
	Andrew Lunn, Ido Schimmel, Kevin Smith
In-Reply-To: <1457900494-10266-3-git-send-email-vivien.didelot@savoirfairelinux.com>

Sun, Mar 13, 2016 at 09:21:33PM CET, vivien.didelot@savoirfairelinux.com wrote:
>netdev_upper_dev_unlink() which notifies NETDEV_CHANGEUPPER, returns
>void, as well as del_nbp(). So there's no advantage to catch an eventual
>error from the port_bridge_leave routine at the DSA level.
>
>Make this routine void for the DSA layer and its existing drivers.
>
>Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>

Acked-by: Jiri Pirko <jiri@mellanox.com>

^ permalink raw reply

* Re: [PATCH net-next 1/3] net: dsa: rename port_*_bridge routines
From: Jiri Pirko @ 2016-03-13 20:56 UTC (permalink / raw)
  To: Vivien Didelot
  Cc: netdev, linux-kernel, kernel, David S. Miller, Florian Fainelli,
	Andrew Lunn, Ido Schimmel, Kevin Smith
In-Reply-To: <1457900494-10266-2-git-send-email-vivien.didelot@savoirfairelinux.com>

Sun, Mar 13, 2016 at 09:21:32PM CET, vivien.didelot@savoirfairelinux.com wrote:
>Rename DSA port_join_bridge and port_leave_bridge routines to
>respectively port_bridge_join and port_bridge_leave in order to respect
>an implicit Port::Bridge namespace.
>
>Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>

Acked-by: Jiri Pirko <jiri@mellanox.com>

^ permalink raw reply

* [PATCH net-next 0/3] net: dsa: finer bridging control
From: Vivien Didelot @ 2016-03-13 20:21 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, kernel, David S. Miller, Florian Fainelli,
	Andrew Lunn, Jiri Pirko, Ido Schimmel, Kevin Smith,
	Vivien Didelot

This patchset renames the bridging routines of the DSA layer, make the
unbridging routine return void, and rework the DSA netdev notifier handler,
similar to what the Mellanox Spectrum driver does.

Changes RFC -> v1:
  - drop unused NETDEV_PRECHANGEUPPER case
  - add Andrew's Tested-by tag

Vivien Didelot (3):
  net: dsa: rename port_*_bridge routines
  net: dsa: make port_bridge_leave return void
  net: dsa: refine netdev event notifier

Tested-by: Andrew Lunn <andrew@lunn.ch> 

 Documentation/networking/dsa/dsa.txt |  4 +--
 drivers/net/dsa/bcm_sf2.c            |  8 ++---
 drivers/net/dsa/mv88e6171.c          |  4 +--
 drivers/net/dsa/mv88e6352.c          |  4 +--
 drivers/net/dsa/mv88e6xxx.c          | 28 +++++----------
 drivers/net/dsa/mv88e6xxx.h          |  2 +-
 include/net/dsa.h                    |  4 +--
 net/dsa/slave.c                      | 67 +++++++++++++++++++-----------------
 8 files changed, 56 insertions(+), 65 deletions(-)

-- 
2.7.2

^ 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