Skip to contentSkip to conversation

bug fixes and supporting new functionalities

PATCH New Doron Shoham 1 participant 5 messages Mar 21, 2010 1 message not in the archive InfiniBand

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 4BA6391A.7020608-smomgflXvOZWk0Htik3J/[email protected]

#2 lore raw

PATCH 1/4 sim_ctl_get_portinfo:

do not decrease port number.
for hca port number can be 1 or 2 and
for switch its always 0.
node_get_port() already handles by type.

---
 ibsim/ibsim.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
ibsim/ibsim.c +1 -3
index e720f0d..9326d37 100644
@@ -318,10 +318,8 @@ static int sim_ctl_get_portinfo(Client * cl, struct sim_ctl * ctl)
 	uint8_t port_num = ctl->data[0];
 	if (port_num == 0 || port_num > cl->port->node->numports)
 		p = cl->port;
-	else if (cl->port->node->type == SWITCH_NODE)
-		p = node_get_port(cl->port->node, port_num);
 	else
-		p = node_get_port(cl->port->node, port_num - 1);
+		p = node_get_port(cl->port->node, port_num);
 	update_portinfo(p);
 	memcpy(ctl->data, p->portinfo, sizeof(ctl->data));
 	return 0;
Signature · 6 lines
1.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

PATCH 2/4 sim_ctl_get_pkeys

In reply to a message not in the archive

similar to sim_ctl_get_portinfo, return the correct port's pkey tables according to the port number.

---
 ibsim/ibsim.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
