From: Ben Hutchings <bhutchings@solarflare.com>
To: David Miller <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-net-drivers@solarflare.com>
Subject: [PATCH net-next 07/11] sfc: Convert firmware subtypes to native byte order in efx_mcdi_get_board_cfg()
Date: Wed, 19 Sep 2012 20:17:36 +0100 [thread overview]
Message-ID: <1348082256.2636.22.camel@bwh-desktop.uk.solarflarecom.com> (raw)
In-Reply-To: <1348081775.2636.15.camel@bwh-desktop.uk.solarflarecom.com>
On big-endian systems the MTD partition names currently have mangled
subtype numbers and are not recognised by the firmware update tool
(sfupdate).
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/ethernet/sfc/mcdi.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c
index 294df4b..578e5f7 100644
--- a/drivers/net/ethernet/sfc/mcdi.c
+++ b/drivers/net/ethernet/sfc/mcdi.c
@@ -661,9 +661,8 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
u16 *fw_subtype_list, u32 *capabilities)
{
uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LENMIN];
- size_t outlen;
+ size_t outlen, offset, i;
int port_num = efx_port_num(efx);
- int offset;
int rc;
BUILD_BUG_ON(MC_CMD_GET_BOARD_CFG_IN_LEN != 0);
@@ -683,11 +682,16 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
: MC_CMD_GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT0_OFST;
if (mac_address)
memcpy(mac_address, outbuf + offset, ETH_ALEN);
- if (fw_subtype_list)
- memcpy(fw_subtype_list,
- outbuf + MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST,
- MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM *
- sizeof(fw_subtype_list[0]));
+ if (fw_subtype_list) {
+ offset = MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST;
+ for (i = 0;
+ i < MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM;
+ i++) {
+ fw_subtype_list[i] =
+ le16_to_cpup((__le16 *)(outbuf + offset));
+ offset += 2;
+ }
+ }
if (capabilities) {
if (port_num)
*capabilities = MCDI_DWORD(outbuf,
--
1.7.7.6
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
next prev parent reply other threads:[~2012-09-19 19:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-19 19:09 Pull request: sfc-next 2012-09-19 Ben Hutchings
2012-09-19 19:13 ` [PATCH net-next 01/11] pps/ptp: Allow PHC devices to adjust PPS events for known delay Ben Hutchings
2012-09-20 6:57 ` Richard Cochran
2012-09-20 7:29 ` Rodolfo Giometti
2012-09-19 19:14 ` [PATCH net-next 02/11] sfc: Add explicit RX queue flag to channel Ben Hutchings
2012-09-19 19:15 ` [PATCH net-next 03/11] sfc: Add channel specific receive_skb handler and post_remove callback Ben Hutchings
2012-09-19 19:16 ` [PATCH net-next 04/11] sfc: Allow efx_mcdi_rpc to be called in two parts Ben Hutchings
2012-09-19 19:16 ` [PATCH net-next 05/11] sfc: Fix maximum array sizes for various MCDI commands Ben Hutchings
2012-09-19 19:17 ` [PATCH net-next 06/11] sfc: Add support for IEEE-1588 PTP Ben Hutchings
2012-09-20 6:59 ` Richard Cochran
2012-09-19 19:17 ` Ben Hutchings [this message]
2012-09-19 19:17 ` [PATCH net-next 08/11] sfc: Support variable-length response to MCDI GET_BOARD_CFG Ben Hutchings
2012-09-19 19:18 ` [PATCH net-next 09/11] sfc: Expose FPGA bitfile partition through MTD Ben Hutchings
2012-09-19 19:18 ` [PATCH net-next 10/11] sfc: Bump version to 3.2 Ben Hutchings
2012-09-19 19:18 ` [PATCH net-next 11/11] sfc: Avoid generating over-length MC_CMD_FLUSH_RX_QUEUES request Ben Hutchings
2012-09-20 20:42 ` Pull request: sfc-next 2012-09-19 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1348082256.2636.22.camel@bwh-desktop.uk.solarflarecom.com \
--to=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=linux-net-drivers@solarflare.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox