net/dpaa2: update MC firmware version
authorSachin Saxena <sachin.saxena@nxp.com>
Tue, 10 Sep 2019 10:30:51 +0000 (16:00 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 23 Oct 2019 14:43:08 +0000 (16:43 +0200)
MC firmware is the core component of FSLMC bus and net/DPAA2 devices.

Prior to this patch, MC firmware supported 10.14.x version. This
patch bumps the min supported version to 10.18.x.

Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
drivers/net/dpaa2/base/dpaa2_hw_dpni.c
drivers/net/dpaa2/dpaa2_ethdev.c
drivers/net/dpaa2/dpaa2_flow.c
drivers/net/dpaa2/mc/dpni.c
drivers/net/dpaa2/mc/fsl_dpni.h
drivers/net/dpaa2/mc/fsl_dpni_cmd.h
drivers/net/dpaa2/mc/fsl_net.h

index 56e2e56..16555d7 100644 (file)
@@ -365,6 +365,7 @@ dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv,
        }
 
        /*Attach buffer pool to the network interface as described by the user*/
+       memset(&bpool_cfg, 0, sizeof(struct dpni_pools_cfg));
        bpool_cfg.num_dpbp = 1;
        bpool_cfg.pools[0].dpbp_id = bp_list->buf_pool.dpbp_node->dpbp_id;
        bpool_cfg.pools[0].backup_pool = 0;
index d241643..03131b9 100644 (file)
@@ -128,8 +128,8 @@ dpaa2_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
        }
 
        if (on)
-               ret = dpni_add_vlan_id(dpni, CMD_PRI_LOW,
-                                      priv->token, vlan_id);
+               ret = dpni_add_vlan_id(dpni, CMD_PRI_LOW, priv->token,
+                                      vlan_id, 0, 0, 0);
        else
                ret = dpni_remove_vlan_id(dpni, CMD_PRI_LOW,
                                          priv->token, vlan_id);
@@ -1326,8 +1326,8 @@ dpaa2_dev_add_mac_addr(struct rte_eth_dev *dev,
                return -1;
        }
 
-       ret = dpni_add_mac_addr(dpni, CMD_PRI_LOW,
-                               priv->token, addr->addr_bytes);
+       ret = dpni_add_mac_addr(dpni, CMD_PRI_LOW, priv->token,
+                               addr->addr_bytes, 0, 0, 0);
        if (ret)
                DPAA2_PMD_ERR(
                        "error: Adding the MAC ADDR failed: err = %d", ret);
