Distinguish between get and set management requests.
The code previously treated all supported request as 'get' actions and ignored the actual action field in the message. This commit makes the code look at the action field when processing the requests. Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
502b52163c
commit
2aaae0854e
10
clock.c
10
clock.c
|
@ -130,8 +130,8 @@ static void clock_freq_est_reset(struct clock *c)
|
|||
c->fest.count = 0;
|
||||
};
|
||||
|
||||
static int clock_management_response(struct clock *c, struct port *p, int id,
|
||||
struct ptp_message *req)
|
||||
static int clock_management_get_response(struct clock *c, struct port *p,
|
||||
int id, struct ptp_message *req)
|
||||
{
|
||||
int datalen = 0, err, pdulen, respond = 0;
|
||||
struct management_tlv *tlv;
|
||||
|
@ -614,6 +614,9 @@ void clock_manage(struct clock *c, struct port *p, struct ptp_message *msg)
|
|||
|
||||
switch (management_action(msg)) {
|
||||
case GET:
|
||||
if (clock_management_get_response(c, p, mgt->id, msg))
|
||||
return;
|
||||
break;
|
||||
case SET:
|
||||
case COMMAND:
|
||||
break;
|
||||
|
@ -623,9 +626,6 @@ void clock_manage(struct clock *c, struct port *p, struct ptp_message *msg)
|
|||
return;
|
||||
}
|
||||
|
||||
if (clock_management_response(c, p, mgt->id, msg))
|
||||
return;
|
||||
|
||||
switch (mgt->id) {
|
||||
case USER_DESCRIPTION:
|
||||
case SAVE_IN_NON_VOLATILE_STORAGE:
|
||||
|
|
23
port.c
23
port.c
|
@ -392,8 +392,9 @@ static int port_ignore(struct port *p, struct ptp_message *m)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int port_management_response(struct port *target, struct port *ingress,
|
||||
int id, struct ptp_message *req)
|
||||
static int port_management_get_response(struct port *target,
|
||||
struct port *ingress, int id,
|
||||
struct ptp_message *req)
|
||||
{
|
||||
int datalen = 0, err, pdulen, respond = 0;
|
||||
struct management_tlv *tlv;
|
||||
|
@ -1613,9 +1614,23 @@ int port_manage(struct port *p, struct port *ingress, struct ptp_message *msg)
|
|||
return 0;
|
||||
}
|
||||
mgt = (struct management_tlv *) msg->management.suffix;
|
||||
if (port_management_response(p, ingress, mgt->id, msg)) {
|
||||
return 0;
|
||||
|
||||
switch (management_action(msg)) {
|
||||
case GET:
|
||||
if (port_management_get_response(p, ingress, mgt->id, msg))
|
||||
return 0;
|
||||
break;
|
||||
case SET:
|
||||
if (port_managment_error(p->portIdentity, ingress, msg,
|
||||
NOT_SUPPORTED))
|
||||
pr_err("port %hu: management error failed", portnum(p));
|
||||
break;
|
||||
case COMMAND:
|
||||
case RESPONSE:
|
||||
case ACKNOWLEDGE:
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (mgt->id) {
|
||||
case CLOCK_DESCRIPTION:
|
||||
case LOG_ANNOUNCE_INTERVAL:
|
||||
|
|
Loading…
Reference in New Issue