From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f181.google.com (mail-wr0-f181.google.com [209.85.128.181]) by dpdk.org (Postfix) with ESMTP id 206CC8CF2 for ; Wed, 24 May 2017 17:20:33 +0200 (CEST) Received: by mail-wr0-f181.google.com with SMTP id w50so57098092wrc.0 for ; Wed, 24 May 2017 08:20:33 -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=JbY9FzGKxF+kRI3W3woq+lNAHZRcgySbt9pwH8ePIKE=; b=fVVkcRqmveDalF7tfvyrs5OD39OghwwQXCU2cmPYzaG25XHC+5AhAD3fNQw3XmClAv bD1K/QlnbNqhbAt2HYfCwyPKhSFTb1D6XtxKOZ3pAq4gJ3cgxQBJYPJ5K+FQVGC8yiPG 1hlp5PRcCA3ooTomxv+BAnMaQSLQT442JqV6Z0P4wjmPM1H+I6xd1+RyDEoTQz2IcSrm /gV3ybi8w2HCYC8LZFhhlgNmMwqJjBhMuA5WHc4gqBrfFOOUR3+jnXtabNpqCHitantj icFGwFdGV4NYQbY/Ir6Qqkdc6lNdQiWH8r1sGcph97nf7DISFnpgBlS2f7cqgCtP67// AQEw== 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=JbY9FzGKxF+kRI3W3woq+lNAHZRcgySbt9pwH8ePIKE=; b=M7JP/9agZPAv6Y8qoalQymv11ABqU+Y/r+uFmU0L6rqERzg3rvM1Rq4pS5BlEBPh4y 9JTsg2cU9bXWE3jqL83ydexjaixlBlqxsYyowcpnKPnRs1UgcxEjUpaaRQZ2+y0pInxD q3sFiL9ZiST12cWMbv8gNL5ET4O18o6HknyG1lt0VPLiqeqkQSg+7P+YEjuAuIA+7MXq AylVPAKw5AaJLJoxH/2+abV4VFhVUhW8P0ClqtIUQAeJab+ONhiFTIJFyXlZuLK1e3j8 0C93O9Zp9Y2epDRu462TkZgUX/z6VCaLXbmmIoREY9mkoEjTUyVi9lVi2v7aaOIF2fWo bz/g== X-Gm-Message-State: AODbwcA0c+ULN4K1PGRGYmLF9Gp2QOJQnaVNXkg/1nPBV22eIvSRjfiZ YILYE/Pa7bDlpckW X-Received: by 10.223.173.23 with SMTP id p23mr22400988wrc.117.1495639232856; Wed, 24 May 2017 08:20:32 -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 t85sm5444271wmt.23.2017.05.24.08.20.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 May 2017 08:20:31 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 24 May 2017 17:20:09 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v3 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: Wed, 24 May 2017 15:20:34 -0000 Signed-off-by: Gaetan Rivet --- drivers/net/failsafe/failsafe_ether.c | 12 ++++++++++++ drivers/net/failsafe/failsafe_flow.c | 29 +++++++++++++++++++++++++++++ drivers/net/failsafe/failsafe_private.h | 4 ++++ 3 files changed, 45 insertions(+) diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c index 3401a18..3a691a1 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -218,6 +218,18 @@ fs_eth_dev_conf_apply(struct rte_eth_dev *dev, DEBUG("VLAN filter already set"); } /* rte_flow */ + 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; + } + } if (TAILQ_EMPTY(&PRIV(dev)->flow_list)) { DEBUG("rte_flow already set"); } else { 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 66303cd..a3885e8 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -109,6 +109,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 { @@ -140,6 +142,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