Merge git://git.denx.de/u-boot-sunxi
[oweals/u-boot.git] / drivers / net / fsl-mc / dpni.c
index 7bc2504f8c3482ade14283f9b8419ecbf59cb4cf..481f9d882b0f647539d60da0cf8641496c12f7b1 100644 (file)
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2013-2015 Freescale Semiconductor
+ * Copyright (C) 2013-2016 Freescale Semiconductor
+ * Copyright 2017 NXP
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
@@ -8,14 +9,38 @@
 #include <fsl-mc/fsl_mc_cmd.h>
 #include <fsl-mc/fsl_dpni.h>
 
-int dpni_open(struct fsl_mc_io *mc_io, int dpni_id, uint16_t *token)
+int dpni_prepare_cfg(const struct dpni_cfg     *cfg,
+                    uint8_t                    *cfg_buf)
+{
+       uint64_t *params = (uint64_t *)cfg_buf;
+
+       DPNI_PREP_CFG(params, cfg);
+
+       return 0;
+}
+
+int dpni_extract_cfg(struct dpni_cfg   *cfg,
+                    const uint8_t      *cfg_buf)
+{
+       uint64_t *params = (uint64_t *)cfg_buf;
+
+       DPNI_EXT_CFG(params, cfg);
+
+       return 0;
+}
+
+int dpni_open(struct fsl_mc_io *mc_io,
+             uint32_t cmd_flags,
+             int dpni_id,
+             uint16_t *token)
 {
        struct mc_command cmd = { 0 };
        int err;
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_OPEN,
-                                         MC_CMD_PRI_LOW, 0);
+                                         cmd_flags,
+                                         0);
        DPNI_CMD_OPEN(cmd, dpni_id);
 
        /* send command to mc*/
@@ -29,213 +54,197 @@ int dpni_open(struct fsl_mc_io *mc_io, int dpni_id, uint16_t *token)
        return 0;
 }
 
-int dpni_close(struct fsl_mc_io *mc_io, uint16_t token)
+int dpni_close(struct fsl_mc_io *mc_io,
+              uint32_t cmd_flags,
+              uint16_t token)
 {
        struct mc_command cmd = { 0 };
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_CLOSE,
-                                         MC_CMD_PRI_HIGH, token);
+                                         cmd_flags,
+                                         token);
 
        /* send command to mc*/
        return mc_send_command(mc_io, &cmd);
 }
 
-int dpni_set_pools(struct fsl_mc_io *mc_io,
-                  uint16_t token,
-                  const struct dpni_pools_cfg *cfg)
+int dpni_create(struct fsl_mc_io *mc_io,
+               uint16_t dprc_token,
+               uint32_t cmd_flags,
+               const struct dpni_cfg *cfg,
+               uint32_t *obj_id)
 {
        struct mc_command cmd = { 0 };
+       int err;
 
        /* prepare command */
-       cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_POOLS,
-                                         MC_CMD_PRI_LOW,
-                                         token);
-       DPNI_CMD_SET_POOLS(cmd, cfg);
+       cmd.header = mc_encode_cmd_header(DPNI_CMDID_CREATE,
+                                         cmd_flags,
+                                         dprc_token);
+       DPNI_CMD_CREATE(cmd, cfg);
 
        /* send command to mc*/
-       return mc_send_command(mc_io, &cmd);
-}
-
-int dpni_enable(struct fsl_mc_io *mc_io, uint16_t token)
-{
-       struct mc_command cmd = { 0 };
+       err = mc_send_command(mc_io, &cmd);
+       if (err)
+               return err;
 
-       /* prepare command */
-       cmd.header = mc_encode_cmd_header(DPNI_CMDID_ENABLE,
-                                         MC_CMD_PRI_LOW, token);
+       /* retrieve response parameters */
+        MC_CMD_READ_OBJ_ID(cmd, *obj_id);
 
-       /* send command to mc*/
-       return mc_send_command(mc_io, &cmd);
+       return 0;
 }
 
-int dpni_disable(struct fsl_mc_io *mc_io, uint16_t token)
+int dpni_destroy(struct fsl_mc_io *mc_io,
+                uint16_t dprc_token,
+                uint32_t cmd_flags,
+                uint32_t obj_id)
 {
        struct mc_command cmd = { 0 };
 
        /* prepare command */
-       cmd.header = mc_encode_cmd_header(DPNI_CMDID_DISABLE,
-                                         MC_CMD_PRI_LOW,
-                                         token);
+       cmd.header = mc_encode_cmd_header(DPNI_CMDID_DESTROY,
+                                         cmd_flags,
+                                         dprc_token);
+
+       /* set object id to destroy */
+       CMD_DESTROY_SET_OBJ_ID_PARAM0(cmd, obj_id);
 
        /* send command to mc*/
        return mc_send_command(mc_io, &cmd);
 }
 
