Re: svn commit: r316990 - head
On Sunday, April 16, 2017, Neel Natu wrote: > Author: neel > Date: Sat Apr 15 22:42:23 2017 > New Revision: 316990 > URL: https://svnweb.freebsd.org/changeset/base/316990 > > Log: > Due to time constraints remove myself as a vmm(4) maintainer. Too bad, when i saw the email I was going to reply "welcome back!" > Modified: > head/MAINTAINERS > > Modified: head/MAINTAINERS > > == > --- head/MAINTAINERSSat Apr 15 22:34:22 2017(r316989) > +++ head/MAINTAINERSSat Apr 15 22:42:23 2017(r316990) > @@ -100,7 +100,7 @@ usr.sbin/bsdconfig dteske Pre-commit pha > usr.sbin/dpv dteske Pre-commit review requested. Keep in sync with > libdpv. > usr.sbin/pkg pkg@Please coordinate behavior or flag changes with > pkg team. > usr.sbin/sysrc dteske Pre-commit phabricator review requested. Keep in > sync with bsdconfig(8) sysrc.subr. > -vmm(4) neel,grehan Pre-commit review requested. > +vmm(4) grehan Pre-commit review requested. > autofs(5) trasz Pre-commit review recommended. > iscsi(4) trasz Pre-commit review recommended. > rctl(8)trasz Pre-commit review recommended. > > -- -+--- Prof. Luigi RIZZO, ri...@iet.unipi.it . Dip. di Ing. dell'Informazione http://www.iet.unipi.it/~luigi/. Universita` di Pisa TEL +39-050-2217533 . via Diotisalvi 2 Mobile +39-338-6809875 . 56122 PISA (Italy) -+--- ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r314915 - head/tools/tools/netmap
On Wed, Mar 8, 2017 at 9:29 AM, Sean Bruno wrote: > Author: sbruno > Date: Wed Mar 8 17:29:40 2017 > New Revision: 314915 > URL: https://svnweb.freebsd.org/changeset/base/314915 > > Log: > Use the buildworld includes and defaults when building pkt-gen. This will > mean that you need a world built to reliably build pkg-gen but this keeps > the build from failing when your source doesn't match your host running > version, e.g. building 12 on 11. This is a good change, but maybe it could help to leave a comment like the following one in the Makefile: # Some netmap helper functions are in sys/net/netmap_user.h. # To build applications using the headers in the source tree, use # make CFLAGS="-nostdinc -I ../../../sys -I/usr/include" ... This is because netmap does not have a proper support library, but some minimal helper functions in netmap_user.h , and people may want to override them. cheers luigi > > Submitted by: Matt Macy > MFC after:2 weeks > Sponsored by: Limelight Networks > > Modified: > head/tools/tools/netmap/Makefile > > Modified: head/tools/tools/netmap/Makefile > == > --- head/tools/tools/netmap/MakefileWed Mar 8 14:52:03 2017 > (r314914) > +++ head/tools/tools/netmap/MakefileWed Mar 8 17:29:40 2017 > (r314915) > @@ -8,7 +8,6 @@ PROGS = pkt-gen nmreplay bridge vale-ctl > CLEANFILES = $(PROGS) *.o > MAN= > CFLAGS += -Werror -Wall > -CFLAGS += -nostdinc -I ../../../sys -I/usr/include > CFLAGS += -Wextra > > LDFLAGS += -lpthread > -- -+--- Prof. Luigi RIZZO, ri...@iet.unipi.it . Dip. di Ing. dell'Informazione http://www.iet.unipi.it/~luigi/. Universita` di Pisa TEL +39-050-2217533 . via Diotisalvi 2 Mobile +39-338-6809875 . 56122 PISA (Italy) -+--- ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r308000 - in head/sys: dev/netmap net
Author: luigi Date: Thu Oct 27 09:46:22 2016 New Revision: 308000 URL: https://svnweb.freebsd.org/changeset/base/308000 Log: Various fixes for ptnet/ptnetmap (passthrough of netmap ports). In detail: - use PCI_VENDOR and PCI_DEVICE ids from a publicly allocated range (thanks to RedHat) - export memory pool information through PCI registers - improve mechanism for configuring passthrough on different hypervisors Code is from Vincenzo Maffione as a follow up to his GSOC work. Modified: head/sys/dev/netmap/if_ptnet.c head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_freebsd.c head/sys/dev/netmap/netmap_kern.h head/sys/dev/netmap/netmap_mem2.c head/sys/dev/netmap/netmap_mem2.h head/sys/dev/netmap/netmap_pt.c head/sys/dev/netmap/netmap_vale.c head/sys/net/netmap.h head/sys/net/netmap_virt.h Modified: head/sys/dev/netmap/if_ptnet.c == --- head/sys/dev/netmap/if_ptnet.c Thu Oct 27 09:11:36 2016 (r307999) +++ head/sys/dev/netmap/if_ptnet.c Thu Oct 27 09:46:22 2016 (r308000) @@ -291,7 +291,7 @@ static inline void ptnet_kick(struct ptn static int ptnet_attach(device_t dev) { - uint32_t ptfeatures = PTNETMAP_F_BASE; + uint32_t ptfeatures = 0; unsigned int num_rx_rings, num_tx_rings; struct netmap_adapter na_arg; unsigned int nifp_offset; @@ -315,19 +315,12 @@ ptnet_attach(device_t dev) return (ENXIO); } - /* Check if we are supported by the hypervisor. If not, -* bail out immediately. */ + /* Negotiate features with the hypervisor. */ if (ptnet_vnet_hdr) { ptfeatures |= PTNETMAP_F_VNET_HDR; } bus_write_4(sc->iomem, PTNET_IO_PTFEAT, ptfeatures); /* wanted */ ptfeatures = bus_read_4(sc->iomem, PTNET_IO_PTFEAT); /* acked */ - if (!(ptfeatures & PTNETMAP_F_BASE)) { - device_printf(dev, "Hypervisor does not support netmap " - "passthorugh\n"); - err = ENXIO; - goto err_path; - } sc->ptfeatures = ptfeatures; /* Allocate CSB and carry out CSB allocation protocol (CSBBAH first, @@ -474,7 +467,8 @@ ptnet_attach(device_t dev) na_arg.nm_txsync = ptnet_nm_txsync; na_arg.nm_rxsync = ptnet_nm_rxsync; - netmap_pt_guest_attach(&na_arg, sc->csb, nifp_offset, ptnet_nm_ptctl); + netmap_pt_guest_attach(&na_arg, sc->csb, nifp_offset, +bus_read_4(sc->iomem, PTNET_IO_HOSTMEMID)); /* Now a netmap adapter for this ifp has been allocated, and it * can be accessed through NA(ifp). We also have to initialize the CSB @@ -1082,13 +1076,12 @@ static uint32_t ptnet_nm_ptctl(if_t ifp, uint32_t cmd) { struct ptnet_softc *sc = if_getsoftc(ifp); - int ret; - + /* +* Write a command and read back error status, +* with zero meaning success. +*/ bus_write_4(sc->iomem, PTNET_IO_PTCTL, cmd); - ret = bus_read_4(sc->iomem, PTNET_IO_PTSTS); - device_printf(sc->dev, "PTCTL %u, ret %u\n", cmd, ret); - - return ret; + return bus_read_4(sc->iomem, PTNET_IO_PTCTL); } static int @@ -1196,7 +1189,7 @@ ptnet_nm_register(struct netmap_adapter /* Make sure the host adapter passed through is ready * for txsync/rxsync. */ - ret = ptnet_nm_ptctl(ifp, PTNETMAP_PTCTL_REGIF); + ret = ptnet_nm_ptctl(ifp, PTNETMAP_PTCTL_CREATE); if (ret) { return ret; } @@ -1246,7 +1239,7 @@ ptnet_nm_register(struct netmap_adapter } if (sc->ptna->backend_regifs == 0) { - ret = ptnet_nm_ptctl(ifp, PTNETMAP_PTCTL_UNREGIF); + ret = ptnet_nm_ptctl(ifp, PTNETMAP_PTCTL_DELETE); } } Modified: head/sys/dev/netmap/netmap.c == --- head/sys/dev/netmap/netmap.cThu Oct 27 09:11:36 2016 (r307999) +++ head/sys/dev/netmap/netmap.cThu Oct 27 09:46:22 2016 (r308000) @@ -2186,7 +2186,11 @@ netmap_ioctl(struct netmap_priv_d *priv, break; case NIOCREGIF: - /* possibly attach/detach NIC and VALE switch */ + /* +* If nmr->nr_cmd is not zero, this NIOCREGIF is not really +* a regif operation, but a different one, specified by the +* value of nmr->nr_cmd. +*/ i = nmr->nr_cmd; if (i == NETMAP_BDG_ATTACH || i == NETMAP_BDG_DETACH || i == NETMAP_BDG_VNET_HDR @@ -2194,12 +2198,15 @@ netmap_ioctl(struct netmap_priv_d *priv,
svn commit: r307574 - in head/sys: dev/netmap net
Author: luigi Date: Tue Oct 18 16:18:25 2016 New Revision: 307574 URL: https://svnweb.freebsd.org/changeset/base/307574 Log: remove stale and unused code from various files fix build on 32 bit platforms simplify logic in netmap_virt.h The commands (in net/netmap.h) to configure communication with the hypervisor may be revised soon. At the moment they are unused so this will not be a change of API. Modified: head/sys/dev/netmap/if_lem_netmap.h head/sys/dev/netmap/if_ptnet.c head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_freebsd.c head/sys/dev/netmap/netmap_generic.c head/sys/dev/netmap/netmap_kern.h head/sys/dev/netmap/netmap_pt.c head/sys/net/netmap.h head/sys/net/netmap_virt.h Modified: head/sys/dev/netmap/if_lem_netmap.h == --- head/sys/dev/netmap/if_lem_netmap.h Tue Oct 18 15:50:20 2016 (r307573) +++ head/sys/dev/netmap/if_lem_netmap.h Tue Oct 18 16:18:25 2016 (r307574) @@ -35,12 +35,8 @@ #include #include -#include -#include /* vtophys ? */ #include -extern int netmap_adaptive_io; - /* * Register/unregister. We are already under netmap lock. */ Modified: head/sys/dev/netmap/if_ptnet.c == --- head/sys/dev/netmap/if_ptnet.c Tue Oct 18 15:50:20 2016 (r307573) +++ head/sys/dev/netmap/if_ptnet.c Tue Oct 18 16:18:25 2016 (r307574) @@ -341,7 +341,11 @@ ptnet_attach(device_t dev) } { - vm_paddr_t paddr = vtophys(sc->csb); + /* +* We use uint64_t rather than vm_paddr_t since we +* need 64 bit addresses even on 32 bit platforms. +*/ + uint64_t paddr = vtophys(sc->csb); bus_write_4(sc->iomem, PTNET_IO_CSBBAH, (paddr >> 32) & 0x); @@ -1139,9 +1143,11 @@ ptnet_sync_from_csb(struct ptnet_softc * static void ptnet_update_vnet_hdr(struct ptnet_softc *sc) { - sc->vnet_hdr_len = ptnet_vnet_hdr ? PTNET_HDR_SIZE : 0; + unsigned int wanted_hdr_len = ptnet_vnet_hdr ? PTNET_HDR_SIZE : 0; + + bus_write_4(sc->iomem, PTNET_IO_VNET_HDR_LEN, wanted_hdr_len); + sc->vnet_hdr_len = bus_read_4(sc->iomem, PTNET_IO_VNET_HDR_LEN); sc->ptna->hwup.up.virt_hdr_len = sc->vnet_hdr_len; - bus_write_4(sc->iomem, PTNET_IO_VNET_HDR_LEN, sc->vnet_hdr_len); } static int Modified: head/sys/dev/netmap/netmap.c == --- head/sys/dev/netmap/netmap.cTue Oct 18 15:50:20 2016 (r307573) +++ head/sys/dev/netmap/netmap.cTue Oct 18 16:18:25 2016 (r307574) @@ -483,7 +483,6 @@ static int netmap_no_timestamp; /* don't int netmap_mitigate = 1; int netmap_no_pendintr = 1; int netmap_txsync_retry = 2; -int netmap_adaptive_io = 0; int netmap_flags = 0; /* debug flags */ static int netmap_fwd = 0; /* force transparent mode */ @@ -540,8 +539,6 @@ SYSCTL_INT(_dev_netmap, OID_AUTO, no_pen CTLFLAG_RW, &netmap_no_pendintr, 0, "Always look for new received packets."); SYSCTL_INT(_dev_netmap, OID_AUTO, txsync_retry, CTLFLAG_RW, &netmap_txsync_retry, 0 , "Number of txsync loops in bridge's flush."); -SYSCTL_INT(_dev_netmap, OID_AUTO, adaptive_io, CTLFLAG_RW, -&netmap_adaptive_io, 0 , "Adaptive I/O on paravirt"); SYSCTL_INT(_dev_netmap, OID_AUTO, flags, CTLFLAG_RW, &netmap_flags, 0 , ""); SYSCTL_INT(_dev_netmap, OID_AUTO, fwd, CTLFLAG_RW, &netmap_fwd, 0 , ""); @@ -1559,7 +1556,7 @@ nm_txsync_prologue(struct netmap_kring * } } if (ring->tail != kring->rtail) { - RD(5, "tail overwritten was %d need %d", + RD(5, "%s tail overwritten was %d need %d", kring->name, ring->tail, kring->rtail); ring->tail = kring->rtail; } Modified: head/sys/dev/netmap/netmap_freebsd.c == --- head/sys/dev/netmap/netmap_freebsd.cTue Oct 18 15:50:20 2016 (r307573) +++ head/sys/dev/netmap/netmap_freebsd.cTue Oct 18 16:18:25 2016 (r307574) @@ -353,7 +353,7 @@ nm_os_generic_xmit_frame(struct nm_os_ge bcopy(a->addr, m->m_data, len); #else /* __FreeBSD_version >= 110 */ /* New FreeBSD versions. Link the external storage to -* the netmap buffer, so that no copy is necessary. */ +* the netmap buffer, so that no copy is necessary. */ m->m_ext.ext_buf = m->m_data = a->addr; m->m_ext.ext_size = len; #endif /* __FreeBSD_version >= 110 */ @@ -644,7 +644,8 @@ DRIVER_MODULE_ORDERED(ptn_memdev, pci, p * of the netmap memory mapped in the guest. */ int -nm_os_pt_memdev_iomap(struct ptnetmap_memdev *ptn_dev, vm_paddr_t *nm_paddr, void **nm_addr) +
svn commit: r307573 - head/sys/dev/e1000
Author: luigi Date: Tue Oct 18 15:50:20 2016 New Revision: 307573 URL: https://svnweb.freebsd.org/changeset/base/307573 Log: remove conditional code for an obsolete feature. if_ptnet now does better. Modified: head/sys/dev/e1000/if_lem.c Modified: head/sys/dev/e1000/if_lem.c == --- head/sys/dev/e1000/if_lem.c Tue Oct 18 15:41:57 2016(r307572) +++ head/sys/dev/e1000/if_lem.c Tue Oct 18 15:50:20 2016(r307573) @@ -39,7 +39,6 @@ */ // #define BATCH_DISPATCH // #define NIC_SEND_COMBINING -// #define NIC_PARAVIRT/* enable virtio-like synchronization */ #include "opt_inet.h" #include "opt_inet6.h" @@ -486,10 +485,6 @@ lem_attach(device_t dev) lem_add_rx_process_limit(adapter, "batch_enable", "driver rx batch", &adapter->batch_enable, 0); #endif /* BATCH_DISPATCH */ -#ifdef NIC_PARAVIRT - lem_add_rx_process_limit(adapter, "rx_retries", - "driver rx retries", &adapter->rx_retries, 0); -#endif /* NIC_PARAVIRT */ /* Sysctl for setting the interface flow control */ lem_set_flow_cntrl(adapter, "flow_control", @@ -548,49 +543,6 @@ lem_attach(device_t dev) */ adapter->hw.mac.report_tx_early = 1; -#ifdef NIC_PARAVIRT - device_printf(dev, "driver supports paravirt, subdev 0x%x\n", - adapter->hw.subsystem_device_id); - if (adapter->hw.subsystem_device_id == E1000_PARA_SUBDEV) { - uint64_t bus_addr; - - device_printf(dev, "paravirt support on dev %p\n", adapter); - tsize = 4096; // XXX one page for the csb - if (lem_dma_malloc(adapter, tsize, &adapter->csb_mem, BUS_DMA_NOWAIT)) { - device_printf(dev, "Unable to allocate csb memory\n"); - error = ENOMEM; - goto err_csb; - } - /* Setup the Base of the CSB */ - adapter->csb = (struct paravirt_csb *)adapter->csb_mem.dma_vaddr; - /* force the first kick */ - adapter->csb->host_need_txkick = 1; /* txring empty */ - adapter->csb->guest_need_rxkick = 1; /* no rx packets */ - bus_addr = adapter->csb_mem.dma_paddr; - lem_add_rx_process_limit(adapter, "csb_on", - "enable paravirt.", &adapter->csb->guest_csb_on, 0); - lem_add_rx_process_limit(adapter, "txc_lim", - "txc_lim", &adapter->csb->host_txcycles_lim, 1); - - /* some stats */ -#define PA_SC(name, var, val) \ - lem_add_rx_process_limit(adapter, name, name, var, val) - PA_SC("host_need_txkick",&adapter->csb->host_need_txkick, 1); - PA_SC("host_rxkick_at",&adapter->csb->host_rxkick_at, ~0); - PA_SC("guest_need_txkick",&adapter->csb->guest_need_txkick, 0); - PA_SC("guest_need_rxkick",&adapter->csb->guest_need_rxkick, 1); - PA_SC("tdt_reg_count",&adapter->tdt_reg_count, 0); - PA_SC("tdt_csb_count",&adapter->tdt_csb_count, 0); - PA_SC("tdt_int_count",&adapter->tdt_int_count, 0); - PA_SC("guest_need_kick_count",&adapter->guest_need_kick_count, 0); - /* tell the host where the block is */ - E1000_WRITE_REG(&adapter->hw, E1000_CSBAH, - (u32)(bus_addr >> 32)); - E1000_WRITE_REG(&adapter->hw, E1000_CSBAL, - (u32)bus_addr); - } -#endif /* NIC_PARAVIRT */ - tsize = roundup2(adapter->num_tx_desc * sizeof(struct e1000_tx_desc), EM_DBA_ALIGN); @@ -749,11 +701,6 @@ err_hw_init: err_rx_desc: lem_dma_free(adapter, &adapter->txdma); err_tx_desc: -#ifdef NIC_PARAVIRT - lem_dma_free(adapter, &adapter->csb_mem); -err_csb: -#endif /* NIC_PARAVIRT */ - err_pci: if (adapter->ifp != (void *)NULL) if_free(adapter->ifp); @@ -841,12 +788,6 @@ lem_detach(device_t dev) adapter->rx_desc_base = NULL; } -#ifdef NIC_PARAVIRT - if (adapter->csb) { - lem_dma_free(adapter, &adapter->csb_mem); - adapter->csb = NULL; - } -#endif /* NIC_PARAVIRT */ lem_release_hw_control(adapter); free(adapter->mta, M_DEVBUF); EM_TX_LOCK_DESTROY(adapter); @@ -956,16 +897,6 @@ lem_start_locked(if_t ifp) } if (adapter->num_tx_desc_avail <= EM_TX_OP_THRESHOLD) if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0); -#ifdef NIC_PARAVIRT - if (if_getdrvflags(ifp) & IFF_DRV_OACTIVE && adapter->csb && - adapter->csb->guest_csb_on && - !(adapter->csb->guest_need_txkick & 1)) { - adapter->csb->guest_need_txkick = 1; - adapter->guest_need_kick_count++; - // XXX memory barrier - lem_txeof(adapter); // XXX possibly clear IFF_D
svn commit: r307572 - in head/sys: dev/netmap net
Author: luigi Date: Tue Oct 18 15:41:57 2016 New Revision: 307572 URL: https://svnweb.freebsd.org/changeset/base/307572 Log: remove trailing whitespace. No code changes. Modified: head/sys/dev/netmap/if_vtnet_netmap.h head/sys/dev/netmap/netmap_monitor.c head/sys/dev/netmap/netmap_pipe.c head/sys/dev/netmap/netmap_vale.c head/sys/net/netmap_user.h Modified: head/sys/dev/netmap/if_vtnet_netmap.h == --- head/sys/dev/netmap/if_vtnet_netmap.h Tue Oct 18 15:24:56 2016 (r307571) +++ head/sys/dev/netmap/if_vtnet_netmap.h Tue Oct 18 15:41:57 2016 (r307572) @@ -127,7 +127,7 @@ vtnet_netmap_txsync(struct netmap_kring * First part: process new packets to send. */ rmb(); - + nm_i = kring->nr_hwcur; if (nm_i != head) { /* we have new packets to send */ struct sglist *sg = txq->vtntx_sg; @@ -182,7 +182,7 @@ vtnet_netmap_txsync(struct netmap_kring virtqueue_enable_intr(vq); // like postpone with 0 } - + /* Free used slots. We only consider our own used buffers, recognized * by the token we passed to virtqueue_add_outbuf. */ Modified: head/sys/dev/netmap/netmap_monitor.c == --- head/sys/dev/netmap/netmap_monitor.cTue Oct 18 15:24:56 2016 (r307571) +++ head/sys/dev/netmap/netmap_monitor.cTue Oct 18 15:41:57 2016 (r307572) @@ -191,7 +191,7 @@ nm_monitor_alloc(struct netmap_kring *kr if (n <= kring->max_monitors) /* we already have more entries that requested */ return 0; - + len = sizeof(struct netmap_kring *) * n; #ifndef _WIN32 nm = realloc(kring->monitors, len, M_DEVBUF, M_NOWAIT | M_ZERO); @@ -301,7 +301,7 @@ netmap_monitor_del(struct netmap_kring * kring->nm_sync = kring->mon_sync; kring->mon_sync = NULL; if (kring->tx == NR_RX) { - ND("%s: restoring notify on %s: %p", + ND("%s: restoring notify on %s: %p", mkring->name, kring->name, kring->mon_notify); kring->nm_notify = kring->mon_notify; kring->mon_notify = NULL; @@ -406,7 +406,7 @@ netmap_monitor_reg_common(struct netmap_ /* - * functions specific for zero-copy monitors + * functions specific for zero-copy monitors */ @@ -554,7 +554,7 @@ netmap_zmon_dtor(struct netmap_adapter * /* - * functions specific for copy monitors + * functions specific for copy monitors */ @@ -729,7 +729,7 @@ netmap_get_monitor_na(struct nmreq *nmr, if ((nmr->nr_flags & (NR_MONITOR_TX | NR_MONITOR_RX)) == 0) { if (nmr->nr_flags & NR_ZCOPY_MON) { - /* the flag makes no sense unless you are + /* the flag makes no sense unless you are * creating a monitor */ return EINVAL; Modified: head/sys/dev/netmap/netmap_pipe.c == --- head/sys/dev/netmap/netmap_pipe.c Tue Oct 18 15:24:56 2016 (r307571) +++ head/sys/dev/netmap/netmap_pipe.c Tue Oct 18 15:41:57 2016 (r307572) @@ -92,7 +92,7 @@ nm_pipe_alloc(struct netmap_adapter *na, if (npipes <= na->na_max_pipes) /* we already have more entries that requested */ return 0; - + if (npipes < na->na_next_pipe || npipes > NM_MAXPIPES) return EINVAL; @@ -402,7 +402,7 @@ netmap_pipe_reg(struct netmap_adapter *n } } } - + /* create all missing needed rings on the other end */ error = netmap_mem_rings_create(ona); if (error) Modified: head/sys/dev/netmap/netmap_vale.c == --- head/sys/dev/netmap/netmap_vale.c Tue Oct 18 15:24:56 2016 (r307571) +++ head/sys/dev/netmap/netmap_vale.c Tue Oct 18 15:41:57 2016 (r307572) @@ -906,7 +906,7 @@ nm_bdg_create_kthreads(struct nm_bdg_pol int affinity = bps->cpu_from + i; t->bps = bps; - t->qfirst = all ? bps->qfirst /* must be 0 */: affinity; + t->qfirst = all ? bps->qfirst /* must be 0 */: affinity; t->
svn commit: r307571 - head/share/man/man4
Author: luigi Date: Tue Oct 18 15:24:56 2016 New Revision: 307571 URL: https://svnweb.freebsd.org/changeset/base/307571 Log: fix a stale sentence in the manpage Modified: head/share/man/man4/netmap.4 Modified: head/share/man/man4/netmap.4 == --- head/share/man/man4/netmap.4Tue Oct 18 15:14:46 2016 (r307570) +++ head/share/man/man4/netmap.4Tue Oct 18 15:24:56 2016 (r307571) @@ -828,9 +828,9 @@ Performance is inferior to native netmap mode but still significantly higher than various raw socket types (bpf, PF_PACKET, etc.). Note that for slow devices (such as 1 Gbit/s and slower NICs, -or several 10 Gbit/s NICs whose hardware is unable -that of in-kernel solutions such as Linux's -.Xr pktgen . +or several 10 Gbit/s NICs whose hardware is unable to sustain line rate), +emulated and native mode will likely have similar or same throughput. +.br When emulation is in use, packet sniffer programs such as tcpdump could see received packets before they are diverted by netmap. This behaviour is not intentional, being just an artifact of the implementation of emulation. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r307396 - head/sys/net
Author: luigi Date: Sun Oct 16 18:27:41 2016 New Revision: 307396 URL: https://svnweb.freebsd.org/changeset/base/307396 Log: add a missing header. Added: head/sys/net/netmap_virt.h (contents, props changed) Added: head/sys/net/netmap_virt.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/net/netmap_virt.h Sun Oct 16 18:27:41 2016(r307396) @@ -0,0 +1,325 @@ +/* + * Copyright (C) 2013-2016 Luigi Rizzo + * Copyright (C) 2013-2016 Giuseppe Lettieri + * Copyright (C) 2013-2016 Vincenzo Maffione + * Copyright (C) 2015 Stefano Garzarella + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef NETMAP_VIRT_H +#define NETMAP_VIRT_H + +#define NETMAP_VIRT_CSB_SIZE 4096 + +/* ptnetmap features */ +#define PTNETMAP_F_BASE1 +#define PTNETMAP_F_FULL2 /* not used */ +#define PTNETMAP_F_VNET_HDR4 + +/* + * ptnetmap_memdev: device used to expose memory into the guest VM + * + * These macros are used in the hypervisor frontend (QEMU, bhyve) and in the + * guest device driver. + */ + +/* PCI identifiers and PCI BARs for the ptnetmap memdev + * and ptnetmap network interface. */ +#define PTNETMAP_MEMDEV_NAME"ptnetmap-memdev" +#define PTNETMAP_PCI_VENDOR_ID 0x /* TODO change vendor_id */ +#define PTNETMAP_PCI_DEVICE_ID 0x0001 /* memory device */ +#define PTNETMAP_PCI_NETIF_ID 0x0002 /* ptnet network interface */ +#define PTNETMAP_IO_PCI_BAR 0 +#define PTNETMAP_MEM_PCI_BAR1 +#define PTNETMAP_MSIX_PCI_BAR 2 + +/* Registers for the ptnetmap memdev */ +/* 32 bit r/o */ +#define PTNETMAP_IO_PCI_FEATURES0 /* XXX should be removed */ +/* 32 bit r/o */ +#define PTNETMAP_IO_PCI_MEMSIZE 4 /* size of the netmap memory shared +* between guest and host */ +/* 16 bit r/o */ +#define PTNETMAP_IO_PCI_HOSTID 8 /* memory allocator ID in netmap host */ +#define PTNETMAP_IO_SIZE10 + +/* + * ptnetmap configuration + * + * The hypervisor (QEMU or bhyve) sends this struct to the host netmap + * module through an ioctl() command when it wants to start the ptnetmap + * kthreads. + */ +struct ptnetmap_cfg { +#define PTNETMAP_CFG_FEAT_CSB 0x0001 +#define PTNETMAP_CFG_FEAT_EVENTFD 0x0002 +#define PTNETMAP_CFG_FEAT_IOCTL0x0004 + uint32_t features; + void *ptrings; /* ptrings inside CSB */ + uint32_t num_rings; /* number of entries */ + struct ptnet_ring_cfg entries[0]; /* per-ptring configuration */ +}; + +/* + * Functions used to write ptnetmap_cfg from/to the nmreq. + * The user-space application writes the pointer of ptnetmap_cfg + * (user-space buffer) starting from nr_arg1 field, so that the kernel + * can read it with copyin (copy_from_user). + */ +static inline void +ptnetmap_write_cfg(struct nmreq *nmr, struct ptnetmap_cfg *cfg) +{ + uintptr_t *nmr_ptncfg = (uintptr_t *)&nmr->nr_arg1; + *nmr_ptncfg = (uintptr_t)cfg; +} + +/* ptnetmap control commands */ +#define PTNETMAP_PTCTL_CONFIG 1 +#define PTNETMAP_PTCTL_FINALIZE2 +#define PTNETMAP_PTCTL_IFNEW 3 +#define PTNETMAP_PTCTL_IFDELETE4 +#define PTNETMAP_PTCTL_RINGSCREATE 5 +#define PTNETMAP_PTCTL_RINGSDELETE 6 +#define PTNETMAP_PTCTL_DEREF 7 +#define PTNETMAP_PTCTL_TXSYNC 8 +#define PTNETMAP_PTCTL_RXSYNC 9 +#define PTNETMAP_PTCTL_REGIF10 +#define PTNETMAP_PTC
svn commit: r307395 - head/sys/dev/netmap
Author: luigi Date: Sun Oct 16 15:22:17 2016 New Revision: 307395 URL: https://svnweb.freebsd.org/changeset/base/307395 Log: add two missing files for the netmap import Added: head/sys/dev/netmap/if_ptnet.c (contents, props changed) head/sys/dev/netmap/netmap_pt.c (contents, props changed) Added: head/sys/dev/netmap/if_ptnet.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/netmap/if_ptnet.c Sun Oct 16 15:22:17 2016 (r307395) @@ -0,0 +1,2277 @@ +/*- + * Copyright (c) 2016, Vincenzo Maffione + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice unmodified, this list of conditions, and the following + *disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* Driver for ptnet paravirtualized network device. */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "opt_inet.h" +#include "opt_inet6.h" + +#include +#include +#include +#include +#include +#include + +#ifndef PTNET_CSB_ALLOC +#error "No support for on-device CSB" +#endif + +#ifndef INET +#error "INET not defined, cannot support offloadings" +#endif + +#if __FreeBSD_version >= 110 +static uint64_tptnet_get_counter(if_t, ift_counter); +#else +typedef struct ifnet *if_t; +#define if_getsoftc(_ifp) (_ifp)->if_softc +#endif + +//#define PTNETMAP_STATS +//#define DEBUG +#ifdef DEBUG +#define DBG(x) x +#else /* !DEBUG */ +#define DBG(x) +#endif /* !DEBUG */ + +extern int ptnet_vnet_hdr; /* Tunable parameter */ + +struct ptnet_softc; + +struct ptnet_queue_stats { + uint64_tpackets; /* if_[io]packets */ + uint64_tbytes; /* if_[io]bytes */ + uint64_terrors; /* if_[io]errors */ + uint64_tiqdrops; /* if_iqdrops */ + uint64_tmcasts; /* if_[io]mcasts */ +#ifdef PTNETMAP_STATS + uint64_tintrs; + uint64_tkicks; +#endif /* PTNETMAP_STATS */ +}; + +struct ptnet_queue { + struct ptnet_softc *sc; + struct resource *irq; + void*cookie; + int kring_id; + struct ptnet_ring *ptring; + unsigned intkick; + struct mtx lock; + struct buf_ring *bufring; /* for TX queues */ + struct ptnet_queue_statsstats; +#ifdef PTNETMAP_STATS + struct ptnet_queue_statslast_stats; +#endif /* PTNETMAP_STATS */ + struct taskqueue*taskq; + struct task task; + charlock_name[16]; +}; + +#define PTNET_Q_LOCK(_pq) mtx_lock(&(_pq)->lock) +#define PTNET_Q_TRYLOCK(_pq) mtx_trylock(&(_pq)->lock) +#define PTNET_Q_UNLOCK(_pq)mtx_unlock(&(_pq)->lock) + +struct ptnet_softc { + device_tdev; + if_tifp; + struct ifmedia media; + struct mtx lock; + charlock_name[16]; + charhwaddr[ETHER_ADDR_LEN]; + + /* Mirror of PTFEAT register. */ + uint32_tptfeatures; + unsigned intvnet_hdr_len; + + /* PCI BARs support. */ + struct resource *iomem; +
svn commit: r307394 - in head: share/man/man4 sys/conf sys/dev/netmap sys/modules/netmap sys/net tools/tools/netmap
b_mode || do_host_rxkick) -#endif /* NIC_PARAVIRT */ E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), nic_i); } @@ -486,6 +318,7 @@ lem_netmap_attach(struct adapter *adapte na.nm_rxsync = lem_netmap_rxsync; na.nm_register = lem_netmap_reg; na.num_tx_rings = na.num_rx_rings = 1; + na.nm_intr = lem_netmap_intr; netmap_attach(&na); } Modified: head/sys/dev/netmap/ixgbe_netmap.h == --- head/sys/dev/netmap/ixgbe_netmap.h Sun Oct 16 12:55:31 2016 (r307393) +++ head/sys/dev/netmap/ixgbe_netmap.h Sun Oct 16 14:13:32 2016 (r307394) @@ -53,7 +53,7 @@ void ixgbe_netmap_attach(struct adapter /* * device-specific sysctl variables: * - * ix_crcstrip: 0: keep CRC in rx frames (default), 1: strip it. + * ix_crcstrip: 0: NIC keeps CRC in rx frames (default), 1: NIC strips it. * During regular operations the CRC is stripped, but on some * hardware reception of frames not multiple of 64 is slower, * so using crcstrip=0 helps in benchmarks. @@ -65,7 +65,7 @@ SYSCTL_DECL(_dev_netmap); static int ix_rx_miss, ix_rx_miss_bufs; int ix_crcstrip; SYSCTL_INT(_dev_netmap, OID_AUTO, ix_crcstrip, -CTLFLAG_RW, &ix_crcstrip, 0, "strip CRC on rx frames"); +CTLFLAG_RW, &ix_crcstrip, 0, "NIC strips CRC on rx frames"); SYSCTL_INT(_dev_netmap, OID_AUTO, ix_rx_miss, CTLFLAG_RW, &ix_rx_miss, 0, "potentially missed rx intr"); SYSCTL_INT(_dev_netmap, OID_AUTO, ix_rx_miss_bufs, @@ -109,6 +109,20 @@ set_crcstrip(struct ixgbe_hw *hw, int on IXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, rxc); } +static void +ixgbe_netmap_intr(struct netmap_adapter *na, int onoff) +{ + struct ifnet *ifp = na->ifp; + struct adapter *adapter = ifp->if_softc; + + IXGBE_CORE_LOCK(adapter); + if (onoff) { + ixgbe_enable_intr(adapter); // XXX maybe ixgbe_stop ? + } else { + ixgbe_disable_intr(adapter); // XXX maybe ixgbe_stop ? + } + IXGBE_CORE_UNLOCK(adapter); +} /* * Register/unregister. We are already under netmap lock. @@ -311,7 +325,7 @@ ixgbe_netmap_txsync(struct netmap_kring * good way. */ nic_i = IXGBE_READ_REG(&adapter->hw, IXGBE_IS_VF(adapter) ? - IXGBE_VFTDH(kring->ring_id) : IXGBE_TDH(kring->ring_id)); + IXGBE_VFTDH(kring->ring_id) : IXGBE_TDH(kring->ring_id)); if (nic_i >= kring->nkr_num_slots) { /* XXX can it happen ? */ D("TDH wrap %d", nic_i); nic_i -= kring->nkr_num_slots; @@ -486,6 +500,7 @@ ixgbe_netmap_attach(struct adapter *adap na.nm_rxsync = ixgbe_netmap_rxsync; na.nm_register = ixgbe_netmap_reg; na.num_tx_rings = na.num_rx_rings = adapter->num_queues; + na.nm_intr = ixgbe_netmap_intr; netmap_attach(&na); } Modified: head/sys/dev/netmap/netmap.c == --- head/sys/dev/netmap/netmap.cSun Oct 16 12:55:31 2016 (r307393) +++ head/sys/dev/netmap/netmap.cSun Oct 16 14:13:32 2016 (r307394) @@ -1,5 +1,9 @@ /* - * Copyright (C) 2011-2014 Matteo Landi, Luigi Rizzo. All rights reserved. + * Copyright (C) 2011-2014 Matteo Landi + * Copyright (C) 2011-2016 Luigi Rizzo + * Copyright (C) 2011-2016 Giuseppe Lettieri + * Copyright (C) 2011-2016 Vincenzo Maffione + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -133,13 +137,12 @@ ports attached to the switch) * >select()able file descriptor on which events are reported. * * Internally, we allocate a netmap_priv_d structure, that will be - * initialized on ioctl(NIOCREGIF). + * initialized on ioctl(NIOCREGIF). There is one netmap_priv_d + * structure for each open(). * * os-specific: - * FreeBSD: netmap_open (netmap_freebsd.c). The priv is - * per-thread. - * linux: linux_netmap_open (netmap_linux.c). The priv is - * per-open. + * FreeBSD: see netmap_open() (netmap_freebsd.c) + * linux: see linux_netmap_open() (netmap_linux.c) * * > 2. on each descriptor, the process issues an ioctl() to identify * >the interface that should report events to the file descriptor. @@ -299,18 +302,17 @@ ports attached to the switch) *netmap_transmit() * na->nm_notify == netmap_notify() * 2) ioctl(NIOCRXSYNC)/netmap_poll() in process context - *kring->nm_sync() == netmap_rxsync_from_host_compat + *kring->nm_sync()
svn commit: r307320 - head/release/picobsd/build
Author: luigi Date: Fri Oct 14 15:16:44 2016 New Revision: 307320 URL: https://svnweb.freebsd.org/changeset/base/307320 Log: adjust picobsd script to work with HEAD Modified: head/release/picobsd/build/picobsd Modified: head/release/picobsd/build/picobsd == --- head/release/picobsd/build/picobsd Fri Oct 14 14:57:43 2016 (r307319) +++ head/release/picobsd/build/picobsd Fri Oct 14 15:16:44 2016 (r307320) @@ -8,6 +8,10 @@ # picobsd [options] image_type [site_name] # # CWARNFLAGS can be used to pass -Wall or similar options +#export CWARNFLAGS=-D__sxasxa__ +#export WARNS=2 +# EFIABI... unused attributes ? +export NO_WERROR=1 # # Where image_type is a directory with the picobsd config info, # and ${image_type}/floppy.tree.${site_name} contains @@ -165,7 +169,7 @@ create_includes_and_libraries2() { # opt local no log "create_includes_and_libraries2() for ${SRC} $1" -no="-DNO_CLEAN -DNO_PROFILE -DNO_GAMES -DNO_LIBC_R" # WITHOUT_CDDL=1" +no="-DNO_CLEAN -DMK_PROFILE=no -DNO_GAMES -DNO_LIBC_R" # WITHOUT_CDDL=1" no="$no -DWITHOUT_CASPER" no="$no -DMALLOC_PRODUCTION" @@ -674,7 +678,7 @@ populate_mfs_tree() { ) || fail $? crunch log "Setting up host key for sshd:" -for K in rsa1 rsa dsa ; do +for K in rsa dsa ; do if [ $K = rsa1 ] ; then i=ssh_host_key else @@ -844,6 +848,7 @@ fill_floppy_image() { mkdir -p ${dst} ( cd ${BUILDDIR} +# old style mfs lookup, find markers in kernel set 0 0 # reset variables # $1 takes the offset of the MFS filesystem set `strings -at d kernel | grep "MFS Filesystem goes here"` @@ -852,6 +857,16 @@ fill_floppy_image() { set `strings -at d kernel | grep "MFS Filesystem had better"` mfs_end=$1 mfs_size="$((${mfs_end} - ${mfs_start}))" +if [ ${mfs_start} = 0 -o ${mfs_end} = 0 ] ; then + # similar to sys/tools/embed_mfs.sh + local x="`objdump -h kernel | grep oldmfs`" + mfs_size=`echo ${x} | awk '{printf("%d", "0x" $3)}' 2> /dev/null` + mfs_start=`echo ${x} | awk '{printf("%d", "0x" $6)}' 2> /dev/null` + if [ ${mfs_start} = 0 -o ${mfs_size} = 0 ] ; then + log "-- old style mfs location not found, have" + logverbose "$x" + fi +fi set -- `ls -l ${c_fs}`; imgsize="$5" if [ ${mfs_start} -gt 0 -a ${mfs_size} -ge ${imgsize} ] ; then mfs_ofs=$((${mfs_start} + 8192)) @@ -953,9 +968,15 @@ set_build_parameters() { OSVERSION=$3 log "OSVERSION is ${OSVERSION}" - export MAKEOBJDIRPREFIX=${l_objtree} - export TARGET_ARCH=${o_arch} TARGET=${o_arch} - # XXX 20131001 see if CLANG fixes the build +export MAKEOBJDIRPREFIX=${l_objtree} +export TARGET_ARCH=${o_arch} TARGET=${o_arch} +# XXX 20131001 see if CLANG fixes the build +if true; then + echo "--- build with clang" + export WITHOUT_CLANG=yes + export WITHOUT_CLANG_BOOTSTRAP=yes + # export WITH_CLANG_BOOTSTRAP=yes +else export WITHOUT_CLANG_IS_CC=yes export WITHOUT_CLANG_BOOTSTRAP=yes export WITH_GCC=yes @@ -964,14 +985,15 @@ set_build_parameters() { export WITHOUT_CLANG=yes export WITHOUT_ICONV=yes export WITHOUT_TESTS=yes +fi - # XXX why change machine_arch ? - #-- export MACHINE_ARCH=`uname -m` MACHINE=`uname -m` - # export CWARNFLAGS="-Wextra -Wno-sign-compare -Wno-missing-field-initializers" - # XXX BINMAKE does not really exist anymore - eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V BINMAKE`\"" - [ "$BINMAKE" = "" ] && \ - eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V SUB_MAKE`\"" +# XXX why change machine_arch ? +#-- export MACHINE_ARCH=`uname -m` MACHINE=`uname -m` +# export CWARNFLAGS="-Wextra -Wno-sign-compare -Wno-missing-field-initializers" +# XXX BINMAKE does not really exist anymore +eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V BINMAKE`\"" +[ "$BINMAKE" = "" ] && \ + eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V SUB_MAKE`\"" if [ "${o_init_src}" != "" ] ; then create_includes_and_libraries2 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r294882 - head/sys/netpfil/ipfw/test
Author: luigi Date: Wed Jan 27 02:22:31 2016 New Revision: 294882 URL: https://svnweb.freebsd.org/changeset/base/294882 Log: cleanup and document in some detail the internals of the testing code for dummynet schedulers Modified: head/sys/netpfil/ipfw/test/Makefile head/sys/netpfil/ipfw/test/dn_test.h head/sys/netpfil/ipfw/test/main.c head/sys/netpfil/ipfw/test/mylist.h head/sys/netpfil/ipfw/test/test_dn_sched.c Modified: head/sys/netpfil/ipfw/test/Makefile == --- head/sys/netpfil/ipfw/test/Makefile Wed Jan 27 02:14:08 2016 (r294881) +++ head/sys/netpfil/ipfw/test/Makefile Wed Jan 27 02:22:31 2016 (r294882) @@ -20,7 +20,7 @@ HEAP_OBJS=$(HEAP_SRCS:.c=.o) VPATH= .:.. -CFLAGS = -I.. -I. -Wall -Werror -O3 -DIPFW -Wextra +CFLAGS = -I.. -I. -Wall -Werror -O3 -Wextra TARGETS= test_sched # no test_heap by default all: $(TARGETS) Modified: head/sys/netpfil/ipfw/test/dn_test.h == --- head/sys/netpfil/ipfw/test/dn_test.hWed Jan 27 02:14:08 2016 (r294881) +++ head/sys/netpfil/ipfw/test/dn_test.hWed Jan 27 02:22:31 2016 (r294882) @@ -23,8 +23,8 @@ extern "C" { extern int debug; #define ND(fmt, args...) do {} while (0) #define D1(fmt, args...) do {} while (0) -#define D(fmt, args...) fprintf(stderr, "%-8s " fmt "\n", \ -__FUNCTION__, ## args) +#define D(fmt, args...) fprintf(stderr, "%-10s %4d %-8s " fmt "\n", \ +__FILE__, __LINE__, __FUNCTION__, ## args) #define DX(lev, fmt, args...) do { \ if (debug > lev) D(fmt, ## args); } while (0) @@ -53,11 +53,24 @@ enum{ DN_SCHED_WF2QP, }; +/* from ip_dummynet.h, fields used in ip_dn_private.h */ struct dn_id { - int type, subtype, len, id; + uint16_tlen; /* total len inc. this header */ + uint8_t type; + uint8_t subtype; +// uint32_tid; /* generic id */ }; +/* (from ip_dummynet.h) + * A flowset, which is a template for flows. Contains parameters + * from the command line: id, target scheduler, queue sizes, plr, + * flow masks, buckets for the flow hash, and possibly scheduler- + * specific parameters (weight, quantum and so on). + */ struct dn_fs { +/* generic scheduler parameters. Leave them at -1 if unset. + * Now we use 0: weight, 1: lmax, 2: priority + */ int par[4]; /* flowset parameters */ /* simulation entries. @@ -78,16 +91,29 @@ struct dn_fs { int cur; }; +/* (ip_dummynet.h) + * scheduler template, indicating nam, number, mask and buckets + */ struct dn_sch { }; +/* (from ip_dummynet.h) + * dn_flow collects flow_id and stats for queues and scheduler + * instances, and is used to pass these info to userland. + * oid.type/oid.subtype describe the object, oid.id is number + * of the parent object. + */ struct dn_flow { struct dn_id oid; - int length; - int len_bytes; - int drops; + uint64_t tot_pkts; uint64_t tot_bytes; - uint32_t flow_id; + uint32_t length;/* Queue length, in packets */ + uint32_t len_bytes; /* Queue length, in bytes */ + uint32_t drops; + //uint32_t flow_id; + + /* the following fields are used by the traffic generator. +*/ struct list_head h; /* used by the generator */ /* bytes served by the flow since the last backlog time */ @@ -96,6 +122,7 @@ struct dn_flow { uint64_t sch_bytes; }; +/* the link */ struct dn_link { }; @@ -107,9 +134,9 @@ struct mbuf { int len; } m_pkthdr; struct mbuf *m_nextpkt; - int flow_id;/* for testing, index of a flow */ + uint32_t flow_id; /* for testing, index of a flow */ //int flowset_id; /* for testing, index of a flowset */ - void *cfg; /* config args */ + //void *cfg;/* config args */ }; #define MALLOC_DECLARE(x) extern volatile int __dummy__ ## x @@ -131,36 +158,9 @@ typedef struct _md_t moduledata_t; moduledata_t *_g_##name = & b #define MODULE_DEPEND(a, b, c, d, e) -#ifdef IPFW #include #include #include -#else -struct dn_queue { -struct dn_fsk *fs; /* parent flowset. */ -struct dn_sch_inst *_si; /* parent sched instance. */ -}; -struct dn_schk { -}; -struct dn_fsk { - struct dn_fs fs; - struct dn_schk *sched; -}; -struct dn_sch_inst { - struct dn_schk *sched; -}; -struct dn_alg { - int type; - const char *name; - void *enqueue, *dequeue; - int q_datalen, si_datalen, schk_datalen; - int (*config)(struct dn_schk *); - int (*new_sched)(struct dn_sch_inst *); - int (*new_fsk)(struct dn_fsk *); -int (*new_queue)(struct dn_queue *q); -}; - -#endif
svn commit: r294881 - head/sys/netpfil/ipfw
Author: luigi Date: Wed Jan 27 02:14:08 2016 New Revision: 294881 URL: https://svnweb.freebsd.org/changeset/base/294881 Log: the _Static_assert was not supposed to be in the commit. Modified: head/sys/netpfil/ipfw/dn_sched_rr.c Modified: head/sys/netpfil/ipfw/dn_sched_rr.c == --- head/sys/netpfil/ipfw/dn_sched_rr.c Wed Jan 27 02:11:58 2016 (r294880) +++ head/sys/netpfil/ipfw/dn_sched_rr.c Wed Jan 27 02:14:08 2016 (r294881) @@ -311,6 +311,5 @@ static struct dn_alg rr_desc = { _SI( .free_queue = ) rr_free_queue, }; -_Static_assert(sizeof(struct dn_schk) < 193, "a"); DECLARE_DNSCHED_MODULE(dn_rr, &rr_desc); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r294879 - head/sys/netpfil/ipfw
Author: luigi Date: Wed Jan 27 02:08:30 2016 New Revision: 294879 URL: https://svnweb.freebsd.org/changeset/base/294879 Log: bugfix: the scheduler template (dn_schk) for the round robin scheduler is followed by another structure (rr_schk) whose size must be set in the schk_datalen field of the descriptor. Not allocating the memory may cause other memory to be overwritten (though dn_schk is 192 bytes and rr_schk only 12 so we may be lucky and end up in the padding after the dn_schk). This is a merge candidate for stable and 10.3 MFC after:3 days Modified: head/sys/netpfil/ipfw/dn_sched_rr.c Modified: head/sys/netpfil/ipfw/dn_sched_rr.c == --- head/sys/netpfil/ipfw/dn_sched_rr.c Wed Jan 27 01:33:26 2016 (r294878) +++ head/sys/netpfil/ipfw/dn_sched_rr.c Wed Jan 27 02:08:30 2016 (r294879) @@ -294,7 +294,7 @@ static struct dn_alg rr_desc = { _SI( .name = ) "RR", _SI( .flags = ) DN_MULTIQUEUE, - _SI( .schk_datalen = ) 0, + _SI( .schk_datalen = ) sizeof(struct rr_schk), _SI( .si_datalen = ) sizeof(struct rr_si), _SI( .q_datalen = ) sizeof(struct rr_queue) - sizeof(struct dn_queue), @@ -311,5 +311,6 @@ static struct dn_alg rr_desc = { _SI( .free_queue = ) rr_free_queue, }; +_Static_assert(sizeof(struct dn_schk) < 193, "a"); DECLARE_DNSCHED_MODULE(dn_rr, &rr_desc); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r294859 - head/sys/netpfil/ipfw/test
Author: luigi Date: Tue Jan 26 23:37:07 2016 New Revision: 294859 URL: https://svnweb.freebsd.org/changeset/base/294859 Log: fix various warnings to compile the test code with -Wextra Modified: head/sys/netpfil/ipfw/test/Makefile head/sys/netpfil/ipfw/test/main.c head/sys/netpfil/ipfw/test/test_dn_sched.c Modified: head/sys/netpfil/ipfw/test/Makefile == --- head/sys/netpfil/ipfw/test/Makefile Tue Jan 26 23:36:18 2016 (r294858) +++ head/sys/netpfil/ipfw/test/Makefile Tue Jan 26 23:37:07 2016 (r294859) @@ -20,7 +20,7 @@ HEAP_OBJS=$(HEAP_SRCS:.c=.o) VPATH= .:.. -CFLAGS = -I.. -I. -Wall -Werror -O3 -DIPFW +CFLAGS = -I.. -I. -Wall -Werror -O3 -DIPFW -Wextra TARGETS= test_sched # no test_heap by default all: $(TARGETS) Modified: head/sys/netpfil/ipfw/test/main.c == --- head/sys/netpfil/ipfw/test/main.c Tue Jan 26 23:36:18 2016 (r294858) +++ head/sys/netpfil/ipfw/test/main.c Tue Jan 26 23:37:07 2016 (r294859) @@ -594,9 +594,9 @@ controller(struct cfg_s *c) int flow_id; /* histeresis between max and min */ - if (c->state == 0 && c->pending >= c->th_max) + if (c->state == 0 && c->pending >= (uint32_t)c->th_max) c->state = 1; - else if (c->state == 1 && c->pending <= c->th_min) + else if (c->state == 1 && c->pending <= (uint32_t)c->th_min) c->state = 0; ND(1, "state %d pending %2d", c->state, c->pending); c->can_dequeue = c->state; Modified: head/sys/netpfil/ipfw/test/test_dn_sched.c == --- head/sys/netpfil/ipfw/test/test_dn_sched.c Tue Jan 26 23:36:18 2016 (r294858) +++ head/sys/netpfil/ipfw/test/test_dn_sched.c Tue Jan 26 23:37:07 2016 (r294859) @@ -15,6 +15,9 @@ m_freem(struct mbuf *m) int dn_sched_modevent(module_t mod, int cmd, void *arg) { + (void)mod; + (void)cmd; + (void)arg; return 0; } @@ -32,6 +35,8 @@ int dn_delete_queue(void *_q, void *do_free) { struct dn_queue *q = _q; + + (void)do_free; if (q->mq.head) dn_free_pkts(q->mq.head); free(q); @@ -66,6 +71,7 @@ drop: int ipdn_bound_var(int *v, int dflt, int lo, int hi, const char *msg) { + (void)msg; if (*v < lo) { *v = dflt; } else if (*v > hi) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r294858 - head/sys/netpfil/ipfw
Author: luigi Date: Tue Jan 26 23:36:18 2016 New Revision: 294858 URL: https://svnweb.freebsd.org/changeset/base/294858 Log: fix various warnings (signed/unsigned, printf types, unused arguments) Modified: head/sys/netpfil/ipfw/dn_sched_qfq.c Modified: head/sys/netpfil/ipfw/dn_sched_qfq.c == --- head/sys/netpfil/ipfw/dn_sched_qfq.cTue Jan 26 22:46:58 2016 (r294857) +++ head/sys/netpfil/ipfw/dn_sched_qfq.cTue Jan 26 23:36:18 2016 (r294858) @@ -48,6 +48,7 @@ #endif #ifdef QFQ_DEBUG +#define _P64 unsigned long long /* cast for printing uint64_t */ struct qfq_sched; static void dump_sched(struct qfq_sched *q, const char *msg); #defineNO(x) x @@ -84,19 +85,19 @@ static inline unsigned long __fls(unsign #if !defined(_KERNEL) || !defined(__linux__) #ifdef QFQ_DEBUG -int test_bit(int ix, bitmap *p) +static int test_bit(int ix, bitmap *p) { if (ix < 0 || ix > 31) D("bad index %d", ix); return *p & (1< 31) D("bad index %d", ix); *p |= (1< 31) D("bad index %d", ix); @@ -230,9 +231,9 @@ struct qfq_sched { uint64_tV; /* Precise virtual time. */ uint32_twsum; /* weight sum */ uint32_tiwsum; /* inverse weight sum */ - NO(uint32_t i_wsum; /* ONE_FP/w_sum */ - uint32_t_queued;/* debugging */ - uint32_tloops; /* debugging */) + NO(uint32_t i_wsum;)/* ONE_FP/w_sum */ + NO(uint32_t queued;)/* debugging */ + NO(uint32_t loops;) /* debugging */ bitmap bitmaps[QFQ_MAX_STATE]; /* Group bitmaps. */ struct qfq_group groups[QFQ_MAX_INDEX + 1]; /* The groups. */ }; @@ -486,6 +487,7 @@ qfq_slot_rotate(struct qfq_sched *q, str { unsigned int i = (grp->S - roundedS) >> grp->slot_shift; + (void)q; grp->full_slots <<= i; grp->front = (grp->front - i) % QFQ_MAX_SLOTS; } @@ -516,6 +518,7 @@ qfq_update_class(struct qfq_sched *q, st struct qfq_class *cl) { + (void)q; cl->S = cl->F; if (cl->_q.mq.head == NULL) { qfq_front_slot_remove(grp); @@ -853,9 +856,9 @@ dump_groups(struct qfq_sched *q, uint32_ if (g->slots[j]) D("bucket %d %p", j, g->slots[j]); } - D("full_slots 0x%x", g->full_slots); + D("full_slots 0x%llx", (_P64)g->full_slots); D("%2d S 0x%20llx F 0x%llx %c", i, - g->S, g->F, + (_P64)g->S, (_P64)g->F, mask & (1queued, q->V); - D("ER 0x%08x", q->bitmaps[ER]); - D("EB 0x%08x", q->bitmaps[EB]); - D("IR 0x%08x", q->bitmaps[IR]); - D("IB 0x%08x", q->bitmaps[IB]); + D("loops %d queued %d V 0x%llx", q->loops, q->queued, (_P64)q->V); + D("ER 0x%08x", (unsigned)q->bitmaps[ER]); + D("EB 0x%08x", (unsigned)q->bitmaps[EB]); + D("IR 0x%08x", (unsigned)q->bitmaps[IR]); + D("IB 0x%08x", (unsigned)q->bitmaps[IB]); dump_groups(q, 0x); }; #endif /* QFQ_DEBUG */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r294857 - head/sys/netpfil/ipfw
Author: luigi Date: Tue Jan 26 22:46:58 2016 New Revision: 294857 URL: https://svnweb.freebsd.org/changeset/base/294857 Log: prevent warnings for signed/unsigned comparisons and unused arguments. Add checks for parameters overflowing 32 bit. Modified: head/sys/netpfil/ipfw/dn_sched_rr.c Modified: head/sys/netpfil/ipfw/dn_sched_rr.c == --- head/sys/netpfil/ipfw/dn_sched_rr.c Tue Jan 26 22:45:45 2016 (r294856) +++ head/sys/netpfil/ipfw/dn_sched_rr.c Tue Jan 26 22:46:58 2016 (r294857) @@ -52,8 +52,8 @@ struct rr_queue { struct dn_queue q; /* Standard queue */ int status; /* 1: queue is in the list */ - int credit; /* Number of bytes to transmit */ - int quantum;/* quantum * C */ + uint32_t credit;/* max bytes we can transmit */ + uint32_t quantum; /* quantum * weight */ struct rr_queue *qnext; /* */ }; @@ -61,9 +61,9 @@ struct rr_queue { * and is right after dn_schk */ struct rr_schk { - int min_q; /* Min quantum */ - int max_q; /* Max quantum */ - int q_bytes;/* Bytes per quantum */ + uint32_t min_q; /* Min quantum */ + uint32_t max_q; /* Max quantum */ + uint32_t q_bytes; /* default quantum in bytes */ }; /* per-instance round robin list, right after dn_sch_inst */ @@ -227,6 +227,7 @@ rr_new_sched(struct dn_sch_inst *_si) static int rr_free_sched(struct dn_sch_inst *_si) { + (void)_si; ND("called"); /* Nothing to do? */ return 0; @@ -237,6 +238,7 @@ rr_new_fsk(struct dn_fsk *fs) { struct rr_schk *schk = (struct rr_schk *)(fs->sched + 1); /* par[0] is the weight, par[1] is the quantum step */ + /* make sure the product fits an uint32_t */ ipdn_bound_var(&fs->fs.par[0], 1, 1, 65536, "RR weight"); ipdn_bound_var(&fs->fs.par[1], schk->q_bytes, @@ -248,10 +250,16 @@ static int rr_new_queue(struct dn_queue *_q) { struct rr_queue *q = (struct rr_queue *)_q; + uint64_t quantum; _q->ni.oid.subtype = DN_SCHED_RR; - q->quantum = _q->fs->fs.par[0] * _q->fs->fs.par[1]; + quantum = (uint64_t)_q->fs->fs.par[0] * _q->fs->fs.par[1]; + if (quantum >= (1ULL<< 32)) { + D("quantum too large, truncating to 4G - 1"); + quantum = (1ULL<< 32) - 1; + } + q->quantum = quantum; ND("called, q->quantum %d", q->quantum); q->credit = q->quantum; q->status = 0; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r294856 - head/sys/netpfil/ipfw
Author: luigi Date: Tue Jan 26 22:45:45 2016 New Revision: 294856 URL: https://svnweb.freebsd.org/changeset/base/294856 Log: prevent warning for unused argument Modified: head/sys/netpfil/ipfw/dn_sched_fifo.c Modified: head/sys/netpfil/ipfw/dn_sched_fifo.c == --- head/sys/netpfil/ipfw/dn_sched_fifo.c Tue Jan 26 22:45:05 2016 (r294855) +++ head/sys/netpfil/ipfw/dn_sched_fifo.c Tue Jan 26 22:45:45 2016 (r294856) @@ -61,6 +61,7 @@ fifo_enqueue(struct dn_sch_inst *si, str * re-enqueue from an existing scheduler, which we should * handle. */ + (void)q; return dn_enqueue((struct dn_queue *)(si+1), m, 0); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r294855 - head/sys/netpfil/ipfw
Author: luigi Date: Tue Jan 26 22:45:05 2016 New Revision: 294855 URL: https://svnweb.freebsd.org/changeset/base/294855 Log: avoid warnings for signed/unsigned comparison and unused arguments Modified: head/sys/netpfil/ipfw/dn_heap.c Modified: head/sys/netpfil/ipfw/dn_heap.c == --- head/sys/netpfil/ipfw/dn_heap.c Tue Jan 26 22:32:58 2016 (r294854) +++ head/sys/netpfil/ipfw/dn_heap.c Tue Jan 26 22:45:05 2016 (r294855) @@ -81,7 +81,7 @@ heap_resize(struct dn_heap *h, unsigned { struct dn_heap_entry *p; - if (h->size >= new_size ) /* have enough room */ + if ((unsigned int)h->size >= new_size ) /* have enough room */ return 0; #if 1 /* round to the next power of 2 */ new_size |= new_size >> 1; @@ -419,6 +419,8 @@ dn_ht_init(struct dn_ht *ht, int buckets static int do_del(void *obj, void *arg) { + (void)obj; + (void)arg; return DNHT_SCAN_DEL; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r294761 - head/sys/netpfil/ipfw
Author: luigi Date: Tue Jan 26 04:48:24 2016 New Revision: 294761 URL: https://svnweb.freebsd.org/changeset/base/294761 Log: Revert one chunk from commit 285362, which introduced an off-by-one error in computing a shift index. The error was due to the use of mixed fls() / __fls() functions in another implementation of qfq. To avoid that the problem occurs again, properly document which incarnation of the function we need. Note that the bug only affects QFQ in FreeBSD head from last july, as the patch was not merged to other versions. Modified: head/sys/netpfil/ipfw/dn_sched_qfq.c Modified: head/sys/netpfil/ipfw/dn_sched_qfq.c == --- head/sys/netpfil/ipfw/dn_sched_qfq.cTue Jan 26 04:41:18 2016 (r294760) +++ head/sys/netpfil/ipfw/dn_sched_qfq.cTue Jan 26 04:48:24 2016 (r294761) @@ -60,6 +60,10 @@ typedef unsigned long bitmap; /* * bitmaps ops are critical. Some linux versions have __fls * and the bitmap ops. Some machines have ffs + * NOTE: fls() returns 1 for the least significant bit, + * __fls() returns 0 for the same case. + * We use the base-0 version __fls() to match the description in + * the ToN QFQ paper */ #if defined(_WIN32) || (defined(__MIPSEL__) && defined(LINUX_24)) int fls(unsigned int n) @@ -409,8 +413,8 @@ qfq_make_eligible(struct qfq_sched *q, u old_vslot = old_V >> QFQ_MIN_SLOT_SHIFT; if (vslot != old_vslot) { - /* should be 1ULL not 2ULL */ - mask = (1ULL << (__fls(vslot ^ old_vslot))) - 1; + /* must be 2ULL, see ToN QFQ article fig.5, we use base-0 fls */ + mask = (2ULL << (__fls(vslot ^ old_vslot))) - 1; qfq_move_groups(q, mask, IR, ER); qfq_move_groups(q, mask, IB, EB); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r285698 - head/sys/dev/netmap
Author: luigi Date: Sun Jul 19 18:06:30 2015 New Revision: 285698 URL: https://svnweb.freebsd.org/changeset/base/285698 Log: properly destroy persistent vale ports Modified: head/sys/dev/netmap/netmap_vale.c Modified: head/sys/dev/netmap/netmap_vale.c == --- head/sys/dev/netmap/netmap_vale.c Sun Jul 19 18:05:49 2015 (r285697) +++ head/sys/dev/netmap/netmap_vale.c Sun Jul 19 18:06:30 2015 (r285698) @@ -506,17 +506,6 @@ netmap_vp_dtor(struct netmap_adapter *na } } -/* nm_dtor callback for persistent VALE ports */ -static void -netmap_persist_vp_dtor(struct netmap_adapter *na) -{ - struct ifnet *ifp = na->ifp; - - netmap_vp_dtor(na); - na->ifp = NULL; - nm_vi_detach(ifp); -} - /* remove a persistent VALE port from the system */ static int nm_vi_destroy(const char *name) @@ -546,6 +535,7 @@ nm_vi_destroy(const char *name) */ if_rele(ifp); netmap_detach(ifp); + nm_vi_detach(ifp); return 0; err: @@ -587,7 +577,6 @@ nm_vi_create(struct nmreq *nmr) } /* persist-specific routines */ vpna->up.nm_bdg_ctl = netmap_vp_bdg_ctl; - vpna->up.nm_dtor = netmap_persist_vp_dtor; netmap_adapter_get(&vpna->up); NMG_UNLOCK(); D("created %s", ifp->if_xname); @@ -1823,6 +1812,11 @@ netmap_vp_create(struct nmreq *nmr, stru D("max frame size %u", vpna->mfs); na->na_flags |= NAF_BDG_MAYSLEEP; + /* persistent VALE ports look like hw devices +* with a native netmap adapter +*/ + if (ifp) + na->na_flags |= NAF_NATIVE; na->nm_txsync = netmap_vp_txsync; na->nm_rxsync = netmap_vp_rxsync; na->nm_register = netmap_vp_reg; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r285699 - head/sys/dev/netmap
Author: luigi Date: Sun Jul 19 18:07:25 2015 New Revision: 285699 URL: https://svnweb.freebsd.org/changeset/base/285699 Log: add a use count so the netmap module cannot be unloaded while in use. Modified: head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_freebsd.c head/sys/dev/netmap/netmap_kern.h Modified: head/sys/dev/netmap/netmap.c == --- head/sys/dev/netmap/netmap.cSun Jul 19 18:06:30 2015 (r285698) +++ head/sys/dev/netmap/netmap.cSun Jul 19 18:07:25 2015 (r285699) @@ -542,6 +542,7 @@ SYSCTL_INT(_dev_netmap, OID_AUTO, generi SYSCTL_INT(_dev_netmap, OID_AUTO, generic_rings, CTLFLAG_RW, &netmap_generic_rings, 0 , ""); NMG_LOCK_T netmap_global_lock; +int netmap_use_count = 0; /* number of active netmap instances */ /* * mark the ring as stopped, and run through the locks @@ -975,11 +976,11 @@ netmap_dtor_locked(struct netmap_priv_d { struct netmap_adapter *na = priv->np_na; - /* number of active mmaps on this fd (FreeBSD only) */ + /* number of active references to this fd */ if (--priv->np_refs > 0) { return 0; } - + netmap_use_count--; if (!na) { return 1; //XXX is it correct? } Modified: head/sys/dev/netmap/netmap_freebsd.c == --- head/sys/dev/netmap/netmap_freebsd.cSun Jul 19 18:06:30 2015 (r285698) +++ head/sys/dev/netmap/netmap_freebsd.cSun Jul 19 18:07:25 2015 (r285699) @@ -642,6 +642,10 @@ netmap_open(struct cdev *dev, int oflags error = devfs_set_cdevpriv(priv, netmap_dtor); if (error) { free(priv, M_DEVBUF); + } else { + NMG_LOCK(); + netmap_use_count++; + NMG_UNLOCK(); } return error; } @@ -827,6 +831,16 @@ netmap_loader(__unused struct module *mo break; case MOD_UNLOAD: + /* +* if some one is still using netmap, +* then the module can not be unloaded. +*/ + if (netmap_use_count) { + D("netmap module can not be unloaded - netmap_use_count: %d", + netmap_use_count); + error = EBUSY; + break; + } netmap_fini(); break; Modified: head/sys/dev/netmap/netmap_kern.h == --- head/sys/dev/netmap/netmap_kern.h Sun Jul 19 18:06:30 2015 (r285698) +++ head/sys/dev/netmap/netmap_kern.h Sun Jul 19 18:07:25 2015 (r285699) @@ -1247,6 +1247,7 @@ extern int netmap_txsync_retry; extern int netmap_generic_mit; extern int netmap_generic_ringsize; extern int netmap_generic_rings; +extern int netmap_use_count; /* * NA returns a pointer to the struct netmap adapter from the ifp, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r285697 - head/sys/dev/netmap
Author: luigi Date: Sun Jul 19 18:05:49 2015 New Revision: 285697 URL: https://svnweb.freebsd.org/changeset/base/285697 Log: do not free NULL if pipe allocation fails Modified: head/sys/dev/netmap/netmap_pipe.c Modified: head/sys/dev/netmap/netmap_pipe.c == --- head/sys/dev/netmap/netmap_pipe.c Sun Jul 19 18:04:51 2015 (r285696) +++ head/sys/dev/netmap/netmap_pipe.c Sun Jul 19 18:05:49 2015 (r285697) @@ -616,7 +616,7 @@ netmap_get_pipe_na(struct nmreq *nmr, st sna = malloc(sizeof(*mna), M_DEVBUF, M_NOWAIT | M_ZERO); if (sna == NULL) { error = ENOMEM; - goto free_mna; + goto unregister_mna; } /* most fields are the same, copy from master and then fix */ *sna = *mna; @@ -666,6 +666,8 @@ found: free_sna: free(sna, M_DEVBUF); +unregister_mna: + netmap_pipe_remove(pna, mna); free_mna: free(mna, M_DEVBUF); put_out: ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r285696 - head/sys/dev/netmap
Author: luigi Date: Sun Jul 19 18:04:51 2015 New Revision: 285696 URL: https://svnweb.freebsd.org/changeset/base/285696 Log: release a reference when stopping a monitor Modified: head/sys/dev/netmap/netmap_monitor.c Modified: head/sys/dev/netmap/netmap_monitor.c == --- head/sys/dev/netmap/netmap_monitor.cSun Jul 19 17:54:42 2015 (r285695) +++ head/sys/dev/netmap/netmap_monitor.cSun Jul 19 18:04:51 2015 (r285696) @@ -326,6 +326,7 @@ netmap_monitor_stop(struct netmap_adapte struct netmap_monitor_adapter *mna = (struct netmap_monitor_adapter *)mkring->na; /* forget about this adapter */ + netmap_adapter_put(mna->priv.np_na); mna->priv.np_na = NULL; } } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r285695 - head/sys/dev/netmap
Author: luigi Date: Sun Jul 19 17:54:42 2015 New Revision: 285695 URL: https://svnweb.freebsd.org/changeset/base/285695 Log: small documentation update Modified: head/sys/dev/netmap/netmap_kern.h Modified: head/sys/dev/netmap/netmap_kern.h == --- head/sys/dev/netmap/netmap_kern.h Sun Jul 19 16:55:47 2015 (r285694) +++ head/sys/dev/netmap/netmap_kern.h Sun Jul 19 17:54:42 2015 (r285695) @@ -503,8 +503,9 @@ struct netmap_adapter { * that cannot be changed */ #define NAF_NATIVE 16 /* the adapter is native. -* Virtual ports (vale, pipe, monitor...) -* should never use this flag. +* Virtual ports (non persistent vale ports, +* pipes, monitors...) should never use +* this flag. */ #defineNAF_NETMAP_ON 32 /* netmap is active (either native or * emulated). Where possible (e.g. FreeBSD) @@ -1483,7 +1484,7 @@ PNMB(struct netmap_adapter *na, struct n * * np_refs counts the number of references to the structure: one for the fd, * plus (on FreeBSD) one for each active mmap which we track ourselves - * (they are not unmapped on close(), unlike linux). + * (linux automatically tracks them, but FreeBSD does not). * np_refs is protected by NMG_LOCK. * * Read access to the structure is lock free, because ni_nifp once set ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r285677 - head/sys/netinet
Author: luigi Date: Sat Jul 18 15:28:32 2015 New Revision: 285677 URL: https://svnweb.freebsd.org/changeset/base/285677 Log: fix a typo in a comment Modified: head/sys/netinet/ip_var.h Modified: head/sys/netinet/ip_var.h == --- head/sys/netinet/ip_var.h Sat Jul 18 15:27:12 2015(r285676) +++ head/sys/netinet/ip_var.h Sat Jul 18 15:28:32 2015(r285677) @@ -281,7 +281,7 @@ enum { IPFW_IS_MASK= 0x3000, /* which source ? */ IPFW_IS_DIVERT = 0x2000, IPFW_IS_DUMMYNET =0x1000, - IPFW_IS_PIPE= 0x0800, /* pip1=1, queue = 0 */ + IPFW_IS_PIPE= 0x0800, /* pipe=1, queue = 0 */ }; #define MTAG_IPFW 1148380143 /* IPFW-tagged cookie */ #define MTAG_IPFW_RULE 1262273568 /* rule reference */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r285445 - head/sys/dev/netmap
Author: luigi Date: Mon Jul 13 10:23:52 2015 New Revision: 285445 URL: https://svnweb.freebsd.org/changeset/base/285445 Log: set the refcount for the structure (dropped by mistake in the last commit). Modified: head/sys/dev/netmap/netmap_freebsd.c Modified: head/sys/dev/netmap/netmap_freebsd.c == --- head/sys/dev/netmap/netmap_freebsd.cMon Jul 13 10:15:01 2015 (r285444) +++ head/sys/dev/netmap/netmap_freebsd.cMon Jul 13 10:23:52 2015 (r285445) @@ -638,6 +638,7 @@ netmap_open(struct cdev *dev, int oflags M_NOWAIT | M_ZERO); if (priv == NULL) return ENOMEM; + priv->np_refs = 1; error = devfs_set_cdevpriv(priv, netmap_dtor); if (error) { free(priv, M_DEVBUF); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r285362 - head/sys/netpfil/ipfw
Author: luigi Date: Fri Jul 10 19:24:36 2015 New Revision: 285362 URL: https://svnweb.freebsd.org/changeset/base/285362 Log: assorted algorithmic fixes from Paolo Valente (one of my qfq coauthors): - use 1ULL to avoid shift truncations - recompute the sum of weight dynamically to provide better fairness - fix an erroneous constant in the computation of the slot - preserve timestamp correctness when the old timestamp is stale. Modified: head/sys/netpfil/ipfw/dn_sched_qfq.c Modified: head/sys/netpfil/ipfw/dn_sched_qfq.c == --- head/sys/netpfil/ipfw/dn_sched_qfq.cFri Jul 10 19:18:49 2015 (r285361) +++ head/sys/netpfil/ipfw/dn_sched_qfq.cFri Jul 10 19:24:36 2015 (r285362) @@ -172,8 +172,6 @@ for the scheduler: bitmaps and bucket li #defineQFQ_MAX_WEIGHT (1lmax); cl->grp = &q->groups[i]; q->wsum += w; + q->iwsum = ONE_FP / q->wsum; /* XXX note theory */ // XXX cl->S = q->V; ? - // XXX compute q->i_wsum return 0; } @@ -325,6 +324,8 @@ qfq_free_queue(struct dn_queue *_q) struct qfq_class *cl = (struct qfq_class *)_q; if (cl->inv_w) { q->wsum -= ONE_FP/cl->inv_w; + if (q->wsum != 0) + q->iwsum = ONE_FP / q->wsum; cl->inv_w = 0; /* reset weight to avoid run twice */ } return 0; @@ -408,7 +409,8 @@ qfq_make_eligible(struct qfq_sched *q, u old_vslot = old_V >> QFQ_MIN_SLOT_SHIFT; if (vslot != old_vslot) { - mask = (2UL << (__fls(vslot ^ old_vslot))) - 1; + /* should be 1ULL not 2ULL */ + mask = (1ULL << (__fls(vslot ^ old_vslot))) - 1; qfq_move_groups(q, mask, IR, ER); qfq_move_groups(q, mask, IB, EB); } @@ -557,7 +559,7 @@ qfq_dequeue(struct dn_sch_inst *si) } NO(q->queued--;) old_V = q->V; - q->V += (uint64_t)m->m_pkthdr.len * IWSUM; + q->V += (uint64_t)m->m_pkthdr.len * q->iwsum; ND("m is %p F 0x%llx V now 0x%llx", m, cl->F, q->V); if (qfq_update_class(q, grp, cl)) { @@ -612,7 +614,7 @@ qfq_update_start(struct qfq_sched *q, st int slot_shift = cl->grp->slot_shift; roundedF = qfq_round_down(cl->F, slot_shift); - limit = qfq_round_down(q->V, slot_shift) + (1UL << slot_shift); + limit = qfq_round_down(q->V, slot_shift) + (1ULL << slot_shift); if (!qfq_gt(cl->F, q->V) || qfq_gt(roundedF, limit)) { /* timestamp was stale */ @@ -620,7 +622,11 @@ qfq_update_start(struct qfq_sched *q, st if (mask) { struct qfq_group *next = qfq_ffs(q, mask); if (qfq_gt(roundedF, next->F)) { - cl->S = next->F; + /* from pv 71261956973ba9e0637848a5adb4a5819b4bae83 */ + if (qfq_gt(limit, next->F)) + cl->S = next->F; + else /* preserve timestamp correctness */ + cl->S = limit; return; } } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r285361 - head/sys/netpfil/ipfw
Author: luigi Date: Fri Jul 10 19:18:49 2015 New Revision: 285361 URL: https://svnweb.freebsd.org/changeset/base/285361 Log: one more warning suppression when compiling the test code in userspace. Modified: head/sys/netpfil/ipfw/dn_heap.c Modified: head/sys/netpfil/ipfw/dn_heap.c == --- head/sys/netpfil/ipfw/dn_heap.c Fri Jul 10 18:10:40 2015 (r285360) +++ head/sys/netpfil/ipfw/dn_heap.c Fri Jul 10 19:18:49 2015 (r285361) @@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$"); #include "dn_heap.h" #define log(x, arg...) fprintf(stderr, ## arg) #define panic(x...)fprintf(stderr, ## x), exit(1) -#define MALLOC_DEFINE(a, b, c) +#define MALLOC_DEFINE(a, b, c) volatile int __dummy__ ## a __attribute__((__unused__)) static void *my_malloc(int s) {return malloc(s); } static void my_free(void *p) { free(p); } #define malloc(s, t, w)my_malloc(s) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r285360 - head/sys/netpfil/ipfw/test
Author: luigi Date: Fri Jul 10 18:10:40 2015 New Revision: 285360 URL: https://svnweb.freebsd.org/changeset/base/285360 Log: add code to compute fairness indexes; cleanups to remove compile warnings. Modified: head/sys/netpfil/ipfw/test/dn_test.h head/sys/netpfil/ipfw/test/main.c Modified: head/sys/netpfil/ipfw/test/dn_test.h == --- head/sys/netpfil/ipfw/test/dn_test.hFri Jul 10 16:05:24 2015 (r285359) +++ head/sys/netpfil/ipfw/test/dn_test.hFri Jul 10 18:10:40 2015 (r285360) @@ -30,9 +30,13 @@ extern int debug; #ifndef offsetof -#define offsetof(t,m) (int)((&((t *)0L)->m)) +#define offsetof(t,m) (int)(intptr_t)((&((t *)0L)->m)) #endif +#if defined(__APPLE__) // XXX osx +typedef unsigned int u_int; +#endif /* osx */ + #include /* prevent include of other system headers */ @@ -85,6 +89,11 @@ struct dn_flow { uint64_t tot_bytes; uint32_t flow_id; struct list_head h; /* used by the generator */ + + /* bytes served by the flow since the last backlog time */ + uint64_t bytes; + /* bytes served by the system at the last backlog time */ + uint64_t sch_bytes; }; struct dn_link { @@ -103,7 +112,7 @@ struct mbuf { void *cfg; /* config args */ }; -#define MALLOC_DECLARE(x) +#define MALLOC_DECLARE(x) extern volatile int __dummy__ ## x #define KASSERT(x, y) do { if (!(x)) printf y ; exit(0); } while (0) struct ipfw_flow_id { }; Modified: head/sys/netpfil/ipfw/test/main.c == --- head/sys/netpfil/ipfw/test/main.c Fri Jul 10 16:05:24 2015 (r285359) +++ head/sys/netpfil/ipfw/test/main.c Fri Jul 10 18:10:40 2015 (r285360) @@ -75,6 +75,9 @@ struct cfg_s { #define BACKLOG30 uint32_tllmask; struct list_head ll[BACKLOG + 10]; + + double *q_wfi; /* (byte) Worst-case Fair Index of the flows */ + double wfi; /* (byte) Worst-case Fair Index of the system */ }; /* FI2Q and Q2FI converts from flow_id to dn_queue and back. @@ -145,6 +148,39 @@ dequeue(struct cfg_s *c) return m; } +static void +gnet_stats_enq(struct cfg_s *c, struct mbuf *mb) +{ + struct dn_sch_inst *si = c->si; + struct dn_queue *_q = FI2Q(c, mb->flow_id); + + if (_q->ni.length == 1) { + _q->ni.bytes = 0; + _q->ni.sch_bytes = si->ni.bytes; + } +} + +static void +gnet_stats_deq(struct cfg_s *c, struct mbuf *mb) +{ + struct dn_sch_inst *si = c->si; + struct dn_queue *_q = FI2Q(c, mb->flow_id); + int len = mb->m_pkthdr.len; + + _q->ni.bytes += len; + si->ni.bytes += len; + + if (_q->ni.length == 0) { + double bytes = (double)_q->ni.bytes; + double sch_bytes = (double)si->ni.bytes - _q->ni.sch_bytes; + double weight = (double)_q->fs->fs.par[0] / c->wsum; + double wfi = sch_bytes * weight - bytes; + + if (c->q_wfi[mb->flow_id] < wfi) + c->q_wfi[mb->flow_id] = wfi; + } +} + static int mainloop(struct cfg_s *c) { @@ -164,6 +200,7 @@ mainloop(struct cfg_s *c) } else { ND("enqueue ok"); c->pending++; + gnet_stats_enq(c, m); } } if (c->can_dequeue) { @@ -172,6 +209,7 @@ mainloop(struct cfg_s *c) c->pending--; drop(c, m); c->drop--; /* compensate */ + gnet_stats_deq(c, m); } } } @@ -187,7 +225,8 @@ dump(struct cfg_s *c) for (i=0; i < c->flows; i++) { q = FI2Q(c, i); - DX(1, "queue %4d tot %10lld", i, q->ni.tot_bytes); + DX(1, "queue %4d tot %10llu", i, + (unsigned long long)q->ni.tot_bytes); } DX(1, "done %d loops\n", c->loops); return 0; @@ -373,6 +412,9 @@ init(struct cfg_s *c) extern moduledata_t *_g_dn_wf2qp; extern moduledata_t *_g_dn_rr; extern moduledata_t *_g_dn_qfq; +#ifdef WITH_QFQP + extern moduledata_t *_g_dn_qfqp; +#endif #ifdef WITH_KPS extern moduledata_t *_g_dn_kps; #endif @@ -384,6 +426,11 @@ init(struct cfg_s *c) mod = _g_dn_fifo; else if (!strcmp(av[1], "qfq")) mod = _g_dn_qfq; +#ifdef WITH_QFQP + else if (!strcmp(av[1], "qfq+") || + !strcmp(av[1], "qfqp") ) + mod = _g_dn_qfqp; +#endi
svn commit: r285359 - head/sys/dev/netmap
Author: luigi Date: Fri Jul 10 16:05:24 2015 New Revision: 285359 URL: https://svnweb.freebsd.org/changeset/base/285359 Log: staticize functions only used in netmap.c (detected by jenkins run with gcc 4.9) Update documentation on the use of netmap_priv_d, rename the refcount and use the same structure in FreeBSD and linux No functional changes. Modified: head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_freebsd.c head/sys/dev/netmap/netmap_kern.h head/sys/dev/netmap/netmap_vale.c Modified: head/sys/dev/netmap/netmap.c == --- head/sys/dev/netmap/netmap.cFri Jul 10 14:39:46 2015 (r285358) +++ head/sys/dev/netmap/netmap.cFri Jul 10 16:05:24 2015 (r285359) @@ -726,6 +726,9 @@ netmap_update_config(struct netmap_adapt return 1; } +static void netmap_txsync_to_host(struct netmap_adapter *na); +static int netmap_rxsync_from_host(struct netmap_adapter *na, struct thread *td, void *pwait); + /* kring->nm_sync callback for the host tx ring */ static int netmap_txsync_to_host_compat(struct netmap_kring *kring, int flags) @@ -959,11 +962,12 @@ nm_si_user(struct netmap_priv_d *priv, e } /* - * Destructor of the netmap_priv_d, called when the fd has - * no active open() and mmap(). - * Undo all the things done by NIOCREGIF. + * Destructor of the netmap_priv_d, called when the fd is closed + * Action: undo all the things done by NIOCREGIF, + * On FreeBSD we need to track whether there are active mmap()s, + * and we use np_active_mmaps for that. On linux, the field is always 0. + * Return: 1 if we can free priv, 0 otherwise. * - * returns 1 if this is the last instance and we can free priv */ /* call with NMG_LOCK held */ int @@ -971,17 +975,13 @@ netmap_dtor_locked(struct netmap_priv_d { struct netmap_adapter *na = priv->np_na; -#ifdef __FreeBSD__ - /* -* np_refcount is the number of active mmaps on -* this file descriptor -*/ - if (--priv->np_refcount > 0) { + /* number of active mmaps on this fd (FreeBSD only) */ + if (--priv->np_refs > 0) { return 0; } -#endif /* __FreeBSD__ */ + if (!na) { - return 1; //XXX is it correct? + return 1; //XXX is it correct? } netmap_do_unregif(priv); netmap_adapter_put(na); @@ -1139,7 +1139,7 @@ netmap_sw_to_nic(struct netmap_adapter * * can be among multiple user threads erroneously calling * this routine concurrently. */ -void +static void netmap_txsync_to_host(struct netmap_adapter *na) { struct netmap_kring *kring = &na->tx_rings[na->num_tx_rings]; @@ -1177,7 +1177,7 @@ netmap_txsync_to_host(struct netmap_adap * returns the number of packets delivered to tx queues in * transparent mode, or a negative value if error */ -int +static int netmap_rxsync_from_host(struct netmap_adapter *na, struct thread *td, void *pwait) { struct netmap_kring *kring = &na->rx_rings[na->num_rx_rings]; Modified: head/sys/dev/netmap/netmap_freebsd.c == --- head/sys/dev/netmap/netmap_freebsd.cFri Jul 10 14:39:46 2015 (r285358) +++ head/sys/dev/netmap/netmap_freebsd.cFri Jul 10 16:05:24 2015 (r285359) @@ -576,7 +576,7 @@ netmap_mmap_single(struct cdev *cdev, vm goto err_unlock; } vmh->priv = priv; - priv->np_refcount++; + priv->np_refs++; NMG_UNLOCK(); obj = cdev_pager_allocate(vmh, OBJT_DEVICE, @@ -593,7 +593,7 @@ netmap_mmap_single(struct cdev *cdev, vm err_deref: NMG_LOCK(); - priv->np_refcount--; + priv->np_refs--; err_unlock: NMG_UNLOCK(); // err: @@ -602,14 +602,14 @@ err_unlock: } /* - * netmap_close() is called on every close(), but we do not need to do - * anything at that moment, since the process may have other open file - * descriptors for /dev/netmap. Instead, we pass netmap_dtor() to + * On FreeBSD the close routine is only called on the last close on + * the device (/dev/netmap) so we cannot do anything useful. + * To track close() on individual file descriptors we pass netmap_dtor() to * devfs_set_cdevpriv() on open(). The FreeBSD kernel will call the destructor * when the last fd pointing to the device is closed. * - * Unfortunately, FreeBSD does not automatically track active mmap()s on an fd, - * so we have to track them by ourselvesi (see above). The result is that + * Note that FreeBSD does not even munmap() on close() so we also have + * to track mmap() ourselves, and postpone the call to * netmap_dtor() is called when the process has no open fds and no active * memory maps on /dev/netmap, as in linux. */ @@ -634,19 +634,15 @@ netmap_open(struct cdev *dev, int oflags (void)devtype; (void)td; - // XXX wait or nowai
svn commit: r285351 - head/sys/dev/virtio/network
Author: luigi Date: Fri Jul 10 07:13:14 2015 New Revision: 285351 URL: https://svnweb.freebsd.org/changeset/base/285351 Log: add netmap dependency when compiled as a module Modified: head/sys/dev/virtio/network/if_vtnet.c Modified: head/sys/dev/virtio/network/if_vtnet.c == --- head/sys/dev/virtio/network/if_vtnet.c Fri Jul 10 06:47:14 2015 (r285350) +++ head/sys/dev/virtio/network/if_vtnet.c Fri Jul 10 07:13:14 2015 (r285351) @@ -304,6 +304,9 @@ DRIVER_MODULE(vtnet, virtio_pci, vtnet_d vtnet_modevent, 0); MODULE_VERSION(vtnet, 1); MODULE_DEPEND(vtnet, virtio, 1, 1, 1); +#ifdef DEV_NETMAP +MODULE_DEPEND(vtnet, netmap, 1, 1, 1); +#endif /* DEV_NETMAP */ static int vtnet_modevent(module_t mod, int type, void *unused) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r285349 - in head/sys: dev/cxgbe dev/e1000 dev/ixgbe dev/netmap dev/re net
Author: luigi Date: Fri Jul 10 05:51:36 2015 New Revision: 285349 URL: https://svnweb.freebsd.org/changeset/base/285349 Log: Sync netmap sources with the version in our private tree. This commit contains large contributions from Giuseppe Lettieri and Stefano Garzarella, is partly supported by grants from Verisign and Cisco, and brings in the following: - fix zerocopy monitor ports and introduce copying monitor ports (the latter are lower performance but give access to all traffic in parallel with the application) - exclusive open mode, useful to implement solutions that recover from crashes of the main netmap client (suggested by Patrick Kelsey) - revised memory allocator in preparation for the 'passthrough mode' (ptnetmap) recently presented at bsdcan. ptnetmap is described in S. Garzarella, G. Lettieri, L. Rizzo; Virtual device passthrough for high speed VM networking, ACM/IEEE ANCS 2015, Oakland (CA) May 2015 http://info.iet.unipi.it/~luigi/research.html - fix rx CRC handing on ixl - add module dependencies for netmap when building drivers as modules - minor simplifications to device-specific routines (*txsync, *rxsync) - general code cleanup (remove unused variables, introduce macros to access rings and remove duplicate code, Applications do not need to be recompiled, unless of course they want to use the new features (monitors and exclusive open). Those willing to try this code on stable/10 can just update the sys/dev/netmap/*, sys/net/netmap* with the version in HEAD and apply the small patches to individual device drivers. MFC after:1 month Sponsored by: (partly) Verisign, Cisco Modified: head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_netmap.c head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_lem.c head/sys/dev/ixgbe/if_ix.c head/sys/dev/netmap/if_em_netmap.h head/sys/dev/netmap/if_igb_netmap.h head/sys/dev/netmap/if_ixl_netmap.h head/sys/dev/netmap/if_lem_netmap.h head/sys/dev/netmap/if_re_netmap.h head/sys/dev/netmap/if_vtnet_netmap.h head/sys/dev/netmap/ixgbe_netmap.h head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_freebsd.c head/sys/dev/netmap/netmap_generic.c head/sys/dev/netmap/netmap_kern.h head/sys/dev/netmap/netmap_mem2.c head/sys/dev/netmap/netmap_mem2.h head/sys/dev/netmap/netmap_monitor.c head/sys/dev/netmap/netmap_pipe.c head/sys/dev/netmap/netmap_vale.c head/sys/dev/re/if_re.c head/sys/net/netmap.h head/sys/net/netmap_user.h Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cFri Jul 10 05:07:18 2015 (r285348) +++ head/sys/dev/cxgbe/t4_main.cFri Jul 10 05:51:36 2015 (r285349) @@ -8533,10 +8533,17 @@ static devclass_t cxgbe_devclass, cxl_de DRIVER_MODULE(t4nex, pci, t4_driver, t4_devclass, mod_event, 0); MODULE_VERSION(t4nex, 1); MODULE_DEPEND(t4nex, firmware, 1, 1, 1); +#ifdef DEV_NETMAP +MODULE_DEPEND(t4nex, netmap, 1, 1, 1); +#endif /* DEV_NETMAP */ + DRIVER_MODULE(t5nex, pci, t5_driver, t5_devclass, mod_event, 0); MODULE_VERSION(t5nex, 1); MODULE_DEPEND(t5nex, firmware, 1, 1, 1); +#ifdef DEV_NETMAP +MODULE_DEPEND(t5nex, netmap, 1, 1, 1); +#endif /* DEV_NETMAP */ DRIVER_MODULE(cxgbe, t4nex, cxgbe_driver, cxgbe_devclass, 0, 0); MODULE_VERSION(cxgbe, 1); Modified: head/sys/dev/cxgbe/t4_netmap.c == --- head/sys/dev/cxgbe/t4_netmap.c Fri Jul 10 05:07:18 2015 (r285348) +++ head/sys/dev/cxgbe/t4_netmap.c Fri Jul 10 05:51:36 2015 (r285349) @@ -917,8 +917,6 @@ cxgbe_netmap_txsync(struct netmap_kring kring->nr_hwtail -= kring->nkr_num_slots; } - nm_txsync_finalize(kring); - return (0); } @@ -931,7 +929,7 @@ cxgbe_netmap_rxsync(struct netmap_kring struct port_info *pi = ifp->if_softc; struct adapter *sc = pi->adapter; struct sge_nm_rxq *nm_rxq = &sc->sge.nm_rxq[pi->first_nm_rxq + kring->ring_id]; - u_int const head = nm_rxsync_prologue(kring); + u_int const head = kring->rhead; u_int n; int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR; @@ -993,8 +991,6 @@ cxgbe_netmap_rxsync(struct netmap_kring } } - nm_rxsync_finalize(kring); - return (0); } Modified: head/sys/dev/e1000/if_em.c == --- head/sys/dev/e1000/if_em.c Fri Jul 10 05:07:18 2015(r285348) +++ head/sys/dev/e1000/if_em.c Fri Jul 10 05:51:36 2015(r285349) @@ -344,6 +344,9 @@ devclass_t em_devclass; DRIVER_MODULE(em, pci, em_driver, em_devclass, 0, 0); MODULE_DEPEND(em, pci, 1, 1, 1); MODULE_DEPEND(em, ethe
svn commit: r285348 - head/release/picobsd/build
Author: luigi Date: Fri Jul 10 05:07:18 2015 New Revision: 285348 URL: https://svnweb.freebsd.org/changeset/base/285348 Log: rev.284898 removed _SHLIBDIRPREFIX so we need to reconstruct its value to properly locate libraries created in the buildworld phase. Modified: head/release/picobsd/build/picobsd Modified: head/release/picobsd/build/picobsd == --- head/release/picobsd/build/picobsd Fri Jul 10 02:23:50 2015 (r285347) +++ head/release/picobsd/build/picobsd Fri Jul 10 05:07:18 2015 (r285348) @@ -532,7 +532,11 @@ do_links() { # rootdir varname # if no argument default to objdir/SHLIBDIRPREFIX for both find_progs() { # programs # logverbose "find_progs: called with $*" - local i=`realpath ${o_objdir:-${_SHLIBDIRPREFIX}/..}` + # rev.284898 removed _SHLIBDIRPREFIX so we need to reconstruct + # its value in i1 + local i1=${_SHLIBDIRPREFIX:-${l_objtree}/${SRC}/tmp} + local i=`realpath ${o_objdir:-${i1}/..}` + # default values for -L and -P local dir="-P $i" local ldir="-L $i" ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r285284 - head/lib/liblzma
Author: luigi Date: Wed Jul 8 18:36:37 2015 New Revision: 285284 URL: https://svnweb.freebsd.org/changeset/base/285284 Log: only enable immintrin when clang is used. The base gcc does not support it. Reviewed by: delphij Modified: head/lib/liblzma/config.h Modified: head/lib/liblzma/config.h == --- head/lib/liblzma/config.h Wed Jul 8 18:12:24 2015(r285283) +++ head/lib/liblzma/config.h Wed Jul 8 18:36:37 2015(r285284) @@ -150,7 +150,8 @@ #define HAVE_ICONV 1 /* Define to 1 if you have the header file. */ -#if defined(__FreeBSD__) && defined(__amd64__) +/* FreeBSD - only with clang because the base gcc does not support it */ +#if defined(__clang__) && defined(__FreeBSD__) && defined(__amd64__) #define HAVE_IMMINTRIN_H 1 #endif ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r285281 - head/release/picobsd/floppy.tree/etc
Author: luigi Date: Wed Jul 8 16:42:28 2015 New Revision: 285281 URL: https://svnweb.freebsd.org/changeset/base/285281 Log: add an extra tty for picobsd builds Modified: head/release/picobsd/floppy.tree/etc/ttys Modified: head/release/picobsd/floppy.tree/etc/ttys == --- head/release/picobsd/floppy.tree/etc/ttys Wed Jul 8 16:41:25 2015 (r285280) +++ head/release/picobsd/floppy.tree/etc/ttys Wed Jul 8 16:42:28 2015 (r285281) @@ -33,3 +33,4 @@ ttyp7 nonenetwork secure ttyp8 nonenetwork secure ttyp9 nonenetwork secure ttyu0 "/usr/libexec/getty 3wire" dialup on secure +ttyu1 "/usr/libexec/getty 3wire" dialup on secure ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r285280 - head/release/picobsd/build
Author: luigi Date: Wed Jul 8 16:41:25 2015 New Revision: 285280 URL: https://svnweb.freebsd.org/changeset/base/285280 Log: trap some errors when building picobsd Modified: head/release/picobsd/build/picobsd Modified: head/release/picobsd/build/picobsd == --- head/release/picobsd/build/picobsd Wed Jul 8 16:37:48 2015 (r285279) +++ head/release/picobsd/build/picobsd Wed Jul 8 16:41:25 2015 (r285280) @@ -725,10 +725,10 @@ populate_mfs_tree() { # /stand/crunch is our main binary, we extract its libs find_progs ${dst}/stand/crunch if [ -n "${u_libs}" ] ; then - mkdir -p ${dst}/lib && cp -p ${u_libs} ${dst}/lib + mkdir -p ${dst}/lib && (cp -p ${u_libs} ${dst}/lib || log "copy libs ${u_libs} failed" ) mkdir -p ${dst}/libexec create_includes_and_libraries2 libexec/rtld-elf -find_progs ld-elf.so.1 && cp -p ${u_progs} ${dst}/libexec +find_progs ld-elf.so.1 && ( cp -p ${u_progs} ${dst}/libexec || log "copy ${u_progs} failed" ) fi [ -n "${copy_files}" ] && do_copyfiles ${dst} copy_files @@ -959,6 +959,7 @@ set_build_parameters() { export WITH_GNUCXX=yes export WITHOUT_CLANG=yes export WITHOUT_ICONV=yes + export WITHOUT_TESTS=yes # XXX why change machine_arch ? #-- export MACHINE_ARCH=`uname -m` MACHINE=`uname -m` ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r283583 - stable/10/contrib/tcpdump
Author: luigi Date: Tue May 26 21:12:02 2015 New Revision: 283583 URL: https://svnweb.freebsd.org/changeset/base/283583 Log: MFC: 272451, 272653 add CAP_EVENT so that we can poll() on netmap and pcap file descriptors Modified: stable/10/contrib/tcpdump/tcpdump.c Modified: stable/10/contrib/tcpdump/tcpdump.c == --- stable/10/contrib/tcpdump/tcpdump.c Tue May 26 21:03:41 2015 (r283582) +++ stable/10/contrib/tcpdump/tcpdump.c Tue May 26 21:12:02 2015 (r283583) @@ -1486,7 +1486,12 @@ main(int argc, char **argv) if (RFileName == NULL && VFileName == NULL) { static const unsigned long cmds[] = { BIOCGSTATS }; - cap_rights_init(&rights, CAP_IOCTL, CAP_READ); + /* +* The various libpcap devices use a combination of +* read (bpf), ioctl (bpf, netmap), poll (netmap). +* Grant the relevant access rights, sorted by name. +*/ + cap_rights_init(&rights, CAP_EVENT, CAP_IOCTL, CAP_READ); if (cap_rights_limit(pcap_fileno(pd), &rights) < 0 && errno != ENOSYS) { error("unable to limit pcap descriptor"); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r283116 - head/sys/netpfil/ipfw
Author: luigi Date: Tue May 19 16:51:30 2015 New Revision: 283116 URL: https://svnweb.freebsd.org/changeset/base/283116 Log: use proper types to represent function pointers Modified: head/sys/netpfil/ipfw/ip_fw_pfil.c head/sys/netpfil/ipfw/ip_fw_sockopt.c Modified: head/sys/netpfil/ipfw/ip_fw_pfil.c == --- head/sys/netpfil/ipfw/ip_fw_pfil.c Tue May 19 16:23:47 2015 (r283115) +++ head/sys/netpfil/ipfw/ip_fw_pfil.c Tue May 19 16:51:30 2015 (r283116) @@ -505,7 +505,7 @@ static int ipfw_hook(int onoff, int pf) { struct pfil_head *pfh; - void *hook_func; + pfil_func_t hook_func; pfh = pfil_head_get(PFIL_TYPE_AF, pf); if (pfh == NULL) Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c == --- head/sys/netpfil/ipfw/ip_fw_sockopt.c Tue May 19 16:23:47 2015 (r283115) +++ head/sys/netpfil/ipfw/ip_fw_sockopt.c Tue May 19 16:51:30 2015 (r283116) @@ -2846,7 +2846,7 @@ compare_sh(const void *_a, const void *_ * Returns pointer to handler or NULL. */ static struct ipfw_sopt_handler * -find_sh(uint16_t code, uint8_t version, void *handler) +find_sh(uint16_t code, uint8_t version, sopt_handler_f *handler) { struct ipfw_sopt_handler *sh, h; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r283113 - head/sys/netpfil/ipfw
Author: luigi Date: Tue May 19 15:29:00 2015 New Revision: 283113 URL: https://svnweb.freebsd.org/changeset/base/283113 Log: remove a redundant ; at the end of a function MFC after:1 week Modified: head/sys/netpfil/ipfw/ip_dn_private.h Modified: head/sys/netpfil/ipfw/ip_dn_private.h == --- head/sys/netpfil/ipfw/ip_dn_private.h Tue May 19 15:25:47 2015 (r283112) +++ head/sys/netpfil/ipfw/ip_dn_private.h Tue May 19 15:29:00 2015 (r283113) @@ -92,7 +92,7 @@ set_oid(struct dn_id *o, int type, int l o->type = type; o->len = len; o->subtype = 0; -}; +} /* * configuration and global data for a dummynet instance ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r283111 - head/sys/netpfil/ipfw
Author: luigi Date: Tue May 19 14:49:31 2015 New Revision: 283111 URL: https://svnweb.freebsd.org/changeset/base/283111 Log: remove an extra ; after MODULE_DEPEND (would otherwise generate a warning with more verbose compiler flags) MFC after:1 week Modified: head/sys/netpfil/ipfw/dn_sched.h Modified: head/sys/netpfil/ipfw/dn_sched.h == --- head/sys/netpfil/ipfw/dn_sched.hTue May 19 14:23:33 2015 (r283110) +++ head/sys/netpfil/ipfw/dn_sched.hTue May 19 14:49:31 2015 (r283111) @@ -188,5 +188,5 @@ int dn_sched_modevent(module_t mod, int }; \ DECLARE_MODULE(name, name##_mod,\ SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY); \ -MODULE_DEPEND(name, dummynet, 3, 3, 3); +MODULE_DEPEND(name, dummynet, 3, 3, 3) #endif /* _DN_SCHED_H */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r282856 - head/sys/netpfil/ipfw
Author: luigi Date: Wed May 13 11:53:25 2015 New Revision: 282856 URL: https://svnweb.freebsd.org/changeset/base/282856 Log: bugfix (only affecting the "lookup" option in the userspace version of ipfw): the conditional block should not include the 'else' otherwise the code does a 'break;' without completing the check Modified: head/sys/netpfil/ipfw/ip_fw2.c Modified: head/sys/netpfil/ipfw/ip_fw2.c == --- head/sys/netpfil/ipfw/ip_fw2.c Wed May 13 11:49:38 2015 (r282855) +++ head/sys/netpfil/ipfw/ip_fw2.c Wed May 13 11:53:25 2015 (r282856) @@ -1532,8 +1532,9 @@ do { \ else if (v == 5 /* O_JAIL */) key = ucred_cache.xid; #endif /* !__FreeBSD__ */ - } else + } #endif /* !USERSPACE */ + else break; } match = ipfw_lookup_table(chain, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r279232 - in head/sys/dev: ixl netmap
sert(&txr->mtx, MA_OWNED); +#ifdef DEV_NETMAP + // XXX todo: implement moderation + if (netmap_tx_irq(que->vsi->ifp, que->me)) + return FALSE; +#endif /* DEF_NETMAP */ /* These are not the descriptors you seek, move along :) */ if (txr->avail == que->num_desc) { @@ -1124,8 +1158,16 @@ ixl_init_rx_ring(struct ixl_queue *que) struct ixl_rx_buf *buf; bus_dma_segment_t pseg[1], hseg[1]; int rsize, nsegs, error = 0; +#ifdef DEV_NETMAP + struct netmap_adapter *na = NA(que->vsi->ifp); + struct netmap_slot *slot; +#endif /* DEV_NETMAP */ IXL_RX_LOCK(rxr); +#ifdef DEV_NETMAP + /* same as in ixl_init_tx_ring() */ + slot = netmap_reset(na, NR_RX, que->me, 0); +#endif /* DEV_NETMAP */ /* Clear the ring contents */ rsize = roundup2(que->num_desc * sizeof(union i40e_rx_desc), DBA_ALIGN); @@ -1159,6 +1201,28 @@ ixl_init_rx_ring(struct ixl_queue *que) struct mbuf *mh, *mp; buf = &rxr->buffers[j]; +#ifdef DEV_NETMAP + /* +* In netmap mode, fill the map and set the buffer +* address in the NIC ring, considering the offset +* between the netmap and NIC rings (see comment in +* ixgbe_setup_transmit_ring() ). No need to allocate +* an mbuf, so end the block with a continue; +*/ + if (slot) { + int sj = netmap_idx_n2k(&na->rx_rings[que->me], j); + uint64_t paddr; + void *addr; + + addr = PNMB(na, slot + sj, &paddr); + netmap_load_map(na, rxr->dma.tag, buf->pmap, addr); + /* Update descriptor and the cached value */ + rxr->base[j].read.pkt_addr = htole64(paddr); + rxr->base[j].read.hdr_addr = 0; + continue; + } +#endif /* DEV_NETMAP */ + /* ** Don't allocate mbufs if not ** doing header split, its wasteful @@ -1458,6 +1522,12 @@ ixl_rxeof(struct ixl_queue *que, int cou IXL_RX_LOCK(rxr); +#ifdef DEV_NETMAP + if (netmap_rx_irq(ifp, que->me, &count)) { + IXL_RX_UNLOCK(rxr); + return (FALSE); + } +#endif /* DEV_NETMAP */ for (i = rxr->next_check; count != 0;) { struct mbuf *sendmp, *mh, *mp; Added: head/sys/dev/netmap/if_ixl_netmap.h ====== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/netmap/if_ixl_netmap.h Tue Feb 24 06:20:50 2015 (r279232) @@ -0,0 +1,422 @@ +/* + * Copyright (C) 2015, Luigi Rizzo. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * $FreeBSD$ + * + * netmap support for: ixl + * + * derived from ixgbe + * netmap support for a network driver. + * This file contains code but only static or inline functions used + * by a single driver. To avoid replication of code we just #include + * it near the beginning of the standard driver. + * For ixl the file is imported in two places, hence the conditional at the + * beginning. + */ + +#include +#include + +/* + * Some drivers may need the following headers. Others + * already include them by default + +#include +#include + + */ +#include + +int ixl_netmap_txsync(struct netmap_kring *kring, int flags); +int ixl_netmap_rxsync(struct netmap_kring *k
svn commit: r279199 - head/sys/dev/netmap
Author: luigi Date: Mon Feb 23 07:28:31 2015 New Revision: 279199 URL: https://svnweb.freebsd.org/changeset/base/279199 Log: add MODULE_VERSION, needed to track module dependencies MFC after:3 days Modified: head/sys/dev/netmap/netmap_freebsd.c Modified: head/sys/dev/netmap/netmap_freebsd.c == --- head/sys/dev/netmap/netmap_freebsd.cMon Feb 23 06:46:04 2015 (r279198) +++ head/sys/dev/netmap/netmap_freebsd.cMon Feb 23 07:28:31 2015 (r279199) @@ -830,3 +830,4 @@ netmap_loader(__unused struct module *mo DEV_MODULE(netmap, netmap_loader, NULL); +MODULE_VERSION(netmap, 1); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r278779 - stable/10/sys/dev/netmap
Author: luigi Date: Sat Feb 14 19:41:26 2015 New Revision: 278779 URL: https://svnweb.freebsd.org/changeset/base/278779 Log: sync the code with the version in head. which the exception of svn 275358 (M_FLOWID deprecation, only a couple of lines) which cannot be merged. if_lem_netmap.h, if_re_netmap.h: - use the same (commented out) function to update the stat counters as in HEAD. This is a no-op here netmap.c - merge 274459 (support for private knote lock) and minor changes on nm_config and comments netmap_freebsd.c - merge 274459 (support for private knote lock) - merge 274354 (initialize color if passed as argument) netmap_generic.c - fix a comment netmap_kern.h - revise the lock macros, using sx locks; merge 274459 (private knote lock) netmap_monitor.c - use full memory barriers netmap_pipe.c - use full memory barriers, use length from the correct queue (mostly cosmetic, since the queues typically have the same size) Modified: stable/10/sys/dev/netmap/if_lem_netmap.h stable/10/sys/dev/netmap/if_re_netmap.h stable/10/sys/dev/netmap/netmap.c stable/10/sys/dev/netmap/netmap_freebsd.c stable/10/sys/dev/netmap/netmap_generic.c stable/10/sys/dev/netmap/netmap_kern.h stable/10/sys/dev/netmap/netmap_monitor.c stable/10/sys/dev/netmap/netmap_pipe.c Modified: stable/10/sys/dev/netmap/if_lem_netmap.h == --- stable/10/sys/dev/netmap/if_lem_netmap.hSat Feb 14 19:28:26 2015 (r278778) +++ stable/10/sys/dev/netmap/if_lem_netmap.hSat Feb 14 19:41:26 2015 (r278779) @@ -410,7 +410,7 @@ lem_netmap_rxsync(struct netmap_kring *k netmap_idx_n2k(kring, adapter->next_rx_desc_to_check), kring->nr_hwtail); adapter->next_rx_desc_to_check = nic_i; - // ifp->if_ipackets += n; + // if_inc_counter(ifp, IFCOUNTER_IPACKETS, n); kring->nr_hwtail = nm_i; } kring->nr_kflags &= ~NKR_PENDINTR; Modified: stable/10/sys/dev/netmap/if_re_netmap.h == --- stable/10/sys/dev/netmap/if_re_netmap.h Sat Feb 14 19:28:26 2015 (r278778) +++ stable/10/sys/dev/netmap/if_re_netmap.h Sat Feb 14 19:41:26 2015 (r278779) @@ -222,7 +222,7 @@ re_netmap_rxsync(struct netmap_kring *kr /* sync was in re_newbuf() */ bus_dmamap_sync(sc->rl_ldata.rl_rx_mtag, rxd[nic_i].rx_dmamap, BUS_DMASYNC_POSTREAD); - // sc->rl_ifp->if_ipackets++; + // if_inc_counter(sc->rl_ifp, IFCOUNTER_IPACKETS, 1); nm_i = nm_next(nm_i, lim); nic_i = nm_next(nic_i, lim); } Modified: stable/10/sys/dev/netmap/netmap.c == --- stable/10/sys/dev/netmap/netmap.c Sat Feb 14 19:28:26 2015 (r278778) +++ stable/10/sys/dev/netmap/netmap.c Sat Feb 14 19:41:26 2015 (r278779) @@ -375,9 +375,14 @@ ports attached to the switch) /* reduce conditional code */ // linux API, use for the knlist in FreeBSD -#define init_waitqueue_head(x) knlist_init_mtx(&(x)->si_note, NULL) +/* use a private mutex for the knlist */ +#define init_waitqueue_head(x) do {\ + struct mtx *m = &(x)->m;\ + mtx_init(m, "nm_kn_lock", NULL, MTX_DEF); \ + knlist_init_mtx(&(x)->si.si_note, m); \ +} while (0) -void freebsd_selwakeup(struct selinfo *si, int pri); +#define OS_selrecord(a, b) selrecord(a, &((b)->si)) #define OS_selwakeup(a, b) freebsd_selwakeup(a, b) #elif defined(linux) @@ -651,9 +656,8 @@ netmap_update_config(struct netmap_adapt u_int txr, txd, rxr, rxd; txr = txd = rxr = rxd = 0; - if (na->nm_config) { - na->nm_config(na, &txr, &txd, &rxr, &rxd); - } else { + if (na->nm_config == NULL || + na->nm_config(na, &txr, &txd, &rxr, &rxd)) { /* take whatever we had at init time */ txr = na->num_tx_rings; txd = na->num_tx_desc; @@ -806,6 +810,19 @@ netmap_krings_create(struct netmap_adapt } +#ifdef __FreeBSD__ +static void +netmap_knlist_destroy(NM_SELINFO_T *si) +{ + /* XXX kqueue(9) needed; these will mirror knlist_init. */ + knlist_delete(&si->si.si_note, curthread, 0 /* not locked */ ); + knlist_destroy(&si->si.si_note); + /* now we don't need the mutex anymore */ + mtx_destroy(&si->m); +} +#endif /* __FreeBSD__ */ + + /* undo the actions performed by netmap_krings_create */ /* call with NMG_LOCK held */ void @@ -816,6 +833,7 @@ netmap_krings_dele
svn commit: r278775 - stable/10/sys/net
Author: luigi Date: Sat Feb 14 19:18:56 2015 New Revision: 278775 URL: https://svnweb.freebsd.org/changeset/base/278775 Log: sync with the version in head (r274338): fix one comment, and return kernel-supplied error if available. no API changes. Modified: stable/10/sys/net/netmap_user.h Modified: stable/10/sys/net/netmap_user.h == --- stable/10/sys/net/netmap_user.h Sat Feb 14 19:03:11 2015 (r278774) +++ stable/10/sys/net/netmap_user.h Sat Feb 14 19:18:56 2015 (r278775) @@ -40,7 +40,7 @@ * From there: * struct netmap_ring *NETMAP_TXRING(nifp, index) * struct netmap_ring *NETMAP_RXRING(nifp, index) - * we can access ring->nr_cur, ring->nr_avail, ring->nr_flags + * we can access ring->cur, ring->head, ring->tail, etc. * * ring->slot[i] gives us the i-th slot (we can access * directly len, flags, buf_idx) @@ -543,7 +543,8 @@ fail: nm_close(d); if (errmsg) D("%s %s", errmsg, ifname); - errno = EINVAL; + if (errno == 0) + errno = EINVAL; return NULL; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r278774 - head/sys/dev/netmap
Author: luigi Date: Sat Feb 14 19:03:11 2015 New Revision: 278774 URL: https://svnweb.freebsd.org/changeset/base/278774 Log: two minor changes from the master netmap version: 1. handle errors from nm_config(), if any (none of the FreeBSD drivers currently returns an error on this function, so this change is a no-op at this time 2. use a full memory barrier on ioctls Modified: head/sys/dev/netmap/netmap.c Modified: head/sys/dev/netmap/netmap.c == --- head/sys/dev/netmap/netmap.cSat Feb 14 18:59:31 2015 (r278773) +++ head/sys/dev/netmap/netmap.cSat Feb 14 19:03:11 2015 (r278774) @@ -656,9 +656,8 @@ netmap_update_config(struct netmap_adapt u_int txr, txd, rxr, rxd; txr = txd = rxr = rxd = 0; - if (na->nm_config) { - na->nm_config(na, &txr, &txd, &rxr, &rxd); - } else { + if (na->nm_config == NULL || + na->nm_config(na, &txr, &txd, &rxr, &rxd)) { /* take whatever we had at init time */ txr = na->num_tx_rings; txd = na->num_tx_desc; @@ -2168,7 +2167,7 @@ netmap_ioctl(struct cdev *dev, u_long cm error = ENXIO; break; } - rmb(); /* make sure following reads are not from cache */ + mb(); /* make sure following reads are not from cache */ na = priv->np_na; /* we have a reference */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r278773 - head/sys/dev/netmap
Author: luigi Date: Sat Feb 14 18:59:31 2015 New Revision: 278773 URL: https://svnweb.freebsd.org/changeset/base/278773 Log: whitespace change: clarify the role of MAKEDEV_ETERNAL_KLD, and remove an old #ifdef __FreeBSD__ since the code is valid on all platforms. Modified: head/sys/dev/netmap/netmap.c Modified: head/sys/dev/netmap/netmap.c == --- head/sys/dev/netmap/netmap.cSat Feb 14 18:57:02 2015 (r278772) +++ head/sys/dev/netmap/netmap.cSat Feb 14 18:59:31 2015 (r278773) @@ -3071,16 +3071,14 @@ netmap_init(void) error = netmap_mem_init(); if (error != 0) goto fail; - /* XXX could use make_dev_credv() to get error number */ -#ifdef __FreeBSD__ - /* support for the 'eternal' flag */ + /* +* MAKEDEV_ETERNAL_KLD avoids an expensive check on syscalls +* when the module is compiled in. +* XXX could use make_dev_credv() to get error number +*/ netmap_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, &netmap_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0600, "netmap"); -#else - netmap_dev = make_dev(&netmap_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, - "netmap"); -#endif if (!netmap_dev) goto fail; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
lost change 272451 - CAP_EVENT for tcpdump (Re: svn commit: r276788 - in head: contrib/tcpdump contrib/tcpdump/lbl contrib/tcpdump/missing usr.sbin/tcpdump/tcpdump
Hi, the update to tcpdump 4.6.2 also lost svn272451 and 272653 (addition of CAP_EVENT to the capabilities given to tcpdump). Given this and the other bug fixed in 277638, I am not sure if there are other local changes that have been lost in the merge. Also I wonder whether there is something we should have done differently when applying local changes to code in contrib/ to make sure that the merge from vendor does not overwrite them ? cheers luigi On Wed, Jan 7, 2015 at 8:55 PM, Xin LI wrote: > Author: delphij > Date: Wed Jan 7 19:55:18 2015 > New Revision: 276788 > URL: https://svnweb.freebsd.org/changeset/base/276788 > > Log: > MFV r276761: tcpdump 4.6.2. > > MFC after:1 month > > Added: > head/contrib/tcpdump/README.md > - copied unchanged from r276761, vendor/tcpdump/dist/README.md > head/contrib/tcpdump/getopt_long.h > - copied unchanged from r276761, vendor/tcpdump/dist/getopt_long.h > head/contrib/tcpdump/missing/getopt_long.c > - copied unchanged from r276761, > vendor/tcpdump/dist/missing/getopt_long.c > head/contrib/tcpdump/openflow.h > - copied unchanged from r276761, vendor/tcpdump/dist/openflow.h > head/contrib/tcpdump/print-ahcp.c > - copied unchanged from r276761, vendor/tcpdump/dist/print-ahcp.c > head/contrib/tcpdump/print-aoe.c > - copied unchanged from r276761, vendor/tcpdump/dist/print-aoe.c > head/contrib/tcpdump/print-calm-fast.c > - copied unchanged from r276761, vendor/tcpdump/dist/print-calm-fast.c > head/contrib/tcpdump/print-geonet.c > - copied unchanged from r276761, vendor/tcpdump/dist/print-geonet.c > head/contrib/tcpdump/print-loopback.c > - copied unchanged from r276761, vendor/tcpdump/dist/print-loopback.c > head/contrib/tcpdump/print-m3ua.c > - copied unchanged from r276761, vendor/tcpdump/dist/print-m3ua.c > head/contrib/tcpdump/print-mptcp.c > - copied unchanged from r276761, vendor/tcpdump/dist/print-mptcp.c > head/contrib/tcpdump/print-nflog.c > - copied unchanged from r276761, vendor/tcpdump/dist/print-nflog.c > head/contrib/tcpdump/print-openflow-1.0.c > - copied unchanged from r276761, vendor/tcpdump/dist/print-openflow-1.0.c > head/contrib/tcpdump/print-openflow.c > - copied unchanged from r276761, vendor/tcpdump/dist/print-openflow.c > head/contrib/tcpdump/print-pktap.c > - copied unchanged from r276761, vendor/tcpdump/dist/print-pktap.c > head/contrib/tcpdump/rpl.h > - copied unchanged from r276761, vendor/tcpdump/dist/rpl.h > Deleted: > head/contrib/tcpdump/README > head/contrib/tcpdump/acconfig.h > head/contrib/tcpdump/aodv.h > head/contrib/tcpdump/arcnet.h > head/contrib/tcpdump/bgp.h > head/contrib/tcpdump/dccp.h > head/contrib/tcpdump/decnet.h > head/contrib/tcpdump/decode_prefix.h > head/contrib/tcpdump/enc.h > head/contrib/tcpdump/esp.h > head/contrib/tcpdump/fddi.h > head/contrib/tcpdump/forces.h > head/contrib/tcpdump/icmp6.h > head/contrib/tcpdump/ieee802_11.h > head/contrib/tcpdump/ieee802_11_radio.h > head/contrib/tcpdump/igrp.h > head/contrib/tcpdump/ipfc.h > head/contrib/tcpdump/ipnet.h > head/contrib/tcpdump/ipsec_doi.h > head/contrib/tcpdump/ipx.h > head/contrib/tcpdump/isakmp.h > head/contrib/tcpdump/l2tp.h > head/contrib/tcpdump/lane.h > head/contrib/tcpdump/missing/sockstorage.h > head/contrib/tcpdump/netbios.h > head/contrib/tcpdump/ntp.h > head/contrib/tcpdump/oakley.h > head/contrib/tcpdump/ospf6.h > head/contrib/tcpdump/pmap_prot.h > head/contrib/tcpdump/ppi.h > head/contrib/tcpdump/print-netbios.c > head/contrib/tcpdump/route6d.h > head/contrib/tcpdump/rx.h > head/contrib/tcpdump/sctpConstants.h > head/contrib/tcpdump/sctpHeader.h > head/contrib/tcpdump/slip.h > head/contrib/tcpdump/sll.h > head/contrib/tcpdump/telnet.h > head/contrib/tcpdump/tftp.h > head/contrib/tcpdump/timed.h > head/contrib/tcpdump/token.h > Modified: > head/contrib/tcpdump/CHANGES > head/contrib/tcpdump/CREDITS > head/contrib/tcpdump/INSTALL.txt > head/contrib/tcpdump/Makefile-devel-adds > head/contrib/tcpdump/Makefile.in > head/contrib/tcpdump/VERSION > head/contrib/tcpdump/addrtoname.c > head/contrib/tcpdump/addrtoname.h > head/contrib/tcpdump/af.c > head/contrib/tcpdump/af.h > head/contrib/tcpdump/ah.h > head/contrib/tcpdump/appletalk.h > head/contrib/tcpdump/atm.h > head/contrib/tcpdump/atmuni31.h > head/contrib/tcpdump/bootp.h > head/contrib/tcpdump/bpf_dump.c > head/contrib/tcpdump/chdlc.h > head/contrib/tcpdump/checksum.c > head/contrib/tcpdump/config.guess > head/contrib/tcpdump/config.h.in > head/contrib/tcpdump/config.sub > head/contrib/tcpdump/configure > head/contrib/tcpdump/configure.in > head/contrib/tcpdump/cpack.c > head/contrib/tcpdump/cpack.h > head/contrib/tcpdump/ether.h > head/contrib/tcpdump/ethertype.h > head/contrib/tcpdump/extract.h > head/contrib/tcpdump/gmpls.c > head/contrib/tc
svn commit: r277722 - in stable/10: contrib/libpcap lib/libpcap
Author: luigi Date: Mon Jan 26 03:26:37 2015 New Revision: 277722 URL: https://svnweb.freebsd.org/changeset/base/277722 Log: Merge 272659: Add netmap support to libpcap. Tcpdump and other native pcap clients can now run directly on netmap ports using netmap:foo or valeXX:YY as device names. Modifications to existing code are small and trivial, the netmap-specific code is all in a new file. Please be aware that in netmap mode the physical interface is disconnected from the host stack, so libpcap will steal the traffic not just make a copy. For the full version of the code (including linux and autotools support) see https://code.google.com/p/netmap-libpcap/ Added: stable/10/lib/libpcap/pcap-netmap.c - copied unchanged from r272659, head/lib/libpcap/pcap-netmap.c Modified: stable/10/contrib/libpcap/inet.c stable/10/contrib/libpcap/pcap.c stable/10/lib/libpcap/Makefile stable/10/lib/libpcap/config.h Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/libpcap/inet.c == --- stable/10/contrib/libpcap/inet.cMon Jan 26 02:58:30 2015 (r277721) +++ stable/10/contrib/libpcap/inet.cMon Jan 26 03:26:37 2015 (r277722) @@ -737,6 +737,10 @@ pcap_lookupnet(device, netp, maskp, errb #ifdef PCAP_SUPPORT_USB || strstr(device, "usbmon") != NULL #endif +#ifdef PCAP_SUPPORT_NETMAP + || !strncmp(device, "netmap:", 7) + || !strncmp(device, "vale", 4) +#endif #ifdef HAVE_SNF_API || strstr(device, "snf") != NULL #endif Modified: stable/10/contrib/libpcap/pcap.c == --- stable/10/contrib/libpcap/pcap.cMon Jan 26 02:58:30 2015 (r277721) +++ stable/10/contrib/libpcap/pcap.cMon Jan 26 03:26:37 2015 (r277722) @@ -106,6 +106,10 @@ static const char rcsid[] _U_ = #include "pcap-netfilter-linux.h" #endif +#ifdef PCAP_SUPPORT_NETMAP +pcap_t* pcap_netmap_create(const char *device, char *ebuf, int *is_ours); +#endif + int pcap_not_initialized(pcap_t *pcap) { @@ -301,6 +305,9 @@ struct capture_source_type { int (*findalldevs_op)(pcap_if_t **, char *); pcap_t *(*create_op)(const char *, char *, int *); } capture_source_types[] = { +#ifdef PCAP_SUPPORT_NETMAP + { NULL, pcap_netmap_create }, +#endif #ifdef HAVE_DAG_API { dag_findalldevs, dag_create }, #endif Modified: stable/10/lib/libpcap/Makefile == --- stable/10/lib/libpcap/Makefile Mon Jan 26 02:58:30 2015 (r277721) +++ stable/10/lib/libpcap/Makefile Mon Jan 26 03:26:37 2015 (r277722) @@ -7,6 +7,7 @@ SHLIBDIR?= /lib LIB= pcap SRCS= grammar.y tokdefs.h version.h pcap-bpf.c \ + pcap-netmap.c \ pcap.c pcap-common.c inet.c fad-getad.c gencode.c optimize.c nametoaddr.c \ etherent.c savefile.c bpf_filter.c bpf_image.c bpf_dump.c \ scanner.l sf-pcap.c sf-pcap-ng.c version.c Modified: stable/10/lib/libpcap/config.h == --- stable/10/lib/libpcap/config.h Mon Jan 26 02:58:30 2015 (r277721) +++ stable/10/lib/libpcap/config.h Mon Jan 26 03:26:37 2015 (r277722) @@ -271,6 +271,9 @@ /* target host supports USB sniffing */ /* #undef PCAP_SUPPORT_USB */ +/* target host supports netmap */ +#define PCAP_SUPPORT_NETMAP 1 + /* include ACN support */ /* #undef SITA */ Copied: stable/10/lib/libpcap/pcap-netmap.c (from r272659, head/lib/libpcap/pcap-netmap.c) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libpcap/pcap-netmap.c Mon Jan 26 03:26:37 2015 (r277722, copy of r272659, head/lib/libpcap/pcap-netmap.c) @@ -0,0 +1,283 @@ +/* + * Copyright (C) 2014 Luigi Rizzo. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + *
svn commit: r277641 - head/release/picobsd/build
Author: luigi Date: Sat Jan 24 08:48:05 2015 New Revision: 277641 URL: https://svnweb.freebsd.org/changeset/base/277641 Log: do not strip /stand This is a temporary workaround until the elftoolchain's version of strip is fixed: The previous (GNU) strip, when acting on a file with multiple links, would modify the one and only file in place (which means creating a new stripped copy, and then writing it back to the original). The new version from elftoolchain creates the new file and then unlinks the old one and renames the new. With multiple hard links, the original remains alive. In the /stand directory, this ends up creating 80+ copies of the same file. Modified: head/release/picobsd/build/picobsd Modified: head/release/picobsd/build/picobsd == --- head/release/picobsd/build/picobsd Sat Jan 24 08:35:49 2015 (r277640) +++ head/release/picobsd/build/picobsd Sat Jan 24 08:48:05 2015 (r277641) @@ -734,8 +734,8 @@ populate_mfs_tree() { [ -n "${copy_files}" ] && do_copyfiles ${dst} copy_files do_copyfiles_user ${dst} || true [ -n "${links}" ] && do_links ${dst} links -strip ${dst}/libexec/* ${dst}/lib/* ${dst}/stand/* 2> /dev/null || true - +strip ${dst}/libexec/* ${dst}/lib/* 2> /dev/null || true +# strip ${dst}/stand/* 2> /dev/null || true # The 'import_files' mechanism is deprecated, as it requires # root permissions to follow the symlinks, and also does # not let you rename the entries. @@ -756,7 +756,7 @@ populate_mfs_tree() { # override the owner echo "/set uid=0 gid=0" > mtree.out mtree -ic -p ${dst} -k "" >> mtree.out - log "mtre.out at ${BUILDDIR}/mtree.out" + log "mtree.out at ${BUILDDIR}/mtree.out size ${MFS_SIZE}k" makefs -t ffs -o bsize=4096 -o fsize=512 \ -s ${MFS_SIZE}k -f 1000 -F mtree.out ${c_fs} ${dst} ls -l ${c_fs} ) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r277639 - stable/10/release/picobsd/build
Author: luigi Date: Sat Jan 24 06:11:13 2015 New Revision: 277639 URL: https://svnweb.freebsd.org/changeset/base/277639 Log: use the same version as in HEAD (among other things, the -v flag to make is long since unsupported) Modified: stable/10/release/picobsd/build/picobsd Modified: stable/10/release/picobsd/build/picobsd == --- stable/10/release/picobsd/build/picobsd Sat Jan 24 06:06:46 2015 (r277638) +++ stable/10/release/picobsd/build/picobsd Sat Jan 24 06:11:13 2015 (r277639) @@ -91,7 +91,7 @@ log() { # message # unconditionally log and wait for input logverbose() { # message local foo -printf "\n*** %s\n" "$*" +printf "\n*** %s\n" "$*" >&2 read -p "=== Press enter to continue" foo return 0 } @@ -164,12 +164,11 @@ set_defaults() { # no arguments create_includes_and_libraries2() { # opt_dir opt_target local no log "create_includes_and_libraries2() for ${SRC} $1" -if [ ${OSVERSION} -ge 60 ] ; then - no="-DNO_CLEAN -DNO_PROFILE -DNO_GAMES -DNO_LIBC_R" # WITHOUT_CDDL=1" - no="$no -DWITHOUT_CLANG -DMALLOC_PRODUCTION" -else - no="-DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R" -fi + +no="-DNO_CLEAN -DNO_PROFILE -DNO_GAMES -DNO_LIBC_R" # WITHOUT_CDDL=1" +no="$no -DWITHOUT_CASPER" +no="$no -DMALLOC_PRODUCTION" + ( cd ${SRC}; # make -DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R -DPICOBSD buildworld if [ -d "$1" ] ; then @@ -177,6 +176,7 @@ create_includes_and_libraries2() { # opt else export MAKEOBJDIRPREFIX=${l_objtree} make ${o_par} $no toolchain + # XXX do we need any of these ? eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV` [ ${o_arch} != `uname -m` ] && \ @@ -185,48 +185,6 @@ create_includes_and_libraries2() { # opt ) } -# entry for 4.x and earlier trees -create_includes_and_libraries() { -local e i - -log "create_includes_and_libraries() for ${SRC}" -# Optionally creates include directory and libraries. -mkdir -p ${l_usrtree}/include # the include directory... -mkdir -p ${l_usrtree}/share/misc # a few things go here -mkdir -p ${l_usrtree}/lib # libraries -mkdir -p ${l_usrtree}/sbin # some binaries -# override variables for ownershiip and destinations -# BINOWN:BINGRP are also used for include files -(cd ${SRC}; \ - BINOWN=`id -un` BINGRP=`id -gn` \ - DESTDIR=${l_usrtree}/.. \ - make -m ${SRC}/share/mk includes ) || fail $? includes -# Pick up the correct headers for libraries. -CFLAGS="-nostdinc -I${l_usrtree}/include" ; export CFLAGS - -(cd ${SRC} - # $e is the invocation of make with correct environment - # XXX check the NO* options below, maybe system dependent. - e="MAKEOBJDIRPREFIX=${l_objtree}/picobsd/libraries \ - BINOWN=`id -un` BINGRP=`id -gn` \ - DESTDIR=${l_usrtree}/.. \ - make -m ${SRC}/share/mk \ - -DNOHTML -DNOINFO -DNOMAN -DNOSHARE -DNOFSCHG " - log "do a 'make obj' in a few places." - # This is very version-specific... The following works for 5.0 - for i in lib secure/lib gnu/lib \ - gnu/usr.bin/perl usr.bin/lex usr.sbin/config ; do - (cd ${i}; eval $e obj) - done - log "now make the static libraries" - eval $e -DNOPROFILE -DNOPIC libraries - (cd ${SRC}/usr.sbin/config - eval $e # build binary - eval $e install # install it - ) -) || fail $? "libraries" -log "Libraries done" -} # set_type [the_site] looks in user or system directories # for the directory named as the first argument, reads the configuration @@ -437,7 +395,7 @@ do_kernel() { # OK [ "${o_do_modules}" = "yes" ] && export MODULES="" # kernel build not parallelizable yet ${BINMAKE} KERNCONF=${l_kernconf} \ - -v -f ${PICO_TREE}/build/Makefile.conf ) || \ + -f ${PICO_TREE}/build/Makefile.conf ) || \ fail $? missing_kernel } @@ -570,71 +528,89 @@ do_links() { # rootdir varname # cp -p ${u_progs} ${dst}/libexec # ignore errors # } +# find programs and required libraries. Accept -L libs -P path +# if no argument default to objdir/SHLIBDIRPREFIX for both find_progs() { # programs - local pass i old_libs="" tmp o="" - if [ x"$1" = "x-L" -a -d "$2" ] ; then # set lib search path - o="-P $2"; shift; shift - fi - # Result returned in global variables - u_libs="" ; u_progs="`find_progs_helper $*`" + # logverbose "find_progs: called with $*" + local i=`realpath ${o_objdir:-${_SHLIBDIRPREFIX}/..}` + # default values for -L and -P + local dir="-P $i" + local ldir="-L $i" + + while [ "$1" != "" ] ; do + if [ x"$1
WITHOUT_CASPER not working anymore ? Re: svn commit: r276788 - in head: contrib/tcpdump contrib/tcpdump/lbl contrib/tcpdump/missing usr.sbin/tcpdump/tcpdump
Not that i mind if it is intentional (though it seems not), but after this commit tcpdump does not build anymore with -DWITHOUT_CASPER. To be precise, the failure is when you do a buildworld with WITHOUT_CASPER, which does not install the libcapsicum headers. I understand that there is a change in the macro that defines support (from HAVE_LIBCAPSICUM to HAVE_CAPSICUM), but it seems to me that in the chunk below (for tcpdump.c, but other sources are affected too) the #ifdef HAVE_CAPSICUM / #endif block contains headers that are totally unrelated to capsicum: you should probably protect the headers. @@ -70,25 +76,24 @@ #include #ifdef __FreeBSD__ #include -#include -#include #include -#include -#include -#include -#ifdef HAVE_LIBCAPSICUM #include #include #include #include -#endif /* HAVE_LIBCAPSICUM */ -#endif /* __FreeBSD__ */ +#endif /* __FreeBSD__ */ +#ifdef HAVE_CAPSICUM +#include +#include +#include +#include +#include +#endif /* HAVE_CAPSICUM */ #ifndef WIN32 #include #include #include #include -#include #endif /* WIN32 */ /* capabilities convinience library */ I am happy to send a patch but would be more comfortable if you could review/deal with it yourself. cheers luigi On Wed, Jan 7, 2015 at 11:55 AM, Xin LI wrote: > Author: delphij > Date: Wed Jan 7 19:55:18 2015 > New Revision: 276788 > URL: https://svnweb.freebsd.org/changeset/base/276788 > > Log: > MFV r276761: tcpdump 4.6.2. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r276485 - in head/sys: conf dev/cxgbe modules/cxgbe/if_cxgbe
os.state = ns.state = r->state; > + ns.cidx = cidx; > + ns.flags = STALLED; > + } while (atomic_cmpset_64(&r->state, os.state, > + ns.state) == 0); > + critical_exit(); > + if (prev != STALLED) > + counter_u64_add(r->stalls, 1); > + else if (total > 0) { > + counter_u64_add(r->restarts, 1); > + counter_u64_add(r->stalls, 1); > + } > + break; > + } > + cidx = increment_idx(r, cidx, n); > + pending += n; > + total += n; > + > + /* > +* We update the cidx only if we've caught up with the > pidx, the > +* real cidx is getting too far ahead of the one visible to > +* everyone else, or we have exceeded our budget. > +*/ > + if (cidx != pidx && pending < 64 && total < budget) > + continue; > + critical_enter(); > + do { > + os.state = ns.state = r->state; > + ns.cidx = cidx; > + ns.flags = state_to_flags(ns, total >= budget); > + } while (atomic_cmpset_acq_64(&r->state, os.state, > ns.state) == 0); > + critical_exit(); > + > + if (ns.flags == ABDICATED) > + counter_u64_add(r->abdications, 1); > + if (ns.flags != BUSY) { > + /* Wrong loop exit if we're going to stall. */ > + MPASS(ns.flags != STALLED); > + if (prev == STALLED) { > + MPASS(total > 0); > + counter_u64_add(r->restarts, 1); > + } > + break; > + } > + > + /* > +* The acquire style atomic above guarantees visibility of > items > +* associated with any pidx change that we notice here. > +*/ > + pidx = ns.pidx_tail; > + pending = 0; > + } > +} > + > +int > +mp_ring_alloc(struct mp_ring **pr, int size, void *cookie, ring_drain_t > drain, > +ring_can_drain_t can_drain, struct malloc_type *mt, int flags) > +{ > + struct mp_ring *r; > + > + /* All idx are 16b so size can be 65536 at most */ > + if (pr == NULL || size < 2 || size > 65536 || drain == NULL || > + can_drain == NULL) > + return (EINVAL); > + *pr = NULL; > + flags &= M_NOWAIT | M_WAITOK; > + MPASS(flags != 0); > + > + r = malloc(__offsetof(struct mp_ring, items[size]), mt, flags | > M_ZERO); > + if (r == NULL) > + return (ENOMEM); > + r->size = size; > + r->cookie = cookie; > + r->mt = mt; > + r->drain = drain; > + r->can_drain = can_drain; > + r->enqueues = counter_u64_alloc(flags); > + r->drops = counter_u64_alloc(flags); > + r->starts = counter_u64_alloc(flags); > + r->stalls = counter_u64_alloc(flags); > + r->restarts = counter_u64_alloc(flags); > + r->abdications = counter_u64_alloc(flags); > + if (r->enqueues == NULL || r->drops == NULL || r->starts == NULL || > + r->stalls == NULL || r->restarts == NULL || > + r->abdications == NULL) { > + mp_ring_free(r); > + return (ENOMEM); > + } > + > + *pr = r; > + return (0); > +} > + > +void > + > +mp_ring_free(struct mp_ring *r) > +{ > + > + if (r == NULL) > + return; > + > + if (r->enqueues != NULL) > + counter_u64_free(r->enqueues); > + if (r->drops != NULL) > + counter_u64_free(r->drops); > + if (r->starts != NULL) > + counter_u64_free(r->starts); > + if (r->stalls != NULL) > + counter_u64_free(r->stalls); > + if (r->restarts != NULL) > + counter_u64_free(r->restarts); > + if (r->abdications != NULL) > + counter_u64_free(r->abdications); > + > + free(r, r->mt); > +} > + > +/* > + * Enqueue n items and maybe drain the ring for some time. > + * > + * Returns an errno. > + */ > +int > +mp_ring_enqueue(struct mp_ring *r, void **items, int n, int budget) > +{ > + union ring_state os, ns; > + uint16_t pidx_start, pidx_stop; > + int i; > + > + MPASS(items != NULL); > + MPASS(n > 0); > + > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > > -- -+--- Prof. Luigi RIZZO, ri...@iet.unipi.it . Dip. di Ing. dell'Informazione http://www.iet.unipi.it/~luigi/. Universita` di Pisa TEL +39-050-2211611 . via Diotisalvi 2 Mobile +39-338-6809875 . 56122 PISA (Italy) -+--- ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r274459 - head/sys/dev/netmap
Author: luigi Date: Thu Nov 13 00:40:34 2014 New Revision: 274459 URL: https://svnweb.freebsd.org/changeset/base/274459 Log: add support for private knote lock (reduces lock contention), adapting OS_selrecord accordingly. Problem and fix suggested by adrian and jmg Modified: head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_freebsd.c head/sys/dev/netmap/netmap_kern.h Modified: head/sys/dev/netmap/netmap.c == --- head/sys/dev/netmap/netmap.cThu Nov 13 00:30:17 2014 (r274458) +++ head/sys/dev/netmap/netmap.cThu Nov 13 00:40:34 2014 (r274459) @@ -375,9 +375,14 @@ ports attached to the switch) /* reduce conditional code */ // linux API, use for the knlist in FreeBSD -#define init_waitqueue_head(x) knlist_init_mtx(&(x)->si_note, NULL) +/* use a private mutex for the knlist */ +#define init_waitqueue_head(x) do {\ + struct mtx *m = &(x)->m;\ + mtx_init(m, "nm_kn_lock", NULL, MTX_DEF); \ + knlist_init_mtx(&(x)->si.si_note, m); \ +} while (0) -void freebsd_selwakeup(struct selinfo *si, int pri); +#define OS_selrecord(a, b) selrecord(a, &((b)->si)) #define OS_selwakeup(a, b) freebsd_selwakeup(a, b) #elif defined(linux) @@ -806,6 +811,19 @@ netmap_krings_create(struct netmap_adapt } +#ifdef __FreeBSD__ +static void +netmap_knlist_destroy(NM_SELINFO_T *si) +{ + /* XXX kqueue(9) needed; these will mirror knlist_init. */ + knlist_delete(&si->si.si_note, curthread, 0 /* not locked */ ); + knlist_destroy(&si->si.si_note); + /* now we don't need the mutex anymore */ + mtx_destroy(&si->m); +} +#endif /* __FreeBSD__ */ + + /* undo the actions performed by netmap_krings_create */ /* call with NMG_LOCK held */ void @@ -816,6 +834,7 @@ netmap_krings_delete(struct netmap_adapt /* we rely on the krings layout described above */ for ( ; kring != na->tailroom; kring++) { mtx_destroy(&kring->q_lock); + netmap_knlist_destroy(&kring->si); } free(na->tx_rings, M_DEVBUF); na->tx_rings = na->rx_rings = na->tailroom = NULL; @@ -996,9 +1015,8 @@ netmap_do_unregif(struct netmap_priv_d * * XXX The wake up now must happen during *_down(), when * we order all activities to stop. -gl */ - /* XXX kqueue(9) needed; these will mirror knlist_init. */ - /* knlist_destroy(&na->tx_si.si_note); */ - /* knlist_destroy(&na->rx_si.si_note); */ + netmap_knlist_destroy(&na->tx_si); + netmap_knlist_destroy(&na->rx_si); /* delete rings and buffers */ netmap_mem_rings_delete(na); @@ -1310,7 +1328,7 @@ netmap_rxsync_from_host(struct netmap_ad /* access copies of cur,tail in the kring */ if (kring->rcur == kring->rtail && td) /* no bufs available */ - selrecord(td, &kring->si); + OS_selrecord(td, &kring->si); mbq_unlock(q); return ret; @@ -2410,7 +2428,7 @@ flush_tx: } } if (want_tx && retry_tx && !is_kevent) { - selrecord(td, check_all_tx ? + OS_selrecord(td, check_all_tx ? &na->tx_si : &na->tx_rings[priv->np_txqfirst].si); retry_tx = 0; goto flush_tx; @@ -2479,7 +2497,7 @@ do_retry_rx: } if (retry_rx && !is_kevent) - selrecord(td, check_all_rx ? + OS_selrecord(td, check_all_rx ? &na->rx_si : &na->rx_rings[priv->np_rxqfirst].si); if (send_down > 0 || retry_rx) { retry_rx = 0; @@ -3054,8 +3072,15 @@ netmap_init(void) if (error != 0) goto fail; /* XXX could use make_dev_credv() to get error number */ +#ifdef __FreeBSD__ + /* support for the 'eternal' flag */ + netmap_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, + &netmap_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0660, + "netmap"); +#else netmap_dev = make_dev(&netmap_cdevsw, 0, UID_ROOT, GID_WHEEL, 0660, "netmap"); +#endif if (!netmap_dev) goto fail; Modified: head/sys/dev/netmap/netmap_freebsd.c == --- head/sys/dev/netmap/netmap_freebsd.cThu Nov 13 00:30:17 2014 (r274458) +++ head/sys/dev/netmap/netmap_freebsd.cThu Nov 13 00:40:34 2014 (r274459) @@ -656,25 +656,24 @@ netmap_open(struct cdev *dev, int oflags * and do not need the selrecord(). */ -void freebsd_selwakeup(struct selinfo *si, int pri);
svn commit: r274457 - head/sys/dev/netmap
Author: luigi Date: Thu Nov 13 00:14:25 2014 New Revision: 274457 URL: https://svnweb.freebsd.org/changeset/base/274457 Log: we need full barriers here Modified: head/sys/dev/netmap/netmap_monitor.c head/sys/dev/netmap/netmap_pipe.c Modified: head/sys/dev/netmap/netmap_monitor.c == --- head/sys/dev/netmap/netmap_monitor.cWed Nov 12 23:29:22 2014 (r274456) +++ head/sys/dev/netmap/netmap_monitor.cThu Nov 13 00:14:25 2014 (r274457) @@ -179,7 +179,7 @@ netmap_monitor_parent_sync(struct netmap i = nm_next(i, mlim); } - wmb(); + mb(); mkring->nr_hwtail = i; mtx_unlock(&mkring->q_lock); @@ -225,7 +225,7 @@ netmap_monitor_rxsync(struct netmap_krin { ND("%s %x", kring->name, flags); kring->nr_hwcur = kring->rcur; - rmb(); + mb(); nm_rxsync_finalize(kring); return 0; } Modified: head/sys/dev/netmap/netmap_pipe.c == --- head/sys/dev/netmap/netmap_pipe.c Wed Nov 12 23:29:22 2014 (r274456) +++ head/sys/dev/netmap/netmap_pipe.c Thu Nov 13 00:14:25 2014 (r274457) @@ -228,7 +228,7 @@ netmap_pipe_txsync(struct netmap_kring * k = nm_next(k, lim_tx); } -wmb(); /* make sure the slots are updated before publishing them */ +mb(); /* make sure the slots are updated before publishing them */ rxkring->nr_hwtail = j; txkring->nr_hwcur = k; txkring->nr_hwtail = nm_prev(k, lim_tx); @@ -237,7 +237,7 @@ netmap_pipe_txsync(struct netmap_kring * ND(2, "after: hwcur %d hwtail %d cur %d head %d tail %d j %d", txkring->nr_hwcur, txkring->nr_hwtail, txkring->rcur, txkring->rhead, txkring->rtail, j); -wmb(); /* make sure rxkring->nr_hwtail is updated before notifying */ +mb(); /* make sure rxkring->nr_hwtail is updated before notifying */ rxkring->na->nm_notify(rxkring->na, rxkring->ring_id, NR_RX, 0); return 0; @@ -253,12 +253,12 @@ netmap_pipe_rxsync(struct netmap_kring * rxkring->nr_hwcur = rxkring->rhead; /* recover user-relased slots */ ND(5, "hwcur %d hwtail %d cur %d head %d tail %d", rxkring->nr_hwcur, rxkring->nr_hwtail, rxkring->rcur, rxkring->rhead, rxkring->rtail); -rmb(); /* paired with the first wmb() in txsync */ +mb(); /* paired with the first mb() in txsync */ nm_rxsync_finalize(rxkring); if (oldhwcur != rxkring->nr_hwcur) { /* we have released some slots, notify the other end */ - wmb(); /* make sure nr_hwcur is updated before notifying */ + mb(); /* make sure nr_hwcur is updated before notifying */ txkring->na->nm_notify(txkring->na, txkring->ring_id, NR_TX, 0); } return 0; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r274362 - head/sys/dev/netmap
Author: luigi Date: Tue Nov 11 00:13:28 2014 New Revision: 274362 URL: https://svnweb.freebsd.org/changeset/base/274362 Log: in the Linux section, properly define the NMG_LOCK type. Also import WITH_GENERIC in preparation to adding fine-grained options to disable specific netmap components. Modified: head/sys/dev/netmap/netmap_kern.h Modified: head/sys/dev/netmap/netmap_kern.h == --- head/sys/dev/netmap/netmap_kern.h Tue Nov 11 00:10:44 2014 (r274361) +++ head/sys/dev/netmap/netmap_kern.h Tue Nov 11 00:13:28 2014 (r274362) @@ -37,6 +37,7 @@ #define WITH_VALE // comment out to disable VALE support #define WITH_PIPES #define WITH_MONITOR +#define WITH_GENERIC #if defined(__FreeBSD__) @@ -44,6 +45,8 @@ #define unlikely(x)__builtin_expect((long)!!(x), 0L) #defineNM_LOCK_T struct mtx + +/* netmap global lock */ #defineNMG_LOCK_T struct sx #define NMG_LOCK_INIT()sx_init(&netmap_global_lock, \ "netmap global lock") @@ -107,13 +110,20 @@ struct hrtimer { #define NM_ATOMIC_Tvolatile long unsigned int -// XXX a mtx would suffice here too 20130404 gl -#define NMG_LOCK_T struct semaphore -#define NMG_LOCK_INIT()sema_init(&netmap_global_lock, 1) -#define NMG_LOCK_DESTROY() -#define NMG_LOCK() down(&netmap_global_lock) -#define NMG_UNLOCK() up(&netmap_global_lock) -#define NMG_LOCK_ASSERT() // XXX to be completed +#define NM_MTX_T struct mutex +#define NM_MTX_INIT(m, s) do { (void)s; mutex_init(&(m)); } while (0) +#define NM_MTX_DESTROY(m) do { (void)m; } while (0) +#define NM_MTX_LOCK(m) mutex_lock(&(m)) +#define NM_MTX_UNLOCK(m) mutex_unlock(&(m)) +#define NM_MTX_LOCK_ASSERT(m) mutex_is_locked(&(m)) + +#defineNMG_LOCK_T NM_MTX_T +#defineNMG_LOCK_INIT() NM_MTX_INIT(netmap_global_lock, \ + "netmap_global_lock") +#defineNMG_LOCK_DESTROY() NM_MTX_DESTROY(netmap_global_lock) +#defineNMG_LOCK() NM_MTX_LOCK(netmap_global_lock) +#defineNMG_UNLOCK()NM_MTX_UNLOCK(netmap_global_lock) +#defineNMG_LOCK_ASSERT() NM_MTX_LOCK_ASSERT(netmap_global_lock) #ifndef DEV_NETMAP #define DEV_NETMAP @@ -641,6 +651,7 @@ struct netmap_hw_adapter { /* physical d int (*nm_hw_register)(struct netmap_adapter *, int onoff); }; +#ifdef WITH_GENERIC /* Mitigation support. */ struct nm_generic_mit { struct hrtimer mit_timer; @@ -668,6 +679,7 @@ struct netmap_generic_adapter { /* emula netdev_tx_t (*save_start_xmit)(struct mbuf *, struct ifnet *); #endif }; +#endif /* WITH_GENERIC */ static __inline int netmap_real_tx_rings(struct netmap_adapter *na) @@ -1481,6 +1493,7 @@ struct netmap_monitor_adapter { #endif /* WITH_MONITOR */ +#ifdef WITH_GENERIC /* * generic netmap emulation for devices that do not have * native netmap support. @@ -1512,6 +1525,7 @@ void netmap_mitigation_start(struct nm_g void netmap_mitigation_restart(struct nm_generic_mit *mit); int netmap_mitigation_active(struct nm_generic_mit *mit); void netmap_mitigation_cleanup(struct nm_generic_mit *mit); +#endif /* WITH_GENERIC */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r274361 - head/sys/dev/netmap
Author: luigi Date: Tue Nov 11 00:10:44 2014 New Revision: 274361 URL: https://svnweb.freebsd.org/changeset/base/274361 Log: - fix typo: use ring size from the rx ring, not the tx one (they should be the same, but just in case); - reuse the previously computed len-1 value Modified: head/sys/dev/netmap/netmap_pipe.c Modified: head/sys/dev/netmap/netmap_pipe.c == --- head/sys/dev/netmap/netmap_pipe.c Mon Nov 10 23:56:06 2014 (r274360) +++ head/sys/dev/netmap/netmap_pipe.c Tue Nov 11 00:10:44 2014 (r274361) @@ -197,10 +197,10 @@ netmap_pipe_txsync(struct netmap_kring * if (m < 0) m += txkring->nkr_num_slots; limit = m; -m = rxkring->nkr_num_slots - 1; /* max avail space on destination */ +m = lim_rx; /* max avail space on destination */ busy = j - rxkring->nr_hwcur; /* busy slots */ if (busy < 0) - busy += txkring->nkr_num_slots; + busy += rxkring->nkr_num_slots; m -= busy; /* subtract busy slots */ ND(2, "m %d limit %d", m, limit); if (m < limit) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r274355 - head/sys/dev/netmap
Author: luigi Date: Mon Nov 10 21:00:23 2014 New Revision: 274355 URL: https://svnweb.freebsd.org/changeset/base/274355 Log: fix a typo Modified: head/sys/dev/netmap/netmap_kern.h Modified: head/sys/dev/netmap/netmap_kern.h == --- head/sys/dev/netmap/netmap_kern.h Mon Nov 10 20:25:33 2014 (r274354) +++ head/sys/dev/netmap/netmap_kern.h Mon Nov 10 21:00:23 2014 (r274355) @@ -266,7 +266,7 @@ struct netmap_kring { struct netmap_adapter *na; - /* The folloiwing fields are for VALE switch support */ + /* The following fields are for VALE switch support */ struct nm_bdg_fwd *nkr_ft; uint32_t*nkr_leases; #define NR_NOSLOT ((uint32_t)~0) /* used in nkr_*lease* */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r274354 - head/sys/dev/netmap
Author: luigi Date: Mon Nov 10 20:25:33 2014 New Revision: 274354 URL: https://svnweb.freebsd.org/changeset/base/274354 Log: initialize *color if passed as an argument Modified: head/sys/dev/netmap/netmap_freebsd.c Modified: head/sys/dev/netmap/netmap_freebsd.c == --- head/sys/dev/netmap/netmap_freebsd.cMon Nov 10 20:19:58 2014 (r274353) +++ head/sys/dev/netmap/netmap_freebsd.cMon Nov 10 20:25:33 2014 (r274354) @@ -466,6 +466,8 @@ netmap_dev_pager_ctor(void *handle, vm_o if (netmap_verbose) D("handle %p size %jd prot %d foff %jd", handle, (intmax_t)size, prot, (intmax_t)foff); + if (color) + *color = 0; dev_ref(vmh->dev); return 0; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r274353 - head/sys/dev/netmap
Author: luigi Date: Mon Nov 10 20:19:58 2014 New Revision: 274353 URL: https://svnweb.freebsd.org/changeset/base/274353 Log: sync a comment with our internal repo Modified: head/sys/dev/netmap/netmap_generic.c Modified: head/sys/dev/netmap/netmap_generic.c == --- head/sys/dev/netmap/netmap_generic.cMon Nov 10 19:53:39 2014 (r274352) +++ head/sys/dev/netmap/netmap_generic.cMon Nov 10 20:19:58 2014 (r274353) @@ -821,7 +821,7 @@ generic_netmap_attach(struct ifnet *ifp) num_tx_desc = num_rx_desc = netmap_generic_ringsize; /* starting point */ - generic_find_num_desc(ifp, &num_tx_desc, &num_rx_desc); + generic_find_num_desc(ifp, &num_tx_desc, &num_rx_desc); /* ignore errors */ ND("Netmap ring size: TX = %d, RX = %d", num_tx_desc, num_rx_desc); if (num_tx_desc == 0 || num_rx_desc == 0) { D("Device has no hw slots (tx %u, rx %u)", num_tx_desc, num_rx_desc); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r274338 - head/sys/net
Author: luigi Date: Mon Nov 10 08:31:56 2014 New Revision: 274338 URL: https://svnweb.freebsd.org/changeset/base/274338 Log: return kernel-supplied error if available. Also fix field names in a comment. Modified: head/sys/net/netmap_user.h Modified: head/sys/net/netmap_user.h == --- head/sys/net/netmap_user.h Mon Nov 10 08:20:21 2014(r274337) +++ head/sys/net/netmap_user.h Mon Nov 10 08:31:56 2014(r274338) @@ -40,7 +40,7 @@ * From there: * struct netmap_ring *NETMAP_TXRING(nifp, index) * struct netmap_ring *NETMAP_RXRING(nifp, index) - * we can access ring->nr_cur, ring->nr_avail, ring->nr_flags + * we can access ring->cur, ring->head, ring->tail, etc. * * ring->slot[i] gives us the i-th slot (we can access * directly len, flags, buf_idx) @@ -543,7 +543,8 @@ fail: nm_close(d); if (errmsg) D("%s %s", errmsg, ifname); - errno = EINVAL; + if (errno == 0) + errno = EINVAL; return NULL; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r273112 - head/sys/dev/ixgbe
On Thu, Nov 06, 2014 at 03:05:30PM +0400, Alexander V. Chernikov wrote: > On 15.10.2014 05:22, Adrian Chadd wrote: > > Author: adrian > > Date: Wed Oct 15 01:22:56 2014 > > New Revision: 273112 > > URL: https://svnweb.freebsd.org/changeset/base/273112 > > > > Log: > >Set the DROP_EN bit before the RX queue is brought up and active. > > > >He noticed issues setting this bit in SRRCTL after the queue was up, > >so doing it from the sysctl handler isn't enough and may not actually > >work correctly. > While investigating/measuring ixgbe performance w/ and without flow control > I noticed that disabling fc entirely (e.g. disabling 512K skid buffer > and turning drop_en on) > not only makes things a bit worse, but also makes NIC stop accounting > tail-drops as errors > at all. > It is a bit unhandy with HW counters, since you, for example, see 2M > packets being received > in netstat, but in reality system receives only 1M (And there is no easy > way to determine exact > count). i'd like to point out that the default does not change (flow control is still enabled by default) and the previous handling of DROP_EN was ineffective. One may argue that FC and DROP_EN should be set independently, and i am all for it. In fact that would be the right thing to do in terms of POLA. This said, i do not understand what kind of performance degradation you experienced, can you be more specific ? cheers luigi ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r273479 - head/sys/net
Author: luigi Date: Wed Oct 22 18:55:36 2014 New Revision: 273479 URL: https://svnweb.freebsd.org/changeset/base/273479 Log: since we cast a pointer, use the correct signedness (this was already in, and got lost in a recent update). Modified: head/sys/net/radix.c Modified: head/sys/net/radix.c == --- head/sys/net/radix.cWed Oct 22 18:11:10 2014(r273478) +++ head/sys/net/radix.cWed Oct 22 18:55:36 2014(r273479) @@ -528,7 +528,7 @@ rn_addmask(void *n_arg, struct radix_nod R_Zalloc(x, struct radix_node *, RADIX_MAX_KEY_LEN + 2 * sizeof (*x)); if ((saved_x = x) == 0) return (0); - netmask = cp = (caddr_t)(x + 2); + netmask = cp = (unsigned char *)(x + 2); bcopy(addmask_key, cp, mlen); x = rn_insert(cp, maskhead, &maskduplicated, x); if (maskduplicated) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r273453 - head/sys/netpfil/ipfw
Author: luigi Date: Wed Oct 22 05:21:36 2014 New Revision: 273453 URL: https://svnweb.freebsd.org/changeset/base/273453 Log: remove/fix old code for building ipfw and dummynet in userspace Modified: head/sys/netpfil/ipfw/ip_dn_io.c head/sys/netpfil/ipfw/ip_fw_private.h head/sys/netpfil/ipfw/ip_fw_sockopt.c Modified: head/sys/netpfil/ipfw/ip_dn_io.c == --- head/sys/netpfil/ipfw/ip_dn_io.cWed Oct 22 04:16:09 2014 (r273452) +++ head/sys/netpfil/ipfw/ip_dn_io.cWed Oct 22 05:21:36 2014 (r273453) @@ -283,7 +283,7 @@ mq_append(struct mq *q, struct mbuf *m) *m_new = *m;// copy m_new->m_flags &= ~M_STACK; m_new->__m_extbuf = p; // point to new buffer - pkt_copy(m->__m_extbuf, p, m->__m_extlen); + _pkt_copy(m->__m_extbuf, p, m->__m_extlen); m_new->m_data = p + ofs; m = m_new; } Modified: head/sys/netpfil/ipfw/ip_fw_private.h == --- head/sys/netpfil/ipfw/ip_fw_private.h Wed Oct 22 04:16:09 2014 (r273452) +++ head/sys/netpfil/ipfw/ip_fw_private.h Wed Oct 22 05:21:36 2014 (r273453) @@ -354,29 +354,6 @@ struct ipfw_ifc { }; /* Macro for working with various counters */ -#ifdef USERSPACE -#defineIPFW_INC_RULE_COUNTER(_cntr, _bytes)do {\ - (_cntr)->pcnt++;\ - (_cntr)->bcnt += _bytes;\ - (_cntr)->timestamp = time_uptime; \ - } while (0) - -#defineIPFW_INC_DYN_COUNTER(_cntr, _bytes) do {\ - (_cntr)->pcnt++;\ - (_cntr)->bcnt += _bytes;\ - } while (0) - -#defineIPFW_ZERO_RULE_COUNTER(_cntr) do { \ - (_cntr)->pcnt = 0; \ - (_cntr)->bcnt = 0; \ - (_cntr)->timestamp = 0; \ - } while (0) - -#defineIPFW_ZERO_DYN_COUNTER(_cntr) do { \ - (_cntr)->pcnt = 0; \ - (_cntr)->bcnt = 0; \ - } while (0) -#else #defineIPFW_INC_RULE_COUNTER(_cntr, _bytes)do {\ counter_u64_add((_cntr)->cntr, 1); \ counter_u64_add((_cntr)->cntr + 1, _bytes); \ @@ -399,7 +376,6 @@ struct ipfw_ifc { (_cntr)->pcnt = 0; \ (_cntr)->bcnt = 0; \ } while (0) -#endif #defineTARG_VAL(ch, k, f) ((struct table_value *)((ch)->valuestate))[k].f #defineIP_FW_ARG_TABLEARG(ch, a, f)\ Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c == --- head/sys/netpfil/ipfw/ip_fw_sockopt.c Wed Oct 22 04:16:09 2014 (r273452) +++ head/sys/netpfil/ipfw/ip_fw_sockopt.c Wed Oct 22 05:21:36 2014 (r273453) @@ -152,8 +152,6 @@ static struct ipfw_sopt_handler scodes[] * static variables followed by global ones */ -#ifndef USERSPACE - static VNET_DEFINE(uma_zone_t, ipfw_cntr_zone); #defineV_ipfw_cntr_zoneVNET(ipfw_cntr_zone) @@ -191,35 +189,6 @@ free_rule(struct ip_fw *rule) uma_zfree(V_ipfw_cntr_zone, rule->cntr); free(rule, M_IPFW); } -#else -void -ipfw_init_counters() -{ -} - -void -ipfw_destroy_counters() -{ -} - -struct ip_fw * -ipfw_alloc_rule(struct ip_fw_chain *chain, size_t rulesize) -{ - struct ip_fw *rule; - - rule = malloc(rulesize, M_IPFW, M_WAITOK | M_ZERO); - - return (rule); -} - -static void -free_rule(struct ip_fw *rule) -{ - - free(rule, M_IPFW); -} - -#endif /* ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r273274 - head/sys/netpfil/ipfw
On Sun, Oct 19, 2014 at 03:02:07PM +0300, Andriy Gapon wrote: > On 19/10/2014 14:15, Alexander V. Chernikov wrote: > > +static uint32_t > > +roundup2p(uint32_t v) > > +{ > > + > > + v--; > > + v |= v >> 1; > > + v |= v >> 2; > > + v |= v >> 4; > > + v |= v >> 8; > > + v |= v >> 16; > > + v++; > > + > > + return (v); > > +} > > I think that on platforms where an optimized version of fls() is available > that > would work faster than this cool piece of bit magic. This code is not performance critical. I wouldn't bother optimizing it. Rather, since this code must be platform independent, I'd like to give it a name that does not conflict with any builtin. cheers luigi > ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r273266 - in head: lib/libkvm sys/compat/freebsd32 sys/kern sys/sys
On Sat, Oct 18, 2014 at 07:36:12PM +, Adrian Chadd wrote: > Author: adrian > Date: Sat Oct 18 19:36:11 2014 > New Revision: 273266 > URL: https://svnweb.freebsd.org/changeset/base/273266 > > Log: > Update the ULE scheduler + thread and kinfo structs to use int for cpuid > rather than u_char. > > To try and play nice with the ABI, the u_char CPU ID values are clamped > at 254. The new fields now contain the full CPU ID, or -1 for no cpu. This causes the following error with gcc: cc1: warnings being treated as errors /usr/home/luigi/FreeBSD/head/sys/kern/kern_intr.c: In function 'intr_setaffinity': /usr/home/luigi/FreeBSD/head/sys/kern/kern_intr.c:378: warning: comparison is always true due to limited range of data type *** Error code 1 I suppose we can use NOCPU_OLD, or cast. cheers luigi > Differential Revision: D955 > Reviewed by:jhb, kib > Sponsored by: Norse Corp, Inc. > > Modified: > head/lib/libkvm/kvm_proc.c > head/sys/compat/freebsd32/freebsd32.h > head/sys/kern/kern_proc.c > head/sys/kern/sched_ule.c > head/sys/sys/proc.h > head/sys/sys/user.h > > Modified: head/lib/libkvm/kvm_proc.c > == > --- head/lib/libkvm/kvm_proc.cSat Oct 18 19:22:59 2014 > (r273265) > +++ head/lib/libkvm/kvm_proc.cSat Oct 18 19:36:11 2014 > (r273266) > @@ -431,6 +431,24 @@ nopgrp: > strlcpy(kp->ki_tdname, mtd.td_name, > sizeof(kp->ki_tdname)); > kp->ki_pctcpu = 0; > kp->ki_rqindex = 0; > + > + /* > + * Note: legacy fields; wraps at NO_CPU_OLD or the > + * old max CPU value as appropriate > + */ > + if (mtd.td_lastcpu == NOCPU) > + kp->ki_lastcpu_old = NOCPU_OLD; > + else if (mtd.td_lastcpu > MAXCPU_OLD) > + kp->ki_lastcpu_old = MAXCPU_OLD; > + else > + kp->ki_lastcpu_old = mtd.td_lastcpu; > + > + if (mtd.td_oncpu == NOCPU) > + kp->ki_oncpu_old = NOCPU_OLD; > + else if (mtd.td_oncpu > MAXCPU_OLD) > + kp->ki_oncpu_old = MAXCPU_OLD; > + else > + kp->ki_oncpu_old = mtd.td_oncpu; > } else { > kp->ki_stat = SZOMB; > } > > Modified: head/sys/compat/freebsd32/freebsd32.h > == > --- head/sys/compat/freebsd32/freebsd32.h Sat Oct 18 19:22:59 2014 > (r273265) > +++ head/sys/compat/freebsd32/freebsd32.h Sat Oct 18 19:36:11 2014 > (r273266) > @@ -332,8 +332,8 @@ struct kinfo_proc32 { > signed char ki_nice; > charki_lock; > charki_rqindex; > - u_char ki_oncpu; > - u_char ki_lastcpu; > + u_char ki_oncpu_old; > + u_char ki_lastcpu_old; > charki_tdname[TDNAMLEN+1]; > charki_wmesg[WMESGLEN+1]; > charki_login[LOGNAMELEN+1]; > @@ -343,6 +343,8 @@ struct kinfo_proc32 { > charki_loginclass[LOGINCLASSLEN+1]; > charki_sparestrings[50]; > int ki_spareints[KI_NSPARE_INT]; > + int ki_oncpu; > + int ki_lastcpu; > int ki_tracer; > int ki_flag2; > int ki_fibnum; > > Modified: head/sys/kern/kern_proc.c > == > --- head/sys/kern/kern_proc.c Sat Oct 18 19:22:59 2014(r273265) > +++ head/sys/kern/kern_proc.c Sat Oct 18 19:36:11 2014(r273266) > @@ -984,6 +984,25 @@ fill_kinfo_thread(struct thread *td, str > kp->ki_wchan = td->td_wchan; > kp->ki_pri.pri_level = td->td_priority; > kp->ki_pri.pri_native = td->td_base_pri; > + > + /* > + * Note: legacy fields; clamp at the old NOCPU value and/or > + * the maximum u_char CPU value. > + */ > + if (td->td_lastcpu == NOCPU) > + kp->ki_lastcpu_old = NOCPU_OLD; > + else if (td->td_lastcpu > MAXCPU_OLD) > + kp->ki_lastcpu_old = MAXCPU_OLD; > + else > + kp->ki_lastcpu_old = td->td_lastcpu; > + > + if (td->td_oncpu == NOCPU) > + kp->ki_oncpu_old = NOCPU_OLD; > + else if (td->td_oncpu > MAXCPU_OLD) > + kp->ki_oncpu_old = MAXCPU_OLD; > + else > + kp->ki_oncpu_old = td->td_oncpu; > + > kp->ki_lastcpu = td->td_lastcpu; > kp->ki_oncpu = td->td_oncpu; > kp->ki_tdflags = td->td_flags; > @@ -1164,6 +1183,11 @@ freebsd32_kinfo_proc_out(const struct ki > CP(*ki, *ki32, ki_rqindex); > CP(*ki, *ki32, ki_oncpu); > CP(*ki, *ki32, ki_lastcpu); > + > + /* XXX TODO: wrap cp
Re: svn commit: r272906 - in head/sys: conf libkern netpfil/pf sys
On Wed, Oct 15, 2014 at 08:14:19AM +0400, Gleb Smirnoff wrote: > On Tue, Oct 14, 2014 at 11:38:23PM -0400, Ed Maste wrote: > E> On 14 October 2014 23:04, Gleb Smirnoff wrote: > E> > > E> > Look at results at the end of email. Guess what -j and -m mean. I > E> > want either proving me doing the test wrong, or backing the change > E> > out ASAP. > E> > E> It looks like there is indeed an error in the test: > E> > E> > h = murmur3_aligned_32((uint32_t *)&key[i], > E> > sizeof(struct pf_state_key_cmp)/sizeof(uint32_t), > E> > E> murmur3's size argument is bytes, not uint32_ts, so the test is only > E> hashing the first 1/4 of the keys. > > Thanks a lot, Ed. I rerun the tests. Results are fine. Distribution > is equal (plots attached). > > Murmur is 9% +/- 1.5% faster. Sorry for noise. is that 9% on the hash alone ? If so it is surprising that you could see any change on pf's throughput. In my very non-scientific tests with VALE, doing two hashes on the MAC address would result in 17 Mpps vs 20 Mpps when no hashes were done. The difference is about 8ns, which is totally in the noise at 2 Mpps or less. cheers luigi > x jenkins-time > + murmur-time > +--+ > | ++ x > | > | ++ xx > | > |+ +++xx > | > |+ + + xx x x x x > x| > | |_A_| |_M__A_| > | > +--+ > N Min MaxMedian AvgStddev > x 12 8147243 8851519 8173132 8296753.8 235815.07 > + 15 7502767 7655925 7547376 7551089.5 39524.149 > Difference at 95.0% confidence > -745664 +/- 127010 > -8.98742% +/- 1.53084% > (Student's t, pooled s = 159194) > > -- > Totus tuus, Glebius. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r272659 - in head: contrib/libpcap lib/libpcap
Author: luigi Date: Mon Oct 6 15:48:28 2014 New Revision: 272659 URL: https://svnweb.freebsd.org/changeset/base/272659 Log: Add netmap support to libpcap. Tcpdump and other native pcap application can now run directly on netmap ports using netmap:foo or valeXX:YY device names. Modifications to existing code are small and trivial, the netmap-specific code is all in a new file. Please be aware that in netmap mode the physical interface is disconnected from the host stack, so libpcap will steal the traffic not just make a copy. For the full version of the code (including linux and autotools support) see https://code.google.com/p/netmap-libpcap/ MFC after:3 days Added: head/lib/libpcap/pcap-netmap.c (contents, props changed) Modified: head/contrib/libpcap/inet.c head/contrib/libpcap/pcap.c head/lib/libpcap/Makefile head/lib/libpcap/config.h Modified: head/contrib/libpcap/inet.c == --- head/contrib/libpcap/inet.c Mon Oct 6 15:43:57 2014(r272658) +++ head/contrib/libpcap/inet.c Mon Oct 6 15:48:28 2014(r272659) @@ -737,6 +737,10 @@ pcap_lookupnet(device, netp, maskp, errb #ifdef PCAP_SUPPORT_USB || strstr(device, "usbmon") != NULL #endif +#ifdef PCAP_SUPPORT_NETMAP + || !strncmp(device, "netmap:", 7) + || !strncmp(device, "vale", 4) +#endif #ifdef HAVE_SNF_API || strstr(device, "snf") != NULL #endif Modified: head/contrib/libpcap/pcap.c == --- head/contrib/libpcap/pcap.c Mon Oct 6 15:43:57 2014(r272658) +++ head/contrib/libpcap/pcap.c Mon Oct 6 15:48:28 2014(r272659) @@ -106,6 +106,10 @@ static const char rcsid[] _U_ = #include "pcap-netfilter-linux.h" #endif +#ifdef PCAP_SUPPORT_NETMAP +pcap_t* pcap_netmap_create(const char *device, char *ebuf, int *is_ours); +#endif + int pcap_not_initialized(pcap_t *pcap) { @@ -301,6 +305,9 @@ struct capture_source_type { int (*findalldevs_op)(pcap_if_t **, char *); pcap_t *(*create_op)(const char *, char *, int *); } capture_source_types[] = { +#ifdef PCAP_SUPPORT_NETMAP + { NULL, pcap_netmap_create }, +#endif #ifdef HAVE_DAG_API { dag_findalldevs, dag_create }, #endif Modified: head/lib/libpcap/Makefile == --- head/lib/libpcap/Makefile Mon Oct 6 15:43:57 2014(r272658) +++ head/lib/libpcap/Makefile Mon Oct 6 15:48:28 2014(r272659) @@ -7,6 +7,7 @@ SHLIBDIR?= /lib LIB= pcap SRCS= grammar.y tokdefs.h version.h pcap-bpf.c \ + pcap-netmap.c \ pcap.c pcap-common.c inet.c fad-getad.c gencode.c optimize.c nametoaddr.c \ etherent.c savefile.c bpf_filter.c bpf_image.c bpf_dump.c \ scanner.l sf-pcap.c sf-pcap-ng.c version.c Modified: head/lib/libpcap/config.h == --- head/lib/libpcap/config.h Mon Oct 6 15:43:57 2014(r272658) +++ head/lib/libpcap/config.h Mon Oct 6 15:48:28 2014(r272659) @@ -271,6 +271,9 @@ /* target host supports USB sniffing */ /* #undef PCAP_SUPPORT_USB */ +/* target host supports netmap */ +#define PCAP_SUPPORT_NETMAP 1 + /* include ACN support */ /* #undef SITA */ Added: head/lib/libpcap/pcap-netmap.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libpcap/pcap-netmap.c Mon Oct 6 15:48:28 2014 (r272659) @@ -0,0 +1,283 @@ +/* + * Copyright (C) 2014 Luigi Rizzo. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LI
svn commit: r272653 - head/contrib/tcpdump
Author: luigi Date: Mon Oct 6 15:03:08 2014 New Revision: 272653 URL: https://svnweb.freebsd.org/changeset/base/272653 Log: Fix comment and sort rights by name MFC after:3 days Modified: head/contrib/tcpdump/tcpdump.c Modified: head/contrib/tcpdump/tcpdump.c == --- head/contrib/tcpdump/tcpdump.c Mon Oct 6 14:57:26 2014 (r272652) +++ head/contrib/tcpdump/tcpdump.c Mon Oct 6 15:03:08 2014 (r272653) @@ -1534,11 +1534,11 @@ main(int argc, char **argv) static const unsigned long cmds[] = { BIOCGSTATS }; /* -* the various libpcap devices use a combination of -* read (bpf), ioctl (bpf, netmap), poll (netmap) -* so we add the relevant access rights. +* The various libpcap devices use a combination of +* read (bpf), ioctl (bpf, netmap), poll (netmap). +* Grant the relevant access rights, sorted by name. */ - cap_rights_init(&rights, CAP_IOCTL, CAP_READ, CAP_EVENT); + cap_rights_init(&rights, CAP_EVENT, CAP_IOCTL, CAP_READ); if (cap_rights_limit(pcap_fileno(pd), &rights) < 0 && errno != ENOSYS) { error("unable to limit pcap descriptor"); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r272648 - stable/10/sys/modules/netmap
Author: luigi Date: Mon Oct 6 14:39:45 2014 New Revision: 272648 URL: https://svnweb.freebsd.org/changeset/base/272648 Log: MFC r272108: add missing file for building netmap as a module Modified: stable/10/sys/modules/netmap/Makefile Modified: stable/10/sys/modules/netmap/Makefile == --- stable/10/sys/modules/netmap/Makefile Mon Oct 6 13:34:12 2014 (r272647) +++ stable/10/sys/modules/netmap/Makefile Mon Oct 6 14:39:45 2014 (r272648) @@ -16,5 +16,6 @@ SRCS += netmap_vale.c SRCS += netmap_freebsd.c SRCS += netmap_offloadings.c SRCS += netmap_pipe.c +SRCS += netmap_monitor.c .include ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r272604 - stable/10/sys/dev/netmap
Author: luigi Date: Mon Oct 6 09:46:21 2014 New Revision: 272604 URL: https://svnweb.freebsd.org/changeset/base/272604 Log: MFC r272111 fix a panic when passing ifioctl from a netmap file descriptor to the underlying device. This needs to be merged to 10.1 Modified: stable/10/sys/dev/netmap/netmap.c Modified: stable/10/sys/dev/netmap/netmap.c == --- stable/10/sys/dev/netmap/netmap.c Mon Oct 6 09:15:09 2014 (r272603) +++ stable/10/sys/dev/netmap/netmap.c Mon Oct 6 09:46:21 2014 (r272604) @@ -,23 +,18 @@ netmap_ioctl(struct cdev *dev, u_long cm default:/* allow device-specific ioctls */ { - struct socket so; - struct ifnet *ifp; - - bzero(&so, sizeof(so)); - NMG_LOCK(); - error = netmap_get_na(nmr, &na, 0 /* don't create */); /* keep reference */ - if (error) { - netmap_adapter_put(na); - NMG_UNLOCK(); - break; + struct ifnet *ifp = ifunit_ref(nmr->nr_name); + if (ifp == NULL) { + error = ENXIO; + } else { + struct socket so; + + bzero(&so, sizeof(so)); + so.so_vnet = ifp->if_vnet; + // so->so_proto not null. + error = ifioctl(&so, cmd, data, td); + if_rele(ifp); } - ifp = na->ifp; - so.so_vnet = ifp->if_vnet; - // so->so_proto not null. - error = ifioctl(&so, cmd, data, td); - netmap_adapter_put(na); - NMG_UNLOCK(); break; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r272451 - head/contrib/tcpdump
Author: luigi Date: Thu Oct 2 21:34:52 2014 New Revision: 272451 URL: https://svnweb.freebsd.org/changeset/base/272451 Log: add CAP_EVENT for the libpcap device so we will be able to use pcap--netmap which does poll() on the file descriptor MFC after:2 weeks Modified: head/contrib/tcpdump/tcpdump.c Modified: head/contrib/tcpdump/tcpdump.c == --- head/contrib/tcpdump/tcpdump.c Thu Oct 2 21:19:13 2014 (r272450) +++ head/contrib/tcpdump/tcpdump.c Thu Oct 2 21:34:52 2014 (r272451) @@ -1533,7 +1533,12 @@ main(int argc, char **argv) if (RFileName == NULL && VFileName == NULL) { static const unsigned long cmds[] = { BIOCGSTATS }; - cap_rights_init(&rights, CAP_IOCTL, CAP_READ); + /* +* the various libpcap devices use a combination of +* read (bpf), ioctl (bpf, netmap), poll (netmap) +* so we add the relevant access rights. +*/ + cap_rights_init(&rights, CAP_IOCTL, CAP_READ, CAP_EVENT); if (cap_rights_limit(pcap_fileno(pd), &rights) < 0 && errno != ENOSYS) { error("unable to limit pcap descriptor"); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r272111 - head/sys/dev/netmap
Author: luigi Date: Thu Sep 25 16:22:32 2014 New Revision: 272111 URL: http://svnweb.freebsd.org/changeset/base/272111 Log: fix a panic when passing ifioctl from a netmap file descriptor to the underlying device. This needs to be merged to 10.1 Reported by: Patrick Kelsey MFC after:3 days Modified: head/sys/dev/netmap/netmap.c Modified: head/sys/dev/netmap/netmap.c == --- head/sys/dev/netmap/netmap.cThu Sep 25 15:57:57 2014 (r272110) +++ head/sys/dev/netmap/netmap.cThu Sep 25 16:22:32 2014 (r272111) @@ -,23 +,18 @@ netmap_ioctl(struct cdev *dev, u_long cm default:/* allow device-specific ioctls */ { - struct socket so; - struct ifnet *ifp; - - bzero(&so, sizeof(so)); - NMG_LOCK(); - error = netmap_get_na(nmr, &na, 0 /* don't create */); /* keep reference */ - if (error) { - netmap_adapter_put(na); - NMG_UNLOCK(); - break; + struct ifnet *ifp = ifunit_ref(nmr->nr_name); + if (ifp == NULL) { + error = ENXIO; + } else { + struct socket so; + + bzero(&so, sizeof(so)); + so.so_vnet = ifp->if_vnet; + // so->so_proto not null. + error = ifioctl(&so, cmd, data, td); + if_rele(ifp); } - ifp = na->ifp; - so.so_vnet = ifp->if_vnet; - // so->so_proto not null. - error = ifioctl(&so, cmd, data, td); - netmap_adapter_put(na); - NMG_UNLOCK(); break; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r272110 - head/sys/dev/netmap
Author: luigi Date: Thu Sep 25 15:57:57 2014 New Revision: 272110 URL: http://svnweb.freebsd.org/changeset/base/272110 Log: adapt the code to different freebsd versions. Not necessary to MFC Modified: head/sys/dev/netmap/netmap_kern.h Modified: head/sys/dev/netmap/netmap_kern.h == --- head/sys/dev/netmap/netmap_kern.h Thu Sep 25 15:02:33 2014 (r272109) +++ head/sys/dev/netmap/netmap_kern.h Thu Sep 25 15:57:57 2014 (r272110) @@ -63,6 +63,12 @@ #define NM_ATOMIC_TEST_AND_SET(p) (!atomic_cmpset_acq_int((p), 0, 1)) #define NM_ATOMIC_CLEAR(p) atomic_store_rel_int((p), 0) +#if __FreeBSD_version >= 1100030 +#defineWNA(_ifp) (_ifp)->if_netmap +#else /* older FreeBSD */ +#defineWNA(_ifp) (_ifp)->if_pspare[0] +#endif /* older FreeBSD */ + #if __FreeBSD_version >= 115 struct netmap_adapter *netmap_getna(if_t ifp); #endif @@ -1186,9 +1192,6 @@ extern int netmap_generic_rings; * NA returns a pointer to the struct netmap adapter from the ifp, * WNA is used to write it. */ -#ifndef WNA -#defineWNA(_ifp) (_ifp)->if_netmap -#endif #defineNA(_ifp)((struct netmap_adapter *)WNA(_ifp)) /* ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r272108 - head/sys/modules/netmap
Author: luigi Date: Thu Sep 25 14:25:38 2014 New Revision: 272108 URL: http://svnweb.freebsd.org/changeset/base/272108 Log: add missing file Submitted by: Daniel Peyrolon MFC after:3 days Modified: head/sys/modules/netmap/Makefile Modified: head/sys/modules/netmap/Makefile == --- head/sys/modules/netmap/MakefileThu Sep 25 14:22:32 2014 (r272107) +++ head/sys/modules/netmap/MakefileThu Sep 25 14:25:38 2014 (r272108) @@ -16,5 +16,6 @@ SRCS += netmap_vale.c SRCS += netmap_freebsd.c SRCS += netmap_offloadings.c SRCS += netmap_pipe.c +SRCS += netmap_monitor.c .include ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r270874 - in head/sys: dev/netmap net
Just noticed this. I would appreciate if you and others could inform me _before_ touching netmap-related stuff, and also, if you make changes make sure they are visible to the preprocessor so i can use conditional compilations. This is because this code is supposed to be the same on various FreeBSD revisions and Linux, and if each platform randomly changes its structures maintainance becomes very hard cheers luigi On Sun, Aug 31, 2014 at 1:33 PM, Gleb Smirnoff wrote: > Author: glebius > Date: Sun Aug 31 11:33:19 2014 > New Revision: 270874 > URL: http://svnweb.freebsd.org/changeset/base/270874 > > Log: > Provide pointer from struct ifnet to struct netmap_adapter, > instead of abusing spare field. > > Modified: > head/sys/dev/netmap/netmap_kern.h > head/sys/net/if_var.h > > Modified: head/sys/dev/netmap/netmap_kern.h > > == > --- head/sys/dev/netmap/netmap_kern.h Sun Aug 31 10:42:52 2014 > (r270873) > +++ head/sys/dev/netmap/netmap_kern.h Sun Aug 31 11:33:19 2014 > (r270874) > @@ -1187,7 +1187,7 @@ extern int netmap_generic_rings; > * WNA is used to write it. > */ > #ifndef WNA > -#defineWNA(_ifp) (_ifp)->if_pspare[0] > +#defineWNA(_ifp) (_ifp)->if_netmap > #endif > #defineNA(_ifp)((struct netmap_adapter *)WNA(_ifp)) > > > Modified: head/sys/net/if_var.h > > == > --- head/sys/net/if_var.h Sun Aug 31 10:42:52 2014(r270873) > +++ head/sys/net/if_var.h Sun Aug 31 11:33:19 2014(r270874) > @@ -67,6 +67,7 @@ struct ifvlantrunk; > struct route; /* if_output */ > struct vnet; > struct ifmedia; > +struct netmap_adapter; > > #ifdef _KERNEL > #include /* ifqueue only? */ > @@ -202,6 +203,7 @@ struct ifnet { > void*if_pf_kif; /* pf glue */ > struct carp_if *if_carp; /* carp interface structure */ > struct label *if_label;/* interface MAC label */ > + struct netmap_adapter *if_netmap; /* netmap(4) softc */ > > /* Various procedures of the layer2 encapsulation and drivers. */ > int (*if_output)/* output routine (enqueue) */ > > -- -+--- Prof. Luigi RIZZO, ri...@iet.unipi.it . Dip. di Ing. dell'Informazione http://www.iet.unipi.it/~luigi/. Universita` di Pisa TEL +39-050-2211611 . via Diotisalvi 2 Mobile +39-338-6809875 . 56122 PISA (Italy) -+--- ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r270252 - in stable/10: sys/conf sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap tools/tools/netmap
Author: luigi Date: Wed Aug 20 23:34:36 2014 New Revision: 270252 URL: http://svnweb.freebsd.org/changeset/base/270252 Log: MFC 270063: update of netmap code (vtnet and cxgbe not merged yet because we need some other mfc first) Added: stable/10/sys/dev/netmap/if_vtnet_netmap.h (contents, props changed) stable/10/sys/dev/netmap/netmap_monitor.c (contents, props changed) Modified: stable/10/sys/conf/files stable/10/sys/dev/e1000/if_em.c stable/10/sys/dev/e1000/if_igb.c stable/10/sys/dev/e1000/if_lem.c stable/10/sys/dev/ixgbe/ixgbe.c stable/10/sys/dev/netmap/if_em_netmap.h stable/10/sys/dev/netmap/if_igb_netmap.h stable/10/sys/dev/netmap/if_lem_netmap.h stable/10/sys/dev/netmap/if_re_netmap.h stable/10/sys/dev/netmap/ixgbe_netmap.h stable/10/sys/dev/netmap/netmap.c stable/10/sys/dev/netmap/netmap_freebsd.c stable/10/sys/dev/netmap/netmap_generic.c stable/10/sys/dev/netmap/netmap_kern.h stable/10/sys/dev/netmap/netmap_mbq.h stable/10/sys/dev/netmap/netmap_mem2.c stable/10/sys/dev/netmap/netmap_mem2.h stable/10/sys/dev/netmap/netmap_offloadings.c stable/10/sys/dev/netmap/netmap_pipe.c stable/10/sys/dev/netmap/netmap_vale.c stable/10/tools/tools/netmap/pkt-gen.c stable/10/tools/tools/netmap/vale-ctl.c Modified: stable/10/sys/conf/files == --- stable/10/sys/conf/filesWed Aug 20 23:29:34 2014(r270251) +++ stable/10/sys/conf/filesWed Aug 20 23:34:36 2014(r270252) @@ -1933,6 +1933,7 @@ dev/netmap/netmap_freebsd.c optional net dev/netmap/netmap_generic.coptional netmap dev/netmap/netmap_mbq.coptional netmap dev/netmap/netmap_mem2.c optional netmap +dev/netmap/netmap_monitor.coptional netmap dev/netmap/netmap_offloadings.coptional netmap dev/netmap/netmap_pipe.c optional netmap dev/netmap/netmap_vale.c optional netmap Modified: stable/10/sys/dev/e1000/if_em.c == --- stable/10/sys/dev/e1000/if_em.c Wed Aug 20 23:29:34 2014 (r270251) +++ stable/10/sys/dev/e1000/if_em.c Wed Aug 20 23:34:36 2014 (r270252) @@ -3389,10 +3389,10 @@ em_setup_transmit_ring(struct tx_ring *t uint64_t paddr; void *addr; - addr = PNMB(slot + si, &paddr); + addr = PNMB(na, slot + si, &paddr); txr->tx_base[i].buffer_addr = htole64(paddr); /* reload the map for netmap mode */ - netmap_load_map(txr->txtag, txbuf->map, addr); + netmap_load_map(na, txr->txtag, txbuf->map, addr); } #endif /* DEV_NETMAP */ @@ -4131,8 +4131,8 @@ em_setup_receive_ring(struct rx_ring *rx uint64_t paddr; void *addr; - addr = PNMB(slot + si, &paddr); - netmap_load_map(rxr->rxtag, rxbuf->map, addr); + addr = PNMB(na, slot + si, &paddr); + netmap_load_map(na, rxr->rxtag, rxbuf->map, addr); /* Update descriptor */ rxr->rx_base[j].buffer_addr = htole64(paddr); continue; Modified: stable/10/sys/dev/e1000/if_igb.c == --- stable/10/sys/dev/e1000/if_igb.cWed Aug 20 23:29:34 2014 (r270251) +++ stable/10/sys/dev/e1000/if_igb.cWed Aug 20 23:34:36 2014 (r270252) @@ -3531,7 +3531,7 @@ igb_setup_transmit_ring(struct tx_ring * if (slot) { int si = netmap_idx_n2k(&na->tx_rings[txr->me], i); /* no need to set the address */ - netmap_load_map(txr->txtag, txbuf->map, NMB(slot + si)); + netmap_load_map(na, txr->txtag, txbuf->map, NMB(na, slot + si)); } #endif /* DEV_NETMAP */ /* clear the watch index */ @@ -4335,8 +4335,8 @@ igb_setup_receive_ring(struct rx_ring *r uint64_t paddr; void *addr; - addr = PNMB(slot + sj, &paddr); - netmap_load_map(rxr->ptag, rxbuf->pmap, addr); + addr = PNMB(na, slot + sj, &paddr); + netmap_load_map(na, rxr->ptag, rxbuf->pmap, addr); /* Update descriptor */ rxr->rx_base[j].read.pkt_addr = htole64(paddr); continue; Modified: stable/10/sys/dev/e1000/if_lem.c == --- stable/10/sys/dev/e1000/if_lem.cWed Aug 20 23:29:34 2014 (r270251) +++ stable/10/sys/dev/e1000/if_lem.cWed Aug 20 23:34:36 2014 (r270252) @
svn commit: r270235 - stable/10/sys/dev/e1000
Author: luigi Date: Wed Aug 20 17:33:32 2014 New Revision: 270235 URL: http://svnweb.freebsd.org/changeset/base/270235 Log: MFC 259907 (dates back to december) use the correct netmap <-> nic slot mapping on the transmit ring for 'lem'. This bug would manifest only in netmap mode and on packets transmitted after a NIC reset while netmap mode is active. Modified: stable/10/sys/dev/e1000/if_lem.c Modified: stable/10/sys/dev/e1000/if_lem.c == --- stable/10/sys/dev/e1000/if_lem.cWed Aug 20 17:27:15 2014 (r270234) +++ stable/10/sys/dev/e1000/if_lem.cWed Aug 20 17:33:32 2014 (r270235) @@ -2678,7 +2678,7 @@ lem_setup_transmit_structures(struct ada void *addr; addr = PNMB(slot + si, &paddr); - adapter->tx_desc_base[si].buffer_addr = htole64(paddr); + adapter->tx_desc_base[i].buffer_addr = htole64(paddr); /* reload the map for netmap mode */ netmap_load_map(adapter->txtag, tx_buffer->map, addr); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r270097 - head/sys/dev/netmap
Author: luigi Date: Sun Aug 17 10:25:27 2014 New Revision: 270097 URL: http://svnweb.freebsd.org/changeset/base/270097 Log: staticize two functions, and use proper format for a struct sglist (reported by bz) Modified: head/sys/dev/netmap/if_vtnet_netmap.h Modified: head/sys/dev/netmap/if_vtnet_netmap.h == --- head/sys/dev/netmap/if_vtnet_netmap.h Sun Aug 17 09:44:42 2014 (r270096) +++ head/sys/dev/netmap/if_vtnet_netmap.h Sun Aug 17 10:25:27 2014 (r270097) @@ -42,7 +42,7 @@ * and need to be freed; * - buffers queued by netmap return the txq/rxq, and do not need work */ -void +static void vtnet_netmap_free_bufs(struct SOFTC_T* sc) { int i, nmb = 0, n = 0, last; @@ -80,7 +80,7 @@ vtnet_netmap_free_bufs(struct SOFTC_T* s } /* Register and unregister. */ -int +static int vtnet_netmap_reg(struct netmap_adapter *na, int onoff) { struct ifnet *ifp = na->ifp; @@ -237,7 +237,7 @@ vtnet_refill_rxq(struct netmap_kring *kr /* use a local sglist, default might be short */ struct sglist_seg ss[2]; - struct sglist sg[1] = { ss, 0, 0, 2}; + struct sglist sg = { ss, 0, 0, 2 }; for (n = 0; nm_i != head; n++) { static struct virtio_net_hdr_mrg_rxbuf hdr; @@ -252,11 +252,11 @@ vtnet_refill_rxq(struct netmap_kring *kr } slot->flags &= ~NS_BUF_CHANGED; - sglist_reset(sg); // cheap - err = sglist_append(sg, &hdr, sc->vtnet_hdr_size); - err = sglist_append_phys(sg, paddr, NETMAP_BUF_SIZE(na)); + sglist_reset(&sg); // cheap + err = sglist_append(&sg, &hdr, sc->vtnet_hdr_size); + err = sglist_append_phys(&sg, paddr, NETMAP_BUF_SIZE(na)); /* writable for the host */ - err = virtqueue_enqueue(vq, rxq, sg, 0, sg->sg_nseg); + err = virtqueue_enqueue(vq, rxq, &sg, 0, sg.sg_nseg); if (err < 0) { D("virtqueue_enqueue failed"); break; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r270063 - in head: sys/conf sys/dev/cxgbe sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap sys/dev/virtio/network sys/net tools/tools/netmap
On Sat, Aug 16, 2014 at 03:00:01PM +, Luigi Rizzo wrote: > Author: luigi ... > 5. if_lem.c: support for various paravirtualization features, > experimental and disabled by default. > Most of these are described in our ANCS'13 paper [1]. > Paravirtualized support in netmap mode is new, and beats the > numbers in the paper by a large factor (under qemu-kvm, > we measured gues-host throughput up to 10-12 Mpps). ref. [1] is Luigi Rizzo, Giuseppe Lettieri, Vincenzo Maffione, Speeding up packet I/O in virtual machines, ACM/IEEE ANCS'13, October 2013, San Jose you can find a draft of the pdf on my research page http://info.iet.unipi.it/~luigi/research.html cheers luigi ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r270063 - in head: sys/conf sys/dev/cxgbe sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap sys/dev/virtio/network sys/net tools/tools/netmap
Author: luigi Date: Sat Aug 16 15:00:01 2014 New Revision: 270063 URL: http://svnweb.freebsd.org/changeset/base/270063 Log: Update to the current version of netmap. Mostly bugfixes or features developed in the past 6 months, so this is a 10.1 candidate. Basically no user API changes (some bugfixes in sys/net/netmap_user.h). In detail: 1. netmap support for virtio-net, including in netmap mode. Under bhyve and with a netmap backend [2] we reach over 1Mpps with standard APIs (e.g. libpcap), and 5-8 Mpps in netmap mode. 2. (kernel) add support for multiple memory allocators, so we can better partition physical and virtual interfaces giving access to separate users. The most visible effect is one additional argument to the various kernel functions to compute buffer addresses. All netmap-supported drivers are affected, but changes are mechanical and trivial 3. (kernel) simplify the prototype for *txsync() and *rxsync() driver methods. All netmap drivers affected, changes mostly mechanical. 4. add support for netmap-monitor ports. Think of it as a mirroring port on a physical switch: a netmap monitor port replicates traffic present on the main port. Restrictions apply. Drive carefully. 5. if_lem.c: support for various paravirtualization features, experimental and disabled by default. Most of these are described in our ANCS'13 paper [1]. Paravirtualized support in netmap mode is new, and beats the numbers in the paper by a large factor (under qemu-kvm, we measured gues-host throughput up to 10-12 Mpps). A lot of refactoring and additional documentation in the files in sys/dev/netmap, but apart from #2 and #3 above, almost nothing of this stuff is visible to other kernel parts. Example programs in tools/tools/netmap have been updated with bugfixes and to support more of the existing features. This is meant to go into 10.1 so we plan an MFC before the Aug.22 deadline. A lot of this code has been contributed by my colleagues at UNIPI, including Giuseppe Lettieri, Vincenzo Maffione, Stefano Garzarella. MFC after:3 days. Added: head/sys/dev/netmap/if_vtnet_netmap.h (contents, props changed) head/sys/dev/netmap/netmap_monitor.c (contents, props changed) head/sys/net/paravirt.h (contents, props changed) Modified: head/sys/conf/files head/sys/dev/cxgbe/t4_netmap.c head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_lem.c head/sys/dev/ixgbe/ixgbe.c head/sys/dev/netmap/if_em_netmap.h head/sys/dev/netmap/if_igb_netmap.h head/sys/dev/netmap/if_lem_netmap.h head/sys/dev/netmap/if_re_netmap.h head/sys/dev/netmap/ixgbe_netmap.h head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_freebsd.c head/sys/dev/netmap/netmap_generic.c head/sys/dev/netmap/netmap_kern.h head/sys/dev/netmap/netmap_mbq.h head/sys/dev/netmap/netmap_mem2.c head/sys/dev/netmap/netmap_mem2.h head/sys/dev/netmap/netmap_offloadings.c head/sys/dev/netmap/netmap_pipe.c head/sys/dev/netmap/netmap_vale.c head/sys/dev/virtio/network/if_vtnet.c head/sys/net/netmap.h head/sys/net/netmap_user.h head/tools/tools/netmap/pkt-gen.c head/tools/tools/netmap/vale-ctl.c Modified: head/sys/conf/files == --- head/sys/conf/files Sat Aug 16 14:56:11 2014(r270062) +++ head/sys/conf/files Sat Aug 16 15:00:01 2014(r270063) @@ -1948,6 +1948,7 @@ dev/netmap/netmap_freebsd.c optional net dev/netmap/netmap_generic.coptional netmap dev/netmap/netmap_mbq.coptional netmap dev/netmap/netmap_mem2.c optional netmap +dev/netmap/netmap_monitor.coptional netmap dev/netmap/netmap_offloadings.coptional netmap dev/netmap/netmap_pipe.c optional netmap dev/netmap/netmap_vale.c optional netmap Modified: head/sys/dev/cxgbe/t4_netmap.c == --- head/sys/dev/cxgbe/t4_netmap.c Sat Aug 16 14:56:11 2014 (r270062) +++ head/sys/dev/cxgbe/t4_netmap.c Sat Aug 16 15:00:01 2014 (r270063) @@ -434,19 +434,18 @@ cxgbe_netmap_on(struct adapter *sc, stru hwb = &sc->sge.hw_buf_info[0]; for (i = 0; i < SGE_FLBUF_SIZES; i++, hwb++) { - if (hwb->size == NETMAP_BUF_SIZE) + if (hwb->size == NETMAP_BUF_SIZE(na)) break; } if (i >= SGE_FLBUF_SIZES) { if_printf(ifp, "no hwidx for netmap buffer size %d.\n", - NETMAP_BUF_SIZE); + NETMAP_BUF_SIZE(na)); return (ENXIO); } hwidx = i; /* Must set caps before calling netmap_reset */ - na->na_flags |= (NAF_NATIVE_ON | NAF_NETMAP_ON); - ifp->if_capenable |= IFCAP_NETMAP; + nm_set_native_flags(na); for_each_n
svn commit: r270046 - head/sys/dev/virtio
Author: luigi Date: Sat Aug 16 13:13:17 2014 New Revision: 270046 URL: http://svnweb.freebsd.org/changeset/base/270046 Log: print additional debugging info in virtqueue_dump() (not fundamental, but useful to debug performance issues on vtnet) MFC after:3 days Modified: head/sys/dev/virtio/virtqueue.c Modified: head/sys/dev/virtio/virtqueue.c == --- head/sys/dev/virtio/virtqueue.c Sat Aug 16 13:11:59 2014 (r270045) +++ head/sys/dev/virtio/virtqueue.c Sat Aug 16 13:13:17 2014 (r270046) @@ -605,11 +605,13 @@ virtqueue_dump(struct virtqueue *vq) printf("VQ: %s - size=%d; free=%d; used=%d; queued=%d; " "desc_head_idx=%d; avail.idx=%d; used_cons_idx=%d; " - "used.idx=%d; avail.flags=0x%x; used.flags=0x%x\n", + "used.idx=%d; used_event_idx=%d; avail.flags=0x%x; used.flags=0x%x\n", vq->vq_name, vq->vq_nentries, vq->vq_free_cnt, virtqueue_nused(vq), vq->vq_queued_cnt, vq->vq_desc_head_idx, vq->vq_ring.avail->idx, vq->vq_used_cons_idx, - vq->vq_ring.used->idx, vq->vq_ring.avail->flags, + vq->vq_ring.used->idx, + vring_used_event(&vq->vq_ring), + vq->vq_ring.avail->flags, vq->vq_ring.used->flags); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r268156 - head/sys/dev/oce
Author: luigi Date: Wed Jul 2 12:13:11 2014 New Revision: 268156 URL: http://svnweb.freebsd.org/changeset/base/268156 Log: Various bugfixes from Stefano Garzarella: 1. oce_multiq_start(): make sure the buffer is consumed even on ENXIO 2. oce_multiq_transmit(): there is an extra call to drbr_enqueue() causing the mbuf to be enqueued twice when the NIC's queue is full, and potential panics 3. oce_multiq_transmit(): same problem fixed recently in ixgbe (r267187) and other drivers: if the mbuf is enqueued, the proper return value is 0 Submitted by: Stefano Garzarella MFC after:3 days Modified: head/sys/dev/oce/oce_if.c Modified: head/sys/dev/oce/oce_if.c == --- head/sys/dev/oce/oce_if.c Wed Jul 2 11:51:01 2014(r268155) +++ head/sys/dev/oce/oce_if.c Wed Jul 2 12:13:11 2014(r268156) @@ -563,9 +563,6 @@ oce_multiq_start(struct ifnet *ifp, stru int queue_index = 0; int status = 0; - if (!sc->link_status) - return ENXIO; - if ((m->m_flags & M_FLOWID) != 0) queue_index = m->m_pkthdr.flowid % sc->nwqs; @@ -1274,7 +1271,6 @@ oce_multiq_transmit(struct ifnet *ifp, s drbr_putback(ifp, br, next); wq->tx_stats.tx_stops ++; ifp->if_drv_flags |= IFF_DRV_OACTIVE; - status = drbr_enqueue(ifp, br, next); } break; } @@ -1285,7 +1281,7 @@ oce_multiq_transmit(struct ifnet *ifp, s ETHER_BPF_MTAP(ifp, next); } - return status; + return 0; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r268028 - head/sys/dev/e1000
On Mon, Jun 30, 2014 at 04:56:01PM +0200, Luigi Rizzo wrote: > I am getting the following error while compiling with gcc: > > cc1: warnings being treated as errors > /usr/home/luigi/FreeBSD/head/sys/dev/e1000/if_igb.c: In function > 'igb_attach': > /usr/home/luigi/FreeBSD/head/sys/dev/e1000/if_igb.c:2461: warning: 'cpu_id' > may be used uninitialized in this function > /usr/home/luigi/FreeBSD/head/sys/dev/e1000/if_igb.c:2461: note: 'cpu_id' > was declared here > > (the code is correct, apparently gcc cannot understand that). > > For compatibility i'd throw in an explicit initialization, > however it might be worthwhile rewriting the code with a single > if (adapter->num_queues > 1) { ...} block within the for(), > and also using only one #ifdef RSS -- the other places only > differ in the string passed to diagnostics or comments. and the same goes for the recent changes to ixgbe.c cheers luigi ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r268028 - head/sys/dev/e1000
SE; > > > > cur = &rxr->rx_base[i]; > > @@ -4853,6 +5020,7 @@ igb_rxeof(struct igb_queue *que, int cou > > else > > vtag = le16toh(cur->wb.upper.vlan); > > hdr = le16toh(cur->wb.lower.lo_dword.hs_rss.hdr_info); > > + pkt_info = > le16toh(cur->wb.lower.lo_dword.hs_rss.pkt_info); > > eop = ((staterr & E1000_RXD_STAT_EOP) == > E1000_RXD_STAT_EOP); > > > > /* Make sure all segments of a bad packet are discarded > */ > > @@ -4952,7 +5120,43 @@ igb_rxeof(struct igb_queue *que, int cou > > rxr->fmp->m_pkthdr.ether_vtag = vtag; > > rxr->fmp->m_flags |= M_VLANTAG; > > } > > -#ifndef IGB_LEGACY_TX > > +#ifdef RSS > > + /* XXX set flowtype once this works right */ > > + rxr->fmp->m_pkthdr.flowid = > > + le32toh(cur->wb.lower.hi_dword.rss); > > + rxr->fmp->m_flags |= M_FLOWID; > > + switch (pkt_info & E1000_RXDADV_RSSTYPE_MASK) { > > + case E1000_RXDADV_RSSTYPE_IPV4_TCP: > > + M_HASHTYPE_SET(rxr->fmp, > M_HASHTYPE_RSS_TCP_IPV4); > > + break; > > + case E1000_RXDADV_RSSTYPE_IPV4: > > + M_HASHTYPE_SET(rxr->fmp, > M_HASHTYPE_RSS_IPV4); > > + break; > > + case E1000_RXDADV_RSSTYPE_IPV6_TCP: > > + M_HASHTYPE_SET(rxr->fmp, > M_HASHTYPE_RSS_TCP_IPV6); > > + break; > > + case E1000_RXDADV_RSSTYPE_IPV6_EX: > > + M_HASHTYPE_SET(rxr->fmp, > M_HASHTYPE_RSS_IPV6_EX); > > + break; > > + case E1000_RXDADV_RSSTYPE_IPV6: > > + M_HASHTYPE_SET(rxr->fmp, > M_HASHTYPE_RSS_IPV6); > > + break; > > + case E1000_RXDADV_RSSTYPE_IPV6_TCP_EX: > > + M_HASHTYPE_SET(rxr->fmp, > M_HASHTYPE_RSS_TCP_IPV6_EX); > > + break; > > + > > + /* XXX no UDP support in RSS just yet */ > > +#ifdef notyet > > + case E1000_RXDADV_RSSTYPE_IPV4_UDP: > > + case E1000_RXDADV_RSSTYPE_IPV6_UDP: > > + case E1000_RXDADV_RSSTYPE_IPV6_UDP_EX: > > +#endif > > + > > + default: > > + /* XXX fallthrough */ > > + M_HASHTYPE_SET(rxr->fmp, > M_HASHTYPE_NONE); > > + } > > +#elif !defined(IGB_LEGACY_TX) > > rxr->fmp->m_pkthdr.flowid = que->msix; > > rxr->fmp->m_flags |= M_FLOWID; > > #endif > > > > -- -+--- Prof. Luigi RIZZO, ri...@iet.unipi.it . Dip. di Ing. dell'Informazione http://www.iet.unipi.it/~luigi/. Universita` di Pisa TEL +39-050-2211611 . via Diotisalvi 2 Mobile +39-338-6809875 . 56122 PISA (Italy) -+--- ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r267334 - stable/10/sys/dev/netmap
Author: luigi Date: Tue Jun 10 17:24:46 2014 New Revision: 267334 URL: http://svnweb.freebsd.org/changeset/base/267334 Log: MFC 267284 Fixes from Fanco Ficthner on transparent mode * The way rings are updated changed with the last API bump. Also sync ->head when moving slots in netmap_sw_to_nic(). * Remove a crashing selrecord() call. * Unclog the logic surrounding netmap_rxsync_from_host(). * Add timestamping to RX host ring. * Remove a couple of obsolete comments. Submitted by: Franco Fichtner MFC after:3 days Sponsored by: Packetwerk Modified: stable/10/sys/dev/netmap/netmap.c Modified: stable/10/sys/dev/netmap/netmap.c == --- stable/10/sys/dev/netmap/netmap.c Tue Jun 10 17:17:44 2014 (r267333) +++ stable/10/sys/dev/netmap/netmap.c Tue Jun 10 17:24:46 2014 (r267334) @@ -981,7 +981,7 @@ netmap_sw_to_nic(struct netmap_adapter * dst->len = tmp.len; dst->flags = NS_BUF_CHANGED; - rdst->cur = nm_next(dst_cur, dst_lim); + rdst->head = rdst->cur = nm_next(dst_cur, dst_lim); } /* if (sent) XXX txsync ? */ } @@ -1028,11 +1028,6 @@ netmap_txsync_to_host(struct netmap_adap * They have been put in kring->rx_queue by netmap_transmit(). * We protect access to the kring using kring->rx_queue.lock * - * This routine also does the selrecord if called from the poll handler - * (we know because td != NULL). - * - * NOTE: on linux, selrecord() is defined as a macro and uses pwait - * as an additional hidden argument. * returns the number of packets delivered to tx queues in * transparent mode, or a negative value if error */ @@ -1088,10 +1083,6 @@ netmap_rxsync_from_host(struct netmap_ad nm_rxsync_finalize(kring); - /* access copies of cur,tail in the kring */ - if (kring->rcur == kring->rtail && td) /* no bufs available */ - selrecord(td, &kring->si); - mbq_unlock(q); return ret; } @@ -2124,8 +2115,6 @@ do_retry_rx: /* * transparent mode support: collect packets * from the rxring(s). -* XXX NR_FORWARD should only be read on -* physical or NIC ports */ if (netmap_fwd ||kring->ring->flags & NR_FORWARD) { ND(10, "forwarding some buffers up %d to %d", @@ -2152,13 +2141,12 @@ do_retry_rx: /* transparent mode XXX only during first pass ? */ if (na->na_flags & NAF_HOST_RINGS) { kring = &na->rx_rings[na->num_rx_rings]; - if (check_all_rx - && (netmap_fwd || kring->ring->flags & NR_FORWARD)) { - /* XXX fix to use kring fields */ - if (nm_ring_empty(kring->ring)) - send_down = netmap_rxsync_from_host(na, td, dev); - if (!nm_ring_empty(kring->ring)) - revents |= want_rx; + if (netmap_fwd || kring->ring->flags & NR_FORWARD) { + send_down = netmap_rxsync_from_host(na, td, dev); + if (send_down && (netmap_no_timestamp == 0 || + kring->ring->flags & NR_TIMESTAMP)) { + microtime(&kring->ring->ts); + } } } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r267333 - stable/10/sys/dev/netmap
Author: luigi Date: Tue Jun 10 17:17:44 2014 New Revision: 267333 URL: http://svnweb.freebsd.org/changeset/base/267333 Log: MFC 267328: change the netmap mbuf destructor so the same code works also on FreeBSD 9. For head and 10 this change has no effect, but on stable/9 it would cause panics when using emulated netmap on top of a standard device driver. MFC after:3 days Modified: stable/10/sys/dev/netmap/netmap_generic.c Modified: stable/10/sys/dev/netmap/netmap_generic.c == --- stable/10/sys/dev/netmap/netmap_generic.c Tue Jun 10 17:05:41 2014 (r267332) +++ stable/10/sys/dev/netmap/netmap_generic.c Tue Jun 10 17:17:44 2014 (r267333) @@ -102,24 +102,30 @@ __FBSDID("$FreeBSD$"); * mbuf wrappers */ -/* mbuf destructor, also need to change the type to EXT_EXTREF, +/* + * mbuf destructor, also need to change the type to EXT_EXTREF, * add an M_NOFREE flag, and then clear the flag and * chain into uma_zfree(zone_pack, mf) * (or reinstall the buffer ?) + * + * On FreeBSD 9 the destructor is called as ext_free(ext_arg1, ext_arg2) + * whereas newer version have ext_free(m, ext_arg1, ext_arg2) + * For compatibility we set ext_arg1 = m on allocation so we have + * the same code on both. */ #define SET_MBUF_DESTRUCTOR(m, fn) do {\ - (m)->m_ext.ext_free = (void *)fn; \ - (m)->m_ext.ext_type = EXT_EXTREF; \ -} while (0) + (m)->m_ext.ext_free = (void *)fn; \ + (m)->m_ext.ext_type = EXT_EXTREF; \ + } while (0) static void -netmap_default_mbuf_destructor(struct mbuf *m) +netmap_default_mbuf_destructor(struct mbuf *m) { - /* restore original mbuf */ - m->m_ext.ext_buf = m->m_data = m->m_ext.ext_arg1; - m->m_ext.ext_arg1 = NULL; + /* restore original data pointer and type */ + m->m_ext.ext_buf = m->m_data = m->m_ext.ext_arg2; m->m_ext.ext_type = EXT_PACKET; m->m_ext.ext_free = NULL; + m->m_ext.ext_arg1 = m->m_ext.ext_arg2 = NULL; if (*(m->m_ext.ref_cnt) == 0) *(m->m_ext.ref_cnt) = 1; uma_zfree(zone_pack, m); @@ -131,7 +137,8 @@ netmap_get_mbuf(int len) struct mbuf *m; m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR | M_NOFREE); if (m) { - m->m_ext.ext_arg1 = m->m_ext.ext_buf; // XXX save + m->m_ext.ext_arg1 = m; /* FreeBSD 9 compat */ + m->m_ext.ext_arg2 = m->m_ext.ext_buf; /* save original */ m->m_ext.ext_free = (void *)netmap_default_mbuf_destructor; m->m_ext.ext_type = EXT_EXTREF; ND(5, "create m %p refcnt %d", m, *m->m_ext.ref_cnt); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r267328 - head/sys/dev/netmap
Author: luigi Date: Tue Jun 10 16:06:59 2014 New Revision: 267328 URL: http://svnweb.freebsd.org/changeset/base/267328 Log: change the netmap mbuf destructor so the same code works also on FreeBSD 9. For head and 10 this change has no effect, but on stable/9 it would cause panics when using emulated netmap on top of a standard device driver. Modified: head/sys/dev/netmap/netmap_generic.c Modified: head/sys/dev/netmap/netmap_generic.c == --- head/sys/dev/netmap/netmap_generic.cTue Jun 10 15:20:41 2014 (r267327) +++ head/sys/dev/netmap/netmap_generic.cTue Jun 10 16:06:59 2014 (r267328) @@ -102,24 +102,30 @@ __FBSDID("$FreeBSD$"); * mbuf wrappers */ -/* mbuf destructor, also need to change the type to EXT_EXTREF, +/* + * mbuf destructor, also need to change the type to EXT_EXTREF, * add an M_NOFREE flag, and then clear the flag and * chain into uma_zfree(zone_pack, mf) * (or reinstall the buffer ?) + * + * On FreeBSD 9 the destructor is called as ext_free(ext_arg1, ext_arg2) + * whereas newer version have ext_free(m, ext_arg1, ext_arg2) + * For compatibility we set ext_arg1 = m on allocation so we have + * the same code on both. */ #define SET_MBUF_DESTRUCTOR(m, fn) do {\ - (m)->m_ext.ext_free = (void *)fn; \ - (m)->m_ext.ext_type = EXT_EXTREF; \ -} while (0) + (m)->m_ext.ext_free = (void *)fn; \ + (m)->m_ext.ext_type = EXT_EXTREF; \ + } while (0) static void -netmap_default_mbuf_destructor(struct mbuf *m) +netmap_default_mbuf_destructor(struct mbuf *m) { - /* restore original mbuf */ - m->m_ext.ext_buf = m->m_data = m->m_ext.ext_arg1; - m->m_ext.ext_arg1 = NULL; + /* restore original data pointer and type */ + m->m_ext.ext_buf = m->m_data = m->m_ext.ext_arg2; m->m_ext.ext_type = EXT_PACKET; m->m_ext.ext_free = NULL; + m->m_ext.ext_arg1 = m->m_ext.ext_arg2 = NULL; if (*(m->m_ext.ref_cnt) == 0) *(m->m_ext.ref_cnt) = 1; uma_zfree(zone_pack, m); @@ -131,7 +137,8 @@ netmap_get_mbuf(int len) struct mbuf *m; m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR | M_NOFREE); if (m) { - m->m_ext.ext_arg1 = m->m_ext.ext_buf; // XXX save + m->m_ext.ext_arg1 = m; /* FreeBSD 9 compat */ + m->m_ext.ext_arg2 = m->m_ext.ext_buf; /* save original */ m->m_ext.ext_free = (void *)netmap_default_mbuf_destructor; m->m_ext.ext_type = EXT_EXTREF; ND(5, "create m %p refcnt %d", m, *m->m_ext.ref_cnt); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r267284 - head/sys/dev/netmap
Author: luigi Date: Mon Jun 9 15:46:11 2014 New Revision: 267284 URL: http://svnweb.freebsd.org/changeset/base/267284 Log: Fixes from Fanco Ficthner on transparent mode * The way rings are updated changed with the last API bump. Also sync ->head when moving slots in netmap_sw_to_nic(). * Remove a crashing selrecord() call. * Unclog the logic surrounding netmap_rxsync_from_host(). * Add timestamping to RX host ring. * Remove a couple of obsolete comments. Submitted by: Franco Fichtner MFC after:3 days Sponsored by: Packetwerk Modified: head/sys/dev/netmap/netmap.c Modified: head/sys/dev/netmap/netmap.c == --- head/sys/dev/netmap/netmap.cMon Jun 9 15:44:31 2014 (r267283) +++ head/sys/dev/netmap/netmap.cMon Jun 9 15:46:11 2014 (r267284) @@ -981,7 +981,7 @@ netmap_sw_to_nic(struct netmap_adapter * dst->len = tmp.len; dst->flags = NS_BUF_CHANGED; - rdst->cur = nm_next(dst_cur, dst_lim); + rdst->head = rdst->cur = nm_next(dst_cur, dst_lim); } /* if (sent) XXX txsync ? */ } @@ -1028,11 +1028,6 @@ netmap_txsync_to_host(struct netmap_adap * They have been put in kring->rx_queue by netmap_transmit(). * We protect access to the kring using kring->rx_queue.lock * - * This routine also does the selrecord if called from the poll handler - * (we know because td != NULL). - * - * NOTE: on linux, selrecord() is defined as a macro and uses pwait - * as an additional hidden argument. * returns the number of packets delivered to tx queues in * transparent mode, or a negative value if error */ @@ -1088,10 +1083,6 @@ netmap_rxsync_from_host(struct netmap_ad nm_rxsync_finalize(kring); - /* access copies of cur,tail in the kring */ - if (kring->rcur == kring->rtail && td) /* no bufs available */ - selrecord(td, &kring->si); - mbq_unlock(q); return ret; } @@ -2124,8 +2115,6 @@ do_retry_rx: /* * transparent mode support: collect packets * from the rxring(s). -* XXX NR_FORWARD should only be read on -* physical or NIC ports */ if (netmap_fwd ||kring->ring->flags & NR_FORWARD) { ND(10, "forwarding some buffers up %d to %d", @@ -2152,13 +2141,12 @@ do_retry_rx: /* transparent mode XXX only during first pass ? */ if (na->na_flags & NAF_HOST_RINGS) { kring = &na->rx_rings[na->num_rx_rings]; - if (check_all_rx - && (netmap_fwd || kring->ring->flags & NR_FORWARD)) { - /* XXX fix to use kring fields */ - if (nm_ring_empty(kring->ring)) - send_down = netmap_rxsync_from_host(na, td, dev); - if (!nm_ring_empty(kring->ring)) - revents |= want_rx; + if (netmap_fwd || kring->ring->flags & NR_FORWARD) { + send_down = netmap_rxsync_from_host(na, td, dev); + if (send_down && (netmap_no_timestamp == 0 || + kring->ring->flags & NR_TIMESTAMP)) { + microtime(&kring->ring->ts); + } } } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r267283 - head/sys/dev/netmap
Author: luigi Date: Mon Jun 9 15:44:31 2014 New Revision: 267283 URL: http://svnweb.freebsd.org/changeset/base/267283 Log: sync the code with the one in stable/10 (wrap the if_t compatibilty function into a __FreeBSD_version conditional block) Modified: head/sys/dev/netmap/netmap_kern.h Modified: head/sys/dev/netmap/netmap_kern.h == --- head/sys/dev/netmap/netmap_kern.h Mon Jun 9 15:24:45 2014 (r267282) +++ head/sys/dev/netmap/netmap_kern.h Mon Jun 9 15:44:31 2014 (r267283) @@ -62,6 +62,9 @@ #define NM_ATOMIC_TEST_AND_SET(p) (!atomic_cmpset_acq_int((p), 0, 1)) #define NM_ATOMIC_CLEAR(p) atomic_store_rel_int((p), 0) +#if __FreeBSD_version >= 115 +struct netmap_adapter *netmap_getna(if_t ifp); +#endif MALLOC_DECLARE(M_NETMAP); @@ -1261,7 +1264,6 @@ void netmap_catch_tx(struct netmap_gener int generic_xmit_frame(struct ifnet *ifp, struct mbuf *m, void *addr, u_int len, u_int ring_nr); int generic_find_num_desc(struct ifnet *ifp, u_int *tx, u_int *rx); void generic_find_num_queues(struct ifnet *ifp, u_int *txq, u_int *rxq); -struct netmap_adapter *netmap_getna(if_t ifp); /* * netmap_mitigation API. This is used by the generic adapter ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r267282 - stable/10/sys/dev/netmap
Author: luigi Date: Mon Jun 9 15:24:45 2014 New Revision: 267282 URL: http://svnweb.freebsd.org/changeset/base/267282 Log: sync netmap code with the version in HEAD: - fix handling of tx mbufs in emulated netmap mode; - introduce mbq_lock() and mbq_unlock() - rate limit some error messages - many whitespace and comment fixes Modified: stable/10/sys/dev/netmap/netmap.c stable/10/sys/dev/netmap/netmap_freebsd.c stable/10/sys/dev/netmap/netmap_generic.c stable/10/sys/dev/netmap/netmap_kern.h stable/10/sys/dev/netmap/netmap_mbq.c stable/10/sys/dev/netmap/netmap_mbq.h stable/10/sys/dev/netmap/netmap_mem2.c stable/10/sys/dev/netmap/netmap_pipe.c stable/10/sys/dev/netmap/netmap_vale.c Modified: stable/10/sys/dev/netmap/netmap.c == --- stable/10/sys/dev/netmap/netmap.c Mon Jun 9 15:16:17 2014 (r267281) +++ stable/10/sys/dev/netmap/netmap.c Mon Jun 9 15:24:45 2014 (r267282) @@ -270,6 +270,7 @@ netmap_disable_ring(struct netmap_kring } +/* stop or enable all the rings of na */ static void netmap_set_all_rings(struct ifnet *ifp, int stopped) { @@ -303,6 +304,13 @@ netmap_set_all_rings(struct ifnet *ifp, } +/* + * Convenience function used in drivers. Waits for current txsync()s/rxsync()s + * to finish and prevents any new one from starting. Call this before turning + * netmap mode off, or before removing the harware rings (e.g., on module + * onload). As a rule of thumb for linux drivers, this should be placed near + * each napi_disable(). + */ void netmap_disable_all_rings(struct ifnet *ifp) { @@ -310,6 +318,11 @@ netmap_disable_all_rings(struct ifnet *i } +/* + * Convenience function used in drivers. Re-enables rxsync and txsync on the + * adapter's rings In linux drivers, this should be placed near each + * napi_enable(). + */ void netmap_enable_all_rings(struct ifnet *ifp) { @@ -393,6 +406,7 @@ nm_dump_buf(char *p, int len, int lim, c * Fetch configuration from the device, to cope with dynamic * reconfigurations after loading the module. */ +/* call with NMG_LOCK held */ int netmap_update_config(struct netmap_adapter *na) { @@ -447,18 +461,20 @@ netmap_rxsync_compat(struct netmap_kring return na->nm_rxsync(na, kring->ring_id, flags); } +/* kring->nm_sync callback for the host tx ring */ static int netmap_txsync_to_host_compat(struct netmap_kring *kring, int flags) { - (void)flags; + (void)flags; /* unused */ netmap_txsync_to_host(kring->na); return 0; } +/* kring->nm_sync callback for the host rx ring */ static int netmap_rxsync_from_host_compat(struct netmap_kring *kring, int flags) { - (void)flags; + (void)flags; /* unused */ netmap_rxsync_from_host(kring->na, NULL, NULL); return 0; } @@ -489,6 +505,7 @@ netmap_rxsync_from_host_compat(struct ne * Note: for compatibility, host krings are created even when not needed. * The tailroom space is currently used by vale ports for allocating leases. */ +/* call with NMG_LOCK held */ int netmap_krings_create(struct netmap_adapter *na, u_int tailroom) { @@ -567,6 +584,7 @@ netmap_krings_create(struct netmap_adapt /* undo the actions performed by netmap_krings_create */ +/* call with NMG_LOCK held */ void netmap_krings_delete(struct netmap_adapter *na) { @@ -586,6 +604,7 @@ netmap_krings_delete(struct netmap_adapt * on the rings connected to the host so we need to purge * them first. */ +/* call with NMG_LOCK held */ static void netmap_hw_krings_delete(struct netmap_adapter *na) { @@ -598,6 +617,12 @@ netmap_hw_krings_delete(struct netmap_ad } +/* create a new netmap_if for a newly registered fd. + * If this is the first registration of the adapter, + * also create the netmap rings and their in-kernel view, + * the netmap krings. + */ +/* call with NMG_LOCK held */ static struct netmap_if* netmap_if_new(const char *ifname, struct netmap_adapter *na) { @@ -608,17 +633,23 @@ netmap_if_new(const char *ifname, struct return NULL; } - if (na->active_fds) + if (na->active_fds) /* already registered */ goto final; + /* create and init the krings arrays. +* Depending on the adapter, this may also create +* the netmap rings themselves +*/ if (na->nm_krings_create(na)) goto cleanup; + /* create all missing netmap rings */ if (netmap_mem_rings_create(na)) goto cleanup; final: + /* in all cases, create a new netmap if */ nifp = netmap_mem_if_new(ifname, na); if (nifp == NULL) goto cleanup; @@ -638,8 +669,8 @@ cleanup: /* grab a reference to the memory allocator, if we don't have one already. The * reference is taken from the netmap_adapter registered with the priv. - * */ +/* call with NMG_LOCK held */ static int n
svn commit: r267281 - stable/10/sys/net
Author: luigi Date: Mon Jun 9 15:16:17 2014 New Revision: 267281 URL: http://svnweb.freebsd.org/changeset/base/267281 Log: MFC 267168: misc bugfixes: - stdio.h is needed for fprint() - make memsize uint32_t to avoid errors due to overflow - honor the *XPOLL flagg in NIOCREGIF requests - mmap fails wit MAP_FAILED, not NULL. Modified: stable/10/sys/net/netmap_user.h Modified: stable/10/sys/net/netmap_user.h == --- stable/10/sys/net/netmap_user.h Mon Jun 9 15:15:08 2014 (r267280) +++ stable/10/sys/net/netmap_user.h Mon Jun 9 15:16:17 2014 (r267281) @@ -133,6 +133,7 @@ nm_ring_space(struct netmap_ring *ring) #ifndef HAVE_NETMAP_WITH_LIBS #define HAVE_NETMAP_WITH_LIBS +#include #include #include #include /* memset */ @@ -192,7 +193,7 @@ struct nm_desc { struct nm_desc *self; /* point to self if netmap. */ int fd; void *mem; - int memsize; + uint32_t memsize; int done_mmap; /* set if mem is the result of mmap */ struct netmap_if * const nifp; uint16_t first_tx_ring, last_tx_ring, cur_tx_ring; @@ -293,7 +294,7 @@ typedef void (*nm_cb_t)(u_char *, const * if passed a netmap_desc with mem != NULL, * use that memory instead of mmap. */ - + static struct nm_desc *nm_open(const char *ifname, const struct nmreq *req, uint64_t flags, const struct nm_desc *arg); @@ -404,8 +405,6 @@ nm_open(const char *ifname, const struct errmsg = "invalid ringid"; goto fail; } - /* add the *XPOLL flags */ - nr_ringid |= new_flags & (NETMAP_NO_TX_POLL | NETMAP_DO_RX_POLL); d = (struct nm_desc *)calloc(1, sizeof(*d)); if (d == NULL) { @@ -461,6 +460,9 @@ nm_open(const char *ifname, const struct d->req.nr_flags = parent->req.nr_flags; } } + /* add the *XPOLL flags */ + d->req.nr_ringid |= new_flags & (NETMAP_NO_TX_POLL | NETMAP_DO_RX_POLL); + if (ioctl(d->fd, NIOCREGIF, &d->req)) { errmsg = "NIOCREGIF failed"; goto fail; @@ -472,10 +474,11 @@ nm_open(const char *ifname, const struct d->memsize = parent->memsize; d->mem = parent->mem; } else { + /* XXX TODO: check if memsize is too large (or there is overflow) */ d->memsize = d->req.nr_memsize; d->mem = mmap(0, d->memsize, PROT_WRITE | PROT_READ, MAP_SHARED, d->fd, 0); - if (d->mem == NULL) { + if (d->mem == MAP_FAILED) { errmsg = "mmap failed"; goto fail; } @@ -531,7 +534,7 @@ nm_open(const char *ifname, const struct } } #endif /* debugging */ - + d->cur_tx_ring = d->first_tx_ring; d->cur_rx_ring = d->first_rx_ring; return d; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r267280 - stable/10/sys/net
Author: luigi Date: Mon Jun 9 15:15:08 2014 New Revision: 267280 URL: http://svnweb.freebsd.org/changeset/base/267280 Log: MFC 267167: whitespace changes (comments) Modified: stable/10/sys/net/netmap.h Modified: stable/10/sys/net/netmap.h == --- stable/10/sys/net/netmap.h Mon Jun 9 15:09:05 2014(r267279) +++ stable/10/sys/net/netmap.h Mon Jun 9 15:15:08 2014(r267280) @@ -124,7 +124,7 @@ * space with a parent device. The ifname indicates the parent device, * which must already exist. Flags in nr_flags indicate if we want to * bind the master or slave side, the index (from nr_ringid) - * is just a cookie and does need to be sequential. + * is just a cookie and does not need to be sequential. * * + NIOCREGIF can also attach to 'monitor' rings that replicate * the content of specific rings, also from the same memory space. @@ -228,7 +228,7 @@ struct netmap_slot { * 'head' and 'cur' must be incremented as slots are filled * with new packets to be sent; * 'cur' can be moved further ahead if we need more space - * for new transmissions. + * for new transmissions. XXX todo (2014-03-12) * * In RX rings: * @@ -447,27 +447,13 @@ struct netmap_if { * * nr_arg1, nr_arg2, nr_arg3 (in/out) command specific * - * + * * */ /* * struct nmreq overlays a struct ifreq (just the name) - * - * On input, nr_ringid indicates which rings we are requesting, - * with the low flags for the specific ring number. - * selection FLAGS RING INDEX - * - * all the NIC rings 0x - - * only HOST ring 0x2000 ring index - * single NIC ring 0x4000 - - * all the NIC+HOST rings 0x6000 - - * one pipe ring, master 0x8000 ring index - * *** INVALID 0xA000 - * one pipe ring, slave0xC000 ring index - * *** INVALID 0xE000 - * */ struct nmreq { charnr_name[IFNAMSIZ]; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r267279 - in stable/10/sys/dev: e1000 ixgbe virtio/network vmware/vmxnet3
Author: luigi Date: Mon Jun 9 15:09:05 2014 New Revision: 267279 URL: http://svnweb.freebsd.org/changeset/base/267279 Log: MFC svn 267065 and 267187 make sure ifp->if_transmit returns 0 if a buffer is enqueued. This should also be merged to stable/9. After this fix, drivers still known to have this bug are igxbe/ixv and i40e. Drivers using if_transmit are correct, and so are most of the other drivers that reassing if_transmit. Among other things, this bug causes panics when using netmap emulation on top of generic drivers. Modified: stable/10/sys/dev/e1000/if_igb.c stable/10/sys/dev/ixgbe/ixgbe.c stable/10/sys/dev/virtio/network/if_vtnet.c stable/10/sys/dev/vmware/vmxnet3/if_vmx.c Modified: stable/10/sys/dev/e1000/if_igb.c == --- stable/10/sys/dev/e1000/if_igb.cMon Jun 9 15:00:43 2014 (r267278) +++ stable/10/sys/dev/e1000/if_igb.cMon Jun 9 15:09:05 2014 (r267279) @@ -988,12 +988,12 @@ igb_mq_start(struct ifnet *ifp, struct m if (err) return (err); if (IGB_TX_TRYLOCK(txr)) { - err = igb_mq_start_locked(ifp, txr); + igb_mq_start_locked(ifp, txr); IGB_TX_UNLOCK(txr); } else taskqueue_enqueue(que->tq, &txr->txq_task); - return (err); + return (0); } static int Modified: stable/10/sys/dev/ixgbe/ixgbe.c == --- stable/10/sys/dev/ixgbe/ixgbe.c Mon Jun 9 15:00:43 2014 (r267278) +++ stable/10/sys/dev/ixgbe/ixgbe.c Mon Jun 9 15:09:05 2014 (r267279) @@ -831,12 +831,12 @@ ixgbe_mq_start(struct ifnet *ifp, struct if (err) return (err); if (IXGBE_TX_TRYLOCK(txr)) { - err = ixgbe_mq_start_locked(ifp, txr); + ixgbe_mq_start_locked(ifp, txr); IXGBE_TX_UNLOCK(txr); } else taskqueue_enqueue(que->tq, &txr->txq_task); - return (err); + return (0); } static int Modified: stable/10/sys/dev/virtio/network/if_vtnet.c == --- stable/10/sys/dev/virtio/network/if_vtnet.c Mon Jun 9 15:00:43 2014 (r267278) +++ stable/10/sys/dev/virtio/network/if_vtnet.c Mon Jun 9 15:09:05 2014 (r267279) @@ -2260,7 +2260,6 @@ vtnet_txq_mq_start_locked(struct vtnet_t while ((m = drbr_peek(ifp, br)) != NULL) { if (virtqueue_full(vq)) { drbr_putback(ifp, br, m); - error = ENOBUFS; break; } @@ -2283,7 +2282,7 @@ vtnet_txq_mq_start_locked(struct vtnet_t txq->vtntx_watchdog = VTNET_TX_TIMEOUT; } - return (error); + return (0); } static int Modified: stable/10/sys/dev/vmware/vmxnet3/if_vmx.c == --- stable/10/sys/dev/vmware/vmxnet3/if_vmx.c Mon Jun 9 15:00:43 2014 (r267278) +++ stable/10/sys/dev/vmware/vmxnet3/if_vmx.c Mon Jun 9 15:09:05 2014 (r267279) @@ -2933,7 +2933,6 @@ vmxnet3_txq_mq_start_locked(struct vmxne /* Assume worse case if this mbuf is the head of a chain. */ if (m->m_next != NULL && avail < VMXNET3_TX_MAXSEGS) { drbr_putback(ifp, br, m); - error = ENOBUFS; break; } @@ -2956,7 +2955,7 @@ vmxnet3_txq_mq_start_locked(struct vmxne txq->vxtxq_watchdog = VMXNET3_WATCHDOG_TIMEOUT; } - return (error); + return (0); } static int ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r267187 - in head/sys/dev: e1000 ixgbe vmware/vmxnet3
Author: luigi Date: Fri Jun 6 20:49:56 2014 New Revision: 267187 URL: http://svnweb.freebsd.org/changeset/base/267187 Log: make sure if_transmit returns 0 if the mbuf is enqueued. ixgbe/ixv.c still needs a similar fix but it takes a little more restructuring of the code. MFC after:3 days Modified: head/sys/dev/e1000/if_igb.c head/sys/dev/ixgbe/ixgbe.c head/sys/dev/vmware/vmxnet3/if_vmx.c Modified: head/sys/dev/e1000/if_igb.c == --- head/sys/dev/e1000/if_igb.c Fri Jun 6 20:35:40 2014(r267186) +++ head/sys/dev/e1000/if_igb.c Fri Jun 6 20:49:56 2014(r267187) @@ -989,12 +989,12 @@ igb_mq_start(struct ifnet *ifp, struct m if (err) return (err); if (IGB_TX_TRYLOCK(txr)) { - err = igb_mq_start_locked(ifp, txr); + igb_mq_start_locked(ifp, txr); IGB_TX_UNLOCK(txr); } else taskqueue_enqueue(que->tq, &txr->txq_task); - return (err); + return (0); } static int Modified: head/sys/dev/ixgbe/ixgbe.c == --- head/sys/dev/ixgbe/ixgbe.c Fri Jun 6 20:35:40 2014(r267186) +++ head/sys/dev/ixgbe/ixgbe.c Fri Jun 6 20:49:56 2014(r267187) @@ -831,12 +831,12 @@ ixgbe_mq_start(struct ifnet *ifp, struct if (err) return (err); if (IXGBE_TX_TRYLOCK(txr)) { - err = ixgbe_mq_start_locked(ifp, txr); + ixgbe_mq_start_locked(ifp, txr); IXGBE_TX_UNLOCK(txr); } else taskqueue_enqueue(que->tq, &txr->txq_task); - return (err); + return (0); } static int Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c == --- head/sys/dev/vmware/vmxnet3/if_vmx.cFri Jun 6 20:35:40 2014 (r267186) +++ head/sys/dev/vmware/vmxnet3/if_vmx.cFri Jun 6 20:49:56 2014 (r267187) @@ -2935,7 +2935,6 @@ vmxnet3_txq_mq_start_locked(struct vmxne /* Assume worse case if this mbuf is the head of a chain. */ if (m->m_next != NULL && avail < VMXNET3_TX_MAXSEGS) { drbr_putback(ifp, br, m); - error = ENOBUFS; break; } @@ -2958,7 +2957,7 @@ vmxnet3_txq_mq_start_locked(struct vmxne txq->vxtxq_watchdog = VMXNET3_WATCHDOG_TIMEOUT; } - return (error); + return (0); } static int ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r267180 - head/sys/dev/netmap
Author: luigi Date: Fri Jun 6 18:36:02 2014 New Revision: 267180 URL: http://svnweb.freebsd.org/changeset/base/267180 Log: better handling of netmap emulation over standard device drivers: plug a potential mbuf leak, and detect bogus drivers that return ENOBUFS even when the packet has been queued. MFC after:3 days Modified: head/sys/dev/netmap/netmap_freebsd.c head/sys/dev/netmap/netmap_generic.c Modified: head/sys/dev/netmap/netmap_freebsd.c == --- head/sys/dev/netmap/netmap_freebsd.cFri Jun 6 18:32:05 2014 (r267179) +++ head/sys/dev/netmap/netmap_freebsd.cFri Jun 6 18:36:02 2014 (r267180) @@ -61,7 +61,8 @@ /* FREEBSD-SPECIFIC ROUTINES == */ -rawsum_t nm_csum_raw(uint8_t *data, size_t len, rawsum_t cur_sum) +rawsum_t +nm_csum_raw(uint8_t *data, size_t len, rawsum_t cur_sum) { /* TODO XXX please use the FreeBSD implementation for this. */ uint16_t *words = (uint16_t *)data; @@ -80,7 +81,8 @@ rawsum_t nm_csum_raw(uint8_t *data, size /* Fold a raw checksum: 'cur_sum' is in host byte order, while the * return value is in network byte order. */ -uint16_t nm_csum_fold(rawsum_t cur_sum) +uint16_t +nm_csum_fold(rawsum_t cur_sum) { /* TODO XXX please use the FreeBSD implementation for this. */ while (cur_sum >> 16) @@ -89,7 +91,8 @@ uint16_t nm_csum_fold(rawsum_t cur_sum) return htobe16((~cur_sum) & 0x); } -uint16_t nm_csum_ipv4(struct nm_iphdr *iph) +uint16_t +nm_csum_ipv4(struct nm_iphdr *iph) { #if 0 return in_cksum_hdr((void *)iph); @@ -98,7 +101,8 @@ uint16_t nm_csum_ipv4(struct nm_iphdr *i #endif } -void nm_csum_tcpudp_ipv4(struct nm_iphdr *iph, void *data, +void +nm_csum_tcpudp_ipv4(struct nm_iphdr *iph, void *data, size_t datalen, uint16_t *check) { #ifdef INET @@ -120,7 +124,8 @@ void nm_csum_tcpudp_ipv4(struct nm_iphdr #endif } -void nm_csum_tcpudp_ipv6(struct nm_ipv6hdr *ip6h, void *data, +void +nm_csum_tcpudp_ipv6(struct nm_ipv6hdr *ip6h, void *data, size_t datalen, uint16_t *check) { #ifdef INET6 @@ -143,7 +148,8 @@ void nm_csum_tcpudp_ipv6(struct nm_ipv6h int netmap_catch_rx(struct netmap_adapter *na, int intercept) { - struct netmap_generic_adapter *gna = (struct netmap_generic_adapter *)na; + struct netmap_generic_adapter *gna = + (struct netmap_generic_adapter *)na; struct ifnet *ifp = na->ifp; if (intercept) { @@ -209,11 +215,29 @@ generic_xmit_frame(struct ifnet *ifp, st { int ret; - m->m_len = m->m_pkthdr.len = 0; + /* +* The mbuf should be a cluster from our special pool, +* so we do not need to do an m_copyback but just copy +* (and eventually, just reference the netmap buffer) +*/ - // copy data to the mbuf - m_copyback(m, 0, len, addr); - // inc refcount. We are alone, so we can skip the atomic + if (*m->m_ext.ref_cnt != 1) { + D("invalid refcnt %d for %p", + *m->m_ext.ref_cnt, m); + panic("in generic_xmit_frame"); + } + // XXX the ext_size check is unnecessary if we link the netmap buf + if (m->m_ext.ext_size < len) { + RD(5, "size %d < len %d", m->m_ext.ext_size, len); + len = m->m_ext.ext_size; + } + if (0) { /* XXX seems to have negligible benefits */ + m->m_ext.ext_buf = m->m_data = addr; + } else { + bcopy(addr, m->m_data, len); + } + m->m_len = m->m_pkthdr.len = len; + // inc refcount. All ours, we could skip the atomic atomic_fetchadd_int(m->m_ext.ref_cnt, 1); m->m_flags |= M_FLOWID; m->m_pkthdr.flowid = ring_nr; @@ -238,7 +262,7 @@ netmap_getna(if_t ifp) int generic_find_num_desc(struct ifnet *ifp, unsigned int *tx, unsigned int *rx) { - D("called"); + D("called, in tx %d rx %d", *tx, *rx); return 0; } @@ -246,13 +270,14 @@ generic_find_num_desc(struct ifnet *ifp, void generic_find_num_queues(struct ifnet *ifp, u_int *txq, u_int *rxq) { - D("called"); + D("called, in txq %d rxq %d", *txq, *rxq); *txq = netmap_generic_rings; *rxq = netmap_generic_rings; } -void netmap_mitigation_init(struct nm_generic_mit *mit, struct netmap_adapter *na) +void +netmap_mitigation_init(struct nm_generic_mit *mit, struct netmap_adapter *na) { ND("called"); mit->mit_pending = 0; @@ -260,26 +285,30 @@ void netmap_mitigation_init(struct nm_ge } -void netmap_mitigation_start(struct nm_generic_mit *mit) +void +netmap_mitigation_start(struct nm_generic_mit *mit) { ND("called"); } -void netmap_mitigation_restart(struct nm_generic_mit *mit) +void +netmap_mitigation_restart(str
svn commit: r267177 - head/sys/dev/netmap
Author: luigi Date: Fri Jun 6 18:02:32 2014 New Revision: 267177 URL: http://svnweb.freebsd.org/changeset/base/267177 Log: introduce mbq_lock() and mbq_unlock() for the mbq, so it is easier to buil the same code on linux (this generalizes the change in svn 267142) MFC after:3 days Modified: head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_mbq.c head/sys/dev/netmap/netmap_mbq.h Modified: head/sys/dev/netmap/netmap.c == --- head/sys/dev/netmap/netmap.cFri Jun 6 17:53:05 2014 (r267176) +++ head/sys/dev/netmap/netmap.cFri Jun 6 18:02:32 2014 (r267177) @@ -1050,7 +1050,7 @@ netmap_rxsync_from_host(struct netmap_ad (void)pwait;/* disable unused warnings */ (void)td; - mtx_lock_spin(&q->lock); + mbq_lock(q); /* First part: import newly received packets */ n = mbq_len(q); @@ -1092,7 +1092,7 @@ netmap_rxsync_from_host(struct netmap_ad if (kring->rcur == kring->rtail && td) /* no bufs available */ selrecord(td, &kring->si); - mtx_unlock_spin(&q->lock); + mbq_unlock(q); return ret; } @@ -2459,7 +2459,7 @@ netmap_transmit(struct ifnet *ifp, struc * not possible on Linux). * Also avoid overflowing the queue. */ - mtx_lock_spin(&q->lock); + mbq_lock(q); space = kring->nr_hwtail - kring->nr_hwcur; if (space < 0) @@ -2476,7 +2476,7 @@ netmap_transmit(struct ifnet *ifp, struc m = NULL; error = 0; } - mtx_unlock_spin(&q->lock); + mbq_unlock(q); done: if (m) Modified: head/sys/dev/netmap/netmap_mbq.c == --- head/sys/dev/netmap/netmap_mbq.cFri Jun 6 17:53:05 2014 (r267176) +++ head/sys/dev/netmap/netmap_mbq.cFri Jun 6 18:02:32 2014 (r267177) @@ -76,9 +76,9 @@ static inline void __mbq_enqueue(struct void mbq_safe_enqueue(struct mbq *q, struct mbuf *m) { -mtx_lock_spin(&q->lock); +mbq_lock(q); __mbq_enqueue(q, m); -mtx_unlock_spin(&q->lock); +mbq_unlock(q); } @@ -110,9 +110,9 @@ struct mbuf *mbq_safe_dequeue(struct mbq { struct mbuf *ret; -mtx_lock_spin(&q->lock); +mbq_lock(q); ret = __mbq_dequeue(q); -mtx_unlock_spin(&q->lock); +mbq_unlock(q); return ret; } Modified: head/sys/dev/netmap/netmap_mbq.h == --- head/sys/dev/netmap/netmap_mbq.hFri Jun 6 17:53:05 2014 (r267176) +++ head/sys/dev/netmap/netmap_mbq.hFri Jun 6 18:02:32 2014 (r267177) @@ -62,7 +62,17 @@ void mbq_enqueue(struct mbq *q, struct m struct mbuf *mbq_dequeue(struct mbq *q); void mbq_purge(struct mbq *q); -/* XXX missing mbq_lock() and mbq_unlock */ +static inline void +mbq_lock(struct mbq *q) +{ + mtx_lock_spin(&q->lock); +} + +static inline void +mbq_unlock(struct mbq *q) +{ + mtx_unlock_spin(&q->lock); +} void mbq_safe_init(struct mbq *q); void mbq_safe_destroy(struct mbq *q); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r267170 - head/sys/dev/netmap
Author: luigi Date: Fri Jun 6 16:23:08 2014 New Revision: 267170 URL: http://svnweb.freebsd.org/changeset/base/267170 Log: move netmap_getna() to a freebsd-specific file Modified: head/sys/dev/netmap/netmap_freebsd.c head/sys/dev/netmap/netmap_generic.c Modified: head/sys/dev/netmap/netmap_freebsd.c == --- head/sys/dev/netmap/netmap_freebsd.cFri Jun 6 16:18:37 2014 (r267169) +++ head/sys/dev/netmap/netmap_freebsd.cFri Jun 6 16:23:08 2014 (r267170) @@ -223,6 +223,14 @@ generic_xmit_frame(struct ifnet *ifp, st } +#if __FreeBSD_version >= 115 +struct netmap_adapter * +netmap_getna(if_t ifp) +{ + return (NA((struct ifnet *)ifp)); +} +#endif /* __FreeBSD_version >= 115 */ + /* * The following two functions are empty until we have a generic * way to extract the info from the ifp Modified: head/sys/dev/netmap/netmap_generic.c == --- head/sys/dev/netmap/netmap_generic.cFri Jun 6 16:18:37 2014 (r267169) +++ head/sys/dev/netmap/netmap_generic.cFri Jun 6 16:23:08 2014 (r267170) @@ -811,9 +811,3 @@ generic_netmap_attach(struct ifnet *ifp) return retval; } - -struct netmap_adapter * -netmap_getna(if_t ifp) -{ - return (NA((struct ifnet *)ifp)); -} ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r267168 - head/sys/net
Author: luigi Date: Fri Jun 6 15:17:19 2014 New Revision: 267168 URL: http://svnweb.freebsd.org/changeset/base/267168 Log: misc bugfixes: - stdio.h is needed for fprint() - make memsize uint32_t to avoid errors due to overflow - honor the *XPOLL flagg in NIOCREGIF requests - mmap fails wit MAP_FAILED, not NULL. MFC after:3 days Modified: head/sys/net/netmap_user.h Modified: head/sys/net/netmap_user.h == --- head/sys/net/netmap_user.h Fri Jun 6 15:15:27 2014(r267167) +++ head/sys/net/netmap_user.h Fri Jun 6 15:17:19 2014(r267168) @@ -133,6 +133,7 @@ nm_ring_space(struct netmap_ring *ring) #ifndef HAVE_NETMAP_WITH_LIBS #define HAVE_NETMAP_WITH_LIBS +#include #include #include #include /* memset */ @@ -192,7 +193,7 @@ struct nm_desc { struct nm_desc *self; /* point to self if netmap. */ int fd; void *mem; - int memsize; + uint32_t memsize; int done_mmap; /* set if mem is the result of mmap */ struct netmap_if * const nifp; uint16_t first_tx_ring, last_tx_ring, cur_tx_ring; @@ -404,8 +405,6 @@ nm_open(const char *ifname, const struct errmsg = "invalid ringid"; goto fail; } - /* add the *XPOLL flags */ - nr_ringid |= new_flags & (NETMAP_NO_TX_POLL | NETMAP_DO_RX_POLL); d = (struct nm_desc *)calloc(1, sizeof(*d)); if (d == NULL) { @@ -461,6 +460,9 @@ nm_open(const char *ifname, const struct d->req.nr_flags = parent->req.nr_flags; } } + /* add the *XPOLL flags */ + d->req.nr_ringid |= new_flags & (NETMAP_NO_TX_POLL | NETMAP_DO_RX_POLL); + if (ioctl(d->fd, NIOCREGIF, &d->req)) { errmsg = "NIOCREGIF failed"; goto fail; @@ -472,10 +474,11 @@ nm_open(const char *ifname, const struct d->memsize = parent->memsize; d->mem = parent->mem; } else { + /* XXX TODO: check if memsize is too large (or there is overflow) */ d->memsize = d->req.nr_memsize; d->mem = mmap(0, d->memsize, PROT_WRITE | PROT_READ, MAP_SHARED, d->fd, 0); - if (d->mem == NULL) { + if (d->mem == MAP_FAILED) { errmsg = "mmap failed"; goto fail; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"