mirror of
https://github.com/corundum/corundum.git
synced 2025-01-30 08:32:52 +08:00
Minor refactor of CQ processing
This commit is contained in:
parent
37294142b8
commit
8536b7d2b7
@ -338,7 +338,7 @@ void mqnic_tx_read_tail_ptr(struct mqnic_ring *ring);
|
||||
void mqnic_tx_write_head_ptr(struct mqnic_ring *ring);
|
||||
void mqnic_free_tx_desc(struct mqnic_priv *priv, struct mqnic_ring *ring, int index, int napi_budget);
|
||||
int mqnic_free_tx_buf(struct mqnic_priv *priv, struct mqnic_ring *ring);
|
||||
bool mqnic_process_tx_cq(struct net_device *ndev, struct mqnic_cq_ring *cq_ring, int napi_budget);
|
||||
int mqnic_process_tx_cq(struct net_device *ndev, struct mqnic_cq_ring *cq_ring, int napi_budget);
|
||||
void mqnic_tx_irq(struct mqnic_cq_ring *cq);
|
||||
int mqnic_poll_tx_cq(struct napi_struct *napi, int budget);
|
||||
netdev_tx_t mqnic_start_xmit(struct sk_buff *skb, struct net_device *dev);
|
||||
@ -356,7 +356,7 @@ void mqnic_free_rx_desc(struct mqnic_priv *priv, struct mqnic_ring *ring, int in
|
||||
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);
|
||||
void mqnic_refill_rx_buffers(struct mqnic_priv *priv, struct mqnic_ring *ring);
|
||||
bool mqnic_process_rx_cq(struct net_device *ndev, struct mqnic_cq_ring *cq_ring, int napi_budget);
|
||||
int mqnic_process_rx_cq(struct net_device *ndev, struct mqnic_cq_ring *cq_ring, int napi_budget);
|
||||
void mqnic_rx_irq(struct mqnic_cq_ring *cq);
|
||||
int mqnic_poll_rx_cq(struct napi_struct *napi, int budget);
|
||||
|
||||
|
@ -257,7 +257,7 @@ void mqnic_refill_rx_buffers(struct mqnic_priv *priv, struct mqnic_ring *ring)
|
||||
mqnic_rx_write_head_ptr(ring);
|
||||
}
|
||||
|
||||
bool mqnic_process_rx_cq(struct net_device *ndev, struct mqnic_cq_ring *cq_ring, int napi_budget)
|
||||
int mqnic_process_rx_cq(struct net_device *ndev, struct mqnic_cq_ring *cq_ring, int napi_budget)
|
||||
{
|
||||
struct mqnic_priv *priv = netdev_priv(ndev);
|
||||
struct mqnic_ring *ring = priv->rx_ring[cq_ring->ring_index];
|
||||
@ -273,7 +273,7 @@ bool mqnic_process_rx_cq(struct net_device *ndev, struct mqnic_cq_ring *cq_ring,
|
||||
|
||||
if (unlikely(!priv->port_up))
|
||||
{
|
||||
return true;
|
||||
return done;
|
||||
}
|
||||
|
||||
// process completion queue
|
||||
@ -372,7 +372,7 @@ bool mqnic_process_rx_cq(struct net_device *ndev, struct mqnic_cq_ring *cq_ring,
|
||||
// replenish buffers
|
||||
mqnic_refill_rx_buffers(priv, ring);
|
||||
|
||||
return done < budget;
|
||||
return done;
|
||||
}
|
||||
|
||||
void mqnic_rx_irq(struct mqnic_cq_ring *cq)
|
||||
@ -393,16 +393,19 @@ int mqnic_poll_rx_cq(struct napi_struct *napi, int budget)
|
||||
{
|
||||
struct mqnic_cq_ring *cq_ring = container_of(napi, struct mqnic_cq_ring, napi);
|
||||
struct net_device *ndev = cq_ring->ndev;
|
||||
int done;
|
||||
|
||||
if (!mqnic_process_rx_cq(ndev, cq_ring, budget))
|
||||
done = mqnic_process_rx_cq(ndev, cq_ring, budget);
|
||||
|
||||
if (done == budget)
|
||||
{
|
||||
return budget;
|
||||
return done;
|
||||
}
|
||||
|
||||
napi_complete(napi);
|
||||
|
||||
mqnic_arm_cq(cq_ring);
|
||||
|
||||
return 0;
|
||||
return done;
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ int mqnic_free_tx_buf(struct mqnic_priv *priv, struct mqnic_ring *ring)
|
||||
return cnt;
|
||||
}
|
||||
|
||||
bool mqnic_process_tx_cq(struct net_device *ndev, struct mqnic_cq_ring *cq_ring, int napi_budget)
|
||||
int mqnic_process_tx_cq(struct net_device *ndev, struct mqnic_cq_ring *cq_ring, int napi_budget)
|
||||
{
|
||||
struct mqnic_priv *priv = netdev_priv(ndev);
|
||||
struct mqnic_ring *ring = priv->tx_ring[cq_ring->ring_index];
|
||||
@ -211,7 +211,7 @@ bool mqnic_process_tx_cq(struct net_device *ndev, struct mqnic_cq_ring *cq_ring,
|
||||
|
||||
if (unlikely(!priv->port_up))
|
||||
{
|
||||
return true;
|
||||
return done;
|
||||
}
|
||||
|
||||
// prefetch for BQL
|
||||
@ -285,7 +285,7 @@ bool mqnic_process_tx_cq(struct net_device *ndev, struct mqnic_cq_ring *cq_ring,
|
||||
netif_tx_wake_queue(ring->tx_queue);
|
||||
}
|
||||
|
||||
return done < budget;
|
||||
return done;
|
||||
}
|
||||
|
||||
void mqnic_tx_irq(struct mqnic_cq_ring *cq)
|
||||
@ -306,17 +306,20 @@ int mqnic_poll_tx_cq(struct napi_struct *napi, int budget)
|
||||
{
|
||||
struct mqnic_cq_ring *cq_ring = container_of(napi, struct mqnic_cq_ring, napi);
|
||||
struct net_device *ndev = cq_ring->ndev;
|
||||
int done;
|
||||
|
||||
if (!mqnic_process_tx_cq(ndev, cq_ring, budget))
|
||||
done = mqnic_process_tx_cq(ndev, cq_ring, budget);
|
||||
|
||||
if (done == budget)
|
||||
{
|
||||
return budget;
|
||||
return done;
|
||||
}
|
||||
|
||||
napi_complete(napi);
|
||||
|
||||
mqnic_arm_cq(cq_ring);
|
||||
|
||||
return 0;
|
||||
return done;
|
||||
}
|
||||
|
||||
netdev_tx_t mqnic_start_xmit(struct sk_buff *skb, struct net_device *ndev)
|
||||
|
Loading…
x
Reference in New Issue
Block a user