From owner-svn-soc-all@FreeBSD.ORG Tue Jun 23 19:11:10 2015 Return-Path: Delivered-To: svn-soc-all@nevdull.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 712E1DCB for ; Tue, 23 Jun 2015 19:11:10 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4507AECC for ; Tue, 23 Jun 2015 19:11:10 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5NJBA11057017 for ; Tue, 23 Jun 2015 19:11:10 GMT (envelope-from stefano@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.9/8.14.9/Submit) id t5NJB9b9056999 for svn-soc-all@FreeBSD.org; Tue, 23 Jun 2015 19:11:09 GMT (envelope-from stefano@FreeBSD.org) Date: Tue, 23 Jun 2015 19:11:09 GMT Message-Id: <201506231911.t5NJB9b9056999@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to stefano@FreeBSD.org using -f From: stefano@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r287504 - soc2015/stefano/ptnetmap/head/sys/dev/netmap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2015 19:11:10 -0000 Author: stefano Date: Tue Jun 23 19:11:09 2015 New Revision: 287504 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=287504 Log: [ptnetmap/virtio] fix iowrite/ioread and mbuf allocation change vtnet_ptnetmap_[iowrite4 | ioread4]: like in linux version, we write/read 1 byte each time use m_gethdr() instead of m_getjcl() to alloc the fake packet Modified: soc2015/stefano/ptnetmap/head/sys/dev/netmap/if_vtnet_netmap.h Modified: soc2015/stefano/ptnetmap/head/sys/dev/netmap/if_vtnet_netmap.h ============================================================================== --- soc2015/stefano/ptnetmap/head/sys/dev/netmap/if_vtnet_netmap.h Tue Jun 23 19:04:46 2015 (r287503) +++ soc2015/stefano/ptnetmap/head/sys/dev/netmap/if_vtnet_netmap.h Tue Jun 23 19:11:09 2015 (r287504) @@ -427,13 +427,23 @@ static void inline vtnet_ptnetmap_iowrite4(device_t dev, uint32_t addr, uint32_t val) { - virtio_write_dev_config_4(dev, PTNETMAP_VIRTIO_IO_BASE + addr, val); + int i; + /* virtio_pci config_set use multiple iowrite8, we need to split the call and reverse the order */ + for (i = 3; i >= 0; i--) { + virtio_write_dev_config_1(dev, PTNETMAP_VIRTIO_IO_BASE + addr + i, *(((uint8_t *)&val) + i)); + } } static uint32_t inline vtnet_ptnetmap_ioread4(device_t dev, uint32_t addr) { - return virtio_read_dev_config_4(dev, PTNETMAP_VIRTIO_IO_BASE + addr); + uint32_t val; + int i; + + for (i = 0; i <= 3; i++) { + *(((uint8_t *)&val) + i) = virtio_read_dev_config_1(dev, PTNETMAP_VIRTIO_IO_BASE + addr + i); + } + return val; } static int @@ -460,8 +470,8 @@ ptna->csb->guest_csb_on = 1; /* Tell the device the CSB physical address. */ - vtnet_ptnetmap_iowrite4(dev, PTNETMAP_VIRTIO_IO_CSBBAH, (csb_phyaddr >> 32)); - vtnet_ptnetmap_iowrite4(dev, PTNETMAP_VIRTIO_IO_CSBBAL, (csb_phyaddr & 0x00000000ffffffffULL)); + vtnet_ptnetmap_iowrite4(dev, PTNETMAP_VIRTIO_IO_CSBBAH, (uint32_t)(csb_phyaddr >> 32)); + vtnet_ptnetmap_iowrite4(dev, PTNETMAP_VIRTIO_IO_CSBBAL, (uint32_t)(csb_phyaddr)); return 0; } @@ -664,7 +674,7 @@ for (i = 0; i < sc->vtnet_max_vq_pairs; i++) { struct vtnet_txq *txq = &sc->vtnet_txqs[i]; struct mbuf *m0; - m0 = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, 64); + m0 = m_gethdr(M_NOWAIT, MT_DATA); m0->m_len = 64; if (m0) {