Lines Matching refs:descr

164 				       card->descr + GELIC_NET_TX_DESCRIPTORS);  in gelic_card_down()
179 gelic_descr_get_status(struct gelic_descr *descr) in gelic_descr_get_status() argument
181 return be32_to_cpu(descr->dmac_cmd_status) & GELIC_DESCR_DMA_STAT_MASK; in gelic_descr_get_status()
192 static void gelic_descr_set_status(struct gelic_descr *descr, in gelic_descr_set_status() argument
195 descr->dmac_cmd_status = cpu_to_be32(status | in gelic_descr_set_status()
196 (be32_to_cpu(descr->dmac_cmd_status) & in gelic_descr_set_status()
215 struct gelic_descr *descr; in gelic_card_free_chain() local
217 for (descr = descr_in; descr && descr->bus_addr; descr = descr->next) { in gelic_card_free_chain()
218 dma_unmap_single(ctodev(card), descr->bus_addr, in gelic_card_free_chain()
220 descr->bus_addr = 0; in gelic_card_free_chain()
242 struct gelic_descr *descr; in gelic_card_init_chain() local
244 descr = start_descr; in gelic_card_init_chain()
245 memset(descr, 0, sizeof(*descr) * no); in gelic_card_init_chain()
248 for (i = 0; i < no; i++, descr++) { in gelic_card_init_chain()
249 gelic_descr_set_status(descr, GELIC_DESCR_DMA_NOT_IN_USE); in gelic_card_init_chain()
250 descr->bus_addr = in gelic_card_init_chain()
251 dma_map_single(ctodev(card), descr, in gelic_card_init_chain()
255 if (!descr->bus_addr) in gelic_card_init_chain()
258 descr->next = descr + 1; in gelic_card_init_chain()
259 descr->prev = descr - 1; in gelic_card_init_chain()
262 (descr - 1)->next = start_descr; in gelic_card_init_chain()
263 start_descr->prev = (descr - 1); in gelic_card_init_chain()
266 descr = start_descr; in gelic_card_init_chain()
267 for (i = 0; i < no; i++, descr++) { in gelic_card_init_chain()
268 descr->next_descr_addr = cpu_to_be32(descr->next->bus_addr); in gelic_card_init_chain()
275 (descr - 1)->next_descr_addr = 0; in gelic_card_init_chain()
280 for (i--, descr--; 0 <= i; i--, descr--) in gelic_card_init_chain()
281 if (descr->bus_addr) in gelic_card_init_chain()
282 dma_unmap_single(ctodev(card), descr->bus_addr, in gelic_card_init_chain()
301 struct gelic_descr *descr; in gelic_card_reset_chain() local
303 for (descr = start_descr; start_descr != descr->next; descr++) { in gelic_card_reset_chain()
304 gelic_descr_set_status(descr, GELIC_DESCR_DMA_CARDOWNED); in gelic_card_reset_chain()
305 descr->next_descr_addr = cpu_to_be32(descr->next->bus_addr); in gelic_card_reset_chain()
309 chain->tail = (descr - 1); in gelic_card_reset_chain()
311 (descr - 1)->next_descr_addr = 0; in gelic_card_reset_chain()
324 struct gelic_descr *descr) in gelic_descr_prepare_rx() argument
329 if (gelic_descr_get_status(descr) != GELIC_DESCR_DMA_NOT_IN_USE) in gelic_descr_prepare_rx()
336 descr->skb = dev_alloc_skb(bufsize + GELIC_NET_RXBUF_ALIGN - 1); in gelic_descr_prepare_rx()
337 if (!descr->skb) { in gelic_descr_prepare_rx()
338 descr->buf_addr = 0; /* tell DMAC don't touch memory */ in gelic_descr_prepare_rx()
343 descr->buf_size = cpu_to_be32(bufsize); in gelic_descr_prepare_rx()
344 descr->dmac_cmd_status = 0; in gelic_descr_prepare_rx()
345 descr->result_size = 0; in gelic_descr_prepare_rx()
346 descr->valid_size = 0; in gelic_descr_prepare_rx()
347 descr->data_error = 0; in gelic_descr_prepare_rx()
349 offset = ((unsigned long)descr->skb->data) & in gelic_descr_prepare_rx()
352 skb_reserve(descr->skb, GELIC_NET_RXBUF_ALIGN - offset); in gelic_descr_prepare_rx()
354 descr->buf_addr = cpu_to_be32(dma_map_single(ctodev(card), in gelic_descr_prepare_rx()
355 descr->skb->data, in gelic_descr_prepare_rx()
358 if (!descr->buf_addr) { in gelic_descr_prepare_rx()
359 dev_kfree_skb_any(descr->skb); in gelic_descr_prepare_rx()
360 descr->skb = NULL; in gelic_descr_prepare_rx()
363 gelic_descr_set_status(descr, GELIC_DESCR_DMA_NOT_IN_USE); in gelic_descr_prepare_rx()
366 gelic_descr_set_status(descr, GELIC_DESCR_DMA_CARDOWNED); in gelic_descr_prepare_rx()
378 struct gelic_descr *descr = card->rx_chain.head; in gelic_card_release_rx_chain() local
381 if (descr->skb) { in gelic_card_release_rx_chain()
383 be32_to_cpu(descr->buf_addr), in gelic_card_release_rx_chain()
384 descr->skb->len, in gelic_card_release_rx_chain()
386 descr->buf_addr = 0; in gelic_card_release_rx_chain()
387 dev_kfree_skb_any(descr->skb); in gelic_card_release_rx_chain()
388 descr->skb = NULL; in gelic_card_release_rx_chain()
389 gelic_descr_set_status(descr, in gelic_card_release_rx_chain()
392 descr = descr->next; in gelic_card_release_rx_chain()
393 } while (descr != card->rx_chain.head); in gelic_card_release_rx_chain()
406 struct gelic_descr *descr = card->rx_chain.head; in gelic_card_fill_rx_chain() local
410 if (!descr->skb) { in gelic_card_fill_rx_chain()
411 ret = gelic_descr_prepare_rx(card, descr); in gelic_card_fill_rx_chain()
415 descr = descr->next; in gelic_card_fill_rx_chain()
416 } while (descr != card->rx_chain.head); in gelic_card_fill_rx_chain()
448 struct gelic_descr *descr) in gelic_descr_release_tx() argument
450 struct sk_buff *skb = descr->skb; in gelic_descr_release_tx()
452 BUG_ON(!(be32_to_cpu(descr->data_status) & GELIC_DESCR_TX_TAIL)); in gelic_descr_release_tx()
454 dma_unmap_single(ctodev(card), be32_to_cpu(descr->buf_addr), skb->len, in gelic_descr_release_tx()
458 descr->buf_addr = 0; in gelic_descr_release_tx()
459 descr->buf_size = 0; in gelic_descr_release_tx()
460 descr->next_descr_addr = 0; in gelic_descr_release_tx()
461 descr->result_size = 0; in gelic_descr_release_tx()
462 descr->valid_size = 0; in gelic_descr_release_tx()
463 descr->data_status = 0; in gelic_descr_release_tx()
464 descr->data_error = 0; in gelic_descr_release_tx()
465 descr->skb = NULL; in gelic_descr_release_tx()
468 gelic_descr_set_status(descr, GELIC_DESCR_DMA_NOT_IN_USE); in gelic_descr_release_tx()
718 static void gelic_descr_set_tx_cmdstat(struct gelic_descr *descr, in gelic_descr_set_tx_cmdstat() argument
722 descr->dmac_cmd_status = in gelic_descr_set_tx_cmdstat()
730 descr->dmac_cmd_status = in gelic_descr_set_tx_cmdstat()
735 descr->dmac_cmd_status = in gelic_descr_set_tx_cmdstat()
742 descr->dmac_cmd_status = in gelic_descr_set_tx_cmdstat()
784 struct gelic_descr *descr, in gelic_descr_prepare_tx() argument
810 descr->buf_addr = cpu_to_be32(buf); in gelic_descr_prepare_tx()
811 descr->buf_size = cpu_to_be32(skb->len); in gelic_descr_prepare_tx()
812 descr->skb = skb; in gelic_descr_prepare_tx()
813 descr->data_status = 0; in gelic_descr_prepare_tx()
814 descr->next_descr_addr = 0; /* terminate hw descr */ in gelic_descr_prepare_tx()
815 gelic_descr_set_tx_cmdstat(descr, skb); in gelic_descr_prepare_tx()
818 card->tx_chain.head = descr->next; in gelic_descr_prepare_tx()
829 struct gelic_descr *descr) in gelic_card_kick_txdma() argument
836 if (gelic_descr_get_status(descr) == GELIC_DESCR_DMA_CARDOWNED) { in gelic_card_kick_txdma()
839 descr->bus_addr, 0); in gelic_card_kick_txdma()
857 struct gelic_descr *descr; in gelic_net_xmit() local
865 descr = gelic_card_get_next_tx_descr(card); in gelic_net_xmit()
866 if (!descr) { in gelic_net_xmit()
875 result = gelic_descr_prepare_tx(card, descr, skb); in gelic_net_xmit()
890 descr->prev->next_descr_addr = cpu_to_be32(descr->bus_addr); in gelic_net_xmit()
896 if (gelic_card_kick_txdma(card, descr)) { in gelic_net_xmit()
902 gelic_descr_release_tx(card, descr); in gelic_net_xmit()
903 gelic_descr_release_tx(card, descr->next); in gelic_net_xmit()
904 card->tx_chain.tail = descr->next->next; in gelic_net_xmit()
921 static void gelic_net_pass_skb_up(struct gelic_descr *descr, in gelic_net_pass_skb_up() argument
926 struct sk_buff *skb = descr->skb; in gelic_net_pass_skb_up()
929 data_status = be32_to_cpu(descr->data_status); in gelic_net_pass_skb_up()
930 data_error = be32_to_cpu(descr->data_error); in gelic_net_pass_skb_up()
932 dma_unmap_single(ctodev(card), be32_to_cpu(descr->buf_addr), in gelic_net_pass_skb_up()
936 skb_put(skb, be32_to_cpu(descr->valid_size)? in gelic_net_pass_skb_up()
937 be32_to_cpu(descr->valid_size) : in gelic_net_pass_skb_up()
938 be32_to_cpu(descr->result_size)); in gelic_net_pass_skb_up()
939 if (!descr->valid_size) in gelic_net_pass_skb_up()
941 be32_to_cpu(descr->result_size), in gelic_net_pass_skb_up()
942 be32_to_cpu(descr->buf_size), in gelic_net_pass_skb_up()
943 be32_to_cpu(descr->dmac_cmd_status)); in gelic_net_pass_skb_up()
945 descr->skb = NULL; in gelic_net_pass_skb_up()
984 struct gelic_descr *descr = chain->head; in gelic_card_decode_one_descr() local
988 status = gelic_descr_get_status(descr); in gelic_card_decode_one_descr()
991 be32_to_cpu(descr->dmac_cmd_status) & in gelic_card_decode_one_descr()
998 dev_dbg(ctodev(card), "dormant descr? %p\n", descr); in gelic_card_decode_one_descr()
1006 vid = *(u16 *)(descr->skb->data) & VLAN_VID_MASK; in gelic_card_decode_one_descr()
1053 gelic_net_pass_skb_up(descr, card, netdev); in gelic_card_decode_one_descr()
1060 descr->next_descr_addr = 0; in gelic_card_decode_one_descr()
1063 gelic_descr_set_status(descr, GELIC_DESCR_DMA_NOT_IN_USE); in gelic_card_decode_one_descr()
1069 gelic_descr_prepare_rx(card, descr); in gelic_card_decode_one_descr()
1071 chain->tail = descr; in gelic_card_decode_one_descr()
1072 chain->head = descr->next; in gelic_card_decode_one_descr()
1077 descr->prev->next_descr_addr = cpu_to_be32(descr->bus_addr); in gelic_card_decode_one_descr()
1569 BUILD_BUG_ON(offsetof(struct gelic_card, descr) % 32); in gelic_alloc_card_net()
1763 card->descr, GELIC_NET_TX_DESCRIPTORS)) in ps3_gelic_driver_probe()
1766 card->descr + GELIC_NET_TX_DESCRIPTORS, in ps3_gelic_driver_probe()