linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: Sheetal Tigadoli <sheetal.tigadoli@broadcom.com>
Cc: "Rafał Miłecki" <zajec5@gmail.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Michal Simek" <michal.simek@xilinx.com>,
	"Rajan Vaja" <rajan.vaja@xilinx.com>,
	"Scott Branden" <scott.branden@broadcom.com>,
	"Ray Jui" <ray.jui@broadcom.com>,
	"Vikram Prakash" <vikram.prakash@broadcom.com>,
	"Jens Wiklander" <jens.wiklander@linaro.org>,
	"Michael Chan" <michael.chan@broadcom.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Vikas Gupta" <vikas.gupta@broadcom.com>,
	"Vasundhara Volam" <vasundhara-v.volam@broadcom.com>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	tee-dev@lists.linaro.org, bcm-kernel-feedback-list@broadcom.com,
	netdev@vger.kernel.org
Subject: Re: [PATCH V2 3/3] bnxt_en: Add support to collect crash dump via ethtool
Date: Thu, 17 Oct 2019 12:21:56 -0700	[thread overview]
Message-ID: <20191017122156.4d5262ac@cakuba.netronome.com> (raw)
In-Reply-To: <1571313682-28900-4-git-send-email-sheetal.tigadoli@broadcom.com>

On Thu, 17 Oct 2019 17:31:22 +0530, Sheetal Tigadoli wrote:
> From: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
> 
> Driver supports 2 types of core dumps.
> 
> 1. Live dump - Firmware dump when system is up and running.
> 2. Crash dump - Dump which is collected during firmware crash
>                 that can be retrieved after recovery.
> Crash dump is currently supported only on specific 58800 chips
> which can be retrieved using OP-TEE API only, as firmware cannot
> access this region directly.
> 
> User needs to set the dump flag using following command before
> initiating the dump collection:
> 
>     $ ethtool -W|--set-dump eth0 N
> 
> Where N is "0" for live dump and "1" for crash dump
> 
> Command to collect the dump after setting the flag:
> 
>     $ ethtool -w eth0 data Filename
> 
> Cc: Michael Chan <michael.chan@broadcom.com>
> Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
> Signed-off-by: Sheetal Tigadoli <sheetal.tigadoli@broadcom.com>
> ---
>  drivers/net/ethernet/broadcom/bnxt/bnxt.h         |  3 ++
>  drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 36 +++++++++++++++++++++--
>  drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h |  2 ++
>  3 files changed, 39 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
> index 0943715..3e7d1fb 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
> @@ -1807,6 +1807,9 @@ struct bnxt {
>  
>  	u8			num_leds;
>  	struct bnxt_led_info	leds[BNXT_MAX_LED];
> +	u16			dump_flag;
> +#define BNXT_DUMP_LIVE		0
> +#define BNXT_DUMP_CRASH		1
>  
>  	struct bpf_prog		*xdp_prog;
>  
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> index 51c1404..1596221 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> @@ -3311,6 +3311,23 @@ static int bnxt_get_coredump(struct bnxt *bp, void *buf, u32 *dump_len)
>  	return rc;
>  }
>  
> +static int bnxt_set_dump(struct net_device *dev, struct ethtool_dump *dump)
> +{
> +	struct bnxt *bp = netdev_priv(dev);
> +
> +#ifndef CONFIG_TEE_BNXT_FW
> +	return -EOPNOTSUPP;
> +#endif

	if (!IS_ENABLED(...))
		return x;

reads better IMHO

But also you seem to be breaking live dump for systems with
CONFIG_TEE_BNXT_FW=n

> +	if (dump->flag > BNXT_DUMP_CRASH) {
> +		netdev_err(dev, "Supports only Live(0) and Crash(1) dumps.\n");

more of an _info than _err, if at all

> +		return -EINVAL;
> +	}
> +
> +	bp->dump_flag = dump->flag;
> +	return 0;
> +}
> +
>  static int bnxt_get_dump_flag(struct net_device *dev, struct ethtool_dump *dump)
>  {
>  	struct bnxt *bp = netdev_priv(dev);
> @@ -3323,7 +3340,12 @@ static int bnxt_get_dump_flag(struct net_device *dev, struct ethtool_dump *dump)
>  			bp->ver_resp.hwrm_fw_bld_8b << 8 |
>  			bp->ver_resp.hwrm_fw_rsvd_8b;
>  
> -	return bnxt_get_coredump(bp, NULL, &dump->len);
> +	dump->flag = bp->dump_flag;
> +	if (bp->dump_flag == BNXT_DUMP_CRASH)
> +		dump->len = BNXT_CRASH_DUMP_LEN;
> +	else
> +		bnxt_get_coredump(bp, NULL, &dump->len);
> +	return 0;
>  }
>  
>  static int bnxt_get_dump_data(struct net_device *dev, struct ethtool_dump *dump,
> @@ -3336,7 +3358,16 @@ static int bnxt_get_dump_data(struct net_device *dev, struct ethtool_dump *dump,
>  
>  	memset(buf, 0, dump->len);
>  
> -	return bnxt_get_coredump(bp, buf, &dump->len);
> +	dump->flag = bp->dump_flag;
> +	if (dump->flag == BNXT_DUMP_CRASH) {
> +#ifdef CONFIG_TEE_BNXT_FW
> +		return tee_bnxt_copy_coredump(buf, 0, dump->len);
> +#endif
> +	} else {
> +		return bnxt_get_coredump(bp, buf, &dump->len);
> +	}
> +
> +	return 0;
>  }
>  
>  void bnxt_ethtool_init(struct bnxt *bp)
> @@ -3446,6 +3477,7 @@ void bnxt_ethtool_free(struct bnxt *bp)
>  	.set_phys_id		= bnxt_set_phys_id,
>  	.self_test		= bnxt_self_test,
>  	.reset			= bnxt_reset,
> +	.set_dump		= bnxt_set_dump,
>  	.get_dump_flag		= bnxt_get_dump_flag,
>  	.get_dump_data		= bnxt_get_dump_data,
>  };
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h
> index b5b65b3..01de7e7 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h
> @@ -59,6 +59,8 @@ struct hwrm_dbg_cmn_output {
>  	#define HWRM_DBG_CMN_FLAGS_MORE	1
>  };
>  
> +#define BNXT_CRASH_DUMP_LEN	(8 << 20)
> +
>  #define BNXT_LED_DFLT_ENA				\
>  	(PORT_LED_CFG_REQ_ENABLES_LED0_ID |		\
>  	 PORT_LED_CFG_REQ_ENABLES_LED0_STATE |		\


  reply	other threads:[~2019-10-17 19:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17 12:01 [PATCH V2 0/3] Add OP-TEE based bnxt f/w manager Sheetal Tigadoli
2019-10-17 12:01 ` [PATCH V2 1/3] firmware: broadcom: add OP-TEE based BNXT " Sheetal Tigadoli
2019-10-17 19:16   ` Jakub Kicinski
2019-10-21  9:11     ` Sheetal Tigadoli
2019-10-17 12:01 ` [PATCH V2 2/3] bnxt_en: Add support to invoke OP-TEE API to reset firmware Sheetal Tigadoli
2019-10-17 12:01 ` [PATCH V2 3/3] bnxt_en: Add support to collect crash dump via ethtool Sheetal Tigadoli
2019-10-17 19:21   ` Jakub Kicinski [this message]
2019-10-18  6:34     ` Vasundhara Volam
2019-10-18 17:01       ` Jakub Kicinski
2019-10-21  4:35         ` Vasundhara Volam
2019-10-21 23:00           ` 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=20191017122156.4d5262ac@cakuba.netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=jens.wiklander@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=michal.simek@xilinx.com \
    --cc=netdev@vger.kernel.org \
    --cc=rajan.vaja@xilinx.com \
    --cc=ray.jui@broadcom.com \
    --cc=scott.branden@broadcom.com \
    --cc=sheetal.tigadoli@broadcom.com \
    --cc=tee-dev@lists.linaro.org \
    --cc=vasundhara-v.volam@broadcom.com \
    --cc=vikas.gupta@broadcom.com \
    --cc=vikram.prakash@broadcom.com \
    --cc=zajec5@gmail.com \
    --subject='Re: [PATCH V2 3/3] bnxt_en: Add support to collect crash dump via ethtool' \
    /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

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).