From patchwork Wed Jan 4 02:39:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ma, WenwuX" X-Patchwork-Id: 121538 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D5395A00C2; Wed, 4 Jan 2023 03:43:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A39C340698; Wed, 4 Jan 2023 03:43:34 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id D0D4240697; Wed, 4 Jan 2023 03:43:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672800213; x=1704336213; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=uixJm7Uvd5HIr0v9XcRIg0iHDXPm9FL9qYZ8/mEL4UM=; b=OwV2KbQOI/UW44CUIZAp00hbJ/hpaLsBTTrusk1pxiHo7s8Q86M/smFB R8Ady93C/tFckEFw+RWh9metGPtHqekZbl7laxtpGh8uQ1QDW6BSwmLUH 6oWhTsPGw5pkXTmoAU3Ji/16/R5kv9gZgGXvHzDoMDyAnV7y9kqiAy/KD 5GLPN7HYHY29koh6jds+5gGQuSTzzb87zoxlC2rTWNUN6WkrF8RSBwyqJ PTFoUAPHnupWyZEHbW9O46Six3lysRu8PANLv41VKjiS3l6NUgHUvqk9N wZcr63g7pj5PGQGKTYxFjpypfEekncLslaAJZevxtFyWkB0v6Z1Xg80Y0 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10579"; a="305317503" X-IronPort-AV: E=Sophos;i="5.96,297,1665471600"; d="scan'208";a="305317503" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jan 2023 18:43:31 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10579"; a="632654893" X-IronPort-AV: E=Sophos;i="5.96,297,1665471600"; d="scan'208";a="632654893" Received: from unknown (HELO localhost.localdomain) ([10.239.252.251]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jan 2023 18:43:30 -0800 From: Wenwu Ma To: dev@dpdk.org Cc: Wenwu Ma , stable@dpdk.org Subject: [PATCH] vhost: fix net header settings in vhost datapath Date: Wed, 4 Jan 2023 10:39:45 +0800 Message-Id: <20230104023945.6669-1-wenwux.ma@intel.com> X-Mailer: git-send-email 2.25.1 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 In vhost sync batch enqueue, the "num_buffers" of virtio net header is not be set, but it should be set to 1 if the mrg_rxbuf feature is turned on, This patch fix the issue. Fixes: ef861692c398 ("vhost: add packed ring batch enqueue") Cc: stable@dpdk.org Signed-off-by: Wenwu Ma Tested-by: Wei Ling Acked-by: Cheng Jiang Reviewed-by: Maxime Coquelin --- lib/vhost/virtio_net.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c index cf796183a0..61d9052a57 100644 --- a/lib/vhost/virtio_net.c +++ b/lib/vhost/virtio_net.c @@ -1493,6 +1493,12 @@ virtio_dev_rx_batch_packed_copy(struct virtio_net *dev, sizeof(struct virtio_net_hdr_mrg_rxbuf); } + if (rxvq_is_mergeable(dev)) { + vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) { + ASSIGN_UNLESS_EQUAL(hdrs[i]->num_buffers, 1); + } + } + vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) virtio_enqueue_offload(pkts[i], &hdrs[i]->hdr);