qlge: Add firmware/driver sub-command support.
authorRon Mercer <ron.mercer@qlogic.com>
Tue, 3 Nov 2009 13:49:30 +0000 (13:49 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 Nov 2009 13:01:37 +0000 (05:01 -0800)
These sub-commands are issued by another (FCoE) function requesting
an operation on a shared resource.

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/qlge/qlge.h
drivers/net/qlge/qlge_mpi.c

index 872e95ee40ee4405b754633f3e67b73870501d8e..5e4d3439043e4f453c8f25dc6c333277cf906316 100644 (file)
@@ -816,6 +816,18 @@ enum {
        MB_CMD_GET_MGMNT_TFK_CTL = 0x00000161, /* Get Mgmnt Traffic Control */
        MB_GET_MPI_TFK_STOPPED = (1 << 0),
        MB_GET_MPI_TFK_FIFO_EMPTY = (1 << 1),
+       /* Sub-commands for IDC request.
+        * This describes the reason for the
+        * IDC request.
+        */
+       MB_CMD_IOP_NONE = 0x0000,
+       MB_CMD_IOP_PREP_UPDATE_MPI      = 0x0001,
+       MB_CMD_IOP_COMP_UPDATE_MPI      = 0x0002,
+       MB_CMD_IOP_PREP_LINK_DOWN       = 0x0010,
+       MB_CMD_IOP_DVR_START     = 0x0100,
+       MB_CMD_IOP_FLASH_ACC     = 0x0101,
+       MB_CMD_IOP_RESTART_MPI  = 0x0102,
+       MB_CMD_IOP_CORE_DUMP_MPI        = 0x0103,
 
        /* Mailbox Command Status. */
        MB_CMD_STS_GOOD = 0x00004000,   /* Success. */
index bac7b86f2129ab0cc95b6112ab3bba44b45d751f..f5619fe87bb24100909b5f68f336d1e42981666c 100644 (file)
@@ -1038,8 +1038,11 @@ void ql_mpi_idc_work(struct work_struct *work)
        int status;
        struct mbox_params *mbcp = &qdev->idc_mbc;
        u32 aen;
+       int timeout;
 
+       rtnl_lock();
        aen = mbcp->mbox_out[1] >> 16;
+       timeout = (mbcp->mbox_out[1] >> 8) & 0xf;
 
        switch (aen) {
        default:
@@ -1047,22 +1050,61 @@ void ql_mpi_idc_work(struct work_struct *work)
                        "Bug: Unhandled IDC action.\n");
                break;
        case MB_CMD_PORT_RESET:
-       case MB_CMD_SET_PORT_CFG:
        case MB_CMD_STOP_FW:
                ql_link_off(qdev);
+       case MB_CMD_SET_PORT_CFG:
                /* Signal the resulting link up AEN
                 * that the frame routing and mac addr
                 * needs to be set.
                 * */
                set_bit(QL_CAM_RT_SET, &qdev->flags);
-               rtnl_lock();
-               status = ql_mb_idc_ack(qdev);
-               rtnl_unlock();
-               if (status) {
-                       QPRINTK(qdev, DRV, ERR,
-                       "Bug: No pending IDC!\n");
+               /* Do ACK if required */
+               if (timeout) {
+                       status = ql_mb_idc_ack(qdev);
+                       if (status)
+                               QPRINTK(qdev, DRV, ERR,
+                                       "Bug: No pending IDC!\n");
+               } else {
+                       QPRINTK(qdev, DRV, DEBUG,
+                                   "IDC ACK not required\n");
+                       status = 0; /* success */
+               }
+               break;
+
+       /* These sub-commands issued by another (FCoE)
+        * function are requesting to do an operation
+        * on the shared resource (MPI environment).
+        * We currently don't issue these so we just
+        * ACK the request.
+        */
+       case MB_CMD_IOP_RESTART_MPI:
+       case MB_CMD_IOP_PREP_LINK_DOWN:
+               /* Drop the link, reload the routing
+                * table when link comes up.
+                */
+               ql_link_off(qdev);
+               set_bit(QL_CAM_RT_SET, &qdev->flags);
+               /* Fall through. */
+       case MB_CMD_IOP_DVR_START:
+       case MB_CMD_IOP_FLASH_ACC:
+       case MB_CMD_IOP_CORE_DUMP_MPI:
+       case MB_CMD_IOP_PREP_UPDATE_MPI:
+       case MB_CMD_IOP_COMP_UPDATE_MPI:
+       case MB_CMD_IOP_NONE:   /*  an IDC without params */
+               /* Do ACK if required */
+               if (timeout) {
+                       status = ql_mb_idc_ack(qdev);
+                       if (status)
+                               QPRINTK(qdev, DRV, ERR,
+                                   "Bug: No pending IDC!\n");
+               } else {
+                       QPRINTK(qdev, DRV, DEBUG,
+                           "IDC ACK not required\n");
+                       status = 0; /* success */
                }
+               break;
        }
+       rtnl_unlock();
 }
 
 void ql_mpi_work(struct work_struct *work)