i40e/base: unify the capability function
[dpdk.git] / drivers / net / i40e / base / i40e_common.c
index cfe071b..8d2f2c7 100644 (file)
@@ -3342,38 +3342,6 @@ i40e_aq_erase_nvm_exit:
        return status;
 }
 
-#define I40E_DEV_FUNC_CAP_SWITCH_MODE  0x01
-#define I40E_DEV_FUNC_CAP_MGMT_MODE    0x02
-#define I40E_DEV_FUNC_CAP_NPAR         0x03
-#define I40E_DEV_FUNC_CAP_OS2BMC       0x04
-#define I40E_DEV_FUNC_CAP_VALID_FUNC   0x05
-#ifdef X722_SUPPORT
-#define I40E_DEV_FUNC_CAP_WOL_PROXY    0x08
-#endif
-#define I40E_DEV_FUNC_CAP_SRIOV_1_1    0x12
-#define I40E_DEV_FUNC_CAP_VF           0x13
-#define I40E_DEV_FUNC_CAP_VMDQ         0x14
-#define I40E_DEV_FUNC_CAP_802_1_QBG    0x15
-#define I40E_DEV_FUNC_CAP_802_1_QBH    0x16
-#define I40E_DEV_FUNC_CAP_VSI          0x17
-#define I40E_DEV_FUNC_CAP_DCB          0x18
-#define I40E_DEV_FUNC_CAP_FCOE         0x21
-#define I40E_DEV_FUNC_CAP_ISCSI                0x22
-#define I40E_DEV_FUNC_CAP_RSS          0x40
-#define I40E_DEV_FUNC_CAP_RX_QUEUES    0x41
-#define I40E_DEV_FUNC_CAP_TX_QUEUES    0x42
-#define I40E_DEV_FUNC_CAP_MSIX         0x43
-#define I40E_DEV_FUNC_CAP_MSIX_VF      0x44
-#define I40E_DEV_FUNC_CAP_FLOW_DIRECTOR        0x45
-#define I40E_DEV_FUNC_CAP_IEEE_1588    0x46
-#define I40E_DEV_FUNC_CAP_FLEX10       0xF1
-#define I40E_DEV_FUNC_CAP_CEM          0xF2
-#define I40E_DEV_FUNC_CAP_IWARP                0x51
-#define I40E_DEV_FUNC_CAP_LED          0x61
-#define I40E_DEV_FUNC_CAP_SDP          0x62
-#define I40E_DEV_FUNC_CAP_MDIO         0x63
-#define I40E_DEV_FUNC_CAP_WR_CSR_PROT  0x64
-
 /**
  * i40e_parse_discover_capabilities
  * @hw: pointer to the hw struct
@@ -3412,79 +3380,146 @@ STATIC void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff,
                major_rev = cap->major_rev;
 
                switch (id) {
-               case I40E_DEV_FUNC_CAP_SWITCH_MODE:
+               case I40E_AQ_CAP_ID_SWITCH_MODE:
                        p->switch_mode = number;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: Switch mode = %d\n",
+                                  p->switch_mode);
                        break;
-               case I40E_DEV_FUNC_CAP_MGMT_MODE:
+               case I40E_AQ_CAP_ID_MNG_MODE:
                        p->management_mode = number;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: Management Mode = %d\n",
+                                  p->management_mode);
                        break;
-               case I40E_DEV_FUNC_CAP_NPAR:
+               case I40E_AQ_CAP_ID_NPAR_ACTIVE:
                        p->npar_enable = number;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: NPAR enable = %d\n",
+                                  p->npar_enable);
                        break;
-               case I40E_DEV_FUNC_CAP_OS2BMC:
+               case I40E_AQ_CAP_ID_OS2BMC_CAP:
                        p->os2bmc = number;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: OS2BMC = %d\n", p->os2bmc);
                        break;
-               case I40E_DEV_FUNC_CAP_VALID_FUNC:
+               case I40E_AQ_CAP_ID_FUNCTIONS_VALID:
                        p->valid_functions = number;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: Valid Functions = %d\n",
+                                  p->valid_functions);
                        break;
-               case I40E_DEV_FUNC_CAP_SRIOV_1_1:
+               case I40E_AQ_CAP_ID_SRIOV:
                        if (number == 1)
                                p->sr_iov_1_1 = true;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: SR-IOV = %d\n",
+                                  p->sr_iov_1_1);
                        break;
-               case I40E_DEV_FUNC_CAP_VF:
+               case I40E_AQ_CAP_ID_VF:
                        p->num_vfs = number;
                        p->vf_base_id = logical_id;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: VF count = %d\n",
+                                  p->num_vfs);
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: VF base_id = %d\n",
+                                  p->vf_base_id);
                        break;
-               case I40E_DEV_FUNC_CAP_VMDQ:
+               case I40E_AQ_CAP_ID_VMDQ:
                        if (number == 1)
                                p->vmdq = true;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: VMDQ = %d\n", p->vmdq);
                        break;
-               case I40E_DEV_FUNC_CAP_802_1_QBG:
+               case I40E_AQ_CAP_ID_8021QBG:
                        if (number == 1)
                                p->evb_802_1_qbg = true;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: 802.1Qbg = %d\n", number);
                        break;
-               case I40E_DEV_FUNC_CAP_802_1_QBH:
+               case I40E_AQ_CAP_ID_8021QBR:
                        if (number == 1)
                                p->evb_802_1_qbh = true;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: 802.1Qbh = %d\n", number);
                        break;
-               case I40E_DEV_FUNC_CAP_VSI:
+               case I40E_AQ_CAP_ID_VSI:
                        p->num_vsis = number;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: VSI count = %d\n",
+                                  p->num_vsis);
                        break;
-               case I40E_DEV_FUNC_CAP_DCB:
+               case I40E_AQ_CAP_ID_DCB:
                        if (number == 1) {
                                p->dcb = true;
                                p->enabled_tcmap = logical_id;
                                p->maxtc = phys_id;
                        }
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: DCB = %d\n", p->dcb);
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: TC Mapping = %d\n",
+                                  logical_id);
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: TC Max = %d\n", p->maxtc);
                        break;
-               case I40E_DEV_FUNC_CAP_FCOE:
+               case I40E_AQ_CAP_ID_FCOE:
                        if (number == 1)
                                p->fcoe = true;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: FCOE = %d\n", p->fcoe);
                        break;
-               case I40E_DEV_FUNC_CAP_ISCSI:
+               case I40E_AQ_CAP_ID_ISCSI:
                        if (number == 1)
                                p->iscsi = true;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: iSCSI = %d\n", p->iscsi);
                        break;
-               case I40E_DEV_FUNC_CAP_RSS:
+               case I40E_AQ_CAP_ID_RSS:
                        p->rss = true;
                        p->rss_table_size = number;
                        p->rss_table_entry_width = logical_id;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: RSS = %d\n", p->rss);
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: RSS table size = %d\n",
+                                  p->rss_table_size);
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: RSS table width = %d\n",
+                                  p->rss_table_entry_width);
                        break;
-               case I40E_DEV_FUNC_CAP_RX_QUEUES:
+               case I40E_AQ_CAP_ID_RXQ:
                        p->num_rx_qp = number;
                        p->base_queue = phys_id;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: Rx QP = %d\n", number);
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: base_queue = %d\n",
+                                  p->base_queue);
                        break;
-               case I40E_DEV_FUNC_CAP_TX_QUEUES:
+               case I40E_AQ_CAP_ID_TXQ:
                        p->num_tx_qp = number;
                        p->base_queue = phys_id;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: Tx QP = %d\n", number);
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: base_queue = %d\n",
+                                  p->base_queue);
                        break;
-               case I40E_DEV_FUNC_CAP_MSIX:
+               case I40E_AQ_CAP_ID_MSIX:
                        p->num_msix_vectors = number;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: MSIX vector count = %d\n",
+                                  p->num_msix_vectors_vf);
                        break;
-               case I40E_DEV_FUNC_CAP_MSIX_VF:
+               case I40E_AQ_CAP_ID_VF_MSIX:
                        p->num_msix_vectors_vf = number;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: MSIX VF vector count = %d\n",
+                                  p->num_msix_vectors_vf);
                        break;
-               case I40E_DEV_FUNC_CAP_FLEX10:
+               case I40E_AQ_CAP_ID_FLEX10:
                        if (major_rev == 1) {
                                if (number == 1) {
                                        p->flex10_enable = true;
@@ -3499,44 +3534,75 @@ STATIC void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff,
                        }
                        p->flex10_mode = logical_id;
                        p->flex10_status = phys_id;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: Flex10 mode = %d\n",
+                                  p->flex10_mode);
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: Flex10 status = %d\n",
+                                  p->flex10_status);
                        break;
-               case I40E_DEV_FUNC_CAP_CEM:
+               case I40E_AQ_CAP_ID_CEM:
                        if (number == 1)
                                p->mgmt_cem = true;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: CEM = %d\n", p->mgmt_cem);
                        break;
-               case I40E_DEV_FUNC_CAP_IWARP:
+               case I40E_AQ_CAP_ID_IWARP:
                        if (number == 1)
                                p->iwarp = true;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: iWARP = %d\n", p->iwarp);
                        break;
-               case I40E_DEV_FUNC_CAP_LED:
+               case I40E_AQ_CAP_ID_LED:
                        if (phys_id < I40E_HW_CAP_MAX_GPIO)
                                p->led[phys_id] = true;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: LED - PIN %d\n", phys_id);
                        break;
-               case I40E_DEV_FUNC_CAP_SDP:
+               case I40E_AQ_CAP_ID_SDP:
                        if (phys_id < I40E_HW_CAP_MAX_GPIO)
                                p->sdp[phys_id] = true;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: SDP - PIN %d\n", phys_id);
                        break;
-               case I40E_DEV_FUNC_CAP_MDIO:
+               case I40E_AQ_CAP_ID_MDIO:
                        if (number == 1) {
                                p->mdio_port_num = phys_id;
                                p->mdio_port_mode = logical_id;
                        }
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: MDIO port number = %d\n",
+                                  p->mdio_port_num);
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: MDIO port mode = %d\n",
+                                  p->mdio_port_mode);
                        break;
-               case I40E_DEV_FUNC_CAP_IEEE_1588:
+               case I40E_AQ_CAP_ID_1588:
                        if (number == 1)
                                p->ieee_1588 = true;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: IEEE 1588 = %d\n",
+                                  p->ieee_1588);
                        break;
-               case I40E_DEV_FUNC_CAP_FLOW_DIRECTOR:
+               case I40E_AQ_CAP_ID_FLOW_DIRECTOR:
                        p->fd = true;
                        p->fd_filters_guaranteed = number;
                        p->fd_filters_best_effort = logical_id;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: Flow Director = 1\n");
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: Guaranteed FD filters = %d\n",
+                                  p->fd_filters_guaranteed);
                        break;
-               case I40E_DEV_FUNC_CAP_WR_CSR_PROT:
+               case I40E_AQ_CAP_ID_WSR_PROT:
                        p->wr_csr_prot = (u64)number;
                        p->wr_csr_prot |= (u64)logical_id << 32;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: wr_csr_prot = 0x%llX\n\n",
+                                  (p->wr_csr_prot & 0xffff));
                        break;
 #ifdef X722_SUPPORT
-               case I40E_DEV_FUNC_CAP_WOL_PROXY:
+               case I40E_AQ_CAP_ID_WOL_AND_PROXY:
                        hw->num_wol_proxy_filters = (u16)number;
                        hw->wol_proxy_vsi_seid = (u16)logical_id;
                        p->apm_wol_support = phys_id & I40E_WOL_SUPPORT_MASK;
@@ -3546,6 +3612,9 @@ STATIC void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff,
                                p->acpi_prog_method = I40E_ACPI_PROGRAMMING_METHOD_HW_FVL;
                        p->proxy_support = (phys_id & I40E_PROXY_SUPPORT_MASK) ? 1 : 0;
                        p->proxy_support = p->proxy_support;
+                       i40e_debug(hw, I40E_DEBUG_INIT,
+                                  "HW Capability: WOL proxy filters = %d\n",
+                                  hw->num_wol_proxy_filters);
                        break;
 #endif
                default: