All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kashyap Desai <kashyap.desai@broadcom.com>
To: Hannes Reinecke <hare@suse.de>, linux-scsi@vger.kernel.org
Cc: jejb@linux.ibm.com, martin.petersen@oracle.com,
	Steve Hagan <steve.hagan@broadcom.com>,
	Peter Rivera <peter.rivera@broadcom.com>,
	mpi3mr-drvr-developers <mpi3mr-linuxdrv.pdl@broadcom.com>,
	Sathya Prakash Veerichetty <sathya.prakash@broadcom.com>
Subject: RE: [PATCH 01/24] mpi3mr: add mpi30 Rev-R headers and Kconfig
Date: Tue, 2 Mar 2021 23:41:30 +0530	[thread overview]
Message-ID: <49f794c98f2c62f717f143271bb0ef84@mail.gmail.com> (raw)
In-Reply-To: <3c325481-753c-d2e0-9110-c08cf747ed8f@suse.de>

[-- Attachment #1: Type: text/plain, Size: 8238 bytes --]

> > +++ b/drivers/scsi/mpi3mr/mpi/mpi30_api.h
> > @@ -0,0 +1,21 @@
> > +/* SPDX-License-Identifier: GPL-2.0-or-later */
> > +/*
> > + *  Copyright 2019-2020 Broadcom Inc. All rights reserved.
> > + *
>
> 2020? Sure you don't want to update it to 2021?
This file is common for application, firmware, driver and UEFI driver and
we are consumer of this file. Further update on this driver will have
updated revision whenever maintainer of this header file post the new
update.

> > +typedef struct _MPI3_SCSI_IO_CDB_EEDP32 {
> > +    U8              CDB[20];                            /* 0x00 */
> > +    __be32          PrimaryReferenceTag;                /* 0x14 */
> > +    U16             PrimaryApplicationTag;              /* 0x18 */
> > +    U16             PrimaryApplicationTagMask;          /* 0x1A */
> > +    U32             TransferLength;                     /* 0x1C */
> > +} MPI3_SCSI_IO_CDB_EEDP32, MPI3_POINTER
> PTR_MPI3_SCSI_IO_CDB_EEDP32,
> > +  Mpi3ScsiIoCdbEedp32_t, MPI3_POINTER pMpi3ScsiIoCdbEedp32_t;
> > +
>
> As noted by Bart, this is a bit naff.
> I can live with having driver-specific typedefs, but having
> driver-specific typedefs _just_ for little endian is pushing it.
> (And incidentally also cancels your argument that you need the
> driver-specific types for cross-development.)
> So please, be consistent, and either use driver-specific typedefs
> throughout or revert to use basic linux types.

As explained earlier - This file is common for application, firmware,
driver and UEFI driver and we are consumer of this file.
Please consider header file as an exception.

>
> > +typedef union _MPI3_SCSO_IO_CDB_UNION {
> > +    U8                      CDB32[32];
> > +    MPI3_SCSI_IO_CDB_EEDP32 EEDP32;
> > +    MPI3_SGE_SIMPLE         SGE;
> > +} MPI3_SCSO_IO_CDB_UNION, MPI3_POINTER
> PTR_MPI3_SCSO_IO_CDB_UNION,
> > +  Mpi3ScsiIoCdb_t, MPI3_POINTER pMpi3ScsiIoCdb_t;
> > +
> > +typedef struct _MPI3_SCSI_IO_REQUEST {
> > +    U16                     HostTag;                        /* 0x00
*/
> > +    U8                      IOCUseOnly02;                   /* 0x02
*/
> > +    U8                      Function;                       /* 0x03
*/
> > +    U16                     IOCUseOnly04;                   /* 0x04
*/
> > +    U8                      IOCUseOnly06;                   /* 0x06
*/
> > +    U8                      MsgFlags;                       /* 0x07
*/
> > +    U16                     ChangeCount;                    /* 0x08
*/
> > +    U16                     DevHandle;                      /* 0x0A
*/
> > +    U32                     Flags;                          /* 0x0C
*/
> > +    U32                     SkipCount;                      /* 0x10
*/
> > +    U32                     DataLength;                     /* 0x14
*/
> > +    U8                      LUN[8];                         /* 0x18
*/
> > +    MPI3_SCSO_IO_CDB_UNION  CDB;                            /* 0x20
*/
> > +    MPI3_SGE_UNION          SGL[4];                         /* 0x40
*/
> > +} MPI3_SCSI_IO_REQUEST, MPI3_POINTER PTR_MPI3_SCSI_IO_REQUEST,
> > +  Mpi3SCSIIORequest_t, MPI3_POINTER pMpi3SCSIIORequest_t;
> > +
>
> Ho-hum.
> What happens if you have SGLs with more than 4 entries?

It is dynamic array. SGL[3] is primarily used in driver and you can notice
that it is for DIF/DIX metadata. Driver will fill simple SGLs in main
frame if there is a room.
Usually MPT Frame size is 128 byte, but another size can be defined by FW
as well. If there are more than 4 SGLs and driver cannot accommodate in
main frame, it will use chain frame which will have remaining SGLs.
Chain frame logic is same as generic mpt3sas interface (with slight
modification in fields based on hardware interface.)

> > diff --git a/drivers/scsi/mpi3mr/mpi/mpi30_type.h
> b/drivers/scsi/mpi3mr/mpi/mpi30_type.h
> > new file mode 100644
> > index 000000000000..5de35e7a660f
> > --- /dev/null
> > +++ b/drivers/scsi/mpi3mr/mpi/mpi30_type.h
> > @@ -0,0 +1,89 @@
> > +/* SPDX-License-Identifier: GPL-2.0-or-later */
> > +/*
> > + *  Copyright 2016-2020 Broadcom Inc. All rights reserved.
> > + *
> > + *           Name: mpi30_type.h
> > + *    Description: MPI basic type definitions
> > + *  Creation Date: 10/07/2016
> > + *        Version: 03.00.00
> > + */
> > +#ifndef MPI30_TYPE_H
> > +#define MPI30_TYPE_H     1
> > +
> >
> +/***************************************************************
> **************
> > + * Define MPI3_POINTER if it has not already been defined. By default
*
> > + * MPI3_POINTER is defined to be a near pointer. MPI3_POINTER can be
> defined *
> > + * as a far pointer by defining MPI3_POINTER as "far *" before this
header
> *
> > + * file is included.
*
> > +
> *****************************************************************
> ***********/
> > +#ifndef MPI3_POINTER
> > +#define MPI3_POINTER    *
> > +#endif  /* MPI3_POINTER */
> > +
> > +/* The basic types may have already been included by mpi_type.h or
> mpi2_type.h*/
> > +#if !defined(MPI_TYPE_H) && !defined(MPI2_TYPE_H)
> > +#if 1
> >
> +/***************************************************************
> **************
> > +*
> > +*               Basic Types
> > +*
> >
> +****************************************************************
> *************/
> > +
> > +typedef u8 U8;
> > +typedef __le16 U16;
> > +typedef __le32 U32;
> > +typedef __le64 U64 __aligned(4);
> > +
> >
> +/***************************************************************
> **************
> > +*
> > +*               Pointer Types
> > +*
> >
> +****************************************************************
> *************/
> > +
> > +typedef U8 * PU8;
> > +typedef U16 * PU16;
> > +typedef U32 * PU32;
> > +typedef U64 * PU64;
> > +#else
> >
> +/***************************************************************
> **************
> > + *              Basic Types
*
> > +
> *****************************************************************
> ***********/
> > +typedef int8_t      S8;
> > +typedef uint8_t     U8;
> > +typedef int16_t     S16;
> > +typedef uint16_t    U16;
> > +typedef int32_t     S32;
> > +typedef uint32_t    U32;
> > +typedef int64_t     S64;
> > +typedef uint64_t    U64;
> > +
> >
> +/***************************************************************
> **************
> > + *              Structure Types
*
> > +
> *****************************************************************
> ***********/
> > +typedef struct _S64struct {
> > +    U32         Low;
> > +    S32         High;
> > +} S64struct;
> > +
> > +typedef struct _U64struct {
> > +    U32         Low;
> > +    U32         High;
> > +} U64struct;
> > +
>
> I wonder why you need these structures on a 64-bit system ...

