DPDK usage discussions
 help / color / mirror / Atom feed
From: "Wu, Jianyue (NSB - CN/Hangzhou)" <jianyue.wu@nokia-sbell.com>
To: "users@dpdk.org" <users@dpdk.org>
Subject: [dpdk-users] How can link status interrupt callback trigger?
Date: Mon, 30 Aug 2021 02:20:09 +0000	[thread overview]
Message-ID: <7ca8ec25d2db48baa50a82cec676896a@nokia-sbell.com> (raw)
In-Reply-To: <d385210fdb094038b2c220d1acdb8c99@nokia-sbell.com>

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)


       reply	other threads:[~2021-08-30  2:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <d385210fdb094038b2c220d1acdb8c99@nokia-sbell.com>
2021-08-30  2:20 ` Wu, Jianyue (NSB - CN/Hangzhou) [this message]
2021-08-30 15:29   ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7ca8ec25d2db48baa50a82cec676896a@nokia-sbell.com \
    --to=jianyue.wu@nokia-sbell.com \
    --cc=users@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).