Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH V3 net-next 02/28] ethtool: Introduce a method for getting time stamping capabilities.
From: Ben Hutchings @ 2012-04-03 19:24 UTC (permalink / raw)
  To: Richard Cochran
  Cc: netdev, David Miller, Martin Porter, Jacob Keller, Jeff Kirsher,
	John Ronciak, e1000-devel
In-Reply-To: <40ae199e9b653f8f2bff0a606e11d90b6806a4e5.1333474522.git.richardcochran@gmail.com>

On Tue, 2012-04-03 at 19:47 +0200, Richard Cochran wrote:
> This commit adds a new ethtool ioctl that exposes the SO_TIMESTAMPING
> capabilities of a network interface. In addition, user space programs
> can use this ioctl to discover the PTP Hardware Clock (PHC) device
> associated with the interface.
> 
> Since software receive time stamps are handled by the stack, the generic
> ethtool code can answer the query correctly in case the MAC or PHY
> drivers lack special time stamping features.
> 
> Signed-off-by: Richard Cochran <richardcochran@gmail.com>
[...]
Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply

* Re: [GIT] Networking
From: Torsten Kaiser @ 2012-04-03 19:23 UTC (permalink / raw)
  To: David Miller; +Cc: torvalds, akpm, netdev, linux-kernel
In-Reply-To: <20120402.203442.1793134339535157754.davem@davemloft.net>

On Tue, Apr 3, 2012 at 2:34 AM, David Miller <davem@davemloft.net> wrote:
> 7) virtio_net accidently uses net_ratelimit() not only on the kernel
>   warning but also the statistic bump, fix from Rick Jones.

I just saw this commit land in Linus tree and I think its got its
parentheses wrong.

Old code (minus the dev_warn()-messages):
if (net_ratelimit()) {
  if (likely(capacity == -ENOMEM)) {
    dev_warn(...);
  } else {
    dev->stats.tx_fifo_errors++;
    dev_warn(...);
  }
}

New code (minus the dev_warn()-messages):
if (likely(capacity == -ENOMEM)) {
  if (net_ratelimit()) {
    dev_warn(...);
  } else {
    dev->stats.tx_fifo_errors++;
    if (net_ratelimit())
      dev_warn(...);
  }
}

Now it will count -ENOMEM errors that were not logged..

I think, intended was:
if (likely(capacity == -ENOMEM)) {
  if (net_ratelimit()) {
    dev_warn(...);
  }
} else {
  dev->stats.tx_fifo_errors++;
  if (net_ratelimit())
    dev_warn(...);
}

HTH, Torsten

^ permalink raw reply

* Re: [PATCH net 0/2] net/bonding: fixes related to neigh
From: Or Gerlitz @ 2012-04-03 18:58 UTC (permalink / raw)
  To: Jay Vosburgh; +Cc: netdev
In-Reply-To: <1333383430-17456-1-git-send-email-ogerlitz@mellanox.com>

On Mon, Apr 2, 2012 at 7:17 PM, Or Gerlitz <ogerlitz@mellanox.com> wrote:
> This small patch set fixes some issues we stepped on when preparing
> for some IPoIB changes.
>
> With the 1st patch, the kernel networking code of arp_netdev_event calls
> neigh_changeaddr which further flashes the boding neighbours in some more
> cases which weren't covered by commit 7d26bb103 "bonding: emit event when
> bonding changes MAC"
>
> The 2nd patch fixes a bug where under bonding, the IPoIB neigh cleanup
> function wasn't called.

Hi Jay,

Could you have a look on these patches, its important for us to know
if we're on the right direction.

Or.

^ permalink raw reply

* Re: [PATCH] sky2: fix missing register reset on error path in sky2_test_msi()
From: Stephen Hemminger @ 2012-04-03 18:55 UTC (permalink / raw)
  To: Lino Sanfilippo; +Cc: linux-kernel, netdev
In-Reply-To: <20120330173616.GC2703@Neptun>

On Fri, 30 Mar 2012 19:36:16 +0200
Lino Sanfilippo <LinoSanfilippo@gmx.de> wrote:

> In sky2_test_msi() the temporarily set SW IRQ in B0 register is not reset in case
> that request_irq() fails.
> With this patch we only set the interrupt mask if request_irq() was successful.
> 
> Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de>

Ok, but this is a non-serious error case. If request_irq() fails here,
the driver is going to fail to load and on the failure path of
sky2_probe will reset the chip on the way out.

^ permalink raw reply

* [PATCH v3] TCP: update ip_local_port_range documentation
From: fernando @ 2012-04-03 18:41 UTC (permalink / raw)
  To: David Miller; +Cc: Stephen Hemminger, netdev@vger.kernel.org
In-Reply-To: <20120403201221.ovff4aabtwwcoco0@webmail.int.intellilink.co.jp>

[-- Attachment #1: Type: text/plain, Size: 111 bytes --]

I forgot to add my Signed-off-by and the patch explanation.
I am aosrry for the noise. Updated patch attached.

[-- Attachment #2: sysctl-ip_local_port_range-documentation-v3.patch --]
[-- Type: text/plain, Size: 1714 bytes --]

Subject: [PATCH] TCP: update ip_local_port_range documentation

From: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>

The explanation of ip_local_port_range in
Documentation/networking/ip-sysctl.txtcontains several factual errors:

- The default value of ip_local_port_range does not depend on the amount of
  memory available in the system.
- tcp_tw_recycle is not enabled by default.
- 1024-4999 is not the default value.
- Etc.

Clean up the mess.

Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
---

diff -urNp linux-3.4-rc1-orig/Documentation/networking/ip-sysctl.txt linux-3.4-rc1/Documentation/networking/ip-sysctl.txt
--- linux-3.4-rc1-orig/Documentation/networking/ip-sysctl.txt	2012-03-19 08:15:34.000000000 +0900
+++ linux-3.4-rc1/Documentation/networking/ip-sysctl.txt	2012-04-03 19:08:59.554903584 +0900
@@ -604,15 +604,8 @@ IP Variables:
 ip_local_port_range - 2 INTEGERS
 	Defines the local port range that is used by TCP and UDP to
 	choose the local port. The first number is the first, the
-	second the last local port number. Default value depends on
-	amount of memory available on the system:
-	> 128Mb 32768-61000
-	< 128Mb 1024-4999 or even less.
-	This number defines number of active connections, which this
-	system can issue simultaneously to systems not supporting
-	TCP extensions (timestamps). With tcp_tw_recycle enabled
-	(i.e. by default) range 1024-4999 is enough to issue up to
-	2000 connections per second to systems supporting timestamps.
+	second the last local port number. The default values are 
+	32768 and 61000 respectively.
 
 ip_local_reserved_ports - list of comma separated ranges
 	Specify the ports which are reserved for known third-party

^ permalink raw reply

* Re: [PATCH] ipl2tp: allow setting session interface name
From: Stephen Hemminger @ 2012-04-03 18:39 UTC (permalink / raw)
  To: João Valverde; +Cc: netdev
In-Reply-To: <4F70CAC8.10900@ist.utl.pt>

On Mon, 26 Mar 2012 21:00:08 +0100
"João Valverde" <jpv950@gmail.com> wrote:

> Hi,
> 
> I've attached a trivial patch for iproute2 to allow naming interfaces 
> created with "ip l2tp add session".
> 
> I believe patches should go through the netdev mailing list but this 
> patch is so small I figured that would just add noise. Hope that's OK.
> 
> Originally I thought I would need a bigger patch and was going to take a 
> stab at implementing something like
> 
> ip l2tp add tunnel L2TP_TUNNEL_ARGS
> ip link add name NAME  [ LINK_OPTS ] type l2tp L2TP_SESSION_ARGS
> 
> (a better interface IMHO) but all the code was there already, all that I 
> needed to add was option parsing.
> 
> Thanks,
> 
> João Valverde
> 
> 

Applied thanks.

^ permalink raw reply

* Re: [RFC] net/hsr: Add support for IEC 62439-3 High-availability Seamless Redundancy
From: Stephen Hemminger @ 2012-04-03 18:37 UTC (permalink / raw)
  To: Arvid Brodin; +Cc: David S. Miller, netdev, Bruno Ferreira
In-Reply-To: <4F71BEAD.5080605@enea.com>

On Tue, 27 Mar 2012 15:20:45 +0200
Arvid Brodin <arvid.brodin@enea.com> wrote:

> +config NONSTANDARD_HSR
> +	bool "HSR: Use efficient tag (breaks HSR standard, read help!)"
> +	depends on HSR
> +	---help---
> +	  The HSR standard specifies a 6-byte HSR tag to be inserted into the
> +	  transmitted network frames. This breaks the 32-bit alignment that the
> +	  Linux network stack relies on, and would cause kernel panics on
> +	  certain architectures. To avoid this, the whole frame payload is
> +	  memmoved 2 bytes on reception on these architectures - which is very
> +	  inefficient!

This option won't fly. Don't do it.
If you need to copy/realign packets on some architecture the stack
should be changed to handle it.

^ permalink raw reply

* Re: [PATCH] stmmac: re-add IFF_UNICAST_FLT for dwmac1000
From: Eric Dumazet @ 2012-04-03 18:20 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: peppe.cavallaro, rayagond, netdev
In-Reply-To: <1333475057-3752-1-git-send-email-mkl@pengutronix.de>

On Tue, 2012-04-03 at 19:44 +0200, Marc Kleine-Budde wrote:
> In commit (bfab27a stmmac: add the experimental PCI support) the
> IFF_UNICAST_FLT flag has been removed from the stmmac_mac_device_setup()
> function. This patch re-adds the flag.
> 
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
> 
> Just compile time tested, since I don't have the hardware.
> Applies to net-next/master (and v3.3).
> 
> regards, Marc
> 
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index e85ffbd..07e0c78 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1737,9 +1737,10 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
>  	struct mac_device_info *mac;
>  
>  	/* Identify the MAC HW device */
> -	if (priv->plat->has_gmac)
> +	if (priv->plat->has_gmac) {
> +		priv->dev->priv_flags |= IFF_UNICAST_FLT;
>  		mac = dwmac1000_setup(priv->ioaddr);
> -	else
> +	} else
>  		mac = dwmac100_setup(priv->ioaddr);
>  	if (!mac)
>  		return -ENOMEM;


	if (priv->plat->has_gmac) {
		priv->dev->priv_flags |= IFF_UNICAST_FLT;
		mac = dwmac1000_setup(priv->ioaddr);
	} else {
		mac = dwmac100_setup(priv->ioaddr);
	}

(Documentation/CodingStyle line 175)

^ permalink raw reply

* Re: [PATCH] phonet: Check input from user before allocating
From: Rick Jones @ 2012-04-03 18:18 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David Miller, remi, levinsasha928, remi.denis-courmont, davej,
	netdev, linux-kernel
In-Reply-To: <1333422844.18626.26.camel@edumazet-glaptop>

On 04/02/2012 08:14 PM, Eric Dumazet wrote:
> It seems netperf has some problems zith AF_UNIX dgram :
>
> socket(PF_FILE, SOCK_DGRAM, 0)          = 4
> setsockopt(4, SOL_SOCKET, SO_SNDBUF, [0], 4) = 0
> getsockopt(4, SOL_SOCKET, SO_SNDBUF, [2048], [4]) = 0
> setsockopt(4, SOL_SOCKET, SO_RCVBUF, [0], 4) = 0
> getsockopt(4, SOL_SOCKET, SO_RCVBUF, [2288], [4]) = 0
> sendto(3, "\0\0\0+\377\377\377\377\0\0\0\0\0\0\10\0\0\0\0\10\0\0\0\0\0\0\0\0\0\0\0\0"..., 256, 0, NULL, 0) = 256
> select(1024, [3], NULL, NULL, {120, 0}) = 1 (in [3], left {119, 979635})
> recvfrom(3, "\0\0\0,\0\0\0\0\0\0\10\360\0\0\10\0\0\0\0\0\0\0\0\n\0\0\0\0\0\0\0\0"..., 256, 0, NULL, NULL) = 256
> connect(4, {sa_family=AF_FILE, path="/tmp/netpe62HGNM"}, 110) = 0
> rt_sigaction(SIGALRM, {0x403171, [ALRM], SA_RESTORER|SA_INTERRUPT, 0x7f691f026af0}, NULL, 8) = 0
> alarm(10)                               = 0
> sendto(4, "netperf\0netperf\0netperf\0netperf\0"..., 2048, 0, NULL, 0) = -1 EMSGSIZE (Message too long)
> dup(2)                                  = 5
> fcntl(5, F_GETFL)                       = 0x8002 (flags O_RDWR|O_LARGEFILE)
> fstat(5, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 3), ...}) = 0
> mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f691fa18000
> lseek(5, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
> write(5, "dg_send: data send error: Messag"..., 43dg_send: data send error: Message too long
> ) = 43
> close(5)                                = 0
> munmap(0x7f691fa18000, 4096)            = 0
> exit_group(1)                           = ?
>
> I guess the SO_SNDBUF/SO_RCVBUF limits are a bit too low ?

The AF_UNIX support in netperf is from a time when the code was very 
simplistic - if no socket buffer size specified on the command line, 
take the system default.  If no send size specified, use the SO_SNDBUF 
size, though some limits were applied.

Of course, along the way, there was a change in the value for socket 
buffer size that meant "take the default" - it used to be 0 but then 
became -1.  Something to do with when Windows would decide to do copy 
avoidance - tell Windows the socket buffer size is 0 and it will do copy 
avoidance. The code in src/nettest_unix.c was still initializing to 0 
rather than -1.

I've fixed that in the top-of-trunk:

raj@tardy:~/netperf2_trunk$ src/netperf -t DG_STREAM
DG UNIDIRECTIONAL SEND TEST
Socket  Message  Elapsed      Messages
Size    Size     Time         Okay Errors   Throughput
bytes   bytes    secs            #      #   10^6bits/sec

126976   65507    10.00     1195647      0     811.07
  2288            10.00     1195647            811.07

BTW, the local CPU utilization seems sane, but "remote" (which is 
redundant anyway) seems to be fubar somehow.  More bitrot I suspect.

happy benchmarking,

rick jones

^ permalink raw reply

* RE: [PATCH] ARM: OMAP: AM33XX: CAN: d_can: Add support for Bosch D_CAN controller
From: AnilKumar, Chimata @ 2012-04-03 18:07 UTC (permalink / raw)
  To: Oliver Hartkopp
  Cc: m.kleine-budde@pengutronix.de, wg@grandegger.com,
	linux-can@vger.kernel.org, netdev@vger.kernel.org,
	linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
	Gole, Anant, Nori, Sekhar
In-Reply-To: <4F7B1D2F.40409@hartkopp.net>

Hi Oliver,

Thanks for the comments,

On Tue, Apr 03, 2012 at 21:24:23, Oliver Hartkopp wrote:
> On 03.04.2012 14:39, AnilKumar, Chimata wrote:
>
> > Hi All,
> >
> > Subject line of this patch should be
> > "ARM: CAN: d_can: Add support for Bosch D_CAN controller"
>
>
> No, the d_can IP core is generally not limited to ARM.
>
>       "can: Add support for Bosch D_CAN controller"
>
> would be perfectly fine.

Agree, I will change the subject line in my next version of patch

>
> The correct way is:
>
> 1. post your new CAN driver to linux-can ML
> 2. When the major reviews & style fixes are done and the driver is fit for
> mainline you can post it on ti-omap ML too
>
> But an initial cross-posting of this CAN driver to netdev ML and linux-kernel
> ML does not help anyone - it only increases traffic & confusion
>

It's true, I will take care from next time onwards

Thanks
AnilKumar

^ permalink raw reply

* Re: [PATCH V3 net-next 00/28] ethtool: support time stamping and phc clocks
From: Richard Cochran @ 2012-04-03 18:02 UTC (permalink / raw)
  To: netdev
  Cc: David Miller, Ben Hutchings, Martin Porter, Jacob Keller,
	Jeff Kirsher, John Ronciak, e1000-devel
In-Reply-To: <cover.1333474520.git.richardcochran@gmail.com>

On Tue, Apr 03, 2012 at 07:47:24PM +0200, Richard Cochran wrote:
> Changes in V3:
> - works without ethtool_ops
> - does not require special privileges
> - neated user space tool output

    neaten (it looks neater now, and more like what Ben was asking for)

Richard

^ permalink raw reply

* [PATCH] Add the command to show the time stamping capabilities.
From: Richard Cochran @ 2012-04-03 17:58 UTC (permalink / raw)
  To: netdev
  Cc: e1000-devel, Martin Porter, John Ronciak, Ben Hutchings,
	David Miller, Jacob Keller
In-Reply-To: <cover.1333474520.git.richardcochran@gmail.com>

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 ethtool-copy.h    |   24 +++++++++++
 ethtool.8.in      |    7 +++
 ethtool.c         |  103 ++++++++++++++++++++++++++++++++++++++++++++++++
 internal.h        |    1 +
 net_tstamp-copy.h |  113 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 test-cmdline.c    |    3 +
 6 files changed, 251 insertions(+), 0 deletions(-)
 create mode 100644 net_tstamp-copy.h

diff --git a/ethtool-copy.h b/ethtool-copy.h
index d904c1a..2e32222 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -680,6 +680,29 @@ struct ethtool_sfeatures {
 	struct ethtool_set_features_block features[0];
 };
 
+/**
+ * struct ethtool_ts_info - holds a device's timestamping and PHC association
+ * @cmd: command number = %ETHTOOL_GET_TS_INFO
+ * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags
+ * @phc_index: device index of the associated PHC, or -1 if there is none
+ * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values
+ * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values
+ *
+ * The bits in the 'tx_types' and 'rx_filters' fields correspond to
+ * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values,
+ * respectively.  For example, if the device supports HWTSTAMP_TX_ON,
+ * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set.
+ */
+struct ethtool_ts_info {
+	__u32	cmd;
+	__u32	so_timestamping;
+	__s32	phc_index;
+	__u32	tx_types;
+	__u32	tx_reserved[3];
+	__u32	rx_filters;
+	__u32	rx_reserved[3];
+};
+
 /*
  * %ETHTOOL_SFEATURES changes features present in features[].valid to the
  * values of corresponding bits in features[].requested. Bits in .requested
@@ -786,6 +809,7 @@ enum ethtool_sfeatures_retval_bits {
 #define ETHTOOL_SET_DUMP	0x0000003e /* Set dump settings */
 #define ETHTOOL_GET_DUMP_FLAG	0x0000003f /* Get dump settings */
 #define ETHTOOL_GET_DUMP_DATA	0x00000040 /* Get dump data */
+#define ETHTOOL_GET_TS_INFO	0x00000041 /* Get time stamping and PHC info */
 
 /* compatibility with older code */
 #define SPARC_ETH_GSET		ETHTOOL_GSET
diff --git a/ethtool.8.in b/ethtool.8.in
index 63d5d48..20fb8e9 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -292,6 +292,9 @@ ethtool \- query or control network driver and hardware settings
 .I devname
 .BI \ N
 .HP
+.B ethtool \-T|\-\-timestamping
+.I devname
+.HP
 .B ethtool \-x|\-\-show\-rxfh\-indir
 .I devname
 .HP
@@ -745,6 +748,10 @@ is indicated, then ethtool fetches the dump data and directs it to a
 .B \-W \-\-set\-dump
 Sets the dump flag for the device.
 .TP
+.B \-T \-\-timestamping
+Show the device's time stamping capabilities and associated PTP
+hardware clock.
+.TP
 .B \-x \-\-show\-rxfh\-indir
 Retrieves the receive flow hash indirection table.
 .TP
diff --git a/ethtool.c b/ethtool.c
index e80b38b..c6292a6 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -1115,6 +1115,91 @@ static int dump_rxfhash(int fhash, u64 val)
 	return 0;
 }
 
+#define N_SOTS 7
+
+static char *so_timestamping_labels[N_SOTS] = {
+	"hardware-transmit     (SOF_TIMESTAMPING_TX_HARDWARE)",
+	"software-transmit     (SOF_TIMESTAMPING_TX_SOFTWARE)",
+	"hardware-receive      (SOF_TIMESTAMPING_RX_HARDWARE)",
+	"software-receive      (SOF_TIMESTAMPING_RX_SOFTWARE)",
+	"software-system-clock (SOF_TIMESTAMPING_SOFTWARE)",
+	"hardware-legacy-clock (SOF_TIMESTAMPING_SYS_HARDWARE)",
+	"hardware-raw-clock    (SOF_TIMESTAMPING_RAW_HARDWARE)",
+};
+
+#define N_TX_TYPES (HWTSTAMP_TX_ONESTEP_SYNC + 1)
+
+static char *tx_type_labels[N_TX_TYPES] = {
+	"off                   (HWTSTAMP_TX_OFF)",
+	"on                    (HWTSTAMP_TX_ON)",
+	"one-step-sync         (HWTSTAMP_TX_ONESTEP_SYNC)",
+};
+
+#define N_RX_FILTERS (HWTSTAMP_FILTER_PTP_V2_DELAY_REQ + 1)
+
+static char *rx_filter_labels[N_RX_FILTERS] = {
+	"none                  (HWTSTAMP_FILTER_NONE)",
+	"all                   (HWTSTAMP_FILTER_ALL)",
+	"some                  (HWTSTAMP_FILTER_SOME)",
+	"ptpv1-l4-event        (HWTSTAMP_FILTER_PTP_V1_L4_EVENT)",
+	"ptpv1-l4-sync         (HWTSTAMP_FILTER_PTP_V1_L4_SYNC)",
+	"ptpv1-l4-delay-req    (HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ)",
+	"ptpv2-l4-event        (HWTSTAMP_FILTER_PTP_V2_L4_EVENT)",
+	"ptpv2-l4-sync         (HWTSTAMP_FILTER_PTP_V2_L4_SYNC)",
+	"ptpv2-l4-delay-req    (HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ)",
+	"ptpv2-l2-event        (HWTSTAMP_FILTER_PTP_V2_L2_EVENT)",
+	"ptpv2-l2-sync         (HWTSTAMP_FILTER_PTP_V2_L2_SYNC)",
+	"ptpv2-l2-delay-req    (HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ)",
+	"ptpv2-event           (HWTSTAMP_FILTER_PTP_V2_EVENT)",
+	"ptpv2-sync            (HWTSTAMP_FILTER_PTP_V2_SYNC)",
+	"ptpv2-delay-req       (HWTSTAMP_FILTER_PTP_V2_DELAY_REQ)",
+};
+
+static int dump_tsinfo(const struct ethtool_ts_info *info)
+{
+	int i;
+
+	fprintf(stdout, "Capabilities:\n");
+
+	for (i = 0; i < N_SOTS; i++) {
+		if (info->so_timestamping & (1 << i))
+			fprintf(stdout, "\t%s\n", so_timestamping_labels[i]);
+	}
+
+	fprintf(stdout, "PTP Hardware Clock: ");
+
+	if (info->phc_index < 0)
+		fprintf(stdout, "none\n");
+	else
+		fprintf(stdout, "%d\n", info->phc_index);
+
+	fprintf(stdout, "Hardware Transmit Timestamp Modes:");
+
+	if (!info->tx_types)
+		fprintf(stdout, " none\n");
+	else
+		fprintf(stdout, "\n");
+
+	for (i = 0; i < N_TX_TYPES; i++) {
+		if (info->tx_types & (1 << i))
+			fprintf(stdout,	"\t%s\n", tx_type_labels[i]);
+	}
+
+	fprintf(stdout, "Hardware Receive Filter Modes:");
+
+	if (!info->rx_filters)
+		fprintf(stdout, " none\n");
+	else
+		fprintf(stdout, "\n");
+
+	for (i = 0; i < N_RX_FILTERS; i++) {
+		if (info->rx_filters & (1 << i))
+			fprintf(stdout, "\t%s\n", rx_filter_labels[i]);
+	}
+
+	return 0;
+}
+
 static struct ethtool_gstrings *
 get_stringset(struct cmd_context *ctx, enum ethtool_stringset set_id,
 	      ptrdiff_t drvinfo_offset)
@@ -3077,6 +3162,23 @@ static int do_sprivflags(struct cmd_context *ctx)
 	return 0;
 }
 
+static int do_tsinfo(struct cmd_context *ctx)
+{
+	struct ethtool_ts_info info;
+
+	if (ctx->argc != 0)
+		exit_bad_args();
+
+	fprintf(stdout, "Time stamping parameters for %s:\n", ctx->devname);
+	info.cmd = ETHTOOL_GET_TS_INFO;
+	if (send_ioctl(ctx, &info)) {
+		perror("Cannot get device time stamping settings");
+		return -1;
+	}
+	dump_tsinfo(&info);
+	return 0;
+}
+
 int send_ioctl(struct cmd_context *ctx, void *cmd)
 {
 #ifndef TEST_ETHTOOL
@@ -3206,6 +3308,7 @@ static const struct option {
 	  "			[ action %d ]\n"
 	  "			[ loc %d]] |\n"
 	  "		delete %d\n" },
+	{ "-T|--timestamping", 1, do_tsinfo, "Show time stamping capabilities" },
 	{ "-x|--show-rxfh-indir", 1, do_grxfhindir,
 	  "Show Rx flow hash indirection" },
 	{ "-X|--set-rxfh-indir", 1, do_srxfhindir,
diff --git a/internal.h b/internal.h
index 867c0ea..d72cdf5 100644
--- a/internal.h
+++ b/internal.h
@@ -25,6 +25,7 @@ typedef __uint8_t u8;
 typedef __int32_t s32;
 
 #include "ethtool-copy.h"
+#include "net_tstamp-copy.h"
 
 #if __BYTE_ORDER == __BIG_ENDIAN
 static inline u16 cpu_to_be16(u16 value)
diff --git a/net_tstamp-copy.h b/net_tstamp-copy.h
new file mode 100644
index 0000000..ae5df12
--- /dev/null
+++ b/net_tstamp-copy.h
@@ -0,0 +1,113 @@
+/*
+ * Userspace API for hardware time stamping of network packets
+ *
+ * Copyright (C) 2008,2009 Intel Corporation
+ * Author: Patrick Ohly <patrick.ohly@intel.com>
+ *
+ */
+
+#ifndef _NET_TIMESTAMPING_H
+#define _NET_TIMESTAMPING_H
+
+#include <linux/socket.h>   /* for SO_TIMESTAMPING */
+
+/* SO_TIMESTAMPING gets an integer bit field comprised of these values */
+enum {
+	SOF_TIMESTAMPING_TX_HARDWARE = (1<<0),
+	SOF_TIMESTAMPING_TX_SOFTWARE = (1<<1),
+	SOF_TIMESTAMPING_RX_HARDWARE = (1<<2),
+	SOF_TIMESTAMPING_RX_SOFTWARE = (1<<3),
+	SOF_TIMESTAMPING_SOFTWARE = (1<<4),
+	SOF_TIMESTAMPING_SYS_HARDWARE = (1<<5),
+	SOF_TIMESTAMPING_RAW_HARDWARE = (1<<6),
+	SOF_TIMESTAMPING_MASK =
+	(SOF_TIMESTAMPING_RAW_HARDWARE - 1) |
+	SOF_TIMESTAMPING_RAW_HARDWARE
+};
+
+/**
+ * struct hwtstamp_config - %SIOCSHWTSTAMP parameter
+ *
+ * @flags:	no flags defined right now, must be zero
+ * @tx_type:	one of HWTSTAMP_TX_*
+ * @rx_type:	one of one of HWTSTAMP_FILTER_*
+ *
+ * %SIOCSHWTSTAMP expects a &struct ifreq with a ifr_data pointer to
+ * this structure. dev_ifsioc() in the kernel takes care of the
+ * translation between 32 bit userspace and 64 bit kernel. The
+ * structure is intentionally chosen so that it has the same layout on
+ * 32 and 64 bit systems, don't break this!
+ */
+struct hwtstamp_config {
+	int flags;
+	int tx_type;
+	int rx_filter;
+};
+
+/* possible values for hwtstamp_config->tx_type */
+enum hwtstamp_tx_types {
+	/*
+	 * No outgoing packet will need hardware time stamping;
+	 * should a packet arrive which asks for it, no hardware
+	 * time stamping will be done.
+	 */
+	HWTSTAMP_TX_OFF,
+
+	/*
+	 * Enables hardware time stamping for outgoing packets;
+	 * the sender of the packet decides which are to be
+	 * time stamped by setting %SOF_TIMESTAMPING_TX_SOFTWARE
+	 * before sending the packet.
+	 */
+	HWTSTAMP_TX_ON,
+
+	/*
+	 * Enables time stamping for outgoing packets just as
+	 * HWTSTAMP_TX_ON does, but also enables time stamp insertion
+	 * directly into Sync packets. In this case, transmitted Sync
+	 * packets will not received a time stamp via the socket error
+	 * queue.
+	 */
+	HWTSTAMP_TX_ONESTEP_SYNC,
+};
+
+/* possible values for hwtstamp_config->rx_filter */
+enum hwtstamp_rx_filters {
+	/* time stamp no incoming packet at all */
+	HWTSTAMP_FILTER_NONE,
+
+	/* time stamp any incoming packet */
+	HWTSTAMP_FILTER_ALL,
+
+	/* return value: time stamp all packets requested plus some others */
+	HWTSTAMP_FILTER_SOME,
+
+	/* PTP v1, UDP, any kind of event packet */
+	HWTSTAMP_FILTER_PTP_V1_L4_EVENT,
+	/* PTP v1, UDP, Sync packet */
+	HWTSTAMP_FILTER_PTP_V1_L4_SYNC,
+	/* PTP v1, UDP, Delay_req packet */
+	HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ,
+	/* PTP v2, UDP, any kind of event packet */
+	HWTSTAMP_FILTER_PTP_V2_L4_EVENT,
+	/* PTP v2, UDP, Sync packet */
+	HWTSTAMP_FILTER_PTP_V2_L4_SYNC,
+	/* PTP v2, UDP, Delay_req packet */
+	HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ,
+
+	/* 802.AS1, Ethernet, any kind of event packet */
+	HWTSTAMP_FILTER_PTP_V2_L2_EVENT,
+	/* 802.AS1, Ethernet, Sync packet */
+	HWTSTAMP_FILTER_PTP_V2_L2_SYNC,
+	/* 802.AS1, Ethernet, Delay_req packet */
+	HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ,
+
+	/* PTP v2/802.AS1, any layer, any kind of event packet */
+	HWTSTAMP_FILTER_PTP_V2_EVENT,
+	/* PTP v2/802.AS1, any layer, Sync packet */
+	HWTSTAMP_FILTER_PTP_V2_SYNC,
+	/* PTP v2/802.AS1, any layer, Delay_req packet */
+	HWTSTAMP_FILTER_PTP_V2_DELAY_REQ,
+};
+
+#endif /* _NET_TIMESTAMPING_H */
diff --git a/test-cmdline.c b/test-cmdline.c
index 4718842..b89ab4e 100644
--- a/test-cmdline.c
+++ b/test-cmdline.c
@@ -172,6 +172,9 @@ static struct test_case {
 	{ 1, "-U devname foo" },
 	{ 1, "-N" },
 	{ 1, "-U" },
+	{ 0, "-T devname" },
+	{ 0, "--timestamping devname" },
+	{ 1, "-T" },
 	{ 0, "-x devname" },
 	{ 0, "--show-rxfh-indir devname" },
 	{ 1, "-x" },
-- 
1.7.2.5


------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

^ permalink raw reply related

* [PATCH V3 net-next 27/28] ucc_geth: Support the get_ts_info ethtool method.
From: Richard Cochran @ 2012-04-03 17:47 UTC (permalink / raw)
  To: netdev
  Cc: David Miller, Ben Hutchings, Martin Porter, Jacob Keller,
	Jeff Kirsher, John Ronciak, e1000-devel
In-Reply-To: <cover.1333474520.git.richardcochran@gmail.com>

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 drivers/net/ethernet/freescale/ucc_geth_ethtool.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/freescale/ucc_geth_ethtool.c b/drivers/net/ethernet/freescale/ucc_geth_ethtool.c
index a97257f..37b0353 100644
--- a/drivers/net/ethernet/freescale/ucc_geth_ethtool.c
+++ b/drivers/net/ethernet/freescale/ucc_geth_ethtool.c
@@ -415,6 +415,7 @@ static const struct ethtool_ops uec_ethtool_ops = {
 	.get_ethtool_stats      = uec_get_ethtool_stats,
 	.get_wol		= uec_get_wol,
 	.set_wol		= uec_set_wol,
+	.get_ts_info		= ethtool_op_get_ts_info,
 };
 
 void uec_set_ethtool_ops(struct net_device *netdev)
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH V3 net-next 24/28] smsc9420: Support the get_ts_info ethtool method.
From: Richard Cochran @ 2012-04-03 17:47 UTC (permalink / raw)
  To: netdev
  Cc: David Miller, Ben Hutchings, Martin Porter, Jacob Keller,
	Jeff Kirsher, John Ronciak, e1000-devel
In-Reply-To: <cover.1333474520.git.richardcochran@gmail.com>

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 drivers/net/ethernet/smsc/smsc9420.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smsc9420.c b/drivers/net/ethernet/smsc/smsc9420.c
index 3838647..f80ec68 100644
--- a/drivers/net/ethernet/smsc/smsc9420.c
+++ b/drivers/net/ethernet/smsc/smsc9420.c
@@ -469,6 +469,7 @@ static const struct ethtool_ops smsc9420_ethtool_ops = {
 	.set_eeprom = smsc9420_ethtool_set_eeprom,
 	.get_regs_len = smsc9420_ethtool_getregslen,
 	.get_regs = smsc9420_ethtool_getregs,
+	.get_ts_info = ethtool_op_get_ts_info,
 };
 
 /* Sets the device MAC address to dev_addr */
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH V3 net-next 23/28] smsc911x: Support the get_ts_info ethtool method.
From: Richard Cochran @ 2012-04-03 17:47 UTC (permalink / raw)
  To: netdev
  Cc: David Miller, Ben Hutchings, Martin Porter, Jacob Keller,
	Jeff Kirsher, John Ronciak, e1000-devel
In-Reply-To: <cover.1333474520.git.richardcochran@gmail.com>

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 drivers/net/ethernet/smsc/smsc911x.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index 4a69710..519ed8e 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -2070,6 +2070,7 @@ static const struct ethtool_ops smsc911x_ethtool_ops = {
 	.get_eeprom_len = smsc911x_ethtool_get_eeprom_len,
 	.get_eeprom = smsc911x_ethtool_get_eeprom,
 	.set_eeprom = smsc911x_ethtool_set_eeprom,
+	.get_ts_info = ethtool_op_get_ts_info,
 };
 
 static const struct net_device_ops smsc911x_netdev_ops = {
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH V3 net-next 19/28] mv643xx_eth: Support the get_ts_info ethtool method.
From: Richard Cochran @ 2012-04-03 17:47 UTC (permalink / raw)
  To: netdev
  Cc: David Miller, Ben Hutchings, Martin Porter, Jacob Keller,
	Jeff Kirsher, John Ronciak, e1000-devel
In-Reply-To: <cover.1333474520.git.richardcochran@gmail.com>

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 drivers/net/ethernet/marvell/mv643xx_eth.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 75af1af..153d332 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -1666,6 +1666,7 @@ static const struct ethtool_ops mv643xx_eth_ethtool_ops = {
 	.get_strings		= mv643xx_eth_get_strings,
 	.get_ethtool_stats	= mv643xx_eth_get_ethtool_stats,
 	.get_sset_count		= mv643xx_eth_get_sset_count,
+	.get_ts_info		= ethtool_op_get_ts_info,
 };
 
 
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH V3 net-next 12/28] e100: Support the get_ts_info ethtool method.
From: Richard Cochran @ 2012-04-03 17:47 UTC (permalink / raw)
  To: netdev
  Cc: David Miller, Ben Hutchings, Martin Porter, Jacob Keller,
	Jeff Kirsher, John Ronciak, e1000-devel
