net/ixgbe: support power management on VF
[dpdk.git] / drivers / net / bnxt / tf_core / tf_util.c
index a901054..ca37df5 100644 (file)
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2014-2019 Broadcom
+ * Copyright(c) 2014-2021 Broadcom
  * All rights reserved.
  */
 
@@ -7,8 +7,8 @@
 
 #include "tf_util.h"
 
-const char
-*tf_dir_2_str(enum tf_dir dir)
+const char *
+tf_dir_2_str(enum tf_dir dir)
 {
        switch (dir) {
        case TF_DIR_RX:
@@ -20,12 +20,14 @@ const char
        }
 }
 
-const char
-*tf_ident_2_str(enum tf_identifier_type id_type)
+const char *
+tf_ident_2_str(enum tf_identifier_type id_type)
 {
        switch (id_type) {
-       case TF_IDENT_TYPE_L2_CTXT:
-               return "l2_ctxt_remap";
+       case TF_IDENT_TYPE_L2_CTXT_HIGH:
+               return "l2_ctxt_remap_high";
+       case TF_IDENT_TYPE_L2_CTXT_LOW:
+               return "l2_ctxt_remap_low";
        case TF_IDENT_TYPE_PROF_FUNC:
                return "prof_func";
        case TF_IDENT_TYPE_WC_PROF:
@@ -39,12 +41,14 @@ const char
        }
 }
 
-const char
-*tf_tcam_tbl_2_str(enum tf_tcam_tbl_type tcam_type)
+const char *
+tf_tcam_tbl_2_str(enum tf_tcam_tbl_type tcam_type)
 {
        switch (tcam_type) {
-       case TF_TCAM_TBL_TYPE_L2_CTXT_TCAM:
-               return "l2_ctxt_tcam";
+       case TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH:
+               return "l2_ctxt_tcam_high";
+       case TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW:
+               return "l2_ctxt_tcam_low";
        case TF_TCAM_TBL_TYPE_PROF_TCAM:
                return "prof_tcam";
        case TF_TCAM_TBL_TYPE_WC_TCAM:
@@ -60,8 +64,8 @@ const char
        }
 }
 
-const char
-*tf_tbl_type_2_str(enum tf_tbl_type tbl_type)
+const char *
+tf_tbl_type_2_str(enum tf_tbl_type tbl_type)
 {
        switch (tbl_type) {
        case TF_TBL_TYPE_FULL_ACT_RECORD:
@@ -88,14 +92,8 @@ const char
                return "NAT Source Port";
        case TF_TBL_TYPE_ACT_MODIFY_DPORT:
                return "NAT Destination Port";
-       case TF_TBL_TYPE_ACT_MODIFY_IPV4_SRC:
-               return "NAT IPv4 Source";
-       case TF_TBL_TYPE_ACT_MODIFY_IPV4_DEST:
-               return "NAT IPv4 Destination";
-       case TF_TBL_TYPE_ACT_MODIFY_IPV6_SRC:
-               return "NAT IPv6 Source";
-       case TF_TBL_TYPE_ACT_MODIFY_IPV6_DEST:
-               return "NAT IPv6 Destination";
+       case TF_TBL_TYPE_ACT_MODIFY_IPV4:
+               return "NAT IPv4";
        case TF_TBL_TYPE_METER_PROF:
                return "Meter Profile";
        case TF_TBL_TYPE_METER_INST:
@@ -131,8 +129,8 @@ const char
        }
 }
 
-const char
-*tf_em_tbl_type_2_str(enum tf_em_tbl_type em_type)
+const char *
+tf_em_tbl_type_2_str(enum tf_em_tbl_type em_type)
 {
        switch (em_type) {
        case TF_EM_TBL_TYPE_EM_RECORD:
@@ -143,3 +141,38 @@ const char
                return "Invalid EM type";
        }
 }
+
+const char *
+tf_device_module_type_subtype_2_str(enum tf_device_module_type dm_type,
+                                   uint16_t mod_type)
+{
+       switch (dm_type) {
+       case TF_DEVICE_MODULE_TYPE_IDENTIFIER:
+               return tf_ident_2_str(mod_type);
+       case TF_DEVICE_MODULE_TYPE_TABLE:
+               return tf_tbl_type_2_str(mod_type);
+       case TF_DEVICE_MODULE_TYPE_TCAM:
+               return tf_tcam_tbl_2_str(mod_type);
+       case TF_DEVICE_MODULE_TYPE_EM:
+               return tf_em_tbl_type_2_str(mod_type);
+       default:
+               return "Invalid Device Module type";
+       }
+}
+
+const char *
+tf_device_module_type_2_str(enum tf_device_module_type dm_type)
+{
+       switch (dm_type) {
+       case TF_DEVICE_MODULE_TYPE_IDENTIFIER:
+               return "Identifier";
+       case TF_DEVICE_MODULE_TYPE_TABLE:
+               return "Table";
+       case TF_DEVICE_MODULE_TYPE_TCAM:
+               return "TCAM";
+       case TF_DEVICE_MODULE_TYPE_EM:
+               return "EM";
+       default:
+               return "Invalid Device Module type";
+       }
+}