1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-30 08:32:52 +08:00

Rework ethtool get_ts_info implementation

This commit is contained in:
Alex Forencich 2021-10-08 17:47:22 -07:00
parent 4294e5ea1d
commit 1bce5827c9

View File

@ -56,13 +56,16 @@ static int mqnic_get_ts_info(struct net_device *ndev, struct ethtool_ts_info *in
{ {
struct mqnic_priv *priv = netdev_priv(ndev); struct mqnic_priv *priv = netdev_priv(ndev);
struct mqnic_dev *mdev = priv->mdev; struct mqnic_dev *mdev = priv->mdev;
int ret;
ret = ethtool_op_get_ts_info(ndev, info); ethtool_op_get_ts_info(ndev, info);
if (ret)
return ret;
info->so_timestamping |= if (mdev->ptp_clock)
info->phc_index = ptp_clock_index(mdev->ptp_clock);
if (!(priv->if_features & MQNIC_IF_FEATURE_PTP_TS) || !mdev->ptp_clock)
return 0;
info->so_timestamping =
SOF_TIMESTAMPING_TX_HARDWARE | SOF_TIMESTAMPING_TX_HARDWARE |
SOF_TIMESTAMPING_RX_HARDWARE | SOF_TIMESTAMPING_RX_HARDWARE |
SOF_TIMESTAMPING_RAW_HARDWARE; SOF_TIMESTAMPING_RAW_HARDWARE;
@ -75,10 +78,7 @@ static int mqnic_get_ts_info(struct net_device *ndev, struct ethtool_ts_info *in
BIT(HWTSTAMP_FILTER_NONE) | BIT(HWTSTAMP_FILTER_NONE) |
BIT(HWTSTAMP_FILTER_ALL); BIT(HWTSTAMP_FILTER_ALL);
if (mdev->ptp_clock) return 0;
info->phc_index = ptp_clock_index(mdev->ptp_clock);
return ret;
} }
static int mqnic_read_module_eeprom(struct net_device *ndev, u16 offset, u16 len, u8 *data) static int mqnic_read_module_eeprom(struct net_device *ndev, u16 offset, u16 len, u8 *data)