xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/8] tools: propogate MTU to vif frontends
@ 2020-08-11  8:01 Paul Durrant
  2020-08-11  8:01 ` [PATCH v3 1/8] public/io/netif: specify MTU override node Paul Durrant
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Paul Durrant @ 2020-08-11  8:01 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Julien Grall, Wei Liu, Andrew Cooper,
	Paul Durrant, Ian Jackson, George Dunlap, Jan Beulich,
	Anthony PERARD

From: Paul Durrant <pdurrant@amazon.com>

This is an expansion from v2 of the series to include the facility to set
the MTU in the vif config.

There is also one cleanup patch to remove the defunct 'vif2' script.

Paul Durrant (8):
  public/io/netif: specify MTU override node
  tools/hotplug/Linux: re-factor add_to_bridge() in
    xen-network-common.sh
  tools/hotplug/Linux: add remove_from_bridge()
  tools/hotplug/Linux: remove code duplication in vif-bridge
  libxl: wire the libxl_device_nic 'mtu' value into xenstore
  tools/hotplug/Linux: modify set_mtu() to optionally use a configured
    value...
  xl: add 'mtu' option to network configuration
  remove netchannel2 hotplug script... ancient history

 docs/man/xl-network-configuration.5.pod   |  6 +++
 docs/misc/xenstore-paths.pandoc           |  3 ++
 tools/hotplug/Linux/Makefile              |  1 -
 tools/hotplug/Linux/vif-bridge            | 20 +++----
 tools/hotplug/Linux/vif2                  | 54 -------------------
 tools/hotplug/Linux/xen-network-common.sh | 65 +++++++++++++++++++----
 tools/libxl/libxl_nic.c                   | 27 +++++++++-
 tools/xl/xl_cmdtable.c                    |  2 +-
 tools/xl/xl_parse.c                       |  2 +
 xen/include/public/io/netif.h             | 12 +++++
 10 files changed, 110 insertions(+), 82 deletions(-)
 delete mode 100644 tools/hotplug/Linux/vif2
---
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Anthony PERARD <anthony.perard@citrix.com>
Cc: George Dunlap <george.dunlap@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Julien Grall <julien@xen.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Wei Liu <wl@xen.org>
-- 
2.20.1



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v3 1/8] public/io/netif: specify MTU override node
  2020-08-11  8:01 [PATCH v3 0/8] tools: propogate MTU to vif frontends Paul Durrant
@ 2020-08-11  8:01 ` Paul Durrant
  2020-08-14 16:24   ` Wei Liu
  2020-08-11  8:01 ` [PATCH v3 2/8] tools/hotplug/Linux: re-factor add_to_bridge() in xen-network-common.sh Paul Durrant
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 12+ messages in thread
From: Paul Durrant @ 2020-08-11  8:01 UTC (permalink / raw)
  To: xen-devel
  Cc: Juergen Gross, Stefano Stabellini, Julien Grall, Wei Liu,
	Andrew Cooper, Paul Durrant, Ian Jackson, George Dunlap,
	Jan Beulich

From: Paul Durrant <pdurrant@amazon.com>

There is currently no documentation to state what MTU a frontend should
adertise to its network stack. It has however long been assumed that the
default value of 1500 is correct.

This patch specifies a mechanism to allow the tools to set the MTU via a
xenstore node in the frontend area and states that the absence of that node
means the frontend should assume an MTU of 1500 octets.

NOTE: The Windows PV frontend has used an MTU sampled from the xenstore
      node specified in this patch.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <george.dunlap@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Julien Grall <julien@xen.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Wei Liu <wl@xen.org>

v2:
 - Add a note in xenstore-paths highlighting the new xenstore node
---
 docs/misc/xenstore-paths.pandoc |  3 +++
 xen/include/public/io/netif.h   | 12 ++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/docs/misc/xenstore-paths.pandoc b/docs/misc/xenstore-paths.pandoc
index 766e8008dc..5cd5c8a3b9 100644
--- a/docs/misc/xenstore-paths.pandoc
+++ b/docs/misc/xenstore-paths.pandoc
@@ -298,6 +298,9 @@ A virtual keyboard device frontend. Described by
 A virtual network device frontend. Described by
 [xen/include/public/io/netif.h][NETIF]
 
+NOTE: ~/device/vif/$DEVID/mtu can be used to inform the frontend of an
+      increased MTU. (The default MTU is 1500 octets).
+
 #### ~/device/vscsi/$DEVID/* []
 
 A virtual scsi device frontend. Described by
