From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f175.google.com (mail-wr0-f175.google.com [209.85.128.175]) by dpdk.org (Postfix) with ESMTP id 194F09113 for ; Thu, 8 Jun 2017 02:00:27 +0200 (CEST) Received: by mail-wr0-f175.google.com with SMTP id g76so11999878wrd.1 for ; Wed, 07 Jun 2017 17:00:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=slwH3NRweiWDR3sTQ3OksAmrh5fzOfeeUOFnU1fzMxA=; b=ylRCze/cETXmC6HzQegSBWajQAgelBzi1viMvYWhhfQlavnQoaLol1vYt9dg87I2Sc C0vFmF1f4jSCxIgOCVeKLfr0nZ6axN5sZjnRUw3XwvVPDaXUsr56tv3Q8HB+f5PQWxJm foOrlmlcfZPj2OU4ya4sJPc0SUFPKSO+SrHzSlg6k9DVGHd8S572xiUdVctYDH0UR6Op qB+T1XlNHqbqP5NkkiE79i9XuBO9xSAZzMJnZsCcY1w5P/s+9jACxAn2tb/F3S4kRTeo ax2GpNXMBikc1MB6R6sgMpzHNH7n+SpJwTaL60lETR9v2vU1iUBtfwM154Rqo5Ks1iYv g52Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=slwH3NRweiWDR3sTQ3OksAmrh5fzOfeeUOFnU1fzMxA=; b=bw120gf/vxzMU/ytivs0Zgst7dMGVku6OWuMdtm8h31TFECwFyE9VqdTdRBYmEg9pD phwvdYshw3ltlkIznhxLDanvjnscJVe5vCh0zeNNDGuBN5WPajLKjJ/kZdhoVCvSnYRL V0RTd5MrVGqPmcxGCKeaVE3ICb7nB4XohH+e98NBKXP99h/tB4eIE+ol1wNsrJpH6oP5 GKdPk3gGAUKtC0fUICI/xVCdXNN171OPNZKGECOvMrZjiB3MUXacYXifWIJ1qHoe6Ni4 ehTAEAd0Yqna8YscAHX7GXNAo2Bxvgd5X5dsSdJ7XeziOvbK8sZasklpdqDtNto/2U5l FRYA== X-Gm-Message-State: AODbwcBI56UaCnBy0R/o2n/jkUdFisBKq2ZndNcIgkNXUEhD1tjQImeS p6tJuURn2b55Ka4QkkQ= X-Received: by 10.223.161.89 with SMTP id r25mr3564551wrr.153.1496880026568; Wed, 07 Jun 2017 17:00:26 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id s10sm4337785wmb.8.2017.06.07.17.00.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Jun 2017 17:00:25 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 8 Jun 2017 02:00:01 +0200 Message-Id: <90f1b32cb82c9c402b6c861bac4dfcd98efdb331.1496877105.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v5 11/12] net/failsafe: support link status change event X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jun 2017 00:00:27 -0000 Signed-off-by: Gaetan Rivet --- doc/guides/nics/features/failsafe.ini | 1 + drivers/net/failsafe/failsafe.c | 1 + drivers/net/failsafe/failsafe_ether.c | 15 +++++++++++++++ drivers/net/failsafe/failsafe_ops.c | 23 +++++++++++++++++++++++ drivers/net/failsafe/failsafe_private.h | 3 +++ 5 files changed, 43 insertions(+) diff --git a/doc/guides/nics/features/failsafe.ini b/doc/guides/nics/features/failsafe.ini index 257f579..251ce55 100644 --- a/doc/guides/nics/features/failsafe.ini +++ b/doc/guides/nics/features/failsafe.ini @@ -5,6 +5,7 @@ ; [Features] Link status = Y +Link status event = Y Queue start/stop = Y MTU update = Y Jumbo frame = Y diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index 4d35860..151f823 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -240,6 +240,7 @@ fs_eth_dev_create(struct rte_vdev_device *vdev) mac->addr_bytes[0], mac->addr_bytes[1], mac->addr_bytes[2], mac->addr_bytes[3], mac->addr_bytes[4], mac->addr_bytes[5]); + dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC; return 0; free_args: failsafe_args_free(dev); diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c index 4456d21..06f950b 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -383,3 +383,18 @@ failsafe_eth_rmv_event_callback(uint8_t port_id __rte_unused, */ sdev->remove = 1; } + +void +failsafe_eth_lsc_event_callback(uint8_t port_id __rte_unused, + enum rte_eth_event_type event __rte_unused, + void *cb_arg) +{ + struct rte_eth_dev *dev = cb_arg; + int ret; + + ret = dev->dev_ops->link_update(dev, 0); + /* We must pass on the LSC event */ + if (ret) + _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, + NULL); +} diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index 2e1c798..05221bc 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -207,6 +207,8 @@ fs_dev_configure(struct rte_eth_dev *dev) } FOREACH_SUBDEV(sdev, i, dev) { int rmv_interrupt = 0; + int lsc_interrupt = 0; + int lsc_enabled; if (sdev->state != DEV_PROBED) continue; @@ -219,6 +221,17 @@ fs_dev_configure(struct rte_eth_dev *dev) } else { DEBUG("sub_device %d does not support RMV event", i); } + lsc_enabled = dev->data->dev_conf.intr_conf.lsc; + lsc_interrupt = lsc_enabled && + (ETH(sdev)->data->dev_flags & + RTE_ETH_DEV_INTR_LSC); + if (lsc_interrupt) { + DEBUG("Enabling LSC interrupts for sub_device %d", i); + dev->data->dev_conf.intr_conf.lsc = 1; + } else if (lsc_enabled && !lsc_interrupt) { + DEBUG("Disabling LSC interrupts for sub_device %d", i); + dev->data->dev_conf.intr_conf.lsc = 0; + } DEBUG("Configuring sub-device %d", i); sdev->remove = 0; ret = rte_eth_dev_configure(PORT_ID(sdev), @@ -239,6 +252,16 @@ fs_dev_configure(struct rte_eth_dev *dev) SUB_ID(sdev)); } dev->data->dev_conf.intr_conf.rmv = 0; + if (lsc_interrupt) { + ret = rte_eth_dev_callback_register(PORT_ID(sdev), + RTE_ETH_EVENT_INTR_LSC, + failsafe_eth_lsc_event_callback, + dev); + if (ret) + WARN("Failed to register LSC callback for sub_device %d", + SUB_ID(sdev)); + } + dev->data->dev_conf.intr_conf.lsc = lsc_enabled; sdev->state = DEV_ACTIVE; } if (PRIV(dev)->state < DEV_ACTIVE) diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index 8f10d61..cb8fad2 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -179,6 +179,9 @@ void failsafe_dev_remove(struct rte_eth_dev *dev); void failsafe_eth_rmv_event_callback(uint8_t port_id, enum rte_eth_event_type type, void *arg); +void failsafe_eth_lsc_event_callback(uint8_t port_id, + enum rte_eth_event_type event, + void *cb_arg); /* GLOBALS */ -- 2.1.4