OpenNSL API Guide and Reference Manual
Macros | Functions | Variables
example_rx_packet_cpu.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sal/driver.h>
#include <sal/version.h>
#include <opennsl/error.h>
#include <opennsl/vlan.h>
#include <opennsl/port.h>
#include <opennsl/switch.h>
#include <opennsl/pkt.h>
#include <opennsl/rx.h>
#include <examples/util.h>

Go to the source code of this file.

Macros

#define DEFAULT_UNIT   0
 
#define DEFAULT_VLAN   1
 
#define MAX_DIGITS_IN_CHOICE   5
 

Functions

int example_pkt_start_get (unsigned int unit, unsigned char *pkt, int len, unsigned char *user_header, unsigned int *offset)
 Strip FTMH and User Header etc and get the start ethernet packet.
 
opennsl_rx_t example_rx_packet_receive (int unit, opennsl_pkt_t *pkt, void *cookie)
 Packet receive callback function.
 
int example_rx_setup (int unit)
 Setup up the system for packet reception.
 
int main (int argc, char *argv[])
 Main function for packet reception.
 

Variables

char example_usage []
 

Macro Definition Documentation

#define DEFAULT_UNIT   0

Definition at line 39 of file example_rx_packet_cpu.c.

Referenced by main().

#define DEFAULT_VLAN   1

Definition at line 40 of file example_rx_packet_cpu.c.

Referenced by main().

#define MAX_DIGITS_IN_CHOICE   5

Definition at line 41 of file example_rx_packet_cpu.c.

Function Documentation

int example_pkt_start_get ( unsigned int  unit,
unsigned char *  pkt,
int  len,
unsigned char *  user_header,
unsigned int *  offset 
)

Strip FTMH and User Header etc and get the start ethernet packet.

Parameters
[IN]unit unit number
[IN]pkt Pointer to packet data
[IN]len Length of the packet
[OUT]user_header Pointer to User Header start
[OUT]offset Offset to ethernet header length of FTMH+ User Header etc
Returns
OPENNSL_E_XXX OpenNSL API return code

Definition at line 68 of file example_rx_packet_cpu.c.

Referenced by example_rx_packet_receive().

opennsl_rx_t example_rx_packet_receive ( int  unit,
opennsl_pkt_t pkt,
void *  cookie 
)

Packet receive callback function.

Parameters
unit[IN] Unit number
pkt[IN] Pointer to packet data
cookie[IN] Cookie
Returns
OPENNSL_E_XXX OpenNSL API return code

Definition at line 169 of file example_rx_packet_cpu.c.

References opennsl_pkt_s::cos, opennsl_pkt_blk_s::data, example_pkt_start_get(), opennsl_pkt_blk_s::len, OPENNSL_RX_HANDLED, opennsl_pkt_s::pkt_data, opennsl_pkt_s::pkt_len, opennsl_pkt_s::rx_port, opennsl_pkt_s::src_port, and opennsl_pkt_s::tot_len.

Referenced by example_rx_setup().

int example_rx_setup ( int  unit)
int main ( int  argc,
char *  argv[] 
)

Variable Documentation

char example_usage[]
Initial value:
=
"Syntax: example_rx_packet_cpu \n\r"
" \n\r"
"Paramaters: None. \n\r"
" \n\r"
"Example: The following command is used to demonstrate receiving a \n\r"
" packet to CPU. \n\r"
" example_rx_packet_cpu \n\r"
" \n\r"
"Usage Guidelines: None. \n\r"

Definition at line 43 of file example_rx_packet_cpu.c.