netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] net: fec: report correct hardware stamping info to ethtool
@ 2013-01-06  1:38 Frank Li
  2013-01-06  8:09 ` Richard Cochran
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Frank Li @ 2013-01-06  1:38 UTC (permalink / raw)
  To: lznuaa, shawn.guo, richardcochran, davem, linux-arm-kernel,
	netdev
  Cc: s.hauer, Frank Li

Report correct hardware stamping capibilty by ethtool interface.
The v1.0 ptp4l check it.

Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
 drivers/net/ethernet/freescale/fec.c |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index a379319..c713db5 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -1173,12 +1173,38 @@ static void fec_enet_get_drvinfo(struct net_device *ndev,
 	strcpy(info->bus_info, dev_name(&ndev->dev));
 }
 
+static int fec_enet_get_ts_info(struct net_device *ndev,
+				struct ethtool_ts_info *info)
+{
+	struct fec_enet_private *fep = netdev_priv(ndev);
+	int ret;
+	ret = ethtool_op_get_ts_info(ndev, info);
+
+	if (fep->bufdesc_ex) {
+
+		info->so_timestamping |= SOF_TIMESTAMPING_TX_HARDWARE |
+					 SOF_TIMESTAMPING_RX_HARDWARE |
+					 SOF_TIMESTAMPING_RAW_HARDWARE;
+		if (fep->ptp_clock)
+			info->phc_index = ptp_clock_index(fep->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);
+	}
+	return ret;
+}
+
 static const struct ethtool_ops fec_enet_ethtool_ops = {
 	.get_settings		= fec_enet_get_settings,
 	.set_settings		= fec_enet_set_settings,
 	.get_drvinfo		= fec_enet_get_drvinfo,
 	.get_link		= ethtool_op_get_link,
-	.get_ts_info		= ethtool_op_get_ts_info,
+	.get_ts_info		= fec_enet_get_ts_info,
 };
 
 static int fec_enet_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] net: fec: report correct hardware stamping info to ethtool
  2013-01-06  1:38 [PATCH 1/1] net: fec: report correct hardware stamping info to ethtool Frank Li
@ 2013-01-06  8:09 ` Richard Cochran
  2013-01-06  8:15 ` Richard Cochran
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Richard Cochran @ 2013-01-06  8:09 UTC (permalink / raw)
  To: Frank Li; +Cc: lznuaa, shawn.guo, davem, linux-arm-kernel, netdev, s.hauer

On Sun, Jan 06, 2013 at 09:38:38AM +0800, Frank Li wrote:
> Report correct hardware stamping capibilty by ethtool interface.
> The v1.0 ptp4l check it.
> 
> Signed-off-by: Frank Li <Frank.Li@freescale.com>
> ---
>  drivers/net/ethernet/freescale/fec.c |   28 +++++++++++++++++++++++++++-
>  1 files changed, 27 insertions(+), 1 deletions(-)

Thanks for following up to add this.

Acked-by: Richard Cochran <richardcochran@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] net: fec: report correct hardware stamping info to ethtool
  2013-01-06  1:38 [PATCH 1/1] net: fec: report correct hardware stamping info to ethtool Frank Li
  2013-01-06  8:09 ` Richard Cochran
@ 2013-01-06  8:15 ` Richard Cochran
  2013-01-06  8:20 ` Richard Cochran
  2013-01-06 11:33 ` Sascha Hauer
  3 siblings, 0 replies; 6+ messages in thread
From: Richard Cochran @ 2013-01-06  8:15 UTC (permalink / raw)
  To: Frank Li; +Cc: lznuaa, shawn.guo, davem, linux-arm-kernel, netdev, s.hauer

Frank,

This also should be fixed in v3.8, but the fix will look
different. Would you please submit a patch for that, too?

BTW, you should always label the patch to tell which tree it goes
into, either "net" or "net-next". This patch is for net-next, but a
fix for v3.8 would be for net.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] net: fec: report correct hardware stamping info to ethtool
  2013-01-06  1:38 [PATCH 1/1] net: fec: report correct hardware stamping info to ethtool Frank Li
  2013-01-06  8:09 ` Richard Cochran
  2013-01-06  8:15 ` Richard Cochran
@ 2013-01-06  8:20 ` Richard Cochran
  2013-01-06  8:23   ` Frank Li
  2013-01-06 11:33 ` Sascha Hauer
  3 siblings, 1 reply; 6+ messages in thread
