get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 76401,
    "url": "http://patches.dpdk.org/api/patches/76401/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1599128029-2092-19-git-send-email-michaelba@nvidia.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": "<1599128029-2092-19-git-send-email-michaelba@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1599128029-2092-19-git-send-email-michaelba@nvidia.com",
    "date": "2020-09-03T10:13:49",
    "name": "[v1,18/18] net/mlx5: share Rx queue drop action code",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "feb2d86a1c743bbbc95273c2b8e38eb5283a52b3",
    "submitter": {
        "id": 1949,
        "url": "http://patches.dpdk.org/api/people/1949/?format=api",
        "name": "Michael Baum",
        "email": "michaelba@nvidia.com"
    },
    "delegate": {
        "id": 3268,
        "url": "http://patches.dpdk.org/api/users/3268/?format=api",
        "username": "rasland",
        "first_name": "Raslan",
        "last_name": "Darawsheh",
        "email": "rasland@nvidia.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1599128029-2092-19-git-send-email-michaelba@nvidia.com/mbox/",
    "series": [
        {
            "id": 11924,
            "url": "http://patches.dpdk.org/api/series/11924/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11924",
            "date": "2020-09-03T10:13:31",
            "name": "mlx5 Rx DevX/Verbs separation",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/11924/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/76401/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/76401/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 08B5AA04DB;\n\tThu,  3 Sep 2020 12:17:55 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 1BB0A1C119;\n\tThu,  3 Sep 2020 12:15:22 +0200 (CEST)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by dpdk.org (Postfix) with ESMTP id 52AF11C0C6\n for <dev@dpdk.org>; Thu,  3 Sep 2020 12:15:20 +0200 (CEST)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n michaelba@nvidia.com) with SMTP; 3 Sep 2020 13:15:17 +0300",
            "from nvidia.com (pegasus07.mtr.labs.mlnx [10.210.16.112])\n by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 083AEP9G031645;\n Thu, 3 Sep 2020 13:15:17 +0300"
        ],
        "From": "Michael Baum <michaelba@nvidia.com>",
        "To": "dev@dpdk.org",
        "Cc": "Matan Azrad <matan@nvidia.com>, Raslan Darawsheh <rasland@nvidia.com>,\n Viacheslav Ovsiienko <viacheslavo@nvidia.com>",
        "Date": "Thu,  3 Sep 2020 10:13:49 +0000",
        "Message-Id": "<1599128029-2092-19-git-send-email-michaelba@nvidia.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1599128029-2092-1-git-send-email-michaelba@nvidia.com>",
        "References": "<1599128029-2092-1-git-send-email-michaelba@nvidia.com>",
        "Subject": "[dpdk-dev] [PATCH v1 18/18] net/mlx5: share Rx queue drop action\n\tcode",
        "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 <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Move Rx queue drop action similar resources allocations from Verbs\nmodule to a shared location.\n\nSigned-off-by: Michael Baum <michaelba@nvidia.com>\nAcked-by: Matan Azrad <matan@nvidia.com>\n---\n drivers/net/mlx5/linux/mlx5_os.c    |   6 +-\n drivers/net/mlx5/linux/mlx5_verbs.c | 246 ++++++++++++------------------------\n drivers/net/mlx5/mlx5.h             |   4 +-\n drivers/net/mlx5/mlx5_devx.c        |  16 +--\n drivers/net/mlx5/mlx5_flow_dv.c     |  10 +-\n drivers/net/mlx5/mlx5_flow_verbs.c  |  10 +-\n drivers/net/mlx5/mlx5_rxq.c         |  72 +++++++++++\n drivers/net/mlx5/mlx5_rxtx.h        |   4 +-\n 8 files changed, 180 insertions(+), 188 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c\nindex 505e7d9..ae871fe 100644\n--- a/drivers/net/mlx5/linux/mlx5_os.c\n+++ b/drivers/net/mlx5/linux/mlx5_os.c\n@@ -1269,8 +1269,10 @@\n \t}\n \tif (config->devx && config->dv_flow_en) {\n \t\tpriv->obj_ops = devx_obj_ops;\n-\t\tpriv->obj_ops.hrxq_drop_new = ibv_obj_ops.hrxq_drop_new;\n-\t\tpriv->obj_ops.hrxq_drop_release = ibv_obj_ops.hrxq_drop_release;\n+\t\tpriv->obj_ops.drop_action_create =\n+\t\t\t\t\t\tibv_obj_ops.drop_action_create;\n+\t\tpriv->obj_ops.drop_action_destroy =\n+\t\t\t\t\t\tibv_obj_ops.drop_action_destroy;\n \t} else {\n \t\tpriv->obj_ops = ibv_obj_ops;\n \t}\ndiff --git a/drivers/net/mlx5/linux/mlx5_verbs.c b/drivers/net/mlx5/linux/mlx5_verbs.c\nindex 0a8ae65..d6e670f 100644\n--- a/drivers/net/mlx5/linux/mlx5_verbs.c\n+++ b/drivers/net/mlx5/linux/mlx5_verbs.c\n@@ -614,73 +614,13 @@\n }\n \n /**\n- * Create a drop Rx queue Verbs object.\n- *\n- * @param dev\n- *   Pointer to Ethernet device.\n- *\n- * @return\n- *   The Verbs object initialized, NULL otherwise and rte_errno is set.\n- */\n-static struct mlx5_rxq_obj *\n-mlx5_rxq_obj_drop_new(struct rte_eth_dev *dev)\n-{\n-\tstruct mlx5_priv *priv = dev->data->dev_private;\n-\tstruct ibv_context *ctx = priv->sh->ctx;\n-\tstruct ibv_cq *cq;\n-\tstruct ibv_wq *wq = NULL;\n-\tstruct mlx5_rxq_obj *rxq;\n-\n-\tif (priv->drop_queue.rxq)\n-\t\treturn priv->drop_queue.rxq;\n-\tcq = mlx5_glue->create_cq(ctx, 1, NULL, NULL, 0);\n-\tif (!cq) {\n-\t\tDEBUG(\"Port %u cannot allocate CQ for drop queue.\",\n-\t\t      dev->data->port_id);\n-\t\trte_errno = errno;\n-\t\tgoto error;\n-\t}\n-\twq = mlx5_glue->create_wq(ctx,\n-\t\t &(struct ibv_wq_init_attr){\n-\t\t\t.wq_type = IBV_WQT_RQ,\n-\t\t\t.max_wr = 1,\n-\t\t\t.max_sge = 1,\n-\t\t\t.pd = priv->sh->pd,\n-\t\t\t.cq = cq,\n-\t\t });\n-\tif (!wq) {\n-\t\tDEBUG(\"Port %u cannot allocate WQ for drop queue.\",\n-\t\t      dev->data->port_id);\n-\t\trte_errno = errno;\n-\t\tgoto error;\n-\t}\n-\trxq = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*rxq), 0, SOCKET_ID_ANY);\n-\tif (!rxq) {\n-\t\tDEBUG(\"Port %u cannot allocate drop Rx queue memory.\",\n-\t\t      dev->data->port_id);\n-\t\trte_errno = ENOMEM;\n-\t\tgoto error;\n-\t}\n-\trxq->ibv_cq = cq;\n-\trxq->wq = wq;\n-\tpriv->drop_queue.rxq = rxq;\n-\treturn rxq;\n-error:\n-\tif (wq)\n-\t\tclaim_zero(mlx5_glue->destroy_wq(wq));\n-\tif (cq)\n-\t\tclaim_zero(mlx5_glue->destroy_cq(cq));\n-\treturn NULL;\n-}\n-\n-/**\n  * Release a drop Rx queue Verbs object.\n  *\n  * @param dev\n  *   Pointer to Ethernet device.\n  */\n static void\n-mlx5_rxq_obj_drop_release(struct rte_eth_dev *dev)\n+mlx5_rxq_ibv_obj_drop_release(struct rte_eth_dev *dev)\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n \tstruct mlx5_rxq_obj *rxq = priv->drop_queue.rxq;\n@@ -694,127 +634,115 @@\n }\n \n /**\n- * Create a drop indirection table.\n+ * Create a drop Rx queue Verbs object.\n  *\n  * @param dev\n  *   Pointer to Ethernet device.\n  *\n  * @return\n- *   The Verbs object initialized, NULL otherwise and rte_errno is set.\n+ *   0 on success, a negative errno value otherwise and rte_errno is set.\n  */\n-static struct mlx5_ind_table_obj *\n-mlx5_ind_table_obj_drop_new(struct rte_eth_dev *dev)\n+static int\n+mlx5_rxq_ibv_obj_drop_create(struct rte_eth_dev *dev)\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n-\tstruct mlx5_ind_table_obj *ind_tbl;\n-\tstruct mlx5_rxq_obj *rxq;\n-\tstruct mlx5_ind_table_obj tmpl;\n-\n-\trxq = mlx5_rxq_obj_drop_new(dev);\n-\tif (!rxq)\n-\t\treturn NULL;\n-\ttmpl.ind_table = mlx5_glue->create_rwq_ind_table\n-\t\t(priv->sh->ctx,\n-\t\t &(struct ibv_rwq_ind_table_init_attr){\n-\t\t\t.log_ind_tbl_size = 0,\n-\t\t\t.ind_tbl = (struct ibv_wq **)&rxq->wq,\n-\t\t\t.comp_mask = 0,\n-\t\t });\n-\tif (!tmpl.ind_table) {\n-\t\tDEBUG(\"Port %u cannot allocate indirection table for drop\"\n-\t\t      \" queue.\", dev->data->port_id);\n+\tstruct ibv_context *ctx = priv->sh->ctx;\n+\tstruct mlx5_rxq_obj *rxq = priv->drop_queue.rxq;\n+\n+\tif (rxq)\n+\t\treturn 0;\n+\trxq = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*rxq), 0, SOCKET_ID_ANY);\n+\tif (!rxq) {\n+\t\tDEBUG(\"Port %u cannot allocate drop Rx queue memory.\",\n+\t\t      dev->data->port_id);\n+\t\trte_errno = ENOMEM;\n+\t\treturn -rte_errno;\n+\t}\n+\tpriv->drop_queue.rxq = rxq;\n+\trxq->ibv_cq = mlx5_glue->create_cq(ctx, 1, NULL, NULL, 0);\n+\tif (!rxq->ibv_cq) {\n+\t\tDEBUG(\"Port %u cannot allocate CQ for drop queue.\",\n+\t\t      dev->data->port_id);\n \t\trte_errno = errno;\n \t\tgoto error;\n \t}\n-\tind_tbl = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*ind_tbl), 0,\n-\t\t\t      SOCKET_ID_ANY);\n-\tif (!ind_tbl) {\n-\t\trte_errno = ENOMEM;\n+\trxq->wq = mlx5_glue->create_wq(ctx, &(struct ibv_wq_init_attr){\n+\t\t\t\t\t\t    .wq_type = IBV_WQT_RQ,\n+\t\t\t\t\t\t    .max_wr = 1,\n+\t\t\t\t\t\t    .max_sge = 1,\n+\t\t\t\t\t\t    .pd = priv->sh->pd,\n+\t\t\t\t\t\t    .cq = rxq->ibv_cq,\n+\t\t\t\t\t      });\n+\tif (!rxq->wq) {\n+\t\tDEBUG(\"Port %u cannot allocate WQ for drop queue.\",\n+\t\t      dev->data->port_id);\n+\t\trte_errno = errno;\n \t\tgoto error;\n \t}\n-\tind_tbl->ind_table = tmpl.ind_table;\n-\treturn ind_tbl;\n+\tpriv->drop_queue.rxq = rxq;\n+\treturn 0;\n error:\n-\tmlx5_rxq_obj_drop_release(dev);\n-\treturn NULL;\n-}\n-\n-/**\n- * Release a drop indirection table.\n- *\n- * @param dev\n- *   Pointer to Ethernet device.\n- */\n-static void\n-mlx5_ind_table_obj_drop_release(struct rte_eth_dev *dev)\n-{\n-\tstruct mlx5_priv *priv = dev->data->dev_private;\n-\tstruct mlx5_ind_table_obj *ind_tbl = priv->drop_queue.hrxq->ind_table;\n-\n-\tclaim_zero(mlx5_glue->destroy_rwq_ind_table(ind_tbl->ind_table));\n-\tmlx5_rxq_obj_drop_release(dev);\n-\tmlx5_free(ind_tbl);\n-\tpriv->drop_queue.hrxq->ind_table = NULL;\n+\tmlx5_rxq_ibv_obj_drop_release(dev);\n+\treturn -rte_errno;\n }\n \n /**\n- * Create a drop Rx Hash queue.\n+ * Create a Verbs drop action for Rx Hash queue.\n  *\n  * @param dev\n  *   Pointer to Ethernet device.\n  *\n  * @return\n- *   The Verbs object initialized, NULL otherwise and rte_errno is set.\n+ *   0 on success, a negative errno value otherwise and rte_errno is set.\n  */\n-static struct mlx5_hrxq *\n-mlx5_ibv_hrxq_drop_new(struct rte_eth_dev *dev)\n+static int\n+mlx5_ibv_drop_action_create(struct rte_eth_dev *dev)\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n-\tstruct mlx5_ind_table_obj *ind_tbl = NULL;\n-\tstruct ibv_qp *qp = NULL;\n-\tstruct mlx5_hrxq *hrxq = NULL;\n+\tstruct mlx5_hrxq *hrxq = priv->drop_queue.hrxq;\n+\tstruct ibv_rwq_ind_table *ind_tbl = NULL;\n+\tstruct mlx5_rxq_obj *rxq;\n+\tint ret;\n \n-\tif (priv->drop_queue.hrxq) {\n-\t\trte_atomic32_inc(&priv->drop_queue.hrxq->refcnt);\n-\t\treturn priv->drop_queue.hrxq;\n-\t}\n-\thrxq = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*hrxq), 0, SOCKET_ID_ANY);\n-\tif (!hrxq) {\n-\t\tDRV_LOG(WARNING,\n-\t\t\t\"Port %u cannot allocate memory for drop queue.\",\n-\t\t\tdev->data->port_id);\n-\t\trte_errno = ENOMEM;\n+\tMLX5_ASSERT(hrxq && hrxq->ind_table);\n+\tret = mlx5_rxq_ibv_obj_drop_create(dev);\n+\tif (ret < 0)\n \t\tgoto error;\n-\t}\n-\tpriv->drop_queue.hrxq = hrxq;\n-\tind_tbl = mlx5_ind_table_obj_drop_new(dev);\n-\tif (!ind_tbl)\n+\trxq = priv->drop_queue.rxq;\n+\tind_tbl = mlx5_glue->create_rwq_ind_table\n+\t\t\t\t(priv->sh->ctx,\n+\t\t\t\t &(struct ibv_rwq_ind_table_init_attr){\n+\t\t\t\t\t.log_ind_tbl_size = 0,\n+\t\t\t\t\t.ind_tbl = (struct ibv_wq **)&rxq->wq,\n+\t\t\t\t\t.comp_mask = 0,\n+\t\t\t\t });\n+\tif (!ind_tbl) {\n+\t\tDEBUG(\"Port %u cannot allocate indirection table for drop\"\n+\t\t      \" queue.\", dev->data->port_id);\n+\t\trte_errno = errno;\n \t\tgoto error;\n-\thrxq->ind_table = ind_tbl;\n-\tqp = mlx5_glue->create_qp_ex(priv->sh->ctx,\n+\t}\n+\thrxq->qp = mlx5_glue->create_qp_ex(priv->sh->ctx,\n \t\t &(struct ibv_qp_init_attr_ex){\n \t\t\t.qp_type = IBV_QPT_RAW_PACKET,\n-\t\t\t.comp_mask =\n-\t\t\t\tIBV_QP_INIT_ATTR_PD |\n-\t\t\t\tIBV_QP_INIT_ATTR_IND_TABLE |\n-\t\t\t\tIBV_QP_INIT_ATTR_RX_HASH,\n+\t\t\t.comp_mask = IBV_QP_INIT_ATTR_PD |\n+\t\t\t\t     IBV_QP_INIT_ATTR_IND_TABLE |\n+\t\t\t\t     IBV_QP_INIT_ATTR_RX_HASH,\n \t\t\t.rx_hash_conf = (struct ibv_rx_hash_conf){\n-\t\t\t\t.rx_hash_function =\n-\t\t\t\t\tIBV_RX_HASH_FUNC_TOEPLITZ,\n+\t\t\t\t.rx_hash_function = IBV_RX_HASH_FUNC_TOEPLITZ,\n \t\t\t\t.rx_hash_key_len = MLX5_RSS_HASH_KEY_LEN,\n \t\t\t\t.rx_hash_key = rss_hash_default_key,\n \t\t\t\t.rx_hash_fields_mask = 0,\n \t\t\t\t},\n-\t\t\t.rwq_ind_tbl = ind_tbl->ind_table,\n+\t\t\t.rwq_ind_tbl = ind_tbl,\n \t\t\t.pd = priv->sh->pd\n \t\t });\n-\tif (!qp) {\n+\tif (!hrxq->qp) {\n \t\tDEBUG(\"Port %u cannot allocate QP for drop queue.\",\n \t\t      dev->data->port_id);\n \t\trte_errno = errno;\n \t\tgoto error;\n \t}\n-\thrxq->qp = qp;\n #ifdef HAVE_IBV_FLOW_DV_SUPPORT\n \thrxq->action = mlx5_glue->dv_create_flow_action_dest_ibv_qp(hrxq->qp);\n \tif (!hrxq->action) {\n@@ -822,22 +750,16 @@\n \t\tgoto error;\n \t}\n #endif\n-\trte_atomic32_set(&hrxq->refcnt, 1);\n-\treturn hrxq;\n+\thrxq->ind_table->ind_table = ind_tbl;\n+\treturn 0;\n error:\n-#ifdef HAVE_IBV_FLOW_DV_SUPPORT\n-\tif (hrxq && hrxq->action)\n-\t\tmlx5_glue->destroy_flow_action(hrxq->action);\n-#endif\n-\tif (qp)\n+\tif (hrxq->qp)\n \t\tclaim_zero(mlx5_glue->destroy_qp(hrxq->qp));\n \tif (ind_tbl)\n-\t\tmlx5_ind_table_obj_drop_release(dev);\n-\tif (hrxq) {\n-\t\tpriv->drop_queue.hrxq = NULL;\n-\t\tmlx5_free(hrxq);\n-\t}\n-\treturn NULL;\n+\t\tclaim_zero(mlx5_glue->destroy_rwq_ind_table(ind_tbl));\n+\tif (priv->drop_queue.rxq)\n+\t\tmlx5_rxq_ibv_obj_drop_release(dev);\n+\treturn -rte_errno;\n }\n \n /**\n@@ -847,20 +769,18 @@\n  *   Pointer to Ethernet device.\n  */\n static void\n-mlx5_ibv_hrxq_drop_release(struct rte_eth_dev *dev)\n+mlx5_ibv_drop_action_destroy(struct rte_eth_dev *dev)\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n \tstruct mlx5_hrxq *hrxq = priv->drop_queue.hrxq;\n+\tstruct ibv_rwq_ind_table *ind_tbl = hrxq->ind_table->ind_table;\n \n-\tif (rte_atomic32_dec_and_test(&hrxq->refcnt)) {\n #ifdef HAVE_IBV_FLOW_DV_SUPPORT\n-\t\tmlx5_glue->destroy_flow_action(hrxq->action);\n+\tclaim_zero(mlx5_glue->destroy_flow_action(hrxq->action));\n #endif\n-\t\tclaim_zero(mlx5_glue->destroy_qp(hrxq->qp));\n-\t\tmlx5_ind_table_obj_drop_release(dev);\n-\t\tmlx5_free(hrxq);\n-\t\tpriv->drop_queue.hrxq = NULL;\n-\t}\n+\tclaim_zero(mlx5_glue->destroy_qp(hrxq->qp));\n+\tclaim_zero(mlx5_glue->destroy_rwq_ind_table(ind_tbl));\n+\tmlx5_rxq_ibv_obj_drop_release(dev);\n }\n \n struct mlx5_obj_ops ibv_obj_ops = {\n@@ -873,6 +793,6 @@ struct mlx5_obj_ops ibv_obj_ops = {\n \t.ind_table_destroy = mlx5_ibv_ind_table_destroy,\n \t.hrxq_new = mlx5_ibv_hrxq_new,\n \t.hrxq_destroy = mlx5_ibv_qp_destroy,\n-\t.hrxq_drop_new = mlx5_ibv_hrxq_drop_new,\n-\t.hrxq_drop_release = mlx5_ibv_hrxq_drop_release,\n+\t.drop_action_create = mlx5_ibv_drop_action_create,\n+\t.drop_action_destroy = mlx5_ibv_drop_action_destroy,\n };\ndiff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h\nindex 8cef097..865e72d 100644\n--- a/drivers/net/mlx5/mlx5.h\n+++ b/drivers/net/mlx5/mlx5.h\n@@ -748,8 +748,8 @@ struct mlx5_obj_ops {\n \tint (*hrxq_new)(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq,\n \t\t\tint tunnel __rte_unused);\n \tvoid (*hrxq_destroy)(struct mlx5_hrxq *hrxq);\n-\tstruct mlx5_hrxq *(*hrxq_drop_new)(struct rte_eth_dev *dev);\n-\tvoid (*hrxq_drop_release)(struct rte_eth_dev *dev);\n+\tint (*drop_action_create)(struct rte_eth_dev *dev);\n+\tvoid (*drop_action_destroy)(struct rte_eth_dev *dev);\n };\n \n struct mlx5_priv {\ndiff --git a/drivers/net/mlx5/mlx5_devx.c b/drivers/net/mlx5/mlx5_devx.c\nindex ddaab83..3e81fcc 100644\n--- a/drivers/net/mlx5/mlx5_devx.c\n+++ b/drivers/net/mlx5/mlx5_devx.c\n@@ -792,21 +792,21 @@\n }\n \n /**\n- * Create a drop Rx Hash queue.\n+ * Create a DevX drop action for Rx Hash queue.\n  *\n  * @param dev\n  *   Pointer to Ethernet device.\n  *\n  * @return\n- *   The DevX object initialized, NULL otherwise and rte_errno is set.\n+ *   0 on success, a negative errno value otherwise and rte_errno is set.\n  */\n-static struct mlx5_hrxq *\n-mlx5_devx_hrxq_drop_new(struct rte_eth_dev *dev)\n+static int\n+mlx5_devx_drop_action_create(struct rte_eth_dev *dev)\n {\n \t(void)dev;\n \tDRV_LOG(ERR, \"DevX drop action is not supported yet\");\n \trte_errno = ENOTSUP;\n-\treturn NULL;\n+\treturn -rte_errno;\n }\n \n /**\n@@ -816,7 +816,7 @@\n  *   Pointer to Ethernet device.\n  */\n static void\n-mlx5_devx_hrxq_drop_release(struct rte_eth_dev *dev)\n+mlx5_devx_drop_action_destroy(struct rte_eth_dev *dev)\n {\n \t(void)dev;\n \tDRV_LOG(ERR, \"DevX drop action is not supported yet\");\n@@ -833,6 +833,6 @@ struct mlx5_obj_ops devx_obj_ops = {\n \t.ind_table_destroy = mlx5_devx_ind_table_destroy,\n \t.hrxq_new = mlx5_devx_hrxq_new,\n \t.hrxq_destroy = mlx5_devx_tir_destroy,\n-\t.hrxq_drop_new = mlx5_devx_hrxq_drop_new,\n-\t.hrxq_drop_release = mlx5_devx_hrxq_drop_release,\n+\t.drop_action_create = mlx5_devx_drop_action_create,\n+\t.drop_action_destroy = mlx5_devx_drop_action_destroy,\n };\ndiff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c\nindex f953a2d..56529c8 100644\n--- a/drivers/net/mlx5/mlx5_flow_dv.c\n+++ b/drivers/net/mlx5/mlx5_flow_dv.c\n@@ -8917,7 +8917,7 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t\tdv->actions[n++] = priv->sh->esw_drop_action;\n \t\t\t} else {\n \t\t\t\tstruct mlx5_hrxq *drop_hrxq;\n-\t\t\t\tdrop_hrxq = priv->obj_ops.hrxq_drop_new(dev);\n+\t\t\t\tdrop_hrxq = mlx5_drop_action_create(dev);\n \t\t\t\tif (!drop_hrxq) {\n \t\t\t\t\trte_flow_error_set\n \t\t\t\t\t\t(error, errno,\n@@ -8928,7 +8928,7 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t\t}\n \t\t\t\t/*\n \t\t\t\t * Drop queues will be released by the specify\n-\t\t\t\t * mlx5_hrxq_drop_release() function. Assign\n+\t\t\t\t * mlx5_drop_action_destroy() function. Assign\n \t\t\t\t * the special index to hrxq to mark the queue\n \t\t\t\t * has been allocated.\n \t\t\t\t */\n@@ -9013,7 +9013,7 @@ struct field_modify_info modify_tcp[] = {\n \t\t/* hrxq is union, don't clear it if the flag is not set. */\n \t\tif (dh->rix_hrxq) {\n \t\t\tif (dh->fate_action == MLX5_FLOW_FATE_DROP) {\n-\t\t\t\tpriv->obj_ops.hrxq_drop_release(dev);\n+\t\t\t\tmlx5_drop_action_destroy(dev);\n \t\t\t\tdh->rix_hrxq = 0;\n \t\t\t} else if (dh->fate_action == MLX5_FLOW_FATE_QUEUE) {\n \t\t\t\tmlx5_hrxq_release(dev, dh->rix_hrxq);\n@@ -9303,13 +9303,11 @@ struct field_modify_info modify_tcp[] = {\n flow_dv_fate_resource_release(struct rte_eth_dev *dev,\n \t\t\t       struct mlx5_flow_handle *handle)\n {\n-\tstruct mlx5_priv *priv = dev->data->dev_private;\n-\n \tif (!handle->rix_fate)\n \t\treturn;\n \tswitch (handle->fate_action) {\n \tcase MLX5_FLOW_FATE_DROP:\n-\t\tpriv->obj_ops.hrxq_drop_release(dev);\n+\t\tmlx5_drop_action_destroy(dev);\n \t\tbreak;\n \tcase MLX5_FLOW_FATE_QUEUE:\n \t\tmlx5_hrxq_release(dev, handle->rix_hrxq);\ndiff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c\nindex e5fc278..62c18b8 100644\n--- a/drivers/net/mlx5/mlx5_flow_verbs.c\n+++ b/drivers/net/mlx5/mlx5_flow_verbs.c\n@@ -72,7 +72,7 @@\n \t\t},\n \t};\n \tstruct ibv_flow *flow;\n-\tstruct mlx5_hrxq *drop = priv->obj_ops.hrxq_drop_new(dev);\n+\tstruct mlx5_hrxq *drop = mlx5_drop_action_create(dev);\n \tuint16_t vprio[] = { 8, 16 };\n \tint i;\n \tint priority = 0;\n@@ -89,7 +89,7 @@\n \t\tclaim_zero(mlx5_glue->destroy_flow(flow));\n \t\tpriority = vprio[i];\n \t}\n-\tpriv->obj_ops.hrxq_drop_release(dev);\n+\tmlx5_drop_action_destroy(dev);\n \tswitch (priority) {\n \tcase 8:\n \t\tpriority = RTE_DIM(priority_map_3);\n@@ -1889,7 +1889,7 @@\n \t\t/* hrxq is union, don't touch it only the flag is set. */\n \t\tif (handle->rix_hrxq) {\n \t\t\tif (handle->fate_action == MLX5_FLOW_FATE_DROP) {\n-\t\t\t\tpriv->obj_ops.hrxq_drop_release(dev);\n+\t\t\t\tmlx5_drop_action_destroy(dev);\n \t\t\t\thandle->rix_hrxq = 0;\n \t\t\t} else if (handle->fate_action ==\n \t\t\t\t   MLX5_FLOW_FATE_QUEUE) {\n@@ -1965,7 +1965,7 @@\n \t\tdev_flow = &((struct mlx5_flow *)priv->inter_flows)[idx];\n \t\thandle = dev_flow->handle;\n \t\tif (handle->fate_action == MLX5_FLOW_FATE_DROP) {\n-\t\t\thrxq = priv->obj_ops.hrxq_drop_new(dev);\n+\t\t\thrxq = mlx5_drop_action_create(dev);\n \t\t\tif (!hrxq) {\n \t\t\t\trte_flow_error_set\n \t\t\t\t\t(error, errno,\n@@ -2034,7 +2034,7 @@\n \t\t/* hrxq is union, don't touch it only the flag is set. */\n \t\tif (handle->rix_hrxq) {\n \t\t\tif (handle->fate_action == MLX5_FLOW_FATE_DROP) {\n-\t\t\t\tpriv->obj_ops.hrxq_drop_release(dev);\n+\t\t\t\tmlx5_drop_action_destroy(dev);\n \t\t\t\thandle->rix_hrxq = 0;\n \t\t\t} else if (handle->fate_action ==\n \t\t\t\t   MLX5_FLOW_FATE_QUEUE) {\ndiff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c\nindex 99b32f6..0b3e813 100644\n--- a/drivers/net/mlx5/mlx5_rxq.c\n+++ b/drivers/net/mlx5/mlx5_rxq.c\n@@ -2006,6 +2006,78 @@ struct mlx5_ind_table_obj *\n }\n \n /**\n+ * Create a drop Rx Hash queue.\n+ *\n+ * @param dev\n+ *   Pointer to Ethernet device.\n+ *\n+ * @return\n+ *   The Verbs/DevX object initialized, NULL otherwise and rte_errno is set.\n+ */\n+struct mlx5_hrxq *\n+mlx5_drop_action_create(struct rte_eth_dev *dev)\n+{\n+\tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_hrxq *hrxq = NULL;\n+\tint ret;\n+\n+\tif (priv->drop_queue.hrxq) {\n+\t\trte_atomic32_inc(&priv->drop_queue.hrxq->refcnt);\n+\t\treturn priv->drop_queue.hrxq;\n+\t}\n+\thrxq = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*hrxq), 0, SOCKET_ID_ANY);\n+\tif (!hrxq) {\n+\t\tDRV_LOG(WARNING,\n+\t\t\t\"Port %u cannot allocate memory for drop queue.\",\n+\t\t\tdev->data->port_id);\n+\t\trte_errno = ENOMEM;\n+\t\tgoto error;\n+\t}\n+\tpriv->drop_queue.hrxq = hrxq;\n+\thrxq->ind_table = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*hrxq->ind_table),\n+\t\t\t\t      0, SOCKET_ID_ANY);\n+\tif (!hrxq->ind_table) {\n+\t\trte_errno = ENOMEM;\n+\t\tgoto error;\n+\t}\n+\tret = priv->obj_ops.drop_action_create(dev);\n+\tif (ret < 0)\n+\t\tgoto error;\n+\trte_atomic32_set(&hrxq->refcnt, 1);\n+\treturn hrxq;\n+error:\n+\tif (hrxq) {\n+\t\tif (hrxq->ind_table)\n+\t\t\tmlx5_free(hrxq->ind_table);\n+\t\tpriv->drop_queue.hrxq = NULL;\n+\t\tmlx5_free(hrxq);\n+\t}\n+\treturn NULL;\n+}\n+\n+/**\n+ * Release a drop hash Rx queue.\n+ *\n+ * @param dev\n+ *   Pointer to Ethernet device.\n+ */\n+void\n+mlx5_drop_action_destroy(struct rte_eth_dev *dev)\n+{\n+\tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_hrxq *hrxq = priv->drop_queue.hrxq;\n+\n+\tif (rte_atomic32_dec_and_test(&hrxq->refcnt)) {\n+\t\tpriv->obj_ops.drop_action_destroy(dev);\n+\t\tmlx5_free(priv->drop_queue.rxq);\n+\t\tmlx5_free(hrxq->ind_table);\n+\t\tmlx5_free(hrxq);\n+\t\tpriv->drop_queue.rxq = NULL;\n+\t\tpriv->drop_queue.hrxq = NULL;\n+\t}\n+}\n+\n+/**\n  * Verify the Rx Queue list is empty\n  *\n  * @param dev\ndiff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h\nindex 164f36b..a8e6837 100644\n--- a/drivers/net/mlx5/mlx5_rxtx.h\n+++ b/drivers/net/mlx5/mlx5_rxtx.h\n@@ -382,8 +382,8 @@ uint32_t mlx5_hrxq_get(struct rte_eth_dev *dev,\n int mlx5_hrxq_release(struct rte_eth_dev *dev, uint32_t hxrq_idx);\n int mlx5_hrxq_verify(struct rte_eth_dev *dev);\n enum mlx5_rxq_type mlx5_rxq_get_type(struct rte_eth_dev *dev, uint16_t idx);\n-struct mlx5_hrxq *mlx5_hrxq_drop_new(struct rte_eth_dev *dev);\n-void mlx5_hrxq_drop_release(struct rte_eth_dev *dev);\n+struct mlx5_hrxq *mlx5_drop_action_create(struct rte_eth_dev *dev);\n+void mlx5_drop_action_destroy(struct rte_eth_dev *dev);\n uint64_t mlx5_get_rx_port_offloads(void);\n uint64_t mlx5_get_rx_queue_offloads(struct rte_eth_dev *dev);\n void mlx5_rxq_timestamp_set(struct rte_eth_dev *dev);\n",
    "prefixes": [
        "v1",
        "18/18"
    ]
}