Lines Matching +full:num +full:- +full:macs

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Linux network driver for QLogic BR-series Converged Network Adapter.
6 * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
7 * Copyright (c) 2014-2015 QLogic Corporation
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()
65 stats_src = (u64 *)&bna->stats.hw_stats_kva->_name ## _stats; \
66 stats_dst = (u64 *)&bna->stats.hw_stats._name ## _stats; \
79 ethport->flags |= BNA_ETHPORT_F_PORT_ENABLED; in bna_bfi_ethport_enable_aen()
91 ethport->flags &= ~BNA_ETHPORT_F_PORT_ENABLED; in bna_bfi_ethport_disable_aen()
102 &ethport->bfi_enet_cmd.admin_req; in bna_bfi_ethport_admin_rsp()
106 switch (admin_req->enable) { in bna_bfi_ethport_admin_rsp()
108 if (rsp->error == BFI_ENET_CMD_OK) in bna_bfi_ethport_admin_rsp()
111 ethport->flags &= ~BNA_ETHPORT_F_PORT_ENABLED; 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()
129 &ethport->bfi_enet_cmd.lpbk_req; in bna_bfi_ethport_lpbk_rsp()
133 switch (diag_lb_req->enable) { in bna_bfi_ethport_lpbk_rsp()
135 if (rsp->error == BFI_ENET_CMD_OK) in bna_bfi_ethport_lpbk_rsp()
138 ethport->flags &= ~BNA_ETHPORT_F_ADMIN_UP; in bna_bfi_ethport_lpbk_rsp()
166 if (!ioceth->attr.fw_query_complete) { in bna_bfi_attr_get_rsp()
167 ioceth->attr.num_txq = ntohl(rsp->max_cfg); in bna_bfi_attr_get_rsp()
168 ioceth->attr.num_rxp = ntohl(rsp->max_cfg); in bna_bfi_attr_get_rsp()
169 ioceth->attr.num_ucmac = ntohl(rsp->max_ucmac); in bna_bfi_attr_get_rsp()
170 ioceth->attr.num_mcmac = BFI_ENET_MAX_MCAM; in bna_bfi_attr_get_rsp()
171 ioceth->attr.max_rit_size = ntohl(rsp->rit_size); in bna_bfi_attr_get_rsp()
172 ioceth->attr.fw_query_complete = true; in bna_bfi_attr_get_rsp()
181 struct bfi_enet_stats_req *stats_req = &bna->stats_mod.stats_get; in bna_bfi_stats_get_rsp()
184 u32 tx_enet_mask = ntohl(stats_req->tx_enet_mask); in bna_bfi_stats_get_rsp()
185 u32 rx_enet_mask = ntohl(stats_req->rx_enet_mask); in bna_bfi_stats_get_rsp()
196 stats_src = (u64 *)&(bna->stats.hw_stats_kva->rxf_stats[0]); in bna_bfi_stats_get_rsp()
200 stats_dst = (u64 *)&(bna->stats.hw_stats.rxf_stats[i]); in bna_bfi_stats_get_rsp()
215 stats_dst = (u64 *)&(bna->stats.hw_stats.txf_stats[i]); in bna_bfi_stats_get_rsp()
228 bna->stats_mod.stats_get_busy = false; in bna_bfi_stats_get_rsp()
229 bnad_cb_stats_get(bna->bnad, BNA_CB_SUCCESS, &bna->stats); in bna_bfi_stats_get_rsp()
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()
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()
258 bfa_nw_ioc_error_isr(&bna->ioceth.ioc); in bna_err_handler()
269 bfa_nw_ioc_mbox_isr(&bna->ioceth.ioc); in bna_mbox_handler()
279 switch (msghdr->msg_id) { in bna_msgq_rsp_handler()
281 bna_rx_from_rid(bna, msghdr->enet_id, rx); in bna_msgq_rsp_handler()
287 bna_rx_from_rid(bna, msghdr->enet_id, rx); in bna_msgq_rsp_handler()
304 bna_rx_from_rid(bna, msghdr->enet_id, rx); in bna_msgq_rsp_handler()
306 bna_bfi_rxf_cfg_rsp(&rx->rxf, msghdr); in bna_msgq_rsp_handler()
310 bna_rx_from_rid(bna, msghdr->enet_id, rx); in bna_msgq_rsp_handler()
312 bna_bfi_rxf_ucast_set_rsp(&rx->rxf, msghdr); in bna_msgq_rsp_handler()
316 bna_rx_from_rid(bna, msghdr->enet_id, rx); in bna_msgq_rsp_handler()
318 bna_bfi_rxf_mcast_add_rsp(&rx->rxf, msghdr); in bna_msgq_rsp_handler()
322 bna_tx_from_rid(bna, msghdr->enet_id, tx); in bna_msgq_rsp_handler()
328 bna_tx_from_rid(bna, msghdr->enet_id, tx); in bna_msgq_rsp_handler()
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()
342 bna_bfi_pause_set_rsp(&bna->enet, msghdr); in bna_msgq_rsp_handler()
346 bna_bfi_attr_get_rsp(&bna->ioceth, msghdr); in bna_msgq_rsp_handler()
354 /* No-op */ 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()
374 bna_bfi_bw_update_aen(&bna->tx_mod); in bna_msgq_rsp_handler()
386 if ((_ethport)->stop_cbfn) { \
388 cbfn = (_ethport)->stop_cbfn; \
389 (_ethport)->stop_cbfn = NULL; \
390 cbfn(&(_ethport)->bna->enet); \
396 if ((ethport)->adminup_cbfn) { \
398 cbfn = (ethport)->adminup_cbfn; \
399 (ethport)->adminup_cbfn = NULL; \
400 cbfn((ethport)->bna->bnad, status); \
408 &ethport->bfi_enet_cmd.admin_req; in bna_bfi_ethport_admin_up()
410 bfi_msgq_mhdr_set(admin_up_req->mh, BFI_MC_ENET, in bna_bfi_ethport_admin_up()
412 admin_up_req->mh.num_entries = htons( in bna_bfi_ethport_admin_up()
414 admin_up_req->enable = BNA_STATUS_T_ENABLED; in bna_bfi_ethport_admin_up()
416 bfa_msgq_cmd_set(&ethport->msgq_cmd, NULL, NULL, in bna_bfi_ethport_admin_up()
417 sizeof(struct bfi_enet_enable_req), &admin_up_req->mh); in bna_bfi_ethport_admin_up()
418 bfa_msgq_cmd_post(&ethport->bna->msgq, &ethport->msgq_cmd); in bna_bfi_ethport_admin_up()
425 &ethport->bfi_enet_cmd.admin_req; in bna_bfi_ethport_admin_down()
427 bfi_msgq_mhdr_set(admin_down_req->mh, BFI_MC_ENET, in bna_bfi_ethport_admin_down()
429 admin_down_req->mh.num_entries = htons( in bna_bfi_ethport_admin_down()
431 admin_down_req->enable = BNA_STATUS_T_DISABLED; in bna_bfi_ethport_admin_down()
433 bfa_msgq_cmd_set(&ethport->msgq_cmd, NULL, NULL, in bna_bfi_ethport_admin_down()
434 sizeof(struct bfi_enet_enable_req), &admin_down_req->mh); in bna_bfi_ethport_admin_down()
435 bfa_msgq_cmd_post(&ethport->bna->msgq, &ethport->msgq_cmd); in bna_bfi_ethport_admin_down()
442 &ethport->bfi_enet_cmd.lpbk_req; in bna_bfi_ethport_lpbk_up()
444 bfi_msgq_mhdr_set(lpbk_up_req->mh, BFI_MC_ENET, in bna_bfi_ethport_lpbk_up()
446 lpbk_up_req->mh.num_entries = htons( in bna_bfi_ethport_lpbk_up()
448 lpbk_up_req->mode = (ethport->bna->enet.type == in bna_bfi_ethport_lpbk_up()
452 lpbk_up_req->enable = BNA_STATUS_T_ENABLED; in bna_bfi_ethport_lpbk_up()
454 bfa_msgq_cmd_set(&ethport->msgq_cmd, NULL, NULL, in bna_bfi_ethport_lpbk_up()
455 sizeof(struct bfi_enet_diag_lb_req), &lpbk_up_req->mh); in bna_bfi_ethport_lpbk_up()
456 bfa_msgq_cmd_post(&ethport->bna->msgq, &ethport->msgq_cmd); in bna_bfi_ethport_lpbk_up()
463 &ethport->bfi_enet_cmd.lpbk_req; in bna_bfi_ethport_lpbk_down()
465 bfi_msgq_mhdr_set(lpbk_down_req->mh, BFI_MC_ENET, in bna_bfi_ethport_lpbk_down()
467 lpbk_down_req->mh.num_entries = htons( in bna_bfi_ethport_lpbk_down()
469 lpbk_down_req->enable = BNA_STATUS_T_DISABLED; in bna_bfi_ethport_lpbk_down()
471 bfa_msgq_cmd_set(&ethport->msgq_cmd, NULL, NULL, in bna_bfi_ethport_lpbk_down()
472 sizeof(struct bfi_enet_diag_lb_req), &lpbk_down_req->mh); in bna_bfi_ethport_lpbk_down()
473 bfa_msgq_cmd_post(&ethport->bna->msgq, &ethport->msgq_cmd); in bna_bfi_ethport_lpbk_down()
479 if (ethport->bna->enet.type == BNA_ENET_T_REGULAR) in bna_bfi_ethport_up()
488 if (ethport->bna->enet.type == BNA_ENET_T_REGULAR) in bna_bfi_ethport_down()
527 /* No-op */ in bna_ethport_sm_stopped()
532 /* No-op */ in bna_ethport_sm_stopped()
603 /* down_resp_wait -> up_resp_wait transition on ETHPORT_E_UP */ in bna_ethport_sm_up_resp_wait()
617 * mbox due to up_resp_wait -> down_resp_wait transition on event in bna_ethport_sm_down_resp_wait_entry()
640 /* up_resp_wait->down_resp_wait transition on ETHPORT_E_DOWN */ in bna_ethport_sm_down_resp_wait()
702 /* No-op */ in bna_ethport_sm_last_resp_wait()
706 /* up_resp_wait->last_resp_wait transition on ETHPORT_T_STOP */ in bna_ethport_sm_last_resp_wait()
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()
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()
755 bfa_wc_down(&enet->chld_stop_wc); in bna_enet_cb_ethport_stopped()
761 ethport->stop_cbfn = bna_enet_cb_ethport_stopped; in bna_ethport_stop()
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()
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()
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()
812 ((enet)->type == BNA_ENET_T_REGULAR) ? \
815 ((enet)->type == BNA_ENET_T_REGULAR) ? \
817 bna_ethport_start(&(enet)->bna->ethport); \
818 bna_tx_mod_start(&(enet)->bna->tx_mod, tx_type); \
819 bna_rx_mod_start(&(enet)->bna->rx_mod, rx_type); \
825 ((enet)->type == BNA_ENET_T_REGULAR) ? \
828 ((enet)->type == BNA_ENET_T_REGULAR) ? \
830 bfa_wc_init(&(enet)->chld_stop_wc, bna_enet_cb_chld_stopped, (enet));\
831 bfa_wc_up(&(enet)->chld_stop_wc); \
832 bna_ethport_stop(&(enet)->bna->ethport); \
833 bfa_wc_up(&(enet)->chld_stop_wc); \
834 bna_tx_mod_stop(&(enet)->bna->tx_mod, tx_type); \
835 bfa_wc_up(&(enet)->chld_stop_wc); \
836 bna_rx_mod_stop(&(enet)->bna->rx_mod, rx_type); \
837 bfa_wc_wait(&(enet)->chld_stop_wc); \
842 bna_ethport_fail(&(enet)->bna->ethport); \
843 bna_tx_mod_fail(&(enet)->bna->tx_mod); \
844 bna_rx_mod_fail(&(enet)->bna->rx_mod); \
850 ((enet)->type == BNA_ENET_T_REGULAR) ? \
852 bna_rx_mod_start(&(enet)->bna->rx_mod, rx_type); \
858 ((enet)->type == BNA_ENET_T_REGULAR) ? \
860 bfa_wc_init(&(enet)->chld_stop_wc, bna_enet_cb_chld_stopped, (enet));\
861 bfa_wc_up(&(enet)->chld_stop_wc); \
862 bna_rx_mod_stop(&(enet)->bna->rx_mod, rx_type); \
863 bfa_wc_wait(&(enet)->chld_stop_wc); \
868 if ((enet)->stop_cbfn) { \
871 cbfn = (enet)->stop_cbfn; \
872 cbarg = (enet)->stop_cbarg; \
873 (enet)->stop_cbfn = NULL; \
874 (enet)->stop_cbarg = NULL; \
881 if ((enet)->mtu_cbfn) { \
883 cbfn = (enet)->mtu_cbfn; \
884 (enet)->mtu_cbfn = NULL; \
885 cbfn((enet)->bna->bnad); \
927 /* No-op */ in bna_enet_sm_stopped()
942 /* No-op */ in bna_enet_sm_stopped()
962 enet->flags &= ~BNA_ENET_F_PAUSE_CHANGED; in bna_enet_sm_pause_init_wait()
967 enet->flags &= ~BNA_ENET_F_PAUSE_CHANGED; in bna_enet_sm_pause_init_wait()
972 enet->flags |= BNA_ENET_F_PAUSE_CHANGED; in bna_enet_sm_pause_init_wait()
976 /* No-op */ in bna_enet_sm_pause_init_wait()
980 if (enet->flags & BNA_ENET_F_PAUSE_CHANGED) { in bna_enet_sm_pause_init_wait()
981 enet->flags &= ~BNA_ENET_F_PAUSE_CHANGED; in bna_enet_sm_pause_init_wait()
997 enet->flags &= ~BNA_ENET_F_PAUSE_CHANGED; in bna_enet_sm_last_resp_wait_entry()
1020 * inadvertently called during cfg_wait->started transition as well in bna_enet_sm_started_entry()
1065 enet->flags &= ~BNA_ENET_F_PAUSE_CHANGED; in bna_enet_sm_cfg_wait()
1066 enet->flags &= ~BNA_ENET_F_MTU_CHANGED; in bna_enet_sm_cfg_wait()
1071 enet->flags &= ~BNA_ENET_F_PAUSE_CHANGED; in bna_enet_sm_cfg_wait()
1072 enet->flags &= ~BNA_ENET_F_MTU_CHANGED; in bna_enet_sm_cfg_wait()
1078 enet->flags |= BNA_ENET_F_PAUSE_CHANGED; in bna_enet_sm_cfg_wait()
1082 enet->flags |= BNA_ENET_F_MTU_CHANGED; in bna_enet_sm_cfg_wait()
1089 if (enet->flags & BNA_ENET_F_PAUSE_CHANGED) { in bna_enet_sm_cfg_wait()
1090 enet->flags &= ~BNA_ENET_F_PAUSE_CHANGED; in bna_enet_sm_cfg_wait()
1092 } else if (enet->flags & BNA_ENET_F_MTU_CHANGED) { in bna_enet_sm_cfg_wait()
1093 enet->flags &= ~BNA_ENET_F_MTU_CHANGED; in bna_enet_sm_cfg_wait()
1108 enet->flags &= ~BNA_ENET_F_PAUSE_CHANGED; in bna_enet_sm_cfg_stop_wait_entry()
1109 enet->flags &= ~BNA_ENET_F_MTU_CHANGED; in bna_enet_sm_cfg_stop_wait_entry()
1160 struct bfi_enet_set_pause_req *pause_req = &enet->pause_req; in bna_bfi_pause_set()
1162 bfi_msgq_mhdr_set(pause_req->mh, BFI_MC_ENET, in bna_bfi_pause_set()
1164 pause_req->mh.num_entries = htons( in bna_bfi_pause_set()
1166 pause_req->tx_pause = enet->pause_config.tx_pause; in bna_bfi_pause_set()
1167 pause_req->rx_pause = enet->pause_config.rx_pause; in bna_bfi_pause_set()
1169 bfa_msgq_cmd_set(&enet->msgq_cmd, NULL, NULL, in bna_bfi_pause_set()
1170 sizeof(struct bfi_enet_set_pause_req), &pause_req->mh); in bna_bfi_pause_set()
1171 bfa_msgq_cmd_post(&enet->bna->msgq, &enet->msgq_cmd); in bna_bfi_pause_set()
1185 enet->bna = bna; in bna_enet_init()
1186 enet->flags = 0; in bna_enet_init()
1187 enet->mtu = 0; in bna_enet_init()
1188 enet->type = BNA_ENET_T_REGULAR; in bna_enet_init()
1190 enet->stop_cbfn = NULL; in bna_enet_init()
1191 enet->stop_cbarg = NULL; in bna_enet_init()
1193 enet->mtu_cbfn = NULL; in bna_enet_init()
1201 enet->flags = 0; in bna_enet_uninit()
1203 enet->bna = NULL; in bna_enet_uninit()
1209 enet->flags |= BNA_ENET_F_IOCETH_READY; in bna_enet_start()
1210 if (enet->flags & BNA_ENET_F_ENABLED) in bna_enet_start()
1225 enet->stop_cbfn = bna_ioceth_cb_enet_stopped; in bna_enet_stop()
1226 enet->stop_cbarg = &enet->bna->ioceth; in bna_enet_stop()
1228 enet->flags &= ~BNA_ENET_F_IOCETH_READY; in bna_enet_stop()
1235 enet->flags &= ~BNA_ENET_F_IOCETH_READY; in bna_enet_fail()
1242 bfa_wc_down(&enet->chld_stop_wc); in bna_enet_cb_tx_stopped()
1248 bfa_wc_down(&enet->chld_stop_wc); in bna_enet_cb_rx_stopped()
1254 return enet->mtu; in bna_enet_mtu_get()
1260 if (enet->fsm != bna_enet_sm_stopped) in bna_enet_enable()
1263 enet->flags |= BNA_ENET_F_ENABLED; in bna_enet_enable()
1265 if (enet->flags & BNA_ENET_F_IOCETH_READY) in bna_enet_enable()
1274 (*cbfn)(enet->bna->bnad); in bna_enet_disable()
1278 enet->stop_cbfn = cbfn; in bna_enet_disable()
1279 enet->stop_cbarg = enet->bna->bnad; in bna_enet_disable()
1281 enet->flags &= ~BNA_ENET_F_ENABLED; in bna_enet_disable()
1290 enet->pause_config = *pause_config; in bna_enet_pause_config()
1299 enet->mtu = mtu; in bna_enet_mtu_set()
1301 enet->mtu_cbfn = cbfn; in bna_enet_mtu_set()
1309 bfa_nw_ioc_get_mac(&enet->bna->ioceth.ioc, mac); in bna_enet_perm_mac_get()
1317 bna_intr_status_get((_ioceth)->bna, intr_status); \
1318 bnad_cb_mbox_intr_enable((_ioceth)->bna->bnad); \
1319 bna_mbox_intr_enable((_ioceth)->bna); \
1324 bna_mbox_intr_disable((_ioceth)->bna); \
1325 bnad_cb_mbox_intr_disable((_ioceth)->bna->bnad); \
1330 if ((_ioceth)->stop_cbfn) { \
1333 cbfn = (_ioceth)->stop_cbfn; \
1334 cbarg = (_ioceth)->stop_cbarg; \
1335 (_ioceth)->stop_cbfn = NULL; \
1336 (_ioceth)->stop_cbarg = NULL; \
1347 (_stats_mod)->ioc_ready = true; \
1352 (_stats_mod)->ioc_ready = false; \
1357 (_stats_mod)->ioc_ready = false; \
1358 (_stats_mod)->stats_get_busy = false; \
1359 (_stats_mod)->stats_clr_busy = false; \
1394 bfa_nw_ioc_enable(&ioceth->ioc); in bna_ioceth_sm_stopped()
1420 * previous state due to failed -> ioc_ready_wait transition. in bna_ioceth_sm_ioc_ready_wait_entry()
1431 bfa_nw_ioc_disable(&ioceth->ioc); in bna_ioceth_sm_ioc_ready_wait()
1484 bna_enet_start(&ioceth->bna->enet); in bna_ioceth_sm_ready_entry()
1485 bna_stats_mod_start(&ioceth->bna->stats_mod); in bna_ioceth_sm_ready_entry()
1486 bnad_cb_ioceth_ready(ioceth->bna->bnad); in bna_ioceth_sm_ready_entry()
1499 bna_enet_fail(&ioceth->bna->enet); in bna_ioceth_sm_ready()
1500 bna_stats_mod_fail(&ioceth->bna->stats_mod); in bna_ioceth_sm_ready()
1522 bfa_nw_ioc_disable(&ioceth->ioc); in bna_ioceth_sm_last_resp_wait()
1527 bfa_nw_ioc_disable(&ioceth->ioc); in bna_ioceth_sm_last_resp_wait()
1538 bna_stats_mod_stop(&ioceth->bna->stats_mod); in bna_ioceth_sm_enet_stop_wait_entry()
1539 bna_enet_stop(&ioceth->bna->enet); in bna_ioceth_sm_enet_stop_wait_entry()
1550 bna_enet_fail(&ioceth->bna->enet); in bna_ioceth_sm_enet_stop_wait()
1551 bna_stats_mod_fail(&ioceth->bna->stats_mod); in bna_ioceth_sm_enet_stop_wait()
1552 bfa_nw_ioc_disable(&ioceth->ioc); in bna_ioceth_sm_enet_stop_wait()
1557 bfa_nw_ioc_disable(&ioceth->ioc); in bna_ioceth_sm_enet_stop_wait()
1582 /* No-op */ in bna_ioceth_sm_ioc_disable_wait()
1593 bnad_cb_ioceth_failed(ioceth->bna->bnad); in bna_ioceth_sm_failed_entry()
1603 bfa_nw_ioc_disable(&ioceth->ioc); in bna_ioceth_sm_failed()
1622 struct bfi_enet_attr_req *attr_req = &ioceth->attr_req; in bna_bfi_attr_get()
1624 bfi_msgq_mhdr_set(attr_req->mh, BFI_MC_ENET, in bna_bfi_attr_get()
1626 attr_req->mh.num_entries = htons( in bna_bfi_attr_get()
1628 bfa_msgq_cmd_set(&ioceth->msgq_cmd, NULL, NULL, in bna_bfi_attr_get()
1629 sizeof(struct bfi_enet_attr_req), &attr_req->mh); in bna_bfi_attr_get()
1630 bfa_msgq_cmd_post(&ioceth->bna->msgq, &ioceth->msgq_cmd); in bna_bfi_attr_get()
1679 ioceth->attr.num_txq = BFI_ENET_DEF_TXQ; in bna_attr_init()
1680 ioceth->attr.num_rxp = BFI_ENET_DEF_RXP; in bna_attr_init()
1681 ioceth->attr.num_ucmac = BFI_ENET_DEF_UCAM; in bna_attr_init()
1682 ioceth->attr.num_mcmac = BFI_ENET_MAX_MCAM; in bna_attr_init()
1683 ioceth->attr.max_rit_size = BFI_ENET_DEF_RITSZ; in bna_attr_init()
1684 ioceth->attr.fw_query_complete = false; in bna_attr_init()
1694 ioceth->bna = bna; in bna_ioceth_init()
1701 bfa_nw_ioc_attach(&ioceth->ioc, ioceth, &bna_ioceth_cbfn); in bna_ioceth_init()
1702 bfa_nw_ioc_pci_init(&ioceth->ioc, &bna->pcidev, BFI_PCIFN_CLASS_ETH); in bna_ioceth_init()
1707 bfa_nw_ioc_mem_claim(&ioceth->ioc, kva, dma); in bna_ioceth_init()
1710 bfa_nw_ioc_debug_memclaim(&ioceth->ioc, kva); in bna_ioceth_init()
1719 bfa_nw_cee_attach(&bna->cee, &ioceth->ioc, bna); in bna_ioceth_init()
1720 bfa_nw_cee_mem_claim(&bna->cee, kva, dma); in bna_ioceth_init()
1724 bfa_nw_flash_attach(&bna->flash, &ioceth->ioc, bna); in bna_ioceth_init()
1725 bfa_nw_flash_memclaim(&bna->flash, kva, dma); in bna_ioceth_init()
1729 bfa_msgq_attach(&bna->msgq, &ioceth->ioc); in bna_ioceth_init()
1730 bfa_msgq_memclaim(&bna->msgq, kva, dma); in bna_ioceth_init()
1731 bfa_msgq_regisr(&bna->msgq, BFI_MC_ENET, bna_msgq_rsp_handler, bna); in bna_ioceth_init()
1735 ioceth->stop_cbfn = NULL; in bna_ioceth_init()
1736 ioceth->stop_cbarg = NULL; in bna_ioceth_init()
1746 bfa_nw_ioc_detach(&ioceth->ioc); in bna_ioceth_uninit()
1748 ioceth->bna = NULL; in bna_ioceth_uninit()
1754 if (ioceth->fsm == bna_ioceth_sm_ready) { in bna_ioceth_enable()
1755 bnad_cb_ioceth_ready(ioceth->bna->bnad); in bna_ioceth_enable()
1759 if (ioceth->fsm == bna_ioceth_sm_stopped) in bna_ioceth_enable()
1767 bnad_cb_ioceth_disabled(ioceth->bna->bnad); in bna_ioceth_disable()
1771 ioceth->stop_cbfn = bnad_cb_ioceth_disabled; in bna_ioceth_disable()
1772 ioceth->stop_cbarg = ioceth->bna->bnad; in bna_ioceth_disable()
1783 ucam_mod->ucmac = (struct bna_mac *) in bna_ucam_mod_init()
1786 INIT_LIST_HEAD(&ucam_mod->free_q); in bna_ucam_mod_init()
1787 for (i = 0; i < bna->ioceth.attr.num_ucmac; i++) in bna_ucam_mod_init()
1788 list_add_tail(&ucam_mod->ucmac[i].qe, &ucam_mod->free_q); in bna_ucam_mod_init()
1790 /* A separate queue to allow synchronous setting of a list of MACs */ in bna_ucam_mod_init()
1791 INIT_LIST_HEAD(&ucam_mod->del_q); in bna_ucam_mod_init()
1792 for (; i < (bna->ioceth.attr.num_ucmac * 2); i++) in bna_ucam_mod_init()
1793 list_add_tail(&ucam_mod->ucmac[i].qe, &ucam_mod->del_q); in bna_ucam_mod_init()
1795 ucam_mod->bna = bna; in bna_ucam_mod_init()
1801 ucam_mod->bna = NULL; in bna_ucam_mod_uninit()
1810 mcam_mod->mcmac = (struct bna_mac *) in bna_mcam_mod_init()
1813 INIT_LIST_HEAD(&mcam_mod->free_q); in bna_mcam_mod_init()
1814 for (i = 0; i < bna->ioceth.attr.num_mcmac; i++) in bna_mcam_mod_init()
1815 list_add_tail(&mcam_mod->mcmac[i].qe, &mcam_mod->free_q); in bna_mcam_mod_init()
1817 mcam_mod->mchandle = (struct bna_mcam_handle *) in bna_mcam_mod_init()
1820 INIT_LIST_HEAD(&mcam_mod->free_handle_q); in bna_mcam_mod_init()
1821 for (i = 0; i < bna->ioceth.attr.num_mcmac; i++) in bna_mcam_mod_init()
1822 list_add_tail(&mcam_mod->mchandle[i].qe, in bna_mcam_mod_init()
1823 &mcam_mod->free_handle_q); in bna_mcam_mod_init()
1825 /* A separate queue to allow synchronous setting of a list of MACs */ in bna_mcam_mod_init()
1826 INIT_LIST_HEAD(&mcam_mod->del_q); in bna_mcam_mod_init()
1827 for (; i < (bna->ioceth.attr.num_mcmac * 2); i++) in bna_mcam_mod_init()
1828 list_add_tail(&mcam_mod->mcmac[i].qe, &mcam_mod->del_q); in bna_mcam_mod_init()
1830 mcam_mod->bna = bna; in bna_mcam_mod_init()
1836 mcam_mod->bna = NULL; in bna_mcam_mod_uninit()
1842 struct bfi_enet_stats_req *stats_req = &bna->stats_mod.stats_get; in bna_bfi_stats_get()
1844 bna->stats_mod.stats_get_busy = true; in bna_bfi_stats_get()
1846 bfi_msgq_mhdr_set(stats_req->mh, BFI_MC_ENET, in bna_bfi_stats_get()
1848 stats_req->mh.num_entries = htons( in bna_bfi_stats_get()
1850 stats_req->stats_mask = htons(BFI_ENET_STATS_ALL); in bna_bfi_stats_get()
1851 stats_req->tx_enet_mask = htonl(bna->tx_mod.rid_mask); in bna_bfi_stats_get()
1852 stats_req->rx_enet_mask = htonl(bna->rx_mod.rid_mask); in bna_bfi_stats_get()
1853 stats_req->host_buffer.a32.addr_hi = bna->stats.hw_stats_dma.msb; in bna_bfi_stats_get()
1854 stats_req->host_buffer.a32.addr_lo = bna->stats.hw_stats_dma.lsb; in bna_bfi_stats_get()
1856 bfa_msgq_cmd_set(&bna->stats_mod.stats_get_cmd, NULL, NULL, in bna_bfi_stats_get()
1857 sizeof(struct bfi_enet_stats_req), &stats_req->mh); in bna_bfi_stats_get()
1858 bfa_msgq_cmd_post(&bna->msgq, &bna->stats_mod.stats_get_cmd); in bna_bfi_stats_get()
1867 res_info[BNA_RES_MEM_T_COM].res_u.mem_info.num = 1; in bna_res_req()
1876 res_info[BNA_RES_MEM_T_ATTR].res_u.mem_info.num = 1; in bna_res_req()
1883 res_info[BNA_RES_MEM_T_FWTRC].res_u.mem_info.num = 1; in bna_res_req()
1889 res_info[BNA_RES_MEM_T_STATS].res_u.mem_info.num = 1; in bna_res_req()
1898 struct bna_attr *attr = &bna->ioceth.attr; in bna_mod_res_req()
1900 /* Virtual memory for Tx objects - stored by Tx module */ in bna_mod_res_req()
1904 res_info[BNA_MOD_RES_MEM_T_TX_ARRAY].res_u.mem_info.num = 1; in bna_mod_res_req()
1906 attr->num_txq * sizeof(struct bna_tx); in bna_mod_res_req()
1908 /* Virtual memory for TxQ - stored by Tx module */ in bna_mod_res_req()
1912 res_info[BNA_MOD_RES_MEM_T_TXQ_ARRAY].res_u.mem_info.num = 1; in bna_mod_res_req()
1914 attr->num_txq * sizeof(struct bna_txq); in bna_mod_res_req()
1916 /* Virtual memory for Rx objects - stored by Rx module */ in bna_mod_res_req()
1920 res_info[BNA_MOD_RES_MEM_T_RX_ARRAY].res_u.mem_info.num = 1; in bna_mod_res_req()
1922 attr->num_rxp * sizeof(struct bna_rx); in bna_mod_res_req()
1924 /* Virtual memory for RxPath - stored by Rx module */ in bna_mod_res_req()
1928 res_info[BNA_MOD_RES_MEM_T_RXP_ARRAY].res_u.mem_info.num = 1; in bna_mod_res_req()
1930 attr->num_rxp * sizeof(struct bna_rxp); in bna_mod_res_req()
1932 /* Virtual memory for RxQ - stored by Rx module */ in bna_mod_res_req()
1936 res_info[BNA_MOD_RES_MEM_T_RXQ_ARRAY].res_u.mem_info.num = 1; in bna_mod_res_req()
1938 (attr->num_rxp * 2) * sizeof(struct bna_rxq); in bna_mod_res_req()
1940 /* Virtual memory for Unicast MAC address - stored by ucam module */ in bna_mod_res_req()
1944 res_info[BNA_MOD_RES_MEM_T_UCMAC_ARRAY].res_u.mem_info.num = 1; in bna_mod_res_req()
1946 (attr->num_ucmac * 2) * sizeof(struct bna_mac); in bna_mod_res_req()
1948 /* Virtual memory for Multicast MAC address - stored by mcam module */ in bna_mod_res_req()
1952 res_info[BNA_MOD_RES_MEM_T_MCMAC_ARRAY].res_u.mem_info.num = 1; in bna_mod_res_req()
1954 (attr->num_mcmac * 2) * sizeof(struct bna_mac); in bna_mod_res_req()
1956 /* Virtual memory for Multicast handle - stored by mcam module */ in bna_mod_res_req()
1960 res_info[BNA_MOD_RES_MEM_T_MCHANDLE_ARRAY].res_u.mem_info.num = 1; in bna_mod_res_req()
1962 attr->num_mcmac * sizeof(struct bna_mcam_handle); in bna_mod_res_req()
1969 bna->bnad = bnad; in bna_init()
1970 bna->pcidev = *pcidev; in bna_init()
1972 bna->stats.hw_stats_kva = (struct bfi_enet_stats *) in bna_init()
1974 bna->stats.hw_stats_dma.msb = in bna_init()
1976 bna->stats.hw_stats_dma.lsb = in bna_init()
1979 bna_reg_addr_init(bna, &bna->pcidev); in bna_init()
1982 bna_ioceth_init(&bna->ioceth, bna, res_info); in bna_init()
1984 bna_enet_init(&bna->enet, bna); in bna_init()
1985 bna_ethport_init(&bna->ethport, bna); in bna_init()
1991 bna_tx_mod_init(&bna->tx_mod, bna, res_info); in bna_mod_init()
1993 bna_rx_mod_init(&bna->rx_mod, bna, res_info); in bna_mod_init()
1995 bna_ucam_mod_init(&bna->ucam_mod, bna, res_info); in bna_mod_init()
1997 bna_mcam_mod_init(&bna->mcam_mod, bna, res_info); in bna_mod_init()
1999 bna->default_mode_rid = BFI_INVALID_RID; in bna_mod_init()
2000 bna->promisc_rid = BFI_INVALID_RID; in bna_mod_init()
2002 bna->mod_flags |= BNA_MOD_F_INIT_DONE; in bna_mod_init()
2008 if (bna->mod_flags & BNA_MOD_F_INIT_DONE) { in bna_uninit()
2009 bna_mcam_mod_uninit(&bna->mcam_mod); in bna_uninit()
2010 bna_ucam_mod_uninit(&bna->ucam_mod); in bna_uninit()
2011 bna_rx_mod_uninit(&bna->rx_mod); in bna_uninit()
2012 bna_tx_mod_uninit(&bna->tx_mod); in bna_uninit()
2013 bna->mod_flags &= ~BNA_MOD_F_INIT_DONE; in bna_uninit()
2016 bna_stats_mod_uninit(&bna->stats_mod); in bna_uninit()
2017 bna_ethport_uninit(&bna->ethport); in bna_uninit()
2018 bna_enet_uninit(&bna->enet); in bna_uninit()
2020 bna_ioceth_uninit(&bna->ioceth); in bna_uninit()
2022 bna->bnad = NULL; in bna_uninit()
2028 if (bna->ioceth.attr.fw_query_complete && in bna_num_txq_set()
2029 (num_txq <= bna->ioceth.attr.num_txq)) { in bna_num_txq_set()
2030 bna->ioceth.attr.num_txq = num_txq; in bna_num_txq_set()
2040 if (bna->ioceth.attr.fw_query_complete && in bna_num_rxp_set()
2041 (num_rxp <= bna->ioceth.attr.num_rxp)) { in bna_num_rxp_set()
2042 bna->ioceth.attr.num_rxp = num_rxp; in bna_num_rxp_set()
2056 list_del(&mac->qe); in bna_cam_mod_mac_get()
2066 handle = list_first_entry_or_null(&mcam_mod->free_handle_q, in bna_mcam_mod_handle_get()
2069 list_del(&handle->qe); in bna_mcam_mod_handle_get()
2078 list_add_tail(&handle->qe, &mcam_mod->free_handle_q); in bna_mcam_mod_handle_put()
2084 if (!bna->stats_mod.ioc_ready) { in bna_hw_stats_get()
2085 bnad_cb_stats_get(bna->bnad, BNA_CB_FAIL, &bna->stats); in bna_hw_stats_get()
2088 if (bna->stats_mod.stats_get_busy) { in bna_hw_stats_get()
2089 bnad_cb_stats_get(bna->bnad, BNA_CB_BUSY, &bna->stats); in bna_hw_stats_get()