Skip to contentSkip to conversation

add mtu set in virtio

PATCH Superseded souvikdey33 3 participants 12 messages Aug 29, 2016 – Sep 9, 2016 Network drivers

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 add mtu set in virtio

Fixes 1fb8e8896ca8 ("Signed-off-by: Souvik Dey <[email protected]>")

Virtio interfaces should also support setting of mtu, as in case of cloud it is expected to have the consistent mtu across the infrastructure that the dhcp server sends and not hardcoded to 1500(default).

---
 drivers/net/virtio/virtio_ethdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/net/virtio/virtio_ethdev.c +12 -0
index 07d6449..da16ad4 100644
@@ -92,6 +92,7 @@ static void virtio_mac_addr_add(struct rte_eth_dev *dev,
 static void virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index);
 static void virtio_mac_addr_set(struct rte_eth_dev *dev,
 				struct ether_addr *mac_addr);
+static int  virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
 
 static int virtio_dev_queue_stats_mapping_set(
 	__rte_unused struct rte_eth_dev *eth_dev,
@@ -652,6 +653,16 @@ virtio_dev_allmulticast_disable(struct rte_eth_dev *dev)
 		PMD_INIT_LOG(ERR, "Failed to disable allmulticast");
 }
 
+static int 
+virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) 
+{
+   struct virtio_hw *hw = dev->data->dev_private;
+   if (mtu < VIRTIO_MIN_RX_BUFSIZE || mtu > VIRTIO_MAX_RX_PKTLEN) {
+	   PMD_INIT_LOG(ERR,"Mtu should be between 64 and 9728."
+          return -EINVAL;
+   }
+   return 0;
+}
+
 /*
  * dev_ops for virtio, bare necessities for basic operation

*/
@@ -664,6 +675,7 @@ static const struct eth_dev_ops virtio_eth_dev_ops = {

 	.promiscuous_disable     = virtio_dev_promiscuous_disable,
 	.allmulticast_enable     = virtio_dev_allmulticast_enable,
 	.allmulticast_disable    = virtio_dev_allmulticast_disable,
+	.mtu_set                 = virtio_mtu_set,

.dev_infos_get = virtio_dev_info_get,
.stats_get = virtio_dev_stats_get,

Signature · 1 line
2.9.3.windows.1
#1 lore raw

Hi Souvik,

Quoted 11 lines · On 08/30/2016 01:02 AM, souvikdey33 wrote:
Fixes 1fb8e8896ca8 ("Signed-off-by: Souvik Dey <[email protected]>")

Virtio interfaces should also support setting of mtu, as in case of cloud it is expected to have the consistent mtu across the infrastructure that the dhcp server sends and not hardcoded to 1500(default).

---
 drivers/net/virtio/virtio_ethdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

FYI, there are some on-going changes in the VIRTIO specification so that the VHOST interface exposes its MTU to its VIRTIO peer. It may also be used as an alternative of what you patch achieves.

I am working on its implementation in Qemu/DPDK, our goal being to reduce performance drops for small packets with Rx mergeable buffers feature enabled.

Regards,
Maxime

#2 lore raw

Hi Maxime,
When is patches or new implementation going to come in the release ? if it is not 16.11 then, can we keep this change till the new virtio changes come in the release. And if it is already planned for 16.11, then can I get a little more information on that.

--
Regards,
Souvik

-----Original Message-----
From: Maxime Coquelin [mailto:[email protected]]
Sent: Tuesday, August 30, 2016 3:58 AM
To: Dey, Souvik <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] add mtu set in virtio

Hi Souvik,

Quoted 11 lines · On 08/30/2016 01:02 AM, souvikdey33 wrote:
Fixes 1fb8e8896ca8 ("Signed-off-by: Souvik Dey <[email protected]>")

Virtio interfaces should also support setting of mtu, as in case of cloud it is expected to have the consistent mtu across the infrastructure that the dhcp server sends and not hardcoded to 1500(default).

---
 drivers/net/virtio/virtio_ethdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

FYI, there are some on-going changes in the VIRTIO specification so that the VHOST interface exposes its MTU to its VIRTIO peer. It may also be used as an alternative of what you patch achieves.

I am working on its implementation in Qemu/DPDK, our goal being to reduce performance drops for small packets with Rx mergeable buffers feature enabled.

Regards,
Maxime

#3 lore raw

Hi Souvik,

Quoted 3 lines · Souvik

Hi Maxime,
When is patches or new implementation going to come in the release ? if it is not 16.11 then, can we keep this change till the new virtio changes come in the release. And if it is already planned for 16.11, then can I get a little more information on that.

I'm currently working on qemu part implementation, first RFC should be sent next week.

Goal is to have it in 16.11, but I cannot commit, as the spec update has not been acked yet.

For more information, you can start by having a look at the spec review:
https://lists.oasis-open.org/archives/virtio-dev/201608/msg00056.html

Regards,
Maxime

Quoted 34 lines

--
Regards,
Souvik

-----Original Message-----
From: Maxime Coquelin [mailto:[email protected]]
Sent: Tuesday, August 30, 2016 3:58 AM
To: Dey, Souvik <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] add mtu set in virtio

