LCOV - code coverage report
Current view: top level - drivers/net/ionic - ionic_rxtx_simple.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 167 0.0 %
Date: 2024-03-01 20:19:12 Functions: 0 3 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 106 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright 2018-2022 Advanced Micro Devices, Inc.
       3                 :            :  */
       4                 :            : 
       5                 :            : #include <stdio.h>
       6                 :            : #include <errno.h>
       7                 :            : #include <stdint.h>
       8                 :            : #include <assert.h>
       9                 :            : 
      10                 :            : #include <rte_common.h>
      11                 :            : #include <rte_byteorder.h>
      12                 :            : #include <rte_atomic.h>
      13                 :            : #include <rte_mempool.h>
      14                 :            : #include <rte_mbuf.h>
      15                 :            : #include <rte_ether.h>
      16                 :            : #include <rte_prefetch.h>
      17                 :            : 
      18                 :            : #include "ionic.h"
      19                 :            : #include "ionic_if.h"
      20                 :            : #include "ionic_dev.h"
      21                 :            : #include "ionic_lif.h"
      22                 :            : #include "ionic_rxtx.h"
      23                 :            : 
      24                 :            : static __rte_always_inline void
      25                 :            : ionic_tx_flush(struct ionic_tx_qcq *txq)
      26                 :            : {
      27                 :            :         struct ionic_cq *cq = &txq->qcq.cq;
      28                 :            :         struct ionic_queue *q = &txq->qcq.q;
      29                 :            :         struct ionic_tx_stats *stats = &txq->stats;
      30                 :            :         struct rte_mbuf *txm;
      31                 :          0 :         struct ionic_txq_comp *cq_desc_base = cq->base;
      32                 :            :         volatile struct ionic_txq_comp *cq_desc;
      33                 :            :         void **info;
      34                 :            : 
      35                 :          0 :         cq_desc = &cq_desc_base[cq->tail_idx];
      36                 :            : 
      37         [ #  # ]:          0 :         while (color_match(cq_desc->color, cq->done_color)) {
      38                 :          0 :                 cq->tail_idx = Q_NEXT_TO_SRVC(cq, 1);
      39         [ #  # ]:          0 :                 if (cq->tail_idx == 0)
      40                 :          0 :                         cq->done_color = !cq->done_color;
      41                 :            : 
      42                 :            :                 /* Prefetch 4 x 16B comp at cq->tail_idx + 4 */
      43         [ #  # ]:          0 :                 if ((cq->tail_idx & 0x3) == 0)
      44                 :          0 :                         rte_prefetch0(&cq_desc_base[Q_NEXT_TO_SRVC(cq, 4)]);
      45                 :            : 
      46         [ #  # ]:          0 :                 while (q->tail_idx != rte_le_to_cpu_16(cq_desc->comp_index)) {
      47                 :            :                         /* Prefetch 8 mbuf ptrs at q->tail_idx + 2 */
      48                 :          0 :                         rte_prefetch0(&q->info[Q_NEXT_TO_SRVC(q, 2)]);
      49                 :            : 
      50                 :            :                         /* Prefetch next mbuf */
      51                 :          0 :                         void **next_info =
      52                 :          0 :                                 &q->info[Q_NEXT_TO_SRVC(q, 1)];
      53         [ #  # ]:          0 :                         if (next_info[0])
      54                 :            :                                 rte_mbuf_prefetch_part2(next_info[0]);
      55                 :            : 
      56                 :          0 :                         info = &q->info[q->tail_idx];
      57                 :            :                         {
      58                 :          0 :                                 txm = info[0];
      59                 :            : 
      60         [ #  # ]:          0 :                                 if (txq->flags & IONIC_QCQ_F_FAST_FREE)
      61         [ #  # ]:          0 :                                         rte_mempool_put(txm->pool, txm);
      62                 :            :                                 else
      63                 :            :                                         rte_pktmbuf_free_seg(txm);
      64                 :            : 
      65                 :          0 :                                 info[0] = NULL;
      66                 :            :                         }
      67                 :            : 
      68                 :          0 :                         q->tail_idx = Q_NEXT_TO_SRVC(q, 1);
      69                 :            :                 }
      70                 :            : 
      71                 :          0 :                 cq_desc = &cq_desc_base[cq->tail_idx];
      72                 :          0 :                 stats->comps++;
      73                 :            :         }
      74                 :            : }
      75                 :            : 
      76                 :            : static __rte_always_inline int
      77                 :            : ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm)
      78                 :            : {
      79                 :            :         struct ionic_queue *q = &txq->qcq.q;
      80                 :          0 :         struct ionic_txq_desc *desc, *desc_base = q->base;
      81                 :            :         struct ionic_tx_stats *stats = &txq->stats;
      82                 :            :         void **info;
      83                 :            :         uint64_t ol_flags = txm->ol_flags;
      84                 :            :         uint64_t addr, cmd;
      85                 :            :         uint8_t opcode = IONIC_TXQ_DESC_OPCODE_CSUM_NONE;
      86                 :            :         uint8_t flags = 0;
      87                 :            : 
      88         [ #  # ]:          0 :         if (txm->nb_segs > 1)
      89                 :            :                 return -EINVAL;
      90                 :            : 
      91                 :          0 :         desc = &desc_base[q->head_idx];
      92                 :          0 :         info = &q->info[q->head_idx];
      93                 :            : 
      94         [ #  # ]:          0 :         if ((ol_flags & RTE_MBUF_F_TX_IP_CKSUM) &&
      95         [ #  # ]:          0 :             (txq->flags & IONIC_QCQ_F_CSUM_L3)) {
      96                 :            :                 opcode = IONIC_TXQ_DESC_OPCODE_CSUM_HW;
      97                 :            :                 flags |= IONIC_TXQ_DESC_FLAG_CSUM_L3;
      98                 :            :         }
      99                 :            : 
     100         [ #  # ]:          0 :         if (((ol_flags & RTE_MBUF_F_TX_TCP_CKSUM) &&
     101         [ #  # ]:          0 :              (txq->flags & IONIC_QCQ_F_CSUM_TCP)) ||
     102         [ #  # ]:          0 :             ((ol_flags & RTE_MBUF_F_TX_UDP_CKSUM) &&
     103         [ #  # ]:          0 :              (txq->flags & IONIC_QCQ_F_CSUM_UDP))) {
     104                 :            :                 opcode = IONIC_TXQ_DESC_OPCODE_CSUM_HW;
     105                 :          0 :                 flags |= IONIC_TXQ_DESC_FLAG_CSUM_L4;
     106                 :            :         }
     107                 :            : 
     108         [ #  # ]:          0 :         if (opcode == IONIC_TXQ_DESC_OPCODE_CSUM_NONE)
     109                 :          0 :                 stats->no_csum++;
     110                 :            : 
     111         [ #  # ]:          0 :         if (((ol_flags & RTE_MBUF_F_TX_OUTER_IP_CKSUM) ||
     112                 :          0 :              (ol_flags & RTE_MBUF_F_TX_OUTER_UDP_CKSUM)) &&
     113         [ #  # ]:          0 :             ((ol_flags & RTE_MBUF_F_TX_OUTER_IPV4) ||
     114                 :            :              (ol_flags & RTE_MBUF_F_TX_OUTER_IPV6))) {
     115                 :          0 :                 flags |= IONIC_TXQ_DESC_FLAG_ENCAP;
     116                 :            :         }
     117                 :            : 
     118         [ #  # ]:          0 :         if (ol_flags & RTE_MBUF_F_TX_VLAN) {
     119                 :          0 :                 flags |= IONIC_TXQ_DESC_FLAG_VLAN;
     120                 :          0 :                 desc->vlan_tci = rte_cpu_to_le_16(txm->vlan_tci);
     121                 :            :         }
     122                 :            : 
     123                 :            :         addr = rte_cpu_to_le_64(rte_mbuf_data_iova(txm));
     124                 :            : 
     125                 :          0 :         cmd = encode_txq_desc_cmd(opcode, flags, 0, addr);
     126                 :          0 :         desc->cmd = rte_cpu_to_le_64(cmd);
     127                 :          0 :         desc->len = rte_cpu_to_le_16(txm->data_len);
     128                 :            : 
     129                 :          0 :         info[0] = txm;
     130                 :            : 
     131                 :          0 :         q->head_idx = Q_NEXT_TO_POST(q, 1);
     132                 :            : 
     133                 :            :         return 0;
     134                 :            : }
     135                 :            : 
     136                 :            : uint16_t
     137                 :          0 : ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
     138                 :            :                 uint16_t nb_pkts)
     139                 :            : {
     140                 :            :         struct ionic_tx_qcq *txq = tx_queue;
     141                 :          0 :         struct ionic_queue *q = &txq->qcq.q;
     142                 :          0 :         struct ionic_txq_desc *desc_base = q->base;
     143                 :            :         struct ionic_tx_stats *stats = &txq->stats;
     144                 :            :         struct rte_mbuf *mbuf;
     145                 :            :         uint32_t bytes_tx = 0;
     146                 :            :         uint16_t nb_avail, nb_tx = 0;
     147                 :            :         uint64_t then, now, hz, delta;
     148                 :            :         int err;
     149                 :            : 
     150                 :          0 :         rte_prefetch0(&desc_base[q->head_idx]);
     151                 :          0 :         rte_prefetch0(&q->info[q->head_idx]);
     152                 :            : 
     153         [ #  # ]:          0 :         if (nb_pkts) {
     154                 :          0 :                 rte_mbuf_prefetch_part1(tx_pkts[0]);
     155                 :            :                 rte_mbuf_prefetch_part2(tx_pkts[0]);
     156                 :            :         }
     157                 :            : 
     158         [ #  # ]:          0 :         if (ionic_q_space_avail(q) < txq->free_thresh) {
     159                 :            :                 /* Cleaning old buffers */
     160                 :            :                 ionic_tx_flush(txq);
     161                 :            :         }
     162                 :            : 
     163                 :            :         nb_avail = ionic_q_space_avail(q);
     164         [ #  # ]:          0 :         if (nb_avail < nb_pkts) {
     165                 :          0 :                 stats->stop += nb_pkts - nb_avail;
     166                 :            :                 nb_pkts = nb_avail;
     167                 :            :         }
     168                 :            : 
     169         [ #  # ]:          0 :         while (nb_tx < nb_pkts) {
     170                 :          0 :                 uint16_t next_idx = Q_NEXT_TO_POST(q, 1);
     171                 :          0 :                 rte_prefetch0(&desc_base[next_idx]);
     172                 :          0 :                 rte_prefetch0(&q->info[next_idx]);
     173                 :            : 
     174         [ #  # ]:          0 :                 if (nb_tx + 1 < nb_pkts) {
     175                 :          0 :                         rte_mbuf_prefetch_part1(tx_pkts[nb_tx + 1]);
     176                 :            :                         rte_mbuf_prefetch_part2(tx_pkts[nb_tx + 1]);
     177                 :            :                 }
     178                 :            : 
     179                 :          0 :                 mbuf = tx_pkts[nb_tx];
     180                 :            : 
     181         [ #  # ]:          0 :                 if (mbuf->ol_flags & RTE_MBUF_F_TX_TCP_SEG)
     182                 :          0 :                         err = ionic_tx_tso(txq, mbuf);
     183                 :            :                 else
     184                 :            :                         err = ionic_tx(txq, mbuf);
     185         [ #  # ]:          0 :                 if (err) {
     186                 :          0 :                         stats->drop += nb_pkts - nb_tx;
     187                 :          0 :                         break;
     188                 :            :                 }
     189                 :            : 
     190                 :          0 :                 bytes_tx += mbuf->pkt_len;
     191                 :          0 :                 nb_tx++;
     192                 :            :         }
     193                 :            : 
     194         [ #  # ]:          0 :         if (nb_tx > 0) {
     195                 :            :                 rte_wmb();
     196                 :          0 :                 ionic_txq_flush(q);
     197                 :            : 
     198                 :          0 :                 txq->last_wdog_cycles = rte_get_timer_cycles();
     199                 :            : 
     200                 :          0 :                 stats->packets += nb_tx;
     201                 :          0 :                 stats->bytes += bytes_tx;
     202                 :            :         } else {
     203                 :            :                 /*
     204                 :            :                  * Ring the doorbell again if no work could be posted and work
     205                 :            :                  * is still pending after the deadline.
     206                 :            :                  */
     207         [ #  # ]:          0 :                 if (q->head_idx != q->tail_idx) {
     208                 :          0 :                         then = txq->last_wdog_cycles;
     209                 :            :                         now = rte_get_timer_cycles();
     210                 :            :                         hz = rte_get_timer_hz();
     211                 :          0 :                         delta = (now - then) * 1000;
     212                 :            : 
     213         [ #  # ]:          0 :                         if (delta >= hz * IONIC_Q_WDOG_MS) {
     214                 :            :                                 ionic_q_flush(q);
     215                 :          0 :                                 txq->last_wdog_cycles = now;
     216                 :            :                         }
     217                 :            :                 }
     218                 :            :         }
     219                 :            : 
     220                 :          0 :         return nb_tx;
     221                 :            : }
     222                 :            : 
     223                 :            : /*
     224                 :            :  * Cleans one descriptor. Connects the filled mbufs into a chain.
     225                 :            :  * Does not advance the tail index.
     226                 :            :  */
     227                 :            : static __rte_always_inline void
     228                 :            : ionic_rx_clean_one(struct ionic_rx_qcq *rxq,
     229                 :            :                 volatile struct ionic_rxq_comp *cq_desc,
     230                 :            :                 struct ionic_rx_service *rx_svc)
     231                 :            : {
     232                 :            :         struct ionic_queue *q = &rxq->qcq.q;
     233                 :            :         struct rte_mbuf *rxm;
     234                 :            :         struct ionic_rx_stats *stats = &rxq->stats;
     235                 :            :         uint64_t pkt_flags = 0;
     236                 :            :         uint32_t pkt_type;
     237                 :            :         uint16_t cq_desc_len;
     238                 :            :         uint8_t ptype, cflags;
     239                 :            :         void **info;
     240                 :            : 
     241                 :          0 :         cq_desc_len = rte_le_to_cpu_16(cq_desc->len);
     242                 :            : 
     243                 :          0 :         info = &q->info[q->tail_idx];
     244                 :            : 
     245                 :          0 :         rxm = info[0];
     246                 :            : 
     247         [ #  # ]:          0 :         if (cq_desc->status) {
     248                 :          0 :                 stats->bad_cq_status++;
     249                 :          0 :                 return;
     250                 :            :         }
     251                 :            : 
     252   [ #  #  #  # ]:          0 :         if (cq_desc_len > rxq->frame_size || cq_desc_len == 0) {
     253                 :          0 :                 stats->bad_len++;
     254                 :          0 :                 return;
     255                 :            :         }
     256                 :            : 
     257                 :          0 :         info[0] = NULL;
     258                 :            : 
     259                 :            :         /* Set the mbuf metadata based on the cq entry */
     260                 :          0 :         rxm->rearm_data[0] = rxq->rearm_data;
     261                 :          0 :         rxm->pkt_len = cq_desc_len;
     262                 :          0 :         rxm->data_len = cq_desc_len;
     263                 :            : 
     264                 :            :         /* RSS */
     265                 :            :         pkt_flags |= RTE_MBUF_F_RX_RSS_HASH;
     266                 :          0 :         rxm->hash.rss = rte_le_to_cpu_32(cq_desc->rss_hash);
     267                 :            : 
     268                 :            :         /* Vlan Strip */
     269         [ #  # ]:          0 :         if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_VLAN) {
     270                 :            :                 pkt_flags |= RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED;
     271                 :          0 :                 rxm->vlan_tci = rte_le_to_cpu_16(cq_desc->vlan_tci);
     272                 :            :         }
     273                 :            : 
     274                 :            :         /* Checksum */
     275         [ #  # ]:          0 :         if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_CALC) {
     276                 :          0 :                 cflags = cq_desc->csum_flags & IONIC_CSUM_FLAG_MASK;
     277                 :          0 :                 pkt_flags |= ionic_csum_flags[cflags];
     278                 :            :         }
     279                 :            : 
     280                 :          0 :         rxm->ol_flags = pkt_flags;
     281                 :            : 
     282                 :            :         /* Packet Type */
     283                 :          0 :         ptype = cq_desc->pkt_type_color & IONIC_RXQ_COMP_PKT_TYPE_MASK;
     284                 :          0 :         pkt_type = ionic_ptype_table[ptype];
     285         [ #  # ]:          0 :         if (pkt_type == RTE_PTYPE_UNKNOWN) {
     286                 :          0 :                 struct rte_ether_hdr *eth_h = rte_pktmbuf_mtod(rxm,
     287                 :            :                                 struct rte_ether_hdr *);
     288                 :          0 :                 uint16_t ether_type = eth_h->ether_type;
     289         [ #  # ]:          0 :                 if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP))
     290                 :            :                         pkt_type = RTE_PTYPE_L2_ETHER_ARP;
     291         [ #  # ]:          0 :                 else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_LLDP))
     292                 :            :                         pkt_type = RTE_PTYPE_L2_ETHER_LLDP;
     293         [ #  # ]:          0 :                 else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_1588))
     294                 :            :                         pkt_type = RTE_PTYPE_L2_ETHER_TIMESYNC;
     295                 :          0 :                 stats->mtods++;
     296         [ #  # ]:          0 :         } else if (pkt_flags & RTE_MBUF_F_RX_VLAN) {
     297                 :          0 :                 pkt_type |= RTE_PTYPE_L2_ETHER_VLAN;
     298                 :            :         } else {
     299                 :          0 :                 pkt_type |= RTE_PTYPE_L2_ETHER;
     300                 :            :         }
     301                 :            : 
     302                 :          0 :         rxm->packet_type = pkt_type;
     303                 :            : 
     304                 :          0 :         rx_svc->rx_pkts[rx_svc->nb_rx] = rxm;
     305                 :          0 :         rx_svc->nb_rx++;
     306                 :            : 
     307                 :          0 :         stats->packets++;
     308                 :          0 :         stats->bytes += rxm->pkt_len;
     309                 :            : }
     310                 :            : 
     311                 :            : /*
     312                 :            :  * Fills one descriptor with mbufs. Does not advance the head index.
     313                 :            :  */
     314                 :            : static __rte_always_inline int
     315                 :            : ionic_rx_fill_one(struct ionic_rx_qcq *rxq)
     316                 :            : {
     317                 :            :         struct ionic_queue *q = &rxq->qcq.q;
     318                 :            :         struct rte_mbuf *rxm;
     319                 :          0 :         struct ionic_rxq_desc *desc, *desc_base = q->base;
     320                 :            :         rte_iova_t data_iova;
     321                 :            :         void **info;
     322                 :            :         int ret;
     323                 :            : 
     324                 :          0 :         info = &q->info[q->head_idx];
     325                 :          0 :         desc = &desc_base[q->head_idx];
     326                 :            : 
     327                 :            :         /* mbuf is unused */
     328         [ #  # ]:          0 :         if (info[0])
     329                 :            :                 return 0;
     330                 :            : 
     331   [ #  #  #  # ]:          0 :         if (rxq->mb_idx == 0) {
     332                 :          0 :                 ret = rte_mempool_get_bulk(rxq->mb_pool,
     333   [ #  #  #  # ]:          0 :                                         (void **)rxq->mbs,
     334                 :            :                                         IONIC_MBUF_BULK_ALLOC);
     335   [ #  #  #  # ]:          0 :                 if (ret) {
     336                 :          0 :                         assert(0);
     337                 :            :                         return -ENOMEM;
     338                 :            :                 }
     339                 :            : 
     340                 :          0 :                 rxq->mb_idx = IONIC_MBUF_BULK_ALLOC;
     341                 :            :         }
     342                 :            : 
     343                 :          0 :         rxm = rxq->mbs[--rxq->mb_idx];
     344                 :          0 :         info[0] = rxm;
     345                 :            : 
     346                 :            :         data_iova = rte_mbuf_data_iova_default(rxm);
     347                 :          0 :         desc->addr = rte_cpu_to_le_64(data_iova);
     348                 :            : 
     349                 :          0 :         return 0;
     350                 :            : }
     351                 :            : 
     352                 :            : /*
     353                 :            :  * Walk the CQ to find completed receive descriptors.
     354                 :            :  * Any completed descriptor found is refilled.
     355                 :            :  */
     356                 :            : static __rte_always_inline void
     357                 :            : ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,
     358                 :            :                 struct ionic_rx_service *rx_svc)
     359                 :            : {
     360                 :            :         struct ionic_cq *cq = &rxq->qcq.cq;
     361                 :          0 :         struct ionic_queue *q = &rxq->qcq.q;
     362                 :          0 :         struct ionic_rxq_desc *q_desc_base = q->base;
     363                 :          0 :         struct ionic_rxq_comp *cq_desc_base = cq->base;
     364                 :            :         volatile struct ionic_rxq_comp *cq_desc;
     365                 :            :         uint32_t work_done = 0;
     366                 :            :         uint64_t then, now, hz, delta;
     367                 :            : 
     368                 :          0 :         cq_desc = &cq_desc_base[cq->tail_idx];
     369                 :            : 
     370         [ #  # ]:          0 :         while (color_match(cq_desc->pkt_type_color, cq->done_color)) {
     371                 :          0 :                 cq->tail_idx = Q_NEXT_TO_SRVC(cq, 1);
     372         [ #  # ]:          0 :                 if (cq->tail_idx == 0)
     373                 :          0 :                         cq->done_color = !cq->done_color;
     374                 :            : 
     375                 :            :                 /* Prefetch 8 x 8B bufinfo */
     376                 :          0 :                 rte_prefetch0(&q->info[Q_NEXT_TO_SRVC(q, 8)]);
     377                 :            :                 /* Prefetch 4 x 16B comp */
     378                 :          0 :                 rte_prefetch0(&cq_desc_base[Q_NEXT_TO_SRVC(cq, 4)]);
     379                 :            :                 /* Prefetch 4 x 16B descriptors */
     380                 :          0 :                 rte_prefetch0(&q_desc_base[Q_NEXT_TO_POST(q, 4)]);
     381                 :            : 
     382                 :            :                 /* Clean one descriptor */
     383                 :            :                 ionic_rx_clean_one(rxq, cq_desc, rx_svc);
     384         [ #  # ]:          0 :                 q->tail_idx = Q_NEXT_TO_SRVC(q, 1);
     385                 :            : 
     386                 :            :                 /* Fill one descriptor */
     387                 :            :                 (void)ionic_rx_fill_one(rxq);
     388                 :            : 
     389                 :          0 :                 q->head_idx = Q_NEXT_TO_POST(q, 1);
     390                 :            : 
     391         [ #  # ]:          0 :                 if (++work_done == work_to_do)
     392                 :            :                         break;
     393                 :            : 
     394                 :          0 :                 cq_desc = &cq_desc_base[cq->tail_idx];
     395                 :            :         }
     396                 :            : 
     397                 :            :         /* Update the queue indices and ring the doorbell */
     398         [ #  # ]:          0 :         if (work_done) {
     399                 :          0 :                 ionic_rxq_flush(q);
     400                 :            : 
     401                 :          0 :                 rxq->last_wdog_cycles = rte_get_timer_cycles();
     402                 :          0 :                 rxq->wdog_ms = IONIC_Q_WDOG_MS;
     403                 :            :         } else {
     404                 :            :                 /*
     405                 :            :                  * Ring the doorbell again if no recvs were posted and the
     406                 :            :                  * recv queue is not empty after the deadline.
     407                 :            :                  *
     408                 :            :                  * Exponentially back off the deadline to avoid excessive
     409                 :            :                  * doorbells when the recv queue is idle.
     410                 :            :                  */
     411         [ #  # ]:          0 :                 if (q->head_idx != q->tail_idx) {
     412                 :          0 :                         then = rxq->last_wdog_cycles;
     413                 :            :                         now = rte_get_timer_cycles();
     414                 :            :                         hz = rte_get_timer_hz();
     415                 :          0 :                         delta = (now - then) * 1000;
     416                 :            : 
     417         [ #  # ]:          0 :                         if (delta >= hz * rxq->wdog_ms) {
     418                 :            :                                 ionic_q_flush(q);
     419                 :          0 :                                 rxq->last_wdog_cycles = now;
     420                 :            : 
     421                 :          0 :                                 delta = 2 * rxq->wdog_ms;
     422                 :            :                                 if (delta > IONIC_Q_WDOG_MAX_MS)
     423                 :            :                                         delta = IONIC_Q_WDOG_MAX_MS;
     424                 :            : 
     425                 :          0 :                                 rxq->wdog_ms = delta;
     426                 :            :                         }
     427                 :            :                 }
     428                 :            :         }
     429                 :            : }
     430                 :            : 
     431                 :            : uint16_t
     432                 :          0 : ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
     433                 :            :                 uint16_t nb_pkts)
     434                 :            : {
     435                 :            :         struct ionic_rx_qcq *rxq = rx_queue;
     436                 :            :         struct ionic_rx_service rx_svc;
     437                 :            : 
     438                 :            :         rx_svc.rx_pkts = rx_pkts;
     439                 :            :         rx_svc.nb_rx = 0;
     440                 :            : 
     441                 :          0 :         ionic_rxq_service(rxq, nb_pkts, &rx_svc);
     442                 :            : 
     443                 :          0 :         return rx_svc.nb_rx;
     444                 :            : }
     445                 :            : 
     446                 :            : /*
     447                 :            :  * Fills all descriptors with mbufs.
     448                 :            :  */
     449                 :            : int __rte_cold
     450                 :          0 : ionic_rx_fill(struct ionic_rx_qcq *rxq)
     451                 :            : {
     452                 :          0 :         struct ionic_queue *q = &rxq->qcq.q;
     453                 :            :         uint32_t i;
     454                 :            :         int err = 0;
     455                 :            : 
     456         [ #  # ]:          0 :         for (i = 0; i < q->num_descs - 1u; i++) {
     457                 :            :                 err = ionic_rx_fill_one(rxq);
     458                 :            :                 if (err)
     459                 :            :                         break;
     460                 :            : 
     461                 :          0 :                 q->head_idx = Q_NEXT_TO_POST(q, 1);
     462                 :            :         }
     463                 :            : 
     464                 :          0 :         ionic_rxq_flush(q);
     465                 :            : 
     466                 :          0 :         return err;
     467                 :            : }

Generated by: LCOV version 1.14