patch: handle data underrun conditions in ciss.c more gracefully

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

patch: handle data underrun conditions in ciss.c more gracefully

Srebrenko Sehic
The following patch fixes "cmd_stat 2 scsi_stat 0x0" error which
occurs on all Smart Array 6i/p600/64xx RAID controllers I've been able
to get my hands on.

What's I've noticed is that this error is only triggered when the
kernel boots and during an installation. After digging thru the code,
I figured out that the condition is triggered when an data underrun
occurs. According to the FreeBSD and Linux drivers, this condition can
safely be ignored.

This is implemented in the patch below and removes the "cmd_stat
warning". Tested on HP DL360G4p with a SA 6i controller.

The patch also removes the version/valance check all together (from
FreeBSD). According to HP, this check is not necessary.

I've done intensive stability testing with this patch. Like running
10xbonnies, doing a dd in the background and untarring ports.tar.gz at
the same time. No problems.

Could someone more skilled in OpenBSD SCSI take a look at this?

// haver

Index: ciss.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/ciss.c,v
retrieving revision 1.10
diff -u -r1.10 ciss.c
--- ciss.c      2005/12/02 11:35:10     1.10
+++ ciss.c      2005/12/09 14:03:09
@@ -142,12 +142,6 @@
                return -1;
        }

-       if (sc->cfg.version != CISS_VERSION &&
-           sc->cfg.version != CISS_VERSION3) {
-               printf(": unsupported version 0x%08x\n", sc->cfg.version);
-               return -1;
-       }
-
        if (!(sc->cfg.methods & CISS_METH_SIMPL)) {
                printf(": not simple 0x%08x\n", sc->cfg.methods);
                return -1;
@@ -620,6 +614,10 @@

        case CISS_ERR_TMO:
                xs->error = XS_TIMEOUT;
+               break;
+
+       case CISS_ERR_UNRUN:
+               xs->error = XS_DRIVER_STUFFUP;
                break;

        default:
Index: cissreg.h
===================================================================
RCS file: /cvs/src/sys/dev/ic/cissreg.h,v
retrieving revision 1.3
diff -u -r1.3 cissreg.h
--- cissreg.h   2005/11/23 14:46:47     1.3
+++ cissreg.h   2005/12/09 14:03:10
@@ -51,8 +51,6 @@
        u_int32_t       signature;
  #define        CISS_SIGNATURE  (*(u_int32_t *)"CISS")
        u_int32_t       version;
-#define        CISS_VERSION    1
-#define        CISS_VERSION3   3
        u_int32_t       methods;
 #define        CISS_METH_READY 0x0001
 #define        CISS_METH_SIMPL 0x0002

Reply | Threaded
Open this post in threaded view
|

Re: patch: handle data underrun conditions in ciss.c more gracefully

Marco Peereboom
What command fails with this status?

This is in violation with the scsi spec (nothing new here!).  So I am  
unsure if this is the right fix.  Depending on the command that fails  
we can make a better determination if it can be ignored this way.

On Dec 9, 2005, at 9:11 AM, Srebrenko Sehic wrote:

> The following patch fixes "cmd_stat 2 scsi_stat 0x0" error which
> occurs on all Smart Array 6i/p600/64xx RAID controllers I've been able
> to get my hands on.
>
> What's I've noticed is that this error is only triggered when the
> kernel boots and during an installation. After digging thru the code,
> I figured out that the condition is triggered when an data underrun
> occurs. According to the FreeBSD and Linux drivers, this condition can
> safely be ignored.
>
> This is implemented in the patch below and removes the "cmd_stat
> warning". Tested on HP DL360G4p with a SA 6i controller.
>
> The patch also removes the version/valance check all together (from
> FreeBSD). According to HP, this check is not necessary.
>
> I've done intensive stability testing with this patch. Like running
> 10xbonnies, doing a dd in the background and untarring ports.tar.gz at
> the same time. No problems.
>
> Could someone more skilled in OpenBSD SCSI take a look at this?
>
> // haver
>
> Index: ciss.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/ic/ciss.c,v
> retrieving revision 1.10
> diff -u -r1.10 ciss.c
> --- ciss.c      2005/12/02 11:35:10     1.10
> +++ ciss.c      2005/12/09 14:03:09
> @@ -142,12 +142,6 @@
>                 return -1;
>         }
>
> -       if (sc->cfg.version != CISS_VERSION &&
> -           sc->cfg.version != CISS_VERSION3) {
> -               printf(": unsupported version 0x%08x\n", sc-
> >cfg.version);
> -               return -1;
> -       }
> -
>         if (!(sc->cfg.methods & CISS_METH_SIMPL)) {
>                 printf(": not simple 0x%08x\n", sc->cfg.methods);
>                 return -1;
> @@ -620,6 +614,10 @@
>
>         case CISS_ERR_TMO:
>                 xs->error = XS_TIMEOUT;
> +               break;
> +
> +       case CISS_ERR_UNRUN:
> +               xs->error = XS_DRIVER_STUFFUP;
>                 break;
>
>         default:
> Index: cissreg.h
> ===================================================================
> RCS file: /cvs/src/sys/dev/ic/cissreg.h,v
> retrieving revision 1.3
> diff -u -r1.3 cissreg.h
> --- cissreg.h   2005/11/23 14:46:47     1.3
> +++ cissreg.h   2005/12/09 14:03:10
> @@ -51,8 +51,6 @@
>         u_int32_t       signature;
>   #define        CISS_SIGNATURE  (*(u_int32_t *)"CISS")
>         u_int32_t       version;
> -#define        CISS_VERSION    1
> -#define        CISS_VERSION3   3
>         u_int32_t       methods;
>  #define        CISS_METH_READY 0x0001
>  #define        CISS_METH_SIMPL 0x0002