aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Joyner <erj@FreeBSD.org>2020-05-11 17:42:04 +0000
committerEric Joyner <erj@FreeBSD.org>2020-05-11 17:42:04 +0000
commitcf1509179cd14a34ef5fa7492f62b1082cfae2b2 (patch)
tree3b1c3af4eeb8e0e547e442b195a964fa7b9e10a7
parente51e957e17799feae80e11da5620af1a338171e2 (diff)
downloadsrc-cf1509179cd14a34ef5fa7492f62b1082cfae2b2.tar.gz
src-cf1509179cd14a34ef5fa7492f62b1082cfae2b2.zip
em/ix/ixv/ixl/iavf: Implement ifdi_needs_restart iflib method
Pursuant to r360398, implement driver-specific versions of the ifdi_needs_restart iflib device method. Some (if not most?) Intel network cards don't need reinitializing when a VLAN is added or removed from the device hardware, so these implement ifdi_needs_restart in a way that tell iflib not to bring the interface up or down when a VLAN is added or removed, regardless of whether the VLAN_HWFILTER interface capability flag is set or not. This could potentially solve several PRs relating to link flaps that occur when VLANs are added/removed to devices. Signed-off-by: Eric Joyner <erj@freebsd.org> PR: 240818, 241785 Reviewed by: gallatin@, olivier@ MFC after: 3 days MFC with: r360398 Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D24659
Notes
Notes: svn path=/head/; revision=360902
-rw-r--r--sys/dev/e1000/if_em.c22
-rw-r--r--sys/dev/ixgbe/if_ix.c21
-rw-r--r--sys/dev/ixgbe/if_ixv.c21
-rw-r--r--sys/dev/ixl/if_iavf.c24
-rw-r--r--sys/dev/ixl/if_ixl.c20
5 files changed, 107 insertions, 1 deletions
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index 4d33820a701e..b4c1ed31ffc2 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -251,6 +251,7 @@ static void em_if_timer(if_ctx_t ctx, uint16_t qid);
static void em_if_vlan_register(if_ctx_t ctx, u16 vtag);
static void em_if_vlan_unregister(if_ctx_t ctx, u16 vtag);
static void em_if_watchdog_reset(if_ctx_t ctx);
+static bool em_if_needs_restart(if_ctx_t ctx, enum iflib_restart_event event);
static void em_identify_hardware(if_ctx_t ctx);
static int em_allocate_pci_resources(if_ctx_t ctx);
@@ -400,6 +401,7 @@ static device_method_t em_if_methods[] = {
DEVMETHOD(ifdi_rx_queue_intr_enable, em_if_rx_queue_intr_enable),
DEVMETHOD(ifdi_tx_queue_intr_enable, em_if_tx_queue_intr_enable),
DEVMETHOD(ifdi_debug, em_if_debug),
+ DEVMETHOD(ifdi_needs_restart, em_if_needs_restart),
DEVMETHOD_END
};
@@ -437,6 +439,7 @@ static device_method_t igb_if_methods[] = {
DEVMETHOD(ifdi_rx_queue_intr_enable, igb_if_rx_queue_intr_enable),
DEVMETHOD(ifdi_tx_queue_intr_enable, igb_if_tx_queue_intr_enable),
DEVMETHOD(ifdi_debug, em_if_debug),
+ DEVMETHOD(ifdi_needs_restart, em_if_needs_restart),
DEVMETHOD_END
};
@@ -4038,6 +4041,25 @@ em_if_get_counter(if_ctx_t ctx, ift_counter cnt)
}
}
+/* em_if_needs_restart - Tell iflib when the driver needs to be reinitialized
+ * @ctx: iflib context
+ * @event: event code to check
+ *
+ * Defaults to returning true for unknown events.
+ *
+ * @returns true if iflib needs to reinit the interface
+ */
+static bool
+em_if_needs_restart(if_ctx_t ctx __unused, enum iflib_restart_event event)
+{
+ switch (event) {
+ case IFLIB_RESTART_VLAN_CONFIG:
+ return (false);
+ default:
+ return (true);
+ }
+}
+
/* Export a single 32-bit register via a read-only sysctl. */
static int
em_sysctl_reg_handler(SYSCTL_HANDLER_ARGS)
diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c
index 45c972990f11..783c50d5a3cc 100644
--- a/sys/dev/ixgbe/if_ix.c
+++ b/sys/dev/ixgbe/if_ix.c
@@ -139,6 +139,7 @@ static void ixgbe_if_update_admin_status(if_ctx_t ctx);
static void ixgbe_if_vlan_register(if_ctx_t ctx, u16 vtag);
static void ixgbe_if_vlan_unregister(if_ctx_t ctx, u16 vtag);
static int ixgbe_if_i2c_req(if_ctx_t ctx, struct ifi2creq *req);
+static bool ixgbe_if_needs_restart(if_ctx_t ctx, enum iflib_restart_event event);
int ixgbe_intr(void *arg);
/************************************************************************
@@ -273,6 +274,7 @@ static device_method_t ixgbe_if_methods[] = {
DEVMETHOD(ifdi_vlan_unregister, ixgbe_if_vlan_unregister),
DEVMETHOD(ifdi_get_counter, ixgbe_if_get_counter),
DEVMETHOD(ifdi_i2c_req, ixgbe_if_i2c_req),
+ DEVMETHOD(ifdi_needs_restart, ixgbe_if_needs_restart),
#ifdef PCI_IOV
DEVMETHOD(ifdi_iov_init, ixgbe_if_iov_init),
DEVMETHOD(ifdi_iov_uninit, ixgbe_if_iov_uninit),
@@ -1235,6 +1237,25 @@ ixgbe_if_i2c_req(if_ctx_t ctx, struct ifi2creq *req)
return (0);
} /* ixgbe_if_i2c_req */
+/* ixgbe_if_needs_restart - Tell iflib when the driver needs to be reinitialized
+ * @ctx: iflib context
+ * @event: event code to check
+ *
+ * Defaults to returning true for unknown events.
+ *
+ * @returns true if iflib needs to reinit the interface
+ */
+static bool
+ixgbe_if_needs_restart(if_ctx_t ctx __unused, enum iflib_restart_event event)
+{
+ switch (event) {
+ case IFLIB_RESTART_VLAN_CONFIG:
+ return (false);
+ default:
+ return (true);
+ }
+}
+
/************************************************************************
* ixgbe_add_media_types
************************************************************************/
diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c
index 1345268ded55..7b8c7f169a7e 100644
--- a/sys/dev/ixgbe/if_ixv.c
+++ b/sys/dev/ixgbe/if_ixv.c
@@ -110,6 +110,7 @@ static void ixv_if_register_vlan(if_ctx_t, u16);
static void ixv_if_unregister_vlan(if_ctx_t, u16);
static uint64_t ixv_if_get_counter(if_ctx_t, ift_counter);
+static bool ixv_if_needs_restart(if_ctx_t, enum iflib_restart_event);
static void ixv_save_stats(struct adapter *);
static void ixv_init_stats(struct adapter *);
@@ -172,6 +173,7 @@ static device_method_t ixv_if_methods[] = {
DEVMETHOD(ifdi_vlan_register, ixv_if_register_vlan),
DEVMETHOD(ifdi_vlan_unregister, ixv_if_unregister_vlan),
DEVMETHOD(ifdi_get_counter, ixv_if_get_counter),
+ DEVMETHOD(ifdi_needs_restart, ixv_if_needs_restart),
DEVMETHOD_END
};
@@ -1187,6 +1189,25 @@ ixv_if_get_counter(if_ctx_t ctx, ift_counter cnt)
}
} /* ixv_if_get_counter */
+/* ixv_if_needs_restart - Tell iflib when the driver needs to be reinitialized
+ * @ctx: iflib context
+ * @event: event code to check
+ *
+ * Defaults to returning true for every event.
+ *
+ * @returns true if iflib needs to reinit the interface
+ */
+static bool
+ixv_if_needs_restart(if_ctx_t ctx __unused, enum iflib_restart_event event)
+{
+ switch (event) {
+ case IFLIB_RESTART_VLAN_CONFIG:
+ /* XXX: This may not need to return true */
+ default:
+ return (true);
+ }
+}
+
/************************************************************************
* ixv_initialize_transmit_units - Enable transmit unit.
************************************************************************/
diff --git a/sys/dev/ixl/if_iavf.c b/sys/dev/ixl/if_iavf.c
index 1b57bd8fe279..ce79f2e6a234 100644
--- a/sys/dev/ixl/if_iavf.c
+++ b/sys/dev/ixl/if_iavf.c
@@ -92,6 +92,7 @@ static void iavf_if_vlan_register(if_ctx_t ctx, u16 vtag);
static void iavf_if_vlan_unregister(if_ctx_t ctx, u16 vtag);
static uint64_t iavf_if_get_counter(if_ctx_t ctx, ift_counter cnt);
static void iavf_if_stop(if_ctx_t ctx);
+static bool iavf_if_needs_restart(if_ctx_t ctx, enum iflib_restart_event event);
static int iavf_allocate_pci_resources(struct iavf_sc *);
static int iavf_reset_complete(struct i40e_hw *);
@@ -190,6 +191,7 @@ static device_method_t iavf_if_methods[] = {
DEVMETHOD(ifdi_vlan_register, iavf_if_vlan_register),
DEVMETHOD(ifdi_vlan_unregister, iavf_if_vlan_unregister),
DEVMETHOD(ifdi_get_counter, iavf_if_get_counter),
+ DEVMETHOD(ifdi_needs_restart, iavf_if_needs_restart),
DEVMETHOD_END
};
@@ -1467,7 +1469,27 @@ iavf_if_get_counter(if_ctx_t ctx, ift_counter cnt)
}
}
-
+/* iavf_if_needs_restart - Tell iflib when the driver needs to be reinitialized
+ * @ctx: iflib context
+ * @event: event code to check
+ *
+ * Defaults to returning true for every event.
+ *
+ * @returns true if iflib needs to reinit the interface
+ */
+static bool
+iavf_if_needs_restart(if_ctx_t ctx __unused, enum iflib_restart_event event)
+{
+ switch (event) {
+ case IFLIB_RESTART_VLAN_CONFIG:
+ /* This case must return true if VLAN anti-spoof checks are
+ * enabled by the PF driver for the VF.
+ */
+ default:
+ return (true);
+ }
+}
+
static void
iavf_free_pci_resources(struct iavf_sc *sc)
{
diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c
index e6adade93498..27e9d9908455 100644
--- a/sys/dev/ixl/if_ixl.c
+++ b/sys/dev/ixl/if_ixl.c
@@ -117,6 +117,7 @@ static void ixl_if_vlan_unregister(if_ctx_t ctx, u16 vtag);
static uint64_t ixl_if_get_counter(if_ctx_t ctx, ift_counter cnt);
static int ixl_if_i2c_req(if_ctx_t ctx, struct ifi2creq *req);
static int ixl_if_priv_ioctl(if_ctx_t ctx, u_long command, caddr_t data);
+static bool ixl_if_needs_restart(if_ctx_t ctx, enum iflib_restart_event event);
#ifdef PCI_IOV
static void ixl_if_vflr_handle(if_ctx_t ctx);
#endif
@@ -187,6 +188,7 @@ static device_method_t ixl_if_methods[] = {
DEVMETHOD(ifdi_get_counter, ixl_if_get_counter),
DEVMETHOD(ifdi_i2c_req, ixl_if_i2c_req),
DEVMETHOD(ifdi_priv_ioctl, ixl_if_priv_ioctl),
+ DEVMETHOD(ifdi_needs_restart, ixl_if_needs_restart),
#ifdef PCI_IOV
DEVMETHOD(ifdi_iov_init, ixl_if_iov_init),
DEVMETHOD(ifdi_iov_uninit, ixl_if_iov_uninit),
@@ -1652,6 +1654,24 @@ ixl_if_priv_ioctl(if_ctx_t ctx, u_long command, caddr_t data)
return (error);
}
+/* ixl_if_needs_restart - Tell iflib when the driver needs to be reinitialized
+ * @ctx: iflib context
+ * @event: event code to check
+ *
+ * Defaults to returning false for every event.
+ *
+ * @returns true if iflib needs to reinit the interface, false otherwise
+ */
+static bool
+ixl_if_needs_restart(if_ctx_t ctx __unused, enum iflib_restart_event event)
+{
+ switch (event) {
+ case IFLIB_RESTART_VLAN_CONFIG:
+ default:
+ return (false);
+ }
+}
+
static u_int
ixl_mc_filter_apply(void *arg, struct sockaddr_dl *sdl, u_int count __unused)
{