Show a patch.

GET /api/patches/42952/
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 42952,
    "url": "http://patches.dpdk.org/api/patches/42952/",
    "web_url": "http://patches.dpdk.org/patch/42952/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk"
    },
    "msgid": "<71d19729a8df211297b6e3bdf74807b0ef05e54c.1531387413.git.nelio.laranjeiro@6wind.com>",
    "date": "2018-07-12T09:30:51",
    "name": "[v4,05/21] net/mlx5: add flow queue action",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "f24a70ff4c5c24e94081edfe1112490b39595194",
    "submitter": {
        "id": 243,
        "url": "http://patches.dpdk.org/api/people/243/",
        "name": "Nélio Laranjeiro",
        "email": "nelio.laranjeiro@6wind.com"
    },
    "delegate": {
        "id": 6624,
        "url": "http://patches.dpdk.org/api/users/6624/",
        "username": "shahafs",
        "first_name": "Shahaf",
        "last_name": "Shuler",
        "email": "shahafs@mellanox.com"
    },
    "mbox": "http://patches.dpdk.org/patch/42952/mbox/",
    "series": [
        {
            "id": 544,
            "url": "http://patches.dpdk.org/api/series/544/",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=544",
            "date": "2018-07-12T09:30:46",
            "name": "net/mlx5: flow rework",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/544/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/42952/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/42952/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "In-Reply-To": "<cover.1531387413.git.nelio.laranjeiro@6wind.com>",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Mailer": "git-send-email 2.18.0",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 0B8831B5BD;\n\tThu, 12 Jul 2018 11:31:39 +0200 (CEST)",
            "from mail-wr1-f65.google.com (mail-wr1-f65.google.com\n\t[209.85.221.65]) by dpdk.org (Postfix) with ESMTP id DCEAE1B550\n\tfor <dev@dpdk.org>; Thu, 12 Jul 2018 11:31:29 +0200 (CEST)",
            "by mail-wr1-f65.google.com with SMTP id g6-v6so12048228wrp.0\n\tfor <dev@dpdk.org>; Thu, 12 Jul 2018 02:31:29 -0700 (PDT)",
            "from laranjeiro-vm.dev.6wind.com\n\t(host.78.145.23.62.rev.coltfrance.com. [62.23.145.78])\n\tby smtp.gmail.com with ESMTPSA id\n\ts2-v6sm18717603wrn.75.2018.07.12.02.31.28\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 12 Jul 2018 02:31:28 -0700 (PDT)"
        ],
        "References": "<cover.1531293415.git.nelio.laranjeiro@6wind.com>\n\t<cover.1531387413.git.nelio.laranjeiro@6wind.com>",
        "X-Google-Smtp-Source": "AAOMgpdwOnrYG0Zmq8sTjsvVTuj20Gj4hstHpqPw4KRFOO4YyT5KUKIM/fTgJWKbHpTtTYsWCDLy4A==",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=6wind-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=ZEIFVBxPBpaxjyp1iYHHlFX3tzI/If+jotUy4ZQt4/4=;\n\tb=ln3vUCj0b87/+Hvc0r1RWyUAhLRW9aGAHYFVT4VrAYLjurl37jex8RMdYwysvedCR5\n\tjUChWYwatVWVHZF5/OcpSqXH8fH/yQ/gGRan2Ea22O3CXuSEzh+w+FA6fEBeLS/ViF7T\n\tgP4TZYjLm6vUFv4leTRf/eeo2X6WwAr/zg0iGuw1biC5bCeCldUVppYEy0C9kx+yL9zj\n\tWgxIy6/Y/E+ne5xv4LkapmmBppsPqKhPrWwWq1hOmd8BNmpRsI7qJtbpppcT/os68ZA+\n\t98WyC5tyrizq6e28Fs0CrcbYoFZEPHWVRhB10PV3+r/PjSwgkId0w1mZ2QOQNiVPPVhU\n\tT3Dw==",
        "X-BeenThere": "dev@dpdk.org",
        "X-Received": "by 2002:adf:c4a7:: with SMTP id\n\tm36-v6mr1124617wrf.103.1531387889214; \n\tThu, 12 Jul 2018 02:31:29 -0700 (PDT)",
        "Message-Id": "<71d19729a8df211297b6e3bdf74807b0ef05e54c.1531387413.git.nelio.laranjeiro@6wind.com>",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=ZEIFVBxPBpaxjyp1iYHHlFX3tzI/If+jotUy4ZQt4/4=;\n\tb=Y9gY9NnYeXhHXAGPlOrp/7Dz7E1NmGmFGU/Xuz5Iu84yB5wn5BX8xYXZc1eF1DDB/B\n\tG/ohilIC9XEhsBfTzVtLKWXd9tzm0VMqCvdd/hv+q7LT1k4qDHPVRelteReOAH33OaU8\n\tYe4VQrAmjvwwNyRZ4K5Ecx96LD2hCbu1wdnd2OxQQigTiIso8CsDqFInbsbpCQVLwcn4\n\tZcXjk40P1pAEuypKFfhT59M7W2YEc3+dTAOKutisnp3KygPsl76oeGmAcyxEjFQktulN\n\t83bVg5Y9SZe3qUZKzpjwtQdLZwgBbv0gbFbF4bzR7n2GZMYJWWbdHf96Q2ezPgUb23fj\n\t0IrQ==",
        "Delivered-To": "patchwork@dpdk.org",
        "Precedence": "list",
        "From": "Nelio Laranjeiro <nelio.laranjeiro@6wind.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "To": "dev@dpdk.org,\n\tYongseok Koh <yskoh@mellanox.com>",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Date": "Thu, 12 Jul 2018 11:30:51 +0200",
        "X-Gm-Message-State": "AOUpUlFF/kICzZk8pyh+oiOAeu+EUsXQ9x/Th3Csyxv3rFMg/tM0l8/q\n\ti+Y5T3VWhrDU97c+GlX87J+iBsrj3Q==",
        "Cc": "Adrien Mazarguil <adrien.mazarguil@6wind.com>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH v4 05/21] net/mlx5: add flow queue action"
    },
    "content": "Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>\nAcked-by: Yongseok Koh <yskoh@mellanox.com>\n---\n drivers/net/mlx5/mlx5_flow.c | 97 ++++++++++++++++++++++++++++++++----\n 1 file changed, 86 insertions(+), 11 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c\nindex 036a8d440..6041a4573 100644\n--- a/drivers/net/mlx5/mlx5_flow.c\n+++ b/drivers/net/mlx5/mlx5_flow.c\n@@ -50,6 +50,7 @@ extern const struct eth_dev_ops mlx5_dev_ops_isolate;\n \n /* Actions that modify the fate of matching traffic. */\n #define MLX5_FLOW_FATE_DROP (1u << 0)\n+#define MLX5_FLOW_FATE_QUEUE (1u << 1)\n \n /** Handles information leading to a drop fate. */\n struct mlx5_flow_verbs {\n@@ -71,7 +72,8 @@ struct rte_flow {\n \t/**< Bit-fields of present layers see MLX5_FLOW_LAYER_*. */\n \tuint32_t fate;\n \t/**< Bit-fields of present fate see MLX5_FLOW_FATE_*. */\n-\tstruct mlx5_flow_verbs verbs; /* Verbs drop flow. */\n+\tstruct mlx5_flow_verbs verbs; /* Verbs flow. */\n+\tuint16_t queue; /**< Destination queue to redirect traffic to. */\n };\n \n static const struct rte_flow_ops mlx5_flow_ops = {\n@@ -492,6 +494,52 @@ mlx5_flow_action_drop(const struct rte_flow_action *action,\n \treturn size;\n }\n \n+/**\n+ * Convert the @p action into @p flow after ensuring the NIC will understand\n+ * and process it correctly.\n+ *\n+ * @param[in] dev\n+ *   Pointer to Ethernet device structure.\n+ * @param[in] action\n+ *   Action configuration.\n+ * @param[in, out] flow\n+ *   Pointer to flow structure.\n+ * @param[out] error\n+ *   Pointer to error structure.\n+ *\n+ * @return\n+ *   0 on success, a negative errno value otherwise and rte_errno is set.\n+ */\n+static int\n+mlx5_flow_action_queue(struct rte_eth_dev *dev,\n+\t\t       const struct rte_flow_action *action,\n+\t\t       struct rte_flow *flow,\n+\t\t       struct rte_flow_error *error)\n+{\n+\tstruct priv *priv = dev->data->dev_private;\n+\tconst struct rte_flow_action_queue *queue = action->conf;\n+\n+\tif (flow->fate)\n+\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION,\n+\t\t\t\t\t  action,\n+\t\t\t\t\t  \"multiple fate actions are not\"\n+\t\t\t\t\t  \" supported\");\n+\tif (queue->index >= priv->rxqs_n)\n+\t\treturn rte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION_CONF,\n+\t\t\t\t\t  &queue->index,\n+\t\t\t\t\t  \"queue index out of range\");\n+\tif (!(*priv->rxqs)[queue->index])\n+\t\treturn rte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION_CONF,\n+\t\t\t\t\t  &queue->index,\n+\t\t\t\t\t  \"queue is not configured\");\n+\tflow->queue = queue->index;\n+\tflow->fate |= MLX5_FLOW_FATE_QUEUE;\n+\treturn 0;\n+}\n+\n /**\n  * Convert the @p action into @p flow after ensuring the NIC will understand\n  * and process it correctly.\n@@ -520,7 +568,7 @@ mlx5_flow_action_drop(const struct rte_flow_action *action,\n  *   On error, a negative errno value is returned and rte_errno is set.\n  */\n static int\n-mlx5_flow_actions(struct rte_eth_dev *dev __rte_unused,\n+mlx5_flow_actions(struct rte_eth_dev *dev,\n \t\t  const struct rte_flow_action actions[],\n \t\t  struct rte_flow *flow, const size_t flow_size,\n \t\t  struct rte_flow_error *error)\n@@ -537,6 +585,9 @@ mlx5_flow_actions(struct rte_eth_dev *dev __rte_unused,\n \t\t\tret = mlx5_flow_action_drop(actions, flow, remain,\n \t\t\t\t\t\t    error);\n \t\t\tbreak;\n+\t\tcase RTE_FLOW_ACTION_TYPE_QUEUE:\n+\t\t\tret = mlx5_flow_action_queue(dev, actions, flow, error);\n+\t\t\tbreak;\n \t\tdefault:\n \t\t\treturn rte_flow_error_set(error, ENOTSUP,\n \t\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION,\n@@ -661,7 +712,10 @@ mlx5_flow_remove(struct rte_eth_dev *dev, struct rte_flow *flow)\n \t\t}\n \t}\n \tif (flow->verbs.hrxq) {\n-\t\tmlx5_hrxq_drop_release(dev);\n+\t\tif (flow->fate & MLX5_FLOW_FATE_DROP)\n+\t\t\tmlx5_hrxq_drop_release(dev);\n+\t\telse if (flow->fate & MLX5_FLOW_FATE_QUEUE)\n+\t\t\tmlx5_hrxq_release(dev, flow->verbs.hrxq);\n \t\tflow->verbs.hrxq = NULL;\n \t}\n }\n@@ -683,17 +737,38 @@ static int\n mlx5_flow_apply(struct rte_eth_dev *dev, struct rte_flow *flow,\n \t\tstruct rte_flow_error *error)\n {\n-\tflow->verbs.hrxq = mlx5_hrxq_drop_new(dev);\n-\tif (!flow->verbs.hrxq)\n-\t\treturn rte_flow_error_set\n-\t\t\t(error, errno,\n-\t\t\t RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t NULL,\n-\t\t\t \"cannot allocate Drop queue\");\n+\tif (flow->fate & MLX5_FLOW_FATE_DROP) {\n+\t\tflow->verbs.hrxq = mlx5_hrxq_drop_new(dev);\n+\t\tif (!flow->verbs.hrxq)\n+\t\t\treturn rte_flow_error_set\n+\t\t\t\t(error, errno,\n+\t\t\t\t RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\t NULL,\n+\t\t\t\t \"cannot allocate Drop queue\");\n+\t} else if (flow->fate & MLX5_FLOW_FATE_QUEUE) {\n+\t\tstruct mlx5_hrxq *hrxq;\n+\n+\t\thrxq = mlx5_hrxq_get(dev, rss_hash_default_key,\n+\t\t\t\t     rss_hash_default_key_len, 0,\n+\t\t\t\t     &flow->queue, 1, 0, 0);\n+\t\tif (!hrxq)\n+\t\t\thrxq = mlx5_hrxq_new(dev, rss_hash_default_key,\n+\t\t\t\t\t     rss_hash_default_key_len, 0,\n+\t\t\t\t\t     &flow->queue, 1, 0, 0);\n+\t\tif (!hrxq)\n+\t\t\treturn rte_flow_error_set(error, rte_errno,\n+\t\t\t\t\tRTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\t\tNULL,\n+\t\t\t\t\t\"cannot create flow\");\n+\t\tflow->verbs.hrxq = hrxq;\n+\t}\n \tflow->verbs.flow =\n \t\tmlx5_glue->create_flow(flow->verbs.hrxq->qp, flow->verbs.attr);\n \tif (!flow->verbs.flow) {\n-\t\tmlx5_hrxq_drop_release(dev);\n+\t\tif (flow->fate & MLX5_FLOW_FATE_DROP)\n+\t\t\tmlx5_hrxq_drop_release(dev);\n+\t\telse\n+\t\t\tmlx5_hrxq_release(dev, flow->verbs.hrxq);\n \t\tflow->verbs.hrxq = NULL;\n \t\treturn rte_flow_error_set(error, errno,\n \t\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n",
    "prefixes": [
        "v4",
        "05/21"
    ]
}