sfc: Report software timestamping capabilities
authorBen Hutchings <bhutchings@solarflare.com>
Mon, 8 Apr 2013 16:34:58 +0000 (17:34 +0100)
committerBen Hutchings <bhutchings@solarflare.com>
Mon, 24 Jun 2013 18:58:29 +0000 (19:58 +0100)
The kernel can generate software receive timestamps and we should
report those for all ports regardless of hardware capabilities.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
drivers/net/ethernet/sfc/ethtool.c
drivers/net/ethernet/sfc/nic.h
drivers/net/ethernet/sfc/ptp.c

index 6e768175e7e00b6b4864088b094cd45a167782a9..1fc21458413d50ade70be1ff1ee9481aca7cf987 100644 (file)
@@ -1114,6 +1114,20 @@ static int efx_ethtool_set_rxfh_indir(struct net_device *net_dev,
        return 0;
 }
 
+int efx_ethtool_get_ts_info(struct net_device *net_dev,
+                           struct ethtool_ts_info *ts_info)
+{
+       struct efx_nic *efx = netdev_priv(net_dev);
+
+       /* Software capabilities */
+       ts_info->so_timestamping = (SOF_TIMESTAMPING_RX_SOFTWARE |
+                                   SOF_TIMESTAMPING_SOFTWARE);
+       ts_info->phc_index = -1;
+
+       efx_ptp_get_ts_info(efx, ts_info);
+       return 0;
+}
+
 static int efx_ethtool_get_module_eeprom(struct net_device *net_dev,
                                         struct ethtool_eeprom *ee,
                                         u8 *data)
@@ -1176,7 +1190,7 @@ const struct ethtool_ops efx_ethtool_ops = {
        .get_rxfh_indir_size    = efx_ethtool_get_rxfh_indir_size,
        .get_rxfh_indir         = efx_ethtool_get_rxfh_indir,
        .set_rxfh_indir         = efx_ethtool_set_rxfh_indir,
-       .get_ts_info            = efx_ptp_get_ts_info,
+       .get_ts_info            = efx_ethtool_get_ts_info,
        .get_module_info        = efx_ethtool_get_module_info,
        .get_module_eeprom      = efx_ethtool_get_module_eeprom,
 };
index 1b0003323498502741f2c36d5437586a8e8176f6..d63c2991a75105767487aa66ae1cbe284fc6abc1 100644 (file)
@@ -254,8 +254,8 @@ extern int efx_sriov_set_vf_spoofchk(struct net_device *net_dev, int vf,
 struct ethtool_ts_info;
 extern void efx_ptp_probe(struct efx_nic *efx);
 extern int efx_ptp_ioctl(struct efx_nic *efx, struct ifreq *ifr, int cmd);
-extern int efx_ptp_get_ts_info(struct net_device *net_dev,
-                              struct ethtool_ts_info *ts_info);
+extern void efx_ptp_get_ts_info(struct efx_nic *efx,
+                               struct ethtool_ts_info *ts_info);
 extern bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb);
 extern int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb);
 extern void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev);
index 9a95abf2dedfad3dce17f6739eaba93a23e4c105..b495394a6dfa7f7f64353caf5929c4a76825e34e 100644 (file)
@@ -1203,18 +1203,16 @@ static int efx_ptp_ts_init(struct efx_nic *efx, struct hwtstamp_config *init)
        return 0;
 }
 
-int
-efx_ptp_get_ts_info(struct net_device *net_dev, struct ethtool_ts_info *ts_info)
+void efx_ptp_get_ts_info(struct efx_nic *efx, struct ethtool_ts_info *ts_info)
 {
-       struct efx_nic *efx = netdev_priv(net_dev);
        struct efx_ptp_data *ptp = efx->ptp_data;
 
        if (!ptp)
-               return -EOPNOTSUPP;
+               return;
 
-       ts_info->so_timestamping = (SOF_TIMESTAMPING_TX_HARDWARE |
-                                   SOF_TIMESTAMPING_RX_HARDWARE |
-                                   SOF_TIMESTAMPING_RAW_HARDWARE);
+       ts_info->so_timestamping |= (SOF_TIMESTAMPING_TX_HARDWARE |
+                                    SOF_TIMESTAMPING_RX_HARDWARE |
+                                    SOF_TIMESTAMPING_RAW_HARDWARE);
        ts_info->phc_index = ptp_clock_index(ptp->phc_clock);
        ts_info->tx_types = 1 << HWTSTAMP_TX_OFF | 1 << HWTSTAMP_TX_ON;
        ts_info->rx_filters = (1 << HWTSTAMP_FILTER_NONE |
@@ -1224,7 +1222,6 @@ efx_ptp_get_ts_info(struct net_device *net_dev, struct ethtool_ts_info *ts_info)
                               1 << HWTSTAMP_FILTER_PTP_V2_L4_EVENT |
                               1 << HWTSTAMP_FILTER_PTP_V2_L4_SYNC |
                               1 << HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ);
-       return 0;
 }
 
 int efx_ptp_ioctl(struct efx_nic *efx, struct ifreq *ifr, int cmd)