96b95cccbe25b6668882bdf45c06af6869af3ad9
[dpdk.git] / drivers / net / sfc / sfc_ev.c
1 /*-
2  * Copyright (c) 2016 Solarflare Communications Inc.
3  * All rights reserved.
4  *
5  * This software was jointly developed between OKTET Labs (under contract
6  * for Solarflare) and Solarflare Communications, Inc.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice,
12  *    this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  *    this list of conditions and the following disclaimer in the documentation
15  *    and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
19  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
21  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29
30 #include <rte_debug.h>
31 #include <rte_cycles.h>
32 #include <rte_alarm.h>
33
34 #include "efx.h"
35
36 #include "sfc.h"
37 #include "sfc_debug.h"
38 #include "sfc_log.h"
39 #include "sfc_ev.h"
40 #include "sfc_rx.h"
41 #include "sfc_tx.h"
42
43
44 /* Initial delay when waiting for event queue init complete event */
45 #define SFC_EVQ_INIT_BACKOFF_START_US   (1)
46 /* Maximum delay between event queue polling attempts */
47 #define SFC_EVQ_INIT_BACKOFF_MAX_US     (10 * 1000)
48 /* Event queue init approx timeout */
49 #define SFC_EVQ_INIT_TIMEOUT_US         (2 * US_PER_S)
50
51 /* Management event queue polling period in microseconds */
52 #define SFC_MGMT_EV_QPOLL_PERIOD_US     (US_PER_S)
53
54
55 static boolean_t
56 sfc_ev_initialized(void *arg)
57 {
58         struct sfc_evq *evq = arg;
59
60         /* Init done events may be duplicated on SFN7xxx (SFC bug 31631) */
61         SFC_ASSERT(evq->init_state == SFC_EVQ_STARTING ||
62                    evq->init_state == SFC_EVQ_STARTED);
63
64         evq->init_state = SFC_EVQ_STARTED;
65
66         return B_FALSE;
67 }
68
69 static boolean_t
70 sfc_ev_rx(void *arg, __rte_unused uint32_t label, uint32_t id,
71           uint32_t size, uint16_t flags)
72 {
73         struct sfc_evq *evq = arg;
74         struct sfc_rxq *rxq;
75         unsigned int stop;
76         unsigned int pending_id;
77         unsigned int delta;
78         unsigned int i;
79         struct sfc_rx_sw_desc *rxd;
80
81         if (unlikely(evq->exception))
82                 goto done;
83
84         rxq = evq->rxq;
85
86         SFC_ASSERT(rxq != NULL);
87         SFC_ASSERT(rxq->evq == evq);
88         SFC_ASSERT(rxq->state & SFC_RXQ_STARTED);
89
90         stop = (id + 1) & rxq->ptr_mask;
91         pending_id = rxq->pending & rxq->ptr_mask;
92         delta = (stop >= pending_id) ? (stop - pending_id) :
93                 (rxq->ptr_mask + 1 - pending_id + stop);
94
95         if (delta == 0) {
96                 /*
97                  * Rx event with no new descriptors done and zero length
98                  * is used to abort scattered packet when there is no room
99                  * for the tail.
100                  */
101                 if (unlikely(size != 0)) {
102                         evq->exception = B_TRUE;
103                         sfc_err(evq->sa,
104                                 "EVQ %u RxQ %u invalid RX abort "
105                                 "(id=%#x size=%u flags=%#x); needs restart\n",
106                                 evq->evq_index, sfc_rxq_sw_index(rxq),
107                                 id, size, flags);
108                         goto done;
109                 }
110
111                 /* Add discard flag to the first fragment */
112                 rxq->sw_desc[pending_id].flags |= EFX_DISCARD;
113                 /* Remove continue flag from the last fragment */
114                 rxq->sw_desc[id].flags &= ~EFX_PKT_CONT;
115         } else if (unlikely(delta > rxq->batch_max)) {
116                 evq->exception = B_TRUE;
117
118                 sfc_err(evq->sa,
119                         "EVQ %u RxQ %u completion out of order "
120                         "(id=%#x delta=%u flags=%#x); needs restart\n",
121                         evq->evq_index, sfc_rxq_sw_index(rxq), id, delta,
122                         flags);
123
124                 goto done;
125         }
126
127         for (i = pending_id; i != stop; i = (i + 1) & rxq->ptr_mask) {
128                 rxd = &rxq->sw_desc[i];
129
130                 rxd->flags = flags;
131
132                 SFC_ASSERT(size < (1 << 16));
133                 rxd->size = (uint16_t)size;
134         }
135
136         rxq->pending += delta;
137
138 done:
139         return B_FALSE;
140 }
141
142 static boolean_t
143 sfc_ev_tx(void *arg, __rte_unused uint32_t label, uint32_t id)
144 {
145         struct sfc_evq *evq = arg;
146         struct sfc_txq *txq;
147         unsigned int stop;
148         unsigned int delta;
149
150         txq = evq->txq;
151
152         SFC_ASSERT(txq != NULL);
153         SFC_ASSERT(txq->evq == evq);
154
155         if (unlikely((txq->state & SFC_TXQ_STARTED) == 0))
156                 goto done;
157
158         stop = (id + 1) & txq->ptr_mask;
159         id = txq->pending & txq->ptr_mask;
160
161         delta = (stop >= id) ? (stop - id) : (txq->ptr_mask + 1 - id + stop);
162
163         txq->pending += delta;
164
165 done:
166         return B_FALSE;
167 }
168
169 static boolean_t
170 sfc_ev_exception(void *arg, __rte_unused uint32_t code,
171                  __rte_unused uint32_t data)
172 {
173         struct sfc_evq *evq = arg;
174
175         if (code == EFX_EXCEPTION_UNKNOWN_SENSOREVT)
176                 return B_FALSE;
177
178         evq->exception = B_TRUE;
179         sfc_warn(evq->sa,
180                  "hardware exception %s (code=%u, data=%#x) on EVQ %u;"
181                  " needs recovery",
182                  (code == EFX_EXCEPTION_RX_RECOVERY) ? "RX_RECOVERY" :
183                  (code == EFX_EXCEPTION_RX_DSC_ERROR) ? "RX_DSC_ERROR" :
184                  (code == EFX_EXCEPTION_TX_DSC_ERROR) ? "TX_DSC_ERROR" :
185                  (code == EFX_EXCEPTION_FWALERT_SRAM) ? "FWALERT_SRAM" :
186                  (code == EFX_EXCEPTION_UNKNOWN_FWALERT) ? "UNKNOWN_FWALERT" :
187                  (code == EFX_EXCEPTION_RX_ERROR) ? "RX_ERROR" :
188                  (code == EFX_EXCEPTION_TX_ERROR) ? "TX_ERROR" :
189                  (code == EFX_EXCEPTION_EV_ERROR) ? "EV_ERROR" :
190                  "UNKNOWN",
191                  code, data, evq->evq_index);
192
193         return B_TRUE;
194 }
195
196 static boolean_t
197 sfc_ev_rxq_flush_done(void *arg, __rte_unused uint32_t rxq_hw_index)
198 {
199         struct sfc_evq *evq = arg;
200         struct sfc_rxq *rxq;
201
202         rxq = evq->rxq;
203         SFC_ASSERT(rxq != NULL);
204         SFC_ASSERT(rxq->hw_index == rxq_hw_index);
205         SFC_ASSERT(rxq->evq == evq);
206         sfc_rx_qflush_done(rxq);
207
208         return B_FALSE;
209 }
210
211 static boolean_t
212 sfc_ev_rxq_flush_failed(void *arg, __rte_unused uint32_t rxq_hw_index)
213 {
214         struct sfc_evq *evq = arg;
215         struct sfc_rxq *rxq;
216
217         rxq = evq->rxq;
218         SFC_ASSERT(rxq != NULL);
219         SFC_ASSERT(rxq->hw_index == rxq_hw_index);
220         SFC_ASSERT(rxq->evq == evq);
221         sfc_rx_qflush_failed(rxq);
222
223         return B_FALSE;
224 }
225
226 static boolean_t
227 sfc_ev_txq_flush_done(void *arg, __rte_unused uint32_t txq_hw_index)
228 {
229         struct sfc_evq *evq = arg;
230         struct sfc_txq *txq;
231
232         txq = evq->txq;
233         SFC_ASSERT(txq != NULL);
234         SFC_ASSERT(txq->hw_index == txq_hw_index);
235         SFC_ASSERT(txq->evq == evq);
236         sfc_tx_qflush_done(txq);
237
238         return B_FALSE;
239 }
240
241 static boolean_t
242 sfc_ev_software(void *arg, uint16_t magic)
243 {
244         struct sfc_evq *evq = arg;
245
246         sfc_err(evq->sa, "EVQ %u unexpected software event magic=%#.4x",
247                 evq->evq_index, magic);
248         return B_TRUE;
249 }
250
251 static boolean_t
252 sfc_ev_sram(void *arg, uint32_t code)
253 {
254         struct sfc_evq *evq = arg;
255
256         sfc_err(evq->sa, "EVQ %u unexpected SRAM event code=%u",
257                 evq->evq_index, code);
258         return B_TRUE;
259 }
260
261 static boolean_t
262 sfc_ev_wake_up(void *arg, uint32_t index)
263 {
264         struct sfc_evq *evq = arg;
265
266         sfc_err(evq->sa, "EVQ %u unexpected wake up event index=%u",
267                 evq->evq_index, index);
268         return B_TRUE;
269 }
270
271 static boolean_t
272 sfc_ev_timer(void *arg, uint32_t index)
273 {
274         struct sfc_evq *evq = arg;
275
276         sfc_err(evq->sa, "EVQ %u unexpected timer event index=%u",
277                 evq->evq_index, index);
278         return B_TRUE;
279 }
280
281 static boolean_t
282 sfc_ev_link_change(void *arg, efx_link_mode_t link_mode)
283 {
284         struct sfc_evq *evq = arg;
285         struct sfc_adapter *sa = evq->sa;
286         struct rte_eth_link *dev_link = &sa->eth_dev->data->dev_link;
287         struct rte_eth_link new_link;
288
289         EFX_STATIC_ASSERT(sizeof(*dev_link) == sizeof(rte_atomic64_t));
290
291         sfc_port_link_mode_to_info(link_mode, &new_link);
292         rte_atomic64_set((rte_atomic64_t *)dev_link, *(uint64_t *)&new_link);
293
294         return B_FALSE;
295 }
296
297 static const efx_ev_callbacks_t sfc_ev_callbacks = {
298         .eec_initialized        = sfc_ev_initialized,
299         .eec_rx                 = sfc_ev_rx,
300         .eec_tx                 = sfc_ev_tx,
301         .eec_exception          = sfc_ev_exception,
302         .eec_rxq_flush_done     = sfc_ev_rxq_flush_done,
303         .eec_rxq_flush_failed   = sfc_ev_rxq_flush_failed,
304         .eec_txq_flush_done     = sfc_ev_txq_flush_done,
305         .eec_software           = sfc_ev_software,
306         .eec_sram               = sfc_ev_sram,
307         .eec_wake_up            = sfc_ev_wake_up,
308         .eec_timer              = sfc_ev_timer,
309         .eec_link_change        = sfc_ev_link_change,
310 };
311
312
313 void
314 sfc_ev_qpoll(struct sfc_evq *evq)
315 {
316         SFC_ASSERT(evq->init_state == SFC_EVQ_STARTED ||
317                    evq->init_state == SFC_EVQ_STARTING);
318
319         /* Synchronize the DMA memory for reading not required */
320
321         efx_ev_qpoll(evq->common, &evq->read_ptr, &sfc_ev_callbacks, evq);
322
323         /* Poll-mode driver does not re-prime the event queue for interrupts */
324 }
325
326 void
327 sfc_ev_mgmt_qpoll(struct sfc_adapter *sa)
328 {
329         if (rte_spinlock_trylock(&sa->mgmt_evq_lock)) {
330                 struct sfc_evq *mgmt_evq = sa->evq_info[sa->mgmt_evq_index].evq;
331
332                 if (mgmt_evq->init_state == SFC_EVQ_STARTED)
333                         sfc_ev_qpoll(mgmt_evq);
334
335                 rte_spinlock_unlock(&sa->mgmt_evq_lock);
336         }
337 }
338
339 int
340 sfc_ev_qprime(struct sfc_evq *evq)
341 {
342         SFC_ASSERT(evq->init_state == SFC_EVQ_STARTED);
343         return efx_ev_qprime(evq->common, evq->read_ptr);
344 }
345
346 int
347 sfc_ev_qstart(struct sfc_adapter *sa, unsigned int sw_index)
348 {
349         const struct sfc_evq_info *evq_info;
350         struct sfc_evq *evq;
351         efsys_mem_t *esmp;
352         unsigned int total_delay_us;
353         unsigned int delay_us;
354         int rc;
355
356         sfc_log_init(sa, "sw_index=%u", sw_index);
357
358         evq_info = &sa->evq_info[sw_index];
359         evq = evq_info->evq;
360         esmp = &evq->mem;
361
362         /* Clear all events */
363         (void)memset((void *)esmp->esm_base, 0xff,
364                      EFX_EVQ_SIZE(evq_info->entries));
365
366         /* Create the common code event queue */
367         rc = efx_ev_qcreate(sa->nic, sw_index, esmp, evq_info->entries,
368                             0 /* unused on EF10 */, 0,
369                             EFX_EVQ_FLAGS_TYPE_THROUGHPUT |
370                             EFX_EVQ_FLAGS_NOTIFY_DISABLED,
371                             &evq->common);
372         if (rc != 0)
373                 goto fail_ev_qcreate;
374
375         evq->init_state = SFC_EVQ_STARTING;
376
377         /* Wait for the initialization event */
378         total_delay_us = 0;
379         delay_us = SFC_EVQ_INIT_BACKOFF_START_US;
380         do {
381                 (void)sfc_ev_qpoll(evq);
382
383                 /* Check to see if the initialization complete indication
384                  * posted by the hardware.
385                  */
386                 if (evq->init_state == SFC_EVQ_STARTED)
387                         goto done;
388
389                 /* Give event queue some time to init */
390                 rte_delay_us(delay_us);
391
392                 total_delay_us += delay_us;
393
394                 /* Exponential backoff */
395                 delay_us *= 2;
396                 if (delay_us > SFC_EVQ_INIT_BACKOFF_MAX_US)
397                         delay_us = SFC_EVQ_INIT_BACKOFF_MAX_US;
398
399         } while (total_delay_us < SFC_EVQ_INIT_TIMEOUT_US);
400
401         rc = ETIMEDOUT;
402         goto fail_timedout;
403
404 done:
405         return 0;
406
407 fail_timedout:
408         evq->init_state = SFC_EVQ_INITIALIZED;
409         efx_ev_qdestroy(evq->common);
410
411 fail_ev_qcreate:
412         sfc_log_init(sa, "failed %d", rc);
413         return rc;
414 }
415
416 void
417 sfc_ev_qstop(struct sfc_adapter *sa, unsigned int sw_index)
418 {
419         const struct sfc_evq_info *evq_info;
420         struct sfc_evq *evq;
421
422         sfc_log_init(sa, "sw_index=%u", sw_index);
423
424         SFC_ASSERT(sw_index < sa->evq_count);
425
426         evq_info = &sa->evq_info[sw_index];
427         evq = evq_info->evq;
428
429         if (evq == NULL || evq->init_state != SFC_EVQ_STARTED)
430                 return;
431
432         evq->init_state = SFC_EVQ_INITIALIZED;
433         evq->read_ptr = 0;
434         evq->exception = B_FALSE;
435
436         efx_ev_qdestroy(evq->common);
437 }
438
439 static void
440 sfc_ev_mgmt_periodic_qpoll(void *arg)
441 {
442         struct sfc_adapter *sa = arg;
443         int rc;
444
445         sfc_ev_mgmt_qpoll(sa);
446
447         rc = rte_eal_alarm_set(SFC_MGMT_EV_QPOLL_PERIOD_US,
448                                sfc_ev_mgmt_periodic_qpoll, sa);
449         if (rc != 0)
450                 sfc_panic(sa,
451                           "cannot rearm management EVQ polling alarm (rc=%d)",
452                           rc);
453 }
454
455 static void
456 sfc_ev_mgmt_periodic_qpoll_start(struct sfc_adapter *sa)
457 {
458         sfc_ev_mgmt_periodic_qpoll(sa);
459 }
460
461 static void
462 sfc_ev_mgmt_periodic_qpoll_stop(struct sfc_adapter *sa)
463 {
464         rte_eal_alarm_cancel(sfc_ev_mgmt_periodic_qpoll, sa);
465 }
466
467 int
468 sfc_ev_start(struct sfc_adapter *sa)
469 {
470         int rc;
471
472         sfc_log_init(sa, "entry");
473
474         rc = efx_ev_init(sa->nic);
475         if (rc != 0)
476                 goto fail_ev_init;
477
478         /* Start management EVQ used for global events */
479         rte_spinlock_lock(&sa->mgmt_evq_lock);
480
481         rc = sfc_ev_qstart(sa, sa->mgmt_evq_index);
482         if (rc != 0)
483                 goto fail_mgmt_evq_start;
484
485         rte_spinlock_unlock(&sa->mgmt_evq_lock);
486
487         /*
488          * Start management EVQ polling. If interrupts are disabled
489          * (not used), it is required to process link status change
490          * and other device level events to avoid unrecoverable
491          * error because the event queue overflow.
492          */
493         sfc_ev_mgmt_periodic_qpoll_start(sa);
494
495         /*
496          * Rx/Tx event queues are started/stopped when corresponding
497          * Rx/Tx queue is started/stopped.
498          */
499
500         return 0;
501
502 fail_mgmt_evq_start:
503         rte_spinlock_unlock(&sa->mgmt_evq_lock);
504         efx_ev_fini(sa->nic);
505
506 fail_ev_init:
507         sfc_log_init(sa, "failed %d", rc);
508         return rc;
509 }
510
511 void
512 sfc_ev_stop(struct sfc_adapter *sa)
513 {
514         unsigned int sw_index;
515
516         sfc_log_init(sa, "entry");
517
518         sfc_ev_mgmt_periodic_qpoll_stop(sa);
519
520         /* Make sure that all event queues are stopped */
521         sw_index = sa->evq_count;
522         while (sw_index-- > 0) {
523                 if (sw_index == sa->mgmt_evq_index) {
524                         /* Locks are required for the management EVQ */
525                         rte_spinlock_lock(&sa->mgmt_evq_lock);
526                         sfc_ev_qstop(sa, sa->mgmt_evq_index);
527                         rte_spinlock_unlock(&sa->mgmt_evq_lock);
528                 } else {
529                         sfc_ev_qstop(sa, sw_index);
530                 }
531         }
532
533         efx_ev_fini(sa->nic);
534 }
535
536 int
537 sfc_ev_qinit(struct sfc_adapter *sa, unsigned int sw_index,
538              unsigned int entries, int socket_id)
539 {
540         struct sfc_evq_info *evq_info;
541         struct sfc_evq *evq;
542         int rc;
543
544         sfc_log_init(sa, "sw_index=%u", sw_index);
545
546         evq_info = &sa->evq_info[sw_index];
547
548         SFC_ASSERT(rte_is_power_of_2(entries));
549         SFC_ASSERT(entries <= evq_info->max_entries);
550         evq_info->entries = entries;
551
552         evq = rte_zmalloc_socket("sfc-evq", sizeof(*evq), RTE_CACHE_LINE_SIZE,
553                                  socket_id);
554         if (evq == NULL)
555                 return ENOMEM;
556
557         evq->sa = sa;
558         evq->evq_index = sw_index;
559
560         /* Allocate DMA space */
561         rc = sfc_dma_alloc(sa, "evq", sw_index, EFX_EVQ_SIZE(evq_info->entries),
562                            socket_id, &evq->mem);
563         if (rc != 0)
564                 return rc;
565
566         evq->init_state = SFC_EVQ_INITIALIZED;
567
568         evq_info->evq = evq;
569
570         return 0;
571 }
572
573 void
574 sfc_ev_qfini(struct sfc_adapter *sa, unsigned int sw_index)
575 {
576         struct sfc_evq *evq;
577
578         sfc_log_init(sa, "sw_index=%u", sw_index);
579
580         evq = sa->evq_info[sw_index].evq;
581
582         SFC_ASSERT(evq->init_state == SFC_EVQ_INITIALIZED);
583
584         sa->evq_info[sw_index].evq = NULL;
585
586         sfc_dma_free(sa, &evq->mem);
587
588         rte_free(evq);
589 }
590
591 static int
592 sfc_ev_qinit_info(struct sfc_adapter *sa, unsigned int sw_index)
593 {
594         struct sfc_evq_info *evq_info = &sa->evq_info[sw_index];
595         unsigned int max_entries;
596
597         sfc_log_init(sa, "sw_index=%u", sw_index);
598
599         max_entries = sfc_evq_max_entries(sa, sw_index);
600         SFC_ASSERT(rte_is_power_of_2(max_entries));
601
602         evq_info->max_entries = max_entries;
603
604         return 0;
605 }
606
607 static void
608 sfc_ev_qfini_info(struct sfc_adapter *sa, unsigned int sw_index)
609 {
610         sfc_log_init(sa, "sw_index=%u", sw_index);
611
612         /* Nothing to cleanup */
613 }
614
615 int
616 sfc_ev_init(struct sfc_adapter *sa)
617 {
618         int rc;
619         unsigned int sw_index;
620
621         sfc_log_init(sa, "entry");
622
623         sa->evq_count = sfc_ev_qcount(sa);
624         sa->mgmt_evq_index = 0;
625         rte_spinlock_init(&sa->mgmt_evq_lock);
626
627         /* Allocate EVQ info array */
628         rc = ENOMEM;
629         sa->evq_info = rte_calloc_socket("sfc-evqs", sa->evq_count,
630                                          sizeof(struct sfc_evq_info), 0,
631                                          sa->socket_id);
632         if (sa->evq_info == NULL)
633                 goto fail_evqs_alloc;
634
635         for (sw_index = 0; sw_index < sa->evq_count; ++sw_index) {
636                 rc = sfc_ev_qinit_info(sa, sw_index);
637                 if (rc != 0)
638                         goto fail_ev_qinit_info;
639         }
640
641         rc = sfc_ev_qinit(sa, sa->mgmt_evq_index, SFC_MGMT_EVQ_ENTRIES,
642                           sa->socket_id);
643         if (rc != 0)
644                 goto fail_mgmt_evq_init;
645
646         /*
647          * Rx/Tx event queues are created/destroyed when corresponding
648          * Rx/Tx queue is created/destroyed.
649          */
650
651         return 0;
652
653 fail_mgmt_evq_init:
654 fail_ev_qinit_info:
655         while (sw_index-- > 0)
656                 sfc_ev_qfini_info(sa, sw_index);
657
658         rte_free(sa->evq_info);
659         sa->evq_info = NULL;
660
661 fail_evqs_alloc:
662         sa->evq_count = 0;
663         sfc_log_init(sa, "failed %d", rc);
664         return rc;
665 }
666
667 void
668 sfc_ev_fini(struct sfc_adapter *sa)
669 {
670         int sw_index;
671
672         sfc_log_init(sa, "entry");
673
674         /* Cleanup all event queues */
675         sw_index = sa->evq_count;
676         while (--sw_index >= 0) {
677                 if (sa->evq_info[sw_index].evq != NULL)
678                         sfc_ev_qfini(sa, sw_index);
679                 sfc_ev_qfini_info(sa, sw_index);
680         }
681
682         rte_free(sa->evq_info);
683         sa->evq_info = NULL;
684         sa->evq_count = 0;
685 }