Lines Matching defs:softc

136 	struct bnxt_softc	*softc;
384 int bnxt_hwrm_func_drv_unrgtr(struct bnxt_softc *softc, bool shutdown);
386 int bnxt_hwrm_port_qstats(struct bnxt_softc *softc);
389 int bnxt_hwrm_vnic_tpa_cfg(struct bnxt_softc *softc);
390 void bnxt_validate_hw_lro_settings(struct bnxt_softc *softc);
391 int bnxt_hwrm_fw_reset(struct bnxt_softc *softc, uint8_t processor,
393 int bnxt_hwrm_fw_qstatus(struct bnxt_softc *softc, uint8_t type,
395 int bnxt_hwrm_fw_get_time(struct bnxt_softc *softc, uint16_t *year,
398 int bnxt_hwrm_fw_set_time(struct bnxt_softc *softc, uint16_t year,
600 cpr->softc = sc;
686 cp->softc = sc;
1871 bnxt_hwrm_port_phy_qcfg(struct bnxt_softc *softc, struct ifmediareq *ifmr)
1873 struct ifnet *ifp = &softc->sc_ac.ac_if;
1876 BNXT_DMA_KVA(softc->sc_cmd_resp);
1887 BNXT_HWRM_LOCK(softc);
1888 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_PORT_PHY_QCFG);
1890 rc = _hwrm_send_message(softc, &req, sizeof(req));
1892 printf("%s: failed to query port phy config\n", DEVNAME(softc));
1896 if (softc->sc_hwrm_ver > 0x10800)
1944 ifmedia_delete_instance(&softc->sc_media, IFM_INST_ANY);
1948 bnxt_add_media_type(softc, resp->support_speeds,
1951 ifmedia_add(&softc->sc_media, IFM_ETHER|IFM_AUTO, 0, NULL);
1952 ifmedia_set(&softc->sc_media, IFM_ETHER|IFM_AUTO);
1975 BNXT_HWRM_UNLOCK(softc);
2429 bnxt_hwrm_cmd_hdr_init(struct bnxt_softc *softc, void *request,
2437 req->resp_addr = htole64(BNXT_DMA_DVA(softc->sc_cmd_resp));
2441 _hwrm_send_message(struct bnxt_softc *softc, void *msg, uint32_t msg_len)
2444 struct hwrm_err_output *resp = BNXT_DMA_KVA(softc->sc_cmd_resp);
2453 req->seq_id = htole16(softc->sc_cmd_seq++);
2456 if (softc->sc_flags & BNXT_FLAG_SHORT_CMD) {
2457 void *short_cmd_req = BNXT_DMA_KVA(softc->sc_cmd_resp);
2461 softc->sc_max_req_len - msg_len);
2468 htole64(BNXT_DMA_DVA(softc->sc_cmd_resp));
2481 bus_space_write_4(softc->sc_hwrm_t,
2482 softc->sc_hwrm_h,
2489 bus_space_write_4(softc->sc_hwrm_t, softc->sc_hwrm_h,
2493 bus_space_write_4(softc->sc_hwrm_t, softc->sc_hwrm_h, 0x100,
2497 for (i = 0; i < softc->sc_cmd_timeo; i++) {
2502 if (i >= softc->sc_cmd_timeo) {
2504 DEVNAME(softc), GET_HWRM_REQ_TYPE(req->req_type),
2505 softc->sc_cmd_timeo,
2511 for (i = 0; i < softc->sc_cmd_timeo; i++) {
2516 if (i >= softc->sc_cmd_timeo) {
2519 DEVNAME(softc), GET_HWRM_REQ_TYPE(req->req_type),
2520 softc->sc_cmd_timeo, le16toh(req->req_type),
2531 DEVNAME(softc),
2543 hwrm_send_message(struct bnxt_softc *softc, void *msg, uint32_t msg_len)
2547 BNXT_HWRM_LOCK(softc);
2548 rc = _hwrm_send_message(softc, msg, msg_len);
2549 BNXT_HWRM_UNLOCK(softc);
2555 bnxt_hwrm_queue_qportcfg(struct bnxt_softc *softc)
2559 BNXT_DMA_KVA(softc->sc_cmd_resp);
2562 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_QUEUE_QPORTCFG);
2564 BNXT_HWRM_LOCK(softc);
2565 rc = _hwrm_send_message(softc, &req, sizeof(req));
2574 softc->sc_tx_queue_id = resp->queue_id0;
2577 BNXT_HWRM_UNLOCK(softc);
2582 bnxt_hwrm_ver_get(struct bnxt_softc *softc)
2586 BNXT_DMA_KVA(softc->sc_cmd_resp);
2594 softc->sc_max_req_len = HWRM_MAX_REQ_LEN;
2595 softc->sc_cmd_timeo = 1000;
2596 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VER_GET);
2602 BNXT_HWRM_LOCK(softc);
2603 rc = _hwrm_send_message(softc, &req, sizeof(req));
2610 softc->sc_hwrm_ver = (resp->hwrm_intf_maj << 16) |
2613 snprintf(softc->ver_info->hwrm_if_ver, BNXT_VERSTR_SIZE, "%d.%d.%d",
2615 softc->ver_info->hwrm_if_major = resp->hwrm_intf_maj;
2616 softc->ver_info->hwrm_if_minor = resp->hwrm_intf_min;
2617 softc->ver_info->hwrm_if_update = resp->hwrm_intf_upd;
2618 snprintf(softc->ver_info->hwrm_fw_ver, BNXT_VERSTR_SIZE, "%d.%d.%d",
2620 strlcpy(softc->ver_info->driver_hwrm_if_ver, HWRM_VERSION_STR,
2622 strlcpy(softc->ver_info->hwrm_fw_name, resp->hwrm_fw_name,
2627 strlcpy(softc->ver_info->mgmt_fw_ver, naver, BNXT_VERSTR_SIZE);
2628 strlcpy(softc->ver_info->mgmt_fw_name, nastr, BNXT_NAME_SIZE);
2631 snprintf(softc->ver_info->mgmt_fw_ver, BNXT_VERSTR_SIZE,
2634 strlcpy(softc->ver_info->mgmt_fw_name, resp->mgmt_fw_name,
2639 strlcpy(softc->ver_info->netctrl_fw_ver, naver,
2641 strlcpy(softc->ver_info->netctrl_fw_name, nastr,
2645 snprintf(softc->ver_info->netctrl_fw_ver, BNXT_VERSTR_SIZE,
2648 strlcpy(softc->ver_info->netctrl_fw_name, resp->netctrl_fw_name,
2653 strlcpy(softc->ver_info->roce_fw_ver, naver, BNXT_VERSTR_SIZE);
2654 strlcpy(softc->ver_info->roce_fw_name, nastr, BNXT_NAME_SIZE);
2657 snprintf(softc->ver_info->roce_fw_ver, BNXT_VERSTR_SIZE,
2660 strlcpy(softc->ver_info->roce_fw_name, resp->roce_fw_name,
2663 softc->ver_info->chip_num = le16toh(resp->chip_num);
2664 softc->ver_info->chip_rev = resp->chip_rev;
2665 softc->ver_info->chip_metal = resp->chip_metal;
2666 softc->ver_info->chip_bond_id = resp->chip_bond_id;
2667 softc->ver_info->chip_type = resp->chip_platform_type;
2671 softc->sc_max_req_len = le16toh(resp->max_req_win_len);
2673 softc->sc_cmd_timeo = le16toh(resp->def_req_timeout);
2678 softc->sc_flags |= BNXT_FLAG_SHORT_CMD;
2681 BNXT_HWRM_UNLOCK(softc);
2687 bnxt_hwrm_func_drv_rgtr(struct bnxt_softc *softc)
2691 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_DRV_RGTR);
2701 return hwrm_send_message(softc, &req, sizeof(req));
2707 bnxt_hwrm_func_drv_unrgtr(struct bnxt_softc *softc, bool shutdown)
2711 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_DRV_UNRGTR);
2715 return hwrm_send_message(softc, &req, sizeof(req));
2721 bnxt_hwrm_func_qcaps(struct bnxt_softc *softc)
2726 BNXT_DMA_KVA(softc->sc_cmd_resp);
2727 /* struct bnxt_func_info *func = &softc->func; */
2729 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_QCAPS);
2732 BNXT_HWRM_LOCK(softc);
2733 rc = _hwrm_send_message(softc, &req, sizeof(req));
2739 softc->sc_flags |= BNXT_FLAG_WOL_CAP;
2741 memcpy(softc->sc_ac.ac_enaddr, resp->mac_address, 6);
2755 if (BNXT_PF(softc)) {
2756 struct bnxt_pf_info *pf = &softc->pf;
2769 device_printf(softc->dev, "Invalid ethernet address, generating random locally administered address\n");
2775 BNXT_HWRM_UNLOCK(softc);
2781 bnxt_hwrm_func_qcfg(struct bnxt_softc *softc)
2785 BNXT_DMA_KVA(softc->sc_cmd_resp);
2786 struct bnxt_func_qcfg *fn_qcfg = &softc->fn_qcfg; */
2789 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_QCFG);
2791 BNXT_HWRM_LOCK(softc);
2792 rc = _hwrm_send_message(softc, &req, sizeof(req));
2803 BNXT_HWRM_UNLOCK(softc);
2809 bnxt_hwrm_func_reset(struct bnxt_softc *softc)
2813 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_RESET);
2816 return hwrm_send_message(softc, &req, sizeof(req));
2820 bnxt_hwrm_vnic_cfg_placement(struct bnxt_softc *softc,
2825 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_PLCMODES_CFG);
2834 return hwrm_send_message(softc, &req, sizeof(req));
2838 bnxt_hwrm_vnic_cfg(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic)
2842 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_CFG);
2860 return hwrm_send_message(softc, &req, sizeof(req));
2864 bnxt_hwrm_vnic_alloc(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic)
2868 BNXT_DMA_KVA(softc->sc_cmd_resp);
2873 DEVNAME(softc), vnic->id);
2877 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_ALLOC);
2882 BNXT_HWRM_LOCK(softc);
2883 rc = _hwrm_send_message(softc, &req, sizeof(req));
2890 BNXT_HWRM_UNLOCK(softc);
2895 bnxt_hwrm_vnic_free(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic)
2902 DEVNAME(softc), vnic->id);
2906 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_FREE);
2909 BNXT_HWRM_LOCK(softc);
2910 rc = _hwrm_send_message(softc, &req, sizeof(req));
2913 BNXT_HWRM_UNLOCK(softc);
2919 bnxt_hwrm_vnic_ctx_alloc(struct bnxt_softc *softc, uint16_t *ctx_id)
2923 BNXT_DMA_KVA(softc->sc_cmd_resp);
2928 DEVNAME(softc), *ctx_id);
2932 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_RSS_COS_LB_CTX_ALLOC);
2934 BNXT_HWRM_LOCK(softc);
2935 rc = _hwrm_send_message(softc, &req, sizeof(req));
2942 BNXT_HWRM_UNLOCK(softc);
2947 bnxt_hwrm_vnic_ctx_free(struct bnxt_softc *softc, uint16_t *ctx_id)
2954 DEVNAME(softc), *ctx_id);
2958 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_RSS_COS_LB_CTX_FREE);
2961 BNXT_HWRM_LOCK(softc);
2962 rc = _hwrm_send_message(softc, &req, sizeof(req));
2965 BNXT_HWRM_UNLOCK(softc);
2970 bnxt_hwrm_ring_grp_alloc(struct bnxt_softc *softc, struct bnxt_grp_info *grp)
2978 DEVNAME(softc), grp->grp_id);
2982 resp = BNXT_DMA_KVA(softc->sc_cmd_resp);
2983 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_RING_GRP_ALLOC);
2989 BNXT_HWRM_LOCK(softc);
2990 rc = _hwrm_send_message(softc, &req, sizeof(req));
2997 BNXT_HWRM_UNLOCK(softc);
3002 bnxt_hwrm_ring_grp_free(struct bnxt_softc *softc, struct bnxt_grp_info *grp)
3009 DEVNAME(softc), grp->grp_id);
3013 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_RING_GRP_FREE);
3016 BNXT_HWRM_LOCK(softc);
3017 rc = _hwrm_send_message(softc, &req, sizeof(req));
3021 BNXT_HWRM_UNLOCK(softc);
3029 bnxt_hwrm_ring_alloc(struct bnxt_softc *softc, uint8_t type,
3039 DEVNAME(softc), ring->phys_id);
3043 resp = BNXT_DMA_KVA(softc->sc_cmd_resp);
3044 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_RING_ALLOC);
3058 req.queue_id = htole16(softc->sc_tx_queue_id);
3059 req.int_mode = (softc->sc_flags & BNXT_FLAG_MSIX) ?
3062 BNXT_HWRM_LOCK(softc);
3063 rc = _hwrm_send_message(softc, &req, sizeof(req));
3070 BNXT_HWRM_UNLOCK(softc);
3075 bnxt_hwrm_ring_free(struct bnxt_softc *softc, uint8_t type, struct bnxt_ring *ring)
3082 DEVNAME(softc), ring->phys_id);
3086 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_RING_FREE);
3089 BNXT_HWRM_LOCK(softc);
3090 rc = _hwrm_send_message(softc, &req, sizeof(req));
3096 BNXT_HWRM_UNLOCK(softc);
3102 bnxt_hwrm_stat_ctx_alloc(struct bnxt_softc *softc, struct bnxt_cp_ring *cpr,
3111 DEVNAME(softc), cpr->stats_ctx_id);
3115 resp = BNXT_DMA_KVA(softc->sc_cmd_resp);
3116 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_STAT_CTX_ALLOC);
3121 BNXT_HWRM_LOCK(softc);
3122 rc = _hwrm_send_message(softc, &req, sizeof(req));
3129 BNXT_HWRM_UNLOCK(softc);
3135 bnxt_hwrm_stat_ctx_free(struct bnxt_softc *softc, struct bnxt_cp_ring *cpr)
3142 DEVNAME(softc), cpr->stats_ctx_id);
3146 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_STAT_CTX_FREE);
3149 BNXT_HWRM_LOCK(softc);
3150 rc = _hwrm_send_message(softc, &req, sizeof(req));
3151 BNXT_HWRM_UNLOCK(softc);
3162 bnxt_hwrm_port_qstats(struct bnxt_softc *softc)
3167 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_PORT_QSTATS);
3169 req.port_id = htole16(softc->pf.port_id);
3170 req.rx_stat_host_addr = htole64(softc->hw_rx_port_stats.idi_paddr);
3171 req.tx_stat_host_addr = htole64(softc->hw_tx_port_stats.idi_paddr);
3173 BNXT_HWRM_LOCK(softc);
3174 rc = _hwrm_send_message(softc, &req, sizeof(req));
3175 BNXT_HWRM_UNLOCK(softc);
3183 bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt_softc *softc,
3188 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_CFA_L2_SET_RX_MASK);
3194 return hwrm_send_message(softc, &req, sizeof(req));
3198 bnxt_hwrm_set_filter(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic)
3207 DEVNAME(softc));
3211 resp = BNXT_DMA_KVA(softc->sc_cmd_resp);
3212 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_CFA_L2_FILTER_ALLOC);
3221 memcpy(req.l2_addr, softc->sc_ac.ac_enaddr, ETHER_ADDR_LEN);
3224 BNXT_HWRM_LOCK(softc);
3225 rc = _hwrm_send_message(softc, &req, sizeof(req));
3233 BNXT_HWRM_UNLOCK(softc);
3238 bnxt_hwrm_free_filter(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic)
3245 DEVNAME(softc), vnic->filter_id);
3249 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_CFA_L2_FILTER_FREE);
3252 BNXT_HWRM_LOCK(softc);
3253 rc = _hwrm_send_message(softc, &req, sizeof(req));
3256 BNXT_HWRM_UNLOCK(softc);
3263 bnxt_hwrm_vnic_rss_cfg(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic,
3268 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_RSS_CFG);
3275 return hwrm_send_message(softc, &req, sizeof(req));
3279 bnxt_cfg_async_cr(struct bnxt_softc *softc, struct bnxt_cp_ring *cpr)
3283 if (1 /* BNXT_PF(softc) */) {
3286 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_CFG);
3292 rc = hwrm_send_message(softc, &req, sizeof(req));
3296 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_VF_CFG);
3301 rc = hwrm_send_message(softc, &req, sizeof(req));
3309 bnxt_validate_hw_lro_settings(struct bnxt_softc *softc)
3311 softc->hw_lro.enable = min(softc->hw_lro.enable, 1);
3313 softc->hw_lro.is_mode_gro = min(softc->hw_lro.is_mode_gro, 1);
3315 softc->hw_lro.max_agg_segs = min(softc->hw_lro.max_agg_segs,
3318 softc->hw_lro.max_aggs = min(softc->hw_lro.max_aggs,
3321 softc->hw_lro.min_agg_len = min(softc->hw_lro.min_agg_len, BNXT_MAX_MTU);
3325 bnxt_hwrm_vnic_tpa_cfg(struct bnxt_softc *softc)
3330 if (softc->vnic_info.id == (uint16_t) HWRM_NA_SIGNATURE) {
3334 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_TPA_CFG);
3336 if (softc->hw_lro.enable) {
3342 if (softc->hw_lro.is_mode_gro)
3353 req.max_agg_segs = htole16(softc->hw_lro.max_agg_segs);
3354 req.max_aggs = htole16(softc->hw_lro.max_aggs);
3355 req.min_agg_len = htole32(softc->hw_lro.min_agg_len);
3358 req.vnic_id = htole16(softc->vnic_info.id);
3360 return hwrm_send_message(softc, &req, sizeof(req));
3365 bnxt_hwrm_fw_reset(struct bnxt_softc *softc, uint8_t processor,
3370 (void *)softc->hwrm_cmd_resp.idi_vaddr;
3375 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FW_RESET);
3379 BNXT_HWRM_LOCK(softc);
3380 rc = _hwrm_send_message(softc, &req, sizeof(req));
3386 BNXT_HWRM_UNLOCK(softc);
3391 bnxt_hwrm_fw_qstatus(struct bnxt_softc *softc, uint8_t type, uint8_t *selfreset)
3395 (void *)softc->hwrm_cmd_resp.idi_vaddr;
3400 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FW_QSTATUS);
3403 BNXT_HWRM_LOCK(softc);
3404 rc = _hwrm_send_message(softc, &req, sizeof(req));
3410 BNXT_HWRM_UNLOCK(softc);
3417 bnxt_hwrm_nvm_get_dev_info(struct bnxt_softc *softc, uint16_t *mfg_id,
3423 BNXT_DMA_KVA(softc->sc_cmd_resp);
3427 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_NVM_GET_DEV_INFO);
3429 BNXT_HWRM_LOCK(softc);
3430 old_timeo = softc->sc_cmd_timeo;
3431 softc->sc_cmd_timeo = BNXT_NVM_TIMEO;
3432 rc = _hwrm_send_message(softc, &req, sizeof(req));
3433 softc->sc_cmd_timeo = old_timeo;
3451 BNXT_HWRM_UNLOCK(softc);
3458 bnxt_hwrm_fw_get_time(struct bnxt_softc *softc, uint16_t *year, uint8_t *month,
3464 (void *)softc->hwrm_cmd_resp.idi_vaddr;
3467 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FW_GET_TIME);
3469 BNXT_HWRM_LOCK(softc);
3470 rc = _hwrm_send_message(softc, &req, sizeof(req));
3492 BNXT_HWRM_UNLOCK(softc);
3497 bnxt_hwrm_fw_set_time(struct bnxt_softc *softc, uint16_t year, uint8_t month,
3503 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FW_SET_TIME);
3513 return hwrm_send_message(softc, &req, sizeof(req));
3525 bnxt_hwrm_func_rgtr_async_events(struct bnxt_softc *softc)
3537 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_DRV_RGTR);
3545 return hwrm_send_message(softc, &req, sizeof(req));
3549 bnxt_get_sffpage(struct bnxt_softc *softc, struct if_sffpage *sff)
3555 bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_PORT_PHY_I2C_READ);
3564 if (hwrm_send_message(softc, &req, sizeof(req))) {
3565 printf("%s: failed to read i2c data\n", DEVNAME(softc));
3570 BNXT_DMA_KVA(softc->sc_cmd_resp);