get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 30136,
    "url": "https://patches.dpdk.org/api/patches/30136/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/31b0fb1d1233fc2fed7855ed8dac004cf03a9c9f.1507730496.git.adrien.mazarguil@6wind.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "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",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<31b0fb1d1233fc2fed7855ed8dac004cf03a9c9f.1507730496.git.adrien.mazarguil@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/31b0fb1d1233fc2fed7855ed8dac004cf03a9c9f.1507730496.git.adrien.mazarguil@6wind.com",
    "date": "2017-10-11T14:35:17",
    "name": "[dpdk-dev,v1,15/29] net/mlx4: simplify trigger code for flow rules",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "52ad37ccfb96bbc164abfb34e1adf203d623d6e5",
    "submitter": {
        "id": 165,
        "url": "https://patches.dpdk.org/api/people/165/?format=api",
        "name": "Adrien Mazarguil",
        "email": "adrien.mazarguil@6wind.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/31b0fb1d1233fc2fed7855ed8dac004cf03a9c9f.1507730496.git.adrien.mazarguil@6wind.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/30136/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/30136/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 759041B25E;\n\tWed, 11 Oct 2017 16:36:49 +0200 (CEST)",
            "from mail-wm0-f41.google.com (mail-wm0-f41.google.com\n\t[74.125.82.41]) by dpdk.org (Postfix) with ESMTP id 1FE7E1B21B\n\tfor <dev@dpdk.org>; Wed, 11 Oct 2017 16:36:36 +0200 (CEST)",
            "by mail-wm0-f41.google.com with SMTP id u138so5448733wmu.4\n\tfor <dev@dpdk.org>; Wed, 11 Oct 2017 07:36:36 -0700 (PDT)",
            "from 6wind.com (host.78.145.23.62.rev.coltfrance.com.\n\t[62.23.145.78]) by smtp.gmail.com with ESMTPSA id\n\te17sm29627837wmf.46.2017.10.11.07.36.34\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 11 Oct 2017 07:36:34 -0700 (PDT)"
        ],
        "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=yLDMduvdTDowW/mq5B0RMoF7uLGuOp/vi1aBm7ljeag=;\n\tb=kSUC7sF42gBZaNPMNOR5Nh3GHHDHG0+Qc0dJfZ1A29lXfZE69DSLf0gw7l1+t4NXfj\n\tjE76fts0mFdHXmgq0COTixnl5Mz9gCHgAfCo7DPzfzDdJ5TgqMls0JTOUZTc7pwPPunD\n\tnDtieU6Jkd0ixcYyBfepwaeDv0UKmKpgjDJDXrUusUFZB7ucM8ECIZKYJYMGV8fkdKwZ\n\twFljo0RrwXRZUfS6U7AAthiZn6QsObtxyDhanKAkEwEE9QazMHIZnqyIcrprKweuU/KZ\n\tk+F2lZHMwXV9fuWW1fJerdpijNEpTyljtE+2VTVl4ofCE9AS9IkM+pdUpAFCAWOGa56w\n\tcAOQ==",
        "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=yLDMduvdTDowW/mq5B0RMoF7uLGuOp/vi1aBm7ljeag=;\n\tb=L0pbsyDjlwb6nvQv4j9AqJW9NvwWKbieNF4HwfUOLzW5QBp//eno/zAv+1VxC6gxSh\n\tQ/EpGMfk780JMhyXJt1P89kHuSzCltTHIcYtWKA6IXCYFTkOBTYQYMuPjD8+IB/lmHK2\n\tBR3rk0DypMV4keJDnz1FhbqTg2GWaqRXyF5R6/SK8jubhkW5fBo2LMqU6KzifgK36JKE\n\tLSCJi9UW4C8yjZ+Z6BBI53SNcm46JLSXVS/FxPj+wLtTFDiK4cQPlh5Q4lmw06J/Ggxe\n\t5Mv5YUzm7XOTskDLfPHO4frbdQQQ7GiTWri1rW1w9XSLtA0U1pshYlYRqXJ/TtOxfLU3\n\twnAw==",
        "X-Gm-Message-State": "AMCzsaXkf/JJ/oog+z+R7dYUdxrFePQ5dYi/W4XwDwjO8ooyzAB7JDUR\n\tBx61gn1kj8cOxUlhGQZbCeTbig==",
        "X-Google-Smtp-Source": "AOwi7QCM7pZTIU+clXZ0DHBoclkVTuD5yNQEuLDJKT5jaPOWiU8xV89DPLItdTKtVfXYVjzhdHV6AQ==",
        "X-Received": "by 10.223.134.157 with SMTP id 29mr14730993wrx.72.1507732595716; \n\tWed, 11 Oct 2017 07:36:35 -0700 (PDT)",
        "From": "Adrien Mazarguil <adrien.mazarguil@6wind.com>",
        "To": "Ferruh Yigit <ferruh.yigit@intel.com>",
        "Cc": "dev@dpdk.org",
        "Date": "Wed, 11 Oct 2017 16:35:17 +0200",
        "Message-Id": "<31b0fb1d1233fc2fed7855ed8dac004cf03a9c9f.1507730496.git.adrien.mazarguil@6wind.com>",
        "X-Mailer": "git-send-email 2.1.4",
        "In-Reply-To": "<cover.1507730496.git.adrien.mazarguil@6wind.com>",
        "References": "<cover.1507730496.git.adrien.mazarguil@6wind.com>",
        "Subject": "[dpdk-dev] [PATCH v1 15/29] net/mlx4: simplify trigger code for\n\tflow rules",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Since flow rules synchronization function mlx4_flow_sync() takes into\naccount the state of the device (whether it is started), trigger functions\nmlx4_flow_start() and mlx4_flow_stop() are redundant. Standardize on\nmlx4_flow_sync().\n\nUse this opportunity to enhance this function with better error reporting\nas the inability to start the device due to a problem with a flow rule\notherwise results in a nondescript error code.\n\nSigned-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>\nAcked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>\n---\n drivers/net/mlx4/mlx4.c      | 25 ++++++++-----\n drivers/net/mlx4/mlx4_flow.c | 76 +++++++++------------------------------\n drivers/net/mlx4/mlx4_flow.h |  4 +--\n drivers/net/mlx4/mlx4_rxq.c  | 14 ++++++--\n 4 files changed, 46 insertions(+), 73 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c\nindex 40c0ee2..256aa3d 100644\n--- a/drivers/net/mlx4/mlx4.c\n+++ b/drivers/net/mlx4/mlx4.c\n@@ -60,6 +60,7 @@\n #include <rte_ethdev.h>\n #include <rte_ethdev_pci.h>\n #include <rte_ether.h>\n+#include <rte_flow.h>\n #include <rte_interrupts.h>\n #include <rte_kvargs.h>\n #include <rte_malloc.h>\n@@ -97,13 +98,17 @@ static int\n mlx4_dev_configure(struct rte_eth_dev *dev)\n {\n \tstruct priv *priv = dev->data->dev_private;\n+\tstruct rte_flow_error error;\n \tint ret;\n \n \t/* Prepare internal flow rules. */\n-\tret = mlx4_flow_sync(priv);\n-\tif (ret)\n-\t\tERROR(\"cannot set up internal flow rules: %s\",\n-\t\t      strerror(-ret));\n+\tret = mlx4_flow_sync(priv, &error);\n+\tif (ret) {\n+\t\tERROR(\"cannot set up internal flow rules (code %d, \\\"%s\\\"),\"\n+\t\t      \" flow error type %d, cause %p, message: %s\",\n+\t\t      -ret, strerror(-ret), error.type, error.cause,\n+\t\t      error.message ? error.message : \"(unspecified)\");\n+\t}\n \treturn ret;\n }\n \n@@ -122,6 +127,7 @@ static int\n mlx4_dev_start(struct rte_eth_dev *dev)\n {\n \tstruct priv *priv = dev->data->dev_private;\n+\tstruct rte_flow_error error;\n \tint ret;\n \n \tif (priv->started)\n@@ -134,10 +140,13 @@ mlx4_dev_start(struct rte_eth_dev *dev)\n \t\t     (void *)dev);\n \t\tgoto err;\n \t}\n-\tret = mlx4_flow_start(priv);\n+\tret = mlx4_flow_sync(priv, &error);\n \tif (ret) {\n-\t\tERROR(\"%p: flow start failed: %s\",\n-\t\t      (void *)dev, strerror(ret));\n+\t\tERROR(\"%p: cannot attach flow rules (code %d, \\\"%s\\\"),\"\n+\t\t      \" flow error type %d, cause %p, message: %s\",\n+\t\t      (void *)dev,\n+\t\t      -ret, strerror(-ret), error.type, error.cause,\n+\t\t      error.message ? error.message : \"(unspecified)\");\n \t\tgoto err;\n \t}\n \treturn 0;\n@@ -164,7 +173,7 @@ mlx4_dev_stop(struct rte_eth_dev *dev)\n \t\treturn;\n \tDEBUG(\"%p: detaching flows from all RX queues\", (void *)dev);\n \tpriv->started = 0;\n-\tmlx4_flow_stop(priv);\n+\tmlx4_flow_sync(priv, NULL);\n \tmlx4_intr_uninstall(priv);\n }\n \ndiff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c\nindex c4de9d9..218b23f 100644\n--- a/drivers/net/mlx4/mlx4_flow.c\n+++ b/drivers/net/mlx4/mlx4_flow.c\n@@ -956,14 +956,9 @@ mlx4_flow_isolate(struct rte_eth_dev *dev,\n \tif (!!enable == !!priv->isolated)\n \t\treturn 0;\n \tpriv->isolated = !!enable;\n-\tif (mlx4_flow_sync(priv)) {\n+\tif (mlx4_flow_sync(priv, error)) {\n \t\tpriv->isolated = !enable;\n-\t\treturn rte_flow_error_set(error, rte_errno,\n-\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\t\t  NULL,\n-\t\t\t\t\t  enable ?\n-\t\t\t\t\t  \"cannot enter isolated mode\" :\n-\t\t\t\t\t  \"cannot leave isolated mode\");\n+\t\treturn -rte_errno;\n \t}\n \treturn 0;\n }\n@@ -1075,12 +1070,14 @@ mlx4_flow_internal(struct priv *priv, struct rte_flow_error *error)\n  *\n  * @param priv\n  *   Pointer to private structure.\n+ * @param[out] error\n+ *   Perform verbose error reporting if not NULL.\n  *\n  * @return\n  *   0 on success, a negative errno value otherwise and rte_errno is set.\n  */\n int\n-mlx4_flow_sync(struct priv *priv)\n+mlx4_flow_sync(struct priv *priv, struct rte_flow_error *error)\n {\n \tstruct rte_flow *flow;\n \tint ret;\n@@ -1094,20 +1091,27 @@ mlx4_flow_sync(struct priv *priv)\n \t\tfor (flow = LIST_FIRST(&priv->flows);\n \t\t     flow && flow->internal;\n \t\t     flow = LIST_FIRST(&priv->flows))\n-\t\t\tclaim_zero(mlx4_flow_destroy(priv->dev, flow, NULL));\n+\t\t\tclaim_zero(mlx4_flow_destroy(priv->dev, flow, error));\n \t} else if (!LIST_FIRST(&priv->flows) ||\n \t\t   !LIST_FIRST(&priv->flows)->internal) {\n \t\t/*\n \t\t * If the first rule is not internal outside isolated mode,\n \t\t * they must be added back.\n \t\t */\n-\t\tret = mlx4_flow_internal(priv, NULL);\n+\t\tret = mlx4_flow_internal(priv, error);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\t/* Toggle the remaining flow rules . */\n+\tfor (flow = LIST_FIRST(&priv->flows);\n+\t     flow;\n+\t     flow = LIST_NEXT(flow, next)) {\n+\t\tret = mlx4_flow_toggle(priv, flow, priv->started, error);\n \t\tif (ret)\n \t\t\treturn ret;\n \t}\n-\tif (priv->started)\n-\t\treturn mlx4_flow_start(priv);\n-\tmlx4_flow_stop(priv);\n+\tif (!priv->started)\n+\t\tassert(!priv->drop);\n \treturn 0;\n }\n \n@@ -1129,52 +1133,6 @@ mlx4_flow_clean(struct priv *priv)\n \t\tmlx4_flow_destroy(priv->dev, flow, NULL);\n }\n \n-/**\n- * Disable flow rules.\n- *\n- * @param priv\n- *   Pointer to private structure.\n- */\n-void\n-mlx4_flow_stop(struct priv *priv)\n-{\n-\tstruct rte_flow *flow;\n-\n-\tfor (flow = LIST_FIRST(&priv->flows);\n-\t     flow;\n-\t     flow = LIST_NEXT(flow, next)) {\n-\t\tclaim_zero(mlx4_flow_toggle(priv, flow, 0, NULL));\n-\t}\n-\tassert(!priv->drop);\n-}\n-\n-/**\n- * Enable flow rules.\n- *\n- * @param priv\n- *   Pointer to private structure.\n- *\n- * @return\n- *   0 on success, a negative errno value otherwise and rte_errno is set.\n- */\n-int\n-mlx4_flow_start(struct priv *priv)\n-{\n-\tint ret;\n-\tstruct rte_flow *flow;\n-\n-\tfor (flow = LIST_FIRST(&priv->flows);\n-\t     flow;\n-\t     flow = LIST_NEXT(flow, next)) {\n-\t\tret = mlx4_flow_toggle(priv, flow, 1, NULL);\n-\t\tif (unlikely(ret)) {\n-\t\t\tmlx4_flow_stop(priv);\n-\t\t\treturn ret;\n-\t\t}\n-\t}\n-\treturn 0;\n-}\n-\n static const struct rte_flow_ops mlx4_flow_ops = {\n \t.validate = mlx4_flow_validate,\n \t.create = mlx4_flow_create,\ndiff --git a/drivers/net/mlx4/mlx4_flow.h b/drivers/net/mlx4/mlx4_flow.h\nindex c2ffa8d..13495d7 100644\n--- a/drivers/net/mlx4/mlx4_flow.h\n+++ b/drivers/net/mlx4/mlx4_flow.h\n@@ -72,10 +72,8 @@ struct rte_flow {\n \n /* mlx4_flow.c */\n \n-int mlx4_flow_sync(struct priv *priv);\n+int mlx4_flow_sync(struct priv *priv, struct rte_flow_error *error);\n void mlx4_flow_clean(struct priv *priv);\n-int mlx4_flow_start(struct priv *priv);\n-void mlx4_flow_stop(struct priv *priv);\n int mlx4_filter_ctrl(struct rte_eth_dev *dev,\n \t\t     enum rte_filter_type filter_type,\n \t\t     enum rte_filter_op filter_op,\ndiff --git a/drivers/net/mlx4/mlx4_rxq.c b/drivers/net/mlx4/mlx4_rxq.c\nindex 7bb2f9e..bcb7b94 100644\n--- a/drivers/net/mlx4/mlx4_rxq.c\n+++ b/drivers/net/mlx4/mlx4_rxq.c\n@@ -54,6 +54,7 @@\n #include <rte_common.h>\n #include <rte_errno.h>\n #include <rte_ethdev.h>\n+#include <rte_flow.h>\n #include <rte_malloc.h>\n #include <rte_mbuf.h>\n #include <rte_mempool.h>\n@@ -401,7 +402,7 @@ mlx4_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,\n \t\t}\n \t\tdev->data->rx_queues[idx] = NULL;\n \t\t/* Disable associated flows. */\n-\t\tmlx4_flow_sync(priv);\n+\t\tmlx4_flow_sync(priv, NULL);\n \t\tmlx4_rxq_cleanup(rxq);\n \t} else {\n \t\trxq = rte_calloc_socket(\"RXQ\", 1, sizeof(*rxq), 0, socket);\n@@ -416,13 +417,20 @@ mlx4_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,\n \tif (ret) {\n \t\trte_free(rxq);\n \t} else {\n+\t\tstruct rte_flow_error error;\n+\n \t\trxq->stats.idx = idx;\n \t\tDEBUG(\"%p: adding Rx queue %p to list\",\n \t\t      (void *)dev, (void *)rxq);\n \t\tdev->data->rx_queues[idx] = rxq;\n \t\t/* Re-enable associated flows. */\n-\t\tret = mlx4_flow_sync(priv);\n+\t\tret = mlx4_flow_sync(priv, &error);\n \t\tif (ret) {\n+\t\t\tERROR(\"cannot re-attach flow rules to queue %u\"\n+\t\t\t      \" (code %d, \\\"%s\\\"), flow error type %d,\"\n+\t\t\t      \" cause %p, message: %s\", idx,\n+\t\t\t      -ret, strerror(-ret), error.type, error.cause,\n+\t\t\t      error.message ? error.message : \"(unspecified)\");\n \t\t\tdev->data->rx_queues[idx] = NULL;\n \t\t\tmlx4_rxq_cleanup(rxq);\n \t\t\trte_free(rxq);\n@@ -457,7 +465,7 @@ mlx4_rx_queue_release(void *dpdk_rxq)\n \t\t\tpriv->dev->data->rx_queues[i] = NULL;\n \t\t\tbreak;\n \t\t}\n-\tmlx4_flow_sync(priv);\n+\tmlx4_flow_sync(priv, NULL);\n \tmlx4_rxq_cleanup(rxq);\n \trte_free(rxq);\n }\n",
    "prefixes": [
        "dpdk-dev",
        "v1",
        "15/29"
    ]
}