[ipxe-devel] [PATCH 1/2] Prevent a netdevice (VLAN) to open/close twice.

Michael Brown mcb30 at ipxe.org
Wed Mar 5 14:02:08 UTC 2014


On 05/03/14 13:33, Wissam Shoukair wrote:
> The reason for this fix is, when opening a VLAN, the current code checks if the trunk interface in also open. If it's not opened, then it will open the trunk and notify all other drivers, which the VLAN driver is one of them, and when the VLAN driver is notified it will try to sync with the opened trunk, so it will be opened again. (same for the close flow)

Does the attached patch fix your problem?  This marks the device as open 
before calling the ->open() method, and so prevents vlan_sync() from 
attempting to (harmlessly) reopen the child VLAN device.

I don't think the same problem exists on the close path:

   call netdev_close(vlan_dev) ->
     mark vlan_dev as closed
     call vlan_close(vlan_dev) ->
       call netdev_close(trunk_dev)
       mark trunk_dev as closed
       call netdev_notify(trunk_dev) ->
         call vlan_sync(trunk_dev) ->
           both devices are marked as closed, so no action taken

   call netdev_close(trunk_dev) ->
     mark trunk_dev as closed
     call netdev_notify(trunk_dev) ->
       call vlan_sync(trunk_dev) ->
         call netdev_close(vlan_dev) ->
           call netdev_close(trunk_dev) ->
             trunk_dev is already marked as closed, so no action taken

Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vlan-open.patch
Type: text/x-patch
Size: 778 bytes
Desc: not available
URL: <http://lists.ipxe.org/pipermail/ipxe-devel/attachments/20140305/d9c822ec/attachment.bin>


More information about the ipxe-devel mailing list