Lines Matching refs:tpd
236 #define EMAC_TPD(TXQ, SIZE, IDX) ((TXQ)->tpd.v_addr + (SIZE * (IDX)))
239 #define GET_TPD_BUFFER(RTQ, IDX) (&((RTQ)->tpd.tpbuff[(IDX)]))
305 writel(upper_32_bits(adpt->tx_q.tpd.dma_addr), in emac_mac_dma_rings_config()
308 writel(lower_32_bits(adpt->tx_q.tpd.dma_addr), in emac_mac_dma_rings_config()
311 writel(adpt->tx_q.tpd.count & TPD_RING_SIZE_BMSK, in emac_mac_dma_rings_config()
592 if (!tx_q->tpd.tpbuff) in emac_tx_q_descs_free()
595 for (i = 0; i < tx_q->tpd.count; i++) { in emac_tx_q_descs_free()
610 size = sizeof(struct emac_buffer) * tx_q->tpd.count; in emac_tx_q_descs_free()
611 memset(tx_q->tpd.tpbuff, 0, size); in emac_tx_q_descs_free()
614 memset(tx_q->tpd.v_addr, 0, tx_q->tpd.size); in emac_tx_q_descs_free()
616 tx_q->tpd.consume_idx = 0; in emac_tx_q_descs_free()
617 tx_q->tpd.produce_idx = 0; in emac_tx_q_descs_free()
666 kfree(tx_q->tpd.tpbuff); in emac_tx_q_bufs_free()
667 tx_q->tpd.tpbuff = NULL; in emac_tx_q_bufs_free()
668 tx_q->tpd.v_addr = NULL; in emac_tx_q_bufs_free()
669 tx_q->tpd.dma_addr = 0; in emac_tx_q_bufs_free()
670 tx_q->tpd.size = 0; in emac_tx_q_bufs_free()
681 size = sizeof(struct emac_buffer) * tx_q->tpd.count; in emac_tx_q_desc_alloc()
682 tx_q->tpd.tpbuff = kzalloc_node(size, GFP_KERNEL, node); in emac_tx_q_desc_alloc()
683 if (!tx_q->tpd.tpbuff) in emac_tx_q_desc_alloc()
686 tx_q->tpd.size = tx_q->tpd.count * (adpt->tpd_size * 4); in emac_tx_q_desc_alloc()
687 tx_q->tpd.dma_addr = ring_header->dma_addr + ring_header->used; in emac_tx_q_desc_alloc()
688 tx_q->tpd.v_addr = ring_header->v_addr + ring_header->used; in emac_tx_q_desc_alloc()
689 ring_header->used += ALIGN(tx_q->tpd.size, 8); in emac_tx_q_desc_alloc()
690 tx_q->tpd.produce_idx = 0; in emac_tx_q_desc_alloc()
691 tx_q->tpd.consume_idx = 0; in emac_tx_q_desc_alloc()
757 adpt->tx_q.tpd.count = adpt->tx_desc_cnt; in emac_mac_rx_tx_rings_alloc_all()
831 adpt->tx_q.tpd.produce_idx = 0; in emac_mac_rx_tx_ring_reset_all()
832 adpt->tx_q.tpd.consume_idx = 0; in emac_mac_rx_tx_ring_reset_all()
833 for (i = 0; i < adpt->tx_q.tpd.count; i++) in emac_mac_rx_tx_ring_reset_all()
834 adpt->tx_q.tpd.tpbuff[i].dma_addr = 0; in emac_mac_rx_tx_ring_reset_all()
1026 struct emac_tx_queue *tx_q, struct emac_tpd *tpd) in emac_tx_tpd_create() argument
1030 tx_q->tpd.last_produce_idx = tx_q->tpd.produce_idx; in emac_tx_tpd_create()
1031 hw_tpd = EMAC_TPD(tx_q, adpt->tpd_size, tx_q->tpd.produce_idx); in emac_tx_tpd_create()
1033 if (++tx_q->tpd.produce_idx == tx_q->tpd.count) in emac_tx_tpd_create()
1034 tx_q->tpd.produce_idx = 0; in emac_tx_tpd_create()
1036 *(hw_tpd++) = tpd->word[0]; in emac_tx_tpd_create()
1037 *(hw_tpd++) = tpd->word[1]; in emac_tx_tpd_create()
1038 *(hw_tpd++) = tpd->word[2]; in emac_tx_tpd_create()
1039 *hw_tpd = tpd->word[3]; in emac_tx_tpd_create()
1047 EMAC_TPD(tx_q, adpt->tpd_size, tx_q->tpd.last_produce_idx); in emac_tx_tpd_mark_last()
1170 u32 produce_idx = tx_q->tpd.produce_idx; in emac_tpd_num_free_descs()
1171 u32 consume_idx = tx_q->tpd.consume_idx; in emac_tpd_num_free_descs()
1175 (tx_q->tpd.count + consume_idx - produce_idx - 1); in emac_tpd_num_free_descs()
1187 while (tx_q->tpd.consume_idx != hw_consume_idx) { in emac_mac_tx_process()
1188 tpbuf = GET_TPD_BUFFER(tx_q, tx_q->tpd.consume_idx); in emac_mac_tx_process()
1203 if (++tx_q->tpd.consume_idx == tx_q->tpd.count) in emac_mac_tx_process()
1204 tx_q->tpd.consume_idx = 0; in emac_mac_tx_process()
1248 struct emac_tpd *tpd) in emac_tso_csum() argument
1281 TPD_IPV4_SET(tpd, 1); in emac_tso_csum()
1288 memset(tpd, 0, sizeof(*tpd)); in emac_tso_csum()
1297 TPD_LSOV_SET(tpd, 1); in emac_tso_csum()
1300 TPD_LSO_SET(tpd, 1); in emac_tso_csum()
1301 TPD_TCPHDR_OFFSET_SET(tpd, skb_transport_offset(skb)); in emac_tso_csum()
1302 TPD_MSS_SET(tpd, skb_shinfo(skb)->gso_size); in emac_tso_csum()
1318 TPD_PAYLOAD_OFFSET_SET(tpd, cso >> 1); in emac_tso_csum()
1319 TPD_CXSUM_OFFSET_SET(tpd, css >> 1); in emac_tso_csum()
1320 TPD_CSX_SET(tpd, 1); in emac_tso_csum()
1329 struct emac_tpd *tpd) in emac_tx_fill_tpd() argument
1332 unsigned int first = tx_q->tpd.produce_idx; in emac_tx_fill_tpd()
1341 if (TPD_LSO(tpd)) { in emac_tx_fill_tpd()
1344 tpbuf = GET_TPD_BUFFER(tx_q, tx_q->tpd.produce_idx); in emac_tx_fill_tpd()
1356 TPD_BUFFER_ADDR_L_SET(tpd, lower_32_bits(tpbuf->dma_addr)); in emac_tx_fill_tpd()
1357 TPD_BUFFER_ADDR_H_SET(tpd, upper_32_bits(tpbuf->dma_addr)); in emac_tx_fill_tpd()
1358 TPD_BUF_LEN_SET(tpd, tpbuf->length); in emac_tx_fill_tpd()
1359 emac_tx_tpd_create(adpt, tx_q, tpd); in emac_tx_fill_tpd()
1364 tpbuf = GET_TPD_BUFFER(tx_q, tx_q->tpd.produce_idx); in emac_tx_fill_tpd()
1377 TPD_BUFFER_ADDR_L_SET(tpd, lower_32_bits(tpbuf->dma_addr)); in emac_tx_fill_tpd()
1378 TPD_BUFFER_ADDR_H_SET(tpd, upper_32_bits(tpbuf->dma_addr)); in emac_tx_fill_tpd()
1379 TPD_BUF_LEN_SET(tpd, tpbuf->length); in emac_tx_fill_tpd()
1380 emac_tx_tpd_create(adpt, tx_q, tpd); in emac_tx_fill_tpd()
1387 tpbuf = GET_TPD_BUFFER(tx_q, tx_q->tpd.produce_idx); in emac_tx_fill_tpd()
1397 TPD_BUFFER_ADDR_L_SET(tpd, lower_32_bits(tpbuf->dma_addr)); in emac_tx_fill_tpd()
1398 TPD_BUFFER_ADDR_H_SET(tpd, upper_32_bits(tpbuf->dma_addr)); in emac_tx_fill_tpd()
1399 TPD_BUF_LEN_SET(tpd, tpbuf->length); in emac_tx_fill_tpd()
1400 emac_tx_tpd_create(adpt, tx_q, tpd); in emac_tx_fill_tpd()
1417 tx_q->tpd.produce_idx = first; in emac_tx_fill_tpd()
1426 if (++first == tx_q->tpd.count) in emac_tx_fill_tpd()
1438 struct emac_tpd tpd; in emac_mac_tx_buf_send() local
1442 memset(&tpd, 0, sizeof(tpd)); in emac_mac_tx_buf_send()
1444 if (emac_tso_csum(adpt, tx_q, skb, &tpd) != 0) { in emac_mac_tx_buf_send()
1453 TPD_CVLAN_TAG_SET(&tpd, tag); in emac_mac_tx_buf_send()
1454 TPD_INSTC_SET(&tpd, 1); in emac_mac_tx_buf_send()
1458 TPD_TYP_SET(&tpd, 1); in emac_mac_tx_buf_send()
1461 emac_tx_fill_tpd(adpt, tx_q, skb, &tpd); in emac_mac_tx_buf_send()
1474 prod_idx = (tx_q->tpd.produce_idx << tx_q->produce_shift) & in emac_mac_tx_buf_send()