Lines Matching +full:tx +full:- +full:port +full:- +full:mapping

1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
2 /* Copyright 2017-2019 NXP */
8 #include <linux/dma-mapping.h>
19 #define ENETC_MAX_MTU (ENETC_MAC_MAXFRM_SIZE - \
47 (SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - ENETC_RXB_PAD)
49 (SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - XDP_PACKET_HEADROOM)
61 /* max # of chained Tx BDs is 15, including head and extension BD */
91 struct device *dev; /* for DMA mapping */
96 void *bd_base; /* points to Rx or Tx BD ring */
107 struct device *dev; /* for DMA mapping */
109 void *bd_base; /* points to Rx or Tx BD ring */
124 void __iomem *tcir; /* Tx */
145 if (unlikely(++*i == bdr->bd_count)) in enetc_bdr_idx_inc()
151 if (bdr->next_to_clean > bdr->next_to_use) in enetc_bd_unused()
152 return bdr->next_to_clean - bdr->next_to_use - 1; in enetc_bd_unused()
154 return bdr->bd_count + bdr->next_to_clean - bdr->next_to_use - 1; in enetc_bd_unused()
159 if (bdr->next_to_clean > bdr->next_to_alloc) in enetc_swbd_unused()
160 return bdr->next_to_clean - bdr->next_to_alloc - 1; in enetc_swbd_unused()
162 return bdr->bd_count + bdr->next_to_clean - bdr->next_to_alloc - 1; in enetc_swbd_unused()
168 void *bd_base; /* points to Rx or Tx BD ring */
187 if (IS_ENABLED(CONFIG_FSL_ENETC_PTP_CLOCK) && rx_ring->ext_en) in enetc_rxbd()
190 return &(((union enetc_rx_bd *)rx_ring->bd_base)[hw_idx]); in enetc_rxbd()
201 if (IS_ENABLED(CONFIG_FSL_ENETC_PTP_CLOCK) && rx_ring->ext_en) in enetc_rxbd_next()
204 if (unlikely(++new_index == rx_ring->bd_count)) { in enetc_rxbd_next()
205 new_rxbd = rx_ring->bd_base; in enetc_rxbd_next()
261 return !!(si->hw.port); in enetc_si_is_pf()
266 switch (pf_pdev->devfn) { in enetc_pf_to_port()
276 return -1; in enetc_pf_to_port()
316 /* 8 bits reserved for TX timestamp types (hwtstamp_tx_types) */
335 /* activated when int coalescing time is set to a non-0 value */
348 struct device *dev; /* dma-mapping device */
351 int bdr_int_num; /* number of Rx/Tx ring interrupts */
374 /* Minimum number of TX queues required by the network stack */
396 /* VF-PF set primary MAC address message format */
460 struct enetc_cbdr *ring = &si->cbd_ring; in enetc_cbd_alloc_data_mem()
464 data = dma_alloc_coherent(ring->dma_dev, in enetc_cbd_alloc_data_mem()
468 dev_err(ring->dma_dev, "CBD alloc data memory failed!\n"); in enetc_cbd_alloc_data_mem()
475 cbd->addr[0] = cpu_to_le32(lower_32_bits(dma_align)); in enetc_cbd_alloc_data_mem()
476 cbd->addr[1] = cpu_to_le32(upper_32_bits(dma_align)); in enetc_cbd_alloc_data_mem()
477 cbd->length = cpu_to_le16(size); in enetc_cbd_alloc_data_mem()
485 struct enetc_cbdr *ring = &si->cbd_ring; in enetc_cbd_free_data_mem()
487 dma_free_coherent(ring->dma_dev, size + ENETC_CBD_DATA_MEM_ALIGN, in enetc_cbd_free_data_mem()
509 struct enetc_hw *hw = &priv->si->hw; in enetc_get_max_cap()
513 priv->psfp_cap.max_streamid = reg & ENETC_PSIDCAPR_MSK; in enetc_get_max_cap()
514 /* Port stream filter capability */ in enetc_get_max_cap()
516 priv->psfp_cap.max_psfp_filter = reg & ENETC_PSFCAPR_MSK; in enetc_get_max_cap()
517 /* Port stream gate capability */ in enetc_get_max_cap()
519 priv->psfp_cap.max_psfp_gate = (reg & ENETC_PSGCAPR_SGIT_MSK); in enetc_get_max_cap()
520 priv->psfp_cap.max_psfp_gatelist = (reg & ENETC_PSGCAPR_GCL_MSK) >> 16; in enetc_get_max_cap()
521 /* Port flow meter capability */ in enetc_get_max_cap()
523 priv->psfp_cap.max_psfp_meter = reg & ENETC_PFMCAPR_MSK; in enetc_get_max_cap()
528 struct enetc_hw *hw = &priv->si->hw; in enetc_psfp_enable()
546 struct enetc_hw *hw = &priv->si->hw; in enetc_psfp_disable()
557 memset(&priv->psfp_cap, 0, sizeof(struct psfp_cap)); in enetc_psfp_disable()
563 #define enetc_qos_query_caps(ndev, type_data) -EOPNOTSUPP
564 #define enetc_setup_tc_taprio(ndev, type_data) -EOPNOTSUPP
566 #define enetc_setup_tc_cbs(ndev, type_data) -EOPNOTSUPP
567 #define enetc_setup_tc_txtime(ndev, type_data) -EOPNOTSUPP
568 #define enetc_setup_tc_psfp(ndev, type_data) -EOPNOTSUPP
572 memset(&((p)->psfp_cap), 0, sizeof(struct psfp_cap))