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()
144 if (compl->flags != 0) { in be_mcc_compl_is_new()
145 flags = le32_to_cpu(compl->flags); in be_mcc_compl_is_new()
147 compl->flags = flags; in be_mcc_compl_is_new()
157 compl->flags = 0; in be_mcc_compl_use()
190 enum mcc_base_status base_status = base_status(compl->status); in be_async_cmd_process()
194 opcode = resp_hdr->opcode; in be_async_cmd_process()
195 subsystem = resp_hdr->subsystem; in be_async_cmd_process()
200 complete(&adapter->et_cmd_compl); in be_async_cmd_process()
206 complete(&adapter->et_cmd_compl); in be_async_cmd_process()
213 adapter->flash_status = compl->status; in be_async_cmd_process()
214 complete(&adapter->et_cmd_compl); in be_async_cmd_process()
223 adapter->stats_cmd_sent = false; in be_async_cmd_process()
232 adapter->hwmon_info.be_on_die_temp = in be_async_cmd_process()
233 resp->on_die_temperature; in be_async_cmd_process()
235 adapter->be_get_temp_freq = 0; in be_async_cmd_process()
236 adapter->hwmon_info.be_on_die_temp = in be_async_cmd_process()
256 base_status = base_status(compl->status); in be_mcc_compl_process()
257 addl_status = addl_status(compl->status); in be_mcc_compl_process()
259 resp_hdr = be_decode_resp_hdr(compl->tag0, compl->tag1); in be_mcc_compl_process()
261 opcode = resp_hdr->opcode; in be_mcc_compl_process()
262 subsystem = resp_hdr->subsystem; in be_mcc_compl_process()
271 dev_warn(&adapter->pdev->dev, in be_mcc_compl_process()
272 "VF is not privileged to issue opcode %d-%d\n", in be_mcc_compl_process()
275 dev_err(&adapter->pdev->dev, in be_mcc_compl_process()
276 "opcode %d-%d failed:status %d-%d\n", in be_mcc_compl_process()
280 return compl->status; in be_mcc_compl_process()
290 /* When link status changes, link speed must be re-queried from FW */ in be_async_link_state_process()
291 adapter->phy.link_speed = -1; in be_async_link_state_process()
299 !(evt->port_link_status & LOGICAL_LINK_STATUS_MASK)) in be_async_link_state_process()
305 if (adapter->flags & BE_FLAGS_LINK_STATUS_INIT) in be_async_link_state_process()
307 evt->port_link_status & LINK_STATUS_MASK); in be_async_link_state_process()
315 u32 sfp_misconfig_evt_word1 = le32_to_cpu(evt->event_data_word1); in be_async_port_misconfig_event_process()
316 u32 sfp_misconfig_evt_word2 = le32_to_cpu(evt->event_data_word2); in be_async_port_misconfig_event_process()
318 struct device *dev = &adapter->pdev->dev; in be_async_port_misconfig_event_process()
324 (sfp_misconfig_evt_word1 >> (adapter->hba_port_num * 8)) & 0xff; in be_async_port_misconfig_event_process()
326 if (new_phy_state == adapter->phy_state) in be_async_port_misconfig_event_process()
329 adapter->phy_state = new_phy_state; in be_async_port_misconfig_event_process()
336 (sfp_misconfig_evt_word2 >> (adapter->hba_port_num * 8)) & 0xff; in be_async_port_misconfig_event_process()
352 adapter->port_name, in be_async_port_misconfig_event_process()
358 adapter->port_name, in be_async_port_misconfig_event_process()
364 adapter->flags |= BE_FLAGS_PHY_MISCONFIGURED; in be_async_port_misconfig_event_process()
374 if (evt->valid) { in be_async_grp5_cos_priority_process()
375 adapter->vlan_prio_bmap = evt->available_priority_bmap; in be_async_grp5_cos_priority_process()
376 adapter->recommended_prio_bits = in be_async_grp5_cos_priority_process()
377 evt->reco_default_priority << VLAN_PRIO_SHIFT; in be_async_grp5_cos_priority_process()
388 if (adapter->phy.link_speed >= 0 && in be_async_grp5_qos_speed_process()
389 evt->physical_port == adapter->port_num) in be_async_grp5_qos_speed_process()
390 adapter->phy.link_speed = le16_to_cpu(evt->qos_link_speed) * 10; in be_async_grp5_qos_speed_process()
400 if (evt->enabled) { in be_async_grp5_pvid_state_process()
401 adapter->pvid = le16_to_cpu(evt->tag) & VLAN_VID_MASK; in be_async_grp5_pvid_state_process()
402 dev_info(&adapter->pdev->dev, "LPVID: %d\n", adapter->pvid); in be_async_grp5_pvid_state_process()
404 adapter->pvid = 0; in be_async_grp5_pvid_state_process()
413 u32 evt_dw1 = le32_to_cpu(evt->event_data_word1); in be_async_grp5_fw_control_process()
416 adapter->flags |= BE_FLAGS_OS2BMC; in be_async_grp5_fw_control_process()
417 adapter->bmc_filt_mask = le32_to_cpu(evt->event_data_word2); in be_async_grp5_fw_control_process()
419 adapter->flags &= ~BE_FLAGS_OS2BMC; in be_async_grp5_fw_control_process()
426 u8 event_type = (compl->flags >> ASYNC_EVENT_TYPE_SHIFT) & in be_async_grp5_evt_process()
439 /* Async event to disable/enable os2bmc and/or mac-learning */ in be_async_grp5_evt_process()
454 event_type = (cmp->flags >> ASYNC_EVENT_TYPE_SHIFT) & in be_async_dbg_evt_process()
459 if (evt->valid) in be_async_dbg_evt_process()
460 adapter->qnq_vid = le16_to_cpu(evt->vlan_tag); in be_async_dbg_evt_process()
461 adapter->flags |= BE_FLAGS_QNQ_ASYNC_EVT_RCVD; in be_async_dbg_evt_process()
464 dev_warn(&adapter->pdev->dev, "Unknown debug event 0x%x!\n", in be_async_dbg_evt_process()
473 u8 event_type = (cmp->flags >> ASYNC_EVENT_TYPE_SHIFT) & in be_async_sliport_evt_process()
507 if (is_link_state_evt(compl->flags)) in be_mcc_event_process()
509 else if (is_grp5_evt(compl->flags)) in be_mcc_event_process()
511 else if (is_dbg_evt(compl->flags)) in be_mcc_event_process()
513 else if (is_sliport_evt(compl->flags)) in be_mcc_event_process()
519 struct be_queue_info *mcc_cq = &adapter->mcc_obj.cq; in be_mcc_compl_get()
531 spin_lock_bh(&adapter->mcc_cq_lock); in be_async_mcc_enable()
533 be_cq_notify(adapter, adapter->mcc_obj.cq.id, true, 0); in be_async_mcc_enable()
534 adapter->mcc_obj.rearm_cq = true; in be_async_mcc_enable()
536 spin_unlock_bh(&adapter->mcc_cq_lock); in be_async_mcc_enable()
541 spin_lock_bh(&adapter->mcc_cq_lock); in be_async_mcc_disable()
543 adapter->mcc_obj.rearm_cq = false; in be_async_mcc_disable()
544 be_cq_notify(adapter, adapter->mcc_obj.cq.id, false, 0); in be_async_mcc_disable()
546 spin_unlock_bh(&adapter->mcc_cq_lock); in be_async_mcc_disable()
553 struct be_mcc_obj *mcc_obj = &adapter->mcc_obj; in be_process_mcc()
555 spin_lock(&adapter->mcc_cq_lock); in be_process_mcc()
558 if (compl->flags & CQE_FLAGS_ASYNC_MASK) { in be_process_mcc()
560 } else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) { in be_process_mcc()
562 atomic_dec(&mcc_obj->q.used); in be_process_mcc()
569 be_cq_notify(adapter, mcc_obj->cq.id, mcc_obj->rearm_cq, num); in be_process_mcc()
571 spin_unlock(&adapter->mcc_cq_lock); in be_process_mcc()
580 struct be_mcc_obj *mcc_obj = &adapter->mcc_obj; in be_mcc_wait_compl()
584 return -EIO; in be_mcc_wait_compl()
590 if (atomic_read(&mcc_obj->q.used) == 0) in be_mcc_wait_compl()
595 dev_err(&adapter->pdev->dev, "FW not responding\n"); in be_mcc_wait_compl()
597 return -EIO; in be_mcc_wait_compl()
607 struct be_mcc_obj *mcc_obj = &adapter->mcc_obj; in be_mcc_notify_wait()
608 u32 index = mcc_obj->q.head; in be_mcc_notify_wait()
611 index_dec(&index, mcc_obj->q.len); in be_mcc_notify_wait()
612 wrb = queue_index_node(&mcc_obj->q, index); in be_mcc_notify_wait()
614 resp = be_decode_resp_hdr(wrb->tag0, wrb->tag1); in be_mcc_notify_wait()
621 if (status == -EIO) in be_mcc_notify_wait()
624 status = (resp->base_status | in be_mcc_notify_wait()
625 ((resp->addl_status & CQE_ADDL_STATUS_MASK) << in be_mcc_notify_wait()
638 return -EIO; in be_mbox_db_ready_wait()
642 return -1; in be_mbox_db_ready_wait()
649 dev_err(&adapter->pdev->dev, "FW not responding\n"); in be_mbox_db_ready_wait()
652 return -1; in be_mbox_db_ready_wait()
669 void __iomem *db = adapter->db + MPU_MAILBOX_DB_OFFSET; in be_mbox_notify_wait()
670 struct be_dma_mem *mbox_mem = &adapter->mbox_mem; in be_mbox_notify_wait()
671 struct be_mcc_mailbox *mbox = mbox_mem->va; in be_mbox_notify_wait()
672 struct be_mcc_compl *compl = &mbox->compl; in be_mbox_notify_wait()
680 /* at bits 2 - 31 place mbox dma addr msb bits 34 - 63 */ in be_mbox_notify_wait()
681 val |= (upper_32_bits(mbox_mem->dma) >> 2) << 2; in be_mbox_notify_wait()
690 /* at bits 2 - 31 place mbox dma addr lsb bits 4 - 33 */ in be_mbox_notify_wait()
691 val |= (u32)(mbox_mem->dma >> 4) << 2; in be_mbox_notify_wait()
700 status = be_mcc_compl_process(adapter, &mbox->compl); in be_mbox_notify_wait()
705 dev_err(&adapter->pdev->dev, "invalid mailbox completion\n"); in be_mbox_notify_wait()
706 return -1; in be_mbox_notify_wait()
716 sem = ioread32(adapter->csr + SLIPORT_SEMAPHORE_OFFSET_BEx); in be_POST_stage_get()
718 pci_read_config_dword(adapter->pdev, in be_POST_stage_get()
731 sliport_status = ioread32(adapter->db + SLIPORT_STATUS_OFFSET); in lancer_wait_ready()
737 return -EIO; in lancer_wait_ready()
742 return sliport_status ? : -1; in lancer_wait_ready()
749 struct device *dev = &adapter->pdev->dev; in be_fw_wait_ready()
772 return -EINTR; in be_fw_wait_ready()
779 return -ETIMEDOUT; in be_fw_wait_ready()
784 return &wrb->payload.sgl[0]; in nonembedded_sgl()
789 wrb->tag0 = addr & 0xFFFFFFFF; in fill_wrb_tags()
790 wrb->tag1 = upper_32_bits(addr); in fill_wrb_tags()
802 req_hdr->opcode = opcode; in be_wrb_cmd_hdr_prepare()
803 req_hdr->subsystem = subsystem; in be_wrb_cmd_hdr_prepare()
804 req_hdr->request_length = cpu_to_le32(cmd_len - sizeof(*req_hdr)); in be_wrb_cmd_hdr_prepare()
805 req_hdr->version = 0; in be_wrb_cmd_hdr_prepare()
807 wrb->payload_length = cmd_len; in be_wrb_cmd_hdr_prepare()
809 wrb->embedded |= (1 & MCC_WRB_SGE_CNT_MASK) << in be_wrb_cmd_hdr_prepare()
812 sge->pa_hi = cpu_to_le32(upper_32_bits(mem->dma)); in be_wrb_cmd_hdr_prepare()
813 sge->pa_lo = cpu_to_le32(mem->dma & 0xFFFFFFFF); in be_wrb_cmd_hdr_prepare()
814 sge->len = cpu_to_le32(mem->size); in be_wrb_cmd_hdr_prepare()
816 wrb->embedded |= MCC_WRB_EMBEDDED_MASK; in be_wrb_cmd_hdr_prepare()
823 int i, buf_pages = min(PAGES_4K_SPANNED(mem->va, mem->size), max_pages); in be_cmd_page_addrs_prepare()
824 u64 dma = (u64)mem->dma; in be_cmd_page_addrs_prepare()
835 struct be_dma_mem *mbox_mem = &adapter->mbox_mem; in wrb_from_mbox()
836 struct be_mcc_wrb *wrb = &((struct be_mcc_mailbox *)(mbox_mem->va))->wrb; in wrb_from_mbox()
844 struct be_queue_info *mccq = &adapter->mcc_obj.q; in wrb_from_mccq()
847 if (!mccq->created) in wrb_from_mccq()
850 if (atomic_read(&mccq->used) >= mccq->len) in wrb_from_mccq()
855 atomic_inc(&mccq->used); in wrb_from_mccq()
862 return adapter->mcc_obj.q.created; in use_mcc()
869 mutex_lock(&adapter->mcc_lock); in be_cmd_lock()
872 return mutex_lock_interruptible(&adapter->mbox_lock); in be_cmd_lock()
880 return mutex_unlock(&adapter->mcc_lock); in be_cmd_unlock()
882 return mutex_unlock(&adapter->mbox_lock); in be_cmd_unlock()
899 if (wrb->embedded & cpu_to_le32(MCC_WRB_EMBEDDED_MASK)) in be_cmd_copy()
918 status = -EBUSY; in be_cmd_notify_wait()
946 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_fw_init()
947 return -1; in be_cmd_fw_init()
961 mutex_unlock(&adapter->mbox_lock); in be_cmd_fw_init()
976 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_fw_clean()
977 return -1; in be_cmd_fw_clean()
991 mutex_unlock(&adapter->mbox_lock); in be_cmd_fw_clean()
999 struct be_dma_mem *q_mem = &eqo->q.dma_mem; in be_cmd_eq_create()
1002 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_eq_create()
1003 return -1; in be_cmd_eq_create()
1008 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_eq_create()
1012 /* Support for EQ_CREATEv2 available only SH-R onwards */ in be_cmd_eq_create()
1016 req->hdr.version = ver; in be_cmd_eq_create()
1017 req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); in be_cmd_eq_create()
1019 AMAP_SET_BITS(struct amap_eq_context, valid, req->context, 1); in be_cmd_eq_create()
1021 AMAP_SET_BITS(struct amap_eq_context, size, req->context, 0); in be_cmd_eq_create()
1022 AMAP_SET_BITS(struct amap_eq_context, count, req->context, in be_cmd_eq_create()
1023 __ilog2_u32(eqo->q.len / 256)); in be_cmd_eq_create()
1024 be_dws_cpu_to_le(req->context, sizeof(req->context)); in be_cmd_eq_create()
1026 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); in be_cmd_eq_create()
1032 eqo->q.id = le16_to_cpu(resp->eq_id); in be_cmd_eq_create()
1033 eqo->msix_idx = in be_cmd_eq_create()
1034 (ver == 2) ? le16_to_cpu(resp->msix_idx) : eqo->idx; in be_cmd_eq_create()
1035 eqo->q.created = true; in be_cmd_eq_create()
1038 mutex_unlock(&adapter->mbox_lock); in be_cmd_eq_create()
1050 mutex_lock(&adapter->mcc_lock); in be_cmd_mac_addr_query()
1054 status = -EBUSY; in be_cmd_mac_addr_query()
1059 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_mac_addr_query()
1062 req->type = MAC_ADDRESS_TYPE_NETWORK; in be_cmd_mac_addr_query()
1064 req->permanent = 1; in be_cmd_mac_addr_query()
1066 req->if_id = cpu_to_le16((u16)if_handle); in be_cmd_mac_addr_query()
1067 req->pmac_id = cpu_to_le32(pmac_id); in be_cmd_mac_addr_query()
1068 req->permanent = 0; in be_cmd_mac_addr_query()
1075 memcpy(mac_addr, resp->mac.addr, ETH_ALEN); in be_cmd_mac_addr_query()
1079 mutex_unlock(&adapter->mcc_lock); in be_cmd_mac_addr_query()
1091 mutex_lock(&adapter->mcc_lock); in be_cmd_pmac_add()
1095 status = -EBUSY; in be_cmd_pmac_add()
1100 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_pmac_add()
1104 req->hdr.domain = domain; in be_cmd_pmac_add()
1105 req->if_id = cpu_to_le32(if_id); in be_cmd_pmac_add()
1106 memcpy(req->mac_address, mac_addr, ETH_ALEN); in be_cmd_pmac_add()
1112 *pmac_id = le32_to_cpu(resp->pmac_id); in be_cmd_pmac_add()
1116 mutex_unlock(&adapter->mcc_lock); in be_cmd_pmac_add()
1119 status = -EPERM; in be_cmd_pmac_add()
1131 if (pmac_id == -1) in be_cmd_pmac_del()
1134 mutex_lock(&adapter->mcc_lock); in be_cmd_pmac_del()
1138 status = -EBUSY; in be_cmd_pmac_del()
1143 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_pmac_del()
1147 req->hdr.domain = dom; in be_cmd_pmac_del()
1148 req->if_id = cpu_to_le32(if_id); in be_cmd_pmac_del()
1149 req->pmac_id = cpu_to_le32(pmac_id); in be_cmd_pmac_del()
1154 mutex_unlock(&adapter->mcc_lock); in be_cmd_pmac_del()
1164 struct be_dma_mem *q_mem = &cq->dma_mem; in be_cmd_cq_create()
1168 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_cq_create()
1169 return -1; in be_cmd_cq_create()
1173 ctxt = &req->context; in be_cmd_cq_create()
1175 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_cq_create()
1179 req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); in be_cmd_cq_create()
1187 __ilog2_u32(cq->len / 256)); in be_cmd_cq_create()
1190 AMAP_SET_BITS(struct amap_cq_context_be, eqid, ctxt, eq->id); in be_cmd_cq_create()
1192 req->hdr.version = 2; in be_cmd_cq_create()
1193 req->page_size = 1; /* 1 for 4K */ in be_cmd_cq_create()
1195 /* coalesce-wm field in this cmd is not relevant to Lancer. in be_cmd_cq_create()
1204 __ilog2_u32(cq->len / 256)); in be_cmd_cq_create()
1207 AMAP_SET_BITS(struct amap_cq_context_v2, eqid, ctxt, eq->id); in be_cmd_cq_create()
1210 be_dws_cpu_to_le(ctxt, sizeof(req->context)); in be_cmd_cq_create()
1212 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); in be_cmd_cq_create()
1218 cq->id = le16_to_cpu(resp->cq_id); in be_cmd_cq_create()
1219 cq->created = true; in be_cmd_cq_create()
1222 mutex_unlock(&adapter->mbox_lock); in be_cmd_cq_create()
1242 struct be_dma_mem *q_mem = &mccq->dma_mem; in be_cmd_mccq_ext_create()
1246 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_mccq_ext_create()
1247 return -1; in be_cmd_mccq_ext_create()
1251 ctxt = &req->context; in be_cmd_mccq_ext_create()
1253 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_mccq_ext_create()
1257 req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); in be_cmd_mccq_ext_create()
1261 be_encoded_q_len(mccq->len)); in be_cmd_mccq_ext_create()
1262 AMAP_SET_BITS(struct amap_mcc_context_be, cq_id, ctxt, cq->id); in be_cmd_mccq_ext_create()
1264 req->hdr.version = 1; in be_cmd_mccq_ext_create()
1265 req->cq_id = cpu_to_le16(cq->id); in be_cmd_mccq_ext_create()
1268 be_encoded_q_len(mccq->len)); in be_cmd_mccq_ext_create()
1271 ctxt, cq->id); in be_cmd_mccq_ext_create()
1279 req->async_event_bitmap[0] = in be_cmd_mccq_ext_create()
1285 be_dws_cpu_to_le(ctxt, sizeof(req->context)); in be_cmd_mccq_ext_create()
1287 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); in be_cmd_mccq_ext_create()
1293 mccq->id = le16_to_cpu(resp->id); in be_cmd_mccq_ext_create()
1294 mccq->created = true; in be_cmd_mccq_ext_create()
1296 mutex_unlock(&adapter->mbox_lock); in be_cmd_mccq_ext_create()
1307 struct be_dma_mem *q_mem = &mccq->dma_mem; in be_cmd_mccq_org_create()
1311 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_mccq_org_create()
1312 return -1; in be_cmd_mccq_org_create()
1316 ctxt = &req->context; in be_cmd_mccq_org_create()
1318 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_mccq_org_create()
1322 req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); in be_cmd_mccq_org_create()
1326 be_encoded_q_len(mccq->len)); in be_cmd_mccq_org_create()
1327 AMAP_SET_BITS(struct amap_mcc_context_be, cq_id, ctxt, cq->id); in be_cmd_mccq_org_create()
1329 be_dws_cpu_to_le(ctxt, sizeof(req->context)); in be_cmd_mccq_org_create()
1331 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); in be_cmd_mccq_org_create()
1337 mccq->id = le16_to_cpu(resp->id); in be_cmd_mccq_org_create()
1338 mccq->created = true; in be_cmd_mccq_org_create()
1341 mutex_unlock(&adapter->mbox_lock); in be_cmd_mccq_org_create()
1352 dev_warn(&adapter->pdev->dev, "Upgrade to F/W ver 2.102.235.0 " in be_cmd_mccq_create()
1364 struct be_queue_info *txq = &txo->q; in be_cmd_txq_create()
1365 struct be_queue_info *cq = &txo->cq; in be_cmd_txq_create()
1366 struct be_dma_mem *q_mem = &txq->dma_mem; in be_cmd_txq_create()
1370 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, in be_cmd_txq_create()
1374 req->hdr.version = 1; in be_cmd_txq_create()
1376 if (adapter->function_caps & BE_FUNCTION_CAPS_SUPER_NIC) in be_cmd_txq_create()
1377 req->hdr.version = 2; in be_cmd_txq_create()
1379 req->hdr.version = 2; in be_cmd_txq_create()
1382 if (req->hdr.version > 0) in be_cmd_txq_create()
1383 req->if_id = cpu_to_le16(adapter->if_handle); in be_cmd_txq_create()
1384 req->num_pages = PAGES_4K_SPANNED(q_mem->va, q_mem->size); in be_cmd_txq_create()
1385 req->ulp_num = BE_ULP1_NUM; in be_cmd_txq_create()
1386 req->type = BE_ETH_TX_RING_TYPE_STANDARD; in be_cmd_txq_create()
1387 req->cq_id = cpu_to_le16(cq->id); in be_cmd_txq_create()
1388 req->queue_size = be_encoded_q_len(txq->len); in be_cmd_txq_create()
1389 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); in be_cmd_txq_create()
1390 ver = req->hdr.version; in be_cmd_txq_create()
1396 txq->id = le16_to_cpu(resp->cid); in be_cmd_txq_create()
1398 txo->db_offset = le32_to_cpu(resp->db_offset); in be_cmd_txq_create()
1400 txo->db_offset = DB_TXULP1_OFFSET; in be_cmd_txq_create()
1401 txq->created = true; in be_cmd_txq_create()
1414 struct be_dma_mem *q_mem = &rxq->dma_mem; in be_cmd_rxq_create()
1417 mutex_lock(&adapter->mcc_lock); in be_cmd_rxq_create()
1421 status = -EBUSY; in be_cmd_rxq_create()
1426 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, in be_cmd_rxq_create()
1429 req->cq_id = cpu_to_le16(cq_id); in be_cmd_rxq_create()
1430 req->frag_size = fls(frag_size) - 1; in be_cmd_rxq_create()
1431 req->num_pages = 2; in be_cmd_rxq_create()
1432 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); in be_cmd_rxq_create()
1433 req->interface_id = cpu_to_le32(if_id); in be_cmd_rxq_create()
1434 req->max_frame_size = cpu_to_le16(BE_MAX_JUMBO_FRAME_SIZE); in be_cmd_rxq_create()
1435 req->rss_queue = cpu_to_le32(rss); in be_cmd_rxq_create()
1441 rxq->id = le16_to_cpu(resp->id); in be_cmd_rxq_create()
1442 rxq->created = true; in be_cmd_rxq_create()
1443 *rss_id = resp->rss_id; in be_cmd_rxq_create()
1447 mutex_unlock(&adapter->mcc_lock); in be_cmd_rxq_create()
1462 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_q_destroy()
1463 return -1; in be_cmd_q_destroy()
1493 be_wrb_cmd_hdr_prepare(&req->hdr, subsys, opcode, sizeof(*req), wrb, in be_cmd_q_destroy()
1495 req->id = cpu_to_le16(q->id); in be_cmd_q_destroy()
1498 q->created = false; in be_cmd_q_destroy()
1500 mutex_unlock(&adapter->mbox_lock); in be_cmd_q_destroy()
1511 mutex_lock(&adapter->mcc_lock); in be_cmd_rxq_destroy()
1515 status = -EBUSY; in be_cmd_rxq_destroy()
1520 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, in be_cmd_rxq_destroy()
1522 req->id = cpu_to_le16(q->id); in be_cmd_rxq_destroy()
1525 q->created = false; in be_cmd_rxq_destroy()
1528 mutex_unlock(&adapter->mcc_lock); in be_cmd_rxq_destroy()
1543 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_if_create()
1546 req->hdr.domain = domain; in be_cmd_if_create()
1547 req->capability_flags = cpu_to_le32(cap_flags); in be_cmd_if_create()
1548 req->enable_flags = cpu_to_le32(en_flags); in be_cmd_if_create()
1549 req->pmac_invalid = true; in be_cmd_if_create()
1555 *if_handle = le32_to_cpu(resp->interface_id); in be_cmd_if_create()
1557 /* Hack to retrieve VF's pmac-id on BE3 */ in be_cmd_if_create()
1559 adapter->pmac_id[0] = le32_to_cpu(resp->pmac_id); in be_cmd_if_create()
1571 if (interface_id == -1) in be_cmd_if_destroy()
1576 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_if_destroy()
1579 req->hdr.domain = domain; in be_cmd_if_destroy()
1580 req->interface_id = cpu_to_le32(interface_id); in be_cmd_if_destroy()
1596 mutex_lock(&adapter->mcc_lock); in be_cmd_get_stats()
1600 status = -EBUSY; in be_cmd_get_stats()
1603 hdr = nonemb_cmd->va; in be_cmd_get_stats()
1606 OPCODE_ETH_GET_STATISTICS, nonemb_cmd->size, wrb, in be_cmd_get_stats()
1611 hdr->version = 0; in be_cmd_get_stats()
1613 hdr->version = 1; in be_cmd_get_stats()
1615 hdr->version = 2; in be_cmd_get_stats()
1621 adapter->stats_cmd_sent = true; in be_cmd_get_stats()
1624 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_stats()
1638 return -EPERM; in lancer_cmd_get_pport_stats()
1640 mutex_lock(&adapter->mcc_lock); in lancer_cmd_get_pport_stats()
1644 status = -EBUSY; in lancer_cmd_get_pport_stats()
1647 req = nonemb_cmd->va; in lancer_cmd_get_pport_stats()
1649 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, in lancer_cmd_get_pport_stats()
1650 OPCODE_ETH_GET_PPORT_STATS, nonemb_cmd->size, in lancer_cmd_get_pport_stats()
1653 req->cmd_params.params.pport_num = cpu_to_le16(adapter->hba_port_num); in lancer_cmd_get_pport_stats()
1654 req->cmd_params.params.reset_stats = 0; in lancer_cmd_get_pport_stats()
1660 adapter->stats_cmd_sent = true; in lancer_cmd_get_pport_stats()
1663 mutex_unlock(&adapter->mcc_lock); in lancer_cmd_get_pport_stats()
1700 mutex_lock(&adapter->mcc_lock); in be_cmd_link_status_query()
1707 status = -EBUSY; in be_cmd_link_status_query()
1712 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_link_status_query()
1718 req->hdr.version = 1; in be_cmd_link_status_query()
1720 req->hdr.domain = dom; in be_cmd_link_status_query()
1727 *link_speed = resp->link_speed ? in be_cmd_link_status_query()
1728 le16_to_cpu(resp->link_speed) * 10 : in be_cmd_link_status_query()
1729 be_mac_to_link_speed(resp->mac_speed); in be_cmd_link_status_query()
1731 if (!resp->logical_link_status) in be_cmd_link_status_query()
1735 *link_status = resp->logical_link_status; in be_cmd_link_status_query()
1739 mutex_unlock(&adapter->mcc_lock); in be_cmd_link_status_query()
1750 mutex_lock(&adapter->mcc_lock); in be_cmd_get_die_temperature()
1754 status = -EBUSY; in be_cmd_get_die_temperature()
1759 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_die_temperature()
1765 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_die_temperature()
1778 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_fat_dump_len()
1781 req->fat_operation = cpu_to_le32(QUERY_FAT); in be_cmd_get_fat_dump_len()
1786 if (dump_size && resp->log_size) in be_cmd_get_fat_dump_len()
1787 *dump_size = le32_to_cpu(resp->log_size) - in be_cmd_get_fat_dump_len()
1808 get_fat_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, in be_cmd_get_fat_dump()
1812 return -ENOMEM; in be_cmd_get_fat_dump()
1814 mutex_lock(&adapter->mcc_lock); in be_cmd_get_fat_dump()
1818 total_size -= buf_size; in be_cmd_get_fat_dump()
1822 status = -EBUSY; in be_cmd_get_fat_dump()
1828 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_fat_dump()
1832 req->fat_operation = cpu_to_le32(RETRIEVE_FAT); in be_cmd_get_fat_dump()
1833 req->read_log_offset = cpu_to_le32(log_offset); in be_cmd_get_fat_dump()
1834 req->read_log_length = cpu_to_le32(buf_size); in be_cmd_get_fat_dump()
1835 req->data_buffer_size = cpu_to_le32(buf_size); in be_cmd_get_fat_dump()
1842 resp->data_buffer, in be_cmd_get_fat_dump()
1843 le32_to_cpu(resp->read_log_length)); in be_cmd_get_fat_dump()
1845 dev_err(&adapter->pdev->dev, "FAT Table Retrieve error\n"); in be_cmd_get_fat_dump()
1852 dma_free_coherent(&adapter->pdev->dev, get_fat_cmd.size, in be_cmd_get_fat_dump()
1854 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_fat_dump()
1865 mutex_lock(&adapter->mcc_lock); in be_cmd_get_fw_ver()
1869 status = -EBUSY; in be_cmd_get_fw_ver()
1875 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_fw_ver()
1882 strscpy(adapter->fw_ver, resp->firmware_version_string, in be_cmd_get_fw_ver()
1883 sizeof(adapter->fw_ver)); in be_cmd_get_fw_ver()
1884 strscpy(adapter->fw_on_flash, resp->fw_on_flash_version_string, in be_cmd_get_fw_ver()
1885 sizeof(adapter->fw_on_flash)); in be_cmd_get_fw_ver()
1888 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_fw_ver()
1902 mutex_lock(&adapter->mcc_lock); in __be_cmd_modify_eqd()
1906 status = -EBUSY; in __be_cmd_modify_eqd()
1911 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in __be_cmd_modify_eqd()
1915 req->num_eq = cpu_to_le32(num); in __be_cmd_modify_eqd()
1917 req->set_eqd[i].eq_id = cpu_to_le32(set_eqd[i].eq_id); in __be_cmd_modify_eqd()
1918 req->set_eqd[i].phase = 0; in __be_cmd_modify_eqd()
1919 req->set_eqd[i].delay_multiplier = in __be_cmd_modify_eqd()
1925 mutex_unlock(&adapter->mcc_lock); in __be_cmd_modify_eqd()
1938 num -= num_eqs; in be_cmd_modify_eqd()
1952 mutex_lock(&adapter->mcc_lock); in be_cmd_vlan_config()
1956 status = -EBUSY; in be_cmd_vlan_config()
1961 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_vlan_config()
1964 req->hdr.domain = domain; in be_cmd_vlan_config()
1966 req->interface_id = if_id; in be_cmd_vlan_config()
1967 req->untagged = BE_IF_FLAGS_UNTAGGED & be_if_cap_flags(adapter) ? 1 : 0; in be_cmd_vlan_config()
1968 req->num_vlan = num; in be_cmd_vlan_config()
1969 memcpy(req->normal_vlan, vtag_array, in be_cmd_vlan_config()
1970 req->num_vlan * sizeof(vtag_array[0])); in be_cmd_vlan_config()
1974 mutex_unlock(&adapter->mcc_lock); in be_cmd_vlan_config()
1981 struct be_dma_mem *mem = &adapter->rx_filter; in __be_cmd_rx_filter()
1982 struct be_cmd_req_rx_filter *req = mem->va; in __be_cmd_rx_filter()
1985 mutex_lock(&adapter->mcc_lock); in __be_cmd_rx_filter()
1989 status = -EBUSY; in __be_cmd_rx_filter()
1993 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in __be_cmd_rx_filter()
1997 req->if_id = cpu_to_le32(adapter->if_handle); in __be_cmd_rx_filter()
1998 req->if_flags_mask = cpu_to_le32(flags); in __be_cmd_rx_filter()
1999 req->if_flags = (value == ON) ? req->if_flags_mask : 0; in __be_cmd_rx_filter()
2007 req->if_flags_mask |= in __be_cmd_rx_filter()
2010 req->mcast_num = cpu_to_le32(adapter->mc_count); in __be_cmd_rx_filter()
2011 for (i = 0; i < adapter->mc_count; i++) in __be_cmd_rx_filter()
2012 ether_addr_copy(req->mcast_mac[i].byte, in __be_cmd_rx_filter()
2013 adapter->mc_list[i].mac); in __be_cmd_rx_filter()
2018 mutex_unlock(&adapter->mcc_lock); in __be_cmd_rx_filter()
2024 struct device *dev = &adapter->pdev->dev; in be_cmd_rx_filter()
2033 return -ENOTSUPP; in be_cmd_rx_filter()
2047 return -EPERM; in be_cmd_set_flow_control()
2049 mutex_lock(&adapter->mcc_lock); in be_cmd_set_flow_control()
2053 status = -EBUSY; in be_cmd_set_flow_control()
2058 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_set_flow_control()
2062 req->hdr.version = 1; in be_cmd_set_flow_control()
2063 req->tx_flow_control = cpu_to_le16((u16)tx_fc); in be_cmd_set_flow_control()
2064 req->rx_flow_control = cpu_to_le16((u16)rx_fc); in be_cmd_set_flow_control()
2069 mutex_unlock(&adapter->mcc_lock); in be_cmd_set_flow_control()
2072 return -EOPNOTSUPP; in be_cmd_set_flow_control()
2086 return -EPERM; in be_cmd_get_flow_control()
2088 mutex_lock(&adapter->mcc_lock); in be_cmd_get_flow_control()
2092 status = -EBUSY; in be_cmd_get_flow_control()
2097 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_flow_control()
2106 *tx_fc = le16_to_cpu(resp->tx_flow_control); in be_cmd_get_flow_control()
2107 *rx_fc = le16_to_cpu(resp->rx_flow_control); in be_cmd_get_flow_control()
2111 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_flow_control()
2122 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_query_fw_cfg()
2123 return -1; in be_cmd_query_fw_cfg()
2128 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_query_fw_cfg()
2136 adapter->port_num = le32_to_cpu(resp->phys_port); in be_cmd_query_fw_cfg()
2137 adapter->function_mode = le32_to_cpu(resp->function_mode); in be_cmd_query_fw_cfg()
2138 adapter->function_caps = le32_to_cpu(resp->function_caps); in be_cmd_query_fw_cfg()
2139 adapter->asic_rev = le32_to_cpu(resp->asic_revision) & 0xFF; in be_cmd_query_fw_cfg()
2140 dev_info(&adapter->pdev->dev, in be_cmd_query_fw_cfg()
2142 adapter->function_mode, adapter->function_caps); in be_cmd_query_fw_cfg()
2145 mutex_unlock(&adapter->mbox_lock); in be_cmd_query_fw_cfg()
2158 adapter->db + SLIPORT_CONTROL_OFFSET); in be_cmd_reset_function()
2161 dev_err(&adapter->pdev->dev, in be_cmd_reset_function()
2166 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_reset_function()
2167 return -1; in be_cmd_reset_function()
2178 mutex_unlock(&adapter->mbox_lock); in be_cmd_reset_function()
2192 mutex_lock(&adapter->mcc_lock); in be_cmd_rss_config()
2196 status = -EBUSY; in be_cmd_rss_config()
2201 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, in be_cmd_rss_config()
2204 req->if_id = cpu_to_le32(adapter->if_handle); in be_cmd_rss_config()
2205 req->enable_rss = cpu_to_le16(rss_hash_opts); in be_cmd_rss_config()
2206 req->cpu_table_size_log2 = cpu_to_le16(fls(table_size) - 1); in be_cmd_rss_config()
2209 req->hdr.version = 1; in be_cmd_rss_config()
2211 memcpy(req->cpu_table, rsstable, table_size); in be_cmd_rss_config()
2212 memcpy(req->hash, rss_hkey, RSS_HASH_KEY_LEN); in be_cmd_rss_config()
2213 be_dws_cpu_to_le(req->hash, sizeof(req->hash)); in be_cmd_rss_config()
2217 mutex_unlock(&adapter->mcc_lock); in be_cmd_rss_config()
2229 mutex_lock(&adapter->mcc_lock); in be_cmd_set_beacon_state()
2233 status = -EBUSY; in be_cmd_set_beacon_state()
2238 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_set_beacon_state()
2242 req->port_num = port_num; in be_cmd_set_beacon_state()
2243 req->beacon_state = state; in be_cmd_set_beacon_state()
2244 req->beacon_duration = bcn; in be_cmd_set_beacon_state()
2245 req->status_duration = sts; in be_cmd_set_beacon_state()
2250 mutex_unlock(&adapter->mcc_lock); in be_cmd_set_beacon_state()
2261 mutex_lock(&adapter->mcc_lock); in be_cmd_get_beacon_state()
2265 status = -EBUSY; in be_cmd_get_beacon_state()
2270 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_beacon_state()
2274 req->port_num = port_num; in be_cmd_get_beacon_state()
2281 *state = resp->beacon_state; in be_cmd_get_beacon_state()
2285 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_beacon_state()
2299 return -EINVAL; in be_cmd_read_port_transceiver_data()
2302 cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, in be_cmd_read_port_transceiver_data()
2305 dev_err(&adapter->pdev->dev, "Memory allocation failed\n"); in be_cmd_read_port_transceiver_data()
2306 return -ENOMEM; in be_cmd_read_port_transceiver_data()
2309 mutex_lock(&adapter->mcc_lock); in be_cmd_read_port_transceiver_data()
2313 status = -EBUSY; in be_cmd_read_port_transceiver_data()
2318 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_read_port_transceiver_data()
2322 req->port = cpu_to_le32(adapter->hba_port_num); in be_cmd_read_port_transceiver_data()
2323 req->page_num = cpu_to_le32(page_num); in be_cmd_read_port_transceiver_data()
2328 memcpy(data, resp->page_data + off, len); in be_cmd_read_port_transceiver_data()
2331 mutex_unlock(&adapter->mcc_lock); in be_cmd_read_port_transceiver_data()
2332 dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma); in be_cmd_read_port_transceiver_data()
2348 mutex_lock(&adapter->mcc_lock); in lancer_cmd_write_object()
2349 adapter->flash_status = 0; in lancer_cmd_write_object()
2353 status = -EBUSY; in lancer_cmd_write_object()
2359 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in lancer_cmd_write_object()
2364 ctxt = &req->context; in lancer_cmd_write_object()
2375 be_dws_cpu_to_le(ctxt, sizeof(req->context)); in lancer_cmd_write_object()
2376 req->write_offset = cpu_to_le32(data_offset); in lancer_cmd_write_object()
2377 strscpy(req->object_name, obj_name, sizeof(req->object_name)); in lancer_cmd_write_object()
2378 req->descriptor_count = cpu_to_le32(1); in lancer_cmd_write_object()
2379 req->buf_len = cpu_to_le32(data_size); in lancer_cmd_write_object()
2380 req->addr_low = cpu_to_le32((cmd->dma + in lancer_cmd_write_object()
2383 req->addr_high = cpu_to_le32(upper_32_bits(cmd->dma + in lancer_cmd_write_object()
2390 mutex_unlock(&adapter->mcc_lock); in lancer_cmd_write_object()
2392 if (!wait_for_completion_timeout(&adapter->et_cmd_compl, in lancer_cmd_write_object()
2394 status = -ETIMEDOUT; in lancer_cmd_write_object()
2396 status = adapter->flash_status; in lancer_cmd_write_object()
2400 *data_written = le32_to_cpu(resp->actual_write_len); in lancer_cmd_write_object()
2401 *change_status = resp->change_status; in lancer_cmd_write_object()
2403 *addn_status = resp->additional_status; in lancer_cmd_write_object()
2409 mutex_unlock(&adapter->mcc_lock); in lancer_cmd_write_object()
2421 switch (adapter->phy.interface_type) { in be_cmd_query_cable_type()
2423 adapter->phy.cable_type = in be_cmd_query_cable_type()
2427 adapter->phy.cable_type = in be_cmd_query_cable_type()
2431 adapter->phy.cable_type = 0; in be_cmd_query_cable_type()
2446 strscpy(adapter->phy.vendor_name, page_data + in be_cmd_query_sfp_info()
2447 SFP_VENDOR_NAME_OFFSET, SFP_VENDOR_NAME_LEN - 1); in be_cmd_query_sfp_info()
2448 strscpy(adapter->phy.vendor_pn, in be_cmd_query_sfp_info()
2450 SFP_VENDOR_NAME_LEN - 1); in be_cmd_query_sfp_info()
2463 mutex_lock(&adapter->mcc_lock); in lancer_cmd_delete_object()
2467 status = -EBUSY; in lancer_cmd_delete_object()
2473 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in lancer_cmd_delete_object()
2477 strscpy(req->object_name, obj_name, sizeof(req->object_name)); in lancer_cmd_delete_object()
2481 mutex_unlock(&adapter->mcc_lock); in lancer_cmd_delete_object()
2494 mutex_lock(&adapter->mcc_lock); in lancer_cmd_read_object()
2498 status = -EBUSY; in lancer_cmd_read_object()
2504 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in lancer_cmd_read_object()
2509 req->desired_read_len = cpu_to_le32(data_size); in lancer_cmd_read_object()
2510 req->read_offset = cpu_to_le32(data_offset); in lancer_cmd_read_object()
2511 strcpy(req->object_name, obj_name); in lancer_cmd_read_object()
2512 req->descriptor_count = cpu_to_le32(1); in lancer_cmd_read_object()
2513 req->buf_len = cpu_to_le32(data_size); in lancer_cmd_read_object()
2514 req->addr_low = cpu_to_le32((cmd->dma & 0xFFFFFFFF)); in lancer_cmd_read_object()
2515 req->addr_high = cpu_to_le32(upper_32_bits(cmd->dma)); in lancer_cmd_read_object()
2521 *data_read = le32_to_cpu(resp->actual_read_len); in lancer_cmd_read_object()
2522 *eof = le32_to_cpu(resp->eof); in lancer_cmd_read_object()
2524 *addn_status = resp->additional_status; in lancer_cmd_read_object()
2528 mutex_unlock(&adapter->mcc_lock); in lancer_cmd_read_object()
2540 mutex_lock(&adapter->mcc_lock); in be_cmd_write_flashrom()
2541 adapter->flash_status = 0; in be_cmd_write_flashrom()
2545 status = -EBUSY; in be_cmd_write_flashrom()
2548 req = cmd->va; in be_cmd_write_flashrom()
2550 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_write_flashrom()
2551 OPCODE_COMMON_WRITE_FLASHROM, cmd->size, wrb, in be_cmd_write_flashrom()
2554 req->params.op_type = cpu_to_le32(flash_type); in be_cmd_write_flashrom()
2556 req->params.offset = cpu_to_le32(img_offset); in be_cmd_write_flashrom()
2558 req->params.op_code = cpu_to_le32(flash_opcode); in be_cmd_write_flashrom()
2559 req->params.data_buf_size = cpu_to_le32(buf_size); in be_cmd_write_flashrom()
2565 mutex_unlock(&adapter->mcc_lock); in be_cmd_write_flashrom()
2567 if (!wait_for_completion_timeout(&adapter->et_cmd_compl, in be_cmd_write_flashrom()
2569 status = -ETIMEDOUT; in be_cmd_write_flashrom()
2571 status = adapter->flash_status; in be_cmd_write_flashrom()
2576 mutex_unlock(&adapter->mcc_lock); in be_cmd_write_flashrom()
2587 mutex_lock(&adapter->mcc_lock); in be_cmd_get_flash_crc()
2591 status = -EBUSY; in be_cmd_get_flash_crc()
2596 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_flash_crc()
2600 req->params.op_type = cpu_to_le32(img_optype); in be_cmd_get_flash_crc()
2602 req->params.offset = cpu_to_le32(img_offset + crc_offset); in be_cmd_get_flash_crc()
2604 req->params.offset = cpu_to_le32(crc_offset); in be_cmd_get_flash_crc()
2606 req->params.op_code = cpu_to_le32(FLASHROM_OPER_REPORT); in be_cmd_get_flash_crc()
2607 req->params.data_buf_size = cpu_to_le32(0x4); in be_cmd_get_flash_crc()
2611 memcpy(flashed_crc, req->crc, 4); in be_cmd_get_flash_crc()
2614 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_flash_crc()
2622 return (adapter->phy.phy_type == PHY_TYPE_TN_8022 && in phy_flashing_required()
2623 adapter->phy.interface_type == PHY_TYPE_BASET_10GB); in phy_flashing_required()
2637 img_type = le32_to_cpu(fsec_g2->fsec_entry[i].type); in is_comp_in_ufi()
2639 img_type = le32_to_cpu(fsec->fsec_entry[i].type); in is_comp_in_ufi()
2652 const u8 *p = fw->data; in get_fsec_info()
2655 while (p < (fw->data + fw->size)) { in get_fsec_info()
2657 if (!memcmp(flash_cookie, fsec->cookie, sizeof(flash_cookie))) in get_fsec_info()
2673 img_size - 4); in be_check_flash_crc()
2677 crc_offset = hdr_size + img_offset + img_size - 4; in be_check_flash_crc()
2693 struct be_cmd_write_flashrom *req = flash_cmd->va; in be_flash()
2699 total_bytes -= num_bytes; in be_flash()
2713 memcpy(req->data_buf, img, num_bytes); in be_flash()
2749 /* For BE2, BE3 and BE3-R */
2755 struct device *dev = &adapter->pdev->dev; in be_flash_BEx()
2819 return -1; in be_flash_BEx()
2826 !be_fw_ncsi_supported(adapter->fw_ver)) { in be_flash_BEx()
2827 dev_info(dev, NCSI_UPDATE_LOG, adapter->fw_ver); in be_flash_BEx()
2836 status = be_check_flash_crc(adapter, fw->data, in be_flash_BEx()
2853 p = fw->data + filehdr_size + pflashcomp[i].offset + in be_flash_BEx()
2855 if (p + pflashcomp[i].size > fw->data + fw->size) in be_flash_BEx()
2856 return -1; in be_flash_BEx()
2927 struct device *dev = &adapter->pdev->dev; in be_flash_skyhawk()
2938 return -EINVAL; in be_flash_skyhawk()
2942 for (i = 0; i < le32_to_cpu(fsec->fsec_hdr.num_images); i++) { in be_flash_skyhawk()
2943 img_offset = le32_to_cpu(fsec->fsec_entry[i].offset); in be_flash_skyhawk()
2944 img_size = le32_to_cpu(fsec->fsec_entry[i].pad_size); in be_flash_skyhawk()
2945 img_type = le32_to_cpu(fsec->fsec_entry[i].type); in be_flash_skyhawk()
2946 img_optype = be_get_img_optype(fsec->fsec_entry[i]); in be_flash_skyhawk()
2947 old_fw_img = fsec->fsec_entry[i].optype == 0xFFFF; in be_flash_skyhawk()
2963 status = be_check_flash_crc(adapter, fw->data, img_offset, in be_flash_skyhawk()
2987 return -EAGAIN; in be_flash_skyhawk()
2991 return -EFAULT; in be_flash_skyhawk()
2998 p = fw->data + filehdr_size + img_offset + img_hdrs_size; in be_flash_skyhawk()
2999 if (p + img_size > fw->data + fw->size) in be_flash_skyhawk()
3000 return -1; in be_flash_skyhawk()
3031 return -EINVAL; in be_flash_skyhawk()
3035 return -EINVAL; in be_flash_skyhawk()
3037 return -EFAULT; in be_flash_skyhawk()
3047 struct device *dev = &adapter->pdev->dev; in lancer_fw_download()
3059 if (!IS_ALIGNED(fw->size, sizeof(u32))) { in lancer_fw_download()
3061 return -EINVAL; in lancer_fw_download()
3069 return -ENOMEM; in lancer_fw_download()
3073 image_size = fw->size; in lancer_fw_download()
3074 data_ptr = fw->data; in lancer_fw_download()
3092 image_size -= data_written; in lancer_fw_download()
3134 dev_err(&adapter->pdev->dev, "Invalid FW UFI file"); in be_check_ufi_compatibility()
3141 switch (fhdr->build[0]) { in be_check_ufi_compatibility()
3161 * pre-BE3-R chips (asic_rev < 0x10) in be_check_ufi_compatibility()
3163 if (BEx_chip(adapter) && fhdr->asic_type_rev == 0) in be_check_ufi_compatibility()
3164 return adapter->asic_rev < 0x10; in be_check_ufi_compatibility()
3166 return (fhdr->asic_type_rev >= adapter->asic_rev); in be_check_ufi_compatibility()
3171 struct device *dev = &adapter->pdev->dev; in be_fw_download()
3177 fhdr3 = (struct flash_file_hdr_g3 *)fw->data; in be_fw_download()
3180 return -EINVAL; in be_fw_download()
3187 return -ENOMEM; in be_fw_download()
3189 num_imgs = le32_to_cpu(fhdr3->num_imgs); in be_fw_download()
3191 img_hdr_ptr = (struct image_hdr *)(fw->data + in be_fw_download()
3195 le32_to_cpu(img_hdr_ptr->imageid) != 1) in be_fw_download()
3213 int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac, in be_cmd_enable_magic_wol() argument
3220 mutex_lock(&adapter->mcc_lock); in be_cmd_enable_magic_wol()
3224 status = -EBUSY; in be_cmd_enable_magic_wol()
3227 req = nonemb_cmd->va; in be_cmd_enable_magic_wol()
3229 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, in be_cmd_enable_magic_wol()
3232 memcpy(req->magic_mac, mac, ETH_ALEN); in be_cmd_enable_magic_wol()
3237 mutex_unlock(&adapter->mcc_lock); in be_cmd_enable_magic_wol()
3250 return -EPERM; in be_cmd_set_loopback()
3252 mutex_lock(&adapter->mcc_lock); in be_cmd_set_loopback()
3256 status = -EBUSY; in be_cmd_set_loopback()
3262 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, in be_cmd_set_loopback()
3266 req->src_port = port_num; in be_cmd_set_loopback()
3267 req->dest_port = port_num; in be_cmd_set_loopback()
3268 req->loopback_type = loopback_type; in be_cmd_set_loopback()
3269 req->loopback_state = enable; in be_cmd_set_loopback()
3275 mutex_unlock(&adapter->mcc_lock); in be_cmd_set_loopback()
3277 if (!wait_for_completion_timeout(&adapter->et_cmd_compl, in be_cmd_set_loopback()
3279 status = -ETIMEDOUT; in be_cmd_set_loopback()
3284 mutex_unlock(&adapter->mcc_lock); in be_cmd_set_loopback()
3299 return -EPERM; in be_cmd_loopback_test()
3301 mutex_lock(&adapter->mcc_lock); in be_cmd_loopback_test()
3305 status = -EBUSY; in be_cmd_loopback_test()
3311 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, in be_cmd_loopback_test()
3315 req->hdr.timeout = cpu_to_le32(15); in be_cmd_loopback_test()
3316 req->pattern = cpu_to_le64(pattern); in be_cmd_loopback_test()
3317 req->src_port = cpu_to_le32(port_num); in be_cmd_loopback_test()
3318 req->dest_port = cpu_to_le32(port_num); in be_cmd_loopback_test()
3319 req->pkt_size = cpu_to_le32(pkt_size); in be_cmd_loopback_test()
3320 req->num_pkts = cpu_to_le32(num_pkts); in be_cmd_loopback_test()
3321 req->loopback_type = cpu_to_le32(loopback_type); in be_cmd_loopback_test()
3327 mutex_unlock(&adapter->mcc_lock); in be_cmd_loopback_test()
3329 wait_for_completion(&adapter->et_cmd_compl); in be_cmd_loopback_test()
3331 status = le32_to_cpu(resp->status); in be_cmd_loopback_test()
3335 mutex_unlock(&adapter->mcc_lock); in be_cmd_loopback_test()
3349 return -EPERM; in be_cmd_ddr_dma_test()
3351 mutex_lock(&adapter->mcc_lock); in be_cmd_ddr_dma_test()
3355 status = -EBUSY; in be_cmd_ddr_dma_test()
3358 req = cmd->va; in be_cmd_ddr_dma_test()
3359 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, in be_cmd_ddr_dma_test()
3360 OPCODE_LOWLEVEL_HOST_DDR_DMA, cmd->size, wrb, in be_cmd_ddr_dma_test()
3363 req->pattern = cpu_to_le64(pattern); in be_cmd_ddr_dma_test()
3364 req->byte_count = cpu_to_le32(byte_cnt); in be_cmd_ddr_dma_test()
3366 req->snd_buff[i] = (u8)(pattern >> (j * 8)); in be_cmd_ddr_dma_test()
3377 resp = cmd->va; in be_cmd_ddr_dma_test()
3378 if ((memcmp(resp->rcv_buff, req->snd_buff, byte_cnt) != 0) || in be_cmd_ddr_dma_test()
3379 resp->snd_err) { in be_cmd_ddr_dma_test()
3380 status = -1; in be_cmd_ddr_dma_test()
3385 mutex_unlock(&adapter->mcc_lock); in be_cmd_ddr_dma_test()
3396 mutex_lock(&adapter->mcc_lock); in be_cmd_get_seeprom_data()
3400 status = -EBUSY; in be_cmd_get_seeprom_data()
3403 req = nonemb_cmd->va; in be_cmd_get_seeprom_data()
3405 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_seeprom_data()
3412 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_seeprom_data()
3425 return -EPERM; in be_cmd_get_phy_info()
3427 mutex_lock(&adapter->mcc_lock); in be_cmd_get_phy_info()
3431 status = -EBUSY; in be_cmd_get_phy_info()
3435 cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, in be_cmd_get_phy_info()
3438 dev_err(&adapter->pdev->dev, "Memory alloc failure\n"); in be_cmd_get_phy_info()
3439 status = -ENOMEM; in be_cmd_get_phy_info()
3445 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_phy_info()
3454 adapter->phy.phy_type = le16_to_cpu(resp_phy_info->phy_type); in be_cmd_get_phy_info()
3455 adapter->phy.interface_type = in be_cmd_get_phy_info()
3456 le16_to_cpu(resp_phy_info->interface_type); in be_cmd_get_phy_info()
3457 adapter->phy.auto_speeds_supported = in be_cmd_get_phy_info()
3458 le16_to_cpu(resp_phy_info->auto_speeds_supported); in be_cmd_get_phy_info()
3459 adapter->phy.fixed_speeds_supported = in be_cmd_get_phy_info()
3460 le16_to_cpu(resp_phy_info->fixed_speeds_supported); in be_cmd_get_phy_info()
3461 adapter->phy.misc_params = in be_cmd_get_phy_info()
3462 le32_to_cpu(resp_phy_info->misc_params); in be_cmd_get_phy_info()
3465 adapter->phy.fixed_speeds_supported = in be_cmd_get_phy_info()
3470 dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma); in be_cmd_get_phy_info()
3472 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_phy_info()
3482 mutex_lock(&adapter->mcc_lock); in be_cmd_set_qos()
3486 status = -EBUSY; in be_cmd_set_qos()
3492 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_set_qos()
3495 req->hdr.domain = domain; in be_cmd_set_qos()
3496 req->valid_bits = cpu_to_le32(BE_QOS_BITS_NIC); in be_cmd_set_qos()
3497 req->max_bps_nic = cpu_to_le32(bps); in be_cmd_set_qos()
3502 mutex_unlock(&adapter->mcc_lock); in be_cmd_set_qos()
3517 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_get_cntl_attributes()
3518 return -1; in be_cmd_get_cntl_attributes()
3522 attribs_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, in be_cmd_get_cntl_attributes()
3526 dev_err(&adapter->pdev->dev, "Memory allocation failure\n"); in be_cmd_get_cntl_attributes()
3527 status = -ENOMEM; in be_cmd_get_cntl_attributes()
3533 status = -EBUSY; in be_cmd_get_cntl_attributes()
3538 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_cntl_attributes()
3545 adapter->hba_port_num = attribs->hba_attribs.phy_port; in be_cmd_get_cntl_attributes()
3546 serial_num = attribs->hba_attribs.controller_serial_number; in be_cmd_get_cntl_attributes()
3548 adapter->serial_num[i] = le32_to_cpu(serial_num[i]) & in be_cmd_get_cntl_attributes()
3549 (BIT_MASK(16) - 1); in be_cmd_get_cntl_attributes()
3554 adapter->pf_num = attribs->hba_attribs.pci_funcnum; in be_cmd_get_cntl_attributes()
3558 mutex_unlock(&adapter->mbox_lock); in be_cmd_get_cntl_attributes()
3560 dma_free_coherent(&adapter->pdev->dev, attribs_cmd.size, in be_cmd_get_cntl_attributes()
3572 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_req_native_mode()
3573 return -1; in be_cmd_req_native_mode()
3577 status = -EBUSY; in be_cmd_req_native_mode()
3583 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_req_native_mode()
3587 req->valid_cap_flags = cpu_to_le32(CAPABILITY_SW_TIMESTAMPS | in be_cmd_req_native_mode()
3589 req->cap_flags = cpu_to_le32(CAPABILITY_BE3_NATIVE_ERX_API); in be_cmd_req_native_mode()
3595 adapter->be3_native = le32_to_cpu(resp->cap_flags) & in be_cmd_req_native_mode()
3597 if (!adapter->be3_native) in be_cmd_req_native_mode()
3598 dev_warn(&adapter->pdev->dev, in be_cmd_req_native_mode()
3602 mutex_unlock(&adapter->mbox_lock); in be_cmd_req_native_mode()
3614 mutex_lock(&adapter->mcc_lock); in be_cmd_get_fn_privileges()
3618 status = -EBUSY; in be_cmd_get_fn_privileges()
3624 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_fn_privileges()
3628 req->hdr.domain = domain; in be_cmd_get_fn_privileges()
3635 *privilege = le32_to_cpu(resp->privilege_mask); in be_cmd_get_fn_privileges()
3646 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_fn_privileges()
3658 mutex_lock(&adapter->mcc_lock); in be_cmd_set_fn_privileges()
3662 status = -EBUSY; in be_cmd_set_fn_privileges()
3667 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_set_fn_privileges()
3670 req->hdr.domain = domain; in be_cmd_set_fn_privileges()
3672 req->privileges_lancer = cpu_to_le32(privileges); in be_cmd_set_fn_privileges()
3674 req->privileges = cpu_to_le32(privileges); in be_cmd_set_fn_privileges()
3678 mutex_unlock(&adapter->mcc_lock); in be_cmd_set_fn_privileges()
3682 /* pmac_id_valid: true => pmac_id is supplied and MAC address is requested.
3683 * pmac_id_valid: false => pmac_id or MAC address is requested.
3686 int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac, in be_cmd_get_mac_from_list() argument
3699 get_mac_list_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, in be_cmd_get_mac_from_list()
3705 dev_err(&adapter->pdev->dev, in be_cmd_get_mac_from_list()
3707 return -ENOMEM; in be_cmd_get_mac_from_list()
3710 mutex_lock(&adapter->mcc_lock); in be_cmd_get_mac_from_list()
3714 status = -EBUSY; in be_cmd_get_mac_from_list()
3720 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_mac_from_list()
3723 req->hdr.domain = domain; in be_cmd_get_mac_from_list()
3724 req->mac_type = MAC_ADDRESS_TYPE_NETWORK; in be_cmd_get_mac_from_list()
3726 req->mac_id = cpu_to_le32(*pmac_id); in be_cmd_get_mac_from_list()
3727 req->iface_id = cpu_to_le16(if_handle); in be_cmd_get_mac_from_list()
3728 req->perm_override = 0; in be_cmd_get_mac_from_list()
3730 req->perm_override = 1; in be_cmd_get_mac_from_list()
3739 memcpy(mac, resp->macid_macaddr.mac_addr_id.macaddr, in be_cmd_get_mac_from_list()
3744 mac_count = resp->true_mac_count + resp->pseudo_mac_count; in be_cmd_get_mac_from_list()
3745 /* Mac list returned could contain one or more active mac_ids in be_cmd_get_mac_from_list()
3746 * or one or more true or pseudo permanent mac addresses. in be_cmd_get_mac_from_list()
3755 mac_entry = &resp->macaddr_list[i]; in be_cmd_get_mac_from_list()
3756 mac_addr_size = le16_to_cpu(mac_entry->mac_addr_size); in be_cmd_get_mac_from_list()
3762 mac_id = mac_entry->mac_addr_id.s_mac_id.mac_id; in be_cmd_get_mac_from_list()
3767 /* If no active mac_id found, return first mac addr */ in be_cmd_get_mac_from_list()
3769 memcpy(mac, resp->macaddr_list[0].mac_addr_id.macaddr, in be_cmd_get_mac_from_list()
3774 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_mac_from_list()
3775 dma_free_coherent(&adapter->pdev->dev, get_mac_list_cmd.size, in be_cmd_get_mac_from_list()
3781 u8 *mac, u32 if_handle, bool active, u32 domain) in be_cmd_get_active_mac() argument
3784 be_cmd_get_mac_from_list(adapter, mac, &active, &curr_pmac_id, in be_cmd_get_active_mac()
3787 return be_cmd_mac_addr_query(adapter, mac, false, in be_cmd_get_active_mac()
3790 /* Fetch the MAC address using pmac_id */ in be_cmd_get_active_mac()
3791 return be_cmd_get_mac_from_list(adapter, mac, &active, in be_cmd_get_active_mac()
3796 int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac) in be_cmd_get_perm_mac() argument
3801 eth_zero_addr(mac); in be_cmd_get_perm_mac()
3805 status = be_cmd_mac_addr_query(adapter, mac, true, 0, in be_cmd_get_perm_mac()
3808 status = be_cmd_mac_addr_query(adapter, mac, false, in be_cmd_get_perm_mac()
3809 adapter->if_handle, 0); in be_cmd_get_perm_mac()
3811 status = be_cmd_get_mac_from_list(adapter, mac, &pmac_valid, in be_cmd_get_perm_mac()
3812 NULL, adapter->if_handle, 0); in be_cmd_get_perm_mac()
3829 cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, in be_cmd_set_mac_list()
3832 return -ENOMEM; in be_cmd_set_mac_list()
3834 mutex_lock(&adapter->mcc_lock); in be_cmd_set_mac_list()
3838 status = -EBUSY; in be_cmd_set_mac_list()
3843 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_set_mac_list()
3847 req->hdr.domain = domain; in be_cmd_set_mac_list()
3848 req->mac_count = mac_count; in be_cmd_set_mac_list()
3850 memcpy(req->mac, mac_array, ETH_ALEN * mac_count); in be_cmd_set_mac_list()
3855 dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma); in be_cmd_set_mac_list()
3856 mutex_unlock(&adapter->mcc_lock); in be_cmd_set_mac_list()
3860 /* Wrapper to delete any active MACs and provision the new mac.
3861 * Changes to MAC_LIST are allowed iff none of the MAC addresses in the
3864 int be_cmd_set_mac(struct be_adapter *adapter, u8 *mac, int if_id, u32 dom) in be_cmd_set_mac() argument
3877 return be_cmd_set_mac_list(adapter, mac, mac ? 1 : 0, dom); in be_cmd_set_mac()
3890 return -EPERM; in be_cmd_set_hsw_config()
3892 mutex_lock(&adapter->mcc_lock); in be_cmd_set_hsw_config()
3896 status = -EBUSY; in be_cmd_set_hsw_config()
3901 ctxt = &req->context; in be_cmd_set_hsw_config()
3903 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_set_hsw_config()
3907 req->hdr.domain = domain; in be_cmd_set_hsw_config()
3915 ctxt, adapter->hba_port_num); in be_cmd_set_hsw_config()
3921 /* Enable/disable both mac and vlan spoof checking */ in be_cmd_set_hsw_config()
3929 be_dws_cpu_to_le(req->context, sizeof(req->context)); in be_cmd_set_hsw_config()
3933 mutex_unlock(&adapter->mcc_lock); in be_cmd_set_hsw_config()
3947 mutex_lock(&adapter->mcc_lock); in be_cmd_get_hsw_config()
3951 status = -EBUSY; in be_cmd_get_hsw_config()
3956 ctxt = &req->context; in be_cmd_get_hsw_config()
3958 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_hsw_config()
3962 req->hdr.domain = domain; in be_cmd_get_hsw_config()
3969 ctxt, adapter->hba_port_num); in be_cmd_get_hsw_config()
3972 be_dws_cpu_to_le(req->context, sizeof(req->context)); in be_cmd_get_hsw_config()
3979 be_dws_le_to_cpu(&resp->context, sizeof(resp->context)); in be_cmd_get_hsw_config()
3981 pvid, &resp->context); in be_cmd_get_hsw_config()
3986 port_fwd_type, &resp->context); in be_cmd_get_hsw_config()
3990 spoofchk, &resp->context); in be_cmd_get_hsw_config()
3994 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_hsw_config()
4000 struct pci_dev *pdev = adapter->pdev; in be_is_wol_excluded()
4005 switch (pdev->subsystem_device) { in be_is_wol_excluded()
4025 return -EPERM; in be_cmd_get_acpi_wol_cap()
4030 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_get_acpi_wol_cap()
4031 return -1; in be_cmd_get_acpi_wol_cap()
4035 cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, in be_cmd_get_acpi_wol_cap()
4038 dev_err(&adapter->pdev->dev, "Memory allocation failure\n"); in be_cmd_get_acpi_wol_cap()
4039 status = -ENOMEM; in be_cmd_get_acpi_wol_cap()
4045 status = -EBUSY; in be_cmd_get_acpi_wol_cap()
4051 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, in be_cmd_get_acpi_wol_cap()
4055 req->hdr.version = 1; in be_cmd_get_acpi_wol_cap()
4056 req->query_options = BE_GET_WOL_CAP; in be_cmd_get_acpi_wol_cap()
4064 adapter->wol_cap = resp->wol_settings; in be_cmd_get_acpi_wol_cap()
4066 /* Non-zero macaddr indicates WOL is enabled */ in be_cmd_get_acpi_wol_cap()
4067 if (adapter->wol_cap & BE_WOL_CAP && in be_cmd_get_acpi_wol_cap()
4068 !is_zero_ether_addr(resp->magic_mac)) in be_cmd_get_acpi_wol_cap()
4069 adapter->wol_en = true; in be_cmd_get_acpi_wol_cap()
4072 mutex_unlock(&adapter->mbox_lock); in be_cmd_get_acpi_wol_cap()
4074 dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, in be_cmd_get_acpi_wol_cap()
4089 extfat_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, in be_cmd_set_fw_log_level()
4093 return -ENOMEM; in be_cmd_set_fw_log_level()
4101 for (i = 0; i < le32_to_cpu(cfgs->num_modules); i++) { in be_cmd_set_fw_log_level()
4102 u32 num_modes = le32_to_cpu(cfgs->module[i].num_modes); in be_cmd_set_fw_log_level()
4105 if (cfgs->module[i].trace_lvl[j].mode == MODE_UART) in be_cmd_set_fw_log_level()
4106 cfgs->module[i].trace_lvl[j].dbg_lvl = in be_cmd_set_fw_log_level()
4113 dma_free_coherent(&adapter->pdev->dev, extfat_cmd.size, extfat_cmd.va, in be_cmd_set_fw_log_level()
4127 extfat_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, in be_cmd_get_fw_log_level()
4132 dev_err(&adapter->pdev->dev, "%s: Memory allocation failure\n", in be_cmd_get_fw_log_level()
4142 for (j = 0; j < le32_to_cpu(cfgs->module[0].num_modes); j++) { in be_cmd_get_fw_log_level()
4143 if (cfgs->module[0].trace_lvl[j].mode == MODE_UART) in be_cmd_get_fw_log_level()
4144 level = cfgs->module[0].trace_lvl[j].dbg_lvl; in be_cmd_get_fw_log_level()
4147 dma_free_coherent(&adapter->pdev->dev, extfat_cmd.size, extfat_cmd.va, in be_cmd_get_fw_log_level()
4162 return -EPERM; in be_cmd_get_ext_fat_capabilites()
4164 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_get_ext_fat_capabilites()
4165 return -1; in be_cmd_get_ext_fat_capabilites()
4169 status = -EBUSY; in be_cmd_get_ext_fat_capabilites()
4173 req = cmd->va; in be_cmd_get_ext_fat_capabilites()
4174 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_ext_fat_capabilites()
4176 cmd->size, wrb, cmd); in be_cmd_get_ext_fat_capabilites()
4177 req->parameter_type = cpu_to_le32(1); in be_cmd_get_ext_fat_capabilites()
4181 mutex_unlock(&adapter->mbox_lock); in be_cmd_get_ext_fat_capabilites()
4193 mutex_lock(&adapter->mcc_lock); in be_cmd_set_ext_fat_capabilites()
4197 status = -EBUSY; in be_cmd_set_ext_fat_capabilites()
4201 req = cmd->va; in be_cmd_set_ext_fat_capabilites()
4202 memcpy(&req->set_params, configs, sizeof(struct be_fat_conf_params)); in be_cmd_set_ext_fat_capabilites()
4203 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_set_ext_fat_capabilites()
4205 cmd->size, wrb, cmd); in be_cmd_set_ext_fat_capabilites()
4209 mutex_unlock(&adapter->mcc_lock); in be_cmd_set_ext_fat_capabilites()
4219 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_query_port_name()
4220 return -1; in be_cmd_query_port_name()
4225 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_query_port_name()
4229 req->hdr.version = 1; in be_cmd_query_port_name()
4235 adapter->port_name = resp->port_name[adapter->hba_port_num]; in be_cmd_query_port_name()
4237 adapter->port_name = adapter->hba_port_num + '0'; in be_cmd_query_port_name()
4240 mutex_unlock(&adapter->mbox_lock); in be_cmd_query_port_name()
4247 * get_vft must be true when the caller wants the VF-template desc of the
4248 * PF-pool.
4260 if (hdr->desc_type == NIC_RESOURCE_DESC_TYPE_V0 || in be_get_nic_desc()
4261 hdr->desc_type == NIC_RESOURCE_DESC_TYPE_V1) { in be_get_nic_desc()
4265 nic->pf_num == pf_num) && in be_get_nic_desc()
4266 (!get_vft || nic->flags & BIT(VFT_SHIFT))) in be_get_nic_desc()
4269 hdr->desc_len = hdr->desc_len ? : RESOURCE_DESC_SIZE_V0; in be_get_nic_desc()
4270 hdr = (void *)hdr + hdr->desc_len; in be_get_nic_desc()
4291 struct be_pcie_res_desc *pcie; in be_get_pcie_desc() local
4295 if (hdr->desc_type == PCIE_RESOURCE_DESC_TYPE_V0 || in be_get_pcie_desc()
4296 hdr->desc_type == PCIE_RESOURCE_DESC_TYPE_V1) { in be_get_pcie_desc()
4297 pcie = (struct be_pcie_res_desc *)hdr; in be_get_pcie_desc()
4298 if (pcie->pf_num == pf_num) in be_get_pcie_desc()
4299 return pcie; in be_get_pcie_desc()
4302 hdr->desc_len = hdr->desc_len ? : RESOURCE_DESC_SIZE_V0; in be_get_pcie_desc()
4303 hdr = (void *)hdr + hdr->desc_len; in be_get_pcie_desc()
4314 if (hdr->desc_type == PORT_RESOURCE_DESC_TYPE_V1) in be_get_port_desc()
4317 hdr->desc_len = hdr->desc_len ? : RESOURCE_DESC_SIZE_V0; in be_get_port_desc()
4318 hdr = (void *)hdr + hdr->desc_len; in be_get_port_desc()
4326 res->max_uc_mac = le16_to_cpu(desc->unicast_mac_count); in be_copy_nic_desc()
4327 res->max_vlans = le16_to_cpu(desc->vlan_count); in be_copy_nic_desc()
4328 res->max_mcast_mac = le16_to_cpu(desc->mcast_mac_count); in be_copy_nic_desc()
4329 res->max_tx_qs = le16_to_cpu(desc->txq_count); in be_copy_nic_desc()
4330 res->max_rss_qs = le16_to_cpu(desc->rssq_count); in be_copy_nic_desc()
4331 res->max_rx_qs = le16_to_cpu(desc->rq_count); in be_copy_nic_desc()
4332 res->max_evt_qs = le16_to_cpu(desc->eq_count); in be_copy_nic_desc()
4333 res->max_cq_count = le16_to_cpu(desc->cq_count); in be_copy_nic_desc()
4334 res->max_iface_count = le16_to_cpu(desc->iface_count); in be_copy_nic_desc()
4335 res->max_mcc_count = le16_to_cpu(desc->mcc_count); in be_copy_nic_desc()
4337 res->if_cap_flags = le32_to_cpu(desc->cap_flags) & in be_copy_nic_desc()
4349 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_get_func_config()
4350 return -1; in be_cmd_get_func_config()
4354 cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, in be_cmd_get_func_config()
4357 dev_err(&adapter->pdev->dev, "Memory alloc failure\n"); in be_cmd_get_func_config()
4358 status = -ENOMEM; in be_cmd_get_func_config()
4364 status = -EBUSY; in be_cmd_get_func_config()
4370 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_func_config()
4375 req->hdr.version = 1; in be_cmd_get_func_config()
4380 u32 desc_count = le32_to_cpu(resp->desc_count); in be_cmd_get_func_config()
4387 desc = be_get_func_nic_desc(resp->func_param, desc_count, in be_cmd_get_func_config()
4390 status = -EINVAL; in be_cmd_get_func_config()
4395 adapter->pf_num = desc->pf_num; in be_cmd_get_func_config()
4396 adapter->vf_num = desc->vf_num; in be_cmd_get_func_config()
4402 mutex_unlock(&adapter->mbox_lock); in be_cmd_get_func_config()
4404 dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, in be_cmd_get_func_config()
4413 struct be_pcie_res_desc *pcie = NULL; in be_get_nic_pf_num_list() local
4418 if (hdr->desc_type == PCIE_RESOURCE_DESC_TYPE_V0 || in be_get_nic_pf_num_list()
4419 hdr->desc_type == PCIE_RESOURCE_DESC_TYPE_V1) { in be_get_nic_pf_num_list()
4420 pcie = (struct be_pcie_res_desc *)hdr; in be_get_nic_pf_num_list()
4421 if (pcie->pf_state && (pcie->pf_type == MISSION_NIC || in be_get_nic_pf_num_list()
4422 pcie->pf_type == MISSION_RDMA)) { in be_get_nic_pf_num_list()
4423 nic_pf_nums[nic_pf_count++] = pcie->pf_num; in be_get_nic_pf_num_list()
4427 hdr->desc_len = hdr->desc_len ? : RESOURCE_DESC_SIZE_V0; in be_get_nic_pf_num_list()
4428 hdr = (void *)hdr + hdr->desc_len; in be_get_nic_pf_num_list()
4442 struct be_pcie_res_desc *pcie; in be_cmd_get_profile_config() local
4452 cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, in be_cmd_get_profile_config()
4455 return -ENOMEM; in be_cmd_get_profile_config()
4458 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_profile_config()
4463 req->hdr.version = 1; in be_cmd_get_profile_config()
4464 req->type = profile_type; in be_cmd_get_profile_config()
4465 req->hdr.domain = domain; in be_cmd_get_profile_config()
4472 req->type |= QUERY_MODIFIABLE_FIELDS_TYPE; in be_cmd_get_profile_config()
4479 desc_count = le16_to_cpu(resp->desc_count); in be_cmd_get_profile_config()
4485 nic_pf_cnt = be_get_nic_pf_num_list(resp->func_param, in be_cmd_get_profile_config()
4490 nic = be_get_func_nic_desc(resp->func_param, desc_count, in be_cmd_get_profile_config()
4492 if (nic->link_param == adapter->port_num) { in be_cmd_get_profile_config()
4493 port_res->nic_pfs++; in be_cmd_get_profile_config()
4494 pcie = be_get_pcie_desc(resp->func_param, in be_cmd_get_profile_config()
4497 port_res->max_vfs += le16_to_cpu(pcie->num_vfs); in be_cmd_get_profile_config()
4503 pcie = be_get_pcie_desc(resp->func_param, desc_count, in be_cmd_get_profile_config()
4504 adapter->pf_num); in be_cmd_get_profile_config()
4505 if (pcie) in be_cmd_get_profile_config()
4506 res->max_vfs = le16_to_cpu(pcie->num_vfs); in be_cmd_get_profile_config()
4508 port = be_get_port_desc(resp->func_param, desc_count); in be_cmd_get_profile_config()
4510 adapter->mc_type = port->mc_type; in be_cmd_get_profile_config()
4512 nic = be_get_func_nic_desc(resp->func_param, desc_count, in be_cmd_get_profile_config()
4513 adapter->pf_num); in be_cmd_get_profile_config()
4517 vf_res = be_get_vft_desc(resp->func_param, desc_count, in be_cmd_get_profile_config()
4518 adapter->pf_num); in be_cmd_get_profile_config()
4520 res->vf_if_cap_flags = vf_res->cap_flags; in be_cmd_get_profile_config()
4523 dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, in be_cmd_get_profile_config()
4539 cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, in be_cmd_set_profile_config()
4542 return -ENOMEM; in be_cmd_set_profile_config()
4545 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_set_profile_config()
4548 req->hdr.version = version; in be_cmd_set_profile_config()
4549 req->hdr.domain = domain; in be_cmd_set_profile_config()
4550 req->desc_count = cpu_to_le32(count); in be_cmd_set_profile_config()
4551 memcpy(req->desc, desc, size); in be_cmd_set_profile_config()
4556 dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, in be_cmd_set_profile_config()
4565 nic->unicast_mac_count = 0xFFFF; in be_reset_nic_desc()
4566 nic->mcc_count = 0xFFFF; in be_reset_nic_desc()
4567 nic->vlan_count = 0xFFFF; in be_reset_nic_desc()
4568 nic->mcast_mac_count = 0xFFFF; in be_reset_nic_desc()
4569 nic->txq_count = 0xFFFF; in be_reset_nic_desc()
4570 nic->rq_count = 0xFFFF; in be_reset_nic_desc()
4571 nic->rssq_count = 0xFFFF; in be_reset_nic_desc()
4572 nic->lro_count = 0xFFFF; in be_reset_nic_desc()
4573 nic->cq_count = 0xFFFF; in be_reset_nic_desc()
4574 nic->toe_conn_count = 0xFFFF; in be_reset_nic_desc()
4575 nic->eq_count = 0xFFFF; in be_reset_nic_desc()
4576 nic->iface_count = 0xFFFF; in be_reset_nic_desc()
4577 nic->link_param = 0xFF; in be_reset_nic_desc()
4578 nic->channel_id_param = cpu_to_le16(0xF000); in be_reset_nic_desc()
4579 nic->acpi_params = 0xFF; in be_reset_nic_desc()
4580 nic->wol_param = 0x0F; in be_reset_nic_desc()
4581 nic->tunnel_iface_count = 0xFFFF; in be_reset_nic_desc()
4582 nic->direct_tenant_iface_count = 0xFFFF; in be_reset_nic_desc()
4583 nic->bw_min = 0xFFFFFFFF; in be_reset_nic_desc()
4584 nic->bw_max = 0xFFFFFFFF; in be_reset_nic_desc()
4588 static void be_reset_pcie_desc(struct be_pcie_res_desc *pcie) in be_reset_pcie_desc() argument
4590 memset(pcie, 0, sizeof(*pcie)); in be_reset_pcie_desc()
4591 pcie->sriov_state = 0xFF; in be_reset_pcie_desc()
4592 pcie->pf_state = 0xFF; in be_reset_pcie_desc()
4593 pcie->pf_type = 0xFF; in be_reset_pcie_desc()
4594 pcie->num_vfs = 0xFFFF; in be_reset_pcie_desc()
4608 nic_desc.pf_num = adapter->pf_num; in be_cmd_config_qos()
4636 struct be_pcie_res_desc pcie; in be_cmd_set_sriov_config() member
4640 /* PF PCIE descriptor */ in be_cmd_set_sriov_config()
4641 be_reset_pcie_desc(&desc.pcie); in be_cmd_set_sriov_config()
4642 desc.pcie.hdr.desc_type = PCIE_RESOURCE_DESC_TYPE_V1; in be_cmd_set_sriov_config()
4643 desc.pcie.hdr.desc_len = RESOURCE_DESC_SIZE_V1; in be_cmd_set_sriov_config()
4644 desc.pcie.flags = BIT(IMM_SHIFT) | BIT(NOSV_SHIFT); in be_cmd_set_sriov_config()
4645 desc.pcie.pf_num = adapter->pdev->devfn; in be_cmd_set_sriov_config()
4646 desc.pcie.sriov_state = num_vfs ? 1 : 0; in be_cmd_set_sriov_config()
4647 desc.pcie.num_vfs = cpu_to_le16(num_vfs); in be_cmd_set_sriov_config()
4653 desc.nic_vft.flags = vft_res->flags | BIT(VFT_SHIFT) | in be_cmd_set_sriov_config()
4655 desc.nic_vft.pf_num = adapter->pdev->devfn; in be_cmd_set_sriov_config()
4657 desc.nic_vft.cap_flags = cpu_to_le32(vft_res->vf_if_cap_flags); in be_cmd_set_sriov_config()
4658 desc.nic_vft.rq_count = cpu_to_le16(vft_res->max_rx_qs); in be_cmd_set_sriov_config()
4659 desc.nic_vft.txq_count = cpu_to_le16(vft_res->max_tx_qs); in be_cmd_set_sriov_config()
4660 desc.nic_vft.rssq_count = cpu_to_le16(vft_res->max_rss_qs); in be_cmd_set_sriov_config()
4661 desc.nic_vft.cq_count = cpu_to_le16(vft_res->max_cq_count); in be_cmd_set_sriov_config()
4663 if (vft_res->max_uc_mac) in be_cmd_set_sriov_config()
4665 cpu_to_le16(vft_res->max_uc_mac); in be_cmd_set_sriov_config()
4666 if (vft_res->max_vlans) in be_cmd_set_sriov_config()
4667 desc.nic_vft.vlan_count = cpu_to_le16(vft_res->max_vlans); in be_cmd_set_sriov_config()
4668 if (vft_res->max_iface_count) in be_cmd_set_sriov_config()
4670 cpu_to_le16(vft_res->max_iface_count); in be_cmd_set_sriov_config()
4671 if (vft_res->max_mcc_count) in be_cmd_set_sriov_config()
4672 desc.nic_vft.mcc_count = cpu_to_le16(vft_res->max_mcc_count); in be_cmd_set_sriov_config()
4685 return -1; in be_cmd_manage_iface()
4687 mutex_lock(&adapter->mcc_lock); in be_cmd_manage_iface()
4691 status = -EBUSY; in be_cmd_manage_iface()
4696 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_manage_iface()
4699 req->op = op; in be_cmd_manage_iface()
4700 req->target_iface_id = cpu_to_le32(iface); in be_cmd_manage_iface()
4704 mutex_unlock(&adapter->mcc_lock); in be_cmd_manage_iface()
4716 port_desc.link_num = adapter->hba_port_num; in be_cmd_set_vxlan_port()
4738 mutex_lock(&adapter->mcc_lock); in be_cmd_get_if_id()
4742 status = -EBUSY; in be_cmd_get_if_id()
4747 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_if_id()
4750 req->hdr.domain = vf_num + 1; in be_cmd_get_if_id()
4755 vf_cfg->if_handle = le32_to_cpu(resp->if_desc.if_id); in be_cmd_get_if_id()
4759 mutex_unlock(&adapter->mcc_lock); in be_cmd_get_if_id()
4770 reg_val = ioread32(adapter->db + PHYSDEV_CONTROL_OFFSET); in lancer_wait_idle()
4778 status = -1; in lancer_wait_idle()
4791 iowrite32(mask, adapter->db + PHYSDEV_CONTROL_OFFSET); in lancer_physdev_ctrl()
4801 sliport_status = ioread32(adapter->db + SLIPORT_STATUS_OFFSET); in dump_present()
4807 struct device *dev = &adapter->pdev->dev; in lancer_initiate_dump()
4812 return -EEXIST; in lancer_initiate_dump()
4829 return -EIO; in lancer_initiate_dump()
4853 mutex_lock(&adapter->mcc_lock); in be_cmd_enable_vf()
4857 status = -EBUSY; in be_cmd_enable_vf()
4863 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_enable_vf()
4867 req->hdr.domain = domain; in be_cmd_enable_vf()
4868 req->enable = 1; in be_cmd_enable_vf()
4871 mutex_unlock(&adapter->mcc_lock); in be_cmd_enable_vf()
4881 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_intr_set()
4882 return -1; in be_cmd_intr_set()
4888 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_intr_set()
4892 req->intr_enabled = intr_enable; in be_cmd_intr_set()
4896 mutex_unlock(&adapter->mbox_lock); in be_cmd_intr_set()
4907 if (mutex_lock_interruptible(&adapter->mbox_lock)) in be_cmd_get_active_profile()
4908 return -1; in be_cmd_get_active_profile()
4912 status = -EBUSY; in be_cmd_get_active_profile()
4918 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_get_active_profile()
4927 *profile_id = le16_to_cpu(resp->active_profile_id); in be_cmd_get_active_profile()
4931 mutex_unlock(&adapter->mbox_lock); in be_cmd_get_active_profile()
4944 mutex_lock(&adapter->mcc_lock); in __be_cmd_set_logical_link_config()
4948 status = -EBUSY; in __be_cmd_set_logical_link_config()
4954 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in __be_cmd_set_logical_link_config()
4958 req->hdr.version = version; in __be_cmd_set_logical_link_config()
4959 req->hdr.domain = domain; in __be_cmd_set_logical_link_config()
4968 req->link_config = cpu_to_le32(link_config); in __be_cmd_set_logical_link_config()
4972 mutex_unlock(&adapter->mcc_lock); in __be_cmd_set_logical_link_config()
4982 return -EOPNOTSUPP; in be_cmd_set_logical_link_config()
5003 if (mutex_lock_interruptible(&adapter->mcc_lock)) in be_cmd_set_features()
5004 return -1; in be_cmd_set_features()
5008 status = -EBUSY; in be_cmd_set_features()
5014 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, in be_cmd_set_features()
5018 req->features = cpu_to_le32(BE_FEATURE_UE_RECOVERY); in be_cmd_set_features()
5019 req->parameter_len = cpu_to_le32(sizeof(struct be_req_ue_recovery)); in be_cmd_set_features()
5020 req->parameter.req.uer = cpu_to_le32(BE_UE_RECOVERY_UER_MASK); in be_cmd_set_features()
5028 adapter->error_recovery.ue_to_poll_time = in be_cmd_set_features()
5029 le16_to_cpu(resp->parameter.resp.ue2rp); in be_cmd_set_features()
5030 adapter->error_recovery.ue_to_reset_time = in be_cmd_set_features()
5031 le16_to_cpu(resp->parameter.resp.ue2sr); in be_cmd_set_features()
5032 adapter->error_recovery.recovery_supported = true; in be_cmd_set_features()
5039 dev_info(&adapter->pdev->dev, in be_cmd_set_features()
5042 mutex_unlock(&adapter->mcc_lock); in be_cmd_set_features()
5056 mutex_lock(&adapter->mcc_lock); in be_roce_mcc_cmd()
5060 status = -EBUSY; in be_roce_mcc_cmd()
5066 be_wrb_cmd_hdr_prepare(req, hdr->subsystem, in be_roce_mcc_cmd()
5067 hdr->opcode, wrb_payload_size, wrb, NULL); in be_roce_mcc_cmd()
5076 memcpy(wrb_payload, resp, sizeof(*resp) + resp->response_length); in be_roce_mcc_cmd()
5077 be_dws_le_to_cpu(wrb_payload, sizeof(*resp) + resp->response_length); in be_roce_mcc_cmd()
5079 mutex_unlock(&adapter->mcc_lock); in be_roce_mcc_cmd()