Support unicast peer to peer delay mechanism.
There are two aspects. First, on the receive path, we reply to unicast peer delay requests in kind. That is, if the peer sends a unicast delay request, then reply with unicast, too, since this is obviously what the peer expects. Second, if configured, we transmit peer delay requests to the specified unicast peer address. Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
faf0e0a025
commit
e8e2be017a
20
port.c
20
port.c
|
@ -40,6 +40,7 @@
|
||||||
#include "tlv.h"
|
#include "tlv.h"
|
||||||
#include "tmv.h"
|
#include "tmv.h"
|
||||||
#include "tsproc.h"
|
#include "tsproc.h"
|
||||||
|
#include "unicast_client.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#define ALLOWED_LOST_RESPONSES 3
|
#define ALLOWED_LOST_RESPONSES 3
|
||||||
|
@ -569,7 +570,11 @@ static int peer_prepare_and_send(struct port *p, struct ptp_message *msg,
|
||||||
if (msg_pre_send(msg)) {
|
if (msg_pre_send(msg)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (msg_unicast(msg)) {
|
||||||
|
cnt = transport_sendto(p->trp, &p->fda, event, msg);
|
||||||
|
} else {
|
||||||
cnt = transport_peer(p->trp, &p->fda, event, msg);
|
cnt = transport_peer(p->trp, &p->fda, event, msg);
|
||||||
|
}
|
||||||
if (cnt <= 0) {
|
if (cnt <= 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1230,6 +1235,11 @@ static int port_pdelay_request(struct port *p)
|
||||||
msg->header.logMessageInterval = port_is_ieee8021as(p) ?
|
msg->header.logMessageInterval = port_is_ieee8021as(p) ?
|
||||||
p->logMinPdelayReqInterval : 0x7f;
|
p->logMinPdelayReqInterval : 0x7f;
|
||||||
|
|
||||||
|
if (unicast_client_enabled(p) && p->unicast_master_table->peer_name) {
|
||||||
|
msg->address = p->unicast_master_table->peer_addr.address;
|
||||||
|
msg->header.flagField[0] |= UNICAST;
|
||||||
|
}
|
||||||
|
|
||||||
err = peer_prepare_and_send(p, msg, TRANS_EVENT);
|
err = peer_prepare_and_send(p, msg, TRANS_EVENT);
|
||||||
if (err) {
|
if (err) {
|
||||||
pr_err("port %hu: send peer delay request failed", portnum(p));
|
pr_err("port %hu: send peer delay request failed", portnum(p));
|
||||||
|
@ -1954,6 +1964,11 @@ int process_pdelay_req(struct port *p, struct ptp_message *m)
|
||||||
}
|
}
|
||||||
rsp->pdelay_resp.requestingPortIdentity = m->header.sourcePortIdentity;
|
rsp->pdelay_resp.requestingPortIdentity = m->header.sourcePortIdentity;
|
||||||
|
|
||||||
|
if (msg_unicast(m)) {
|
||||||
|
rsp->address = m->address;
|
||||||
|
rsp->header.flagField[0] |= UNICAST;
|
||||||
|
}
|
||||||
|
|
||||||
err = peer_prepare_and_send(p, rsp, event);
|
err = peer_prepare_and_send(p, rsp, event);
|
||||||
if (err) {
|
if (err) {
|
||||||
pr_err("port %hu: send peer delay response failed", portnum(p));
|
pr_err("port %hu: send peer delay response failed", portnum(p));
|
||||||
|
@ -1987,6 +2002,11 @@ int process_pdelay_req(struct port *p, struct ptp_message *m)
|
||||||
fup->pdelay_resp_fup.responseOriginTimestamp =
|
fup->pdelay_resp_fup.responseOriginTimestamp =
|
||||||
tmv_to_Timestamp(rsp->hwts.ts);
|
tmv_to_Timestamp(rsp->hwts.ts);
|
||||||
|
|
||||||
|
if (msg_unicast(m)) {
|
||||||
|
fup->address = m->address;
|
||||||
|
fup->header.flagField[0] |= UNICAST;
|
||||||
|
}
|
||||||
|
|
||||||
err = peer_prepare_and_send(p, fup, TRANS_GENERAL);
|
err = peer_prepare_and_send(p, fup, TRANS_GENERAL);
|
||||||
if (err) {
|
if (err) {
|
||||||
pr_err("port %hu: send pdelay_resp_fup failed", portnum(p));
|
pr_err("port %hu: send pdelay_resp_fup failed", portnum(p));
|
||||||
|
|
Loading…
Reference in New Issue