linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net: hns3: fixes sparse: warning and type error
@ 2019-04-15 13:48 Huazhong Tan
  2019-04-15 13:48 ` [PATCH net-next 1/2] net: hns3: fix sparse: warning when calling hclge_set_vlan_filter_hw() Huazhong Tan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Huazhong Tan @ 2019-04-15 13:48 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-kernel, salil.mehta, yisen.zhuang, linuxarm, Huazhong Tan

This patchset fixes a sparse warning and a overflow problem.

Jian Shen (1):
  net: hns3: fix sparse: warning when calling hclge_set_vlan_filter_hw()

Yunsheng Lin (1):
  net: hns3: fix for vport->bw_limit overflow problem

 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 6 ++++--
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 1/2] net: hns3: fix sparse: warning when calling hclge_set_vlan_filter_hw()
  2019-04-15 13:48 [PATCH net-next 0/2] net: hns3: fixes sparse: warning and type error Huazhong Tan
@ 2019-04-15 13:48 ` Huazhong Tan
  2019-04-15 13:48 ` [PATCH net-next 2/2] net: hns3: fix for vport->bw_limit overflow problem Huazhong Tan
  2019-04-15 20:39 ` [PATCH net-next 0/2] net: hns3: fixes sparse: warning and type error David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Huazhong Tan @ 2019-04-15 13:48 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-kernel, salil.mehta, yisen.zhuang, linuxarm,
	Jian Shen, Huazhong Tan

From: Jian Shen <shenjian15@huawei.com>

The input parameter "proto" in function hclge_set_vlan_filter_hw()
is asked to be __be16, but got u16 when calling it in function
hclge_update_port_base_vlan_cfg().

This patch fixes it by converting it with htons().

Reported-by: kbuild test robot <lkp@intel.com>
Fixes: 21e043cd8124 ("net: hns3: fix set port based VLAN for PF")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 6 ++++--
 1 file changed, 4 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 d2fb548..7dba3b4 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -6964,7 +6964,8 @@ int hclge_update_port_base_vlan_cfg(struct hclge_vport *vport, u16 state,
 
 	if (state == HNAE3_PORT_BASE_VLAN_MODIFY) {
 		/* add new VLAN tag */
-		ret = hclge_set_vlan_filter_hw(hdev, vlan_info->vlan_proto,
+		ret = hclge_set_vlan_filter_hw(hdev,
+					       htons(vlan_info->vlan_proto),
 					       vport->vport_id,
 					       vlan_info->vlan_tag,
 					       vlan_info->qos, false);
@@ -6972,7 +6973,8 @@ int hclge_update_port_base_vlan_cfg(struct hclge_vport *vport, u16 state,
 			return ret;
 
 		/* remove old VLAN tag */
-		ret = hclge_set_vlan_filter_hw(hdev, old_vlan_info->vlan_proto,
+		ret = hclge_set_vlan_filter_hw(hdev,
+					       htons(old_vlan_info->vlan_proto),
 					       vport->vport_id,
 					       old_vlan_info->vlan_tag,
 					       old_vlan_info->qos, true);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/2] net: hns3: fix for vport->bw_limit overflow problem
  2019-04-15 13:48 [PATCH net-next 0/2] net: hns3: fixes sparse: warning and type error Huazhong Tan
  2019-04-15 13:48 ` [PATCH net-next 1/2] net: hns3: fix sparse: warning when calling hclge_set_vlan_filter_hw() Huazhong Tan
@ 2019-04-15 13:48 ` Huazhong Tan
  2019-04-15 20:39 ` [PATCH net-next 0/2] net: hns3: fixes sparse: warning and type error David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Huazhong Tan @ 2019-04-15 13:48 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-kernel, salil.mehta, yisen.zhuang, linuxarm,
	Yunsheng Lin, Huazhong Tan

From: Yunsheng Lin <linyunsheng@huawei.com>

When setting vport->bw_limit to hdev->tm_info.pg_info[0].bw_limit
in hclge_tm_vport_tc_info_update, vport->bw_limit can be as big as
HCLGE_ETHER_MAX_RATE (100000), which can not fit into u16 (65535).

So this patch fixes it by using u32 for vport->bw_limit.

Fixes: 848440544b41 ("net: hns3: Add support of TX Scheduler & Shaper to HNS3 driver")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
index f04a52f..e736030 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
@@ -854,7 +854,7 @@ struct hclge_vport {
 	u16 alloc_rss_size;
 
 	u16 qs_offset;
-	u16 bw_limit;		/* VSI BW Limit (0 = disabled) */
+	u32 bw_limit;		/* VSI BW Limit (0 = disabled) */
 	u8  dwrr;
 
 	struct hclge_port_base_vlan_config port_base_vlan_cfg;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 0/2] net: hns3: fixes sparse: warning and type error
  2019-04-15 13:48 [PATCH net-next 0/2] net: hns3: fixes sparse: warning and type error Huazhong Tan
  2019-04-15 13:48 ` [PATCH net-next 1/2] net: hns3: fix sparse: warning when calling hclge_set_vlan_filter_hw() Huazhong Tan
  2019-04-15 13:48 ` [PATCH net-next 2/2] net: hns3: fix for vport->bw_limit overflow problem Huazhong Tan
@ 2019-04-15 20:39 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-04-15 20:39 UTC (permalink / raw)
  To: tanhuazhong; +Cc: netdev, linux-kernel, salil.mehta, yisen.zhuang, linuxarm

From: Huazhong Tan <tanhuazhong@huawei.com>
Date: Mon, 15 Apr 2019 21:48:37 +0800

> This patchset fixes a sparse warning and a overflow problem.

Series applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-15 20:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-15 13:48 [PATCH net-next 0/2] net: hns3: fixes sparse: warning and type error Huazhong Tan
2019-04-15 13:48 ` [PATCH net-next 1/2] net: hns3: fix sparse: warning when calling hclge_set_vlan_filter_hw() Huazhong Tan
2019-04-15 13:48 ` [PATCH net-next 2/2] net: hns3: fix for vport->bw_limit overflow problem Huazhong Tan
2019-04-15 20:39 ` [PATCH net-next 0/2] net: hns3: fixes sparse: warning and type error David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).