Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 188337
b: refs/heads/master
c: 2993cc7
h: refs/heads/master
i:
  188335: 95ff078
v: v3
  • Loading branch information
Krishna Gudipati authored and James Bottomley committed Mar 7, 2010
1 parent 434b8b8 commit 279a0a8
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 65 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9693e7dff5c2911b4e445f5f656ef57b3a5bffac
refs/heads/master: 2993cc71d1bff61999ade7f2b6b3ea2dd1e2c8d9
1 change: 1 addition & 0 deletions trunk/drivers/scsi/bfa/bfa_fcport.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ bfa_pport_aen_post(struct bfa_pport_s *pport, enum bfa_port_aen_event event)
char pwwn_ptr[BFA_STRING_32];
struct bfa_ioc_attr_s ioc_attr;

memset(&aen_data, 0, sizeof(aen_data));
wwn2str(pwwn_ptr, pwwn);
switch (event) {
case BFA_PORT_AEN_ONLINE:
Expand Down
32 changes: 21 additions & 11 deletions trunk/drivers/scsi/bfa/bfa_ioc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1731,6 +1731,21 @@ bfa_ioc_get_adapter_attr(struct bfa_ioc_s *ioc,
ad_attr->cna_capable = ioc->cna;
}

enum bfa_ioc_type_e
bfa_ioc_get_type(struct bfa_ioc_s *ioc)
{
if (!ioc->ctdev || ioc->fcmode)
return BFA_IOC_TYPE_FC;
else if (ioc->ioc_mc == BFI_MC_IOCFC)
return BFA_IOC_TYPE_FCoE;
else if (ioc->ioc_mc == BFI_MC_LL)
return BFA_IOC_TYPE_LL;
else {
bfa_assert(ioc->ioc_mc == BFI_MC_LL);
return BFA_IOC_TYPE_LL;
}
}

void
bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr)
{
Expand All @@ -1739,12 +1754,7 @@ bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr)
ioc_attr->state = bfa_sm_to_state(ioc_sm_table, ioc->fsm);
ioc_attr->port_id = ioc->port_id;

if (!ioc->ctdev || ioc->fcmode)
ioc_attr->ioc_type = BFA_IOC_TYPE_FC;
else if (ioc->ioc_mc == BFI_MC_IOCFC)
ioc_attr->ioc_type = BFA_IOC_TYPE_FCoE;
else if (ioc->ioc_mc == BFI_MC_LL)
ioc_attr->ioc_type = BFA_IOC_TYPE_LL;
ioc_attr->ioc_type = bfa_ioc_get_type(ioc);

bfa_ioc_get_adapter_attr(ioc, &ioc_attr->adapter_attr);

Expand Down Expand Up @@ -1860,7 +1870,7 @@ bfa_ioc_aen_post(struct bfa_ioc_s *ioc, enum bfa_ioc_aen_event event)
union bfa_aen_data_u aen_data;
struct bfa_log_mod_s *logmod = ioc->logm;
s32 inst_num = 0;
struct bfa_ioc_attr_s ioc_attr;
enum bfa_ioc_type_e ioc_type;

switch (event) {
case BFA_IOC_AEN_HBGOOD:
Expand All @@ -1884,8 +1894,8 @@ bfa_ioc_aen_post(struct bfa_ioc_s *ioc, enum bfa_ioc_aen_event event)

memset(&aen_data.ioc.pwwn, 0, sizeof(aen_data.ioc.pwwn));
memset(&aen_data.ioc.mac, 0, sizeof(aen_data.ioc.mac));
bfa_ioc_get_attr(ioc, &ioc_attr);
switch (ioc_attr.ioc_type) {
ioc_type = bfa_ioc_get_type(ioc);
switch (ioc_type) {
case BFA_IOC_TYPE_FC:
aen_data.ioc.pwwn = bfa_ioc_get_pwwn(ioc);
break;
Expand All @@ -1897,10 +1907,10 @@ bfa_ioc_aen_post(struct bfa_ioc_s *ioc, enum bfa_ioc_aen_event event)
aen_data.ioc.mac = bfa_ioc_get_mac(ioc);
break;
default:
bfa_assert(ioc_attr.ioc_type == BFA_IOC_TYPE_FC);
bfa_assert(ioc_type == BFA_IOC_TYPE_FC);
break;
}
aen_data.ioc.ioc_type = ioc_attr.ioc_type;
aen_data.ioc.ioc_type = ioc_type;
}

/**
Expand Down
9 changes: 1 addition & 8 deletions trunk/drivers/scsi/bfa/bfad.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,6 @@ bfad_drv_init(struct bfad_s *bfad)
bfa_status_t rc;
unsigned long flags;
struct bfa_fcs_driver_info_s driver_info;
int i;

bfad->cfg_data.rport_del_timeout = rport_del_timeout;
bfad->cfg_data.lun_queue_depth = bfa_lun_queue_depth;
Expand All @@ -697,12 +696,7 @@ bfad_drv_init(struct bfad_s *bfad)
bfa_init_log(&bfad->bfa, bfad->logmod);
bfa_init_trc(&bfad->bfa, bfad->trcmod);
bfa_init_aen(&bfad->bfa, bfad->aen);
INIT_LIST_HEAD(&bfad->file_q);
INIT_LIST_HEAD(&bfad->file_free_q);
for (i = 0; i < BFAD_AEN_MAX_APPS; i++) {
bfa_q_qe_init(&bfad->file_buf[i].qe);
list_add_tail(&bfad->file_buf[i].qe, &bfad->file_free_q);
}
memset(bfad->file_map, 0, sizeof(bfad->file_map));
bfa_init_plog(&bfad->bfa, &bfad->plog_buf);
bfa_plog_init(&bfad->plog_buf);
bfa_plog_str(&bfad->plog_buf, BFA_PL_MID_DRVR, BFA_PL_EID_DRIVER_START,
Expand Down Expand Up @@ -799,7 +793,6 @@ bfad_drv_uninit(struct bfad_s *bfad)
bfa_isr_disable(&bfad->bfa);
bfa_detach(&bfad->bfa);
bfad_remove_intr(bfad);
bfa_assert(list_empty(&bfad->file_q));
bfad_hal_mem_release(bfad);

bfad->bfad_flags &= ~BFAD_DRV_INIT_DONE;
Expand Down
12 changes: 1 addition & 11 deletions trunk/drivers/scsi/bfa/bfad_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,6 @@ struct bfad_cfg_param_s {
u32 binding_method;
};

#define BFAD_AEN_MAX_APPS 8
struct bfad_aen_file_s {
struct list_head qe;
struct bfad_s *bfad;
s32 ri;
s32 app_id;
};

/*
* BFAD (PCI function) data structure
*/
Expand Down Expand Up @@ -186,9 +178,7 @@ struct bfad_s {
struct bfa_log_mod_s *logmod;
struct bfa_aen_s *aen;
struct bfa_aen_s aen_buf;
struct bfad_aen_file_s file_buf[BFAD_AEN_MAX_APPS];
struct list_head file_q;
struct list_head file_free_q;
void *file_map[BFA_AEN_MAX_APP];
struct bfa_plog_s plog_buf;
int ref_count;
bfa_boolean_t ipfc_enabled;
Expand Down
50 changes: 27 additions & 23 deletions trunk/drivers/scsi/bfa/include/aen/bfa_aen.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,24 @@
#define __BFA_AEN_H__

#include "defs/bfa_defs_aen.h"
#include "defs/bfa_defs_status.h"
#include "cs/bfa_debug.h"

#define BFA_AEN_MAX_ENTRY 512
#define BFA_AEN_MAX_ENTRY 512

extern s32 bfa_aen_max_cfg_entry;
extern int bfa_aen_max_cfg_entry;
struct bfa_aen_s {
void *bfad;
s32 max_entry;
s32 write_index;
s32 read_index;
u32 bfad_num;
u32 seq_num;
int max_entry;
int write_index;
int read_index;
int bfad_num;
int seq_num;
void (*aen_cb_notify)(void *bfad);
void (*gettimeofday)(struct bfa_timeval_s *tv);
struct bfa_trc_mod_s *trcmod;
struct bfa_aen_entry_s list[BFA_AEN_MAX_ENTRY]; /* Must be the last */
struct bfa_trc_mod_s *trcmod;
int app_ri[BFA_AEN_MAX_APP]; /* For multiclient support */
struct bfa_aen_entry_s list[BFA_AEN_MAX_ENTRY]; /* Must be the last */
};


Expand All @@ -45,48 +48,49 @@ bfa_aen_set_max_cfg_entry(int max_entry)
bfa_aen_max_cfg_entry = max_entry;
}

static inline s32
static inline int
bfa_aen_get_max_cfg_entry(void)
{
return bfa_aen_max_cfg_entry;
}

static inline s32
static inline int
bfa_aen_get_meminfo(void)
{
return sizeof(struct bfa_aen_entry_s) * bfa_aen_get_max_cfg_entry();
}

static inline s32
static inline int
bfa_aen_get_wi(struct bfa_aen_s *aen)
{
return aen->write_index;
}

static inline s32
static inline int
bfa_aen_get_ri(struct bfa_aen_s *aen)
{
return aen->read_index;
}

static inline s32
bfa_aen_fetch_count(struct bfa_aen_s *aen, s32 read_index)
static inline int
bfa_aen_fetch_count(struct bfa_aen_s *aen, enum bfa_aen_app app_id)
{
return ((aen->write_index + aen->max_entry) - read_index)
bfa_assert((app_id < BFA_AEN_MAX_APP) && (app_id >= bfa_aen_app_bcu));
return ((aen->write_index + aen->max_entry) - aen->app_ri[app_id])
% aen->max_entry;
}

s32 bfa_aen_init(struct bfa_aen_s *aen, struct bfa_trc_mod_s *trcmod,
void *bfad, u32 inst_id, void (*aen_cb_notify)(void *),
int bfa_aen_init(struct bfa_aen_s *aen, struct bfa_trc_mod_s *trcmod,
void *bfad, int bfad_num, void (*aen_cb_notify)(void *),
void (*gettimeofday)(struct bfa_timeval_s *));

s32 bfa_aen_post(struct bfa_aen_s *aen, enum bfa_aen_category aen_category,
void bfa_aen_post(struct bfa_aen_s *aen, enum bfa_aen_category aen_category,
int aen_type, union bfa_aen_data_u *aen_data);

s32 bfa_aen_fetch(struct bfa_aen_s *aen, struct bfa_aen_entry_s *aen_entry,
s32 entry_space, s32 rii, s32 *ri_arr,
s32 ri_arr_cnt);
bfa_status_t bfa_aen_fetch(struct bfa_aen_s *aen,
struct bfa_aen_entry_s *aen_entry,
int entry_req, enum bfa_aen_app app_id, int *entry_ret);

s32 bfa_aen_get_inst(struct bfa_aen_s *aen);
int bfa_aen_get_inst(struct bfa_aen_s *aen);

#endif /* __BFA_AEN_H__ */
10 changes: 10 additions & 0 deletions trunk/drivers/scsi/bfa/include/defs/bfa_defs_aen.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@
#include <defs/bfa_defs_audit.h>
#include <defs/bfa_defs_ethport.h>

#define BFA_AEN_MAX_APP 5

enum bfa_aen_app {
bfa_aen_app_bcu = 0, /* No thread for bcu */
bfa_aen_app_hcm = 1,
bfa_aen_app_cim = 2,
bfa_aen_app_snia = 3,
bfa_aen_app_test = 4, /* To be removed after unit test */
};

enum bfa_aen_category {
BFA_AEN_CAT_ADAPTER = 1,
BFA_AEN_CAT_PORT = 2,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/scsi/bfa/include/defs/bfa_defs_ioc.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ enum bfa_ioc_aen_event {
* BFA IOC level event data, now just a place holder
*/
struct bfa_ioc_aen_data_s {
enum bfa_ioc_type_e ioc_type;
wwn_t pwwn;
s16 ioc_type;
mac_t mac;
};

Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/scsi/bfa/include/defs/bfa_defs_lport.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ enum bfa_lport_aen_event {
*/
struct bfa_lport_aen_data_s {
u16 vf_id; /* vf_id of this logical port */
u16 rsvd;
enum bfa_port_role roles; /* Logical port mode,IM/TM/IP etc */
s16 roles; /* Logical port mode,IM/TM/IP etc */
u32 rsvd;
wwn_t ppwwn; /* WWN of its physical port */
wwn_t lpwwn; /* WWN of this logical port */
};
Expand Down
17 changes: 9 additions & 8 deletions trunk/drivers/scsi/bfa/include/defs/bfa_defs_port.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,15 @@ enum bfa_port_aen_sfp_pom {
};

struct bfa_port_aen_data_s {
enum bfa_ioc_type_e ioc_type;
wwn_t pwwn; /* WWN of the physical port */
wwn_t fwwn; /* WWN of the fabric port */
mac_t mac; /* MAC address of the ethernet port,
* applicable to CNA port only */
int phy_port_num; /*! For SFP related events */
enum bfa_port_aen_sfp_pom level; /* Only transitions will
* be informed */
wwn_t pwwn; /* WWN of the physical port */
wwn_t fwwn; /* WWN of the fabric port */
s32 phy_port_num; /*! For SFP related events */
s16 ioc_type;
s16 level; /* Only transitions will
* be informed */
struct mac_s mac; /* MAC address of the ethernet port,
* applicable to CNA port only */
s16 rsvd;
};

#endif /* __BFA_DEFS_PORT_H__ */

0 comments on commit 279a0a8

Please sign in to comment.