On Tue, May 29, 2018 at 11:42:12PM +0200, Anders Selhammer wrote: > @@ -124,20 +120,25 @@ void pmc_destroy(struct pmc *pmc) > > static struct ptp_message *pmc_message(struct pmc *pmc, uint8_t action) > { > + UInteger8 transportSpecific; > struct ptp_message *msg; > int pdulen; > > msg = msg_allocate(); > - if (!msg) > + if (!msg) { > return NULL; > + } > + > + transportSpecific = config_get_int(pmc->cfg, NULL, "transportSpecific");
I don't like this patch. It isn't required for SNMP support, and it makes every PMC message do a hash table lookup once ... > + transportSpecific <<= 4; > > pdulen = sizeof(struct management_msg); > msg->hwts.type = TS_SOFTWARE; > > - msg->header.tsmt = MANAGEMENT | pmc->transport_specific; > + msg->header.tsmt = MANAGEMENT | transportSpecific; > msg->header.ver = PTP_VERSION; > msg->header.messageLength = pdulen; > - msg->header.domainNumber = pmc->domain_number; > + msg->header.domainNumber = config_get_int(pmc->cfg, NULL, > "domainNumber"); ... twice for every sent message. That is a waste of CPU time, especially for clients that must send many messages. The original code pre-computed those values which is the right thing to do. > msg->header.sourcePortIdentity = pmc->port_identity; > msg->header.sequenceId = pmc->sequence_id++; > msg->header.control = CTL_MANAGEMENT; Thanks, Richard ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel