From: Ilya Maximets <i.maximets@samsung.com>
To: Jens Freimann <jfreimann@redhat.com>, dev@dpdk.org
Cc: tiwei.bie@intel.com, maxime.coquelin@redhat.com
Subject: Re: [dpdk-dev] [v4] net/virtio: set offload flag for jumbo frames
Date: Fri, 1 Feb 2019 17:27:37 +0300 [thread overview]
Message-ID: <d120a32b-a83b-b5ca-c956-0413c5af65f6@samsung.com> (raw)
In-Reply-To: <20190201100348.6730-1-jfreimann@redhat.com>
On 01.02.2019 13:03, Jens Freimann wrote:
> Port configuration fails because offload flags don't match the expected
> value when max-pkt-len is set to a value that should enable receive port
> offloading but doesn't.
>
> There are two cases to consider:
>
> 1. VIRTIO_NET_F_MTU is set. Then we need to check if the requested
> max-pkt-len fits into the MTU plus header. If yes we set the
> offload flag.
> 2. VIRTIO_NET_F_MTU is not set. We can set the offload flag.
>
> Fixes: a4996bd89c42 ("ethdev: new Rx/Tx offloads API")
> Cc: stable@dpdk.org
>
> Signed-off-by: Jens Freimann <jfreimann@redhat.com>
> ---
> v3->v4:
> * make use of hw-max_mtu which is calculated during device init. This
> way we don't have to re-read the mtu from config space again. This
> is safe because hw->max_mtu is not changed after init.
>
> v2->v3:
> * remove unnecessary brackets (Maxime)
> * fix commit message (David)
>
> v1->v2:
> * include virtnet hdr, ethernet header, vlan tag when comparing against
> max-rx-pkt-len (Maxime)
>
> drivers/net/virtio/virtio_ethdev.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index 7c4c1df00..4cf91909d 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -2351,6 +2351,16 @@ 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)) {
> + uint32_t ether_hdr_len = ETHER_HDR_LEN + VLAN_TAG_LEN +
> + hw->vtnet_hdr_size;
> + if (dev->data->dev_conf.rxmode.max_rx_pkt_len <=
> + hw->max_mtu + ether_hdr_len)
> + dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> + } else {
> + dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> + }
> +
As I wrote for v3, hw->max_mtu already calculated taking VIRTIO_NET_F_MTU
into account. If VIRTIO_NET_F_MTU is not set, hw->max_mtu is equal to
"VIRTIO_MAX_RX_PKTLEN - ETHER_HDR_LEN - VLAN_TAG_LEN - hw->vtnet_hdr_size".
i.e. "hw->max_mtu + ether_hdr_len" equal to VIRTIO_MAX_RX_PKTLEN which is
larger or equal to rxmode.max_rx_pkt_len.
So, there is no need to check for VIRTIO_NET_F_MTU here. You may just perform
same check for both cases.
This doesn't give any performance or so, but will simplify the code.
> dev_info->tx_offload_capa = DEV_TX_OFFLOAD_MULTI_SEGS |
> DEV_TX_OFFLOAD_VLAN_INSERT;
> if (host_features & (1ULL << VIRTIO_NET_F_CSUM)) {
>
next prev parent reply other threads:[~2019-02-01 14:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-01 10:03 [dpdk-dev] [PATCH v4] " Jens Freimann
[not found] ` <CGME20190201142739eucas1p1eff46b874ee985b7aa2d32b185e837c1@eucas1p1.samsung.com>
2019-02-01 14:27 ` Ilya Maximets [this message]
2019-02-01 15:13 ` [dpdk-dev] [v4] " Jens Freimann
2019-02-01 15:21 ` Ilya Maximets
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=d120a32b-a83b-b5ca-c956-0413c5af65f6@samsung.com \
--to=i.maximets@samsung.com \
--cc=dev@dpdk.org \
--cc=jfreimann@redhat.com \
--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).