[v3,08/19] examples/ptpclient: replace rte_memcpy with assignment
Checks
Commit Message
Don't use rte_memcpy() when not necessary. Structure assignment
is as fast and type safe.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/ptpclient/ptpclient.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
@@ -363,9 +363,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;
}
@@ -470,9 +468,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;