Lines Matching refs:sq

209 				struct snd_queue *sq, int q_len)  in nicvf_init_snd_queue()  argument
211 if (nicvf_alloc_q_desc_mem(nic, &sq->dmem, q_len, in nicvf_init_snd_queue()
218 sq->desc = sq->dmem.base; in nicvf_init_snd_queue()
219 sq->skbuff = calloc(q_len, sizeof(u64)); in nicvf_init_snd_queue()
220 sq->head = 0; in nicvf_init_snd_queue()
221 sq->tail = 0; in nicvf_init_snd_queue()
222 sq->free_cnt = q_len - 1; in nicvf_init_snd_queue()
223 sq->thresh = SND_QUEUE_THRESH; in nicvf_init_snd_queue()
228 static void nicvf_free_snd_queue(struct nicvf *nic, struct snd_queue *sq) in nicvf_free_snd_queue() argument
230 if (!sq) in nicvf_free_snd_queue()
232 if (!sq->dmem.base) in nicvf_free_snd_queue()
236 free(sq->skbuff); in nicvf_free_snd_queue()
238 nicvf_free_q_desc_mem(nic, &sq->dmem); in nicvf_free_snd_queue()
428 struct snd_queue *sq; in nicvf_snd_queue_config() local
435 sq = &qs->sq[qidx]; in nicvf_snd_queue_config()
436 sq->enable = enable; in nicvf_snd_queue_config()
438 if (!sq->enable) { in nicvf_snd_queue_config()
446 sq->cq_qs = qs->vnic_id; in nicvf_snd_queue_config()
447 sq->cq_idx = qidx; in nicvf_snd_queue_config()
450 mbx.sq.msg = NIC_MBOX_MSG_SQ_CFG; in nicvf_snd_queue_config()
451 mbx.sq.qs_num = qs->vnic_id; in nicvf_snd_queue_config()
452 mbx.sq.sq_num = qidx; in nicvf_snd_queue_config()
453 mbx.sq.sqs_mode = nic->sqs_mode; in nicvf_snd_queue_config()
454 mbx.sq.cfg = (sq->cq_qs << 3) | sq->cq_idx; in nicvf_snd_queue_config()
459 qidx, (u64)(sq->dmem.phys_base)); in nicvf_snd_queue_config()
470 nicvf_queue_reg_write(nic, NIC_QSET_SQ_0_7_THRESH, qidx, sq->thresh); in nicvf_snd_queue_config()
561 nicvf_free_snd_queue(nic, &qs->sq[qidx]); in nicvf_free_resources()
578 if (nicvf_init_snd_queue(nic, &qs->sq[qidx], qs->sq_len)) in nicvf_alloc_resources()
660 static int nicvf_get_sq_desc(struct snd_queue *sq, int desc_cnt) in nicvf_get_sq_desc() argument
664 qentry = sq->tail; in nicvf_get_sq_desc()
665 sq->free_cnt -= desc_cnt; in nicvf_get_sq_desc()
666 sq->tail += desc_cnt; in nicvf_get_sq_desc()
667 sq->tail &= (sq->dmem.q_len - 1); in nicvf_get_sq_desc()
673 void nicvf_put_sq_desc(struct snd_queue *sq, int desc_cnt) in nicvf_put_sq_desc() argument
675 sq->free_cnt += desc_cnt; in nicvf_put_sq_desc()
676 sq->head += desc_cnt; in nicvf_put_sq_desc()
677 sq->head &= (sq->dmem.q_len - 1); in nicvf_put_sq_desc()
680 static int nicvf_get_nxt_sqentry(struct snd_queue *sq, int qentry) in nicvf_get_nxt_sqentry() argument
683 qentry &= (sq->dmem.q_len - 1); in nicvf_get_nxt_sqentry()
687 void nicvf_sq_enable(struct nicvf *nic, struct snd_queue *sq, int qidx) in nicvf_sq_enable() argument
707 void nicvf_sq_free_used_descs(struct udevice *dev, struct snd_queue *sq, in nicvf_sq_free_used_descs() argument
716 while (sq->head != head) { in nicvf_sq_free_used_descs()
717 hdr = (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, sq->head); in nicvf_sq_free_used_descs()
719 nicvf_put_sq_desc(sq, 1); in nicvf_sq_free_used_descs()
722 nicvf_put_sq_desc(sq, hdr->subdesc_cnt + 1); in nicvf_sq_free_used_descs()
738 nicvf_sq_add_hdr_subdesc(struct nicvf *nic, struct snd_queue *sq, int qentry, in nicvf_sq_add_hdr_subdesc() argument
743 hdr = (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, qentry); in nicvf_sq_add_hdr_subdesc()
744 sq->skbuff[qentry] = (uintptr_t)pkt; in nicvf_sq_add_hdr_subdesc()
761 static inline void nicvf_sq_add_gather_subdesc(struct snd_queue *sq, int qentry, in nicvf_sq_add_gather_subdesc() argument
766 qentry &= (sq->dmem.q_len - 1); in nicvf_sq_add_gather_subdesc()
767 gather = (struct sq_gather_subdesc *)GET_SQ_DESC(sq, qentry); in nicvf_sq_add_gather_subdesc()
785 struct snd_queue *sq; in nicvf_sq_append_pkt() local
788 sq = &qs->sq[sq_num]; in nicvf_sq_append_pkt()
791 if (subdesc_cnt > sq->free_cnt) in nicvf_sq_append_pkt()
794 qentry = nicvf_get_sq_desc(sq, subdesc_cnt); in nicvf_sq_append_pkt()
797 nicvf_sq_add_hdr_subdesc(nic, sq, qentry, subdesc_cnt - 1, in nicvf_sq_append_pkt()
801 qentry = nicvf_get_nxt_sqentry(sq, qentry); in nicvf_sq_append_pkt()
802 nicvf_sq_add_gather_subdesc(sq, qentry, pkt_size, (uintptr_t)(pkt)); in nicvf_sq_append_pkt()
950 struct snd_queue *sq; in nicvf_update_sq_stats() local
956 sq = &nic->qs->sq[sq_idx]; in nicvf_update_sq_stats()
957 sq->stats.bytes = GET_SQ_STATS(RQ_SQ_STATS_OCTS); in nicvf_update_sq_stats()
958 sq->stats.pkts = GET_SQ_STATS(RQ_SQ_STATS_PKTS); in nicvf_update_sq_stats()