mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 16:41:25 +00:00
Merge branch 'xen-netback-fixes'
David Vrabel says: ==================== xen-netback: use skb to determine number of required (etc.) "xen-netback: use skb to determine number of required" plus two other minor fixes I found down the back of the sofa. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
973365dc2d
2 changed files with 15 additions and 22 deletions
|
@ -615,6 +615,7 @@ err_tx_unbind:
|
||||||
queue->tx_irq = 0;
|
queue->tx_irq = 0;
|
||||||
err_unmap:
|
err_unmap:
|
||||||
xenvif_unmap_frontend_rings(queue);
|
xenvif_unmap_frontend_rings(queue);
|
||||||
|
netif_napi_del(&queue->napi);
|
||||||
err:
|
err:
|
||||||
module_put(THIS_MODULE);
|
module_put(THIS_MODULE);
|
||||||
return err;
|
return err;
|
||||||
|
@ -684,22 +685,16 @@ void xenvif_deinit_queue(struct xenvif_queue *queue)
|
||||||
|
|
||||||
void xenvif_free(struct xenvif *vif)
|
void xenvif_free(struct xenvif *vif)
|
||||||
{
|
{
|
||||||
struct xenvif_queue *queue = NULL;
|
struct xenvif_queue *queues = vif->queues;
|
||||||
unsigned int num_queues = vif->num_queues;
|
unsigned int num_queues = vif->num_queues;
|
||||||
unsigned int queue_index;
|
unsigned int queue_index;
|
||||||
|
|
||||||
unregister_netdev(vif->dev);
|
unregister_netdev(vif->dev);
|
||||||
|
|
||||||
for (queue_index = 0; queue_index < num_queues; ++queue_index) {
|
|
||||||
queue = &vif->queues[queue_index];
|
|
||||||
xenvif_deinit_queue(queue);
|
|
||||||
}
|
|
||||||
|
|
||||||
vfree(vif->queues);
|
|
||||||
vif->queues = NULL;
|
|
||||||
vif->num_queues = 0;
|
|
||||||
|
|
||||||
free_netdev(vif->dev);
|
free_netdev(vif->dev);
|
||||||
|
|
||||||
|
for (queue_index = 0; queue_index < num_queues; ++queue_index)
|
||||||
|
xenvif_deinit_queue(&queues[queue_index]);
|
||||||
|
vfree(queues);
|
||||||
|
|
||||||
module_put(THIS_MODULE);
|
module_put(THIS_MODULE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,20 +149,19 @@ static inline pending_ring_idx_t pending_index(unsigned i)
|
||||||
return i & (MAX_PENDING_REQS-1);
|
return i & (MAX_PENDING_REQS-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xenvif_rx_ring_slots_needed(struct xenvif *vif)
|
|
||||||
{
|
|
||||||
if (vif->gso_mask)
|
|
||||||
return DIV_ROUND_UP(vif->dev->gso_max_size, XEN_PAGE_SIZE) + 1;
|
|
||||||
else
|
|
||||||
return DIV_ROUND_UP(vif->dev->mtu, XEN_PAGE_SIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool xenvif_rx_ring_slots_available(struct xenvif_queue *queue)
|
static bool xenvif_rx_ring_slots_available(struct xenvif_queue *queue)
|
||||||
{
|
{
|
||||||
RING_IDX prod, cons;
|
RING_IDX prod, cons;
|
||||||
|
struct sk_buff *skb;
|
||||||
int needed;
|
int needed;
|
||||||
|
|
||||||
needed = xenvif_rx_ring_slots_needed(queue->vif);
|
skb = skb_peek(&queue->rx_queue);
|
||||||
|
if (!skb)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
needed = DIV_ROUND_UP(skb->len, XEN_PAGE_SIZE);
|
||||||
|
if (skb_is_gso(skb))
|
||||||
|
needed++;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
prod = queue->rx.sring->req_prod;
|
prod = queue->rx.sring->req_prod;
|
||||||
|
@ -2005,8 +2004,7 @@ static bool xenvif_rx_queue_ready(struct xenvif_queue *queue)
|
||||||
|
|
||||||
static bool xenvif_have_rx_work(struct xenvif_queue *queue)
|
static bool xenvif_have_rx_work(struct xenvif_queue *queue)
|
||||||
{
|
{
|
||||||
return (!skb_queue_empty(&queue->rx_queue)
|
return xenvif_rx_ring_slots_available(queue)
|
||||||
&& xenvif_rx_ring_slots_available(queue))
|
|
||||||
|| (queue->vif->stall_timeout &&
|
|| (queue->vif->stall_timeout &&
|
||||||
(xenvif_rx_queue_stalled(queue)
|
(xenvif_rx_queue_stalled(queue)
|
||||||
|| xenvif_rx_queue_ready(queue)))
|
|| xenvif_rx_queue_ready(queue)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue