Commit e84232f0 authored by Adam Wujek's avatar Adam Wujek 💬 Committed by Alessandro Rubini

userspace/libwr: update structure names in rtu_shmem.h

Add "rtu_" to structure names in rtu_shmem.h and change all users.
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 17580b18
......@@ -21,7 +21,7 @@ struct rtu_addr {
/**
* \brief RTU Filtering Database Entry Object
*/
struct filtering_entry {
struct rtu_filtering_entry {
struct rtu_addr addr; /* address of self in the RTU hashtable */
int valid; /* bit: 1 = entry is valid, 0: entry is
......@@ -77,7 +77,7 @@ struct filtering_entry {
/**
* \brief RTU VLAN registration entry object
*/
struct vlan_table_entry {
struct rtu_vlan_table_entry {
uint32_t port_mask; /* VLAN port mask:
* 1 = ports assigned to this VLAN */
uint8_t fid; /* Filtering Database Identifier */
......
......@@ -78,9 +78,9 @@ struct rtu_request {
* \brief Copies src filtering entry body into dst filtering entry body.
* @return pointer to dst filtering entry.
*/
static inline
struct filtering_entry *rtu_fe_copy(struct filtering_entry *dst,
struct filtering_entry *src)
static inline struct rtu_filtering_entry *rtu_fe_copy(
struct rtu_filtering_entry *dst,
struct rtu_filtering_entry *src)
{
return memcpy(dst, src, sizeof(*src));
}
......@@ -90,7 +90,8 @@ static inline
* @param ent pointer to entry to clean (either in HCAM or HTAB)
* @return pointer to filtering entry that was cleaned
*/
static inline struct filtering_entry *rtu_fe_clean(struct filtering_entry *ent)
static inline struct rtu_filtering_entry *rtu_fe_clean(
struct rtu_filtering_entry *ent)
{
return memset(ent, 0, sizeof(*ent));
}
......
......@@ -56,11 +56,11 @@
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 uint32_t mac_entry_word0_w(struct rtu_filtering_entry *ent);
static uint32_t mac_entry_word1_w(struct rtu_filtering_entry *ent);
static uint32_t mac_entry_word2_w(struct rtu_filtering_entry *ent);
static uint32_t mac_entry_word3_w(struct rtu_filtering_entry *ent);
static uint32_t mac_entry_word4_w(struct rtu_filtering_entry *ent);
/*
* Used to communicate to RTU UFIFO IRQ handler device at kernel space
......@@ -293,7 +293,7 @@ static void flush_mfifo()
* @param ent MAC table entry to be written to MFIFO.
* @param zbt_addr ZBT SRAM memory address in which MAC entry shoud be added.
*/
void rtu_write_htab_entry(uint16_t zbt_addr, struct filtering_entry *ent,
void rtu_write_htab_entry(uint16_t zbt_addr, struct rtu_filtering_entry *ent,
int flush)
{
write_mfifo_addr(zbt_addr);
......@@ -356,7 +356,7 @@ void rtu_read_aging_bitmap(uint32_t * bitmap)
* VLAN table size: 4096 32-bit words.
* @param addr entry memory address
*/
void rtu_write_vlan_entry(int vid, struct vlan_table_entry *ent)
void rtu_write_vlan_entry(int vid, struct rtu_vlan_table_entry *ent)
{
uint32_t vtr1 = 0, vtr2 = 0;
......@@ -583,7 +583,7 @@ static void write_mfifo_data(uint32_t word)
// to marshall MAC entries
static uint32_t mac_entry_word0_w(struct filtering_entry *ent)
static uint32_t mac_entry_word0_w(struct rtu_filtering_entry *ent)
{
return
((0xFF & ent->mac[0]) << 24) |
......@@ -593,7 +593,7 @@ static uint32_t mac_entry_word0_w(struct filtering_entry *ent)
((0x1 & ent->end_of_bucket) << 1) | ((0x1 & ent->valid));
}
static uint32_t mac_entry_word1_w(struct filtering_entry *ent)
static uint32_t mac_entry_word1_w(struct rtu_filtering_entry *ent)
{
return
((0xFF & ent->mac[2]) << 24) |
......@@ -601,7 +601,7 @@ static uint32_t mac_entry_word1_w(struct filtering_entry *ent)
((0xFF & ent->mac[4]) << 8) | ((0xFF & ent->mac[5]));
}
static uint32_t mac_entry_word2_w(struct filtering_entry *ent)
static uint32_t mac_entry_word2_w(struct rtu_filtering_entry *ent)
{
return
((0x1 & ent->drop_when_dest) << 28) |
......@@ -614,14 +614,14 @@ static uint32_t mac_entry_word2_w(struct filtering_entry *ent)
((0x7 & ent->prio_src) << 17) | ((0x1 & ent->has_prio_src) << 16);
}
static uint32_t mac_entry_word3_w(struct filtering_entry *ent)
static uint32_t mac_entry_word3_w(struct rtu_filtering_entry *ent)
{
return
((0xFFFF & ent->port_mask_dst) << 16) |
((0xFFFF & ent->port_mask_src));
}
static uint32_t mac_entry_word4_w(struct filtering_entry *ent)
static uint32_t mac_entry_word4_w(struct rtu_filtering_entry *ent)
{
return
((0xFFFF & (ent->port_mask_dst >> 16)) << 16) |
......
......@@ -49,7 +49,7 @@ int rtu_read_learning_queue(struct rtu_request *req);
// HTAB access
void rtu_write_htab_entry(uint16_t zbt_addr, struct filtering_entry *ent,
void rtu_write_htab_entry(uint16_t zbt_addr, struct rtu_filtering_entry *ent,
int flush);
void rtu_clean_htab(void);
......@@ -59,7 +59,7 @@ void rtu_read_aging_bitmap(uint32_t * bitmap);
// VLAN TABLE
void rtu_write_vlan_entry(int vid, struct vlan_table_entry *ent);
void rtu_write_vlan_entry(int vid, struct rtu_vlan_table_entry *ent);
void rtu_clean_vlan_entry(int vid);
void rtu_clean_vlan(void);
......
......@@ -53,7 +53,8 @@
*/
struct fd_handle {
struct rtu_addr addr;
struct filtering_entry *entry_ptr; // pointer to entry at mirror fd
struct rtu_filtering_entry *entry_ptr; /* pointer to entry at mirror
* fd */
};
/**
......@@ -76,7 +77,7 @@ struct hw_req *hw_req_list;
* Main filtering table organized as hash table with 4-entry buckets.
* Note both banks have the same content. Therefore SW only mirrors one bank.
*/
static struct filtering_entry rtu_htab[HTAB_ENTRIES][RTU_BUCKETS];
static struct rtu_filtering_entry rtu_htab[HTAB_ENTRIES][RTU_BUCKETS];
/**
* \brief Max time that a dynamic MAC entry can remain
......@@ -87,7 +88,7 @@ static unsigned long aging_time = DEFAULT_AGING_TIME;
/**
* Mirror of VLAN table
*/
static struct vlan_table_entry vlan_tab[NUM_VLANS];
static struct rtu_vlan_table_entry vlan_tab[NUM_VLANS];
/**
* \brief Mutex used to synchronise concurrent access to the filtering database.
......@@ -97,7 +98,7 @@ static pthread_mutex_t fd_mutex;
static struct hw_req *tail(struct hw_req *head);
static void clean_list(struct hw_req *head);
static int hw_request(int type, struct rtu_addr addr,
struct filtering_entry *ent);
struct rtu_filtering_entry *ent);
static void clean_fd(void);
static void clean_vd(void);
......@@ -138,13 +139,13 @@ int rtu_fd_init(uint16_t poly, unsigned long aging)
}
static int htab_search(uint8_t mac[ETH_ALEN],
uint8_t fid, struct filtering_entry **ent)
uint8_t fid, struct rtu_filtering_entry **ent)
{
int i, j;
for (i = 0; i < HTAB_ENTRIES; i++)
for (j = 0; j < RTU_BUCKETS; j++) {
struct filtering_entry *tmp = &rtu_htab[i][j];
struct rtu_filtering_entry *tmp = &rtu_htab[i][j];
if (!tmp->valid)
continue;
......@@ -181,7 +182,7 @@ static int htab_count_buckets(struct rtu_addr addr)
int rtu_fd_create_entry(uint8_t mac[ETH_ALEN], uint16_t vid, uint32_t port_mask,
int dynamic, int at_existing_entry)
{
struct filtering_entry *ent; // pointer to scan hashtable
struct rtu_filtering_entry *ent; /* pointer to scan hashtable */
uint8_t fid; // Filtering database identifier
int ret = 0; // return value
uint32_t mask_src, mask_dst; // used to check port masks update
......@@ -297,7 +298,7 @@ void rtu_fd_flush(void)
pthread_mutex_unlock(&fd_mutex);
}
struct filtering_entry *rtu_fd_lookup_htab_entry(int index)
struct rtu_filtering_entry *rtu_fd_lookup_htab_entry(int index)
{
int i, j, n = 0;
......@@ -343,7 +344,7 @@ static void clean_list(struct hw_req *head)
}
static int hw_request(int type, struct rtu_addr addr,
struct filtering_entry *ent)
struct rtu_filtering_entry *ent)
{
struct hw_req *req;
......@@ -465,7 +466,7 @@ void rtu_fd_clear_entries_for_port(int dest_port)
{
int i; // loop index
int j; // bucket loop index
struct filtering_entry *ent; // pointer to scan tables
struct rtu_filtering_entry *ent; /* pointer to scan tables */
for (i = HTAB_ENTRIES; i-- > 0;) {
for (j = RTU_BUCKETS; j-- > 0;) {
......@@ -494,7 +495,7 @@ static void rtu_fd_age_out(void)
{
int i; // loop index
int j; // bucket loop index
struct filtering_entry *ent; // pointer to scan tables
struct rtu_filtering_entry *ent; /* pointer to scan tables */
unsigned long t; // (secs)
t = now() - aging_time;
......@@ -530,13 +531,13 @@ static void delete_htab_entry(struct rtu_addr addr)
addr.bucket);
memset(&rtu_htab[addr.hash][addr.bucket], 0,
sizeof(struct filtering_entry));
sizeof(struct rtu_filtering_entry));
if (addr.bucket < n_buckets - 1)
memmove(&rtu_htab[addr.hash][addr.bucket],
&rtu_htab[addr.hash][addr.bucket + 1],
(n_buckets - addr.bucket -
1) * sizeof(struct filtering_entry));
1) * sizeof(struct rtu_filtering_entry));
for (i = 0; i < n_buckets; i++) {
struct rtu_addr a;
......@@ -628,7 +629,7 @@ void rtu_fd_create_vlan_entry(int vid, uint32_t port_mask, uint8_t fid,
* @param vid VLAN ID
* @return entry of VLAN table at given VID-address
*/
struct vlan_table_entry *rtu_vlan_entry_get(int vid)
struct rtu_vlan_table_entry *rtu_vlan_entry_get(int vid)
{
// First entry reserved for untagged packets.
if (vid > NUM_VLANS)
......
......@@ -62,15 +62,15 @@ void rtu_fd_set_hash_poly(uint16_t poly);
void rtu_fd_flush(void);
void rtu_fd_clear_entries_for_port(int dest_port);
struct filtering_entry *rtu_fd_lookup_htab_entry(int index);
struct rtu_filtering_entry *rtu_fd_lookup_htab_entry(int index);
struct filtering_entry *rtu_fd_lookup_htab_entry(int index);
struct rtu_filtering_entry *rtu_fd_lookup_htab_entry(int index);
void rtu_fd_create_vlan_entry(int vid, uint32_t port_mask, uint8_t fid,
uint8_t prio, int has_prio, int prio_override,
int drop);
void vlan_entry_rd(int vid);
struct vlan_table_entry *rtu_vlan_entry_get(int vid);
struct rtu_vlan_table_entry *rtu_vlan_entry_get(int vid);
#endif /*__WHITERABBIT_RTU_FD_H*/
......@@ -57,7 +57,7 @@ int rtudexp_get_fd_list(const struct minipc_pd *pd, uint32_t * args, void *ret)
pr_info("GetFDList start=%d\n", start_from);
for (i = 0; i < 8; i++) {
struct filtering_entry *ent =
struct rtu_filtering_entry *ent =
rtu_fd_lookup_htab_entry(start_from + i);
if (!ent)
break;
......@@ -90,7 +90,7 @@ int rtudexp_get_vd_list(const struct minipc_pd *pd, uint32_t * args, void *ret)
pr_info("GetVDList start=%d\n", current);
do {
struct vlan_table_entry *ent = rtu_vlan_entry_get(current);
struct rtu_vlan_table_entry *ent = rtu_vlan_entry_get(current);
if (!ent)
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment