[PATCH] net/vhost: get csum offload capabilities of vhost backend
Hu, Jiayu
jiayu.hu at intel.com
Tue Mar 15 03:56:03 CET 2022
Hi Wenwu,
> -----Original Message-----
> From: Ma, WenwuX <wenwux.ma at intel.com>
> Sent: Thursday, February 17, 2022 11:16 PM
> To: maxime.coquelin at redhat.com; Xia, Chenbo <chenbo.xia at intel.com>
> Cc: dev at dpdk.org; Hu, Jiayu <jiayu.hu at intel.com>; Wang, Yinan
> <yinan.wang at intel.com>; He, Xingguang <xingguang.he at intel.com>; Ma,
> WenwuX <wenwux.ma at intel.com>
> Subject: [PATCH] net/vhost: get csum offload capabilities of vhost backend
>
> The current vhost backend lacks csum offloads information, which will cause
> testpmd command such as "csum set tcp hw <port_id>" to fail. This patch
> adds the information according to the device features.
Vhost-pmd cannot report correct checksum offloading capabilities, since
feature negotiation may happen after vhost-pmd device creation. It's good
to see there is a solution for it, IMO.
>
> Signed-off-by: Wenwu Ma <wenwux.ma at intel.com>
> ---
> 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 |
The spec says "VIRTIO_NET_F_CSUM: host handles pkts w/ partial csum".
If this feature is negotiated, it means vhost pmd supports to receive packets
with partial checksum, right? So VIRTIO_NET_F_CSUM should represent Rx
offloading capabilities for vhost pmd.
> +
> 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 |=
Same as above.
Thanks,
Jiayu
More information about the dev
mailing list