similar to sim_ctl_get_portinfo, return the correct port's pkey tables according to the port number.
Signed-off-by: Doron Shoham <[email protected]> --- ibsim/ibsim.c | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ibsim/ibsim.c b/ibsim/ibsim.c index 9326d37..3cb97e4 100644 --- a/ibsim/ibsim.c +++ b/ibsim/ibsim.c @@ -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)) -- 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
