Google
 

Trailing-Edge - PDP-10 Archives - BB-R595B-SM_11-9-85 - mcb/xpt/xptupd.bli
There is 1 other file named xptupd.bli in the archive. Click here to see a list.
module XPTUPD	(
		IDENT = 'X01110'
		) =
begin

!
!                    COPYRIGHT (c) 1980, 1981, 1982
!                    DIGITAL EQUIPMENT CORPORATION
!                        Maynard, Massachusetts
!
!     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:	Transport
!
! ABSTRACT:
!
!	Transport update module; responsible for the propagation of
!	routing messages.
!
! ENVIRONMENT:	MCB
!
! AUTHOR: L. Webber , CREATION DATE: 20-Jul-79
!
! MODIFIED BY:
!
!	L. Webber, 20-Jul-79 : VERSION 01
!
! 1.01	L. Webber, 23-Oct-79
!	Rewrote routines UPDTIM and UPDFMT
!
! 1.02	L. Webber, 1-Apr-80
!	Modified Transport data base structure; added
!	Node and Line sub-data-bases.
!
! 1.03	L. Webber, 30-Jun-80
!	Modify to use MCBLIB macros
!
! 1.04	L. Webber, 21-Nov-80
!	Fix UPDTIM to clear SRM after sending a message
!
! 1.05	L. Webber, 11-Dec-80
!	Modify to support MCB 3.1
!
! 1.06	L. Webber, 9-Feb-81
!	Change references to SNDBUF to CALL$E
!
! 1.07	L. Webber, 9-Feb-81
!	Change back to direct call; an interface routine has been added.
!
! 1.08	L. Webber, 10-Feb-81
!	This module is now in XPE; SNDBUF now becomes _SNDBUF and CALL$,
!	while UPDTIM itself becomes CALL$.
!
! 1.09	L. Webber, 3-Jun-81
!	Allocate a buffer of a specific size rather than an LDB.
!
! 1.10	A. Peckham, 22-Apr-82
!       Eliminate GETLINE, GETNODE references.
!
! 1.11	A. Peckham, 23-Sep-82
!       Send shortened routing messages to nodes with fences.
!
!--
!
! INCLUDE FILES:
!

require 'XPTMAC';

!
! TABLE OF CONTENTS
!

forward routine
	UPDFMT: LINKAGE_DB_CCB novalue;

!
! MACROS:
!

!
! EQUATED SYMBOLS:
!

!
! OWN STORAGE:
!

!
! EXTERNAL REFERENCES:
!

external routine
    _SNDBUF: CALL$ novalue;
routine UPDFMT (LINEb,CCB): LINKAGE_DB_CCB novalue =

!++
! FUNCTIONAL DESCRIPTION:
!
!  Formats and sends a routing message over the specified line.
!
! FORMAL PARAMETERS
!
!       LINEb   Line over which to send the message
!	CCB	LDB in which to build the routing message
!
! IMPLICIT INPUTS
!
!	Minhop,Mincost.
!
! ROUTINE VALUE:
! COMPLETION CODES:
!
!	NONE.
!
! SIDE EFFECTS:
!
!	NONE.
!
!--

begin
map CCB: ref block field (C_XPT_fields);
require 'XPTSYM';
pointer PTR;
local NO_NODES,SUM;

begin                          ! Get number of nodes to process
bind MXA = NO_NODES: ref vector;

if (MXA = .NODEmaximum_address_vector) neqa 0
then begin
     if (MXA = .MXA [.Nid - 1]) neq 0
     then begin
          if .MXA gtr NN
          then MXA = NN;
          end
     else MXA = NN;
     end
else MXA = NN;
end;
CCB[C_XPT_TYPE] = UPDATEcode;           ! Move buffer type into CCB
CCB[C_XPT_SUBTYPE] = UPDATEcode;	!  (subtype also)
MAPBUF(.CCB,PTR);                       ! Map to buffer and get address
putb(7,PTR);				! Put in control flags
putb(.(Tid)<0,8>,PTR);			! Put in source node (us)
putb(.(Tid)<8,8>,PTR);
SUM = 0;				! Initialize checksum
$XPT_for_each_NODEb_do_begin
    local WORK;
    if .NODEaddress gtr .NO_NODES then exitloop;
    WORK = .Minhop^Hop_P+.Mincost^Cost_P; !  hop/cost word
    putb(.WORK<0,8>,PTR);               !  and add word
    putb(.WORK<8,8>,PTR);
    checksum(SUM,.WORK);                !  into checksum
$XPT_next_NODEb_end;
putb(.SUM<0,8>,PTR);			! Store checksum into message
putb(.SUM<8,8>,PTR);
CCB[C_CNT] = ch$diff(.PTR,.CCB[C_ADDR]);! Calculate message length;
CCB[C_XPT_ALLOCATION] = .CCB[C_CNT];    !  also store it as buffer length
end;				!End of UPDFMT
global routine UPDTIM: CALL$ novalue =

!++
! FUNCTIONAL DESCRIPTION:
!
!  Processes calls from the Transport timer routine.
!  If the Update_clock has expired, sends a routing message
!  on each line with Srm set.
!
! FORMAL PARAMETERS
!
!	NONE.
!
! IMPLICIT INPUTS
!
!	Update_clock, Srm, UPDATEquota, NEXTline
!
! ROUTINE VALUE:
! COMPLETION CODES:
!
!	NONE.
!
! SIDE EFFECTS:
!
!	If Update_clock is expired, Update_clock is reset.
!	If a routing message is sent on a line, Srm is cleared for the line.
!
!--

begin
require 'XPTSYM';
label LINE_CHECKER;
local CCB,LIN;

LIN = .NEXTline;			! Start scan at end of last time's

    do
LINE_CHECKER:
        begin				!Scan each line
        local LINEb: ref LINEblock;
	LINEb = $XPT_GET_LINE_DB(.LIN); !  Address line data base entry

	if .LINEstate neq RU then leave LINE_CHECKER;

        if .Nty neq Full then leave LINE_CHECKER;

	if not .Srm then leave LINE_CHECKER;

        if .UPDATEquota eql 0 then exitloop;    !  If no congestion
                                        ! and
	if not $MCB_GET_CCB_AND_BUFFER (NN*2 + 5, CCB)  ! resource available,
        then exitloop;

        UPDATEquota = .UPDATEquota - 1; ! Update the Update quota
        UPDFMT(.LINEb,.CCB);            !    build the routing message
        _SNDBUF(.LINEb,.CCB);           !    and send it out
        Srm = false;
	end
    while
        begin
	LIN = .LIN + 1;			!  Try next line,
	if .LIN gtr NLN then LIN = 1;	!    wrapping around if necessary
        .LIN neq .NEXTline
        end;

NEXTline = .LIN;
end;				!End of UPDTIM

end				!End of module XPTUPD
eludom