Skip to contentSkip to conversation

Update netif public header

PATCH In review Wei Liu 4 participants 10 messages Apr 30, 2013 – May 7, 2013

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

cover Update netif public header

These constants were added when fixing XSA-39 regression. Keep master copy in Xen up to date with this series.

Thanks
Wei.

author
#1 lore raw

PATCH 1/2 netif: define XEN_NETIF_MAX_TX_SIZE in public header

This is the maximum supportted size of a packet.

---
 xen/include/public/io/netif.h |    1 +
 1 file changed, 1 insertion(+)
xen/include/public/io/netif.h +1 -0
index b184e49..ccde53b 100644
@@ -65,6 +65,7 @@
 #define _NETTXF_extra_info     (3)
 #define  NETTXF_extra_info     (1U<<_NETTXF_extra_info)
 
+#define XEN_NETIF_MAX_TX_SIZE 0xFFFF
 struct netif_tx_request {
     grant_ref_t gref;      /* Reference to buffer page */
     uint16_t offset;       /* Offset within buffer page */
Signature · 1 line
1.7.10.4
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] netif: define XEN_NETIF_MAX_TX_SIZE in public header

Quoted 1 line · Wei Liu

This is the maximum supportted size of a packet.

Too many t's in supported.

Worth mentioning that this limit comes from the size of netif_tx_request.size.

Quoted 1 line
Quoted 16 lines
---
 xen/include/public/io/netif.h |    1 +
 1 file changed, 1 insertion(+)
xen/include/public/io/netif.h +1 -0
index b184e49..ccde53b 100644
@@ -65,6 +65,7 @@
 #define _NETTXF_extra_info     (3)
 #define  NETTXF_extra_info     (1U<<_NETTXF_extra_info)
 
