get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 22815,
    "url": "http://patches.dpdk.org/api/patches/22815/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1490819822-27267-49-git-send-email-rasesh.mody@cavium.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": "<1490819822-27267-49-git-send-email-rasesh.mody@cavium.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1490819822-27267-49-git-send-email-rasesh.mody@cavium.com",
    "date": "2017-03-29T20:36:48",
    "name": "[dpdk-dev,v5,48/62] net/qede/base: set max values for soft resources",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "dde05f1df8a3ca7b398f3d09b1aec68e56fd3544",
    "submitter": {
        "id": 569,
        "url": "http://patches.dpdk.org/api/people/569/?format=api",
        "name": "Mody, Rasesh",
        "email": "rasesh.mody@cavium.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/1490819822-27267-49-git-send-email-rasesh.mody@cavium.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/22815/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/22815/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 EB555FBE0;\n\tThu, 30 Mar 2017 00:25:02 +0200 (CEST)",
            "from mx0b-0016ce01.pphosted.com (mx0a-0016ce01.pphosted.com\n\t[67.231.148.157]) by dpdk.org (Postfix) with ESMTP id 7FEBA374C\n\tfor <dev@dpdk.org>; Wed, 29 Mar 2017 22:38:37 +0200 (CEST)",
            "from pps.filterd (m0095336.ppops.net [127.0.0.1])\n\tby mx0a-0016ce01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv2TKUjsZ002095; Wed, 29 Mar 2017 13:38:33 -0700",
            "from avcashub1.qlogic.com ([198.186.0.115])\n\tby mx0a-0016ce01.pphosted.com with ESMTP id 29en8ywyau-1\n\t(version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT);\n\tWed, 29 Mar 2017 13:38:33 -0700",
            "from avluser05.qlc.com (10.1.113.115) by avcashub1.qlogic.org\n\t(10.1.4.190) with Microsoft SMTP Server (TLS) id 14.3.235.1;\n\tWed, 29 Mar 2017 13:38:34 -0700",
            "(from rmody@localhost)\tby avluser05.qlc.com (8.14.4/8.14.4/Submit)\n\tid v2TKcXi3027507;\tWed, 29 Mar 2017 13:38:33 -0700"
        ],
        "X-Authentication-Warning": "avluser05.qlc.com: rmody set sender to\n\trasesh.mody@cavium.com using -f",
        "From": "Rasesh Mody <rasesh.mody@cavium.com>",
        "To": "<ferruh.yigit@intel.com>, <dev@dpdk.org>",
        "CC": "Rasesh Mody <rasesh.mody@cavium.com>, <Dept-EngDPDKDev@cavium.com>",
        "Date": "Wed, 29 Mar 2017 13:36:48 -0700",
        "Message-ID": "<1490819822-27267-49-git-send-email-rasesh.mody@cavium.com>",
        "X-Mailer": "git-send-email 1.7.10.3",
        "In-Reply-To": "<1490683952-24919-1-git-send-email-rasesh.mody@cavium.com>",
        "References": "<1490683952-24919-1-git-send-email-rasesh.mody@cavium.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "disclaimer": "bypass",
        "X-Proofpoint-Virus-Version": "vendor=nai engine=5800 definitions=8482\n\tsignatures=668451",
        "X-Proofpoint-Spam-Details": "rule=notspam policy=default score=0\n\tpriorityscore=1501 malwarescore=0\n\tsuspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015\n\tlowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam\n\tadjust=0\n\treason=mlx scancount=1 engine=8.0.1-1702020001\n\tdefinitions=main-1703290173",
        "Subject": "[dpdk-dev] [PATCH v5 48/62] net/qede/base: set max values for soft\n\tresources",
        "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": "Add support for the new interface with the Management FW for setting\nmax values of \"soft\" resources.\n\nSigned-off-by: Rasesh Mody <rasesh.mody@cavium.com>\n---\n drivers/net/qede/base/ecore.h     |    2 +\n drivers/net/qede/base/ecore_dev.c |  282 ++++++++++++++++++++++--------------\n drivers/net/qede/base/ecore_mcp.c |  287 +++++++++++++++++++++++++++++++------\n drivers/net/qede/base/ecore_mcp.h |  104 ++++++++++----\n 4 files changed, 498 insertions(+), 177 deletions(-)",
    "diff": "diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h\nindex 25b6c4e..7379b3f 100644\n--- a/drivers/net/qede/base/ecore.h\n+++ b/drivers/net/qede/base/ecore.h\n@@ -856,4 +856,6 @@ u16 ecore_init_qm_get_num_pqs(struct ecore_hwfn *p_hwfn);\n \n #define ECORE_LEADING_HWFN(dev)\t(&dev->hwfns[0])\n \n+const char *ecore_hw_get_resc_name(enum ecore_resources res_id);\n+\n #endif /* __ECORE_H */\ndiff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c\nindex d5a8a90..3191ee4 100644\n--- a/drivers/net/qede/base/ecore_dev.c\n+++ b/drivers/net/qede/base/ecore_dev.c\n@@ -2420,64 +2420,109 @@ static void ecore_hw_set_feat(struct ecore_hwfn *p_hwfn)\n \t\t   RESC_NUM(p_hwfn, ECORE_SB));\n }\n \n-static enum resource_id_enum\n-ecore_hw_get_mfw_res_id(enum ecore_resources res_id)\n+const char *ecore_hw_get_resc_name(enum ecore_resources res_id)\n {\n-\tenum resource_id_enum mfw_res_id = RESOURCE_NUM_INVALID;\n-\n \tswitch (res_id) {\n \tcase ECORE_SB:\n-\t\tmfw_res_id = RESOURCE_NUM_SB_E;\n-\t\tbreak;\n+\t\treturn \"SB\";\n \tcase ECORE_L2_QUEUE:\n-\t\tmfw_res_id = RESOURCE_NUM_L2_QUEUE_E;\n-\t\tbreak;\n+\t\treturn \"L2_QUEUE\";\n \tcase ECORE_VPORT:\n-\t\tmfw_res_id = RESOURCE_NUM_VPORT_E;\n-\t\tbreak;\n+\t\treturn \"VPORT\";\n \tcase ECORE_RSS_ENG:\n-\t\tmfw_res_id = RESOURCE_NUM_RSS_ENGINES_E;\n-\t\tbreak;\n+\t\treturn \"RSS_ENG\";\n \tcase ECORE_PQ:\n-\t\tmfw_res_id = RESOURCE_NUM_PQ_E;\n-\t\tbreak;\n+\t\treturn \"PQ\";\n \tcase ECORE_RL:\n-\t\tmfw_res_id = RESOURCE_NUM_RL_E;\n-\t\tbreak;\n+\t\treturn \"RL\";\n \tcase ECORE_MAC:\n+\t\treturn \"MAC\";\n \tcase ECORE_VLAN:\n-\t\t/* Each VFC resource can accommodate both a MAC and a VLAN */\n-\t\tmfw_res_id = RESOURCE_VFC_FILTER_E;\n-\t\tbreak;\n+\t\treturn \"VLAN\";\n+\tcase ECORE_RDMA_CNQ_RAM:\n+\t\treturn \"RDMA_CNQ_RAM\";\n \tcase ECORE_ILT:\n-\t\tmfw_res_id = RESOURCE_ILT_E;\n-\t\tbreak;\n+\t\treturn \"ILT\";\n \tcase ECORE_LL2_QUEUE:\n-\t\tmfw_res_id = RESOURCE_LL2_QUEUE_E;\n-\t\tbreak;\n-\tcase ECORE_RDMA_CNQ_RAM:\n+\t\treturn \"LL2_QUEUE\";\n \tcase ECORE_CMDQS_CQS:\n-\t\t/* CNQ/CMDQS are the same resource */\n-\t\tmfw_res_id = RESOURCE_CQS_E;\n-\t\tbreak;\n+\t\treturn \"CMDQS_CQS\";\n \tcase ECORE_RDMA_STATS_QUEUE:\n-\t\tmfw_res_id = RESOURCE_RDMA_STATS_QUEUE_E;\n-\t\tbreak;\n+\t\treturn \"RDMA_STATS_QUEUE\";\n \tcase ECORE_BDQ:\n-\t\tmfw_res_id = RESOURCE_BDQ_E;\n-\t\tbreak;\n+\t\treturn \"BDQ\";\n \tdefault:\n-\t\tbreak;\n+\t\treturn \"UNKNOWN_RESOURCE\";\n \t}\n+}\n \n-\treturn mfw_res_id;\n+static enum _ecore_status_t\n+__ecore_hw_set_soft_resc_size(struct ecore_hwfn *p_hwfn,\n+\t\t\t      enum ecore_resources res_id, u32 resc_max_val,\n+\t\t\t      u32 *p_mcp_resp)\n+{\n+\tenum _ecore_status_t rc;\n+\n+\trc = ecore_mcp_set_resc_max_val(p_hwfn, p_hwfn->p_main_ptt, res_id,\n+\t\t\t\t\tresc_max_val, p_mcp_resp);\n+\tif (rc != ECORE_SUCCESS) {\n+\t\tDP_NOTICE(p_hwfn, true,\n+\t\t\t  \"MFW response failure for a max value setting of resource %d [%s]\\n\",\n+\t\t\t  res_id, ecore_hw_get_resc_name(res_id));\n+\t\treturn rc;\n+\t}\n+\n+\tif (*p_mcp_resp != FW_MSG_CODE_RESOURCE_ALLOC_OK)\n+\t\tDP_INFO(p_hwfn,\n+\t\t\t\"Failed to set the max value of resource %d [%s]. mcp_resp = 0x%08x.\\n\",\n+\t\t\tres_id, ecore_hw_get_resc_name(res_id), *p_mcp_resp);\n+\n+\treturn ECORE_SUCCESS;\n+}\n+\n+static enum _ecore_status_t\n+ecore_hw_set_soft_resc_size(struct ecore_hwfn *p_hwfn)\n+{\n+\tbool b_ah = ECORE_IS_AH(p_hwfn->p_dev);\n+\tu32 resc_max_val, mcp_resp;\n+\tu8 res_id;\n+\tenum _ecore_status_t rc;\n+\n+\tfor (res_id = 0; res_id < ECORE_MAX_RESC; res_id++) {\n+\t\t/* @DPDK */\n+\t\tswitch (res_id) {\n+\t\tcase ECORE_LL2_QUEUE:\n+\t\tcase ECORE_RDMA_CNQ_RAM:\n+\t\tcase ECORE_RDMA_STATS_QUEUE:\n+\t\tcase ECORE_BDQ:\n+\t\t\tresc_max_val = 0;\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\trc = __ecore_hw_set_soft_resc_size(p_hwfn, res_id,\n+\t\t\t\t\t\t   resc_max_val, &mcp_resp);\n+\t\tif (rc != ECORE_SUCCESS)\n+\t\t\treturn rc;\n+\n+\t\t/* There's no point to continue to the next resource if the\n+\t\t * command is not supported by the MFW.\n+\t\t * We do continue if the command is supported but the resource\n+\t\t * is unknown to the MFW. Such a resource will be later\n+\t\t * configured with the default allocation values.\n+\t\t */\n+\t\tif (mcp_resp == FW_MSG_CODE_UNSUPPORTED)\n+\t\t\treturn ECORE_NOTIMPL;\n+\t}\n+\n+\treturn ECORE_SUCCESS;\n }\n \n static\n enum _ecore_status_t ecore_hw_get_dflt_resc(struct ecore_hwfn *p_hwfn,\n \t\t\t\t\t    enum ecore_resources res_id,\n-\t\t\t\t\t    u32 *p_resc_num,\n-\t\t\t\t\t    u32 *p_resc_start)\n+\t\t\t\t\t    u32 *p_resc_num, u32 *p_resc_start)\n {\n \tu8 num_funcs = p_hwfn->num_funcs_on_engine;\n \tbool b_ah = ECORE_IS_AH(p_hwfn->p_dev);\n@@ -2553,56 +2598,19 @@ enum _ecore_status_t ecore_hw_get_dflt_resc(struct ecore_hwfn *p_hwfn,\n \treturn ECORE_SUCCESS;\n }\n \n-static const char *ecore_hw_get_resc_name(enum ecore_resources res_id)\n-{\n-\tswitch (res_id) {\n-\tcase ECORE_SB:\n-\t\treturn \"SB\";\n-\tcase ECORE_L2_QUEUE:\n-\t\treturn \"L2_QUEUE\";\n-\tcase ECORE_VPORT:\n-\t\treturn \"VPORT\";\n-\tcase ECORE_RSS_ENG:\n-\t\treturn \"RSS_ENG\";\n-\tcase ECORE_PQ:\n-\t\treturn \"PQ\";\n-\tcase ECORE_RL:\n-\t\treturn \"RL\";\n-\tcase ECORE_MAC:\n-\t\treturn \"MAC\";\n-\tcase ECORE_VLAN:\n-\t\treturn \"VLAN\";\n-\tcase ECORE_RDMA_CNQ_RAM:\n-\t\treturn \"RDMA_CNQ_RAM\";\n-\tcase ECORE_ILT:\n-\t\treturn \"ILT\";\n-\tcase ECORE_LL2_QUEUE:\n-\t\treturn \"LL2_QUEUE\";\n-\tcase ECORE_CMDQS_CQS:\n-\t\treturn \"CMDQS_CQS\";\n-\tcase ECORE_RDMA_STATS_QUEUE:\n-\t\treturn \"RDMA_STATS_QUEUE\";\n-\tcase ECORE_BDQ:\n-\t\treturn \"BDQ\";\n-\tdefault:\n-\t\treturn \"UNKNOWN_RESOURCE\";\n-\t}\n-}\n-\n-static enum _ecore_status_t ecore_hw_set_resc_info(struct ecore_hwfn *p_hwfn,\n-\t\t\t\t\t\t   enum ecore_resources res_id,\n-\t\t\t\t\t\t   bool drv_resc_alloc)\n+static enum _ecore_status_t\n+__ecore_hw_set_resc_info(struct ecore_hwfn *p_hwfn, enum ecore_resources res_id,\n+\t\t\t bool drv_resc_alloc)\n {\n-\tu32 dflt_resc_num = 0, dflt_resc_start = 0, mcp_resp, mcp_param;\n-\tu32 *p_resc_num, *p_resc_start;\n-\tstruct resource_info resc_info;\n+\tu32 dflt_resc_num = 0, dflt_resc_start = 0;\n+\tu32 mcp_resp, *p_resc_num, *p_resc_start;\n \tenum _ecore_status_t rc;\n \n \tp_resc_num = &RESC_NUM(p_hwfn, res_id);\n \tp_resc_start = &RESC_START(p_hwfn, res_id);\n \n-\trc = ecore_hw_get_dflt_resc(p_hwfn, res_id,\n-\t\t\t\t    &dflt_resc_num, &dflt_resc_start);\n+\trc = ecore_hw_get_dflt_resc(p_hwfn, res_id, &dflt_resc_num,\n+\t\t\t\t    &dflt_resc_start);\n \tif (rc != ECORE_SUCCESS) {\n \t\tDP_ERR(p_hwfn,\n \t\t       \"Failed to get default amount for resource %d [%s]\\n\",\n@@ -2618,17 +2626,8 @@ static enum _ecore_status_t ecore_hw_set_resc_info(struct ecore_hwfn *p_hwfn,\n \t}\n #endif\n \n-\tOSAL_MEM_ZERO(&resc_info, sizeof(resc_info));\n-\tresc_info.res_id = ecore_hw_get_mfw_res_id(res_id);\n-\tif (resc_info.res_id == RESOURCE_NUM_INVALID) {\n-\t\tDP_ERR(p_hwfn,\n-\t\t       \"Failed to match resource %d with MFW resources\\n\",\n-\t\t       res_id);\n-\t\treturn ECORE_INVAL;\n-\t}\n-\n-\trc = ecore_mcp_get_resc_info(p_hwfn, p_hwfn->p_main_ptt, &resc_info,\n-\t\t\t\t     &mcp_resp, &mcp_param);\n+\trc = ecore_mcp_get_resc_info(p_hwfn, p_hwfn->p_main_ptt, res_id,\n+\t\t\t\t     &mcp_resp, p_resc_num, p_resc_start);\n \tif (rc != ECORE_SUCCESS) {\n \t\tDP_NOTICE(p_hwfn, true,\n \t\t\t  \"MFW response failure for an allocation request for\"\n@@ -2642,13 +2641,11 @@ static enum _ecore_status_t ecore_hw_set_resc_info(struct ecore_hwfn *p_hwfn,\n \t * - There is an internal error in the MFW while processing the request\n \t * - The resource ID is unknown to the MFW\n \t */\n-\tif (mcp_resp != FW_MSG_CODE_RESOURCE_ALLOC_OK &&\n-\t    mcp_resp != FW_MSG_CODE_RESOURCE_ALLOC_DEPRECATED) {\n-\t\t/* @DPDK */\n+\tif (mcp_resp != FW_MSG_CODE_RESOURCE_ALLOC_OK) {\n \t\tDP_INFO(p_hwfn,\n-\t\t\t\"Resource %d [%s]: No allocation info was received\"\n-\t\t\t\" [mcp_resp 0x%x]. Applying default values\"\n-\t\t\t\" [num %d, start %d].\\n\",\n+\t\t\t\"Failed to receive allocation info for resource %d [%s].\"\n+\t\t\t\" mcp_resp = 0x%x. Applying default values\"\n+\t\t\t\" [%d,%d].\\n\",\n \t\t\tres_id, ecore_hw_get_resc_name(res_id), mcp_resp,\n \t\t\tdflt_resc_num, dflt_resc_start);\n \n@@ -2660,16 +2657,13 @@ static enum _ecore_status_t ecore_hw_set_resc_info(struct ecore_hwfn *p_hwfn,\n \t/* TBD - remove this when revising the handling of the SB resource */\n \tif (res_id == ECORE_SB) {\n \t\t/* Excluding the slowpath SB */\n-\t\tresc_info.size -= 1;\n-\t\tresc_info.offset -= p_hwfn->enabled_func_idx;\n+\t\t*p_resc_num -= 1;\n+\t\t*p_resc_start -= p_hwfn->enabled_func_idx;\n \t}\n \n-\t*p_resc_num = resc_info.size;\n-\t*p_resc_start = resc_info.offset;\n-\n \tif (*p_resc_num != dflt_resc_num || *p_resc_start != dflt_resc_start) {\n \t\tDP_INFO(p_hwfn,\n-\t\t\t\"Resource %d [%s]: MFW allocation [num %d, start %d] differs from default values [num %d, start %d]%s\\n\",\n+\t\t\t\"MFW allocation for resource %d [%s] differs from default values [%d,%d vs. %d,%d]%s\\n\",\n \t\t\tres_id, ecore_hw_get_resc_name(res_id), *p_resc_num,\n \t\t\t*p_resc_start, dflt_resc_num, dflt_resc_start,\n \t\t\tdrv_resc_alloc ? \" - Applying default values\" : \"\");\n@@ -2682,12 +2676,32 @@ out:\n \treturn ECORE_SUCCESS;\n }\n \n+static enum _ecore_status_t ecore_hw_set_resc_info(struct ecore_hwfn *p_hwfn,\n+\t\t\t\t\t\t   bool drv_resc_alloc)\n+{\n+\tenum _ecore_status_t rc;\n+\tu8 res_id;\n+\n+\tfor (res_id = 0; res_id < ECORE_MAX_RESC; res_id++) {\n+\t\trc = __ecore_hw_set_resc_info(p_hwfn, res_id, drv_resc_alloc);\n+\t\tif (rc != ECORE_SUCCESS)\n+\t\t\treturn rc;\n+\t}\n+\n+\treturn ECORE_SUCCESS;\n+}\n+\n+#define ECORE_RESC_ALLOC_LOCK_RETRY_CNT\t\t10\n+#define ECORE_RESC_ALLOC_LOCK_RETRY_INTVL_US\t10000 /* 10 msec */\n+\n static enum _ecore_status_t ecore_hw_get_resc(struct ecore_hwfn *p_hwfn,\n \t\t\t\t\t      bool drv_resc_alloc)\n {\n+\tstruct ecore_resc_unlock_params resc_unlock_params;\n+\tstruct ecore_resc_lock_params resc_lock_params;\n \tbool b_ah = ECORE_IS_AH(p_hwfn->p_dev);\n-\tenum _ecore_status_t rc;\n \tu8 res_id;\n+\tenum _ecore_status_t rc;\n #ifndef ASIC_ONLY\n \tu32 *resc_start = p_hwfn->hw_info.resc_start;\n \tu32 *resc_num = p_hwfn->hw_info.resc_num;\n@@ -2700,10 +2714,62 @@ static enum _ecore_status_t ecore_hw_get_resc(struct ecore_hwfn *p_hwfn,\n \tu32 roce_min_ilt_lines = PXP_NUM_ILT_RECORDS_BB / MAX_NUM_PFS_BB;\n #endif\n \n-\tfor (res_id = 0; res_id < ECORE_MAX_RESC; res_id++) {\n-\t\trc = ecore_hw_set_resc_info(p_hwfn, res_id, drv_resc_alloc);\n+\t/* Setting the max values of the soft resources and the following\n+\t * resources allocation queries should be atomic. Since several PFs can\n+\t * run in parallel - a resource lock is needed.\n+\t * If either the resource lock or resource set value commands are not\n+\t * supported - skip the the max values setting, release the lock if\n+\t * needed, and proceed to the queries. Other failures, including a\n+\t * failure to acquire the lock, will cause this function to fail.\n+\t * Old drivers that don't acquire the lock can run in parallel, and\n+\t * their allocation values won't be affected by the updated max values.\n+\t */\n+\tOSAL_MEM_ZERO(&resc_lock_params, sizeof(resc_lock_params));\n+\tresc_lock_params.resource = ECORE_RESC_LOCK_RESC_ALLOC;\n+\tresc_lock_params.retry_num = ECORE_RESC_ALLOC_LOCK_RETRY_CNT;\n+\tresc_lock_params.retry_interval = ECORE_RESC_ALLOC_LOCK_RETRY_INTVL_US;\n+\tresc_lock_params.sleep_b4_retry = true;\n+\tOSAL_MEM_ZERO(&resc_unlock_params, sizeof(resc_unlock_params));\n+\tresc_unlock_params.resource = ECORE_RESC_LOCK_RESC_ALLOC;\n+\n+\trc = ecore_mcp_resc_lock(p_hwfn, p_hwfn->p_main_ptt, &resc_lock_params);\n+\tif (rc != ECORE_SUCCESS && rc != ECORE_NOTIMPL) {\n+\t\treturn rc;\n+\t} else if (rc == ECORE_NOTIMPL) {\n+\t\tDP_INFO(p_hwfn,\n+\t\t\t\"Skip the max values setting of the soft resources since the resource lock is not supported by the MFW\\n\");\n+\t} else if (rc == ECORE_SUCCESS && !resc_lock_params.b_granted) {\n+\t\tDP_NOTICE(p_hwfn, false,\n+\t\t\t  \"Failed to acquire the resource lock for the resource allocation commands\\n\");\n+\t\trc = ECORE_BUSY;\n+\t\tgoto unlock_and_exit;\n+\t} else {\n+\t\trc = ecore_hw_set_soft_resc_size(p_hwfn);\n+\t\tif (rc != ECORE_SUCCESS && rc != ECORE_NOTIMPL) {\n+\t\t\tDP_NOTICE(p_hwfn, false,\n+\t\t\t\t  \"Failed to set the max values of the soft resources\\n\");\n+\t\t\tgoto unlock_and_exit;\n+\t\t} else if (rc == ECORE_NOTIMPL) {\n+\t\t\tDP_INFO(p_hwfn,\n+\t\t\t\t\"Skip the max values setting of the soft resources since it is not supported by the MFW\\n\");\n+\t\t\trc = ecore_mcp_resc_unlock(p_hwfn, p_hwfn->p_main_ptt,\n+\t\t\t\t\t\t   &resc_unlock_params);\n+\t\t\tif (rc != ECORE_SUCCESS)\n+\t\t\t\tDP_INFO(p_hwfn,\n+\t\t\t\t\t\"Failed to release the resource lock for the resource allocation commands\\n\");\n+\t\t}\n+\t}\n+\n+\trc = ecore_hw_set_resc_info(p_hwfn, drv_resc_alloc);\n+\tif (rc != ECORE_SUCCESS)\n+\t\tgoto unlock_and_exit;\n+\n+\tif (resc_lock_params.b_granted && !resc_unlock_params.b_released) {\n+\t\trc = ecore_mcp_resc_unlock(p_hwfn, p_hwfn->p_main_ptt,\n+\t\t\t\t\t   &resc_unlock_params);\n \t\tif (rc != ECORE_SUCCESS)\n-\t\t\treturn rc;\n+\t\t\tDP_INFO(p_hwfn,\n+\t\t\t\t\"Failed to release the resource lock for the resource allocation commands\\n\");\n \t}\n \n #ifndef ASIC_ONLY\n@@ -2756,6 +2822,10 @@ static enum _ecore_status_t ecore_hw_get_resc(struct ecore_hwfn *p_hwfn,\n \t\t\t   RESC_START(p_hwfn, res_id));\n \n \treturn ECORE_SUCCESS;\n+\n+unlock_and_exit:\n+\tecore_mcp_resc_unlock(p_hwfn, p_hwfn->p_main_ptt, &resc_unlock_params);\n+\treturn rc;\n }\n \n static enum _ecore_status_t\ndiff --git a/drivers/net/qede/base/ecore_mcp.c b/drivers/net/qede/base/ecore_mcp.c\nindex 15f3ea0..3efe0a0 100644\n--- a/drivers/net/qede/base/ecore_mcp.c\n+++ b/drivers/net/qede/base/ecore_mcp.c\n@@ -2768,7 +2768,60 @@ enum _ecore_status_t ecore_mcp_mem_ecc_events(struct ecore_hwfn *p_hwfn,\n \t\t\t     0, &rsp, (u32 *)num_events);\n }\n \n-#define ECORE_RESC_ALLOC_VERSION_MAJOR\t1\n+static enum resource_id_enum\n+ecore_mcp_get_mfw_res_id(enum ecore_resources res_id)\n+{\n+\tenum resource_id_enum mfw_res_id = RESOURCE_NUM_INVALID;\n+\n+\tswitch (res_id) {\n+\tcase ECORE_SB:\n+\t\tmfw_res_id = RESOURCE_NUM_SB_E;\n+\t\tbreak;\n+\tcase ECORE_L2_QUEUE:\n+\t\tmfw_res_id = RESOURCE_NUM_L2_QUEUE_E;\n+\t\tbreak;\n+\tcase ECORE_VPORT:\n+\t\tmfw_res_id = RESOURCE_NUM_VPORT_E;\n+\t\tbreak;\n+\tcase ECORE_RSS_ENG:\n+\t\tmfw_res_id = RESOURCE_NUM_RSS_ENGINES_E;\n+\t\tbreak;\n+\tcase ECORE_PQ:\n+\t\tmfw_res_id = RESOURCE_NUM_PQ_E;\n+\t\tbreak;\n+\tcase ECORE_RL:\n+\t\tmfw_res_id = RESOURCE_NUM_RL_E;\n+\t\tbreak;\n+\tcase ECORE_MAC:\n+\tcase ECORE_VLAN:\n+\t\t/* Each VFC resource can accommodate both a MAC and a VLAN */\n+\t\tmfw_res_id = RESOURCE_VFC_FILTER_E;\n+\t\tbreak;\n+\tcase ECORE_ILT:\n+\t\tmfw_res_id = RESOURCE_ILT_E;\n+\t\tbreak;\n+\tcase ECORE_LL2_QUEUE:\n+\t\tmfw_res_id = RESOURCE_LL2_QUEUE_E;\n+\t\tbreak;\n+\tcase ECORE_RDMA_CNQ_RAM:\n+\tcase ECORE_CMDQS_CQS:\n+\t\t/* CNQ/CMDQS are the same resource */\n+\t\tmfw_res_id = RESOURCE_CQS_E;\n+\t\tbreak;\n+\tcase ECORE_RDMA_STATS_QUEUE:\n+\t\tmfw_res_id = RESOURCE_RDMA_STATS_QUEUE_E;\n+\t\tbreak;\n+\tcase ECORE_BDQ:\n+\t\tmfw_res_id = RESOURCE_BDQ_E;\n+\t\tbreak;\n+\tdefault:\n+\t\tbreak;\n+\t}\n+\n+\treturn mfw_res_id;\n+}\n+\n+#define ECORE_RESC_ALLOC_VERSION_MAJOR\t2\n #define ECORE_RESC_ALLOC_VERSION_MINOR\t0\n #define ECORE_RESC_ALLOC_VERSION\t\t\t\t\\\n \t((ECORE_RESC_ALLOC_VERSION_MAJOR <<\t\t\t\\\n@@ -2776,36 +2829,146 @@ enum _ecore_status_t ecore_mcp_mem_ecc_events(struct ecore_hwfn *p_hwfn,\n \t (ECORE_RESC_ALLOC_VERSION_MINOR <<\t\t\t\\\n \t  DRV_MB_PARAM_RESOURCE_ALLOC_VERSION_MINOR_SHIFT))\n \n-enum _ecore_status_t ecore_mcp_get_resc_info(struct ecore_hwfn *p_hwfn,\n-\t\t\t\t\t     struct ecore_ptt *p_ptt,\n-\t\t\t\t\t     struct resource_info *p_resc_info,\n-\t\t\t\t\t     u32 *p_mcp_resp, u32 *p_mcp_param)\n+struct ecore_resc_alloc_in_params {\n+\tu32 cmd;\n+\tenum ecore_resources res_id;\n+\tu32 resc_max_val;\n+};\n+\n+struct ecore_resc_alloc_out_params {\n+\tu32 mcp_resp;\n+\tu32 mcp_param;\n+\tu32 resc_num;\n+\tu32 resc_start;\n+\tu32 vf_resc_num;\n+\tu32 vf_resc_start;\n+\tu32 flags;\n+};\n+\n+static enum _ecore_status_t\n+ecore_mcp_resc_allocation_msg(struct ecore_hwfn *p_hwfn,\n+\t\t\t      struct ecore_ptt *p_ptt,\n+\t\t\t      struct ecore_resc_alloc_in_params *p_in_params,\n+\t\t\t      struct ecore_resc_alloc_out_params *p_out_params)\n {\n+\tstruct resource_info *p_mfw_resc_info;\n \tstruct ecore_mcp_mb_params mb_params;\n \tunion drv_union_data union_data;\n \tenum _ecore_status_t rc;\n \n+\tp_mfw_resc_info = &union_data.resource;\n+\tOSAL_MEM_ZERO(p_mfw_resc_info, sizeof(*p_mfw_resc_info));\n+\n+\tp_mfw_resc_info->res_id = ecore_mcp_get_mfw_res_id(p_in_params->res_id);\n+\tif (p_mfw_resc_info->res_id == RESOURCE_NUM_INVALID) {\n+\t\tDP_ERR(p_hwfn,\n+\t\t       \"Failed to match resource %d [%s] with the MFW resources\\n\",\n+\t\t       p_in_params->res_id,\n+\t\t       ecore_hw_get_resc_name(p_in_params->res_id));\n+\t\treturn ECORE_INVAL;\n+\t}\n+\n+\tswitch (p_in_params->cmd) {\n+\tcase DRV_MSG_SET_RESOURCE_VALUE_MSG:\n+\t\tp_mfw_resc_info->size = p_in_params->resc_max_val;\n+\t\t/* Fallthrough */\n+\tcase DRV_MSG_GET_RESOURCE_ALLOC_MSG:\n+\t\tbreak;\n+\tdefault:\n+\t\tDP_ERR(p_hwfn, \"Unexpected resource alloc command [0x%08x]\\n\",\n+\t\t       p_in_params->cmd);\n+\t\treturn ECORE_INVAL;\n+\t}\n+\n \tOSAL_MEM_ZERO(&mb_params, sizeof(mb_params));\n-\tmb_params.cmd = DRV_MSG_GET_RESOURCE_ALLOC_MSG;\n+\tmb_params.cmd = p_in_params->cmd;\n \tmb_params.param = ECORE_RESC_ALLOC_VERSION;\n-\tOSAL_MEMCPY(&union_data.resource, p_resc_info, sizeof(*p_resc_info));\n \tmb_params.p_data_src = &union_data;\n \tmb_params.p_data_dst = &union_data;\n+\n+\tDP_VERBOSE(p_hwfn, ECORE_MSG_SP,\n+\t\t   \"Resource message request: cmd 0x%08x, res_id %d [%s], hsi_version %d.%d, val 0x%x\\n\",\n+\t\t   p_in_params->cmd, p_in_params->res_id,\n+\t\t   ecore_hw_get_resc_name(p_in_params->res_id),\n+\t\t   ECORE_MFW_GET_FIELD(mb_params.param,\n+\t\t\t   DRV_MB_PARAM_RESOURCE_ALLOC_VERSION_MAJOR),\n+\t\t   ECORE_MFW_GET_FIELD(mb_params.param,\n+\t\t\t   DRV_MB_PARAM_RESOURCE_ALLOC_VERSION_MINOR),\n+\t\t   p_in_params->resc_max_val);\n+\n \trc = ecore_mcp_cmd_and_union(p_hwfn, p_ptt, &mb_params);\n \tif (rc != ECORE_SUCCESS)\n \t\treturn rc;\n \n-\t*p_mcp_resp = mb_params.mcp_resp;\n-\t*p_mcp_param = mb_params.mcp_param;\n-\n-\tOSAL_MEMCPY(p_resc_info, &union_data.resource, sizeof(*p_resc_info));\n+\tp_out_params->mcp_resp = mb_params.mcp_resp;\n+\tp_out_params->mcp_param = mb_params.mcp_param;\n+\tp_out_params->resc_num = p_mfw_resc_info->size;\n+\tp_out_params->resc_start = p_mfw_resc_info->offset;\n+\tp_out_params->vf_resc_num = p_mfw_resc_info->vf_size;\n+\tp_out_params->vf_resc_start = p_mfw_resc_info->vf_offset;\n+\tp_out_params->flags = p_mfw_resc_info->flags;\n \n \tDP_VERBOSE(p_hwfn, ECORE_MSG_SP,\n-\t\t   \"MFW resource_info: version 0x%x, res_id 0x%x, size 0x%x,\"\n-\t\t   \" offset 0x%x, vf_size 0x%x, vf_offset 0x%x, flags 0x%x\\n\",\n-\t\t   *p_mcp_param, p_resc_info->res_id, p_resc_info->size,\n-\t\t   p_resc_info->offset, p_resc_info->vf_size,\n-\t\t   p_resc_info->vf_offset, p_resc_info->flags);\n+\t\t   \"Resource message response: mfw_hsi_version %d.%d, num 0x%x, start 0x%x, vf_num 0x%x, vf_start 0x%x, flags 0x%08x\\n\",\n+\t\t   ECORE_MFW_GET_FIELD(p_out_params->mcp_param,\n+\t\t\t   FW_MB_PARAM_RESOURCE_ALLOC_VERSION_MAJOR),\n+\t\t   ECORE_MFW_GET_FIELD(p_out_params->mcp_param,\n+\t\t\t   FW_MB_PARAM_RESOURCE_ALLOC_VERSION_MINOR),\n+\t\t   p_out_params->resc_num, p_out_params->resc_start,\n+\t\t   p_out_params->vf_resc_num, p_out_params->vf_resc_start,\n+\t\t   p_out_params->flags);\n+\n+\treturn ECORE_SUCCESS;\n+}\n+\n+enum _ecore_status_t\n+ecore_mcp_set_resc_max_val(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,\n+\t\t\t   enum ecore_resources res_id, u32 resc_max_val,\n+\t\t\t   u32 *p_mcp_resp)\n+{\n+\tstruct ecore_resc_alloc_out_params out_params;\n+\tstruct ecore_resc_alloc_in_params in_params;\n+\tenum _ecore_status_t rc;\n+\n+\tOSAL_MEM_ZERO(&in_params, sizeof(in_params));\n+\tin_params.cmd = DRV_MSG_SET_RESOURCE_VALUE_MSG;\n+\tin_params.res_id = res_id;\n+\tin_params.resc_max_val = resc_max_val;\n+\tOSAL_MEM_ZERO(&out_params, sizeof(out_params));\n+\trc = ecore_mcp_resc_allocation_msg(p_hwfn, p_ptt, &in_params,\n+\t\t\t\t\t   &out_params);\n+\tif (rc != ECORE_SUCCESS)\n+\t\treturn rc;\n+\n+\t*p_mcp_resp = out_params.mcp_resp;\n+\n+\treturn ECORE_SUCCESS;\n+}\n+\n+enum _ecore_status_t\n+ecore_mcp_get_resc_info(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,\n+\t\t\tenum ecore_resources res_id, u32 *p_mcp_resp,\n+\t\t\tu32 *p_resc_num, u32 *p_resc_start)\n+{\n+\tstruct ecore_resc_alloc_out_params out_params;\n+\tstruct ecore_resc_alloc_in_params in_params;\n+\tenum _ecore_status_t rc;\n+\n+\tOSAL_MEM_ZERO(&in_params, sizeof(in_params));\n+\tin_params.cmd = DRV_MSG_GET_RESOURCE_ALLOC_MSG;\n+\tin_params.res_id = res_id;\n+\tOSAL_MEM_ZERO(&out_params, sizeof(out_params));\n+\trc = ecore_mcp_resc_allocation_msg(p_hwfn, p_ptt, &in_params,\n+\t\t\t\t\t   &out_params);\n+\tif (rc != ECORE_SUCCESS)\n+\t\treturn rc;\n+\n+\t*p_mcp_resp = out_params.mcp_resp;\n+\n+\tif (*p_mcp_resp == FW_MSG_CODE_RESOURCE_ALLOC_OK) {\n+\t\t*p_resc_num = out_params.resc_num;\n+\t\t*p_resc_start = out_params.resc_start;\n+\t}\n \n \treturn ECORE_SUCCESS;\n }\n@@ -2831,8 +2994,11 @@ static enum _ecore_status_t ecore_mcp_resource_cmd(struct ecore_hwfn *p_hwfn,\n \tif (rc != ECORE_SUCCESS)\n \t\treturn rc;\n \n-\tif (*p_mcp_resp == FW_MSG_CODE_UNSUPPORTED)\n+\tif (*p_mcp_resp == FW_MSG_CODE_UNSUPPORTED) {\n+\t\tDP_INFO(p_hwfn,\n+\t\t\t\"The resource command is unsupported by the MFW\\n\");\n \t\treturn ECORE_NOTIMPL;\n+\t}\n \n \tif (*p_mcp_param == RESOURCE_OPCODE_UNKNOWN_CMD) {\n \t\tu8 opcode = ECORE_MFW_GET_FIELD(param, RESOURCE_CMD_REQ_OPCODE);\n@@ -2846,36 +3012,35 @@ static enum _ecore_status_t ecore_mcp_resource_cmd(struct ecore_hwfn *p_hwfn,\n \treturn rc;\n }\n \n-enum _ecore_status_t ecore_mcp_resc_lock(struct ecore_hwfn *p_hwfn,\n-\t\t\t\t\t struct ecore_ptt *p_ptt,\n-\t\t\t\t\t u8 resource_num, u8 timeout,\n-\t\t\t\t\t bool *p_granted, u8 *p_owner)\n+enum _ecore_status_t\n+__ecore_mcp_resc_lock(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,\n+\t\t      struct ecore_resc_lock_params *p_params)\n {\n \tu32 param = 0, mcp_resp, mcp_param;\n \tu8 opcode;\n \tenum _ecore_status_t rc;\n \n-\tswitch (timeout) {\n+\tswitch (p_params->timeout) {\n \tcase ECORE_MCP_RESC_LOCK_TO_DEFAULT:\n \t\topcode = RESOURCE_OPCODE_REQ;\n-\t\ttimeout = 0;\n+\t\tp_params->timeout = 0;\n \t\tbreak;\n \tcase ECORE_MCP_RESC_LOCK_TO_NONE:\n \t\topcode = RESOURCE_OPCODE_REQ_WO_AGING;\n-\t\ttimeout = 0;\n+\t\tp_params->timeout = 0;\n \t\tbreak;\n \tdefault:\n \t\topcode = RESOURCE_OPCODE_REQ_W_AGING;\n \t\tbreak;\n \t}\n \n-\tECORE_MFW_SET_FIELD(param, RESOURCE_CMD_REQ_RESC, resource_num);\n+\tECORE_MFW_SET_FIELD(param, RESOURCE_CMD_REQ_RESC, p_params->resource);\n \tECORE_MFW_SET_FIELD(param, RESOURCE_CMD_REQ_OPCODE, opcode);\n-\tECORE_MFW_SET_FIELD(param, RESOURCE_CMD_REQ_AGE, timeout);\n+\tECORE_MFW_SET_FIELD(param, RESOURCE_CMD_REQ_AGE, p_params->timeout);\n \n \tDP_VERBOSE(p_hwfn, ECORE_MSG_SP,\n-\t\t   \"Resource lock request: param 0x%08x [age %d, opcode %d, resc_num %d]\\n\",\n-\t\t   param, timeout, opcode, resource_num);\n+\t\t   \"Resource lock request: param 0x%08x [age %d, opcode %d, resource %d]\\n\",\n+\t\t   param, p_params->timeout, opcode, p_params->resource);\n \n \t/* Attempt to acquire the resource */\n \trc = ecore_mcp_resource_cmd(p_hwfn, p_ptt, param, &mcp_resp,\n@@ -2884,19 +3049,20 @@ enum _ecore_status_t ecore_mcp_resc_lock(struct ecore_hwfn *p_hwfn,\n \t\treturn rc;\n \n \t/* Analyze the response */\n-\t*p_owner = ECORE_MFW_GET_FIELD(mcp_param, RESOURCE_CMD_RSP_OWNER);\n+\tp_params->owner = ECORE_MFW_GET_FIELD(mcp_param,\n+\t\t\t\t\t     RESOURCE_CMD_RSP_OWNER);\n \topcode = ECORE_MFW_GET_FIELD(mcp_param, RESOURCE_CMD_RSP_OPCODE);\n \n \tDP_VERBOSE(p_hwfn, ECORE_MSG_SP,\n \t\t   \"Resource lock response: mcp_param 0x%08x [opcode %d, owner %d]\\n\",\n-\t\t   mcp_param, opcode, *p_owner);\n+\t\t   mcp_param, opcode, p_params->owner);\n \n \tswitch (opcode) {\n \tcase RESOURCE_OPCODE_GNT:\n-\t\t*p_granted = true;\n+\t\tp_params->b_granted = true;\n \t\tbreak;\n \tcase RESOURCE_OPCODE_BUSY:\n-\t\t*p_granted = false;\n+\t\tp_params->b_granted = false;\n \t\tbreak;\n \tdefault:\n \t\tDP_NOTICE(p_hwfn, false,\n@@ -2908,23 +3074,54 @@ enum _ecore_status_t ecore_mcp_resc_lock(struct ecore_hwfn *p_hwfn,\n \treturn ECORE_SUCCESS;\n }\n \n-enum _ecore_status_t ecore_mcp_resc_unlock(struct ecore_hwfn *p_hwfn,\n-\t\t\t\t\t   struct ecore_ptt *p_ptt,\n-\t\t\t\t\t   u8 resource_num, bool force,\n-\t\t\t\t\t   bool *p_released)\n+enum _ecore_status_t\n+ecore_mcp_resc_lock(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,\n+\t\t    struct ecore_resc_lock_params *p_params)\n+{\n+\tu32 retry_cnt = 0;\n+\tenum _ecore_status_t rc;\n+\n+\tdo {\n+\t\t/* No need for an interval before the first iteration */\n+\t\tif (retry_cnt) {\n+\t\t\tif (p_params->sleep_b4_retry) {\n+\t\t\t\tu16 retry_interval_in_ms =\n+\t\t\t\t\tDIV_ROUND_UP(p_params->retry_interval,\n+\t\t\t\t\t\t     1000);\n+\n+\t\t\t\tOSAL_MSLEEP(retry_interval_in_ms);\n+\t\t\t} else {\n+\t\t\t\tOSAL_UDELAY(p_params->retry_interval);\n+\t\t\t}\n+\t\t}\n+\n+\t\trc = __ecore_mcp_resc_lock(p_hwfn, p_ptt, p_params);\n+\t\tif (rc != ECORE_SUCCESS)\n+\t\t\treturn rc;\n+\n+\t\tif (p_params->b_granted)\n+\t\t\tbreak;\n+\t} while (retry_cnt++ < p_params->retry_num);\n+\n+\treturn ECORE_SUCCESS;\n+}\n+\n+enum _ecore_status_t\n+ecore_mcp_resc_unlock(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,\n+\t\t      struct ecore_resc_unlock_params *p_params)\n {\n \tu32 param = 0, mcp_resp, mcp_param;\n \tu8 opcode;\n \tenum _ecore_status_t rc;\n \n-\topcode = force ? RESOURCE_OPCODE_FORCE_RELEASE\n-\t\t       : RESOURCE_OPCODE_RELEASE;\n-\tECORE_MFW_SET_FIELD(param, RESOURCE_CMD_REQ_RESC, resource_num);\n+\topcode = p_params->b_force ? RESOURCE_OPCODE_FORCE_RELEASE\n+\t\t\t\t   : RESOURCE_OPCODE_RELEASE;\n+\tECORE_MFW_SET_FIELD(param, RESOURCE_CMD_REQ_RESC, p_params->resource);\n \tECORE_MFW_SET_FIELD(param, RESOURCE_CMD_REQ_OPCODE, opcode);\n \n \tDP_VERBOSE(p_hwfn, ECORE_MSG_SP,\n-\t\t   \"Resource unlock request: param 0x%08x [opcode %d, resc_num %d]\\n\",\n-\t\t   param, opcode, resource_num);\n+\t\t   \"Resource unlock request: param 0x%08x [opcode %d, resource %d]\\n\",\n+\t\t   param, opcode, p_params->resource);\n \n \t/* Attempt to release the resource */\n \trc = ecore_mcp_resource_cmd(p_hwfn, p_ptt, param, &mcp_resp,\n@@ -2942,14 +3139,14 @@ enum _ecore_status_t ecore_mcp_resc_unlock(struct ecore_hwfn *p_hwfn,\n \tswitch (opcode) {\n \tcase RESOURCE_OPCODE_RELEASED_PREVIOUS:\n \t\tDP_INFO(p_hwfn,\n-\t\t\t\"Resource unlock request for an already released resource [resc_num %d]\\n\",\n-\t\t\tresource_num);\n+\t\t\t\"Resource unlock request for an already released resource [%d]\\n\",\n+\t\t\tp_params->resource);\n \t\t/* Fallthrough */\n \tcase RESOURCE_OPCODE_RELEASED:\n-\t\t*p_released = true;\n+\t\tp_params->b_released = true;\n \t\tbreak;\n \tcase RESOURCE_OPCODE_WRONG_OWNER:\n-\t\t*p_released = false;\n+\t\tp_params->b_released = false;\n \t\tbreak;\n \tdefault:\n \t\tDP_NOTICE(p_hwfn, false,\ndiff --git a/drivers/net/qede/base/ecore_mcp.h b/drivers/net/qede/base/ecore_mcp.h\nindex 4138a12..f5dac9d 100644\n--- a/drivers/net/qede/base/ecore_mcp.h\n+++ b/drivers/net/qede/base/ecore_mcp.h\n@@ -11,6 +11,7 @@\n \n #include \"bcm_osal.h\"\n #include \"mcp_public.h\"\n+#include \"ecore.h\"\n #include \"ecore_mcp_api.h\"\n \n /* Using hwfn number (and not pf_num) is required since in CMT mode,\n@@ -339,20 +340,37 @@ enum _ecore_status_t ecore_mcp_mdump_trigger(struct ecore_hwfn *p_hwfn,\n \t\t\t\t\t     struct ecore_ptt *p_ptt);\n \n /**\n+ * @brief - Sets the MFW's max value for the given resource\n+ *\n+ *  @param p_hwfn\n+ *  @param p_ptt\n+ *  @param res_id\n+ *  @param resc_max_val\n+ *  @param p_mcp_resp\n+ *\n+ * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.\n+ */\n+enum _ecore_status_t\n+ecore_mcp_set_resc_max_val(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,\n+\t\t\t   enum ecore_resources res_id, u32 resc_max_val,\n+\t\t\t   u32 *p_mcp_resp);\n+\n+/**\n  * @brief - Gets the MFW allocation info for the given resource\n  *\n  *  @param p_hwfn\n  *  @param p_ptt\n- *  @param p_resc_info\n+ *  @param res_id\n  *  @param p_mcp_resp\n- *  @param p_mcp_param\n+ *  @param p_resc_num\n+ *  @param p_resc_start\n  *\n  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.\n  */\n-enum _ecore_status_t ecore_mcp_get_resc_info(struct ecore_hwfn *p_hwfn,\n-\t\t\t\t\t     struct ecore_ptt *p_ptt,\n-\t\t\t\t\t     struct resource_info *p_resc_info,\n-\t\t\t\t\t     u32 *p_mcp_resp, u32 *p_mcp_param);\n+enum _ecore_status_t\n+ecore_mcp_get_resc_info(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,\n+\t\t\tenum ecore_resources res_id, u32 *p_mcp_resp,\n+\t\t\tu32 *p_resc_num, u32 *p_resc_start);\n \n /**\n  * @brief - Initiates PF FLR\n@@ -365,45 +383,79 @@ enum _ecore_status_t ecore_mcp_get_resc_info(struct ecore_hwfn *p_hwfn,\n enum _ecore_status_t ecore_mcp_initiate_pf_flr(struct ecore_hwfn *p_hwfn,\n \t\t\t\t\t       struct ecore_ptt *p_ptt);\n \n+#define ECORE_MCP_RESC_LOCK_MIN_VAL\tRESOURCE_DUMP /* 0 */\n+#define ECORE_MCP_RESC_LOCK_MAX_VAL\t31\n+\n+enum ecore_resc_lock {\n+\tECORE_RESC_LOCK_DBG_DUMP = ECORE_MCP_RESC_LOCK_MIN_VAL,\n+\t/* Locks that the MFW is aware of should be added here downwards */\n+\n+\t/* Ecore only locks should be added here upwards */\n+\tECORE_RESC_LOCK_RESC_ALLOC = ECORE_MCP_RESC_LOCK_MAX_VAL\n+};\n+\n+struct ecore_resc_lock_params {\n+\t/* Resource number [valid values are 0..31] */\n+\tu8 resource;\n+\n+\t/* Lock timeout value in seconds [default, none or 1..254] */\n+\tu8 timeout;\n #define ECORE_MCP_RESC_LOCK_TO_DEFAULT\t0\n #define ECORE_MCP_RESC_LOCK_TO_NONE\t255\n \n+\t/* Number of times to retry locking */\n+\tu8 retry_num;\n+\n+\t/* The interval in usec between retries */\n+\tu16 retry_interval;\n+\n+\t/* Use sleep or delay between retries */\n+\tbool sleep_b4_retry;\n+\n+\t/* Will be set as true if the resource is free and granted */\n+\tbool b_granted;\n+\n+\t/* Will be filled with the resource owner.\n+\t * [0..15 = PF0-15, 16 = MFW, 17 = diag over serial]\n+\t */\n+\tu8 owner;\n+};\n+\n /**\n  * @brief Acquires MFW generic resource lock\n  *\n  *  @param p_hwfn\n  *  @param p_ptt\n- *  @param resource_num - valid values are 0..31\n- *  @param timeout - lock timeout value in seconds\n- *                   (1..254, '0' - default value, '255' - no timeout).\n- *  @param p_granted - will be filled as true if the resource is free and\n- *                     granted, or false if it is busy.\n- *  @param p_owner - A pointer to a variable to be filled with the resource\n- *                   owner (0..15 = PF0-15, 16 = MFW, 17 = diag over serial).\n+ *  @param p_params\n  *\n  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.\n  */\n-enum _ecore_status_t ecore_mcp_resc_lock(struct ecore_hwfn *p_hwfn,\n-\t\t\t\t\t struct ecore_ptt *p_ptt,\n-\t\t\t\t\t u8 resource_num, u8 timeout,\n-\t\t\t\t\t bool *p_granted, u8 *p_owner);\n+enum _ecore_status_t\n+ecore_mcp_resc_lock(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,\n+\t\t    struct ecore_resc_lock_params *p_params);\n+\n+struct ecore_resc_unlock_params {\n+\t/* Resource number [valid values are 0..31] */\n+\tu8 resource;\n+\n+\t/* Allow to release a resource even if belongs to another PF */\n+\tbool b_force;\n+\n+\t/* Will be set as true if the resource is released */\n+\tbool b_released;\n+};\n \n /**\n  * @brief Releases MFW generic resource lock\n  *\n  *  @param p_hwfn\n  *  @param p_ptt\n- *  @param resource_num\n- *  @param force -  allows to release a reeource even if belongs to another PF\n- *  @param p_released - will be filled as true if the resource is released (or\n- *\t\t\thas been already released), and false if the resource is\n- *\t\t\tacquired by another PF and the `force' flag was not set.\n+ *  @param p_params\n  *\n  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.\n  */\n-enum _ecore_status_t ecore_mcp_resc_unlock(struct ecore_hwfn *p_hwfn,\n-\t\t\t\t\t   struct ecore_ptt *p_ptt,\n-\t\t\t\t\t   u8 resource_num, bool force,\n-\t\t\t\t\t   bool *p_released);\n+enum _ecore_status_t\n+ecore_mcp_resc_unlock(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,\n+\t\t      struct ecore_resc_unlock_params *p_params);\n \n #endif /* __ECORE_MCP_H__ */\n",
    "prefixes": [
        "dpdk-dev",
        "v5",
        "48/62"
    ]
}