From: James L. <jle...@us...> - 2006-01-09 16:58:36
|
Update of /cvsroot/dapl/dapl/openib_cma In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9382/dapl/openib_cma Modified Files: dapl_ib_cm.c Log Message: Fix disconnect event processing and update dtest to validate. Signed-off-by: Arlin Davis <ar...@ic...> Signed-off-by: James Lentini <jle...@ne...> Index: dapl_ib_cm.c =================================================================== RCS file: /cvsroot/dapl/dapl/openib_cma/dapl_ib_cm.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C10 -d -r1.1 -r1.2 *** dapl_ib_cm.c 5 Dec 2005 16:48:36 -0000 1.1 --- dapl_ib_cm.c 9 Jan 2006 16:58:28 -0000 1.2 *************** *** 28,48 **** * Module: uDAPL * * Filename: dapl_ib_cm.c * * Author: Arlin Davis * * Created: 3/10/2005 * * Description: * ! * The uDAPL openib provider - connection management * **************************************************************************** * Source Control System Information * * $Id$ * * Copyright (c) 2005 Voltaire Inc. All rights reserved. * Copyright (c) 2005 Intel Corporation. All rights reserved. * Copyright (c) 2004-2005, Mellanox Technologies, Inc. All rights reserved. * Copyright (c) 2003 Topspin Corporation. All rights reserved. --- 28,48 ---- * Module: uDAPL * * Filename: dapl_ib_cm.c * * Author: Arlin Davis * * Created: 3/10/2005 * * Description: * ! * The OpenIB uCMA provider - uCMA connection management * **************************************************************************** * Source Control System Information * * $Id$ * * Copyright (c) 2005 Voltaire Inc. All rights reserved. * Copyright (c) 2005 Intel Corporation. All rights reserved. * Copyright (c) 2004-2005, Mellanox Technologies, Inc. All rights reserved. * Copyright (c) 2003 Topspin Corporation. All rights reserved. *************** *** 280,299 **** --- 280,305 ---- ntohs(((struct sockaddr_in *) &conn->cm_id->route.addr.dst_addr)->sin_port), ntohl(((struct sockaddr_in *) &conn->cm_id->route.addr.dst_addr)->sin_addr.s_addr)); dapl_evd_connection_callback(conn, IB_CME_CONNECTED, event->private_data, conn->ep); break; case RDMA_CM_EVENT_DISCONNECTED: + /* validate EP handle */ + if (!DAPL_BAD_HANDLE(conn->ep, DAPL_MAGIC_EP)) + dapl_evd_connection_callback(conn, + IB_CME_DISCONNECTED, + NULL, + conn->ep); break; default: dapl_dbg_log( DAPL_DBG_TYPE_ERR, " dapli_cm_active_cb_handler: Unexpected CM " "event %d on ID 0x%p\n", event->event, conn->cm_id); break; } dapl_os_lock(&conn->lock); *************** *** 357,376 **** --- 363,389 ---- ntohs(((struct sockaddr_in *) &conn->cm_id->route.addr.src_addr)->sin_port), ntohl(((struct sockaddr_in *) &conn->cm_id->route.addr.dst_addr)->sin_addr.s_addr)); dapls_cr_callback(conn, IB_CME_CONNECTED, NULL, conn->sp); break; case RDMA_CM_EVENT_DISCONNECTED: + /* validate SP handle context */ + if (!DAPL_BAD_HANDLE(conn->sp, DAPL_MAGIC_PSP) || + !DAPL_BAD_HANDLE(conn->sp, DAPL_MAGIC_RSP)) + dapls_cr_callback(conn, + IB_CME_DISCONNECTED, + NULL, + conn->sp); break; default: dapl_dbg_log(DAPL_DBG_TYPE_ERR, " passive_cb: " "Unexpected CM event %d on ID 0x%p\n", event->event, conn->cm_id); break; } dapl_os_lock(&conn->lock); destroy = conn->destroy; *************** *** 489,523 **** if (conn == IB_INVALID_HANDLE) return DAT_SUCCESS; /* no graceful half-pipe disconnect option */ ret = rdma_disconnect(conn->cm_id); if (ret) dapl_dbg_log(DAPL_DBG_TYPE_ERR, " disconnect: ID %p ret %d\n", ep_ptr->cm_handle, ret); ! /* ! * uDAPL does NOT expect disconnect callback from provider ! * with abrupt close. uDAPL will callback with DISC event when ! * from provider returns. So, if callback is expected from ! * rdma_cma then block and don't post the event during callback. */ - if (close_flags != DAT_CLOSE_ABRUPT_FLAG) - { - if (ep_ptr->cr_ptr) - dapls_cr_callback(conn, IB_CME_DISCONNECTED, NULL, - ((DAPL_CR *)ep_ptr->cr_ptr)->sp_ptr); - else - dapl_evd_connection_callback(conn, IB_CME_DISCONNECTED, - NULL, ep_ptr); - } return DAT_SUCCESS; } /* * dapls_ib_disconnect_clean * * Clean up outstanding connection data. This routine is invoked * after the final disconnect callback has occurred. Only on the * ACTIVE side of a connection. * --- 502,525 ---- if (conn == IB_INVALID_HANDLE) return DAT_SUCCESS; /* no graceful half-pipe disconnect option */ ret = rdma_disconnect(conn->cm_id); if (ret) dapl_dbg_log(DAPL_DBG_TYPE_ERR, " disconnect: ID %p ret %d\n", ep_ptr->cm_handle, ret); ! /* ! * DAT event notification occurs from the callback ! * Note: will fire even if DREQ goes unanswered on timeout */ return DAT_SUCCESS; } /* * dapls_ib_disconnect_clean * * Clean up outstanding connection data. This routine is invoked * after the final disconnect callback has occurred. Only on the * ACTIVE side of a connection. * *************** *** 530,554 **** * * Returns: * void * */ void dapls_ib_disconnect_clean(IN DAPL_EP *ep_ptr, IN DAT_BOOLEAN active, IN const ib_cm_events_t ib_cm_event) { ! /* ! * Clean up outstanding connection state ! */ ! dapls_ib_disconnect(ep_ptr, DAT_CLOSE_ABRUPT_FLAG); ! } /* * dapl_ib_setup_conn_listener * * Have the CM set up a connection listener. * * Input: * ibm_hca_handle HCA handle * qp_handle QP handle --- 532,553 ---- * * Returns: * void * */ void dapls_ib_disconnect_clean(IN DAPL_EP *ep_ptr, IN DAT_BOOLEAN active, IN const ib_cm_events_t ib_cm_event) { ! /* nothing to do */ ! return; } /* * dapl_ib_setup_conn_listener * * Have the CM set up a connection listener. * * Input: * ibm_hca_handle HCA handle * qp_handle QP handle *************** *** 585,605 **** dapl_os_free(conn, sizeof(*conn)); return(dapl_convert_errno(errno,"setup_listener")); } /* open identifies the local device; per DAT specification */ ((struct sockaddr_in *)&ia_ptr->hca_ptr->hca_address)->sin_port = htons(MAKE_PORT(ServiceID)); if (rdma_bind_addr(conn->cm_id, (struct sockaddr *)&ia_ptr->hca_ptr->hca_address)) { ! dat_status = dapl_convert_errno(errno,"setup_listener"); goto bail; } dapl_dbg_log(DAPL_DBG_TYPE_CM, " listen(ia_ptr %p SID %d sp %p conn %p id %d)\n", ia_ptr, MAKE_PORT(ServiceID), sp_ptr, conn, conn->cm_id); sp_ptr->cm_srvc_handle = conn; conn->sp = sp_ptr; --- 584,608 ---- dapl_os_free(conn, sizeof(*conn)); return(dapl_convert_errno(errno,"setup_listener")); } /* open identifies the local device; per DAT specification */ ((struct sockaddr_in *)&ia_ptr->hca_ptr->hca_address)->sin_port = htons(MAKE_PORT(ServiceID)); if (rdma_bind_addr(conn->cm_id, (struct sockaddr *)&ia_ptr->hca_ptr->hca_address)) { ! if (errno == -EBUSY) ! dat_status = DAT_CONN_QUAL_IN_USE; ! else ! dat_status = ! dapl_convert_errno(errno,"setup_listener"); goto bail; } dapl_dbg_log(DAPL_DBG_TYPE_CM, " listen(ia_ptr %p SID %d sp %p conn %p id %d)\n", ia_ptr, MAKE_PORT(ServiceID), sp_ptr, conn, conn->cm_id); sp_ptr->cm_srvc_handle = conn; conn->sp = sp_ptr; |