Lines Matching +full:mtl +full:- +full:tx +full:- +full:config
9 * Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
59 * Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
129 #include "xgbe-common.h"
176 for (i = 0; i < ARRAY_SIZE(pdata->channel); i++) { in xgbe_free_channels()
177 if (!pdata->channel[i]) in xgbe_free_channels()
180 kfree(pdata->channel[i]->rx_ring); in xgbe_free_channels()
181 kfree(pdata->channel[i]->tx_ring); in xgbe_free_channels()
182 kfree(pdata->channel[i]); in xgbe_free_channels()
184 pdata->channel[i] = NULL; in xgbe_free_channels()
187 pdata->channel_count = 0; in xgbe_free_channels()
198 count = max_t(unsigned int, pdata->tx_ring_count, pdata->rx_ring_count); in xgbe_alloc_channels()
201 cpu = cpumask_local_spread(i, dev_to_node(pdata->dev)); in xgbe_alloc_channels()
209 pdata->channel[i] = channel; in xgbe_alloc_channels()
211 snprintf(channel->name, sizeof(channel->name), "channel-%u", i); in xgbe_alloc_channels()
212 channel->pdata = pdata; in xgbe_alloc_channels()
213 channel->queue_index = i; in xgbe_alloc_channels()
214 channel->dma_regs = pdata->xgmac_regs + DMA_CH_BASE + in xgbe_alloc_channels()
216 channel->node = node; in xgbe_alloc_channels()
217 cpumask_set_cpu(cpu, &channel->affinity_mask); in xgbe_alloc_channels()
219 if (pdata->per_channel_irq) in xgbe_alloc_channels()
220 channel->dma_irq = pdata->channel_irq[i]; in xgbe_alloc_channels()
222 if (i < pdata->tx_ring_count) { in xgbe_alloc_channels()
227 spin_lock_init(&ring->lock); in xgbe_alloc_channels()
228 ring->node = node; in xgbe_alloc_channels()
230 channel->tx_ring = ring; in xgbe_alloc_channels()
233 if (i < pdata->rx_ring_count) { in xgbe_alloc_channels()
238 spin_lock_init(&ring->lock); in xgbe_alloc_channels()
239 ring->node = node; in xgbe_alloc_channels()
241 channel->rx_ring = ring; in xgbe_alloc_channels()
244 netif_dbg(pdata, drv, pdata->netdev, in xgbe_alloc_channels()
245 "%s: cpu=%u, node=%d\n", channel->name, cpu, node); in xgbe_alloc_channels()
247 netif_dbg(pdata, drv, pdata->netdev, in xgbe_alloc_channels()
248 "%s: dma_regs=%p, dma_irq=%d, tx=%p, rx=%p\n", in xgbe_alloc_channels()
249 channel->name, channel->dma_regs, channel->dma_irq, in xgbe_alloc_channels()
250 channel->tx_ring, channel->rx_ring); in xgbe_alloc_channels()
253 pdata->channel_count = count; in xgbe_alloc_channels()
260 return -ENOMEM; in xgbe_alloc_channels()
265 return (ring->rdesc_count - (ring->cur - ring->dirty)); in xgbe_tx_avail_desc()
270 return (ring->cur - ring->dirty); in xgbe_rx_dirty_desc()
276 struct xgbe_prv_data *pdata = channel->pdata; in xgbe_maybe_stop_tx_queue()
279 netif_info(pdata, drv, pdata->netdev, in xgbe_maybe_stop_tx_queue()
280 "Tx queue stopped, not enough descriptors available\n"); in xgbe_maybe_stop_tx_queue()
281 netif_stop_subqueue(pdata->netdev, channel->queue_index); in xgbe_maybe_stop_tx_queue()
282 ring->tx.queue_stopped = 1; in xgbe_maybe_stop_tx_queue()
287 if (ring->tx.xmit_more) in xgbe_maybe_stop_tx_queue()
288 pdata->hw_if.tx_start_xmit(channel, ring); in xgbe_maybe_stop_tx_queue()
303 rx_buf_size = (rx_buf_size + XGBE_RX_BUF_ALIGN - 1) & in xgbe_calc_rx_buf_size()
304 ~(XGBE_RX_BUF_ALIGN - 1); in xgbe_calc_rx_buf_size()
312 struct xgbe_hw_if *hw_if = &pdata->hw_if; in xgbe_enable_rx_tx_int()
315 if (channel->tx_ring && channel->rx_ring) in xgbe_enable_rx_tx_int()
317 else if (channel->tx_ring) in xgbe_enable_rx_tx_int()
319 else if (channel->rx_ring) in xgbe_enable_rx_tx_int()
324 hw_if->enable_int(channel, int_id); in xgbe_enable_rx_tx_int()
331 for (i = 0; i < pdata->channel_count; i++) in xgbe_enable_rx_tx_ints()
332 xgbe_enable_rx_tx_int(pdata, pdata->channel[i]); in xgbe_enable_rx_tx_ints()
338 struct xgbe_hw_if *hw_if = &pdata->hw_if; in xgbe_disable_rx_tx_int()
341 if (channel->tx_ring && channel->rx_ring) in xgbe_disable_rx_tx_int()
343 else if (channel->tx_ring) in xgbe_disable_rx_tx_int()
345 else if (channel->rx_ring) in xgbe_disable_rx_tx_int()
350 hw_if->disable_int(channel, int_id); in xgbe_disable_rx_tx_int()
357 for (i = 0; i < pdata->channel_count; i++) in xgbe_disable_rx_tx_ints()
358 xgbe_disable_rx_tx_int(pdata, pdata->channel[i]); in xgbe_disable_rx_tx_ints()
372 dev_warn_once(pdata->dev, in xgbe_ecc_sec()
377 dev_warn_once(pdata->dev, in xgbe_ecc_sec()
397 netdev_alert(pdata->netdev, in xgbe_ecc_ded()
415 netif_dbg(pdata, intr, pdata->netdev, "ECC_ISR=%#010x\n", ecc_isr); in xgbe_ecc_isr_bh_work()
418 stop |= xgbe_ecc_ded(pdata, &pdata->tx_ded_period, in xgbe_ecc_isr_bh_work()
419 &pdata->tx_ded_count, "TX fifo"); in xgbe_ecc_isr_bh_work()
423 stop |= xgbe_ecc_ded(pdata, &pdata->rx_ded_period, in xgbe_ecc_isr_bh_work()
424 &pdata->rx_ded_count, "RX fifo"); in xgbe_ecc_isr_bh_work()
428 stop |= xgbe_ecc_ded(pdata, &pdata->desc_ded_period, in xgbe_ecc_isr_bh_work()
429 &pdata->desc_ded_count, in xgbe_ecc_isr_bh_work()
434 pdata->hw_if.disable_ecc_ded(pdata); in xgbe_ecc_isr_bh_work()
435 schedule_work(&pdata->stopdev_work); in xgbe_ecc_isr_bh_work()
440 if (xgbe_ecc_sec(pdata, &pdata->tx_sec_period, in xgbe_ecc_isr_bh_work()
441 &pdata->tx_sec_count, "TX fifo")) in xgbe_ecc_isr_bh_work()
442 pdata->hw_if.disable_ecc_sec(pdata, XGBE_ECC_SEC_TX); in xgbe_ecc_isr_bh_work()
446 if (xgbe_ecc_sec(pdata, &pdata->rx_sec_period, in xgbe_ecc_isr_bh_work()
447 &pdata->rx_sec_count, "RX fifo")) in xgbe_ecc_isr_bh_work()
448 pdata->hw_if.disable_ecc_sec(pdata, XGBE_ECC_SEC_RX); in xgbe_ecc_isr_bh_work()
451 if (xgbe_ecc_sec(pdata, &pdata->desc_sec_period, in xgbe_ecc_isr_bh_work()
452 &pdata->desc_sec_count, "descriptor cache")) in xgbe_ecc_isr_bh_work()
453 pdata->hw_if.disable_ecc_sec(pdata, XGBE_ECC_SEC_DESC); in xgbe_ecc_isr_bh_work()
460 if (pdata->vdata->irq_reissue_support) in xgbe_ecc_isr_bh_work()
468 if (pdata->isr_as_bh_work) in xgbe_ecc_isr()
469 queue_work(system_bh_wq, &pdata->ecc_bh_work); in xgbe_ecc_isr()
471 xgbe_ecc_isr_bh_work(&pdata->ecc_bh_work); in xgbe_ecc_isr()
479 struct xgbe_hw_if *hw_if = &pdata->hw_if; in xgbe_isr_bh_work()
485 /* The DMA interrupt status register also reports MAC and MTL in xgbe_isr_bh_work()
487 * this register to be non-zero in xgbe_isr_bh_work()
493 netif_dbg(pdata, intr, pdata->netdev, "DMA_ISR=%#010x\n", dma_isr); in xgbe_isr_bh_work()
495 for (i = 0; i < pdata->channel_count; i++) { in xgbe_isr_bh_work()
499 channel = pdata->channel[i]; in xgbe_isr_bh_work()
502 netif_dbg(pdata, intr, pdata->netdev, "DMA_CH%u_ISR=%#010x\n", in xgbe_isr_bh_work()
509 if (!pdata->per_channel_irq && in xgbe_isr_bh_work()
512 if (napi_schedule_prep(&pdata->napi)) { in xgbe_isr_bh_work()
513 /* Disable Tx and Rx interrupts */ in xgbe_isr_bh_work()
517 __napi_schedule(&pdata->napi); in xgbe_isr_bh_work()
520 /* Don't clear Rx/Tx status if doing per channel DMA in xgbe_isr_bh_work()
529 pdata->ext_stats.rx_buffer_unavailable++; in xgbe_isr_bh_work()
533 schedule_work(&pdata->restart_work); in xgbe_isr_bh_work()
542 netif_dbg(pdata, intr, pdata->netdev, "MAC_ISR=%#010x\n", in xgbe_isr_bh_work()
546 hw_if->tx_mmc_int(pdata); in xgbe_isr_bh_work()
549 hw_if->rx_mmc_int(pdata); in xgbe_isr_bh_work()
554 netif_dbg(pdata, intr, pdata->netdev, in xgbe_isr_bh_work()
558 /* Read Tx Timestamp to clear interrupt */ in xgbe_isr_bh_work()
559 pdata->tx_tstamp = in xgbe_isr_bh_work()
560 hw_if->get_tx_tstamp(pdata); in xgbe_isr_bh_work()
561 queue_work(pdata->dev_workqueue, in xgbe_isr_bh_work()
562 &pdata->tx_tstamp_work); in xgbe_isr_bh_work()
569 netif_dbg(pdata, intr, pdata->netdev, in xgbe_isr_bh_work()
574 complete(&pdata->mdio_complete); in xgbe_isr_bh_work()
580 if (pdata->dev_irq == pdata->an_irq) in xgbe_isr_bh_work()
581 pdata->phy_if.an_isr(pdata); in xgbe_isr_bh_work()
584 if (pdata->vdata->ecc_support && (pdata->dev_irq == pdata->ecc_irq)) in xgbe_isr_bh_work()
585 xgbe_ecc_isr_bh_work(&pdata->ecc_bh_work); in xgbe_isr_bh_work()
588 if (pdata->vdata->i2c_support && (pdata->dev_irq == pdata->i2c_irq)) in xgbe_isr_bh_work()
589 pdata->i2c_if.i2c_isr(pdata); in xgbe_isr_bh_work()
592 if (pdata->vdata->irq_reissue_support) { in xgbe_isr_bh_work()
596 if (!pdata->per_channel_irq) in xgbe_isr_bh_work()
607 if (pdata->isr_as_bh_work) in xgbe_isr()
608 queue_work(system_bh_wq, &pdata->dev_bh_work); in xgbe_isr()
610 xgbe_isr_bh_work(&pdata->dev_bh_work); in xgbe_isr()
618 struct xgbe_prv_data *pdata = channel->pdata; in xgbe_dma_isr()
624 if (napi_schedule_prep(&channel->napi)) { in xgbe_dma_isr()
625 /* Disable Tx and Rx interrupts */ in xgbe_dma_isr()
626 if (pdata->channel_irq_mode) in xgbe_dma_isr()
629 disable_irq_nosync(channel->dma_irq); in xgbe_dma_isr()
632 __napi_schedule_irqoff(&channel->napi); in xgbe_dma_isr()
635 /* Clear Tx/Rx signals */ in xgbe_dma_isr()
647 struct xgbe_prv_data *pdata = channel->pdata; in xgbe_tx_timer()
650 DBGPR("-->xgbe_tx_timer\n"); in xgbe_tx_timer()
652 napi = (pdata->per_channel_irq) ? &channel->napi : &pdata->napi; in xgbe_tx_timer()
655 /* Disable Tx and Rx interrupts */ in xgbe_tx_timer()
656 if (pdata->per_channel_irq) in xgbe_tx_timer()
657 if (pdata->channel_irq_mode) in xgbe_tx_timer()
660 disable_irq_nosync(channel->dma_irq); in xgbe_tx_timer()
668 channel->tx_timer_active = 0; in xgbe_tx_timer()
670 DBGPR("<--xgbe_tx_timer\n"); in xgbe_tx_timer()
679 pdata->phy_if.phy_status(pdata); in xgbe_service()
688 queue_work(pdata->dev_workqueue, &pdata->service_work); in xgbe_service_timer()
690 mod_timer(&pdata->service_timer, jiffies + HZ); in xgbe_service_timer()
692 if (!pdata->tx_usecs) in xgbe_service_timer()
695 for (i = 0; i < pdata->channel_count; i++) { in xgbe_service_timer()
696 channel = pdata->channel[i]; in xgbe_service_timer()
697 if (!channel->tx_ring || channel->tx_timer_active) in xgbe_service_timer()
699 channel->tx_timer_active = 1; in xgbe_service_timer()
700 mod_timer(&channel->tx_timer, in xgbe_service_timer()
701 jiffies + usecs_to_jiffies(pdata->tx_usecs)); in xgbe_service_timer()
710 timer_setup(&pdata->service_timer, xgbe_service_timer, 0); in xgbe_init_timers()
712 for (i = 0; i < pdata->channel_count; i++) { in xgbe_init_timers()
713 channel = pdata->channel[i]; in xgbe_init_timers()
714 if (!channel->tx_ring) in xgbe_init_timers()
717 timer_setup(&channel->tx_timer, xgbe_tx_timer, 0); in xgbe_init_timers()
723 mod_timer(&pdata->service_timer, jiffies + HZ); in xgbe_start_timers()
731 del_timer_sync(&pdata->service_timer); in xgbe_stop_timers()
733 for (i = 0; i < pdata->channel_count; i++) { in xgbe_stop_timers()
734 channel = pdata->channel[i]; in xgbe_stop_timers()
735 if (!channel->tx_ring) in xgbe_stop_timers()
738 /* Deactivate the Tx timer */ in xgbe_stop_timers()
739 del_timer_sync(&channel->tx_timer); in xgbe_stop_timers()
740 channel->tx_timer_active = 0; in xgbe_stop_timers()
747 struct xgbe_hw_features *hw_feat = &pdata->hw_feat; in xgbe_get_all_hw_features()
755 hw_feat->version = XGMAC_IOREAD(pdata, MAC_VR); in xgbe_get_all_hw_features()
758 hw_feat->gmii = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, GMIISEL); in xgbe_get_all_hw_features()
759 hw_feat->vlhash = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, VLHASH); in xgbe_get_all_hw_features()
760 hw_feat->sma = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, SMASEL); in xgbe_get_all_hw_features()
761 hw_feat->rwk = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, RWKSEL); in xgbe_get_all_hw_features()
762 hw_feat->mgk = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, MGKSEL); in xgbe_get_all_hw_features()
763 hw_feat->mmc = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, MMCSEL); in xgbe_get_all_hw_features()
764 hw_feat->aoe = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, ARPOFFSEL); in xgbe_get_all_hw_features()
765 hw_feat->ts = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, TSSEL); in xgbe_get_all_hw_features()
766 hw_feat->eee = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, EEESEL); in xgbe_get_all_hw_features()
767 hw_feat->tx_coe = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, TXCOESEL); in xgbe_get_all_hw_features()
768 hw_feat->rx_coe = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, RXCOESEL); in xgbe_get_all_hw_features()
769 hw_feat->addn_mac = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, in xgbe_get_all_hw_features()
771 hw_feat->ts_src = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, TSSTSSEL); in xgbe_get_all_hw_features()
772 hw_feat->sa_vlan_ins = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, SAVLANINS); in xgbe_get_all_hw_features()
773 hw_feat->vxn = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, VXN); in xgbe_get_all_hw_features()
776 hw_feat->rx_fifo_size = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, in xgbe_get_all_hw_features()
778 hw_feat->tx_fifo_size = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, in xgbe_get_all_hw_features()
780 hw_feat->adv_ts_hi = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, ADVTHWORD); in xgbe_get_all_hw_features()
781 hw_feat->dma_width = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, ADDR64); in xgbe_get_all_hw_features()
782 hw_feat->dcb = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, DCBEN); in xgbe_get_all_hw_features()
783 hw_feat->sph = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, SPHEN); in xgbe_get_all_hw_features()
784 hw_feat->tso = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, TSOEN); in xgbe_get_all_hw_features()
785 hw_feat->dma_debug = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, DBGMEMA); in xgbe_get_all_hw_features()
786 hw_feat->rss = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, RSSEN); in xgbe_get_all_hw_features()
787 hw_feat->tc_cnt = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, NUMTC); in xgbe_get_all_hw_features()
788 hw_feat->hash_table_size = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, in xgbe_get_all_hw_features()
790 hw_feat->l3l4_filter_num = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, in xgbe_get_all_hw_features()
794 hw_feat->rx_q_cnt = XGMAC_GET_BITS(mac_hfr2, MAC_HWF2R, RXQCNT); in xgbe_get_all_hw_features()
795 hw_feat->tx_q_cnt = XGMAC_GET_BITS(mac_hfr2, MAC_HWF2R, TXQCNT); in xgbe_get_all_hw_features()
796 hw_feat->rx_ch_cnt = XGMAC_GET_BITS(mac_hfr2, MAC_HWF2R, RXCHCNT); in xgbe_get_all_hw_features()
797 hw_feat->tx_ch_cnt = XGMAC_GET_BITS(mac_hfr2, MAC_HWF2R, TXCHCNT); in xgbe_get_all_hw_features()
798 hw_feat->pps_out_num = XGMAC_GET_BITS(mac_hfr2, MAC_HWF2R, PPSOUTNUM); in xgbe_get_all_hw_features()
799 hw_feat->aux_snap_num = XGMAC_GET_BITS(mac_hfr2, MAC_HWF2R, AUXSNAPNUM); in xgbe_get_all_hw_features()
802 switch (hw_feat->hash_table_size) { in xgbe_get_all_hw_features()
806 hw_feat->hash_table_size = 64; in xgbe_get_all_hw_features()
809 hw_feat->hash_table_size = 128; in xgbe_get_all_hw_features()
812 hw_feat->hash_table_size = 256; in xgbe_get_all_hw_features()
817 switch (hw_feat->dma_width) { in xgbe_get_all_hw_features()
819 hw_feat->dma_width = 32; in xgbe_get_all_hw_features()
822 hw_feat->dma_width = 40; in xgbe_get_all_hw_features()
825 hw_feat->dma_width = 48; in xgbe_get_all_hw_features()
828 hw_feat->dma_width = 32; in xgbe_get_all_hw_features()
834 hw_feat->rx_q_cnt++; in xgbe_get_all_hw_features()
835 hw_feat->tx_q_cnt++; in xgbe_get_all_hw_features()
836 hw_feat->rx_ch_cnt++; in xgbe_get_all_hw_features()
837 hw_feat->tx_ch_cnt++; in xgbe_get_all_hw_features()
838 hw_feat->tc_cnt++; in xgbe_get_all_hw_features()
841 hw_feat->rx_fifo_size = 1 << (hw_feat->rx_fifo_size + 7); in xgbe_get_all_hw_features()
842 hw_feat->tx_fifo_size = 1 << (hw_feat->tx_fifo_size + 7); in xgbe_get_all_hw_features()
845 dev_dbg(pdata->dev, "Hardware features:\n"); in xgbe_get_all_hw_features()
848 dev_dbg(pdata->dev, " 1GbE support : %s\n", in xgbe_get_all_hw_features()
849 hw_feat->gmii ? "yes" : "no"); in xgbe_get_all_hw_features()
850 dev_dbg(pdata->dev, " VLAN hash filter : %s\n", in xgbe_get_all_hw_features()
851 hw_feat->vlhash ? "yes" : "no"); in xgbe_get_all_hw_features()
852 dev_dbg(pdata->dev, " MDIO interface : %s\n", in xgbe_get_all_hw_features()
853 hw_feat->sma ? "yes" : "no"); in xgbe_get_all_hw_features()
854 dev_dbg(pdata->dev, " Wake-up packet support : %s\n", in xgbe_get_all_hw_features()
855 hw_feat->rwk ? "yes" : "no"); in xgbe_get_all_hw_features()
856 dev_dbg(pdata->dev, " Magic packet support : %s\n", in xgbe_get_all_hw_features()
857 hw_feat->mgk ? "yes" : "no"); in xgbe_get_all_hw_features()
858 dev_dbg(pdata->dev, " Management counters : %s\n", in xgbe_get_all_hw_features()
859 hw_feat->mmc ? "yes" : "no"); in xgbe_get_all_hw_features()
860 dev_dbg(pdata->dev, " ARP offload : %s\n", in xgbe_get_all_hw_features()
861 hw_feat->aoe ? "yes" : "no"); in xgbe_get_all_hw_features()
862 dev_dbg(pdata->dev, " IEEE 1588-2008 Timestamp : %s\n", in xgbe_get_all_hw_features()
863 hw_feat->ts ? "yes" : "no"); in xgbe_get_all_hw_features()
864 dev_dbg(pdata->dev, " Energy Efficient Ethernet : %s\n", in xgbe_get_all_hw_features()
865 hw_feat->eee ? "yes" : "no"); in xgbe_get_all_hw_features()
866 dev_dbg(pdata->dev, " TX checksum offload : %s\n", in xgbe_get_all_hw_features()
867 hw_feat->tx_coe ? "yes" : "no"); in xgbe_get_all_hw_features()
868 dev_dbg(pdata->dev, " RX checksum offload : %s\n", in xgbe_get_all_hw_features()
869 hw_feat->rx_coe ? "yes" : "no"); in xgbe_get_all_hw_features()
870 dev_dbg(pdata->dev, " Additional MAC addresses : %u\n", in xgbe_get_all_hw_features()
871 hw_feat->addn_mac); in xgbe_get_all_hw_features()
872 dev_dbg(pdata->dev, " Timestamp source : %s\n", in xgbe_get_all_hw_features()
873 (hw_feat->ts_src == 1) ? "internal" : in xgbe_get_all_hw_features()
874 (hw_feat->ts_src == 2) ? "external" : in xgbe_get_all_hw_features()
875 (hw_feat->ts_src == 3) ? "internal/external" : "n/a"); in xgbe_get_all_hw_features()
876 dev_dbg(pdata->dev, " SA/VLAN insertion : %s\n", in xgbe_get_all_hw_features()
877 hw_feat->sa_vlan_ins ? "yes" : "no"); in xgbe_get_all_hw_features()
878 dev_dbg(pdata->dev, " VXLAN/NVGRE support : %s\n", in xgbe_get_all_hw_features()
879 hw_feat->vxn ? "yes" : "no"); in xgbe_get_all_hw_features()
882 dev_dbg(pdata->dev, " RX fifo size : %u\n", in xgbe_get_all_hw_features()
883 hw_feat->rx_fifo_size); in xgbe_get_all_hw_features()
884 dev_dbg(pdata->dev, " TX fifo size : %u\n", in xgbe_get_all_hw_features()
885 hw_feat->tx_fifo_size); in xgbe_get_all_hw_features()
886 dev_dbg(pdata->dev, " IEEE 1588 high word : %s\n", in xgbe_get_all_hw_features()
887 hw_feat->adv_ts_hi ? "yes" : "no"); in xgbe_get_all_hw_features()
888 dev_dbg(pdata->dev, " DMA width : %u\n", in xgbe_get_all_hw_features()
889 hw_feat->dma_width); in xgbe_get_all_hw_features()
890 dev_dbg(pdata->dev, " Data Center Bridging : %s\n", in xgbe_get_all_hw_features()
891 hw_feat->dcb ? "yes" : "no"); in xgbe_get_all_hw_features()
892 dev_dbg(pdata->dev, " Split header : %s\n", in xgbe_get_all_hw_features()
893 hw_feat->sph ? "yes" : "no"); in xgbe_get_all_hw_features()
894 dev_dbg(pdata->dev, " TCP Segmentation Offload : %s\n", in xgbe_get_all_hw_features()
895 hw_feat->tso ? "yes" : "no"); in xgbe_get_all_hw_features()
896 dev_dbg(pdata->dev, " Debug memory interface : %s\n", in xgbe_get_all_hw_features()
897 hw_feat->dma_debug ? "yes" : "no"); in xgbe_get_all_hw_features()
898 dev_dbg(pdata->dev, " Receive Side Scaling : %s\n", in xgbe_get_all_hw_features()
899 hw_feat->rss ? "yes" : "no"); in xgbe_get_all_hw_features()
900 dev_dbg(pdata->dev, " Traffic Class count : %u\n", in xgbe_get_all_hw_features()
901 hw_feat->tc_cnt); in xgbe_get_all_hw_features()
902 dev_dbg(pdata->dev, " Hash table size : %u\n", in xgbe_get_all_hw_features()
903 hw_feat->hash_table_size); in xgbe_get_all_hw_features()
904 dev_dbg(pdata->dev, " L3/L4 Filters : %u\n", in xgbe_get_all_hw_features()
905 hw_feat->l3l4_filter_num); in xgbe_get_all_hw_features()
908 dev_dbg(pdata->dev, " RX queue count : %u\n", in xgbe_get_all_hw_features()
909 hw_feat->rx_q_cnt); in xgbe_get_all_hw_features()
910 dev_dbg(pdata->dev, " TX queue count : %u\n", in xgbe_get_all_hw_features()
911 hw_feat->tx_q_cnt); in xgbe_get_all_hw_features()
912 dev_dbg(pdata->dev, " RX DMA channel count : %u\n", in xgbe_get_all_hw_features()
913 hw_feat->rx_ch_cnt); in xgbe_get_all_hw_features()
914 dev_dbg(pdata->dev, " TX DMA channel count : %u\n", in xgbe_get_all_hw_features()
915 hw_feat->rx_ch_cnt); in xgbe_get_all_hw_features()
916 dev_dbg(pdata->dev, " PPS outputs : %u\n", in xgbe_get_all_hw_features()
917 hw_feat->pps_out_num); in xgbe_get_all_hw_features()
918 dev_dbg(pdata->dev, " Auxiliary snapshot inputs : %u\n", in xgbe_get_all_hw_features()
919 hw_feat->aux_snap_num); in xgbe_get_all_hw_features()
928 pdata->vxlan_port = be16_to_cpu(ti->port); in xgbe_vxlan_set_port()
929 pdata->hw_if.enable_vxlan(pdata); in xgbe_vxlan_set_port()
939 pdata->hw_if.disable_vxlan(pdata); in xgbe_vxlan_unset_port()
940 pdata->vxlan_port = 0; in xgbe_vxlan_unset_port()
964 if (pdata->per_channel_irq) { in xgbe_napi_enable()
965 for (i = 0; i < pdata->channel_count; i++) { in xgbe_napi_enable()
966 channel = pdata->channel[i]; in xgbe_napi_enable()
968 netif_napi_add(pdata->netdev, &channel->napi, in xgbe_napi_enable()
971 napi_enable(&channel->napi); in xgbe_napi_enable()
975 netif_napi_add(pdata->netdev, &pdata->napi, in xgbe_napi_enable()
978 napi_enable(&pdata->napi); in xgbe_napi_enable()
987 if (pdata->per_channel_irq) { in xgbe_napi_disable()
988 for (i = 0; i < pdata->channel_count; i++) { in xgbe_napi_disable()
989 channel = pdata->channel[i]; in xgbe_napi_disable()
990 napi_disable(&channel->napi); in xgbe_napi_disable()
993 netif_napi_del(&channel->napi); in xgbe_napi_disable()
996 napi_disable(&pdata->napi); in xgbe_napi_disable()
999 netif_napi_del(&pdata->napi); in xgbe_napi_disable()
1006 struct net_device *netdev = pdata->netdev; in xgbe_request_irqs()
1010 INIT_WORK(&pdata->dev_bh_work, xgbe_isr_bh_work); in xgbe_request_irqs()
1011 INIT_WORK(&pdata->ecc_bh_work, xgbe_ecc_isr_bh_work); in xgbe_request_irqs()
1013 ret = devm_request_irq(pdata->dev, pdata->dev_irq, xgbe_isr, 0, in xgbe_request_irqs()
1017 pdata->dev_irq); in xgbe_request_irqs()
1021 if (pdata->vdata->ecc_support && (pdata->dev_irq != pdata->ecc_irq)) { in xgbe_request_irqs()
1022 ret = devm_request_irq(pdata->dev, pdata->ecc_irq, xgbe_ecc_isr, in xgbe_request_irqs()
1023 0, pdata->ecc_name, pdata); in xgbe_request_irqs()
1026 pdata->ecc_irq); in xgbe_request_irqs()
1031 if (!pdata->per_channel_irq) in xgbe_request_irqs()
1034 for (i = 0; i < pdata->channel_count; i++) { in xgbe_request_irqs()
1035 channel = pdata->channel[i]; in xgbe_request_irqs()
1036 snprintf(channel->dma_irq_name, in xgbe_request_irqs()
1037 sizeof(channel->dma_irq_name) - 1, in xgbe_request_irqs()
1038 "%s-TxRx-%u", netdev_name(netdev), in xgbe_request_irqs()
1039 channel->queue_index); in xgbe_request_irqs()
1041 ret = devm_request_irq(pdata->dev, channel->dma_irq, in xgbe_request_irqs()
1043 channel->dma_irq_name, channel); in xgbe_request_irqs()
1046 channel->dma_irq); in xgbe_request_irqs()
1050 irq_set_affinity_hint(channel->dma_irq, in xgbe_request_irqs()
1051 &channel->affinity_mask); in xgbe_request_irqs()
1058 for (i--; i < pdata->channel_count; i--) { in xgbe_request_irqs()
1059 channel = pdata->channel[i]; in xgbe_request_irqs()
1061 irq_set_affinity_hint(channel->dma_irq, NULL); in xgbe_request_irqs()
1062 devm_free_irq(pdata->dev, channel->dma_irq, channel); in xgbe_request_irqs()
1065 if (pdata->vdata->ecc_support && (pdata->dev_irq != pdata->ecc_irq)) in xgbe_request_irqs()
1066 devm_free_irq(pdata->dev, pdata->ecc_irq, pdata); in xgbe_request_irqs()
1069 devm_free_irq(pdata->dev, pdata->dev_irq, pdata); in xgbe_request_irqs()
1079 devm_free_irq(pdata->dev, pdata->dev_irq, pdata); in xgbe_free_irqs()
1081 cancel_work_sync(&pdata->dev_bh_work); in xgbe_free_irqs()
1082 cancel_work_sync(&pdata->ecc_bh_work); in xgbe_free_irqs()
1084 if (pdata->vdata->ecc_support && (pdata->dev_irq != pdata->ecc_irq)) in xgbe_free_irqs()
1085 devm_free_irq(pdata->dev, pdata->ecc_irq, pdata); in xgbe_free_irqs()
1087 if (!pdata->per_channel_irq) in xgbe_free_irqs()
1090 for (i = 0; i < pdata->channel_count; i++) { in xgbe_free_irqs()
1091 channel = pdata->channel[i]; in xgbe_free_irqs()
1093 irq_set_affinity_hint(channel->dma_irq, NULL); in xgbe_free_irqs()
1094 devm_free_irq(pdata->dev, channel->dma_irq, channel); in xgbe_free_irqs()
1100 struct xgbe_hw_if *hw_if = &pdata->hw_if; in xgbe_init_tx_coalesce()
1102 DBGPR("-->xgbe_init_tx_coalesce\n"); in xgbe_init_tx_coalesce()
1104 pdata->tx_usecs = XGMAC_INIT_DMA_TX_USECS; in xgbe_init_tx_coalesce()
1105 pdata->tx_frames = XGMAC_INIT_DMA_TX_FRAMES; in xgbe_init_tx_coalesce()
1107 hw_if->config_tx_coalesce(pdata); in xgbe_init_tx_coalesce()
1109 DBGPR("<--xgbe_init_tx_coalesce\n"); in xgbe_init_tx_coalesce()
1114 struct xgbe_hw_if *hw_if = &pdata->hw_if; in xgbe_init_rx_coalesce()
1116 DBGPR("-->xgbe_init_rx_coalesce\n"); in xgbe_init_rx_coalesce()
1118 pdata->rx_riwt = hw_if->usec_to_riwt(pdata, XGMAC_INIT_DMA_RX_USECS); in xgbe_init_rx_coalesce()
1119 pdata->rx_usecs = XGMAC_INIT_DMA_RX_USECS; in xgbe_init_rx_coalesce()
1120 pdata->rx_frames = XGMAC_INIT_DMA_RX_FRAMES; in xgbe_init_rx_coalesce()
1122 hw_if->config_rx_coalesce(pdata); in xgbe_init_rx_coalesce()
1124 DBGPR("<--xgbe_init_rx_coalesce\n"); in xgbe_init_rx_coalesce()
1129 struct xgbe_desc_if *desc_if = &pdata->desc_if; in xgbe_free_tx_data()
1134 DBGPR("-->xgbe_free_tx_data\n"); in xgbe_free_tx_data()
1136 for (i = 0; i < pdata->channel_count; i++) { in xgbe_free_tx_data()
1137 ring = pdata->channel[i]->tx_ring; in xgbe_free_tx_data()
1141 for (j = 0; j < ring->rdesc_count; j++) { in xgbe_free_tx_data()
1143 desc_if->unmap_rdata(pdata, rdata); in xgbe_free_tx_data()
1147 DBGPR("<--xgbe_free_tx_data\n"); in xgbe_free_tx_data()
1152 struct xgbe_desc_if *desc_if = &pdata->desc_if; in xgbe_free_rx_data()
1157 DBGPR("-->xgbe_free_rx_data\n"); in xgbe_free_rx_data()
1159 for (i = 0; i < pdata->channel_count; i++) { in xgbe_free_rx_data()
1160 ring = pdata->channel[i]->rx_ring; in xgbe_free_rx_data()
1164 for (j = 0; j < ring->rdesc_count; j++) { in xgbe_free_rx_data()
1166 desc_if->unmap_rdata(pdata, rdata); in xgbe_free_rx_data()
1170 DBGPR("<--xgbe_free_rx_data\n"); in xgbe_free_rx_data()
1175 pdata->phy_link = -1; in xgbe_phy_reset()
1176 pdata->phy_speed = SPEED_UNKNOWN; in xgbe_phy_reset()
1178 return pdata->phy_if.phy_reset(pdata); in xgbe_phy_reset()
1184 struct xgbe_hw_if *hw_if = &pdata->hw_if; in xgbe_powerdown()
1187 DBGPR("-->xgbe_powerdown\n"); in xgbe_powerdown()
1190 (caller == XGMAC_IOCTL_CONTEXT && pdata->power_down)) { in xgbe_powerdown()
1192 DBGPR("<--xgbe_powerdown\n"); in xgbe_powerdown()
1193 return -EINVAL; in xgbe_powerdown()
1196 spin_lock_irqsave(&pdata->lock, flags); in xgbe_powerdown()
1204 flush_workqueue(pdata->dev_workqueue); in xgbe_powerdown()
1206 hw_if->powerdown_tx(pdata); in xgbe_powerdown()
1207 hw_if->powerdown_rx(pdata); in xgbe_powerdown()
1211 pdata->power_down = 1; in xgbe_powerdown()
1213 spin_unlock_irqrestore(&pdata->lock, flags); in xgbe_powerdown()
1215 DBGPR("<--xgbe_powerdown\n"); in xgbe_powerdown()
1223 struct xgbe_hw_if *hw_if = &pdata->hw_if; in xgbe_powerup()
1226 DBGPR("-->xgbe_powerup\n"); in xgbe_powerup()
1229 (caller == XGMAC_IOCTL_CONTEXT && !pdata->power_down)) { in xgbe_powerup()
1231 DBGPR("<--xgbe_powerup\n"); in xgbe_powerup()
1232 return -EINVAL; in xgbe_powerup()
1235 spin_lock_irqsave(&pdata->lock, flags); in xgbe_powerup()
1237 pdata->power_down = 0; in xgbe_powerup()
1241 hw_if->powerup_tx(pdata); in xgbe_powerup()
1242 hw_if->powerup_rx(pdata); in xgbe_powerup()
1251 spin_unlock_irqrestore(&pdata->lock, flags); in xgbe_powerup()
1253 DBGPR("<--xgbe_powerup\n"); in xgbe_powerup()
1260 struct xgbe_desc_if *desc_if = &pdata->desc_if; in xgbe_free_memory()
1263 desc_if->free_ring_resources(pdata); in xgbe_free_memory()
1271 struct xgbe_desc_if *desc_if = &pdata->desc_if; in xgbe_alloc_memory()
1272 struct net_device *netdev = pdata->netdev; in xgbe_alloc_memory()
1275 if (pdata->new_tx_ring_count) { in xgbe_alloc_memory()
1276 pdata->tx_ring_count = pdata->new_tx_ring_count; in xgbe_alloc_memory()
1277 pdata->tx_q_count = pdata->tx_ring_count; in xgbe_alloc_memory()
1278 pdata->new_tx_ring_count = 0; in xgbe_alloc_memory()
1281 if (pdata->new_rx_ring_count) { in xgbe_alloc_memory()
1282 pdata->rx_ring_count = pdata->new_rx_ring_count; in xgbe_alloc_memory()
1283 pdata->new_rx_ring_count = 0; in xgbe_alloc_memory()
1287 pdata->rx_buf_size = xgbe_calc_rx_buf_size(netdev, netdev->mtu); in xgbe_alloc_memory()
1295 ret = desc_if->alloc_ring_resources(pdata); in xgbe_alloc_memory()
1299 /* Initialize the service and Tx timers */ in xgbe_alloc_memory()
1312 struct xgbe_hw_if *hw_if = &pdata->hw_if; in xgbe_start()
1313 struct xgbe_phy_if *phy_if = &pdata->phy_if; in xgbe_start()
1314 struct net_device *netdev = pdata->netdev; in xgbe_start()
1319 ret = netif_set_real_num_tx_queues(netdev, pdata->tx_ring_count); in xgbe_start()
1321 netdev_err(netdev, "error setting real tx queue count\n"); in xgbe_start()
1325 ret = netif_set_real_num_rx_queues(netdev, pdata->rx_ring_count); in xgbe_start()
1333 XGMAC_SET_BITS(pdata->rss_table[i], MAC_RSSDR, DMCH, in xgbe_start()
1334 i % pdata->rx_ring_count); in xgbe_start()
1336 ret = hw_if->init(pdata); in xgbe_start()
1346 ret = phy_if->phy_start(pdata); in xgbe_start()
1350 hw_if->enable_tx(pdata); in xgbe_start()
1351 hw_if->enable_rx(pdata); in xgbe_start()
1358 queue_work(pdata->dev_workqueue, &pdata->service_work); in xgbe_start()
1360 clear_bit(XGBE_STOPPED, &pdata->dev_state); in xgbe_start()
1370 hw_if->exit(pdata); in xgbe_start()
1377 struct xgbe_hw_if *hw_if = &pdata->hw_if; in xgbe_stop()
1378 struct xgbe_phy_if *phy_if = &pdata->phy_if; in xgbe_stop()
1380 struct net_device *netdev = pdata->netdev; in xgbe_stop()
1384 DBGPR("-->xgbe_stop\n"); in xgbe_stop()
1386 if (test_bit(XGBE_STOPPED, &pdata->dev_state)) in xgbe_stop()
1390 netif_carrier_off(pdata->netdev); in xgbe_stop()
1393 flush_workqueue(pdata->dev_workqueue); in xgbe_stop()
1397 hw_if->disable_tx(pdata); in xgbe_stop()
1398 hw_if->disable_rx(pdata); in xgbe_stop()
1400 phy_if->phy_stop(pdata); in xgbe_stop()
1406 hw_if->exit(pdata); in xgbe_stop()
1408 for (i = 0; i < pdata->channel_count; i++) { in xgbe_stop()
1409 channel = pdata->channel[i]; in xgbe_stop()
1410 if (!channel->tx_ring) in xgbe_stop()
1413 txq = netdev_get_tx_queue(netdev, channel->queue_index); in xgbe_stop()
1417 set_bit(XGBE_STOPPED, &pdata->dev_state); in xgbe_stop()
1419 DBGPR("<--xgbe_stop\n"); in xgbe_stop()
1437 netdev_alert(pdata->netdev, "device stopped\n"); in xgbe_stopdev()
1443 if (!netif_running(pdata->netdev)) in xgbe_full_restart_dev()
1457 if (!netif_running(pdata->netdev)) in xgbe_restart_dev()
1490 spin_lock_irqsave(&pdata->tstamp_lock, flags); in xgbe_tx_tstamp()
1491 if (!pdata->tx_tstamp_skb) in xgbe_tx_tstamp()
1494 if (pdata->tx_tstamp) { in xgbe_tx_tstamp()
1495 nsec = timecounter_cyc2time(&pdata->tstamp_tc, in xgbe_tx_tstamp()
1496 pdata->tx_tstamp); in xgbe_tx_tstamp()
1500 skb_tstamp_tx(pdata->tx_tstamp_skb, &hwtstamps); in xgbe_tx_tstamp()
1503 dev_kfree_skb_any(pdata->tx_tstamp_skb); in xgbe_tx_tstamp()
1505 pdata->tx_tstamp_skb = NULL; in xgbe_tx_tstamp()
1508 spin_unlock_irqrestore(&pdata->tstamp_lock, flags); in xgbe_tx_tstamp()
1514 if (copy_to_user(ifreq->ifr_data, &pdata->tstamp_config, in xgbe_get_hwtstamp_settings()
1515 sizeof(pdata->tstamp_config))) in xgbe_get_hwtstamp_settings()
1516 return -EFAULT; in xgbe_get_hwtstamp_settings()
1524 struct hwtstamp_config config; in xgbe_set_hwtstamp_settings() local
1527 if (copy_from_user(&config, ifreq->ifr_data, sizeof(config))) in xgbe_set_hwtstamp_settings()
1528 return -EFAULT; in xgbe_set_hwtstamp_settings()
1532 switch (config.tx_type) { in xgbe_set_hwtstamp_settings()
1541 return -ERANGE; in xgbe_set_hwtstamp_settings()
1544 switch (config.rx_filter) { in xgbe_set_hwtstamp_settings()
1642 return -ERANGE; in xgbe_set_hwtstamp_settings()
1645 pdata->hw_if.config_tstamp(pdata, mac_tscr); in xgbe_set_hwtstamp_settings()
1647 memcpy(&pdata->tstamp_config, &config, sizeof(config)); in xgbe_set_hwtstamp_settings()
1658 if (XGMAC_GET_BITS(packet->attributes, TX_PACKET_ATTRIBUTES, PTP)) { in xgbe_prep_tx_tstamp()
1659 spin_lock_irqsave(&pdata->tstamp_lock, flags); in xgbe_prep_tx_tstamp()
1660 if (pdata->tx_tstamp_skb) { in xgbe_prep_tx_tstamp()
1662 XGMAC_SET_BITS(packet->attributes, in xgbe_prep_tx_tstamp()
1665 pdata->tx_tstamp_skb = skb_get(skb); in xgbe_prep_tx_tstamp()
1666 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; in xgbe_prep_tx_tstamp()
1668 spin_unlock_irqrestore(&pdata->tstamp_lock, flags); in xgbe_prep_tx_tstamp()
1677 packet->vlan_ctag = skb_vlan_tag_get(skb); in xgbe_prep_vlan()
1684 if (!XGMAC_GET_BITS(packet->attributes, TX_PACKET_ATTRIBUTES, in xgbe_prep_tso()
1692 if (XGMAC_GET_BITS(packet->attributes, TX_PACKET_ATTRIBUTES, VXLAN)) { in xgbe_prep_tso()
1693 packet->header_len = skb_inner_tcp_all_headers(skb); in xgbe_prep_tso()
1694 packet->tcp_header_len = inner_tcp_hdrlen(skb); in xgbe_prep_tso()
1696 packet->header_len = skb_tcp_all_headers(skb); in xgbe_prep_tso()
1697 packet->tcp_header_len = tcp_hdrlen(skb); in xgbe_prep_tso()
1699 packet->tcp_payload_len = skb->len - packet->header_len; in xgbe_prep_tso()
1700 packet->mss = skb_shinfo(skb)->gso_size; in xgbe_prep_tso()
1702 DBGPR(" packet->header_len=%u\n", packet->header_len); in xgbe_prep_tso()
1703 DBGPR(" packet->tcp_header_len=%u, packet->tcp_payload_len=%u\n", in xgbe_prep_tso()
1704 packet->tcp_header_len, packet->tcp_payload_len); in xgbe_prep_tso()
1705 DBGPR(" packet->mss=%u\n", packet->mss); in xgbe_prep_tso()
1710 packet->tx_packets = skb_shinfo(skb)->gso_segs; in xgbe_prep_tso()
1711 packet->tx_bytes += (packet->tx_packets - 1) * packet->header_len; in xgbe_prep_tso()
1718 if (!skb->encapsulation) in xgbe_is_vxlan()
1721 if (skb->ip_summed != CHECKSUM_PARTIAL) in xgbe_is_vxlan()
1724 switch (skb->protocol) { in xgbe_is_vxlan()
1726 if (ip_hdr(skb)->protocol != IPPROTO_UDP) in xgbe_is_vxlan()
1731 if (ipv6_hdr(skb)->nexthdr != IPPROTO_UDP) in xgbe_is_vxlan()
1739 if (skb->inner_protocol_type != ENCAP_TYPE_ETHER || in xgbe_is_vxlan()
1740 skb->inner_protocol != htons(ETH_P_TEB) || in xgbe_is_vxlan()
1741 (skb_inner_mac_header(skb) - skb_transport_header(skb) != in xgbe_is_vxlan()
1750 if (skb->ip_summed != CHECKSUM_PARTIAL) in xgbe_is_tso()
1770 packet->skb = skb; in xgbe_packet_info()
1773 packet->rdesc_count = 0; in xgbe_packet_info()
1775 packet->tx_packets = 1; in xgbe_packet_info()
1776 packet->tx_bytes = skb->len; in xgbe_packet_info()
1780 if (skb_shinfo(skb)->gso_size != ring->tx.cur_mss) { in xgbe_packet_info()
1782 packet->rdesc_count++; in xgbe_packet_info()
1786 packet->rdesc_count++; in xgbe_packet_info()
1788 XGMAC_SET_BITS(packet->attributes, TX_PACKET_ATTRIBUTES, in xgbe_packet_info()
1790 XGMAC_SET_BITS(packet->attributes, TX_PACKET_ATTRIBUTES, in xgbe_packet_info()
1792 } else if (skb->ip_summed == CHECKSUM_PARTIAL) in xgbe_packet_info()
1793 XGMAC_SET_BITS(packet->attributes, TX_PACKET_ATTRIBUTES, in xgbe_packet_info()
1797 XGMAC_SET_BITS(packet->attributes, TX_PACKET_ATTRIBUTES, in xgbe_packet_info()
1802 if (skb_vlan_tag_get(skb) != ring->tx.cur_vlan_ctag) in xgbe_packet_info()
1806 packet->rdesc_count++; in xgbe_packet_info()
1809 XGMAC_SET_BITS(packet->attributes, TX_PACKET_ATTRIBUTES, in xgbe_packet_info()
1813 if ((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && in xgbe_packet_info()
1814 (pdata->tstamp_config.tx_type == HWTSTAMP_TX_ON)) in xgbe_packet_info()
1815 XGMAC_SET_BITS(packet->attributes, TX_PACKET_ATTRIBUTES, in xgbe_packet_info()
1819 packet->rdesc_count++; in xgbe_packet_info()
1820 len -= min_t(unsigned int, len, XGBE_TX_MAX_BUF_SIZE); in xgbe_packet_info()
1823 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { in xgbe_packet_info()
1824 frag = &skb_shinfo(skb)->frags[i]; in xgbe_packet_info()
1826 packet->rdesc_count++; in xgbe_packet_info()
1827 len -= min_t(unsigned int, len, XGBE_TX_MAX_BUF_SIZE); in xgbe_packet_info()
1838 snprintf(pdata->an_name, sizeof(pdata->an_name) - 1, "%s-pcs", in xgbe_open()
1841 snprintf(pdata->ecc_name, sizeof(pdata->ecc_name) - 1, "%s-ecc", in xgbe_open()
1844 snprintf(pdata->i2c_name, sizeof(pdata->i2c_name) - 1, "%s-i2c", in xgbe_open()
1848 pdata->dev_workqueue = in xgbe_open()
1850 if (!pdata->dev_workqueue) { in xgbe_open()
1852 return -ENOMEM; in xgbe_open()
1855 pdata->an_workqueue = in xgbe_open()
1856 create_singlethread_workqueue(pdata->an_name); in xgbe_open()
1857 if (!pdata->an_workqueue) { in xgbe_open()
1859 ret = -ENOMEM; in xgbe_open()
1869 ret = clk_prepare_enable(pdata->sysclk); in xgbe_open()
1875 ret = clk_prepare_enable(pdata->ptpclk); in xgbe_open()
1881 INIT_WORK(&pdata->service_work, xgbe_service); in xgbe_open()
1882 INIT_WORK(&pdata->restart_work, xgbe_restart); in xgbe_open()
1883 INIT_WORK(&pdata->stopdev_work, xgbe_stopdev); in xgbe_open()
1884 INIT_WORK(&pdata->tx_tstamp_work, xgbe_tx_tstamp); in xgbe_open()
1894 clear_bit(XGBE_DOWN, &pdata->dev_state); in xgbe_open()
1902 clk_disable_unprepare(pdata->ptpclk); in xgbe_open()
1905 clk_disable_unprepare(pdata->sysclk); in xgbe_open()
1908 destroy_workqueue(pdata->an_workqueue); in xgbe_open()
1911 destroy_workqueue(pdata->dev_workqueue); in xgbe_open()
1926 clk_disable_unprepare(pdata->ptpclk); in xgbe_close()
1927 clk_disable_unprepare(pdata->sysclk); in xgbe_close()
1929 destroy_workqueue(pdata->an_workqueue); in xgbe_close()
1931 destroy_workqueue(pdata->dev_workqueue); in xgbe_close()
1933 set_bit(XGBE_DOWN, &pdata->dev_state); in xgbe_close()
1941 struct xgbe_hw_if *hw_if = &pdata->hw_if; in xgbe_xmit()
1942 struct xgbe_desc_if *desc_if = &pdata->desc_if; in xgbe_xmit()
1949 DBGPR("-->xgbe_xmit: skb->len = %d\n", skb->len); in xgbe_xmit()
1951 channel = pdata->channel[skb->queue_mapping]; in xgbe_xmit()
1952 txq = netdev_get_tx_queue(netdev, channel->queue_index); in xgbe_xmit()
1953 ring = channel->tx_ring; in xgbe_xmit()
1954 packet = &ring->packet_data; in xgbe_xmit()
1958 if (skb->len == 0) { in xgbe_xmit()
1970 ret = xgbe_maybe_stop_tx_queue(channel, ring, packet->rdesc_count); in xgbe_xmit()
1983 if (!desc_if->map_tx_skb(channel, skb)) { in xgbe_xmit()
1991 netdev_tx_sent_queue(txq, packet->tx_bytes); in xgbe_xmit()
1994 hw_if->dev_xmit(channel); in xgbe_xmit()
2011 struct xgbe_hw_if *hw_if = &pdata->hw_if; in xgbe_set_rx_mode()
2013 DBGPR("-->xgbe_set_rx_mode\n"); in xgbe_set_rx_mode()
2015 hw_if->config_rx_mode(pdata); in xgbe_set_rx_mode()
2017 DBGPR("<--xgbe_set_rx_mode\n"); in xgbe_set_rx_mode()
2023 struct xgbe_hw_if *hw_if = &pdata->hw_if; in xgbe_set_mac_address()
2026 DBGPR("-->xgbe_set_mac_address\n"); in xgbe_set_mac_address()
2028 if (!is_valid_ether_addr(saddr->sa_data)) in xgbe_set_mac_address()
2029 return -EADDRNOTAVAIL; in xgbe_set_mac_address()
2031 eth_hw_addr_set(netdev, saddr->sa_data); in xgbe_set_mac_address()
2033 hw_if->set_mac_address(pdata, netdev->dev_addr); in xgbe_set_mac_address()
2035 DBGPR("<--xgbe_set_mac_address\n"); in xgbe_set_mac_address()
2055 ret = -EOPNOTSUPP; in xgbe_ioctl()
2066 DBGPR("-->xgbe_change_mtu\n"); in xgbe_change_mtu()
2072 pdata->rx_buf_size = ret; in xgbe_change_mtu()
2073 WRITE_ONCE(netdev->mtu, mtu); in xgbe_change_mtu()
2077 DBGPR("<--xgbe_change_mtu\n"); in xgbe_change_mtu()
2086 netdev_warn(netdev, "tx timeout, device restarting\n"); in xgbe_tx_timeout()
2087 schedule_work(&pdata->restart_work); in xgbe_tx_timeout()
2094 struct xgbe_mmc_stats *pstats = &pdata->mmc_stats; in xgbe_get_stats64()
2096 DBGPR("-->%s\n", __func__); in xgbe_get_stats64()
2098 pdata->hw_if.read_mmc_stats(pdata); in xgbe_get_stats64()
2100 s->rx_packets = pstats->rxframecount_gb; in xgbe_get_stats64()
2101 s->rx_bytes = pstats->rxoctetcount_gb; in xgbe_get_stats64()
2102 s->rx_errors = pstats->rxframecount_gb - in xgbe_get_stats64()
2103 pstats->rxbroadcastframes_g - in xgbe_get_stats64()
2104 pstats->rxmulticastframes_g - in xgbe_get_stats64()
2105 pstats->rxunicastframes_g; in xgbe_get_stats64()
2106 s->multicast = pstats->rxmulticastframes_g; in xgbe_get_stats64()
2107 s->rx_length_errors = pstats->rxlengtherror; in xgbe_get_stats64()
2108 s->rx_crc_errors = pstats->rxcrcerror; in xgbe_get_stats64()
2109 s->rx_fifo_errors = pstats->rxfifooverflow; in xgbe_get_stats64()
2111 s->tx_packets = pstats->txframecount_gb; in xgbe_get_stats64()
2112 s->tx_bytes = pstats->txoctetcount_gb; in xgbe_get_stats64()
2113 s->tx_errors = pstats->txframecount_gb - pstats->txframecount_g; in xgbe_get_stats64()
2114 s->tx_dropped = netdev->stats.tx_dropped; in xgbe_get_stats64()
2116 DBGPR("<--%s\n", __func__); in xgbe_get_stats64()
2123 struct xgbe_hw_if *hw_if = &pdata->hw_if; in xgbe_vlan_rx_add_vid()
2125 DBGPR("-->%s\n", __func__); in xgbe_vlan_rx_add_vid()
2127 set_bit(vid, pdata->active_vlans); in xgbe_vlan_rx_add_vid()
2128 hw_if->update_vlan_hash_table(pdata); in xgbe_vlan_rx_add_vid()
2130 DBGPR("<--%s\n", __func__); in xgbe_vlan_rx_add_vid()
2139 struct xgbe_hw_if *hw_if = &pdata->hw_if; in xgbe_vlan_rx_kill_vid()
2141 DBGPR("-->%s\n", __func__); in xgbe_vlan_rx_kill_vid()
2143 clear_bit(vid, pdata->active_vlans); in xgbe_vlan_rx_kill_vid()
2144 hw_if->update_vlan_hash_table(pdata); in xgbe_vlan_rx_kill_vid()
2146 DBGPR("<--%s\n", __func__); in xgbe_vlan_rx_kill_vid()
2158 DBGPR("-->xgbe_poll_controller\n"); in xgbe_poll_controller()
2160 if (pdata->per_channel_irq) { in xgbe_poll_controller()
2161 for (i = 0; i < pdata->channel_count; i++) { in xgbe_poll_controller()
2162 channel = pdata->channel[i]; in xgbe_poll_controller()
2163 xgbe_dma_isr(channel->dma_irq, channel); in xgbe_poll_controller()
2166 disable_irq(pdata->dev_irq); in xgbe_poll_controller()
2167 xgbe_isr(pdata->dev_irq, pdata); in xgbe_poll_controller()
2168 enable_irq(pdata->dev_irq); in xgbe_poll_controller()
2171 DBGPR("<--xgbe_poll_controller\n"); in xgbe_poll_controller()
2183 return -EOPNOTSUPP; in xgbe_setup_tc()
2185 mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS; in xgbe_setup_tc()
2186 tc = mqprio->num_tc; in xgbe_setup_tc()
2188 if (tc > pdata->hw_feat.tc_cnt) in xgbe_setup_tc()
2189 return -EINVAL; in xgbe_setup_tc()
2191 pdata->num_tcs = tc; in xgbe_setup_tc()
2192 pdata->hw_if.config_tc(pdata); in xgbe_setup_tc()
2205 if (!pdata->hw_feat.vxn) in xgbe_fix_features()
2212 "forcing tx udp tunnel support\n"); in xgbe_fix_features()
2219 "forcing both tx and rx udp tunnel support\n"); in xgbe_fix_features()
2226 "forcing tx udp tunnel checksumming on\n"); in xgbe_fix_features()
2232 "forcing tx udp tunnel checksumming off\n"); in xgbe_fix_features()
2244 struct xgbe_hw_if *hw_if = &pdata->hw_if; in xgbe_set_features()
2248 rxhash = pdata->netdev_features & NETIF_F_RXHASH; in xgbe_set_features()
2249 rxcsum = pdata->netdev_features & NETIF_F_RXCSUM; in xgbe_set_features()
2250 rxvlan = pdata->netdev_features & NETIF_F_HW_VLAN_CTAG_RX; in xgbe_set_features()
2251 rxvlan_filter = pdata->netdev_features & NETIF_F_HW_VLAN_CTAG_FILTER; in xgbe_set_features()
2254 ret = hw_if->enable_rss(pdata); in xgbe_set_features()
2256 ret = hw_if->disable_rss(pdata); in xgbe_set_features()
2261 hw_if->enable_rx_csum(pdata); in xgbe_set_features()
2263 hw_if->disable_rx_csum(pdata); in xgbe_set_features()
2266 hw_if->enable_rx_vlan_stripping(pdata); in xgbe_set_features()
2268 hw_if->disable_rx_vlan_stripping(pdata); in xgbe_set_features()
2271 hw_if->enable_rx_vlan_filtering(pdata); in xgbe_set_features()
2273 hw_if->disable_rx_vlan_filtering(pdata); in xgbe_set_features()
2275 pdata->netdev_features = features; in xgbe_set_features()
2277 DBGPR("<--xgbe_set_features\n"); in xgbe_set_features()
2321 struct xgbe_prv_data *pdata = channel->pdata; in xgbe_rx_refresh()
2322 struct xgbe_hw_if *hw_if = &pdata->hw_if; in xgbe_rx_refresh()
2323 struct xgbe_desc_if *desc_if = &pdata->desc_if; in xgbe_rx_refresh()
2324 struct xgbe_ring *ring = channel->rx_ring; in xgbe_rx_refresh()
2327 while (ring->dirty != ring->cur) { in xgbe_rx_refresh()
2328 rdata = XGBE_GET_DESC_DATA(ring, ring->dirty); in xgbe_rx_refresh()
2331 desc_if->unmap_rdata(pdata, rdata); in xgbe_rx_refresh()
2333 if (desc_if->map_rx_buffer(pdata, ring, rdata)) in xgbe_rx_refresh()
2336 hw_if->rx_desc_reset(pdata, rdata, ring->dirty); in xgbe_rx_refresh()
2338 ring->dirty++; in xgbe_rx_refresh()
2346 rdata = XGBE_GET_DESC_DATA(ring, ring->dirty - 1); in xgbe_rx_refresh()
2348 lower_32_bits(rdata->rdesc_dma)); in xgbe_rx_refresh()
2359 skb = napi_alloc_skb(napi, rdata->rx.hdr.dma_len); in xgbe_create_skb()
2366 dma_sync_single_range_for_cpu(pdata->dev, rdata->rx.hdr.dma_base, in xgbe_create_skb()
2367 rdata->rx.hdr.dma_off, in xgbe_create_skb()
2368 rdata->rx.hdr.dma_len, DMA_FROM_DEVICE); in xgbe_create_skb()
2370 packet = page_address(rdata->rx.hdr.pa.pages) + in xgbe_create_skb()
2371 rdata->rx.hdr.pa.pages_offset; in xgbe_create_skb()
2382 if (!XGMAC_GET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, FIRST)) in xgbe_rx_buf1_len()
2386 if (rdata->rx.hdr_len) in xgbe_rx_buf1_len()
2387 return rdata->rx.hdr_len; in xgbe_rx_buf1_len()
2392 if (!XGMAC_GET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, LAST)) in xgbe_rx_buf1_len()
2393 return rdata->rx.hdr.dma_len; in xgbe_rx_buf1_len()
2398 return min_t(unsigned int, rdata->rx.hdr.dma_len, rdata->rx.len); in xgbe_rx_buf1_len()
2406 if (!XGMAC_GET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, LAST)) in xgbe_rx_buf2_len()
2407 return rdata->rx.buf.dma_len; in xgbe_rx_buf2_len()
2412 return rdata->rx.len - len; in xgbe_rx_buf2_len()
2417 struct xgbe_prv_data *pdata = channel->pdata; in xgbe_tx_poll()
2418 struct xgbe_hw_if *hw_if = &pdata->hw_if; in xgbe_tx_poll()
2419 struct xgbe_desc_if *desc_if = &pdata->desc_if; in xgbe_tx_poll()
2420 struct xgbe_ring *ring = channel->tx_ring; in xgbe_tx_poll()
2423 struct net_device *netdev = pdata->netdev; in xgbe_tx_poll()
2429 DBGPR("-->xgbe_tx_poll\n"); in xgbe_tx_poll()
2431 /* Nothing to do if there isn't a Tx ring for this channel */ in xgbe_tx_poll()
2435 cur = ring->cur; in xgbe_tx_poll()
2437 /* Be sure we get ring->cur before accessing descriptor data */ in xgbe_tx_poll()
2440 txq = netdev_get_tx_queue(netdev, channel->queue_index); in xgbe_tx_poll()
2443 (ring->dirty != cur)) { in xgbe_tx_poll()
2444 rdata = XGBE_GET_DESC_DATA(ring, ring->dirty); in xgbe_tx_poll()
2445 rdesc = rdata->rdesc; in xgbe_tx_poll()
2447 if (!hw_if->tx_complete(rdesc)) in xgbe_tx_poll()
2455 xgbe_dump_tx_desc(pdata, ring, ring->dirty, 1, 0); in xgbe_tx_poll()
2457 if (hw_if->is_last_desc(rdesc)) { in xgbe_tx_poll()
2458 tx_packets += rdata->tx.packets; in xgbe_tx_poll()
2459 tx_bytes += rdata->tx.bytes; in xgbe_tx_poll()
2462 /* Free the SKB and reset the descriptor for re-use */ in xgbe_tx_poll()
2463 desc_if->unmap_rdata(pdata, rdata); in xgbe_tx_poll()
2464 hw_if->tx_desc_reset(rdata); in xgbe_tx_poll()
2467 ring->dirty++; in xgbe_tx_poll()
2475 if ((ring->tx.queue_stopped == 1) && in xgbe_tx_poll()
2477 ring->tx.queue_stopped = 0; in xgbe_tx_poll()
2481 DBGPR("<--xgbe_tx_poll: processed=%d\n", processed); in xgbe_tx_poll()
2488 struct xgbe_prv_data *pdata = channel->pdata; in xgbe_rx_poll()
2489 struct xgbe_hw_if *hw_if = &pdata->hw_if; in xgbe_rx_poll()
2490 struct xgbe_ring *ring = channel->rx_ring; in xgbe_rx_poll()
2493 struct net_device *netdev = pdata->netdev; in xgbe_rx_poll()
2502 DBGPR("-->xgbe_rx_poll: budget=%d\n", budget); in xgbe_rx_poll()
2511 napi = (pdata->per_channel_irq) ? &channel->napi : &pdata->napi; in xgbe_rx_poll()
2513 rdata = XGBE_GET_DESC_DATA(ring, ring->cur); in xgbe_rx_poll()
2514 packet = &ring->packet_data; in xgbe_rx_poll()
2516 DBGPR(" cur = %d\n", ring->cur); in xgbe_rx_poll()
2519 if (!received && rdata->state_saved) { in xgbe_rx_poll()
2520 skb = rdata->state.skb; in xgbe_rx_poll()
2521 error = rdata->state.error; in xgbe_rx_poll()
2522 len = rdata->state.len; in xgbe_rx_poll()
2531 rdata = XGBE_GET_DESC_DATA(ring, ring->cur); in xgbe_rx_poll()
2536 if (hw_if->dev_read(channel)) in xgbe_rx_poll()
2540 ring->cur++; in xgbe_rx_poll()
2542 last = XGMAC_GET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, in xgbe_rx_poll()
2544 context_next = XGMAC_GET_BITS(packet->attributes, in xgbe_rx_poll()
2547 context = XGMAC_GET_BITS(packet->attributes, in xgbe_rx_poll()
2555 if (error || packet->errors) { in xgbe_rx_poll()
2556 if (packet->errors) in xgbe_rx_poll()
2570 if (buf2_len > rdata->rx.buf.dma_len) { in xgbe_rx_poll()
2588 dma_sync_single_range_for_cpu(pdata->dev, in xgbe_rx_poll()
2589 rdata->rx.buf.dma_base, in xgbe_rx_poll()
2590 rdata->rx.buf.dma_off, in xgbe_rx_poll()
2591 rdata->rx.buf.dma_len, in xgbe_rx_poll()
2594 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, in xgbe_rx_poll()
2595 rdata->rx.buf.pa.pages, in xgbe_rx_poll()
2596 rdata->rx.buf.pa.pages_offset, in xgbe_rx_poll()
2598 rdata->rx.buf.dma_len); in xgbe_rx_poll()
2599 rdata->rx.buf.pa.pages = NULL; in xgbe_rx_poll()
2613 max_len = netdev->mtu + ETH_HLEN; in xgbe_rx_poll()
2614 if (!(netdev->features & NETIF_F_HW_VLAN_CTAG_RX) && in xgbe_rx_poll()
2615 (skb->protocol == htons(ETH_P_8021Q))) in xgbe_rx_poll()
2618 if (skb->len > max_len) { in xgbe_rx_poll()
2629 if (XGMAC_GET_BITS(packet->attributes, in xgbe_rx_poll()
2631 skb->ip_summed = CHECKSUM_UNNECESSARY; in xgbe_rx_poll()
2633 if (XGMAC_GET_BITS(packet->attributes, in xgbe_rx_poll()
2635 skb->encapsulation = 1; in xgbe_rx_poll()
2637 if (XGMAC_GET_BITS(packet->attributes, in xgbe_rx_poll()
2639 skb->csum_level = 1; in xgbe_rx_poll()
2642 if (XGMAC_GET_BITS(packet->attributes, in xgbe_rx_poll()
2645 packet->vlan_ctag); in xgbe_rx_poll()
2647 if (XGMAC_GET_BITS(packet->attributes, in xgbe_rx_poll()
2651 nsec = timecounter_cyc2time(&pdata->tstamp_tc, in xgbe_rx_poll()
2652 packet->rx_tstamp); in xgbe_rx_poll()
2654 hwtstamps->hwtstamp = ns_to_ktime(nsec); in xgbe_rx_poll()
2657 if (XGMAC_GET_BITS(packet->attributes, in xgbe_rx_poll()
2659 skb_set_hash(skb, packet->rss_hash, in xgbe_rx_poll()
2660 packet->rss_hash_type); in xgbe_rx_poll()
2662 skb->dev = netdev; in xgbe_rx_poll()
2663 skb->protocol = eth_type_trans(skb, netdev); in xgbe_rx_poll()
2664 skb_record_rx_queue(skb, channel->queue_index); in xgbe_rx_poll()
2674 rdata = XGBE_GET_DESC_DATA(ring, ring->cur); in xgbe_rx_poll()
2675 rdata->state_saved = 1; in xgbe_rx_poll()
2676 rdata->state.skb = skb; in xgbe_rx_poll()
2677 rdata->state.len = len; in xgbe_rx_poll()
2678 rdata->state.error = error; in xgbe_rx_poll()
2681 DBGPR("<--xgbe_rx_poll: packet_count = %d\n", packet_count); in xgbe_rx_poll()
2690 struct xgbe_prv_data *pdata = channel->pdata; in xgbe_one_poll()
2693 DBGPR("-->xgbe_one_poll: budget=%d\n", budget); in xgbe_one_poll()
2695 /* Cleanup Tx ring first */ in xgbe_one_poll()
2703 /* Enable Tx and Rx interrupts */ in xgbe_one_poll()
2704 if (pdata->channel_irq_mode) in xgbe_one_poll()
2707 enable_irq(channel->dma_irq); in xgbe_one_poll()
2710 DBGPR("<--xgbe_one_poll: received = %d\n", processed); in xgbe_one_poll()
2724 DBGPR("-->xgbe_all_poll: budget=%d\n", budget); in xgbe_all_poll()
2727 ring_budget = budget / pdata->rx_ring_count; in xgbe_all_poll()
2731 for (i = 0; i < pdata->channel_count; i++) { in xgbe_all_poll()
2732 channel = pdata->channel[i]; in xgbe_all_poll()
2734 /* Cleanup Tx ring first */ in xgbe_all_poll()
2738 if (ring_budget > (budget - processed)) in xgbe_all_poll()
2739 ring_budget = budget - processed; in xgbe_all_poll()
2746 /* Enable Tx and Rx interrupts */ in xgbe_all_poll()
2750 DBGPR("<--xgbe_all_poll: received = %d\n", processed); in xgbe_all_poll()
2761 while (count--) { in xgbe_dump_tx_desc()
2763 rdesc = rdata->rdesc; in xgbe_dump_tx_desc()
2764 netdev_dbg(pdata->netdev, in xgbe_dump_tx_desc()
2766 (flag == 1) ? "QUEUED FOR TX" : "TX BY DEVICE", in xgbe_dump_tx_desc()
2767 le32_to_cpu(rdesc->desc0), in xgbe_dump_tx_desc()
2768 le32_to_cpu(rdesc->desc1), in xgbe_dump_tx_desc()
2769 le32_to_cpu(rdesc->desc2), in xgbe_dump_tx_desc()
2770 le32_to_cpu(rdesc->desc3)); in xgbe_dump_tx_desc()
2782 rdesc = rdata->rdesc; in xgbe_dump_rx_desc()
2783 netdev_dbg(pdata->netdev, in xgbe_dump_rx_desc()
2785 idx, le32_to_cpu(rdesc->desc0), le32_to_cpu(rdesc->desc1), in xgbe_dump_rx_desc()
2786 le32_to_cpu(rdesc->desc2), le32_to_cpu(rdesc->desc3)); in xgbe_dump_rx_desc()
2791 struct ethhdr *eth = (struct ethhdr *)skb->data; in xgbe_print_pkt()
2798 (tx_rx ? "TX" : "RX"), skb->len); in xgbe_print_pkt()
2800 netdev_dbg(netdev, "Dst MAC addr: %pM\n", eth->h_dest); in xgbe_print_pkt()
2801 netdev_dbg(netdev, "Src MAC addr: %pM\n", eth->h_source); in xgbe_print_pkt()
2802 netdev_dbg(netdev, "Protocol: %#06x\n", ntohs(eth->h_proto)); in xgbe_print_pkt()
2804 for (i = 0; i < skb->len; i += 32) { in xgbe_print_pkt()
2805 unsigned int len = min(skb->len - i, 32U); in xgbe_print_pkt()
2807 hex_dump_to_buffer(&skb->data[i], len, 32, 1, in xgbe_print_pkt()