get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 17160,
    "url": "http://patches.dpdk.org/api/patches/17160/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1479740470-6723-55-git-send-email-arybchenko@solarflare.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": "<1479740470-6723-55-git-send-email-arybchenko@solarflare.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1479740470-6723-55-git-send-email-arybchenko@solarflare.com",
    "date": "2016-11-21T15:01:08",
    "name": "[dpdk-dev,54/56] net/sfc: add callbacks to set up and release Tx queues",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "6cf2836f07819b5c47c3842e0946b29f7f43f9f3",
    "submitter": {
        "id": 607,
        "url": "http://patches.dpdk.org/api/people/607/?format=api",
        "name": "Andrew Rybchenko",
        "email": "arybchenko@solarflare.com"
    },
    "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/1479740470-6723-55-git-send-email-arybchenko@solarflare.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/17160/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/17160/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 49957D6BA;\n\tMon, 21 Nov 2016 16:03:58 +0100 (CET)",
            "from nbfkord-smmo02.seg.att.com (nbfkord-smmo02.seg.att.com\n\t[209.65.160.78]) by dpdk.org (Postfix) with ESMTP id 471ED5582\n\tfor <dev@dpdk.org>; Mon, 21 Nov 2016 16:01:57 +0100 (CET)",
            "from unknown [12.187.104.26] (EHLO nbfkord-smmo02.seg.att.com)\n\tby nbfkord-smmo02.seg.att.com(mxl_mta-7.2.4-7) with ESMTP id\n\t56c03385.2b927801f940.1541332.00-2495.3424383.nbfkord-smmo02.seg.att.com\n\t(envelope-from <arybchenko@solarflare.com>); \n\tMon, 21 Nov 2016 15:01:57 +0000 (UTC)",
            "from unknown [12.187.104.26]\n\tby nbfkord-smmo02.seg.att.com(mxl_mta-7.2.4-7) with SMTP id\n\t55c03385.0.1541296.00-2347.3424250.nbfkord-smmo02.seg.att.com\n\t(envelope-from <arybchenko@solarflare.com>); \n\tMon, 21 Nov 2016 15:01:43 +0000 (UTC)",
            "from ocex03.SolarFlarecom.com (10.20.40.36) by\n\tocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server\n\t(TLS) id 15.0.1044.25; Mon, 21 Nov 2016 07:01:23 -0800",
            "from opal.uk.solarflarecom.com (10.17.10.1) by\n\tocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server\n\t(TLS) id\n\t15.0.1044.25 via Frontend Transport; Mon, 21 Nov 2016 07:01:22 -0800",
            "from uklogin.uk.solarflarecom.com (uklogin.uk.solarflarecom.com\n\t[10.17.10.10])\n\tby opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id\n\tuALF1LXe007260; Mon, 21 Nov 2016 15:01:21 GMT",
            "from uklogin.uk.solarflarecom.com (localhost.localdomain\n\t[127.0.0.1])\n\tby uklogin.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id\n\tuALF1J3j006765; Mon, 21 Nov 2016 15:01:21 GMT"
        ],
        "X-MXL-Hash": [
            "58330c657c2fef50-5999b13b5e58dcc4be2854c23791fb1b24e767fe",
            "58330c5752100c9f-bd49d2a1af7a60dbe81aa6eb75bafbe83055463b"
        ],
        "From": "Andrew Rybchenko <arybchenko@solarflare.com>",
        "To": "<dev@dpdk.org>",
        "CC": "Ivan Malov <ivan.malov@oktetlabs.ru>",
        "Date": "Mon, 21 Nov 2016 15:01:08 +0000",
        "Message-ID": "<1479740470-6723-55-git-send-email-arybchenko@solarflare.com>",
        "X-Mailer": "git-send-email 1.8.2.3",
        "In-Reply-To": "<1479740470-6723-1-git-send-email-arybchenko@solarflare.com>",
        "References": "<1479740470-6723-1-git-send-email-arybchenko@solarflare.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-AnalysisOut": [
            "[v=2.1 cv=UI/baXry c=1 sm=1 tr=0 a=8BlWFWvVlq5taO8ncb8nKg==]",
            "[:17 a=L24OOQBejmoA:10 a=pK7X0mNQAAAA:8 a=zRKbQ67AAAAA:8 a=]",
            "[qEWDoAS3dpP2Ns0Aji0A:9 a=5HA-qpC1VU4iIGLgRoNS:22 a=PA03WX8]",
            "[tBzeizutn5_OT:22]"
        ],
        "X-Spam": "[F=0.3471414136; CM=0.500; S=0.347(2015072901)]",
        "X-MAIL-FROM": "<arybchenko@solarflare.com>",
        "X-SOURCE-IP": "[12.187.104.26]",
        "Subject": "[dpdk-dev] [PATCH 54/56] net/sfc: add callbacks to set up and\n\trelease Tx queues",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <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": "From: Ivan Malov <ivan.malov@oktetlabs.ru>\n\nReviewed-by: Andy Moreton <amoreton@solarflare.com>\nSigned-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>\nSigned-off-by: Andrew Rybchenko <arybchenko@solarflare.com>\n---\n drivers/net/sfc/efx/sfc_ethdev.c |  58 ++++++++++++++\n drivers/net/sfc/efx/sfc_ev.h     |   2 +\n drivers/net/sfc/efx/sfc_tx.c     | 167 +++++++++++++++++++++++++++++++++++++++\n drivers/net/sfc/efx/sfc_tx.h     |  36 +++++++++\n 4 files changed, 263 insertions(+)",
    "diff": "diff --git a/drivers/net/sfc/efx/sfc_ethdev.c b/drivers/net/sfc/efx/sfc_ethdev.c\nindex 4afd30c..98e5d83 100644\n--- a/drivers/net/sfc/efx/sfc_ethdev.c\n+++ b/drivers/net/sfc/efx/sfc_ethdev.c\n@@ -39,6 +39,7 @@\n #include \"sfc_kvargs.h\"\n #include \"sfc_ev.h\"\n #include \"sfc_rx.h\"\n+#include \"sfc_tx.h\"\n \n \n static void\n@@ -266,6 +267,61 @@ sfc_rx_queue_release(void *queue)\n \tsfc_adapter_unlock(sa);\n }\n \n+static int\n+sfc_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,\n+\t\t   uint16_t nb_tx_desc, unsigned int socket_id,\n+\t\t   const struct rte_eth_txconf *tx_conf)\n+{\n+\tstruct sfc_adapter *sa = dev->data->dev_private;\n+\tint rc;\n+\n+\tsfc_log_init(sa, \"TxQ = %u, nb_tx_desc = %u, socket_id = %u\",\n+\t\t     tx_queue_id, nb_tx_desc, socket_id);\n+\n+\tsfc_adapter_lock(sa);\n+\n+\trc = sfc_tx_qinit(sa, tx_queue_id, nb_tx_desc, socket_id, tx_conf);\n+\tif (rc != 0)\n+\t\tgoto fail_tx_qinit;\n+\n+\tdev->data->tx_queues[tx_queue_id] = sa->txq_info[tx_queue_id].txq;\n+\n+\tsfc_adapter_unlock(sa);\n+\treturn 0;\n+\n+fail_tx_qinit:\n+\tsfc_adapter_unlock(sa);\n+\tSFC_ASSERT(rc > 0);\n+\treturn -rc;\n+}\n+\n+static void\n+sfc_tx_queue_release(void *queue)\n+{\n+\tstruct sfc_txq *txq = queue;\n+\tunsigned int sw_index;\n+\tstruct sfc_adapter *sa;\n+\n+\tif (txq == NULL)\n+\t\treturn;\n+\n+\tsw_index = sfc_txq_sw_index(txq);\n+\n+\tSFC_ASSERT(txq->evq != NULL);\n+\tsa = txq->evq->sa;\n+\n+\tsfc_log_init(sa, \"TxQ = %u\", sw_index);\n+\n+\tsfc_adapter_lock(sa);\n+\n+\tSFC_ASSERT(sw_index < sa->eth_dev->data->nb_tx_queues);\n+\tsa->eth_dev->data->tx_queues[sw_index] = NULL;\n+\n+\tsfc_tx_qfini(sa, sw_index);\n+\n+\tsfc_adapter_unlock(sa);\n+}\n+\n static const struct eth_dev_ops sfc_eth_dev_ops = {\n \t.dev_configure\t\t\t= sfc_dev_configure,\n \t.dev_start\t\t\t= sfc_dev_start,\n@@ -275,6 +331,8 @@ static const struct eth_dev_ops sfc_eth_dev_ops = {\n \t.dev_infos_get\t\t\t= sfc_dev_infos_get,\n \t.rx_queue_setup\t\t\t= sfc_rx_queue_setup,\n \t.rx_queue_release\t\t= sfc_rx_queue_release,\n+\t.tx_queue_setup\t\t\t= sfc_tx_queue_setup,\n+\t.tx_queue_release\t\t= sfc_tx_queue_release,\n };\n \n static int\ndiff --git a/drivers/net/sfc/efx/sfc_ev.h b/drivers/net/sfc/efx/sfc_ev.h\nindex d053182..71e51a5 100644\n--- a/drivers/net/sfc/efx/sfc_ev.h\n+++ b/drivers/net/sfc/efx/sfc_ev.h\n@@ -41,6 +41,7 @@ extern \"C\" {\n \n struct sfc_adapter;\n struct sfc_rxq;\n+struct sfc_txq;\n \n enum sfc_evq_state {\n \tSFC_EVQ_UNINITIALIZED = 0,\n@@ -58,6 +59,7 @@ struct sfc_evq {\n \tboolean_t\t\texception;\n \tefsys_mem_t\t\tmem;\n \tstruct sfc_rxq\t\t*rxq;\n+\tstruct sfc_txq\t\t*txq;\n \n \t/* Not used on datapath */\n \tstruct sfc_adapter\t*sa;\ndiff --git a/drivers/net/sfc/efx/sfc_tx.c b/drivers/net/sfc/efx/sfc_tx.c\nindex fecd058..a4ffe9c 100644\n--- a/drivers/net/sfc/efx/sfc_tx.c\n+++ b/drivers/net/sfc/efx/sfc_tx.c\n@@ -33,6 +33,165 @@\n #include \"sfc_tx.h\"\n \n static int\n+sfc_tx_qcheck_conf(struct sfc_adapter *sa,\n+\t\t   const struct rte_eth_txconf *tx_conf)\n+{\n+\tunsigned int flags = tx_conf->txq_flags;\n+\tint rc = 0;\n+\n+\tif (tx_conf->tx_rs_thresh != 0) {\n+\t\tsfc_err(sa, \"RS bit in transmit descriptor is not supported\");\n+\t\trc = EINVAL;\n+\t}\n+\n+\tif (tx_conf->tx_free_thresh != 0) {\n+\t\tsfc_err(sa,\n+\t\t\t\"setting explicit TX free threshold is not supported\");\n+\t\trc = EINVAL;\n+\t}\n+\n+\tif (tx_conf->tx_deferred_start != 0) {\n+\t\tsfc_err(sa, \"TX queue deferred start is not supported (yet)\");\n+\t\trc = EINVAL;\n+\t}\n+\n+\tif (tx_conf->tx_thresh.pthresh != 0 ||\n+\t    tx_conf->tx_thresh.hthresh != 0 ||\n+\t    tx_conf->tx_thresh.wthresh != 0) {\n+\t\tsfc_err(sa,\n+\t\t\t\"prefetch/host/writeback thresholds are not supported\");\n+\t\trc = EINVAL;\n+\t}\n+\n+\tif ((flags & ETH_TXQ_FLAGS_NOVLANOFFL) == 0) {\n+\t\tsfc_err(sa, \"VLAN offload is not supported\");\n+\t\trc = EINVAL;\n+\t}\n+\n+\tif ((flags & ETH_TXQ_FLAGS_NOXSUMSCTP) == 0) {\n+\t\tsfc_err(sa, \"SCTP offload is not supported\");\n+\t\trc = EINVAL;\n+\t}\n+\n+\t/* We either perform both TCP and UDP offload, or no offload at all */\n+\tif (((flags & ETH_TXQ_FLAGS_NOXSUMTCP) == 0) !=\n+\t    ((flags & ETH_TXQ_FLAGS_NOXSUMUDP) == 0)) {\n+\t\tsfc_err(sa, \"TCP and UDP offloads can't be set independently\");\n+\t\trc = EINVAL;\n+\t}\n+\n+\treturn rc;\n+}\n+\n+int\n+sfc_tx_qinit(struct sfc_adapter *sa, unsigned int sw_index,\n+\t     uint16_t nb_tx_desc, unsigned int socket_id,\n+\t     const struct rte_eth_txconf *tx_conf)\n+{\n+\tstruct sfc_txq_info *txq_info;\n+\tstruct sfc_evq *evq;\n+\tstruct sfc_txq *txq;\n+\tunsigned int evq_index = sfc_evq_index_by_txq_sw_index(sa, sw_index);\n+\tint rc = 0;\n+\n+\tsfc_log_init(sa, \"TxQ = %u\", sw_index);\n+\n+\trc = sfc_tx_qcheck_conf(sa, tx_conf);\n+\tif (rc != 0)\n+\t\tgoto fail_bad_conf;\n+\n+\tSFC_ASSERT(sw_index < sa->txq_count);\n+\ttxq_info = &sa->txq_info[sw_index];\n+\n+\tSFC_ASSERT(nb_tx_desc <= sa->txq_max_entries);\n+\ttxq_info->entries = nb_tx_desc;\n+\n+\trc = sfc_ev_qinit(sa, evq_index, txq_info->entries, socket_id);\n+\tif (rc != 0)\n+\t\tgoto fail_ev_qinit;\n+\n+\tevq = sa->evq_info[evq_index].evq;\n+\n+\trc = ENOMEM;\n+\ttxq = rte_zmalloc_socket(\"sfc-txq\", sizeof(*txq), 0, socket_id);\n+\tif (txq == NULL)\n+\t\tgoto fail_txq_alloc;\n+\n+\trc = sfc_dma_alloc(sa, \"txq\", sw_index, EFX_TXQ_SIZE(txq_info->entries),\n+\t\t\t   socket_id, &txq->mem);\n+\tif (rc != 0)\n+\t\tgoto fail_dma_alloc;\n+\n+\trc = ENOMEM;\n+\ttxq->pend_desc = rte_calloc_socket(\"sfc-txq-pend-desc\",\n+\t\t\t\t\t   EFX_TXQ_LIMIT(txq_info->entries),\n+\t\t\t\t\t   sizeof(efx_desc_t), 0, socket_id);\n+\tif (txq->pend_desc == NULL)\n+\t\tgoto fail_pend_desc_alloc;\n+\n+\trc = ENOMEM;\n+\ttxq->sw_ring = rte_calloc_socket(\"sfc-txq-desc\", txq_info->entries,\n+\t\t\t\t\t sizeof(*txq->sw_ring), 0, socket_id);\n+\tif (txq->sw_ring == NULL)\n+\t\tgoto fail_desc_alloc;\n+\n+\ttxq->state = SFC_TXQ_INITIALIZED;\n+\ttxq->ptr_mask = txq_info->entries - 1;\n+\ttxq->hw_index = sw_index;\n+\ttxq->flags = tx_conf->txq_flags;\n+\ttxq->evq = evq;\n+\n+\tevq->txq = txq;\n+\n+\ttxq_info->txq = txq;\n+\n+\treturn 0;\n+\n+fail_desc_alloc:\n+\trte_free(txq->pend_desc);\n+\n+fail_pend_desc_alloc:\n+\tsfc_dma_free(sa, &txq->mem);\n+\n+fail_dma_alloc:\n+\trte_free(txq);\n+\n+fail_txq_alloc:\n+\tsfc_ev_qfini(sa, evq_index);\n+\n+fail_ev_qinit:\n+\ttxq_info->entries = 0;\n+\n+fail_bad_conf:\n+\tsfc_log_init(sa, \"failed (TxQ = %u, rc = %d)\", sw_index, rc);\n+\treturn rc;\n+}\n+\n+void\n+sfc_tx_qfini(struct sfc_adapter *sa, unsigned int sw_index)\n+{\n+\tstruct sfc_txq_info *txq_info;\n+\tstruct sfc_txq *txq;\n+\n+\tsfc_log_init(sa, \"TxQ = %u\", sw_index);\n+\n+\tSFC_ASSERT(sw_index < sa->txq_count);\n+\ttxq_info = &sa->txq_info[sw_index];\n+\n+\ttxq = txq_info->txq;\n+\tSFC_ASSERT(txq != NULL);\n+\tSFC_ASSERT(txq->state == SFC_TXQ_INITIALIZED);\n+\n+\ttxq_info->txq = NULL;\n+\ttxq_info->entries = 0;\n+\n+\trte_free(txq->sw_ring);\n+\trte_free(txq->pend_desc);\n+\tsfc_dma_free(sa, &txq->mem);\n+\trte_free(txq);\n+}\n+\n+static int\n sfc_tx_qinit_info(struct sfc_adapter *sa, unsigned int sw_index)\n {\n \tstruct sfc_txq_info *txq_info = &sa->txq_info[sw_index];\n@@ -121,6 +280,14 @@ sfc_tx_init(struct sfc_adapter *sa)\n void\n sfc_tx_fini(struct sfc_adapter *sa)\n {\n+\tint sw_index;\n+\n+\tsw_index = sa->txq_count;\n+\twhile (--sw_index >= 0) {\n+\t\tif (sa->txq_info[sw_index].txq != NULL)\n+\t\t\tsfc_tx_qfini(sa, sw_index);\n+\t}\n+\n \trte_free(sa->txq_info);\n \tsa->txq_info = NULL;\n \tsa->txq_count = 0;\ndiff --git a/drivers/net/sfc/efx/sfc_tx.h b/drivers/net/sfc/efx/sfc_tx.h\nindex b2d4875..3278797 100644\n--- a/drivers/net/sfc/efx/sfc_tx.h\n+++ b/drivers/net/sfc/efx/sfc_tx.h\n@@ -40,13 +40,49 @@ extern \"C\" {\n #endif\n \n struct sfc_adapter;\n+struct sfc_evq;\n+\n+struct sfc_tx_sw_desc {\n+\tstruct rte_mbuf\t\t*mbuf;\n+};\n+\n+enum sfc_txq_state_bit {\n+\tSFC_TXQ_INITIALIZED_BIT = 0,\n+#define\tSFC_TXQ_INITIALIZED\t(1 << SFC_TXQ_INITIALIZED_BIT)\n+};\n+\n+struct sfc_txq {\n+\tstruct sfc_evq\t\t*evq;\n+\tstruct sfc_tx_sw_desc\t*sw_ring;\n+\tunsigned int\t\tstate;\n+\tunsigned int\t\tptr_mask;\n+\tefx_desc_t\t\t*pend_desc;\n+\tefx_txq_t\t\t*common;\n+\tefsys_mem_t\t\tmem;\n+\n+\tunsigned int\t\thw_index;\n+\tunsigned int\t\tflags;\n+};\n+\n+static inline unsigned int\n+sfc_txq_sw_index(const struct sfc_txq *txq)\n+{\n+\treturn txq->hw_index;\n+}\n \n struct sfc_txq_info {\n+\tunsigned int\t\tentries;\n+\tstruct sfc_txq\t\t*txq;\n };\n \n int sfc_tx_init(struct sfc_adapter *sa);\n void sfc_tx_fini(struct sfc_adapter *sa);\n \n+int sfc_tx_qinit(struct sfc_adapter *sa, unsigned int sw_index,\n+\t\t uint16_t nb_tx_desc, unsigned int socket_id,\n+\t\t const struct rte_eth_txconf *tx_conf);\n+void sfc_tx_qfini(struct sfc_adapter *sa, unsigned int sw_index);\n+\n #ifdef __cplusplus\n }\n #endif\n",
    "prefixes": [
        "dpdk-dev",
        "54/56"
    ]
}