From: Kieran Mansley Subject: [Patch] Fix for BUG when MAC addresses conflict Date: Tue, 25 Mar 2008 14:26:51 +0000 Message-ID: <1206455211.4186.36.camel@moonstone.uk.level5networks.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-Tj0WeHXh9FLP4rIGS/Oj" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --=-Tj0WeHXh9FLP4rIGS/Oj Content-Type: text/plain Content-Transfer-Encoding: 7bit When the Solarflare network acceleration plugins are used they currently do a BUG check to make sure that they're not being used on multiple guest interfaces with the same MAC address. While this is a configuration error it's not very nice to BUG dom0 as a result, so I've attached a patch that instead returns an error. Acceleration will continue on the first interface with that MAC address but any subsequent ones will be declined and continue to use the normal network path. Signed-off-by: Kieran Mansley Avoid BUG_ON when vifs have conflicting MAC addresses diff -r de57c3f218fb drivers/xen/sfc_netback/accel_fwd.c --- a/drivers/xen/sfc_netback/accel_fwd.c +++ b/drivers/xen/sfc_netback/accel_fwd.c @@ -196,8 +196,13 @@ int netback_accel_fwd_add(const __u8 *ma index = rc; /* Shouldn't already be in the table */ - BUG_ON(cuckoo_hash_lookup(&fwd_set->fwd_hash_table, - (cuckoo_hash_key *)(&key), &rc) != 0); + if (cuckoo_hash_lookup(&fwd_set->fwd_hash_table, + (cuckoo_hash_key *)(&key), &rc) != 0) { + spin_unlock_irqrestore(&fwd_set->fwd_lock, flags); + EPRINTK("MAC address " MAC_FMT " already accelerated.\n", + MAC_ARG(mac)); + return -EEXIST; + } if ((rc = cuckoo_hash_add(&fwd_set->fwd_hash_table, (cuckoo_hash_key *)(&key), index, 1)) == 0) { Kieran --=-Tj0WeHXh9FLP4rIGS/Oj Content-Disposition: attachment; filename=accel_mac_conflict Content-Type: text/plain; name=accel_mac_conflict; charset=UTF-8 Content-Transfer-Encoding: 7bit Avoid BUG_ON when vifs have conflicting MAC addresses diff -r de57c3f218fb drivers/xen/sfc_netback/accel_fwd.c --- a/drivers/xen/sfc_netback/accel_fwd.c +++ b/drivers/xen/sfc_netback/accel_fwd.c @@ -196,8 +196,13 @@ int netback_accel_fwd_add(const __u8 *ma index = rc; /* Shouldn't already be in the table */ - BUG_ON(cuckoo_hash_lookup(&fwd_set->fwd_hash_table, - (cuckoo_hash_key *)(&key), &rc) != 0); + if (cuckoo_hash_lookup(&fwd_set->fwd_hash_table, + (cuckoo_hash_key *)(&key), &rc) != 0) { + spin_unlock_irqrestore(&fwd_set->fwd_lock, flags); + EPRINTK("MAC address " MAC_FMT " already accelerated.\n", + MAC_ARG(mac)); + return -EEXIST; + } if ((rc = cuckoo_hash_add(&fwd_set->fwd_hash_table, (cuckoo_hash_key *)(&key), index, 1)) == 0) { --=-Tj0WeHXh9FLP4rIGS/Oj 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 --=-Tj0WeHXh9FLP4rIGS/Oj--