Cells are metered on the input port side on a per connection basis. Four separate meters are provided which may be configured to mark (set CLP bit) or discard a cell. Additionally, cells may be marked (‘skewed') for potential discard at the transmit queue, depending on the current state of that queue.
The metering works on a ‘credit' system: credits are accumulated during idle (no cell) times and consumed each time a cell is sent into the switch fabric. Each connection is configured with a maximum number of credits and the number of credits spent each time a cell is sent. Each meter generates an ‘non-conforming' output if a cell arrives when there are insufficient credits remaining. These meter outputs may be logically combined in a series of masks to define the policy for cell discard, mark or skew.
Each meter has two parameters, normally defined when the connection is set up, and stored in the connection's control block (CCB). These parameters are the maximum number of credits (maxCredits) and the number of credits spent when a cell is transmitted (credits_per_cell).
A single global counter (globalTime) counts 1us increments. Each time a cell is sent on a connection, the current time is saved in the connection's CCB (last_credit_time) and the number of credits remaining (current_credits) is calculated.
The algorithm followed is as shown below:
new_current_credits = current_credits +(globalTime - last_credit_time)
if new_current_credits > maxCredits
new_current_credits = maxCredits
new_current_credits = new_current_credits - credits_per_cell
if new_current_credits >= 0
if new_currrent_credits < 0
cell not conforming
If the result of the policy is to send the cell, then:
current_credits = new_current_credits
last_credit_time = globalTime
Otherwise, if the cell is discarded, the values are unchanged. Note that ‘non-conforming' in this context does not necessarily mean the cell is marked or discarded - that depends on the policy defined by the masks, see below.
The two parameters maxCredits and credits_per_cell combine to form the ‘I' and ‘L' parameters for the GCRA algorithm. For instance, if maxCredits = 100 and credits_per_cell = 100 then any cells less than 100us apart would be non-conforming. The cell rate would be 10,000 cells/sec and delay tolerance would be zero. Specifying a larger maxCredits value permits limited ‘bursts' of cells.
The four meters are termed PIR01, PIR0, SIR01 and SIR0. These are intended for monitoring the peak (P) and sustainable (S) cell rates for the CLP=0 (PIR0, SIR0) and CLP=0/1 (PIR01, SIR01) flows. By default, the PIR/SIR0 meters monitor the CLP=0 flow and the PIR/SIR01 meters monitor the CLP=0/1 flow. The only difference in behaviour between the P and S meters lies in the parameters selected for them, since they work in the same way (but see below for special case of SIR01).
Otherwise, if the cell is discarded, the values are unchanged. Note that 'non-conforming' in this context does not necessarily mean the cell is marked or discarded - that depends on the policy defined by the masks, see below.
The SIR01 meter has an additional parameter, SIR01 ‘threshold'. This provides a second ‘maxCredits' value, enabling this meter to identify two levels of non-conformance.
The policing policy to be used for a connection is defined by the maxCredits and credits_per_cell values for PIR0, PIR01, SIR0 and SIR01, the threshold value for SIR01 and the UPC ‘masks'.
There is one mask each for ‘mark' (set CLP bit) and ‘skew' (modify output discard threshold, see switch output queue description) and two masks for ‘discard'. Each mask forms a logical ‘AND' of selected bits to determine whether to apply its policy. The bits available include the outputs from each meter (PIR01 etc and SIR01 threshold) plus the state of the CLP bit of the cell as it was received. The two masks for discard are logically ‘OR'ed together to determine whether to discard a cell.
As an example, you could program the masks so as to discard cells if PIR01 or SIR01 is not conformant, mark cells if PIR0 is not conformant and skew cells if the SIR01 threshold is exceeded and the CLP bit is set.
Relationship with Traffic Management Standards:
The maxCredits and credits_per_cell parameters define the bucket capacity and leak rate respectively for a standard leaky bucket. These relate to the GCRA(I,L) algorithm defined in the ATM Forum Traffic Management Specifications:
- maxCredits = bucket capacity = I+L
- credits_per_cell = bucket leak rate = I