netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>, David Miller <davem@davemloft.net>,
	Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Cc: netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 15/17] net: dsa: Add new binding implementation
Date: Fri, 3 Jun 2016 14:19:48 -0700	[thread overview]
Message-ID: <5751F474.3050109@gmail.com> (raw)
In-Reply-To: <1464972256-10408-16-git-send-email-andrew@lunn.ch>

On 06/03/2016 09:44 AM, Andrew Lunn wrote:
> The existing DSA binding has a number of limitations and problems. The
> main problem is that it cannot represent a switch as a linux device,
> hanging off some bus. It is limited to one CPU port. The DSA platform
> device is artificial, and does not really represent hardware.
> 
> Implement a new binding which can be embedded into any type of node on
> a bus to represent one switch device, and its links to other switches.
> 
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Just a few nits that I had not seen before...


> diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
> index 6c314f300424..d8cb2acd4f0a 100644
> --- a/net/dsa/dsa.c
> +++ b/net/dsa/dsa.c
> @@ -294,6 +294,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
>  			}
>  			dst->cpu_switch = index;
>  			dst->cpu_port = i;
> +			ds->cpu_port_mask |= 1 << i;
>  		} else if (!strcmp(name, "dsa")) {
>  			ds->dsa_port_mask |= 1 << i;
>  		} else {

We might want to undo setting the cpu_port_mask bit in
dsa_cpu_dsa_destroy()?

[snip]

> +static int dsa_ds_complete(struct dsa_switch_tree *dst, struct dsa_switch *ds)
> +{
> +	struct device_node *port;
> +	u32 index;
> +	int err;
> +
> +	for (index = 0; index < DSA_MAX_PORTS; index++) {
> +		port = ds->ports[index].dn;
> +		if (!port)
> +			continue;
> +
> +		if (!dsa_port_is_dsa(port))
> +			continue;
> +
> +		ds->dsa_port_mask |= 1 << index;
> +
> +		err = dsa_port_complete(dst, ds, port, index);
> +		if (err != 0)

Should we move ds->dsa_port_mask |= 1 << index into dsa_port_complete,
for a) symetry with code undoing this, and b) avoid letting this bit be
set in case dsa_port_complete() returns an error?
-- 
Florian

  parent reply	other threads:[~2016-06-03 21:19 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-03 16:43 [PATCH net-next 00/17] New DSA bind, switches as devices Andrew Lunn
2016-06-03 16:44 ` [PATCH net-next 01/17] net: dsa: slave: chip data is optional, don't dereference NULL Andrew Lunn
2016-06-03 17:16   ` Florian Fainelli
2016-06-03 18:09   ` Vivien Didelot
2016-06-03 16:44 ` [PATCH net-next 02/17] net: dsa: mv88e6xxx: fix circular lock in PPU work Andrew Lunn
2016-06-03 21:11   ` Florian Fainelli
2016-06-03 16:44 ` [PATCH net-next 03/17] net: dsa: slave: Remove MDIO address from switch MDIO bus name Andrew Lunn
2016-06-03 17:16   ` Florian Fainelli
2016-06-03 18:10   ` Vivien Didelot
2016-06-03 16:44 ` [PATCH net-next 04/17] net: dsa: tag_{e}dsa.c: Remove dependency on platform data Andrew Lunn
2016-06-03 17:16   ` Florian Fainelli
2016-06-03 18:12   ` Vivien Didelot
2016-06-03 16:44 ` [PATCH net-next 05/17] net: dsa: Add a ports structure and use it in the switch structure Andrew Lunn
2016-06-03 18:16   ` Vivien Didelot
2016-06-03 18:21   ` Florian Fainelli
2016-06-03 16:44 ` [PATCH net-next 06/17] net: dsa: Move port device node into port structure Andrew Lunn
2016-06-03 18:19   ` Vivien Didelot
2016-06-03 18:21   ` Florian Fainelli
2016-06-03 16:44 ` [PATCH net-next 07/17] net: dsa: Remove dynamic allocate of routing table Andrew Lunn
2016-06-03 18:21   ` Vivien Didelot
2016-06-03 21:11   ` Florian Fainelli
2016-06-03 16:44 ` [PATCH net-next 08/17] net: dsa: Copy the routing table into the switch structure Andrew Lunn
2016-06-03 18:27   ` Vivien Didelot
2016-06-03 21:21   ` Florian Fainelli
2016-06-03 16:44 ` [PATCH net-next 09/17] net: dsa: Split up creating/destroying of DSA and CPU ports Andrew Lunn
2016-06-03 18:37   ` Vivien Didelot
2016-06-03 21:21   ` Florian Fainelli
2016-06-03 16:44 ` [PATCH net-next 10/17] net: dsa: mv88e6xxx: Only support EDSA tagging Andrew Lunn
2016-06-03 18:51   ` Vivien Didelot
2016-06-03 21:20   ` Florian Fainelli
2016-06-03 16:44 ` [PATCH net-next 11/17] net: dsa: Refactor selection of tag ops into a function Andrew Lunn
2016-06-03 17:19   ` Florian Fainelli
2016-06-03 19:04   ` Vivien Didelot
2016-06-03 16:44 ` [PATCH net-next 12/17] net: dsa: Make mdio bus optional Andrew Lunn
2016-06-03 17:21   ` Florian Fainelli
2016-06-03 16:44 ` [PATCH net-next 13/17] net: dsa: mv88e6xxx: Rename _phy_ to _mdio_ Andrew Lunn
2016-06-03 19:40   ` Vivien Didelot
2016-06-03 16:44 ` [PATCH net-next 14/17] net: dsa: mv88e6xxx: Refactor MDIO so driver registers mdio bus Andrew Lunn
2016-06-03 19:54   ` Vivien Didelot
2016-06-03 16:44 ` [PATCH net-next 15/17] net: dsa: Add new binding implementation Andrew Lunn
2016-06-03 20:06   ` Vivien Didelot
2016-06-03 21:19   ` Florian Fainelli [this message]
2016-06-03 16:44 ` [PATCH net-next 16/17] arm: dt: vf610-zii-devel-b: Make use of new DSA binding Andrew Lunn
2016-06-03 21:31   ` Vivien Didelot
2016-06-03 16:44 ` [PATCH net-next 17/17] net: dsa: Document new binding Andrew Lunn
2016-06-03 21:29   ` Vivien Didelot
2016-06-03 17:33 ` [PATCH net-next 00/17] New DSA bind, switches as devices Florian Fainelli
2016-06-03 20:38 ` Vivien Didelot
2016-06-04  5:41 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5751F474.3050109@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).