[PATCH] net/virtio: include ipv4 cksum to support cksum offload capability
Harold Huang
baymaxhuang at gmail.com
Mon Feb 7 03:54:00 CET 2022
Hi, Maxime,
Maxime Coquelin <maxime.coquelin at redhat.com> 于2022年1月31日周一 18:04写道:
>
> Hi Harold,
>
> On 1/7/22 12:53, Harold Huang wrote:
> > Device cksum offload capability usually include ipv4 cksum, tcp and udp
> > cksum offload capability. The application such as OVS usually negotiate
> > with the drive like this to enable cksum offload.
> >
> > Signed-off-by: Harold Huang <baymaxhuang at gmail.com>
> > ---
> > drivers/net/virtio/virtio_ethdev.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> > index c2588369b2..65b03bf0e4 100644
> > --- a/drivers/net/virtio/virtio_ethdev.c
> > +++ b/drivers/net/virtio/virtio_ethdev.c
> > @@ -3041,6 +3041,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
> > dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_SCATTER;
> > if (host_features & (1ULL << VIRTIO_NET_F_GUEST_CSUM)) {
> > dev_info->rx_offload_capa |=
> > + RTE_ETH_RX_OFFLOAD_IPV4_CKSUM |
> > RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
> > RTE_ETH_RX_OFFLOAD_UDP_CKSUM;
> > }
> > @@ -3055,6 +3056,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
> > RTE_ETH_TX_OFFLOAD_VLAN_INSERT;
> > if (host_features & (1ULL << VIRTIO_NET_F_CSUM)) {
> > dev_info->tx_offload_capa |=
> > + RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |
> > RTE_ETH_TX_OFFLOAD_UDP_CKSUM |
> > RTE_ETH_TX_OFFLOAD_TCP_CKSUM;
> > }
>
> I'm not sure to understand why this is needed, as Vhost lib will always
> ensure the IP csum has been calculated. Could you please elaborate?
Thanks for your comments. Previously I want to enable tx checksum
offload for the tap device when I use DPDK virtio-user driver with
OVS. OVS assume checksum offload capability includes tcp, udp and ipv4
checksum offload:
https://github.com/openvswitch/ovs/blob/master/lib/netdev-dpdk.c#L1097.
But AFAIK, ipv4 checksum has always been calculated in the kernel.
And according to the virito-spec
(https://docs.oasis-open.org/virtio/virtio/v1.1/csprd01/virtio-v1.1-csprd01.html),
VIRTIO_NET_F_GUEST_CSUM feature bit may only indicate TCP or UDP
checksum offload, right? Maybe I need to change OVS to adapt to
virtio-user driver to enable checksum offload.
>
> Thanks,
> Maxime
>
Thanks,
Harold
More information about the dev
mailing list