[dpdk-dev] [PATCH v2 55/62] net/cnxk: add base PTP timesync support

Nithin Dabilpuram nithind1988 at gmail.com
Wed Jun 9 13:06:11 CEST 2021


On Tue, Jun 08, 2021 at 12:04:45PM +0000, Pavan Nikhilesh Bhagavatula wrote:
> <snip>
> 
> >
> >+static __rte_always_inline void
> >+cn10k_nix_xmit_prepare_tstamp(uintptr_t lmt_addr, const uint64_t
> >*cmd,
> >+			      const uint64_t ol_flags, const uint16_t
> >no_segdw,
> >+			      const uint16_t flags)
> >+{
> >+	if (flags & NIX_TX_OFFLOAD_TSTAMP_F) {
> >+		const uint8_t is_ol_tstamp = !(ol_flags &
> >PKT_TX_IEEE1588_TMST);
> >+		struct nix_send_ext_s *send_hdr_ext =
> >+					(struct nix_send_ext_s
> >*)lmt_addr + 16;
> >+		uint64_t *lmt = (uint64_t *)lmt_addr;
> >+		uint16_t off = (no_segdw - 1) << 1;
> >+		struct nix_send_mem_s *send_mem;
> >+
> >+		send_mem = (struct nix_send_mem_s *)(lmt + off);
> >+		send_hdr_ext->w0.subdc = NIX_SUBDC_EXT;
> >+		send_hdr_ext->w0.tstmp = 1;
> >+		if (flags & NIX_TX_MULTI_SEG_F) {
> >+			/* Retrieving the default desc values */
> >+			lmt[off] = cmd[2];
> >+
> >+			/* Using compiler barier to avoid voilation of C
> >+			 * aliasing rules.
> >+			 */
> >+			rte_compiler_barrier();
> >+		}
> >+
> >+		/* Packets for which PKT_TX_IEEE1588_TMST is not set,
> >tx tstamp
> >+		 * should not be recorded, hence changing the alg type
> >to
> >+		 * NIX_SENDMEMALG_SET and also changing send mem
> >addr field to
> >+		 * next 8 bytes as it corrpt the actual tx tstamp
> >registered
> >+		 * address.
> >+		 */
> >+		send_mem->w0.subdc = NIX_SUBDC_MEM;
> >+		send_mem->w0.alg = NIX_SENDMEMALG_SETTSTMP -
> >(is_ol_tstamp);
> >+		send_mem->addr = (rte_iova_t)((uint64_t *)cmd[3]);
> 
> Missing address increment for non-tstmp packets here.

Ack, will fix it.
> 
> >+	}
> >+}
> >+
> 
> <snip>
> 
> > static __rte_always_inline void
> >+cn9k_nix_xmit_prepare_tstamp(uint64_t *cmd, const uint64_t
> >*send_mem_desc,
> >+			     const uint64_t ol_flags, const uint16_t
> >no_segdw,
> >+			     const uint16_t flags)
> >+{
> >+	if (flags & NIX_TX_OFFLOAD_TSTAMP_F) {
> >+		struct nix_send_mem_s *send_mem;
> >+		uint16_t off = (no_segdw - 1) << 1;
> >+		const uint8_t is_ol_tstamp = !(ol_flags &
> >PKT_TX_IEEE1588_TMST);
> >+
> >+		send_mem = (struct nix_send_mem_s *)(cmd + off);
> >+		if (flags & NIX_TX_MULTI_SEG_F) {
> >+			/* Retrieving the default desc values */
> >+			cmd[off] = send_mem_desc[6];
> >+
> >+			/* Using compiler barier to avoid voilation of C
> >+			 * aliasing rules.
> >+			 */
> >+			rte_compiler_barrier();
> >+		}
> >+
> >+		/* Packets for which PKT_TX_IEEE1588_TMST is not set,
> >tx tstamp
> >+		 * should not be recorded, hence changing the alg type
> >to
> >+		 * NIX_SENDMEMALG_SET and also changing send mem
> >addr field to
> >+		 * next 8 bytes as it corrpt the actual tx tstamp
> >registered
> >+		 * address.
> >+		 */
> >+		send_mem->w0.cn9k.alg =
> >+			NIX_SENDMEMALG_SETTSTMP -
> >(is_ol_tstamp);
> >+
> >+		send_mem->addr = (rte_iova_t)((uint64_t
> >*)send_mem_desc[7] +
> >+					      (is_ol_tstamp));
> 
> Need to increment by at-least 8 bytes.
Ack.
> 
> >+	}
> >+}
> >+
> 
> <snip>


More information about the dev mailing list