# Patent

## Title
Multiple calendar schedule reservation structure and method

## Abstract

A machine-based method includes scheduling data units into respective time slots of reservation groups by representing the time slots in a base vector. The time slots of each of the reservation groups corresponds to a contiguous block in the base vector. Groups of time slots are represented in a higher-level vector having fewer elements than the base vector.

## Background
TECHNICAL FIELD
This description relates to computer networking, and more particularly to scheduling transmission of network cells.
BACKGROUND
In ATM networking, cells are transmitted over virtual connections. Virtual connections represent stateful communication setups such as an ATM virtual circuit or an Internet TCP connection. At each end of the network virtual connection is a software application that can send and receive messages. The messages are carried across the network as packets or frames that are further subdivided into 48 byte ATM cells. The interface in and out of the forwarding device is either 48 byte ATM cells or 64 byte frame segments. Each virtual connection has a quality of service or rate specification. ATM Forum Traffic Management Specification 4.1 specifies the types of rates, e.g. constant bit rate (CBR), variable bit rate (VBR), unspecified bit rate (UBR), etc. Unspecified bit rate can have a priority associated with the virtual connection.
Network devices such as routers, switches, and traffic shapers schedule the transmission of cells to a network. One form of schedule for transmission is the calendar schedule, where a slot of the schedule represents a period of time for possible transmission of one or more cells. A virtual connection is “scheduled” according to a calendar schedule if a slot in the calendar schedule is reserved for the virtual connection. A transmission process performs the transmissions of the network device. The transmission process uses the calendar schedule as a guide for when to offer transmission opportunities to scheduled virtual connections.
Groups of virtual connections may be scheduled for transmission to one region of a network, going through a network interface such as a port. A large traffic shaper may handle many schedules. For example, each schedule may be for a different port or network domain.



DESCRIPTION OF DRAWINGS
FIG. 1 is a block diagram of logical elements in a reservation system;
FIG. 2 is a block diagram of a router/traffic shaper;
FIG. 3A is a block diagram of a schedule repository;
FIG. 3B is a diagram of a recurrent transmission cycle;
FIG. 4 is a block diagram of a virtual connection repository;
FIG. 5A is a diagram of a hierarchical reservation vector;
FIG. 5B is a diagram of a branch of a hierarchical reservation vector;
FIG. 6 is a block diagram of a vector address;
FIG. 7 is a block diagram of a range for virtual connection transmission;
FIG. 8 is a block diagram of reservation procedures;
FIG. 9 is a flowchart of a shape procedure;
FIG. 10 is a flowchart of a schedule next slot procedure;
FIG. 11 is a flowchart of a recursive slot subroutine; and
FIG. 12 is a flowchart of a circular priority find procedure.



Like reference symbols in the various drawings indicate like elements.
DETAILED DESCRIPTION
In general, for a virtual connection associated with a schedule, a reservation system includes reservation procedures that find an available slot within the schedule. The reservation procedures find the available slot subject to timing requirements imposed by the rate of the virtual connection, when such requirements exists. The reservation system also includes a hierarchical reservation vector whose structure supports efficient lookups of first available slots by the reservation procedures. The reservation procedures are encoded as computing instructions that are executable by one or more automated processors.
Referring to FIG. 1, a reservation system 20 includes hierarchical reservation vector 22 and reservations procedures 24. Hierarchical reservation vector 22 is a data structure.
Reservation system 20 uses a schedule repository 26 that provides information on schedules 28, including the timing and boundaries of each such schedule 28.
Reservation system 20 also uses a virtual connection (or “VC”) repository 34. VC repository 34 provides information on virtual connections 36 whose transmission opportunities are governed by schedules 28 in schedule repository 26. VC repository 34 provides information including the rate and affiliated schedule 28 for each virtual connection 36.
Broadly, reservation system 20 manages transmission opportunities for virtual connections 36 according to multiple schedules 28. A transmission process 38 uses reservation system 20 to determine when to offer a transmission opportunity to a given virtual connection 36.
Reservation system 20, schedule repository 26, VC repository 34, and transmission process 38 are component software processes of routing/shaping software 30. In general, routing/shaping software 30 includes software processes that control the operation of a router/traffic shaper 40 (shown in FIG. 2).
The inner workings of transmission process 38 are beyond the scope of the description. Transmission process 38 is a software process that controls transmissions of network traffic by router/traffic shaper (to be discussed below).
Referring to FIG. 2, a router/traffic shaper 40 is a networking device. Router/traffic shaper 40 includes components such as main memory 42a, storage 42b, one or more processors 42c, network interface 42d, and bus 42e interconnecting components 42a-d. Main memory 42a and storage 42b store computing instructions and data readable by a processor 42c. Main memory 42a is random-access memory. Storage 42b is non-volatile storage such as a disk drive, programmable memory, writable media, or non-writable media. Processor 42c can access and transfer computing instructions, such as router/shaper software (Item 30, FIG. 1), between main memory 42a and storage 42b. Furthermore, processor 42c, which contains multiple registers 48, executes computing instructions of router/shaper software (Item 30, FIG. 1).
In the present embodiment, router/traffic shaper 40 is a networking device conforming to architecture standards for the Intel IXP series of network processors, manufactured by Intel Corporation, Santa Clara, Calif. In this case, processor 42c is an Intel IXP 1200, and registers 48 each hold 32 bits.
Network interface 42d includes physical ports 44a and 44b, which carry communication between network interface 42d and a network 46. Network interface 42d provides logical access to physical ports 44. Transmission process 38 controls transmissions of network traffic by router/traffic shaper 40 onto network 46.
In the Intel IXP1200 architecture, bit addressing is conventional, i.e., the least significant bit of a byte is rightmost. Byte addressing is little-endian, i.e., less significant bytes have lower addresses.
Referring now to FIG. 3A, schedule repository 26 is a source of information on schedules (Item 28, FIG. 1). Schedule repository 26 includes a schedule space 50, which is divided into 64K (i.e., two to the sixteenth power) slots 52. A slot 52 represents a unit of time for possible transmission of a cell. Slots 52 can be reserved for use by virtual connections (Item 36, FIG. 1) as will be described. Slots 52 are sequenced relative to one another in schedule space 50 according to a timing sequence 54. Schedule space 50 has a schedule space start 50a and a schedule space end 50b which correspond to its first and last slots 52, respectively.
Schedule space 50 includes one or more schedules 28a, 28b, 28c. There can be many hundreds of schedules 28a, 28b, 28c in schedule space 50. In general, a schedule 28a, 28b, 28c describes when to transmit cells to a network. The transmissions described by a schedule 28a, 28b, 28c can have local or remote origins, relative to router/traffic shaper (Item 40, FIG. 2). That is, a schedule 28a, 28b, 28c can govern the local behavior of the router/traffic shaper 40 in its capacity as a store-and-forward network device on network 46. Alternatively, a schedule 28a, 28b, 28c can govern transmissions in other devices or systems than router/traffic shaper (Item 40, FIG. 2). For instance, router/traffic shaper (Item 40, FIG. 2) could manage schedules 28a, 28b, 28c for other devices or systems accessible via network (Item 46, FIG. 2) each for a different port, network domain, or the like.
Each schedule 28a, 28b, 28c is encoded in schedule space 50 as a contiguous block of slots 52 in schedule space 50. Schedules 28a, 28b, 28c therefore represents a block of time that is divided into slots 52. Each schedule 28a, 28b, 28c has a schedule start 56 and a schedule end 58 which correspond to its first and last slots 52, respectively.
Referring now to FIG. 3B, schedule space (Item 50, FIG. 3a) describes a finite amount of time divided into schedule slots (Item 52, FIG. 3a). The amount corresponds to a transmission cycle 51 that repeats with a regular period in time. Typically, the transmission cycle describes a window of transmission choices made by a transmission process (Item 38, FIG. 1) of router/traffic shaper (Item 40, FIG. 2).
Periodic repetition maps the transmission cycle 51 forward in time. Repetition creates a correspondence between a finite amount of time (corresponding to a transmission cycle) and an arbitrarily large amount of time (corresponding to the future transmission choices of transmission process; item 38, FIG. 1). In particular, any future transmission choice corresponds to some unique iteration of the transmission cycle.
Furthermore, transmission cycle repeats with a regular period. The timing of events governed by schedule space (Item 50, FIG. 3a) is therefore predictable, at least until the configuration of schedule space (Item 50, FIG. 3a) changes.
Referring now to FIG. 4, VC repository 34 is a source of virtual connection information. VC repository 34 includes a VC schedule map 60 and collection of virtual connections 36.
A virtual connection 36 includes a type 36a and rate information 36b. Type 36a can adopt values consistent with ATM Forum Traffic Management Specification 4.1. For instance, acceptable values for type 36a include constant bit rate (CBR), variable bit rate (VBR), and unspecified bit rate (UBR).
In general, rate information 36b describes traffic parameters for virtual connection 36, such as for quality-of-service contracts or bandwidth allocations. Rate information 36b includes fields for PCR (“peak cell rate”) 62a and MBS (“maximum burst size”) 62b. PCR 62a describes a maximum data rate at which virtual connection 36 is specified to operate, measured as an average over time. MBS 62b describes the maximum number of sequential cells that can be sent at PCR 62a on virtual connection 36 instantaneously (or within a small window of instantaneously, relative to the measurement of PCR 62a).
Some types of rate information 36b depend on the value of type 36a. For example, virtual connections 36 with a VBR value for type 36a include a field for sustained cell rate (SCR) 62c. SCR 62c describes a minimum data rate at which virtual connection 36 is specified to operate, measured as an average over time. Alternatively, a virtual connection 36 with a non-VBR value for type 36a can include a minimum cell rate (MCR) 62d. A third possibility is a UBR virtual connection 36 that has a zero-valued MCR 62d, indicating that there is no minimum rate associated with them.
VC schedule map 60 associates virtual connections 36 with schedules 28.
Broadly speaking, a hierarchical reservation vector (to be discussed below) is a data structure that tracks whether slots (Item 52, FIG. 3a) in schedule space (Item 50, FIG. 3a) are reserved, i.e., have transmission commitments to a virtual connection 36.
Referring now to FIGS. 5A & 5B, a hierarchical reservation vector 22 includes a first level 22a, a second level 22b, and a third level 22c. In the present embodiment, third level 22c includes a left longword 70a and a right longword 70b. Hierarchical reservation vector 22 also features a time direction 22d, which organizes first level slots 72 into a sequence corresponding to their relative positions in time within the transmission cycle of schedule space.
First level 22a is a bit vector organized to correspond to schedule space 50. First level 22a includes first level slots 72, each of which is encoded as a bit that uniquely corresponds to a schedule space slot 52 in schedule space 50. First level 22a has as many first level slots 72 as there are schedule space slots 52 in schedule space 50—in this case, 64K. Time direction 22d is an ordering of first level slots 72 that corresponds to timing sequence (Item 54, FIG. 3).
In the present embodiment, time direction 22d simply uses the ordering given by bit addressing in main memory (Item 42a, FIG. 2). Thus, schedule space slots 52 and collections of schedule space slots 52 have corresponding locations in first level 22a. In particular, a given schedule 28 in schedule space 50 corresponds to a schedule image 74 in first level 22a. In this way, schedules 28 are encoded as variable-size arrays (schedule images 74) within hierarchical reservation vector 22.
Second level 22b is a bit vector organized to correspond to first level 22a according to a scaling factor 78. The scaling factor 78 is the number of bits in first level 22a that are represented (or “shadowed”) by a single bit in second level 22b. The scaling factor 78 is constant throughout hierarchical reservation vector 22. In the present embodiment, the scaling factor 78 has the value thirty-two. In FIG. 5A, for visual simplicity and clarity, scaling factor 78 is drawn such that the scaling factor 78 is four. The value of thirty-two for scaling factor 78 is based on the word size of processor (Item 42c, FIG. 1), i.e., the number of bits that can fit in register (Item 48, FIG. 2). Each bit in second level 22b corresponds to a full word in first level 22a. Conversely, every bit in first level 22a has one bit in second level 22b that shadows it.
Scaling factor 78 determines the size of second level 22b relative to the size of first level 22a. Because first level 22a has 64K members, second level 22b has 2K (i.e., 2048) members.
Third level 22c relates to second level 22b in much the same way that second level 22b relates to first level 22a. Each bit in third level 22c corresponds to a full word in second level 22b, as determined by scaling factor 78. Because first level 22a has 2048 members, therefore, second level 22b has 64 members. The first half of these is shadowed by left longword 70a, while the second half is shadowed by right longword 70b. 
Reservations are represented in hierarchical reservation vector 22 as follows. A bit off in first level 22a (i.e., a value of a slot 72) indicates the corresponding slot 52 is reserved. A bit off in second level 22b indicates all of the bits it shadows are off in the next lower level, i.e., all of the corresponding first level slots 72 are reserved. Therefore, a bit on at second level 22b indicates at least one of its shadowed first level slots 72 is available. Similarly, a bit off at third level 22c indicates all of the bits it shadows are off in lower levels, i.e., 1024 first level slots 72 are reserved. A bit on at third level 22c indicates at least one of the 1024 first level slots 72 it represents is available.
Referring now to FIG. 6, a vector address 80 is a 16-bit unsigned binary integer that describes hierarchical reservation vector 22. Vector address 80 describes a bit position of a first level slot 72 within first level 22a. Vector address 80 also describes bit positions of shadowing bits in second level 22b and third level 22c. 
The bits of vector address 80 are numbered sequentially from least significant to most significant. Thus, the least significant bit of vector address 80 is numbered zero, and the most significant bit is numbered fifteen.
Vector address 80 is organized into portions that yield offsets 82a, 82b, 82c into levels of hierarchical reservation vector 22, when the portions are evaluated as unsigned binary integers. For example, treated as a 16-bit unsigned binary integer, the entire vector address 80 is an offset into the 64K bits of first level 22a, shown as first level offset 80a. Conversely, every first level slot 72 has a unique value, representing its offset position in first level 22a, that can be represented as a vector address 80.
Vector address 80 includes a second-level sub-address 80b, stored in bits five through fifteen of vector address 80. Note that the scaling factor (Item 78, FIG. 5a) is such that first level slots 72 are grouped together in groups of thirty-two. Also note that for a given 11-bit prefix on a 16-bit unsigned binary integer (that is, for fixed values of bits five through fifteen) there are precisely thirty-two such integers that have that prefix. (A prefix of length N is the N most significant bits.) Further note that 11 bits is precisely the number of bits necessary to address the 2048 members of second level 22b. Vector address 80 takes advantage of these inherent properties of unsigned binary integers to use bits five through fifteen as second-level sub-address 80b, describing an offset 82b into second level 22b. In particular, for a given first level slot 72 having a vector address 80, the offset of its corresponding shadowing bit in second level 22b is given by second-level sub-address 80b. 
Vector address 80 includes a third-level sub-address group 84, stored in the six bits numbered ten through fifteen of vector address 80. Third-level sub-address group 84 is divided into a branch sub-address 80d and a third-level sub-address 80c. Note that the six bits of third-level sub-address group 84 use several of the same principles of unsigned binary integers that define the value of second-level sub-address 80b. A given 6-bit prefix of a 16-bit value is held in common by a group of 1024 distinct values, which is a size that corresponds exactly to the shadowing of 1024 first level slots 72 as already described. Furthermore, the 6-bit prefix also corresponds to a shadowed group when considered only as the prefix of the 11-bit second-level sub-address 80b. That is, a given 6-bit prefix is held in common by a group of 32 distinct 11-bit values. Thus, third-level sub-address group 84 could be used as an offset into third level 22c, but this is not how vector address 80 is structured in the present embodiment. Instead, third level 22c is divided into two 32-bit arrays, namely, left longword 70a and right longword 70b. Bit fifteen of vector address 80 is used to specify the branch to use, while bits ten through fourteen are used as an offset into the particular array. An advantage of this branched approach is that each of left longword 70a and right longword 70b can be placed entirely in register 48 of the processor (Item 42c, FIG. 2). The fact that an entire array (or a significant portion of one) can be stored in register 48 or processed in native operations of processor 42c is beneficial to certain manipulations of hierarchical reservation vector 22. For instance, it is useful if the processor (Item 42c, FIG. 2) supports finding the first set bit in a 32-bit array, as will be explained in regards to circular priority find procedure (to be explained below). Thus, for sufficiently small lengths of bit arrays in hierarchical reservation vector 22, addressing the arrays via the branching approach used for third-level sub-address 80c may have advantages over the non-branched approach used for second-level sub-address 80b. 
Referring now to FIG. 7, a range 91′, 91′′ associates a virtual connection (Item 36, FIG. 4) with a schedule image 74′, 74′′ in the hierarchical reservation vector (Item 22, FIG. 6). Therefore, a range (e.g., 91′) can describe a period of time in which a reservation can be made for the virtual connection (Item 36, FIG. 4) that would satisfy both the traffic parameters of the virtual connection (Item 36, FIG. 4) and the time constraints of a schedule image (e.g., 74′).
For example, range 91′ includes a could-send reference 91a′ and a must-send reference 91b′. Together, could-send reference 91a′ and a must-send reference 91b′ specify one or more contiguous blocks of first level slots (Item 72, FIG. 6) in hierarchical reservation vector (Item 22, FIG. 6), such that the blocks occur within the boundaries of the schedule image 74′.
Could-send reference 91a′ specifies a could-sent slot 74a′, while must-send reference 91b specifies a must-send slot 74b′. The relative position of could-sent slot 74a′ and must-send slot 74b′ in schedule image 74′ determines at least two possible values for a range topology 91c′. When could-sent slot 74a′ occurs before must-send slot 74b′ with regards to time direction (Item 22d, FIG. 5a) of hierarchical reservation vector (Item 22, FIG. 5a), topology 91c, has a contiguous range 100.
Alternatively, for example, when could-sent slot 74a′′ occurs after must-send slot 74b′′, topology 91c′′ has a wrapped range 102.
In schedule image 74′, contiguous range 100 is a contiguous block of slots, which begins with could-send slot 74a′ and ends with must-send slot 74b′. 
For schedule image 74′′, wrapped range 102 includes a high component 102b and a low component 102a, each of which is a contiguous block of slots in schedule image 74′′. Low component 102a begins with could-send slot 74a′′ and ends with the last slot of schedule image 74′′. Low component 102a represents an earlier time than high component 102b, due to the wrap. High component 102b begins with the first slot of schedule image 74′′ and ends with must-send slot 74b′′. Conceptually, wrapped range 102 begins with could-send slot 74a′′, continues uninterrupted to the last slot of schedule image 74′′, wraps to the first slot of schedule image 74′′, and ends with must-send slot 74b′′. This conceptual wrapping of wrapped range 102 reflects the cyclical structure of schedules (Item 28, FIG. 1) and their corresponding schedule images (e.g., 74).
Reservation system 20 includes reservation procedures 24 (to be discussed below). Broadly speaking, reservation procedures maintain and inspect schedule information stored in hierarchical reservation vector (Item 22, FIG. 6). For instance, various reservation procedures set, clear, and detect slot reservations in the schedule space (Item 50, FIG. 3a) as it is represented in hierarchical reservation vector (Item 22, FIG. 6).
Referring now to FIG. 8, reservation procedures 24 include a shape procedure 90, a schedule next slot procedure 92, a circular priority find procedure 94, a zeroes-compensation procedure 98, a schedule bit set procedure 96, and a schedule bit clear procedure 97.
Broadly, shape procedure 90 determines a range (e.g., range 91′′, FIG. 7) for a given virtual connection (Item 36, FIG. 1) associated with a schedule (Item 28, FIG. 1). Given a virtual connection (Item 36, FIG. 1) having traffic parameters, shape procedure 90 calculates a could-send time, which is the earliest time the next cell can be sent according to the traffic parameters. Shape procedure 90 also calculates a must-send time, which is the latest time the next cell can be sent according to the traffic parameters. Shape procedure 90 correlates these times to slots (Item 72, FIG. 6) in the hierarchical reservation vector (Item 22, FIG. 6).
Referring now to FIG. 9, shape procedure 90 receives as input a virtual connection and a base slot index (i.e., process 90a). Virtual connection is associated with a schedule, in that schedule has a schedule image in hierarchical reservation vector. The base slot index references a first-level slot that corresponds to current absolute time, i.e., the time at which the shape procedure 90 is executing.
Shape procedure 90 examines the rate of virtual connection to determine a maximum permissible current transmission speed, then expresses this speed as a could-send offset (i.e., process 90b). The could-send offset is a count of first-level slots. Maximum permissible current transmission speed is calculated based on the current state of virtual connection and its traffic parameters. Generally, the maximum permissible current transmission speed is the lesser of an overall maximum, given by PCR, and a situational maximum based on burst size, given by MBS.
Shape procedure 90 tests whether the could-send offset added to the base slot index yields a slot before the end of the current schedule (i.e., process 90c). If the test is positive, shape procedure 90 designates that slot as the could-send slot (i.e., process 90d). If the test is negative, shape procedure wraps the offset to the corresponding slot within schedule (i.e., process 90e), then designates the wrapped slot as the could-send slot (i.e., process 90d).
Shape procedure 90 also examines the rate of virtual connection to determine a minimum permissible current transmission speed, expressing this speed as a must-send offset (i.e., process 90f). The must-send offset is a count of first-level slots. Minimum permissible current transmission speed is calculated based on the type and traffic parameters of virtual connection. For instance, for a VBR virtual connection, the calculation uses SCR (Item 62c, FIG. 4). Alternatively, for a non-VBR virtual connection (Item 36a, FIG. 1) that has a minimum, the calculation uses MCR (Item 62d, FIG. 1).
Shape procedure 90 then tests whether the must-send offset added to the base slot index yields a slot before the end of the current schedule (i.e., process 90g). If the test is positive, shape procedure 90 designates that slot as the must-send slot (i.e., process 90h). If the test is negative, shape procedure 90 wraps the offset to the corresponding slot within schedule and designates the wrapped slot as the must-send slot (i.e., process 90i).
Broadly speaking, unless schedule next slot procedure encounters a failure condition, as will be explained, schedule next slot procedure starts at the highest level of hierarchical reservation vector and repeatedly applies circular priority find procedure at each successive level, until reaching first level and finding a first level slot. The slot, if found, is the first available slot within a given range.
Referring now to FIG. 10, schedule next slot procedure 92 first determines which branch (e.g., items 70a and 70b, FIG. 5a) of hierarchical reservation vector (Item 22, FIG. 6) is appropriate to the could-send reference (i.e., procedure 92a). Schedule next slot procedure inspects branch sub-address of the could-send reference, which is a vector address. For example, in the described embodiment, where branch sub-address can be stored in one bit, schedule next slot procedure 92 determines the branch by testing the bit of branch sub-address. If the bit is on, schedule next slot procedure 92 selects the left longword 70a. Otherwise, schedule next slot procedure 92 selects the right longword 70b. 
Schedule next slot procedure 92 then invokes recursive slot subroutine (i.e., procedure 92b). Generally, starting from an arbitrary location within a branch, recursive slot subroutine either finds a first available slot subject to a range and a schedule image, or returns a failure result (e.g., if no such slot is available). Schedule next slot procedure 92 provides recursive slot subroutine with the range that schedule next slot procedure received as inputs, and also provides the top level of the branch and a zero offset into that branch.
Schedule next slot procedure 92 next tests the output of recursive slot subroutine (i.e., procedure 92c). If the recursive slot subroutine returns a slot, schedule next slot procedure 92 returns that slot as a result value (i.e., procedure 92d). Otherwise, schedule next slot procedure 92 tests whether the given range spans a subsequent branch (i.e., procedure 92e). If such a spanning exists, schedule next slot procedure 92 loops back to select the next branch, according to the ordering given by time direction and the range topology (i.e., procedure 92a). Thus, schedule next slot procedure 92 continues evaluating branches according to the ordering given by time direction until either the entirety of range has been searched, or an available slot has been found. For a range topology having a contiguous range, the ordering of branches is that given by time direction over contiguous range. For a range topology having a wrapped range however, the ordering of branches has two parts: that given by time direction over high component, followed by the same ordering over low component.
If the test of procedure is negative, schedule next slot procedure 92 returns a result indicating failure (i.e., procedure 92f).
Referring now to FIG. 11, recursive slot subroutine 93 takes as input a range, a schedule image, a level of hierarchical reservation vector, and an offset within that level. The offset specifies a unique longword within the given level. Recursive slot subroutine returns a first available slot after the starting point and within the range, or a failure result.
Recursive slot subroutine 93 invokes a primary instance of circular priority find (Item 94, FIG. 8) on the longword specified by the offset (i.e., process 93a). As will be explained, circular priority find (Item 94, FIG. 8) returns a first set bit within a longword. This discussion will refer to that bit as the “primary bit”. If the level given to recursive slot subroutine 93 is first level, the primary bit represents a slot that is available to be allocated. For higher levels such as second level and above, the primary bit shadows a block of slots, at least one of which is available to be allocated. Moreover, since bits of the longword are ordered according to time direction, the primary bit typically represents a first available allocation opportunity. An exception to this general rule occurs for degenerate cases, as will be explained.
Recursive slot subroutine 93 next invokes a secondary instance of circular priority find on the portion of the longword, if any, that follows the bit position returned by the primary instance of circular priority find (i.e., process 93b). The bit returned by the secondary instance of circular priority find, if any, represents a next available allocation opportunity, subsequent to the first. This discussion will refer to that bit as the “secondary bit”. Process 93b also sets a “fallback flag” to a true/false value, initially indicating whether the secondary bit is available as a fallback alternative to the primary bit.
Recursive slot subroutine 93 tests the result of the primary instance of circular priority find (i.e., process 93c). If the primary bit was successfully found, recursive slot subroutine 93 uses the primary bit as a working bit (i.e., process 93d). The working bit is a candidate for the bit that recursive slot subroutine 93 will return. Otherwise, if a primary bit was not found, recursive slot subroutine 93 tests the fallback flag (i.e., process 93e). If the fallback flag is true, recursive slot subroutine 93 uses the secondary bit as the working bit and sets the fallback flag value to false (i.e., process 93f).
If the fallback flag is false, recursive slot subroutine 93 returns a failure result (i.e., process 93g).
Following a selection of the working bit, recursive slot subroutine 93 tests whether the current level of hierarchical reservation vector is the first level (i.e., process 93h). If the current level is the first level, recursive slot subroutine returns the working bit as a result value representing a slot (i.e., process 93k). Otherwise, if the current level is not the first level, an opportunity exists to recurse from the current level to a next level, toward first level, such that the next level includes a longword shadowed by the working bit. If such a next level exists, recursive slot subroutine 93 begins processing the next level at the longword shadowed by the working bit, using the same range as was passed to recursive slot subroutine 93 (i.e., process 93i). For example, a current instance of recursive slot subroutine 93 can pass control to a dependent instance of recursive slot subroutine 93, where the dependent instance executes to completion before returning control to the current instance. In general, unless failure conditions occur, this pattern of recursive control-passing repeats until recursive slot subroutine 93 processes a longword at first level. The number of repetitions is therefore bounded by the number of levels between first level and the level passed to the top-level instance of recursive slot subroutine 93.
Process 93i can return a problem result, comparable to that returned by recursive slot subroutine 93 itself. In the absence of a problem result, however, process 93i continues a recursive chain that eventually reaches first level. Thus, if process 93i returns a bit, that bit represents a first-level slot.
Recursive slot subroutine 93 tests the result of process 93i via process 93m. If a problem result is found, recursive slot subroutine 93 goes to process 93e to test the fallback flag and proceeds from there as already described. Otherwise, if no problem result is found, recursive slot subroutine 93 uses the bit returned by process 93i as the working bit (i.e., process 93n). Recursive slot subroutine 93 then returns the working bit as a result value representing a slot (i.e., process 93k).
Circular priority find procedure (Item 94, FIG. 8) takes as inputs a range and a longword of hierarchical reservation vector. Circular priority find procedure (Item 94, FIG. 8) returns a first set bit, or an error if no first set bit exists. In the present embodiment, the first set bit is the least significant bit which is not off and which is in the intersection of the longword and the range.
Referring now to FIG. 12, circular priority find procedure 94 tests whether the given range has a could-send reference which is less than its must-send reference (i.e., process 94a). This is equivalent to testing whether the given range has a contiguous range topology. If the range is contiguous, circular priority find procedure 94 creates a contiguous mask (i.e., process 94b). Contiguous mask is a bit mask that selects for bits of the longword that correspond to the range topology of range, using exclusive-or (“XOR”) bit operations. Contiguous mask is a longword. Thus, there is a one-to-one correspondence between contiguous mask and the longword passed as input to circular priority find procedure 94. A bit in contiguous mask is on if the corresponding slot in hierarchical reservation vector is covered by the range topology of range.
Next, circular priority find procedure 94 applies contiguous mask to the longword and finds the first set bit in the result (i.e., process 94c). In the present embodiment, circular priority find procedure 94 can take advantage of a hardware-supported processor operation of processor to find the first set bit in a longword. Circular priority find procedure 94 returns the resulting bit or indicates that no such bit exists. This can happen, for instance, if all bits in the intersection of the range 91 and the given longword represent slots that are already allocated.
When the range 91 is not contiguous, circular priority find procedure 94 creates a low mask and a high mask (i.e., process 94d). In this case, range topology has a wrapped range. Low mask is a mask that selects bits of the input longword that correspond to the low component of wrapped range. Similarly, high mask is a mask that selects bits of the input longword that correspond to the high component of wrapped range.
Next, circular priority find procedure 94 applies low mask to the input longword and finds the first set bit in the result (i.e., process 94e). Circular priority find procedure 94 then determines whether process 94e found a set bit (i.e., process 94f). If so, circular priority find procedure 94 returns the resulting bit. Otherwise, circular priority find procedure 94 applies high mask to the input longword and finds the first set bit in that result (i.e., process 94g). Circular priority find procedure 94 returns the resulting bit or indicates that no such bit exists.
One advantage of reservation system applies to lookups of the first available time slot in a contiguous range of time slots—for instance, by the schedule next slot procedure. The hierarchy encoded in hierarchical reservation vector allows lookups to take advantage of register-based processor operations. This reduces the number of memory accesses needed to accomplish the lookup, relative to approaches that use processor operations that cannot be accomplished within the registers.
For example, a three-level hierarchical reservation vector keeps reservations for multiple calendars over 64K time slots. A processor provides 32-bit memory accesses and a 32-bit circular find first bit set. The hierarchical reservation vector keeps its top level (level 3) in two local registers as 64-bits. The reservation system can perform a search over the 64K time slots in four operations. One memory reference and a circular find first bit set reduces the candidates to 2048 time slots, while a second memory reference and another circular find first bit set to reduce the candidates to one.
In another advantage, the reservation system also supports circular lookups, i.e. lookups within a schedule where the range of possible values wraps around the end of the schedule and continues from the beginning of the schedule.
Still another advantage of the hierarchical reservation vector is a relatively small footprint in memory for its representation of the schedule space.
A number of embodiments have been described. Nevertheless, it will be understood that various modifications may be made without departing from the spirit and scope of the description.
In the described embodiment, schedule repository and VC repository are component software processes of routing/shaping software. In other embodiments, schedule repository or VC repository (or both) could be applications or services external to routing/shaping software. Indeed, schedule repository or VC repository (or both) could be external to router/traffic shaper—for instance, they could remote software in communication with routing/shaping software via network. In other embodiments, slots can be reserved to entities other than virtual connections.
The details of one or more embodiments are set forth in the accompanying drawings and the description below. Other features, objects, and advantages will be apparent from the description and drawings, and from the claims. Accordingly, other embodiments are within the scope of the following claims.

