RDMA/core: Avoid redundant memcpy in rdma_addr_find_l2_eth_by_grh
authorParav Pandit <parav@mellanox.com>
Tue, 14 Nov 2017 12:52:08 +0000 (14:52 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Mon, 18 Dec 2017 22:37:09 +0000 (15:37 -0700)
rdma_resolve_ip already copies 'addr' to its dev_addr argument.
Remove the duplicate memcpy and since it was the only user, remove the
'addr' member from resolve_cb_context.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/addr.c

index da4469c38eac19257f73b1274ffd8eb577d76307..6679dd43fe0839ccd6354b6bde9b2e7f26853760 100644 (file)
@@ -744,7 +744,6 @@ void rdma_addr_cancel(struct rdma_dev_addr *addr)
 EXPORT_SYMBOL(rdma_addr_cancel);
 
 struct resolve_cb_context {
-       struct rdma_dev_addr *addr;
        struct completion comp;
        int status;
 };
@@ -752,9 +751,6 @@ struct resolve_cb_context {
 static void resolve_cb(int status, struct sockaddr *src_addr,
             struct rdma_dev_addr *addr, void *context)
 {
-       if (!status)
-               memcpy(((struct resolve_cb_context *)context)->addr,
-                      addr, sizeof(struct rdma_dev_addr));
        ((struct resolve_cb_context *)context)->status = status;
        complete(&((struct resolve_cb_context *)context)->comp);
 }
@@ -780,7 +776,6 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
        dev_addr.bound_dev_if = ndev->ifindex;
        dev_addr.net = &init_net;
 
-       ctx.addr = &dev_addr;
        init_completion(&ctx.comp);
        ret = rdma_resolve_ip(&self, &sgid_addr._sockaddr, &dgid_addr._sockaddr,
                        &dev_addr, 1000, resolve_cb, &ctx);