2016-03-04 00:51:13

by huangdaode

[permalink] [raw]
Subject: [PATCH net 0/6]net: hns: hns driver updates

Hi David,
This patch series are hisilicon network driver bug fix.

Best Regards
Daode.

Daode Huang (5):
net: hns: bug fix about the overflow of mss
net: hns: fixes the hw interrupt bug in using napi
net: hns: fixed portid bug in sending manage pkt
net: hns: adds uc match for debug port
net: hns: bug fix of getting hilink status

Lisheng (1):
net: hns: fixed service-ges setting MAC-addr bug

drivers/net/ethernet/hisilicon/hns/hnae.h | 3 ++
drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c | 1 +
drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c | 29 ++++++++++++----
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c | 39 +++++++++++-----------
drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h | 4 +++
drivers/net/ethernet/hisilicon/hns/hns_enet.c | 30 +++++++++--------
6 files changed, 67 insertions(+), 39 deletions(-)

--
1.9.1


2016-03-04 00:51:17

by huangdaode

[permalink] [raw]
Subject: [PATCH net 2/6] net: hns: fixes the hw interrupt bug in using napi

In V1 chip, common_poll should check and clean fbd pkts, because it
can not pend irq to clean them if there is no new pkt comes in.
But V2 chip hw fixes this bug, and will pend irq itself to do this.
So, for V2 chip, we set ring_data->fini_process to NULL.

Signed-off-by: Daode Huang <[email protected]>
Signed-off-by: Lisheng <[email protected]>
---
drivers/net/ethernet/hisilicon/hns/hns_enet.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index 9d46d57..6250a42 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -946,8 +946,8 @@ static int hns_nic_common_poll(struct napi_struct *napi, int budget)
napi_complete(napi);
ring_data->ring->q->handle->dev->ops->toggle_ring_irq(
ring_data->ring, 0);
-
- ring_data->fini_process(ring_data);
+ if (ring_data->fini_process)
+ ring_data->fini_process(ring_data);
return 0;
}

@@ -1710,6 +1710,7 @@ static int hns_nic_init_ring_data(struct hns_nic_priv *priv)
{
struct hnae_handle *h = priv->ae_handle;
struct hns_nic_ring_data *rd;
+ bool is_ver1 = AE_IS_VER1(priv->enet_ver);
int i;

if (h->q_num > NIC_MAX_Q_PER_VF) {
@@ -1727,7 +1728,7 @@ static int hns_nic_init_ring_data(struct hns_nic_priv *priv)
rd->queue_index = i;
rd->ring = &h->qs[i]->tx_ring;
rd->poll_one = hns_nic_tx_poll_one;
- rd->fini_process = hns_nic_tx_fini_pro;
+ rd->fini_process = is_ver1 ? hns_nic_tx_fini_pro : NULL;

netif_napi_add(priv->netdev, &rd->napi,
hns_nic_common_poll, NIC_TX_CLEAN_MAX_NUM);
@@ -1739,7 +1740,7 @@ static int hns_nic_init_ring_data(struct hns_nic_priv *priv)
rd->ring = &h->qs[i - h->q_num]->rx_ring;
rd->poll_one = hns_nic_rx_poll_one;
rd->ex_process = hns_nic_rx_up_pro;
- rd->fini_process = hns_nic_rx_fini_pro;
+ rd->fini_process = is_ver1 ? hns_nic_rx_fini_pro : NULL;

netif_napi_add(priv->netdev, &rd->napi,
hns_nic_common_poll, NIC_RX_CLEAN_MAX_NUM);
--
1.9.1

2016-03-04 00:51:15

by huangdaode

[permalink] [raw]
Subject: [PATCH net 5/6] net: hns: fixed service-ges setting MAC-addr bug

From: Lisheng <[email protected]>

Service gmacs can not set mac add, this patch will fix the bug.

Signed-off-by: Daode Huang <[email protected]>
Signed-off-by: Lisheng <[email protected]>
---
drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
index 2591a51..eb86178 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
@@ -414,18 +414,17 @@ static void hns_gmac_set_mac_addr(void *mac_drv, char *mac_addr)
{
struct mac_driver *drv = (struct mac_driver *)mac_drv;

- if (drv->mac_id >= DSAF_SERVICE_NW_NUM) {
- u32 high_val = mac_addr[1] | (mac_addr[0] << 8);
+ u32 high_val = mac_addr[1] | (mac_addr[0] << 8);

- u32 low_val = mac_addr[5] | (mac_addr[4] << 8)
- | (mac_addr[3] << 16) | (mac_addr[2] << 24);
+ u32 low_val = mac_addr[5] | (mac_addr[4] << 8)
+ | (mac_addr[3] << 16) | (mac_addr[2] << 24);

- u32 val = dsaf_read_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG);
- u32 sta_addr_en = dsaf_get_bit(val, GMAC_ADDR_EN_B);
- dsaf_write_dev(drv, GMAC_STATION_ADDR_LOW_2_REG, low_val);
- dsaf_write_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG,
- high_val | (sta_addr_en << GMAC_ADDR_EN_B));
- }
+ u32 val = dsaf_read_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG);
+ u32 sta_addr_en = dsaf_get_bit(val, GMAC_ADDR_EN_B);
+
+ dsaf_write_dev(drv, GMAC_STATION_ADDR_LOW_2_REG, low_val);
+ dsaf_write_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG,
+ high_val | (sta_addr_en << GMAC_ADDR_EN_B));
}

