Thread (8 messages) 8 messages, 2 authors, 2012-09-17

[net-next 3/6] igb: Correct PTP support query from ethtool.

flat view
STALE5145d SUPERSEDED: 1 (0M)

From: Jeff Kirsher <hidden>
Date: 2012-09-17 09:21:52
Subsystem: intel ethernet drivers, networking drivers, the rest · Maintainers: Tony Nguyen, Przemek Kitszel, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

Revision v1 of 220 in this series; 1 review trailer.

Revisions (220)
  1. v1
  2. v1
  3. v1
  4. v2 [diff vs current]
  5. v1
  6. v1
  7. v1
  8. v2 [diff vs current]
  9. v1
  10. v1
  11. v1
  12. v1
  13. v1
  14. v1
  15. v1
  16. v1
  17. v1
  18. v1
  19. v2 [diff vs current]
  20. v1
  21. v3 [diff vs current]
  22. v1
  23. v1
  24. v1
  25. v2 [diff vs current]
  26. v2 [diff vs current]
  27. v1
  28. v2 [diff vs current]
  29. v1
  30. v2 [diff vs current]
  31. v3 [diff vs current]
  32. v1
  33. v1
  34. v1
  35. v2 [diff vs current]
  36. v1
  37. v1
  38. v1
  39. v2 [diff vs current]
  40. v1
  41. v1
  42. v1
  43. v1
  44. v1
  45. v2 [diff vs current]
  46. v1
  47. v2 [diff vs current]
  48. v1
  49. v1
  50. v1
  51. v1
  52. v1
  53. v1
  54. v1
  55. v1
  56. v1
  57. v1
  58. v1
  59. v1
  60. v1
  61. v1
  62. v1
  63. v1
  64. v1
  65. v1
  66. v2 [diff vs current]
  67. v1
  68. v2 [diff vs current]
  69. v1
  70. v2 [diff vs current]
  71. v1
  72. v1
  73. v1
  74. v2 [diff vs current]
  75. v1
  76. v1
  77. v1
  78. v1
  79. v1
  80. v1
  81. v1
  82. v1
  83. v1
  84. v1
  85. v1
  86. v1
  87. v1
  88. v1
  89. v1
  90. v1
  91. v1
  92. v1
  93. v1
  94. v1 current
  95. v1
  96. v2 [diff vs current]
  97. v1
  98. v1
  99. v1
  100. v1
  101. v1
  102. v1
  103. v1
  104. v1
  105. v1
  106. v2 [diff vs current]
  107. v1
  108. v1
  109. v1
  110. v1
  111. v1
  112. v2 [diff vs current]
  113. v1
  114. v1
  115. v1
  116. v1
  117. v2 [diff vs current]
  118. v1
  119. v2 [diff vs current]
  120. v1
  121. v1
  122. v1
  123. v1
  124. v1
  125. v1
  126. v1
  127. v1
  128. v1
  129. v1
  130. v1
  131. v1
  132. v2 [diff vs current]
  133. v1
  134. v1
  135. v2 [diff vs current]
  136. v1
  137. v1
  138. v1
  139. v1
  140. v1
  141. v1
  142. v2 [diff vs current]
  143. v1
  144. v2 [diff vs current]
  145. v2 [diff vs current]
  146. v1
  147. v2 [diff vs current]
  148. v3 [diff vs current]
  149. v1
  150. v4 [diff vs current]
  151. v1
  152. v5 [diff vs current]
  153. v6 [diff vs current]
  154. v7 [diff vs current]
  155. v1
  156. v1
  157. v2 [diff vs current]
  158. v1
  159. v1
  160. v1
  161. v2 [diff vs current]
  162. v1
  163. v1
  164. v1
  165. v1
  166. v1
  167. v2 [diff vs current]
  168. v1
  169. v1
  170. v1
  171. v1
  172. v2 [diff vs current]
  173. v1
  174. v1
  175. v1
  176. v2 [diff vs current]
  177. v3 [diff vs current]
  178. v4 [diff vs current]
  179. v1
  180. v1
  181. v2 [diff vs current]
  182. v5 [diff vs current]
  183. v1
  184. v1
  185. v1
  186. v2 [diff vs current]
  187. v1
  188. v1
  189. v2 [diff vs current]
  190. v3 [diff vs current]
  191. v1
  192. v2 [diff vs current]
  193. v1
  194. v1
  195. v2 [diff vs current]
  196. v1
  197. v2 [diff vs current]
  198. v1
  199. v2 [diff vs current]
  200. v3 [diff vs current]
  201. v1
  202. v1
  203. v1
  204. v2 [diff vs current]
  205. v1
  206. v1
  207. v1
  208. v1
  209. v1
  210. v1
  211. v2 [diff vs current]
  212. v1
  213. v1
  214. v1
  215. v1
  216. v2 [diff vs current]
  217. v1
  218. v1
  219. v1
  220. v2 [diff vs current]
