On 9/2/21 4:39 PM, Andrew Rybchenko wrote:
> From: Ivan Ilchenko <ivan.ilche...@oktetlabs.ru>
>
> Use max-pkt-len only if jumbo frames offload is requested
> since otherwise this field isn't valid.
>
> Fixes: 8b90e4358112 ("net/virtio: set offload flag for jumbo frames")
> Fixes: 4e8169eb0d2d ("net/virtio: fix Rx scatter offload")
> Cc: sta...@dpdk.org
>
> Signed-off-by: Ivan Ilchenko <ivan.ilche...@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <andrew.rybche...@oktetlabs.ru>
> ---
> drivers/net/virtio/virtio_ethdev.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/virtio/virtio_ethdev.c
> b/drivers/net/virtio/virtio_ethdev.c
> index e58085a2c9..9bce6833db 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -2099,10 +2099,14 @@ virtio_dev_configure(struct rte_eth_dev *dev)
> return ret;
> }
>
> - if (rxmode->max_rx_pkt_len > hw->max_mtu + ether_hdr_len)
> + if ((rx_offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) &&
> + (rxmode->max_rx_pkt_len > hw->max_mtu + ether_hdr_len))
> req_features &= ~(1ULL << VIRTIO_NET_F_MTU);
>
> - hw->max_rx_pkt_len = rxmode->max_rx_pkt_len;
> + if (rx_offloads & DEV_RX_OFFLOAD_JUMBO_FRAME)
> + hw->max_rx_pkt_len = rxmode->max_rx_pkt_len;
> + else
> + hw->max_rx_pkt_len = ether_hdr_len + dev->data->mtu;
>
> if (rx_offloads & (DEV_RX_OFFLOAD_UDP_CKSUM |
> DEV_RX_OFFLOAD_TCP_CKSUM))
>
Reviewed-by: Maxime Coquelin <maxime.coque...@redhat.com>
Thanks,
Maxime