static int hns_gmac_config_loopback(void *mac_drv, enum hnae_loop loop_mode,
--
1.9.1

2016-03-04 00:51:14

by huangdaode

[permalink] [raw]
Subject: [PATCH net 4/6] net: hns: adds uc match for debug port

This patch adds uc match for debug port by:
1)Enables uc match of debug port when initializing gmac
2)Enables uc match of mac address register2

Signed-off-by: Daode Huang <[email protected]>
Signed-off-by: lipeng <[email protected]>
---
drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c | 18 +++++++++++++++++-
drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h | 2 ++
2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
index b8517b0..2591a51 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
@@ -290,6 +290,16 @@ static int hns_gmac_adjust_link(void *mac_drv, enum mac_speed speed,
return 0;
}

+static void hns_gmac_set_uc_match(void *mac_drv, u16 en)
+{
+ struct mac_driver *drv = (struct mac_driver *)mac_drv;
+
+ dsaf_set_dev_bit(drv, GMAC_REC_FILT_CONTROL_REG,
+ GMAC_UC_MATCH_EN_B, !en);
+ dsaf_set_dev_bit(drv, GMAC_STATION_ADDR_HIGH_2_REG,
+ GMAC_ADDR_EN_B, !en);
+}
+
static void hns_gmac_init(void *mac_drv)
{
u32 port;
@@ -305,6 +315,8 @@ static void hns_gmac_init(void *mac_drv)
mdelay(10);
hns_gmac_disable(mac_drv, MAC_COMM_MODE_RX_AND_TX);
hns_gmac_tx_loop_pkt_dis(mac_drv);
+ if (drv->mac_cb->mac_type == HNAE_PORT_DEBUG)
+ hns_gmac_set_uc_match(mac_drv, 0);
}

void hns_gmac_update_stats(void *mac_drv)
@@ -407,8 +419,12 @@ static void hns_gmac_set_mac_addr(void *mac_drv, char *mac_addr)

u32 low_val = mac_addr[5] | (mac_addr[4] << 8)
| (mac_addr[3] << 16) | (mac_addr[2] << 24);
+
+ u32 val = dsaf_read_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG);
+ u32 sta_addr_en = dsaf_get_bit(val, GMAC_ADDR_EN_B);
dsaf_write_dev(drv, GMAC_STATION_ADDR_LOW_2_REG, low_val);
- dsaf_write_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG, high_val);
+ dsaf_write_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG,
+ high_val | (sta_addr_en << GMAC_ADDR_EN_B));
}
}

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
index f0c4f9b..d8c49b6 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
@@ -917,6 +917,8 @@
#define GMAC_LP_REG_CF2MI_LP_EN_B 2

#define GMAC_MODE_CHANGE_EB_B 0
+#define GMAC_UC_MATCH_EN_B 0
+#define GMAC_ADDR_EN_B 16

#define GMAC_RECV_CTRL_STRIP_PAD_EN_B 3
#define GMAC_RECV_CTRL_RUNT_PKT_EN_B 4
--
1.9.1

2016-03-04 00:51:11

by huangdaode

[permalink] [raw]
Subject: [PATCH net 3/6] net: hns: fixed portid bug in sending manage pkt

In V2 chip, when sending mamagement packets, the driver should
config the port id to BD descs.

Signed-off-by: Daode Huang <[email protected]>
Signed-off-by: Lisheng <[email protected]>
---
drivers/net/ethernet/hisilicon/hns/hnae.h | 3 +++
drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c | 1 +
drivers/net/ethernet/hisilicon/hns/hns_enet.c | 4 ++++
3 files changed, 8 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.h b/drivers/net/ethernet/hisilicon/hns/hnae.h
index 1cbcb9f..11a3f97 100644
--- a/drivers/net/ethernet/hisilicon/hns/hnae.h
+++ b/drivers/net/ethernet/hisilicon/hns/hnae.h
@@ -147,6 +147,8 @@ enum hnae_led_state {

#define HNSV2_TXD_BUFNUM_S 0
#define HNSV2_TXD_BUFNUM_M (0x7 << HNSV2_TXD_BUFNUM_S)
+#define HNSV2_TXD_PORTID_S 4
+#define HNSV2_TXD_PORTID_M (0X7 << HNSV2_TXD_PORTID_S)
#define HNSV2_TXD_RI_B 1
#define HNSV2_TXD_L4CS_B 2
#define HNSV2_TXD_L3CS_B 3
@@ -516,6 +518,7 @@ struct hnae_handle {
int q_num;
int vf_id;
u32 eport_id;
+ u32 dport_id; /*v2 tx bd should fill the dport_id*/
enum hnae_port_type port_type;
struct list_head node; /* list to hnae_ae_dev->handle_list */
struct hnae_buf_ops *bops; /* operation for the buffer */
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
index a0070d0..ea2561a 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
@@ -175,6 +175,7 @@ struct hnae_handle *hns_ae_get_handle(struct hnae_ae_dev *dev,
ae_handle->phy_node = vf_cb->mac_cb->phy_node;
ae_handle->if_support = vf_cb->mac_cb->if_support;
ae_handle->port_type = vf_cb->mac_cb->mac_type;
+ ae_handle->dport_id = port_idx;

return ae_handle;
vf_id_err:
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index 6250a42..b45dcc2 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -69,6 +69,10 @@ static void fill_v2_desc(struct hnae_ring *ring, void *priv,
hnae_set_bit(rrcfv, HNSV2_TXD_VLD_B, 1);
hnae_set_field(bn_pid, HNSV2_TXD_BUFNUM_M, 0, buf_num - 1);

+ /*fill port_id in the tx bd for sending management pkts*/
+ hnae_set_field(bn_pid, HNSV2_TXD_PORTID_M,
+ HNSV2_TXD_PORTID_S, ring->q->handle->dport_id);
+
if (type == DESC_TYPE_SKB) {
skb = (struct sk_buff *)priv;

--
1.9.1

2016-03-04 00:52:37

by huangdaode

[permalink] [raw]
Subject: [PATCH net 1/6] net: hns: bug fix about the overflow of mss

When set MTU to the minimum value 68, there are increasing number
of error packets occur, which is caused by the overflowed value of
mss. This patch fix the bug.

This patch is just for huawei internal review, if there is no
comment for three days, I will send out to the mainline.

thanks

Signed-off-by: Daode Huang <[email protected]>
---
drivers/net/ethernet/hisilicon/hns/hns_enet.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index 3f77ff7..9d46d57 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -48,7 +48,6 @@ static void fill_v2_desc(struct hnae_ring *ring, void *priv,
struct iphdr *iphdr;
struct ipv6hdr *ipv6hdr;
struct sk_buff *skb;
- int skb_tmp_len;
__be16 protocol;
u8 bn_pid = 0;
u8 rrcfv = 0;
@@ -90,13 +89,13 @@ static void fill_v2_desc(struct hnae_ring *ring, void *priv,
hnae_set_bit(rrcfv, HNSV2_TXD_L4CS_B, 1);

/* check for tcp/udp header */
- if (iphdr->protocol == IPPROTO_TCP) {
+ if (iphdr->protocol == IPPROTO_TCP &&
+ skb_is_gso(skb)) {
hnae_set_bit(tvsvsn,
HNSV2_TXD_TSE_B, 1);
- skb_tmp_len = SKB_TMP_LEN(skb);
l4_len = tcp_hdrlen(skb);
- mss = mtu - skb_tmp_len - ETH_FCS_LEN;
- paylen = skb->len - skb_tmp_len;
+ mss = skb_shinfo(skb)->gso_size;
+ paylen = skb->len - SKB_TMP_LEN(skb);
}
} else if (skb->protocol == htons(ETH_P_IPV6)) {
hnae_set_bit(tvsvsn, HNSV2_TXD_IPV6_B, 1);
@@ -104,13 +103,13 @@ static void fill_v2_desc(struct hnae_ring *ring, void *priv,
hnae_set_bit(rrcfv, HNSV2_TXD_L4CS_B, 1);

/* check for tcp/udp header */
- if (ipv6hdr->nexthdr == IPPROTO_TCP) {
+ if (ipv6hdr->nexthdr == IPPROTO_TCP &&
+ skb_is_gso(skb) && skb_is_gso_v6(skb)) {
hnae_set_bit(tvsvsn,
HNSV2_TXD_TSE_B, 1);
- skb_tmp_len = SKB_TMP_LEN(skb);
l4_len = tcp_hdrlen(skb);
- mss = mtu - skb_tmp_len - ETH_FCS_LEN;
- paylen = skb->len - skb_tmp_len;
+ mss = skb_shinfo(skb)->gso_size;
+ paylen = skb->len - SKB_TMP_LEN(skb);
}
}
desc->tx.ip_offset = ip_offset;
--
1.9.1

2016-03-04 00:52:36

by huangdaode

[permalink] [raw]
Subject: [PATCH net 6/6] net: hns: bug fix of getting hilink status

from Lisheng <[email protected]>

There is some difference in hilink status defination between
v1 and v2 chips.
for v1 chip, all ports connected to the same hilink share the same
hilink status register bit.
but for v2, all ports have separately hilink status register bit. And
the register addr is also changed.
So this patch fixes the bug.

Signed-off-by: Daode Huang <[email protected]>
Signed-off-by: Lisheng <[email protected]>
---
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c | 39 +++++++++++-----------
drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h | 2 ++
2 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
index 607c3be..2fa38f1 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
@@ -240,35 +240,36 @@ void hns_ppe_com_srst(struct ppe_common_cb *ppe_common, u32 val)
/**
* hns_mac_get_sds_mode - get phy ifterface form serdes mode
* @mac_cb: mac control block
- * retuen phy interface
+ * return phy interface
*/
phy_interface_t hns_mac_get_phy_if(struct hns_mac_cb *mac_cb)
{
- u32 hilink3_mode;
- u32 hilink4_mode;
+ u32 reg, mode, shift;
void __iomem *sys_ctl_vaddr = mac_cb->sys_ctl_vaddr;
- int dev_id = mac_cb->mac_id;
+ int mac_id = mac_cb->mac_id;
phy_interface_t phy_if = PHY_INTERFACE_MODE_NA;
+ bool is_ver1 = AE_IS_VER1(mac_cb->dsaf_dev->dsaf_ver);

- hilink3_mode = dsaf_read_reg(sys_ctl_vaddr, HNS_MAC_HILINK3_REG);
- hilink4_mode = dsaf_read_reg(sys_ctl_vaddr, HNS_MAC_HILINK4_REG);
- if (dev_id >= 0 && dev_id <= 3) {
- if (hilink4_mode == 0)
- phy_if = PHY_INTERFACE_MODE_SGMII;
- else
+ /*for hip05 soc, port6,7 only support ge mode*/
+ if (is_ver1 && (mac_id >= 6 && mac_id <= 7)) {
+ phy_if = PHY_INTERFACE_MODE_SGMII;
+ } else if (mac_id >= 0 && mac_id <= 3) {
+ reg = is_ver1 ? HNS_MAC_HILINK4_REG : HNS_MAC_HILINK4V2_REG;
+ mode = dsaf_read_reg(sys_ctl_vaddr, reg);
+ shift = is_ver1 ? 0 : mac_id;
+ if (dsaf_get_bit(mode, shift))
phy_if = PHY_INTERFACE_MODE_XGMII;
- } else if (dev_id >= 4 && dev_id <= 5) {
- if (hilink3_mode == 0)
- phy_if = PHY_INTERFACE_MODE_SGMII;
else
+ phy_if = PHY_INTERFACE_MODE_SGMII;
+ } else if (mac_id >= 4 && mac_id <= 7) {
+ reg = is_ver1 ? HNS_MAC_HILINK3_REG : HNS_MAC_HILINK3V2_REG;
+ mode = dsaf_read_reg(sys_ctl_vaddr, reg);
+ shift = is_ver1 ? 0 : mac_id - 4;
+ if (dsaf_get_bit(mode, shift))
phy_if = PHY_INTERFACE_MODE_XGMII;
- } else {
- phy_if = PHY_INTERFACE_MODE_SGMII;
+ else
+ phy_if = PHY_INTERFACE_MODE_SGMII;
}
-
- dev_dbg(mac_cb->dev,
- "hilink3_mode=%d, hilink4_mode=%d dev_id=%d, phy_if=%d\n",
- hilink3_mode, hilink4_mode, dev_id, phy_if);
return phy_if;
}

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
index d8c49b6..690e4ea 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
@@ -103,6 +103,8 @@
/*serdes offset**/
#define HNS_MAC_HILINK3_REG DSAF_SUB_SC_HILINK3_CRG_CTRL0_REG
#define HNS_MAC_HILINK4_REG DSAF_SUB_SC_HILINK4_CRG_CTRL0_REG
+#define HNS_MAC_HILINK3V2_REG DSAF_SUB_SC_HILINK3_CRG_CTRL1_REG
+#define HNS_MAC_HILINK4V2_REG DSAF_SUB_SC_HILINK4_CRG_CTRL1_REG
#define HNS_MAC_LANE0_CTLEDFE_REG 0x000BFFCCULL
#define HNS_MAC_LANE1_CTLEDFE_REG 0x000BFFBCULL
#define HNS_MAC_LANE2_CTLEDFE_REG 0x000BFFACULL
--
1.9.1

2016-03-04 01:00:13

by huangdaode

[permalink] [raw]
Subject: Re: [PATCH net 0/6]net: hns: hns driver updates

sorry. please ignore this mail,
i will send out it again.

On 2016/3/4 9:09, Daode Huang wrote:
> Hi David,
> This patch series are hisilicon network driver bug fix.
>
> Best Regards
> Daode.
>
> Daode Huang (5):
> net: hns: bug fix about the overflow of mss
> net: hns: fixes the hw interrupt bug in using napi
> net: hns: fixed portid bug in sending manage pkt
> net: hns: adds uc match for debug port
> net: hns: bug fix of getting hilink status
>
> Lisheng (1):
> net: hns: fixed service-ges setting MAC-addr bug
>
> drivers/net/ethernet/hisilicon/hns/hnae.h | 3 ++
> drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c | 1 +
> drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c | 29 ++++++++++++----
> drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c | 39 +++++++++++-----------
> drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h | 4 +++
> drivers/net/ethernet/hisilicon/hns/hns_enet.c | 30 +++++++++--------
> 6 files changed, 67 insertions(+), 39 deletions(-)
>


2016-03-04 13:37:24

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH net 3/6] net: hns: fixed portid bug in sending manage pkt

Hello.

On 3/4/2016 4:09 AM, Daode Huang wrote:

> In V2 chip, when sending mamagement packets, the driver should
> config the port id to BD descs.
>
> Signed-off-by: Daode Huang <[email protected]>
> Signed-off-by: Lisheng <[email protected]>
> ---
> drivers/net/ethernet/hisilicon/hns/hnae.h | 3 +++
> drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c | 1 +
> drivers/net/ethernet/hisilicon/hns/hns_enet.c | 4 ++++
> 3 files changed, 8 insertions(+)
>
> diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.h b/drivers/net/ethernet/hisilicon/hns/hnae.h
> index 1cbcb9f..11a3f97 100644
> --- a/drivers/net/ethernet/hisilicon/hns/hnae.h
> +++ b/drivers/net/ethernet/hisilicon/hns/hnae.h
[...]
> @@ -516,6 +518,7 @@ struct hnae_handle {
> int q_num;
> int vf_id;
> u32 eport_id;
> + u32 dport_id; /*v2 tx bd should fill the dport_id*/

Please add spaces after /* and before */ (like it's done in other places
in this driver).

[...]
> diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
> index 6250a42..b45dcc2 100644
> --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
> +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
> @@ -69,6 +69,10 @@ static void fill_v2_desc(struct hnae_ring *ring, void *priv,
> hnae_set_bit(rrcfv, HNSV2_TXD_VLD_B, 1);
> hnae_set_field(bn_pid, HNSV2_TXD_BUFNUM_M, 0, buf_num - 1);
>
> + /*fill port_id in the tx bd for sending management pkts*/

Likewise.

> + hnae_set_field(bn_pid, HNSV2_TXD_PORTID_M,
> + HNSV2_TXD_PORTID_S, ring->q->handle->dport_id);
> +
> if (type == DESC_TYPE_SKB) {
> skb = (struct sk_buff *)priv;
>

MBR, Sergei

2016-03-04 13:39:24

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH net 4/6] net: hns: adds uc match for debug port

On 3/4/2016 4:09 AM, Daode Huang wrote:

> This patch adds uc match for debug port by:
> 1)Enables uc match of debug port when initializing gmac
> 2)Enables uc match of mac address register2
>
> Signed-off-by: Daode Huang <[email protected]>
> Signed-off-by: lipeng <[email protected]>

True/full name is required here.

> ---
> drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c | 18 +++++++++++++++++-
> drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h | 2 ++
> 2 files changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
> index b8517b0..2591a51 100644
> --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
> +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
[...]
> @@ -407,8 +419,12 @@ static void hns_gmac_set_mac_addr(void *mac_drv, char *mac_addr)
>
> u32 low_val = mac_addr[5] | (mac_addr[4] << 8)
> | (mac_addr[3] << 16) | (mac_addr[2] << 24);
> +
> + u32 val = dsaf_read_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG);
> + u32 sta_addr_en = dsaf_get_bit(val, GMAC_ADDR_EN_B);

Empty line needed after declarations.

> dsaf_write_dev(drv, GMAC_STATION_ADDR_LOW_2_REG, low_val);
> - dsaf_write_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG, high_val);
> + dsaf_write_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG,
> + high_val | (sta_addr_en << GMAC_ADDR_EN_B));
> }
> }
>
[...]

MBR, Sergei

2016-03-11 01:54:55

by huangdaode

[permalink] [raw]
Subject: Re: [PATCH net 3/6] net: hns: fixed portid bug in sending manage pkt



On 2016/3/4 21:37, Sergei Shtylyov wrote:
> Hello.
>
> On 3/4/2016 4:09 AM, Daode Huang wrote:
>
>> In V2 chip, when sending mamagement packets, the driver should
>> config the port id to BD descs.
>>
>> Signed-off-by: Daode Huang <[email protected]>
>> Signed-off-by: Lisheng <[email protected]>
>> ---
>> drivers/net/ethernet/hisilicon/hns/hnae.h | 3 +++
>> drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c | 1 +
>> drivers/net/ethernet/hisilicon/hns/hns_enet.c | 4 ++++
>> 3 files changed, 8 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.h
>> b/drivers/net/ethernet/hisilicon/hns/hnae.h
>> index 1cbcb9f..11a3f97 100644
>> --- a/drivers/net/ethernet/hisilicon/hns/hnae.h
>> +++ b/drivers/net/ethernet/hisilicon/hns/hnae.h
> [...]
>> @@ -516,6 +518,7 @@ struct hnae_handle {
>> int q_num;
>> int vf_id;
>> u32 eport_id;
>> + u32 dport_id; /*v2 tx bd should fill the dport_id*/
>
> Please add spaces after /* and before */ (like it's done in other
> places in this driver).
>

Hi MBR, Sergei,
Thanks for you comments,
will change it in next version.
Daode.

> [...]
>> diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
>> b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
>> index 6250a42..b45dcc2 100644
>> --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
>> +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
>> @@ -69,6 +69,10 @@ static void fill_v2_desc(struct hnae_ring *ring,
>> void *priv,
>> hnae_set_bit(rrcfv, HNSV2_TXD_VLD_B, 1);
>> hnae_set_field(bn_pid, HNSV2_TXD_BUFNUM_M, 0, buf_num - 1);
>>
>> + /*fill port_id in the tx bd for sending management pkts*/
>
> Likewise.
>
>> + hnae_set_field(bn_pid, HNSV2_TXD_PORTID_M,
>> + HNSV2_TXD_PORTID_S, ring->q->handle->dport_id);
>> +
>> if (type == DESC_TYPE_SKB) {
>> skb = (struct sk_buff *)priv;
>>
>
> MBR, Sergei
>
>
> .
>


2016-03-11 01:59:46

by huangdaode

[permalink] [raw]
Subject: Re: [PATCH net 4/6] net: hns: adds uc match for debug port



On 2016/3/4 21:39, Sergei Shtylyov wrote:
> On 3/4/2016 4:09 AM, Daode Huang wrote:
>
>> This patch adds uc match for debug port by:
>> 1)Enables uc match of debug port when initializing gmac
>> 2)Enables uc match of mac address register2
>>
>> Signed-off-by: Daode Huang <[email protected]>
>> Signed-off-by: lipeng <[email protected]>
>
Lipeng is his full name. i will change it to another style (Peng Li
<[email protected]>)

> True/full name is required here.
>
>> ---
>> drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c | 18
>> +++++++++++++++++-
>> drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h | 2 ++
>> 2 files changed, 19 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
>> b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
>> index b8517b0..2591a51 100644
>> --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
>> +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
> [...]
>> @@ -407,8 +419,12 @@ static void hns_gmac_set_mac_addr(void *mac_drv,
>> char *mac_addr)
>>
>> u32 low_val = mac_addr[5] | (mac_addr[4] << 8)
>> | (mac_addr[3] << 16) | (mac_addr[2] << 24);
>> +
>> + u32 val = dsaf_read_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG);
>> + u32 sta_addr_en = dsaf_get_bit(val, GMAC_ADDR_EN_B);
>
> Empty line needed after declarations.
>

agree,
thanks
Daode.

>> dsaf_write_dev(drv, GMAC_STATION_ADDR_LOW_2_REG, low_val);
>> - dsaf_write_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG, high_val);
>> + dsaf_write_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG,
>> + high_val | (sta_addr_en << GMAC_ADDR_EN_B));
>> }
>> }
>>
> [...]
>
> MBR, Sergei
>
>
> .
>


2016-03-11 13:29:43

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH net 3/6] net: hns: fixed portid bug in sending manage pkt

Hello.

On 3/11/2016 4:53 AM, Daode Huang wrote:

>>> In V2 chip, when sending mamagement packets, the driver should
>>> config the port id to BD descs.
>>>
>>> Signed-off-by: Daode Huang <[email protected]>
>>> Signed-off-by: Lisheng <[email protected]>
>>> ---
>>> drivers/net/ethernet/hisilicon/hns/hnae.h | 3 +++
>>> drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c | 1 +
>>> drivers/net/ethernet/hisilicon/hns/hns_enet.c | 4 ++++
>>> 3 files changed, 8 insertions(+)
>>>
>>> diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.h
>>> b/drivers/net/ethernet/hisilicon/hns/hnae.h
>>> index 1cbcb9f..11a3f97 100644
>>> --- a/drivers/net/ethernet/hisilicon/hns/hnae.h
>>> +++ b/drivers/net/ethernet/hisilicon/hns/hnae.h
>> [...]
>>> @@ -516,6 +518,7 @@ struct hnae_handle {
>>> int q_num;
>>> int vf_id;
>>> u32 eport_id;
>>> + u32 dport_id; /*v2 tx bd should fill the dport_id*/
>>
>> Please add spaces after /* and before */ (like it's done in other places
>> in this driver).
>>
>
> Hi MBR, Sergei,

Just in case: MBR stands for "my best regards", Sergei is my name. :-)

