port: Separate unicast specific code from port_signaling_construct()
Make port_signaling_construct() to create a generic signaling ptp_message. Move the unicast specific code to port_signaling_uc_construct(). This is done to support the creation of Message Interval Request TLV (as defined in 802.1AS Section 10.5.4.3). This TLV can be used to request change in Announce Interval, Sync Interval or Link Delay Interval on a remote system. [ RC - fix trivial rebase conflict on top of targetPortIdentity check. ] Signed-off-by: Vedang Patel <vedang.patel@intel.com> Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
705e5a32fa
commit
43085ab741
|
@ -169,9 +169,9 @@ int port_set_delay_tmo(struct port *p);
|
||||||
int port_set_qualification_tmo(struct port *p);
|
int port_set_qualification_tmo(struct port *p);
|
||||||
void port_show_transition(struct port *p, enum port_state next,
|
void port_show_transition(struct port *p, enum port_state next,
|
||||||
enum fsm_event event);
|
enum fsm_event event);
|
||||||
struct ptp_message *port_signaling_construct(struct port *p,
|
struct ptp_message *port_signaling_uc_construct(struct port *p,
|
||||||
struct address *address,
|
struct address *address,
|
||||||
struct PortIdentity *tpid);
|
struct PortIdentity *tpid);
|
||||||
int port_tx_announce(struct port *p, struct address *dst);
|
int port_tx_announce(struct port *p, struct address *dst);
|
||||||
int port_tx_sync(struct port *p, struct address *dst);
|
int port_tx_sync(struct port *p, struct address *dst);
|
||||||
int process_announce(struct port *p, struct ptp_message *m);
|
int process_announce(struct port *p, struct ptp_message *m);
|
||||||
|
|
|
@ -28,9 +28,8 @@ static struct PortIdentity wildcard = {
|
||||||
.portNumber = 0xffff,
|
.portNumber = 0xffff,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ptp_message *port_signaling_construct(struct port *p,
|
static struct ptp_message *port_signaling_construct(struct port *p,
|
||||||
struct address *address,
|
struct PortIdentity *tpid)
|
||||||
struct PortIdentity *tpid)
|
|
||||||
{
|
{
|
||||||
struct ptp_message *msg;
|
struct ptp_message *msg;
|
||||||
|
|
||||||
|
@ -48,6 +47,21 @@ struct ptp_message *port_signaling_construct(struct port *p,
|
||||||
msg->header.control = CTL_OTHER;
|
msg->header.control = CTL_OTHER;
|
||||||
msg->header.logMessageInterval = 0x7F;
|
msg->header.logMessageInterval = 0x7F;
|
||||||
msg->signaling.targetPortIdentity = *tpid;
|
msg->signaling.targetPortIdentity = *tpid;
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ptp_message *port_signaling_uc_construct(struct port *p,
|
||||||
|
struct address *address,
|
||||||
|
struct PortIdentity *tpid)
|
||||||
|
{
|
||||||
|
struct ptp_message *msg;
|
||||||
|
|
||||||
|
msg = port_signaling_construct(p, tpid);
|
||||||
|
if (!msg) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
msg->header.flagField[0] |= UNICAST;
|
msg->header.flagField[0] |= UNICAST;
|
||||||
msg->address = *address;
|
msg->address = *address;
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ static int unicast_client_announce(struct port *p,
|
||||||
struct ptp_message *msg;
|
struct ptp_message *msg;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
msg = port_signaling_construct(p, &dst->address, &dst->portIdentity);
|
msg = port_signaling_uc_construct(p, &dst->address, &dst->portIdentity);
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ static int unicast_client_peer_renew(struct port *p)
|
||||||
peer->renewal_tmo = 0;
|
peer->renewal_tmo = 0;
|
||||||
pr_debug("port %d: time to renew P2P unicast subscription", portnum(p));
|
pr_debug("port %d: time to renew P2P unicast subscription", portnum(p));
|
||||||
|
|
||||||
msg = port_signaling_construct(p, &peer->address, &peer->portIdentity);
|
msg = port_signaling_uc_construct(p, &peer->address, &peer->portIdentity);
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ static int unicast_client_renew(struct port *p,
|
||||||
dst->renewal_tmo = 0;
|
dst->renewal_tmo = 0;
|
||||||
pr_debug("port %d: time to renew unicast subscriptions", portnum(p));
|
pr_debug("port %d: time to renew unicast subscriptions", portnum(p));
|
||||||
|
|
||||||
msg = port_signaling_construct(p, &dst->address, &dst->portIdentity);
|
msg = port_signaling_uc_construct(p, &dst->address, &dst->portIdentity);
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ static int unicast_client_sydy(struct port *p,
|
||||||
struct ptp_message *msg;
|
struct ptp_message *msg;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
msg = port_signaling_construct(p, &dst->address, &dst->portIdentity);
|
msg = port_signaling_uc_construct(p, &dst->address, &dst->portIdentity);
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -285,7 +285,7 @@ int unicast_client_cancel(struct port *p, struct ptp_message *m,
|
||||||
ucma->granted &= ~(1 << mtype);
|
ucma->granted &= ~(1 << mtype);
|
||||||
|
|
||||||
/* Respond with ACK. */
|
/* Respond with ACK. */
|
||||||
msg = port_signaling_construct(p, &ucma->address, &ucma->portIdentity);
|
msg = port_signaling_uc_construct(p, &ucma->address, &ucma->portIdentity);
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,8 +241,8 @@ static int unicast_service_reply(struct port *p, struct ptp_message *dst,
|
||||||
struct ptp_message *msg;
|
struct ptp_message *msg;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
msg = port_signaling_construct(p, &dst->address,
|
msg = port_signaling_uc_construct(p, &dst->address,
|
||||||
&dst->header.sourcePortIdentity);
|
&dst->header.sourcePortIdentity);
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue