Lines Matching refs:pdata
43 struct xlgmac_pdata *pdata = channel->pdata; in xlgmac_maybe_stop_tx_queue() local
46 netif_info(pdata, drv, pdata->netdev, in xlgmac_maybe_stop_tx_queue()
48 netif_stop_subqueue(pdata->netdev, channel->queue_index); in xlgmac_maybe_stop_tx_queue()
55 pdata->hw_ops.tx_start_xmit(channel, ring); in xlgmac_maybe_stop_tx_queue()
114 static void xlgmac_prep_tx_pkt(struct xlgmac_pdata *pdata, in xlgmac_prep_tx_pkt() argument
207 static void xlgmac_enable_rx_tx_ints(struct xlgmac_pdata *pdata) in xlgmac_enable_rx_tx_ints() argument
209 struct xlgmac_hw_ops *hw_ops = &pdata->hw_ops; in xlgmac_enable_rx_tx_ints()
214 channel = pdata->channel_head; in xlgmac_enable_rx_tx_ints()
215 for (i = 0; i < pdata->channel_count; i++, channel++) { in xlgmac_enable_rx_tx_ints()
229 static void xlgmac_disable_rx_tx_ints(struct xlgmac_pdata *pdata) in xlgmac_disable_rx_tx_ints() argument
231 struct xlgmac_hw_ops *hw_ops = &pdata->hw_ops; in xlgmac_disable_rx_tx_ints()
236 channel = pdata->channel_head; in xlgmac_disable_rx_tx_ints()
237 for (i = 0; i < pdata->channel_count; i++, channel++) { in xlgmac_disable_rx_tx_ints()
254 struct xlgmac_pdata *pdata = data; in xlgmac_isr() local
259 hw_ops = &pdata->hw_ops; in xlgmac_isr()
265 dma_isr = readl(pdata->mac_regs + DMA_ISR); in xlgmac_isr()
269 netif_dbg(pdata, intr, pdata->netdev, "DMA_ISR=%#010x\n", dma_isr); in xlgmac_isr()
271 for (i = 0; i < pdata->channel_count; i++) { in xlgmac_isr()
275 channel = pdata->channel_head + i; in xlgmac_isr()
278 netif_dbg(pdata, intr, pdata->netdev, "DMA_CH%u_ISR=%#010x\n", in xlgmac_isr()
289 if (!pdata->per_channel_irq && (ti || ri)) { in xlgmac_isr()
290 if (napi_schedule_prep(&pdata->napi)) { in xlgmac_isr()
292 xlgmac_disable_rx_tx_ints(pdata); in xlgmac_isr()
294 pdata->stats.napi_poll_isr++; in xlgmac_isr()
296 __napi_schedule_irqoff(&pdata->napi); in xlgmac_isr()
302 pdata->stats.tx_process_stopped++; in xlgmac_isr()
306 pdata->stats.rx_process_stopped++; in xlgmac_isr()
310 pdata->stats.tx_buffer_unavailable++; in xlgmac_isr()
314 pdata->stats.rx_buffer_unavailable++; in xlgmac_isr()
319 pdata->stats.fatal_bus_error++; in xlgmac_isr()
320 schedule_work(&pdata->restart_work); in xlgmac_isr()
329 mac_isr = readl(pdata->mac_regs + MAC_ISR); in xlgmac_isr()
333 hw_ops->tx_mmc_int(pdata); in xlgmac_isr()
337 hw_ops->rx_mmc_int(pdata); in xlgmac_isr()
364 struct xlgmac_pdata *pdata = channel->pdata; in xlgmac_tx_timer() local
367 napi = (pdata->per_channel_irq) ? &channel->napi : &pdata->napi; in xlgmac_tx_timer()
371 if (pdata->per_channel_irq) in xlgmac_tx_timer()
374 xlgmac_disable_rx_tx_ints(pdata); in xlgmac_tx_timer()
376 pdata->stats.napi_poll_txtimer++; in xlgmac_tx_timer()
384 static void xlgmac_init_timers(struct xlgmac_pdata *pdata) in xlgmac_init_timers() argument
389 channel = pdata->channel_head; in xlgmac_init_timers()
390 for (i = 0; i < pdata->channel_count; i++, channel++) { in xlgmac_init_timers()
398 static void xlgmac_stop_timers(struct xlgmac_pdata *pdata) in xlgmac_stop_timers() argument
403 channel = pdata->channel_head; in xlgmac_stop_timers()
404 for (i = 0; i < pdata->channel_count; i++, channel++) { in xlgmac_stop_timers()
412 static void xlgmac_napi_enable(struct xlgmac_pdata *pdata, unsigned int add) in xlgmac_napi_enable() argument
417 if (pdata->per_channel_irq) { in xlgmac_napi_enable()
418 channel = pdata->channel_head; in xlgmac_napi_enable()
419 for (i = 0; i < pdata->channel_count; i++, channel++) { in xlgmac_napi_enable()
421 netif_napi_add(pdata->netdev, &channel->napi, in xlgmac_napi_enable()
429 netif_napi_add(pdata->netdev, &pdata->napi, in xlgmac_napi_enable()
432 napi_enable(&pdata->napi); in xlgmac_napi_enable()
436 static void xlgmac_napi_disable(struct xlgmac_pdata *pdata, unsigned int del) in xlgmac_napi_disable() argument
441 if (pdata->per_channel_irq) { in xlgmac_napi_disable()
442 channel = pdata->channel_head; in xlgmac_napi_disable()
443 for (i = 0; i < pdata->channel_count; i++, channel++) { in xlgmac_napi_disable()
450 napi_disable(&pdata->napi); in xlgmac_napi_disable()
453 netif_napi_del(&pdata->napi); in xlgmac_napi_disable()
457 static int xlgmac_request_irqs(struct xlgmac_pdata *pdata) in xlgmac_request_irqs() argument
459 struct net_device *netdev = pdata->netdev; in xlgmac_request_irqs()
464 ret = devm_request_irq(pdata->dev, pdata->dev_irq, xlgmac_isr, in xlgmac_request_irqs()
465 IRQF_SHARED, netdev->name, pdata); in xlgmac_request_irqs()
468 pdata->dev_irq); in xlgmac_request_irqs()
472 if (!pdata->per_channel_irq) in xlgmac_request_irqs()
475 channel = pdata->channel_head; in xlgmac_request_irqs()
476 for (i = 0; i < pdata->channel_count; i++, channel++) { in xlgmac_request_irqs()
482 ret = devm_request_irq(pdata->dev, channel->dma_irq, in xlgmac_request_irqs()
496 for (i--, channel--; i < pdata->channel_count; i--, channel--) in xlgmac_request_irqs()
497 devm_free_irq(pdata->dev, channel->dma_irq, channel); in xlgmac_request_irqs()
499 devm_free_irq(pdata->dev, pdata->dev_irq, pdata); in xlgmac_request_irqs()
504 static void xlgmac_free_irqs(struct xlgmac_pdata *pdata) in xlgmac_free_irqs() argument
509 devm_free_irq(pdata->dev, pdata->dev_irq, pdata); in xlgmac_free_irqs()
511 if (!pdata->per_channel_irq) in xlgmac_free_irqs()
514 channel = pdata->channel_head; in xlgmac_free_irqs()
515 for (i = 0; i < pdata->channel_count; i++, channel++) in xlgmac_free_irqs()
516 devm_free_irq(pdata->dev, channel->dma_irq, channel); in xlgmac_free_irqs()
519 static void xlgmac_free_tx_data(struct xlgmac_pdata *pdata) in xlgmac_free_tx_data() argument
521 struct xlgmac_desc_ops *desc_ops = &pdata->desc_ops; in xlgmac_free_tx_data()
527 channel = pdata->channel_head; in xlgmac_free_tx_data()
528 for (i = 0; i < pdata->channel_count; i++, channel++) { in xlgmac_free_tx_data()
535 desc_ops->unmap_desc_data(pdata, desc_data); in xlgmac_free_tx_data()
540 static void xlgmac_free_rx_data(struct xlgmac_pdata *pdata) in xlgmac_free_rx_data() argument
542 struct xlgmac_desc_ops *desc_ops = &pdata->desc_ops; in xlgmac_free_rx_data()
548 channel = pdata->channel_head; in xlgmac_free_rx_data()
549 for (i = 0; i < pdata->channel_count; i++, channel++) { in xlgmac_free_rx_data()
556 desc_ops->unmap_desc_data(pdata, desc_data); in xlgmac_free_rx_data()
561 static int xlgmac_start(struct xlgmac_pdata *pdata) in xlgmac_start() argument
563 struct xlgmac_hw_ops *hw_ops = &pdata->hw_ops; in xlgmac_start()
564 struct net_device *netdev = pdata->netdev; in xlgmac_start()
567 hw_ops->init(pdata); in xlgmac_start()
568 xlgmac_napi_enable(pdata, 1); in xlgmac_start()
570 ret = xlgmac_request_irqs(pdata); in xlgmac_start()
574 hw_ops->enable_tx(pdata); in xlgmac_start()
575 hw_ops->enable_rx(pdata); in xlgmac_start()
581 xlgmac_napi_disable(pdata, 1); in xlgmac_start()
582 hw_ops->exit(pdata); in xlgmac_start()
587 static void xlgmac_stop(struct xlgmac_pdata *pdata) in xlgmac_stop() argument
589 struct xlgmac_hw_ops *hw_ops = &pdata->hw_ops; in xlgmac_stop()
590 struct net_device *netdev = pdata->netdev; in xlgmac_stop()
596 xlgmac_stop_timers(pdata); in xlgmac_stop()
597 hw_ops->disable_tx(pdata); in xlgmac_stop()
598 hw_ops->disable_rx(pdata); in xlgmac_stop()
599 xlgmac_free_irqs(pdata); in xlgmac_stop()
600 xlgmac_napi_disable(pdata, 1); in xlgmac_stop()
601 hw_ops->exit(pdata); in xlgmac_stop()
603 channel = pdata->channel_head; in xlgmac_stop()
604 for (i = 0; i < pdata->channel_count; i++, channel++) { in xlgmac_stop()
613 static void xlgmac_restart_dev(struct xlgmac_pdata *pdata) in xlgmac_restart_dev() argument
616 if (!netif_running(pdata->netdev)) in xlgmac_restart_dev()
619 xlgmac_stop(pdata); in xlgmac_restart_dev()
621 xlgmac_free_tx_data(pdata); in xlgmac_restart_dev()
622 xlgmac_free_rx_data(pdata); in xlgmac_restart_dev()
624 xlgmac_start(pdata); in xlgmac_restart_dev()
629 struct xlgmac_pdata *pdata = container_of(work, in xlgmac_restart() local
635 xlgmac_restart_dev(pdata); in xlgmac_restart()
642 struct xlgmac_pdata *pdata = netdev_priv(netdev); in xlgmac_open() local
646 desc_ops = &pdata->desc_ops; in xlgmac_open()
654 pdata->rx_buf_size = ret; in xlgmac_open()
657 ret = desc_ops->alloc_channles_and_rings(pdata); in xlgmac_open()
661 INIT_WORK(&pdata->restart_work, xlgmac_restart); in xlgmac_open()
662 xlgmac_init_timers(pdata); in xlgmac_open()
664 ret = xlgmac_start(pdata); in xlgmac_open()
671 desc_ops->free_channels_and_rings(pdata); in xlgmac_open()
678 struct xlgmac_pdata *pdata = netdev_priv(netdev); in xlgmac_close() local
681 desc_ops = &pdata->desc_ops; in xlgmac_close()
684 xlgmac_stop(pdata); in xlgmac_close()
687 desc_ops->free_channels_and_rings(pdata); in xlgmac_close()
694 struct xlgmac_pdata *pdata = netdev_priv(netdev); in xlgmac_tx_timeout() local
697 schedule_work(&pdata->restart_work); in xlgmac_tx_timeout()
702 struct xlgmac_pdata *pdata = netdev_priv(netdev); in xlgmac_xmit() local
711 desc_ops = &pdata->desc_ops; in xlgmac_xmit()
712 hw_ops = &pdata->hw_ops; in xlgmac_xmit()
716 channel = pdata->channel_head + skb->queue_mapping; in xlgmac_xmit()
722 netif_err(pdata, tx_err, netdev, in xlgmac_xmit()
730 xlgmac_prep_tx_pkt(pdata, ring, skb, tx_pkt_info); in xlgmac_xmit()
740 netif_err(pdata, tx_err, netdev, in xlgmac_xmit()
758 if (netif_msg_pktdata(pdata)) in xlgmac_xmit()
770 struct xlgmac_pdata *pdata = netdev_priv(netdev); in xlgmac_get_stats64() local
771 struct xlgmac_stats *pstats = &pdata->stats; in xlgmac_get_stats64()
773 pdata->hw_ops.read_mmc_stats(pdata); in xlgmac_get_stats64()
794 struct xlgmac_pdata *pdata = netdev_priv(netdev); in xlgmac_set_mac_address() local
795 struct xlgmac_hw_ops *hw_ops = &pdata->hw_ops; in xlgmac_set_mac_address()
803 hw_ops->set_mac_address(pdata, netdev->dev_addr); in xlgmac_set_mac_address()
819 struct xlgmac_pdata *pdata = netdev_priv(netdev); in xlgmac_change_mtu() local
826 pdata->rx_buf_size = ret; in xlgmac_change_mtu()
829 xlgmac_restart_dev(pdata); in xlgmac_change_mtu()
838 struct xlgmac_pdata *pdata = netdev_priv(netdev); in xlgmac_vlan_rx_add_vid() local
839 struct xlgmac_hw_ops *hw_ops = &pdata->hw_ops; in xlgmac_vlan_rx_add_vid()
841 set_bit(vid, pdata->active_vlans); in xlgmac_vlan_rx_add_vid()
842 hw_ops->update_vlan_hash_table(pdata); in xlgmac_vlan_rx_add_vid()
851 struct xlgmac_pdata *pdata = netdev_priv(netdev); in xlgmac_vlan_rx_kill_vid() local
852 struct xlgmac_hw_ops *hw_ops = &pdata->hw_ops; in xlgmac_vlan_rx_kill_vid()
854 clear_bit(vid, pdata->active_vlans); in xlgmac_vlan_rx_kill_vid()
855 hw_ops->update_vlan_hash_table(pdata); in xlgmac_vlan_rx_kill_vid()
863 struct xlgmac_pdata *pdata = netdev_priv(netdev); in xlgmac_poll_controller() local
867 if (pdata->per_channel_irq) { in xlgmac_poll_controller()
868 channel = pdata->channel_head; in xlgmac_poll_controller()
869 for (i = 0; i < pdata->channel_count; i++, channel++) in xlgmac_poll_controller()
872 disable_irq(pdata->dev_irq); in xlgmac_poll_controller()
873 xlgmac_isr(pdata->dev_irq, pdata); in xlgmac_poll_controller()
874 enable_irq(pdata->dev_irq); in xlgmac_poll_controller()
883 struct xlgmac_pdata *pdata = netdev_priv(netdev); in xlgmac_set_features() local
884 struct xlgmac_hw_ops *hw_ops = &pdata->hw_ops; in xlgmac_set_features()
887 rxhash = pdata->netdev_features & NETIF_F_RXHASH; in xlgmac_set_features()
888 rxcsum = pdata->netdev_features & NETIF_F_RXCSUM; in xlgmac_set_features()
889 rxvlan = pdata->netdev_features & NETIF_F_HW_VLAN_CTAG_RX; in xlgmac_set_features()
890 rxvlan_filter = pdata->netdev_features & NETIF_F_HW_VLAN_CTAG_FILTER; in xlgmac_set_features()
893 ret = hw_ops->enable_rss(pdata); in xlgmac_set_features()
895 ret = hw_ops->disable_rss(pdata); in xlgmac_set_features()
900 hw_ops->enable_rx_csum(pdata); in xlgmac_set_features()
902 hw_ops->disable_rx_csum(pdata); in xlgmac_set_features()
905 hw_ops->enable_rx_vlan_stripping(pdata); in xlgmac_set_features()
907 hw_ops->disable_rx_vlan_stripping(pdata); in xlgmac_set_features()
910 hw_ops->enable_rx_vlan_filtering(pdata); in xlgmac_set_features()
912 hw_ops->disable_rx_vlan_filtering(pdata); in xlgmac_set_features()
914 pdata->netdev_features = features; in xlgmac_set_features()
921 struct xlgmac_pdata *pdata = netdev_priv(netdev); in xlgmac_set_rx_mode() local
922 struct xlgmac_hw_ops *hw_ops = &pdata->hw_ops; in xlgmac_set_rx_mode()
924 hw_ops->config_rx_mode(pdata); in xlgmac_set_rx_mode()
953 struct xlgmac_pdata *pdata = channel->pdata; in xlgmac_rx_refresh() local
959 desc_ops = &pdata->desc_ops; in xlgmac_rx_refresh()
960 hw_ops = &pdata->hw_ops; in xlgmac_rx_refresh()
966 desc_ops->unmap_desc_data(pdata, desc_data); in xlgmac_rx_refresh()
968 if (desc_ops->map_rx_buffer(pdata, ring, desc_data)) in xlgmac_rx_refresh()
971 hw_ops->rx_desc_reset(pdata, desc_data, ring->dirty); in xlgmac_rx_refresh()
987 static struct sk_buff *xlgmac_create_skb(struct xlgmac_pdata *pdata, in xlgmac_create_skb() argument
1003 dma_sync_single_range_for_cpu(pdata->dev, desc_data->rx.hdr.dma_base, in xlgmac_create_skb()
1018 dma_sync_single_range_for_cpu(pdata->dev, in xlgmac_create_skb()
1036 struct xlgmac_pdata *pdata = channel->pdata; in xlgmac_tx_poll() local
1038 struct net_device *netdev = pdata->netdev; in xlgmac_tx_poll()
1048 desc_ops = &pdata->desc_ops; in xlgmac_tx_poll()
1049 hw_ops = &pdata->hw_ops; in xlgmac_tx_poll()
1075 if (netif_msg_tx_done(pdata)) in xlgmac_tx_poll()
1076 xlgmac_dump_tx_desc(pdata, ring, ring->dirty, 1, 0); in xlgmac_tx_poll()
1084 desc_ops->unmap_desc_data(pdata, desc_data); in xlgmac_tx_poll()
1109 struct xlgmac_pdata *pdata = channel->pdata; in xlgmac_rx_poll() local
1111 struct net_device *netdev = pdata->netdev; in xlgmac_rx_poll()
1123 hw_ops = &pdata->hw_ops; in xlgmac_rx_poll()
1132 napi = (pdata->per_channel_irq) ? &channel->napi : &pdata->napi; in xlgmac_rx_poll()
1180 netif_err(pdata, rx_err, netdev, in xlgmac_rx_poll()
1192 skb = xlgmac_create_skb(pdata, napi, desc_data, in xlgmac_rx_poll()
1198 pdata->dev, in xlgmac_rx_poll()
1227 netif_err(pdata, rx_err, netdev, in xlgmac_rx_poll()
1233 if (netif_msg_pktdata(pdata)) in xlgmac_rx_poll()
1247 pdata->stats.rx_vlan_packets++; in xlgmac_rx_poll()
1311 struct xlgmac_pdata *pdata = container_of(napi, in xlgmac_all_poll() local
1322 ring_budget = budget / pdata->rx_ring_count; in xlgmac_all_poll()
1326 channel = pdata->channel_head; in xlgmac_all_poll()
1327 for (i = 0; i < pdata->channel_count; i++, channel++) { in xlgmac_all_poll()
1344 xlgmac_enable_rx_tx_ints(pdata); in xlgmac_all_poll()