192d7f7b0cde3ad2260e7462b40867b57efd49851James Smart/******************************************************************* 292d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * This file is part of the Emulex Linux Device Driver for * 392d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * Fibre Channel Host Bus Adapters. * 492d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * Copyright (C) 2004-2006 Emulex. All rights reserved. * 592d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * EMULEX and SLI are trademarks of Emulex. * 692d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * www.emulex.com * 792d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * Portions Copyright (C) 2004-2005 Christoph Hellwig * 892d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * * 992d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * This program is free software; you can redistribute it and/or * 1092d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * modify it under the terms of version 2 of the GNU General * 1192d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * Public License as published by the Free Software Foundation. * 1292d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * This program is distributed in the hope that it will be useful. * 1392d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND * 1492d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, * 1592d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE * 1692d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD * 1792d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * TO BE LEGALLY INVALID. See the GNU General Public License for * 1892d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * more details, a copy of which can be found in the file COPYING * 1992d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * included with this package. * 2092d7f7b0cde3ad2260e7462b40867b57efd49851James Smart *******************************************************************/ 2192d7f7b0cde3ad2260e7462b40867b57efd49851James Smart 2292d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#ifndef _H_LPFC_VPORT 2392d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define _H_LPFC_VPORT 2492d7f7b0cde3ad2260e7462b40867b57efd49851James Smart 2592d7f7b0cde3ad2260e7462b40867b57efd49851James Smart/* API version values (each will be an individual bit) */ 2692d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_API_VERSION_1 0x01 2792d7f7b0cde3ad2260e7462b40867b57efd49851James Smart 2892d7f7b0cde3ad2260e7462b40867b57efd49851James Smart/* Values returned via lpfc_vport_getinfo() */ 2992d7f7b0cde3ad2260e7462b40867b57efd49851James Smartstruct vport_info { 3092d7f7b0cde3ad2260e7462b40867b57efd49851James Smart 3192d7f7b0cde3ad2260e7462b40867b57efd49851James Smart uint32_t api_versions; 3292d7f7b0cde3ad2260e7462b40867b57efd49851James Smart uint8_t linktype; 3392d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_TYPE_PHYSICAL 0 3492d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_TYPE_VIRTUAL 1 3592d7f7b0cde3ad2260e7462b40867b57efd49851James Smart 3692d7f7b0cde3ad2260e7462b40867b57efd49851James Smart uint8_t state; 3792d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_STATE_OFFLINE 0 3892d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_STATE_ACTIVE 1 3992d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_STATE_FAILED 2 4092d7f7b0cde3ad2260e7462b40867b57efd49851James Smart 4192d7f7b0cde3ad2260e7462b40867b57efd49851James Smart uint8_t fail_reason; 4292d7f7b0cde3ad2260e7462b40867b57efd49851James Smart uint8_t prev_fail_reason; 4392d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_FAIL_UNKNOWN 0 4492d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_FAIL_LINKDOWN 1 4592d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_FAIL_FAB_UNSUPPORTED 2 4692d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_FAIL_FAB_NORESOURCES 3 4792d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_FAIL_FAB_LOGOUT 4 4892d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_FAIL_ADAP_NORESOURCES 5 4992d7f7b0cde3ad2260e7462b40867b57efd49851James Smart 5092d7f7b0cde3ad2260e7462b40867b57efd49851James Smart uint8_t node_name[8]; /* WWNN */ 5192d7f7b0cde3ad2260e7462b40867b57efd49851James Smart uint8_t port_name[8]; /* WWPN */ 5292d7f7b0cde3ad2260e7462b40867b57efd49851James Smart 5392d7f7b0cde3ad2260e7462b40867b57efd49851James Smart struct Scsi_Host *shost; 5492d7f7b0cde3ad2260e7462b40867b57efd49851James Smart 5592d7f7b0cde3ad2260e7462b40867b57efd49851James Smart/* Following values are valid only on physical links */ 5692d7f7b0cde3ad2260e7462b40867b57efd49851James Smart uint32_t vports_max; 5792d7f7b0cde3ad2260e7462b40867b57efd49851James Smart uint32_t vports_inuse; 5892d7f7b0cde3ad2260e7462b40867b57efd49851James Smart uint32_t rpi_max; 5992d7f7b0cde3ad2260e7462b40867b57efd49851James Smart uint32_t rpi_inuse; 6092d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_CNT_INVALID 0xFFFFFFFF 6192d7f7b0cde3ad2260e7462b40867b57efd49851James Smart}; 6292d7f7b0cde3ad2260e7462b40867b57efd49851James Smart 6392d7f7b0cde3ad2260e7462b40867b57efd49851James Smart/* data used in link creation */ 6492d7f7b0cde3ad2260e7462b40867b57efd49851James Smartstruct vport_data { 6592d7f7b0cde3ad2260e7462b40867b57efd49851James Smart uint32_t api_version; 6692d7f7b0cde3ad2260e7462b40867b57efd49851James Smart 6792d7f7b0cde3ad2260e7462b40867b57efd49851James Smart uint32_t options; 6892d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_OPT_AUTORETRY 0x01 6992d7f7b0cde3ad2260e7462b40867b57efd49851James Smart 7092d7f7b0cde3ad2260e7462b40867b57efd49851James Smart uint8_t node_name[8]; /* WWNN */ 7192d7f7b0cde3ad2260e7462b40867b57efd49851James Smart uint8_t port_name[8]; /* WWPN */ 7292d7f7b0cde3ad2260e7462b40867b57efd49851James Smart 7392d7f7b0cde3ad2260e7462b40867b57efd49851James Smart/* 7492d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * Upon successful creation, vport_shost will point to the new Scsi_Host 7592d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * structure for the new virtual link. 7692d7f7b0cde3ad2260e7462b40867b57efd49851James Smart */ 7792d7f7b0cde3ad2260e7462b40867b57efd49851James Smart struct Scsi_Host *vport_shost; 7892d7f7b0cde3ad2260e7462b40867b57efd49851James Smart}; 7992d7f7b0cde3ad2260e7462b40867b57efd49851James Smart 8092d7f7b0cde3ad2260e7462b40867b57efd49851James Smart/* API function return codes */ 8192d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_OK 0 8292d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_ERROR -1 8392d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_INVAL -2 8492d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_NOMEM -3 8592d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_NORESOURCES -4 8692d7f7b0cde3ad2260e7462b40867b57efd49851James Smart 8792d7f7b0cde3ad2260e7462b40867b57efd49851James Smartint lpfc_vport_create(struct fc_vport *, bool); 8892d7f7b0cde3ad2260e7462b40867b57efd49851James Smartint lpfc_vport_delete(struct fc_vport *); 8992d7f7b0cde3ad2260e7462b40867b57efd49851James Smartint lpfc_vport_getinfo(struct Scsi_Host *, struct vport_info *); 9092d7f7b0cde3ad2260e7462b40867b57efd49851James Smartint lpfc_vport_tgt_remove(struct Scsi_Host *, uint, uint); 91549e55cd2a1b83ea45ac17fb6c309654a3d371a4James Smartstruct lpfc_vport **lpfc_create_vport_work_array(struct lpfc_hba *); 920937282036d9ae798e02c9c69a8b2ef044048855James Smartvoid lpfc_destroy_vport_work_array(struct lpfc_hba *, struct lpfc_vport **); 9392d7f7b0cde3ad2260e7462b40867b57efd49851James Smart 9492d7f7b0cde3ad2260e7462b40867b57efd49851James Smart/* 9592d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * queuecommand VPORT-specific return codes. Specified in the host byte code. 9692d7f7b0cde3ad2260e7462b40867b57efd49851James Smart * Returned when the virtual link has failed or is not active. 9792d7f7b0cde3ad2260e7462b40867b57efd49851James Smart */ 9892d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define DID_VPORT_ERROR 0x0f 9992d7f7b0cde3ad2260e7462b40867b57efd49851James Smart 10092d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_INFO 0x1 10192d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_CREATE 0x2 10292d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#define VPORT_DELETE 0x4 10392d7f7b0cde3ad2260e7462b40867b57efd49851James Smart 10492d7f7b0cde3ad2260e7462b40867b57efd49851James Smartstruct vport_cmd_tag { 10592d7f7b0cde3ad2260e7462b40867b57efd49851James Smart uint32_t cmd; 10692d7f7b0cde3ad2260e7462b40867b57efd49851James Smart struct vport_data cdata; 10792d7f7b0cde3ad2260e7462b40867b57efd49851James Smart struct vport_info cinfo; 10892d7f7b0cde3ad2260e7462b40867b57efd49851James Smart void *vport; 10992d7f7b0cde3ad2260e7462b40867b57efd49851James Smart int vport_num; 11092d7f7b0cde3ad2260e7462b40867b57efd49851James Smart}; 11192d7f7b0cde3ad2260e7462b40867b57efd49851James Smart 11292d7f7b0cde3ad2260e7462b40867b57efd49851James Smartvoid lpfc_vport_set_state(struct lpfc_vport *vport, 11392d7f7b0cde3ad2260e7462b40867b57efd49851James Smart enum fc_vport_state new_state); 11492d7f7b0cde3ad2260e7462b40867b57efd49851James Smart 115ea2151b4e142fa2de0319d9dd80413a997bf435aJames Smartvoid lpfc_vport_reset_stat_data(struct lpfc_vport *); 116ea2151b4e142fa2de0319d9dd80413a997bf435aJames Smartvoid lpfc_alloc_bucket(struct lpfc_vport *); 117ea2151b4e142fa2de0319d9dd80413a997bf435aJames Smartvoid lpfc_free_bucket(struct lpfc_vport *); 118ea2151b4e142fa2de0319d9dd80413a997bf435aJames Smart 11992d7f7b0cde3ad2260e7462b40867b57efd49851James Smart#endif /* H_LPFC_VPORT */ 120