diff --git a/xen/include/public/io/netif.h b/xen/include/public/io/netif.h
index 9fcf91a2fe..00dd258712 100644
--- a/xen/include/public/io/netif.h
+++ b/xen/include/public/io/netif.h
@@ -204,6 +204,18 @@
  * present).
  */
 
+/*
+ * MTU
+ * ===
+ *
+ * The toolstack may set a value of MTU for the frontend by setting the
+ * /local/domain/<domid>/device/vif/<vif>/mtu node with the MTU value in
+ * octets. If this node is absent the frontend should assume an MTU value
+ * of 1500 octets. A frontend is also at liberty to ignore this value so
+ * it is only suitable for informing the frontend that a packet payload
+ * >1500 octets is permitted.
+ */
+
 /*
  * Hash types
  * ==========
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 2/8] tools/hotplug/Linux: re-factor add_to_bridge() in xen-network-common.sh
  2020-08-11  8:01 [PATCH v3 0/8] tools: propogate MTU to vif frontends Paul Durrant
  2020-08-11  8:01 ` [PATCH v3 1/8] public/io/netif: specify MTU override node Paul Durrant
@ 2020-08-11  8:01 ` Paul Durrant
  2020-08-11  8:01 ` [PATCH v3 3/8] tools/hotplug/Linux: add remove_from_bridge() Paul Durrant
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Paul Durrant @ 2020-08-11  8:01 UTC (permalink / raw)
  To: xen-devel; +Cc: Paul Durrant, Ian Jackson, Wei Liu

From: Paul Durrant <pdurrant@amazon.com>

Remove duplication of 'ip link set dev'. It is perfectly fine to call it
even if the device has already been added to the bridge.

NOTE: This patch also adds code to write a debug log entry if the device
      was already on the bridge.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wl@xen.org>

v3:
 - Re-factored from "tools/hotplug: add remove_from_bridge() and improve
   debug output" in v2
---
 tools/hotplug/Linux/xen-network-common.sh | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/tools/hotplug/Linux/xen-network-common.sh b/tools/hotplug/Linux/xen-network-common.sh
index 8dd3a62068..ec3bd4ec4a 100644
--- a/tools/hotplug/Linux/xen-network-common.sh
+++ b/tools/hotplug/Linux/xen-network-common.sh
@@ -126,16 +126,18 @@ add_to_bridge () {
     local bridge=$1
     local dev=$2
 
-    # Don't add $dev to $bridge if it's already on a bridge.
-    if [ -e "/sys/class/net/${bridge}/brif/${dev}" ]; then
-	ip link set dev ${dev} up || true
-	return
-    fi
-    if which brctl >&/dev/null; then
-        brctl addif ${bridge} ${dev}
+    # Don't add $dev to $bridge if it's already on the bridge.
+    if [ ! -e "/sys/class/net/${bridge}/brif/${dev}" ]; then
+        log debug "adding $dev to bridge $bridge"
+        if which brctl >&/dev/null; then
+            brctl addif ${bridge} ${dev}
+        else
+            ip link set ${dev} master ${bridge}
+        fi
     else
-        ip link set ${dev} master ${bridge}
+        log debug "$dev already on bridge $bridge"
     fi
+
     ip link set dev ${dev} up
 }
 
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 3/8] tools/hotplug/Linux: add remove_from_bridge()
  2020-08-11  8:01 [PATCH v3 0/8] tools: propogate MTU to vif frontends Paul Durrant
  2020-08-11  8:01 ` [PATCH v3 1/8] public/io/netif: specify MTU override node Paul Durrant
  2020-08-11  8:01 ` [PATCH v3 2/8] tools/hotplug/Linux: re-factor add_to_bridge() in xen-network-common.sh Paul Durrant
@ 2020-08-11  8:01 ` Paul Durrant
  2020-08-11  8:01 ` [PATCH v3 4/8] tools/hotplug/Linux: remove code duplication in vif-bridge Paul Durrant
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Paul Durrant @ 2020-08-11  8:01 UTC (permalink / raw)
  To: xen-devel; +Cc: Paul Durrant, Ian Jackson, Wei Liu

From: Paul Durrant <pdurrant@amazon.com>

This patch adds a remove_from_bridge() function into xen-network-common.sh
to partner with the existing add_to_bridge() function. The vif-bridge
script is then modified to use it.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wl@xen.org>

v3:
 - Re-factored from "tools/hotplug: add remove_from_bridge() and improve
   debug output" and "tools/hotplug: combine add/online and remove/offline
   in vif-bridge..." in v2
---
 tools/hotplug/Linux/vif-bridge            |  7 +------
 tools/hotplug/Linux/xen-network-common.sh | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/tools/hotplug/Linux/vif-bridge b/tools/hotplug/Linux/vif-bridge
index e722090ca8..c3e409926d 100644
--- a/tools/hotplug/Linux/vif-bridge
+++ b/tools/hotplug/Linux/vif-bridge
@@ -84,12 +84,7 @@ case "$command" in
         ;;
 
     offline)
-        if which brctl >&/dev/null; then
-            do_without_error brctl delif "$bridge" "$dev"
-        else
-            do_without_error ip link set "$dev" nomaster
-        fi
-        do_without_error ifconfig "$dev" down
+        remove_from_bridge "$bridge" "$dev"
         ;;
 
     add)
diff --git a/tools/hotplug/Linux/xen-network-common.sh b/tools/hotplug/Linux/xen-network-common.sh
index ec3bd4ec4a..6a0904361f 100644
--- a/tools/hotplug/Linux/xen-network-common.sh
+++ b/tools/hotplug/Linux/xen-network-common.sh
@@ -141,6 +141,25 @@ add_to_bridge () {
     ip link set dev ${dev} up
 }
 
+remove_from_bridge () {
+    local bridge=$1
+    local dev=$2
+
+    do_without_error ip link set dev ${dev} down
+
+    # Don't remove $dev from $bridge if it's not on the bridge.
+    if [ -e "/sys/class/net/${bridge}/brif/${dev}" ]; then
+        log debug "removing $dev from bridge $bridge"
+        if which brctl >&/dev/null; then
+            do_without_error brctl delif ${bridge} ${dev}
+        else
+            do_without_error ip link set ${dev} nomaster
+        fi
+    else
+        log debug "$dev not on bridge $bridge"
+    fi
+}
+
 # Usage: set_mtu bridge dev
 set_mtu () {
     local bridge=$1
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 4/8] tools/hotplug/Linux: remove code duplication in vif-bridge
  2020-08-11  8:01 [PATCH v3 0/8] tools: propogate MTU to vif frontends Paul Durrant
                   ` (2 preceding siblings ...)
  2020-08-11  8:01 ` [PATCH v3 3/8] tools/hotplug/Linux: add remove_from_bridge() Paul Durrant
@ 2020-08-11  8:01 ` Paul Durrant
  2020-08-11  8:01 ` [PATCH v3 5/8] libxl: wire the libxl_device_nic 'mtu' value into xenstore Paul Durrant
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Paul Durrant @ 2020-08-11  8:01 UTC (permalink / raw)
  To: xen-devel; +Cc: Paul Durrant, Ian Jackson, Wei Liu

From: Paul Durrant <pdurrant@amazon.com>

The 'add' and 'online' cases do exactly the same thing so have 'add' simply
fall through to 'online'.

NOTE: This patch also adds in the missing 'remove' case, which falls though
      to 'offline'. (The former is passed for 'tap' devices, the latter for
      'vif' devices).

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wl@xen.org>

v3:
 - Re-factored from "tools/hotplug: combine add/online and remove/offline
   in vif-bridge..." in v2
---
 tools/hotplug/Linux/vif-bridge | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/tools/hotplug/Linux/vif-bridge b/tools/hotplug/Linux/vif-bridge
index c3e409926d..e1d7c49788 100644
--- a/tools/hotplug/Linux/vif-bridge
+++ b/tools/hotplug/Linux/vif-bridge
@@ -77,21 +77,18 @@ then
 fi
 
 case "$command" in
+    add)
+        ;&
     online)
         setup_virtual_bridge_port "$dev"
         set_mtu "$bridge" "$dev"
         add_to_bridge "$bridge" "$dev"
         ;;
-
+    remove)
+        ;&
     offline)
         remove_from_bridge "$bridge" "$dev"
         ;;
-
-    add)
-        setup_virtual_bridge_port "$dev"
-        set_mtu "$bridge" "$dev"
-        add_to_bridge "$bridge" "$dev"
-        ;;
 esac
 
 handle_iptable
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 5/8] libxl: wire the libxl_device_nic 'mtu' value into xenstore
  2020-08-11  8:01 [PATCH v3 0/8] tools: propogate MTU to vif frontends Paul Durrant
                   ` (3 preceding siblings ...)
  2020-08-11  8:01 ` [PATCH v3 4/8] tools/hotplug/Linux: remove code duplication in vif-bridge Paul Durrant
@ 2020-08-11  8:01 ` Paul Durrant
  2020-08-11  8:02 ` [PATCH v3 6/8] tools/hotplug/Linux: modify set_mtu() to optionally use a configured value Paul Durrant
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Paul Durrant @ 2020-08-11  8:01 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Paul Durrant, Ian Jackson, Wei Liu

From: Paul Durrant <pdurrant@amazon.com>

Currently the 'mtu' field of libxl_device_nic objects is effectively ignored:
It is set by libxl__device_nic_setdefault() to a slightly odd default value of
1492 but otherwise ignored.

This patch changes the default value to a more conventional 1500 and modifies
libxl__set_xenstore_nic() to write the value into an 'mtu' node in the
xenstore backend area (if it is a non-default value), as well as a read-only
node of the same name in the frontend area.

The backend node is used to set the value of 'mtu' in
libxl__nic_from_xenstore(), when retrieving the configuration.

NOTE: There is currently no way to set a non-default value of 'mtu', hence
      the backend node is never written. This, however, will be addressed
      by a subsequent patch.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wl@xen.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>

v3:
 - New in v3
---
 tools/libxl/libxl_nic.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_nic.c b/tools/libxl/libxl_nic.c
index 07880b39e1..0e5d120ae9 100644
--- a/tools/libxl/libxl_nic.c
+++ b/tools/libxl/libxl_nic.c
@@ -53,13 +53,15 @@ int libxl_mac_to_device_nic(libxl_ctx *ctx, uint32_t domid,
     return rc;
 }
 
+#define LIBXL_DEVICE_NIC_MTU_DEFAULT 1500
+
 static int libxl__device_nic_setdefault(libxl__gc *gc, uint32_t domid,
                                         libxl_device_nic *nic, bool hotplug)
 {
     int rc;
 
     if (!nic->mtu)
-        nic->mtu = 1492;
+        nic->mtu = LIBXL_DEVICE_NIC_MTU_DEFAULT;
     if (!nic->model) {
         nic->model = strdup("rtl8139");
         if (!nic->model) return ERROR_NOMEM;
@@ -223,6 +225,11 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
                             nic->rate_interval_usecs));
     }
 
+    if (nic->mtu != LIBXL_DEVICE_NIC_MTU_DEFAULT) {
+        flexarray_append(back, "mtu");
+        flexarray_append(back, GCSPRINTF("%u", nic->mtu));
+    }
+    
     flexarray_append(back, "bridge");
     flexarray_append(back, libxl__strdup(gc, nic->bridge));
     flexarray_append(back, "handle");
@@ -237,6 +244,9 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
     flexarray_append(front, GCSPRINTF(
                                     LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nic->mac)));
 
+    flexarray_append(ro_front, "mtu");
+    flexarray_append(ro_front, GCSPRINTF("%u", nic->mtu));
+
     return 0;
 }
 
@@ -275,7 +285,20 @@ static int libxl__nic_from_xenstore(libxl__gc *gc, const char *libxl_path,
     rc = libxl__backendpath_parse_domid(gc, tmp, &nic->backend_domid);
     if (rc) goto out;
 
-    /* nic->mtu = */
+    rc = libxl__xs_read_checked(gc, XBT_NULL,
+                                GCSPRINTF("%s/mtu", libxl_path), &tmp);
+    if (rc) goto out;
+    if (tmp) {
+        char *endptr;
+
+        nic->mtu = strtol(tmp, &endptr, 10);
+        if (*endptr != '\0') {
+            rc = ERROR_INVAL;
+            goto out;
+        }
+    } else {
+        nic->mtu = LIBXL_DEVICE_NIC_MTU_DEFAULT;
+    }
 
     rc = libxl__xs_read_checked(gc, XBT_NULL,
                                 GCSPRINTF("%s/mac", libxl_path), &tmp);
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 6/8] tools/hotplug/Linux: modify set_mtu() to optionally use a configured value...
  2020-08-11  8:01 [PATCH v3 0/8] tools: propogate MTU to vif frontends Paul Durrant
                   ` (4 preceding siblings ...)
  2020-08-11  8:01 ` [PATCH v3 5/8] libxl: wire the libxl_device_nic 'mtu' value into xenstore Paul Durrant
