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

Stephen Hemminger stephen at networkplumber.org
Mon Aug 30 17:29:22 CEST 2021


On Mon, 30 Aug 2021 02:20:09 +0000
"Wu, Jianyue (NSB - CN/Hangzhou)" <jianyue.wu at nokia-sbell.com> wrote:

> 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)
> 

The link status interrupt reflects changes to the DPDK interface (not the kernel interface).
When you changed the eth0 it was a kernel interface. If it was a PF, then it may not be propogating
that change the VF that DPDK is using.  What hardware is this?


More information about the users mailing list