From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com [74.125.82.44]) by dpdk.org (Postfix) with ESMTP id 69B897D6E for ; Mon, 29 May 2017 15:43:19 +0200 (CEST) Received: by mail-wm0-f44.google.com with SMTP id b84so56702297wmh.0 for ; Mon, 29 May 2017 06:43:19 -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=apXpOxP9f4jwq/R4To7j2A5ufQmg4LX7T8FGEeVpaus=; b=BZ+wY4iZMegC4XdXjNnR6paJxvfqKmPH4mkt4MVDOXpGhkwcJ9qwA1CVsYFQtoupix 6OuKmPrAv+Bhd5rvuD+965BoGBnXuQuWuSwm4Xn9P2Yuygn0jfYuPa0ui2wR3JMkHS6f unTW47g6g7DchkpnDnv0Bvn+Dvm/14AqsSs+onkoTiY68COf1kWxIFVPAZ/OkicygNda 8buzdn4ggtf+S818KiLib0V0W7hD+Njl4WLW0TWZJdfzT+zGayv5Pbgk1ZGhy3mRzbf9 PJlNC7vCgGwJ5c5tts19G788S+rOIIB20UNhz4XZu1w9Bl7PLfLkU9zn8UHaIkI5DQBG xP5w== 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=apXpOxP9f4jwq/R4To7j2A5ufQmg4LX7T8FGEeVpaus=; b=W/6RLYruIGtjqyGAbO/xbvyc7apNf6KQFskJyxrnwybF8nKLKILssFFwsk5wPfaTq0 fhArYr50qUGm7Yey7Kxq0yQVN1fh+Sn9KyZ/bSf99O1P1jQsB4JvjO+Sb9EEinPQks7a 4IL9TSIKIvgA7uSCA8mAr7V3nwPCHZpbMFft5UM0jDldt0fxKGGud0IP1ag2WjgpD+zO D5jgsGo5vZvJB5rp7nCPcUnFKeTQHJnjcDPR7JbLau43QrQOcHBmf/Zl0NydKzEOvHpa K+KAX2pKGb70O43k4hPES2ytB8w6Kz0PMixFqurJgcFdM3U1cXwU2UF4jjuse0YpmqyE HgGg== X-Gm-Message-State: AODbwcAqE4iPYieBHYBk+szAb4Kf7jZjg/eVc7kt4Yzva8+7nE76jDpB 84we5feZ0m2PRxTzaos= X-Received: by 10.223.139.199 with SMTP id w7mr12183873wra.92.1496065398879; Mon, 29 May 2017 06:43:18 -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 l8sm12906671wmd.8.2017.05.29.06.43.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 29 May 2017 06:43:18 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Mon, 29 May 2017 15:42:23 +0200 Message-Id: <73367b1a20119d04dfea626ae69daa927a0b6e78.1496065002.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 v4 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: Mon, 29 May 2017 13:43:20 -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 bb6fcff..3401a18 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -384,3 +384,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 ca20109..66303cd 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -180,6 +180,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