linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] opensm: update internal PortInfo state for any ports
@ 2013-07-07 20:56 Sasha Khapyorsky
       [not found] ` <20130707205219.GA6084-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Sasha Khapyorsky @ 2013-07-07 20:56 UTC (permalink / raw)
  To: Hal Rosenstock; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

Should not be matter to keep internal SM's PortInfo data for ports
in any states.

Signed-off-by: Sasha Khapyorsky <sashakh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>


diff --git a/opensm/osm_port.c b/opensm/osm_port.c
index 6e73e66..d59d404 100644
--- a/opensm/osm_port.c
+++ b/opensm/osm_port.c
@@ -669,25 +669,16 @@ void osm_physp_set_port_info(IN osm_physp_t * p_physp,
 	CL_ASSERT(p_pi);
 	CL_ASSERT(osm_physp_is_valid(p_physp));
 
-	if (ib_port_info_get_port_state(p_pi) == IB_LINK_DOWN) {
-		/* If PortState is down, only copy PortState */
-		/* and PortPhysicalState per C14-24-2.1 */
-		ib_port_info_set_port_state(&p_physp->port_info, IB_LINK_DOWN);
-		ib_port_info_set_port_phys_state
-		    (ib_port_info_get_port_phys_state(p_pi),
-		     &p_physp->port_info);
-	} else {
-		p_physp->port_info = *p_pi;
-
-		/* The MKey in p_pi can only be considered valid if it's
-		 * for a HCA/router or switch port 0, and it's either
-		 * non-zero or the MKeyProtect bits are also zero.
-		 */
-		if ((osm_node_get_type(p_physp->p_node) !=
-		     IB_NODE_TYPE_SWITCH || p_physp->port_num == 0) &&
-		    (p_pi->m_key != 0 || ib_port_info_get_mpb(p_pi) == 0))
-			osm_db_guid2mkey_set(p_sm->p_subn->p_g2m,
-					     cl_ntoh64(p_physp->port_guid),
-					     cl_ntoh64(p_pi->m_key));
-	}
+	p_physp->port_info = *p_pi;
+
+	/* The MKey in p_pi can only be considered valid if it's
+	 * for a HCA/router or switch port 0, and it's either
+	 * non-zero or the MKeyProtect bits are also zero.
+	 */
+	if ((osm_node_get_type(p_physp->p_node) != IB_NODE_TYPE_SWITCH ||
+	     p_physp->port_num == 0) &&
+	    (p_pi->m_key != 0 || ib_port_info_get_mpb(p_pi) == 0))
+		osm_db_guid2mkey_set(p_sm->p_subn->p_g2m,
+				     cl_ntoh64(p_physp->port_guid),
+				     cl_ntoh64(p_pi->m_key));
 }
--
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] 4+ messages in thread

* Re: [PATCH] opensm: update internal PortInfo state for any ports
       [not found] ` <20130707205219.GA6084-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2013-07-12 13:37   ` Hal Rosenstock
       [not found]     ` <51E006B5.3060808-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Hal Rosenstock @ 2013-07-12 13:37 UTC (permalink / raw)
  To: Sasha Khapyorsky; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

On 7/7/2013 4:56 PM, Sasha Khapyorsky wrote:
> Should not be matter to keep internal SM's PortInfo data for ports
> in any states.

What difference does it make ? Does this patch fix some operational
issue ? Is there any harm in not keeping the complete PortInfo when port
is DOWN ?

At worst, the current implementation is a minor efficiency improvement:
to only copy the 2 required to be valid fields rather than all 64 bytes
in PortInfo. Also, it seems safer to only save the guaranteed valid fields.

-- Hal

> Signed-off-by: Sasha Khapyorsky <sashakh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> 
> diff --git a/opensm/osm_port.c b/opensm/osm_port.c
> index 6e73e66..d59d404 100644
> --- a/opensm/osm_port.c
> +++ b/opensm/osm_port.c
> @@ -669,25 +669,16 @@ void osm_physp_set_port_info(IN osm_physp_t * p_physp,
>  	CL_ASSERT(p_pi);
>  	CL_ASSERT(osm_physp_is_valid(p_physp));
>  
> -	if (ib_port_info_get_port_state(p_pi) == IB_LINK_DOWN) {
> -		/* If PortState is down, only copy PortState */
> -		/* and PortPhysicalState per C14-24-2.1 */
> -		ib_port_info_set_port_state(&p_physp->port_info, IB_LINK_DOWN);
> -		ib_port_info_set_port_phys_state
> -		    (ib_port_info_get_port_phys_state(p_pi),
> -		     &p_physp->port_info);
> -	} else {
> -		p_physp->port_info = *p_pi;
> -
> -		/* The MKey in p_pi can only be considered valid if it's
> -		 * for a HCA/router or switch port 0, and it's either
> -		 * non-zero or the MKeyProtect bits are also zero.
> -		 */
> -		if ((osm_node_get_type(p_physp->p_node) !=
> -		     IB_NODE_TYPE_SWITCH || p_physp->port_num == 0) &&
> -		    (p_pi->m_key != 0 || ib_port_info_get_mpb(p_pi) == 0))
> -			osm_db_guid2mkey_set(p_sm->p_subn->p_g2m,
> -					     cl_ntoh64(p_physp->port_guid),
> -					     cl_ntoh64(p_pi->m_key));
> -	}
> +	p_physp->port_info = *p_pi;
> +
> +	/* The MKey in p_pi can only be considered valid if it's
> +	 * for a HCA/router or switch port 0, and it's either
> +	 * non-zero or the MKeyProtect bits are also zero.
> +	 */
> +	if ((osm_node_get_type(p_physp->p_node) != IB_NODE_TYPE_SWITCH ||
> +	     p_physp->port_num == 0) &&
> +	    (p_pi->m_key != 0 || ib_port_info_get_mpb(p_pi) == 0))
> +		osm_db_guid2mkey_set(p_sm->p_subn->p_g2m,
> +				     cl_ntoh64(p_physp->port_guid),
> +				     cl_ntoh64(p_pi->m_key));
>  }
> 

--
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] 4+ messages in thread

* Re: [PATCH] opensm: update internal PortInfo state for any ports
       [not found]     ` <51E006B5.3060808-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
@ 2013-07-22 15:40       ` Sasha Khapyorsky
       [not found]         ` <20130722154032.GA23909-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Sasha Khapyorsky @ 2013-07-22 15:40 UTC (permalink / raw)
  To: Hal Rosenstock; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

Hi Hal,

On 09:37 Fri 12 Jul     , Hal Rosenstock wrote:
> 
> What difference does it make ? Does this patch fix some operational
> issue ? Is there any harm in not keeping the complete PortInfo when port
> is DOWN ?

AFAIK it doesn't harm in the current state. However, I'm prepering the
patches, which will let to OpenSM work on stand alone port. For such
mode this fix is critical.

Will recent with other patches shortly.

Sasha
--
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] 4+ messages in thread

* Re: [PATCH] opensm: update internal PortInfo state for any ports
       [not found]         ` <20130722154032.GA23909-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2013-08-08 15:03           ` Hal Rosenstock
  0 siblings, 0 replies; 4+ messages in thread
From: Hal Rosenstock @ 2013-08-08 15:03 UTC (permalink / raw)
  To: Sasha Khapyorsky; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

Hi Sasha,

On 7/22/2013 11:40 AM, Sasha Khapyorsky wrote:
> Hi Hal,
> 
> On 09:37 Fri 12 Jul     , Hal Rosenstock wrote:
>>
>> What difference does it make ? Does this patch fix some operational
>> issue ? Is there any harm in not keeping the complete PortInfo when port
>> is DOWN ?
> 
> AFAIK it doesn't harm in the current state. However, I'm prepering the
> patches, which will let to OpenSM work on stand alone port. For such
> mode this fix is critical.

Why is it critical for this set of patches ? I'm still missing why
that's required for supporting single port sweep (so loopback
connections still work). What PortInfo fields are really needed ?

-- Hal

> Will recent with other patches shortly.
> 
> Sasha
> .
> 

--
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] 4+ messages in thread

end of thread, other threads:[~2013-08-08 15:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-07 20:56 [PATCH] opensm: update internal PortInfo state for any ports Sasha Khapyorsky
     [not found] ` <20130707205219.GA6084-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-07-12 13:37   ` Hal Rosenstock
     [not found]     ` <51E006B5.3060808-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2013-07-22 15:40       ` Sasha Khapyorsky
     [not found]         ` <20130722154032.GA23909-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-08-08 15:03           ` Hal Rosenstock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).