aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliuzhongzhu <liuzhongzhu@huawei.com>2019-02-02 22:39:37 +0800
committerDavid S. Miller <davem@davemloft.net>2019-02-02 08:24:09 -0800
commit54a395b63e470696884fc12629b12e24d9379111 (patch)
tree968469624af55a71a428dc2c04c165d4e075bb2b
parent6104ca87e12a5119d3e53e926bb6fe468bb328e2 (diff)
downloadlinux-stericsson-54a395b63e470696884fc12629b12e24d9379111.tar.gz
net: hns3: MAC table entry count function increases operation 0 value protection measures
When updating the available MAC VLAN table counts, MAC VLAN table entry count function adds operation 0 value protection measures. Signed-off-by: liuzhongzhu <liuzhongzhu@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index f55835dee5c7..0a64c7f2dc6c 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -5830,9 +5830,12 @@ static void hclge_update_umv_space(struct hclge_vport *vport, bool is_free)
if (is_free) {
if (vport->used_umv_num > hdev->priv_umv_size)
hdev->share_umv_size++;
- vport->used_umv_num--;
+
+ if (vport->used_umv_num > 0)
+ vport->used_umv_num--;
} else {
- if (vport->used_umv_num >= hdev->priv_umv_size)
+ if (vport->used_umv_num >= hdev->priv_umv_size &&
+ hdev->share_umv_size > 0)
hdev->share_umv_size--;
vport->used_umv_num++;
}