Re: [PATCH v2 net-next] net: hisilicon: fix binding document of mdio

2015-11-17 Thread huangdaode

On 2015/11/16 17:38, Arnd Bergmann wrote:

On Monday 16 November 2015 17:38:24 huangdaode wrote:

This patch explains the occasion of "hisilcon,mdio" and
"hisilicon,hns-mdio" according to Arnd's comments.
and reformat it according to comments from Rob<r...@kernel.org>.

chang log:

v2:
   1) reformat the style.
   2) make it more clearity.

v1:
   initial version.

Signed-off-by: huangdaode <huangda...@hisilicon.com>
---

The new version looks ok, but your changelog above is formatted
incorrectly. Please put only the contents you want in the git history
above the '---' line and your Signed-off-by, but put the parts that
refer to previous versions of the submission below the ---.


Got it.
thanks Arnd.

Daode


  Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt | 7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt 
b/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
index 9c23fdf..4942d20 100644
--- a/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
+++ b/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
@@ -1,7 +1,12 @@
  Hisilicon MDIO bus controller
  
  Properties:

-- compatible: "hisilicon,mdio","hisilicon,hns-mdio".
+- compatible: can be one of:
+   "hisilicon,hns-mdio"
+   "hisilicon,mdio"
+  "hisilicon,hns-mdio" is recommendly to be used for hip05 and later SOCs,
+  while "hisilicon,mdio" is optional for backwards compatibility, only
+  support for hip04 Soc.
  - reg: The base address of the MDIO bus controller register bank.
  - #address-cells: Must be <1>.
  - #size-cells: Must be <0>.  MDIO addresses have no size component.



.




--
Best Regards
Daode Huang


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 net-next] net: hisilicon: fix binding document of mdio

2015-11-17 Thread huangdaode

On 2015/11/16 23:20, Rob Herring wrote:

On Mon, Nov 16, 2015 at 05:38:24PM +0800, huangdaode wrote:

This patch explains the occasion of "hisilcon,mdio" and
"hisilicon,hns-mdio" according to Arnd's comments.
and reformat it according to comments from Rob<r...@kernel.org>.

chang log:

v2:
   1) reformat the style.
   2) make it more clearity.

v1:
   initial version.

Signed-off-by: huangdaode <huangda...@hisilicon.com>
---
  Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt | 7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt 
b/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
index 9c23fdf..4942d20 100644
--- a/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
+++ b/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
@@ -1,7 +1,12 @@
  Hisilicon MDIO bus controller
  
  Properties:

-- compatible: "hisilicon,mdio","hisilicon,hns-mdio".
+- compatible: can be one of:
+   "hisilicon,hns-mdio"
+   "hisilicon,mdio"
+  "hisilicon,hns-mdio" is recommendly to be used for hip05 and later SOCs,

s/recommendly/recommended/


+  while "hisilicon,mdio" is optional for backwards compatibility, only
+  support for hip04 Soc.

...compatibility only on hip04 SOC.


  - reg: The base address of the MDIO bus controller register bank.
  - #address-cells: Must be <1>.
  - #size-cells: Must be <0>.  MDIO addresses have no size component.
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Agreed.
Will fix this in v3 patch.

thanks
Daode.


.




--
Best Regards
Daode Huang


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 net-next] net: hisilicon: fix binding document of mdio

2015-11-17 Thread huangdaode
This patch explains the occasion of "hisilcon,mdio" and
"hisilicon,hns-mdio" according to Arnd's comments.
and reformat it according to comments from Rob<r...@kernel.org>.

Signed-off-by: huangdaode <huangda...@hisilicon.com>
---
change log:
v3:
  1)move change log under '---' line.
  2)change minor syntax error on description.

v2:
  1) reformat the style.
  2) make it more clearity.

v1:
  initial version.

v2 patch reference:https://lkml.org/lkml/2015/11/16/88
v1 patch reference:https://lkml.org/lkml/2015/11/12/913

 Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt 
b/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
index 9c23fdf..4a7ede9 100644
--- a/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
+++ b/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
@@ -1,7 +1,12 @@
 Hisilicon MDIO bus controller
 
 Properties:
-- compatible: "hisilicon,mdio","hisilicon,hns-mdio".
+- compatible: can be one of:
+   "hisilicon,hns-mdio"
+   "hisilicon,mdio"
+  "hisilicon,hns-mdio" is recommended to be used for hip05 and later SOCs,
+  while "hisilicon,mdio" is optional for backwards compatibility only on
+  hip04 Soc.
 - reg: The base address of the MDIO bus controller register bank.
 - #address-cells: Must be <1>.
 - #size-cells: Must be <0>.  MDIO addresses have no size component.
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 net-next] net: hisilicon: fix binding document of mdio

2015-11-16 Thread huangdaode
This patch explains the occasion of "hisilcon,mdio" and
"hisilicon,hns-mdio" according to Arnd's comments.
and reformat it according to comments from Rob<r...@kernel.org>.

chang log:

v2:
  1) reformat the style.
  2) make it more clearity.

v1:
  initial version.

Signed-off-by: huangdaode <huangda...@hisilicon.com>
---
 Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt 
b/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
index 9c23fdf..4942d20 100644
--- a/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
+++ b/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
@@ -1,7 +1,12 @@
 Hisilicon MDIO bus controller
 
 Properties:
-- compatible: "hisilicon,mdio","hisilicon,hns-mdio".
+- compatible: can be one of:
+   "hisilicon,hns-mdio"
+   "hisilicon,mdio"
+  "hisilicon,hns-mdio" is recommendly to be used for hip05 and later SOCs,
+  while "hisilicon,mdio" is optional for backwards compatibility, only
+  support for hip04 Soc.
 - reg: The base address of the MDIO bus controller register bank.
 - #address-cells: Must be <1>.
 - #size-cells: Must be <0>.  MDIO addresses have no size component.
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] net: hisilicon: fix binding document of mdio

2015-11-12 Thread huangdaode
This patch fixes explain the occasion of "hisilcon,mdio" according to
Arnd's comments. specify it is only used for hip04.

First, please give your commnents.

Signed-off-by: huangdaode <huangda...@hisilicon.com>
---
 Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt 
b/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
index 9c23fdf..f650e78 100644
--- a/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
+++ b/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
@@ -1,7 +1,9 @@
 Hisilicon MDIO bus controller
 
 Properties:
-- compatible: "hisilicon,mdio","hisilicon,hns-mdio".
+- compatible: can be one of "hisilicon,hns-mdio","hisilicon,mdio",
+  for hip04 board, please use "hisilicon,mdio",
+  other boards, "hisilicon,hns-mdio" is OK.
 - reg: The base address of the MDIO bus controller register bank.
 - #address-cells: Must be <1>.
 - #size-cells: Must be <0>.  MDIO addresses have no size component.
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH RESEND v2 net-next] net: hisilicon: updates HNS config and documents

2015-11-11 Thread huangdaode

On 2015/11/3 6:05, Arnd Bergmann wrote:

On Saturday 31 October 2015 02:18:19 Salil Mehta wrote:

On 10/31/2015 1:40 AM, huangdaode wrote:

On 2015/10/30 22:20, Arnd Bergmann wrote:

On Tuesday 27 October 2015 19:16:34 huangdaode wrote:

mdio@803c {
  #address-cells = <1>;
  #size-cells = <0>;
-   compatible = "hisilicon,mdio","hisilicon,hns-mdio";
+   compatible = "hisilicon,hns-mdio","hisilicon,mdio";
  reg = <0x0 0x803c 0x0 0x1>;


Does "hisilicon,mdio" actually have a specific meaning? Is that just
there
for legacy reasons?

 Arnd

.


hi Arnd,
"hisilicon,mdio" is  the gernerical configuation compatible  for the
default hisilicon chip,
We use generic hisilicon since our MDIO/PHY is same across flavour of
SoCs.


Hi Arnd,
Yes, "hisilicon,mdio" exists for the legacy reasons to support older SoC
Hip04.

I see. In that case, that compatible string should probably be mentioned
only as 'optional' in the binding, and not used for devices other than
hip04.

Arnd

.


Hi, Arnd
ok, ill send a patch to specify it, please Ack then.
thanks
Daode.

--
Best Regards
Daode Huang


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH RESEND v2 net-next] net: hisilicon: updates HNS config and documents

2015-10-30 Thread huangdaode

On 2015/10/30 22:20, Arnd Bergmann wrote:

