[v2] net/enic: reset the vxlan port during vNIC initialization

Message ID 20180731212613.27109-1-johndale@cisco.com (mailing list archive)
State Accepted, archived
Headers
Series [v2] net/enic: reset the vxlan port during vNIC initialization |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

John Daley (johndale) July 31, 2018, 9:26 p.m. UTC
  From: Hyong Youb Kim <hyonkim@cisco.com>

The NIC persists the vxlan port number across vNIC init/de-init
(e.g. restart testpmd). So, explicitly reset the setting to the
default value (4789) as part of the initialization.

Fixes: 8a4efd17410c ("net/enic: add handlers to add/delete vxlan port number")

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
---

v2: fix signoff

 drivers/net/enic/enic_main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
  

Comments

Thomas Monjalon Aug. 2, 2018, 8:30 a.m. UTC | #1
31/07/2018 23:26, John Daley:
> From: Hyong Youb Kim <hyonkim@cisco.com>
> 
> The NIC persists the vxlan port number across vNIC init/de-init
> (e.g. restart testpmd). So, explicitly reset the setting to the
> default value (4789) as part of the initialization.
> 
> Fixes: 8a4efd17410c ("net/enic: add handlers to add/delete vxlan port number")
> 
> Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
> Reviewed-by: John Daley <johndale@cisco.com>

Applied, thanks
  

Patch

diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index f04dc0878..03bde76b2 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -1664,6 +1664,16 @@  static int enic_dev_init(struct enic *enic)
 		enic->overlay_offload = true;
 		enic->vxlan_port = ENIC_DEFAULT_VXLAN_PORT;
 		dev_info(enic, "Overlay offload is enabled\n");
+		/*
+		 * Reset the vxlan port to the default, as the NIC firmware
+		 * does not reset it automatically and keeps the old setting.
+		 */
+		if (vnic_dev_overlay_offload_cfg(enic->vdev,
+						 OVERLAY_CFG_VXLAN_PORT_UPDATE,
+						 ENIC_DEFAULT_VXLAN_PORT)) {
+			dev_err(enic, "failed to update vxlan port\n");
+			return -EINVAL;
+		}
 	}
 
 	return 0;