提交 7575c917 编写于 作者: B Ben Hutchings

bfin_mac: Implement the SIOCGHWTSTAMP ioctl

Compile-tested only (thanks to the kbuild test robot).
Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
上级 433dc9b3
...@@ -667,8 +667,8 @@ static u32 bfin_select_phc_clock(u32 input_clk, unsigned int *shift_result) ...@@ -667,8 +667,8 @@ static u32 bfin_select_phc_clock(u32 input_clk, unsigned int *shift_result)
return 1000000000UL / ppn; return 1000000000UL / ppn;
} }
static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev, static int bfin_mac_hwtstamp_set(struct net_device *netdev,
struct ifreq *ifr, int cmd) struct ifreq *ifr)
{ {
struct hwtstamp_config config; struct hwtstamp_config config;
struct bfin_mac_local *lp = netdev_priv(netdev); struct bfin_mac_local *lp = netdev_priv(netdev);
...@@ -824,6 +824,16 @@ static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev, ...@@ -824,6 +824,16 @@ static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev,
-EFAULT : 0; -EFAULT : 0;
} }
static int bfin_mac_hwtstamp_get(struct net_device *netdev,
struct ifreq *ifr)
{
struct bfin_mac_local *lp = netdev_priv(netdev);
return copy_to_user(ifr->ifr_data, &lp->stamp_cfg,
sizeof(lp->stamp_cfg)) ?
-EFAULT : 0;
}
static void bfin_tx_hwtstamp(struct net_device *netdev, struct sk_buff *skb) static void bfin_tx_hwtstamp(struct net_device *netdev, struct sk_buff *skb)
{ {
struct bfin_mac_local *lp = netdev_priv(netdev); struct bfin_mac_local *lp = netdev_priv(netdev);
...@@ -1062,7 +1072,8 @@ static void bfin_phc_release(struct bfin_mac_local *lp) ...@@ -1062,7 +1072,8 @@ static void bfin_phc_release(struct bfin_mac_local *lp)
#else #else
# define bfin_mac_hwtstamp_is_none(cfg) 0 # define bfin_mac_hwtstamp_is_none(cfg) 0
# define bfin_mac_hwtstamp_init(dev) # define bfin_mac_hwtstamp_init(dev)
# define bfin_mac_hwtstamp_ioctl(dev, ifr, cmd) (-EOPNOTSUPP) # define bfin_mac_hwtstamp_set(dev, ifr) (-EOPNOTSUPP)
# define bfin_mac_hwtstamp_get(dev, ifr) (-EOPNOTSUPP)
# define bfin_rx_hwtstamp(dev, skb) # define bfin_rx_hwtstamp(dev, skb)
# define bfin_tx_hwtstamp(dev, skb) # define bfin_tx_hwtstamp(dev, skb)
# define bfin_phc_init(netdev, dev) 0 # define bfin_phc_init(netdev, dev) 0
...@@ -1496,7 +1507,9 @@ static int bfin_mac_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) ...@@ -1496,7 +1507,9 @@ static int bfin_mac_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
switch (cmd) { switch (cmd) {
case SIOCSHWTSTAMP: case SIOCSHWTSTAMP:
return bfin_mac_hwtstamp_ioctl(netdev, ifr, cmd); return bfin_mac_hwtstamp_set(netdev, ifr);
case SIOCGHWTSTAMP:
return bfin_mac_hwtstamp_get(netdev, ifr);
default: default:
if (lp->phydev) if (lp->phydev)
return phy_mii_ioctl(lp->phydev, ifr, cmd); return phy_mii_ioctl(lp->phydev, ifr, cmd);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册