From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3AA01A04DB for ; Thu, 15 Oct 2020 17:40:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2F7ED1EB49; Thu, 15 Oct 2020 17:40:42 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by dpdk.org (Postfix) with ESMTP id A42401EB49 for ; Thu, 15 Oct 2020 17:40:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602776439; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mx1hh6SnneRoN4G2amKLz7SdgJywf3xEroZHLlf1geQ=; b=O1tQFiBoSnZcoP/b1qCFERxySl0O/Ha/LNN4W23/nY8/h8PDcKcZ8nIT672E3pJ2leoqAx SEiNs9JNJ2CXR0rJ4D+bkQY8ApZGX7kZW+iTvjcnJuVWB0ZmffNPOJ+EjWdfCHbuJZwisS 7JyQ6UzN11hGRsuZrtM66R6Rm0VhRdA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-84-Fb_kw8BKOumze_6s52vEhw-1; Thu, 15 Oct 2020 11:40:37 -0400 X-MC-Unique: Fb_kw8BKOumze_6s52vEhw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 12FFB803F48; Thu, 15 Oct 2020 15:40:36 +0000 (UTC) Received: from [10.36.110.38] (unknown [10.36.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9C0125C1BD; Thu, 15 Oct 2020 15:40:34 +0000 (UTC) To: Marvin Liu , chenbo.xia@intel.com, zhihong.wang@intel.com Cc: dev@dpdk.org, stable@dpdk.org References: <20201015054607.57325-1-yong.liu@intel.com> From: Maxime Coquelin Message-ID: <95d7daa6-0579-1cb4-0d0b-fad2fcd28484@redhat.com> Date: Thu, 15 Oct 2020 17:40:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <20201015054607.57325-1-yong.liu@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-stable] [PATCH] net/virtio: fix invalid indirect desc length X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On 10/15/20 7:46 AM, Marvin Liu wrote: > When transmitting indirect descriptors, first desc will store net_hdr > and following descs will be mapped to mbuf segments. Total desc number > will be seg_num plus one. Meaning of variable needed is the number of > used descs in packed ring. This value will always be two for indirect > desc. Now use mbuf segments number for calculating correct desc length. > > Fixes: de8b3d238074 ("net/virtio: fix indirect descs in packed datapaths") > Cc: stable@dpdk.org > > Signed-off-by: Marvin Liu > > diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h > index 8c8ab9889..42c4c9882 100644 > --- a/drivers/net/virtio/virtqueue.h > +++ b/drivers/net/virtio/virtqueue.h > @@ -698,6 +698,7 @@ virtqueue_enqueue_xmit_packed(struct virtnet_tx *txvq, struct rte_mbuf *cookie, > struct virtio_net_hdr *hdr; > uint16_t prev; > bool prepend_header = false; > + uint16_t seg_num = cookie->nb_segs; > > id = in_order ? vq->vq_avail_idx : vq->vq_desc_head_idx; > > @@ -732,7 +733,7 @@ virtqueue_enqueue_xmit_packed(struct virtnet_tx *txvq, struct rte_mbuf *cookie, > */ > start_dp[idx].addr = txvq->virtio_net_hdr_mem + > RTE_PTR_DIFF(&txr[idx].tx_packed_indir, txr); > - start_dp[idx].len = (needed + 1) * > + start_dp[idx].len = (seg_num + 1) * > sizeof(struct vring_packed_desc); > /* reset flags for indirect desc */ > head_flags = VRING_DESC_F_INDIRECT; > Applied to dpdk-next-virtio/main. Thanks, Maxime