port: drop erroneous neighbor rate ratio
When a connected peer introduces a time discontinuities in between consecutive peer-delay measurements (i.e. a jump in time in consecutive PDelay response), an erroneous neighbor rate ratio is calculated. This change disqualifies any neighbor rate ratio that exceeds +/- 100 ppm, as required by IEEE 802.1AS-2011 Anex B.1.1. This patch is to check and drop erroneous neighbor rate ratio to ensure IEEE 802.1AS-2011 Anex B.1.1. Signed-off-by: Rodney Greenstreet <rodney.greenstreet@ni.com> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>master
parent
f8ffb2cf5a
commit
416058d136
13
port.c
13
port.c
|
@ -47,6 +47,7 @@
|
||||||
|
|
||||||
#define ALLOWED_LOST_RESPONSES 3
|
#define ALLOWED_LOST_RESPONSES 3
|
||||||
#define ANNOUNCE_SPAN 1
|
#define ANNOUNCE_SPAN 1
|
||||||
|
#define MAX_NEIGHBOR_FREQ_OFFSET 0.0002
|
||||||
|
|
||||||
enum syfu_event {
|
enum syfu_event {
|
||||||
SYNC_MISMATCH,
|
SYNC_MISMATCH,
|
||||||
|
@ -1024,6 +1025,7 @@ static int port_management_set(struct port *target,
|
||||||
static void port_nrate_calculate(struct port *p, tmv_t origin, tmv_t ingress)
|
static void port_nrate_calculate(struct port *p, tmv_t origin, tmv_t ingress)
|
||||||
{
|
{
|
||||||
struct nrate_estimator *n = &p->nrate;
|
struct nrate_estimator *n = &p->nrate;
|
||||||
|
double ratio;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We experienced a successful exchanges of peer delay request
|
* We experienced a successful exchanges of peer delay request
|
||||||
|
@ -1044,9 +1046,18 @@ static void port_nrate_calculate(struct port *p, tmv_t origin, tmv_t ingress)
|
||||||
pr_warning("bad timestamps in nrate calculation");
|
pr_warning("bad timestamps in nrate calculation");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
n->ratio =
|
|
||||||
|
ratio =
|
||||||
tmv_dbl(tmv_sub(origin, n->origin1)) /
|
tmv_dbl(tmv_sub(origin, n->origin1)) /
|
||||||
tmv_dbl(tmv_sub(ingress, n->ingress1));
|
tmv_dbl(tmv_sub(ingress, n->ingress1));
|
||||||
|
|
||||||
|
if ((ratio <= (1.0 + MAX_NEIGHBOR_FREQ_OFFSET)) &&
|
||||||
|
(ratio >= (1.0 - MAX_NEIGHBOR_FREQ_OFFSET)))
|
||||||
|
n->ratio = ratio;
|
||||||
|
else
|
||||||
|
pr_debug("port %hu: drop erroneous nratio %lf, max offset %lf",
|
||||||
|
portnum(p), ratio, MAX_NEIGHBOR_FREQ_OFFSET);
|
||||||
|
|
||||||
n->ingress1 = ingress;
|
n->ingress1 = ingress;
|
||||||
n->origin1 = origin;
|
n->origin1 = origin;
|
||||||
n->count = 0;
|
n->count = 0;
|
||||||
|
|
Loading…
Reference in New Issue