From patchwork Mon Aug 3 12:49:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 11697999 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 47A6C912 for ; Mon, 3 Aug 2020 12:50:47 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 23CC82064B for ; Mon, 3 Aug 2020 12:50:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xen.org header.i=@xen.org header.b="etQRioOu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 23CC82064B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k2ZuR-0001oz-B2; Mon, 03 Aug 2020 12:49:43 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k2ZuP-0001oJ-KB for xen-devel@lists.xenproject.org; Mon, 03 Aug 2020 12:49:41 +0000 X-Inumbo-ID: c94bbfc8-d587-11ea-908e-bc764e2007e4 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id c94bbfc8-d587-11ea-908e-bc764e2007e4; Mon, 03 Aug 2020 12:49:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=fEecjANlWh3hBTz/ieGtixPqvrZoBJyua6jWfk3Vf10=; b=etQRioOuZx5mSrQGtdIYJdZ0Yc ZEVxz5N3UUHLW/QPuNGa/Jorna3ZqR7Hwj3mwB5CcspH7meQgXSd7H/LTsHrqsMkc6uaQkP24+Mpf E1XkZpIWjBvJCHKM06adVaIfBZLO9RqRHMkbY8UkjB8DSItessioIBxTbwYNM3JyJJLA=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k2ZuJ-0000wp-Tp; Mon, 03 Aug 2020 12:49:35 +0000 Received: from host86-143-223-30.range86-143.btcentralplus.com ([86.143.223.30] helo=u2f063a87eabd5f.home) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k2ZuJ-0002Mv-KR; Mon, 03 Aug 2020 12:49:35 +0000 From: Paul Durrant To: xen-devel@lists.xenproject.org Subject: [PATCH v2 1/4] tools/hotplug: add remove_from_bridge() and improve debug output Date: Mon, 3 Aug 2020 13:49:28 +0100 Message-Id: <20200803124931.2678-2-paul@xen.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200803124931.2678-1-paul@xen.org> References: <20200803124931.2678-1-paul@xen.org> MIME-Version: 1.0 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Paul Durrant , Ian Jackson , Wei Liu Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Paul Durrant This patch adds a remove_from_bridge() function into xen-network-common.sh to partner with the existing add_to_bridge() function. The code in add_to_bridge() is also slightly re-arranged to avoid duplication calls of 'ip link'. Both add_to_bridge() and remove_from_bridge() will check if their bridge manipulation operations are necessary and emit a log message if they are not. NOTE: A call to remove_from_bridge() will be added by a subsequent patch. Signed-off-by: Paul Durrant --- Cc: Ian Jackson Cc: Wei Liu --- tools/hotplug/Linux/xen-network-common.sh | 37 ++++++++++++++++++----- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/tools/hotplug/Linux/xen-network-common.sh b/tools/hotplug/Linux/xen-network-common.sh index 8dd3a62068..37e71cfa9c 100644 --- a/tools/hotplug/Linux/xen-network-common.sh +++ b/tools/hotplug/Linux/xen-network-common.sh @@ -126,19 +126,40 @@ 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 } +remove_from_bridge () { + local bridge=$1 + local dev=$2 + + 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 + brctl delif ${bridge} ${dev} + else + 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 From patchwork Mon Aug 3 12:49:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 11698001 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7084C912 for ; Mon, 3 Aug 2020 12:50:52 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 480242064B for ; Mon, 3 Aug 2020 12:50:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xen.org header.i=@xen.org header.b="ZJ+YGwog" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 480242064B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k2ZuV-0001r6-NL; Mon, 03 Aug 2020 12:49:47 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k2ZuU-0001oJ-KD for xen-devel@lists.xenproject.org; Mon, 03 Aug 2020 12:49:46 +0000 X-Inumbo-ID: c94bbfc9-d587-11ea-908e-bc764e2007e4 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id c94bbfc9-d587-11ea-908e-bc764e2007e4; Mon, 03 Aug 2020 12:49:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=kR8KOrJwsxDE/ONPFOt3nY9mFnEziImu/LnFUCfqeYk=; b=ZJ+YGwogR5jrHLs2CgiehNTwnw COemTsnajKTmERoLv9bCRMdHA1p4sBqBeZJH4w2ewDSrlQDb4vMSsN2NBJDOySHSFjZ8GIkbkppFA 934tKxQUzzOfZL8Si5zYm6ODa2bIqWOPvg2C9LsRhGT1a7F85sZO546cKptlYuwLLGT0=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k2ZuK-0000wv-Nq; Mon, 03 Aug 2020 12:49:36 +0000 Received: from host86-143-223-30.range86-143.btcentralplus.com ([86.143.223.30] helo=u2f063a87eabd5f.home) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k2ZuK-0002Mv-GL; Mon, 03 Aug 2020 12:49:36 +0000 From: Paul Durrant To: xen-devel@lists.xenproject.org Subject: [PATCH v2 2/4] tools/hotplug: combine add/online and remove/offline in vif-bridge... Date: Mon, 3 Aug 2020 13:49:29 +0100 Message-Id: <20200803124931.2678-3-paul@xen.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200803124931.2678-1-paul@xen.org> References: <20200803124931.2678-1-paul@xen.org> MIME-Version: 1.0 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Paul Durrant , Ian Jackson , Wei Liu Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Paul Durrant ... as they are in vif-route. The script is invoked with online/offline for vifs and add/remove for taps. The operations that are necessary, however, are the same in both cases. This patch therefore combines the cases. The open-coded bridge removal code is also replaced with call to remove_from_bridge(). Signed-off-by: Paul Durrant --- Cc: Ian Jackson Cc: Wei Liu --- tools/hotplug/Linux/vif-bridge | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/tools/hotplug/Linux/vif-bridge b/tools/hotplug/Linux/vif-bridge index e722090ca8..e1d7c49788 100644 --- a/tools/hotplug/Linux/vif-bridge +++ b/tools/hotplug/Linux/vif-bridge @@ -77,25 +77,17 @@ then fi case "$command" in + add) + ;& online) setup_virtual_bridge_port "$dev" set_mtu "$bridge" "$dev" add_to_bridge "$bridge" "$dev" ;; - + remove) + ;& 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 - ;; - - add) - setup_virtual_bridge_port "$dev" - set_mtu "$bridge" "$dev" - add_to_bridge "$bridge" "$dev" + remove_from_bridge "$bridge" "$dev" ;; esac From patchwork Mon Aug 3 12:49:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 11698003 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 561E8912 for ; Mon, 3 Aug 2020 12:51:11 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 326942064B for ; Mon, 3 Aug 2020 12:51:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xen.org header.i=@xen.org header.b="hJC6+ih5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 326942064B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k2Zua-0001st-WD; Mon, 03 Aug 2020 12:49:53 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k2ZuZ-0001oJ-KL for xen-devel@lists.xenproject.org; Mon, 03 Aug 2020 12:49:51 +0000 X-Inumbo-ID: cac696e8-d587-11ea-908e-bc764e2007e4 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id cac696e8-d587-11ea-908e-bc764e2007e4; Mon, 03 Aug 2020 12:49:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZlyGB/IJYGIn5IH/TrwY8/sEiVYZi4FF/kqtp/gyRxw=; b=hJC6+ih5zJRfQVFW6Xs+gmmWiq YJhFI9oAmkTlJ3xCbgIfFxXloH8CAPaa9IZvw7n+mgKWcE9optOJDA4EKcSC6R8CaVBpWJG+6GFA9 jxDVxDOYCpOSnTvDw1YveJc2AeAj2n80rk8zPkBxHrvglE/STnWKYVt/9dikQ/bDqeXg=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k2ZuM-0000x6-5e; Mon, 03 Aug 2020 12:49:38 +0000 Received: from host86-143-223-30.range86-143.btcentralplus.com ([86.143.223.30] helo=u2f063a87eabd5f.home) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k2ZuL-0002Mv-TE; Mon, 03 Aug 2020 12:49:38 +0000 From: Paul Durrant To: xen-devel@lists.xenproject.org Subject: [PATCH v2 3/4] public/io/netif: specify MTU override node Date: Mon, 3 Aug 2020 13:49:30 +0100 Message-Id: <20200803124931.2678-4-paul@xen.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200803124931.2678-1-paul@xen.org> References: <20200803124931.2678-1-paul@xen.org> MIME-Version: 1.0 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Stefano Stabellini , Julien Grall , Wei Liu , Andrew Cooper , Paul Durrant , Ian Jackson , George Dunlap , Jan Beulich Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Paul Durrant 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 Reviewed-by: Juergen Gross Reviewed-by: Ian Jackson --- Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Julien Grall Cc: Stefano Stabellini Cc: Wei Liu 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//device/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 * ========== From patchwork Mon Aug 3 12:49:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 11697997 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C53BB912 for ; Mon, 3 Aug 2020 12:50:36 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A0BE620678 for ; Mon, 3 Aug 2020 12:50:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xen.org header.i=@xen.org header.b="HcGqnvkm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0BE620678 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k2ZuQ-0001oi-2T; Mon, 03 Aug 2020 12:49:42 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k2ZuO-0001oY-Mk for xen-devel@lists.xenproject.org; Mon, 03 Aug 2020 12:49:40 +0000 X-Inumbo-ID: cb1d6432-d587-11ea-af2b-12813bfff9fa Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id cb1d6432-d587-11ea-af2b-12813bfff9fa; Mon, 03 Aug 2020 12:49:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=TpRalkvkG38JtEdNhqPS3RNesiK5+8RoUBFVAeIBPhI=; b=HcGqnvkm6tlHw+zgLd1/kNuEYB SI5YhlrENiOZLAl0wm0EdzhX20S1VZ6gneUaKlARLRWqKGPwR+O1EyytYJsk7B4B/k72q6HWW4Kwl p4ziJymIfIxP8eBjRnxqLZgmRsjlPmUeAIgof9xUH1woX0+s4wTwoGCsa+8ouZR9STsQ=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k2ZuN-0000xA-0f; Mon, 03 Aug 2020 12:49:39 +0000 Received: from host86-143-223-30.range86-143.btcentralplus.com ([86.143.223.30] helo=u2f063a87eabd5f.home) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k2ZuM-0002Mv-PT; Mon, 03 Aug 2020 12:49:38 +0000 From: Paul Durrant To: xen-devel@lists.xenproject.org Subject: [PATCH v2 4/4] tools/hotplug: modify set_mtu() to inform the frontend via xenstore Date: Mon, 3 Aug 2020 13:49:31 +0100 Message-Id: <20200803124931.2678-5-paul@xen.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200803124931.2678-1-paul@xen.org> References: <20200803124931.2678-1-paul@xen.org> MIME-Version: 1.0 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Paul Durrant , Ian Jackson , Wei Liu Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Paul Durrant set_mtu() currently sets the backend vif MTU but does not inform the frontend what it is. This patch adds code to write the MTU into a xenstore node. See netif.h for a specification of the node. NOTE: There is also a small modification replacing '$mtu' with '${mtu}' for style consistency. Signed-off-by: Paul Durrant Reviewed-by: Ian Jackson --- Cc: Ian Jackson Cc: Wei Liu --- tools/hotplug/Linux/vif-bridge | 2 +- tools/hotplug/Linux/xen-network-common.sh | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 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 37e71cfa9c..24fc42d9cf 100644 --- a/tools/hotplug/Linux/xen-network-common.sh +++ b/tools/hotplug/Linux/xen-network-common.sh @@ -164,9 +164,21 @@ remove_from_bridge () { set_mtu () { local bridge=$1 local dev=$2 + local type_if=$3 + mtu="`ip link show dev ${bridge}| awk '/mtu/ { print $5 }'`" if [ -n "$mtu" ] && [ "$mtu" -gt 0 ] then - ip link set dev ${dev} mtu $mtu || : + ip link set dev ${dev} mtu ${mtu} || : + fi + + if [ ${type_if} = vif ] + then + dev_=${dev#vif} + domid=${dev_%.*} + devid=${dev_#*.} + + XENBUS_PATH="/local/domain/$domid/device/vif/$devid" + xenstore_write "$XENBUS_PATH/mtu" ${mtu} fi }