From: Richard Cochran @ 2013-01-06  8:20 UTC (permalink / raw)
  To: Frank Li; +Cc: lznuaa, shawn.guo, davem, linux-arm-kernel, netdev, s.hauer

Frank,

You have a bad email address as one of the recipients:

   linux-arm-kernel@lists.infradead.or
                                    ***

You also did that last time. Please take care and fix it.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] net: fec: report correct hardware stamping info to ethtool
  2013-01-06  8:20 ` Richard Cochran
@ 2013-01-06  8:23   ` Frank Li
  0 siblings, 0 replies; 6+ messages in thread
From: Frank Li @ 2013-01-06  8:23 UTC (permalink / raw)
  To: Richard Cochran
  Cc: Frank Li, netdev, s.hauer, shawn.guo, davem, linux-arm-kernel

2013/1/6 Richard Cochran <richardcochran@gmail.com>:
> Frank,
>
> You have a bad email address as one of the recipients:
>
>    linux-arm-kernel@lists.infradead.or
>                                     ***

Thank you very much

>
> You also did that last time. Please take care and fix it.
>
> Thanks,
> Richard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] net: fec: report correct hardware stamping info to ethtool
  2013-01-06  1:38 [PATCH 1/1] net: fec: report correct hardware stamping info to ethtool Frank Li
                   ` (2 preceding siblings ...)
  2013-01-06  8:20 ` Richard Cochran
@ 2013-01-06 11:33 ` Sascha Hauer
  3 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2013-01-06 11:33 UTC (permalink / raw)
  To: Frank Li; +Cc: lznuaa, shawn.guo, richardcochran, davem, linux-arm-kernel,
	netdev

On Sun, Jan 06, 2013 at 09:38:38AM +0800, Frank Li wrote:
> Report correct hardware stamping capibilty by ethtool interface.

s/capibilty/capability/

> The v1.0 ptp4l check it.
> 
> Signed-off-by: Frank Li <Frank.Li@freescale.com>
> ---
>  drivers/net/ethernet/freescale/fec.c |   28 +++++++++++++++++++++++++++-
>  1 files changed, 27 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
> index a379319..c713db5 100644
> --- a/drivers/net/ethernet/freescale/fec.c
> +++ b/drivers/net/ethernet/freescale/fec.c
> @@ -1173,12 +1173,38 @@ static void fec_enet_get_drvinfo(struct net_device *ndev,
>  	strcpy(info->bus_info, dev_name(&ndev->dev));
>  }
>  
> +static int fec_enet_get_ts_info(struct net_device *ndev,
> +				struct ethtool_ts_info *info)
> +{
> +	struct fec_enet_private *fep = netdev_priv(ndev);
> +	int ret;
> +	ret = ethtool_op_get_ts_info(ndev, info);
> +
> +	if (fep->bufdesc_ex) {
> +
> +		info->so_timestamping |= SOF_TIMESTAMPING_TX_HARDWARE |
> +					 SOF_TIMESTAMPING_RX_HARDWARE |
> +					 SOF_TIMESTAMPING_RAW_HARDWARE;
> +		if (fep->ptp_clock)
> +			info->phc_index = ptp_clock_index(fep->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);

		return 0;
	} else {
		return ethtool_op_get_ts_info(ndev, info);
	}

?

Otherwise you call ethtool_op_get_ts_info() and don't use the result
with fep->bufdesc_ex, still you return the return value of
ethtool_op_get_ts_info().

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-01-06 11:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-06  1:38 [PATCH 1/1] net: fec: report correct hardware stamping info to ethtool Frank Li
2013-01-06  8:09 ` Richard Cochran
2013-01-06  8:15 ` Richard Cochran
2013-01-06  8:20 ` Richard Cochran
2013-01-06  8:23   ` Frank Li
2013-01-06 11:33 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).