Lines Matching defs:txq
276 #define IS_TSO_HEADER(txq, addr) \
277 ((addr >= txq->tso_hdrs_dma) && \
278 (addr < txq->tso_hdrs_dma + txq->bd.ring_size * TSO_HEADER_SIZE))
302 static int fec_enet_get_free_txdesc_num(struct fec_enet_priv_tx_q *txq)
306 entries = (((const char *)txq->dirty_tx -
307 (const char *)txq->bd.cur) >> txq->bd.dsize_log2) - 1;
309 return entries >= 0 ? entries : entries + txq->bd.ring_size;
335 struct fec_enet_priv_tx_q *txq;
341 txq = fep->tx_queue[0];
342 bdp = txq->bd.base;
347 bdp == txq->bd.cur ? 'S' : ' ',
348 bdp == txq->dirty_tx ? 'H' : ' ',
352 txq->tx_skbuff[index]);
353 bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
355 } while (bdp != txq->bd.base);
381 fec_enet_txq_submit_frag_skb(struct fec_enet_priv_tx_q *txq,
386 struct bufdesc *bdp = txq->bd.cur;
400 bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
421 estatus |= FEC_TX_BD_FTYPE(txq->bd.qid);
430 index = fec_enet_get_bd_index(bdp, &txq->bd);
433 memcpy(txq->tx_bounce[index], bufaddr, frag_len);
434 bufaddr = txq->tx_bounce[index];
459 bdp = txq->bd.cur;
461 bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
468 static int fec_enet_txq_submit_skb(struct fec_enet_priv_tx_q *txq,
482 entries_free = fec_enet_get_free_txdesc_num(txq);
497 bdp = txq->bd.cur;
506 index = fec_enet_get_bd_index(bdp, &txq->bd);
509 memcpy(txq->tx_bounce[index], skb->data, buflen);
510 bufaddr = txq->tx_bounce[index];
526 last_bdp = fec_enet_txq_submit_frag_skb(txq, skb, ndev);
554 estatus |= FEC_TX_BD_FTYPE(txq->bd.qid);
563 index = fec_enet_get_bd_index(last_bdp, &txq->bd);
565 txq->tx_skbuff[index] = skb;
579 bdp = fec_enet_get_nextdesc(last_bdp, &txq->bd);
584 * txq->bd.cur.
587 txq->bd.cur = bdp;
590 writel(0, txq->bd.reg_desc_active);
596 fec_enet_txq_put_data_tso(struct fec_enet_priv_tx_q *txq, struct sk_buff *skb,
614 memcpy(txq->tx_bounce[index], data, size);
615 data = txq->tx_bounce[index];
634 estatus |= FEC_TX_BD_FTYPE(txq->bd.qid);
656 fec_enet_txq_put_hdr_tso(struct fec_enet_priv_tx_q *txq,
672 bufaddr = txq->tso_hdrs + index * TSO_HEADER_SIZE;
673 dmabuf = txq->tso_hdrs_dma + index * TSO_HEADER_SIZE;
676 memcpy(txq->tx_bounce[index], skb->data, hdr_len);
677 bufaddr = txq->tx_bounce[index];
697 estatus |= FEC_TX_BD_FTYPE(txq->bd.qid);
709 static int fec_enet_txq_submit_tso(struct fec_enet_priv_tx_q *txq,
715 struct bufdesc *bdp = txq->bd.cur;
720 if (tso_count_descs(skb) >= fec_enet_get_free_txdesc_num(txq)) {
740 index = fec_enet_get_bd_index(bdp, &txq->bd);
745 hdr = txq->tso_hdrs + index * TSO_HEADER_SIZE;
747 ret = fec_enet_txq_put_hdr_tso(txq, skb, ndev, bdp, index);
755 bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
756 index = fec_enet_get_bd_index(bdp, &txq->bd);
757 ret = fec_enet_txq_put_data_tso(txq, skb, ndev,
769 bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
773 txq->tx_skbuff[index] = skb;
776 txq->bd.cur = bdp;
780 !readl(txq->bd.reg_desc_active) ||
781 !readl(txq->bd.reg_desc_active) ||
782 !readl(txq->bd.reg_desc_active) ||
783 !readl(txq->bd.reg_desc_active))
784 writel(0, txq->bd.reg_desc_active);
799 struct fec_enet_priv_tx_q *txq;
804 txq = fep->tx_queue[queue];
808 ret = fec_enet_txq_submit_tso(txq, skb, ndev);
810 ret = fec_enet_txq_submit_skb(txq, skb, ndev);
814 entries_free = fec_enet_get_free_txdesc_num(txq);
815 if (entries_free <= txq->tx_stop_threshold)
826 struct fec_enet_priv_tx_q *txq;
856 txq = fep->tx_queue[q];
857 bdp = txq->bd.base;
858 txq->bd.cur = bdp;
860 for (i = 0; i < txq->bd.ring_size; i++) {
864 !IS_TSO_HEADER(txq, fec32_to_cpu(bdp->cbd_bufaddr)))
869 if (txq->tx_skbuff[i]) {
870 dev_kfree_skb_any(txq->tx_skbuff[i]);
871 txq->tx_skbuff[i] = NULL;
874 bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
878 bdp = fec_enet_get_prevdesc(bdp, &txq->bd);
880 txq->dirty_tx = bdp;
896 struct fec_enet_priv_tx_q *txq;
912 txq = fep->tx_queue[i];
913 writel(txq->bd.dma, fep->hwp + FEC_X_DES_START(i));
925 struct fec_enet_priv_tx_q *txq;
929 txq = fep->tx_queue[i];
931 for (j = 0; j < txq->bd.ring_size; j++) {
932 if (txq->tx_skbuff[j]) {
933 dev_kfree_skb_any(txq->tx_skbuff[j]);
934 txq->tx_skbuff[j] = NULL;
1244 struct fec_enet_priv_tx_q *txq;
1251 txq = fep->tx_queue[queue_id];
1254 bdp = txq->dirty_tx;
1257 bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
1259 while (bdp != READ_ONCE(txq->bd.cur)) {
1266 index = fec_enet_get_bd_index(bdp, &txq->bd);
1268 skb = txq->tx_skbuff[index];
1269 txq->tx_skbuff[index] = NULL;
1270 if (!IS_TSO_HEADER(txq, fec32_to_cpu(bdp->cbd_bufaddr)))
1326 txq->dirty_tx = bdp;
1329 bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
1334 entries_free = fec_enet_get_free_txdesc_num(txq);
1335 if (entries_free >= txq->tx_wake_threshold)
1341 if (bdp != txq->bd.cur &&
1342 readl(txq->bd.reg_desc_active) == 0)
1343 writel(0, txq->bd.reg_desc_active);
2819 struct fec_enet_priv_tx_q *txq;
2841 txq = fep->tx_queue[q];
2842 for (i = 0; i < txq->bd.ring_size; i++) {
2843 kfree(txq->tx_bounce[i]);
2844 txq->tx_bounce[i] = NULL;
2845 skb = txq->tx_skbuff[i];
2846 txq->tx_skbuff[i] = NULL;
2856 struct fec_enet_priv_tx_q *txq;
2860 txq = fep->tx_queue[i];
2862 txq->bd.ring_size * TSO_HEADER_SIZE,
2863 txq->tso_hdrs,
2864 txq->tso_hdrs_dma);
2878 struct fec_enet_priv_tx_q *txq;
2881 txq = kzalloc(sizeof(*txq), GFP_KERNEL);
2882 if (!txq) {
2887 fep->tx_queue[i] = txq;
2888 txq->bd.ring_size = TX_RING_SIZE;
2891 txq->tx_stop_threshold = FEC_MAX_SKB_DESCS;
2892 txq->tx_wake_threshold =
2893 (txq->bd.ring_size - txq->tx_stop_threshold) / 2;
2895 txq->tso_hdrs = dma_alloc_coherent(&fep->pdev->dev,
2896 txq->bd.ring_size * TSO_HEADER_SIZE,
2897 &txq->tso_hdrs_dma,
2899 if (!txq->tso_hdrs) {
2971 struct fec_enet_priv_tx_q *txq;
2973 txq = fep->tx_queue[queue];
2974 bdp = txq->bd.base;
2975 for (i = 0; i < txq->bd.ring_size; i++) {
2976 txq->tx_bounce[i] = kmalloc(FEC_ENET_TX_FRSIZE, GFP_KERNEL);
2977 if (!txq->tx_bounce[i])
2988 bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
2992 bdp = fec_enet_get_prevdesc(bdp, &txq->bd);
3388 struct fec_enet_priv_tx_q *txq = fep->tx_queue[i];
3389 unsigned size = dsize * txq->bd.ring_size;
3391 txq->bd.qid = i;
3392 txq->bd.base = cbd_base;
3393 txq->bd.cur = cbd_base;
3394 txq->bd.dma = bd_dma;
3395 txq->bd.dsize = dsize;
3396 txq->bd.dsize_log2 = dsize_log2;
3397 txq->bd.reg_desc_active = fep->hwp + offset_des_active_txq[i];
3400 txq->bd.last = (struct bufdesc *)(((void *)cbd_base) - dsize);