Please consider all such things in header file as an exception since
header files are common and created to all platforms and users must use
without modified version to avoid API compatibility issues.
Mpi3mr linux driver is not using this but some other users like UEFI
driver, windows drivers etc might be a consumer of it.

>
> >
> +/***************************************************************
> **************
> > + *              Pointer Types
*
> > +
> *****************************************************************
> ***********/
> > +typedef S8 * PS8;
> > +typedef U8 * PU8;
> > +typedef S16 * PS16;
> > +typedef U16 * PU16;
> > +typedef S32         *PS32;
> > +typedef U32         *PU32;
> > +typedef S64 * PS64;
> > +typedef U64 * PU64;
> > +typedef S64struct * PS64struct;
> > +typedef U64struct * PU64struct;
> > +#endif
> > +#endif  /* MPI_TYPE_H && MPI2_TYPE_H */
> > +
> > +#endif  /* MPI30_TYPE_H */
> >
> And I do agree with Bart, please kill the pointer types.
> It's not serving any purpose whatsoever.

Same as above.
>
> Cheers,
>
> Hannes
> --
> Dr. Hannes Reinecke		           Kernel Storage Architect
> hare@suse.de			                  +49 911 74053 688
> SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
> HRB 36809 (AG Nürnberg), GF: Felix Imendörffer

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

  reply	other threads:[~2021-03-02 19:56 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-22 10:11 [PATCH 00/24] Introducing mpi3mr driver Kashyap Desai
2020-12-22 10:11 ` [PATCH 01/24] mpi3mr: add mpi30 Rev-R headers and Kconfig Kashyap Desai
2020-12-22 18:15   ` Bart Van Assche
2020-12-23 13:33     ` Kashyap Desai
2021-02-23 12:30   ` Hannes Reinecke
2021-03-02 18:11     ` Kashyap Desai [this message]
2020-12-22 10:11 ` [PATCH 02/24] mpi3mr: base driver code Kashyap Desai
2020-12-27 14:14   ` kernel test robot
2020-12-27 14:14     ` kernel test robot
2021-02-23 12:55   ` Hannes Reinecke
2021-03-02 18:36     ` Kashyap Desai
2020-12-22 10:11 ` [PATCH 03/24] mpi3mr: create operational request and reply queue pair Kashyap Desai
2020-12-22 18:18   ` Bart Van Assche
2020-12-23 13:16     ` Kashyap Desai
2021-02-28 13:04   ` Hannes Reinecke
2021-03-02 19:05     ` Kashyap Desai
2020-12-22 10:11 ` [PATCH 04/24] mpi3mr: add support of queue command processing Kashyap Desai
2021-02-22 15:23   ` Tomas Henzl
2021-02-25 13:24     ` Kashyap Desai
2021-02-25 14:11       ` Tomas Henzl
2021-02-28 13:22   ` Hannes Reinecke
2021-03-08 18:25     ` Kashyap Desai
2020-12-22 10:11 ` [PATCH 05/24] mpi3mr: add support of internal watchdog thread Kashyap Desai
2021-02-28 13:24   ` Hannes Reinecke
2020-12-22 10:11 ` [PATCH 06/24] mpi3mr: add support of event handling part-1 Kashyap Desai
2020-12-27 13:14   ` kernel test robot
2020-12-27 13:14     ` kernel test robot
2021-02-22 15:31   ` Tomas Henzl
2021-02-25 13:36     ` Kashyap Desai
2021-03-01  6:47   ` Hannes Reinecke
2020-12-22 10:11 ` [PATCH 07/24] mpi3mr: add support of event handling pcie devices part-2 Kashyap Desai
2021-03-01  6:52   ` Hannes Reinecke
2020-12-22 10:11 ` [PATCH 08/24] mpi3mr: add support of event handling part-3 Kashyap Desai
2021-03-01  6:53   ` Hannes Reinecke
2020-12-22 10:11 ` [PATCH 09/24] mpi3mr: add support for recovering controller Kashyap Desai
2021-03-01  6:56   ` Hannes Reinecke
2020-12-22 10:11 ` [PATCH 10/24] mpi3mr: add support of timestamp sync with firmware Kashyap Desai
2021-03-01  6:57   ` Hannes Reinecke
2020-12-22 10:11 ` [PATCH 11/24] mpi3mr: print ioc info for debugging Kashyap Desai
2021-03-01  6:59   ` Hannes Reinecke
2020-12-22 10:11 ` [PATCH 12/24] mpi3mr: add bios_param shost template hook Kashyap Desai
2021-03-01  7:00   ` Hannes Reinecke
2020-12-22 10:11 ` [PATCH 13/24] mpi3mr: implement scsi error handler hooks Kashyap Desai
2021-03-01  7:09   ` Hannes Reinecke
2021-04-16 14:12     ` Kashyap Desai
2021-04-16 14:31       ` Hannes Reinecke
2020-12-22 10:11 ` [PATCH 14/24] mpi3mr: add change queue depth support Kashyap Desai
2021-03-01  7:10   ` Hannes Reinecke
2020-12-22 10:11 ` [PATCH 15/24] mpi3mr: allow certain commands during pci-remove hook Kashyap Desai
2021-03-01  7:11   ` Hannes Reinecke
2020-12-22 10:11 ` [PATCH 16/24] mpi3mr: hardware workaround for UNMAP commands to nvme drives Kashyap Desai
2021-03-01  7:13   ` Hannes Reinecke
2020-12-22 10:11 ` [PATCH 17/24] mpi3mr: add support of threaded isr Kashyap Desai
2020-12-27 13:51   ` kernel test robot
2020-12-27 13:51     ` kernel test robot
2021-03-01  7:14   ` Hannes Reinecke
2020-12-22 10:11 ` [PATCH 18/24] mpi3mr: add complete support of soft reset Kashyap Desai
2021-03-01  7:16   ` Hannes Reinecke
2020-12-22 10:11 ` [PATCH 19/24] mpi3mr: print pending host ios for debug Kashyap Desai
2021-03-01  7:16   ` Hannes Reinecke
2020-12-22 10:11 ` [PATCH 20/24] mpi3mr: wait for pending IO completions upon detection of VD IO timeout Kashyap Desai
2021-03-01  7:17   ` Hannes Reinecke
2020-12-22 10:11 ` [PATCH 21/24] mpi3mr: add support of PM suspend and resume Kashyap Desai
2021-02-22 15:32   ` Tomas Henzl
2021-02-25 13:37     ` Kashyap Desai
2021-03-01  7:18   ` Hannes Reinecke
2020-12-22 10:11 ` [PATCH 22/24] mpi3mr: add support of DSN secure fw check Kashyap Desai
2021-03-01  7:19   ` Hannes Reinecke
2020-12-22 10:11 ` [PATCH 23/24] mpi3mr: add eedp dif dix support Kashyap Desai
2021-02-22 15:37   ` Tomas Henzl
2021-02-25 13:39     ` Kashyap Desai
2021-03-01  7:20   ` Hannes Reinecke
2020-12-22 10:11 ` [PATCH 24/24] mpi3mr: add event handling debug prints Kashyap Desai
2021-03-01  7:20   ` Hannes Reinecke
2021-02-22 15:39 ` [PATCH 00/24] Introducing mpi3mr driver Tomas Henzl

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=49f794c98f2c62f717f143271bb0ef84@mail.gmail.com \
    --to=kashyap.desai@broadcom.com \
    --cc=hare@suse.de \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mpi3mr-linuxdrv.pdl@broadcom.com \
    --cc=peter.rivera@broadcom.com \
    --cc=sathya.prakash@broadcom.com \
    --cc=steve.hagan@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.