A method for processing various numbers of ports in a network processor. A
method for processing various numbers of ports in a network processor
comprises the steps of: a) receiving the number N of ports from a system
controller; b) allocating N-1 number of registers for storing N-1 number
of port management information in response to the number N of ports; c)
processing a packet by sequentially accessing the N number of ports; and
d) after processing a packet related to a predetermined port, storing
management information related to the predetermined port in a register
used for the next port, and storing the management information related to
the predetermined port in a first register among the N-1 number of
registers when a register for storing management information in a
previous packet processing is the last (N-1)-th register among the N-1
number of registers.