[ofa-general] RE: [RFC V4 PATCH 4/5] rdma/cma: implement RDMA_CM_EVENT_ADDR_CHANGE notification

Sean Hefty sean.hefty at intel.com
Wed May 28 12:06:00 PDT 2008


>+static void cma_ndev_work_handler(struct work_struct *_work)
>+{
>+	struct cma_ndev_work *work = container_of(_work, struct cma_ndev_work,
>work);
>+	struct rdma_id_private *id_priv = work->id;
>+	int destroy = 0;
>+
>+	mutex_lock(&id_priv->handler_mutex);
>+	if (id_priv->state == CMA_DESTROYING)

We should probably skip id_priv->state == CMA_DEVICE_REMOVAL as well.

>@@ -2723,6 +2751,63 @@ void rdma_leave_multicast(struct rdma_cm
> }
> EXPORT_SYMBOL(rdma_leave_multicast);
>
>+static int cma_netdev_change(struct net_device *ndev, struct rdma_id_private
>*id_priv)
>+{
>+	struct rdma_dev_addr *dev_addr;
>+	struct cma_ndev_work *work;
>+
>+	dev_addr = &id_priv->id.route.addr.dev_addr;
>+
>+	if (!memcmp(dev_addr->src_dev_name, ndev->name, IFNAMSIZ) &&
>+	  memcmp(dev_addr->src_dev_addr, ndev->dev_addr, ndev->addr_len)) {
>+		printk(KERN_ERR "addr change for device %s used by id %p,
>notifying\n",

Is KERN_ERR what we want here?

>+static int cma_netdev_callback(struct notifier_block *self, unsigned long
>event,
>+	void *ctx)
>+{
>+	struct net_device *ndev = (struct net_device *)ctx;
>+	struct cma_device *cma_dev;
>+	struct rdma_id_private *id_priv;
>+	int ret = NOTIFY_DONE;
>+
>+	if (dev_net(ndev) != &init_net)
>+		return NOTIFY_DONE;
>+
>+	if (event != NETDEV_BONDING_FAILOVER)
>+		return NOTIFY_DONE;
>+
>+	if (!(ndev->flags & IFF_MASTER) || !(ndev->priv_flags & IFF_BONDING))
>+		return NOTIFY_DONE;
>+
>+	mutex_lock(&lock);
>+	list_for_each_entry(cma_dev, &dev_list, list)
>+		list_for_each_entry(id_priv, &cma_dev->id_list, list) {
>+			ret = cma_netdev_change(ndev, id_priv);
>+			if (ret)
>+				break;

Should this be goto (mutex_unlock) instead?

Okay - I think we're pretty close on the rdma_cm side of things.  Thanks.

- Sean




More information about the general mailing list