[ofw][IBAL]smp m_key authentication

Yossi Leybovich sleybo at dev.mellanox.co.il
Wed Apr 25 05:47:55 PDT 2007


 

> -----Original Message-----
> From: Alex Estrin [mailto:alex.estrin at qlogic.com] 
> Sent: Tuesday, April 24, 2007 12:52 AM
> To: Yossi Leybovich; ofw at lists.openfabrics.org
> Subject: [ofw][IBAL]smp m_key authentication
> 
> Hi Yossi,
> 
> Proposed patch intended to fix following issues:
> 1. If portinfo m_key is zero check will always fail, no 
> cached info will ever be returned.

The code does not support mkey=0 , in case mkey = 0 the cache is disable.
The problem with mkey=0 is that the SMA can return mkey = 0 when protection
bits is set to 1 and there is mkey mismatch.
If we will support mkey = 0 the mkey in the p_spl_qp_svc will be set to zero
and the cache will not work for the right key
You can try to run Lamprey on your code and it will fail.

I could not find easy way to distinguish between real mkey = 0 and the case
the SMA just return 0.
I hope that in the near future SM will support mkey manager and there will
be limited use with mkey = 0.

> 2. As per spec no check should be done if portinfo m_key is zero.
> From chapter 14.2.4 C14-15: "An M_Key contained in the 
> MADHeader:M_Key of the SMP shall not be checked at the 
> receiving port with the PortInfo:M_Key set to zero. As a 
> result, no authentication is performed."
> 
> Please review.
> 
> Thanks,
> Alex
> 
> 
> Index: kernel/al_smi.c
> ===================================================================
> --- kernel/al_smi.c	(revision 630)
> +++ kernel/al_smi.c	(working copy)
> @@ -2135,23 +2135,32 @@
>  		p_smp->mgmt_class == IB_MCLASS_SUBN_LID );
>  
>  	/* simple m-key check */
> -	if( p_spl_qp_svc->m_key && p_smp->m_key == p_spl_qp_svc->m_key )
> +	if( p_spl_qp_svc->m_key )
>  	{
> -		if(!p_spl_qp_svc->cache_en )
> +		if( p_smp->m_key == p_spl_qp_svc->m_key )
>  		{
> -			p_spl_qp_svc->cache_en = TRUE;
> +			if( !p_spl_qp_svc->cache_en )
> +			{
> +				p_spl_qp_svc->cache_en = TRUE;
> +				AL_EXIT( AL_DBG_SMI );
> +				return IB_NOT_DONE;
> +			}
> +		}
> +		else
> +		{
> +			AL_PRINT(TRACE_LEVEL_WARNING, AL_DBG_SMI, ("Mkey
> check failed \n"));
> +			AL_PRINT(TRACE_LEVEL_WARNING, AL_DBG_SMI, ("Mkey
> check SMP= 0x%08x:%08x  SVC = 0x%08x:%08x \n",
> +
> ((uint32_t*)&p_smp->m_key)[0],((uint32_t*)&p_smp->m_key)[1],
> +
> ((uint32_t*)&p_spl_qp_svc->m_key)[0],((uint32_t*)&p_spl_qp_svc
> ->m_key)[1
> ]));
> +
> +			p_spl_qp_svc->cache_en = FALSE;
>  			AL_EXIT( AL_DBG_SMI );
>  			return IB_NOT_DONE;
>  		}
>  	}
> -	else
> +	else if( !p_spl_qp_svc->cache_en )
>  	{
> -		AL_PRINT(TRACE_LEVEL_WARNING, AL_DBG_SMI, ("Mkey check
> failed \n"));
> -		AL_PRINT(TRACE_LEVEL_WARNING, AL_DBG_SMI, ("Mkey check
> SMP= 0x%08x:%08x  SVC = 0x%08x:%08x \n",
> -
> ((uint32_t*)&p_smp->m_key)[0],((uint32_t*)&p_smp->m_key)[1],
> -
> ((uint32_t*)&p_spl_qp_svc->m_key)[0],((uint32_t*)&p_spl_qp_svc
> ->m_key)[1
> ]));
> -
> -		p_spl_qp_svc->cache_en = FALSE;
> +		p_spl_qp_svc->cache_en = TRUE;
>  		AL_EXIT( AL_DBG_SMI );
>  		return IB_NOT_DONE;
>  	}
> 




More information about the ofw mailing list