MCPcopy Create free account
hub / github.com/F-Stack/f-stack / virtqueue_dequeue_burst_rx_packed

Function virtqueue_dequeue_burst_rx_packed

dpdk/drivers/net/virtio/virtio_rxtx.c:125–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123}
124
125static uint16_t
126virtqueue_dequeue_burst_rx_packed(struct virtqueue *vq,
127 struct rte_mbuf **rx_pkts,
128 uint32_t *len,
129 uint16_t num)
130{
131 struct rte_mbuf *cookie;
132 uint16_t used_idx;
133 uint16_t id;
134 struct vring_packed_desc *desc;
135 uint16_t i;
136
137 desc = vq->vq_packed.ring.desc;
138
139 for (i = 0; i < num; i++) {
140 used_idx = vq->vq_used_cons_idx;
141 /* desc_is_used has a load-acquire or rte_io_rmb inside
142 * and wait for used desc in virtqueue.
143 */
144 if (!desc_is_used(&desc[used_idx], vq))
145 return i;
146 len[i] = desc[used_idx].len;
147 id = desc[used_idx].id;
148 cookie = (struct rte_mbuf *)vq->vq_descx[id].cookie;
149 if (unlikely(cookie == NULL)) {
150 PMD_DRV_LOG(ERR, "vring descriptor with no mbuf cookie at %u",
151 vq->vq_used_cons_idx);
152 break;
153 }
154 rte_prefetch0(cookie);
155 rte_packet_prefetch(rte_pktmbuf_mtod(cookie, void *));
156 rx_pkts[i] = cookie;
157
158 vq->vq_free_cnt++;
159 vq->vq_used_cons_idx++;
160 if (vq->vq_used_cons_idx >= vq->vq_nentries) {
161 vq->vq_used_cons_idx -= vq->vq_nentries;
162 vq->vq_packed.used_wrap_counter ^= 1;
163 }
164 }
165
166 return i;
167}
168
169static uint16_t
170virtqueue_dequeue_burst_rx(struct virtqueue *vq, struct rte_mbuf **rx_pkts,

Callers 2

virtio_recv_pkts_packedFunction · 0.85

Calls 2

desc_is_usedFunction · 0.85
rte_prefetch0Function · 0.50

Tested by

no test coverage detected