Show a patch.

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

{
    "id": 41080,
    "url": "http://patches.dpdk.org/api/patches/41080/",
    "web_url": "http://patches.dpdk.org/patch/41080/",
    "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": "<20180614083047.10812-3-adrien.mazarguil@6wind.com>",
    "date": "2018-06-14T08:34:52",
    "name": "[v2,2/7] net/mlx5: remove redundant objects in probe code",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "a77c0c69a029cf9816b607aa7d5bada05208bd53",
    "submitter": {
        "id": 165,
        "url": "http://patches.dpdk.org/api/people/165/",
        "name": "Adrien Mazarguil",
        "email": "adrien.mazarguil@6wind.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/patch/41080/mbox/",
    "series": [
        {
            "id": 118,
            "url": "http://patches.dpdk.org/api/series/118/",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=118",
            "date": "2018-06-14T08:34:47",
            "name": "net/mlx5: add port representor support",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/118/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/41080/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/41080/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "In-Reply-To": "<20180614083047.10812-1-adrien.mazarguil@6wind.com>",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Mailer": "git-send-email 2.11.0",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id DD92C1E436;\n\tThu, 14 Jun 2018 10:35:10 +0200 (CEST)",
            "from mail-wr0-f170.google.com (mail-wr0-f170.google.com\n\t[209.85.128.170]) by dpdk.org (Postfix) with ESMTP id 740601E409\n\tfor <dev@dpdk.org>; Thu, 14 Jun 2018 10:35:08 +0200 (CEST)",
            "by mail-wr0-f170.google.com with SMTP id h10-v6so5419862wrq.8\n\tfor <dev@dpdk.org>; Thu, 14 Jun 2018 01:35:08 -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\tn56-v6sm10705890wrn.72.2018.06.14.01.35.07\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 14 Jun 2018 01:35:07 -0700 (PDT)"
        ],
        "References": "<20180525161814.13873-1-adrien.mazarguil@6wind.com>\n\t<20180614083047.10812-1-adrien.mazarguil@6wind.com>",
        "X-Google-Smtp-Source": "ADUXVKKmY/vXXbhvOJ4qGwuz1f5+7usTzkQZS4d4BOmQQBUHzG8RZs9CdQcG6keVl8Qf0inW92SGtA==",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=6wind-com.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:in-reply-to;\n\tbh=XMoJwcopedEjdu0b76//vItV9waRTNBNH3pEozTruVA=;\n\tb=zGeJ98OHWJoTh19FBsaYghpRfQa2ucQJHkmYPlA8NrnsvWOUo9e6jo4s8xnPNANm0F\n\tm0G36uB+qdeQoJxaiNmny+Fl2ohh6HfF/N2zFmSuqAynLJ3f2MLSuSAEjBwc4HFroX8J\n\tP9yowEe0Ueid2gEqivhbbHeSMbxbas1FJ25M54PlFRrMqXEcKCLDiTV9j7zr+GV+7B5N\n\tT3M6bpolvp0AKTiT0p4OwTTN8F26IIO/tH5ftom15xg1EuiUyJdyBn/0vW//s3EVMy6I\n\tkjdZKxYi4/8fS3Ym7XIVAycqxoK5WJH87y8gjWnTCNtRb8168YpuDnxcnwlx8YfM5//a\n\tGrYA==",
        "MIME-Version": "1.0",
        "X-Received": "by 2002:adf:ef4f:: with SMTP id\n\tc15-v6mr1200115wrp.182.1528965308173; \n\tThu, 14 Jun 2018 01:35:08 -0700 (PDT)",
        "Message-ID": "<20180614083047.10812-3-adrien.mazarguil@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:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:in-reply-to;\n\tbh=XMoJwcopedEjdu0b76//vItV9waRTNBNH3pEozTruVA=;\n\tb=oRGwmnfpVQHIrb+9gpjn5XSQ5YdKmKOOl2Iq3uv0IF012WfWCSJ3W0GXTzs17FwAm2\n\tJV81A2Bea2e5DiaIDzKrnUipXWOHQ9A9hKZEd1qq4j5zHxzR6/ZNYQIyVAFvq4AryNq1\n\tMY0YNoCtNmnRiylT8ZwYedGRRhlUD6U+43fJdTESxaSxSVQbc6sJkhNyzQBrOosRYAOw\n\tV3sgrC/dzm2w4gpiG2Ipt2CBBBjeEtGtBR8PQLOO67r+4FQ+DQ5dpGUQlwwekawrVQX9\n\tOiZ7fKFM4X4aAQ2z/wgM3aupBbf/i2Sx/HhNVkiANBB5MFWKAl1xLJZaFCOwhhG5mRXq\n\teMmQ==",
        "Delivered-To": "patchwork@dpdk.org",
        "Precedence": "list",
        "From": "Adrien Mazarguil <adrien.mazarguil@6wind.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "Content-Type": "text/plain; charset=us-ascii",
        "Content-Disposition": "inline",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "To": "Shahaf Shuler <shahafs@mellanox.com>",
        "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Date": "Thu, 14 Jun 2018 10:34:52 +0200",
        "X-Gm-Message-State": "APt69E1KDAZcINlG/ktbQa+jVOqAqsxkdSlpLV7idjA4PCB1NMpr4F+v\n\t6E+jJZlSxQn1ySjDDwvTzWLRZg==",
        "Cc": "dev@dpdk.org",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "X-BeenThere": "dev@dpdk.org",
        "Subject": "[dpdk-dev] [PATCH v2 2/7] net/mlx5: remove redundant objects in\n\tprobe code"
    },
    "content": "This patch gets rid of redundant calls to open the device and query its\nattributes in order to simplify the code.\n\nSigned-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>\n--\nv2 changes:\n\n- Minor indent fix on existing code.\n---\n drivers/net/mlx5/mlx5.c | 64 +++++++++++++++++++++-----------------------\n 1 file changed, 30 insertions(+), 34 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c\nindex 3bdcb3970..1a5391e63 100644\n--- a/drivers/net/mlx5/mlx5.c\n+++ b/drivers/net/mlx5/mlx5.c\n@@ -654,10 +654,10 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n {\n \tstruct ibv_device **list = NULL;\n \tstruct ibv_device *ibv_dev;\n+\tstruct ibv_context *ctx = NULL;\n+\tstruct ibv_device_attr_ex attr;\n \tstruct mlx5dv_context dv_attr = { .comp_mask = 0 };\n \tint err = 0;\n-\tstruct ibv_context *attr_ctx = NULL;\n-\tstruct ibv_device_attr_ex device_attr;\n \tunsigned int vf = 0;\n \tunsigned int mps;\n \tunsigned int cqe_comp;\n@@ -714,12 +714,12 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\t       PCI_DEVICE_ID_MELLANOX_CONNECTX5VF) ||\n \t\t      (pci_dev->id.device_id ==\n \t\t       PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF));\n-\t\tattr_ctx = mlx5_glue->open_device(list[i]);\n+\t\tctx = mlx5_glue->open_device(list[i]);\n \t\trte_errno = errno;\n \t\terr = rte_errno;\n \t\tbreak;\n \t}\n-\tif (attr_ctx == NULL) {\n+\tif (ctx == NULL) {\n \t\tswitch (err) {\n \t\tcase 0:\n \t\t\tDRV_LOG(ERR,\n@@ -748,7 +748,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n #ifdef HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT\n \tdv_attr.comp_mask |= MLX5DV_CONTEXT_MASK_STRIDING_RQ;\n #endif\n-\tmlx5_glue->dv_query_device(attr_ctx, &dv_attr);\n+\tmlx5_glue->dv_query_device(ctx, &dv_attr);\n \tif (dv_attr.flags & MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED) {\n \t\tif (dv_attr.flags & MLX5DV_CONTEXT_FLAGS_ENHANCED_MPW) {\n \t\t\tDRV_LOG(DEBUG, \"enhanced MPW is supported\");\n@@ -822,23 +822,20 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \tDRV_LOG(WARNING, \"MPLS over GRE/UDP tunnel offloading disabled due to\"\n \t\t\" old OFED/rdma-core version or firmware configuration\");\n #endif\n-\terr = mlx5_glue->query_device_ex(attr_ctx, NULL, &device_attr);\n+\terr = mlx5_glue->query_device_ex(ctx, NULL, &attr);\n \tif (err) {\n \t\tDEBUG(\"ibv_query_device_ex() failed\");\n \t\tgoto error;\n \t}\n-\tDRV_LOG(INFO, \"%u port(s) detected\",\n-\t\tdevice_attr.orig_attr.phys_port_cnt);\n-\tfor (i = 0; i < device_attr.orig_attr.phys_port_cnt; i++) {\n+\tDRV_LOG(INFO, \"%u port(s) detected\", attr.orig_attr.phys_port_cnt);\n+\tfor (i = 0; i < attr.orig_attr.phys_port_cnt; i++) {\n \t\tchar name[RTE_ETH_NAME_MAX_LEN];\n \t\tint len;\n \t\tuint32_t port = i + 1; /* ports are indexed from one */\n-\t\tstruct ibv_context *ctx = NULL;\n \t\tstruct ibv_port_attr port_attr;\n \t\tstruct ibv_pd *pd = NULL;\n \t\tstruct priv *priv = NULL;\n \t\tstruct rte_eth_dev *eth_dev = NULL;\n-\t\tstruct ibv_device_attr_ex device_attr_ex;\n \t\tstruct ether_addr mac;\n \t\tstruct mlx5_dev_config config = {\n \t\t\t.cqe_comp = cqe_comp,\n@@ -865,7 +862,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\tlen = snprintf(name, sizeof(name), PCI_PRI_FMT,\n \t\t\t pci_dev->addr.domain, pci_dev->addr.bus,\n \t\t\t pci_dev->addr.devid, pci_dev->addr.function);\n-\t\tif (device_attr.orig_attr.phys_port_cnt > 1)\n+\t\tif (attr.orig_attr.phys_port_cnt > 1)\n \t\t\tsnprintf(name + len, sizeof(name), \" port %u\", i);\n \t\tif (rte_eal_process_type() == RTE_PROC_SECONDARY) {\n \t\t\teth_dev = rte_eth_dev_attach_secondary(name);\n@@ -907,7 +904,8 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\t\tcontinue;\n \t\t}\n \t\tDRV_LOG(DEBUG, \"using port %u\", port);\n-\t\tctx = mlx5_glue->open_device(ibv_dev);\n+\t\tif (!ctx)\n+\t\t\tctx = mlx5_glue->open_device(ibv_dev);\n \t\tif (ctx == NULL) {\n \t\t\terr = ENODEV;\n \t\t\tgoto port_error;\n@@ -949,7 +947,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\tpriv->ctx = ctx;\n \t\tstrncpy(priv->ibdev_path, priv->ctx->device->ibdev_path,\n \t\t\tsizeof(priv->ibdev_path));\n-\t\tpriv->device_attr = device_attr;\n+\t\tpriv->device_attr = attr;\n \t\tpriv->port = port;\n \t\tpriv->pd = pd;\n \t\tpriv->mtu = ETHER_MTU;\n@@ -960,17 +958,12 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\t\t\tstrerror(rte_errno));\n \t\t\tgoto port_error;\n \t\t}\n-\t\terr = mlx5_glue->query_device_ex(ctx, NULL, &device_attr_ex);\n-\t\tif (err) {\n-\t\t\tDRV_LOG(ERR, \"ibv_query_device_ex() failed\");\n-\t\t\tgoto port_error;\n-\t\t}\n-\t\tconfig.hw_csum = !!(device_attr_ex.device_cap_flags_ex &\n+\t\tconfig.hw_csum = !!(attr.device_cap_flags_ex &\n \t\t\t\t    IBV_DEVICE_RAW_IP_CSUM);\n \t\tDRV_LOG(DEBUG, \"checksum offloading is %ssupported\",\n \t\t\t(config.hw_csum ? \"\" : \"not \"));\n #ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT\n-\t\tconfig.flow_counter_en = !!(device_attr.max_counter_sets);\n+\t\tconfig.flow_counter_en = !!attr.max_counter_sets;\n \t\tmlx5_glue->describe_counter_set(ctx, 0, &cs_desc);\n \t\tDRV_LOG(DEBUG,\n \t\t\t\"counter type = %d, num of cs = %ld, attributes = %d\",\n@@ -978,7 +971,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\t\tcs_desc.attributes);\n #endif\n \t\tconfig.ind_table_max_size =\n-\t\t\tdevice_attr_ex.rss_caps.max_rwq_indirection_table_size;\n+\t\t\tattr.rss_caps.max_rwq_indirection_table_size;\n \t\t/* Remove this check once DPDK supports larger/variable\n \t\t * indirection tables. */\n \t\tif (config.ind_table_max_size >\n@@ -986,29 +979,28 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\t\tconfig.ind_table_max_size = ETH_RSS_RETA_SIZE_512;\n \t\tDRV_LOG(DEBUG, \"maximum Rx indirection table size is %u\",\n \t\t\tconfig.ind_table_max_size);\n-\t\tconfig.hw_vlan_strip = !!(device_attr_ex.raw_packet_caps &\n+\t\tconfig.hw_vlan_strip = !!(attr.raw_packet_caps &\n \t\t\t\t\t IBV_RAW_PACKET_CAP_CVLAN_STRIPPING);\n \t\tDRV_LOG(DEBUG, \"VLAN stripping is %ssupported\",\n \t\t\t(config.hw_vlan_strip ? \"\" : \"not \"));\n \n-\t\tconfig.hw_fcs_strip = !!(device_attr_ex.raw_packet_caps &\n+\t\tconfig.hw_fcs_strip = !!(attr.raw_packet_caps &\n \t\t\t\t\t IBV_RAW_PACKET_CAP_SCATTER_FCS);\n \t\tDRV_LOG(DEBUG, \"FCS stripping configuration is %ssupported\",\n \t\t\t(config.hw_fcs_strip ? \"\" : \"not \"));\n \n #ifdef HAVE_IBV_WQ_FLAG_RX_END_PADDING\n-\t\tconfig.hw_padding = !!device_attr_ex.rx_pad_end_addr_align;\n+\t\tconfig.hw_padding = !!attr.rx_pad_end_addr_align;\n #endif\n \t\tDRV_LOG(DEBUG,\n \t\t\t\"hardware Rx end alignment padding is %ssupported\",\n \t\t\t(config.hw_padding ? \"\" : \"not \"));\n \t\tconfig.vf = vf;\n-\t\tconfig.tso = ((device_attr_ex.tso_caps.max_tso > 0) &&\n-\t\t\t      (device_attr_ex.tso_caps.supported_qpts &\n-\t\t\t      (1 << IBV_QPT_RAW_PACKET)));\n+\t\tconfig.tso = (attr.tso_caps.max_tso > 0 &&\n+\t\t\t      (attr.tso_caps.supported_qpts &\n+\t\t\t       (1 << IBV_QPT_RAW_PACKET)));\n \t\tif (config.tso)\n-\t\t\tconfig.tso_max_payload_sz =\n-\t\t\t\t\tdevice_attr_ex.tso_caps.max_tso;\n+\t\t\tconfig.tso_max_payload_sz = attr.tso_caps.max_tso;\n \t\tif (config.mps && !mps) {\n \t\t\tDRV_LOG(ERR,\n \t\t\t\t\"multi-packet send not supported on this device\"\n@@ -1168,14 +1160,18 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\t\t\t priv, mem_event_cb);\n \t\trte_rwlock_write_unlock(&mlx5_shared_data->mem_event_rwlock);\n \t\trte_eth_dev_probing_finish(eth_dev);\n+\t\t/*\n+\t\t * Each eth_dev instance is assigned its own Verbs context,\n+\t\t * since this one is consumed, let the next iteration open\n+\t\t * another.\n+\t\t */\n+\t\tctx = NULL;\n \t\tcontinue;\n port_error:\n \t\tif (priv)\n \t\t\trte_free(priv);\n \t\tif (pd)\n \t\t\tclaim_zero(mlx5_glue->dealloc_pd(pd));\n-\t\tif (ctx)\n-\t\t\tclaim_zero(mlx5_glue->close_device(ctx));\n \t\tif (eth_dev && rte_eal_process_type() == RTE_PROC_PRIMARY)\n \t\t\trte_eth_dev_release_port(eth_dev);\n \t\tbreak;\n@@ -1187,8 +1183,8 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t * way to enumerate the registered ethdevs to free the previous ones.\n \t */\n error:\n-\tif (attr_ctx)\n-\t\tclaim_zero(mlx5_glue->close_device(attr_ctx));\n+\tif (ctx)\n+\t\tclaim_zero(mlx5_glue->close_device(ctx));\n \tif (list)\n \t\tmlx5_glue->free_device_list(list);\n \tif (err) {\n",
    "prefixes": [
        "v2",
        "2/7"
    ]
}