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 366478D9C for ; Wed, 25 Apr 2018 17:28:24 +0200 (CEST) Received: by mail-wr0-f179.google.com with SMTP id h3-v6so53773687wrh.5 for ; Wed, 25 Apr 2018 08:28:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=R59NSydPU9h7CUvdtNcrO43BQ88DkhhwygjItYdxA8o=; b=kB0JqvS8Tb6qS4yuudeoYWv96QOa+j3qE1BL0+hAplzXkL83P+dj/uXA3Vy/UKmcLt 4oDAUrORpTjC8YJ6+qzBTXXt/vaUvJT+S1W9Ugzv73xvRbXInEZ6JFpo0kbusIADtGpK yruQmnhLOAb7AdEks6albQ0YeTyqNsnDwPgmLhfRQ0VU3OdoxGHRJhDp/KpzEKhvQVN6 8yV5cPYyIQgh5frcBw6MUv/SX/vzVw5MN/wWId7meXzLq356WDf+7Wu6J6SXdZnngET6 x3vAwAAa6Gma3D30xaPH7TkTQotaIDVAWGXI5kUmjAi7Hvm36SBhiH9Utdr7y/jgEewx HR2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=R59NSydPU9h7CUvdtNcrO43BQ88DkhhwygjItYdxA8o=; b=poZkdx9mH9Vnf85ydfNdVpJc6NW/e2LdR+1lB/Qs8zG0QpSdGX50NVdRYBgKsF/dt5 JotjseNX0UZQWY7c528GINDKWyL2fEHwadsdrPvPGuCnzxYh8qmkSSPO5v1KiTAh0BLc 6AtjBoz22aNobeVa+2TNviRmTlzoTxzkgFatJqxvuCxsMj0vwptbN5jT8SCOAcTFiRzU tFg3Ad2EO5Sdoe9b7wRKI1hQa+7cRuf5fUDwzl0snL6KlmLbHnQHnhxNH1XJRBqCoHhf xcKj8V66sJz5qKZefZnzK7IUFPOvS5oyz2taWGmt1dyPjkx/KkkHml7hKLFMXI4D6cwB 7Qqg== X-Gm-Message-State: ALQs6tBGp/S/kNB1VAY4q/6pYgdH1dWmMofMyD/46++CNLSDhjO+IWvE uGOPgfpV3VkxMpUL/g6+NoTN4Pj0 X-Google-Smtp-Source: AB8JxZqx0T5jw4d2CpodDx0PxZXBSXA7iVD5cKhRM988n49n7ji93PrtXFWobVU0hikN8ueMFbqebQ== X-Received: by 2002:adf:984c:: with SMTP id v70-v6mr2346886wrb.100.1524670102925; Wed, 25 Apr 2018 08:28:22 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id c27-v6sm23413701wrg.75.2018.04.25.08.28.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Apr 2018 08:28:22 -0700 (PDT) Date: Wed, 25 Apr 2018 17:28:08 +0200 From: Adrien Mazarguil To: Thomas Monjalon , Ferruh Yigit , dev@dpdk.org Cc: "Zhang, Qi Z" Message-ID: <20180425151852.7676-16-adrien.mazarguil@6wind.com> References: <20180419100848.6178-1-adrien.mazarguil@6wind.com> <20180425151852.7676-1-adrien.mazarguil@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180425151852.7676-1-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH v6 15/16] ethdev: add physical port action to flow API 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, 25 Apr 2018 15:28:24 -0000 This patch adds the missing action counterpart to the PHY_PORT pattern item, that is, the ability to directly inject matching traffic into a physical port of the underlying device. It breaks ABI compatibility for the following public functions: - rte_flow_copy() - rte_flow_create() - rte_flow_query() - rte_flow_validate() Signed-off-by: Adrien Mazarguil Acked-by: Andrew Rybchenko Acked-by: Mohammad Abdul Awal Cc: "Zhang, Qi Z" --- v6 changes: Updated API changes section in release notes. --- app/test-pmd/cmdline_flow.c | 35 ++++++++++++++++++++++++ app/test-pmd/config.c | 1 + doc/guides/prog_guide/rte_flow.rst | 20 ++++++++++++++ doc/guides/rel_notes/release_18_05.rst | 2 ++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 5 ++++ lib/librte_ether/rte_flow.c | 1 + lib/librte_ether/rte_flow.h | 22 +++++++++++++++ 7 files changed, 86 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index f9f937277..356714801 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -182,6 +182,9 @@ enum index { ACTION_VF, ACTION_VF_ORIGINAL, ACTION_VF_ID, + ACTION_PHY_PORT, + ACTION_PHY_PORT_ORIGINAL, + ACTION_PHY_PORT_INDEX, ACTION_METER, ACTION_METER_ID, }; @@ -623,6 +626,7 @@ static const enum index next_action[] = { ACTION_RSS, ACTION_PF, ACTION_VF, + ACTION_PHY_PORT, ACTION_METER, ZERO, }; @@ -657,6 +661,13 @@ static const enum index action_vf[] = { ZERO, }; +static const enum index action_phy_port[] = { + ACTION_PHY_PORT_ORIGINAL, + ACTION_PHY_PORT_INDEX, + ACTION_NEXT, + ZERO, +}; + static const enum index action_meter[] = { ACTION_METER_ID, ACTION_NEXT, @@ -1714,6 +1725,30 @@ static const struct token token_list[] = { .args = ARGS(ARGS_ENTRY(struct rte_flow_action_vf, id)), .call = parse_vc_conf, }, + [ACTION_PHY_PORT] = { + .name = "phy_port", + .help = "direct packets to physical port index", + .priv = PRIV_ACTION(PHY_PORT, + sizeof(struct rte_flow_action_phy_port)), + .next = NEXT(action_phy_port), + .call = parse_vc, + }, + [ACTION_PHY_PORT_ORIGINAL] = { + .name = "original", + .help = "use original port index if possible", + .next = NEXT(action_phy_port, NEXT_ENTRY(BOOLEAN)), + .args = ARGS(ARGS_ENTRY_BF(struct rte_flow_action_phy_port, + original, 1)), + .call = parse_vc_conf, + }, + [ACTION_PHY_PORT_INDEX] = { + .name = "index", + .help = "physical port index", + .next = NEXT(action_phy_port, NEXT_ENTRY(UNSIGNED)), + .args = ARGS(ARGS_ENTRY(struct rte_flow_action_phy_port, + index)), + .call = parse_vc_conf, + }, [ACTION_METER] = { .name = "meter", .help = "meter the directed packets at given id", diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index d168e515d..869c6663b 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1091,6 +1091,7 @@ static const struct { MK_FLOW_ACTION(RSS, sizeof(struct rte_flow_action_rss)), MK_FLOW_ACTION(PF, 0), MK_FLOW_ACTION(VF, sizeof(struct rte_flow_action_vf)), + MK_FLOW_ACTION(PHY_PORT, sizeof(struct rte_flow_action_phy_port)), MK_FLOW_ACTION(METER, sizeof(struct rte_flow_action_meter)), }; diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 4e053c24b..a39c1e1b0 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1433,6 +1433,26 @@ See `Item: VF`_. | ``id`` | VF ID | +--------------+--------------------------------+ +Action: ``PHY_PORT`` +^^^^^^^^^^^^^^^^^^^^ + +Directs matching traffic to a given physical port index of the underlying +device. + +See `Item: PHY_PORT`_. + +.. _table_rte_flow_action_phy_port: + +.. table:: PHY_PORT + + +--------------+-------------------------------------+ + | Field | Value | + +==============+=====================================+ + | ``original`` | use original port index if possible | + +--------------+-------------------------------------+ + | ``index`` | physical port index | + +--------------+-------------------------------------+ + Action: ``METER`` ^^^^^^^^^^^^^^^^^ diff --git a/doc/guides/rel_notes/release_18_05.rst b/doc/guides/rel_notes/release_18_05.rst index 86dd710d2..211f68da1 100644 --- a/doc/guides/rel_notes/release_18_05.rst +++ b/doc/guides/rel_notes/release_18_05.rst @@ -273,6 +273,8 @@ API Changes consistency. * Pattern item PORT was renamed PHY_PORT to avoid confusion with DPDK port IDs. + * An action counterpart to the PHY_PORT pattern item was added in order to + redirect matching traffic to a specific physical port. ABI Changes diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 51d36d346..9733a7262 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3447,6 +3447,11 @@ This section lists supported actions and their attributes, if any. - ``original {boolean}``: use original VF ID if possible. - ``id {unsigned}``: VF ID. +- ``phy_port``: direct packets to physical port index. + + - ``original {boolean}``: use original port index if possible. + - ``index {unsigned}``: physical port index. + Destroying flow rules ~~~~~~~~~~~~~~~~~~~~~ diff --git a/lib/librte_ether/rte_flow.c b/lib/librte_ether/rte_flow.c index 36e277a4f..00989c73b 100644 --- a/lib/librte_ether/rte_flow.c +++ b/lib/librte_ether/rte_flow.c @@ -76,6 +76,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = { MK_FLOW_ACTION(RSS, sizeof(struct rte_flow_action_rss)), MK_FLOW_ACTION(PF, 0), MK_FLOW_ACTION(VF, sizeof(struct rte_flow_action_vf)), + MK_FLOW_ACTION(PHY_PORT, sizeof(struct rte_flow_action_phy_port)), }; static int diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h index 2c7c4d009..58b75e934 100644 --- a/lib/librte_ether/rte_flow.h +++ b/lib/librte_ether/rte_flow.h @@ -989,6 +989,14 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_VF, /** + * Directs packets to a given physical port index of the underlying + * device. + * + * See struct rte_flow_action_phy_port. + */ + RTE_FLOW_ACTION_TYPE_PHY_PORT, + + /** * Traffic metering and policing (MTR). * * See struct rte_flow_action_meter. @@ -1112,6 +1120,20 @@ struct rte_flow_action_vf { }; /** + * RTE_FLOW_ACTION_TYPE_PHY_PORT + * + * Directs packets to a given physical port index of the underlying + * device. + * + * @see RTE_FLOW_ITEM_TYPE_PHY_PORT + */ +struct rte_flow_action_phy_port { + uint32_t original:1; /**< Use original port index if possible. */ + uint32_t reserved:31; /**< Reserved, must be zero. */ + uint32_t index; /**< Physical port index. */ +}; + +/** * RTE_FLOW_ACTION_TYPE_METER * * Traffic metering and policing (MTR). -- 2.11.0