From e93d5e1e556bb0fc3dfea89123ca5c519fce1a5f Mon Sep 17 00:00:00 2001 From: Narayan Reddy Date: Sat, 14 Sep 2019 01:11:54 +0530 Subject: [PATCH] nvethernet: read actual ptp clock index Issue: currently always returning 0 as PTP clock index Fix: Instead of hardcoding the ptp clock index to 0, read actual index using ptp_clock_index. Bug 2703848 Change-Id: Icff23ab516c4e16df02230a7dc7369e133bd7a5f Signed-off-by: Narayan Reddy Reviewed-on: https://git-master.nvidia.com/r/2197387 Reviewed-by: Srinivas Ramachandran Reviewed-by: Bhadram Varka GVS: Gerrit_Virtual_Submit Reviewed-by: Bitan Biswas Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/net/ethernet/nvidia/nvethernet/ethtool.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/nvidia/nvethernet/ethtool.c b/drivers/net/ethernet/nvidia/nvethernet/ethtool.c index d19e2fa6..8e3c3af2 100644 --- a/drivers/net/ethernet/nvidia/nvethernet/ethtool.c +++ b/drivers/net/ethernet/nvidia/nvethernet/ethtool.c @@ -498,23 +498,28 @@ static int ether_set_pauseparam(struct net_device *ndev, * * Algorithm: Function used to query the PTP capabilities for given netdev. * - * @param[in] net: Net device data. + * @param[in] ndev: Net device data. * @param[in] info: Holds device supported timestamping types * * @note HW need to support PTP functionality. * * @return zero on success */ -static int ether_get_ts_info(struct net_device *net, +static int ether_get_ts_info(struct net_device *ndev, struct ethtool_ts_info *info) { + struct ether_priv_data *pdata = netdev_priv(ndev); + info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE | SOF_TIMESTAMPING_RX_HARDWARE | SOF_TIMESTAMPING_TX_SOFTWARE | SOF_TIMESTAMPING_RX_SOFTWARE | SOF_TIMESTAMPING_RAW_HARDWARE | SOF_TIMESTAMPING_SOFTWARE; - info->phc_index = 0; + + if (pdata->ptp_clock) { + info->phc_index = ptp_clock_index(pdata->ptp_clock); + } info->tx_types = (1 << HWTSTAMP_TX_OFF) | (1 << HWTSTAMP_TX_ON);