[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] tools/hotplug/Linux: modify set_mtu() to optionally use a configured value...
commit c7c6de0cb9b00efc203790743ef8c37ba113d3ee Author: Paul Durrant <pdurrant@xxxxxxxxxx> AuthorDate: Tue Aug 11 09:02:00 2020 +0100 Commit: Wei Liu <wl@xxxxxxx> CommitDate: Thu Aug 27 10:04:21 2020 +0000 tools/hotplug/Linux: modify set_mtu() to optionally use a configured value... ...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@xxxxxxxxxx> Acked-by: Wei Liu <wl@xxxxxxx> --- 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 } -- generated by git-patchbot for /home/xen/git/xen.git#staging
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |