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

Use configured ring stride

This commit is contained in:
Alex Forencich 2020-03-10 23:07:30 -07:00
parent 65ead3a064
commit 3d959c2d4f
3 changed files with 5 additions and 5 deletions

View File

@ -177,7 +177,7 @@ void mqnic_process_eq(struct net_device *ndev, struct mqnic_eq_ring *eq_ring)
while (eq_ring->head_ptr != eq_tail_ptr) while (eq_ring->head_ptr != eq_tail_ptr)
{ {
event = (struct mqnic_event *)(eq_ring->buf + eq_index * MQNIC_EVENT_SIZE); event = (struct mqnic_event *)(eq_ring->buf + eq_index*eq_ring->stride);
if (event->type == MQNIC_EVENT_TYPE_TX_CPL) if (event->type == MQNIC_EVENT_TYPE_TX_CPL)
{ {

View File

@ -197,7 +197,7 @@ int mqnic_free_rx_buf(struct mqnic_priv *priv, struct mqnic_ring *ring)
int mqnic_prepare_rx_desc(struct mqnic_priv *priv, struct mqnic_ring *ring, int index) int mqnic_prepare_rx_desc(struct mqnic_priv *priv, struct mqnic_ring *ring, int index)
{ {
struct mqnic_rx_info *rx_info = &ring->rx_info[index]; struct mqnic_rx_info *rx_info = &ring->rx_info[index];
struct mqnic_desc *rx_desc = (struct mqnic_desc *)(ring->buf + index * sizeof(*rx_desc)); struct mqnic_desc *rx_desc = (struct mqnic_desc *)(ring->buf + index*ring->stride);
struct page *page = rx_info->page; struct page *page = rx_info->page;
u32 page_order = ring->page_order; u32 page_order = ring->page_order;
u32 len = PAGE_SIZE << page_order; u32 len = PAGE_SIZE << page_order;
@ -291,7 +291,7 @@ int mqnic_process_rx_cq(struct net_device *ndev, struct mqnic_cq_ring *cq_ring,
while (cq_ring->head_ptr != cq_tail_ptr && done < budget) while (cq_ring->head_ptr != cq_tail_ptr && done < budget)
{ {
cpl = (struct mqnic_cpl *)(cq_ring->buf + cq_index * MQNIC_CPL_SIZE); cpl = (struct mqnic_cpl *)(cq_ring->buf + cq_index*cq_ring->stride);
ring_index = cpl->index & ring->size_mask; ring_index = cpl->index & ring->size_mask;
rx_info = &ring->rx_info[ring_index]; rx_info = &ring->rx_info[ring_index];
page = rx_info->page; page = rx_info->page;

View File

@ -226,7 +226,7 @@ int mqnic_process_tx_cq(struct net_device *ndev, struct mqnic_cq_ring *cq_ring,
while (cq_ring->head_ptr != cq_tail_ptr && done < budget) while (cq_ring->head_ptr != cq_tail_ptr && done < budget)
{ {
cpl = (struct mqnic_cpl *)(cq_ring->buf + cq_index * MQNIC_CPL_SIZE); cpl = (struct mqnic_cpl *)(cq_ring->buf + cq_index*cq_ring->stride);
ring_index = cpl->index & ring->size_mask; ring_index = cpl->index & ring->size_mask;
tx_info = &ring->tx_info[ring_index]; tx_info = &ring->tx_info[ring_index];
@ -357,7 +357,7 @@ netdev_tx_t mqnic_start_xmit(struct sk_buff *skb, struct net_device *ndev)
index = ring->head_ptr & ring->size_mask; index = ring->head_ptr & ring->size_mask;
tx_desc = (struct mqnic_desc *)(ring->buf + index * sizeof(*tx_desc)); tx_desc = (struct mqnic_desc *)(ring->buf + index*ring->stride);
tx_info = &ring->tx_info[index]; tx_info = &ring->tx_info[index];