Print this page
10689 srpt_cm_conn_closed_hdlr() needs a smatch fix


   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 /*




  27  * IB CM handlers for s Solaris SCSI RDMA Protocol Target (SRP)
  28  * transport port provider module for the COMSTAR framework.
  29  */
  30 
  31 #include <sys/cpuvar.h>
  32 #include <sys/types.h>
  33 #include <sys/conf.h>
  34 #include <sys/stat.h>
  35 #include <sys/file.h>
  36 #include <sys/ddi.h>
  37 #include <sys/sunddi.h>
  38 #include <sys/modctl.h>
  39 #include <sys/sysmacros.h>
  40 #include <sys/sdt.h>
  41 #include <sys/taskq.h>
  42 #include <sys/ib/ibtl/ibti.h>
  43 
  44 #include <sys/stmf.h>
  45 #include <sys/stmf_ioctl.h>
  46 #include <sys/portif.h>


 227                  * Cleanup the channel (which will remove the targets
 228                  * reference) and then release CM's reference.
 229                  */
 230                 SRPT_DPRINTF_L3("cm_conn_closed_hdlr, local close call-back");
 231                 srpt_ch_cleanup(ch);
 232                 srpt_ch_release_ref(ch, 1);
 233                 break;
 234 
 235         case IBT_CM_CLOSED_DREQ_RCVD:
 236         case IBT_CM_CLOSED_REJ_RCVD:
 237         case IBT_CM_CLOSED_STALE:
 238                 /*
 239                  * These cases indicate that the SRP initiator is closing
 240                  * the channel.  CM will have already closed the RC channel,
 241                  * so simply initiate cleanup which will remove the target
 242                  * ports reference to the channel and then release the
 243                  * reference held by the CM.
 244                  */
 245                 SRPT_DPRINTF_L3("cm_conn_closed_hdlr, remote close,"
 246                     " free channel");
 247                 if (ch != NULL) {
 248                         srpt_ch_cleanup(ch);
 249                         srpt_ch_release_ref(ch, 1);
 250                 } else {
 251                         SRPT_DPRINTF_L2("cm_conn_closed_hdlr, NULL channel");
 252                 }
 253                 break;
 254 
 255         default:
 256                 SRPT_DPRINTF_L2("cm_conn_closed_hdlr, unknown close type (%d)",
 257                     event->cm_event.closed);
 258                 status = IBT_CM_DEFAULT;
 259                 break;
 260         }
 261         return (status);
 262 }
 263 
 264 /*
 265  * srpt_cm_failure_hdlr() - Called when the channel is in error.  Cleanup
 266  * and release the channel.
 267  */
 268 static ibt_cm_status_t
 269 srpt_cm_failure_hdlr(ibt_cm_event_t *event)
 270 {
 271         srpt_channel_t          *ch;
 272 




   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 /*
  27  * Copyright 2019, Joyent, Inc.
  28  */
  29 
  30 /*
  31  * IB CM handlers for s Solaris SCSI RDMA Protocol Target (SRP)
  32  * transport port provider module for the COMSTAR framework.
  33  */
  34 
  35 #include <sys/cpuvar.h>
  36 #include <sys/types.h>
  37 #include <sys/conf.h>
  38 #include <sys/stat.h>
  39 #include <sys/file.h>
  40 #include <sys/ddi.h>
  41 #include <sys/sunddi.h>
  42 #include <sys/modctl.h>
  43 #include <sys/sysmacros.h>
  44 #include <sys/sdt.h>
  45 #include <sys/taskq.h>
  46 #include <sys/ib/ibtl/ibti.h>
  47 
  48 #include <sys/stmf.h>
  49 #include <sys/stmf_ioctl.h>
  50 #include <sys/portif.h>


 231                  * Cleanup the channel (which will remove the targets
 232                  * reference) and then release CM's reference.
 233                  */
 234                 SRPT_DPRINTF_L3("cm_conn_closed_hdlr, local close call-back");
 235                 srpt_ch_cleanup(ch);
 236                 srpt_ch_release_ref(ch, 1);
 237                 break;
 238 
 239         case IBT_CM_CLOSED_DREQ_RCVD:
 240         case IBT_CM_CLOSED_REJ_RCVD:
 241         case IBT_CM_CLOSED_STALE:
 242                 /*
 243                  * These cases indicate that the SRP initiator is closing
 244                  * the channel.  CM will have already closed the RC channel,
 245                  * so simply initiate cleanup which will remove the target
 246                  * ports reference to the channel and then release the
 247                  * reference held by the CM.
 248                  */
 249                 SRPT_DPRINTF_L3("cm_conn_closed_hdlr, remote close,"
 250                     " free channel");

 251                 srpt_ch_cleanup(ch);
 252                 srpt_ch_release_ref(ch, 1);



 253                 break;
 254 
 255         default:
 256                 SRPT_DPRINTF_L2("cm_conn_closed_hdlr, unknown close type (%d)",
 257                     event->cm_event.closed);
 258                 status = IBT_CM_DEFAULT;
 259                 break;
 260         }
 261         return (status);
 262 }
 263 
 264 /*
 265  * srpt_cm_failure_hdlr() - Called when the channel is in error.  Cleanup
 266  * and release the channel.
 267  */
 268 static ibt_cm_status_t
 269 srpt_cm_failure_hdlr(ibt_cm_event_t *event)
 270 {
 271         srpt_channel_t          *ch;
 272