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 BBA55A04DB for ; Thu, 15 Oct 2020 12:48:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AC2EA1DEC0; Thu, 15 Oct 2020 12:48:56 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by dpdk.org (Postfix) with ESMTP id 814241DE78 for ; Thu, 15 Oct 2020 12:48:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602758933; 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=86rluX1+25Z8qtfwnj15MAFM+9hZQzXP+e6+Gm/9KtI=; b=Pz2d92RA95f6IRCo/2MgePKM+UZiNrGxXBrnA0WvYb1Jyuzu4w1Ki5swsg3C/ZJyvo85EX WwHKszcpXuicMG6LLSM/DFsBDIAwEesqJrvvCULiJyw9IC5scuRcMfiPmMu7Z0D8GFTc7f NQLpfB1mqcBjuBfvTDa6E8GMH/yLwqs= 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-209-jHG3DzmlO82dnMm1Hamw1g-1; Thu, 15 Oct 2020 06:48:51 -0400 X-MC-Unique: jHG3DzmlO82dnMm1Hamw1g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 746F38797F6; Thu, 15 Oct 2020 10:48:49 +0000 (UTC) Received: from [10.36.110.38] (unknown [10.36.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9FE5276666; Thu, 15 Oct 2020 10:48:47 +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: <98f13f5d-880c-7413-c112-92dbe7b198db@redhat.com> Date: Thu, 15 Oct 2020 12:48:44 +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.11 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; > Reviewed-by: Maxime Coquelin Thanks, Maxime