Commit 7723f724 authored by Grzegorz Daniluk's avatar Grzegorz Daniluk Committed by Adam Wujek

userspace/snmpd: NetworkingStatus now also monitoring Tx frames vs RTU & NIC forwards

It requires update of FPGA's bitstream. At least to the one including the
commit from wr-switch-hdl repo:
d6cf3c7 adding rmon events in NIC for per-port tx frames
parent 12b80416
......@@ -48,6 +48,10 @@ static void copy_pstats(struct ns_pstats *copy, struct wrsPstatsHCTable_s *org,
/* wrsRTUStatus */
copy->wrsPstatsHCRXDropRTUFull = org->wrsPstatsHCRXDropRTUFull;
copy->wrsPstatsHCTXFrames = org->wrsPstatsHCTXFrames;
copy->wrsPstatsHCForwarded = org->wrsPstatsHCForwarded;
copy->wrsPstatsHCNICTXFrames = org->wrsPstatsHCNICTXFrames;
copy++;
org++;
}
......@@ -86,11 +90,11 @@ static int get_swcore_status(struct ns_pstats *old,
float t_delta)
{
int i;
int ret;
ret = 0;
/* don't use this function for now, return OK */
return ret;
int ret = 0;
uint64_t total_fwd_delta;
uint64_t total_fwd_delta_nic;
uint64_t total_fwd_delta_ports;
uint64_t tx_delta;
slog_obj_name = wrsSwcoreStatus_str;
......@@ -98,20 +102,28 @@ static int get_swcore_status(struct ns_pstats *old,
/* TXFrames and Forwarded described in 2.2.3 "Problem with the
* SwCore or Endpoint HDL module" in wrs_failures document
* shouldn't differ more than FORWARD_DELTA in total */
/* counter Forwarded (38) is implemented in HDL, but does not count PTP
* traffic!!! */
#if 0
total_fwd_delta_ports = new[i].wrsPstatsHCForwarded - old[i].wrsPstatsHCForwarded;
total_fwd_delta_nic = new[i].wrsPstatsHCNICTXFrames - old[i].wrsPstatsHCNICTXFrames;
total_fwd_delta = total_fwd_delta_ports + total_fwd_delta_nic;
tx_delta = new[i].wrsPstatsHCTXFrames - old[i].wrsPstatsHCTXFrames;
if ( /* shouldn't differ more than FORWARD_DELTA */
((new[i].wrsPstatsHCTXFrames - new[i].wrsPstatsHCForwarded) > FORWARD_DELTA)
|| ((new[i].wrsPstatsHCForwarded - new[i].wrsPstatsHCTXFrames) > FORWARD_DELTA)
((tx_delta - total_fwd_delta) > FORWARD_DELTA)
|| ((total_fwd_delta - tx_delta) > FORWARD_DELTA)
) {
/* if error, no need to check more, but do it just for
* logs */
ret = 1;
snmp_log(LOG_ERR, "SNMP: wrsSwcoreStatus failed for "
"port %d (wri %d)\n", i + 1, i + 1);
snmp_log(LOG_ERR, "SNMP: " SL_ER " %s: "
"Endpoint TX frames number (%lld) on port %d (wri %d) does not match "
"the number of frames forwarded from other ports (%lld) and NIC (%lld), "
"some frames got lost... Difference is more than %d, since last check (%ds)",
slog_obj_name, tx_delta, i + 1, i + 1,
total_fwd_delta_ports, total_fwd_delta_nic,
FORWARD_DELTA, (int)t_delta);
}
#endif
#if 0
/* values from 2.2.5 "Too much HP traffic / Per-priority queue
* full" in wrs_failures document shouldn't change faster
* than parameters defined in dotconfig per second */
......@@ -125,6 +137,7 @@ static int get_swcore_status(struct ns_pstats *old,
SLOG_IF_COMP_WNSG(SL_ER, wrsPstatsHCRXPrio6, new, old, i, t_delta, ns_dotconfig.rx_prio_frame_rate, ret = 1);
SLOG_IF_COMP_WNSG(SL_ER, wrsPstatsHCRXPrio7, new, old, i, t_delta, ns_dotconfig.rx_prio_frame_rate, ret = 1);
SLOG_IF_COMP_WNSG(SL_ER, wrsPstatsHCFastMatchPriority, new, old, i, t_delta, ns_dotconfig.hp_frame_rate, ret = 1);
#endif
}
return ret;
}
......
......@@ -46,6 +46,10 @@ struct ns_pstats {
uint64_t wrsPstatsHCRXPCSErrors; /* 7 */
uint64_t wrsPstatsHCRXCRCErrors; /* 10 */
/* wrsSwcoreStatus */
/* Problem with the SwCore or Endpoint HDL module */
uint64_t wrsPstatsHCTXFrames; /* 19 */
uint64_t wrsPstatsHCForwarded; /* 38 */
uint64_t wrsPstatsHCNICTXFrames; /* 40 */
/* Too much HP traffic / Per-priority queue full */
uint64_t wrsPstatsHCRXFrames; /* 20 */
uint64_t wrsPstatsHCRXPrio0; /* 22 */
......
......@@ -77,6 +77,7 @@ wrsPstatsHCTable_data_fill(unsigned int *n_rows)
/* fill array with 0xff, buy this it will be easy visible in case
* some counters are invalid */
memset(&pstats_array, 0xff, sizeof(pstats_array));
memset(&counters, 0xff, sizeof(counters));
/* read counters version and number of counters */
f = fopen(PSTATS_SYSCTL_PATH PSTATS_SYSCTL_INFO_FILE, "r");
......
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