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 : : int __rte_cold 27 : 0 : virtio_rxq_vec_setup(struct virtnet_rx *rxq) 28 : : { 29 : 0 : struct virtqueue *vq = virtnet_rxq_to_vq(rxq); 30 : : uintptr_t p; 31 : 0 : struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */ 32 : : 33 : 0 : mb_def.nb_segs = 1; 34 : 0 : mb_def.data_off = RTE_PKTMBUF_HEADROOM; 35 : 0 : mb_def.port = vq->hw->port_id; 36 : : rte_mbuf_refcnt_set(&mb_def, 1); 37 : : 38 : : /* prevent compiler reordering: rearm_data covers previous fields */ 39 : 0 : rte_compiler_barrier(); 40 : : p = (uintptr_t)&mb_def.rearm_data; 41 : 0 : rxq->mbuf_initializer = *(uint64_t *)p; 42 : : 43 : 0 : return 0; 44 : : } 45 : : 46 : : /* Stub for linkage when arch specific implementation is not available */ 47 : : __rte_weak uint16_t 48 : 0 : virtio_recv_pkts_vec(void *rx_queue __rte_unused, 49 : : struct rte_mbuf **rx_pkts __rte_unused, 50 : : uint16_t nb_pkts __rte_unused) 51 : : { 52 : 0 : rte_panic("Wrong weak function linked by linker\n"); 53 : : return 0; 54 : : }