Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright(c) 2010-2015 Intel Corporation 3 : : */ 4 : : 5 : : #include <stdint.h> 6 : : #include <stdio.h> 7 : : #include <stdlib.h> 8 : : #include <string.h> 9 : : #include <errno.h> 10 : : 11 : : #include <rte_cycles.h> 12 : : #include <rte_memory.h> 13 : : #include <rte_branch_prediction.h> 14 : : #include <rte_mempool.h> 15 : : #include <rte_malloc.h> 16 : : #include <rte_mbuf.h> 17 : : #include <rte_ether.h> 18 : : #include <ethdev_driver.h> 19 : : #include <rte_prefetch.h> 20 : : #include <rte_string_fns.h> 21 : : #include <rte_errno.h> 22 : : #include <rte_byteorder.h> 23 : : 24 : : #include "virtio_rxtx_simple.h" 25 : : 26 : : #ifndef __INTEL_COMPILER 27 : : #pragma GCC diagnostic ignored "-Wcast-qual" 28 : : #endif 29 : : 30 : : int __rte_cold 31 : 0 : virtio_rxq_vec_setup(struct virtnet_rx *rxq) 32 : : { 33 : 0 : struct virtqueue *vq = virtnet_rxq_to_vq(rxq); 34 : : uintptr_t p; 35 : 0 : struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */ 36 : : 37 : 0 : mb_def.nb_segs = 1; 38 : 0 : mb_def.data_off = RTE_PKTMBUF_HEADROOM; 39 : 0 : mb_def.port = vq->hw->port_id; 40 : : rte_mbuf_refcnt_set(&mb_def, 1); 41 : : 42 : : /* prevent compiler reordering: rearm_data covers previous fields */ 43 : 0 : rte_compiler_barrier(); 44 : : p = (uintptr_t)&mb_def.rearm_data; 45 : 0 : rxq->mbuf_initializer = *(uint64_t *)p; 46 : : 47 : 0 : return 0; 48 : : } 49 : : 50 : : /* Stub for linkage when arch specific implementation is not available */ 51 : : __rte_weak uint16_t 52 : 0 : virtio_recv_pkts_vec(void *rx_queue __rte_unused, 53 : : struct rte_mbuf **rx_pkts __rte_unused, 54 : : uint16_t nb_pkts __rte_unused) 55 : : { 56 : 0 : rte_panic("Wrong weak function linked by linker\n"); 57 : : return 0; 58 : : }