From mboxrd@z Thu Jan 1 00:00:00 1970
Return-Path:
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
by inbox.dpdk.org (Postfix) with ESMTP id 70AEF426D6;
Sat, 7 Oct 2023 05:37:34 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
by mails.dpdk.org (Postfix) with ESMTP id 133D0402BF;
Sat, 7 Oct 2023 05:37:34 +0200 (CEST)
Received: from inbox.dpdk.org (inbox.dpdk.org [95.142.172.178])
by mails.dpdk.org (Postfix) with ESMTP id B91E9402A7
for ; Sat, 7 Oct 2023 05:37:32 +0200 (CEST)
Received: by inbox.dpdk.org (Postfix, from userid 33)
id 93E46426D8; Sat, 7 Oct 2023 05:37:32 +0200 (CEST)
From: bugzilla@dpdk.org
To: dev@dpdk.org
Subject: [Bug 1295] Virtio driver, packed mode, the first desc misses the
next flag, causing the message to be sent abnormally
Date: Sat, 07 Oct 2023 03:37:32 +0000
X-Bugzilla-Reason: AssignedTo
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: DPDK
X-Bugzilla-Component: vhost/virtio
X-Bugzilla-Version: 23.07
X-Bugzilla-Keywords:
X-Bugzilla-Severity: major
X-Bugzilla-Who: fengjiang_liu@163.com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: Normal
X-Bugzilla-Assigned-To: dev@dpdk.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform
op_sys bug_status bug_severity priority component assigned_to reporter
target_milestone
Message-ID:
Content-Type: multipart/alternative; boundary=16966498520.0E2a2C.1502694
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://bugs.dpdk.org/
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All
MIME-Version: 1.0
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: dev-bounces@dpdk.org
--16966498520.0E2a2C.1502694
Date: Sat, 7 Oct 2023 05:37:32 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://bugs.dpdk.org/
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All
https://bugs.dpdk.org/show_bug.cgi?id=3D1295
Bug ID: 1295
Summary: Virtio driver, packed mode, the first desc misses the
next flag, causing the message to be sent abnormally
Product: DPDK
Version: 23.07
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: major
Priority: Normal
Component: vhost/virtio
Assignee: dev@dpdk.org
Reporter: fengjiang_liu@163.com
Target Milestone: ---
In the virtio_xmit_pkts_packed sending interface, when the virio header and=
pkt
payload are added in two descs, the desc of the virtio-header is missing
VRING_DESC_F_NEXT flag, resulting in the virio header and pkt payload being
considered to be two pkts, resulting in an exception.
static inline void
virtqueue_enqueue_xmit_packed(struct virtnet_tx *txvq, struct rte_mbuf *coo=
kie,
uint16_t needed, int use_indirect, int can_pu=
sh,
int in_order)
{
struct virtio_tx_region *txr =3D txvq->hdr_mz->addr;
struct vq_desc_extra *dxp;
struct virtqueue *vq =3D virtnet_txq_to_vq(txvq);
struct vring_packed_desc *start_dp, *head_dp;
uint16_t idx, id, head_idx, head_flags;
int16_t head_size =3D vq->hw->vtnet_hdr_size;
struct virtio_net_hdr *hdr;
uint16_t prev;
bool prepend_header =3D false;
uint16_t seg_num =3D cookie->nb_segs;
id =3D in_order ? vq->vq_avail_idx : vq->vq_desc_head_idx;
dxp =3D &vq->vq_descx[id];
dxp->ndescs =3D needed;
dxp->cookie =3D cookie;
head_idx =3D vq->vq_avail_idx;
idx =3D head_idx;
prev =3D head_idx;
start_dp =3D vq->vq_packed.ring.desc;
head_dp =3D &vq->vq_packed.ring.desc[idx];
head_flags =3D cookie->next ? VRING_DESC_F_NEXT : 0;
=3D=3D=3D=3D>branch1=EF=BC=9A mbuf is not buffer-list, next =3D=3D =
NULL, so No next flag
set=20
head_flags |=3D vq->vq_packed.cached_flags;
if (can_push) {
/* prepend cannot fail, checked by caller */
hdr =3D rte_pktmbuf_mtod_offset(cookie, struct virtio_net_h=
dr *,
-head_size);
prepend_header =3D true;
/* if offload disabled, it is not zeroed below, do it now */
if (!vq->hw->has_tx_offload)
virtqueue_clear_net_hdr(hdr);
} else if (use_indirect) {
/* setup tx ring slot to point to indirect
* descriptor list stored in reserved region.
*
* the first slot in indirect ring is already preset
* to point to the header in reserved region
*/
start_dp[idx].addr =3D txvq->hdr_mem +
RTE_PTR_DIFF(&txr[idx].tx_packed_indir, txr);
start_dp[idx].len =3D (seg_num + 1) * sizeof(struct
vring_packed_desc);
/* Packed descriptor id needs to be restored when inorder. =
*/
if (in_order)
start_dp[idx].id =3D idx;
/* reset flags for indirect desc */
head_flags =3D VRING_DESC_F_INDIRECT;
head_flags |=3D vq->vq_packed.cached_flags;
hdr =3D (struct virtio_net_hdr *)&txr[idx].tx_hdr;
/* loop below will fill in rest of the indirect elements */
start_dp =3D txr[idx].tx_packed_indir;
idx =3D 1;
} else {
/* setup first tx ring slot to point to header
* stored in reserved region.
*/
start_dp[idx].addr =3D txvq->hdr_mem +
RTE_PTR_DIFF(&txr[idx].tx_hdr, txr);
start_dp[idx].len =3D vq->hw->vtnet_hdr_size;
hdr =3D (struct virtio_net_hdr *)&txr[idx].tx_hdr;
=3D=3D=3D=3D>branch2=EF=BC=9A Add virtio header desc, no ne=
xt flag set
idx++;
if (idx >=3D vq->vq_nentries) {
idx -=3D vq->vq_nentries;
vq->vq_packed.cached_flags ^=3D
VRING_PACKED_DESC_F_AVAIL_USED;
}
}
if (vq->hw->has_tx_offload)
virtqueue_xmit_offload(hdr, cookie);
do {
uint16_t flags;
start_dp[idx].addr =3D VIRTIO_MBUF_DATA_DMA_ADDR(cookie, vq=
);
start_dp[idx].len =3D cookie->data_len;
if (prepend_header) {
start_dp[idx].addr -=3D head_size;
start_dp[idx].len +=3D head_size;
prepend_header =3D false;
}
if (likely(idx !=3D head_idx)) {
flags =3D cookie->next ? VRING_DESC_F_NEXT : 0;
flags |=3D vq->vq_packed.cached_flags;
start_dp[idx].flags =3D flags;
}
prev =3D idx;
idx++;
if (idx >=3D vq->vq_nentries) {
idx -=3D vq->vq_nentries;
vq->vq_packed.cached_flags ^=3D
VRING_PACKED_DESC_F_AVAIL_USED;
}
} while ((cookie =3D cookie->next) !=3D NULL);
start_dp[prev].id =3D id;
if (use_indirect) {
idx =3D head_idx;
if (++idx >=3D vq->vq_nentries) {
idx -=3D vq->vq_nentries;
vq->vq_packed.cached_flags ^=3D
VRING_PACKED_DESC_F_AVAIL_USED;
}
}
vq->vq_free_cnt =3D (uint16_t)(vq->vq_free_cnt - needed);
vq->vq_avail_idx =3D idx;
if (!in_order) {
vq->vq_desc_head_idx =3D dxp->next;
if (vq->vq_desc_head_idx =3D=3D VQ_RING_DESC_CHAIN_END)
vq->vq_desc_tail_idx =3D VQ_RING_DESC_CHAIN_END;
}
=3D=3D=3D=E3=80=8Bhead_flags =EF=BC=9Ano next flag set
virtqueue_store_flags_packed(head_dp, head_flags,
vq->hw->weak_barriers);
}
--=20
You are receiving this mail because:
You are the assignee for the bug.=
--16966498520.0E2a2C.1502694
Date: Sat, 7 Oct 2023 05:37:32 +0200
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://bugs.dpdk.org/
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All