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

Function cxgbe_dev_link_update

dpdk/drivers/net/cxgbe/cxgbe_ethdev.c:207–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207int cxgbe_dev_link_update(struct rte_eth_dev *eth_dev,
208 int wait_to_complete)
209{
210 struct port_info *pi = eth_dev->data->dev_private;
211 unsigned int i, work_done, budget = 32;
212 struct link_config *lc = &pi->link_cfg;
213 struct adapter *adapter = pi->adapter;
214 u8 old_link = pi->link_cfg.link_ok;
215 struct sge *s = &adapter->sge;
216 struct rte_eth_link new_link;
217
218 for (i = 0; i < CXGBE_LINK_STATUS_POLL_CNT; i++) {
219 if (!s->fw_evtq.desc)
220 break;
221
222 cxgbe_poll(&s->fw_evtq, NULL, budget, &work_done);
223
224 /* Exit if link status changed or always forced up */
225 if (pi->link_cfg.link_ok != old_link ||
226 cxgbe_force_linkup(adapter))
227 break;
228
229 if (!wait_to_complete)
230 break;
231
232 rte_delay_ms(CXGBE_LINK_STATUS_POLL_MS);
233 }
234
235 memset(&new_link, 0, sizeof(new_link));
236 new_link.link_status = cxgbe_force_linkup(adapter) ?
237 RTE_ETH_LINK_UP : pi->link_cfg.link_ok;
238 new_link.link_autoneg = (lc->link_caps & FW_PORT_CAP32_ANEG) ? 1 : 0;
239 new_link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
240 new_link.link_speed = t4_fwcap_to_speed(lc->link_caps);
241
242 return rte_eth_linkstatus_set(eth_dev, &new_link);
243}
244
245/**
246 * Set device link up.

Callers 2

cxgbe_dev_set_link_upFunction · 0.85
cxgbe_dev_set_link_downFunction · 0.85

Calls 6

cxgbe_pollFunction · 0.85
cxgbe_force_linkupFunction · 0.85
rte_delay_msFunction · 0.85
memsetFunction · 0.85
t4_fwcap_to_speedFunction · 0.85
rte_eth_linkstatus_setFunction · 0.85

Tested by

no test coverage detected