Hi Souvik,

Quoted 11 lines · On 08/30/2016 01:02 AM, souvikdey33 wrote:
Fixes 1fb8e8896ca8 ("Signed-off-by: Souvik Dey <[email protected]>")

Virtio interfaces should also support setting of mtu, as in case of cloud it is expected to have the consistent mtu across the infrastructure that the dhcp server sends and not hardcoded to 1500(default).

---
 drivers/net/virtio/virtio_ethdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

FYI, there are some on-going changes in the VIRTIO specification so that the VHOST interface exposes its MTU to its VIRTIO peer. It may also be used as an alternative of what you patch achieves.

I am working on its implementation in Qemu/DPDK, our goal being to reduce performance drops for small packets with Rx mergeable buffers feature enabled.

Regards,
Maxime

#4 lore raw

Hi Maxime,
In that case let this fix be there till the time the new implementation comes in. We can re-visit the changes again in the new implementation and then decide to keep this or remove it. Hope this serves all the purposes.

--
Regards,
Souvik

-----Original Message-----
From: Maxime Coquelin [mailto:[email protected]]
Sent: Friday, September 2, 2016 3:06 AM
To: Dey, Souvik <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] add mtu set in virtio

Hi Souvik,

Quoted 3 lines · Souvik

Hi Maxime,
When is patches or new implementation going to come in the release ? if it is not 16.11 then, can we keep this change till the new virtio changes come in the release. And if it is already planned for 16.11, then can I get a little more information on that.

I'm currently working on qemu part implementation, first RFC should be sent next week.

Goal is to have it in 16.11, but I cannot commit, as the spec update has not been acked yet.

For more information, you can start by having a look at the spec review:
https://lists.oasis-open.org/archives/virtio-dev/201608/msg00056.html

Regards,
Maxime

Quoted 36 lines

--
Regards,
Souvik

-----Original Message-----
From: Maxime Coquelin [mailto:[email protected]]
Sent: Tuesday, August 30, 2016 3:58 AM
To: Dey, Souvik <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] add mtu set in virtio

Hi Souvik,

Quoted 4 lines · On 08/30/2016 01:02 AM, souvikdey33 wrote:
Fixes 1fb8e8896ca8 ("Signed-off-by: Souvik Dey

<[email protected]>")

Quoted 8 lines

Virtio interfaces should also support setting of mtu, as in case of cloud it is expected to have the consistent mtu across the infrastructure that the dhcp server sends and not hardcoded to 1500(default).

---
 drivers/net/virtio/virtio_ethdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

FYI, there are some on-going changes in the VIRTIO specification so that the VHOST interface exposes its MTU to its VIRTIO peer. It may also be used as an alternative of what you patch achieves.

I am working on its implementation in Qemu/DPDK, our goal being to reduce performance drops for small packets with Rx mergeable buffers feature enabled.

Regards,
Maxime

#6 lore raw
In reply to Maxime Coquelin
Quoted 15 lines · Maxime Coquelin

Hi Souvik,

Quoted 11 lines · On 08/30/2016 01:02 AM, souvikdey33 wrote:
Fixes 1fb8e8896ca8 ("Signed-off-by: Souvik Dey <[email protected]>")

Virtio interfaces should also support setting of mtu, as in case of cloud it is expected to have the consistent mtu across the infrastructure that the dhcp server sends and not hardcoded to 1500(default).
---
drivers/net/virtio/virtio_ethdev.c | 12 ++++++++++++

1 file changed, 12 insertions(+)
Quoted 7 lines

FYI, there are some on-going changes in the VIRTIO specification so that the VHOST interface exposes its MTU to its VIRTIO peer. It may also be used as an alternative of what you patch achieves.

I am working on its implementation in Qemu/DPDK, our goal being to reduce performance drops for small packets with Rx mergeable buffers feature enabled.

Mind to educate me a bit on how that works?

	--yliu
#5 lore raw
In reply to Dey, Souvik
Quoted 2 lines · Souvik

Hi Maxime,
In that case let this fix be there till the time the new implementation comes in. We can re-visit the changes again in the new implementation and then decide to keep this or remove it. Hope this serves all the purposes.

Sure, I'm fine with your proposal.

Thanks,
Maxime

Quoted 64 lines

--
Regards,
Souvik

-----Original Message-----
From: Maxime Coquelin [mailto:[email protected]]
Sent: Friday, September 2, 2016 3:06 AM
To: Dey, Souvik <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] add mtu set in virtio

