Defines | Functions

# software/wrsw_rtud/rtu_drv.h File Reference

`#include "rtu.h"`

Go to the source code of this file.

## Defines
#define | RTU_HCAM 0x4000
#define | RTU_ARAM_MAIN 0x8000
#define | RTU_VLAN_TAB 0xc000
#define | RTU_MFIFO_R0_DATA_SEL 0x00000000
#define | RTU_MFIFO_R1_ADDR_MASK 0x0007FFFF
#define | RTU_DEVNAME "/dev/wr_rtu"
## Functions
int | rtu_init (void) __attribute__((warn_unused_result))
| 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.
void | rtu_write_hash_poly (uint16_t hash_poly)
| Sets the polynomial used for hash computation in RTU at HW.
uint16_t | rtu_read_hash_poly (void)
| Gets 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) __attribute__((warn_unused_result))
| 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) __attribute__((warn_unused_result))
| Unsets fixed priority on indicated port. Orders to use priority from the endpoint instead.
int | rtu_learn_enable_on_port (int port, int flag) __attribute__((warn_unused_result))
| Sets the LEARN_EN flag on indicated port.
int | rtu_pass_bpdu_on_port (int port, int flag) __attribute__((warn_unused_result))
| Sets the PASS_BPDU flag on indicated port.
int | rtu_pass_all_on_port (int port, int pass_all) __attribute__((warn_unused_result))
| Sets the PASS_ALL flag on indicated port.
int | rtu_set_unrecognised_behaviour_on_port (int port, int flag) __attribute__((warn_unused_result))
| Sets the B_UNREC flag on indicated port.
void | rtu_enable_irq (void)
void | rtu_disable_irq (void)
void | rtu_clear_irq (void)

## Define Documentation

#define RTU_ARAM_MAIN 0x8000

#define RTU_DEVNAME "/dev/wr_rtu"

#define RTU_HCAM 0x4000

#define RTU_MFIFO_R0_DATA_SEL 0x00000000

#define RTU_MFIFO_R1_ADDR_MASK 0x0007FFFF

#define RTU_VLAN_TAB 0xc000

## Function Documentation

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:

  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.

Parameters:

  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.

Parameters:

  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.

Parameters:

  port | port number (0 to 9)
  flag | 0 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:

  port | port number (0 to 9)
  flag | 0: 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:

  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.

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:

  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.

Parameters:

  req | pointer 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:

  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.

Parameters:

  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.

Parameters:

  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.

Parameters:

  port | port number (0 to 9)
  prio | priority value

Returns:
  error code.

int rtu_set_unrecognised_behaviour_on_port | ( | int | port,
|  | int | flag
| ) |  |

Sets the B_UNREC flag on indicated port.

Parameters:

  port | port number (0 to 9)
  flag | 0: 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:

  port | port 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_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.

Parameters:

  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.

Parameters:

  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.

Parameters:

  addr | entry memory address

All Data Structures Files Functions Variables Defines