📄 scs_protocol.c
字号:
#ifndef lintstatic char *sccsid = "@(#)scs_protocol.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 * Systems Communication Services * * Abstract: This module contains Systems Communication Services( SCS ) * protocol handler functions and routines. * * Creator: Todd M. Katz Creation Date: June 15, 1985 * * Function/Routines: * * scs_receive SCS Sequenced Message Received * scs_request Send SCS Sequenced Message Request * scs_response Send SCS Sequenced Message Response * scs_timer SCS Protocol Interval Timer * * Modification History: * * 06-Jun-1990 Pete Keilty * Corrected the use of a possible null pb pointer in the scs_receive * routine SCS_CONN_REQ to use the pccb->Open_path. * * 06-Apr-1989 Pete Keilty * Added include file smp_lock.h * * 10-Feb-1989 Todd M. Katz TMK0005 * 1. Move scs_abort_conn() to module ../vaxscs/scs_error.c * 2. Add support for SCS event logging. Log establishments and * terminations of full SCS connections, and terminations and * rejections of formative SCS connections. * 3. Include header file ../vaxmsi/msisysap.h. * * 27-Sep-1988 Todd M. Katz TMK0004 * 1. Modify the order in which scs_receive() executes the steps required * to process received SCS sequenced messages. This re-ordering * explicitly unlocks the targeted CB prior to initiating transmission * of an appropriate response or the next request pending transmission * across the path. It is necessary because scs_request(), the routine * responsible for sending all SCS requests, assumes the CB associated * with the next pending request is NOT locked by the current thread. * This was not the case when the next request pending transmission is * on behalf of the CB targeted by the current received SCS response. * With this re-ordering this assumption is now always true. * 2. The sanity check interval for SCS protocol sequences was being * incorrectly computed by scs_request(). Fix it. * * 20-Aug-1988 Todd M. Katz TMK0003 * SCA event codes have been completed revised. All former SCS path crash * codes are now defined as either error events or severe error events. * The path crash attribute is only applied by the individual port driver * routines responsible for crashing paths and only when the crashed path * is currently open. * * 12-Jul-1988 Todd M. Katz TMK0002 * Macros Copy_name() and Copy_data() have been renamed to Move_name() and * Move_data() respectively. * * 08-Jan-1988 Todd M. Katz TMK0001 * Formated module, revised comments, increased robustness, restructured * code paths, and added SMP support. *//* * System Communication Services Protocol * * SCS provides logical SCS connections for use as communication conduits * between SYSAPs. The establishment, maintenance, and termination of these * connections requires SCS to communicate with equivalent SCS layers on other * systems. Such communication between peers utilizes a SCS specific * communication protocol. Three such protocol sequences are currently * defined: * * 1. Establishment of a logical SCS connection. * 2. Maintenance of flow control across a logical SCS connection. * 3. Termination of a logical SCS connection. * * Each SCS protocol sequence consists of the transmission of one or more * requests. For each request transmitted a response is received. This * response acknowledges reception of the request and in some cases terminates * the SCS protocol sequence. * * The connection establishment SCS protocol sequence is triggered by a SYSAP * actively requesting a logical SCS connection to a remote counterpart * passively listening for such connection requests. The passive SYSAP * responds to the connection request by accepting or rejecting the connection. * There are three possible pathways to this SCS protocol sequence: * * Active SYSAP Passive SYSAP * ------------ ------------- * * Connection can NOT be Established * * SCS_CONN_REQ -------------------------> * <------------------------- SCS_CONN_RSP * * Connection is Accepted and Established * * SCS_CONN_REQ -------------------------> * <------------------------- SCS_CONN_RSP * <------------------------- SCS_ACCEPT_REQ * SCS_ACCEPT_RSP -------------------------> * * Connection is Rejected * * SCS_CONN_REQ -------------------------> * <------------------------- SCS_CONN_RSP * <------------------------- SCS_REJECT_REQ * SCS_REJECT_RSP -------------------------> * * The maintenance flow control SCS protocol sequence is triggered whenever SCS * determines that send credits must be extended on a logical SCS connection in * order to maintain maximum throughput across the connection. This occurs as * a side-effect of explicit SYSAP action and as a result of SCS processing of * deallocated application sequenced messages. SCS also allows for withdrawal * of send credits already extended ( but not used ) through this same * sequence. There is only one possible pathway to this SCS protocol sequence: * * Local SCS Remote SCS * --------- ---------- * * SCS_CREDIT_REQ -------------------------> * <------------------------- SCS_CREDIT_RSP * * The connection termination SCS protocol sequence is triggered by a SYSAP * actively requesting termination of a logical SCS connection to a remote * counterpart. The remote SYSAP responds to the termination request by * issuing its own request for connection termination. As both the local and * remote SYSAPs may simultaneously initiate connection termination there are * two possible pathways to this SCS protocol sequence: * * Local SYSAP Remote SYSAP * ----------- ------------ * * Sequential Exchange of Disconnects * * SCS_DISCONN_REQ -------------------------> * <------------------------- SCS_DISCONN_RSP * <------------------------- SCS_DISCONN_REQ * SCS_DISCONN_RSP -------------------------> * * Simultaneous Exchange of Disconnects * * SCS_DISCONN_REQ -------------------------> * <------------------------- SCS_DISCONN_REQ * SCS_DISCONN_RSP -------------------------> * <------------------------- SCS_DISCONN_RSP * * The transmission of each SCS request is timed. If a response to a request * is not received before the timer expires then the path over which the * request was transmitted is terminated. Because SCS flow control always * allows SCS responses to be transmitted, this use of a sanity timer * guarantees that SCS peer communication over a path is never impeded by * problems on a remote system. * * Associated with each logical SCS connection is its connection state. This * state impacts on its connection in the following ways: * * 1. It marks the connection's place within a SCS protocol sequence. * 2. It dictates the actions taken by SCS in response to asynchronous events * occurring on the connection. * 3. It affects the validity of explicit SYSAP requests on the the connection. * * The connection state table documented below summarizes for each state the * allowed explicit SYSAP requests and the actions taken by SCS in response to * asynchronous events. * * BEGINNING ENDING * CONNECTION CONNECTION * STATE EVENT OR SYSAP REQUEST ACTION STATE * ---------- ---------------------- ------------------------- ------------ * CLOSED Issue LISTEN - LISTEN * Issue CONNECT Transmit CONN_REQ CONN_SNT * Receive CONN_RSP - - * Receive ACCEPT_REQ Transmit ACCEPT_RSP( F ) - * Receive REJECT_REQ Transmit REJECT_RSP - * * LISTEN Issue DISCONNECT - CLOSED * Receive CONN_REQ Transmit CONN_RSP( S ) CONN_REC * Notify SYSAP( S ) * Discover new path Notify SYSAP - * * CONN_REC Issue ACCEPT Transmit ACCEPT_REQ ACCEPT_SNT * Issue REJECT Transmit REJECT_REQ REJECT_SNT * Issue DISCONNECT Transmit REJECT_REQ REJECT_SNT * Path failure - LISTEN * * CONN_SNT Issue DISCONNECT Abort Connection CLOSED * Receive CONN_RSP( S ) - CONN_ACK * Receive CONN_RSP( F ) Notify SYSAP( F ) CLOSED * Path failure Notify SYSAP( F ) CLOSED * * CONN_ACK Issue DISCONNECT Abort Connection CLOSED * Receive ACCEPT_REQ Transmit ACCEPT_RSP( S ) OPEN * Notify SYSAP( S ) * Receive REJECT_REQ Notify SYSAP( F ) CLOSED * Path failure Notify SYSAP( F ) CLOSED * * ACCEPT_SNT Receive ACCEPT_RSP( S ) Notify SYSAP( S ) OPEN * Receive ACCEPT_RSP( F ) Notify SYSAP( F ) CLOSED * Receive CONN_REQ Transmit CONN_RSP( F ) - * Discover new path Notify SYSAP - * Path failure Notify SYSAP( F ) LISTEN * * REJECT_SNT Receive REJECT_RSP Notify SYSAP( S ) CLOSED * Receive CONN_REQ Transmit CONN_RSP( F ) - * Discover new path Notify SYSAP - * Path failure Notify SYSAP LISTEN * * DISCONN_REC Issue DISCONNECT Transmit DISCONN_REQ DISCONN_MTCH * Issue DEALLOC_MSG Deallocate message buffer - * Issue DEALLOC_DG Deallocate datagram buffer - * Issue UNMAP_BUF Unmap local buffer - * Receive CREDIT_RSP - - * Block Transfer Done Notify SYSAP - * Datagram Transmitted Return Datagram to SYSAP - * Message Transmitted Return Message to SYSAP - * Path failure Notify SYSAP PATH_FAILURE * * DISCONN_SNT Receive DISCONN_RSP - DISCONN_ACK * Receive DISCONN_REQ Transmit DISCONN_RSP DISCONN_MTCH * Receive CREDIT_REQ Ignore Request - * Transmit CREDIT_RSP * Receive CREDIT_RSP - - * Receive Appl Datagram Discard Datagram - * Receive Appl Message Discard Message - * Datagram Transmitted Discard Datagram - * Message Transmitted Discard Message - * Path failure Notify SYSAP CLOSED * * DISCONN_ACK Receive DISCONN_REQ Transmit DISCONN_RSP CLOSED * Notify SYSAP * Path failure Notify SYSAP CLOSED * * DISCONN_MTCH Receive DISCONN_RSP Notify SYSAP CLOSED * Receive CREDIT_RSP - - * Datagram Transmitted Discard Datagram - * Message Transmitted Discard Message - * Path failure Notify SYSAP CLOSED * * PATH_FAILURE Issue DISCONNECT - CLOSED * Issue DEALLOC_MSG Deallocate message buffer - * Issue DEALLOC_DG Deallocate datagram buffer - * Issue UNMAP_BUF Unmap local buffer - * * OPEN Issue DISCONNECT Transmit DISCONN_REQ DISCONN_SNT * Issue ALLOC_DG Allocate Datagram Buffer - * Issue DEALLOC_DG Deallocate Datagram Buffer - * Issue QUEUE_DGS Add Receive Datagrams - * Issue SEND_DG Transmit Appl Datagram - * Issue ALLOC_MSG Allocate Message Buffer - * Issue DEALLOC_MSG Deallocate Message Buffer - * Issue MOD_CREDITS Transmit CREDIT_REQ - * Issue ALLOC_RSPID Allocate RSPID - * Issue SEND_MSG Transmit Appl Message - * Issue MAP_BUF Map Local Buffer - * Issue UNMAP_BUF Unmap Local Buffer - * Issue SEND_DATA Transfer Block Data - * Issue REQ_DATA Transfer Block Data - * Deallocate appl msg Transmit CREDIT_REQ - * Receive DISCONN_REQ Transmit DISCONN_RSP DISCONN_REC * Notify SYSAP * Receive CREDIT_REQ Process Request - * Transmit CREDIT_RSP * Notify SYSAP * Receive CREDIT_RSP - - * Block Transfer Done Notify SYSAP - * Receive Appl Datagram Return Datagram to SYSAP - * Receive Appl Message Return Message to SYSAP - * Datagram Transmitted Return Datagram to SYSAP - * Message Transmitted Return Message to SYSAP - * Path failure Notify SYSAP PATH_FAILURE * * NOTES: 1. Associated with all SYSAP notifications and some messages is * a status. Success status are indicated by ( S ) while ( F ) * indicates a failure status. * 2. The reception of CREDIT_REQ SCS sequenced messages while in * the OPEN connection state sometimes results in SYSAP * notification. * 3. The deallocation of application sequenced messages while in * the OPEN connection state sometimes results in transmission * of SCS CREDIT_REQ sequenced messages. * * There are some additional rules which serve to explain all the cases not * covered by the connection state table: * * 1. The issuing of a SCS service function by a SYSAP on a logical SCS * connection in any other state returns an error. * 2. The reception of a CONN_REQ SCS sequenced message for a logical SCS * connection in any other state panics the local system. * 3. The reception of a SCS sequenced message for a logical SCS connection in * any other state results in termination of the path. * 4. The reception of an unknown SCS sequenced message results in termination * of the path. * 5. Notification of block data transfer completion for a logical SCS * connection in any other state results in termination of the path. * 6. The reception of an application datagram or sequenced message for a * logical SCS connection in any other state results in termination of the * path. * 7. The completion of application datagram or sequenced message transmission * for a logical SCS connection in any other state results in termination of * the path. * 8. The occurrence of path failure for a logical SCS connection in any other * state panics the local system. *//* Libraries and Include Files. */#include "../h/types.h"#include "../h/param.h"#include "../h/ksched.h"#include "../h/time.h"#include "../h/errlog.h"#include "../h/smp_lock.h"#ifdef mips#include "../h/systm.h"#include "../h/vmmac.h"#endif mips#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"/* External Variables and Routines. */extern int hz;extern SCSIB lscs;extern struct lock_t lk_scadb;extern u_char scs_sanity;extern CBVTDB *scs_cbvtdb;extern cbq scs_listeners; extern pbq scs_timeoutq;extern CB *scs_alloc_cb();extern void scs_dealloc_cb(), scs_init_cmsb(), scs_log_event(), scs_request(), scs_response(), scs_timer(), timeout();/* Name: scs_receive - SCS Sequenced Message Received * * Abstract: This routine processes and disposes of SCS sequenced messages * received over specific paths. Such messages contain either * SCS requests or SCS responses. There are five types of SCS * requests: * * 1. Request for establishment of a logical SCS connection. * 2. Request for acceptance of a connection request. * 3. Request for rejection of a connection request.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -