[Click] [PATCH] patches for linux 2.6.24

Joonwoo Park joonwpark81 at gmail.com
Thu Feb 14 02:28:20 EST 2008


On Mon, Feb 11, 2008 at 05:10:18PM -0000, Egi, Norbert wrote:
> >I guess the assertion issue  is releated locking problem, I sent a patch for it.
> >Since I'm off for this week, I can't test your patch at this moment.
> >I'll dig these things at next week and I'll try NAPI as a possible
> >option for e1000 that you patched.
> 
> Joonwoo,
>  
> Yes, it was related to a locking problem when I wanted to have the interfaces in promiscuous mode. It looks so that the dev_set_promiscuity function (in net/core/dev.c) requires the calling thread to hold rtnl mutex by calling rtnl_lock(), so I added this to anydevice.cc with the corresponding rtnl_unlock(). This eliminated the assertion problem I had. So far I haven't experienced any other problems with the patches yet. (By the way, I didn't get the patch you mentioned above.)
>  
> Cheers,
> Norbert

Hi Norbert,
I think you made a indentation mistake.
After fixing it, the RTNL_LOCK assertion was disappeared.
I'm attaching a mergered patch as click-1.6.0-linux-2.6.24-3.patch.gz as
well.

---
diff --git a/elements/linuxmodule/anydevice.cc b/elements/linuxmodule/anydevice.cc
index f4e4a56..5383356 100644
--- a/elements/linuxmodule/anydevice.cc
+++ b/elements/linuxmodule/anydevice.cc
@@ -66,10 +66,11 @@ AnyDevice::find_device(AnyDeviceMap *adm, ErrorHandler *errh)
 	_dev = 0;
     }
 
-    if (_dev && _promisc)
+    if (_dev && _promisc) {
 	rtnl_lock();
 	dev_set_promiscuity(_dev, 1);
 	rtnl_unlock();
+    }
 #if HAVE_NET_ENABLE_TIMESTAMP
     if (_dev && _timestamp)
 	net_enable_timestamp();
@@ -91,10 +92,11 @@ AnyDevice::set_device(net_device *dev, AnyDeviceMap *adm, bool locked)
     if (dev && !_quiet)
 	click_chatter("%s: device '%s' came up", declaration().c_str(), _devname.c_str());
     
-    if (_dev && _promisc)
+    if (_dev && _promisc) {
 	rtnl_lock();
 	dev_set_promiscuity(_dev, -1);
 	rtnl_unlock();
+    }
 #if HAVE_NET_ENABLE_TIMESTAMP
     if (_dev && _timestamp)
 	net_disable_timestamp();
@@ -110,10 +112,11 @@ AnyDevice::set_device(net_device *dev, AnyDeviceMap *adm, bool locked)
     if (adm)
 	adm->insert(this, locked);
 
-    if (_dev && _promisc)
+    if (_dev && _promisc) {
 	rtnl_lock();
 	dev_set_promiscuity(_dev, 1);
 	rtnl_unlock();
+    }
 #if HAVE_NET_ENABLE_TIMESTAMP
     if (_dev && _timestamp)
 	net_enable_timestamp();
@@ -123,10 +126,11 @@ AnyDevice::set_device(net_device *dev, AnyDeviceMap *adm, bool locked)
 void
 AnyDevice::clear_device(AnyDeviceMap *adm)
 {
-    if (_dev && _promisc)
+    if (_dev && _promisc) {
 	rtnl_lock();
 	dev_set_promiscuity(_dev, -1);
 	rtnl_unlock();
+    }
 #if HAVE_NET_ENABLE_TIMESTAMP
     if (_dev && _timestamp)
 	net_disable_timestamp();
---

Thanks,
Joonwoo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: click-1.6.0-linux-2.6.24-3.patch.gz
Type: application/octet-stream
Size: 6952 bytes
Desc: not available
Url : https://pdos.csail.mit.edu/pipermail/click/attachments/20080214/71d55122/attachment.obj 


More information about the click mailing list