All of lore.kernel.org
 help / color / mirror / Atom feed
From: Huazhong Tan <tanhuazhong@huawei.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<huangdaode@hisilicon.com>, <yisen.zhuang@huawei.com>,
	<salil.mehta@huawei.com>, <linuxarm@huawei.com>,
	liuzhongzhu <liuzhongzhu@huawei.com>,
	Peng Li <lipeng321@huawei.com>,
	Huazhong Tan <tanhuazhong@huawei.com>
Subject: [PATCH net-next 12/12] net: hns3: MAC table entry count function increases operation 0 value protection measures
Date: Sat, 2 Feb 2019 22:39:37 +0800	[thread overview]
Message-ID: <20190202143937.8924-13-tanhuazhong@huawei.com> (raw)
In-Reply-To: <20190202143937.8924-1-tanhuazhong@huawei.com>

From: liuzhongzhu <liuzhongzhu@huawei.com>

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>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 7 +++++--
 1 file 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++;
 	}
-- 
2.20.1



  parent reply	other threads:[~2019-02-02 14:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-02 14:39 [PATCH net-next 00/12] code optimizations & bugfixes for HNS3 driver Huazhong Tan
2019-02-02 14:39 ` [PATCH net-next 01/12] net: hns3: fix a code style issue for hns3_update_new_int_gl() Huazhong Tan
2019-02-02 14:39 ` [PATCH net-next 02/12] net: hns3: fix an issue for hns3_update_new_int_gl Huazhong Tan
2019-02-02 14:39 ` [PATCH net-next 03/12] net: hns3: Modify parameter type from int to bool in set_gro_en Huazhong Tan
2019-02-02 14:39 ` [PATCH net-next 04/12] net: hns3: code optimization for hclge_rx_buffer_calc Huazhong Tan
2019-02-02 14:39 ` [PATCH net-next 05/12] net: hns3: add hclge_cmd_check_retval() to parse comman's return value Huazhong Tan
2019-02-02 14:39 ` [PATCH net-next 06/12] net: hns3: move some set_bit statement into hclge_prepare_mac_addr Huazhong Tan
2019-02-02 14:39 ` [PATCH net-next 07/12] net: hns3: fix a wrong checking in the hclge_tx_buffer_calc() Huazhong Tan
2019-02-02 14:39 ` [PATCH net-next 08/12] net: hns3: fix the problem that the supported port is empty Huazhong Tan
2019-02-02 14:39 ` [PATCH net-next 09/12] net: hns3: optimize the maximum TC macro Huazhong Tan
2019-02-02 14:39 ` [PATCH net-next 10/12] net: hns3: don't allow user to change vlan filter state Huazhong Tan
2019-02-03  7:42   ` Sergei Shtylyov
2019-02-02 14:39 ` [PATCH net-next 11/12] net: hns3: modify the upper limit judgment condition Huazhong Tan
2019-02-02 14:39 ` Huazhong Tan [this message]
2019-02-02 16:48 ` [PATCH net-next 00/12] code optimizations & bugfixes for HNS3 driver David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190202143937.8924-13-tanhuazhong@huawei.com \
    --to=tanhuazhong@huawei.com \
    --cc=davem@davemloft.net \
    --cc=huangdaode@hisilicon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=lipeng321@huawei.com \
    --cc=liuzhongzhu@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.