From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f179.google.com (mail-wr0-f179.google.com [209.85.128.179]) by dpdk.org (Postfix) with ESMTP id DFCD3532E for ; Tue, 18 Jul 2017 14:48:50 +0200 (CEST) Received: by mail-wr0-f179.google.com with SMTP id a10so28214760wrd.0 for ; Tue, 18 Jul 2017 05:48:50 -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=iL/iHEWjrKWBvADPvoFG9c19VY5Rxg5pV/bXjJUSipQ=; b=INzZ7d55Ev5xZSmfCA/VX/C8r+ikjKPzWMpYHTh84kGYxW0p4t/Y8YGugw/MWSab8N GHGdntgxmFWl7vGccHlJYmtiXZFFHX/O79Jwo0YK8Hup2Si/DH8eirgm/Vz4sl5F2WBY 1y1gOVuK3u5l4MAyQEhMXZwKrURXs79klcjMY5gSmvkOn9whvBWOekRt9i0KEzViVxyc Ji7ihQYgf1ubRG4X9QBt1XELSPzXp+fwPKeOEf15s0s7asGq4ktvbJSZsISJf+eqNRUA t6odpX0rod2EaO6DBBAwsoxfrRpXqXJcw8uE4wd3XDt9tLftCWR+/flehlByXyqlH7xN ACBw== 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=iL/iHEWjrKWBvADPvoFG9c19VY5Rxg5pV/bXjJUSipQ=; b=f6II7cMa0UO6UEeiUj9B6mJAZUAx7wVl0FN7Rh9Vjthy+x5CUpQlrO/hJqFMIVq6Zz HlxEWdNRh3omXq35kFYatiZIh6ei1y2XHOc2lwavDdu4ComtlXJImaq4L5Y0GmPWo/WU WnWLBEb+lhRYWJ/AgkHipVwmLkYr7L8Op0IeRXcyCghYZtfWDTNkCd3LJdBbT1yvZpRx B+xpG6zSTSkXdA6xbCpel49QYssOABDko5pfXbcMxYzwVEk0p0ag1u/RK3CTa7UItruL TgoK8isrFRpVmNCC/2YNM1kRc1XSCVn8ECX1XVwXrHo/ZG6tXdZdPRdZL/gOLrwIDlS5 te9w== X-Gm-Message-State: AIVw110ZnB1ADmCi7+O8GruFD9wNHwyUVKhw/zJPMOf7RnV9ug2VcE49 B986vlKYiICuMjl91kY= X-Received: by 10.28.156.202 with SMTP id f193mr1690811wme.22.1500382130236; Tue, 18 Jul 2017 05:48:50 -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 j8sm1033960wrj.10.2017.07.18.05.48.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Jul 2017 05:48:49 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Tue, 18 Jul 2017 14:48:21 +0200 Message-Id: <34cb0545e8bfa7799cfdd4321bf4f6d7cbe9c816.1500381642.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 v11 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: Tue, 18 Jul 2017 12:48:51 -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 2e802aa..a42e344 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 MTU update = Y Jumbo frame = Y Promiscuous mode = Y diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index 7628c21..6006bef 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -238,6 +238,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 359b8c9..d205f61 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 e8edf15..ff9ad15 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -206,6 +206,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; @@ -218,6 +220,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), @@ -238,6 +251,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 80bbc61..2c52d2b 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