ulong_t pkt_sent, pkt_recv, pkt_drop;
+#if 1 //for temporary performance testing purpose
+ long last_sent_time, last_recv_time;
+#endif
+
struct v3_dev_net_ops * net_ops;
v3_lock_t lock;
struct virtio_queue * q = &(virtio_state->tx_vq);
struct virtio_net_hdr * hdr = NULL;
+ PrintDebug("Virtio NIC: TX: running on cpu: %d\n", V3_Get_CPU());
while (q->cur_avail_idx != q->avail->index) {
struct vring_desc * hdr_desc = NULL;
hdr = (struct virtio_net_hdr*)hdr_addr;
desc_idx = hdr_desc->next;
-
+
for (i = 0; i < desc_cnt - 1; i++) {
struct vring_desc * buf_desc = &(q->desc[desc_idx]);
if (pkt_tx(core, virtio_state, buf_desc) == -1) {
virtio_state->virtio_cfg.pci_isr = 0x1;
}
+#ifdef CONFIG_VNET_PROFILE
+ if (virtio_state->pkt_sent % 50000 == 0){
+ long cur_time, time;
+ rdtscll(cur_time);
+ time = cur_time - virtio_state->last_sent_time;
+ PrintError("Virtio NIC: last sent 50000 cycles: %ld\n",time);
+ //PrintError("Virtio NIC: sent: %ld, rxed: %ld, dropped: %ld\n",
+ // virtio_state->pkt_sent,
+ // virtio_state->pkt_recv,
+ // virtio_state->pkt_drop);
+ rdtscll(virtio_state->last_sent_time);
+ }
+#endif
+
return 0;
}
int raw = 1;
flags = v3_lock_irqsave(virtio->lock);
-
- PrintDebug("VIRTIO NIC: receiving packet to virtio nic %p, size:%d\n", virtio, size);
+
+ PrintDebug("VIRTIO NIC: RX on cpu %d to virtio nic %p, size:%d\n", V3_Get_CPU(), virtio, size);
virtio->pkt_recv ++;
q->cur_avail_idx++;
} else {
virtio->pkt_drop++;
+ goto exit;
}
if (!(q->avail->flags & VIRTIO_NO_IRQ_FLAG)) {
ret_val = offset;
exit:
+
+#ifdef CONFIG_VNET_PROFILE
+ if (virtio->pkt_recv % 50000 == 0){
+ long cur_time, time;
+ rdtscll(cur_time);
+ time = cur_time - virtio->last_recv_time;
+ PrintError("Virtio NIC: last recv 50000 cycles: %ld\n",time);
+ //PrintError("Virtio NIC: sent: %ld, rxed: %ld, dropped: %ld\n",
+ //virtio->pkt_sent,
+ //virtio->pkt_recv,
+ //virtio->pkt_drop);
+ rdtscll(virtio->last_recv_time);
+ }
+#endif
v3_unlock_irqrestore(virtio->lock, flags);