Lines Matching refs:rcb_common
211 void hns_rcb_common_init_commit_hw(struct rcb_common_cb *rcb_common) in hns_rcb_common_init_commit_hw() argument
214 dsaf_write_dev(rcb_common, RCB_COM_CFG_SYS_FSH_REG, 1); in hns_rcb_common_init_commit_hw()
297 static void hns_rcb_set_port_desc_cnt(struct rcb_common_cb *rcb_common, in hns_rcb_set_port_desc_cnt() argument
300 dsaf_write_dev(rcb_common, RCB_CFG_BD_NUM_REG + port_idx * 4, in hns_rcb_set_port_desc_cnt()
305 struct rcb_common_cb *rcb_common, u32 port_idx, u32 timeout) in hns_rcb_set_port_timeout() argument
307 if (AE_IS_VER1(rcb_common->dsaf_dev->dsaf_ver)) { in hns_rcb_set_port_timeout()
308 dsaf_write_dev(rcb_common, RCB_CFG_OVERTIME_REG, in hns_rcb_set_port_timeout()
310 } else if (!HNS_DSAF_IS_DEBUG(rcb_common->dsaf_dev)) { in hns_rcb_set_port_timeout()
312 dsaf_write_dev(rcb_common, in hns_rcb_set_port_timeout()
316 dsaf_write_dev(rcb_common, in hns_rcb_set_port_timeout()
320 dsaf_write_dev(rcb_common, in hns_rcb_set_port_timeout()
324 dsaf_write_dev(rcb_common, in hns_rcb_set_port_timeout()
330 static int hns_rcb_common_get_port_num(struct rcb_common_cb *rcb_common) in hns_rcb_common_get_port_num() argument
332 if (!HNS_DSAF_IS_DEBUG(rcb_common->dsaf_dev)) in hns_rcb_common_get_port_num()
340 struct rcb_common_cb *rcb_common, int en) in hns_rcb_comm_exc_irq_en() argument
346 dsaf_write_dev(rcb_common, RCB_COM_INTSTS_ECC_ERR_REG, clr_vlue); in hns_rcb_comm_exc_irq_en()
348 dsaf_write_dev(rcb_common, RCB_COM_SF_CFG_RING_STS, clr_vlue); in hns_rcb_comm_exc_irq_en()
350 dsaf_write_dev(rcb_common, RCB_COM_SF_CFG_BD_RINT_STS, clr_vlue); in hns_rcb_comm_exc_irq_en()
352 dsaf_write_dev(rcb_common, RCB_COM_RINT_TX_PKT_REG, clr_vlue); in hns_rcb_comm_exc_irq_en()
353 dsaf_write_dev(rcb_common, RCB_COM_AXI_ERR_STS, clr_vlue); in hns_rcb_comm_exc_irq_en()
356 dsaf_write_dev(rcb_common, RCB_COM_INTMASK_ECC_ERR_REG, msk_vlue); in hns_rcb_comm_exc_irq_en()
358 dsaf_write_dev(rcb_common, RCB_COM_SF_CFG_INTMASK_RING, msk_vlue); in hns_rcb_comm_exc_irq_en()
361 dsaf_write_dev(rcb_common, RCB_COM_SF_CFG_INTMASK_BD, msk_vlue | 2); in hns_rcb_comm_exc_irq_en()
363 dsaf_write_dev(rcb_common, RCB_COM_INTMSK_TX_PKT_REG, msk_vlue); in hns_rcb_comm_exc_irq_en()
364 dsaf_write_dev(rcb_common, RCB_COM_AXI_WR_ERR_INTMASK, msk_vlue); in hns_rcb_comm_exc_irq_en()
372 int hns_rcb_common_init_hw(struct rcb_common_cb *rcb_common) in hns_rcb_common_init_hw() argument
376 int port_num = hns_rcb_common_get_port_num(rcb_common); in hns_rcb_common_init_hw()
378 hns_rcb_comm_exc_irq_en(rcb_common, 0); in hns_rcb_common_init_hw()
380 reg_val = dsaf_read_dev(rcb_common, RCB_COM_CFG_INIT_FLAG_REG); in hns_rcb_common_init_hw()
382 dev_err(rcb_common->dsaf_dev->dev, in hns_rcb_common_init_hw()
388 hns_rcb_set_port_desc_cnt(rcb_common, i, rcb_common->desc_num); in hns_rcb_common_init_hw()
390 rcb_common, i, HNS_RCB_DEF_RX_COALESCED_FRAMES); in hns_rcb_common_init_hw()
391 if (!AE_IS_VER1(rcb_common->dsaf_dev->dsaf_ver) && in hns_rcb_common_init_hw()
392 !HNS_DSAF_IS_DEBUG(rcb_common->dsaf_dev)) in hns_rcb_common_init_hw()
394 rcb_common, i, HNS_RCB_DEF_TX_COALESCED_FRAMES); in hns_rcb_common_init_hw()
396 rcb_common, i, HNS_RCB_DEF_COALESCED_USECS); in hns_rcb_common_init_hw()
399 dsaf_write_dev(rcb_common, RCB_COM_CFG_ENDIAN_REG, in hns_rcb_common_init_hw()
402 if (AE_IS_VER1(rcb_common->dsaf_dev->dsaf_ver)) { in hns_rcb_common_init_hw()
403 dsaf_write_dev(rcb_common, RCB_COM_CFG_FNA_REG, 0x0); in hns_rcb_common_init_hw()
404 dsaf_write_dev(rcb_common, RCB_COM_CFG_FA_REG, 0x1); in hns_rcb_common_init_hw()
406 dsaf_set_dev_bit(rcb_common, RCBV2_COM_CFG_USER_REG, in hns_rcb_common_init_hw()
408 dsaf_set_dev_bit(rcb_common, RCBV2_COM_CFG_USER_REG, in hns_rcb_common_init_hw()
410 dsaf_set_dev_bit(rcb_common, RCBV2_COM_CFG_TSO_MODE_REG, in hns_rcb_common_init_hw()
444 struct rcb_common_cb *rcb_common; in hns_rcb_ring_get_cfg() local
450 is_ver1 = AE_IS_VER1(ring_pair_cb->rcb_common->dsaf_dev->dsaf_ver); in hns_rcb_ring_get_cfg()
465 rcb_common = ring_pair_cb->rcb_common; in hns_rcb_ring_get_cfg()
466 desc_num = rcb_common->dsaf_dev->desc_num; in hns_rcb_ring_get_cfg()
492 struct rcb_common_cb *rcb_common, int ring_idx) in hns_rcb_get_port_in_comm() argument
494 return ring_idx / (rcb_common->max_q_per_vf * rcb_common->max_vfn); in hns_rcb_get_port_in_comm()
499 static int hns_rcb_get_base_irq_idx(struct rcb_common_cb *rcb_common) in hns_rcb_get_base_irq_idx() argument
501 bool is_ver1 = AE_IS_VER1(rcb_common->dsaf_dev->dsaf_ver); in hns_rcb_get_base_irq_idx()
503 if (!HNS_DSAF_IS_DEBUG(rcb_common->dsaf_dev)) in hns_rcb_get_base_irq_idx()
515 int hns_rcb_get_cfg(struct rcb_common_cb *rcb_common) in hns_rcb_get_cfg() argument
519 u32 ring_num = rcb_common->ring_num; in hns_rcb_get_cfg()
520 int base_irq_idx = hns_rcb_get_base_irq_idx(rcb_common); in hns_rcb_get_cfg()
522 to_platform_device(rcb_common->dsaf_dev->dev); in hns_rcb_get_cfg()
523 bool is_ver1 = AE_IS_VER1(rcb_common->dsaf_dev->dsaf_ver); in hns_rcb_get_cfg()
526 ring_pair_cb = &rcb_common->ring_pair_cb[i]; in hns_rcb_get_cfg()
527 ring_pair_cb->rcb_common = rcb_common; in hns_rcb_get_cfg()
528 ring_pair_cb->dev = rcb_common->dsaf_dev->dev; in hns_rcb_get_cfg()
531 RCB_COMM_BASE_TO_RING_BASE(rcb_common->io_base, i); in hns_rcb_get_cfg()
533 hns_rcb_get_port_in_comm(rcb_common, i); in hns_rcb_get_cfg()
545 RCB_COMM_BASE_TO_RING_BASE(rcb_common->phy_base, i); in hns_rcb_get_cfg()
560 struct rcb_common_cb *rcb_common, u32 port_idx) in hns_rcb_get_rx_coalesced_frames() argument
562 return dsaf_read_dev(rcb_common, RCB_CFG_PKTLINE_REG + port_idx * 4); in hns_rcb_get_rx_coalesced_frames()
573 struct rcb_common_cb *rcb_common, u32 port_idx) in hns_rcb_get_tx_coalesced_frames() argument
578 return dsaf_read_dev(rcb_common, reg); in hns_rcb_get_tx_coalesced_frames()
589 struct rcb_common_cb *rcb_common, u32 port_idx) in hns_rcb_get_coalesce_usecs() argument
591 if (AE_IS_VER1(rcb_common->dsaf_dev->dsaf_ver)) in hns_rcb_get_coalesce_usecs()
592 return dsaf_read_dev(rcb_common, RCB_CFG_OVERTIME_REG) / in hns_rcb_get_coalesce_usecs()
595 return dsaf_read_dev(rcb_common, in hns_rcb_get_coalesce_usecs()
609 struct rcb_common_cb *rcb_common, u32 port_idx, u32 timeout) in hns_rcb_set_coalesce_usecs() argument
611 u32 old_timeout = hns_rcb_get_coalesce_usecs(rcb_common, port_idx); in hns_rcb_set_coalesce_usecs()
616 if (AE_IS_VER1(rcb_common->dsaf_dev->dsaf_ver)) { in hns_rcb_set_coalesce_usecs()
617 if (!HNS_DSAF_IS_DEBUG(rcb_common->dsaf_dev)) { in hns_rcb_set_coalesce_usecs()
618 dev_err(rcb_common->dsaf_dev->dev, in hns_rcb_set_coalesce_usecs()
624 dev_err(rcb_common->dsaf_dev->dev, in hns_rcb_set_coalesce_usecs()
628 hns_rcb_set_port_timeout(rcb_common, port_idx, timeout); in hns_rcb_set_coalesce_usecs()
642 struct rcb_common_cb *rcb_common, u32 port_idx, u32 coalesced_frames) in hns_rcb_set_tx_coalesced_frames() argument
645 hns_rcb_get_tx_coalesced_frames(rcb_common, port_idx); in hns_rcb_set_tx_coalesced_frames()
652 dev_err(rcb_common->dsaf_dev->dev, in hns_rcb_set_tx_coalesced_frames()
658 dsaf_write_dev(rcb_common, reg, coalesced_frames); in hns_rcb_set_tx_coalesced_frames()
672 struct rcb_common_cb *rcb_common, u32 port_idx, u32 coalesced_frames) in hns_rcb_set_rx_coalesced_frames() argument
675 hns_rcb_get_rx_coalesced_frames(rcb_common, port_idx); in hns_rcb_set_rx_coalesced_frames()
680 if (coalesced_frames >= rcb_common->desc_num || in hns_rcb_set_rx_coalesced_frames()
683 dev_err(rcb_common->dsaf_dev->dev, in hns_rcb_set_rx_coalesced_frames()
688 dsaf_write_dev(rcb_common, RCB_CFG_PKTLINE_REG + port_idx * 4, in hns_rcb_set_rx_coalesced_frames()
764 static u8 __iomem *hns_rcb_common_get_vaddr(struct rcb_common_cb *rcb_common) in hns_rcb_common_get_vaddr() argument
766 struct dsaf_device *dsaf_dev = rcb_common->dsaf_dev; in hns_rcb_common_get_vaddr()
771 static phys_addr_t hns_rcb_common_get_paddr(struct rcb_common_cb *rcb_common) in hns_rcb_common_get_paddr() argument
773 struct dsaf_device *dsaf_dev = rcb_common->dsaf_dev; in hns_rcb_common_get_paddr()
781 struct rcb_common_cb *rcb_common; in hns_rcb_common_get_cfg() local
787 rcb_common = in hns_rcb_common_get_cfg()
789 struct_size(rcb_common, ring_pair_cb, ring_num), in hns_rcb_common_get_cfg()
791 if (!rcb_common) { in hns_rcb_common_get_cfg()
795 rcb_common->comm_index = comm_index; in hns_rcb_common_get_cfg()
796 rcb_common->ring_num = ring_num; in hns_rcb_common_get_cfg()
797 rcb_common->dsaf_dev = dsaf_dev; in hns_rcb_common_get_cfg()
799 rcb_common->desc_num = dsaf_dev->desc_num; in hns_rcb_common_get_cfg()
802 rcb_common->max_vfn = max_vfn; in hns_rcb_common_get_cfg()
803 rcb_common->max_q_per_vf = max_q_per_vf; in hns_rcb_common_get_cfg()
805 rcb_common->io_base = hns_rcb_common_get_vaddr(rcb_common); in hns_rcb_common_get_cfg()
806 rcb_common->phy_base = hns_rcb_common_get_paddr(rcb_common); in hns_rcb_common_get_cfg()
808 dsaf_dev->rcb_common[comm_index] = rcb_common; in hns_rcb_common_get_cfg()
815 dsaf_dev->rcb_common[comm_index] = NULL; in hns_rcb_common_free_cfg()
822 struct dsaf_device *dsaf_dev = ring->rcb_common->dsaf_dev; in hns_rcb_update_stats()
824 = dsaf_dev->ppe_common[ring->rcb_common->comm_index]; in hns_rcb_update_stats()