> -----Original Message----- > From: Rodney Greenstreet [mailto:rodney.greenstr...@ni.com] > Sent: Thursday, August 03, 2017 2:22 PM > To: linuxptp-devel@lists.sourceforge.net > Cc: Rodney Greenstreet <rodney.greenstr...@ni.com> > Subject: [Linuxptp-devel] [PATCH 3/6] This patch places the internal port data > structure into a common header for use by the original BC and the new TC code. > > Signed-off-by: Richard Cochran <richardcoch...@gmail.com> > > port_private: Updated return type of variable dispatch routine to be void. >
I'd change the title, since the subject is quite long. > Signed-off-by: Rodney Greenstreet <rodney.greenstr...@ni.com> > --- > port.c | 86 +------------------------------------------ > port_private.h | 113 > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 114 insertions(+), 85 deletions(-) > create mode 100644 port_private.h > > diff --git a/port.c b/port.c > index c8c4424..c1d2f04 100644 > --- a/port.c > +++ b/port.c > @@ -32,6 +32,7 @@ > #include "msg.h" > #include "phc.h" > #include "port.h" > +#include "port_private.h" > #include "print.h" > #include "rtnl.h" > #include "sk.h" > @@ -43,12 +44,6 @@ > #define ALLOWED_LOST_RESPONSES 3 > #define ANNOUNCE_SPAN 1 > > -enum syfu_state { > - SF_EMPTY, > - SF_HAVE_SYNC, > - SF_HAVE_FUP, > -}; > - > enum syfu_event { > SYNC_MISMATCH, > SYNC_MATCH, > @@ -56,87 +51,8 @@ enum syfu_event { > FUP_MATCH, > }; > > -struct nrate_estimator { > - double ratio; > - tmv_t origin1; > - tmv_t ingress1; > - unsigned int max_count; > - unsigned int count; > - int ratio_valid; > -}; > - > -struct port { > - LIST_ENTRY(port) list; > - char *name; > - struct clock *clock; > - struct transport *trp; > - enum timestamp_type timestamping; > - struct fdarray fda; > - int fault_fd; > - int phc_index; > - > - void (*dispatch)(struct port *p, enum fsm_event event, int mdiff); > - enum fsm_event (*event)(struct port *p, int fd_index); > - > - int jbod; > - struct foreign_clock *best; > - enum syfu_state syfu; > - struct ptp_message *last_syncfup; > - struct ptp_message *delay_req; > - struct ptp_message *peer_delay_req; > - struct ptp_message *peer_delay_resp; > - struct ptp_message *peer_delay_fup; > - int peer_portid_valid; > - struct PortIdentity peer_portid; > - struct { > - UInteger16 announce; > - UInteger16 delayreq; > - UInteger16 sync; > - } seqnum; > - tmv_t peer_delay; > - struct tsproc *tsproc; > - int log_sync_interval; > - struct nrate_estimator nrate; > - unsigned int pdr_missing; > - unsigned int multiple_seq_pdr_count; > - unsigned int multiple_pdr_detected; > - enum port_state (*state_machine)(enum port_state state, > - enum fsm_event event, int mdiff); > - /* portDS */ > - struct PortIdentity portIdentity; > - enum port_state state; /*portState*/ > - Integer64 asymmetry; > - int asCapable; > - Integer8 logMinDelayReqInterval; > - TimeInterval peerMeanPathDelay; > - Integer8 logAnnounceInterval; > - UInteger8 announceReceiptTimeout; > - int announce_span; > - UInteger8 syncReceiptTimeout; > - UInteger8 transportSpecific; > - Integer8 logSyncInterval; > - Enumeration8 delayMechanism; > - Integer8 logMinPdelayReqInterval; > - UInteger32 neighborPropDelayThresh; > - int follow_up_info; > - int freq_est_interval; > - int hybrid_e2e; > - int min_neighbor_prop_delay; > - int path_trace_enabled; > - int rx_timestamp_offset; > - int tx_timestamp_offset; > - int link_status; > - struct fault_interval flt_interval_pertype[FT_CNT]; > - enum fault_type last_fault_type; > - unsigned int versionNumber; /*UInteger4*/ > - /* foreignMasterDS */ > - LIST_HEAD(fm, foreign_clock) foreign_masters; > -}; > - > #define portnum(p) (p->portIdentity.portNumber) > > -#define NSEC2SEC 1000000000LL > - > static int port_capable(struct port *p); > static int port_is_ieee8021as(struct port *p); > static void port_nrate_initialize(struct port *p); > diff --git a/port_private.h b/port_private.h > new file mode 100644 > index 0000000..8815bd4 > --- /dev/null > +++ b/port_private.h > @@ -0,0 +1,113 @@ > +/** > + * @file port_private.h > + * @note Copyright (C) 2015 Richard Cochran <richardcoch...@gmail.com> > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License along > + * with this program; if not, write to the Free Software Foundation, Inc., > + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > + */ > +#ifndef HAVE_PORT_PRIVATE_H > +#define HAVE_PORT_PRIVATE_H > + > +#include <sys/queue.h> > + > +#include "clock.h" > +#include "msg.h" > +#include "tmv.h" > + > +#define NSEC2SEC 1000000000LL > + > +enum syfu_state { > + SF_EMPTY, > + SF_HAVE_SYNC, > + SF_HAVE_FUP, > +}; > + > +struct nrate_estimator { > + double ratio; > + tmv_t origin1; > + tmv_t ingress1; > + unsigned int max_count; > + unsigned int count; > + int ratio_valid; > +}; > + > +struct port { > + LIST_ENTRY(port) list; > + char *name; > + struct clock *clock; > + struct transport *trp; > + enum timestamp_type timestamping; > + struct fdarray fda; > + int fault_fd; > + int phc_index; > + > + void (*dispatch)(struct port *p, enum fsm_event event, int mdiff); > + enum fsm_event (*event)(struct port *p, int fd_index); > + > + int jbod; > + struct foreign_clock *best; > + enum syfu_state syfu; > + struct ptp_message *last_syncfup; > + struct ptp_message *delay_req; > + struct ptp_message *peer_delay_req; > + struct ptp_message *peer_delay_resp; > + struct ptp_message *peer_delay_fup; > + int peer_portid_valid; > + struct PortIdentity peer_portid; > + struct { > + UInteger16 announce; > + UInteger16 delayreq; > + UInteger16 sync; > + } seqnum; > + tmv_t peer_delay; > + struct tsproc *tsproc; > + int log_sync_interval; > + struct nrate_estimator nrate; > + unsigned int pdr_missing; > + unsigned int multiple_seq_pdr_count; > + unsigned int multiple_pdr_detected; > + enum port_state (*state_machine)(enum port_state state, > + enum fsm_event event, int mdiff); > + /* portDS */ > + struct PortIdentity portIdentity; > + enum port_state state; /*portState*/ > + Integer64 asymmetry; > + int asCapable; > + Integer8 logMinDelayReqInterval; > + TimeInterval peerMeanPathDelay; > + Integer8 logAnnounceInterval; > + UInteger8 announceReceiptTimeout; > + int announce_span; > + UInteger8 syncReceiptTimeout; > + UInteger8 transportSpecific; > + Integer8 logSyncInterval; > + Enumeration8 delayMechanism; > + Integer8 logMinPdelayReqInterval; > + UInteger32 neighborPropDelayThresh; > + int follow_up_info; > + int freq_est_interval; > + int hybrid_e2e; > + int min_neighbor_prop_delay; > + int path_trace_enabled; > + int rx_timestamp_offset; > + int tx_timestamp_offset; > + int link_status; > + struct fault_interval flt_interval_pertype[FT_CNT]; > + enum fault_type last_fault_type; > + unsigned int versionNumber; /*UInteger4*/ > + /* foreignMasterDS */ > + LIST_HEAD(fm, foreign_clock) foreign_masters; > +}; > + > +#endif > -- > 2.13.0 > > > ------------------------------------------------------------------------------ > 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 ------------------------------------------------------------------------------ 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