Functions | Variables

software/wrsw_rtud/rtu_drv.c File Reference

#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <hw/switch_hw.h>
#include <hw/wrsw_rtu_wb.h>
#include <hal_client.h>
#include "rtu_drv.h"
#include "wr_rtu_irq.h"

Functions

int shw_fpga_mmap_init ()
static void write_mfifo_addr (uint32_t zbt_addr)
static void write_mfifo_data (uint32_t word)
static uint32_t mac_entry_word0_w (struct filtering_entry *ent)
static uint32_t mac_entry_word1_w (struct filtering_entry *ent)
static uint32_t mac_entry_word2_w (struct filtering_entry *ent)
static uint32_t mac_entry_word3_w (struct filtering_entry *ent)
static uint32_t mac_entry_word4_w (struct filtering_entry *ent)
static void mac_entry_word0_r (uint32_t word, struct filtering_entry *ent)
static void mac_entry_word1_r (uint32_t word, struct filtering_entry *ent)
static void mac_entry_word2_r (uint32_t word, struct filtering_entry *ent)
static void mac_entry_word3_r (uint32_t word, struct filtering_entry *ent)
static void mac_entry_word4_r (uint32_t word, struct filtering_entry *ent)
static uint32_t vlan_entry_word0_w (struct vlan_table_entry *ent)
static uint32_t fpga_rtu_pcr_addr (int port)
int rtu_init (void)
 Initialize HW RTU memory map.
void rtu_exit (void)
int rtu_ufifo_is_empty (void)
 Returns the UFIFO empty flag.
int rtu_read_learning_queue_cnt (void)
 Returns the current learning queue length.
int rtu_read_learning_queue (struct rtu_request *req)
 Reads unrecognised request from UFIFO. Blocks on read if learning queue is empty.
int rtu_read_mfifo_cnt (void)
 Returns the current main hashtable CPU access FIFO (MFIFO) length.
int rtu_mfifo_is_full (void)
 Checks whether the main hashtable CPU access FIFO (MFIFO) is full.
int rtu_mfifo_is_empty (void)
 Checks whether the main hashtable CPU access FIFO (MFIFO) is empty.
void rtu_clean_mfifo (void)
 Cleans MFIFO.
void rtu_write_htab_entry (uint16_t zbt_addr, struct filtering_entry *ent)
 Writes one MAC entry into main hash table at the given address.
void rtu_clean_htab_entry (uint16_t zbt_addr)
 Cleans MAC entry in main hash table at the given address.
void rtu_clean_htab (void)
 Cleans main hash table. Cleans all entries in HTAB inactive bank.
void rtu_read_hcam_entry (uint16_t cam_addr, struct filtering_entry *ent)
 Reads MAC entry from HCAM Hash collisions memory.
void rtu_write_hcam_entry (uint16_t cam_addr, struct filtering_entry *ent)
 Writes MAC entry to HCAM Hash collisions memory.
void rtu_clean_hcam_entry (uint8_t cam_addr)
 Cleans MAC entry in HCAM Hash collisions memory.
void rtu_clean_hcam (void)
 Cleans HCAM. Cleans all entries in HCAM inactive bank.
uint32_t rtu_read_agr_htab (uint32_t addr)
 Read word from aging HTAB. Aging RAM Size: 256 32-bit words.
void rtu_clean_agr_htab (void)
 Clears aging bitmap for HTAB.
uint32_t rtu_read_agr_hcam (void)
 Read aging register for HCAM. Each bit corresponds to one MAC entry in HCAM memory.
void rtu_clean_agr_hcam (void)
 Clears aging register for HCAM.
void rtu_write_vlan_entry (uint32_t addr, struct vlan_table_entry *ent)
 Writes entry to vlan table. VLAN table size: 4096 32-bit words.
void rtu_clean_vlan_entry (uint32_t addr)
 Cleans VLAN entry in VLAN table.
void rtu_clean_vlan (void)
 Cleans VLAN table (drop bit is set to 1)
void rtu_enable (void)
 Enables RTU operation.
void rtu_disable (void)
 Disables RTU operation.
uint16_t rtu_read_hash_poly (void)
 Gets the polynomial used for hash computation in RTU at HW.
void rtu_write_hash_poly (uint16_t hash_poly)
 Sets the polynomial used for hash computation in RTU at HW.
void rtu_set_active_htab_bank (uint8_t bank)
 Set active ZBT bank.
void rtu_set_active_hcam_bank (uint8_t bank)
 Set active CAM bank.
void rtu_set_active_bank (uint8_t bank)
 Set active ZBT and CAM banks at once.
int rtu_set_fixed_prio_on_port (int port, uint8_t prio)
 Sets fixed priority of value 'prio' on indicated port. It overrides the priority coming form the endpoint.
int rtu_unset_fixed_prio_on_port (int port)
 Unsets fixed priority on indicated port. Orders to use priority from the endpoint instead.
int rtu_learn_enable_on_port (int port, int flag)
 Sets the LEARN_EN flag on indicated port.
int rtu_pass_bpdu_on_port (int port, int flag)
 Sets the PASS_BPDU flag on indicated port.
int rtu_pass_all_on_port (int port, int flag)
 Sets the PASS_ALL flag on indicated port.
int rtu_set_unrecognised_behaviour_on_port (int port, int flag)
 Sets the B_UNREC flag on indicated port.
void rtu_enable_irq (void)
void rtu_disable_irq (void)
void rtu_clear_irq (void)

Variables

static int fd

Function Documentation

static uint32_t fpga_rtu_pcr_addr ( int  port ) [static]
static void mac_entry_word0_r ( uint32_t  word,
struct filtering_entry ent 
) [static]
static uint32_t mac_entry_word0_w ( struct filtering_entry ent ) [static]
static void mac_entry_word1_r ( uint32_t  word,
struct filtering_entry ent 
) [static]
static uint32_t mac_entry_word1_w ( struct filtering_entry ent ) [static]
static void mac_entry_word2_r ( uint32_t  word,
struct filtering_entry ent 
) [static]
static uint32_t mac_entry_word2_w ( struct filtering_entry ent ) [static]
static void mac_entry_word3_r ( uint32_t  word,
struct filtering_entry ent 
) [static]
static uint32_t mac_entry_word3_w ( struct filtering_entry ent ) [static]
static void mac_entry_word4_r ( uint32_t  word,
struct filtering_entry ent 
) [static]
static uint32_t mac_entry_word4_w ( struct filtering_entry ent ) [static]
void rtu_clean_agr_hcam ( void   )

Clears aging register for HCAM.

void rtu_clean_agr_htab ( void   )

Clears aging bitmap for HTAB.

void rtu_clean_hcam ( void   )

Cleans HCAM. Cleans all entries in HCAM inactive bank.

void rtu_clean_hcam_entry ( uint8_t  cam_addr )

Cleans MAC entry in HCAM Hash collisions memory.

Parameters:
addrmemory address which shoud be cleaned.
void rtu_clean_htab ( void   )

Cleans main hash table. Cleans all entries in HTAB inactive bank.

void rtu_clean_htab_entry ( uint16_t  zbt_addr )

Cleans MAC entry in main hash table at the given address.

Parameters:
zbt_addrmemory address which shoud be cleaned.
void rtu_clean_mfifo ( void   )

Cleans MFIFO.

void rtu_clean_vlan ( void   )

Cleans VLAN table (drop bit is set to 1)

void rtu_clean_vlan_entry ( uint32_t  addr )

Cleans VLAN entry in VLAN table.

Parameters:
addrmemory address which shoud be cleaned.
void rtu_clear_irq ( void   )
void rtu_disable ( void   )

Disables RTU operation.

void rtu_disable_irq ( void   )
void rtu_enable ( void   )

Enables RTU operation.

void rtu_enable_irq ( void   )
void rtu_exit ( void   )
int rtu_init ( void   )

Initialize HW RTU memory map.

int rtu_learn_enable_on_port ( int  port,
int  flag 
)

Sets the LEARN_EN flag on indicated port.

Parameters:
portport number (0 to 9)
flag0 disables learning. Otherwise: enables learning porcess on this port.
Returns:
error code.
int rtu_mfifo_is_empty ( void   )

Checks whether the main hashtable CPU access FIFO (MFIFO) is empty.

Returns:
1 if MFIFO is empty. 0 otherwise.
int rtu_mfifo_is_full ( void   )

Checks whether the main hashtable CPU access FIFO (MFIFO) is full.

Returns:
1 if MFIFO is full. 0 otherwise.
int rtu_pass_all_on_port ( int  port,
int  flag 
)

Sets the PASS_ALL flag on indicated port.

Parameters:
portport number (0 to 9)
flag0: all packets are dropped. Otherwise: all packets are passed.
Returns:
error code.
int rtu_pass_bpdu_on_port ( int  port,
int  flag 
)

Sets the PASS_BPDU flag on indicated port.

Parameters:
portport number (0 to 9)
flag0: BPDU packets are passed RTU rules only if PASS_ALL is set. Otherwise: BPDU packets are passed according to RTU rules.
Returns:
error code.
uint32_t rtu_read_agr_hcam ( void   )

Read aging register for HCAM. Each bit corresponds to one MAC entry in HCAM memory.

uint32_t rtu_read_agr_htab ( uint32_t  addr )

Read word from aging HTAB. Aging RAM Size: 256 32-bit words.

uint16_t rtu_read_hash_poly ( void   )

Gets the polynomial used for hash computation in RTU at HW.

Returns:
hash_poly hex representation of polynomial
void rtu_read_hcam_entry ( uint16_t  cam_addr,
struct filtering_entry ent 
)

Reads MAC entry from HCAM Hash collisions memory.

Parameters:
entused to store the entry read. Memory should be handled by callee.
cam_addrmemory address which shoud be read.
int rtu_read_learning_queue ( struct rtu_request req )

Reads unrecognised request from UFIFO. Blocks on read if learning queue is empty.

Parameters:
reqpointer to unrecognised request data. Memory handled by callee.
Returns:
error code
int rtu_read_learning_queue_cnt ( void   )

Returns the current learning queue length.

Returns:
Number of unrecognised requests currently in the learning queue.
int rtu_read_mfifo_cnt ( void   )

Returns the current main hashtable CPU access FIFO (MFIFO) length.

Returns:
Number of MAC entries currently in the MFIFO.
void rtu_set_active_bank ( uint8_t  bank )

Set active ZBT and CAM banks at once.

Parameters:
bankactive ZBT and CAM bank (0 or 1). Other values will be evaluated as 1.
void rtu_set_active_hcam_bank ( uint8_t  bank )

Set active CAM bank.

Parameters:
bankactive CAM bank (0 or 1). Other values will be evaluated as 1.
void rtu_set_active_htab_bank ( uint8_t  bank )

Set active ZBT bank.

Parameters:
bankactive ZBT bank (0 or 1). Other values will be evaluated as 1.
int rtu_set_fixed_prio_on_port ( int  port,
uint8_t  prio 
)

Sets fixed priority of value 'prio' on indicated port. It overrides the priority coming form the endpoint.

Parameters:
portport number (0 to 9)
priopriority value
Returns:
error code.
int rtu_set_unrecognised_behaviour_on_port ( int  port,
int  flag 
)

Sets the B_UNREC flag on indicated port.

Parameters:
portport number (0 to 9)
flag0: packet is dropped. Otherwise: packet is broadcast.
Returns:
error code.
int rtu_ufifo_is_empty ( void   )

Returns the UFIFO empty flag.

Returns:
Value of UFIFO empty flag.
int rtu_unset_fixed_prio_on_port ( int  port )

Unsets fixed priority on indicated port. Orders to use priority from the endpoint instead.

Parameters:
portport number (0 to 9)
Returns:
error code.
void rtu_write_hash_poly ( uint16_t  hash_poly )

Sets the polynomial used for hash computation in RTU at HW.

Parameters:
hash_polyhex representation of polynomial
void rtu_write_hcam_entry ( uint16_t  cam_addr,
struct filtering_entry ent 
)

Writes MAC entry to HCAM Hash collisions memory.

Parameters:
entMAC table entry to be written to HCAM.
cam_addrmemory address in which MAC entry shoud be added.
void rtu_write_htab_entry ( uint16_t  zbt_addr,
struct filtering_entry ent 
)

Writes one MAC entry into main hash table at the given address.

Parameters:
entMAC table entry to be written to MFIFO.
zbt_addrZBT SRAM memory address in which MAC entry shoud be added.
void rtu_write_vlan_entry ( uint32_t  addr,
struct vlan_table_entry ent 
)

Writes entry to vlan table. VLAN table size: 4096 32-bit words.

Parameters:
addrentry memory address
int shw_fpga_mmap_init (  )
static uint32_t vlan_entry_word0_w ( struct vlan_table_entry ent ) [static]
static void write_mfifo_addr ( uint32_t  zbt_addr ) [static]
static void write_mfifo_data ( uint32_t  word ) [static]

Variable Documentation

int fd [static]
 All Data Structures Files Functions Variables Defines