aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Sobczak <bartosz.sobczak@intel.com>2023-07-24 15:46:31 +0000
committerEric Joyner <erj@FreeBSD.org>2023-09-22 21:55:02 +0000
commit1002fd41e1b91d1acc8df9a2b06a4e163721e5e8 (patch)
tree80f7e86b2cd3b94202e0e71be597ea55d2ebe280
parentf5f2cc9ee688b0f6fc372f784ae8642de2e6ef7e (diff)
downloadsrc-1002fd41e1b91d1acc8df9a2b06a4e163721e5e8.tar.gz
src-1002fd41e1b91d1acc8df9a2b06a4e163721e5e8.zip
ice(4): Match irdma interface changes
(This is a direct commit to stable/13) Signed-off-by: Bartosz Sobczak <bartosz.sobczak@intel.com> Signed-off-by: Eric Joyner <erj@FreeBSD.org> Sponsored by: Intel Corporation
-rw-r--r--sys/dev/ice/ice_rdma.c59
-rw-r--r--sys/dev/ice/ice_rdma.h11
-rw-r--r--sys/dev/ice/ice_rdma_internal.h2
-rw-r--r--sys/dev/ice/if_ice_iflib.c15
-rw-r--r--sys/dev/irdma/icrdma.c4
5 files changed, 69 insertions, 22 deletions
diff --git a/sys/dev/ice/ice_rdma.c b/sys/dev/ice/ice_rdma.c
index 8443cab1e98e..411bfb41dcec 100644
--- a/sys/dev/ice/ice_rdma.c
+++ b/sys/dev/ice/ice_rdma.c
@@ -121,11 +121,10 @@ ice_rdma_pf_reset(struct ice_rdma_peer *peer)
{
struct ice_softc *sc = ice_rdma_peer_to_sc(peer);
- /*
- * Request that the driver re-initialize by bringing the interface
- * down and up.
- */
- ice_request_stack_reinit(sc);
+ /* Tell the base driver that RDMA is requesting a PFR */
+ ice_set_state(&sc->state, ICE_STATE_RESET_PFR_REQ);
+
+ /* XXX: Base driver will notify RDMA when it's done */
return (0);
}
@@ -331,6 +330,7 @@ ice_rdma_request_handler(struct ice_rdma_peer *peer,
switch(req->type) {
case ICE_RDMA_EVENT_RESET:
+ ice_rdma_pf_reset(peer);
break;
case ICE_RDMA_EVENT_QSET_REGISTER:
ice_rdma_qset_register_request(peer, &req->res);
@@ -865,3 +865,52 @@ ice_rdma_dcb_qos_update(struct ice_softc *sc, struct ice_port_info *pi)
IRDMA_EVENT_HANDLER(peer, &event);
sx_xunlock(&ice_rdma.mtx);
}
+
+/**
+ * ice_rdma_notify_pe_intr - notify irdma on incoming interrupts regarding PE
+ * @sc: the ice driver softc
+ * @oicr: interrupt cause
+ *
+ * Pass the information about received interrupt to RDMA driver if it was
+ * relating to PE. Specifically PE_CRITERR and HMC_ERR.
+ * The irdma driver shall decide what should be done upon these interrupts.
+ */
+void
+ice_rdma_notify_pe_intr(struct ice_softc *sc, uint32_t oicr)
+{
+ struct ice_rdma_peer *peer = &sc->rdma_entry.peer;
+ struct ice_rdma_event event;
+
+ memset(&event, 0, sizeof(struct ice_rdma_event));
+ event.type = ICE_RDMA_EVENT_CRIT_ERR;
+ event.oicr_reg = oicr;
+
+ sx_xlock(&ice_rdma.mtx);
+ if (sc->rdma_entry.attached && ice_rdma.registered)
+ IRDMA_EVENT_HANDLER(peer, &event);
+ sx_xunlock(&ice_rdma.mtx);
+}
+
+/**
+ * ice_rdma_notify_reset - notify irdma on incoming pf-reset
+ * @sc: the ice driver softc
+ *
+ * Inform irdma driver of an incoming PF reset.
+ * The irdma driver shall set its state to reset, and avoid using CQP
+ * anymore. Next step should be to call ice_rdma_pf_stop in order to
+ * remove resources.
+ */
+void
+ice_rdma_notify_reset(struct ice_softc *sc)
+{
+ struct ice_rdma_peer *peer = &sc->rdma_entry.peer;
+ struct ice_rdma_event event;
+
+ memset(&event, 0, sizeof(struct ice_rdma_event));
+ event.type = ICE_RDMA_EVENT_RESET;
+
+ sx_xlock(&ice_rdma.mtx);
+ if (sc->rdma_entry.attached && ice_rdma.registered)
+ IRDMA_EVENT_HANDLER(peer, &event);
+ sx_xunlock(&ice_rdma.mtx);
+}
diff --git a/sys/dev/ice/ice_rdma.h b/sys/dev/ice/ice_rdma.h
index f83c30b33f6c..38e2ef491e8e 100644
--- a/sys/dev/ice/ice_rdma.h
+++ b/sys/dev/ice/ice_rdma.h
@@ -64,7 +64,7 @@
* considered stable.
*/
#define ICE_RDMA_MAJOR_VERSION 1
-#define ICE_RDMA_MINOR_VERSION 0
+#define ICE_RDMA_MINOR_VERSION 1
#define ICE_RDMA_PATCH_VERSION 0
/**
@@ -273,18 +273,19 @@ struct ice_rdma_event {
uint64_t baudrate;
};
/* MTU change event */
- struct {
- int mtu;
- };
+ int mtu;
/*
* TC/QoS/DCB change event
- * RESET event use prep variable only
* prep: if true, this is a pre-event, post-event otherwise
*/
struct {
struct ice_qos_params port_qos;
bool prep;
};
+ /*
+ * CRIT_ERR event
+ */
+ uint32_t oicr_reg;
};
};
diff --git a/sys/dev/ice/ice_rdma_internal.h b/sys/dev/ice/ice_rdma_internal.h
index c80d4540194a..b36544609f45 100644
--- a/sys/dev/ice/ice_rdma_internal.h
+++ b/sys/dev/ice/ice_rdma_internal.h
@@ -98,4 +98,6 @@ int ice_rdma_pf_stop(struct ice_softc *sc);
void ice_rdma_link_change(struct ice_softc *sc, int linkstate, uint64_t baudrate);
void ice_rdma_notify_dcb_qos_change(struct ice_softc *sc);
void ice_rdma_dcb_qos_update(struct ice_softc *sc, struct ice_port_info *pi);
+void ice_rdma_notify_pe_intr(struct ice_softc *sc, uint32_t oicr);
+void ice_rdma_notify_reset(struct ice_softc *sc);
#endif
diff --git a/sys/dev/ice/if_ice_iflib.c b/sys/dev/ice/if_ice_iflib.c
index be1aa86234c7..d8542e383564 100644
--- a/sys/dev/ice/if_ice_iflib.c
+++ b/sys/dev/ice/if_ice_iflib.c
@@ -1287,9 +1287,11 @@ ice_msix_admin(void *arg)
ice_set_state(&sc->state, ICE_STATE_RESET_PFR_REQ);
}
- if (oicr & PFINT_OICR_PE_CRITERR_M) {
- device_printf(dev, "Critical Protocol Engine Error detected!\n");
- ice_set_state(&sc->state, ICE_STATE_RESET_PFR_REQ);
+ if (oicr & (PFINT_OICR_PE_CRITERR_M | PFINT_OICR_HMC_ERR_M)) {
+ if (oicr & PFINT_OICR_HMC_ERR_M)
+ /* Log the HMC errors */
+ ice_log_hmc_error(hw, dev);
+ ice_rdma_notify_pe_intr(sc, oicr);
}
if (oicr & PFINT_OICR_PCI_EXCEPTION_M) {
@@ -1297,11 +1299,6 @@ ice_msix_admin(void *arg)
ice_set_state(&sc->state, ICE_STATE_RESET_PFR_REQ);
}
- if (oicr & PFINT_OICR_HMC_ERR_M) {
- /* Log the HMC errors, but don't disable the interrupt cause */
- ice_log_hmc_error(hw, dev);
- }
-
return (FILTER_SCHEDULE_THREAD);
}
@@ -2307,6 +2304,8 @@ ice_prepare_for_reset(struct ice_softc *sc)
if (ice_test_state(&sc->state, ICE_STATE_RECOVERY_MODE))
return;
+ /* inform the RDMA client */
+ ice_rdma_notify_reset(sc);
/* stop the RDMA client */
ice_rdma_pf_stop(sc);
diff --git a/sys/dev/irdma/icrdma.c b/sys/dev/irdma/icrdma.c
index 848f8126e57c..8efd9d5c6034 100644
--- a/sys/dev/irdma/icrdma.c
+++ b/sys/dev/irdma/icrdma.c
@@ -350,7 +350,6 @@ irdma_event_handler(struct ice_rdma_peer *peer, struct ice_rdma_event *event)
atomic_dec(&iwdev->rf->dev_ctx.event_rfcnt);
break;
case ICE_RDMA_EVENT_CRIT_ERR:
-#ifdef EVNT_HNDLR_CRITERR
if (event->oicr_reg & IRDMAPFINT_OICR_PE_CRITERR_M) {
u32 pe_criterr;
@@ -371,9 +370,6 @@ irdma_event_handler(struct ice_rdma_peer *peer, struct ice_rdma_event *event)
}
if (iwdev->rf->reset)
iwdev->rf->gen_ops.request_reset(iwdev->rf);
-#else
- printf("%s:%d event type received: %d\n", __func__, __LINE__, event->type);
-#endif
break;
case ICE_RDMA_EVENT_RESET:
iwdev->rf->reset = true;