@ 2020-08-11  8:02 ` Paul Durrant
  2020-08-11  8:02 ` [PATCH v3 7/8] xl: add 'mtu' option to network configuration Paul Durrant
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Paul Durrant @ 2020-08-11  8:02 UTC (permalink / raw)
  To: xen-devel; +Cc: Paul Durrant, Ian Jackson, Wei Liu

From: Paul Durrant <pdurrant@amazon.com>

...and also inform the frontend.

The set_mtu() function in xen-network-common.sh currently sets the backend
vif MTU to match that of the bridge.

A prior patch added code into libxl such that a tools-configured 'mtu' value
may be present in the xenstore backend area. If the node is present in
xenstore then it should be authoritative. Hence set_mtu() is modified to only
read the MTU of the bridge if it is not present.

The function is also modified to write whatever value it applies to the
backend vif into the xenstore frontend area where is may then be used to
configure the frontend network stack.

NOTE: There is also a small modification replacing '$mtu' with '${mtu}'
      for style consistency.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wl@xen.org>

v3:
 - Re-factored from "tools/hotplug: modify set_mtu() to inform the frontend
   via xenstore" in v2
---
 tools/hotplug/Linux/vif-bridge            |  2 +-
 tools/hotplug/Linux/xen-network-common.sh | 28 +++++++++++++++++++++--
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/tools/hotplug/Linux/vif-bridge b/tools/hotplug/Linux/vif-bridge
index e1d7c49788..b99cc82a21 100644
--- a/tools/hotplug/Linux/vif-bridge
+++ b/tools/hotplug/Linux/vif-bridge
@@ -81,7 +81,7 @@ case "$command" in
         ;&
     online)
         setup_virtual_bridge_port "$dev"
