get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 87756,
    "url": "http://patches.dpdk.org/api/patches/87756/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210204195853.13411-2-aboyer@pensando.io/",
    "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": "<20210204195853.13411-2-aboyer@pensando.io>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210204195853.13411-2-aboyer@pensando.io",
    "date": "2021-02-04T19:58:40",
    "name": "[01/14] net/ionic: cut down completion queue structure",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "8b58670e3c90179da064336af48972d4149957ae",
    "submitter": {
        "id": 2036,
        "url": "http://patches.dpdk.org/api/people/2036/?format=api",
        "name": "Andrew Boyer",
        "email": "aboyer@pensando.io"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20210204195853.13411-2-aboyer@pensando.io/mbox/",
    "series": [
        {
            "id": 15176,
            "url": "http://patches.dpdk.org/api/series/15176/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=15176",
            "date": "2021-02-04T19:58:39",
            "name": "net/ionic: struct optimizations, fixes",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/15176/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/87756/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/87756/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 4FDB7A0524;\n\tThu,  4 Feb 2021 20:59:20 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 2F2E92407DB;\n\tThu,  4 Feb 2021 20:59:20 +0100 (CET)",
            "from mail-pl1-f174.google.com (mail-pl1-f174.google.com\n [209.85.214.174])\n by mails.dpdk.org (Postfix) with ESMTP id 666312407C2\n for <dev@dpdk.org>; Thu,  4 Feb 2021 20:59:19 +0100 (CET)",
            "by mail-pl1-f174.google.com with SMTP id u15so2354081plf.1\n for <dev@dpdk.org>; Thu, 04 Feb 2021 11:59:19 -0800 (PST)",
            "from driver-dev1.pensando.io ([12.226.153.42])\n by smtp.gmail.com with ESMTPSA id r14sm7757915pgi.27.2021.02.04.11.59.17\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 04 Feb 2021 11:59:17 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google;\n h=from:to:cc:subject:date:message-id:in-reply-to:references;\n bh=wD2bD7+eFZMjDixxUZdAOLC8xtPhN64xLgf0LhF9XGU=;\n b=afyLz+yEFtuqgf8GC6Pi26UW59f/smO6dGqt3FsSqdL+9yomv/+AEHgSkoMuOCJXpu\n zxFbAOAA9zQmHrktJZinKe1YI73IwsRumwPAvu0bt/e+MI2WYz/KYw0Zwa7TwBIPlAk6\n Uxuj+fFyN87p87xQTLm3heWSuQLBIK9By1jp4VbGWQcwSuT6ebToB0ZbghEDaMti2Qhh\n C4jpIC7aayLgQQO2yvavDlDXOy/EkK9TaARTTlnZk9fbALVr6hBropOaNw2Ux7xIRqjl\n xrim49Q6ZKkKS0tUpG0NsChbrFsDyUO8o51thKtIX5EjBJC7aBlr/dhMHW2/+wCT5pkH\n EU1A==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references;\n bh=wD2bD7+eFZMjDixxUZdAOLC8xtPhN64xLgf0LhF9XGU=;\n b=X0NS4iZ5ZBQzoCIHHOpq7Qw1i1bsj3LYfqUvgxvSJrZ7rD+B2gOrx4ydhGWkXu+ifB\n Cc5MaNqw0PIIxx4BqXv3zn9Jk8/Umd7i1cscQsPJQH3c3TWRvt7+PEPUxhQdYZms5MFw\n SXeNEQUtyy1/Aj826/Vxl2QgHPfXMcMYKinues+vSQd03OCOXGF0BLx3e8la8XNRNOkw\n ueAJHFoTKGblsrEVBueUvCa52oLrZBK0vud/f754SrpJeG8gM4HJqsSsWRgL/Y7AR/ky\n 1KFZOcbidY8BDT9j6z8pVeEykOcq1JQBJtB3Tx7+vR9vQ9vxZLOtqBiMDCuR8hYLJfJr\n JeTg==",
        "X-Gm-Message-State": "AOAM530n8lMTAzdYiX5iEb5NNKFR9/V7To94txLT5k9WWMQGJp314Anm\n zJxKX43wzBDaOOk+gH4wFNC9ovHcJbfo5A==",
        "X-Google-Smtp-Source": "\n ABdhPJxeZAaAaVf4koyx7WbJGanvJ5tD2fLjWk2MMiAlrf21VMa0CIQn/Vgus+PVToG2pFK63G7LbA==",
        "X-Received": "by 2002:a17:902:ab83:b029:e1:6021:dd19 with SMTP id\n f3-20020a170902ab83b02900e16021dd19mr767821plr.40.1612468758327;\n Thu, 04 Feb 2021 11:59:18 -0800 (PST)",
        "From": "Andrew Boyer <aboyer@pensando.io>",
        "To": "dev@dpdk.org",
        "Cc": "Alfredo Cardigliano <cardigliano@ntop.org>,\n Andrew Boyer <aboyer@pensando.io>",
        "Date": "Thu,  4 Feb 2021 11:58:40 -0800",
        "Message-Id": "<20210204195853.13411-2-aboyer@pensando.io>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20210204195853.13411-1-aboyer@pensando.io>",
        "References": "<20210204195853.13411-1-aboyer@pensando.io>",
        "Subject": "[dpdk-dev] [PATCH 01/14] net/ionic: cut down completion queue\n structure",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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": "Add Q_NEXT_TO_POST() and Q_NEXT_TO_SRVC() macros.\nUse a precomputed size mask.\n\nThis will conserve resources.\n\nSigned-off-by: Andrew Boyer <aboyer@pensando.io>\n---\n drivers/net/ionic/ionic_dev.c  | 14 +++-----------\n drivers/net/ionic/ionic_dev.h  | 14 +++++++-------\n drivers/net/ionic/ionic_lif.c  |  5 +++--\n drivers/net/ionic/ionic_lif.h  |  3 ++-\n drivers/net/ionic/ionic_rxtx.c | 24 ++++++++++++------------\n 5 files changed, 27 insertions(+), 33 deletions(-)",
    "diff": "diff --git a/drivers/net/ionic/ionic_dev.c b/drivers/net/ionic/ionic_dev.c\nindex a9f9e2faf9..f837817a0a 100644\n--- a/drivers/net/ionic/ionic_dev.c\n+++ b/drivers/net/ionic/ionic_dev.c\n@@ -358,14 +358,8 @@ ionic_dev_cmd_adminq_init(struct ionic_dev *idev, struct ionic_qcq *qcq)\n }\n \n int\n-ionic_cq_init(struct ionic_lif *lif, struct ionic_cq *cq,\n-\t\tuint32_t num_descs, size_t desc_size)\n+ionic_cq_init(struct ionic_cq *cq, uint16_t num_descs)\n {\n-\tif (desc_size == 0) {\n-\t\tIONIC_PRINT(ERR, \"Descriptor size is %zu\", desc_size);\n-\t\treturn -EINVAL;\n-\t}\n-\n \tif (!rte_is_power_of_2(num_descs) ||\n \t    num_descs < IONIC_MIN_RING_DESC ||\n \t    num_descs > IONIC_MAX_RING_DESC) {\n@@ -374,9 +368,8 @@ ionic_cq_init(struct ionic_lif *lif, struct ionic_cq *cq,\n \t\treturn -EINVAL;\n \t}\n \n-\tcq->lif = lif;\n \tcq->num_descs = num_descs;\n-\tcq->desc_size = desc_size;\n+\tcq->size_mask = num_descs - 1;\n \tcq->tail_idx = 0;\n \tcq->done_color = 1;\n \n@@ -393,7 +386,6 @@ ionic_cq_map(struct ionic_cq *cq, void *base, rte_iova_t base_pa)\n void\n ionic_cq_bind(struct ionic_cq *cq, struct ionic_queue *q)\n {\n-\tcq->bound_q = q;\n \tq->bound_cq = cq;\n }\n \n@@ -407,7 +399,7 @@ ionic_cq_service(struct ionic_cq *cq, uint32_t work_to_do,\n \t\treturn 0;\n \n \twhile (cb(cq, cq->tail_idx, cb_arg)) {\n-\t\tcq->tail_idx = (cq->tail_idx + 1) & (cq->num_descs - 1);\n+\t\tcq->tail_idx = Q_NEXT_TO_SRVC(cq, 1);\n \t\tif (cq->tail_idx == 0)\n \t\t\tcq->done_color = !cq->done_color;\n \ndiff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h\nindex bacbe3f053..b29bfd13be 100644\n--- a/drivers/net/ionic/ionic_dev.h\n+++ b/drivers/net/ionic/ionic_dev.h\n@@ -142,6 +142,9 @@ struct ionic_desc_info {\n \tvoid *cb_arg;\n };\n \n+#define Q_NEXT_TO_POST(_q, _n)\t(((_q)->head_idx + (_n)) & ((_q)->size_mask))\n+#define Q_NEXT_TO_SRVC(_q, _n)\t(((_q)->tail_idx + (_n)) & ((_q)->size_mask))\n+\n struct ionic_queue {\n \tstruct ionic_dev *idev;\n \tstruct ionic_lif *lif;\n@@ -174,11 +177,9 @@ struct ionic_intr_info {\n };\n \n struct ionic_cq {\n-\tstruct ionic_lif *lif;\n-\tstruct ionic_queue *bound_q;\n-\tuint32_t tail_idx;\n-\tuint32_t num_descs;\n-\tuint32_t desc_size;\n+\tuint16_t tail_idx;\n+\tuint16_t num_descs;\n+\tuint16_t size_mask;\n \tbool done_color;\n \tvoid *base;\n \trte_iova_t base_pa;\n@@ -240,8 +241,7 @@ void ionic_dev_cmd_adminq_init(struct ionic_dev *idev, struct ionic_qcq *qcq);\n struct ionic_doorbell __iomem *ionic_db_map(struct ionic_lif *lif,\n \tstruct ionic_queue *q);\n \n-int ionic_cq_init(struct ionic_lif *lif, struct ionic_cq *cq,\n-\tuint32_t num_descs, size_t desc_size);\n+int ionic_cq_init(struct ionic_cq *cq, uint16_t num_descs);\n void ionic_cq_map(struct ionic_cq *cq, void *base, rte_iova_t base_pa);\n void ionic_cq_bind(struct ionic_cq *cq, struct ionic_queue *q);\n typedef bool (*ionic_cq_cb)(struct ionic_cq *cq, uint32_t cq_desc_index,\ndiff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c\nindex e083f92417..a9fe34c0f2 100644\n--- a/drivers/net/ionic/ionic_lif.c\n+++ b/drivers/net/ionic/ionic_lif.c\n@@ -656,7 +656,7 @@ ionic_qcq_alloc(struct ionic_lif *lif, uint8_t type,\n \t\tgoto err_out_free_info;\n \t}\n \n-\terr = ionic_cq_init(lif, &new->cq, num_descs, cq_desc_size);\n+\terr = ionic_cq_init(&new->cq, num_descs);\n \tif (err) {\n \t\tIONIC_PRINT(ERR, \"Completion queue initialization failed\");\n \t\tgoto err_out_free_info;\n@@ -1169,11 +1169,12 @@ ionic_adminq_service(struct ionic_cq *cq, uint32_t cq_desc_index,\n {\n \tstruct ionic_admin_comp *cq_desc_base = cq->base;\n \tstruct ionic_admin_comp *cq_desc = &cq_desc_base[cq_desc_index];\n+\tstruct ionic_qcq *qcq = IONIC_CQ_TO_QCQ(cq);\n \n \tif (!color_match(cq_desc->color, cq->done_color))\n \t\treturn false;\n \n-\tionic_q_service(cq->bound_q, cq_desc_index, cq_desc->comp_index, NULL);\n+\tionic_q_service(&qcq->q, cq_desc_index, cq_desc->comp_index, NULL);\n \n \treturn true;\n }\ndiff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h\nindex 8f01aefd60..1a898a0ef9 100644\n--- a/drivers/net/ionic/ionic_lif.h\n+++ b/drivers/net/ionic/ionic_lif.h\n@@ -71,7 +71,8 @@ struct ionic_qcq {\n \tstruct ionic_intr_info intr;\n };\n \n-#define IONIC_Q_TO_QCQ(q)\tcontainer_of(q, struct ionic_qcq, q)\n+#define IONIC_Q_TO_QCQ(_q)\tcontainer_of(_q, struct ionic_qcq, q)\n+#define IONIC_CQ_TO_QCQ(_cq)\tcontainer_of(_cq, struct ionic_qcq, cq)\n #define IONIC_Q_TO_TX_STATS(q)\t(&IONIC_Q_TO_QCQ(q)->stats.tx)\n #define IONIC_Q_TO_RX_STATS(q)\t(&IONIC_Q_TO_QCQ(q)->stats.rx)\n \ndiff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c\nindex 5ae9ecf400..1ad95d8e39 100644\n--- a/drivers/net/ionic/ionic_rxtx.c\n+++ b/drivers/net/ionic/ionic_rxtx.c\n@@ -68,9 +68,10 @@ ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,\n }\n \n static __rte_always_inline void\n-ionic_tx_flush(struct ionic_cq *cq)\n+ionic_tx_flush(struct ionic_qcq *txq)\n {\n-\tstruct ionic_queue *q = cq->bound_q;\n+\tstruct ionic_cq *cq = &txq->cq;\n+\tstruct ionic_queue *q = &txq->q;\n \tstruct ionic_desc_info *q_desc_info;\n \tstruct rte_mbuf *txm, *next;\n \tstruct ionic_txq_comp *cq_desc_base = cq->base;\n@@ -79,7 +80,7 @@ ionic_tx_flush(struct ionic_cq *cq)\n \n \tcq_desc = &cq_desc_base[cq->tail_idx];\n \twhile (color_match(cq_desc->color, cq->done_color)) {\n-\t\tcq->tail_idx = (cq->tail_idx + 1) & (cq->num_descs - 1);\n+\t\tcq->tail_idx = Q_NEXT_TO_SRVC(cq, 1);\n \n \t\t/* Prefetch the next 4 descriptors (not really useful here) */\n \t\tif ((cq->tail_idx & 0x3) == 0)\n@@ -149,7 +150,7 @@ ionic_dev_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id)\n \n \tionic_qcq_disable(txq);\n \n-\tionic_tx_flush(&txq->cq);\n+\tionic_tx_flush(txq);\n \n \treturn 0;\n }\n@@ -521,7 +522,6 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,\n {\n \tstruct ionic_qcq *txq = (struct ionic_qcq *)tx_queue;\n \tstruct ionic_queue *q = &txq->q;\n-\tstruct ionic_cq *cq = &txq->cq;\n \tstruct ionic_tx_stats *stats = IONIC_Q_TO_TX_STATS(q);\n \tuint32_t next_q_head_idx;\n \tuint32_t bytes_tx = 0;\n@@ -530,7 +530,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,\n \tbool last;\n \n \t/* Cleaning old buffers */\n-\tionic_tx_flush(cq);\n+\tionic_tx_flush(txq);\n \n \tif (unlikely(ionic_q_space_avail(q) < nb_pkts)) {\n \t\tstats->stop += nb_pkts;\n@@ -1018,10 +1018,11 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)\n }\n \n static __rte_always_inline void\n-ionic_rxq_service(struct ionic_cq *cq, uint32_t work_to_do,\n+ionic_rxq_service(struct ionic_qcq *rxq, uint32_t work_to_do,\n \t\tvoid *service_cb_arg)\n {\n-\tstruct ionic_queue *q = cq->bound_q;\n+\tstruct ionic_cq *cq = &rxq->cq;\n+\tstruct ionic_queue *q = &rxq->q;\n \tstruct ionic_desc_info *q_desc_info;\n \tstruct ionic_rxq_comp *cq_desc_base = cq->base;\n \tstruct ionic_rxq_comp *cq_desc;\n@@ -1035,7 +1036,7 @@ ionic_rxq_service(struct ionic_cq *cq, uint32_t work_to_do,\n \tcq_desc = &cq_desc_base[cq->tail_idx];\n \twhile (color_match(cq_desc->pkt_type_color, cq->done_color)) {\n \t\tcurr_cq_tail_idx = cq->tail_idx;\n-\t\tcq->tail_idx = (cq->tail_idx + 1) & (cq->num_descs - 1);\n+\t\tcq->tail_idx = Q_NEXT_TO_SRVC(cq, 1);\n \n \t\tif (cq->tail_idx == 0)\n \t\t\tcq->done_color = !cq->done_color;\n@@ -1087,7 +1088,7 @@ ionic_dev_rx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)\n \tionic_qcq_disable(rxq);\n \n \t/* Flush */\n-\tionic_rxq_service(&rxq->cq, -1, NULL);\n+\tionic_rxq_service(rxq, -1, NULL);\n \n \treturn 0;\n }\n@@ -1099,14 +1100,13 @@ ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,\n \tstruct ionic_qcq *rxq = (struct ionic_qcq *)rx_queue;\n \tuint32_t frame_size =\n \t\trxq->lif->eth_dev->data->dev_conf.rxmode.max_rx_pkt_len;\n-\tstruct ionic_cq *cq = &rxq->cq;\n \tstruct ionic_rx_service service_cb_arg;\n \n \tservice_cb_arg.rx_pkts = rx_pkts;\n \tservice_cb_arg.nb_pkts = nb_pkts;\n \tservice_cb_arg.nb_rx = 0;\n \n-\tionic_rxq_service(cq, nb_pkts, &service_cb_arg);\n+\tionic_rxq_service(rxq, nb_pkts, &service_cb_arg);\n \n \tionic_rx_fill(rxq, frame_size);\n \n",
    "prefixes": [
        "01/14"
    ]
}