| .. | .. |
|---|
| 1 | | -// SPDX-License-Identifier: GPL-2.0+ |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0+ */ |
|---|
| 2 | 2 | // Copyright (c) 2016-2017 Hisilicon Limited. |
|---|
| 3 | 3 | |
|---|
| 4 | 4 | #ifndef __HCLGE_TM_H |
|---|
| .. | .. |
|---|
| 12 | 12 | |
|---|
| 13 | 13 | #define HCLGE_TM_PORT_BASE_MODE_MSK BIT(0) |
|---|
| 14 | 14 | |
|---|
| 15 | | -#define HCLGE_DEFAULT_PAUSE_TRANS_GAP 0xFF |
|---|
| 15 | +#define HCLGE_DEFAULT_PAUSE_TRANS_GAP 0x7F |
|---|
| 16 | 16 | #define HCLGE_DEFAULT_PAUSE_TRANS_TIME 0xFFFF |
|---|
| 17 | 17 | |
|---|
| 18 | 18 | /* SP or DWRR */ |
|---|
| 19 | 19 | #define HCLGE_TM_TX_SCHD_DWRR_MSK BIT(0) |
|---|
| 20 | 20 | #define HCLGE_TM_TX_SCHD_SP_MSK (0xFE) |
|---|
| 21 | + |
|---|
| 22 | +#define HCLGE_ETHER_MAX_RATE 100000 |
|---|
| 21 | 23 | |
|---|
| 22 | 24 | struct hclge_pg_to_pri_link_cmd { |
|---|
| 23 | 25 | u8 pg_id; |
|---|
| .. | .. |
|---|
| 40 | 42 | __le16 qset_id; |
|---|
| 41 | 43 | }; |
|---|
| 42 | 44 | |
|---|
| 45 | +struct hclge_tqp_tx_queue_tc_cmd { |
|---|
| 46 | + __le16 queue_id; |
|---|
| 47 | + __le16 rsvd; |
|---|
| 48 | + u8 tc_id; |
|---|
| 49 | + u8 rev[3]; |
|---|
| 50 | +}; |
|---|
| 51 | + |
|---|
| 43 | 52 | struct hclge_pg_weight_cmd { |
|---|
| 44 | 53 | u8 pg_id; |
|---|
| 45 | 54 | u8 dwrr; |
|---|
| .. | .. |
|---|
| 53 | 62 | struct hclge_qs_weight_cmd { |
|---|
| 54 | 63 | __le16 qs_id; |
|---|
| 55 | 64 | u8 dwrr; |
|---|
| 65 | +}; |
|---|
| 66 | + |
|---|
| 67 | +struct hclge_ets_tc_weight_cmd { |
|---|
| 68 | + u8 tc_weight[HNAE3_MAX_TC]; |
|---|
| 69 | + u8 weight_offset; |
|---|
| 70 | + u8 rsvd[15]; |
|---|
| 56 | 71 | }; |
|---|
| 57 | 72 | |
|---|
| 58 | 73 | #define HCLGE_TM_SHAP_IR_B_MSK GENMASK(7, 0) |
|---|
| .. | .. |
|---|
| 83 | 98 | __le32 pg_shapping_para; |
|---|
| 84 | 99 | }; |
|---|
| 85 | 100 | |
|---|
| 101 | +struct hclge_qs_shapping_cmd { |
|---|
| 102 | + __le16 qs_id; |
|---|
| 103 | + u8 rsvd[2]; |
|---|
| 104 | + __le32 qs_shapping_para; |
|---|
| 105 | +}; |
|---|
| 106 | + |
|---|
| 86 | 107 | #define HCLGE_BP_GRP_NUM 32 |
|---|
| 87 | 108 | #define HCLGE_BP_SUB_GRP_ID_S 0 |
|---|
| 88 | 109 | #define HCLGE_BP_SUB_GRP_ID_M GENMASK(4, 0) |
|---|
| .. | .. |
|---|
| 106 | 127 | u8 pause_trans_gap; |
|---|
| 107 | 128 | u8 rsvd; |
|---|
| 108 | 129 | __le16 pause_trans_time; |
|---|
| 130 | + u8 rsvd1[6]; |
|---|
| 131 | + /* extra mac address to do double check for pause frame */ |
|---|
| 132 | + u8 mac_addr_extra[ETH_ALEN]; |
|---|
| 133 | + u16 rsvd2; |
|---|
| 109 | 134 | }; |
|---|
| 110 | 135 | |
|---|
| 111 | 136 | struct hclge_pfc_stats_cmd { |
|---|
| .. | .. |
|---|
| 114 | 139 | |
|---|
| 115 | 140 | struct hclge_port_shapping_cmd { |
|---|
| 116 | 141 | __le32 port_shapping_para; |
|---|
| 142 | +}; |
|---|
| 143 | + |
|---|
| 144 | +struct hclge_shaper_ir_para { |
|---|
| 145 | + u8 ir_b; /* IR_B parameter of IR shaper */ |
|---|
| 146 | + u8 ir_u; /* IR_U parameter of IR shaper */ |
|---|
| 147 | + u8 ir_s; /* IR_S parameter of IR shaper */ |
|---|
| 117 | 148 | }; |
|---|
| 118 | 149 | |
|---|
| 119 | 150 | #define hclge_tm_set_field(dest, string, val) \ |
|---|
| .. | .. |
|---|
| 125 | 156 | (HCLGE_TM_SHAP_##string##_LSH)) |
|---|
| 126 | 157 | |
|---|
| 127 | 158 | int hclge_tm_schd_init(struct hclge_dev *hdev); |
|---|
| 128 | | -int hclge_pause_setup_hw(struct hclge_dev *hdev); |
|---|
| 129 | | -int hclge_tm_schd_mode_hw(struct hclge_dev *hdev); |
|---|
| 130 | | -int hclge_tm_prio_tc_info_update(struct hclge_dev *hdev, u8 *prio_tc); |
|---|
| 159 | +int hclge_tm_vport_map_update(struct hclge_dev *hdev); |
|---|
| 160 | +int hclge_pause_setup_hw(struct hclge_dev *hdev, bool init); |
|---|
| 161 | +int hclge_tm_schd_setup_hw(struct hclge_dev *hdev); |
|---|
| 162 | +void hclge_tm_prio_tc_info_update(struct hclge_dev *hdev, u8 *prio_tc); |
|---|
| 131 | 163 | void hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc); |
|---|
| 164 | +void hclge_tm_pfc_info_update(struct hclge_dev *hdev); |
|---|
| 132 | 165 | int hclge_tm_dwrr_cfg(struct hclge_dev *hdev); |
|---|
| 133 | | -int hclge_tm_map_cfg(struct hclge_dev *hdev); |
|---|
| 134 | | -int hclge_tm_init_hw(struct hclge_dev *hdev); |
|---|
| 166 | +int hclge_tm_init_hw(struct hclge_dev *hdev, bool init); |
|---|
| 135 | 167 | int hclge_mac_pause_en_cfg(struct hclge_dev *hdev, bool tx, bool rx); |
|---|
| 136 | 168 | int hclge_pause_addr_cfg(struct hclge_dev *hdev, const u8 *mac_addr); |
|---|
| 137 | 169 | int hclge_pfc_rx_stats_get(struct hclge_dev *hdev, u64 *stats); |
|---|
| 138 | 170 | int hclge_pfc_tx_stats_get(struct hclge_dev *hdev, u64 *stats); |
|---|
| 171 | +int hclge_tm_qs_shaper_cfg(struct hclge_vport *vport, int max_tx_rate); |
|---|
| 172 | + |
|---|
| 139 | 173 | #endif |
|---|