Signed-off-by: Anders Selhammer <anders.selham...@est.tech>
---
 port.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/port.c b/port.c
index cef8c2b..fd638aa 100644
--- a/port.c
+++ b/port.c
@@ -892,6 +892,11 @@ static int port_management_fill_response(struct port 
*target,
                mtd->val = target->versionNumber;
                datalen = sizeof(*mtd);
                break;
+       case TLV_UNICAST_NEGOTIATION_ENABLE:
+               mtd = (struct management_tlv_datum *) tlv->data;
+               mtd->val = unicast_client_enabled(target);
+               datalen = sizeof(*mtd);
+               break;
        case TLV_DELAY_MECHANISM:
                mtd = (struct management_tlv_datum *) tlv->data;
                if (target->delayMechanism)
@@ -963,6 +968,7 @@ static int port_management_set(struct port *target,
                               struct port *ingress, int id,
                               struct ptp_message *req)
 {
+       struct management_tlv_datum *mtd;
        struct management_tlv *tlv;
        struct port_ds_np *pdsnp;
 
@@ -973,6 +979,33 @@ static int port_management_set(struct port *target,
                pdsnp = (struct port_ds_np *) tlv->data;
                target->neighborPropDelayThresh = 
pdsnp->neighborPropDelayThresh;
                break;
+       case TLV_UNICAST_NEGOTIATION_ENABLE:
+               mtd = (struct management_tlv_datum *)tlv->data;
+               if (mtd->val) {
+                       if (unicast_client_enabled(target)) {
+                               break;
+                       }
+                       if (unicast_client_claim_table(target)) {
+                               pr_err("port %hu: failed to enable unicast 
client",
+                                      portnum(target));
+                               break;
+                       }
+                       if (unicast_client_set_tmo(target)) {
+                               pr_err("port %hu: failed to set unicast client 
tmo",
+                                      portnum(target));
+                               break;
+                       }
+               } else {
+                       if (!unicast_client_enabled(target)) {
+                               break;
+                       }
+                       if (unicast_client_disable(target)) {
+                               pr_err("port %hu: failed to disable unicast 
client",
+                                      portnum(target));
+                               break;
+                       }
+               }
+               break;
        default:
                /* The caller should *not* respond to this message. */
                return 0;
@@ -2728,7 +2761,6 @@ int port_manage(struct port *p, struct port *ingress, 
struct ptp_message *msg)
        case TLV_VERSION_NUMBER:
        case TLV_ENABLE_PORT:
        case TLV_DISABLE_PORT:
-       case TLV_UNICAST_NEGOTIATION_ENABLE:
        case TLV_UNICAST_MASTER_TABLE:
        case TLV_UNICAST_MASTER_MAX_TABLE_SIZE:
        case TLV_ACCEPTABLE_MASTER_TABLE_ENABLED:
-- 
1.8.3.1



_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to