IB/core: Use GID table in AH creation and dmac resolution
Previously, vlan id and source MAC were used from QP attributes. Since the net device is now stored in the GID attributes, they could be used instead of getting this information from the QP attributes. IB_QP_SMAC, IB_QP_ALT_SMAC, IB_QP_VID and IB_QP_ALT_VID were removed because there is no known libibverbs that uses them. This commit also modifies the vendors (mlx4, ocrdma) drivers in order to use the new approach. ocrdma driver changes were done by Somnath Kotur <Somnath.Kotur@Avagotech.Com> Signed-off-by: Matan Barak <matanb@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:

committed by
Doug Ledford

parent
99b27e3b5d
commit
dbf727de74
@@ -47,6 +47,7 @@
|
||||
|
||||
#include <rdma/ib_verbs.h>
|
||||
#include <rdma/ib_user_verbs.h>
|
||||
#include <rdma/ib_cache.h>
|
||||
|
||||
#include "ocrdma.h"
|
||||
#include "ocrdma_hw.h"
|
||||
@@ -2470,6 +2471,7 @@ static int ocrdma_set_av_params(struct ocrdma_qp *qp,
|
||||
int status;
|
||||
struct ib_ah_attr *ah_attr = &attrs->ah_attr;
|
||||
union ib_gid sgid, zgid;
|
||||
struct ib_gid_attr sgid_attr;
|
||||
u32 vlan_id = 0xFFFF;
|
||||
u8 mac_addr[6];
|
||||
struct ocrdma_dev *dev = get_ocrdma_dev(qp->ibqp.device);
|
||||
@@ -2488,10 +2490,14 @@ static int ocrdma_set_av_params(struct ocrdma_qp *qp,
|
||||
cmd->flags |= OCRDMA_QP_PARA_FLOW_LBL_VALID;
|
||||
memcpy(&cmd->params.dgid[0], &ah_attr->grh.dgid.raw[0],
|
||||
sizeof(cmd->params.dgid));
|
||||
status = ocrdma_query_gid(&dev->ibdev, 1,
|
||||
ah_attr->grh.sgid_index, &sgid);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
status = ib_get_cached_gid(&dev->ibdev, 1, ah_attr->grh.sgid_index,
|
||||
&sgid, &sgid_attr);
|
||||
if (!status && sgid_attr.ndev) {
|
||||
vlan_id = rdma_vlan_dev_vlan_id(sgid_attr.ndev);
|
||||
memcpy(mac_addr, sgid_attr.ndev->dev_addr, ETH_ALEN);
|
||||
dev_put(sgid_attr.ndev);
|
||||
}
|
||||
|
||||
memset(&zgid, 0, sizeof(zgid));
|
||||
if (!memcmp(&sgid, &zgid, sizeof(zgid)))
|
||||
@@ -2508,17 +2514,15 @@ static int ocrdma_set_av_params(struct ocrdma_qp *qp,
|
||||
ocrdma_cpu_to_le32(&cmd->params.dgid[0], sizeof(cmd->params.dgid));
|
||||
ocrdma_cpu_to_le32(&cmd->params.sgid[0], sizeof(cmd->params.sgid));
|
||||
cmd->params.vlan_dmac_b4_to_b5 = mac_addr[4] | (mac_addr[5] << 8);
|
||||
if (attr_mask & IB_QP_VID) {
|
||||
vlan_id = attrs->vlan_id;
|
||||
} else if (dev->pfc_state) {
|
||||
vlan_id = 0;
|
||||
pr_err("ocrdma%d:Using VLAN with PFC is recommended\n",
|
||||
dev->id);
|
||||
pr_err("ocrdma%d:Using VLAN 0 for this connection\n",
|
||||
dev->id);
|
||||
}
|
||||
|
||||
if (vlan_id < 0x1000) {
|
||||
if (dev->pfc_state) {
|
||||
vlan_id = 0;
|
||||
pr_err("ocrdma%d:Using VLAN with PFC is recommended\n",
|
||||
dev->id);
|
||||
pr_err("ocrdma%d:Using VLAN 0 for this connection\n",
|
||||
dev->id);
|
||||
}
|
||||
cmd->params.vlan_dmac_b4_to_b5 |=
|
||||
vlan_id << OCRDMA_QP_PARAMS_VLAN_SHIFT;
|
||||
cmd->flags |= OCRDMA_QP_PARA_VLAN_EN_VALID;
|
||||
|
Reference in New Issue
Block a user