119 lines · c
1/*******************************************************************2 * This file is part of the Emulex Linux Device Driver for *3 * Fibre Channel Host Bus Adapters. *4 * Copyright (C) 2017-2022 Broadcom. All Rights Reserved. The term *5 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. *6 * Copyright (C) 2004-2006 Emulex. All rights reserved. *7 * EMULEX and SLI are trademarks of Emulex. *8 * www.broadcom.com *9 * Portions Copyright (C) 2004-2005 Christoph Hellwig *10 * *11 * This program is free software; you can redistribute it and/or *12 * modify it under the terms of version 2 of the GNU General *13 * Public License as published by the Free Software Foundation. *14 * This program is distributed in the hope that it will be useful. *15 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND *16 * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, *17 * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE *18 * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *19 * TO BE LEGALLY INVALID. See the GNU General Public License for *20 * more details, a copy of which can be found in the file COPYING *21 * included with this package. *22 *******************************************************************/23 24#ifndef _H_LPFC_VPORT25#define _H_LPFC_VPORT26 27/* API version values (each will be an individual bit) */28#define VPORT_API_VERSION_1 0x0129 30/* Values returned via lpfc_vport_getinfo() */31struct vport_info {32 33 uint32_t api_versions;34 uint8_t linktype;35#define VPORT_TYPE_PHYSICAL 036#define VPORT_TYPE_VIRTUAL 137 38 uint8_t state;39#define VPORT_STATE_OFFLINE 040#define VPORT_STATE_ACTIVE 141#define VPORT_STATE_FAILED 242 43 uint8_t fail_reason;44 uint8_t prev_fail_reason;45#define VPORT_FAIL_UNKNOWN 046#define VPORT_FAIL_LINKDOWN 147#define VPORT_FAIL_FAB_UNSUPPORTED 248#define VPORT_FAIL_FAB_NORESOURCES 349#define VPORT_FAIL_FAB_LOGOUT 450#define VPORT_FAIL_ADAP_NORESOURCES 551 52 uint8_t node_name[8]; /* WWNN */53 uint8_t port_name[8]; /* WWPN */54 55 struct Scsi_Host *shost;56 57/* Following values are valid only on physical links */58 uint32_t vports_max;59 uint32_t vports_inuse;60 uint32_t rpi_max;61 uint32_t rpi_inuse;62#define VPORT_CNT_INVALID 0xFFFFFFFF63};64 65/* data used in link creation */66struct vport_data {67 uint32_t api_version;68 69 uint32_t options;70#define VPORT_OPT_AUTORETRY 0x0171 72 uint8_t node_name[8]; /* WWNN */73 uint8_t port_name[8]; /* WWPN */74 75/*76 * Upon successful creation, vport_shost will point to the new Scsi_Host77 * structure for the new virtual link.78 */79 struct Scsi_Host *vport_shost;80};81 82/* API function return codes */83#define VPORT_OK 084#define VPORT_ERROR -185#define VPORT_INVAL -286#define VPORT_NOMEM -387#define VPORT_NORESOURCES -488 89int lpfc_vport_create(struct fc_vport *, bool);90int lpfc_vport_delete(struct fc_vport *);91int lpfc_vport_getinfo(struct Scsi_Host *, struct vport_info *);92int lpfc_vport_tgt_remove(struct Scsi_Host *, uint, uint);93struct lpfc_vport **lpfc_create_vport_work_array(struct lpfc_hba *);94void lpfc_destroy_vport_work_array(struct lpfc_hba *, struct lpfc_vport **);95int lpfc_alloc_vpi(struct lpfc_hba *phba);96 97/*98 * queuecommand VPORT-specific return codes. Specified in the host byte code.99 * Returned when the virtual link has failed or is not active.100 */101#define DID_VPORT_ERROR 0x0f102 103#define VPORT_INFO 0x1104#define VPORT_CREATE 0x2105#define VPORT_DELETE 0x4106 107struct vport_cmd_tag {108 uint32_t cmd;109 struct vport_data cdata;110 struct vport_info cinfo;111 void *vport;112 int vport_num;113};114 115void lpfc_vport_set_state(struct lpfc_vport *vport,116 enum fc_vport_state new_state);117 118#endif /* H_LPFC_VPORT */119