MCPcopy Create free account
hub / github.com/F-Stack/f-stack / txgbe_dev_rx_init

Function txgbe_dev_rx_init

dpdk/drivers/net/txgbe/txgbe_rxtx.c:4305–4457  ·  view source on GitHub ↗

* Initializes Receive Unit. */

Source from the content-addressed store, hash-verified

4303 * Initializes Receive Unit.
4304 */
4305int __rte_cold
4306txgbe_dev_rx_init(struct rte_eth_dev *dev)
4307{
4308 struct txgbe_hw *hw;
4309 struct txgbe_rx_queue *rxq;
4310 uint64_t bus_addr;
4311 uint32_t fctrl;
4312 uint32_t hlreg0;
4313 uint32_t srrctl;
4314 uint32_t rdrxctl;
4315 uint32_t rxcsum;
4316 uint16_t buf_size;
4317 uint16_t i;
4318 struct rte_eth_rxmode *rx_conf = &dev->data->dev_conf.rxmode;
4319 int rc;
4320
4321 PMD_INIT_FUNC_TRACE();
4322 hw = TXGBE_DEV_HW(dev);
4323
4324 /*
4325 * Make sure receives are disabled while setting
4326 * up the RX context (registers, descriptor rings, etc.).
4327 */
4328 wr32m(hw, TXGBE_MACRXCFG, TXGBE_MACRXCFG_ENA, 0);
4329 wr32m(hw, TXGBE_PBRXCTL, TXGBE_PBRXCTL_ENA, 0);
4330
4331 /* Enable receipt of broadcasted frames */
4332 fctrl = rd32(hw, TXGBE_PSRCTL);
4333 fctrl |= TXGBE_PSRCTL_BCA;
4334 wr32(hw, TXGBE_PSRCTL, fctrl);
4335
4336 /*
4337 * Configure CRC stripping, if any.
4338 */
4339 hlreg0 = rd32(hw, TXGBE_SECRXCTL);
4340 if (rx_conf->offloads & RTE_ETH_RX_OFFLOAD_KEEP_CRC)
4341 hlreg0 &= ~TXGBE_SECRXCTL_CRCSTRIP;
4342 else
4343 hlreg0 |= TXGBE_SECRXCTL_CRCSTRIP;
4344 wr32(hw, TXGBE_SECRXCTL, hlreg0);
4345
4346 /*
4347 * Configure jumbo frame support, if any.
4348 */
4349 wr32m(hw, TXGBE_FRMSZ, TXGBE_FRMSZ_MAX_MASK,
4350 TXGBE_FRMSZ_MAX(dev->data->mtu + TXGBE_ETH_OVERHEAD));
4351
4352 /*
4353 * If loopback mode is configured, set LPBK bit.
4354 */
4355 hlreg0 = rd32(hw, TXGBE_PSRCTL);
4356 if (hw->mac.type == txgbe_mac_raptor &&
4357 dev->data->dev_conf.lpbk_mode)
4358 hlreg0 |= TXGBE_PSRCTL_LBENA;
4359 else
4360 hlreg0 &= ~TXGBE_PSRCTL_LBENA;
4361
4362 wr32(hw, TXGBE_PSRCTL, hlreg0);

Callers 1

txgbe_dev_startFunction · 0.85

Calls 7

txgbe_set_rscFunction · 0.85
txgbe_set_rx_functionFunction · 0.85
wr32mFunction · 0.50
rd32Function · 0.50
wr32Function · 0.50

Tested by

no test coverage detected