* [dpdk-users] How can link status interrupt callback trigger?
[not found] <d385210fdb094038b2c220d1acdb8c99@nokia-sbell.com>
@ 2021-08-30 2:20 ` Wu, Jianyue (NSB - CN/Hangzhou)
2021-08-30 15:29 ` Stephen Hemminger
0 siblings, 1 reply; 2+ messages in thread
From: Wu, Jianyue (NSB - CN/Hangzhou) @ 2021-08-30 2:20 UTC (permalink / raw)
To: users
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)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-users] How can link status interrupt callback trigger?
2021-08-30 2:20 ` [dpdk-users] How can link status interrupt callback trigger? Wu, Jianyue (NSB - CN/Hangzhou)
@ 2021-08-30 15:29 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2021-08-30 15:29 UTC (permalink / raw)
To: Wu, Jianyue (NSB - CN/Hangzhou); +Cc: users
On Mon, 30 Aug 2021 02:20:09 +0000
"Wu, Jianyue (NSB - CN/Hangzhou)" <jianyue.wu@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?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-30 15:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <d385210fdb094038b2c220d1acdb8c99@nokia-sbell.com>
2021-08-30 2:20 ` [dpdk-users] How can link status interrupt callback trigger? Wu, Jianyue (NSB - CN/Hangzhou)
2021-08-30 15:29 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).