get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 42000,
    "url": "http://patches.dpdk.org/api/patches/42000/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/968f776ccb53269cb825f847b017bfcc83b5a840.1530300158.git.rahul.lakkireddy@chelsio.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": "<968f776ccb53269cb825f847b017bfcc83b5a840.1530300158.git.rahul.lakkireddy@chelsio.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/968f776ccb53269cb825f847b017bfcc83b5a840.1530300158.git.rahul.lakkireddy@chelsio.com",
    "date": "2018-06-29T19:23:53",
    "name": "[3/5] net/cxgbe: query firmware for max queues available",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "ee620535d104a1b31a32120b7ffb3aad8a844751",
    "submitter": {
        "id": 241,
        "url": "http://patches.dpdk.org/api/people/241/?format=api",
        "name": "Rahul Lakkireddy",
        "email": "rahul.lakkireddy@chelsio.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/968f776ccb53269cb825f847b017bfcc83b5a840.1530300158.git.rahul.lakkireddy@chelsio.com/mbox/",
    "series": [
        {
            "id": 332,
            "url": "http://patches.dpdk.org/api/series/332/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=332",
            "date": "2018-06-29T19:23:50",
            "name": "net/cxgbe: feature updates and bug fixes",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/332/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/42000/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/42000/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 415661BACD;\n\tFri, 29 Jun 2018 21:25:34 +0200 (CEST)",
            "from stargate.chelsio.com (stargate.chelsio.com [12.32.117.8])\n\tby dpdk.org (Postfix) with ESMTP id 23E171BAB6\n\tfor <dev@dpdk.org>; Fri, 29 Jun 2018 21:25:31 +0200 (CEST)",
            "from localhost (scalar.blr.asicdesigners.com [10.193.185.94])\n\tby stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id w5TJPQmM028999; \n\tFri, 29 Jun 2018 12:25:27 -0700"
        ],
        "From": "Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>",
        "To": "dev@dpdk.org",
        "Cc": "surendra@chelsio.com, shaguna@chelsio.com, indranil@chelsio.com,\n\tnirranjan@chelsio.com",
        "Date": "Sat, 30 Jun 2018 00:53:53 +0530",
        "Message-Id": "<968f776ccb53269cb825f847b017bfcc83b5a840.1530300158.git.rahul.lakkireddy@chelsio.com>",
        "X-Mailer": "git-send-email 2.5.3",
        "In-Reply-To": [
            "<cover.1530300158.git.rahul.lakkireddy@chelsio.com>",
            "<cover.1530300158.git.rahul.lakkireddy@chelsio.com>"
        ],
        "References": [
            "<cover.1530300158.git.rahul.lakkireddy@chelsio.com>",
            "<cover.1530300158.git.rahul.lakkireddy@chelsio.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH 3/5] net/cxgbe: query firmware for max queues\n\tavailable",
        "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": "Query firmware for max Tx and Rx queues that can be allocated.\nMove the code to determine max queues to common place for both\nPF and VF.\n\nSigned-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>\n---\n drivers/net/cxgbe/base/common.h         | 10 +++++++\n drivers/net/cxgbe/base/t4_hw.c          | 40 ++++++++++++++++++++++++++\n drivers/net/cxgbe/base/t4fw_interface.h |  6 ++++\n drivers/net/cxgbe/cxgbe.h               |  1 +\n drivers/net/cxgbe/cxgbe_main.c          | 50 +++++++++++++++++++++++++++++++--\n drivers/net/cxgbe/cxgbevf_main.c        | 20 ++-----------\n 6 files changed, 106 insertions(+), 21 deletions(-)",
    "diff": "diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h\nindex e524f7931..9c4a33771 100644\n--- a/drivers/net/cxgbe/base/common.h\n+++ b/drivers/net/cxgbe/base/common.h\n@@ -207,6 +207,14 @@ struct rss_params {\n \t} u;\n };\n \n+/*\n+ * Maximum resources provisioned for a PCI PF.\n+ */\n+struct pf_resources {\n+\tunsigned int neq;      /* N egress Qs */\n+\tunsigned int niqflint; /* N ingress Qs/w free list(s) & intr */\n+};\n+\n /*\n  * Maximum resources provisioned for a PCI VF.\n  */\n@@ -230,6 +238,7 @@ struct adapter_params {\n \tstruct pci_params pci;\n \tstruct devlog_params devlog;\n \tstruct rss_params rss;\n+\tstruct pf_resources pfres;\n \tstruct vf_resources vfres;\n \tenum pcie_memwin drv_memwin;\n \n@@ -456,6 +465,7 @@ void t4_write_indirect(struct adapter *adap, unsigned int addr_reg,\n \t\t       unsigned int nregs, unsigned int start_idx);\n \n int t4_get_vpd_params(struct adapter *adapter, struct vpd_params *p);\n+int t4_get_pfres(struct adapter *adapter);\n int t4_read_flash(struct adapter *adapter, unsigned int addr,\n \t\t  unsigned int nwords, u32 *data, int byte_oriented);\n int t4_flash_cfg_addr(struct adapter *adapter);\ndiff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c\nindex 66d080476..698781509 100644\n--- a/drivers/net/cxgbe/base/t4_hw.c\n+++ b/drivers/net/cxgbe/base/t4_hw.c\n@@ -2480,6 +2480,46 @@ int t4_get_core_clock(struct adapter *adapter, struct vpd_params *p)\n \treturn 0;\n }\n \n+/**\n+ * t4_get_pfres - retrieve VF resource limits\n+ * @adapter: the adapter\n+ *\n+ * Retrieves configured resource limits and capabilities for a physical\n+ * function.  The results are stored in @adapter->pfres.\n+ */\n+int t4_get_pfres(struct adapter *adapter)\n+{\n+\tstruct pf_resources *pfres = &adapter->params.pfres;\n+\tstruct fw_pfvf_cmd cmd, rpl;\n+\tu32 word;\n+\tint v;\n+\n+\t/*\n+\t * Execute PFVF Read command to get VF resource limits; bail out early\n+\t * with error on command failure.\n+\t */\n+\tmemset(&cmd, 0, sizeof(cmd));\n+\tcmd.op_to_vfn = cpu_to_be32(V_FW_CMD_OP(FW_PFVF_CMD) |\n+\t\t\t\t    F_FW_CMD_REQUEST |\n+\t\t\t\t    F_FW_CMD_READ |\n+\t\t\t\t    V_FW_PFVF_CMD_PFN(adapter->pf) |\n+\t\t\t\t    V_FW_PFVF_CMD_VFN(0));\n+\tcmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd));\n+\tv = t4_wr_mbox(adapter, adapter->mbox, &cmd, sizeof(cmd), &rpl);\n+\tif (v != FW_SUCCESS)\n+\t\treturn v;\n+\n+\t/*\n+\t * Extract PF resource limits and return success.\n+\t */\n+\tword = be32_to_cpu(rpl.niqflint_niq);\n+\tpfres->niqflint = G_FW_PFVF_CMD_NIQFLINT(word);\n+\n+\tword = be32_to_cpu(rpl.type_to_neq);\n+\tpfres->neq = G_FW_PFVF_CMD_NEQ(word);\n+\treturn 0;\n+}\n+\n /* serial flash and firmware constants and flash config file constants */\n enum {\n \tSF_ATTEMPTS = 10,             /* max retries for SF operations */\ndiff --git a/drivers/net/cxgbe/base/t4fw_interface.h b/drivers/net/cxgbe/base/t4fw_interface.h\nindex 842aa1263..9dc6d8123 100644\n--- a/drivers/net/cxgbe/base/t4fw_interface.h\n+++ b/drivers/net/cxgbe/base/t4fw_interface.h\n@@ -729,6 +729,12 @@ struct fw_pfvf_cmd {\n \t__be32 r4;\n };\n \n+#define S_FW_PFVF_CMD_PFN\t\t8\n+#define V_FW_PFVF_CMD_PFN(x)\t\t((x) << S_FW_PFVF_CMD_PFN)\n+\n+#define S_FW_PFVF_CMD_VFN\t\t0\n+#define V_FW_PFVF_CMD_VFN(x)\t\t((x) << S_FW_PFVF_CMD_VFN)\n+\n #define S_FW_PFVF_CMD_NIQFLINT          20\n #define M_FW_PFVF_CMD_NIQFLINT          0xfff\n #define G_FW_PFVF_CMD_NIQFLINT(x)       \\\ndiff --git a/drivers/net/cxgbe/cxgbe.h b/drivers/net/cxgbe/cxgbe.h\nindex 70f974f5a..5e6f5c98d 100644\n--- a/drivers/net/cxgbe/cxgbe.h\n+++ b/drivers/net/cxgbe/cxgbe.h\n@@ -63,5 +63,6 @@ void cxgbe_enable_rx_queues(struct port_info *pi);\n void print_port_info(struct adapter *adap);\n void print_adapter_info(struct adapter *adap);\n int cxgbe_get_devargs(struct rte_devargs *devargs, const char *key);\n+void configure_max_ethqsets(struct adapter *adapter);\n \n #endif /* _CXGBE_H_ */\ndiff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c\nindex 1d77d4621..334c3678f 100644\n--- a/drivers/net/cxgbe/cxgbe_main.c\n+++ b/drivers/net/cxgbe/cxgbe_main.c\n@@ -389,7 +389,7 @@ void cfg_queues(struct rte_eth_dev *eth_dev)\n \t\t * We default up to # of cores queues per 1G/10G port.\n \t\t */\n \t\tif (nb_ports)\n-\t\t\tq_per_port = (MAX_ETH_QSETS -\n+\t\t\tq_per_port = (s->max_ethqsets -\n \t\t\t\t     (adap->params.nports - nb_ports)) /\n \t\t\t\t     nb_ports;\n \n@@ -413,8 +413,6 @@ void cfg_queues(struct rte_eth_dev *eth_dev)\n \t\t\tqidx += pi->n_rx_qsets;\n \t\t}\n \n-\t\ts->max_ethqsets = qidx;\n-\n \t\tfor (i = 0; i < ARRAY_SIZE(s->ethrxq); i++) {\n \t\t\tstruct sge_eth_rxq *r = &s->ethrxq[i];\n \n@@ -646,6 +644,40 @@ static void configure_pcie_ext_tag(struct adapter *adapter)\n \t}\n }\n \n+/* Figure out how many Queue Sets we can support */\n+void configure_max_ethqsets(struct adapter *adapter)\n+{\n+\tunsigned int ethqsets;\n+\n+\t/*\n+\t * We need to reserve an Ingress Queue for the Asynchronous Firmware\n+\t * Event Queue.\n+\t *\n+\t * For each Queue Set, we'll need the ability to allocate two Egress\n+\t * Contexts -- one for the Ingress Queue Free List and one for the TX\n+\t * Ethernet Queue.\n+\t */\n+\tif (is_pf4(adapter)) {\n+\t\tstruct pf_resources *pfres = &adapter->params.pfres;\n+\n+\t\tethqsets = pfres->niqflint - 1;\n+\t\tif (pfres->neq < ethqsets * 2)\n+\t\t\tethqsets = pfres->neq / 2;\n+\t} else {\n+\t\tstruct vf_resources *vfres = &adapter->params.vfres;\n+\n+\t\tethqsets = vfres->niqflint - 1;\n+\t\tif (vfres->nethctrl != ethqsets)\n+\t\t\tethqsets = min(vfres->nethctrl, ethqsets);\n+\t\tif (vfres->neq < ethqsets * 2)\n+\t\t\tethqsets = vfres->neq / 2;\n+\t}\n+\n+\tif (ethqsets > MAX_ETH_QSETS)\n+\t\tethqsets = MAX_ETH_QSETS;\n+\tadapter->sge.max_ethqsets = ethqsets;\n+}\n+\n /*\n  * Tweak configuration based on system architecture, etc.  Most of these have\n  * defaults assigned to them by Firmware Configuration Files (if we're using\n@@ -928,6 +960,17 @@ static int adap_init0(struct adapter *adap)\n \t\tgoto bye;\n \t}\n \n+\t/* Now that we've successfully configured and initialized the adapter\n+\t * (or found it already initialized), we can ask the Firmware what\n+\t * resources it has provisioned for us.\n+\t */\n+\tret = t4_get_pfres(adap);\n+\tif (ret) {\n+\t\tdev_err(adap->pdev_dev,\n+\t\t\t\"Unable to retrieve resource provisioning info\\n\");\n+\t\tgoto bye;\n+\t}\n+\n \t/* Find out what ports are available to us. */\n \tv = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) |\n \t    V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_PORTVEC);\n@@ -1063,6 +1106,7 @@ static int adap_init0(struct adapter *adap)\n \tt4_init_tp_params(adap);\n \tconfigure_pcie_ext_tag(adap);\n \tconfigure_vlan_types(adap);\n+\tconfigure_max_ethqsets(adap);\n \n \tadap->params.drv_memwin = MEMWIN_NIC;\n \tadap->flags |= FW_OK;\ndiff --git a/drivers/net/cxgbe/cxgbevf_main.c b/drivers/net/cxgbe/cxgbevf_main.c\nindex 5b3fb5399..4214d0312 100644\n--- a/drivers/net/cxgbe/cxgbevf_main.c\n+++ b/drivers/net/cxgbe/cxgbevf_main.c\n@@ -20,7 +20,7 @@\n static void size_nports_qsets(struct adapter *adapter)\n {\n \tstruct vf_resources *vfres = &adapter->params.vfres;\n-\tunsigned int ethqsets, pmask_nports;\n+\tunsigned int pmask_nports;\n \n \t/*\n \t * The number of \"ports\" which we support is equal to the number of\n@@ -49,23 +49,7 @@ static void size_nports_qsets(struct adapter *adapter)\n \t\tadapter->params.nports = pmask_nports;\n \t}\n \n-\t/*\n-\t * We need to reserve an Ingress Queue for the Asynchronous Firmware\n-\t * Event Queue.\n-\t *\n-\t * For each Queue Set, we'll need the ability to allocate two Egress\n-\t * Contexts -- one for the Ingress Queue Free List and one for the TX\n-\t * Ethernet Queue.\n-\t */\n-\tethqsets = vfres->niqflint - 1;\n-\tif (vfres->nethctrl != ethqsets)\n-\t\tethqsets = min(vfres->nethctrl, ethqsets);\n-\tif (vfres->neq < ethqsets * 2)\n-\t\tethqsets = vfres->neq / 2;\n-\tif (ethqsets > MAX_ETH_QSETS)\n-\t\tethqsets = MAX_ETH_QSETS;\n-\tadapter->sge.max_ethqsets = ethqsets;\n-\n+\tconfigure_max_ethqsets(adapter);\n \tif (adapter->sge.max_ethqsets < adapter->params.nports) {\n \t\tdev_warn(adapter->pdev_dev, \"only using %d of %d available\"\n \t\t\t \" virtual interfaces (too few Queue Sets)\\n\",\n",
    "prefixes": [
        "3/5"
    ]
}