[dpdk-users] How can link status interrupt callback trigger?

Wu, Jianyue (NSB - CN/Hangzhou) jianyue.wu at nokia-sbell.com
Mon Aug 30 04:20:09 CEST 2021


Hi,

May I ask some questions about how can link status interrupt callback trigger? Thanks in advance!
I tried to do register right after rte_eth_dev_configure(), but when I set
#ip link set eth0 down
Nothing happens, no callback triggered.
These links I registered are the vf(virtual functions) under eth0.
I also tried to set the vf as disabled, but seems not allowed.
#ip link set eth0 vf 0 state disable
RTNETLINK answers: Operation not supported.

    ret = rte_eth_dev_callback_register(portid, RTE_ETH_EVENT_INTR_LSC, link_status_interrupt_event_callback, NULL);

static int
link_status_interrupt_event_callback(uint16_t port_id, enum rte_eth_event_type type, void *param, void *param1)
{
    struct rte_eth_link link;
    int ret;
    (void)param;
    (void)param1;

    printf("\nIn registered callback %s(): event type(%d): %s\n",
                __func__,
                type,
                type == RTE_ETH_EVENT_INTR_LSC ? "LSC interrupt" : "unknown event");

    ret = rte_eth_link_get_nowait(port_id, &link);
    if (ret < 0) {
        printf("Failed to get port %d link status: %s\n\n",
               port_id, rte_strerror(-ret));
        return ret;
    } else if (link.link_status) {
        printf("Port %d Link Up - speed %u Mbps - %s\n\n", port_id, (unsigned)link.link_speed,
              (link.link_duplex == ETH_LINK_FULL_DUPLEX) ? ("full-duplex") : ("half-duplex"));
    } else {
        printf("Port %d Link Down\n\n", port_id);
    }
    return 0;
}

Best Regards,
Dave(Jianyue)



More information about the users mailing list