Skip to content

Commit 694aed7

Browse files
Akhil Goyaljerinjacobk
authored andcommitted
lib/virtio: change flags to match specification
Update flags to match specification. Also change the value as an offset in flags instead of it being an offset in second 64 bit of VirtIO descriptor. Signed-off-by: Akhil Goyal <gakhil@marvell.com> Signed-off-by: Anoob Joseph <anoobj@marvell.com> Change-Id: I768d0473eb98dd6524bad2b996cd93950bf42341 Reviewed-on: https://sj1git1.cavium.com/c/IP/SW/dataplane/dpu-offload/+/140842 Tested-by: sa_ip-toolkits-Jenkins <sa_ip-toolkits-jenkins@marvell.com> Reviewed-by: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>
1 parent f86c6b1 commit 694aed7

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

lib/virtio/spec/virtio.h

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,20 @@
1717
#define VIRTIO_F_NOTIFICATION_DATA 38
1818

1919
/** This marks a buffer as continuing via the next field. */
20-
#define VRING_DESC_F_NEXT 48
20+
#define VRING_DESC_F_NEXT 1
2121
/** This marks a buffer as write-only (otherwise read-only). */
22-
#define VRING_DESC_F_WRITE 50
22+
#define VRING_DESC_F_WRITE 2
2323
/** This means the buffer contains a list of buffer descriptors. */
24-
#define VRING_DESC_F_INDIRECT 52
25-
/** This flag means the descriptor was made available by the driver */
26-
#define VIRT_PACKED_RING_DESC_F_AVAIL (1UL << 55)
27-
/** This flag means the descriptor was used by the device */
28-
#define VIRT_PACKED_RING_DESC_F_USED (1UL << 63)
24+
#define VRING_DESC_F_INDIRECT 4
25+
26+
/* This flag means the descriptor was made available by the driver */
27+
#define VRING_PACKED_DESC_F_AVAIL (1UL << 7)
28+
/* This flag means the descriptor was used by the device */
29+
#define VRING_PACKED_DESC_F_USED (1UL << 15)
30+
31+
/* Flags to be used when working with second uint64_t in the VirtIO descriptor. */
32+
#define VIRT_PACKED_RING_DESC_F_AVAIL (VRING_PACKED_DESC_F_AVAIL << 48)
33+
#define VIRT_PACKED_RING_DESC_F_USED (VRING_PACKED_DESC_F_USED << 48)
2934
#define VIRT_PACKED_RING_DESC_F_AVAIL_USED \
3035
(VIRT_PACKED_RING_DESC_F_AVAIL | VIRT_PACKED_RING_DESC_F_USED)
3136

lib/virtio_net/virtio_net_deq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,15 @@ post_process_pkts(struct virtio_net_queue *q, struct rte_mbuf **d_mbufs, uint16_
204204
rte_prefetch0((uint8_t *)mbuf_arr[last_off + 1] + data_off);
205205
mbuf0 = mbuf_arr[last_off];
206206

207-
dflags = (*DESC_PTR_OFF(desc_base, last_off, 8) >> VRING_DESC_F_NEXT) & 0x1;
207+
dflags = (*DESC_PTR_OFF(desc_base, last_off, 8) >> 48) & VRING_DESC_F_NEXT;
208208

209209
mbuf1 = mbuf0;
210210
off = last_off;
211211

212212
/* Calculate additional segments required for mbuf-chain */
213213
while (unlikely(dflags)) {
214214
off = (off + 1) & (q_sz - 1);
215-
dflags = (*DESC_PTR_OFF(desc_base, off, 8) >> VRING_DESC_F_NEXT) & 0x1;
215+
dflags = (*DESC_PTR_OFF(desc_base, off, 8) >> 48) & VRING_DESC_F_NEXT;
216216
segs++;
217217
}
218218

0 commit comments

Comments
 (0)