⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cippd_event.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 3 页
字号:
#ifndef	lintstatic char *sccsid = "@(#)cippd_event.c	4.1	(ULTRIX)	7/2/90";#endif	lint/************************************************************************ *                                                                      * *                      Copyright (c) 1988 - 1989 by                    * *              Digital Equipment Corporation, Maynard, MA              * *                      All rights reserved.                            * *                                                                      * *   This software is furnished under a license and may be used and     * *   copied  only  in accordance with the terms of such license and     * *   with the  inclusion  of  the  above  copyright  notice.   This     * *   software  or  any  other copies thereof may not be provided or     * *   otherwise made available to any other person.  No title to and     * *   ownership of the software is hereby transferred.                   * *                                                                      * *   The information in this software is subject to change  without     * *   notice  and should not be construed as a commitment by Digital     * *   Equipment Corporation.                                             * *                                                                      * *   Digital assumes no responsibility for the use  or  reliability     * *   of its software on equipment which is not supplied by Digital.     * *                                                                      * ************************************************************************ * * *   Facility:	Systems Communication Architecture *		Computer Interconnect Port-to-Port Driver * *   Abstract:	This module contains Computer Interconnect Port-to-Port *		Driver( CI PPD ) event notification routines.  There are *		two types of such routines: routines utilized by port *		drivers to notify the CI PPD finite state machine of the *		occurrence of specific path related events and event driven *		routines which are never directly invoked by port drivers. * *   Creator:	Todd M. Katz	Creation Date:	October 20, 1985 * *   Function/Routines: * *   Routines Invoked by Port Drivers *	cippd_receive		CI PPD Datagram/ID Packet Received *	cippd_reqid_snt		Identification Request Transmission Completed *	cippd_start		Start CI PPD Activity on Local Port *	cippd_stop		Stop CI PPD Activity on Local Port *   Routines NOT Invoked by Port Drivers *	cippd_poll		Poll Remote Ports for their Identification *	cippd_timer		CI PPD Interval Timer Routine * *   Modification History: * *   20-May-1989	Pete Keilty *	Changed splx(IPL_SCS) to new macro Splscs() and remove forkb.ipl. * *   06-Apr-1989	Pete Keilty *	Added include file smp_locl.h * *   17-Jan-1989	Todd M. Katz		TMK0006 *	1. The PCCB address is now part of the interface to Get_port. *	2. The macro Scaaddr_lol() has been renamed to Scaaddr_low().  It now *	   accesses only the low order word( instead of low order longword ) of *	   a SCA system address. *	3. Allow sanity checks on local port functioning to be permanently *	   disabled on a per local port basis at the discretion of the *	   appropriate port driver. *	4. Modify the cippd_start() to initialize the formative path PB queue *	   listhead.  Formerly it was down within the individual port drivers. *	5. Include header file ../vaxmsi/msisysap.h. * *   23-Sep-1988	Todd M. Katz		TMK0005 *	Modify cippd_receive() to verify the message type of received CI PPD *	datagrams.  Unknown CI PPD message types crash the paths over which the *	datagrams were received, or are logged and discarded if no path exists. * *   17-Aug-1988	Todd M. Katz		TMK0004 *	1. Rename IE_ALLOCFAIL -> E_ALLOCFAIL( it is now an error event ) and *	   LPC_BROKEN -> SE_PPDSANITY( the local port crash severity modifier( *	   ESM_LPC ) is applied only by the individual port driver routines *	   responsible for crashing paths and only when the local port has not *	   yet already been crashed ). *	2. cippd_stop() no longer needs to map specific port failure reasons to *	   generic ones.  This mapping is now performed by the individual port *	   drivers and passed into the routine in place of the specific reason *	   for crashing the port. *	3. Modify cippd_start(), cippd_timer(), and cippd_poll() to obtain *	   port polling burst size and contact frequency from CI PPD specific *	   PCCB fields instead of from CI PPD configuration variables. *	4. Modify cippd_stop() to event log the failure of each formative and *	   established path associated with a failed local port. *	5. Modify cippd_start() and cippd_poll() to allocate and add to each *	   local port an initial number of free datagram buffers for the *	   reception of solicited remote port identifications and unsolicitated *	   START CI PPD datagrams. *	6. Refer to error logging as event logging. * *   03-Jun-1988	Todd M. Katz		TMK0003 *	1. Modify cippd_receive() to event log instances of insufficient memory *	   for new path establishment. *	2. When cippd_receive() is unable to allocate sufficient resources, it *	   aborts new path establishment and deallocates those resources it was *	   able to allocate.  Unfortunately, an attempt was being made to *	   always deallocate the datagram allocated specifically for use during *	   path establishment, even though this datagram might not have been *	   successfully allocated.  Resolve the problem with this error path. *	3. Modify cippd_stop() to no longer zero log maps( dbclogmap, *	   ptdlogmap ) during CI PPD specific PCCB clean up. *	4. CI PPD event logging is now split between the routines *	   cippd_log_path() and cippd_log_sys() to differentiate between *	   logging of path specific and system level events respectively. *	   Modify cippd_receive() to invoke cippd_log_path(). * *   02-Jun-1988	Ricky S. Palmer *      Removed inclusion of header file ../vaxmsi/msisysap.h * *   11-Apr-1988	Todd M. Katz		TMK0002 *	Add use of Pb_fork() and Pccb_fork() macros in place of straight-line *	code. * *   08-Jan-1988	Todd M. Katz		TMK0001 *	Formated module, revised comments, increased robustness, made *	CI PPD and GVP completely independent from underlying port drivers, *	restructured code paths, and added SMP support. *//* Libraries and Include Files. */#include		"../h/types.h"#include		"../h/param.h"#include		"../h/systm.h"#include		"../h/vmmac.h"#include		"../h/ksched.h"#include		"../h/time.h"#include		"../h/errlog.h"#include		"../h/smp_lock.h"#include		"../io/scs/sca.h"#include		"../io/scs/scaparam.h"#include		"../io/ci/cippdsysap.h"#include		"../io/ci/cisysap.h"#include		"../io/msi/msisysap.h"#include		"../io/bi/bvpsysap.h"#include		"../io/gvp/gvpsysap.h"#include		"../io/uba/uqsysap.h"#include		"../io/sysap/sysap.h"#include		"../io/ci/cippdscs.h"#include		"../io/ci/ciscs.h"#include		"../io/msi/msiscs.h"#include		"../io/bi/bvpscs.h"#include		"../io/gvp/gvpscs.h"#include		"../io/uba/uqscs.h"#include		"../io/scs/scs.h"#include		"../io/gvp/gvp.h"#include		"../io/ci/cippd.h"/* External Variables and Routines. */extern	int		hz;extern	u_long		cippd_dispatch();extern	PB		*cippd_get_pb(), *scs_alloc_pb();extern	u_short		cippd_init_dgs, cippd_itime, cippd_max_port,			cippd_penable;extern	void		cippd_clean_fpb(), cippd_clean_pb(), cippd_crash_pb(),			cippd_log_path(), cippd_poll(), cippd_timer(),			scs_dealloc_pb();/*   Name:	cippd_receive	- CI PPD Datagram/ID Packet Received * *   Abstract:	This CI PPD event notification routine is asynchronously *		invoked whenever a port driver receives one of the following ID *		packets or non-application CI PPD datagrams: * *		1. ID packet. *		2. START CI PPD datagram. *		3. STACK( Start Acknowledge ) CI PPD datagram. *		4. ACK CI PPD datagram. *		5. ERROR CI PPD datagram. *		6. STOP CI PPD datagram. * *		Its purpose is to process and dispose of the received packet. * *		NOTE: SCA port numbers are 6 bytes in size; however, maximum *		      CI PPD port numbers only occupy 1 byte, the low-order *		      byte of a port station address.  Port numbers are passed *		      as 4 bytes entities back and forth between the CI PPD and *		      its client port drivers. * *   Inputs: * *   IPL_SCS			- Interrupt processor level *   cippd_max_port		- CI PPD maximum port to recognize *   cippd_penable		- CI PPD port polling enable flag *   cippdbp			- Address CI PPD header in datagram/ID buffer *   pccb			- Port Command and Control Block pointer *   type			- Type of packet received * *   Outputs: * *   IPL_SCS			- Interrupt processor level *   pb				- Path Block pointer *	forkb			-  Fork block for path clean up *	ppd.cippd		-  CI PPD specific PB fields *	    fsmpstatus		-   Finite State Machine path status flags *		path_closed	-    Path already closed by port status bit *   pccb			- Port Command and Control Block pointer *	lpinfo.ppd.cippd	-  CI PPD specific local port information *	    nform_paths		-   Current number of formative paths *	    npaths		-   Current number of paths *	ppd.cippd		-  CI PPD specific PCCB fields *	    aflogmap		-   Path establishment insufficient mem log map *	    elogopt.port_num	-   Remote port number * *   SMP:	The PCCB is locked to synchronize access, for retrieval of *		existing PBs, for insertion of new PBs onto the queue of *		formative PBs to postpone potential PB deletion, and as *		required by cippd_log_path() in case logging becomes necessary. *		PCCB addresses are always valid because these data structures *		are never deleted once their corresponding ports have been *		initialized. * *		The PB is locked to postpone potential deletion and for *		declaration of an event on the corresponding path appropriate *		to the packet received and the path's current state. * *		NO EXTERNAL locks may be held when this routine is invoked. */voidcippd_receive( pccb, cippdbp, type )    register PCCB	*pccb;    GVPPPDH		*cippdbp;    u_long		type;{    register PB		*pb;    register SCSH	*scsbp;    register u_long	( *alloc )(), port;    PIB			cippd_pib;    /* Lock the PCCB, process and dispose of the received packet, and unlock     * the PCCB before returning.  Received packets are processed in one of the     * following ways:     *     * 1. ID packets and CI PPD datagrams with known message types received     *	  over existent paths are processed and disposed of by the CI PPD     *	  finite state machine.     * 2. Non-START CI PPD datagrams received over non-existent paths are     *    returned to the appropriate local port datagram free queue.     * 3. ID packets and START CI PPD datagrams received over unknown paths     *	  initiate new path establishment and are processed and disposed of by     *	  the CI PPD finite state machine.     * 4. CI PPD datagrams with unknown message types crash the paths over     *	  which they were received.  If no path exists then the invalid     *	  datagrams are just logged before being discarded.     *     * The appropriate PB is always locked prior and unlocked after invocation     * of the finite state machine.     *     * New path establishment requires the following actions prior to     * invocation of the finite state machine:     *     * 1. A new PB is allocated.     * 2. A datagram is allocated for use during path establishment and added     *    to the appropriate port's datagram free queue.     * 3. Any port driver specific buffers are allocated.     * 4. The PB fork block reserved for clean up of the path is initialized.     * 5. The appropriate PB CI PPD path state bits are initialized.     *     * Insufficient memory in Steps 1-3 aborts new path establishment.  Only     * the first such failure to establish a specific path is logged.  Logging     * of all subsequent failures is bypassed until after the CI PPD is     * successful at allocating all required memory for establishment of the     * specific path( see cippd_enab_path()).     *     * The allocated datagram( Step 2 ) is conceptually used for all protocol     * exchanges during establishment of the new path.  It is only temporarily     * required and is removed from the free queue and deallocated following     * path establishment.     *     * START CI PPD datagrams and ID packets received over unknown paths may     * also be returned to the appropriate port's datagram free queue instead     * of initiating new path establishment when one the following conditions     * exists:     *     * 1. Polling is not currently enabled.     * 2. The station address of the sending CI PPD exceeds the maximum address     *	  the local CI PPD is currently willing to converse with.     * 3. A failure occurs during new path establishment initiation.     */    Lock_pccb( pccb )    if(( pb = cippd_get_pb( pccb, Ppd_to_scs( cippdbp ), BUF )) == NULL ) {	port = ( *pccb->Get_port )( pccb, cippdbp );	if(( type == CNFE_START_REC || type == CNFE_ID_REC ) &&	      cippd_penable				     &&	      port <= Maxport( pccb )) {	    ( void )bzero(( u_char * )&cippd_pib, sizeof( PIB ));	    cippd_pib.lport_name = pccb->lpinfo.name;	    Scaaddr_low( cippd_pib.rport_addr ) = port;	    if(( pb = scs_alloc_pb( PS_CLOSED, pccb, &cippd_pib )) &&		 ( scsbp = ( *pccb->Alloc_dg )( pccb ))		   &&		 (( alloc = pccb->Alloc_buf )			? ( *alloc )( pccb, pb )			: RET_SUCCESS ) == RET_SUCCESS ) {		( void )( *pccb->Add_dg )( pccb, scsbp );		pb->Fsmpstatus.path_closed = 1;		Insert_entry( pb->flink, pccb->Form_pb )		++pccb->lpinfo.Nform_paths;	    } else {		if( pb ) {		    if( scsbp ) {			( void )( *pccb->Dealloc_dg )( pccb, scsbp );		    }		    ( void )scs_dealloc_pb( pccb, pb );		    pb = NULL;		}		if( !Test_map( Aflogmap, port )){		    Set_map( Aflogmap, port )		    pccb->Elogopt.port_num = port;		    ( void )cippd_log_path( pccb, NULL, NULL, E_ALLOCFAIL );		}	    }	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -