Commit 6fecc497 authored by Michal Wasiak's avatar Michal Wasiak Committed by Adam Wujek

RTU: add a timestamp of VLAN creation to shmem

To be used by SNMP
Signed-off-by: 's avatarMichal Wasiak <michal.wasiak@gmail.com>
parent 7a4b73d8
......@@ -2,6 +2,7 @@
#define __LIBWR_RTU_SHMEM_H__
#include <stdint.h>
#include <sys/time.h>
#define RTU_ENTRIES 2048
#define RTU_BUCKETS 4
......@@ -161,6 +162,7 @@ struct rtu_vlan_table_entry {
int prio_override; /* priority override
* (force per-VLAN priority) */
int drop; /* 1: drop the packet (VLAN not registered) */
struct timeval creation_time; /* timestamp of creation, used by SNMP */
};
/**
......@@ -186,7 +188,7 @@ struct rtu_port_entry {
};
/* This is the overall structure stored in shared memory */
#define RTU_SHMEM_VERSION 6 /* Version 6, remove *_offset */
#define RTU_SHMEM_VERSION 7 /* Version 7, add vlan creation_time */
struct rtu_shmem_header {
struct rtu_filtering_entry *filters;
struct rtu_vlan_table_entry *vlans;
......
......@@ -644,6 +644,7 @@ struct dump_info vlan_info[] = {
DUMP_FIELD(yes_no, has_prio),
DUMP_FIELD(yes_no, prio_override),
DUMP_FIELD(yes_no, drop),
DUMP_FIELD(timeval, creation_time),
};
#undef DUMP_STRUCT
......
......@@ -835,6 +835,9 @@ void rtu_fd_create_vlan_entry(int vid, uint32_t port_mask, uint8_t fid,
#define rtu_rd(reg) \
_fpga_readl(FPGA_BASE_RTU + offsetof(struct RTU_WB, reg))
int port_num = RTU_PSR_N_PORTS_R(rtu_rd(PSR));
struct timespec tv;
clock_gettime(CLOCK_MONOTONIC, &tv);
wrs_shm_write(rtu_shmem_p, WRS_SHM_WRITE_BEGIN);
/****************************************************************************************/
if (port_mask == 0x0 && drop == 1)
......@@ -846,6 +849,8 @@ void rtu_fd_create_vlan_entry(int vid, uint32_t port_mask, uint8_t fid,
vlan_tab[vid].has_prio = has_prio;
vlan_tab[vid].prio_override = prio_override;
vlan_tab[vid].prio = prio;
vlan_tab[vid].creation_time.tv_sec = tv.tv_sec;
vlan_tab[vid].creation_time.tv_usec = tv.tv_nsec / 1000;
rtu_write_vlan_entry(vid, &vlan_tab[vid]);
wrs_shm_write(rtu_shmem_p, WRS_SHM_WRITE_END);
......
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