Lines Matching refs:ethport

14 ethport_can_be_up(struct bna_ethport *ethport)  in ethport_can_be_up()  argument
17 if (ethport->bna->enet.type == BNA_ENET_T_REGULAR) in ethport_can_be_up()
18 ready = ((ethport->flags & BNA_ETHPORT_F_ADMIN_UP) && in ethport_can_be_up()
19 (ethport->flags & BNA_ETHPORT_F_RX_STARTED) && in ethport_can_be_up()
20 (ethport->flags & BNA_ETHPORT_F_PORT_ENABLED)); in ethport_can_be_up()
22 ready = ((ethport->flags & BNA_ETHPORT_F_ADMIN_UP) && in ethport_can_be_up()
23 (ethport->flags & BNA_ETHPORT_F_RX_STARTED) && in ethport_can_be_up()
24 !(ethport->flags & BNA_ETHPORT_F_PORT_ENABLED)); in ethport_can_be_up()
76 bna_bfi_ethport_enable_aen(struct bna_ethport *ethport, in bna_bfi_ethport_enable_aen() argument
79 ethport->flags |= BNA_ETHPORT_F_PORT_ENABLED; in bna_bfi_ethport_enable_aen()
81 if (ethport_can_be_up(ethport)) in bna_bfi_ethport_enable_aen()
82 bfa_fsm_send_event(ethport, ETHPORT_E_UP); in bna_bfi_ethport_enable_aen()
86 bna_bfi_ethport_disable_aen(struct bna_ethport *ethport, in bna_bfi_ethport_disable_aen() argument
89 int ethport_up = ethport_is_up(ethport); in bna_bfi_ethport_disable_aen()
91 ethport->flags &= ~BNA_ETHPORT_F_PORT_ENABLED; in bna_bfi_ethport_disable_aen()
94 bfa_fsm_send_event(ethport, ETHPORT_E_DOWN); in bna_bfi_ethport_disable_aen()
98 bna_bfi_ethport_admin_rsp(struct bna_ethport *ethport, in bna_bfi_ethport_admin_rsp() argument
102 &ethport->bfi_enet_cmd.admin_req; in bna_bfi_ethport_admin_rsp()
109 bfa_fsm_send_event(ethport, ETHPORT_E_FWRESP_UP_OK); in bna_bfi_ethport_admin_rsp()
111 ethport->flags &= ~BNA_ETHPORT_F_PORT_ENABLED; in bna_bfi_ethport_admin_rsp()
112 bfa_fsm_send_event(ethport, ETHPORT_E_FWRESP_UP_FAIL); in bna_bfi_ethport_admin_rsp()
117 bfa_fsm_send_event(ethport, ETHPORT_E_FWRESP_DOWN); in bna_bfi_ethport_admin_rsp()
118 ethport->link_status = BNA_LINK_DOWN; in bna_bfi_ethport_admin_rsp()
119 ethport->link_cbfn(ethport->bna->bnad, BNA_LINK_DOWN); in bna_bfi_ethport_admin_rsp()
125 bna_bfi_ethport_lpbk_rsp(struct bna_ethport *ethport, in bna_bfi_ethport_lpbk_rsp() argument
129 &ethport->bfi_enet_cmd.lpbk_req; in bna_bfi_ethport_lpbk_rsp()
136 bfa_fsm_send_event(ethport, ETHPORT_E_FWRESP_UP_OK); in bna_bfi_ethport_lpbk_rsp()
138 ethport->flags &= ~BNA_ETHPORT_F_ADMIN_UP; in bna_bfi_ethport_lpbk_rsp()
139 bfa_fsm_send_event(ethport, ETHPORT_E_FWRESP_UP_FAIL); in bna_bfi_ethport_lpbk_rsp()
144 bfa_fsm_send_event(ethport, ETHPORT_E_FWRESP_DOWN); in bna_bfi_ethport_lpbk_rsp()
233 bna_bfi_ethport_linkup_aen(struct bna_ethport *ethport, in bna_bfi_ethport_linkup_aen() argument
236 ethport->link_status = BNA_LINK_UP; in bna_bfi_ethport_linkup_aen()
239 ethport->link_cbfn(ethport->bna->bnad, ethport->link_status); in bna_bfi_ethport_linkup_aen()
243 bna_bfi_ethport_linkdown_aen(struct bna_ethport *ethport, in bna_bfi_ethport_linkdown_aen() argument
246 ethport->link_status = BNA_LINK_DOWN; in bna_bfi_ethport_linkdown_aen()
249 ethport->link_cbfn(ethport->bna->bnad, BNA_LINK_DOWN); in bna_bfi_ethport_linkdown_aen()
334 bna_bfi_ethport_admin_rsp(&bna->ethport, msghdr); in bna_msgq_rsp_handler()
338 bna_bfi_ethport_lpbk_rsp(&bna->ethport, msghdr); in bna_msgq_rsp_handler()
358 bna_bfi_ethport_linkup_aen(&bna->ethport, msghdr); in bna_msgq_rsp_handler()
362 bna_bfi_ethport_linkdown_aen(&bna->ethport, msghdr); in bna_msgq_rsp_handler()
366 bna_bfi_ethport_enable_aen(&bna->ethport, msghdr); in bna_msgq_rsp_handler()
370 bna_bfi_ethport_disable_aen(&bna->ethport, msghdr); in bna_msgq_rsp_handler()
394 #define call_ethport_adminup_cbfn(ethport, status) \ argument
396 if ((ethport)->adminup_cbfn) { \
398 cbfn = (ethport)->adminup_cbfn; \
399 (ethport)->adminup_cbfn = NULL; \
400 cbfn((ethport)->bna->bnad, status); \
405 bna_bfi_ethport_admin_up(struct bna_ethport *ethport) in bna_bfi_ethport_admin_up() argument
408 &ethport->bfi_enet_cmd.admin_req; in bna_bfi_ethport_admin_up()
416 bfa_msgq_cmd_set(&ethport->msgq_cmd, NULL, NULL, in bna_bfi_ethport_admin_up()
418 bfa_msgq_cmd_post(&ethport->bna->msgq, &ethport->msgq_cmd); in bna_bfi_ethport_admin_up()
422 bna_bfi_ethport_admin_down(struct bna_ethport *ethport) in bna_bfi_ethport_admin_down() argument
425 &ethport->bfi_enet_cmd.admin_req; in bna_bfi_ethport_admin_down()
433 bfa_msgq_cmd_set(&ethport->msgq_cmd, NULL, NULL, in bna_bfi_ethport_admin_down()
435 bfa_msgq_cmd_post(&ethport->bna->msgq, &ethport->msgq_cmd); in bna_bfi_ethport_admin_down()
439 bna_bfi_ethport_lpbk_up(struct bna_ethport *ethport) in bna_bfi_ethport_lpbk_up() argument
442 &ethport->bfi_enet_cmd.lpbk_req; in bna_bfi_ethport_lpbk_up()
448 lpbk_up_req->mode = (ethport->bna->enet.type == in bna_bfi_ethport_lpbk_up()
454 bfa_msgq_cmd_set(&ethport->msgq_cmd, NULL, NULL, in bna_bfi_ethport_lpbk_up()
456 bfa_msgq_cmd_post(&ethport->bna->msgq, &ethport->msgq_cmd); in bna_bfi_ethport_lpbk_up()
460 bna_bfi_ethport_lpbk_down(struct bna_ethport *ethport) in bna_bfi_ethport_lpbk_down() argument
463 &ethport->bfi_enet_cmd.lpbk_req; in bna_bfi_ethport_lpbk_down()
471 bfa_msgq_cmd_set(&ethport->msgq_cmd, NULL, NULL, in bna_bfi_ethport_lpbk_down()
473 bfa_msgq_cmd_post(&ethport->bna->msgq, &ethport->msgq_cmd); in bna_bfi_ethport_lpbk_down()
477 bna_bfi_ethport_up(struct bna_ethport *ethport) in bna_bfi_ethport_up() argument
479 if (ethport->bna->enet.type == BNA_ENET_T_REGULAR) in bna_bfi_ethport_up()
480 bna_bfi_ethport_admin_up(ethport); in bna_bfi_ethport_up()
482 bna_bfi_ethport_lpbk_up(ethport); in bna_bfi_ethport_up()
486 bna_bfi_ethport_down(struct bna_ethport *ethport) in bna_bfi_ethport_down() argument
488 if (ethport->bna->enet.type == BNA_ENET_T_REGULAR) in bna_bfi_ethport_down()
489 bna_bfi_ethport_admin_down(ethport); in bna_bfi_ethport_down()
491 bna_bfi_ethport_lpbk_down(ethport); in bna_bfi_ethport_down()
508 bna_ethport_sm_stopped_entry(struct bna_ethport *ethport) in bna_ethport_sm_stopped_entry() argument
510 call_ethport_stop_cbfn(ethport); in bna_ethport_sm_stopped_entry()
514 bna_ethport_sm_stopped(struct bna_ethport *ethport, in bna_ethport_sm_stopped() argument
519 bfa_fsm_set_state(ethport, bna_ethport_sm_down); in bna_ethport_sm_stopped()
523 call_ethport_stop_cbfn(ethport); in bna_ethport_sm_stopped()
541 bna_ethport_sm_down_entry(struct bna_ethport *ethport) in bna_ethport_sm_down_entry() argument
546 bna_ethport_sm_down(struct bna_ethport *ethport, in bna_ethport_sm_down() argument
551 bfa_fsm_set_state(ethport, bna_ethport_sm_stopped); in bna_ethport_sm_down()
555 bfa_fsm_set_state(ethport, bna_ethport_sm_stopped); in bna_ethport_sm_down()
559 bfa_fsm_set_state(ethport, bna_ethport_sm_up_resp_wait); in bna_ethport_sm_down()
560 bna_bfi_ethport_up(ethport); in bna_ethport_sm_down()
569 bna_ethport_sm_up_resp_wait_entry(struct bna_ethport *ethport) in bna_ethport_sm_up_resp_wait_entry() argument
574 bna_ethport_sm_up_resp_wait(struct bna_ethport *ethport, in bna_ethport_sm_up_resp_wait() argument
579 bfa_fsm_set_state(ethport, bna_ethport_sm_last_resp_wait); in bna_ethport_sm_up_resp_wait()
583 call_ethport_adminup_cbfn(ethport, BNA_CB_FAIL); in bna_ethport_sm_up_resp_wait()
584 bfa_fsm_set_state(ethport, bna_ethport_sm_stopped); in bna_ethport_sm_up_resp_wait()
588 call_ethport_adminup_cbfn(ethport, BNA_CB_INTERRUPT); in bna_ethport_sm_up_resp_wait()
589 bfa_fsm_set_state(ethport, bna_ethport_sm_down_resp_wait); in bna_ethport_sm_up_resp_wait()
593 call_ethport_adminup_cbfn(ethport, BNA_CB_SUCCESS); in bna_ethport_sm_up_resp_wait()
594 bfa_fsm_set_state(ethport, bna_ethport_sm_up); in bna_ethport_sm_up_resp_wait()
598 call_ethport_adminup_cbfn(ethport, BNA_CB_FAIL); in bna_ethport_sm_up_resp_wait()
599 bfa_fsm_set_state(ethport, bna_ethport_sm_down); in bna_ethport_sm_up_resp_wait()
604 bna_bfi_ethport_up(ethport); in bna_ethport_sm_up_resp_wait()
613 bna_ethport_sm_down_resp_wait_entry(struct bna_ethport *ethport) in bna_ethport_sm_down_resp_wait_entry() argument
623 bna_ethport_sm_down_resp_wait(struct bna_ethport *ethport, in bna_ethport_sm_down_resp_wait() argument
628 bfa_fsm_set_state(ethport, bna_ethport_sm_last_resp_wait); in bna_ethport_sm_down_resp_wait()
632 bfa_fsm_set_state(ethport, bna_ethport_sm_stopped); in bna_ethport_sm_down_resp_wait()
636 bfa_fsm_set_state(ethport, bna_ethport_sm_up_resp_wait); in bna_ethport_sm_down_resp_wait()
641 bna_bfi_ethport_down(ethport); in bna_ethport_sm_down_resp_wait()
646 bfa_fsm_set_state(ethport, bna_ethport_sm_down); in bna_ethport_sm_down_resp_wait()
655 bna_ethport_sm_up_entry(struct bna_ethport *ethport) in bna_ethport_sm_up_entry() argument
660 bna_ethport_sm_up(struct bna_ethport *ethport, in bna_ethport_sm_up() argument
665 bfa_fsm_set_state(ethport, bna_ethport_sm_last_resp_wait); in bna_ethport_sm_up()
666 bna_bfi_ethport_down(ethport); in bna_ethport_sm_up()
670 bfa_fsm_set_state(ethport, bna_ethport_sm_stopped); in bna_ethport_sm_up()
674 bfa_fsm_set_state(ethport, bna_ethport_sm_down_resp_wait); in bna_ethport_sm_up()
675 bna_bfi_ethport_down(ethport); in bna_ethport_sm_up()
684 bna_ethport_sm_last_resp_wait_entry(struct bna_ethport *ethport) in bna_ethport_sm_last_resp_wait_entry() argument
689 bna_ethport_sm_last_resp_wait(struct bna_ethport *ethport, in bna_ethport_sm_last_resp_wait() argument
694 bfa_fsm_set_state(ethport, bna_ethport_sm_stopped); in bna_ethport_sm_last_resp_wait()
707 bna_bfi_ethport_down(ethport); in bna_ethport_sm_last_resp_wait()
712 bfa_fsm_set_state(ethport, bna_ethport_sm_stopped); in bna_ethport_sm_last_resp_wait()
721 bna_ethport_init(struct bna_ethport *ethport, struct bna *bna) in bna_ethport_init() argument
723 ethport->flags |= (BNA_ETHPORT_F_ADMIN_UP | BNA_ETHPORT_F_PORT_ENABLED); in bna_ethport_init()
724 ethport->bna = bna; in bna_ethport_init()
726 ethport->link_status = BNA_LINK_DOWN; in bna_ethport_init()
727 ethport->link_cbfn = bnad_cb_ethport_link_status; in bna_ethport_init()
729 ethport->rx_started_count = 0; in bna_ethport_init()
731 ethport->stop_cbfn = NULL; in bna_ethport_init()
732 ethport->adminup_cbfn = NULL; in bna_ethport_init()
734 bfa_fsm_set_state(ethport, bna_ethport_sm_stopped); in bna_ethport_init()
738 bna_ethport_uninit(struct bna_ethport *ethport) in bna_ethport_uninit() argument
740 ethport->flags &= ~BNA_ETHPORT_F_ADMIN_UP; in bna_ethport_uninit()
741 ethport->flags &= ~BNA_ETHPORT_F_PORT_ENABLED; in bna_ethport_uninit()
743 ethport->bna = NULL; in bna_ethport_uninit()
747 bna_ethport_start(struct bna_ethport *ethport) in bna_ethport_start() argument
749 bfa_fsm_send_event(ethport, ETHPORT_E_START); in bna_ethport_start()
759 bna_ethport_stop(struct bna_ethport *ethport) in bna_ethport_stop() argument
761 ethport->stop_cbfn = bna_enet_cb_ethport_stopped; in bna_ethport_stop()
762 bfa_fsm_send_event(ethport, ETHPORT_E_STOP); in bna_ethport_stop()
766 bna_ethport_fail(struct bna_ethport *ethport) in bna_ethport_fail() argument
769 ethport->flags |= BNA_ETHPORT_F_PORT_ENABLED; in bna_ethport_fail()
771 if (ethport->link_status != BNA_LINK_DOWN) { in bna_ethport_fail()
772 ethport->link_status = BNA_LINK_DOWN; in bna_ethport_fail()
773 ethport->link_cbfn(ethport->bna->bnad, BNA_LINK_DOWN); in bna_ethport_fail()
775 bfa_fsm_send_event(ethport, ETHPORT_E_FAIL); in bna_ethport_fail()
780 bna_ethport_cb_rx_started(struct bna_ethport *ethport) in bna_ethport_cb_rx_started() argument
782 ethport->rx_started_count++; in bna_ethport_cb_rx_started()
784 if (ethport->rx_started_count == 1) { in bna_ethport_cb_rx_started()
785 ethport->flags |= BNA_ETHPORT_F_RX_STARTED; in bna_ethport_cb_rx_started()
787 if (ethport_can_be_up(ethport)) in bna_ethport_cb_rx_started()
788 bfa_fsm_send_event(ethport, ETHPORT_E_UP); in bna_ethport_cb_rx_started()
793 bna_ethport_cb_rx_stopped(struct bna_ethport *ethport) in bna_ethport_cb_rx_stopped() argument
795 int ethport_up = ethport_is_up(ethport); in bna_ethport_cb_rx_stopped()
797 ethport->rx_started_count--; in bna_ethport_cb_rx_stopped()
799 if (ethport->rx_started_count == 0) { in bna_ethport_cb_rx_stopped()
800 ethport->flags &= ~BNA_ETHPORT_F_RX_STARTED; in bna_ethport_cb_rx_stopped()
803 bfa_fsm_send_event(ethport, ETHPORT_E_DOWN); in bna_ethport_cb_rx_stopped()
817 bna_ethport_start(&(enet)->bna->ethport); \
832 bna_ethport_stop(&(enet)->bna->ethport); \
842 bna_ethport_fail(&(enet)->bna->ethport); \
1985 bna_ethport_init(&bna->ethport, bna); in bna_init()
2017 bna_ethport_uninit(&bna->ethport); in bna_uninit()