Skip to contentSkip to conversation

opensm/osm_sa.c: In osm_sa_respond, only fill in attr offset if RMPP method

PATCH In review Hal Rosenstock 5 participants 15 messages Jun 3, 2010 – Jun 14, 2010 6 messages not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 opensm/osm_sa.c: In osm_sa_respond, only fill in attr offset if RMPP method

---
 opensm/opensm/osm_sa.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
opensm/opensm/osm_sa.c +10 -2
index 0aca81f..8325632 100644
@@ -3,6 +3,7 @@
  * Copyright (c) 2002-2010 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
+ * Copyright (c) 2010 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -454,8 +455,15 @@ void osm_sa_respond(osm_sa_t *sa, osm_madw_t *madw, size_t attr_size,
 	/* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
 	resp_sa_mad->sm_key = 0;
 
-	/* Fill in the offset (paylen will be done by the rmpp SAR) */
-	resp_sa_mad->attr_offset = num_rec ? ib_get_attr_offset(attr_size) : 0;
+#ifdef DUAL_SIDED_RMPP
+	if (resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP ||
+	    resp_sa_mad->method == IB_MAD_METHOD_GETMULTI_RESP) {
+#else
+	if (resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP) {
+#endif
+		/* Fill in the offset (paylen will be done by the rmpp SAR) */
+		resp_sa_mad->attr_offset = num_rec ? ib_get_attr_offset(attr_size) : 0;
+	}
 
 	p = ib_sa_mad_get_payload_ptr(resp_sa_mad);
 
Signature · 6 lines
1.5.6.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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi Hal,

Quoted 23 lines · Hal Rosenstock
---
 opensm/opensm/osm_sa.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
opensm/opensm/osm_sa.c +1 -1
index 0aca81f..8325632 100644
@@ -3,6 +3,7 @@
  * Copyright (c) 2002-2010 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
+ * Copyright (c) 2010 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -454,8 +455,15 @@ void osm_sa_respond(osm_sa_t *sa, osm_madw_t *madw, size_t attr_size,
 	/* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
 	resp_sa_mad->sm_key = 0;
 
-	/* Fill in the offset (paylen will be done by the rmpp SAR) */

opensm/opensm/osm_sa.c void osm_sa_respond(osm_sa_t *sa, osm_madw_t *madw, size_t attr_size, · line 466

Quoted 10 lines
opensm/opensm/osm_sa.c +9 -1
-	resp_sa_mad->attr_offset = num_rec ? ib_get_attr_offset(attr_size) : 0;
+#ifdef DUAL_SIDED_RMPP
+	if (resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP ||
+	    resp_sa_mad->method == IB_MAD_METHOD_GETMULTI_RESP) {
+#else
+	if (resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP) {
+#endif
+		/* Fill in the offset (paylen will be done by the rmpp SAR) */
+		resp_sa_mad->attr_offset = num_rec ? ib_get_attr_offset(attr_size) : 0;
+	}

What is wrong with current implementation?

Sasha

Quoted 6 lines
opensm/opensm/osm_sa.c +0 -0
 	p = ib_sa_mad_get_payload_ptr(resp_sa_mad);
 
Signature · 1 line
1.5.6.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

Hi Sasha,

Quoted 25 lines · Sasha Khapyorsky

Hi Hal,

Quoted 22 lines · Hal Rosenstock
---
 opensm/opensm/osm_sa.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
opensm/opensm/osm_sa.c +1 -0
index 0aca81f..8325632 100644
@@ -3,6 +3,7 @@
  * Copyright (c) 2002-2010 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
+ * Copyright (c) 2010 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -454,8 +455,15 @@ void osm_sa_respond(osm_sa_t *sa, osm_madw_t *madw, size_t attr_size,
      /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
      resp_sa_mad->sm_key = 0;
 
Quoted 13 lines

opensm/opensm/osm_sa.c void osm_sa_respond(osm_sa_t *sa, osm_madw_t *madw, size_t attr_size, · line 466

Quoted 11 lines
opensm/opensm/osm_sa.c +9 -2
-     /* Fill in the offset (paylen will be done by the rmpp SAR) */
-     resp_sa_mad->attr_offset = num_rec ? ib_get_attr_offset(attr_size) : 0;
+#ifdef DUAL_SIDED_RMPP
+     if (resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP ||
+         resp_sa_mad->method == IB_MAD_METHOD_GETMULTI_RESP) {
+#else
+     if (resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP) {
+#endif
+             /* Fill in the offset (paylen will be done by the rmpp SAR) */
+             resp_sa_mad->attr_offset = num_rec ? ib_get_attr_offset(attr_size) : 0;
+     }

What is wrong with current implementation?

It's now needed for the debug version of OpenSM not to assert due to:

7fc6cd3037f07190e483a047f17d37b6bebbb2b3

Author: Smith, Stan <[email protected]>
Date:   Fri May 21 10:49:27 2010 -0700

ib_types.h add debug assert

Add a debug assert to catch incorrect MAD attr offset size. This proved to be useful in catching incorrect struct sizes as MAD attrs nee
d to be a multiple of 8 bytes.

as not all SA attributes are multiple of 8 bytes.

-- Hal

Quoted 5 lines

Sasha

Quoted 3 lines
opensm/opensm/osm_sa.c +0 -0
      p = ib_sa_mad_get_payload_ptr(resp_sa_mad);
 
Quoted 8 lines
Quoted 3 lines
opensm/opensm/osm_sa.c +0 -1
--

1.5.6.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

--
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

A message that is not in the archive (sent off-list or not yet received): AANLkTilkr6KYG_TVJYwvNl7sZ8XBKmFljktxg8qCA9t9-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#5 lore raw
Quoted 44 lines · Hal Rosenstock
Quoted 22 lines
Quoted 22 lines
---
 opensm/opensm/osm_sa.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
opensm/opensm/osm_sa.c +1 -0
index 0aca81f..8325632 100644
@@ -3,6 +3,7 @@
  * Copyright (c) 2002-2010 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
+ * Copyright (c) 2010 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -454,8 +455,15 @@ void osm_sa_respond(osm_sa_t *sa, osm_madw_t *madw, size_t attr_size,
      /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
      resp_sa_mad->sm_key = 0;
 
Quoted 13 lines

opensm/opensm/osm_sa.c void osm_sa_respond(osm_sa_t *sa, osm_madw_t *madw, size_t attr_size, · line 466

Quoted 11 lines
opensm/opensm/osm_sa.c +9 -2
-     /* Fill in the offset (paylen will be done by the rmpp SAR) */
-     resp_sa_mad->attr_offset = num_rec ? ib_get_attr_offset(attr_size) : 0;
+#ifdef DUAL_SIDED_RMPP
+     if (resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP ||
+         resp_sa_mad->method == IB_MAD_METHOD_GETMULTI_RESP) {
+#else
+     if (resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP) {
+#endif
+             /* Fill in the offset (paylen will be done by the rmpp SAR) */
+             resp_sa_mad->attr_offset = num_rec ? ib_get_attr_offset(attr_size) : 0;
+     }

What is wrong with current implementation?

It's now needed for the debug version of OpenSM not to assert due to:

7fc6cd3037f07190e483a047f17d37b6bebbb2b3

Author: Smith, Stan <[email protected]>
Date:   Fri May 21 10:49:27 2010 -0700

ib_types.h add debug assert

Quoted 8 lines

Add a debug assert to catch incorrect MAD attr offset size. This proved to be useful in catching incorrect struct sizes as MAD attrs nee
d to be a multiple of 8 bytes.

as not all SA attributes are multiple of 8 bytes.

Then it seems that such assertion is incorrect and the patch should be reverted. Right?

Sasha
--
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

#6 lore raw
Quoted 49 lines · Sasha Khapyorsky
Quoted 48 lines · Hal Rosenstock
Quoted 22 lines
Quoted 22 lines

---
 opensm/opensm/osm_sa.c |   12 ++++++++++--

 1 files changed, 10 insertions(+), 2 deletions(-)
opensm/opensm/osm_sa.c +1 -0
index 0aca81f..8325632 100644
@@ -3,6 +3,7 @@
   * Copyright (c) 2002-2010 Mellanox Technologies LTD. All rights reserved.
   * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
   * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
+ * Copyright (c) 2010 HNR Consulting. All rights reserved.
   *
   * This software is available to you under a choice of one of two
   * licenses.  You may choose to be licensed under the terms of the GNU
@@ -454,8 +455,15 @@ void osm_sa_respond(osm_sa_t *sa, osm_madw_t *madw, size_t attr_size,
       /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
       resp_sa_mad->sm_key = 0;
 
Quoted 13 lines

opensm/opensm/osm_sa.c void osm_sa_respond(osm_sa_t *sa, osm_madw_t *madw, size_t attr_size, · line 466

Quoted 11 lines
opensm/opensm/osm_sa.c +9 -2
-     /* Fill in the offset (paylen will be done by the rmpp SAR) */
-     resp_sa_mad->attr_offset = num_rec ? ib_get_attr_offset(attr_size) : 0;
+#ifdef DUAL_SIDED_RMPP
+     if (resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP ||
+         resp_sa_mad->method == IB_MAD_METHOD_GETMULTI_RESP) {
+#else
+     if (resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP) {
+#endif
+             /* Fill in the offset (paylen will be done by the rmpp SAR) */
+             resp_sa_mad->attr_offset = num_rec ? ib_get_attr_offset(attr_size) : 0;
+     }

What is wrong with current implementation?

It's now needed for the debug version of OpenSM not to assert due to:

7fc6cd3037f07190e483a047f17d37b6bebbb2b3
Author: Smith, Stan <[email protected]>
Date:   Fri May 21 10:49:27 2010 -0700

    ib_types.h add debug assert

    Add a debug assert to catch incorrect MAD attr offset size. This proved to be useful in catching incorrect struct sizes as MAD attrs nee d to be a multiple of 8 bytes.

Quoted 7 lines
Quoted 4 lines

as not all SA attributes are multiple of 8 bytes.

Then it seems that such assertion is incorrect and the patch should be reverted. Right?

I think the use of ib_get_attr_offset is being "overused". I'd rather see this patch used as it is the simplest way to address that rather than conditionalize ib_get_attr_offset on the SA attribute or would you rather see a patch along those lines ?

-- Hal

Quoted 3 lines

Sasha

--
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

A message that is not in the archive (sent off-list or not yet received): AANLkTikTxpvb-Nw2V1PrBcX4rZ1GwElXV22CBtBZx1iK-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#8 lore raw
Quoted 5 lines · Hal Rosenstock

I think the use of ib_get_attr_offset is being "overused". I'd rather see this patch used as it is the simplest way to address that rather than conditionalize ib_get_attr_offset on the SA attribute or would you rather see a patch along those lines ?

I just think that if the assertion is incorrect (and ib_get_attr_offset() is generic function) we need to remove this. That is simplest.

Sasha
--
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

#9 lore raw
Quoted 9 lines · Sasha Khapyorsky
Quoted 5 lines · Hal Rosenstock

I think the use of ib_get_attr_offset is being "overused". I'd rather see this patch used as it is the simplest way to address that rather than conditionalize ib_get_attr_offset on the SA attribute or would you rather see a patch along those lines ?

I just think that if the assertion is incorrect (and ib_get_attr_offset() is generic function) we need to remove this. That is simplest.

The downside is that it loses the ability to catch SA records which were not properly padded out. It seems like a reasonable tradeoff to me to not set this field on the transmit side when it's going to be ignored on receive (treat it like a reserved field for this case) and keep the ability to catch the SA record issue which has bit the community a number of times.

The only other approach I see to maintain this is to add an additional calling parameter (allribute ID) to get_attr_offset and then inside check the attribute ID and return 0 for those SA attributes.

-- Hal

Quoted 2 lines

Sasha

--
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

A message that is not in the archive (sent off-list or not yet received): AANLkTinxeLPtxYPvPBZfWq96BZjxDqcAlCzP2v_1VJnv-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#11 lore raw
Quoted 8 lines · Hal Rosenstock
Quoted 7 lines · Sasha Khapyorsky
Quoted 5 lines · Hal Rosenstock

I think the use of ib_get_attr_offset is being "overused". I'd rather see this patch used as it is the simplest way to address that rather than conditionalize ib_get_attr_offset on the SA attribute or would you rather see a patch along those lines ?

Quoted 5 lines
Quoted 2 lines

I just think that if the assertion is incorrect (and ib_get_attr_offset() is generic function) we need to remove this. That is simplest.

The downside is that it loses the ability to catch SA records which were not properly padded out.

It is not run-time error, so I don't think that such sort of debugging is a main function of OpenSM.

Quoted 5 lines

It seems like a reasonable tradeoff to
me to not set this field on the transmit side when it's going to be ignored on receive (treat it like a reserved field for this case) and keep the ability to catch the SA record issue which has bit the community a number of times.

This will cost in extra code.

Quoted 3 lines

The only other approach I see to maintain this is to add an additional calling parameter (allribute ID) to get_attr_offset and then inside check the attribute ID and return 0 for those SA attributes.

Which SA attributes?

Sasha
--
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

#12 lore raw
Quoted 18 lines · Sasha Khapyorsky
Quoted 8 lines · Hal Rosenstock
Quoted 7 lines · Sasha Khapyorsky
Quoted 5 lines · Hal Rosenstock

I think the use of ib_get_attr_offset is being "overused". I'd rather see this patch used as it is the simplest way to address that rather than conditionalize ib_get_attr_offset on the SA attribute or would you rather see a patch along those lines ?

Quoted 5 lines
Quoted 2 lines

I just think that if the assertion is incorrect (and ib_get_attr_offset() is generic function) we need to remove this. That is simplest.

The downside is that it loses the ability to catch SA records which were not properly padded out.

It is not run-time error, so I don't think that such sort of debugging is a main function of OpenSM.

Quoted 7 lines
Quoted 5 lines

It seems like a reasonable tradeoff to
me to not set this field on the transmit side when it's going to be ignored on receive (treat it like a reserved field for this case) and keep the ability to catch the SA record issue which has bit the community a number of times.

This will cost in extra code.

Sure; that's the tradeoff. I doubt the code size difference is significant.

Quoted 5 lines
Quoted 3 lines

The only other approach I see to maintain this is to add an additional calling parameter (allribute ID) to get_attr_offset and then inside check the attribute ID and return 0 for those SA attributes.

Which SA attributes?

Any of the non record ones but AFAIT the only one of those going through this code is InformInfo.

-- Hal

Quoted 2 lines

Sasha

--
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

#13 lore raw
In reply to Sasha Khapyorsky
Quoted 5 lines · Sasha Khapyorsky
Quoted 4 lines · Hal Rosenstock
Quoted 2 lines · Sasha Khapyorsky
Quoted 1 line · Hal Rosenstock
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

I think the use of ib_get_attr_offset is being "overused". I'd rather see this patch used as it is the simplest way to address that rather than conditionalize ib_get_attr_offset on the SA attribute or would you rather see a patch along those lines ?

I just think that if the assertion is incorrect (and ib_get_attr_offset() is generic function) we need to remove this. That is simplest.

The ASSERT() in ib_get_attr_offset() is only valid for the debug case; no runtime impact for the 'normal' build.

Quoted 15 lines
Quoted 3 lines

The downside is that it loses the ability to catch SA records which were not properly padded out.

It is not run-time error, so I don't think that such sort of debugging is a main function of OpenSM.

Quoted 5 lines

It seems like a reasonable tradeoff to
me to not set this field on the transmit side when it's going to be ignored on receive (treat it like a reserved field for this case) and keep the ability to catch the SA record issue which has bit the community a number of times.

This will cost in extra code.

Quoted 8 lines
Quoted 4 lines

The only other approach I see to maintain this is to add an additional calling parameter (allribute ID) to get_attr_offset and then inside
check the attribute ID and return 0 for those SA attributes.

Which SA attributes?

Sasha

--
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

#14 lore raw
In reply to Sasha Khapyorsky

<snip...>

Following discussion is tangential to Hal's patch.

Last night I came across an curious discovery.
sizeof(ib_inform_info_t) == 36.
sizeof(ib_inform_info_record_t) == 64.

My debug version of 'osmtest -f v' trips CL_ASSERT() in ib_get_attr_offset() osmteset.c::osmtest_informinfo_request()for ib_get_attr_offset(rec), where rec is ib_inform_info_t.

The winOFED ib_types.h & OFED ib_types.h match w.r.t. definitions for ib_inform_info_t & ib_inform_info_record_t.

Question: should ib_inform_info_t be 8-bye aligned with padding in ib_inform_info_record_t adjusted or should we remove the CL_ASSERT() from ib_get_attr_offset()?

stan.
--
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

A message that is not in the archive (sent off-list or not yet received): 3F6F638B8D880340AB536D29CD4C1E1925634C8F42-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org

#16 lore raw
Quoted 7 lines · Stan

<snip...>

Following discussion is tangential to Hal's patch.

Last night I came across an curious discovery.
sizeof(ib_inform_info_t)        == 36.
sizeof(ib_inform_info_record_t) == 64.

Those match the IBA spec (InformInfoRecord being padded whereas InformInfo is not).

Quoted 5 lines

My debug version of 'osmtest -f v' trips CL_ASSERT() in ib_get_attr_offset() osmteset.c::osmtest_informinfo_request()for ib_get_attr_offset(rec), where rec is ib_inform_info_t.

The winOFED ib_types.h & OFED ib_types.h match w.r.t. definitions for ib_inform_info_t & ib_inform_info_record_t.

Question: should ib_inform_info_t be 8-bye aligned with padding in ib_inform_info_record_t adjusted or should we remove the CL_ASSERT() from ib_get_attr_offset()?

Why does osmtest need to call this routine ? I think most if not all of those calls should be removed. Attribute offset only needs setting when RMPP and most SA client invocations of things like Get and GetTable are not RMPP (response is). I know osmtest does some negative testing of SA like invalid methods for a given attribute.

-- Hal

Quoted 3 lines

stan.

--
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

#17 lore raw
In reply to Sasha Khapyorsky
Quoted 12 lines · Stan

<snip...>

Following discussion is tangential to Hal's patch.

Last night I came across an curious discovery.
sizeof(ib_inform_info_t) == 36.
sizeof(ib_inform_info_record_t) == 64.

My debug version of 'osmtest -f v' trips CL_ASSERT() in ib_get_attr_offset() osmteset.c::osmtest_informinfo_request()for ib_get_attr_offset(rec), where rec is ib_inform_info_t.

Quoted 8 lines

The winOFED ib_types.h & OFED ib_types.h match w.r.t. definitions for ib_inform_info_t & ib_inform_info_record_t.

Question: should ib_inform_info_t be 8-byte aligned with padding in ib_inform_info_record_t adjusted or should we remove the CL_ASSERT() from ib_get_attr_offset()?

stan.

According to the IB spec, ib_inform_info_t is not 8-byte aligned, so removing the CL_ASSERT() makes sense. Sorry about extra work incurred, I thought I had tested all cases.

stan.
--
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

A message that is not in the archive (sent off-list or not yet received): 3F6F638B8D880340AB536D29CD4C1E1925634C8FE9-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org

#19 lore raw

PATCH 1/1 iba/ib_types.h: remove assertion in ib_get_attr_offset()

This reverts the commit:

commit 7fc6cd3037f07190e483a047f17d37b6bebbb2b3

Author: Smith, Stan <[email protected]>
Date:   Fri May 21 10:49:27 2010 -0700

ib_types.h add debug assert

Add a debug assert to catch incorrect MAD attr offset size.
This proved to be useful in catching incorrect struct sizes as MAD attrs need to be a multiple of 8 bytes.

Since not all SA attributes should be multiple of 8 bytes (specifically InformInfo).

The issue was discovered by Hal Rosenstock.

---
 opensm/include/iba/ib_types.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
opensm/include/iba/ib_types.h +0 -1
index 203c319..e1bc102 100644
@@ -4395,7 +4395,6 @@ static inline uint32_t OSM_API ib_get_attr_size(IN const ib_net16_t attr_offset)
 
 static inline ib_net16_t OSM_API ib_get_attr_offset(IN const uint32_t attr_size)
 {
-	CL_ASSERT((attr_size & 0x07) == 0);
 	return (cl_hton16((uint16_t) (attr_size >> 3)));
 }
 
Signature · 6 lines
1.7.0.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
#20 lore raw

RE: [PATCH] iba/ib_types.h: remove assertion in ib_get_attr_offset()

Quoted 2 lines

Since not all SA attributes should be multiple of 8 bytes (specifically InformInfo).

I thought the issue was that the C-struct definition was required to be a multiple of 8-bytes, not the actual SA attribute definition, ..

opensm/include/iba/ib_types.h static inline uint32_t OSM_API ib_get_attr_size(IN const ib_net16_t attr_offset) · line 4399

Quoted 6 lines

static inline ib_net16_t OSM_API ib_get_attr_offset(IN const uint32_t
attr_size)
{

opensm/include/iba/ib_types.h +0 -1
-	CL_ASSERT((attr_size & 0x07) == 0);
 	return (cl_hton16((uint16_t) (attr_size >> 3)));
 }

which causes this to fail, since it lops off the lower bits of the size, rather than rounding up.

I would either expect the assert to always work or the code to round up properly.

- Sean
--
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