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

Function ixgbevf_check_link

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

Source from the content-addressed store, hash-verified

4123}
4124
4125static int
4126ixgbevf_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
4127 bool *link_up, int wait_to_complete)
4128{
4129 struct ixgbe_adapter *adapter = container_of(hw,
4130 struct ixgbe_adapter, hw);
4131 struct ixgbe_mbx_info *mbx = &hw->mbx;
4132 struct ixgbe_mac_info *mac = &hw->mac;
4133 uint32_t links_reg, in_msg;
4134 int ret_val = 0;
4135
4136 /* If we were hit with a reset drop the link */
4137 if (!mbx->ops.check_for_rst(hw, 0) || !mbx->timeout)
4138 mac->get_link_status = true;
4139
4140 if (!mac->get_link_status)
4141 goto out;
4142
4143 /* if link status is down no point in checking to see if pf is up */
4144 links_reg = IXGBE_READ_REG(hw, IXGBE_VFLINKS);
4145 if (!(links_reg & IXGBE_LINKS_UP))
4146 goto out;
4147
4148 /* for SFP+ modules and DA cables on 82599 it can take up to 500usecs
4149 * before the link status is correct
4150 */
4151 if (mac->type == ixgbe_mac_82599_vf && wait_to_complete) {
4152 int i;
4153
4154 for (i = 0; i < 5; i++) {
4155 rte_delay_us(100);
4156 links_reg = IXGBE_READ_REG(hw, IXGBE_VFLINKS);
4157
4158 if (!(links_reg & IXGBE_LINKS_UP))
4159 goto out;
4160 }
4161 }
4162
4163 switch (links_reg & IXGBE_LINKS_SPEED_82599) {
4164 case IXGBE_LINKS_SPEED_10G_82599:
4165 *speed = IXGBE_LINK_SPEED_10GB_FULL;
4166 if (hw->mac.type >= ixgbe_mac_X550) {
4167 if (links_reg & IXGBE_LINKS_SPEED_NON_STD)
4168 *speed = IXGBE_LINK_SPEED_2_5GB_FULL;
4169 }
4170 break;
4171 case IXGBE_LINKS_SPEED_1G_82599:
4172 *speed = IXGBE_LINK_SPEED_1GB_FULL;
4173 break;
4174 case IXGBE_LINKS_SPEED_100_82599:
4175 *speed = IXGBE_LINK_SPEED_100_FULL;
4176 if (hw->mac.type == ixgbe_mac_X550) {
4177 if (links_reg & IXGBE_LINKS_SPEED_NON_STD)
4178 *speed = IXGBE_LINK_SPEED_5GB_FULL;
4179 }
4180 break;
4181 case IXGBE_LINKS_SPEED_10_X550EM_A:
4182 *speed = IXGBE_LINK_SPEED_UNKNOWN;

Callers 1

Calls 1

readMethod · 0.45

Tested by

no test coverage detected