Lines Matching refs:descr

99 gelic_descr_get_status(struct gelic_descr *descr)  in gelic_descr_get_status()  argument
101 return be32_to_cpu(descr->dmac_cmd_status) & GELIC_DESCR_DMA_STAT_MASK; in gelic_descr_get_status()
195 static void gelic_descr_set_status(struct gelic_descr *descr, in gelic_descr_set_status() argument
198 descr->dmac_cmd_status = cpu_to_be32(status | in gelic_descr_set_status()
199 (be32_to_cpu(descr->dmac_cmd_status) & in gelic_descr_set_status()
223 struct gelic_descr *descr; in gelic_card_reset_chain() local
225 for (descr = start_descr; start_descr != descr->next; descr++) { in gelic_card_reset_chain()
226 gelic_descr_set_status(descr, GELIC_DESCR_DMA_CARDOWNED); in gelic_card_reset_chain()
227 descr->next_descr_addr = cpu_to_be32(descr->next->bus_addr); in gelic_card_reset_chain()
231 chain->tail = (descr - 1); in gelic_card_reset_chain()
233 (descr - 1)->next_descr_addr = 0; in gelic_card_reset_chain()
271 card->descr + GELIC_NET_TX_DESCRIPTORS); in gelic_card_down()
287 struct gelic_descr *descr; in gelic_card_free_chain() local
289 for (descr = descr_in; descr && descr->bus_addr; descr = descr->next) { in gelic_card_free_chain()
290 dma_unmap_single(ctodev(card), descr->bus_addr, in gelic_card_free_chain()
292 descr->bus_addr = 0; in gelic_card_free_chain()
313 struct gelic_descr *descr; in gelic_card_init_chain() local
315 descr = start_descr; in gelic_card_init_chain()
316 memset(descr, 0, sizeof(*descr) * no); in gelic_card_init_chain()
319 for (i = 0; i < no; i++, descr++) { in gelic_card_init_chain()
322 gelic_descr_set_status(descr, GELIC_DESCR_DMA_NOT_IN_USE); in gelic_card_init_chain()
324 cpu_addr = dma_map_single(ctodev(card), descr, in gelic_card_init_chain()
330 descr->bus_addr = cpu_to_be32(cpu_addr); in gelic_card_init_chain()
331 descr->next = descr + 1; in gelic_card_init_chain()
332 descr->prev = descr - 1; in gelic_card_init_chain()
335 (descr - 1)->next = start_descr; in gelic_card_init_chain()
336 start_descr->prev = (descr - 1); in gelic_card_init_chain()
339 descr = start_descr; in gelic_card_init_chain()
340 for (i = 0; i < no; i++, descr++) { in gelic_card_init_chain()
341 descr->next_descr_addr = cpu_to_be32(descr->next->bus_addr); in gelic_card_init_chain()
348 (descr - 1)->next_descr_addr = 0; in gelic_card_init_chain()
353 for (i--, descr--; 0 <= i; i--, descr--) in gelic_card_init_chain()
354 if (descr->bus_addr) in gelic_card_init_chain()
355 dma_unmap_single(ctodev(card), descr->bus_addr, in gelic_card_init_chain()
375 struct gelic_descr *descr) in gelic_descr_prepare_rx() argument
383 if (gelic_descr_get_status(descr) != GELIC_DESCR_DMA_NOT_IN_USE) in gelic_descr_prepare_rx()
386 descr->skb = netdev_alloc_skb(*card->netdev, rx_skb_size); in gelic_descr_prepare_rx()
387 if (!descr->skb) { in gelic_descr_prepare_rx()
388 descr->buf_addr = 0; /* tell DMAC don't touch memory */ in gelic_descr_prepare_rx()
391 descr->buf_size = cpu_to_be32(rx_skb_size); in gelic_descr_prepare_rx()
392 descr->dmac_cmd_status = 0; in gelic_descr_prepare_rx()
393 descr->result_size = 0; in gelic_descr_prepare_rx()
394 descr->valid_size = 0; in gelic_descr_prepare_rx()
395 descr->data_error = 0; in gelic_descr_prepare_rx()
397 offset = ((unsigned long)descr->skb->data) & in gelic_descr_prepare_rx()
400 skb_reserve(descr->skb, GELIC_NET_RXBUF_ALIGN - offset); in gelic_descr_prepare_rx()
402 cpu_addr = dma_map_single(ctodev(card), descr->skb->data, in gelic_descr_prepare_rx()
404 descr->buf_addr = cpu_to_be32(cpu_addr); in gelic_descr_prepare_rx()
406 dev_kfree_skb_any(descr->skb); in gelic_descr_prepare_rx()
407 descr->skb = NULL; in gelic_descr_prepare_rx()
410 gelic_descr_set_status(descr, GELIC_DESCR_DMA_NOT_IN_USE); in gelic_descr_prepare_rx()
413 gelic_descr_set_status(descr, GELIC_DESCR_DMA_CARDOWNED); in gelic_descr_prepare_rx()
425 struct gelic_descr *descr = card->rx_chain.head; in gelic_card_release_rx_chain() local
428 if (descr->skb) { in gelic_card_release_rx_chain()
430 be32_to_cpu(descr->buf_addr), in gelic_card_release_rx_chain()
431 descr->skb->len, in gelic_card_release_rx_chain()
433 descr->buf_addr = 0; in gelic_card_release_rx_chain()
434 dev_kfree_skb_any(descr->skb); in gelic_card_release_rx_chain()
435 descr->skb = NULL; in gelic_card_release_rx_chain()
436 gelic_descr_set_status(descr, in gelic_card_release_rx_chain()
439 descr = descr->next; in gelic_card_release_rx_chain()
440 } while (descr != card->rx_chain.head); in gelic_card_release_rx_chain()
453 struct gelic_descr *descr = card->rx_chain.head; in gelic_card_fill_rx_chain() local
457 if (!descr->skb) { in gelic_card_fill_rx_chain()
458 ret = gelic_descr_prepare_rx(card, descr); in gelic_card_fill_rx_chain()
462 descr = descr->next; in gelic_card_fill_rx_chain()
463 } while (descr != card->rx_chain.head); in gelic_card_fill_rx_chain()
495 struct gelic_descr *descr) in gelic_descr_release_tx() argument
497 struct sk_buff *skb = descr->skb; in gelic_descr_release_tx()
499 BUG_ON(!(be32_to_cpu(descr->data_status) & GELIC_DESCR_TX_TAIL)); in gelic_descr_release_tx()
501 dma_unmap_single(ctodev(card), be32_to_cpu(descr->buf_addr), skb->len, in gelic_descr_release_tx()
505 descr->buf_addr = 0; in gelic_descr_release_tx()
506 descr->buf_size = 0; in gelic_descr_release_tx()
507 descr->next_descr_addr = 0; in gelic_descr_release_tx()
508 descr->result_size = 0; in gelic_descr_release_tx()
509 descr->valid_size = 0; in gelic_descr_release_tx()
510 descr->data_status = 0; in gelic_descr_release_tx()
511 descr->data_error = 0; in gelic_descr_release_tx()
512 descr->skb = NULL; in gelic_descr_release_tx()
515 gelic_descr_set_status(descr, GELIC_DESCR_DMA_NOT_IN_USE); in gelic_descr_release_tx()
700 static void gelic_descr_set_tx_cmdstat(struct gelic_descr *descr, in gelic_descr_set_tx_cmdstat() argument
704 descr->dmac_cmd_status = in gelic_descr_set_tx_cmdstat()
712 descr->dmac_cmd_status = in gelic_descr_set_tx_cmdstat()
717 descr->dmac_cmd_status = in gelic_descr_set_tx_cmdstat()
724 descr->dmac_cmd_status = in gelic_descr_set_tx_cmdstat()
766 struct gelic_descr *descr, in gelic_descr_prepare_tx() argument
792 descr->buf_addr = cpu_to_be32(buf); in gelic_descr_prepare_tx()
793 descr->buf_size = cpu_to_be32(skb->len); in gelic_descr_prepare_tx()
794 descr->skb = skb; in gelic_descr_prepare_tx()
795 descr->data_status = 0; in gelic_descr_prepare_tx()
796 descr->next_descr_addr = 0; /* terminate hw descr */ in gelic_descr_prepare_tx()
797 gelic_descr_set_tx_cmdstat(descr, skb); in gelic_descr_prepare_tx()
800 card->tx_chain.head = descr->next; in gelic_descr_prepare_tx()
811 struct gelic_descr *descr) in gelic_card_kick_txdma() argument
818 if (gelic_descr_get_status(descr) == GELIC_DESCR_DMA_CARDOWNED) { in gelic_card_kick_txdma()
821 descr->bus_addr, 0); in gelic_card_kick_txdma()
841 struct gelic_descr *descr; in gelic_net_xmit() local
849 descr = gelic_card_get_next_tx_descr(card); in gelic_net_xmit()
850 if (!descr) { in gelic_net_xmit()
859 result = gelic_descr_prepare_tx(card, descr, skb); in gelic_net_xmit()
874 descr->prev->next_descr_addr = cpu_to_be32(descr->bus_addr); in gelic_net_xmit()
880 if (gelic_card_kick_txdma(card, descr)) { in gelic_net_xmit()
887 descr->data_status = cpu_to_be32(GELIC_DESCR_TX_TAIL); in gelic_net_xmit()
888 gelic_descr_release_tx(card, descr); in gelic_net_xmit()
890 card->tx_chain.head = descr; in gelic_net_xmit()
892 descr->prev->next_descr_addr = 0; in gelic_net_xmit()
909 static void gelic_net_pass_skb_up(struct gelic_descr *descr, in gelic_net_pass_skb_up() argument
914 struct sk_buff *skb = descr->skb; in gelic_net_pass_skb_up()
917 data_status = be32_to_cpu(descr->data_status); in gelic_net_pass_skb_up()
918 data_error = be32_to_cpu(descr->data_error); in gelic_net_pass_skb_up()
920 dma_unmap_single(ctodev(card), be32_to_cpu(descr->buf_addr), in gelic_net_pass_skb_up()
924 skb_put(skb, be32_to_cpu(descr->valid_size)? in gelic_net_pass_skb_up()
925 be32_to_cpu(descr->valid_size) : in gelic_net_pass_skb_up()
926 be32_to_cpu(descr->result_size)); in gelic_net_pass_skb_up()
927 if (!descr->valid_size) in gelic_net_pass_skb_up()
929 be32_to_cpu(descr->result_size), in gelic_net_pass_skb_up()
930 be32_to_cpu(descr->buf_size), in gelic_net_pass_skb_up()
931 be32_to_cpu(descr->dmac_cmd_status)); in gelic_net_pass_skb_up()
933 descr->skb = NULL; in gelic_net_pass_skb_up()
972 struct gelic_descr *descr = chain->head; in gelic_card_decode_one_descr() local
976 status = gelic_descr_get_status(descr); in gelic_card_decode_one_descr()
982 dev_dbg(ctodev(card), "dormant descr? %p\n", descr); in gelic_card_decode_one_descr()
990 vid = *(u16 *)(descr->skb->data) & VLAN_VID_MASK; in gelic_card_decode_one_descr()
1037 gelic_net_pass_skb_up(descr, card, netdev); in gelic_card_decode_one_descr()
1042 be32_to_cpu(descr->dmac_cmd_status) & in gelic_card_decode_one_descr()
1049 descr->next_descr_addr = 0; in gelic_card_decode_one_descr()
1052 gelic_descr_set_status(descr, GELIC_DESCR_DMA_NOT_IN_USE); in gelic_card_decode_one_descr()
1058 gelic_descr_prepare_rx(card, descr); in gelic_card_decode_one_descr()
1060 chain->tail = descr; in gelic_card_decode_one_descr()
1061 chain->head = descr->next; in gelic_card_decode_one_descr()
1066 descr->prev->next_descr_addr = cpu_to_be32(descr->bus_addr); in gelic_card_decode_one_descr()
1529 BUILD_BUG_ON(offsetof(struct gelic_card, descr) % 32); in gelic_alloc_card_net()
1725 card->descr, GELIC_NET_TX_DESCRIPTORS); in ps3_gelic_driver_probe()
1729 card->descr + GELIC_NET_TX_DESCRIPTORS, in ps3_gelic_driver_probe()