diff options
author | Rasesh Mody <rmody@brocade.com> | 2011-07-22 04:07:42 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-22 20:01:13 -0400 |
commit | bd5a92e9a0eb03c4e7d04c64aa99e9050459faf5 (patch) | |
tree | fe2ea8edebefc97372a198346e1191f3db5bd87c /drivers/net/bna/bfa_ioc.c | |
parent | 0120b99c8d56b5d3f2d80aaf8769dea05ef80439 (diff) |
bna: IOC Event Notification Enhancement
Change details:
- Replace IOC HB failure event notification with a more generic mechanism
that is capable of sending enble, disable, and failed events to registered
modules. As a result, cee module event handling callback bfa_cee_hbfail()
is replaced with bfa_cee_notify() so that it can receive and handle
different events from IOC.
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bna/bfa_ioc.c')
-rw-r--r-- | drivers/net/bna/bfa_ioc.c | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/drivers/net/bna/bfa_ioc.c b/drivers/net/bna/bfa_ioc.c index 04bfb29bdc93..c52ef6347dc6 100644 --- a/drivers/net/bna/bfa_ioc.c +++ b/drivers/net/bna/bfa_ioc.c | |||
@@ -71,6 +71,7 @@ static void bfa_ioc_mbox_poll(struct bfa_ioc *ioc); | |||
71 | static void bfa_ioc_mbox_hbfail(struct bfa_ioc *ioc); | 71 | static void bfa_ioc_mbox_hbfail(struct bfa_ioc *ioc); |
72 | static void bfa_ioc_recover(struct bfa_ioc *ioc); | 72 | static void bfa_ioc_recover(struct bfa_ioc *ioc); |
73 | static void bfa_ioc_check_attr_wwns(struct bfa_ioc *ioc); | 73 | static void bfa_ioc_check_attr_wwns(struct bfa_ioc *ioc); |
74 | static void bfa_ioc_event_notify(struct bfa_ioc *, enum bfa_ioc_event); | ||
74 | static void bfa_ioc_disable_comp(struct bfa_ioc *ioc); | 75 | static void bfa_ioc_disable_comp(struct bfa_ioc *ioc); |
75 | static void bfa_ioc_lpu_stop(struct bfa_ioc *ioc); | 76 | static void bfa_ioc_lpu_stop(struct bfa_ioc *ioc); |
76 | static void bfa_ioc_fail_notify(struct bfa_ioc *ioc); | 77 | static void bfa_ioc_fail_notify(struct bfa_ioc *ioc); |
@@ -1123,23 +1124,28 @@ bfa_iocpf_sm_fail(struct bfa_iocpf *iocpf, enum iocpf_event event) | |||
1123 | * BFA IOC private functions | 1124 | * BFA IOC private functions |
1124 | */ | 1125 | */ |
1125 | 1126 | ||
1127 | /** | ||
1128 | * Notify common modules registered for notification. | ||
1129 | */ | ||
1126 | static void | 1130 | static void |
1127 | bfa_ioc_disable_comp(struct bfa_ioc *ioc) | 1131 | bfa_ioc_event_notify(struct bfa_ioc *ioc, enum bfa_ioc_event event) |
1128 | { | 1132 | { |
1133 | struct bfa_ioc_notify *notify; | ||
1129 | struct list_head *qe; | 1134 | struct list_head *qe; |
1130 | struct bfa_ioc_hbfail_notify *notify; | ||
1131 | 1135 | ||
1132 | ioc->cbfn->disable_cbfn(ioc->bfa); | 1136 | list_for_each(qe, &ioc->notify_q) { |
1133 | 1137 | notify = (struct bfa_ioc_notify *)qe; | |
1134 | /** | 1138 | notify->cbfn(notify->cbarg, event); |
1135 | * Notify common modules registered for notification. | ||
1136 | */ | ||
1137 | list_for_each(qe, &ioc->hb_notify_q) { | ||
1138 | notify = (struct bfa_ioc_hbfail_notify *) qe; | ||
1139 | notify->cbfn(notify->cbarg); | ||
1140 | } | 1139 | } |
1141 | } | 1140 | } |
1142 | 1141 | ||
1142 | static void | ||
1143 | bfa_ioc_disable_comp(struct bfa_ioc *ioc) | ||
1144 | { | ||
1145 | ioc->cbfn->disable_cbfn(ioc->bfa); | ||
1146 | bfa_ioc_event_notify(ioc, BFA_IOC_E_DISABLED); | ||
1147 | } | ||
1148 | |||
1143 | bool | 1149 | bool |
1144 | bfa_nw_ioc_sem_get(void __iomem *sem_reg) | 1150 | bfa_nw_ioc_sem_get(void __iomem *sem_reg) |
1145 | { | 1151 | { |
@@ -1650,17 +1656,11 @@ bfa_ioc_mbox_hbfail(struct bfa_ioc *ioc) | |||
1650 | static void | 1656 | static void |
1651 | bfa_ioc_fail_notify(struct bfa_ioc *ioc) | 1657 | bfa_ioc_fail_notify(struct bfa_ioc *ioc) |
1652 | { | 1658 | { |
1653 | struct list_head *qe; | ||
1654 | struct bfa_ioc_hbfail_notify *notify; | ||
1655 | |||
1656 | /** | 1659 | /** |
1657 | * Notify driver and common modules registered for notification. | 1660 | * Notify driver and common modules registered for notification. |
1658 | */ | 1661 | */ |
1659 | ioc->cbfn->hbfail_cbfn(ioc->bfa); | 1662 | ioc->cbfn->hbfail_cbfn(ioc->bfa); |
1660 | list_for_each(qe, &ioc->hb_notify_q) { | 1663 | bfa_ioc_event_notify(ioc, BFA_IOC_E_FAILED); |
1661 | notify = (struct bfa_ioc_hbfail_notify *) qe; | ||
1662 | notify->cbfn(notify->cbarg); | ||
1663 | } | ||
1664 | } | 1664 | } |
1665 | 1665 | ||
1666 | static void | 1666 | static void |
@@ -1839,7 +1839,7 @@ bfa_nw_ioc_attach(struct bfa_ioc *ioc, void *bfa, struct bfa_ioc_cbfn *cbfn) | |||
1839 | ioc->iocpf.ioc = ioc; | 1839 | ioc->iocpf.ioc = ioc; |
1840 | 1840 | ||
1841 | bfa_ioc_mbox_attach(ioc); | 1841 | bfa_ioc_mbox_attach(ioc); |
1842 | INIT_LIST_HEAD(&ioc->hb_notify_q); | 1842 | INIT_LIST_HEAD(&ioc->notify_q); |
1843 | 1843 | ||
1844 | bfa_fsm_set_state(ioc, bfa_ioc_sm_uninit); | 1844 | bfa_fsm_set_state(ioc, bfa_ioc_sm_uninit); |
1845 | bfa_fsm_send_event(ioc, IOC_E_RESET); | 1845 | bfa_fsm_send_event(ioc, IOC_E_RESET); |
@@ -1969,6 +1969,8 @@ bfa_nw_ioc_mbox_queue(struct bfa_ioc *ioc, struct bfa_mbox_cmd *cmd) | |||
1969 | * mailbox is free -- queue command to firmware | 1969 | * mailbox is free -- queue command to firmware |
1970 | */ | 1970 | */ |
1971 | bfa_ioc_mbox_send(ioc, cmd->msg, sizeof(cmd->msg)); | 1971 | bfa_ioc_mbox_send(ioc, cmd->msg, sizeof(cmd->msg)); |
1972 | |||
1973 | return; | ||
1972 | } | 1974 | } |
1973 | 1975 | ||
1974 | /** | 1976 | /** |
@@ -2005,14 +2007,24 @@ bfa_nw_ioc_error_isr(struct bfa_ioc *ioc) | |||
2005 | } | 2007 | } |
2006 | 2008 | ||
2007 | /** | 2009 | /** |
2010 | * return true if IOC is disabled | ||
2011 | */ | ||
2012 | bool | ||
2013 | bfa_nw_ioc_is_disabled(struct bfa_ioc *ioc) | ||
2014 | { | ||
2015 | return bfa_fsm_cmp_state(ioc, bfa_ioc_sm_disabling) || | ||
2016 | bfa_fsm_cmp_state(ioc, bfa_ioc_sm_disabled); | ||
2017 | } | ||
2018 | |||
2019 | /** | ||
2008 | * Add to IOC heartbeat failure notification queue. To be used by common | 2020 | * Add to IOC heartbeat failure notification queue. To be used by common |
2009 | * modules such as cee, port, diag. | 2021 | * modules such as cee, port, diag. |
2010 | */ | 2022 | */ |
2011 | void | 2023 | void |
2012 | bfa_nw_ioc_hbfail_register(struct bfa_ioc *ioc, | 2024 | bfa_nw_ioc_notify_register(struct bfa_ioc *ioc, |
2013 | struct bfa_ioc_hbfail_notify *notify) | 2025 | struct bfa_ioc_notify *notify) |
2014 | { | 2026 | { |
2015 | list_add_tail(¬ify->qe, &ioc->hb_notify_q); | 2027 | list_add_tail(¬ify->qe, &ioc->notify_q); |
2016 | } | 2028 | } |
2017 | 2029 | ||
2018 | #define BFA_MFG_NAME "Brocade" | 2030 | #define BFA_MFG_NAME "Brocade" |