LCOV - code coverage report
Current view: top level - drivers/net/cnxk - cn20k_rx.h (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 124 0.0 %
Date: 2025-04-03 19:37:06 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 240 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(C) 2024 Marvell.
       3                 :            :  */
       4                 :            : #ifndef __CN20K_RX_H__
       5                 :            : #define __CN20K_RX_H__
       6                 :            : 
       7                 :            : #include "cn20k_rxtx.h"
       8                 :            : #include <rte_ethdev.h>
       9                 :            : #include <rte_security_driver.h>
      10                 :            : #include <rte_vect.h>
      11                 :            : 
      12                 :            : #define NSEC_PER_SEC 1000000000L
      13                 :            : 
      14                 :            : #define NIX_RX_OFFLOAD_NONE          (0)
      15                 :            : #define NIX_RX_OFFLOAD_RSS_F         BIT(0)
      16                 :            : #define NIX_RX_OFFLOAD_PTYPE_F       BIT(1)
      17                 :            : #define NIX_RX_OFFLOAD_CHECKSUM_F    BIT(2)
      18                 :            : #define NIX_RX_OFFLOAD_MARK_UPDATE_F BIT(3)
      19                 :            : #define NIX_RX_OFFLOAD_TSTAMP_F      BIT(4)
      20                 :            : #define NIX_RX_OFFLOAD_VLAN_STRIP_F  BIT(5)
      21                 :            : #define NIX_RX_OFFLOAD_SECURITY_F    BIT(6)
      22                 :            : #define NIX_RX_OFFLOAD_MAX           (NIX_RX_OFFLOAD_SECURITY_F << 1)
      23                 :            : 
      24                 :            : /* Flags to control cqe_to_mbuf conversion function.
      25                 :            :  * Defining it from backwards to denote its been
      26                 :            :  * not used as offload flags to pick function
      27                 :            :  */
      28                 :            : #define NIX_RX_REAS_F      BIT(12)
      29                 :            : #define NIX_RX_VWQE_F      BIT(13)
      30                 :            : #define NIX_RX_MULTI_SEG_F BIT(14)
      31                 :            : 
      32                 :            : #define CNXK_NIX_CQ_ENTRY_SZ 128
      33                 :            : #define NIX_DESCS_PER_LOOP   4
      34                 :            : #define CQE_CAST(x)          ((struct nix_cqe_hdr_s *)(x))
      35                 :            : #define CQE_SZ(x)            ((x) * CNXK_NIX_CQ_ENTRY_SZ)
      36                 :            : 
      37                 :            : #define CQE_PTR_OFF(b, i, o, f)                                                                    \
      38                 :            :         (((f) & NIX_RX_VWQE_F) ? (uint64_t *)(((uintptr_t)((uint64_t *)(b))[i]) + (o)) :           \
      39                 :            :                                  (uint64_t *)(((uintptr_t)(b)) + CQE_SZ(i) + (o)))
      40                 :            : #define CQE_PTR_DIFF(b, i, o, f)                                                                   \
      41                 :            :         (((f) & NIX_RX_VWQE_F) ? (uint64_t *)(((uintptr_t)((uint64_t *)(b))[i]) - (o)) :           \
      42                 :            :                                  (uint64_t *)(((uintptr_t)(b)) + CQE_SZ(i) - (o)))
      43                 :            : 
      44                 :            : #define NIX_RX_SEC_UCC_CONST                                                                       \
      45                 :            :         ((RTE_MBUF_F_RX_IP_CKSUM_BAD >> 1) |                                                       \
      46                 :            :          ((RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_GOOD) >> 1) << 8 |                 \
      47                 :            :          ((RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_BAD) >> 1) << 16 |                 \
      48                 :            :          ((RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_GOOD) >> 1) << 32 |                \
      49                 :            :          ((RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_GOOD) >> 1) << 48)
      50                 :            : 
      51                 :            : #ifdef RTE_LIBRTE_MEMPOOL_DEBUG
      52                 :            : static inline void
      53                 :            : nix_mbuf_validate_next(struct rte_mbuf *m)
      54                 :            : {
      55                 :            :         if (m->nb_segs == 1 && m->next)
      56                 :            :                 rte_panic("mbuf->next[%p] valid when mbuf->nb_segs is %d", m->next, m->nb_segs);
      57                 :            : }
      58                 :            : #else
      59                 :            : static inline void
      60                 :            : nix_mbuf_validate_next(struct rte_mbuf *m)
      61                 :            : {
      62                 :            :         RTE_SET_USED(m);
      63                 :            : }
      64                 :            : #endif
      65                 :            : 
      66                 :            : #define NIX_RX_SEC_REASSEMBLY_F (NIX_RX_REAS_F | NIX_RX_OFFLOAD_SECURITY_F)
      67                 :            : 
      68                 :            : static inline rte_eth_ip_reassembly_dynfield_t *
      69                 :            : cnxk_ip_reassembly_dynfield(struct rte_mbuf *mbuf, int ip_reassembly_dynfield_offset)
      70                 :            : {
      71                 :          0 :         return RTE_MBUF_DYNFIELD(mbuf, ip_reassembly_dynfield_offset,
      72                 :            :                                  rte_eth_ip_reassembly_dynfield_t *);
      73                 :            : }
      74                 :            : 
      75                 :            : union mbuf_initializer {
      76                 :            :         struct {
      77                 :            :                 uint16_t data_off;
      78                 :            :                 uint16_t refcnt;
      79                 :            :                 uint16_t nb_segs;
      80                 :            :                 uint16_t port;
      81                 :            :         } fields;
      82                 :            :         uint64_t value;
      83                 :            : };
      84                 :            : 
      85                 :            : static __rte_always_inline void
      86                 :            : nix_sec_flush_meta_burst(uint16_t lmt_id, uint64_t data, uint16_t lnum, uintptr_t aura_handle)
      87                 :            : {
      88                 :            :         uint64_t pa;
      89                 :            : 
      90                 :            :         /* Prepare PA and Data */
      91                 :            :         pa = roc_npa_aura_handle_to_base(aura_handle) + NPA_LF_AURA_BATCH_FREE0;
      92                 :            :         pa |= ((data & 0x7) << 4);
      93                 :            : 
      94                 :            :         data >>= 3;
      95                 :            :         data <<= 19;
      96                 :            :         data |= (uint64_t)lmt_id;
      97                 :            :         data |= (uint64_t)(lnum - 1) << 12;
      98                 :            : 
      99                 :            :         roc_lmt_submit_steorl(data, pa);
     100                 :            : }
     101                 :            : 
     102                 :            : static __rte_always_inline void
     103                 :            : nix_sec_flush_meta(uintptr_t laddr, uint16_t lmt_id, uint8_t loff, uintptr_t aura_handle)
     104                 :            : {
     105                 :            :         uint64_t pa;
     106                 :            : 
     107                 :            :         /* laddr is pointing to first pointer */
     108                 :          0 :         laddr -= 8;
     109                 :            : 
     110                 :            :         /* Trigger free either on lmtline full or different aura handle */
     111                 :            :         pa = roc_npa_aura_handle_to_base(aura_handle) + NPA_LF_AURA_BATCH_FREE0;
     112                 :            : 
     113                 :            :         /* Update aura handle */
     114                 :          0 :         *(uint64_t *)laddr =
     115                 :          0 :                 (((uint64_t)(loff & 0x1) << 32) | roc_npa_aura_handle_to_aura(aura_handle));
     116                 :            : 
     117                 :            :         pa |= ((uint64_t)(loff >> 1) << 4);
     118                 :            :         roc_lmt_submit_steorl(lmt_id, pa);
     119                 :            : }
     120                 :            : 
     121                 :            : static __rte_always_inline uint64_t
     122                 :            : nix_clear_data_off(uint64_t oldval)
     123                 :            : {
     124                 :            :         union mbuf_initializer mbuf_init = {.value = oldval};
     125                 :            : 
     126                 :            :         mbuf_init.fields.data_off = 0;
     127                 :            :         return mbuf_init.value;
     128                 :            : }
     129                 :            : 
     130                 :            : static __rte_always_inline struct rte_mbuf *
     131                 :            : nix_get_mbuf_from_cqe(void *cq, const uint64_t data_off)
     132                 :            : {
     133                 :            :         rte_iova_t buff;
     134                 :            : 
     135                 :            :         /* Skip CQE, NIX_RX_PARSE_S and SG HDR(9 DWORDs) and peek buff addr */
     136                 :            :         buff = *((rte_iova_t *)((uint64_t *)cq + 9));
     137                 :            :         return (struct rte_mbuf *)(buff - data_off);
     138                 :            : }
     139                 :            : 
     140                 :            : static __rte_always_inline uint64_t
     141                 :            : nix_sec_meta_to_mbuf_sc(uint64_t cq_w5, uint64_t cpth, const uint64_t sa_base,
     142                 :            :                         struct rte_mbuf *mbuf, uint16_t *len, uint64_t *mbuf_init,
     143                 :            :                         const uint16_t flags)
     144                 :            : {
     145                 :          0 :         const struct cpt_parse_hdr_s *hdr = (const struct cpt_parse_hdr_s *)cpth;
     146                 :            :         struct cn20k_inb_priv_data *inb_priv;
     147                 :          0 :         uint64_t ol_flags, w3 = hdr->w3.u64;
     148                 :            :         uint32_t sa_idx;
     149                 :            :         uint16_t ucc;
     150                 :            :         void *inb_sa;
     151                 :            : 
     152                 :            :         /* Get SPI from CPT_PARSE_S's cookie(already swapped) */
     153                 :          0 :         sa_idx = hdr->w0.cookie;
     154                 :          0 :         inb_sa = roc_nix_inl_ow_ipsec_inb_sa(sa_base, sa_idx);
     155                 :            :         inb_priv = roc_nix_inl_ow_ipsec_inb_sa_sw_rsvd(inb_sa);
     156                 :            : 
     157                 :            :         /* Cryptodev injected packet can be identified from SA IDX 0xFFFFFFFF, and
     158                 :            :          * Ethdev injected packet can be identified with match ID 0xFFFF.
     159                 :            :          */
     160   [ #  #  #  #  :          0 :         if (flags & NIX_RX_REAS_F && !hdr->w2.pkt_inline) {
             #  #  #  # ]
     161                 :          0 :                 *mbuf_init = (*mbuf_init & ~(BIT_ULL(16) - 1)) | mbuf->data_off;
     162   [ #  #  #  #  :          0 :                 if (hdr->w0.match_id == 0xFFFFU)
             #  #  #  # ]
     163                 :          0 :                         *rte_security_dynfield(mbuf) = (uint64_t)inb_priv->userdata;
     164                 :            :         } else {
     165                 :            :                 /* Update dynamic field with userdata */
     166                 :          0 :                 *rte_security_dynfield(mbuf) = (uint64_t)inb_priv->userdata;
     167                 :            :         }
     168                 :            : 
     169                 :          0 :         *len = ((w3 >> 48) & 0xFFFF) + ((cq_w5 >> 16) & 0xFF) - (cq_w5 & 0xFF);
     170                 :            : 
     171                 :            :         /* Get ucc from cpt parse header */
     172                 :          0 :         ucc = w3 & 0xFF;
     173                 :          0 :         ol_flags = ((CPT_COMP_HWGOOD_MASK & (1U << ucc)) ?
     174   [ #  #  #  #  :          0 :                             RTE_MBUF_F_RX_SEC_OFFLOAD :
             #  #  #  # ]
     175                 :            :                             RTE_MBUF_F_RX_SEC_OFFLOAD | RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED);
     176                 :            : 
     177                 :          0 :         ucc = (w3 >> 8) & 0xFF;
     178   [ #  #  #  #  :          0 :         if (ucc && ucc < ROC_IE_OW_UCC_SUCCESS_PKT_IP_BADCSUM) {
             #  #  #  # ]
     179                 :            :                 ol_flags |= RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED;
     180                 :            :         } else {
     181                 :          0 :                 ucc += 3; /* To make codes in 0xFx series except 0 */
     182                 :          0 :                 ol_flags |= ((ucc & 0xF0) == 0xF0) ?
     183   [ #  #  #  #  :          0 :                                     ((NIX_RX_SEC_UCC_CONST >> ((ucc & 0xF) << 3)) & 0xFF) << 1 :
             #  #  #  # ]
     184                 :            :                                     RTE_MBUF_F_RX_IP_CKSUM_GOOD;
     185                 :            :         }
     186                 :            : 
     187                 :            :         return ol_flags;
     188                 :            : }
     189                 :            : 
     190                 :            : static __rte_always_inline uint32_t
     191                 :            : nix_ptype_get(const void *const lookup_mem, const uint64_t in)
     192                 :            : {
     193                 :            :         const uint16_t *const ptype = lookup_mem;
     194                 :          0 :         const uint16_t lh_lg_lf = (in & 0xFFF0000000000000) >> 52;
     195                 :          0 :         const uint16_t tu_l2 = ptype[(in & 0x000FFFF000000000) >> 36];
     196                 :          0 :         const uint16_t il4_tu = ptype[PTYPE_NON_TUNNEL_ARRAY_SZ + lh_lg_lf];
     197                 :            : 
     198                 :          0 :         return (il4_tu << PTYPE_NON_TUNNEL_WIDTH) | tu_l2;
     199                 :            : }
     200                 :            : 
     201                 :            : static __rte_always_inline uint32_t
     202                 :            : nix_rx_olflags_get(const void *const lookup_mem, const uint64_t in)
     203                 :            : {
     204                 :            :         const uint32_t *const ol_flags =
     205                 :            :                 (const uint32_t *)((const uint8_t *)lookup_mem + PTYPE_ARRAY_SZ);
     206                 :            : 
     207                 :          0 :         return ol_flags[(in & 0xfff00000) >> 20];
     208                 :            : }
     209                 :            : 
     210                 :            : static inline uint64_t
     211                 :          0 : nix_update_match_id(const uint16_t match_id, uint64_t ol_flags, struct rte_mbuf *mbuf)
     212                 :            : {
     213                 :            :         /* There is no separate bit to check match_id
     214                 :            :          * is valid or not? and no flag to identify it is an
     215                 :            :          * RTE_FLOW_ACTION_TYPE_FLAG vs RTE_FLOW_ACTION_TYPE_MARK
     216                 :            :          * action. The former case addressed through 0 being invalid
     217                 :            :          * value and inc/dec match_id pair when MARK is activated.
     218                 :            :          * The later case addressed through defining
     219                 :            :          * CNXK_FLOW_MARK_DEFAULT as value for
     220                 :            :          * RTE_FLOW_ACTION_TYPE_MARK.
     221                 :            :          * This would translate to not use
     222                 :            :          * CNXK_FLOW_ACTION_FLAG_DEFAULT - 1 and
     223                 :            :          * CNXK_FLOW_ACTION_FLAG_DEFAULT for match_id.
     224                 :            :          * i.e valid mark_id's are from
     225                 :            :          * 0 to CNXK_FLOW_ACTION_FLAG_DEFAULT - 2
     226                 :            :          */
     227         [ #  # ]:          0 :         if (likely(match_id)) {
     228                 :          0 :                 ol_flags |= RTE_MBUF_F_RX_FDIR;
     229         [ #  # ]:          0 :                 if (match_id != CNXK_FLOW_ACTION_FLAG_DEFAULT) {
     230                 :          0 :                         ol_flags |= RTE_MBUF_F_RX_FDIR_ID;
     231                 :          0 :                         mbuf->hash.fdir.hi = match_id - 1;
     232                 :            :                 }
     233                 :            :         }
     234                 :            : 
     235                 :          0 :         return ol_flags;
     236                 :            : }
     237                 :            : 
     238                 :            : static __rte_always_inline void
     239                 :            : nix_cqe_xtract_mseg(const union nix_rx_parse_u *rx, struct rte_mbuf *mbuf, uint64_t rearm,
     240                 :            :                     uintptr_t cpth, uintptr_t sa_base, const uint64_t buf_sz, const uint16_t flags)
     241                 :            : {
     242                 :          0 :         const struct cpt_parse_hdr_s *hdr = (const struct cpt_parse_hdr_s *)cpth;
     243                 :            :         struct cn20k_inb_priv_data *inb_priv = NULL;
     244                 :          0 :         uint32_t offset = hdr->w2.ptr_offset;
     245                 :            :         const struct cpt_frag_info_s *finfo;
     246                 :            :         uint8_t num_frags = 0, nxt_frag = 0;
     247                 :            :         struct rte_mbuf *head, *last_mbuf;
     248                 :            :         uint64_t fsz_w1 = 0, cq_w1, sg;
     249                 :            :         const rte_iova_t *iova_list;
     250                 :            :         uint8_t sg_cnt = 1, nb_segs;
     251                 :            :         uint16_t later_skip = 0;
     252                 :            :         bool reas_fail = false;
     253                 :            :         const rte_iova_t *eol;
     254                 :            :         uint8_t ts_rx_off;
     255                 :            :         int dyn_off = 0;
     256                 :            :         uint32_t len;
     257                 :            :         uintptr_t p;
     258                 :            : 
     259                 :          0 :         cq_w1 = *(const uint64_t *)rx;
     260                 :            :         ts_rx_off = (flags & NIX_RX_OFFLOAD_TSTAMP_F) ? CNXK_NIX_TIMESYNC_RX_OFFSET : 0;
     261                 :            : 
     262                 :          0 :         if ((flags & NIX_RX_SEC_REASSEMBLY_F) && (cq_w1 & BIT(11))) {
     263                 :            :                 uint64_t sg_base;
     264                 :            : 
     265                 :            :                 /* Check if there are no SG's */
     266   [ #  #  #  #  :          0 :                 if (!hdr->w4.gthr_size && ((flags & NIX_RX_REAS_F) || !hdr->w4.sctr_size))
             #  #  #  # ]
     267                 :            :                         return;
     268                 :            : 
     269                 :          0 :                 num_frags = hdr->w0.num_frags;
     270   [ #  #  #  #  :          0 :                 sg_base = cpth + (offset ? (offset << 3) : 256);
             #  #  #  # ]
     271                 :          0 :                 finfo = (const struct cpt_frag_info_s *)sg_base;
     272   [ #  #  #  #  :          0 :                 sg_base += num_frags ? (num_frags >> 2 ? 32 : 16) : 0;
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     273                 :          0 :                 sg = *(uint64_t *)sg_base;
     274                 :          0 :                 nb_segs = (sg >> 48) & 0x3;
     275                 :            :                 iova_list = (rte_iova_t *)(sg_base);
     276                 :          0 :                 eol = iova_list + (hdr->w4.gthr_size << 2);
     277                 :          0 :                 iova_list += 2;
     278                 :            : 
     279   [ #  #  #  #  :          0 :                 if ((flags & NIX_RX_REAS_F) && num_frags) {
             #  #  #  # ]
     280                 :            :                         void *inb_sa;
     281                 :            : 
     282                 :            :                         num_frags = hdr->w0.num_frags;
     283   [ #  #  #  #  :          0 :                         inb_sa = roc_nix_inl_ot_ipsec_inb_sa(sa_base, hdr->w0.cookie);
             #  #  #  # ]
     284                 :            :                         inb_priv = roc_nix_inl_ot_ipsec_inb_sa_sw_rsvd(inb_sa);
     285                 :          0 :                         dyn_off = inb_priv->reass_dynfield_off;
     286                 :          0 :                         num_frags -= 1;
     287                 :            : 
     288   [ #  #  #  #  :          0 :                         if (hdr->w0.reas_sts ||
             #  #  #  # ]
     289   [ #  #  #  #  :          0 :                             (hdr->w0.err_sum && !roc_ie_ow_ucc_is_success(hdr->w3.uc_ccode))) {
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     290                 :            :                                 reas_fail = true;
     291                 :          0 :                                 nxt_frag = (sg >> 51) & 0x3;
     292                 :          0 :                                 fsz_w1 = finfo->w1.u64 >> 16;
     293                 :          0 :                                 finfo++;
     294                 :            :                         }
     295                 :            :                 }
     296                 :            :         } else {
     297                 :          0 :                 sg = *(const uint64_t *)(rx + 1);
     298                 :          0 :                 nb_segs = (sg >> 48) & 0x3;
     299                 :            : 
     300   [ #  #  #  #  :          0 :                 if (nb_segs == 1)
             #  #  #  # ]
     301                 :            :                         return;
     302                 :            : 
     303                 :            :                 /* Skip SG_S and first IOVA */
     304                 :          0 :                 eol = ((const rte_iova_t *)(rx + 1) + ((rx->desc_sizem1 + 1) << 1));
     305                 :          0 :                 iova_list = ((const rte_iova_t *)(rx + 1)) + 2;
     306                 :            :         }
     307                 :            : 
     308                 :            :         /* Update data len as per the segment size */
     309                 :          0 :         mbuf->data_len = sg & 0xFFFF;
     310                 :          0 :         mbuf->nb_segs = nb_segs;
     311                 :            :         head = mbuf;
     312                 :            : 
     313                 :          0 :         sg = sg >> 16;
     314                 :          0 :         nb_segs--;
     315                 :            : 
     316                 :            :         later_skip = (uintptr_t)mbuf->buf_addr - (uintptr_t)mbuf;
     317                 :            : 
     318   [ #  #  #  #  :          0 :         while (nb_segs) {
             #  #  #  # ]
     319                 :            :                 last_mbuf = mbuf;
     320                 :            :                 if (flags & NIX_RX_REAS_F) {
     321                 :          0 :                         offset = (*iova_list) % (buf_sz & 0xFFFFFFFF);
     322                 :          0 :                         mbuf->next = (struct rte_mbuf *)((*iova_list) - offset + (buf_sz >> 32));
     323                 :            :                 } else {
     324                 :            :                         mbuf->next = (struct rte_mbuf *)((*iova_list) - later_skip);
     325                 :            :                 }
     326                 :            :                 mbuf = mbuf->next;
     327                 :            : 
     328                 :            :                 RTE_MEMPOOL_CHECK_COOKIES(mbuf->pool, (void **)&mbuf, 1, 1);
     329                 :            : 
     330                 :            :                 /* Process reassembly failure case */
     331   [ #  #  #  #  :          0 :                 if ((flags & NIX_RX_REAS_F) && unlikely(reas_fail && (nxt_frag & 1))) {
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     332                 :          0 :                         head->ol_flags |=
     333                 :          0 :                                 BIT_ULL(inb_priv->reass_dynflag_bit) | RTE_MBUF_F_RX_SEC_OFFLOAD;
     334                 :            : 
     335                 :          0 :                         cnxk_ip_reassembly_dynfield(head, dyn_off)->next_frag = mbuf;
     336   [ #  #  #  #  :          0 :                         cnxk_ip_reassembly_dynfield(head, dyn_off)->nb_frags = num_frags;
             #  #  #  # ]
     337                 :            : 
     338                 :            :                         /* Update dynamic field with userdata from prev head */
     339                 :          0 :                         *rte_security_dynfield(mbuf) = *rte_security_dynfield(head);
     340                 :            : 
     341                 :            :                         /* Reset last mbuf next and start new mbuf chain */
     342                 :          0 :                         last_mbuf->next = NULL;
     343                 :            :                         head = mbuf;
     344                 :          0 :                         len = fsz_w1 & 0xFFFF;
     345                 :          0 :                         head->pkt_len = len - ts_rx_off;
     346                 :            :                         head->nb_segs = sg_cnt;
     347                 :            :                         sg_cnt = 0;
     348                 :          0 :                         nxt_frag = nxt_frag >> 1;
     349                 :          0 :                         fsz_w1 = fsz_w1 >> 16;
     350   [ #  #  #  #  :          0 :                         if (--num_frags == 4)
             #  #  #  # ]
     351                 :          0 :                                 fsz_w1 = finfo->w1.u64;
     352                 :            :                 }
     353                 :            : 
     354                 :          0 :                 mbuf->data_len = (sg & 0xFFFF) - ts_rx_off;
     355                 :          0 :                 sg = sg >> 16;
     356                 :            :                 p = (uintptr_t)&mbuf->rearm_data;
     357                 :          0 :                 *(uint64_t *)p = rearm & ~0xFFFF;
     358                 :            : 
     359                 :            :                 sg_cnt++;
     360                 :          0 :                 nb_segs--;
     361                 :          0 :                 iova_list++;
     362                 :            : 
     363   [ #  #  #  #  :          0 :                 if (!nb_segs && (iova_list + 1 < eol)) {
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     364                 :          0 :                         sg = *(const uint64_t *)(iova_list);
     365                 :          0 :                         nb_segs = (sg >> 48) & 0x3;
     366                 :            :                         iova_list++;
     367                 :          0 :                         head->nb_segs += nb_segs;
     368   [ #  #  #  #  :          0 :                         if ((flags & NIX_RX_REAS_F) && reas_fail)
             #  #  #  # ]
     369                 :          0 :                                 nxt_frag = (sg >> 50) & 0x7;
     370                 :            :                 }
     371                 :            :         }
     372                 :            : 
     373                 :            :         /* Update for last failure fragment */
     374   [ #  #  #  #  :          0 :         if ((flags & NIX_RX_REAS_F) && reas_fail) {
             #  #  #  # ]
     375                 :          0 :                 cnxk_ip_reassembly_dynfield(head, dyn_off)->next_frag = NULL;
     376                 :          0 :                 cnxk_ip_reassembly_dynfield(head, dyn_off)->nb_frags = 0;
     377                 :            :         }
     378                 :            : }
     379                 :            : 
     380                 :            : static __rte_always_inline void
     381                 :            : cn20k_nix_cqe_to_mbuf(const struct nix_cqe_hdr_s *cq, const uint32_t tag, struct rte_mbuf *mbuf,
     382                 :            :                       const void *lookup_mem, uint64_t val, const uintptr_t cpth,
     383                 :            :                       const uintptr_t sa_base, const uint64_t buf_sz, const uint16_t flag)
     384                 :            : {
     385                 :            :         const union nix_rx_parse_u *rx = (const union nix_rx_parse_u *)((const uint64_t *)cq + 1);
     386                 :          0 :         const uint64_t w1 = *(const uint64_t *)rx;
     387                 :          0 :         uint16_t len = rx->pkt_lenm1 + 1;
     388                 :            :         uint64_t ol_flags = 0;
     389                 :            :         uintptr_t p;
     390                 :            : 
     391                 :            :         if (flag & NIX_RX_OFFLOAD_PTYPE_F)
     392                 :          0 :                 mbuf->packet_type = nix_ptype_get(lookup_mem, w1);
     393                 :            :         else
     394                 :          0 :                 mbuf->packet_type = 0;
     395                 :            : 
     396                 :            :         if (flag & NIX_RX_OFFLOAD_RSS_F) {
     397                 :          0 :                 mbuf->hash.rss = tag;
     398                 :            :                 ol_flags |= RTE_MBUF_F_RX_RSS_HASH;
     399                 :            :         }
     400                 :            : 
     401                 :          0 :         ol_flags |= (uint64_t)nix_rx_olflags_get(lookup_mem, w1);
     402                 :            : 
     403                 :            :         if (flag & NIX_RX_OFFLOAD_VLAN_STRIP_F) {
     404   [ #  #  #  #  :          0 :                 if (rx->vtag0_gone) {
             #  #  #  # ]
     405                 :          0 :                         ol_flags |= RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED;
     406                 :          0 :                         mbuf->vlan_tci = rx->vtag0_tci;
     407                 :            :                 }
     408   [ #  #  #  #  :          0 :                 if (rx->vtag1_gone) {
             #  #  #  # ]
     409                 :          0 :                         ol_flags |= RTE_MBUF_F_RX_QINQ | RTE_MBUF_F_RX_QINQ_STRIPPED;
     410                 :          0 :                         mbuf->vlan_tci_outer = rx->vtag1_tci;
     411                 :            :                 }
     412                 :            :         }
     413                 :            : 
     414                 :            :         if (flag & NIX_RX_OFFLOAD_MARK_UPDATE_F)
     415                 :          0 :                 ol_flags = nix_update_match_id(rx->match_id, ol_flags, mbuf);
     416                 :            : 
     417   [ #  #  #  #  :          0 :         if (flag & NIX_RX_OFFLOAD_SECURITY_F && w1 & BIT_ULL(11)) {
             #  #  #  # ]
     418   [ #  #  #  #  :          0 :                 const uint64_t cq_w5 = *((const uint64_t *)cq + 5);
             #  #  #  # ]
     419                 :            : 
     420                 :          0 :                 ol_flags |= nix_sec_meta_to_mbuf_sc(cq_w5, cpth, sa_base, mbuf, &len, &val, flag);
     421                 :            :         }
     422                 :            : 
     423                 :            :         p = (uintptr_t)&mbuf->rearm_data;
     424                 :          0 :         *(uint64_t *)p = val;
     425                 :            : 
     426                 :          0 :         mbuf->ol_flags = ol_flags;
     427                 :          0 :         mbuf->pkt_len = len;
     428   [ #  #  #  #  :          0 :         mbuf->data_len = len;
             #  #  #  # ]
     429                 :            : 
     430                 :            :         if ((flag & NIX_RX_MULTI_SEG_F) || (flag & NIX_RX_REAS_F))
     431                 :            :                 nix_cqe_xtract_mseg(rx, mbuf, val, cpth, sa_base, buf_sz, flag);
     432                 :            : }
     433                 :            : 
     434                 :            : static inline uint16_t
     435                 :            : nix_rx_nb_pkts(struct cn20k_eth_rxq *rxq, const uint64_t wdata, const uint16_t pkts,
     436                 :            :                const uint32_t qmask)
     437                 :            : {
     438                 :            :         uint32_t available = rxq->available;
     439                 :            : 
     440                 :            :         /* Update the available count if cached value is not enough */
     441                 :            :         if (unlikely(available < pkts)) {
     442                 :            :                 uint64_t reg, head, tail;
     443                 :            : 
     444                 :            :                 /* Use LDADDA version to avoid reorder */
     445                 :            :                 reg = roc_atomic64_add_sync(wdata, rxq->cq_status);
     446                 :            :                 /* CQ_OP_STATUS operation error */
     447                 :            :                 if (reg & BIT_ULL(NIX_CQ_OP_STAT_OP_ERR) || reg & BIT_ULL(NIX_CQ_OP_STAT_CQ_ERR))
     448                 :            :                         return 0;
     449                 :            : 
     450                 :            :                 tail = reg & 0xFFFFF;
     451                 :            :                 head = (reg >> 20) & 0xFFFFF;
     452                 :            :                 if (tail < head)
     453                 :            :                         available = tail - head + qmask + 1;
     454                 :            :                 else
     455                 :            :                         available = tail - head;
     456                 :            : 
     457                 :            :                 rxq->available = available;
     458                 :            :         }
     459                 :            : 
     460                 :            :         return RTE_MIN(pkts, available);
     461                 :            : }
     462                 :            : 
     463                 :            : static __rte_always_inline void
     464                 :            : cn20k_nix_mbuf_to_tstamp(struct rte_mbuf *mbuf, struct cnxk_timesync_info *tstamp,
     465                 :            :                          const uint8_t ts_enable, uint64_t *tstamp_ptr)
     466                 :            : {
     467                 :            :         if (ts_enable) {
     468                 :          0 :                 mbuf->pkt_len -= CNXK_NIX_TIMESYNC_RX_OFFSET;
     469                 :          0 :                 mbuf->data_len -= CNXK_NIX_TIMESYNC_RX_OFFSET;
     470                 :            : 
     471                 :            :                 /* Reading the rx timestamp inserted by CGX, viz at
     472                 :            :                  * starting of the packet data.
     473                 :            :                  */
     474                 :          0 :                 *tstamp_ptr = ((*tstamp_ptr >> 32) * NSEC_PER_SEC) + (*tstamp_ptr & 0xFFFFFFFFUL);
     475         [ #  # ]:          0 :                 *cnxk_nix_timestamp_dynfield(mbuf, tstamp) = rte_be_to_cpu_64(*tstamp_ptr);
     476                 :            :                 /* RTE_MBUF_F_RX_IEEE1588_TMST flag needs to be set only in case
     477                 :            :                  * PTP packets are received.
     478                 :            :                  */
     479         [ #  # ]:          0 :                 if (mbuf->packet_type == RTE_PTYPE_L2_ETHER_TIMESYNC) {
     480                 :          0 :                         tstamp->rx_tstamp = *cnxk_nix_timestamp_dynfield(mbuf, tstamp);
     481                 :          0 :                         tstamp->rx_ready = 1;
     482                 :          0 :                         mbuf->ol_flags |= RTE_MBUF_F_RX_IEEE1588_PTP | RTE_MBUF_F_RX_IEEE1588_TMST |
     483                 :          0 :                                           tstamp->rx_tstamp_dynflag;
     484                 :            :                 }
     485                 :            :         }
     486                 :            : }
     487                 :            : 
     488                 :            : static __rte_always_inline uint16_t
     489                 :            : cn20k_nix_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts, const uint16_t flags)
     490                 :            : {
     491                 :            :         struct cn20k_eth_rxq *rxq = rx_queue;
     492                 :            :         uint64_t mbuf_init = rxq->mbuf_initializer;
     493                 :            :         const void *lookup_mem = rxq->lookup_mem;
     494                 :            :         const uint64_t data_off = rxq->data_off;
     495                 :            :         uint8_t m_sz = sizeof(struct rte_mbuf);
     496                 :            :         const uint64_t wdata = rxq->wdata;
     497                 :            :         const uint32_t qmask = rxq->qmask;
     498                 :            :         const uintptr_t desc = rxq->desc;
     499                 :            :         uint64_t buf_sz = rxq->mp_buf_sz;
     500                 :            :         uint64_t lbase = rxq->lmt_base;
     501                 :            :         uint16_t packets = 0, nb_pkts;
     502                 :            :         uint8_t loff = 0, lnum = 0;
     503                 :            :         uint32_t head = rxq->head;
     504                 :            :         struct nix_cqe_hdr_s *cq;
     505                 :            :         struct rte_mbuf *mbuf;
     506                 :            :         uint64_t aura_handle;
     507                 :            :         uint64_t sa_base = 0;
     508                 :            :         uintptr_t cpth = 0;
     509                 :            :         uint16_t lmt_id;
     510                 :            :         uint64_t laddr;
     511                 :            : 
     512                 :            :         nb_pkts = nix_rx_nb_pkts(rxq, wdata, pkts, qmask);
     513                 :            : 
     514                 :            :         if (flags & NIX_RX_OFFLOAD_SECURITY_F) {
     515                 :            :                 aura_handle = rxq->meta_aura;
     516                 :            :                 sa_base = rxq->sa_base;
     517                 :            :                 sa_base &= ~(ROC_NIX_INL_SA_BASE_ALIGN - 1);
     518                 :            :                 ROC_LMT_BASE_ID_GET(lbase, lmt_id);
     519                 :            :                 laddr = lbase;
     520                 :            :                 laddr += 8;
     521                 :            :         }
     522                 :            : 
     523                 :            :         while (packets < nb_pkts) {
     524                 :            :                 /* Prefetch N desc ahead */
     525                 :            :                 rte_prefetch_non_temporal((void *)(desc + (CQE_SZ((head + 2) & qmask))));
     526                 :            :                 cq = (struct nix_cqe_hdr_s *)(desc + CQE_SZ(head));
     527                 :            : 
     528                 :            :                 mbuf = nix_get_mbuf_from_cqe(cq, data_off);
     529                 :            : 
     530                 :            :                 /* Mark mempool obj as "get" as it is alloc'ed by NIX */
     531                 :            :                 RTE_MEMPOOL_CHECK_COOKIES(mbuf->pool, (void **)&mbuf, 1, 1);
     532                 :            : 
     533                 :            :                 /* Translate meta to mbuf */
     534                 :            :                 if (flags & NIX_RX_OFFLOAD_SECURITY_F) {
     535                 :            :                         const uint64_t cq_w1 = *((const uint64_t *)cq + 1);
     536                 :            : 
     537                 :            :                         cpth = ((uintptr_t)mbuf + (uint16_t)data_off);
     538                 :            : 
     539                 :            :                         if (cq_w1 & BIT(11)) {
     540                 :            :                                 /* Mark meta mbuf as put */
     541                 :            :                                 RTE_MEMPOOL_CHECK_COOKIES(mbuf->pool, (void **)&mbuf, 1, 0);
     542                 :            : 
     543                 :            :                                 /* Store meta in lmtline to free
     544                 :            :                                  * Assume all meta's from same aura.
     545                 :            :                                  */
     546                 :            :                                 *(uint64_t *)(laddr + (loff << 3)) = (uint64_t)mbuf;
     547                 :            :                                 loff = loff + 1;
     548                 :            :                                 mbuf = (struct rte_mbuf *)(*(uint64_t *)(cpth + 8) - m_sz);
     549                 :            : 
     550                 :            :                                 /* Mark inner mbuf as get */
     551                 :            :                                 RTE_MEMPOOL_CHECK_COOKIES(mbuf->pool, (void **)&mbuf, 1, 1);
     552                 :            :                         }
     553                 :            :                 }
     554                 :            : 
     555                 :            :                 cn20k_nix_cqe_to_mbuf(cq, cq->tag, mbuf, lookup_mem, mbuf_init, cpth, sa_base,
     556                 :            :                                       buf_sz, flags);
     557                 :            :                 cn20k_nix_mbuf_to_tstamp(mbuf, rxq->tstamp, (flags & NIX_RX_OFFLOAD_TSTAMP_F),
     558                 :            :                                          (uint64_t *)((uint8_t *)mbuf + data_off));
     559                 :            :                 rx_pkts[packets++] = mbuf;
     560                 :            :                 roc_prefetch_store_keep(mbuf);
     561                 :            :                 head++;
     562                 :            :                 head &= qmask;
     563                 :            : 
     564                 :            :                 if (flags & NIX_RX_OFFLOAD_SECURITY_F) {
     565                 :            :                         /* Flush when we don't have space for 4 meta */
     566                 :            :                         if ((15 - loff) < 1) {
     567                 :            :                                 nix_sec_flush_meta(laddr, lmt_id + lnum, loff, aura_handle);
     568                 :            :                                 lnum++;
     569                 :            :                                 lnum &= BIT_ULL(ROC_LMT_LINES_PER_CORE_LOG2) - 1;
     570                 :            :                                 /* First pointer starts at 8B offset */
     571                 :            :                                 laddr = (uintptr_t)LMT_OFF(lbase, lnum, 8);
     572                 :            :                                 loff = 0;
     573                 :            :                         }
     574                 :            :                 }
     575                 :            :         }
     576                 :            : 
     577                 :            :         rxq->head = head;
     578                 :            :         rxq->available -= nb_pkts;
     579                 :            : 
     580                 :            :         /* Free all the CQs that we've processed */
     581                 :            :         plt_write64((wdata | nb_pkts), rxq->cq_door);
     582                 :            : 
     583                 :            :         /* Free remaining meta buffers if any */
     584                 :            :         if (flags & NIX_RX_OFFLOAD_SECURITY_F && loff)
     585                 :            :                 nix_sec_flush_meta(laddr, lmt_id + lnum, loff, aura_handle);
     586                 :            : 
     587                 :            :         if (flags & NIX_RX_OFFLOAD_SECURITY_F)
     588                 :            :                 rte_io_wmb();
     589                 :            : 
     590                 :            :         return nb_pkts;
     591                 :            : }
     592                 :            : 
     593                 :            : static __rte_always_inline uint16_t
     594                 :            : cn20k_nix_flush_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts,
     595                 :            :                           const uint16_t flags)
     596                 :            : {
     597                 :            :         struct cn20k_eth_rxq *rxq = rx_queue;
     598                 :            :         uint64_t mbuf_init = rxq->mbuf_initializer;
     599                 :            :         const void *lookup_mem = rxq->lookup_mem;
     600                 :            :         const uint64_t data_off = rxq->data_off;
     601                 :            :         uint8_t m_sz = sizeof(struct rte_mbuf);
     602                 :            :         const uint64_t wdata = rxq->wdata;
     603                 :            :         const uint32_t qmask = rxq->qmask;
     604                 :            :         const uintptr_t desc = rxq->desc;
     605                 :            :         uint64_t buf_sz = rxq->mp_buf_sz;
     606                 :            :         uint16_t packets = 0, nb_pkts;
     607                 :            :         uint16_t lmt_id __rte_unused;
     608                 :            :         uint32_t head = rxq->head;
     609                 :            :         struct nix_cqe_hdr_s *cq;
     610                 :            :         struct rte_mbuf *mbuf;
     611                 :            :         uint64_t sa_base = 0;
     612                 :            :         uintptr_t cpth = 0;
     613                 :            : 
     614                 :            :         nb_pkts = nix_rx_nb_pkts(rxq, wdata, pkts, qmask);
     615                 :            : 
     616                 :            :         if (flags & NIX_RX_OFFLOAD_SECURITY_F) {
     617                 :            :                 sa_base = rxq->sa_base;
     618                 :            :                 sa_base &= ~(ROC_NIX_INL_SA_BASE_ALIGN - 1);
     619                 :            :         }
     620                 :            : 
     621                 :            :         while (packets < nb_pkts) {
     622                 :            :                 /* Prefetch N desc ahead */
     623                 :            :                 rte_prefetch_non_temporal((void *)(desc + (CQE_SZ((head + 2) & qmask))));
     624                 :            :                 cq = (struct nix_cqe_hdr_s *)(desc + CQE_SZ(head));
     625                 :            : 
     626                 :            :                 mbuf = nix_get_mbuf_from_cqe(cq, data_off);
     627                 :            : 
     628                 :            :                 /* Mark mempool obj as "get" as it is alloc'ed by NIX */
     629                 :            :                 RTE_MEMPOOL_CHECK_COOKIES(mbuf->pool, (void **)&mbuf, 1, 1);
     630                 :            : 
     631                 :            :                 /* Translate meta to mbuf */
     632                 :            :                 if (flags & NIX_RX_OFFLOAD_SECURITY_F) {
     633                 :            :                         const uint64_t cq_w1 = *((const uint64_t *)cq + 1);
     634                 :            : 
     635                 :            :                         cpth = ((uintptr_t)mbuf + (uint16_t)data_off);
     636                 :            : 
     637                 :            :                         if (cq_w1 & BIT(11)) {
     638                 :            :                                 /* Mark meta mbuf as put */
     639                 :            :                                 RTE_MEMPOOL_CHECK_COOKIES(mbuf->pool, (void **)&mbuf, 1, 0);
     640                 :            : 
     641                 :            :                                 /* Store meta in lmtline to free
     642                 :            :                                  * Assume all meta's from same aura.
     643                 :            :                                  */
     644                 :            :                                 roc_npa_aura_op_free(mbuf->pool->pool_id, 0, (uint64_t)mbuf);
     645                 :            :                                 mbuf = (struct rte_mbuf *)(*(uint64_t *)(cpth + 8) - m_sz);
     646                 :            : 
     647                 :            :                                 /* Mark inner mbuf as get */
     648                 :            :                                 RTE_MEMPOOL_CHECK_COOKIES(mbuf->pool, (void **)&mbuf, 1, 1);
     649                 :            :                         }
     650                 :            :                 }
     651                 :            : 
     652                 :            :                 cn20k_nix_cqe_to_mbuf(cq, cq->tag, mbuf, lookup_mem, mbuf_init, cpth, sa_base,
     653                 :            :                                       buf_sz, flags);
     654                 :            :                 cn20k_nix_mbuf_to_tstamp(mbuf, rxq->tstamp, (flags & NIX_RX_OFFLOAD_TSTAMP_F),
     655                 :            :                                          (uint64_t *)((uint8_t *)mbuf + data_off));
     656                 :            :                 rx_pkts[packets++] = mbuf;
     657                 :            :                 roc_prefetch_store_keep(mbuf);
     658                 :            :                 head++;
     659                 :            :                 head &= qmask;
     660                 :            :         }
     661                 :            : 
     662                 :            :         rxq->head = head;
     663                 :            :         rxq->available -= nb_pkts;
     664                 :            : 
     665                 :            :         /* Free all the CQs that we've processed */
     666                 :            :         plt_write64((wdata | nb_pkts), rxq->cq_door);
     667                 :            : 
     668                 :            :         if (flags & NIX_RX_OFFLOAD_SECURITY_F)
     669                 :            :                 rte_io_wmb();
     670                 :            : 
     671                 :            :         return nb_pkts;
     672                 :            : }
     673                 :            : 
     674                 :            : #if defined(RTE_ARCH_ARM64)
     675                 :            : 
     676                 :            : static __rte_always_inline void
     677                 :            : nix_sec_meta_to_mbuf(uintptr_t inb_sa, uintptr_t cpth, struct rte_mbuf **inner, uint64_t *ol_flags,
     678                 :            :                      const uint16_t flags, uint64x2_t *rearm)
     679                 :            : {
     680                 :            :         const struct cpt_parse_hdr_s *hdr = (const struct cpt_parse_hdr_s *)cpth;
     681                 :            :         struct rte_mbuf *inner_m = inner[0];
     682                 :            :         struct cn20k_inb_priv_data *inb_priv;
     683                 :            : 
     684                 :            :         /* Clear checksum flags */
     685                 :            :         *ol_flags &= ~(RTE_MBUF_F_RX_L4_CKSUM_MASK | RTE_MBUF_F_RX_IP_CKSUM_MASK);
     686                 :            : 
     687                 :            :         if (flags & NIX_RX_REAS_F && !inb_sa) {
     688                 :            :                 /* Clear and update original lower 16 bit of data offset */
     689                 :            :                 *rearm = (*rearm & ~(BIT_ULL(16) - 1)) | inner_m->data_off;
     690                 :            :         } else {
     691                 :            :                 /* Get SPI from CPT_PARSE_S's cookie(already swapped) */
     692                 :            :                 inb_priv = roc_nix_inl_ot_ipsec_inb_sa_sw_rsvd((void *)inb_sa);
     693                 :            :                 /* Update dynamic field with userdata */
     694                 :            :                 *rte_security_dynfield(inner_m) = (uint64_t)inb_priv->userdata;
     695                 :            :         }
     696                 :            : 
     697                 :            :         /* Clear and update original lower 16 bit of data offset */
     698                 :            :         if (flags & NIX_RX_REAS_F && hdr->w0.match_id == 0xFFFFU)
     699                 :            :                 *rearm = (*rearm & ~(BIT_ULL(16) - 1)) | inner_m->data_off;
     700                 :            : 
     701                 :            :         /* Mark inner mbuf as get */
     702                 :            :         RTE_MEMPOOL_CHECK_COOKIES(inner_m->pool, (void **)&inner_m, 1, 1);
     703                 :            : }
     704                 :            : 
     705                 :            : static __rte_always_inline uint64_t
     706                 :            : nix_vlan_update(const uint64_t w2, uint64_t ol_flags, uint8x16_t *f)
     707                 :            : {
     708                 :            :         if (w2 & BIT_ULL(21) /* vtag0_gone */) {
     709                 :            :                 ol_flags |= RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED;
     710                 :            :                 *f = vsetq_lane_u16((uint16_t)(w2 >> 32), *f, 5);
     711                 :            :         }
     712                 :            : 
     713                 :            :         return ol_flags;
     714                 :            : }
     715                 :            : 
     716                 :            : static __rte_always_inline uint64_t
     717                 :            : nix_qinq_update(const uint64_t w2, uint64_t ol_flags, struct rte_mbuf *mbuf)
     718                 :            : {
     719                 :            :         if (w2 & BIT_ULL(23) /* vtag1_gone */) {
     720                 :            :                 ol_flags |= RTE_MBUF_F_RX_QINQ | RTE_MBUF_F_RX_QINQ_STRIPPED;
     721                 :            :                 mbuf->vlan_tci_outer = (uint16_t)(w2 >> 48);
     722                 :            :         }
     723                 :            : 
     724                 :            :         return ol_flags;
     725                 :            : }
     726                 :            : 
     727                 :            : #define NIX_PUSH_META_TO_FREE(_mbuf, _laddr, _loff_p)                                              \
     728                 :            :         do {                                                                                       \
     729                 :            :                 *(uint64_t *)((_laddr) + (*(_loff_p) << 3)) = (uint64_t)_mbuf;                     \
     730                 :            :                 *(_loff_p) = *(_loff_p) + 1;                                                       \
     731                 :            :                 /* Mark meta mbuf as put */                                                        \
     732                 :            :                 RTE_MEMPOOL_CHECK_COOKIES(_mbuf->pool, (void **)&_mbuf, 1, 0);                     \
     733                 :            :         } while (0)
     734                 :            : 
     735                 :            : static __rte_always_inline uint16_t
     736                 :            : cn20k_nix_recv_pkts_vector(void *args, struct rte_mbuf **mbufs, uint16_t pkts, const uint16_t flags,
     737                 :            :                            void *lookup_mem, struct cnxk_timesync_info *tstamp, uintptr_t lmt_base,
     738                 :            :                            uint64_t meta_aura)
     739                 :            : {
     740                 :            :         struct cn20k_eth_rxq *rxq = args;
     741                 :            :         const uint64_t mbuf_initializer =
     742                 :            :                 (flags & NIX_RX_VWQE_F) ? *(uint64_t *)args : rxq->mbuf_initializer;
     743                 :            :         const uint64x2_t data_off = flags & NIX_RX_VWQE_F ? vdupq_n_u64(RTE_PKTMBUF_HEADROOM) :
     744                 :            :                                                             vdupq_n_u64(rxq->data_off);
     745                 :            :         const uint32_t qmask = flags & NIX_RX_VWQE_F ? 0 : rxq->qmask;
     746                 :            :         const uint64_t wdata = flags & NIX_RX_VWQE_F ? 0 : rxq->wdata;
     747                 :            :         const uintptr_t desc = flags & NIX_RX_VWQE_F ? 0 : rxq->desc;
     748                 :            :         uint64x2_t cq0_w8, cq1_w8, cq2_w8, cq3_w8, mbuf01, mbuf23;
     749                 :            :         uintptr_t cpth0 = 0, cpth1 = 0, cpth2 = 0, cpth3 = 0;
     750                 :            :         uint64_t ol_flags0, ol_flags1, ol_flags2, ol_flags3;
     751                 :            :         uint64x2_t rearm0 = vdupq_n_u64(mbuf_initializer);
     752                 :            :         uint64x2_t rearm1 = vdupq_n_u64(mbuf_initializer);
     753                 :            :         uint64x2_t rearm2 = vdupq_n_u64(mbuf_initializer);
     754                 :            :         uint64x2_t rearm3 = vdupq_n_u64(mbuf_initializer);
     755                 :            :         struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3;
     756                 :            :         uint8_t loff = 0, lnum = 0, shft = 0;
     757                 :            :         uint64_t lbase, laddr, buf_sz;
     758                 :            :         uint8x16_t f0, f1, f2, f3;
     759                 :            :         uint16_t lmt_id, d_off;
     760                 :            :         uintptr_t sa_base = 0;
     761                 :            :         uint16_t packets = 0;
     762                 :            :         uint16_t pkts_left;
     763                 :            :         uint32_t head;
     764                 :            :         uintptr_t cq0;
     765                 :            : 
     766                 :            :         if (!(flags & NIX_RX_VWQE_F)) {
     767                 :            :                 lookup_mem = rxq->lookup_mem;
     768                 :            :                 head = rxq->head;
     769                 :            : 
     770                 :            :                 pkts = nix_rx_nb_pkts(rxq, wdata, pkts, qmask);
     771                 :            :                 pkts_left = pkts & (NIX_DESCS_PER_LOOP - 1);
     772                 :            :                 /* Packets has to be floor-aligned to NIX_DESCS_PER_LOOP */
     773                 :            :                 pkts = RTE_ALIGN_FLOOR(pkts, NIX_DESCS_PER_LOOP);
     774                 :            :                 if (flags & NIX_RX_OFFLOAD_TSTAMP_F)
     775                 :            :                         tstamp = rxq->tstamp;
     776                 :            : 
     777                 :            :                 cq0 = desc + CQE_SZ(head);
     778                 :            :                 rte_prefetch0(CQE_PTR_OFF(cq0, 0, 64, flags));
     779                 :            :                 rte_prefetch0(CQE_PTR_OFF(cq0, 1, 64, flags));
     780                 :            :                 rte_prefetch0(CQE_PTR_OFF(cq0, 2, 64, flags));
     781                 :            :                 rte_prefetch0(CQE_PTR_OFF(cq0, 3, 64, flags));
     782                 :            :         } else {
     783                 :            :                 RTE_SET_USED(head);
     784                 :            :         }
     785                 :            : 
     786                 :            :         if (flags & NIX_RX_OFFLOAD_SECURITY_F) {
     787                 :            :                 if (flags & NIX_RX_VWQE_F) {
     788                 :            :                         uint64_t sg_w1;
     789                 :            :                         uint16_t port;
     790                 :            : 
     791                 :            :                         mbuf0 = (struct rte_mbuf *)((uintptr_t)mbufs[0] - sizeof(struct rte_mbuf));
     792                 :            :                         /* Pick first mbuf's aura handle assuming all
     793                 :            :                          * mbufs are from a vec and are from same RQ.
     794                 :            :                          */
     795                 :            :                         if (!meta_aura)
     796                 :            :                                 meta_aura = mbuf0->pool->pool_id;
     797                 :            :                         /* Calculate offset from mbuf to actual data area */
     798                 :            :                         /* Zero aura's first skip i.e mbuf setup might not match the actual
     799                 :            :                          * offset as first skip is taken from second pass RQ. So compute
     800                 :            :                          * using diff b/w first SG pointer and mbuf addr.
     801                 :            :                          */
     802                 :            :                         sg_w1 = *(uint64_t *)((uintptr_t)mbufs[0] + 72);
     803                 :            :                         d_off = (sg_w1 - (uint64_t)mbuf0);
     804                 :            : 
     805                 :            :                         /* Get SA Base from lookup tbl using port_id */
     806                 :            :                         port = mbuf_initializer >> 48;
     807                 :            :                         sa_base = cnxk_nix_sa_base_get(port, lookup_mem);
     808                 :            :                         buf_sz = cnxk_nix_inl_bufsize_get(port, lookup_mem);
     809                 :            :                         lbase = lmt_base;
     810                 :            :                 } else {
     811                 :            :                         meta_aura = rxq->meta_aura;
     812                 :            :                         d_off = rxq->data_off;
     813                 :            :                         sa_base = rxq->sa_base;
     814                 :            :                         lbase = rxq->lmt_base;
     815                 :            :                         buf_sz = rxq->mp_buf_sz;
     816                 :            :                 }
     817                 :            : 
     818                 :            :                 sa_base &= ~(ROC_NIX_INL_SA_BASE_ALIGN - 1);
     819                 :            :                 ROC_LMT_BASE_ID_GET(lbase, lmt_id);
     820                 :            :                 lnum = 0;
     821                 :            :                 laddr = lbase;
     822                 :            :                 laddr += 8;
     823                 :            :         }
     824                 :            : 
     825                 :            :         while (packets < pkts) {
     826                 :            :                 if (!(flags & NIX_RX_VWQE_F)) {
     827                 :            :                         /* Exit loop if head is about to wrap and become
     828                 :            :                          * unaligned.
     829                 :            :                          */
     830                 :            :                         if (((head + NIX_DESCS_PER_LOOP - 1) & qmask) < NIX_DESCS_PER_LOOP) {
     831                 :            :                                 pkts_left += (pkts - packets);
     832                 :            :                                 break;
     833                 :            :                         }
     834                 :            : 
     835                 :            :                         cq0 = desc + CQE_SZ(head);
     836                 :            :                 } else {
     837                 :            :                         cq0 = (uintptr_t)&mbufs[packets];
     838                 :            :                 }
     839                 :            : 
     840                 :            :                 if (flags & NIX_RX_VWQE_F) {
     841                 :            :                         if (pkts - packets > 4) {
     842                 :            :                                 rte_prefetch_non_temporal(CQE_PTR_OFF(cq0, 4, 0, flags));
     843                 :            :                                 rte_prefetch_non_temporal(CQE_PTR_OFF(cq0, 5, 0, flags));
     844                 :            :                                 rte_prefetch_non_temporal(CQE_PTR_OFF(cq0, 6, 0, flags));
     845                 :            :                                 rte_prefetch_non_temporal(CQE_PTR_OFF(cq0, 7, 0, flags));
     846                 :            : 
     847                 :            :                                 if (likely(pkts - packets > 8)) {
     848                 :            :                                         rte_prefetch1(CQE_PTR_OFF(cq0, 8, 0, flags));
     849                 :            :                                         rte_prefetch1(CQE_PTR_OFF(cq0, 9, 0, flags));
     850                 :            :                                         rte_prefetch1(CQE_PTR_OFF(cq0, 10, 0, flags));
     851                 :            :                                         rte_prefetch1(CQE_PTR_OFF(cq0, 11, 0, flags));
     852                 :            :                                         if (pkts - packets > 12) {
     853                 :            :                                                 rte_prefetch1(CQE_PTR_OFF(cq0, 12, 0, flags));
     854                 :            :                                                 rte_prefetch1(CQE_PTR_OFF(cq0, 13, 0, flags));
     855                 :            :                                                 rte_prefetch1(CQE_PTR_OFF(cq0, 14, 0, flags));
     856                 :            :                                                 rte_prefetch1(CQE_PTR_OFF(cq0, 15, 0, flags));
     857                 :            :                                         }
     858                 :            :                                 }
     859                 :            : 
     860                 :            :                                 rte_prefetch0(CQE_PTR_DIFF(cq0, 4, RTE_PKTMBUF_HEADROOM, flags));
     861                 :            :                                 rte_prefetch0(CQE_PTR_DIFF(cq0, 5, RTE_PKTMBUF_HEADROOM, flags));
     862                 :            :                                 rte_prefetch0(CQE_PTR_DIFF(cq0, 6, RTE_PKTMBUF_HEADROOM, flags));
     863                 :            :                                 rte_prefetch0(CQE_PTR_DIFF(cq0, 7, RTE_PKTMBUF_HEADROOM, flags));
     864                 :            : 
     865                 :            :                                 if (likely(pkts - packets > 8)) {
     866                 :            :                                         rte_prefetch0(
     867                 :            :                                                 CQE_PTR_DIFF(cq0, 8, RTE_PKTMBUF_HEADROOM, flags));
     868                 :            :                                         rte_prefetch0(
     869                 :            :                                                 CQE_PTR_DIFF(cq0, 9, RTE_PKTMBUF_HEADROOM, flags));
     870                 :            :                                         rte_prefetch0(
     871                 :            :                                                 CQE_PTR_DIFF(cq0, 10, RTE_PKTMBUF_HEADROOM, flags));
     872                 :            :                                         rte_prefetch0(
     873                 :            :                                                 CQE_PTR_DIFF(cq0, 11, RTE_PKTMBUF_HEADROOM, flags));
     874                 :            :                                 }
     875                 :            :                         }
     876                 :            :                 } else {
     877                 :            :                         if (pkts - packets > 8) {
     878                 :            :                                 if (flags) {
     879                 :            :                                         rte_prefetch0(CQE_PTR_OFF(cq0, 8, 0, flags));
     880                 :            :                                         rte_prefetch0(CQE_PTR_OFF(cq0, 9, 0, flags));
     881                 :            :                                         rte_prefetch0(CQE_PTR_OFF(cq0, 10, 0, flags));
     882                 :            :                                         rte_prefetch0(CQE_PTR_OFF(cq0, 11, 0, flags));
     883                 :            :                                 }
     884                 :            :                                 rte_prefetch0(CQE_PTR_OFF(cq0, 8, 64, flags));
     885                 :            :                                 rte_prefetch0(CQE_PTR_OFF(cq0, 9, 64, flags));
     886                 :            :                                 rte_prefetch0(CQE_PTR_OFF(cq0, 10, 64, flags));
     887                 :            :                                 rte_prefetch0(CQE_PTR_OFF(cq0, 11, 64, flags));
     888                 :            :                         }
     889                 :            :                 }
     890                 :            : 
     891                 :            :                 if (!(flags & NIX_RX_VWQE_F)) {
     892                 :            :                         /* Get NIX_RX_SG_S for size and buffer pointer */
     893                 :            :                         cq0_w8 = vld1q_u64(CQE_PTR_OFF(cq0, 0, 64, flags));
     894                 :            :                         cq1_w8 = vld1q_u64(CQE_PTR_OFF(cq0, 1, 64, flags));
     895                 :            :                         cq2_w8 = vld1q_u64(CQE_PTR_OFF(cq0, 2, 64, flags));
     896                 :            :                         cq3_w8 = vld1q_u64(CQE_PTR_OFF(cq0, 3, 64, flags));
     897                 :            : 
     898                 :            :                         /* Extract mbuf from NIX_RX_SG_S */
     899                 :            :                         mbuf01 = vzip2q_u64(cq0_w8, cq1_w8);
     900                 :            :                         mbuf23 = vzip2q_u64(cq2_w8, cq3_w8);
     901                 :            :                         mbuf01 = vqsubq_u64(mbuf01, data_off);
     902                 :            :                         mbuf23 = vqsubq_u64(mbuf23, data_off);
     903                 :            :                 } else {
     904                 :            :                         mbuf01 = vsubq_u64(vld1q_u64((uint64_t *)cq0),
     905                 :            :                                            vdupq_n_u64(sizeof(struct rte_mbuf)));
     906                 :            :                         mbuf23 = vsubq_u64(vld1q_u64((uint64_t *)(cq0 + 16)),
     907                 :            :                                            vdupq_n_u64(sizeof(struct rte_mbuf)));
     908                 :            :                 }
     909                 :            : 
     910                 :            :                 /* Move mbufs to scalar registers for future use */
     911                 :            :                 mbuf0 = (struct rte_mbuf *)vgetq_lane_u64(mbuf01, 0);
     912                 :            :                 mbuf1 = (struct rte_mbuf *)vgetq_lane_u64(mbuf01, 1);
     913                 :            :                 mbuf2 = (struct rte_mbuf *)vgetq_lane_u64(mbuf23, 0);
     914                 :            :                 mbuf3 = (struct rte_mbuf *)vgetq_lane_u64(mbuf23, 1);
     915                 :            : 
     916                 :            :                 /* Mark mempool obj as "get" as it is alloc'ed by NIX */
     917                 :            :                 RTE_MEMPOOL_CHECK_COOKIES(mbuf0->pool, (void **)&mbuf0, 1, 1);
     918                 :            :                 RTE_MEMPOOL_CHECK_COOKIES(mbuf1->pool, (void **)&mbuf1, 1, 1);
     919                 :            :                 RTE_MEMPOOL_CHECK_COOKIES(mbuf2->pool, (void **)&mbuf2, 1, 1);
     920                 :            :                 RTE_MEMPOOL_CHECK_COOKIES(mbuf3->pool, (void **)&mbuf3, 1, 1);
     921                 :            : 
     922                 :            :                 if (!(flags & NIX_RX_VWQE_F)) {
     923                 :            :                         /* Mask to get packet len from NIX_RX_SG_S */
     924                 :            :                         const uint8x16_t shuf_msk = {
     925                 :            :                                 0xFF, 0xFF, /* pkt_type set as unknown */
     926                 :            :                                 0xFF, 0xFF, /* pkt_type set as unknown */
     927                 :            :                                 0,    1,    /* octet 1~0, low 16 bits pkt_len */
     928                 :            :                                 0xFF, 0xFF, /* skip high 16it pkt_len, zero out */
     929                 :            :                                 0,    1,    /* octet 1~0, 16 bits data_len */
     930                 :            :                                 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
     931                 :            : 
     932                 :            :                         /* Form the rx_descriptor_fields1 with pkt_len and data_len */
     933                 :            :                         f0 = vqtbl1q_u8(cq0_w8, shuf_msk);
     934                 :            :                         f1 = vqtbl1q_u8(cq1_w8, shuf_msk);
     935                 :            :                         f2 = vqtbl1q_u8(cq2_w8, shuf_msk);
     936                 :            :                         f3 = vqtbl1q_u8(cq3_w8, shuf_msk);
     937                 :            :                 }
     938                 :            : 
     939                 :            :                 /* Load CQE word0 and word 1 */
     940                 :            :                 const uint64_t cq0_w0 = *CQE_PTR_OFF(cq0, 0, 0, flags);
     941                 :            :                 const uint64_t cq0_w1 = *CQE_PTR_OFF(cq0, 0, 8, flags);
     942                 :            :                 const uint64_t cq0_w2 = *CQE_PTR_OFF(cq0, 0, 16, flags);
     943                 :            :                 const uint64_t cq1_w0 = *CQE_PTR_OFF(cq0, 1, 0, flags);
     944                 :            :                 const uint64_t cq1_w1 = *CQE_PTR_OFF(cq0, 1, 8, flags);
     945                 :            :                 const uint64_t cq1_w2 = *CQE_PTR_OFF(cq0, 1, 16, flags);
     946                 :            :                 const uint64_t cq2_w0 = *CQE_PTR_OFF(cq0, 2, 0, flags);
     947                 :            :                 const uint64_t cq2_w1 = *CQE_PTR_OFF(cq0, 2, 8, flags);
     948                 :            :                 const uint64_t cq2_w2 = *CQE_PTR_OFF(cq0, 2, 16, flags);
     949                 :            :                 const uint64_t cq3_w0 = *CQE_PTR_OFF(cq0, 3, 0, flags);
     950                 :            :                 const uint64_t cq3_w1 = *CQE_PTR_OFF(cq0, 3, 8, flags);
     951                 :            :                 const uint64_t cq3_w2 = *CQE_PTR_OFF(cq0, 3, 16, flags);
     952                 :            : 
     953                 :            :                 if (flags & NIX_RX_VWQE_F) {
     954                 :            :                         uint16_t psize0, psize1, psize2, psize3;
     955                 :            : 
     956                 :            :                         psize0 = (cq0_w2 & 0xFFFF) + 1;
     957                 :            :                         psize1 = (cq1_w2 & 0xFFFF) + 1;
     958                 :            :                         psize2 = (cq2_w2 & 0xFFFF) + 1;
     959                 :            :                         psize3 = (cq3_w2 & 0xFFFF) + 1;
     960                 :            : 
     961                 :            :                         f0 = vdupq_n_u64(0);
     962                 :            :                         f1 = vdupq_n_u64(0);
     963                 :            :                         f2 = vdupq_n_u64(0);
     964                 :            :                         f3 = vdupq_n_u64(0);
     965                 :            : 
     966                 :            :                         f0 = vsetq_lane_u16(psize0, f0, 2);
     967                 :            :                         f0 = vsetq_lane_u16(psize0, f0, 4);
     968                 :            : 
     969                 :            :                         f1 = vsetq_lane_u16(psize1, f1, 2);
     970                 :            :                         f1 = vsetq_lane_u16(psize1, f1, 4);
     971                 :            : 
     972                 :            :                         f2 = vsetq_lane_u16(psize2, f2, 2);
     973                 :            :                         f2 = vsetq_lane_u16(psize2, f2, 4);
     974                 :            : 
     975                 :            :                         f3 = vsetq_lane_u16(psize3, f3, 2);
     976                 :            :                         f3 = vsetq_lane_u16(psize3, f3, 4);
     977                 :            :                 }
     978                 :            : 
     979                 :            :                 if (flags & NIX_RX_OFFLOAD_RSS_F) {
     980                 :            :                         /* Fill rss in the rx_descriptor_fields1 */
     981                 :            :                         f0 = vsetq_lane_u32(cq0_w0, f0, 3);
     982                 :            :                         f1 = vsetq_lane_u32(cq1_w0, f1, 3);
     983                 :            :                         f2 = vsetq_lane_u32(cq2_w0, f2, 3);
     984                 :            :                         f3 = vsetq_lane_u32(cq3_w0, f3, 3);
     985                 :            :                         ol_flags0 = RTE_MBUF_F_RX_RSS_HASH;
     986                 :            :                         ol_flags1 = RTE_MBUF_F_RX_RSS_HASH;
     987                 :            :                         ol_flags2 = RTE_MBUF_F_RX_RSS_HASH;
     988                 :            :                         ol_flags3 = RTE_MBUF_F_RX_RSS_HASH;
     989                 :            :                 } else {
     990                 :            :                         ol_flags0 = 0;
     991                 :            :                         ol_flags1 = 0;
     992                 :            :                         ol_flags2 = 0;
     993                 :            :                         ol_flags3 = 0;
     994                 :            :                 }
     995                 :            : 
     996                 :            :                 if (flags & NIX_RX_OFFLOAD_PTYPE_F) {
     997                 :            :                         /* Fill packet_type in the rx_descriptor_fields1 */
     998                 :            :                         f0 = vsetq_lane_u32(nix_ptype_get(lookup_mem, cq0_w1), f0, 0);
     999                 :            :                         f1 = vsetq_lane_u32(nix_ptype_get(lookup_mem, cq1_w1), f1, 0);
    1000                 :            :                         f2 = vsetq_lane_u32(nix_ptype_get(lookup_mem, cq2_w1), f2, 0);
    1001                 :            :                         f3 = vsetq_lane_u32(nix_ptype_get(lookup_mem, cq3_w1), f3, 0);
    1002                 :            :                 }
    1003                 :            : 
    1004                 :            :                 if (flags & NIX_RX_OFFLOAD_CHECKSUM_F) {
    1005                 :            :                         ol_flags0 |= (uint64_t)nix_rx_olflags_get(lookup_mem, cq0_w1);
    1006                 :            :                         ol_flags1 |= (uint64_t)nix_rx_olflags_get(lookup_mem, cq1_w1);
    1007                 :            :                         ol_flags2 |= (uint64_t)nix_rx_olflags_get(lookup_mem, cq2_w1);
    1008                 :            :                         ol_flags3 |= (uint64_t)nix_rx_olflags_get(lookup_mem, cq3_w1);
    1009                 :            :                 }
    1010                 :            : 
    1011                 :            :                 /* Translate meta to mbuf */
    1012                 :            :                 if (flags & NIX_RX_OFFLOAD_SECURITY_F) {
    1013                 :            :                         uint64_t cq0_w5 = *CQE_PTR_OFF(cq0, 0, 40, flags);
    1014                 :            :                         uint64_t cq1_w5 = *CQE_PTR_OFF(cq0, 1, 40, flags);
    1015                 :            :                         uint64_t cq2_w5 = *CQE_PTR_OFF(cq0, 2, 40, flags);
    1016                 :            :                         uint64_t cq3_w5 = *CQE_PTR_OFF(cq0, 3, 40, flags);
    1017                 :            :                         uint8_t code;
    1018                 :            : 
    1019                 :            :                         uint64x2_t inner0, inner1, inner2, inner3;
    1020                 :            :                         uint64x2_t wqe01, wqe23, sa01, sa23;
    1021                 :            :                         uint64x2_t mask01, mask23;
    1022                 :            :                         uint16x4_t lens, l2lens;
    1023                 :            :                         uint8x8_t ucc;
    1024                 :            : 
    1025                 :            :                         cpth0 = (uintptr_t)mbuf0 + d_off;
    1026                 :            :                         cpth1 = (uintptr_t)mbuf1 + d_off;
    1027                 :            :                         cpth2 = (uintptr_t)mbuf2 + d_off;
    1028                 :            :                         cpth3 = (uintptr_t)mbuf3 + d_off;
    1029                 :            : 
    1030                 :            :                         inner0 = vld1q_u64((const uint64_t *)cpth0);
    1031                 :            :                         inner1 = vld1q_u64((const uint64_t *)cpth1);
    1032                 :            :                         inner2 = vld1q_u64((const uint64_t *)cpth2);
    1033                 :            :                         inner3 = vld1q_u64((const uint64_t *)cpth3);
    1034                 :            : 
    1035                 :            :                         /* Extract and reverse wqe pointers */
    1036                 :            :                         wqe01 = vzip2q_u64(inner0, inner1);
    1037                 :            :                         wqe23 = vzip2q_u64(inner2, inner3);
    1038                 :            : 
    1039                 :            :                         /* Adjust wqe pointers to point to mbuf */
    1040                 :            :                         wqe01 = vsubq_u64(wqe01, vdupq_n_u64(sizeof(struct rte_mbuf)));
    1041                 :            :                         wqe23 = vsubq_u64(wqe23, vdupq_n_u64(sizeof(struct rte_mbuf)));
    1042                 :            : 
    1043                 :            :                         /* Extract sa idx from cookie area and add to sa_base */
    1044                 :            :                         sa01 = vzip1q_u64(inner0, inner1);
    1045                 :            :                         sa23 = vzip1q_u64(inner2, inner3);
    1046                 :            : 
    1047                 :            :                         sa01 = vandq_u64(sa01, vdupq_n_u64(0xFFFFFFFF));
    1048                 :            :                         sa23 = vandq_u64(sa23, vdupq_n_u64(0xFFFFFFFF));
    1049                 :            : 
    1050                 :            :                         if (flags & NIX_RX_REAS_F) {
    1051                 :            :                                 /* Crypto Look-aside Rx Inject case */
    1052                 :            :                                 mask01 = vceqq_u64(sa01, vdupq_n_u64(0xFFFFFFFF));
    1053                 :            :                                 mask23 = vceqq_u64(sa23, vdupq_n_u64(0xFFFFFFFF));
    1054                 :            :                         }
    1055                 :            : 
    1056                 :            :                         sa01 = vshlq_n_u64(sa01, ROC_NIX_INL_OT_IPSEC_INB_SA_SZ_LOG2);
    1057                 :            :                         sa23 = vshlq_n_u64(sa23, ROC_NIX_INL_OT_IPSEC_INB_SA_SZ_LOG2);
    1058                 :            :                         sa01 = vaddq_u64(sa01, vdupq_n_u64(sa_base));
    1059                 :            :                         sa23 = vaddq_u64(sa23, vdupq_n_u64(sa_base));
    1060                 :            : 
    1061                 :            :                         if (flags & NIX_RX_REAS_F) {
    1062                 :            :                                 sa01 = vbicq_u64(sa01, mask01);
    1063                 :            :                                 sa23 = vbicq_u64(sa23, mask23);
    1064                 :            :                         }
    1065                 :            : 
    1066                 :            :                         const uint8x16x2_t tbl = {{
    1067                 :            :                                 {
    1068                 :            :                                         /* ROC_IE_OT_UCC_SUCCESS_PKT_IP_BADCSUM */
    1069                 :            :                                         RTE_MBUF_F_RX_IP_CKSUM_BAD >> 1,
    1070                 :            :                                         /* ROC_IE_OT_UCC_SUCCESS_PKT_L4_GOODCSUM */
    1071                 :            :                                         (RTE_MBUF_F_RX_IP_CKSUM_GOOD |
    1072                 :            :                                          RTE_MBUF_F_RX_L4_CKSUM_GOOD) >>
    1073                 :            :                                                 1,
    1074                 :            :                                         /* ROC_IE_OT_UCC_SUCCESS_PKT_L4_BADCSUM */
    1075                 :            :                                         (RTE_MBUF_F_RX_IP_CKSUM_GOOD |
    1076                 :            :                                          RTE_MBUF_F_RX_L4_CKSUM_BAD) >>
    1077                 :            :                                                 1,
    1078                 :            :                                         1,
    1079                 :            :                                         /* ROC_IE_OT_UCC_SUCCESS_PKT_UDPESP_NZCSUM */
    1080                 :            :                                         (RTE_MBUF_F_RX_IP_CKSUM_GOOD |
    1081                 :            :                                          RTE_MBUF_F_RX_L4_CKSUM_GOOD) >>
    1082                 :            :                                                 1,
    1083                 :            :                                         1,
    1084                 :            :                                         /* ROC_IE_OT_UCC_SUCCESS_PKT_UDP_ZEROCSUM */
    1085                 :            :                                         (RTE_MBUF_F_RX_IP_CKSUM_GOOD |
    1086                 :            :                                          RTE_MBUF_F_RX_L4_CKSUM_GOOD) >>
    1087                 :            :                                                 1,
    1088                 :            :                                         3,
    1089                 :            :                                         1,
    1090                 :            :                                         3,
    1091                 :            :                                         3,
    1092                 :            :                                         3,
    1093                 :            :                                         3,
    1094                 :            :                                         1,
    1095                 :            :                                         3,
    1096                 :            :                                         1,
    1097                 :            :                                 },
    1098                 :            :                                 {
    1099                 :            :                                         1,
    1100                 :            :                                         1,
    1101                 :            :                                         1,
    1102                 :            :                                         /* ROC_IE_OT_UCC_SUCCESS_PKT_IP_GOODCSUM */
    1103                 :            :                                         RTE_MBUF_F_RX_IP_CKSUM_GOOD >> 1,
    1104                 :            :                                         /* Rest 0 to indicate RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED */
    1105                 :            :                                         0,
    1106                 :            :                                         0,
    1107                 :            :                                         0,
    1108                 :            :                                         0,
    1109                 :            :                                         0,
    1110                 :            :                                         0,
    1111                 :            :                                         0,
    1112                 :            :                                         0,
    1113                 :            :                                         0,
    1114                 :            :                                         0,
    1115                 :            :                                         0,
    1116                 :            :                                         0,
    1117                 :            :                                 },
    1118                 :            :                         }};
    1119                 :            : 
    1120                 :            :                         const uint8x8_t err_off = {
    1121                 :            :                                 /* HW_CCODE 0:6 -> 7:D */
    1122                 :            :                                 -7,
    1123                 :            :                                 /* UCC */
    1124                 :            :                                 0xED,
    1125                 :            :                                 -7,
    1126                 :            :                                 0xED,
    1127                 :            :                                 -7,
    1128                 :            :                                 0xED,
    1129                 :            :                                 -7,
    1130                 :            :                                 0xED,
    1131                 :            :                         };
    1132                 :            : 
    1133                 :            :                         ucc = vdup_n_u8(0);
    1134                 :            :                         ucc = vset_lane_u16(*(uint16_t *)(cpth0 + 24), ucc, 0);
    1135                 :            :                         ucc = vset_lane_u16(*(uint16_t *)(cpth1 + 24), ucc, 1);
    1136                 :            :                         ucc = vset_lane_u16(*(uint16_t *)(cpth2 + 24), ucc, 2);
    1137                 :            :                         ucc = vset_lane_u16(*(uint16_t *)(cpth3 + 24), ucc, 3);
    1138                 :            :                         ucc = vsub_u8(ucc, err_off);
    1139                 :            : 
    1140                 :            :                         /* Table lookup to get the corresponding flags, Out of the range
    1141                 :            :                          * from this lookup will have value 0 and consider as
    1142                 :            :                          * RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED.
    1143                 :            :                          */
    1144                 :            :                         ucc = vqtbl2_u8(tbl, ucc);
    1145                 :            : 
    1146                 :            :                         /* Extract l3 lengths from hdr */
    1147                 :            :                         lens = vdup_n_u16(0);
    1148                 :            :                         lens = vset_lane_u16(*(uint16_t *)(cpth0 + 30), lens, 0);
    1149                 :            :                         lens = vset_lane_u16(*(uint16_t *)(cpth1 + 30), lens, 1);
    1150                 :            :                         lens = vset_lane_u16(*(uint16_t *)(cpth2 + 30), lens, 2);
    1151                 :            :                         lens = vset_lane_u16(*(uint16_t *)(cpth3 + 30), lens, 3);
    1152                 :            : 
    1153                 :            :                         /* Add l2 length to l3 lengths */
    1154                 :            :                         l2lens = vdup_n_u16(0);
    1155                 :            :                         l2lens =
    1156                 :            :                                 vset_lane_u16(((cq0_w5 >> 16) & 0xFF) - (cq0_w5 & 0xFF), l2lens, 0);
    1157                 :            :                         l2lens =
    1158                 :            :                                 vset_lane_u16(((cq1_w5 >> 16) & 0xFF) - (cq1_w5 & 0xFF), l2lens, 1);
    1159                 :            :                         l2lens =
    1160                 :            :                                 vset_lane_u16(((cq2_w5 >> 16) & 0xFF) - (cq2_w5 & 0xFF), l2lens, 2);
    1161                 :            :                         l2lens =
    1162                 :            :                                 vset_lane_u16(((cq3_w5 >> 16) & 0xFF) - (cq3_w5 & 0xFF), l2lens, 3);
    1163                 :            :                         lens = vadd_u16(lens, l2lens);
    1164                 :            : 
    1165                 :            :                         /* Initialize rearm data when reassembly is enabled as
    1166                 :            :                          * data offset might change.
    1167                 :            :                          */
    1168                 :            :                         if (flags & NIX_RX_REAS_F) {
    1169                 :            :                                 rearm0 = vdupq_n_u64(mbuf_initializer);
    1170                 :            :                                 rearm1 = vdupq_n_u64(mbuf_initializer);
    1171                 :            :                                 rearm2 = vdupq_n_u64(mbuf_initializer);
    1172                 :            :                                 rearm3 = vdupq_n_u64(mbuf_initializer);
    1173                 :            :                         }
    1174                 :            : 
    1175                 :            :                         /* Checksum ol_flags will be cleared if mbuf is meta */
    1176                 :            :                         if (cq0_w1 & BIT(11)) {
    1177                 :            :                                 uintptr_t wqe = vgetq_lane_u64(wqe01, 0);
    1178                 :            :                                 uintptr_t sa = vgetq_lane_u64(sa01, 0);
    1179                 :            :                                 uint16_t len = vget_lane_u16(lens, 0);
    1180                 :            : 
    1181                 :            :                                 cpth0 = (uintptr_t)mbuf0 + d_off;
    1182                 :            : 
    1183                 :            :                                 /* Free meta to aura */
    1184                 :            :                                 NIX_PUSH_META_TO_FREE(mbuf0, laddr, &loff);
    1185                 :            :                                 mbuf0 = (struct rte_mbuf *)wqe;
    1186                 :            : 
    1187                 :            :                                 /* Update pkt_len and data_len */
    1188                 :            :                                 f0 = vsetq_lane_u16(len, f0, 2);
    1189                 :            :                                 f0 = vsetq_lane_u16(len, f0, 4);
    1190                 :            : 
    1191                 :            :                                 nix_sec_meta_to_mbuf(sa, cpth0, &mbuf0, &ol_flags0, flags, &rearm0);
    1192                 :            :                                 mbuf01 = vsetq_lane_u64((uintptr_t)mbuf0, mbuf01, 0);
    1193                 :            :                                 code = vget_lane_u8(ucc, 1);
    1194                 :            :                                 ol_flags0 |= code ? (code > 1 ? ((uint64_t)code) << 1 : 0) :
    1195                 :            :                                                     RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED;
    1196                 :            : 
    1197                 :            :                                 ol_flags0 |= ((uint64_t)(vget_lane_u8(ucc, 0)) << 18);
    1198                 :            :                         }
    1199                 :            : 
    1200                 :            :                         if (cq1_w1 & BIT(11)) {
    1201                 :            :                                 uintptr_t wqe = vgetq_lane_u64(wqe01, 1);
    1202                 :            :                                 uintptr_t sa = vgetq_lane_u64(sa01, 1);
    1203                 :            :                                 uint16_t len = vget_lane_u16(lens, 1);
    1204                 :            : 
    1205                 :            :                                 cpth1 = (uintptr_t)mbuf1 + d_off;
    1206                 :            : 
    1207                 :            :                                 /* Free meta to aura */
    1208                 :            :                                 NIX_PUSH_META_TO_FREE(mbuf1, laddr, &loff);
    1209                 :            :                                 mbuf1 = (struct rte_mbuf *)wqe;
    1210                 :            : 
    1211                 :            :                                 /* Update pkt_len and data_len */
    1212                 :            :                                 f1 = vsetq_lane_u16(len, f1, 2);
    1213                 :            :                                 f1 = vsetq_lane_u16(len, f1, 4);
    1214                 :            : 
    1215                 :            :                                 nix_sec_meta_to_mbuf(sa, cpth1, &mbuf1, &ol_flags1, flags, &rearm1);
    1216                 :            :                                 mbuf01 = vsetq_lane_u64((uintptr_t)mbuf1, mbuf01, 1);
    1217                 :            :                                 code = vget_lane_u8(ucc, 3);
    1218                 :            :                                 ol_flags1 |= code ? (code > 1 ? ((uint64_t)code) << 1 : 0) :
    1219                 :            :                                                     RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED;
    1220                 :            :                                 ol_flags1 |= ((uint64_t)(vget_lane_u8(ucc, 2)) << 18);
    1221                 :            :                         }
    1222                 :            : 
    1223                 :            :                         if (cq2_w1 & BIT(11)) {
    1224                 :            :                                 uintptr_t wqe = vgetq_lane_u64(wqe23, 0);
    1225                 :            :                                 uintptr_t sa = vgetq_lane_u64(sa23, 0);
    1226                 :            :                                 uint16_t len = vget_lane_u16(lens, 2);
    1227                 :            : 
    1228                 :            :                                 cpth2 = (uintptr_t)mbuf2 + d_off;
    1229                 :            : 
    1230                 :            :                                 /* Free meta to aura */
    1231                 :            :                                 NIX_PUSH_META_TO_FREE(mbuf2, laddr, &loff);
    1232                 :            :                                 mbuf2 = (struct rte_mbuf *)wqe;
    1233                 :            : 
    1234                 :            :                                 /* Update pkt_len and data_len */
    1235                 :            :                                 f2 = vsetq_lane_u16(len, f2, 2);
    1236                 :            :                                 f2 = vsetq_lane_u16(len, f2, 4);
    1237                 :            : 
    1238                 :            :                                 nix_sec_meta_to_mbuf(sa, cpth2, &mbuf2, &ol_flags2, flags, &rearm2);
    1239                 :            :                                 mbuf23 = vsetq_lane_u64((uintptr_t)mbuf2, mbuf23, 0);
    1240                 :            :                                 code = vget_lane_u8(ucc, 5);
    1241                 :            :                                 ol_flags2 |= code ? (code > 1 ? ((uint64_t)code) << 1 : 0) :
    1242                 :            :                                                     RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED;
    1243                 :            :                                 ol_flags2 |= ((uint64_t)(vget_lane_u8(ucc, 4)) << 18);
    1244                 :            :                         }
    1245                 :            : 
    1246                 :            :                         if (cq3_w1 & BIT(11)) {
    1247                 :            :                                 uintptr_t wqe = vgetq_lane_u64(wqe23, 1);
    1248                 :            :                                 uintptr_t sa = vgetq_lane_u64(sa23, 1);
    1249                 :            :                                 uint16_t len = vget_lane_u16(lens, 3);
    1250                 :            : 
    1251                 :            :                                 cpth3 = (uintptr_t)mbuf3 + d_off;
    1252                 :            : 
    1253                 :            :                                 /* Free meta to aura */
    1254                 :            :                                 NIX_PUSH_META_TO_FREE(mbuf3, laddr, &loff);
    1255                 :            :                                 mbuf3 = (struct rte_mbuf *)wqe;
    1256                 :            : 
    1257                 :            :                                 /* Update pkt_len and data_len */
    1258                 :            :                                 f3 = vsetq_lane_u16(len, f3, 2);
    1259                 :            :                                 f3 = vsetq_lane_u16(len, f3, 4);
    1260                 :            : 
    1261                 :            :                                 nix_sec_meta_to_mbuf(sa, cpth3, &mbuf3, &ol_flags3, flags, &rearm3);
    1262                 :            :                                 mbuf23 = vsetq_lane_u64((uintptr_t)mbuf3, mbuf23, 1);
    1263                 :            :                                 code = vget_lane_u8(ucc, 7);
    1264                 :            :                                 ol_flags3 |= code ? (code > 1 ? ((uint64_t)code) << 1 : 0) :
    1265                 :            :                                                     RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED;
    1266                 :            :                                 ol_flags3 |= ((uint64_t)(vget_lane_u8(ucc, 6)) << 18);
    1267                 :            :                         }
    1268                 :            :                 }
    1269                 :            : 
    1270                 :            :                 if (flags & NIX_RX_OFFLOAD_VLAN_STRIP_F) {
    1271                 :            :                         ol_flags0 = nix_vlan_update(cq0_w2, ol_flags0, &f0);
    1272                 :            :                         ol_flags1 = nix_vlan_update(cq1_w2, ol_flags1, &f1);
    1273                 :            :                         ol_flags2 = nix_vlan_update(cq2_w2, ol_flags2, &f2);
    1274                 :            :                         ol_flags3 = nix_vlan_update(cq3_w2, ol_flags3, &f3);
    1275                 :            : 
    1276                 :            :                         ol_flags0 = nix_qinq_update(cq0_w2, ol_flags0, mbuf0);
    1277                 :            :                         ol_flags1 = nix_qinq_update(cq1_w2, ol_flags1, mbuf1);
    1278                 :            :                         ol_flags2 = nix_qinq_update(cq2_w2, ol_flags2, mbuf2);
    1279                 :            :                         ol_flags3 = nix_qinq_update(cq3_w2, ol_flags3, mbuf3);
    1280                 :            :                 }
    1281                 :            : 
    1282                 :            :                 if (flags & NIX_RX_OFFLOAD_MARK_UPDATE_F) {
    1283                 :            :                         ol_flags0 = nix_update_match_id(*(uint16_t *)CQE_PTR_OFF(cq0, 0, 38, flags),
    1284                 :            :                                                         ol_flags0, mbuf0);
    1285                 :            :                         ol_flags1 = nix_update_match_id(*(uint16_t *)CQE_PTR_OFF(cq0, 1, 38, flags),
    1286                 :            :                                                         ol_flags1, mbuf1);
    1287                 :            :                         ol_flags2 = nix_update_match_id(*(uint16_t *)CQE_PTR_OFF(cq0, 2, 38, flags),
    1288                 :            :                                                         ol_flags2, mbuf2);
    1289                 :            :                         ol_flags3 = nix_update_match_id(*(uint16_t *)CQE_PTR_OFF(cq0, 3, 38, flags),
    1290                 :            :                                                         ol_flags3, mbuf3);
    1291                 :            :                 }
    1292                 :            : 
    1293                 :            :                 if ((flags & NIX_RX_OFFLOAD_TSTAMP_F) && ((flags & NIX_RX_VWQE_F) && tstamp)) {
    1294                 :            :                         const uint16x8_t len_off = {0,                           /* ptype   0:15 */
    1295                 :            :                                                     0,                           /* ptype  16:32 */
    1296                 :            :                                                     CNXK_NIX_TIMESYNC_RX_OFFSET, /* pktlen  0:15*/
    1297                 :            :                                                     0,                           /* pktlen 16:32 */
    1298                 :            :                                                     CNXK_NIX_TIMESYNC_RX_OFFSET, /* datalen 0:15 */
    1299                 :            :                                                     0,
    1300                 :            :                                                     0,
    1301                 :            :                                                     0};
    1302                 :            :                         const uint32x4_t ptype = {
    1303                 :            :                                 RTE_PTYPE_L2_ETHER_TIMESYNC, RTE_PTYPE_L2_ETHER_TIMESYNC,
    1304                 :            :                                 RTE_PTYPE_L2_ETHER_TIMESYNC, RTE_PTYPE_L2_ETHER_TIMESYNC};
    1305                 :            :                         const uint64_t ts_olf = RTE_MBUF_F_RX_IEEE1588_PTP |
    1306                 :            :                                                 RTE_MBUF_F_RX_IEEE1588_TMST |
    1307                 :            :                                                 tstamp->rx_tstamp_dynflag;
    1308                 :            :                         const uint32x4_t and_mask = {0x1, 0x2, 0x4, 0x8};
    1309                 :            :                         uint64x2_t ts01, ts23, mask;
    1310                 :            :                         uint64_t ts[4];
    1311                 :            :                         uint8_t res;
    1312                 :            : 
    1313                 :            :                         /* Subtract timesync length from total pkt length. */
    1314                 :            :                         f0 = vsubq_u16(f0, len_off);
    1315                 :            :                         f1 = vsubq_u16(f1, len_off);
    1316                 :            :                         f2 = vsubq_u16(f2, len_off);
    1317                 :            :                         f3 = vsubq_u16(f3, len_off);
    1318                 :            : 
    1319                 :            :                         /* Get the address of actual timestamp. */
    1320                 :            :                         ts01 = vaddq_u64(mbuf01, data_off);
    1321                 :            :                         ts23 = vaddq_u64(mbuf23, data_off);
    1322                 :            :                         /* Load timestamp from address. */
    1323                 :            :                         ts01 = vsetq_lane_u64(*(uint64_t *)vgetq_lane_u64(ts01, 0), ts01, 0);
    1324                 :            :                         ts01 = vsetq_lane_u64(*(uint64_t *)vgetq_lane_u64(ts01, 1), ts01, 1);
    1325                 :            :                         ts23 = vsetq_lane_u64(*(uint64_t *)vgetq_lane_u64(ts23, 0), ts23, 0);
    1326                 :            :                         ts23 = vsetq_lane_u64(*(uint64_t *)vgetq_lane_u64(ts23, 1), ts23, 1);
    1327                 :            :                         /* Convert from be to cpu byteorder. */
    1328                 :            :                         ts01 = vrev64q_u8(ts01);
    1329                 :            :                         ts23 = vrev64q_u8(ts23);
    1330                 :            :                         /* Store timestamp into scalar for later use. */
    1331                 :            :                         ts[0] = vgetq_lane_u64(ts01, 0);
    1332                 :            :                         ts[1] = vgetq_lane_u64(ts01, 1);
    1333                 :            :                         ts[2] = vgetq_lane_u64(ts23, 0);
    1334                 :            :                         ts[3] = vgetq_lane_u64(ts23, 1);
    1335                 :            : 
    1336                 :            :                         /* Store timestamp into dynfield. */
    1337                 :            :                         *cnxk_nix_timestamp_dynfield(mbuf0, tstamp) = ts[0];
    1338                 :            :                         *cnxk_nix_timestamp_dynfield(mbuf1, tstamp) = ts[1];
    1339                 :            :                         *cnxk_nix_timestamp_dynfield(mbuf2, tstamp) = ts[2];
    1340                 :            :                         *cnxk_nix_timestamp_dynfield(mbuf3, tstamp) = ts[3];
    1341                 :            : 
    1342                 :            :                         /* Generate ptype mask to filter L2 ether timesync */
    1343                 :            :                         mask = vdupq_n_u32(vgetq_lane_u32(f0, 0));
    1344                 :            :                         mask = vsetq_lane_u32(vgetq_lane_u32(f1, 0), mask, 1);
    1345                 :            :                         mask = vsetq_lane_u32(vgetq_lane_u32(f2, 0), mask, 2);
    1346                 :            :                         mask = vsetq_lane_u32(vgetq_lane_u32(f3, 0), mask, 3);
    1347                 :            : 
    1348                 :            :                         /* Match against L2 ether timesync. */
    1349                 :            :                         mask = vceqq_u32(mask, ptype);
    1350                 :            :                         /* Convert from vector from scalar mask */
    1351                 :            :                         res = vaddvq_u32(vandq_u32(mask, and_mask));
    1352                 :            :                         res &= 0xF;
    1353                 :            : 
    1354                 :            :                         if (res) {
    1355                 :            :                                 /* Fill in the ol_flags for any packets that
    1356                 :            :                                  * matched.
    1357                 :            :                                  */
    1358                 :            :                                 ol_flags0 |= ((res & 0x1) ? ts_olf : 0);
    1359                 :            :                                 ol_flags1 |= ((res & 0x2) ? ts_olf : 0);
    1360                 :            :                                 ol_flags2 |= ((res & 0x4) ? ts_olf : 0);
    1361                 :            :                                 ol_flags3 |= ((res & 0x8) ? ts_olf : 0);
    1362                 :            : 
    1363                 :            :                                 /* Update Rxq timestamp with the latest
    1364                 :            :                                  * timestamp.
    1365                 :            :                                  */
    1366                 :            :                                 tstamp->rx_ready = 1;
    1367                 :            :                                 tstamp->rx_tstamp = ts[31 - rte_clz32(res)];
    1368                 :            :                         }
    1369                 :            :                 }
    1370                 :            : 
    1371                 :            :                 /* Form rearm_data with ol_flags */
    1372                 :            :                 rearm0 = vsetq_lane_u64(ol_flags0, rearm0, 1);
    1373                 :            :                 rearm1 = vsetq_lane_u64(ol_flags1, rearm1, 1);
    1374                 :            :                 rearm2 = vsetq_lane_u64(ol_flags2, rearm2, 1);
    1375                 :            :                 rearm3 = vsetq_lane_u64(ol_flags3, rearm3, 1);
    1376                 :            : 
    1377                 :            :                 /* Update rx_descriptor_fields1 */
    1378                 :            :                 vst1q_u64((uint64_t *)mbuf0->rx_descriptor_fields1, f0);
    1379                 :            :                 vst1q_u64((uint64_t *)mbuf1->rx_descriptor_fields1, f1);
    1380                 :            :                 vst1q_u64((uint64_t *)mbuf2->rx_descriptor_fields1, f2);
    1381                 :            :                 vst1q_u64((uint64_t *)mbuf3->rx_descriptor_fields1, f3);
    1382                 :            : 
    1383                 :            :                 /* Update rearm_data */
    1384                 :            :                 vst1q_u64((uint64_t *)mbuf0->rearm_data, rearm0);
    1385                 :            :                 vst1q_u64((uint64_t *)mbuf1->rearm_data, rearm1);
    1386                 :            :                 vst1q_u64((uint64_t *)mbuf2->rearm_data, rearm2);
    1387                 :            :                 vst1q_u64((uint64_t *)mbuf3->rearm_data, rearm3);
    1388                 :            : 
    1389                 :            :                 if (flags & NIX_RX_MULTI_SEG_F || (flags & NIX_RX_REAS_F)) {
    1390                 :            :                         /* Multi segment is enable build mseg list for
    1391                 :            :                          * individual mbufs in scalar mode.
    1392                 :            :                          */
    1393                 :            :                         nix_cqe_xtract_mseg((union nix_rx_parse_u *)(CQE_PTR_OFF(cq0, 0, 8, flags)),
    1394                 :            :                                             mbuf0, mbuf_initializer, cpth0, sa_base, buf_sz, flags);
    1395                 :            :                         nix_cqe_xtract_mseg((union nix_rx_parse_u *)(CQE_PTR_OFF(cq0, 1, 8, flags)),
    1396                 :            :                                             mbuf1, mbuf_initializer, cpth1, sa_base, buf_sz, flags);
    1397                 :            :                         nix_cqe_xtract_mseg((union nix_rx_parse_u *)(CQE_PTR_OFF(cq0, 2, 8, flags)),
    1398                 :            :                                             mbuf2, mbuf_initializer, cpth2, sa_base, buf_sz, flags);
    1399                 :            :                         nix_cqe_xtract_mseg((union nix_rx_parse_u *)(CQE_PTR_OFF(cq0, 3, 8, flags)),
    1400                 :            :                                             mbuf3, mbuf_initializer, cpth3, sa_base, buf_sz, flags);
    1401                 :            :                 }
    1402                 :            : 
    1403                 :            :                 /* Store the mbufs to rx_pkts */
    1404                 :            :                 vst1q_u64((uint64_t *)&mbufs[packets], mbuf01);
    1405                 :            :                 vst1q_u64((uint64_t *)&mbufs[packets + 2], mbuf23);
    1406                 :            : 
    1407                 :            :                 nix_mbuf_validate_next(mbuf0);
    1408                 :            :                 nix_mbuf_validate_next(mbuf1);
    1409                 :            :                 nix_mbuf_validate_next(mbuf2);
    1410                 :            :                 nix_mbuf_validate_next(mbuf3);
    1411                 :            : 
    1412                 :            :                 packets += NIX_DESCS_PER_LOOP;
    1413                 :            : 
    1414                 :            :                 if (!(flags & NIX_RX_VWQE_F)) {
    1415                 :            :                         /* Advance head pointer and packets */
    1416                 :            :                         head += NIX_DESCS_PER_LOOP;
    1417                 :            :                         head &= qmask;
    1418                 :            :                 }
    1419                 :            : 
    1420                 :            :                 if (flags & NIX_RX_OFFLOAD_SECURITY_F) {
    1421                 :            :                         /* Check if lmtline border is crossed and adjust lnum */
    1422                 :            :                         if (loff > 15) {
    1423                 :            :                                 /* Update aura handle */
    1424                 :            :                                 *(uint64_t *)(laddr - 8) = (((uint64_t)(15 & 0x1) << 32) |
    1425                 :            :                                                             roc_npa_aura_handle_to_aura(meta_aura));
    1426                 :            :                                 loff = loff - 15;
    1427                 :            :                                 shft += 3;
    1428                 :            : 
    1429                 :            :                                 lnum++;
    1430                 :            :                                 laddr = (uintptr_t)LMT_OFF(lbase, lnum, 8);
    1431                 :            :                                 /* Pick the pointer from 16th index and put it
    1432                 :            :                                  * at end of this new line.
    1433                 :            :                                  */
    1434                 :            :                                 *(uint64_t *)(laddr + (loff << 3) - 8) = *(uint64_t *)(laddr - 8);
    1435                 :            :                         }
    1436                 :            : 
    1437                 :            :                         /* Flush it when we are in 16th line and might
    1438                 :            :                          * overflow it
    1439                 :            :                          */
    1440                 :            :                         if (lnum >= 15 && loff >= 12) {
    1441                 :            :                                 /* 16 LMT Line size m1 */
    1442                 :            :                                 uint64_t data = BIT_ULL(48) - 1;
    1443                 :            : 
    1444                 :            :                                 /* Update aura handle */
    1445                 :            :                                 *(uint64_t *)(laddr - 8) = (((uint64_t)(loff & 0x1) << 32) |
    1446                 :            :                                                             roc_npa_aura_handle_to_aura(meta_aura));
    1447                 :            : 
    1448                 :            :                                 data = (data & ~(0x7UL << shft)) | (((uint64_t)loff >> 1) << shft);
    1449                 :            : 
    1450                 :            :                                 /* Send up to 16 lmt lines of pointers */
    1451                 :            :                                 nix_sec_flush_meta_burst(lmt_id, data, lnum + 1, meta_aura);
    1452                 :            :                                 rte_io_wmb();
    1453                 :            :                                 lnum = 0;
    1454                 :            :                                 loff = 0;
    1455                 :            :                                 shft = 0;
    1456                 :            :                                 /* First pointer starts at 8B offset */
    1457                 :            :                                 laddr = (uintptr_t)LMT_OFF(lbase, lnum, 8);
    1458                 :            :                         }
    1459                 :            :                 }
    1460                 :            :         }
    1461                 :            : 
    1462                 :            :         if (flags & NIX_RX_OFFLOAD_SECURITY_F && loff) {
    1463                 :            :                 /* 16 LMT Line size m1 */
    1464                 :            :                 uint64_t data = BIT_ULL(48) - 1;
    1465                 :            : 
    1466                 :            :                 /* Update aura handle */
    1467                 :            :                 *(uint64_t *)(laddr - 8) =
    1468                 :            :                         (((uint64_t)(loff & 0x1) << 32) | roc_npa_aura_handle_to_aura(meta_aura));
    1469                 :            : 
    1470                 :            :                 data = (data & ~(0x7UL << shft)) | (((uint64_t)loff >> 1) << shft);
    1471                 :            : 
    1472                 :            :                 /* Send up to 16 lmt lines of pointers */
    1473                 :            :                 nix_sec_flush_meta_burst(lmt_id, data, lnum + 1, meta_aura);
    1474                 :            :                 if (flags & NIX_RX_VWQE_F)
    1475                 :            :                         plt_io_wmb();
    1476                 :            :         }
    1477                 :            : 
    1478                 :            :         if (flags & NIX_RX_VWQE_F)
    1479                 :            :                 return packets;
    1480                 :            : 
    1481                 :            :         rxq->head = head;
    1482                 :            :         rxq->available -= packets;
    1483                 :            : 
    1484                 :            :         rte_io_wmb();
    1485                 :            :         /* Free all the CQs that we've processed */
    1486                 :            :         plt_write64((rxq->wdata | packets), rxq->cq_door);
    1487                 :            : 
    1488                 :            :         if (unlikely(pkts_left))
    1489                 :            :                 packets += cn20k_nix_recv_pkts(args, &mbufs[packets], pkts_left, flags);
    1490                 :            : 
    1491                 :            :         return packets;
    1492                 :            : }
    1493                 :            : 
    1494                 :            : #else
    1495                 :            : 
    1496                 :            : static inline uint16_t
    1497                 :            : cn20k_nix_recv_pkts_vector(void *args, struct rte_mbuf **mbufs, uint16_t pkts, const uint16_t flags,
    1498                 :            :                            void *lookup_mem, struct cnxk_timesync_info *tstamp, uintptr_t lmt_base,
    1499                 :            :                            uint64_t meta_aura)
    1500                 :            : {
    1501                 :            :         RTE_SET_USED(args);
    1502                 :            :         RTE_SET_USED(mbufs);
    1503                 :            :         RTE_SET_USED(pkts);
    1504                 :            :         RTE_SET_USED(flags);
    1505                 :            :         RTE_SET_USED(lookup_mem);
    1506                 :            :         RTE_SET_USED(tstamp);
    1507                 :            :         RTE_SET_USED(lmt_base);
    1508                 :            :         RTE_SET_USED(meta_aura);
    1509                 :            : 
    1510                 :            :         return 0;
    1511                 :            : }
    1512                 :            : 
    1513                 :            : #endif
    1514                 :            : 
    1515                 :            : #define RSS_F     NIX_RX_OFFLOAD_RSS_F
    1516                 :            : #define PTYPE_F   NIX_RX_OFFLOAD_PTYPE_F
    1517                 :            : #define CKSUM_F   NIX_RX_OFFLOAD_CHECKSUM_F
    1518                 :            : #define MARK_F    NIX_RX_OFFLOAD_MARK_UPDATE_F
    1519                 :            : #define TS_F      NIX_RX_OFFLOAD_TSTAMP_F
    1520                 :            : #define RX_VLAN_F NIX_RX_OFFLOAD_VLAN_STRIP_F
    1521                 :            : #define R_SEC_F   NIX_RX_OFFLOAD_SECURITY_F
    1522                 :            : 
    1523                 :            : /* [R_SEC_F] [RX_VLAN_F] [TS] [MARK] [CKSUM] [PTYPE] [RSS] */
    1524                 :            : #define NIX_RX_FASTPATH_MODES_0_15                                                                 \
    1525                 :            :         R(no_offload, NIX_RX_OFFLOAD_NONE)                                                         \
    1526                 :            :         R(rss, RSS_F)                                                                              \
    1527                 :            :         R(ptype, PTYPE_F)                                                                          \
    1528                 :            :         R(ptype_rss, PTYPE_F | RSS_F)                                                              \
    1529                 :            :         R(cksum, CKSUM_F)                                                                          \
    1530                 :            :         R(cksum_rss, CKSUM_F | RSS_F)                                                              \
    1531                 :            :         R(cksum_ptype, CKSUM_F | PTYPE_F)                                                          \
    1532                 :            :         R(cksum_ptype_rss, CKSUM_F | PTYPE_F | RSS_F)                                              \
    1533                 :            :         R(mark, MARK_F)                                                                            \
    1534                 :            :         R(mark_rss, MARK_F | RSS_F)                                                                \
    1535                 :            :         R(mark_ptype, MARK_F | PTYPE_F)                                                            \
    1536                 :            :         R(mark_ptype_rss, MARK_F | PTYPE_F | RSS_F)                                                \
    1537                 :            :         R(mark_cksum, MARK_F | CKSUM_F)                                                            \
    1538                 :            :         R(mark_cksum_rss, MARK_F | CKSUM_F | RSS_F)                                                \
    1539                 :            :         R(mark_cksum_ptype, MARK_F | CKSUM_F | PTYPE_F)                                            \
    1540                 :            :         R(mark_cksum_ptype_rss, MARK_F | CKSUM_F | PTYPE_F | RSS_F)
    1541                 :            : 
    1542                 :            : #define NIX_RX_FASTPATH_MODES_16_31                                                                \
    1543                 :            :         R(ts, TS_F)                                                                                \
    1544                 :            :         R(ts_rss, TS_F | RSS_F)                                                                    \
    1545                 :            :         R(ts_ptype, TS_F | PTYPE_F)                                                                \
    1546                 :            :         R(ts_ptype_rss, TS_F | PTYPE_F | RSS_F)                                                    \
    1547                 :            :         R(ts_cksum, TS_F | CKSUM_F)                                                                \
    1548                 :            :         R(ts_cksum_rss, TS_F | CKSUM_F | RSS_F)                                                    \
    1549                 :            :         R(ts_cksum_ptype, TS_F | CKSUM_F | PTYPE_F)                                                \
    1550                 :            :         R(ts_cksum_ptype_rss, TS_F | CKSUM_F | PTYPE_F | RSS_F)                                    \
    1551                 :            :         R(ts_mark, TS_F | MARK_F)                                                                  \
    1552                 :            :         R(ts_mark_rss, TS_F | MARK_F | RSS_F)                                                      \
    1553                 :            :         R(ts_mark_ptype, TS_F | MARK_F | PTYPE_F)                                                  \
    1554                 :            :         R(ts_mark_ptype_rss, TS_F | MARK_F | PTYPE_F | RSS_F)                                      \
    1555                 :            :         R(ts_mark_cksum, TS_F | MARK_F | CKSUM_F)                                                  \
    1556                 :            :         R(ts_mark_cksum_rss, TS_F | MARK_F | CKSUM_F | RSS_F)                                      \
    1557                 :            :         R(ts_mark_cksum_ptype, TS_F | MARK_F | CKSUM_F | PTYPE_F)                                  \
    1558                 :            :         R(ts_mark_cksum_ptype_rss, TS_F | MARK_F | CKSUM_F | PTYPE_F | RSS_F)
    1559                 :            : 
    1560                 :            : #define NIX_RX_FASTPATH_MODES_32_47                                                                \
    1561                 :            :         R(vlan, RX_VLAN_F)                                                                         \
    1562                 :            :         R(vlan_rss, RX_VLAN_F | RSS_F)                                                             \
    1563                 :            :         R(vlan_ptype, RX_VLAN_F | PTYPE_F)                                                         \
    1564                 :            :         R(vlan_ptype_rss, RX_VLAN_F | PTYPE_F | RSS_F)                                             \
    1565                 :            :         R(vlan_cksum, RX_VLAN_F | CKSUM_F)                                                         \
    1566                 :            :         R(vlan_cksum_rss, RX_VLAN_F | CKSUM_F | RSS_F)                                             \
    1567                 :            :         R(vlan_cksum_ptype, RX_VLAN_F | CKSUM_F | PTYPE_F)                                         \
    1568                 :            :         R(vlan_cksum_ptype_rss, RX_VLAN_F | CKSUM_F | PTYPE_F | RSS_F)                             \
    1569                 :            :         R(vlan_mark, RX_VLAN_F | MARK_F)                                                           \
    1570                 :            :         R(vlan_mark_rss, RX_VLAN_F | MARK_F | RSS_F)                                               \
    1571                 :            :         R(vlan_mark_ptype, RX_VLAN_F | MARK_F | PTYPE_F)                                           \
    1572                 :            :         R(vlan_mark_ptype_rss, RX_VLAN_F | MARK_F | PTYPE_F | RSS_F)                               \
    1573                 :            :         R(vlan_mark_cksum, RX_VLAN_F | MARK_F | CKSUM_F)                                           \
    1574                 :            :         R(vlan_mark_cksum_rss, RX_VLAN_F | MARK_F | CKSUM_F | RSS_F)                               \
    1575                 :            :         R(vlan_mark_cksum_ptype, RX_VLAN_F | MARK_F | CKSUM_F | PTYPE_F)                           \
    1576                 :            :         R(vlan_mark_cksum_ptype_rss, RX_VLAN_F | MARK_F | CKSUM_F | PTYPE_F | RSS_F)
    1577                 :            : 
    1578                 :            : #define NIX_RX_FASTPATH_MODES_48_63                                                                \
    1579                 :            :         R(vlan_ts, RX_VLAN_F | TS_F)                                                               \
    1580                 :            :         R(vlan_ts_rss, RX_VLAN_F | TS_F | RSS_F)                                                   \
    1581                 :            :         R(vlan_ts_ptype, RX_VLAN_F | TS_F | PTYPE_F)                                               \
    1582                 :            :         R(vlan_ts_ptype_rss, RX_VLAN_F | TS_F | PTYPE_F | RSS_F)                                   \
    1583                 :            :         R(vlan_ts_cksum, RX_VLAN_F | TS_F | CKSUM_F)                                               \
    1584                 :            :         R(vlan_ts_cksum_rss, RX_VLAN_F | TS_F | CKSUM_F | RSS_F)                                   \
    1585                 :            :         R(vlan_ts_cksum_ptype, RX_VLAN_F | TS_F | CKSUM_F | PTYPE_F)                               \
    1586                 :            :         R(vlan_ts_cksum_ptype_rss, RX_VLAN_F | TS_F | CKSUM_F | PTYPE_F | RSS_F)                   \
    1587                 :            :         R(vlan_ts_mark, RX_VLAN_F | TS_F | MARK_F)                                                 \
    1588                 :            :         R(vlan_ts_mark_rss, RX_VLAN_F | TS_F | MARK_F | RSS_F)                                     \
    1589                 :            :         R(vlan_ts_mark_ptype, RX_VLAN_F | TS_F | MARK_F | PTYPE_F)                                 \
    1590                 :            :         R(vlan_ts_mark_ptype_rss, RX_VLAN_F | TS_F | MARK_F | PTYPE_F | RSS_F)                     \
    1591                 :            :         R(vlan_ts_mark_cksum, RX_VLAN_F | TS_F | MARK_F | CKSUM_F)                                 \
    1592                 :            :         R(vlan_ts_mark_cksum_rss, RX_VLAN_F | TS_F | MARK_F | CKSUM_F | RSS_F)                     \
    1593                 :            :         R(vlan_ts_mark_cksum_ptype, RX_VLAN_F | TS_F | MARK_F | CKSUM_F | PTYPE_F)                 \
    1594                 :            :         R(vlan_ts_mark_cksum_ptype_rss, RX_VLAN_F | TS_F | MARK_F | CKSUM_F | PTYPE_F | RSS_F)
    1595                 :            : 
    1596                 :            : #define NIX_RX_FASTPATH_MODES_64_79                                                                \
    1597                 :            :         R(sec, R_SEC_F)                                                                            \
    1598                 :            :         R(sec_rss, R_SEC_F | RSS_F)                                                                \
    1599                 :            :         R(sec_ptype, R_SEC_F | PTYPE_F)                                                            \
    1600                 :            :         R(sec_ptype_rss, R_SEC_F | PTYPE_F | RSS_F)                                                \
    1601                 :            :         R(sec_cksum, R_SEC_F | CKSUM_F)                                                            \
    1602                 :            :         R(sec_cksum_rss, R_SEC_F | CKSUM_F | RSS_F)                                                \
    1603                 :            :         R(sec_cksum_ptype, R_SEC_F | CKSUM_F | PTYPE_F)                                            \
    1604                 :            :         R(sec_cksum_ptype_rss, R_SEC_F | CKSUM_F | PTYPE_F | RSS_F)                                \
    1605                 :            :         R(sec_mark, R_SEC_F | MARK_F)                                                              \
    1606                 :            :         R(sec_mark_rss, R_SEC_F | MARK_F | RSS_F)                                                  \
    1607                 :            :         R(sec_mark_ptype, R_SEC_F | MARK_F | PTYPE_F)                                              \
    1608                 :            :         R(sec_mark_ptype_rss, R_SEC_F | MARK_F | PTYPE_F | RSS_F)                                  \
    1609                 :            :         R(sec_mark_cksum, R_SEC_F | MARK_F | CKSUM_F)                                              \
    1610                 :            :         R(sec_mark_cksum_rss, R_SEC_F | MARK_F | CKSUM_F | RSS_F)                                  \
    1611                 :            :         R(sec_mark_cksum_ptype, R_SEC_F | MARK_F | CKSUM_F | PTYPE_F)                              \
    1612                 :            :         R(sec_mark_cksum_ptype_rss, R_SEC_F | MARK_F | CKSUM_F | PTYPE_F | RSS_F)
    1613                 :            : 
    1614                 :            : #define NIX_RX_FASTPATH_MODES_80_95                                                                \
    1615                 :            :         R(sec_ts, R_SEC_F | TS_F)                                                                  \
    1616                 :            :         R(sec_ts_rss, R_SEC_F | TS_F | RSS_F)                                                      \
    1617                 :            :         R(sec_ts_ptype, R_SEC_F | TS_F | PTYPE_F)                                                  \
    1618                 :            :         R(sec_ts_ptype_rss, R_SEC_F | TS_F | PTYPE_F | RSS_F)                                      \
    1619                 :            :         R(sec_ts_cksum, R_SEC_F | TS_F | CKSUM_F)                                                  \
    1620                 :            :         R(sec_ts_cksum_rss, R_SEC_F | TS_F | CKSUM_F | RSS_F)                                      \
    1621                 :            :         R(sec_ts_cksum_ptype, R_SEC_F | TS_F | CKSUM_F | PTYPE_F)                                  \
    1622                 :            :         R(sec_ts_cksum_ptype_rss, R_SEC_F | TS_F | CKSUM_F | PTYPE_F | RSS_F)                      \
    1623                 :            :         R(sec_ts_mark, R_SEC_F | TS_F | MARK_F)                                                    \
    1624                 :            :         R(sec_ts_mark_rss, R_SEC_F | TS_F | MARK_F | RSS_F)                                        \
    1625                 :            :         R(sec_ts_mark_ptype, R_SEC_F | TS_F | MARK_F | PTYPE_F)                                    \
    1626                 :            :         R(sec_ts_mark_ptype_rss, R_SEC_F | TS_F | MARK_F | PTYPE_F | RSS_F)                        \
    1627                 :            :         R(sec_ts_mark_cksum, R_SEC_F | TS_F | MARK_F | CKSUM_F)                                    \
    1628                 :            :         R(sec_ts_mark_cksum_rss, R_SEC_F | TS_F | MARK_F | CKSUM_F | RSS_F)                        \
    1629                 :            :         R(sec_ts_mark_cksum_ptype, R_SEC_F | TS_F | MARK_F | CKSUM_F | PTYPE_F)                    \
    1630                 :            :         R(sec_ts_mark_cksum_ptype_rss, R_SEC_F | TS_F | MARK_F | CKSUM_F | PTYPE_F | RSS_F)
    1631                 :            : 
    1632                 :            : #define NIX_RX_FASTPATH_MODES_96_111                                                               \
    1633                 :            :         R(sec_vlan, R_SEC_F | RX_VLAN_F)                                                           \
    1634                 :            :         R(sec_vlan_rss, R_SEC_F | RX_VLAN_F | RSS_F)                                               \
    1635                 :            :         R(sec_vlan_ptype, R_SEC_F | RX_VLAN_F | PTYPE_F)                                           \
    1636                 :            :         R(sec_vlan_ptype_rss, R_SEC_F | RX_VLAN_F | PTYPE_F | RSS_F)                               \
    1637                 :            :         R(sec_vlan_cksum, R_SEC_F | RX_VLAN_F | CKSUM_F)                                           \
    1638                 :            :         R(sec_vlan_cksum_rss, R_SEC_F | RX_VLAN_F | CKSUM_F | RSS_F)                               \
    1639                 :            :         R(sec_vlan_cksum_ptype, R_SEC_F | RX_VLAN_F | CKSUM_F | PTYPE_F)                           \
    1640                 :            :         R(sec_vlan_cksum_ptype_rss, R_SEC_F | RX_VLAN_F | CKSUM_F | PTYPE_F | RSS_F)               \
    1641                 :            :         R(sec_vlan_mark, R_SEC_F | RX_VLAN_F | MARK_F)                                             \
    1642                 :            :         R(sec_vlan_mark_rss, R_SEC_F | RX_VLAN_F | MARK_F | RSS_F)                                 \
    1643                 :            :         R(sec_vlan_mark_ptype, R_SEC_F | RX_VLAN_F | MARK_F | PTYPE_F)                             \
    1644                 :            :         R(sec_vlan_mark_ptype_rss, R_SEC_F | RX_VLAN_F | MARK_F | PTYPE_F | RSS_F)                 \
    1645                 :            :         R(sec_vlan_mark_cksum, R_SEC_F | RX_VLAN_F | MARK_F | CKSUM_F)                             \
    1646                 :            :         R(sec_vlan_mark_cksum_rss, R_SEC_F | RX_VLAN_F | MARK_F | CKSUM_F | RSS_F)                 \
    1647                 :            :         R(sec_vlan_mark_cksum_ptype, R_SEC_F | RX_VLAN_F | MARK_F | CKSUM_F | PTYPE_F)             \
    1648                 :            :         R(sec_vlan_mark_cksum_ptype_rss, R_SEC_F | RX_VLAN_F | MARK_F | CKSUM_F | PTYPE_F | RSS_F)
    1649                 :            : 
    1650                 :            : #define NIX_RX_FASTPATH_MODES_112_127                                                              \
    1651                 :            :         R(sec_vlan_ts, R_SEC_F | RX_VLAN_F | TS_F)                                                 \
    1652                 :            :         R(sec_vlan_ts_rss, R_SEC_F | RX_VLAN_F | TS_F | RSS_F)                                     \
    1653                 :            :         R(sec_vlan_ts_ptype, R_SEC_F | RX_VLAN_F | TS_F | PTYPE_F)                                 \
    1654                 :            :         R(sec_vlan_ts_ptype_rss, R_SEC_F | RX_VLAN_F | TS_F | PTYPE_F | RSS_F)                     \
    1655                 :            :         R(sec_vlan_ts_cksum, R_SEC_F | RX_VLAN_F | TS_F | CKSUM_F)                                 \
    1656                 :            :         R(sec_vlan_ts_cksum_rss, R_SEC_F | RX_VLAN_F | TS_F | CKSUM_F | RSS_F)                     \
    1657                 :            :         R(sec_vlan_ts_cksum_ptype, R_SEC_F | RX_VLAN_F | TS_F | CKSUM_F | PTYPE_F)                 \
    1658                 :            :         R(sec_vlan_ts_cksum_ptype_rss, R_SEC_F | RX_VLAN_F | TS_F | CKSUM_F | PTYPE_F | RSS_F)     \
    1659                 :            :         R(sec_vlan_ts_mark, R_SEC_F | RX_VLAN_F | TS_F | MARK_F)                                   \
    1660                 :            :         R(sec_vlan_ts_mark_rss, R_SEC_F | RX_VLAN_F | TS_F | MARK_F | RSS_F)                       \
    1661                 :            :         R(sec_vlan_ts_mark_ptype, R_SEC_F | RX_VLAN_F | TS_F | MARK_F | PTYPE_F)                   \
    1662                 :            :         R(sec_vlan_ts_mark_ptype_rss, R_SEC_F | RX_VLAN_F | TS_F | MARK_F | PTYPE_F | RSS_F)       \
    1663                 :            :         R(sec_vlan_ts_mark_cksum, R_SEC_F | RX_VLAN_F | TS_F | MARK_F | CKSUM_F)                   \
    1664                 :            :         R(sec_vlan_ts_mark_cksum_rss, R_SEC_F | RX_VLAN_F | TS_F | MARK_F | CKSUM_F | RSS_F)       \
    1665                 :            :         R(sec_vlan_ts_mark_cksum_ptype, R_SEC_F | RX_VLAN_F | TS_F | MARK_F | CKSUM_F | PTYPE_F)   \
    1666                 :            :         R(sec_vlan_ts_mark_cksum_ptype_rss,                                                        \
    1667                 :            :           R_SEC_F | RX_VLAN_F | TS_F | MARK_F | CKSUM_F | PTYPE_F | RSS_F)
    1668                 :            : 
    1669                 :            : #define NIX_RX_FASTPATH_MODES                                                                      \
    1670                 :            :         NIX_RX_FASTPATH_MODES_0_15                                                                 \
    1671                 :            :         NIX_RX_FASTPATH_MODES_16_31                                                                \
    1672                 :            :         NIX_RX_FASTPATH_MODES_32_47                                                                \
    1673                 :            :         NIX_RX_FASTPATH_MODES_48_63                                                                \
    1674                 :            :         NIX_RX_FASTPATH_MODES_64_79                                                                \
    1675                 :            :         NIX_RX_FASTPATH_MODES_80_95                                                                \
    1676                 :            :         NIX_RX_FASTPATH_MODES_96_111                                                               \
    1677                 :            :         NIX_RX_FASTPATH_MODES_112_127
    1678                 :            : 
    1679                 :            : #define R(name, flags)                                                                             \
    1680                 :            :         uint16_t __rte_noinline __rte_hot cn20k_nix_recv_pkts_##name(                              \
    1681                 :            :                 void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts);                         \
    1682                 :            :         uint16_t __rte_noinline __rte_hot cn20k_nix_recv_pkts_mseg_##name(                         \
    1683                 :            :                 void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts);                         \
    1684                 :            :         uint16_t __rte_noinline __rte_hot cn20k_nix_recv_pkts_vec_##name(                          \
    1685                 :            :                 void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts);                         \
    1686                 :            :         uint16_t __rte_noinline __rte_hot cn20k_nix_recv_pkts_vec_mseg_##name(                     \
    1687                 :            :                 void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts);                         \
    1688                 :            :         uint16_t __rte_noinline __rte_hot cn20k_nix_recv_pkts_reas_##name(                         \
    1689                 :            :                 void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts);                         \
    1690                 :            :         uint16_t __rte_noinline __rte_hot cn20k_nix_recv_pkts_reas_mseg_##name(                    \
    1691                 :            :                 void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts);                         \
    1692                 :            :         uint16_t __rte_noinline __rte_hot cn20k_nix_recv_pkts_reas_vec_##name(                     \
    1693                 :            :                 void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts);                         \
    1694                 :            :         uint16_t __rte_noinline __rte_hot cn20k_nix_recv_pkts_reas_vec_mseg_##name(                \
    1695                 :            :                 void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts);
    1696                 :            : 
    1697                 :            : NIX_RX_FASTPATH_MODES
    1698                 :            : #undef R
    1699                 :            : 
    1700                 :            : #define NIX_RX_RECV(fn, flags)                                                                     \
    1701                 :            :         uint16_t __rte_noinline __rte_hot fn(void *rx_queue, struct rte_mbuf **rx_pkts,            \
    1702                 :            :                                              uint16_t pkts)                                        \
    1703                 :            :         {                                                                                          \
    1704                 :            :                 return cn20k_nix_recv_pkts(rx_queue, rx_pkts, pkts, (flags));                      \
    1705                 :            :         }
    1706                 :            : 
    1707                 :            : #define NIX_RX_RECV_MSEG(fn, flags) NIX_RX_RECV(fn, flags | NIX_RX_MULTI_SEG_F)
    1708                 :            : 
    1709                 :            : #define NIX_RX_RECV_VEC(fn, flags)                                                                 \
    1710                 :            :         uint16_t __rte_noinline __rte_hot fn(void *rx_queue, struct rte_mbuf **rx_pkts,            \
    1711                 :            :                                              uint16_t pkts)                                        \
    1712                 :            :         {                                                                                          \
    1713                 :            :                 return cn20k_nix_recv_pkts_vector(rx_queue, rx_pkts, pkts, (flags), NULL, NULL, 0, \
    1714                 :            :                                                   0);                                              \
    1715                 :            :         }
    1716                 :            : 
    1717                 :            : #define NIX_RX_RECV_VEC_MSEG(fn, flags) NIX_RX_RECV_VEC(fn, flags | NIX_RX_MULTI_SEG_F)
    1718                 :            : 
    1719                 :            : uint16_t __rte_noinline __rte_hot cn20k_nix_recv_pkts_all_offload(void *rx_queue,
    1720                 :            :                                                                   struct rte_mbuf **rx_pkts,
    1721                 :            :                                                                   uint16_t pkts);
    1722                 :            : 
    1723                 :            : uint16_t __rte_noinline __rte_hot cn20k_nix_recv_pkts_vec_all_offload(void *rx_queue,
    1724                 :            :                                                                       struct rte_mbuf **rx_pkts,
    1725                 :            :                                                                       uint16_t pkts);
    1726                 :            : 
    1727                 :            : uint16_t __rte_noinline __rte_hot cn20k_nix_recv_pkts_all_offload_tst(void *rx_queue,
    1728                 :            :                                                                       struct rte_mbuf **rx_pkts,
    1729                 :            :                                                                       uint16_t pkts);
    1730                 :            : 
    1731                 :            : uint16_t __rte_noinline __rte_hot cn20k_nix_recv_pkts_vec_all_offload_tst(void *rx_queue,
    1732                 :            :                                                                           struct rte_mbuf **rx_pkts,
    1733                 :            :                                                                           uint16_t pkts);
    1734                 :            : 
    1735                 :            : #endif /* __CN20K_RX_H__ */

Generated by: LCOV version 1.14