diff mbox

[V2,net-next,08/28] ethtool: Add a common function for drivers with transmit time stamping.

Message ID 7eca521e2f9db67dab89a9c2bfd62b8fdff587f3.1333289292.git.richardcochran@gmail.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Richard Cochran April 1, 2012, 3:19 p.m. UTC
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(-)

Comments

Ben Hutchings April 2, 2012, 5:34 p.m. UTC | #1
On Sun, 2012-04-01 at 17:19 +0200, Richard Cochran wrote:
> 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.

This looks fine but obviously depends on the other ethtool change.

Ben.

> 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 776b3d0..0245d1d 100644
> --- a/include/linux/ethtool.h
> +++ b/include/linux/ethtool.h
> @@ -806,6 +806,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 d6eff4b..14bb8b1 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)
diff mbox

Patch

diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 776b3d0..0245d1d 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -806,6 +806,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 d6eff4b..14bb8b1 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)