12874c5fdSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
2511e6bc0Shuangdaode /*
3511e6bc0Shuangdaode * Copyright (c) 2014-2015 Hisilicon Limited.
4511e6bc0Shuangdaode */
5511e6bc0Shuangdaode
6511e6bc0Shuangdaode #include <linux/module.h>
7511e6bc0Shuangdaode #include <linux/kernel.h>
8511e6bc0Shuangdaode #include <linux/init.h>
9511e6bc0Shuangdaode #include <linux/netdevice.h>
10511e6bc0Shuangdaode #include <linux/etherdevice.h>
11511e6bc0Shuangdaode #include <linux/platform_device.h>
12511e6bc0Shuangdaode
13511e6bc0Shuangdaode #include "hns_dsaf_ppe.h"
14511e6bc0Shuangdaode
hns_ppe_set_tso_enable(struct hns_ppe_cb * ppe_cb,u32 value)1564353af6SSalil void hns_ppe_set_tso_enable(struct hns_ppe_cb *ppe_cb, u32 value)
1664353af6SSalil {
1764353af6SSalil dsaf_set_dev_bit(ppe_cb, PPEV2_CFG_TSO_EN_REG, 0, !!value);
1864353af6SSalil }
1964353af6SSalil
hns_ppe_set_rss_key(struct hns_ppe_cb * ppe_cb,const u32 rss_key[HNS_PPEV2_RSS_KEY_NUM])206bc0ce7dSSalil void hns_ppe_set_rss_key(struct hns_ppe_cb *ppe_cb,
216bc0ce7dSSalil const u32 rss_key[HNS_PPEV2_RSS_KEY_NUM])
226bc0ce7dSSalil {
23beecfe9eSKejian Yan u32 key_item;
246bc0ce7dSSalil
256bc0ce7dSSalil for (key_item = 0; key_item < HNS_PPEV2_RSS_KEY_NUM; key_item++)
266bc0ce7dSSalil dsaf_write_dev(ppe_cb, PPEV2_RSS_KEY_REG + key_item * 0x4,
276bc0ce7dSSalil rss_key[key_item]);
286bc0ce7dSSalil }
296bc0ce7dSSalil
hns_ppe_set_indir_table(struct hns_ppe_cb * ppe_cb,const u32 rss_tab[HNS_PPEV2_RSS_IND_TBL_SIZE])306bc0ce7dSSalil void hns_ppe_set_indir_table(struct hns_ppe_cb *ppe_cb,
316bc0ce7dSSalil const u32 rss_tab[HNS_PPEV2_RSS_IND_TBL_SIZE])
326bc0ce7dSSalil {
336bc0ce7dSSalil int i;
346bc0ce7dSSalil int reg_value;
356bc0ce7dSSalil
366bc0ce7dSSalil for (i = 0; i < (HNS_PPEV2_RSS_IND_TBL_SIZE / 4); i++) {
376bc0ce7dSSalil reg_value = dsaf_read_dev(ppe_cb,
386bc0ce7dSSalil PPEV2_INDRECTION_TBL_REG + i * 0x4);
396bc0ce7dSSalil
406bc0ce7dSSalil dsaf_set_field(reg_value, PPEV2_CFG_RSS_TBL_4N0_M,
416bc0ce7dSSalil PPEV2_CFG_RSS_TBL_4N0_S,
426bc0ce7dSSalil rss_tab[i * 4 + 0] & 0x1F);
436bc0ce7dSSalil dsaf_set_field(reg_value, PPEV2_CFG_RSS_TBL_4N1_M,
446bc0ce7dSSalil PPEV2_CFG_RSS_TBL_4N1_S,
456bc0ce7dSSalil rss_tab[i * 4 + 1] & 0x1F);
466bc0ce7dSSalil dsaf_set_field(reg_value, PPEV2_CFG_RSS_TBL_4N2_M,
476bc0ce7dSSalil PPEV2_CFG_RSS_TBL_4N2_S,
486bc0ce7dSSalil rss_tab[i * 4 + 2] & 0x1F);
496bc0ce7dSSalil dsaf_set_field(reg_value, PPEV2_CFG_RSS_TBL_4N3_M,
506bc0ce7dSSalil PPEV2_CFG_RSS_TBL_4N3_S,
516bc0ce7dSSalil rss_tab[i * 4 + 3] & 0x1F);
526bc0ce7dSSalil dsaf_write_dev(
536bc0ce7dSSalil ppe_cb, PPEV2_INDRECTION_TBL_REG + i * 0x4, reg_value);
546bc0ce7dSSalil }
556bc0ce7dSSalil }
566bc0ce7dSSalil
5715400663SYonglong Liu static u8 __iomem *
hns_ppe_common_get_ioaddr(struct ppe_common_cb * ppe_common)58831d828bSYisen.Zhuang\(Zhuangyuzeng\) hns_ppe_common_get_ioaddr(struct ppe_common_cb *ppe_common)
59511e6bc0Shuangdaode {
60831d828bSYisen.Zhuang\(Zhuangyuzeng\) return ppe_common->dsaf_dev->ppe_base + PPE_COMMON_REG_OFFSET;
61511e6bc0Shuangdaode }
62511e6bc0Shuangdaode
63511e6bc0Shuangdaode /**
64511e6bc0Shuangdaode * hns_ppe_common_get_cfg - get ppe common config
65511e6bc0Shuangdaode * @dsaf_dev: dasf device
66d0ea5cbdSJesse Brandeburg * @comm_index: common index
67d0ea5cbdSJesse Brandeburg * return 0 - success , negative --fail
68511e6bc0Shuangdaode */
hns_ppe_common_get_cfg(struct dsaf_device * dsaf_dev,int comm_index)69336a443bSYueHaibing static int hns_ppe_common_get_cfg(struct dsaf_device *dsaf_dev, int comm_index)
70511e6bc0Shuangdaode {
71511e6bc0Shuangdaode struct ppe_common_cb *ppe_common;
72511e6bc0Shuangdaode int ppe_num;
73511e6bc0Shuangdaode
7489a44093SYisen.Zhuang\(Zhuangyuzeng\) if (!HNS_DSAF_IS_DEBUG(dsaf_dev))
75511e6bc0Shuangdaode ppe_num = HNS_PPE_SERVICE_NW_ENGINE_NUM;
76511e6bc0Shuangdaode else
77511e6bc0Shuangdaode ppe_num = HNS_PPE_DEBUG_NW_ENGINE_NUM;
78511e6bc0Shuangdaode
79d89ea4acSGustavo A. R. Silva ppe_common = devm_kzalloc(dsaf_dev->dev,
80d89ea4acSGustavo A. R. Silva struct_size(ppe_common, ppe_cb, ppe_num),
81d89ea4acSGustavo A. R. Silva GFP_KERNEL);
82511e6bc0Shuangdaode if (!ppe_common)
83511e6bc0Shuangdaode return -ENOMEM;
84511e6bc0Shuangdaode
85511e6bc0Shuangdaode ppe_common->ppe_num = ppe_num;
86511e6bc0Shuangdaode ppe_common->dsaf_dev = dsaf_dev;
87511e6bc0Shuangdaode ppe_common->comm_index = comm_index;
8889a44093SYisen.Zhuang\(Zhuangyuzeng\) if (!HNS_DSAF_IS_DEBUG(dsaf_dev))
89511e6bc0Shuangdaode ppe_common->ppe_mode = PPE_COMMON_MODE_SERVICE;
90511e6bc0Shuangdaode else
91511e6bc0Shuangdaode ppe_common->ppe_mode = PPE_COMMON_MODE_DEBUG;
92511e6bc0Shuangdaode ppe_common->dev = dsaf_dev->dev;
93511e6bc0Shuangdaode
94511e6bc0Shuangdaode ppe_common->io_base = hns_ppe_common_get_ioaddr(ppe_common);
95511e6bc0Shuangdaode
96511e6bc0Shuangdaode dsaf_dev->ppe_common[comm_index] = ppe_common;
97511e6bc0Shuangdaode
98511e6bc0Shuangdaode return 0;
99511e6bc0Shuangdaode }
100511e6bc0Shuangdaode
101336a443bSYueHaibing static void
hns_ppe_common_free_cfg(struct dsaf_device * dsaf_dev,u32 comm_index)102336a443bSYueHaibing hns_ppe_common_free_cfg(struct dsaf_device *dsaf_dev, u32 comm_index)
103511e6bc0Shuangdaode {
104511e6bc0Shuangdaode dsaf_dev->ppe_common[comm_index] = NULL;
105511e6bc0Shuangdaode }
106511e6bc0Shuangdaode
hns_ppe_get_iobase(struct ppe_common_cb * ppe_common,int ppe_idx)10715400663SYonglong Liu static u8 __iomem *hns_ppe_get_iobase(struct ppe_common_cb *ppe_common,
108511e6bc0Shuangdaode int ppe_idx)
109511e6bc0Shuangdaode {
110831d828bSYisen.Zhuang\(Zhuangyuzeng\) return ppe_common->dsaf_dev->ppe_base + ppe_idx * PPE_REG_OFFSET;
111511e6bc0Shuangdaode }
112511e6bc0Shuangdaode
hns_ppe_get_cfg(struct ppe_common_cb * ppe_common)113511e6bc0Shuangdaode static void hns_ppe_get_cfg(struct ppe_common_cb *ppe_common)
114511e6bc0Shuangdaode {
115511e6bc0Shuangdaode u32 i;
116511e6bc0Shuangdaode struct hns_ppe_cb *ppe_cb;
117511e6bc0Shuangdaode u32 ppe_num = ppe_common->ppe_num;
118511e6bc0Shuangdaode
119511e6bc0Shuangdaode for (i = 0; i < ppe_num; i++) {
120511e6bc0Shuangdaode ppe_cb = &ppe_common->ppe_cb[i];
121511e6bc0Shuangdaode ppe_cb->dev = ppe_common->dev;
122511e6bc0Shuangdaode ppe_cb->next = NULL;
123511e6bc0Shuangdaode ppe_cb->ppe_common_cb = ppe_common;
124511e6bc0Shuangdaode ppe_cb->index = i;
125511e6bc0Shuangdaode ppe_cb->io_base = hns_ppe_get_iobase(ppe_common, i);
126511e6bc0Shuangdaode ppe_cb->virq = 0;
127511e6bc0Shuangdaode }
128511e6bc0Shuangdaode }
129511e6bc0Shuangdaode
hns_ppe_cnt_clr_ce(struct hns_ppe_cb * ppe_cb)130511e6bc0Shuangdaode static void hns_ppe_cnt_clr_ce(struct hns_ppe_cb *ppe_cb)
131511e6bc0Shuangdaode {
132511e6bc0Shuangdaode dsaf_set_dev_bit(ppe_cb, PPE_TNL_0_5_CNT_CLR_CE_REG,
133511e6bc0Shuangdaode PPE_CNT_CLR_CE_B, 1);
134511e6bc0Shuangdaode }
135511e6bc0Shuangdaode
hns_ppe_set_vlan_strip(struct hns_ppe_cb * ppe_cb,int en)1368044f97eSSalil static void hns_ppe_set_vlan_strip(struct hns_ppe_cb *ppe_cb, int en)
1378044f97eSSalil {
1388044f97eSSalil dsaf_write_dev(ppe_cb, PPEV2_VLAN_STRIP_EN_REG, en);
1398044f97eSSalil }
1408044f97eSSalil
141511e6bc0Shuangdaode /**
142511e6bc0Shuangdaode * hns_ppe_checksum_hw - set ppe checksum caculate
143d0ea5cbdSJesse Brandeburg * @ppe_cb: ppe device
144511e6bc0Shuangdaode * @value: value
145511e6bc0Shuangdaode */
hns_ppe_checksum_hw(struct hns_ppe_cb * ppe_cb,u32 value)146511e6bc0Shuangdaode static void hns_ppe_checksum_hw(struct hns_ppe_cb *ppe_cb, u32 value)
147511e6bc0Shuangdaode {
148511e6bc0Shuangdaode dsaf_set_dev_field(ppe_cb, PPE_CFG_PRO_CHECK_EN_REG,
149511e6bc0Shuangdaode 0xfffffff, 0, value);
150511e6bc0Shuangdaode }
151511e6bc0Shuangdaode
hns_ppe_set_qid_mode(struct ppe_common_cb * ppe_common,enum ppe_qid_mode qid_mdoe)152511e6bc0Shuangdaode static void hns_ppe_set_qid_mode(struct ppe_common_cb *ppe_common,
153511e6bc0Shuangdaode enum ppe_qid_mode qid_mdoe)
154511e6bc0Shuangdaode {
155511e6bc0Shuangdaode dsaf_set_dev_field(ppe_common, PPE_COM_CFG_QID_MODE_REG,
156511e6bc0Shuangdaode PPE_CFG_QID_MODE_CF_QID_MODE_M,
157511e6bc0Shuangdaode PPE_CFG_QID_MODE_CF_QID_MODE_S, qid_mdoe);
158511e6bc0Shuangdaode }
159511e6bc0Shuangdaode
160511e6bc0Shuangdaode /**
161511e6bc0Shuangdaode * hns_ppe_set_qid - set ppe qid
162511e6bc0Shuangdaode * @ppe_common: ppe common device
163511e6bc0Shuangdaode * @qid: queue id
164511e6bc0Shuangdaode */
hns_ppe_set_qid(struct ppe_common_cb * ppe_common,u32 qid)165511e6bc0Shuangdaode static void hns_ppe_set_qid(struct ppe_common_cb *ppe_common, u32 qid)
166511e6bc0Shuangdaode {
167511e6bc0Shuangdaode u32 qid_mod = dsaf_read_dev(ppe_common, PPE_COM_CFG_QID_MODE_REG);
168511e6bc0Shuangdaode
169511e6bc0Shuangdaode if (!dsaf_get_field(qid_mod, PPE_CFG_QID_MODE_DEF_QID_M,
170511e6bc0Shuangdaode PPE_CFG_QID_MODE_DEF_QID_S)) {
171511e6bc0Shuangdaode dsaf_set_field(qid_mod, PPE_CFG_QID_MODE_DEF_QID_M,
172511e6bc0Shuangdaode PPE_CFG_QID_MODE_DEF_QID_S, qid);
173511e6bc0Shuangdaode dsaf_write_dev(ppe_common, PPE_COM_CFG_QID_MODE_REG, qid_mod);
174511e6bc0Shuangdaode }
175511e6bc0Shuangdaode }
176511e6bc0Shuangdaode
177511e6bc0Shuangdaode /**
178511e6bc0Shuangdaode * hns_ppe_set_port_mode - set port mode
179d0ea5cbdSJesse Brandeburg * @ppe_cb: ppe device
180511e6bc0Shuangdaode * @mode: port mode
181511e6bc0Shuangdaode */
hns_ppe_set_port_mode(struct hns_ppe_cb * ppe_cb,enum ppe_port_mode mode)182511e6bc0Shuangdaode static void hns_ppe_set_port_mode(struct hns_ppe_cb *ppe_cb,
183511e6bc0Shuangdaode enum ppe_port_mode mode)
184511e6bc0Shuangdaode {
185511e6bc0Shuangdaode dsaf_write_dev(ppe_cb, PPE_CFG_XGE_MODE_REG, mode);
186511e6bc0Shuangdaode }
187511e6bc0Shuangdaode
188511e6bc0Shuangdaode /**
189511e6bc0Shuangdaode * hns_ppe_common_init_hw - init ppe common device
190511e6bc0Shuangdaode * @ppe_common: ppe common device
191511e6bc0Shuangdaode *
192511e6bc0Shuangdaode * Return 0 on success, negative on failure
193511e6bc0Shuangdaode */
hns_ppe_common_init_hw(struct ppe_common_cb * ppe_common)194511e6bc0Shuangdaode static int hns_ppe_common_init_hw(struct ppe_common_cb *ppe_common)
195511e6bc0Shuangdaode {
196511e6bc0Shuangdaode enum ppe_qid_mode qid_mode;
197a24274aaSKejian Yan struct dsaf_device *dsaf_dev = ppe_common->dsaf_dev;
198a24274aaSKejian Yan enum dsaf_mode dsaf_mode = dsaf_dev->dsaf_mode;
199511e6bc0Shuangdaode
200a24274aaSKejian Yan dsaf_dev->misc_op->ppe_comm_srst(dsaf_dev, 0);
20189036f23SJia-Ju Bai msleep(100);
202a24274aaSKejian Yan dsaf_dev->misc_op->ppe_comm_srst(dsaf_dev, 1);
20389036f23SJia-Ju Bai msleep(100);
204511e6bc0Shuangdaode
205511e6bc0Shuangdaode if (ppe_common->ppe_mode == PPE_COMMON_MODE_SERVICE) {
206511e6bc0Shuangdaode switch (dsaf_mode) {
207511e6bc0Shuangdaode case DSAF_MODE_ENABLE_FIX:
208511e6bc0Shuangdaode case DSAF_MODE_DISABLE_FIX:
209511e6bc0Shuangdaode qid_mode = PPE_QID_MODE0;
210511e6bc0Shuangdaode hns_ppe_set_qid(ppe_common, 0);
211511e6bc0Shuangdaode break;
212511e6bc0Shuangdaode case DSAF_MODE_ENABLE_0VM:
213511e6bc0Shuangdaode case DSAF_MODE_DISABLE_2PORT_64VM:
214511e6bc0Shuangdaode qid_mode = PPE_QID_MODE3;
215511e6bc0Shuangdaode break;
216511e6bc0Shuangdaode case DSAF_MODE_ENABLE_8VM:
217511e6bc0Shuangdaode case DSAF_MODE_DISABLE_2PORT_16VM:
218511e6bc0Shuangdaode qid_mode = PPE_QID_MODE4;
219511e6bc0Shuangdaode break;
220511e6bc0Shuangdaode case DSAF_MODE_ENABLE_16VM:
221511e6bc0Shuangdaode case DSAF_MODE_DISABLE_6PORT_0VM:
222511e6bc0Shuangdaode qid_mode = PPE_QID_MODE5;
223511e6bc0Shuangdaode break;
224511e6bc0Shuangdaode case DSAF_MODE_ENABLE_32VM:
225511e6bc0Shuangdaode case DSAF_MODE_DISABLE_6PORT_16VM:
226511e6bc0Shuangdaode qid_mode = PPE_QID_MODE2;
227511e6bc0Shuangdaode break;
228511e6bc0Shuangdaode case DSAF_MODE_ENABLE_128VM:
229511e6bc0Shuangdaode case DSAF_MODE_DISABLE_6PORT_4VM:
230511e6bc0Shuangdaode qid_mode = PPE_QID_MODE1;
231511e6bc0Shuangdaode break;
232511e6bc0Shuangdaode case DSAF_MODE_DISABLE_2PORT_8VM:
233511e6bc0Shuangdaode qid_mode = PPE_QID_MODE7;
234511e6bc0Shuangdaode break;
235511e6bc0Shuangdaode case DSAF_MODE_DISABLE_6PORT_2VM:
236511e6bc0Shuangdaode qid_mode = PPE_QID_MODE6;
237511e6bc0Shuangdaode break;
238511e6bc0Shuangdaode default:
239511e6bc0Shuangdaode dev_err(ppe_common->dev,
240511e6bc0Shuangdaode "get ppe queue mode failed! dsaf_mode=%d\n",
241511e6bc0Shuangdaode dsaf_mode);
242511e6bc0Shuangdaode return -EINVAL;
243511e6bc0Shuangdaode }
244511e6bc0Shuangdaode hns_ppe_set_qid_mode(ppe_common, qid_mode);
245511e6bc0Shuangdaode }
246511e6bc0Shuangdaode
247511e6bc0Shuangdaode dsaf_set_dev_bit(ppe_common, PPE_COM_COMMON_CNT_CLR_CE_REG,
248511e6bc0Shuangdaode PPE_COMMON_CNT_CLR_CE_B, 1);
249511e6bc0Shuangdaode
250511e6bc0Shuangdaode return 0;
251511e6bc0Shuangdaode }
252511e6bc0Shuangdaode
253511e6bc0Shuangdaode /*clr ppe exception irq*/
hns_ppe_exc_irq_en(struct hns_ppe_cb * ppe_cb,int en)254511e6bc0Shuangdaode static void hns_ppe_exc_irq_en(struct hns_ppe_cb *ppe_cb, int en)
255511e6bc0Shuangdaode {
256511e6bc0Shuangdaode u32 clr_vlue = 0xfffffffful;
257511e6bc0Shuangdaode u32 msk_vlue = en ? 0xfffffffful : 0; /*1 is en, 0 is dis*/
258511e6bc0Shuangdaode u32 vld_msk = 0;
259511e6bc0Shuangdaode
260511e6bc0Shuangdaode /*only care bit 0,1,7*/
261511e6bc0Shuangdaode dsaf_set_bit(vld_msk, 0, 1);
262511e6bc0Shuangdaode dsaf_set_bit(vld_msk, 1, 1);
263511e6bc0Shuangdaode dsaf_set_bit(vld_msk, 7, 1);
264511e6bc0Shuangdaode
265511e6bc0Shuangdaode /*clr sts**/
266511e6bc0Shuangdaode dsaf_write_dev(ppe_cb, PPE_RINT_REG, clr_vlue);
267511e6bc0Shuangdaode
268511e6bc0Shuangdaode /*for some reserved bits, so set 0**/
269511e6bc0Shuangdaode dsaf_write_dev(ppe_cb, PPE_INTEN_REG, msk_vlue & vld_msk);
270511e6bc0Shuangdaode }
271511e6bc0Shuangdaode
hns_ppe_wait_tx_fifo_clean(struct hns_ppe_cb * ppe_cb)27231fabbeeSPeng Li int hns_ppe_wait_tx_fifo_clean(struct hns_ppe_cb *ppe_cb)
27331fabbeeSPeng Li {
27431fabbeeSPeng Li int wait_cnt;
27531fabbeeSPeng Li u32 val;
27631fabbeeSPeng Li
27731fabbeeSPeng Li wait_cnt = 0;
27831fabbeeSPeng Li while (wait_cnt++ < HNS_MAX_WAIT_CNT) {
27931fabbeeSPeng Li val = dsaf_read_dev(ppe_cb, PPE_CURR_TX_FIFO0_REG) & 0x3ffU;
28031fabbeeSPeng Li if (!val)
28131fabbeeSPeng Li break;
28231fabbeeSPeng Li
28331fabbeeSPeng Li usleep_range(100, 200);
28431fabbeeSPeng Li }
28531fabbeeSPeng Li
28631fabbeeSPeng Li if (wait_cnt >= HNS_MAX_WAIT_CNT) {
28731fabbeeSPeng Li dev_err(ppe_cb->dev, "hns ppe tx fifo clean wait timeout, still has %u pkt.\n",
28831fabbeeSPeng Li val);
28931fabbeeSPeng Li return -EBUSY;
29031fabbeeSPeng Li }
29131fabbeeSPeng Li
29231fabbeeSPeng Li return 0;
29331fabbeeSPeng Li }
29431fabbeeSPeng Li
295511e6bc0Shuangdaode /**
296*5a9594cfSYang Shen * hns_ppe_init_hw - init ppe
2976bc0ce7dSSalil * @ppe_cb: ppe device
298511e6bc0Shuangdaode */
hns_ppe_init_hw(struct hns_ppe_cb * ppe_cb)299511e6bc0Shuangdaode static void hns_ppe_init_hw(struct hns_ppe_cb *ppe_cb)
300511e6bc0Shuangdaode {
301511e6bc0Shuangdaode struct ppe_common_cb *ppe_common_cb = ppe_cb->ppe_common_cb;
302831d828bSYisen.Zhuang\(Zhuangyuzeng\) u32 port = ppe_cb->index;
303511e6bc0Shuangdaode struct dsaf_device *dsaf_dev = ppe_common_cb->dsaf_dev;
3046bc0ce7dSSalil int i;
3056bc0ce7dSSalil
3066bc0ce7dSSalil /* get default RSS key */
3076bc0ce7dSSalil netdev_rss_key_fill(ppe_cb->rss_key, HNS_PPEV2_RSS_KEY_SIZE);
308511e6bc0Shuangdaode
309a24274aaSKejian Yan dsaf_dev->misc_op->ppe_srst(dsaf_dev, port, 0);
310511e6bc0Shuangdaode mdelay(10);
311a24274aaSKejian Yan dsaf_dev->misc_op->ppe_srst(dsaf_dev, port, 1);
312511e6bc0Shuangdaode
313511e6bc0Shuangdaode /* clr and msk except irq*/
314511e6bc0Shuangdaode hns_ppe_exc_irq_en(ppe_cb, 0);
315511e6bc0Shuangdaode
3165ada37b5SLisheng if (ppe_common_cb->ppe_mode == PPE_COMMON_MODE_DEBUG) {
317511e6bc0Shuangdaode hns_ppe_set_port_mode(ppe_cb, PPE_MODE_GE);
3185ada37b5SLisheng dsaf_write_dev(ppe_cb, PPE_CFG_PAUSE_IDLE_CNT_REG, 0);
3195ada37b5SLisheng } else {
320511e6bc0Shuangdaode hns_ppe_set_port_mode(ppe_cb, PPE_MODE_XGE);
3215ada37b5SLisheng }
3226bc0ce7dSSalil
323511e6bc0Shuangdaode hns_ppe_checksum_hw(ppe_cb, 0xffffffff);
324511e6bc0Shuangdaode hns_ppe_cnt_clr_ce(ppe_cb);
3256bc0ce7dSSalil
3266bc0ce7dSSalil if (!AE_IS_VER1(dsaf_dev->dsaf_ver)) {
3278044f97eSSalil hns_ppe_set_vlan_strip(ppe_cb, 0);
3288044f97eSSalil
329da3488bbSKejian Yan dsaf_write_dev(ppe_cb, PPE_CFG_MAX_FRAME_LEN_REG,
330da3488bbSKejian Yan HNS_PPEV2_MAX_FRAME_LEN);
331da3488bbSKejian Yan
3326bc0ce7dSSalil /* set default RSS key in h/w */
3336bc0ce7dSSalil hns_ppe_set_rss_key(ppe_cb, ppe_cb->rss_key);
3346bc0ce7dSSalil
3356bc0ce7dSSalil /* Set default indrection table in h/w */
3366bc0ce7dSSalil for (i = 0; i < HNS_PPEV2_RSS_IND_TBL_SIZE; i++)
3376bc0ce7dSSalil ppe_cb->rss_indir_table[i] = i;
3386bc0ce7dSSalil hns_ppe_set_indir_table(ppe_cb, ppe_cb->rss_indir_table);
3396bc0ce7dSSalil }
340511e6bc0Shuangdaode }
341511e6bc0Shuangdaode
342511e6bc0Shuangdaode /**
343*5a9594cfSYang Shen * hns_ppe_uninit_hw - uninit ppe
344d0ea5cbdSJesse Brandeburg * @ppe_cb: ppe device
345511e6bc0Shuangdaode */
hns_ppe_uninit_hw(struct hns_ppe_cb * ppe_cb)346511e6bc0Shuangdaode static void hns_ppe_uninit_hw(struct hns_ppe_cb *ppe_cb)
347511e6bc0Shuangdaode {
348511e6bc0Shuangdaode u32 port;
349511e6bc0Shuangdaode
350511e6bc0Shuangdaode if (ppe_cb->ppe_common_cb) {
351c234af58SColin Ian King struct dsaf_device *dsaf_dev = ppe_cb->ppe_common_cb->dsaf_dev;
352c234af58SColin Ian King
353511e6bc0Shuangdaode port = ppe_cb->index;
354a24274aaSKejian Yan dsaf_dev->misc_op->ppe_srst(dsaf_dev, port, 0);
355511e6bc0Shuangdaode }
356511e6bc0Shuangdaode }
357511e6bc0Shuangdaode
hns_ppe_uninit_ex(struct ppe_common_cb * ppe_common)358336a443bSYueHaibing static void hns_ppe_uninit_ex(struct ppe_common_cb *ppe_common)
359511e6bc0Shuangdaode {
360511e6bc0Shuangdaode u32 i;
361511e6bc0Shuangdaode
362511e6bc0Shuangdaode for (i = 0; i < ppe_common->ppe_num; i++) {
363831d828bSYisen.Zhuang\(Zhuangyuzeng\) if (ppe_common->dsaf_dev->mac_cb[i])
364511e6bc0Shuangdaode hns_ppe_uninit_hw(&ppe_common->ppe_cb[i]);
365511e6bc0Shuangdaode memset(&ppe_common->ppe_cb[i], 0, sizeof(struct hns_ppe_cb));
366511e6bc0Shuangdaode }
367511e6bc0Shuangdaode }
368511e6bc0Shuangdaode
hns_ppe_uninit(struct dsaf_device * dsaf_dev)369511e6bc0Shuangdaode void hns_ppe_uninit(struct dsaf_device *dsaf_dev)
370511e6bc0Shuangdaode {
371511e6bc0Shuangdaode u32 i;
372511e6bc0Shuangdaode
373511e6bc0Shuangdaode for (i = 0; i < HNS_PPE_COM_NUM; i++) {
374511e6bc0Shuangdaode if (dsaf_dev->ppe_common[i])
375511e6bc0Shuangdaode hns_ppe_uninit_ex(dsaf_dev->ppe_common[i]);
376511e6bc0Shuangdaode hns_rcb_common_free_cfg(dsaf_dev, i);
377511e6bc0Shuangdaode hns_ppe_common_free_cfg(dsaf_dev, i);
378511e6bc0Shuangdaode }
379511e6bc0Shuangdaode }
380511e6bc0Shuangdaode
381511e6bc0Shuangdaode /**
382*5a9594cfSYang Shen * hns_ppe_reset_common - reinit ppe/rcb hw
383511e6bc0Shuangdaode * @dsaf_dev: dasf device
384d0ea5cbdSJesse Brandeburg * @ppe_common_index: the index
385d0ea5cbdSJesse Brandeburg * return void
386511e6bc0Shuangdaode */
hns_ppe_reset_common(struct dsaf_device * dsaf_dev,u8 ppe_common_index)387511e6bc0Shuangdaode void hns_ppe_reset_common(struct dsaf_device *dsaf_dev, u8 ppe_common_index)
388511e6bc0Shuangdaode {
389511e6bc0Shuangdaode u32 i;
390511e6bc0Shuangdaode int ret;
391511e6bc0Shuangdaode struct ppe_common_cb *ppe_common;
392511e6bc0Shuangdaode
393511e6bc0Shuangdaode ppe_common = dsaf_dev->ppe_common[ppe_common_index];
394511e6bc0Shuangdaode ret = hns_ppe_common_init_hw(ppe_common);
395511e6bc0Shuangdaode if (ret)
396511e6bc0Shuangdaode return;
397511e6bc0Shuangdaode
398831d828bSYisen.Zhuang\(Zhuangyuzeng\) for (i = 0; i < ppe_common->ppe_num; i++) {
399831d828bSYisen.Zhuang\(Zhuangyuzeng\) /* We only need to initiate ppe when the port exists */
400831d828bSYisen.Zhuang\(Zhuangyuzeng\) if (dsaf_dev->mac_cb[i])
40113ac695eSSalil hns_ppe_init_hw(&ppe_common->ppe_cb[i]);
402831d828bSYisen.Zhuang\(Zhuangyuzeng\) }
40313ac695eSSalil
404511e6bc0Shuangdaode ret = hns_rcb_common_init_hw(dsaf_dev->rcb_common[ppe_common_index]);
405511e6bc0Shuangdaode if (ret)
406511e6bc0Shuangdaode return;
407511e6bc0Shuangdaode
408511e6bc0Shuangdaode hns_rcb_common_init_commit_hw(dsaf_dev->rcb_common[ppe_common_index]);
409511e6bc0Shuangdaode }
410511e6bc0Shuangdaode
hns_ppe_update_stats(struct hns_ppe_cb * ppe_cb)411511e6bc0Shuangdaode void hns_ppe_update_stats(struct hns_ppe_cb *ppe_cb)
412511e6bc0Shuangdaode {
413511e6bc0Shuangdaode struct hns_ppe_hw_stats *hw_stats = &ppe_cb->hw_stats;
414511e6bc0Shuangdaode
415511e6bc0Shuangdaode hw_stats->rx_pkts_from_sw
416511e6bc0Shuangdaode += dsaf_read_dev(ppe_cb, PPE_HIS_RX_SW_PKT_CNT_REG);
417511e6bc0Shuangdaode hw_stats->rx_pkts
418511e6bc0Shuangdaode += dsaf_read_dev(ppe_cb, PPE_HIS_RX_WR_BD_OK_PKT_CNT_REG);
419511e6bc0Shuangdaode hw_stats->rx_drop_no_bd
420511e6bc0Shuangdaode += dsaf_read_dev(ppe_cb, PPE_HIS_RX_PKT_NO_BUF_CNT_REG);
421511e6bc0Shuangdaode hw_stats->rx_alloc_buf_fail
422511e6bc0Shuangdaode += dsaf_read_dev(ppe_cb, PPE_HIS_RX_APP_BUF_FAIL_CNT_REG);
423511e6bc0Shuangdaode hw_stats->rx_alloc_buf_wait
424511e6bc0Shuangdaode += dsaf_read_dev(ppe_cb, PPE_HIS_RX_APP_BUF_WAIT_CNT_REG);
425511e6bc0Shuangdaode hw_stats->rx_drop_no_buf
426511e6bc0Shuangdaode += dsaf_read_dev(ppe_cb, PPE_HIS_RX_PKT_DROP_FUL_CNT_REG);
427511e6bc0Shuangdaode hw_stats->rx_err_fifo_full
428511e6bc0Shuangdaode += dsaf_read_dev(ppe_cb, PPE_HIS_RX_PKT_DROP_PRT_CNT_REG);
429511e6bc0Shuangdaode
430511e6bc0Shuangdaode hw_stats->tx_bd_form_rcb
431511e6bc0Shuangdaode += dsaf_read_dev(ppe_cb, PPE_HIS_TX_BD_CNT_REG);
432511e6bc0Shuangdaode hw_stats->tx_pkts_from_rcb
433511e6bc0Shuangdaode += dsaf_read_dev(ppe_cb, PPE_HIS_TX_PKT_CNT_REG);
434511e6bc0Shuangdaode hw_stats->tx_pkts
435511e6bc0Shuangdaode += dsaf_read_dev(ppe_cb, PPE_HIS_TX_PKT_OK_CNT_REG);
436511e6bc0Shuangdaode hw_stats->tx_err_fifo_empty
437511e6bc0Shuangdaode += dsaf_read_dev(ppe_cb, PPE_HIS_TX_PKT_EPT_CNT_REG);
438511e6bc0Shuangdaode hw_stats->tx_err_checksum
439511e6bc0Shuangdaode += dsaf_read_dev(ppe_cb, PPE_HIS_TX_PKT_CS_FAIL_CNT_REG);
440511e6bc0Shuangdaode }
441511e6bc0Shuangdaode
hns_ppe_get_sset_count(int stringset)442511e6bc0Shuangdaode int hns_ppe_get_sset_count(int stringset)
443511e6bc0Shuangdaode {
444d61d263cSMatthias Brugger if (stringset == ETH_SS_STATS)
445511e6bc0Shuangdaode return ETH_PPE_STATIC_NUM;
446511e6bc0Shuangdaode return 0;
447511e6bc0Shuangdaode }
448511e6bc0Shuangdaode
hns_ppe_get_regs_count(void)449511e6bc0Shuangdaode int hns_ppe_get_regs_count(void)
450511e6bc0Shuangdaode {
451511e6bc0Shuangdaode return ETH_PPE_DUMP_NUM;
452511e6bc0Shuangdaode }
453511e6bc0Shuangdaode
454511e6bc0Shuangdaode /**
455*5a9594cfSYang Shen * hns_ppe_get_strings - get ppe srting
456d0ea5cbdSJesse Brandeburg * @ppe_cb: ppe device
457511e6bc0Shuangdaode * @stringset: string set type
458511e6bc0Shuangdaode * @data: output string
459511e6bc0Shuangdaode */
hns_ppe_get_strings(struct hns_ppe_cb * ppe_cb,int stringset,u8 * data)460511e6bc0Shuangdaode void hns_ppe_get_strings(struct hns_ppe_cb *ppe_cb, int stringset, u8 *data)
461511e6bc0Shuangdaode {
462511e6bc0Shuangdaode int index = ppe_cb->index;
46383cd2397SAlexander Duyck u8 *buff = data;
464511e6bc0Shuangdaode
46583cd2397SAlexander Duyck ethtool_sprintf(&buff, "ppe%d_rx_sw_pkt", index);
46683cd2397SAlexander Duyck ethtool_sprintf(&buff, "ppe%d_rx_pkt_ok", index);
46783cd2397SAlexander Duyck ethtool_sprintf(&buff, "ppe%d_rx_drop_pkt_no_bd", index);
46883cd2397SAlexander Duyck ethtool_sprintf(&buff, "ppe%d_rx_alloc_buf_fail", index);
46983cd2397SAlexander Duyck ethtool_sprintf(&buff, "ppe%d_rx_alloc_buf_wait", index);
47083cd2397SAlexander Duyck ethtool_sprintf(&buff, "ppe%d_rx_pkt_drop_no_buf", index);
47183cd2397SAlexander Duyck ethtool_sprintf(&buff, "ppe%d_rx_pkt_err_fifo_full", index);
472511e6bc0Shuangdaode
47383cd2397SAlexander Duyck ethtool_sprintf(&buff, "ppe%d_tx_bd", index);
47483cd2397SAlexander Duyck ethtool_sprintf(&buff, "ppe%d_tx_pkt", index);
47583cd2397SAlexander Duyck ethtool_sprintf(&buff, "ppe%d_tx_pkt_ok", index);
47683cd2397SAlexander Duyck ethtool_sprintf(&buff, "ppe%d_tx_pkt_err_fifo_empty", index);
47783cd2397SAlexander Duyck ethtool_sprintf(&buff, "ppe%d_tx_pkt_err_csum_fail", index);
478511e6bc0Shuangdaode }
479511e6bc0Shuangdaode
hns_ppe_get_stats(struct hns_ppe_cb * ppe_cb,u64 * data)480511e6bc0Shuangdaode void hns_ppe_get_stats(struct hns_ppe_cb *ppe_cb, u64 *data)
481511e6bc0Shuangdaode {
482511e6bc0Shuangdaode u64 *regs_buff = data;
483511e6bc0Shuangdaode struct hns_ppe_hw_stats *hw_stats = &ppe_cb->hw_stats;
484511e6bc0Shuangdaode
485511e6bc0Shuangdaode regs_buff[0] = hw_stats->rx_pkts_from_sw;
486511e6bc0Shuangdaode regs_buff[1] = hw_stats->rx_pkts;
487511e6bc0Shuangdaode regs_buff[2] = hw_stats->rx_drop_no_bd;
488511e6bc0Shuangdaode regs_buff[3] = hw_stats->rx_alloc_buf_fail;
489511e6bc0Shuangdaode regs_buff[4] = hw_stats->rx_alloc_buf_wait;
490511e6bc0Shuangdaode regs_buff[5] = hw_stats->rx_drop_no_buf;
491511e6bc0Shuangdaode regs_buff[6] = hw_stats->rx_err_fifo_full;
492511e6bc0Shuangdaode
493511e6bc0Shuangdaode regs_buff[7] = hw_stats->tx_bd_form_rcb;
494511e6bc0Shuangdaode regs_buff[8] = hw_stats->tx_pkts_from_rcb;
495511e6bc0Shuangdaode regs_buff[9] = hw_stats->tx_pkts;
496511e6bc0Shuangdaode regs_buff[10] = hw_stats->tx_err_fifo_empty;
497511e6bc0Shuangdaode regs_buff[11] = hw_stats->tx_err_checksum;
498511e6bc0Shuangdaode }
499511e6bc0Shuangdaode
500511e6bc0Shuangdaode /**
501511e6bc0Shuangdaode * hns_ppe_init - init ppe device
502511e6bc0Shuangdaode * @dsaf_dev: dasf device
503d0ea5cbdSJesse Brandeburg * return 0 - success , negative --fail
504511e6bc0Shuangdaode */
hns_ppe_init(struct dsaf_device * dsaf_dev)505511e6bc0Shuangdaode int hns_ppe_init(struct dsaf_device *dsaf_dev)
506511e6bc0Shuangdaode {
507511e6bc0Shuangdaode int ret;
508a2185587SKejian Yan int i;
509511e6bc0Shuangdaode
510511e6bc0Shuangdaode for (i = 0; i < HNS_PPE_COM_NUM; i++) {
511511e6bc0Shuangdaode ret = hns_ppe_common_get_cfg(dsaf_dev, i);
512511e6bc0Shuangdaode if (ret)
513a2185587SKejian Yan goto get_cfg_fail;
514511e6bc0Shuangdaode
515511e6bc0Shuangdaode ret = hns_rcb_common_get_cfg(dsaf_dev, i);
516511e6bc0Shuangdaode if (ret)
517a2185587SKejian Yan goto get_cfg_fail;
518511e6bc0Shuangdaode
519511e6bc0Shuangdaode hns_ppe_get_cfg(dsaf_dev->ppe_common[i]);
520511e6bc0Shuangdaode
5212fdd6bafSlipeng ret = hns_rcb_get_cfg(dsaf_dev->rcb_common[i]);
5222fdd6bafSlipeng if (ret)
5232fdd6bafSlipeng goto get_cfg_fail;
524511e6bc0Shuangdaode }
525511e6bc0Shuangdaode
526511e6bc0Shuangdaode for (i = 0; i < HNS_PPE_COM_NUM; i++)
527511e6bc0Shuangdaode hns_ppe_reset_common(dsaf_dev, i);
528511e6bc0Shuangdaode
529511e6bc0Shuangdaode return 0;
530511e6bc0Shuangdaode
531a2185587SKejian Yan get_cfg_fail:
532a2185587SKejian Yan for (i = 0; i < HNS_PPE_COM_NUM; i++) {
533a2185587SKejian Yan hns_rcb_common_free_cfg(dsaf_dev, i);
534511e6bc0Shuangdaode hns_ppe_common_free_cfg(dsaf_dev, i);
535511e6bc0Shuangdaode }
536a2185587SKejian Yan
537511e6bc0Shuangdaode return ret;
538511e6bc0Shuangdaode }
539511e6bc0Shuangdaode
hns_ppe_get_regs(struct hns_ppe_cb * ppe_cb,void * data)540511e6bc0Shuangdaode void hns_ppe_get_regs(struct hns_ppe_cb *ppe_cb, void *data)
541511e6bc0Shuangdaode {
542511e6bc0Shuangdaode struct ppe_common_cb *ppe_common = ppe_cb->ppe_common_cb;
543511e6bc0Shuangdaode u32 *regs = data;
544511e6bc0Shuangdaode u32 i;
545511e6bc0Shuangdaode u32 offset;
546511e6bc0Shuangdaode
547511e6bc0Shuangdaode /* ppe common registers */
548511e6bc0Shuangdaode regs[0] = dsaf_read_dev(ppe_common, PPE_COM_CFG_QID_MODE_REG);
549511e6bc0Shuangdaode regs[1] = dsaf_read_dev(ppe_common, PPE_COM_INTEN_REG);
550511e6bc0Shuangdaode regs[2] = dsaf_read_dev(ppe_common, PPE_COM_RINT_REG);
551511e6bc0Shuangdaode regs[3] = dsaf_read_dev(ppe_common, PPE_COM_INTSTS_REG);
552511e6bc0Shuangdaode regs[4] = dsaf_read_dev(ppe_common, PPE_COM_COMMON_CNT_CLR_CE_REG);
553511e6bc0Shuangdaode
554511e6bc0Shuangdaode for (i = 0; i < DSAF_TOTAL_QUEUE_NUM; i++) {
555511e6bc0Shuangdaode offset = PPE_COM_HIS_RX_PKT_QID_DROP_CNT_REG + 0x4 * i;
556511e6bc0Shuangdaode regs[5 + i] = dsaf_read_dev(ppe_common, offset);
557511e6bc0Shuangdaode offset = PPE_COM_HIS_RX_PKT_QID_OK_CNT_REG + 0x4 * i;
558511e6bc0Shuangdaode regs[5 + i + DSAF_TOTAL_QUEUE_NUM]
559511e6bc0Shuangdaode = dsaf_read_dev(ppe_common, offset);
560511e6bc0Shuangdaode offset = PPE_COM_HIS_TX_PKT_QID_ERR_CNT_REG + 0x4 * i;
561511e6bc0Shuangdaode regs[5 + i + DSAF_TOTAL_QUEUE_NUM * 2]
562511e6bc0Shuangdaode = dsaf_read_dev(ppe_common, offset);
563511e6bc0Shuangdaode offset = PPE_COM_HIS_TX_PKT_QID_OK_CNT_REG + 0x4 * i;
564511e6bc0Shuangdaode regs[5 + i + DSAF_TOTAL_QUEUE_NUM * 3]
565511e6bc0Shuangdaode = dsaf_read_dev(ppe_common, offset);
566511e6bc0Shuangdaode }
567511e6bc0Shuangdaode
568511e6bc0Shuangdaode /* mark end of ppe regs */
569511e6bc0Shuangdaode for (i = 521; i < 524; i++)
570511e6bc0Shuangdaode regs[i] = 0xeeeeeeee;
571511e6bc0Shuangdaode
572511e6bc0Shuangdaode /* ppe channel registers */
573511e6bc0Shuangdaode regs[525] = dsaf_read_dev(ppe_cb, PPE_CFG_TX_FIFO_THRSLD_REG);
574511e6bc0Shuangdaode regs[526] = dsaf_read_dev(ppe_cb, PPE_CFG_RX_FIFO_THRSLD_REG);
575511e6bc0Shuangdaode regs[527] = dsaf_read_dev(ppe_cb, PPE_CFG_RX_FIFO_PAUSE_THRSLD_REG);
576511e6bc0Shuangdaode regs[528] = dsaf_read_dev(ppe_cb, PPE_CFG_RX_FIFO_SW_BP_THRSLD_REG);
577511e6bc0Shuangdaode regs[529] = dsaf_read_dev(ppe_cb, PPE_CFG_PAUSE_IDLE_CNT_REG);
578511e6bc0Shuangdaode regs[530] = dsaf_read_dev(ppe_cb, PPE_CFG_BUS_CTRL_REG);
579511e6bc0Shuangdaode regs[531] = dsaf_read_dev(ppe_cb, PPE_CFG_TNL_TO_BE_RST_REG);
580511e6bc0Shuangdaode regs[532] = dsaf_read_dev(ppe_cb, PPE_CURR_TNL_CAN_RST_REG);
581511e6bc0Shuangdaode
582511e6bc0Shuangdaode regs[533] = dsaf_read_dev(ppe_cb, PPE_CFG_XGE_MODE_REG);
583511e6bc0Shuangdaode regs[534] = dsaf_read_dev(ppe_cb, PPE_CFG_MAX_FRAME_LEN_REG);
584511e6bc0Shuangdaode regs[535] = dsaf_read_dev(ppe_cb, PPE_CFG_RX_PKT_MODE_REG);
585511e6bc0Shuangdaode regs[536] = dsaf_read_dev(ppe_cb, PPE_CFG_RX_VLAN_TAG_REG);
586511e6bc0Shuangdaode regs[537] = dsaf_read_dev(ppe_cb, PPE_CFG_TAG_GEN_REG);
587511e6bc0Shuangdaode regs[538] = dsaf_read_dev(ppe_cb, PPE_CFG_PARSE_TAG_REG);
588511e6bc0Shuangdaode regs[539] = dsaf_read_dev(ppe_cb, PPE_CFG_PRO_CHECK_EN_REG);
589511e6bc0Shuangdaode
590511e6bc0Shuangdaode regs[540] = dsaf_read_dev(ppe_cb, PPE_INTEN_REG);
591511e6bc0Shuangdaode regs[541] = dsaf_read_dev(ppe_cb, PPE_RINT_REG);
592511e6bc0Shuangdaode regs[542] = dsaf_read_dev(ppe_cb, PPE_INTSTS_REG);
593511e6bc0Shuangdaode regs[543] = dsaf_read_dev(ppe_cb, PPE_CFG_RX_PKT_INT_REG);
594511e6bc0Shuangdaode
595511e6bc0Shuangdaode regs[544] = dsaf_read_dev(ppe_cb, PPE_CFG_HEAT_DECT_TIME0_REG);
596511e6bc0Shuangdaode regs[545] = dsaf_read_dev(ppe_cb, PPE_CFG_HEAT_DECT_TIME1_REG);
597511e6bc0Shuangdaode
598511e6bc0Shuangdaode /* ppe static */
599511e6bc0Shuangdaode regs[546] = dsaf_read_dev(ppe_cb, PPE_HIS_RX_SW_PKT_CNT_REG);
600511e6bc0Shuangdaode regs[547] = dsaf_read_dev(ppe_cb, PPE_HIS_RX_WR_BD_OK_PKT_CNT_REG);
601511e6bc0Shuangdaode regs[548] = dsaf_read_dev(ppe_cb, PPE_HIS_RX_PKT_NO_BUF_CNT_REG);
602511e6bc0Shuangdaode regs[549] = dsaf_read_dev(ppe_cb, PPE_HIS_TX_BD_CNT_REG);
603511e6bc0Shuangdaode regs[550] = dsaf_read_dev(ppe_cb, PPE_HIS_TX_PKT_CNT_REG);
604511e6bc0Shuangdaode regs[551] = dsaf_read_dev(ppe_cb, PPE_HIS_TX_PKT_OK_CNT_REG);
605511e6bc0Shuangdaode regs[552] = dsaf_read_dev(ppe_cb, PPE_HIS_TX_PKT_EPT_CNT_REG);
606511e6bc0Shuangdaode regs[553] = dsaf_read_dev(ppe_cb, PPE_HIS_TX_PKT_CS_FAIL_CNT_REG);
607511e6bc0Shuangdaode regs[554] = dsaf_read_dev(ppe_cb, PPE_HIS_RX_APP_BUF_FAIL_CNT_REG);
608511e6bc0Shuangdaode regs[555] = dsaf_read_dev(ppe_cb, PPE_HIS_RX_APP_BUF_WAIT_CNT_REG);
609511e6bc0Shuangdaode regs[556] = dsaf_read_dev(ppe_cb, PPE_HIS_RX_PKT_DROP_FUL_CNT_REG);
610511e6bc0Shuangdaode regs[557] = dsaf_read_dev(ppe_cb, PPE_HIS_RX_PKT_DROP_PRT_CNT_REG);
611511e6bc0Shuangdaode
612511e6bc0Shuangdaode regs[558] = dsaf_read_dev(ppe_cb, PPE_TNL_0_5_CNT_CLR_CE_REG);
613511e6bc0Shuangdaode regs[559] = dsaf_read_dev(ppe_cb, PPE_CFG_AXI_DBG_REG);
614511e6bc0Shuangdaode regs[560] = dsaf_read_dev(ppe_cb, PPE_HIS_PRO_ERR_REG);
615511e6bc0Shuangdaode regs[561] = dsaf_read_dev(ppe_cb, PPE_HIS_TNL_FIFO_ERR_REG);
616511e6bc0Shuangdaode regs[562] = dsaf_read_dev(ppe_cb, PPE_CURR_CFF_DATA_NUM_REG);
617511e6bc0Shuangdaode regs[563] = dsaf_read_dev(ppe_cb, PPE_CURR_RX_ST_REG);
618511e6bc0Shuangdaode regs[564] = dsaf_read_dev(ppe_cb, PPE_CURR_TX_ST_REG);
619511e6bc0Shuangdaode regs[565] = dsaf_read_dev(ppe_cb, PPE_CURR_RX_FIFO0_REG);
620511e6bc0Shuangdaode regs[566] = dsaf_read_dev(ppe_cb, PPE_CURR_RX_FIFO1_REG);
621511e6bc0Shuangdaode regs[567] = dsaf_read_dev(ppe_cb, PPE_CURR_TX_FIFO0_REG);
622511e6bc0Shuangdaode regs[568] = dsaf_read_dev(ppe_cb, PPE_CURR_TX_FIFO1_REG);
623511e6bc0Shuangdaode regs[569] = dsaf_read_dev(ppe_cb, PPE_ECO0_REG);
624511e6bc0Shuangdaode regs[570] = dsaf_read_dev(ppe_cb, PPE_ECO1_REG);
625511e6bc0Shuangdaode regs[571] = dsaf_read_dev(ppe_cb, PPE_ECO2_REG);
626511e6bc0Shuangdaode
627511e6bc0Shuangdaode /* mark end of ppe regs */
628511e6bc0Shuangdaode for (i = 572; i < 576; i++)
629511e6bc0Shuangdaode regs[i] = 0xeeeeeeee;
630511e6bc0Shuangdaode }
631