* [dpdk-stable] [PATCH v3] net/virtio: set offload flag for jumbo frames
@ 2019-01-31 9:17 Jens Freimann
2019-01-31 9:28 ` Maxime Coquelin
[not found] ` <CGME20190131110154eucas1p150b171c1c77a49e12843d28b61116966@eucas1p1.samsung.com>
0 siblings, 2 replies; 4+ messages in thread
From: Jens Freimann @ 2019-01-31 9:17 UTC (permalink / raw)
To: dev; +Cc: tiwei.bie, maxime.coquelin, stable
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>
---
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 | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 7c4c1df00..f39d4e630 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -2351,6 +2351,20 @@ 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;
+ uint32_t ether_hdr_len = ETHER_HDR_LEN + VLAN_TAG_LEN +
+ hw->vtnet_hdr_size;
+ 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 + ether_hdr_len)
+ 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-stable] [PATCH v3] net/virtio: set offload flag for jumbo frames
2019-01-31 9:17 [dpdk-stable] [PATCH v3] net/virtio: set offload flag for jumbo frames Jens Freimann
@ 2019-01-31 9:28 ` Maxime Coquelin
[not found] ` <CGME20190131110154eucas1p150b171c1c77a49e12843d28b61116966@eucas1p1.samsung.com>
1 sibling, 0 replies; 4+ messages in thread
From: Maxime Coquelin @ 2019-01-31 9:28 UTC (permalink / raw)
To: Jens Freimann, dev; +Cc: tiwei.bie, stable
On 1/31/19 10:17 AM, 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>
> ---
> 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 | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
>
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index 7c4c1df00..f39d4e630 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -2351,6 +2351,20 @@ 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;
> + uint32_t ether_hdr_len = ETHER_HDR_LEN + VLAN_TAG_LEN +
> + hw->vtnet_hdr_size;
> + 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 + ether_hdr_len)
> + 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)) {
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-stable] [v3] net/virtio: set offload flag for jumbo frames
[not found] ` <CGME20190131110154eucas1p150b171c1c77a49e12843d28b61116966@eucas1p1.samsung.com>
@ 2019-01-31 11:01 ` Ilya Maximets
2019-01-31 16:33 ` Jens Freimann
0 siblings, 1 reply; 4+ messages in thread
From: Ilya Maximets @ 2019-01-31 11:01 UTC (permalink / raw)
To: Jens Freimann, dev; +Cc: tiwei.bie, maxime.coquelin, stable
On 31.01.2019 12:17, 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>
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> 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 | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index 7c4c1df00..f39d4e630 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -2351,6 +2351,20 @@ 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;
> + uint32_t ether_hdr_len = ETHER_HDR_LEN + VLAN_TAG_LEN +
> + hw->vtnet_hdr_size;
> + 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 + ether_hdr_len)
> + dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> + } else {
> + dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> + }
> +
Why we can't just use 'hw->max_mtu' here for checking instead of
reading 'config.mtu' ?
Also, It's already calculated with regards to VIRTIO_NET_F_MTU.
> dev_info->tx_offload_capa = DEV_TX_OFFLOAD_MULTI_SEGS |
> DEV_TX_OFFLOAD_VLAN_INSERT;
> if (host_features & (1ULL << VIRTIO_NET_F_CSUM)) {
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-stable] [v3] net/virtio: set offload flag for jumbo frames
2019-01-31 11:01 ` [dpdk-stable] [v3] " Ilya Maximets
@ 2019-01-31 16:33 ` Jens Freimann
0 siblings, 0 replies; 4+ messages in thread
From: Jens Freimann @ 2019-01-31 16:33 UTC (permalink / raw)
To: Ilya Maximets; +Cc: dev, tiwei.bie, maxime.coquelin, stable
On Thu, Jan 31, 2019 at 02:01:53PM +0300, Ilya Maximets wrote:
>On 31.01.2019 12:17, 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>
>> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>> ---
>> 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 | 14 ++++++++++++++
>> 1 file changed, 14 insertions(+)
>>
>> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
>> index 7c4c1df00..f39d4e630 100644
>> --- a/drivers/net/virtio/virtio_ethdev.c
>> +++ b/drivers/net/virtio/virtio_ethdev.c
>> @@ -2351,6 +2351,20 @@ 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;
>> + uint32_t ether_hdr_len = ETHER_HDR_LEN + VLAN_TAG_LEN +
>> + hw->vtnet_hdr_size;
>> + 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 + ether_hdr_len)
>> + dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_JUMBO_FRAME;
>> + } else {
>> + dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_JUMBO_FRAME;
>> + }
>> +
>
>Why we can't just use 'hw->max_mtu' here for checking instead of
>reading 'config.mtu' ?
>Also, It's already calculated with regards to VIRTIO_NET_F_MTU.
Can't mtu have changed after device init? If not then yes, I guess we
could use hw->max_mtu.
regards,
Jens
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-01-31 16:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-31 9:17 [dpdk-stable] [PATCH v3] net/virtio: set offload flag for jumbo frames Jens Freimann
2019-01-31 9:28 ` Maxime Coquelin
[not found] ` <CGME20190131110154eucas1p150b171c1c77a49e12843d28b61116966@eucas1p1.samsung.com>
2019-01-31 11:01 ` [dpdk-stable] [v3] " Ilya Maximets
2019-01-31 16:33 ` Jens Freimann
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).