From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM05-CO1-obe.outbound.protection.outlook.com (mail-eopbgr720043.outbound.protection.outlook.com [40.107.72.43]) by dpdk.org (Postfix) with ESMTP id D88AE4CBD; Sat, 9 Mar 2019 15:03:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=AQUANTIA1COM.onmicrosoft.com; s=selector1-aquantia-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=q4+DJPYTJQxzSdb4fXcC1nBJWoojhxm1DylR0yF3Tts=; b=l+xS0u6pDIUt8tVDj5kNWEk/f644oKiZLCJajb3Qbct5iW28bTzU510iQ0dsLsKetGIPSnrmEtYumluv3kwjeNL5QYZDRjoaMVbPaMxPyG9nz/zJggMikncETRJAK7o+nmvYeS2wPUEz94qQFw9P5LDJ2Mi3y42Li+ETscx7vz4= Received: from DM6PR11MB3625.namprd11.prod.outlook.com (20.178.230.149) by DM6PR11MB2892.namprd11.prod.outlook.com (20.177.216.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.18; Sat, 9 Mar 2019 14:03:34 +0000 Received: from DM6PR11MB3625.namprd11.prod.outlook.com ([fe80::d145:a1f4:ed34:e31b]) by DM6PR11MB3625.namprd11.prod.outlook.com ([fe80::d145:a1f4:ed34:e31b%3]) with mapi id 15.20.1665.020; Sat, 9 Mar 2019 14:03:34 +0000 From: Igor Russkikh To: "dev@dpdk.org" CC: Pavel Belous , Igor Russkikh , "stable@dpdk.org" , Pavel Belous Thread-Topic: [PATCH v2 06/10] net/atlantic: fix EEPROM get for small and uneven lengths Thread-Index: AQHU1oDiHlEj9M8bzk62FFyT6fCeeg== Date: Sat, 9 Mar 2019 14:03:34 +0000 Message-ID: <5850449a9d75c21ee7b41a527f4e45c11d28e7ca.1552138867.git.igor.russkikh@aquantia.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0278.eurprd05.prod.outlook.com (2603:10a6:3:fc::30) To DM6PR11MB3625.namprd11.prod.outlook.com (2603:10b6:5:13a::21) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Igor.Russkikh@aquantia.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [95.79.108.179] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7b08c8f6-1124-442f-768b-08d6a49804c0 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:DM6PR11MB2892; x-ms-traffictypediagnostic: DM6PR11MB2892: x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; DM6PR11MB2892; 23:oR39Lvbbx2eis6GUzOua7h7EZop+FZRn1XlH6ua?= =?iso-8859-1?Q?HxymTh8LqkGl8DRK9lRFFCWt8g65SC8Tfvp2btMjxdT/lxASWzNVq2MlD8?= =?iso-8859-1?Q?wTLNFJs2dqaL6xN0ZAovoB6ujdyK4iU6q9xr4bsZr3au+DKPaZyHR07T9t?= =?iso-8859-1?Q?kugjh87aRL7p9kQ2tChaiytVyzcl0DJIQnvtlyzqgxbXHkk0W8kgfAwLHZ?= =?iso-8859-1?Q?m9ITctzGQ7/47sK0MovlkGZipKTFaezLs+nqTN7G56Oyi2/px0/voPtJrE?= =?iso-8859-1?Q?5MAQHOAWdaFg6IhkOgzyWXPyuKwbG9ECCkBdWz0cGDbY8iDf4KwMyFYazI?= =?iso-8859-1?Q?w3ezj2lEGu9oMndxx73K2+jeZNHdZ6D++aqxrP8dDRxZ/RJu8sJVyrAGNG?= =?iso-8859-1?Q?Z0ELFfJh3QoFAdNdJaT5q6SzQRpqAvccpX1s+gMFNof75RZDloF8QusAF+?= =?iso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0YNjhI8t8wba+4UMwUWlcXpK+7Yx0WvOvGvKC?= =?iso-8859-1?Q?QV8LJTCiuH4XJ4FNqSAzpuL/C1cZjPwV2Q/CnfMM6pedDKlxaJYO4gaQr2?= =?iso-8859-1?Q?/ebYxZgTLenvlg=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 0971922F40 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(376002)(366004)(39850400004)(136003)(346002)(199004)(189003)(106356001)(5660300002)(6116002)(26005)(4326008)(99286004)(52116002)(2906002)(3846002)(76176011)(107886003)(2351001)(105586002)(14454004)(102836004)(97736004)(476003)(68736007)(44832011)(386003)(186003)(486006)(11346002)(446003)(2616005)(6506007)(450100002)(25786009)(2501003)(86362001)(305945005)(7736002)(72206003)(8676002)(6486002)(256004)(118296001)(316002)(8936002)(66066001)(6436002)(81156014)(1730700003)(53936002)(5640700003)(81166006)(50226002)(71190400001)(6916009)(54906003)(36756003)(71200400001)(478600001)(6512007); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR11MB2892; H:DM6PR11MB3625.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: aquantia.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: oEnP76kai4MyqNY21KE7GhygbXRFQrUQuXf6v610YEfiLlwt1Nbk0Ntf5U6YOpv4/4ekdrzqxJPQ+TCicTRYL2gmlea/stc0ip1Pk4aAcPh4A5AFEm3swOqAAq6z+lftltobsOoZY4Vhcp/S82buy+Xo4fXCDR/WYDQKmoXCSUnxq5K6XusK8TVYMNBf+AW2V04vYzW1nlCb87E3dVNsH3QSmSTAGwLL3Tt1znShxprk0LVJ1iv46fJryYSrmjASubAuk1wO09SoMzMNUab1gjAxU1d1dbrPnSRkFlhyETdbJg4ck2+6ZclY089+tdO7zPiaAFDenpdkEba3izcKvTkWe3oHNgq2Ys6CyhdYCUdLdfU5TZVUJ81P0M0bKX4e/9Y42bG6gATuRwy8KCOi4bD1wHCBZuQllhQY1VA7BSg= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b08c8f6-1124-442f-768b-08d6a49804c0 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Mar 2019 14:03:34.3355 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 83e2e134-991c-4ede-8ced-34d47e38e6b1 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB2892 Subject: [dpdk-stable] [PATCH v2 06/10] net/atlantic: fix EEPROM get for small and uneven lengths X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2019 14:03:36 -0000 From: Pavel Belous Fixes: ce4e8d418097 ("net/atlantic: implement EEPROM get/set") Cc: stable@dpdk.org Signed-off-by: Igor Russkikh Signed-off-by: Pavel Belous --- .../net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/= atlantic/hw_atl/hw_atl_utils_fw2x.c index 78ca1eb1faaa..dc619bfdd75e 100644 --- a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c +++ b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c @@ -534,13 +534,33 @@ static int aq_fw2x_get_eeprom(struct aq_hw_s *self, i= nt dev_addr, return err; =20 if (result =3D=3D 0) { - err =3D hw_atl_utils_fw_downld_dwords(self, + u32 num_dwords =3D len / sizeof(u32); + u32 bytes_remains =3D len % sizeof(u32); + + if (num_dwords) { + err =3D hw_atl_utils_fw_downld_dwords(self, self->rpc_addr + sizeof(u32) * 2, data, - RTE_ALIGN(len, sizeof(u32))); + num_dwords); =20 - if (err < 0) - return err; + if (err < 0) + return err; + } + + if (bytes_remains) { + u32 val =3D 0; + + err =3D hw_atl_utils_fw_downld_dwords(self, + self->rpc_addr + sizeof(u32) * 2 + num_dwords, + &val, + sizeof(u32)); + + if (err < 0) + return err; + + rte_memcpy((u8 *)data + len - bytes_remains, + &val, bytes_remains); + } } =20 return 0; --=20 2.17.1