[v3,48/60] common/sfc_efx/base: introduce UDP tunnel destruct operation
diff mbox series

Message ID 1600949555-28043-49-git-send-email-arybchenko@solarflare.com
State Accepted
Delegated to: Ferruh Yigit
Headers show
Series
  • common/sfc_efx: support Riverhead NIC family
Related show

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Andrew Rybchenko Sept. 24, 2020, 12:12 p.m. UTC
From: Igor Romanov <igor.romanov@oktetlabs.ru>

The procedures for destroying UDP tunnels are NIC family specific,
so they should be implemented separately for each of them.

Check for supported UDP encapsulation is removed from generic
operations since it is no longer used by the generic libefx API.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
 drivers/common/sfc_efx/base/efx_impl.h   |  2 +-
 drivers/common/sfc_efx/base/efx_tunnel.c | 39 +++++++++++++++---------
 2 files changed, 26 insertions(+), 15 deletions(-)

Patch
diff mbox series

diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h
index dfe5f1fecf..64156de884 100644
--- a/drivers/common/sfc_efx/base/efx_impl.h
+++ b/drivers/common/sfc_efx/base/efx_impl.h
@@ -303,8 +303,8 @@  efx_filter_reconfigure(
 
 #if EFSYS_OPT_TUNNEL
 typedef struct efx_tunnel_ops_s {
-	boolean_t	(*eto_udp_encap_supported)(efx_nic_t *);
 	efx_rc_t	(*eto_reconfigure)(efx_nic_t *);
+	void		(*eto_fini)(efx_nic_t *);
 } efx_tunnel_ops_t;
 #endif /* EFSYS_OPT_TUNNEL */
 
diff --git a/drivers/common/sfc_efx/base/efx_tunnel.c b/drivers/common/sfc_efx/base/efx_tunnel.c
index b1d1407bd2..5f2186c4c8 100644
--- a/drivers/common/sfc_efx/base/efx_tunnel.c
+++ b/drivers/common/sfc_efx/base/efx_tunnel.c
@@ -12,8 +12,8 @@ 
 
 #if EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_RIVERHEAD
 static const efx_tunnel_ops_t	__efx_tunnel_dummy_ops = {
-	NULL,	/* eto_udp_encap_supported */
 	NULL,	/* eto_reconfigure */
+	NULL,	/* eto_fini */
 };
 #endif /* EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_RIVERHEAD */
 
@@ -26,9 +26,13 @@  static	__checkReturn	efx_rc_t
 ef10_tunnel_reconfigure(
 	__in		efx_nic_t *enp);
 
+static			void
+ef10_tunnel_fini(
+	__in		efx_nic_t *enp);
+
 static const efx_tunnel_ops_t	__efx_tunnel_ef10_ops = {
-	ef10_udp_encap_supported,	/* eto_udp_encap_supported */
 	ef10_tunnel_reconfigure,	/* eto_reconfigure */
+	ef10_tunnel_fini,		/* eto_fini */
 };
 #endif /* EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
 
@@ -204,22 +208,12 @@  efx_tunnel_init(
 efx_tunnel_fini(
 	__in		efx_nic_t *enp)
 {
-	boolean_t resetting;
-
 	EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
 	EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
 	EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_TUNNEL);
 
-	if ((enp->en_etop->eto_udp_encap_supported != NULL) &&
-	    enp->en_etop->eto_udp_encap_supported(enp)) {
-		/*
-		 * The UNLOADING flag allows the MC to suppress the datapath
-		 * reset if it was set on the last call to
-		 * MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS by all functions
-		 */
-		(void) efx_mcdi_set_tunnel_encap_udp_ports(enp, NULL, B_TRUE,
-		    &resetting);
-	}
+	if (enp->en_etop->eto_fini != NULL)
+		enp->en_etop->eto_fini(enp);
 
 	enp->en_etop = NULL;
 	enp->en_mod_flags &= ~EFX_MOD_TUNNEL;
@@ -476,6 +470,23 @@  ef10_tunnel_reconfigure(
 
 	return (rc);
 }
+
+static			void
+ef10_tunnel_fini(
+	__in		efx_nic_t *enp)
+{
+	boolean_t resetting;
+
+	if (ef10_udp_encap_supported(enp) != B_FALSE) {
+		/*
+		 * The UNLOADING flag allows the MC to suppress the datapath
+		 * reset if it was set on the last call to
+		 * MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS by all functions
+		 */
+		(void) efx_mcdi_set_tunnel_encap_udp_ports(enp, NULL, B_TRUE,
+		    &resetting);
+	}
+}
 #endif /* EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
 
 #endif /* EFSYS_OPT_TUNNEL */