All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: Michael Chan <michael.chan@broadcom.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	vasundhara-v.volam@broadcom.com, Jiri Pirko <jiri@mellanox.com>
Subject: Re: [PATCH net 2/5] bnxt_en: Fix devlink NVRAM related byte order related issues.
Date: Mon, 21 Oct 2019 21:14:25 -0700	[thread overview]
Message-ID: <20191021211425.242beb0e@cakuba.netronome.com> (raw)
In-Reply-To: <1571636069-14179-3-git-send-email-michael.chan@broadcom.com>

On Mon, 21 Oct 2019 01:34:26 -0400, Michael Chan wrote:
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
> index 68f74f5..bd4b9f3 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
> @@ -226,12 +226,55 @@ static const struct bnxt_dl_nvm_param nvm_params[] = {
>  	 BNXT_NVM_SHARED_CFG, 1, 1},
>  };
>  
> +union bnxt_nvm_data {
> +	u8	val8;
> +	__le32	val32;
> +};
> +
> +static void bnxt_copy_to_nvm_data(union bnxt_nvm_data *dst,
> +				  union devlink_param_value *src,
> +				  int nvm_num_bits, int dl_num_bytes)
> +{
> +	u32 val32 = 0;
> +
> +	if (nvm_num_bits == 1) {
> +		dst->val8 = src->vbool;
> +		return;
> +	}

Why do you special case the num_bits == 1? If val32 is __le32 the low
byte would have landed on the first byte anyway, no? 🤔

just curious

> +	if (dl_num_bytes == 4)
> +		val32 = src->vu32;
> +	else if (dl_num_bytes == 2)
> +		val32 = (u32)src->vu16;
> +	else if (dl_num_bytes == 1)
> +		val32 = (u32)src->vu8;
> +	dst->val32 = cpu_to_le32(val32);
> +}

  reply	other threads:[~2019-10-22  4:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-21  5:34 [PATCH net 0/5] bnxt_en: Bug fixes Michael Chan
2019-10-21  5:34 ` [PATCH net 1/5] bnxt_en: Fix the size of devlink MSIX parameters Michael Chan
2019-10-21  5:34 ` [PATCH net 2/5] bnxt_en: Fix devlink NVRAM related byte order related issues Michael Chan
2019-10-22  4:14   ` Jakub Kicinski [this message]
2019-10-22  5:38     ` Michael Chan
2019-10-21  5:34 ` [PATCH net 3/5] bnxt_en: Adjust the time to wait before polling firmware readiness Michael Chan
2019-10-21  5:34 ` [PATCH net 4/5] bnxt_en: Minor formatting changes in FW devlink_health_reporter Michael Chan
2019-10-21  5:34 ` [PATCH net 5/5] bnxt_en: Avoid disabling pci device in bnxt_remove_one() for already disabled device Michael Chan
2019-10-22 20:29 ` [PATCH net 0/5] bnxt_en: Bug fixes Jakub Kicinski

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=20191021211425.242beb0e@cakuba.netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=davem@davemloft.net \
    --cc=jiri@mellanox.com \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=vasundhara-v.volam@broadcom.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.