From: Florian Fainelli <f.fainelli@gmail.com>
To: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Cc: netdev <netdev@vger.kernel.org>, Andrew Lunn <andrew@lunn.ch>,
John Crispin <john@phrozen.org>,
David Miller <davem@davemloft.net>
Subject: Re: [PATCH net-next v2 5/5] net: dsa: Stop accessing ds->dst->cpu_dp in drivers
Date: Wed, 7 Jun 2017 12:21:51 -0700 [thread overview]
Message-ID: <c8ecc6c3-2780-cf63-24f6-b546e837430e@gmail.com> (raw)
In-Reply-To: <87ink7oh1h.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>
On 06/07/2017 10:15 AM, Vivien Didelot wrote:
> Hi Florian,
>
> Florian Fainelli <f.fainelli@gmail.com> writes:
>
>>> So as I said in v2, now that a driver is guaranteed that dp->cpu_dp is
>>> correctly assigned at setup time, isn't better (especially for future
>>> multi-CPU support) to provide an helper which returns the CPU port for a
>>> given port? i.e. dsa_get_cpu_port(struct dsa_switch *ds, int port).
>>>
>>> Or is there something blocking? I might be wrong.
>>
>> mt7530.c needs access to the CPU port at ops->setup() time which is
>> why this is still here.
>
> Yes, mt7530 is the only one doing this and has an hardcoded CPU port. So
> what I meant was, shouldn't we have this instead:
>
> struct dsa_port *dsa_get_cpu_port(struct dsa_switch *ds, int port)
> {
> return ds->ports[port].cpu_dp;
> }
We don't actually have a CPU port point to itself:
+
+ for (i = 0; i < ds->num_ports; i++) {
+ p = &ds->ports[i];
+ if (!dsa_port_is_valid(p) ||
+ i == index) <=============
+ continue;
+
+ p->cpu_dp = port;
+ }
}
>
> And:
>
> - dn = ds->dst->cpu_dp->netdev->dev.of_node->parent;
> + cpu_dp = dsa_get_cpu_port(ds, MT7530_CPU_PORT);
> + dn = cpu_dp->netdev->dev.of_node->parent;
If we are giving the port number to get its cpu_dp pointer back, that
seems a bit pointless.
I still think the helper with fls(ds->cpu_port_mask) - 1 is better in
that it will return what you have configured from Device Tree/platform
data. MT7530 does allow the CPU port being arbitrary, and it would
disable MTK tags in that case.
Thanks!
--
Florian
next prev parent reply other threads:[~2017-06-07 19:22 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-07 0:03 [PATCH net-next v2 0/5] net: dsa: Multi-CPU ground work (v2) Florian Fainelli
2017-06-07 0:03 ` [PATCH net-next v2 1/5] net: dsa: Remove master_netdev and use dst->cpu_dp->netdev Florian Fainelli
2017-06-07 2:15 ` Vivien Didelot
2017-06-07 0:03 ` [PATCH net-next v2 2/5] net: dsa: Relocate master ethtool operations Florian Fainelli
2017-06-07 0:03 ` [PATCH net-next v2 3/5] net: dsa: Associate slave network device with CPU port Florian Fainelli
2017-06-07 0:03 ` [PATCH net-next v2 4/5] net: dsa: Introduce dsa_dst_get_cpu_dp() Florian Fainelli
2017-06-07 0:03 ` [PATCH net-next v2 5/5] net: dsa: Stop accessing ds->dst->cpu_dp in drivers Florian Fainelli
2017-06-07 2:11 ` Vivien Didelot
2017-06-07 2:38 ` Florian Fainelli
2017-06-07 17:15 ` Vivien Didelot
2017-06-07 19:21 ` Florian Fainelli [this message]
2017-06-07 19:27 ` Vivien Didelot
2017-06-07 23:24 ` Vivien Didelot
2017-06-08 0:27 ` Florian Fainelli
2017-06-08 1:03 ` Vivien Didelot
2017-06-07 0:05 ` [PATCH net-next v2 0/5] net: dsa: Multi-CPU ground work (v2) Florian Fainelli
2017-06-07 2:13 ` Vivien Didelot
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=c8ecc6c3-2780-cf63-24f6-b546e837430e@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=john@phrozen.org \
--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).