From: Jens Freimann <jfreimann@redhat.com>
To: dev@dpdk.org
Cc: tiwei.bie@intel.com, maxime.coquelin@redhat.com
Subject: [dpdk-dev] [PATCH] net/virtio: set offload flag for jumbo frames
Date: Wed, 30 Jan 2019 16:26:34 +0100 [thread overview]
Message-ID: <20190130152634.8652-1-jfreimann@redhat.com> (raw)
Port configuration fails when offload flags don't match the expected
value, e.g. when max-pkt-len is set to a value that should enable
receive port offloading but doesn't.
This can be triggered by running testpmd e.g. with --max-pkt-len=2000.
It will fail with "Ethdev port_id=0 requested Rx offloads 0x800 doesn't
match Rx offloads capabilities 0x20d in rte_eth_dev_configure()"
To fix this there are two cases to consider:
1. VIRTIO_NET_F_MTU is negotiated. Then we need to check if the
requested max. packet length fits into the MTU. If yes we set the
offload flag.
2. VIRTIO_NET_F_MTU is not negotiated. We can set the offload flag.
Signed-off-by: Jens Freimann <jfreimann@redhat.com>
---
drivers/net/virtio/virtio_ethdev.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 7c4c1df00..e0d6542d4 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -2351,6 +2351,17 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
if ((host_features & tso_mask) == tso_mask)
dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_LRO;
+ if (host_features & (1ULL << VIRTIO_NET_F_MTU)) {
+ struct virtio_net_config config;
+ vtpci_read_dev_config(hw,
+ offsetof(struct virtio_net_config, mtu),
+ &config.mtu, sizeof(config.mtu));
+ if (dev->data->dev_conf.rxmode.max_rx_pkt_len <= config.mtu)
+ dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_JUMBO_FRAME;
+ } else {
+ dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_JUMBO_FRAME;
+ }
+
dev_info->tx_offload_capa = DEV_TX_OFFLOAD_MULTI_SEGS |
DEV_TX_OFFLOAD_VLAN_INSERT;
if (host_features & (1ULL << VIRTIO_NET_F_CSUM)) {
--
2.17.2
next reply other threads:[~2019-01-30 15:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-30 15:26 Jens Freimann [this message]
2019-01-30 15:41 ` Maxime Coquelin
2019-01-30 16:12 ` Jens Freimann
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=20190130152634.8652-1-jfreimann@redhat.com \
--to=jfreimann@redhat.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
--cc=tiwei.bie@intel.com \
/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).