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

Function ixgbe_dev_link_update_share

dpdk/drivers/net/ixgbe/ixgbe_ethdev.c:4316–4429  ·  view source on GitHub ↗

return 0 means link status changed, -1 means not changed */

Source from the content-addressed store, hash-verified

4314
4315/* return 0 means link status changed, -1 means not changed */
4316int
4317ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
4318 int wait_to_complete, int vf)
4319{
4320 struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
4321 struct ixgbe_adapter *ad = dev->data->dev_private;
4322 struct rte_eth_link link;
4323 ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_UNKNOWN;
4324 struct ixgbe_interrupt *intr =
4325 IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
4326 bool link_up;
4327 int diag;
4328 int wait = 1;
4329 u32 esdp_reg;
4330
4331 if (rte_eal_process_type() != RTE_PROC_PRIMARY)
4332 return -1;
4333
4334 memset(&link, 0, sizeof(link));
4335 link.link_status = RTE_ETH_LINK_DOWN;
4336 link.link_speed = RTE_ETH_SPEED_NUM_NONE;
4337 link.link_duplex = RTE_ETH_LINK_HALF_DUPLEX;
4338 link.link_autoneg = !(dev->data->dev_conf.link_speeds &
4339 RTE_ETH_LINK_SPEED_FIXED);
4340
4341 hw->mac.get_link_status = true;
4342
4343 if (intr->flags & IXGBE_FLAG_NEED_LINK_CONFIG)
4344 return rte_eth_linkstatus_set(dev, &link);
4345
4346 /* check if it needs to wait to complete, if lsc interrupt is enabled */
4347 if (wait_to_complete == 0 || dev->data->dev_conf.intr_conf.lsc != 0)
4348 wait = 0;
4349
4350 if (vf)
4351 diag = ixgbevf_check_link(hw, &link_speed, &link_up, wait);
4352 else
4353 diag = ixgbe_check_link(hw, &link_speed, &link_up, wait);
4354
4355 if (diag != 0) {
4356 link.link_speed = RTE_ETH_SPEED_NUM_100M;
4357 link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
4358 return rte_eth_linkstatus_set(dev, &link);
4359 }
4360
4361 if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber &&
4362 !ad->sdp3_no_tx_disable) {
4363 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP);
4364 if ((esdp_reg & IXGBE_ESDP_SDP3))
4365 link_up = 0;
4366 }
4367
4368 if (link_up == 0) {
4369 if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) {
4370 ixgbe_dev_wait_setup_link_complete(dev, 0);
4371 /* NOTE: review for potential ordering optimization */
4372 if (!__atomic_test_and_set(&ad->link_thread_running, __ATOMIC_SEQ_CST)) {
4373 /* To avoid race condition between threads, set

Callers 3

ixgbe_dev_link_updateFunction · 0.85
ixgbevf_dev_link_updateFunction · 0.85

Calls 8

rte_eal_process_typeFunction · 0.85
memsetFunction · 0.85
rte_eth_linkstatus_setFunction · 0.85
ixgbevf_check_linkFunction · 0.85
ixgbe_check_linkFunction · 0.85
ixgbe_get_media_typeFunction · 0.85

Tested by

no test coverage detected