From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-eopbgr790050.outbound.protection.outlook.com [40.107.79.50]) by dpdk.org (Postfix) with ESMTP id 866B05688; Tue, 12 Mar 2019 16:25:03 +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=aJ6oSpzi2bQ747WPAHfFT6fePTGStolzIe/Qt0LSAoI=; b=j91oUH/yNqOwdKpkahgTVqZab5kzAxb1XHve4g3PAuGRHACzBn1HKvqe/ALV+tKldznBUGzGQHCUtxJ8jC8/948H7zHX4mkBJHplCCgrzfI2gVDNFt5GCixVIx6EZhsYgzwVuZ77RvpGGVi1wnGlV1t99cfBwMTuGepqpqp4pPY= Received: from DM6PR11MB3625.namprd11.prod.outlook.com (20.178.230.149) by DM6PR11MB2747.namprd11.prod.outlook.com (20.176.100.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.18; Tue, 12 Mar 2019 15:25:02 +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.1686.021; Tue, 12 Mar 2019 15:25:02 +0000 From: Igor Russkikh To: "dev@dpdk.org" CC: Pavel Belous , Igor Russkikh , "stable@dpdk.org" , Pavel Belous Thread-Topic: [PATCH v3 06/10] net/atlantic: fix EEPROM get for small and uneven lengths Thread-Index: AQHU2OfC908YZtmstEmdJ6jfT9iL4w== Date: Tue, 12 Mar 2019 15:25:01 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0901CA0050.eurprd09.prod.outlook.com (2603:10a6:3:45::18) 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: 587319e2-b1bb-439b-d0a1-08d6a6fee52b x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:DM6PR11MB2747; x-ms-traffictypediagnostic: DM6PR11MB2747: x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; DM6PR11MB2747; 23:BNoVGvS2mKQt3J+8jsmQ0IEM81AZHYOY5pEUMHL?= =?iso-8859-1?Q?ORP8ouO0eFeZ+7qZX7qgwTh8y8mqFNDLVcvpGAQGTciyRD+JPDWcpaznvG?= =?iso-8859-1?Q?J8OYsUeGYM/0JjLsWMhgoy7orOoi2fzrD8PWNmc0wP6gq7YOXaCYQBvOxQ?= =?iso-8859-1?Q?+H8HwpRsKWSmJkwpGYFRl74imQZaEA+782ysFTNLrRMsa8XOUo8pJxPKUT?= =?iso-8859-1?Q?Zu93RNqjaClKfshewZ2Uxh+WiFHAsfxnQj3JfdnJi5IthEKEir5l3Uf0oM?= =?iso-8859-1?Q?HWX/g2lYdQXMosU50mBbrN2xcPypcKiwHXCLwVSnFoBtKYjhbhVUq2w9A4?= =?iso-8859-1?Q?+rqHM5csXt/eyghnoMlDK2g/lYrcLl0i200abxBqv6jZyaLLjtHCmzXXVT?= =?iso-8859-1?Q?sQb51RGtqk73PiE6+hudFlH/EvLuyNH++cMn9NSWyYUfNs0M+GYiAPavm1?= =?iso-8859-1?Q?PO4kUKL11v9by2x2IDfuQc1XhCtAZfh+4dP9/ULN/5uHM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9g2aA6XjmCzjeWOMJpwBJNmImk4IWILOgiEF2r+UH9UpgytrnYF7p/d?= =?iso-8859-1?Q?R8S1S1XpTgR79jPVOndVMtzdX3zQjfIgbM6Gl4fmjVvCNbYjm5QnN4vXSb?= =?iso-8859-1?Q?dZ8IQ7pGet8YTOrYxEPTFR+7VJc5lutssmG0EYZ5VR3UjLi3YvPMOJmeuE?= =?iso-8859-1?Q?P/c3g=3D=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 09749A275C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(396003)(346002)(39850400004)(136003)(366004)(376002)(199004)(189003)(53936002)(2501003)(106356001)(86362001)(81166006)(5660300002)(99286004)(81156014)(6116002)(44832011)(2351001)(105586002)(4326008)(66066001)(2616005)(71200400001)(486006)(72206003)(478600001)(446003)(476003)(186003)(118296001)(14454004)(26005)(54906003)(71190400001)(11346002)(386003)(6506007)(305945005)(102836004)(25786009)(7736002)(50226002)(3846002)(256004)(107886003)(316002)(36756003)(450100002)(6916009)(6486002)(52116002)(1730700003)(8676002)(76176011)(6512007)(97736004)(8936002)(68736007)(6436002)(2906002)(5640700003)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR11MB2747; 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: hw3GYpt4fLERe90mL7OBRioJoSJcf4isvvldcBpoA7a5zDP/gkK65kAuIN11ljG5BwJLpooKIS70J5Onu+cSmacGYcBWEiJnnzDNKfUJkhL8mb+nx/j5EsBVPSU5l3uCzGzEaiG3pkPXKtRuXXrbwVx6CaCaLnNRNWPIJO9jMS874yR6ZdGz/ffzHyD1alQ75R2g+ZPHv5wC4Pq5MueQCpOqEx30noJt1/jsSZc8s6XOFuI++Hcfy4MIDbasLwkzwr3ADhNyj8zpwgaswuhB05qlYmIt5HWkukIsk2ZNTlMnj01X6xULT6qgutqk8y0BCVVrHSkWSUdJihNkyPbiqkfqxgImMaqZR/2qix4fd5pEZJFytL+mtjiFuk0uuEI+eKDqToUSOQW5kj88rJFxQmTqPChPgjeXx4xXMn8iK80= 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: 587319e2-b1bb-439b-d0a1-08d6a6fee52b X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Mar 2019 15:25:01.9324 (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: DM6PR11MB2747 Subject: [dpdk-dev] [PATCH v3 06/10] net/atlantic: fix EEPROM get for small and uneven lengths X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Mar 2019 15:25:04 -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 1d9190155421..f215ceb70435 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