From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f182.google.com (mail-wr0-f182.google.com [209.85.128.182]) by dpdk.org (Postfix) with ESMTP id 75CF23DC for ; Wed, 8 Mar 2017 16:16:13 +0100 (CET) Received: by mail-wr0-f182.google.com with SMTP id g10so25539717wrg.2 for ; Wed, 08 Mar 2017 07:16:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references:in-reply-to :references; bh=Qn0yuLPt1b9jVHwancDeajAm6ggLoGWM3ThXV2wevro=; b=fow8yxrhVa1Zw3rUeVaS/WKvErDmxIawFXtTFzVM/OueQm2M+fP6MAzo84ALatkZZY 4tWbMN2VVYJE3mrW7BUc+Q5YW7GFdS8KhEONnI11PNTtTd2En/oYZwvaOa2+mxhooae5 V8NqIRbCoVn8dqIf27VVna84EpWqKBITKYc7wsG5glbH4mIgal1JjGYvIpSun8gm3w08 38vb7kl/jm4hAhgjlq41xq2fSI2oHjBe43zKISevX/J4REHt4ES+gqixYNhV+bfZuSXl n9QgXF6tA13XAyiQUjThOF+NVOmXWrJZbixQLmU0+EaTI4V4RhfKlzHE21jH0bJl5CoU YeAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=Qn0yuLPt1b9jVHwancDeajAm6ggLoGWM3ThXV2wevro=; b=Uba+bqKIiQOX8uRQwcrU7ALrIWTwVfqdwsIqwA4EKfWPYS6k5YvrwVTl6ZCRAEOJBd a64G1lT2NUS+uZPeX6VAeMMa+4ylk1965jVioSA/FXFHHXQrsW+BBxzXNbyknossQBm6 6iuIZUVAr6pJaNnHbOODKoWF5tU1lNoE2mUELl0TaGWXgoVMfQ2K0eAcI71lTfyQhYjO h/QD9ewhkeLWIQlh9n8NxLER6E4naixeFsd/EnZA/QpZZnvrdz9oPn2/YdwjDcWki455 ZTFjpqtWsvP/uMkYdw4x7OTGe+Tbm4Y2ne9EsCJZ89sOJhiK3LNkv5LXBMwIvv8nyJI3 2Q1A== X-Gm-Message-State: AMke39nc+WXwSX9DMj5iq3so+f5ZgaMZSU3se5VLhln9ZYlN4TuwU9kTh+jHNPnAVqRhNXXE X-Received: by 10.223.164.16 with SMTP id d16mr5654753wra.47.1488986172995; Wed, 08 Mar 2017 07:16:12 -0800 (PST) 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 t103sm4553592wrc.43.2017.03.08.07.16.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Mar 2017 07:16:12 -0800 (PST) From: Gaetan Rivet To: dev@dpdk.org Date: Wed, 8 Mar 2017 16:15:46 +0100 Message-Id: <85b490407a388e111f5bf5b948d12c7cf868f66b.1488985489.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 v2 13/13] 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: Wed, 08 Mar 2017 15:16:13 -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 | 18 ++++++++++++++++++ drivers/net/failsafe/failsafe_ops.c | 24 ++++++++++++++++++++++++ drivers/net/failsafe/failsafe_private.h | 3 +++ 5 files changed, 47 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 6151736..f885c19 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -238,6 +238,7 @@ eth_dev_create(const char *name, 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 f12b8d7..5c2e118 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -374,3 +374,21 @@ failsafe_eth_rmv_event_callback(uint8_t port_id __rte_unused, cb_arg)) ERROR("Could not set up deferred sub_device removal"); } + +void +failsafe_eth_lsc_event_callback(uint8_t port_id __rte_unused, + enum rte_eth_event_type event, + void *cb_arg) +{ + struct rte_eth_dev *dev = cb_arg; + int ret; + + if (event != RTE_ETH_EVENT_INTR_LSC) { + ERROR("Incorrect event"); + return; + } + 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 8d0e7a2..695e7b3 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -199,6 +199,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; @@ -211,6 +213,18 @@ 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); ret = rte_eth_dev_configure(PORT_ID(sdev), dev->data->nb_rx_queues, @@ -230,6 +244,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 5efd084..27e2a0c 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -182,6 +182,9 @@ int failsafe_eth_dev_state_sync(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