From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yosuke Iwamatsu Subject: incompatibility of netfront driver with bonding module Date: Thu, 03 Apr 2008 15:29:32 +0900 Message-ID: <47F4794C.2040707@ab.jp.nec.com> References: <78C9135A3D2ECE4B8162EBDCE82CAD77034D3337@nekter> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020400020009000008070605" Return-path: In-Reply-To: <78C9135A3D2ECE4B8162EBDCE82CAD77034D3337@nekter> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Masroor Vettuparambil Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------020400020009000008070605 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, Masroor Vettuparambil wrote: > 1. Normally, bonding will inherit the mac from the first slave and > assign it to all the other slaves added later. So the mac of vif will be > updated. But during migration, the mac of vif is getting updated from > xenstore(/vm/). So how about having a set_mac_address entry in netfront > that update the xenstore? > So I need help, especially on #1. Is it ok to update the xenstore > /vm/ keys from domU? how to do this? I tried a bit to find out the way to update /vm/ keys from frontend, but didn't succeed. Either way, I don't think it is a good idea to update the xenstore key of the vif mac address, because the original mac will be lost and we won't be able to reset it e.g. after the guest reboot. So the attached patch adds set mac_address() support to netfront. It doesn't touch xenstore at all, but just preserves the modified mac address in netfront_info structure and keeps using it after migration. Thanks, ----------------------- Yosuke Iwamatsu NEC Corporation --------------020400020009000008070605 Content-Type: all/allfiles; name="netfront_set_mac.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="netfront_set_mac.patch" # HG changeset patch # User y-iwamatsu@ab.jp.nec.com # Date 1207201836 -32400 # Node ID e0cbf339041149119780900979653ac57a302e8a # Parent 06ffa3eb5e3ff1cf517c15b40a8cd757bc827950 netfront: Support set_mac_address() Signed-off-by: Yosuke Iwamatsu diff -r 06ffa3eb5e3f -r e0cbf3390411 drivers/xen/netfront/netfront.c --- a/drivers/xen/netfront/netfront.c Mon Mar 31 18:07:41 2008 +0100 +++ b/drivers/xen/netfront/netfront.c Thu Apr 03 14:50:36 2008 +0900 @@ -366,10 +366,14 @@ static int talk_to_backend(struct xenbus struct xenbus_transaction xbt; int err; - err = xen_net_read_mac(dev, info->mac); - if (err) { - xenbus_dev_fatal(dev, err, "parsing %s/mac", dev->nodename); - goto out; + /* Read mac only in the first setup. */ + if (!is_valid_ether_addr(info->mac)) { + err = xen_net_read_mac(dev, info->mac); + if (err) { + xenbus_dev_fatal(dev, err, "parsing %s/mac", + dev->nodename); + goto out; + } } /* Create shared ring, alloc event channel. */ @@ -1688,6 +1692,20 @@ static struct net_device_stats *network_ return &np->stats; } +static int xennet_set_mac_address(struct net_device *dev, void *p) +{ + struct netfront_info *np = netdev_priv(dev); + struct sockaddr *addr = p; + + if (!is_valid_ether_addr(addr->sa_data)) + return -EADDRNOTAVAIL; + + memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); + memcpy(np->mac, addr->sa_data, ETH_ALEN); + + return 0; +} + static int xennet_change_mtu(struct net_device *dev, int mtu) { int max = xennet_can_sg(dev) ? 65535 - ETH_HLEN : ETH_DATA_LEN; @@ -2075,6 +2093,7 @@ static struct net_device * __devinit cre netdev->poll = netif_poll; netdev->set_multicast_list = network_set_multicast_list; netdev->uninit = netif_uninit; + netdev->set_mac_address = xennet_set_mac_address; netdev->change_mtu = xennet_change_mtu; netdev->weight = 64; netdev->features = NETIF_F_IP_CSUM; --------------020400020009000008070605 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------020400020009000008070605--