diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2013-11-13 20:26:21 -0500 |
---|---|---|
committer | Ben Hutchings <bhutchings@solarflare.com> | 2013-11-19 16:42:46 -0500 |
commit | 433dc9b3d123e72a0f5988c1f0d1c9319a735276 (patch) | |
tree | 4383e9560feb4c9f5674d7cc9b8edfde70b2bc38 /drivers/net/ethernet | |
parent | fd468c74bd4d6949736810a80d6ca05eb20fba84 (diff) |
sfc: Implement the SIOCGHWTSTAMP ioctl
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/sfc/efx.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/nic.h | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/ptp.c | 11 |
3 files changed, 15 insertions, 3 deletions
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index 07c9bc4c61bc..22ca5cd3f722 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c | |||
@@ -1857,7 +1857,9 @@ static int efx_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd) | |||
1857 | struct mii_ioctl_data *data = if_mii(ifr); | 1857 | struct mii_ioctl_data *data = if_mii(ifr); |
1858 | 1858 | ||
1859 | if (cmd == SIOCSHWTSTAMP) | 1859 | if (cmd == SIOCSHWTSTAMP) |
1860 | return efx_ptp_ioctl(efx, ifr, cmd); | 1860 | return efx_ptp_set_ts_config(efx, ifr); |
1861 | if (cmd == SIOCGHWTSTAMP) | ||
1862 | return efx_ptp_get_ts_config(efx, ifr); | ||
1861 | 1863 | ||
1862 | /* Convert phy_id from older PRTAD/DEVAD format */ | 1864 | /* Convert phy_id from older PRTAD/DEVAD format */ |
1863 | if ((cmd == SIOCGMIIREG || cmd == SIOCSMIIREG) && | 1865 | if ((cmd == SIOCGMIIREG || cmd == SIOCSMIIREG) && |
diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h index 11b6112d9249..33852e824f12 100644 --- a/drivers/net/ethernet/sfc/nic.h +++ b/drivers/net/ethernet/sfc/nic.h | |||
@@ -555,7 +555,8 @@ int efx_sriov_set_vf_spoofchk(struct net_device *net_dev, int vf, | |||
555 | 555 | ||
556 | struct ethtool_ts_info; | 556 | struct ethtool_ts_info; |
557 | void efx_ptp_probe(struct efx_nic *efx); | 557 | void efx_ptp_probe(struct efx_nic *efx); |
558 | int efx_ptp_ioctl(struct efx_nic *efx, struct ifreq *ifr, int cmd); | 558 | int efx_ptp_set_ts_config(struct efx_nic *efx, struct ifreq *ifr); |
559 | int efx_ptp_get_ts_config(struct efx_nic *efx, struct ifreq *ifr); | ||
559 | void efx_ptp_get_ts_info(struct efx_nic *efx, struct ethtool_ts_info *ts_info); | 560 | void efx_ptp_get_ts_info(struct efx_nic *efx, struct ethtool_ts_info *ts_info); |
560 | bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); | 561 | bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); |
561 | int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); | 562 | int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); |
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c index 03acf57df045..afd4d3a50460 100644 --- a/drivers/net/ethernet/sfc/ptp.c +++ b/drivers/net/ethernet/sfc/ptp.c | |||
@@ -1231,7 +1231,7 @@ void efx_ptp_get_ts_info(struct efx_nic *efx, struct ethtool_ts_info *ts_info) | |||
1231 | 1 << HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ); | 1231 | 1 << HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ); |
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | int efx_ptp_ioctl(struct efx_nic *efx, struct ifreq *ifr, int cmd) | 1234 | int efx_ptp_set_ts_config(struct efx_nic *efx, struct ifreq *ifr) |
1235 | { | 1235 | { |
1236 | struct hwtstamp_config config; | 1236 | struct hwtstamp_config config; |
1237 | int rc; | 1237 | int rc; |
@@ -1251,6 +1251,15 @@ int efx_ptp_ioctl(struct efx_nic *efx, struct ifreq *ifr, int cmd) | |||
1251 | ? -EFAULT : 0; | 1251 | ? -EFAULT : 0; |
1252 | } | 1252 | } |
1253 | 1253 | ||
1254 | int efx_ptp_get_ts_config(struct efx_nic *efx, struct ifreq *ifr) | ||
1255 | { | ||
1256 | if (!efx->ptp_data) | ||
1257 | return -EOPNOTSUPP; | ||
1258 | |||
1259 | return copy_to_user(ifr->ifr_data, &efx->ptp_data->config, | ||
1260 | sizeof(efx->ptp_data->config)) ? -EFAULT : 0; | ||
1261 | } | ||
1262 | |||
1254 | static void ptp_event_failure(struct efx_nic *efx, int expected_frag_len) | 1263 | static void ptp_event_failure(struct efx_nic *efx, int expected_frag_len) |
1255 | { | 1264 | { |
1256 | struct efx_ptp_data *ptp = efx->ptp_data; | 1265 | struct efx_ptp_data *ptp = efx->ptp_data; |