Skip to contentSkip to conversation

Detecting backup slaves of bonding interface in network driver

DISCUSSION Poornima Kamath 2 participants 5 messages Dec 11, 2008 – Dec 29, 2008 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,
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.
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?

Thanks,
Poornima

#1 lore raw
Quoted 3 lines · Poornima Kamath

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.

Quoted 6 lines

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, [email protected]

#3 lore raw
In reply to a message not in the archive
Quoted 9 lines · Poornima Kamath

The driver creates virtual interfaces that talk to ethernet interfaces over infiniband, using an infiniband to ethernet gateway device.
The gateway device sends data to all interfaces having same mac address. For this the driver needs to explicitly tell the gateway device not to send data to the backup slaves.
Therefore the driver needs to know which slaves are backup slaves. The failover mac option works well, but it is present for kernels greater than 2.6.24. So this option is not available for distros like RHEL5, SLES10 etc

I believe that RHEL5 and SLES10 contain an "ib-bonding" package
which includes a backport of the current (or at least a more current) bonding driver specifically for use over Infiniband. I think it's also got a couple of other patches to bonding that aren't in the mainline. In any event, it has the fail_over_mac functionality.

Have you looked at ib-bonding?

Quoted 3 lines

So in order to support these distros I need some way of identifying the backup slaves.
Is it ok to check the IFF_SLAVE_INACTIVE flags for these distros?

It will do what you want (identify backup slaves), and is not
guaranteed to be available in the future. I doubt that the flag would ever go away on RHEL5 or SLES10, but, again, no guarantee.

	-J

---
-Jay Vosburgh, IBM Linux Technology Center, [email protected]

#5 lore raw
In reply to Jay Vosburgh

Hi Jay,

Thanks for your reply.
The driver creates virtual interfaces that talk to ethernet interfaces over infiniband, using an infiniband to ethernet gateway device.
The gateway device sends data to all interfaces having same mac address. For this the driver needs to explicitly tell the gateway device not to send data to the backup slaves. Therefore the driver needs to know which slaves are backup slaves.
The failover mac option works well, but it is present for kernels greater than 2.6.24. So this option is not available for distros like RHEL5, SLES10 etc So in order to support these distros I need some way of identifying the backup slaves.
Is it ok to check the IFF_SLAVE_INACTIVE flags for these distros?

Thanks,
Poornima

Quoted 47 lines · Jay Vosburgh
Quoted 4 lines · Poornima Kamath

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.

Quoted 7 lines

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, [email protected]
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
In reply to Jay Vosburgh

Hi Jay,

Thanks a lot for your response.
ib-bonding does have fail_over_mac functionality and works on both RHEL5 and SLES10.

Thanks,
Poornima

Quoted 42 lines · Jay Vosburgh
Quoted 10 lines · Poornima Kamath

The driver creates virtual interfaces that talk to ethernet interfaces over infiniband, using an infiniband to ethernet gateway device.
The gateway device sends data to all interfaces having same mac address. For this the driver needs to explicitly tell the gateway device not to send data to the backup slaves.
Therefore the driver needs to know which slaves are backup slaves. The failover mac option works well, but it is present for kernels greater than 2.6.24. So this option is not available for distros like RHEL5, SLES10 etc

I believe that RHEL5 and SLES10 contain an "ib-bonding" package
which includes a backport of the current (or at least a more current) bonding driver specifically for use over Infiniband. I think it's also got a couple of other patches to bonding that aren't in the mainline. In any event, it has the fail_over_mac functionality.

Have you looked at ib-bonding?

Quoted 4 lines

So in order to support these distros I need some way of identifying the backup slaves.
Is it ok to check the IFF_SLAVE_INACTIVE flags for these distros?

It will do what you want (identify backup slaves), and is not
guaranteed to be available in the future. I doubt that the flag would ever go away on RHEL5 or SLES10, but, again, no guarantee.

	-J

---
-Jay Vosburgh, IBM Linux Technology Center, [email protected]
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html