Re: [PATCH] drivers/net/: ll_temac_main.c & ll_temac.h: Adding ethtool interface

Previous thread: [RFC PATCH 00/11] sched: CFS low-latency features by Mathieu Desnoyers on Thursday, August 26, 2010 - 11:09 am. (36 messages)

Next thread: [PATCH 1/5] vfs: implement open "forwarding" by Miklos Szeredi on Thursday, August 26, 2010 - 11:33 am. (1 message)
From: Ville Sundell
Date: Thursday, August 26, 2010 - 11:13 am

This patch adds an interface to the ethtool subsystem and
implements read/write functionality for handling settings with the
ethtool_cmd structure. "Speed" is the only setting implemented so far.
Other settings (like reading the duplex value) can be easily implemented
later on.

One can read the speed of the link by reading /sys/class/net/eth0/speed.
It seems that you can't write to /sys/class/net/eth0/speed, so the
"ethtool" command line utility must be used to set the speed.

So far, it is tested only in the DMA mode, since I don't have hardware
with DCR available.

Signed-off-by: Ville Sundell <ville.sundell@digilent.ro>
---

When using a non-static PHY and 100Mbit connection in Temac, the speed
is not changed and stays at the reset value (1000Mbit). This leads to a
situation where data is not sent or received correctly since
temac_adjust_link() is not called due to lack of static PHY.  Therefore
the link speed retains the reset value.

There is also no possibility to read or set the link speed from the user
space.

The patch is done against the newest version of ll_temac_main.cc and
ll_temac.h of the linux-next tree.

Thanks to Michal Simek for his feedback on this patch!

Regards,
Ville Sundell
Digilent Inc.

 drivers/net/ll_temac.h      |    3 ++
 drivers/net/ll_temac_main.c |   76 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ll_temac.h b/drivers/net/ll_temac.h
index 522abe2..ddd00cc 100644
--- a/drivers/net/ll_temac.h
+++ b/drivers/net/ll_temac.h
@@ -247,6 +247,9 @@ This option defaults to enabled (set) */
 #define XTE_EMCFG_LINKSPD_10		0x00000000 /* 10 Mbit LINKSPD_MASK */
 #define XTE_EMCFG_LINKSPD_100		(1 << 30)  /* 100 Mbit LINKSPD_MASK */
 #define XTE_EMCFG_LINKSPD_1000		(1 << 31)  /* 1000 Mbit LINKSPD_MASK */
+#define XTE_EMCFG_LINKSPD_NA		0xC0000000 /* For undefined speed */
+
+#define TEMAC_SPEED_NA			0 /* To indicate XTE_EMCFG_LINKSPD_NA */
 
 #define ...
From: Grant Likely
Date: Thursday, August 26, 2010 - 12:26 pm

On Thu, Aug 26, 2010 at 12:13 PM, Ville Sundell

The ll_temac driver uses phylib.  The Ethtool ops should then also be
implemented using phylib and not by writing to the ll_temac registers
directly.  Otherwise changes to the ll_temac speed will not be
reflected in the PHY.




-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--

Previous thread: [RFC PATCH 00/11] sched: CFS low-latency features by Mathieu Desnoyers on Thursday, August 26, 2010 - 11:09 am. (36 messages)

Next thread: [PATCH 1/5] vfs: implement open "forwarding" by Miklos Szeredi on Thursday, August 26, 2010 - 11:33 am. (1 message)