1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2017 6WIND S.A.
3 * Copyright 2017 Mellanox Technologies, Ltd
6 #ifndef RTE_PMD_MLX5_RXTX_VEC_ALTIVEC_H_
7 #define RTE_PMD_MLX5_RXTX_VEC_ALTIVEC_H_
13 #include <rte_altivec.h>
16 #include <rte_mempool.h>
17 #include <rte_prefetch.h>
21 #include "mlx5_defs.h"
23 #include "mlx5_utils.h"
24 #include "mlx5_rxtx.h"
25 #include "mlx5_rxtx_vec.h"
26 #include "mlx5_autoconf.h"
28 #ifndef __INTEL_COMPILER
29 #pragma GCC diagnostic ignored "-Wcast-qual"
30 #pragma GCC diagnostic ignored "-Wstrict-aliasing"
34 * Store free buffers to RX SW ring.
37 * Pointer to RX queue structure.
39 * Pointer to array of packets to be stored.
41 * Number of packets to be stored.
44 rxq_copy_mbuf_v(struct mlx5_rxq_data *rxq, struct rte_mbuf **pkts, uint16_t n)
46 const uint16_t q_mask = (1 << rxq->elts_n) - 1;
47 struct rte_mbuf **elts = &(*rxq->elts)[rxq->rq_pi & q_mask];
51 for (pos = 0; pos < p; pos += 2) {
52 vector unsigned char mbp;
54 mbp = (vector unsigned char)vec_vsx_ld(0,
55 (signed int const *)&elts[pos]);
56 *(vector unsigned char *)&pkts[pos] = mbp;
59 pkts[pos] = elts[pos];
63 * Decompress a compressed completion and fill in mbufs in RX SW ring with data
64 * extracted from the title completion descriptor.
67 * Pointer to RX queue structure.
69 * Pointer to completion array having a compressed completion at first.
71 * Pointer to SW ring to be filled. The first mbuf has to be pre-built from
72 * the title completion descriptor to be copied to the rest of mbufs.
75 * Number of mini-CQEs successfully decompressed.
77 static inline uint16_t
78 rxq_cq_decompress_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq,
79 struct rte_mbuf **elts)
81 volatile struct mlx5_mini_cqe8 *mcq = (void *)&(cq + 1)->pkt_info;
82 struct rte_mbuf *t_pkt = elts[0]; /* Title packet is pre-built. */
83 const vector unsigned char zero = (vector unsigned char){0};
84 /* Mask to shuffle from extracted mini CQE to mbuf. */
85 const vector unsigned char shuf_mask1 = (vector unsigned char){
86 -1, -1, -1, -1, /* skip packet_type */
87 7, 6, -1, -1, /* bswap16, pkt_len */
88 7, 6, /* bswap16, data_len */
89 -1, -1, /* skip vlan_tci */
90 3, 2, 1, 0}; /* bswap32, rss */
91 const vector unsigned char shuf_mask2 = (vector unsigned char){
92 -1, -1, -1, -1, /* skip packet_type */
93 15, 14, -1, -1, /* bswap16, pkt_len */
94 15, 14, /* data_len, bswap16 */
95 -1, -1, /* skip vlan_tci */
96 11, 10, 9, 8}; /* bswap32, rss */
97 /* Restore the compressed count. Must be 16 bits. */
98 const uint16_t mcqe_n = t_pkt->data_len +
99 (rxq->crc_present * RTE_ETHER_CRC_LEN);
100 const vector unsigned char rearm =
101 (vector unsigned char)vec_vsx_ld(0,
102 (signed int const *)&t_pkt->rearm_data);
103 const vector unsigned char rxdf =
104 (vector unsigned char)vec_vsx_ld(0,
105 (signed int const *)&t_pkt->rx_descriptor_fields1);
106 const vector unsigned char crc_adj =
107 (vector unsigned char)(vector unsigned short){
108 0, 0, rxq->crc_present * RTE_ETHER_CRC_LEN, 0,
109 rxq->crc_present * RTE_ETHER_CRC_LEN, 0, 0, 0};
110 const vector unsigned short rxdf_sel_mask =
111 (vector unsigned short){
112 0xffff, 0xffff, 0, 0, 0, 0xffff, 0, 0};
113 const uint32_t flow_tag = t_pkt->hash.fdir.hi;
116 unsigned int inv = 0;
118 #ifdef MLX5_PMD_SOFT_COUNTERS
119 const vector unsigned char ones = vec_splat_u8(-1);
120 uint32_t rcvd_byte = 0;
121 /* Mask to shuffle byte_cnt to add up stats. Do bswap16 for all. */
122 const vector unsigned char len_shuf_mask = (vector unsigned char){
130 * A. load mCQEs into a 128bit register.
131 * B. store rearm data to mbuf.
132 * C. combine data from mCQEs with rx_descriptor_fields1.
133 * D. store rx_descriptor_fields1.
134 * E. store flow tag (rte_flow mark).
136 for (pos = 0; pos < mcqe_n; ) {
137 vector unsigned char mcqe1, mcqe2;
138 vector unsigned char rxdf1, rxdf2;
139 #ifdef MLX5_PMD_SOFT_COUNTERS
140 const vector unsigned short mcqe_sel_mask =
141 (vector unsigned short){0, 0, 0xffff, 0xffff,
142 0, 0, 0xfff, 0xffff};
143 const vector unsigned char lower_half = {
144 0, 1, 4, 5, 8, 9, 12, 13, 16,
145 17, 20, 21, 24, 25, 28, 29};
146 const vector unsigned char upper_half = {
147 2, 3, 6, 7, 10, 11, 14, 15,
148 18, 19, 22, 23, 26, 27, 30, 31};
149 vector unsigned short left, right;
150 vector unsigned char byte_cnt, invalid_mask;
151 vector unsigned long lshift;
152 __attribute__((altivec(vector__)))
153 __attribute__((altivec(bool__)))
154 unsigned long long shmask;
155 const vector unsigned long shmax = {64, 64};
158 for (i = 0; i < MLX5_VPMD_DESCS_PER_LOOP; ++i)
159 if (likely(pos + i < mcqe_n))
160 rte_prefetch0((void *)(cq + pos + i));
162 /* A.1 load mCQEs into a 128bit register. */
163 mcqe1 = (vector unsigned char)vec_vsx_ld(0,
164 (signed int const *)&mcq[pos % 8]);
165 mcqe2 = (vector unsigned char)vec_vsx_ld(0,
166 (signed int const *)&mcq[pos % 8 + 2]);
168 /* B.1 store rearm data to mbuf. */
169 *(vector unsigned char *)
170 &elts[pos]->rearm_data = rearm;
171 *(vector unsigned char *)
172 &elts[pos + 1]->rearm_data = rearm;
174 /* C.1 combine data from mCQEs with rx_descriptor_fields1. */
175 rxdf1 = vec_perm(mcqe1, zero, shuf_mask1);
176 rxdf2 = vec_perm(mcqe1, zero, shuf_mask2);
177 rxdf1 = (vector unsigned char)
178 ((vector unsigned short)rxdf1 -
179 (vector unsigned short)crc_adj);
180 rxdf2 = (vector unsigned char)
181 ((vector unsigned short)rxdf2 -
182 (vector unsigned short)crc_adj);
183 rxdf1 = (vector unsigned char)
184 vec_sel((vector unsigned short)rxdf1,
185 (vector unsigned short)rxdf, rxdf_sel_mask);
186 rxdf2 = (vector unsigned char)
187 vec_sel((vector unsigned short)rxdf2,
188 (vector unsigned short)rxdf, rxdf_sel_mask);
190 /* D.1 store rx_descriptor_fields1. */
191 *(vector unsigned char *)
192 &elts[pos]->rx_descriptor_fields1 = rxdf1;
193 *(vector unsigned char *)
194 &elts[pos + 1]->rx_descriptor_fields1 = rxdf2;
196 /* B.1 store rearm data to mbuf. */
197 *(vector unsigned char *)
198 &elts[pos + 2]->rearm_data = rearm;
199 *(vector unsigned char *)
200 &elts[pos + 3]->rearm_data = rearm;
202 /* C.1 combine data from mCQEs with rx_descriptor_fields1. */
203 rxdf1 = vec_perm(mcqe2, zero, shuf_mask1);
204 rxdf2 = vec_perm(mcqe2, zero, shuf_mask2);
205 rxdf1 = (vector unsigned char)
206 ((vector unsigned short)rxdf1 -
207 (vector unsigned short)crc_adj);
208 rxdf2 = (vector unsigned char)
209 ((vector unsigned short)rxdf2 -
210 (vector unsigned short)crc_adj);
211 rxdf1 = (vector unsigned char)
212 vec_sel((vector unsigned short)rxdf1,
213 (vector unsigned short)rxdf, rxdf_sel_mask);
214 rxdf2 = (vector unsigned char)
215 vec_sel((vector unsigned short)rxdf2,
216 (vector unsigned short)rxdf, rxdf_sel_mask);
218 /* D.1 store rx_descriptor_fields1. */
219 *(vector unsigned char *)
220 &elts[pos + 2]->rx_descriptor_fields1 = rxdf1;
221 *(vector unsigned char *)
222 &elts[pos + 3]->rx_descriptor_fields1 = rxdf2;
224 #ifdef MLX5_PMD_SOFT_COUNTERS
225 invalid_mask = (vector unsigned char)(vector unsigned long){
226 (mcqe_n - pos) * sizeof(uint16_t) * 8, 0};
229 vec_splat((vector unsigned long)invalid_mask, 0);
230 shmask = vec_cmpgt(shmax, lshift);
231 invalid_mask = (vector unsigned char)
232 vec_sl((vector unsigned long)ones, lshift);
233 invalid_mask = (vector unsigned char)
234 vec_sel((vector unsigned long)shmask,
235 (vector unsigned long)invalid_mask, shmask);
237 mcqe1 = (vector unsigned char)
238 vec_sro((vector unsigned short)mcqe1,
239 (vector unsigned char){32}),
240 byte_cnt = (vector unsigned char)
241 vec_sel((vector unsigned short)mcqe1,
242 (vector unsigned short)mcqe2, mcqe_sel_mask);
243 byte_cnt = vec_perm(byte_cnt, zero, len_shuf_mask);
244 byte_cnt = (vector unsigned char)
245 vec_andc((vector unsigned long)byte_cnt,
246 (vector unsigned long)invalid_mask);
247 left = vec_perm((vector unsigned short)byte_cnt,
248 (vector unsigned short)zero, lower_half);
249 right = vec_perm((vector unsigned short)byte_cnt,
250 (vector unsigned short)zero, upper_half);
251 byte_cnt = (vector unsigned char)vec_add(left, right);
252 left = vec_perm((vector unsigned short)byte_cnt,
253 (vector unsigned short)zero, lower_half);
254 right = vec_perm((vector unsigned short)byte_cnt,
255 (vector unsigned short)zero, upper_half);
256 byte_cnt = (vector unsigned char)vec_add(left, right);
257 rcvd_byte += ((vector unsigned long)byte_cnt)[0];
261 /* E.1 store flow tag (rte_flow mark). */
262 elts[pos]->hash.fdir.hi = flow_tag;
263 elts[pos + 1]->hash.fdir.hi = flow_tag;
264 elts[pos + 2]->hash.fdir.hi = flow_tag;
265 elts[pos + 3]->hash.fdir.hi = flow_tag;
267 if (rxq->dynf_meta) {
268 int32_t offs = rxq->flow_meta_offset;
269 const uint32_t meta =
270 *RTE_MBUF_DYNFIELD(t_pkt, offs, uint32_t *);
272 /* Check if title packet has valid metadata. */
274 MLX5_ASSERT(t_pkt->ol_flags &
275 rxq->flow_meta_mask);
276 *RTE_MBUF_DYNFIELD(elts[pos], offs,
278 *RTE_MBUF_DYNFIELD(elts[pos + 1], offs,
280 *RTE_MBUF_DYNFIELD(elts[pos + 2], offs,
282 *RTE_MBUF_DYNFIELD(elts[pos + 3], offs,
287 pos += MLX5_VPMD_DESCS_PER_LOOP;
288 /* Move to next CQE and invalidate consumed CQEs. */
289 if (!(pos & 0x7) && pos < mcqe_n) {
290 mcq = (void *)&(cq + pos)->pkt_info;
291 for (i = 0; i < 8; ++i)
292 cq[inv++].op_own = MLX5_CQE_INVALIDATE;
296 /* Invalidate the rest of CQEs. */
297 for (; inv < mcqe_n; ++inv)
298 cq[inv].op_own = MLX5_CQE_INVALIDATE;
300 #ifdef MLX5_PMD_SOFT_COUNTERS
301 rxq->stats.ipackets += mcqe_n;
302 rxq->stats.ibytes += rcvd_byte;
305 rxq->cq_ci += mcqe_n;
310 * Calculate packet type and offload flag for mbuf and store it.
313 * Pointer to RX queue structure.
315 * Array of four 16bytes completions extracted from the original completion
318 * Opcode vector having responder error status. Each field is 4B.
320 * Pointer to array of packets to be filled.
323 rxq_cq_to_ptype_oflags_v(struct mlx5_rxq_data *rxq,
324 vector unsigned char cqes[4], vector unsigned char op_err,
325 struct rte_mbuf **pkts)
327 vector unsigned char pinfo0, pinfo1;
328 vector unsigned char pinfo, ptype;
329 vector unsigned char ol_flags = (vector unsigned char)
330 (vector unsigned int){
331 rxq->rss_hash * PKT_RX_RSS_HASH |
332 rxq->hw_timestamp * PKT_RX_TIMESTAMP,
333 rxq->rss_hash * PKT_RX_RSS_HASH |
334 rxq->hw_timestamp * PKT_RX_TIMESTAMP,
335 rxq->rss_hash * PKT_RX_RSS_HASH |
336 rxq->hw_timestamp * PKT_RX_TIMESTAMP,
337 rxq->rss_hash * PKT_RX_RSS_HASH |
338 rxq->hw_timestamp * PKT_RX_TIMESTAMP};
339 vector unsigned char cv_flags;
340 const vector unsigned char zero = (vector unsigned char){0};
341 const vector unsigned char ptype_mask =
342 (vector unsigned char)(vector unsigned int){
343 0x0000fd06, 0x0000fd06, 0x0000fd06, 0x0000fd06};
344 const vector unsigned char ptype_ol_mask =
345 (vector unsigned char)(vector unsigned int){
346 0x00000106, 0x00000106, 0x00000106, 0x00000106};
347 const vector unsigned char pinfo_mask =
348 (vector unsigned char)(vector unsigned int){
349 0x00000003, 0x00000003, 0x00000003, 0x00000003};
350 const vector unsigned char cv_flag_sel = (vector unsigned char){
351 0, (uint8_t)(PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED),
352 (uint8_t)(PKT_RX_IP_CKSUM_GOOD >> 1), 0,
353 (uint8_t)(PKT_RX_L4_CKSUM_GOOD >> 1), 0,
354 (uint8_t)((PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD) >> 1),
355 0, 0, 0, 0, 0, 0, 0, 0, 0};
356 const vector unsigned char cv_mask =
357 (vector unsigned char)(vector unsigned int){
358 PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD |
359 PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED,
360 PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD |
361 PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED,
362 PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD |
363 PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED,
364 PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD |
365 PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED};
366 const vector unsigned char mbuf_init =
367 (vector unsigned char)vec_vsx_ld
368 (0, (vector unsigned char *)&rxq->mbuf_initializer);
369 const vector unsigned short rearm_sel_mask =
370 (vector unsigned short){0, 0, 0, 0, 0xffff, 0xffff, 0, 0};
371 vector unsigned char rearm0, rearm1, rearm2, rearm3;
372 uint8_t pt_idx0, pt_idx1, pt_idx2, pt_idx3;
374 /* Extract pkt_info field. */
375 pinfo0 = (vector unsigned char)
376 vec_mergeh((vector unsigned int)cqes[0],
377 (vector unsigned int)cqes[1]);
378 pinfo1 = (vector unsigned char)
379 vec_mergeh((vector unsigned int)cqes[2],
380 (vector unsigned int)cqes[3]);
381 pinfo = (vector unsigned char)
382 vec_mergeh((vector unsigned long)pinfo0,
383 (vector unsigned long)pinfo1);
385 /* Extract hdr_type_etc field. */
386 pinfo0 = (vector unsigned char)
387 vec_mergel((vector unsigned int)cqes[0],
388 (vector unsigned int)cqes[1]);
389 pinfo1 = (vector unsigned char)
390 vec_mergel((vector unsigned int)cqes[2],
391 (vector unsigned int)cqes[3]);
392 ptype = (vector unsigned char)
393 vec_mergeh((vector unsigned long)pinfo0,
394 (vector unsigned long)pinfo1);
397 const vector unsigned char pinfo_ft_mask =
398 (vector unsigned char)(vector unsigned int){
399 0xffffff00, 0xffffff00, 0xffffff00, 0xffffff00};
400 const vector unsigned char fdir_flags =
401 (vector unsigned char)(vector unsigned int){
402 PKT_RX_FDIR, PKT_RX_FDIR,
403 PKT_RX_FDIR, PKT_RX_FDIR};
404 vector unsigned char fdir_id_flags =
405 (vector unsigned char)(vector unsigned int){
406 PKT_RX_FDIR_ID, PKT_RX_FDIR_ID,
407 PKT_RX_FDIR_ID, PKT_RX_FDIR_ID};
408 vector unsigned char flow_tag, invalid_mask;
410 flow_tag = (vector unsigned char)
411 vec_and((vector unsigned long)pinfo,
412 (vector unsigned long)pinfo_ft_mask);
414 /* Check if flow tag is non-zero then set PKT_RX_FDIR. */
415 invalid_mask = (vector unsigned char)
416 vec_cmpeq((vector unsigned int)flow_tag,
417 (vector unsigned int)zero);
418 ol_flags = (vector unsigned char)
419 vec_or((vector unsigned long)ol_flags,
420 (vector unsigned long)
421 vec_andc((vector unsigned long)fdir_flags,
422 (vector unsigned long)invalid_mask));
424 /* Mask out invalid entries. */
425 fdir_id_flags = (vector unsigned char)
426 vec_andc((vector unsigned long)fdir_id_flags,
427 (vector unsigned long)invalid_mask);
429 /* Check if flow tag MLX5_FLOW_MARK_DEFAULT. */
430 ol_flags = (vector unsigned char)
431 vec_or((vector unsigned long)ol_flags,
432 (vector unsigned long)
433 vec_andc((vector unsigned long)fdir_id_flags,
434 (vector unsigned long)
435 vec_cmpeq((vector unsigned int)flow_tag,
436 (vector unsigned int)pinfo_ft_mask)));
439 * Merge the two fields to generate the following:
443 * bit[11:10] = l3_hdr_type
444 * bit[14:12] = l4_hdr_type
447 * bit[17] = outer_l3_type
449 ptype = (vector unsigned char)
450 vec_and((vector unsigned long)ptype,
451 (vector unsigned long)ptype_mask);
452 pinfo = (vector unsigned char)
453 vec_and((vector unsigned long)pinfo,
454 (vector unsigned long)pinfo_mask);
455 pinfo = (vector unsigned char)
456 vec_sl((vector unsigned int)pinfo,
457 (vector unsigned int){16, 16, 16, 16});
459 /* Make pinfo has merged fields for ol_flags calculation. */
460 pinfo = (vector unsigned char)
461 vec_or((vector unsigned long)ptype,
462 (vector unsigned long)pinfo);
463 ptype = (vector unsigned char)
464 vec_sr((vector unsigned int)pinfo,
465 (vector unsigned int){10, 10, 10, 10});
466 ptype = (vector unsigned char)
467 vec_packs((vector unsigned int)ptype,
468 (vector unsigned int)zero);
470 /* Errored packets will have RTE_PTYPE_ALL_MASK. */
471 op_err = (vector unsigned char)
472 vec_sr((vector unsigned short)op_err,
473 (vector unsigned short){8, 8, 8, 8, 8, 8, 8, 8});
474 ptype = (vector unsigned char)
475 vec_or((vector unsigned long)ptype,
476 (vector unsigned long)op_err);
478 pt_idx0 = (uint8_t)((vector unsigned char)ptype)[0];
479 pt_idx1 = (uint8_t)((vector unsigned char)ptype)[2];
480 pt_idx2 = (uint8_t)((vector unsigned char)ptype)[4];
481 pt_idx3 = (uint8_t)((vector unsigned char)ptype)[6];
483 pkts[0]->packet_type = mlx5_ptype_table[pt_idx0] |
484 !!(pt_idx0 & (1 << 6)) * rxq->tunnel;
485 pkts[1]->packet_type = mlx5_ptype_table[pt_idx1] |
486 !!(pt_idx1 & (1 << 6)) * rxq->tunnel;
487 pkts[2]->packet_type = mlx5_ptype_table[pt_idx2] |
488 !!(pt_idx2 & (1 << 6)) * rxq->tunnel;
489 pkts[3]->packet_type = mlx5_ptype_table[pt_idx3] |
490 !!(pt_idx3 & (1 << 6)) * rxq->tunnel;
492 /* Fill flags for checksum and VLAN. */
493 pinfo = (vector unsigned char)
494 vec_and((vector unsigned long)pinfo,
495 (vector unsigned long)ptype_ol_mask);
496 pinfo = vec_perm(cv_flag_sel, zero, pinfo);
498 /* Locate checksum flags at byte[2:1] and merge with VLAN flags. */
499 cv_flags = (vector unsigned char)
500 vec_sl((vector unsigned int)pinfo,
501 (vector unsigned int){9, 9, 9, 9});
502 cv_flags = (vector unsigned char)
503 vec_or((vector unsigned long)pinfo,
504 (vector unsigned long)cv_flags);
506 /* Move back flags to start from byte[0]. */
507 cv_flags = (vector unsigned char)
508 vec_sr((vector unsigned int)cv_flags,
509 (vector unsigned int){8, 8, 8, 8});
511 /* Mask out garbage bits. */
512 cv_flags = (vector unsigned char)
513 vec_and((vector unsigned long)cv_flags,
514 (vector unsigned long)cv_mask);
516 /* Merge to ol_flags. */
517 ol_flags = (vector unsigned char)
518 vec_or((vector unsigned long)ol_flags,
519 (vector unsigned long)cv_flags);
521 /* Merge mbuf_init and ol_flags. */
522 rearm0 = (vector unsigned char)
523 vec_sel((vector unsigned short)mbuf_init,
524 (vector unsigned short)
525 vec_slo((vector unsigned short)ol_flags,
526 (vector unsigned char){64}), rearm_sel_mask);
527 rearm1 = (vector unsigned char)
528 vec_sel((vector unsigned short)mbuf_init,
529 (vector unsigned short)
530 vec_slo((vector unsigned short)ol_flags,
531 (vector unsigned char){32}), rearm_sel_mask);
532 rearm2 = (vector unsigned char)
533 vec_sel((vector unsigned short)mbuf_init,
534 (vector unsigned short)ol_flags, rearm_sel_mask);
535 rearm3 = (vector unsigned char)
536 vec_sel((vector unsigned short)mbuf_init,
537 (vector unsigned short)
538 vec_sro((vector unsigned short)ol_flags,
539 (vector unsigned char){32}), rearm_sel_mask);
541 /* Write 8B rearm_data and 8B ol_flags. */
542 vec_vsx_st(rearm0, 0,
543 (vector unsigned char *)&pkts[0]->rearm_data);
544 vec_vsx_st(rearm1, 0,
545 (vector unsigned char *)&pkts[1]->rearm_data);
546 vec_vsx_st(rearm2, 0,
547 (vector unsigned char *)&pkts[2]->rearm_data);
548 vec_vsx_st(rearm3, 0,
549 (vector unsigned char *)&pkts[3]->rearm_data);
554 * Receive burst of packets. An errored completion also consumes a mbuf, but the
555 * packet_type is set to be RTE_PTYPE_ALL_MASK. Marked mbufs should be freed
556 * before returning to application.
559 * Pointer to RX queue structure.
561 * Array to store received packets.
563 * Maximum number of packets in array.
565 * Pointer to a flag. Set non-zero value if pkts array has at least one error
569 * Number of packets received including errors (<= pkts_n).
571 static inline uint16_t
572 rxq_burst_v(struct mlx5_rxq_data *rxq, struct rte_mbuf **pkts, uint16_t pkts_n,
575 const uint16_t q_n = 1 << rxq->cqe_n;
576 const uint16_t q_mask = q_n - 1;
577 volatile struct mlx5_cqe *cq;
578 struct rte_mbuf **elts;
582 uint64_t comp_idx = MLX5_VPMD_DESCS_PER_LOOP;
583 uint16_t nocmp_n = 0;
584 uint16_t rcvd_pkt = 0;
585 unsigned int cq_idx = rxq->cq_ci & q_mask;
586 unsigned int elts_idx;
587 unsigned int ownership = !!(rxq->cq_ci & (q_mask + 1));
588 const vector unsigned char zero = (vector unsigned char){0};
589 const vector unsigned char ones = vec_splat_u8(-1);
590 const vector unsigned char owner_check =
591 (vector unsigned char)(vector unsigned long){
592 0x0100000001000000LL, 0x0100000001000000LL};
593 const vector unsigned char opcode_check =
594 (vector unsigned char)(vector unsigned long){
595 0xf0000000f0000000LL, 0xf0000000f0000000LL};
596 const vector unsigned char format_check =
597 (vector unsigned char)(vector unsigned long){
598 0x0c0000000c000000LL, 0x0c0000000c000000LL};
599 const vector unsigned char resp_err_check =
600 (vector unsigned char)(vector unsigned long){
601 0xe0000000e0000000LL, 0xe0000000e0000000LL};
602 #ifdef MLX5_PMD_SOFT_COUNTERS
603 uint32_t rcvd_byte = 0;
604 /* Mask to shuffle byte_cnt to add up stats. Do bswap16 for all. */
605 const vector unsigned char len_shuf_mask = (vector unsigned char){
611 /* Mask to shuffle from extracted CQE to mbuf. */
612 const vector unsigned char shuf_mask = (vector unsigned char){
613 5, 4, /* bswap16, pkt_len */
614 -1, -1, /* zero out 2nd half of pkt_len */
615 5, 4, /* bswap16, data_len */
616 11, 10, /* bswap16, vlan+tci */
617 15, 14, 13, 12, /* bswap32, rss */
618 1, 2, 3, -1}; /* fdir.hi */
619 /* Mask to blend from the last Qword to the first DQword. */
620 /* Mask to blend from the last Qword to the first DQword. */
621 const vector unsigned char blend_mask = (vector unsigned char){
626 const vector unsigned char crc_adj =
627 (vector unsigned char)(vector unsigned short){
628 rxq->crc_present * RTE_ETHER_CRC_LEN, 0,
629 rxq->crc_present * RTE_ETHER_CRC_LEN, 0, 0, 0, 0, 0};
630 const vector unsigned char flow_mark_adj =
631 (vector unsigned char)(vector unsigned int){
632 0, 0, 0, rxq->mark * (-1)};
633 const vector unsigned short cqe_sel_mask1 =
634 (vector unsigned short){0, 0, 0, 0, 0xffff, 0xffff, 0, 0};
635 const vector unsigned short cqe_sel_mask2 =
636 (vector unsigned short){0, 0, 0xffff, 0, 0, 0, 0, 0};
638 MLX5_ASSERT(rxq->sges_n == 0);
639 MLX5_ASSERT(rxq->cqe_n == rxq->elts_n);
640 cq = &(*rxq->cqes)[cq_idx];
642 rte_prefetch0(cq + 1);
643 rte_prefetch0(cq + 2);
644 rte_prefetch0(cq + 3);
645 pkts_n = RTE_MIN(pkts_n, MLX5_VPMD_RX_MAX_BURST);
647 repl_n = q_n - (rxq->rq_ci - rxq->rq_pi);
648 if (repl_n >= rxq->rq_repl_thresh)
649 mlx5_rx_replenish_bulk_mbuf(rxq, repl_n);
650 /* See if there're unreturned mbufs from compressed CQE. */
651 rcvd_pkt = rxq->decompressed;
653 rcvd_pkt = RTE_MIN(rcvd_pkt, pkts_n);
654 rxq_copy_mbuf_v(rxq, pkts, rcvd_pkt);
655 rxq->rq_pi += rcvd_pkt;
656 rxq->decompressed -= rcvd_pkt;
659 elts_idx = rxq->rq_pi & q_mask;
660 elts = &(*rxq->elts)[elts_idx];
661 /* Not to overflow pkts array. */
662 pkts_n = RTE_ALIGN_FLOOR(pkts_n - rcvd_pkt, MLX5_VPMD_DESCS_PER_LOOP);
663 /* Not to cross queue end. */
664 pkts_n = RTE_MIN(pkts_n, q_n - elts_idx);
665 pkts_n = RTE_MIN(pkts_n, q_n - cq_idx);
668 /* At this point, there shouldn't be any remaining packets. */
669 MLX5_ASSERT(rxq->decompressed == 0);
672 * A. load first Qword (8bytes) in one loop.
673 * B. copy 4 mbuf pointers from elts ring to returing pkts.
674 * C. load remaining CQE data and extract necessary fields.
675 * Final 16bytes cqes[] extracted from original 64bytes CQE has the
676 * following structure:
679 * uint8_t flow_tag[3];
683 * uint16_t hdr_type_etc;
684 * uint16_t vlan_info;
685 * uint32_t rx_has_res;
689 * F. find compressed CQE.
693 pos += MLX5_VPMD_DESCS_PER_LOOP) {
694 vector unsigned char cqes[MLX5_VPMD_DESCS_PER_LOOP];
695 vector unsigned char cqe_tmp1, cqe_tmp2;
696 vector unsigned char pkt_mb0, pkt_mb1, pkt_mb2, pkt_mb3;
697 vector unsigned char op_own, op_own_tmp1, op_own_tmp2;
698 vector unsigned char opcode, owner_mask, invalid_mask;
699 vector unsigned char comp_mask;
700 vector unsigned char mask;
701 #ifdef MLX5_PMD_SOFT_COUNTERS
702 const vector unsigned char lower_half = {
703 0, 1, 4, 5, 8, 9, 12, 13,
704 16, 17, 20, 21, 24, 25, 28, 29};
705 const vector unsigned char upper_half = {
706 2, 3, 6, 7, 10, 11, 14, 15,
707 18, 19, 22, 23, 26, 27, 30, 31};
708 const vector unsigned long shmax = {64, 64};
709 vector unsigned char byte_cnt;
710 vector unsigned short left, right;
711 vector unsigned long lshift;
712 vector __attribute__((altivec(bool__)))
713 unsigned long shmask;
715 vector unsigned char mbp1, mbp2;
716 vector unsigned char p =
717 (vector unsigned char)(vector unsigned short){
718 0, 1, 2, 3, 0, 0, 0, 0};
719 unsigned int p1, p2, p3;
721 /* Prefetch next 4 CQEs. */
722 if (pkts_n - pos >= 2 * MLX5_VPMD_DESCS_PER_LOOP) {
723 rte_prefetch0(&cq[pos + MLX5_VPMD_DESCS_PER_LOOP]);
724 rte_prefetch0(&cq[pos + MLX5_VPMD_DESCS_PER_LOOP + 1]);
725 rte_prefetch0(&cq[pos + MLX5_VPMD_DESCS_PER_LOOP + 2]);
726 rte_prefetch0(&cq[pos + MLX5_VPMD_DESCS_PER_LOOP + 3]);
729 /* A.0 do not cross the end of CQ. */
730 mask = (vector unsigned char)(vector unsigned long){
731 (pkts_n - pos) * sizeof(uint16_t) * 8, 0};
734 vector unsigned long lshift;
735 vector __attribute__((altivec(bool__)))
736 unsigned long shmask;
737 const vector unsigned long shmax = {64, 64};
739 lshift = vec_splat((vector unsigned long)mask, 0);
740 shmask = vec_cmpgt(shmax, lshift);
741 mask = (vector unsigned char)
742 vec_sl((vector unsigned long)ones, lshift);
743 mask = (vector unsigned char)
744 vec_sel((vector unsigned long)shmask,
745 (vector unsigned long)mask, shmask);
748 p = (vector unsigned char)
749 vec_andc((vector unsigned long)p,
750 (vector unsigned long)mask);
753 p3 = (unsigned int)((vector unsigned short)p)[3];
754 cqes[3] = (vector unsigned char)(vector unsigned long){
755 *(__rte_aligned(8) unsigned long *)
756 &cq[pos + p3].sop_drop_qpn, 0LL};
757 rte_compiler_barrier();
759 p2 = (unsigned int)((vector unsigned short)p)[2];
760 cqes[2] = (vector unsigned char)(vector unsigned long){
761 *(__rte_aligned(8) unsigned long *)
762 &cq[pos + p2].sop_drop_qpn, 0LL};
763 rte_compiler_barrier();
765 /* B.1 load mbuf pointers. */
766 mbp1 = (vector unsigned char)vec_vsx_ld(0,
767 (signed int const *)&elts[pos]);
768 mbp2 = (vector unsigned char)vec_vsx_ld(0,
769 (signed int const *)&elts[pos + 2]);
771 /* A.1 load a block having op_own. */
772 p1 = (unsigned int)((vector unsigned short)p)[1];
773 cqes[1] = (vector unsigned char)(vector unsigned long){
774 *(__rte_aligned(8) unsigned long *)
775 &cq[pos + p1].sop_drop_qpn, 0LL};
776 rte_compiler_barrier();
778 cqes[0] = (vector unsigned char)(vector unsigned long){
779 *(__rte_aligned(8) unsigned long *)
780 &cq[pos].sop_drop_qpn, 0LL};
781 rte_compiler_barrier();
783 /* B.2 copy mbuf pointers. */
784 *(vector unsigned char *)&pkts[pos] = mbp1;
785 *(vector unsigned char *)&pkts[pos + 2] = mbp2;
788 /* C.1 load remaining CQE data and extract necessary fields. */
789 cqe_tmp2 = *(vector unsigned char *)
790 &cq[pos + p3].pkt_info;
791 cqe_tmp1 = *(vector unsigned char *)
792 &cq[pos + p2].pkt_info;
793 cqes[3] = vec_sel(cqes[3], cqe_tmp2, blend_mask);
794 cqes[2] = vec_sel(cqes[2], cqe_tmp1, blend_mask);
795 cqe_tmp2 = (vector unsigned char)vec_vsx_ld(0,
796 (signed int const *)&cq[pos + p3].csum);
797 cqe_tmp1 = (vector unsigned char)vec_vsx_ld(0,
798 (signed int const *)&cq[pos + p2].csum);
799 cqes[3] = (vector unsigned char)
800 vec_sel((vector unsigned short)cqes[3],
801 (vector unsigned short)cqe_tmp2, cqe_sel_mask1);
802 cqes[2] = (vector unsigned char)
803 vec_sel((vector unsigned short)cqes[2],
804 (vector unsigned short)cqe_tmp1, cqe_sel_mask1);
805 cqe_tmp2 = (vector unsigned char)(vector unsigned long){
806 *(__rte_aligned(8) unsigned long *)
807 &cq[pos + p3].rsvd3[9], 0LL};
808 cqe_tmp1 = (vector unsigned char)(vector unsigned long){
809 *(__rte_aligned(8) unsigned long *)
810 &cq[pos + p2].rsvd3[9], 0LL};
811 cqes[3] = (vector unsigned char)
812 vec_sel((vector unsigned short)cqes[3],
813 (vector unsigned short)cqe_tmp2,
814 (vector unsigned short)cqe_sel_mask2);
815 cqes[2] = (vector unsigned char)
816 vec_sel((vector unsigned short)cqes[2],
817 (vector unsigned short)cqe_tmp1,
818 (vector unsigned short)cqe_sel_mask2);
820 /* C.2 generate final structure for mbuf with swapping bytes. */
821 pkt_mb3 = vec_perm(cqes[3], zero, shuf_mask);
822 pkt_mb2 = vec_perm(cqes[2], zero, shuf_mask);
824 /* C.3 adjust CRC length. */
825 pkt_mb3 = (vector unsigned char)
826 ((vector unsigned short)pkt_mb3 -
827 (vector unsigned short)crc_adj);
828 pkt_mb2 = (vector unsigned char)
829 ((vector unsigned short)pkt_mb2 -
830 (vector unsigned short)crc_adj);
832 /* C.4 adjust flow mark. */
833 pkt_mb3 = (vector unsigned char)
834 ((vector unsigned int)pkt_mb3 +
835 (vector unsigned int)flow_mark_adj);
836 pkt_mb2 = (vector unsigned char)
837 ((vector unsigned int)pkt_mb2 +
838 (vector unsigned int)flow_mark_adj);
840 /* D.1 fill in mbuf - rx_descriptor_fields1. */
841 *(vector unsigned char *)
842 &pkts[pos + 3]->pkt_len = pkt_mb3;
843 *(vector unsigned char *)
844 &pkts[pos + 2]->pkt_len = pkt_mb2;
846 /* E.1 extract op_own field. */
847 op_own_tmp2 = (vector unsigned char)
848 vec_mergeh((vector unsigned int)cqes[2],
849 (vector unsigned int)cqes[3]);
851 /* C.1 load remaining CQE data and extract necessary fields. */
852 cqe_tmp2 = *(vector unsigned char *)
853 &cq[pos + p1].pkt_info;
854 cqe_tmp1 = *(vector unsigned char *)
856 cqes[1] = vec_sel(cqes[1], cqe_tmp2, blend_mask);
857 cqes[0] = vec_sel(cqes[0], cqe_tmp2, blend_mask);
858 cqe_tmp2 = (vector unsigned char)vec_vsx_ld(0,
859 (signed int const *)&cq[pos + p1].csum);
860 cqe_tmp1 = (vector unsigned char)vec_vsx_ld(0,
861 (signed int const *)&cq[pos].csum);
862 cqes[1] = (vector unsigned char)
863 vec_sel((vector unsigned short)cqes[1],
864 (vector unsigned short)cqe_tmp2, cqe_sel_mask1);
865 cqes[0] = (vector unsigned char)
866 vec_sel((vector unsigned short)cqes[0],
867 (vector unsigned short)cqe_tmp1, cqe_sel_mask1);
868 cqe_tmp2 = (vector unsigned char)(vector unsigned long){
869 *(__rte_aligned(8) unsigned long *)
870 &cq[pos + p1].rsvd3[9], 0LL};
871 cqe_tmp1 = (vector unsigned char)(vector unsigned long){
872 *(__rte_aligned(8) unsigned long *)
873 &cq[pos].rsvd3[9], 0LL};
874 cqes[1] = (vector unsigned char)
875 vec_sel((vector unsigned short)cqes[1],
876 (vector unsigned short)cqe_tmp2, cqe_sel_mask2);
877 cqes[0] = (vector unsigned char)
878 vec_sel((vector unsigned short)cqes[0],
879 (vector unsigned short)cqe_tmp1, cqe_sel_mask2);
881 /* C.2 generate final structure for mbuf with swapping bytes. */
882 pkt_mb1 = vec_perm(cqes[1], zero, shuf_mask);
883 pkt_mb0 = vec_perm(cqes[0], zero, shuf_mask);
885 /* C.3 adjust CRC length. */
886 pkt_mb1 = (vector unsigned char)
887 ((vector unsigned short)pkt_mb1 -
888 (vector unsigned short)crc_adj);
889 pkt_mb0 = (vector unsigned char)
890 ((vector unsigned short)pkt_mb0 -
891 (vector unsigned short)crc_adj);
893 /* C.4 adjust flow mark. */
894 pkt_mb1 = (vector unsigned char)
895 ((vector unsigned int)pkt_mb1 +
896 (vector unsigned int)flow_mark_adj);
897 pkt_mb0 = (vector unsigned char)
898 ((vector unsigned int)pkt_mb0 +
899 (vector unsigned int)flow_mark_adj);
901 /* E.1 extract op_own byte. */
902 op_own_tmp1 = (vector unsigned char)
903 vec_mergeh((vector unsigned int)cqes[0],
904 (vector unsigned int)cqes[1]);
905 op_own = (vector unsigned char)
906 vec_mergel((vector unsigned long)op_own_tmp1,
907 (vector unsigned long)op_own_tmp2);
909 /* D.1 fill in mbuf - rx_descriptor_fields1. */
910 *(vector unsigned char *)
911 &pkts[pos + 1]->pkt_len = pkt_mb1;
912 *(vector unsigned char *)
913 &pkts[pos]->pkt_len = pkt_mb0;
915 /* E.2 flip owner bit to mark CQEs from last round. */
916 owner_mask = (vector unsigned char)
917 vec_and((vector unsigned long)op_own,
918 (vector unsigned long)owner_check);
920 owner_mask = (vector unsigned char)
921 vec_xor((vector unsigned long)owner_mask,
922 (vector unsigned long)owner_check);
923 owner_mask = (vector unsigned char)
924 vec_cmpeq((vector unsigned int)owner_mask,
925 (vector unsigned int)owner_check);
926 owner_mask = (vector unsigned char)
927 vec_packs((vector unsigned int)owner_mask,
928 (vector unsigned int)zero);
930 /* E.3 get mask for invalidated CQEs. */
931 opcode = (vector unsigned char)
932 vec_and((vector unsigned long)op_own,
933 (vector unsigned long)opcode_check);
934 invalid_mask = (vector unsigned char)
935 vec_cmpeq((vector unsigned int)opcode_check,
936 (vector unsigned int)opcode);
937 invalid_mask = (vector unsigned char)
938 vec_packs((vector unsigned int)invalid_mask,
939 (vector unsigned int)zero);
941 /* E.4 mask out beyond boundary. */
942 invalid_mask = (vector unsigned char)
943 vec_or((vector unsigned long)invalid_mask,
944 (vector unsigned long)mask);
946 /* E.5 merge invalid_mask with invalid owner. */
947 invalid_mask = (vector unsigned char)
948 vec_or((vector unsigned long)invalid_mask,
949 (vector unsigned long)owner_mask);
951 /* F.1 find compressed CQE format. */
952 comp_mask = (vector unsigned char)
953 vec_and((vector unsigned long)op_own,
954 (vector unsigned long)format_check);
955 comp_mask = (vector unsigned char)
956 vec_cmpeq((vector unsigned int)comp_mask,
957 (vector unsigned int)format_check);
958 comp_mask = (vector unsigned char)
959 vec_packs((vector unsigned int)comp_mask,
960 (vector unsigned int)zero);
962 /* F.2 mask out invalid entries. */
963 comp_mask = (vector unsigned char)
964 vec_andc((vector unsigned long)comp_mask,
965 (vector unsigned long)invalid_mask);
966 comp_idx = ((vector unsigned long)comp_mask)[0];
968 /* F.3 get the first compressed CQE. */
969 comp_idx = comp_idx ? __builtin_ctzll(comp_idx) /
970 (sizeof(uint16_t) * 8) : MLX5_VPMD_DESCS_PER_LOOP;
972 /* E.6 mask out entries after the compressed CQE. */
973 mask = (vector unsigned char)(vector unsigned long){
974 (comp_idx * sizeof(uint16_t) * 8), 0};
975 lshift = vec_splat((vector unsigned long)mask, 0);
976 shmask = vec_cmpgt(shmax, lshift);
977 mask = (vector unsigned char)
978 vec_sl((vector unsigned long)ones, lshift);
979 mask = (vector unsigned char)
980 vec_sel((vector unsigned long)shmask,
981 (vector unsigned long)mask, shmask);
982 invalid_mask = (vector unsigned char)
983 vec_or((vector unsigned long)invalid_mask,
984 (vector unsigned long)mask);
986 /* E.7 count non-compressed valid CQEs. */
987 n = ((vector unsigned long)invalid_mask)[0];
988 n = n ? __builtin_ctzll(n) / (sizeof(uint16_t) * 8) :
989 MLX5_VPMD_DESCS_PER_LOOP;
992 /* D.2 get the final invalid mask. */
993 mask = (vector unsigned char)(vector unsigned long){
994 (n * sizeof(uint16_t) * 8), 0};
995 lshift = vec_splat((vector unsigned long)mask, 0);
996 shmask = vec_cmpgt(shmax, lshift);
997 mask = (vector unsigned char)
998 vec_sl((vector unsigned long)ones, lshift);
999 mask = (vector unsigned char)
1000 vec_sel((vector unsigned long)shmask,
1001 (vector unsigned long)mask, shmask);
1002 invalid_mask = (vector unsigned char)
1003 vec_or((vector unsigned long)invalid_mask,
1004 (vector unsigned long)mask);
1006 /* D.3 check error in opcode. */
1007 opcode = (vector unsigned char)
1008 vec_cmpeq((vector unsigned int)resp_err_check,
1009 (vector unsigned int)opcode);
1010 opcode = (vector unsigned char)
1011 vec_packs((vector unsigned int)opcode,
1012 (vector unsigned int)zero);
1013 opcode = (vector unsigned char)
1014 vec_andc((vector unsigned long)opcode,
1015 (vector unsigned long)invalid_mask);
1017 /* D.4 mark if any error is set */
1018 *err |= ((vector unsigned long)opcode)[0];
1020 /* D.5 fill in mbuf - rearm_data and packet_type. */
1021 rxq_cq_to_ptype_oflags_v(rxq, cqes, opcode, &pkts[pos]);
1022 if (rxq->hw_timestamp) {
1023 pkts[pos]->timestamp =
1024 rte_be_to_cpu_64(cq[pos].timestamp);
1025 pkts[pos + 1]->timestamp =
1026 rte_be_to_cpu_64(cq[pos + p1].timestamp);
1027 pkts[pos + 2]->timestamp =
1028 rte_be_to_cpu_64(cq[pos + p2].timestamp);
1029 pkts[pos + 3]->timestamp =
1030 rte_be_to_cpu_64(cq[pos + p3].timestamp);
1032 if (rxq->dynf_meta) {
1033 uint64_t flag = rxq->flow_meta_mask;
1034 int32_t offs = rxq->flow_meta_offset;
1037 /* This code is subject for futher optimization. */
1038 metadata = cq[pos].flow_table_metadata;
1039 *RTE_MBUF_DYNFIELD(pkts[pos], offs, uint32_t *) =
1041 pkts[pos]->ol_flags |= metadata ? flag : 0ULL;
1042 metadata = cq[pos + 1].flow_table_metadata;
1043 *RTE_MBUF_DYNFIELD(pkts[pos + 1], offs, uint32_t *) =
1045 pkts[pos + 1]->ol_flags |= metadata ? flag : 0ULL;
1046 metadata = cq[pos + 2].flow_table_metadata;
1047 *RTE_MBUF_DYNFIELD(pkts[pos + 2], offs, uint32_t *) =
1049 pkts[pos + 2]->ol_flags |= metadata ? flag : 0ULL;
1050 metadata = cq[pos + 3].flow_table_metadata;
1051 *RTE_MBUF_DYNFIELD(pkts[pos + 3], offs, uint32_t *) =
1053 pkts[pos + 3]->ol_flags |= metadata ? flag : 0ULL;
1055 #ifdef MLX5_PMD_SOFT_COUNTERS
1056 /* Add up received bytes count. */
1057 byte_cnt = vec_perm(op_own, zero, len_shuf_mask);
1058 byte_cnt = (vector unsigned char)
1059 vec_andc((vector unsigned long)byte_cnt,
1060 (vector unsigned long)invalid_mask);
1061 left = vec_perm((vector unsigned short)byte_cnt,
1062 (vector unsigned short)zero, lower_half);
1063 right = vec_perm((vector unsigned short)byte_cnt,
1064 (vector unsigned short)zero, upper_half);
1065 byte_cnt = (vector unsigned char)vec_add(left, right);
1066 left = vec_perm((vector unsigned short)byte_cnt,
1067 (vector unsigned short)zero, lower_half);
1068 right = vec_perm((vector unsigned short)byte_cnt,
1069 (vector unsigned short)zero, upper_half);
1070 byte_cnt = (vector unsigned char)vec_add(left, right);
1071 rcvd_byte += ((vector unsigned long)byte_cnt)[0];
1075 * Break the loop unless more valid CQE is expected, or if
1076 * there's a compressed CQE.
1078 if (n != MLX5_VPMD_DESCS_PER_LOOP)
1081 /* If no new CQE seen, return without updating cq_db. */
1082 if (unlikely(!nocmp_n && comp_idx == MLX5_VPMD_DESCS_PER_LOOP))
1084 /* Update the consumer indexes for non-compressed CQEs. */
1085 MLX5_ASSERT(nocmp_n <= pkts_n);
1086 rxq->cq_ci += nocmp_n;
1087 rxq->rq_pi += nocmp_n;
1088 rcvd_pkt += nocmp_n;
1089 #ifdef MLX5_PMD_SOFT_COUNTERS
1090 rxq->stats.ipackets += nocmp_n;
1091 rxq->stats.ibytes += rcvd_byte;
1093 /* Decompress the last CQE if compressed. */
1094 if (comp_idx < MLX5_VPMD_DESCS_PER_LOOP && comp_idx == n) {
1095 MLX5_ASSERT(comp_idx == (nocmp_n % MLX5_VPMD_DESCS_PER_LOOP));
1097 rxq_cq_decompress_v(rxq, &cq[nocmp_n], &elts[nocmp_n]);
1098 /* Return more packets if needed. */
1099 if (nocmp_n < pkts_n) {
1100 uint16_t n = rxq->decompressed;
1102 n = RTE_MIN(n, pkts_n - nocmp_n);
1103 rxq_copy_mbuf_v(rxq, &pkts[nocmp_n], n);
1106 rxq->decompressed -= n;
1109 rte_compiler_barrier();
1110 *rxq->cq_db = rte_cpu_to_be_32(rxq->cq_ci);
1114 #endif /* RTE_PMD_MLX5_RXTX_VEC_ALTIVEC_H_ */