Lines Matching refs:ch

97 	struct ltq_etop_chan ch[MAX_DMA_CHAN];  member
107 ltq_etop_alloc_skb(struct ltq_etop_chan *ch) in ltq_etop_alloc_skb() argument
109 struct ltq_etop_priv *priv = netdev_priv(ch->netdev); in ltq_etop_alloc_skb()
111 ch->skb[ch->dma.desc] = netdev_alloc_skb(ch->netdev, MAX_DMA_DATA_LEN); in ltq_etop_alloc_skb()
112 if (!ch->skb[ch->dma.desc]) in ltq_etop_alloc_skb()
114 ch->dma.desc_base[ch->dma.desc].addr = in ltq_etop_alloc_skb()
115 dma_map_single(&priv->pdev->dev, ch->skb[ch->dma.desc]->data, in ltq_etop_alloc_skb()
117 ch->dma.desc_base[ch->dma.desc].addr = in ltq_etop_alloc_skb()
118 CPHYSADDR(ch->skb[ch->dma.desc]->data); in ltq_etop_alloc_skb()
119 ch->dma.desc_base[ch->dma.desc].ctl = in ltq_etop_alloc_skb()
122 skb_reserve(ch->skb[ch->dma.desc], NET_IP_ALIGN); in ltq_etop_alloc_skb()
127 ltq_etop_hw_receive(struct ltq_etop_chan *ch) in ltq_etop_hw_receive() argument
129 struct ltq_etop_priv *priv = netdev_priv(ch->netdev); in ltq_etop_hw_receive()
130 struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc]; in ltq_etop_hw_receive()
131 struct sk_buff *skb = ch->skb[ch->dma.desc]; in ltq_etop_hw_receive()
136 if (ltq_etop_alloc_skb(ch)) { in ltq_etop_hw_receive()
137 netdev_err(ch->netdev, in ltq_etop_hw_receive()
139 ltq_dma_close(&ch->dma); in ltq_etop_hw_receive()
141 ch->dma.desc++; in ltq_etop_hw_receive()
142 ch->dma.desc %= LTQ_DESC_NUM; in ltq_etop_hw_receive()
146 skb->protocol = eth_type_trans(skb, ch->netdev); in ltq_etop_hw_receive()
153 struct ltq_etop_chan *ch = container_of(napi, in ltq_etop_poll_rx() local
158 struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc]; in ltq_etop_poll_rx()
162 ltq_etop_hw_receive(ch); in ltq_etop_poll_rx()
166 napi_complete_done(&ch->napi, work_done); in ltq_etop_poll_rx()
167 ltq_dma_ack_irq(&ch->dma); in ltq_etop_poll_rx()
175 struct ltq_etop_chan *ch = in ltq_etop_poll_tx() local
177 struct ltq_etop_priv *priv = netdev_priv(ch->netdev); in ltq_etop_poll_tx()
179 netdev_get_tx_queue(ch->netdev, ch->idx >> 1); in ltq_etop_poll_tx()
183 while ((ch->dma.desc_base[ch->tx_free].ctl & in ltq_etop_poll_tx()
185 dev_kfree_skb_any(ch->skb[ch->tx_free]); in ltq_etop_poll_tx()
186 ch->skb[ch->tx_free] = NULL; in ltq_etop_poll_tx()
187 memset(&ch->dma.desc_base[ch->tx_free], 0, in ltq_etop_poll_tx()
189 ch->tx_free++; in ltq_etop_poll_tx()
190 ch->tx_free %= LTQ_DESC_NUM; in ltq_etop_poll_tx()
196 napi_complete(&ch->napi); in ltq_etop_poll_tx()
197 ltq_dma_ack_irq(&ch->dma); in ltq_etop_poll_tx()
205 int ch = irq - LTQ_DMA_CH0_INT; in ltq_etop_dma_irq() local
207 napi_schedule(&priv->ch[ch].napi); in ltq_etop_dma_irq()
212 ltq_etop_free_channel(struct net_device *dev, struct ltq_etop_chan *ch) in ltq_etop_free_channel() argument
216 ltq_dma_free(&ch->dma); in ltq_etop_free_channel()
217 if (ch->dma.irq) in ltq_etop_free_channel()
218 free_irq(ch->dma.irq, priv); in ltq_etop_free_channel()
219 if (IS_RX(ch->idx)) { in ltq_etop_free_channel()
223 dev_kfree_skb_any(ch->skb[ch->dma.desc]); in ltq_etop_free_channel()
236 ltq_etop_free_channel(dev, &priv->ch[i]); in ltq_etop_hw_exit()
272 struct ltq_etop_chan *ch = &priv->ch[i]; in ltq_etop_hw_init() local
274 ch->dma.nr = i; in ltq_etop_hw_init()
275 ch->idx = ch->dma.nr; in ltq_etop_hw_init()
276 ch->dma.dev = &priv->pdev->dev; in ltq_etop_hw_init()
279 ltq_dma_alloc_tx(&ch->dma); in ltq_etop_hw_init()
288 ltq_dma_alloc_rx(&ch->dma); in ltq_etop_hw_init()
289 for (ch->dma.desc = 0; ch->dma.desc < LTQ_DESC_NUM; in ltq_etop_hw_init()
290 ch->dma.desc++) in ltq_etop_hw_init()
291 if (ltq_etop_alloc_skb(ch)) in ltq_etop_hw_init()
293 ch->dma.desc = 0; in ltq_etop_hw_init()
302 ch->dma.irq = irq; in ltq_etop_hw_init()
441 struct ltq_etop_chan *ch = &priv->ch[i]; in ltq_etop_open() local
445 ltq_dma_open(&ch->dma); in ltq_etop_open()
446 ltq_dma_enable_irq(&ch->dma); in ltq_etop_open()
447 napi_enable(&ch->napi); in ltq_etop_open()
463 struct ltq_etop_chan *ch = &priv->ch[i]; in ltq_etop_stop() local
467 napi_disable(&ch->napi); in ltq_etop_stop()
468 ltq_dma_close(&ch->dma); in ltq_etop_stop()
479 struct ltq_etop_chan *ch = &priv->ch[(queue << 1) | 1]; in ltq_etop_tx() local
480 struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc]; in ltq_etop_tx()
487 if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || ch->skb[ch->dma.desc]) { in ltq_etop_tx()
495 ch->skb[ch->dma.desc] = skb; in ltq_etop_tx()
506 ch->dma.desc++; in ltq_etop_tx()
507 ch->dma.desc %= LTQ_DESC_NUM; in ltq_etop_tx()
510 if (ch->dma.desc_base[ch->dma.desc].ctl & LTQ_DMA_OWN) in ltq_etop_tx()
703 netif_napi_add_weight(dev, &priv->ch[i].napi, in ltq_etop_probe()
706 netif_napi_add_weight(dev, &priv->ch[i].napi, in ltq_etop_probe()
708 priv->ch[i].netdev = dev; in ltq_etop_probe()