Lines Matching refs:adapter
54 struct qlcnic_adapter *adapter, u32 type) in qlcnic_82xx_alloc_mbx_args() argument
95 qlcnic_poll_rsp(struct qlcnic_adapter *adapter) in qlcnic_poll_rsp() argument
107 rsp = QLCRD32(adapter, QLCNIC_CDRP_CRB_OFFSET, &err); in qlcnic_poll_rsp()
113 int qlcnic_82xx_issue_cmd(struct qlcnic_adapter *adapter, in qlcnic_82xx_issue_cmd() argument
119 struct pci_dev *pdev = adapter->pdev; in qlcnic_82xx_issue_cmd()
120 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_82xx_issue_cmd()
126 if (qlcnic_api_lock(adapter)) { in qlcnic_82xx_issue_cmd()
131 QLCWR32(adapter, QLCNIC_SIGN_CRB_OFFSET, signature); in qlcnic_82xx_issue_cmd()
133 QLCWR32(adapter, QLCNIC_CDRP_ARG(i), cmd->req.arg[i]); in qlcnic_82xx_issue_cmd()
134 QLCWR32(adapter, QLCNIC_CDRP_CRB_OFFSET, in qlcnic_82xx_issue_cmd()
136 rsp = qlcnic_poll_rsp(adapter); in qlcnic_82xx_issue_cmd()
142 cmd->rsp.arg[0] = QLCRD32(adapter, QLCNIC_CDRP_ARG(1), &err); in qlcnic_82xx_issue_cmd()
165 qlcnic_dump_mbx(adapter, cmd); in qlcnic_82xx_issue_cmd()
170 cmd->rsp.arg[i] = QLCRD32(adapter, QLCNIC_CDRP_ARG(i), &err); in qlcnic_82xx_issue_cmd()
173 qlcnic_api_unlock(adapter); in qlcnic_82xx_issue_cmd()
177 int qlcnic_fw_cmd_set_drv_version(struct qlcnic_adapter *adapter, u32 fw_cmd) in qlcnic_fw_cmd_set_drv_version() argument
189 err = qlcnic_alloc_mbx_args(&cmd, adapter, fw_cmd); in qlcnic_fw_cmd_set_drv_version()
201 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_fw_cmd_set_drv_version()
203 dev_info(&adapter->pdev->dev, in qlcnic_fw_cmd_set_drv_version()
212 qlcnic_fw_cmd_set_mtu(struct qlcnic_adapter *adapter, int mtu) in qlcnic_fw_cmd_set_mtu() argument
216 struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; in qlcnic_fw_cmd_set_mtu()
220 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_SET_MTU); in qlcnic_fw_cmd_set_mtu()
227 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_fw_cmd_set_mtu()
229 dev_err(&adapter->pdev->dev, "Failed to set mtu\n"); in qlcnic_fw_cmd_set_mtu()
236 int qlcnic_82xx_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter) in qlcnic_82xx_fw_cmd_create_rx_ctx() argument
238 struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; in qlcnic_82xx_fw_cmd_create_rx_ctx()
239 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_82xx_fw_cmd_create_rx_ctx()
241 struct net_device *netdev = adapter->netdev; in qlcnic_82xx_fw_cmd_create_rx_ctx()
260 nrds_rings = adapter->max_rds_rings; in qlcnic_82xx_fw_cmd_create_rx_ctx()
261 nsds_rings = adapter->drv_sds_rings; in qlcnic_82xx_fw_cmd_create_rx_ctx()
268 addr = dma_alloc_coherent(&adapter->pdev->dev, rq_size, in qlcnic_82xx_fw_cmd_create_rx_ctx()
274 addr = dma_alloc_coherent(&adapter->pdev->dev, rsp_size, in qlcnic_82xx_fw_cmd_create_rx_ctx()
288 if (qlcnic_check_multi_tx(adapter) && in qlcnic_82xx_fw_cmd_create_rx_ctx()
289 !adapter->ahw->diag_test) { in qlcnic_82xx_fw_cmd_create_rx_ctx()
332 if (qlcnic_check_multi_tx(adapter) && in qlcnic_82xx_fw_cmd_create_rx_ctx()
333 !adapter->ahw->diag_test) in qlcnic_82xx_fw_cmd_create_rx_ctx()
340 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CREATE_RX_CTX); in qlcnic_82xx_fw_cmd_create_rx_ctx()
347 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_82xx_fw_cmd_create_rx_ctx()
349 dev_err(&adapter->pdev->dev, in qlcnic_82xx_fw_cmd_create_rx_ctx()
369 if (qlcnic_check_multi_tx(adapter) && !adapter->ahw->diag_test) in qlcnic_82xx_fw_cmd_create_rx_ctx()
387 dma_free_coherent(&adapter->pdev->dev, rsp_size, prsp, in qlcnic_82xx_fw_cmd_create_rx_ctx()
390 dma_free_coherent(&adapter->pdev->dev, rq_size, prq, hostrq_phys_addr); in qlcnic_82xx_fw_cmd_create_rx_ctx()
395 void qlcnic_82xx_fw_cmd_del_rx_ctx(struct qlcnic_adapter *adapter) in qlcnic_82xx_fw_cmd_del_rx_ctx() argument
399 struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; in qlcnic_82xx_fw_cmd_del_rx_ctx()
401 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_DESTROY_RX_CTX); in qlcnic_82xx_fw_cmd_del_rx_ctx()
406 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_82xx_fw_cmd_del_rx_ctx()
408 dev_err(&adapter->pdev->dev, in qlcnic_82xx_fw_cmd_del_rx_ctx()
415 int qlcnic_82xx_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter, in qlcnic_82xx_fw_cmd_create_tx_ctx() argument
419 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_82xx_fw_cmd_create_tx_ctx()
420 struct net_device *netdev = adapter->netdev; in qlcnic_82xx_fw_cmd_create_tx_ctx()
439 rq_addr = dma_zalloc_coherent(&adapter->pdev->dev, rq_size, in qlcnic_82xx_fw_cmd_create_tx_ctx()
445 rsp_addr = dma_zalloc_coherent(&adapter->pdev->dev, rsp_size, in qlcnic_82xx_fw_cmd_create_tx_ctx()
459 if (qlcnic_check_multi_tx(adapter) && !adapter->ahw->diag_test) in qlcnic_82xx_fw_cmd_create_tx_ctx()
464 if (qlcnic_check_multi_tx(adapter) && in qlcnic_82xx_fw_cmd_create_tx_ctx()
465 !adapter->ahw->diag_test) { in qlcnic_82xx_fw_cmd_create_tx_ctx()
466 temp_nsds_rings = adapter->drv_sds_rings; in qlcnic_82xx_fw_cmd_create_tx_ctx()
486 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CREATE_TX_CTX); in qlcnic_82xx_fw_cmd_create_tx_ctx()
493 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_82xx_fw_cmd_create_tx_ctx()
498 tx_ring->crb_cmd_producer = adapter->ahw->pci_base0 + temp; in qlcnic_82xx_fw_cmd_create_tx_ctx()
500 if (qlcnic_check_multi_tx(adapter) && in qlcnic_82xx_fw_cmd_create_tx_ctx()
501 !adapter->ahw->diag_test && in qlcnic_82xx_fw_cmd_create_tx_ctx()
502 (adapter->flags & QLCNIC_MSIX_ENABLED)) { in qlcnic_82xx_fw_cmd_create_tx_ctx()
503 index = adapter->drv_sds_rings + ring; in qlcnic_82xx_fw_cmd_create_tx_ctx()
518 dma_free_coherent(&adapter->pdev->dev, rsp_size, rsp_addr, in qlcnic_82xx_fw_cmd_create_tx_ctx()
521 dma_free_coherent(&adapter->pdev->dev, rq_size, rq_addr, rq_phys_addr); in qlcnic_82xx_fw_cmd_create_tx_ctx()
526 void qlcnic_82xx_fw_cmd_del_tx_ctx(struct qlcnic_adapter *adapter, in qlcnic_82xx_fw_cmd_del_tx_ctx() argument
532 ret = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_DESTROY_TX_CTX); in qlcnic_82xx_fw_cmd_del_tx_ctx()
537 if (qlcnic_issue_cmd(adapter, &cmd)) in qlcnic_82xx_fw_cmd_del_tx_ctx()
538 dev_err(&adapter->pdev->dev, in qlcnic_82xx_fw_cmd_del_tx_ctx()
544 qlcnic_fw_cmd_set_port(struct qlcnic_adapter *adapter, u32 config) in qlcnic_fw_cmd_set_port() argument
549 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CONFIG_PORT); in qlcnic_fw_cmd_set_port()
554 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_fw_cmd_set_port()
559 int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter) in qlcnic_alloc_hw_resources() argument
569 struct pci_dev *pdev = adapter->pdev; in qlcnic_alloc_hw_resources()
571 recv_ctx = adapter->recv_ctx; in qlcnic_alloc_hw_resources()
573 for (ring = 0; ring < adapter->drv_tx_rings; ring++) { in qlcnic_alloc_hw_resources()
574 tx_ring = &adapter->tx_ring[ring]; in qlcnic_alloc_hw_resources()
594 for (ring = 0; ring < adapter->max_rds_rings; ring++) { in qlcnic_alloc_hw_resources()
596 addr = dma_alloc_coherent(&adapter->pdev->dev, in qlcnic_alloc_hw_resources()
607 for (ring = 0; ring < adapter->drv_sds_rings; ring++) { in qlcnic_alloc_hw_resources()
610 addr = dma_alloc_coherent(&adapter->pdev->dev, in qlcnic_alloc_hw_resources()
623 qlcnic_free_hw_resources(adapter); in qlcnic_alloc_hw_resources()
688 void qlcnic_fw_destroy_ctx(struct qlcnic_adapter *adapter) in qlcnic_fw_destroy_ctx() argument
692 if (test_and_clear_bit(__QLCNIC_FW_ATTACHED, &adapter->state)) { in qlcnic_fw_destroy_ctx()
693 qlcnic_fw_cmd_del_rx_ctx(adapter); in qlcnic_fw_destroy_ctx()
694 for (ring = 0; ring < adapter->drv_tx_rings; ring++) in qlcnic_fw_destroy_ctx()
695 qlcnic_fw_cmd_del_tx_ctx(adapter, in qlcnic_fw_destroy_ctx()
696 &adapter->tx_ring[ring]); in qlcnic_fw_destroy_ctx()
698 if (qlcnic_82xx_check(adapter) && in qlcnic_fw_destroy_ctx()
699 (adapter->flags & QLCNIC_MSIX_ENABLED) && in qlcnic_fw_destroy_ctx()
700 qlcnic_check_multi_tx(adapter) && in qlcnic_fw_destroy_ctx()
701 !adapter->ahw->diag_test) in qlcnic_fw_destroy_ctx()
702 qlcnic_82xx_config_intrpt(adapter, 0); in qlcnic_fw_destroy_ctx()
704 if (qlcnic_83xx_check(adapter) && in qlcnic_fw_destroy_ctx()
705 (adapter->flags & QLCNIC_MSIX_ENABLED)) { in qlcnic_fw_destroy_ctx()
706 if (adapter->ahw->diag_test != QLCNIC_LOOPBACK_TEST) in qlcnic_fw_destroy_ctx()
707 qlcnic_83xx_config_intrpt(adapter, 0); in qlcnic_fw_destroy_ctx()
714 void qlcnic_free_hw_resources(struct qlcnic_adapter *adapter) in qlcnic_free_hw_resources() argument
722 recv_ctx = adapter->recv_ctx; in qlcnic_free_hw_resources()
724 for (ring = 0; ring < adapter->drv_tx_rings; ring++) { in qlcnic_free_hw_resources()
725 tx_ring = &adapter->tx_ring[ring]; in qlcnic_free_hw_resources()
727 dma_free_coherent(&adapter->pdev->dev, sizeof(u32), in qlcnic_free_hw_resources()
735 dma_free_coherent(&adapter->pdev->dev, in qlcnic_free_hw_resources()
743 for (ring = 0; ring < adapter->max_rds_rings; ring++) { in qlcnic_free_hw_resources()
747 dma_free_coherent(&adapter->pdev->dev, in qlcnic_free_hw_resources()
755 for (ring = 0; ring < adapter->drv_sds_rings; ring++) { in qlcnic_free_hw_resources()
759 dma_free_coherent(&adapter->pdev->dev, in qlcnic_free_hw_resources()
768 int qlcnic_82xx_config_intrpt(struct qlcnic_adapter *adapter, u8 op_type) in qlcnic_82xx_config_intrpt() argument
770 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_82xx_config_intrpt()
771 struct net_device *netdev = adapter->netdev; in qlcnic_82xx_config_intrpt()
777 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()