From: Matthew Vick <redacted>

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 <redacted>
Cc: Richard Cochran <richardcochran@gmail.com>
Tested-by: Jeff Pieper <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
 drivers/net/ethernet/intel/igb/igb_ethtool.c | 62 +++++++++++++++++-----------
 1 file 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 ffed4d0..2ea0128 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)
 	}
 }
 
-#ifdef CONFIG_IGB_PTP
 static int igb_get_ts_info(struct net_device *dev,
-				   struct ethtool_ts_info *info)
+			   struct ethtool_ts_info *info)
 {
 	struct igb_adapter *adapter = netdev_priv(dev);
 
-	info->so_timestamping =
-		SOF_TIMESTAMPING_TX_HARDWARE |
-		SOF_TIMESTAMPING_RX_HARDWARE |
-		SOF_TIMESTAMPING_RAW_HARDWARE;
+	switch (adapter->hw.mac.type) {
+#ifdef CONFIG_IGB_PTP
+	case e1000_82576:
+	case e1000_82580:
+	case e1000_i350:
+	case e1000_i210:
+	case e1000_i211:
+		info->so_timestamping =
+			SOF_TIMESTAMPING_TX_HARDWARE |
+			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;
+		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);
+		info->tx_types =
+			(1 << HWTSTAMP_TX_OFF) |
+			(1 << HWTSTAMP_TX_ON);
 
-	info->rx_filters =
-		(1 << HWTSTAMP_FILTER_NONE) |
-		(1 << HWTSTAMP_FILTER_ALL) |
-		(1 << HWTSTAMP_FILTER_SOME) |
-		(1 << HWTSTAMP_FILTER_PTP_V1_L4_SYNC) |
-		(1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) |
-		(1 << HWTSTAMP_FILTER_PTP_V2_EVENT);
+		info->rx_filters = 1 << HWTSTAMP_FILTER_NONE;
 
-	return 0;
-}
+		/* 82576 does not support timestamping all packets. */
+		if (adapter->hw.mac.type >= e1000_82580)
+			info->rx_filters |= 1 << HWTSTAMP_FILTER_ALL;
+		else
+			info->rx_filters |=
+				(1 << HWTSTAMP_FILTER_PTP_V1_L4_SYNC) |
+				(1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) |
+				(1 << HWTSTAMP_FILTER_PTP_V2_L2_SYNC) |
+				(1 << HWTSTAMP_FILTER_PTP_V2_L4_SYNC) |
+				(1 << HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ) |
+				(1 << HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ) |
+				(1 << HWTSTAMP_FILTER_PTP_V2_EVENT);
+
+		return 0;
 #endif /* CONFIG_IGB_PTP */
+	default:
+		return -EOPNOTSUPP;
+	}
+}
 
 static int igb_ethtool_begin(struct net_device *netdev)
 {
@@ -2366,9 +2382,7 @@ static const struct ethtool_ops igb_ethtool_ops = {
 	.get_ethtool_stats      = igb_get_ethtool_stats,
 	.get_coalesce           = igb_get_coalesce,
 	.set_coalesce           = igb_set_coalesce,
-#ifdef CONFIG_IGB_PTP
 	.get_ts_info            = igb_get_ts_info,
-#endif /* CONFIG_IGB_PTP */
 	.begin			= igb_ethtool_begin,
 	.complete		= igb_ethtool_complete,
 };
-- 
1.7.11.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help