public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] opensm/osm_helper: Add ib_mtu_is_valid
@ 2011-10-04 13:53 Hal Rosenstock
       [not found] ` <4E8B0FC6.8010504-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Hal Rosenstock @ 2011-10-04 13:53 UTC (permalink / raw)
  To: Alex Netes
  Cc: linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)


for use in mtu validation by SA

Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 include/opensm/osm_helper.h |   24 ++++++++++++++++++++++++
 opensm/libopensm.map        |    1 +
 opensm/osm_helper.c         |    7 +++++++
 3 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/include/opensm/osm_helper.h b/include/opensm/osm_helper.h
index 7eb4e2a..57d1b00 100644
--- a/include/opensm/osm_helper.h
+++ b/include/opensm/osm_helper.h
@@ -588,6 +588,30 @@ const char *osm_get_sm_mgr_state_str(IN uint16_t state);
 * SEE ALSO
 *********/
 
+/****f* IBA Base: Types/ib_mtu_is_valid
+* NAME
+*	ib_mtu_is_valid
+*
+* DESCRIPTION
+*	Validates encoded MTU 
+*
+* SYNOPSIS
+*/
+int ib_mtu_is_valid(IN const int mtu);
+/*
+* PARAMETERS
+*	mtu
+*		[in] Encoded path mtu.
+*
+* RETURN VALUES
+*	Returns an int indicating mtu is valid (1)
+*	or invalid (0).
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
 /****f* IBA Base: Types/ib_rate_is_valid
 * NAME
 *	ib_rate_is_valid
diff --git a/opensm/libopensm.map b/opensm/libopensm.map
index 5e8dae8..90c2857 100644
--- a/opensm/libopensm.map
+++ b/opensm/libopensm.map
@@ -57,6 +57,7 @@ OPENSM_1.5 {
 		osm_get_lsa_str;
 		osm_get_sm_mgr_signal_str;
 		osm_get_sm_mgr_state_str;
+		ib_mtu_is_valid;
 		ib_rate_is_valid;
 		ib_path_compare_rates;
 		ib_path_rate_get_prev;
diff --git a/opensm/osm_helper.c b/opensm/osm_helper.c
index 05becb5..f9f3d9d 100644
--- a/opensm/osm_helper.c
+++ b/opensm/osm_helper.c
@@ -2362,6 +2362,13 @@ const char *osm_get_sm_mgr_state_str(IN uint16_t state)
 	    sm_mgr_state_str[ARR_SIZE(sm_mgr_state_str) - 1];
 }
 
+int ib_mtu_is_valid(IN const int mtu)
+{
+	if (mtu < IB_MIN_MTU || mtu > IB_MAX_MTU)
+		return 0;
+	return 1;
+}
+
 int ib_rate_is_valid(IN const int rate)
 {
 	if (rate < IB_MIN_RATE || rate > IB_MAX_RATE)
-- 
1.7.6.1

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/4] opensm/osm_helper: Add ib_mtu_is_valid
       [not found] ` <4E8B0FC6.8010504-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
@ 2011-10-05 18:45   ` Bart Van Assche
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Van Assche @ 2011-10-05 18:45 UTC (permalink / raw)
  To: Hal Rosenstock
  Cc: Alex Netes,
	linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)

On Tue, Oct 4, 2011 at 3:53 PM, Hal Rosenstock <hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org> wrote:
> +int ib_mtu_is_valid(IN const int mtu)
> +{
> +       if (mtu < IB_MIN_MTU || mtu > IB_MAX_MTU)
> +               return 0;
> +       return 1;
> +}

Not that it matters, but the above three lines can also be written as follows:

    return (mtu >= IB_MIN_MTU && mtu <= IB_MAX_MTU);

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-05 18:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-04 13:53 [PATCH 1/4] opensm/osm_helper: Add ib_mtu_is_valid Hal Rosenstock
     [not found] ` <4E8B0FC6.8010504-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2011-10-05 18:45   ` Bart Van Assche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox