Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright(C) 2024 Marvell.
3 : : */
4 : :
5 : : #include "roc_api.h"
6 : :
7 : : #include "cn20k_cryptodev_ops.h"
8 : : #include "cn20k_ethdev.h"
9 : : #include "cn20k_eventdev.h"
10 : : #include "cn20k_tx_worker.h"
11 : : #include "cn20k_worker.h"
12 : : #include "cnxk_common.h"
13 : : #include "cnxk_eventdev.h"
14 : : #include "cnxk_vector_adptr.h"
15 : : #include "cnxk_worker.h"
16 : :
17 : : #define CN20K_SET_EVDEV_DEQ_OP(dev, deq_op, deq_ops) \
18 : : deq_op = deq_ops[dev->rx_offloads & (NIX_RX_OFFLOAD_MAX - 1)]
19 : :
20 : : #define CN20K_SET_EVDEV_ENQ_OP(dev, enq_op, enq_ops) \
21 : : enq_op = enq_ops[dev->tx_offloads & (NIX_TX_OFFLOAD_MAX - 1)]
22 : :
23 : : static uint8_t
24 : : cn20k_sso_hw_weight(uint8_t weight)
25 : : {
26 : : /* Map DPDK weight 0-255 to HW weight 1-255 */
27 : 0 : return (weight + 1) > CN20K_SSO_WEIGHT_MAX ? CN20K_SSO_WEIGHT_MAX : (weight + 1);
28 : : }
29 : :
30 : : static int
31 [ # # ]: 0 : cn20k_sso_queue_setup(struct rte_eventdev *event_dev, uint8_t queue_id,
32 : : const struct rte_event_queue_conf *queue_conf)
33 : : {
34 : : struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
35 : : uint8_t priority, weight, affinity;
36 : :
37 : 0 : priority = CNXK_QOS_NORMALIZE(queue_conf->priority, 0, RTE_EVENT_DEV_PRIORITY_LOWEST,
38 : : CNXK_SSO_PRIORITY_CNT);
39 [ # # ]: 0 : weight = cn20k_sso_hw_weight(queue_conf->weight);
40 : 0 : affinity = CNXK_QOS_NORMALIZE(queue_conf->affinity, 0, RTE_EVENT_QUEUE_AFFINITY_HIGHEST,
41 : : CNXK_SSO_AFFINITY_CNT);
42 : :
43 : 0 : plt_sso_dbg("Queue=%u prio=%u weight=%u affinity=%u", queue_id, priority, weight, affinity);
44 : :
45 : 0 : return roc_sso_hwgrp_set_priority(&dev->sso, queue_id, weight, affinity, priority);
46 : : }
47 : :
48 : : static int
49 [ # # # # : 0 : cn20k_sso_queue_attribute_set(struct rte_eventdev *event_dev, uint8_t queue_id, uint32_t attr_id,
# ]
50 : : uint64_t attr_value)
51 : : {
52 : : struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
53 : : uint8_t priority, weight, affinity;
54 : : struct rte_event_queue_conf *conf;
55 : :
56 : 0 : conf = &event_dev->data->queues_cfg[queue_id];
57 : :
58 [ # # # # : 0 : switch (attr_id) {
# ]
59 : 0 : case RTE_EVENT_QUEUE_ATTR_PRIORITY:
60 : 0 : conf->priority = attr_value;
61 : 0 : break;
62 : 0 : case RTE_EVENT_QUEUE_ATTR_WEIGHT:
63 : 0 : conf->weight = attr_value;
64 : 0 : break;
65 : 0 : case RTE_EVENT_QUEUE_ATTR_AFFINITY:
66 : 0 : conf->affinity = attr_value;
67 : 0 : break;
68 : 0 : case RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_FLOWS:
69 : : case RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_ORDER_SEQUENCES:
70 : : case RTE_EVENT_QUEUE_ATTR_EVENT_QUEUE_CFG:
71 : : case RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE:
72 : : /* FALLTHROUGH */
73 : 0 : plt_sso_dbg("Unsupported attribute id %u", attr_id);
74 : 0 : return -ENOTSUP;
75 : 0 : default:
76 : 0 : plt_err("Invalid attribute id %u", attr_id);
77 : 0 : return -EINVAL;
78 : : }
79 : :
80 : 0 : priority = CNXK_QOS_NORMALIZE(conf->priority, 0, RTE_EVENT_DEV_PRIORITY_LOWEST,
81 : : CNXK_SSO_PRIORITY_CNT);
82 [ # # ]: 0 : weight = cn20k_sso_hw_weight(conf->weight);
83 : 0 : affinity = CNXK_QOS_NORMALIZE(conf->affinity, 0, RTE_EVENT_QUEUE_AFFINITY_HIGHEST,
84 : : CNXK_SSO_AFFINITY_CNT);
85 : :
86 : 0 : return roc_sso_hwgrp_set_priority(&dev->sso, queue_id, weight, affinity, priority);
87 : : }
88 : :
89 : : static void *
90 : 0 : cn20k_sso_init_hws_mem(void *arg, uint8_t port_id)
91 : : {
92 : : struct cnxk_sso_evdev *dev = arg;
93 : : struct cn20k_sso_hws *ws;
94 : :
95 : : /* Allocate event port memory */
96 : 0 : ws = rte_zmalloc("cn20k_ws", sizeof(struct cn20k_sso_hws) + RTE_CACHE_LINE_SIZE,
97 : : RTE_CACHE_LINE_SIZE);
98 [ # # ]: 0 : if (ws == NULL) {
99 : 0 : plt_err("Failed to alloc memory for port=%d", port_id);
100 : 0 : return NULL;
101 : : }
102 : :
103 : : /* First cache line is reserved for cookie */
104 : 0 : ws = (struct cn20k_sso_hws *)((uint8_t *)ws + RTE_CACHE_LINE_SIZE);
105 : 0 : ws->base = roc_sso_hws_base_get(&dev->sso, port_id);
106 : 0 : ws->hws_id = port_id;
107 [ # # ]: 0 : ws->swtag_req = 0;
108 : 0 : ws->gw_wdata = cnxk_sso_hws_prf_wdata(dev);
109 : 0 : ws->gw_rdata = SSO_TT_EMPTY << 32;
110 : 0 : ws->xae_waes = dev->sso.feat.xaq_wq_entries;
111 : :
112 : 0 : return ws;
113 : : }
114 : :
115 : : static int
116 : 0 : cn20k_sso_hws_link(void *arg, void *port, uint16_t *map, uint16_t nb_link, uint8_t profile)
117 : : {
118 : : struct cnxk_sso_evdev *dev = arg;
119 : : struct cn20k_sso_hws *ws = port;
120 : :
121 : 0 : return roc_sso_hws_link(&dev->sso, ws->hws_id, map, nb_link, profile, 0);
122 : : }
123 : :
124 : : static int
125 : 0 : cn20k_sso_hws_unlink(void *arg, void *port, uint16_t *map, uint16_t nb_link, uint8_t profile)
126 : : {
127 : : struct cnxk_sso_evdev *dev = arg;
128 : : struct cn20k_sso_hws *ws = port;
129 : :
130 : 0 : return roc_sso_hws_unlink(&dev->sso, ws->hws_id, map, nb_link, profile, 0);
131 : : }
132 : :
133 : : static void
134 : 0 : cn20k_sso_hws_setup(void *arg, void *hws, uintptr_t grp_base)
135 : : {
136 : : struct cnxk_sso_evdev *dev = arg;
137 : : struct cn20k_sso_hws *ws = hws;
138 : : uint64_t val;
139 : :
140 : 0 : ws->grp_base = grp_base;
141 : 0 : ws->fc_mem = (int64_t __rte_atomic *)dev->fc_iova;
142 : 0 : ws->xaq_lmt = dev->xaq_lmt;
143 : 0 : ws->fc_cache_space = (int64_t __rte_atomic *)dev->fc_cache_space;
144 [ # # ]: 0 : ws->aw_lmt = dev->sso.lmt_base;
145 : 0 : ws->gw_wdata = cnxk_sso_hws_prf_wdata(dev);
146 : 0 : ws->lmt_base = dev->sso.lmt_base;
147 : :
148 : : /* Set get_work timeout for HWS */
149 : 0 : val = NSEC2USEC(dev->deq_tmo_ns);
150 [ # # ]: 0 : val = val ? val - 1 : 0;
151 : 0 : plt_write64(val, ws->base + SSOW_LF_GWS_NW_TIM);
152 : 0 : }
153 : :
154 : : static void
155 : 0 : cn20k_sso_hws_release(void *arg, void *hws)
156 : : {
157 : : struct cnxk_sso_evdev *dev = arg;
158 : : struct cn20k_sso_hws *ws = hws;
159 : : uint16_t i, j;
160 : :
161 [ # # ]: 0 : for (i = 0; i < CNXK_SSO_MAX_PROFILES; i++)
162 [ # # ]: 0 : for (j = 0; j < dev->nb_event_queues; j++)
163 : 0 : roc_sso_hws_unlink(&dev->sso, ws->hws_id, &j, 1, i, 0);
164 : : memset(ws, 0, sizeof(*ws));
165 : 0 : }
166 : :
167 : : static int
168 : 0 : cn20k_sso_hws_flush_events(void *hws, uint8_t queue_id, uintptr_t base, cnxk_handle_event_t fn,
169 : : void *arg)
170 : : {
171 : : struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(arg);
172 : : uint64_t retry = CNXK_SSO_FLUSH_RETRY_MAX;
173 : : struct cn20k_sso_hws *ws = hws;
174 : : uint64_t cq_ds_cnt = 1;
175 : : uint64_t aq_cnt = 1;
176 : : uint64_t ds_cnt = 1;
177 : : struct rte_event ev;
178 : : uint64_t val, req;
179 : :
180 : 0 : plt_write64(0, base + SSO_LF_GGRP_QCTL);
181 : :
182 : 0 : roc_sso_hws_gwc_invalidate(&dev->sso, &ws->hws_id, 1);
183 : 0 : plt_write64(0, ws->base + SSOW_LF_GWS_OP_GWC_INVAL);
184 : 0 : req = queue_id; /* GGRP ID */
185 : : req |= BIT_ULL(18); /* Grouped */
186 : 0 : req |= BIT_ULL(16); /* WAIT */
187 : :
188 : 0 : aq_cnt = plt_read64(base + SSO_LF_GGRP_AQ_CNT);
189 : 0 : ds_cnt = plt_read64(base + SSO_LF_GGRP_MISC_CNT);
190 : 0 : cq_ds_cnt = plt_read64(base + SSO_LF_GGRP_INT_CNT);
191 : 0 : cq_ds_cnt &= 0x3FFF3FFF0000;
192 : :
193 [ # # ]: 0 : while (aq_cnt || cq_ds_cnt || ds_cnt) {
194 : 0 : plt_write64(req, ws->base + SSOW_LF_GWS_OP_GET_WORK0);
195 : 0 : cn20k_sso_hws_get_work_empty(ws, &ev, dev->rx_offloads);
196 [ # # # # ]: 0 : if (fn != NULL && ev.u64 != 0)
197 : 0 : fn(arg, ev);
198 [ # # ]: 0 : if (ev.sched_type != SSO_TT_EMPTY)
199 : 0 : cnxk_sso_hws_swtag_flush(ws->base);
200 [ # # ]: 0 : else if (retry-- == 0)
201 : : break;
202 : : do {
203 [ # # ]: 0 : val = plt_read64(ws->base + SSOW_LF_GWS_PENDSTATE);
204 [ # # ]: 0 : } while (val & BIT_ULL(56));
205 : : aq_cnt = plt_read64(base + SSO_LF_GGRP_AQ_CNT);
206 : : ds_cnt = plt_read64(base + SSO_LF_GGRP_MISC_CNT);
207 : : cq_ds_cnt = plt_read64(base + SSO_LF_GGRP_INT_CNT);
208 : : /* Extract cq and ds count */
209 : 0 : cq_ds_cnt &= 0x3FFF3FFF0000;
210 : : }
211 : :
212 [ # # ]: 0 : if (aq_cnt || cq_ds_cnt || ds_cnt)
213 : : return -EAGAIN;
214 : :
215 : 0 : plt_write64(0, ws->base + SSOW_LF_GWS_OP_GWC_INVAL);
216 : 0 : roc_sso_hws_gwc_invalidate(&dev->sso, &ws->hws_id, 1);
217 : : rte_mb();
218 : :
219 : 0 : return 0;
220 : : }
221 : :
222 : : static void
223 : : cn20k_sso_set_rsrc(void *arg)
224 : : {
225 : : struct cnxk_sso_evdev *dev = arg;
226 : :
227 : 0 : dev->max_event_ports = dev->sso.max_hws;
228 : 0 : dev->max_event_queues = dev->sso.max_hwgrp > RTE_EVENT_MAX_QUEUES_PER_DEV ?
229 : 0 : RTE_EVENT_MAX_QUEUES_PER_DEV :
230 : : dev->sso.max_hwgrp;
231 : : }
232 : :
233 : : static int
234 : 0 : cn20k_sso_rsrc_init(void *arg, uint8_t hws, uint8_t hwgrp)
235 : : {
236 : : struct cnxk_tim_evdev *tim_dev = cnxk_tim_priv_get();
237 : : struct cnxk_sso_evdev *dev = arg;
238 : : uint16_t nb_tim_lfs;
239 : :
240 [ # # ]: 0 : nb_tim_lfs = tim_dev ? tim_dev->nb_rings : 0;
241 : 0 : return roc_sso_rsrc_init(&dev->sso, hws, hwgrp, nb_tim_lfs);
242 : : }
243 : :
244 : : static int
245 [ # # ]: 0 : cn20k_sso_updt_tx_adptr_data(const struct rte_eventdev *event_dev)
246 : : {
247 : : struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
248 : : int i;
249 : :
250 [ # # ]: 0 : if (dev->tx_adptr_data == NULL)
251 : : return 0;
252 : :
253 [ # # ]: 0 : for (i = 0; i < dev->nb_event_ports; i++) {
254 : 0 : struct cn20k_sso_hws *ws = event_dev->data->ports[i];
255 : : void *ws_cookie;
256 : :
257 : : ws_cookie = cnxk_sso_hws_get_cookie(ws);
258 : 0 : ws_cookie = rte_realloc_socket(ws_cookie,
259 : : sizeof(struct cnxk_sso_hws_cookie) +
260 : : sizeof(struct cn20k_sso_hws) +
261 : 0 : dev->tx_adptr_data_sz,
262 : : RTE_CACHE_LINE_SIZE, SOCKET_ID_ANY);
263 [ # # ]: 0 : if (ws_cookie == NULL)
264 : : return -ENOMEM;
265 : 0 : ws = RTE_PTR_ADD(ws_cookie, sizeof(struct cnxk_sso_hws_cookie));
266 : 0 : memcpy(&ws->tx_adptr_data, dev->tx_adptr_data, dev->tx_adptr_data_sz);
267 : 0 : event_dev->data->ports[i] = ws;
268 : : }
269 : :
270 : : return 0;
271 : : }
272 : :
273 : : #if defined(RTE_ARCH_ARM64)
274 : : static inline void
275 : : cn20k_sso_fp_tmplt_fns_set(struct rte_eventdev *event_dev)
276 : : {
277 : : #if !defined(CNXK_DIS_TMPLT_FUNC)
278 : : struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
279 : :
280 : : const event_dequeue_burst_t sso_hws_deq_burst[NIX_RX_OFFLOAD_MAX] = {
281 : : #define R(name, flags) [flags] = cn20k_sso_hws_deq_burst_##name,
282 : : NIX_RX_FASTPATH_MODES
283 : : #undef R
284 : : };
285 : :
286 : : const event_dequeue_burst_t sso_hws_deq_tmo_burst[NIX_RX_OFFLOAD_MAX] = {
287 : : #define R(name, flags) [flags] = cn20k_sso_hws_deq_tmo_burst_##name,
288 : : NIX_RX_FASTPATH_MODES
289 : : #undef R
290 : : };
291 : :
292 : : const event_dequeue_burst_t sso_hws_deq_seg_burst[NIX_RX_OFFLOAD_MAX] = {
293 : : #define R(name, flags) [flags] = cn20k_sso_hws_deq_seg_burst_##name,
294 : : NIX_RX_FASTPATH_MODES
295 : : #undef R
296 : : };
297 : :
298 : : const event_dequeue_burst_t sso_hws_deq_tmo_seg_burst[NIX_RX_OFFLOAD_MAX] = {
299 : : #define R(name, flags) [flags] = cn20k_sso_hws_deq_tmo_seg_burst_##name,
300 : : NIX_RX_FASTPATH_MODES
301 : : #undef R
302 : : };
303 : :
304 : : const event_dequeue_burst_t sso_hws_reas_deq_burst[NIX_RX_OFFLOAD_MAX] = {
305 : : #define R(name, flags) [flags] = cn20k_sso_hws_reas_deq_burst_##name,
306 : : NIX_RX_FASTPATH_MODES
307 : : #undef R
308 : : };
309 : :
310 : : const event_dequeue_burst_t sso_hws_reas_deq_tmo_burst[NIX_RX_OFFLOAD_MAX] = {
311 : : #define R(name, flags) [flags] = cn20k_sso_hws_reas_deq_tmo_burst_##name,
312 : : NIX_RX_FASTPATH_MODES
313 : : #undef R
314 : : };
315 : :
316 : : const event_dequeue_burst_t sso_hws_reas_deq_seg_burst[NIX_RX_OFFLOAD_MAX] = {
317 : : #define R(name, flags) [flags] = cn20k_sso_hws_reas_deq_seg_burst_##name,
318 : : NIX_RX_FASTPATH_MODES
319 : : #undef R
320 : : };
321 : :
322 : : const event_dequeue_burst_t sso_hws_reas_deq_tmo_seg_burst[NIX_RX_OFFLOAD_MAX] = {
323 : : #define R(name, flags) [flags] = cn20k_sso_hws_reas_deq_tmo_seg_burst_##name,
324 : : NIX_RX_FASTPATH_MODES
325 : : #undef R
326 : : };
327 : :
328 : : /* Tx modes */
329 : : const event_tx_adapter_enqueue_t sso_hws_tx_adptr_enq[NIX_TX_OFFLOAD_MAX] = {
330 : : #define T(name, sz, flags) [flags] = cn20k_sso_hws_tx_adptr_enq_##name,
331 : : NIX_TX_FASTPATH_MODES
332 : : #undef T
333 : : };
334 : :
335 : : const event_tx_adapter_enqueue_t sso_hws_tx_adptr_enq_seg[NIX_TX_OFFLOAD_MAX] = {
336 : : #define T(name, sz, flags) [flags] = cn20k_sso_hws_tx_adptr_enq_seg_##name,
337 : : NIX_TX_FASTPATH_MODES
338 : : #undef T
339 : : };
340 : :
341 : : if (dev->rx_offloads & NIX_RX_MULTI_SEG_F) {
342 : : if (dev->rx_offloads & NIX_RX_REAS_F) {
343 : : CN20K_SET_EVDEV_DEQ_OP(dev, event_dev->dequeue_burst,
344 : : sso_hws_reas_deq_seg_burst);
345 : : if (dev->is_timeout_deq)
346 : : CN20K_SET_EVDEV_DEQ_OP(dev, event_dev->dequeue_burst,
347 : : sso_hws_reas_deq_tmo_seg_burst);
348 : : } else {
349 : : CN20K_SET_EVDEV_DEQ_OP(dev, event_dev->dequeue_burst,
350 : : sso_hws_deq_seg_burst);
351 : :
352 : : if (dev->is_timeout_deq)
353 : : CN20K_SET_EVDEV_DEQ_OP(dev, event_dev->dequeue_burst,
354 : : sso_hws_deq_tmo_seg_burst);
355 : : }
356 : : } else {
357 : : if (dev->rx_offloads & NIX_RX_REAS_F) {
358 : : CN20K_SET_EVDEV_DEQ_OP(dev, event_dev->dequeue_burst,
359 : : sso_hws_reas_deq_burst);
360 : :
361 : : if (dev->is_timeout_deq)
362 : : CN20K_SET_EVDEV_DEQ_OP(dev, event_dev->dequeue_burst,
363 : : sso_hws_reas_deq_tmo_burst);
364 : : } else {
365 : : CN20K_SET_EVDEV_DEQ_OP(dev, event_dev->dequeue_burst, sso_hws_deq_burst);
366 : :
367 : : if (dev->is_timeout_deq)
368 : : CN20K_SET_EVDEV_DEQ_OP(dev, event_dev->dequeue_burst,
369 : : sso_hws_deq_tmo_burst);
370 : : }
371 : : }
372 : :
373 : : if (dev->tx_offloads & NIX_TX_MULTI_SEG_F)
374 : : CN20K_SET_EVDEV_ENQ_OP(dev, event_dev->txa_enqueue, sso_hws_tx_adptr_enq_seg);
375 : : else
376 : : CN20K_SET_EVDEV_ENQ_OP(dev, event_dev->txa_enqueue, sso_hws_tx_adptr_enq);
377 : :
378 : : event_dev->txa_enqueue_same_dest = event_dev->txa_enqueue;
379 : : #else
380 : : RTE_SET_USED(event_dev);
381 : : #endif
382 : : }
383 : :
384 : : static inline void
385 : : cn20k_sso_fp_blk_fns_set(struct rte_eventdev *event_dev)
386 : : {
387 : : #if defined(CNXK_DIS_TMPLT_FUNC)
388 : : struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
389 : :
390 : : event_dev->dequeue_burst = cn20k_sso_hws_deq_burst_all_offload;
391 : : if (dev->rx_offloads & NIX_RX_OFFLOAD_TSTAMP_F)
392 : : event_dev->dequeue_burst = cn20k_sso_hws_deq_burst_all_offload_tst;
393 : : event_dev->txa_enqueue = cn20k_sso_hws_tx_adptr_enq_seg_all_offload;
394 : : event_dev->txa_enqueue_same_dest = cn20k_sso_hws_tx_adptr_enq_seg_all_offload;
395 : : if (dev->tx_offloads & (NIX_TX_OFFLOAD_OL3_OL4_CSUM_F | NIX_TX_OFFLOAD_VLAN_QINQ_F |
396 : : NIX_TX_OFFLOAD_TSO_F | NIX_TX_OFFLOAD_TSTAMP_F)) {
397 : : event_dev->txa_enqueue = cn20k_sso_hws_tx_adptr_enq_seg_all_offload_tst;
398 : : event_dev->txa_enqueue_same_dest = cn20k_sso_hws_tx_adptr_enq_seg_all_offload_tst;
399 : : }
400 : : #else
401 : : RTE_SET_USED(event_dev);
402 : : #endif
403 : : }
404 : : #endif
405 : :
406 : : static void
407 : : cn20k_sso_fp_fns_set(struct rte_eventdev *event_dev)
408 : : {
409 : : #if defined(RTE_ARCH_ARM64)
410 : : cn20k_sso_fp_blk_fns_set(event_dev);
411 : : cn20k_sso_fp_tmplt_fns_set(event_dev);
412 : :
413 : : event_dev->enqueue_burst = cn20k_sso_hws_enq_burst;
414 : : event_dev->enqueue_new_burst = cn20k_sso_hws_enq_new_burst;
415 : : event_dev->enqueue_forward_burst = cn20k_sso_hws_enq_fwd_burst;
416 : :
417 : : event_dev->ca_enqueue = cn20k_cpt_crypto_adapter_enqueue;
418 : : event_dev->profile_switch = cn20k_sso_hws_profile_switch;
419 : : event_dev->preschedule_modify = cn20k_sso_hws_preschedule_modify;
420 : : event_dev->preschedule = cn20k_sso_hws_preschedule;
421 : : #else
422 : : RTE_SET_USED(event_dev);
423 : : #endif
424 : : }
425 : :
426 : : static void
427 : 0 : cn20k_sso_info_get(struct rte_eventdev *event_dev, struct rte_event_dev_info *dev_info)
428 : : {
429 : : struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
430 : :
431 : 0 : dev_info->driver_name = RTE_STR(EVENTDEV_NAME_CN20K_PMD);
432 : 0 : cnxk_sso_info_get(dev, dev_info);
433 : 0 : dev_info->max_event_port_enqueue_depth = UINT32_MAX;
434 : 0 : dev_info->event_dev_cap |= RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE |
435 : : RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE_ADAPTIVE |
436 : : RTE_EVENT_DEV_CAP_PER_PORT_PRESCHEDULE;
437 : 0 : }
438 : :
439 : : static int
440 : 0 : cn20k_sso_dev_configure(const struct rte_eventdev *event_dev)
441 : : {
442 : : struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
443 : : int rc;
444 : :
445 : 0 : rc = cnxk_sso_dev_validate(event_dev, 1, UINT32_MAX);
446 [ # # ]: 0 : if (rc < 0) {
447 : 0 : plt_err("Invalid event device configuration");
448 : 0 : return -EINVAL;
449 : : }
450 : :
451 : 0 : rc = cn20k_sso_rsrc_init(dev, dev->nb_event_ports, dev->nb_event_queues);
452 [ # # ]: 0 : if (rc < 0) {
453 : 0 : plt_err("Failed to initialize SSO resources");
454 : 0 : return -ENODEV;
455 : : }
456 : :
457 : 0 : rc = cnxk_sso_xaq_allocate(dev);
458 [ # # ]: 0 : if (rc < 0)
459 : 0 : goto cnxk_rsrc_fini;
460 : :
461 [ # # # ]: 0 : dev->gw_mode = cnxk_sso_hws_preschedule_get(event_dev->data->dev_conf.preschedule_type);
462 : :
463 : 0 : rc = cnxk_setup_event_ports(event_dev, cn20k_sso_init_hws_mem, cn20k_sso_hws_setup);
464 [ # # ]: 0 : if (rc < 0)
465 : 0 : goto cnxk_rsrc_fini;
466 : :
467 : : /* Restore any prior port-queue mapping. */
468 : 0 : cnxk_sso_restore_links(event_dev, cn20k_sso_hws_link);
469 : :
470 : 0 : dev->configured = 1;
471 : : rte_mb();
472 : :
473 : 0 : return 0;
474 : 0 : cnxk_rsrc_fini:
475 : 0 : roc_sso_rsrc_fini(&dev->sso);
476 : 0 : dev->nb_event_ports = 0;
477 : 0 : return rc;
478 : : }
479 : :
480 : : static int
481 : 0 : cn20k_sso_port_setup(struct rte_eventdev *event_dev, uint8_t port_id,
482 : : const struct rte_event_port_conf *port_conf)
483 : : {
484 : :
485 : : RTE_SET_USED(port_conf);
486 : 0 : return cnxk_sso_port_setup(event_dev, port_id, cn20k_sso_hws_setup);
487 : : }
488 : :
489 : : static void
490 [ # # ]: 0 : cn20k_sso_port_release(void *port)
491 : : {
492 : : struct cnxk_sso_hws_cookie *gws_cookie = cnxk_sso_hws_get_cookie(port);
493 : : struct cnxk_sso_evdev *dev;
494 : :
495 [ # # ]: 0 : if (port == NULL)
496 : : return;
497 : :
498 [ # # ]: 0 : dev = cnxk_sso_pmd_priv(gws_cookie->event_dev);
499 [ # # ]: 0 : if (!gws_cookie->configured)
500 : 0 : goto free;
501 : :
502 : 0 : cn20k_sso_hws_release(dev, port);
503 : : memset(gws_cookie, 0, sizeof(*gws_cookie));
504 : 0 : free:
505 : 0 : rte_free(gws_cookie);
506 : : }
507 : :
508 : : static void
509 [ # # ]: 0 : cn20k_sso_port_quiesce(struct rte_eventdev *event_dev, void *port,
510 : : rte_eventdev_port_flush_t flush_cb, void *args)
511 : : {
512 : : struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
513 : : struct cn20k_sso_hws *ws = port;
514 : : struct rte_event ev;
515 : : uint64_t ptag;
516 : : bool is_pend;
517 : :
518 : : is_pend = false;
519 : : /* Work in WQE0 is always consumed, unless its a SWTAG. */
520 [ # # ]: 0 : ptag = plt_read64(ws->base + SSOW_LF_GWS_PENDSTATE);
521 [ # # # # ]: 0 : if (ptag & (BIT_ULL(62) | BIT_ULL(54)) || ws->swtag_req)
522 : : is_pend = true;
523 : : do {
524 : : ptag = plt_read64(ws->base + SSOW_LF_GWS_PENDSTATE);
525 [ # # ]: 0 : } while (ptag & (BIT_ULL(62) | BIT_ULL(58) | BIT_ULL(56) | BIT_ULL(54)));
526 : :
527 : 0 : cn20k_sso_hws_get_work_empty(ws, &ev, dev->rx_offloads);
528 [ # # # # ]: 0 : if (is_pend && ev.u64)
529 [ # # ]: 0 : if (flush_cb)
530 : 0 : flush_cb(event_dev->data->dev_id, ev, args);
531 [ # # ]: 0 : ptag = (plt_read64(ws->base + SSOW_LF_GWS_TAG) >> 32) & SSO_TT_EMPTY;
532 [ # # ]: 0 : if (ptag != SSO_TT_EMPTY)
533 : : cnxk_sso_hws_swtag_flush(ws->base);
534 : :
535 : : do {
536 [ # # ]: 0 : ptag = plt_read64(ws->base + SSOW_LF_GWS_PENDSTATE);
537 [ # # ]: 0 : } while (ptag & BIT_ULL(56));
538 : :
539 : : /* Check if we have work in PRF_WQE0, if so extract it. */
540 [ # # ]: 0 : switch (dev->gw_mode) {
541 : : case CNXK_GW_MODE_PREF:
542 : : case CNXK_GW_MODE_PREF_WFE:
543 [ # # ]: 0 : while (plt_read64(ws->base + SSOW_LF_GWS_PRF_WQE0) & BIT_ULL(63))
544 : : ;
545 : : break;
546 : : case CNXK_GW_MODE_NONE:
547 : : default:
548 : : break;
549 : : }
550 : :
551 [ # # ]: 0 : if (CNXK_TT_FROM_TAG(plt_read64(ws->base + SSOW_LF_GWS_PRF_WQE0)) != SSO_TT_EMPTY) {
552 : 0 : plt_write64(BIT_ULL(16) | 1, ws->base + SSOW_LF_GWS_OP_GET_WORK0);
553 : 0 : cn20k_sso_hws_get_work_empty(ws, &ev, dev->rx_offloads);
554 [ # # ]: 0 : if (ev.u64) {
555 [ # # ]: 0 : if (flush_cb)
556 : 0 : flush_cb(event_dev->data->dev_id, ev, args);
557 : : }
558 : 0 : cnxk_sso_hws_swtag_flush(ws->base);
559 : : do {
560 [ # # ]: 0 : ptag = plt_read64(ws->base + SSOW_LF_GWS_PENDSTATE);
561 [ # # ]: 0 : } while (ptag & BIT_ULL(56));
562 : : }
563 : 0 : ws->swtag_req = 0;
564 : 0 : plt_write64(0, ws->base + SSOW_LF_GWS_OP_GWC_INVAL);
565 : 0 : }
566 : :
567 : : static int
568 : 0 : cn20k_sso_port_link_profile(struct rte_eventdev *event_dev, void *port, const uint8_t queues[],
569 : : const uint8_t priorities[], uint16_t nb_links, uint8_t profile)
570 : 0 : {
571 : : struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
572 : 0 : uint16_t hwgrp_ids[nb_links];
573 : : uint16_t link;
574 : :
575 : : RTE_SET_USED(priorities);
576 [ # # ]: 0 : for (link = 0; link < nb_links; link++)
577 : 0 : hwgrp_ids[link] = queues[link];
578 : 0 : nb_links = cn20k_sso_hws_link(dev, port, hwgrp_ids, nb_links, profile);
579 : :
580 : 0 : return (int)nb_links;
581 : : }
582 : :
583 : : static int
584 : 0 : cn20k_sso_port_unlink_profile(struct rte_eventdev *event_dev, void *port, uint8_t queues[],
585 : : uint16_t nb_unlinks, uint8_t profile)
586 : 0 : {
587 : : struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
588 : 0 : uint16_t hwgrp_ids[nb_unlinks];
589 : : uint16_t unlink;
590 : :
591 [ # # ]: 0 : for (unlink = 0; unlink < nb_unlinks; unlink++)
592 : 0 : hwgrp_ids[unlink] = queues[unlink];
593 : 0 : nb_unlinks = cn20k_sso_hws_unlink(dev, port, hwgrp_ids, nb_unlinks, profile);
594 : :
595 : 0 : return (int)nb_unlinks;
596 : : }
597 : :
598 : : static int
599 : 0 : cn20k_sso_port_link(struct rte_eventdev *event_dev, void *port, const uint8_t queues[],
600 : : const uint8_t priorities[], uint16_t nb_links)
601 : : {
602 : 0 : return cn20k_sso_port_link_profile(event_dev, port, queues, priorities, nb_links, 0);
603 : : }
604 : :
605 : : static int
606 : 0 : cn20k_sso_port_unlink(struct rte_eventdev *event_dev, void *port, uint8_t queues[],
607 : : uint16_t nb_unlinks)
608 : : {
609 : 0 : return cn20k_sso_port_unlink_profile(event_dev, port, queues, nb_unlinks, 0);
610 : : }
611 : :
612 : : static int
613 : 0 : cn20k_sso_start(struct rte_eventdev *event_dev)
614 : : {
615 : : struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
616 : : uint8_t hws[RTE_EVENT_MAX_PORTS_PER_DEV];
617 : : int rc, i;
618 : :
619 : 0 : cnxk_sso_configure_queue_stash(event_dev);
620 : 0 : rc = cnxk_sso_start(event_dev, cnxk_sso_hws_reset, cn20k_sso_hws_flush_events);
621 [ # # ]: 0 : if (rc < 0)
622 : : return rc;
623 : : cn20k_sso_fp_fns_set(event_dev);
624 [ # # ]: 0 : for (i = 0; i < event_dev->data->nb_ports; i++)
625 : 0 : hws[i] = i;
626 : 0 : roc_sso_hws_gwc_invalidate(&dev->sso, hws, event_dev->data->nb_ports);
627 : :
628 : 0 : return rc;
629 : : }
630 : :
631 : : static void
632 : 0 : cn20k_sso_stop(struct rte_eventdev *event_dev)
633 : : {
634 : : struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
635 : : uint8_t hws[RTE_EVENT_MAX_PORTS_PER_DEV];
636 : : int i;
637 : :
638 [ # # ]: 0 : for (i = 0; i < event_dev->data->nb_ports; i++)
639 : 0 : hws[i] = i;
640 : 0 : roc_sso_hws_gwc_invalidate(&dev->sso, hws, event_dev->data->nb_ports);
641 : 0 : cnxk_sso_stop(event_dev, cnxk_sso_hws_reset, cn20k_sso_hws_flush_events);
642 : 0 : }
643 : :
644 : : static int
645 : 0 : cn20k_sso_close(struct rte_eventdev *event_dev)
646 : : {
647 : 0 : return cnxk_sso_close(event_dev, cn20k_sso_hws_unlink);
648 : : }
649 : :
650 : : static int
651 : 0 : cn20k_sso_selftest(void)
652 : : {
653 : 0 : return cnxk_sso_selftest(RTE_STR(event_cn20k));
654 : : }
655 : :
656 : : static int
657 : 0 : cn20k_sso_rx_adapter_caps_get(const struct rte_eventdev *event_dev,
658 : : const struct rte_eth_dev *eth_dev, uint32_t *caps)
659 : : {
660 : : int rc;
661 : :
662 : : RTE_SET_USED(event_dev);
663 : 0 : rc = strncmp(eth_dev->device->driver->name, "net_cn20k", 9);
664 [ # # ]: 0 : if (rc)
665 : 0 : *caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
666 : : else
667 : 0 : *caps = RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT |
668 : : RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ |
669 : : RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID |
670 : : RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR;
671 : :
672 : 0 : return 0;
673 : : }
674 : :
675 : : static void
676 : 0 : cn20k_sso_set_priv_mem(const struct rte_eventdev *event_dev, void *lookup_mem)
677 : : {
678 : : struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
679 : : int i;
680 : :
681 [ # # # # : 0 : for (i = 0; i < dev->nb_event_ports; i++) {
# # # # ]
682 : 0 : struct cn20k_sso_hws *ws = event_dev->data->ports[i];
683 : 0 : ws->xaq_lmt = dev->xaq_lmt;
684 : 0 : ws->fc_mem = (int64_t __rte_atomic *)dev->fc_iova;
685 : 0 : ws->tstamp = dev->tstamp;
686 [ # # # # : 0 : if (lookup_mem)
# # ]
687 : 0 : ws->lookup_mem = lookup_mem;
688 : : }
689 : 0 : }
690 : :
691 : : static void
692 : : eventdev_fops_tstamp_update(struct rte_eventdev *event_dev)
693 : : {
694 : 0 : struct rte_event_fp_ops *fp_op = rte_event_fp_ops + event_dev->data->dev_id;
695 : :
696 : 0 : fp_op->dequeue_burst = event_dev->dequeue_burst;
697 : 0 : }
698 : :
699 : : static void
700 : 0 : cn20k_sso_tstamp_hdl_update(uint16_t port_id, uint16_t flags, bool ptp_en)
701 : : {
702 : 0 : struct rte_eth_dev *dev = &rte_eth_devices[port_id];
703 : 0 : struct cnxk_eth_dev *cnxk_eth_dev = dev->data->dev_private;
704 [ # # ]: 0 : struct rte_eventdev *event_dev = cnxk_eth_dev->evdev_priv;
705 : : struct cnxk_sso_evdev *evdev = cnxk_sso_pmd_priv(event_dev);
706 : :
707 : 0 : evdev->rx_offloads |= flags;
708 [ # # ]: 0 : if (ptp_en)
709 : 0 : evdev->tstamp[port_id] = &cnxk_eth_dev->tstamp;
710 : : else
711 : 0 : evdev->tstamp[port_id] = NULL;
712 : : cn20k_sso_fp_fns_set((struct rte_eventdev *)(uintptr_t)event_dev);
713 : : eventdev_fops_tstamp_update(event_dev);
714 : 0 : }
715 : :
716 : : static void
717 : 0 : cn20k_sso_rx_offload_cb(uint16_t port_id, uint64_t flags)
718 : : {
719 : 0 : struct rte_eth_dev *dev = &rte_eth_devices[port_id];
720 : 0 : struct cnxk_eth_dev *cnxk_eth_dev = dev->data->dev_private;
721 : 0 : struct rte_eventdev *event_dev = cnxk_eth_dev->evdev_priv;
722 : : struct cnxk_sso_evdev *evdev;
723 : :
724 [ # # ]: 0 : if (event_dev == NULL)
725 : : return;
726 : :
727 : : evdev = cnxk_sso_pmd_priv(event_dev);
728 : 0 : evdev->rx_offloads |= flags;
729 : : cn20k_sso_fp_fns_set((struct rte_eventdev *)(uintptr_t)event_dev);
730 : : eventdev_fops_tstamp_update(event_dev);
731 : : }
732 : :
733 : : static int
734 : 0 : cn20k_sso_rxq_enable(struct cnxk_eth_dev *cnxk_eth_dev, uint16_t rq_id, uint16_t port_id,
735 : : const struct rte_event_eth_rx_adapter_queue_conf *queue_conf, int agq)
736 : : {
737 : : struct roc_nix_rq *rq;
738 : : uint32_t tag_mask;
739 : : uint16_t wqe_skip;
740 : : uint8_t tt;
741 : : int rc;
742 : :
743 : 0 : rq = &cnxk_eth_dev->rqs[rq_id];
744 [ # # ]: 0 : if (queue_conf->rx_queue_flags & RTE_EVENT_ETH_RX_ADAPTER_QUEUE_EVENT_VECTOR) {
745 : 0 : tag_mask = agq;
746 : : tt = SSO_TT_AGG;
747 : 0 : rq->flow_tag_width = 0;
748 : : } else {
749 : 0 : tag_mask = (port_id & 0xFF) << 20;
750 : : tag_mask |= (RTE_EVENT_TYPE_ETHDEV << 28);
751 : 0 : tt = queue_conf->ev.sched_type;
752 : 0 : rq->flow_tag_width = 20;
753 [ # # ]: 0 : if (queue_conf->rx_queue_flags & RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID) {
754 : 0 : rq->flow_tag_width = 0;
755 : 0 : tag_mask |= queue_conf->ev.flow_id;
756 : : }
757 : : }
758 : :
759 : 0 : rq->tag_mask = tag_mask;
760 : 0 : rq->sso_ena = 1;
761 : 0 : rq->tt = tt;
762 : 0 : rq->hwgrp = queue_conf->ev.queue_id;
763 : : wqe_skip = RTE_ALIGN_CEIL(sizeof(struct rte_mbuf), ROC_CACHE_LINE_SZ);
764 : : wqe_skip = wqe_skip / ROC_CACHE_LINE_SZ;
765 : 0 : rq->wqe_skip = wqe_skip;
766 : :
767 : 0 : rc = roc_nix_rq_modify(&cnxk_eth_dev->nix, rq, 0);
768 : 0 : return rc;
769 : : }
770 : :
771 : : static int
772 : 0 : cn20k_sso_rx_adapter_vwqe_enable(struct cnxk_sso_evdev *dev, uint16_t port_id, uint16_t rq_id,
773 : : const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
774 : : {
775 : : uint32_t agq, tag_mask, stag_mask;
776 : : struct roc_sso_agq_data data;
777 : : int rc;
778 : :
779 : 0 : tag_mask = (port_id & 0xff) << 20;
780 [ # # ]: 0 : if (queue_conf->rx_queue_flags & RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID)
781 : 0 : tag_mask |= queue_conf->ev.flow_id;
782 : : else
783 : 0 : tag_mask |= rq_id;
784 : :
785 : : stag_mask = tag_mask;
786 [ # # ]: 0 : tag_mask |= RTE_EVENT_TYPE_ETHDEV_VECTOR << 28;
787 : : stag_mask |= RTE_EVENT_TYPE_ETHDEV << 28;
788 : :
789 : : memset(&data, 0, sizeof(struct roc_sso_agq_data));
790 : 0 : data.tag = tag_mask;
791 : 0 : data.tt = queue_conf->ev.sched_type;
792 : 0 : data.stag = stag_mask;
793 [ # # ]: 0 : data.vwqe_aura = roc_npa_aura_handle_to_aura(queue_conf->vector_mp->pool_id);
794 [ # # ]: 0 : data.vwqe_max_sz_exp = rte_log2_u32(queue_conf->vector_sz);
795 : 0 : data.vwqe_wait_tmo = queue_conf->vector_timeout_ns / ((SSO_AGGR_DEF_TMO + 1) * 100);
796 : : data.xqe_type = 0;
797 : :
798 : 0 : agq = UINT32_MAX;
799 : 0 : rc = roc_sso_hwgrp_agq_alloc(&dev->sso, queue_conf->ev.queue_id, &data, &agq);
800 [ # # ]: 0 : if (rc < 0)
801 : : return rc;
802 : :
803 : 0 : return agq;
804 : : }
805 : :
806 : : static int
807 : 0 : cn20k_rx_adapter_queue_del(const struct rte_eventdev *event_dev, const struct rte_eth_dev *eth_dev,
808 : : int32_t rx_queue_id)
809 : : {
810 [ # # ]: 0 : struct cnxk_eth_dev *cnxk_eth_dev = eth_dev->data->dev_private;
811 : : struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
812 : : struct roc_nix_rq *rxq;
813 : : int i, rc = 0;
814 : :
815 : : RTE_SET_USED(event_dev);
816 [ # # ]: 0 : if (rx_queue_id < 0) {
817 [ # # ]: 0 : for (i = 0; i < eth_dev->data->nb_rx_queues; i++)
818 : 0 : cn20k_rx_adapter_queue_del(event_dev, eth_dev, i);
819 : : } else {
820 : 0 : rxq = &cnxk_eth_dev->rqs[rx_queue_id];
821 [ # # ]: 0 : if (rxq->tt == SSO_TT_AGG)
822 : 0 : roc_sso_hwgrp_agq_free(&dev->sso, rxq->hwgrp, rxq->tag_mask);
823 : 0 : rc = cnxk_sso_rxq_disable(eth_dev, (uint16_t)rx_queue_id);
824 : 0 : cnxk_eth_dev->nb_rxq_sso--;
825 : : }
826 : :
827 [ # # ]: 0 : if (rc < 0)
828 : 0 : plt_err("Failed to clear Rx adapter config port=%d, q=%d", eth_dev->data->port_id,
829 : : rx_queue_id);
830 : 0 : return rc;
831 : : }
832 : :
833 : : static int
834 : 0 : cn20k_rx_adapter_queues_add(const struct rte_eventdev *event_dev, const struct rte_eth_dev *eth_dev,
835 : : int32_t rx_queue_id[],
836 : : const struct rte_event_eth_rx_adapter_queue_conf queue_conf[],
837 : : uint16_t nb_rx_queues)
838 : : {
839 [ # # ]: 0 : struct cnxk_eth_dev *cnxk_eth_dev = eth_dev->data->dev_private;
840 : : struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
841 : : const struct rte_event_eth_rx_adapter_queue_conf *conf;
842 : 0 : uint64_t old_xae_cnt = dev->adptr_xae_cnt;
843 : 0 : uint16_t port = eth_dev->data->port_id;
844 : : struct cnxk_eth_rxq_sp *rxq_sp;
845 : : uint16_t max_rx_queues;
846 : : int i, rc = 0, agq = 0;
847 : : int32_t queue_id;
848 : :
849 [ # # ]: 0 : max_rx_queues = nb_rx_queues ? nb_rx_queues : eth_dev->data->nb_rx_queues;
850 [ # # ]: 0 : for (i = 0; i < max_rx_queues; i++) {
851 [ # # ]: 0 : conf = nb_rx_queues ? &queue_conf[i] : &queue_conf[0];
852 [ # # ]: 0 : queue_id = nb_rx_queues ? rx_queue_id[i] : i;
853 : 0 : rxq_sp = cnxk_eth_rxq_to_sp(eth_dev->data->rx_queues[queue_id]);
854 : 0 : cnxk_sso_updt_xae_cnt(dev, rxq_sp, RTE_EVENT_TYPE_ETHDEV);
855 : :
856 [ # # ]: 0 : if (conf->rx_queue_flags & RTE_EVENT_ETH_RX_ADAPTER_QUEUE_EVENT_VECTOR)
857 : 0 : cnxk_sso_updt_xae_cnt(dev, conf->vector_mp, RTE_EVENT_TYPE_ETHDEV_VECTOR);
858 : : }
859 : :
860 [ # # ]: 0 : if (dev->adptr_xae_cnt != old_xae_cnt) {
861 : 0 : rc = cnxk_sso_xae_reconfigure((struct rte_eventdev *)(uintptr_t)event_dev);
862 [ # # ]: 0 : if (rc < 0)
863 : : return rc;
864 : : }
865 : :
866 [ # # ]: 0 : for (i = 0; i < max_rx_queues; i++) {
867 [ # # ]: 0 : conf = nb_rx_queues ? &queue_conf[i] : &queue_conf[0];
868 [ # # ]: 0 : queue_id = nb_rx_queues ? rx_queue_id[i] : i;
869 [ # # ]: 0 : if (conf->rx_queue_flags & RTE_EVENT_ETH_RX_ADAPTER_QUEUE_EVENT_VECTOR) {
870 : 0 : rc = cn20k_sso_rx_adapter_vwqe_enable(dev, port, queue_id, conf);
871 [ # # ]: 0 : if (rc < 0) {
872 : 0 : plt_err("Failed to enable VWQE, port=%d, rxq=%d", port, queue_id);
873 : 0 : goto fail;
874 : : }
875 : :
876 : : agq = rc;
877 : : }
878 : :
879 : 0 : rc = cn20k_sso_rxq_enable(cnxk_eth_dev, (uint16_t)queue_id, port, conf, agq);
880 [ # # ]: 0 : if (rc < 0) {
881 : 0 : plt_err("Failed to enable Rx queue, port=%d, rxq=%d", port, queue_id);
882 : 0 : goto fail;
883 : : }
884 : :
885 : 0 : cnxk_eth_dev->nb_rxq_sso++;
886 : : }
887 : :
888 : : /* Propagate force bp devarg */
889 : 0 : cnxk_eth_dev->nix.force_rx_aura_bp = dev->force_ena_bp;
890 : 0 : cnxk_sso_tstamp_cfg(port, eth_dev, dev);
891 : 0 : dev->rx_offloads |= cnxk_eth_dev->rx_offload_flags;
892 : 0 : return 0;
893 : :
894 : 0 : fail:
895 [ # # ]: 0 : for (i = cnxk_eth_dev->nb_rxq_sso - 1; i >= 0; i--) {
896 [ # # ]: 0 : queue_id = nb_rx_queues ? rx_queue_id[i] : i;
897 : 0 : cn20k_rx_adapter_queue_del(event_dev, eth_dev, queue_id);
898 : : }
899 : :
900 : : return rc;
901 : : }
902 : :
903 : : static int
904 : 0 : cn20k_sso_configure_queue_stash_default(struct cnxk_sso_evdev *dev, uint16_t hwgrp)
905 : : {
906 : : struct roc_sso_hwgrp_stash stash;
907 : : int rc;
908 : :
909 : 0 : stash.hwgrp = hwgrp;
910 : 0 : stash.stash_offset = CN20K_SSO_DEFAULT_STASH_OFFSET;
911 : 0 : stash.stash_count = CN20K_SSO_DEFAULT_STASH_LENGTH;
912 : 0 : rc = roc_sso_hwgrp_stash_config(&dev->sso, &stash, 1);
913 [ # # ]: 0 : if (rc < 0)
914 : 0 : plt_warn("failed to configure HWGRP WQE stashing rc = %d", rc);
915 : :
916 : 0 : return rc;
917 : : }
918 : :
919 : : static int
920 : 0 : cn20k_sso_rx_adapter_queue_add(const struct rte_eventdev *event_dev,
921 : : const struct rte_eth_dev *eth_dev, int32_t rx_queue_id,
922 : : const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
923 : : {
924 [ # # ]: 0 : struct cnxk_eth_dev *cnxk_eth_dev = eth_dev->data->dev_private;
925 : : struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
926 : : struct cn20k_eth_rxq *rxq;
927 : : uint16_t nb_rx_queues;
928 : : void *lookup_mem;
929 : : int rc;
930 : :
931 : 0 : rc = strncmp(eth_dev->device->driver->name, "net_cn20k", 8);
932 [ # # ]: 0 : if (rc)
933 : : return -EINVAL;
934 : :
935 : 0 : nb_rx_queues = rx_queue_id == -1 ? 0 : 1;
936 : 0 : rc = cn20k_rx_adapter_queues_add(event_dev, eth_dev, &rx_queue_id, queue_conf,
937 : : nb_rx_queues);
938 [ # # ]: 0 : if (rc)
939 : : return -EINVAL;
940 : :
941 : 0 : cnxk_eth_dev->cnxk_sso_ptp_tstamp_cb = cn20k_sso_tstamp_hdl_update;
942 : 0 : cnxk_eth_dev->evdev_priv = (struct rte_eventdev *)(uintptr_t)event_dev;
943 : :
944 : 0 : rxq = eth_dev->data->rx_queues[0];
945 : 0 : lookup_mem = rxq->lookup_mem;
946 : : cn20k_sso_set_priv_mem(event_dev, lookup_mem);
947 : : cn20k_sso_fp_fns_set((struct rte_eventdev *)(uintptr_t)event_dev);
948 [ # # # # ]: 0 : if (roc_feature_sso_has_stash() && dev->nb_event_ports > 1)
949 : 0 : rc = cn20k_sso_configure_queue_stash_default(dev, queue_conf->ev.queue_id);
950 : :
951 : : return rc;
952 : : }
953 : :
954 : : static int
955 : 0 : cn20k_sso_rx_adapter_queues_add(const struct rte_eventdev *event_dev,
956 : : const struct rte_eth_dev *eth_dev, int32_t rx_queue_id[],
957 : : const struct rte_event_eth_rx_adapter_queue_conf queue_conf[],
958 : : uint16_t nb_rx_queues)
959 : : {
960 [ # # ]: 0 : struct cnxk_eth_dev *cnxk_eth_dev = eth_dev->data->dev_private;
961 : : struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
962 : : struct cn20k_eth_rxq *rxq;
963 : : void *lookup_mem;
964 : : int rc, i;
965 : :
966 : 0 : rc = strncmp(eth_dev->device->driver->name, "net_cn20k", 8);
967 [ # # ]: 0 : if (rc)
968 : : return -EINVAL;
969 : :
970 : 0 : rc = cn20k_rx_adapter_queues_add(event_dev, eth_dev, rx_queue_id, queue_conf, nb_rx_queues);
971 [ # # ]: 0 : if (rc)
972 : : return -EINVAL;
973 : :
974 : 0 : cnxk_eth_dev->cnxk_sso_ptp_tstamp_cb = cn20k_sso_tstamp_hdl_update;
975 : 0 : cnxk_eth_dev->evdev_priv = (struct rte_eventdev *)(uintptr_t)event_dev;
976 : :
977 : 0 : rxq = eth_dev->data->rx_queues[0];
978 : 0 : lookup_mem = rxq->lookup_mem;
979 : : cn20k_sso_set_priv_mem(event_dev, lookup_mem);
980 : : cn20k_sso_fp_fns_set((struct rte_eventdev *)(uintptr_t)event_dev);
981 [ # # # # ]: 0 : if (roc_feature_sso_has_stash() && dev->nb_event_ports > 1) {
982 : 0 : uint16_t hwgrp = dev->sso.max_hwgrp;
983 : :
984 [ # # ]: 0 : if (nb_rx_queues == 0)
985 : 0 : rc = cn20k_sso_configure_queue_stash_default(dev,
986 : 0 : queue_conf[0].ev.queue_id);
987 : :
988 [ # # ]: 0 : for (i = 0; i < nb_rx_queues; i++) {
989 [ # # ]: 0 : if (hwgrp == queue_conf[i].ev.queue_id)
990 : 0 : continue;
991 : :
992 : : hwgrp = queue_conf[i].ev.queue_id;
993 : 0 : rc = cn20k_sso_configure_queue_stash_default(dev, hwgrp);
994 [ # # ]: 0 : if (rc < 0)
995 : : break;
996 : : }
997 : : }
998 : :
999 : : return rc;
1000 : : }
1001 : :
1002 : : static int
1003 : 0 : cn20k_sso_rx_adapter_queue_del(const struct rte_eventdev *event_dev,
1004 : : const struct rte_eth_dev *eth_dev, int32_t rx_queue_id)
1005 : : {
1006 : : int rc;
1007 : :
1008 : 0 : rc = strncmp(eth_dev->device->driver->name, "net_cn20k", 8);
1009 [ # # ]: 0 : if (rc)
1010 : : return -EINVAL;
1011 : :
1012 : 0 : return cn20k_rx_adapter_queue_del(event_dev, eth_dev, rx_queue_id);
1013 : : }
1014 : :
1015 : : static int
1016 : 0 : cn20k_sso_rx_adapter_vector_limits(const struct rte_eventdev *dev,
1017 : : const struct rte_eth_dev *eth_dev,
1018 : : struct rte_event_eth_rx_adapter_vector_limits *limits)
1019 : : {
1020 : : int ret;
1021 : :
1022 : : RTE_SET_USED(dev);
1023 : : RTE_SET_USED(eth_dev);
1024 : 0 : ret = strncmp(eth_dev->device->driver->name, "net_cn20k", 8);
1025 [ # # ]: 0 : if (ret)
1026 : : return -ENOTSUP;
1027 : :
1028 : 0 : limits->log2_sz = true;
1029 : 0 : limits->min_sz = 1 << ROC_NIX_VWQE_MIN_SIZE_LOG2;
1030 : 0 : limits->max_sz = 1 << ROC_NIX_VWQE_MAX_SIZE_LOG2;
1031 : 0 : limits->min_timeout_ns = (SSO_AGGR_DEF_TMO + 1) * 100;
1032 : 0 : limits->max_timeout_ns = (BITMASK_ULL(11, 0) + 1) * limits->min_timeout_ns;
1033 : :
1034 : 0 : return 0;
1035 : : }
1036 : :
1037 : : static int
1038 : 0 : cn20k_sso_tx_adapter_caps_get(const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev,
1039 : : uint32_t *caps)
1040 : : {
1041 : : int ret;
1042 : :
1043 : : RTE_SET_USED(dev);
1044 : 0 : ret = strncmp(eth_dev->device->driver->name, "net_cn20k", 8);
1045 [ # # ]: 0 : if (ret)
1046 : 0 : *caps = 0;
1047 : : else
1048 : 0 : *caps = RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT |
1049 : : RTE_EVENT_ETH_TX_ADAPTER_CAP_EVENT_VECTOR;
1050 : :
1051 : 0 : return 0;
1052 : : }
1053 : :
1054 : : static void
1055 : 0 : cn20k_sso_txq_fc_update(const struct rte_eth_dev *eth_dev, int32_t tx_queue_id)
1056 : : {
1057 : 0 : struct cnxk_eth_dev *cnxk_eth_dev = eth_dev->data->dev_private;
1058 : : struct cn20k_eth_txq *txq;
1059 : : struct roc_nix_sq *sq;
1060 : : int i;
1061 : :
1062 [ # # ]: 0 : if (tx_queue_id < 0) {
1063 [ # # ]: 0 : for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
1064 : 0 : cn20k_sso_txq_fc_update(eth_dev, i);
1065 : : } else {
1066 : : uint16_t sqes_per_sqb;
1067 : :
1068 : 0 : sq = &cnxk_eth_dev->sqs[tx_queue_id];
1069 : 0 : txq = eth_dev->data->tx_queues[tx_queue_id];
1070 : 0 : sqes_per_sqb = 1U << txq->sqes_per_sqb_log2;
1071 [ # # ]: 0 : if (cnxk_eth_dev->tx_offloads & RTE_ETH_TX_OFFLOAD_SECURITY)
1072 : 0 : sq->nb_sqb_bufs_adj -= (cnxk_eth_dev->outb.nb_desc / sqes_per_sqb);
1073 : 0 : txq->nb_sqb_bufs_adj = sq->nb_sqb_bufs_adj;
1074 : : }
1075 : 0 : }
1076 : :
1077 : : static int
1078 : 0 : cn20k_sso_tx_adapter_queue_add(uint8_t id, const struct rte_eventdev *event_dev,
1079 : : const struct rte_eth_dev *eth_dev, int32_t tx_queue_id)
1080 : : {
1081 : 0 : struct cnxk_eth_dev *cnxk_eth_dev = eth_dev->data->dev_private;
1082 : : struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
1083 : : uint64_t tx_offloads;
1084 : : int rc;
1085 : :
1086 : : RTE_SET_USED(id);
1087 : 0 : rc = cnxk_sso_tx_adapter_queue_add(event_dev, eth_dev, tx_queue_id);
1088 [ # # ]: 0 : if (rc < 0)
1089 : : return rc;
1090 : :
1091 : : /* Can't enable tstamp if all the ports don't have it enabled. */
1092 : 0 : tx_offloads = cnxk_eth_dev->tx_offload_flags;
1093 [ # # ]: 0 : if (dev->tx_adptr_configured) {
1094 : 0 : uint8_t tstmp_req = !!(tx_offloads & NIX_TX_OFFLOAD_TSTAMP_F);
1095 : 0 : uint8_t tstmp_ena = !!(dev->tx_offloads & NIX_TX_OFFLOAD_TSTAMP_F);
1096 : :
1097 [ # # ]: 0 : if (tstmp_ena && !tstmp_req)
1098 : 0 : dev->tx_offloads &= ~(NIX_TX_OFFLOAD_TSTAMP_F);
1099 [ # # ]: 0 : else if (!tstmp_ena && tstmp_req)
1100 : 0 : tx_offloads &= ~(NIX_TX_OFFLOAD_TSTAMP_F);
1101 : : }
1102 : :
1103 : 0 : dev->tx_offloads |= tx_offloads;
1104 : 0 : cn20k_sso_txq_fc_update(eth_dev, tx_queue_id);
1105 : 0 : rc = cn20k_sso_updt_tx_adptr_data(event_dev);
1106 [ # # ]: 0 : if (rc < 0)
1107 : : return rc;
1108 : : cn20k_sso_fp_fns_set((struct rte_eventdev *)(uintptr_t)event_dev);
1109 : 0 : dev->tx_adptr_configured = 1;
1110 : :
1111 : 0 : return 0;
1112 : : }
1113 : :
1114 : : static int
1115 : 0 : cn20k_sso_tx_adapter_queue_del(uint8_t id, const struct rte_eventdev *event_dev,
1116 : : const struct rte_eth_dev *eth_dev, int32_t tx_queue_id)
1117 : : {
1118 : : int rc;
1119 : :
1120 : : RTE_SET_USED(id);
1121 : 0 : rc = cnxk_sso_tx_adapter_queue_del(event_dev, eth_dev, tx_queue_id);
1122 [ # # ]: 0 : if (rc < 0)
1123 : : return rc;
1124 : 0 : return cn20k_sso_updt_tx_adptr_data(event_dev);
1125 : : }
1126 : :
1127 : : static int
1128 : 0 : cn20k_crypto_adapter_caps_get(const struct rte_eventdev *event_dev,
1129 : : const struct rte_cryptodev *cdev, uint32_t *caps)
1130 : : {
1131 [ # # ]: 0 : CNXK_VALID_DEV_OR_ERR_RET(event_dev->device, "event_cn20k", ENOTSUP);
1132 [ # # ]: 0 : CNXK_VALID_DEV_OR_ERR_RET(cdev->device, "crypto_cn20k", ENOTSUP);
1133 : :
1134 : 0 : *caps = RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD |
1135 : : RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA |
1136 : : RTE_EVENT_CRYPTO_ADAPTER_CAP_EVENT_VECTOR;
1137 : :
1138 : 0 : return 0;
1139 : : }
1140 : :
1141 : : static int
1142 : 0 : cn20k_crypto_adapter_qp_add(const struct rte_eventdev *event_dev, const struct rte_cryptodev *cdev,
1143 : : int32_t queue_pair_id,
1144 : : const struct rte_event_crypto_adapter_queue_conf *conf)
1145 : : {
1146 : : int ret;
1147 : :
1148 [ # # ]: 0 : CNXK_VALID_DEV_OR_ERR_RET(event_dev->device, "event_cn20k", EINVAL);
1149 [ # # ]: 0 : CNXK_VALID_DEV_OR_ERR_RET(cdev->device, "crypto_cn20k", EINVAL);
1150 : :
1151 : : cn20k_sso_fp_fns_set((struct rte_eventdev *)(uintptr_t)event_dev);
1152 : :
1153 : 0 : ret = cnxk_crypto_adapter_qp_add(event_dev, cdev, queue_pair_id, conf);
1154 : : cn20k_sso_set_priv_mem(event_dev, NULL);
1155 : :
1156 : : return ret;
1157 : : }
1158 : :
1159 : : static int
1160 : 0 : cn20k_crypto_adapter_qp_del(const struct rte_eventdev *event_dev, const struct rte_cryptodev *cdev,
1161 : : int32_t queue_pair_id)
1162 : : {
1163 [ # # ]: 0 : CNXK_VALID_DEV_OR_ERR_RET(event_dev->device, "event_cn20k", EINVAL);
1164 [ # # ]: 0 : CNXK_VALID_DEV_OR_ERR_RET(cdev->device, "crypto_cn20k", EINVAL);
1165 : :
1166 : 0 : return cnxk_crypto_adapter_qp_del(cdev, queue_pair_id);
1167 : : }
1168 : :
1169 : : static int
1170 : 0 : cn20k_tim_caps_get(const struct rte_eventdev *evdev, uint64_t flags, uint32_t *caps,
1171 : : const struct event_timer_adapter_ops **ops)
1172 : : {
1173 : 0 : return cnxk_tim_caps_get(evdev, flags, caps, ops, cn20k_sso_set_priv_mem);
1174 : : }
1175 : :
1176 : : static int
1177 : 0 : cn20k_crypto_adapter_vec_limits(const struct rte_eventdev *event_dev,
1178 : : const struct rte_cryptodev *cdev,
1179 : : struct rte_event_crypto_adapter_vector_limits *limits)
1180 : : {
1181 [ # # ]: 0 : CNXK_VALID_DEV_OR_ERR_RET(event_dev->device, "event_cn20k", EINVAL);
1182 [ # # ]: 0 : CNXK_VALID_DEV_OR_ERR_RET(cdev->device, "crypto_cn20k", EINVAL);
1183 : :
1184 : 0 : limits->log2_sz = false;
1185 : 0 : limits->min_sz = 0;
1186 : 0 : limits->max_sz = UINT16_MAX;
1187 : : /* Unused timeout, in software implementation we aggregate all crypto
1188 : : * operations passed to the enqueue function
1189 : : */
1190 : 0 : limits->min_timeout_ns = 0;
1191 : 0 : limits->max_timeout_ns = 0;
1192 : :
1193 : 0 : return 0;
1194 : : }
1195 : :
1196 : : static struct eventdev_ops cn20k_sso_dev_ops = {
1197 : : .dev_infos_get = cn20k_sso_info_get,
1198 : : .dev_configure = cn20k_sso_dev_configure,
1199 : :
1200 : : .queue_def_conf = cnxk_sso_queue_def_conf,
1201 : : .queue_setup = cn20k_sso_queue_setup,
1202 : : .queue_release = cnxk_sso_queue_release,
1203 : : .queue_attr_set = cn20k_sso_queue_attribute_set,
1204 : :
1205 : : .port_def_conf = cnxk_sso_port_def_conf,
1206 : : .port_setup = cn20k_sso_port_setup,
1207 : : .port_release = cn20k_sso_port_release,
1208 : : .port_quiesce = cn20k_sso_port_quiesce,
1209 : : .port_link = cn20k_sso_port_link,
1210 : : .port_unlink = cn20k_sso_port_unlink,
1211 : : .port_link_profile = cn20k_sso_port_link_profile,
1212 : : .port_unlink_profile = cn20k_sso_port_unlink_profile,
1213 : : .timeout_ticks = cnxk_sso_timeout_ticks,
1214 : :
1215 : : .eth_rx_adapter_caps_get = cn20k_sso_rx_adapter_caps_get,
1216 : : .eth_rx_adapter_queue_add = cn20k_sso_rx_adapter_queue_add,
1217 : : .eth_rx_adapter_queues_add = cn20k_sso_rx_adapter_queues_add,
1218 : : .eth_rx_adapter_queue_del = cn20k_sso_rx_adapter_queue_del,
1219 : : .eth_rx_adapter_start = cnxk_sso_rx_adapter_start,
1220 : : .eth_rx_adapter_stop = cnxk_sso_rx_adapter_stop,
1221 : :
1222 : : .eth_rx_adapter_vector_limits_get = cn20k_sso_rx_adapter_vector_limits,
1223 : :
1224 : : .eth_tx_adapter_caps_get = cn20k_sso_tx_adapter_caps_get,
1225 : : .eth_tx_adapter_queue_add = cn20k_sso_tx_adapter_queue_add,
1226 : : .eth_tx_adapter_queue_del = cn20k_sso_tx_adapter_queue_del,
1227 : : .eth_tx_adapter_start = cnxk_sso_tx_adapter_start,
1228 : : .eth_tx_adapter_stop = cnxk_sso_tx_adapter_stop,
1229 : : .eth_tx_adapter_free = cnxk_sso_tx_adapter_free,
1230 : :
1231 : : .timer_adapter_caps_get = cn20k_tim_caps_get,
1232 : :
1233 : : .crypto_adapter_caps_get = cn20k_crypto_adapter_caps_get,
1234 : : .crypto_adapter_queue_pair_add = cn20k_crypto_adapter_qp_add,
1235 : : .crypto_adapter_queue_pair_del = cn20k_crypto_adapter_qp_del,
1236 : : .crypto_adapter_vector_limits_get = cn20k_crypto_adapter_vec_limits,
1237 : :
1238 : : .vector_adapter_caps_get = cnxk_vector_caps_get,
1239 : : .vector_adapter_info_get = cnxk_vector_info_get,
1240 : :
1241 : : .xstats_get = cnxk_sso_xstats_get,
1242 : : .xstats_reset = cnxk_sso_xstats_reset,
1243 : : .xstats_get_names = cnxk_sso_xstats_get_names,
1244 : :
1245 : : .dump = cnxk_sso_dump,
1246 : : .dev_start = cn20k_sso_start,
1247 : : .dev_stop = cn20k_sso_stop,
1248 : : .dev_close = cn20k_sso_close,
1249 : : .dev_selftest = cn20k_sso_selftest,
1250 : : };
1251 : :
1252 : : static int
1253 : 0 : cn20k_sso_init(struct rte_eventdev *event_dev)
1254 : : {
1255 : : struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
1256 : : int rc;
1257 : :
1258 : 0 : rc = roc_plt_init();
1259 [ # # ]: 0 : if (rc < 0) {
1260 : 0 : plt_err("Failed to initialize platform model");
1261 : 0 : return rc;
1262 : : }
1263 : :
1264 : 0 : cnxk_ethdev_rx_offload_cb_register(cn20k_sso_rx_offload_cb);
1265 : 0 : event_dev->dev_ops = &cn20k_sso_dev_ops;
1266 : : /* For secondary processes, the primary has done all the work */
1267 [ # # ]: 0 : if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
1268 : : cn20k_sso_fp_fns_set(event_dev);
1269 : : return 0;
1270 : : }
1271 : :
1272 : 0 : rc = cnxk_sso_init(event_dev);
1273 [ # # ]: 0 : if (rc < 0)
1274 : : return rc;
1275 : :
1276 : : cn20k_sso_set_rsrc(cnxk_sso_pmd_priv(event_dev));
1277 [ # # # # ]: 0 : if (!dev->max_event_ports || !dev->max_event_queues) {
1278 : 0 : plt_err("Not enough eventdev resource queues=%d ports=%d", dev->max_event_queues,
1279 : : dev->max_event_ports);
1280 : 0 : cnxk_sso_fini(event_dev);
1281 : 0 : return -ENODEV;
1282 : : }
1283 : :
1284 : 0 : plt_sso_dbg("Initializing %s max_queues=%d max_ports=%d", event_dev->data->name,
1285 : : dev->max_event_queues, dev->max_event_ports);
1286 : :
1287 : 0 : return 0;
1288 : : }
1289 : :
1290 : : static int
1291 : 0 : cn20k_sso_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
1292 : : {
1293 : 0 : return rte_event_pmd_pci_probe(pci_drv, pci_dev, sizeof(struct cnxk_sso_evdev),
1294 : : cn20k_sso_init);
1295 : : }
1296 : :
1297 : : static const struct rte_pci_id cn20k_pci_sso_map[] = {
1298 : : CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN20KA, PCI_DEVID_CNXK_RVU_SSO_TIM_PF),
1299 : : CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN20KA, PCI_DEVID_CNXK_RVU_SSO_TIM_VF),
1300 : : {
1301 : : .vendor_id = 0,
1302 : : },
1303 : : };
1304 : :
1305 : : static struct rte_pci_driver cn20k_pci_sso = {
1306 : : .id_table = cn20k_pci_sso_map,
1307 : : .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_NEED_IOVA_AS_VA,
1308 : : .probe = cn20k_sso_probe,
1309 : : .remove = cnxk_sso_remove,
1310 : : };
1311 : :
1312 : 303 : RTE_PMD_REGISTER_PCI(event_cn20k, cn20k_pci_sso);
1313 : : RTE_PMD_REGISTER_PCI_TABLE(event_cn20k, cn20k_pci_sso_map);
1314 : : RTE_PMD_REGISTER_KMOD_DEP(event_cn20k, "vfio-pci");
1315 : : RTE_PMD_REGISTER_PARAM_STRING(event_cn20k,
1316 : : CNXK_SSO_XAE_CNT "=<int>"
1317 : : CNXK_SSO_GGRP_QOS "=<string>"
1318 : : CNXK_SSO_STASH "=<string>"
1319 : : CNXK_SSO_FORCE_BP "=1"
1320 : : CNXK_TIM_DISABLE_NPA "=1"
1321 : : CNXK_TIM_CHNK_SLOTS "=<int>"
1322 : : CNXK_TIM_RINGS_LMT "=<int>"
1323 : : CNXK_TIM_STATS_ENA "=1"
1324 : : CNXK_TIM_EXT_CLK "=<string>");
|