get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 44983,
    "url": "https://patches.dpdk.org/api/patches/44983/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1537394318-17682-5-git-send-email-rasesh.mody@cavium.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": "<1537394318-17682-5-git-send-email-rasesh.mody@cavium.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1537394318-17682-5-git-send-email-rasesh.mody@cavium.com",
    "date": "2018-09-19T21:59:44",
    "name": "[5/5] net/bnx2x: fix to add phy lock",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "20135c4d07e5bcd0d2c8999ea246d2cf6c5c3d4a",
    "submitter": {
        "id": 569,
        "url": "https://patches.dpdk.org/api/people/569/?format=api",
        "name": "Mody, Rasesh",
        "email": "rasesh.mody@cavium.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1537394318-17682-5-git-send-email-rasesh.mody@cavium.com/mbox/",
    "series": [
        {
            "id": 1402,
            "url": "https://patches.dpdk.org/api/series/1402/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=1402",
            "date": "2018-09-19T21:59:05",
            "name": "[1/5] net/bnx2x: fix logging to include dev name",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/1402/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/44983/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/44983/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 A57B21B142;\n\tWed, 19 Sep 2018 23:59:51 +0200 (CEST)",
            "from NAM02-BL2-obe.outbound.protection.outlook.com\n\t(mail-bl2nam02on0046.outbound.protection.outlook.com [104.47.38.46])\n\tby dpdk.org (Postfix) with ESMTP id CF2AC1B121;\n\tWed, 19 Sep 2018 23:59:45 +0200 (CEST)",
            "from BYAPR07MB5365.namprd07.prod.outlook.com (20.177.125.18) by\n\tBYAPR07MB5703.namprd07.prod.outlook.com (20.178.0.29) with Microsoft\n\tSMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n\t15.20.1143.17; Wed, 19 Sep 2018 21:59:44 +0000",
            "from BYAPR07MB5365.namprd07.prod.outlook.com\n\t([fe80::2047:9647:f196:bde0]) by\n\tBYAPR07MB5365.namprd07.prod.outlook.com\n\t([fe80::2047:9647:f196:bde0%6]) with mapi id 15.20.1143.017;\n\tWed, 19 Sep 2018 21:59:44 +0000"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n\tbh=5AeCgIcujCn4PUjS0Kety5sgSiIdV/+VFYA1pk7LVh4=;\n\tb=PuIeDQLZo35Kccpq1RZkm7CM9f7N/1myqai1EXdURpXCwzHyppytXdP7rPSMXSz3AuE7rg1LnlpteHJu6qno+lobEEgeTWB/oAnHks9xDf2PF6W4vP6RVXV5iDMZ+ARptyynYrhHaIri62vD5cR51tKu6TBUNKwNTfjwCt63XBA=",
        "From": "\"Mody, Rasesh\" <Rasesh.Mody@cavium.com>",
        "To": "\"dev@dpdk.org\" <dev@dpdk.org>",
        "CC": "\"Mody, Rasesh\" <Rasesh.Mody@cavium.com>, \"ferruh.yigit@intel.com\"\n\t<ferruh.yigit@intel.com>,\n\tDept-Eng DPDK Dev <Dept-EngDPDKDev@cavium.com>, \n\t\"stable@dpdk.org\" <stable@dpdk.org>",
        "Thread-Topic": "[PATCH 5/5] net/bnx2x: fix to add phy lock",
        "Thread-Index": "AQHUUGQSujsXIoHuvEWj1mRQuTPa8w==",
        "Date": "Wed, 19 Sep 2018 21:59:44 +0000",
        "Message-ID": "<1537394318-17682-5-git-send-email-rasesh.mody@cavium.com>",
        "References": "<1537394318-17682-1-git-send-email-rasesh.mody@cavium.com>",
        "In-Reply-To": "<1537394318-17682-1-git-send-email-rasesh.mody@cavium.com>",
        "Accept-Language": "en-US",
        "Content-Language": "en-US",
        "X-MS-Has-Attach": "",
        "X-MS-TNEF-Correlator": "",
        "x-clientproxiedby": "BYAPR04CA0003.namprd04.prod.outlook.com\n\t(2603:10b6:a03:40::16) To BYAPR07MB5365.namprd07.prod.outlook.com\n\t(2603:10b6:a03:64::18)",
        "authentication-results": "spf=none (sender IP is )\n\tsmtp.mailfrom=Rasesh.Mody@cavium.com; ",
        "x-ms-exchange-messagesentrepresentingtype": "1",
        "x-originating-ip": "[198.186.1.5]",
        "x-ms-publictraffictype": "Email",
        "x-microsoft-exchange-diagnostics": "1; BYAPR07MB5703;\n\t6:1QPyLb5+RF86ol3IT4nLxFwUknQLAsXMryq5hc3vvTK8t/wibQmGdktHuaV1hNE6GrjgJVVFDNqVl+9EMYrwgvFl8qlMjKsJ77EnGrEZlK0jZx7M/QNlEmvpzYUCq21xOeerYld8Grv452loyYdoag1BnRivJW442F4+MaZOUXpFjAAgnaWbAyfeH2oyL5jkYcsFfxmmIcGKZ6jqMKJBqJbYSBJxNATnlR5JEEVx62qRyk2vj1BiWdrm2wP4exjF2F4O7KTD0TNB3+hKT+APuPX5vEO+qTuqYwEiseD3rPxlXp6aVW71Tz2HHDOOWYzu2MyyVryQ//n9TUGFKXz6ljMGMCZP4r7W35VC7eEgS84CpXzZdV3Wqx9M0Rnat0R+lt01qdPW6IuxVgH/zUXBzuI8M6BM0zkpKXG2rIPdYJORhbCvM5++1YpIJv9EhFq4DqJdiwNGg35cILTAlc6w6w==;\n\t5:6j90N4jWtdyDsamIId1YZ5fzH/qWnvkv9M+vDtsZVYY0eTN9y2EWGpRPv1EuFAp9UWV0YDpX1fo3o8JsqO1SXNCI1Ir3ymacL9oMF1WpgOgncIjvb9rLyxLfpcQnZ3HmOWtfBdSFG93kkzfYIir2MTNL8QWC5WulY5RMZop/x+Y=;\n\t7:QaVunDQWyKYpwRJDtEXzKm/KB0u4IetPJwPqa6axPSmExPBDKEvjio+NtFzCDYd1Hu/E0jJ0hZCkVPd1+HbxafLZEBXptN9AMaSK24Fey5UGGI9w2ER0J2/YlP8H+k4velNZ04CwQLjud5/Yv9LhRC/TGobRbHopNDSy9ZRfxI60ajCJyWEmITM6vAnsRqvCPgbQY0F79wg+k5qr766rzujfynmhJyv/dAJUnJpatzK90xyWtLD8q2naaqMUUT5Z",
        "x-ms-office365-filtering-correlation-id": "088e19c5-7ef1-46e8-4884-08d61e7b34c1",
        "x-microsoft-antispam": "BCL:0; PCL:0;\n\tRULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);\n\tSRVR:BYAPR07MB5703; ",
        "x-ms-traffictypediagnostic": "BYAPR07MB5703:",
        "x-microsoft-antispam-prvs": "<BYAPR07MB5703396B04D139402AF681AC9F1C0@BYAPR07MB5703.namprd07.prod.outlook.com>",
        "x-exchange-antispam-report-test": "UriScan:;",
        "x-ms-exchange-senderadcheck": "1",
        "x-exchange-antispam-report-cfa-test": "BCL:0; PCL:0;\n\tRULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(823301075)(3231355)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051);\n\tSRVR:BYAPR07MB5703; BCL:0; PCL:0; RULEID:; SRVR:BYAPR07MB5703; ",
        "x-forefront-prvs": "0800C0C167",
        "x-forefront-antispam-report": "SFV:NSPM;\n\tSFS:(10009020)(1496009)(346002)(136003)(396003)(376002)(39850400004)(366004)(189003)(199004)(446003)(5660300001)(76176011)(2351001)(6486002)(7736002)(6116002)(6436002)(3846002)(99286004)(54906003)(6916009)(11346002)(476003)(486006)(105586002)(2616005)(478600001)(5640700003)(106356001)(305945005)(6512007)(97736004)(66066001)(52116002)(53936002)(2906002)(256004)(316002)(4326008)(2501003)(102836004)(2900100001)(81156014)(386003)(86362001)(81166006)(5250100002)(26005)(36756003)(8676002)(72206003)(14444005)(68736007)(8936002)(25786009)(1730700003)(14454004)(186003)(6506007);\n\tDIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB5703;\n\tH:BYAPR07MB5365.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en;\n\tPTR:InfoNoRecords; MX:1; A:1; ",
        "received-spf": "None (protection.outlook.com: cavium.com does not designate\n\tpermitted sender hosts)",
        "x-microsoft-antispam-message-info": "Ck3/wKZqIGTQcPCOfd59RuK/mmjp6i+Lfcs1aNurqj2zZ1gt8GyaEGN1vCuAiHX2HO2zrBbdYXKtWPhKUyShKakBjUfm1uMNBDJ5WotL//0ok4CKn33MxBhjCq/E9ZPMupwe1a4ColHsl2tDGV3MLBQGJT3MjCWZoQ6oL0NvEKjyTXx+6HSAr8G6poDoF6PpmCWMlQC9aDhbjqwUE51ae9JtLCW6TPjKloQyv5Zx31Y9Dcer4zBT6hI9ZFqa9id4zCky4/+sx0urAs3is9rrVcaReSdI59rDLL9vlnJhXVEeegrS6rpDx9ljEPl9BQXaR+20YX9u4UrpvyUBstUDQxCUgKvBcWwKBVSkxqKvjgw=",
        "spamdiagnosticoutput": "1:99",
        "spamdiagnosticmetadata": "NSPM",
        "Content-Type": "text/plain; charset=\"iso-8859-1\"",
        "Content-Transfer-Encoding": "quoted-printable",
        "MIME-Version": "1.0",
        "X-OriginatorOrg": "cavium.com",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "088e19c5-7ef1-46e8-4884-08d61e7b34c1",
        "X-MS-Exchange-CrossTenant-originalarrivaltime": "19 Sep 2018 21:59:44.6185\n\t(UTC)",
        "X-MS-Exchange-CrossTenant-fromentityheader": "Hosted",
        "X-MS-Exchange-CrossTenant-id": "711e4ccf-2e9b-4bcf-a551-4094005b6194",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "BYAPR07MB5703",
        "Subject": "[dpdk-dev] [PATCH 5/5] net/bnx2x: fix to add phy lock",
        "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": "This patch adds phy_lock, acquire/release the lock when performing\nPHY transactions. Without this fix driver can run into synchronization\nissues with management FW when modifying PHY settings.\n\nFixes: 540a211084a7 (\"bnx2x: driver core\")\nCc: stable@dpdk.org\n\nSigned-off-by: Rasesh Mody <rasesh.mody@cavium.com>\n---\n drivers/net/bnx2x/bnx2x.c     |   59 ++++++++++++++++++++++++++++++++++++-----\n drivers/net/bnx2x/bnx2x.h     |    7 +++++\n drivers/net/bnx2x/ecore_reg.h |    1 +\n 3 files changed, 60 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c\nindex 0225bea..2797593 100644\n--- a/drivers/net/bnx2x/bnx2x.c\n+++ b/drivers/net/bnx2x/bnx2x.c\n@@ -112,6 +112,7 @@ static uint8_t bnx2x_chk_parity_attn(struct bnx2x_softc *sc, uint8_t * global,\n static void bnx2x_update_rx_prod(struct bnx2x_softc *sc,\n \t\t\t\t struct bnx2x_fastpath *fp,\n \t\t\t\t uint16_t rx_bd_prod, uint16_t rx_cq_prod);\n+static void bnx2x_link_report_locked(struct bnx2x_softc *sc);\n static void bnx2x_link_report(struct bnx2x_softc *sc);\n void bnx2x_link_status_update(struct bnx2x_softc *sc);\n static int bnx2x_alloc_mem(struct bnx2x_softc *sc);\n@@ -198,7 +199,8 @@ static int bnx2x_acquire_hw_lock(struct bnx2x_softc *sc, uint32_t resource)\n \tuint32_t hw_lock_control_reg;\n \tint cnt;\n \n-\tPMD_INIT_FUNC_TRACE(sc);\n+\tif (resource)\n+\t\tPMD_INIT_FUNC_TRACE(sc);\n \n \t/* validate the resource is within range */\n \tif (resource > HW_LOCK_MAX_RESOURCE_VALUE) {\n@@ -234,7 +236,8 @@ static int bnx2x_acquire_hw_lock(struct bnx2x_softc *sc, uint32_t resource)\n \t\tDELAY(5000);\n \t}\n \n-\tPMD_DRV_LOG(NOTICE, sc, \"Resource lock timeout!\");\n+\tPMD_DRV_LOG(NOTICE, sc, \"Resource 0x%x resource_bit 0x%x lock timeout!\",\n+\t\t    resource, resource_bit);\n \treturn -1;\n }\n \n@@ -245,13 +248,14 @@ static int bnx2x_release_hw_lock(struct bnx2x_softc *sc, uint32_t resource)\n \tint func = SC_FUNC(sc);\n \tuint32_t hw_lock_control_reg;\n \n-\tPMD_INIT_FUNC_TRACE(sc);\n+\tif (resource)\n+\t\tPMD_INIT_FUNC_TRACE(sc);\n \n \t/* validate the resource is within range */\n \tif (resource > HW_LOCK_MAX_RESOURCE_VALUE) {\n \t\tPMD_DRV_LOG(NOTICE, sc,\n-\t\t\t    \"resource 0x%x > HW_LOCK_MAX_RESOURCE_VALUE\",\n-\t\t\t    resource);\n+\t\t\t    \"(resource 0x%x > HW_LOCK_MAX_RESOURCE_VALUE)\"\n+\t\t\t    \" resource_bit 0x%x\", resource, resource_bit);\n \t\treturn -1;\n \t}\n \n@@ -275,6 +279,18 @@ static int bnx2x_release_hw_lock(struct bnx2x_softc *sc, uint32_t resource)\n \treturn 0;\n }\n \n+static void bnx2x_acquire_phy_lock(struct bnx2x_softc *sc)\n+{\n+\tBNX2X_PHY_LOCK(sc);\n+\tbnx2x_acquire_hw_lock(sc, HW_LOCK_RESOURCE_MDIO);\n+}\n+\n+static void bnx2x_release_phy_lock(struct bnx2x_softc *sc)\n+{\n+\tbnx2x_release_hw_lock(sc, HW_LOCK_RESOURCE_MDIO);\n+\tBNX2X_PHY_UNLOCK(sc);\n+}\n+\n /* copy command into DMAE command memory and set DMAE command Go */\n void bnx2x_post_dmae(struct bnx2x_softc *sc, struct dmae_command *dmae, int idx)\n {\n@@ -2903,7 +2919,7 @@ static void bnx2x_link_attn(struct bnx2x_softc *sc)\n \t\t}\n \t}\n \n-\tbnx2x_link_report(sc);\n+\tbnx2x_link_report_locked(sc);\n \n \tif (IS_MF(sc)) {\n \t\tbnx2x_link_sync_notify(sc);\n@@ -2942,6 +2958,7 @@ static void bnx2x_attn_int_asserted(struct bnx2x_softc *sc, uint32_t asserted)\n \tif (asserted & ATTN_HARD_WIRED_MASK) {\n \t\tif (asserted & ATTN_NIG_FOR_FUNC) {\n \n+\t\t\tbnx2x_acquire_phy_lock(sc);\n \t\t\t/* save nig interrupt mask */\n \t\t\tnig_mask = REG_RD(sc, nig_int_mask_addr);\n \n@@ -3039,6 +3056,7 @@ static void bnx2x_attn_int_asserted(struct bnx2x_softc *sc, uint32_t asserted)\n \n \t\tREG_WR(sc, nig_int_mask_addr, nig_mask);\n \n+\t\tbnx2x_release_phy_lock(sc);\n \t}\n }\n \n@@ -3838,8 +3856,10 @@ static void bnx2x_attn_int_deasserted3(struct bnx2x_softc *sc, uint32_t attn)\n \t\t\tif (sc->link_vars.periodic_flags &\n \t\t\t    ELINK_PERIODIC_FLAGS_LINK_EVENT) {\n \t\t\t\t/* sync with link */\n+\t\t\t\tbnx2x_acquire_phy_lock(sc);\n \t\t\t\tsc->link_vars.periodic_flags &=\n \t\t\t\t    ~ELINK_PERIODIC_FLAGS_LINK_EVENT;\n+\t\t\t\tbnx2x_release_phy_lock(sc);\n \t\t\t\tif (IS_MF(sc)) {\n \t\t\t\t\tbnx2x_link_sync_notify(sc);\n \t\t\t\t}\n@@ -4029,7 +4049,9 @@ static void bnx2x_attn_int_deasserted0(struct bnx2x_softc *sc, uint32_t attn)\n \t}\n \n \tif ((attn & sc->link_vars.aeu_int_mask) && sc->port.pmf) {\n+\t\tbnx2x_acquire_phy_lock(sc);\n \t\telink_handle_module_detect_int(&sc->link_params);\n+\t\tbnx2x_release_phy_lock(sc);\n \t}\n \n \tif (attn & HW_INTERRUT_ASSERT_SET_0) {\n@@ -6867,7 +6889,7 @@ static uint16_t bnx2x_get_mf_speed(struct bnx2x_softc *sc)\n }\n \n /* report link status to OS, should be called under phy_lock */\n-static void bnx2x_link_report(struct bnx2x_softc *sc)\n+static void bnx2x_link_report_locked(struct bnx2x_softc *sc)\n {\n \tstruct bnx2x_link_report_data cur_data;\n \n@@ -6888,8 +6910,13 @@ static void bnx2x_link_report(struct bnx2x_softc *sc)\n \t\treturn;\n \t}\n \n+\tPMD_DRV_LOG(INFO, sc, \"Change in link status : cur_data = %lx, last_reported_link = %lx\\n\",\n+\t\t    cur_data.link_report_flags,\n+\t\t    sc->last_reported_link.link_report_flags);\n+\n \tsc->link_cnt++;\n \n+\tPMD_DRV_LOG(INFO, sc, \"link status change count = %x\\n\", sc->link_cnt);\n \t/* report new link params and remember the state for the next time */\n \trte_memcpy(&sc->last_reported_link, &cur_data, sizeof(cur_data));\n \n@@ -6941,6 +6968,14 @@ static void bnx2x_link_report(struct bnx2x_softc *sc)\n \t}\n }\n \n+static void\n+bnx2x_link_report(struct bnx2x_softc *sc)\n+{\n+\tbnx2x_acquire_phy_lock(sc);\n+\tbnx2x_link_report_locked(sc);\n+\tbnx2x_release_phy_lock(sc);\n+}\n+\n void bnx2x_link_status_update(struct bnx2x_softc *sc)\n {\n \tif (sc->state != BNX2X_STATE_OPEN) {\n@@ -7019,6 +7054,8 @@ static int bnx2x_initial_phy_init(struct bnx2x_softc *sc, int load_mode)\n \n \tbnx2x_set_requested_fc(sc);\n \n+\tbnx2x_acquire_phy_lock(sc);\n+\n \tif (load_mode == LOAD_DIAG) {\n \t\tlp->loopback_mode = ELINK_LOOPBACK_XGXS;\n /* Prefer doing PHY loopback at 10G speed, if possible */\n@@ -7038,6 +7075,8 @@ static int bnx2x_initial_phy_init(struct bnx2x_softc *sc, int load_mode)\n \n \trc = elink_phy_init(&sc->link_params, &sc->link_vars);\n \n+\tbnx2x_release_phy_lock(sc);\n+\n \tbnx2x_calc_fc_adv(sc);\n \n \tif (sc->link_vars.link_up) {\n@@ -7088,7 +7127,9 @@ void bnx2x_periodic_callout(struct bnx2x_softc *sc)\n  */\n \t\tmb();\n \t\tif (sc->port.pmf) {\n+\t\t\tbnx2x_acquire_phy_lock(sc);\n \t\t\telink_period_func(&sc->link_params, &sc->link_vars);\n+\t\t\tbnx2x_release_phy_lock(sc);\n \t\t}\n \t}\n #ifdef BNX2X_PULSE\n@@ -9840,8 +9881,10 @@ static void bnx2x_common_init_phy(struct bnx2x_softc *sc)\n \t\tshmem2_base[1] = SHMEM2_RD(sc, other_shmem2_base_addr);\n \t}\n \n+\tbnx2x_acquire_phy_lock(sc);\n \telink_common_init_phy(sc, shmem_base, shmem2_base,\n \t\t\t      sc->devinfo.chip_id, 0);\n+\tbnx2x_release_phy_lock(sc);\n }\n \n static void bnx2x_pf_disable(struct bnx2x_softc *sc)\n@@ -11320,7 +11363,9 @@ static int bnx2x_init_hw_func(struct bnx2x_softc *sc)\n static void bnx2x_link_reset(struct bnx2x_softc *sc)\n {\n \tif (!BNX2X_NOMCP(sc)) {\n+\t\tbnx2x_acquire_phy_lock(sc);\n \t\telink_lfa_reset(&sc->link_params, &sc->link_vars);\n+\t\tbnx2x_release_phy_lock(sc);\n \t} else {\n \t\tif (!CHIP_REV_IS_SLOW(sc)) {\n \t\t\tPMD_DRV_LOG(WARNING, sc,\ndiff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h\nindex 1cc5a6b..7478072 100644\n--- a/drivers/net/bnx2x/bnx2x.h\n+++ b/drivers/net/bnx2x/bnx2x.h\n@@ -725,6 +725,13 @@ struct bnx2x_port {\n \n     uint32_t    phy_addr;\n \n+\t/* Used to synchronize phy accesses. */\n+\trte_spinlock_t\tphy_mtx;\n+\tchar\t\tphy_mtx_name[32];\n+\n+#define BNX2X_PHY_LOCK(sc)          rte_spinlock_lock(&sc->port.phy_mtx)\n+#define BNX2X_PHY_UNLOCK(sc)        rte_spinlock_unlock(&sc->port.phy_mtx)\n+\n     /*\n      * MCP scratchpad address for port specific statistics.\n      * The device is responsible for writing statistcss\ndiff --git a/drivers/net/bnx2x/ecore_reg.h b/drivers/net/bnx2x/ecore_reg.h\nindex ae8a93b..d69e857 100644\n--- a/drivers/net/bnx2x/ecore_reg.h\n+++ b/drivers/net/bnx2x/ecore_reg.h\n@@ -1967,6 +1967,7 @@\n #define HW_LOCK_MAX_RESOURCE_VALUE\t\t 31\n #define HW_LOCK_RESOURCE_DRV_FLAGS\t\t 10\n #define HW_LOCK_RESOURCE_GPIO\t\t\t 1\n+#define HW_LOCK_RESOURCE_MDIO\t\t\t 0\n #define HW_LOCK_RESOURCE_NVRAM\t\t\t 12\n #define HW_LOCK_RESOURCE_PORT0_ATT_MASK\t\t 3\n #define HW_LOCK_RESOURCE_RECOVERY_LEADER_0\t 8\n",
    "prefixes": [
        "5/5"
    ]
}