In-Reply-To: <cover.1333474520.git.richardcochran@gmail.com>

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 drivers/net/ethernet/intel/e100.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
index 8a1ba85..eb6b97d 100644
--- a/drivers/net/ethernet/intel/e100.c
+++ b/drivers/net/ethernet/intel/e100.c
@@ -2735,6 +2735,7 @@ static const struct ethtool_ops e100_ethtool_ops = {
 	.set_phys_id		= e100_set_phys_id,
 	.get_ethtool_stats	= e100_get_ethtool_stats,
 	.get_sset_count		= e100_get_sset_count,
+	.get_ts_info		= ethtool_op_get_ts_info,
 };
 
 static int e100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH V3 net-next 10/28] davinci_emac: Support the get_ts_info ethtool method.
From: Richard Cochran @ 2012-04-03 17:47 UTC (permalink / raw)
  To: netdev
  Cc: David Miller, Ben Hutchings, Martin Porter, Jacob Keller,
	Jeff Kirsher, John Ronciak, e1000-devel
In-Reply-To: <cover.1333474520.git.richardcochran@gmail.com>

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 drivers/net/ethernet/ti/davinci_emac.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 174a334..8aa3332 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -627,6 +627,7 @@ static const struct ethtool_ops ethtool_ops = {
 	.get_link = ethtool_op_get_link,
 	.get_coalesce = emac_get_coalesce,
 	.set_coalesce =  emac_set_coalesce,
+	.get_ts_info = ethtool_op_get_ts_info,
 };
 
 /**
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH V3 net-next 08/28] ethtool: Add a common function for drivers with transmit time stamping.
From: Richard Cochran @ 2012-04-03 17:47 UTC (permalink / raw)
  To: netdev
  Cc: David Miller, Ben Hutchings, Martin Porter, Jacob Keller,
	Jeff Kirsher, John Ronciak, e1000-devel
In-Reply-To: <cover.1333474520.git.richardcochran@gmail.com>

Currently, most drivers do not support transmit SO_TIMESTAMPING. For those
that do support it, there is one appropriate response to the get_ts_info
query. This patch adds a common function providing this response.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 include/linux/ethtool.h |    1 +
 net/core/ethtool.c      |   11 +++++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 1769714..560a247 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -811,6 +811,7 @@ struct net_device;
 
 /* Some generic methods drivers may use in their ethtool_ops */
 u32 ethtool_op_get_link(struct net_device *dev);
+int ethtool_op_get_ts_info(struct net_device *dev, struct ethtool_ts_info *eti);
 
 /**
  * ethtool_rxfh_indir_default - get default value for RX flow hash indirection
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index a723b13..beacdd9 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -38,6 +38,17 @@ u32 ethtool_op_get_link(struct net_device *dev)
 }
 EXPORT_SYMBOL(ethtool_op_get_link);
 
+int ethtool_op_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info)
+{
+	info->so_timestamping =
+		SOF_TIMESTAMPING_TX_SOFTWARE |
+		SOF_TIMESTAMPING_RX_SOFTWARE |
+		SOF_TIMESTAMPING_SOFTWARE;
+	info->phc_index = -1;
+	return 0;
+}
+EXPORT_SYMBOL(ethtool_op_get_ts_info);
+
 /* Handlers for each ethtool command */
 
 #define ETHTOOL_DEV_FEATURE_WORDS	((NETDEV_FEATURE_COUNT + 31) / 32)
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH V3 net-next 06/28] bfin_mac: Support the get_ts_info ethtool method.
From: Richard Cochran @ 2012-04-03 17:47 UTC (permalink / raw)
  To: netdev
  Cc: David Miller, Ben Hutchings, Martin Porter, Jacob Keller,
	Jeff Kirsher, John Ronciak, e1000-devel
In-Reply-To: <cover.1333474520.git.richardcochran@gmail.com>

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 drivers/net/ethernet/adi/bfin_mac.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/adi/bfin_mac.c b/drivers/net/ethernet/adi/bfin_mac.c
index ab4daec..db22278 100644
--- a/drivers/net/ethernet/adi/bfin_mac.c
+++ b/drivers/net/ethernet/adi/bfin_mac.c
@@ -548,6 +548,25 @@ static int bfin_mac_ethtool_setwol(struct net_device *dev,
 	return 0;
 }
 
+static int bfin_mac_ethtool_get_ts_info(struct net_device *dev,
+	struct ethtool_ts_info *info);
+{
+	info->so_timestamping =
+		SOF_TIMESTAMPING_TX_HARDWARE |
+		SOF_TIMESTAMPING_RX_HARDWARE |
+		SOF_TIMESTAMPING_SYS_HARDWARE;
+	info->phc_index = -1;
+	info->tx_types =
+		(1 << HWTSTAMP_TX_OFF) |
+		(1 << HWTSTAMP_TX_ON);
+	info->rx_filters =
+		(1 << HWTSTAMP_FILTER_NONE) |
+		(1 << HWTSTAMP_FILTER_PTP_V1_L4_EVENT) |
+		(1 << HWTSTAMP_FILTER_PTP_V2_L2_EVENT) |
+		(1 << HWTSTAMP_FILTER_PTP_V2_L4_EVENT);
+	return 0;
+}
+
 static const struct ethtool_ops bfin_mac_ethtool_ops = {
 	.get_settings = bfin_mac_ethtool_getsettings,
 	.set_settings = bfin_mac_ethtool_setsettings,
@@ -555,6 +574,7 @@ static const struct ethtool_ops bfin_mac_ethtool_ops = {
 	.get_drvinfo = bfin_mac_ethtool_getdrvinfo,
 	.get_wol = bfin_mac_ethtool_getwol,
 	.set_wol = bfin_mac_ethtool_setwol,
+	.get_ts_info = bfin_mac_ethtool_get_ts_info,
 };
 
 /**************************************************************************/
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH V3 net-next 03/28] igb: Support the get_ts_info ethtool method.
From: Richard Cochran @ 2012-04-03 17:47 UTC (permalink / raw)
  To: netdev
  Cc: David Miller, Ben Hutchings, Martin Porter, Jacob Keller,
	Jeff Kirsher, John Ronciak, e1000-devel
In-Reply-To: <cover.1333474520.git.richardcochran@gmail.com>

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 drivers/net/ethernet/intel/igb/igb_ethtool.c |   31 ++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index e10821a..245fec0 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -2182,6 +2182,36 @@ static void igb_ethtool_complete(struct net_device *netdev)
 	pm_runtime_put(&adapter->pdev->dev);
 }
 
+static int igb_ethtool_get_ts_info(struct net_device *dev,
+				   struct ethtool_ts_info *info)
+{
+	struct igb_adapter *adapter = netdev_priv(dev);
+
+	info->so_timestamping =
+		SOF_TIMESTAMPING_TX_HARDWARE |
+		SOF_TIMESTAMPING_RX_HARDWARE |
+		SOF_TIMESTAMPING_RAW_HARDWARE;
+
+	if (adapter->ptp_clock)
+		info->phc_index = ptp_clock_index(adapter->ptp_clock);
+	else
+		info->phc_index = -1;
+
+	info->tx_types =
+		(1 << HWTSTAMP_TX_OFF) |
+		(1 << HWTSTAMP_TX_ON);
+
+	info->rx_filters =
+		(1 << HWTSTAMP_FILTER_NONE) |
+		(1 << HWTSTAMP_FILTER_ALL) |
+		(1 << HWTSTAMP_FILTER_SOME) |
+		(1 << HWTSTAMP_FILTER_PTP_V1_L4_SYNC) |
+		(1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) |
+		(1 << HWTSTAMP_FILTER_PTP_V2_EVENT);
+
+	return 0;
+}
+
 static const struct ethtool_ops igb_ethtool_ops = {
 	.get_settings           = igb_get_settings,
 	.set_settings           = igb_set_settings,
@@ -2210,6 +2240,7 @@ static const struct ethtool_ops igb_ethtool_ops = {
 	.set_coalesce           = igb_set_coalesce,
 	.begin			= igb_ethtool_begin,
 	.complete		= igb_ethtool_complete,
+	.get_ts_info		= igb_ethtool_get_ts_info,
 };
 
 void igb_set_ethtool_ops(struct net_device *netdev)
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH V3 net-next 01/28] phc: Add a method for obtaining the device index.
From: Richard Cochran @ 2012-04-03 17:47 UTC (permalink / raw)
  To: netdev
  Cc: David Miller, Ben Hutchings, Martin Porter, Jacob Keller,
	Jeff Kirsher, John Ronciak, e1000-devel
In-Reply-To: <cover.1333474520.git.richardcochran@gmail.com>

This commit adds a method that MAC drivers may call in order to find out
the device number of their associated PTP Hardware Clock.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 drivers/ptp/ptp_clock.c          |    6 ++++++
 include/linux/ptp_clock_kernel.h |    8 ++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index f519a13..1e528b5 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -304,6 +304,12 @@ void ptp_clock_event(struct ptp_clock *ptp, struct ptp_clock_event *event)
 }
 EXPORT_SYMBOL(ptp_clock_event);
 
+int ptp_clock_index(struct ptp_clock *ptp)
+{
+	return ptp->index;
+}
+EXPORT_SYMBOL(ptp_clock_index);
+
 /* module operations */
 
 static void __exit ptp_exit(void)
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index dd2e44f..945704c 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -136,4 +136,12 @@ struct ptp_clock_event {
 extern void ptp_clock_event(struct ptp_clock *ptp,
 			    struct ptp_clock_event *event);
 
+/**
+ * ptp_clock_index() - obtain the device index of a PTP clock
+ *
+ * @ptp:    The clock obtained from ptp_clock_register().
+ */
+
+extern int ptp_clock_index(struct ptp_clock *ptp);
+
 #endif
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH V3 net-next 00/28] ethtool: support time stamping and phc clocks
From: Richard Cochran @ 2012-04-03 17:47 UTC (permalink / raw)
  To: netdev
  Cc: David Miller, Ben Hutchings, Martin Porter, Jacob Keller,
	Jeff Kirsher, John Ronciak, e1000-devel

Changes in V3:
- works without ethtool_ops
- does not require special privileges
- neated user space tool output

Support for SO_TIMESTAMPING of network packets and PTP Hardware Clocks
has been expanding over the last year or two. In an ideal world, every
host would have exactly one PTP hardware clock, and every Ethernet MAC
would support SO_TIMESTAMPING on both the transmit and receive paths.
However, since we do not yet have full coverage for these features,
user space programs need a way to discover what a given interface
supports in these two areas.

* PTP Hardware Clocks

  The relationship between the network interfaces and the (possibly
  multiple) PHC devices is not discoverable except by knowing what
  hardware you have got and carefully looking into the kernel log.

* SO_TIMESTAMPING

  - Receive software time stamps are implemented in the stack
    and thus work for all MAC hardware.
  - Transmit software time stamps are only supported by a dozen
    drivers or so.
  - Some special devices support Tx/Rx time stamping in hardware.
  - None of this is discoverable except by looking into the kernel
    sources.

This series exposes the hardware and driver capabilities known to user
space via ethtool. 

Since the PHC code was first merged, this has become the number one
requested new feature.

Patch number  3 applies on top of my recent two igb/phc patches.
Patch number 12 applies on top of my recent e100 patch.

The new feature has been tested on the following hardware:

igb       Hardware time stamping in the MAC
dp83640   Hardware time stamping in the PHY
r8169     Software Tx time stamping in the MAC

Thanks,
Richard


Richard Cochran (28):
  phc: Add a method for obtaining the device index.
  ethtool: Introduce a method for getting time stamping capabilities.
  igb: Support the get_ts_info ethtool method.
  dp83640: Support the get_ts_info ethtool method.
  gianfar: Support the get_ts_info ethtool method.
  bfin_mac: Support the get_ts_info ethtool method.
  ixp4xx_eth: Support the get_ts_info ethtool method.
  ethtool: Add a common function for drivers with transmit time
    stamping.
  ax88796: Support the get_ts_info ethtool method.
  davinci_emac: Support the get_ts_info ethtool method.
  dnet: Support the get_ts_info ethtool method.
  e100: Support the get_ts_info ethtool method.
  etherh: Support the get_ts_info ethtool method.
  fec_mpc52xx: Support the get_ts_info ethtool method.
  fec: Support the get_ts_info ethtool method.
  fs_enet: Support the get_ts_info ethtool method.
  ll_temac: Support the get_ts_info ethtool method.
  macb: Support the get_ts_info ethtool method.
  mv643xx_eth: Support the get_ts_info ethtool method.
  pxa168_eth: Support the get_ts_info ethtool method.
  r6040: Support the get_ts_info ethtool method.
  r8169: Support the get_ts_info ethtool method.
  smsc911x: Support the get_ts_info ethtool method.
  smsc9420: Support the get_ts_info ethtool method.
  stmmac: Support the get_ts_info ethtool method.
  tg3: Support the get_ts_info ethtool method.
  ucc_geth: Support the get_ts_info ethtool method.
  usbnet: Support the get_ts_info ethtool method.

 arch/arm/mach-ixp4xx/include/mach/ixp46x_ts.h      |    3 +
 drivers/net/ethernet/8390/ax88796.c                |    1 +
 drivers/net/ethernet/8390/etherh.c                 |    1 +
 drivers/net/ethernet/adi/bfin_mac.c                |   20 +++++++
 drivers/net/ethernet/broadcom/tg3.c                |    1 +
 drivers/net/ethernet/cadence/macb.c                |    1 +
 drivers/net/ethernet/dnet.c                        |    1 +
 drivers/net/ethernet/freescale/fec.c               |    1 +
 drivers/net/ethernet/freescale/fec_mpc52xx.c       |    1 +
 .../net/ethernet/freescale/fs_enet/fs_enet-main.c  |    1 +
 drivers/net/ethernet/freescale/gianfar.h           |    3 +
 drivers/net/ethernet/freescale/gianfar_ethtool.c   |   29 ++++++++++
 drivers/net/ethernet/freescale/gianfar_ptp.c       |    2 +
 drivers/net/ethernet/freescale/ucc_geth_ethtool.c  |    1 +
 drivers/net/ethernet/intel/e100.c                  |    1 +
 drivers/net/ethernet/intel/igb/igb_ethtool.c       |   31 ++++++++++
 drivers/net/ethernet/marvell/mv643xx_eth.c         |    1 +
 drivers/net/ethernet/marvell/pxa168_eth.c          |    1 +
 drivers/net/ethernet/rdc/r6040.c                   |    1 +
 drivers/net/ethernet/realtek/r8169.c               |    1 +
 drivers/net/ethernet/smsc/smsc911x.c               |    1 +
 drivers/net/ethernet/smsc/smsc9420.c               |    1 +
 .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c   |    1 +
 drivers/net/ethernet/ti/davinci_emac.c             |    1 +
 drivers/net/ethernet/xilinx/ll_temac_main.c        |    1 +
 drivers/net/ethernet/xscale/ixp4xx_eth.c           |   29 ++++++++++
 drivers/net/phy/dp83640.c                          |   31 ++++++++++
 drivers/net/usb/usbnet.c                           |    1 +
 drivers/ptp/ptp_clock.c                            |    6 ++
 drivers/ptp/ptp_ixp46x.c                           |    3 +
 include/linux/ethtool.h                            |   29 ++++++++++
 include/linux/phy.h                                |    3 +
 include/linux/ptp_clock_kernel.h                   |    8 +++
 net/core/ethtool.c                                 |   59 +++++++++++++++++++-
 34 files changed, 273 insertions(+), 3 deletions(-)

-- 
1.7.2.5

^ permalink raw reply

* [PATCH V3 net-next 28/28] usbnet: Support the get_ts_info ethtool method.
From: Richard Cochran @ 2012-04-03 17:47 UTC (permalink / raw)
  To: netdev
  Cc: e1000-devel, Martin Porter, John Ronciak, Ben Hutchings,
	David Miller, Jacob Keller
In-Reply-To: <cover.1333474520.git.richardcochran@gmail.com>

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 drivers/net/usb/usbnet.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index b7b3f5b..db99536 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -884,6 +884,7 @@ static const struct ethtool_ops usbnet_ethtool_ops = {
 	.get_drvinfo		= usbnet_get_drvinfo,
 	.get_msglevel		= usbnet_get_msglevel,
 	.set_msglevel		= usbnet_set_msglevel,
+	.get_ts_info		= ethtool_op_get_ts_info,
 };
 
 /*-------------------------------------------------------------------------*/
-- 
1.7.2.5


------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

^ permalink raw reply related

* [PATCH V3 net-next 26/28] tg3: Support the get_ts_info ethtool method.
From: Richard Cochran @ 2012-04-03 17:47 UTC (permalink / raw)
  To: netdev
  Cc: e1000-devel, Martin Porter, John Ronciak, Ben Hutchings,
	David Miller, Jacob Keller
In-Reply-To: <cover.1333474520.git.richardcochran@gmail.com>

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 drivers/net/ethernet/broadcom/tg3.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 7b71387..8609798 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -12233,6 +12233,7 @@ static const struct ethtool_ops tg3_ethtool_ops = {
 	.get_rxfh_indir_size    = tg3_get_rxfh_indir_size,
 	.get_rxfh_indir		= tg3_get_rxfh_indir,
 	.set_rxfh_indir		= tg3_set_rxfh_indir,
+	.get_ts_info		= ethtool_op_get_ts_info,
 };
 
 static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *dev,
-- 
1.7.2.5


------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox