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

Use ring indicies during setup

This commit is contained in:
Alex Forencich 2021-12-10 21:05:57 -08:00
parent ddeb8bad94
commit 74bb15bf00

View File

@ -51,7 +51,8 @@ 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],
priv->event_ring[k % priv->event_queue_count]->ring_index);
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,
@ -68,12 +69,14 @@ static int mqnic_start_port(struct net_device *ndev)
priv->rx_ring[k]->page_order = 0; priv->rx_ring[k]->page_order = 0;
else else
priv->rx_ring[k]->page_order = ilog2((ndev->mtu + ETH_HLEN + PAGE_SIZE - 1) / PAGE_SIZE - 1) + 1; priv->rx_ring[k]->page_order = ilog2((ndev->mtu + ETH_HLEN + PAGE_SIZE - 1) / PAGE_SIZE - 1) + 1;
mqnic_activate_rx_ring(priv->rx_ring[k], k); mqnic_activate_rx_ring(priv->rx_ring[k],
priv->rx_cpl_ring[k % priv->rx_cpl_queue_count]->ring_index);
} }
// 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],
priv->event_ring[k % priv->event_queue_count]->ring_index);
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,
@ -85,7 +88,8 @@ static int mqnic_start_port(struct net_device *ndev)
// set up TX queues // set up TX queues
for (k = 0; k < priv->tx_queue_count; k++) { for (k = 0; k < priv->tx_queue_count; k++) {
mqnic_activate_tx_ring(priv->tx_ring[k], k); mqnic_activate_tx_ring(priv->tx_ring[k],
priv->tx_cpl_ring[k % priv->tx_cpl_queue_count]->ring_index);
priv->tx_ring[k]->tx_queue = netdev_get_tx_queue(ndev, k); priv->tx_ring[k]->tx_queue = netdev_get_tx_queue(ndev, k);
} }