Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 167230
b: refs/heads/master
c: 7725ccf
h: refs/heads/master
v: v3
  • Loading branch information
Jing Huang authored and James Bottomley committed Oct 2, 2009
1 parent 5d2f350 commit 1c2911f
Show file tree
Hide file tree
Showing 199 changed files with 49,190 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5415907af1f5ef80c95147bacbd321b0d4236dd5
refs/heads/master: 7725ccfda59715ecf8f99e3b520a0b84cc2ea79e
7 changes: 7 additions & 0 deletions trunk/MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,13 @@ L: netdev@vger.kernel.org
S: Supported
F: drivers/net/tg3.*

BROCADE BFA FC SCSI DRIVER
P: Jing Huang
M: huangj@brocade.com
L: linux-scsi@vger.kernel.org
S: Supported
F: drivers/scsi/bfa/

BSG (block layer generic sg v4 driver)
M: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
L: linux-scsi@vger.kernel.org
Expand Down
10 changes: 10 additions & 0 deletions trunk/drivers/scsi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1827,6 +1827,16 @@ config SCSI_SRP
To compile this driver as a module, choose M here: the
module will be called libsrp.

config SCSI_BFA_FC
tristate "Brocade BFA Fibre Channel Support"
depends on PCI && SCSI
select SCSI_FC_ATTRS
help
This bfa driver supports all Brocade PCIe FC/FCOE host adapters.

To compile this driver as a module, choose M here. The module will
be called bfa.

endif # SCSI_LOWLEVEL

source "drivers/scsi/pcmcia/Kconfig"
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/scsi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ obj-$(CONFIG_SCSI_QLOGIC_1280) += qla1280.o
obj-$(CONFIG_SCSI_QLA_FC) += qla2xxx/
obj-$(CONFIG_SCSI_QLA_ISCSI) += qla4xxx/
obj-$(CONFIG_SCSI_LPFC) += lpfc/
obj-$(CONFIG_SCSI_BFA_FC) += bfa/
obj-$(CONFIG_SCSI_PAS16) += pas16.o
obj-$(CONFIG_SCSI_T128) += t128.o
obj-$(CONFIG_SCSI_DMX3191D) += dmx3191d.o
Expand Down
15 changes: 15 additions & 0 deletions trunk/drivers/scsi/bfa/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
obj-$(CONFIG_SCSI_BFA_FC) := bfa.o

bfa-y := bfad.o bfad_intr.o bfad_os.o bfad_im.o bfad_attr.o bfad_fwimg.o

bfa-y += bfa_core.o bfa_ioc.o bfa_iocfc.o bfa_fcxp.o bfa_lps.o
bfa-y += bfa_hw_cb.o bfa_hw_ct.o bfa_intr.o bfa_timer.o bfa_rport.o
bfa-y += bfa_fcport.o bfa_port.o bfa_uf.o bfa_sgpg.o bfa_module.o bfa_ioim.o
bfa-y += bfa_itnim.o bfa_fcpim.o bfa_tskim.o bfa_log.o bfa_log_module.o
bfa-y += bfa_csdebug.o bfa_sm.o plog.o

bfa-y += fcbuild.o fabric.o fcpim.o vfapi.o fcptm.o bfa_fcs.o bfa_fcs_port.o
bfa-y += bfa_fcs_uf.o bfa_fcs_lport.o fab.o fdmi.o ms.o ns.o scn.o loop.o
bfa-y += lport_api.o n2n.o rport.o rport_api.o rport_ftrs.o vport.o

ccflags-y := -I$(obj) -I$(obj)/include -I$(obj)/include/cna
57 changes: 57 additions & 0 deletions trunk/drivers/scsi/bfa/bfa_callback_priv.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright (c) 2005-2009 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 __BFA_CALLBACK_PRIV_H__
#define __BFA_CALLBACK_PRIV_H__

#include <cs/bfa_q.h>

typedef void (*bfa_cb_cbfn_t) (void *cbarg, bfa_boolean_t complete);

/**
* Generic BFA callback element.
*/
struct bfa_cb_qe_s {
struct list_head qe;
bfa_cb_cbfn_t cbfn;
bfa_boolean_t once;
u32 rsvd;
void *cbarg;
};

#define bfa_cb_queue(__bfa, __hcb_qe, __cbfn, __cbarg) do { \
(__hcb_qe)->cbfn = (__cbfn); \
(__hcb_qe)->cbarg = (__cbarg); \
list_add_tail(&(__hcb_qe)->qe, &(__bfa)->comp_q); \
} while (0)

#define bfa_cb_dequeue(__hcb_qe) list_del(&(__hcb_qe)->qe)

#define bfa_cb_queue_once(__bfa, __hcb_qe, __cbfn, __cbarg) do { \
(__hcb_qe)->cbfn = (__cbfn); \
(__hcb_qe)->cbarg = (__cbarg); \
if (!(__hcb_qe)->once) { \
list_add_tail((__hcb_qe), &(__bfa)->comp_q); \
(__hcb_qe)->once = BFA_TRUE; \
} \
} while (0)

