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 A77B2A0093; Thu, 5 May 2022 16:15:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4DE394014F; Thu, 5 May 2022 16:15:47 +0200 (CEST) Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [170.10.129.74]) by mails.dpdk.org (Postfix) with ESMTP id EF2E040042 for ; Thu, 5 May 2022 16:15:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651760145; 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=JFydyGhAGK76Y3lfDQgvCp3p3/RkylaxqnLmb5380vc=; b=TFCMb2jxrhVb16JcWRMuPkrv1RT1vEJIVeNTDjRRrOxmLgwg4r/Fh/ZgouEHjVdh3VULRt dWFH87j9H2R1wdWS8IQFqjlLdVO9z1hY3TFatIOBk/muvgDw58DfARGjTDESg1VyoBIqI5 C6+AG/iHIqlcIqNyaYT+lFVOsM1bvSI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-619-JgsSTWAcO8iAkQZgur7o8w-1; Thu, 05 May 2022 10:15:39 -0400 X-MC-Unique: JgsSTWAcO8iAkQZgur7o8w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3649685A5BC; Thu, 5 May 2022 14:15:39 +0000 (UTC) Received: from [10.39.208.18] (unknown [10.39.208.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 30AC640C1247; Thu, 5 May 2022 14:15:38 +0000 (UTC) Message-ID: Date: Thu, 5 May 2022 16:15:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Subject: Re: [PATCH] net/vhost: get csum offload capabilities of vhost backend To: Wenwu Ma , chenbo.xia@intel.com Cc: dev@dpdk.org, jiayu.hu@intel.com, yinan.wang@intel.com, xingguang.he@intel.com References: <20220217151628.441165-1-wenwux.ma@intel.com> From: Maxime Coquelin In-Reply-To: <20220217151628.441165-1-wenwux.ma@intel.com> X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 Hi Wenwu, On 2/17/22 16:16, Wenwu Ma wrote: > 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; > } > > This patch has lots of gaps, since the negotiated Virtio features can change if the guest driver decides so, so the exposed ethdev offload capabilities may not represent what is really supported by the guest driver. I have done a series that handles this issue by implementing SW fallbacks in case of misalignment between host application and guest application: http://patches.dpdk.org/project/dpdk/cover/20220505102729.821075-1-maxime.coquelin@redhat.com/ Please help reviewing & testing the series if possible. Thanks, Maxime