get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 74118,
    "url": "http://patches.dpdk.org/api/patches/74118/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200715155043.12476-3-arkadiuszx.kusztal@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": "<20200715155043.12476-3-arkadiuszx.kusztal@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200715155043.12476-3-arkadiuszx.kusztal@intel.com",
    "date": "2020-07-15T15:50:40",
    "name": "[v3,2/5] app/mp_crypto: add device configuration functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "47f643d4d66f91db6e73d81479a72b665d662fe7",
    "submitter": {
        "id": 452,
        "url": "http://patches.dpdk.org/api/people/452/?format=api",
        "name": "Arkadiusz Kusztal",
        "email": "arkadiuszx.kusztal@intel.com"
    },
    "delegate": {
        "id": 6690,
        "url": "http://patches.dpdk.org/api/users/6690/?format=api",
        "username": "akhil",
        "first_name": "akhil",
        "last_name": "goyal",
        "email": "gakhil@marvell.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200715155043.12476-3-arkadiuszx.kusztal@intel.com/mbox/",
    "series": [
        {
            "id": 11057,
            "url": "http://patches.dpdk.org/api/series/11057/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11057",
            "date": "2020-07-15T15:50:38",
            "name": "app: add multi process crypto application",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/11057/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/74118/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/74118/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id C232CA0547;\n\tWed, 15 Jul 2020 17:51:06 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id DD0D41B952;\n\tWed, 15 Jul 2020 17:50:54 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by dpdk.org (Postfix) with ESMTP id 344A6199BC\n for <dev@dpdk.org>; Wed, 15 Jul 2020 17:50:53 +0200 (CEST)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 15 Jul 2020 08:50:52 -0700",
            "from akusztax-mobl.ger.corp.intel.com ([10.104.121.32])\n by fmsmga002.fm.intel.com with ESMTP; 15 Jul 2020 08:50:51 -0700"
        ],
        "IronPort-SDR": [
            "\n w9TgnLyc5P/pKC4/bUS9R+FlPi4WI5o3s1jvmlLKR7dIdXUrCfEwlwAzTgHRXYfqqxtSp/OakA\n ejtw1ozvlb+A==",
            "\n cwE9bi8Rthy8NToRzi/XI3JWosGwLw55cNbJbyECqq9XJimQKF9jsQI+oS/iAGFTdehmTymMjo\n YA4DhYlatSmg=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9683\"; a=\"167303523\"",
            "E=Sophos;i=\"5.75,355,1589266800\"; d=\"scan'208\";a=\"167303523\"",
            "E=Sophos;i=\"5.75,355,1589266800\"; d=\"scan'208\";a=\"318102537\""
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Arek Kusztal <arkadiuszx.kusztal@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "akhil.goyal@nxp.com, fiona.trahe@intel.com,\n Arek Kusztal <arkadiuszx.kusztal@intel.com>",
        "Date": "Wed, 15 Jul 2020 17:50:40 +0200",
        "Message-Id": "<20200715155043.12476-3-arkadiuszx.kusztal@intel.com>",
        "X-Mailer": "git-send-email 2.19.1.windows.1",
        "In-Reply-To": "<20200715155043.12476-1-arkadiuszx.kusztal@intel.com>",
        "References": "<20200715155043.12476-1-arkadiuszx.kusztal@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v3 2/5] app/mp_crypto: add device configuration\n\tfunctions",
        "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 <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Add functions to allow device configuration, command line\nused to configure device is described in mp_crypto.rst file.\n\nSigned-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>\n---\n app/test-mp-crypto/main.c      | 229 ++++++++++++++++++++++++++++++++++++++++-\n app/test-mp-crypto/mp_crypto.h |   6 ++\n 2 files changed, 232 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/app/test-mp-crypto/main.c b/app/test-mp-crypto/main.c\nindex ce150b5..680faf0 100644\n--- a/app/test-mp-crypto/main.c\n+++ b/app/test-mp-crypto/main.c\n@@ -29,8 +29,7 @@ static int\n mp_app_init(int argc, char *argv[])\n {\n \t/* init EAL */\n-\tint ret = rte_eal_init(argc, argv)\n-;\n+\tint ret = rte_eal_init(argc, argv);\n \tif (ret < 0)\n \t\trte_exit(-1, \"Invalid EAL arguments!\\n\");\n \n@@ -69,7 +68,8 @@ mp_app_init(int argc, char *argv[])\n \t\t\treturn -1;\n \t\t}\n \t\t/* Setup memzone for shared data */\n-\t\tmp_app_process_mz = rte_memzone_reserve(MP_APP_PROC_SHARED_NAME,\n+\t\tmp_app_process_mz = rte_memzone_reserve(\n+\t\t\t\tMP_APP_PROC_SHARED_NAME,\n \t\t\t\tsizeof(struct mp_app_process_data), 0, 0);\n \t\tif (mp_app_process_mz == NULL) {\n \t\t\tRTE_LOG(ERR, USER1,\n@@ -153,6 +153,219 @@ void mp_crypto_exit_app(void)\n \t}\n }\n \n+int\n+mp_crypto_init_devs(void)\n+{\n+\tuint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];\n+\tstruct rte_cryptodev_config conf;\n+\tstruct rte_cryptodev_info info;\n+\tint nb_devs = 0;\n+\tint i;\n+\n+\tfor (i = 0; i < RTE_CRYPTO_MAX_DEVS; i++)\n+\t\tmp_app_devs[i].id = -1;\n+\n+\tif (mp_app_driver_id == -1) {\n+\t\tMP_APP_LOG(ERR, COL_RED, \"No driver of type %s registered\",\n+\t\t\t\tmp_app_params->devtype_name);\n+\t\treturn -1;\n+\t}\n+\n+\tnb_devs = rte_cryptodev_devices_get(mp_app_params->devtype_name,\n+\t\t\t\t\tvalid_devs, RTE_CRYPTO_MAX_DEVS);\n+\n+\tif (nb_devs < 1) {\n+\t\tMP_APP_LOG(ERR, COL_RED, \"No %s devices found\",\n+\t\t\t\tmp_app_params->devtype_name);\n+\t\treturn -1;\n+\t}\n+\n+\tif (rte_eal_process_type() == RTE_PROC_PRIMARY) {\n+\t\tmp_shared_data->devices_number = nb_devs;\n+\t} else {\n+\t\tif (mp_shared_data->devices_number != nb_devs) {\n+\t\t\tMP_APP_LOG(INFO, COL_RED,\n+\t\t\t\"- Number of devices probed by primary process differs with current process config, number of devices = %d, number on primary = %d\",\n+\t\t\t\t\tnb_devs,\n+\t\t\t\t\tmp_shared_data->devices_number);\n+\t\t\treturn -1;\n+\t\t}\n+\t}\n+\n+\tfor (i = 0; i < nb_devs ; i++) {\n+\t\trte_cryptodev_info_get(valid_devs[i], &info);\n+\t\tif (info.feature_flags & RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO) {\n+\t\t\tmp_app_devs[mp_app_devs_cnt].id = valid_devs[i];\n+\t\t\tmp_app_devs[mp_app_devs_cnt].probed = 1;\n+\t\t\tmp_app_devs[mp_app_devs_cnt++].max_queue_pairs =\n+\t\t\t\t\tinfo.max_nb_queue_pairs;\n+\n+\t\t\t/* Last one is as good as first one */\n+\t\t\tmp_app_max_queues = info.max_nb_queue_pairs;\n+\t\t\tif (rte_eal_process_type() == RTE_PROC_PRIMARY) {\n+\t\t\t\tstrncpy(mp_shared_data->prim_dev_name[i].name,\n+\t\t\t\t\tinfo.device->name,\n+\t\t\t\t\tMP_APP_DEV_NAME_LEN);\n+\t\t\t} else {\n+\t\t\t\tif (strncmp(\n+\t\t\t\t\tmp_shared_data->prim_dev_name[i].name,\n+\t\t\t\t\t\tinfo.device->name,\n+\t\t\t\t\t\tMP_APP_DEV_NAME_LEN)) {\n+\t\t\t\t\tMP_APP_LOG(INFO, COL_RED,\n+\t\t\t\t\t\"Wrong device: %s, are BDF passed to primary process the same?\",\n+\t\t\t\t\t\tinfo.device->name);\n+\t\t\t\t\treturn -1;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t}\n+\t}\n+\t/* Pick one device to be used for session creation,\n+\t * only valid when all devices of the same type.\n+\t */\n+\tmp_app_device_id = mp_app_devs[0].id;\n+\tMP_APP_LOG(INFO, COL_GREEN,\n+\t\t\t\"Configure devices according to mask: 0x%\"PRIu64,\n+\t\t\tmp_app_params->dev_to_configure_mask);\n+\n+\tuint64_t dev_mask_id;\n+\tint dev_id;\n+\n+\tfor (dev_mask_id = 1, dev_id = 0; dev_id <= MP_APP_MAX_DEVS;\n+\t\t\tdev_mask_id <<= 1, dev_id++) {\n+\t\tif (dev_mask_id & mp_app_params->dev_to_configure_mask) {\n+\t\t\tif (!mp_app_devs[dev_id].probed)\n+\t\t\t\tcontinue;\n+\n+\t\t\t/* TODO check if already configured */\n+\n+\t\t\tconf.nb_queue_pairs = info.max_nb_queue_pairs;\n+\t\t\tconf.socket_id = SOCKET_ID_ANY;\n+\t\t\tconf.ff_disable = RTE_CRYPTODEV_FF_SECURITY;\n+\n+\t\t\tif (rte_cryptodev_configure(mp_app_devs[dev_id].id,\n+\t\t\t\t&conf) != 0) {\n+\t\t\t\tRTE_LOG(ERR, USER1,\n+\t\t\t\t\t\"Error when configuring device number %d\",\n+\t\t\t\t\t\tdev_id);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\n+\t\t\tmp_app_devs[dev_id].configured = 1;\n+\t\t\tMP_APP_LOG(INFO, COL_BLUE, \"- Configure Device id %d\",\n+\t\t\t\t\tmp_app_devs[dev_id].id);\n+\t\t}\n+\t}\n+\treturn 0;\n+}\n+\n+static int\n+steup_qps_main_loop(int dev_id, int qp_id)\n+{\n+\twhile (1) {\n+\t\t/* This could be is_dev_configured */\n+\t\tint ret  = rte_cryptodev_get_qp_status(\n+\t\t\tmp_app_devs[dev_id].id, qp_id);\n+\t\tif (ret == 1) {\n+\t\t\tmp_app_devs[dev_id].queue_pair_flag[\n+\t\t\t\tqp_id] = 0;\n+\t\t\tMP_APP_LOG_2(WARNING, COL_YEL,\n+\t\t\t\t\"Queue was already configured by other process, skipping\");\n+\t\t\treturn 1;\n+\t\t} else if (ret < 0) {\n+\t\t\tchar c;\n+\n+\t\t\tmp_app_devs[dev_id].queue_pair_flag[\n+\t\t\t\tqp_id] = 0;\n+\t\t\tMP_APP_LOG_2(ERR, COL_RED,\n+\t\t\t\t\"Error setting queues, was this device configured?\");\n+\t\t\tprintf(\n+\t\t\t\t\"\\n - Press 'w' to wait until other process will configure it\");\n+\t\t\tprintf(\"\\n - Press 'x' to exit\");\n+\t\t\tint __rte_unused r = scanf(\"%s\", &c);\n+\n+\t\t\tif (c == 'w') {\n+\t\t\t\tint timeout = 3;\n+\t\t\t\tint counter = 1;\n+\n+\t\t\t\twhile (timeout <= counter) {\n+\t\t\t\t\trte_delay_ms(1000);\n+\t\t\t\t\tMP_APP_LOG(INFO,\n+\t\t\t\t\tCOL_NORM,\n+\t\t\t\t\t\"Waiting for %d out of %d seconds\",\n+\t\t\t\t\tcounter++, 3);\n+\t\t\t\t}\n+\t\t\t} else if (c == 'x')\n+\t\t\t\treturn -1;\n+\t\t} else if (ret == 0)\n+\t\t\treturn 0;\n+\t}\n+\n+}\n+\n+int\n+mp_crypto_setup_qps(void)\n+{\n+\tint dev_id;\n+\tint qp_id;\n+\tint queue_count = 0;\n+\tint last_qp_on_device = mp_app_max_queues;\n+\n+\tMP_APP_LOG_2(INFO, COL_NORM, \"- Configuring queues:\");\n+\tfor (dev_id = 0; dev_id < MP_APP_MAX_DEVS; dev_id++) {\n+\t\tif (!mp_app_devs[dev_id].probed)\n+\t\t\tcontinue;\n+\t\tfor (qp_id = 0; qp_id < mp_app_max_queues; qp_id++) {\n+\t\t\tif (mp_app_devs[dev_id].queue_pair_flag[qp_id]\n+\t\t\t\t\t!= QP_TO_CONFIGURE)\n+\t\t\t\tcontinue;\n+\t\t\tstruct rte_cryptodev_qp_conf qp_conf;\n+\t\t\tint cont = steup_qps_main_loop(dev_id, qp_id);\n+\n+\t\t\t/* Queue was already set, continue */\n+\t\t\tif (cont == 1)\n+\t\t\t\tcontinue;\n+\t\t\telse if (cont == -1)\n+\t\t\t\treturn -1;\n+\t\t\tqp_conf.nb_descriptors = MP_CRYPTO_QP_DESC_NUM;\n+\t\t\tqp_conf.mp_session = NULL;\n+\t\t\tqp_conf.mp_session_private = NULL;\n+\t\t\tif (rte_cryptodev_queue_pair_setup(\n+\t\t\t\t\tmp_app_devs[dev_id].id,\n+\t\t\t\t\tqp_id, &qp_conf,\n+\t\t\t\t\trte_cryptodev_socket_id(\n+\t\t\t\t\tmp_app_devs[dev_id].id))) {\n+\t\t\t\tRTE_LOG(ERR, USER1,\n+\t\t\t\t\t\"Error when setting up queue pair %d on dev %d\",\n+\t\t\t\t\tqp_id, dev_id);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t\tMP_APP_LOG(INFO, COL_BLUE, \"Created qp %d on dev %d\",\n+\t\t\t\t\tqp_id, mp_app_devs[dev_id].id);\n+\t\t\tmp_app_devs[dev_id].queue_pair_flag[qp_id] = 1;\n+\t\t\tqueue_count++;\n+\t\t}\n+\t}\n+\n+\tfor (dev_id = 0; dev_id < MP_APP_MAX_DEVS; dev_id++) {\n+\t\tif (!mp_app_devs[dev_id].probed)\n+\t\t\tcontinue;\n+\t\tfor (qp_id = last_qp_on_device; qp_id < MP_APP_QUEUE_PAIRS_NUM;\n+\t\t\tqp_id++) {\n+\t\t\tif (mp_app_devs[dev_id].queue_pair_flag[qp_id]\n+\t\t\t\t\t== QP_TO_CONFIGURE) {\n+\t\t\t\tMP_APP_LOG(WARNING, COL_YEL,\n+\t\t\t\t\"Cannot create qp %d on dev %d, maximum allowed by this device = %d (%d queue pairs)\",\n+\t\t\t\tqp_id, mp_app_devs[dev_id].id,\n+\t\t\t\tmp_app_max_queues - 1,\n+\t\t\t\tmp_app_max_queues);\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\tMP_APP_LOG(INFO, COL_GREEN, \"- Configured %d queues.\", queue_count);\n+\treturn 0;\n+}\n+\n int main(int argc, char *argv[])\n {\n \tif (mp_app_init(argc, argv) < 0) {\n@@ -160,6 +373,16 @@ int main(int argc, char *argv[])\n \t\tgoto err;\n \t};\n \n+\tif (mp_crypto_init_devs() < 0) {\n+\t\tMP_APP_LOG_2(ERR, COL_RED, \"Devices cannot be initialized\");\n+\t\tgoto err;\n+\t};\n+\n+\tif (mp_crypto_setup_qps() < 0) {\n+\t\tMP_APP_LOG_2(ERR, COL_RED, \"Setup qps returned an error\");\n+\t\tgoto err;\n+\t};\n+\n \tmp_crypto_exit_app();\n \treturn 0;\n err:\ndiff --git a/app/test-mp-crypto/mp_crypto.h b/app/test-mp-crypto/mp_crypto.h\nindex da89501..fa6dc44 100644\n--- a/app/test-mp-crypto/mp_crypto.h\n+++ b/app/test-mp-crypto/mp_crypto.h\n@@ -168,6 +168,12 @@ int\n mp_crypto_secondary_handler(const struct rte_mp_msg *mp_msg,\n \t\t  const void *peer);\n \n+int mp_crypto_setup_qps(void);\n+/* Function to setup queues according to input string */\n+\n+int mp_crypto_init_devs(void);\n+/* Function to setup devices according to mask */\n+\n #define IV_OFFSET\t\t\t(sizeof(struct rte_crypto_op) + \\\n \t\tsizeof(struct rte_crypto_sym_op) + DEFAULT_NUM_XFORMS * \\\n \t\tsizeof(struct rte_crypto_sym_xform))\n",
    "prefixes": [
        "v3",
        "2/5"
    ]
}