dapl_cr_callback.c revision 2
2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved. 2N/A * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A * PURPOSE: implements passive side connection callbacks 2N/A * Description: Accepts asynchronous callbacks from the Communications Manager 2N/A * for EVDs that have been specified as the connection_evd. 2N/A * The callback function registered with verbs for passive side of 2N/A * connection requests. The interface is specified by cm_api.h 2N/A * ib_cm_handle, Handle to CM 2N/A * ib_cm_event Specific CM event 2N/A * instant_data Private data with DAT ADDRESS header 2N/A * context SP pointer 2N/A "--> dapls_cr_callback! context: 0x%p " 2N/A "event: %d cm_handle 0x%llx magic 0x%x\n",
2N/A * Passive side of the connection, context is a SP and 2N/A * we need to look up the EP. 2N/A * CONNECT_REQUEST events create an event on the PSP 2N/A * EVD, which will trigger connection processing. The 2N/A * CONNECT_REQUEST Event to SP 2N/A * CONNECTED Event to EP 2N/A * DISCONNECT Event to EP 2N/A * Obtain the EP if required and set an event up on the correct EVD. 2N/A " dapls_cr_callback cont: ep 0x%p evd 0x%p\n",
2N/A * Requests arriving on a disabled SP are immediatly rejected 2N/A "---> dapls_cr_callback: conn event on down SP\n");
2N/A * RSP connections only allow a single connection. Close 2N/A * it down NOW so we reject any further connections. 2N/A * Only occurs on the passive side of a connection 2N/A * dapli_connection_request will post the connection 2N/A * event if appropriate. 2N/A * This is just a notification the connection is now 2N/A * established, there isn't any private data to deal with. 2N/A * Update the EP state and cache a copy of the cm handle, 2N/A * then let the user know we are ready to go. 2N/A * If someone pulled the plug on the connection, just 2N/A * post them to the recv evd now. 2N/A * there is a race here - if events arrive after we change 2N/A * the ep state to connected and before we process premature 2N/A * EP is now fully disconnected; initiate any post processing 2N/A * to reset the underlying QP and get the EP ready for 2N/A * another connection 2N/A /* DTO error caused this */ 2N/A * If the user has done an ep_free of the EP, we have been 2N/A * waiting for the disconnect event; just clean it up now. 2N/A /* If the EP has been freed, the evd_ptr will be NULL */ 2N/A * After posting an accept the requesting node has 2N/A * DAPL does not deal with this IB error. There is a 2N/A * separate OVERFLOW event error if we try to post too many 2N/A * events, but we don't propagate this provider error. Not 2N/A * all providers generate this error. 2N/A /* The event post failed; take appropriate action. */ 2N/A * dapli_connection_request 2N/A * Process a connection request on the Passive side of a connection. 2N/A * Create a CR record and link it on to the SP so we can update it 2N/A * and free it later. Create an EP if specified by the PSP flags. 2N/A * DAT_INSUFFICIENT_RESOURCES 2N/A /* Invoking function will call dapls_ib_cm_reject() */ 2N/A * Copy the remote address and private data out of the private_data 2N/A * payload and put them in a local structure 2N/A /* EP will be NULL unless RSP service point */ 2N/A * Never true for RSP connections 2N/A * Create an EP for the user. If we can't allocate an 2N/A * EP we are out of resources and need to tell the 2N/A * requestor that we cant help them. 2N/A /* Invoking function will call dapls_ib_cm_reject() */ 2N/A /* Link the EP onto the IA */ 2N/A /* Assign valid EP fields: RSP and PSP_PROVIDER_FLAG only */ 2N/A /* Post the event. */ 2N/A /* assign sp_ptr to union to avoid typecast errors from compilers */ 2N/A /* link the CR onto the SP so we can pick it up later */ 2N/A * Passive side of a connection is now fully established. Clean 2N/A * up resources and obtain the EP pointer associated with a CR in 2N/A * There are potentially multiple connections in progress. Need to 2N/A * go through the list and find the one we are interested 2N/A * in. There is no guarantee of order. dapl_sp_search_cr 2N/A * leaves the CR on the SP queue. 2N/A /* Remove the CR from the queue */ 2N/A * Last event, time to clean up and dispose of the resource 2N/A * If this SP has been removed from service, free it 2N/A * up after the last CR is removed 2N/A "--> dapli_get_sp_ep! disconnect dump sp: %p \n",