From patchwork Thu Dec 26 07:57:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuval Mintz X-Patchwork-Id: 305215 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2E4E32C0095 for ; Thu, 26 Dec 2013 18:57:46 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752711Ab3LZH52 (ORCPT ); Thu, 26 Dec 2013 02:57:28 -0500 Received: from mail-gw2-out.broadcom.com ([216.31.210.63]:47794 "EHLO mail-gw2-out.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752669Ab3LZH5T (ORCPT ); Thu, 26 Dec 2013 02:57:19 -0500 X-IronPort-AV: E=Sophos;i="4.95,553,1384329600"; d="scan'208";a="5772552" Received: from irvexchcas06.broadcom.com (HELO IRVEXCHCAS06.corp.ad.broadcom.com) ([10.9.208.53]) by mail-gw2-out.broadcom.com with ESMTP; 26 Dec 2013 00:04:44 -0800 Received: from IRVEXCHSMTP1.corp.ad.broadcom.com (10.9.207.51) by IRVEXCHCAS06.corp.ad.broadcom.com (10.9.208.53) with Microsoft SMTP Server (TLS) id 14.1.438.0; Wed, 25 Dec 2013 23:57:19 -0800 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP1.corp.ad.broadcom.com (10.9.207.51) with Microsoft SMTP Server id 14.1.438.0; Wed, 25 Dec 2013 23:57:18 -0800 Received: from lb-tlvb-yuvalmin.il.broadcom.com (lb-tlvb-yuvalmin.il.broadcom.com [10.185.6.94]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id ADAB5246A3; Wed, 25 Dec 2013 23:57:17 -0800 (PST) From: Yuval Mintz To: , CC: , Yuval Mintz Subject: [PATCH v2 net-next 3/6] bnx2x: add Big-Endian ethtool comment Date: Thu, 26 Dec 2013 09:57:09 +0200 Message-ID: <1388044632-9172-4-git-send-email-yuvalmin@broadcom.com> X-Mailer: git-send-email 1.8.1.227.g44fe835 In-Reply-To: <1388044632-9172-1-git-send-email-yuvalmin@broadcom.com> References: <1388044632-9172-1-git-send-email-yuvalmin@broadcom.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org There's a known issue that using `ethtool -e' flips the endianity of the written data, i.e., using `ethtool -E' to dump eeprom image and than using `ethtool -e' to re-write that same image will result in an image where the data has the opposite endianity. Sadly, this cannot be fixed as there are already various tools deployed based on the endianity of the eeprom read/write. Instead, a comment is added to the code to help explain why this is un-fixable. Signed-off-by: Yuval Mintz Signed-off-by: Ariel Elior --- drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c index 32d0f14..92a467f 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c @@ -1639,6 +1639,12 @@ static int bnx2x_nvram_write(struct bnx2x *bp, u32 offset, u8 *data_buf, memcpy(&val, data_buf, 4); + /* Notice unlike bnx2x_nvram_read_dword() this will not + * change val using be32_to_cpu(), which causes data to flip + * if the eeprom is read and then written back. This is due + * to tools utilizing this functionality that would break + * if this would be resolved. + */ rc = bnx2x_nvram_write_dword(bp, offset, val, cmd_flags); /* advance to the next dword */