## Claims

1. A computer-based method, comprising:
scheduling data units for transmission within a time interval corresponding to one or more of a plurality of time slots represented by elements in a first-level vector, the time slots of the interval corresponding to selected elements of a contiguous block of elements in the first-level vector;
representing groups of elements in the first-level vector by respective elements in a second-level vector having fewer elements than the first-level vector, with the quantity of elements included in the first-level vector being equal to the quantity of elements included in the second-level vector, scaled by a scaling factor; and
representing groups of the groups of elements in a third-level vector having fewer elements than the second-level vector.

2. The method of claim 1, wherein the first-level vector includes a bit for each time slot in the plurality of time slots.

3. The method of claim 1, wherein positions in the first-level vector are ordered according to the sequence in time of the time slots.

4. The method of claim 1, wherein positions in the second-level vector are ordered according to the sequence of the corresponding groups of elements in the first-level vector.

5. A traffic shaping method, comprising:
scheduling data units for transmission within a time interval represented by one or of a plurality of time slots, the time slots of the interval corresponding to selected time slots of a contiguous block of time slots; and
representing the time slots in one or more hierarchical reservation vectors, the one or more hierarchical reservation vectors including;
a first-level vector including one or more bits that each represent one time slot; and
a second-level vector including one or more bits that each represent a group of time slots represented in the first-level vector

wherein the one or more hierarchical reservation vectors further include a third-level vector including one or more bits that each represent a plurality of the groups of time slots represented in the second-level vector.

6. The method of claim 5 wherein the quantity of bits included in the first-level vector is equal to the quantity of bits included in the second-level vector, scaled by a first bit-scaling factor.

7. The method of claim 6 wherein the quantity of bits included in the second-level vector is equal to the quantity of bits included in the third-level vector, scaled by a second bit-scaling factor.

8. The method of claim 7 wherein the first bit-scaling factor and the second bit-scaling factor are equal.

9. The method of claim 8 wherein the first scaling factor is thirty-two, the second scaling factor is thirty-two, the second-level vector includes two-thousand-forty-eight bits, and the third-level vector includes sixty-four bits.

10. The method of claim 9 wherein the first-level vector includes sixty-four kilobits.

11. The method of claim 9 wherein the third-level vector is divided into a first thirty-two bit array and a second thirty-two bit array.

12. The method of claim 11 further comprising:
storing the first thirty-two bit array in a first local register; and
storing the second thirty-two bit array in a second local register.

13. The method of claim 5 wherein each bit in the second-level vector is indicative of the availability of one or more time slots within the group represented by that bit.

14. The method of claim 13 wherein each bit in the third-level vector is indicative of the availability of one or more time slots within the plurality of groups represented by that bit.

15. The method of claim 14 wherein scheduling data units comprises:
identifying, within the third-level vector, a select plurality of groups having an available time slot;
identifying, within the second-level vector, a select group of time slots, as chosen from the select plurality of groups, that includes the available time slot; and
identifying, within the first-level vector, the available time slot, as chosen from the select group of time slots.

16. The method of claim 5 further comprising receiving one or more schedules that provide information including timing and boundaries.

17. The method of claim 16 wherein the schedules have a remote origin relative to the traffic shaper.

18. The method of claim 5 further comprising receiving available slot information from a virtual connection repository.

19. The method of claim 18 wherein the slot information includes a type parameter and a rate parameter.

20. The method of claim 19 wherein the type parameter include a bit rate control parameter.

21. The method of claim 19 wherein the rate parameter includes a quality parameter and a bandwidth parameter.

22. The method of claim 5, wherein the time slots are processed in the order in which the time slots become available.

23. The method of claim 5, wherein the plurality of time slots correspond to a transmission cycle that repeats.

24. The method of claim 23, further comprising:
calculating a could-send time based on a maximum data transfer rate; and
designating a first available time slot as a could-send time slot.

25. The method of claim 24, further comprising:
calculating a must-send time based on a minimum data transfer rate; and
designating a second available time slot as a must-send time slot.

26. The method of claim 25, further comprising reserving a range of time slots corresponding to a range of bits within a block of bits, the range of bits occurring between a bit representing the must-send time slot and a bit representing the could-send time slot, if it is determined that the range of bits is contiguous within the block when representing the must-send time slot as chronologically after the could-send time slot.

27. The method of claim 25, further comprising reserving:
a first range of time slots corresponding to a first range of bits within a block of bits, the first range of bits occurring between a bit representing a first end time slot represented in the block and a bit representing the must-send time slot; and
a second range of time slots corresponding to a second range of bits within the block, the second range of bits occurring between a bit representing the could-send time slot and a bit representing a second end time slot represented in the block,
if it is determined that the range of bits wraps around between the bit representing the first end time slot and the bit representing the second end time slot when representing the must-send time slot as chronologically after the could-send time slot.

28. A computer-readable medium embodied with a computer program to perform a method of storing executable instructions for traffic shaping, comprising:
schedule data units for transmission within a time interval represented by one or more of a plurality of time slots, the time slots of the interval corresponding to selected time slots of a contiguous block of time slots; and
represent the time slots in one or more hierarchical reservation vectors, the one or more hierarchical reservation vectors including:
a first-level vector including one or more bits that each represent one time slot; and
a second-level vector including one or more bits that each represent a group of time slots represented in the first-level vector;

wherein the one or more hierarchical reservation vectors further includes a third-level vector including one or more bits that each represent a plurality of the groups of time slots represented in the second-level vector.

29. The computer-readable medium of claim 28, wherein the quantity of bits included in the first-level vector is equal to the quantity of bits included in the second-level vector, scaled by a first bit-scaling factor and the quantity of bits included in the second-level vector is equal to the quantity of bits included in the third-level vector, scaled by a second bit-scaling factor.

30. The computer-readable medium of claim 29, wherein the first and second scaling factors are thirty-two, the first-level vector includes sixty-four kilobits, the second-level vector includes two-thousand-forty-eight bits, the third-level vector includes sixty-four bits, and the third-level vector is divided into a first thirty-two bit array and a second thirty-two bit array and; further comprising instructions for causing a computer to store the first thirty-two bit array in a first local register and store a second thirty-two bit array in a second local register.

31. The computer-readable medium of claim 29, wherein each bit in the second-level vector is indicative of the availability of one or more time slots within the group represented by that bit and each bit in the third-level vector is indicative of the availability of one or more time slots within the plurality of groups represented by that bit.

32. The computer-readable medium of claim 31, wherein the instructions to schedule data units further comprises instruction for causing a computer to:
identify, within the third-level vector, a select plurality of groups having an available time slot;
identify, within the second-level vector, a select group of time slots, as chosen from the select plurality of groups, that includes the available time slot; and
identify, within the first-level vector, the available time slot, as chosen from the select group of time slots.

33. The computer-readable medium of claim 31, further comprising instruction to cause a computer to:
receive one or more schedules that provide information including timing and boundaries,
receive available slot information including a type parameter and rate parameter from a virtual connection repository.

34. The computer-readable medium of claim 28, wherein the plurality of time slots correspond to a transmission cycle that repeats.

35. The computer-readable medium of claim 34, further comprising instruction to cause a computer to:
calculate a could-send time based on a maximum data transfer rate; and designating a first available time slot as a could-send time slot and
calculate a must-send time based on a minimum data transfer rate; and designating a second available time slot as a must-send time slot.

36. The computer-readable medium of claim 35, further comprising instruction to cause a computer to:
reserve a range of time slots corresponding to a range of bits within a block of bits, the range of bits occurring between a bit representing the must-send time slot and a bit representing the could-send time slot, if it is determined that the range of bits is contiguous within the block when representing the must-send time slot as chronologically after the could-send time slot.

37. The computer-readable medium of claim 35, further comprising instruction to cause a computer to:
reserve a first range of time slots corresponding to a first range of bits within a block of bits, the first range of bits occurring between a bit representing a first end time slot represented in the block and a bit representing the must-send time slot; and a second range of time slots corresponding to a second range of bits within the block, the second range of bits occurring between a bit representing the could-send time slot and a bit representing a second end time slot represented in the block, if it is determined that the range of bits wraps around between the bit representing the first end time slot and the bit representing the second end time slot when representing the must-send time slot as chronologically after the could-send time slot.

38. A router system, comprising
circuitry configured to schedule data units for transmission within a time interval represented by one or more of a plurality of time slots, the time slots of the interval corresponding to selected time slots of a contiguous block of time slots; and
circuitry configured to represent the time slots in one or more hierarchical reservation vectors, the one or more hierarchical reservation vectors including:
a first-level vector including one or more bits that each represent one time slot; and
a second-level vector including one or more bits that each represent a group of time slots represented in the first-level vector;

wherein the one or more hierarchical reservation vectors further include a third-level vector including one or more bits that each represent a plurality of the groups of time slots represented in the second-level vector.

39. The router system of claim 38, wherein the quantity of bits included in the first-level vector is equal to the quantity of bits included in the second-level vector, scaled by a first bit-scaling factor and the quantity of bits included in the second-level vector is equal to the quantity of bits included in the third-level vector, scaled by a second bit-scaling factor.

40. The router system of claim 39, wherein the first and second bit-scaling factors are thirty-two, the first-level vector includes sixty-four kilobits, the second-level vector includes two-thousand-forty-eight bits, the third-level vector includes sixty-four bits, and the third-level vector is divided into a first thirty-two bit array and a second thirty-two bit array and; further comprising storing the first thirty-two bit array in a first local register and storing the second thirty-two bit array in a second local register.

41. The router system of claim 40, further comprising circuitry configured to:
receive one or more schedules that provide information including timing and boundaries, and
receive available slot information including a type parameter and a rate parameter from a virtual connection repository.

42. The router system of claim 39, wherein each bit in the second-level vector is indicative of the availability of one or more time slots within the group represented by that bit and each bit in the third-level vector is indicative of the availability of one or more time slots within the plurality of groups represented by that bit.

43. The router system of claim 42, wherein scheduling data units comprises:
identifying, within the third-level vector, a select plurality of groups having an available time slot;
identifying, within the second-level vector, a select group of time slots, as chosen from the select plurality of groups, that includes the available time slot; and
identifying, within the first-level vector, the available time slot, as chosen from the select group of time slots.

44. The router system of claim 38, wherein the plurality of time slots correspond to a transmission cycle that repeats.

45. The router system of claim 44, further comprising circuitry configured to:
calculate a could-send time based on a maximum data transfer rate; and designating a first available time slot as a could-send time slot and
calculate a must-send time based on a minimum data transfer rate; and designating a second available time slot as a must-send time slot.

46. The router system of claim 45, further comprising circuitry configured to:
reserve a range of time slots corresponding to a range of bits within a block of bits, the range of bits occurring between a bit representing the must-send time slot and a bit representing the could-send time slot, if it is determined that the range of bits is contiguous within the block when representing the must-send time slot as chronologically after the could-send time slot.

47. The router system of claim 45, further comprising circuitry configured to:
reserve a first range of time slots corresponding to a first range of bits within a block of bits, the first range of bits occurring between a bit representing a first end time slot represented in the block and a bit representing the must-send time slot; and a second range of time slots corresponding to a second range of bits within the block, the second range of bits occurring between a bit representing the could-send time slot and a bit representing a second end time slot represented in the block, if it is determined that the range of bits wraps around between the bit representing the first end time slot and the bit representing the second end time slot when representing the must-send time slot as chronologically after the could-send time slot.

48. A router system within a network of computers, comprising
circuitry configured to schedule data units received from the network of computers for transmission within a time interval represented by one or more of a plurality of time slots;
circuitry configured to represent the time slots in one or more hierarchical reservation vectors, the one or more hierarchical reservation vectors including:
a first-level vector including one or more bits that each represent one time slot wherein the plurality of time slots correspond to a transmission cycle that repeats;
a second-level vector including one or more bits that each represent a group of time slots represented in the first-level vector;
a third-level vector including one or more bits that each represent a plurality of the groups of time slots represented in the second-level vector; and

circuitry configured to:
identify, within the third-level vector, a select plurality of groups having an available time slot;
identify, within the second-level vector, a select group of time slots, as chosen from the select plurality of groups, that includes the available time slot;
identify, within the first-level vector, the available time slot, as chosen from the select group of time slots;
calculate a could-send time based on a maximum data transfer rate, and designate a first available time slot as a could-send time slot;
calculate a must-send time based on a minimum data transfer rate, and designate a second available time slot as a must-send time slot;
reserve a range of time slots corresponding to a range of bits within a block of bits, the range of bits occurring between a bit representing the must-send time slot and a bit representing the could-send time slot, if it is determined that the range of bits is contiguous within the block when representing the must-send time slot as chronologically after the could-send time slot; and
reserve a first range of time slots corresponding to a first range of bits within a block of bits, the first range of bits occurring between a bit representing a first end time slot represented in the block and a bit representing the must-send time slot; and a second range of time slots corresponding to a second range of bits within the block, the second range of bits occurring between a bit representing the could-send time slot and a bit representing a second end time slot represented in the block, if it is determined that the range of bits wraps around between the bit representing the first end time slot and the bit representing the second end time slot when representing the must-send time slot as chronologically after the could-send time slot.