virtio_net.c (ea7735d97ba9064c448664429e249991ccd8aa77) | virtio_net.c (7b0411ef4aa69c9256d6a2c289d0a2b320414633) |
---|---|
1/* A network driver using virtio. 2 * 3 * Copyright 2007 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. --- 1061 unchanged lines hidden (view full) --- 1070 return; 1071 1072 u64_stats_update_begin(&stats->tx_syncp); 1073 stats->tx_bytes += bytes; 1074 stats->tx_packets += packets; 1075 u64_stats_update_end(&stats->tx_syncp); 1076} 1077 | 1/* A network driver using virtio. 2 * 3 * Copyright 2007 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. --- 1061 unchanged lines hidden (view full) --- 1070 return; 1071 1072 u64_stats_update_begin(&stats->tx_syncp); 1073 stats->tx_bytes += bytes; 1074 stats->tx_packets += packets; 1075 u64_stats_update_end(&stats->tx_syncp); 1076} 1077 |
1078static void virtnet_poll_cleantx(struct receive_queue *rq) 1079{ 1080 struct virtnet_info *vi = rq->vq->vdev->priv; 1081 unsigned int index = vq2rxq(rq->vq); 1082 struct send_queue *sq = &vi->sq[index]; 1083 struct netdev_queue *txq = netdev_get_tx_queue(vi->dev, index); 1084 1085 if (!sq->napi.weight) 1086 return; 1087 1088 if (__netif_tx_trylock(txq)) { 1089 free_old_xmit_skbs(sq); 1090 __netif_tx_unlock(txq); 1091 } 1092 1093 if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) 1094 netif_tx_wake_queue(txq); 1095} 1096 |
|
1078static int virtnet_poll(struct napi_struct *napi, int budget) 1079{ 1080 struct receive_queue *rq = 1081 container_of(napi, struct receive_queue, napi); 1082 unsigned int received; 1083 | 1097static int virtnet_poll(struct napi_struct *napi, int budget) 1098{ 1099 struct receive_queue *rq = 1100 container_of(napi, struct receive_queue, napi); 1101 unsigned int received; 1102 |
1103 virtnet_poll_cleantx(rq); 1104 |
|
1084 received = virtnet_receive(rq, budget); 1085 1086 /* Out of packets? */ 1087 if (received < budget) 1088 virtqueue_napi_complete(napi, rq->vq, received); 1089 1090 return received; 1091} --- 1599 unchanged lines hidden --- | 1105 received = virtnet_receive(rq, budget); 1106 1107 /* Out of packets? */ 1108 if (received < budget) 1109 virtqueue_napi_complete(napi, rq->vq, received); 1110 1111 return received; 1112} --- 1599 unchanged lines hidden --- |