i40e/base: add WOL/proxy capability parsing
authorJingjing Wu <jingjing.wu@intel.com>
Sun, 6 Sep 2015 07:11:54 +0000 (15:11 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 1 Oct 2015 23:35:23 +0000 (01:35 +0200)
Adds support to retrieve and parse WoL/Proxy capabilities from the
device/function list.
Also saves WR_CSR_PROT field from DEV/FUNC capabilities.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Tested-by: Huilong Xu <huilongx.xu@intel.com>
drivers/net/i40e/base/i40e_common.c
drivers/net/i40e/base/i40e_type.h

index 43ca970..d7c940d 100644 (file)
@@ -3334,6 +3334,9 @@ i40e_aq_erase_nvm_exit:
 #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
@@ -3356,6 +3359,7 @@ i40e_aq_erase_nvm_exit:
 #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
@@ -3514,6 +3518,23 @@ STATIC void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff,
                        p->fd_filters_guaranteed = number;
                        p->fd_filters_best_effort = logical_id;
                        break;
+               case I40E_DEV_FUNC_CAP_WR_CSR_PROT:
+                       p->wr_csr_prot = (u64)number;
+                       p->wr_csr_prot |= (u64)logical_id << 32;
+                       break;
+#ifdef X722_SUPPORT
+               case I40E_DEV_FUNC_CAP_WOL_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;
+                       if (phys_id & I40E_ACPI_PROGRAMMING_METHOD_MASK)
+                               p->acpi_prog_method = I40E_ACPI_PROGRAMMING_METHOD_AQC_FPK;
+                       else
+                               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;
+                       break;
+#endif
                default:
                        break;
                }
@@ -5612,11 +5633,11 @@ enum i40e_status_code i40e_read_bw_from_alt_ram(struct i40e_hw *hw,
 
        /* Calculate the address of the min/max bw registers */
        max_bw_addr = I40E_ALT_STRUCT_FIRST_PF_OFFSET +
-               I40E_ALT_STRUCT_MAX_BW_OFFSET +
-               (I40E_ALT_STRUCT_DWORDS_PER_PF*hw->pf_id);
+                     I40E_ALT_STRUCT_MAX_BW_OFFSET +
+                     (I40E_ALT_STRUCT_DWORDS_PER_PF * hw->pf_id);
        min_bw_addr = I40E_ALT_STRUCT_FIRST_PF_OFFSET +
-               I40E_ALT_STRUCT_MIN_BW_OFFSET +
-               (I40E_ALT_STRUCT_DWORDS_PER_PF*hw->pf_id);
+                     I40E_ALT_STRUCT_MIN_BW_OFFSET +
+                     (I40E_ALT_STRUCT_DWORDS_PER_PF * hw->pf_id);
 
        /* Read the bandwidths from alt ram */
        status = i40e_aq_alternate_read(hw, max_bw_addr, max_bw,
index 1cf6965..7ff0881 100644 (file)
@@ -321,6 +321,17 @@ struct i40e_phy_info {
 #define I40E_HW_CAP_MDIO_PORT_MODE_MDIO                0
 #define I40E_HW_CAP_MDIO_PORT_MODE_I2C         1
 
+#ifdef X722_SUPPORT
+enum i40e_acpi_programming_method {
+       I40E_ACPI_PROGRAMMING_METHOD_HW_FVL = 0,
+       I40E_ACPI_PROGRAMMING_METHOD_AQC_FPK = 1
+};
+
+#define I40E_WOL_SUPPORT_MASK                  1
+#define I40E_ACPI_PROGRAMMING_METHOD_MASK      (1 << 1)
+#define I40E_PROXY_SUPPORT_MASK                        (1 << 2)
+
+#endif
 /* Capabilities of a PF or a VF or the whole device */
 struct i40e_hw_capabilities {
        u32  switch_mode;
@@ -378,6 +389,12 @@ struct i40e_hw_capabilities {
        u8 rx_buf_chain_len;
        u32 enabled_tcmap;
        u32 maxtc;
+       u64 wr_csr_prot;
+#ifdef X722_SUPPORT
+       bool apm_wol_support;
+       enum i40e_acpi_programming_method acpi_prog_method;
+       bool proxy_support;
+#endif
 };
 
 struct i40e_mac_info {
@@ -635,6 +652,12 @@ struct i40e_hw {
        struct i40e_dcbx_config remote_dcbx_config; /* Peer Cfg */
        struct i40e_dcbx_config desired_dcbx_config; /* CEE Desired Cfg */
 
+#ifdef X722_SUPPORT
+       /* WoL and proxy support */
+       u16 num_wol_proxy_filters;
+       u16 wol_proxy_vsi_seid;
+
+#endif
        /* debug mask */
        u32 debug_mask;
 #ifndef I40E_NDIS_SUPPORT