-        set_mtu "$bridge" "$dev"
+        set_mtu "$bridge" "$dev" "$type_if"
         add_to_bridge "$bridge" "$dev"
         ;;
     remove)
diff --git a/tools/hotplug/Linux/xen-network-common.sh b/tools/hotplug/Linux/xen-network-common.sh
index 6a0904361f..82ee70aab4 100644
--- a/tools/hotplug/Linux/xen-network-common.sh
+++ b/tools/hotplug/Linux/xen-network-common.sh
@@ -164,9 +164,33 @@ remove_from_bridge () {
 set_mtu () {
     local bridge=$1
     local dev=$2
-    mtu="`ip link show dev ${bridge}| awk '/mtu/ { print $5 }'`"
+    local type_if=$3
+
+    XENBUS_PATH="${XENBUS_PATH:?}"
+
+    local mtu=$(xenstore_read_default "$XENBUS_PATH/mtu" "")
+    if [ -z "$mtu" ]
+    then
+        mtu="`ip link show dev ${bridge}| awk '/mtu/ { print $5 }'`"
+        if [ -n "$mtu" ]
+        then
+            log debug "$bridge MTU is $mtu"
+        fi
+    fi
     if [ -n "$mtu" ] && [ "$mtu" -gt 0 ]
     then
-            ip link set dev ${dev} mtu $mtu || :
+        log debug "setting $dev MTU to $mtu"
+        ip link set dev ${dev} mtu ${mtu} || :
+
+        if [ ${type_if} = vif ]
+        then
+            local dev_=${dev#vif}
+            local domid=${dev_%.*}
+            local devid=${dev_#*.}
+
+            local FRONTEND_PATH="/local/domain/$domid/device/vif/$devid"
+
+            xenstore_write "$FRONTEND_PATH/mtu" ${mtu}
+        fi
     fi
 }
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 7/8] xl: add 'mtu' option to network configuration
  2020-08-11  8:01 [PATCH v3 0/8] tools: propogate MTU to vif frontends Paul Durrant
                   ` (5 preceding siblings ...)
  2020-08-11  8:02 ` [PATCH v3 6/8] tools/hotplug/Linux: modify set_mtu() to optionally use a configured value Paul Durrant
@ 2020-08-11  8:02 ` Paul Durrant
  2020-08-11  8:02 ` [PATCH v3 8/8] remove netchannel2 hotplug script... ancient history Paul Durrant
  2020-08-27  9:58 ` [PATCH v3 0/8] tools: propogate MTU to vif frontends Wei Liu
  8 siblings, 0 replies; 12+ messages in thread
From: Paul Durrant @ 2020-08-11  8:02 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Paul Durrant, Ian Jackson, Wei Liu

From: Paul Durrant <pdurrant@amazon.com>

This patch adds code to parse a value for MTU from the network configuration
if it is present. The documentation in xl-network-configuration.5.pod is
also modified accordingly.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wl@xen.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>

v3:
 - New in v3
---
 docs/man/xl-network-configuration.5.pod | 6 ++++++
 tools/xl/xl_cmdtable.c                  | 2 +-
 tools/xl/xl_parse.c                     | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/docs/man/xl-network-configuration.5.pod b/docs/man/xl-network-configuration.5.pod
index 0ac24c4a18..af058d4d3c 100644
--- a/docs/man/xl-network-configuration.5.pod
+++ b/docs/man/xl-network-configuration.5.pod
@@ -249,3 +249,9 @@ on the underlying netback implementation.
 Specifies the devid manually instead of letting xl choose the lowest index available.
 
 NOTE: This should not be set unless you have a reason to.
+
+=head2 mtu
+
+Specifies the MTU (i.e. the maximum size of an IP payload, exclusing headers). The
+default value is 1500 but, if the VIF is attached to a bridge, it will be set to match
+unless overridden by this parameter.
diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index 08335394e5..2b8e1b321a 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -338,7 +338,7 @@ struct cmd_spec cmd_table[] = {
       "Create a new virtual network device",
       "<Domain> [type=<type>] [mac=<mac>] [bridge=<bridge>] "
       "[ip=<ip>] [script=<script>] [backend=<BackDomain>] [vifname=<name>] "
-      "[rate=<rate>] [model=<model>] [accel=<accel>]",
+      "[rate=<rate>] [model=<model>] [accel=<accel>] [mtu=<mtu>]",
     },
     { "network-list",
       &main_networklist, 0, 0,
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 61b4ef7b7e..cae8eb679c 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -563,6 +563,8 @@ int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token)
         fprintf(stderr, "the accel parameter for vifs is currently not supported\n");
     } else if (MATCH_OPTION("devid", token, oparg)) {
         nic->devid = parse_ulong(oparg);
+    } else if (MATCH_OPTION("mtu", token, oparg)) {
+        nic->mtu = parse_ulong(oparg);
     } else {
         fprintf(stderr, "unrecognized argument `%s'\n", token);
         return 1;
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 8/8] remove netchannel2 hotplug script... ancient history
  2020-08-11  8:01 [PATCH v3 0/8] tools: propogate MTU to vif frontends Paul Durrant
                   ` (6 preceding siblings ...)
  2020-08-11  8:02 ` [PATCH v3 7/8] xl: add 'mtu' option to network configuration Paul Durrant
@ 2020-08-11  8:02 ` Paul Durrant
  2020-08-27  9:58 ` [PATCH v3 0/8] tools: propogate MTU to vif frontends Wei Liu
  8 siblings, 0 replies; 12+ messages in thread
From: Paul Durrant @ 2020-08-11  8:02 UTC (permalink / raw)
  To: xen-devel; +Cc: Paul Durrant, Ian Jackson, Wei Liu

From: Paul Durrant <pdurrant@amazon.com>

configuration is not parsed by libxl so there is no reason for the hotplug
script to exist

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wl@xen.org>

v3:
 - New in v3
---
 tools/hotplug/Linux/Makefile |  1 -
 tools/hotplug/Linux/vif2     | 54 ------------------------------------
 2 files changed, 55 deletions(-)
 delete mode 100644 tools/hotplug/Linux/vif2

diff --git a/tools/hotplug/Linux/Makefile b/tools/hotplug/Linux/Makefile
index 3a90990594..0b1d111d7e 100644
--- a/tools/hotplug/Linux/Makefile
+++ b/tools/hotplug/Linux/Makefile
@@ -6,7 +6,6 @@ XEN_SCRIPTS = vif-bridge
 XEN_SCRIPTS += vif-route
 XEN_SCRIPTS += vif-nat
 XEN_SCRIPTS += vif-openvswitch
-XEN_SCRIPTS += vif2
 XEN_SCRIPTS += vif-setup
 XEN_SCRIPTS-$(CONFIG_LIBNL) += remus-netbuf-setup
 XEN_SCRIPTS += block
diff --git a/tools/hotplug/Linux/vif2 b/tools/hotplug/Linux/vif2
deleted file mode 100644
index 5bd555c6f0..0000000000
--- a/tools/hotplug/Linux/vif2
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-
-dir=$(dirname "$0")
-. "$dir/xen-hotplug-common.sh"
-. "$dir/xen-network-common.sh"
-
-bridge=$(xenstore_read_default "$XENBUS_PATH/bridge" "$bridge")
-if [ -z "$bridge" ]
-    then
-    if which brctl >&/dev/null; then
-        nr_bridges=$(($(brctl show | cut -f 1 | grep -v "^$" | wc -l) - 1))
-    else
-        nr_bridges=$(bridge link | wc -l)
-    fi
-    if [ "$nr_bridges" != 1 ]
-	then
-	fatal "no bridge specified, and don't know which one to use ($nr_bridges found)"
-    fi
-    if which brctl >&/dev/null; then
-        bridge=$(brctl show | cut -d "
-" -f 2 | cut -f 1)
-    else
-        bridge=$(bridge link | cut -d" " -f6)
-    fi
-fi
-
-command="$1"
-shift
-
-case "$command" in
-    "online")
-	if [ "$bridge" != "-" ]
-	    then
-	    setup_virtual_bridge_port "$vif"
-	    add_to_bridge "$bridge" "$vif"
-	else
-	    # Just let the normal udev rules for interfaces handle it.
-	    true
-	fi
-	success
-	;;
-
-    "add")
-	success
-	;;
-
-    "remove")
-	;;
-
-    *)
-	echo "Unknown command: $command"
-	echo 'Valid commands are: add, remove, online'
-	exit 1
-esac
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 1/8] public/io/netif: specify MTU override node
  2020-08-11  8:01 ` [PATCH v3 1/8] public/io/netif: specify MTU override node Paul Durrant
@ 2020-08-14 16:24   ` Wei Liu
  0 siblings, 0 replies; 12+ messages in thread
