From owner-freebsd-net@FreeBSD.ORG Fri Nov 21 22:51:58 2014 Return-Path: Delivered-To: net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CAC58C62 for ; Fri, 21 Nov 2014 22:51:58 +0000 (UTC) Received: from nm19-vm0.bullet.mail.bf1.yahoo.com (nm19-vm0.bullet.mail.bf1.yahoo.com [98.139.213.162]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7403392C for ; Fri, 21 Nov 2014 22:51:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1416610317; bh=xj2HDgWevz+rfWw06VatkW3e6HQQlJ645gBLbbtfar4=; h=Date:From:Reply-To:To:Subject:From:Subject; b=dzSqRWFqinwhqJDGa1eAXDWNpMDpZ0Ym0JTwnEmRnlXEDrfSbBFF80r9qTwvNsHTPl4N7MtmjO8YJWpnWAzMyh+CMkD/K3KmBKvsbMXD2rYeIWzrjSdtMj48UxSz4sYdwAi31RJCKhSxU//vp7LdWhX5Sj6eWxR2k1TYUIVggn46PadWQlLBPwlRDXgYQxE+W3/NveLGwokPRzUKCl2N6zt+nrjW/IUVO5ES8895OlFVAyQ0DLlWweumv9889vyt+Bg8GCkywcwJ6xFGY3E1J/1j+ztk03Q5EJBWf1NGA6qtM6Lj0S0ziKG4lbQUZQ9+XcWxxKxkMrFZHhvK3dsrLA== DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s2048; d=yahoo.com; b=IhpJnLzT0uvUXBfT5gJVy2PphokTOi5kthWg19IbONMKuWfoMbsK97bq3/UjqG9HbhA7kAFaKq6A7oceV1fia0TDzYvv9Toa3J4ZKvYtgNNdrKG6Xp7iBh9eEILKH6wpEikKyjoNztNFWoklhuWW5QPSBXU5KcjHDMfu3lPnX9lc0bD4wPYJVgGWvKI4SvIgsVYZu8dqwRkaztZOiMy04F4fKnk1gn87+l9c0pTK5tPdGkmzkxdG1wZOoADx7sgA8WTXTeli2vpPthr38K+9abFFSLZCpbAxG/ihaqbEWV4ZFP8JvfLVNS7celTSzV+yU6Nirf8AaGd+cnf9Ag4Nxg==; Received: from [66.196.81.171] by nm19.bullet.mail.bf1.yahoo.com with NNFMP; 21 Nov 2014 22:51:56 -0000 Received: from [98.139.212.237] by tm17.bullet.mail.bf1.yahoo.com with NNFMP; 21 Nov 2014 22:51:56 -0000 Received: from [127.0.0.1] by omp1046.mail.bf1.yahoo.com with NNFMP; 21 Nov 2014 22:51:56 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 950366.8426.bm@omp1046.mail.bf1.yahoo.com X-YMail-OSG: dza3XRAVM1lxFQVp1Rvevxeev7qJzYqW3gqGgJTGqcCCOJlY2kjcdaPe2eVbsqR ro3R6rnrZdunuj4qZ8e3YFcxjSIb62hiwJ5F8R3_2mvi709bg.d6Wt.Uzygj8x9YVgzYxLywfPEV IbQbQfKWATIas6IaSlN7uqWHLYHGiYim5BKBwcpiqdiR.MGX9YN9WJJQ9vSJ02wH52I3G8_TCANh tfd_VrOzTqpsD7M_LXAYhat3tEfvO3Xnq1eaoaCgXXJBUEYlHnyakGwCnE7KEaGHUNepfgUbchGW Da6JCK48fiH9xqTxrTKa3SNpNcSl4MnNFGzdNbJmKbkpjMHQEMNYKX3j6x69AXHH9CXnJdFzjmBX B4q0zZmWmFUcdwJAmR2bMVoJEHiH8ctY352lXHUQgXhgfAaxcSfWadvzY9Xl4Cm1YesNrdLtF8w6 J5LxcKyIA6OSggqxRIXxwe1l4QN6KIwMdyOPC54WlzhE.z31FqsDDwEUsVCdf4YTaaHy1elWYKQ-- Received: by 66.196.80.114; Fri, 21 Nov 2014 22:51:56 +0000 Date: Fri, 21 Nov 2014 22:51:56 +0000 (UTC) From: eclectic 923 Reply-To: eclectic 923 To: "net@freebsd.org" Message-ID: <30479248.2784505.1416610316088.JavaMail.yahoo@jws106129.mail.bf1.yahoo.com> Subject: Re: Patches for linux virtio_net driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Nov 2014 22:51:59 -0000 Sorry, having problems sending attachments as plain text. Here's virtio_netmap.patch: # This file is a patch to the netmap virtio_net driver include file. # There is a problem with the initialization, and during read packet with # control of the indicies . # # This problem is easily seen by building a KVM netmap/virtio_net driver, and # simply pinging it (host pings KVM guest). All goes well, until ring buffer # reaches index 255, and no packet is actually received. This will fix that # problem and resulted in a working driver. # Index: b/LINUX/virtio_netmap.h =================================================================== --- a/LINUX/virtio_netmap.h 2014-11-21 16:26:03.951278021 -0500 +++ b/LINUX/virtio_netmap.h 2014-11-21 16:26:25.451386665 -0500 @@ -398,8 +398,8 @@ * Second part: skip past packets that userspace has released. */ nm_i = kring->nr_hwcur; /* netmap ring index */ - if (nm_i != head) { - for (n = 0; nm_i != head; n++) { + if (nm_next(nm_i, lim) != head) { + for (n = 0; nm_next(nm_i, lim) != head; n++) { struct netmap_slot *slot = &ring->slot[nm_i]; void *addr = NMB(slot); int err; @@ -421,7 +421,7 @@ virtqueue_kick(vq); nm_i = nm_next(nm_i, lim); } - kring->nr_hwcur = head; + kring->nr_hwcur = nm_i; } /* We have finished processing used RX buffers, so we have to tell @@ -454,6 +454,7 @@ for (r = 0; r < na->num_rx_rings; r++) { COMPAT_DECL_SG struct netmap_ring *ring = na->rx_rings[r].ring; + struct netmap_kring *kring = &na->rx_rings[r]; struct virtqueue *vq = GET_RX_VQ(vi, r); struct scatterlist *sg = GET_RX_SG(vi, r); struct netmap_slot* slot; @@ -485,6 +486,7 @@ if (VQ_FULL(vq, err)) break; } + kring->nr_hwcur = i; D("added %d inbufs on queue %d", i, r); virtqueue_kick(vq); }