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 E0FD37CE1 for ; Fri, 7 Jul 2017 02:10:34 +0200 (CEST) Received: by mail-wr0-f169.google.com with SMTP id k67so24236147wrc.2 for ; Thu, 06 Jul 2017 17:10:34 -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=tK8N38zv+1XCLQBHkQzhQtH8NHRU/Dnje/JLwgZdags=; b=mvjwL0tberYNipluh8S+vzgPlozyko2bRkAIV2nCr4x420IVk6PTcbxIiLV5UjyOt3 7WrdsFW7kThzjZrom2A1B+SNM+CzVXwEplBbwOYsJfxg/zU5CZb54kTmntH0xxbUfWPV CZ69y9+x3qKwtL3l6f++CNJTfbslkukxqPeNh1krMgIUugoZ1hJf4cd9GDnHP1T4RVfw 5/absmGi828ZOUmi5cHCXCANDgh8emuIDZ4xLbHEiqDu4BxD1fAWooR4vXylJSfxo8W3 Gan0adyunDSdSV1F11HdgowuEnLAsvvbfncdUZvtA25GqO/JWWwwZlUnka4k0Fsxi8FU aYiA== 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=tK8N38zv+1XCLQBHkQzhQtH8NHRU/Dnje/JLwgZdags=; b=RrkH1QHsyDojJxPC0xo9d2+LRCHznXEIjpFU91HJmY07YnYKvORbBR3RnQs+WDpRdq UJ7S12AwVMqdU7tHly5ZG5sv66V1BSfAdxxrDKskJtDLjR5X8if74x5tOKtu5FQGuSl+ Q05yQ0C60LJ5fJrhyUlpY3Zhr+NZ1mqO1aClWjQiOuNKSdYnotsL4TrgcBCKjSCTEiV7 rNiPzlNN9i7X2cEadFAdl/AP2m0EdD+u8p8A0UU4WxI05Q3ANwLAFLHRdLZPYx8pwQ/b gjmGO6q+G+KsLDwKKBvdRotRQBoTdqLuZcbVbXq5oQWpCwMZK3C7dvyex6oQh4At0Ady DsLQ== X-Gm-Message-State: AKS2vOw8DLGw41H/lyPFiM5uHXuCz+CHYAtpQnVBrsJEvSZXi/JFoltw CDVqWh3EV9d++A4RVfk= X-Received: by 10.223.147.132 with SMTP id 4mr45217373wrp.107.1499386234396; Thu, 06 Jul 2017 17:10:34 -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 f45sm2391166wrf.2.2017.07.06.17.10.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Jul 2017 17:10:33 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Fri, 7 Jul 2017 02:09:42 +0200 Message-Id: <64c0e7f710c2f37746d771279c192acbcc9352d6.1499384906.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 v6 23/23] 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: Fri, 07 Jul 2017 00:10:35 -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 d8f59a1..a5598ae 100644 --- a/drivers/net/failsafe/failsafe_flow.c +++ b/drivers/net/failsafe/failsafe_flow.c @@ -207,10 +207,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 6b34998..a071ad9 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