mirror of
https://github.com/corundum/corundum.git
synced 2025-01-16 08:12:53 +08:00
Add port management code to userspace code
This commit is contained in:
parent
d8a2efc756
commit
7477cda192
@ -125,6 +125,22 @@ struct mqnic *mqnic_open(const char *dev_name)
|
||||
interface->rx_queue_count = MQNIC_MAX_RX_RINGS;
|
||||
if (interface->rx_cpl_queue_count > MQNIC_MAX_RX_CPL_RINGS)
|
||||
interface->rx_cpl_queue_count = MQNIC_MAX_RX_CPL_RINGS;
|
||||
|
||||
if (interface->port_count > MQNIC_MAX_PORTS)
|
||||
interface->port_count = MQNIC_MAX_PORTS;
|
||||
|
||||
for (int l = 0; l < interface->port_count; l++)
|
||||
{
|
||||
struct mqnic_port *port = &interface->ports[l];
|
||||
port->regs = interface->regs + interface->port_offset + interface->port_stride*l;
|
||||
|
||||
port->port_id = mqnic_reg_read32(port->regs, MQNIC_PORT_REG_PORT_ID);
|
||||
|
||||
port->sched_count = mqnic_reg_read32(port->regs, MQNIC_PORT_REG_SCHED_COUNT);
|
||||
port->sched_offset = mqnic_reg_read32(port->regs, MQNIC_PORT_REG_SCHED_OFFSET);
|
||||
port->sched_stride = mqnic_reg_read32(port->regs, MQNIC_PORT_REG_SCHED_STRIDE);
|
||||
port->sched_type = mqnic_reg_read32(port->regs, MQNIC_PORT_REG_SCHED_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
return dev;
|
||||
|
@ -45,6 +45,20 @@ either expressed or implied, of The Regents of the University of California.
|
||||
|
||||
struct mqnic;
|
||||
|
||||
struct mqnic_port {
|
||||
struct mqnic *mqnic;
|
||||
struct mqnic_if *mqnic_if;
|
||||
|
||||
volatile uint8_t *regs;
|
||||
|
||||
uint32_t port_id;
|
||||
|
||||
uint32_t sched_count;
|
||||
uint32_t sched_offset;
|
||||
uint32_t sched_stride;
|
||||
uint32_t sched_type;
|
||||
};
|
||||
|
||||
struct mqnic_if {
|
||||
struct mqnic *mqnic;
|
||||
|
||||
@ -67,6 +81,8 @@ struct mqnic_if {
|
||||
uint32_t port_count;
|
||||
uint32_t port_offset;
|
||||
uint32_t port_stride;
|
||||
|
||||
struct mqnic_port ports[MQNIC_MAX_PORTS];
|
||||
};
|
||||
|
||||
struct mqnic {
|
||||
|
Loading…
x
Reference in New Issue
Block a user