OpenNSL API Guide and Reference Manual
|
Data Structures | |
struct | opennsl_pkt_blk_s |
OPENNSL packet gather block type. More... | |
struct | opennsl_pkt_oam_counter_s |
OAM counter. More... | |
struct | opennsl_pkt_s |
Initialize a OPENNSL packet structure. More... | |
struct | opennsl_rx_cfg_s |
User-configurable, per-unit RX configuration. More... | |
struct | opennsl_rx_chan_cfg_s |
Channel-specific RX data. More... | |
struct | opennsl_rx_snoop_config_s |
User-configurable, per-unit RX configuration. More... | |
struct | opennsl_rx_trap_config_s |
User-configurable, per-unit RX configuration. More... | |
struct | opennsl_rx_trap_core_config_s |
User-configurable, per-unit-core RX destination configuration. More... | |
Files | |
file | pktX.h |
file | rxX.h |
file | tx.h |
file | txX.h |
Macros | |
#define | OPENNSL_CMICX_RX_CHANNELS 8 |
Max. | |
#define | OPENNSL_PKT_F_NO_VTAG 0x4 |
Packet does not contain VLAN tag. | |
#define | OPENNSL_PKT_F_TRUNK 0x20000000 |
Trunk port. | |
#define | OPENNSL_PKT_NOF_DNX_HEADERS _SHR_PKT_NOF_DNX_HEADERS |
#define | OPENNSL_PKT_OAM_COUNTER_MAX 3 |
#define | OPENNSL_PKT_ONE_BUF_SETUP(pkt, buf, _len) |
#define | OPENNSL_RCO_F_ALL_COS 0x40000000 |
#define | OPENNSL_RCO_F_COS_ACCEPT(cos) (1 << (cos)) |
#define | OPENNSL_RX_CHANNELS 4 |
Max. | |
#define | OPENNSL_RX_COSQ_PACKET_TYPE_MIRROR 0x4 |
#define | OPENNSL_RX_COSQ_PACKET_TYPE_NON_UNICAST 0x2 |
#define | OPENNSL_RX_COSQ_PACKET_TYPE_SWITCHED 0x1 |
#define | OPENNSL_RX_REASON_CLEAR_ALL(_reasons) _SHR_RX_REASON_CLEAR_ALL(_reasons) |
#define | OPENNSL_RX_REASON_GET(_reasons, _reason) _SHR_RX_REASON_GET(_reasons, _reason) |
#define | OPENNSL_RX_REASON_NAMES_INITIALIZER _SHR_RX_REASON_NAMES_INITIALIZER |
#define | OPENNSL_RX_REASON_SET(_reasons, _reason) _SHR_RX_REASON_SET(_reasons, _reason) |
#define | OPENNSL_RX_SNOOP_DEST_MULTICAST 0x00000040 |
destination is multicast. | |
#define | OPENNSL_RX_SNOOP_REPLACE 0x00000100 |
Replace config of existing trap/snoop. | |
#define | OPENNSL_RX_SNOOP_UPDATE_COLOR 0x00000004 |
update color. | |
#define | OPENNSL_RX_SNOOP_UPDATE_COUNTER 0x00000020 |
update counter. | |
#define | OPENNSL_RX_SNOOP_UPDATE_DEST 0x00000001 |
update destination. | |
#define | OPENNSL_RX_SNOOP_UPDATE_ETHERNET_POLICER 0x00000010 |
update Ethernet policer. | |
#define | OPENNSL_RX_SNOOP_UPDATE_POLICER 0x00000008 |
update policer id. | |
#define | OPENNSL_RX_SNOOP_UPDATE_PRIO 0x00000002 |
update priority. | |
#define | OPENNSL_RX_SNOOP_WITH_ID 0x00000080 |
Use the specified trap/snoop id. | |
#define | OPENNSL_RX_TRAP_REPLACE 0x00000800 |
Replace config of existing trap/snoop. | |
#define | OPENNSL_TX_CRC_ALLOC 0x10 |
Allocate buffer for CRC. | |
#define | OPENNSL_TX_CRC_APPEND (OPENNSL_TX_CRC_ALLOC + OPENNSL_TX_CRC_REGEN) |
#define | OPENNSL_TX_CRC_REGEN 0x20 |
Regenerate CRC. | |
#define | OPENNSL_TX_ETHER 0x100000 |
Fully mapped packet TX. | |
Typedefs | |
typedef struct opennsl_pkt_blk_s | opennsl_pkt_blk_t |
OPENNSL packet gather block type. | |
typedef void(* | opennsl_pkt_cb_f )(int reserved1, opennsl_pkt_t *reserved2, void *reserved3) |
typedef struct opennsl_pkt_oam_counter_s | opennsl_pkt_oam_counter_t |
OAM counter. | |
typedef struct opennsl_pkt_s | opennsl_pkt_t |
The packet structure. | |
typedef int(* | opennsl_rx_alloc_f )(int reserved1, int reserved2, uint32 reserved3, void **reserved4) |
typedef opennsl_rx_t(* | opennsl_rx_cb_f )(int unit, opennsl_pkt_t *pkt, void *cookie) |
typedef struct opennsl_rx_cfg_s | opennsl_rx_cfg_t |
User-configurable, per-unit RX configuration. | |
typedef struct opennsl_rx_chan_cfg_s | opennsl_rx_chan_cfg_t |
Channel-specific RX data. | |
typedef enum opennsl_rx_control_e | opennsl_rx_control_t |
typedef int(* | opennsl_rx_free_f )(int reserved1, void *reserved2) |
typedef enum opennsl_rx_reason_e | opennsl_rx_reason_t |
PKT RX Packet Reasons; reason CPU received the packet. | |
typedef _shr_rx_reasons_t | opennsl_rx_reasons_t |
Set of 'reasons' (see opennslRxReason*) why a packet came to the CPU. | |
typedef struct opennsl_rx_snoop_config_s | opennsl_rx_snoop_config_t |
User-configurable, per-unit RX configuration. | |
typedef enum opennsl_rx_e | opennsl_rx_t |
Return values from PKT RX callout routines. | |
typedef struct opennsl_rx_trap_config_s | opennsl_rx_trap_config_t |
User-configurable, per-unit RX configuration. | |
typedef struct opennsl_rx_trap_core_config_s | opennsl_rx_trap_core_config_t |
User-configurable, per-unit-core RX destination configuration. | |
typedef enum opennsl_rx_trap_forwarding_header_e | opennsl_rx_trap_forwarding_header_t |
Forwarding header position overridden value. | |
typedef enum opennsl_rx_trap_e | opennsl_rx_trap_t |
Return values from PKT RX callout routines. | |
Functions | |
int | opennsl_pkt_alloc (int unit, int size, uint32 flags, opennsl_pkt_t **pkt_buf) LIB_DLL_EXPORTED |
Allocate or deallocate a packet structure and packet data. | |
void | opennsl_pkt_blk_t_init (opennsl_pkt_blk_t *pkt_blk) LIB_DLL_EXPORTED |
Initialize a OPENNSL packet block structure. | |
int | opennsl_pkt_clear (int unit, opennsl_pkt_t *pkt, opennsl_pkt_blk_t *blks, int blk_count, uint32 flags, opennsl_pkt_t **pkt_buf) LIB_DLL_EXPORTED |
Initialize and set up a opennsl_pkt_t structure. | |
int | opennsl_pkt_flags_init (int unit, opennsl_pkt_t *pkt, uint32 init_flags) LIB_DLL_EXPORTED |
Initialize packet flags based on the type of device. | |
int | opennsl_pkt_free (int unit, opennsl_pkt_t *pkt) LIB_DLL_EXPORTED |
Allocate or deallocate a packet structure and packet data. | |
int | opennsl_pkt_memcpy (opennsl_pkt_t *pkt, int dest_byte, uint8 *src, int len) LIB_DLL_EXPORTED |
Copy data into the data blocks of a packet structure. | |
void | opennsl_pkt_t_init (opennsl_pkt_t *pkt) LIB_DLL_EXPORTED |
Initialize a OPENNSL packet structure. | |
int | opennsl_rx_active (int unit) LIB_DLL_EXPORTED |
Boolean indication of whether RX is running on this device. | |
int | opennsl_rx_cfg_get (int unit, opennsl_rx_cfg_t *cfg) LIB_DLL_EXPORTED |
Get the current configuration for the given device. | |
int | opennsl_rx_cfg_init (int unit) LIB_DLL_EXPORTED |
Re-initialize the user level configuration for the RX module. | |
void | opennsl_rx_cfg_t_init (opennsl_rx_cfg_t *rx_cfg) LIB_DLL_EXPORTED |
Initialize a OPENNSL RX configuration structure. | |
int | opennsl_rx_control_get (int unit, opennsl_rx_control_t type, int *arg) LIB_DLL_EXPORTED |
Set/get RX operating modes. | |
int | opennsl_rx_control_set (int unit, opennsl_rx_control_t type, int arg) LIB_DLL_EXPORTED |
Set/get RX operating modes. | |
int | opennsl_rx_cos_rate_set (int unit, int cos, int pps) LIB_DLL_EXPORTED |
Set/get the RX per-Cos rate limiting value. | |
int | opennsl_rx_cosq_mapping_delete (int unit, int index) LIB_DLL_EXPORTED |
Map/Un-map packets to a CPU CoS queue. | |
int | opennsl_rx_cosq_mapping_get (int unit, int index, opennsl_rx_reasons_t *reasons, opennsl_rx_reasons_t *reasons_mask, uint8 *int_prio, uint8 *int_prio_mask, uint32 *packet_type, uint32 *packet_type_mask, opennsl_cos_queue_t *cosq) LIB_DLL_EXPORTED |
Map/Un-map packets to a CPU CoS queue. | |
int | opennsl_rx_cosq_mapping_reasons_get (int unit, opennsl_rx_reasons_t *reasons) LIB_DLL_EXPORTED |
Get all the CPU CoS queue mapping reasons supported on the specified device. | |
int | opennsl_rx_cosq_mapping_set (int unit, int index, opennsl_rx_reasons_t reasons, opennsl_rx_reasons_t reasons_mask, uint8 int_prio, uint8 int_prio_mask, uint32 packet_type, uint32 packet_type_mask, opennsl_cos_queue_t cosq) LIB_DLL_EXPORTED |
Map/Un-map packets to a CPU CoS queue. | |
int | opennsl_rx_cosq_mapping_size_get (int unit, int *size) LIB_DLL_EXPORTED |
Map/Un-map packets to a CPU CoS queue. | |
int | opennsl_rx_free (int unit, void *pkt_data) LIB_DLL_EXPORTED |
Allocate or deallocate a packet buffer as configured. | |
int | opennsl_rx_queue_max_get (int unit, opennsl_cos_queue_t *cosq) LIB_DLL_EXPORTED |
Get highest priority queue number supported by device. | |
int | opennsl_rx_reasons_get (int unit, opennsl_rx_reasons_t *reasons) LIB_DLL_EXPORTED |
Get all the CPU RX reasons supported on the specified device. | |
void | opennsl_rx_reasons_t_init (opennsl_rx_reasons_t *reasons) LIB_DLL_EXPORTED |
Initialize a OPENNSL RX reasons structure. | |
int | opennsl_rx_register (int unit, const char *name, opennsl_rx_cb_f callback, uint8 priority, void *cookie, uint32 flags) LIB_DLL_EXPORTED |
Register or unregister to receive callbacks for received packets. | |
void | opennsl_rx_snoop_config_t_init (opennsl_rx_snoop_config_t *snoop_config) LIB_DLL_EXPORTED |
Initialize the rx_snoop_config_t structure. | |
int | opennsl_rx_snoop_create (int unit, int flags, int *snoop_cmnd) LIB_DLL_EXPORTED |
Create snoop command. | |
int | opennsl_rx_snoop_destroy (int unit, int flags, int snoop_cmnd) LIB_DLL_EXPORTED |
Destroy create snoop command. | |
int | opennsl_rx_snoop_get (int unit, int snoop_cmnd, opennsl_rx_snoop_config_t *config) LIB_DLL_EXPORTED |
Set snoop configuration of the snoop command. | |
int | opennsl_rx_snoop_set (int unit, int snoop_cmnd, opennsl_rx_snoop_config_t *config) LIB_DLL_EXPORTED |
The snoop can be set for given trap-code (e.g. | |
int | opennsl_rx_start (int unit, opennsl_rx_cfg_t *cfg) LIB_DLL_EXPORTED |
Start packet reception for the given device. | |
int | opennsl_rx_stop (int unit, opennsl_rx_cfg_t *cfg) LIB_DLL_EXPORTED |
Stop the RX software module. | |
void | opennsl_rx_trap_config_t_init (opennsl_rx_trap_config_t *trap_config) LIB_DLL_EXPORTED |
Initialize the rx_trap_config_t structure. | |
int | opennsl_rx_trap_get (int unit, int trap_id, opennsl_rx_trap_config_t *config) LIB_DLL_EXPORTED |
Get trap configuration according to trap id. | |
int | opennsl_rx_trap_set (int unit, int trap_id, opennsl_rx_trap_config_t *config) LIB_DLL_EXPORTED |
Set how to handle packet according to trap type. | |
int | opennsl_rx_trap_type_create (int unit, int flags, opennsl_rx_trap_t type, int *trap_id) LIB_DLL_EXPORTED |
Create trap handle for a given type. | |
int | opennsl_rx_trap_type_destroy (int unit, int trap_id) LIB_DLL_EXPORTED |
Destroy trap handle for a given trap id. | |
int | opennsl_rx_trap_type_from_id_get (int unit, int flags, int trap_id, opennsl_rx_trap_t *trap_type) LIB_DLL_EXPORTED |
Get trap type according to trap id. | |
int | opennsl_rx_trap_type_get (int unit, int flags, opennsl_rx_trap_t type, int *trap_id) LIB_DLL_EXPORTED |
Get trap id according to type. | |
int | opennsl_rx_unregister (int unit, opennsl_rx_cb_f callback, uint8 priority) LIB_DLL_EXPORTED |
Register or unregister to receive callbacks for received packets. | |
int | opennsl_tx (int unit, opennsl_pkt_t *tx_pkt, void *cookie) LIB_DLL_EXPORTED |
Transmit one or more packets. | |
#define OPENNSL_CMICX_RX_CHANNELS 8 |
#define OPENNSL_PKT_F_NO_VTAG 0x4 |
#define OPENNSL_PKT_NOF_DNX_HEADERS _SHR_PKT_NOF_DNX_HEADERS |
#define OPENNSL_PKT_ONE_BUF_SETUP | ( | pkt, | |
buf, | |||
_len | |||
) |
#define OPENNSL_RCO_F_ALL_COS 0x40000000 |
Definition at line 36 of file rx.h.
Referenced by example_rx_setup(), and main().
#define OPENNSL_RX_REASON_CLEAR_ALL | ( | _reasons | ) | _SHR_RX_REASON_CLEAR_ALL(_reasons) |
#define OPENNSL_RX_REASON_GET | ( | _reasons, | |
_reason | |||
) | _SHR_RX_REASON_GET(_reasons, _reason) |
#define OPENNSL_RX_REASON_NAMES_INITIALIZER _SHR_RX_REASON_NAMES_INITIALIZER |
#define OPENNSL_RX_REASON_SET | ( | _reasons, | |
_reason | |||
) | _SHR_RX_REASON_SET(_reasons, _reason) |
#define OPENNSL_RX_SNOOP_DEST_MULTICAST 0x00000040 |
#define OPENNSL_RX_SNOOP_REPLACE 0x00000100 |
#define OPENNSL_RX_SNOOP_UPDATE_COLOR 0x00000004 |
#define OPENNSL_RX_SNOOP_UPDATE_COUNTER 0x00000020 |
#define OPENNSL_RX_SNOOP_UPDATE_DEST 0x00000001 |
#define OPENNSL_RX_SNOOP_UPDATE_ETHERNET_POLICER 0x00000010 |
#define OPENNSL_RX_SNOOP_UPDATE_POLICER 0x00000008 |
#define OPENNSL_RX_SNOOP_UPDATE_PRIO 0x00000002 |
#define OPENNSL_RX_SNOOP_WITH_ID 0x00000080 |
#define OPENNSL_RX_TRAP_REPLACE 0x00000800 |
#define OPENNSL_TX_CRC_ALLOC 0x10 |
#define OPENNSL_TX_CRC_APPEND (OPENNSL_TX_CRC_ALLOC + OPENNSL_TX_CRC_REGEN) |
typedef struct opennsl_pkt_blk_s opennsl_pkt_blk_t |
OPENNSL packet gather block type.
typedef void(* opennsl_pkt_cb_f)(int reserved1, opennsl_pkt_t *reserved2, void *reserved3) |
typedef struct opennsl_pkt_oam_counter_s opennsl_pkt_oam_counter_t |
OAM counter.
typedef struct opennsl_pkt_s opennsl_pkt_t |
The packet structure.
The packet layout is as follows:
DMAC + SMAC 12 bytes VLAN tag 4 bytes (may be filled in by SW on network switch) payload N bytes CRC 4 bytes pad M bytes SL tag 4 bytes (may be unused) HiGig Header 12 bytes (may be unused)
The rule is: alloc_len = 12 + 4 + N + 4 + M + 4 + 12 (all of above). payload_len (below) is N.
Note that the payload may grow until M == 0; the CRC moves. The SL and HiGig headers will not move.
The "IEEE packet" is everything from the DMAC through the CRC (inclusive), not including SL tag or HiGig header.
Scatter/gather is used to put the data into the right positions on transmit and receive. The SL/HiGig headers are parsed on RX into data members in the packet structure. On TX, opennsl_tx will send the packet according to the unit type. It will not check or affect any fields except maybe the CRC. Other routines will be provided to ensure the HiGig and SL tags are properly set up from the data in the packet structure.
typedef int(* opennsl_rx_alloc_f)(int reserved1, int reserved2, uint32 reserved3, void **reserved4) |
typedef opennsl_rx_t(* opennsl_rx_cb_f)(int unit, opennsl_pkt_t *pkt, void *cookie) |
typedef struct opennsl_rx_cfg_s opennsl_rx_cfg_t |
User-configurable, per-unit RX configuration.
typedef struct opennsl_rx_chan_cfg_s opennsl_rx_chan_cfg_t |
Channel-specific RX data.
The number of chains allowed for the channel controls the burst size that the channel accepts.
The 'rate_pps' field is DEPRECATED. The rate may be set on a per-COS basis using opennsl_rx_rate_set/get.
IMPORTANT: If OPENNSL_RX_F_MULTI_DCB is NOT used (single DCB per packet) then the rx_free routine must be given the allocation pointer (pkt->alloc_ptr) rather than the packet data pointer (pkt->_pkt_data.data or pkt->pkt_data[0].data).
typedef enum opennsl_rx_control_e opennsl_rx_control_t |
typedef int(* opennsl_rx_free_f)(int reserved1, void *reserved2) |
typedef enum opennsl_rx_reason_e opennsl_rx_reason_t |
PKT RX Packet Reasons; reason CPU received the packet.
It is possible no reasons are set (directed to CPU from ARL for example), or multiple reasons may be set.
typedef struct opennsl_rx_snoop_config_s opennsl_rx_snoop_config_t |
User-configurable, per-unit RX configuration.
typedef enum opennsl_rx_e opennsl_rx_t |
Return values from PKT RX callout routines.
typedef struct opennsl_rx_trap_config_s opennsl_rx_trap_config_t |
User-configurable, per-unit RX configuration.
typedef struct opennsl_rx_trap_core_config_s opennsl_rx_trap_core_config_t |
User-configurable, per-unit-core RX destination configuration.
Forwarding header position overridden value.
typedef enum opennsl_rx_trap_e opennsl_rx_trap_t |
Return values from PKT RX callout routines.
enum opennsl_rx_control_e |
enum opennsl_rx_e |
enum opennsl_rx_reason_e |
PKT RX Packet Reasons; reason CPU received the packet.
It is possible no reasons are set (directed to CPU from ARL for example), or multiple reasons may be set.
enum opennsl_rx_trap_e |
Forwarding header position overridden value.
int opennsl_pkt_alloc | ( | int | unit, |
int | size, | ||
uint32 | flags, | ||
opennsl_pkt_t ** | pkt_buf | ||
) |
Allocate or deallocate a packet structure and packet data.
unit | [IN] Unit number. |
size | [IN] Number of bytes to allocate for buffer space |
flags | [IN] Initial flags for the packet structure |
pkt_buf | [OUT] Structure to be allocated. |
OPENNSL_E_NONE | Operation completed successfully |
OPENNSL_E_MEMORY | Not enough memory - pkt_buf will be NULL |
Referenced by example_pkt_send().
void opennsl_pkt_blk_t_init | ( | opennsl_pkt_blk_t * | pkt_blk | ) |
Initialize a OPENNSL packet block structure.
pkt_blk | [IN,OUT] Pointer to OPENNSL packet block structure to initialize. |
None. |
int opennsl_pkt_clear | ( | int | unit, |
opennsl_pkt_t * | pkt, | ||
opennsl_pkt_blk_t * | blks, | ||
int | blk_count, | ||
uint32 | flags, | ||
opennsl_pkt_t ** | pkt_buf | ||
) |
Initialize and set up a opennsl_pkt_t structure.
unit | [IN] Unit number. |
pkt | [IN] Pointer to packet to setup; may be NULL |
blks | [IN] Pointer to array of gather blocks for the packet |
blk_count | [IN] Number of elements in blks array |
flags | [IN] See =pkt_flags_table for TX related flags |
pkt_buf | [OUT] Pointer to a cleared packet or NULL if failed to allocate packet |
OPENNSL_E_NONE | On success |
OPENNSL_E_MEMORY | Otherwise |
int opennsl_pkt_flags_init | ( | int | unit, |
opennsl_pkt_t * | pkt, | ||
uint32 | init_flags | ||
) |
Initialize packet flags based on the type of device.
unit | [IN] Unit number. |
pkt | [IN] Packet structure to modify |
init_flags | [IN] Initial flags to start with |
OPENNSL_E_NONE | On success |
int opennsl_pkt_free | ( | int | unit, |
opennsl_pkt_t * | pkt | ||
) |
Allocate or deallocate a packet structure and packet data.
unit | [IN] Unit number. |
pkt | [IN] Structure to be allocated. |
OPENNSL_E_NONE | Operation completed successfully |
OPENNSL_E_MEMORY | Not enough memory - pkt_buf will be NULL |
Referenced by example_pkt_send().
int opennsl_pkt_memcpy | ( | opennsl_pkt_t * | pkt, |
int | dest_byte, | ||
uint8 * | src, | ||
int | len | ||
) |
Copy data into the data blocks of a packet structure.
pkt | [IN] Structure to be updated |
dest_byte | [IN] Byte offset in the packet's data buffer |
src | [IN] Pointer to source data to copy |
len | [IN] Number of bytes to copy |
The | number of bytes copied. If there is not sufficient space in the |
packet's | data buffer, this may be less than len. |
Referenced by example_pkt_send().
void opennsl_pkt_t_init | ( | opennsl_pkt_t * | pkt | ) |
Initialize a OPENNSL packet structure.
pkt | [IN,OUT] Pointer to OPENNSL packet structure to initialize. |
None. |
int opennsl_rx_active | ( | int | unit | ) |
Boolean indication of whether RX is running on this device.
unit | [IN] Unit number. |
TRUE | The RX module is initialized and running on this device |
FALSE | The RX module is not running on this device |
Referenced by example_rx_setup(), and main().
int opennsl_rx_cfg_get | ( | int | unit, |
opennsl_rx_cfg_t * | cfg | ||
) |
Get the current configuration for the given device.
unit | [IN] Unit number. |
cfg | [OUT] Where to copy the device's configuration |
OPENNSL_E_NONE | Success |
OPENNSL_E_INIT | Start has not yet been called on the device |
OPENNSL_E_PARAM | Invalid device |
OPENNSL_E_MEMORY | Unable to allocate necessary objects for initialization |
int opennsl_rx_cfg_init | ( | int | unit | ) |
Re-initialize the user level configuration for the RX module.
unit | [IN] Unit number. |
OPENNSL_E_NONE | Success |
OPENNSL_E_BUSY | Device has been started |
OPENNSL_E_PARAM | Invalid device |
OPENNSL_E_MEMORY | Unable to allocate necessary objects for initialization |
void opennsl_rx_cfg_t_init | ( | opennsl_rx_cfg_t * | rx_cfg | ) |
Initialize a OPENNSL RX configuration structure.
rx_cfg | [IN,OUT] Pointer to OPENNSL RX configuration structure to initialize. |
None. |
Referenced by example_rx_setup().
int opennsl_rx_control_get | ( | int | unit, |
opennsl_rx_control_t | type, | ||
int * | arg | ||
) |
Set/get RX operating modes.
unit | [IN] Unit number. |
type | [IN] RX control parameter (see =opennsl_rx_control_switches) |
arg | [OUT] (for _set) Argument whose meaning is dependent on type |
OPENNSL_E_NONE | Success |
OPENNSL_E_UNAVAIL | Control unavailable |
int opennsl_rx_control_set | ( | int | unit, |
opennsl_rx_control_t | type, | ||
int | arg | ||
) |
Set/get RX operating modes.
unit | [IN] Unit number. |
type | [IN] RX control parameter (see =opennsl_rx_control_switches) |
arg | [IN] (for _set) Argument whose meaning is dependent on type |
OPENNSL_E_NONE | Success |
OPENNSL_E_UNAVAIL | Control unavailable |
int opennsl_rx_cos_rate_set | ( | int | unit, |
int | cos, | ||
int | pps | ||
) |
Set/get the RX per-Cos rate limiting value.
unit | [IN] Unit number. |
cos | [IN] CoS to configure |
pps | [IN] Rate in packets/second |
OPENNSL_E_XXX | Error during required initialization |
int opennsl_rx_cosq_mapping_delete | ( | int | unit, |
int | index | ||
) |
Map/Un-map packets to a CPU CoS queue.
unit | [IN] Unit number. |
index | [IN] Index into CPU CoS mapping table |
OPENNSL_E_NONE | Success |
OPENNSL_E_PARAM | Invalid parameter(s) |
OPENNSL_E_UNAVAIL | Not available on the specified unit |
int opennsl_rx_cosq_mapping_get | ( | int | unit, |
int | index, | ||
opennsl_rx_reasons_t * | reasons, | ||
opennsl_rx_reasons_t * | reasons_mask, | ||
uint8 * | int_prio, | ||
uint8 * | int_prio_mask, | ||
uint32 * | packet_type, | ||
uint32 * | packet_type_mask, | ||
opennsl_cos_queue_t * | cosq | ||
) |
Map/Un-map packets to a CPU CoS queue.
unit | [IN] Unit number. |
index | [IN] Index into CPU CoS mapping table |
reasons | [IN,OUT] Set of packet reasons |
reasons_mask | [IN,OUT] Mask for the set of packet reasons |
int_prio | [OUT] Internal priority value of packet |
int_prio_mask | [OUT] Mask for internal priority value |
packet_type | [OUT] Packet type (see OPENNSL_RX_COSQ_PACKET_TYPE_* below) |
packet_type_mask | [OUT] Mask for packet type |
cosq | [OUT] CPU CoS queue |
OPENNSL_E_NONE | Success |
OPENNSL_E_PARAM | Invalid parameter(s) |
OPENNSL_E_UNAVAIL | Not available on the specified unit |
int opennsl_rx_cosq_mapping_reasons_get | ( | int | unit, |
opennsl_rx_reasons_t * | reasons | ||
) |
Get all the CPU CoS queue mapping reasons supported on the specified device.
unit | [IN] Unit number. |
reasons | [OUT] Set of packet reasons |
OPENNSL_E_NONE | Success |
OPENNSL_E_PARAM | Invalid parameter(s) |
OPENNSL_E_UNAVAIL | Not available on the specified unit |
int opennsl_rx_cosq_mapping_set | ( | int | unit, |
int | index, | ||
opennsl_rx_reasons_t | reasons, | ||
opennsl_rx_reasons_t | reasons_mask, | ||
uint8 | int_prio, | ||
uint8 | int_prio_mask, | ||
uint32 | packet_type, | ||
uint32 | packet_type_mask, | ||
opennsl_cos_queue_t | cosq | ||
) |
Map/Un-map packets to a CPU CoS queue.
unit | [IN] Unit number. |
index | [IN] Index into CPU CoS mapping table |
reasons | [IN] Set of packet reasons |
reasons_mask | [IN] Mask for the set of packet reasons |
int_prio | [IN] Internal priority value of packet |
int_prio_mask | [IN] Mask for internal priority value |
packet_type | [IN] Packet type (see OPENNSL_RX_COSQ_PACKET_TYPE_* below) |
packet_type_mask | [IN] Mask for packet type |
cosq | [IN] CPU CoS queue |
OPENNSL_E_NONE | Success |
OPENNSL_E_PARAM | Invalid parameter(s) |
OPENNSL_E_UNAVAIL | Not available on the specified unit |
int opennsl_rx_cosq_mapping_size_get | ( | int | unit, |
int * | size | ||
) |
Map/Un-map packets to a CPU CoS queue.
unit | [IN] Unit number. |
size | [OUT] |
OPENNSL_E_NONE | Success |
OPENNSL_E_PARAM | Invalid parameter(s) |
OPENNSL_E_UNAVAIL | Not available on the specified unit |
int opennsl_rx_free | ( | int | unit, |
void * | pkt_data | ||
) |
Allocate or deallocate a packet buffer as configured.
unit | [IN] Unit number. |
pkt_data | [IN] For opennsl_rx_free, pointer to the data to free |
OPENNSL_E_NONE | Operation completed successfully |
OPENNSL_E_MEMORY | Otherwise |
int opennsl_rx_queue_max_get | ( | int | unit, |
opennsl_cos_queue_t * | cosq | ||
) |
Get highest priority queue number supported by device.
unit | [IN] Unit number. |
cosq | [OUT] Maximum priority queue supported by device. |
OPENNSL_E_XXX |
int opennsl_rx_reasons_get | ( | int | unit, |
opennsl_rx_reasons_t * | reasons | ||
) |
Get all the CPU RX reasons supported on the specified device.
unit | [IN] Unit number. |
reasons | [OUT] Set of packet reasons |
OPENNSL_E_NONE | Success |
OPENNSL_E_PARAM | Invalid parameter(s) |
OPENNSL_E_UNAVAIL | Not available on the specified unit |
void opennsl_rx_reasons_t_init | ( | opennsl_rx_reasons_t * | reasons | ) |
Initialize a OPENNSL RX reasons structure.
reasons | [IN,OUT] - Pointer to the structure to be initialized. |
None. |
int opennsl_rx_register | ( | int | unit, |
const char * | name, | ||
opennsl_rx_cb_f | callback, | ||
uint8 | priority, | ||
void * | cookie, | ||
uint32 | flags | ||
) |
Register or unregister to receive callbacks for received packets.
unit | [IN] Unit number. |
name | [IN] String to identify function; for reporting only |
callback | [IN] Function pointer to be called |
priority | [IN] Relative priority of the callback; 0 is lowest |
cookie | [IN] Application data passed on callback |
flags | [IN] CoS and interrupt level flags; see =rx_callback_flags |
OPENNSL_E_NONE | Success |
OPENNSL_E_MEMORY | Could not allocate an entry on the callback list |
OPENNSL_E_PARAM | Register was called with a NULL callback or re-registered with mismatched flags or cookie. |
Referenced by example_rx_setup(), and main().
void opennsl_rx_snoop_config_t_init | ( | opennsl_rx_snoop_config_t * | snoop_config | ) |
Initialize the rx_snoop_config_t structure.
snoop_config | [IN,OUT] snoop configuration structure |
int opennsl_rx_snoop_create | ( | int | unit, |
int | flags, | ||
int * | snoop_cmnd | ||
) |
Create snoop command.
unit | [IN] Unit number. |
flags | [IN] OPENNSL_RX_SNOOP_XXX FLAGS |
snoop_cmnd | [IN,OUT] Snoop command |
OPENNSL_E_RESOURCE | No more trap-id of given type |
OPENNSL_E_EXISTS | Trap-id already exists |
int opennsl_rx_snoop_destroy | ( | int | unit, |
int | flags, | ||
int | snoop_cmnd | ||
) |
Destroy create snoop command.
unit | [IN] Unit number. |
flags | [IN] See OPENNSL_RX_TRAP_xxx |
snoop_cmnd | [IN] Snoop command |
OPENNSL_E_NOT_FOUND | Trap not found |
int opennsl_rx_snoop_get | ( | int | unit, |
int | snoop_cmnd, | ||
opennsl_rx_snoop_config_t * | config | ||
) |
Set snoop configuration of the snoop command.
unit | [IN] Unit number. |
snoop_cmnd | [IN] Snoop command |
config | [OUT] Pointer for opennsl_rx_snoop_config_t struct |
OPENNSL_E_NOT_FOUND | Trap not found |
int opennsl_rx_snoop_set | ( | int | unit, |
int | snoop_cmnd, | ||
opennsl_rx_snoop_config_t * | config | ||
) |
The snoop can be set for given trap-code (e.g.
IGMP), or by other action, like FP, or forwarding lookup.
unit | [IN] Unit number. |
snoop_cmnd | [IN] Snoop command |
config | [IN] Pointer for opennsl_rx_snoop_config_t struct |
OPENNSL_E_UNIT | Illegal unit number |
OPENNSL_E_INIT | Unit not initialized yet |
OPENNSL_E_PARAM | Bad parameter |
OPENNSL_E_XXX | Other error code |
int opennsl_rx_start | ( | int | unit, |
opennsl_rx_cfg_t * | cfg | ||
) |
Start packet reception for the given device.
unit | [IN] Unit number. |
cfg | [IN] Configuration to use (may be NULL) |
OPENNSL_E_NONE | Success; RX is now running on the device |
OPENNSL_E_PARAM | Invalid device or pkt_size/pkts_per_chain is 0 |
OPENNSL_E_MEMORY | Unable to allocate necessary objects for initialization |
Referenced by example_rx_setup(), and main().
int opennsl_rx_stop | ( | int | unit, |
opennsl_rx_cfg_t * | cfg | ||
) |
Stop the RX software module.
unit | [IN] Unit number. |
cfg | [OUT] Saved configuration state |
OPENNSL_E_NONE | Success; RX is no longer running on this device |
void opennsl_rx_trap_config_t_init | ( | opennsl_rx_trap_config_t * | trap_config | ) |
Initialize the rx_trap_config_t structure.
trap_config | [IN,OUT] Trap configuration structure |
int opennsl_rx_trap_get | ( | int | unit, |
int | trap_id, | ||
opennsl_rx_trap_config_t * | config | ||
) |
Get trap configuration according to trap id.
unit | [IN] Unit number. |
trap_id | [IN] Trap id |
config | [OUT] Trap configuration |
OPENNSL_E_NOT_FOUND | Trap not found |
int opennsl_rx_trap_set | ( | int | unit, |
int | trap_id, | ||
opennsl_rx_trap_config_t * | config | ||
) |
Set how to handle packet according to trap type.
unit | [IN] Unit number. |
trap_id | [IN] Trap id |
config | [IN] Trap configuration |
OPENNSL_E_UNIT | Illegal unit number |
OPENNSL_E_INIT | Unit not initialized yet |
OPENNSL_E_PARAM | Bad parameter |
OPENNSL_E_XXX | Other error code |
int opennsl_rx_trap_type_create | ( | int | unit, |
int | flags, | ||
opennsl_rx_trap_t | type, | ||
int * | trap_id | ||
) |
Create trap handle for a given type.
unit | [IN] Unit number. |
flags | [IN] See OPENNSL_RX_TRAP_xxx |
type | [IN] Type of trap see opennsl_rx_trap_t |
trap_id | [IN,OUT] Trap id |
OPENNSL_E_RESOURCE | No more trap-id of given type |
OPENNSL_E_EXISTS | Trap-id already exists |
int opennsl_rx_trap_type_destroy | ( | int | unit, |
int | trap_id | ||
) |
Destroy trap handle for a given trap id.
unit | [IN] Unit number. |
trap_id | [IN] Trap id |
OPENNSL_E_NOT_FOUND | Trap not found |
int opennsl_rx_trap_type_from_id_get | ( | int | unit, |
int | flags, | ||
int | trap_id, | ||
opennsl_rx_trap_t * | trap_type | ||
) |
Get trap type according to trap id.
unit | [IN] Unit number. |
flags | [IN] reserved for future use |
trap_id | [IN] Trap id |
trap_type | [OUT] Trap type |
OPENNSL_E_NOT_FOUND | if trap type not found |
int opennsl_rx_trap_type_get | ( | int | unit, |
int | flags, | ||
opennsl_rx_trap_t | type, | ||
int * | trap_id | ||
) |
Get trap id according to type.
unit | [IN] Unit number. |
flags | [IN] See OPENNSL_RX_TRAP_xxx |
type | [IN] Type of trap see opennsl_rx_trap_t |
trap_id | [OUT] Trap id |
OPENNSL_E_PARAM | Bad parameter |
int opennsl_rx_unregister | ( | int | unit, |
opennsl_rx_cb_f | callback, | ||
uint8 | priority | ||
) |
Register or unregister to receive callbacks for received packets.
unit | [IN] Unit number. |
callback | [IN] Function pointer to be called |
priority | [IN] Relative priority of the callback; 0 is lowest |
OPENNSL_E_NONE | Success |
OPENNSL_E_MEMORY | Could not allocate an entry on the callback list |
OPENNSL_E_PARAM | Register was called with a NULL callback or re-registered with mismatched flags or cookie. |
int opennsl_tx | ( | int | unit, |
opennsl_pkt_t * | tx_pkt, | ||
void * | cookie | ||
) |
Transmit one or more packets.
unit | [IN] Unit number. |
tx_pkt | [IN] A single packet structure |
cookie | [IN] Application data returned with callback |
OPENNSL_E_NONE | Success |
OPENNSL_E_UNIT | Invalid device ID |
OPENNSL_E_MEMORY | Unable to allocate necessary structures for transmit |
OPENNSL_E_PARAM | See |
Referenced by example_pkt_send().