From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 48C7C42B4C; Fri, 19 May 2023 20:15:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1FD8B40E25; Fri, 19 May 2023 20:15:54 +0200 (CEST) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mails.dpdk.org (Postfix) with ESMTP id 3DF5A40E09 for ; Fri, 19 May 2023 20:15:53 +0200 (CEST) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1ae8ecb4f9aso3389925ad.1 for ; Fri, 19 May 2023 11:15:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1684520152; x=1687112152; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=npPdY0XT9O6rhiLS7BQfmgV6PIXuxuGXkrZcRolKcwM=; b=x2VDrvIJTL9ma8BYbmS/J4SI92jnrUh2Won3a48IC6pHnaNeh9afbIUZ5ZeWImBwja +WEbtGfAmxkPydQ1qx+wQoplX0BCTu1c5fm8yFuSlrA0LMNBhtq6q7wAfUw5AQuPSFzZ nei6sz7rYLfKkuPH2lg7Gxt9Rlcj0rhUg7jS9F1tCJ1eRmlmxMlBbmEc5Hl0wB57Dt3F JkAhURyeosVJERhJMK/fNIsM1gdCEjRG50DNcnAnjwKij8+n1kCCka+Q3p9s1SY97IF8 cXrEgVgUx5hGvIoN3xAvgT2hQyk340zfbNktEdhQ2lKL5NUD+HwABRBBonB9JjWws6BQ U6Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684520152; x=1687112152; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=npPdY0XT9O6rhiLS7BQfmgV6PIXuxuGXkrZcRolKcwM=; b=VGPd6byfSmg7yVL6Ev5Zj8dOeLauVv7M/NxOogfmeYqA+PNazTnmghMQ4/ZldvaHiG TGFdi1u9pu2Aq+j8nLXehpwQiykFYh5zhYu6QBoMUAMML5vx4IK/akUmC4t3qMkZoNNl 3uwzJ7XFQXxHMnaiO76hlxrJXqdy4VwccNWxVRtFnc+WchjZ0+5otBAwWJSfLpC+bb+a V9vSQnf9cFliUzNFasNidW3303eN8Q/f4leiUalgw2PNgve9TrZd4GHzX8kubFDnUN7E zBoyQYcDnGjCjzD1veR+1oIeolHB5J3YxPt5QQVJM76Dx6+LgtX608Sovgb0SW8DCNb/ +U7w== X-Gm-Message-State: AC+VfDw5wPjvCshZZCoMlnxrhJB3m+NRZ520eZdslDQgg0Zg9KXxgS9s HjP2ELo3Zv6ta9RfoRhZcFmaVqVcY98QQwUWtEiqVQ== X-Google-Smtp-Source: ACHHUZ7mPN5+tjKEGmkj3UBC5SN1FEWn0lkbIkJm2QN1yA1X3FvzEsHaM8xKhXCsxrVy3x644tKAvQ== X-Received: by 2002:a17:902:bf0a:b0:1ab:26a8:5401 with SMTP id bi10-20020a170902bf0a00b001ab26a85401mr3102743plb.31.1684520151989; Fri, 19 May 2023 11:15:51 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id v9-20020a17090ac90900b0023b3d80c76csm1795584pjt.4.2023.05.19.11.15.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 11:15:51 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Ajit Khaparde , Somnath Kotur , Kirill Rybalchenko Subject: [PATCH] ptp: replace terms master/slave Date: Fri, 19 May 2023 11:15:49 -0700 Message-Id: <20230519181549.4341-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The IEEE has revised the naming in PTP protocol. Use these new terms to replace master and slave. Signed-off-by: Stephen Hemminger --- doc/guides/nics/bnxt.rst | 7 +-- doc/guides/sample_app_ug/img/ptpclient.svg | 4 +- doc/guides/sample_app_ug/intro.rst | 4 +- doc/guides/sample_app_ug/ptpclient.rst | 29 +++++------ examples/ptpclient/ptpclient.c | 56 +++++++++++----------- 5 files changed, 51 insertions(+), 49 deletions(-) diff --git a/doc/guides/nics/bnxt.rst b/doc/guides/nics/bnxt.rst index 0b09b0c50a7b..bb126689c204 100644 --- a/doc/guides/nics/bnxt.rst +++ b/doc/guides/nics/bnxt.rst @@ -538,10 +538,11 @@ Time Synchronization ~~~~~~~~~~~~~~~~~~~~ System operators may run a PTP (Precision Time Protocol) client application to -synchronize the time on the NIC (and optionally, on the system) to a PTP master. +synchronize the time on the NIC (and optionally, on the system) to a PTP time transmitter. -The BNXT PMD supports a PTP client application to communicate with a PTP master -clock using DPDK IEEE1588 APIs. Note that the PTP client application needs to +The BNXT PMD supports a PTP client application to communicate with a PTP time +transmitter using DPDK IEEE1588 APIs. +Note that the PTP client application needs to run on PF and vector mode needs to be disabled. .. code-block:: console diff --git a/doc/guides/sample_app_ug/img/ptpclient.svg b/doc/guides/sample_app_ug/img/ptpclient.svg index fd78ef839b91..aaf49ea274b1 100644 --- a/doc/guides/sample_app_ug/img/ptpclient.svg +++ b/doc/guides/sample_app_ug/img/ptpclient.svg @@ -488,7 +488,7 @@ sodipodi:role="line" id="tspan7096" x="38.764343" - y="590.47479">master + y="590.47479">sender slave + y="593.71478">receiver `: The PTP client is another minimal implementation of a real world application. In this case the application is a PTP client that communicates with a PTP - master clock to synchronize time on a Network Interface Card (NIC) using the - IEEE1588 protocol. + time transmitter to synchronize time on a Network Interface Card (NIC) + using the IEEE1588 protocol. * :doc:`Quality of Service (QoS) Scheduler`: The QoS Scheduler application demonstrates the use of DPDK to provide QoS scheduling. diff --git a/doc/guides/sample_app_ug/ptpclient.rst b/doc/guides/sample_app_ug/ptpclient.rst index d47e942738d0..ef8846f27436 100644 --- a/doc/guides/sample_app_ug/ptpclient.rst +++ b/doc/guides/sample_app_ug/ptpclient.rst @@ -5,8 +5,9 @@ PTP Client Sample Application ============================= The PTP (Precision Time Protocol) client sample application is a simple -example of using the DPDK IEEE1588 API to communicate with a PTP master clock -to synchronize the time on the NIC and, optionally, on the Linux system. +example of using the DPDK IEEE1588 API to communicate with a PTP time +transmitter to synchronize the time on the NIC and, optionally, +on the Linux system. Note, PTP is a time syncing protocol and cannot be used within DPDK as a time-stamping mechanism. See the following for an explanation of the protocol: @@ -21,10 +22,10 @@ The PTP sample application is intended as a simple reference implementation of a PTP client using the DPDK IEEE1588 API. In order to keep the application simple the following assumptions are made: -* The first discovered master is the main for the session. +* The first discovered transmitter is the main for the session. * Only L2 PTP packets are supported. * Only the PTP v2 protocol is supported. -* Only the slave clock is implemented. +* Only the time receiver clock is implemented. How the Application Works @@ -38,12 +39,12 @@ How the Application Works The PTP synchronization in the sample application works as follows: -* Master sends *Sync* message - the slave saves it as T2. -* Master sends *Follow Up* message and sends time of T1. -* Slave sends *Delay Request* frame to PTP Master and stores T3. -* Master sends *Delay Response* T4 time which is time of received T3. +* TimeTransmitter sends *Sync* message - the TimeReceiver saves it as T2. +* TimeTransmitter sends *Follow Up* message and sends time of T1. +* TimeReceiver sends *Delay Request* frame to PTP TimeTransmitter and stores T3. +* TimeTransmitter sends *Delay Response* T4 time which is time of received T3. -The adjustment for slave can be represented as: +The adjustment for time receiver can be represented as: adj = -[(T2-T1)-(T4 - T3)]/2 @@ -71,8 +72,8 @@ Refer to *DPDK Getting Started Guide* for general information on running applications and the Environment Abstraction Layer (EAL) options. * ``-p portmask``: Hexadecimal portmask. -* ``-T 0``: Update only the PTP slave clock. -* ``-T 1``: Update the PTP slave clock and synchronize the Linux Kernel to the PTP clock. +* ``-T 0``: Update only the PTP time receiver clock. +* ``-T 1``: Update the PTP time receiver clock and synchronize the Linux Kernel to the PTP clock. Code Explanation @@ -178,7 +179,7 @@ The forwarding loop can be interrupted and the application closed using PTP parsing ~~~~~~~~~~~ -The ``parse_ptp_frames()`` function processes PTP packets, implementing slave +The ``parse_ptp_frames()`` function processes PTP packets, implementing time receiver PTP IEEE1588 L2 functionality. .. literalinclude:: ../../../examples/ptpclient/ptpclient.c @@ -187,11 +188,11 @@ PTP IEEE1588 L2 functionality. :end-before: >8 End of function processes PTP packets. There are 3 types of packets on the RX path which we must parse to create a minimal -implementation of the PTP slave client: +implementation of the PTP time receiver client: * SYNC packet. * FOLLOW UP packet * DELAY RESPONSE packet. When we parse the *FOLLOW UP* packet we also create and send a *DELAY_REQUEST* packet. -Also when we parse the *DELAY RESPONSE* packet, and all conditions are met we adjust the PTP slave clock. +Also when we parse the *DELAY RESPONSE* packet, and all conditions are met we adjust the PTP time receiver clock. diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c index cdf2da64dfee..d87d19c74e2f 100644 --- a/examples/ptpclient/ptpclient.c +++ b/examples/ptpclient/ptpclient.c @@ -116,14 +116,14 @@ struct ptp_message { } __rte_packed; }; -struct ptpv2_data_slave_ordinary { +struct ptpv2_receiver_ordinary { struct rte_mbuf *m; struct timespec tstamp1; struct timespec tstamp2; struct timespec tstamp3; struct timespec tstamp4; struct clock_id client_clock_id; - struct clock_id master_clock_id; + struct clock_id sender_clock_id; struct timeval new_adj; int64_t delta; uint16_t portid; @@ -134,7 +134,7 @@ struct ptpv2_data_slave_ordinary { uint16_t current_ptp_port; }; -static struct ptpv2_data_slave_ordinary ptp_data; +static struct ptpv2_receiver_ordinary ptp_data; static inline uint64_t timespec64_to_ns(const struct timespec *ts) { @@ -263,38 +263,38 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) } static void -print_clock_info(struct ptpv2_data_slave_ordinary *ptp_data) +print_clock_info(struct ptpv2_receiver_ordinary *ptp_data) { int64_t nsec; struct timespec net_time, sys_time; - printf("Master Clock id: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", - ptp_data->master_clock_id.id[0], - ptp_data->master_clock_id.id[1], - ptp_data->master_clock_id.id[2], - ptp_data->master_clock_id.id[3], - ptp_data->master_clock_id.id[4], - ptp_data->master_clock_id.id[5], - ptp_data->master_clock_id.id[6], - ptp_data->master_clock_id.id[7]); - - printf("\nT2 - Slave Clock. %lds %ldns", + printf("Transmitter id: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", + ptp_data->sender_clock_id.id[0], + ptp_data->sender_clock_id.id[1], + ptp_data->sender_clock_id.id[2], + ptp_data->sender_clock_id.id[3], + ptp_data->sender_clock_id.id[4], + ptp_data->sender_clock_id.id[5], + ptp_data->sender_clock_id.id[6], + ptp_data->sender_clock_id.id[7]); + + printf("\nT2 - Receiver. %lds %ldns", (ptp_data->tstamp2.tv_sec), (ptp_data->tstamp2.tv_nsec)); - printf("\nT1 - Master Clock. %lds %ldns ", + printf("\nT1 - Transmitter. %lds %ldns ", ptp_data->tstamp1.tv_sec, (ptp_data->tstamp1.tv_nsec)); - printf("\nT3 - Slave Clock. %lds %ldns", + printf("\nT3 - Receiver. %lds %ldns", ptp_data->tstamp3.tv_sec, (ptp_data->tstamp3.tv_nsec)); - printf("\nT4 - Master Clock. %lds %ldns ", + printf("\nT4 - Transmitter. %lds %ldns ", ptp_data->tstamp4.tv_sec, (ptp_data->tstamp4.tv_nsec)); - printf("\nDelta between master and slave clocks:%"PRId64"ns\n", + printf("\nDelta between transmitter and receiver clocks:%"PRId64"ns\n", ptp_data->delta); clock_gettime(CLOCK_REALTIME, &sys_time); @@ -328,7 +328,7 @@ print_clock_info(struct ptpv2_data_slave_ordinary *ptp_data) } static int64_t -delta_eval(struct ptpv2_data_slave_ordinary *ptp_data) +delta_eval(struct ptpv2_receiver_ordinary *ptp_data) { int64_t delta; uint64_t t1 = 0; @@ -350,7 +350,7 @@ delta_eval(struct ptpv2_data_slave_ordinary *ptp_data) * Parse the PTP SYNC message. */ static void -parse_sync(struct ptpv2_data_slave_ordinary *ptp_data, uint16_t rx_tstamp_idx) +parse_sync(struct ptpv2_receiver_ordinary *ptp_data, uint16_t rx_tstamp_idx) { struct ptp_header *ptp_hdr; @@ -359,7 +359,7 @@ parse_sync(struct ptpv2_data_slave_ordinary *ptp_data, uint16_t rx_tstamp_idx) ptp_data->seqID_SYNC = rte_be_to_cpu_16(ptp_hdr->seq_id); if (ptp_data->ptpset == 0) { - rte_memcpy(&ptp_data->master_clock_id, + rte_memcpy(&ptp_data->sender_clock_id, &ptp_hdr->source_port_id.clock_id, sizeof(struct clock_id)); ptp_data->ptpset = 1; @@ -380,7 +380,7 @@ parse_sync(struct ptpv2_data_slave_ordinary *ptp_data, uint16_t rx_tstamp_idx) * Parse the PTP FOLLOWUP message and send DELAY_REQ to the main clock. */ static void -parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) +parse_fup(struct ptpv2_receiver_ordinary *ptp_data) { struct rte_ether_hdr *eth_hdr; struct rte_ether_addr eth_addr; @@ -399,7 +399,7 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ptp_hdr = (struct ptp_header *)(rte_pktmbuf_mtod(m, char *) + sizeof(struct rte_ether_hdr)); - if (memcmp(&ptp_data->master_clock_id, + if (memcmp(&ptp_data->sender_clock_id, &ptp_hdr->source_port_id.clock_id, sizeof(struct clock_id)) != 0) return; @@ -530,7 +530,7 @@ update_kernel_time(void) * Parse the DELAY_RESP message. */ static void -parse_drsp(struct ptpv2_data_slave_ordinary *ptp_data) +parse_drsp(struct ptpv2_receiver_ordinary *ptp_data) { struct rte_mbuf *m = ptp_data->m; struct ptp_message *ptp_msg; @@ -568,8 +568,8 @@ parse_drsp(struct ptpv2_data_slave_ordinary *ptp_data) } } -/* This function processes PTP packets, implementing slave PTP IEEE1588 L2 - * functionality. +/* This function processes PTP packets, + * implementing receiver PTP IEEE1588 L2 functionality. */ /* Parse ptp frames. 8< */ @@ -753,7 +753,7 @@ main(int argc, char *argv[]) rte_exit(EXIT_FAILURE, "Error with EAL initialization\n"); /* >8 End of initialization of EAL. */ - memset(&ptp_data, '\0', sizeof(struct ptpv2_data_slave_ordinary)); + memset(&ptp_data, '\0', sizeof(struct ptpv2_receiver_ordinary)); /* Parse specific arguments. 8< */ argc -= ret; -- 2.39.2