layerscape: add patches-5.4
[openwrt/staging/dedeckeh.git] / target / linux / layerscape / patches-5.4 / 701-net-0206-dpaa2-eth-Add-API-for-counters-reset.patch
1 From 991c03df1b0543ed02a5d4e803ac8fa9d993fb8e Mon Sep 17 00:00:00 2001
2 From: Ioana Radulescu <ruxandra.radulescu@nxp.com>
3 Date: Tue, 9 May 2017 16:36:39 +0300
4 Subject: [PATCH] dpaa2-eth: Add API for counters reset
5
6 Add DPNI object API function for resetting interface
7 hardware counters.
8
9 Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
10 ---
11 drivers/net/ethernet/freescale/dpaa2/dpni-cmd.h | 1 +
12 drivers/net/ethernet/freescale/dpaa2/dpni.c | 23 +++++++++++++++++++++++
13 drivers/net/ethernet/freescale/dpaa2/dpni.h | 4 ++++
14 3 files changed, 28 insertions(+)
15
16 --- a/drivers/net/ethernet/freescale/dpaa2/dpni-cmd.h
17 +++ b/drivers/net/ethernet/freescale/dpaa2/dpni-cmd.h
18 @@ -68,6 +68,7 @@
19 #define DPNI_CMDID_CLR_FS_ENT DPNI_CMD(0x246)
20
21 #define DPNI_CMDID_GET_STATISTICS DPNI_CMD(0x25D)
22 +#define DPNI_CMDID_RESET_STATISTICS DPNI_CMD(0x25E)
23 #define DPNI_CMDID_GET_QUEUE DPNI_CMD(0x25F)
24 #define DPNI_CMDID_SET_QUEUE DPNI_CMD(0x260)
25 #define DPNI_CMDID_GET_TAILDROP DPNI_CMD(0x261)
26 --- a/drivers/net/ethernet/freescale/dpaa2/dpni.c
27 +++ b/drivers/net/ethernet/freescale/dpaa2/dpni.c
28 @@ -1582,6 +1582,29 @@ int dpni_get_statistics(struct fsl_mc_io
29 }
30
31 /**
32 + * dpni_reset_statistics() - Clears DPNI statistics
33 + * @mc_io: Pointer to MC portal's I/O object
34 + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
35 + * @token: Token of DPNI object
36 + *
37 + * Return: '0' on Success; Error code otherwise.
38 + */
39 +int dpni_reset_statistics(struct fsl_mc_io *mc_io,
40 + u32 cmd_flags,
41 + u16 token)
42 +{
43 + struct fsl_mc_command cmd = { 0 };
44 +
45 + /* prepare command */
46 + cmd.header = mc_encode_cmd_header(DPNI_CMDID_RESET_STATISTICS,
47 + cmd_flags,
48 + token);
49 +
50 + /* send command to mc*/
51 + return mc_send_command(mc_io, &cmd);
52 +}
53 +
54 +/**
55 * dpni_set_taildrop() - Set taildrop per queue or TC
56 * @mc_io: Pointer to MC portal's I/O object
57 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
58 --- a/drivers/net/ethernet/freescale/dpaa2/dpni.h
59 +++ b/drivers/net/ethernet/freescale/dpaa2/dpni.h
60 @@ -496,6 +496,10 @@ int dpni_get_statistics(struct fsl_mc_io
61 u8 page,
62 union dpni_statistics *stat);
63
64 +int dpni_reset_statistics(struct fsl_mc_io *mc_io,
65 + u32 cmd_flags,
66 + u16 token);
67 +
68 /**
69 * Enable auto-negotiation
70 */