Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
cvmx-pko.h File Reference
#include <asm/octeon/cvmx-fpa.h>
#include <asm/octeon/cvmx-pow.h>
#include <asm/octeon/cvmx-cmd-queue.h>
#include <asm/octeon/cvmx-pko-defs.h>

Go to the source code of this file.

Data Structures

struct  cvmx_pko_port_status_t
 
union  cvmx_pko_doorbell_address_t
 
union  cvmx_pko_command_word0_t
 
struct  cvmx_pko_state_elem_t
 

Macros

#define CVMX_PKO_COMMAND_BUFFER_SIZE_ADJUST   (1)
 
#define CVMX_PKO_MAX_OUTPUT_QUEUES_STATIC   256
 
#define CVMX_PKO_MAX_OUTPUT_QUEUES
 
#define CVMX_PKO_NUM_OUTPUT_PORTS   40
 
#define CVMX_PKO_MEM_QUEUE_PTRS_ILLEGAL_PID   63
 
#define CVMX_PKO_QUEUE_STATIC_PRIORITY   9
 
#define CVMX_PKO_ILLEGAL_QUEUE   0xFFFF
 
#define CVMX_PKO_MAX_QUEUE_DEPTH   0
 
#define CVMX_HELPER_PKO_MAX_PORTS_INTERFACE0   16
 
#define CVMX_HELPER_PKO_MAX_PORTS_INTERFACE1   16
 

Enumerations

enum  cvmx_pko_status_t {
  CVMX_PKO_SUCCESS, CVMX_PKO_INVALID_PORT, CVMX_PKO_INVALID_QUEUE, CVMX_PKO_INVALID_PRIORITY,
  CVMX_PKO_NO_MEMORY, CVMX_PKO_PORT_ALREADY_SETUP, CVMX_PKO_CMD_QUEUE_INIT_ERROR
}
 
enum  cvmx_pko_lock_t { CVMX_PKO_LOCK_NONE = 0, CVMX_PKO_LOCK_ATOMIC_TAG = 1, CVMX_PKO_LOCK_CMD_QUEUE = 2 }
 

Functions

void cvmx_pko_initialize_global (void)
 
int cvmx_pko_initialize_local (void)
 
void cvmx_pko_enable (void)
 
void cvmx_pko_disable (void)
 
void cvmx_pko_shutdown (void)
 
cvmx_pko_status_t cvmx_pko_config_port (uint64_t port, uint64_t base_queue, uint64_t num_queues, const uint64_t priority[])
 
int cvmx_pko_rate_limit_packets (int port, int packets_s, int burst)
 
int cvmx_pko_rate_limit_bits (int port, uint64_t bits_s, int burst)
 

Macro Definition Documentation

#define CVMX_HELPER_PKO_MAX_PORTS_INTERFACE0   16
#define CVMX_HELPER_PKO_MAX_PORTS_INTERFACE1   16
#define CVMX_PKO_COMMAND_BUFFER_SIZE_ADJUST   (1)

Interface to the hardware Packet Output unit.

Starting with SDK 1.7.0, the PKO output functions now support two types of locking. CVMX_PKO_LOCK_ATOMIC_TAG continues to function similarly to previous SDKs by using POW atomic tags to preserve ordering and exclusivity. As a new option, you can now pass CVMX_PKO_LOCK_CMD_QUEUE which uses a ll/sc memory based locking instead. This locking has the advantage of not affecting the tag state but doesn't preserve packet ordering. CVMX_PKO_LOCK_CMD_QUEUE is appropriate in most generic code while CVMX_PKO_LOCK_CMD_QUEUE should be used with hand tuned fast path code.

Some of other SDK differences visible to the command command queuing:

  • PKO indexes are no longer stored in the FAU. A large percentage of the FAU register block used to be tied up maintaining PKO queue pointers. These are now stored in a global named block.
  • The PKO use_locking parameter can now have a global effect. Since all application use the same named block, queue locking correctly applies across all operating systems when using CVMX_PKO_LOCK_CMD_QUEUE.
  • PKO 3 word commands are now supported. Use cvmx_pko_send_packet_finish3().

Definition at line 69 of file cvmx-pko.h.

#define CVMX_PKO_ILLEGAL_QUEUE   0xFFFF

Definition at line 81 of file cvmx-pko.h.

#define CVMX_PKO_MAX_OUTPUT_QUEUES
Value:
OCTEON_IS_MODEL(OCTEON_CN3010) || OCTEON_IS_MODEL(OCTEON_CN3005) || \
OCTEON_IS_MODEL(OCTEON_CN50XX)) ? 32 : \
OCTEON_IS_MODEL(OCTEON_CN56XX)) ? 256 : 128)

Definition at line 72 of file cvmx-pko.h.

#define CVMX_PKO_MAX_OUTPUT_QUEUES_STATIC   256

Definition at line 71 of file cvmx-pko.h.

#define CVMX_PKO_MAX_QUEUE_DEPTH   0

Definition at line 82 of file cvmx-pko.h.

#define CVMX_PKO_MEM_QUEUE_PTRS_ILLEGAL_PID   63

Definition at line 79 of file cvmx-pko.h.

#define CVMX_PKO_NUM_OUTPUT_PORTS   40

Definition at line 77 of file cvmx-pko.h.

#define CVMX_PKO_QUEUE_STATIC_PRIORITY   9

Definition at line 80 of file cvmx-pko.h.

Enumeration Type Documentation

This enumeration represents the differnet locking modes supported by PKO.

Enumerator:
CVMX_PKO_LOCK_NONE 
CVMX_PKO_LOCK_ATOMIC_TAG 
CVMX_PKO_LOCK_CMD_QUEUE 

Definition at line 97 of file cvmx-pko.h.

Enumerator:
CVMX_PKO_SUCCESS 
CVMX_PKO_INVALID_PORT 
CVMX_PKO_INVALID_QUEUE 
CVMX_PKO_INVALID_PRIORITY 
CVMX_PKO_NO_MEMORY 
CVMX_PKO_PORT_ALREADY_SETUP 
CVMX_PKO_CMD_QUEUE_INIT_ERROR 

Definition at line 84 of file cvmx-pko.h.

Function Documentation

cvmx_pko_status_t cvmx_pko_config_port ( uint64_t  port,
uint64_t  base_queue,
uint64_t  num_queues,
const uint64_t  priority[] 
)

Configure a output port and the associated queues for use.

: Port to configure. : First queue number to associate with this port. : Number of queues t oassociate with this port : Array of priority levels for each queue. Values are allowed to be 1-8. A value of 8 get 8 times the traffic of a value of 1. There must be num_queues elements in the array.

Configure a output port and the associated queues for use.

: Port to configure. : First queue number to associate with this port. : Number of queues to associate with this port : Array of priority levels for each queue. Values are allowed to be 0-8. A value of 8 get 8 times the traffic of a value of 1. A value of 0 indicates that no rounds will be participated in. These priorities can be changed on the fly while the pko is enabled. A priority of 9 indicates that static priority should be used. If static priority is used all queues with static priority must be contiguous starting at the base_queue, and lower numbered queues have higher priority than higher numbered queues. There must be num_queues elements in the array.

Definition at line 203 of file cvmx-pko.c.

void cvmx_pko_disable ( void  )

Disables the packet output. Does not affect any configuration.

Definition at line 136 of file cvmx-pko.c.

void cvmx_pko_enable ( void  )

Enables the packet output hardware. It must already be configured.

Definition at line 114 of file cvmx-pko.c.

void cvmx_pko_initialize_global ( void  )

Call before any other calls to initialize the packet output system.

Internal state of packet output Call before any other calls to initialize the packet output system. This does chip global config, and should only be done by one core.

Definition at line 48 of file cvmx-pko.c.

int cvmx_pko_initialize_local ( void  )

This function does per-core initialization required by the PKO routines. This must be called on all cores that will do packet output, and must be called after the FPA has been initialized and filled with pages.

Returns 0 on success !0 on failure

Definition at line 104 of file cvmx-pko.c.

int cvmx_pko_rate_limit_bits ( int  port,
uint64_t  bits_s,
int  burst 
)

Rate limit a PKO port to a max bits/sec. This function is only supported on CN57XX, CN56XX, CN55XX, and CN54XX.

: Port to rate limit : PKO rate limit in bits/sec : Maximum number of bits to burst before rate limiting cuts in.

Returns Zero on success, negative on failure

Rate limit a PKO port to a max bits/sec. This function is only supported on CN51XX and higher, excluding CN58XX.

: Port to rate limit : PKO rate limit in bits/sec : Maximum number of bits to burst before rate limiting cuts in.

Returns Zero on success, negative on failure

Definition at line 480 of file cvmx-pko.c.

int cvmx_pko_rate_limit_packets ( int  port,
int  packets_s,
int  burst 
)

Rate limit a PKO port to a max packets/sec. This function is only supported on CN57XX, CN56XX, CN55XX, and CN54XX.

: Port to rate limit : Maximum packet/sec : Maximum number of packets to burst in a row before rate limiting cuts in.

Returns Zero on success, negative on failure

Rate limit a PKO port to a max packets/sec. This function is only supported on CN51XX and higher, excluding CN58XX.

: Port to rate limit : Maximum packet/sec : Maximum number of packets to burst in a row before rate limiting cuts in.

Returns Zero on success, negative on failure

Definition at line 447 of file cvmx-pko.c.

void cvmx_pko_shutdown ( void  )

Shutdown and free resources required by packet output.

Definition at line 159 of file cvmx-pko.c.