+#define XEN_NETIF_MAX_TX_SIZE 0xFFFF
 struct netif_tx_request {
     grant_ref_t gref;      /* Reference to buffer page */
     uint16_t offset;       /* Offset within buffer page */
author Acked-by Ian Campbell
#3 lore raw

Re: [PATCH 1/2] netif: define XEN_NETIF_MAX_TX_SIZE in public header

Quoted 13 lines · Ian Campbell
Quoted 1 line · Wei Liu

This is the maximum supportted size of a packet.

Too many t's in supported.

Worth mentioning that this limit comes from the size of netif_tx_request.size.

Quoted 1 line
Quoted 1 line

---

-------8<----

Quoted 1 line

From b52999bc45cf1fcac369346c14b03bcf844db410 Mon Sep 17 00:00:00 2001

From: Wei Liu <[email protected]>
Date: Tue, 30 Apr 2013 17:58:48 +0100
Subject: [PATCH] netif: define XEN_NETIF_MAX_TX_SIZE in public header

This is the maximum supported size of a packet. It comes from the size of netif_tx_request.size.

---
 xen/include/public/io/netif.h |    1 +
 1 file changed, 1 insertion(+)
xen/include/public/io/netif.h +1 -0
index b184e49..ccde53b 100644
@@ -65,6 +65,7 @@
 #define _NETTXF_extra_info     (3)
 #define  NETTXF_extra_info     (1U<<_NETTXF_extra_info)
 
+#define XEN_NETIF_MAX_TX_SIZE 0xFFFF
 struct netif_tx_request {
     grant_ref_t gref;      /* Reference to buffer page */
     uint16_t offset;       /* Offset within buffer page */
Signature · 1 line
1.7.10.4
Acked-by on v1 1/2
#4 lore raw

Re: [PATCH 1/2] netif: define XEN_NETIF_MAX_TX_SIZE in public header

In reply to Wei Liu
Quoted 3 lines · Wei Liu

This is the maximum supportted size of a packet.

Quoted 16 lines
---
 xen/include/public/io/netif.h |    1 +
 1 file changed, 1 insertion(+)
xen/include/public/io/netif.h +1 -0
index b184e49..ccde53b 100644
@@ -65,6 +65,7 @@
 #define _NETTXF_extra_info     (3)
 #define  NETTXF_extra_info     (1U<<_NETTXF_extra_info)
 
+#define XEN_NETIF_MAX_TX_SIZE 0xFFFF
 struct netif_tx_request {
     grant_ref_t gref;      /* Reference to buffer page */
     uint16_t offset;       /* Offset within buffer page */
author
#5 lore raw

PATCH 2/2 netif: define XEN_NETIF_NR_SLOTS_MIN in public header

In reply to Wei Liu

Xen network protocol has implicit dependency on MAX_SKB_FRAGS. In order to remove dependency on MAX_SKB_FRAGS, we derive a constant from historical MAX_SKB_FRAGS for future reference.

---
 xen/include/public/io/netif.h |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
xen/include/public/io/netif.h +18 -0
index ccde53b..9664998 100644
@@ -31,6 +31,24 @@
 #include "../grant_table.h"
 
 /*
+ * Older implementation of Xen network frontend / backend has an
+ * implicit dependency on the MAX_SKB_FRAGS as the maximum number of
+ * ring slots a skb can use. Netfront / netback may not work as
+ * expected when frontend and backend have different MAX_SKB_FRAGS.
+ *
+ * A better approach is to add mechanism for netfront / netback to
+ * negotiate this value. However we cannot fix all possible
+ * frontends, so we need to define a value which states the minimum
+ * slots backend must support.
+ *
+ * The minimum value derives from older Linux kernel's MAX_SKB_FRAGS
+ * (18), which is proved to work with most frontends. Any new backend
+ * which doesn't negotiate with frontend should expect frontend to
+ * send a valid packet using slots up to this value.
+ */
+#define XEN_NETIF_NR_SLOTS_MIN 18
+
+/*
  * Notifications after enqueuing any type of message should be conditional on
  * the appropriate req_event or rsp_event field in the shared ring.
  * If the client sends notification for rx requests then it should specify
Signature · 1 line
1.7.10.4
Acked-by on v1 2/2
#6 lore raw

Re: [PATCH 2/2] netif: define XEN_NETIF_NR_SLOTS_MIN in public header

Quoted 5 lines · Wei Liu

Xen network protocol has implicit dependency on MAX_SKB_FRAGS. In order to remove dependency on MAX_SKB_FRAGS, we derive a constant from historical MAX_SKB_FRAGS for future reference.

Quoted 33 lines
---
 xen/include/public/io/netif.h |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
xen/include/public/io/netif.h +18 -0
index ccde53b..9664998 100644
@@ -31,6 +31,24 @@
 #include "../grant_table.h"
 
 /*
+ * Older implementation of Xen network frontend / backend has an
+ * implicit dependency on the MAX_SKB_FRAGS as the maximum number of
+ * ring slots a skb can use. Netfront / netback may not work as
+ * expected when frontend and backend have different MAX_SKB_FRAGS.
+ *
+ * A better approach is to add mechanism for netfront / netback to
+ * negotiate this value. However we cannot fix all possible
+ * frontends, so we need to define a value which states the minimum
+ * slots backend must support.
+ *
+ * The minimum value derives from older Linux kernel's MAX_SKB_FRAGS
+ * (18), which is proved to work with most frontends. Any new backend
+ * which doesn't negotiate with frontend should expect frontend to
+ * send a valid packet using slots up to this value.
+ */
+#define XEN_NETIF_NR_SLOTS_MIN 18
+
+/*
  * Notifications after enqueuing any type of message should be conditional on
  * the appropriate req_event or rsp_event field in the shared ring.
  * If the client sends notification for rx requests then it should specify
#7 lore raw

interface header maintainership (was Re: [PATCH 2/2] netif: define XEN_NETIF_NR_SLOTS_MIN in public header)

Quoted 9 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 5 lines · Wei Liu

Xen network protocol has implicit dependency on MAX_SKB_FRAGS. In order to remove dependency on MAX_SKB_FRAGS, we derive a constant from historical MAX_SKB_FRAGS for future reference.

In order to not require Keir to ack any trivial change like this, wouldn't it make sense to list you as the maintainer for xen/include/public/io/netif.h, and Konrad similarly for blkif.h, matching the Linux side maintainership?

Which reminds me that blkif.h too is lagging behind what's being done in Linux (wrt indirect requests)...

Jan

#8 lore raw

Re: interface header maintainership (was Re: [PATCH 2/2] netif: define XEN_NETIF_NR_SLOTS_MIN in public header)

Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 4 lines · Wei Liu

Xen network protocol has implicit dependency on MAX_SKB_FRAGS. In order to remove dependency on MAX_SKB_FRAGS, we derive a constant from historical MAX_SKB_FRAGS for future reference.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

In order to not require Keir to ack any trivial change like this, wouldn't it make sense to list you as the maintainer for xen/include/public/io/netif.h, and Konrad similarly for blkif.h, matching the Linux side maintainership?

My only concern is that the I/O interfaces should be independent from the Linux implementation and by having the Linux maintainer be the *if.h maintainer risks unintentionally baking (more) Linux'isms into our interfaces or at least failing to fully consider the other OSes.

So I think any decision regarding maintainership of io/*.h should be made independently of the Linux maintainership, even if the result is that the "best" person happens to also be the Linux maintainer.

With that said I'm happy to try and wear both hats at the appropriate times.

Ian.

Acked-by on v1 2/2
#9 lore raw

Re: [PATCH 2/2] netif: define XEN_NETIF_NR_SLOTS_MIN in public header

In reply to Wei Liu
Quoted 5 lines · Wei Liu

Xen network protocol has implicit dependency on MAX_SKB_FRAGS. In order to remove dependency on MAX_SKB_FRAGS, we derive a constant from historical MAX_SKB_FRAGS for future reference.

Quoted 33 lines
---
 xen/include/public/io/netif.h |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
xen/include/public/io/netif.h +18 -0
index ccde53b..9664998 100644
@@ -31,6 +31,24 @@
 #include "../grant_table.h"
 
 /*
+ * Older implementation of Xen network frontend / backend has an
+ * implicit dependency on the MAX_SKB_FRAGS as the maximum number of
+ * ring slots a skb can use. Netfront / netback may not work as
+ * expected when frontend and backend have different MAX_SKB_FRAGS.
+ *
+ * A better approach is to add mechanism for netfront / netback to
+ * negotiate this value. However we cannot fix all possible
+ * frontends, so we need to define a value which states the minimum
+ * slots backend must support.
+ *
+ * The minimum value derives from older Linux kernel's MAX_SKB_FRAGS
+ * (18), which is proved to work with most frontends. Any new backend
+ * which doesn't negotiate with frontend should expect frontend to
+ * send a valid packet using slots up to this value.
+ */
+#define XEN_NETIF_NR_SLOTS_MIN 18
+
+/*
  * Notifications after enqueuing any type of message should be conditional on
  * the appropriate req_event or rsp_event field in the shared ring.
  * If the client sends notification for rx requests then it should specify