16021407e8d600bcc1d47682db11cf0eaf3f8e55
[dpdk.git] / drivers / net / bnxt / bnxt_txr.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2014-2018 Broadcom
3  * All rights reserved.
4  */
5
6 #include <inttypes.h>
7
8 #include <rte_byteorder.h>
9 #include <rte_malloc.h>
10
11 #include "bnxt.h"
12 #include "bnxt_ring.h"
13 #include "bnxt_txq.h"
14 #include "bnxt_txr.h"
15 #include "hsi_struct_def_dpdk.h"
16 #include <stdbool.h>
17
18 /*
19  * TX Ring handling
20  */
21
22 void bnxt_free_tx_rings(struct bnxt *bp)
23 {
24         int i;
25
26         for (i = 0; i < (int)bp->tx_nr_rings; i++) {
27                 struct bnxt_tx_queue *txq = bp->tx_queues[i];
28
29                 if (!txq)
30                         continue;
31
32                 bnxt_free_ring(txq->tx_ring->tx_ring_struct);
33                 rte_free(txq->tx_ring->tx_ring_struct);
34                 rte_free(txq->tx_ring);
35
36                 bnxt_free_ring(txq->cp_ring->cp_ring_struct);
37                 rte_free(txq->cp_ring->cp_ring_struct);
38                 rte_free(txq->cp_ring);
39
40                 rte_free(txq);
41                 bp->tx_queues[i] = NULL;
42         }
43 }
44
45 int bnxt_init_one_tx_ring(struct bnxt_tx_queue *txq)
46 {
47         struct bnxt_tx_ring_info *txr = txq->tx_ring;
48         struct bnxt_ring *ring = txr->tx_ring_struct;
49
50         txq->tx_wake_thresh = ring->ring_size / 2;
51         ring->fw_ring_id = INVALID_HW_RING_ID;
52
53         return 0;
54 }
55
56 int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id)
57 {
58         struct bnxt_cp_ring_info *cpr;
59         struct bnxt_tx_ring_info *txr;
60         struct bnxt_ring *ring;
61
62         txr = rte_zmalloc_socket("bnxt_tx_ring",
63                                  sizeof(struct bnxt_tx_ring_info),
64                                  RTE_CACHE_LINE_SIZE, socket_id);
65         if (txr == NULL)
66                 return -ENOMEM;
67         txq->tx_ring = txr;
68
69         ring = rte_zmalloc_socket("bnxt_tx_ring_struct",
70                                   sizeof(struct bnxt_ring),
71                                   RTE_CACHE_LINE_SIZE, socket_id);
72         if (ring == NULL)
73                 return -ENOMEM;
74         txr->tx_ring_struct = ring;
75         ring->ring_size = rte_align32pow2(txq->nb_tx_desc);
76         ring->ring_mask = ring->ring_size - 1;
77         ring->bd = (void *)txr->tx_desc_ring;
78         ring->bd_dma = txr->tx_desc_mapping;
79         ring->vmem_size = ring->ring_size * sizeof(struct bnxt_sw_tx_bd);
80         ring->vmem = (void **)&txr->tx_buf_ring;
81
82         cpr = rte_zmalloc_socket("bnxt_tx_ring",
83                                  sizeof(struct bnxt_cp_ring_info),
84                                  RTE_CACHE_LINE_SIZE, socket_id);
85         if (cpr == NULL)
86                 return -ENOMEM;
87         txq->cp_ring = cpr;
88
89         ring = rte_zmalloc_socket("bnxt_tx_ring_struct",
90                                   sizeof(struct bnxt_ring),
91                                   RTE_CACHE_LINE_SIZE, socket_id);
92         if (ring == NULL)
93                 return -ENOMEM;
94         cpr->cp_ring_struct = ring;
95         ring->ring_size = txr->tx_ring_struct->ring_size;
96         ring->ring_mask = ring->ring_size - 1;
97         ring->bd = (void *)cpr->cp_desc_ring;
98         ring->bd_dma = cpr->cp_desc_mapping;
99         ring->vmem_size = 0;
100         ring->vmem = NULL;
101
102         return 0;
103 }
104
105 static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
106                                 struct bnxt_tx_queue *txq,
107                                 uint16_t *coal_pkts,
108                                 struct tx_bd_long **last_txbd)
109 {
110         struct bnxt_tx_ring_info *txr = txq->tx_ring;
111         uint32_t outer_tpid_bd = 0;
112         struct tx_bd_long *txbd;
113         struct tx_bd_long_hi *txbd1 = NULL;
114         uint32_t vlan_tag_flags, cfa_action;
115         bool long_bd = false;
116         unsigned short nr_bds = 0;
117         struct rte_mbuf *m_seg;
118         struct bnxt_sw_tx_bd *tx_buf;
119         static const uint32_t lhint_arr[4] = {
120                 TX_BD_LONG_FLAGS_LHINT_LT512,
121                 TX_BD_LONG_FLAGS_LHINT_LT1K,
122                 TX_BD_LONG_FLAGS_LHINT_LT2K,
123                 TX_BD_LONG_FLAGS_LHINT_LT2K
124         };
125
126         if (unlikely(is_bnxt_in_error(txq->bp)))
127                 return -EIO;
128
129         if (tx_pkt->ol_flags & (PKT_TX_TCP_SEG | PKT_TX_TCP_CKSUM |
130                                 PKT_TX_UDP_CKSUM | PKT_TX_IP_CKSUM |
131                                 PKT_TX_VLAN_PKT | PKT_TX_OUTER_IP_CKSUM |
132                                 PKT_TX_TUNNEL_GRE | PKT_TX_TUNNEL_VXLAN |
133                                 PKT_TX_TUNNEL_GENEVE | PKT_TX_IEEE1588_TMST |
134                                 PKT_TX_QINQ_PKT))
135                 long_bd = true;
136
137         nr_bds = long_bd + tx_pkt->nb_segs;
138         if (unlikely(bnxt_tx_avail(txq) < nr_bds))
139                 return -ENOMEM;
140
141         /* Check if number of Tx descriptors is above HW limit */
142         if (unlikely(nr_bds > BNXT_MAX_TSO_SEGS)) {
143                 PMD_DRV_LOG(ERR,
144                             "Num descriptors %d exceeds HW limit\n", nr_bds);
145                 return -ENOSPC;
146         }
147
148         /* If packet length is less than minimum packet size, pad it */
149         if (unlikely(rte_pktmbuf_pkt_len(tx_pkt) < BNXT_MIN_PKT_SIZE)) {
150                 uint8_t pad = BNXT_MIN_PKT_SIZE - rte_pktmbuf_pkt_len(tx_pkt);
151                 char *seg = rte_pktmbuf_append(tx_pkt, pad);
152
153                 if (!seg) {
154                         PMD_DRV_LOG(ERR,
155                                     "Failed to pad mbuf by %d bytes\n",
156                                     pad);
157                         return -ENOMEM;
158                 }
159
160                 /* Note: data_len, pkt len are updated in rte_pktmbuf_append */
161                 memset(seg, 0, pad);
162         }
163
164         /* Check non zero data_len */
165         RTE_VERIFY(tx_pkt->data_len);
166
167         tx_buf = &txr->tx_buf_ring[txr->tx_prod];
168         tx_buf->mbuf = tx_pkt;
169         tx_buf->nr_bds = nr_bds;
170
171         txbd = &txr->tx_desc_ring[txr->tx_prod];
172         txbd->opaque = *coal_pkts;
173         txbd->flags_type = nr_bds << TX_BD_LONG_FLAGS_BD_CNT_SFT;
174         txbd->flags_type |= TX_BD_SHORT_FLAGS_COAL_NOW;
175         txbd->flags_type |= TX_BD_LONG_FLAGS_NO_CMPL;
176         txbd->len = tx_pkt->data_len;
177         if (tx_pkt->pkt_len >= 2014)
178                 txbd->flags_type |= TX_BD_LONG_FLAGS_LHINT_GTE2K;
179         else
180                 txbd->flags_type |= lhint_arr[tx_pkt->pkt_len >> 9];
181         txbd->address = rte_cpu_to_le_64(rte_mbuf_data_iova(tx_buf->mbuf));
182         *last_txbd = txbd;
183
184         if (long_bd) {
185                 txbd->flags_type |= TX_BD_LONG_TYPE_TX_BD_LONG;
186                 vlan_tag_flags = 0;
187                 cfa_action = 0;
188                 /* HW can accelerate only outer vlan in QinQ mode */
189                 if (tx_buf->mbuf->ol_flags & PKT_TX_QINQ_PKT) {
190                         vlan_tag_flags = TX_BD_LONG_CFA_META_KEY_VLAN_TAG |
191                                 tx_buf->mbuf->vlan_tci_outer;
192                         outer_tpid_bd = txq->bp->outer_tpid_bd &
193                                 BNXT_OUTER_TPID_BD_MASK;
194                         vlan_tag_flags |= outer_tpid_bd;
195                 } else if (tx_buf->mbuf->ol_flags & PKT_TX_VLAN_PKT) {
196                         /* shurd: Should this mask at
197                          * TX_BD_LONG_CFA_META_VLAN_VID_MASK?
198                          */
199                         vlan_tag_flags = TX_BD_LONG_CFA_META_KEY_VLAN_TAG |
200                                 tx_buf->mbuf->vlan_tci;
201                         /* Currently supports 8021Q, 8021AD vlan offloads
202                          * QINQ1, QINQ2, QINQ3 vlan headers are deprecated
203                          */
204                         /* DPDK only supports 802.11q VLAN packets */
205                         vlan_tag_flags |=
206                                         TX_BD_LONG_CFA_META_VLAN_TPID_TPID8100;
207                 }
208
209                 txr->tx_prod = RING_NEXT(txr->tx_ring_struct, txr->tx_prod);
210
211                 txbd1 = (struct tx_bd_long_hi *)
212                                         &txr->tx_desc_ring[txr->tx_prod];
213                 txbd1->lflags = 0;
214                 txbd1->cfa_meta = vlan_tag_flags;
215                 txbd1->cfa_action = cfa_action;
216
217                 if (tx_pkt->ol_flags & PKT_TX_TCP_SEG) {
218                         uint16_t hdr_size;
219
220                         /* TSO */
221                         txbd1->lflags |= TX_BD_LONG_LFLAGS_LSO |
222                                          TX_BD_LONG_LFLAGS_T_IPID;
223                         hdr_size = tx_pkt->l2_len + tx_pkt->l3_len +
224                                         tx_pkt->l4_len;
225                         hdr_size += (tx_pkt->ol_flags & PKT_TX_TUNNEL_MASK) ?
226                                     tx_pkt->outer_l2_len +
227                                     tx_pkt->outer_l3_len : 0;
228                         /* The hdr_size is multiple of 16bit units not 8bit.
229                          * Hence divide by 2.
230                          */
231                         txbd1->hdr_size = hdr_size >> 1;
232                         txbd1->mss = tx_pkt->tso_segsz;
233                         RTE_VERIFY(txbd1->mss);
234
235                 } else if ((tx_pkt->ol_flags & PKT_TX_OIP_IIP_TCP_UDP_CKSUM) ==
236                            PKT_TX_OIP_IIP_TCP_UDP_CKSUM) {
237                         /* Outer IP, Inner IP, Inner TCP/UDP CSO */
238                         txbd1->lflags |= TX_BD_FLG_TIP_IP_TCP_UDP_CHKSUM;
239                         txbd1->mss = 0;
240                 } else if ((tx_pkt->ol_flags & PKT_TX_OIP_IIP_TCP_CKSUM) ==
241                            PKT_TX_OIP_IIP_TCP_CKSUM) {
242                         /* Outer IP, Inner IP, Inner TCP/UDP CSO */
243                         txbd1->lflags |= TX_BD_FLG_TIP_IP_TCP_UDP_CHKSUM;
244                         txbd1->mss = 0;
245                 } else if ((tx_pkt->ol_flags & PKT_TX_OIP_IIP_UDP_CKSUM) ==
246                            PKT_TX_OIP_IIP_UDP_CKSUM) {
247                         /* Outer IP, Inner IP, Inner TCP/UDP CSO */
248                         txbd1->lflags |= TX_BD_FLG_TIP_IP_TCP_UDP_CHKSUM;
249                         txbd1->mss = 0;
250                 } else if ((tx_pkt->ol_flags & PKT_TX_IIP_TCP_UDP_CKSUM) ==
251                            PKT_TX_IIP_TCP_UDP_CKSUM) {
252                         /* (Inner) IP, (Inner) TCP/UDP CSO */
253                         txbd1->lflags |= TX_BD_FLG_IP_TCP_UDP_CHKSUM;
254                         txbd1->mss = 0;
255                 } else if ((tx_pkt->ol_flags & PKT_TX_IIP_UDP_CKSUM) ==
256                            PKT_TX_IIP_UDP_CKSUM) {
257                         /* (Inner) IP, (Inner) TCP/UDP CSO */
258                         txbd1->lflags |= TX_BD_FLG_IP_TCP_UDP_CHKSUM;
259                         txbd1->mss = 0;
260                 } else if ((tx_pkt->ol_flags & PKT_TX_IIP_TCP_CKSUM) ==
261                            PKT_TX_IIP_TCP_CKSUM) {
262                         /* (Inner) IP, (Inner) TCP/UDP CSO */
263                         txbd1->lflags |= TX_BD_FLG_IP_TCP_UDP_CHKSUM;
264                         txbd1->mss = 0;
265                 } else if ((tx_pkt->ol_flags & PKT_TX_OIP_TCP_UDP_CKSUM) ==
266                            PKT_TX_OIP_TCP_UDP_CKSUM) {
267                         /* Outer IP, (Inner) TCP/UDP CSO */
268                         txbd1->lflags |= TX_BD_FLG_TIP_TCP_UDP_CHKSUM;
269                         txbd1->mss = 0;
270                 } else if ((tx_pkt->ol_flags & PKT_TX_OIP_UDP_CKSUM) ==
271                            PKT_TX_OIP_UDP_CKSUM) {
272                         /* Outer IP, (Inner) TCP/UDP CSO */
273                         txbd1->lflags |= TX_BD_FLG_TIP_TCP_UDP_CHKSUM;
274                         txbd1->mss = 0;
275                 } else if ((tx_pkt->ol_flags & PKT_TX_OIP_TCP_CKSUM) ==
276                            PKT_TX_OIP_TCP_CKSUM) {
277                         /* Outer IP, (Inner) TCP/UDP CSO */
278                         txbd1->lflags |= TX_BD_FLG_TIP_TCP_UDP_CHKSUM;
279                         txbd1->mss = 0;
280                 } else if ((tx_pkt->ol_flags & PKT_TX_OIP_IIP_CKSUM) ==
281                            PKT_TX_OIP_IIP_CKSUM) {
282                         /* Outer IP, Inner IP CSO */
283                         txbd1->lflags |= TX_BD_FLG_TIP_IP_CHKSUM;
284                         txbd1->mss = 0;
285                 } else if ((tx_pkt->ol_flags & PKT_TX_TCP_UDP_CKSUM) ==
286                            PKT_TX_TCP_UDP_CKSUM) {
287                         /* TCP/UDP CSO */
288                         txbd1->lflags |= TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM;
289                         txbd1->mss = 0;
290                 } else if ((tx_pkt->ol_flags & PKT_TX_TCP_CKSUM) ==
291                            PKT_TX_TCP_CKSUM) {
292                         /* TCP/UDP CSO */
293                         txbd1->lflags |= TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM;
294                         txbd1->mss = 0;
295                 } else if ((tx_pkt->ol_flags & PKT_TX_UDP_CKSUM) ==
296                            PKT_TX_UDP_CKSUM) {
297                         /* TCP/UDP CSO */
298                         txbd1->lflags |= TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM;
299                         txbd1->mss = 0;
300                 } else if ((tx_pkt->ol_flags & PKT_TX_IP_CKSUM) ==
301                            PKT_TX_IP_CKSUM) {
302                         /* IP CSO */
303                         txbd1->lflags |= TX_BD_LONG_LFLAGS_IP_CHKSUM;
304                         txbd1->mss = 0;
305                 } else if ((tx_pkt->ol_flags & PKT_TX_OUTER_IP_CKSUM) ==
306                            PKT_TX_OUTER_IP_CKSUM) {
307                         /* IP CSO */
308                         txbd1->lflags |= TX_BD_LONG_LFLAGS_T_IP_CHKSUM;
309                         txbd1->mss = 0;
310                 } else if ((tx_pkt->ol_flags & PKT_TX_IEEE1588_TMST) ==
311                            PKT_TX_IEEE1588_TMST) {
312                         /* PTP */
313                         txbd1->lflags |= TX_BD_LONG_LFLAGS_STAMP;
314                         txbd1->mss = 0;
315                 }
316         } else {
317                 txbd->flags_type |= TX_BD_SHORT_TYPE_TX_BD_SHORT;
318         }
319
320         m_seg = tx_pkt->next;
321         while (m_seg) {
322                 /* Check non zero data_len */
323                 RTE_VERIFY(m_seg->data_len);
324                 txr->tx_prod = RING_NEXT(txr->tx_ring_struct, txr->tx_prod);
325                 tx_buf = &txr->tx_buf_ring[txr->tx_prod];
326                 tx_buf->mbuf = m_seg;
327
328                 txbd = &txr->tx_desc_ring[txr->tx_prod];
329                 txbd->address = rte_cpu_to_le_64(rte_mbuf_data_iova(m_seg));
330                 txbd->flags_type = TX_BD_SHORT_TYPE_TX_BD_SHORT;
331                 txbd->len = m_seg->data_len;
332
333                 m_seg = m_seg->next;
334         }
335
336         txbd->flags_type |= TX_BD_LONG_FLAGS_PACKET_END;
337
338         txr->tx_prod = RING_NEXT(txr->tx_ring_struct, txr->tx_prod);
339
340         return 0;
341 }
342
343 static void bnxt_tx_cmp(struct bnxt_tx_queue *txq, int nr_pkts)
344 {
345         struct bnxt_tx_ring_info *txr = txq->tx_ring;
346         struct rte_mempool *pool = NULL;
347         struct rte_mbuf **free = txq->free;
348         uint16_t cons = txr->tx_cons;
349         unsigned int blk = 0;
350         int i, j;
351
352         for (i = 0; i < nr_pkts; i++) {
353                 struct rte_mbuf *mbuf;
354                 struct bnxt_sw_tx_bd *tx_buf = &txr->tx_buf_ring[cons];
355                 unsigned short nr_bds = tx_buf->nr_bds;
356
357                 for (j = 0; j < nr_bds; j++) {
358                         mbuf = tx_buf->mbuf;
359                         tx_buf->mbuf = NULL;
360                         cons = RING_NEXT(txr->tx_ring_struct, cons);
361                         tx_buf = &txr->tx_buf_ring[cons];
362                         if (!mbuf)      /* long_bd's tx_buf ? */
363                                 continue;
364
365                         mbuf = rte_pktmbuf_prefree_seg(mbuf);
366                         if (unlikely(!mbuf))
367                                 continue;
368
369                         /* EW - no need to unmap DMA memory? */
370
371                         if (likely(mbuf->pool == pool)) {
372                                 /* Add mbuf to the bulk free array */
373                                 free[blk++] = mbuf;
374                         } else {
375                                 /* Found an mbuf from a different pool. Free
376                                  * mbufs accumulated so far to the previous
377                                  * pool
378                                  */
379                                 if (likely(pool != NULL))
380                                         rte_mempool_put_bulk(pool,
381                                                              (void *)free,
382                                                              blk);
383
384                                 /* Start accumulating mbufs in a new pool */
385                                 free[0] = mbuf;
386                                 pool = mbuf->pool;
387                                 blk = 1;
388                         }
389                 }
390         }
391         if (blk)
392                 rte_mempool_put_bulk(pool, (void *)free, blk);
393
394         txr->tx_cons = cons;
395 }
396
397 static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq)
398 {
399         struct bnxt_cp_ring_info *cpr = txq->cp_ring;
400         uint32_t raw_cons = cpr->cp_raw_cons;
401         uint32_t cons;
402         uint32_t nb_tx_pkts = 0;
403         struct tx_cmpl *txcmp;
404         struct cmpl_base *cp_desc_ring = cpr->cp_desc_ring;
405         struct bnxt_ring *cp_ring_struct = cpr->cp_ring_struct;
406         uint32_t ring_mask = cp_ring_struct->ring_mask;
407         uint32_t opaque = 0;
408
409         if (bnxt_tx_bds_in_hw(txq) < txq->tx_free_thresh)
410                 return 0;
411
412         do {
413                 cons = RING_CMPL(ring_mask, raw_cons);
414                 txcmp = (struct tx_cmpl *)&cpr->cp_desc_ring[cons];
415                 rte_prefetch_non_temporal(&cp_desc_ring[(cons + 2) &
416                                                         ring_mask]);
417
418                 if (!CMPL_VALID(txcmp, cpr->valid))
419                         break;
420                 opaque = rte_cpu_to_le_32(txcmp->opaque);
421                 NEXT_CMPL(cpr, cons, cpr->valid, 1);
422                 rte_prefetch0(&cp_desc_ring[cons]);
423
424                 if (CMP_TYPE(txcmp) == TX_CMPL_TYPE_TX_L2)
425                         nb_tx_pkts += opaque;
426                 else
427                         RTE_LOG_DP(ERR, PMD,
428                                         "Unhandled CMP type %02x\n",
429                                         CMP_TYPE(txcmp));
430                 raw_cons = cons;
431         } while (nb_tx_pkts < ring_mask);
432
433         if (nb_tx_pkts) {
434                 bnxt_tx_cmp(txq, nb_tx_pkts);
435                 cpr->cp_raw_cons = raw_cons;
436                 bnxt_db_cq(cpr);
437         }
438
439         return nb_tx_pkts;
440 }
441
442 uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
443                                uint16_t nb_pkts)
444 {
445         int rc;
446         uint16_t nb_tx_pkts = 0;
447         uint16_t coal_pkts = 0;
448         struct bnxt_tx_queue *txq = tx_queue;
449         struct tx_bd_long *last_txbd = NULL;
450
451         /* Handle TX completions */
452         bnxt_handle_tx_cp(txq);
453
454         /* Tx queue was stopped; wait for it to be restarted */
455         if (unlikely(!txq->tx_started)) {
456                 PMD_DRV_LOG(DEBUG, "Tx q stopped;return\n");
457                 return 0;
458         }
459
460         /* Handle TX burst request */
461         for (nb_tx_pkts = 0; nb_tx_pkts < nb_pkts; nb_tx_pkts++) {
462                 coal_pkts++;
463                 rc = bnxt_start_xmit(tx_pkts[nb_tx_pkts], txq,
464                                      &coal_pkts, &last_txbd);
465
466                 if (unlikely(rc))
467                         break;
468         }
469
470         if (likely(nb_tx_pkts)) {
471                 /* Request a completion on the last packet */
472                 last_txbd->flags_type &= ~TX_BD_LONG_FLAGS_NO_CMPL;
473                 bnxt_db_write(&txq->tx_ring->tx_db, txq->tx_ring->tx_prod);
474         }
475
476         return nb_tx_pkts;
477 }
478
479 /*
480  * Dummy DPDK callback for TX.
481  *
482  * This function is used to temporarily replace the real callback during
483  * unsafe control operations on the queue, or in case of error.
484  */
485 uint16_t
486 bnxt_dummy_xmit_pkts(void *tx_queue __rte_unused,
487                      struct rte_mbuf **tx_pkts __rte_unused,
488                      uint16_t nb_pkts __rte_unused)
489 {
490         return 0;
491 }
492
493 int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
494 {
495         struct bnxt *bp = dev->data->dev_private;
496         struct bnxt_tx_queue *txq = bp->tx_queues[tx_queue_id];
497         int rc = 0;
498
499         rc = is_bnxt_in_error(bp);
500         if (rc)
501                 return rc;
502
503         dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
504         txq->tx_started = true;
505         PMD_DRV_LOG(DEBUG, "Tx queue started\n");
506
507         return 0;
508 }
509
510 int bnxt_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
511 {
512         struct bnxt *bp = dev->data->dev_private;
513         struct bnxt_tx_queue *txq = bp->tx_queues[tx_queue_id];
514         int rc = 0;
515
516         rc = is_bnxt_in_error(bp);
517         if (rc)
518                 return rc;
519
520         /* Handle TX completions */
521         bnxt_handle_tx_cp(txq);
522
523         dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
524         txq->tx_started = false;
525         PMD_DRV_LOG(DEBUG, "Tx queue stopped\n");
526
527         return 0;
528 }