From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com [74.125.82.45]) by dpdk.org (Postfix) with ESMTP id 3E52D5599 for ; Sat, 15 Jul 2017 19:58:08 +0200 (CEST) Received: by mail-wm0-f45.google.com with SMTP id 70so15134163wmo.1 for ; Sat, 15 Jul 2017 10:58:08 -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=9k2JGIXyLU+9NNHr8vY0RnmttnFtDMdSgfJxYnMWULE=; b=ZqqWQ/11GB3E/jCq5KQKiUNO0vwJa1eojW5mhdp9WeBg7r9SKyQ5wlanYXEpKYY5MW zAZm18z4+oOhBxIGAW/xZ3A3dH+6Vye631x2NprL0WlyPntJ6/Zgiq4qM4z5Kz3PBZhp v4rINKgkgTlwj7sdjNSCBOTyp+2Y6ww+dZEl6vp/ljlDDX3t/vkEqX6J22embfCWItq7 2+tMbzXaJxv2cT5L+lNOvIS0ZXVKNRGgrVvP43vXN7zmUBZ6L6yukpItoRwDthqiMeZf guzyhn2OODem79f/0wX0AvNM7VYoZQl8CsPFQFo9jff1yQn9Og41cl5SHAQC7U8522BZ SZHQ== 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=9k2JGIXyLU+9NNHr8vY0RnmttnFtDMdSgfJxYnMWULE=; b=MJYeruhmgvcRInpuPCS5uHcFY5DdodbQq0EJxIWfbvBF8LG5P2pq3ekaP6mwx5bGX1 NavBviVZfs7ejucknweVDMT+QXq3OuCoq9QiX5w6+XOoOSMWvN9sVIAjcad7hlS//PS0 crCmiSJWClPomyvOlZGT+9sSh6U5uYlmelUTHmXktK1xsqP4AuHTJAYeATwf2s+Iv9UX a/PIy50hyieHqNPY246MxLpG6fCxMBJvgyVYD1pUnJmpEcsxYzbERkc9oZiFUDPFNs9h MrdKkp2aPQGHiGZlvh0BMfO1H4KrHtrToDP6bSkB4g4KmYF1Ip6GcL3T9yo+Nwe7BmD5 RyKA== X-Gm-Message-State: AIVw110M/m4Ti7OKy4vzjkMiuyUl6mbpNQ+l4rlMdDNKTsim+EFx/c2x a6AyXMacoEMnxhpnkS0= X-Received: by 10.28.98.66 with SMTP id w63mr1534134wmb.34.1500141487605; Sat, 15 Jul 2017 10:58:07 -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 g82sm6342745wmg.8.2017.07.15.10.58.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 15 Jul 2017 10:58:06 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Sat, 15 Jul 2017 19:57:40 +0200 Message-Id: <1e5819dd14c6c021b6aeadd36442a7c2c50c9b23.1500130635.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 v10 11/11] net/failsafe: support flow API isolation mode 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: Sat, 15 Jul 2017 17:58:09 -0000 Signed-off-by: Gaetan Rivet --- drivers/net/failsafe/failsafe_ether.c | 34 +++++++++++++++++++++++++++++++-- drivers/net/failsafe/failsafe_flow.c | 29 ++++++++++++++++++++++++++++ drivers/net/failsafe/failsafe_private.h | 4 ++++ 3 files changed, 65 insertions(+), 2 deletions(-) diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c index a694b4d..c8b9c8a 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -74,6 +74,28 @@ fs_flow_complain(struct rte_flow_error *error) } static int +eth_dev_flow_isolate_set(struct rte_eth_dev *dev, + struct sub_device *sdev) +{ + struct rte_flow_error ferror; + int ret; + + if (!PRIV(dev)->flow_isolated) { + DEBUG("Flow isolation already disabled"); + } else { + DEBUG("Enabling flow isolation"); + ret = rte_flow_isolate(PORT_ID(sdev), + PRIV(dev)->flow_isolated, + &ferror); + if (ret) { + fs_flow_complain(&ferror); + return ret; + } + } + return 0; +} + +static int fs_eth_dev_conf_apply(struct rte_eth_dev *dev, struct sub_device *sdev) { @@ -334,9 +356,17 @@ failsafe_eth_dev_state_sync(struct rte_eth_dev *dev) if (PRIV(dev)->state < DEV_ACTIVE) return 0; inactive = 0; - FOREACH_SUBDEV(sdev, i, dev) - if (sdev->state == DEV_PROBED) + FOREACH_SUBDEV(sdev, i, dev) { + if (sdev->state == DEV_PROBED) { inactive |= UINT32_C(1) << i; + ret = eth_dev_flow_isolate_set(dev, sdev); + if (ret) { + ERROR("Could not apply configuration to sub_device %d", + i); + goto err_remove; + } + } + } ret = dev->dev_ops->dev_configure(dev); if (ret) goto err_remove; diff --git a/drivers/net/failsafe/failsafe_flow.c b/drivers/net/failsafe/failsafe_flow.c index 8547e51..5217adf 100644 --- a/drivers/net/failsafe/failsafe_flow.c +++ b/drivers/net/failsafe/failsafe_flow.c @@ -206,10 +206,39 @@ fs_flow_query(struct rte_eth_dev *dev, return -1; } +static int +fs_flow_isolate(struct rte_eth_dev *dev, + int set, + struct rte_flow_error *error) +{ + struct sub_device *sdev; + uint8_t i; + int ret; + + FOREACH_SUBDEV(sdev, i, dev) { + if (sdev->state < DEV_PROBED) + continue; + DEBUG("Calling rte_flow_isolate on sub_device %d", i); + if (PRIV(dev)->flow_isolated != sdev->flow_isolated) + WARN("flow isolation mode of sub_device %d in incoherent state.", + i); + ret = rte_flow_isolate(PORT_ID(sdev), set, error); + if (ret) { + ERROR("Operation rte_flow_isolate failed for sub_device %d" + " with error %d", i, ret); + return ret; + } + sdev->flow_isolated = set; + } + PRIV(dev)->flow_isolated = set; + return 0; +} + const struct rte_flow_ops fs_flow_ops = { .validate = fs_flow_validate, .create = fs_flow_create, .destroy = fs_flow_destroy, .flush = fs_flow_flush, .query = fs_flow_query, + .isolate = fs_flow_isolate, }; diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index a9cddbc..1bff123 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -108,6 +108,8 @@ struct sub_device { struct rte_eth_dev *fs_dev; /* flag calling for recollection */ volatile unsigned int remove:1; + /* flow isolation state */ + int flow_isolated:1; }; struct fs_priv { @@ -139,6 +141,8 @@ struct fs_priv { */ enum dev_state state; unsigned int pending_alarm:1; /* An alarm is pending */ + /* flow isolation state */ + int flow_isolated:1; }; /* MISC */ -- 2.1.4