[v2,08/10] net/bnxt: add FW status location structure

Message ID 20200421200720.81151-9-ajit.khaparde@broadcom.com (mailing list archive)
State Superseded, archived
Delegated to: Ajit Khaparde
Headers
Series bnxt patchset with fixes |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Ajit Khaparde April 21, 2020, 8:07 p.m. UTC
  From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Code using this change will be added in next patch.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 49 ++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
  

Comments

Ferruh Yigit April 21, 2020, 9:05 p.m. UTC | #1
On 4/21/2020 9:07 PM, Ajit Khaparde wrote:
> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> 
> Code using this change will be added in next patch.

It can be better to merge this patch to next one, where it uses this new struct.

> 
> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>  drivers/net/bnxt/hsi_struct_def_dpdk.h | 49 ++++++++++++++++++++++++++
>  1 file changed, 49 insertions(+)
> 
> diff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h b/drivers/net/bnxt/hsi_struct_def_dpdk.h
> index da22b6249..fe18686f8 100644
> --- a/drivers/net/bnxt/hsi_struct_def_dpdk.h
> +++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h
> @@ -38622,4 +38622,53 @@ struct hwrm_cfa_counter_qstats_output {
>  	uint8_t	valid;
>  } __rte_packed;
>  
> +/*
> + * This structure is fixed at the beginning of the ChiMP SRAM (GRC
> + * offset: 0x31001F0). Host software is expected to read from this
> + * location for a defined signature. If it exists, the software can
> + * assume the presence of this structure and the validity of the
> + * FW_STATUS location in the next field.
> + */
> +/* hcomm_status (size:64b/8B) */
> +struct hcomm_status {
> +	uint32_t	sig_ver;
> +	/*
> +	 * This field defines the version of the structure. The latest
> +	 * version value is 1.
> +	 */
> +	#define HCOMM_STATUS_VER_MASK		UINT32_C(0xff)
> +	#define HCOMM_STATUS_VER_SFT		0
> +	#define HCOMM_STATUS_VER_LATEST		UINT32_C(0x1)
> +	#define HCOMM_STATUS_VER_LAST		HCOMM_STATUS_VER_LATEST
> +	/*
> +	 * This field is to store the signature value to indicate the
> +	 * presence of the structure.
> +	 */
> +	#define HCOMM_STATUS_SIGNATURE_MASK	UINT32_C(0xffffff00)
> +	#define HCOMM_STATUS_SIGNATURE_SFT	8
> +	#define HCOMM_STATUS_SIGNATURE_VAL	(UINT32_C(0x484353) << 8)
> +	#define HCOMM_STATUS_SIGNATURE_LAST	HCOMM_STATUS_SIGNATURE_VAL
> +	uint32_t	fw_status_loc;
> +	#define HCOMM_STATUS_TRUE_ADDR_SPACE_MASK	UINT32_C(0x3)
> +	#define HCOMM_STATUS_TRUE_ADDR_SPACE_SFT	0
> +	/* PCIE configuration space */
> +	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_PCIE_CFG	UINT32_C(0x0)
> +	/* GRC space */
> +	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_GRC	UINT32_C(0x1)
> +	/* BAR0 space */
> +	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR0	UINT32_C(0x2)
> +	/* BAR1 space */
> +	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR1	UINT32_C(0x3)
> +	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_LAST	\
> +		HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR1
> +	/*
> +	 * This offset where the fw_status register is located. The value
> +	 * is generally 4-byte aligned.
> +	 */
> +	#define HCOMM_STATUS_TRUE_OFFSET_MASK		UINT32_C(0xfffffffc)
> +	#define HCOMM_STATUS_TRUE_OFFSET_SFT		2
> +} __attribute__((packed));

Can you please prefer '__rte_packed' instead of the '__attribute__((packed))'?
If you recognized I have updated all the occurrences in next-net already while
rebasing on top of main repo. But please send new patches according it.
  
Ajit Khaparde April 21, 2020, 9:21 p.m. UTC | #2
On Tue, Apr 21, 2020 at 2:05 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> On 4/21/2020 9:07 PM, Ajit Khaparde wrote:
> > From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> >
> > Code using this change will be added in next patch.
>
> It can be better to merge this patch to next one, where it uses this new
> struct.
>
> >
> > Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> > Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> > ---
> >  drivers/net/bnxt/hsi_struct_def_dpdk.h | 49 ++++++++++++++++++++++++++
> >  1 file changed, 49 insertions(+)
> >
> > diff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h
> b/drivers/net/bnxt/hsi_struct_def_dpdk.h
> > index da22b6249..fe18686f8 100644
> > --- a/drivers/net/bnxt/hsi_struct_def_dpdk.h
> > +++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h
> > @@ -38622,4 +38622,53 @@ struct hwrm_cfa_counter_qstats_output {
> >       uint8_t valid;
> >  } __rte_packed;
> >
> > +/*
> > + * This structure is fixed at the beginning of the ChiMP SRAM (GRC
> > + * offset: 0x31001F0). Host software is expected to read from this
> > + * location for a defined signature. If it exists, the software can
> > + * assume the presence of this structure and the validity of the
> > + * FW_STATUS location in the next field.
> > + */
> > +/* hcomm_status (size:64b/8B) */
> > +struct hcomm_status {
> > +     uint32_t        sig_ver;
> > +     /*
> > +      * This field defines the version of the structure. The latest
> > +      * version value is 1.
> > +      */
> > +     #define HCOMM_STATUS_VER_MASK           UINT32_C(0xff)
> > +     #define HCOMM_STATUS_VER_SFT            0
> > +     #define HCOMM_STATUS_VER_LATEST         UINT32_C(0x1)
> > +     #define HCOMM_STATUS_VER_LAST           HCOMM_STATUS_VER_LATEST
> > +     /*
> > +      * This field is to store the signature value to indicate the
> > +      * presence of the structure.
> > +      */
> > +     #define HCOMM_STATUS_SIGNATURE_MASK     UINT32_C(0xffffff00)
> > +     #define HCOMM_STATUS_SIGNATURE_SFT      8
> > +     #define HCOMM_STATUS_SIGNATURE_VAL      (UINT32_C(0x484353) << 8)
> > +     #define HCOMM_STATUS_SIGNATURE_LAST     HCOMM_STATUS_SIGNATURE_VAL
> > +     uint32_t        fw_status_loc;
> > +     #define HCOMM_STATUS_TRUE_ADDR_SPACE_MASK       UINT32_C(0x3)
> > +     #define HCOMM_STATUS_TRUE_ADDR_SPACE_SFT        0
> > +     /* PCIE configuration space */
> > +     #define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_PCIE_CFG
> UINT32_C(0x0)
> > +     /* GRC space */
> > +     #define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_GRC
>  UINT32_C(0x1)
> > +     /* BAR0 space */
> > +     #define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR0
> UINT32_C(0x2)
> > +     /* BAR1 space */
> > +     #define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR1
> UINT32_C(0x3)
> > +     #define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_LAST      \
> > +             HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR1
> > +     /*
> > +      * This offset where the fw_status register is located. The value
> > +      * is generally 4-byte aligned.
> > +      */
> > +     #define HCOMM_STATUS_TRUE_OFFSET_MASK
>  UINT32_C(0xfffffffc)
> > +     #define HCOMM_STATUS_TRUE_OFFSET_SFT            2
> > +} __attribute__((packed));
>
> Can you please prefer '__rte_packed' instead of the
> '__attribute__((packed))'?
> If you recognized I have updated all the occurrences in next-net already
> while
> rebasing on top of main repo. But please send new patches according it.
>
Sure, can do that. Thanks
  

Patch

diff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h b/drivers/net/bnxt/hsi_struct_def_dpdk.h
index da22b6249..fe18686f8 100644
--- a/drivers/net/bnxt/hsi_struct_def_dpdk.h
+++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h
@@ -38622,4 +38622,53 @@  struct hwrm_cfa_counter_qstats_output {
 	uint8_t	valid;
 } __rte_packed;
 
+/*
+ * This structure is fixed at the beginning of the ChiMP SRAM (GRC
+ * offset: 0x31001F0). Host software is expected to read from this
+ * location for a defined signature. If it exists, the software can
+ * assume the presence of this structure and the validity of the
+ * FW_STATUS location in the next field.
+ */
+/* hcomm_status (size:64b/8B) */
+struct hcomm_status {
+	uint32_t	sig_ver;
+	/*
+	 * This field defines the version of the structure. The latest
+	 * version value is 1.
+	 */
+	#define HCOMM_STATUS_VER_MASK		UINT32_C(0xff)
+	#define HCOMM_STATUS_VER_SFT		0
+	#define HCOMM_STATUS_VER_LATEST		UINT32_C(0x1)
+	#define HCOMM_STATUS_VER_LAST		HCOMM_STATUS_VER_LATEST
+	/*
+	 * This field is to store the signature value to indicate the
+	 * presence of the structure.
+	 */
+	#define HCOMM_STATUS_SIGNATURE_MASK	UINT32_C(0xffffff00)
+	#define HCOMM_STATUS_SIGNATURE_SFT	8
+	#define HCOMM_STATUS_SIGNATURE_VAL	(UINT32_C(0x484353) << 8)
+	#define HCOMM_STATUS_SIGNATURE_LAST	HCOMM_STATUS_SIGNATURE_VAL
+	uint32_t	fw_status_loc;
+	#define HCOMM_STATUS_TRUE_ADDR_SPACE_MASK	UINT32_C(0x3)
+	#define HCOMM_STATUS_TRUE_ADDR_SPACE_SFT	0
+	/* PCIE configuration space */
+	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_PCIE_CFG	UINT32_C(0x0)
+	/* GRC space */
+	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_GRC	UINT32_C(0x1)
+	/* BAR0 space */
+	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR0	UINT32_C(0x2)
+	/* BAR1 space */
+	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR1	UINT32_C(0x3)
+	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_LAST	\
+		HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR1
+	/*
+	 * This offset where the fw_status register is located. The value
+	 * is generally 4-byte aligned.
+	 */
+	#define HCOMM_STATUS_TRUE_OFFSET_MASK		UINT32_C(0xfffffffc)
+	#define HCOMM_STATUS_TRUE_OFFSET_SFT		2
+} __attribute__((packed));
+/* This is the GRC offset where the hcomm_status struct resides. */
+#define HCOMM_STATUS_STRUCT_LOC		0x31001F0UL
+
 #endif /* _HSI_STRUCT_DEF_DPDK_H_ */