static void ecore_dcbx_get_local_lldp_params(struct ecore_hwfn *p_hwfn, struct ecore_dcbx_get *params) { struct lldp_config_params_s *p_local; p_local = &p_hwfn->p_dcbx_info->lldp_local[LLDP_NEAREST_BRIDGE]; OSAL_MEMCPY(params->lldp_local.local_chassis_id, p_local->local_chassis_id, sizeof(params->lldp_local.local_chassis_id)); OSAL_MEMCPY(params->lldp_local.local_port_id, p_local->local_port_id, sizeof(params->lldp_local.local_port_id)); }
static void ecore_dcbx_get_remote_lldp_params(struct ecore_hwfn *p_hwfn, struct ecore_dcbx_get *params) { struct lldp_status_params_s *p_remote; p_remote = &p_hwfn->p_dcbx_info->lldp_remote[LLDP_NEAREST_BRIDGE]; OSAL_MEMCPY(params->lldp_remote.peer_chassis_id, p_remote->peer_chassis_id, sizeof(params->lldp_remote.peer_chassis_id)); OSAL_MEMCPY(params->lldp_remote.peer_port_id, p_remote->peer_port_id, sizeof(params->lldp_remote.peer_port_id)); }
static void ecore_dcbx_set_local_params(struct ecore_hwfn *p_hwfn, struct dcbx_local_params *local_admin, struct ecore_dcbx_set *params) { bool ieee = false; local_admin->flags = 0; OSAL_MEMCPY(&local_admin->features, &p_hwfn->p_dcbx_info->operational.features, sizeof(local_admin->features)); if (params->enabled) { local_admin->config = params->ver_num; ieee = !!(params->ver_num & DCBX_CONFIG_VERSION_IEEE); } else { local_admin->config = DCBX_CONFIG_VERSION_DISABLED; } DP_VERBOSE(p_hwfn, ECORE_MSG_DCB, "Dcbx version = %d\n", local_admin->config); if (params->override_flags & ECORE_DCBX_OVERRIDE_PFC_CFG) ecore_dcbx_set_pfc_data(p_hwfn, &local_admin->features.pfc, ¶ms->config.params); if (params->override_flags & ECORE_DCBX_OVERRIDE_ETS_CFG) ecore_dcbx_set_ets_data(p_hwfn, &local_admin->features.ets, ¶ms->config.params); if (params->override_flags & ECORE_DCBX_OVERRIDE_APP_CFG) ecore_dcbx_set_app_data(p_hwfn, &local_admin->features.app, ¶ms->config.params, ieee); }
static enum _ecore_status_t ecore_mfw_update_tlvs(struct ecore_hwfn *p_hwfn, u8 tlv_group, u8 *p_mfw_buf, u32 size) { union ecore_mfw_tlv_data *p_tlv_data; struct ecore_tlv_parsed_buf buffer; struct ecore_drv_tlv_hdr tlv; u32 offset; int len; u8 *p_tlv; p_tlv_data = OSAL_VZALLOC(p_hwfn->p_dev, sizeof(*p_tlv_data)); if (!p_tlv_data) return ECORE_NOMEM; if (OSAL_MFW_FILL_TLV_DATA(p_hwfn,tlv_group, p_tlv_data)) { OSAL_VFREE(p_hwfn->p_dev, p_tlv_data); return ECORE_INVAL; } OSAL_MEMSET(&tlv, 0, sizeof(tlv)); for (offset = 0; offset < size; offset += sizeof(tlv) + sizeof(u32) * tlv.tlv_length) { p_tlv = &p_mfw_buf[offset]; tlv.tlv_type = TLV_TYPE(p_tlv); tlv.tlv_length = TLV_LENGTH(p_tlv); tlv.tlv_flags = TLV_FLAGS(p_tlv); DP_VERBOSE(p_hwfn, ECORE_MSG_SP, "Type %d length = %d flags = 0x%x\n", tlv.tlv_type, tlv.tlv_length, tlv.tlv_flags); if (tlv_group == ECORE_MFW_TLV_GENERIC) len = ecore_mfw_get_gen_tlv_value(&tlv, &p_tlv_data->generic, &buffer); else if (tlv_group == ECORE_MFW_TLV_ETH) len = ecore_mfw_get_eth_tlv_value(&tlv, &p_tlv_data->eth, &buffer); else if (tlv_group == ECORE_MFW_TLV_FCOE) len = ecore_mfw_get_fcoe_tlv_value(&tlv, &p_tlv_data->fcoe, &buffer); else len = ecore_mfw_get_iscsi_tlv_value(&tlv, &p_tlv_data->iscsi, &buffer); if (len > 0) { OSAL_WARN(len > 4 * tlv.tlv_length, "Incorrect MFW TLV length %d, it shouldn't be greater than %d\n", len, 4 * tlv.tlv_length); len = OSAL_MIN_T(int, len, 4 * tlv.tlv_length); tlv.tlv_flags |= ECORE_DRV_TLV_FLAGS_CHANGED; TLV_FLAGS(p_tlv) = tlv.tlv_flags; OSAL_MEMCPY(p_mfw_buf + offset + sizeof(tlv), buffer.p_val, len); } }
/* Parse app TLV's to update TC information in hw_info structure for * reconfiguring QM. Get protocol specific data for PF update ramrod command. */ static enum _ecore_status_t ecore_dcbx_process_mib_info(struct ecore_hwfn *p_hwfn) { struct dcbx_app_priority_feature *p_app; struct dcbx_app_priority_entry *p_tbl; struct ecore_dcbx_results data = { 0 }; struct dcbx_ets_feature *p_ets; struct ecore_hw_info *p_info; u32 pri_tc_tbl, flags; u8 dcbx_version; int num_entries; enum _ecore_status_t rc = ECORE_SUCCESS; flags = p_hwfn->p_dcbx_info->operational.flags; dcbx_version = GET_MFW_FIELD(flags, DCBX_CONFIG_VERSION); p_app = &p_hwfn->p_dcbx_info->operational.features.app; p_tbl = p_app->app_pri_tbl; p_ets = &p_hwfn->p_dcbx_info->operational.features.ets; pri_tc_tbl = p_ets->pri_tc_tbl[0]; p_info = &p_hwfn->hw_info; num_entries = GET_MFW_FIELD(p_app->flags, DCBX_APP_NUM_ENTRIES); rc = ecore_dcbx_process_tlv(p_hwfn, &data, p_tbl, pri_tc_tbl, num_entries, dcbx_version); if (rc != ECORE_SUCCESS) return rc; p_info->num_active_tc = GET_MFW_FIELD(p_ets->flags, DCBX_ETS_MAX_TCS); p_hwfn->qm_info.ooo_tc = GET_MFW_FIELD(p_ets->flags, DCBX_OOO_TC); data.pf_id = p_hwfn->rel_pf_id; data.dcbx_enabled = !!dcbx_version; ecore_dcbx_dp_protocol(p_hwfn, &data); OSAL_MEMCPY(&p_hwfn->p_dcbx_info->results, &data, sizeof(struct ecore_dcbx_results)); return ECORE_SUCCESS; }
enum _ecore_status_t ecore_dcbx_config_params(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, struct ecore_dcbx_set *params, bool hw_commit) { struct dcbx_local_params local_admin; struct ecore_dcbx_mib_meta_data data; struct dcb_dscp_map dscp_map; u32 resp = 0, param = 0; enum _ecore_status_t rc = ECORE_SUCCESS; OSAL_MEMCPY(&p_hwfn->p_dcbx_info->set, params, sizeof(p_hwfn->p_dcbx_info->set)); if (!hw_commit) return ECORE_SUCCESS; OSAL_MEMSET(&local_admin, 0, sizeof(local_admin)); ecore_dcbx_set_local_params(p_hwfn, &local_admin, params); data.addr = p_hwfn->mcp_info->port_addr + offsetof(struct public_port, local_admin_dcbx_mib); data.local_admin = &local_admin; data.size = sizeof(struct dcbx_local_params); ecore_memcpy_to(p_hwfn, p_ptt, data.addr, data.local_admin, data.size); if (params->override_flags & ECORE_DCBX_OVERRIDE_DSCP_CFG) { OSAL_MEMSET(&dscp_map, 0, sizeof(dscp_map)); ecore_dcbx_set_dscp_params(p_hwfn, &dscp_map, params); data.addr = p_hwfn->mcp_info->port_addr + offsetof(struct public_port, dcb_dscp_map); data.dscp_map = &dscp_map; data.size = sizeof(struct dcb_dscp_map); ecore_memcpy_to(p_hwfn, p_ptt, data.addr, data.dscp_map, data.size); }
static enum _ecore_status_t ecore_dcbx_set_dscp_params(struct ecore_hwfn *p_hwfn, struct dcb_dscp_map *p_dscp_map, struct ecore_dcbx_set *p_params) { int entry, i, j; u32 val; OSAL_MEMCPY(p_dscp_map, &p_hwfn->p_dcbx_info->dscp_map, sizeof(*p_dscp_map)); p_dscp_map->flags &= ~DCB_DSCP_ENABLE_MASK; if (p_params->dscp.enabled) p_dscp_map->flags |= DCB_DSCP_ENABLE_MASK; for (i = 0, entry = 0; i < 8; i++) { val = 0; for (j = 0; j < 8; j++, entry++) val |= (((u32)p_params->dscp.dscp_pri_map[entry]) << (j * 4)); p_dscp_map->dscp_pri_map[i] = OSAL_CPU_TO_BE32(val); } p_hwfn->p_dcbx_info->dscp_nig_update = true; DP_VERBOSE(p_hwfn, ECORE_MSG_DCB, "flags = 0x%x\n", p_dscp_map->flags); DP_VERBOSE(p_hwfn, ECORE_MSG_DCB, "pri_map[] = 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", p_dscp_map->dscp_pri_map[0], p_dscp_map->dscp_pri_map[1], p_dscp_map->dscp_pri_map[2], p_dscp_map->dscp_pri_map[3], p_dscp_map->dscp_pri_map[4], p_dscp_map->dscp_pri_map[5], p_dscp_map->dscp_pri_map[6], p_dscp_map->dscp_pri_map[7]); return ECORE_SUCCESS; }