net: hns3: Optimize for unicast mac vlan table
[linux-2.6-microblaze.git] / drivers / net / ethernet / hisilicon / hns3 / hns3pf / hclge_main.h
index 06adbdd..d0c7c62 100644 (file)
@@ -14,6 +14,8 @@
 #define HCLGE_MOD_VERSION "1.0"
 #define HCLGE_DRIVER_NAME "hclge"
 
+#define HCLGE_MAX_PF_NUM               8
+
 #define HCLGE_INVALID_VPORT 0xffff
 
 #define HCLGE_PF_CFG_BLOCK_SIZE                32
 #define HCLGE_RSS_TC_SIZE_6            64
 #define HCLGE_RSS_TC_SIZE_7            128
 
+#define HCLGE_UMV_TBL_SIZE             3072
+#define HCLGE_DEFAULT_UMV_SPACE_PER_PF \
+       (HCLGE_UMV_TBL_SIZE / HCLGE_MAX_PF_NUM)
+
 #define HCLGE_MTA_TBL_SIZE             4096
 
 #define HCLGE_TQP_RESET_TRY_TIMES      10
@@ -251,6 +257,7 @@ struct hclge_cfg {
        u8 default_speed;
        u32 numa_node_map;
        u8 speed_ability;
+       u16 umv_space;
 };
 
 struct hclge_tm_info {
@@ -680,6 +687,15 @@ struct hclge_dev {
        struct hclge_fd_cfg fd_cfg;
        struct hlist_head fd_rule_list;
        u16 hclge_fd_rule_num;
+
+       u16 wanted_umv_size;
+       /* max available unicast mac vlan space */
+       u16 max_umv_size;
+       /* private unicast mac vlan space, it's same for PF and its VFs */
+       u16 priv_umv_size;
+       /* unicast mac vlan space shared by PF and its VFs */
+       u16 share_umv_size;
+       struct mutex umv_mutex; /* protect share_umv_size */
 };
 
 /* VPort level vlan tag configuration for TX direction */
@@ -732,6 +748,8 @@ struct hclge_vport {
        struct hclge_tx_vtag_cfg  txvlan_cfg;
        struct hclge_rx_vtag_cfg  rxvlan_cfg;
 
+       u16 used_umv_num;
+
        int vport_id;
        struct hclge_dev *back;  /* Back reference to associated dev */
        struct hnae3_handle nic;