[openib-general] [PATCH] IB/ipoib get net_device from ipoib_neigh instead of linux neighbour

Michael S. Tsirkin mst at mellanox.co.il
Tue Feb 6 08:02:59 PST 2007


> ------------------------------------------------------------------------------
> IPoIB uses a two layer neighboring scheme, such that for each struct neighbour
> whose device is an ipoib one, there is a struct ipoib_neigh buddy which is
> created on demand at the tx flow by an ipoib_neigh_alloc(skb->dst->neighbour)
> call.
> 
> When using the bonding driver, neighbours are created by the net stack on behalf
> of the bonding (master) device. On the tx flow the bonding code gets an skb such
> that skb->dev points to the master device, it changes this skb to point on the
> slave device and calls the slave hard_start_xmit function.
> 
> Combing these two flows, there is a hole if some code at ipoib
> (ipoib_neigh_destructor) assumes that for each struct neighbour it gets, n->dev
> is an ipoib device so for example netdev_priv(n->dev) would be of type struct
> ipoib_dev_priv.

Could you plese elaborate how ipoib_neigh_destructor comes to be called at all?
At what point does ipoib_neigh_setup_dev get called?

> To fix it, this patch adds a dev field to struct ipoib_neigh which is used
> instead of the struct neighbour dev one.

What I am concerned with is - if the master is not an IPoIB device,
what guarantee do we have that to_ipoib_neigh will return 0
and not part of an actual hardware address?

Without bonding, the reason is that dev points to an ipoib device,
so we know hw address is 20 bytes.

-- 
MST




More information about the general mailing list