Lines Matching +full:- +full:556
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (c) 2014-2015 Hisilicon Limited.
60 return ppe_common->dsaf_dev->ppe_base + PPE_COMMON_REG_OFFSET; in hns_ppe_common_get_ioaddr()
64 * hns_ppe_common_get_cfg - get ppe common config
67 * return 0 - success , negative --fail
79 ppe_common = devm_kzalloc(dsaf_dev->dev, in hns_ppe_common_get_cfg()
83 return -ENOMEM; in hns_ppe_common_get_cfg()
85 ppe_common->ppe_num = ppe_num; in hns_ppe_common_get_cfg()
86 ppe_common->dsaf_dev = dsaf_dev; in hns_ppe_common_get_cfg()
87 ppe_common->comm_index = comm_index; in hns_ppe_common_get_cfg()
89 ppe_common->ppe_mode = PPE_COMMON_MODE_SERVICE; in hns_ppe_common_get_cfg()
91 ppe_common->ppe_mode = PPE_COMMON_MODE_DEBUG; in hns_ppe_common_get_cfg()
92 ppe_common->dev = dsaf_dev->dev; in hns_ppe_common_get_cfg()
94 ppe_common->io_base = hns_ppe_common_get_ioaddr(ppe_common); in hns_ppe_common_get_cfg()
96 dsaf_dev->ppe_common[comm_index] = ppe_common; in hns_ppe_common_get_cfg()
104 dsaf_dev->ppe_common[comm_index] = NULL; in hns_ppe_common_free_cfg()
110 return ppe_common->dsaf_dev->ppe_base + ppe_idx * PPE_REG_OFFSET; in hns_ppe_get_iobase()
117 u32 ppe_num = ppe_common->ppe_num; in hns_ppe_get_cfg()
120 ppe_cb = &ppe_common->ppe_cb[i]; in hns_ppe_get_cfg()
121 ppe_cb->dev = ppe_common->dev; in hns_ppe_get_cfg()
122 ppe_cb->next = NULL; in hns_ppe_get_cfg()
123 ppe_cb->ppe_common_cb = ppe_common; in hns_ppe_get_cfg()
124 ppe_cb->index = i; in hns_ppe_get_cfg()
125 ppe_cb->io_base = hns_ppe_get_iobase(ppe_common, i); in hns_ppe_get_cfg()
126 ppe_cb->virq = 0; in hns_ppe_get_cfg()
142 * hns_ppe_checksum_hw - set ppe checksum caculate
161 * hns_ppe_set_qid - set ppe qid
178 * hns_ppe_set_port_mode - set port mode
189 * hns_ppe_common_init_hw - init ppe common device
197 struct dsaf_device *dsaf_dev = ppe_common->dsaf_dev; in hns_ppe_common_init_hw()
198 enum dsaf_mode dsaf_mode = dsaf_dev->dsaf_mode; in hns_ppe_common_init_hw()
200 dsaf_dev->misc_op->ppe_comm_srst(dsaf_dev, 0); in hns_ppe_common_init_hw()
202 dsaf_dev->misc_op->ppe_comm_srst(dsaf_dev, 1); in hns_ppe_common_init_hw()
205 if (ppe_common->ppe_mode == PPE_COMMON_MODE_SERVICE) { in hns_ppe_common_init_hw()
239 dev_err(ppe_common->dev, in hns_ppe_common_init_hw()
242 return -EINVAL; in hns_ppe_common_init_hw()
287 dev_err(ppe_cb->dev, "hns ppe tx fifo clean wait timeout, still has %u pkt.\n", in hns_ppe_wait_tx_fifo_clean()
289 return -EBUSY; in hns_ppe_wait_tx_fifo_clean()
296 * hns_ppe_init_hw - init ppe
301 struct ppe_common_cb *ppe_common_cb = ppe_cb->ppe_common_cb; in hns_ppe_init_hw()
302 u32 port = ppe_cb->index; in hns_ppe_init_hw()
303 struct dsaf_device *dsaf_dev = ppe_common_cb->dsaf_dev; in hns_ppe_init_hw()
307 netdev_rss_key_fill(ppe_cb->rss_key, HNS_PPEV2_RSS_KEY_SIZE); in hns_ppe_init_hw()
309 dsaf_dev->misc_op->ppe_srst(dsaf_dev, port, 0); in hns_ppe_init_hw()
311 dsaf_dev->misc_op->ppe_srst(dsaf_dev, port, 1); in hns_ppe_init_hw()
316 if (ppe_common_cb->ppe_mode == PPE_COMMON_MODE_DEBUG) { in hns_ppe_init_hw()
326 if (!AE_IS_VER1(dsaf_dev->dsaf_ver)) { in hns_ppe_init_hw()
333 hns_ppe_set_rss_key(ppe_cb, ppe_cb->rss_key); in hns_ppe_init_hw()
337 ppe_cb->rss_indir_table[i] = i; in hns_ppe_init_hw()
338 hns_ppe_set_indir_table(ppe_cb, ppe_cb->rss_indir_table); in hns_ppe_init_hw()
343 * hns_ppe_uninit_hw - uninit ppe
350 if (ppe_cb->ppe_common_cb) { in hns_ppe_uninit_hw()
351 struct dsaf_device *dsaf_dev = ppe_cb->ppe_common_cb->dsaf_dev; in hns_ppe_uninit_hw()
353 port = ppe_cb->index; in hns_ppe_uninit_hw()
354 dsaf_dev->misc_op->ppe_srst(dsaf_dev, port, 0); in hns_ppe_uninit_hw()
362 for (i = 0; i < ppe_common->ppe_num; i++) { in hns_ppe_uninit_ex()
363 if (ppe_common->dsaf_dev->mac_cb[i]) in hns_ppe_uninit_ex()
364 hns_ppe_uninit_hw(&ppe_common->ppe_cb[i]); in hns_ppe_uninit_ex()
365 memset(&ppe_common->ppe_cb[i], 0, sizeof(struct hns_ppe_cb)); in hns_ppe_uninit_ex()
374 if (dsaf_dev->ppe_common[i]) in hns_ppe_uninit()
375 hns_ppe_uninit_ex(dsaf_dev->ppe_common[i]); in hns_ppe_uninit()
382 * hns_ppe_reset_common - reinit ppe/rcb hw
393 ppe_common = dsaf_dev->ppe_common[ppe_common_index]; in hns_ppe_reset_common()
398 for (i = 0; i < ppe_common->ppe_num; i++) { in hns_ppe_reset_common()
400 if (dsaf_dev->mac_cb[i]) in hns_ppe_reset_common()
401 hns_ppe_init_hw(&ppe_common->ppe_cb[i]); in hns_ppe_reset_common()
404 ret = hns_rcb_common_init_hw(dsaf_dev->rcb_common[ppe_common_index]); in hns_ppe_reset_common()
408 hns_rcb_common_init_commit_hw(dsaf_dev->rcb_common[ppe_common_index]); in hns_ppe_reset_common()
413 struct hns_ppe_hw_stats *hw_stats = &ppe_cb->hw_stats; in hns_ppe_update_stats()
415 hw_stats->rx_pkts_from_sw in hns_ppe_update_stats()
417 hw_stats->rx_pkts in hns_ppe_update_stats()
419 hw_stats->rx_drop_no_bd in hns_ppe_update_stats()
421 hw_stats->rx_alloc_buf_fail in hns_ppe_update_stats()
423 hw_stats->rx_alloc_buf_wait in hns_ppe_update_stats()
425 hw_stats->rx_drop_no_buf in hns_ppe_update_stats()
427 hw_stats->rx_err_fifo_full in hns_ppe_update_stats()
430 hw_stats->tx_bd_form_rcb in hns_ppe_update_stats()
432 hw_stats->tx_pkts_from_rcb in hns_ppe_update_stats()
434 hw_stats->tx_pkts in hns_ppe_update_stats()
436 hw_stats->tx_err_fifo_empty in hns_ppe_update_stats()
438 hw_stats->tx_err_checksum in hns_ppe_update_stats()
455 * hns_ppe_get_strings - get ppe srting
462 int index = ppe_cb->index; in hns_ppe_get_strings()
483 struct hns_ppe_hw_stats *hw_stats = &ppe_cb->hw_stats; in hns_ppe_get_stats()
485 regs_buff[0] = hw_stats->rx_pkts_from_sw; in hns_ppe_get_stats()
486 regs_buff[1] = hw_stats->rx_pkts; in hns_ppe_get_stats()
487 regs_buff[2] = hw_stats->rx_drop_no_bd; in hns_ppe_get_stats()
488 regs_buff[3] = hw_stats->rx_alloc_buf_fail; in hns_ppe_get_stats()
489 regs_buff[4] = hw_stats->rx_alloc_buf_wait; in hns_ppe_get_stats()
490 regs_buff[5] = hw_stats->rx_drop_no_buf; in hns_ppe_get_stats()
491 regs_buff[6] = hw_stats->rx_err_fifo_full; in hns_ppe_get_stats()
493 regs_buff[7] = hw_stats->tx_bd_form_rcb; in hns_ppe_get_stats()
494 regs_buff[8] = hw_stats->tx_pkts_from_rcb; in hns_ppe_get_stats()
495 regs_buff[9] = hw_stats->tx_pkts; in hns_ppe_get_stats()
496 regs_buff[10] = hw_stats->tx_err_fifo_empty; in hns_ppe_get_stats()
497 regs_buff[11] = hw_stats->tx_err_checksum; in hns_ppe_get_stats()
501 * hns_ppe_init - init ppe device
503 * return 0 - success , negative --fail
519 hns_ppe_get_cfg(dsaf_dev->ppe_common[i]); in hns_ppe_init()
521 ret = hns_rcb_get_cfg(dsaf_dev->rcb_common[i]); in hns_ppe_init()
542 struct ppe_common_cb *ppe_common = ppe_cb->ppe_common_cb; in hns_ppe_get_regs()
609 regs[556] = dsaf_read_dev(ppe_cb, PPE_HIS_RX_PKT_DROP_FUL_CNT_REG); in hns_ppe_get_regs()