Watermark interrupt – Maxim Integrated 78Q8430 Software Driver User Manual
Page 29

UG_8430_004
78Q8430 Software Driver Development Guidelines
Rev. 1.0
29
STEP 3: Set the value of the PAUSE field in the WMVR value.
This can be done with the use of a bit-wise OR operator. The desired watermark value needs to be
shifted to make it line up with the position of the PAUSE field in the WMVR value.
STEP 4: Write the new value to WMVR.
5.3.3 Watermark
Interrupt
The watermark interrupt is a key part of 78Q8430 memory management. Proper setting and servicing of
the watermark interrupt helps to ensure smooth Ethernet operation under the most severe loads.
The watermark values are set based on the minimum number of free memory blocks that must be
available to avoid the specified action. In the case of the interrupt watermark, the specified action is an
interrupt. The value of the interrupt watermark should be set low enough that it is not triggered under
ordinary circumstances, as this would increase the interrupt service load of the system. The interrupt
watermark should also be set high enough that the interrupt is triggered while there is still enough free
memory to keep the system moving long enough to take action and avoid data loss due to a lack of
memory.
The following procedures describe how to set the interrupt watermark and service the watermark
interrupt.
Set the Interrupt Watermark Level
STEP 1: Read the WMVR value.
WMVR contains three different watermark values. Change only the Interrupt watermark value while
keeping the values of the other two unchanged. This is accomplished using a read-modify-write
operation.
STEP 2: Clear only the Interrupt field of the WMVR value.
This can be done with the use of a bit-wise AND operator.
STEP 3: Set the value of the Interrupt field in the WMVR value.
This can be done with the use of a bit-wise OR operator. The desired watermark value needs to be
shifted to make it line up with the position of the Interrupt field in the WMVR value.
STEP 4: Write the new value to WMVR.
Handle the Watermark Interrupt
STEP 1: Set the HIMR Water Mark bit to enable the watermark interrupt.
STEP 2: Wait for a watermark interrupt.
STEP 3: Calculate the number of memory blocks currently in use.
The number of blocks in use is the sum of the number of blocks used by each QUE. Each QUE’s
QSR Count field contains the number of blocks currently used. It is not necessary to read the static
QUEs as they always use exactly one block.
STEP 4: Check the receive QUE size for excessive use.
If the number of memory blocks currently in use by the receive QUE is large, the driver should
address this before taking any other action. The driver should stop loading the transmit QUEs at the
next opportunity without risking a transmit under-run and focus all host bus activity into reducing the
receive QUE. If transmit frames are higher priority than receive frames, the driver should consider
dropping low priority receive frames as an alternate method for drawing down the receive QUE.