Thread (22 messages) 22 messages, 4 authors, 2014-01-07

[net-next 02/15] i40e: Fix SR-IOV VF port VLAN

flat view
STALE4667d SUPERSEDED: 1 (0M)

From: Jeff Kirsher <hidden>
Date: 2014-01-06 12:30:40
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 228 in this series; 1 review trailer.

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

This patch fixes two different problems.
1) The port VLAN configuration was not persistent across VF driver
   loads and unloads.

2) The port VLAN configuration was only correct the first time it was
   set. Switching the port VLAN on and off would cause subsequent VLAN
   configurations to be corrupted in the VSI.  Ensure that the correct
   bits are being set for the VSI port VLAN configuration.

Change-Id: I7ebf5329f77eb8d73ccd3324eb346b3abeea737d
Signed-off-by: Greg Rose <redacted>
Signed-off-by: Jesse Brandeburg <redacted>
Tested-by: Sibai Li <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c        |  8 +++++---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 16 ++++++++++++++--
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h |  1 +
 3 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 55fd23d..d0b2046 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -2016,8 +2016,9 @@ int i40e_vsi_add_pvid(struct i40e_vsi *vsi, u16 vid)
 
 	vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
 	vsi->info.pvid = cpu_to_le16(vid);
-	vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_INSERT_PVID;
-	vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_MODE_UNTAGGED;
+	vsi->info.port_vlan_flags = I40E_AQ_VSI_PVLAN_MODE_TAGGED |
+				    I40E_AQ_VSI_PVLAN_INSERT_PVID |
+				    I40E_AQ_VSI_PVLAN_EMOD_STR_BOTH;
 
 	ctxt.seid = vsi->seid;
 	memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
@@ -2040,8 +2041,9 @@ int i40e_vsi_add_pvid(struct i40e_vsi *vsi, u16 vid)
  **/
 void i40e_vsi_remove_pvid(struct i40e_vsi *vsi)
 {
+	i40e_vlan_stripping_disable(vsi);
+
 	vsi->info.pvid = 0;
-	i40e_vlan_rx_register(vsi->netdev, vsi->netdev->features);
 }
 
 /**
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 685b285..2c042a26 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -388,8 +388,16 @@ static int i40e_alloc_vsi_res(struct i40e_vf *vf, enum i40e_vsi_type type)
 		dev_info(&pf->pdev->dev,
 			 "LAN VSI index %d, VSI id %d\n",
 			 vsi->idx, vsi->id);
+		/* If the port VLAN has been configured and then the
+		 * VF driver was removed then the VSI port VLAN
+		 * configuration was destroyed.  Check if there is
+		 * a port VLAN and restore the VSI configuration if
+		 * needed.
+		 */
+		if (vf->port_vlan_id)
+			i40e_vsi_add_pvid(vsi, vf->port_vlan_id);
 		f = i40e_add_filter(vsi, vf->default_lan_addr.addr,
-				    0, true, false);
+				    vf->port_vlan_id, true, false);
 	}
 
 	if (!f) {
@@ -1958,7 +1966,7 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
 		ret = i40e_vsi_add_pvid(vsi,
 				vlan_id | (qos << I40E_VLAN_PRIORITY_SHIFT));
 	else
-		i40e_vlan_stripping_disable(vsi);
+		i40e_vsi_remove_pvid(vsi);
 
 	if (vlan_id) {
 		dev_info(&pf->pdev->dev, "Setting VLAN %d, QOS 0x%x on VF %d\n",
@@ -1978,6 +1986,10 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
 		dev_err(&pf->pdev->dev, "Unable to update VF vsi context\n");
 		goto error_pvid;
 	}
+	/* The Port VLAN needs to be saved across resets the same as the
+	 * default LAN MAC address.
+	 */
+	vf->port_vlan_id = le16_to_cpu(vsi->info.pvid);
 	ret = 0;
 
 error_pvid:
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
index d0b712c..bf3384f 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
@@ -82,6 +82,7 @@ struct i40e_vf {
 
 	struct i40e_virtchnl_ether_addr default_lan_addr;
 	struct i40e_virtchnl_ether_addr default_fcoe_addr;
+	u16 port_vlan_id;
 
 	/* VSI indices - actual VSI pointers are maintained in the PF structure
 	 * When assigned, these will be non-zero, because VSI 0 is always
-- 
1.8.3.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help