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

Commit f549e088 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull infiniband fixes from Roland Dreier:
 "Fix a regression in the /sys/class/infiniband/.../rate attribute --
  old kernels used to just return something, even if the underlying
  value was out-of-bounds, while 3.4-rc1 returned EINVAL to userspace.
  This breaks some applications that check for the error, so go back to
  the old behavior."

* tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband:
  IB/core: Don't return EINVAL from sysfs rate attribute for invalid speeds
  IB/mlx4: Don't return an invalid speed when a port is down
parents 70f33fa5 0559d8dc
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused,
{
	struct ib_port_attr attr;
	char *speed = "";
	int rate = -1;		/* in deci-Gb/sec */
	int rate;		/* in deci-Gb/sec */
	ssize_t ret;

	ret = ib_query_port(p->ibdev, p->port_num, &attr);
@@ -187,9 +187,6 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused,
		return ret;

	switch (attr.active_speed) {
	case IB_SPEED_SDR:
		rate = 25;
		break;
	case IB_SPEED_DDR:
		speed = " DDR";
		rate = 50;
@@ -210,6 +207,10 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused,
		speed = " EDR";
		rate = 250;
		break;
	case IB_SPEED_SDR:
	default:		/* default to SDR for invalid rates */
		rate = 25;
		break;
	}

	rate *= ib_width_enum_to_int(attr.active_width);
+5 −0
Original line number Diff line number Diff line
@@ -253,6 +253,11 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 port,
		if (out_mad->data[15] & 0x1)
			props->active_speed = IB_SPEED_FDR10;
	}

	/* Avoid wrong speed value returned by FW if the IB link is down. */
	if (props->state == IB_PORT_DOWN)
		 props->active_speed = IB_SPEED_SDR;

out:
	kfree(in_mad);
	kfree(out_mad);