get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 12567,
    "url": "https://patches.dpdk.org/api/patches/12567/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1462562780-47991-17-git-send-email-stephen.hurd@broadcom.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<1462562780-47991-17-git-send-email-stephen.hurd@broadcom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1462562780-47991-17-git-send-email-stephen.hurd@broadcom.com",
    "date": "2016-05-06T19:25:57",
    "name": "[dpdk-dev,17/40] bnxt: add HWRM vnic alloc function",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "c84c1269e4650572ec6a3a2e1966d54c74fac816",
    "submitter": {
        "id": 438,
        "url": "https://patches.dpdk.org/api/people/438/?format=api",
        "name": "Stephen Hurd",
        "email": "stephen.hurd@broadcom.com"
    },
    "delegate": {
        "id": 10,
        "url": "https://patches.dpdk.org/api/users/10/?format=api",
        "username": "bruce",
        "first_name": "Bruce",
        "last_name": "Richardson",
        "email": "bruce.richardson@intel.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1462562780-47991-17-git-send-email-stephen.hurd@broadcom.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/12567/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/12567/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 43C525AB7;\n\tFri,  6 May 2016 21:27:10 +0200 (CEST)",
            "from mail-gw3-out.broadcom.com (mail-gw3-out.broadcom.com\n\t[216.31.210.64]) by dpdk.org (Postfix) with ESMTP id D94075A0A\n\tfor <dev@dpdk.org>; Fri,  6 May 2016 21:26:54 +0200 (CEST)",
            "from mail-irv-18.broadcom.com ([10.15.198.37])\n\tby mail-gw3-out.broadcom.com with ESMTP; 06 May 2016 12:41:11 -0700",
            "from mail-irva-12.broadcom.com (mail-irva-12.broadcom.com\n\t[10.11.16.101])\n\tby mail-irv-18.broadcom.com (Postfix) with ESMTP id A818782022\n\tfor <dev@dpdk.org>; Fri,  6 May 2016 12:26:53 -0700 (PDT)",
            "from DPDK-C1.broadcom.com (dhcp-10-13-115-104.irv.broadcom.com\n\t[10.13.115.104])\n\tby mail-irva-12.broadcom.com (Postfix) with ESMTP id F1BB8127635\n\tfor <dev@dpdk.org>; Fri,  6 May 2016 12:26:49 -0700 (PDT)"
        ],
        "X-IronPort-AV": "E=Sophos;i=\"5.24,587,1455004800\"; d=\"scan'208\";a=\"94346002\"",
        "From": "Stephen Hurd <stephen.hurd@broadcom.com>",
        "To": "dev@dpdk.org",
        "Date": "Fri,  6 May 2016 12:25:57 -0700",
        "Message-Id": "<1462562780-47991-17-git-send-email-stephen.hurd@broadcom.com>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1462562780-47991-1-git-send-email-stephen.hurd@broadcom.com>",
        "References": "<20160421100005.GA976@bricha3-MOBL3>\n\t<1462562780-47991-1-git-send-email-stephen.hurd@broadcom.com>",
        "Subject": "[dpdk-dev] [PATCH 17/40] bnxt: add HWRM vnic alloc function",
        "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": "This requires a group info array in struct bnxt, so add that, save\nthe max size from the func_qcap response, and alloc/free in init/uninit\n\nSigned-off-by: Stephen Hurd <stephen.hurd@broadcom.com>\nReviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>\n---\n drivers/net/bnxt/bnxt.h                |  2 +\n drivers/net/bnxt/bnxt_hwrm.c           | 33 ++++++++++++\n drivers/net/bnxt/bnxt_hwrm.h           |  2 +\n drivers/net/bnxt/hsi_struct_def_dpdk.h | 99 ++++++++++++++++++++++++++++++++++\n 4 files changed, 136 insertions(+)",
    "diff": "diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h\nindex 96f162e..d258e2b 100644\n--- a/drivers/net/bnxt/bnxt.h\n+++ b/drivers/net/bnxt/bnxt.h\n@@ -140,6 +140,8 @@ struct bnxt {\n \t/* Default completion ring */\n \tstruct bnxt_cp_ring_info\t*def_cp_ring;\n \n+\tuint32_t\t\tmax_ring_grps;\n+\tstruct bnxt_ring_grp_info\t*grp_info;\n \tunsigned\t\tnr_vnics;\n \n \tstruct bnxt_vnic_info\t*vnic_info;\ndiff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c\nindex 922c92a..ecd4718 100644\n--- a/drivers/net/bnxt/bnxt_hwrm.c\n+++ b/drivers/net/bnxt/bnxt_hwrm.c\n@@ -43,7 +43,9 @@\n #include \"bnxt_filter.h\"\n #include \"bnxt_hwrm.h\"\n #include \"bnxt_rxq.h\"\n+#include \"bnxt_ring.h\"\n #include \"bnxt_txq.h\"\n+#include \"bnxt_vnic.h\"\n #include \"hsi_struct_def_dpdk.h\"\n \n #define HWRM_CMD_TIMEOUT\t\t2000\n@@ -191,6 +193,7 @@ int bnxt_hwrm_func_qcaps(struct bnxt *bp)\n \n \tHWRM_CHECK_RESULT;\n \n+\tbp->max_ring_grps = rte_le_to_cpu_32(resp->max_hw_ring_grps);\n \tif (BNXT_PF(bp)) {\n \t\tstruct bnxt_pf_info *pf = &bp->pf;\n \n@@ -477,6 +480,36 @@ int bnxt_hwrm_stat_clear(struct bnxt *bp, struct bnxt_cp_ring_info *cpr)\n \treturn rc;\n }\n \n+int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic)\n+{\n+\tint rc = 0, i, j;\n+\tstruct hwrm_vnic_alloc_input req = {.req_type = 0 };\n+\tstruct hwrm_vnic_alloc_output *resp = bp->hwrm_cmd_resp_addr;\n+\n+\t/* map ring groups to this vnic */\n+\tfor (i = vnic->start_grp_id, j = 0; i <= vnic->end_grp_id; i++, j++) {\n+\t\tif (bp->grp_info[i].fw_grp_id == (uint16_t)HWRM_NA_SIGNATURE) {\n+\t\t\tRTE_LOG(ERR, PMD,\n+\t\t\t\t\"Not enough ring groups avail:%x req:%x\\n\", j,\n+\t\t\t\t(vnic->end_grp_id - vnic->start_grp_id) + 1);\n+\t\t\tbreak;\n+\t\t}\n+\t\tvnic->fw_grp_ids[j] = bp->grp_info[i].fw_grp_id;\n+\t}\n+\n+\tvnic->fw_rss_cos_lb_ctx = (uint16_t)HWRM_NA_SIGNATURE;\n+\tvnic->ctx_is_rss_cos_lb = HW_CONTEXT_NONE;\n+\n+\tHWRM_PREP(req, VNIC_ALLOC, -1, resp);\n+\n+\trc = bnxt_hwrm_send_message(bp, &req, sizeof(req));\n+\n+\tHWRM_CHECK_RESULT;\n+\n+\tvnic->fw_vnic_id = rte_le_to_cpu_16(resp->vnic_id);\n+\treturn rc;\n+}\n+\n /*\n  * HWRM utility functions\n  */\ndiff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h\nindex 4fa94aa..62dc801 100644\n--- a/drivers/net/bnxt/bnxt_hwrm.h\n+++ b/drivers/net/bnxt/bnxt_hwrm.h\n@@ -59,6 +59,8 @@ int bnxt_hwrm_stat_clear(struct bnxt *bp, struct bnxt_cp_ring_info *cpr);\n \n int bnxt_hwrm_ver_get(struct bnxt *bp);\n \n+int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic);\n+\n int bnxt_clear_all_hwrm_stat_ctxs(struct bnxt *bp);\n void bnxt_free_hwrm_resources(struct bnxt *bp);\n int bnxt_alloc_hwrm_resources(struct bnxt *bp);\ndiff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h b/drivers/net/bnxt/hsi_struct_def_dpdk.h\nindex 9c82d13..ba0e054 100644\n--- a/drivers/net/bnxt/hsi_struct_def_dpdk.h\n+++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h\n@@ -89,6 +89,7 @@ typedef struct ctx_hw_stats64 {\n #define HWRM_FUNC_DRV_RGTR\t\t(UINT32_C(0x1d))\n #define HWRM_PORT_PHY_CFG\t\t(UINT32_C(0x20))\n #define HWRM_QUEUE_QPORTCFG\t\t(UINT32_C(0x30))\n+#define HWRM_VNIC_ALLOC\t\t\t(UINT32_C(0x40))\n #define HWRM_CFA_L2_FILTER_ALLOC\t(UINT32_C(0x90))\n #define HWRM_CFA_L2_FILTER_FREE\t\t(UINT32_C(0x91))\n #define HWRM_CFA_L2_FILTER_CFG\t\t(UINT32_C(0x92))\n@@ -3168,6 +3169,104 @@ struct hwrm_stat_ctx_clr_stats_output {\n \tuint8_t valid;\n } __attribute__((packed));\n \n+/* hwrm_vnic_alloc */\n+/*\n+ * Description: This VNIC is a resource in the RX side of the chip that is used\n+ * to represent a virtual host \"interface\". # At the time of VNIC allocation or\n+ * configuration, the function can specify whether it wants the requested VNIC\n+ * to be the default VNIC for the function or not. # If a function requests\n+ * allocation of a VNIC for the first time and a VNIC is successfully allocated\n+ * by the HWRM, then the HWRM shall make the allocated VNIC as the default VNIC\n+ * for that function. # The default VNIC shall be used for the default action\n+ * for a partition or function. # For each VNIC allocated on a function, a\n+ * mapping on the RX side to map the allocated VNIC to source virtual interface\n+ * shall be performed by the HWRM. This should be hidden to the function driver\n+ * requesting the VNIC allocation. This enables broadcast/multicast replication\n+ * with source knockout. # If multicast replication with source knockout is\n+ * enabled, then the internal VNIC to SVIF mapping data structures shall be\n+ * programmed at the time of VNIC allocation.\n+ */\n+\n+/* Input (24 bytes) */\n+struct hwrm_vnic_alloc_input {\n+\t/*\n+\t * This value indicates what type of request this is. The format for the\n+\t * rest of the command is determined by this field.\n+\t */\n+\tuint16_t req_type;\n+\n+\t/*\n+\t * This value indicates the what completion ring the request will be\n+\t * optionally completed on. If the value is -1, then no CR completion\n+\t * will be generated. Any other value must be a valid CR ring_id value\n+\t * for this function.\n+\t */\n+\tuint16_t cmpl_ring;\n+\n+\t/* This value indicates the command sequence number. */\n+\tuint16_t seq_id;\n+\n+\t/*\n+\t * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids\n+\t * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM\n+\t */\n+\tuint16_t target_id;\n+\n+\t/*\n+\t * This is the host address where the response will be written when the\n+\t * request is complete. This area must be 16B aligned and must be\n+\t * cleared to zero before the request is made.\n+\t */\n+\tuint64_t resp_addr;\n+\n+\t/*\n+\t * When this bit is '1', this VNIC is requested to be the default VNIC\n+\t * for this function.\n+\t */\n+\t#define HWRM_VNIC_ALLOC_INPUT_FLAGS_DEFAULT                UINT32_C(0x1)\n+\tuint32_t flags;\n+\n+\tuint32_t unused_0;\n+} __attribute__((packed));\n+\n+/* Output (16 bytes) */\n+struct hwrm_vnic_alloc_output {\n+\t/*\n+\t * Pass/Fail or error type Note: receiver to verify the in parameters,\n+\t * and fail the call with an error when appropriate\n+\t */\n+\tuint16_t error_code;\n+\n+\t/* This field returns the type of original request. */\n+\tuint16_t req_type;\n+\n+\t/* This field provides original sequence number of the command. */\n+\tuint16_t seq_id;\n+\n+\t/*\n+\t * This field is the length of the response in bytes. The last byte of\n+\t * the response is a valid flag that will read as '1' when the command\n+\t * has been completely written to memory.\n+\t */\n+\tuint16_t resp_len;\n+\n+\t/* Logical vnic ID */\n+\tuint32_t vnic_id;\n+\n+\tuint8_t unused_0;\n+\tuint8_t unused_1;\n+\tuint8_t unused_2;\n+\n+\t/*\n+\t * This field is used in Output records to indicate that the output is\n+\t * completely written to RAM. This field should be read as '1' to\n+\t * indicate that the output has been completely written. When writing a\n+\t * command completion or response to an internal processor, the order of\n+\t * writes has to be such that this field is written last.\n+\t */\n+\tuint8_t valid;\n+} __attribute__((packed));\n+\n /* hwrm_vnic_rss_cfg */\n /* Description: This function is used to enable RSS configuration. */\n \n",
    "prefixes": [
        "dpdk-dev",
        "17/40"
    ]
}