Skip to contentSkip to conversation

Fix for BUG when MAC addresses conflict

PATCH New Kieran Mansley 1 participant 1 message Mar 25, 2008 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix for BUG when MAC addresses conflict

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.

Avoid BUG_ON when vifs have conflicting MAC addresses

drivers/xen/sfc_netback/accel_fwd.c +7 -2
diff -r de57c3f218fb 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

Avoid BUG_ON when vifs have conflicting MAC addresses

drivers/xen/sfc_netback/accel_fwd.c +7 -2
diff -r de57c3f218fb 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) {

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel