aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYunsheng Lin <linyunsheng@huawei.com>2018-08-14 12:13:18 -0400
committerDavid S. Miller <davem@davemloft.net>2018-08-14 12:54:24 -0400
commit1c77215480bcfa0852575180f997bd156f2aef17 (patch)
tree26547b3d9ee4ac05fdf7a75a10db318a28b7a13d
parent26a07ccc1d0781fee3027e40a8bfa7a1a3358df3 (diff)
net: hns3: Set tx ring' tc info when netdev is up
The HNS3_RING_TX_RING_TC_REG register is used to map tx ring to specific tc, the tx queue to tc mapping is needed by the hardware to do the correct tx schedule. Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Salil Mehta <salil.mehta@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/hisilicon/hns3/hns3_enet.c24
-rw-r--r--drivers/net/ethernet/hisilicon/hns3/hns3_enet.h1
2 files changed, 25 insertions, 0 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index b7b9ee3f4d20..b28c7e142308 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -2974,6 +2974,28 @@ static void hns3_init_ring_hw(struct hns3_enet_ring *ring)
2974 } 2974 }
2975} 2975}
2976 2976
2977static void hns3_init_tx_ring_tc(struct hns3_nic_priv *priv)
2978{
2979 struct hnae3_knic_private_info *kinfo = &priv->ae_handle->kinfo;
2980 int i;
2981
2982 for (i = 0; i < HNAE3_MAX_TC; i++) {
2983 struct hnae3_tc_info *tc_info = &kinfo->tc_info[i];
2984 int j;
2985
2986 if (!tc_info->enable)
2987 continue;
2988
2989 for (j = 0; j < tc_info->tqp_count; j++) {
2990 struct hnae3_queue *q;
2991
2992 q = priv->ring_data[tc_info->tqp_offset + j].ring->tqp;
2993 hns3_write_dev(q, HNS3_RING_TX_RING_TC_REG,
2994 tc_info->tc);
2995 }
2996 }
2997}
2998
2977int hns3_init_all_ring(struct hns3_nic_priv *priv) 2999int hns3_init_all_ring(struct hns3_nic_priv *priv)
2978{ 3000{
2979 struct hnae3_handle *h = priv->ae_handle; 3001 struct hnae3_handle *h = priv->ae_handle;
@@ -3385,6 +3407,8 @@ int hns3_nic_reset_all_ring(struct hnae3_handle *h)
3385 rx_ring->next_to_use = 0; 3407 rx_ring->next_to_use = 0;
3386 } 3408 }
3387 3409
3410 hns3_init_tx_ring_tc(priv);
3411
3388 return 0; 3412 return 0;
3389} 3413}
3390 3414
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
index 0f071a0f4ff9..a02a96aee2a2 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
@@ -37,6 +37,7 @@ enum hns3_nic_state {
37#define HNS3_RING_TX_RING_BASEADDR_L_REG 0x00040 37#define HNS3_RING_TX_RING_BASEADDR_L_REG 0x00040
38#define HNS3_RING_TX_RING_BASEADDR_H_REG 0x00044 38#define HNS3_RING_TX_RING_BASEADDR_H_REG 0x00044
39#define HNS3_RING_TX_RING_BD_NUM_REG 0x00048 39#define HNS3_RING_TX_RING_BD_NUM_REG 0x00048
40#define HNS3_RING_TX_RING_TC_REG 0x00050
40#define HNS3_RING_TX_RING_TAIL_REG 0x00058 41#define HNS3_RING_TX_RING_TAIL_REG 0x00058
41#define HNS3_RING_TX_RING_HEAD_REG 0x0005C 42#define HNS3_RING_TX_RING_HEAD_REG 0x0005C
42#define HNS3_RING_TX_RING_FBDNUM_REG 0x00060 43#define HNS3_RING_TX_RING_FBDNUM_REG 0x00060