netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Hao Lan <lanhao@huawei.com>,
	kuba@kernel.org, Leon Romanovsky <leon@kernel.org>
Cc: yisen.zhuang@huawei.com, salil.mehta@huawei.com,
	edumazet@google.com, richardcochran@gmail.com,
	shenjian15@huawei.com, wangjie125@huawei.com,
	netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [PATCH net-next 2/2] net: hns3: add vf fault process in hns3 ras
Date: Tue, 17 Jan 2023 09:04:52 +0100	[thread overview]
Message-ID: <504c2c6ba951859cbd007cfd441dde7de1a8f479.camel@redhat.com> (raw)
In-Reply-To: <20230113020829.48451-3-lanhao@huawei.com>

Hello,

On Fri, 2023-01-13 at 10:08 +0800, Hao Lan wrote:
[...]

> +static void hclge_get_vf_fault_bitmap(struct hclge_desc *desc,
> +				      unsigned long *bitmap)
> +{
> +#define HCLGE_FIR_FAULT_BYTES	24
> +#define HCLGE_SEC_FAULT_BYTES	8
> +
> +	u8 *buff;
> +
> +	memcpy(bitmap, desc[0].data, HCLGE_FIR_FAULT_BYTES);
> +	buff = (u8 *)bitmap + HCLGE_FIR_FAULT_BYTES;
> +	memcpy(buff, desc[1].data, HCLGE_SEC_FAULT_BYTES);
> +}

The above works under the assumption that:

	HCLGE_FIR_FAULT_BYTES + HCLGE_SEC_FAULT_BYTES == BITS_TO_BYTES(HCLGE_VPORT_NUM)

I think it's better to enforce such condition at build time with a
BUILD_BUG_ON(), to avoid future issues.

Also I think Leon still deserve a reply to one of his questions,
specifically: What will happen (at recovery time) with driver bound to
this VF?

Thanks!

Paolo


  parent reply	other threads:[~2023-01-17  8:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-13  2:08 [PATCH net-next 0/2] add some vf fault detect patch for hns Hao Lan
2023-01-13  2:08 ` [PATCH net-next 1/2] net: hns3: add hns3 vf fault detect cap bit support Hao Lan
2023-01-13  2:08 ` [PATCH net-next 2/2] net: hns3: add vf fault process in hns3 ras Hao Lan
2023-01-13  6:51   ` Leon Romanovsky
2023-01-17  7:04     ` wangjie (L)
2023-01-17 11:21       ` Leon Romanovsky
2023-01-18 12:34         ` wangjie (L)
2023-01-20 17:12           ` Leon Romanovsky
2023-01-31 12:04             ` wangjie (L)
2023-01-31 13:24               ` Leon Romanovsky
2023-02-02 13:08                 ` wangjie (L)
2023-02-06 13:36                   ` Leon Romanovsky
2023-01-17  8:04   ` Paolo Abeni [this message]
2023-01-18 12:36     ` wangjie (L)
2023-01-18 12:36     ` wangjie (L)

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=504c2c6ba951859cbd007cfd441dde7de1a8f479.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=lanhao@huawei.com \
    --cc=leon@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    --cc=salil.mehta@huawei.com \
    --cc=shenjian15@huawei.com \
    --cc=wangjie125@huawei.com \
    --cc=yisen.zhuang@huawei.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 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).