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

Function check_link_status

dpdk/examples/dma/dmafwd.c:770–800  ·  view source on GitHub ↗

check link status, return true if at least one port is up */

Source from the content-addressed store, hash-verified

768
769/* check link status, return true if at least one port is up */
770static int
771check_link_status(uint32_t port_mask)
772{
773 uint16_t portid;
774 struct rte_eth_link link;
775 int ret, link_status = 0;
776 char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
777
778 printf("\nChecking link status\n");
779 RTE_ETH_FOREACH_DEV(portid) {
780 if ((port_mask & (1 << portid)) == 0)
781 continue;
782
783 memset(&link, 0, sizeof(link));
784 ret = rte_eth_link_get(portid, &link);
785 if (ret < 0) {
786 printf("Port %u link get failed: err=%d\n",
787 portid, ret);
788 continue;
789 }
790
791 /* Print link status */
792 rte_eth_link_to_str(link_status_text,
793 sizeof(link_status_text), &link);
794 printf("Port %d %s\n", portid, link_status_text);
795
796 if (link.link_status)
797 link_status = 1;
798 }
799 return link_status;
800}
801
802/* Configuration of device. 8< */
803static void

Callers 1

mainFunction · 0.85

Calls 4

memsetFunction · 0.85
rte_eth_link_getFunction · 0.85
rte_eth_link_to_strFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected