[ofa-general] RE: [RFC v2 PATCH 4/5] rdma/cma: implement RDMA_ALIGN_WITH_NETDEVICE ha mode
Sean Hefty
sean.hefty at intel.com
Thu May 15 09:47:07 PDT 2008
>+static int cma_netdev_align_id(struct net_device *ndev, struct rdma_id_private
>*id_priv)
>+{
>+ struct rdma_dev_addr *dev_addr;
>+ struct cma_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",
>+ ndev->name, &id_priv->id);
>+ work = kzalloc(sizeof *work, GFP_KERNEL);
>+ if (!work)
>+ return -ENOMEM;
>+ work->id = id_priv;
>+ INIT_WORK(&work->work, cma_work_handler);
>+ work->old_state = id_priv->state;
>+ work->new_state = id_priv->state;
>+ work->event.event = RDMA_CM_EVENT_NETDEV_CHANGE;
>+ atomic_inc(&id_priv->refcount);
>+ queue_work(cma_wq, &work->work);
>+ }
>+}
My initial thought on this is to see if we can just queue a single work item
that can be used to invoke the user callbacks. I'd have to see how the locking
worked out though to know if that approach is 'cleaner'.
Currently, the rdma_cm ensures that only a single callback to the user is
invoked at a time. This is needed to support the user trying to destroy their
rdma_cm_id from the callback. I didn't look to see if this still maintains
that.
- Sean
More information about the general
mailing list