Lines Matching +full:pcie +full:- +full:mac

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2005 - 2016 Broadcom
7 * linux-drivers@emulex.com
20 …"Optics faulted/incorrectly installed/not installed - Reseat optics. If issue not resolved, replac…
24 "Uncertified optics – Replace with Avago-certified optics to enable link operation."
35 "Link is non-operational",
103 u32 cmd_privileges = adapter->cmd_privileges; in be_cmd_allowed()
116 return wrb->payload.embedded_payload; in embedded_payload()
121 struct be_queue_info *mccq = &adapter->mcc_obj.q; in be_mcc_notify()
125 return -EIO; in be_mcc_notify()
127 val |= mccq->id & DB_MCCQ_RING_ID_MASK; in be_mcc_notify()
131 iowrite32(val, adapter->db + DB_MCCQ_OFFSET); in be_mcc_notify()
143 if (compl->flags != 0) { in be_mcc_compl_is_new()
144 flags = le32_to_cpu(compl->flags); in be_mcc_compl_is_new()
146 compl->flags = flags; in be_mcc_compl_is_new()
156 compl->flags = 0; in be_mcc_compl_use()
189 enum mcc_base_status base_status = base_status(compl->status); in be_async_cmd_process()
193 opcode = resp_hdr->opcode; in be_async_cmd_process()
194 subsystem = resp_hdr->subsystem; in be_async_cmd_process()
199 complete(&adapter->et_cmd_compl); in be_async_cmd_process()
205 complete(&adapter->et_cmd_compl); in be_async_cmd_process()
212 adapter->flash_status = compl->status; in be_async_cmd_process()
213 complete(&adapter->et_cmd_compl); in be_async_cmd_process()
222 adapter->stats_cmd_sent = false; in be_async_cmd_process()
231 adapter->hwmon_info.be_on_die_temp = in be_async_cmd_process()
232 resp->on_die_temperature; in be_async_cmd_process()
234 adapter->be_get_temp_freq = 0; in be_async_cmd_process()
235 adapter->hwmon_info.be_on_die_temp = in be_async_cmd_process()
254 base_status = base_status(compl->status); in be_mcc_compl_process()
255 addl_status = addl_status(compl->status); in be_mcc_compl_process()
257 resp_hdr = be_decode_resp_hdr(compl->tag0, compl->tag1); in be_mcc_compl_process()
259 opcode = resp_hdr->opcode; in be_mcc_compl_process()
260 subsystem = resp_hdr->subsystem; in be_mcc_compl_process()
269 dev_warn(&adapter->pdev->dev, in be_mcc_compl_process()
270 "VF is not privileged to issue opcode %d-%d\n", in be_mcc_compl_process()
273 dev_err(&adapter->pdev->dev, in be_mcc_compl_process()
274 "opcode %d-%d failed:status %d-%d\n", in be_mcc_compl_process()
278 return compl->status; in be_mcc_compl_process()
288 /* When link status changes, link speed must be re-queried from FW */ in be_async_link_state_process()
289 adapter->phy.link_speed = -1; in be_async_link_state_process()
297 !(evt->port_link_status & LOGICAL_LINK_STATUS_MASK)) in be_async_link_state_process()
303 if (adapter->flags & BE_FLAGS_LINK_STATUS_INIT) in be_async_link_state_process()
305 evt->port_link_status & LINK_STATUS_MASK); in be_async_link_state_process()
313 u32 sfp_misconfig_evt_word1 = le32_to_cpu(evt->event_data_word1); in be_async_port_misconfig_event_process()
314 u32 sfp_misconfig_evt_word2 = le32_to_cpu(evt->event_data_word2); in be_async_port_misconfig_event_process()
316 struct device *dev = &adapter->pdev->dev; in be_async_port_misconfig_event_process()
322 (sfp_misconfig_evt_word1 >> (adapter->hba_port_num * 8)) & 0xff; in be_async_port_misconfig_event_process()
324 if (new_phy_state == adapter->phy_state) in be_async_port_misconfig_event_process()
327 adapter->phy_state = new_phy_state; in be_async_port_misconfig_event_process()
334 (sfp_misconfig_evt_word2 >> (adapter->hba_port_num * 8)) & 0xff; in be_async_port_misconfig_event_process()
350 adapter->port_name, in be_async_port_misconfig_event_process()
356 adapter->port_name, in be_async_port_misconfig_event_process()
362 adapter->flags |= BE_FLAGS_PHY_MISCONFIGURED; in be_async_port_misconfig_event_process()
372 if (evt->valid) { in be_async_grp5_cos_priority_process()
373 adapter->vlan_prio_bmap = evt->available_priority_bmap; in be_async_grp5_cos_priority_process()
374 adapter->recommended_prio_bits = in be_async_grp5_cos_priority_process()
375 evt->reco_default_priority << VLAN_PRIO_SHIFT; in be_async_grp5_cos_priority_process()
386 if (adapter->phy.link_speed >= 0 && in be_async_grp5_qos_speed_process()
387 evt->physical_port == adapter->port_num) in be_async_grp5_qos_speed_process()
388 adapter->phy.link_speed = le16_to_cpu(evt->qos_link_speed) * 10; in be_async_grp5_qos_speed_process()
398 if (evt->enabled) { in be_async_grp5_pvid_state_process()
399 adapter->pvid = le16_to_cpu(evt->tag) & VLAN_VID_MASK; in be_async_grp5_pvid_state_process()
400 dev_info(&adapter->pdev->dev, "LPVID: %d\n", adapter->pvid); in be_async_grp5_pvid_state_process()
402 adapter->pvid = 0; in be_async_grp5_pvid_state_process()
411 u32 evt_dw1 = le32_to_cpu(evt->event_data_word1); in be_async_grp5_fw_control_process()
414 adapter->flags |= BE_FLAGS_OS2BMC; in be_async_grp5_fw_control_process()
415 adapter->bmc_filt_mask = le32_to_cpu(evt->event_data_word2); in be_async_grp5_fw_control_process()
417 adapter->flags &= ~BE_FLAGS_OS2BMC; in be_async_grp5_fw_control_process()
424 u8 event_type = (compl->flags >> ASYNC_EVENT_TYPE_SHIFT) & in be_async_grp5_evt_process()
437 /* Async event to disable/enable os2bmc and/or mac-learning */ in be_async_grp5_evt_process()
452 event_type = (cmp->flags >> ASYNC_EVENT_TYPE_SHIFT) & in be_async_dbg_evt_process()
457 if (evt->valid) in be_async_dbg_evt_process()
458 adapter->qnq_vid = le16_to_cpu(evt->vlan_tag); in be_async_dbg_evt_process()
459 adapter->flags |= BE_FLAGS_QNQ_ASYNC_EVT_RCVD; in be_async_dbg_evt_process()
462 dev_warn(&adapter->pdev->dev, "Unknown debug event 0x%x!\n", in be_async_dbg_evt_process()
471 u8 event_type = (cmp->flags >> ASYNC_EVENT_TYPE_SHIFT) & in be_async_sliport_evt_process()
505 if (is_link_state_evt(compl->flags)) in be_mcc_event_process()
507 else if (is_grp5_evt(compl->flags)) in be_mcc_event_process()
509 else if (is_dbg_evt(compl->flags)) in be_mcc_event_process()
511 else if (is_sliport_evt(compl->flags)) in be_mcc_event_process()
517 struct be_queue_info *mcc_cq = &adapter->mcc_obj.cq; in be_mcc_compl_get()
529 spin_lock_bh(&adapter->mcc_cq_lock); in be_async_mcc_enable()
531 be_cq_notify(adapter, adapter->mcc_obj.cq.id, true, 0); in be_async_mcc_enable()
532 adapter->mcc_obj.rearm_cq = true; in be_async_mcc_enable()
534 spin_unlock_bh(&adapter->mcc_cq_lock); in be_async_mcc_enable()
539 spin_lock_bh(&adapter->mcc_cq_lock); in be_async_mcc_disable()
541 adapter->mcc_obj.rearm_cq = false; in be_async_mcc_disable()
542 be_cq_notify(adapter, adapter->mcc_obj.cq.id, false, 0); in be_async_mcc_disable()
544 spin_unlock_bh(&adapter->mcc_cq_lock); in be_async_mcc_disable()
551 struct be_mcc_obj *mcc_obj = &adapter->mcc_obj; in be_process_mcc()
553 spin_lock(&adapter->mcc_cq_lock); in be_process_mcc()
556 if (compl->flags & CQE_FLAGS_ASYNC_MASK) { in be_process_mcc()
558 } else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) { in be_process_mcc()
560 atomic_dec(&mcc_obj->q.used); in be_process_mcc()
567 be_cq_notify(adapter, mcc_obj->cq.id, mcc_obj->rearm_cq, num); in be_process_mcc()
569 spin_unlock(&adapter->mcc_cq_lock); in be_process_mcc()
578 struct be_mcc_obj *mcc_obj = &adapter->mcc_obj; in be_mcc_wait_compl()
582 return -EIO; in be_mcc_wait_compl()
588 if (atomic_read(&mcc_obj->q.used) == 0) in be_mcc_wait_compl()
593 dev_err(&adapter->pdev->dev, "FW not responding\n"); in be_mcc_wait_compl()
595 return -EIO; in be_mcc_wait_compl()
605 struct be_mcc_obj *mcc_obj = &adapter->mcc_obj; in be_mcc_notify_wait()
606 u32 index = mcc_obj->q.head; in be_mcc_notify_wait()
609 index_dec(&index, mcc_obj->q.len); in be_mcc_notify_wait()
610 wrb = queue_index_node(&mcc_obj->q, index); in be_mcc_notify_wait()
612 resp = be_decode_resp_hdr(wrb->tag0, wrb->tag1); in be_mcc_notify_wait()
619 if (status == -EIO) in be_mcc_notify_wait()
622 status = (resp->base_status | in be_mcc_notify_wait()
623 ((resp->addl_status & CQE_ADDL_STATUS_MASK) << in be_mcc_notify_wait()
636 return -EIO; in be_mbox_db_ready_wait()
640 return -1; in be_mbox_db_ready_wait()
647 dev_err(&adapter->pdev->dev, "FW not responding\n"); in be_mbox_db_ready_wait()
650 return -1; in be_mbox_db_ready_wait()
668 void __iomem *db = adapter->db + MPU_MAILBOX_DB_OFFSET; in be_mbox_notify_wait()
669 struct be_dma_mem *mbox_mem = &adapter->mbox_mem; in be_mbox_notify_wait()
670 struct be_mcc_mailbox *mbox = mbox_mem->va; in be_mbox_notify_wait()
671 struct be_mcc_compl *compl = &mbox->compl; in be_mbox_notify_wait()
679 /* at bits 2 - 31 place mbox dma addr msb bits 34 - 63 */ in be_mbox_notify_wait()
680 val |= (upper_32_bits(mbox_mem->dma) >> 2) << 2; in be_mbox_notify_wait()
689 /* at bits 2 - 31 place mbox dma addr lsb bits 4 - 33 */ in be_mbox_notify_wait()
690 val |= (u32)(mbox_mem->dma >> 4) << 2; in be_mbox_notify_wait()
699 status = be_mcc_compl_process(adapter, &mbox->compl); in be_mbox_notify_wait()
704 dev_err(&adapter->pdev->dev, "invalid mailbox completion\n"); in be_mbox_notify_wait()
705 return -1; in be_mbox_notify_wait()
715 sem = ioread32(adapter->csr + SLIPORT_SEMAPHORE_OFFSET_BEx); in be_POST_stage_get()
717 pci_read_config_dword(adapter->pdev, in be_POST_stage_get()
730 sliport_status = ioread32(adapter->db + SLIPORT_STATUS_OFFSET); in lancer_wait_ready()
736 return -EIO; in lancer_wait_ready()
741 return sliport_status ? : -1; in lancer_wait_ready()
748 struct device *dev = &adapter->pdev->dev; in be_fw_wait_ready()
771 return -EINTR; in be_fw_wait_ready()
778 return -ETIMEDOUT; in be_fw_wait_ready()
783 return &wrb->payload.sgl[0]; in nonembedded_sgl()
788 wrb->tag0 = addr & 0xFFFFFFFF; in fill_wrb_tags()
789 wrb->tag1 = upper_32_bits(addr); in fill_wrb_tags()
801 req_hdr->opcode = opcode; in be_wrb_cmd_hdr_prepare()
802 req_hdr->subsystem = subsystem; in be_wrb_cmd_hdr_prepare()
803 req_hdr->request_length = cpu_to_le32(cmd_len - sizeof(*req_hdr)); in be_wrb_cmd_hdr_prepare()
804 req_hdr->version = 0; in be_wrb_cmd_hdr_prepare()
806 wrb->payload_length = cmd_len; in be_wrb_cmd_hdr_prepare()
808 wrb->embedded |= (1 & MCC_WRB_SGE_CNT_MASK) << in be_wrb_cmd_hdr_prepare()
811 sge->pa_hi = cpu_to_le32(upper_32_bits(mem->dma)); in be_wrb_cmd_hdr_prepare()
812 sge->pa_lo = cpu_to_le32(mem->dma & 0xFFFFFFFF); in be_wrb_cmd_hdr_prepare()
813 sge->len = cpu_to_le32(mem->size); in be_wrb_cmd_hdr_prepare()
815 wrb->embedded |= MCC_WRB_EMBEDDED_MASK; in be_wrb_cmd_hdr_prepare()
822 int i, buf_pages = min(PAGES_4K_SPANNED(mem->va, mem->size), max_pages); in be_cmd_page_addrs_prepare()
823 u64 dma = (u64)mem->dma; in be_cmd_page_addrs_prepare()
834 struct be_dma_mem *mbox_mem = &adapter->mbox_mem; in wrb_from_mbox()
836 = &((struct be_mcc_mailbox *)(mbox_mem->va))->wrb; in wrb_from_mbox()
843 struct be_queue_info *mccq = &adapter->mcc_obj.q; in wrb_from_mccq()
846 if (!mccq->created) in wrb_from_mccq()
849 if (atomic_read(&mccq->used) >= mccq->len) in wrb_from_mccq()
854 atomic_inc(&mccq->used); in wrb_from_mccq()
861 return adapter->mcc_obj.q.created; in use_mcc()
868 mutex_lock(&adapter->mcc_lock); in be_cmd_lock()
871 return mutex_lock_interruptible(&adapter->mbox_lock); in be_cmd_lock()
879 return mutex_unlock(&adapter->mcc_lock); in be_cmd_unlock()
881 return mutex_unlock(&adapter->mbox_lock); in be_cmd_unlock()
898 if (wrb->embedded & cpu_to_le32(MCC_WRB_EMBEDDED_MASK)) in be_cmd_copy()
917 status = -EBUSY; in be_cmd_notify_wait()
945 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_fw_init()
946 return -1; in be_cmd_fw_init()
960 mutex_unlock(&adapter->mbox_lock); in be_cmd_fw_init()
975 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_fw_clean()
976 return -1; in be_cmd_fw_clean()
990 mutex_unlock(&adapter->mbox_lock); in be_cmd_fw_clean()
998 struct be_dma_mem *q_mem = &eqo->q.dma_mem; in be_cmd_eq_create()
1001 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_eq_create()
1002 return -1; in be_cmd_eq_create()
1007 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_eq_create()
1011 /* Support for EQ_CREATEv2 available only SH-R onwards */ in be_cmd_eq_create()
1015 req->hdr.version = ver; in be_cmd_eq_create()
1016 req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); in be_cmd_eq_create()
1018 AMAP_SET_BITS(struct amap_eq_context, valid, req->context, 1); in be_cmd_eq_create()
1020 AMAP_SET_BITS(struct amap_eq_context, size, req->context, 0); in be_cmd_eq_create()
1021 AMAP_SET_BITS(struct amap_eq_context, count, req->context, in be_cmd_eq_create()
1022 __ilog2_u32(eqo->q.len / 256)); in be_cmd_eq_create()
1023 be_dws_cpu_to_le(req->context, sizeof(req->context)); in be_cmd_eq_create()
1025 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); in be_cmd_eq_create()
1031 eqo->q.id = le16_to_cpu(resp->eq_id); in be_cmd_eq_create()
1032 eqo->msix_idx = in be_cmd_eq_create()
1033 (ver == 2) ? le16_to_cpu(resp->msix_idx) : eqo->idx; in be_cmd_eq_create()
1034 eqo->q.created = true; in be_cmd_eq_create()
1037 mutex_unlock(&adapter->mbox_lock); in be_cmd_eq_create()
1049 mutex_lock(&adapter->mcc_lock); in be_cmd_mac_addr_query()
1053 status = -EBUSY; in be_cmd_mac_addr_query()
1058 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_mac_addr_query()
1061 req->type = MAC_ADDRESS_TYPE_NETWORK; in be_cmd_mac_addr_query()
1063 req->permanent = 1; in be_cmd_mac_addr_query()
1065 req->if_id = cpu_to_le16((u16)if_handle); in be_cmd_mac_addr_query()
1066 req->pmac_id = cpu_to_le32(pmac_id); in be_cmd_mac_addr_query()
1067 req->permanent = 0; in be_cmd_mac_addr_query()
1074 memcpy(mac_addr, resp->mac.addr, ETH_ALEN); in be_cmd_mac_addr_query()
1078 mutex_unlock(&adapter->mcc_lock); in be_cmd_mac_addr_query()
1090 mutex_lock(&adapter->mcc_lock); in be_cmd_pmac_add()
1094 status = -EBUSY; in be_cmd_pmac_add()
1099 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_pmac_add()
1103 req->hdr.domain = domain; in be_cmd_pmac_add()
1104 req->if_id = cpu_to_le32(if_id); in be_cmd_pmac_add()
1105 memcpy(req->mac_address, mac_addr, ETH_ALEN); in be_cmd_pmac_add()
1111 *pmac_id = le32_to_cpu(resp->pmac_id); in be_cmd_pmac_add()
1115 mutex_unlock(&adapter->mcc_lock); in be_cmd_pmac_add()
1118 status = -EPERM; in be_cmd_pmac_add()
1130 if (pmac_id == -1) in be_cmd_pmac_del()
1133 mutex_lock(&adapter->mcc_lock); in be_cmd_pmac_del()
1137 status = -EBUSY; in be_cmd_pmac_del()
1142 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_pmac_del()
1146 req->hdr.domain = dom; in be_cmd_pmac_del()
1147 req->if_id = cpu_to_le32(if_id); in be_cmd_pmac_del()
1148 req->pmac_id = cpu_to_le32(pmac_id); in be_cmd_pmac_del()
1153 mutex_unlock(&adapter->mcc_lock); in be_cmd_pmac_del()
1163 struct be_dma_mem *q_mem = &cq->dma_mem; in be_cmd_cq_create()
1167 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_cq_create()
1168 return -1; in be_cmd_cq_create()
1172 ctxt = &req->context; in be_cmd_cq_create()
1174 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_cq_create()
1178 req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); in be_cmd_cq_create()
1186 __ilog2_u32(cq->len / 256)); in be_cmd_cq_create()
1189 AMAP_SET_BITS(struct amap_cq_context_be, eqid, ctxt, eq->id); in be_cmd_cq_create()
1191 req->hdr.version = 2; in be_cmd_cq_create()
1192 req->page_size = 1; /* 1 for 4K */ in be_cmd_cq_create()
1194 /* coalesce-wm field in this cmd is not relevant to Lancer. in be_cmd_cq_create()
1203 __ilog2_u32(cq->len / 256)); in be_cmd_cq_create()
1206 AMAP_SET_BITS(struct amap_cq_context_v2, eqid, ctxt, eq->id); in be_cmd_cq_create()
1209 be_dws_cpu_to_le(ctxt, sizeof(req->context)); in be_cmd_cq_create()
1211 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); in be_cmd_cq_create()
1217 cq->id = le16_to_cpu(resp->cq_id); in be_cmd_cq_create()
1218 cq->created = true; in be_cmd_cq_create()
1221 mutex_unlock(&adapter->mbox_lock); in be_cmd_cq_create()
1241 struct be_dma_mem *q_mem = &mccq->dma_mem; in be_cmd_mccq_ext_create()
1245 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_mccq_ext_create()
1246 return -1; in be_cmd_mccq_ext_create()
1250 ctxt = &req->context; in be_cmd_mccq_ext_create()
1252 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_mccq_ext_create()
1256 req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); in be_cmd_mccq_ext_create()
1260 be_encoded_q_len(mccq->len)); in be_cmd_mccq_ext_create()
1261 AMAP_SET_BITS(struct amap_mcc_context_be, cq_id, ctxt, cq->id); in be_cmd_mccq_ext_create()
1263 req->hdr.version = 1; in be_cmd_mccq_ext_create()
1264 req->cq_id = cpu_to_le16(cq->id); in be_cmd_mccq_ext_create()
1267 be_encoded_q_len(mccq->len)); in be_cmd_mccq_ext_create()
1270 ctxt, cq->id); in be_cmd_mccq_ext_create()
1278 req->async_event_bitmap[0] = in be_cmd_mccq_ext_create()
1284 be_dws_cpu_to_le(ctxt, sizeof(req->context)); in be_cmd_mccq_ext_create()
1286 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); in be_cmd_mccq_ext_create()
1292 mccq->id = le16_to_cpu(resp->id); in be_cmd_mccq_ext_create()
1293 mccq->created = true; in be_cmd_mccq_ext_create()
1295 mutex_unlock(&adapter->mbox_lock); in be_cmd_mccq_ext_create()
1306 struct be_dma_mem *q_mem = &mccq->dma_mem; in be_cmd_mccq_org_create()
1310 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_mccq_org_create()
1311 return -1; in be_cmd_mccq_org_create()
1315 ctxt = &req->context; in be_cmd_mccq_org_create()
1317 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_mccq_org_create()
1321 req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); in be_cmd_mccq_org_create()
1325 be_encoded_q_len(mccq->len)); in be_cmd_mccq_org_create()
1326 AMAP_SET_BITS(struct amap_mcc_context_be, cq_id, ctxt, cq->id); in be_cmd_mccq_org_create()
1328 be_dws_cpu_to_le(ctxt, sizeof(req->context)); in be_cmd_mccq_org_create()
1330 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); in be_cmd_mccq_org_create()
1336 mccq->id = le16_to_cpu(resp->id); in be_cmd_mccq_org_create()
1337 mccq->created = true; in be_cmd_mccq_org_create()
1340 mutex_unlock(&adapter->mbox_lock); in be_cmd_mccq_org_create()
1351 dev_warn(&adapter->pdev->dev, "Upgrade to F/W ver 2.102.235.0 " in be_cmd_mccq_create()
1363 struct be_queue_info *txq = &txo->q; in be_cmd_txq_create()
1364 struct be_queue_info *cq = &txo->cq; in be_cmd_txq_create()
1365 struct be_dma_mem *q_mem = &txq->dma_mem; in be_cmd_txq_create()
1369 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, in be_cmd_txq_create()
1373 req->hdr.version = 1; in be_cmd_txq_create()
1375 if (adapter->function_caps & BE_FUNCTION_CAPS_SUPER_NIC) in be_cmd_txq_create()
1376 req->hdr.version = 2; in be_cmd_txq_create()
1378 req->hdr.version = 2; in be_cmd_txq_create()
1381 if (req->hdr.version > 0) in be_cmd_txq_create()
1382 req->if_id = cpu_to_le16(adapter->if_handle); in be_cmd_txq_create()
1383 req->num_pages = PAGES_4K_SPANNED(q_mem->va, q_mem->size); in be_cmd_txq_create()
1384 req->ulp_num = BE_ULP1_NUM; in be_cmd_txq_create()
1385 req->type = BE_ETH_TX_RING_TYPE_STANDARD; in be_cmd_txq_create()
1386 req->cq_id = cpu_to_le16(cq->id); in be_cmd_txq_create()
1387 req->queue_size = be_encoded_q_len(txq->len); in be_cmd_txq_create()
1388 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); in be_cmd_txq_create()
1389 ver = req->hdr.version; in be_cmd_txq_create()
1395 txq->id = le16_to_cpu(resp->cid); in be_cmd_txq_create()
1397 txo->db_offset = le32_to_cpu(resp->db_offset); in be_cmd_txq_create()
1399 txo->db_offset = DB_TXULP1_OFFSET; in be_cmd_txq_create()
1400 txq->created = true; in be_cmd_txq_create()
1413 struct be_dma_mem *q_mem = &rxq->dma_mem; in be_cmd_rxq_create()
1416 mutex_lock(&adapter->mcc_lock); in be_cmd_rxq_create()
1420 status = -EBUSY; in be_cmd_rxq_create()
1425 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, in be_cmd_rxq_create()
1428 req->cq_id = cpu_to_le16(cq_id); in be_cmd_rxq_create()
1429 req->frag_size = fls(frag_size) - 1; in be_cmd_rxq_create()
1430 req->num_pages = 2; in be_cmd_rxq_create()
1431 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); in be_cmd_rxq_create()
1432 req->interface_id = cpu_to_le32(if_id); in be_cmd_rxq_create()
1433 req->max_frame_size = cpu_to_le16(BE_MAX_JUMBO_FRAME_SIZE); in be_cmd_rxq_create()
1434 req->rss_queue = cpu_to_le32(rss); in be_cmd_rxq_create()
1440 rxq->id = le16_to_cpu(resp->id); in be_cmd_rxq_create()
1441 rxq->created = true; in be_cmd_rxq_create()
1442 *rss_id = resp->rss_id; in be_cmd_rxq_create()
1446 mutex_unlock(&adapter->mcc_lock); in be_cmd_rxq_create()
1461 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_q_destroy()
1462 return -1; in be_cmd_q_destroy()
1492 be_wrb_cmd_hdr_prepare(&req->hdr, subsys, opcode, sizeof(*req), wrb, in be_cmd_q_destroy()
1494 req->id = cpu_to_le16(q->id); in be_cmd_q_destroy()
1497 q->created = false; in be_cmd_q_destroy()
1499 mutex_unlock(&adapter->mbox_lock); in be_cmd_q_destroy()
1510 mutex_lock(&adapter->mcc_lock); in be_cmd_rxq_destroy()
1514 status = -EBUSY; in be_cmd_rxq_destroy()
1519 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, in be_cmd_rxq_destroy()
1521 req->id = cpu_to_le16(q->id); in be_cmd_rxq_destroy()
1524 q->created = false; in be_cmd_rxq_destroy()
1527 mutex_unlock(&adapter->mcc_lock); in be_cmd_rxq_destroy()
1542 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_if_create()
1545 req->hdr.domain = domain; in be_cmd_if_create()
1546 req->capability_flags = cpu_to_le32(cap_flags); in be_cmd_if_create()
1547 req->enable_flags = cpu_to_le32(en_flags); in be_cmd_if_create()
1548 req->pmac_invalid = true; in be_cmd_if_create()
1554 *if_handle = le32_to_cpu(resp->interface_id); in be_cmd_if_create()
1556 /* Hack to retrieve VF's pmac-id on BE3 */ in be_cmd_if_create()
1558 adapter->pmac_id[0] = le32_to_cpu(resp->pmac_id); in be_cmd_if_create()
1570 if (interface_id == -1) in be_cmd_if_destroy()
1575 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_if_destroy()
1578 req->hdr.domain = domain; in be_cmd_if_destroy()
1579 req->interface_id = cpu_to_le32(interface_id); in be_cmd_if_destroy()
1595 mutex_lock(&adapter->mcc_lock); in be_cmd_get_stats()
1599 status = -EBUSY; in be_cmd_get_stats()
1602 hdr = nonemb_cmd->va; in be_cmd_get_stats()
1605 OPCODE_ETH_GET_STATISTICS, nonemb_cmd->size, wrb, in be_cmd_get_stats()
1610 hdr->version = 0; in be_cmd_get_stats()
1612 hdr->version = 1; in be_cmd_get_stats()
1614 hdr->version = 2; in be_cmd_get_stats()
1620 adapter->stats_cmd_sent = true; in be_cmd_get_stats()
1623 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_stats()
1637 return -EPERM; in lancer_cmd_get_pport_stats()
1639 mutex_lock(&adapter->mcc_lock); in lancer_cmd_get_pport_stats()
1643 status = -EBUSY; in lancer_cmd_get_pport_stats()
1646 req = nonemb_cmd->va; in lancer_cmd_get_pport_stats()
1648 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, in lancer_cmd_get_pport_stats()
1649 OPCODE_ETH_GET_PPORT_STATS, nonemb_cmd->size, in lancer_cmd_get_pport_stats()
1652 req->cmd_params.params.pport_num = cpu_to_le16(adapter->hba_port_num); in lancer_cmd_get_pport_stats()
1653 req->cmd_params.params.reset_stats = 0; in lancer_cmd_get_pport_stats()
1659 adapter->stats_cmd_sent = true; in lancer_cmd_get_pport_stats()
1662 mutex_unlock(&adapter->mcc_lock); in lancer_cmd_get_pport_stats()
1699 mutex_lock(&adapter->mcc_lock); in be_cmd_link_status_query()
1706 status = -EBUSY; in be_cmd_link_status_query()
1711 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_link_status_query()
1717 req->hdr.version = 1; in be_cmd_link_status_query()
1719 req->hdr.domain = dom; in be_cmd_link_status_query()
1726 *link_speed = resp->link_speed ? in be_cmd_link_status_query()
1727 le16_to_cpu(resp->link_speed) * 10 : in be_cmd_link_status_query()
1728 be_mac_to_link_speed(resp->mac_speed); in be_cmd_link_status_query()
1730 if (!resp->logical_link_status) in be_cmd_link_status_query()
1734 *link_status = resp->logical_link_status; in be_cmd_link_status_query()
1738 mutex_unlock(&adapter->mcc_lock); in be_cmd_link_status_query()
1749 mutex_lock(&adapter->mcc_lock); in be_cmd_get_die_temperature()
1753 status = -EBUSY; in be_cmd_get_die_temperature()
1758 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_die_temperature()
1764 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_die_temperature()
1777 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_fat_dump_len()
1780 req->fat_operation = cpu_to_le32(QUERY_FAT); in be_cmd_get_fat_dump_len()
1785 if (dump_size && resp->log_size) in be_cmd_get_fat_dump_len()
1786 *dump_size = le32_to_cpu(resp->log_size) - in be_cmd_get_fat_dump_len()
1807 get_fat_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, in be_cmd_get_fat_dump()
1811 return -ENOMEM; in be_cmd_get_fat_dump()
1813 mutex_lock(&adapter->mcc_lock); in be_cmd_get_fat_dump()
1817 total_size -= buf_size; in be_cmd_get_fat_dump()
1821 status = -EBUSY; in be_cmd_get_fat_dump()
1827 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_fat_dump()
1831 req->fat_operation = cpu_to_le32(RETRIEVE_FAT); in be_cmd_get_fat_dump()
1832 req->read_log_offset = cpu_to_le32(log_offset); in be_cmd_get_fat_dump()
1833 req->read_log_length = cpu_to_le32(buf_size); in be_cmd_get_fat_dump()
1834 req->data_buffer_size = cpu_to_le32(buf_size); in be_cmd_get_fat_dump()
1841 resp->data_buffer, in be_cmd_get_fat_dump()
1842 le32_to_cpu(resp->read_log_length)); in be_cmd_get_fat_dump()
1844 dev_err(&adapter->pdev->dev, "FAT Table Retrieve error\n"); in be_cmd_get_fat_dump()
1851 dma_free_coherent(&adapter->pdev->dev, get_fat_cmd.size, in be_cmd_get_fat_dump()
1853 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_fat_dump()
1864 mutex_lock(&adapter->mcc_lock); in be_cmd_get_fw_ver()
1868 status = -EBUSY; in be_cmd_get_fw_ver()
1874 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_fw_ver()
1881 strscpy(adapter->fw_ver, resp->firmware_version_string, in be_cmd_get_fw_ver()
1882 sizeof(adapter->fw_ver)); in be_cmd_get_fw_ver()
1883 strscpy(adapter->fw_on_flash, resp->fw_on_flash_version_string, in be_cmd_get_fw_ver()
1884 sizeof(adapter->fw_on_flash)); in be_cmd_get_fw_ver()
1887 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_fw_ver()
1901 mutex_lock(&adapter->mcc_lock); in __be_cmd_modify_eqd()
1905 status = -EBUSY; in __be_cmd_modify_eqd()
1910 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in __be_cmd_modify_eqd()
1914 req->num_eq = cpu_to_le32(num); in __be_cmd_modify_eqd()
1916 req->set_eqd[i].eq_id = cpu_to_le32(set_eqd[i].eq_id); in __be_cmd_modify_eqd()
1917 req->set_eqd[i].phase = 0; in __be_cmd_modify_eqd()
1918 req->set_eqd[i].delay_multiplier = in __be_cmd_modify_eqd()
1924 mutex_unlock(&adapter->mcc_lock); in __be_cmd_modify_eqd()
1937 num -= num_eqs; in be_cmd_modify_eqd()
1951 mutex_lock(&adapter->mcc_lock); in be_cmd_vlan_config()
1955 status = -EBUSY; in be_cmd_vlan_config()
1960 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_vlan_config()
1963 req->hdr.domain = domain; in be_cmd_vlan_config()
1965 req->interface_id = if_id; in be_cmd_vlan_config()
1966 req->untagged = BE_IF_FLAGS_UNTAGGED & be_if_cap_flags(adapter) ? 1 : 0; in be_cmd_vlan_config()
1967 req->num_vlan = num; in be_cmd_vlan_config()
1968 memcpy(req->normal_vlan, vtag_array, in be_cmd_vlan_config()
1969 req->num_vlan * sizeof(vtag_array[0])); in be_cmd_vlan_config()
1973 mutex_unlock(&adapter->mcc_lock); in be_cmd_vlan_config()
1980 struct be_dma_mem *mem = &adapter->rx_filter; in __be_cmd_rx_filter()
1981 struct be_cmd_req_rx_filter *req = mem->va; in __be_cmd_rx_filter()
1984 mutex_lock(&adapter->mcc_lock); in __be_cmd_rx_filter()
1988 status = -EBUSY; in __be_cmd_rx_filter()
1992 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in __be_cmd_rx_filter()
1996 req->if_id = cpu_to_le32(adapter->if_handle); in __be_cmd_rx_filter()
1997 req->if_flags_mask = cpu_to_le32(flags); in __be_cmd_rx_filter()
1998 req->if_flags = (value == ON) ? req->if_flags_mask : 0; in __be_cmd_rx_filter()
2006 req->if_flags_mask |= in __be_cmd_rx_filter()
2009 req->mcast_num = cpu_to_le32(adapter->mc_count); in __be_cmd_rx_filter()
2010 for (i = 0; i < adapter->mc_count; i++) in __be_cmd_rx_filter()
2011 ether_addr_copy(req->mcast_mac[i].byte, in __be_cmd_rx_filter()
2012 adapter->mc_list[i].mac); in __be_cmd_rx_filter()
2017 mutex_unlock(&adapter->mcc_lock); in __be_cmd_rx_filter()
2023 struct device *dev = &adapter->pdev->dev; in be_cmd_rx_filter()
2032 return -ENOTSUPP; in be_cmd_rx_filter()
2046 return -EPERM; in be_cmd_set_flow_control()
2048 mutex_lock(&adapter->mcc_lock); in be_cmd_set_flow_control()
2052 status = -EBUSY; in be_cmd_set_flow_control()
2057 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_set_flow_control()
2061 req->hdr.version = 1; in be_cmd_set_flow_control()
2062 req->tx_flow_control = cpu_to_le16((u16)tx_fc); in be_cmd_set_flow_control()
2063 req->rx_flow_control = cpu_to_le16((u16)rx_fc); in be_cmd_set_flow_control()
2068 mutex_unlock(&adapter->mcc_lock); in be_cmd_set_flow_control()
2071 return -EOPNOTSUPP; in be_cmd_set_flow_control()
2085 return -EPERM; in be_cmd_get_flow_control()
2087 mutex_lock(&adapter->mcc_lock); in be_cmd_get_flow_control()
2091 status = -EBUSY; in be_cmd_get_flow_control()
2096 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_flow_control()
2105 *tx_fc = le16_to_cpu(resp->tx_flow_control); in be_cmd_get_flow_control()
2106 *rx_fc = le16_to_cpu(resp->rx_flow_control); in be_cmd_get_flow_control()
2110 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_flow_control()
2121 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_query_fw_cfg()
2122 return -1; in be_cmd_query_fw_cfg()
2127 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_query_fw_cfg()
2135 adapter->port_num = le32_to_cpu(resp->phys_port); in be_cmd_query_fw_cfg()
2136 adapter->function_mode = le32_to_cpu(resp->function_mode); in be_cmd_query_fw_cfg()
2137 adapter->function_caps = le32_to_cpu(resp->function_caps); in be_cmd_query_fw_cfg()
2138 adapter->asic_rev = le32_to_cpu(resp->asic_revision) & 0xFF; in be_cmd_query_fw_cfg()
2139 dev_info(&adapter->pdev->dev, in be_cmd_query_fw_cfg()
2141 adapter->function_mode, adapter->function_caps); in be_cmd_query_fw_cfg()
2144 mutex_unlock(&adapter->mbox_lock); in be_cmd_query_fw_cfg()
2157 adapter->db + SLIPORT_CONTROL_OFFSET); in be_cmd_reset_function()
2160 dev_err(&adapter->pdev->dev, in be_cmd_reset_function()
2165 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_reset_function()
2166 return -1; in be_cmd_reset_function()
2177 mutex_unlock(&adapter->mbox_lock); in be_cmd_reset_function()
2191 mutex_lock(&adapter->mcc_lock); in be_cmd_rss_config()
2195 status = -EBUSY; in be_cmd_rss_config()
2200 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, in be_cmd_rss_config()
2203 req->if_id = cpu_to_le32(adapter->if_handle); in be_cmd_rss_config()
2204 req->enable_rss = cpu_to_le16(rss_hash_opts); in be_cmd_rss_config()
2205 req->cpu_table_size_log2 = cpu_to_le16(fls(table_size) - 1); in be_cmd_rss_config()
2208 req->hdr.version = 1; in be_cmd_rss_config()
2210 memcpy(req->cpu_table, rsstable, table_size); in be_cmd_rss_config()
2211 memcpy(req->hash, rss_hkey, RSS_HASH_KEY_LEN); in be_cmd_rss_config()
2212 be_dws_cpu_to_le(req->hash, sizeof(req->hash)); in be_cmd_rss_config()
2216 mutex_unlock(&adapter->mcc_lock); in be_cmd_rss_config()
2228 mutex_lock(&adapter->mcc_lock); in be_cmd_set_beacon_state()
2232 status = -EBUSY; in be_cmd_set_beacon_state()
2237 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_set_beacon_state()
2241 req->port_num = port_num; in be_cmd_set_beacon_state()
2242 req->beacon_state = state; in be_cmd_set_beacon_state()
2243 req->beacon_duration = bcn; in be_cmd_set_beacon_state()
2244 req->status_duration = sts; in be_cmd_set_beacon_state()
2249 mutex_unlock(&adapter->mcc_lock); in be_cmd_set_beacon_state()
2260 mutex_lock(&adapter->mcc_lock); in be_cmd_get_beacon_state()
2264 status = -EBUSY; in be_cmd_get_beacon_state()
2269 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_beacon_state()
2273 req->port_num = port_num; in be_cmd_get_beacon_state()
2280 *state = resp->beacon_state; in be_cmd_get_beacon_state()
2284 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_beacon_state()
2298 return -EINVAL; in be_cmd_read_port_transceiver_data()
2301 cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, in be_cmd_read_port_transceiver_data()
2304 dev_err(&adapter->pdev->dev, "Memory allocation failed\n"); in be_cmd_read_port_transceiver_data()
2305 return -ENOMEM; in be_cmd_read_port_transceiver_data()
2308 mutex_lock(&adapter->mcc_lock); in be_cmd_read_port_transceiver_data()
2312 status = -EBUSY; in be_cmd_read_port_transceiver_data()
2317 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_read_port_transceiver_data()
2321 req->port = cpu_to_le32(adapter->hba_port_num); in be_cmd_read_port_transceiver_data()
2322 req->page_num = cpu_to_le32(page_num); in be_cmd_read_port_transceiver_data()
2327 memcpy(data, resp->page_data + off, len); in be_cmd_read_port_transceiver_data()
2330 mutex_unlock(&adapter->mcc_lock); in be_cmd_read_port_transceiver_data()
2331 dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma); in be_cmd_read_port_transceiver_data()
2347 mutex_lock(&adapter->mcc_lock); in lancer_cmd_write_object()
2348 adapter->flash_status = 0; in lancer_cmd_write_object()
2352 status = -EBUSY; in lancer_cmd_write_object()
2358 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in lancer_cmd_write_object()
2363 ctxt = &req->context; in lancer_cmd_write_object()
2374 be_dws_cpu_to_le(ctxt, sizeof(req->context)); in lancer_cmd_write_object()
2375 req->write_offset = cpu_to_le32(data_offset); in lancer_cmd_write_object()
2376 strscpy(req->object_name, obj_name, sizeof(req->object_name)); in lancer_cmd_write_object()
2377 req->descriptor_count = cpu_to_le32(1); in lancer_cmd_write_object()
2378 req->buf_len = cpu_to_le32(data_size); in lancer_cmd_write_object()
2379 req->addr_low = cpu_to_le32((cmd->dma + in lancer_cmd_write_object()
2382 req->addr_high = cpu_to_le32(upper_32_bits(cmd->dma + in lancer_cmd_write_object()
2389 mutex_unlock(&adapter->mcc_lock); in lancer_cmd_write_object()
2391 if (!wait_for_completion_timeout(&adapter->et_cmd_compl, in lancer_cmd_write_object()
2393 status = -ETIMEDOUT; in lancer_cmd_write_object()
2395 status = adapter->flash_status; in lancer_cmd_write_object()
2399 *data_written = le32_to_cpu(resp->actual_write_len); in lancer_cmd_write_object()
2400 *change_status = resp->change_status; in lancer_cmd_write_object()
2402 *addn_status = resp->additional_status; in lancer_cmd_write_object()
2408 mutex_unlock(&adapter->mcc_lock); in lancer_cmd_write_object()
2420 switch (adapter->phy.interface_type) { in be_cmd_query_cable_type()
2422 adapter->phy.cable_type = in be_cmd_query_cable_type()
2426 adapter->phy.cable_type = in be_cmd_query_cable_type()
2430 adapter->phy.cable_type = 0; in be_cmd_query_cable_type()
2445 strscpy(adapter->phy.vendor_name, page_data + in be_cmd_query_sfp_info()
2446 SFP_VENDOR_NAME_OFFSET, SFP_VENDOR_NAME_LEN - 1); in be_cmd_query_sfp_info()
2447 strscpy(adapter->phy.vendor_pn, in be_cmd_query_sfp_info()
2449 SFP_VENDOR_NAME_LEN - 1); in be_cmd_query_sfp_info()
2462 mutex_lock(&adapter->mcc_lock); in lancer_cmd_delete_object()
2466 status = -EBUSY; in lancer_cmd_delete_object()
2472 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in lancer_cmd_delete_object()
2476 strscpy(req->object_name, obj_name, sizeof(req->object_name)); in lancer_cmd_delete_object()
2480 mutex_unlock(&adapter->mcc_lock); in lancer_cmd_delete_object()
2493 mutex_lock(&adapter->mcc_lock); in lancer_cmd_read_object()
2497 status = -EBUSY; in lancer_cmd_read_object()
2503 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in lancer_cmd_read_object()
2508 req->desired_read_len = cpu_to_le32(data_size); in lancer_cmd_read_object()
2509 req->read_offset = cpu_to_le32(data_offset); in lancer_cmd_read_object()
2510 strcpy(req->object_name, obj_name); in lancer_cmd_read_object()
2511 req->descriptor_count = cpu_to_le32(1); in lancer_cmd_read_object()
2512 req->buf_len = cpu_to_le32(data_size); in lancer_cmd_read_object()
2513 req->addr_low = cpu_to_le32((cmd->dma & 0xFFFFFFFF)); in lancer_cmd_read_object()
2514 req->addr_high = cpu_to_le32(upper_32_bits(cmd->dma)); in lancer_cmd_read_object()
2520 *data_read = le32_to_cpu(resp->actual_read_len); in lancer_cmd_read_object()
2521 *eof = le32_to_cpu(resp->eof); in lancer_cmd_read_object()
2523 *addn_status = resp->additional_status; in lancer_cmd_read_object()
2527 mutex_unlock(&adapter->mcc_lock); in lancer_cmd_read_object()
2539 mutex_lock(&adapter->mcc_lock); in be_cmd_write_flashrom()
2540 adapter->flash_status = 0; in be_cmd_write_flashrom()
2544 status = -EBUSY; in be_cmd_write_flashrom()
2547 req = cmd->va; in be_cmd_write_flashrom()
2549 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_write_flashrom()
2550 OPCODE_COMMON_WRITE_FLASHROM, cmd->size, wrb, in be_cmd_write_flashrom()
2553 req->params.op_type = cpu_to_le32(flash_type); in be_cmd_write_flashrom()
2555 req->params.offset = cpu_to_le32(img_offset); in be_cmd_write_flashrom()
2557 req->params.op_code = cpu_to_le32(flash_opcode); in be_cmd_write_flashrom()
2558 req->params.data_buf_size = cpu_to_le32(buf_size); in be_cmd_write_flashrom()
2564 mutex_unlock(&adapter->mcc_lock); in be_cmd_write_flashrom()
2566 if (!wait_for_completion_timeout(&adapter->et_cmd_compl, in be_cmd_write_flashrom()
2568 status = -ETIMEDOUT; in be_cmd_write_flashrom()
2570 status = adapter->flash_status; in be_cmd_write_flashrom()
2575 mutex_unlock(&adapter->mcc_lock); in be_cmd_write_flashrom()
2586 mutex_lock(&adapter->mcc_lock); in be_cmd_get_flash_crc()
2590 status = -EBUSY; in be_cmd_get_flash_crc()
2595 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_flash_crc()
2599 req->params.op_type = cpu_to_le32(img_optype); in be_cmd_get_flash_crc()
2601 req->params.offset = cpu_to_le32(img_offset + crc_offset); in be_cmd_get_flash_crc()
2603 req->params.offset = cpu_to_le32(crc_offset); in be_cmd_get_flash_crc()
2605 req->params.op_code = cpu_to_le32(FLASHROM_OPER_REPORT); in be_cmd_get_flash_crc()
2606 req->params.data_buf_size = cpu_to_le32(0x4); in be_cmd_get_flash_crc()
2610 memcpy(flashed_crc, req->crc, 4); in be_cmd_get_flash_crc()
2613 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_flash_crc()
2621 return (adapter->phy.phy_type == PHY_TYPE_TN_8022 && in phy_flashing_required()
2622 adapter->phy.interface_type == PHY_TYPE_BASET_10GB); in phy_flashing_required()
2636 img_type = le32_to_cpu(fsec_g2->fsec_entry[i].type); in is_comp_in_ufi()
2638 img_type = le32_to_cpu(fsec->fsec_entry[i].type); in is_comp_in_ufi()
2651 const u8 *p = fw->data; in get_fsec_info()
2654 while (p < (fw->data + fw->size)) { in get_fsec_info()
2656 if (!memcmp(flash_cookie, fsec->cookie, sizeof(flash_cookie))) in get_fsec_info()
2672 img_size - 4); in be_check_flash_crc()
2676 crc_offset = hdr_size + img_offset + img_size - 4; in be_check_flash_crc()
2692 struct be_cmd_write_flashrom *req = flash_cmd->va; in be_flash()
2698 total_bytes -= num_bytes; in be_flash()
2712 memcpy(req->data_buf, img, num_bytes); in be_flash()
2748 /* For BE2, BE3 and BE3-R */
2754 struct device *dev = &adapter->pdev->dev; in be_flash_BEx()
2818 return -1; in be_flash_BEx()
2825 !be_fw_ncsi_supported(adapter->fw_ver)) { in be_flash_BEx()
2826 dev_info(dev, NCSI_UPDATE_LOG, adapter->fw_ver); in be_flash_BEx()
2835 status = be_check_flash_crc(adapter, fw->data, in be_flash_BEx()
2852 p = fw->data + filehdr_size + pflashcomp[i].offset + in be_flash_BEx()
2854 if (p + pflashcomp[i].size > fw->data + fw->size) in be_flash_BEx()
2855 return -1; in be_flash_BEx()
2926 struct device *dev = &adapter->pdev->dev; in be_flash_skyhawk()
2937 return -EINVAL; in be_flash_skyhawk()
2941 for (i = 0; i < le32_to_cpu(fsec->fsec_hdr.num_images); i++) { in be_flash_skyhawk()
2942 img_offset = le32_to_cpu(fsec->fsec_entry[i].offset); in be_flash_skyhawk()
2943 img_size = le32_to_cpu(fsec->fsec_entry[i].pad_size); in be_flash_skyhawk()
2944 img_type = le32_to_cpu(fsec->fsec_entry[i].type); in be_flash_skyhawk()
2945 img_optype = be_get_img_optype(fsec->fsec_entry[i]); in be_flash_skyhawk()
2946 old_fw_img = fsec->fsec_entry[i].optype == 0xFFFF; in be_flash_skyhawk()
2962 status = be_check_flash_crc(adapter, fw->data, img_offset, in be_flash_skyhawk()
2986 return -EAGAIN; in be_flash_skyhawk()
2990 return -EFAULT; in be_flash_skyhawk()
2997 p = fw->data + filehdr_size + img_offset + img_hdrs_size; in be_flash_skyhawk()
2998 if (p + img_size > fw->data + fw->size) in be_flash_skyhawk()
2999 return -1; in be_flash_skyhawk()
3030 return -EINVAL; in be_flash_skyhawk()
3034 return -EINVAL; in be_flash_skyhawk()
3036 return -EFAULT; in be_flash_skyhawk()
3046 struct device *dev = &adapter->pdev->dev; in lancer_fw_download()
3058 if (!IS_ALIGNED(fw->size, sizeof(u32))) { in lancer_fw_download()
3060 return -EINVAL; in lancer_fw_download()
3068 return -ENOMEM; in lancer_fw_download()
3072 image_size = fw->size; in lancer_fw_download()
3073 data_ptr = fw->data; in lancer_fw_download()
3091 image_size -= data_written; in lancer_fw_download()
3133 dev_err(&adapter->pdev->dev, "Invalid FW UFI file"); in be_check_ufi_compatibility()
3140 switch (fhdr->build[0]) { in be_check_ufi_compatibility()
3160 * pre-BE3-R chips (asic_rev < 0x10) in be_check_ufi_compatibility()
3162 if (BEx_chip(adapter) && fhdr->asic_type_rev == 0) in be_check_ufi_compatibility()
3163 return adapter->asic_rev < 0x10; in be_check_ufi_compatibility()
3165 return (fhdr->asic_type_rev >= adapter->asic_rev); in be_check_ufi_compatibility()
3170 struct device *dev = &adapter->pdev->dev; in be_fw_download()
3176 fhdr3 = (struct flash_file_hdr_g3 *)fw->data; in be_fw_download()
3179 return -EINVAL; in be_fw_download()
3186 return -ENOMEM; in be_fw_download()
3188 num_imgs = le32_to_cpu(fhdr3->num_imgs); in be_fw_download()
3190 img_hdr_ptr = (struct image_hdr *)(fw->data + in be_fw_download()
3194 le32_to_cpu(img_hdr_ptr->imageid) != 1) in be_fw_download()
3212 int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac, in be_cmd_enable_magic_wol() argument
3219 mutex_lock(&adapter->mcc_lock); in be_cmd_enable_magic_wol()
3223 status = -EBUSY; in be_cmd_enable_magic_wol()
3226 req = nonemb_cmd->va; in be_cmd_enable_magic_wol()
3228 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, in be_cmd_enable_magic_wol()
3231 memcpy(req->magic_mac, mac, ETH_ALEN); in be_cmd_enable_magic_wol()
3236 mutex_unlock(&adapter->mcc_lock); in be_cmd_enable_magic_wol()
3249 return -EPERM; in be_cmd_set_loopback()
3251 mutex_lock(&adapter->mcc_lock); in be_cmd_set_loopback()
3255 status = -EBUSY; in be_cmd_set_loopback()
3261 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, in be_cmd_set_loopback()
3265 req->src_port = port_num; in be_cmd_set_loopback()
3266 req->dest_port = port_num; in be_cmd_set_loopback()
3267 req->loopback_type = loopback_type; in be_cmd_set_loopback()
3268 req->loopback_state = enable; in be_cmd_set_loopback()
3274 mutex_unlock(&adapter->mcc_lock); in be_cmd_set_loopback()
3276 if (!wait_for_completion_timeout(&adapter->et_cmd_compl, in be_cmd_set_loopback()
3278 status = -ETIMEDOUT; in be_cmd_set_loopback()
3283 mutex_unlock(&adapter->mcc_lock); in be_cmd_set_loopback()
3298 return -EPERM; in be_cmd_loopback_test()
3300 mutex_lock(&adapter->mcc_lock); in be_cmd_loopback_test()
3304 status = -EBUSY; in be_cmd_loopback_test()
3310 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, in be_cmd_loopback_test()
3314 req->hdr.timeout = cpu_to_le32(15); in be_cmd_loopback_test()
3315 req->pattern = cpu_to_le64(pattern); in be_cmd_loopback_test()
3316 req->src_port = cpu_to_le32(port_num); in be_cmd_loopback_test()
3317 req->dest_port = cpu_to_le32(port_num); in be_cmd_loopback_test()
3318 req->pkt_size = cpu_to_le32(pkt_size); in be_cmd_loopback_test()
3319 req->num_pkts = cpu_to_le32(num_pkts); in be_cmd_loopback_test()
3320 req->loopback_type = cpu_to_le32(loopback_type); in be_cmd_loopback_test()
3326 mutex_unlock(&adapter->mcc_lock); in be_cmd_loopback_test()
3328 wait_for_completion(&adapter->et_cmd_compl); in be_cmd_loopback_test()
3330 status = le32_to_cpu(resp->status); in be_cmd_loopback_test()
3334 mutex_unlock(&adapter->mcc_lock); in be_cmd_loopback_test()
3348 return -EPERM; in be_cmd_ddr_dma_test()
3350 mutex_lock(&adapter->mcc_lock); in be_cmd_ddr_dma_test()
3354 status = -EBUSY; in be_cmd_ddr_dma_test()
3357 req = cmd->va; in be_cmd_ddr_dma_test()
3358 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, in be_cmd_ddr_dma_test()
3359 OPCODE_LOWLEVEL_HOST_DDR_DMA, cmd->size, wrb, in be_cmd_ddr_dma_test()
3362 req->pattern = cpu_to_le64(pattern); in be_cmd_ddr_dma_test()
3363 req->byte_count = cpu_to_le32(byte_cnt); in be_cmd_ddr_dma_test()
3365 req->snd_buff[i] = (u8)(pattern >> (j*8)); in be_cmd_ddr_dma_test()
3376 resp = cmd->va; in be_cmd_ddr_dma_test()
3377 if ((memcmp(resp->rcv_buff, req->snd_buff, byte_cnt) != 0) || in be_cmd_ddr_dma_test()
3378 resp->snd_err) { in be_cmd_ddr_dma_test()
3379 status = -1; in be_cmd_ddr_dma_test()
3384 mutex_unlock(&adapter->mcc_lock); in be_cmd_ddr_dma_test()
3395 mutex_lock(&adapter->mcc_lock); in be_cmd_get_seeprom_data()
3399 status = -EBUSY; in be_cmd_get_seeprom_data()
3402 req = nonemb_cmd->va; in be_cmd_get_seeprom_data()
3404 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_seeprom_data()
3411 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_seeprom_data()
3424 return -EPERM; in be_cmd_get_phy_info()
3426 mutex_lock(&adapter->mcc_lock); in be_cmd_get_phy_info()
3430 status = -EBUSY; in be_cmd_get_phy_info()
3434 cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, in be_cmd_get_phy_info()
3437 dev_err(&adapter->pdev->dev, "Memory alloc failure\n"); in be_cmd_get_phy_info()
3438 status = -ENOMEM; in be_cmd_get_phy_info()
3444 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_phy_info()
3453 adapter->phy.phy_type = le16_to_cpu(resp_phy_info->phy_type); in be_cmd_get_phy_info()
3454 adapter->phy.interface_type = in be_cmd_get_phy_info()
3455 le16_to_cpu(resp_phy_info->interface_type); in be_cmd_get_phy_info()
3456 adapter->phy.auto_speeds_supported = in be_cmd_get_phy_info()
3457 le16_to_cpu(resp_phy_info->auto_speeds_supported); in be_cmd_get_phy_info()
3458 adapter->phy.fixed_speeds_supported = in be_cmd_get_phy_info()
3459 le16_to_cpu(resp_phy_info->fixed_speeds_supported); in be_cmd_get_phy_info()
3460 adapter->phy.misc_params = in be_cmd_get_phy_info()
3461 le32_to_cpu(resp_phy_info->misc_params); in be_cmd_get_phy_info()
3464 adapter->phy.fixed_speeds_supported = in be_cmd_get_phy_info()
3469 dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma); in be_cmd_get_phy_info()
3471 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_phy_info()
3481 mutex_lock(&adapter->mcc_lock); in be_cmd_set_qos()
3485 status = -EBUSY; in be_cmd_set_qos()
3491 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_set_qos()
3494 req->hdr.domain = domain; in be_cmd_set_qos()
3495 req->valid_bits = cpu_to_le32(BE_QOS_BITS_NIC); in be_cmd_set_qos()
3496 req->max_bps_nic = cpu_to_le32(bps); in be_cmd_set_qos()
3501 mutex_unlock(&adapter->mcc_lock); in be_cmd_set_qos()
3516 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_get_cntl_attributes()
3517 return -1; in be_cmd_get_cntl_attributes()
3521 attribs_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, in be_cmd_get_cntl_attributes()
3525 dev_err(&adapter->pdev->dev, "Memory allocation failure\n"); in be_cmd_get_cntl_attributes()
3526 status = -ENOMEM; in be_cmd_get_cntl_attributes()
3532 status = -EBUSY; in be_cmd_get_cntl_attributes()
3537 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_cntl_attributes()
3544 adapter->hba_port_num = attribs->hba_attribs.phy_port; in be_cmd_get_cntl_attributes()
3545 serial_num = attribs->hba_attribs.controller_serial_number; in be_cmd_get_cntl_attributes()
3547 adapter->serial_num[i] = le32_to_cpu(serial_num[i]) & in be_cmd_get_cntl_attributes()
3548 (BIT_MASK(16) - 1); in be_cmd_get_cntl_attributes()
3553 adapter->pf_num = attribs->hba_attribs.pci_funcnum; in be_cmd_get_cntl_attributes()
3557 mutex_unlock(&adapter->mbox_lock); in be_cmd_get_cntl_attributes()
3559 dma_free_coherent(&adapter->pdev->dev, attribs_cmd.size, in be_cmd_get_cntl_attributes()
3571 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_req_native_mode()
3572 return -1; in be_cmd_req_native_mode()
3576 status = -EBUSY; in be_cmd_req_native_mode()
3582 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_req_native_mode()
3586 req->valid_cap_flags = cpu_to_le32(CAPABILITY_SW_TIMESTAMPS | in be_cmd_req_native_mode()
3588 req->cap_flags = cpu_to_le32(CAPABILITY_BE3_NATIVE_ERX_API); in be_cmd_req_native_mode()
3594 adapter->be3_native = le32_to_cpu(resp->cap_flags) & in be_cmd_req_native_mode()
3596 if (!adapter->be3_native) in be_cmd_req_native_mode()
3597 dev_warn(&adapter->pdev->dev, in be_cmd_req_native_mode()
3601 mutex_unlock(&adapter->mbox_lock); in be_cmd_req_native_mode()
3613 mutex_lock(&adapter->mcc_lock); in be_cmd_get_fn_privileges()
3617 status = -EBUSY; in be_cmd_get_fn_privileges()
3623 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_fn_privileges()
3627 req->hdr.domain = domain; in be_cmd_get_fn_privileges()
3634 *privilege = le32_to_cpu(resp->privilege_mask); in be_cmd_get_fn_privileges()
3645 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_fn_privileges()
3657 mutex_lock(&adapter->mcc_lock); in be_cmd_set_fn_privileges()
3661 status = -EBUSY; in be_cmd_set_fn_privileges()
3666 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_set_fn_privileges()
3669 req->hdr.domain = domain; in be_cmd_set_fn_privileges()
3671 req->privileges_lancer = cpu_to_le32(privileges); in be_cmd_set_fn_privileges()
3673 req->privileges = cpu_to_le32(privileges); in be_cmd_set_fn_privileges()
3677 mutex_unlock(&adapter->mcc_lock); in be_cmd_set_fn_privileges()
3681 /* pmac_id_valid: true => pmac_id is supplied and MAC address is requested.
3682 * pmac_id_valid: false => pmac_id or MAC address is requested.
3685 int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac, in be_cmd_get_mac_from_list() argument
3698 get_mac_list_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, in be_cmd_get_mac_from_list()
3704 dev_err(&adapter->pdev->dev, in be_cmd_get_mac_from_list()
3706 return -ENOMEM; in be_cmd_get_mac_from_list()
3709 mutex_lock(&adapter->mcc_lock); in be_cmd_get_mac_from_list()
3713 status = -EBUSY; in be_cmd_get_mac_from_list()
3719 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_mac_from_list()
3722 req->hdr.domain = domain; in be_cmd_get_mac_from_list()
3723 req->mac_type = MAC_ADDRESS_TYPE_NETWORK; in be_cmd_get_mac_from_list()
3725 req->mac_id = cpu_to_le32(*pmac_id); in be_cmd_get_mac_from_list()
3726 req->iface_id = cpu_to_le16(if_handle); in be_cmd_get_mac_from_list()
3727 req->perm_override = 0; in be_cmd_get_mac_from_list()
3729 req->perm_override = 1; in be_cmd_get_mac_from_list()
3738 memcpy(mac, resp->macid_macaddr.mac_addr_id.macaddr, in be_cmd_get_mac_from_list()
3743 mac_count = resp->true_mac_count + resp->pseudo_mac_count; in be_cmd_get_mac_from_list()
3744 /* Mac list returned could contain one or more active mac_ids in be_cmd_get_mac_from_list()
3745 * or one or more true or pseudo permanent mac addresses. in be_cmd_get_mac_from_list()
3754 mac_entry = &resp->macaddr_list[i]; in be_cmd_get_mac_from_list()
3755 mac_addr_size = le16_to_cpu(mac_entry->mac_addr_size); in be_cmd_get_mac_from_list()
3761 mac_id = mac_entry->mac_addr_id.s_mac_id.mac_id; in be_cmd_get_mac_from_list()
3766 /* If no active mac_id found, return first mac addr */ in be_cmd_get_mac_from_list()
3768 memcpy(mac, resp->macaddr_list[0].mac_addr_id.macaddr, in be_cmd_get_mac_from_list()
3773 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_mac_from_list()
3774 dma_free_coherent(&adapter->pdev->dev, get_mac_list_cmd.size, in be_cmd_get_mac_from_list()
3780 u8 *mac, u32 if_handle, bool active, u32 domain) in be_cmd_get_active_mac() argument
3783 be_cmd_get_mac_from_list(adapter, mac, &active, &curr_pmac_id, in be_cmd_get_active_mac()
3786 return be_cmd_mac_addr_query(adapter, mac, false, in be_cmd_get_active_mac()
3789 /* Fetch the MAC address using pmac_id */ in be_cmd_get_active_mac()
3790 return be_cmd_get_mac_from_list(adapter, mac, &active, in be_cmd_get_active_mac()
3795 int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac) in be_cmd_get_perm_mac() argument
3800 eth_zero_addr(mac); in be_cmd_get_perm_mac()
3804 status = be_cmd_mac_addr_query(adapter, mac, true, 0, in be_cmd_get_perm_mac()
3807 status = be_cmd_mac_addr_query(adapter, mac, false, in be_cmd_get_perm_mac()
3808 adapter->if_handle, 0); in be_cmd_get_perm_mac()
3810 status = be_cmd_get_mac_from_list(adapter, mac, &pmac_valid, in be_cmd_get_perm_mac()
3811 NULL, adapter->if_handle, 0); in be_cmd_get_perm_mac()
3828 cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, in be_cmd_set_mac_list()
3831 return -ENOMEM; in be_cmd_set_mac_list()
3833 mutex_lock(&adapter->mcc_lock); in be_cmd_set_mac_list()
3837 status = -EBUSY; in be_cmd_set_mac_list()
3842 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_set_mac_list()
3846 req->hdr.domain = domain; in be_cmd_set_mac_list()
3847 req->mac_count = mac_count; in be_cmd_set_mac_list()
3849 memcpy(req->mac, mac_array, ETH_ALEN*mac_count); in be_cmd_set_mac_list()
3854 dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma); in be_cmd_set_mac_list()
3855 mutex_unlock(&adapter->mcc_lock); in be_cmd_set_mac_list()
3859 /* Wrapper to delete any active MACs and provision the new mac.
3860 * Changes to MAC_LIST are allowed iff none of the MAC addresses in the
3863 int be_cmd_set_mac(struct be_adapter *adapter, u8 *mac, int if_id, u32 dom) in be_cmd_set_mac() argument
3876 return be_cmd_set_mac_list(adapter, mac, mac ? 1 : 0, dom); in be_cmd_set_mac()
3889 return -EPERM; in be_cmd_set_hsw_config()
3891 mutex_lock(&adapter->mcc_lock); in be_cmd_set_hsw_config()
3895 status = -EBUSY; in be_cmd_set_hsw_config()
3900 ctxt = &req->context; in be_cmd_set_hsw_config()
3902 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_set_hsw_config()
3906 req->hdr.domain = domain; in be_cmd_set_hsw_config()
3914 ctxt, adapter->hba_port_num); in be_cmd_set_hsw_config()
3920 /* Enable/disable both mac and vlan spoof checking */ in be_cmd_set_hsw_config()
3928 be_dws_cpu_to_le(req->context, sizeof(req->context)); in be_cmd_set_hsw_config()
3932 mutex_unlock(&adapter->mcc_lock); in be_cmd_set_hsw_config()
3946 mutex_lock(&adapter->mcc_lock); in be_cmd_get_hsw_config()
3950 status = -EBUSY; in be_cmd_get_hsw_config()
3955 ctxt = &req->context; in be_cmd_get_hsw_config()
3957 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_hsw_config()
3961 req->hdr.domain = domain; in be_cmd_get_hsw_config()
3968 ctxt, adapter->hba_port_num); in be_cmd_get_hsw_config()
3971 be_dws_cpu_to_le(req->context, sizeof(req->context)); in be_cmd_get_hsw_config()
3978 be_dws_le_to_cpu(&resp->context, sizeof(resp->context)); in be_cmd_get_hsw_config()
3980 pvid, &resp->context); in be_cmd_get_hsw_config()
3985 port_fwd_type, &resp->context); in be_cmd_get_hsw_config()
3989 spoofchk, &resp->context); in be_cmd_get_hsw_config()
3993 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_hsw_config()
3999 struct pci_dev *pdev = adapter->pdev; in be_is_wol_excluded()
4004 switch (pdev->subsystem_device) { in be_is_wol_excluded()
4024 return -EPERM; in be_cmd_get_acpi_wol_cap()
4029 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_get_acpi_wol_cap()
4030 return -1; in be_cmd_get_acpi_wol_cap()
4034 cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, in be_cmd_get_acpi_wol_cap()
4037 dev_err(&adapter->pdev->dev, "Memory allocation failure\n"); in be_cmd_get_acpi_wol_cap()
4038 status = -ENOMEM; in be_cmd_get_acpi_wol_cap()
4044 status = -EBUSY; in be_cmd_get_acpi_wol_cap()
4050 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, in be_cmd_get_acpi_wol_cap()
4054 req->hdr.version = 1; in be_cmd_get_acpi_wol_cap()
4055 req->query_options = BE_GET_WOL_CAP; in be_cmd_get_acpi_wol_cap()
4063 adapter->wol_cap = resp->wol_settings; in be_cmd_get_acpi_wol_cap()
4065 /* Non-zero macaddr indicates WOL is enabled */ in be_cmd_get_acpi_wol_cap()
4066 if (adapter->wol_cap & BE_WOL_CAP && in be_cmd_get_acpi_wol_cap()
4067 !is_zero_ether_addr(resp->magic_mac)) in be_cmd_get_acpi_wol_cap()
4068 adapter->wol_en = true; in be_cmd_get_acpi_wol_cap()
4071 mutex_unlock(&adapter->mbox_lock); in be_cmd_get_acpi_wol_cap()
4073 dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, in be_cmd_get_acpi_wol_cap()
4088 extfat_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, in be_cmd_set_fw_log_level()
4092 return -ENOMEM; in be_cmd_set_fw_log_level()
4100 for (i = 0; i < le32_to_cpu(cfgs->num_modules); i++) { in be_cmd_set_fw_log_level()
4101 u32 num_modes = le32_to_cpu(cfgs->module[i].num_modes); in be_cmd_set_fw_log_level()
4104 if (cfgs->module[i].trace_lvl[j].mode == MODE_UART) in be_cmd_set_fw_log_level()
4105 cfgs->module[i].trace_lvl[j].dbg_lvl = in be_cmd_set_fw_log_level()
4112 dma_free_coherent(&adapter->pdev->dev, extfat_cmd.size, extfat_cmd.va, in be_cmd_set_fw_log_level()
4126 extfat_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, in be_cmd_get_fw_log_level()
4131 dev_err(&adapter->pdev->dev, "%s: Memory allocation failure\n", in be_cmd_get_fw_log_level()
4141 for (j = 0; j < le32_to_cpu(cfgs->module[0].num_modes); j++) { in be_cmd_get_fw_log_level()
4142 if (cfgs->module[0].trace_lvl[j].mode == MODE_UART) in be_cmd_get_fw_log_level()
4143 level = cfgs->module[0].trace_lvl[j].dbg_lvl; in be_cmd_get_fw_log_level()
4146 dma_free_coherent(&adapter->pdev->dev, extfat_cmd.size, extfat_cmd.va, in be_cmd_get_fw_log_level()
4161 return -EPERM; in be_cmd_get_ext_fat_capabilites()
4163 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_get_ext_fat_capabilites()
4164 return -1; in be_cmd_get_ext_fat_capabilites()
4168 status = -EBUSY; in be_cmd_get_ext_fat_capabilites()
4172 req = cmd->va; in be_cmd_get_ext_fat_capabilites()
4173 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_ext_fat_capabilites()
4175 cmd->size, wrb, cmd); in be_cmd_get_ext_fat_capabilites()
4176 req->parameter_type = cpu_to_le32(1); in be_cmd_get_ext_fat_capabilites()
4180 mutex_unlock(&adapter->mbox_lock); in be_cmd_get_ext_fat_capabilites()
4192 mutex_lock(&adapter->mcc_lock); in be_cmd_set_ext_fat_capabilites()
4196 status = -EBUSY; in be_cmd_set_ext_fat_capabilites()
4200 req = cmd->va; in be_cmd_set_ext_fat_capabilites()
4201 memcpy(&req->set_params, configs, sizeof(struct be_fat_conf_params)); in be_cmd_set_ext_fat_capabilites()
4202 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_set_ext_fat_capabilites()
4204 cmd->size, wrb, cmd); in be_cmd_set_ext_fat_capabilites()
4208 mutex_unlock(&adapter->mcc_lock); in be_cmd_set_ext_fat_capabilites()
4218 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_query_port_name()
4219 return -1; in be_cmd_query_port_name()
4224 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_query_port_name()
4228 req->hdr.version = 1; in be_cmd_query_port_name()
4234 adapter->port_name = resp->port_name[adapter->hba_port_num]; in be_cmd_query_port_name()
4236 adapter->port_name = adapter->hba_port_num + '0'; in be_cmd_query_port_name()
4239 mutex_unlock(&adapter->mbox_lock); in be_cmd_query_port_name()
4246 * get_vft must be true when the caller wants the VF-template desc of the
4247 * PF-pool.
4259 if (hdr->desc_type == NIC_RESOURCE_DESC_TYPE_V0 || in be_get_nic_desc()
4260 hdr->desc_type == NIC_RESOURCE_DESC_TYPE_V1) { in be_get_nic_desc()
4264 nic->pf_num == pf_num) && in be_get_nic_desc()
4265 (!get_vft || nic->flags & BIT(VFT_SHIFT))) in be_get_nic_desc()
4268 hdr->desc_len = hdr->desc_len ? : RESOURCE_DESC_SIZE_V0; in be_get_nic_desc()
4269 hdr = (void *)hdr + hdr->desc_len; in be_get_nic_desc()
4290 struct be_pcie_res_desc *pcie; in be_get_pcie_desc() local
4294 if (hdr->desc_type == PCIE_RESOURCE_DESC_TYPE_V0 || in be_get_pcie_desc()
4295 hdr->desc_type == PCIE_RESOURCE_DESC_TYPE_V1) { in be_get_pcie_desc()
4296 pcie = (struct be_pcie_res_desc *)hdr; in be_get_pcie_desc()
4297 if (pcie->pf_num == pf_num) in be_get_pcie_desc()
4298 return pcie; in be_get_pcie_desc()
4301 hdr->desc_len = hdr->desc_len ? : RESOURCE_DESC_SIZE_V0; in be_get_pcie_desc()
4302 hdr = (void *)hdr + hdr->desc_len; in be_get_pcie_desc()
4313 if (hdr->desc_type == PORT_RESOURCE_DESC_TYPE_V1) in be_get_port_desc()
4316 hdr->desc_len = hdr->desc_len ? : RESOURCE_DESC_SIZE_V0; in be_get_port_desc()
4317 hdr = (void *)hdr + hdr->desc_len; in be_get_port_desc()
4325 res->max_uc_mac = le16_to_cpu(desc->unicast_mac_count); in be_copy_nic_desc()
4326 res->max_vlans = le16_to_cpu(desc->vlan_count); in be_copy_nic_desc()
4327 res->max_mcast_mac = le16_to_cpu(desc->mcast_mac_count); in be_copy_nic_desc()
4328 res->max_tx_qs = le16_to_cpu(desc->txq_count); in be_copy_nic_desc()
4329 res->max_rss_qs = le16_to_cpu(desc->rssq_count); in be_copy_nic_desc()
4330 res->max_rx_qs = le16_to_cpu(desc->rq_count); in be_copy_nic_desc()
4331 res->max_evt_qs = le16_to_cpu(desc->eq_count); in be_copy_nic_desc()
4332 res->max_cq_count = le16_to_cpu(desc->cq_count); in be_copy_nic_desc()
4333 res->max_iface_count = le16_to_cpu(desc->iface_count); in be_copy_nic_desc()
4334 res->max_mcc_count = le16_to_cpu(desc->mcc_count); in be_copy_nic_desc()
4336 res->if_cap_flags = le32_to_cpu(desc->cap_flags) & in be_copy_nic_desc()
4348 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_get_func_config()
4349 return -1; in be_cmd_get_func_config()
4353 cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, in be_cmd_get_func_config()
4356 dev_err(&adapter->pdev->dev, "Memory alloc failure\n"); in be_cmd_get_func_config()
4357 status = -ENOMEM; in be_cmd_get_func_config()
4363 status = -EBUSY; in be_cmd_get_func_config()
4369 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_func_config()
4374 req->hdr.version = 1; in be_cmd_get_func_config()
4379 u32 desc_count = le32_to_cpu(resp->desc_count); in be_cmd_get_func_config()
4386 desc = be_get_func_nic_desc(resp->func_param, desc_count, in be_cmd_get_func_config()
4389 status = -EINVAL; in be_cmd_get_func_config()
4394 adapter->pf_num = desc->pf_num; in be_cmd_get_func_config()
4395 adapter->vf_num = desc->vf_num; in be_cmd_get_func_config()
4401 mutex_unlock(&adapter->mbox_lock); in be_cmd_get_func_config()
4403 dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, in be_cmd_get_func_config()
4412 struct be_pcie_res_desc *pcie = NULL; in be_get_nic_pf_num_list() local
4417 if (hdr->desc_type == PCIE_RESOURCE_DESC_TYPE_V0 || in be_get_nic_pf_num_list()
4418 hdr->desc_type == PCIE_RESOURCE_DESC_TYPE_V1) { in be_get_nic_pf_num_list()
4419 pcie = (struct be_pcie_res_desc *)hdr; in be_get_nic_pf_num_list()
4420 if (pcie->pf_state && (pcie->pf_type == MISSION_NIC || in be_get_nic_pf_num_list()
4421 pcie->pf_type == MISSION_RDMA)) { in be_get_nic_pf_num_list()
4422 nic_pf_nums[nic_pf_count++] = pcie->pf_num; in be_get_nic_pf_num_list()
4426 hdr->desc_len = hdr->desc_len ? : RESOURCE_DESC_SIZE_V0; in be_get_nic_pf_num_list()
4427 hdr = (void *)hdr + hdr->desc_len; in be_get_nic_pf_num_list()
4441 struct be_pcie_res_desc *pcie; in be_cmd_get_profile_config() local
4451 cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, in be_cmd_get_profile_config()
4454 return -ENOMEM; in be_cmd_get_profile_config()
4457 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_profile_config()
4462 req->hdr.version = 1; in be_cmd_get_profile_config()
4463 req->type = profile_type; in be_cmd_get_profile_config()
4464 req->hdr.domain = domain; in be_cmd_get_profile_config()
4471 req->type |= QUERY_MODIFIABLE_FIELDS_TYPE; in be_cmd_get_profile_config()
4478 desc_count = le16_to_cpu(resp->desc_count); in be_cmd_get_profile_config()
4484 nic_pf_cnt = be_get_nic_pf_num_list(resp->func_param, in be_cmd_get_profile_config()
4489 nic = be_get_func_nic_desc(resp->func_param, desc_count, in be_cmd_get_profile_config()
4491 if (nic->link_param == adapter->port_num) { in be_cmd_get_profile_config()
4492 port_res->nic_pfs++; in be_cmd_get_profile_config()
4493 pcie = be_get_pcie_desc(resp->func_param, in be_cmd_get_profile_config()
4496 port_res->max_vfs += le16_to_cpu(pcie->num_vfs); in be_cmd_get_profile_config()
4502 pcie = be_get_pcie_desc(resp->func_param, desc_count, in be_cmd_get_profile_config()
4503 adapter->pf_num); in be_cmd_get_profile_config()
4504 if (pcie) in be_cmd_get_profile_config()
4505 res->max_vfs = le16_to_cpu(pcie->num_vfs); in be_cmd_get_profile_config()
4507 port = be_get_port_desc(resp->func_param, desc_count); in be_cmd_get_profile_config()
4509 adapter->mc_type = port->mc_type; in be_cmd_get_profile_config()
4511 nic = be_get_func_nic_desc(resp->func_param, desc_count, in be_cmd_get_profile_config()
4512 adapter->pf_num); in be_cmd_get_profile_config()
4516 vf_res = be_get_vft_desc(resp->func_param, desc_count, in be_cmd_get_profile_config()
4517 adapter->pf_num); in be_cmd_get_profile_config()
4519 res->vf_if_cap_flags = vf_res->cap_flags; in be_cmd_get_profile_config()
4522 dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, in be_cmd_get_profile_config()
4538 cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, in be_cmd_set_profile_config()
4541 return -ENOMEM; in be_cmd_set_profile_config()
4544 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_set_profile_config()
4547 req->hdr.version = version; in be_cmd_set_profile_config()
4548 req->hdr.domain = domain; in be_cmd_set_profile_config()
4549 req->desc_count = cpu_to_le32(count); in be_cmd_set_profile_config()
4550 memcpy(req->desc, desc, size); in be_cmd_set_profile_config()
4555 dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, in be_cmd_set_profile_config()
4564 nic->unicast_mac_count = 0xFFFF; in be_reset_nic_desc()
4565 nic->mcc_count = 0xFFFF; in be_reset_nic_desc()
4566 nic->vlan_count = 0xFFFF; in be_reset_nic_desc()
4567 nic->mcast_mac_count = 0xFFFF; in be_reset_nic_desc()
4568 nic->txq_count = 0xFFFF; in be_reset_nic_desc()
4569 nic->rq_count = 0xFFFF; in be_reset_nic_desc()
4570 nic->rssq_count = 0xFFFF; in be_reset_nic_desc()
4571 nic->lro_count = 0xFFFF; in be_reset_nic_desc()
4572 nic->cq_count = 0xFFFF; in be_reset_nic_desc()
4573 nic->toe_conn_count = 0xFFFF; in be_reset_nic_desc()
4574 nic->eq_count = 0xFFFF; in be_reset_nic_desc()
4575 nic->iface_count = 0xFFFF; in be_reset_nic_desc()
4576 nic->link_param = 0xFF; in be_reset_nic_desc()
4577 nic->channel_id_param = cpu_to_le16(0xF000); in be_reset_nic_desc()
4578 nic->acpi_params = 0xFF; in be_reset_nic_desc()
4579 nic->wol_param = 0x0F; in be_reset_nic_desc()
4580 nic->tunnel_iface_count = 0xFFFF; in be_reset_nic_desc()
4581 nic->direct_tenant_iface_count = 0xFFFF; in be_reset_nic_desc()
4582 nic->bw_min = 0xFFFFFFFF; in be_reset_nic_desc()
4583 nic->bw_max = 0xFFFFFFFF; in be_reset_nic_desc()
4587 static void be_reset_pcie_desc(struct be_pcie_res_desc *pcie) in be_reset_pcie_desc() argument
4589 memset(pcie, 0, sizeof(*pcie)); in be_reset_pcie_desc()
4590 pcie->sriov_state = 0xFF; in be_reset_pcie_desc()
4591 pcie->pf_state = 0xFF; in be_reset_pcie_desc()
4592 pcie->pf_type = 0xFF; in be_reset_pcie_desc()
4593 pcie->num_vfs = 0xFFFF; in be_reset_pcie_desc()
4607 nic_desc.pf_num = adapter->pf_num; in be_cmd_config_qos()
4635 struct be_pcie_res_desc pcie; in be_cmd_set_sriov_config() member
4639 /* PF PCIE descriptor */ in be_cmd_set_sriov_config()
4640 be_reset_pcie_desc(&desc.pcie); in be_cmd_set_sriov_config()
4641 desc.pcie.hdr.desc_type = PCIE_RESOURCE_DESC_TYPE_V1; in be_cmd_set_sriov_config()
4642 desc.pcie.hdr.desc_len = RESOURCE_DESC_SIZE_V1; in be_cmd_set_sriov_config()
4643 desc.pcie.flags = BIT(IMM_SHIFT) | BIT(NOSV_SHIFT); in be_cmd_set_sriov_config()
4644 desc.pcie.pf_num = adapter->pdev->devfn; in be_cmd_set_sriov_config()
4645 desc.pcie.sriov_state = num_vfs ? 1 : 0; in be_cmd_set_sriov_config()
4646 desc.pcie.num_vfs = cpu_to_le16(num_vfs); in be_cmd_set_sriov_config()
4652 desc.nic_vft.flags = vft_res->flags | BIT(VFT_SHIFT) | in be_cmd_set_sriov_config()
4654 desc.nic_vft.pf_num = adapter->pdev->devfn; in be_cmd_set_sriov_config()
4656 desc.nic_vft.cap_flags = cpu_to_le32(vft_res->vf_if_cap_flags); in be_cmd_set_sriov_config()
4657 desc.nic_vft.rq_count = cpu_to_le16(vft_res->max_rx_qs); in be_cmd_set_sriov_config()
4658 desc.nic_vft.txq_count = cpu_to_le16(vft_res->max_tx_qs); in be_cmd_set_sriov_config()
4659 desc.nic_vft.rssq_count = cpu_to_le16(vft_res->max_rss_qs); in be_cmd_set_sriov_config()
4660 desc.nic_vft.cq_count = cpu_to_le16(vft_res->max_cq_count); in be_cmd_set_sriov_config()
4662 if (vft_res->max_uc_mac) in be_cmd_set_sriov_config()
4664 cpu_to_le16(vft_res->max_uc_mac); in be_cmd_set_sriov_config()
4665 if (vft_res->max_vlans) in be_cmd_set_sriov_config()
4666 desc.nic_vft.vlan_count = cpu_to_le16(vft_res->max_vlans); in be_cmd_set_sriov_config()
4667 if (vft_res->max_iface_count) in be_cmd_set_sriov_config()
4669 cpu_to_le16(vft_res->max_iface_count); in be_cmd_set_sriov_config()
4670 if (vft_res->max_mcc_count) in be_cmd_set_sriov_config()
4671 desc.nic_vft.mcc_count = cpu_to_le16(vft_res->max_mcc_count); in be_cmd_set_sriov_config()
4684 return -1; in be_cmd_manage_iface()
4686 mutex_lock(&adapter->mcc_lock); in be_cmd_manage_iface()
4690 status = -EBUSY; in be_cmd_manage_iface()
4695 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_manage_iface()
4698 req->op = op; in be_cmd_manage_iface()
4699 req->target_iface_id = cpu_to_le32(iface); in be_cmd_manage_iface()
4703 mutex_unlock(&adapter->mcc_lock); in be_cmd_manage_iface()
4715 port_desc.link_num = adapter->hba_port_num; in be_cmd_set_vxlan_port()
4737 mutex_lock(&adapter->mcc_lock); in be_cmd_get_if_id()
4741 status = -EBUSY; in be_cmd_get_if_id()
4746 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_if_id()
4749 req->hdr.domain = vf_num + 1; in be_cmd_get_if_id()
4754 vf_cfg->if_handle = le32_to_cpu(resp->if_desc.if_id); in be_cmd_get_if_id()
4758 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_if_id()
4769 reg_val = ioread32(adapter->db + PHYSDEV_CONTROL_OFFSET); in lancer_wait_idle()
4777 status = -1; in lancer_wait_idle()
4790 iowrite32(mask, adapter->db + PHYSDEV_CONTROL_OFFSET); in lancer_physdev_ctrl()
4800 sliport_status = ioread32(adapter->db + SLIPORT_STATUS_OFFSET); in dump_present()
4806 struct device *dev = &adapter->pdev->dev; in lancer_initiate_dump()
4811 return -EEXIST; in lancer_initiate_dump()
4828 return -EIO; in lancer_initiate_dump()
4852 mutex_lock(&adapter->mcc_lock); in be_cmd_enable_vf()
4856 status = -EBUSY; in be_cmd_enable_vf()
4862 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_enable_vf()
4866 req->hdr.domain = domain; in be_cmd_enable_vf()
4867 req->enable = 1; in be_cmd_enable_vf()
4870 mutex_unlock(&adapter->mcc_lock); in be_cmd_enable_vf()
4880 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_intr_set()
4881 return -1; in be_cmd_intr_set()
4887 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_intr_set()
4891 req->intr_enabled = intr_enable; in be_cmd_intr_set()
4895 mutex_unlock(&adapter->mbox_lock); in be_cmd_intr_set()
4906 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_get_active_profile()
4907 return -1; in be_cmd_get_active_profile()
4911 status = -EBUSY; in be_cmd_get_active_profile()
4917 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_active_profile()
4926 *profile_id = le16_to_cpu(resp->active_profile_id); in be_cmd_get_active_profile()
4930 mutex_unlock(&adapter->mbox_lock); in be_cmd_get_active_profile()
4943 mutex_lock(&adapter->mcc_lock); in __be_cmd_set_logical_link_config()
4947 status = -EBUSY; in __be_cmd_set_logical_link_config()
4953 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in __be_cmd_set_logical_link_config()
4957 req->hdr.version = version; in __be_cmd_set_logical_link_config()
4958 req->hdr.domain = domain; in __be_cmd_set_logical_link_config()
4967 req->link_config = cpu_to_le32(link_config); in __be_cmd_set_logical_link_config()
4971 mutex_unlock(&adapter->mcc_lock); in __be_cmd_set_logical_link_config()
4981 return -EOPNOTSUPP; in be_cmd_set_logical_link_config()
5002 if (mutex_lock_interruptible(&adapter->mcc_lock)) in be_cmd_set_features()
5003 return -1; in be_cmd_set_features()
5007 status = -EBUSY; in be_cmd_set_features()
5013 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_set_features()
5017 req->features = cpu_to_le32(BE_FEATURE_UE_RECOVERY); in be_cmd_set_features()
5018 req->parameter_len = cpu_to_le32(sizeof(struct be_req_ue_recovery)); in be_cmd_set_features()
5019 req->parameter.req.uer = cpu_to_le32(BE_UE_RECOVERY_UER_MASK); in be_cmd_set_features()
5027 adapter->error_recovery.ue_to_poll_time = in be_cmd_set_features()
5028 le16_to_cpu(resp->parameter.resp.ue2rp); in be_cmd_set_features()
5029 adapter->error_recovery.ue_to_reset_time = in be_cmd_set_features()
5030 le16_to_cpu(resp->parameter.resp.ue2sr); in be_cmd_set_features()
5031 adapter->error_recovery.recovery_supported = true; in be_cmd_set_features()
5038 dev_info(&adapter->pdev->dev, in be_cmd_set_features()
5041 mutex_unlock(&adapter->mcc_lock); in be_cmd_set_features()
5055 mutex_lock(&adapter->mcc_lock); in be_roce_mcc_cmd()
5059 status = -EBUSY; in be_roce_mcc_cmd()
5065 be_wrb_cmd_hdr_prepare(req, hdr->subsystem, in be_roce_mcc_cmd()
5066 hdr->opcode, wrb_payload_size, wrb, NULL); in be_roce_mcc_cmd()
5075 memcpy(wrb_payload, resp, sizeof(*resp) + resp->response_length); in be_roce_mcc_cmd()
5076 be_dws_le_to_cpu(wrb_payload, sizeof(*resp) + resp->response_length); in be_roce_mcc_cmd()
5078 mutex_unlock(&adapter->mcc_lock); in be_roce_mcc_cmd()