Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13c19222 authored by Don Hiatt's avatar Don Hiatt Committed by Doug Ledford
Browse files

IB/rdmavt, hfi1, qib: Modify check_ah() to account for extended LIDs



rvt_check_ah() delegates lid verification to underlying
driver. Underlying driver uses different conditions to
check for dlid depending on whether the device supports
extended LIDs

Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarDasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com>
Signed-off-by: default avatarDon Hiatt <don.hiatt@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent d295dbeb
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -333,15 +333,6 @@ struct diag_pkt {

#define DEFAULT_P_KEY LIM_MGMT_P_KEY

/**
 * 0xF8 - 4 bits of multicast range and 1 bit for collective range
 * Example: For 24 bit LID space,
 * Multicast range: 0xF00000 to 0xF7FFFF
 * Collective range: 0xF80000 to 0xFFFFFE
 */
#define HFI1_MCAST_NR 0x4 /* Number of top bits set */
#define HFI1_COLLECTIVE_NR 0x1 /* Number of bits after MCAST_NR */

#define HFI1_PSM_IOC_BASE_SEQ 0x0

static inline __u64 rhf_to_cpu(const __le32 *rbuf)
+3 −2
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@
 */

#include <linux/net.h>
#include <rdma/opa_addr.h>
#define OPA_NUM_PKEY_BLOCKS_PER_SMP (OPA_SMP_DR_DATA_SIZE \
			/ (OPA_PARTITION_TABLE_BLK_SIZE * sizeof(u16)))

@@ -905,8 +906,8 @@ static int __subn_get_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,
	pi->buffer_units = cpu_to_be32(buffer_units);

	pi->opa_cap_mask = cpu_to_be16(ibp->rvp.port_cap3_flags);
	pi->collectivemask_multicastmask = ((HFI1_COLLECTIVE_NR & 0x7)
					    << 3 | (HFI1_MCAST_NR & 0x7));
	pi->collectivemask_multicastmask = ((OPA_COLLECTIVE_NR & 0x7)
					    << 3 | (OPA_MCAST_NR & 0x7));

	/* HFI supports a replay buffer 128 LTPs in size */
	pi->replay_depth.buffer = 0x80;
+5 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@
#include <linux/rculist.h>
#include <linux/mm.h>
#include <linux/vmalloc.h>
#include <rdma/opa_addr.h>

#include "hfi.h"
#include "common.h"
@@ -1461,6 +1462,10 @@ static int hfi1_check_ah(struct ib_device *ibdev, struct rdma_ah_attr *ah_attr)
	struct hfi1_devdata *dd;
	u8 sc5;

	if (hfi1_check_mcast(rdma_ah_get_dlid(ah_attr)) &&
	    !(rdma_ah_get_ah_flags(ah_attr) & IB_AH_GRH))
		return -EINVAL;

	/* test the mapping for validity */
	ibp = to_iport(ibdev, rdma_ah_get_port_num(ah_attr));
	ppd = ppd_from_ibp(ibp);
+9 −0
Original line number Diff line number Diff line
@@ -1341,6 +1341,15 @@ int qib_check_ah(struct ib_device *ibdev, struct rdma_ah_attr *ah_attr)
	if (rdma_ah_get_sl(ah_attr) > 15)
		return -EINVAL;

	if (rdma_ah_get_dlid(ah_attr) == 0)
		return -EINVAL;
	if (rdma_ah_get_dlid(ah_attr) >=
		be16_to_cpu(IB_MULTICAST_LID_BASE) &&
	    rdma_ah_get_dlid(ah_attr) !=
		be16_to_cpu(IB_LID_PERMISSIVE) &&
	    !(rdma_ah_get_ah_flags(ah_attr) & IB_AH_GRH))
		return -EINVAL;

	return 0;
}

+0 −10
Original line number Diff line number Diff line
@@ -66,8 +66,6 @@ int rvt_check_ah(struct ib_device *ibdev,
	int port_num = rdma_ah_get_port_num(ah_attr);
	struct ib_port_attr port_attr;
	struct rvt_dev_info *rdi = ib_to_rvt(ibdev);
	enum rdma_link_layer link = rdma_port_get_link_layer(ibdev, port_num);
	u32 dlid = rdma_ah_get_dlid(ah_attr);
	u8 ah_flags = rdma_ah_get_ah_flags(ah_attr);
	u8 static_rate = rdma_ah_get_static_rate(ah_attr);

@@ -83,14 +81,6 @@ int rvt_check_ah(struct ib_device *ibdev,
	if ((ah_flags & IB_AH_GRH) &&
	    rdma_ah_read_grh(ah_attr)->sgid_index >= port_attr.gid_tbl_len)
		return -EINVAL;
	if (link != IB_LINK_LAYER_ETHERNET) {
		if (dlid == 0)
			return -EINVAL;
		if (dlid >= be16_to_cpu(IB_MULTICAST_LID_BASE) &&
		    dlid != be16_to_cpu(IB_LID_PERMISSIVE) &&
		    !(ah_flags & IB_AH_GRH))
			return -EINVAL;
	}
	if (rdi->driver_f.check_ah)
		return rdi->driver_f.check_ah(ibdev, ah_attr);
	return 0;
Loading