Assume the link to be dead if bit error rate (BER) parameter is set to 1.
When a transition from link alive to link dead configuration or vice versa occurs, notify any upstream and / or downstream peers using NGM_FLOW messagges. Link state notification using NGM_FLOW messages is modelled around around already existing code in ng_ether.c. MFC after: 3 days
This commit is contained in:
parent
7d5ddd30cd
commit
2956ec9bc7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=222257
@ -298,11 +298,12 @@ ngp_rcvmsg(node_p node, item_p item, hook_p lasthook)
|
||||
{
|
||||
const priv_p priv = NG_NODE_PRIVATE(node);
|
||||
struct ng_mesg *resp = NULL;
|
||||
struct ng_mesg *msg;
|
||||
struct ng_mesg *msg, *flow_msg;
|
||||
struct ng_pipe_stats *stats;
|
||||
struct ng_pipe_run *run;
|
||||
struct ng_pipe_cfg *cfg;
|
||||
int error = 0;
|
||||
int prev_down, now_down, cmd;
|
||||
|
||||
NGI_GET_MSG(item, msg);
|
||||
switch (msg->header.typecookie) {
|
||||
@ -403,10 +404,38 @@ ngp_rcvmsg(node_p node, item_p item, hook_p lasthook)
|
||||
cfg->header_offset < 64)
|
||||
priv->header_offset = cfg->header_offset;
|
||||
|
||||
prev_down = priv->upper.cfg.ber == 1 ||
|
||||
priv->lower.cfg.ber == 1;
|
||||
parse_cfg(&priv->upper.cfg, &cfg->downstream,
|
||||
&priv->upper, priv);
|
||||
parse_cfg(&priv->lower.cfg, &cfg->upstream,
|
||||
&priv->lower, priv);
|
||||
now_down = priv->upper.cfg.ber == 1 ||
|
||||
priv->lower.cfg.ber == 1;
|
||||
|
||||
if (prev_down != now_down) {
|
||||
if (now_down)
|
||||
cmd = NGM_LINK_IS_DOWN;
|
||||
else
|
||||
cmd = NGM_LINK_IS_UP;
|
||||
|
||||
if (priv->lower.hook != NULL) {
|
||||
NG_MKMESSAGE(flow_msg, NGM_FLOW_COOKIE,
|
||||
cmd, 0, M_NOWAIT);
|
||||
if (flow_msg != NULL)
|
||||
NG_SEND_MSG_HOOK(error, node,
|
||||
flow_msg, priv->lower.hook,
|
||||
0);
|
||||
}
|
||||
if (priv->upper.hook != NULL) {
|
||||
NG_MKMESSAGE(flow_msg, NGM_FLOW_COOKIE,
|
||||
cmd, 0, M_NOWAIT);
|
||||
if (flow_msg != NULL)
|
||||
NG_SEND_MSG_HOOK(error, node,
|
||||
flow_msg, priv->upper.hook,
|
||||
0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
error = EINVAL;
|
||||
|
Loading…
Reference in New Issue
Block a user