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

Commit 2e96691c authored by Or Gerlitz's avatar Or Gerlitz Committed by Roland Dreier
Browse files

IB: Use central enum for speed instead of hard-coded values



The kernel IB stack uses one enumeration for IB speed, which wasn't
explicitly specified in the verbs header file.  Add that enum, and use
it all over the code.

The IB speed/width notation is also used by iWARP and IBoE HW drivers,
which use the convention of rate = speed * width to advertise their
port link rate.

Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent e9319b0c
Loading
Loading
Loading
Loading
+6 −7
Original line number Original line Diff line number Diff line
@@ -187,27 +187,26 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused,
		return ret;
		return ret;


	switch (attr.active_speed) {
	switch (attr.active_speed) {
	case 1:
	case IB_SPEED_SDR:
		/* SDR */
		rate = 25;
		rate = 25;
		break;
		break;
	case 2:
	case IB_SPEED_DDR:
		speed = " DDR";
		speed = " DDR";
		rate = 50;
		rate = 50;
		break;
		break;
	case 4:
	case IB_SPEED_QDR:
		speed = " QDR";
		speed = " QDR";
		rate = 100;
		rate = 100;
		break;
		break;
	case 8:
	case IB_SPEED_FDR10:
		speed = " FDR10";
		speed = " FDR10";
		rate = 100;
		rate = 100;
		break;
		break;
	case 16:
	case IB_SPEED_FDR:
		speed = " FDR";
		speed = " FDR";
		rate = 140;
		rate = 140;
		break;
		break;
	case 32:
	case IB_SPEED_EDR:
		speed = " EDR";
		speed = " EDR";
		rate = 250;
		rate = 250;
		break;
		break;
+1 −1
Original line number Original line Diff line number Diff line
@@ -94,7 +94,7 @@ static int c2_query_port(struct ib_device *ibdev,
	props->pkey_tbl_len = 1;
	props->pkey_tbl_len = 1;
	props->qkey_viol_cntr = 0;
	props->qkey_viol_cntr = 0;
	props->active_width = 1;
	props->active_width = 1;
	props->active_speed = 1;
	props->active_speed = IB_SPEED_SDR;


	return 0;
	return 0;
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -1227,7 +1227,7 @@ static int iwch_query_port(struct ib_device *ibdev,
	props->gid_tbl_len = 1;
	props->gid_tbl_len = 1;
	props->pkey_tbl_len = 1;
	props->pkey_tbl_len = 1;
	props->active_width = 2;
	props->active_width = 2;
	props->active_speed = 2;
	props->active_speed = IB_SPEED_DDR;
	props->max_msg_sz = -1;
	props->max_msg_sz = -1;


	return 0;
	return 0;
+1 −1
Original line number Original line Diff line number Diff line
@@ -329,7 +329,7 @@ static int c4iw_query_port(struct ib_device *ibdev, u8 port,
	props->gid_tbl_len = 1;
	props->gid_tbl_len = 1;
	props->pkey_tbl_len = 1;
	props->pkey_tbl_len = 1;
	props->active_width = 2;
	props->active_width = 2;
	props->active_speed = 2;
	props->active_speed = IB_SPEED_DDR;
	props->max_msg_sz = -1;
	props->max_msg_sz = -1;


	return 0;
	return 0;
+1 −1
Original line number Original line Diff line number Diff line
@@ -233,7 +233,7 @@ int ehca_query_port(struct ib_device *ibdev,
		props->phys_state      = 5;
		props->phys_state      = 5;
		props->state           = rblock->state;
		props->state           = rblock->state;
		props->active_width    = IB_WIDTH_12X;
		props->active_width    = IB_WIDTH_12X;
		props->active_speed    = 0x1;
		props->active_speed    = IB_SPEED_SDR;
	}
	}


query_port1:
query_port1:
Loading