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->hw_regs.dmac_cmd_status) & in gelic_descr_get_status()
196 static void gelic_descr_set_status(struct gelic_descr *descr, in gelic_descr_set_status() argument
199 descr->hw_regs.dmac_cmd_status = cpu_to_be32(status | in gelic_descr_set_status()
200 (be32_to_cpu(descr->hw_regs.dmac_cmd_status) & in gelic_descr_set_status()
224 struct gelic_descr *descr; in gelic_card_reset_chain() local
226 for (descr = start_descr; start_descr != descr->next; descr++) { in gelic_card_reset_chain()
227 gelic_descr_set_status(descr, GELIC_DESCR_DMA_CARDOWNED); in gelic_card_reset_chain()
228 descr->hw_regs.next_descr_addr in gelic_card_reset_chain()
229 = cpu_to_be32(descr->next->link.cpu_addr); in gelic_card_reset_chain()
233 chain->tail = (descr - 1); in gelic_card_reset_chain()
235 (descr - 1)->hw_regs.next_descr_addr = 0; in gelic_card_reset_chain()
273 card->descr + GELIC_NET_TX_DESCRIPTORS); in gelic_card_down()
289 struct gelic_descr *descr; in gelic_card_free_chain() local
291 for (descr = descr_in; descr && descr->link.cpu_addr; in gelic_card_free_chain()
292 descr = descr->next) { in gelic_card_free_chain()
293 dma_unmap_single(ctodev(card), descr->link.cpu_addr, in gelic_card_free_chain()
294 descr->link.size, DMA_BIDIRECTIONAL); in gelic_card_free_chain()
295 descr->link.cpu_addr = 0; in gelic_card_free_chain()
296 descr->link.size = 0; in gelic_card_free_chain()
317 struct gelic_descr *descr; in gelic_card_init_chain() local
319 descr = start_descr; in gelic_card_init_chain()
320 memset(descr, 0, sizeof(*descr) * no); in gelic_card_init_chain()
323 for (i = 0; i < no; i++, descr++) { in gelic_card_init_chain()
324 gelic_descr_set_status(descr, GELIC_DESCR_DMA_NOT_IN_USE); in gelic_card_init_chain()
326 descr->link.size = sizeof(struct gelic_hw_regs); in gelic_card_init_chain()
327 descr->link.cpu_addr = dma_map_single(ctodev(card), descr, in gelic_card_init_chain()
328 descr->link.size, DMA_BIDIRECTIONAL); in gelic_card_init_chain()
330 if (dma_mapping_error(ctodev(card), descr->link.cpu_addr)) { in gelic_card_init_chain()
331 for (i--, descr--; 0 <= i; i--, descr--) { in gelic_card_init_chain()
333 descr->link.cpu_addr, descr->link.size, in gelic_card_init_chain()
339 descr->next = descr + 1; in gelic_card_init_chain()
340 descr->prev = descr - 1; in gelic_card_init_chain()
343 (descr - 1)->next = start_descr; in gelic_card_init_chain()
344 start_descr->prev = (descr - 1); in gelic_card_init_chain()
347 descr = start_descr; in gelic_card_init_chain()
348 for (i = 0; i < no; i++, descr++) { in gelic_card_init_chain()
349 descr->hw_regs.next_descr_addr = in gelic_card_init_chain()
350 cpu_to_be32(descr->next->link.cpu_addr); in gelic_card_init_chain()
357 (descr - 1)->hw_regs.next_descr_addr = 0; in gelic_card_init_chain()
376 struct gelic_descr *descr) in gelic_descr_prepare_rx() argument
384 if (gelic_descr_get_status(descr) != GELIC_DESCR_DMA_NOT_IN_USE) in gelic_descr_prepare_rx()
387 descr->hw_regs.dmac_cmd_status = 0; in gelic_descr_prepare_rx()
388 descr->hw_regs.result_size = 0; in gelic_descr_prepare_rx()
389 descr->hw_regs.valid_size = 0; in gelic_descr_prepare_rx()
390 descr->hw_regs.data_error = 0; in gelic_descr_prepare_rx()
391 descr->hw_regs.payload.dev_addr = 0; in gelic_descr_prepare_rx()
392 descr->hw_regs.payload.size = 0; in gelic_descr_prepare_rx()
394 descr->skb = netdev_alloc_skb(*card->netdev, rx_skb_size); in gelic_descr_prepare_rx()
395 if (!descr->skb) { in gelic_descr_prepare_rx()
396 descr->hw_regs.payload.dev_addr = 0; /* tell DMAC don't touch memory */ in gelic_descr_prepare_rx()
400 offset = ((unsigned long)descr->skb->data) & in gelic_descr_prepare_rx()
403 skb_reserve(descr->skb, GELIC_NET_RXBUF_ALIGN - offset); in gelic_descr_prepare_rx()
405 cpu_addr = dma_map_single(ctodev(card), descr->skb->data, in gelic_descr_prepare_rx()
407 descr->hw_regs.payload.dev_addr = cpu_to_be32(cpu_addr); in gelic_descr_prepare_rx()
409 dev_kfree_skb_any(descr->skb); in gelic_descr_prepare_rx()
410 descr->skb = NULL; in gelic_descr_prepare_rx()
413 gelic_descr_set_status(descr, GELIC_DESCR_DMA_NOT_IN_USE); in gelic_descr_prepare_rx()
417 descr->hw_regs.payload.size = cpu_to_be32(GELIC_NET_MAX_FRAME); in gelic_descr_prepare_rx()
418 descr->hw_regs.payload.dev_addr = cpu_to_be32(cpu_addr); in gelic_descr_prepare_rx()
420 gelic_descr_set_status(descr, GELIC_DESCR_DMA_CARDOWNED); in gelic_descr_prepare_rx()
432 struct gelic_descr *descr = card->rx_chain.head; in gelic_card_release_rx_chain() local
435 if (descr->skb) { in gelic_card_release_rx_chain()
437 be32_to_cpu(descr->hw_regs.payload.dev_addr), in gelic_card_release_rx_chain()
438 descr->skb->len, in gelic_card_release_rx_chain()
440 descr->hw_regs.payload.dev_addr = 0; in gelic_card_release_rx_chain()
441 descr->hw_regs.payload.size = 0; in gelic_card_release_rx_chain()
442 dev_kfree_skb_any(descr->skb); in gelic_card_release_rx_chain()
443 descr->skb = NULL; in gelic_card_release_rx_chain()
444 gelic_descr_set_status(descr, in gelic_card_release_rx_chain()
447 descr = descr->next; in gelic_card_release_rx_chain()
448 } while (descr != card->rx_chain.head); in gelic_card_release_rx_chain()
461 struct gelic_descr *descr = card->rx_chain.head; in gelic_card_fill_rx_chain() local
465 if (!descr->skb) { in gelic_card_fill_rx_chain()
466 ret = gelic_descr_prepare_rx(card, descr); in gelic_card_fill_rx_chain()
470 descr = descr->next; in gelic_card_fill_rx_chain()
471 } while (descr != card->rx_chain.head); in gelic_card_fill_rx_chain()
503 struct gelic_descr *descr) in gelic_descr_release_tx() argument
505 struct sk_buff *skb = descr->skb; in gelic_descr_release_tx()
507 BUG_ON(!(be32_to_cpu(descr->hw_regs.data_status) & GELIC_DESCR_TX_TAIL)); in gelic_descr_release_tx()
510 be32_to_cpu(descr->hw_regs.payload.dev_addr), skb->len, in gelic_descr_release_tx()
514 descr->hw_regs.payload.dev_addr = 0; in gelic_descr_release_tx()
515 descr->hw_regs.payload.size = 0; in gelic_descr_release_tx()
516 descr->hw_regs.next_descr_addr = 0; in gelic_descr_release_tx()
517 descr->hw_regs.result_size = 0; in gelic_descr_release_tx()
518 descr->hw_regs.valid_size = 0; in gelic_descr_release_tx()
519 descr->hw_regs.data_status = 0; in gelic_descr_release_tx()
520 descr->hw_regs.data_error = 0; in gelic_descr_release_tx()
521 descr->skb = NULL; in gelic_descr_release_tx()
524 gelic_descr_set_status(descr, GELIC_DESCR_DMA_NOT_IN_USE); in gelic_descr_release_tx()
709 static void gelic_descr_set_tx_cmdstat(struct gelic_descr *descr, in gelic_descr_set_tx_cmdstat() argument
713 descr->hw_regs.dmac_cmd_status = in gelic_descr_set_tx_cmdstat()
721 descr->hw_regs.dmac_cmd_status = in gelic_descr_set_tx_cmdstat()
726 descr->hw_regs.dmac_cmd_status = in gelic_descr_set_tx_cmdstat()
733 descr->hw_regs.dmac_cmd_status = in gelic_descr_set_tx_cmdstat()
775 struct gelic_descr *descr, in gelic_descr_prepare_tx() argument
801 descr->hw_regs.payload.dev_addr = cpu_to_be32(buf); in gelic_descr_prepare_tx()
802 descr->hw_regs.payload.size = cpu_to_be32(skb->len); in gelic_descr_prepare_tx()
803 descr->skb = skb; in gelic_descr_prepare_tx()
804 descr->hw_regs.data_status = 0; in gelic_descr_prepare_tx()
805 descr->hw_regs.next_descr_addr = 0; /* terminate hw descr */ in gelic_descr_prepare_tx()
806 gelic_descr_set_tx_cmdstat(descr, skb); in gelic_descr_prepare_tx()
809 card->tx_chain.head = descr->next; in gelic_descr_prepare_tx()
820 struct gelic_descr *descr) in gelic_card_kick_txdma() argument
827 if (gelic_descr_get_status(descr) == GELIC_DESCR_DMA_CARDOWNED) { in gelic_card_kick_txdma()
830 descr->link.cpu_addr, 0); in gelic_card_kick_txdma()
850 struct gelic_descr *descr; in gelic_net_xmit() local
858 descr = gelic_card_get_next_tx_descr(card); in gelic_net_xmit()
859 if (!descr) { in gelic_net_xmit()
868 result = gelic_descr_prepare_tx(card, descr, skb); in gelic_net_xmit()
883 descr->prev->hw_regs.next_descr_addr = in gelic_net_xmit()
884 cpu_to_be32(descr->link.cpu_addr); in gelic_net_xmit()
890 if (gelic_card_kick_txdma(card, descr)) { in gelic_net_xmit()
897 descr->hw_regs.data_status = cpu_to_be32(GELIC_DESCR_TX_TAIL); in gelic_net_xmit()
898 gelic_descr_release_tx(card, descr); in gelic_net_xmit()
900 card->tx_chain.head = descr; in gelic_net_xmit()
902 descr->prev->hw_regs.next_descr_addr = 0; in gelic_net_xmit()
919 static void gelic_net_pass_skb_up(struct gelic_descr *descr, in gelic_net_pass_skb_up() argument
924 struct sk_buff *skb = descr->skb; in gelic_net_pass_skb_up()
927 data_status = be32_to_cpu(descr->hw_regs.data_status); in gelic_net_pass_skb_up()
928 data_error = be32_to_cpu(descr->hw_regs.data_error); in gelic_net_pass_skb_up()
931 be32_to_cpu(descr->hw_regs.payload.dev_addr), in gelic_net_pass_skb_up()
932 be32_to_cpu(descr->hw_regs.payload.size), DMA_FROM_DEVICE); in gelic_net_pass_skb_up()
934 skb_put(skb, be32_to_cpu(descr->hw_regs.valid_size)? in gelic_net_pass_skb_up()
935 be32_to_cpu(descr->hw_regs.valid_size) : in gelic_net_pass_skb_up()
936 be32_to_cpu(descr->hw_regs.result_size)); in gelic_net_pass_skb_up()
937 if (!descr->hw_regs.valid_size) in gelic_net_pass_skb_up()
939 be32_to_cpu(descr->hw_regs.result_size), in gelic_net_pass_skb_up()
940 be32_to_cpu(descr->hw_regs.payload.size), in gelic_net_pass_skb_up()
941 be32_to_cpu(descr->hw_regs.dmac_cmd_status)); in gelic_net_pass_skb_up()
943 descr->skb = NULL; in gelic_net_pass_skb_up()
982 struct gelic_descr *descr = chain->head; in gelic_card_decode_one_descr() local
986 status = gelic_descr_get_status(descr); in gelic_card_decode_one_descr()
992 dev_dbg(ctodev(card), "dormant descr? %p\n", descr); in gelic_card_decode_one_descr()
1000 vid = *(u16 *)(descr->skb->data) & VLAN_VID_MASK; in gelic_card_decode_one_descr()
1047 gelic_net_pass_skb_up(descr, card, netdev); in gelic_card_decode_one_descr()
1052 be32_to_cpu(descr->hw_regs.dmac_cmd_status) & in gelic_card_decode_one_descr()
1059 descr->hw_regs.next_descr_addr = 0; in gelic_card_decode_one_descr()
1062 gelic_descr_set_status(descr, GELIC_DESCR_DMA_NOT_IN_USE); in gelic_card_decode_one_descr()
1068 gelic_descr_prepare_rx(card, descr); in gelic_card_decode_one_descr()
1070 chain->tail = descr; in gelic_card_decode_one_descr()
1071 chain->head = descr->next; in gelic_card_decode_one_descr()
1076 descr->prev->hw_regs.next_descr_addr = in gelic_card_decode_one_descr()
1077 cpu_to_be32(descr->link.cpu_addr); in gelic_card_decode_one_descr()
1542 BUILD_BUG_ON(offsetof(struct gelic_card, descr) % 32); in gelic_alloc_card_net()
1738 card->descr, GELIC_NET_TX_DESCRIPTORS); in ps3_gelic_driver_probe()
1742 card->descr + GELIC_NET_TX_DESCRIPTORS, in ps3_gelic_driver_probe()