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 A5D3E45CD8; Mon, 18 Nov 2024 19:22:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 438F542DB1; Mon, 18 Nov 2024 19:22:16 +0100 (CET) Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by mails.dpdk.org (Postfix) with ESMTP id B9080427B5 for ; Mon, 18 Nov 2024 19:22:09 +0100 (CET) Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-720aa3dbda5so3165369b3a.1 for ; Mon, 18 Nov 2024 10:22:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731954129; x=1732558929; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dBtW4k9RIz6mavCEq8I9+rapLYbr1mpuZNcAJxQ1E+0=; b=xrKlYH6KXWvojtxGsEPvO9h5qbV5pX4eqSRmps8dhYBUvIcvubfEq95D59CJfIzUh2 UZFNfeYWtSeDoBGArLEndOB97fb6OFyBT9wLQZKTEd+9WyngDWBeeaFFK/q0pLCQJoTG SuERIjOo0LP9EYtxaMxgk3+OTKyoZDZE/3yyb0NIiWexU+JO8ps3r5WWaW3O4R9Hiews Y6p/FCfCiK70SIrx1mYYYLHJBszh+H13BzF3baL+h0OJwTNZI+Hsop+4Js6HU76GtK19 JWZ3WrJw6MwO7erh6C8Cv+8k1dS2LC5G+IFrW834c4zvjctg1OlyICkJwIOhUhenYqNb leOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731954129; x=1732558929; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dBtW4k9RIz6mavCEq8I9+rapLYbr1mpuZNcAJxQ1E+0=; b=sKPcWImQV5FR4wkoRceKEHR551qs7qRVmFPODi2fMBgjPXZGmFJInaXsT+yedS3u4r J1n9Uxo3EFTIf1cK00JDYQDc9VCsy1RyZdGucy39Y2VaBg78h3Tb1hlxtB5t2VW4vMNe 81mUq7HykK3zQNVKxeDqFGxOvscRxXFcEknemkp9tzc1wDO/YQc9YooXiXPU06YxlC+B jkorurUw/6SOtVst4P6exniet1Q1L9mbjtuVPk/WDfOT3X5IgmkfkdCyDTwIbG+iqx8k CBN500Lbnr1qqyz9q5pXQJC86eHxakIrvSjsowBYQAoECQD/PoohiLl3cKPMxuMAEFfz z5dw== X-Gm-Message-State: AOJu0Ywa862j46LiCwI3Y7cJxXgHsqkg9eMm/yzqt7r8j+AruaKDbHyg pyCMDMZEUUwCzr1xNma9MHIeYEd9tsD1667W7tRSouXHP0dVfwxMRl1rbE+4uPZwSNDO8VkUV9l T X-Google-Smtp-Source: AGHT+IEyyYL8J3Qb9heNI/u7ON5Q6mAC+QpIYp/akJcYpn3hORIY+CVY3LPzij+ijcDvO8t27PEGuA== X-Received: by 2002:a17:90b:3b8d:b0:2ea:8c3b:6d07 with SMTP id 98e67ed59e1d1-2ea8c3b6f2cmr3198685a91.28.1731954129019; Mon, 18 Nov 2024 10:22:09 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2ea61869bb2sm2916724a91.12.2024.11.18.10.22.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2024 10:22:08 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v2 08/19] examples/ptpclient: replace rte_memcpy with assignment Date: Mon, 18 Nov 2024 10:20:49 -0800 Message-ID: <20241118182153.87042-9-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118182153.87042-1-stephen@networkplumber.org> References: <20241115060738.313190-1-stephen@networkplumber.org> <20241118182153.87042-1-stephen@networkplumber.org> 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 Don't use rte_memcpy() when not necessary. Structure assignment is as fast and type safe. Signed-off-by: Stephen Hemminger --- examples/ptpclient/ptpclient.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c index 23fa487081..2ec532d058 100644 --- a/examples/ptpclient/ptpclient.c +++ b/examples/ptpclient/ptpclient.c @@ -415,9 +415,7 @@ parse_sync(struct ptpv2_time_receiver_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->transmitter_clock_id, - &ptp_hdr->source_port_id.clock_id, - sizeof(struct clock_id)); + ptp_data->transmitter_clock_id = ptp_hdr->source_port_id.clock_id; ptp_data->ptpset = 1; } @@ -522,9 +520,7 @@ parse_fup(struct ptpv2_time_receiver_ordinary *ptp_data) client_clkid->id[6] = eth_hdr->src_addr.addr_bytes[4]; client_clkid->id[7] = eth_hdr->src_addr.addr_bytes[5]; - rte_memcpy(&ptp_data->client_clock_id, - client_clkid, - sizeof(struct clock_id)); + ptp_data->client_clock_id = *client_clkid; /* Enable flag for hardware timestamping. */ created_pkt->ol_flags |= RTE_MBUF_F_TX_IEEE1588_TMST; -- 2.45.2