Lines Matching refs:softc
40 static void bnxt_hwrm_set_link_common(struct bnxt_softc *softc,
42 static void bnxt_hwrm_set_pause_common(struct bnxt_softc *softc,
44 static void bnxt_hwrm_set_eee(struct bnxt_softc *softc,
112 bnxt_alloc_hwrm_dma_mem(struct bnxt_softc *softc) in bnxt_alloc_hwrm_dma_mem() argument
116 rc = iflib_dma_alloc(softc->ctx, PAGE_SIZE, &softc->hwrm_cmd_resp, in bnxt_alloc_hwrm_dma_mem()
122 bnxt_free_hwrm_dma_mem(struct bnxt_softc *softc) in bnxt_free_hwrm_dma_mem() argument
124 if (softc->hwrm_cmd_resp.idi_vaddr) in bnxt_free_hwrm_dma_mem()
125 iflib_dma_free(&softc->hwrm_cmd_resp); in bnxt_free_hwrm_dma_mem()
126 softc->hwrm_cmd_resp.idi_vaddr = NULL; in bnxt_free_hwrm_dma_mem()
131 bnxt_hwrm_cmd_hdr_init(struct bnxt_softc *softc, void *request, in bnxt_hwrm_cmd_hdr_init() argument
139 req->resp_addr = htole64(softc->hwrm_cmd_resp.idi_paddr); in bnxt_hwrm_cmd_hdr_init()
143 _hwrm_send_message(struct bnxt_softc *softc, void *msg, uint32_t msg_len) in _hwrm_send_message() argument
146 struct hwrm_err_output *resp = (void *)softc->hwrm_cmd_resp.idi_vaddr; in _hwrm_send_message()
155 req->seq_id = htole16(softc->hwrm_cmd_seq++); in _hwrm_send_message()
158 if (BNXT_NO_FW_ACCESS(softc) && in _hwrm_send_message()
162 if ((softc->flags & BNXT_FLAG_SHORT_CMD) || in _hwrm_send_message()
164 void *short_cmd_req = softc->hwrm_short_cmd_req_addr.idi_vaddr; in _hwrm_send_message()
172 max_msg_len = softc->hwrm_max_ext_req_len; in _hwrm_send_message()
185 htole64(softc->hwrm_short_cmd_req_addr.idi_paddr); in _hwrm_send_message()
198 bus_space_write_4(softc->hwrm_bar.tag, in _hwrm_send_message()
199 softc->hwrm_bar.handle, in _hwrm_send_message()
206 bus_space_write_4(softc->hwrm_bar.tag, softc->hwrm_bar.handle, in _hwrm_send_message()
210 bus_space_write_4(softc->hwrm_bar.tag, in _hwrm_send_message()
211 softc->hwrm_bar.handle, in _hwrm_send_message()
215 for (i = 0; i < softc->hwrm_cmd_timeo; i++) { in _hwrm_send_message()
220 if (i >= softc->hwrm_cmd_timeo) { in _hwrm_send_message()
221 device_printf(softc->dev, in _hwrm_send_message()
223 GET_HWRM_REQ_TYPE(req->req_type), softc->hwrm_cmd_timeo, in _hwrm_send_message()
229 for (i = 0; i < softc->hwrm_cmd_timeo; i++) { in _hwrm_send_message()
234 if (i >= softc->hwrm_cmd_timeo) { in _hwrm_send_message()
235 device_printf(softc->dev, "Timeout sending %s: " in _hwrm_send_message()
238 softc->hwrm_cmd_timeo, le16toh(req->req_type), in _hwrm_send_message()
248 device_printf(softc->dev, in _hwrm_send_message()
260 hwrm_send_message(struct bnxt_softc *softc, void *msg, uint32_t msg_len) in hwrm_send_message() argument
264 BNXT_HWRM_LOCK(softc); in hwrm_send_message()
265 rc = _hwrm_send_message(softc, msg, msg_len); in hwrm_send_message()
266 BNXT_HWRM_UNLOCK(softc); in hwrm_send_message()
271 bnxt_hwrm_queue_qportcfg(struct bnxt_softc *softc, uint32_t path_dir) in bnxt_hwrm_queue_qportcfg() argument
276 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_queue_qportcfg()
283 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_QUEUE_QPORTCFG); in bnxt_hwrm_queue_qportcfg()
285 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_queue_qportcfg()
286 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_queue_qportcfg()
296 softc->is_asym_q = true; in bnxt_hwrm_queue_qportcfg()
299 softc->is_asym_q = false; in bnxt_hwrm_queue_qportcfg()
314 q_info = softc->tx_q_info; in bnxt_hwrm_queue_qportcfg()
315 q_ids = softc->tx_q_ids; in bnxt_hwrm_queue_qportcfg()
316 max_q = &softc->tx_max_q; in bnxt_hwrm_queue_qportcfg()
318 q_info = softc->rx_q_info; in bnxt_hwrm_queue_qportcfg()
319 q_ids = softc->rx_q_ids; in bnxt_hwrm_queue_qportcfg()
320 max_q = &softc->rx_max_q; in bnxt_hwrm_queue_qportcfg()
334 softc->tc_to_qidx[j] = j; in bnxt_hwrm_queue_qportcfg()
337 (no_rdma && BNXT_PF(softc))) in bnxt_hwrm_queue_qportcfg()
342 softc->max_tc = softc->max_tc ? min(softc->max_tc, max_tc) : max_tc; in bnxt_hwrm_queue_qportcfg()
343 softc->max_lltc = softc->max_lltc ? min(softc->max_lltc, max_lltc) : max_lltc; in bnxt_hwrm_queue_qportcfg()
345 if (softc->max_lltc > softc->max_tc) in bnxt_hwrm_queue_qportcfg()
346 softc->max_lltc = softc->max_tc; in bnxt_hwrm_queue_qportcfg()
349 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_queue_qportcfg()
353 static int bnxt_alloc_all_ctx_pg_info(struct bnxt_softc *softc, int ctx_max) in bnxt_alloc_all_ctx_pg_info() argument
355 struct bnxt_ctx_mem_info *ctx = softc->ctx_mem; in bnxt_alloc_all_ctx_pg_info()
391 bnxt_hwrm_func_backing_store_qcaps_v2(struct bnxt_softc *softc) in bnxt_hwrm_func_backing_store_qcaps_v2() argument
395 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_func_backing_store_qcaps_v2()
400 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_BACKING_STORE_QCAPS_V2); in bnxt_hwrm_func_backing_store_qcaps_v2()
406 softc->ctx_mem = ctx; in bnxt_hwrm_func_backing_store_qcaps_v2()
408 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_func_backing_store_qcaps_v2()
416 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_func_backing_store_qcaps_v2()
442 rc = bnxt_alloc_all_ctx_pg_info(softc, BNXT_CTX_V2_MAX); in bnxt_hwrm_func_backing_store_qcaps_v2()
445 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_func_backing_store_qcaps_v2()
449 int bnxt_hwrm_func_backing_store_qcaps(struct bnxt_softc *softc) in bnxt_hwrm_func_backing_store_qcaps() argument
453 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_func_backing_store_qcaps()
456 if (softc->hwrm_spec_code < 0x10902 || softc->ctx_mem) in bnxt_hwrm_func_backing_store_qcaps()
459 if (BNXT_CHIP_P7(softc)) { in bnxt_hwrm_func_backing_store_qcaps()
460 if (softc->fw_cap & BNXT_FW_CAP_BACKING_STORE_V2) in bnxt_hwrm_func_backing_store_qcaps()
461 return bnxt_hwrm_func_backing_store_qcaps_v2(softc); in bnxt_hwrm_func_backing_store_qcaps()
464 if (BNXT_VF(softc)) in bnxt_hwrm_func_backing_store_qcaps()
467 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_BACKING_STORE_QCAPS); in bnxt_hwrm_func_backing_store_qcaps()
468 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_func_backing_store_qcaps()
469 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_func_backing_store_qcaps()
476 ctx = softc->ctx_mem; in bnxt_hwrm_func_backing_store_qcaps()
483 softc->ctx_mem = ctx; in bnxt_hwrm_func_backing_store_qcaps()
551 ctx->tqm_fp_rings_count = softc->tx_max_q; in bnxt_hwrm_func_backing_store_qcaps()
555 softc->hwrm_max_ext_req_len >= BNXT_BACKING_STORE_CFG_LEN) { in bnxt_hwrm_func_backing_store_qcaps()
564 rc = bnxt_alloc_all_ctx_pg_info(softc, BNXT_CTX_MAX); in bnxt_hwrm_func_backing_store_qcaps()
569 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_func_backing_store_qcaps()
599 int bnxt_hwrm_func_backing_store_cfg(struct bnxt_softc *softc, uint32_t enables) in bnxt_hwrm_func_backing_store_cfg() argument
602 struct bnxt_ctx_mem_info *ctx = softc->ctx_mem; in bnxt_hwrm_func_backing_store_cfg()
615 if (req_len > softc->hwrm_max_ext_req_len) in bnxt_hwrm_func_backing_store_cfg()
618 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_BACKING_STORE_CFG); in bnxt_hwrm_func_backing_store_cfg()
717 return hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_func_backing_store_cfg()
720 int bnxt_hwrm_func_resc_qcaps(struct bnxt_softc *softc, bool all) in bnxt_hwrm_func_resc_qcaps() argument
723 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_func_resc_qcaps()
725 struct bnxt_hw_resc *hw_resc = &softc->hw_resc; in bnxt_hwrm_func_resc_qcaps()
728 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_RESOURCE_QCAPS); in bnxt_hwrm_func_resc_qcaps()
731 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_func_resc_qcaps()
732 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_func_resc_qcaps()
759 if (BNXT_CHIP_P5_PLUS(softc)) { in bnxt_hwrm_func_resc_qcaps()
765 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_func_resc_qcaps()
769 int bnxt_hwrm_func_backing_store_cfg_v2(struct bnxt_softc *softc, in bnxt_hwrm_func_backing_store_cfg_v2() argument
786 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_BACKING_STORE_CFG_V2); in bnxt_hwrm_func_backing_store_cfg_v2()
788 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_func_backing_store_cfg_v2()
810 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_func_backing_store_cfg_v2()
812 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_func_backing_store_cfg_v2()
817 bnxt_hwrm_passthrough(struct bnxt_softc *softc, void *req, uint32_t req_len, in bnxt_hwrm_passthrough() argument
821 void *output = (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_passthrough()
825 input->resp_addr = htole64(softc->hwrm_cmd_resp.idi_paddr); in bnxt_hwrm_passthrough()
826 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_passthrough()
827 old_timeo = softc->hwrm_cmd_timeo; in bnxt_hwrm_passthrough()
829 softc->hwrm_cmd_timeo = BNXT_NVM_TIMEO; in bnxt_hwrm_passthrough()
831 softc->hwrm_cmd_timeo = max(app_timeout, softc->hwrm_cmd_timeo); in bnxt_hwrm_passthrough()
832 rc = _hwrm_send_message(softc, req, req_len); in bnxt_hwrm_passthrough()
833 softc->hwrm_cmd_timeo = old_timeo; in bnxt_hwrm_passthrough()
835 device_printf(softc->dev, "%s: %s command failed with rc: 0x%x\n", in bnxt_hwrm_passthrough()
842 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_passthrough()
848 bnxt_hwrm_ver_get(struct bnxt_softc *softc) in bnxt_hwrm_ver_get() argument
852 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_ver_get()
859 softc->hwrm_max_req_len = HWRM_MAX_REQ_LEN; in bnxt_hwrm_ver_get()
860 softc->hwrm_cmd_timeo = 1000; in bnxt_hwrm_ver_get()
861 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VER_GET); in bnxt_hwrm_ver_get()
867 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_ver_get()
868 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_ver_get()
872 snprintf(softc->ver_info->hwrm_if_ver, BNXT_VERSTR_SIZE, "%d.%d.%d", in bnxt_hwrm_ver_get()
874 softc->ver_info->hwrm_if_major = resp->hwrm_intf_maj_8b; in bnxt_hwrm_ver_get()
875 softc->ver_info->hwrm_if_minor = resp->hwrm_intf_min_8b; in bnxt_hwrm_ver_get()
876 softc->ver_info->hwrm_if_update = resp->hwrm_intf_upd_8b; in bnxt_hwrm_ver_get()
877 strlcpy(softc->ver_info->driver_hwrm_if_ver, HWRM_VERSION_STR, in bnxt_hwrm_ver_get()
879 strlcpy(softc->ver_info->hwrm_fw_name, resp->hwrm_fw_name, in bnxt_hwrm_ver_get()
882 softc->hwrm_spec_code = resp->hwrm_intf_maj_8b << 16 | in bnxt_hwrm_ver_get()
886 device_printf(softc->dev, "HWRM interface %d.%d.%d is older " in bnxt_hwrm_ver_get()
889 device_printf(softc->dev, "Please update firmware with HWRM " in bnxt_hwrm_ver_get()
894 strlcpy(softc->ver_info->mgmt_fw_ver, naver, BNXT_VERSTR_SIZE); in bnxt_hwrm_ver_get()
895 strlcpy(softc->ver_info->mgmt_fw_name, nastr, BNXT_NAME_SIZE); in bnxt_hwrm_ver_get()
898 snprintf(softc->ver_info->mgmt_fw_ver, FW_VER_STR_LEN, in bnxt_hwrm_ver_get()
901 strlcpy(softc->ver_info->mgmt_fw_name, resp->mgmt_fw_name, in bnxt_hwrm_ver_get()
906 strlcpy(softc->ver_info->netctrl_fw_ver, naver, in bnxt_hwrm_ver_get()
908 strlcpy(softc->ver_info->netctrl_fw_name, nastr, in bnxt_hwrm_ver_get()
912 snprintf(softc->ver_info->netctrl_fw_ver, FW_VER_STR_LEN, in bnxt_hwrm_ver_get()
915 strlcpy(softc->ver_info->netctrl_fw_name, resp->netctrl_fw_name, in bnxt_hwrm_ver_get()
920 strlcpy(softc->ver_info->roce_fw_ver, naver, BNXT_VERSTR_SIZE); in bnxt_hwrm_ver_get()
921 strlcpy(softc->ver_info->roce_fw_name, nastr, BNXT_NAME_SIZE); in bnxt_hwrm_ver_get()
924 snprintf(softc->ver_info->roce_fw_ver, BNXT_VERSTR_SIZE, in bnxt_hwrm_ver_get()
927 strlcpy(softc->ver_info->roce_fw_name, resp->roce_fw_name, in bnxt_hwrm_ver_get()
932 if (softc->hwrm_spec_code > 0x10803 && fw_maj) { in bnxt_hwrm_ver_get()
945 softc->ver_info->fw_ver_code = BNXT_FW_VER_CODE(fw_maj, fw_min, fw_bld, fw_rsv); in bnxt_hwrm_ver_get()
946 snprintf (softc->ver_info->fw_ver_str, len, "%d.%d.%d.%d", in bnxt_hwrm_ver_get()
950 int fw_ver_len = strlen (softc->ver_info->fw_ver_str); in bnxt_hwrm_ver_get()
952 snprintf(softc->ver_info->fw_ver_str + fw_ver_len, in bnxt_hwrm_ver_get()
955 softc->fw_cap |= BNXT_FW_CAP_PKG_VER; in bnxt_hwrm_ver_get()
958 softc->ver_info->chip_num = le16toh(resp->chip_num); in bnxt_hwrm_ver_get()
959 softc->ver_info->chip_rev = resp->chip_rev; in bnxt_hwrm_ver_get()
960 softc->ver_info->chip_metal = resp->chip_metal; in bnxt_hwrm_ver_get()
961 softc->ver_info->chip_bond_id = resp->chip_bond_id; in bnxt_hwrm_ver_get()
962 softc->ver_info->chip_type = resp->chip_platform_type; in bnxt_hwrm_ver_get()
965 softc->hwrm_max_req_len = le16toh(resp->max_req_win_len); in bnxt_hwrm_ver_get()
966 softc->hwrm_max_ext_req_len = le16toh(resp->max_ext_req_len); in bnxt_hwrm_ver_get()
968 softc->hwrm_cmd_timeo = le16toh(resp->def_req_timeout); in bnxt_hwrm_ver_get()
969 if (!softc->hwrm_cmd_timeo) in bnxt_hwrm_ver_get()
970 softc->hwrm_cmd_timeo = DFLT_HWRM_CMD_TIMEOUT; in bnxt_hwrm_ver_get()
975 softc->flags |= BNXT_FLAG_SHORT_CMD; in bnxt_hwrm_ver_get()
979 softc->fw_cap |= BNXT_FW_CAP_SHORT_CMD; in bnxt_hwrm_ver_get()
982 softc->fw_cap |= BNXT_FW_CAP_KONG_MB_CHNL; in bnxt_hwrm_ver_get()
985 softc->fw_cap |= BNXT_FW_CAP_OVS_64BIT_HANDLE; in bnxt_hwrm_ver_get()
988 softc->fw_cap |= BNXT_FW_CAP_TRUSTED_VF; in bnxt_hwrm_ver_get()
991 softc->fw_cap |= BNXT_FW_CAP_CFA_ADV_FLOW; in bnxt_hwrm_ver_get()
994 softc->fw_cap |= BNXT_FW_CAP_CFA_EEM; in bnxt_hwrm_ver_get()
997 softc->fw_cap |= BNXT_FW_CAP_TRUFLOW_EN; in bnxt_hwrm_ver_get()
1000 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_ver_get()
1100 bnxt_hwrm_func_drv_unrgtr(struct bnxt_softc *softc, bool shutdown) in bnxt_hwrm_func_drv_unrgtr() argument
1104 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_DRV_UNRGTR); in bnxt_hwrm_func_drv_unrgtr()
1108 return hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_func_drv_unrgtr()
1134 bnxt_hwrm_func_qcaps(struct bnxt_softc *softc) in bnxt_hwrm_func_qcaps() argument
1139 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_func_qcaps()
1140 struct bnxt_func_info *func = &softc->func; in bnxt_hwrm_func_qcaps()
1143 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_QCAPS); in bnxt_hwrm_func_qcaps()
1146 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_func_qcaps()
1147 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_func_qcaps()
1153 softc->flags |= BNXT_FLAG_WOL_CAP; in bnxt_hwrm_func_qcaps()
1155 softc->flags |= BNXT_FLAG_FW_CAP_EXT_STATS; in bnxt_hwrm_func_qcaps()
1158 if (BNXT_CHIP_P5_PLUS(softc)) { in bnxt_hwrm_func_qcaps()
1160 softc->flags |= BNXT_FLAG_ROCEV1_CAP; in bnxt_hwrm_func_qcaps()
1162 softc->flags |= BNXT_FLAG_ROCEV2_CAP; in bnxt_hwrm_func_qcaps()
1166 softc->fw_cap |= BNXT_FW_CAP_LINK_ADMIN; in bnxt_hwrm_func_qcaps()
1168 softc->fw_cap |= BNXT_FW_CAP_ADMIN_PF; in bnxt_hwrm_func_qcaps()
1170 softc->fw_cap |= BNXT_FW_CAP_HOT_RESET; in bnxt_hwrm_func_qcaps()
1172 softc->fw_cap |= BNXT_FW_CAP_ERROR_RECOVERY; in bnxt_hwrm_func_qcaps()
1174 softc->fw_cap |= BNXT_FW_CAP_PCIE_STATS_SUPPORTED; in bnxt_hwrm_func_qcaps()
1176 softc->fw_cap |= BNXT_FW_CAP_EXT_STATS_SUPPORTED; in bnxt_hwrm_func_qcaps()
1178 softc->fw_cap |= BNXT_FW_CAP_ERR_RECOVER_RELOAD; in bnxt_hwrm_func_qcaps()
1180 softc->fw_cap |= BNXT_FW_CAP_VF_VNIC_NOTIFY; in bnxt_hwrm_func_qcaps()
1182 softc->fw_cap |= BNXT_FW_CAP_CRASHDUMP; in bnxt_hwrm_func_qcaps()
1184 softc->fw_cap |= BNXT_FW_CAP_VLAN_TX_INSERT; in bnxt_hwrm_func_qcaps()
1186 softc->fw_cap |= BNXT_FW_CAP_DBG_QCAPS; in bnxt_hwrm_func_qcaps()
1190 softc->fw_cap |= BNXT_FW_CAP_EXT_HW_STATS_SUPPORTED; in bnxt_hwrm_func_qcaps()
1191 if (BNXT_PF(softc) && (flags_ext & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT_ECN_STATS_SUPPORTED)) in bnxt_hwrm_func_qcaps()
1192 softc->fw_cap |= BNXT_FW_CAP_ECN_STATS; in bnxt_hwrm_func_qcaps()
1195 softc->fw_cap |= BNXT_FW_CAP_PTP_PPS; in bnxt_hwrm_func_qcaps()
1197 softc->fw_cap |= BNXT_FW_CAP_PTP_PTM; in bnxt_hwrm_func_qcaps()
1199 softc->fw_cap |= BNXT_FW_CAP_PTP_RTC; in bnxt_hwrm_func_qcaps()
1200 if (BNXT_PF(softc) && (flags_ext & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT_HOT_RESET_IF_SUPPORT)) in bnxt_hwrm_func_qcaps()
1201 softc->fw_cap |= BNXT_FW_CAP_HOT_RESET_IF; in bnxt_hwrm_func_qcaps()
1202 if (BNXT_PF(softc) && (flags_ext & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT_FW_LIVEPATCH_SUPPORTED)) in bnxt_hwrm_func_qcaps()
1203 softc->fw_cap |= BNXT_FW_CAP_LIVEPATCH; in bnxt_hwrm_func_qcaps()
1205 softc->fw_cap |= BNXT_FW_CAP_NPAR_1_2; in bnxt_hwrm_func_qcaps()
1207 softc->fw_cap |= BNXT_FW_CAP_BACKING_STORE_V2; in bnxt_hwrm_func_qcaps()
1208 if (BNXT_PF(softc) && in bnxt_hwrm_func_qcaps()
1210 softc->fw_cap |= BNXT_FW_CAP_VF_CFG_FOR_PF; in bnxt_hwrm_func_qcaps()
1214 softc->fw_cap |= BNXT_FW_CAP_RX_ALL_PKT_TS; in bnxt_hwrm_func_qcaps()
1216 softc->fw_cap |= BNXT_FW_CAP_DBR_SUPPORTED; in bnxt_hwrm_func_qcaps()
1219 softc->fw_cap |= BNXT_FW_CAP_DBR_PACING_SUPPORTED; in bnxt_hwrm_func_qcaps()
1222 softc->fw_cap |= BNXT_FW_CAP_GENERIC_STATS; in bnxt_hwrm_func_qcaps()
1235 if (BNXT_PF(softc)) { in bnxt_hwrm_func_qcaps()
1236 struct bnxt_pf_info *pf = &softc->pf; in bnxt_hwrm_func_qcaps()
1249 …device_printf(softc->dev, "Invalid ethernet address, generating random locally administered addres… in bnxt_hwrm_func_qcaps()
1254 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_func_qcaps()
1259 bnxt_hwrm_func_qcfg(struct bnxt_softc *softc) in bnxt_hwrm_func_qcfg() argument
1263 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_func_qcfg()
1264 struct bnxt_func_qcfg *fn_qcfg = &softc->fn_qcfg; in bnxt_hwrm_func_qcfg()
1269 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_QCFG); in bnxt_hwrm_func_qcfg()
1271 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_func_qcfg()
1272 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_func_qcfg()
1286 softc->port_partition_type = resp->port_partition_type; in bnxt_hwrm_func_qcfg()
1293 softc->fw_cap |= BNXT_FW_CAP_LLDP_AGENT; in bnxt_hwrm_func_qcfg()
1295 softc->fw_cap |= BNXT_FW_CAP_DCBX_AGENT; in bnxt_hwrm_func_qcfg()
1297 if (BNXT_PF(softc) && (flags & HWRM_FUNC_QCFG_OUTPUT_FLAGS_MULTI_HOST)) in bnxt_hwrm_func_qcfg()
1298 softc->flags |= BNXT_FLAG_MULTI_HOST; in bnxt_hwrm_func_qcfg()
1299 if (BNXT_PF(softc) && (flags & HWRM_FUNC_QCFG_OUTPUT_FLAGS_MULTI_ROOT)) in bnxt_hwrm_func_qcfg()
1300 softc->flags |= BNXT_FLAG_MULTI_ROOT; in bnxt_hwrm_func_qcfg()
1302 softc->fw_cap |= BNXT_FW_CAP_SECURE_MODE; in bnxt_hwrm_func_qcfg()
1304 softc->fw_cap |= BNXT_FW_CAP_RING_MONITOR; in bnxt_hwrm_func_qcfg()
1306 softc->fw_cap |= BNXT_FW_CAP_ENABLE_RDMA_SRIOV; in bnxt_hwrm_func_qcfg()
1308 if (softc->db_size) in bnxt_hwrm_func_qcfg()
1311 softc->legacy_db_size = le16_to_cpu(resp->legacy_l2_db_size_kb) * 1024; in bnxt_hwrm_func_qcfg()
1313 if (BNXT_CHIP_P5(softc)) { in bnxt_hwrm_func_qcfg()
1314 if (BNXT_PF(softc)) in bnxt_hwrm_func_qcfg()
1318 softc->legacy_db_size = min_db_offset; in bnxt_hwrm_func_qcfg()
1321 softc->db_size = roundup2(le16_to_cpu(resp->l2_doorbell_bar_size_kb) * in bnxt_hwrm_func_qcfg()
1323 if (!softc->db_size || softc->db_size > pci_resource_len(softc->pdev, 2) || in bnxt_hwrm_func_qcfg()
1324 softc->db_size <= min_db_offset) in bnxt_hwrm_func_qcfg()
1325 softc->db_size = pci_resource_len(softc->pdev, 2); in bnxt_hwrm_func_qcfg()
1328 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_func_qcfg()
1333 bnxt_hwrm_func_reset(struct bnxt_softc *softc) in bnxt_hwrm_func_reset() argument
1337 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_RESET); in bnxt_hwrm_func_reset()
1340 return hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_func_reset()
1344 bnxt_hwrm_set_link_common(struct bnxt_softc *softc, in bnxt_hwrm_set_link_common() argument
1347 struct bnxt_link_info *link_info = &softc->link_info; in bnxt_hwrm_set_link_common()
1348 uint8_t autoneg = softc->link_info.autoneg; in bnxt_hwrm_set_link_common()
1349 uint16_t fw_link_speed = softc->link_info.req_link_speed; in bnxt_hwrm_set_link_common()
1352 uint8_t phy_type = get_phy_type(softc); in bnxt_hwrm_set_link_common()
1397 bnxt_hwrm_set_pause_common(struct bnxt_softc *softc, in bnxt_hwrm_set_pause_common() argument
1400 struct bnxt_link_info *link_info = &softc->link_info; in bnxt_hwrm_set_pause_common()
1430 bnxt_hwrm_set_eee(struct bnxt_softc *softc, struct hwrm_port_phy_cfg_input *req) in bnxt_hwrm_set_eee() argument
1455 bnxt_hwrm_set_link_setting(struct bnxt_softc *softc, bool set_pause, in bnxt_hwrm_set_link_setting() argument
1461 if (softc->flags & BNXT_FLAG_NPAR) in bnxt_hwrm_set_link_setting()
1464 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_PORT_PHY_CFG); in bnxt_hwrm_set_link_setting()
1467 bnxt_hwrm_set_pause_common(softc, &req); in bnxt_hwrm_set_link_setting()
1469 if (softc->link_info.flow_ctrl.autoneg) in bnxt_hwrm_set_link_setting()
1474 bnxt_hwrm_set_link_common(softc, &req); in bnxt_hwrm_set_link_setting()
1477 bnxt_hwrm_set_eee(softc, &req); in bnxt_hwrm_set_link_setting()
1479 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_set_link_setting()
1480 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_set_link_setting()
1488 if (!softc->link_info.flow_ctrl.autoneg) in bnxt_hwrm_set_link_setting()
1489 bnxt_report_link(softc); in bnxt_hwrm_set_link_setting()
1492 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_set_link_setting()
1497 bnxt_hwrm_vnic_set_hds(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic) in bnxt_hwrm_vnic_set_hds() argument
1501 if (!BNXT_CHIP_P5_PLUS(softc)) in bnxt_hwrm_vnic_set_hds()
1504 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_PLCMODES_CFG); in bnxt_hwrm_vnic_set_hds()
1509 return hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_vnic_set_hds()
1513 bnxt_hwrm_vnic_cfg(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic) in bnxt_hwrm_vnic_cfg() argument
1517 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_CFG); in bnxt_hwrm_vnic_cfg()
1525 if (BNXT_CHIP_P5_PLUS (softc)) { in bnxt_hwrm_vnic_cfg()
1527 htole16(softc->rx_rings[0].phys_id); in bnxt_hwrm_vnic_cfg()
1529 htole16(softc->rx_cp_rings[0].ring.phys_id); in bnxt_hwrm_vnic_cfg()
1546 return hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_vnic_cfg()
1550 bnxt_hwrm_vnic_free(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic) in bnxt_hwrm_vnic_free() argument
1558 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_FREE); in bnxt_hwrm_vnic_free()
1562 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_vnic_free()
1563 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_vnic_free()
1568 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_vnic_free()
1573 bnxt_hwrm_vnic_alloc(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic) in bnxt_hwrm_vnic_alloc() argument
1577 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_vnic_alloc()
1581 device_printf(softc->dev, in bnxt_hwrm_vnic_alloc()
1586 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_ALLOC); in bnxt_hwrm_vnic_alloc()
1591 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_vnic_alloc()
1592 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_vnic_alloc()
1599 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_vnic_alloc()
1604 bnxt_hwrm_vnic_ctx_free(struct bnxt_softc *softc, uint16_t ctx_id) in bnxt_hwrm_vnic_ctx_free() argument
1612 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_RSS_COS_LB_CTX_FREE); in bnxt_hwrm_vnic_ctx_free()
1614 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_vnic_ctx_free()
1615 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_vnic_ctx_free()
1620 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_vnic_ctx_free()
1625 bnxt_hwrm_vnic_ctx_alloc(struct bnxt_softc *softc, uint16_t *ctx_id) in bnxt_hwrm_vnic_ctx_alloc() argument
1629 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_vnic_ctx_alloc()
1633 device_printf(softc->dev, in bnxt_hwrm_vnic_ctx_alloc()
1638 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_RSS_COS_LB_CTX_ALLOC); in bnxt_hwrm_vnic_ctx_alloc()
1640 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_vnic_ctx_alloc()
1641 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_vnic_ctx_alloc()
1648 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_vnic_ctx_alloc()
1653 bnxt_hwrm_ring_grp_alloc(struct bnxt_softc *softc, struct bnxt_grp_info *grp) in bnxt_hwrm_ring_grp_alloc() argument
1660 device_printf(softc->dev, in bnxt_hwrm_ring_grp_alloc()
1665 if (BNXT_CHIP_P5_PLUS (softc)) in bnxt_hwrm_ring_grp_alloc()
1668 resp = (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_ring_grp_alloc()
1669 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_RING_GRP_ALLOC); in bnxt_hwrm_ring_grp_alloc()
1675 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_ring_grp_alloc()
1676 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_ring_grp_alloc()
1683 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_ring_grp_alloc()
1688 bnxt_hwrm_ring_grp_free(struct bnxt_softc *softc, struct bnxt_grp_info *grp) in bnxt_hwrm_ring_grp_free() argument
1696 if (BNXT_CHIP_P5_PLUS (softc)) in bnxt_hwrm_ring_grp_free()
1699 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_RING_GRP_FREE); in bnxt_hwrm_ring_grp_free()
1703 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_ring_grp_free()
1704 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_ring_grp_free()
1709 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_ring_grp_free()
1713 int bnxt_hwrm_ring_free(struct bnxt_softc *softc, uint32_t ring_type, in bnxt_hwrm_ring_free() argument
1724 resp = (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_ring_free()
1725 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_RING_FREE); in bnxt_hwrm_ring_free()
1730 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_ring_free()
1731 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_ring_free()
1735 device_printf(softc->dev, "hwrm_ring_free type %d failed. " in bnxt_hwrm_ring_free()
1741 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_ring_free()
1749 bnxt_hwrm_ring_alloc(struct bnxt_softc *softc, uint8_t type, in bnxt_hwrm_ring_alloc() argument
1759 device_printf(softc->dev, in bnxt_hwrm_ring_alloc()
1764 resp = (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_ring_alloc()
1765 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_RING_ALLOC); in bnxt_hwrm_ring_alloc()
1775 cp_ring = &softc->tx_cp_rings[idx]; in bnxt_hwrm_ring_alloc()
1779 req.queue_id = htole16(softc->tx_q_info[0].queue_id); in bnxt_hwrm_ring_alloc()
1786 if (!BNXT_CHIP_P5_PLUS(softc)) in bnxt_hwrm_ring_alloc()
1789 cp_ring = &softc->rx_cp_rings[idx]; in bnxt_hwrm_ring_alloc()
1792 req.rx_buf_size = htole16(softc->rx_buf_size); in bnxt_hwrm_ring_alloc()
1798 if (!BNXT_CHIP_P5_PLUS(softc)) { in bnxt_hwrm_ring_alloc()
1803 cp_ring = &softc->rx_cp_rings[idx]; in bnxt_hwrm_ring_alloc()
1805 req.rx_ring_id = htole16(softc->rx_rings[idx].phys_id); in bnxt_hwrm_ring_alloc()
1807 req.rx_buf_size = htole16(softc->rx_buf_size); in bnxt_hwrm_ring_alloc()
1814 if (!BNXT_CHIP_P5_PLUS(softc)) { in bnxt_hwrm_ring_alloc()
1820 req.nq_ring_id = htole16(softc->nq_rings[idx].ring.phys_id); in bnxt_hwrm_ring_alloc()
1828 device_printf(softc->dev, in bnxt_hwrm_ring_alloc()
1833 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_ring_alloc()
1834 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_ring_alloc()
1841 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_ring_alloc()
1846 bnxt_hwrm_stat_ctx_free(struct bnxt_softc *softc, struct bnxt_cp_ring *cpr) in bnxt_hwrm_stat_ctx_free() argument
1854 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_STAT_CTX_FREE); in bnxt_hwrm_stat_ctx_free()
1857 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_stat_ctx_free()
1858 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_stat_ctx_free()
1863 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_stat_ctx_free()
1869 bnxt_hwrm_stat_ctx_alloc(struct bnxt_softc *softc, struct bnxt_cp_ring *cpr, in bnxt_hwrm_stat_ctx_alloc() argument
1877 device_printf(softc->dev, in bnxt_hwrm_stat_ctx_alloc()
1883 resp = (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_stat_ctx_alloc()
1884 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_STAT_CTX_ALLOC); in bnxt_hwrm_stat_ctx_alloc()
1889 if (BNXT_CHIP_P7(softc)) in bnxt_hwrm_stat_ctx_alloc()
1891 else if (BNXT_CHIP_P5(softc)) in bnxt_hwrm_stat_ctx_alloc()
1896 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_stat_ctx_alloc()
1897 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_stat_ctx_alloc()
1904 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_stat_ctx_alloc()
1910 bnxt_hwrm_port_qstats(struct bnxt_softc *softc) in bnxt_hwrm_port_qstats() argument
1915 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_PORT_QSTATS); in bnxt_hwrm_port_qstats()
1917 req.port_id = htole16(softc->pf.port_id); in bnxt_hwrm_port_qstats()
1918 req.rx_stat_host_addr = htole64(softc->hw_rx_port_stats.idi_paddr); in bnxt_hwrm_port_qstats()
1919 req.tx_stat_host_addr = htole64(softc->hw_tx_port_stats.idi_paddr); in bnxt_hwrm_port_qstats()
1921 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_port_qstats()
1922 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_port_qstats()
1923 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_port_qstats()
1927 static int bnxt_hwrm_pri2cos_idx(struct bnxt_softc *softc, uint32_t path_dir) in bnxt_hwrm_pri2cos_idx() argument
1935 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_QUEUE_PRI2COS_QCFG); in bnxt_hwrm_pri2cos_idx()
1936 resp = (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_pri2cos_idx()
1940 rc = hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_pri2cos_idx()
1946 pri2cos_idx = softc->tx_pri2cos_idx; in bnxt_hwrm_pri2cos_idx()
1947 q_ids = softc->tx_q_ids; in bnxt_hwrm_pri2cos_idx()
1948 max_q = softc->tx_max_q; in bnxt_hwrm_pri2cos_idx()
1950 pri2cos_idx = softc->rx_pri2cos_idx; in bnxt_hwrm_pri2cos_idx()
1951 q_ids = softc->rx_q_ids; in bnxt_hwrm_pri2cos_idx()
1952 max_q = softc->rx_max_q; in bnxt_hwrm_pri2cos_idx()
1964 softc->pri2cos_valid = false; in bnxt_hwrm_pri2cos_idx()
1975 softc->pri2cos_valid = true; in bnxt_hwrm_pri2cos_idx()
1981 bnxt_hwrm_port_qstats_ext(struct bnxt_softc *softc) in bnxt_hwrm_port_qstats_ext() argument
1988 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_PORT_QSTATS_EXT); in bnxt_hwrm_port_qstats_ext()
1989 resp = (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_port_qstats_ext()
1992 req.port_id = htole16(softc->pf.port_id); in bnxt_hwrm_port_qstats_ext()
1995 req.rx_stat_host_addr = htole64(softc->hw_rx_port_stats_ext.idi_paddr); in bnxt_hwrm_port_qstats_ext()
1996 req.tx_stat_host_addr = htole64(softc->hw_tx_port_stats_ext.idi_paddr); in bnxt_hwrm_port_qstats_ext()
1998 rc = hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_port_qstats_ext()
2001 softc->fw_rx_stats_ext_size = in bnxt_hwrm_port_qstats_ext()
2003 if (BNXT_FW_MAJ(softc) < 220 && !BNXT_CHIP_P7(softc) && in bnxt_hwrm_port_qstats_ext()
2004 softc->fw_rx_stats_ext_size > BNXT_RX_STATS_EXT_NUM_LEGACY) in bnxt_hwrm_port_qstats_ext()
2005 softc->fw_rx_stats_ext_size = BNXT_RX_STATS_EXT_NUM_LEGACY; in bnxt_hwrm_port_qstats_ext()
2007 softc->fw_tx_stats_ext_size = tx_stat_size ? in bnxt_hwrm_port_qstats_ext()
2010 softc->fw_rx_stats_ext_size = 0; in bnxt_hwrm_port_qstats_ext()
2011 softc->fw_tx_stats_ext_size = 0; in bnxt_hwrm_port_qstats_ext()
2014 if (softc->fw_tx_stats_ext_size <= in bnxt_hwrm_port_qstats_ext()
2016 softc->pri2cos_valid = false; in bnxt_hwrm_port_qstats_ext()
2020 rc = bnxt_hwrm_pri2cos_idx(softc, HWRM_QUEUE_PRI2COS_QCFG_INPUT_FLAGS_PATH_TX); in bnxt_hwrm_port_qstats_ext()
2024 if (softc->is_asym_q) { in bnxt_hwrm_port_qstats_ext()
2025 rc = bnxt_hwrm_pri2cos_idx(softc, HWRM_QUEUE_PRI2COS_QCFG_INPUT_FLAGS_PATH_RX); in bnxt_hwrm_port_qstats_ext()
2029 memcpy(softc->rx_pri2cos_idx, softc->tx_pri2cos_idx, sizeof(softc->rx_pri2cos_idx)); in bnxt_hwrm_port_qstats_ext()
2032 u64 *rx_port_stats_ext = (u64 *)softc->hw_rx_port_stats_ext.idi_vaddr; in bnxt_hwrm_port_qstats_ext()
2033 u64 *tx_port_stats_ext = (u64 *)softc->hw_tx_port_stats_ext.idi_vaddr; in bnxt_hwrm_port_qstats_ext()
2035 if (softc->pri2cos_valid) { in bnxt_hwrm_port_qstats_ext()
2038 softc->rx_pri2cos_idx[i]; in bnxt_hwrm_port_qstats_ext()
2040 softc->rx_bytes_pri[i] = *(rx_port_stats_ext + n); in bnxt_hwrm_port_qstats_ext()
2044 softc->rx_pri2cos_idx[i]; in bnxt_hwrm_port_qstats_ext()
2046 softc->rx_packets_pri[i] = *(rx_port_stats_ext + n); in bnxt_hwrm_port_qstats_ext()
2050 softc->tx_pri2cos_idx[i]; in bnxt_hwrm_port_qstats_ext()
2052 softc->tx_bytes_pri[i] = *(tx_port_stats_ext + n); in bnxt_hwrm_port_qstats_ext()
2056 softc->tx_pri2cos_idx[i]; in bnxt_hwrm_port_qstats_ext()
2058 softc->tx_packets_pri[i] = *(tx_port_stats_ext + n); in bnxt_hwrm_port_qstats_ext()
2066 bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt_softc *softc, in bnxt_hwrm_cfa_l2_set_rx_mask() argument
2072 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_CFA_L2_SET_RX_MASK); in bnxt_hwrm_cfa_l2_set_rx_mask()
2078 return hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_cfa_l2_set_rx_mask()
2082 bnxt_hwrm_l2_filter_free(struct bnxt_softc *softc, uint64_t filter_id) in bnxt_hwrm_l2_filter_free() argument
2090 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_CFA_L2_FILTER_FREE); in bnxt_hwrm_l2_filter_free()
2094 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_l2_filter_free()
2095 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_l2_filter_free()
2100 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_l2_filter_free()
2105 bnxt_hwrm_free_filter(struct bnxt_softc *softc) in bnxt_hwrm_free_filter() argument
2107 struct bnxt_vnic_info *vnic = &softc->vnic_info; in bnxt_hwrm_free_filter()
2111 rc = bnxt_hwrm_l2_filter_free(softc, softc->vnic_info.filter_id); in bnxt_hwrm_free_filter()
2116 rc = bnxt_hwrm_l2_filter_free(softc, tag->filter_id); in bnxt_hwrm_free_filter()
2127 bnxt_hwrm_l2_filter_alloc(struct bnxt_softc *softc, uint16_t vlan_tag, in bnxt_hwrm_l2_filter_alloc() argument
2132 struct bnxt_vnic_info *vnic = &softc->vnic_info; in bnxt_hwrm_l2_filter_alloc()
2137 device_printf(softc->dev, "Attempt to re-allocate l2 ctx " in bnxt_hwrm_l2_filter_alloc()
2142 resp = (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_l2_filter_alloc()
2143 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_CFA_L2_FILTER_ALLOC); in bnxt_hwrm_l2_filter_alloc()
2162 memcpy(req.l2_addr, if_getlladdr(iflib_get_ifp(softc->ctx)), in bnxt_hwrm_l2_filter_alloc()
2166 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_l2_filter_alloc()
2167 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_l2_filter_alloc()
2173 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_l2_filter_alloc()
2178 bnxt_hwrm_set_filter(struct bnxt_softc *softc) in bnxt_hwrm_set_filter() argument
2180 struct bnxt_vnic_info *vnic = &softc->vnic_info; in bnxt_hwrm_set_filter()
2184 rc = bnxt_hwrm_l2_filter_alloc(softc, 0xffff, &vnic->filter_id); in bnxt_hwrm_set_filter()
2189 rc = bnxt_hwrm_l2_filter_alloc(softc, tag->tag, in bnxt_hwrm_set_filter()
2200 bnxt_hwrm_rss_cfg(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic, in bnxt_hwrm_rss_cfg() argument
2205 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_RSS_CFG); in bnxt_hwrm_rss_cfg()
2207 if (BNXT_CHIP_P7(softc)) in bnxt_hwrm_rss_cfg()
2215 if (BNXT_CHIP_P5_PLUS(softc)) { in bnxt_hwrm_rss_cfg()
2220 return hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_rss_cfg()
2224 bnxt_hwrm_reserve_pf_rings(struct bnxt_softc *softc) in bnxt_hwrm_reserve_pf_rings() argument
2228 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_CFG); in bnxt_hwrm_reserve_pf_rings()
2246 return hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_reserve_pf_rings()
2250 bnxt_cfg_async_cr(struct bnxt_softc *softc) in bnxt_cfg_async_cr() argument
2255 if (!BNXT_PF(softc)) in bnxt_cfg_async_cr()
2258 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_CFG); in bnxt_cfg_async_cr()
2262 if (BNXT_CHIP_P5_PLUS(softc)) in bnxt_cfg_async_cr()
2263 req.async_event_cr = htole16(softc->nq_rings[0].ring.phys_id); in bnxt_cfg_async_cr()
2265 req.async_event_cr = htole16(softc->def_cp_ring.ring.phys_id); in bnxt_cfg_async_cr()
2267 rc = hwrm_send_message(softc, &req, sizeof(req)); in bnxt_cfg_async_cr()
2273 bnxt_validate_hw_lro_settings(struct bnxt_softc *softc) in bnxt_validate_hw_lro_settings() argument
2275 softc->hw_lro.enable = min(softc->hw_lro.enable, 1); in bnxt_validate_hw_lro_settings()
2277 softc->hw_lro.is_mode_gro = min(softc->hw_lro.is_mode_gro, 1); in bnxt_validate_hw_lro_settings()
2279 softc->hw_lro.max_agg_segs = min(softc->hw_lro.max_agg_segs, in bnxt_validate_hw_lro_settings()
2282 softc->hw_lro.max_aggs = min(softc->hw_lro.max_aggs, in bnxt_validate_hw_lro_settings()
2285 softc->hw_lro.min_agg_len = min(softc->hw_lro.min_agg_len, BNXT_MAX_MTU); in bnxt_validate_hw_lro_settings()
2289 bnxt_hwrm_vnic_tpa_cfg(struct bnxt_softc *softc) in bnxt_hwrm_vnic_tpa_cfg() argument
2294 if (softc->vnic_info.id == (uint16_t) HWRM_NA_SIGNATURE) { in bnxt_hwrm_vnic_tpa_cfg()
2298 if (!(softc->flags & BNXT_FLAG_TPA)) in bnxt_hwrm_vnic_tpa_cfg()
2301 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_TPA_CFG); in bnxt_hwrm_vnic_tpa_cfg()
2303 if (softc->hw_lro.enable) { in bnxt_hwrm_vnic_tpa_cfg()
2309 if (softc->hw_lro.is_mode_gro) in bnxt_hwrm_vnic_tpa_cfg()
2320 req.max_agg_segs = htole16(softc->hw_lro.max_agg_segs); in bnxt_hwrm_vnic_tpa_cfg()
2321 req.max_aggs = htole16(softc->hw_lro.max_aggs); in bnxt_hwrm_vnic_tpa_cfg()
2322 req.min_agg_len = htole32(softc->hw_lro.min_agg_len); in bnxt_hwrm_vnic_tpa_cfg()
2325 req.vnic_id = htole16(softc->vnic_info.id); in bnxt_hwrm_vnic_tpa_cfg()
2327 return hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_vnic_tpa_cfg()
2331 bnxt_hwrm_nvm_find_dir_entry(struct bnxt_softc *softc, uint16_t type, in bnxt_hwrm_nvm_find_dir_entry() argument
2338 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_nvm_find_dir_entry()
2344 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_NVM_FIND_DIR_ENTRY); in bnxt_hwrm_nvm_find_dir_entry()
2355 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_nvm_find_dir_entry()
2356 old_timeo = softc->hwrm_cmd_timeo; in bnxt_hwrm_nvm_find_dir_entry()
2357 softc->hwrm_cmd_timeo = BNXT_NVM_TIMEO; in bnxt_hwrm_nvm_find_dir_entry()
2358 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_nvm_find_dir_entry()
2359 softc->hwrm_cmd_timeo = old_timeo; in bnxt_hwrm_nvm_find_dir_entry()
2374 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_nvm_find_dir_entry()
2379 bnxt_hwrm_nvm_read(struct bnxt_softc *softc, uint16_t index, uint32_t offset, in bnxt_hwrm_nvm_read() argument
2390 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_NVM_READ); in bnxt_hwrm_nvm_read()
2395 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_nvm_read()
2396 old_timeo = softc->hwrm_cmd_timeo; in bnxt_hwrm_nvm_read()
2397 softc->hwrm_cmd_timeo = BNXT_NVM_TIMEO; in bnxt_hwrm_nvm_read()
2398 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_nvm_read()
2399 softc->hwrm_cmd_timeo = old_timeo; in bnxt_hwrm_nvm_read()
2400 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_nvm_read()
2412 bnxt_hwrm_nvm_modify(struct bnxt_softc *softc, uint16_t index, uint32_t offset, in bnxt_hwrm_nvm_modify() argument
2422 rc = iflib_dma_alloc(softc->ctx, length, &dma_data, in bnxt_hwrm_nvm_modify()
2436 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_NVM_MODIFY); in bnxt_hwrm_nvm_modify()
2441 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_nvm_modify()
2442 old_timeo = softc->hwrm_cmd_timeo; in bnxt_hwrm_nvm_modify()
2443 softc->hwrm_cmd_timeo = BNXT_NVM_TIMEO; in bnxt_hwrm_nvm_modify()
2444 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_nvm_modify()
2445 softc->hwrm_cmd_timeo = old_timeo; in bnxt_hwrm_nvm_modify()
2446 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_nvm_modify()
2454 bnxt_hwrm_fw_reset(struct bnxt_softc *softc, uint8_t processor, in bnxt_hwrm_fw_reset() argument
2459 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_fw_reset()
2464 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FW_RESET); in bnxt_hwrm_fw_reset()
2468 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_fw_reset()
2469 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_fw_reset()
2475 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_fw_reset()
2480 bnxt_hwrm_fw_qstatus(struct bnxt_softc *softc, uint8_t type, uint8_t *selfreset) in bnxt_hwrm_fw_qstatus() argument
2484 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_fw_qstatus()
2489 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FW_QSTATUS); in bnxt_hwrm_fw_qstatus()
2492 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_fw_qstatus()
2493 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_fw_qstatus()
2499 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_fw_qstatus()
2504 bnxt_hwrm_nvm_write(struct bnxt_softc *softc, void *data, bool cpyin, in bnxt_hwrm_nvm_write() argument
2511 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_nvm_write()
2517 rc = iflib_dma_alloc(softc->ctx, data_length, &dma_data, in bnxt_hwrm_nvm_write()
2534 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_NVM_WRITE); in bnxt_hwrm_nvm_write()
2550 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_nvm_write()
2551 old_timeo = softc->hwrm_cmd_timeo; in bnxt_hwrm_nvm_write()
2552 softc->hwrm_cmd_timeo = BNXT_NVM_TIMEO; in bnxt_hwrm_nvm_write()
2553 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_nvm_write()
2554 softc->hwrm_cmd_timeo = old_timeo; in bnxt_hwrm_nvm_write()
2563 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_nvm_write()
2571 bnxt_hwrm_nvm_erase_dir_entry(struct bnxt_softc *softc, uint16_t index) in bnxt_hwrm_nvm_erase_dir_entry() argument
2577 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_NVM_ERASE_DIR_ENTRY); in bnxt_hwrm_nvm_erase_dir_entry()
2579 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_nvm_erase_dir_entry()
2580 old_timeo = softc->hwrm_cmd_timeo; in bnxt_hwrm_nvm_erase_dir_entry()
2581 softc->hwrm_cmd_timeo = BNXT_NVM_TIMEO; in bnxt_hwrm_nvm_erase_dir_entry()
2582 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_nvm_erase_dir_entry()
2583 softc->hwrm_cmd_timeo = old_timeo; in bnxt_hwrm_nvm_erase_dir_entry()
2584 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_nvm_erase_dir_entry()
2589 bnxt_hwrm_nvm_get_dir_info(struct bnxt_softc *softc, uint32_t *entries, in bnxt_hwrm_nvm_get_dir_info() argument
2594 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_nvm_get_dir_info()
2598 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_NVM_GET_DIR_INFO); in bnxt_hwrm_nvm_get_dir_info()
2600 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_nvm_get_dir_info()
2601 old_timeo = softc->hwrm_cmd_timeo; in bnxt_hwrm_nvm_get_dir_info()
2602 softc->hwrm_cmd_timeo = BNXT_NVM_TIMEO; in bnxt_hwrm_nvm_get_dir_info()
2603 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_nvm_get_dir_info()
2604 softc->hwrm_cmd_timeo = old_timeo; in bnxt_hwrm_nvm_get_dir_info()
2614 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_nvm_get_dir_info()
2619 bnxt_hwrm_nvm_get_dir_entries(struct bnxt_softc *softc, uint32_t *entries, in bnxt_hwrm_nvm_get_dir_entries() argument
2633 rc = bnxt_hwrm_nvm_get_dir_info(softc, entries, entry_length); in bnxt_hwrm_nvm_get_dir_entries()
2646 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_NVM_GET_DIR_ENTRIES); in bnxt_hwrm_nvm_get_dir_entries()
2648 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_nvm_get_dir_entries()
2649 old_timeo = softc->hwrm_cmd_timeo; in bnxt_hwrm_nvm_get_dir_entries()
2650 softc->hwrm_cmd_timeo = BNXT_NVM_TIMEO; in bnxt_hwrm_nvm_get_dir_entries()
2651 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_nvm_get_dir_entries()
2652 softc->hwrm_cmd_timeo = old_timeo; in bnxt_hwrm_nvm_get_dir_entries()
2653 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_nvm_get_dir_entries()
2664 bnxt_hwrm_nvm_get_dev_info(struct bnxt_softc *softc, uint16_t *mfg_id, in bnxt_hwrm_nvm_get_dev_info() argument
2670 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_nvm_get_dev_info()
2674 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_NVM_GET_DEV_INFO); in bnxt_hwrm_nvm_get_dev_info()
2676 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_nvm_get_dev_info()
2677 old_timeo = softc->hwrm_cmd_timeo; in bnxt_hwrm_nvm_get_dev_info()
2678 softc->hwrm_cmd_timeo = BNXT_NVM_TIMEO; in bnxt_hwrm_nvm_get_dev_info()
2679 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_nvm_get_dev_info()
2680 softc->hwrm_cmd_timeo = old_timeo; in bnxt_hwrm_nvm_get_dev_info()
2698 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_nvm_get_dev_info()
2703 bnxt_hwrm_nvm_install_update(struct bnxt_softc *softc, in bnxt_hwrm_nvm_install_update() argument
2709 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_nvm_install_update()
2713 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_NVM_INSTALL_UPDATE); in bnxt_hwrm_nvm_install_update()
2716 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_nvm_install_update()
2717 old_timeo = softc->hwrm_cmd_timeo; in bnxt_hwrm_nvm_install_update()
2718 softc->hwrm_cmd_timeo = BNXT_NVM_TIMEO; in bnxt_hwrm_nvm_install_update()
2719 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_nvm_install_update()
2720 softc->hwrm_cmd_timeo = old_timeo; in bnxt_hwrm_nvm_install_update()
2734 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_nvm_install_update()
2739 bnxt_hwrm_nvm_verify_update(struct bnxt_softc *softc, uint16_t type, in bnxt_hwrm_nvm_verify_update() argument
2746 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_NVM_VERIFY_UPDATE); in bnxt_hwrm_nvm_verify_update()
2752 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_nvm_verify_update()
2753 old_timeo = softc->hwrm_cmd_timeo; in bnxt_hwrm_nvm_verify_update()
2754 softc->hwrm_cmd_timeo = BNXT_NVM_TIMEO; in bnxt_hwrm_nvm_verify_update()
2755 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_nvm_verify_update()
2756 softc->hwrm_cmd_timeo = old_timeo; in bnxt_hwrm_nvm_verify_update()
2757 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_nvm_verify_update()
2762 bnxt_hwrm_fw_get_time(struct bnxt_softc *softc, uint16_t *year, uint8_t *month, in bnxt_hwrm_fw_get_time() argument
2768 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_fw_get_time()
2771 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FW_GET_TIME); in bnxt_hwrm_fw_get_time()
2773 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_fw_get_time()
2774 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_fw_get_time()
2796 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_fw_get_time()
2801 bnxt_hwrm_fw_set_time(struct bnxt_softc *softc, uint16_t year, uint8_t month, in bnxt_hwrm_fw_set_time() argument
2807 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FW_SET_TIME); in bnxt_hwrm_fw_set_time()
2817 return hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_fw_set_time()
2820 int bnxt_read_sfp_module_eeprom_info(struct bnxt_softc *softc, uint16_t i2c_addr, in bnxt_read_sfp_module_eeprom_info() argument
2825 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_read_sfp_module_eeprom_info()
2829 BNXT_HWRM_LOCK(softc); in bnxt_read_sfp_module_eeprom_info()
2830 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_PORT_PHY_I2C_READ); in bnxt_read_sfp_module_eeprom_info()
2834 req.port_id = htole16(softc->pf.port_id); in bnxt_read_sfp_module_eeprom_info()
2847 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_read_sfp_module_eeprom_info()
2853 BNXT_HWRM_UNLOCK(softc); in bnxt_read_sfp_module_eeprom_info()
2859 bnxt_hwrm_port_phy_qcfg(struct bnxt_softc *softc) in bnxt_hwrm_port_phy_qcfg() argument
2861 struct bnxt_link_info *link_info = &softc->link_info; in bnxt_hwrm_port_phy_qcfg()
2864 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_port_phy_qcfg()
2867 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_PORT_PHY_QCFG); in bnxt_hwrm_port_phy_qcfg()
2869 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_port_phy_qcfg()
2870 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_port_phy_qcfg()
2927 snprintf(softc->ver_info->phy_ver, sizeof(softc->ver_info->phy_ver), in bnxt_hwrm_port_phy_qcfg()
2930 strlcpy(softc->ver_info->phy_vendor, resp->phy_vendor_name, in bnxt_hwrm_port_phy_qcfg()
2932 strlcpy(softc->ver_info->phy_partnumber, resp->phy_vendor_partnumber, in bnxt_hwrm_port_phy_qcfg()
2944 if (softc->hwrm_spec_code >= 0x10504) in bnxt_hwrm_port_phy_qcfg()
2952 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_port_phy_qcfg()
2970 int bnxt_hwrm_phy_qcaps(struct bnxt_softc *softc) in bnxt_hwrm_phy_qcaps() argument
2972 struct bnxt_link_info *link_info = &softc->link_info; in bnxt_hwrm_phy_qcaps()
2974 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_phy_qcaps()
2978 if (softc->hwrm_spec_code < 0x10201) in bnxt_hwrm_phy_qcaps()
2981 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_PORT_PHY_QCAPS); in bnxt_hwrm_phy_qcaps()
2983 BNXT_HWRM_LOCK(softc); in bnxt_hwrm_phy_qcaps()
2984 rc = _hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_phy_qcaps()
2988 softc->phy_flags = resp->flags | (resp->flags2 << 8); in bnxt_hwrm_phy_qcaps()
2991 softc->lpi_tmr_lo = le32toh(resp->tx_lpi_timer_low) & in bnxt_hwrm_phy_qcaps()
2993 softc->lpi_tmr_hi = le32toh(resp->valid_tx_lpi_timer_high) & in bnxt_hwrm_phy_qcaps()
2997 if (softc->hwrm_spec_code >= 0x10a01) { in bnxt_hwrm_phy_qcaps()
3000 device_printf(softc->dev, "Ethernet link disabled\n"); in bnxt_hwrm_phy_qcaps()
3003 device_printf(softc->dev, "Ethernet link enabled\n"); in bnxt_hwrm_phy_qcaps()
3032 BNXT_HWRM_UNLOCK(softc); in bnxt_hwrm_phy_qcaps()
3037 bnxt_hwrm_get_wol_fltrs(struct bnxt_softc *softc, uint16_t handle) in bnxt_hwrm_get_wol_fltrs() argument
3041 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_get_wol_fltrs()
3045 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_WOL_FILTER_QCFG); in bnxt_hwrm_get_wol_fltrs()
3046 req.port_id = htole16(softc->pf.port_id); in bnxt_hwrm_get_wol_fltrs()
3048 rc = hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_get_wol_fltrs()
3054 softc->wol = 1; in bnxt_hwrm_get_wol_fltrs()
3055 softc->wol_filter_id = resp->wol_filter_id; in bnxt_hwrm_get_wol_fltrs()
3063 bnxt_hwrm_alloc_wol_fltr(struct bnxt_softc *softc) in bnxt_hwrm_alloc_wol_fltr() argument
3067 (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_alloc_wol_fltr()
3070 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_WOL_FILTER_ALLOC); in bnxt_hwrm_alloc_wol_fltr()
3071 req.port_id = htole16(softc->pf.port_id); in bnxt_hwrm_alloc_wol_fltr()
3075 memcpy(req.mac_address, softc->func.mac_addr, ETHER_ADDR_LEN); in bnxt_hwrm_alloc_wol_fltr()
3076 rc = hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_alloc_wol_fltr()
3078 softc->wol_filter_id = resp->wol_filter_id; in bnxt_hwrm_alloc_wol_fltr()
3084 bnxt_hwrm_free_wol_fltr(struct bnxt_softc *softc) in bnxt_hwrm_free_wol_fltr() argument
3088 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_WOL_FILTER_FREE); in bnxt_hwrm_free_wol_fltr()
3089 req.port_id = htole16(softc->pf.port_id); in bnxt_hwrm_free_wol_fltr()
3092 req.wol_filter_id = softc->wol_filter_id; in bnxt_hwrm_free_wol_fltr()
3093 return hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_free_wol_fltr()
3096 static void bnxt_hwrm_set_coal_params(struct bnxt_softc *softc, uint32_t max_frames, in bnxt_hwrm_set_coal_params() argument
3111 int bnxt_hwrm_set_coal(struct bnxt_softc *softc) in bnxt_hwrm_set_coal() argument
3120 bnxt_hwrm_cmd_hdr_init(softc, &req_rx, in bnxt_hwrm_set_coal()
3122 bnxt_hwrm_cmd_hdr_init(softc, &req_tx, in bnxt_hwrm_set_coal()
3128 max_buf = min_t(uint16_t, softc->rx_coal_frames / 4, 2); in bnxt_hwrm_set_coal()
3131 max_buf_irq = clamp_t(uint16_t, softc->rx_coal_frames_irq, 1, 63); in bnxt_hwrm_set_coal()
3132 buf_tmr = BNXT_USEC_TO_COAL_TIMER(softc->rx_coal_usecs); in bnxt_hwrm_set_coal()
3135 buf_tmr_irq = BNXT_USEC_TO_COAL_TIMER(softc->rx_coal_usecs_irq); in bnxt_hwrm_set_coal()
3143 if (softc->rx_coal_usecs < 25) in bnxt_hwrm_set_coal()
3146 bnxt_hwrm_set_coal_params(softc, max_buf_irq << 16 | max_buf, in bnxt_hwrm_set_coal()
3150 max_buf = clamp_t(uint16_t, softc->tx_coal_frames, 1, 63); in bnxt_hwrm_set_coal()
3151 max_buf_irq = clamp_t(uint16_t, softc->tx_coal_frames_irq, 1, 63); in bnxt_hwrm_set_coal()
3152 buf_tmr = BNXT_USEC_TO_COAL_TIMER(softc->tx_coal_usecs); in bnxt_hwrm_set_coal()
3155 buf_tmr_irq = BNXT_USEC_TO_COAL_TIMER(softc->tx_coal_usecs_irq); in bnxt_hwrm_set_coal()
3158 bnxt_hwrm_set_coal_params(softc, max_buf_irq << 16 | max_buf, in bnxt_hwrm_set_coal()
3161 for (i = 0; i < softc->nrxqsets; i++) { in bnxt_hwrm_set_coal()
3164 req->ring_id = htole16(softc->grp_info[i].cp_ring_id); in bnxt_hwrm_set_coal()
3166 rc = hwrm_send_message(softc, req, sizeof(*req)); in bnxt_hwrm_set_coal()
3173 void bnxt_hwrm_ring_info_get(struct bnxt_softc *softc, uint8_t ring_type, in bnxt_hwrm_ring_info_get() argument
3177 hwrm_dbg_ring_info_get_output_t *resp = (void *)softc->hwrm_cmd_resp.idi_vaddr; in bnxt_hwrm_ring_info_get()
3181 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_DBG_RING_INFO_GET); in bnxt_hwrm_ring_info_get()
3184 rc = hwrm_send_message(softc, &req, sizeof(req)); in bnxt_hwrm_ring_info_get()