Lines Matching refs:adapter

54 			       struct qlcnic_adapter *adapter, u32 type)  in qlcnic_82xx_alloc_mbx_args()  argument
93 qlcnic_poll_rsp(struct qlcnic_adapter *adapter) in qlcnic_poll_rsp() argument
105 rsp = QLCRD32(adapter, QLCNIC_CDRP_CRB_OFFSET, &err); in qlcnic_poll_rsp()
111 int qlcnic_82xx_issue_cmd(struct qlcnic_adapter *adapter, in qlcnic_82xx_issue_cmd() argument
117 struct pci_dev *pdev = adapter->pdev; in qlcnic_82xx_issue_cmd()
118 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_82xx_issue_cmd()
124 if (qlcnic_api_lock(adapter)) { in qlcnic_82xx_issue_cmd()
129 QLCWR32(adapter, QLCNIC_SIGN_CRB_OFFSET, signature); in qlcnic_82xx_issue_cmd()
131 QLCWR32(adapter, QLCNIC_CDRP_ARG(i), cmd->req.arg[i]); in qlcnic_82xx_issue_cmd()
132 QLCWR32(adapter, QLCNIC_CDRP_CRB_OFFSET, in qlcnic_82xx_issue_cmd()
134 rsp = qlcnic_poll_rsp(adapter); in qlcnic_82xx_issue_cmd()
140 cmd->rsp.arg[0] = QLCRD32(adapter, QLCNIC_CDRP_ARG(1), &err); in qlcnic_82xx_issue_cmd()
163 qlcnic_dump_mbx(adapter, cmd); in qlcnic_82xx_issue_cmd()
168 cmd->rsp.arg[i] = QLCRD32(adapter, QLCNIC_CDRP_ARG(i), &err); in qlcnic_82xx_issue_cmd()
171 qlcnic_api_unlock(adapter); in qlcnic_82xx_issue_cmd()
175 int qlcnic_fw_cmd_set_drv_version(struct qlcnic_adapter *adapter, u32 fw_cmd) in qlcnic_fw_cmd_set_drv_version() argument
187 err = qlcnic_alloc_mbx_args(&cmd, adapter, fw_cmd); in qlcnic_fw_cmd_set_drv_version()
199 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_fw_cmd_set_drv_version()
201 dev_info(&adapter->pdev->dev, in qlcnic_fw_cmd_set_drv_version()
210 qlcnic_fw_cmd_set_mtu(struct qlcnic_adapter *adapter, int mtu) in qlcnic_fw_cmd_set_mtu() argument
214 struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; in qlcnic_fw_cmd_set_mtu()
218 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_SET_MTU); in qlcnic_fw_cmd_set_mtu()
225 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_fw_cmd_set_mtu()
227 dev_err(&adapter->pdev->dev, "Failed to set mtu\n"); in qlcnic_fw_cmd_set_mtu()
234 int qlcnic_82xx_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter) in qlcnic_82xx_fw_cmd_create_rx_ctx() argument
236 struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; in qlcnic_82xx_fw_cmd_create_rx_ctx()
237 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_82xx_fw_cmd_create_rx_ctx()
239 struct net_device *netdev = adapter->netdev; in qlcnic_82xx_fw_cmd_create_rx_ctx()
258 nrds_rings = adapter->max_rds_rings; in qlcnic_82xx_fw_cmd_create_rx_ctx()
259 nsds_rings = adapter->drv_sds_rings; in qlcnic_82xx_fw_cmd_create_rx_ctx()
266 addr = dma_alloc_coherent(&adapter->pdev->dev, rq_size, in qlcnic_82xx_fw_cmd_create_rx_ctx()
272 addr = dma_alloc_coherent(&adapter->pdev->dev, rsp_size, in qlcnic_82xx_fw_cmd_create_rx_ctx()
286 if (qlcnic_check_multi_tx(adapter) && in qlcnic_82xx_fw_cmd_create_rx_ctx()
287 !adapter->ahw->diag_test) { in qlcnic_82xx_fw_cmd_create_rx_ctx()
330 if (qlcnic_check_multi_tx(adapter) && in qlcnic_82xx_fw_cmd_create_rx_ctx()
331 !adapter->ahw->diag_test) in qlcnic_82xx_fw_cmd_create_rx_ctx()
338 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CREATE_RX_CTX); in qlcnic_82xx_fw_cmd_create_rx_ctx()
345 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_82xx_fw_cmd_create_rx_ctx()
347 dev_err(&adapter->pdev->dev, in qlcnic_82xx_fw_cmd_create_rx_ctx()
367 if (qlcnic_check_multi_tx(adapter) && !adapter->ahw->diag_test) in qlcnic_82xx_fw_cmd_create_rx_ctx()
385 dma_free_coherent(&adapter->pdev->dev, rsp_size, prsp, in qlcnic_82xx_fw_cmd_create_rx_ctx()
388 dma_free_coherent(&adapter->pdev->dev, rq_size, prq, hostrq_phys_addr); in qlcnic_82xx_fw_cmd_create_rx_ctx()
393 void qlcnic_82xx_fw_cmd_del_rx_ctx(struct qlcnic_adapter *adapter) in qlcnic_82xx_fw_cmd_del_rx_ctx() argument
397 struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; in qlcnic_82xx_fw_cmd_del_rx_ctx()
399 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_DESTROY_RX_CTX); in qlcnic_82xx_fw_cmd_del_rx_ctx()
404 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_82xx_fw_cmd_del_rx_ctx()
406 dev_err(&adapter->pdev->dev, in qlcnic_82xx_fw_cmd_del_rx_ctx()
413 int qlcnic_82xx_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter, in qlcnic_82xx_fw_cmd_create_tx_ctx() argument
417 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_82xx_fw_cmd_create_tx_ctx()
418 struct net_device *netdev = adapter->netdev; in qlcnic_82xx_fw_cmd_create_tx_ctx()
437 rq_addr = dma_zalloc_coherent(&adapter->pdev->dev, rq_size, in qlcnic_82xx_fw_cmd_create_tx_ctx()
443 rsp_addr = dma_zalloc_coherent(&adapter->pdev->dev, rsp_size, in qlcnic_82xx_fw_cmd_create_tx_ctx()
457 if (qlcnic_check_multi_tx(adapter) && !adapter->ahw->diag_test) in qlcnic_82xx_fw_cmd_create_tx_ctx()
462 if (qlcnic_check_multi_tx(adapter) && in qlcnic_82xx_fw_cmd_create_tx_ctx()
463 !adapter->ahw->diag_test) { in qlcnic_82xx_fw_cmd_create_tx_ctx()
464 temp_nsds_rings = adapter->drv_sds_rings; in qlcnic_82xx_fw_cmd_create_tx_ctx()
484 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CREATE_TX_CTX); in qlcnic_82xx_fw_cmd_create_tx_ctx()
491 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_82xx_fw_cmd_create_tx_ctx()
496 tx_ring->crb_cmd_producer = adapter->ahw->pci_base0 + temp; in qlcnic_82xx_fw_cmd_create_tx_ctx()
498 if (qlcnic_check_multi_tx(adapter) && in qlcnic_82xx_fw_cmd_create_tx_ctx()
499 !adapter->ahw->diag_test && in qlcnic_82xx_fw_cmd_create_tx_ctx()
500 (adapter->flags & QLCNIC_MSIX_ENABLED)) { in qlcnic_82xx_fw_cmd_create_tx_ctx()
501 index = adapter->drv_sds_rings + ring; in qlcnic_82xx_fw_cmd_create_tx_ctx()
516 dma_free_coherent(&adapter->pdev->dev, rsp_size, rsp_addr, in qlcnic_82xx_fw_cmd_create_tx_ctx()
519 dma_free_coherent(&adapter->pdev->dev, rq_size, rq_addr, rq_phys_addr); in qlcnic_82xx_fw_cmd_create_tx_ctx()
524 void qlcnic_82xx_fw_cmd_del_tx_ctx(struct qlcnic_adapter *adapter, in qlcnic_82xx_fw_cmd_del_tx_ctx() argument
530 ret = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_DESTROY_TX_CTX); in qlcnic_82xx_fw_cmd_del_tx_ctx()
535 if (qlcnic_issue_cmd(adapter, &cmd)) in qlcnic_82xx_fw_cmd_del_tx_ctx()
536 dev_err(&adapter->pdev->dev, in qlcnic_82xx_fw_cmd_del_tx_ctx()
542 qlcnic_fw_cmd_set_port(struct qlcnic_adapter *adapter, u32 config) in qlcnic_fw_cmd_set_port() argument
547 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CONFIG_PORT); in qlcnic_fw_cmd_set_port()
552 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_fw_cmd_set_port()
557 int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter) in qlcnic_alloc_hw_resources() argument
567 struct pci_dev *pdev = adapter->pdev; in qlcnic_alloc_hw_resources()
569 recv_ctx = adapter->recv_ctx; in qlcnic_alloc_hw_resources()
571 for (ring = 0; ring < adapter->drv_tx_rings; ring++) { in qlcnic_alloc_hw_resources()
572 tx_ring = &adapter->tx_ring[ring]; in qlcnic_alloc_hw_resources()
592 for (ring = 0; ring < adapter->max_rds_rings; ring++) { in qlcnic_alloc_hw_resources()
594 addr = dma_alloc_coherent(&adapter->pdev->dev, in qlcnic_alloc_hw_resources()
605 for (ring = 0; ring < adapter->drv_sds_rings; ring++) { in qlcnic_alloc_hw_resources()
608 addr = dma_alloc_coherent(&adapter->pdev->dev, in qlcnic_alloc_hw_resources()
621 qlcnic_free_hw_resources(adapter); in qlcnic_alloc_hw_resources()
686 void qlcnic_fw_destroy_ctx(struct qlcnic_adapter *adapter) in qlcnic_fw_destroy_ctx() argument
690 if (test_and_clear_bit(__QLCNIC_FW_ATTACHED, &adapter->state)) { in qlcnic_fw_destroy_ctx()
691 qlcnic_fw_cmd_del_rx_ctx(adapter); in qlcnic_fw_destroy_ctx()
692 for (ring = 0; ring < adapter->drv_tx_rings; ring++) in qlcnic_fw_destroy_ctx()
693 qlcnic_fw_cmd_del_tx_ctx(adapter, in qlcnic_fw_destroy_ctx()
694 &adapter->tx_ring[ring]); in qlcnic_fw_destroy_ctx()
696 if (qlcnic_82xx_check(adapter) && in qlcnic_fw_destroy_ctx()
697 (adapter->flags & QLCNIC_MSIX_ENABLED) && in qlcnic_fw_destroy_ctx()
698 qlcnic_check_multi_tx(adapter) && in qlcnic_fw_destroy_ctx()
699 !adapter->ahw->diag_test) in qlcnic_fw_destroy_ctx()
700 qlcnic_82xx_config_intrpt(adapter, 0); in qlcnic_fw_destroy_ctx()
702 if (qlcnic_83xx_check(adapter) && in qlcnic_fw_destroy_ctx()
703 (adapter->flags & QLCNIC_MSIX_ENABLED)) { in qlcnic_fw_destroy_ctx()
704 if (adapter->ahw->diag_test != QLCNIC_LOOPBACK_TEST) in qlcnic_fw_destroy_ctx()
705 qlcnic_83xx_config_intrpt(adapter, 0); in qlcnic_fw_destroy_ctx()
712 void qlcnic_free_hw_resources(struct qlcnic_adapter *adapter) in qlcnic_free_hw_resources() argument
720 recv_ctx = adapter->recv_ctx; in qlcnic_free_hw_resources()
722 for (ring = 0; ring < adapter->drv_tx_rings; ring++) { in qlcnic_free_hw_resources()
723 tx_ring = &adapter->tx_ring[ring]; in qlcnic_free_hw_resources()
725 dma_free_coherent(&adapter->pdev->dev, sizeof(u32), in qlcnic_free_hw_resources()
733 dma_free_coherent(&adapter->pdev->dev, in qlcnic_free_hw_resources()
741 for (ring = 0; ring < adapter->max_rds_rings; ring++) { in qlcnic_free_hw_resources()
745 dma_free_coherent(&adapter->pdev->dev, in qlcnic_free_hw_resources()
753 for (ring = 0; ring < adapter->drv_sds_rings; ring++) { in qlcnic_free_hw_resources()
757 dma_free_coherent(&adapter->pdev->dev, in qlcnic_free_hw_resources()
766 int qlcnic_82xx_config_intrpt(struct qlcnic_adapter *adapter, u8 op_type) in qlcnic_82xx_config_intrpt() argument
768 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_82xx_config_intrpt()
769 struct net_device *netdev = adapter->netdev; in qlcnic_82xx_config_intrpt()
775 err = qlcnic_alloc_mbx_args(&cmd, adapter, in qlcnic_82xx_config_intrpt()
784 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_82xx_config_intrpt()
814 int qlcnic_82xx_get_mac_address(struct qlcnic_adapter *adapter, u8 *mac, in qlcnic_82xx_get_mac_address() argument
821 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_MAC_ADDRESS); in qlcnic_82xx_get_mac_address()
826 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_82xx_get_mac_address()
837 dev_err(&adapter->pdev->dev, in qlcnic_82xx_get_mac_address()
846 int qlcnic_82xx_get_nic_info(struct qlcnic_adapter *adapter, in qlcnic_82xx_get_nic_info() argument
856 nic_info_addr = dma_zalloc_coherent(&adapter->pdev->dev, nic_size, in qlcnic_82xx_get_nic_info()
863 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_NIC_INFO); in qlcnic_82xx_get_nic_info()
870 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_82xx_get_nic_info()
872 dev_err(&adapter->pdev->dev, in qlcnic_82xx_get_nic_info()
890 dma_free_coherent(&adapter->pdev->dev, nic_size, nic_info_addr, in qlcnic_82xx_get_nic_info()
897 int qlcnic_82xx_set_nic_info(struct qlcnic_adapter *adapter, in qlcnic_82xx_set_nic_info() argument
907 if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC) in qlcnic_82xx_set_nic_info()
910 nic_info_addr = dma_zalloc_coherent(&adapter->pdev->dev, nic_size, in qlcnic_82xx_set_nic_info()
928 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_SET_NIC_INFO); in qlcnic_82xx_set_nic_info()
935 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_82xx_set_nic_info()
938 dev_err(&adapter->pdev->dev, in qlcnic_82xx_set_nic_info()
945 dma_free_coherent(&adapter->pdev->dev, nic_size, nic_info_addr, in qlcnic_82xx_set_nic_info()
952 int qlcnic_82xx_get_pci_info(struct qlcnic_adapter *adapter, in qlcnic_82xx_get_pci_info() argument
955 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_82xx_get_pci_info()
965 pci_info_addr = dma_zalloc_coherent(&adapter->pdev->dev, pci_size, in qlcnic_82xx_get_pci_info()
971 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_PCI_INFO); in qlcnic_82xx_get_pci_info()
978 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_82xx_get_pci_info()
988 err = qlcnic_get_pci_func_type(adapter, pci_info->type, in qlcnic_82xx_get_pci_info()
999 dev_err(&adapter->pdev->dev, in qlcnic_82xx_get_pci_info()
1007 dev_err(&adapter->pdev->dev, in qlcnic_82xx_get_pci_info()
1014 dma_free_coherent(&adapter->pdev->dev, pci_size, pci_info_addr, in qlcnic_82xx_get_pci_info()
1021 int qlcnic_config_port_mirroring(struct qlcnic_adapter *adapter, u8 id, in qlcnic_config_port_mirroring() argument
1024 struct device *dev = &adapter->pdev->dev; in qlcnic_config_port_mirroring()
1029 if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC || in qlcnic_config_port_mirroring()
1030 !(adapter->eswitch[id].flags & QLCNIC_SWITCH_ENABLE)) { in qlcnic_config_port_mirroring()
1031 dev_err(&adapter->pdev->dev, "%s: Not a management function\n", in qlcnic_config_port_mirroring()
1039 err = qlcnic_alloc_mbx_args(&cmd, adapter, in qlcnic_config_port_mirroring()
1045 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_config_port_mirroring()
1058 int qlcnic_get_port_stats(struct qlcnic_adapter *adapter, const u8 func, in qlcnic_get_port_stats() argument
1072 if ((adapter->ahw->op_mode != QLCNIC_MGMT_FUNC) && in qlcnic_get_port_stats()
1073 (func != adapter->ahw->pci_func)) { in qlcnic_get_port_stats()
1074 dev_err(&adapter->pdev->dev, in qlcnic_get_port_stats()
1079 stats_addr = dma_zalloc_coherent(&adapter->pdev->dev, stats_size, in qlcnic_get_port_stats()
1087 err = qlcnic_alloc_mbx_args(&cmd, adapter, in qlcnic_get_port_stats()
1095 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_get_port_stats()
1115 dma_free_coherent(&adapter->pdev->dev, stats_size, stats_addr, in qlcnic_get_port_stats()
1122 int qlcnic_get_mac_stats(struct qlcnic_adapter *adapter, in qlcnic_get_mac_stats() argument
1135 stats_addr = dma_zalloc_coherent(&adapter->pdev->dev, stats_size, in qlcnic_get_mac_stats()
1140 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_MAC_STATS); in qlcnic_get_mac_stats()
1147 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_get_mac_stats()
1170 dev_err(&adapter->pdev->dev, in qlcnic_get_mac_stats()
1177 dma_free_coherent(&adapter->pdev->dev, stats_size, stats_addr, in qlcnic_get_mac_stats()
1183 int qlcnic_get_eswitch_stats(struct qlcnic_adapter *adapter, const u8 eswitch, in qlcnic_get_eswitch_stats() argument
1192 if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC) in qlcnic_get_eswitch_stats()
1194 if (adapter->npars == NULL) in qlcnic_get_eswitch_stats()
1207 for (i = 0; i < adapter->ahw->total_nic_func; i++) { in qlcnic_get_eswitch_stats()
1208 if (adapter->npars[i].phy_port != eswitch) in qlcnic_get_eswitch_stats()
1212 if (qlcnic_get_port_stats(adapter, adapter->npars[i].pci_func, in qlcnic_get_eswitch_stats()
1237 int qlcnic_clear_esw_stats(struct qlcnic_adapter *adapter, const u8 func_esw, in qlcnic_clear_esw_stats() argument
1240 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_clear_esw_stats()
1264 err = qlcnic_alloc_mbx_args(&cmd, adapter, in qlcnic_clear_esw_stats()
1270 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_clear_esw_stats()
1275 dev_err(&adapter->pdev->dev, in qlcnic_clear_esw_stats()
1281 static int __qlcnic_get_eswitch_port_config(struct qlcnic_adapter *adapter, in __qlcnic_get_eswitch_port_config() argument
1284 struct device *dev = &adapter->pdev->dev; in __qlcnic_get_eswitch_port_config()
1289 err = qlcnic_alloc_mbx_args(&cmd, adapter, in __qlcnic_get_eswitch_port_config()
1295 err = qlcnic_issue_cmd(adapter, &cmd); in __qlcnic_get_eswitch_port_config()
1315 int qlcnic_config_switch_port(struct qlcnic_adapter *adapter, in qlcnic_config_switch_port() argument
1318 struct device *dev = &adapter->pdev->dev; in qlcnic_config_switch_port()
1324 if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC) { in qlcnic_config_switch_port()
1325 dev_err(&adapter->pdev->dev, "%s: Not a management function\n", in qlcnic_config_switch_port()
1331 index = qlcnic_is_valid_nic_func(adapter, pci_func); in qlcnic_config_switch_port()
1334 arg1 = (adapter->npars[index].phy_port & BIT_0); in qlcnic_config_switch_port()
1337 if (__qlcnic_get_eswitch_port_config(adapter, &arg1, &arg2)) in qlcnic_config_switch_port()
1346 if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_TSO) in qlcnic_config_switch_port()
1373 dev_err(&adapter->pdev->dev, "%s: Invalid opmode 0x%x\n", in qlcnic_config_switch_port()
1378 err = qlcnic_alloc_mbx_args(&cmd, adapter, in qlcnic_config_switch_port()
1385 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_config_switch_port()
1399 qlcnic_get_eswitch_port_config(struct qlcnic_adapter *adapter, in qlcnic_get_eswitch_port_config() argument
1406 if (adapter->ahw->op_mode == QLCNIC_MGMT_FUNC) { in qlcnic_get_eswitch_port_config()
1407 index = qlcnic_is_valid_nic_func(adapter, esw_cfg->pci_func); in qlcnic_get_eswitch_port_config()
1410 phy_port = adapter->npars[index].phy_port; in qlcnic_get_eswitch_port_config()
1412 phy_port = adapter->ahw->physical_port; in qlcnic_get_eswitch_port_config()
1416 if (__qlcnic_get_eswitch_port_config(adapter, &arg1, &arg2)) in qlcnic_get_eswitch_port_config()