Skip to content

Commit 77f255c

Browse files
Yunsheng Lindavem330
authored andcommitted
net: hns3: Add some interface for the support of DCB feature
This patch add some interface and export some interface from hclge_tm and hclgc_main to support the upcoming DCB feature. Signed-off-by: Yunsheng Lin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent cc9bb43 commit 77f255c

File tree

4 files changed

+55
-5
lines changed

4 files changed

+55
-5
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#define HCLGE_64BIT_STATS_FIELD_OFF(f) (offsetof(struct hclge_64_bit_stats, f))
3131
#define HCLGE_32BIT_STATS_FIELD_OFF(f) (offsetof(struct hclge_32_bit_stats, f))
3232

33-
static int hclge_rss_init_hw(struct hclge_dev *hdev);
3433
static int hclge_set_mta_filter_mode(struct hclge_dev *hdev,
3534
enum hclge_mta_dmac_sel_type mta_mac_sel,
3635
bool enable);
@@ -2655,7 +2654,7 @@ static int hclge_get_tc_size(struct hnae3_handle *handle)
26552654
return hdev->rss_size_max;
26562655
}
26572656

2658-
static int hclge_rss_init_hw(struct hclge_dev *hdev)
2657+
int hclge_rss_init_hw(struct hclge_dev *hdev)
26592658
{
26602659
const u8 hfunc = HCLGE_RSS_HASH_ALGO_TOEPLITZ;
26612660
struct hclge_vport *vport = hdev->vport;

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,4 +515,7 @@ static inline int hclge_get_queue_id(struct hnae3_queue *queue)
515515
int hclge_cfg_mac_speed_dup(struct hclge_dev *hdev, int speed, u8 duplex);
516516
int hclge_set_vf_vlan_common(struct hclge_dev *vport, int vfid,
517517
bool is_kill, u16 vlan, u8 qos, __be16 proto);
518+
519+
int hclge_buffer_alloc(struct hclge_dev *hdev);
520+
int hclge_rss_init_hw(struct hclge_dev *hdev);
518521
#endif

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -883,10 +883,14 @@ static int hclge_tm_pri_dwrr_cfg(struct hclge_dev *hdev)
883883
return 0;
884884
}
885885

886-
static int hclge_tm_map_cfg(struct hclge_dev *hdev)
886+
int hclge_tm_map_cfg(struct hclge_dev *hdev)
887887
{
888888
int ret;
889889

890+
ret = hclge_up_to_tc_map(hdev);
891+
if (ret)
892+
return ret;
893+
890894
ret = hclge_tm_pg_to_pri_map(hdev);
891895
if (ret)
892896
return ret;
@@ -994,7 +998,7 @@ static int hclge_tm_lvl34_schd_mode_cfg(struct hclge_dev *hdev)
994998
return 0;
995999
}
9961000

997-
static int hclge_tm_schd_mode_hw(struct hclge_dev *hdev)
1001+
int hclge_tm_schd_mode_hw(struct hclge_dev *hdev)
9981002
{
9991003
int ret;
10001004

@@ -1092,7 +1096,45 @@ int hclge_pause_setup_hw(struct hclge_dev *hdev)
10921096
return ret;
10931097
}
10941098

1095-
return hclge_up_to_tc_map(hdev);
1099+
return 0;
1100+
}
1101+
1102+
int hclge_tm_prio_tc_info_update(struct hclge_dev *hdev, u8 *prio_tc)
1103+
{
1104+
struct hclge_vport *vport = hdev->vport;
1105+
struct hnae3_knic_private_info *kinfo;
1106+
u32 i, k;
1107+
1108+
for (i = 0; i < HNAE3_MAX_USER_PRIO; i++) {
1109+
if (prio_tc[i] >= hdev->tm_info.num_tc)
1110+
return -EINVAL;
1111+
hdev->tm_info.prio_tc[i] = prio_tc[i];
1112+
1113+
for (k = 0; k < hdev->num_alloc_vport; k++) {
1114+
kinfo = &vport[k].nic.kinfo;
1115+
kinfo->prio_tc[i] = prio_tc[i];
1116+
}
1117+
}
1118+
return 0;
1119+
}
1120+
1121+
void hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc)
1122+
{
1123+
u8 i, bit_map = 0;
1124+
1125+
hdev->tm_info.num_tc = num_tc;
1126+
1127+
for (i = 0; i < hdev->tm_info.num_tc; i++)
1128+
bit_map |= BIT(i);
1129+
1130+
if (!bit_map) {
1131+
bit_map = 1;
1132+
hdev->tm_info.num_tc = 1;
1133+
}
1134+
1135+
hdev->hw_tc_map = bit_map;
1136+
1137+
hclge_tm_schd_info_init(hdev);
10961138
}
10971139

10981140
int hclge_tm_init_hw(struct hclge_dev *hdev)

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,10 @@ struct hclge_port_shapping_cmd {
112112

113113
int hclge_tm_schd_init(struct hclge_dev *hdev);
114114
int hclge_pause_setup_hw(struct hclge_dev *hdev);
115+
int hclge_tm_schd_mode_hw(struct hclge_dev *hdev);
116+
int hclge_tm_prio_tc_info_update(struct hclge_dev *hdev, u8 *prio_tc);
117+
void hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc);
118+
int hclge_tm_dwrr_cfg(struct hclge_dev *hdev);
119+
int hclge_tm_map_cfg(struct hclge_dev *hdev);
120+
int hclge_tm_init_hw(struct hclge_dev *hdev);
115121
#endif

0 commit comments

Comments
 (0)