#define bfa_cb_queue_done(__hcb_qe) do { \
(__hcb_qe)->once = BFA_FALSE; \
} while (0)

#endif /* __BFA_CALLBACK_PRIV_H__ */
205 changes: 205 additions & 0 deletions trunk/drivers/scsi/bfa/bfa_cb_ioim_macros.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
/*
* Copyright (c) 2005-2009 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.
*/

/**
* bfa_cb_ioim_macros.h BFA IOIM driver interface macros.
*/

#ifndef __BFA_HCB_IOIM_MACROS_H__
#define __BFA_HCB_IOIM_MACROS_H__

#include <bfa_os_inc.h>
/*
* #include <linux/dma-mapping.h>
*
* #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h> #include
* <scsi/scsi_device.h> #include <scsi/scsi_host.h>
*/
#include "bfad_im_compat.h"

/*
* task attribute values in FCP-2 FCP_CMND IU
*/
#define SIMPLE_Q 0
#define HEAD_OF_Q 1
#define ORDERED_Q 2
#define ACA_Q 4
#define UNTAGGED 5

static inline lun_t
bfad_int_to_lun(u32 luno)
{
union {
u16 scsi_lun[4];
lun_t bfa_lun;
} lun;

lun.bfa_lun = 0;
lun.scsi_lun[0] = bfa_os_htons(luno);

return (lun.bfa_lun);
}

/**
* Get LUN for the I/O request
*/
#define bfa_cb_ioim_get_lun(__dio) \
bfad_int_to_lun(((struct scsi_cmnd *)__dio)->device->lun)

/**
* Get CDB for the I/O request
*/
static inline u8 *
bfa_cb_ioim_get_cdb(struct bfad_ioim_s *dio)
{
struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio;

return ((u8 *) cmnd->cmnd);
}

/**
* Get I/O direction (read/write) for the I/O request
*/
static inline enum fcp_iodir
bfa_cb_ioim_get_iodir(struct bfad_ioim_s *dio)
{
struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio;
enum dma_data_direction dmadir;

dmadir = cmnd->sc_data_direction;
if (dmadir == DMA_TO_DEVICE)
return FCP_IODIR_WRITE;
else if (dmadir == DMA_FROM_DEVICE)
return FCP_IODIR_READ;
else
return FCP_IODIR_NONE;
}

/**
* Get IO size in bytes for the I/O request
*/
static inline u32
bfa_cb_ioim_get_size(struct bfad_ioim_s *dio)
{
struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio;

return (scsi_bufflen(cmnd));
}

/**
* Get timeout for the I/O request
*/
static inline u8
bfa_cb_ioim_get_timeout(struct bfad_ioim_s *dio)
{
struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio;
/*
* TBD: need a timeout for scsi passthru
*/
if (cmnd->device->host == NULL)
return 4;

return 0;
}

/**
* Get SG element for the I/O request given the SG element index
*/
static inline union bfi_addr_u
bfa_cb_ioim_get_sgaddr(struct bfad_ioim_s *dio, int sgeid)
{
struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio;
struct scatterlist *sge;
u64 addr;

sge = (struct scatterlist *)scsi_sglist(cmnd) + sgeid;
addr = (u64) sg_dma_address(sge);

return (*(union bfi_addr_u *) &addr);
}

static inline u32
bfa_cb_ioim_get_sglen(struct bfad_ioim_s *dio, int sgeid)
{
struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio;
struct scatterlist *sge;
u32 len;

sge = (struct scatterlist *)scsi_sglist(cmnd) + sgeid;
len = sg_dma_len(sge);

return len;
}

/**
* Get Command Reference Number for the I/O request. 0 if none.
*/
static inline u8
bfa_cb_ioim_get_crn(struct bfad_ioim_s *dio)
{
return 0;
}

/**
* Get SAM-3 priority for the I/O request. 0 is default.
*/
static inline u8
bfa_cb_ioim_get_priority(struct bfad_ioim_s *dio)
{
return 0;
}

/**
* Get task attributes for the I/O request. Default is FCP_TASK_ATTR_SIMPLE(0).
*/
static inline u8
bfa_cb_ioim_get_taskattr(struct bfad_ioim_s *dio)
{
struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio;
u8 task_attr = UNTAGGED;

if (cmnd->device->tagged_supported) {
switch (cmnd->tag) {
case HEAD_OF_QUEUE_TAG:
task_attr = HEAD_OF_Q;
break;
case ORDERED_QUEUE_TAG:
task_attr = ORDERED_Q;
break;
default:
task_attr = SIMPLE_Q;
break;
}
}

return task_attr;
}

/**
* Get CDB length in bytes for the I/O request. Default is FCP_CMND_CDB_LEN(16).
*/
static inline u8
bfa_cb_ioim_get_cdblen(struct bfad_ioim_s *dio)
{
struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio;

return (cmnd->cmd_len);
}



#endif /* __BFA_HCB_IOIM_MACROS_H__ */
Loading

0 comments on commit 1c2911f

Please sign in to comment.