From f493a3fc144adf053c6bb2cf446300c65e9e22c3 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 4 Nov 2010 13:49:19 -0700 Subject: [PATCH] datapath: Use struct assignment in place of memcpy() for copying stats. We might as well take advantage of type safety when we can get it. Signed-off-by: Ben Pfaff Acked-by: Jesse Gross --- datapath/vport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/datapath/vport.c b/datapath/vport.c index 6c8eb084..f0c81823 100644 --- a/datapath/vport.c +++ b/datapath/vport.c @@ -910,7 +910,7 @@ int vport_set_stats(struct vport *vport, struct odp_vport_stats *stats) if (vport->ops->flags & VPORT_F_GEN_STATS) { spin_lock_bh(&vport->stats_lock); - memcpy(&vport->offset_stats, stats, sizeof(struct odp_vport_stats)); + vport->offset_stats = *stats; spin_unlock_bh(&vport->stats_lock); return 0; @@ -1030,7 +1030,7 @@ int vport_get_stats(struct vport *vport, struct odp_vport_stats *stats) spin_lock_bh(&vport->stats_lock); - memcpy(stats, &vport->offset_stats, sizeof(struct odp_vport_stats)); + *stats = vport->offset_stats; stats->rx_errors += vport->err_stats.rx_errors + vport->err_stats.rx_frame_err -- 2.30.2