bus/dpaa: fix statistics reading
Reading of word un-aligned values after reading word aligned values lead to corruption of memory. This patch make changes such that word aligned access is made, before making an un-aligned access Fixes: 6d6b4f49a155 ("bus/dpaa: add FMAN hardware operations") Cc: stable@dpdk.org Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
This commit is contained in:
parent
a675f35d78
commit
e62a3f4183
@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* Copyright 2017 NXP
|
||||
* Copyright 2017,2020 NXP
|
||||
*
|
||||
*/
|
||||
|
||||
@ -219,20 +219,20 @@ fman_if_stats_get(struct fman_if *p, struct rte_eth_stats *stats)
|
||||
struct memac_regs *regs = m->ccsr_map;
|
||||
|
||||
/* read recved packet count */
|
||||
stats->ipackets = ((u64)in_be32(®s->rfrm_u)) << 32 |
|
||||
in_be32(®s->rfrm_l);
|
||||
stats->ibytes = ((u64)in_be32(®s->roct_u)) << 32 |
|
||||
in_be32(®s->roct_l);
|
||||
stats->ierrors = ((u64)in_be32(®s->rerr_u)) << 32 |
|
||||
in_be32(®s->rerr_l);
|
||||
stats->ipackets = (u64)in_be32(®s->rfrm_l) |
|
||||
((u64)in_be32(®s->rfrm_u)) << 32;
|
||||
stats->ibytes = (u64)in_be32(®s->roct_l) |
|
||||
((u64)in_be32(®s->roct_u)) << 32;
|
||||
stats->ierrors = (u64)in_be32(®s->rerr_l) |
|
||||
((u64)in_be32(®s->rerr_u)) << 32;
|
||||
|
||||
/* read xmited packet count */
|
||||
stats->opackets = ((u64)in_be32(®s->tfrm_u)) << 32 |
|
||||
in_be32(®s->tfrm_l);
|
||||
stats->obytes = ((u64)in_be32(®s->toct_u)) << 32 |
|
||||
in_be32(®s->toct_l);
|
||||
stats->oerrors = ((u64)in_be32(®s->terr_u)) << 32 |
|
||||
in_be32(®s->terr_l);
|
||||
stats->opackets = (u64)in_be32(®s->tfrm_l) |
|
||||
((u64)in_be32(®s->tfrm_u)) << 32;
|
||||
stats->obytes = (u64)in_be32(®s->toct_l) |
|
||||
((u64)in_be32(®s->toct_u)) << 32;
|
||||
stats->oerrors = (u64)in_be32(®s->terr_l) |
|
||||
((u64)in_be32(®s->terr_u)) << 32;
|
||||
}
|
||||
|
||||
void
|
||||
@ -244,10 +244,9 @@ fman_if_stats_get_all(struct fman_if *p, uint64_t *value, int n)
|
||||
uint64_t base_offset = offsetof(struct memac_regs, reoct_l);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
value[i] = ((u64)in_be32((char *)regs
|
||||
+ base_offset + 8 * i + 4)) << 32 |
|
||||
((u64)in_be32((char *)regs
|
||||
+ base_offset + 8 * i));
|
||||
value[i] = (((u64)in_be32((char *)regs + base_offset + 8 * i) |
|
||||
(u64)in_be32((char *)regs + base_offset +
|
||||
8 * i + 4)) << 32);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
x
Reference in New Issue
Block a user