index 572eb84..2212650 100644 (file)
@@ -1505,7 +1505,8 @@ dpaa2_generic_flow_set(struct rte_flow *flow,
                        index = flow->index + (flow->tc_id * nic_attr.fs_entries);
                        ret = dpni_add_qos_entry(dpni, CMD_PRI_LOW,
                                                priv->token, &flow->rule,
-                                               flow->tc_id, index);
+                                               flow->tc_id, index,
+                                               0, 0);
                        if (ret < 0) {
                                DPAA2_PMD_ERR(
                                "Error in addnig entry to QoS table(%d)", ret);
@@ -1607,7 +1608,7 @@ dpaa2_generic_flow_set(struct rte_flow *flow,
                        index = flow->index + (flow->tc_id * nic_attr.fs_entries);
                        ret = dpni_add_qos_entry(dpni, CMD_PRI_LOW, priv->token,
                                                &flow->rule, flow->tc_id,
-                                               index);
+                                               index, 0, 0);
                        if (ret < 0) {
                                DPAA2_PMD_ERR(
                                "Error in entry addition in QoS table(%d)",
index b37f997..0950ee0 100644 (file)
@@ -200,6 +200,7 @@ int dpni_set_pools(struct fsl_mc_io *mc_io,
                                          token);
        cmd_params = (struct dpni_cmd_set_pools *)cmd.params;
        cmd_params->num_dpbp = cfg->num_dpbp;
+       cmd_params->pool_options = cfg->pool_options;
        for (i = 0; i < cmd_params->num_dpbp; i++) {
                cmd_params->pool[i].dpbp_id =
                        cpu_to_le16(cfg->pools[i].dpbp_id);
@@ -1211,13 +1212,24 @@ int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io,
  * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
  * @token:     Token of DPNI object
  * @mac_addr:  MAC address to add
- *
+ * @flags :    0 - tc_id and flow_id will be ignored.
+ *               Pkt with this mac_id will be passed to the next
+ *               classification stages
+ *             DPNI_MAC_SET_QUEUE_ACTION
+ *               Pkt with this mac will be forward directly to
+ *               queue defined by the tc_id and flow_id
+ * @tc_id : Traffic class selection (0-7)
+ * @flow_id : Selects the specific queue out of the set allocated for the
+ *            same as tc_id. Value must be in range 0 to NUM_QUEUES - 1
  * Return:     '0' on Success; Error code otherwise.
  */
 int dpni_add_mac_addr(struct fsl_mc_io *mc_io,
                      uint32_t cmd_flags,
                      uint16_t token,
-                     const uint8_t mac_addr[6])
+                     const uint8_t mac_addr[6],
+                         uint8_t flags,
+                         uint8_t tc_id,
+                         uint8_t flow_id)
 {
        struct mc_command cmd = { 0 };
        struct dpni_cmd_add_mac_addr *cmd_params;
@@ -1228,6 +1240,10 @@ int dpni_add_mac_addr(struct fsl_mc_io *mc_io,
                                          cmd_flags,
                                          token);
        cmd_params = (struct dpni_cmd_add_mac_addr *)cmd.params;
+       cmd_params->flags = flags;
+       cmd_params->tc_id = tc_id;
+       cmd_params->fq_id = flow_id;
+
        for (i = 0; i < 6; i++)
                cmd_params->mac_addr[i] = mac_addr[5 - i];
 
@@ -1371,13 +1387,26 @@ int dpni_enable_vlan_filter(struct fsl_mc_io *mc_io,
  * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
  * @token:     Token of DPNI object
  * @vlan_id:   VLAN ID to add
+ * @flags:     0 - tc_id and flow_id will be ignored.
+ *               Pkt with this vlan_id will be passed to the next
+ *               classification stages
+ *             DPNI_VLAN_SET_QUEUE_ACTION
+ *               Pkt with this vlan_id will be forward directly to
+ *               queue defined by the tc_id and flow_id
+ *
+ * @tc_id: Traffic class selection (0-7)
+ * @flow_id: Selects the specific queue out of the set allocated for the
+ *           same as tc_id. Value must be in range 0 to NUM_QUEUES - 1
  *
  * Return:     '0' on Success; Error code otherwise.
  */
 int dpni_add_vlan_id(struct fsl_mc_io *mc_io,
                     uint32_t cmd_flags,
                     uint16_t token,
-                    uint16_t vlan_id)
+                    uint16_t vlan_id,
+                        uint8_t flags,
+                        uint8_t tc_id,
+                        uint8_t flow_id)
 {
        struct dpni_cmd_vlan_id *cmd_params;
        struct mc_command cmd = { 0 };
@@ -1387,6 +1416,9 @@ int dpni_add_vlan_id(struct fsl_mc_io *mc_io,
                                          cmd_flags,
                                          token);
        cmd_params = (struct dpni_cmd_vlan_id *)cmd.params;
+       cmd_params->flags = flags;
+       cmd_params->tc_id = tc_id;
+       cmd_params->flow_id =  flow_id;
        cmd_params->vlan_id = cpu_to_le16(vlan_id);
 
        /* send command to mc*/
@@ -1589,7 +1621,9 @@ int dpni_add_qos_entry(struct fsl_mc_io *mc_io,
                       uint16_t token,
                       const struct dpni_rule_cfg *cfg,
                       uint8_t tc_id,
-                      uint16_t index)
+                      uint16_t index,
+                          uint8_t flags,
+                          uint8_t flow_id)
 {
        struct dpni_cmd_add_qos_entry *cmd_params;
        struct mc_command cmd = { 0 };
@@ -1599,6 +1633,8 @@ int dpni_add_qos_entry(struct fsl_mc_io *mc_io,
                                          cmd_flags,
                                          token);
        cmd_params = (struct dpni_cmd_add_qos_entry *)cmd.params;
+       cmd_params->flags = flags;
+       cmd_params->flow_id = flow_id;
        cmd_params->tc_id = tc_id;
        cmd_params->key_size = cfg->key_size;
        cmd_params->index = cpu_to_le16(index);
@@ -2031,7 +2067,7 @@ int dpni_get_queue(struct fsl_mc_io *mc_io,
  * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
  * @token:     Token of DPNI object
  * @page:      Selects the statistics page to retrieve, see
- *             DPNI_GET_STATISTICS output. Pages are numbered 0 to 3.
+ *             DPNI_GET_STATISTICS output. Pages are numbered 0 to 6.
  * @param:     Custom parameter for some pages used to select
  *             a certain statistic source, for example the TC.
  * @stat:      Structure containing the statistics
index 97fde31..51b39bd 100644 (file)
@@ -199,6 +199,8 @@ int dpni_destroy(struct fsl_mc_io *mc_io,
 /**
  * struct dpni_pools_cfg - Structure representing buffer pools configuration
  * @num_dpbp:  Number of DPBPs
+ * @pool_options: Buffer assignment options
+ *                This field is a combination of DPNI_POOL_ASSOC_flags
  * @pools:     Array of buffer pools parameters; The number of valid entries
  *             must match 'num_dpbp' value
  * @pools.dpbp_id:     DPBP object ID
@@ -207,8 +209,13 @@ int dpni_destroy(struct fsl_mc_io *mc_io,
  * @pools.buffer_size: Buffer size
  * @pools.backup_pool: Backup pool
  */
+
+#define DPNI_POOL_ASSOC_QPRI   0
+#define DPNI_POOL_ASSOC_QDBIN  1
+
 struct dpni_pools_cfg {
        uint8_t num_dpbp;
+       uint8_t pool_options;
        struct {
                int             dpbp_id;
                uint8_t         priority_mask;
@@ -581,6 +588,7 @@ int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io,
  * @page_5.policer_cnt_green: number of green colored frames
  * @page_5.policer_cnt_re_red: number of recolored red frames
  * @page_5.policer_cnt_re_yellow: number of recolored yellow frames
+ * @page_6.tx_pending_frames_cnt: total number of frames pending in Tx queues
  * @raw: raw statistics structure, used to index counters
  */
 union dpni_statistics {
@@ -624,6 +632,9 @@ union dpni_statistics {
                uint64_t policer_cnt_re_red;
                uint64_t policer_cnt_re_yellow;
        } page_5;
+       struct {
+               uint64_t tx_pending_frames_cnt;
+       } page_6;
        struct {
                uint64_t counter[DPNI_STATISTICS_CNT];
        } raw;
@@ -773,7 +784,10 @@ 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]);
+                     const uint8_t mac_addr[6],
+                         uint8_t flags,
+                         uint8_t tc_id,
+                         uint8_t flow_id);
 
 int dpni_remove_mac_addr(struct fsl_mc_io *mc_io,
                         uint32_t cmd_flags,
@@ -796,10 +810,18 @@ int dpni_enable_vlan_filter(struct fsl_mc_io *mc_io,
                            uint16_t token,
                            int en);
 
+/**
+ * Set vlan filter queue action
+ */
+#define DPNI_VLAN_SET_QUEUE_ACTION 1
+
 int dpni_add_vlan_id(struct fsl_mc_io *mc_io,
                     uint32_t cmd_flags,
                     uint16_t token,
-                    uint16_t vlan_id);
+                    uint16_t vlan_id,
+                        uint8_t flags,
+                        uint8_t tc_id,
+                        uint8_t flow_id);
 
 int dpni_remove_vlan_id(struct fsl_mc_io *mc_io,
                        uint32_t cmd_flags,
@@ -1181,7 +1203,9 @@ int dpni_add_qos_entry(struct fsl_mc_io *mc_io,
                       uint16_t token,
                       const struct dpni_rule_cfg *cfg,
                       uint8_t tc_id,
-                      uint16_t index);
+                      uint16_t index,
+                          uint8_t flags,
+                          uint8_t flow_id);
 
 int dpni_remove_qos_entry(struct fsl_mc_io *mc_io,
                          uint32_t cmd_flags,
index dfaccd9..9e73762 100644 (file)
@@ -9,7 +9,7 @@
 
 /* DPNI Version */
 #define DPNI_VER_MAJOR                         7
-#define DPNI_VER_MINOR                         9
+#define DPNI_VER_MINOR                         13
 
 #define DPNI_CMD_BASE_VERSION                  1
 #define DPNI_CMD_VERSION_2                     2
@@ -40,7 +40,7 @@
 #define DPNI_CMDID_GET_IRQ_STATUS              DPNI_CMD(0x016)
 #define DPNI_CMDID_CLEAR_IRQ_STATUS            DPNI_CMD(0x017)
 
-#define DPNI_CMDID_SET_POOLS                   DPNI_CMD_V2(0x200)
+#define DPNI_CMDID_SET_POOLS                   DPNI_CMD_V3(0x200)
 #define DPNI_CMDID_SET_ERRORS_BEHAVIOR         DPNI_CMD(0x20B)
 
 #define DPNI_CMDID_GET_QDID                    DPNI_CMD(0x210)
 #define DPNI_CMDID_GET_UNICAST_PROMISC         DPNI_CMD(0x223)
 #define DPNI_CMDID_SET_PRIM_MAC                        DPNI_CMD(0x224)
 #define DPNI_CMDID_GET_PRIM_MAC                        DPNI_CMD(0x225)
-#define DPNI_CMDID_ADD_MAC_ADDR                        DPNI_CMD(0x226)
+#define DPNI_CMDID_ADD_MAC_ADDR                        DPNI_CMD_V2(0x226)
 #define DPNI_CMDID_REMOVE_MAC_ADDR             DPNI_CMD(0x227)
 #define DPNI_CMDID_CLR_MAC_FILTERS             DPNI_CMD(0x228)
 
 #define DPNI_CMDID_ENABLE_VLAN_FILTER          DPNI_CMD(0x230)
-#define DPNI_CMDID_ADD_VLAN_ID                 DPNI_CMD(0x231)
+#define DPNI_CMDID_ADD_VLAN_ID                 DPNI_CMD_V2(0x231)
 #define DPNI_CMDID_REMOVE_VLAN_ID              DPNI_CMD(0x232)
 #define DPNI_CMDID_CLR_VLAN_FILTERS            DPNI_CMD(0x233)
 
 #define DPNI_CMDID_SET_RX_TC_DIST              DPNI_CMD_V3(0x235)
 
 #define DPNI_CMDID_SET_QOS_TBL                 DPNI_CMD_V2(0x240)
-#define DPNI_CMDID_ADD_QOS_ENT                 DPNI_CMD(0x241)
+#define DPNI_CMDID_ADD_QOS_ENT                 DPNI_CMD_V2(0x241)
 #define DPNI_CMDID_REMOVE_QOS_ENT              DPNI_CMD(0x242)
 #define DPNI_CMDID_CLR_QOS_TBL                 DPNI_CMD(0x243)
 #define DPNI_CMDID_ADD_FS_ENT                  DPNI_CMD(0x244)
@@ -153,7 +153,8 @@ struct dpni_cmd_pool {
 struct dpni_cmd_set_pools {
        uint8_t num_dpbp;
        uint8_t backup_pool_mask;
-       uint16_t pad;
+       uint8_t pad;
+       uint8_t pool_options;
        struct dpni_cmd_pool pool[8];
        uint16_t buffer_size[8];
 };
@@ -392,9 +393,14 @@ struct dpni_rsp_get_port_mac_addr {
        uint8_t mac_addr[6];
 };
 
+#define DPNI_MAC_SET_QUEUE_ACTION 1
+
 struct dpni_cmd_add_mac_addr {
-       uint16_t pad;
+       uint8_t flags;
+       uint8_t pad;
        uint8_t mac_addr[6];
+       uint8_t tc_id;
+       uint8_t fq_id;
 };
 
 struct dpni_cmd_remove_mac_addr {
@@ -417,8 +423,13 @@ struct dpni_cmd_enable_vlan_filter {
        uint8_t en;
 };
 
+#define DPNI_VLAN_SET_QUEUE_ACTION 1
+
 struct dpni_cmd_vlan_id {
-       uint32_t pad;
+       uint8_t flags;
+       uint8_t tc_id;
+       uint8_t flow_id;
+       uint8_t pad;
        uint16_t vlan_id;
 };
 
@@ -534,8 +545,12 @@ struct dpni_cmd_set_qos_table {
        uint64_t key_cfg_iova;
 };
 
+#define DPNI_QOS_OPT_SET_TC_ONLY 0x0
+#define DPNI_QOS_OPT_SET_FLOW_ID 0x1
+
 struct dpni_cmd_add_qos_entry {
-       uint16_t pad;
+       uint8_t flags;
+       uint8_t flow_id;
        uint8_t tc_id;
        uint8_t key_size;
        uint16_t index;
index 0dc0131..3eaad2f 100644 (file)
@@ -1,8 +1,10 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
  *
  * Copyright 2013-2015 Freescale Semiconductor Inc.
+ * Copyright 2018-2019 NXP
  *
  */
+
 #ifndef __FSL_NET_H
 #define __FSL_NET_H