virtio_net: set default mtu to 1500 when 'Device maximum MTU' bigger than 1500
Subsystems (4)
PATCH 1/1 virtio_net: set default mtu to 1500 when 'Device maximum MTU' bigger than 1500
When VIRTIO_NET_F_MTU(3) Device maximum MTU reporting is supported. If offered by the device, device advises driver about the value of its maximum MTU. If negotiated, the driver uses mtu as the maximum MTU value. But there the driver also uses it as default mtu, some devices may have a maximum MTU greater than 1500, this may cause some large packages to be discarded, so I changed the MTU to a more general 1500 when 'Device maximum MTU' bigger than 1500.
--- drivers/net/virtio_net.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/virtio_net.c +4 -1
@@ -4040,7 +4040,10 @@ static int virtnet_probe(struct virtio_device *vdev) goto free; } - dev->mtu = mtu; +if (mtu >1500 ) + dev->mtu =1500 ; +else + dev->mtu = mtu; dev->max_mtu = mtu; }
Signature · 1 line
2.27.0
Xuan Zhuo
reviewerQuoted 6 lines · Hao Chen
When
VIRTIO_NET_F_MTU(3)Device maximum MTU reporting is supported. If offered by the device, device advises driver about the value of its maximum MTU. If negotiated, the driver uses mtu as the maximum MTU value. But there the driver also uses it as default mtu, some devices may have a maximum MTU greater than 1500, this may cause some large packages to be discarded,
You mean tx packet?
If yes, I do not think this is the problem of driver.
Maybe you should give more details about the discard.
Quoted 13 lines
so I changed the MTU to a more
general 1500 when 'Device maximum MTU' bigger than 1500.Signed-off-by Hao Chen <[email protected]>--- drivers/net/virtio_net.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/virtio_net.c +0
-0
drivers/net/virtio_net.c static int virtnet_probe(struct virtio_device *vdev) · line 4043
Quoted 5 lines
drivers/net/virtio_net.c +1
-1@@ -4040,7 +4040,10 @@ static int virtnet_probe(struct virtio_device *vdev) goto free; } - dev->mtu = mtu; +if (mtu >1500 )
s/1500/ETH_DATA_LEN/
Thanks.
Quoted 9 lines
drivers/net/virtio_net.c +3
-1+ dev->mtu =1500 ; + else + dev->mtu = mtu; dev->max_mtu = mtu; } --2.27.0
Quoted 9 lines · Xuan Zhuo
Quoted 6 lines · Hao Chen
When
VIRTIO_NET_F_MTU(3)Device maximum MTU reporting is supported. If offered by the device, device advises driver about the value of its maximum MTU. If negotiated, the driver uses mtu as the maximum MTU value. But there the driver also uses it as default mtu, some devices may have a maximum MTU greater than 1500, this may cause some large packages to be discarded,You mean tx packet?
Yes.
Quoted 5 lines
If yes, I do not think this is the problem of driver.
Maybe you should give more details about the discard.
In the current code, if the maximum MTU supported by the virtio net hardware is 9000, the default MTU of the virtio net driver will also be set to 9000. When sending packets through "ping -s 5000", if the peer router does not support negotiating a path MTU through ICMP packets, the packets will be discarded. If the peer router supports negotiating path mtu through ICMP packets, the host side will perform packet sharding processing based on the negotiated path mtu, which is generally within 1500. This is not a bugfix patch, I think setting the default mtu to within 1500 would be more suitable here.Thanks.
Quoted 32 lines
Quoted 13 lines
so I changed the MTU to a more
general 1500 when 'Device maximum MTU' bigger than 1500.Signed-off-by Hao Chen <[email protected]>--- drivers/net/virtio_net.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/virtio_net.c +0
-0drivers/net/virtio_net.c static int virtnet_probe(struct virtio_device *vdev) · line 4043
Quoted 5 lines
drivers/net/virtio_net.c +1
-1@@ -4040,7 +4040,10 @@ static int virtnet_probe(struct virtio_device *vdev) goto free; } - dev->mtu = mtu; +if (mtu >1500 )s/1500/ETH_DATA_LEN/
Thanks.
Quoted 9 lines
drivers/net/virtio_net.c +3
-1+ dev->mtu =1500 ; + else + dev->mtu = mtu; dev->max_mtu = mtu; } --2.27.0
Michael S. Tsirkin
maintainerQuoted 18 lines · Hao Chen
Quoted 9 lines · Xuan Zhuo
Quoted 6 lines · Hao Chen
When
VIRTIO_NET_F_MTU(3)Device maximum MTU reporting is supported. If offered by the device, device advises driver about the value of its maximum MTU. If negotiated, the driver uses mtu as the maximum MTU value. But there the driver also uses it as default mtu, some devices may have a maximum MTU greater than 1500, this may cause some large packages to be discarded,You mean tx packet?
Yes.
Quoted 5 lines
If yes, I do not think this is the problem of driver.
Maybe you should give more details about the discard.
Quoted 9 lines
In the current code, if the maximum MTU supported by the virtio net hardware is 9000, the default MTU of the virtio net driver will also be set to 9000. When sending packets through "ping -s 5000", if the peer router does not support negotiating a path MTU through ICMP packets, the packets will be discarded. If the peer router supports negotiating path mtu through ICMP packets, the host side will perform packet sharding processing based on the negotiated path mtu, which is generally within 1500.
This is not a bugfix patch, I think setting the default mtu to within 1500 would be more suitable here.Thanks.
I don't think VIRTIO_NET_F_MTU is appropriate for support for jumbo packets.
The spec says:
The device MUST forward transmitted packets of up to mtu (plus low level ethernet header length) size with gso_type NONE or ECN, and do so without fragmentation, after VIRTIO_NET_F_MTU has been success- fully negotiated.VIRTIO_NET_F_MTU has been designed for all kind of tunneling devices,
and this is why we set mtu to max by default.
For things like jumbo frames where MTU might or might not be available, a new feature would be more appropriate.
Quoted 32 lines
Quoted 32 lines
Quoted 13 lines
so I changed the MTU to a more
general 1500 when 'Device maximum MTU' bigger than 1500.Signed-off-by Hao Chen <[email protected]>--- drivers/net/virtio_net.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/virtio_net.c +0
-0drivers/net/virtio_net.c static int virtnet_probe(struct virtio_device *vdev) · line 4043
Quoted 5 lines
drivers/net/virtio_net.c +1
-1@@ -4040,7 +4040,10 @@ static int virtnet_probe(struct virtio_device *vdev) goto free; } - dev->mtu = mtu; +if (mtu >1500 )s/1500/ETH_DATA_LEN/
Thanks.
Quoted 9 lines
drivers/net/virtio_net.c +3
-1+ dev->mtu =1500 ; + else + dev->mtu = mtu; dev->max_mtu = mtu; } --2.27.0
Xuan Zhuo
reviewerQuoted 37 lines · Michael S. Tsirkin
Quoted 18 lines · Hao Chen
Quoted 9 lines · Xuan Zhuo
Quoted 6 lines · Hao Chen
When
VIRTIO_NET_F_MTU(3)Device maximum MTU reporting is supported. If offered by the device, device advises driver about the value of its maximum MTU. If negotiated, the driver uses mtu as the maximum MTU value. But there the driver also uses it as default mtu, some devices may have a maximum MTU greater than 1500, this may cause some large packages to be discarded,You mean tx packet?
Yes.
Quoted 5 lines
If yes, I do not think this is the problem of driver.
Maybe you should give more details about the discard.
Quoted 9 lines
In the current code, if the maximum MTU supported by the virtio net hardware is 9000, the default MTU of the virtio net driver will also be set to 9000. When sending packets through "ping -s 5000", if the peer router does not support negotiating a path MTU through ICMP packets, the packets will be discarded. If the peer router supports negotiating path mtu through ICMP packets, the host side will perform packet sharding processing based on the negotiated path mtu, which is generally within 1500.
This is not a bugfix patch, I think setting the default mtu to within 1500 would be more suitable here.Thanks.I don't think
VIRTIO_NET_F_MTUis appropriate for support for jumbo packets.
The spec says:
The device MUST forward transmitted packets of up to mtu (plus low level ethernet header length) size withgso_typeNONE or ECN, and do so without fragmentation, afterVIRTIO_NET_F_MTUhas been success- fully negotiated.VIRTIO_NET_F_MTUhas been designed for all kind of tunneling devices,
and this is why we set mtu to max by default.
Quoted 2 lines
For things like jumbo frames where MTU might or might not be available, a new feature would be more appropriate.
So for jumbo frame, what is the problem?
We are trying to do this. @Heng
Thanks.
Quoted 34 lines
Quoted 33 lines
Quoted 33 lines
Quoted 14 lines
so I changed the MTU to a more
general 1500 when 'Device maximum MTU' bigger than 1500.Signed-off-by Hao Chen <[email protected]>--- drivers/net/virtio_net.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/virtio_net.c +0
-0drivers/net/virtio_net.c static int virtnet_probe(struct virtio_device *vdev) · line 4043
Quoted 5 lines
drivers/net/virtio_net.c +1
-1@@ -4040,7 +4040,10 @@ static int virtnet_probe(struct virtio_device *vdev) goto free; } - dev->mtu = mtu; +if (mtu >1500 )s/1500/ETH_DATA_LEN/
Thanks.
Quoted 9 lines
drivers/net/virtio_net.c +3
-1+ dev->mtu =1500 ; + else + dev->mtu = mtu; dev->max_mtu = mtu; } --2.27.0
Michael S. Tsirkin
maintainerQuoted 42 lines · Xuan Zhuo
Quoted 37 lines · Michael S. Tsirkin
Quoted 18 lines · Hao Chen
Quoted 9 lines · Xuan Zhuo
Quoted 6 lines · Hao Chen
When
VIRTIO_NET_F_MTU(3)Device maximum MTU reporting is supported. If offered by the device, device advises driver about the value of its maximum MTU. If negotiated, the driver uses mtu as the maximum MTU value. But there the driver also uses it as default mtu, some devices may have a maximum MTU greater than 1500, this may cause some large packages to be discarded,You mean tx packet?
Yes.
Quoted 5 lines
If yes, I do not think this is the problem of driver.
Maybe you should give more details about the discard.
Quoted 9 lines
In the current code, if the maximum MTU supported by the virtio net hardware is 9000, the default MTU of the virtio net driver will also be set to 9000. When sending packets through "ping -s 5000", if the peer router does not support negotiating a path MTU through ICMP packets, the packets will be discarded. If the peer router supports negotiating path mtu through ICMP packets, the host side will perform packet sharding processing based on the negotiated path mtu, which is generally within 1500.
This is not a bugfix patch, I think setting the default mtu to within 1500 would be more suitable here.Thanks.I don't think
VIRTIO_NET_F_MTUis appropriate for support for jumbo packets.
The spec says:
The device MUST forward transmitted packets of up to mtu (plus low level ethernet header length) size withgso_typeNONE or ECN, and do so without fragmentation, afterVIRTIO_NET_F_MTUhas been success- fully negotiated.VIRTIO_NET_F_MTUhas been designed for all kind of tunneling devices,
and this is why we set mtu to max by default.Quoted 2 lines
For things like jumbo frames where MTU might or might not be available, a new feature would be more appropriate.
Quoted 5 lines
So for jumbo frame, what is the problem?
We are trying to do this. @Heng
Thanks.
It is not a problem as such. But VIRTIO_NET_F_MTU will set the default MTU not just the maximum one, because spec seems to say it can.
Quoted 35 lines
Quoted 35 lines
Quoted 34 lines
Quoted 34 lines
Quoted 15 lines
so I changed the MTU to a more
general 1500 when 'Device maximum MTU' bigger than 1500.Signed-off-by Hao Chen <[email protected]>--- drivers/net/virtio_net.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/virtio_net.c +0
-0drivers/net/virtio_net.c static int virtnet_probe(struct virtio_device *vdev) · line 4043
Quoted 5 lines
drivers/net/virtio_net.c +1
-1@@ -4040,7 +4040,10 @@ static int virtnet_probe(struct virtio_device *vdev) goto free; } - dev->mtu = mtu; +if (mtu >1500 )s/1500/ETH_DATA_LEN/
Thanks.
Quoted 9 lines
drivers/net/virtio_net.c +3
-1+ dev->mtu =1500 ; + else + dev->mtu = mtu; dev->max_mtu = mtu; } --2.27.0
Xuan Zhuo
reviewerQuoted 45 lines · Michael S. Tsirkin
Quoted 44 lines · Xuan Zhuo
Quoted 37 lines · Michael S. Tsirkin
Quoted 18 lines · Hao Chen
Quoted 9 lines · Xuan Zhuo
Quoted 6 lines · Hao Chen
When
VIRTIO_NET_F_MTU(3)Device maximum MTU reporting is supported. If offered by the device, device advises driver about the value of its maximum MTU. If negotiated, the driver uses mtu as the maximum MTU value. But there the driver also uses it as default mtu, some devices may have a maximum MTU greater than 1500, this may cause some large packages to be discarded,You mean tx packet?
Yes.
Quoted 5 lines
If yes, I do not think this is the problem of driver.
Maybe you should give more details about the discard.
Quoted 9 lines
In the current code, if the maximum MTU supported by the virtio net hardware is 9000, the default MTU of the virtio net driver will also be set to 9000. When sending packets through "ping -s 5000", if the peer router does not support negotiating a path MTU through ICMP packets, the packets will be discarded. If the peer router supports negotiating path mtu through ICMP packets, the host side will perform packet sharding processing based on the negotiated path mtu, which is generally within 1500.
This is not a bugfix patch, I think setting the default mtu to within 1500 would be more suitable here.Thanks.I don't think
VIRTIO_NET_F_MTUis appropriate for support for jumbo packets.
The spec says:
The device MUST forward transmitted packets of up to mtu (plus low level ethernet header length) size withgso_typeNONE or ECN, and do so without fragmentation, afterVIRTIO_NET_F_MTUhas been success- fully negotiated.VIRTIO_NET_F_MTUhas been designed for all kind of tunneling devices,
and this is why we set mtu to max by default.Quoted 2 lines
For things like jumbo frames where MTU might or might not be available, a new feature would be more appropriate.
So for jumbo frame, what is the problem?
Quoted 7 lines
Quoted 3 lines
We are trying to do this. @Heng
Thanks.
It is not a problem as such. But
VIRTIO_NET_F_MTUwill set the default MTU not just the maximum one, because spec seems to say it can.
I see.
In the case of Jumbo Frame, we also hope that the driver will set the default directly to the max mtu. Just like what you said "Bigger packets = better performance."
I don't know, in any scenario, when the hardware supports a large mtu, but we do not want the user to use it by default. Of course, the scene that this patch wants to handle does exist, but I have never thought that this is a problem at the driver level.
Thanks.
Quoted 38 lines
Quoted 37 lines
Quoted 37 lines
Quoted 36 lines
Quoted 36 lines
Quoted 17 lines
so I changed the MTU to a more
general 1500 when 'Device maximum MTU' bigger than 1500.Signed-off-by Hao Chen <[email protected]>--- drivers/net/virtio_net.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/virtio_net.c +0
-0drivers/net/virtio_net.c static int virtnet_probe(struct virtio_device *vdev) · line 4043
Quoted 5 lines
drivers/net/virtio_net.c +1
-1@@ -4040,7 +4040,10 @@ static int virtnet_probe(struct virtio_device *vdev) goto free; } - dev->mtu = mtu; +if (mtu >1500 )s/1500/ETH_DATA_LEN/
Thanks.
Quoted 9 lines
drivers/net/virtio_net.c +3
-1+ dev->mtu =1500 ; + else + dev->mtu = mtu; dev->max_mtu = mtu; } --2.27.0
Michael S. Tsirkin
maintainerQuoted 54 lines · Xuan Zhuo
Quoted 45 lines · Michael S. Tsirkin
Quoted 44 lines · Xuan Zhuo
Quoted 37 lines · Michael S. Tsirkin
Quoted 18 lines · Hao Chen
Quoted 9 lines · Xuan Zhuo
Quoted 6 lines · Hao Chen
When
VIRTIO_NET_F_MTU(3)Device maximum MTU reporting is supported. If offered by the device, device advises driver about the value of its maximum MTU. If negotiated, the driver uses mtu as the maximum MTU value. But there the driver also uses it as default mtu, some devices may have a maximum MTU greater than 1500, this may cause some large packages to be discarded,You mean tx packet?
Yes.
Quoted 5 lines
If yes, I do not think this is the problem of driver.
Maybe you should give more details about the discard.
Quoted 9 lines
In the current code, if the maximum MTU supported by the virtio net hardware is 9000, the default MTU of the virtio net driver will also be set to 9000. When sending packets through "ping -s 5000", if the peer router does not support negotiating a path MTU through ICMP packets, the packets will be discarded. If the peer router supports negotiating path mtu through ICMP packets, the host side will perform packet sharding processing based on the negotiated path mtu, which is generally within 1500.
This is not a bugfix patch, I think setting the default mtu to within 1500 would be more suitable here.Thanks.I don't think
VIRTIO_NET_F_MTUis appropriate for support for jumbo packets.
The spec says:
The device MUST forward transmitted packets of up to mtu (plus low level ethernet header length) size withgso_typeNONE or ECN, and do so without fragmentation, afterVIRTIO_NET_F_MTUhas been success- fully negotiated.VIRTIO_NET_F_MTUhas been designed for all kind of tunneling devices,
and this is why we set mtu to max by default.Quoted 2 lines
For things like jumbo frames where MTU might or might not be available, a new feature would be more appropriate.
So for jumbo frame, what is the problem?
Quoted 7 lines
Quoted 3 lines
We are trying to do this. @Heng
Thanks.
It is not a problem as such. But
VIRTIO_NET_F_MTUwill set the default MTU not just the maximum one, because spec seems to say it can.
Quoted 8 lines
I see.
In the case of Jumbo Frame, we also hope that the driver will set the default directly to the max mtu. Just like what you said "Bigger packets = better performance."
I don't know, in any scenario, when the hardware supports a large mtu, but we do not want the user to use it by default.
When other devices on the same LAN have mtu set to 1500 and won't accept bigger packets.
Quoted 45 lines
Of course, the scene that this patch
wants to handle does exist, but I have never thought that this is a problem at the driver level.Thanks.
Quoted 38 lines
Quoted 37 lines
Quoted 37 lines
Quoted 36 lines
Quoted 36 lines
Quoted 17 lines
so I changed the MTU to a more
general 1500 when 'Device maximum MTU' bigger than 1500.Signed-off-by Hao Chen <[email protected]>--- drivers/net/virtio_net.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/virtio_net.c +0
-0drivers/net/virtio_net.c static int virtnet_probe(struct virtio_device *vdev) · line 4043
Quoted 5 lines
drivers/net/virtio_net.c +1
-1@@ -4040,7 +4040,10 @@ static int virtnet_probe(struct virtio_device *vdev) goto free; } - dev->mtu = mtu; +if (mtu >1500 )s/1500/ETH_DATA_LEN/
Thanks.
Quoted 9 lines
drivers/net/virtio_net.c +3
-1+ dev->mtu =1500 ; + else + dev->mtu = mtu; dev->max_mtu = mtu; } --2.27.0
Xuan Zhuo
reviewerQuoted 61 lines · Michael S. Tsirkin
Quoted 60 lines · Xuan Zhuo
Quoted 45 lines · Michael S. Tsirkin
Quoted 44 lines · Xuan Zhuo
Quoted 37 lines · Michael S. Tsirkin
Quoted 18 lines · Hao Chen
Quoted 9 lines · Xuan Zhuo
Quoted 6 lines · Hao Chen
When
VIRTIO_NET_F_MTU(3)Device maximum MTU reporting is supported. If offered by the device, device advises driver about the value of its maximum MTU. If negotiated, the driver uses mtu as the maximum MTU value. But there the driver also uses it as default mtu, some devices may have a maximum MTU greater than 1500, this may cause some large packages to be discarded,You mean tx packet?
Yes.
Quoted 5 lines
If yes, I do not think this is the problem of driver.
Maybe you should give more details about the discard.
Quoted 9 lines
In the current code, if the maximum MTU supported by the virtio net hardware is 9000, the default MTU of the virtio net driver will also be set to 9000. When sending packets through "ping -s 5000", if the peer router does not support negotiating a path MTU through ICMP packets, the packets will be discarded. If the peer router supports negotiating path mtu through ICMP packets, the host side will perform packet sharding processing based on the negotiated path mtu, which is generally within 1500.
This is not a bugfix patch, I think setting the default mtu to within 1500 would be more suitable here.Thanks.I don't think
VIRTIO_NET_F_MTUis appropriate for support for jumbo packets.
The spec says:
The device MUST forward transmitted packets of up to mtu (plus low level ethernet header length) size withgso_typeNONE or ECN, and do so without fragmentation, afterVIRTIO_NET_F_MTUhas been success- fully negotiated.VIRTIO_NET_F_MTUhas been designed for all kind of tunneling devices,
and this is why we set mtu to max by default.Quoted 2 lines
For things like jumbo frames where MTU might or might not be available, a new feature would be more appropriate.
So for jumbo frame, what is the problem?
Quoted 7 lines
Quoted 3 lines
We are trying to do this. @Heng
Thanks.
It is not a problem as such. But
VIRTIO_NET_F_MTUwill set the default MTU not just the maximum one, because spec seems to say it can.I see.
In the case of Jumbo Frame, we also hope that the driver will set the default directly to the max mtu. Just like what you said "Bigger packets = better performance."
Quoted 5 lines
Quoted 2 lines
I don't know, in any scenario, when the hardware supports a large mtu, but we do not want the user to use it by default.
When other devices on the same LAN have mtu set to 1500 and won't accept bigger packets.
So, that depends on pmtu/tcp-probe-mtu.
If the os without pmtu/tcp-probe-mtu has a bigger mtu, then it's big packet will lost.
Thanks.
Quoted 47 lines
Quoted 46 lines
Of course, the scene that this patch
wants to handle does exist, but I have never thought that this is a problem at the driver level.Thanks.
Quoted 38 lines
Quoted 37 lines
Quoted 37 lines
Quoted 36 lines
Quoted 36 lines
Quoted 17 lines
so I changed the MTU to a more
general 1500 when 'Device maximum MTU' bigger than 1500.Signed-off-by Hao Chen <[email protected]>--- drivers/net/virtio_net.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/virtio_net.c +0
-0drivers/net/virtio_net.c static int virtnet_probe(struct virtio_device *vdev) · line 4043
Quoted 5 lines
drivers/net/virtio_net.c +1
-1@@ -4040,7 +4040,10 @@ static int virtnet_probe(struct virtio_device *vdev) goto free; } - dev->mtu = mtu; +if (mtu >1500 )s/1500/ETH_DATA_LEN/
Thanks.
Quoted 9 lines
drivers/net/virtio_net.c +3
-1+ dev->mtu =1500 ; + else + dev->mtu = mtu; dev->max_mtu = mtu; } --2.27.0
Michael S. Tsirkin
maintainerQuoted 68 lines · Xuan Zhuo
Quoted 61 lines · Michael S. Tsirkin
Quoted 60 lines · Xuan Zhuo
Quoted 45 lines · Michael S. Tsirkin
Quoted 44 lines · Xuan Zhuo
Quoted 37 lines · Michael S. Tsirkin
Quoted 18 lines · Hao Chen
Quoted 9 lines · Xuan Zhuo
Quoted 6 lines · Hao Chen
When
VIRTIO_NET_F_MTU(3)Device maximum MTU reporting is supported. If offered by the device, device advises driver about the value of its maximum MTU. If negotiated, the driver uses mtu as the maximum MTU value. But there the driver also uses it as default mtu, some devices may have a maximum MTU greater than 1500, this may cause some large packages to be discarded,You mean tx packet?
Yes.
Quoted 5 lines
If yes, I do not think this is the problem of driver.
Maybe you should give more details about the discard.
Quoted 9 lines
In the current code, if the maximum MTU supported by the virtio net hardware is 9000, the default MTU of the virtio net driver will also be set to 9000. When sending packets through "ping -s 5000", if the peer router does not support negotiating a path MTU through ICMP packets, the packets will be discarded. If the peer router supports negotiating path mtu through ICMP packets, the host side will perform packet sharding processing based on the negotiated path mtu, which is generally within 1500.
This is not a bugfix patch, I think setting the default mtu to within 1500 would be more suitable here.Thanks.I don't think
VIRTIO_NET_F_MTUis appropriate for support for jumbo packets.
The spec says:
The device MUST forward transmitted packets of up to mtu (plus low level ethernet header length) size withgso_typeNONE or ECN, and do so without fragmentation, afterVIRTIO_NET_F_MTUhas been success- fully negotiated.VIRTIO_NET_F_MTUhas been designed for all kind of tunneling devices,
and this is why we set mtu to max by default.Quoted 2 lines
For things like jumbo frames where MTU might or might not be available, a new feature would be more appropriate.
So for jumbo frame, what is the problem?
Quoted 7 lines
Quoted 3 lines
We are trying to do this. @Heng
Thanks.
It is not a problem as such. But
VIRTIO_NET_F_MTUwill set the default MTU not just the maximum one, because spec seems to say it can.I see.
In the case of Jumbo Frame, we also hope that the driver will set the default directly to the max mtu. Just like what you said "Bigger packets = better performance."
Quoted 5 lines
Quoted 2 lines
I don't know, in any scenario, when the hardware supports a large mtu, but we do not want the user to use it by default.
When other devices on the same LAN have mtu set to 1500 and won't accept bigger packets.
Quoted 7 lines
So, that depends on pmtu/tcp-probe-mtu.
If the os without pmtu/tcp-probe-mtu has a bigger mtu, then it's big packet will lost.
Thanks.
pmtu is designed for routing. LAN is supposed to be configured with a consistent MTU.
Quoted 47 lines
Quoted 47 lines
Quoted 46 lines
Of course, the scene that this patch
wants to handle does exist, but I have never thought that this is a problem at the driver level.Thanks.
Quoted 38 lines
Quoted 37 lines
Quoted 37 lines
Quoted 36 lines
Quoted 36 lines
Quoted 17 lines
so I changed the MTU to a more
general 1500 when 'Device maximum MTU' bigger than 1500.Signed-off-by Hao Chen <[email protected]>--- drivers/net/virtio_net.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/virtio_net.c +0
-0drivers/net/virtio_net.c static int virtnet_probe(struct virtio_device *vdev) · line 4043
Quoted 5 lines
drivers/net/virtio_net.c +1
-1@@ -4040,7 +4040,10 @@ static int virtnet_probe(struct virtio_device *vdev) goto free; } - dev->mtu = mtu; +if (mtu >1500 )s/1500/ETH_DATA_LEN/
Thanks.
Quoted 9 lines
drivers/net/virtio_net.c +3
-1+ dev->mtu =1500 ; + else + dev->mtu = mtu; dev->max_mtu = mtu; } --2.27.0
Quoted 8 lines · On Mon, 8 May 2023 06:30:07 -0400 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
I don't know, in any scenario, when the hardware supports a large mtu, but we do not want the user to use it by default.
When other devices on the same LAN have mtu set to 1500 and won't accept bigger packets.
So, that depends on pmtu/tcp-probe-mtu.
Quoted 8 lines
Quoted 5 lines
If the os without pmtu/tcp-probe-mtu has a bigger mtu, then it's big packet will lost.
Thanks.
pmtu is designed for routing. LAN is supposed to be configured with a consistent MTU.
Virtio is often used with bridging or macvlan which can't support PMTU. PMTU only works when forwarding at layer 3 (ie routing) where there is a IP address to send the ICMP response. If doing L2 forwarding, the only thin the bridge can do is drop the packet.
TCP cab recover but detecting an MTU blackhole requires retransmissions.
Michael S. Tsirkin
maintainerQuoted 20 lines · Stephen Hemminger
Quoted 8 lines · On Mon, 8 May 2023 06:30:07 -0400 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
I don't know, in any scenario, when the hardware supports a large mtu, but we do not want the user to use it by default.
When other devices on the same LAN have mtu set to 1500 and won't accept bigger packets.
So, that depends on pmtu/tcp-probe-mtu.
Quoted 8 lines
Quoted 5 lines
If the os without pmtu/tcp-probe-mtu has a bigger mtu, then it's big packet will lost.
Thanks.
pmtu is designed for routing. LAN is supposed to be configured with a consistent MTU.
Quoted 6 lines
Virtio is often used with bridging or macvlan which can't support PMTU. PMTU only works when forwarding at layer 3 (ie routing) where there is a IP address to send the ICMP response. If doing L2 forwarding, the only thin the bridge can do is drop the packet.
TCP cab recover but detecting an MTU blackhole requires retransmissions.
Exactly. That's why we basically use the MTU advice supplied by device by default - it's designed for use-cases of software devices where the device might have more information about the MTU than the guest. If hardware devices want e.g. a way to communicate support for jumbo frames without communicating any information about the LAN, a new feature will be needed.
Signature · 1 line
MST
Xuan Zhuo
reviewerQuoted 26 lines · Michael S. Tsirkin
Quoted 25 lines · Stephen Hemminger
Quoted 8 lines · On Mon, 8 May 2023 06:30:07 -0400 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
I don't know, in any scenario, when the hardware supports a large mtu, but we do not want the user to use it by default.
When other devices on the same LAN have mtu set to 1500 and won't accept bigger packets.
So, that depends on pmtu/tcp-probe-mtu.
Quoted 8 lines
Quoted 5 lines
If the os without pmtu/tcp-probe-mtu has a bigger mtu, then it's big packet will lost.
Thanks.
pmtu is designed for routing. LAN is supposed to be configured with a consistent MTU.
Virtio is often used with bridging or macvlan which can't support PMTU. PMTU only works when forwarding at layer 3 (ie routing) where there is a IP address to send the ICMP response. If doing L2 forwarding, the only thin the bridge can do is drop the packet.
Quoted 8 lines
Quoted 1 line
TCP cab recover but detecting an MTU blackhole requires retransmissions.
Exactly. That's why we basically use the MTU advice supplied by device by default - it's designed for use-cases of software devices where the device might have more information about the MTU than the guest. If hardware devices want e.g. a way to communicate support for jumbo frames without communicating any information about the LAN, a new feature will be needed.
Let's think this question carefully. If necessary, we will try to introduce a new feature for virtio-net spec to support Jumbo Frame.
Thanks.
Quoted 4 lines
--
MST
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 1 line · Hao Chen
In the current code, if the maximum MTU supported by the virtio net hardware is 9000, the default MTU of the virtio net driver will also be set to 9000. When sending packets through "ping -s 5000", if the peer router does not support negotiating a path MTU through ICMP packets, the packets will be discarded.
That router is just plain broken, and it's going to break all kinds of traffic. Hacking the virtio-net MTU is only a partial workaround.
Surely the correct fix here is to apply percussive education to whatever idiot thought it was OK to block ICMP. Not to hack the default MTU of one device to the lowest common denominator.
Michael S. Tsirkin
maintainerQuoted 8 lines · David Woodhouse
Quoted 1 line · Hao Chen
In the current code, if the maximum MTU supported by the virtio net hardware is 9000, the default MTU of the virtio net driver will also be set to 9000. When sending packets through "ping -s 5000", if the peer router does not support negotiating a path MTU through ICMP packets, the packets will be discarded.
That router is just plain broken, and it's going to break all kinds of traffic. Hacking the virtio-net MTU is only a partial workaround.
Surely the correct fix here is to apply percussive education to whatever idiot thought it was OK to block ICMP. Not to hack the default MTU of one device to the lowest common denominator.
Yea I don't understand what does path MTU have to do with it. MTU has to be set the same for all endpoints on LAN, that's a fundamental assumption that ethernet makes. Going outside LAN all best are off.
Signature · 1 line
MST
Michael S. Tsirkin
maintainerQuoted 9 lines · Hao Chen
When
VIRTIO_NET_F_MTU(3)Device maximum MTU reporting is supported. If offered by the device, device advises driver about the value of its maximum MTU. If negotiated, the driver uses mtu as the maximum MTU value. But there the driver also uses it as default mtu, some devices may have a maximum MTU greater than 1500, this may cause some large packages to be discarded, so I changed the MTU to a more general 1500 when 'Device maximum MTU' bigger than 1500.Signed-off-by Hao Chen <[email protected]>
I don't see why not use the maximum. Bigger packets = better performance.
Quoted 22 lines
--- drivers/net/virtio_net.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/virtio_net.c +4
-1@@ -4040,7 +4040,10 @@ static int virtnet_probe(struct virtio_device *vdev) goto free; } - dev->mtu = mtu; +if (mtu >1500 ) + dev->mtu =1500 ; +else + dev->mtu = mtu; dev->max_mtu = mtu; }Signature · 1 line
2.27.0