Skip to content

Commit 60dbede

Browse files
vcgomesJeff Kirsher
authored andcommitted
igc: Add support for ethtool GET_TS_INFO command
This command allows igc to report what types of timestamping are supported. ptp4l uses this to detect if the hardware supports timestamping. Signed-off-by: Vinicius Costa Gomes <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 2c344ae commit 60dbede

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

drivers/net/ethernet/intel/igc/igc_ethtool.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,6 +1600,39 @@ static int igc_set_channels(struct net_device *netdev,
16001600
return 0;
16011601
}
16021602

1603+
static int igc_get_ts_info(struct net_device *dev,
1604+
struct ethtool_ts_info *info)
1605+
{
1606+
struct igc_adapter *adapter = netdev_priv(dev);
1607+
1608+
if (adapter->ptp_clock)
1609+
info->phc_index = ptp_clock_index(adapter->ptp_clock);
1610+
else
1611+
info->phc_index = -1;
1612+
1613+
switch (adapter->hw.mac.type) {
1614+
case igc_i225:
1615+
info->so_timestamping =
1616+
SOF_TIMESTAMPING_TX_SOFTWARE |
1617+
SOF_TIMESTAMPING_RX_SOFTWARE |
1618+
SOF_TIMESTAMPING_SOFTWARE |
1619+
SOF_TIMESTAMPING_TX_HARDWARE |
1620+
SOF_TIMESTAMPING_RX_HARDWARE |
1621+
SOF_TIMESTAMPING_RAW_HARDWARE;
1622+
1623+
info->tx_types =
1624+
BIT(HWTSTAMP_TX_OFF) |
1625+
BIT(HWTSTAMP_TX_ON);
1626+
1627+
info->rx_filters = BIT(HWTSTAMP_FILTER_NONE);
1628+
info->rx_filters |= BIT(HWTSTAMP_FILTER_ALL);
1629+
1630+
return 0;
1631+
default:
1632+
return -EOPNOTSUPP;
1633+
}
1634+
}
1635+
16031636
static u32 igc_get_priv_flags(struct net_device *netdev)
16041637
{
16051638
struct igc_adapter *adapter = netdev_priv(netdev);
@@ -1847,6 +1880,7 @@ static const struct ethtool_ops igc_ethtool_ops = {
18471880
.get_rxfh_indir_size = igc_get_rxfh_indir_size,
18481881
.get_rxfh = igc_get_rxfh,
18491882
.set_rxfh = igc_set_rxfh,
1883+
.get_ts_info = igc_get_ts_info,
18501884
.get_channels = igc_get_channels,
18511885
.set_channels = igc_set_channels,
18521886
.get_priv_flags = igc_get_priv_flags,

0 commit comments

Comments
 (0)