From: Pavan Nikhilesh <pbhagavat...@marvell.com> Flush currently held flow context on event port cleanup.
Signed-off-by: Pavan Nikhilesh <pbhagavat...@marvell.com> --- drivers/event/cnxk/cn10k_eventdev.c | 18 ++++++++++++++---- drivers/event/cnxk/cn9k_eventdev.c | 25 +++++++++++++++++++------ 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/drivers/event/cnxk/cn10k_eventdev.c b/drivers/event/cnxk/cn10k_eventdev.c index 499a3aace7..211c51fd12 100644 --- a/drivers/event/cnxk/cn10k_eventdev.c +++ b/drivers/event/cnxk/cn10k_eventdev.c @@ -200,12 +200,14 @@ cn10k_sso_hws_reset(void *arg, void *hws) cnxk_sso_hws_swtag_untag(base + SSOW_LF_GWS_OP_SWTAG_UNTAG); plt_write64(0, base + SSOW_LF_GWS_OP_DESCHED); + } else if (pend_tt != SSO_TT_EMPTY) { + plt_write64(0, base + SSOW_LF_GWS_OP_SWTAG_FLUSH); } /* Wait for desched to complete. */ do { pend_state = plt_read64(base + SSOW_LF_GWS_PENDSTATE); - } while (pend_state & BIT_ULL(58)); + } while (pend_state & (BIT_ULL(58) | BIT_ULL(56))); switch (dev->gw_mode) { case CN10K_GW_MODE_PREF: @@ -582,11 +584,16 @@ cn10k_sso_port_quiesce(struct rte_eventdev *event_dev, void *port, cn10k_sso_hws_get_work_empty(ws, &ev, (NIX_RX_OFFLOAD_MAX - 1) | NIX_RX_REAS_F | NIX_RX_MULTI_SEG_F); - if (is_pend && ev.u64) { + if (is_pend && ev.u64) if (flush_cb) flush_cb(event_dev->data->dev_id, ev, args); + ptag = (plt_read64(ws->base + SSOW_LF_GWS_TAG) >> 32) & SSO_TT_EMPTY; + if (ptag != SSO_TT_EMPTY) cnxk_sso_hws_swtag_flush(ws->base); - } + + do { + ptag = plt_read64(ws->base + SSOW_LF_GWS_PENDSTATE); + } while (ptag & BIT_ULL(56)); /* Check if we have work in PRF_WQE0, if so extract it. */ switch (dev->gw_mode) { @@ -610,8 +617,11 @@ cn10k_sso_port_quiesce(struct rte_eventdev *event_dev, void *port, if (ev.u64) { if (flush_cb) flush_cb(event_dev->data->dev_id, ev, args); - cnxk_sso_hws_swtag_flush(ws->base); } + cnxk_sso_hws_swtag_flush(ws->base); + do { + ptag = plt_read64(ws->base + SSOW_LF_GWS_PENDSTATE); + } while (ptag & BIT_ULL(56)); } ws->swtag_req = 0; plt_write64(0, ws->base + SSOW_LF_GWS_OP_GWC_INVAL); diff --git a/drivers/event/cnxk/cn9k_eventdev.c b/drivers/event/cnxk/cn9k_eventdev.c index 6cce5477f0..a03e3c138b 100644 --- a/drivers/event/cnxk/cn9k_eventdev.c +++ b/drivers/event/cnxk/cn9k_eventdev.c @@ -222,16 +222,16 @@ cn9k_sso_hws_reset(void *arg, void *hws) cnxk_sso_hws_swtag_untag( base + SSOW_LF_GWS_OP_SWTAG_UNTAG); plt_write64(0, base + SSOW_LF_GWS_OP_DESCHED); + } else if (pend_tt != SSO_TT_EMPTY) { + plt_write64(0, base + SSOW_LF_GWS_OP_SWTAG_FLUSH); } /* Wait for desched to complete. */ do { pend_state = plt_read64(base + SSOW_LF_GWS_PENDSTATE); - } while (pend_state & BIT_ULL(58)); - + } while (pend_state & (BIT_ULL(58) | BIT_ULL(56))); plt_write64(0, base + SSOW_LF_GWS_OP_GWC_INVAL); } - if (dev->dual_ws) dws->swtag_req = 0; else @@ -686,12 +686,25 @@ cn9k_sso_port_quiesce(struct rte_eventdev *event_dev, void *port, base, &ev, dev->rx_offloads, dev->dual_ws ? dws->lookup_mem : ws->lookup_mem, dev->dual_ws ? dws->tstamp : ws->tstamp); - if (is_pend && ev.u64) { + if (is_pend && ev.u64) if (flush_cb) flush_cb(event_dev->data->dev_id, ev, args); - cnxk_sso_hws_swtag_flush(ws->base); - } + + ptag = (plt_read64(base + SSOW_LF_GWS_TAG) >> 32) & SSO_TT_EMPTY; + if (ptag != SSO_TT_EMPTY) + cnxk_sso_hws_swtag_flush(base); + + do { + ptag = plt_read64(base + SSOW_LF_GWS_PENDSTATE); + } while (ptag & BIT_ULL(56)); + + plt_write64(0, base + SSOW_LF_GWS_OP_GWC_INVAL); } + + if (dev->dual_ws) + dws->swtag_req = 0; + else + ws->swtag_req = 0; } static int -- 2.25.1