static void qlcnic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) { struct qlcnic_adapter *adapter = netdev_priv(dev); struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; struct qlcnic_host_sds_ring *sds_ring; u32 *regs_buff = p; int ring, i = 0; memset(p, 0, qlcnic_get_regs_len(dev)); regs->version = (QLCNIC_ETHTOOL_REGS_VER << 24) | (adapter->ahw->revision_id << 16) | (adapter->pdev)->device; regs_buff[0] = (0xcafe0000 | (QLCNIC_DEV_INFO_SIZE & 0xffff)); regs_buff[1] = QLCNIC_MGMT_API_VERSION; if (qlcnic_82xx_check(adapter)) i = qlcnic_82xx_get_registers(adapter, regs_buff); else i = qlcnic_83xx_get_registers(adapter, regs_buff); if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) return; regs_buff[i++] = 0xFFEFCDAB; /* Marker btw regs and ring count*/ regs_buff[i++] = 1; /* No. of tx ring */ regs_buff[i++] = le32_to_cpu(*(adapter->tx_ring->hw_consumer)); regs_buff[i++] = readl(adapter->tx_ring->crb_cmd_producer); regs_buff[i++] = 2; /* No. of rx ring */ regs_buff[i++] = readl(recv_ctx->rds_rings[0].crb_rcv_producer); regs_buff[i++] = readl(recv_ctx->rds_rings[1].crb_rcv_producer); regs_buff[i++] = adapter->max_sds_rings; for (ring = 0; ring < adapter->max_sds_rings; ring++) { sds_ring = &(recv_ctx->sds_rings[ring]); regs_buff[i++] = readl(sds_ring->crb_sts_consumer); } }
static void qlcnic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) { struct qlcnic_adapter *adapter = netdev_priv(dev); struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; struct qlcnic_host_sds_ring *sds_ring; u32 *regs_buff = p; int ring, i = 0; memset(p, 0, qlcnic_get_regs_len(dev)); regs->version = (1 << 24) | (adapter->ahw.revision_id << 16) | (adapter->pdev)->device; for (i = 0; diag_registers[i] != -1; i++) regs_buff[i] = QLCRD32(adapter, diag_registers[i]); if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) return; regs_buff[i++] = 0xFFEFCDAB; /* Marker btw regs and ring count*/ regs_buff[i++] = 1; /* No. of tx ring */ regs_buff[i++] = le32_to_cpu(*(adapter->tx_ring->hw_consumer)); regs_buff[i++] = readl(adapter->tx_ring->crb_cmd_producer); regs_buff[i++] = 2; /* No. of rx ring */ regs_buff[i++] = readl(recv_ctx->rds_rings[0].crb_rcv_producer); regs_buff[i++] = readl(recv_ctx->rds_rings[1].crb_rcv_producer); regs_buff[i++] = adapter->max_sds_rings; for (ring = 0; ring < adapter->max_sds_rings; ring++) { sds_ring = &(recv_ctx->sds_rings[ring]); regs_buff[i++] = readl(sds_ring->crb_sts_consumer); } }