get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 24792,
    "url": "http://patches.dpdk.org/api/patches/24792/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1495901077-11845-1-git-send-email-andrey.chilikin@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": "<1495901077-11845-1-git-send-email-andrey.chilikin@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1495901077-11845-1-git-send-email-andrey.chilikin@intel.com",
    "date": "2017-05-27T16:04:37",
    "name": "[dpdk-dev] net/i40e: extended list of operations for ddp processing",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "a20c19eadc4d90641c781ab65c9f8d6863362e42",
    "submitter": {
        "id": 94,
        "url": "http://patches.dpdk.org/api/people/94/?format=api",
        "name": "Chilikin, Andrey",
        "email": "andrey.chilikin@intel.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/1495901077-11845-1-git-send-email-andrey.chilikin@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/24792/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/24792/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 ACED32BA3;\n\tSat, 27 May 2017 18:04:44 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id BFBEA2BA2\n\tfor <dev@dpdk.org>; Sat, 27 May 2017 18:04:42 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t27 May 2017 09:04:41 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga001.jf.intel.com with ESMTP; 27 May 2017 09:04:39 -0700",
            "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tv4RG4drg024116; Sat, 27 May 2017 17:04:39 +0100",
            "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id v4RG4d1T011889;\n\tSat, 27 May 2017 17:04:39 +0100",
            "(from achiliki@localhost)\n\tby sivswdev01.ir.intel.com with ? id v4RG4dVU011885;\n\tSat, 27 May 2017 17:04:39 +0100"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos; i=\"5.38,403,1491289200\"; d=\"scan'208\";\n\ta=\"1135408786\"",
        "From": "Andrey Chilikin <andrey.chilikin@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "beilei.xing@intel.com, jingjing.wu@intel.com,\n\tAndrey Chilikin <andrey.chilikin@intel.com>",
        "Date": "Sat, 27 May 2017 17:04:37 +0100",
        "Message-Id": "<1495901077-11845-1-git-send-email-andrey.chilikin@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "Subject": "[dpdk-dev] [PATCH] net/i40e: extended list of operations for ddp\n\tprocessing",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <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 patch adds ability to remove already loaded profile\nor write profile without registering it\n\nSigned-off-by: Andrey Chilikin <andrey.chilikin@intel.com>\n---\n drivers/net/i40e/rte_pmd_i40e.c |  165 ++++++++++++++++++++++++++++++++-------\n drivers/net/i40e/rte_pmd_i40e.h |    6 +-\n 2 files changed, 141 insertions(+), 30 deletions(-)",
    "diff": "diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c\nindex f7ce62b..5ebd7cf 100644\n--- a/drivers/net/i40e/rte_pmd_i40e.c\n+++ b/drivers/net/i40e/rte_pmd_i40e.c\n@@ -1523,6 +1523,9 @@ int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,\n #define I40E_PROFILE_INFO_SIZE 48\n #define I40E_MAX_PROFILE_NUM 16\n \n+#define I40E_DDP_TRACKID_INVALID 0xFFFFFFFF\n+#define SECTION_TYPE_RB_MMIO 0x00001800\n+\n /* Check if the profile info exists */\n static int\n i40e_check_profile_info(uint8_t port, uint8_t *profile_info_sec)\n@@ -1557,11 +1560,7 @@ int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,\n \t\t\t     sizeof(struct i40e_profile_section_header));\n \tfor (i = 0; i < p_list->p_count; i++) {\n \t\tp = &p_list->p_info[i];\n-\t\tif ((pinfo->track_id == p->track_id) &&\n-\t\t    !memcmp(&pinfo->version, &p->version,\n-\t\t\t    sizeof(struct i40e_ddp_version)) &&\n-\t\t    !memcmp(&pinfo->name, &p->name,\n-\t\t\t    I40E_DDP_NAME_SIZE)) {\n+\t\tif (pinfo->track_id == p->track_id) {\n \t\t\tPMD_DRV_LOG(INFO, \"Profile exists.\");\n \t\t\trte_free(buff);\n \t\t\treturn 1;\n@@ -1572,6 +1571,88 @@ int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,\n \treturn 0;\n }\n \n+/**\n+ * i40e_rollback_profile\n+ * @hw: pointer to the hardware structure\n+ * @profile: pointer to the profile segment of the package to be removed\n+ * @track_id: package tracking id\n+ *\n+ * Rolls back previously loaded package.\n+ */\n+static enum i40e_status_code\n+i40e_rollback_profile(struct i40e_hw *hw, struct i40e_profile_segment *profile,\n+\t\t   u32 track_id)\n+{\n+\tenum i40e_status_code status = I40E_SUCCESS;\n+\tstruct i40e_section_table *sec_tbl;\n+\tstruct i40e_profile_section_header *sec = NULL;\n+\tu32 dev_cnt;\n+\tu32 vendor_dev_id;\n+\tu32 *nvm;\n+\tu32 section_size = 0;\n+\tu32 offset = 0, info = 0;\n+\tu32 i, n;\n+\n+\tif (track_id == I40E_DDP_TRACKID_INVALID) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid track_id\");\n+\t\treturn I40E_NOT_SUPPORTED;\n+\t}\n+\n+\tdev_cnt = profile->device_table_count;\n+\n+\tfor (i = 0; i < dev_cnt; i++) {\n+\t\tvendor_dev_id = profile->device_table[i].vendor_dev_id;\n+\t\tif ((vendor_dev_id >> 16) == I40E_INTEL_VENDOR_ID)\n+\t\t\tif (hw->device_id == (vendor_dev_id & 0xFFFF))\n+\t\t\t\tbreak;\n+\t}\n+\tif (dev_cnt && (i == dev_cnt)) {\n+\t\tPMD_DRV_LOG(ERR, \"Device doesn't support DDP\");\n+\t\treturn I40E_ERR_DEVICE_NOT_SUPPORTED;\n+\t}\n+\n+\tnvm = (u32 *)&profile->device_table[dev_cnt];\n+\tsec_tbl = (struct i40e_section_table *)&nvm[nvm[0] + 1];\n+\n+\tfor (i = 0; i < sec_tbl->section_count; i++) {\n+\t\tsec = (struct i40e_profile_section_header *)((u8 *)profile +\n+\t\t\tsec_tbl->section_offset[i]);\n+\t\tif (sec->section.type == SECTION_TYPE_AQ) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Rollback not supported for AQ sections\");\n+\t\t\treturn I40E_NOT_SUPPORTED;\n+\t\t}\n+\t\tif (sec->section.type == SECTION_TYPE_MMIO) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Not a roll-back package\");\n+\t\t\treturn I40E_NOT_SUPPORTED;\n+\t\t}\n+\t}\n+\n+\tfor (i = 0; i < sec_tbl->section_count; i++) {\n+\t\t/* For rollback write sections in reverse */\n+\t\tn = sec_tbl->section_count - i - 1;\n+\t\tsec = (struct i40e_profile_section_header *)((u8 *)profile +\n+\t\t\t\t\t     sec_tbl->section_offset[n]);\n+\n+\t\t/* Skip any non-rollback sections */\n+\t\tif (sec->section.type != SECTION_TYPE_RB_MMIO)\n+\t\t\tcontinue;\n+\n+\t\tsection_size = sec->section.size +\n+\t\t\tsizeof(struct i40e_profile_section_header);\n+\n+\t\t/* Write roll-back MMIO section */\n+\t\tstatus = i40e_aq_write_ddp(hw, (void *)sec, (u16)section_size,\n+\t\t\t\t\t   track_id, &offset, &info, NULL);\n+\t\tif (status) {\n+\t\t\tPMD_DRV_LOG(ERR,\n+\t\t\t\t   \"Failed to write profile: section %d, offset %d, info %d\",\n+\t\t\t\t   n, offset, info);\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\treturn status;\n+}\n+\n int\n rte_pmd_i40e_process_ddp_package(uint8_t port, uint8_t *buff,\n \t\t\t\t uint32_t size,\n@@ -1587,6 +1668,13 @@ int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,\n \tint is_exist;\n \tenum i40e_status_code status = I40E_SUCCESS;\n \n+\tif (op != RTE_PMD_I40E_PKG_OP_WR_ADD &&\n+\t\top != RTE_PMD_I40E_PKG_OP_WR_ONLY &&\n+\t\top != RTE_PMD_I40E_PKG_OP_WR_DEL) {\n+\t\tPMD_DRV_LOG(ERR, \"Operation not supported.\");\n+\t\treturn -ENOTSUP;\n+\t}\n+\n \tRTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);\n \n \tdev = &rte_eth_devices[port];\n@@ -1623,6 +1711,10 @@ int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,\n \t\treturn -EINVAL;\n \t}\n \ttrack_id = ((struct i40e_metadata_segment *)metadata_seg_hdr)->track_id;\n+\tif (track_id == I40E_DDP_TRACKID_INVALID) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid track_id\");\n+\t\treturn -EINVAL;\n+\t}\n \n \t/* Find profile segment */\n \tprofile_seg_hdr = i40e_find_segment_in_package(SEGMENT_TYPE_I40E,\n@@ -1642,40 +1734,55 @@ int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,\n \t\treturn -EINVAL;\n \t}\n \n+\t/* Check if the profile already loaded */\n+\ti40e_generate_profile_info_sec(\n+\t\t((struct i40e_profile_segment *)profile_seg_hdr)->name,\n+\t\t&((struct i40e_profile_segment *)profile_seg_hdr)->version,\n+\t\ttrack_id, profile_info_sec,\n+\t\top == RTE_PMD_I40E_PKG_OP_WR_ADD);\n+\tis_exist = i40e_check_profile_info(port, profile_info_sec);\n+\tif (is_exist < 0) {\n+\t\tPMD_DRV_LOG(ERR, \"Failed to check profile.\");\n+\t\trte_free(profile_info_sec);\n+\t\treturn -EINVAL;\n+\t}\n+\n \tif (op == RTE_PMD_I40E_PKG_OP_WR_ADD) {\n-\t\t/* Check if the profile exists */\n-\t\ti40e_generate_profile_info_sec(\n-\t\t     ((struct i40e_profile_segment *)profile_seg_hdr)->name,\n-\t\t     &((struct i40e_profile_segment *)profile_seg_hdr)->version,\n-\t\t     track_id, profile_info_sec, 1);\n-\t\tis_exist = i40e_check_profile_info(port, profile_info_sec);\n-\t\tif (is_exist > 0) {\n+\t\tif (is_exist) {\n \t\t\tPMD_DRV_LOG(ERR, \"Profile already exists.\");\n \t\t\trte_free(profile_info_sec);\n-\t\t\treturn 1;\n-\t\t} else if (is_exist < 0) {\n-\t\t\tPMD_DRV_LOG(ERR, \"Failed to check profile.\");\n+\t\t\treturn -EEXIST;\n+\t\t}\n+\t} else if (op == RTE_PMD_I40E_PKG_OP_WR_DEL) {\n+\t\tif (!is_exist) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Profile does not exist.\");\n \t\t\trte_free(profile_info_sec);\n-\t\t\treturn -EINVAL;\n+\t\t\treturn -EACCES;\n \t\t}\n+\t}\n \n-\t\t/* Write profile to HW */\n+\tif (op == RTE_PMD_I40E_PKG_OP_WR_DEL)\n+\t\tstatus = i40e_rollback_profile(\n+\t\t\thw,\n+\t\t\t(struct i40e_profile_segment *)profile_seg_hdr,\n+\t\t\ttrack_id);\n+\telse\n \t\tstatus = i40e_write_profile(\n-\t\t\t\thw,\n-\t\t\t\t(struct i40e_profile_segment *)profile_seg_hdr,\n-\t\t\t\ttrack_id);\n-\t\tif (status) {\n-\t\t\tPMD_DRV_LOG(ERR, \"Failed to write profile.\");\n-\t\t\trte_free(profile_info_sec);\n-\t\t\treturn status;\n-\t\t}\n+\t\t\thw,\n+\t\t\t(struct i40e_profile_segment *)profile_seg_hdr,\n+\t\t\ttrack_id);\n+\n+\tif (status) {\n+\t\tPMD_DRV_LOG(ERR, \"Failed to write profile.\");\n+\t\trte_free(profile_info_sec);\n+\t\treturn status;\n+\t}\n \n-\t\t/* Add profile info to info list */\n+\tif (track_id && (op != RTE_PMD_I40E_PKG_OP_WR_ONLY)) {\n+\t\t/* Modify loaded profiles info list */\n \t\tstatus = i40e_add_rm_profile_info(hw, profile_info_sec);\n \t\tif (status)\n-\t\t\tPMD_DRV_LOG(ERR, \"Failed to add profile info.\");\n-\t} else {\n-\t\tPMD_DRV_LOG(ERR, \"Operation not supported.\");\n+\t\t\tPMD_DRV_LOG(ERR, \"Failed to modify profile info list.\");\n \t}\n \n \trte_free(profile_info_sec);\ndiff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h\nindex 1efb2c4..46287cc 100644\n--- a/drivers/net/i40e/rte_pmd_i40e.h\n+++ b/drivers/net/i40e/rte_pmd_i40e.h\n@@ -71,6 +71,8 @@ struct rte_pmd_i40e_mb_event_param {\n enum rte_pmd_i40e_package_op {\n \tRTE_PMD_I40E_PKG_OP_UNDEFINED = 0,\n \tRTE_PMD_I40E_PKG_OP_WR_ADD,   /**< load package and add to info list */\n+\tRTE_PMD_I40E_PKG_OP_WR_DEL, /** load package and delete from info list */\n+\tRTE_PMD_I40E_PKG_OP_WR_ONLY, /**< load package without modifying info list */\n \tRTE_PMD_I40E_PKG_OP_MAX = 32\n };\n \n@@ -492,7 +494,9 @@ int rte_pmd_i40e_set_vf_tc_max_bw(uint8_t port,\n  *   - (0) if successful.\n  *   - (-ENODEV) if *port* invalid.\n  *   - (-EINVAL) if bad parameter.\n- *   - (1) if profile exists.\n+ *   - (-EEXIST) if profile exists.\n+ *   - (-EACCES) if profile does not exist.\n+ *   - (-ENOTSUP) if operation not supported.\n  */\n int rte_pmd_i40e_process_ddp_package(uint8_t port, uint8_t *buff,\n \t\t\t\t     uint32_t size,\n",
    "prefixes": [
        "dpdk-dev"
    ]
}