Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright(C) 2021 Marvell.
3 : : */
4 : :
5 : : #include "roc_api.h"
6 : :
7 : : #include "cn9k_worker.h"
8 : : #include "cn9k_cryptodev_ops.h"
9 : :
10 : : uint16_t __rte_hot
11 : 0 : cn9k_sso_hws_enq(void *port, const struct rte_event *ev)
12 : : {
13 : : struct cn9k_sso_hws *ws = port;
14 : :
15 [ # # # # ]: 0 : switch (ev->op) {
16 : : case RTE_EVENT_OP_NEW:
17 : 0 : return cn9k_sso_hws_new_event(ws, ev);
18 : : case RTE_EVENT_OP_FORWARD:
19 : : cn9k_sso_hws_forward_event(ws, ev);
20 : : break;
21 : 0 : case RTE_EVENT_OP_RELEASE:
22 [ # # ]: 0 : if (ws->swtag_req) {
23 : 0 : cnxk_sso_hws_desched(ev->u64, ws->base);
24 : 0 : ws->swtag_req = 0;
25 : 0 : break;
26 : : }
27 : 0 : cnxk_sso_hws_swtag_flush(ws->base);
28 : : break;
29 : : default:
30 : : return 0;
31 : : }
32 : :
33 : : return 1;
34 : : }
35 : :
36 : : uint16_t __rte_hot
37 : 0 : cn9k_sso_hws_enq_burst(void *port, const struct rte_event ev[],
38 : : uint16_t nb_events)
39 : : {
40 : : RTE_SET_USED(nb_events);
41 : 0 : return cn9k_sso_hws_enq(port, ev);
42 : : }
43 : :
44 : : uint16_t __rte_hot
45 : 0 : cn9k_sso_hws_enq_new_burst(void *port, const struct rte_event ev[],
46 : : uint16_t nb_events)
47 : : {
48 : : struct cn9k_sso_hws *ws = port;
49 : : uint16_t i, rc = 1;
50 : :
51 [ # # ]: 0 : for (i = 0; i < nb_events && rc; i++)
52 [ # # ]: 0 : rc = cn9k_sso_hws_new_event(ws, &ev[i]);
53 : :
54 : 0 : return nb_events;
55 : : }
56 : :
57 : : uint16_t __rte_hot
58 [ # # ]: 0 : cn9k_sso_hws_enq_fwd_burst(void *port, const struct rte_event ev[],
59 : : uint16_t nb_events)
60 : : {
61 : : struct cn9k_sso_hws *ws = port;
62 : :
63 : : RTE_SET_USED(nb_events);
64 : : cn9k_sso_hws_forward_event(ws, ev);
65 : :
66 : 0 : return 1;
67 : : }
68 : :
69 : : int __rte_hot
70 : 0 : cn9k_sso_hws_profile_switch(void *port, uint8_t profile)
71 : : {
72 : : struct cn9k_sso_hws *ws = port;
73 : :
74 : 0 : ws->gw_wdata &= ~(0xFFUL);
75 : 0 : ws->gw_wdata |= (profile + 1);
76 : :
77 : 0 : return 0;
78 : : }
79 : :
80 : : /* Dual ws ops. */
81 : :
82 : : uint16_t __rte_hot
83 : 0 : cn9k_sso_hws_dual_enq(void *port, const struct rte_event *ev)
84 : : {
85 : : struct cn9k_sso_hws_dual *dws = port;
86 : : uint64_t base;
87 : :
88 : 0 : base = dws->base[!dws->vws];
89 [ # # # # ]: 0 : switch (ev->op) {
90 : : case RTE_EVENT_OP_NEW:
91 : 0 : return cn9k_sso_hws_dual_new_event(dws, ev);
92 : : case RTE_EVENT_OP_FORWARD:
93 : : cn9k_sso_hws_dual_forward_event(dws, base, ev);
94 : : break;
95 : 0 : case RTE_EVENT_OP_RELEASE:
96 [ # # ]: 0 : if (dws->swtag_req) {
97 : 0 : cnxk_sso_hws_desched(ev->u64, base);
98 : 0 : dws->swtag_req = 0;
99 : 0 : break;
100 : : }
101 : : cnxk_sso_hws_swtag_flush(base);
102 : : break;
103 : : default:
104 : : return 0;
105 : : }
106 : :
107 : : return 1;
108 : : }
109 : :
110 : : uint16_t __rte_hot
111 : 0 : cn9k_sso_hws_dual_enq_burst(void *port, const struct rte_event ev[],
112 : : uint16_t nb_events)
113 : : {
114 : : RTE_SET_USED(nb_events);
115 : 0 : return cn9k_sso_hws_dual_enq(port, ev);
116 : : }
117 : :
118 : : uint16_t __rte_hot
119 : 0 : cn9k_sso_hws_dual_enq_new_burst(void *port, const struct rte_event ev[],
120 : : uint16_t nb_events)
121 : : {
122 : : struct cn9k_sso_hws_dual *dws = port;
123 : : uint16_t i, rc = 1;
124 : :
125 [ # # ]: 0 : for (i = 0; i < nb_events && rc; i++)
126 [ # # ]: 0 : rc = cn9k_sso_hws_dual_new_event(dws, &ev[i]);
127 : :
128 : 0 : return nb_events;
129 : : }
130 : :
131 : : uint16_t __rte_hot
132 : 0 : cn9k_sso_hws_dual_enq_fwd_burst(void *port, const struct rte_event ev[],
133 : : uint16_t nb_events)
134 : : {
135 : : struct cn9k_sso_hws_dual *dws = port;
136 : :
137 : : RTE_SET_USED(nb_events);
138 [ # # ]: 0 : cn9k_sso_hws_dual_forward_event(dws, dws->base[!dws->vws], ev);
139 : :
140 : 0 : return 1;
141 : : }
142 : :
143 : : uint16_t __rte_hot
144 : 0 : cn9k_sso_hws_ca_enq(void *port, struct rte_event ev[], uint16_t nb_events)
145 : : {
146 : : struct cn9k_sso_hws *ws = port;
147 : :
148 : : RTE_SET_USED(nb_events);
149 : :
150 : 0 : return cn9k_cpt_crypto_adapter_enqueue(ws->base, ev->event_ptr);
151 : : }
152 : :
153 : : uint16_t __rte_hot
154 : 0 : cn9k_sso_hws_dual_ca_enq(void *port, struct rte_event ev[], uint16_t nb_events)
155 : : {
156 : : struct cn9k_sso_hws_dual *dws = port;
157 : :
158 : : RTE_SET_USED(nb_events);
159 : :
160 : 0 : return cn9k_cpt_crypto_adapter_enqueue(dws->base[!dws->vws],
161 : 0 : ev->event_ptr);
162 : : }
163 : :
164 : : int __rte_hot
165 : 0 : cn9k_sso_hws_dual_profile_switch(void *port, uint8_t profile)
166 : : {
167 : : struct cn9k_sso_hws_dual *dws = port;
168 : :
169 : 0 : dws->gw_wdata &= ~(0xFFUL);
170 : 0 : dws->gw_wdata |= (profile + 1);
171 : :
172 : 0 : return 0;
173 : : }
|