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