From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f169.google.com (mail-wr0-f169.google.com [209.85.128.169]) by dpdk.org (Postfix) with ESMTP id D92117CF2 for ; Tue, 11 Jul 2017 01:20:19 +0200 (CEST) Received: by mail-wr0-f169.google.com with SMTP id r103so159339164wrb.0 for ; Mon, 10 Jul 2017 16:20: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=Q4O/r+TWVcK/Zqe4Wb1Fg7cR5oNsAMnAT2E+yL4M9Dg=; b=cCuoBYdu4L+uAC5Icis00cB7nPqmTyECqdYtxf7RHWwk1ZAE4Ju0FNKH2ISWUaBxxF J78Phjly/aF+yWgr97TZaCwYq9sxdAH3tpj5AvpZHPPL6Tj+SLXIMO+h3Ev1SWjWtkJ4 DtktMgwVxLlRy0t9eLyy+b48VChO8UxwZGeib1UhRl+BEPE35yOB5ZgH43lBsL4T+Syx V0ekibce6TMcano/OCJxHuIb/pqTdbmGYIpJx+nIoYHT1lv3XPpMVMj6woSqhrs3I201 DaJCRfGhxFaxo25Nm32CotzYR/Caqjzj1un7C51DBwnzcnHe7bmxvW1/8QeInm2N2YBF m6oA== 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=Q4O/r+TWVcK/Zqe4Wb1Fg7cR5oNsAMnAT2E+yL4M9Dg=; b=PD3Z/PiTsuKEeg7PFDeEHYcMaAVFuzOwCAfbhqHoss81KL8wegy9Uybh8NxogVVn9t OO79tWUgP1F8URYQlTb8m+hJdoo5jAbh3SKIG752lZAbzQYEy74EzC9x1kMQPqnFIL0y gcIQPwTIa/APZPAwyVybL5BR2ucIqqKaCoZfl/b/0ZpbSqzYAOxEt7388d+Nu+1IGRBD 3RVg5YUm/fAnBJ0VhlaFtd8AccrI76xmErV/j3UYaOAC/Mr5H9IXZZntM0WfI3fS1kuy ZrY0Zpl4uKUaoNkGki1evpCk6cvhigWDqP4fElOTCM8wL6PLr65mlHBKYJNWkfP4Y3Km 4+qQ== X-Gm-Message-State: AIVw111wG5u+sAhbkgQghUNXhvM3+cYDtcIm+1XdQPdY6NUDInQp1EeC af2ZhOSCkMW3X0hr+uE= X-Received: by 10.28.146.208 with SMTP id u199mr398252wmd.6.1499728819117; Mon, 10 Jul 2017 16:20:19 -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 k137sm11805038wmd.22.2017.07.10.16.20.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Jul 2017 16:20:18 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Tue, 11 Jul 2017 01:19:51 +0200 Message-Id: <93a186238b38e0d7e70e09385a95645614dd2461.1499728587.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 v8 10/11] 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, 10 Jul 2017 23:20: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 | 18 ++++++++++++++++++ drivers/net/failsafe/failsafe_ops.c | 23 +++++++++++++++++++++++ drivers/net/failsafe/failsafe_private.h | 3 +++ 5 files changed, 46 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 ea3105c..a694b4d 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -387,3 +387,21 @@ failsafe_eth_rmv_event_callback(uint8_t port_id __rte_unused, sdev->remove = 1; return 0; } + +int +failsafe_eth_lsc_event_callback(uint8_t port_id __rte_unused, + enum rte_eth_event_type event __rte_unused, + void *cb_arg, void *out __rte_unused) +{ + 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) + return _rte_eth_dev_callback_process(dev, + RTE_ETH_EVENT_INTR_LSC, + NULL, NULL); + else + return 0; +} 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 6a8041d..6b34998 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); int failsafe_eth_rmv_event_callback(uint8_t port_id, enum rte_eth_event_type type, void *arg, void *out); +int failsafe_eth_lsc_event_callback(uint8_t port_id, + enum rte_eth_event_type event, + void *cb_arg, void *out); /* GLOBALS */ -- 2.1.4