Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1358244 > unrolled thread
| Started by | Aaron Conole <aconole@redhat.com> |
|---|---|
| First post | 2016-03-15 22:10 +0100 |
| Last post | 2016-03-17 23:10 +0100 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[RFC v2 -next 1/2] virtio: Start feature MTU support Aaron Conole <aconole@redhat.com> - 2016-03-15 22:10 +0100
Re: [RFC v2 -next 1/2] virtio: Start feature MTU support Stephen Hemminger <stephen@networkplumber.org> - 2016-03-16 19:30 +0100
Re: [RFC v2 -next 1/2] virtio: Start feature MTU support "Michael S. Tsirkin" <mst@redhat.com> - 2016-03-16 19:40 +0100
Re: [RFC v2 -next 1/2] virtio: Start feature MTU support Aaron Conole <aconole@redhat.com> - 2016-03-17 22:20 +0100
Re: [RFC v2 -next 1/2] virtio: Start feature MTU support Stephen Hemminger <stephen@networkplumber.org> - 2016-03-17 23:10 +0100
| From | Aaron Conole <aconole@redhat.com> |
|---|---|
| Date | 2016-03-15 22:10 +0100 |
| Subject | [RFC v2 -next 1/2] virtio: Start feature MTU support |
| Message-ID | <rd4o2-7FE-9@gated-at.bofh.it> |
This commit adds the feature bit and associated mtu device entry for the
virtio network device. Future commits will make use of these bits to support
negotiated MTU.
Signed-off-by: Aaron Conole <aconole@bytheb.org>
---
v2:
* No change
include/uapi/linux/virtio_net.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
index ec32293..41a6a01 100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -55,6 +55,7 @@
#define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow
* Steering */
#define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */
+#define VIRTIO_NET_F_MTU 25 /* Device supports Default MTU Negotiation */
#ifndef VIRTIO_NET_NO_LEGACY
#define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */
@@ -73,6 +74,8 @@ struct virtio_net_config {
* Legal values are between 1 and 0x8000
*/
__u16 max_virtqueue_pairs;
+ /* Default maximum transmit unit advice */
+ __u16 mtu;
} __attribute__((packed));
/*
--
2.5.0
[toc] | [next] | [standalone]
| From | Stephen Hemminger <stephen@networkplumber.org> |
|---|---|
| Date | 2016-03-16 19:30 +0100 |
| Message-ID | <rdomJ-4bz-1@gated-at.bofh.it> |
| In reply to | #1358244 |
On Tue, 15 Mar 2016 17:04:12 -0400
Aaron Conole <aconole@redhat.com> wrote:
> --- a/include/uapi/linux/virtio_net.h
> +++ b/include/uapi/linux/virtio_net.h
> @@ -55,6 +55,7 @@
> #define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow
> * Steering */
> #define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */
> +#define VIRTIO_NET_F_MTU 25 /* Device supports Default MTU Negotiation */
>
> #ifndef VIRTIO_NET_NO_LEGACY
> #define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */
> @@ -73,6 +74,8 @@ struct virtio_net_config {
> * Legal values are between 1 and 0x8000
> */
> __u16 max_virtqueue_pairs;
> + /* Default maximum transmit unit advice */
> + __u16 mtu;
> } __attribute__((packed));
>
> /*
You can't change user visible headers without breaking ABI.
This structure might be used by other user code. Also how can this
work if host is using old size of structure.
[toc] | [prev] | [next] | [standalone]
| From | "Michael S. Tsirkin" <mst@redhat.com> |
|---|---|
| Date | 2016-03-16 19:40 +0100 |
| Message-ID | <rdowq-4gp-17@gated-at.bofh.it> |
| In reply to | #1359218 |
On Wed, Mar 16, 2016 at 11:23:14AM -0700, Stephen Hemminger wrote:
> On Tue, 15 Mar 2016 17:04:12 -0400
> Aaron Conole <aconole@redhat.com> wrote:
>
> > --- a/include/uapi/linux/virtio_net.h
> > +++ b/include/uapi/linux/virtio_net.h
> > @@ -55,6 +55,7 @@
> > #define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow
> > * Steering */
> > #define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */
> > +#define VIRTIO_NET_F_MTU 25 /* Device supports Default MTU Negotiation */
> >
> > #ifndef VIRTIO_NET_NO_LEGACY
> > #define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */
> > @@ -73,6 +74,8 @@ struct virtio_net_config {
> > * Legal values are between 1 and 0x8000
> > */
> > __u16 max_virtqueue_pairs;
> > + /* Default maximum transmit unit advice */
> > + __u16 mtu;
> > } __attribute__((packed));
> >
> > /*
>
> You can't change user visible headers without breaking ABI.
> This structure might be used by other user code.
Then this userspace is broken.
If someone uses virtio code one has to follow virtio spec.
And Virtio spec makes it very clear that
1. config space size can change at any time
2. fields can only be accessed if the correct feature bit
has been both advertized in host bitmap and acknowledged
in guest bitmap
> Also how can this
> work if host is using old size of structure.
It works because access is guarded by feature bit check.
--
MST
[toc] | [prev] | [next] | [standalone]
| From | Aaron Conole <aconole@redhat.com> |
|---|---|
| Date | 2016-03-17 22:20 +0100 |
| Message-ID | <rdNuN-4lS-3@gated-at.bofh.it> |
| In reply to | #1359218 |
Stephen Hemminger <stephen@networkplumber.org> writes:
> On Tue, 15 Mar 2016 17:04:12 -0400
> Aaron Conole <aconole@redhat.com> wrote:
>
>> --- a/include/uapi/linux/virtio_net.h
>> +++ b/include/uapi/linux/virtio_net.h
>> @@ -55,6 +55,7 @@
>> #define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow
>> * Steering */
>> #define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */
>> +#define VIRTIO_NET_F_MTU 25 /* Device supports Default MTU Negotiation */
>>
>> #ifndef VIRTIO_NET_NO_LEGACY
>> #define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */
>> @@ -73,6 +74,8 @@ struct virtio_net_config {
>> * Legal values are between 1 and 0x8000
>> */
>> __u16 max_virtqueue_pairs;
>> + /* Default maximum transmit unit advice */
>> + __u16 mtu;
>> } __attribute__((packed));
>>
>> /*
>
> You can't change user visible headers without breaking ABI.
> This structure might be used by other user code. Also how can this
> work if host is using old size of structure.
How else can this field be added and remain compliant with the spec? The
spec requires that mtu be passed in the virtio_net_config field.
As for old sizeof, I think the absence of the VIRTIO_NET_F_MTU bit being
asserted is confirmation that mtu is not valid (at least, it is implied
in the spec).
Thanks so much for the review, Stephen!
-Aaron
[toc] | [prev] | [next] | [standalone]
| From | Stephen Hemminger <stephen@networkplumber.org> |
|---|---|
| Date | 2016-03-17 23:10 +0100 |
| Message-ID | <rdOhc-4TJ-7@gated-at.bofh.it> |
| In reply to | #1360199 |
On Thu, 17 Mar 2016 17:10:55 -0400
Aaron Conole <aconole@redhat.com> wrote:
> Stephen Hemminger <stephen@networkplumber.org> writes:
>
> > On Tue, 15 Mar 2016 17:04:12 -0400
> > Aaron Conole <aconole@redhat.com> wrote:
> >
> >> --- a/include/uapi/linux/virtio_net.h
> >> +++ b/include/uapi/linux/virtio_net.h
> >> @@ -55,6 +55,7 @@
> >> #define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow
> >> * Steering */
> >> #define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */
> >> +#define VIRTIO_NET_F_MTU 25 /* Device supports Default MTU Negotiation */
> >>
> >> #ifndef VIRTIO_NET_NO_LEGACY
> >> #define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */
> >> @@ -73,6 +74,8 @@ struct virtio_net_config {
> >> * Legal values are between 1 and 0x8000
> >> */
> >> __u16 max_virtqueue_pairs;
> >> + /* Default maximum transmit unit advice */
> >> + __u16 mtu;
> >> } __attribute__((packed));
> >>
> >> /*
> >
> > You can't change user visible headers without breaking ABI.
> > This structure might be used by other user code. Also how can this
> > work if host is using old size of structure.
>
> How else can this field be added and remain compliant with the spec? The
> spec requires that mtu be passed in the virtio_net_config field.
>
> As for old sizeof, I think the absence of the VIRTIO_NET_F_MTU bit being
> asserted is confirmation that mtu is not valid (at least, it is implied
> in the spec).
Michael is right as long as the code checks for MTU flag before
referencing the mtu field, everything is fine. Actually, the structure
is never used directly only by fetching fields with offsetof
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web