patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
	Chenbo Xia <chenbo.xia@intel.com>,
	Jens Freimann <jfreimann@redhat.com>,
	Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>,
	Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>,
	stable@dpdk.org
Subject: [dpdk-stable] [PATCH] net/virtio: fix device configure without jumbo Rx offload
Date: Thu,  2 Sep 2021 17:39:39 +0300	[thread overview]
Message-ID: <20210902143939.45596-1-andrew.rybchenko@oktetlabs.ru> (raw)

From: Ivan Ilchenko <Ivan.Ilchenko@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: stable@dpdk.org

Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@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))
-- 
2.30.2


             reply	other threads:[~2021-09-02 14:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-02 14:39 Andrew Rybchenko [this message]
2021-09-14 11:07 ` Maxime Coquelin
2021-09-14 11:17   ` Andrew Rybchenko
2021-09-14 11:28     ` Maxime Coquelin
2021-09-14 11:28 ` Maxime Coquelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210902143939.45596-1-andrew.rybchenko@oktetlabs.ru \
    --to=andrew.rybchenko@oktetlabs.ru \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=ivan.ilchenko@oktetlabs.ru \
    --cc=jfreimann@redhat.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).