Back to home page

OSCL-LXR

 
 

    


0001 /*******************************************************************
0002  * This file is part of the Emulex Linux Device Driver for         *
0003  * Fibre Channel Host Bus Adapters.                                *
0004  * Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term *
0005  * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.     *
0006  * Copyright (C) 2004-2006 Emulex.  All rights reserved.           *
0007  * EMULEX and SLI are trademarks of Emulex.                        *
0008  * www.broadcom.com                                                *
0009  * Portions Copyright (C) 2004-2005 Christoph Hellwig              *
0010  *                                                                 *
0011  * This program is free software; you can redistribute it and/or   *
0012  * modify it under the terms of version 2 of the GNU General       *
0013  * Public License as published by the Free Software Foundation.    *
0014  * This program is distributed in the hope that it will be useful. *
0015  * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND          *
0016  * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,  *
0017  * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE      *
0018  * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
0019  * TO BE LEGALLY INVALID.  See the GNU General Public License for  *
0020  * more details, a copy of which can be found in the file COPYING  *
0021  * included with this package.                                     *
0022  *******************************************************************/
0023 
0024 #ifndef _H_LPFC_VPORT
0025 #define _H_LPFC_VPORT
0026 
0027 /* API version values (each will be an individual bit) */
0028 #define VPORT_API_VERSION_1 0x01
0029 
0030 /* Values returned via lpfc_vport_getinfo() */
0031 struct vport_info {
0032 
0033     uint32_t api_versions;
0034     uint8_t linktype;
0035 #define  VPORT_TYPE_PHYSICAL    0
0036 #define  VPORT_TYPE_VIRTUAL 1
0037 
0038     uint8_t state;
0039 #define  VPORT_STATE_OFFLINE    0
0040 #define  VPORT_STATE_ACTIVE 1
0041 #define  VPORT_STATE_FAILED 2
0042 
0043     uint8_t fail_reason;
0044     uint8_t prev_fail_reason;
0045 #define  VPORT_FAIL_UNKNOWN 0
0046 #define  VPORT_FAIL_LINKDOWN    1
0047 #define  VPORT_FAIL_FAB_UNSUPPORTED 2
0048 #define  VPORT_FAIL_FAB_NORESOURCES 3
0049 #define  VPORT_FAIL_FAB_LOGOUT  4
0050 #define  VPORT_FAIL_ADAP_NORESOURCES    5
0051 
0052     uint8_t node_name[8];   /* WWNN */
0053     uint8_t port_name[8];   /* WWPN */
0054 
0055     struct Scsi_Host *shost;
0056 
0057 /* Following values are valid only on physical links */
0058     uint32_t vports_max;
0059     uint32_t vports_inuse;
0060     uint32_t rpi_max;
0061     uint32_t rpi_inuse;
0062 #define  VPORT_CNT_INVALID  0xFFFFFFFF
0063 };
0064 
0065 /* data used  in link creation */
0066 struct vport_data {
0067     uint32_t api_version;
0068 
0069     uint32_t options;
0070 #define  VPORT_OPT_AUTORETRY    0x01
0071 
0072     uint8_t node_name[8];   /* WWNN */
0073     uint8_t port_name[8];   /* WWPN */
0074 
0075 /*
0076  *  Upon successful creation, vport_shost will point to the new Scsi_Host
0077  *  structure for the new virtual link.
0078  */
0079     struct Scsi_Host *vport_shost;
0080 };
0081 
0082 /* API function return codes */
0083 #define VPORT_OK    0
0084 #define VPORT_ERROR -1
0085 #define VPORT_INVAL -2
0086 #define VPORT_NOMEM -3
0087 #define VPORT_NORESOURCES   -4
0088 
0089 int lpfc_vport_create(struct fc_vport *, bool);
0090 int lpfc_vport_delete(struct fc_vport *);
0091 int lpfc_vport_getinfo(struct Scsi_Host *, struct vport_info *);
0092 int lpfc_vport_tgt_remove(struct Scsi_Host *, uint, uint);
0093 struct lpfc_vport **lpfc_create_vport_work_array(struct lpfc_hba *);
0094 void lpfc_destroy_vport_work_array(struct lpfc_hba *, struct lpfc_vport **);
0095 int lpfc_alloc_vpi(struct lpfc_hba *phba);
0096 
0097 /*
0098  *  queuecommand  VPORT-specific return codes. Specified in  the host byte code.
0099  *  Returned when the virtual link has failed or is not active.
0100  */
0101 #define  DID_VPORT_ERROR    0x0f
0102 
0103 #define VPORT_INFO  0x1
0104 #define VPORT_CREATE    0x2
0105 #define VPORT_DELETE    0x4
0106 
0107 struct vport_cmd_tag {
0108     uint32_t cmd;
0109     struct vport_data cdata;
0110     struct vport_info cinfo;
0111     void *vport;
0112     int vport_num;
0113 };
0114 
0115 void lpfc_vport_set_state(struct lpfc_vport *vport,
0116               enum fc_vport_state new_state);
0117 
0118 void lpfc_vport_reset_stat_data(struct lpfc_vport *);
0119 void lpfc_alloc_bucket(struct lpfc_vport *);
0120 void lpfc_free_bucket(struct lpfc_vport *);
0121 
0122 #endif /* H_LPFC_VPORT */