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 401B9A00C4; Thu, 20 Jan 2022 06:08:20 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A0F44411B6; Thu, 20 Jan 2022 06:08:19 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 09BFB40042; Thu, 20 Jan 2022 06:08:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642655298; x=1674191298; h=from:to:cc:subject:date:message-id; bh=+3gxfVU7vGCmaUjTgGvxoO+tPJ6d6OK1eWecfN45IOU=; b=fAjyjcAhaH2eKW5QBq9uTWV1LojSLDTc0J9N9FUnEDLkWx7pB6IMhoG4 MkG8TEybdKVU9B4TVtRKz3e7VdM07El56QFEwZGsOvv1p3+rKuROYTfZ2 SruKA3pqKD+dxATuJO0oJdy/E8CEdgok48vCRlPiGm4RJJfr50aiVjCs7 EJg4gShF/bk01M09XER/kY1aHYE9v7xJYYnc0ELdf4x6NtO2BYiGx4YKX dMMZ2UfUMJVdC5PvAgo8rHI2knHzbH+RMJqwWGTY01vHEEOdwFCPav2mY b5O2vYYIjVM3hpuY6FNDIhGPBS+DZGpFD3fjZKknqF6lvsTjtagr4yH/n Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10232"; a="245066258" X-IronPort-AV: E=Sophos;i="5.88,301,1635231600"; d="scan'208";a="245066258" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2022 21:08:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,301,1635231600"; d="scan'208";a="477660970" Received: from no.sh.intel.com ([10.67.119.11]) by orsmga006.jf.intel.com with ESMTP; 19 Jan 2022 21:08:15 -0800 From: Marvin Liu To: maxime.coquelin@redhat.com, chenbo.xia@intel.com Cc: dev@dpdk.org, Marvin Liu , stable@dpdk.org Subject: [PATCH] net/virtio: fix incorrect slots number when indirect feature on Date: Thu, 20 Jan 2022 20:22:18 +0800 Message-Id: <20220120122218.25027-1-yong.liu@intel.com> X-Mailer: git-send-email 2.17.1 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 Virtio driver only occupies one slot for enqueuing chained mbufs when indirect feature is on. Required slots calculation should depend on indirect feature status at the end. Fixes: 0eaf7fc2fe8e ("net/virtio: separate AVX Rx/Tx") Cc: stable@dpdk.org Signed-off-by: Marvin Liu diff --git a/drivers/net/virtio/virtio_rxtx_packed.h b/drivers/net/virtio/virtio_rxtx_packed.h index d5c259a1f6..536112983c 100644 --- a/drivers/net/virtio/virtio_rxtx_packed.h +++ b/drivers/net/virtio/virtio_rxtx_packed.h @@ -125,13 +125,12 @@ virtqueue_enqueue_single_packed_vec(struct virtnet_tx *txvq, * any_layout => number of segments * default => number of segments + 1 */ - slots = use_indirect ? 1 : (txm->nb_segs + !can_push); can_push = rte_mbuf_refcnt_read(txm) == 1 && RTE_MBUF_DIRECT(txm) && txm->nb_segs == 1 && rte_pktmbuf_headroom(txm) >= hdr_size; - slots = txm->nb_segs + !can_push; + slots = use_indirect ? 1 : (txm->nb_segs + !can_push); need = slots - vq->vq_free_cnt; /* Positive value indicates it need free vring descriptors */ -- 2.17.1