* [PATCH V2 07/11] dnet: enable transmit time stamping.
From: Richard Cochran @ 2011-06-10 15:24 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Ilya Yanok
In-Reply-To: <cover.1307719258.git.richard.cochran@omicron.at>
This patch enables software (and phy device) transmit time stamping
in the "Dave ethernet interface." Compile tested only.
Cc: Ilya Yanok <yanok@emcraft.com>
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
drivers/net/dnet.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/net/dnet.c b/drivers/net/dnet.c
index 8318ea0..c36763c 100644
--- a/drivers/net/dnet.c
+++ b/drivers/net/dnet.c
@@ -587,6 +587,8 @@ static netdev_tx_t dnet_start_xmit(struct sk_buff *skb, struct net_device *dev)
dnet_writel(bp, irq_enable, INTR_ENB);
}
+ skb_tx_timestamp(skb);
+
/* free the buffer */
dev_kfree_skb(skb);
--
1.7.0.4
^ permalink raw reply related
* [PATCH V2 06/11] tg3: enable transmit time stamping.
From: Richard Cochran @ 2011-06-10 15:24 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Matt Carlson, Michael Chan
In-Reply-To: <cover.1307719258.git.richard.cochran@omicron.at>
This patch enables software (and phy device) transmit time stamping
for the TIGON3 driver. Compile tested only.
Cc: Matt Carlson <mcarlson@broadcom.com>
Cc: Michael Chan <mchan@broadcom.com>
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
drivers/net/tg3.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index f4b01c6..e6b4f14 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -6091,6 +6091,8 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Packets are ready, update Tx producer idx local and on card. */
tw32_tx_mbox(tnapi->prodmbox, entry);
+ skb_tx_timestamp(skb);
+
tnapi->tx_prod = entry;
if (unlikely(tg3_tx_avail(tnapi) <= (MAX_SKB_FRAGS + 1))) {
netif_tx_stop_queue(txq);
--
1.7.0.4
^ permalink raw reply related
* [PATCH V2 05/11] davinci_emac: enable transmit time stamping.
From: Richard Cochran @ 2011-06-10 15:24 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Anant Gole, Kevin Hilman, Chaithrika U S
In-Reply-To: <cover.1307719258.git.richard.cochran@omicron.at>
This patch enables software (and phy device) transmit time stamping
for the DaVinci EMAC driver. Tested together with the dp83640 PHY.
Cc: Anant Gole <anantgole@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Chaithrika U S <chaithrika@ti.com>
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
drivers/net/davinci_emac.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index efa2901..52ea30e 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -1090,6 +1090,7 @@ static int emac_dev_xmit(struct sk_buff *skb, struct net_device *ndev)
dev_err(emac_dev, "DaVinci EMAC: desc submit failed");
goto fail_tx;
}
+ skb_tx_timestamp(skb);
return NETDEV_TX_OK;
--
1.7.0.4
^ permalink raw reply related
* [PATCH V2 04/11] davinci_emac: pass ioctls through to phy device.
From: Richard Cochran @ 2011-06-10 15:24 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Anant Gole, Kevin Hilman, Chaithrika U S
In-Reply-To: <cover.1307719258.git.richard.cochran@omicron.at>
The DaVinci EMAC driver does not implement any ioctls, but still it can
pass them through to the phy device. This makes it possible for a phy
to offer PHC capabilities.
Cc: Anant Gole <anantgole@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Chaithrika U S <chaithrika@ti.com>
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
drivers/net/davinci_emac.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 29a4f06..efa2901 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -1489,14 +1489,14 @@ static void emac_adjust_link(struct net_device *ndev)
*/
static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd)
{
- dev_warn(&ndev->dev, "DaVinci EMAC: ioctl not supported\n");
+ struct emac_priv *priv = netdev_priv(ndev);
if (!(netif_running(ndev)))
return -EINVAL;
/* TODO: Add phy read and write and private statistics get feature */
- return -EOPNOTSUPP;
+ return phy_mii_ioctl(priv->phydev, ifrq, cmd);
}
static int match_first_device(struct device *dev, void *data)
--
1.7.0.4
^ permalink raw reply related
* [PATCH V2 03/11] fec: enable transmit and receive time stamping.
From: Richard Cochran @ 2011-06-10 15:24 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Greg Ungerer, Uwe Kleine-König, Shawn Guo
In-Reply-To: <cover.1307719258.git.richard.cochran@omicron.at>
This patch has been tested on the Freescale M5234BCC, which includes the
National Semiconductor DP83640 with IEEE 1588 support.
Cc: Greg Ungerer <gerg@uclinux.org>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
drivers/net/fec.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 885d8ba..68d479b 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -326,6 +326,8 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
spin_unlock_irqrestore(&fep->hw_lock, flags);
+ skb_tx_timestamp(skb);
+
return NETDEV_TX_OK;
}
@@ -650,7 +652,7 @@ fec_enet_rx(struct net_device *ndev)
skb_put(skb, pkt_len - 4); /* Make room */
skb_copy_to_linear_data(skb, data, pkt_len - 4);
skb->protocol = eth_type_trans(skb, ndev);
- netif_rx(skb);
+ netif_rx_defer(skb);
}
bdp->cbd_bufaddr = dma_map_single(&fep->pdev->dev, data,
--
1.7.0.4
^ permalink raw reply related
* [PATCH V2 02/11] net: introduce time stamping wrapper for netif_rx.
From: Richard Cochran @ 2011-06-10 15:24 UTC (permalink / raw)
To: netdev; +Cc: David Miller
In-Reply-To: <cover.1307719258.git.richard.cochran@omicron.at>
This commit adds a variation on netif_rx() designed to allow non-NAPI
Ethernet MAC drivers to support hardware time stamping in PHY devices.
Adapting a given driver requires two small changes, namely replacing
netif_rx() with netif_rx_defer() and adding a call to skb_tx_timestamp()
in the transmission path.
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
include/linux/netdevice.h | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ca333e7..9a56505 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2066,6 +2066,27 @@ extern void dev_kfree_skb_any(struct sk_buff *skb);
#define HAVE_NETIF_RX 1
extern int netif_rx(struct sk_buff *skb);
extern int netif_rx_ni(struct sk_buff *skb);
+
+/**
+ * netif_rx_defer() - post buffer to the network code
+ * @skb: buffer to post
+ *
+ * This function receives a packet from a device driver and queues it
+ * for the upper (protocol) levels to process. All non-NAPI Ethernet
+ * MAC drivers should use this instead of netif_rx() since this method
+ * allows hardware timestamping to occur within the PHY.
+ *
+ * return values:
+ * NET_RX_SUCCESS (no congestion)
+ * NET_RX_DROP (packet was dropped)
+ */
+static inline int netif_rx_defer(struct sk_buff *skb)
+{
+ if (skb_defer_rx_timestamp(skb))
+ return NET_RX_SUCCESS;
+ return netif_rx(skb);
+}
+
#define HAVE_NETIF_RECEIVE_SKB 1
extern int netif_receive_skb(struct sk_buff *skb);
extern gro_result_t dev_gro_receive(struct napi_struct *napi,
--
1.7.0.4
^ permalink raw reply related
* [PATCH V2 01/11] net: export time stamp utility function for Ethernet MAC drivers
From: Richard Cochran @ 2011-06-10 15:24 UTC (permalink / raw)
To: netdev; +Cc: David Miller
In-Reply-To: <cover.1307719258.git.richard.cochran@omicron.at>
The network stack provides the function, skb_clone_tx_timestamp().
Ethernet MAC drivers can call this via the transmit time stamping
hook, skb_tx_timestamp(). This commit exports the clone function so
that drivers using it can be compiled as modules.
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
net/core/timestamping.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/net/core/timestamping.c b/net/core/timestamping.c
index 7e7ca37..3b00a6b 100644
--- a/net/core/timestamping.c
+++ b/net/core/timestamping.c
@@ -68,6 +68,7 @@ void skb_clone_tx_timestamp(struct sk_buff *skb)
break;
}
}
+EXPORT_SYMBOL_GPL(skb_clone_tx_timestamp);
void skb_complete_tx_timestamp(struct sk_buff *skb,
struct skb_shared_hwtstamps *hwtstamps)
--
1.7.0.4
^ permalink raw reply related
* [PATCH V2 00/11] net: expand time stamping, batch #1
From: Richard Cochran @ 2011-06-10 15:24 UTC (permalink / raw)
To: netdev; +Cc: David Miller
(This is V2 - forgot one of the patches when first posted, sorry)
This patch series represents the start of an effort to get better
coverage of the SO_TIMESTAMPING socket API in the Ethernet drivers.
Adding time stamping support to a given driver solves two separate
issues, namely software transmit time stamping and hardware time
stamping in PHY devices.
The SO_TIMESTAMPING socket API has been around since 2.6.30, but it
turned out that getting software transmit time stamps could not be
done in one central place in the stack. Instead, a work around was
introduced whereby each MAC driver must call a skb_tx_timestamp() hook
in order to support SW Tx time stamps.
Full PTP Hardware Clock (PHC) support has been merged for Linux 3.0,
including a driver for a PHY that does HW stamping. In the receive
path, the PHY based time stamping is handled by the stack for NAPI
based MAC drivers. But for transmit time stamps, support is needed in
the Ethernet MAC driver by calling the skb_tx_timestamp() hook.
For non-NAPI drivers, PHY based receive time stamping is currently not
possible. This patch series adds yet another hook (a wrapper around
netif_rx) for such drivers.
The first two patches make minor changes in the stack in support of
MAC/PHY time stamping. The next three patches enable PHY time stamping
for two MACs which have been paired with a PHC PHY on real life
boards.
The remaining patches are for MACs that I chose because they (1) use
phylib and (2) compile for x86. However, I only compiled these, not
tested, since I do not have the hardware.
The larger goal is to eventually get the skb_tx_timestamp hook into
each and every Ethernet MAC driver, so that SO_TIMESTAMPING using SW
time stamps will be supported across the board. I have started by
picking those drivers in which adding the hook will bring the greatest
benefit, namely those using phylib, since adding hooks provides both
SW and PHY HW time stamping.
If people approve of this effort, I will follow with another patch
series adding SW Tx time stamping to yet more MACs. Adding SW Tx
support is just a single line, but still, perhaps compile testing only
is too risky. I would appreciate feedback on this issue.
Richard Cochran (11):
net: export time stamp utility function for Ethernet MAC drivers
net: introduce time stamping wrapper for netif_rx.
fec: enable transmit and receive time stamping.
davinci_emac: pass ioctls through to phy device.
davinci_emac: enable transmit time stamping.
tg3: enable transmit time stamping.
dnet: enable transmit time stamping.
ethoc: enable transmit time stamping.
r6040: enable transmit time stamping.
stmmac: enable transmit time stamping.
smsc9420: enable transmit time stamping.
drivers/net/davinci_emac.c | 5 +++--
drivers/net/dnet.c | 2 ++
drivers/net/ethoc.c | 1 +
drivers/net/fec.c | 4 +++-
drivers/net/r6040.c | 2 ++
drivers/net/smsc9420.c | 2 ++
drivers/net/stmmac/stmmac_main.c | 2 ++
drivers/net/tg3.c | 2 ++
include/linux/netdevice.h | 21 +++++++++++++++++++++
net/core/timestamping.c | 1 +
10 files changed, 39 insertions(+), 3 deletions(-)
^ permalink raw reply
* Re: [PATCH 01/10] net: introduce time stamping wrapper for netif_rx.
From: Stephen Hemminger @ 2011-06-10 15:20 UTC (permalink / raw)
To: Richard Cochran; +Cc: netdev, David Miller
In-Reply-To: <34a4527448b3a36c88d0c1c3cb9ad8661e693d7a.1307717675.git.richard.cochran@omicron.at>
On Fri, 10 Jun 2011 17:06:59 +0200
Richard Cochran <richardcochran@gmail.com> wrote:
> This commit adds a variation on netif_rx() designed to allow non-NAPI
> Ethernet MAC drivers to support hardware time stamping in PHY devices.
> Adapting a given driver requires two small changes, namely replacing
> netif_rx() with netif_rx_defer() and adding a call to skb_tx_timestamp()
> in the transmission path.
>
> Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
> ---
> include/linux/netdevice.h | 21 +++++++++++++++++++++
> 1 files changed, 21 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index ca333e7..9a56505 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -2066,6 +2066,27 @@ extern void dev_kfree_skb_any(struct sk_buff *skb);
> #define HAVE_NETIF_RX 1
> extern int netif_rx(struct sk_buff *skb);
> extern int netif_rx_ni(struct sk_buff *skb);
> +
> +/**
> + * netif_rx_defer() - post buffer to the network code
> + * @skb: buffer to post
> + *
> + * This function receives a packet from a device driver and queues it
> + * for the upper (protocol) levels to process. All non-NAPI Ethernet
> + * MAC drivers should use this instead of netif_rx() since this method
> + * allows hardware timestamping to occur within the PHY.
> + *
> + * return values:
> + * NET_RX_SUCCESS (no congestion)
> + * NET_RX_DROP (packet was dropped)
> + */
> +static inline int netif_rx_defer(struct sk_buff *skb)
> +{
> + if (skb_defer_rx_timestamp(skb))
> + return NET_RX_SUCCESS;
> + return netif_rx(skb);
> +}
Obvious question why not just put this in netif_rx.
^ permalink raw reply
* Re: TCP keepalives ignored by kernel when the contain timestamps
From: Charles Bearden @ 2011-06-10 15:10 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev
In-Reply-To: <1307714177.4044.4.camel@edumazet-laptop>
[-- Attachment #1: Type: text/plain, Size: 4550 bytes --]
On 06/10/2011 08:56 AM, Eric Dumazet wrote:
> Le jeudi 09 juin 2011 à 10:26 -0500, Charles Bearden a écrit :
>> I have come across a case that looks like it might be a kernel bug. It appears
>> that tcp keepalives sent by a remote system are ignored when they contain tcp
>> timestamps, but are ACKed when they don't. When they are ignored, the remote
>> system resets the connection after a number of retries.
>>
>> I have replicated this problem on both Ubuntu 10.04 with a 2.6.32-32-server
>> kernel (x86_64) and CentOS 5.6 with a 2.6.18-238.12.1.el5 kernel. I'm sorry that
>> I haven't had a chance to try to replicate the bug with a newer kernel, though a
>> co-worker has looked through changelogs for more recent kernels and didn't find
>> anything that looked relevant.
>>
>> From either of these hosts I run an application that connects to a remote host
>> for 2-3 minutes, and that for most of that time sends no application data back
>> and forth. After 30 seconds of no data from the Linux host, the remote host
>> sends a garden variety keepalive. When the remote host includes tcp timestamps
>> in the keepalives, they are ignored by the Linux host, and the remote host
>> resets the connection after 10 unACKed keepalives. When timestamps are absent
>> from the keepalives, the Linux host ACKs each one, and all is copacetic.
>>
>> Text output of a tcpdump trace of a connection that fails:
>> http://pastebin.com/v6CpteJ9
>>
>> Text output of a tcpdump trace of a connection that succeeds:
>> http://pastebin.com/KVLb3Mzh
>>
>> More details, in case you think they are relevant:
>>
>> My application creates a JDBC connection to a remote MS SQL Server and
>> executes a statement that does not return a result set, and so it doesn't
>> need to pass application data back and forth while it executes. The
>> statement takes 2 or 3 minutes to complete. I connect to two different
>> remote hosts: a Win2003 machine, and a Win2008R2 machine. The Win2003
>> machine doesn't put timestamps in its keep-alives, so the application
>> completes successfully when connecting to that host. If tcp timestamps
>> are enabled on the Linux host, the Win2008 host includes them in its
>> keepalives, and they are unACKed, so the connection is reset; if they
>> are disabled on the Linux host, the Win2008 host doesn't include them in
>> the keepalives, and the application completes successfully. I use (as
>> you might expect) sysctl to disable tcp timestamps on the Linux hosts.
>>
>> I have dumps for all permutations of CentOS/Ubuntu, Win200[38], and +/-
>> timestamps on the Linux side, and I will post them if the developers think that
>> they would be useful.
>
> Hi Charles
>
> I could not reproduce the problem here, even using a quite old kernel as
> receiver (2.6.9)
>
> 15:54:33.566192 IP 192.168.20.108.55926> 192.168.20.124.777: SWE
> 479814493:479814493(0) win 14600<mss 1460,sackOK,timestamp 151666
> 0,nop,wscale 7>
> 15:54:33.566265 IP 192.168.20.124.777> 192.168.20.108.55926: S
> 3714869381:3714869381(0) ack 479814494 win 5792<mss
> 1460,sackOK,timestamp 54553041 151666,nop,wscale 2>
> 15:54:33.566274 IP 192.168.20.108.55926> 192.168.20.124.777: . ack 1
> win 115<nop,nop,timestamp 151666 54553041>
> 15:54:33.566281 IP 192.168.20.108.55926> 192.168.20.124.777: P 1:5(4)
> ack 1 win 115<nop,nop,timestamp 151666 54553041>
> 15:54:33.566351 IP 192.168.20.124.777> 192.168.20.108.55926: . ack 5
> win 1448<nop,nop,timestamp 54553041 151666>
> 15:54:33.566375 IP 192.168.20.124.777> 192.168.20.108.55926: P 1:5(4)
> ack 5 win 1448<nop,nop,timestamp 54553041 151666>
> 15:54:33.566380 IP 192.168.20.108.55926> 192.168.20.124.777: . ack 5
> win 115<nop,nop,timestamp 151666 54553041>
> 15:54:43.577945 IP 192.168.20.108.55926> 192.168.20.124.777: . 4:5(1)
> ack 5 win 115<nop,nop,timestamp 152668 54553041>
> 15:54:43.578012 IP 192.168.20.124.777> 192.168.20.108.55926: . ack 5
> win 1448<nop,nop,timestamp 54563053 152668,nop,nop,sack sack 1 {4:5}>
> 15:54:53.597946 IP 192.168.20.108.55926> 192.168.20.124.777: . 4:5(1)
> ack 5 win 115<nop,nop,timestamp 153670 54563053>
> 15:54:53.598012 IP 192.168.20.124.777> 192.168.20.108.55926: . ack 5
> win 1448<nop,nop,timestamp 54573073 153670,nop,nop,sack sack 1 {4:5}>
>
>
> Are you sure frame tcp checksums are OK when the 'faulty' linux receive
> them ? (tcpdump -v)
I will check when I get into the office and let you know.
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5168 bytes --]
^ permalink raw reply
* Re: Configure Distributed Switch Architecture Via Device Tree
From: Barry G @ 2011-06-10 15:14 UTC (permalink / raw)
To: netdev
In-Reply-To: <BANLkTikystOn-36tCWWnYZR7_+yx2wFt=Q@mail.gmail.com>
Just in case anyone else runs into this problem, this is what I ended up doing.
This code needs more error checking and isn't "right", plus it needs
to read the
chip mapping stuff from the OF, but it answers my original two questions :-)
#include <linux/of.h>
#include <linux/kernel.h>
#include <linux/of_platform.h>
#include <net/dsa.h>
static struct dsa_chip_data switches[] = {
{
.sw_addr = 0x9,
.port_names = {
"eth%d", //0
"eth%d", //1
"eth%d", //2
"eth%d", //3
"eth%d", //4
"eth%d", //5
"eth%d", //6
"eth%d", //7
NULL, //8
NULL, //9
"cpu", //10
},
.rtable = (s8 []){-1, 9, 8},
},
{
.sw_addr = 0xa,
.port_names = {
"eth%d", //0
"eth%d", //1
"eth%d", //2
"eth%d", //3
"eth%d", //4
"eth%d", //5
"eth%d", //6
"eth%d", //7
"dsa", //8
"dsa", //9
},
.rtable = (s8 []){8, -1, 9},
},
{
.sw_addr = 0x8,
.port_names = {
"eth%d", //0
"eth%d", //1
"eth%d", //2
"eth%d", //3
"eth%d", //4
"eth%d", //5
"eth%d", //6
"eth%d", //7
"dsa", //8
"dsa", //9
NULL, //10
},
.rtable = (s8 []){9, 8, -1},
},
};
static struct dsa_platform_data my_switch_data = {
.nr_chips = 3,
.chip = switches,
};
static int __devinit dsa_probe(struct platform_device *);
static int __devexit dsa_remove(struct platform_device *);
static const struct of_device_id dsa_match[] = {
{
.compatible = "vendor,my-dsa-of",
},
{}
};
static struct platform_driver dsa_driver = {
.driver = {
.name = "dsa-driver",
.owner = THIS_MODULE,
.of_match_table = dsa_match,
},
.probe = dsa_probe,
.remove = dsa_remove,
};
static struct platform_device switchdriver = {
.name = "dsa",
.id = 0,
.num_resources = 0,
.dev.platform_data = &my_switch_data
};
static int __devinit dsa_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
const phandle *mdio_ph;
const phandle *ethernet_ph;
struct device_node *mdio;
struct device_node *ethernet;
struct platform_device *mdio_pd;
struct platform_device *ethernet_pd;
int i;
dev_info(&pdev->dev, "Initializing OF Marvell DSA driver\n");
mdio_ph = of_get_property(np, "mdio-handle", NULL);
ethernet_ph = of_get_property(np, "ethernet-handle", NULL);
mdio = of_find_node_by_phandle(*mdio_ph);
ethernet = of_find_node_by_phandle(*ethernet_ph);
mdio_pd = of_find_device_by_node(mdio);
ethernet_pd = of_find_device_by_node(ethernet);
my_switch_data.netdev = ðernet_pd->dev;
for(i = 0; i < my_switch_data.nr_chips; i++)
{
switches[i].mii_bus = &mdio_pd->dev;
}
platform_device_register(&switchdriver);
return 0;
}
static int __devexit dsa_remove(struct platform_device *pdev)
{
printk("dsa_remove\n");
return 0;
}
static int __init dsa_driver_init(void)
{
printk("dsa_drver_init\n");
return platform_driver_register(&dsa_driver);
}
static void __exit dsa_driver_cleanup(void)
{
printk("dsa_driver_cleanup\n");
platform_driver_unregister(&dsa_driver);
}
module_init(dsa_driver_init);
module_exit(dsa_driver_cleanup);
MODULE_DESCRIPTION("Marvell DSA OF driver");
MODULE_AUTHOR("Barry G <mr.scada@gmail.com>");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:dsa-driver");
^ permalink raw reply
* [PATCH 10/10] smsc9420: enable transmit time stamping.
From: Richard Cochran @ 2011-06-10 15:07 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Steve Glendinning
In-Reply-To: <cover.1307717675.git.richard.cochran@omicron.at>
This patch enables software (and phy device) transmit time stamping
for the smsc9420. Compile tested only.
Cc: Steve Glendinning <steve.glendinning@smsc.com>
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
drivers/net/smsc9420.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/net/smsc9420.c b/drivers/net/smsc9420.c
index 4c92ad8..2d84f92 100644
--- a/drivers/net/smsc9420.c
+++ b/drivers/net/smsc9420.c
@@ -1034,6 +1034,8 @@ static netdev_tx_t smsc9420_hard_start_xmit(struct sk_buff *skb,
smsc9420_reg_write(pd, TX_POLL_DEMAND, 1);
smsc9420_pci_flush_write(pd);
+ skb_tx_timestamp(skb);
+
return NETDEV_TX_OK;
}
--
1.7.0.4
^ permalink raw reply related
* [PATCH 09/10] stmmac: enable transmit time stamping.
From: Richard Cochran @ 2011-06-10 15:07 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Giuseppe Cavallaro
In-Reply-To: <cover.1307717675.git.richard.cochran@omicron.at>
This patch enables software (and phy device) transmit time stamping
for the STMicroelectronics Ethernet driver. Compile tested only.
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
drivers/net/stmmac/stmmac_main.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index e25e44a..5b85f4c 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -1081,6 +1081,8 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
priv->hw->dma->enable_dma_transmission(priv->ioaddr);
+ skb_tx_timestamp(skb);
+
return NETDEV_TX_OK;
}
--
1.7.0.4
^ permalink raw reply related
* [PATCH 08/10] r6040: enable transmit time stamping.
From: Richard Cochran @ 2011-06-10 15:07 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Florian Fainelli
In-Reply-To: <cover.1307717675.git.richard.cochran@omicron.at>
This patch enables software (and phy device) transmit time stamping
for the RDC R6040 Fast Ethernet MAC. Compile tested only.
Cc: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
drivers/net/r6040.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 200a363..5ee5f8f 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -846,6 +846,8 @@ static netdev_tx_t r6040_start_xmit(struct sk_buff *skb,
spin_unlock_irqrestore(&lp->lock, flags);
+ skb_tx_timestamp(skb);
+
return NETDEV_TX_OK;
}
--
1.7.0.4
^ permalink raw reply related
* [PATCH 07/10] ethoc: enable transmit time stamping.
From: Richard Cochran @ 2011-06-10 15:07 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Thierry Reding
In-Reply-To: <cover.1307717675.git.richard.cochran@omicron.at>
This patch enables software (and phy device) transmit time stamping
for the OpenCores 10/100 MAC driver. Compile tested only.
Cc: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
drivers/net/ethoc.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index a83dd31..8645ec8 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -874,6 +874,7 @@ static netdev_tx_t ethoc_start_xmit(struct sk_buff *skb, struct net_device *dev)
}
spin_unlock_irq(&priv->lock);
+ skb_tx_timestamp(skb);
out:
dev_kfree_skb(skb);
return NETDEV_TX_OK;
--
1.7.0.4
^ permalink raw reply related
* [PATCH 06/10] dnet: enable transmit time stamping.
From: Richard Cochran @ 2011-06-10 15:07 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Ilya Yanok
In-Reply-To: <cover.1307717675.git.richard.cochran@omicron.at>
This patch enables software (and phy device) transmit time stamping
in the "Dave ethernet interface." Compile tested only.
Cc: Ilya Yanok <yanok@emcraft.com>
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
drivers/net/dnet.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/net/dnet.c b/drivers/net/dnet.c
index 8318ea0..c36763c 100644
--- a/drivers/net/dnet.c
+++ b/drivers/net/dnet.c
@@ -587,6 +587,8 @@ static netdev_tx_t dnet_start_xmit(struct sk_buff *skb, struct net_device *dev)
dnet_writel(bp, irq_enable, INTR_ENB);
}
+ skb_tx_timestamp(skb);
+
/* free the buffer */
dev_kfree_skb(skb);
--
1.7.0.4
^ permalink raw reply related
* [PATCH 05/10] tg3: enable transmit time stamping.
From: Richard Cochran @ 2011-06-10 15:07 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Matt Carlson, Michael Chan
In-Reply-To: <cover.1307717675.git.richard.cochran@omicron.at>
This patch enables software (and phy device) transmit time stamping
for the TIGON3 driver. Compile tested only.
Cc: Matt Carlson <mcarlson@broadcom.com>
Cc: Michael Chan <mchan@broadcom.com>
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
drivers/net/tg3.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index f4b01c6..e6b4f14 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -6091,6 +6091,8 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Packets are ready, update Tx producer idx local and on card. */
tw32_tx_mbox(tnapi->prodmbox, entry);
+ skb_tx_timestamp(skb);
+
tnapi->tx_prod = entry;
if (unlikely(tg3_tx_avail(tnapi) <= (MAX_SKB_FRAGS + 1))) {
netif_tx_stop_queue(txq);
--
1.7.0.4
^ permalink raw reply related
* [PATCH 04/10] davinci_emac: enable transmit time stamping.
From: Richard Cochran @ 2011-06-10 15:07 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Anant Gole, Kevin Hilman, Chaithrika U S
In-Reply-To: <cover.1307717675.git.richard.cochran@omicron.at>
This patch enables software (and phy device) transmit time stamping
for the DaVinci EMAC driver. Tested together with the dp83640 PHY.
Cc: Anant Gole <anantgole@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Chaithrika U S <chaithrika@ti.com>
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
drivers/net/davinci_emac.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index efa2901..52ea30e 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -1090,6 +1090,7 @@ static int emac_dev_xmit(struct sk_buff *skb, struct net_device *ndev)
dev_err(emac_dev, "DaVinci EMAC: desc submit failed");
goto fail_tx;
}
+ skb_tx_timestamp(skb);
return NETDEV_TX_OK;
--
1.7.0.4
^ permalink raw reply related
* [PATCH 03/10] davinci_emac: pass ioctls through to phy device.
From: Richard Cochran @ 2011-06-10 15:07 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Anant Gole, Kevin Hilman, Chaithrika U S
In-Reply-To: <cover.1307717675.git.richard.cochran@omicron.at>
The DaVinci EMAC driver does not implement any ioctls, but still it can
pass them through to the phy device. This makes it possible for a phy
to offer PHC capabilities.
Cc: Anant Gole <anantgole@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Chaithrika U S <chaithrika@ti.com>
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
drivers/net/davinci_emac.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 29a4f06..efa2901 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -1489,14 +1489,14 @@ static void emac_adjust_link(struct net_device *ndev)
*/
static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd)
{
- dev_warn(&ndev->dev, "DaVinci EMAC: ioctl not supported\n");
+ struct emac_priv *priv = netdev_priv(ndev);
if (!(netif_running(ndev)))
return -EINVAL;
/* TODO: Add phy read and write and private statistics get feature */
- return -EOPNOTSUPP;
+ return phy_mii_ioctl(priv->phydev, ifrq, cmd);
}
static int match_first_device(struct device *dev, void *data)
--
1.7.0.4
^ permalink raw reply related
* [PATCH 02/10] fec: enable transmit and receive time stamping.
From: Richard Cochran @ 2011-06-10 15:07 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Greg Ungerer, Uwe Kleine-König, Shawn Guo
In-Reply-To: <cover.1307717675.git.richard.cochran@omicron.at>
This patch has been tested on the Freescale M5234BCC, which includes the
National Semiconductor DP83640 with IEEE 1588 support.
Cc: Greg Ungerer <gerg@uclinux.org>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
drivers/net/fec.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 885d8ba..68d479b 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -326,6 +326,8 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
spin_unlock_irqrestore(&fep->hw_lock, flags);
+ skb_tx_timestamp(skb);
+
return NETDEV_TX_OK;
}
@@ -650,7 +652,7 @@ fec_enet_rx(struct net_device *ndev)
skb_put(skb, pkt_len - 4); /* Make room */
skb_copy_to_linear_data(skb, data, pkt_len - 4);
skb->protocol = eth_type_trans(skb, ndev);
- netif_rx(skb);
+ netif_rx_defer(skb);
}
bdp->cbd_bufaddr = dma_map_single(&fep->pdev->dev, data,
--
1.7.0.4
^ permalink raw reply related
* [PATCH 01/10] net: introduce time stamping wrapper for netif_rx.
From: Richard Cochran @ 2011-06-10 15:06 UTC (permalink / raw)
To: netdev; +Cc: David Miller
In-Reply-To: <cover.1307717675.git.richard.cochran@omicron.at>
This commit adds a variation on netif_rx() designed to allow non-NAPI
Ethernet MAC drivers to support hardware time stamping in PHY devices.
Adapting a given driver requires two small changes, namely replacing
netif_rx() with netif_rx_defer() and adding a call to skb_tx_timestamp()
in the transmission path.
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
include/linux/netdevice.h | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ca333e7..9a56505 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2066,6 +2066,27 @@ extern void dev_kfree_skb_any(struct sk_buff *skb);
#define HAVE_NETIF_RX 1
extern int netif_rx(struct sk_buff *skb);
extern int netif_rx_ni(struct sk_buff *skb);
+
+/**
+ * netif_rx_defer() - post buffer to the network code
+ * @skb: buffer to post
+ *
+ * This function receives a packet from a device driver and queues it
+ * for the upper (protocol) levels to process. All non-NAPI Ethernet
+ * MAC drivers should use this instead of netif_rx() since this method
+ * allows hardware timestamping to occur within the PHY.
+ *
+ * return values:
+ * NET_RX_SUCCESS (no congestion)
+ * NET_RX_DROP (packet was dropped)
+ */
+static inline int netif_rx_defer(struct sk_buff *skb)
+{
+ if (skb_defer_rx_timestamp(skb))
+ return NET_RX_SUCCESS;
+ return netif_rx(skb);
+}
+
#define HAVE_NETIF_RECEIVE_SKB 1
extern int netif_receive_skb(struct sk_buff *skb);
extern gro_result_t dev_gro_receive(struct napi_struct *napi,
--
1.7.0.4
^ permalink raw reply related
* [PATCH 00/10] net: expand time stamping, batch #1
From: Richard Cochran @ 2011-06-10 15:06 UTC (permalink / raw)
To: netdev; +Cc: David Miller
This patch series represents the start of an effort to get better
coverage of the SO_TIMESTAMPING socket API in the Ethernet drivers.
Adding time stamping support to a given driver solves two separate
issues, namely software transmit time stamping and hardware time
stamping in PHY devices.
The SO_TIMESTAMPING socket API has been around since 2.6.30, but it
turned out that getting software transmit time stamps could not be
done in one central place in the stack. Instead, a work around was
introduced whereby each MAC driver must call a skb_tx_timestamp() hook
in order to support SW Tx time stamps.
Full PTP Hardware Clock (PHC) support has been merged for Linux 3.0,
including a driver for a PHY that does HW stamping. In the receive
path, the PHY based time stamping is handled by the stack for NAPI
based MAC drivers. But for transmit time stamps, support is needed in
the Ethernet MAC driver by calling the skb_tx_timestamp() hook.
For non-NAPI drivers, PHY based receive time stamping is currently not
possible. This patch series adds yet another hook (a wrapper around
netif_rx) for such drivers.
The first two patches make minor changes in the stack in support of
MAC/PHY time stamping. The next three patches enable PHY time stamping
for two MACs which have been paired with a PHC PHY on real life
boards.
The remaining patches are for MACs that I chose because they (1) use
phylib and (2) compile for x86. However, I only compiled these, not
tested, since I do not have the hardware.
The larger goal is to eventually get the skb_tx_timestamp hook into
each and every Ethernet MAC driver, so that SO_TIMESTAMPING using SW
time stamps will be supported across the board. I have started by
picking those drivers in which adding the hook will bring the greatest
benefit, namely those using phylib, since adding hooks provides both
SW and PHY HW time stamping.
If people approve of this effort, I will follow with another patch
series adding SW Tx time stamping to yet more MACs. Adding SW Tx
support is just a single line, but still, perhaps compile testing only
is too risky. I would appreciate feedback on this issue.
Richard Cochran (10):
net: introduce time stamping wrapper for netif_rx.
fec: enable transmit and receive time stamping.
davinci_emac: pass ioctls through to phy device.
davinci_emac: enable transmit time stamping.
tg3: enable transmit time stamping.
dnet: enable transmit time stamping.
ethoc: enable transmit time stamping.
r6040: enable transmit time stamping.
stmmac: enable transmit time stamping.
smsc9420: enable transmit time stamping.
drivers/net/davinci_emac.c | 5 +++--
drivers/net/dnet.c | 2 ++
drivers/net/ethoc.c | 1 +
drivers/net/fec.c | 4 +++-
drivers/net/r6040.c | 2 ++
drivers/net/smsc9420.c | 2 ++
drivers/net/stmmac/stmmac_main.c | 2 ++
drivers/net/tg3.c | 2 ++
include/linux/netdevice.h | 21 +++++++++++++++++++++
9 files changed, 38 insertions(+), 3 deletions(-)
^ permalink raw reply
* [PATCH v2] dl2k: EEPROM CRC calculation wrong endianess on bigendian machine
From: Daniel Hellstrom @ 2011-06-10 14:55 UTC (permalink / raw)
To: davem; +Cc: netdev, bhutchings
Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
---
drivers/net/dl2k.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index c445457..23179db 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -346,7 +346,7 @@ parse_eeprom (struct net_device *dev)
if (np->pdev->vendor == PCI_VENDOR_ID_DLINK) { /* D-Link Only */
/* Check CRC */
crc = ~ether_crc_le (256 - 4, sromdata);
- if (psrom->crc != crc) {
+ if (psrom->crc != cpu_to_le32(crc)) {
printk (KERN_ERR "%s: EEPROM data CRC error.\n",
dev->name);
return -1;
--
1.5.4
^ permalink raw reply related
* Re: [PATCH 1/1] dl2k: EEPROM CRC calculation wrong endianess on bigendian machine
From: Daniel Hellstrom @ 2011-06-10 14:54 UTC (permalink / raw)
To: Ben Hutchings; +Cc: davem, netdev
In-Reply-To: <1307713751.22348.602.camel@localhost>
Ben Hutchings wrote:
>On Fri, 2011-06-10 at 15:16 +0200, Daniel Hellstrom wrote:
>
>
>>Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
>>---
>> drivers/net/dl2k.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>>diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
>>index c445457..4bbbd7b 100644
>>--- a/drivers/net/dl2k.c
>>+++ b/drivers/net/dl2k.c
>>@@ -346,7 +346,7 @@ parse_eeprom (struct net_device *dev)
>> if (np->pdev->vendor == PCI_VENDOR_ID_DLINK) { /* D-Link Only */
>> /* Check CRC */
>> crc = ~ether_crc_le (256 - 4, sromdata);
>>- if (psrom->crc != crc) {
>>+ if (psrom->crc != cpu_to_le32(crc)) {q
>>
>>
>
>You still have a rogue 'q' there.
>
>
ooh, you got a sharp eye, I wonder how that made it into there... I will
resend, thanks!
Daniel
>Ben.
>
>
>
>> printk (KERN_ERR "%s: EEPROM data CRC error.\n",
>> dev->name);
>> return -1;
>>
>>
>
>
>
^ permalink raw reply
* tc match MAC destination
From: Andrei Popa @ 2011-06-10 14:18 UTC (permalink / raw)
To: netdev; +Cc: pdoru.kernel
Hello,
I want to shape PVSTP+ traffic (traffic that has MAC destination
01:00:0c:cc:cc:cd) and it doesn't work.
I've tried
filter parent 1: protocol 802_3 pref 2 u32 fh 802::11 order 17 key ht
802 bkt 0 flowid 1:3
match 01000ccc/ffffffff at 0
but it doesn't work.
With
filter parent 1: protocol arp pref 1 u32
filter parent 1: protocol arp pref 1 u32 fh 801: ht divisor 1
filter parent 1: protocol arp pref 1 u32 fh 801::7 order 7 key ht 801
bkt 0 flowid 1:3
match 00000000/00000000 at 0
filter parent 1: protocol 802_3 pref 2 u32
filter parent 1: protocol 802_3 pref 2 u32 fh 802: ht divisor 1
filter parent 1: protocol 802_3 pref 2 u32 fh 802::3 order 3 key ht 802
bkt 0 flowid 1:3
match 00000000/00000000 at 0
action order 1: mirred (Egress Mirror to device ifb1) pipe
index 1923 ref 1 bind 1
I see arp trafic with tcpdump on ifb1, but no STP traffic or any kind of
traffic except arp, because I've matched all MAC addreses.
Can somebody verify that this match works ?
I use kernel 2.6.39.1.
Thank you,
--
Andrei Popa
0760 683 280
^ permalink raw reply
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