]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
IB: Let ib_core resolve destination mac address
authorParav Pandit <parav@mellanox.com>
Mon, 16 Oct 2017 05:45:13 +0000 (08:45 +0300)
committerDoug Ledford <dledford@redhat.com>
Wed, 18 Oct 2017 16:10:36 +0000 (12:10 -0400)
Since IB/core resolves the destination mac address for user and kernel
consumers, avoid resolving in multiple provider drivers.

Only ib_core resolves DMAC now, therefore resolve_eth_dmac is removed as
exported symbol.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/core/verbs.c
drivers/infiniband/hw/bnxt_re/ib_verbs.c
drivers/infiniband/hw/hns/hns_roce_ah.c
drivers/infiniband/hw/mlx4/ah.c
drivers/infiniband/hw/mlx5/ah.c
drivers/infiniband/hw/ocrdma/ocrdma_ah.c
include/rdma/ib_verbs.h

index 4dcfe47c479d23d857cba6d7cab146a6df8a8c1a..d8f1a5d34f4ff2b3b31e0286ebbd86706b8819db 100644 (file)
@@ -53,6 +53,9 @@
 
 #include "core_priv.h"
 
+static int ib_resolve_eth_dmac(struct ib_device *device,
+                              struct rdma_ah_attr *ah_attr);
+
 static const char * const ib_events[] = {
        [IB_EVENT_CQ_ERR]               = "CQ error",
        [IB_EVENT_QP_FATAL]             = "QP fatal error",
@@ -1257,8 +1260,8 @@ int ib_modify_qp_is_ok(enum ib_qp_state cur_state, enum ib_qp_state next_state,
 }
 EXPORT_SYMBOL(ib_modify_qp_is_ok);
 
-int ib_resolve_eth_dmac(struct ib_device *device,
-                       struct rdma_ah_attr *ah_attr)
+static int ib_resolve_eth_dmac(struct ib_device *device,
+                              struct rdma_ah_attr *ah_attr)
 {
        int           ret = 0;
        struct ib_global_route *grh;
@@ -1317,7 +1320,6 @@ int ib_resolve_eth_dmac(struct ib_device *device,
 out:
        return ret;
 }
-EXPORT_SYMBOL(ib_resolve_eth_dmac);
 
 /**
  * ib_modify_qp_with_udata - Modifies the attributes for the specified QP.
index 0d89621d9fe8ed81b0d28c031d48ffcacb31fdfd..20e5eb9290ad5216ebdcef52c17961d4dfe44629 100644 (file)
@@ -729,14 +729,6 @@ struct ib_ah *bnxt_re_create_ah(struct ib_pd *ib_pd,
                        ah->qplib_ah.nw_type = CMDQ_CREATE_AH_TYPE_V1;
                        break;
                }
-               rc = rdma_addr_find_l2_eth_by_grh(&sgid, &grh->dgid,
-                                                 ah_attr->roce.dmac, &vlan_tag,
-                                                 &sgid_attr.ndev->ifindex,
-                                                 NULL);
-               if (rc) {
-                       dev_err(rdev_to_dev(rdev), "Failed to get dmac\n");
-                       goto fail;
-               }
        }
 
        memcpy(ah->qplib_ah.dmac, ah_attr->roce.dmac, ETH_ALEN);
index d545302b8ef8c520d4eceb630a39db06b7a584a4..05bab4a39d915608ff0a878dbb79e86e75fa1cdd 100644 (file)
@@ -48,7 +48,6 @@ struct ib_ah *hns_roce_create_ah(struct ib_pd *ibpd,
        struct ib_gid_attr gid_attr;
        struct hns_roce_ah *ah;
        u16 vlan_tag = 0xffff;
-       struct in6_addr in6;
        const struct ib_global_route *grh = rdma_ah_read_grh(ah_attr);
        union ib_gid sgid;
        int ret;
@@ -58,18 +57,7 @@ struct ib_ah *hns_roce_create_ah(struct ib_pd *ibpd,
                return ERR_PTR(-ENOMEM);
 
        /* Get mac address */
-       memcpy(&in6, grh->dgid.raw, sizeof(grh->dgid.raw));
-       if (rdma_is_multicast_addr(&in6)) {
-               rdma_get_mcast_mac(&in6, ah->av.mac);
-       } else {
-               u8 *dmac = rdma_ah_retrieve_dmac(ah_attr);
-
-               if (!dmac) {
-                       kfree(ah);
-                       return ERR_PTR(-EINVAL);
-               }
-               memcpy(ah->av.mac, dmac, ETH_ALEN);
-       }
+       memcpy(ah->av.mac, ah_attr->roce.dmac, ETH_ALEN);
 
        /* Get source gid */
        ret = ib_get_cached_gid(ibpd->device, rdma_ah_get_port_num(ah_attr),
index 538c46a73248f264cf432c46815d18947543d3ba..6dee4fdc5d671a27100658ab7ad53a6ee0829b85 100644 (file)
@@ -92,12 +92,10 @@ static struct ib_ah *create_iboe_ah(struct ib_pd *pd,
        int ret;
 
        memcpy(&in6, grh->dgid.raw, sizeof(in6));
-       if (rdma_is_multicast_addr(&in6)) {
+       if (rdma_is_multicast_addr(&in6))
                is_mcast = 1;
-               rdma_get_mcast_mac(&in6, ah->av.eth.mac);
-       } else {
-               memcpy(ah->av.eth.mac, ah_attr->roce.dmac, ETH_ALEN);
-       }
+
+       memcpy(ah->av.eth.mac, ah_attr->roce.dmac, ETH_ALEN);
        ret = ib_get_cached_gid(pd->device, rdma_ah_get_port_num(ah_attr),
                                grh->sgid_index, &sgid, &gid_attr);
        if (ret)
index 3363e29157f6c0a56089b17bab9ea49acee0367b..fe269f680103ca8981d80c585601bcadafc9b0e4 100644 (file)
@@ -89,10 +89,6 @@ struct ib_ah *mlx5_ib_create_ah(struct ib_pd *pd, struct rdma_ah_attr *ah_attr,
 
                resp.response_length = min_resp_len;
 
-               err = ib_resolve_eth_dmac(pd->device, ah_attr);
-               if (err)
-                       return ERR_PTR(err);
-
                memcpy(resp.dmac, ah_attr->roce.dmac, ETH_ALEN);
                err = ib_copy_to_udata(udata, &resp, resp.response_length);
                if (err)
index d0249e463338653d4df6b4c89ea7d8e87d664196..dec650930ca66abde3fe34a4e27ce6e0ca2d3e34 100644 (file)
@@ -201,21 +201,6 @@ struct ib_ah *ocrdma_create_ah(struct ib_pd *ibpd, struct rdma_ah_attr *attr,
        /* Get network header type for this GID */
        ah->hdr_type = ib_gid_to_network_type(sgid_attr.gid_type, &sgid);
 
-       if ((pd->uctx) &&
-           (!rdma_is_multicast_addr((struct in6_addr *)grh->dgid.raw)) &&
-           (!rdma_link_local_addr((struct in6_addr *)grh->dgid.raw))) {
-               status = rdma_addr_find_l2_eth_by_grh(&sgid, &grh->dgid,
-                                                     attr->roce.dmac,
-                                                     &vlan_tag,
-                                                     &sgid_attr.ndev->ifindex,
-                                                     NULL);
-               if (status) {
-                       pr_err("%s(): Failed to resolve dmac from gid." 
-                               "status = %d\n", __func__, status);
-                       goto av_conf_err;
-               }
-       }
-
        status = set_av_attr(dev, ah, attr, &sgid, pd->id, &isvlan, vlan_tag);
        if (status)
                goto av_conf_err;
index 09c4a695155ef286cebebc087a0b0b31e71efdd3..9810e45686352fd5386eaf24068b4ba5190fe169 100644 (file)
@@ -3622,8 +3622,6 @@ void ib_drain_rq(struct ib_qp *qp);
 void ib_drain_sq(struct ib_qp *qp);
 void ib_drain_qp(struct ib_qp *qp);
 
-int ib_resolve_eth_dmac(struct ib_device *device,
-                       struct rdma_ah_attr *ah_attr);
 int ib_get_eth_speed(struct ib_device *dev, u8 port_num, u8 *speed, u8 *width);
 
 static inline u8 *rdma_ah_retrieve_dmac(struct rdma_ah_attr *attr)