mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
InfiniBand/RDMA changes for the 3.4 merge window. Nothing big really
stands out; by patch count lots of fixes to the mlx4 driver plus some cleanups and fixes to the core and other drivers. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABCAAGBQJPZ2THAAoJEENa44ZhAt0hMgkP/AwXjwzz6lYlIizytQ5KOH11 CT/VoHLIGIwY31aRhZRHggWLEbJi8akgfh04K9PiSh/muFRPYk5KJDoQEoJV5Odv 12krqtpZeL41YcAPq0wiyP3Ki5AZDCDumzWbOtmxE9m93mVfi3yFTTWDHFo/7SOx A2kUITdKuZhgBpCFYS23Gs8QTWcMPUlwNlM76edG90BjSySHsK15tbqTUaEOC6Ux SPG0p0c2YjlZCPmRObrCL65o5LFRVajinZ4rXN7rre4LEU+IuXgW+mQU2Kwy8z6a oMPE2l4OMSqj270r2PlVK087gGH69nKfLgLQLJiP0Id+KwdYUk7vQcA+Fu0jwjP3 Ci/ahllvB76IiaNbax0vTy2ohCJmilLLotAP46NW0vPR2/KnmVy0Mqk8pXQQddw4 tnAFNnafn/MjTty8GwqyXR/enJZs29ePcSxcYnKjXYRIgG4ldejL2wktgSra8+gb 3/qFag1HRgZzcICkXGpHj7uWJ2KDe++1m6KTb0THUmrjuiel6ATFZpYoeRed3GfS ZMqpjZvuXM8nA9CrKMkzm5vIiUFF8Qq0hUTLR38F8FiNEhmC08JqH5PqjJ3Z18if R1yG4W4xmp/0ICHg4zyg6LWV3YsweDD+jSCJpW+KNBvu3HtYb41HIlK+i2TTmtPD 3etEZZRwROAyYKcwN01p =DbLx -----END PGP SIGNATURE----- Merge tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband Pull InfiniBand/RDMA changes for the 3.4 merge window from Roland Dreier: "Nothing big really stands out; by patch count lots of fixes to the mlx4 driver plus some cleanups and fixes to the core and other drivers." * tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: (28 commits) mlx4_core: Scale size of MTT table with system RAM mlx4_core: Allow dynamic MTU configuration for IB ports IB/mlx4: Fix info returned when querying IBoE ports IB/mlx4: Fix possible missed completion event mlx4_core: Report thermal error events mlx4_core: Fix one more static exported function IB: Change CQE "csum_ok" field to a bit flag RDMA/iwcm: Reject connect requests if cmid is not in LISTEN state RDMA/cxgb3: Don't pass irq flags to flush_qp() mlx4_core: Get rid of redundant ext_port_cap flags RDMA/ucma: Fix AB-BA deadlock IB/ehca: Fix ilog2() compile failure IB: Use central enum for speed instead of hard-coded values IB/iser: Post initial receive buffers before sending the final login request IB/iser: Free IB connection resources in the proper place IB/srp: Consolidate repetitive sysfs code IB/srp: Use pr_fmt() and pr_err()/pr_warn() IB/core: Fix SDR rates in sysfs mlx4: Enforce device max FMR maps in FMR alloc IB/mlx4: Set bad_wr for invalid send opcode ...
This commit is contained in:
commit
0c2fe82a9b
39 changed files with 606 additions and 351 deletions
|
|
@ -79,7 +79,8 @@ enum {
|
|||
(1ull << MLX4_EVENT_TYPE_SRQ_LIMIT) | \
|
||||
(1ull << MLX4_EVENT_TYPE_CMD) | \
|
||||
(1ull << MLX4_EVENT_TYPE_COMM_CHANNEL) | \
|
||||
(1ull << MLX4_EVENT_TYPE_FLR_EVENT))
|
||||
(1ull << MLX4_EVENT_TYPE_FLR_EVENT) | \
|
||||
(1ull << MLX4_EVENT_TYPE_FATAL_WARNING))
|
||||
|
||||
static void eq_set_ci(struct mlx4_eq *eq, int req_not)
|
||||
{
|
||||
|
|
@ -443,6 +444,35 @@ static int mlx4_eq_int(struct mlx4_dev *dev, struct mlx4_eq *eq)
|
|||
queue_work(priv->mfunc.master.comm_wq,
|
||||
&priv->mfunc.master.slave_flr_event_work);
|
||||
break;
|
||||
|
||||
case MLX4_EVENT_TYPE_FATAL_WARNING:
|
||||
if (eqe->subtype == MLX4_FATAL_WARNING_SUBTYPE_WARMING) {
|
||||
if (mlx4_is_master(dev))
|
||||
for (i = 0; i < dev->num_slaves; i++) {
|
||||
mlx4_dbg(dev, "%s: Sending "
|
||||
"MLX4_FATAL_WARNING_SUBTYPE_WARMING"
|
||||
" to slave: %d\n", __func__, i);
|
||||
if (i == dev->caps.function)
|
||||
continue;
|
||||
mlx4_slave_event(dev, i, eqe);
|
||||
}
|
||||
mlx4_err(dev, "Temperature Threshold was reached! "
|
||||
"Threshold: %d celsius degrees; "
|
||||
"Current Temperature: %d\n",
|
||||
be16_to_cpu(eqe->event.warming.warning_threshold),
|
||||
be16_to_cpu(eqe->event.warming.current_temperature));
|
||||
} else
|
||||
mlx4_warn(dev, "Unhandled event FATAL WARNING (%02x), "
|
||||
"subtype %02x on EQ %d at index %u. owner=%x, "
|
||||
"nent=0x%x, slave=%x, ownership=%s\n",
|
||||
eqe->type, eqe->subtype, eq->eqn,
|
||||
eq->cons_index, eqe->owner, eq->nent,
|
||||
eqe->slave_id,
|
||||
!!(eqe->owner & 0x80) ^
|
||||
!!(eq->cons_index & eq->nent) ? "HW" : "SW");
|
||||
|
||||
break;
|
||||
|
||||
case MLX4_EVENT_TYPE_EEC_CATAS_ERROR:
|
||||
case MLX4_EVENT_TYPE_ECC_DETECT:
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ static int mlx4_how_many_lives_vf(struct mlx4_dev *dev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int mlx4_is_slave_active(struct mlx4_dev *dev, int slave)
|
||||
int mlx4_is_slave_active(struct mlx4_dev *dev, int slave)
|
||||
{
|
||||
struct mlx4_priv *priv = mlx4_priv(dev);
|
||||
struct mlx4_slave_state *s_slave;
|
||||
|
|
@ -646,6 +646,99 @@ out:
|
|||
return err ? err : count;
|
||||
}
|
||||
|
||||
enum ibta_mtu {
|
||||
IB_MTU_256 = 1,
|
||||
IB_MTU_512 = 2,
|
||||
IB_MTU_1024 = 3,
|
||||
IB_MTU_2048 = 4,
|
||||
IB_MTU_4096 = 5
|
||||
};
|
||||
|
||||
static inline int int_to_ibta_mtu(int mtu)
|
||||
{
|
||||
switch (mtu) {
|
||||
case 256: return IB_MTU_256;
|
||||
case 512: return IB_MTU_512;
|
||||
case 1024: return IB_MTU_1024;
|
||||
case 2048: return IB_MTU_2048;
|
||||
case 4096: return IB_MTU_4096;
|
||||
default: return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static inline int ibta_mtu_to_int(enum ibta_mtu mtu)
|
||||
{
|
||||
switch (mtu) {
|
||||
case IB_MTU_256: return 256;
|
||||
case IB_MTU_512: return 512;
|
||||
case IB_MTU_1024: return 1024;
|
||||
case IB_MTU_2048: return 2048;
|
||||
case IB_MTU_4096: return 4096;
|
||||
default: return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static ssize_t show_port_ib_mtu(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct mlx4_port_info *info = container_of(attr, struct mlx4_port_info,
|
||||
port_mtu_attr);
|
||||
struct mlx4_dev *mdev = info->dev;
|
||||
|
||||
if (mdev->caps.port_type[info->port] == MLX4_PORT_TYPE_ETH)
|
||||
mlx4_warn(mdev, "port level mtu is only used for IB ports\n");
|
||||
|
||||
sprintf(buf, "%d\n",
|
||||
ibta_mtu_to_int(mdev->caps.port_ib_mtu[info->port]));
|
||||
return strlen(buf);
|
||||
}
|
||||
|
||||
static ssize_t set_port_ib_mtu(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct mlx4_port_info *info = container_of(attr, struct mlx4_port_info,
|
||||
port_mtu_attr);
|
||||
struct mlx4_dev *mdev = info->dev;
|
||||
struct mlx4_priv *priv = mlx4_priv(mdev);
|
||||
int err, port, mtu, ibta_mtu = -1;
|
||||
|
||||
if (mdev->caps.port_type[info->port] == MLX4_PORT_TYPE_ETH) {
|
||||
mlx4_warn(mdev, "port level mtu is only used for IB ports\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = sscanf(buf, "%d", &mtu);
|
||||
if (err > 0)
|
||||
ibta_mtu = int_to_ibta_mtu(mtu);
|
||||
|
||||
if (err <= 0 || ibta_mtu < 0) {
|
||||
mlx4_err(mdev, "%s is invalid IBTA mtu\n", buf);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mdev->caps.port_ib_mtu[info->port] = ibta_mtu;
|
||||
|
||||
mlx4_stop_sense(mdev);
|
||||
mutex_lock(&priv->port_mutex);
|
||||
mlx4_unregister_device(mdev);
|
||||
for (port = 1; port <= mdev->caps.num_ports; port++) {
|
||||
mlx4_CLOSE_PORT(mdev, port);
|
||||
err = mlx4_SET_PORT(mdev, port);
|
||||
if (err) {
|
||||
mlx4_err(mdev, "Failed to set port %d, "
|
||||
"aborting\n", port);
|
||||
goto err_set_port;
|
||||
}
|
||||
}
|
||||
err = mlx4_register_device(mdev);
|
||||
err_set_port:
|
||||
mutex_unlock(&priv->port_mutex);
|
||||
mlx4_start_sense(mdev);
|
||||
return err ? err : count;
|
||||
}
|
||||
|
||||
static int mlx4_load_fw(struct mlx4_dev *dev)
|
||||
{
|
||||
struct mlx4_priv *priv = mlx4_priv(dev);
|
||||
|
|
@ -1133,6 +1226,8 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
|
|||
goto err_stop_fw;
|
||||
}
|
||||
|
||||
dev->caps.max_fmr_maps = (1 << (32 - ilog2(dev->caps.num_mpts))) - 1;
|
||||
|
||||
init_hca.log_uar_sz = ilog2(dev->caps.num_uars);
|
||||
init_hca.uar_page_sz = PAGE_SHIFT - 12;
|
||||
|
||||
|
|
@ -1363,12 +1458,10 @@ static int mlx4_setup_hca(struct mlx4_dev *dev)
|
|||
"with caps = 0\n", port, err);
|
||||
dev->caps.ib_port_def_cap[port] = ib_port_default_caps;
|
||||
|
||||
err = mlx4_check_ext_port_caps(dev, port);
|
||||
if (err)
|
||||
mlx4_warn(dev, "failed to get port %d extended "
|
||||
"port capabilities support info (%d)."
|
||||
" Assuming not supported\n",
|
||||
port, err);
|
||||
if (mlx4_is_mfunc(dev))
|
||||
dev->caps.port_ib_mtu[port] = IB_MTU_2048;
|
||||
else
|
||||
dev->caps.port_ib_mtu[port] = IB_MTU_4096;
|
||||
|
||||
err = mlx4_SET_PORT(dev, port);
|
||||
if (err) {
|
||||
|
|
@ -1524,6 +1617,24 @@ static int mlx4_init_port_info(struct mlx4_dev *dev, int port)
|
|||
info->port = -1;
|
||||
}
|
||||
|
||||
sprintf(info->dev_mtu_name, "mlx4_port%d_mtu", port);
|
||||
info->port_mtu_attr.attr.name = info->dev_mtu_name;
|
||||
if (mlx4_is_mfunc(dev))
|
||||
info->port_mtu_attr.attr.mode = S_IRUGO;
|
||||
else {
|
||||
info->port_mtu_attr.attr.mode = S_IRUGO | S_IWUSR;
|
||||
info->port_mtu_attr.store = set_port_ib_mtu;
|
||||
}
|
||||
info->port_mtu_attr.show = show_port_ib_mtu;
|
||||
sysfs_attr_init(&info->port_mtu_attr.attr);
|
||||
|
||||
err = device_create_file(&dev->pdev->dev, &info->port_mtu_attr);
|
||||
if (err) {
|
||||
mlx4_err(dev, "Failed to create mtu file for port %d\n", port);
|
||||
device_remove_file(&info->dev->pdev->dev, &info->port_attr);
|
||||
info->port = -1;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -1533,6 +1644,7 @@ static void mlx4_cleanup_port_info(struct mlx4_port_info *info)
|
|||
return;
|
||||
|
||||
device_remove_file(&info->dev->pdev->dev, &info->port_attr);
|
||||
device_remove_file(&info->dev->pdev->dev, &info->port_mtu_attr);
|
||||
}
|
||||
|
||||
static int mlx4_init_steering(struct mlx4_dev *dev)
|
||||
|
|
|
|||
|
|
@ -363,6 +363,10 @@ struct mlx4_eqe {
|
|||
struct {
|
||||
__be32 slave_id;
|
||||
} __packed flr_event;
|
||||
struct {
|
||||
__be16 current_temperature;
|
||||
__be16 warning_threshold;
|
||||
} __packed warming;
|
||||
} event;
|
||||
u8 slave_id;
|
||||
u8 reserved3[2];
|
||||
|
|
@ -399,7 +403,7 @@ struct mlx4_profile {
|
|||
int num_cq;
|
||||
int num_mcg;
|
||||
int num_mpt;
|
||||
int num_mtt;
|
||||
unsigned num_mtt;
|
||||
};
|
||||
|
||||
struct mlx4_fw {
|
||||
|
|
@ -682,6 +686,8 @@ struct mlx4_port_info {
|
|||
char dev_name[16];
|
||||
struct device_attribute port_attr;
|
||||
enum mlx4_port_type tmp_type;
|
||||
char dev_mtu_name[16];
|
||||
struct device_attribute port_mtu_attr;
|
||||
struct mlx4_mac_table mac_table;
|
||||
struct radix_tree_root mac_tree;
|
||||
struct mlx4_vlan_table vlan_table;
|
||||
|
|
@ -1024,7 +1030,6 @@ int mlx4_QUERY_PORT_wrapper(struct mlx4_dev *dev, int slave,
|
|||
struct mlx4_cmd_mailbox *outbox,
|
||||
struct mlx4_cmd_info *cmd);
|
||||
int mlx4_get_port_ib_caps(struct mlx4_dev *dev, u8 port, __be32 *caps);
|
||||
int mlx4_check_ext_port_caps(struct mlx4_dev *dev, u8 port);
|
||||
|
||||
|
||||
int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
|
||||
|
|
|
|||
|
|
@ -791,6 +791,9 @@ int mlx4_fmr_alloc(struct mlx4_dev *dev, u32 pd, u32 access, int max_pages,
|
|||
u64 mtt_offset;
|
||||
int err = -ENOMEM;
|
||||
|
||||
if (max_maps > dev->caps.max_fmr_maps)
|
||||
return -EINVAL;
|
||||
|
||||
if (page_shift < (ffs(dev->caps.page_size_cap) - 1) || page_shift >= 32)
|
||||
return -EINVAL;
|
||||
|
||||
|
|
|
|||
|
|
@ -590,49 +590,6 @@ int mlx4_get_port_ib_caps(struct mlx4_dev *dev, u8 port, __be32 *caps)
|
|||
return err;
|
||||
}
|
||||
|
||||
int mlx4_check_ext_port_caps(struct mlx4_dev *dev, u8 port)
|
||||
{
|
||||
struct mlx4_cmd_mailbox *inmailbox, *outmailbox;
|
||||
u8 *inbuf, *outbuf;
|
||||
int err, packet_error;
|
||||
|
||||
inmailbox = mlx4_alloc_cmd_mailbox(dev);
|
||||
if (IS_ERR(inmailbox))
|
||||
return PTR_ERR(inmailbox);
|
||||
|
||||
outmailbox = mlx4_alloc_cmd_mailbox(dev);
|
||||
if (IS_ERR(outmailbox)) {
|
||||
mlx4_free_cmd_mailbox(dev, inmailbox);
|
||||
return PTR_ERR(outmailbox);
|
||||
}
|
||||
|
||||
inbuf = inmailbox->buf;
|
||||
outbuf = outmailbox->buf;
|
||||
memset(inbuf, 0, 256);
|
||||
memset(outbuf, 0, 256);
|
||||
inbuf[0] = 1;
|
||||
inbuf[1] = 1;
|
||||
inbuf[2] = 1;
|
||||
inbuf[3] = 1;
|
||||
|
||||
*(__be16 *) (&inbuf[16]) = MLX4_ATTR_EXTENDED_PORT_INFO;
|
||||
*(__be32 *) (&inbuf[20]) = cpu_to_be32(port);
|
||||
|
||||
err = mlx4_cmd_box(dev, inmailbox->dma, outmailbox->dma, port, 3,
|
||||
MLX4_CMD_MAD_IFC, MLX4_CMD_TIME_CLASS_C,
|
||||
MLX4_CMD_NATIVE);
|
||||
|
||||
packet_error = be16_to_cpu(*(__be16 *) (outbuf + 4));
|
||||
|
||||
dev->caps.ext_port_cap[port] = (!err && !packet_error) ?
|
||||
MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO
|
||||
: 0;
|
||||
|
||||
mlx4_free_cmd_mailbox(dev, inmailbox);
|
||||
mlx4_free_cmd_mailbox(dev, outmailbox);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int mlx4_common_set_port(struct mlx4_dev *dev, int slave, u32 in_mod,
|
||||
u8 op_mod, struct mlx4_cmd_mailbox *inbox)
|
||||
{
|
||||
|
|
@ -766,10 +723,18 @@ int mlx4_SET_PORT_wrapper(struct mlx4_dev *dev, int slave,
|
|||
vhcr->op_modifier, inbox);
|
||||
}
|
||||
|
||||
/* bit locations for set port command with zero op modifier */
|
||||
enum {
|
||||
MLX4_SET_PORT_VL_CAP = 4, /* bits 7:4 */
|
||||
MLX4_SET_PORT_MTU_CAP = 12, /* bits 15:12 */
|
||||
MLX4_CHANGE_PORT_VL_CAP = 21,
|
||||
MLX4_CHANGE_PORT_MTU_CAP = 22,
|
||||
};
|
||||
|
||||
int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port)
|
||||
{
|
||||
struct mlx4_cmd_mailbox *mailbox;
|
||||
int err;
|
||||
int err, vl_cap;
|
||||
|
||||
if (dev->caps.port_type[port] == MLX4_PORT_TYPE_ETH)
|
||||
return 0;
|
||||
|
|
@ -781,8 +746,19 @@ int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port)
|
|||
memset(mailbox->buf, 0, 256);
|
||||
|
||||
((__be32 *) mailbox->buf)[1] = dev->caps.ib_port_def_cap[port];
|
||||
err = mlx4_cmd(dev, mailbox->dma, port, 0, MLX4_CMD_SET_PORT,
|
||||
MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED);
|
||||
|
||||
/* IB VL CAP enum isn't used by the firmware, just numerical values */
|
||||
for (vl_cap = 8; vl_cap >= 1; vl_cap >>= 1) {
|
||||
((__be32 *) mailbox->buf)[0] = cpu_to_be32(
|
||||
(1 << MLX4_CHANGE_PORT_MTU_CAP) |
|
||||
(1 << MLX4_CHANGE_PORT_VL_CAP) |
|
||||
(dev->caps.port_ib_mtu[port] << MLX4_SET_PORT_MTU_CAP) |
|
||||
(vl_cap << MLX4_SET_PORT_VL_CAP));
|
||||
err = mlx4_cmd(dev, mailbox->dma, port, 0, MLX4_CMD_SET_PORT,
|
||||
MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED);
|
||||
if (err != -ENOMEM)
|
||||
break;
|
||||
}
|
||||
|
||||
mlx4_free_cmd_mailbox(dev, mailbox);
|
||||
return err;
|
||||
|
|
|
|||
|
|
@ -83,12 +83,31 @@ u64 mlx4_make_profile(struct mlx4_dev *dev,
|
|||
u64 total_size = 0;
|
||||
struct mlx4_resource *profile;
|
||||
struct mlx4_resource tmp;
|
||||
struct sysinfo si;
|
||||
int i, j;
|
||||
|
||||
profile = kcalloc(MLX4_RES_NUM, sizeof(*profile), GFP_KERNEL);
|
||||
if (!profile)
|
||||
return -ENOMEM;
|
||||
|
||||
/*
|
||||
* We want to scale the number of MTTs with the size of the
|
||||
* system memory, since it makes sense to register a lot of
|
||||
* memory on a system with a lot of memory. As a heuristic,
|
||||
* make sure we have enough MTTs to cover twice the system
|
||||
* memory (with PAGE_SIZE entries).
|
||||
*
|
||||
* This number has to be a power of two and fit into 32 bits
|
||||
* due to device limitations, so cap this at 2^31 as well.
|
||||
* That limits us to 8TB of memory registration per HCA with
|
||||
* 4KB pages, which is probably OK for the next few months.
|
||||
*/
|
||||
si_meminfo(&si);
|
||||
request->num_mtt =
|
||||
roundup_pow_of_two(max_t(unsigned, request->num_mtt,
|
||||
min(1UL << 31,
|
||||
si.totalram >> (log_mtts_per_seg - 1))));
|
||||
|
||||
profile[MLX4_RES_QP].size = dev_cap->qpc_entry_sz;
|
||||
profile[MLX4_RES_RDMARC].size = dev_cap->rdmarc_entry_sz;
|
||||
profile[MLX4_RES_ALTC].size = dev_cap->altc_entry_sz;
|
||||
|
|
|
|||
Loading…
Reference in a new issue