[ofa-general] [PATCH] opensm: set SA attribute offset to 0 when no records are returned

Sasha Khapyorsky sashak at voltaire.com
Sun Mar 2 12:07:24 PST 2008


IBA 1.2.1 clarifies (t.187, p.897) that SA Attribute offset shell be set
to zero if zero attributes are returned. Fix this.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/opensm/osm_sa.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/opensm/opensm/osm_sa.c b/opensm/opensm/osm_sa.c
index d85463e..46c5bf7 100644
--- a/opensm/opensm/osm_sa.c
+++ b/opensm/opensm/osm_sa.c
@@ -372,6 +372,8 @@ osm_sa_send_error(IN osm_sa_t * sa,
 
 	if (p_resp_sa_mad->method == IB_MAD_METHOD_SET)
 		p_resp_sa_mad->method = IB_MAD_METHOD_GET;
+	else if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE)
+		p_resp_sa_mad->attr_offset = 0;
 
 	p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
 
@@ -473,7 +475,7 @@ void osm_sa_respond(osm_sa_t *sa, osm_madw_t *madw, size_t attr_size,
 	resp_sa_mad->sm_key = 0;
 
 	/* Fill in the offset (paylen will be done by the rmpp SAR) */
-	resp_sa_mad->attr_offset = ib_get_attr_offset(attr_size);
+	resp_sa_mad->attr_offset = num_rec ? ib_get_attr_offset(attr_size) : 0;
 
 	p = ib_sa_mad_get_payload_ptr(resp_sa_mad);
 
-- 
1.5.4.rc2.60.gb2e62




More information about the general mailing list