On Tuesday 27 October 2015 19:16:34 huangdaode wrote:

   mdio@803c {
 #address-cells = <1>;
 #size-cells = <0>;
-   compatible = "hisilicon,mdio","hisilicon,hns-mdio";
+   compatible = "hisilicon,hns-mdio","hisilicon,mdio";
 reg = <0x0 0x803c 0x0 0x1>;
  


Does "hisilicon,mdio" actually have a specific meaning? Is that just there
for legacy reasons?

Arnd

.


hi Arnd,
"hisilicon,mdio" is  the gernerical configuation compatible  for the 
default hisilicon chip,

We use generic hisilicon since our MDIO/PHY is same across flavour of SoCs.

--
Best Regards
Daode Huang


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[PATCH] net: hisilicon: Remove .owner assignment from platform_driver

2015-10-29 Thread huangdaode
platform_driver doesn't need to set .owner, because
platform_driver_register() will set it.

Signed-off-by: huangdaode <huangda...@hisilicon.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_enet.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c 
b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index 83c02a8..562eff9 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -1914,7 +1914,6 @@ MODULE_DEVICE_TABLE(of, hns_enet_of_match);
 static struct platform_driver hns_nic_dev_driver = {
.driver = {
.name = "hns-nic",
-   .owner = THIS_MODULE,
.of_match_table = hns_enet_of_match,
},
.probe = hns_nic_dev_probe,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND v2 net-next] net: hisilicon: updates HNS config and documents

2015-10-27 Thread huangdaode
From: yankejian <yankej...@huawei.com>

updates the bindings documents and dtsi file according to the review
comments[https://lkml.org/lkml/2015/9/21/670] from Rob Herring <r...@kernel.org>

Acked-by: Rob Herring <r...@kernel.org>
Signed-off-by: yankejian <yankej...@huawei.com>
Signed-off-by: huangdaode <huangda...@hisilicon.com>
---
 Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt | 2 +-
 arch/arm64/boot/dts/hisilicon/hip05_hns.dtsi | 8 +++-
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt 
b/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
index 9940aa0..9c23fdf 100644
--- a/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
+++ b/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
@@ -12,7 +12,7 @@ Example:
  mdio@803c {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "hisilicon,mdio","hisilicon,hns-mdio";
+   compatible = "hisilicon,hns-mdio","hisilicon,mdio";
reg = <0x0 0x803c 0x0 0x1>;
 
ethernet-phy@0 {
diff --git a/arch/arm64/boot/dts/hisilicon/hip05_hns.dtsi 
b/arch/arm64/boot/dts/hisilicon/hip05_hns.dtsi
index 3500586..606dd5a 100644
--- a/arch/arm64/boot/dts/hisilicon/hip05_hns.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hip05_hns.dtsi
@@ -13,14 +13,12 @@ soc0: soc@0 {
reg = <0x0 0x803c 0x0 0x1
   0x0 0x8000 0x0 0x1>;
 
-   soc0_phy4: ethernet-phy@4 {
+   soc0_phy0: ethernet-phy@0 {
reg = <0x0>;
-   device_type = "ethernet-phy";
compatible = "ethernet-phy-ieee802.3-c22";
};
-   soc0_phy5: ethernet-phy@5 {
+   soc0_phy1: ethernet-phy@1 {
reg = <0x1>;
-   device_type = "ethernet-phy";
compatible = "ethernet-phy-ieee802.3-c22";
};
};
@@ -37,7 +35,7 @@ soc0: soc@0 {
   0x0 0xc700 0x0 0x6
   >;
 
-   phy-handle = <0 0 0 0 _phy4 _phy5 0 0>;
+   phy-handle = <0 0 0 0 _phy0 _phy1 0 0>;
interrupts = <
/* [14] ge fifo err 8 / xge 6**/
149 0x4 150 0x4 151 0x4 152 0x4
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next v3 0/2] net: hisilicon fix some bugs in HNS drivers

2015-10-18 Thread huangdaode

On 2015/10/16 17:30, Arnd Bergmann wrote:

On Friday 16 October 2015 11:54:15 huangdaode wrote:

This patchset fixes the two bugs in HNS driver, one is remove the hnae sysfs 
interface
according to the review comments from Arnd Bergmann <a...@arndb.de>, another
is fixing the wrong mac_id judgement bug which is found during internal tests.

change log:
v3:
  remove the hnae sysfs interface.

v2:
   1) remove first bug fix, which is fixed in another patch submitted by
  Arnd Bergmann <a...@arndb.de>
   2) change the code sytyle according to Joe.

v1:
  initial version.

huangdaode (2):
   net: hisilicon rm hnae sysfs interface
   net: hisilicon fix a bug on Hisilicon Network Subsystem

  drivers/net/ethernet/hisilicon/hns/hnae.c | 47 ---
  drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c |  2 +-
  2 files changed, 1 insertion(+), 48 deletions(-)



I found two more bugs in build testing, will follow up with patches in this
thread

Arnd.

.


Hi Arnd, thanks for your comments. i see you adding  three patches in 
this thread to fix related bugs.
should  I need to re-send a new version patch which contains your other 
three patches  or just wait for

David Miller to merge this thread?

thanks
Daode Huang
  .


--
Best Regards
Daode Huang


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v3 1/2] net: hisilicon rm hnae sysfs interface

2015-10-15 Thread huangdaode
This patch removes the hns driver hnae sysfs interface according to
Arnd's review comments.

Signed-off-by: huangdaode <huangda...@hisilicon.com>
---
 drivers/net/ethernet/hisilicon/hns/hnae.c | 47 ---
 1 file changed, 47 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.c 
b/drivers/net/ethernet/hisilicon/hns/hnae.c
index f52e99a..9d3bb83 100644
--- a/drivers/net/ethernet/hisilicon/hns/hnae.c
+++ b/drivers/net/ethernet/hisilicon/hns/hnae.c
@@ -436,59 +436,12 @@ void hnae_ae_unregister(struct hnae_ae_dev *hdev)
 }
 EXPORT_SYMBOL(hnae_ae_unregister);
 
-static ssize_t handles_show(struct device *dev,
-   struct device_attribute *attr, char *buf)
-{
-   ssize_t s = 0;
-   struct hnae_ae_dev *hdev = cls_to_ae_dev(dev);
-   struct hnae_handle *h;
-   int i = 0, j;
-
-   list_for_each_entry_rcu(h, >handle_list, node) {
-   s += sprintf(buf + s, "handle %d (eport_id=%u from %s):\n",
-   i++, h->eport_id, h->dev->name);
-   for (j = 0; j < h->q_num; j++) {
-   s += sprintf(buf + s, "\tqueue[%d] on %p\n",
-j, h->qs[i]->io_base);
-#define HANDEL_TX_MSG "\t\ttx_ring on %p:%u,%u,%u,%u,%u,%llu,%llu\n"
-   s += sprintf(buf + s,
-HANDEL_TX_MSG,
-h->qs[i]->tx_ring.io_base,
-h->qs[i]->tx_ring.buf_size,
-h->qs[i]->tx_ring.desc_num,
-h->qs[i]->tx_ring.max_desc_num_per_pkt,
-h->qs[i]->tx_ring.max_raw_data_sz_per_desc,
-h->qs[i]->tx_ring.max_pkt_size,
-h->qs[i]->tx_ring.stats.sw_err_cnt,
-h->qs[i]->tx_ring.stats.io_err_cnt);
-   s += sprintf(buf + s,
-   "\t\trx_ring on %p:%u,%u,%llu,%llu,%llu\n",
-   h->qs[i]->rx_ring.io_base,
-   h->qs[i]->rx_ring.buf_size,
-   h->qs[i]->rx_ring.desc_num,
-   h->qs[i]->rx_ring.stats.sw_err_cnt,
-   h->qs[i]->rx_ring.stats.io_err_cnt,
-   h->qs[i]->rx_ring.stats.seg_pkt_cnt);
-   }
-   }
-
-   return s;
-}
-
-static DEVICE_ATTR_RO(handles);
-static struct attribute *hnae_class_attrs[] = {
-   _attr_handles.attr,
-   NULL,
-};
-ATTRIBUTE_GROUPS(hnae_class);
-
 static int __init hnae_init(void)
 {
hnae_class = class_create(THIS_MODULE, "hnae");
if (IS_ERR(hnae_class))
return PTR_ERR(hnae_class);
 
-   hnae_class->dev_groups = hnae_class_groups;
return 0;
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v3 0/2] net: hisilicon fix some bugs in HNS drivers

2015-10-15 Thread huangdaode
This patchset fixes the two bugs in HNS driver, one is remove the hnae sysfs 
interface
according to the review comments from Arnd Bergmann <a...@arndb.de>, another
is fixing the wrong mac_id judgement bug which is found during internal tests.

change log:
v3:
 remove the hnae sysfs interface.

v2:
  1) remove first bug fix, which is fixed in another patch submitted by
 Arnd Bergmann <a...@arndb.de>
  2) change the code sytyle according to Joe.

v1:
 initial version.

huangdaode (2):
  net: hisilicon rm hnae sysfs interface
  net: hisilicon fix a bug on Hisilicon Network Subsystem

 drivers/net/ethernet/hisilicon/hns/hnae.c | 47 ---
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c |  2 +-
 2 files changed, 1 insertion(+), 48 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v3 2/2] net: hisilicon fix a bug on Hisilicon Network Subsystem

2015-10-15 Thread huangdaode
This patch fixes the wrong judgement of mac_id when get port num.

Signed-off-by: huangdaode <huangda...@hisilicon.com>
Signed-off-by: yankejian <yankej...@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
index f8f7347..026b386 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
@@ -179,7 +179,7 @@ static int hns_mac_get_inner_port_num(struct hns_mac_cb 
*mac_cb,
return -EINVAL;
}
} else if (mac_cb->dsaf_dev->dsaf_mode < DSAF_MODE_MAX) {
-   if (mac_cb->mac_id <= DSAF_MAX_PORT_NUM_PER_CHIP) {
+   if (mac_cb->mac_id >= DSAF_MAX_PORT_NUM_PER_CHIP) {
dev_err(mac_cb->dev,
"input invalid,%s mac%d vmid%d!\n",
mac_cb->dsaf_dev->ae_dev.name,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] net: nhs: fix 32-bit build warning

2015-10-11 Thread huangdaode

On 2015/10/12 4:13, Joe Perches wrote:

On Tue, 2015-10-06 at 23:53 +0200, Arnd Bergmann wrote:

diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.c 
b/drivers/net/ethernet/hisilicon/hns/hnae.c

[]

@@ -448,12 +448,12 @@ static ssize_t handles_show(struct device *dev,
s += sprintf(buf + s, "handle %d (eport_id=%u from %s):\n",
i++, h->eport_id, h->dev->name);
for (j = 0; j < h->q_num; j++) {
-   s += sprintf(buf + s, "\tqueue[%d] on 0x%llx\n",
-j, (u64)h->qs[i]->io_base);
-#define HANDEL_TX_MSG "\t\ttx_ring on 0x%llx:%u,%u,%u,%u,%u,%llu,%llu\n"
+   s += sprintf(buf + s, "\tqueue[%d] on %p\n",
+j, h->qs[i]->io_base);
+#define HANDEL_TX_MSG "\t\ttx_ring on %p:%u,%u,%u,%u,%u,%llu,%llu\n"
s += sprintf(buf + s,
 HANDEL_TX_MSG,

Maybe one day remove the misspelled and
used once HANDEL_TX_MSG macro too.

Another possibility is to use a generally
smaller object code style like:

char *s = buf;
...
s += sprintf(s, ...)
...
return s - buf;

instead of

ssize_t s = 0;
...
s += sprintf(buf + s, ...)
...
return s;
---
  drivers/net/ethernet/hisilicon/hns/hnae.c | 35 +++
  1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.c 
b/drivers/net/ethernet/hisilicon/hns/hnae.c
index f52e99a..d2af46f 100644
--- a/drivers/net/ethernet/hisilicon/hns/hnae.c
+++ b/drivers/net/ethernet/hisilicon/hns/hnae.c
@@ -439,40 +439,39 @@ EXPORT_SYMBOL(hnae_ae_unregister);
  static ssize_t handles_show(struct device *dev,
struct device_attribute *attr, char *buf)
  {
-   ssize_t s = 0;
+   char *s = buf;
struct hnae_ae_dev *hdev = cls_to_ae_dev(dev);
struct hnae_handle *h;
int i = 0, j;
  
  	list_for_each_entry_rcu(h, >handle_list, node) {

-   s += sprintf(buf + s, "handle %d (eport_id=%u from %s):\n",
-   i++, h->eport_id, h->dev->name);
+   s += sprintf(s, "handle %d (eport_id=%u from %s):\n",
+i++, h->eport_id, h->dev->name);
for (j = 0; j < h->q_num; j++) {
-   s += sprintf(buf + s, "\tqueue[%d] on %p\n",
+   s += sprintf(s, "\tqueue[%d] on %p\n",
 j, h->qs[i]->io_base);
-#define HANDEL_TX_MSG "\t\ttx_ring on %p:%u,%u,%u,%u,%u,%llu,%llu\n"
-   s += sprintf(buf + s,
-HANDEL_TX_MSG,
+   s += sprintf(s,
+"\t\ttx_ring on 
%p:%u,%u,%u,%u,%u,%llu,%llu\n",
 h->qs[i]->tx_ring.io_base,
 h->qs[i]->tx_ring.buf_size,
 h->qs[i]->tx_ring.desc_num,
 h->qs[i]->tx_ring.max_desc_num_per_pkt,
 h->qs[i]->tx_ring.max_raw_data_sz_per_desc,
 h->qs[i]->tx_ring.max_pkt_size,
-h->qs[i]->tx_ring.stats.sw_err_cnt,
-h->qs[i]->tx_ring.stats.io_err_cnt);
-   s += sprintf(buf + s,
-   "\t\trx_ring on %p:%u,%u,%llu,%llu,%llu\n",
-   h->qs[i]->rx_ring.io_base,
-   h->qs[i]->rx_ring.buf_size,
-   h->qs[i]->rx_ring.desc_num,
-   h->qs[i]->rx_ring.stats.sw_err_cnt,
-   h->qs[i]->rx_ring.stats.io_err_cnt,
-   h->qs[i]->rx_ring.stats.seg_pkt_cnt);
+h->qs[i]->tx_ring.stats.sw_err_cnt,
+h->qs[i]->tx_ring.stats.io_err_cnt);
+   s += sprintf(s,
+"\t\trx_ring on %p:%u,%u,%llu,%llu,%llu\n",
+h->qs[i]->rx_ring.io_base,
+h->qs[i]->rx_ring.buf_size,
+h->qs[i]->rx_ring.desc_num,
+h->qs[i]->rx_ring.stats.sw_err_cnt,
+h->qs[i]->rx_ring.stats.io_err_cnt,
+h->qs[i]->rx_ring.stats.seg_pkt_cnt);
}
}
  
-	return s;

+   return s - buf;
  }
  
  static DEVICE_ATTR_RO(handles);




.


thanks Joe
your suggestion is good, will send out a patch to fix it.


--
Best Regards
Daode Huang


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo 

Re: [PATCH net-next 0/2] net: fix some bugs in HNS drivers

2015-10-11 Thread huangdaode

On 2015/10/11 20:02, David Miller wrote:

From: huangdaode <huangda...@hisilicon.com>
Date: Thu, 8 Oct 2015 14:17:23 +0800


This patchset fixes the two bugs in HNS driver, one is for fixing the
compilation warning bug on arm 32-bit platform, another is fixing the wrong
mac port judgement bug which is found during internal tests.

This patch series does not apply to the net-next tree at all.

Also, both patches should use a subsystem prefix of "hisilicon: "
in the Subject lines.

Thanks.

.



Thanks David,
Because it conflicts with arnd's patches,  which fixes this bug.
in the mail, Joe Perches advised another fix, we will send out the patch 
soon.

thanks

--
Best Regards
Daode Huang


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next v2 1/2] hisilicon net: removes the once HANDEL_TX_MSG macro

2015-10-11 Thread huangdaode

On 2015/10/12 11:24, Joe Perches wrote:

Hello Huang.

On Mon, 2015-10-12 at 11:23 +0800, huangdaode wrote:

This patch changes the code style to make the code more simple.
also removes the once used HNADEL_TX_MSG macro, according to the

HANDEL_TX_MSG typo


review comments from Joe Perches.

Signed-off-by: huangdaode <huangda...@hisilicon.com>
Reviewed-by: Joe Perches <j...@perches.com>

I didn't review this.
'

Hi Joe
please refer to http://lists.openwall.net/netdev/2015/10/11/61
thanks.


Please do not add signatures for another person when
not specifically added by that person.



.




--
Best Regards
Daode Huang


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v2 2/2] hisilicon net: fix a bug on Hisilicon Network Subsystem

2015-10-11 Thread huangdaode
This patch fixes the wrong judgement of mac_id when get port num.

Signed-off-by: huangdaode <huangda...@hisilicon.com>
Signed-off-by: yankejian <yankej...@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
index 95bf42a..e162e4a 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
@@ -179,7 +179,7 @@ static int hns_mac_get_inner_port_num(struct hns_mac_cb 
*mac_cb,
return -EINVAL;
}
} else if (mac_cb->dsaf_dev->dsaf_mode < DSAF_MODE_MAX) {
-   if (mac_cb->mac_id <= DSAF_MAX_PORT_NUM_PER_CHIP) {
+   if (mac_cb->mac_id >= DSAF_MAX_PORT_NUM_PER_CHIP) {
dev_err(mac_cb->dev,
"input invalid,%s mac%d vmid%d!\n",
mac_cb->dsaf_dev->ae_dev.name,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v2 0/2] hisilicon net: fix some bugs in HNS drivers

2015-10-11 Thread huangdaode
This patchset fixes the two bugs in HNS driver, one is change the code style 
according to the review comments from Joe Perches<j...@perches.com>, another
is fixing the wrong mac_id judgement bug which is found during internal tests.

change log:
v2
  1) remove first bug fix, which is fixed in another patch submitted by
 Arnd Bergmann <a...@arndb.de>
  2) change the code sytyle according to Joe.
v1
 initial version.
 
huangdaode (2):
  hisilicon net: removes the once HANDEL_TX_MSG macro
  hisilicon net: fix a bug on Hisilicon Network Subsystem

 drivers/net/ethernet/hisilicon/hns/hnae.c | 45 +++
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c |  2 +-
 2 files changed, 23 insertions(+), 24 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v2 1/2] hisilicon net: removes the once HANDEL_TX_MSG macro

2015-10-11 Thread huangdaode
This patch changes the code style to make the code more simple.
also removes the once used HNADEL_TX_MSG macro, according to the
review comments from Joe Perches.

Signed-off-by: huangdaode <huangda...@hisilicon.com>
Reviewed-by: Joe Perches <j...@perches.com>
---
 drivers/net/ethernet/hisilicon/hns/hnae.c | 45 +++
 1 file changed, 22 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.c 
b/drivers/net/ethernet/hisilicon/hns/hnae.c
index f52e99a..40f5779 100644
--- a/drivers/net/ethernet/hisilicon/hns/hnae.c
+++ b/drivers/net/ethernet/hisilicon/hns/hnae.c
@@ -439,40 +439,39 @@ EXPORT_SYMBOL(hnae_ae_unregister);
 static ssize_t handles_show(struct device *dev,
struct device_attribute *attr, char *buf)
 {
-   ssize_t s = 0;
+   char *s = buf;
struct hnae_ae_dev *hdev = cls_to_ae_dev(dev);
struct hnae_handle *h;
int i = 0, j;
 
list_for_each_entry_rcu(h, >handle_list, node) {
-   s += sprintf(buf + s, "handle %d (eport_id=%u from %s):\n",
+   s += sprintf(s, "handle %d (eport_id=%u from %s):\n",
i++, h->eport_id, h->dev->name);
for (j = 0; j < h->q_num; j++) {
-   s += sprintf(buf + s, "\tqueue[%d] on %p\n",
+   s += sprintf(s, "\tqueue[%d] on %p\n",
 j, h->qs[i]->io_base);
-#define HANDEL_TX_MSG "\t\ttx_ring on %p:%u,%u,%u,%u,%u,%llu,%llu\n"
-   s += sprintf(buf + s,
-HANDEL_TX_MSG,
-h->qs[i]->tx_ring.io_base,
-h->qs[i]->tx_ring.buf_size,
-h->qs[i]->tx_ring.desc_num,
-h->qs[i]->tx_ring.max_desc_num_per_pkt,
-h->qs[i]->tx_ring.max_raw_data_sz_per_desc,
-h->qs[i]->tx_ring.max_pkt_size,
-h->qs[i]->tx_ring.stats.sw_err_cnt,
-h->qs[i]->tx_ring.stats.io_err_cnt);
-   s += sprintf(buf + s,
-   "\t\trx_ring on %p:%u,%u,%llu,%llu,%llu\n",
-   h->qs[i]->rx_ring.io_base,
-   h->qs[i]->rx_ring.buf_size,
-   h->qs[i]->rx_ring.desc_num,
-   h->qs[i]->rx_ring.stats.sw_err_cnt,
-   h->qs[i]->rx_ring.stats.io_err_cnt,
-   h->qs[i]->rx_ring.stats.seg_pkt_cnt);
+   s += sprintf(s,
+   "\t\ttx_ring on 
%p:%u,%u,%u,%u,%u,%llu,%llu\n",
+   h->qs[i]->tx_ring.io_base,
+   h->qs[i]->tx_ring.buf_size,
+   h->qs[i]->tx_ring.desc_num,
+   h->qs[i]->tx_ring.max_desc_num_per_pkt,
+   h->qs[i]->tx_ring.max_raw_data_sz_per_desc,
+   h->qs[i]->tx_ring.max_pkt_size,
+   h->qs[i]->tx_ring.stats.sw_err_cnt,
+   h->qs[i]->tx_ring.stats.io_err_cnt);
+   s += sprintf(s,
+   "\t\trx_ring on %p:%u,%u,%llu,%llu,%llu\n",
+   h->qs[i]->rx_ring.io_base,
+   h->qs[i]->rx_ring.buf_size,
+   h->qs[i]->rx_ring.desc_num,
+   h->qs[i]->rx_ring.stats.sw_err_cnt,
+   h->qs[i]->rx_ring.stats.io_err_cnt,
+   h->qs[i]->rx_ring.stats.seg_pkt_cnt);
}
}
 
-   return s;
+   return s - buf;
 }
 
 static DEVICE_ATTR_RO(handles);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next] net: hns: fix the unknown phy_nterface_t type error

2015-10-10 Thread huangdaode
This patch fix the building error reported by Jiri Pirko <j...@resnulli.us>

drivers/net/ethernet/hisilicon/hns/hnae.h:465:2: error: unknown type
name 'phy_interface_t'
phy_interface_t phy_if;
^
the full build log is on https://lists.01.org/pipermail/kbuild-all.

Signed-off-by: huangdaode <huangda...@hisilicon.com>
Signed-off-by: yankejian <yankej...@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns/hnae.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.h 
b/drivers/net/ethernet/hisilicon/hns/hnae.h
index 5edd8cd..d4a1eb1 100644
--- a/drivers/net/ethernet/hisilicon/hns/hnae.h
+++ b/drivers/net/ethernet/hisilicon/hns/hnae.h
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #define HNAE_DRIVER_VERSION "1.3.0"
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 0/2] net: fix some bugs in HNS drivers

2015-10-08 Thread huangdaode
This patchset fixes the two bugs in HNS driver, one is for fixing the
compilation warning bug on arm 32-bit platform, another is fixing the wrong
mac port judgement bug which is found during internal tests.

huangdaode (2):
  net: Fix Hisilicon Network Subsystem compilation warning
  net: fix a bug on Hisilicon Network Subsystem

 drivers/net/ethernet/hisilicon/hns/hnae.c | 12 ++--
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 2/2] net: fix a bug on Hisilicon Network Subsystem

2015-10-08 Thread huangdaode
This patch fixes a bug in hns driver during internal testing of the
driver.

Signed-off-by: huangdaode <huangda...@hisilicon.com>
Signed-off-by: yankejian <yankej...@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
index 95bf42a..e162e4a 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
@@ -179,7 +179,7 @@ static int hns_mac_get_inner_port_num(struct hns_mac_cb 
*mac_cb,
return -EINVAL;
}
} else if (mac_cb->dsaf_dev->dsaf_mode < DSAF_MODE_MAX) {
-   if (mac_cb->mac_id <= DSAF_MAX_PORT_NUM_PER_CHIP) {
+   if (mac_cb->mac_id >= DSAF_MAX_PORT_NUM_PER_CHIP) {
dev_err(mac_cb->dev,
"input invalid,%s mac%d vmid%d!\n",
mac_cb->dsaf_dev->ae_dev.name,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 1/2] net: Fix Hisilicon Network Subsystem compilation warning

2015-10-08 Thread huangdaode
This patch fix a compilation warning on arm 32-bit platform

Signed-off-by: huangdaode <huangda...@hisilicon.com>
Signed-off-by: yankejian <yankej...@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns/hnae.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.c 
b/drivers/net/ethernet/hisilicon/hns/hnae.c
index 0a0a9e8..ccbb666 100644
--- a/drivers/net/ethernet/hisilicon/hns/hnae.c
+++ b/drivers/net/ethernet/hisilicon/hns/hnae.c
@@ -448,12 +448,12 @@ static ssize_t handles_show(struct device *dev,
s += sprintf(buf + s, "handle %d (eport_id=%u from %s):\n",
i++, h->eport_id, h->dev->name);
for (j = 0; j < h->q_num; j++) {
-   s += sprintf(buf + s, "\tqueue[%d] on 0x%llx\n",
-j, (u64)h->qs[i]->io_base);
-#define HANDEL_TX_MSG "\t\ttx_ring on 0x%llx:%u,%u,%u,%u,%u,%llu,%llu\n"
+   s += sprintf(buf + s, "\tqueue[%d] on 0x%p\n",
+j, h->qs[i]->io_base);
+#define HANDEL_TX_MSG "\t\ttx_ring on 0x%p:%u,%u,%u,%u,%u,%llu,%llu\n"
s += sprintf(buf + s,
 HANDEL_TX_MSG,
-(u64)h->qs[i]->tx_ring.io_base,
+h->qs[i]->tx_ring.io_base,
 h->qs[i]->tx_ring.buf_size,
 h->qs[i]->tx_ring.desc_num,
 h->qs[i]->tx_ring.max_desc_num_per_pkt,
@@ -462,8 +462,8 @@ static ssize_t handles_show(struct device *dev,
 h->qs[i]->tx_ring.stats.sw_err_cnt,
 h->qs[i]->tx_ring.stats.io_err_cnt);
s += sprintf(buf + s,
-   "\t\trx_ring on 0x%llx:%u,%u,%llu,%llu,%llu\n",
-   (u64)h->qs[i]->rx_ring.io_base,
+   "\t\trx_ring on 0x%p:%u,%u,%llu,%llu,%llu\n",
+   h->qs[i]->rx_ring.io_base,
h->qs[i]->rx_ring.buf_size,
h->qs[i]->rx_ring.desc_num,
h->qs[i]->rx_ring.stats.sw_err_cnt,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next 3/6] net: remove dsa.h include from linux/netdevice.h

2015-10-08 Thread huangdaode

On 2015/10/8 20:18, Jiri Pirko wrote:

Thu, Oct 08, 2015 at 02:11:11PM CEST, huangda...@hisilicon.com wrote:

On 2015/10/8 17:18, Jiri Pirko wrote:

Thu, Oct 08, 2015 at 11:04:48AM CEST, l...@intel.com wrote:

Hi Vivien,

[auto build test ERROR on net-next/master -- if it's inappropriate base, please 
ignore]

config: arm64-allyesconfig (attached as .config)
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm64

All errors (new ones prefixed by >>):

   In file included from drivers/net/ethernet/hisilicon/hns/hnae.c:15:0:

drivers/net/ethernet/hisilicon/hns/hnae.h:465:2: error: unknown type name 
'phy_interface_t'

 phy_interface_t phy_if;
 ^

vim +/phy_interface_t +465 drivers/net/ethernet/hisilicon/hns/hnae.h

Looks like hnae.c needs to do "#include " directly.
Cc'ing maintainer.



6fe6611f huangdaode 2015-09-17  449  struct hnae_ae_dev {
6fe6611f huangdaode 2015-09-17  450 struct device cls_dev; /* the class dev 
*/
6fe6611f huangdaode 2015-09-17  451 struct device *dev; /* the presented 
dev */
6fe6611f huangdaode 2015-09-17  452 struct hnae_ae_ops *ops;
6fe6611f huangdaode 2015-09-17  453 struct list_head node;
6fe6611f huangdaode 2015-09-17  454 struct module *owner; /* the module who 
provides this dev */
6fe6611f huangdaode 2015-09-17  455 int id;
6fe6611f huangdaode 2015-09-17  456 char name[AE_NAME_SIZE];
6fe6611f huangdaode 2015-09-17  457 struct list_head handle_list;
6fe6611f huangdaode 2015-09-17  458 spinlock_t lock; /* lock to protect the 
handle_list */
6fe6611f huangdaode 2015-09-17  459  };
6fe6611f huangdaode 2015-09-17  460
6fe6611f huangdaode 2015-09-17  461  struct hnae_handle {
6fe6611f huangdaode 2015-09-17  462 struct device *owner_dev; /* the device 
which make use of this handle */
6fe6611f huangdaode 2015-09-17  463 struct hnae_ae_dev *dev;  /* the device 
who provides this handle */
6fe6611f huangdaode 2015-09-17  464 struct device_node *phy_node;
6fe6611f huangdaode 2015-09-17 @465 phy_interface_t phy_if;
6fe6611f huangdaode 2015-09-17  466 u32 if_support;
6fe6611f huangdaode 2015-09-17  467 int q_num;
6fe6611f huangdaode 2015-09-17  468 int vf_id;
6fe6611f huangdaode 2015-09-17  469 u32 eport_id;
6fe6611f huangdaode 2015-09-17  470 enum hnae_port_type port_type;
6fe6611f huangdaode 2015-09-17  471 struct list_head node;/* list to 
hnae_ae_dev->handle_list */
6fe6611f huangdaode 2015-09-17  472 struct hnae_buf_ops *bops; /* operation 
for the buffer */
6fe6611f huangdaode 2015-09-17  473 struct hnae_queue **qs;  /* array base 
of all queues */

:: The code at line 465 was first introduced by commit
:: 6fe6611ff275522a4e4c0359e2f46cdd07780d2f net: add Hisilicon Network 
Subsystem hnae framework support

:: TO: huangdaode <huangda...@hisilicon.com>
:: CC: David S. Miller <da...@davemloft.net>

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

.


Hi Jiri
thanks for your information. i have compiled the latest net-next repo using
your config file, but don't find the error you mentioned.
the attachment is the build log and the  config file.

also, i used the following command to compile, but still fail to reproduce
your issue.
/  daode@Turing-Arch-b:~/work/net-next$ cat build.sh //
//export ARCH=arm64 //
//export CROSS_COMPILE=aarch64-linux-gnu-//
//make allyesconfig//
//make -j16 //
daode@Turing-Arch-b:~/work/net-next$ /

so could you please help me to reproduce the issue.

The patch is not in tree. That does not change the fact that you should
include linux/phy.h directly. Please send the patch adding that. Thanks!



.


ok,
thanks!

--
Best Regards
Daode Huang


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next v3] net: Fix Hisilicon Network Subsystem Support Compilation

2015-09-27 Thread huangdaode

On 2015/9/26 12:42, David Miller wrote:

From: huangdaode <huangda...@hisilicon.com>
Date: Fri, 25 Sep 2015 16:29:50 +0800


@@ -191,9 +191,12 @@ static void hns_rcb_ring_init(struct ring_pair_cb 
*ring_pair, int ring_type)
if (ring_type == RX_RING) {
dsaf_write_dev(q, RCB_RING_RX_RING_BASEADDR_L_REG,
   (u32)dma);
+#ifdef CONFIG_64BIT
dsaf_write_dev(q, RCB_RING_RX_RING_BASEADDR_H_REG,
   (u32)(dma >> 32));
-
+#else
+   dsaf_write_dev(q, RCB_RING_RX_RING_BASEADDR_H_REG, 0);
+#endif
dsaf_write_dev(q, RCB_RING_RX_RING_BD_LEN_REG,
   bd_size_type);
dsaf_write_dev(q, RCB_RING_RX_RING_BD_NUM_REG,

CONFIG_64BIT doesn't tell you if _DMA_ addresses are 64-bit or not.

Furthermore there is a portable way to shift a 32-bit value down
32-bits whilst avoiding warnings.

(x >> 31) >> 1

So you should definitely use that instead of the CONFIG_64BIT test.

.


agreed.



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v4] net: Fix Hisilicon Network Subsystem Support Compilation

2015-09-27 Thread huangdaode
This patch fixes the compilation error with arm allmodconfig, this error
generated due to unavailability of readq() on 32-bit platform which was
found during net-next daily compilation. In the same time, fix all the
hns drivers compilation warnings.

Signed-off-by: huangdaode <huangda...@hisilicon.com>
Signed-off-by: zhaungyuzeng <yisen.zhu...@huawei.com>
Signed-off-by: kenneth Lee <liguo...@hisilicon.com>
Signed-off-by: yankejian <yankej...@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c   |  2 +-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h  |  4 ++--
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c   |  6 ++
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h   |  2 +-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c |  1 +
 drivers/net/ethernet/hisilicon/hns/hns_enet.c   | 17 -
 6 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
index a8bd27b..95bf42a 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
@@ -86,7 +86,7 @@ int hns_mac_get_sfp_prsnt(struct hns_mac_cb *mac_cb, int 
*sfp_prsnt)
if (!mac_cb->cpld_vaddr)
return -ENODEV;
 
-   *sfp_prsnt = !dsaf_read_b((u64)mac_cb->cpld_vaddr
+   *sfp_prsnt = !dsaf_read_b((u8 *)mac_cb->cpld_vaddr
+ MAC_SFP_PORT_OFFSET);
 
return 0;
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
index e0417c0..315b07e 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
@@ -43,7 +43,7 @@ struct hns_mac_cb;
 #define DSAF_DUMP_REGS_NUM 504
 #define DSAF_STATIC_NUM 28
 
-#define DSAF_STATS_READ(p, offset) (*((u64 *)((u64)(p) + (offset
+#define DSAF_STATS_READ(p, offset) (*((u64 *)((u8 *)(p) + (offset
 
 enum hal_dsaf_mode {
HRD_DSAF_NO_DSAF_MODE   = 0x0,
@@ -302,7 +302,7 @@ struct dsaf_device {
 
 static inline void *hns_dsaf_dev_priv(const struct dsaf_device *dsaf_dev)
 {
-   return (void *)((u64)dsaf_dev + sizeof(*dsaf_dev));
+   return (void *)((u8 *)dsaf_dev + sizeof(*dsaf_dev));
 }
 
 struct dsaf_drv_tbl_tcam_key {
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
index 50f3427..05ea244 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
@@ -192,8 +192,7 @@ static void hns_rcb_ring_init(struct ring_pair_cb 
*ring_pair, int ring_type)
dsaf_write_dev(q, RCB_RING_RX_RING_BASEADDR_L_REG,
   (u32)dma);
dsaf_write_dev(q, RCB_RING_RX_RING_BASEADDR_H_REG,
-  (u32)(dma >> 32));
-
+  (u32)((dma >> 31) >> 1));
dsaf_write_dev(q, RCB_RING_RX_RING_BD_LEN_REG,
   bd_size_type);
dsaf_write_dev(q, RCB_RING_RX_RING_BD_NUM_REG,
@@ -204,8 +203,7 @@ static void hns_rcb_ring_init(struct ring_pair_cb 
*ring_pair, int ring_type)
dsaf_write_dev(q, RCB_RING_TX_RING_BASEADDR_L_REG,
   (u32)dma);
dsaf_write_dev(q, RCB_RING_TX_RING_BASEADDR_H_REG,
-  (u32)(dma >> 32));
-
+  (u32)((dma >> 31) >> 1));
dsaf_write_dev(q, RCB_RING_TX_RING_BD_LEN_REG,
   bd_size_type);
dsaf_write_dev(q, RCB_RING_TX_RING_BD_NUM_REG,
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
index 6fc58ba..b475e1b 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
@@ -967,6 +967,6 @@ static inline u32 dsaf_get_reg_field(void *base, u32 reg, 
u32 mask, u32 shift)
readb((__iomem unsigned char *)(addr))
 
 #define hns_mac_reg_read64(drv, offset) \
-   readq((__iomem void *)(((u64)(drv)->io_base + 0xc00 + (offset
+   readq((__iomem void *)(((u8 *)(drv)->io_base + 0xc00 + (offset
 
 #endif /* _DSAF_REG_H */
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
index fe7fa1d..dab5ecf 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
@@ -7,6 +7,7 @@
  * (at your option) any later version.
  */
 
+#include 
 #include 
 #include "hns_dsaf_main.h"
 #include "hns_dsaf_mac.h"
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c 
b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index 0713ced..ce7f2e0 1006

[PATCH v2] net: Fix Hisilicon Network Subsystem Support Compilation

2015-09-25 Thread huangdaode
This patch fixes the compilation error with arm allmodconfig, this error
generated due to unavailability of readq() on 32-bit platform which was
found during net-next daily compilation. In the same time, fix all the
hns drivers compilation warnings.

Signed-off-by: huangdaode <huangda...@hisilicon.com>
Signed-off-by: zhaungyuzeng <yisen.zhu...@huawei.com>
Signed-off-by: kenneth Lee <liguo...@hisilicon.com>
Signed-off-by: yankejian <yankej...@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c  |  2 +-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h |  4 ++--
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c  | 10 --
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h  | 10 +-
 drivers/net/ethernet/hisilicon/hns/hns_enet.c  | 17 -
 5 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
index a8bd27b..95bf42a 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
@@ -86,7 +86,7 @@ int hns_mac_get_sfp_prsnt(struct hns_mac_cb *mac_cb, int 
*sfp_prsnt)
if (!mac_cb->cpld_vaddr)
return -ENODEV;
 
-   *sfp_prsnt = !dsaf_read_b((u64)mac_cb->cpld_vaddr
+   *sfp_prsnt = !dsaf_read_b((u8 *)mac_cb->cpld_vaddr
+ MAC_SFP_PORT_OFFSET);
 
return 0;
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
index e0417c0..315b07e 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
@@ -43,7 +43,7 @@ struct hns_mac_cb;
 #define DSAF_DUMP_REGS_NUM 504
 #define DSAF_STATIC_NUM 28
 
-#define DSAF_STATS_READ(p, offset) (*((u64 *)((u64)(p) + (offset
+#define DSAF_STATS_READ(p, offset) (*((u64 *)((u8 *)(p) + (offset
 
 enum hal_dsaf_mode {
HRD_DSAF_NO_DSAF_MODE   = 0x0,
@@ -302,7 +302,7 @@ struct dsaf_device {
 
 static inline void *hns_dsaf_dev_priv(const struct dsaf_device *dsaf_dev)
 {
-   return (void *)((u64)dsaf_dev + sizeof(*dsaf_dev));
+   return (void *)((u8 *)dsaf_dev + sizeof(*dsaf_dev));
 }
 
 struct dsaf_drv_tbl_tcam_key {
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
index 50f3427..1e10f65 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
@@ -191,9 +191,12 @@ static void hns_rcb_ring_init(struct ring_pair_cb 
*ring_pair, int ring_type)
if (ring_type == RX_RING) {
dsaf_write_dev(q, RCB_RING_RX_RING_BASEADDR_L_REG,
   (u32)dma);
+#ifdef CONFIG_64BIT
dsaf_write_dev(q, RCB_RING_RX_RING_BASEADDR_H_REG,
   (u32)(dma >> 32));
-
+#else
+   dsaf_write_dev(q, RCB_RING_RX_RING_BASEADDR_H_REG, 0);
+#endif
dsaf_write_dev(q, RCB_RING_RX_RING_BD_LEN_REG,
   bd_size_type);
dsaf_write_dev(q, RCB_RING_RX_RING_BD_NUM_REG,
@@ -203,9 +206,12 @@ static void hns_rcb_ring_init(struct ring_pair_cb 
*ring_pair, int ring_type)
} else {
dsaf_write_dev(q, RCB_RING_TX_RING_BASEADDR_L_REG,
   (u32)dma);
+#ifdef CONFIG_64BIT
dsaf_write_dev(q, RCB_RING_TX_RING_BASEADDR_H_REG,
   (u32)(dma >> 32));
-
+#else
+   dsaf_write_dev(q, RCB_RING_TX_RING_BASEADDR_H_REG, 0);
+#endif
dsaf_write_dev(q, RCB_RING_TX_RING_BD_LEN_REG,
   bd_size_type);
dsaf_write_dev(q, RCB_RING_TX_RING_BD_NUM_REG,
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
index 6fc58ba..8dcaf5f 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
@@ -966,7 +966,15 @@ static inline u32 dsaf_get_reg_field(void *base, u32 reg, 
u32 mask, u32 shift)
 #define dsaf_read_b(addr)\
readb((__iomem unsigned char *)(addr))
 
+#ifndef readq
+static inline u64 readq(void __iomem *reg)
+{
+   return (((u64)readl(reg + 0x4UL) << 32) |
+   (u64)readl(reg));
+}
+#endif
+
 #define hns_mac_reg_read64(drv, offset) \
-   readq((__iomem void *)(((u64)(drv)->io_base + 0xc00 + (offset
+   readq((__iomem void *)(((u8 *)(drv)->io_base + 0xc00 + (offset
 
 #endif /* _DSAF_REG_H */
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c 
b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index 0713ced..ce7f2e0 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -31,8 +31,6 @@
 #define NIC_TX_CLEA

Re: [PATCH v2] net: Fix Hisilicon Network Subsystem Support Compilation

2015-09-25 Thread huangdaode

On 2015/9/25 15:12, David Miller wrote:

From: huangdaode <huangda...@hisilicon.com>
Date: Fri, 25 Sep 2015 14:47:23 +0800


@@ -966,7 +966,15 @@ static inline u32 dsaf_get_reg_field(void *base, u32 reg, 
u32 mask, u32 shift)
  #define dsaf_read_b(addr)\
readb((__iomem unsigned char *)(addr))
  
+#ifndef readq

+static inline u64 readq(void __iomem *reg)
+{

Nope, try instead "#include 
yes, it's defined in #include .
will fix in v3,
thanks

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v2] net: Fix Hisilicon Network Subsystem Support Compilation

2015-09-25 Thread huangdaode
This patch fixes the compilation error with arm allmodconfig, this error
generated due to unavailability of readq() on 32-bit platform which was
found during net-next daily compilation. In the same time, fix all the
hns drivers compilation warnings.

Sgned-off-by: huangdaode <huangda...@hisilicon.com>
Signed-off-by: zhaungyuzeng <yisen.zhu...@huawei.com>
Signed-off-by: kenneth Lee <liguo...@hisilicon.com>
Signed-off-by: yankejian <yankej...@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c   |  2 +-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h  |  4 ++--
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c   | 10 --
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h   |  2 +-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c |  1 +
 drivers/net/ethernet/hisilicon/hns/hns_enet.c   | 17 -
 6 files changed, 13 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
index a8bd27b..95bf42a 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
@@ -86,7 +86,7 @@ int hns_mac_get_sfp_prsnt(struct hns_mac_cb *mac_cb, int 
*sfp_prsnt)
if (!mac_cb->cpld_vaddr)
return -ENODEV;
 
-   *sfp_prsnt = !dsaf_read_b((u64)mac_cb->cpld_vaddr
+   *sfp_prsnt = !dsaf_read_b((u8 *)mac_cb->cpld_vaddr
+ MAC_SFP_PORT_OFFSET);
 
return 0;
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
index e0417c0..315b07e 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
@@ -43,7 +43,7 @@ struct hns_mac_cb;
 #define DSAF_DUMP_REGS_NUM 504
 #define DSAF_STATIC_NUM 28
 
-#define DSAF_STATS_READ(p, offset) (*((u64 *)((u64)(p) + (offset
+#define DSAF_STATS_READ(p, offset) (*((u64 *)((u8 *)(p) + (offset
 
 enum hal_dsaf_mode {
HRD_DSAF_NO_DSAF_MODE   = 0x0,
@@ -302,7 +302,7 @@ struct dsaf_device {
 
 static inline void *hns_dsaf_dev_priv(const struct dsaf_device *dsaf_dev)
 {
-   return (void *)((u64)dsaf_dev + sizeof(*dsaf_dev));
+   return (void *)((u8 *)dsaf_dev + sizeof(*dsaf_dev));
 }
 
 struct dsaf_drv_tbl_tcam_key {
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
index 50f3427..1e10f65 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
@@ -191,9 +191,12 @@ static void hns_rcb_ring_init(struct ring_pair_cb 
*ring_pair, int ring_type)
if (ring_type == RX_RING) {
dsaf_write_dev(q, RCB_RING_RX_RING_BASEADDR_L_REG,
   (u32)dma);
+#ifdef CONFIG_64BIT
dsaf_write_dev(q, RCB_RING_RX_RING_BASEADDR_H_REG,
   (u32)(dma >> 32));
-
+#else
+   dsaf_write_dev(q, RCB_RING_RX_RING_BASEADDR_H_REG, 0);
+#endif
dsaf_write_dev(q, RCB_RING_RX_RING_BD_LEN_REG,
   bd_size_type);
dsaf_write_dev(q, RCB_RING_RX_RING_BD_NUM_REG,
@@ -203,9 +206,12 @@ static void hns_rcb_ring_init(struct ring_pair_cb 
*ring_pair, int ring_type)
} else {
dsaf_write_dev(q, RCB_RING_TX_RING_BASEADDR_L_REG,
   (u32)dma);
+#ifdef CONFIG_64BIT
dsaf_write_dev(q, RCB_RING_TX_RING_BASEADDR_H_REG,
   (u32)(dma >> 32));
-
+#else
+   dsaf_write_dev(q, RCB_RING_TX_RING_BASEADDR_H_REG, 0);
+#endif
dsaf_write_dev(q, RCB_RING_TX_RING_BD_LEN_REG,
   bd_size_type);
dsaf_write_dev(q, RCB_RING_TX_RING_BD_NUM_REG,
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
index 6fc58ba..b475e1b 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
@@ -967,6 +967,6 @@ static inline u32 dsaf_get_reg_field(void *base, u32 reg, 
u32 mask, u32 shift)
readb((__iomem unsigned char *)(addr))
 
 #define hns_mac_reg_read64(drv, offset) \
-   readq((__iomem void *)(((u64)(drv)->io_base + 0xc00 + (offset
+   readq((__iomem void *)(((u8 *)(drv)->io_base + 0xc00 + (offset
 
 #endif /* _DSAF_REG_H */
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
index fe7fa1d..dab5ecf 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
@@ -7,6 +7,7 @@
  * (at your option) any later version.
  */
 
+#include 
 #include 
 #include "hns_dsaf_main.h"
 #include "hns_dsaf_mac.h"
di

[PATCH net-next v3] net: Fix Hisilicon Network Subsystem Support Compilation

2015-09-25 Thread huangdaode
This patch fixes the compilation error with arm allmodconfig, this error
generated due to unavailability of readq() on 32-bit platform which was
found during net-next daily compilation. In the same time, fix all the
hns drivers compilation warnings.

Sgned-off-by: huangdaode <huangda...@hisilicon.com>
Signed-off-by: zhaungyuzeng <yisen.zhu...@huawei.com>
Signed-off-by: kenneth Lee <liguo...@hisilicon.com>
Signed-off-by: yankejian <yankej...@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c   |  2 +-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h  |  4 ++--
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c   | 10 --
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h   |  2 +-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c |  1 +
 drivers/net/ethernet/hisilicon/hns/hns_enet.c   | 17 -
 6 files changed, 13 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
index a8bd27b..95bf42a 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
@@ -86,7 +86,7 @@ int hns_mac_get_sfp_prsnt(struct hns_mac_cb *mac_cb, int 
*sfp_prsnt)
if (!mac_cb->cpld_vaddr)
return -ENODEV;
 
-   *sfp_prsnt = !dsaf_read_b((u64)mac_cb->cpld_vaddr
+   *sfp_prsnt = !dsaf_read_b((u8 *)mac_cb->cpld_vaddr
+ MAC_SFP_PORT_OFFSET);
 
return 0;
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
index e0417c0..315b07e 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
@@ -43,7 +43,7 @@ struct hns_mac_cb;
 #define DSAF_DUMP_REGS_NUM 504
 #define DSAF_STATIC_NUM 28
 
-#define DSAF_STATS_READ(p, offset) (*((u64 *)((u64)(p) + (offset
+#define DSAF_STATS_READ(p, offset) (*((u64 *)((u8 *)(p) + (offset
 
 enum hal_dsaf_mode {
HRD_DSAF_NO_DSAF_MODE   = 0x0,
@@ -302,7 +302,7 @@ struct dsaf_device {
 
 static inline void *hns_dsaf_dev_priv(const struct dsaf_device *dsaf_dev)
 {
-   return (void *)((u64)dsaf_dev + sizeof(*dsaf_dev));
+   return (void *)((u8 *)dsaf_dev + sizeof(*dsaf_dev));
 }
 
 struct dsaf_drv_tbl_tcam_key {
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
index 50f3427..1e10f65 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
@@ -191,9 +191,12 @@ static void hns_rcb_ring_init(struct ring_pair_cb 
*ring_pair, int ring_type)
if (ring_type == RX_RING) {
dsaf_write_dev(q, RCB_RING_RX_RING_BASEADDR_L_REG,
   (u32)dma);
+#ifdef CONFIG_64BIT
dsaf_write_dev(q, RCB_RING_RX_RING_BASEADDR_H_REG,
   (u32)(dma >> 32));
-
+#else
+   dsaf_write_dev(q, RCB_RING_RX_RING_BASEADDR_H_REG, 0);
+#endif
dsaf_write_dev(q, RCB_RING_RX_RING_BD_LEN_REG,
   bd_size_type);
dsaf_write_dev(q, RCB_RING_RX_RING_BD_NUM_REG,
@@ -203,9 +206,12 @@ static void hns_rcb_ring_init(struct ring_pair_cb 
*ring_pair, int ring_type)
} else {
dsaf_write_dev(q, RCB_RING_TX_RING_BASEADDR_L_REG,
   (u32)dma);
+#ifdef CONFIG_64BIT
dsaf_write_dev(q, RCB_RING_TX_RING_BASEADDR_H_REG,
   (u32)(dma >> 32));
-
+#else
+   dsaf_write_dev(q, RCB_RING_TX_RING_BASEADDR_H_REG, 0);
+#endif
dsaf_write_dev(q, RCB_RING_TX_RING_BD_LEN_REG,
   bd_size_type);
dsaf_write_dev(q, RCB_RING_TX_RING_BD_NUM_REG,
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
index 6fc58ba..b475e1b 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
@@ -967,6 +967,6 @@ static inline u32 dsaf_get_reg_field(void *base, u32 reg, 
u32 mask, u32 shift)
readb((__iomem unsigned char *)(addr))
 
 #define hns_mac_reg_read64(drv, offset) \
-   readq((__iomem void *)(((u64)(drv)->io_base + 0xc00 + (offset
+   readq((__iomem void *)(((u8 *)(drv)->io_base + 0xc00 + (offset
 
 #endif /* _DSAF_REG_H */
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
index fe7fa1d..dab5ecf 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
@@ -7,6 +7,7 @@
  * (at your option) any later version.
  */
 
+#include 
 #include 
 #include "hns_dsaf_main.h"
 #include "hns_dsaf_mac.h"
di

[PATCH net-next] net: Fix Hisilicon Network Subsystem Support Compilation

2015-09-24 Thread huangdaode
This patch fixes the compilation error with arm allmodconfig, this error
generated due to unavailability of readq on 32-bit platform which was
found during net-next daily compilation

Signed-off-by: huangdaode <huangda...@hisilicon.com>
Singed-off-by: yankejian <yankej...@huawei.com>
---
 drivers/net/ethernet/hisilicon/Kconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/Kconfig 
b/drivers/net/ethernet/hisilicon/Kconfig
index 165b5a8..04d5f8f 100644
--- a/drivers/net/ethernet/hisilicon/Kconfig
+++ b/drivers/net/ethernet/hisilicon/Kconfig
@@ -41,6 +41,7 @@ config HNS_MDIO
 
 config HNS
tristate "Hisilicon Network Subsystem Support (Framework)"
+   depends on ARM64
---help---
  This selects the framework support for Hisilicon Network Subsystem. It
  is needed by any driver which provides HNS acceleration engine or make
@@ -50,6 +51,7 @@ config HNS_DSAF
tristate "Hisilicon HNS DSAF device Support"
select HNS
select HNS_MDIO
+   depends on ARM64
---help---
  This selects the DSAF (Distributed System Area Frabric) network
  acceleration engine support. The engine is used in Hisilicon hip05,
@@ -59,6 +61,7 @@ config HNS_ENET
tristate "Hisilicon HNS Ethernet Device Support"
select PHYLIB
select HNS
+   depends on ARM64
---help---
  This selects the general ethernet driver for HNS.  This module make
  use of any HNS AE driver, such as HNS_DSAF
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/5] net: add Hisilicon Network Subsystem support (config and documents)

2015-09-23 Thread huangdaode

On 2015/9/21 22:52, Rob Herring wrote:

On 09/17/2015 01:51 AM, huangdaode wrote:

The Hisilicon Network Subsystem is a long term evolution IP which is
supposed to be used in Hisilicon ICT SoC. The IP, which is called hns
for short, is a TCP/IP acceleration engine, which can directly decode
TCP/IP stream and distribute them to different ring buffers.

HNS can be configured to work on different mode for different scenario.
This patch make use only some of the mode to make it as standard
ethernet NIC. The other mode will be added soon.

The whole function has 4 kernel sub-modules:

hnae: the HNS acceleration engine framework. It provides a abstract
interface between the engine and the upper layers which make use of the
engine by ring buffer.

hns_enet_drv: a standard ethernet driver that base on the ring buffer.

hns_dsaf: one of the implementation of HNS acceleration engine, which is
applied on Hililicon hip05, Hi1610 and other later-on SoCs

hns_mdio: the mdio control to the PHY, used by acceleration engine

This submit add basic config and documents

Signed-off-by: huangdaode <huangda...@hisilicon.com>
Signed-off-by: Kenneth Lee <liguo...@huawei.com>
Signed-off-by: Yisen Zhuang <yisen.zhu...@huawei.com>
---
  .../bindings/net/hisilicon-hip04-net.txt   |   4 +-
  .../devicetree/bindings/net/hisilicon-hns-dsaf.txt |  49 ++
  .../devicetree/bindings/net/hisilicon-hns-mdio.txt |  22 +++
  .../devicetree/bindings/net/hisilicon-hns-nic.txt  |  47 +
  arch/arm64/boot/dts/hisilicon/hip05_hns.dtsi   | 193 +
  5 files changed, 313 insertions(+), 2 deletions(-)
  create mode 100644 
Documentation/devicetree/bindings/net/hisilicon-hns-dsaf.txt
  create mode 100644 
Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
  create mode 100644 Documentation/devicetree/bindings/net/hisilicon-hns-nic.txt
  create mode 100644 arch/arm64/boot/dts/hisilicon/hip05_hns.dtsi

diff --git a/Documentation/devicetree/bindings/net/hisilicon-hip04-net.txt 
b/Documentation/devicetree/bindings/net/hisilicon-hip04-net.txt
index 988fc69..d1df8a0 100644
--- a/Documentation/devicetree/bindings/net/hisilicon-hip04-net.txt
+++ b/Documentation/devicetree/bindings/net/hisilicon-hip04-net.txt
@@ -32,13 +32,13 @@ Required properties:
  
  Required properties:
  
-- compatible: should be "hisilicon,hip04-mdio".

+- compatible: should be "hisilicon,mdio".

Why are you removing the old one? Please use more specific compatible
strings, not less specific.



we have unified the hip04_mdio.c and hip05_mdio.c  into hns_mdio.c, so 
we plan use
"hisilicon,mdio", "hisilicon,hns-mdio" "hisilicon,hns-mdio Vx", in this 
case, "hisilicon, mdio "
is more suitable for us, meanwhile, we will upstream hip04 dts file 
later, and will apply the

compatible property with "hisilicon,mdio".


  - Inherits from MDIO bus node binding [2]
  [2] Documentation/devicetree/bindings/net/phy.txt
  
  Example:

mdio {
-   compatible = "hisilicon,hip04-mdio";
+   compatible = "hisilicon,mdio";
reg = <0x28f1000 0x1000>;
#address-cells = <1>;
#size-cells = <0>;
diff --git a/Documentation/devicetree/bindings/net/hisilicon-hns-dsaf.txt 
b/Documentation/devicetree/bindings/net/hisilicon-hns-dsaf.txt
new file mode 100644
index 000..80411b2
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/hisilicon-hns-dsaf.txt
@@ -0,0 +1,49 @@
+Hisilicon DSA Fabric device controller
+
+Required properties:
+- compatible: should be "hisilicon,hns-dsaf-v1" or "hisilicon,hns-dsaf-v2".
+  "hisilicon,hns-dsaf-v1" is for hip05.
+  "hisilicon,hns-dsaf-v2" is for Hi1610 and Hi1612.
+- dsa-name: dsa fabric name who provide this interface.
+  should be "dsafX", X is the dsaf id.

What is this for? Find a different way to distinguish instances other
than an index.


our driver support multi dsaf, so X in dsafX is the dsaf id.
the enet driver interface use the dsa-name to match the dsaf engine, 
then get it's handle.
when there are 2 dsafs ,we use dsaf0 and dsaf1 to distinguish them. The 
default is dsaf0.



+- mode: dsa fabric mode string. only support one of dsaf modes like these:
+   "2port-64vf",
+   "6port-16rss",
+   "6port-16vf".
+- interrupt-parent: the interrupt parent of this device.
+- interrupts: should contain the DSA Fabric and rcb interrupt.
+- reg: specifies base physical address(es) and size of the device registers.
+  The first region is external interface control register base and size.
+  The second region is SerDes base register and size.
+  The third region is the PPE register base and size.
+  The fourth region is dsa fabric base register and size.
+  The fifth region is cpld base register and size, it is not

[PATCH v2 1/5] net: add Hisilicon Network Subsystem support (config and documents)

2015-09-17 Thread huangdaode
The Hisilicon Network Subsystem is a long term evolution IP which is
supposed to be used in Hisilicon ICT SoC. The IP, which is called hns
for short, is a TCP/IP acceleration engine, which can directly decode
TCP/IP stream and distribute them to different ring buffers.

HNS can be configured to work on different mode for different scenario.
This patch make use only some of the mode to make it as standard
ethernet NIC. The other mode will be added soon.

The whole function has 4 kernel sub-modules:

hnae: the HNS acceleration engine framework. It provides a abstract
interface between the engine and the upper layers which make use of the
engine by ring buffer.

hns_enet_drv: a standard ethernet driver that base on the ring buffer.

hns_dsaf: one of the implementation of HNS acceleration engine, which is
applied on Hililicon hip05, Hi1610 and other later-on SoCs

hns_mdio: the mdio control to the PHY, used by acceleration engine

This submit add basic config and documents

Signed-off-by: huangdaode <huangda...@hisilicon.com>
Signed-off-by: Kenneth Lee <liguo...@huawei.com>
Signed-off-by: Yisen Zhuang <yisen.zhu...@huawei.com>
---
 .../bindings/net/hisilicon-hip04-net.txt   |   4 +-
 .../devicetree/bindings/net/hisilicon-hns-dsaf.txt |  49 ++
 .../devicetree/bindings/net/hisilicon-hns-mdio.txt |  22 +++
 .../devicetree/bindings/net/hisilicon-hns-nic.txt  |  47 +
 arch/arm64/boot/dts/hisilicon/hip05_hns.dtsi   | 193 +
 5 files changed, 313 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/hisilicon-hns-dsaf.txt
 create mode 100644 Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
 create mode 100644 Documentation/devicetree/bindings/net/hisilicon-hns-nic.txt
 create mode 100644 arch/arm64/boot/dts/hisilicon/hip05_hns.dtsi

diff --git a/Documentation/devicetree/bindings/net/hisilicon-hip04-net.txt 
b/Documentation/devicetree/bindings/net/hisilicon-hip04-net.txt
index 988fc69..d1df8a0 100644
--- a/Documentation/devicetree/bindings/net/hisilicon-hip04-net.txt
+++ b/Documentation/devicetree/bindings/net/hisilicon-hip04-net.txt
@@ -32,13 +32,13 @@ Required properties:
 
 Required properties:
 
-- compatible: should be "hisilicon,hip04-mdio".
+- compatible: should be "hisilicon,mdio".
 - Inherits from MDIO bus node binding [2]
 [2] Documentation/devicetree/bindings/net/phy.txt
 
 Example:
mdio {
-   compatible = "hisilicon,hip04-mdio";
+   compatible = "hisilicon,mdio";
reg = <0x28f1000 0x1000>;
#address-cells = <1>;
#size-cells = <0>;
diff --git a/Documentation/devicetree/bindings/net/hisilicon-hns-dsaf.txt 
b/Documentation/devicetree/bindings/net/hisilicon-hns-dsaf.txt
new file mode 100644
index 000..80411b2
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/hisilicon-hns-dsaf.txt
@@ -0,0 +1,49 @@
+Hisilicon DSA Fabric device controller
+
+Required properties:
+- compatible: should be "hisilicon,hns-dsaf-v1" or "hisilicon,hns-dsaf-v2".
+  "hisilicon,hns-dsaf-v1" is for hip05.
+  "hisilicon,hns-dsaf-v2" is for Hi1610 and Hi1612.
+- dsa-name: dsa fabric name who provide this interface.
+  should be "dsafX", X is the dsaf id.
+- mode: dsa fabric mode string. only support one of dsaf modes like these:
+   "2port-64vf",
+   "6port-16rss",
+   "6port-16vf".
+- interrupt-parent: the interrupt parent of this device.
+- interrupts: should contain the DSA Fabric and rcb interrupt.
+- reg: specifies base physical address(es) and size of the device registers.
+  The first region is external interface control register base and size.
+  The second region is SerDes base register and size.
+  The third region is the PPE register base and size.
+  The fourth region is dsa fabric base register and size.
+  The fifth region is cpld base register and size, it is not required if do 
not use cpld.
+- phy-handle: phy handle of physicl port, 0 if not any phy device. see 
ethernet.txt [1].
+- buf-size: rx buffer size, should be 16-1024.
+- desc-num: number of description in TX and RX queue, should be 512, 1024, 
2048 or 4096.
+
+[1] Documentation/devicetree/bindings/net/phy.txt
+
+Example:
+
+dsa: dsa@c700 {
+   compatible = "hisilicon,hns-dsaf-v1";
+   dsa_name = "dsaf0";
+   mode = "6port-16rss";
+   interrupt-parent = <_dsa>;
+   reg = <0x0 0xC000 0x0 0x42
+  0x0 0xC200 0x0 0x30
+  0x0 0xc500 0x0 0x89
+  0x0 0xc700 0x0 0x6>;
+   phy-handle = <0 0 0 0 _phy4 _phy5 0 0>;
+   interrupts = <131 4>,<132 4>, <133 4>,<134 4>,
+<135 4>,<136 4>, <137 4>,<138 4>,
+  

[PATCH v2 5/5] net: add Hisilicon Network Subsystem basic ethernet support

2015-09-17 Thread huangdaode
This is to add basic ethernet support for HNS. It is one of the way to
use the HNS acceleration engine. But most of the decoding/encoding
capability of the AE cannot be used in this way.

This submit contains the basic feature as a ethernet driver. More will
be added later.

Signed-off-by: huangdaode <huangda...@hisilicon.com>
Signed-off-by: Kenneth Lee <liguo...@huawei.com>
Signed-off-by: Yisen Zhuang <yisen.zhu...@huawei.com>
---
 drivers/net/ethernet/hisilicon/Kconfig   |8 +
 drivers/net/ethernet/hisilicon/hns/Makefile  |3 +
 drivers/net/ethernet/hisilicon/hns/hns_enet.c| 1646 ++
 drivers/net/ethernet/hisilicon/hns/hns_enet.h|   84 ++
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 1230 
 5 files changed, 2971 insertions(+)
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hns_enet.c
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hns_enet.h
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c

diff --git a/drivers/net/ethernet/hisilicon/Kconfig 
b/drivers/net/ethernet/hisilicon/Kconfig
index aae2c47..165b5a8 100644
--- a/drivers/net/ethernet/hisilicon/Kconfig
+++ b/drivers/net/ethernet/hisilicon/Kconfig
@@ -55,4 +55,12 @@ config HNS_DSAF
  acceleration engine support. The engine is used in Hisilicon hip05,
  Hi1610 and further ICT SoC
 
+config HNS_ENET
+   tristate "Hisilicon HNS Ethernet Device Support"
+   select PHYLIB
+   select HNS
+   ---help---
+ This selects the general ethernet driver for HNS.  This module make
+ use of any HNS AE driver, such as HNS_DSAF
+
 endif # NET_VENDOR_HISILICON
diff --git a/drivers/net/ethernet/hisilicon/hns/Makefile 
b/drivers/net/ethernet/hisilicon/hns/Makefile
index 0516af7..6010c83 100644
--- a/drivers/net/ethernet/hisilicon/hns/Makefile
+++ b/drivers/net/ethernet/hisilicon/hns/Makefile
@@ -7,3 +7,6 @@ obj-$(CONFIG_HNS) += hnae.o
 obj-$(CONFIG_HNS_DSAF) += hns_dsaf.o
 hns_dsaf-objs = hns_ae_adapt.o hns_dsaf_gmac.o hns_dsaf_mac.o hns_dsaf_misc.o \
hns_dsaf_main.o hns_dsaf_ppe.o hns_dsaf_rcb.o hns_dsaf_xgmac.o
+
+obj-$(CONFIG_HNS_ENET) += hns_enet_drv.o
+hns_enet_drv-objs = hns_enet.o hns_ethtool.o
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c 
b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
new file mode 100644
index 000..0713ced
--- /dev/null
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -0,0 +1,1646 @@
+/*
+ * Copyright (c) 2014-2015 Hisilicon Limited.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "hnae.h"
+#include "hns_enet.h"
+
+#define NIC_MAX_Q_PER_VF 16
+#define HNS_NIC_TX_TIMEOUT (5 * HZ)
+
+#define SERVICE_TIMER_HZ (1 * HZ)
+
+#define NIC_TX_CLEAN_MAX_NUM 256
+#define NIC_RX_CLEAN_MAX_NUM 64
+
+#define RCB_ERR_PRINT_CYCLE 1000
+
+#define RCB_IRQ_NOT_INITED 0
+#define RCB_IRQ_INITED 1
+
+static void fill_desc(struct hnae_ring *ring, void *priv,
+ int size, dma_addr_t dma, int frag_end,
+ int buf_num, enum hns_desc_type type)
+{
+   struct hnae_desc *desc = >desc[ring->next_to_use];
+   struct hnae_desc_cb *desc_cb = >desc_cb[ring->next_to_use];
+   struct sk_buff *skb;
+   __be16 protocol;
+   u32 ip_offset;
+   u32 asid_bufnum_pid = 0;
+   u32 flag_ipoffset = 0;
+
+   desc_cb->priv = priv;
+   desc_cb->length = size;
+   desc_cb->dma = dma;
+   desc_cb->type = type;
+
+   desc->addr = cpu_to_le64(dma);
+   desc->tx.send_size = cpu_to_le16((u16)size);
+
+   /*config bd buffer end */
+   flag_ipoffset |= 1 << HNS_TXD_VLD_B;
+
+   asid_bufnum_pid |= buf_num << HNS_TXD_BUFNUM_S;
+
+   if (type == DESC_TYPE_SKB) {
+   skb = (struct sk_buff *)priv;
+
+   if (skb->ip_summed == CHECKSUM_PARTIAL) {
+   protocol = skb->protocol;
+   ip_offset = ETH_HLEN;
+
+   /*if it is a SW VLAN check the next protocol*/
+   if (protocol == htons(ETH_P_8021Q)) {
+   ip_offset += VLAN_HLEN;
+   protocol = vlan_get_protocol(skb);
+   skb->protocol = protocol;
+   }
+
+   if (skb->protocol == htons(ETH_P_IP)) {
+   flag_ipoffset |= 1 << HNS_TXD_L3CS_B;
+   /* check for tcp/udp header */
+   

[PATCH v2 0/5] net: Hisilicon Network Subsystem support

2015-09-17 Thread huangdaode
This is V2 of Hisilicon Network Subsystem(HNS) patchesets taking care
about LKML comments.

Please find out the changes from the change logs. 
This patchset is rebased on mainline kernel Linux 4.3-rc1 branch.

[PATCH v2 1/5] Device Tree Binding Documentation
[PATCH v2 2/5] Merge MDIO Module
[PATCH v2 3/5] Hisilicon Network Acceleration Engine Framework
[PATCH v2 4/5] Distributed System Area Fabric Module
[PATCH v2 5/5] Basic Ethernet Driver Module

Changes from V1:
1. Remove "inline" in C file (according to LKML comment, same in below).
2. Fix a bug about class_find_device.
3. Change the DTS pattern on hnae, restruct it to compatible with Hi1610 soc.
4. Unified hip04_mdio and hip05_mdio into hns_mdio, which is more usaul for 
   later SOCs.

V1 Patches Reference: https://lkml.org/lkml/2015/8/14/165

Thanks

huangdaode (5):
  net: add Hisilicon Network Subsystem support (config and documents)
  net: add Hisilicon Network Subsystem MDIO support
  net: add Hisilicon Network Subsystem hnae framework support
  net: add Hisilicon Network Subsystem DSAF support
  net: add Hisilicon Network Subsystem basic ethernet support

 .../bindings/net/hisilicon-hip04-net.txt   |4 +-
 .../devicetree/bindings/net/hisilicon-hns-dsaf.txt |   49 +
 .../devicetree/bindings/net/hisilicon-hns-mdio.txt |   22 +
 .../devicetree/bindings/net/hisilicon-hns-nic.txt  |   47 +
 arch/arm64/boot/dts/hisilicon/hip05_hns.dtsi   |  193 ++
 drivers/net/ethernet/hisilicon/Kconfig |   34 +-
 drivers/net/ethernet/hisilicon/Makefile|4 +-
 drivers/net/ethernet/hisilicon/hip04_mdio.c|  185 --
 drivers/net/ethernet/hisilicon/hns/Makefile|   12 +
 drivers/net/ethernet/hisilicon/hns/hnae.c  |  507 
 drivers/net/ethernet/hisilicon/hns/hnae.h  |  583 +
 drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c  |  777 +++
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c |  704 ++
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.h |   45 +
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c  |  900 +++
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h  |  456 
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 2445 
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h |  427 
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c |  317 +++
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.h |   43 +
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c  |  583 +
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h  |  105 +
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c  | 1023 
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.h  |  137 ++
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h  |  972 
 .../net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c|  836 +++
 .../net/ethernet/hisilicon/hns/hns_dsaf_xgmac.h|   15 +
 drivers/net/ethernet/hisilicon/hns/hns_enet.c  | 1646 +
 drivers/net/ethernet/hisilicon/hns/hns_enet.h  |   84 +
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c   | 1230 ++
 drivers/net/ethernet/hisilicon/hns_mdio.c  |  520 +
 31 files changed, 14716 insertions(+), 189 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/hisilicon-hns-dsaf.txt
 create mode 100644 Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
 create mode 100644 Documentation/devicetree/bindings/net/hisilicon-hns-nic.txt
 create mode 100644 arch/arm64/boot/dts/hisilicon/hip05_hns.dtsi
 delete mode 100644 drivers/net/ethernet/hisilicon/hip04_mdio.c
 create mode 100644 drivers/net/ethernet/hisilicon/hns/Makefile
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hnae.c
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hnae.h
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.h
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.h
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.h
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.h
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hns_enet.c
 create mode 100644 drivers/net/ethernet/his

[PATCH v2 2/5] net: add Hisilicon Network Subsystem MDIO support

2015-09-17 Thread huangdaode
The MDIO support for Hisilicon Network Subsystem. It is used in Hislicon
hip04, hip05 and Hi1610 SoC to control the external PHY

Signed-off-by: huangdaode <huangda...@hisilicon.com>
Signed-off-by: Yisen Zhuang <yisen.zhu...@huawei.com>
Signed-off-by: Kenneth Lee <liguo...@huawei.com>
---
 drivers/net/ethernet/hisilicon/Kconfig  |  10 +-
 drivers/net/ethernet/hisilicon/Makefile |   3 +-
 drivers/net/ethernet/hisilicon/hip04_mdio.c | 185 --
 drivers/net/ethernet/hisilicon/hns_mdio.c   | 520 
 4 files changed, 531 insertions(+), 187 deletions(-)
 delete mode 100644 drivers/net/ethernet/hisilicon/hip04_mdio.c
 create mode 100644 drivers/net/ethernet/hisilicon/hns_mdio.c

diff --git a/drivers/net/ethernet/hisilicon/Kconfig 
b/drivers/net/ethernet/hisilicon/Kconfig
index dead17b..9184f1d 100644
--- a/drivers/net/ethernet/hisilicon/Kconfig
+++ b/drivers/net/ethernet/hisilicon/Kconfig
@@ -5,7 +5,7 @@
 config NET_VENDOR_HISILICON
bool "Hisilicon devices"
default y
-   depends on ARM
+   depends on ARM || ARM64
---help---
  If you have a network (Ethernet) card belonging to this class, say Y.
 
@@ -27,8 +27,16 @@ config HIP04_ETH
select PHYLIB
select MARVELL_PHY
select MFD_SYSCON
+   select HNS_MDIO
---help---
  If you wish to compile a kernel for a hardware with hisilicon p04 SoC 
and
  want to use the internal ethernet then you should answer Y to this.
 
+config HNS_MDIO
+   tristate "Hisilicon HNS MDIO device Support"
+   select MDIO
+   ---help---
+ This selects the HNS MDIO support. It is needed by HNS_DSAF to access
+ the PHY
+
 endif # NET_VENDOR_HISILICON
diff --git a/drivers/net/ethernet/hisilicon/Makefile 
b/drivers/net/ethernet/hisilicon/Makefile
index 6c14540..04b4b21 100644
--- a/drivers/net/ethernet/hisilicon/Makefile
+++ b/drivers/net/ethernet/hisilicon/Makefile
@@ -3,4 +3,5 @@
 #
 
 obj-$(CONFIG_HIX5HD2_GMAC) += hix5hd2_gmac.o
-obj-$(CONFIG_HIP04_ETH) += hip04_mdio.o hip04_eth.o
+obj-$(CONFIG_HIP04_ETH) += hip04_eth.o
+obj-$(CONFIG_HNS_MDIO) += hns_mdio.o
diff --git a/drivers/net/ethernet/hisilicon/hip04_mdio.c 
b/drivers/net/ethernet/hisilicon/hip04_mdio.c
deleted file mode 100644
index fca0a5b..000
--- a/drivers/net/ethernet/hisilicon/hip04_mdio.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/* Copyright (c) 2014 Linaro Ltd.
- * Copyright (c) 2014 Hisilicon Limited.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#define MDIO_CMD_REG   0x0
-#define MDIO_ADDR_REG  0x4
-#define MDIO_WDATA_REG 0x8
-#define MDIO_RDATA_REG 0xc
-#define MDIO_STA_REG   0x10
-
-#define MDIO_START BIT(14)
-#define MDIO_R_VALID   BIT(1)
-#define MDIO_READ  (BIT(12) | BIT(11) | MDIO_START)
-#define MDIO_WRITE (BIT(12) | BIT(10) | MDIO_START)
-
-struct hip04_mdio_priv {
-   void __iomem *base;
-};
-
-#define WAIT_TIMEOUT 10
-static int hip04_mdio_wait_ready(struct mii_bus *bus)
-{
-   struct hip04_mdio_priv *priv = bus->priv;
-   int i;
-
-   for (i = 0; readl_relaxed(priv->base + MDIO_CMD_REG) & MDIO_START; i++) 
{
-   if (i == WAIT_TIMEOUT)
-   return -ETIMEDOUT;
-   msleep(20);
-   }
-
-   return 0;
-}
-
-static int hip04_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
-{
-   struct hip04_mdio_priv *priv = bus->priv;
-   u32 val;
-   int ret;
-
-   ret = hip04_mdio_wait_ready(bus);
-   if (ret < 0)
-   goto out;
-
-   val = regnum | (mii_id << 5) | MDIO_READ;
-   writel_relaxed(val, priv->base + MDIO_CMD_REG);
-
-   ret = hip04_mdio_wait_ready(bus);
-   if (ret < 0)
-   goto out;
-
-   val = readl_relaxed(priv->base + MDIO_STA_REG);
-   if (val & MDIO_R_VALID) {
-   dev_err(bus->parent, "SMI bus read not valid\n");
-   ret = -ENODEV;
-   goto out;
-   }
-
-   val = readl_relaxed(priv->base + MDIO_RDATA_REG);
-   ret = val & 0x;
-out:
-   return ret;
-}
-
-static int hip04_mdio_write(struct mii_bus *bus, int mii_id,
-   int regnum, u16 value)
-{
-   struct hip04_mdio_priv *priv = bus->priv;
-   u32 val;
-   int ret;
-
-   ret = hip04_mdio_wait_ready(bus);
-   if (ret < 0)
-   goto out;
-
-   writel_relaxed(value, priv->base + MDIO_WDATA_REG);
-   val = regnum | (mii_id << 5) | MDIO_WRITE;
-   writel_relaxed(val, priv->base + MDIO_CM

[PATCH v2 3/5] net: add Hisilicon Network Subsystem hnae framework support

2015-09-17 Thread huangdaode
HNAE (Hisilicon Network Acceleration Engine) is a framework to provide a
unified ring buffer interface for Hisilicon Network Acceleration
Engines.

With the interface, upper layer can work as ethernet driver, ODP driver
or other service driver on purpose.

Signed-off-by: huangdaode <huangda...@hisilicon.com>
Signed-off-by: Kenneth Lee <liguo...@huawei.com>
Signed-off-by: Yisen Zhuang <yisen.zhu...@huawei.com>
---
 drivers/net/ethernet/hisilicon/Kconfig  |   7 +
 drivers/net/ethernet/hisilicon/Makefile |   1 +
 drivers/net/ethernet/hisilicon/hns/Makefile |   5 +
 drivers/net/ethernet/hisilicon/hns/hnae.c   | 507 
 drivers/net/ethernet/hisilicon/hns/hnae.h   | 583 
 5 files changed, 1103 insertions(+)
 create mode 100644 drivers/net/ethernet/hisilicon/hns/Makefile
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hnae.c
 create mode 100644 drivers/net/ethernet/hisilicon/hns/hnae.h

diff --git a/drivers/net/ethernet/hisilicon/Kconfig 
b/drivers/net/ethernet/hisilicon/Kconfig
index 9184f1d..85a2609 100644
--- a/drivers/net/ethernet/hisilicon/Kconfig
+++ b/drivers/net/ethernet/hisilicon/Kconfig
@@ -39,4 +39,11 @@ config HNS_MDIO
  This selects the HNS MDIO support. It is needed by HNS_DSAF to access
  the PHY
 
+config HNS
+   tristate "Hisilicon Network Subsystem Support (Framework)"
+   ---help---
+ This selects the framework support for Hisilicon Network Subsystem. It
+ is needed by any driver which provides HNS acceleration engine or make
+ use of the engine
+
 endif # NET_VENDOR_HISILICON
diff --git a/drivers/net/ethernet/hisilicon/Makefile 
b/drivers/net/ethernet/hisilicon/Makefile
index 04b4b21..390b71f 100644
--- a/drivers/net/ethernet/hisilicon/Makefile
+++ b/drivers/net/ethernet/hisilicon/Makefile
@@ -5,3 +5,4 @@
 obj-$(CONFIG_HIX5HD2_GMAC) += hix5hd2_gmac.o
 obj-$(CONFIG_HIP04_ETH) += hip04_eth.o
 obj-$(CONFIG_HNS_MDIO) += hns_mdio.o
+obj-$(CONFIG_HNS) += hns/
diff --git a/drivers/net/ethernet/hisilicon/hns/Makefile 
b/drivers/net/ethernet/hisilicon/hns/Makefile
new file mode 100644
index 000..8a5f1e7
--- /dev/null
+++ b/drivers/net/ethernet/hisilicon/hns/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile for the HISILICON network device drivers.
+#
+
+obj-$(CONFIG_HNS) += hnae.o
diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.c 
b/drivers/net/ethernet/hisilicon/hns/hnae.c
new file mode 100644
index 000..0a0a9e8
--- /dev/null
+++ b/drivers/net/ethernet/hisilicon/hns/hnae.c
@@ -0,0 +1,507 @@
+/*
+ * Copyright (c) 2014-2015 Hisilicon Limited.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include "hnae.h"
+
+#define cls_to_ae_dev(dev) container_of(dev, struct hnae_ae_dev, cls_dev)
+
+static struct class *hnae_class;
+
+static void
+hnae_list_add(spinlock_t *lock, struct list_head *node, struct list_head *head)
+{
+   unsigned long flags;
+
+   spin_lock_irqsave(lock, flags);
+   list_add_tail_rcu(node, head);
+   spin_unlock_irqrestore(lock, flags);
+}
+
+static void hnae_list_del(spinlock_t *lock, struct list_head *node)
+{
+   unsigned long flags;
+
+   spin_lock_irqsave(lock, flags);
+   list_del_rcu(node);
+   spin_unlock_irqrestore(lock, flags);
+}
+
+static int hnae_alloc_buffer(struct hnae_ring *ring, struct hnae_desc_cb *cb)
+{
+   unsigned int order = hnae_page_order(ring);
+   struct page *p = dev_alloc_pages(order);
+
+   if (!p)
+   return -ENOMEM;
+
+   cb->priv = p;
+   cb->page_offset = 0;
+   cb->reuse_flag = 0;
+   cb->buf  = page_address(p);
+   cb->length = hnae_page_size(ring);
+   cb->type = DESC_TYPE_PAGE;
+
+   return 0;
+}
+
+static void hnae_free_buffer(struct hnae_ring *ring, struct hnae_desc_cb *cb)
+{
+   if (cb->type == DESC_TYPE_SKB)
+   dev_kfree_skb_any((struct sk_buff *)cb->priv);
+   else if (unlikely(is_rx_ring(ring)))
+   put_page((struct page *)cb->priv);
+   memset(cb, 0, sizeof(*cb));
+}
+
+static int hnae_map_buffer(struct hnae_ring *ring, struct hnae_desc_cb *cb)
+{
+   cb->dma = dma_map_page(ring_to_dev(ring), cb->priv, 0,
+  cb->length, ring_to_dma_dir(ring));
+
+   if (dma_mapping_error(ring_to_dev(ring), cb->dma))
+   return -EIO;
+
+   return 0;
+}
+
+static void hnae_unmap_buffer(struct hnae_ring *ring, struct hnae_desc_cb *cb)
+{
+   if (cb->type == DESC_TYPE_SKB)
+   dma_unmap_single(ring_to_dev(ring), cb->dma, cb->length,
+ring_to_dma_dir(ring