Lines Matching +full:tx +full:- +full:queues +full:- +full:to +full:- +full:use
4 * This file is available to you under your choice of the following two
9 * Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
28 * Inc. unless otherwise expressly agreed to in writing between Synopsys
34 * granted, free of charge, to any person obtaining a copy of this software
35 * annotated with this license and the Software, to deal in the Software
36 * without restriction, including without limitation the rights to use,
38 * of the Software, and to permit persons to whom the Software is furnished
39 * to do so, subject to the following conditions:
46 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
49 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
50 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
53 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
59 * Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
62 * Redistribution and use in source and binary forms, with or without
70 * names of its contributors may be used to endorse or promote products
74 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
78 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
79 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
81 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
88 * Inc. unless otherwise expressly agreed to in writing between Synopsys
94 * granted, free of charge, to any person obtaining a copy of this software
95 * annotated with this license and the Software, to deal in the Software
96 * without restriction, including without limitation the rights to use,
98 * of the Software, and to permit persons to whom the Software is furnished
99 * to do so, subject to the following conditions:
106 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
109 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
110 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
113 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
126 #include "xgbe-common.h"
132 static int debug = -1;
141 DBGPR("-->xgbe_default_config\n"); in xgbe_default_config()
143 pdata->blen = DMA_SBMR_BLEN_64; in xgbe_default_config()
144 pdata->pbl = DMA_PBL_128; in xgbe_default_config()
145 pdata->aal = 1; in xgbe_default_config()
146 pdata->rd_osr_limit = 8; in xgbe_default_config()
147 pdata->wr_osr_limit = 8; in xgbe_default_config()
148 pdata->tx_sf_mode = MTL_TSF_ENABLE; in xgbe_default_config()
149 pdata->tx_threshold = MTL_TX_THRESHOLD_64; in xgbe_default_config()
150 pdata->tx_osp_mode = DMA_OSP_ENABLE; in xgbe_default_config()
151 pdata->rx_sf_mode = MTL_RSF_DISABLE; in xgbe_default_config()
152 pdata->rx_threshold = MTL_RX_THRESHOLD_64; in xgbe_default_config()
153 pdata->pause_autoneg = 1; in xgbe_default_config()
154 pdata->tx_pause = 1; in xgbe_default_config()
155 pdata->rx_pause = 1; in xgbe_default_config()
156 pdata->phy_speed = SPEED_UNKNOWN; in xgbe_default_config()
157 pdata->power_down = 0; in xgbe_default_config()
159 DBGPR("<--xgbe_default_config\n"); in xgbe_default_config()
164 xgbe_init_function_ptrs_dev(&pdata->hw_if); in xgbe_init_all_fptrs()
165 xgbe_init_function_ptrs_phy(&pdata->phy_if); in xgbe_init_all_fptrs()
166 xgbe_init_function_ptrs_i2c(&pdata->i2c_if); in xgbe_init_all_fptrs()
167 xgbe_init_function_ptrs_desc(&pdata->desc_if); in xgbe_init_all_fptrs()
169 pdata->vdata->init_function_ptrs_phy_impl(&pdata->phy_if); in xgbe_init_all_fptrs()
181 return ERR_PTR(-ENOMEM); in xgbe_alloc_pdata()
185 pdata->netdev = netdev; in xgbe_alloc_pdata()
186 pdata->dev = dev; in xgbe_alloc_pdata()
188 spin_lock_init(&pdata->lock); in xgbe_alloc_pdata()
189 spin_lock_init(&pdata->xpcs_lock); in xgbe_alloc_pdata()
190 mutex_init(&pdata->rss_mutex); in xgbe_alloc_pdata()
191 spin_lock_init(&pdata->tstamp_lock); in xgbe_alloc_pdata()
192 mutex_init(&pdata->i2c_mutex); in xgbe_alloc_pdata()
193 init_completion(&pdata->i2c_complete); in xgbe_alloc_pdata()
194 init_completion(&pdata->mdio_complete); in xgbe_alloc_pdata()
196 pdata->msg_enable = netif_msg_init(debug, default_msg_level); in xgbe_alloc_pdata()
198 set_bit(XGBE_DOWN, &pdata->dev_state); in xgbe_alloc_pdata()
199 set_bit(XGBE_STOPPED, &pdata->dev_state); in xgbe_alloc_pdata()
206 struct net_device *netdev = pdata->netdev; in xgbe_free_pdata()
220 if (!pdata->tx_max_channel_count) in xgbe_set_counts()
221 pdata->tx_max_channel_count = pdata->hw_feat.tx_ch_cnt; in xgbe_set_counts()
222 if (!pdata->rx_max_channel_count) in xgbe_set_counts()
223 pdata->rx_max_channel_count = pdata->hw_feat.rx_ch_cnt; in xgbe_set_counts()
225 if (!pdata->tx_max_q_count) in xgbe_set_counts()
226 pdata->tx_max_q_count = pdata->hw_feat.tx_q_cnt; in xgbe_set_counts()
227 if (!pdata->rx_max_q_count) in xgbe_set_counts()
228 pdata->rx_max_q_count = pdata->hw_feat.rx_q_cnt; in xgbe_set_counts()
230 /* Calculate the number of Tx and Rx rings to be created in xgbe_set_counts()
231 * -Tx (DMA) Channels map 1-to-1 to Tx Queues so set in xgbe_set_counts()
232 * the number of Tx queues to the number of Tx channels in xgbe_set_counts()
234 * -Rx (DMA) Channels do not map 1-to-1 so use the actual in xgbe_set_counts()
235 * number of Rx queues or maximum allowed in xgbe_set_counts()
237 pdata->tx_ring_count = min_t(unsigned int, num_online_cpus(), in xgbe_set_counts()
238 pdata->hw_feat.tx_ch_cnt); in xgbe_set_counts()
239 pdata->tx_ring_count = min_t(unsigned int, pdata->tx_ring_count, in xgbe_set_counts()
240 pdata->tx_max_channel_count); in xgbe_set_counts()
241 pdata->tx_ring_count = min_t(unsigned int, pdata->tx_ring_count, in xgbe_set_counts()
242 pdata->tx_max_q_count); in xgbe_set_counts()
244 pdata->tx_q_count = pdata->tx_ring_count; in xgbe_set_counts()
246 pdata->rx_ring_count = min_t(unsigned int, num_online_cpus(), in xgbe_set_counts()
247 pdata->hw_feat.rx_ch_cnt); in xgbe_set_counts()
248 pdata->rx_ring_count = min_t(unsigned int, pdata->rx_ring_count, in xgbe_set_counts()
249 pdata->rx_max_channel_count); in xgbe_set_counts()
251 pdata->rx_q_count = min_t(unsigned int, pdata->hw_feat.rx_q_cnt, in xgbe_set_counts()
252 pdata->rx_max_q_count); in xgbe_set_counts()
255 dev_dbg(pdata->dev, "TX/RX DMA channel count = %u/%u\n", in xgbe_set_counts()
256 pdata->tx_ring_count, pdata->rx_ring_count); in xgbe_set_counts()
257 dev_dbg(pdata->dev, "TX/RX hardware queue count = %u/%u\n", in xgbe_set_counts()
258 pdata->tx_q_count, pdata->rx_q_count); in xgbe_set_counts()
264 struct net_device *netdev = pdata->netdev; in xgbe_config_netdev()
265 struct device *dev = pdata->dev; in xgbe_config_netdev()
268 netdev->irq = pdata->dev_irq; in xgbe_config_netdev()
269 netdev->base_addr = (unsigned long)pdata->xgmac_regs; in xgbe_config_netdev()
270 eth_hw_addr_set(netdev, pdata->mac_addr); in xgbe_config_netdev()
273 pdata->tx_sec_period = jiffies; in xgbe_config_netdev()
274 pdata->tx_ded_period = jiffies; in xgbe_config_netdev()
275 pdata->rx_sec_period = jiffies; in xgbe_config_netdev()
276 pdata->rx_ded_period = jiffies; in xgbe_config_netdev()
277 pdata->desc_sec_period = jiffies; in xgbe_config_netdev()
278 pdata->desc_ded_period = jiffies; in xgbe_config_netdev()
280 /* Issue software reset to device */ in xgbe_config_netdev()
281 ret = pdata->hw_if.exit(pdata); in xgbe_config_netdev()
292 DMA_BIT_MASK(pdata->hw_feat.dma_width)); in xgbe_config_netdev()
299 if (!pdata->tx_max_fifo_size) in xgbe_config_netdev()
300 pdata->tx_max_fifo_size = pdata->hw_feat.tx_fifo_size; in xgbe_config_netdev()
301 if (!pdata->rx_max_fifo_size) in xgbe_config_netdev()
302 pdata->rx_max_fifo_size = pdata->hw_feat.rx_fifo_size; in xgbe_config_netdev()
306 pdata->tx_desc_count = XGBE_TX_DESC_CNT; in xgbe_config_netdev()
309 pdata->rx_desc_count = XGBE_RX_DESC_CNT; in xgbe_config_netdev()
311 /* Adjust the number of queues based on interrupts assigned */ in xgbe_config_netdev()
312 if (pdata->channel_irq_count) { in xgbe_config_netdev()
313 pdata->tx_ring_count = min_t(unsigned int, pdata->tx_ring_count, in xgbe_config_netdev()
314 pdata->channel_irq_count); in xgbe_config_netdev()
315 pdata->rx_ring_count = min_t(unsigned int, pdata->rx_ring_count, in xgbe_config_netdev()
316 pdata->channel_irq_count); in xgbe_config_netdev()
319 dev_dbg(pdata->dev, in xgbe_config_netdev()
320 "adjusted TX/RX DMA channel count = %u/%u\n", in xgbe_config_netdev()
321 pdata->tx_ring_count, pdata->rx_ring_count); in xgbe_config_netdev()
325 netdev_rss_key_fill(pdata->rss_key, sizeof(pdata->rss_key)); in xgbe_config_netdev()
327 XGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, IP2TE, 1); in xgbe_config_netdev()
328 XGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, TCP4TE, 1); in xgbe_config_netdev()
329 XGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, UDP4TE, 1); in xgbe_config_netdev()
332 pdata->debugfs_an_cdr_workaround = pdata->vdata->an_cdr_workaround; in xgbe_config_netdev()
333 ret = pdata->phy_if.phy_init(pdata); in xgbe_config_netdev()
338 netdev->netdev_ops = xgbe_get_netdev_ops(); in xgbe_config_netdev()
339 netdev->ethtool_ops = xgbe_get_ethtool_ops(); in xgbe_config_netdev()
341 netdev->dcbnl_ops = xgbe_get_dcbnl_ops(); in xgbe_config_netdev()
345 netdev->hw_features = NETIF_F_SG | in xgbe_config_netdev()
356 if (pdata->hw_feat.rss) in xgbe_config_netdev()
357 netdev->hw_features |= NETIF_F_RXHASH; in xgbe_config_netdev()
359 if (pdata->hw_feat.vxn) { in xgbe_config_netdev()
360 netdev->hw_enc_features = NETIF_F_SG | in xgbe_config_netdev()
370 netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL | in xgbe_config_netdev()
373 netdev->udp_tunnel_nic_info = xgbe_get_udp_tunnel_info(); in xgbe_config_netdev()
376 netdev->vlan_features |= NETIF_F_SG | in xgbe_config_netdev()
382 netdev->features |= netdev->hw_features; in xgbe_config_netdev()
383 pdata->netdev_features = netdev->features; in xgbe_config_netdev()
385 netdev->priv_flags |= IFF_UNICAST_FLT; in xgbe_config_netdev()
386 netdev->min_mtu = 0; in xgbe_config_netdev()
387 netdev->max_mtu = XGMAC_JUMBO_PACKET_MTU; in xgbe_config_netdev()
389 /* Use default watchdog timeout */ in xgbe_config_netdev()
390 netdev->watchdog_timeo = 0; in xgbe_config_netdev()
407 netif_dbg(pdata, drv, pdata->netdev, "%u Tx software queues\n", in xgbe_config_netdev()
408 pdata->tx_ring_count); in xgbe_config_netdev()
409 netif_dbg(pdata, drv, pdata->netdev, "%u Rx software queues\n", in xgbe_config_netdev()
410 pdata->rx_ring_count); in xgbe_config_netdev()
417 struct net_device *netdev = pdata->netdev; in xgbe_deconfig_netdev()
426 pdata->phy_if.phy_exit(pdata); in xgbe_deconfig_netdev()
435 if (netdev->netdev_ops != xgbe_get_netdev_ops()) in xgbe_netdev_event()