Hi Souvik,

Quoted 3 lines · Souvik

Hi Maxime,
When is patches or new implementation going to come in the release ? if it is not 16.11 then, can we keep this change till the new virtio changes come in the release. And if it is already planned for 16.11, then can I get a little more information on that.

I'm currently working on qemu part implementation, first RFC should be sent next week.

Goal is to have it in 16.11, but I cannot commit, as the spec update has not been acked yet.

For more information, you can start by having a look at the spec review:
https://lists.oasis-open.org/archives/virtio-dev/201608/msg00056.html

Regards,
Maxime

Quoted 36 lines

--
Regards,
Souvik

-----Original Message-----
From: Maxime Coquelin [mailto:[email protected]]
Sent: Tuesday, August 30, 2016 3:58 AM
To: Dey, Souvik <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] add mtu set in virtio

Hi Souvik,

Quoted 4 lines · On 08/30/2016 01:02 AM, souvikdey33 wrote:
Fixes 1fb8e8896ca8 ("Signed-off-by: Souvik Dey

<[email protected]>")

Quoted 8 lines

Virtio interfaces should also support setting of mtu, as in case of cloud it is expected to have the consistent mtu across the infrastructure that the dhcp server sends and not hardcoded to 1500(default).

---
 drivers/net/virtio/virtio_ethdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

FYI, there are some on-going changes in the VIRTIO specification so that the VHOST interface exposes its MTU to its VIRTIO peer. It may also be used as an alternative of what you patch achieves.

I am working on its implementation in Qemu/DPDK, our goal being to reduce performance drops for small packets with Rx mergeable buffers feature enabled.

Regards,
Maxime

#7 lore raw
In reply to Yuanhan Liu
Quoted 20 lines · Yuanhan Liu
Quoted 19 lines · Maxime Coquelin

Hi Souvik,

Quoted 11 lines · On 08/30/2016 01:02 AM, souvikdey33 wrote:
Fixes 1fb8e8896ca8 ("Signed-off-by: Souvik Dey <[email protected]>")

Virtio interfaces should also support setting of mtu, as in case of cloud it is expected to have the consistent mtu across the infrastructure that the dhcp server sends and not hardcoded to 1500(default).
---
drivers/net/virtio/virtio_ethdev.c | 12 ++++++++++++

1 file changed, 12 insertions(+)

FYI, there are some on-going changes in the VIRTIO specification so that the VHOST interface exposes its MTU to its VIRTIO peer. It may also be used as an alternative of what you patch achieves.

Quoted 5 lines
Quoted 3 lines

I am working on its implementation in Qemu/DPDK, our goal being to reduce performance drops for small packets with Rx mergeable buffers feature enabled.

Mind to educate me a bit on how that works?

Of course.

Basically, this is a way to advise the MTU we want in the guest. In the guest, if GRO is not enabled:
- In case of Kernel virtio-net, it could be used to
size the SKBs at the expected MTU. If possible, we could disable Rx mergeable buffers.
- In case of virtio PMD, if the MTU advised by host is lower than the
pre-allocated mbuf size for the receive queue, then we should not need mergeable buffers.

Does that sound reasonnable?
Do I miss something?

Thanks,
Maxime

#8 lore raw
Quoted 31 lines · Maxime Coquelin
Quoted 20 lines · Yuanhan Liu
Quoted 19 lines · Maxime Coquelin

Hi Souvik,

Quoted 11 lines · On 08/30/2016 01:02 AM, souvikdey33 wrote:
Fixes 1fb8e8896ca8 ("Signed-off-by: Souvik Dey <[email protected]>")

Virtio interfaces should also support setting of mtu, as in case of cloud it is expected to have the consistent mtu across the infrastructure that the dhcp server sends and not hardcoded to 1500(default).
---
drivers/net/virtio/virtio_ethdev.c | 12 ++++++++++++

1 file changed, 12 insertions(+)

FYI, there are some on-going changes in the VIRTIO specification so that the VHOST interface exposes its MTU to its VIRTIO peer. It may also be used as an alternative of what you patch achieves.

Quoted 5 lines
Quoted 3 lines

I am working on its implementation in Qemu/DPDK, our goal being to reduce performance drops for small packets with Rx mergeable buffers feature enabled.

Mind to educate me a bit on how that works?

Of course.

Quoted 8 lines

Basically, this is a way to advise the MTU we want in the guest. In the guest, if GRO is not enabled:
- In case of Kernel virtio-net, it could be used to
size the SKBs at the expected MTU. If possible, we could disable Rx mergeable buffers.
- In case of virtio PMD, if the MTU advised by host is lower than the
pre-allocated mbuf size for the receive queue, then we should not need mergeable buffers.

Thanks for the explanation!

I see. So, the point is to avoid using mergeable buffers while it is enabled.

Quoted 1 line

Does that sound reasonnable?

Yeah, maybe. Just don't know how well it may work in real life. Have you got any rought data so far?

	--yliu
Quoted 4 lines

Do I miss something?

Thanks,
Maxime

#9 lore raw
Quoted 43 lines · Yuanhan Liu
Quoted 31 lines · Maxime Coquelin
Quoted 20 lines · Yuanhan Liu
Quoted 19 lines · Maxime Coquelin

Hi Souvik,

Quoted 11 lines · On 08/30/2016 01:02 AM, souvikdey33 wrote:
Fixes 1fb8e8896ca8 ("Signed-off-by: Souvik Dey <[email protected]>")

Virtio interfaces should also support setting of mtu, as in case of cloud it is expected to have the consistent mtu across the infrastructure that the dhcp server sends and not hardcoded to 1500(default).
---
drivers/net/virtio/virtio_ethdev.c | 12 ++++++++++++

1 file changed, 12 insertions(+)

FYI, there are some on-going changes in the VIRTIO specification so that the VHOST interface exposes its MTU to its VIRTIO peer. It may also be used as an alternative of what you patch achieves.

Quoted 5 lines
Quoted 3 lines

I am working on its implementation in Qemu/DPDK, our goal being to reduce performance drops for small packets with Rx mergeable buffers feature enabled.

Mind to educate me a bit on how that works?

Of course.

Quoted 8 lines

Basically, this is a way to advise the MTU we want in the guest. In the guest, if GRO is not enabled:
- In case of Kernel virtio-net, it could be used to
size the SKBs at the expected MTU. If possible, we could disable Rx mergeable buffers.
- In case of virtio PMD, if the MTU advised by host is lower than the
pre-allocated mbuf size for the receive queue, then we should not need mergeable buffers.

Thanks for the explanation!

Quoted 7 lines

I see. So, the point is to avoid using mergeable buffers while it is enabled.

Quoted 1 line

Does that sound reasonnable?

Yeah, maybe. Just don't know how well it may work in real life. Have you got any rought data so far?

The PoC is not done yet, only Qemu part is implemented. But what we noticed is that for small packets, we have a 50% degradation when rx mergeable buffers are on when running PVP use-case.

Main part of the degradation is due an additional cache-miss in virtio-pmd receive path, because we fetch the header to get the number of buffer.

When sending only small packets and removing this access, we recover 25% of the degradation.

The 25% remaining part may be reduced significantly with Zhihong series.

Hope it answer your questions.

Thanks,
Maxime

#10 lore raw
Quoted 63 lines · Maxime Coquelin
Quoted 43 lines · Yuanhan Liu
Quoted 31 lines · Maxime Coquelin
Quoted 20 lines · Yuanhan Liu
Quoted 19 lines · Maxime Coquelin

Hi Souvik,

Quoted 11 lines · On 08/30/2016 01:02 AM, souvikdey33 wrote:
Fixes 1fb8e8896ca8 ("Signed-off-by: Souvik Dey <[email protected]>")

Virtio interfaces should also support setting of mtu, as in case of cloud it is expected to have the consistent mtu across the infrastructure that the dhcp server sends and not hardcoded to 1500(default).
---
drivers/net/virtio/virtio_ethdev.c | 12 ++++++++++++

1 file changed, 12 insertions(+)

FYI, there are some on-going changes in the VIRTIO specification so that the VHOST interface exposes its MTU to its VIRTIO peer. It may also be used as an alternative of what you patch achieves.

Quoted 5 lines
Quoted 3 lines

I am working on its implementation in Qemu/DPDK, our goal being to reduce performance drops for small packets with Rx mergeable buffers feature enabled.

Mind to educate me a bit on how that works?

Of course.

Quoted 8 lines

Basically, this is a way to advise the MTU we want in the guest. In the guest, if GRO is not enabled:
- In case of Kernel virtio-net, it could be used to
size the SKBs at the expected MTU. If possible, we could disable Rx mergeable buffers.
- In case of virtio PMD, if the MTU advised by host is lower than the pre-allocated mbuf size for the receive queue, then we should not need mergeable buffers.

Thanks for the explanation!

Quoted 7 lines

I see. So, the point is to avoid using mergeable buffers while it is enabled.

Quoted 1 line

Does that sound reasonnable?

Yeah, maybe. Just don't know how well it may work in real life. Have you got any rought data so far?

The PoC is not done yet, only Qemu part is implemented. But what we noticed is that for small packets, we have a 50% degradation when rx mergeable buffers are on when running PVP use-case.

Main part of the degradation is due an additional cache-miss in virtio-pmd receive path, because we fetch the header to get the number of buffer.

Quoted 6 lines

When sending only small packets and removing this access, we recover 25% of the degradation.

The 25% remaining part may be reduced significantly with Zhihong series.

Hope it answer your questions.

Yes, it does and thanks for the info.

	--yliu
#11 lore raw

Are we good to get this in for 16.11 and then revisit this when the VHOST improvements comes in. This will atleast take care of the gap between 16.11 and VHOST improvements coming in.

--
Regards,
Souvik

-----Original Message-----
From: Yuanhan Liu [mailto:[email protected]]
Sent: Thursday, September 8, 2016 3:57 AM
To: Maxime Coquelin <[email protected]>
Cc: Dey, Souvik <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] add mtu set in virtio

Quoted 64 lines · Maxime Coquelin
Quoted 44 lines · Yuanhan Liu
Quoted 32 lines · Maxime Coquelin
Quoted 21 lines · Yuanhan Liu
Quoted 20 lines · Maxime Coquelin

Hi Souvik,

Quoted 4 lines · On 08/30/2016 01:02 AM, souvikdey33 wrote:
Fixes 1fb8e8896ca8 ("Signed-off-by: Souvik Dey

<[email protected]>")

Quoted 8 lines

Virtio interfaces should also support setting of mtu, as in case of cloud it is expected to have the consistent mtu across the infrastructure that the dhcp server sends and not hardcoded to 1500(default).
---
drivers/net/virtio/virtio_ethdev.c | 12 ++++++++++++

1 file changed, 12 insertions(+)

FYI, there are some on-going changes in the VIRTIO specification so that the VHOST interface exposes its MTU to its VIRTIO peer. It may also be used as an alternative of what you patch achieves.

Quoted 5 lines
Quoted 3 lines

I am working on its implementation in Qemu/DPDK, our goal being to reduce performance drops for small packets with Rx mergeable buffers feature enabled.

Mind to educate me a bit on how that works?

Of course.

Quoted 8 lines

Basically, this is a way to advise the MTU we want in the guest. In the guest, if GRO is not enabled:
- In case of Kernel virtio-net, it could be used to size the SKBs at the expected MTU. If possible, we could disable Rx mergeable buffers.
- In case of virtio PMD, if the MTU advised by host is lower than the pre-allocated mbuf size for the receive queue, then we should not need mergeable buffers.

Thanks for the explanation!

Quoted 7 lines

I see. So, the point is to avoid using mergeable buffers while it is enabled.

Quoted 1 line

Does that sound reasonnable?

Yeah, maybe. Just don't know how well it may work in real life. Have you got any rought data so far?

The PoC is not done yet, only Qemu part is implemented. But what we noticed is that for small packets, we have a 50% degradation when rx mergeable buffers are on when running PVP use-case.

Main part of the degradation is due an additional cache-miss in virtio-pmd receive path, because we fetch the header to get the number of buffer.

Quoted 6 lines

When sending only small packets and removing this access, we recover 25% of the degradation.

The 25% remaining part may be reduced significantly with Zhihong series.

Hope it answer your questions.

Yes, it does and thanks for the info.

	--yliu