netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch net 0/2] net: hns3: bug fix & optimization for HNS3 driver
@ 2018-08-23  3:37 Huazhong Tan
  2018-08-23  3:37 ` [Patch net 1/2] net: hns3: fix page_offset overflow when CONFIG_ARM64_64K_PAGES Huazhong Tan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Huazhong Tan @ 2018-08-23  3:37 UTC (permalink / raw)
  To: davem; +Cc: netdev, linuxarm, salil.mehta, yisen.zhuang, lipeng321,
	tanhuazhong

This patchset presents a bug fix found out when CONFIG_ARM64_64K_PAGES
enable and an optimization for HNS3 driver.

Huazhong Tan (2):
  net: hns3: fix page_offset overflow when CONFIG_ARM64_64K_PAGES
  net: hns3: modify variable type in hns3_nic_reuse_page

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

-- 
1.9.1

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

* [Patch net 1/2] net: hns3: fix page_offset overflow when CONFIG_ARM64_64K_PAGES
  2018-08-23  3:37 [Patch net 0/2] net: hns3: bug fix & optimization for HNS3 driver Huazhong Tan
@ 2018-08-23  3:37 ` Huazhong Tan
  2018-08-23  3:37 ` [Patch net 2/2] net: hns3: modify variable type in hns3_nic_reuse_page Huazhong Tan
  2018-08-23  5:13 ` [Patch net 0/2] net: hns3: bug fix & optimization for HNS3 driver David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Huazhong Tan @ 2018-08-23  3:37 UTC (permalink / raw)
  To: davem; +Cc: netdev, linuxarm, salil.mehta, yisen.zhuang, lipeng321,
	tanhuazhong

When enable the config item "CONFIG_ARM64_64K_PAGES", the size of
PAGE_SIZE is 65536(64K). But the type of page_offset is u16, it will
overflow. So change it to u32, when "CONFIG_ARM64_64K_PAGES" enabled.

Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC")
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
index a02a96a..cb450d7 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
@@ -284,11 +284,11 @@ struct hns3_desc_cb {
 
 	/* priv data for the desc, e.g. skb when use with ip stack*/
 	void *priv;
-	u16 page_offset;
-	u16 reuse_flag;
-
+	u32 page_offset;
 	u32 length;     /* length of the buffer */
 
+	u16 reuse_flag;
+
        /* desc type, used by the ring user to mark the type of the priv data */
 	u16 type;
 };
-- 
1.9.1

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

* [Patch net 2/2] net: hns3: modify variable type in hns3_nic_reuse_page
  2018-08-23  3:37 [Patch net 0/2] net: hns3: bug fix & optimization for HNS3 driver Huazhong Tan
  2018-08-23  3:37 ` [Patch net 1/2] net: hns3: fix page_offset overflow when CONFIG_ARM64_64K_PAGES Huazhong Tan
@ 2018-08-23  3:37 ` Huazhong Tan
  2018-08-23  5:13 ` [Patch net 0/2] net: hns3: bug fix & optimization for HNS3 driver David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Huazhong Tan @ 2018-08-23  3:37 UTC (permalink / raw)
  To: davem; +Cc: netdev, linuxarm, salil.mehta, yisen.zhuang, lipeng321,
	tanhuazhong

'truesize' is supposed to be u32, not int, so fix it.

Signed-off-by: Huazhong tan <tanhuazhong@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index 3554dca..955c4ab 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -2019,7 +2019,8 @@ static void hns3_nic_reuse_page(struct sk_buff *skb, int i,
 				struct hns3_desc_cb *desc_cb)
 {
 	struct hns3_desc *desc;
-	int truesize, size;
+	u32 truesize;
+	int size;
 	int last_offset;
 	bool twobufs;
 
-- 
1.9.1

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

* Re: [Patch net 0/2] net: hns3: bug fix & optimization for HNS3 driver
  2018-08-23  3:37 [Patch net 0/2] net: hns3: bug fix & optimization for HNS3 driver Huazhong Tan
  2018-08-23  3:37 ` [Patch net 1/2] net: hns3: fix page_offset overflow when CONFIG_ARM64_64K_PAGES Huazhong Tan
  2018-08-23  3:37 ` [Patch net 2/2] net: hns3: modify variable type in hns3_nic_reuse_page Huazhong Tan
@ 2018-08-23  5:13 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-08-23  5:13 UTC (permalink / raw)
  To: tanhuazhong; +Cc: netdev, linuxarm, salil.mehta, yisen.zhuang, lipeng321

From: Huazhong Tan <tanhuazhong@huawei.com>
Date: Thu, 23 Aug 2018 11:37:14 +0800

> This patchset presents a bug fix found out when CONFIG_ARM64_64K_PAGES
> enable and an optimization for HNS3 driver.

Series applied, thank you.

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

end of thread, other threads:[~2018-08-23  8:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-23  3:37 [Patch net 0/2] net: hns3: bug fix & optimization for HNS3 driver Huazhong Tan
2018-08-23  3:37 ` [Patch net 1/2] net: hns3: fix page_offset overflow when CONFIG_ARM64_64K_PAGES Huazhong Tan
2018-08-23  3:37 ` [Patch net 2/2] net: hns3: modify variable type in hns3_nic_reuse_page Huazhong Tan
2018-08-23  5:13 ` [Patch net 0/2] net: hns3: bug fix & optimization for HNS3 driver 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).