memset(ws, 0, sizeof(*ws));
}
-static void
+static int
cn10k_sso_hws_flush_events(void *hws, uint8_t queue_id, uintptr_t base,
cnxk_handle_event_t fn, void *arg)
{
+ uint64_t retry = CNXK_SSO_FLUSH_RETRY_MAX;
struct cn10k_sso_hws *ws = hws;
uint64_t cq_ds_cnt = 1;
uint64_t aq_cnt = 1;
fn(arg, ev);
if (ev.sched_type != SSO_TT_EMPTY)
cnxk_sso_hws_swtag_flush(ws->base);
+ else if (retry-- == 0)
+ break;
do {
val = plt_read64(ws->base + SSOW_LF_GWS_PENDSTATE);
} while (val & BIT_ULL(56));
cq_ds_cnt &= 0x3FFF3FFF0000;
}
+ if (aq_cnt || cq_ds_cnt || ds_cnt)
+ return -EAGAIN;
+
plt_write64(0, ws->base + SSOW_LF_GWS_OP_GWC_INVAL);
rte_mb();
+
+ return 0;
}
static void
}
}
-static void
+static int
cn9k_sso_hws_flush_events(void *hws, uint8_t queue_id, uintptr_t base,
cnxk_handle_event_t fn, void *arg)
{
struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(arg);
+ uint64_t retry = CNXK_SSO_FLUSH_RETRY_MAX;
struct cnxk_timesync_info *tstamp;
struct cn9k_sso_hws_dual *dws;
struct cn9k_sso_hws *ws;
fn(arg, ev);
if (ev.sched_type != SSO_TT_EMPTY)
cnxk_sso_hws_swtag_flush(ws_base);
+ else if (retry-- == 0)
+ break;
do {
val = plt_read64(ws_base + SSOW_LF_GWS_PENDSTATE);
} while (val & BIT_ULL(56));
cq_ds_cnt &= 0x3FFF3FFF0000;
}
+ if (aq_cnt || cq_ds_cnt || ds_cnt)
+ return -EAGAIN;
+
plt_write64(0, ws_base + SSOW_LF_GWS_OP_GWC_INVAL);
+
+ return 0;
}
static void
cnxk_sso_cleanup(struct rte_eventdev *event_dev, cnxk_sso_hws_reset_t reset_fn,
cnxk_sso_hws_flush_t flush_fn, uint8_t enable)
{
+ uint8_t pend_list[RTE_EVENT_MAX_QUEUES_PER_DEV], pend_cnt, new_pcnt;
struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
uintptr_t hwgrp_base;
- uint16_t i;
+ uint8_t queue_id, i;
void *ws;
for (i = 0; i < dev->nb_event_ports; i++) {
}
rte_mb();
+
+ /* Consume all the events through HWS0 */
ws = event_dev->data->ports[0];
- for (i = 0; i < dev->nb_event_queues; i++) {
- /* Consume all the events through HWS0 */
- hwgrp_base = roc_sso_hwgrp_base_get(&dev->sso, i);
- flush_fn(ws, i, hwgrp_base, cnxk_handle_event, event_dev);
- /* Enable/Disable SSO GGRP */
- plt_write64(enable, hwgrp_base + SSO_LF_GGRP_QCTL);
+ /* Starting list of queues to flush */
+ pend_cnt = dev->nb_event_queues;
+ for (i = 0; i < dev->nb_event_queues; i++)
+ pend_list[i] = i;
+
+ while (pend_cnt) {
+ new_pcnt = 0;
+ for (i = 0; i < pend_cnt; i++) {
+ queue_id = pend_list[i];
+ hwgrp_base =
+ roc_sso_hwgrp_base_get(&dev->sso, queue_id);
+ if (flush_fn(ws, queue_id, hwgrp_base,
+ cnxk_handle_event, event_dev)) {
+ pend_list[new_pcnt++] = queue_id;
+ continue;
+ }
+ /* Enable/Disable SSO GGRP */
+ plt_write64(enable, hwgrp_base + SSO_LF_GGRP_QCTL);
+ }
+ pend_cnt = new_pcnt;
}
}
#define CNXK_QOS_NORMALIZE(val, min, max, cnt) \
(min + val / ((max + cnt - 1) / cnt))
+#define CNXK_SSO_FLUSH_RETRY_MAX 0xfff
+
#define CNXK_VALID_DEV_OR_ERR_RET(dev, drv_name) \
do { \
if (strncmp(dev->driver->name, drv_name, strlen(drv_name))) \
uint16_t nb_link);
typedef void (*cnxk_handle_event_t)(void *arg, struct rte_event ev);
typedef void (*cnxk_sso_hws_reset_t)(void *arg, void *ws);
-typedef void (*cnxk_sso_hws_flush_t)(void *ws, uint8_t queue_id, uintptr_t base,
- cnxk_handle_event_t fn, void *arg);
+typedef int (*cnxk_sso_hws_flush_t)(void *ws, uint8_t queue_id, uintptr_t base,
+ cnxk_handle_event_t fn, void *arg);
struct cnxk_sso_qos {
uint16_t queue;