ibsim/ibsim.c +12 -5
index 9326d37..3cb97e4 100644
@@ -354,11 +354,18 @@ static int sim_ctl_set_issm(Client * cl, struct sim_ctl * ctl)
 
 static int sim_ctl_get_pkeys(Client * cl, struct sim_ctl * ctl)
 {
-	Port *port = cl->port;
-	unsigned size = (port->node->sw && port->portnum) ?
-	    mad_get_field(port->node->sw->switchinfo, 0,
-			  IB_SW_PARTITION_ENFORCE_CAP_F) :
-	    mad_get_field(port->node->nodeinfo, 0, IB_NODE_PARTITION_CAP_F);
+	Port *port;
+	uint8_t port_num = ctl->data[0];
+	unsigned size;
+
+	if (port_num == 0 || port_num > cl->port->node->numports)
+		port = cl->port;
+	else
+		port = node_get_port(cl->port->node, port_num);
+	size = (port->node->sw && port->portnum) ?
+			mad_get_field(port->node->sw->switchinfo, 0,
+					IB_SW_PARTITION_ENFORCE_CAP_F) :
+			mad_get_field(port->node->nodeinfo, 0, IB_NODE_PARTITION_CAP_F);
 
 	size *= sizeof(port->pkey_tbl[0]);
 	if (size > sizeof(ctl->data))
Signature · 6 lines
1.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw

PATCH 3/4 set PartitionCap and PartitionEnforcementCap to be 32.

In reply to a message not in the archive

This is maximum number of pkeys that can be sent
in one CTL message.
This number is calculated from:
SIM_CTL_MAX_DATA/sizeof(uint16_t)

---
 ibsim/sim_net.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
ibsim/sim_net.c +3 -3
index 13c3b8c..6cdd40a 100644
@@ -121,7 +121,7 @@ static const uint8_t hcaport_down[] = {
 
 static const uint8_t switchinfo[] = {
 	0xC0, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
 	0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -134,7 +134,7 @@ static const uint8_t swnodeinfo[] = {
 	0x01, 0x01, 0x02, 0x08, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
 	0xF1, 0x04, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x08,
-	0xF1, 0x04, 0x00, 0x0D, 0x00, 0x08, 0xA8, 0x7C,
+	0xF1, 0x04, 0x00, 0x0D, 0x00, 0x20, 0xA8, 0x7C,
 	0x00, 0x00, 0x00, 0xA1, 0x00, 0x00, 0x08, 0xF1,
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -145,7 +145,7 @@ static const uint8_t hcanodeinfo[] = {
 	0x01, 0x01, 0x01, 0x02, 0x00, 0x02, 0xC9, 0x00,
 	0x01, 0x13, 0x6E, 0x40, 0x00, 0x02, 0xC9, 0x00,
 	0x01, 0x13, 0x6E, 0x40, 0x00, 0x02, 0xC9, 0x00,
-	0x01, 0x13, 0x6E, 0x41, 0x00, 0x40, 0x5A, 0x44,
+	0x01, 0x13, 0x6E, 0x41, 0x00, 0x20, 0x5A, 0x44,
 	0x00, 0x00, 0x00, 0xA1, 0x01, 0x00, 0x02, 0xC9,
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Signature · 6 lines
1.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw

PATCH 4/4 add support for end port selection

In reply to a message not in the archive

add support for end port selection instead
of using only the first port.

---
 ibsim/ibsim.c         |   29 +++++
 umad2sim/sim_client.c |   49 +++++++-
 umad2sim/sim_client.h |    6 +-
 umad2sim/umad2sim.c   |  332 +++++++++++++++++++++++++++----------------------
 4 files changed, 259 insertions(+), 157 deletions(-)
ibsim/ibsim.c +29 -0
index 3cb97e4..f59257d 100644
@@ -289,6 +289,31 @@ static int sim_ctl_get_port(Client * cl, struct sim_ctl * ctl)
 	return 0;
 }
 
+static int sim_ctl_set_port(Client *cl, struct sim_ctl *ctl)
+{
+	int portnum = ctl->data[0];
+	Node *node;
+
+	if (!(node = find_node(cl->nodeid)) &&
+			!(node = find_node_by_desc(cl->nodeid))) {
+		IBWARN("client %d attempt to set port to unknown host"
+				" \"%s\"", cl->id, cl->nodeid);
+		ctl->type = SIM_CTL_ERROR;
+		return -1;
+	}
+	if (portnum < 0 || portnum > node->numports) {
+		IBWARN("client %d attempt to set invalid port number %d",
+				cl->id, portnum);
+		ctl->type = SIM_CTL_ERROR;
+		return -1;
+	}
+	cl->port = node_get_port(node, portnum);
+	VERB("Setting port %d to client %d at node \"%s\" port 0x%" PRIx64,
+			portnum, cl->id, node->nodeid, cl->port->portguid);
+	return 0;
+}
+
+
 static int sim_ctl_get_gid(Client * cl, struct sim_ctl * ctl)
 {
 	char *gid = (void *)ctl->data;
@@ -458,6 +483,10 @@ static int sim_ctl(int fd)
 		sim_ctl_get_pkeys(cl, &ctl);
 		break;
 
+	case SIM_CTL_SET_PORT:
+		sim_ctl_set_port(cl, &ctl);
+		break;
+
 	default:
 	case SIM_CTL_ERROR:
 		IBWARN("bad ctl pkt type %d", ctl.type);
umad2sim/sim_client.c +43 -6

72 lines not on this page · raw message

umad2sim/sim_client.h +4 -2
index 80ed442..01d0939 100644
@@ -37,13 +37,15 @@
 
 #include <ibsim.h>
 
+#define MAX_PORTS 8
+
 struct sim_client {
 	int clientid;
 	int fd_pktin, fd_pktout, fd_ctl;
 	struct sim_vendor vendor;
 	uint8_t nodeinfo[64];
-	uint8_t portinfo[64];
-	uint16_t pkeys[SIM_CTL_MAX_DATA/sizeof(uint16_t)];
+	uint8_t *portinfo;
+	uint16_t *pkeys;
 };
 
 extern int sim_client_set_sm(struct sim_client *sc, unsigned issm);
umad2sim/umad2sim.c +183 -149

391 lines not on this page · raw message

Signature · 6 lines
1.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html