c71aa3732780f83c0bf15a20f6318966a2a5beda
[dpdk.git] / drivers / event / cnxk / cn10k_worker.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 Marvell.
3  */
4
5 #include "cn10k_worker.h"
6 #include "cnxk_eventdev.h"
7 #include "cnxk_worker.h"
8
9 uint16_t __rte_hot
10 cn10k_sso_hws_enq(void *port, const struct rte_event *ev)
11 {
12         struct cn10k_sso_hws *ws = port;
13
14         switch (ev->op) {
15         case RTE_EVENT_OP_NEW:
16                 return cn10k_sso_hws_new_event(ws, ev);
17         case RTE_EVENT_OP_FORWARD:
18                 cn10k_sso_hws_forward_event(ws, ev);
19                 break;
20         case RTE_EVENT_OP_RELEASE:
21                 cnxk_sso_hws_swtag_flush(ws->base + SSOW_LF_GWS_WQE0,
22                                          ws->base + SSOW_LF_GWS_OP_SWTAG_FLUSH);
23                 break;
24         default:
25                 return 0;
26         }
27
28         return 1;
29 }
30
31 uint16_t __rte_hot
32 cn10k_sso_hws_enq_burst(void *port, const struct rte_event ev[],
33                         uint16_t nb_events)
34 {
35         RTE_SET_USED(nb_events);
36         return cn10k_sso_hws_enq(port, ev);
37 }
38
39 uint16_t __rte_hot
40 cn10k_sso_hws_enq_new_burst(void *port, const struct rte_event ev[],
41                             uint16_t nb_events)
42 {
43         struct cn10k_sso_hws *ws = port;
44         uint16_t i, rc = 1;
45
46         for (i = 0; i < nb_events && rc; i++)
47                 rc = cn10k_sso_hws_new_event(ws, &ev[i]);
48
49         return nb_events;
50 }
51
52 uint16_t __rte_hot
53 cn10k_sso_hws_enq_fwd_burst(void *port, const struct rte_event ev[],
54                             uint16_t nb_events)
55 {
56         struct cn10k_sso_hws *ws = port;
57
58         RTE_SET_USED(nb_events);
59         cn10k_sso_hws_forward_event(ws, ev);
60
61         return 1;
62 }