-int dpni_reset(struct fsl_mc_io *mc_io, uint16_t token)
+int dpni_set_pools(struct fsl_mc_io *mc_io,
+                  uint32_t cmd_flags,
+                  uint16_t token,
+                  const struct dpni_pools_cfg *cfg)
 {
        struct mc_command cmd = { 0 };
 
        /* prepare command */
-       cmd.header = mc_encode_cmd_header(DPNI_CMDID_RESET,
-                                         MC_CMD_PRI_LOW, token);
+       cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_POOLS,
+                                         cmd_flags,
+                                         token);
+       DPNI_CMD_SET_POOLS(cmd, cfg);
 
        /* send command to mc*/
        return mc_send_command(mc_io, &cmd);
 }
 
-int dpni_get_attributes(struct fsl_mc_io *mc_io,
-                       uint16_t token,
-                       struct dpni_attr *attr)
+int dpni_enable(struct fsl_mc_io *mc_io,
+               uint32_t cmd_flags,
+               uint16_t token)
 {
        struct mc_command cmd = { 0 };
-       int err;
 
        /* prepare command */
-       cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_ATTR,
-                                         MC_CMD_PRI_LOW,
+       cmd.header = mc_encode_cmd_header(DPNI_CMDID_ENABLE,
+                                         cmd_flags,
                                          token);
 
        /* send command to mc*/
-       err = mc_send_command(mc_io, &cmd);
-       if (err)
-               return err;
-
-       /* retrieve response parameters */
-       DPNI_RSP_GET_ATTR(cmd, attr);
-
-       return 0;
+       return mc_send_command(mc_io, &cmd);
 }
 
-int dpni_get_rx_buffer_layout(struct fsl_mc_io *mc_io,
-                             uint16_t token,
-                             struct dpni_buffer_layout *layout)
+int dpni_disable(struct fsl_mc_io *mc_io,
+                uint32_t cmd_flags,
+                uint16_t token)
 {
        struct mc_command cmd = { 0 };
-       int err;
 
        /* prepare command */
-       cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_RX_BUFFER_LAYOUT,
-                                         MC_CMD_PRI_LOW, token);
+       cmd.header = mc_encode_cmd_header(DPNI_CMDID_DISABLE,
+                                         cmd_flags,
+                                         token);
 
        /* send command to mc*/
-       err = mc_send_command(mc_io, &cmd);
-       if (err)
-               return err;
-
-       /* retrieve response parameters */
-       DPNI_RSP_GET_RX_BUFFER_LAYOUT(cmd, layout);
-
-       return 0;
+       return mc_send_command(mc_io, &cmd);
 }
 
-int dpni_set_rx_buffer_layout(struct fsl_mc_io *mc_io,
-                             uint16_t token,
-                             const struct dpni_buffer_layout *layout)
+int dpni_reset(struct fsl_mc_io *mc_io,
+              uint32_t cmd_flags,
+              uint16_t token)
 {
        struct mc_command cmd = { 0 };
 
        /* prepare command */
-       cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_RX_BUFFER_LAYOUT,
-                                         MC_CMD_PRI_LOW, token);
-       DPNI_CMD_SET_RX_BUFFER_LAYOUT(cmd, layout);
+       cmd.header = mc_encode_cmd_header(DPNI_CMDID_RESET,
+                                         cmd_flags,
+                                         token);
 
        /* send command to mc*/
        return mc_send_command(mc_io, &cmd);
 }
 
-int dpni_get_tx_buffer_layout(struct fsl_mc_io *mc_io,
-                             uint16_t token,
-                             struct dpni_buffer_layout *layout)
+int dpni_get_attributes(struct fsl_mc_io *mc_io,
+                       uint32_t cmd_flags,
+                       uint16_t token,
+                       struct dpni_attr *attr)
 {
        struct mc_command cmd = { 0 };
        int err;
 
        /* prepare command */
-       cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_TX_BUFFER_LAYOUT,
-                                         MC_CMD_PRI_LOW, token);
-
+       cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_ATTR,
+                                         cmd_flags,
+                                         token);
        /* send command to mc*/
        err = mc_send_command(mc_io, &cmd);
        if (err)
                return err;
 
        /* retrieve response parameters */
-       DPNI_RSP_GET_TX_BUFFER_LAYOUT(cmd, layout);
+       DPNI_RSP_GET_ATTR(cmd, attr);
 
        return 0;
 }
 
-int dpni_set_tx_buffer_layout(struct fsl_mc_io *mc_io,
-                             uint16_t token,
-                             const struct dpni_buffer_layout *layout)
+int dpni_set_errors_behavior(struct fsl_mc_io *mc_io,
+                            uint32_t cmd_flags,
+                            uint16_t token,
+                             struct dpni_error_cfg *cfg)
 {
        struct mc_command cmd = { 0 };
 
        /* prepare command */
-       cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_TX_BUFFER_LAYOUT,
-                                         MC_CMD_PRI_LOW, token);
-       DPNI_CMD_SET_TX_BUFFER_LAYOUT(cmd, layout);
+       cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_ERRORS_BEHAVIOR,
+                                         cmd_flags,
+                                         token);
+       DPNI_CMD_SET_ERRORS_BEHAVIOR(cmd, cfg);
 
        /* send command to mc*/
        return mc_send_command(mc_io, &cmd);
 }
 
-int dpni_get_tx_conf_buffer_layout(struct fsl_mc_io *mc_io,
-                                  uint16_t token,
-                                  struct dpni_buffer_layout *layout)
-{
-       struct mc_command cmd = { 0 };
-       int err;
-
-       /* prepare command */
-       cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_TX_CONF_BUFFER_LAYOUT,
-                                         MC_CMD_PRI_LOW, token);
-
-       /* send command to mc*/
-       err = mc_send_command(mc_io, &cmd);
-       if (err)
-               return err;
-
-       /* retrieve response parameters */
-       DPNI_RSP_GET_TX_CONF_BUFFER_LAYOUT(cmd, layout);
-
-       return 0;
-}
-
-int dpni_set_tx_conf_buffer_layout(struct fsl_mc_io *mc_io,
-                                  uint16_t token,
-                                  const struct dpni_buffer_layout *layout)
+int dpni_set_buffer_layout(struct fsl_mc_io *mc_io,
+                          uint32_t cmd_flags,
+                          uint16_t token,
+                          const struct dpni_buffer_layout *layout,
+                          enum dpni_queue_type type)
 {
        struct mc_command cmd = { 0 };
 
        /* prepare command */
-       cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_TX_CONF_BUFFER_LAYOUT,
-                                         MC_CMD_PRI_LOW, token);
-       DPNI_CMD_SET_TX_CONF_BUFFER_LAYOUT(cmd, layout);
+       cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_BUFFER_LAYOUT,
+                                         cmd_flags,
+                                         token);
+       DPNI_CMD_SET_BUFFER_LAYOUT(cmd, layout, type);
 
        /* send command to mc*/
        return mc_send_command(mc_io, &cmd);
 }
 
-int dpni_get_qdid(struct fsl_mc_io *mc_io, uint16_t token, uint16_t *qdid)
+int dpni_get_qdid(struct fsl_mc_io *mc_io,
+                 uint32_t cmd_flags,
+                 uint16_t token,
+                 uint16_t *qdid)
 {
        struct mc_command cmd = { 0 };
        int err;
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_QDID,
-                                         MC_CMD_PRI_LOW,
+                                         cmd_flags,
                                          token);
 
        /* send command to mc*/
@@ -250,6 +259,7 @@ int dpni_get_qdid(struct fsl_mc_io *mc_io, uint16_t token, uint16_t *qdid)
 }
 
 int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io,
+                           uint32_t cmd_flags,
                            uint16_t token,
                            uint16_t *data_offset)
 {
@@ -258,7 +268,8 @@ int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_TX_DATA_OFFSET,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
 
        /* send command to mc*/
        err = mc_send_command(mc_io, &cmd);
@@ -271,55 +282,17 @@ int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io,
        return 0;
 }
 
-int dpni_get_counter(struct fsl_mc_io *mc_io,
-                    uint16_t token,
-                    enum dpni_counter counter,
-                    uint64_t *value)
-{
-       struct mc_command cmd = { 0 };
-       int err;
-
-       /* prepare command */
-       cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_COUNTER,
-                                         MC_CMD_PRI_LOW, token);
-       DPNI_CMD_GET_COUNTER(cmd, counter);
-
-       /* send command to mc*/
-       err = mc_send_command(mc_io, &cmd);
-       if (err)
-               return err;
-
-       /* retrieve response parameters */
-       DPNI_RSP_GET_COUNTER(cmd, *value);
-
-       return 0;
-}
-
-int dpni_set_counter(struct fsl_mc_io *mc_io,
-                    uint16_t token,
-                    enum dpni_counter counter,
-                    uint64_t value)
-{
-       struct mc_command cmd = { 0 };
-
-       /* prepare command */
-       cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_COUNTER,
-                                         MC_CMD_PRI_LOW, token);
-       DPNI_CMD_SET_COUNTER(cmd, counter, value);
-
-       /* send command to mc*/
-       return mc_send_command(mc_io, &cmd);
-}
-
 int dpni_set_link_cfg(struct fsl_mc_io *mc_io,
+                     uint32_t cmd_flags,
                      uint16_t token,
-                    const struct dpni_link_cfg *cfg)
+                     const struct dpni_link_cfg *cfg)
 {
        struct mc_command cmd = { 0 };
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_LINK_CFG,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
        DPNI_CMD_SET_LINK_CFG(cmd, cfg);
 
        /* send command to mc*/
@@ -327,6 +300,7 @@ int dpni_set_link_cfg(struct fsl_mc_io *mc_io,
 }
 
 int dpni_get_link_state(struct fsl_mc_io *mc_io,
+                       uint32_t cmd_flags,
                        uint16_t token,
                        struct dpni_link_state *state)
 {
@@ -335,7 +309,8 @@ int dpni_get_link_state(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_LINK_STATE,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
 
        /* send command to mc*/
        err = mc_send_command(mc_io, &cmd);
@@ -350,6 +325,7 @@ int dpni_get_link_state(struct fsl_mc_io *mc_io,
 
 
 int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io,
+                             uint32_t cmd_flags,
                              uint16_t token,
                              const uint8_t mac_addr[6])
 {
@@ -357,7 +333,8 @@ int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_PRIM_MAC,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
        DPNI_CMD_SET_PRIMARY_MAC_ADDR(cmd, mac_addr);
 
        /* send command to mc*/
@@ -365,6 +342,7 @@ int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io,
 }
 
 int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io,
+                             uint32_t cmd_flags,
                              uint16_t token,
                              uint8_t mac_addr[6])
 {
@@ -373,7 +351,8 @@ int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_PRIM_MAC,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
 
        /* send command to mc*/
        err = mc_send_command(mc_io, &cmd);
@@ -387,6 +366,7 @@ int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io,
 }
 
 int dpni_add_mac_addr(struct fsl_mc_io *mc_io,
+                     uint32_t cmd_flags,
                      uint16_t token,
                      const uint8_t mac_addr[6])
 {
@@ -394,7 +374,8 @@ int dpni_add_mac_addr(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_ADD_MAC_ADDR,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
        DPNI_CMD_ADD_MAC_ADDR(cmd, mac_addr);
 
        /* send command to mc*/
@@ -402,6 +383,7 @@ int dpni_add_mac_addr(struct fsl_mc_io *mc_io,
 }
 
 int dpni_remove_mac_addr(struct fsl_mc_io *mc_io,
+                        uint32_t cmd_flags,
                         uint16_t token,
                         const uint8_t mac_addr[6])
 {
@@ -409,49 +391,72 @@ int dpni_remove_mac_addr(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_REMOVE_MAC_ADDR,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
        DPNI_CMD_REMOVE_MAC_ADDR(cmd, mac_addr);
 
        /* send command to mc*/
        return mc_send_command(mc_io, &cmd);
 }
 
-int dpni_set_tx_flow(struct fsl_mc_io *mc_io,
-                    uint16_t token,
-                    uint16_t *flow_id,
-                    const struct dpni_tx_flow_cfg *cfg)
+int dpni_get_api_version(struct fsl_mc_io *mc_io,
+                        u32 cmd_flags,
+                        u16 *major_ver,
+                        u16 *minor_ver)
 {
        struct mc_command cmd = { 0 };
        int err;
 
        /* prepare command */
-       cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_TX_FLOW,
-                                         MC_CMD_PRI_LOW, token);
-       DPNI_CMD_SET_TX_FLOW(cmd, *flow_id, cfg);
+       cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_API_VERSION,
+                                         cmd_flags, 0);
 
-       /* send command to mc*/
+       /* send command to mc */
        err = mc_send_command(mc_io, &cmd);
        if (err)
                return err;
 
        /* retrieve response parameters */
-       DPNI_RSP_SET_TX_FLOW(cmd, *flow_id);
+       mc_cmd_read_api_version(&cmd, major_ver, minor_ver);
 
        return 0;
 }
 
-int dpni_get_tx_flow(struct fsl_mc_io *mc_io,
-                    uint16_t token,
-                    uint16_t flow_id,
-                    struct dpni_tx_flow_attr *attr)
+int dpni_set_queue(struct fsl_mc_io *mc_io,
+       uint32_t cmd_flags,
+       uint16_t token,
+       enum dpni_queue_type type,
+       uint8_t tc,
+       uint8_t index,
+       const struct dpni_queue *queue)
+{
+       struct mc_command cmd = { 0 };
+       /* prepare command */
+       cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_QUEUE,
+                                         cmd_flags,
+                                         token);
+       DPNI_CMD_SET_QUEUE(cmd, type, tc, index, queue);
+
+       /* send command to mc*/
+       return mc_send_command(mc_io, &cmd);
+}
+
+int dpni_get_queue(struct fsl_mc_io *mc_io,
+       uint32_t cmd_flags,
+       uint16_t token,
+       enum dpni_queue_type type,
+       uint8_t tc,
+       uint8_t index,
+       struct dpni_queue *queue)
 {
        struct mc_command cmd = { 0 };
        int err;
 
        /* prepare command */
-       cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_TX_FLOW,
-                                         MC_CMD_PRI_LOW, token);
-       DPNI_CMD_GET_TX_FLOW(cmd, flow_id);
+       cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_QUEUE,
+                                         cmd_flags,
+                                         token);
+       DPNI_CMD_GET_QUEUE(cmd, type, tc, index);
 
        /* send command to mc*/
        err = mc_send_command(mc_io, &cmd);
@@ -459,40 +464,43 @@ int dpni_get_tx_flow(struct fsl_mc_io *mc_io,
                return err;
 
        /* retrieve response parameters */
-       DPNI_RSP_GET_TX_FLOW(cmd, attr);
-
+       DPNI_RSP_GET_QUEUE(cmd, queue);
        return 0;
 }
 
-int dpni_set_rx_flow(struct fsl_mc_io *mc_io,
-                    uint16_t token,
-                    uint8_t tc_id,
-                    uint16_t flow_id,
-                    const struct dpni_queue_cfg *cfg)
+int dpni_set_tx_confirmation_mode(struct fsl_mc_io *mc_io,
+       uint32_t cmd_flags,
+       uint16_t token,
+       enum dpni_confirmation_mode mode)
 {
+       struct dpni_tx_confirmation_mode *cmd_params;
        struct mc_command cmd = { 0 };
 
        /* prepare command */
-       cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_RX_FLOW,
-                                         MC_CMD_PRI_LOW, token);
-       DPNI_CMD_SET_RX_FLOW(cmd, tc_id, flow_id, cfg);
+       cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_TX_CONFIRMATION_MODE,
+                                         cmd_flags,
+                                         token);
+
+       cmd_params = (struct dpni_tx_confirmation_mode *)cmd.params;
+       cmd_params->confirmation_mode = mode;
 
        /* send command to mc*/
        return mc_send_command(mc_io, &cmd);
 }
 
-int dpni_get_rx_flow(struct fsl_mc_io *mc_io,
-                    uint16_t token,
-                    uint8_t tc_id,
-                    uint16_t flow_id,
-                    struct dpni_queue_attr *attr)
+int dpni_get_statistics(struct fsl_mc_io *mc_io,
+                       uint32_t cmd_flags,
+                       uint16_t token,
+                       uint8_t  page,
+                       struct dpni_statistics *stat)
 {
        struct mc_command cmd = { 0 };
        int err;
+
        /* prepare command */
-       cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_RX_FLOW,
-                                         MC_CMD_PRI_LOW, token);
-       DPNI_CMD_GET_RX_FLOW(cmd, tc_id, flow_id);
+       cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_STATISTICS,
+                                         cmd_flags, token);
+       DPNI_CMD_GET_STATISTICS(cmd, page);
 
        /* send command to mc*/
        err = mc_send_command(mc_io, &cmd);
@@ -500,7 +508,22 @@ int dpni_get_rx_flow(struct fsl_mc_io *mc_io,
                return err;
 
        /* retrieve response parameters */
-       DPNI_RSP_GET_RX_FLOW(cmd, attr);
+       DPNI_RSP_GET_STATISTICS(cmd, stat);
 
        return 0;
 }
+
+int dpni_reset_statistics(struct fsl_mc_io *mc_io,
+                         uint32_t cmd_flags,
+                         uint16_t token)
+{
+       struct mc_command cmd = { 0 };
+
+       /* prepare command */
+       cmd.header = mc_encode_cmd_header(DPNI_CMDID_RESET_STATISTICS,
+                                         cmd_flags, token);
+
+       /* send command to mc*/
+       return mc_send_command(mc_io, &cmd);
+}
+