1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-30 08:32:52 +08:00

Normalize ring_index parameter

This commit is contained in:
Alex Forencich 2021-12-10 21:03:46 -08:00
parent 32a82929c6
commit c9de7d24d0
6 changed files with 10 additions and 2 deletions

View File

@ -199,6 +199,7 @@ struct mqnic_ring {
struct device *dev; struct device *dev;
struct net_device *ndev; struct net_device *ndev;
struct mqnic_priv *priv; struct mqnic_priv *priv;
int ring_index;
u32 hw_ptr_mask; u32 hw_ptr_mask;
u8 __iomem *hw_addr; u8 __iomem *hw_addr;
@ -248,6 +249,7 @@ struct mqnic_eq_ring {
struct net_device *ndev; struct net_device *ndev;
struct mqnic_priv *priv; struct mqnic_priv *priv;
int ring_index;
int int_index; int int_index;
int irq; int irq;

View File

@ -49,6 +49,8 @@ int mqnic_create_cq_ring(struct mqnic_priv *priv, struct mqnic_cq_ring **ring_pt
ring->ndev = priv->ndev; ring->ndev = priv->ndev;
ring->priv = priv; ring->priv = priv;
ring->ring_index = index;
ring->size = roundup_pow_of_two(size); ring->size = roundup_pow_of_two(size);
ring->size_mask = ring->size - 1; ring->size_mask = ring->size - 1;
ring->stride = roundup_pow_of_two(stride); ring->stride = roundup_pow_of_two(stride);

View File

@ -49,6 +49,8 @@ int mqnic_create_eq_ring(struct mqnic_priv *priv, struct mqnic_eq_ring **ring_pt
ring->ndev = priv->ndev; ring->ndev = priv->ndev;
ring->priv = priv; ring->priv = priv;
ring->ring_index = index;
ring->size = roundup_pow_of_two(size); ring->size = roundup_pow_of_two(size);
ring->size_mask = ring->size - 1; ring->size_mask = ring->size - 1;
ring->stride = roundup_pow_of_two(stride); ring->stride = roundup_pow_of_two(stride);

View File

@ -53,7 +53,6 @@ static int mqnic_start_port(struct net_device *ndev)
// set up RX completion queues // set up RX completion queues
for (k = 0; k < priv->rx_cpl_queue_count; k++) { for (k = 0; k < priv->rx_cpl_queue_count; k++) {
mqnic_activate_cq_ring(priv->rx_cpl_ring[k], k % priv->event_queue_count); mqnic_activate_cq_ring(priv->rx_cpl_ring[k], k % priv->event_queue_count);
priv->rx_cpl_ring[k]->ring_index = k;
priv->rx_cpl_ring[k]->handler = mqnic_rx_irq; priv->rx_cpl_ring[k]->handler = mqnic_rx_irq;
netif_napi_add(ndev, &priv->rx_cpl_ring[k]->napi, netif_napi_add(ndev, &priv->rx_cpl_ring[k]->napi,
@ -76,7 +75,6 @@ static int mqnic_start_port(struct net_device *ndev)
// set up TX completion queues // set up TX completion queues
for (k = 0; k < priv->tx_cpl_queue_count; k++) { for (k = 0; k < priv->tx_cpl_queue_count; k++) {
mqnic_activate_cq_ring(priv->tx_cpl_ring[k], k % priv->event_queue_count); mqnic_activate_cq_ring(priv->tx_cpl_ring[k], k % priv->event_queue_count);
priv->tx_cpl_ring[k]->ring_index = k;
priv->tx_cpl_ring[k]->handler = mqnic_tx_irq; priv->tx_cpl_ring[k]->handler = mqnic_tx_irq;
netif_tx_napi_add(ndev, &priv->tx_cpl_ring[k]->napi, netif_tx_napi_add(ndev, &priv->tx_cpl_ring[k]->napi,

View File

@ -50,6 +50,8 @@ int mqnic_create_rx_ring(struct mqnic_priv *priv, struct mqnic_ring **ring_ptr,
ring->ndev = priv->ndev; ring->ndev = priv->ndev;
ring->priv = priv; ring->priv = priv;
ring->ring_index = index;
ring->size = roundup_pow_of_two(size); ring->size = roundup_pow_of_two(size);
ring->size_mask = ring->size - 1; ring->size_mask = ring->size - 1;
ring->stride = roundup_pow_of_two(stride); ring->stride = roundup_pow_of_two(stride);

View File

@ -51,6 +51,8 @@ int mqnic_create_tx_ring(struct mqnic_priv *priv, struct mqnic_ring **ring_ptr,
ring->ndev = priv->ndev; ring->ndev = priv->ndev;
ring->priv = priv; ring->priv = priv;
ring->ring_index = index;
ring->size = roundup_pow_of_two(size); ring->size = roundup_pow_of_two(size);
ring->full_size = ring->size >> 1; ring->full_size = ring->size >> 1;
ring->size_mask = ring->size - 1; ring->size_mask = ring->size - 1;