Lines Matching refs:mbx
494 static inline void qlcnic_83xx_notify_mbx_response(struct qlcnic_mailbox *mbx) in qlcnic_83xx_notify_mbx_response() argument
496 mbx->rsp_status = QLC_83XX_MBX_RESPONSE_ARRIVED; in qlcnic_83xx_notify_mbx_response()
497 complete(&mbx->completion); in qlcnic_83xx_notify_mbx_response()
503 struct qlcnic_mailbox *mbx = adapter->ahw->mailbox; in qlcnic_83xx_poll_process_aen() local
506 spin_lock_irqsave(&mbx->aen_lock, flags); in qlcnic_83xx_poll_process_aen()
515 if (mbx->rsp_status != rsp_status) in qlcnic_83xx_poll_process_aen()
516 qlcnic_83xx_notify_mbx_response(mbx); in qlcnic_83xx_poll_process_aen()
520 spin_unlock_irqrestore(&mbx->aen_lock, flags); in qlcnic_83xx_poll_process_aen()
851 struct qlcnic_mailbox *mbx = adapter->ahw->mailbox; in qlcnic_83xx_issue_cmd() local
856 if (!mbx) in qlcnic_83xx_issue_cmd()
861 err = mbx->ops->enqueue_cmd(adapter, cmd, &timeout); in qlcnic_83xx_issue_cmd()
877 flush_workqueue(mbx->work_q); in qlcnic_83xx_issue_cmd()
896 int qlcnic_83xx_alloc_mbx_args(struct qlcnic_cmd_args *mbx, in qlcnic_83xx_alloc_mbx_args() argument
903 memset(mbx, 0, sizeof(struct qlcnic_cmd_args)); in qlcnic_83xx_alloc_mbx_args()
908 mbx->op_type = QLC_83XX_FW_MBX_CMD; in qlcnic_83xx_alloc_mbx_args()
909 mbx->req.num = mbx_tbl[i].in_args; in qlcnic_83xx_alloc_mbx_args()
910 mbx->rsp.num = mbx_tbl[i].out_args; in qlcnic_83xx_alloc_mbx_args()
911 mbx->req.arg = kcalloc(mbx->req.num, sizeof(u32), in qlcnic_83xx_alloc_mbx_args()
913 if (!mbx->req.arg) in qlcnic_83xx_alloc_mbx_args()
915 mbx->rsp.arg = kcalloc(mbx->rsp.num, sizeof(u32), in qlcnic_83xx_alloc_mbx_args()
917 if (!mbx->rsp.arg) { in qlcnic_83xx_alloc_mbx_args()
918 kfree(mbx->req.arg); in qlcnic_83xx_alloc_mbx_args()
919 mbx->req.arg = NULL; in qlcnic_83xx_alloc_mbx_args()
923 mbx->req.arg[0] = (type | (mbx->req.num << 16) | temp); in qlcnic_83xx_alloc_mbx_args()
924 mbx->cmd_op = type; in qlcnic_83xx_alloc_mbx_args()
1017 struct qlcnic_mailbox *mbx = ahw->mailbox; in qlcnic_83xx_process_aen() local
1020 spin_lock_irqsave(&mbx->aen_lock, flags); in qlcnic_83xx_process_aen()
1027 if (mbx->rsp_status != rsp_status) in qlcnic_83xx_process_aen()
1028 qlcnic_83xx_notify_mbx_response(mbx); in qlcnic_83xx_process_aen()
1031 spin_unlock_irqrestore(&mbx->aen_lock, flags); in qlcnic_83xx_process_aen()
1325 struct qlcnic_tx_mbx mbx; in qlcnic_83xx_create_tx_ctx() local
1335 memset(&mbx, 0, sizeof(struct qlcnic_tx_mbx)); in qlcnic_83xx_create_tx_ctx()
1338 mbx.phys_addr_low = LSD(tx->phys_addr); in qlcnic_83xx_create_tx_ctx()
1339 mbx.phys_addr_high = MSD(tx->phys_addr); in qlcnic_83xx_create_tx_ctx()
1340 mbx.cnsmr_index_low = LSD(tx->hw_cons_phys_addr); in qlcnic_83xx_create_tx_ctx()
1341 mbx.cnsmr_index_high = MSD(tx->hw_cons_phys_addr); in qlcnic_83xx_create_tx_ctx()
1342 mbx.size = tx->num_desc; in qlcnic_83xx_create_tx_ctx()
1354 mbx.intr_id = msix_id; in qlcnic_83xx_create_tx_ctx()
1356 mbx.intr_id = 0xffff; in qlcnic_83xx_create_tx_ctx()
1357 mbx.src = 0; in qlcnic_83xx_create_tx_ctx()
1373 memcpy(buf, &mbx, sizeof(struct qlcnic_tx_mbx)); in qlcnic_83xx_create_tx_ctx()
2350 struct qlcnic_mailbox *mbx; in qlcnic_83xx_handle_aen() local
2353 mbx = adapter->ahw->mailbox; in qlcnic_83xx_handle_aen()
2354 spin_lock_irqsave(&mbx->aen_lock, flags); in qlcnic_83xx_handle_aen()
2363 if (mbx->rsp_status != rsp_status) in qlcnic_83xx_handle_aen()
2364 qlcnic_83xx_notify_mbx_response(mbx); in qlcnic_83xx_handle_aen()
2372 spin_unlock_irqrestore(&mbx->aen_lock, flags); in qlcnic_83xx_handle_aen()
3864 void qlcnic_83xx_reinit_mbx_work(struct qlcnic_mailbox *mbx) in qlcnic_83xx_reinit_mbx_work() argument
3866 reinit_completion(&mbx->completion); in qlcnic_83xx_reinit_mbx_work()
3867 set_bit(QLC_83XX_MBX_READY, &mbx->status); in qlcnic_83xx_reinit_mbx_work()
3870 void qlcnic_83xx_free_mailbox(struct qlcnic_mailbox *mbx) in qlcnic_83xx_free_mailbox() argument
3872 if (!mbx) in qlcnic_83xx_free_mailbox()
3875 destroy_workqueue(mbx->work_q); in qlcnic_83xx_free_mailbox()
3876 kfree(mbx); in qlcnic_83xx_free_mailbox()
3895 struct qlcnic_mailbox *mbx = adapter->ahw->mailbox; in qlcnic_83xx_flush_mbx_queue() local
3896 struct list_head *head = &mbx->cmd_q; in qlcnic_83xx_flush_mbx_queue()
3899 spin_lock_bh(&mbx->queue_lock); in qlcnic_83xx_flush_mbx_queue()
3906 mbx->num_cmds--; in qlcnic_83xx_flush_mbx_queue()
3910 spin_unlock_bh(&mbx->queue_lock); in qlcnic_83xx_flush_mbx_queue()
3916 struct qlcnic_mailbox *mbx = ahw->mailbox; in qlcnic_83xx_check_mbx_status() local
3919 if (!test_bit(QLC_83XX_MBX_READY, &mbx->status)) in qlcnic_83xx_check_mbx_status()
3924 clear_bit(QLC_83XX_MBX_READY, &mbx->status); in qlcnic_83xx_check_mbx_status()
3944 struct qlcnic_mailbox *mbx = adapter->ahw->mailbox; in qlcnic_83xx_dequeue_mbx_cmd() local
3946 spin_lock_bh(&mbx->queue_lock); in qlcnic_83xx_dequeue_mbx_cmd()
3949 mbx->num_cmds--; in qlcnic_83xx_dequeue_mbx_cmd()
3951 spin_unlock_bh(&mbx->queue_lock); in qlcnic_83xx_dequeue_mbx_cmd()
3993 struct qlcnic_mailbox *mbx = adapter->ahw->mailbox; in qlcnic_83xx_detach_mailbox_work() local
3995 if (!mbx) in qlcnic_83xx_detach_mailbox_work()
3998 clear_bit(QLC_83XX_MBX_READY, &mbx->status); in qlcnic_83xx_detach_mailbox_work()
3999 complete(&mbx->completion); in qlcnic_83xx_detach_mailbox_work()
4000 cancel_work_sync(&mbx->work); in qlcnic_83xx_detach_mailbox_work()
4001 flush_workqueue(mbx->work_q); in qlcnic_83xx_detach_mailbox_work()
4009 struct qlcnic_mailbox *mbx = adapter->ahw->mailbox; in qlcnic_83xx_enqueue_mbx_cmd() local
4011 if (test_bit(QLC_83XX_MBX_READY, &mbx->status)) { in qlcnic_83xx_enqueue_mbx_cmd()
4016 spin_lock_bh(&mbx->queue_lock); in qlcnic_83xx_enqueue_mbx_cmd()
4018 list_add_tail(&cmd->list, &mbx->cmd_q); in qlcnic_83xx_enqueue_mbx_cmd()
4019 mbx->num_cmds++; in qlcnic_83xx_enqueue_mbx_cmd()
4020 cmd->total_cmds = mbx->num_cmds; in qlcnic_83xx_enqueue_mbx_cmd()
4022 queue_work(mbx->work_q, &mbx->work); in qlcnic_83xx_enqueue_mbx_cmd()
4024 spin_unlock_bh(&mbx->queue_lock); in qlcnic_83xx_enqueue_mbx_cmd()
4098 struct qlcnic_mailbox *mbx = container_of(work, struct qlcnic_mailbox, in qlcnic_83xx_mailbox_worker() local
4100 struct qlcnic_adapter *adapter = mbx->adapter; in qlcnic_83xx_mailbox_worker()
4101 const struct qlcnic_mbx_ops *mbx_ops = mbx->ops; in qlcnic_83xx_mailbox_worker()
4103 struct list_head *head = &mbx->cmd_q; in qlcnic_83xx_mailbox_worker()
4116 spin_lock_irqsave(&mbx->aen_lock, flags); in qlcnic_83xx_mailbox_worker()
4117 mbx->rsp_status = QLC_83XX_MBX_RESPONSE_WAIT; in qlcnic_83xx_mailbox_worker()
4118 spin_unlock_irqrestore(&mbx->aen_lock, flags); in qlcnic_83xx_mailbox_worker()
4120 spin_lock_bh(&mbx->queue_lock); in qlcnic_83xx_mailbox_worker()
4123 spin_unlock_bh(&mbx->queue_lock); in qlcnic_83xx_mailbox_worker()
4128 spin_unlock_bh(&mbx->queue_lock); in qlcnic_83xx_mailbox_worker()
4133 if (wait_for_completion_timeout(&mbx->completion, in qlcnic_83xx_mailbox_worker()
4141 clear_bit(QLC_83XX_MBX_READY, &mbx->status); in qlcnic_83xx_mailbox_worker()
4164 struct qlcnic_mailbox *mbx; in qlcnic_83xx_init_mailbox_work() local
4166 ahw->mailbox = kzalloc(sizeof(*mbx), GFP_KERNEL); in qlcnic_83xx_init_mailbox_work()
4170 mbx = ahw->mailbox; in qlcnic_83xx_init_mailbox_work()
4171 mbx->ops = &qlcnic_83xx_mbx_ops; in qlcnic_83xx_init_mailbox_work()
4172 mbx->adapter = adapter; in qlcnic_83xx_init_mailbox_work()
4174 spin_lock_init(&mbx->queue_lock); in qlcnic_83xx_init_mailbox_work()
4175 spin_lock_init(&mbx->aen_lock); in qlcnic_83xx_init_mailbox_work()
4176 INIT_LIST_HEAD(&mbx->cmd_q); in qlcnic_83xx_init_mailbox_work()
4177 init_completion(&mbx->completion); in qlcnic_83xx_init_mailbox_work()
4179 mbx->work_q = create_singlethread_workqueue("qlcnic_mailbox"); in qlcnic_83xx_init_mailbox_work()
4180 if (mbx->work_q == NULL) { in qlcnic_83xx_init_mailbox_work()
4181 kfree(mbx); in qlcnic_83xx_init_mailbox_work()
4185 INIT_WORK(&mbx->work, qlcnic_83xx_mailbox_worker); in qlcnic_83xx_init_mailbox_work()
4186 set_bit(QLC_83XX_MBX_READY, &mbx->status); in qlcnic_83xx_init_mailbox_work()