From: Wei Liu @ 2020-08-14 16:24 UTC (permalink / raw)
  To: Paul Durrant
  Cc: xen-devel, Paul Durrant, Juergen Gross, Ian Jackson,
	Andrew Cooper, George Dunlap, Jan Beulich, Julien Grall,
	Stefano Stabellini, Wei Liu

On Tue, Aug 11, 2020 at 09:01:55AM +0100, Paul Durrant wrote:
> From: Paul Durrant <pdurrant@amazon.com>
> 
> There is currently no documentation to state what MTU a frontend should
> adertise to its network stack. It has however long been assumed that the
> default value of 1500 is correct.
> 
> This patch specifies a mechanism to allow the tools to set the MTU via a
> xenstore node in the frontend area and states that the absence of that node
> means the frontend should assume an MTU of 1500 octets.
> 
> NOTE: The Windows PV frontend has used an MTU sampled from the xenstore
>       node specified in this patch.
> 
> Signed-off-by: Paul Durrant <pdurrant@amazon.com>
> Reviewed-by: Juergen Gross <jgross@suse.com>
> Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>

Acked-by: Wei Liu <wl@xen.org>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 0/8] tools: propogate MTU to vif frontends
  2020-08-11  8:01 [PATCH v3 0/8] tools: propogate MTU to vif frontends Paul Durrant
                   ` (7 preceding siblings ...)
  2020-08-11  8:02 ` [PATCH v3 8/8] remove netchannel2 hotplug script... ancient history Paul Durrant
