get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 52302,
    "url": "http://patches.dpdk.org/api/patches/52302/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1554383065-11151-3-git-send-email-viacheslavo@mellanox.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<1554383065-11151-3-git-send-email-viacheslavo@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1554383065-11151-3-git-send-email-viacheslavo@mellanox.com",
    "date": "2019-04-04T13:04:25",
    "name": "[v2,2/2] net/mlx5: share Direct Rules/Verbs flow related structures",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "8a971d9d668df62aea9914a5a95c4cb5778de29f",
    "submitter": {
        "id": 1102,
        "url": "http://patches.dpdk.org/api/people/1102/?format=api",
        "name": "Slava Ovsiienko",
        "email": "viacheslavo@mellanox.com"
    },
    "delegate": {
        "id": 6624,
        "url": "http://patches.dpdk.org/api/users/6624/?format=api",
        "username": "shahafs",
        "first_name": "Shahaf",
        "last_name": "Shuler",
        "email": "shahafs@mellanox.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1554383065-11151-3-git-send-email-viacheslavo@mellanox.com/mbox/",
    "series": [
        {
            "id": 4119,
            "url": "http://patches.dpdk.org/api/series/4119/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4119",
            "date": "2019-04-04T13:04:23",
            "name": "support Direct Rules flows over shared IB context",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/4119/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/52302/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/52302/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 4DF791B45B;\n\tThu,  4 Apr 2019 15:06:01 +0200 (CEST)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n\tby dpdk.org (Postfix) with ESMTP id B5EA41B45A\n\tfor <dev@dpdk.org>; Thu,  4 Apr 2019 15:05:59 +0200 (CEST)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n\tviacheslavo@mellanox.com)\n\twith ESMTPS (AES256-SHA encrypted); 4 Apr 2019 16:05:54 +0300",
            "from pegasus12.mtr.labs.mlnx. (pegasus12.mtr.labs.mlnx\n\t[10.210.17.40])\n\tby labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x34D5mBl027457;\n\tThu, 4 Apr 2019 16:05:54 +0300"
        ],
        "From": "Viacheslav Ovsiienko <viacheslavo@mellanox.com>",
        "To": "dev@dpdk.org",
        "Cc": "shahafs@mellanox.com",
        "Date": "Thu,  4 Apr 2019 13:04:25 +0000",
        "Message-Id": "<1554383065-11151-3-git-send-email-viacheslavo@mellanox.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1554383065-11151-1-git-send-email-viacheslavo@mellanox.com>",
        "References": "<1554186157-29455-1-git-send-email-viacheslavo@mellanox.com>\n\t<1554383065-11151-1-git-send-email-viacheslavo@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH v2 2/2] net/mlx5: share Direct Rules/Verbs flow\n\trelated structures",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "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>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@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>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Direct Rules/Verbs related structures are moved to\nthe shared context:\n  - rx/tx namespaces, shared by master and representors\n  - rx/tx flow tables\n  - matchers\n  - encap/decap action resources\n  - flow tags (MARK actions)\n  - modify action resources\n  - jump tables\n\nSigned-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>\n---\n drivers/net/mlx5/mlx5.c         |  30 ++++----\n drivers/net/mlx5/mlx5.h         |  41 ++++++-----\n drivers/net/mlx5/mlx5_flow_dv.c | 159 ++++++++++++++++++++++++++++++++--------\n 3 files changed, 167 insertions(+), 63 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c\nindex 62cba00..aea72a1 100644\n--- a/drivers/net/mlx5/mlx5.c\n+++ b/drivers/net/mlx5/mlx5.c\n@@ -335,27 +335,28 @@ struct mlx5_dev_spawn_data {\n \t\terr = errno;\n \t\tgoto error;\n \t}\n-\tpriv->rx_ns = ns;\n+\tsh->rx_ns = ns;\n \tns = mlx5dv_dr_create_ns(sh->ctx, MLX5DV_DR_NS_DOMAIN_EGRESS_BYPASS);\n \tif (!ns) {\n \t\tDRV_LOG(ERR, \"egress mlx5dv_dr_create_ns failed\");\n \t\terr = errno;\n \t\tgoto error;\n \t}\n-\tpriv->tx_ns = ns;\n+\tpthread_mutex_init(&sh->dv_mutex, NULL);\n+\tsh->tx_ns = ns;\n \tsh->dv_refcnt++;\n \tpriv->dr_shared = 1;\n \treturn 0;\n \n error:\n        /* Rollback the created objects. */\n-\tif (priv->rx_ns) {\n-\t\tmlx5dv_dr_destroy_ns(priv->rx_ns);\n-\t\tpriv->rx_ns = NULL;\n+\tif (sh->rx_ns) {\n+\t\tmlx5dv_dr_destroy_ns(sh->rx_ns);\n+\t\tsh->rx_ns = NULL;\n \t}\n-\tif (priv->tx_ns) {\n-\t\tmlx5dv_dr_destroy_ns(priv->tx_ns);\n-\t\tpriv->tx_ns = NULL;\n+\tif (sh->tx_ns) {\n+\t\tmlx5dv_dr_destroy_ns(sh->tx_ns);\n+\t\tsh->tx_ns = NULL;\n \t}\n \treturn err;\n #else\n@@ -384,14 +385,15 @@ struct mlx5_dev_spawn_data {\n \tassert(sh->dv_refcnt);\n \tif (sh->dv_refcnt && --sh->dv_refcnt)\n \t\treturn;\n-\tif (priv->rx_ns) {\n-\t\tmlx5dv_dr_destroy_ns(priv->rx_ns);\n-\t\tpriv->rx_ns = NULL;\n+\tif (sh->rx_ns) {\n+\t\tmlx5dv_dr_destroy_ns(sh->rx_ns);\n+\t\tsh->rx_ns = NULL;\n \t}\n-\tif (priv->tx_ns) {\n-\t\tmlx5dv_dr_destroy_ns(priv->tx_ns);\n-\t\tpriv->tx_ns = NULL;\n+\tif (sh->tx_ns) {\n+\t\tmlx5dv_dr_destroy_ns(sh->tx_ns);\n+\t\tsh->tx_ns = NULL;\n \t}\n+\tpthread_mutex_destroy(&sh->dv_mutex);\n #else\n \t(void)priv;\n #endif\ndiff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h\nindex a6f6ef4..ef05d9f 100644\n--- a/drivers/net/mlx5/mlx5.h\n+++ b/drivers/net/mlx5/mlx5.h\n@@ -239,6 +239,15 @@ struct mlx5_ibv_shared_port {\n \t */\n };\n \n+/* Table structure. */\n+struct mlx5_flow_tbl_resource {\n+\tvoid *obj; /**< Pointer to DR table object. */\n+\trte_atomic32_t refcnt; /**< Reference counter. */\n+};\n+\n+#define MLX5_MAX_TABLES 1024\n+#define MLX5_GROUP_FACTOR 1\n+\n /*\n  * Shared Infiniband device context for Master/Representors\n  * which belong to same IB device with multiple IB ports.\n@@ -254,7 +263,19 @@ struct mlx5_ibv_shared {\n \tchar ibdev_path[IBV_SYSFS_PATH_MAX]; /* IB device path for secondary */\n \tstruct ibv_device_attr_ex device_attr; /* Device properties. */\n \t/* Shared DV/DR flow data section. */\n+\tpthread_mutex_t dv_mutex; /* DV context mutex. */\n \tuint32_t dv_refcnt; /* DV/DR data reference counter. */\n+\tvoid *rx_ns; /* RX Direct Rules name space handle. */\n+\tstruct mlx5_flow_tbl_resource rx_tbl[MLX5_MAX_TABLES];\n+\t/* RX Direct Rules tables. */\n+\tvoid *tx_ns; /* TX Direct Rules name space handle. */\n+\tstruct mlx5_flow_tbl_resource tx_tbl[MLX5_MAX_TABLES];\n+\t/* TX Direct Rules tables/ */\n+\tLIST_HEAD(matchers, mlx5_flow_dv_matcher) matchers;\n+\tLIST_HEAD(encap_decap, mlx5_flow_dv_encap_decap_resource) encaps_decaps;\n+\tLIST_HEAD(modify_cmd, mlx5_flow_dv_modify_hdr_resource) modify_cmds;\n+\tLIST_HEAD(tag, mlx5_flow_dv_tag_resource) tags;\n+\tLIST_HEAD(jump, mlx5_flow_dv_jump_tbl_resource) jump_tbl;\n \t/* Shared interrupt handler section. */\n \tpthread_mutex_t intr_mutex; /* Interrupt config mutex. */\n \tuint32_t intr_cnt; /* Interrupt handler reference counter. */\n@@ -262,15 +283,6 @@ struct mlx5_ibv_shared {\n \tstruct mlx5_ibv_shared_port port[]; /* per device port data array. */\n };\n \n-/* Table structure. */\n-struct mlx5_flow_tbl_resource {\n-\tvoid *obj; /**< Pointer to DR table object. */\n-\trte_atomic32_t refcnt; /**< Reference counter. */\n-};\n-\n-#define MLX5_MAX_TABLES 1024\n-#define MLX5_GROUP_FACTOR 1\n-\n struct mlx5_priv {\n \tLIST_ENTRY(mlx5_priv) mem_event_cb;\n \t/**< Called by memory event callback. */\n@@ -319,11 +331,6 @@ struct mlx5_priv {\n \tLIST_HEAD(txqibv, mlx5_txq_ibv) txqsibv; /* Verbs Tx queues. */\n \t/* Verbs Indirection tables. */\n \tLIST_HEAD(ind_tables, mlx5_ind_table_ibv) ind_tbls;\n-\tLIST_HEAD(matchers, mlx5_flow_dv_matcher) matchers;\n-\tLIST_HEAD(encap_decap, mlx5_flow_dv_encap_decap_resource) encaps_decaps;\n-\tLIST_HEAD(modify_cmd, mlx5_flow_dv_modify_hdr_resource) modify_cmds;\n-\tLIST_HEAD(tag, mlx5_flow_dv_tag_resource) tags;\n-\tLIST_HEAD(jump, mlx5_flow_dv_jump_tbl_resource) jump_tbl;\n \t/* Pointer to next element. */\n \trte_atomic32_t refcnt; /**< Reference counter. */\n \tstruct ibv_flow_action *verbs_action;\n@@ -345,12 +352,6 @@ struct mlx5_priv {\n \t/* UAR same-page access control required in 32bit implementations. */\n #endif\n \tstruct mlx5_flow_tcf_context *tcf_context; /* TC flower context. */\n-\tvoid *rx_ns; /* RX Direct Rules name space handle. */\n-\tstruct mlx5_flow_tbl_resource rx_tbl[MLX5_MAX_TABLES];\n-\t/* RX Direct Rules tables. */\n-\tvoid *tx_ns; /* TX Direct Rules name space handle. */\n-\tstruct mlx5_flow_tbl_resource tx_tbl[MLX5_MAX_TABLES];\n-\t/* TX Direct Rules tables/ */\n };\n \n #define PORT_ID(priv) ((priv)->dev_data->port_id)\ndiff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c\nindex 10c6eee..52be8b3 100644\n--- a/drivers/net/mlx5/mlx5_flow_dv.c\n+++ b/drivers/net/mlx5/mlx5_flow_dv.c\n@@ -129,6 +129,45 @@ struct field_modify_info modify_tcp[] = {\n };\n \n /**\n+ * Acquire the synchronizing object to protect multithreaded access\n+ * to shared dv context. Lock occurs only if context is actually\n+ * shared, i.e. we have multiport IB device and representors are\n+ * created.\n+ *\n+ * @param[in] dev\n+ *   Pointer to the rte_eth_dev structure.\n+ */\n+static void\n+flow_d_shared_lock(struct rte_eth_dev *dev)\n+{\n+\tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_ibv_shared *sh = priv->sh;\n+\n+\tif (sh->dv_refcnt > 1) {\n+\t\tint ret;\n+\n+\t\tret = pthread_mutex_lock(&sh->dv_mutex);\n+\t\tassert(!ret);\n+\t\t(void)ret;\n+\t}\n+}\n+\n+static void\n+flow_d_shared_unlock(struct rte_eth_dev *dev)\n+{\n+\tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_ibv_shared *sh = priv->sh;\n+\n+\tif (sh->dv_refcnt > 1) {\n+\t\tint ret;\n+\n+\t\tret = pthread_mutex_unlock(&sh->dv_mutex);\n+\t\tassert(!ret);\n+\t\t(void)ret;\n+\t}\n+}\n+\n+/**\n  * Convert modify-header action to DV specification.\n  *\n  * @param[in] item\n@@ -808,18 +847,19 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t struct rte_flow_error *error)\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_ibv_shared *sh = priv->sh;\n \tstruct mlx5_flow_dv_encap_decap_resource *cache_resource;\n \tstruct rte_flow *flow = dev_flow->flow;\n \tstruct mlx5dv_dr_ns *ns;\n \n \tresource->flags = flow->group ? 0 : 1;\n \tif (flow->ingress)\n-\t\tns = priv->rx_ns;\n+\t\tns = sh->rx_ns;\n \telse\n-\t\tns = priv->tx_ns;\n+\t\tns = sh->tx_ns;\n \n \t/* Lookup a matching resource from cache. */\n-\tLIST_FOREACH(cache_resource, &priv->encaps_decaps, next) {\n+\tLIST_FOREACH(cache_resource, &sh->encaps_decaps, next) {\n \t\tif (resource->reformat_type == cache_resource->reformat_type &&\n \t\t    resource->ft_type == cache_resource->ft_type &&\n \t\t    resource->flags == cache_resource->flags &&\n@@ -844,7 +884,7 @@ struct field_modify_info modify_tcp[] = {\n \t*cache_resource = *resource;\n \tcache_resource->verbs_action =\n \t\tmlx5_glue->dv_create_flow_action_packet_reformat\n-\t\t\t(priv->sh->ctx, cache_resource->reformat_type,\n+\t\t\t(sh->ctx, cache_resource->reformat_type,\n \t\t\t cache_resource->ft_type, ns, cache_resource->flags,\n \t\t\t cache_resource->size,\n \t\t\t (cache_resource->size ? cache_resource->buf : NULL));\n@@ -856,7 +896,7 @@ struct field_modify_info modify_tcp[] = {\n \t}\n \trte_atomic32_init(&cache_resource->refcnt);\n \trte_atomic32_inc(&cache_resource->refcnt);\n-\tLIST_INSERT_HEAD(&priv->encaps_decaps, cache_resource, next);\n+\tLIST_INSERT_HEAD(&sh->encaps_decaps, cache_resource, next);\n \tdev_flow->dv.encap_decap = cache_resource;\n \tDRV_LOG(DEBUG, \"new encap/decap resource %p: refcnt %d++\",\n \t\t(void *)cache_resource,\n@@ -887,10 +927,11 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t struct rte_flow_error *error)\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_ibv_shared *sh = priv->sh;\n \tstruct mlx5_flow_dv_jump_tbl_resource *cache_resource;\n \n \t/* Lookup a matching resource from cache. */\n-\tLIST_FOREACH(cache_resource, &priv->jump_tbl, next) {\n+\tLIST_FOREACH(cache_resource, &sh->jump_tbl, next) {\n \t\tif (resource->tbl == cache_resource->tbl) {\n \t\t\tDRV_LOG(DEBUG, \"jump table resource resource %p: refcnt %d++\",\n \t\t\t\t(void *)cache_resource,\n@@ -918,7 +959,7 @@ struct field_modify_info modify_tcp[] = {\n \t}\n \trte_atomic32_init(&cache_resource->refcnt);\n \trte_atomic32_inc(&cache_resource->refcnt);\n-\tLIST_INSERT_HEAD(&priv->jump_tbl, cache_resource, next);\n+\tLIST_INSERT_HEAD(&sh->jump_tbl, cache_resource, next);\n \tdev_flow->dv.jump = cache_resource;\n \tDRV_LOG(DEBUG, \"new jump table  resource %p: refcnt %d++\",\n \t\t(void *)cache_resource,\n@@ -1542,14 +1583,15 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t struct rte_flow_error *error)\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_ibv_shared *sh = priv->sh;\n \tstruct mlx5_flow_dv_modify_hdr_resource *cache_resource;\n \n \tstruct mlx5dv_dr_ns *ns =\n \t\tresource->ft_type == MLX5DV_FLOW_TABLE_TYPE_NIC_TX  ?\n-\t\tpriv->tx_ns : priv->rx_ns;\n+\t\tsh->tx_ns : sh->rx_ns;\n \n \t/* Lookup a matching resource from cache. */\n-\tLIST_FOREACH(cache_resource, &priv->modify_cmds, next) {\n+\tLIST_FOREACH(cache_resource, &sh->modify_cmds, next) {\n \t\tif (resource->ft_type == cache_resource->ft_type &&\n \t\t    resource->actions_num == cache_resource->actions_num &&\n \t\t    !memcmp((const void *)resource->actions,\n@@ -1573,7 +1615,7 @@ struct field_modify_info modify_tcp[] = {\n \t*cache_resource = *resource;\n \tcache_resource->verbs_action =\n \t\tmlx5_glue->dv_create_flow_action_modify_header\n-\t\t\t\t\t(priv->sh->ctx, cache_resource->ft_type,\n+\t\t\t\t\t(sh->ctx, cache_resource->ft_type,\n \t\t\t\t\t ns, 0,\n \t\t\t\t\t cache_resource->actions_num *\n \t\t\t\t\t sizeof(cache_resource->actions[0]),\n@@ -1586,7 +1628,7 @@ struct field_modify_info modify_tcp[] = {\n \t}\n \trte_atomic32_init(&cache_resource->refcnt);\n \trte_atomic32_inc(&cache_resource->refcnt);\n-\tLIST_INSERT_HEAD(&priv->modify_cmds, cache_resource, next);\n+\tLIST_INSERT_HEAD(&sh->modify_cmds, cache_resource, next);\n \tdev_flow->dv.modify_hdr = cache_resource;\n \tDRV_LOG(DEBUG, \"new modify-header resource %p: refcnt %d++\",\n \t\t(void *)cache_resource,\n@@ -2883,19 +2925,20 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t struct rte_flow_error *error)\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_ibv_shared *sh = priv->sh;\n \tstruct mlx5_flow_tbl_resource *tbl;\n \n #ifdef HAVE_MLX5DV_DR\n \tif (egress) {\n-\t\ttbl = &priv->tx_tbl[table_id];\n+\t\ttbl = &sh->tx_tbl[table_id];\n \t\tif (!tbl->obj)\n \t\t\ttbl->obj = mlx5_glue->dr_create_flow_tbl\n-\t\t\t\t(priv->tx_ns, table_id);\n+\t\t\t\t(sh->tx_ns, table_id);\n \t} else {\n-\t\ttbl = &priv->rx_tbl[table_id];\n+\t\ttbl = &sh->rx_tbl[table_id];\n \t\tif (!tbl->obj)\n \t\t\ttbl->obj = mlx5_glue->dr_create_flow_tbl\n-\t\t\t\t(priv->rx_ns, table_id);\n+\t\t\t\t(sh->rx_ns, table_id);\n \t}\n \tif (!tbl->obj) {\n \t\trte_flow_error_set(error, ENOMEM,\n@@ -2909,9 +2952,9 @@ struct field_modify_info modify_tcp[] = {\n \t(void)error;\n \t(void)tbl;\n \tif (egress)\n-\t\treturn &priv->tx_tbl[table_id];\n+\t\treturn &sh->tx_tbl[table_id];\n \telse\n-\t\treturn &priv->rx_tbl[table_id];\n+\t\treturn &sh->rx_tbl[table_id];\n #endif\n }\n \n@@ -2959,6 +3002,7 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t struct rte_flow_error *error)\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_ibv_shared *sh = priv->sh;\n \tstruct mlx5_flow_dv_matcher *cache_matcher;\n \tstruct mlx5dv_flow_matcher_attr dv_attr = {\n \t\t.type = IBV_FLOW_ATTR_NORMAL,\n@@ -2967,7 +3011,7 @@ struct field_modify_info modify_tcp[] = {\n \tstruct mlx5_flow_tbl_resource *tbl = NULL;\n \n \t/* Lookup from cache. */\n-\tLIST_FOREACH(cache_matcher, &priv->matchers, next) {\n+\tLIST_FOREACH(cache_matcher, &sh->matchers, next) {\n \t\tif (matcher->crc == cache_matcher->crc &&\n \t\t    matcher->priority == cache_matcher->priority &&\n \t\t    matcher->egress == cache_matcher->egress &&\n@@ -3007,8 +3051,7 @@ struct field_modify_info modify_tcp[] = {\n \tif (matcher->egress)\n \t\tdv_attr.flags |= IBV_FLOW_ATTR_FLAGS_EGRESS;\n \tcache_matcher->matcher_object =\n-\t\tmlx5_glue->dv_create_flow_matcher(priv->sh->ctx, &dv_attr,\n-\t\t\t\t\t\t  tbl->obj);\n+\t\tmlx5_glue->dv_create_flow_matcher(sh->ctx, &dv_attr, tbl->obj);\n \tif (!cache_matcher->matcher_object) {\n \t\trte_free(cache_matcher);\n #ifdef HAVE_MLX5DV_DR\n@@ -3019,7 +3062,7 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t\t\t  NULL, \"cannot create matcher\");\n \t}\n \trte_atomic32_inc(&cache_matcher->refcnt);\n-\tLIST_INSERT_HEAD(&priv->matchers, cache_matcher, next);\n+\tLIST_INSERT_HEAD(&sh->matchers, cache_matcher, next);\n \tdev_flow->dv.matcher = cache_matcher;\n \tDRV_LOG(DEBUG, \"priority %hd new %s matcher %p: refcnt %d\",\n \t\tcache_matcher->priority,\n@@ -3075,10 +3118,11 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t struct rte_flow_error *error)\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_ibv_shared *sh = priv->sh;\n \tstruct mlx5_flow_dv_tag_resource *cache_resource;\n \n \t/* Lookup a matching resource from cache. */\n-\tLIST_FOREACH(cache_resource, &priv->tags, next) {\n+\tLIST_FOREACH(cache_resource, &sh->tags, next) {\n \t\tif (resource->tag == cache_resource->tag) {\n \t\t\tDRV_LOG(DEBUG, \"tag resource %p: refcnt %d++\",\n \t\t\t\t(void *)cache_resource,\n@@ -3105,7 +3149,7 @@ struct field_modify_info modify_tcp[] = {\n \t}\n \trte_atomic32_init(&cache_resource->refcnt);\n \trte_atomic32_inc(&cache_resource->refcnt);\n-\tLIST_INSERT_HEAD(&priv->tags, cache_resource, next);\n+\tLIST_INSERT_HEAD(&sh->tags, cache_resource, next);\n \tdev_flow->flow->tag_resource = cache_resource;\n \tDRV_LOG(DEBUG, \"new tag resource %p: refcnt %d++\",\n \t\t(void *)cache_resource,\n@@ -3682,6 +3726,7 @@ struct field_modify_info modify_tcp[] = {\n {\n \tstruct mlx5_flow_dv_matcher *matcher = flow->dv.matcher;\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_ibv_shared *sh = priv->sh;\n \tstruct mlx5_flow_tbl_resource *tbl;\n \n \tassert(matcher->matcher_object);\n@@ -3693,9 +3738,9 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t   (matcher->matcher_object));\n \t\tLIST_REMOVE(matcher, next);\n \t\tif (matcher->egress)\n-\t\t\ttbl = &priv->tx_tbl[matcher->group];\n+\t\t\ttbl = &sh->tx_tbl[matcher->group];\n \t\telse\n-\t\t\ttbl = &priv->rx_tbl[matcher->group];\n+\t\t\ttbl = &sh->rx_tbl[matcher->group];\n \t\tflow_dv_tbl_resource_release(tbl);\n \t\trte_free(matcher);\n \t\tDRV_LOG(DEBUG, \"port %u matcher %p: removed\",\n@@ -3958,14 +4003,70 @@ struct field_modify_info modify_tcp[] = {\n \treturn ret;\n }\n \n+/*\n+ * Mutex-protected thunk to flow_dv_translate().\n+ */\n+static int\n+flow_d_translate(struct rte_eth_dev *dev,\n+\t\t struct mlx5_flow *dev_flow,\n+\t\t const struct rte_flow_attr *attr,\n+\t\t const struct rte_flow_item items[],\n+\t\t const struct rte_flow_action actions[],\n+\t\t struct rte_flow_error *error)\n+{\n+\tint ret;\n+\n+\tflow_d_shared_lock(dev);\n+\tret = flow_dv_translate(dev, dev_flow, attr, items, actions, error);\n+\tflow_d_shared_unlock(dev);\n+\treturn ret;\n+}\n+\n+/*\n+ * Mutex-protected thunk to flow_dv_apply().\n+ */\n+static int\n+flow_d_apply(struct rte_eth_dev *dev,\n+\t     struct rte_flow *flow,\n+\t     struct rte_flow_error *error)\n+{\n+\tint ret;\n+\n+\tflow_d_shared_lock(dev);\n+\tret = flow_dv_apply(dev, flow, error);\n+\tflow_d_shared_unlock(dev);\n+\treturn ret;\n+}\n+\n+/*\n+ * Mutex-protected thunk to flow_dv_remove().\n+ */\n+static void\n+flow_d_remove(struct rte_eth_dev *dev, struct rte_flow *flow)\n+{\n+\tflow_d_shared_lock(dev);\n+\tflow_dv_remove(dev, flow);\n+\tflow_d_shared_unlock(dev);\n+}\n+\n+/*\n+ * Mutex-protected thunk to flow_dv_destroy().\n+ */\n+static void\n+flow_d_destroy(struct rte_eth_dev *dev, struct rte_flow *flow)\n+{\n+\tflow_d_shared_lock(dev);\n+\tflow_dv_destroy(dev, flow);\n+\tflow_d_shared_unlock(dev);\n+}\n \n const struct mlx5_flow_driver_ops mlx5_flow_dv_drv_ops = {\n \t.validate = flow_dv_validate,\n \t.prepare = flow_dv_prepare,\n-\t.translate = flow_dv_translate,\n-\t.apply = flow_dv_apply,\n-\t.remove = flow_dv_remove,\n-\t.destroy = flow_dv_destroy,\n+\t.translate = flow_d_translate,\n+\t.apply = flow_d_apply,\n+\t.remove = flow_d_remove,\n+\t.destroy = flow_d_destroy,\n \t.query = flow_dv_query,\n };\n \n",
    "prefixes": [
        "v2",
        "2/2"
    ]
}