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 145B5A0032; Thu, 17 Feb 2022 08:17:39 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E562E40150; Thu, 17 Feb 2022 08:17:38 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 73B9840042 for ; Thu, 17 Feb 2022 08:17:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645082256; x=1676618256; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=8ImLPcPmpkcN4ynw3qALbgHbw0TWHANUcJnHt5Agrfw=; b=YkrBXqVenXNitsk86nyiXRnkHcqlbjV99WOiPbcrXlmOguukK2ugAqW0 mQDKiwWUEDvQrg00W+8lf1Tx6+HjSgK+FOEcaoaVGb+L4kiB/0DAKRnJa eQ0UQr/GdNDN9aA+L8Hmgdjls33c79MgB1q0CzHz+ymuxpeottGC5KqN3 wU2/up+JanGg4b+0vsKH62yjUaStp2DDUSXMQaz6233Kyt+iNbm1Ah6on VLl3W/hMV+tar6gqrspyimks61smNnm5dMWGhJGZ/KuXCuCmUZcq6mpoI Ma+tCJ70XwKCd7A5HtHY5OOiolYTFVesPvuwTudw4xnyeMUmWKWCw5Bdm Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10260"; a="251011365" X-IronPort-AV: E=Sophos;i="5.88,375,1635231600"; d="scan'208";a="251011365" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2022 23:17:29 -0800 X-IronPort-AV: E=Sophos;i="5.88,375,1635231600"; d="scan'208";a="571668974" Received: from unknown (HELO localhost.localdomain) ([10.239.251.209]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2022 23:17:26 -0800 From: Wenwu Ma To: maxime.coquelin@redhat.com, chenbo.xia@intel.com Cc: dev@dpdk.org, jiayu.hu@intel.com, yinan.wang@intel.com, xingguang.he@intel.com, Wenwu Ma Subject: [PATCH] net/vhost: get csum offload capabilities of vhost backend Date: Thu, 17 Feb 2022 15:16:28 +0000 Message-Id: <20220217151628.441165-1-wenwux.ma@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 The current vhost backend lacks csum offloads information, which will cause testpmd command such as "csum set tcp hw " to fail. This patch adds the information according to the device features. Signed-off-by: Wenwu Ma --- drivers/net/vhost/rte_eth_vhost.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 070f0e6dfd..7593d5a9ae 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -1281,6 +1281,24 @@ eth_dev_info(struct rte_eth_dev *dev, RTE_ETH_TX_OFFLOAD_VLAN_INSERT; dev_info->rx_offload_capa = RTE_ETH_RX_OFFLOAD_VLAN_STRIP; + if (internal->vid != -1) { + uint64_t features = 0; + if (rte_vhost_get_negotiated_features(internal->vid, &features) != 0) + return 0; + + if (features & (1ULL << VIRTIO_NET_F_CSUM)) { + dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_TCP_CKSUM | + RTE_ETH_TX_OFFLOAD_UDP_CKSUM | + RTE_ETH_TX_OFFLOAD_IPV4_CKSUM; + } + + if (features & (1ULL << VIRTIO_NET_F_GUEST_CSUM)) { + dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_TCP_CKSUM | + RTE_ETH_RX_OFFLOAD_UDP_CKSUM | + RTE_ETH_RX_OFFLOAD_IPV4_CKSUM; + } + } + return 0; } -- 2.25.1