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

Function atl_dev_link_update

dpdk/drivers/net/atlantic/atl_ethdev.c:1166–1220  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1164
1165/* return 0 means link status changed, -1 means not changed */
1166static int
1167atl_dev_link_update(struct rte_eth_dev *dev, int wait __rte_unused)
1168{
1169 struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1170 struct rte_eth_link link, old;
1171 u32 fc = AQ_NIC_FC_OFF;
1172 int err = 0;
1173
1174 link.link_status = RTE_ETH_LINK_DOWN;
1175 link.link_speed = 0;
1176 link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
1177 link.link_autoneg = hw->is_autoneg ? RTE_ETH_LINK_AUTONEG : RTE_ETH_LINK_FIXED;
1178 memset(&old, 0, sizeof(old));
1179
1180 /* load old link status */
1181 rte_eth_linkstatus_get(dev, &old);
1182
1183 /* read current link status */
1184 err = hw->aq_fw_ops->update_link_status(hw);
1185
1186 if (err)
1187 return 0;
1188
1189 if (hw->aq_link_status.mbps == 0) {
1190 /* write default (down) link status */
1191 rte_eth_linkstatus_set(dev, &link);
1192 if (link.link_status == old.link_status)
1193 return -1;
1194 return 0;
1195 }
1196
1197 link.link_status = RTE_ETH_LINK_UP;
1198 link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
1199 link.link_speed = hw->aq_link_status.mbps;
1200
1201 rte_eth_linkstatus_set(dev, &link);
1202
1203 if (link.link_status == old.link_status)
1204 return -1;
1205
1206 /* Driver has to update flow control settings on RX block
1207 * on any link event.
1208 * We should query FW whether it negotiated FC.
1209 */
1210 if (hw->aq_fw_ops->get_flow_control) {
1211 hw->aq_fw_ops->get_flow_control(hw, &fc);
1212 hw_atl_b0_set_fc(hw, fc, 0U);
1213 }
1214
1215 if (rte_eal_alarm_set(1000 * 1000,
1216 atl_dev_delayed_handler, (void *)dev) < 0)
1217 PMD_DRV_LOG(ERR, "rte_eal_alarm_set fail");
1218
1219 return 0;
1220}
1221
1222static int
1223atl_dev_promiscuous_enable(struct rte_eth_dev *dev)

Callers 1

atl_dev_interrupt_actionFunction · 0.85

Calls 5

memsetFunction · 0.85
rte_eth_linkstatus_getFunction · 0.85
rte_eth_linkstatus_setFunction · 0.85
hw_atl_b0_set_fcFunction · 0.85
rte_eal_alarm_setFunction · 0.50

Tested by

no test coverage detected