@ 2020-08-27  9:58 ` Wei Liu
  2020-08-28 11:03   ` Durrant, Paul
  8 siblings, 1 reply; 12+ messages in thread
From: Wei Liu @ 2020-08-27  9:58 UTC (permalink / raw)
  To: Paul Durrant
  Cc: xen-devel, Paul Durrant, Andrew Cooper, Anthony PERARD,
	George Dunlap, Ian Jackson, Jan Beulich, Julien Grall,
	Stefano Stabellini, Wei Liu

On Tue, Aug 11, 2020 at 09:01:54AM +0100, Paul Durrant wrote:
> From: Paul Durrant <pdurrant@amazon.com>
> 
> This is an expansion from v2 of the series to include the facility to set
> the MTU in the vif config.
> 
> There is also one cleanup patch to remove the defunct 'vif2' script.
> 
> Paul Durrant (8):
>   public/io/netif: specify MTU override node
>   tools/hotplug/Linux: re-factor add_to_bridge() in
>     xen-network-common.sh
>   tools/hotplug/Linux: add remove_from_bridge()
>   tools/hotplug/Linux: remove code duplication in vif-bridge
>   libxl: wire the libxl_device_nic 'mtu' value into xenstore
>   tools/hotplug/Linux: modify set_mtu() to optionally use a configured
>     value...
>   xl: add 'mtu' option to network configuration
>   remove netchannel2 hotplug script... ancient history
> 

