Commit e5ac1fea authored by Adam Wujek's avatar Adam Wujek 💬

userspace/snmpd: change the name of wrsPstatsTable to wrsPstatsHCTable

HC will use 64bit counters.
Rename files and make them compile.
wrsPstatsHCTable will go to .7.7 in MIB
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 2da6c927
......@@ -45,7 +45,7 @@ SOURCES = \
wrsStartCntGroup.c \
wrsSpllVersionGroup.c \
wrsSpllStatusGroup.c \
wrsPstatsTable.c \
wrsPstatsHCTable.c \
wrsPtpDataTable.c \
wrsPortStatusTable.c \
init.c \
......
......@@ -23,9 +23,9 @@
#include "wrsStartCntGroup.h"
#include "wrsSpllVersionGroup.h"
#include "wrsSpllStatusGroup.h"
#include "wrsPstatsTable.h"
#include "wrsPtpDataTable.h"
#include "wrsPortStatusTable.h"
#include "wrsPstatsHCTable.h"
#define DOTCONFIG_FILE "/wr/etc/dot-config"
......@@ -55,9 +55,9 @@ void init_wrsSnmp(void)
init_wrsStartCntGroup();
init_wrsSpllVersionGroup();
init_wrsSpllStatusGroup();
init_wrsPstatsTable();
init_wrsPtpDataTable();
init_wrsPortStatusTable();
init_wrsPstatsHCTable();
/* perform first reads, needed to calculate deltas later */
wrsTimingStatus_data_fill();
......
#include "wrsSnmp.h"
#include "wrsPortStatusTable.h"
#include "wrsPstatsTable.h"
#include "wrsPstatsHCTable.h"
#include "wrsNetworkingStatusGroup.h"
#include <libwr/config.h>
......@@ -15,7 +15,7 @@ struct wrsNetworkingStatus_s wrsNetworkingStatus_s;
static struct wrsNetworkingStatus_config ns_dotconfig;
static struct ns_pstats ns_pstats_copy[WRS_N_PORTS];
static void copy_pstats(struct ns_pstats *copy, struct wrsPstatsTable_s *org,
static void copy_pstats(struct ns_pstats *copy, struct wrsPstatsHCTable_s *org,
unsigned int rows)
{
int i;
......@@ -48,7 +48,8 @@ static void copy_pstats(struct ns_pstats *copy, struct wrsPstatsTable_s *org,
}
static int get_endpoint_status(struct ns_pstats *old,
struct wrsPstatsTable_s *new, unsigned int rows,
struct wrsPstatsHCTable_s *new,
unsigned int rows,
float t_delta)
{
int i;
......@@ -80,8 +81,9 @@ static int get_endpoint_status(struct ns_pstats *old,
/* don't use this function for now, return OK */
static int get_swcore_status(struct ns_pstats *old,
struct wrsPstatsTable_s *new, unsigned int rows,
float t_delta)
struct wrsPstatsHCTable_s *new,
unsigned int rows,
float t_delta)
{
int i;
int ret;
......@@ -134,8 +136,8 @@ static int get_swcore_status(struct ns_pstats *old,
}
static int get_rtu_status(struct ns_pstats *old,
struct wrsPstatsTable_s *new, unsigned int rows,
float t_delta)
struct wrsPstatsHCTable_s *new, unsigned int rows,
float t_delta)
{
int i;
int ret;
......@@ -195,7 +197,7 @@ time_t wrsNetworkingStatus_data_fill(void)
static int run_once = 1;
time_port_status = wrsPortStatusTable_data_fill(&port_status_nrows);
time_pstats = wrsPstatsTable_data_fill(&pstats_nrows);
time_pstats = wrsPstatsHCTable_data_fill(&pstats_nrows);
if (time_port_status <= time_update
&& time_pstats <= time_update) {
......
#include "wrsSnmp.h"
#include "wrsPstatsTable.h"
#include "wrsPstatsHCTable.h"
struct wrsPstatsTable_s pstats_array[WRS_N_PORTS];
struct wrsPstatsHCTable_s pstats_array[WRS_N_PORTS];
static struct pickinfo wrsPstatsTable_pickinfo[] = {
static struct pickinfo wrsPstatsHCTable_pickinfo[] = {
/* Warning: strings are a special case for snmp format */
FIELD(wrsPstatsTable_s, ASN_UNSIGNED, index), /* not reported */
FIELD(wrsPstatsTable_s, ASN_OCTET_STR, port_name),
FIELD(wrsPstatsTable_s, ASN_COUNTER, TXUnderrun),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXOverrun),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXInvalidCode),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXSyncLost),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXPauseFrames),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXPfilterDropped),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXPCSErrors),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXGiantFrames),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXRuntFrames),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXCRCErrors),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXPclass0),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXPclass1),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXPclass2),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXPclass3),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXPclass4),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXPclass5),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXPclass6),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXPclass7),
FIELD(wrsPstatsTable_s, ASN_COUNTER, TXFrames),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXFrames),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXDropRTUFull),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXPrio0),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXPrio1),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXPrio2),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXPrio3),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXPrio4),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXPrio5),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXPrio6),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RXPrio7),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RTUValid),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RTUResponses),
FIELD(wrsPstatsTable_s, ASN_COUNTER, RTUDropped),
FIELD(wrsPstatsTable_s, ASN_COUNTER, FastMatchPriority),
FIELD(wrsPstatsTable_s, ASN_COUNTER, FastMatchFastForward),
FIELD(wrsPstatsTable_s, ASN_COUNTER, FastMatchNonForward),
FIELD(wrsPstatsTable_s, ASN_COUNTER, FastMatchRespValid),
FIELD(wrsPstatsTable_s, ASN_COUNTER, FullMatchRespValid),
FIELD(wrsPstatsTable_s, ASN_COUNTER, Forwarded),
FIELD(wrsPstatsTable_s, ASN_COUNTER, TRURespValid),
FIELD(wrsPstatsHCTable_s, ASN_UNSIGNED, index), /* not reported */
FIELD(wrsPstatsHCTable_s, ASN_OCTET_STR, port_name),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, TXUnderrun),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXOverrun),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXInvalidCode),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXSyncLost),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXPauseFrames),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXPfilterDropped),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXPCSErrors),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXGiantFrames),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXRuntFrames),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXCRCErrors),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXPclass0),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXPclass1),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXPclass2),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXPclass3),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXPclass4),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXPclass5),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXPclass6),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXPclass7),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, TXFrames),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXFrames),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXDropRTUFull),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXPrio0),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXPrio1),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXPrio2),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXPrio3),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXPrio4),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXPrio5),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXPrio6),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RXPrio7),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RTUValid),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RTUResponses),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, RTUDropped),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, FastMatchPriority),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, FastMatchFastForward),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, FastMatchNonForward),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, FastMatchRespValid),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, FullMatchRespValid),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, Forwarded),
FIELD(wrsPstatsHCTable_s, ASN_COUNTER, TRURespValid),
};
time_t
wrsPstatsTable_data_fill(unsigned int *n_rows)
wrsPstatsHCTable_data_fill(unsigned int *n_rows)
{
FILE *f;
char fname[32];
......@@ -66,7 +66,7 @@ wrsPstatsTable_data_fill(unsigned int *n_rows)
time_cur = get_monotonic_sec();
if (time_update
&& time_cur - time_update < WRSPSTATSTABLE_CACHE_TIMEOUT) {
&& time_cur - time_update < WRSPSTATSHCTABLE_CACHE_TIMEOUT) {
/* cache not updated, return last update time */
return time_update;
}
......@@ -176,12 +176,12 @@ wrsPstatsTable_data_fill(unsigned int *n_rows)
return time_update;
}
#define TT_OID WRSPSTATSTABLE_OID
#define TT_PICKINFO wrsPstatsTable_pickinfo
#define TT_DATA_FILL_FUNC wrsPstatsTable_data_fill
#define TT_OID WRSPSTATSHCTABLE_OID
#define TT_PICKINFO wrsPstatsHCTable_pickinfo
#define TT_DATA_FILL_FUNC wrsPstatsHCTable_data_fill
#define TT_DATA_ARRAY pstats_array
#define TT_GROUP_NAME "wrsPstatsTable"
#define TT_INIT_FUNC init_wrsPstatsTable
#define TT_CACHE_TIMEOUT WRSPSTATSTABLE_CACHE_TIMEOUT
#define TT_GROUP_NAME "wrsPstatsHCTable"
#define TT_INIT_FUNC init_wrsPstatsHCTable
#define TT_CACHE_TIMEOUT WRSPSTATSHCTABLE_CACHE_TIMEOUT
#include "wrsTableTemplate.h"
#ifndef WRS_PSTATS_TABLE_H
#define WRS_PSTATS_TABLE_H
#ifndef WRS_PSTATS_HC_TABLE_H
#define WRS_PSTATS_HC_TABLE_H
#define WRSPSTATSTABLE_CACHE_TIMEOUT 5
#define WRSPSTATSTABLE_OID WRS_OID, 7, 4
#define WRSPSTATSHCTABLE_CACHE_TIMEOUT 5
#define WRSPSTATSHCTABLE_OID WRS_OID, 7, 7
#define PSTATS_MAX_N_COUNTERS 39 /* maximum number of counters */
#define PSTATS_SYSCTL_PATH "/proc/sys/pstats/" /* Path to sysclt entries */
......@@ -10,7 +10,7 @@
* and number of counters */
struct wrsPstatsTable_s {
struct wrsPstatsHCTable_s {
uint32_t index; /* not reported, index fields has to be marked
* as not-accessible in MIB */
char port_name[12]; /* port name of counters */
......@@ -55,8 +55,8 @@ struct wrsPstatsTable_s {
uint32_t TRURespValid;
};
extern struct wrsPstatsTable_s pstats_array[WRS_N_PORTS];
time_t wrsPstatsTable_data_fill(unsigned int *rows);
void init_wrsPstatsTable(void);
extern struct wrsPstatsHCTable_s pstats_array[WRS_N_PORTS];
time_t wrsPstatsHCTable_data_fill(unsigned int *rows);
void init_wrsPstatsHCTable(void);
#endif /* WRS_PSTATS_TABLE_H */
#endif /* WRS_PSTATS_HC_TABLE_H */
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