Merge branch 'siocghwtstamp' of git://git.kernel.org/pub/scm/linux/kernel/git/bwh/sfc-next
Ben Hutchings says: ==================== SIOCGHWTSTAMP ioctl 1. Add the SIOCGHWTSTAMP ioctl and update the timestamping documentation. 2. Implement SIOCGHWTSTAMP in most drivers that support SIOCSHWTSTAMP. 3. Add a test program to exercise SIOC{G,S}HWTSTAMP. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -339,7 +339,8 @@ struct fec_enet_private {
|
||||
|
||||
void fec_ptp_init(struct platform_device *pdev);
|
||||
void fec_ptp_start_cyclecounter(struct net_device *ndev);
|
||||
int fec_ptp_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd);
|
||||
int fec_ptp_set(struct net_device *ndev, struct ifreq *ifr);
|
||||
int fec_ptp_get(struct net_device *ndev, struct ifreq *ifr);
|
||||
|
||||
/****************************************************************************/
|
||||
#endif /* FEC_H */
|
||||
|
@@ -1683,8 +1683,12 @@ static int fec_enet_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
|
||||
if (!phydev)
|
||||
return -ENODEV;
|
||||
|
||||
if (cmd == SIOCSHWTSTAMP && fep->bufdesc_ex)
|
||||
return fec_ptp_ioctl(ndev, rq, cmd);
|
||||
if (fep->bufdesc_ex) {
|
||||
if (cmd == SIOCSHWTSTAMP)
|
||||
return fec_ptp_set(ndev, rq);
|
||||
if (cmd == SIOCGHWTSTAMP)
|
||||
return fec_ptp_get(ndev, rq);
|
||||
}
|
||||
|
||||
return phy_mii_ioctl(phydev, rq, cmd);
|
||||
}
|
||||
|
@@ -274,7 +274,7 @@ static int fec_ptp_enable(struct ptp_clock_info *ptp,
|
||||
* @ifreq: ioctl data
|
||||
* @cmd: particular ioctl requested
|
||||
*/
|
||||
int fec_ptp_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd)
|
||||
int fec_ptp_set(struct net_device *ndev, struct ifreq *ifr)
|
||||
{
|
||||
struct fec_enet_private *fep = netdev_priv(ndev);
|
||||
|
||||
@@ -321,6 +321,20 @@ int fec_ptp_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd)
|
||||
-EFAULT : 0;
|
||||
}
|
||||
|
||||
int fec_ptp_get(struct net_device *ndev, struct ifreq *ifr)
|
||||
{
|
||||
struct fec_enet_private *fep = netdev_priv(ndev);
|
||||
struct hwtstamp_config config;
|
||||
|
||||
config.flags = 0;
|
||||
config.tx_type = fep->hwts_tx_en ? HWTSTAMP_TX_ON : HWTSTAMP_TX_OFF;
|
||||
config.rx_filter = (fep->hwts_rx_en ?
|
||||
HWTSTAMP_FILTER_ALL : HWTSTAMP_FILTER_NONE);
|
||||
|
||||
return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
|
||||
-EFAULT : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* fec_time_keep - call timecounter_read every second to avoid timer overrun
|
||||
* because ENET just support 32bit counter, will timeout in 4s
|
||||
|
@@ -795,8 +795,7 @@ err_grp_init:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int gfar_hwtstamp_ioctl(struct net_device *netdev,
|
||||
struct ifreq *ifr, int cmd)
|
||||
static int gfar_hwtstamp_set(struct net_device *netdev, struct ifreq *ifr)
|
||||
{
|
||||
struct hwtstamp_config config;
|
||||
struct gfar_private *priv = netdev_priv(netdev);
|
||||
@@ -845,7 +844,20 @@ static int gfar_hwtstamp_ioctl(struct net_device *netdev,
|
||||
-EFAULT : 0;
|
||||
}
|
||||
|
||||
/* Ioctl MII Interface */
|
||||
static int gfar_hwtstamp_get(struct net_device *netdev, struct ifreq *ifr)
|
||||
{
|
||||
struct hwtstamp_config config;
|
||||
struct gfar_private *priv = netdev_priv(netdev);
|
||||
|
||||
config.flags = 0;
|
||||
config.tx_type = priv->hwts_tx_en ? HWTSTAMP_TX_ON : HWTSTAMP_TX_OFF;
|
||||
config.rx_filter = (priv->hwts_rx_en ?
|
||||
HWTSTAMP_FILTER_ALL : HWTSTAMP_FILTER_NONE);
|
||||
|
||||
return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
|
||||
-EFAULT : 0;
|
||||
}
|
||||
|
||||
static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
{
|
||||
struct gfar_private *priv = netdev_priv(dev);
|
||||
@@ -854,7 +866,9 @@ static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
return -EINVAL;
|
||||
|
||||
if (cmd == SIOCSHWTSTAMP)
|
||||
return gfar_hwtstamp_ioctl(dev, rq, cmd);
|
||||
return gfar_hwtstamp_set(dev, rq);
|
||||
if (cmd == SIOCGHWTSTAMP)
|
||||
return gfar_hwtstamp_get(dev, rq);
|
||||
|
||||
if (!priv->phydev)
|
||||
return -ENODEV;
|
||||
|
Reference in New Issue
Block a user