Patches 2 - 8:
Acked-by: Wei Liu <wl@xen.org>

(I already acked patch 1)


^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH v3 0/8] tools: propogate MTU to vif frontends
  2020-08-27  9:58 ` [PATCH v3 0/8] tools: propogate MTU to vif frontends Wei Liu
@ 2020-08-28 11:03   ` Durrant, Paul
  0 siblings, 0 replies; 12+ messages in thread
From: Durrant, Paul @ 2020-08-28 11:03 UTC (permalink / raw)
  To: Wei Liu, Ian Jackson
  Cc: xen-devel, Andrew Cooper, Anthony PERARD, George Dunlap,
	Jan Beulich, Julien Grall, Stefano Stabellini, Paul Durrant

> -----Original Message-----
> From: Wei Liu <wl@xen.org>
> Sent: 27 August 2020 10:58
> To: Paul Durrant <paul@xen.org>
> Cc: xen-devel@lists.xenproject.org; Durrant, Paul <pdurrant@amazon.co.uk>; Andrew Cooper
> <andrew.cooper3@citrix.com>; Anthony PERARD <anthony.perard@citrix.com>; George Dunlap
> <george.dunlap@citrix.com>; Ian Jackson <ian.jackson@eu.citrix.com>; Jan Beulich <jbeulich@suse.com>;
> Julien Grall <julien@xen.org>; Stefano Stabellini <sstabellini@kernel.org>; Wei Liu <wl@xen.org>
> Subject: RE: [EXTERNAL] [PATCH v3 0/8] tools: propogate MTU to vif frontends
> 
> CAUTION: This email originated from outside of the organization. Do not click links or open
> attachments unless you can confirm the sender and know the content is safe.
> 
> 
> 
> On Tue, Aug 11, 2020 at 09:01:54AM +0100, Paul Durrant wrote:
> > From: Paul Durrant <pdurrant@amazon.com>
> >
> > This is an expansion from v2 of the series to include the facility to set
> > the MTU in the vif config.
> >
> > There is also one cleanup patch to remove the defunct 'vif2' script.
> >
> > Paul Durrant (8):
> >   public/io/netif: specify MTU override node
> >   tools/hotplug/Linux: re-factor add_to_bridge() in
> >     xen-network-common.sh
> >   tools/hotplug/Linux: add remove_from_bridge()
> >   tools/hotplug/Linux: remove code duplication in vif-bridge
> >   libxl: wire the libxl_device_nic 'mtu' value into xenstore
> >   tools/hotplug/Linux: modify set_mtu() to optionally use a configured
> >     value...
> >   xl: add 'mtu' option to network configuration
> >   remove netchannel2 hotplug script... ancient history
> >
> 
> Patches 2 - 8:
> Acked-by: Wei Liu <wl@xen.org>
> 
> (I already acked patch 1)

