diff options
author | Matthew Vick <matthew.vick@intel.com> | 2012-08-28 02:33:05 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2012-09-17 05:04:18 -0400 |
commit | a9188028fd8a446413be48e7f6490f2d18a8d07e (patch) | |
tree | b10b5cf7d490ed71c34ed13ceca48cd77168f932 /drivers/net/ethernet/intel | |
parent | a79f4f88261d7fd492121daf85beafff663f1f01 (diff) |
igb: Correct PTP support query from ethtool.
Update ethtool_get_ts_info to not report any supported functionality on
82575 and add support for V2 Sync and V2 Delay packets. In the case
where CONFIG_IGB_PTP is not defined, we should be reporting default
values.
v2: Correct the function to return EOPNOTSUPP when there is no PTP support
or the device does not support PTP. Also fix minor whitespace issue.
Signed-off-by: Matthew Vick <matthew.vick@intel.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel')
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_ethtool.c | 62 |
1 files changed, 38 insertions, 24 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index ffed4d068591..2ea012849825 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c | |||
@@ -2295,37 +2295,53 @@ static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data) | |||
2295 | } | 2295 | } |
2296 | } | 2296 | } |
2297 | 2297 | ||
2298 | #ifdef CONFIG_IGB_PTP | ||
2299 | static int igb_get_ts_info(struct net_device *dev, | 2298 | static int igb_get_ts_info(struct net_device *dev, |
2300 | struct ethtool_ts_info *info) | 2299 | struct ethtool_ts_info *info) |
2301 | { | 2300 | { |
2302 | struct igb_adapter *adapter = netdev_priv(dev); | 2301 | struct igb_adapter *adapter = netdev_priv(dev); |
2303 | 2302 | ||
2304 | info->so_timestamping = | 2303 | switch (adapter->hw.mac.type) { |
2305 | SOF_TIMESTAMPING_TX_HARDWARE | | 2304 | #ifdef CONFIG_IGB_PTP |
2306 | SOF_TIMESTAMPING_RX_HARDWARE | | 2305 | case e1000_82576: |
2307 | SOF_TIMESTAMPING_RAW_HARDWARE; | 2306 | case e1000_82580: |
2307 | case e1000_i350: | ||
2308 | case e1000_i210: | ||
2309 | case e1000_i211: | ||
2310 | info->so_timestamping = | ||
2311 | SOF_TIMESTAMPING_TX_HARDWARE | | ||
2312 | SOF_TIMESTAMPING_RX_HARDWARE | | ||
2313 | SOF_TIMESTAMPING_RAW_HARDWARE; | ||
2308 | 2314 | ||
2309 | if (adapter->ptp_clock) | 2315 | if (adapter->ptp_clock) |
2310 | info->phc_index = ptp_clock_index(adapter->ptp_clock); | 2316 | info->phc_index = ptp_clock_index(adapter->ptp_clock); |
2311 | else | 2317 | else |
2312 | info->phc_index = -1; | 2318 | info->phc_index = -1; |
2313 | 2319 | ||
2314 | info->tx_types = | 2320 | info->tx_types = |
2315 | (1 << HWTSTAMP_TX_OFF) | | 2321 | (1 << HWTSTAMP_TX_OFF) | |
2316 | (1 << HWTSTAMP_TX_ON); | 2322 | (1 << HWTSTAMP_TX_ON); |
2317 | 2323 | ||
2318 | info->rx_filters = | 2324 | info->rx_filters = 1 << HWTSTAMP_FILTER_NONE; |
2319 | (1 << HWTSTAMP_FILTER_NONE) | | ||
2320 | (1 << HWTSTAMP_FILTER_ALL) | | ||
2321 | (1 << HWTSTAMP_FILTER_SOME) | | ||
2322 | (1 << HWTSTAMP_FILTER_PTP_V1_L4_SYNC) | | ||
2323 | (1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) | | ||
2324 | (1 << HWTSTAMP_FILTER_PTP_V2_EVENT); | ||
2325 | 2325 | ||
2326 | return 0; | 2326 | /* 82576 does not support timestamping all packets. */ |
2327 | } | 2327 | if (adapter->hw.mac.type >= e1000_82580) |
2328 | info->rx_filters |= 1 << HWTSTAMP_FILTER_ALL; | ||
2329 | else | ||
2330 | info->rx_filters |= | ||
2331 | (1 << HWTSTAMP_FILTER_PTP_V1_L4_SYNC) | | ||
2332 | (1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) | | ||
2333 | (1 << HWTSTAMP_FILTER_PTP_V2_L2_SYNC) | | ||
2334 | (1 << HWTSTAMP_FILTER_PTP_V2_L4_SYNC) | | ||
2335 | (1 << HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ) | | ||
2336 | (1 << HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ) | | ||
2337 | (1 << HWTSTAMP_FILTER_PTP_V2_EVENT); | ||
2338 | |||
2339 | return 0; | ||
2328 | #endif /* CONFIG_IGB_PTP */ | 2340 | #endif /* CONFIG_IGB_PTP */ |
2341 | default: | ||
2342 | return -EOPNOTSUPP; | ||
2343 | } | ||
2344 | } | ||
2329 | 2345 | ||
2330 | static int igb_ethtool_begin(struct net_device *netdev) | 2346 | static int igb_ethtool_begin(struct net_device *netdev) |
2331 | { | 2347 | { |
@@ -2366,9 +2382,7 @@ static const struct ethtool_ops igb_ethtool_ops = { | |||
2366 | .get_ethtool_stats = igb_get_ethtool_stats, | 2382 | .get_ethtool_stats = igb_get_ethtool_stats, |
2367 | .get_coalesce = igb_get_coalesce, | 2383 | .get_coalesce = igb_get_coalesce, |
2368 | .set_coalesce = igb_set_coalesce, | 2384 | .set_coalesce = igb_set_coalesce, |
2369 | #ifdef CONFIG_IGB_PTP | ||
2370 | .get_ts_info = igb_get_ts_info, | 2385 | .get_ts_info = igb_get_ts_info, |
2371 | #endif /* CONFIG_IGB_PTP */ | ||
2372 | .begin = igb_ethtool_begin, | 2386 | .begin = igb_ethtool_begin, |
2373 | .complete = igb_ethtool_complete, | 2387 | .complete = igb_ethtool_complete, |
2374 | }; | 2388 | }; |