Commit 6581d71c authored by Adam Wujek's avatar Adam Wujek 💬

[BUG: 1575] userspace: add "monitor" port parameter to HAL and snmp

Include again the commit:
[BUG: 1575] userspace: add "monitor" port parameter to HAL and snmp
74e16153

This time on top of HA
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent e859ad5f
......@@ -297,6 +297,7 @@ WR network.
\snmpadd{WR-SWITCH-MIB::wrsPortStatusSfpInDB.<n>}\\
\snmpadd{WR-SWITCH-MIB::wrsPortStatusSfpGbE.<n>}\\
\snmpadd{WR-SWITCH-MIB::wrsPortStatusSfpError.<n>}\\
\snmpadd{WR-SWITCH-MIB::wrsPortStatusMonitor.<n>}\\
\snmpadd{WR-SWITCH-MIB::wrsSFPsStatus}\\
\snmpadd{WR-SWITCH-MIB::wrsNetworkingStatus}\\
\snmpadd{WR-SWITCH-MIB::wrsMainSystemStatus} }
......
......@@ -253,9 +253,12 @@
\item Check your network layout and the WR Switch configuration. If you
have some non-WR devices connected to ports of the WR Switch (e.g.
computer sending/receiving only data, without the need of
synchronization), these ports should have their role in the timing
synchronization), for firmware versions up to 5.0.1
these ports should have their role in the timing
configuration set to \emph{non-wr} to avoid PTP traffic or \emph{none}
to disable PTP traffic at all.
to disable PTP traffic at all. For newer releases the parameter
\emph{monitor} shall be set to \emph{n} to ignore all errors on
a given port.
\item Check the status of a WR device connected to the reported port.
\item Restart the switch.
\item If the problem persists, please contact WR experts for in-depth
......@@ -285,8 +288,10 @@
wri2}
\item If the reported port is intended to be used with WR not compatible
equipment (e.g. using a copper SFP module), to avoid SNMP errors set
this port to \emph{non-wr}. To disable PTP traffic on this port set it
to \emph{none}.
on this port the \emph{role} to \emph{non-wr} or set \emph{monitor=y}
(firmware after 5.0.1). To disable WR traffic on this port set
the \emph{role} to \emph{non-wr}, to disable PTP traffic set to
\emph{none}.
\item Otherwise, you should use a WR-supported SFP module and make sure it
is declared together with calibration values in the WRS configuration.
\end{pck_proc}
......@@ -631,6 +636,7 @@
\snmpentrye{WR-SWITCH-MIB}{wrsPortStatusTable}{wrsPortStatusSfpError.<n>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPortStatusTable}{wrsPortStatusPtpTxFrames.<n>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPortStatusTable}{wrsPortStatusPtpRxFrames.<n>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPortStatusTable}{wrsPortStatusMonitor.<n>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPortStatusTable}{wrsPortStatusSfpDom.<n>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPortStatusTable}{wrsPortStatusSfpTemp.<n>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPortStatusTable}{wrsPortStatusSfpVcc.<n>}{}
......
......@@ -17,6 +17,10 @@
#define READ_SFP_DIAG_ENABLE 1
#define READ_SFP_DIAG_DISABLE 0
/* Monitor port in SNMP */
#define HAL_PORT_MONITOR_ENABLE 1
#define HAL_PORT_MONITOR_DISABLE 2
#define DEFAULT_T2_PHASE_TRANS 0
#define DEFAULT_T4_PHASE_TRANS 0
......@@ -109,6 +113,10 @@ struct hal_port_state {
/* whether SFP has diagnostic Monitoring capability */
int has_sfp_diag;
/* whether the port shall be monitored by SNMP */
int monitor;
};
struct hal_temp_sensors {
......@@ -119,7 +127,8 @@ struct hal_temp_sensors {
};
/* This is the overall structure stored in shared memory */
#define HAL_SHMEM_VERSION 11 /* Version 11, changed wrs_shm_head */
#define HAL_SHMEM_VERSION 12 /* Version 12, added monitor to
struct hal_port_state */
struct hal_shmem_header {
int nports;
......
Subproject commit be8e037238a2ca33e636f26ba693a5520192b97e
Subproject commit 2630de3cdc31bf389fe23ea16f26b96e0b2de1f1
......@@ -27,8 +27,9 @@ wrSwitchMIB MODULE-IDENTITY
"
REVISION "201807181400Z"
DESCRIPTION
"Add wrsStartCntLldpd"
"Add wrsStartCntLldpd
Add in wrsPortStatusTable:
- wrsPortStatusMonitor
- wrsPortStatusSfpDom
- wrsPortStatusSfpTemp
- wrsPortStatusSfpVcc
......@@ -1979,7 +1980,7 @@ WrsPortStatusEntry ::=
wrsPortStatusSfpError INTEGER,
wrsPortStatusPtpTxFrames Counter32,
wrsPortStatusPtpRxFrames Counter32,
wrsPortStatusDummy INTEGER, -- reserved for wrsPortStatusMonitor
wrsPortStatusMonitor INTEGER,
wrsPortStatusSfpDom INTEGER,
wrsPortStatusSfpTemp INTEGER,
wrsPortStatusSfpVcc INTEGER,
......@@ -2122,6 +2123,18 @@ wrsPortStatusPtpRxFrames OBJECT-TYPE
running on particular port"
::= { wrsPortStatusEntry 14 }
wrsPortStatusMonitor OBJECT-TYPE
SYNTAX INTEGER {
na(0),
enable(1),
disable(2)
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"If disable, SNMP will not generate any errors for this port."
::= { wrsPortStatusEntry 15 }
wrsPortStatusSfpDom OBJECT-TYPE
SYNTAX INTEGER {
na(0),
......@@ -2132,7 +2145,7 @@ wrsPortStatusSfpDom OBJECT-TYPE
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"If disable, SNMP will not generate any errors for this port."
"SFP plugged into a given port has extra monitoring (DOM) capabilities."
::= { wrsPortStatusEntry 16 }
wrsPortStatusSfpTemp OBJECT-TYPE
......
......@@ -23,6 +23,7 @@ static struct pickinfo wrsPortStatusTable_pickinfo[] = {
FIELD(wrsPortStatusTable_s, ASN_INTEGER, wrsPortStatusSfpError),
FIELD(wrsPortStatusTable_s, ASN_COUNTER, wrsPortStatusPtpTxFrames),
FIELD(wrsPortStatusTable_s, ASN_COUNTER, wrsPortStatusPtpRxFrames),
FIELD(wrsPortStatusTable_s, ASN_INTEGER, wrsPortStatusMonitor),
FIELD(wrsPortStatusTable_s, ASN_INTEGER, wrsPortStatusSfpDom),
FIELD(wrsPortStatusTable_s, ASN_INTEGER, wrsPortStatusSfpTemp),
FIELD(wrsPortStatusTable_s, ASN_INTEGER, wrsPortStatusSfpVcc),
......@@ -86,6 +87,10 @@ time_t wrsPortStatusTable_data_fill(unsigned int *n_rows)
*/
continue;
}
wrsPortStatusTable_array[i].wrsPortStatusMonitor =
port_state->monitor;
/* No need to copy all ports structures, only what
* we're interested in.
* Keep value 0 for Not available
......@@ -194,6 +199,7 @@ time_t wrsPortStatusTable_data_fill(unsigned int *n_rows)
}
if ((wrsPortStatusTable_array[i].wrsPortStatusConfiguredMode != WRS_PORT_STATUS_CONFIGURED_MODE_NON_WR)
&& (wrsPortStatusTable_array[i].wrsPortStatusConfiguredMode != WRS_PORT_STATUS_CONFIGURED_MODE_NONE)
&& (wrsPortStatusTable_array[i].wrsPortStatusMonitor != WRS_PORT_STATUS_MONITOR_DISABLE)
&& (wrsPortStatusTable_array[i].wrsPortStatusSfpInDB == WRS_PORT_STATUS_SFP_IN_DB_NOT_IN_DATA_BASE)) {
/* error, port is not non-wr mode and sfp not in data base */
wrsPortStatusTable_array[i].wrsPortStatusSfpError = WRS_PORT_STATUS_SFP_ERROR_SFP_ERROR;
......
......@@ -23,9 +23,13 @@
#define WRS_PORT_STATUS_SFP_GBE_LINK_NOT_GBE 1 /* error */
#define WRS_PORT_STATUS_SFP_GBE_LINK_GBE 2 /* ok */
#define WRS_PORT_STATUS_MONITOR_ENABLE HAL_PORT_MONITOR_ENABLE
#define WRS_PORT_STATUS_MONITOR_DISABLE HAL_PORT_MONITOR_DISABLE
#define WRS_PORT_STATUS_SFP_DOM_ENABLE 1
#define WRS_PORT_STATUS_SFP_DOM_DISABLE 2
#define WRS_PORT_STATUS_SFP_DOM_NOT_SUPPORTED 3
struct wrsPortStatusTable_s {
uint32_t index; /* not reported, index fields has to be marked
* as not-accessible in MIB */
......@@ -43,6 +47,7 @@ struct wrsPortStatusTable_s {
int wrsPortStatusSfpError;
unsigned long wrsPortStatusPtpTxFrames;
unsigned long wrsPortStatusPtpRxFrames;
int wrsPortStatusMonitor; /* Ignore errors on this port */
int wrsPortStatusSfpDom;
int wrsPortStatusSfpTemp;
int wrsPortStatusSfpVcc;
......
......@@ -333,6 +333,7 @@ static void get_wrsSlaveLinksStatus(unsigned int port_status_nrows)
if (shmem_ready_hald()) {
t->wrsSlaveLinksStatus = WRS_SLAVE_LINK_STATUS_OK;
for (i = 0; i < port_status_nrows; i++) {
/* wrsPortStatusMonitor value is ignored for this oid on this port */
/* warning N/A */
if (p_a[i].wrsPortStatusConfiguredMode == 0) {
if (t->wrsSlaveLinksStatus != WRS_SLAVE_LINK_STATUS_ERROR) {
......@@ -436,6 +437,7 @@ static void get_wrsPTPFramesFlowing(unsigned int port_status_nrows)
}
if ((p_a[i].wrsPortStatusConfiguredMode != WRS_PORT_STATUS_CONFIGURED_MODE_NON_WR)
&& (p_a[i].wrsPortStatusConfiguredMode != WRS_PORT_STATUS_CONFIGURED_MODE_NONE)
&& (p_a[i].wrsPortStatusMonitor != WRS_PORT_STATUS_MONITOR_DISABLE)
&& (p_a[i].wrsPortStatusLink == WRS_PORT_STATUS_LINK_UP)) {
if (wrsPortStatusPtpTxFrames_prev[i] == p_a[i].wrsPortStatusPtpTxFrames) {
t->wrsPTPFramesFlowing = WRS_PTP_FRAMES_FLOWING_ERROR;
......
......@@ -443,6 +443,7 @@ struct dump_info hal_port_info [] = {
DUMP_FIELD(uint32_t, t4_phase_transition),
DUMP_FIELD(uint32_t, ep_base),
DUMP_FIELD(int, has_sfp_diag),
DUMP_FIELD(int, monitor),
};
int dump_hal_mem(struct wrs_shm_head *head)
......
......@@ -209,6 +209,30 @@ static int hal_port_init(int index)
p->fiber_index = 0;
}
/* Enable port monitoring by default */
p->monitor = HAL_PORT_MONITOR_ENABLE;
sprintf(key,"PORT%02i_INST%02i_MONITOR",port_i,i);
if ((retValue = libwr_cfg_get(key)) == NULL ) {
pr_error("port %i (%s): no key \"%s\" specified. Default to"
" monitor=y.\n",
port_i, p->name,key);
} else {
if (!strcasecmp(retValue, "n")) {
p->monitor = HAL_PORT_MONITOR_DISABLE;
pr_info("port %i (%s): monitor=n (%i)\n", port_i,
p->name, p->monitor);
} else if (!strcasecmp(retValue, "y")) {
p->monitor = HAL_PORT_MONITOR_ENABLE;
pr_info("port %i (%s): monitor=y (%i)\n", port_i,
p->name, p->monitor);
} else {
/* error */
pr_error("port %i (%s): not supported \"monitor\" "
"value, default to y\n",
port_i, p->name);
}
}
/* Used to pre-calibrate the TX path for each port. No more in V3 */
/* FIXME: this address should come from the driver header */
......
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