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

📄 ci_subr.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 4 页
字号:
 *		      driver specific.  It is passed by the CI PPD to the *		      driver's optionally provided Init_pb routine during path *		      establishment, presumably for storage in the PB *		      corresponding to the new path being established. * *   Inputs: * *   IPL_SCS			- Interrupt processor level *   cippdbp			- Address of CI PPD header in datagram buffer *   dispose			- RECEIVE_BUF or DEALLOC_BUF *   pccb			- Port Command and Control Block pointer *	ppd.cippd		-  CI PPD specific PCCB fields *	    poll_cable		-   CI cable to use for polling *   gvp_queue_retry		- SCA queuing failure retry count *   rport_addr			- Address of target remote port * *   Outputs: * *   IPL_SCS			- Interrupt processor level * *   Return Values: * *   RET_SUCCESS		- Successfully initiated request transmission *   RET_ALLOCFAIL		- Unable to allocate CI command packet * *   SMP:	The PCCB is locked( EXTERNALLY ) allowing exclusive access to *		PCCB contents. * *		Access to port command queues is by means of memory *		interlocking queuing instructions. */u_longci_send_reqid( pccb, cippdbp, rport_addr, dispose )    register PCCB	*pccb;    GVPPPDH		*cippdbp;    u_long		rport_addr;    u_long		dispose;{    register REQIDH	*bp;    register GVPH	*cibp;    /* The steps involved in requesting a specific remote port's identification     * are as follows:     *     * 1. Allocate a CI port command packet if a CI datagram buffer was not     *	  provided.     * 2. Format the REQID specific portion of the command packet.     * 3. Format the generic Vaxport port header.     * 4. Initiate request transmission.     *     * The request for remote port identification is always transmitted over     * the current polling cable instead of allowing the port to choose the     * physical cable for transmission.  Note that it is still possible to     * allow the port to choose the physical cable for transmission by     * specifying the current polling cable as ANY_CABLE.     *     * The port is crashed if transmission can not be successfully initiated.     *     * NOTE: The port driver utilizes port command completion as the trigger     *	     for asynchronously notifying the CI PPD of completion of its     *	     request for identification of the specific remote port.  The     *	     completed command packet contains all information necessary for     *	     this notification.  No auxiliary information need be stored.     *     * NOTE: Existence of the targeted remote port results in automatic remote     *	     initiated transmission of its identification.  Reception of this     *	     information automatically triggers asynchronous CI PPD     *	     notification of identification reception.     */    if(( bp = ( REQIDH * )cippdbp )) {	cibp = Ppd_to_pd( bp, pccb );    } else if(( cibp = ci_alloc_pkt( pccb ))) {	dispose = DEALLOC_BUF;	bp = ( REQIDH * )Pd_to_ppd( cibp, pccb );    } else {	return( RET_ALLOCFAIL );    }    bp->xctid.blockid = 0;    U_long( bp->xctid.lconnid ) = 0;    Format_gvph( pccb, cibp, REQID, rport_addr, dispose )    Cselect( cibp ) = pccb->Poll_cable;    Insqti_communication( cibp, pccb )    return( RET_SUCCESS );}/*   Name:	ci_set_circuit	- Set Virtual Circuit State to On/Off * *   Abstract:	This function initiates the setting of the virtual circuit *		associated with a specific remote port to either an on or an *		off state.  It is provided by the port driver for use by the *		CI PPD finite state machine during path establishment and *		disablement. * *		Circuit state modification is initiated by placing a SETCKT *		command packet onto the highest priority port command queue *		and notifying the port when the queue was previously empty. * *		A CI command packet is used to contain the command.  It is *		provided to this function only when the virtual circuit is to *		be turned off and a PB is provided.  The PB's emergency set *		circuit off command packet, preallocated during path *		establishment, is used for the command.  In all other *		situations the command packet must be allocated.  Packets are *		always deallocated following command execution. * *		The port is crashed if the queue interlock can not be obtained. * *		NOTE: This is a mandatory PD function( Set_circuit ) for use by *		      the CI PPD finite state machine.  Not all port drivers *		      are required to issue port commands in order to set the *		      virtual circuit.  However, all must supply this function *		      for use by the CI PPD.  How each driver accomplishes *		      circuit state modification is left up to it. * *		NOTE: SCA port numbers are 6 bytes in size; however, maximum CI *		      and 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 *		      CI port driver. * *   Inputs: * *   IPL_SCS			- Interrupt processor level *   pb				- Path Block pointer *	pd.gvp.ci		-  CI specific PB fields *	    scpkt		-   Set circuit off command packet *   pccb			- Port Command and Control Block pointer *   rport_addr			- Address of target remote port *   state			- SET_VC_CLOSE or SET_VC_OPEN *   gvp_queue_retry		- SCA queuing failure retry count * *   Outputs: * *   IPL_SCS			- Interrupt processor level *   pb				- Path Block pointer *	pd.gvp.ci		-  CI specific PB fields *	    scpkt		-   Set circuit off command packet * *   Return Values: * *   RET_SUCCESS		- Set circuit command successfully initiated *   RET_ALLOCFAIL		- Unable to allocate CI port command packet * *   SMP:	The PB is locked( EXTERNALLY ) allowing exclusive access to PB *		contents. * *		Access to port command queues is by means of memory *		interlocking queuing instructions. * *              This function requires the PCCB to be locked( EXTERNALLY ) *		because locks lower than the PCCB in the SCA locking hierarchy *              such as the PB may NOT be held without also holding the PCCB *              lock in case the port requires crashing. */u_longci_set_circuit( pccb, pb, rport_addr, state )    register PCCB	*pccb;    PB			*pb;    u_long		rport_addr;    u_long		state;{    register GVPH	*cibp;    register SETCKTH	*bp;    /* The steps involved in setting a specific virtual circuit state are as     * follows:     *     * 1. Allocate a CI port command packet if such a packet was not provided.     * 2. Format the SETCKT specific portion of the command packet.     * 3. Format the generic Vaxport port header     * 4. Initiate port command execution.     *     * The port is crashed if command execution can not be successfully     * initiated.     */    if( pb == NULL || state == SET_VC_OPEN ) {	if(( cibp = ci_alloc_pkt( pccb )) == NULL ) {	    return( RET_ALLOCFAIL );	}    } else if(( cibp = pb->Scpkt )) {	pb->Scpkt = NULL;    } else {	( void )panic( PANIC_NOSCPKT );    }    bp = ( SETCKTH * )Pd_to_ppd( cibp, pccb );    U_long( bp->mvalue ) = 0;    switch( pccb->lpinfo.type.hwtype ) {        case HPT_CIXCD:	    if( state ) {                U_long( bp->mask ) = Exp_mask;                U_long( bp->mvalue ) = EFR_MASK( pb->pinfo.Port_fcn_ext2 );                U_long( bp->mvalue ) |= NADP_MASK( pb->pinfo.Port_fcn_ext2 );	    } else if( pb == NULL ) {                U_long( bp->mask ) = Exp_mask;		/* for full subnode need to check dst_port.mem != 0 and		   set mvalue bit to 1 or change the mask for EAS = 0 */	    } else {                U_long( bp->mask ) = Exp_mask;                U_long( bp->mvalue ) = FR_MASK( pb->pinfo.Port_fcn_ext2 );		/* for full subnode need to check dst_port.mem != 0 and		   set mvalue bit to 1 or change the mask for EAS = 0 */	    }            break;        case HPT_CIKMF:            U_long( bp->mask ) = Kmf_mask;            U_long( bp->mvalue ) = Kmf_mvalue;            break;        default:            U_long( bp->mask ) = Imp_mask;            break;    }    bp->mvalue.vcd_ov.fsn.vcstate = state;    Format_gvph( pccb, cibp, SETCKT, rport_addr, DEALLOC_BUF )    Insqti_control( cibp, pccb )    return( RET_SUCCESS );}/*   Name:	ci_test_lpconn	- Test Local CI Port Connectivity * *   Abstract:	This routine tests the connectivity of the specified local CI *		port.  It also resets the CI PPD port polling contact frequency *		and burst size on the local port for the next polling sweep *		using CI configuration variables.  It is invoked by the CI PPD *		during port polling at the conclusion of the current polling *		sweep. * *		Local port connectivity is defined as the demonstrated ability *		to communicate with other CI ports over the CI itself.  A local *		ports ability to communicate with itself is not sufficient to *		establish local port connectivity as such communication may be *		looped back internally bypassing the CI.  Only those local *		ports with demonstrated ability to communicate with ports other *		than themselves are consider to possess connectivity. * *		Testing local port connectivity makes use of the special *		loopback function provided by CI ports.  This loopback  *		function guarantees transmission of special loopback datagrams *		over the CI, even when the datagrams are directed to the local *		port itself.  Loopback datagram transmission is initiated by *		placing a SNDLB command packet onto the second highest priority *		port command queue and notifying the port when the queue was *		previously empty. * *		A full size CI port specific datagram buffer is used to contain *		the command.  It is allocated by this routine and placed onto *		the appropriate local port datagram free queue following *		successful command execution for reception of the corresponding *		response( LBREC ).  Note: this explains why full size datagram *		buffers are used to contain SNDLB port commands instead of *		smaller CI port command packets.  Corresponding responses are *		always deallocated following processing. * *		The port is crashed if the queue interlock can not be obtained. * *		NOTE: This is an optional PD routine( Test_lportconn ) for use *		      by the CI PPD.  The CI port driver provides it because it *		      oversees ports whose connectivity may come into question *		      and must be verified when this is indeed the case.  Other *		      port drivers do not have such needs and need not provide *		      this function. * *		NOTE: Lack of local port connectivity may be due to many *		      factors ranging from hardware problems to failure to *		      properly cable up the CI port to the coupler/switch. * *   Inputs: * *   IPL_SCS			- Interrupt processor level *   ci_cippdburst		- CI PPD port polling burst size *   ci_cippdcontact		- CI PPD port polling contact frequency *   pccb			- Port Command and Control Block pointer *   gvp_queue_retry		- SCA queuing failure retry count * *   Outputs: *   pccb			- Port Command and Control Block pointer *	pd.gvp.type.ci		-  CI specific PCCB fields *	    lbstatus		-   Loopback status flags *		cable0_curr	-    Cable 0 current status flag *		cable0_prev	-    Cable 0 previous status flag *		cable0_test	-    Cable 0 loopback tested status flags *		cable1_curr	-    Cable 1 current status flag *		cable1_prev	-    Cable 1 previous status flag *		cable1_test	-    Cable 1 loopback tested status flags *	    lpstatus		-   Local port status flags *		connectivity	-    Port connectivity established status flag *	ppd.cippd		-  CI PPD specific PCCB fields *	    burst		-   Port polling burst size *	    contact		-   Port polling contact frequency *	    fsmstatus.online	-   1 * *   IPL_SCS			- Interrupt processor level * *   SMP:	The PCCB is locked( EXTERNALLY ) to synchronize access and as *		required by ci_update_cable() for updating of loopback cable *		status. * *		Access to port command queues is by means of memory *		interlocking queuing instructions. */voidci_test_lpconn( pccb )    register PCCB	*pccb;{    register GVPH	*cibp;    register SCSH	*scsbp;    register SNDLBH	*bp;    register u_long	npaths, skip_test;    /* Testing local CI port connectivity is naturally subdivided into testing     * the connectivity of each of the local port's cables.  Each time this     * routine is invoked, the connectivity of one of the port's cables is     * targeted.  Which cable is targeted by each invocation is defined by the     * current CI PPD port polling cable.     *     * Each test of local port connectivity consists of the following phases:     *     * 1. Updating local port connectivity status.     * 2. Determining whether an explicit connectivity test is required.     * 3. Initiating any required connectivity test.     *     * Updating local port connectivity status( Phase 1 ) consists of updating     * local port loopback cable status from the previous test of the current     * cable.  Any good->bad loopback cable transitions are also logged.     *     * An explicit connectivity test is required( Phase 2 ) when either local     * port connectivity has not yet been established or connectivity of the     * target cable not yet explicitly demonstrated.  Local port connectivity     * is demonstrated only through reception of an identification response     * from a port other than the local one.  An explicit demonstration of     * cable connectivity is achieved only through a successful result of a     * previous connectivity test on the target cable.     *     * Determining the need for an explicit connectivity test( Phase 2 ) also     * involves determining whether established local port connectivity has     * been lost.  Whenever the local port has lost communication with all     * ports, or all ports but itself, local port connectivity is considered to     * be lost.  The PCCB is updated appropriately and connectivity tests are     * executed each time this routine is invoked until connectivity is again     * demonstrated on each cable.     *     * A cable connectivity test( Phase 3 ) basically consists of transmitting     * a special loopback datagram to the local port over the target cable by     * means of the following steps:     *

⌨️ 快捷键说明

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