get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 54281,
    "url": "http://patches.dpdk.org/api/patches/54281/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190604054248.68510-6-leyi.rong@intel.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": "<20190604054248.68510-6-leyi.rong@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190604054248.68510-6-leyi.rong@intel.com",
    "date": "2019-06-04T05:42:04",
    "name": "[05/49] net/ice/base: add funcs to create new switch recipe",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "7cca2af6f191b7826d3a569e520445969f5ec914",
    "submitter": {
        "id": 1204,
        "url": "http://patches.dpdk.org/api/people/1204/?format=api",
        "name": "Leyi Rong",
        "email": "leyi.rong@intel.com"
    },
    "delegate": {
        "id": 1540,
        "url": "http://patches.dpdk.org/api/users/1540/?format=api",
        "username": "qzhan15",
        "first_name": "Qi",
        "last_name": "Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190604054248.68510-6-leyi.rong@intel.com/mbox/",
    "series": [
        {
            "id": 4879,
            "url": "http://patches.dpdk.org/api/series/4879/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4879",
            "date": "2019-06-04T05:41:59",
            "name": "shared code update",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/4879/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/54281/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/54281/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 1E0BF1B9DA;\n\tTue,  4 Jun 2019 07:44:05 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id EB43E1B9B2\n\tfor <dev@dpdk.org>; Tue,  4 Jun 2019 07:43:57 +0200 (CEST)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t03 Jun 2019 22:43:57 -0700",
            "from lrong-srv-03.sh.intel.com ([10.67.119.177])\n\tby fmsmga008.fm.intel.com with ESMTP; 03 Jun 2019 22:43:56 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Leyi Rong <leyi.rong@intel.com>",
        "To": "qi.z.zhang@intel.com",
        "Cc": "dev@dpdk.org, Leyi Rong <leyi.rong@intel.com>,\n\tGrishma Kotecha <grishma.kotecha@intel.com>,\n\tPaul M Stillwell Jr <paul.m.stillwell.jr@intel.com>",
        "Date": "Tue,  4 Jun 2019 13:42:04 +0800",
        "Message-Id": "<20190604054248.68510-6-leyi.rong@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20190604054248.68510-1-leyi.rong@intel.com>",
        "References": "<20190604054248.68510-1-leyi.rong@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 05/49] net/ice/base: add funcs to create new\n\tswitch recipe",
        "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": "Add functions to support following admin queue commands:\n1. 0x0208: allocate resource to hold a switch recipe. This is needed\nwhen a new switch recipe needs to be created.\n2. 0x0290: create a recipe with protocol header information and\nother details that determine how this recipe filter work.\n3. 0x0292: get details of an existing recipe.\n4. 0x0291: associate a switch recipe to a profile.\n\nSigned-off-by: Grishma Kotecha <grishma.kotecha@intel.com>\nSigned-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>\nSigned-off-by: Leyi Rong <leyi.rong@intel.com>\n---\n drivers/net/ice/base/ice_switch.c | 132 ++++++++++++++++++++++++++++++\n drivers/net/ice/base/ice_switch.h |  12 +++\n 2 files changed, 144 insertions(+)",
    "diff": "diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c\nindex a1c29d606..b84a07459 100644\n--- a/drivers/net/ice/base/ice_switch.c\n+++ b/drivers/net/ice/base/ice_switch.c\n@@ -914,6 +914,138 @@ ice_aq_sw_rules(struct ice_hw *hw, void *rule_list, u16 rule_list_sz,\n \treturn ice_aq_send_cmd(hw, &desc, rule_list, rule_list_sz, cd);\n }\n \n+/**\n+ * ice_aq_add_recipe - add switch recipe\n+ * @hw: pointer to the HW struct\n+ * @s_recipe_list: pointer to switch rule population list\n+ * @num_recipes: number of switch recipes in the list\n+ * @cd: pointer to command details structure or NULL\n+ *\n+ * Add(0x0290)\n+ */\n+enum ice_status\n+ice_aq_add_recipe(struct ice_hw *hw,\n+\t\t  struct ice_aqc_recipe_data_elem *s_recipe_list,\n+\t\t  u16 num_recipes, struct ice_sq_cd *cd)\n+{\n+\tstruct ice_aqc_add_get_recipe *cmd;\n+\tstruct ice_aq_desc desc;\n+\tu16 buf_size;\n+\n+\tice_debug(hw, ICE_DBG_TRACE, \"ice_aq_add_recipe\");\n+\tcmd = &desc.params.add_get_recipe;\n+\tice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_add_recipe);\n+\n+\tcmd->num_sub_recipes = CPU_TO_LE16(num_recipes);\n+\tdesc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD);\n+\n+\tbuf_size = num_recipes * sizeof(*s_recipe_list);\n+\n+\treturn ice_aq_send_cmd(hw, &desc, s_recipe_list, buf_size, cd);\n+}\n+\n+/**\n+ * ice_aq_get_recipe - get switch recipe\n+ * @hw: pointer to the HW struct\n+ * @s_recipe_list: pointer to switch rule population list\n+ * @num_recipes: pointer to the number of recipes (input and output)\n+ * @recipe_root: root recipe number of recipe(s) to retrieve\n+ * @cd: pointer to command details structure or NULL\n+ *\n+ * Get(0x0292)\n+ *\n+ * On input, *num_recipes should equal the number of entries in s_recipe_list.\n+ * On output, *num_recipes will equal the number of entries returned in\n+ * s_recipe_list.\n+ *\n+ * The caller must supply enough space in s_recipe_list to hold all possible\n+ * recipes and *num_recipes must equal ICE_MAX_NUM_RECIPES.\n+ */\n+enum ice_status\n+ice_aq_get_recipe(struct ice_hw *hw,\n+\t\t  struct ice_aqc_recipe_data_elem *s_recipe_list,\n+\t\t  u16 *num_recipes, u16 recipe_root, struct ice_sq_cd *cd)\n+{\n+\tstruct ice_aqc_add_get_recipe *cmd;\n+\tstruct ice_aq_desc desc;\n+\tenum ice_status status;\n+\tu16 buf_size;\n+\n+\tif (*num_recipes != ICE_MAX_NUM_RECIPES)\n+\t\treturn ICE_ERR_PARAM;\n+\n+\tice_debug(hw, ICE_DBG_TRACE, \"ice_aq_get_recipe\");\n+\tcmd = &desc.params.add_get_recipe;\n+\tice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_recipe);\n+\n+\tcmd->return_index = CPU_TO_LE16(recipe_root);\n+\tcmd->num_sub_recipes = 0;\n+\n+\tbuf_size = *num_recipes * sizeof(*s_recipe_list);\n+\n+\tstatus = ice_aq_send_cmd(hw, &desc, s_recipe_list, buf_size, cd);\n+\t/* cppcheck-suppress constArgument */\n+\t*num_recipes = LE16_TO_CPU(cmd->num_sub_recipes);\n+\n+\treturn status;\n+}\n+\n+/**\n+ * ice_aq_map_recipe_to_profile - Map recipe to packet profile\n+ * @hw: pointer to the HW struct\n+ * @profile_id: package profile ID to associate the recipe with\n+ * @r_bitmap: Recipe bitmap filled in and need to be returned as response\n+ * @cd: pointer to command details structure or NULL\n+ * Recipe to profile association (0x0291)\n+ */\n+enum ice_status\n+ice_aq_map_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u8 *r_bitmap,\n+\t\t\t     struct ice_sq_cd *cd)\n+{\n+\tstruct ice_aqc_recipe_to_profile *cmd;\n+\tstruct ice_aq_desc desc;\n+\n+\tice_debug(hw, ICE_DBG_TRACE, \"ice_aq_assoc_recipe_to_prof\");\n+\tcmd = &desc.params.recipe_to_profile;\n+\tice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_recipe_to_profile);\n+\tcmd->profile_id = CPU_TO_LE16(profile_id);\n+\t/* Set the recipe ID bit in the bitmask to let the device know which\n+\t * profile we are associating the recipe to\n+\t */\n+\tice_memcpy(cmd->recipe_assoc, r_bitmap, sizeof(cmd->recipe_assoc),\n+\t\t   ICE_NONDMA_TO_NONDMA);\n+\n+\treturn ice_aq_send_cmd(hw, &desc, NULL, 0, cd);\n+}\n+\n+/**\n+ * ice_alloc_recipe - add recipe resource\n+ * @hw: pointer to the hardware structure\n+ * @rid: recipe ID returned as response to AQ call\n+ */\n+enum ice_status ice_alloc_recipe(struct ice_hw *hw, u16 *rid)\n+{\n+\tstruct ice_aqc_alloc_free_res_elem *sw_buf;\n+\tenum ice_status status;\n+\tu16 buf_len;\n+\n+\tbuf_len = sizeof(*sw_buf);\n+\tsw_buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc(hw, buf_len);\n+\tif (!sw_buf)\n+\t\treturn ICE_ERR_NO_MEMORY;\n+\n+\tsw_buf->num_elems = CPU_TO_LE16(1);\n+\tsw_buf->res_type = CPU_TO_LE16((ICE_AQC_RES_TYPE_RECIPE <<\n+\t\t\t\t\tICE_AQC_RES_TYPE_S) |\n+\t\t\t\t\tICE_AQC_RES_TYPE_FLAG_SHARED);\n+\tstatus = ice_aq_alloc_free_res(hw, 1, sw_buf, buf_len,\n+\t\t\t\t       ice_aqc_opc_alloc_res, NULL);\n+\tif (!status)\n+\t\t*rid = LE16_TO_CPU(sw_buf->elem[0].e.sw_resp);\n+\tice_free(hw, sw_buf);\n+\n+\treturn status;\n+}\n \n /* ice_init_port_info - Initialize port_info with switch configuration data\n  * @pi: pointer to port_info\ndiff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h\nindex 13525d8d0..fd61c0eea 100644\n--- a/drivers/net/ice/base/ice_switch.h\n+++ b/drivers/net/ice/base/ice_switch.h\n@@ -408,8 +408,20 @@ enum ice_status\n ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,\n \t\t\t u16 *vid);\n \n+enum ice_status\n+ice_aq_add_recipe(struct ice_hw *hw,\n+\t\t  struct ice_aqc_recipe_data_elem *s_recipe_list,\n+\t\t  u16 num_recipes, struct ice_sq_cd *cd);\n \n+enum ice_status\n+ice_aq_get_recipe(struct ice_hw *hw,\n+\t\t  struct ice_aqc_recipe_data_elem *s_recipe_list,\n+\t\t  u16 *num_recipes, u16 recipe_root, struct ice_sq_cd *cd);\n+enum ice_status\n+ice_aq_map_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u8 *r_bitmap,\n+\t\t\t     struct ice_sq_cd *cd);\n \n+enum ice_status ice_alloc_recipe(struct ice_hw *hw, u16 *recipe_id);\n enum ice_status ice_replay_all_fltr(struct ice_hw *hw);\n \n enum ice_status ice_init_def_sw_recp(struct ice_hw *hw);\n",
    "prefixes": [
        "05/49"
    ]
}