#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 |
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.
addr | memory 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.
zbt_addr | memory 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.
addr | memory 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.
port | port number (0 to 9) |
flag | 0 disables learning. Otherwise: enables learning porcess on this port. |
int rtu_mfifo_is_empty | ( | void | ) |
Checks whether the main hashtable CPU access FIFO (MFIFO) is empty.
int rtu_mfifo_is_full | ( | void | ) |
Checks whether the main hashtable CPU access FIFO (MFIFO) is full.
int rtu_pass_all_on_port | ( | int | port, |
int | flag | ||
) |
Sets the PASS_ALL flag on indicated port.
port | port number (0 to 9) |
flag | 0: all packets are dropped. Otherwise: all packets are passed. |
int rtu_pass_bpdu_on_port | ( | int | port, |
int | flag | ||
) |
Sets the PASS_BPDU flag on indicated port.
port | port number (0 to 9) |
flag | 0: BPDU packets are passed RTU rules only if PASS_ALL is set. Otherwise: BPDU packets are passed according to RTU rules. |
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.
void rtu_read_hcam_entry | ( | uint16_t | cam_addr, |
struct filtering_entry * | ent | ||
) |
Reads MAC entry from HCAM Hash collisions memory.
ent | used to store the entry read. Memory should be handled by callee. |
cam_addr | memory 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.
req | pointer to unrecognised request data. Memory handled by callee. |
int rtu_read_learning_queue_cnt | ( | void | ) |
Returns the current learning queue length.
int rtu_read_mfifo_cnt | ( | void | ) |
Returns the current main hashtable CPU access FIFO (MFIFO) length.
void rtu_set_active_bank | ( | uint8_t | bank ) |
Set active ZBT and CAM banks at once.
bank | active 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.
bank | active 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.
bank | active 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.
port | port number (0 to 9) |
prio | priority value |
int rtu_set_unrecognised_behaviour_on_port | ( | int | port, |
int | flag | ||
) |
Sets the B_UNREC flag on indicated port.
port | port number (0 to 9) |
flag | 0: packet is dropped. Otherwise: packet is broadcast. |
int rtu_ufifo_is_empty | ( | void | ) |
Returns the 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.
port | port number (0 to 9) |
void rtu_write_hash_poly | ( | uint16_t | hash_poly ) |
Sets the polynomial used for hash computation in RTU at HW.
hash_poly | hex representation of polynomial |
void rtu_write_hcam_entry | ( | uint16_t | cam_addr, |
struct filtering_entry * | ent | ||
) |
Writes MAC entry to HCAM Hash collisions memory.
ent | MAC table entry to be written to HCAM. |
cam_addr | memory 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.
ent | MAC table entry to be written to MFIFO. |
zbt_addr | ZBT 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.
addr | entry 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] |
int fd [static] |