From: Jay Vosburgh Subject: Re: Detecting backup slaves of bonding interface in network driver Date: Thu, 11 Dec 2008 08:35:59 -0800 Message-ID: <25821.1229013359@death.nxdomain.ibm.com> References: <494108D7.3040304@gslab.com> Cc: netdev@vger.kernel.org To: Poornima Kamath Return-path: Received: from e35.co.us.ibm.com ([32.97.110.153]:58580 "EHLO e35.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755554AbYLKQgC (ORCPT ); Thu, 11 Dec 2008 11:36:02 -0500 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e35.co.us.ibm.com (8.13.1/8.13.1) with ESMTP id mBBGYWG4019204 for ; Thu, 11 Dec 2008 09:34:32 -0700 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id mBBGa1mC178554 for ; Thu, 11 Dec 2008 09:36:01 -0700 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id mBBGa1v9012938 for ; Thu, 11 Dec 2008 09:36:01 -0700 In-reply-to: <494108D7.3040304@gslab.com> Sender: netdev-owner@vger.kernel.org List-ID: Poornima Kamath wrote: >I have a network driver which creates virtual ethernet interfaces. I am >using the bonding driver in the active backup mode for failover. >I want to detect the interfaces which are backup slaves in the driver. What device is it, and why do you want to do this? I ask not just out of curiosity, but because there are other devices that have problems with bonding's handling of some things, and there are already special options for those devices. If your device, e.g., can't handle having the same MAC on multiple ports, then your problem may be resolved with one of the fail_over_mac option settings. >I found that the bonding driver sets the IFF_SLAVE_INACTIVE private flag >of net_device structure for all the backup slaves. >But I dont see any callbacks in my driver when this flag is set. >I am planning to check the netdevice flags in the driver. Is it >recommended to check the private flags of net_device ? >Or is there some better way in which I can find the backup slaves? Those flags are private to the driver (bonding, in this case), and there is no callback generated when they change. The IFF_SLAVE_INACTIVE is what you want (it's set in priv_flags for backup slaves), but it's purpose is to identify backup slaves so that most incoming packets on them can be dropped. It's possible that the flag may change or be eliminated in the future. Also, note that there is a notifier generated by bonding when a failover occurs (NETDEV_BONDING_FAILOVER), this was added to the mainline about six months ago. You may be able to use that to determine when to check things. -J --- -Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com