Date: Fri, 21 Nov 2014 22:50:21 +0000 (UTC) From: eclectic 923 <eclectic923@yahoo.com> To: "net@freebsd.org" <net@freebsd.org> Subject: Re: Patches for linux virtio_net driver Message-ID: <1737441065.3841217.1416610221856.JavaMail.yahoo@jws10674.mail.bf1.yahoo.com>
next in thread | raw e-mail | index | archive | help
Sorry, having problems sending attachments as plain text. Here's virtio_net_3.10.60.patch: # The netmap 3.10 patch for the virtio_net driver fails to apply. This # patch is the whole netmap virtio driver patch for 3.10.60 (from # kernel.org), and it applies correctly. # Index: linux-3.10.60/drivers/net/virtio_net.c =================================================================== --- linux-3.10.60.orig/drivers/net/virtio_net.c 2014-11-14 11:48:23.000000000 -0500 +++ linux-3.10.60/drivers/net/virtio_net.c 2014-11-21 12:54:29.751760095 -0500 @@ -131,6 +131,10 @@ struct notifier_block nb; }; +#if defined(CONFIG_NETMAP) || defined(CONFIG_NETMAP_MODULE) +#include <virtio_netmap.h> +#endif + struct skb_vnet_hdr { union { struct virtio_net_hdr hdr; @@ -210,6 +214,10 @@ /* Suppress further interrupts. */ virtqueue_disable_cb(vq); +#ifdef DEV_NETMAP + if (netmap_tx_irq(vi->dev, vq2txq(vq))) + return; +#endif /* We were probably waiting for more output buffers. */ netif_wake_subqueue(vi->dev, vq2txq(vq)); } @@ -646,7 +654,16 @@ struct virtnet_info *vi = rq->vq->vdev->priv; void *buf; unsigned int r, len, received = 0; +#ifdef DEV_NETMAP + int work_done = 0; + + if (netmap_rx_irq(vi->dev, vq2rxq(rq->vq), &work_done)) { + napi_complete(napi); + ND("called netmap_rx_irq"); + return 1; + } +#endif again: while (received < budget && (buf = virtqueue_get_buf(rq->vq, &len)) != NULL) { @@ -679,6 +696,16 @@ { struct virtnet_info *vi = netdev_priv(dev); int i; +#ifdef DEV_NETMAP + int ok = virtio_netmap_init_buffers(vi); + + netmap_enable_all_rings(dev); + if (ok) { + for (i = 0; i < vi->max_queue_pairs; i++) + virtnet_napi_enable(&vi->rq[i]); + return 0; + } +#endif for (i = 0; i < vi->max_queue_pairs; i++) { if (i < vi->curr_queue_pairs) @@ -972,6 +999,9 @@ struct virtnet_info *vi = netdev_priv(dev); int i; +#ifdef DEV_NETMAP + netmap_disable_all_rings(dev); +#endif /* Make sure refill_work doesn't re-enable napi! */ cancel_delayed_work_sync(&vi->refill); @@ -1644,6 +1674,10 @@ goto free_recv_bufs; } +#ifdef DEV_NETMAP + virtio_netmap_attach(vi); +#endif + /* Assume link up if device can't report link status, otherwise get link status from config. */ if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_STATUS)) { @@ -1690,6 +1724,9 @@ { struct virtnet_info *vi = vdev->priv; +#ifdef DEV_NETMAP + netmap_detach(vi->dev); +#endif unregister_hotcpu_notifier(&vi->nb); /* Prevent config work handler from accessing the device. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1737441065.3841217.1416610221856.JavaMail.yahoo>