82575 has only software timestamping capability and it has
no PTP Hardware Clocks. Therefore, -1 has to be specified
to the phc_index for ethtool's get_ts_info, otherwise a wrong
value will be set to the phc_index.

v2: move the if (adapter->ptp_clock) section specifying phc_index
    to above the switch statement as suggested by Matthew Vick.
    adapter->ptpclock will always be NULL for 82575.

Signed-off-by: Ken ICHIKAWA <ichikawa....@jp.fujitsu.com>
---
 drivers/net/ethernet/intel/igb/igb_ethtool.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c 
b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index 1df0237..1c050f1 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -2354,6 +2354,11 @@ static int igb_get_ts_info(struct net_device *dev,
 {
        struct igb_adapter *adapter = netdev_priv(dev);
 
+       if (adapter->ptp_clock)
+               info->phc_index = ptp_clock_index(adapter->ptp_clock);
+       else
+               info->phc_index = -1;
+
        switch (adapter->hw.mac.type) {
        case e1000_82575:
                info->so_timestamping =
@@ -2375,11 +2380,6 @@ static int igb_get_ts_info(struct net_device *dev,
                        SOF_TIMESTAMPING_RX_HARDWARE |
                        SOF_TIMESTAMPING_RAW_HARDWARE;
 
-               if (adapter->ptp_clock)
-                       info->phc_index = ptp_clock_index(adapter->ptp_clock);
-               else
-                       info->phc_index = -1;
-
                info->tx_types =
                        (1 << HWTSTAMP_TX_OFF) |
                        (1 << HWTSTAMP_TX_ON);
-- 
1.8.4.2



------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit 
http://communities.intel.com/community/wired

Reply via email to