[ofw] [patch] pkey_changes.diff patch
Tzachi Dar
tzachid at mellanox.co.il
Mon Nov 10 10:07:11 PST 2008
Applied on 1747, 1748.
Thanks
Tzachi
> -----Original Message-----
> From: ofw-bounces at lists.openfabrics.org
> [mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of
> Anatoly Greenblatt
> Sent: Sunday, November 09, 2008 5:56 PM
> To: ofw at lists.openfabrics.org
> Subject: [ofw] [patch] pkey_changes.diff patch
>
> <<pkey_changes.diff>> Hi,
>
> Attached please find final version of patch that changes
> network connection status when pkey added/removed in SM.
>
> Thanks,
> Anatoly.
>
> Index: ulp/ipoib/kernel/ipoib_adapter.c
> ===================================================================
> --- ulp/ipoib/kernel/ipoib_adapter.c (revision 1742)
> +++ ulp/ipoib/kernel/ipoib_adapter.c (working copy)
> @@ -548,19 +548,19 @@
>
> p_adapter->p_ifc->get_err_str( status )) );
> goto pkey_end;
> }
> -
> - CL_ASSERT(ca_attr->p_port_attr->p_pkey_table[0] ==
> IB_DEFAULT_PKEY);
> - for(index = 0; index < ca_attr->p_port_attr->num_pkeys; index++)
> + CL_ASSERT(ca_attr->p_port_attr[p_adapter->p_port->port_num
> -1].p_pkey_table[0] == IB_DEFAULT_PKEY);
> + for(index = 0; index <
> ca_attr->p_port_attr[p_adapter->p_port->port_num
> -1].num_pkeys; index++)
> {
> - if(cl_hton16(p_adapter->guids.port_guid.pkey) ==
> ca_attr->p_port_attr->p_pkey_table[index])
> + if(cl_hton16(p_adapter->guids.port_guid.pkey) ==
> ca_attr->p_port_attr[p_adapter->p_port->port_num
> -1].p_pkey_table[index])
> break;
> }
> - if(index >= ca_attr->p_port_attr->num_pkeys)
> + if(index >= ca_attr->p_port_attr[p_adapter->p_port->port_num
> -1].num_pkeys)
> {
> IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,
> ("Pkey table is invalid,
> index not found\n"));
> NdisWriteErrorLogEntry( p_adapter->h_adapter,
> EVENT_IPOIB_PARTITION_ERR, 1,
> p_adapter->guids.port_guid.pkey );
> + status = IB_NOT_FOUND;
> p_adapter->p_port->pkey_index = PKEY_INVALID_INDEX;
> goto pkey_end;
> }
> @@ -755,7 +755,11 @@
> {
> status =
> ipoib_query_pkey_index(p_adapter);
> if(status != IB_SUCCESS)
> - break;
> + {
> + cl_obj_lock( &p_adapter->obj );
> + p_adapter->state = IB_PNP_PORT_INIT;
> + cl_obj_unlock( &p_adapter->obj );
> + }
> }
>
> case IB_PNP_SM_CHANGE:
> @@ -1071,12 +1075,13 @@
> }
>
>
> -void
> +ib_api_status_t
> ipoib_set_active(
> IN ipoib_adapter_t* const
> p_adapter )
> {
> ib_pnp_event_t old_state;
> uint8_t i;
> + ib_api_status_t status = IB_SUCCESS;
>
> IPOIB_ENTER( IPOIB_DBG_INIT );
>
> @@ -1105,8 +1110,13 @@
>
> default:
> if (p_adapter->guids.port_guid.pkey != IB_DEFAULT_PKEY)
> - ipoib_query_pkey_index(p_adapter);
> -
> + {
> + status = ipoib_query_pkey_index(p_adapter);
> + if( IB_SUCCESS != status)
> + {
> + break;
> + }
> + }
> /* Join all programmed multicast groups. */
> for( i = 0; i < p_adapter->mcast_array_size; i++ )
> {
> @@ -1144,6 +1154,7 @@
> }
>
> IPOIB_EXIT( IPOIB_DBG_INIT );
> + return status;
> }
>
>
> Index: ulp/ipoib/kernel/ipoib_adapter.h
> ===================================================================
> --- ulp/ipoib/kernel/ipoib_adapter.h (revision 1742)
> +++ ulp/ipoib/kernel/ipoib_adapter.h (working copy)
> @@ -413,7 +413,7 @@
> IN const uint8_t
> link_speed );
>
>
> -void
> +ib_api_status_t
> ipoib_set_active(
> IN ipoib_adapter_t* const
> p_adapter );
>
> Index: ulp/ipoib/kernel/ipoib_port.c
> ===================================================================
> --- ulp/ipoib/kernel/ipoib_port.c (revision 1742)
> +++ ulp/ipoib/kernel/ipoib_port.c (working copy)
> @@ -5789,8 +5789,36 @@
> cl_spinlock_release( &p_port->recv_lock );
>
> /* Notify the adapter that we now have an active connection. */
> - ipoib_set_active( p_port->p_adapter );
> + status = ipoib_set_active( p_port->p_adapter );
> + if( status != IB_SUCCESS )
> + {
> + ib_qp_mod_t qp_mod;
> + ipoib_set_inactive( p_port->p_adapter );
> + KeSetEvent( &p_port->sa_event, EVENT_INCREMENT, FALSE );
> + IPOIB_PRINT_EXIT( TRACE_LEVEL_INFORMATION,
> IPOIB_DBG_INIT,
> + ("ipoib_set_active returned
> %s.\n",p_port->p_adapter->p_ifc->get_err_str( status )));
> + cl_spinlock_acquire( &p_port->recv_lock );
> + cl_obj_lock( &p_port->obj );
> + p_port->state = IB_QPS_ERROR;
> + if( p_port->ib_mgr.h_query )
> + {
> + p_port->p_adapter->p_ifc->cancel_query(
> + p_port->p_adapter->h_al,
> p_port->ib_mgr.h_query );
> + p_port->ib_mgr.h_query = NULL;
> + }
> + cl_obj_unlock( &p_port->obj );
> + cl_spinlock_release( &p_port->recv_lock );
>
> + CL_ASSERT( p_port->ib_mgr.h_qp );
> + cl_memclr( &qp_mod, sizeof(ib_qp_mod_t) );
> + qp_mod.req_state = IB_QPS_ERROR;
> + status = p_port->p_adapter->p_ifc->modify_qp(
> p_port->ib_mgr.h_qp, &qp_mod );
> + __endpt_mgr_reset_all( p_port );
> +
> + ipoib_port_deref( p_port, ref_join_bcast );
> + return;
> + }
> +
> /* garbage collector timer is needed when link is active */
> gc_due_time.QuadPart =
> -(int64_t)(((uint64_t)p_port->p_adapter->params.mc_leave_rescan *
> 2000000) * 10);
> KeSetTimerEx(&p_port->gc_timer,gc_due_time,
>
More information about the ofw
mailing list