* Re: [PATCH net-next 1/3] net: phy: Create sysfs reciprocal links for attached_dev/phydev
From: Florian Fainelli @ 2017-05-27 1:26 UTC (permalink / raw)
To: Woojung.Huh, netdev; +Cc: davem, andrew
In-Reply-To: <9235D6609DB808459E95D78E17F2E43D40A9DB32@CHN-SV-EXMX02.mchp-main.com>
On 05/26/2017 06:00 PM, Woojung.Huh@microchip.com wrote:
> Hi Florian,
>>>> OK, so here is what is happening: macb_mii_init() calls macb_mii_probe()
>>>> and so by the time we call phy_connect_direct(), we have not called
>>>> register_netdevice() yet, netdev_register_kobject() has not been called
>>>> either, and so sysfs_create_link() fails....
>>> I just found same thing.
>>> Yes, register_netdev() was not called at phy_connect_direct() time.
>>>
>>>> Let me think about a way to solve that, even though I am leaning towards
>>>> ignoring the errors from sysfs_create_link() rather than fixing each and
>>>> every Ethernet driver to make it probe its MII bus *after* calling
>>>> register_netdevice()....
>>> Agree.
>>
>> Thanks, would the following work for you? I don't want to do something
>> more complex than that, although, if we really wanted to see this
>> information, we could imagine having netdev_register_kobject() check
>> whether phydev->dev.kobj is valid, and set the symbolic link at that
>> point... The problem with that approach is that we are no longer
>> symetrical within the core PHYLIB code (phy_attach_direct and phy_detach).
>>
>> Let me know if this works so I can make a formal submission:
>>
>> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
>> index f84414b8f2ee..daad816ee1d1 100644
>> --- a/drivers/net/phy/phy_device.c
>> +++ b/drivers/net/phy/phy_device.c
>> @@ -960,14 +960,20 @@ int phy_attach_direct(struct net_device *dev,
>> struct phy_device *phydev,
>>
>> phydev->attached_dev = dev;
>> dev->phydev = phydev;
>> +
>> + /* Some Ethernet drivers try to connect to a PHY device before
>> + * calling register_netdevice(). register_netdevice() does
>> ultimately
>> + * lead to netdev_register_kobject() which would do the
>> dev->dev.kobj
>> + * initialization. Here we explicitly ignore those particular errors
>> + */
>> err = sysfs_create_link(&phydev->mdio.dev.kobj, &dev->dev.kobj,
>> "attached_dev");
>> - if (err)
>> + if (err && err != -ENOENT)
>> goto error;
> This one fine. However, next one returns -14 (-EFAULT)
>
>> err = sysfs_create_link(&dev->dev.kobj, &phydev->mdio.dev.kobj,
>> "phydev");
>> - if (err)
>> + if (err && err != -ENOENT)
>> goto error;
> No need to call 2nd sysfs_create_link(), how about following?
>
> err = sysfs_create_link(&phydev->mdio.dev.kobj, &dev->dev.kobj,
> "attached_dev");
> - if (err)
> + if (err && err != -ENOENT)
> goto error;
>
> - err = sysfs_create_link(&dev->dev.kobj, &phydev->mdio.dev.kobj,
> - "phydev");
> - if (err)
> - goto error;
> + if (!err) {
> + err = sysfs_create_link(&dev->dev.kobj, &phydev->mdio.dev.kobj,
> + "phydev");
> + if (err)
> + goto error;
> + }
Yes, that's a very valid point, how about we even do this:
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index f84414b8f2ee..dc666ec13651 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -960,15 +960,21 @@ int phy_attach_direct(struct net_device *dev,
struct phy_device *phydev,
phydev->attached_dev = dev;
dev->phydev = phydev;
+
+ /* Some Ethernet drivers try to connect to a PHY device before
+ * calling register_netdevice() -> netdev_register_kobject() and
+ * does the dev->dev.kobj initialization. Here we only check for
+ * success which indicates that the network device kobject is
+ * ready.
+ */
err = sysfs_create_link(&phydev->mdio.dev.kobj, &dev->dev.kobj,
"attached_dev");
- if (err)
- goto error;
-
- err = sysfs_create_link(&dev->dev.kobj, &phydev->mdio.dev.kobj,
- "phydev");
- if (err)
- goto error;
+ if (!err) {
+ err = sysfs_create_link(&dev->dev.kobj,
&phydev->mdio.dev.kobj,
+ "phydev");
+ if (err)
+ goto error;
+ }
phydev->dev_flags = flags;
--
Florian
^ permalink raw reply related
* RE: [PATCH] e1000e: use disable_hardirq() also for MSIX vectors in e1000_netpoll()
From: Brown, Aaron F @ 2017-05-27 1:21 UTC (permalink / raw)
To: Konstantin Khlebnikov, netdev@vger.kernel.org,
intel-wired-lan@lists.osuosl.org, Kirsher, Jeffrey T
Cc: Dave Jones, WANG Cong, David S. Miller, Sabrina Dubroca
In-Reply-To: <149517832870.37403.16008624383220981105.stgit@buzz>
> From: netdev-owner@vger.kernel.org [mailto:netdev-
> owner@vger.kernel.org] On Behalf Of Konstantin Khlebnikov
> Sent: Friday, May 19, 2017 12:19 AM
> To: netdev@vger.kernel.org; intel-wired-lan@lists.osuosl.org; Kirsher, Jeffrey
> T <jeffrey.t.kirsher@intel.com>
> Cc: Dave Jones <davej@codemonkey.org.uk>; WANG Cong
> <xiyou.wangcong@gmail.com>; David S. Miller <davem@davemloft.net>;
> Sabrina Dubroca <sd@queasysnail.net>
> Subject: [PATCH] e1000e: use disable_hardirq() also for MSIX vectors in
> e1000_netpoll()
>
> Replace disable_irq() which waits for threaded irq handlers with
> disable_hardirq() which waits only for hardirq part.
>
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
> Fixes: 311191297125 ("e1000: use disable_hardirq() for e1000_netpoll()")
> ---
> drivers/net/ethernet/intel/e1000e/netdev.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
^ permalink raw reply
* RE: [PATCH net-next 1/3] net: phy: Create sysfs reciprocal links for attached_dev/phydev
From: Woojung.Huh @ 2017-05-27 1:00 UTC (permalink / raw)
To: f.fainelli, netdev; +Cc: davem, andrew
In-Reply-To: <0413eb98-61cc-2fca-a4d6-7f4ef91843ba@gmail.com>
Hi Florian,
> >> OK, so here is what is happening: macb_mii_init() calls macb_mii_probe()
> >> and so by the time we call phy_connect_direct(), we have not called
> >> register_netdevice() yet, netdev_register_kobject() has not been called
> >> either, and so sysfs_create_link() fails....
> > I just found same thing.
> > Yes, register_netdev() was not called at phy_connect_direct() time.
> >
> >> Let me think about a way to solve that, even though I am leaning towards
> >> ignoring the errors from sysfs_create_link() rather than fixing each and
> >> every Ethernet driver to make it probe its MII bus *after* calling
> >> register_netdevice()....
> > Agree.
>
> Thanks, would the following work for you? I don't want to do something
> more complex than that, although, if we really wanted to see this
> information, we could imagine having netdev_register_kobject() check
> whether phydev->dev.kobj is valid, and set the symbolic link at that
> point... The problem with that approach is that we are no longer
> symetrical within the core PHYLIB code (phy_attach_direct and phy_detach).
>
> Let me know if this works so I can make a formal submission:
>
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index f84414b8f2ee..daad816ee1d1 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -960,14 +960,20 @@ int phy_attach_direct(struct net_device *dev,
> struct phy_device *phydev,
>
> phydev->attached_dev = dev;
> dev->phydev = phydev;
> +
> + /* Some Ethernet drivers try to connect to a PHY device before
> + * calling register_netdevice(). register_netdevice() does
> ultimately
> + * lead to netdev_register_kobject() which would do the
> dev->dev.kobj
> + * initialization. Here we explicitly ignore those particular errors
> + */
> err = sysfs_create_link(&phydev->mdio.dev.kobj, &dev->dev.kobj,
> "attached_dev");
> - if (err)
> + if (err && err != -ENOENT)
> goto error;
This one fine. However, next one returns -14 (-EFAULT)
> err = sysfs_create_link(&dev->dev.kobj, &phydev->mdio.dev.kobj,
> "phydev");
> - if (err)
> + if (err && err != -ENOENT)
> goto error;
No need to call 2nd sysfs_create_link(), how about following?
err = sysfs_create_link(&phydev->mdio.dev.kobj, &dev->dev.kobj,
"attached_dev");
- if (err)
+ if (err && err != -ENOENT)
goto error;
- err = sysfs_create_link(&dev->dev.kobj, &phydev->mdio.dev.kobj,
- "phydev");
- if (err)
- goto error;
+ if (!err) {
+ err = sysfs_create_link(&dev->dev.kobj, &phydev->mdio.dev.kobj,
+ "phydev");
+ if (err)
+ goto error;
+ }
phydev->dev_flags = flags;
- Woojung
^ permalink raw reply
* Re: [PATCH net-next 1/3] net: phy: Create sysfs reciprocal links for attached_dev/phydev
From: Florian Fainelli @ 2017-05-27 0:46 UTC (permalink / raw)
To: Woojung.Huh, netdev; +Cc: davem, andrew
In-Reply-To: <9235D6609DB808459E95D78E17F2E43D40A9DB14@CHN-SV-EXMX02.mchp-main.com>
Hi Woojung,
On 05/26/2017 05:43 PM, Woojung.Huh@microchip.com wrote:
> Hi Florian,
>
>> OK, so here is what is happening: macb_mii_init() calls macb_mii_probe()
>> and so by the time we call phy_connect_direct(), we have not called
>> register_netdevice() yet, netdev_register_kobject() has not been called
>> either, and so sysfs_create_link() fails....
> I just found same thing.
> Yes, register_netdev() was not called at phy_connect_direct() time.
>
>> Let me think about a way to solve that, even though I am leaning towards
>> ignoring the errors from sysfs_create_link() rather than fixing each and
>> every Ethernet driver to make it probe its MII bus *after* calling
>> register_netdevice()....
> Agree.
Thanks, would the following work for you? I don't want to do something
more complex than that, although, if we really wanted to see this
information, we could imagine having netdev_register_kobject() check
whether phydev->dev.kobj is valid, and set the symbolic link at that
point... The problem with that approach is that we are no longer
symetrical within the core PHYLIB code (phy_attach_direct and phy_detach).
Let me know if this works so I can make a formal submission:
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index f84414b8f2ee..daad816ee1d1 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -960,14 +960,20 @@ int phy_attach_direct(struct net_device *dev,
struct phy_device *phydev,
phydev->attached_dev = dev;
dev->phydev = phydev;
+
+ /* Some Ethernet drivers try to connect to a PHY device before
+ * calling register_netdevice(). register_netdevice() does
ultimately
+ * lead to netdev_register_kobject() which would do the
dev->dev.kobj
+ * initialization. Here we explicitly ignore those particular errors
+ */
err = sysfs_create_link(&phydev->mdio.dev.kobj, &dev->dev.kobj,
"attached_dev");
- if (err)
+ if (err && err != -ENOENT)
goto error;
err = sysfs_create_link(&dev->dev.kobj, &phydev->mdio.dev.kobj,
"phydev");
- if (err)
+ if (err && err != -ENOENT)
goto error;
phydev->dev_flags = flags;
--
Florian
^ permalink raw reply related
* RE: [PATCH net-next 1/3] net: phy: Create sysfs reciprocal links for attached_dev/phydev
From: Woojung.Huh @ 2017-05-27 0:43 UTC (permalink / raw)
To: f.fainelli, netdev; +Cc: davem, andrew
In-Reply-To: <05a159af-6689-70db-9506-09059a09f1a5@gmail.com>
Hi Florian,
> OK, so here is what is happening: macb_mii_init() calls macb_mii_probe()
> and so by the time we call phy_connect_direct(), we have not called
> register_netdevice() yet, netdev_register_kobject() has not been called
> either, and so sysfs_create_link() fails....
I just found same thing.
Yes, register_netdev() was not called at phy_connect_direct() time.
> Let me think about a way to solve that, even though I am leaning towards
> ignoring the errors from sysfs_create_link() rather than fixing each and
> every Ethernet driver to make it probe its MII bus *after* calling
> register_netdevice()....
Agree.
> >
> > What is driver you are testing? I can check the file.
>
> Drivers involved are the following:
>
> drivers/net/ethernet/broadcom/bcmsysport.c,
> drivers/net/dsa/bcm_sf2.c
> drivers/net/ethernet/broadcom/genet/
> drivers/net/phy/bcm7xxx.c
Thanks for list of files.
- Woojung
^ permalink raw reply
* Re: [PATCH net-next 1/3] net: phy: Create sysfs reciprocal links for attached_dev/phydev
From: Florian Fainelli @ 2017-05-27 0:33 UTC (permalink / raw)
To: Woojung.Huh, netdev; +Cc: davem, andrew
In-Reply-To: <9235D6609DB808459E95D78E17F2E43D40A9DAF6@CHN-SV-EXMX02.mchp-main.com>
On 05/26/2017 05:20 PM, Woojung.Huh@microchip.com wrote:
>> OK, I am confused now. You are describing what is going on with your
>> platform right? Can you describe a bit further here what is happening
>> and with which type of interface? Is this with the CPU interface or
>> something?
>
> Yes. It's on our platform.
> Like your platform, fixed phy is used to connect switch CPU port/master netdev.
> GMAC of SoC is cadence/macb.c with fixed phy modification.
>
> static int macb_mii_probe(struct net_device *dev)
> {
> ...
> phydev = phy_find_first(bp->mii_bus);
> if (!phydev) {
> phydev = fixed_phy_register(PHY_POLL, &fphy_status, -1, NULL);
> if (IS_ERR(phydev)) {
> netdev_err(dev, "no PHY found\n");
> return -ENXIO;
> }> }
> ...
> When failed to find phydev from phy_find_first(), it forces to fixed phy.
> ...
> /* attach the mac to the phy */
> ret = phy_connect_direct(dev, phydev, &macb_handle_link_change,
> bp->phy_interface);
>
> sysfs_create_lin() inside of phy_connect_direct() fails.
OK, so here is what is happening: macb_mii_init() calls macb_mii_probe()
and so by the time we call phy_connect_direct(), we have not called
register_netdevice() yet, netdev_register_kobject() has not been called
either, and so sysfs_create_link() fails....
Let me think about a way to solve that, even though I am leaning towards
ignoring the errors from sysfs_create_link() rather than fixing each and
every Ethernet driver to make it probe its MII bus *after* calling
register_netdevice()....
>
> What is driver you are testing? I can check the file.
Drivers involved are the following:
drivers/net/ethernet/broadcom/bcmsysport.c,
drivers/net/dsa/bcm_sf2.c
drivers/net/ethernet/broadcom/genet/
drivers/net/phy/bcm7xxx.c
--
Florian
^ permalink raw reply
* Re: [patch iproute2 v2 repost 1/3] tc_filter: add support for chain index
From: Daniel Borkmann @ 2017-05-27 0:24 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Jiri Pirko, netdev, davem, jhs, xiyou.wangcong, dsa, edumazet,
alexander.h.duyck, simon.horman, mlxsw
In-Reply-To: <20170526171137.0acccbc5@xeon-e3>
On 05/27/2017 02:11 AM, Stephen Hemminger wrote:
> On Fri, 26 May 2017 21:48:05 +0200
> Daniel Borkmann <daniel@iogearbox.net> wrote:
>
>> On 05/23/2017 03:40 PM, Jiri Pirko wrote:
>>> Mon, May 22, 2017 at 10:33:15PM CEST, stephen@networkplumber.org wrote:
>> [...]
>>>> Applied to net-next branch of iproute2
>>>
>>> Looks like you missed the uapi part:
>>>
>>> CC tc_filter.o
>>> tc_filter.c: In function ‘tc_filter_modify’:
>>> tc_filter.c:159:34: error: ‘TCA_CHAIN’ undeclared (first use in this function)
>>> addattr32(&req.n, sizeof(req), TCA_CHAIN, chain_index);
>>> ^~~~~~~~~
>>
>> Looks like still unresolved in the iproute2 -net-next branch ...
>
> On the net-next branch include/linux/rtnetlink.h now has TCA_CHAIN, and everything
> builds fine. You may have local changes or be using different includes
Ok, now it works, thanks for pushing the header rebase out.
^ permalink raw reply
* RE: [PATCH net-next 1/3] net: phy: Create sysfs reciprocal links for attached_dev/phydev
From: Woojung.Huh @ 2017-05-27 0:20 UTC (permalink / raw)
To: f.fainelli, netdev; +Cc: davem, andrew
In-Reply-To: <44f24fbd-5093-faa2-02cd-f8d4d835b59d@gmail.com>
> OK, I am confused now. You are describing what is going on with your
> platform right? Can you describe a bit further here what is happening
> and with which type of interface? Is this with the CPU interface or
> something?
Yes. It's on our platform.
Like your platform, fixed phy is used to connect switch CPU port/master netdev.
GMAC of SoC is cadence/macb.c with fixed phy modification.
static int macb_mii_probe(struct net_device *dev)
{
...
phydev = phy_find_first(bp->mii_bus);
if (!phydev) {
phydev = fixed_phy_register(PHY_POLL, &fphy_status, -1, NULL);
if (IS_ERR(phydev)) {
netdev_err(dev, "no PHY found\n");
return -ENXIO;
}
}
...
When failed to find phydev from phy_find_first(), it forces to fixed phy.
...
/* attach the mac to the phy */
ret = phy_connect_direct(dev, phydev, &macb_handle_link_change,
bp->phy_interface);
sysfs_create_lin() inside of phy_connect_direct() fails.
What is driver you are testing? I can check the file.
Thanks.
- Woojung
^ permalink raw reply
* Re: [PATCH net-next] net: dsa: remove dsa_port_is_bridged
From: Florian Fainelli @ 2017-05-27 0:15 UTC (permalink / raw)
To: Vivien Didelot, netdev; +Cc: linux-kernel, kernel, David S. Miller, Andrew Lunn
In-Reply-To: <20170526221242.14875-1-vivien.didelot@savoirfairelinux.com>
On 05/26/2017 03:12 PM, Vivien Didelot wrote:
> The helper is only used once and makes the code more complicated that it
> should. Remove it and reorganize the variables so that it fits on 80
> columns.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply
* Re: [patch iproute2 v2 repost 1/3] tc_filter: add support for chain index
From: Stephen Hemminger @ 2017-05-27 0:11 UTC (permalink / raw)
To: Daniel Borkmann
Cc: Jiri Pirko, netdev, davem, jhs, xiyou.wangcong, dsa, edumazet,
alexander.h.duyck, simon.horman, mlxsw
In-Reply-To: <59288675.4040009@iogearbox.net>
On Fri, 26 May 2017 21:48:05 +0200
Daniel Borkmann <daniel@iogearbox.net> wrote:
> On 05/23/2017 03:40 PM, Jiri Pirko wrote:
> > Mon, May 22, 2017 at 10:33:15PM CEST, stephen@networkplumber.org wrote:
> [...]
> >> Applied to net-next branch of iproute2
> >
> > Looks like you missed the uapi part:
> >
> > CC tc_filter.o
> > tc_filter.c: In function ‘tc_filter_modify’:
> > tc_filter.c:159:34: error: ‘TCA_CHAIN’ undeclared (first use in this function)
> > addattr32(&req.n, sizeof(req), TCA_CHAIN, chain_index);
> > ^~~~~~~~~
>
> Looks like still unresolved in the iproute2 -net-next branch ...
On the net-next branch include/linux/rtnetlink.h now has TCA_CHAIN, and everything
builds fine. You may have local changes or be using different includes
$ git grep TCA_CHAIN
include/linux/rtnetlink.h: TCA_CHAIN,
tc/tc_filter.c: addattr32(&req.n, sizeof(req), TCA_CHAIN, chain_index);
tc/tc_filter.c: if (tb[TCA_CHAIN]) {
tc/tc_filter.c: __u32 chain_index = rta_getattr_u32(tb[TCA_CHAIN]);
tc/tc_filter.c: addattr32(&req.n, sizeof(req), TCA_CHAIN, chain_index);
tc/tc_filter.c: addattr32(&req.n, sizeof(req), TCA_CHAIN, chain_index);
^ permalink raw reply
* Re: [PATCH net-next 1/3] net: phy: Create sysfs reciprocal links for attached_dev/phydev
From: Florian Fainelli @ 2017-05-27 0:02 UTC (permalink / raw)
To: Woojung.Huh, netdev; +Cc: davem, andrew
In-Reply-To: <9235D6609DB808459E95D78E17F2E43D40A9DACE@CHN-SV-EXMX02.mchp-main.com>
On 05/26/2017 04:52 PM, Woojung.Huh@microchip.com wrote:
> Hi Florian,
>
>>> I knew that it is applied to net-next.
>>> However, sysfs_create_link() fails when fixed phy
>> (drivers/net/phy/fixed_phy.c)
>>> Do you have a chance to test with it?
>>
>> I did, my main test system (BCM7445 w/ bcm_sf2) has one normal PHY
>> driver and 3 fixed PHYs (including one for the CPU port/master netdev),
>> see below.
>>
>> What kind of error do you get here?
> sysfs_create_link() returns -2 (-ENOENT).
>
>>
>> # ls -l /sys/class/net/gphy/phydev
>> lrwxrwxrwx 1 root root 0 Jan 1 00:00
>> /sys/class/net/gphy/phydev ->
>> ../../../f0b403c0.mdio/mdio_bus/f0b403c0.mdio/f0b403c0.mdio:05
>> # ls -l /sys/class/net/*/phydev
>> lrwxrwxrwx 1 root root 0 Jan 1 00:01
>> /sys/class/net/eth0/phydev -> ../../../../Fixed MDIO
>> bus.0/mdio_bus/fixed-0/fixed-0:00
>> lrwxrwxrwx 1 root root 0 Jan 1 00:00
>> /sys/class/net/gphy/phydev ->
>> ../../../f0b403c0.mdio/mdio_bus/f0b403c0.mdio/f0b403c0.mdio:05
>> lrwxrwxrwx 1 root root 0 Jan 1 00:01
>> /sys/class/net/moca/phydev -> ../../../../../Fixed MDIO
>> bus.0/mdio_bus/fixed-0/fixed-0:02
>> lrwxrwxrwx 1 root root 0 Jan 1 00:01
>> /sys/class/net/rgmii_1/phydev -> ../../../mdio_bus/sf2-1/sf2-1:00
>> lrwxrwxrwx 1 root root 0 Jan 1 00:01
>> /sys/class/net/rgmii_2/phydev -> ../../../../../Fixed MDIO
>> bus.0/mdio_bus/fixed-0/fixed-0:01
>>
>> # ls -l /sys/class/mdio_bus/fixed-0/*/attached_dev
>> lrwxrwxrwx 1 root root 0 Jan 1 00:01
>> /sys/class/mdio_bus/fixed-0/fixed-0:00/attached_dev ->
>> ../../../../rdb/f04a0000.ethernet/net/eth0
>> lrwxrwxrwx 1 root root 0 Jan 1 00:02
>> /sys/class/mdio_bus/fixed-0/fixed-0:01/attached_dev ->
>> ../../../../rdb/rdb:switch_top@f0b00000/f0b00000.ethernet_switch/net/rgm
>> ii_2
>> lrwxrwxrwx 1 root root 0 Jan 1 00:02
>> /sys/class/mdio_bus/fixed-0/fixed-0:02/attached_dev ->
>> ../../../../rdb/rdb:switch_top@f0b00000/f0b00000.ethernet_switch/net/moc
>> a
>>
>> # ls -l /sys/class/mdio_bus/f0b403c0.mdio/f0b403c0.mdio\:05/attached_dev
>> lrwxrwxrwx 1 root root 0 Jan 1 00:02
>> /sys/class/mdio_bus/f0b403c0.mdio/f0b403c0.mdio:05/attached_dev ->
>> ../../../../f0b00000.ethernet_switch/net/gphy
>
> /sys/class/mdio_bus/devices/fixed-0:00/* exists.
> But not /sys/class/net/eth0.. because Ethernet driver initialization failed.
OK, I am confused now. You are describing what is going on with your
platform right? Can you describe a bit further here what is happening
and with which type of interface? Is this with the CPU interface or
something?
--
Florian
^ permalink raw reply
* RE: [PATCH net-next 1/3] net: phy: Create sysfs reciprocal links for attached_dev/phydev
From: Woojung.Huh @ 2017-05-26 23:52 UTC (permalink / raw)
To: f.fainelli, netdev; +Cc: davem, andrew
In-Reply-To: <d2d97683-3fcc-6603-09e1-13818464de18@gmail.com>
Hi Florian,
> > I knew that it is applied to net-next.
> > However, sysfs_create_link() fails when fixed phy
> (drivers/net/phy/fixed_phy.c)
> > Do you have a chance to test with it?
>
> I did, my main test system (BCM7445 w/ bcm_sf2) has one normal PHY
> driver and 3 fixed PHYs (including one for the CPU port/master netdev),
> see below.
>
> What kind of error do you get here?
sysfs_create_link() returns -2 (-ENOENT).
>
> # ls -l /sys/class/net/gphy/phydev
> lrwxrwxrwx 1 root root 0 Jan 1 00:00
> /sys/class/net/gphy/phydev ->
> ../../../f0b403c0.mdio/mdio_bus/f0b403c0.mdio/f0b403c0.mdio:05
> # ls -l /sys/class/net/*/phydev
> lrwxrwxrwx 1 root root 0 Jan 1 00:01
> /sys/class/net/eth0/phydev -> ../../../../Fixed MDIO
> bus.0/mdio_bus/fixed-0/fixed-0:00
> lrwxrwxrwx 1 root root 0 Jan 1 00:00
> /sys/class/net/gphy/phydev ->
> ../../../f0b403c0.mdio/mdio_bus/f0b403c0.mdio/f0b403c0.mdio:05
> lrwxrwxrwx 1 root root 0 Jan 1 00:01
> /sys/class/net/moca/phydev -> ../../../../../Fixed MDIO
> bus.0/mdio_bus/fixed-0/fixed-0:02
> lrwxrwxrwx 1 root root 0 Jan 1 00:01
> /sys/class/net/rgmii_1/phydev -> ../../../mdio_bus/sf2-1/sf2-1:00
> lrwxrwxrwx 1 root root 0 Jan 1 00:01
> /sys/class/net/rgmii_2/phydev -> ../../../../../Fixed MDIO
> bus.0/mdio_bus/fixed-0/fixed-0:01
>
> # ls -l /sys/class/mdio_bus/fixed-0/*/attached_dev
> lrwxrwxrwx 1 root root 0 Jan 1 00:01
> /sys/class/mdio_bus/fixed-0/fixed-0:00/attached_dev ->
> ../../../../rdb/f04a0000.ethernet/net/eth0
> lrwxrwxrwx 1 root root 0 Jan 1 00:02
> /sys/class/mdio_bus/fixed-0/fixed-0:01/attached_dev ->
> ../../../../rdb/rdb:switch_top@f0b00000/f0b00000.ethernet_switch/net/rgm
> ii_2
> lrwxrwxrwx 1 root root 0 Jan 1 00:02
> /sys/class/mdio_bus/fixed-0/fixed-0:02/attached_dev ->
> ../../../../rdb/rdb:switch_top@f0b00000/f0b00000.ethernet_switch/net/moc
> a
>
> # ls -l /sys/class/mdio_bus/f0b403c0.mdio/f0b403c0.mdio\:05/attached_dev
> lrwxrwxrwx 1 root root 0 Jan 1 00:02
> /sys/class/mdio_bus/f0b403c0.mdio/f0b403c0.mdio:05/attached_dev ->
> ../../../../f0b00000.ethernet_switch/net/gphy
/sys/class/mdio_bus/devices/fixed-0:00/* exists.
But not /sys/class/net/eth0.. because Ethernet driver initialization failed.
- Woojung
^ permalink raw reply
* Re: [PATCH net-next 1/3] net: phy: Create sysfs reciprocal links for attached_dev/phydev
From: Florian Fainelli @ 2017-05-26 23:44 UTC (permalink / raw)
To: Woojung.Huh, netdev; +Cc: davem, andrew
In-Reply-To: <9235D6609DB808459E95D78E17F2E43D40A9DAA2@CHN-SV-EXMX02.mchp-main.com>
Hi Woojung,
On 05/26/2017 04:34 PM, Woojung.Huh@microchip.com wrote:
>> @@ -960,6 +960,15 @@ int phy_attach_direct(struct net_device *dev, struct
>> phy_device *phydev,
>>
>> phydev->attached_dev = dev;
>> dev->phydev = phydev;
>> + err = sysfs_create_link(&phydev->mdio.dev.kobj, &dev->dev.kobj,
>> + "attached_dev");
>> + if (err)
>> + goto error;
>> +
>> + err = sysfs_create_link(&dev->dev.kobj, &phydev->mdio.dev.kobj,
>> + "phydev");
>> + if (err)
>> + goto error;
>>
> Florian,
>
> I knew that it is applied to net-next.
> However, sysfs_create_link() fails when fixed phy (drivers/net/phy/fixed_phy.c)
> Do you have a chance to test with it?
I did, my main test system (BCM7445 w/ bcm_sf2) has one normal PHY
driver and 3 fixed PHYs (including one for the CPU port/master netdev),
see below.
What kind of error do you get here?
# ls -l /sys/class/net/gphy/phydev
lrwxrwxrwx 1 root root 0 Jan 1 00:00
/sys/class/net/gphy/phydev ->
../../../f0b403c0.mdio/mdio_bus/f0b403c0.mdio/f0b403c0.mdio:05
# ls -l /sys/class/net/*/phydev
lrwxrwxrwx 1 root root 0 Jan 1 00:01
/sys/class/net/eth0/phydev -> ../../../../Fixed MDIO
bus.0/mdio_bus/fixed-0/fixed-0:00
lrwxrwxrwx 1 root root 0 Jan 1 00:00
/sys/class/net/gphy/phydev ->
../../../f0b403c0.mdio/mdio_bus/f0b403c0.mdio/f0b403c0.mdio:05
lrwxrwxrwx 1 root root 0 Jan 1 00:01
/sys/class/net/moca/phydev -> ../../../../../Fixed MDIO
bus.0/mdio_bus/fixed-0/fixed-0:02
lrwxrwxrwx 1 root root 0 Jan 1 00:01
/sys/class/net/rgmii_1/phydev -> ../../../mdio_bus/sf2-1/sf2-1:00
lrwxrwxrwx 1 root root 0 Jan 1 00:01
/sys/class/net/rgmii_2/phydev -> ../../../../../Fixed MDIO
bus.0/mdio_bus/fixed-0/fixed-0:01
# ls -l /sys/class/mdio_bus/fixed-0/*/attached_dev
lrwxrwxrwx 1 root root 0 Jan 1 00:01
/sys/class/mdio_bus/fixed-0/fixed-0:00/attached_dev ->
../../../../rdb/f04a0000.ethernet/net/eth0
lrwxrwxrwx 1 root root 0 Jan 1 00:02
/sys/class/mdio_bus/fixed-0/fixed-0:01/attached_dev ->
../../../../rdb/rdb:switch_top@f0b00000/f0b00000.ethernet_switch/net/rgmii_2
lrwxrwxrwx 1 root root 0 Jan 1 00:02
/sys/class/mdio_bus/fixed-0/fixed-0:02/attached_dev ->
../../../../rdb/rdb:switch_top@f0b00000/f0b00000.ethernet_switch/net/moca
# ls -l /sys/class/mdio_bus/f0b403c0.mdio/f0b403c0.mdio\:05/attached_dev
lrwxrwxrwx 1 root root 0 Jan 1 00:02
/sys/class/mdio_bus/f0b403c0.mdio/f0b403c0.mdio:05/attached_dev ->
../../../../f0b00000.ethernet_switch/net/gphy
>
> - Woojung
>
--
Florian
^ permalink raw reply
* RE: [PATCH net-next 1/3] net: phy: Create sysfs reciprocal links for attached_dev/phydev
From: Woojung.Huh @ 2017-05-26 23:34 UTC (permalink / raw)
To: f.fainelli, netdev; +Cc: davem, andrew
In-Reply-To: <20170524193354.10739-2-f.fainelli@gmail.com>
> @@ -960,6 +960,15 @@ int phy_attach_direct(struct net_device *dev, struct
> phy_device *phydev,
>
> phydev->attached_dev = dev;
> dev->phydev = phydev;
> + err = sysfs_create_link(&phydev->mdio.dev.kobj, &dev->dev.kobj,
> + "attached_dev");
> + if (err)
> + goto error;
> +
> + err = sysfs_create_link(&dev->dev.kobj, &phydev->mdio.dev.kobj,
> + "phydev");
> + if (err)
> + goto error;
>
Florian,
I knew that it is applied to net-next.
However, sysfs_create_link() fails when fixed phy (drivers/net/phy/fixed_phy.c)
Do you have a chance to test with it?
- Woojung
^ permalink raw reply
* Re: [PATCH net-next] net: dsa: b53: remove unused dev argument
From: Florian Fainelli @ 2017-05-26 22:50 UTC (permalink / raw)
To: Vivien Didelot, netdev; +Cc: linux-kernel, kernel, David S. Miller, Andrew Lunn
In-Reply-To: <20170526220737.24579-1-vivien.didelot@savoirfairelinux.com>
On 05/26/2017 03:07 PM, Vivien Didelot wrote:
> The port net device passed to b53_fdb_copy is not used. Remove it.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply
* [PATCH net-next] net: dsa: remove dev arg of dsa_register_switch
From: Vivien Didelot @ 2017-05-26 22:12 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, kernel, David S. Miller, Florian Fainelli,
Andrew Lunn, Vivien Didelot
The current dsa_register_switch function takes a useless struct device
pointer argument, which always equals ds->dev.
Drivers either call it with ds->dev, or with the same device pointer
passed to dsa_switch_alloc, which ends up being assigned to ds->dev.
This patch removes the second argument of the dsa_register_switch and
_dsa_register_switch functions.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/net/dsa/b53/b53_common.c | 2 +-
drivers/net/dsa/dsa_loop.c | 2 +-
drivers/net/dsa/lan9303-core.c | 2 +-
drivers/net/dsa/mt7530.c | 2 +-
drivers/net/dsa/mv88e6xxx/chip.c | 2 +-
drivers/net/dsa/qca8k.c | 2 +-
include/net/dsa.h | 2 +-
net/dsa/dsa2.c | 10 +++++-----
8 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index fa099ed41652..37bd6bd3b8d0 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1991,7 +1991,7 @@ int b53_switch_register(struct b53_device *dev)
pr_info("found switch: %s, rev %i\n", dev->name, dev->core_rev);
- return dsa_register_switch(dev->ds, dev->ds->dev);
+ return dsa_register_switch(dev->ds);
}
EXPORT_SYMBOL(b53_switch_register);
diff --git a/drivers/net/dsa/dsa_loop.c b/drivers/net/dsa/dsa_loop.c
index 5edf07beb9d2..79e62593ff4e 100644
--- a/drivers/net/dsa/dsa_loop.c
+++ b/drivers/net/dsa/dsa_loop.c
@@ -271,7 +271,7 @@ static int dsa_loop_drv_probe(struct mdio_device *mdiodev)
dev_set_drvdata(&mdiodev->dev, ds);
- return dsa_register_switch(ds, ds->dev);
+ return dsa_register_switch(ds);
}
static void dsa_loop_drv_remove(struct mdio_device *mdiodev)
diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
index c8b2423c8ef7..cd76e61f1fca 100644
--- a/drivers/net/dsa/lan9303-core.c
+++ b/drivers/net/dsa/lan9303-core.c
@@ -802,7 +802,7 @@ static int lan9303_register_switch(struct lan9303 *chip)
chip->ds->ops = &lan9303_switch_ops;
chip->ds->phys_mii_mask = chip->phy_addr_sel_strap ? 0xe : 0x7;
- return dsa_register_switch(chip->ds, chip->dev);
+ return dsa_register_switch(chip->ds);
}
static void lan9303_probe_reset_gpio(struct lan9303 *chip,
diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 4d2f45153ede..25e00d5e0eec 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -1080,7 +1080,7 @@ mt7530_probe(struct mdio_device *mdiodev)
mutex_init(&priv->reg_mutex);
dev_set_drvdata(&mdiodev->dev, priv);
- return dsa_register_switch(priv->ds, &mdiodev->dev);
+ return dsa_register_switch(priv->ds);
}
static void
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index c2f38f6770aa..5e992a5745b0 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -3892,7 +3892,7 @@ static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip)
dev_set_drvdata(dev, ds);
- return dsa_register_switch(ds, dev);
+ return dsa_register_switch(ds);
}
static void mv88e6xxx_unregister_switch(struct mv88e6xxx_chip *chip)
diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index 0f6a011d8ed1..b3bee7eab45f 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -958,7 +958,7 @@ qca8k_sw_probe(struct mdio_device *mdiodev)
mutex_init(&priv->reg_mutex);
dev_set_drvdata(&mdiodev->dev, priv);
- return dsa_register_switch(priv->ds, &mdiodev->dev);
+ return dsa_register_switch(priv->ds);
}
static void
diff --git a/include/net/dsa.h b/include/net/dsa.h
index c0e567c0c824..d9bd6939229a 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -480,7 +480,7 @@ static inline bool netdev_uses_dsa(struct net_device *dev)
struct dsa_switch *dsa_switch_alloc(struct device *dev, size_t n);
void dsa_unregister_switch(struct dsa_switch *ds);
-int dsa_register_switch(struct dsa_switch *ds, struct device *dev);
+int dsa_register_switch(struct dsa_switch *ds);
#ifdef CONFIG_PM_SLEEP
int dsa_switch_suspend(struct dsa_switch *ds);
int dsa_switch_resume(struct dsa_switch *ds);
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 4301f52e4f5a..c0a4576db4a2 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -686,10 +686,10 @@ static struct device_node *dsa_get_ports(struct dsa_switch *ds,
return ports;
}
-static int _dsa_register_switch(struct dsa_switch *ds, struct device *dev)
+static int _dsa_register_switch(struct dsa_switch *ds)
{
- struct dsa_chip_data *pdata = dev->platform_data;
- struct device_node *np = dev->of_node;
+ struct dsa_chip_data *pdata = ds->dev->platform_data;
+ struct device_node *np = ds->dev->of_node;
struct dsa_switch_tree *dst;
struct device_node *ports;
u32 tree, index;
@@ -803,12 +803,12 @@ struct dsa_switch *dsa_switch_alloc(struct device *dev, size_t n)
}
EXPORT_SYMBOL_GPL(dsa_switch_alloc);
-int dsa_register_switch(struct dsa_switch *ds, struct device *dev)
+int dsa_register_switch(struct dsa_switch *ds)
{
int err;
mutex_lock(&dsa2_mutex);
- err = _dsa_register_switch(ds, dev);
+ err = _dsa_register_switch(ds);
mutex_unlock(&dsa2_mutex);
return err;
--
2.13.0
^ permalink raw reply related
* [PATCH net-next] net: dsa: remove dsa_port_is_bridged
From: Vivien Didelot @ 2017-05-26 22:12 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, kernel, David S. Miller, Florian Fainelli,
Andrew Lunn, Vivien Didelot
The helper is only used once and makes the code more complicated that it
should. Remove it and reorganize the variables so that it fits on 80
columns.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
net/dsa/slave.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 887e26695519..0442b6bf52fa 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -69,18 +69,13 @@ static int dsa_slave_get_iflink(const struct net_device *dev)
return p->dp->ds->dst->master_netdev->ifindex;
}
-static inline bool dsa_port_is_bridged(struct dsa_port *dp)
-{
- return !!dp->bridge_dev;
-}
-
static int dsa_slave_open(struct net_device *dev)
{
struct dsa_slave_priv *p = netdev_priv(dev);
- struct net_device *master = p->dp->ds->dst->master_netdev;
- struct dsa_switch *ds = p->dp->ds;
- u8 stp_state = dsa_port_is_bridged(p->dp) ?
- BR_STATE_BLOCKING : BR_STATE_FORWARDING;
+ struct dsa_port *dp = p->dp;
+ struct dsa_switch *ds = dp->ds;
+ struct net_device *master = ds->dst->master_netdev;
+ u8 stp_state = dp->bridge_dev ? BR_STATE_BLOCKING : BR_STATE_FORWARDING;
int err;
if (!(master->flags & IFF_UP))
--
2.13.0
^ permalink raw reply related
* Re: [PATCH net-next 1/2] net: ndisc.c: fix coding style issue
From: yuan linyu @ 2017-05-26 22:08 UTC (permalink / raw)
To: 吉藤英明
Cc: network dev, David S . Miller, Joe Perches, David Ahern,
yuan linyu, YOSHIFUJI Hideaki
In-Reply-To: <CAPA1RqB1_ObcZc_rgE6HN+-PzsabWd2X=swGbkPxVLrzY60MKg@mail.gmail.com>
On 六, 2017-05-27 at 02:25 +0900, 吉藤英明 wrote:
> Hi,
>
> 2017-05-26 22:55 GMT+09:00 yuan linyu <cugyly@163.com>:
> >
> > On 五, 2017-05-26 at 22:45 +0900, 吉藤英明 wrote:
> > >
> > > Hi,
> > >
> > > 2017-05-26 22:23 GMT+09:00 yuan linyu <cugyly@163.com>:
> > > >
> > > >
> > > > From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> > > >
> > > > Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> > > > ---
> > > > net/ipv6/ndisc.c | 109 ++++++++++++++++++++++++++++---------------------------
> > > > 1 file changed, 55 insertions(+), 54 deletions(-)
> > > Sorry, I don't think this kind of change for style is good
> > > bacause this makes effort of backport more difficult.
> > hi, i can't understand.
> > if any change of this code you decide to backport, it need effort,
> > not only important fix.
> >
> > do I miss your point ?
> Please let us minimize our effort when doing so.
>
> If the style is not changed, we have more chance to apply the patch
> itself on top of old tree.
>
> Thank you.
I don't know you hate this kind of changes,
from a code reader view, I like to see code with good style.
I am not happy when reading code with this kind of bad style.
And it only spend a command time to backport, right?
it will never spend your effort only if this code will not change in future.
>
> >
> > >
> > >
> > > --yoshfuji
> > >
> >
^ permalink raw reply
* [PATCH net-next] net: dsa: b53: remove unused dev argument
From: Vivien Didelot @ 2017-05-26 22:07 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, kernel, David S. Miller, Florian Fainelli,
Andrew Lunn, Vivien Didelot
The port net device passed to b53_fdb_copy is not used. Remove it.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/net/dsa/b53/b53_common.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index fa099ed41652..6a5648a9cb09 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1281,8 +1281,7 @@ static void b53_arl_search_rd(struct b53_device *dev, u8 idx,
b53_arl_to_entry(ent, mac_vid, fwd_entry);
}
-static int b53_fdb_copy(struct net_device *dev, int port,
- const struct b53_arl_entry *ent,
+static int b53_fdb_copy(int port, const struct b53_arl_entry *ent,
struct switchdev_obj_port_fdb *fdb,
switchdev_obj_dump_cb_t *cb)
{
@@ -1304,7 +1303,6 @@ int b53_fdb_dump(struct dsa_switch *ds, int port,
switchdev_obj_dump_cb_t *cb)
{
struct b53_device *priv = ds->priv;
- struct net_device *dev = ds->ports[port].netdev;
struct b53_arl_entry results[2];
unsigned int count = 0;
int ret;
@@ -1320,13 +1318,13 @@ int b53_fdb_dump(struct dsa_switch *ds, int port,
return ret;
b53_arl_search_rd(priv, 0, &results[0]);
- ret = b53_fdb_copy(dev, port, &results[0], fdb, cb);
+ ret = b53_fdb_copy(port, &results[0], fdb, cb);
if (ret)
return ret;
if (priv->num_arl_entries > 2) {
b53_arl_search_rd(priv, 1, &results[1]);
- ret = b53_fdb_copy(dev, port, &results[1], fdb, cb);
+ ret = b53_fdb_copy(port, &results[1], fdb, cb);
if (ret)
return ret;
--
2.13.0
^ permalink raw reply related
* [PATCH net-next 2/3] net: dsa: mv88e6xxx: rename PHY PPU accessors
From: Vivien Didelot @ 2017-05-26 22:03 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, kernel, David S. Miller, Florian Fainelli,
Andrew Lunn, Vivien Didelot
In-Reply-To: <20170526220307.23503-1-vivien.didelot@savoirfairelinux.com>
Make it clear that mv88e6xxx_phy_ppu_{read,write} are an implementation
of the .phy_{read,write} operations, by renaming them with the mv88e6185
prefix, since 88E6185 it is the reference switch model supported in an
upstream board (ZII Dev Rev B), which makes use of them.
Distinguish the signatures of implementation specific and generic PHY
functions in the phy.h header.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 16 ++++++++--------
drivers/net/dsa/mv88e6xxx/phy.c | 4 ++--
drivers/net/dsa/mv88e6xxx/phy.h | 11 +++++++----
3 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 7f5f44f89389..070e82ac6132 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -2371,8 +2371,8 @@ static int mv88e6xxx_set_eeprom(struct dsa_switch *ds,
static const struct mv88e6xxx_ops mv88e6085_ops = {
/* MV88E6XXX_FAMILY_6097 */
.set_switch_mac = mv88e6xxx_g1_set_switch_mac,
- .phy_read = mv88e6xxx_phy_ppu_read,
- .phy_write = mv88e6xxx_phy_ppu_write,
+ .phy_read = mv88e6185_phy_ppu_read,
+ .phy_write = mv88e6185_phy_ppu_write,
.port_set_link = mv88e6xxx_port_set_link,
.port_set_duplex = mv88e6xxx_port_set_duplex,
.port_set_speed = mv88e6185_port_set_speed,
@@ -2402,8 +2402,8 @@ static const struct mv88e6xxx_ops mv88e6085_ops = {
static const struct mv88e6xxx_ops mv88e6095_ops = {
/* MV88E6XXX_FAMILY_6095 */
.set_switch_mac = mv88e6xxx_g1_set_switch_mac,
- .phy_read = mv88e6xxx_phy_ppu_read,
- .phy_write = mv88e6xxx_phy_ppu_write,
+ .phy_read = mv88e6185_phy_ppu_read,
+ .phy_write = mv88e6185_phy_ppu_write,
.port_set_link = mv88e6xxx_port_set_link,
.port_set_duplex = mv88e6xxx_port_set_duplex,
.port_set_speed = mv88e6185_port_set_speed,
@@ -2480,8 +2480,8 @@ static const struct mv88e6xxx_ops mv88e6123_ops = {
static const struct mv88e6xxx_ops mv88e6131_ops = {
/* MV88E6XXX_FAMILY_6185 */
.set_switch_mac = mv88e6xxx_g1_set_switch_mac,
- .phy_read = mv88e6xxx_phy_ppu_read,
- .phy_write = mv88e6xxx_phy_ppu_write,
+ .phy_read = mv88e6185_phy_ppu_read,
+ .phy_write = mv88e6185_phy_ppu_write,
.port_set_link = mv88e6xxx_port_set_link,
.port_set_duplex = mv88e6xxx_port_set_duplex,
.port_set_speed = mv88e6185_port_set_speed,
@@ -2727,8 +2727,8 @@ static const struct mv88e6xxx_ops mv88e6176_ops = {
static const struct mv88e6xxx_ops mv88e6185_ops = {
/* MV88E6XXX_FAMILY_6185 */
.set_switch_mac = mv88e6xxx_g1_set_switch_mac,
- .phy_read = mv88e6xxx_phy_ppu_read,
- .phy_write = mv88e6xxx_phy_ppu_write,
+ .phy_read = mv88e6185_phy_ppu_read,
+ .phy_write = mv88e6185_phy_ppu_write,
.port_set_link = mv88e6xxx_port_set_link,
.port_set_duplex = mv88e6xxx_port_set_duplex,
.port_set_speed = mv88e6185_port_set_speed,
diff --git a/drivers/net/dsa/mv88e6xxx/phy.c b/drivers/net/dsa/mv88e6xxx/phy.c
index b865b1e2b103..19e0128257e5 100644
--- a/drivers/net/dsa/mv88e6xxx/phy.c
+++ b/drivers/net/dsa/mv88e6xxx/phy.c
@@ -202,7 +202,7 @@ static void mv88e6xxx_ppu_state_destroy(struct mv88e6xxx_chip *chip)
del_timer_sync(&chip->ppu_timer);
}
-int mv88e6xxx_phy_ppu_read(struct mv88e6xxx_chip *chip, struct mii_bus *bus,
+int mv88e6185_phy_ppu_read(struct mv88e6xxx_chip *chip, struct mii_bus *bus,
int addr, int reg, u16 *val)
{
int err;
@@ -216,7 +216,7 @@ int mv88e6xxx_phy_ppu_read(struct mv88e6xxx_chip *chip, struct mii_bus *bus,
return err;
}
-int mv88e6xxx_phy_ppu_write(struct mv88e6xxx_chip *chip, struct mii_bus *bus,
+int mv88e6185_phy_ppu_write(struct mv88e6xxx_chip *chip, struct mii_bus *bus,
int addr, int reg, u16 val)
{
int err;
diff --git a/drivers/net/dsa/mv88e6xxx/phy.h b/drivers/net/dsa/mv88e6xxx/phy.h
index dfa98549dfcd..91fe3c3e9aea 100644
--- a/drivers/net/dsa/mv88e6xxx/phy.h
+++ b/drivers/net/dsa/mv88e6xxx/phy.h
@@ -14,10 +14,17 @@
#ifndef _MV88E6XXX_PHY_H
#define _MV88E6XXX_PHY_H
+/* PHY Registers accesses implementations */
int mv88e6165_phy_read(struct mv88e6xxx_chip *chip, struct mii_bus *bus,
int addr, int reg, u16 *val);
int mv88e6165_phy_write(struct mv88e6xxx_chip *chip, struct mii_bus *bus,
int addr, int reg, u16 val);
+int mv88e6185_phy_ppu_read(struct mv88e6xxx_chip *chip, struct mii_bus *bus,
+ int addr, int reg, u16 *val);
+int mv88e6185_phy_ppu_write(struct mv88e6xxx_chip *chip, struct mii_bus *bus,
+ int addr, int reg, u16 val);
+
+/* Generic PHY operations */
int mv88e6xxx_phy_read(struct mv88e6xxx_chip *chip, int phy,
int reg, u16 *val);
int mv88e6xxx_phy_write(struct mv88e6xxx_chip *chip, int phy,
@@ -26,10 +33,6 @@ int mv88e6xxx_phy_page_read(struct mv88e6xxx_chip *chip, int phy,
u8 page, int reg, u16 *val);
int mv88e6xxx_phy_page_write(struct mv88e6xxx_chip *chip, int phy,
u8 page, int reg, u16 val);
-int mv88e6xxx_phy_ppu_read(struct mv88e6xxx_chip *chip, struct mii_bus *bus,
- int addr, int reg, u16 *val);
-int mv88e6xxx_phy_ppu_write(struct mv88e6xxx_chip *chip, struct mii_bus *bus,
- int addr, int reg, u16 val);
void mv88e6xxx_phy_init(struct mv88e6xxx_chip *chip);
void mv88e6xxx_phy_destroy(struct mv88e6xxx_chip *chip);
int mv88e6xxx_phy_setup(struct mv88e6xxx_chip *chip);
--
2.13.0
^ permalink raw reply related
* [PATCH net-next 3/3] net: dsa: mv88e6xxx: rename PHY PPU functions
From: Vivien Didelot @ 2017-05-26 22:03 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, kernel, David S. Miller, Florian Fainelli,
Andrew Lunn, Vivien Didelot
In-Reply-To: <20170526220307.23503-1-vivien.didelot@savoirfairelinux.com>
Respect the implicit naming convention used in all register sets
specific files, by renaming the mv88e6xxx_ppu_* functions with the
mv88e6xxx_phy_* prefix.
This is simply a s/xxx_ppu/xxx_phy_ppu/ substitution.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/net/dsa/mv88e6xxx/phy.c | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/phy.c b/drivers/net/dsa/mv88e6xxx/phy.c
index 19e0128257e5..d47a6e08d88c 100644
--- a/drivers/net/dsa/mv88e6xxx/phy.c
+++ b/drivers/net/dsa/mv88e6xxx/phy.c
@@ -116,7 +116,7 @@ int mv88e6xxx_phy_page_write(struct mv88e6xxx_chip *chip, int phy,
return err;
}
-static int mv88e6xxx_ppu_disable(struct mv88e6xxx_chip *chip)
+static int mv88e6xxx_phy_ppu_disable(struct mv88e6xxx_chip *chip)
{
if (!chip->info->ops->ppu_disable)
return 0;
@@ -124,7 +124,7 @@ static int mv88e6xxx_ppu_disable(struct mv88e6xxx_chip *chip)
return chip->info->ops->ppu_disable(chip);
}
-static int mv88e6xxx_ppu_enable(struct mv88e6xxx_chip *chip)
+static int mv88e6xxx_phy_ppu_enable(struct mv88e6xxx_chip *chip)
{
if (!chip->info->ops->ppu_enable)
return 0;
@@ -132,7 +132,7 @@ static int mv88e6xxx_ppu_enable(struct mv88e6xxx_chip *chip)
return chip->info->ops->ppu_enable(chip);
}
-static void mv88e6xxx_ppu_reenable_work(struct work_struct *ugly)
+static void mv88e6xxx_phy_ppu_reenable_work(struct work_struct *ugly)
{
struct mv88e6xxx_chip *chip;
@@ -141,7 +141,7 @@ static void mv88e6xxx_ppu_reenable_work(struct work_struct *ugly)
mutex_lock(&chip->reg_lock);
if (mutex_trylock(&chip->ppu_mutex)) {
- if (mv88e6xxx_ppu_enable(chip) == 0)
+ if (mv88e6xxx_phy_ppu_enable(chip) == 0)
chip->ppu_disabled = 0;
mutex_unlock(&chip->ppu_mutex);
}
@@ -149,14 +149,14 @@ static void mv88e6xxx_ppu_reenable_work(struct work_struct *ugly)
mutex_unlock(&chip->reg_lock);
}
-static void mv88e6xxx_ppu_reenable_timer(unsigned long _ps)
+static void mv88e6xxx_phy_ppu_reenable_timer(unsigned long _ps)
{
struct mv88e6xxx_chip *chip = (void *)_ps;
schedule_work(&chip->ppu_work);
}
-static int mv88e6xxx_ppu_access_get(struct mv88e6xxx_chip *chip)
+static int mv88e6xxx_phy_ppu_access_get(struct mv88e6xxx_chip *chip)
{
int ret;
@@ -168,7 +168,7 @@ static int mv88e6xxx_ppu_access_get(struct mv88e6xxx_chip *chip)
* it.
*/
if (!chip->ppu_disabled) {
- ret = mv88e6xxx_ppu_disable(chip);
+ ret = mv88e6xxx_phy_ppu_disable(chip);
if (ret < 0) {
mutex_unlock(&chip->ppu_mutex);
return ret;
@@ -182,22 +182,22 @@ static int mv88e6xxx_ppu_access_get(struct mv88e6xxx_chip *chip)
return ret;
}
-static void mv88e6xxx_ppu_access_put(struct mv88e6xxx_chip *chip)
+static void mv88e6xxx_phy_ppu_access_put(struct mv88e6xxx_chip *chip)
{
/* Schedule a timer to re-enable the PHY polling unit. */
mod_timer(&chip->ppu_timer, jiffies + msecs_to_jiffies(10));
mutex_unlock(&chip->ppu_mutex);
}
-static void mv88e6xxx_ppu_state_init(struct mv88e6xxx_chip *chip)
+static void mv88e6xxx_phy_ppu_state_init(struct mv88e6xxx_chip *chip)
{
mutex_init(&chip->ppu_mutex);
- INIT_WORK(&chip->ppu_work, mv88e6xxx_ppu_reenable_work);
- setup_timer(&chip->ppu_timer, mv88e6xxx_ppu_reenable_timer,
+ INIT_WORK(&chip->ppu_work, mv88e6xxx_phy_ppu_reenable_work);
+ setup_timer(&chip->ppu_timer, mv88e6xxx_phy_ppu_reenable_timer,
(unsigned long)chip);
}
-static void mv88e6xxx_ppu_state_destroy(struct mv88e6xxx_chip *chip)
+static void mv88e6xxx_phy_ppu_state_destroy(struct mv88e6xxx_chip *chip)
{
del_timer_sync(&chip->ppu_timer);
}
@@ -207,10 +207,10 @@ int mv88e6185_phy_ppu_read(struct mv88e6xxx_chip *chip, struct mii_bus *bus,
{
int err;
- err = mv88e6xxx_ppu_access_get(chip);
+ err = mv88e6xxx_phy_ppu_access_get(chip);
if (!err) {
err = mv88e6xxx_read(chip, addr, reg, val);
- mv88e6xxx_ppu_access_put(chip);
+ mv88e6xxx_phy_ppu_access_put(chip);
}
return err;
@@ -221,10 +221,10 @@ int mv88e6185_phy_ppu_write(struct mv88e6xxx_chip *chip, struct mii_bus *bus,
{
int err;
- err = mv88e6xxx_ppu_access_get(chip);
+ err = mv88e6xxx_phy_ppu_access_get(chip);
if (!err) {
err = mv88e6xxx_write(chip, addr, reg, val);
- mv88e6xxx_ppu_access_put(chip);
+ mv88e6xxx_phy_ppu_access_put(chip);
}
return err;
@@ -233,16 +233,16 @@ int mv88e6185_phy_ppu_write(struct mv88e6xxx_chip *chip, struct mii_bus *bus,
void mv88e6xxx_phy_init(struct mv88e6xxx_chip *chip)
{
if (chip->info->ops->ppu_enable && chip->info->ops->ppu_disable)
- mv88e6xxx_ppu_state_init(chip);
+ mv88e6xxx_phy_ppu_state_init(chip);
}
void mv88e6xxx_phy_destroy(struct mv88e6xxx_chip *chip)
{
if (chip->info->ops->ppu_enable && chip->info->ops->ppu_disable)
- mv88e6xxx_ppu_state_destroy(chip);
+ mv88e6xxx_phy_ppu_state_destroy(chip);
}
int mv88e6xxx_phy_setup(struct mv88e6xxx_chip *chip)
{
- return mv88e6xxx_ppu_enable(chip);
+ return mv88e6xxx_phy_ppu_enable(chip);
}
--
2.13.0
^ permalink raw reply related
* [PATCH net-next 1/3] net: dsa: mv88e6xxx: provide a PHY setup helper
From: Vivien Didelot @ 2017-05-26 22:03 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, kernel, David S. Miller, Florian Fainelli,
Andrew Lunn, Vivien Didelot
In-Reply-To: <20170526220307.23503-1-vivien.didelot@savoirfairelinux.com>
Similarly to the VTU, PVT and ATU setup, provide a mv88e6xxx_phy_setup
helper which wraps mv88e6xxx_ppu_enable, so that no more PPU-related
functions are exposed outside of phy.c.
Thus make mv88e6xxx_ppu_enable static.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 11 ++++-------
drivers/net/dsa/mv88e6xxx/phy.c | 7 ++++++-
drivers/net/dsa/mv88e6xxx/phy.h | 2 +-
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 742c0eae7fa3..7f5f44f89389 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -2034,13 +2034,6 @@ static int mv88e6xxx_g1_setup(struct mv88e6xxx_chip *chip)
u32 upstream_port = dsa_upstream_port(ds);
int err;
- /* Enable the PHY Polling Unit if present, don't discard any packets,
- * and mask all interrupt sources.
- */
- err = mv88e6xxx_ppu_enable(chip);
- if (err)
- return err;
-
if (chip->info->ops->g1_set_cpu_port) {
err = chip->info->ops->g1_set_cpu_port(chip, upstream_port);
if (err)
@@ -2140,6 +2133,10 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
goto unlock;
}
+ err = mv88e6xxx_phy_setup(chip);
+ if (err)
+ goto unlock;
+
err = mv88e6xxx_vtu_setup(chip);
if (err)
goto unlock;
diff --git a/drivers/net/dsa/mv88e6xxx/phy.c b/drivers/net/dsa/mv88e6xxx/phy.c
index 0d3e8aaedf50..b865b1e2b103 100644
--- a/drivers/net/dsa/mv88e6xxx/phy.c
+++ b/drivers/net/dsa/mv88e6xxx/phy.c
@@ -124,7 +124,7 @@ static int mv88e6xxx_ppu_disable(struct mv88e6xxx_chip *chip)
return chip->info->ops->ppu_disable(chip);
}
-int mv88e6xxx_ppu_enable(struct mv88e6xxx_chip *chip)
+static int mv88e6xxx_ppu_enable(struct mv88e6xxx_chip *chip)
{
if (!chip->info->ops->ppu_enable)
return 0;
@@ -241,3 +241,8 @@ void mv88e6xxx_phy_destroy(struct mv88e6xxx_chip *chip)
if (chip->info->ops->ppu_enable && chip->info->ops->ppu_disable)
mv88e6xxx_ppu_state_destroy(chip);
}
+
+int mv88e6xxx_phy_setup(struct mv88e6xxx_chip *chip)
+{
+ return mv88e6xxx_ppu_enable(chip);
+}
diff --git a/drivers/net/dsa/mv88e6xxx/phy.h b/drivers/net/dsa/mv88e6xxx/phy.h
index 0961d781b726..dfa98549dfcd 100644
--- a/drivers/net/dsa/mv88e6xxx/phy.h
+++ b/drivers/net/dsa/mv88e6xxx/phy.h
@@ -30,8 +30,8 @@ int mv88e6xxx_phy_ppu_read(struct mv88e6xxx_chip *chip, struct mii_bus *bus,
int addr, int reg, u16 *val);
int mv88e6xxx_phy_ppu_write(struct mv88e6xxx_chip *chip, struct mii_bus *bus,
int addr, int reg, u16 val);
-int mv88e6xxx_ppu_enable(struct mv88e6xxx_chip *chip);
void mv88e6xxx_phy_init(struct mv88e6xxx_chip *chip);
void mv88e6xxx_phy_destroy(struct mv88e6xxx_chip *chip);
+int mv88e6xxx_phy_setup(struct mv88e6xxx_chip *chip);
#endif /*_MV88E6XXX_PHY_H */
--
2.13.0
^ permalink raw reply related
* [PATCH net-next 0/3] net: dsa: mv88e6xxx: PHY nitpicks
From: Vivien Didelot @ 2017-05-26 22:03 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, kernel, David S. Miller, Florian Fainelli,
Andrew Lunn, Vivien Didelot
This patchset isolates more PPU code into phy.c and makes distinction
between PHY Registers read and write implementations vs. generic PHY
routines.
Vivien Didelot (3):
net: dsa: mv88e6xxx: provide a PHY setup helper
net: dsa: mv88e6xxx: rename PHY PPU accessors
net: dsa: mv88e6xxx: rename PHY PPU functions
drivers/net/dsa/mv88e6xxx/chip.c | 27 +++++++++++-------------
drivers/net/dsa/mv88e6xxx/phy.c | 45 ++++++++++++++++++++++------------------
drivers/net/dsa/mv88e6xxx/phy.h | 13 +++++++-----
3 files changed, 45 insertions(+), 40 deletions(-)
--
2.13.0
^ permalink raw reply
* [PATCH net-next] net: dsa: mv88e6xxx: handle SERDES error appropriately
From: Vivien Didelot @ 2017-05-26 22:02 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, kernel, David S. Miller, Florian Fainelli,
Andrew Lunn, Vivien Didelot
mv88e6xxx_serdes_power returns an error, so no need to print an error
message inside of it. Rather print it in its caller when the error is
ignored, which is in the mv88e6xxx_port_disable void function.
Catch and return its error in the counterpart mv88e6xxx_port_enable.
Fixes: 04aca9938255 ("dsa: mv88e6xxx: Enable/Disable SERDES on port enable/disable")
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index c2f38f6770aa..742c0eae7fa3 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -1806,16 +1806,10 @@ static int mv88e6xxx_setup_egress_floods(struct mv88e6xxx_chip *chip, int port)
static int mv88e6xxx_serdes_power(struct mv88e6xxx_chip *chip, int port,
bool on)
{
- int err = 0;
+ if (chip->info->ops->serdes_power)
+ return chip->info->ops->serdes_power(chip, port, on);
- if (chip->info->ops->serdes_power) {
- err = chip->info->ops->serdes_power(chip, port, on);
- if (err)
- dev_err(chip->dev,
- "Failed to change SERDES power: %d\n", err);
- }
-
- return err;
+ return 0;
}
static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
@@ -1982,10 +1976,10 @@ static int mv88e6xxx_port_enable(struct dsa_switch *ds, int port,
struct phy_device *phydev)
{
struct mv88e6xxx_chip *chip = ds->priv;
- int err = 0;
+ int err;
mutex_lock(&chip->reg_lock);
- mv88e6xxx_serdes_power(chip, port, true);
+ err = mv88e6xxx_serdes_power(chip, port, true);
mutex_unlock(&chip->reg_lock);
return err;
@@ -1997,7 +1991,8 @@ static void mv88e6xxx_port_disable(struct dsa_switch *ds, int port,
struct mv88e6xxx_chip *chip = ds->priv;
mutex_lock(&chip->reg_lock);
- mv88e6xxx_serdes_power(chip, port, false);
+ if (mv88e6xxx_serdes_power(chip, port, false))
+ dev_err(chip->dev, "failed to power off SERDES\n");
mutex_unlock(&chip->reg_lock);
}
--
2.13.0
^ permalink raw reply related
* [PATCH net-next] net: ndisc.c: reduce size of __ndisc_fill_addr_option()
From: yuan linyu @ 2017-05-26 22:00 UTC (permalink / raw)
To: netdev; +Cc: David S . Miller, Joe Perches, David Ahern, yuan linyu
From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
---
net/ipv6/ndisc.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index d310dc4..414e929 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -148,17 +148,18 @@ void __ndisc_fill_addr_option(struct sk_buff *skb, int type, void *data,
opt[0] = type;
opt[1] = space>>3;
+ opt += 2;
+ space -= 2;
- memset(opt + 2, 0, pad);
+ memset(opt, 0, pad);
opt += pad;
space -= pad;
- memcpy(opt+2, data, data_len);
- data_len += 2;
+ memcpy(opt, data, data_len);
opt += data_len;
space -= data_len;
- if (space > 0)
- memset(opt, 0, space);
+
+ memset(opt, 0, space);
}
EXPORT_SYMBOL_GPL(__ndisc_fill_addr_option);
--
2.7.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox