Thread (9 messages) 9 messages, 2 authors, 2012-07-17

[net-next 6/7] ixgbe: Add function for obtaining FCoE TC based on FCoE user priority

flat view
STALE5209d SUPERSEDED: 2 (0M)

From: Jeff Kirsher <hidden>
Date: 2012-07-14 23:07:48
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 186 in this series; 2 review trailers.

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

In upcoming patches it will become increasingly common to need to determine
the FCoE traffic class in order to determine the correct queues for FCoE.
In order to make this easier I am adding a function for obtaining the FCoE
traffic class based on the user priority.

Cc: John Fastabend <redacted>
Signed-off-by: Alexander Duyck <redacted>
Tested-by: Phil Schmitt <redacted>
Tested-by: Ross Brattain <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe.h      |    1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c |   15 +++++++++++++++
 drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c  |    7 ++-----
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   14 ++++----------
 4 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 2ffdc8f..5a75a9c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -707,6 +707,7 @@ extern u8 ixgbe_fcoe_setapp(struct ixgbe_adapter *adapter, u8 up);
 extern int ixgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type);
 extern int ixgbe_fcoe_get_hbainfo(struct net_device *netdev,
 				  struct netdev_fcoe_hbainfo *info);
+extern u8 ixgbe_fcoe_get_tc(struct ixgbe_adapter *adapter);
 #endif /* IXGBE_FCOE */
 
 static inline struct netdev_queue *txring_txq(const struct ixgbe_ring *ring)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
index 0922ece..cc28c44 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
@@ -960,3 +960,18 @@ int ixgbe_fcoe_get_hbainfo(struct net_device *netdev,
 
 	return 0;
 }
+
+/**
+ * ixgbe_fcoe_get_tc - get the current TC that fcoe is mapped to
+ * @adapter - pointer to the device adapter structure
+ *
+ * Return : TC that FCoE is mapped to
+ */
+u8 ixgbe_fcoe_get_tc(struct ixgbe_adapter *adapter)
+{
+#ifdef CONFIG_IXGBE_DCB
+	return netdev_get_prio_tc_map(adapter->netdev, adapter->fcoe.up);
+#else
+	return 0;
+#endif
+}
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index 83eadd0..c0ff31e 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -49,8 +49,8 @@ static inline bool ixgbe_cache_ring_rss(struct ixgbe_adapter *adapter)
 
 	return true;
 }
-#ifdef CONFIG_IXGBE_DCB
 
+#ifdef CONFIG_IXGBE_DCB
 /* ixgbe_get_first_reg_idx - Return first register index associated with ring */
 static void ixgbe_get_first_reg_idx(struct ixgbe_adapter *adapter, u8 tc,
 				    unsigned int *tx, unsigned int *rx)
@@ -343,13 +343,10 @@ static inline bool ixgbe_set_dcb_queues(struct ixgbe_adapter *adapter)
 	 * configuration later.
 	 */
 	if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) {
-		u8 prio_tc[MAX_USER_PRIORITY] = {0};
-		int tc;
+		u8 tc = ixgbe_fcoe_get_tc(adapter);
 		struct ixgbe_ring_feature *f =
 					&adapter->ring_feature[RING_F_FCOE];
 
-		ixgbe_dcb_unpack_map(&adapter->dcb_cfg, DCB_TX_CONFIG, prio_tc);
-		tc = prio_tc[adapter->fcoe.up];
 		f->indices = dev->tc_to_txq[tc].count;
 		f->offset = dev->tc_to_txq[tc].offset;
 	}
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 91bc60f..3d7ce7e 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -3646,18 +3646,12 @@ static int ixgbe_hpbthresh(struct ixgbe_adapter *adapter, int pb)
 
 #ifdef IXGBE_FCOE
 	/* FCoE traffic class uses FCOE jumbo frames */
-	if (dev->features & NETIF_F_FCOE_MTU) {
-		int fcoe_pb = 0;
-
-#ifdef CONFIG_IXGBE_DCB
-		fcoe_pb = netdev_get_prio_tc_map(dev, adapter->fcoe.up);
+	if ((dev->features & NETIF_F_FCOE_MTU) &&
+	    (tc < IXGBE_FCOE_JUMBO_FRAME_SIZE) &&
+	    (pb == ixgbe_fcoe_get_tc(adapter)))
+		tc = IXGBE_FCOE_JUMBO_FRAME_SIZE;
 
 #endif
-		if (fcoe_pb == pb && tc < IXGBE_FCOE_JUMBO_FRAME_SIZE)
-			tc = IXGBE_FCOE_JUMBO_FRAME_SIZE;
-	}
-#endif
-
 	/* Calculate delay value for device */
 	switch (hw->mac.type) {
 	case ixgbe_mac_X540:
-- 
1.7.10.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