static int ecore_mfw_get_tlv_time_value(struct ecore_mfw_tlv_time *p_time, struct ecore_tlv_parsed_buf *p_buf) { if (!p_time->b_set) return -1; /* Validate numbers */ if (p_time->month > 12) p_time->month = 0; if (p_time->day > 31) p_time->day = 0; if (p_time->hour > 23) p_time->hour = 0; if (p_time->min > 59) p_time->hour = 0; if (p_time->msec > 999) p_time->msec = 0; if (p_time->usec > 999) p_time->usec = 0; OSAL_MEM_ZERO(p_buf->data, sizeof(u8) * ECORE_TLV_DATA_MAX); OSAL_SNPRINTF(p_buf->data, 14, "%d%d%d%d%d%d", p_time->month, p_time->day, p_time->hour, p_time->min, p_time->msec, p_time->usec); p_buf->p_val = p_buf->data; return 14; }
void ecore_ooo_setup(struct ecore_hwfn *p_hwfn) { ecore_ooo_release_all_isles(p_hwfn->p_ooo_info); OSAL_MEM_ZERO(p_hwfn->p_ooo_info->ooo_history.p_cqes, p_hwfn->p_ooo_info->ooo_history.num_of_cqes * sizeof(struct ooo_opaque)); p_hwfn->p_ooo_info->ooo_history.head_idx = 0; }
static enum _ecore_status_t ecore_dcbx_read_local_mib(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt) { struct ecore_dcbx_mib_meta_data data; enum _ecore_status_t rc = ECORE_SUCCESS; OSAL_MEM_ZERO(&data, sizeof(data)); data.addr = p_hwfn->mcp_info->port_addr + offsetof(struct public_port, local_admin_dcbx_mib); data.local_admin = &p_hwfn->p_dcbx_info->local_admin; data.size = sizeof(struct dcbx_local_params); ecore_memcpy_from(p_hwfn, p_ptt, data.local_admin, data.addr, data.size); return rc; }
static enum _ecore_status_t ecore_dcbx_read_remote_mib(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, enum ecore_mib_read_type type) { struct ecore_dcbx_mib_meta_data data; enum _ecore_status_t rc = ECORE_SUCCESS; OSAL_MEM_ZERO(&data, sizeof(data)); data.addr = p_hwfn->mcp_info->port_addr + offsetof(struct public_port, remote_dcbx_mib); data.mib = &p_hwfn->p_dcbx_info->remote; data.size = sizeof(struct dcbx_mib); rc = ecore_dcbx_copy_mib(p_hwfn, p_ptt, &data, type); return rc; }
static int ecore_mfw_get_gen_tlv_value(struct ecore_drv_tlv_hdr *p_tlv, struct ecore_mfw_tlv_generic *p_drv_buf, struct ecore_tlv_parsed_buf *p_buf) { switch (p_tlv->tlv_type) { case DRV_TLV_FEATURE_FLAGS: if (p_drv_buf->flags.b_set) { OSAL_MEM_ZERO(p_buf->data, sizeof(u8) * ECORE_TLV_DATA_MAX); p_buf->data[0] = p_drv_buf->flags.ipv4_csum_offload ? 1 : 0; p_buf->data[0] |= (p_drv_buf->flags.lso_supported ? 1 : 0) << 1; p_buf->p_val = p_buf->data; return 2; } break; case DRV_TLV_LOCAL_ADMIN_ADDR: case DRV_TLV_ADDITIONAL_MAC_ADDR_1: case DRV_TLV_ADDITIONAL_MAC_ADDR_2: { int idx = p_tlv->tlv_type - DRV_TLV_LOCAL_ADMIN_ADDR; if (p_drv_buf->mac_set[idx]) { p_buf->p_val = p_drv_buf->mac[idx]; return 6; } break; } case DRV_TLV_RX_FRAMES_RECEIVED: if (p_drv_buf->rx_frames_set) { p_buf->p_val = (u8 *)&p_drv_buf->rx_frames; return sizeof(p_drv_buf->rx_frames); } break; case DRV_TLV_RX_BYTES_RECEIVED: if (p_drv_buf->rx_bytes_set) { p_buf->p_val = (u8 *)&p_drv_buf->rx_bytes; return sizeof(p_drv_buf->rx_bytes); } break; case DRV_TLV_TX_FRAMES_SENT: if (p_drv_buf->tx_frames_set) { p_buf->p_val = (u8 *)&p_drv_buf->tx_frames; return sizeof(p_drv_buf->tx_frames); } break; case DRV_TLV_TX_BYTES_SENT: if (p_drv_buf->tx_bytes_set) { p_buf->p_val = (u8 *)&p_drv_buf->tx_bytes; return sizeof(p_drv_buf->tx_bytes); } break; default: break; } return -1; }