aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/brocade/bna/bfa_ioc.c
diff options
context:
space:
mode:
authorRasesh Mody <rmody@brocade.com>2011-08-08 12:21:35 -0400
committerDavid S. Miller <davem@davemloft.net>2011-08-11 10:30:12 -0400
commitaf027a34f34a8c0794a72dae8367e268eae89dbb (patch)
tree4af30be7fe275e1cb2b360c01e0d04a1ba81ad75 /drivers/net/ethernet/brocade/bna/bfa_ioc.c
parenta6a5580c4d90788d67a77c689d3ab22aa5eecfc3 (diff)
bna: MSGQ Implementation
Change details: - Currently modules communicate with the FW using 32 byte command and response register. This limits the size of the command and response messages exchanged with the FW to 32 bytes. We need a mechanism to exchange the comamnds and responses exchange with FW that exceeds 32 bytes. - MSGQ implementation provides that facility. It removes the assumption that command/response queue size is precisely calculated to accommodate all concurrent FW commands/responses. The queue depth is made variable now, defined by a macro. A waiting command list is implemented to hold all the commands when there is no place in the command queue. Callback is implemented for each command entry to invoke the module posting the command, when there is space in the command queue and the command was finally posted to the queue. Module/Object information is embedded in the response for tracking purpose. Signed-off-by: Rasesh Mody <rmody@brocade.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/brocade/bna/bfa_ioc.c')
-rw-r--r--drivers/net/ethernet/brocade/bna/bfa_ioc.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
index 3cdea65aee12..2d5c4fd778ee 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c
+++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
@@ -1968,18 +1968,22 @@ bfa_nw_ioc_mbox_regisr(struct bfa_ioc *ioc, enum bfi_mclass mc,
1968 * @param[in] ioc IOC instance 1968 * @param[in] ioc IOC instance
1969 * @param[i] cmd Mailbox command 1969 * @param[i] cmd Mailbox command
1970 */ 1970 */
1971void 1971bool
1972bfa_nw_ioc_mbox_queue(struct bfa_ioc *ioc, struct bfa_mbox_cmd *cmd) 1972bfa_nw_ioc_mbox_queue(struct bfa_ioc *ioc, struct bfa_mbox_cmd *cmd,
1973 bfa_mbox_cmd_cbfn_t cbfn, void *cbarg)
1973{ 1974{
1974 struct bfa_ioc_mbox_mod *mod = &ioc->mbox_mod; 1975 struct bfa_ioc_mbox_mod *mod = &ioc->mbox_mod;
1975 u32 stat; 1976 u32 stat;
1976 1977
1978 cmd->cbfn = cbfn;
1979 cmd->cbarg = cbarg;
1980
1977 /** 1981 /**
1978 * If a previous command is pending, queue new command 1982 * If a previous command is pending, queue new command
1979 */ 1983 */
1980 if (!list_empty(&mod->cmd_q)) { 1984 if (!list_empty(&mod->cmd_q)) {
1981 list_add_tail(&cmd->qe, &mod->cmd_q); 1985 list_add_tail(&cmd->qe, &mod->cmd_q);
1982 return; 1986 return true;
1983 } 1987 }
1984 1988
1985 /** 1989 /**
@@ -1988,7 +1992,7 @@ bfa_nw_ioc_mbox_queue(struct bfa_ioc *ioc, struct bfa_mbox_cmd *cmd)
1988 stat = readl(ioc->ioc_regs.hfn_mbox_cmd); 1992 stat = readl(ioc->ioc_regs.hfn_mbox_cmd);
1989 if (stat) { 1993 if (stat) {
1990 list_add_tail(&cmd->qe, &mod->cmd_q); 1994 list_add_tail(&cmd->qe, &mod->cmd_q);
1991 return; 1995 return true;
1992 } 1996 }
1993 1997
1994 /** 1998 /**
@@ -1996,7 +2000,7 @@ bfa_nw_ioc_mbox_queue(struct bfa_ioc *ioc, struct bfa_mbox_cmd *cmd)
1996 */ 2000 */
1997 bfa_ioc_mbox_send(ioc, cmd->msg, sizeof(cmd->msg)); 2001 bfa_ioc_mbox_send(ioc, cmd->msg, sizeof(cmd->msg));
1998 2002
1999 return; 2003 return false;
2000} 2004}
2001 2005
2002/** 2006/**