diff mbox

ibsim: Do not return allportselect for non-switches

Message ID 1371603068.19017.95.camel@auk59.llnl.gov (mailing list archive)
State Accepted
Delegated to: Hal Rosenstock
Headers show

Commit Message

Al Chu June 19, 2013, 12:51 a.m. UTC
ibsim only supports allportselect (i.e. port 0xff) for switches
but not HCAs.  However the allportselect flag would be returned
for all classportinfo requests, leading to unexpected results
when running some infiniband-diag tools against ibsim.

Signed-off-by: Albert L. Chu <chu11@llnl.gov>
---
 ibsim/sim_mad.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

Comments

Hal Rosenstock June 19, 2013, 6:12 p.m. UTC | #1
On 6/18/2013 8:51 PM, Albert Chu wrote:
> ibsim only supports allportselect (i.e. port 0xff) for switches
> but not HCAs.  However the allportselect flag would be returned
> for all classportinfo requests, leading to unexpected results
> when running some infiniband-diag tools against ibsim.
> 
> Signed-off-by: Albert L. Chu <chu11@llnl.gov>

Thanks. Applied.

-- Hal
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/ibsim/sim_mad.c b/ibsim/sim_mad.c
index 0b52c52..223d507 100644
--- a/ibsim/sim_mad.c
+++ b/ibsim/sim_mad.c
@@ -235,6 +235,7 @@  static int reply_MAD(void *buf, ib_rpc_t * rpc, ib_dr_path_t * path,
 
 static int do_cpi(Port * port, unsigned op, uint32_t mod, uint8_t * data)
 {
+	Node *node = port->node;
 	int status = 0;
 
 	if (op != IB_MAD_METHOD_GET)
@@ -242,7 +243,10 @@  static int do_cpi(Port * port, unsigned op, uint32_t mod, uint8_t * data)
 	memset(data, 0, IB_SMP_DATA_SIZE);
 	mad_set_field(data, 0, IB_CPI_BASEVER_F, 1);
 	mad_set_field(data, 0, IB_CPI_CLASSVER_F, 1);
-	mad_set_field(data, 0, IB_CPI_CAPMASK_F, 0x300);
+	if (node->type != SWITCH_NODE)
+		mad_set_field(data, 0, IB_CPI_CAPMASK_F, 0x200);
+	else
+		mad_set_field(data, 0, IB_CPI_CAPMASK_F, 0x300);
 	mad_set_field(data, 0, IB_CPI_RESP_TIME_VALUE_F, 0x12);
 	return status;
 }