Lines Matching refs:sq
351 struct snd_queue *sq, int q_len) in nicvf_init_snd_queue() argument
355 err = nicvf_alloc_q_desc_mem(nic, &sq->dmem, q_len, SND_QUEUE_DESC_SIZE, in nicvf_init_snd_queue()
360 sq->desc = sq->dmem.base; in nicvf_init_snd_queue()
361 sq->skbuff = kcalloc(q_len, sizeof(u64), GFP_KERNEL); in nicvf_init_snd_queue()
362 if (!sq->skbuff) in nicvf_init_snd_queue()
364 sq->head = 0; in nicvf_init_snd_queue()
365 sq->tail = 0; in nicvf_init_snd_queue()
366 atomic_set(&sq->free_cnt, q_len - 1); in nicvf_init_snd_queue()
367 sq->thresh = SND_QUEUE_THRESH; in nicvf_init_snd_queue()
370 sq->tso_hdrs = dma_alloc_coherent(&nic->pdev->dev, in nicvf_init_snd_queue()
372 &sq->tso_hdrs_phys, GFP_KERNEL); in nicvf_init_snd_queue()
373 if (!sq->tso_hdrs) in nicvf_init_snd_queue()
379 static void nicvf_free_snd_queue(struct nicvf *nic, struct snd_queue *sq) in nicvf_free_snd_queue() argument
381 if (!sq) in nicvf_free_snd_queue()
383 if (!sq->dmem.base) in nicvf_free_snd_queue()
386 if (sq->tso_hdrs) in nicvf_free_snd_queue()
388 sq->dmem.q_len * TSO_HEADER_SIZE, in nicvf_free_snd_queue()
389 sq->tso_hdrs, sq->tso_hdrs_phys); in nicvf_free_snd_queue()
391 kfree(sq->skbuff); in nicvf_free_snd_queue()
392 nicvf_free_q_desc_mem(nic, &sq->dmem); in nicvf_free_snd_queue()
605 struct snd_queue *sq; in nicvf_snd_queue_config() local
608 sq = &qs->sq[qidx]; in nicvf_snd_queue_config()
609 sq->enable = enable; in nicvf_snd_queue_config()
611 if (!sq->enable) { in nicvf_snd_queue_config()
619 sq->cq_qs = qs->vnic_id; in nicvf_snd_queue_config()
620 sq->cq_idx = qidx; in nicvf_snd_queue_config()
623 mbx.sq.msg = NIC_MBOX_MSG_SQ_CFG; in nicvf_snd_queue_config()
624 mbx.sq.qs_num = qs->vnic_id; in nicvf_snd_queue_config()
625 mbx.sq.sq_num = qidx; in nicvf_snd_queue_config()
626 mbx.sq.sqs_mode = nic->sqs_mode; in nicvf_snd_queue_config()
627 mbx.sq.cfg = (sq->cq_qs << 3) | sq->cq_idx; in nicvf_snd_queue_config()
632 qidx, (u64)(sq->dmem.phys_base)); in nicvf_snd_queue_config()
644 nicvf_queue_reg_write(nic, NIC_QSET_SQ_0_7_THRESH, qidx, sq->thresh); in nicvf_snd_queue_config()
648 cpumask_set_cpu(qidx, &sq->affinity_mask); in nicvf_snd_queue_config()
650 &sq->affinity_mask, qidx); in nicvf_snd_queue_config()
739 nicvf_free_snd_queue(nic, &qs->sq[qidx]); in nicvf_free_resources()
756 if (nicvf_init_snd_queue(nic, &qs->sq[qidx], qs->sq_len)) in nicvf_alloc_resources()
838 static inline int nicvf_get_sq_desc(struct snd_queue *sq, int desc_cnt) in nicvf_get_sq_desc() argument
842 qentry = sq->tail; in nicvf_get_sq_desc()
843 atomic_sub(desc_cnt, &sq->free_cnt); in nicvf_get_sq_desc()
844 sq->tail += desc_cnt; in nicvf_get_sq_desc()
845 sq->tail &= (sq->dmem.q_len - 1); in nicvf_get_sq_desc()
851 void nicvf_put_sq_desc(struct snd_queue *sq, int desc_cnt) in nicvf_put_sq_desc() argument
853 atomic_add(desc_cnt, &sq->free_cnt); in nicvf_put_sq_desc()
854 sq->head += desc_cnt; in nicvf_put_sq_desc()
855 sq->head &= (sq->dmem.q_len - 1); in nicvf_put_sq_desc()
858 static inline int nicvf_get_nxt_sqentry(struct snd_queue *sq, int qentry) in nicvf_get_nxt_sqentry() argument
861 qentry &= (sq->dmem.q_len - 1); in nicvf_get_nxt_sqentry()
865 void nicvf_sq_enable(struct nicvf *nic, struct snd_queue *sq, int qidx) in nicvf_sq_enable() argument
885 void nicvf_sq_free_used_descs(struct net_device *netdev, struct snd_queue *sq, in nicvf_sq_free_used_descs() argument
895 while (sq->head != head) { in nicvf_sq_free_used_descs()
896 hdr = (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, sq->head); in nicvf_sq_free_used_descs()
898 nicvf_put_sq_desc(sq, 1); in nicvf_sq_free_used_descs()
901 skb = (struct sk_buff *)sq->skbuff[sq->head]; in nicvf_sq_free_used_descs()
907 nicvf_put_sq_desc(sq, hdr->subdesc_cnt + 1); in nicvf_sq_free_used_descs()
978 nicvf_sq_add_hdr_subdesc(struct snd_queue *sq, int qentry, in nicvf_sq_add_hdr_subdesc() argument
984 hdr = (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, qentry); in nicvf_sq_add_hdr_subdesc()
985 sq->skbuff[qentry] = (u64)skb; in nicvf_sq_add_hdr_subdesc()
1019 static inline void nicvf_sq_add_gather_subdesc(struct snd_queue *sq, int qentry, in nicvf_sq_add_gather_subdesc() argument
1024 qentry &= (sq->dmem.q_len - 1); in nicvf_sq_add_gather_subdesc()
1025 gather = (struct sq_gather_subdesc *)GET_SQ_DESC(sq, qentry); in nicvf_sq_add_gather_subdesc()
1037 static int nicvf_sq_append_tso(struct nicvf *nic, struct snd_queue *sq, in nicvf_sq_append_tso() argument
1058 qentry = nicvf_get_nxt_sqentry(sq, qentry); in nicvf_sq_append_tso()
1059 hdr = sq->tso_hdrs + qentry * TSO_HEADER_SIZE; in nicvf_sq_append_tso()
1061 nicvf_sq_add_gather_subdesc(sq, qentry, hdr_len, in nicvf_sq_append_tso()
1062 sq->tso_hdrs_phys + in nicvf_sq_append_tso()
1074 qentry = nicvf_get_nxt_sqentry(sq, qentry); in nicvf_sq_append_tso()
1075 nicvf_sq_add_gather_subdesc(sq, qentry, size, in nicvf_sq_append_tso()
1083 nicvf_sq_add_hdr_subdesc(sq, hdr_qentry, in nicvf_sq_append_tso()
1085 sq->skbuff[hdr_qentry] = (u64)NULL; in nicvf_sq_append_tso()
1086 qentry = nicvf_get_nxt_sqentry(sq, qentry); in nicvf_sq_append_tso()
1091 sq->skbuff[hdr_qentry] = (u64)skb; in nicvf_sq_append_tso()
1110 struct snd_queue *sq; in nicvf_sq_append_skb() local
1127 sq = &qs->sq[sq_num]; in nicvf_sq_append_skb()
1130 if (subdesc_cnt > atomic_read(&sq->free_cnt)) in nicvf_sq_append_skb()
1133 qentry = nicvf_get_sq_desc(sq, subdesc_cnt); in nicvf_sq_append_skb()
1137 return nicvf_sq_append_tso(nic, sq, sq_num, qentry, skb); in nicvf_sq_append_skb()
1140 nicvf_sq_add_hdr_subdesc(sq, qentry, subdesc_cnt - 1, skb, skb->len); in nicvf_sq_append_skb()
1143 qentry = nicvf_get_nxt_sqentry(sq, qentry); in nicvf_sq_append_skb()
1145 nicvf_sq_add_gather_subdesc(sq, qentry, size, virt_to_phys(skb->data)); in nicvf_sq_append_skb()
1156 qentry = nicvf_get_nxt_sqentry(sq, qentry); in nicvf_sq_append_skb()
1158 nicvf_sq_add_gather_subdesc(sq, qentry, size, in nicvf_sq_append_skb()
1405 struct snd_queue *sq; in nicvf_update_sq_stats() local
1411 sq = &nic->qs->sq[sq_idx]; in nicvf_update_sq_stats()
1412 sq->stats.bytes = GET_SQ_STATS(RQ_SQ_STATS_OCTS); in nicvf_update_sq_stats()
1413 sq->stats.pkts = GET_SQ_STATS(RQ_SQ_STATS_PKTS); in nicvf_update_sq_stats()