* [PATCH] net-bnx2x: Fix byte order problem on NVRAM writes
@ 2013-10-21 21:57 Nate Klein
2013-10-22 13:30 ` Yuval Mintz
0 siblings, 1 reply; 2+ messages in thread
From: Nate Klein @ 2013-10-21 21:57 UTC (permalink / raw)
To: netdev; +Cc: eilong, nxk, linux-kernel
Tested:
ethtool -e eth0 raw on >first.nvram
ethtool -E eth0 <first.nvram
ethtool -e eth0 raw on >second.nvram
cmp first.nvram second.nvram || ethtool -E eth0 <second.nvram
(No output means pass.)
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index 8213cc8..35671fb 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -1549,7 +1549,7 @@ static int bnx2x_nvram_write_dword(struct bnx2x *bp, u32 offset, u32 val,
REG_WR(bp, MCP_REG_MCPR_NVM_COMMAND, MCPR_NVM_COMMAND_DONE);
/* write the data */
- REG_WR(bp, MCP_REG_MCPR_NVM_WRITE, val);
+ REG_WR(bp, MCP_REG_MCPR_NVM_WRITE, cpu_to_be32(val));
/* address of the NVRAM to write to */
REG_WR(bp, MCP_REG_MCPR_NVM_ADDR,
--
1.8.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH] net-bnx2x: Fix byte order problem on NVRAM writes
2013-10-21 21:57 [PATCH] net-bnx2x: Fix byte order problem on NVRAM writes Nate Klein
@ 2013-10-22 13:30 ` Yuval Mintz
0 siblings, 0 replies; 2+ messages in thread
From: Yuval Mintz @ 2013-10-22 13:30 UTC (permalink / raw)
To: Nate Klein, netdev@vger.kernel.org
Cc: Eilon Greenstein, linux-kernel@vger.kernel.org
> Tested:
> ethtool -e eth0 raw on >first.nvram
> ethtool -E eth0 <first.nvram
> ethtool -e eth0 raw on >second.nvram
> cmp first.nvram second.nvram || ethtool -E eth0 <second.nvram
> (No output means pass.)
Hi Nate,
We're aware of this `bug' for some time - we've encountered it when
trying to fix the endian sparse warnings in the driver.
Sadly, there are already existing user applications that assume that this is
the driver's behaviour - i.e., those applications prepare their buffers in a
manner which assumes the endian of the writes; changing this write will
cause those tools to break.
That's why we haven't fixed the issue before, and cannot support such a
fix. We're more than willing to document it somewhere, if that seems
useful to anyone.
Thanks,
Yuval
> ---
> drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
> b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
> index 8213cc8..35671fb 100644
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
> @@ -1549,7 +1549,7 @@ static int bnx2x_nvram_write_dword(struct bnx2x
> *bp, u32 offset, u32 val,
> REG_WR(bp, MCP_REG_MCPR_NVM_COMMAND,
> MCPR_NVM_COMMAND_DONE);
>
> /* write the data */
> - REG_WR(bp, MCP_REG_MCPR_NVM_WRITE, val);
> + REG_WR(bp, MCP_REG_MCPR_NVM_WRITE, cpu_to_be32(val));
>
> /* address of the NVRAM to write to */
> REG_WR(bp, MCP_REG_MCPR_NVM_ADDR,
> --
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-22 13:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-21 21:57 [PATCH] net-bnx2x: Fix byte order problem on NVRAM writes Nate Klein
2013-10-22 13:30 ` Yuval Mintz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).