On Wed, Feb 03, 2010 at 02:28:05PM -0600, Steve Wise wrote:
> Here is the patched cma_acquire_dev() function.  Where does it
> "build the gid in the pre rocee patches fashion and search again"
> for the iwarp case?  Maybe I'm missing it?
> 
> ---------------
> static int cma_acquire_dev(struct rdma_id_private *id_priv)
> {
>        struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr;
>        struct cma_device *cma_dev;
>        union ib_gid gid;
>        int ret = -ENODEV;
> 
>        if (dev_addr->dev_type != ARPHRD_INFINIBAND) {
>                rocee_addr_get_sgid(dev_addr, &gid);
>                list_for_each_entry(cma_dev, &dev_list, list) {
>                        ret = ib_find_cached_gid(cma_dev->device, &gid,
>                                                 &id_priv->id.port_num,
> NULL);
>                        if (!ret)
>                                break;
>                }
>        } else {

here it is - it's the memcpy below:

>                memcpy(&gid, dev_addr->src_dev_addr +
>                       rdma_addr_gid_offset(dev_addr), sizeof gid);
>                list_for_each_entry(cma_dev, &dev_list, list) {
>                        ret = ib_find_cached_gid(cma_dev->device, &gid,
>                                                 &id_priv->id.port_num,
> NULL);
>                        if (!ret)
>                                break;
>                }
>        }
> 
>        if (!ret)
>                cma_attach_to_dev(id_priv, cma_dev);
> 
>        return ret;
> }
> ----------------
> 
> 
> 
> Eli Cohen wrote:
> >On Wed, Feb 03, 2010 at 09:20:05AM -0600, Steve Wise wrote:
> >>>diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
> >>>index a2d5aad..76dce2b 100644
> >>>--- a/drivers/infiniband/core/cma.c
> >>>+++ b/drivers/infiniband/core/cma.c
> >>>@@ -348,15 +348,28 @@ static int cma_acquire_dev(struct rdma_id_private 
> >>>*id_priv)
> >>>   union ib_gid gid;
> >>>   int ret = -ENODEV;
> >>>-  rdma_addr_get_sgid(dev_addr, &gid);
> >>>-  list_for_each_entry(cma_dev, &dev_list, list) {
> >>>-          ret = ib_find_cached_gid(cma_dev->device, &gid,
> >>>-                                   &id_priv->id.port_num, NULL);
> >>>-          if (!ret) {
> >>>-                  cma_attach_to_dev(id_priv, cma_dev);
> >>>-                  break;
> >>>+  if (dev_addr->dev_type != ARPHRD_INFINIBAND) {
> >>>+          rocee_addr_get_sgid(dev_addr, &gid);
> >>>+          list_for_each_entry(cma_dev, &dev_list, list) {
> >>>+                  ret = ib_find_cached_gid(cma_dev->device, &gid,
> >>>+                                           &id_priv->id.port_num, NULL);
> >>>+                  if (!ret)
> >>>+                          break;
> >>>+          }
> >>The above if statement is true for iwarp devices, so this patch is
> >>just wrong.   rocee__addr_get_sgid() should only be used for ROCEE
> >>interfaces, correct?
> >
> >No, the idea is this: for non ARPHRD_INFINIBAND devices (e.g. rocee or
> >iwarp) I assume first this rocee, get the rocee gid, and check if this
> >gid appears in any device's gid table. It the mac address belongs to a
> >rocee device then it will be found; if it belongs to an iwarp device
> >then it won't be found. In the later case I build the gid in the pre
> >rocee patches fashion and search again.
> >>
> >>>+  } else {
> >>>+          memcpy(&gid, dev_addr->src_dev_addr +
> >>>+                 rdma_addr_gid_offset(dev_addr), sizeof gid);
> >>>+          list_for_each_entry(cma_dev, &dev_list, list) {
> >>>+                  ret = ib_find_cached_gid(cma_dev->device, &gid,
> >>>+                                           &id_priv->id.port_num, NULL);
> >>>+                  if (!ret)
> >>>+                          break;
> >>>           }
> >>>   }
> >>>+
> >>>+  if (!ret)
> >>>+          cma_attach_to_dev(id_priv, cma_dev);
> >>>+
> >>>   return ret;
> >>>}
_______________________________________________
ewg mailing list
ewg@lists.openfabrics.org
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg

Reply via email to