Commit b85daafe authored by Krishna Gudipati's avatar Krishna Gudipati Committed by James Bottomley

[SCSI] bfa: Add BSG interface to support ELS, CT and vendor commands.

- Added BSG interface support to BFA driver
- Adds support to send ELS/CT FC passthru commands and
  few vendor specific BSG requests.
Signed-off-by: default avatarKrishna Gudipati <kgudipat@brocade.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent 75332a70
obj-$(CONFIG_SCSI_BFA_FC) := bfa.o
bfa-y := bfad.o bfad_im.o bfad_attr.o bfad_debugfs.o
bfa-y := bfad.o bfad_im.o bfad_attr.o bfad_debugfs.o bfad_bsg.o
bfa-y += bfa_ioc.o bfa_ioc_cb.o bfa_ioc_ct.o bfa_hw_cb.o bfa_hw_ct.o
bfa-y += bfa_fcs.o bfa_fcs_lport.o bfa_fcs_rport.o bfa_fcs_fcpim.o bfa_fcbuild.o
bfa-y += bfa_port.o bfa_fcpim.o bfa_core.o bfa_svc.o
......@@ -130,6 +130,7 @@ enum bfa_status {
BFA_STATUS_ETIMER = 5, /* Timer expired - Retry, if persists,
* contact support */
BFA_STATUS_EPROTOCOL = 6, /* Protocol error */
BFA_STATUS_UNKNOWN_VFID = 11, /* VF_ID not found */
BFA_STATUS_DEVBUSY = 13, /* Device busy - Retry operation */
BFA_STATUS_UNKNOWN_LWWN = 18, /* LPORT PWWN not found */
BFA_STATUS_UNKNOWN_RWWN = 19, /* RPORT PWWN not found */
......@@ -138,11 +139,13 @@ enum bfa_status {
BFA_STATUS_UNSUPP_SPEED = 23, /* Invalid Speed Check speed setting */
BFA_STATUS_INVLD_DFSZ = 24, /* Invalid Max data field size */
BFA_STATUS_FABRIC_RJT = 29, /* Reject from attached fabric */
BFA_STATUS_PORT_OFFLINE = 34, /* Port is not online */
BFA_STATUS_VPORT_WWN_BP = 46, /* WWN is same as base port's WWN */
BFA_STATUS_NO_FCPIM_NEXUS = 52, /* No FCP Nexus exists with the rport */
BFA_STATUS_IOC_FAILURE = 56, /* IOC failure - Retry, if persists
* contact support */
BFA_STATUS_INVALID_WWN = 57, /* Invalid WWN */
BFA_STATUS_VERSION_FAIL = 70, /* Application/Driver version mismatch */
BFA_STATUS_DIAG_BUSY = 71, /* diag busy */
BFA_STATUS_ENOFSAVE = 78, /* No saved firmware trace */
BFA_STATUS_IOC_DISABLED = 82, /* IOC is already disabled */
......
......@@ -1369,6 +1369,45 @@ bfa_fcs_vf_lookup(struct bfa_fcs_s *fcs, u16 vf_id)
return NULL;
}
/*
* Return the list of local logical ports present in the given VF.
*
* @param[in] vf vf for which logical ports are returned
* @param[out] lpwwn returned logical port wwn list
* @param[in,out] nlports in:size of lpwwn list;
* out:total elements present,
* actual elements returned is limited by the size
*/
void
bfa_fcs_vf_get_ports(bfa_fcs_vf_t *vf, wwn_t lpwwn[], int *nlports)
{
struct list_head *qe;
struct bfa_fcs_vport_s *vport;
int i = 0;
struct bfa_fcs_s *fcs;
if (vf == NULL || lpwwn == NULL || *nlports == 0)
return;
fcs = vf->fcs;
bfa_trc(fcs, vf->vf_id);
bfa_trc(fcs, (uint32_t) *nlports);
lpwwn[i++] = vf->bport.port_cfg.pwwn;
list_for_each(qe, &vf->vport_q) {
if (i >= *nlports)
break;
vport = (struct bfa_fcs_vport_s *) qe;
lpwwn[i++] = vport->lport.port_cfg.pwwn;
}
bfa_trc(fcs, i);
*nlports = i;
}
/*
* BFA FCS PPORT ( physical port)
*/
......
......@@ -731,6 +731,7 @@ void bfa_fcs_exit(struct bfa_fcs_s *fcs);
* bfa fcs vf public functions
*/
bfa_fcs_vf_t *bfa_fcs_vf_lookup(struct bfa_fcs_s *fcs, u16 vf_id);
void bfa_fcs_vf_get_ports(bfa_fcs_vf_t *vf, wwn_t vpwwn[], int *nports);
/*
* fabric protected interface functions
......
......@@ -583,6 +583,8 @@ struct fc_function_template bfad_im_fc_function_template = {
.vport_create = bfad_im_vport_create,
.vport_delete = bfad_im_vport_delete,
.vport_disable = bfad_im_vport_disable,
.bsg_request = bfad_im_bsg_request,
.bsg_timeout = bfad_im_bsg_timeout,
};
struct fc_function_template bfad_im_vport_fc_function_template = {
......
This diff is collapsed.
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* All rights reserved
* www.brocade.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as
* published by the Free Software Foundation
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
#ifndef BFAD_BSG_H
#define BFAD_BSG_H
#include "bfa_defs.h"
#include "bfa_defs_fcs.h"
/* Definitions of vendor unique structures and command codes passed in
* using FC_BSG_HST_VENDOR message code.
*/
enum {
IOCMD_IOC_GET_ATTR = 0x1,
IOCMD_IOC_GET_INFO,
IOCMD_PORT_GET_ATTR,
IOCMD_LPORT_GET_ATTR,
IOCMD_RPORT_GET_ADDR,
IOCMD_FABRIC_GET_LPORTS,
IOCMD_ITNIM_GET_ATTR,
};
struct bfa_bsg_ioc_info_s {
bfa_status_t status;
u16 bfad_num;
u16 rsvd;
char serialnum[64];
char hwpath[BFA_STRING_32];
char adapter_hwpath[BFA_STRING_32];
char guid[BFA_ADAPTER_SYM_NAME_LEN*2];
char name[BFA_ADAPTER_SYM_NAME_LEN];
char port_name[BFA_ADAPTER_SYM_NAME_LEN];
char eth_name[BFA_ADAPTER_SYM_NAME_LEN];
wwn_t pwwn;
wwn_t nwwn;
wwn_t factorypwwn;
wwn_t factorynwwn;
mac_t mac;
mac_t factory_mac; /* Factory mac address */
mac_t current_mac; /* Currently assigned mac address */
enum bfa_ioc_type_e ioc_type;
u16 pvid; /* Port vlan id */
u16 rsvd1;
u32 host;
u32 bandwidth; /* For PF support */
u32 rsvd2;
};
struct bfa_bsg_ioc_attr_s {
bfa_status_t status;
u16 bfad_num;
u16 rsvd;
struct bfa_ioc_attr_s ioc_attr;
};
struct bfa_bsg_port_attr_s {
bfa_status_t status;
u16 bfad_num;
u16 rsvd;
struct bfa_port_attr_s attr;
};
struct bfa_bsg_lport_attr_s {
bfa_status_t status;
u16 bfad_num;
u16 vf_id;
wwn_t pwwn;
struct bfa_lport_attr_s port_attr;
};
struct bfa_bsg_rport_scsi_addr_s {
bfa_status_t status;
u16 bfad_num;
u16 vf_id;
wwn_t pwwn;
wwn_t rpwwn;
u32 host;
u32 bus;
u32 target;
u32 lun;
};
struct bfa_bsg_fabric_get_lports_s {
bfa_status_t status;
u16 bfad_num;
u16 vf_id;
u64 buf_ptr;
u32 nports;
u32 rsvd;
};
struct bfa_bsg_itnim_attr_s {
bfa_status_t status;
u16 bfad_num;
u16 vf_id;
wwn_t lpwwn;
wwn_t rpwwn;
struct bfa_itnim_attr_s attr;
};
struct bfa_bsg_fcpt_s {
bfa_status_t status;
u16 vf_id;
wwn_t lpwwn;
wwn_t dpwwn;
u32 tsecs;
int cts;
enum fc_cos cos;
struct fchs_s fchs;
};
#define bfa_bsg_fcpt_t struct bfa_bsg_fcpt_s
struct bfa_bsg_data {
int payload_len;
void *payload;
};
#define bfad_chk_iocmd_sz(__payload_len, __hdrsz, __bufsz) \
(((__payload_len) != ((__hdrsz) + (__bufsz))) ? \
BFA_STATUS_FAILED : BFA_STATUS_OK)
#endif /* BFAD_BSG_H */
......@@ -43,6 +43,7 @@
#include <scsi/scsi_tcq.h>
#include <scsi/scsi_transport_fc.h>
#include <scsi/scsi_transport.h>
#include <scsi/scsi_bsg_fc.h>
#include "bfa_modules.h"
#include "bfa_fcs.h"
......@@ -110,6 +111,7 @@ struct bfad_msix_s {
enum {
BFA_TRC_LDRV_BFAD = 1,
BFA_TRC_LDRV_IM = 2,
BFA_TRC_LDRV_BSG = 3,
};
enum bfad_port_pvb_type {
......
......@@ -778,6 +778,7 @@ struct scsi_host_template bfad_im_scsi_host_template = {
.use_clustering = ENABLE_CLUSTERING,
.shost_attrs = bfad_im_host_attrs,
.max_sectors = 0xFFFF,
.vendor_id = BFA_PCI_VENDOR_ID_BROCADE,
};
struct scsi_host_template bfad_im_vport_template = {
......
......@@ -141,4 +141,7 @@ extern struct device_attribute *bfad_im_vport_attrs[];
irqreturn_t bfad_intx(int irq, void *dev_id);
int bfad_im_bsg_request(struct fc_bsg_job *job);
int bfad_im_bsg_timeout(struct fc_bsg_job *job);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment