mirror of
https://github.com/corundum/corundum.git
synced 2025-01-30 08:32:52 +08:00
Add tx_queue_count field to mqnic_port, remove unnecessary arguments
This commit is contained in:
parent
ed7e374afa
commit
8dd5d02e35
@ -219,6 +219,8 @@ struct mqnic_port {
|
||||
|
||||
int index;
|
||||
|
||||
u32 tx_queue_count;
|
||||
|
||||
u32 port_id;
|
||||
u32 port_features;
|
||||
u32 sched_count;
|
||||
@ -283,8 +285,8 @@ void mqnic_destroy_netdev(struct net_device *ndev);
|
||||
// mqnic_port.c
|
||||
int mqnic_create_port(struct mqnic_priv *priv, struct mqnic_port **port_ptr, int index, u8 __iomem *hw_addr);
|
||||
void mqnic_destroy_port(struct mqnic_priv *priv, struct mqnic_port **port_ptr);
|
||||
int mqnic_activate_port(struct mqnic_priv *priv, struct mqnic_port *port);
|
||||
void mqnic_deactivate_port(struct mqnic_priv *priv, struct mqnic_port *port);
|
||||
int mqnic_activate_port(struct mqnic_port *port);
|
||||
void mqnic_deactivate_port(struct mqnic_port *port);
|
||||
|
||||
// mqnic_ptp.c
|
||||
void mqnic_register_phc(struct mqnic_dev *mdev);
|
||||
|
@ -89,7 +89,7 @@ static int mqnic_open(struct net_device *ndev)
|
||||
}
|
||||
|
||||
// enable first port
|
||||
mqnic_activate_port(priv, priv->ports[0]);
|
||||
mqnic_activate_port(priv->ports[0]);
|
||||
|
||||
priv->port_up = true;
|
||||
|
||||
@ -126,7 +126,7 @@ static int mqnic_close(struct net_device *ndev)
|
||||
// disable ports
|
||||
for (k = 0; k < priv->port_count; k++)
|
||||
{
|
||||
mqnic_deactivate_port(priv, priv->ports[k]);
|
||||
mqnic_deactivate_port(priv->ports[k]);
|
||||
}
|
||||
|
||||
// deactivate TX queues
|
||||
|
@ -52,6 +52,8 @@ int mqnic_create_port(struct mqnic_priv *priv, struct mqnic_port **port_ptr, int
|
||||
|
||||
port->index = index;
|
||||
|
||||
port->tx_queue_count = priv->tx_queue_count;
|
||||
|
||||
port->hw_addr = hw_addr;
|
||||
|
||||
// read ID registers
|
||||
@ -69,7 +71,7 @@ int mqnic_create_port(struct mqnic_priv *priv, struct mqnic_port **port_ptr, int
|
||||
port->sched_type = ioread32(port->hw_addr+MQNIC_PORT_REG_SCHED_TYPE);
|
||||
dev_info(dev, "Scheduler type: 0x%08x", port->sched_type);
|
||||
|
||||
mqnic_deactivate_port(priv, port);
|
||||
mqnic_deactivate_port(port);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -79,12 +81,12 @@ void mqnic_destroy_port(struct mqnic_priv *priv, struct mqnic_port **port_ptr)
|
||||
struct mqnic_port *port = *port_ptr;
|
||||
*port_ptr = NULL;
|
||||
|
||||
mqnic_deactivate_port(priv, port);
|
||||
mqnic_deactivate_port(port);
|
||||
|
||||
kfree(port);
|
||||
}
|
||||
|
||||
int mqnic_activate_port(struct mqnic_priv *priv, struct mqnic_port *port)
|
||||
int mqnic_activate_port(struct mqnic_port *port)
|
||||
{
|
||||
int k;
|
||||
|
||||
@ -92,7 +94,7 @@ int mqnic_activate_port(struct mqnic_priv *priv, struct mqnic_port *port)
|
||||
iowrite32(0xffffffff, port->hw_addr+MQNIC_PORT_REG_SCHED_ENABLE);
|
||||
|
||||
// enable queues
|
||||
for (k = 0; k < priv->tx_queue_count; k++)
|
||||
for (k = 0; k < port->tx_queue_count; k++)
|
||||
{
|
||||
iowrite32(3, port->hw_addr+port->sched_offset+k*4);
|
||||
}
|
||||
@ -100,7 +102,7 @@ int mqnic_activate_port(struct mqnic_priv *priv, struct mqnic_port *port)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mqnic_deactivate_port(struct mqnic_priv *priv, struct mqnic_port *port)
|
||||
void mqnic_deactivate_port(struct mqnic_port *port)
|
||||
{
|
||||
// disable schedulers
|
||||
iowrite32(0, port->hw_addr+MQNIC_PORT_REG_SCHED_ENABLE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user