> Daode.

MBR, Sergei

2016-03-14 00:46:23

by huangdaode

[permalink] [raw]
Subject: Re: [PATCH net 3/6] net: hns: fixed portid bug in sending manage pkt



On 2016/3/11 21:29, Sergei Shtylyov wrote:
> Hello.
>
> On 3/11/2016 4:53 AM, Daode Huang wrote:
>
>>>> In V2 chip, when sending mamagement packets, the driver should
>>>> config the port id to BD descs.
>>>>
>>>> Signed-off-by: Daode Huang <[email protected]>
>>>> Signed-off-by: Lisheng <[email protected]>
>>>> ---
>>>> drivers/net/ethernet/hisilicon/hns/hnae.h | 3 +++
>>>> drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c | 1 +
>>>> drivers/net/ethernet/hisilicon/hns/hns_enet.c | 4 ++++
>>>> 3 files changed, 8 insertions(+)
>>>>
>>>> diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.h
>>>> b/drivers/net/ethernet/hisilicon/hns/hnae.h
>>>> index 1cbcb9f..11a3f97 100644
>>>> --- a/drivers/net/ethernet/hisilicon/hns/hnae.h
>>>> +++ b/drivers/net/ethernet/hisilicon/hns/hnae.h
>>> [...]
>>>> @@ -516,6 +518,7 @@ struct hnae_handle {
>>>> int q_num;
>>>> int vf_id;
>>>> u32 eport_id;
>>>> + u32 dport_id; /*v2 tx bd should fill the dport_id*/
>>>
>>> Please add spaces after /* and before */ (like it's done in other
>>> places
>>> in this driver).
>>>
>>
>> Hi MBR, Sergei,
>
> Just in case: MBR stands for "my best regards", Sergei is my name. :-)
hi Sergei,

So sorry for my misunderstanding.
thanks for your reminding.

Best Regards
Daode.

>
>> Daode.
>
> MBR, Sergei
>
>
> .
>