diff --git a/clock.c b/clock.c index 67271a9..14ea25e 100644 --- a/clock.c +++ b/clock.c @@ -131,6 +131,13 @@ static void clock_freq_est_reset(struct clock *c) c->fest.count = 0; }; +static void clock_management_send_error(struct port *p, + struct ptp_message *msg, int error_id) +{ + if (port_management_error(port_identity(p), p, msg, error_id)) + pr_err("failed to send management error status"); +} + static int clock_management_get_response(struct clock *c, struct port *p, int id, struct ptp_message *req) { @@ -610,7 +617,6 @@ void clock_manage(struct clock *c, struct port *p, struct ptp_message *msg) { int i; struct management_tlv *mgt; - struct PortIdentity pid; struct ClockIdentity *tcid, wildcard = { {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} }; @@ -669,9 +675,7 @@ void clock_manage(struct clock *c, struct port *p, struct ptp_message *msg) case ALTERNATE_TIME_OFFSET_PROPERTIES: case TRANSPARENT_CLOCK_DEFAULT_DATA_SET: case PRIMARY_DOMAIN: - pid = port_identity(p); - if (port_management_error(pid, p, msg, NOT_SUPPORTED)) - pr_err("failed to send management error status"); + clock_management_send_error(p, msg, NOT_SUPPORTED); break; default: for (i = 0; i < c->nports; i++) { diff --git a/port.c b/port.c index a1c42ac..7abf2f0 100644 --- a/port.c +++ b/port.c @@ -431,6 +431,13 @@ static int port_is_ieee8021as(struct port *p) return p->pod.follow_up_info ? 1 : 0; } +static void port_management_send_error(struct port *p, struct port *ingress, + struct ptp_message *msg, int error_id) +{ + if (port_management_error(p->portIdentity, ingress, msg, error_id)) + pr_err("port %hu: management error failed", portnum(p)); +} + static int port_management_get_response(struct port *target, struct port *ingress, int id, struct ptp_message *req) @@ -1691,9 +1698,7 @@ int port_manage(struct port *p, struct port *ingress, struct ptp_message *msg) return 0; break; case SET: - if (port_management_error(p->portIdentity, ingress, msg, - NOT_SUPPORTED)) - pr_err("port %hu: management error failed", portnum(p)); + port_management_send_error(p, ingress, msg, NOT_SUPPORTED); break; case COMMAND: case RESPONSE: @@ -1717,9 +1722,7 @@ int port_manage(struct port *p, struct port *ingress, struct ptp_message *msg) case TRANSPARENT_CLOCK_PORT_DATA_SET: case DELAY_MECHANISM: case LOG_MIN_PDELAY_REQ_INTERVAL: - if (port_management_error(p->portIdentity, ingress, msg, - NOT_SUPPORTED)) - pr_err("port %hu: management error failed", portnum(p)); + port_management_send_error(p, ingress, msg, NOT_SUPPORTED); break; default: return -1;