* [PATCH 1/2] net: ethernet: renesas: sh_eth: use phydev from struct net_device
@ 2016-08-09 22:04 Philippe Reynes
2016-08-09 22:04 ` [PATCH 2/2] net: ethernet: renesas: sh_eth: use new api ethtool_{get|set}_link_ksettings Philippe Reynes
2016-08-10 9:19 ` Simon Horman
0 siblings, 2 replies; 6+ messages in thread
From: Philippe Reynes @ 2016-08-09 22:04 UTC (permalink / raw)
To: sergei.shtylyov, davem, horms+renesas, geert+renesas, andrew
Cc: netdev, linux-renesas-soc, linux-kernel, Philippe Reynes
The private structure contain a pointer to phydev, but the structure
net_device already contain such pointer. So we can remove the pointer
phy_dev in the private structure, and update the driver to use the
one contained in struct net_device.
Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
---
drivers/net/ethernet/renesas/sh_eth.c | 29 ++++++++++++-----------------
drivers/net/ethernet/renesas/sh_eth.h | 1 -
2 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 799d58d..901ed36 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1723,7 +1723,7 @@ out:
static void sh_eth_adjust_link(struct net_device *ndev)
{
struct sh_eth_private *mdp = netdev_priv(ndev);
- struct phy_device *phydev = mdp->phydev;
+ struct phy_device *phydev = ndev->phydev;
int new_state = 0;
if (phydev->link) {
@@ -1800,22 +1800,19 @@ static int sh_eth_phy_init(struct net_device *ndev)
phy_attached_info(phydev);
- mdp->phydev = phydev;
-
return 0;
}
/* PHY control start function */
static int sh_eth_phy_start(struct net_device *ndev)
{
- struct sh_eth_private *mdp = netdev_priv(ndev);
int ret;
ret = sh_eth_phy_init(ndev);
if (ret)
return ret;
- phy_start(mdp->phydev);
+ phy_start(ndev->phydev);
return 0;
}
@@ -1827,11 +1824,11 @@ static int sh_eth_get_settings(struct net_device *ndev,
unsigned long flags;
int ret;
- if (!mdp->phydev)
+ if (!ndev->phydev)
return -ENODEV;
spin_lock_irqsave(&mdp->lock, flags);
- ret = phy_ethtool_gset(mdp->phydev, ecmd);
+ ret = phy_ethtool_gset(ndev->phydev, ecmd);
spin_unlock_irqrestore(&mdp->lock, flags);
return ret;
@@ -1844,7 +1841,7 @@ static int sh_eth_set_settings(struct net_device *ndev,
unsigned long flags;
int ret;
- if (!mdp->phydev)
+ if (!ndev->phydev)
return -ENODEV;
spin_lock_irqsave(&mdp->lock, flags);
@@ -1852,7 +1849,7 @@ static int sh_eth_set_settings(struct net_device *ndev,
/* disable tx and rx */
sh_eth_rcv_snd_disable(ndev);
- ret = phy_ethtool_sset(mdp->phydev, ecmd);
+ ret = phy_ethtool_sset(ndev->phydev, ecmd);
if (ret)
goto error_exit;
@@ -2067,11 +2064,11 @@ static int sh_eth_nway_reset(struct net_device *ndev)
unsigned long flags;
int ret;
- if (!mdp->phydev)
+ if (!ndev->phydev)
return -ENODEV;
spin_lock_irqsave(&mdp->lock, flags);
- ret = phy_start_aneg(mdp->phydev);
+ ret = phy_start_aneg(ndev->phydev);
spin_unlock_irqrestore(&mdp->lock, flags);
return ret;
@@ -2408,10 +2405,9 @@ static int sh_eth_close(struct net_device *ndev)
sh_eth_dev_exit(ndev);
/* PHY Disconnect */
- if (mdp->phydev) {
- phy_stop(mdp->phydev);
- phy_disconnect(mdp->phydev);
- mdp->phydev = NULL;
+ if (ndev->phydev) {
+ phy_stop(ndev->phydev);
+ phy_disconnect(ndev->phydev);
}
free_irq(ndev->irq, ndev);
@@ -2429,8 +2425,7 @@ static int sh_eth_close(struct net_device *ndev)
/* ioctl to device function */
static int sh_eth_do_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
{
- struct sh_eth_private *mdp = netdev_priv(ndev);
- struct phy_device *phydev = mdp->phydev;
+ struct phy_device *phydev = ndev->phydev;
if (!netif_running(ndev))
return -EINVAL;
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
index c62380e..d050f37 100644
--- a/drivers/net/ethernet/renesas/sh_eth.h
+++ b/drivers/net/ethernet/renesas/sh_eth.h
@@ -518,7 +518,6 @@ struct sh_eth_private {
/* MII transceiver section. */
u32 phy_id; /* PHY ID */
struct mii_bus *mii_bus; /* MDIO bus control */
- struct phy_device *phydev; /* PHY device control */
int link;
phy_interface_t phy_interface;
int msg_enable;
--
1.7.4.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] net: ethernet: renesas: sh_eth: use new api ethtool_{get|set}_link_ksettings
2016-08-09 22:04 [PATCH 1/2] net: ethernet: renesas: sh_eth: use phydev from struct net_device Philippe Reynes
@ 2016-08-09 22:04 ` Philippe Reynes
2016-08-10 9:29 ` Simon Horman
2016-08-10 9:19 ` Simon Horman
1 sibling, 1 reply; 6+ messages in thread
From: Philippe Reynes @ 2016-08-09 22:04 UTC (permalink / raw)
To: sergei.shtylyov, davem, horms+renesas, geert+renesas, andrew
Cc: netdev, linux-renesas-soc, linux-kernel, Philippe Reynes
The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.
Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
---
drivers/net/ethernet/renesas/sh_eth.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 901ed36..1f8240a 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1817,8 +1817,8 @@ static int sh_eth_phy_start(struct net_device *ndev)
return 0;
}
-static int sh_eth_get_settings(struct net_device *ndev,
- struct ethtool_cmd *ecmd)
+static int sh_eth_get_link_ksettings(struct net_device *ndev,
+ struct ethtool_link_ksettings *cmd)
{
struct sh_eth_private *mdp = netdev_priv(ndev);
unsigned long flags;
@@ -1828,14 +1828,14 @@ static int sh_eth_get_settings(struct net_device *ndev,
return -ENODEV;
spin_lock_irqsave(&mdp->lock, flags);
- ret = phy_ethtool_gset(ndev->phydev, ecmd);
+ ret = phy_ethtool_ksettings_get(ndev->phydev, cmd);
spin_unlock_irqrestore(&mdp->lock, flags);
return ret;
}
-static int sh_eth_set_settings(struct net_device *ndev,
- struct ethtool_cmd *ecmd)
+static int sh_eth_set_link_ksettings(struct net_device *ndev,
+ const struct ethtool_link_ksettings *cmd)
{
struct sh_eth_private *mdp = netdev_priv(ndev);
unsigned long flags;
@@ -1849,11 +1849,11 @@ static int sh_eth_set_settings(struct net_device *ndev,
/* disable tx and rx */
sh_eth_rcv_snd_disable(ndev);
- ret = phy_ethtool_sset(ndev->phydev, ecmd);
+ ret = phy_ethtool_ksettings_set(ndev->phydev, cmd);
if (ret)
goto error_exit;
- if (ecmd->duplex == DUPLEX_FULL)
+ if (cmd->base.duplex == DUPLEX_FULL)
mdp->duplex = 1;
else
mdp->duplex = 0;
@@ -2195,8 +2195,6 @@ static int sh_eth_set_ringparam(struct net_device *ndev,
}
static const struct ethtool_ops sh_eth_ethtool_ops = {
- .get_settings = sh_eth_get_settings,
- .set_settings = sh_eth_set_settings,
.get_regs_len = sh_eth_get_regs_len,
.get_regs = sh_eth_get_regs,
.nway_reset = sh_eth_nway_reset,
@@ -2208,6 +2206,8 @@ static const struct ethtool_ops sh_eth_ethtool_ops = {
.get_sset_count = sh_eth_get_sset_count,
.get_ringparam = sh_eth_get_ringparam,
.set_ringparam = sh_eth_set_ringparam,
+ .get_link_ksettings = sh_eth_get_link_ksettings,
+ .set_link_ksettings = sh_eth_set_link_ksettings,
};
/* network device open function */
--
1.7.4.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] net: ethernet: renesas: sh_eth: use phydev from struct net_device
2016-08-09 22:04 [PATCH 1/2] net: ethernet: renesas: sh_eth: use phydev from struct net_device Philippe Reynes
@ 2016-08-10 9:19 ` Simon Horman
2016-08-10 9:19 ` Simon Horman
1 sibling, 0 replies; 6+ messages in thread
From: Simon Horman @ 2016-08-10 9:19 UTC (permalink / raw)
To: Philippe Reynes
Cc: sergei.shtylyov, davem, geert+renesas, andrew, netdev,
linux-renesas-soc, linux-kernel, linux-sh
[CC linux-sh as some of those boards use this driver]
On Wed, Aug 10, 2016 at 12:04:48AM +0200, Philippe Reynes wrote:
> The private structure contain a pointer to phydev, but the structure
> net_device already contain such pointer. So we can remove the pointer
> phy_dev in the private structure, and update the driver to use the
> one contained in struct net_device.
>
> Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
I have looked over this and it seems good to me.
I have also tested it on the r8a7790/Lager board and it appears to work.
Tested-by: Simon Horman <horms+renesas@verge.net.au>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] net: ethernet: renesas: sh_eth: use phydev from struct net_device
@ 2016-08-10 9:19 ` Simon Horman
0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2016-08-10 9:19 UTC (permalink / raw)
To: Philippe Reynes
Cc: sergei.shtylyov, davem, geert+renesas, andrew, netdev,
linux-renesas-soc, linux-kernel, linux-sh
[CC linux-sh as some of those boards use this driver]
On Wed, Aug 10, 2016 at 12:04:48AM +0200, Philippe Reynes wrote:
> The private structure contain a pointer to phydev, but the structure
> net_device already contain such pointer. So we can remove the pointer
> phy_dev in the private structure, and update the driver to use the
> one contained in struct net_device.
>
> Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
I have looked over this and it seems good to me.
I have also tested it on the r8a7790/Lager board and it appears to work.
Tested-by: Simon Horman <horms+renesas@verge.net.au>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] net: ethernet: renesas: sh_eth: use new api ethtool_{get|set}_link_ksettings
2016-08-09 22:04 ` [PATCH 2/2] net: ethernet: renesas: sh_eth: use new api ethtool_{get|set}_link_ksettings Philippe Reynes
@ 2016-08-10 9:29 ` Simon Horman
0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2016-08-10 9:29 UTC (permalink / raw)
To: Philippe Reynes
Cc: sergei.shtylyov, davem, geert+renesas, andrew, netdev,
linux-renesas-soc, linux-kernel, linux-sh
[CC linux-sh as some of those boards use this driver]
Hi Phillippe,
On Wed, Aug 10, 2016 at 12:04:49AM +0200, Philippe Reynes wrote:
> The ethtool api {get|set}_settings is deprecated.
> We move this driver to new api {get|set}_link_ksettings.
>
> Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Thanks this change looks reasonable to me.
I have also tested it as follows on the r8a7790/Lager board and it
appears to work.
Tested-by: Simon Horman <horms+renesas@verge.net.au>
# ethtool -h | head -1
ethtool version 3.1
# ethtool -i eth0
driver: sh-eth
version:
firmware-version:
bus-info: ee700000.ethernet
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: yes
# ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Link partner advertised pause frame use: No
Link partner advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: MII
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Current message level: 0x000000cc (204)
link timer rx_err tx_err
Link detected: yes
# ethtool -s eth0 speed 10 duplex half
--- start kernel messages ---
[ 375.640312] sh-eth ee700000.ethernet eth0: Link is Down
[ 377.360727] sh-eth ee700000.ethernet eth0: Link is Up - 10Mbps/Half - flow control off
--- end kernel messages ---
# ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Link partner advertised pause frame use: No
Link partner advertised auto-negotiation: Yes
Speed: 10Mb/s
Duplex: Half
Port: MII
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Current message level: 0x000000cc (204)
link timer rx_err tx_err
Link detected: yes
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] net: ethernet: renesas: sh_eth: use new api ethtool_{get|set}_link_ksettings
@ 2016-08-10 9:29 ` Simon Horman
0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2016-08-10 9:29 UTC (permalink / raw)
To: Philippe Reynes
Cc: sergei.shtylyov, davem, geert+renesas, andrew, netdev,
linux-renesas-soc, linux-kernel, linux-sh
[CC linux-sh as some of those boards use this driver]
Hi Phillippe,
On Wed, Aug 10, 2016 at 12:04:49AM +0200, Philippe Reynes wrote:
> The ethtool api {get|set}_settings is deprecated.
> We move this driver to new api {get|set}_link_ksettings.
>
> Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Thanks this change looks reasonable to me.
I have also tested it as follows on the r8a7790/Lager board and it
appears to work.
Tested-by: Simon Horman <horms+renesas@verge.net.au>
# ethtool -h | head -1
ethtool version 3.1
# ethtool -i eth0
driver: sh-eth
version:
firmware-version:
bus-info: ee700000.ethernet
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: yes
# ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Link partner advertised pause frame use: No
Link partner advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: MII
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Current message level: 0x000000cc (204)
link timer rx_err tx_err
Link detected: yes
# ethtool -s eth0 speed 10 duplex half
--- start kernel messages ---
[ 375.640312] sh-eth ee700000.ethernet eth0: Link is Down
[ 377.360727] sh-eth ee700000.ethernet eth0: Link is Up - 10Mbps/Half - flow control off
--- end kernel messages ---
# ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Link partner advertised pause frame use: No
Link partner advertised auto-negotiation: Yes
Speed: 10Mb/s
Duplex: Half
Port: MII
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Current message level: 0x000000cc (204)
link timer rx_err tx_err
Link detected: yes
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-08-10 19:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-09 22:04 [PATCH 1/2] net: ethernet: renesas: sh_eth: use phydev from struct net_device Philippe Reynes
2016-08-09 22:04 ` [PATCH 2/2] net: ethernet: renesas: sh_eth: use new api ethtool_{get|set}_link_ksettings Philippe Reynes
2016-08-10 9:29 ` Simon Horman
2016-08-10 9:29 ` Simon Horman
2016-08-10 9:19 ` [PATCH 1/2] net: ethernet: renesas: sh_eth: use phydev from struct net_device Simon Horman
2016-08-10 9:19 ` Simon Horman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.