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

Commit 337877a4 authored by Ira Weiny's avatar Ira Weiny Committed by Doug Ledford
Browse files

IB/core: Add ability for drivers to report an alternate MAD size.



Add max MAD size to the device immutable data set and have all drivers that
support MADs report the current IB MAD size (IB_MGMT_MAD_SIZE) to the core.

Verify MAD size data in both the MAD core and when reading the immutable data.

OPA drivers will report alternate MAD sizes in subsequent patches.

Signed-off-by: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent da2dfaa3
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -211,6 +211,12 @@ static int add_client_context(struct ib_device *device, struct ib_client *client
	return 0;
}

static int verify_immutable(const struct ib_device *dev, u8 port)
{
	return WARN_ON(!rdma_cap_ib_mad(dev, port) &&
			    rdma_max_mad_size(dev, port) != 0);
}

static int read_port_immutable(struct ib_device *device)
{
	int ret = -ENOMEM;
@@ -236,6 +242,11 @@ static int read_port_immutable(struct ib_device *device)
						 &device->port_immutable[port]);
		if (ret)
			goto err;

		if (verify_immutable(device, port)) {
			ret = -EINVAL;
			goto err;
		}
	}

	ret = 0;
+3 −0
Original line number Diff line number Diff line
@@ -2939,6 +2939,9 @@ static int ib_mad_port_open(struct ib_device *device,
	int has_smi;
	struct ib_cq_init_attr cq_attr = {};

	if (WARN_ON(rdma_max_mad_size(device, port_num) < IB_MGMT_MAD_SIZE))
		return -EFAULT;

	/* Create new device info */
	port_priv = kzalloc(sizeof *port_priv, GFP_KERNEL);
	if (!port_priv) {
+2 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@

#include <linux/notifier.h>
#include <linux/memory.h>
#include <rdma/ib_mad.h>
#include "ehca_classes.h"
#include "ehca_iverbs.h"
#include "ehca_mrmw.h"
@@ -444,6 +445,7 @@ static int ehca_port_immutable(struct ib_device *ibdev, u8 port_num,
	immutable->pkey_tbl_len = attr.pkey_tbl_len;
	immutable->gid_tbl_len = attr.gid_tbl_len;
	immutable->core_cap_flags = RDMA_CORE_PORT_IBA_IB;
	immutable->max_mad_size = IB_MGMT_MAD_SIZE;

	return 0;
}
+1 −0
Original line number Diff line number Diff line
@@ -1996,6 +1996,7 @@ static int ipath_port_immutable(struct ib_device *ibdev, u8 port_num,
	immutable->pkey_tbl_len = attr.pkey_tbl_len;
	immutable->gid_tbl_len = attr.gid_tbl_len;
	immutable->core_cap_flags = RDMA_CORE_PORT_IBA_IB;
	immutable->max_mad_size = IB_MGMT_MAD_SIZE;

	return 0;
}
+2 −0
Original line number Diff line number Diff line
@@ -2189,6 +2189,8 @@ static int mlx4_port_immutable(struct ib_device *ibdev, u8 port_num,
	else
		immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE;

	immutable->max_mad_size = IB_MGMT_MAD_SIZE;

	return 0;
}

Loading