Thanks Wei.

Ian... ping?

  Paul



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-08-28 11:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11  8:01 [PATCH v3 0/8] tools: propogate MTU to vif frontends Paul Durrant
2020-08-11  8:01 ` [PATCH v3 1/8] public/io/netif: specify MTU override node Paul Durrant
2020-08-14 16:24   ` Wei Liu
2020-08-11  8:01 ` [PATCH v3 2/8] tools/hotplug/Linux: re-factor add_to_bridge() in xen-network-common.sh Paul Durrant
2020-08-11  8:01 ` [PATCH v3 3/8] tools/hotplug/Linux: add remove_from_bridge() Paul Durrant
2020-08-11  8:01 ` [PATCH v3 4/8] tools/hotplug/Linux: remove code duplication in vif-bridge Paul Durrant
2020-08-11  8:01 ` [PATCH v3 5/8] libxl: wire the libxl_device_nic 'mtu' value into xenstore Paul Durrant
2020-08-11  8:02 ` [PATCH v3 6/8] tools/hotplug/Linux: modify set_mtu() to optionally use a configured value Paul Durrant
2020-08-11  8:02 ` [PATCH v3 7/8] xl: add 'mtu' option to network configuration Paul Durrant
2020-08-11  8:02 ` [PATCH v3 8/8] remove netchannel2 hotplug script... ancient history Paul Durrant
2020-08-27  9:58 ` [PATCH v3 0/8] tools: propogate MTU to vif frontends Wei Liu
2020-08-28 11:03   ` Durrant, Paul

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).