svn commit: r335305 - head/sys/dev/virtio
Author: bryanv Date: Sun Jun 17 20:45:48 2018 New Revision: 335305 URL: https://svnweb.freebsd.org/changeset/base/335305 Log: Update VirtIO definitions from Linux virtio_config.h and virtio_ring.h headers Modified: head/sys/dev/virtio/virtio_config.h head/sys/dev/virtio/virtio_ring.h Modified: head/sys/dev/virtio/virtio_config.h == --- head/sys/dev/virtio/virtio_config.h Sun Jun 17 20:44:20 2018 (r335304) +++ head/sys/dev/virtio/virtio_config.h Sun Jun 17 20:45:48 2018 (r335305) @@ -33,35 +33,58 @@ /* Status byte for guest to report progress. */ #define VIRTIO_CONFIG_STATUS_RESET 0x00 +/* We have seen device and processed generic fields. */ #define VIRTIO_CONFIG_STATUS_ACK 0x01 -#define VIRTIO_CONFIG_STATUS_DRIVER0x03 +/* We have found a driver for the device. */ +#define VIRTIO_CONFIG_STATUS_DRIVER0x02 +/* Driver has used its parts of the config, and is happy. */ #define VIRTIO_CONFIG_STATUS_DRIVER_OK 0x04 +/* Driver has finished configuring features (modern only). */ +#define VIRTIO_CONFIG_S_FEATURES_OK0x08 +/* Device entered invalid state, driver must reset it. */ +#define VIRTIO_CONFIG_S_NEEDS_RESET0x40 +/* We've given up on this device. */ #define VIRTIO_CONFIG_STATUS_FAILED0x80 /* * Generate interrupt when the virtqueue ring is * completely used, even if we've suppressed them. */ -#define VIRTIO_F_NOTIFY_ON_EMPTY (1 << 24) +#define VIRTIO_F_NOTIFY_ON_EMPTY (1UL << 24) +/* Can the device handle any descriptor layout? */ +#define VIRTIO_F_ANY_LAYOUT(1UL << 27) + /* Support for indirect buffer descriptors. */ -#define VIRTIO_RING_F_INDIRECT_DESC(1 << 28) +#define VIRTIO_RING_F_INDIRECT_DESC(1UL << 28) /* Support to suppress interrupt until specific index is reached. */ -#define VIRTIO_RING_F_EVENT_IDX(1 << 29) +#define VIRTIO_RING_F_EVENT_IDX(1UL << 29) /* * The guest should never negotiate this feature; it * is used to detect faulty drivers. */ -#define VIRTIO_F_BAD_FEATURE (1 << 30) +#define VIRTIO_F_BAD_FEATURE (1UL << 30) +/* v1.0 compliant. */ +#define VIRTIO_F_VERSION_1 (1ULL << 32) + /* - * Some VirtIO feature bits (currently bits 28 through 31) are + * If clear - device has the IOMMU bypass quirk feature. + * If set - use platform tools to detect the IOMMU. + * + * Note the reverse polarity (compared to most other features), + * this is for compatibility with legacy systems. + */ +#define VIRTIO_F_IOMMU_PLATFORM(1ULL << 33) + +/* + * Some VirtIO feature bits (currently bits 28 through 34) are * reserved for the transport being used (eg. virtio_ring), the * rest are per-device feature bits. */ #define VIRTIO_TRANSPORT_F_START 28 -#define VIRTIO_TRANSPORT_F_END 32 +#define VIRTIO_TRANSPORT_F_END 34 #endif /* _VIRTIO_CONFIG_H_ */ Modified: head/sys/dev/virtio/virtio_ring.h == --- head/sys/dev/virtio/virtio_ring.h Sun Jun 17 20:44:20 2018 (r335304) +++ head/sys/dev/virtio/virtio_ring.h Sun Jun 17 20:45:48 2018 (r335305) @@ -92,6 +92,13 @@ struct vring { struct vring_used *used; }; +/* Alignment requirements for vring elements. + * When using pre-virtio 1.0 layout, these fall out naturally. + */ +#define VRING_AVAIL_ALIGN_SIZE 2 +#define VRING_USED_ALIGN_SIZE 4 +#define VRING_DESC_ALIGN_SIZE 16 + /* The standard layout for the ring is a continuous chunk of memory which * looks like this. We assume num is a power of 2. * ___ 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: r331112 - stable/11/sys/dev/virtio
Author: bryanv Date: Sat Mar 17 20:37:01 2018 New Revision: 331112 URL: https://svnweb.freebsd.org/changeset/base/331112 Log: MFC r327958, r329601, r329602: Sync VirtIO IDs with Linux Add VirtIO bus config_generation method Add more virtqueue getter methods Modified: stable/11/sys/dev/virtio/virtio.c stable/11/sys/dev/virtio/virtio.h stable/11/sys/dev/virtio/virtio_bus_if.m stable/11/sys/dev/virtio/virtio_ids.h stable/11/sys/dev/virtio/virtqueue.c stable/11/sys/dev/virtio/virtqueue.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/virtio/virtio.c == --- stable/11/sys/dev/virtio/virtio.c Sat Mar 17 20:20:29 2018 (r33) +++ stable/11/sys/dev/virtio/virtio.c Sat Mar 17 20:37:01 2018 (r331112) @@ -54,14 +54,21 @@ static struct virtio_ident { uint16_tdevid; const char *name; } virtio_ident_table[] = { - { VIRTIO_ID_NETWORK,"Network" }, - { VIRTIO_ID_BLOCK, "Block" }, - { VIRTIO_ID_CONSOLE,"Console" }, - { VIRTIO_ID_ENTROPY,"Entropy" }, - { VIRTIO_ID_BALLOON,"Balloon" }, - { VIRTIO_ID_IOMEMORY, "IOMemory" }, - { VIRTIO_ID_SCSI, "SCSI" }, - { VIRTIO_ID_9P, "9P Transport" }, + { VIRTIO_ID_NETWORK,"Network" }, + { VIRTIO_ID_BLOCK, "Block" }, + { VIRTIO_ID_CONSOLE,"Console" }, + { VIRTIO_ID_ENTROPY,"Entropy" }, + { VIRTIO_ID_BALLOON,"Balloon" }, + { VIRTIO_ID_IOMEMORY, "IOMemory" }, + { VIRTIO_ID_RPMSG, "Remote Processor Messaging"}, + { VIRTIO_ID_SCSI, "SCSI" }, + { VIRTIO_ID_9P, "9P Transport" }, + { VIRTIO_ID_RPROC_SERIAL, "Remote Processor Serial" }, + { VIRTIO_ID_CAIF, "CAIF" }, + { VIRTIO_ID_GPU,"GPU" }, + { VIRTIO_ID_INPUT, "Input" }, + { VIRTIO_ID_VSOCK, "VSOCK Transport" }, + { VIRTIO_ID_CRYPTO, "Crypto"}, { 0, NULL } }; @@ -231,6 +238,13 @@ virtio_reinit_complete(device_t dev) { VIRTIO_BUS_REINIT_COMPLETE(device_get_parent(dev)); +} + +int +virtio_config_generation(device_t dev) +{ + + return (VIRTIO_BUS_CONFIG_GENERATION(device_get_parent(dev))); } void Modified: stable/11/sys/dev/virtio/virtio.h == --- stable/11/sys/dev/virtio/virtio.h Sat Mar 17 20:20:29 2018 (r33) +++ stable/11/sys/dev/virtio/virtio.h Sat Mar 17 20:37:01 2018 (r331112) @@ -78,6 +78,7 @@ intvirtio_alloc_virtqueues(device_t dev, int flags, int virtio_setup_intr(device_t dev, enum intr_type type); int virtio_with_feature(device_t dev, uint64_t feature); voidvirtio_stop(device_t dev); +int virtio_config_generation(device_t dev); int virtio_reinit(device_t dev, uint64_t features); voidvirtio_reinit_complete(device_t dev); Modified: stable/11/sys/dev/virtio/virtio_bus_if.m == --- stable/11/sys/dev/virtio/virtio_bus_if.mSat Mar 17 20:20:29 2018 (r33) +++ stable/11/sys/dev/virtio/virtio_bus_if.mSat Mar 17 20:37:01 2018 (r331112) @@ -34,6 +34,14 @@ HEADER { struct vq_alloc_info; }; +CODE { + static int + virtio_bus_default_config_generation(device_t dev) + { + return (0); + } +}; + METHOD uint64_t negotiate_features { device_tdev; uint64_tchild_features; @@ -73,6 +81,10 @@ METHOD void notify_vq { device_tdev; uint16_tqueue; }; + +METHOD int config_generation { + device_tdev; +} DEFAULT virtio_bus_default_config_generation; METHOD void read_device_config { device_tdev; Modified: stable/11/sys/dev/virtio/virtio_ids.h == --- stable/11/sys/dev/virtio/virtio_ids.h Sat Mar 17 20:20:29 2018 (r33) +++ stable/11/sys/dev/virtio/virtio_ids.h Sat Mar 17 20:37:01 2018 (r331112) @@ -32,13 +32,20 @@ #define _VIRTIO_IDS_H_ /* VirtIO device IDs. */ -#define VIRTIO_ID_NETWORK 0x01 -#define VIRTIO_ID_BLOCK0x02 -#define VIRTIO_ID_CONSOLE 0x03 -#define VIRTIO_ID_ENTROPY 0x04 -#define VIRTIO_ID_BALLOON 0x05 -#define
svn commit: r331111 - in stable/11: share/man/man9 sys/dev/pci
Author: bryanv Date: Sat Mar 17 20:20:29 2018 New Revision: 33 URL: https://svnweb.freebsd.org/changeset/base/33 Log: MFC r329598: Add PCI methods to iterate over the PCI capabilities VirtIO V1 provides configuration in multiple VENDOR capabilities so this allows all of the configuration to be discovered. Reviewed by: jhb Differential Revision:https://reviews.freebsd.org/D14325 Modified: stable/11/share/man/man9/pci.9 stable/11/sys/dev/pci/hostb_pci.c stable/11/sys/dev/pci/pci.c stable/11/sys/dev/pci/pci_if.m stable/11/sys/dev/pci/pci_private.h stable/11/sys/dev/pci/pcivar.h stable/11/sys/dev/pci/vga_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/pci.9 == --- stable/11/share/man/man9/pci.9 Sat Mar 17 20:17:35 2018 (r331110) +++ stable/11/share/man/man9/pci.9 Sat Mar 17 20:20:29 2018 (r33) @@ -42,6 +42,9 @@ .Nm pci_find_device , .Nm pci_find_extcap , .Nm pci_find_htcap , +.Nm pci_find_next_cap , +.Nm pci_find_next_extcap , +.Nm pci_find_next_htcap , .Nm pci_find_pcie_root_port , .Nm pci_get_id , .Nm pci_get_max_payload , @@ -100,6 +103,12 @@ .Fn pci_find_extcap "device_t dev" "int capability" "int *capreg" .Ft int .Fn pci_find_htcap "device_t dev" "int capability" "int *capreg" +.Ft int +.Fn pci_find_next_cap "device_t dev" "int capability" "int start" "int *capreg" +.Ft int +.Fn pci_find_next_extcap "device_t dev" "int capability" "int start" "int *capreg" +.Ft int +.Fn pci_find_next_htcap "device_t dev" "int capability" "int start" "int *capreg" .Ft device_t .Fn pci_find_pcie_root_port "device_t dev" .Ft int @@ -330,6 +339,22 @@ returns zero. If the capability is not found or the device does not support capabilities, .Fn pci_find_cap returns an error. +The +.Fn pci_find_next_cap +function is used to locate the next instance of a PCI capability +register set for the device +.Fa dev . +The +.Fa start +should be the +.Fa *capreg +returned by a prior +.Fn pci_find_cap +or +.Fn pci_find_next_cap . +When no more instances are located +.Fn pci_find_next_cap +returns an error. .Pp The .Fn pci_find_extcap @@ -352,6 +377,22 @@ If the extended capability is not found or the device PCI-express device, .Fn pci_find_extcap returns an error. +The +.Fn pci_find_next_extcap +function is used to locate the next instance of a PCI-express +extended capability register set for the device +.Fa dev . +The +.Fa start +should be the +.Fa *capreg +returned by a prior +.Fn pci_find_extcap +or +.Fn pci_find_next_extcap . +When no more instances are located +.Fn pci_find_next_extcap +returns an error. .Pp The .Fn pci_find_htcap @@ -372,6 +413,22 @@ and returns zero. If the capability is not found or the device is not a HyperTransport device, .Fn pci_find_htcap +returns an error. +The +.Fn pci_find_next_htcap +function is used to locate the next instance of a HyperTransport capability +register set for the device +.Fa dev . +The +.Fa start +should be the +.Fa *capreg +returned by a prior +.Fn pci_find_htcap +or +.Fn pci_find_next_htcap . +When no more instances are located +.Fn pci_find_next_htcap returns an error. .Pp The Modified: stable/11/sys/dev/pci/hostb_pci.c == --- stable/11/sys/dev/pci/hostb_pci.c Sat Mar 17 20:17:35 2018 (r331110) +++ stable/11/sys/dev/pci/hostb_pci.c Sat Mar 17 20:20:29 2018 (r33) @@ -207,6 +207,14 @@ pci_hostb_find_cap(device_t dev, device_t child, int c } static int +pci_hostb_find_next_cap(device_t dev, device_t child, int capability, +int start, int *capreg) +{ + + return (pci_find_next_cap(dev, capability, start, capreg)); +} + +static int pci_hostb_find_extcap(device_t dev, device_t child, int capability, int *capreg) { @@ -215,6 +223,14 @@ pci_hostb_find_extcap(device_t dev, device_t child, in } static int +pci_hostb_find_next_extcap(device_t dev, device_t child, int capability, +int start, int *capreg) +{ + + return (pci_find_next_extcap(dev, capability, start, capreg)); +} + +static int pci_hostb_find_htcap(device_t dev, device_t child, int capability, int *capreg) { @@ -222,6 +238,14 @@ pci_hostb_find_htcap(device_t dev, device_t child, int return (pci_find_htcap(dev, capability, capreg)); } +static int +pci_hostb_find_next_htcap(device_t dev, device_t child, int capability, +int start, int *capreg) +{ + + return (pci_find_next_htcap(dev, capability, start, capreg)); +} + static device_method_t pci_hostb_methods[] = { /* Device interface */ DEVMETHOD(device_probe, pci_hostb_probe), @@ -252,8 +276,11 @@ static device_method_t pci_hostb_methods[] = { DEVMETHOD(pci_set_powerstate, pci_hostb_set_powerstate), DEVMETHOD(pci_assign_interrupt,
svn commit: r329602 - head/sys/dev/virtio
Author: bryanv Date: Mon Feb 19 19:31:18 2018 New Revision: 329602 URL: https://svnweb.freebsd.org/changeset/base/329602 Log: Add more virtqueue getter methods MFC after:2 weeks Modified: head/sys/dev/virtio/virtqueue.c head/sys/dev/virtio/virtqueue.h Modified: head/sys/dev/virtio/virtqueue.c == --- head/sys/dev/virtio/virtqueue.c Mon Feb 19 19:28:24 2018 (r329601) +++ head/sys/dev/virtio/virtqueue.c Mon Feb 19 19:31:18 2018 (r329602) @@ -369,6 +369,33 @@ virtqueue_paddr(struct virtqueue *vq) return (vtophys(vq->vq_ring_mem)); } +vm_paddr_t +virtqueue_desc_paddr(struct virtqueue *vq) +{ + + return (vtophys(vq->vq_ring.desc)); +} + +vm_paddr_t +virtqueue_avail_paddr(struct virtqueue *vq) +{ + + return (vtophys(vq->vq_ring.avail)); +} + +vm_paddr_t +virtqueue_used_paddr(struct virtqueue *vq) +{ + + return (vtophys(vq->vq_ring.used)); +} + +uint16_t +virtqueue_index(struct virtqueue *vq) +{ + return (vq->vq_queue_index); +} + int virtqueue_size(struct virtqueue *vq) { Modified: head/sys/dev/virtio/virtqueue.h == --- head/sys/dev/virtio/virtqueue.h Mon Feb 19 19:28:24 2018 (r329601) +++ head/sys/dev/virtio/virtqueue.h Mon Feb 19 19:31:18 2018 (r329602) @@ -84,7 +84,11 @@ void virtqueue_disable_intr(struct virtqueue *vq); /* Get physical address of the virtqueue ring. */ vm_paddr_t virtqueue_paddr(struct virtqueue *vq); +vm_paddr_t virtqueue_desc_paddr(struct virtqueue *vq); +vm_paddr_t virtqueue_avail_paddr(struct virtqueue *vq); +vm_paddr_t virtqueue_used_paddr(struct virtqueue *vq); +uint16_t virtqueue_index(struct virtqueue *vq); int virtqueue_full(struct virtqueue *vq); int virtqueue_empty(struct virtqueue *vq); int virtqueue_size(struct virtqueue *vq); ___ 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: r329601 - head/sys/dev/virtio
Author: bryanv Date: Mon Feb 19 19:28:24 2018 New Revision: 329601 URL: https://svnweb.freebsd.org/changeset/base/329601 Log: Add VirtIO bus config_generation method VirtIO buses (PCI, MMIO) can provide a generation field so a driver can ensure either a 64-bit or array read was stable. MFC after:2 weeks Modified: head/sys/dev/virtio/virtio.c head/sys/dev/virtio/virtio.h head/sys/dev/virtio/virtio_bus_if.m Modified: head/sys/dev/virtio/virtio.c == --- head/sys/dev/virtio/virtio.cMon Feb 19 19:08:25 2018 (r329600) +++ head/sys/dev/virtio/virtio.cMon Feb 19 19:28:24 2018 (r329601) @@ -240,6 +240,13 @@ virtio_reinit_complete(device_t dev) VIRTIO_BUS_REINIT_COMPLETE(device_get_parent(dev)); } +int +virtio_config_generation(device_t dev) +{ + + return (VIRTIO_BUS_CONFIG_GENERATION(device_get_parent(dev))); +} + void virtio_read_device_config(device_t dev, bus_size_t offset, void *dst, int len) { Modified: head/sys/dev/virtio/virtio.h == --- head/sys/dev/virtio/virtio.hMon Feb 19 19:08:25 2018 (r329600) +++ head/sys/dev/virtio/virtio.hMon Feb 19 19:28:24 2018 (r329601) @@ -78,6 +78,7 @@ intvirtio_alloc_virtqueues(device_t dev, int flags, int virtio_setup_intr(device_t dev, enum intr_type type); int virtio_with_feature(device_t dev, uint64_t feature); voidvirtio_stop(device_t dev); +int virtio_config_generation(device_t dev); int virtio_reinit(device_t dev, uint64_t features); voidvirtio_reinit_complete(device_t dev); Modified: head/sys/dev/virtio/virtio_bus_if.m == --- head/sys/dev/virtio/virtio_bus_if.m Mon Feb 19 19:08:25 2018 (r329600) +++ head/sys/dev/virtio/virtio_bus_if.m Mon Feb 19 19:28:24 2018 (r329601) @@ -34,6 +34,14 @@ HEADER { struct vq_alloc_info; }; +CODE { + static int + virtio_bus_default_config_generation(device_t dev) + { + return (0); + } +}; + METHOD uint64_t negotiate_features { device_tdev; uint64_tchild_features; @@ -73,6 +81,10 @@ METHOD void notify_vq { device_tdev; uint16_tqueue; }; + +METHOD int config_generation { + device_tdev; +} DEFAULT virtio_bus_default_config_generation; METHOD void read_device_config { device_tdev; ___ 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: r329598 - in head: share/man/man9 sys/dev/pci
Author: bryanv Date: Mon Feb 19 18:41:56 2018 New Revision: 329598 URL: https://svnweb.freebsd.org/changeset/base/329598 Log: Add PCI methods to iterate over the PCI capabilities VirtIO V1 provides configuration in multiple VENDOR capabilities so this allows all of the configuration to be discovered. Reviewed by: jhb MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D14325 Modified: head/share/man/man9/pci.9 head/sys/dev/pci/hostb_pci.c head/sys/dev/pci/pci.c head/sys/dev/pci/pci_if.m head/sys/dev/pci/pci_private.h head/sys/dev/pci/pcivar.h head/sys/dev/pci/vga_pci.c Modified: head/share/man/man9/pci.9 == --- head/share/man/man9/pci.9 Mon Feb 19 18:14:12 2018(r329597) +++ head/share/man/man9/pci.9 Mon Feb 19 18:41:56 2018(r329598) @@ -42,6 +42,9 @@ .Nm pci_find_device , .Nm pci_find_extcap , .Nm pci_find_htcap , +.Nm pci_find_next_cap , +.Nm pci_find_next_extcap , +.Nm pci_find_next_htcap , .Nm pci_find_pcie_root_port , .Nm pci_get_id , .Nm pci_get_max_payload , @@ -100,6 +103,12 @@ .Fn pci_find_extcap "device_t dev" "int capability" "int *capreg" .Ft int .Fn pci_find_htcap "device_t dev" "int capability" "int *capreg" +.Ft int +.Fn pci_find_next_cap "device_t dev" "int capability" "int start" "int *capreg" +.Ft int +.Fn pci_find_next_extcap "device_t dev" "int capability" "int start" "int *capreg" +.Ft int +.Fn pci_find_next_htcap "device_t dev" "int capability" "int start" "int *capreg" .Ft device_t .Fn pci_find_pcie_root_port "device_t dev" .Ft int @@ -330,6 +339,22 @@ returns zero. If the capability is not found or the device does not support capabilities, .Fn pci_find_cap returns an error. +The +.Fn pci_find_next_cap +function is used to locate the next instance of a PCI capability +register set for the device +.Fa dev . +The +.Fa start +should be the +.Fa *capreg +returned by a prior +.Fn pci_find_cap +or +.Fn pci_find_next_cap . +When no more instances are located +.Fn pci_find_next_cap +returns an error. .Pp The .Fn pci_find_extcap @@ -352,6 +377,22 @@ If the extended capability is not found or the device PCI-express device, .Fn pci_find_extcap returns an error. +The +.Fn pci_find_next_extcap +function is used to locate the next instance of a PCI-express +extended capability register set for the device +.Fa dev . +The +.Fa start +should be the +.Fa *capreg +returned by a prior +.Fn pci_find_extcap +or +.Fn pci_find_next_extcap . +When no more instances are located +.Fn pci_find_next_extcap +returns an error. .Pp The .Fn pci_find_htcap @@ -372,6 +413,22 @@ and returns zero. If the capability is not found or the device is not a HyperTransport device, .Fn pci_find_htcap +returns an error. +The +.Fn pci_find_next_htcap +function is used to locate the next instance of a HyperTransport capability +register set for the device +.Fa dev . +The +.Fa start +should be the +.Fa *capreg +returned by a prior +.Fn pci_find_htcap +or +.Fn pci_find_next_htcap . +When no more instances are located +.Fn pci_find_next_htcap returns an error. .Pp The Modified: head/sys/dev/pci/hostb_pci.c == --- head/sys/dev/pci/hostb_pci.cMon Feb 19 18:14:12 2018 (r329597) +++ head/sys/dev/pci/hostb_pci.cMon Feb 19 18:41:56 2018 (r329598) @@ -207,6 +207,14 @@ pci_hostb_find_cap(device_t dev, device_t child, int c } static int +pci_hostb_find_next_cap(device_t dev, device_t child, int capability, +int start, int *capreg) +{ + + return (pci_find_next_cap(dev, capability, start, capreg)); +} + +static int pci_hostb_find_extcap(device_t dev, device_t child, int capability, int *capreg) { @@ -215,6 +223,14 @@ pci_hostb_find_extcap(device_t dev, device_t child, in } static int +pci_hostb_find_next_extcap(device_t dev, device_t child, int capability, +int start, int *capreg) +{ + + return (pci_find_next_extcap(dev, capability, start, capreg)); +} + +static int pci_hostb_find_htcap(device_t dev, device_t child, int capability, int *capreg) { @@ -222,6 +238,14 @@ pci_hostb_find_htcap(device_t dev, device_t child, int return (pci_find_htcap(dev, capability, capreg)); } +static int +pci_hostb_find_next_htcap(device_t dev, device_t child, int capability, +int start, int *capreg) +{ + + return (pci_find_next_htcap(dev, capability, start, capreg)); +} + static device_method_t pci_hostb_methods[] = { /* Device interface */ DEVMETHOD(device_probe, pci_hostb_probe), @@ -252,8 +276,11 @@ static device_method_t pci_hostb_methods[] = { DEVMETHOD(pci_set_powerstate, pci_hostb_set_powerstate), DEVMETHOD(pci_assign_interrupt, pci_hostb_assign_interrupt), DEVMETHOD(pci_find_cap, pci_hostb_find_cap), + DEVMETHOD(pci_find_next_cap,
svn commit: r329217 - stable/11/share/man/man9
Author: bryanv Date: Tue Feb 13 15:55:31 2018 New Revision: 329217 URL: https://svnweb.freebsd.org/changeset/base/329217 Log: MFC 328917: Correct structure name used in bus_map_resource(9) example Modified: stable/11/share/man/man9/bus_map_resource.9 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/bus_map_resource.9 == --- stable/11/share/man/man9/bus_map_resource.9 Tue Feb 13 15:44:35 2018 (r329216) +++ stable/11/share/man/man9/bus_map_resource.9 Tue Feb 13 15:55:31 2018 (r329217) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 20, 2016 +.Dd February 5, 2018 .Dt BUS_MAP_RESOURCE 9 .Os .Sh NAME @@ -143,16 +143,16 @@ reads the first 32-bit word: .Bd -literal struct resource *r; struct resource_map map; - struct resource_map_args args; + struct resource_map_request req; uint32_t val; int rid; rid = PCIR_BAR(0); r = bus_alloc_resource_any(dev, SYS_RES_MEMORY, , RF_ACTIVE | RF_UNMAPPED); - resource_init_map_request(); - args.memattr = VM_MEMATTR_WRITE_COMBINING; - bus_map_resource(dev, SYS_RES_MEMORY, r, , ); + resource_init_map_request(); + req.memattr = VM_MEMATTR_WRITE_COMBINING; + bus_map_resource(dev, SYS_RES_MEMORY, r, , ); val = bus_read_4(, 0); .Ed .Sh SEE ALSO ___ 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: r328917 - head/share/man/man9
Author: bryanv Date: Tue Feb 6 04:28:21 2018 New Revision: 328917 URL: https://svnweb.freebsd.org/changeset/base/328917 Log: Correct structure name used in bus_map_resource(9) example Reviewed by: jhb MFC after:1 week Differential Revision:https://reviews.freebsd.org/D14188 Modified: head/share/man/man9/bus_map_resource.9 Modified: head/share/man/man9/bus_map_resource.9 == --- head/share/man/man9/bus_map_resource.9 Tue Feb 6 04:16:00 2018 (r328916) +++ head/share/man/man9/bus_map_resource.9 Tue Feb 6 04:28:21 2018 (r328917) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 20, 2016 +.Dd February 5, 2018 .Dt BUS_MAP_RESOURCE 9 .Os .Sh NAME @@ -143,16 +143,16 @@ reads the first 32-bit word: .Bd -literal struct resource *r; struct resource_map map; - struct resource_map_args args; + struct resource_map_request req; uint32_t val; int rid; rid = PCIR_BAR(0); r = bus_alloc_resource_any(dev, SYS_RES_MEMORY, , RF_ACTIVE | RF_UNMAPPED); - resource_init_map_request(); - args.memattr = VM_MEMATTR_WRITE_COMBINING; - bus_map_resource(dev, SYS_RES_MEMORY, r, , ); + resource_init_map_request(); + req.memattr = VM_MEMATTR_WRITE_COMBINING; + bus_map_resource(dev, SYS_RES_MEMORY, r, , ); val = bus_read_4(, 0); .Ed .Sh SEE ALSO ___ 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: r327958 - head/sys/dev/virtio
Author: bryanv Date: Sun Jan 14 06:03:40 2018 New Revision: 327958 URL: https://svnweb.freebsd.org/changeset/base/327958 Log: Sync VirtIO IDs with Linux Modified: head/sys/dev/virtio/virtio.c head/sys/dev/virtio/virtio_ids.h Modified: head/sys/dev/virtio/virtio.c == --- head/sys/dev/virtio/virtio.cSun Jan 14 05:10:02 2018 (r327957) +++ head/sys/dev/virtio/virtio.cSun Jan 14 06:03:40 2018 (r327958) @@ -54,14 +54,21 @@ static struct virtio_ident { uint16_tdevid; const char *name; } virtio_ident_table[] = { - { VIRTIO_ID_NETWORK,"Network" }, - { VIRTIO_ID_BLOCK, "Block" }, - { VIRTIO_ID_CONSOLE,"Console" }, - { VIRTIO_ID_ENTROPY,"Entropy" }, - { VIRTIO_ID_BALLOON,"Balloon" }, - { VIRTIO_ID_IOMEMORY, "IOMemory" }, - { VIRTIO_ID_SCSI, "SCSI" }, - { VIRTIO_ID_9P, "9P Transport" }, + { VIRTIO_ID_NETWORK,"Network" }, + { VIRTIO_ID_BLOCK, "Block" }, + { VIRTIO_ID_CONSOLE,"Console" }, + { VIRTIO_ID_ENTROPY,"Entropy" }, + { VIRTIO_ID_BALLOON,"Balloon" }, + { VIRTIO_ID_IOMEMORY, "IOMemory" }, + { VIRTIO_ID_RPMSG, "Remote Processor Messaging"}, + { VIRTIO_ID_SCSI, "SCSI" }, + { VIRTIO_ID_9P, "9P Transport" }, + { VIRTIO_ID_RPROC_SERIAL, "Remote Processor Serial" }, + { VIRTIO_ID_CAIF, "CAIF" }, + { VIRTIO_ID_GPU,"GPU" }, + { VIRTIO_ID_INPUT, "Input" }, + { VIRTIO_ID_VSOCK, "VSOCK Transport" }, + { VIRTIO_ID_CRYPTO, "Crypto"}, { 0, NULL } }; Modified: head/sys/dev/virtio/virtio_ids.h == --- head/sys/dev/virtio/virtio_ids.hSun Jan 14 05:10:02 2018 (r327957) +++ head/sys/dev/virtio/virtio_ids.hSun Jan 14 06:03:40 2018 (r327958) @@ -32,13 +32,20 @@ #define _VIRTIO_IDS_H_ /* VirtIO device IDs. */ -#define VIRTIO_ID_NETWORK 0x01 -#define VIRTIO_ID_BLOCK0x02 -#define VIRTIO_ID_CONSOLE 0x03 -#define VIRTIO_ID_ENTROPY 0x04 -#define VIRTIO_ID_BALLOON 0x05 -#define VIRTIO_ID_IOMEMORY 0x06 -#define VIRTIO_ID_SCSI 0x08 -#define VIRTIO_ID_9P 0x09 +#define VIRTIO_ID_NETWORK 1 +#define VIRTIO_ID_BLOCK2 +#define VIRTIO_ID_CONSOLE 3 +#define VIRTIO_ID_ENTROPY 4 +#define VIRTIO_ID_BALLOON 5 +#define VIRTIO_ID_IOMEMORY 6 +#define VIRTIO_ID_RPMSG7 +#define VIRTIO_ID_SCSI 8 +#define VIRTIO_ID_9P 9 +#define VIRTIO_ID_RPROC_SERIAL 11 +#define VIRTIO_ID_CAIF 12 +#define VIRTIO_ID_GPU 16 +#define VIRTIO_ID_INPUT18 +#define VIRTIO_ID_VSOCK19 +#define VIRTIO_ID_CRYPTO 20 #endif /* _VIRTIO_IDS_H_ */ ___ 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: r327956 - stable/11/share/man/man4
Author: bryanv Date: Sun Jan 14 05:07:15 2018 New Revision: 327956 URL: https://svnweb.freebsd.org/changeset/base/327956 Log: MFC r327448: Add rc.conf vxlan example Modified: stable/11/share/man/man4/vxlan.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/vxlan.4 == --- stable/11/share/man/man4/vxlan.4Sun Jan 14 05:05:06 2018 (r327955) +++ stable/11/share/man/man4/vxlan.4Sun Jan 14 05:07:15 2018 (r327956) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 16, 2014 +.Dd December 31, 2017 .Dt VXLAN 4 .Os .Sh NAME @@ -214,10 +214,21 @@ Once created, the .Nm interface can be configured with .Xr ifconfig 8 . +.Ed +.Pp +The following when placed in the file +.Pa /etc/rc.conf +will cause a vxlan interface called +.Dq Li vxlan0 +to be created, and will configure the interface in unicast mode. +.Bd -literal -offset indent +cloned_interfaces="vxlan0" +create_args_vxlan0="vxlanid 108 vxlanlocal 192.168.100.1 vxlanremote 192.168.100.2" .Sh SEE ALSO .Xr inet 4 , .Xr inet6 4 , .Xr vlan 4 , +.Xr rc.conf 5 , .Xr ifconfig 8 , .Xr sysctl 8 .Rs ___ 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: r327955 - stable/11/etc
Author: bryanv Date: Sun Jan 14 05:05:06 2018 New Revision: 327955 URL: https://svnweb.freebsd.org/changeset/base/327955 Log: MFC r327438: Add VXLAN (RFC 7348) port Modified: stable/11/etc/services Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/services == --- stable/11/etc/services Sun Jan 14 03:36:03 2018(r327954) +++ stable/11/etc/services Sun Jan 14 05:05:06 2018(r327955) @@ -2291,6 +2291,7 @@ ipfix 4739/udp #IP Flow Info Export ipfixs 4740/sctp #ipfix protocol over DTLS ipfixs 4740/tcp #ipfix protocol over TLS ipfixs 4740/udp #ipfix protocol over DTLS +vxlan 4789/udp #Virtual eXtensible Local Area Network (VXLAN) commplex-main 5000/tcp commplex-main 5000/udp commplex-link 5001/tcp ___ 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: r327948 - head/sys/dev/virtio/console
Author: bryanv Date: Sat Jan 13 21:39:46 2018 New Revision: 327948 URL: https://svnweb.freebsd.org/changeset/base/327948 Log: Fix possible panic when creating VirtIO console dev aliases Since we have no control over the name, the MAKEDEV_CHECKNAME flag must be used to return an error on an invalid (to devfs) name instead of panicing. r305900 that originally added this feature also introduced a few other bugs: - Proper locking not performed - Theoretically broke the expectation that the control event buffer would not span more than one pages, but did not update the CTASSERT that was in place to prevent this. However, since the struct virtio_console_control and the bulk buffer together were quite small, this could not have happened. Also workaround an QEMU VirtIO spec violation in that it includes the NUL terminator in the buffer length when the spec says it is not included. PR: 223531 MFC after:1 week Modified: head/sys/dev/virtio/console/virtio_console.c Modified: head/sys/dev/virtio/console/virtio_console.c == --- head/sys/dev/virtio/console/virtio_console.cSat Jan 13 21:37:14 2018(r327947) +++ head/sys/dev/virtio/console/virtio_console.cSat Jan 13 21:39:46 2018(r327948) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -58,14 +59,19 @@ __FBSDID("$FreeBSD$"); #define VTCON_MAX_PORTS 32 #define VTCON_TTY_PREFIX "V" +#define VTCON_TTY_ALIAS_PREFIX "vtcon" #define VTCON_BULK_BUFSZ 128 +#define VTCON_CTRL_BUFSZ 128 /* - * The buffer cannot cross more than one page boundary due to the + * The buffers cannot cross more than one page boundary due to the * size of the sglist segment array used. */ CTASSERT(VTCON_BULK_BUFSZ <= PAGE_SIZE); +CTASSERT(VTCON_CTRL_BUFSZ <= PAGE_SIZE); +CTASSERT(sizeof(struct virtio_console_config) <= VTCON_CTRL_BUFSZ); + struct vtcon_softc; struct vtcon_softc_port; @@ -80,6 +86,7 @@ struct vtcon_port { int vtcport_flags; #define VTCON_PORT_FLAG_GONE 0x01 #define VTCON_PORT_FLAG_CONSOLE0x02 +#define VTCON_PORT_FLAG_ALIAS 0x04 #if defined(KDB) int vtcport_alt_break_state; @@ -193,6 +200,8 @@ static void vtcon_port_requeue_buf(struct vtcon_port static int vtcon_port_populate(struct vtcon_port *); static void vtcon_port_destroy(struct vtcon_port *); static int vtcon_port_create(struct vtcon_softc *, int); +static void vtcon_port_dev_alias(struct vtcon_port *, const char *, +size_t); static void vtcon_port_drain_bufs(struct virtqueue *); static void vtcon_port_drain(struct vtcon_port *); static void vtcon_port_teardown(struct vtcon_port *); @@ -599,8 +608,7 @@ vtcon_ctrl_event_enqueue(struct vtcon_softc *sc, vq = sc->vtcon_ctrl_rxvq; sglist_init(, 2, segs); - error = sglist_append(, control, - sizeof(struct virtio_console_control) + VTCON_BULK_BUFSZ); + error = sglist_append(, control, VTCON_CTRL_BUFSZ); KASSERT(error == 0, ("%s: error %d adding control to sglist", __func__, error)); @@ -613,10 +621,7 @@ vtcon_ctrl_event_create(struct vtcon_softc *sc) struct virtio_console_control *control; int error; - control = malloc( - sizeof(struct virtio_console_control) + VTCON_BULK_BUFSZ, - M_DEVBUF, M_ZERO | M_NOWAIT); - + control = malloc(VTCON_CTRL_BUFSZ, M_DEVBUF, M_ZERO | M_NOWAIT); if (control == NULL) return (ENOMEM); @@ -633,8 +638,7 @@ vtcon_ctrl_event_requeue(struct vtcon_softc *sc, { int error; - bzero(control, sizeof(struct virtio_console_control) + - VTCON_BULK_BUFSZ); + bzero(control, VTCON_CTRL_BUFSZ); error = vtcon_ctrl_event_enqueue(sc, control); KASSERT(error == 0, @@ -811,19 +815,36 @@ vtcon_ctrl_port_name_event(struct vtcon_softc *sc, int dev = sc->vtcon_dev; scport = >vtcon_ports[id]; + /* +* The VirtIO specification says the NUL terminator is not included in +* the length, but QEMU includes it. Adjust the length if needed. +*/ + if (name == NULL || len == 0) + return; + if (name[len - 1] == '\0') { + len--; + if (len == 0) + return; + } + + VTCON_LOCK(sc); port = scport->vcsp_port; if (port == NULL) { + VTCON_UNLOCK(sc); device_printf(dev, "%s: name port %d, but does not exist\n", __func__, id); return; } - tty_makealias(port->vtcport_tty, "vtcon/%*s", (int)len, name); + VTCON_PORT_LOCK(port); + VTCON_UNLOCK(sc); + vtcon_port_dev_alias(port, name,
svn commit: r327927 - in stable/11: sbin/ifconfig sys/net
Author: bryanv Date: Sat Jan 13 17:21:45 2018 New Revision: 327927 URL: https://svnweb.freebsd.org/changeset/base/327927 Log: MFC r327375, r327385, r327386: Add support for IPv6 scoped addresses to vxlan Advertise IFCAP_LINKSTAT after r326480 added link status support Add macro for vxlan list mutex lock and unlock Modified: stable/11/sbin/ifconfig/ifvxlan.c stable/11/sys/net/if_vxlan.c stable/11/sys/net/if_vxlan.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ifconfig/ifvxlan.c == --- stable/11/sbin/ifconfig/ifvxlan.c Sat Jan 13 16:32:09 2018 (r327926) +++ stable/11/sbin/ifconfig/ifvxlan.c Sat Jan 13 17:21:45 2018 (r327927) @@ -236,25 +236,23 @@ DECL_CMD_FUNC(setvxlan_local, addr, d) switch (ai->ai_family) { #ifdef INET case AF_INET: { - struct in_addr addr = ((struct sockaddr_in *) sa)->sin_addr; + struct sockaddr_in *sin = (struct sockaddr_in *)sa; - if (IN_MULTICAST(ntohl(addr.s_addr))) + if (IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) errx(1, "local address cannot be multicast"); - cmd.vxlcmd_sa.in4.sin_family = AF_INET; - cmd.vxlcmd_sa.in4.sin_addr = addr; + cmd.vxlcmd_sa.in4 = *sin; break; } #endif #ifdef INET6 case AF_INET6: { - struct in6_addr *addr = &((struct sockaddr_in6 *)sa)->sin6_addr; + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa; - if (IN6_IS_ADDR_MULTICAST(addr)) + if (IN6_IS_ADDR_MULTICAST(>sin6_addr)) errx(1, "local address cannot be multicast"); - cmd.vxlcmd_sa.in6.sin6_family = AF_INET6; - cmd.vxlcmd_sa.in6.sin6_addr = *addr; + cmd.vxlcmd_sa.in6 = *sin6; break; } #endif @@ -267,10 +265,10 @@ DECL_CMD_FUNC(setvxlan_local, addr, d) if (!vxlan_exists(s)) { if (cmd.vxlcmd_sa.sa.sa_family == AF_INET) { params.vxlp_with |= VXLAN_PARAM_WITH_LOCAL_ADDR4; - params.vxlp_local_in4 = cmd.vxlcmd_sa.in4.sin_addr; + params.vxlp_local_sa.in4 = cmd.vxlcmd_sa.in4; } else { params.vxlp_with |= VXLAN_PARAM_WITH_LOCAL_ADDR6; - params.vxlp_local_in6 = cmd.vxlcmd_sa.in6.sin6_addr; + params.vxlp_local_sa.in6 = cmd.vxlcmd_sa.in6; } return; } @@ -298,25 +296,23 @@ DECL_CMD_FUNC(setvxlan_remote, addr, d) switch (ai->ai_family) { #ifdef INET case AF_INET: { - struct in_addr addr = ((struct sockaddr_in *)sa)->sin_addr; + struct sockaddr_in *sin = (struct sockaddr_in *)sa; - if (IN_MULTICAST(ntohl(addr.s_addr))) + if (IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) errx(1, "remote address cannot be multicast"); - cmd.vxlcmd_sa.in4.sin_family = AF_INET; - cmd.vxlcmd_sa.in4.sin_addr = addr; + cmd.vxlcmd_sa.in4 = *sin; break; } #endif #ifdef INET6 case AF_INET6: { - struct in6_addr *addr = &((struct sockaddr_in6 *)sa)->sin6_addr; + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa; - if (IN6_IS_ADDR_MULTICAST(addr)) + if (IN6_IS_ADDR_MULTICAST(>sin6_addr)) errx(1, "remote address cannot be multicast"); - cmd.vxlcmd_sa.in6.sin6_family = AF_INET6; - cmd.vxlcmd_sa.in6.sin6_addr = *addr; + cmd.vxlcmd_sa.in6 = *sin6; break; } #endif @@ -329,10 +325,10 @@ DECL_CMD_FUNC(setvxlan_remote, addr, d) if (!vxlan_exists(s)) { if (cmd.vxlcmd_sa.sa.sa_family == AF_INET) { params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR4; - params.vxlp_remote_in4 = cmd.vxlcmd_sa.in4.sin_addr; + params.vxlp_remote_sa.in4 = cmd.vxlcmd_sa.in4; } else { params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR6; - params.vxlp_remote_in6 = cmd.vxlcmd_sa.in6.sin6_addr; + params.vxlp_remote_sa.in6 = cmd.vxlcmd_sa.in6; } return; } @@ -360,25 +356,23 @@ DECL_CMD_FUNC(setvxlan_group, addr, d) switch (ai->ai_family) { #ifdef INET case AF_INET: { - struct in_addr addr = ((struct sockaddr_in *)sa)->sin_addr; + struct sockaddr_in *sin = (struct sockaddr_in *)sa; - if (!IN_MULTICAST(ntohl(addr.s_addr))) + if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
svn commit: r327635 - stable/11/sbin/ifconfig
Author: bryanv Date: Sat Jan 6 20:22:32 2018 New Revision: 327635 URL: https://svnweb.freebsd.org/changeset/base/327635 Log: MFC r326654: Use consistent name for the vxlan VNI parameter name and provide shorthand Modified: stable/11/sbin/ifconfig/ifvxlan.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ifconfig/ifvxlan.c == --- stable/11/sbin/ifconfig/ifvxlan.c Sat Jan 6 19:36:29 2018 (r327634) +++ stable/11/sbin/ifconfig/ifvxlan.c Sat Jan 6 20:22:32 2018 (r327635) @@ -594,6 +594,7 @@ setvxlan_flush(const char *val, int d, int s, const st static struct cmd vxlan_cmds[] = { + DEF_CLONE_CMD_ARG("vni",setvxlan_vni), DEF_CLONE_CMD_ARG("vxlanid",setvxlan_vni), DEF_CLONE_CMD_ARG("vxlanlocal", setvxlan_local), DEF_CLONE_CMD_ARG("vxlanremote",setvxlan_remote), @@ -608,7 +609,8 @@ static struct cmd vxlan_cmds[] = { DEF_CLONE_CMD("vxlanlearn", 1, setvxlan_learn), DEF_CLONE_CMD("-vxlanlearn", 0, setvxlan_learn), - DEF_CMD_ARG("vxlanvni", setvxlan_vni), + DEF_CMD_ARG("vni", setvxlan_vni), + DEF_CMD_ARG("vxlanid", setvxlan_vni), DEF_CMD_ARG("vxlanlocal", setvxlan_local), DEF_CMD_ARG("vxlanremote", setvxlan_remote), DEF_CMD_ARG("vxlangroup", setvxlan_group), ___ 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: r327448 - head/share/man/man4
Author: bryanv Date: Sun Dec 31 21:23:14 2017 New Revision: 327448 URL: https://svnweb.freebsd.org/changeset/base/327448 Log: Add rc.conf vxlan example PR: 206288 Submitted by: ja...@lodge.me.uk MFC after:2 weeks Modified: head/share/man/man4/vxlan.4 Modified: head/share/man/man4/vxlan.4 == --- head/share/man/man4/vxlan.4 Sun Dec 31 21:00:21 2017(r327447) +++ head/share/man/man4/vxlan.4 Sun Dec 31 21:23:14 2017(r327448) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 16, 2014 +.Dd December 31, 2017 .Dt VXLAN 4 .Os .Sh NAME @@ -214,10 +214,21 @@ Once created, the .Nm interface can be configured with .Xr ifconfig 8 . +.Ed +.Pp +The following when placed in the file +.Pa /etc/rc.conf +will cause a vxlan interface called +.Dq Li vxlan0 +to be created, and will configure the interface in unicast mode. +.Bd -literal -offset indent +cloned_interfaces="vxlan0" +create_args_vxlan0="vxlanid 108 vxlanlocal 192.168.100.1 vxlanremote 192.168.100.2" .Sh SEE ALSO .Xr inet 4 , .Xr inet6 4 , .Xr vlan 4 , +.Xr rc.conf 5 , .Xr ifconfig 8 , .Xr sysctl 8 .Rs ___ 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: r327438 - head/etc
Author: bryanv Date: Sun Dec 31 17:11:12 2017 New Revision: 327438 URL: https://svnweb.freebsd.org/changeset/base/327438 Log: Add VXLAN (RFC 7348) port PR: 202316 Submitted by: olgeni@ MFC after:2 weeks Modified: head/etc/services Modified: head/etc/services == --- head/etc/services Sun Dec 31 17:07:59 2017(r327437) +++ head/etc/services Sun Dec 31 17:11:12 2017(r327438) @@ -2291,6 +2291,7 @@ ipfix 4739/udp #IP Flow Info Export ipfixs 4740/sctp #ipfix protocol over DTLS ipfixs 4740/tcp #ipfix protocol over TLS ipfixs 4740/udp #ipfix protocol over DTLS +vxlan 4789/udp #Virtual eXtensible Local Area Network (VXLAN) commplex-main 5000/tcp commplex-main 5000/udp commplex-link 5001/tcp ___ 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: r327386 - head/sys/net
Author: bryanv Date: Sat Dec 30 19:49:40 2017 New Revision: 327386 URL: https://svnweb.freebsd.org/changeset/base/327386 Log: Add macro for vxlan list mutex lock and unlock This will simplify some later VNET support. Submitted by: hrs MFC after:2 weeks Modified: head/sys/net/if_vxlan.c Modified: head/sys/net/if_vxlan.c == --- head/sys/net/if_vxlan.c Sat Dec 30 19:35:12 2017(r327385) +++ head/sys/net/if_vxlan.c Sat Dec 30 19:49:40 2017(r327386) @@ -381,7 +381,11 @@ static const char vxlan_name[] = "vxlan"; static MALLOC_DEFINE(M_VXLAN, vxlan_name, "Virtual eXtensible LAN Interface"); static struct if_clone *vxlan_cloner; + static struct mtx vxlan_list_mtx; +#define VXLAN_LIST_LOCK() mtx_lock(_list_mtx) +#define VXLAN_LIST_UNLOCK()mtx_unlock(_list_mtx) + static LIST_HEAD(, vxlan_socket) vxlan_socket_list; static eventhandler_tag vxlan_ifdetach_event_tag; @@ -890,11 +894,11 @@ vxlan_socket_release(struct vxlan_socket *vso) { int destroy; - mtx_lock(_list_mtx); + VXLAN_LIST_LOCK(); destroy = VXLAN_SO_RELEASE(vso); if (destroy != 0) LIST_REMOVE(vso, vxlso_entry); - mtx_unlock(_list_mtx); + VXLAN_LIST_UNLOCK(); if (destroy != 0) vxlan_socket_destroy(vso); @@ -905,14 +909,14 @@ vxlan_socket_lookup(union vxlan_sockaddr *vxlsa) { struct vxlan_socket *vso; - mtx_lock(_list_mtx); + VXLAN_LIST_LOCK(); LIST_FOREACH(vso, _socket_list, vxlso_entry) { if (vxlan_sockaddr_cmp(>vxlso_laddr, >sa) == 0) { VXLAN_SO_ACQUIRE(vso); break; } } - mtx_unlock(_list_mtx); + VXLAN_LIST_UNLOCK(); return (vso); } @@ -921,10 +925,10 @@ static void vxlan_socket_insert(struct vxlan_socket *vso) { - mtx_lock(_list_mtx); + VXLAN_LIST_LOCK(); VXLAN_SO_ACQUIRE(vso); LIST_INSERT_HEAD(_socket_list, vso, vxlso_entry); - mtx_unlock(_list_mtx); + VXLAN_LIST_UNLOCK(); } static int @@ -3116,10 +3120,10 @@ vxlan_ifdetach_event(void *arg __unused, struct ifnet if ((ifp->if_flags & IFF_MULTICAST) == 0) return; - mtx_lock(_list_mtx); + VXLAN_LIST_LOCK(); LIST_FOREACH(vso, _socket_list, vxlso_entry) vxlan_socket_ifdetach(vso, ifp, ); - mtx_unlock(_list_mtx); + VXLAN_LIST_UNLOCK(); LIST_FOREACH_SAFE(sc, , vxl_ifdetach_list, tsc) { LIST_REMOVE(sc, vxl_ifdetach_list); ___ 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: r327385 - head/sys/net
Author: bryanv Date: Sat Dec 30 19:35:12 2017 New Revision: 327385 URL: https://svnweb.freebsd.org/changeset/base/327385 Log: Advertise IFCAP_LINKSTAT after r326480 added link status support MFC after:2 weeks Modified: head/sys/net/if_vxlan.c Modified: head/sys/net/if_vxlan.c == --- head/sys/net/if_vxlan.c Sat Dec 30 19:27:22 2017(r327384) +++ head/sys/net/if_vxlan.c Sat Dec 30 19:35:12 2017(r327385) @@ -2743,6 +2743,8 @@ vxlan_clone_create(struct if_clone *ifc, int unit, cad ifp->if_ioctl = vxlan_ioctl; ifp->if_transmit = vxlan_transmit; ifp->if_qflush = vxlan_qflush; + ifp->if_capabilities |= IFCAP_LINKSTATE; + ifp->if_capenable |= IFCAP_LINKSTATE; ifmedia_init(>vxl_media, 0, vxlan_media_change, vxlan_media_status); ifmedia_add(>vxl_media, IFM_ETHER | IFM_AUTO, 0, NULL); ___ 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: r327375 - in head: sbin/ifconfig sys/net
Author: bryanv Date: Sat Dec 30 04:03:53 2017 New Revision: 327375 URL: https://svnweb.freebsd.org/changeset/base/327375 Log: Add support for IPv6 scoped addresses to vxlan MFC after:2 weeks Modified: head/sbin/ifconfig/ifvxlan.c head/sys/net/if_vxlan.c head/sys/net/if_vxlan.h Modified: head/sbin/ifconfig/ifvxlan.c == --- head/sbin/ifconfig/ifvxlan.cSat Dec 30 03:08:49 2017 (r327374) +++ head/sbin/ifconfig/ifvxlan.cSat Dec 30 04:03:53 2017 (r327375) @@ -236,25 +236,23 @@ DECL_CMD_FUNC(setvxlan_local, addr, d) switch (ai->ai_family) { #ifdef INET case AF_INET: { - struct in_addr addr = ((struct sockaddr_in *) sa)->sin_addr; + struct sockaddr_in *sin = (struct sockaddr_in *)sa; - if (IN_MULTICAST(ntohl(addr.s_addr))) + if (IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) errx(1, "local address cannot be multicast"); - cmd.vxlcmd_sa.in4.sin_family = AF_INET; - cmd.vxlcmd_sa.in4.sin_addr = addr; + cmd.vxlcmd_sa.in4 = *sin; break; } #endif #ifdef INET6 case AF_INET6: { - struct in6_addr *addr = &((struct sockaddr_in6 *)sa)->sin6_addr; + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa; - if (IN6_IS_ADDR_MULTICAST(addr)) + if (IN6_IS_ADDR_MULTICAST(>sin6_addr)) errx(1, "local address cannot be multicast"); - cmd.vxlcmd_sa.in6.sin6_family = AF_INET6; - cmd.vxlcmd_sa.in6.sin6_addr = *addr; + cmd.vxlcmd_sa.in6 = *sin6; break; } #endif @@ -267,10 +265,10 @@ DECL_CMD_FUNC(setvxlan_local, addr, d) if (!vxlan_exists(s)) { if (cmd.vxlcmd_sa.sa.sa_family == AF_INET) { params.vxlp_with |= VXLAN_PARAM_WITH_LOCAL_ADDR4; - params.vxlp_local_in4 = cmd.vxlcmd_sa.in4.sin_addr; + params.vxlp_local_sa.in4 = cmd.vxlcmd_sa.in4; } else { params.vxlp_with |= VXLAN_PARAM_WITH_LOCAL_ADDR6; - params.vxlp_local_in6 = cmd.vxlcmd_sa.in6.sin6_addr; + params.vxlp_local_sa.in6 = cmd.vxlcmd_sa.in6; } return; } @@ -298,25 +296,23 @@ DECL_CMD_FUNC(setvxlan_remote, addr, d) switch (ai->ai_family) { #ifdef INET case AF_INET: { - struct in_addr addr = ((struct sockaddr_in *)sa)->sin_addr; + struct sockaddr_in *sin = (struct sockaddr_in *)sa; - if (IN_MULTICAST(ntohl(addr.s_addr))) + if (IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) errx(1, "remote address cannot be multicast"); - cmd.vxlcmd_sa.in4.sin_family = AF_INET; - cmd.vxlcmd_sa.in4.sin_addr = addr; + cmd.vxlcmd_sa.in4 = *sin; break; } #endif #ifdef INET6 case AF_INET6: { - struct in6_addr *addr = &((struct sockaddr_in6 *)sa)->sin6_addr; + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa; - if (IN6_IS_ADDR_MULTICAST(addr)) + if (IN6_IS_ADDR_MULTICAST(>sin6_addr)) errx(1, "remote address cannot be multicast"); - cmd.vxlcmd_sa.in6.sin6_family = AF_INET6; - cmd.vxlcmd_sa.in6.sin6_addr = *addr; + cmd.vxlcmd_sa.in6 = *sin6; break; } #endif @@ -329,10 +325,10 @@ DECL_CMD_FUNC(setvxlan_remote, addr, d) if (!vxlan_exists(s)) { if (cmd.vxlcmd_sa.sa.sa_family == AF_INET) { params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR4; - params.vxlp_remote_in4 = cmd.vxlcmd_sa.in4.sin_addr; + params.vxlp_remote_sa.in4 = cmd.vxlcmd_sa.in4; } else { params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR6; - params.vxlp_remote_in6 = cmd.vxlcmd_sa.in6.sin6_addr; + params.vxlp_remote_sa.in6 = cmd.vxlcmd_sa.in6; } return; } @@ -360,25 +356,23 @@ DECL_CMD_FUNC(setvxlan_group, addr, d) switch (ai->ai_family) { #ifdef INET case AF_INET: { - struct in_addr addr = ((struct sockaddr_in *)sa)->sin_addr; + struct sockaddr_in *sin = (struct sockaddr_in *)sa; - if (!IN_MULTICAST(ntohl(addr.s_addr))) + if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) errx(1, "group address must be multicast"); - cmd.vxlcmd_sa.in4.sin_family = AF_INET; - cmd.vxlcmd_sa.in4.sin_addr = addr; + cmd.vxlcmd_sa.in4 = *sin;
svn commit: r327217 - stable/11/sys/net
Author: bryanv Date: Tue Dec 26 17:12:16 2017 New Revision: 327217 URL: https://svnweb.freebsd.org/changeset/base/327217 Log: MFC r326480: Add if media and link status events to vxlan Modified: stable/11/sys/net/if_vxlan.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_vxlan.c == --- stable/11/sys/net/if_vxlan.cTue Dec 26 16:50:49 2017 (r327216) +++ stable/11/sys/net/if_vxlan.cTue Dec 26 17:12:16 2017 (r327217) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -177,6 +178,7 @@ struct vxlan_softc { uint8_t vxl_hwaddr[ETHER_ADDR_LEN]; int vxl_mc_ifindex; struct ifnet*vxl_mc_ifp; + struct ifmedia vxl_media; char vxl_mc_ifname[IFNAMSIZ]; LIST_ENTRY(vxlan_softc) vxl_entry; LIST_ENTRY(vxlan_softc) vxl_ifdetach_list; @@ -342,6 +344,8 @@ static void vxlan_clone_destroy(struct ifnet *); static uint32_t vxlan_mac_hash(struct vxlan_softc *, const uint8_t *); static voidvxlan_fakeaddr(struct vxlan_softc *); +static int vxlan_media_change(struct ifnet *); +static voidvxlan_media_status(struct ifnet *, struct ifmediareq *); static int vxlan_sockaddr_cmp(const union vxlan_sockaddr *, const struct sockaddr *); @@ -1655,6 +1659,7 @@ vxlan_init(void *xsc) vxlan_timer, sc); VXLAN_WUNLOCK(sc); + if_link_state_change(ifp, LINK_STATE_UP); out: vxlan_init_complete(sc); } @@ -1710,6 +1715,7 @@ vxlan_teardown_locked(struct vxlan_softc *sc) sc->vxl_sock = NULL; VXLAN_WUNLOCK(sc); + if_link_state_change(ifp, LINK_STATE_DOWN); if (vso != NULL) { vxlan_socket_remove_softc(vso, sc); @@ -2219,6 +2225,12 @@ vxlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t dat case SIOCSIFFLAGS: error = vxlan_ioctl_ifflags(sc); break; + + case SIOCSIFMEDIA: + case SIOCGIFMEDIA: + error = ifmedia_ioctl(ifp, ifr, >vxl_media, cmd); + break; + default: error = ether_ioctl(ifp, cmd, data); break; @@ -2685,6 +2697,10 @@ vxlan_clone_create(struct if_clone *ifc, int unit, cad ifp->if_transmit = vxlan_transmit; ifp->if_qflush = vxlan_qflush; + ifmedia_init(>vxl_media, 0, vxlan_media_change, vxlan_media_status); + ifmedia_add(>vxl_media, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_set(>vxl_media, IFM_ETHER | IFM_AUTO); + vxlan_fakeaddr(sc); ether_ifattach(ifp, sc->vxl_hwaddr); @@ -2711,6 +2727,7 @@ vxlan_clone_destroy(struct ifnet *ifp) ether_ifdetach(ifp); if_free(ifp); + ifmedia_removeall(>vxl_media); vxlan_ftable_fini(sc); @@ -2768,6 +2785,22 @@ vxlan_fakeaddr(struct vxlan_softc *sc) arc4rand(sc->vxl_hwaddr, ETHER_ADDR_LEN, 1); sc->vxl_hwaddr[0] &= ~1; sc->vxl_hwaddr[0] |= 2; +} + +static int +vxlan_media_change(struct ifnet *ifp) +{ + + /* Ignore. */ + return (0); +} + +static void +vxlan_media_status(struct ifnet *ifp, struct ifmediareq *ifmr) +{ + + ifmr->ifm_status = IFM_ACTIVE | IFM_AVALID; + ifmr->ifm_active = IFM_ETHER | IFM_FDX; } static int ___ 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: r326751 - stable/11/sys/dev/vmware/vmxnet3
Author: bryanv Date: Sun Dec 10 19:22:43 2017 New Revision: 326751 URL: https://svnweb.freebsd.org/changeset/base/326751 Log: MFC r326744: Correctly report the vmxnet3 link down media status Modified: stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/vmware/vmxnet3/if_vmx.c == --- stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Sun Dec 10 18:55:42 2017 (r326750) +++ stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Sun Dec 10 19:22:43 2017 (r326751) @@ -3485,14 +3485,15 @@ vmxnet3_media_status(struct ifnet *ifp, struct ifmedia sc = ifp->if_softc; - ifmr->ifm_active = IFM_ETHER | IFM_AUTO; ifmr->ifm_status = IFM_AVALID; + ifmr->ifm_active = IFM_ETHER; VMXNET3_CORE_LOCK(sc); - if (vmxnet3_link_is_up(sc) != 0) + if (vmxnet3_link_is_up(sc) != 0) { ifmr->ifm_status |= IFM_ACTIVE; - else - ifmr->ifm_status |= IFM_NONE; + ifmr->ifm_active |= IFM_AUTO; + } else + ifmr->ifm_active |= IFM_NONE; VMXNET3_CORE_UNLOCK(sc); } ___ 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: r326654 - head/sbin/ifconfig
Author: bryanv Date: Thu Dec 7 04:55:31 2017 New Revision: 326654 URL: https://svnweb.freebsd.org/changeset/base/326654 Log: Use consistent name for the vxlan VNI parameter name and provide shorthand Submitted by: hrs MFC after:1 month Differential Revision:https://reviews.freebsd.org/D2868 Modified: head/sbin/ifconfig/ifvxlan.c Modified: head/sbin/ifconfig/ifvxlan.c == --- head/sbin/ifconfig/ifvxlan.cThu Dec 7 03:57:11 2017 (r326653) +++ head/sbin/ifconfig/ifvxlan.cThu Dec 7 04:55:31 2017 (r326654) @@ -594,6 +594,7 @@ setvxlan_flush(const char *val, int d, int s, const st static struct cmd vxlan_cmds[] = { + DEF_CLONE_CMD_ARG("vni",setvxlan_vni), DEF_CLONE_CMD_ARG("vxlanid",setvxlan_vni), DEF_CLONE_CMD_ARG("vxlanlocal", setvxlan_local), DEF_CLONE_CMD_ARG("vxlanremote",setvxlan_remote), @@ -608,7 +609,8 @@ static struct cmd vxlan_cmds[] = { DEF_CLONE_CMD("vxlanlearn", 1, setvxlan_learn), DEF_CLONE_CMD("-vxlanlearn", 0, setvxlan_learn), - DEF_CMD_ARG("vxlanvni", setvxlan_vni), + DEF_CMD_ARG("vni", setvxlan_vni), + DEF_CMD_ARG("vxlanid", setvxlan_vni), DEF_CMD_ARG("vxlanlocal", setvxlan_local), DEF_CMD_ARG("vxlanremote", setvxlan_remote), DEF_CMD_ARG("vxlangroup", setvxlan_group), ___ 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: r326480 - head/sys/net
Author: bryanv Date: Sat Dec 2 22:04:00 2017 New Revision: 326480 URL: https://svnweb.freebsd.org/changeset/base/326480 Log: Add if media and link status events to vxlan PR: 214359 MFC after:2 weeks Modified: head/sys/net/if_vxlan.c Modified: head/sys/net/if_vxlan.c == --- head/sys/net/if_vxlan.c Sat Dec 2 19:42:08 2017(r326479) +++ head/sys/net/if_vxlan.c Sat Dec 2 22:04:00 2017(r326480) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -177,6 +178,7 @@ struct vxlan_softc { uint8_t vxl_hwaddr[ETHER_ADDR_LEN]; int vxl_mc_ifindex; struct ifnet*vxl_mc_ifp; + struct ifmedia vxl_media; char vxl_mc_ifname[IFNAMSIZ]; LIST_ENTRY(vxlan_softc) vxl_entry; LIST_ENTRY(vxlan_softc) vxl_ifdetach_list; @@ -342,6 +344,8 @@ static void vxlan_clone_destroy(struct ifnet *); static uint32_t vxlan_mac_hash(struct vxlan_softc *, const uint8_t *); static voidvxlan_fakeaddr(struct vxlan_softc *); +static int vxlan_media_change(struct ifnet *); +static voidvxlan_media_status(struct ifnet *, struct ifmediareq *); static int vxlan_sockaddr_cmp(const union vxlan_sockaddr *, const struct sockaddr *); @@ -1655,6 +1659,7 @@ vxlan_init(void *xsc) vxlan_timer, sc); VXLAN_WUNLOCK(sc); + if_link_state_change(ifp, LINK_STATE_UP); out: vxlan_init_complete(sc); } @@ -1710,6 +1715,7 @@ vxlan_teardown_locked(struct vxlan_softc *sc) sc->vxl_sock = NULL; VXLAN_WUNLOCK(sc); + if_link_state_change(ifp, LINK_STATE_DOWN); if (vso != NULL) { vxlan_socket_remove_softc(vso, sc); @@ -2219,6 +2225,12 @@ vxlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t dat case SIOCSIFFLAGS: error = vxlan_ioctl_ifflags(sc); break; + + case SIOCSIFMEDIA: + case SIOCGIFMEDIA: + error = ifmedia_ioctl(ifp, ifr, >vxl_media, cmd); + break; + default: error = ether_ioctl(ifp, cmd, data); break; @@ -2685,6 +2697,10 @@ vxlan_clone_create(struct if_clone *ifc, int unit, cad ifp->if_transmit = vxlan_transmit; ifp->if_qflush = vxlan_qflush; + ifmedia_init(>vxl_media, 0, vxlan_media_change, vxlan_media_status); + ifmedia_add(>vxl_media, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_set(>vxl_media, IFM_ETHER | IFM_AUTO); + vxlan_fakeaddr(sc); ether_ifattach(ifp, sc->vxl_hwaddr); @@ -2711,6 +2727,7 @@ vxlan_clone_destroy(struct ifnet *ifp) ether_ifdetach(ifp); if_free(ifp); + ifmedia_removeall(>vxl_media); vxlan_ftable_fini(sc); @@ -2768,6 +2785,22 @@ vxlan_fakeaddr(struct vxlan_softc *sc) arc4rand(sc->vxl_hwaddr, ETHER_ADDR_LEN, 1); sc->vxl_hwaddr[0] &= ~1; sc->vxl_hwaddr[0] |= 2; +} + +static int +vxlan_media_change(struct ifnet *ifp) +{ + + /* Ignore. */ + return (0); +} + +static void +vxlan_media_status(struct ifnet *ifp, struct ifmediareq *ifmr) +{ + + ifmr->ifm_status = IFM_ACTIVE | IFM_AVALID; + ifmr->ifm_active = IFM_ETHER | IFM_FDX; } static int ___ 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: r326309 - head/sys/dev/vmware/vmxnet3
Author: bryanv Date: Tue Nov 28 06:21:37 2017 New Revision: 326309 URL: https://svnweb.freebsd.org/changeset/base/326309 Log: Correctly report the vmxnet3 link down media status Reported by: l...@perftech.com MFC after:1 week Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c == --- head/sys/dev/vmware/vmxnet3/if_vmx.cTue Nov 28 05:39:48 2017 (r326308) +++ head/sys/dev/vmware/vmxnet3/if_vmx.cTue Nov 28 06:21:37 2017 (r326309) @@ -3485,14 +3485,15 @@ vmxnet3_media_status(struct ifnet *ifp, struct ifmedia sc = ifp->if_softc; - ifmr->ifm_active = IFM_ETHER | IFM_AUTO; ifmr->ifm_status = IFM_AVALID; + ifmr->ifm_active = IFM_ETHER; VMXNET3_CORE_LOCK(sc); - if (vmxnet3_link_is_up(sc) != 0) + if (vmxnet3_link_is_up(sc) != 0) { ifmr->ifm_status |= IFM_ACTIVE; - else - ifmr->ifm_status |= IFM_NONE; + ifmr->ifm_active |= IFM_AUTO; + } else + ifmr->ifm_active |= IFM_NONE; VMXNET3_CORE_UNLOCK(sc); } ___ 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: r284365 - in stable/10: sbin/ifconfig share/man/man4 sys/conf sys/modules sys/modules/if_vxlan sys/net sys/sys
MLINKS+=vr.4 if_vr.4 Copied and modified: stable/10/share/man/man4/vxlan.4 (from r273331, head/share/man/man4/vxlan.4) == --- head/share/man/man4/vxlan.4 Mon Oct 20 14:42:42 2014(r273331, copy source) +++ stable/10/share/man/man4/vxlan.4Sun Jun 14 03:14:45 2015 (r284365) @@ -24,7 +24,7 @@ .\ .\ $FreeBSD$ .\ -.Dd October 20, 2014 +.Dd December 16, 2014 .Dt VXLAN 4 .Os .Sh NAME @@ -140,7 +140,7 @@ or VNI. .Pp When configured with the .Xr ifconfig 8 -.Cm learn +.Cm vxlanlearn parameter, the interface dynamically creates forwarding table entries from received packets. An entry in the forwarding table maps the inner source MAC address @@ -153,16 +153,16 @@ Otherwise, when configured in multicast the interface must flood the frame to all hosts in the group. The maximum number of entries in the table is configurable with the .Xr ifconfig 8 -.Cm maxaddr +.Cm vxlanmaxaddr command. Stale entries in the table periodically pruned. The timeout is configurable with the .Xr ifconfig 8 -.Cm timeout +.Cm vxlantimeout command. The table may be viewed with the .Xr sysctl 8 -.Cm net.link.vlxan.N.ftable.dump +.Cm net.link.vxlan.N.ftable.dump command. .Sh MTU Since the @@ -187,13 +187,13 @@ Create a .Nm interface in unicast mode with the -.Cm local +.Cm vxlanlocal tunnel address of 192.168.100.1, and the -.Cm remote +.Cm vxlanremote tunnel address of 192.168.100.2. .Bd -literal -offset indent -ifconfig vxlan create vni 108 local 192.168.100.1 remote 192.168.100.2 +ifconfig vxlan create vxlanid 108 vxlanlocal 192.168.100.1 vxlanremote 192.168.100.2 .Ed .Pp Create a @@ -207,7 +207,7 @@ and the address of 224.0.2.6. The em0 interface will be used to transmit multicast packets. .Bd -literal -offset indent -ifconfig vxlan create vni 42 local 192.168.10.95 group 224.0.2.6 vxlandev em0 +ifconfig vxlan create vxlanid 42 vxlanlocal 192.168.10.95 vxlangroup 224.0.2.6 vxlandev em0 .Ed .Pp Once created, the Modified: stable/10/sys/conf/NOTES == --- stable/10/sys/conf/NOTESSun Jun 14 02:21:19 2015(r284364) +++ stable/10/sys/conf/NOTESSun Jun 14 03:14:45 2015(r284365) @@ -793,6 +793,10 @@ device ether # according to IEEE 802.1Q. device vlan +# The `vxlan' device implements the VXLAN encapsulation of Ethernet +# frames in UDP packets according to RFC7348. +device vxlan + # The `wlan' device provides generic code to support 802.11 # drivers, including host AP mode; it is MANDATORY for the wi, # and ath drivers and will eventually be required by all 802.11 drivers. Modified: stable/10/sys/conf/files == --- stable/10/sys/conf/filesSun Jun 14 02:21:19 2015(r284364) +++ stable/10/sys/conf/filesSun Jun 14 03:14:45 2015(r284365) @@ -3238,6 +3238,7 @@ net/if_stf.c optional stf inet inet6 net/if_tun.c optional tun net/if_tap.c optional tap net/if_vlan.c optional vlan +net/if_vxlan.c optional vxlan inet | vxlan inet6 net/mppcc.coptional netgraph_mppc_compression net/mppcd.coptional netgraph_mppc_compression net/netisr.c standard Modified: stable/10/sys/modules/Makefile == --- stable/10/sys/modules/Makefile Sun Jun 14 02:21:19 2015 (r284364) +++ stable/10/sys/modules/Makefile Sun Jun 14 03:14:45 2015 (r284365) @@ -150,6 +150,7 @@ SUBDIR= \ if_tap \ if_tun \ if_vlan \ + if_vxlan \ ${_igb} \ ${_iir} \ ${_imgact_binmisc} \ Copied and modified: stable/10/sys/net/if_vxlan.c (from r273331, head/sys/net/if_vxlan.c) == --- head/sys/net/if_vxlan.c Mon Oct 20 14:42:42 2014(r273331, copy source) +++ stable/10/sys/net/if_vxlan.cSun Jun 14 03:14:45 2015 (r284365) @@ -716,7 +716,7 @@ vxlan_ftable_entry_init(struct vxlan_sof fe-vxlfe_flags = flags; fe-vxlfe_expire = time_uptime + sc-vxl_ftable_timeout; - memcpy(fe-vxlfe_mac, mac, ETHER_HDR_LEN); + memcpy(fe-vxlfe_mac, mac, ETHER_ADDR_LEN); vxlan_sockaddr_copy(fe-vxlfe_raddr, sa); } Copied: stable/10/sys/net/if_vxlan.h (from r273331, head/sys/net/if_vxlan.h) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/net/if_vxlan.hSun Jun 14 03:14:45 2015 (r284365, copy of r273331, head/sys/net/if_vxlan.h) @@ -0,0 +1,148 @@ +/*- + * Copyright (c) 2014, Bryan Venteicher
svn commit: r284342 - head/sys/dev/virtio/network
Author: bryanv Date: Sat Jun 13 16:13:31 2015 New Revision: 284342 URL: https://svnweb.freebsd.org/changeset/base/284342 Log: Fix typo when deregistering the VLAN unconfig event handler Submitted by: Masao Uebayashi uebay...@tombiinc.com MFC after:3 days 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 Sat Jun 13 15:36:13 2015 (r284341) +++ head/sys/dev/virtio/network/if_vtnet.c Sat Jun 13 16:13:31 2015 (r284342) @@ -443,7 +443,7 @@ vtnet_detach(device_t dev) sc-vtnet_vlan_attach = NULL; } if (sc-vtnet_vlan_detach != NULL) { - EVENTHANDLER_DEREGISTER(vlan_unconfg, sc-vtnet_vlan_detach); + EVENTHANDLER_DEREGISTER(vlan_unconfig, sc-vtnet_vlan_detach); sc-vtnet_vlan_detach = 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: r284344 - stable/10/sys/dev/virtio/block
Author: bryanv Date: Sat Jun 13 17:40:33 2015 New Revision: 284344 URL: https://svnweb.freebsd.org/changeset/base/284344 Log: MFC r277788: Rework vtblk dump handling of in flight requests Previously, the driver resets the device and abandon the requests that are caught in flight when the dump was initiated. This was problematic if the system is resumed after the dump is completed. While that is probably not the typical action, it is simple to rework the driver to very likely have the device usable after the dump without making it more likely for the dump to fail. The in flight requests are simply queued for completion once the dump is finished. Modified: stable/10/sys/dev/virtio/block/virtio_blk.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/virtio/block/virtio_blk.c == --- stable/10/sys/dev/virtio/block/virtio_blk.c Sat Jun 13 16:15:43 2015 (r284343) +++ stable/10/sys/dev/virtio/block/virtio_blk.c Sat Jun 13 17:40:33 2015 (r284344) @@ -76,9 +76,8 @@ struct vtblk_softc { #define VTBLK_FLAG_READONLY0x0002 #define VTBLK_FLAG_DETACH 0x0004 #define VTBLK_FLAG_SUSPEND 0x0008 -#define VTBLK_FLAG_DUMPING 0x0010 -#define VTBLK_FLAG_BARRIER 0x0020 -#define VTBLK_FLAG_WC_CONFIG 0x0040 +#define VTBLK_FLAG_BARRIER 0x0010 +#define VTBLK_FLAG_WC_CONFIG 0x0020 struct virtqueue*vtblk_vq; struct sglist *vtblk_sglist; @@ -95,6 +94,7 @@ struct vtblk_softc { int vtblk_request_count; enum vtblk_cache_modevtblk_write_cache; + struct bio_queue vtblk_dump_queue; struct vtblk_request vtblk_dump_request; }; @@ -162,7 +162,7 @@ static void vtblk_queue_completed(struct struct bio_queue *); static voidvtblk_done_completed(struct vtblk_softc *, struct bio_queue *); -static voidvtblk_drain_vq(struct vtblk_softc *, int); +static voidvtblk_drain_vq(struct vtblk_softc *); static voidvtblk_drain(struct vtblk_softc *); static voidvtblk_startio(struct vtblk_softc *); @@ -177,9 +177,10 @@ static int vtblk_quiesce(struct vtblk_so static voidvtblk_vq_intr(void *); static voidvtblk_stop(struct vtblk_softc *); -static voidvtblk_dump_prepare(struct vtblk_softc *); +static voidvtblk_dump_quiesce(struct vtblk_softc *); static int vtblk_dump_write(struct vtblk_softc *, void *, off_t, size_t); static int vtblk_dump_flush(struct vtblk_softc *); +static voidvtblk_dump_complete(struct vtblk_softc *); static voidvtblk_set_write_cache(struct vtblk_softc *, int); static int vtblk_write_cache_enabled(struct vtblk_softc *sc, @@ -301,6 +302,7 @@ vtblk_attach(device_t dev) sc-vtblk_dev = dev; VTBLK_LOCK_INIT(sc, device_get_nameunit(dev)); bioq_init(sc-vtblk_bioq); + TAILQ_INIT(sc-vtblk_dump_queue); TAILQ_INIT(sc-vtblk_req_free); TAILQ_INIT(sc-vtblk_req_ready); @@ -505,25 +507,19 @@ vtblk_dump(void *arg, void *virtual, vm_ int error; dp = arg; + error = 0; if ((sc = dp-d_drv1) == NULL) return (ENXIO); VTBLK_LOCK(sc); - if ((sc-vtblk_flags VTBLK_FLAG_DUMPING) == 0) { - vtblk_dump_prepare(sc); - sc-vtblk_flags |= VTBLK_FLAG_DUMPING; - } + vtblk_dump_quiesce(sc); if (length 0) error = vtblk_dump_write(sc, virtual, offset, length); - else if (virtual == NULL offset == 0) - error = vtblk_dump_flush(sc); - else { - error = EINVAL; - sc-vtblk_flags = ~VTBLK_FLAG_DUMPING; - } + if (error || (virtual == NULL offset == 0)) + vtblk_dump_complete(sc); VTBLK_UNLOCK(sc); @@ -996,7 +992,7 @@ vtblk_done_completed(struct vtblk_softc } static void -vtblk_drain_vq(struct vtblk_softc *sc, int skip_done) +vtblk_drain_vq(struct vtblk_softc *sc) { struct virtqueue *vq; struct vtblk_request *req; @@ -1006,9 +1002,7 @@ vtblk_drain_vq(struct vtblk_softc *sc, i last = 0; while ((req = virtqueue_drain(vq, last)) != NULL) { - if (!skip_done) - vtblk_bio_done(sc, req-vbr_bp, ENXIO); - + vtblk_bio_done(sc, req-vbr_bp, ENXIO); vtblk_request_enqueue(sc, req); } @@ -1031,7 +1025,7 @@ vtblk_drain(struct vtblk_softc *sc) vtblk_queue_completed(sc, queue); vtblk_done_completed(sc, queue); - vtblk_drain_vq(sc, 0); + vtblk_drain_vq(sc); } while ((req = vtblk_request_next_ready(sc)) != NULL) { @@ -1256,31 +1250,16 @@ vtblk_stop(struct vtblk_softc *sc) } static void -vtblk_dump_prepare(struct vtblk_softc *sc)
svn commit: r284347 - stable/10/sbin/ifconfig
Author: bryanv Date: Sat Jun 13 19:36:32 2015 New Revision: 284347 URL: https://svnweb.freebsd.org/changeset/base/284347 Log: MFC r271603: Add DEF_CLONE_CMD_ARG2 Modified: stable/10/sbin/ifconfig/ifconfig.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/ifconfig/ifconfig.h == --- stable/10/sbin/ifconfig/ifconfig.h Sat Jun 13 19:26:48 2015 (r284346) +++ stable/10/sbin/ifconfig/ifconfig.h Sat Jun 13 19:36:32 2015 (r284347) @@ -74,6 +74,7 @@ void callback_register(callback_func *, #defineDEF_CMD_ARG2(name, func){ name, NEXTARG2, { .c_func2 = func }, 0, NULL } #defineDEF_CLONE_CMD(name, param, func) { name, param, { .c_func = func }, 1, NULL } #defineDEF_CLONE_CMD_ARG(name, func) { name, NEXTARG, { .c_func = func }, 1, NULL } +#defineDEF_CLONE_CMD_ARG2(name, func) { name, NEXTARG2, { .c_func2 = func }, 1, NULL } struct ifaddrs; struct addrinfo; ___ 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: r280154 - head/usr.sbin/bhyve
On Mon, Mar 16, 2015 at 3:13 PM, Alexander Motin m...@freebsd.org wrote: Author: mav Date: Mon Mar 16 20:13:25 2015 New Revision: 280154 URL: https://svnweb.freebsd.org/changeset/base/280154 Log: Report that we may have write cache, and that we do support FLUSH. FreeBSD guest driver does not use that legacy flag, but Linux seems does. The guest driver calls it by a prior name: VIRTIO_BLK_F_WCE. The write cache stuff went through several iterations, and goes away in VirtIO 1.0 specification. MFC after:2 weeks Modified: head/usr.sbin/bhyve/pci_virtio_block.c Modified: head/usr.sbin/bhyve/pci_virtio_block.c == --- head/usr.sbin/bhyve/pci_virtio_block.c Mon Mar 16 20:00:09 2015 (r280153) +++ head/usr.sbin/bhyve/pci_virtio_block.c Mon Mar 16 20:13:25 2015 (r280154) @@ -64,6 +64,7 @@ __FBSDID($FreeBSD$); /* Capability bits */ #defineVTBLK_F_SEG_MAX (1 2)/* Maximum request segments */ #defineVTBLK_F_BLK_SIZE(1 6)/* cfg block size valid */ +#defineVTBLK_F_FLUSH (1 9)/* Cache flush support */ #defineVTBLK_F_TOPOLOGY(1 10) /* Optimal I/O alignment */ /* @@ -72,6 +73,7 @@ __FBSDID($FreeBSD$); #define VTBLK_S_HOSTCAPS \ ( VTBLK_F_SEG_MAX | \ VTBLK_F_BLK_SIZE | \ +VTBLK_F_FLUSH| \ VTBLK_F_TOPOLOGY | \ VIRTIO_RING_F_INDIRECT_DESC ) /* indirect descriptors */ ___ 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: r278473 - in head/sys: amd64/amd64 amd64/include amd64/vmm contrib/dev/acpica/include i386/i386 i386/include x86/acpica x86/include x86/x86 x86/xen
On Wed, Feb 11, 2015 at 9:20 AM, John Baldwin j...@freebsd.org wrote: On Wednesday, February 11, 2015 10:32:00 AM Konstantin Belousov wrote: On Wed, Feb 11, 2015 at 12:43:39AM +, Rui Paulo wrote: On Feb 09, 2015, at 01:01 PM, Konstantin Belousov k...@freebsd.org wrote: Author: kib Date: Mon Feb 9 21:00:56 2015 New Revision: 278473 URL: https://svnweb.freebsd.org/changeset/base/278473 Log: Add x2APIC support. Enable it by default if CPU is capable. The hw.x2apic_enable tunable allows disabling it from the loader prompt. This breaks VMware Fusion when the host CPU has x2APIC support. In my case, mpt(4) was unable to receive interrupts and USB was similarly broken. It's possible that this is a VMware bug, but you might want to avoid turning this on when running under the VMware hypervisor. Neel pointed this out to me when the patch was reviewed. He told me that x2APIC does not work in Fusion 5.x, while it seems to be fixed in 7.x. https://communities.vmware.com/message/2173695?tstart=0 Upon further discussion with Neel and Peter, it was suggested that we enable enable x2APIC unconditionally, which seems what is done for Linux benchmarks. Is vmware 5.x is used while there is already at least version 7.x ? I have no idea about vmware product nomenclature and lifecycle. I believe we can ask vmware what version it is when we notice we are running under it (which we already detect for TSC purposes). We could quirk for that case, or even just disable for VM_GUEST_VMWARE for now. I'm not too familiar with this stuff, but is this Linux commit [1] relevant? If so, it might be something nice to wrap into my projects/paravirt branch (I've been extremely busy recently, but I hope to get the review comments addressed and merge it into HEAD soon). [1] - https://lkml.org/lkml/2013/1/17/552 -- John Baldwin ___ 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: r278184 - in head/sys/x86: include x86
Author: bryanv Date: Wed Feb 4 08:33:04 2015 New Revision: 278184 URL: https://svnweb.freebsd.org/changeset/base/278184 Log: Add interface to derive a TSC frequency from the pvclock This can later use this to determine the TSC frequency like is done with VMware, instead of using a DELAY loop that is not always accurate in an VM. MFC after:1 month Modified: head/sys/x86/include/pvclock.h head/sys/x86/x86/pvclock.c Modified: head/sys/x86/include/pvclock.h == --- head/sys/x86/include/pvclock.h Wed Feb 4 08:26:43 2015 (r278183) +++ head/sys/x86/include/pvclock.h Wed Feb 4 08:33:04 2015 (r278184) @@ -51,6 +51,7 @@ struct pvclock_wall_clock { void pvclock_resume(void); uint64_t pvclock_get_last_cycles(void); +uint64_t pvclock_tsc_freq(struct pvclock_vcpu_time_info *ti); uint64_t pvclock_get_timecount(struct pvclock_vcpu_time_info *ti); void pvclock_get_wallclock(struct pvclock_wall_clock *wc, struct timespec *ts); Modified: head/sys/x86/x86/pvclock.c == --- head/sys/x86/x86/pvclock.c Wed Feb 4 08:26:43 2015(r278183) +++ head/sys/x86/x86/pvclock.c Wed Feb 4 08:33:04 2015(r278184) @@ -58,6 +58,21 @@ pvclock_get_last_cycles(void) return (atomic_load_acq_64(pvclock_last_cycles)); } +uint64_t +pvclock_tsc_freq(struct pvclock_vcpu_time_info *ti) +{ + uint64_t freq; + + freq = (10ULL 32) / ti-tsc_to_system_mul; + + if (ti-tsc_shift 0) + freq = -ti-tsc_shift; + else + freq = ti-tsc_shift; + + return (freq); +} + /* * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction, * yielding a 64-bit result. ___ 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: r278183 - in head/sys: amd64/include conf dev/xen/timer i386/include i386/xen x86/include x86/x86
-get_nsec_offset(struct vcpu_time_info *tinfo) -{ - - return (scale_delta(rdtsc() - tinfo-tsc_timestamp, - tinfo-tsc_to_system_mul, tinfo-tsc_shift)); -} - -/* - * Read the current hypervisor system uptime value from Xen. - * See xen/interface/xen.h for a description of how this works. - */ -static uint32_t -xen_fetch_vcpu_tinfo(struct vcpu_time_info *dst, struct vcpu_time_info *src) -{ - - do { - dst-version = src-version; - rmb(); - dst-tsc_timestamp = src-tsc_timestamp; - dst-system_time = src-system_time; - dst-tsc_to_system_mul = src-tsc_to_system_mul; - dst-tsc_shift = src-tsc_shift; - rmb(); - } while ((src-version 1) | (dst-version ^ src-version)); - - return (dst-version); -} - /** * \brief Get the current time, in nanoseconds, since the hypervisor booted. * * \param vcpu vcpu_info structure to fetch the time from. * - * \note This function returns the current CPU's idea of this value, unless - * it happens to be less than another CPU's previously determined value. */ static uint64_t xen_fetch_vcpu_time(struct vcpu_info *vcpu) { - struct vcpu_time_info dst; - struct vcpu_time_info *src; - uint32_t pre_version; - uint64_t now; - volatile uint64_t last; + struct pvclock_vcpu_time_info *time; - src = vcpu-time; - - do { - pre_version = xen_fetch_vcpu_tinfo(dst, src); - barrier(); - now = dst.system_time + get_nsec_offset(dst); - barrier(); - } while (pre_version != src-version); + time = (struct pvclock_vcpu_time_info *) vcpu-time; - /* -* Enforce a monotonically increasing clock time across all -* VCPUs. If our time is too old, use the last time and return. -* Otherwise, try to update the last time. -*/ - do { - last = xen_timer_last_time; - if (last now) { - now = last; - break; - } - } while (!atomic_cmpset_64(xen_timer_last_time, last, now)); - - return (now); + return (pvclock_get_timecount(time)); } static uint32_t @@ -302,15 +192,11 @@ static void xen_fetch_wallclock(struct timespec *ts) { shared_info_t *src = HYPERVISOR_shared_info; - uint32_t version = 0; + struct pvclock_wall_clock *wc; - do { - version = src-wc_version; - rmb(); - ts-tv_sec = src-wc_sec; - ts-tv_nsec = src-wc_nsec; - rmb(); - } while ((src-wc_version 1) | (version ^ src-wc_version)); + wc = (struct pvclock_wall_clock *) src-wc_version; + + pvclock_get_wallclock(wc, ts); } static void @@ -574,7 +460,7 @@ xentimer_resume(device_t dev) } /* Reset the last uptime value */ - xen_timer_last_time = 0; + pvclock_resume(); /* Reset the RTC clock */ inittodr(time_second); Added: head/sys/i386/include/pvclock.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/i386/include/pvclock.h Wed Feb 4 08:26:43 2015 (r278183) @@ -0,0 +1,6 @@ +/*- + * This file is in the public domain. + */ +/* $FreeBSD$ */ + +#include x86/pvclock.h Modified: head/sys/i386/xen/clock.c == --- head/sys/i386/xen/clock.c Wed Feb 4 06:53:45 2015(r278182) +++ head/sys/i386/xen/clock.c Wed Feb 4 08:26:43 2015(r278183) @@ -69,6 +69,7 @@ __FBSDID($FreeBSD$); #include machine/intr_machdep.h #include machine/md_var.h #include machine/psl.h +#include machine/pvclock.h #if defined(SMP) #include machine/smp.h #endif @@ -127,8 +128,6 @@ u_int timer_freq = TIMER_FREQ; static u_long cyc2ns_scale; static uint64_t processed_system_time; /* stime (ns) at last processing. */ -extern volatile uint64_t xen_timer_last_time; - #define do_div(n,base) ({ \ unsigned long __upper, __low, __high, __mod, __base; \ __base = (base); \ @@ -172,7 +171,7 @@ static inline unsigned long long cycles_ static uint32_t getit(void) { - return (xen_timer_last_time); + return (pvclock_get_last_cycles()); } Added: head/sys/x86/include/pvclock.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/x86/include/pvclock.h Wed Feb 4 08:26:43 2015 (r278183) @@ -0,0 +1,58 @@ +/*- + * Copyright (c) 2014, Bryan Venteicher bry...@freebsd.org + * 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
svn commit: r277789 - in stable/10/sys: netinet netinet6
Author: bryanv Date: Tue Jan 27 06:19:30 2015 New Revision: 277789 URL: https://svnweb.freebsd.org/changeset/base/277789 Log: MFC r272886: Add context pointer and source address to the UDP tunnel callback These are needed for the forthcoming vxlan implementation. The context pointer means we do not have to use a spare pointer field in the inpcb, and the source address is required to populate vxlan's forwarding table. Modified: stable/10/sys/netinet/sctputil.c stable/10/sys/netinet/udp_usrreq.c stable/10/sys/netinet/udp_var.h stable/10/sys/netinet6/udp6_usrreq.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/sctputil.c == --- stable/10/sys/netinet/sctputil.cTue Jan 27 05:34:46 2015 (r277788) +++ stable/10/sys/netinet/sctputil.cTue Jan 27 06:19:30 2015 (r277789) @@ -6832,7 +6832,8 @@ sctp_log_trace(uint32_t subsys, const ch #endif static void -sctp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *ignored) +sctp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *ignored, +const struct sockaddr *sa SCTP_UNUSED, void *ctx SCTP_UNUSED) { struct ip *iph; @@ -6968,7 +6969,7 @@ sctp_over_udp_start(void) } /* Call the special UDP hook. */ if ((ret = udp_set_kernel_tunneling(SCTP_BASE_INFO(udp4_tun_socket), - sctp_recv_udp_tunneled_packet))) { + sctp_recv_udp_tunneled_packet, NULL))) { sctp_over_udp_stop(); return (ret); } @@ -6992,7 +6993,7 @@ sctp_over_udp_start(void) } /* Call the special UDP hook. */ if ((ret = udp_set_kernel_tunneling(SCTP_BASE_INFO(udp6_tun_socket), - sctp_recv_udp_tunneled_packet))) { + sctp_recv_udp_tunneled_packet, NULL))) { sctp_over_udp_stop(); return (ret); } Modified: stable/10/sys/netinet/udp_usrreq.c == --- stable/10/sys/netinet/udp_usrreq.c Tue Jan 27 05:34:46 2015 (r277788) +++ stable/10/sys/netinet/udp_usrreq.c Tue Jan 27 06:19:30 2015 (r277789) @@ -303,7 +303,8 @@ udp_append(struct inpcb *inp, struct ip */ up = intoudpcb(inp); if (up-u_tun_func != NULL) { - (*up-u_tun_func)(n, off, inp); + (*up-u_tun_func)(n, off, inp, (struct sockaddr *)udp_in, + up-u_tun_ctx); return; } @@ -1624,7 +1625,7 @@ udp_attach(struct socket *so, int proto, #endif /* INET */ int -udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f) +udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f, void *ctx) { struct inpcb *inp; struct udpcb *up; @@ -1640,6 +1641,7 @@ udp_set_kernel_tunneling(struct socket * return (EBUSY); } up-u_tun_func = f; + up-u_tun_ctx = ctx; INP_WUNLOCK(inp); return (0); } Modified: stable/10/sys/netinet/udp_var.h == --- stable/10/sys/netinet/udp_var.h Tue Jan 27 05:34:46 2015 (r277788) +++ stable/10/sys/netinet/udp_var.h Tue Jan 27 06:19:30 2015 (r277789) @@ -55,7 +55,8 @@ struct udpiphdr { struct inpcb; struct mbuf; -typedef void(*udp_tun_func_t)(struct mbuf *, int off, struct inpcb *); +typedef void(*udp_tun_func_t)(struct mbuf *, int off, struct inpcb *, + const struct sockaddr *, void *); /* * UDP control block; one per udp. @@ -65,6 +66,7 @@ struct udpcb { u_int u_flags;/* Generic UDP flags. */ uint16_tu_rxcslen; /* Coverage for incoming datagrams. */ uint16_tu_txcslen; /* Coverage for outgoing datagrams. */ + void*u_tun_ctx; /* Tunneling callback context. */ }; #defineintoudpcb(ip) ((struct udpcb *)(ip)-inp_ppcb) @@ -176,7 +178,8 @@ voidudplite_input(struct mbuf *, int); struct inpcb *udp_notify(struct inpcb *inp, int errno); intudp_shutdown(struct socket *so); -intudp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f); +intudp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f, +void *ctx); #endif /* _KERNEL */ Modified: stable/10/sys/netinet6/udp6_usrreq.c == --- stable/10/sys/netinet6/udp6_usrreq.cTue Jan 27 05:34:46 2015 (r277788) +++ stable/10/sys/netinet6/udp6_usrreq.cTue Jan 27 06:19:30 2015 (r277789) @@ -148,7 +148,8 @@ udp6_append(struct inpcb *inp, struct mb */ up = intoudpcb(inp); if (up-u_tun_func != NULL) { -
svn commit: r277790 - stable/10/sys/sys
Author: bryanv Date: Tue Jan 27 06:24:33 2015 New Revision: 277790 URL: https://svnweb.freebsd.org/changeset/base/277790 Log: Bump __FreeBSD_version after r277789: Changes to the UDP tunneling callback Modified: stable/10/sys/sys/param.h Modified: stable/10/sys/sys/param.h == --- stable/10/sys/sys/param.h Tue Jan 27 06:19:30 2015(r277789) +++ stable/10/sys/sys/param.h Tue Jan 27 06:24:33 2015(r277790) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1001506 /* Master, propagated to newvers */ +#define __FreeBSD_version 1001507 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, ___ 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: r277788 - head/sys/dev/virtio/block
Author: bryanv Date: Tue Jan 27 05:34:46 2015 New Revision: 277788 URL: https://svnweb.freebsd.org/changeset/base/277788 Log: Rework vtblk dump handling of in flight requests Previously, the driver resets the device and abandon the requests that are caught in flight when the dump was initiated. This was problematic if the system is resumed after the dump is completed. While that is probably not the typical action, it is simple to rework the driver to very likely have the device usable after the dump without making it more likely for the dump to fail. The in flight requests are simply queued for completion once the dump is finished. Requested by: markj MFC after:1 month Modified: head/sys/dev/virtio/block/virtio_blk.c Modified: head/sys/dev/virtio/block/virtio_blk.c == --- head/sys/dev/virtio/block/virtio_blk.c Tue Jan 27 04:06:47 2015 (r277787) +++ head/sys/dev/virtio/block/virtio_blk.c Tue Jan 27 05:34:46 2015 (r277788) @@ -76,9 +76,8 @@ struct vtblk_softc { #define VTBLK_FLAG_READONLY0x0002 #define VTBLK_FLAG_DETACH 0x0004 #define VTBLK_FLAG_SUSPEND 0x0008 -#define VTBLK_FLAG_DUMPING 0x0010 -#define VTBLK_FLAG_BARRIER 0x0020 -#define VTBLK_FLAG_WC_CONFIG 0x0040 +#define VTBLK_FLAG_BARRIER 0x0010 +#define VTBLK_FLAG_WC_CONFIG 0x0020 struct virtqueue*vtblk_vq; struct sglist *vtblk_sglist; @@ -95,6 +94,7 @@ struct vtblk_softc { int vtblk_request_count; enum vtblk_cache_modevtblk_write_cache; + struct bio_queue vtblk_dump_queue; struct vtblk_request vtblk_dump_request; }; @@ -162,7 +162,7 @@ static void vtblk_queue_completed(struct struct bio_queue *); static voidvtblk_done_completed(struct vtblk_softc *, struct bio_queue *); -static voidvtblk_drain_vq(struct vtblk_softc *, int); +static voidvtblk_drain_vq(struct vtblk_softc *); static voidvtblk_drain(struct vtblk_softc *); static voidvtblk_startio(struct vtblk_softc *); @@ -177,9 +177,10 @@ static int vtblk_quiesce(struct vtblk_so static voidvtblk_vq_intr(void *); static voidvtblk_stop(struct vtblk_softc *); -static voidvtblk_dump_prepare(struct vtblk_softc *); +static voidvtblk_dump_quiesce(struct vtblk_softc *); static int vtblk_dump_write(struct vtblk_softc *, void *, off_t, size_t); static int vtblk_dump_flush(struct vtblk_softc *); +static voidvtblk_dump_complete(struct vtblk_softc *); static voidvtblk_set_write_cache(struct vtblk_softc *, int); static int vtblk_write_cache_enabled(struct vtblk_softc *sc, @@ -302,6 +303,7 @@ vtblk_attach(device_t dev) sc-vtblk_dev = dev; VTBLK_LOCK_INIT(sc, device_get_nameunit(dev)); bioq_init(sc-vtblk_bioq); + TAILQ_INIT(sc-vtblk_dump_queue); TAILQ_INIT(sc-vtblk_req_free); TAILQ_INIT(sc-vtblk_req_ready); @@ -506,25 +508,19 @@ vtblk_dump(void *arg, void *virtual, vm_ int error; dp = arg; + error = 0; if ((sc = dp-d_drv1) == NULL) return (ENXIO); VTBLK_LOCK(sc); - if ((sc-vtblk_flags VTBLK_FLAG_DUMPING) == 0) { - vtblk_dump_prepare(sc); - sc-vtblk_flags |= VTBLK_FLAG_DUMPING; - } + vtblk_dump_quiesce(sc); if (length 0) error = vtblk_dump_write(sc, virtual, offset, length); - else if (virtual == NULL offset == 0) - error = vtblk_dump_flush(sc); - else { - error = EINVAL; - sc-vtblk_flags = ~VTBLK_FLAG_DUMPING; - } + if (error || (virtual == NULL offset == 0)) + vtblk_dump_complete(sc); VTBLK_UNLOCK(sc); @@ -996,7 +992,7 @@ vtblk_done_completed(struct vtblk_softc } static void -vtblk_drain_vq(struct vtblk_softc *sc, int skip_done) +vtblk_drain_vq(struct vtblk_softc *sc) { struct virtqueue *vq; struct vtblk_request *req; @@ -1006,9 +1002,7 @@ vtblk_drain_vq(struct vtblk_softc *sc, i last = 0; while ((req = virtqueue_drain(vq, last)) != NULL) { - if (!skip_done) - vtblk_bio_done(sc, req-vbr_bp, ENXIO); - + vtblk_bio_done(sc, req-vbr_bp, ENXIO); vtblk_request_enqueue(sc, req); } @@ -1031,7 +1025,7 @@ vtblk_drain(struct vtblk_softc *sc) vtblk_queue_completed(sc, queue); vtblk_done_completed(sc, queue); - vtblk_drain_vq(sc, 0); + vtblk_drain_vq(sc); } while ((req = vtblk_request_next_ready(sc)) != NULL) { @@ -1256,31 +1250,16 @@ vtblk_stop(struct vtblk_softc *sc) } static void -vtblk_dump_prepare(struct vtblk_softc *sc) +vtblk_dump_quiesce(struct vtblk_softc *sc) { -
svn commit: r277388 - stable/10/sys/dev/virtio/network
Author: bryanv Date: Mon Jan 19 17:00:53 2015 New Revision: 277388 URL: https://svnweb.freebsd.org/changeset/base/277388 Log: MFC r276489: Use the appropriate IPv4 or IPv6 TSO HW assist flag Modified: stable/10/sys/dev/virtio/network/if_vtnet.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/virtio/network/if_vtnet.c == --- stable/10/sys/dev/virtio/network/if_vtnet.c Mon Jan 19 16:33:58 2015 (r277387) +++ stable/10/sys/dev/virtio/network/if_vtnet.c Mon Jan 19 17:00:53 2015 (r277388) @@ -3016,9 +3016,9 @@ vtnet_reinit(struct vtnet_softc *sc) if (ifp-if_capenable IFCAP_TXCSUM_IPV6) ifp-if_hwassist |= VTNET_CSUM_OFFLOAD_IPV6; if (ifp-if_capenable IFCAP_TSO4) - ifp-if_hwassist |= CSUM_TSO; + ifp-if_hwassist |= CSUM_IP_TSO; if (ifp-if_capenable IFCAP_TSO6) - ifp-if_hwassist |= CSUM_TSO; /* No CSUM_TSO_IPV6. */ + ifp-if_hwassist |= CSUM_IP6_TSO; if (sc-vtnet_flags VTNET_FLAG_CTRL_VQ) vtnet_init_rx_filters(sc); ___ 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: r277389 - stable/10/sys/dev/virtio/network
Author: bryanv Date: Mon Jan 19 17:02:30 2015 New Revision: 277389 URL: https://svnweb.freebsd.org/changeset/base/277389 Log: MFC r276491: Add softc flag for when the indirect descriptor feature was negotiated Modified: stable/10/sys/dev/virtio/network/if_vtnet.c stable/10/sys/dev/virtio/network/if_vtnetvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/virtio/network/if_vtnet.c == --- stable/10/sys/dev/virtio/network/if_vtnet.c Mon Jan 19 17:00:53 2015 (r277388) +++ stable/10/sys/dev/virtio/network/if_vtnet.c Mon Jan 19 17:02:30 2015 (r277389) @@ -597,6 +597,8 @@ vtnet_setup_features(struct vtnet_softc vtnet_negotiate_features(sc); + if (virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC)) + sc-vtnet_flags |= VTNET_FLAG_INDIRECT; if (virtio_with_feature(dev, VIRTIO_RING_F_EVENT_IDX)) sc-vtnet_flags |= VTNET_FLAG_EVENT_IDX; @@ -3663,7 +3665,7 @@ vtnet_set_tx_intr_threshold(struct vtnet * Without indirect descriptors, leave enough room for the most * segments we handle. */ - if (virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC) == 0 + if ((sc-vtnet_flags VTNET_FLAG_INDIRECT) == 0 thresh sc-vtnet_tx_nsegs) thresh = sc-vtnet_tx_nsegs; Modified: stable/10/sys/dev/virtio/network/if_vtnetvar.h == --- stable/10/sys/dev/virtio/network/if_vtnetvar.h Mon Jan 19 17:00:53 2015(r277388) +++ stable/10/sys/dev/virtio/network/if_vtnetvar.h Mon Jan 19 17:02:30 2015(r277389) @@ -140,7 +140,8 @@ struct vtnet_softc { #define VTNET_FLAG_MRG_RXBUFS 0x0080 #define VTNET_FLAG_LRO_NOMRG0x0100 #define VTNET_FLAG_MULTIQ 0x0200 -#define VTNET_FLAG_EVENT_IDX0x0400 +#define VTNET_FLAG_INDIRECT 0x0400 +#define VTNET_FLAG_EVENT_IDX0x0800 int vtnet_link_active; int vtnet_hdr_size; ___ 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: r272886 - in head/sys: netinet netinet6
On Mon, Jan 12, 2015 at 5:20 PM, Michael Tuexen tue...@fh-muenster.de wrote: On 12 Jan 2015, at 18:42, Bjoern A. Zeeb b...@freebsd.org wrote: On 12 Jan 2015, at 15:51 , John Baldwin j...@baldwin.cx wrote: On Tuesday, January 06, 2015 07:07:11 PM Bryan Venteicher wrote: On Tue, Jan 6, 2015 at 5:27 PM, Bryan Drewery bdrew...@freebsd.org wrote: On 1/6/2015 4:00 PM, Bryan Venteicher wrote: On Tue, Jan 6, 2015 at 2:52 PM, John Nielsen li...@jnielsen.net mailto:li...@jnielsen.net wrote: Bryan- On Oct 10, 2014, at 12:09 AM, Bryan Venteicher bry...@freebsd.org mailto:bry...@freebsd.org wrote: Author: bryanv Date: Fri Oct 10 06:08:59 2014 New Revision: 272886 URL: https://svnweb.freebsd.org/changeset/base/272886 Log: Add context pointer and source address to the UDP tunnel callback These are needed for the forthcoming vxlan implementation. The context pointer means we do not have to use a spare pointer field in the inpcb, and the source address is required to populate vxlan's forwarding table. While I highly doubt there is an out of tree consumer of the UDP tunneling callback, this change may be a difficult to eventually MFC. I noticed this comment while doing an MFC of vxlan to my local tree. Do you think an MFC to 10-STABLE of this change (and vxlan generally) will be feasible? Is there precedent for ABI changes like this being sanctioned? Could symbol versioning help? I'd like to get some consensus on whether this commit is OK to MFC. With this commit, vxlan should be an easy to MFC. Breaking ABI will potentially hurt packages. FreeBSD builds packages for the oldest supported release on a branch. If you break ABI in 10.2 while we are building packages for 10.1 then any packages using these interfaces may not work right or result in panics packages with kmods. Please consider that. The only user visible change of this commit would be the addition of a field at the end of 'struct udpcb'. I don't think that is a problem, at least a similar change didn't prevent the MFC of UDP Lite. The kernel part of this changes the UDP tunneling functions which I guess there could be a 3rd party module out there, but I very highly doubt that, based on how un-useful the previous interface was. Userland should not be impacted by this at all. (Nothing in userland cares about udpcb's internals.) I think there was only ever one consumer for the existing UDP tunneling code (bz@ knows what it is). I'm not sure where it lives. If you are talking about u_tun_func then it came from SCTP over UDP tunneling. tuexen and rrs are your friends. rrs implemented it to support SCTP over UDP over IPv[46]. To be more precisely, to receive such packets. So I am just being overly cautious and this change is fine to MFC? Best regards Michael I was wondering if it could be used similarly for IPsec UDPencap but I think that went nowhere back then. — Bjoern A. Zeeb Charles Haddon Spurgeon: Friendship is one of the sweetest joys of life. Many might have failed beneath the bitterness of their trial had they not found a friend. ___ 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: r272886 - in head/sys: netinet netinet6
On Mon, Jan 12, 2015 at 9:51 AM, John Baldwin j...@baldwin.cx wrote: On Tuesday, January 06, 2015 07:07:11 PM Bryan Venteicher wrote: On Tue, Jan 6, 2015 at 5:27 PM, Bryan Drewery bdrew...@freebsd.org wrote: On 1/6/2015 4:00 PM, Bryan Venteicher wrote: On Tue, Jan 6, 2015 at 2:52 PM, John Nielsen li...@jnielsen.net mailto:li...@jnielsen.net wrote: Bryan- On Oct 10, 2014, at 12:09 AM, Bryan Venteicher bry...@freebsd.org mailto:bry...@freebsd.org wrote: Author: bryanv Date: Fri Oct 10 06:08:59 2014 New Revision: 272886 URL: https://svnweb.freebsd.org/changeset/base/272886 Log: Add context pointer and source address to the UDP tunnel callback These are needed for the forthcoming vxlan implementation. The context pointer means we do not have to use a spare pointer field in the inpcb, and the source address is required to populate vxlan's forwarding table. While I highly doubt there is an out of tree consumer of the UDP tunneling callback, this change may be a difficult to eventually MFC. I noticed this comment while doing an MFC of vxlan to my local tree. Do you think an MFC to 10-STABLE of this change (and vxlan generally) will be feasible? Is there precedent for ABI changes like this being sanctioned? Could symbol versioning help? I'd like to get some consensus on whether this commit is OK to MFC. With this commit, vxlan should be an easy to MFC. Breaking ABI will potentially hurt packages. FreeBSD builds packages for the oldest supported release on a branch. If you break ABI in 10.2 while we are building packages for 10.1 then any packages using these interfaces may not work right or result in panics packages with kmods. Please consider that. The only user visible change of this commit would be the addition of a field at the end of 'struct udpcb'. I don't think that is a problem, at least a similar change didn't prevent the MFC of UDP Lite. The kernel part of this changes the UDP tunneling functions which I guess there could be a 3rd party module out there, but I very highly doubt that, based on how un-useful the previous interface was. Userland should not be impacted by this at all. (Nothing in userland cares about udpcb's internals.) I think there was only ever one consumer for the existing UDP tunneling code (bz@ knows what it is). I'm not sure where it lives. The only in tree consumer is SCTP. -- John Baldwin ___ 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: r272886 - in head/sys: netinet netinet6
On Tue, Jan 6, 2015 at 2:52 PM, John Nielsen li...@jnielsen.net wrote: Bryan- On Oct 10, 2014, at 12:09 AM, Bryan Venteicher bry...@freebsd.org wrote: Author: bryanv Date: Fri Oct 10 06:08:59 2014 New Revision: 272886 URL: https://svnweb.freebsd.org/changeset/base/272886 Log: Add context pointer and source address to the UDP tunnel callback These are needed for the forthcoming vxlan implementation. The context pointer means we do not have to use a spare pointer field in the inpcb, and the source address is required to populate vxlan's forwarding table. While I highly doubt there is an out of tree consumer of the UDP tunneling callback, this change may be a difficult to eventually MFC. I noticed this comment while doing an MFC of vxlan to my local tree. Do you think an MFC to 10-STABLE of this change (and vxlan generally) will be feasible? Is there precedent for ABI changes like this being sanctioned? Could symbol versioning help? I'd like to get some consensus on whether this commit is OK to MFC. With this commit, vxlan should be an easy to MFC. Phabricator: https://reviews.freebsd.org/D383 Reviewed by: gnn Modified: head/sys/netinet/sctputil.c head/sys/netinet/udp_usrreq.c head/sys/netinet/udp_var.h head/sys/netinet6/udp6_usrreq.c Thanks, JN ___ 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: r272886 - in head/sys: netinet netinet6
On Tue, Jan 6, 2015 at 5:27 PM, Bryan Drewery bdrew...@freebsd.org wrote: On 1/6/2015 4:00 PM, Bryan Venteicher wrote: On Tue, Jan 6, 2015 at 2:52 PM, John Nielsen li...@jnielsen.net mailto:li...@jnielsen.net wrote: Bryan- On Oct 10, 2014, at 12:09 AM, Bryan Venteicher bry...@freebsd.org mailto:bry...@freebsd.org wrote: Author: bryanv Date: Fri Oct 10 06:08:59 2014 New Revision: 272886 URL: https://svnweb.freebsd.org/changeset/base/272886 Log: Add context pointer and source address to the UDP tunnel callback These are needed for the forthcoming vxlan implementation. The context pointer means we do not have to use a spare pointer field in the inpcb, and the source address is required to populate vxlan's forwarding table. While I highly doubt there is an out of tree consumer of the UDP tunneling callback, this change may be a difficult to eventually MFC. I noticed this comment while doing an MFC of vxlan to my local tree. Do you think an MFC to 10-STABLE of this change (and vxlan generally) will be feasible? Is there precedent for ABI changes like this being sanctioned? Could symbol versioning help? I'd like to get some consensus on whether this commit is OK to MFC. With this commit, vxlan should be an easy to MFC. Breaking ABI will potentially hurt packages. FreeBSD builds packages for the oldest supported release on a branch. If you break ABI in 10.2 while we are building packages for 10.1 then any packages using these interfaces may not work right or result in panics packages with kmods. Please consider that. The only user visible change of this commit would be the addition of a field at the end of 'struct udpcb'. I don't think that is a problem, at least a similar change didn't prevent the MFC of UDP Lite. The kernel part of this changes the UDP tunneling functions which I guess there could be a 3rd party module out there, but I very highly doubt that, based on how un-useful the previous interface was. Phabricator: https://reviews.freebsd.org/D383 Reviewed by: gnn Modified: head/sys/netinet/sctputil.c head/sys/netinet/udp_usrreq.c head/sys/netinet/udp_var.h head/sys/netinet6/udp6_usrreq.c Thanks, JN -- Regards, Bryan Drewery ___ 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: r276487 - stable/10/sys/dev/virtio/block
Author: bryanv Date: Thu Jan 1 01:43:00 2015 New Revision: 276487 URL: https://svnweb.freebsd.org/changeset/base/276487 Log: MFC r275335: Cleanup and performance improvement of the virtio_blk driver - Add support for GEOM direct completion. Depending on the benchmark, this tends to give a ~30% improvement w.r.t IOPs and BW. - Remove an invariants check in the strategy routine. This assertion is caught later on by an existing panic. - Rename and resort various related functions to make more sense. Modified: stable/10/sys/dev/virtio/block/virtio_blk.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/virtio/block/virtio_blk.c == --- stable/10/sys/dev/virtio/block/virtio_blk.c Wed Dec 31 23:25:37 2014 (r276486) +++ stable/10/sys/dev/virtio/block/virtio_blk.c Thu Jan 1 01:43:00 2015 (r276487) @@ -58,7 +58,6 @@ struct vtblk_request { struct virtio_blk_outhdr vbr_hdr; struct bio *vbr_bp; uint8_t vbr_ack; - TAILQ_ENTRY(vtblk_request) vbr_link; }; @@ -132,53 +131,60 @@ static intvtblk_dump(void *, void *, vm static voidvtblk_strategy(struct bio *); static voidvtblk_negotiate_features(struct vtblk_softc *); +static voidvtblk_setup_features(struct vtblk_softc *); static int vtblk_maximum_segments(struct vtblk_softc *, struct virtio_blk_config *); static int vtblk_alloc_virtqueue(struct vtblk_softc *); static voidvtblk_resize_disk(struct vtblk_softc *, uint64_t); -static voidvtblk_set_write_cache(struct vtblk_softc *, int); -static int vtblk_write_cache_enabled(struct vtblk_softc *sc, - struct virtio_blk_config *); -static int vtblk_write_cache_sysctl(SYSCTL_HANDLER_ARGS); static voidvtblk_alloc_disk(struct vtblk_softc *, struct virtio_blk_config *); static voidvtblk_create_disk(struct vtblk_softc *); -static int vtblk_quiesce(struct vtblk_softc *); -static voidvtblk_startio(struct vtblk_softc *); -static struct vtblk_request * vtblk_bio_request(struct vtblk_softc *); -static int vtblk_execute_request(struct vtblk_softc *, +static int vtblk_request_prealloc(struct vtblk_softc *); +static voidvtblk_request_free(struct vtblk_softc *); +static struct vtblk_request * + vtblk_request_dequeue(struct vtblk_softc *); +static voidvtblk_request_enqueue(struct vtblk_softc *, struct vtblk_request *); +static struct vtblk_request * + vtblk_request_next_ready(struct vtblk_softc *); +static voidvtblk_request_requeue_ready(struct vtblk_softc *, + struct vtblk_request *); +static struct vtblk_request * + vtblk_request_next(struct vtblk_softc *); +static struct vtblk_request * + vtblk_request_bio(struct vtblk_softc *); +static int vtblk_request_execute(struct vtblk_softc *, + struct vtblk_request *); +static int vtblk_request_error(struct vtblk_request *); -static voidvtblk_vq_intr(void *); +static voidvtblk_queue_completed(struct vtblk_softc *, + struct bio_queue *); +static voidvtblk_done_completed(struct vtblk_softc *, + struct bio_queue *); +static voidvtblk_drain_vq(struct vtblk_softc *, int); +static voidvtblk_drain(struct vtblk_softc *); -static voidvtblk_stop(struct vtblk_softc *); +static voidvtblk_startio(struct vtblk_softc *); +static voidvtblk_bio_done(struct vtblk_softc *, struct bio *, int); static voidvtblk_read_config(struct vtblk_softc *, struct virtio_blk_config *); -static voidvtblk_get_ident(struct vtblk_softc *); -static voidvtblk_prepare_dump(struct vtblk_softc *); -static int vtblk_write_dump(struct vtblk_softc *, void *, off_t, size_t); -static int vtblk_flush_dump(struct vtblk_softc *); +static voidvtblk_ident(struct vtblk_softc *); static int vtblk_poll_request(struct vtblk_softc *, struct vtblk_request *); +static int vtblk_quiesce(struct vtblk_softc *); +static voidvtblk_vq_intr(void *); +static voidvtblk_stop(struct vtblk_softc *); -static voidvtblk_finish_completed(struct vtblk_softc *); -static voidvtblk_drain_vq(struct vtblk_softc *, int); -static voidvtblk_drain(struct vtblk_softc *); - -static int vtblk_alloc_requests(struct vtblk_softc *); -static voidvtblk_free_requests(struct vtblk_softc *); -static struct vtblk_request * vtblk_dequeue_request(struct vtblk_softc *); -static voidvtblk_enqueue_request(struct vtblk_softc *, - struct vtblk_request *); - -static struct vtblk_request * vtblk_dequeue_ready(struct vtblk_softc *); -static voidvtblk_enqueue_ready(struct
svn commit: r276489 - head/sys/dev/virtio/network
Author: bryanv Date: Thu Jan 1 02:03:09 2015 New Revision: 276489 URL: https://svnweb.freebsd.org/changeset/base/276489 Log: Use the appropriate IPv4 or IPv6 TSO HW assist flag MFC after:2 weeks 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 Thu Jan 1 02:00:04 2015 (r276488) +++ head/sys/dev/virtio/network/if_vtnet.c Thu Jan 1 02:03:09 2015 (r276489) @@ -3006,9 +3006,9 @@ vtnet_reinit(struct vtnet_softc *sc) if (ifp-if_capenable IFCAP_TXCSUM_IPV6) ifp-if_hwassist |= VTNET_CSUM_OFFLOAD_IPV6; if (ifp-if_capenable IFCAP_TSO4) - ifp-if_hwassist |= CSUM_TSO; + ifp-if_hwassist |= CSUM_IP_TSO; if (ifp-if_capenable IFCAP_TSO6) - ifp-if_hwassist |= CSUM_TSO; /* No CSUM_TSO_IPV6. */ + ifp-if_hwassist |= CSUM_IP6_TSO; if (sc-vtnet_flags VTNET_FLAG_CTRL_VQ) vtnet_init_rx_filters(sc); ___ 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: r276491 - head/sys/dev/virtio/network
Author: bryanv Date: Thu Jan 1 02:06:00 2015 New Revision: 276491 URL: https://svnweb.freebsd.org/changeset/base/276491 Log: Add softc flag for when the indirect descriptor feature was negotiated MFC after:2 weeks Modified: head/sys/dev/virtio/network/if_vtnet.c head/sys/dev/virtio/network/if_vtnetvar.h Modified: head/sys/dev/virtio/network/if_vtnet.c == --- head/sys/dev/virtio/network/if_vtnet.c Thu Jan 1 02:04:44 2015 (r276490) +++ head/sys/dev/virtio/network/if_vtnet.c Thu Jan 1 02:06:00 2015 (r276491) @@ -599,6 +599,8 @@ vtnet_setup_features(struct vtnet_softc vtnet_negotiate_features(sc); + if (virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC)) + sc-vtnet_flags |= VTNET_FLAG_INDIRECT; if (virtio_with_feature(dev, VIRTIO_RING_F_EVENT_IDX)) sc-vtnet_flags |= VTNET_FLAG_EVENT_IDX; @@ -3653,7 +3655,7 @@ vtnet_set_tx_intr_threshold(struct vtnet * Without indirect descriptors, leave enough room for the most * segments we handle. */ - if (virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC) == 0 + if ((sc-vtnet_flags VTNET_FLAG_INDIRECT) == 0 thresh sc-vtnet_tx_nsegs) thresh = sc-vtnet_tx_nsegs; Modified: head/sys/dev/virtio/network/if_vtnetvar.h == --- head/sys/dev/virtio/network/if_vtnetvar.h Thu Jan 1 02:04:44 2015 (r276490) +++ head/sys/dev/virtio/network/if_vtnetvar.h Thu Jan 1 02:06:00 2015 (r276491) @@ -140,7 +140,8 @@ struct vtnet_softc { #define VTNET_FLAG_MRG_RXBUFS 0x0080 #define VTNET_FLAG_LRO_NOMRG0x0100 #define VTNET_FLAG_MULTIQ 0x0200 -#define VTNET_FLAG_EVENT_IDX0x0400 +#define VTNET_FLAG_INDIRECT 0x0400 +#define VTNET_FLAG_EVENT_IDX0x0800 int vtnet_link_active; int vtnet_hdr_size; ___ 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: r276354 - in head/sys/dev/beri/virtio: . network
Author: bryanv Date: Mon Dec 29 00:35:44 2014 New Revision: 276354 URL: https://svnweb.freebsd.org/changeset/base/276354 Log: Remove dev/virtio/virtio.h include from BERI VirtIO This header file contains prototypes and defines that only make sense to the guest VirtIO device drivers. Reviewed by: br Modified: head/sys/dev/beri/virtio/network/if_vtbe.c head/sys/dev/beri/virtio/virtio.c head/sys/dev/beri/virtio/virtio_block.c Modified: head/sys/dev/beri/virtio/network/if_vtbe.c == --- head/sys/dev/beri/virtio/network/if_vtbe.c Mon Dec 29 00:30:38 2014 (r276353) +++ head/sys/dev/beri/virtio/network/if_vtbe.c Mon Dec 29 00:35:44 2014 (r276354) @@ -82,7 +82,8 @@ __FBSDID($FreeBSD$); #include dev/virtio/mmio/virtio_mmio.h #include dev/virtio/network/virtio_net.h -#include dev/virtio/virtio.h +#include dev/virtio/virtio_ids.h +#include dev/virtio/virtio_config.h #include dev/virtio/virtio_ring.h #include pio_if.h Modified: head/sys/dev/beri/virtio/virtio.c == --- head/sys/dev/beri/virtio/virtio.c Mon Dec 29 00:30:38 2014 (r276353) +++ head/sys/dev/beri/virtio/virtio.c Mon Dec 29 00:35:44 2014 (r276354) @@ -65,7 +65,6 @@ __FBSDID($FreeBSD$); #include dev/ofw/ofw_bus_subr.h #include dev/beri/virtio/virtio.h -#include dev/virtio/virtio.h #include dev/virtio/virtqueue.h #include dev/virtio/virtio_ring.h #include dev/altera/pio/pio.h Modified: head/sys/dev/beri/virtio/virtio_block.c == --- head/sys/dev/beri/virtio/virtio_block.c Mon Dec 29 00:30:38 2014 (r276353) +++ head/sys/dev/beri/virtio/virtio_block.c Mon Dec 29 00:35:44 2014 (r276354) @@ -67,7 +67,8 @@ __FBSDID($FreeBSD$); #include dev/altera/pio/pio.h #include dev/virtio/mmio/virtio_mmio.h #include dev/virtio/block/virtio_blk.h -#include dev/virtio/virtio.h +#include dev/virtio/virtio_ids.h +#include dev/virtio/virtio_config.h #include dev/virtio/virtio_ring.h #include pio_if.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: r275851 - in head: sbin/ifconfig share/man/man4
Author: bryanv Date: Wed Dec 17 05:36:34 2014 New Revision: 275851 URL: https://svnweb.freebsd.org/changeset/base/275851 Log: Prefix all the vxlan ifconfig commands so they are unique And rehook ifvxlan back into the build. Modified: head/sbin/ifconfig/Makefile head/sbin/ifconfig/ifconfig.8 head/sbin/ifconfig/ifvxlan.c head/share/man/man4/vxlan.4 Modified: head/sbin/ifconfig/Makefile == --- head/sbin/ifconfig/Makefile Wed Dec 17 03:04:43 2014(r275850) +++ head/sbin/ifconfig/Makefile Wed Dec 17 05:36:34 2014(r275851) @@ -30,7 +30,7 @@ SRCS+=ifmac.c # MAC support SRCS+= ifmedia.c # SIOC[GS]IFMEDIA support SRCS+= iffib.c # non-default FIB support SRCS+= ifvlan.c# SIOC[GS]ETVLAN support -#SRCS+=ifvxlan.c # VXLAN support +SRCS+= ifvxlan.c # VXLAN support SRCS+= ifgre.c # GRE keys etc SRCS+= ifgif.c # GIF reversed header workaround Modified: head/sbin/ifconfig/ifconfig.8 == --- head/sbin/ifconfig/ifconfig.8 Wed Dec 17 03:04:43 2014 (r275850) +++ head/sbin/ifconfig/ifconfig.8 Wed Dec 17 05:36:34 2014 (r275851) @@ -28,7 +28,7 @@ .\ From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\ $FreeBSD$ .\ -.Dd October 20, 2014 +.Dd December 16, 2014 .Dt IFCONFIG 8 .Os .Sh NAME @@ -2544,33 +2544,33 @@ The following parameters are used to con .Xr vxlan 4 interfaces. .Bl -tag -width indent -.It Cm vni Ar identifier +.It Cm vxlanid Ar identifier This value is a 24-bit VXLAN Network Identifier (VNI) that identifies the virtual network segment membership of the interface. -.It Cm local Ar address +.It Cm vxlanlocal Ar address The source address used in the encapsulating IPv4/IPv6 header. The address should already be assigned to an existing interface. When the interface is configured in unicast mode, the listening socket is bound to this address. -.It Cm remote Ar address +.It Cm vxlanremote Ar address The interface can be configured in a unicast, or point-to-point, mode to create a tunnel between two hosts. This is the IP address of the remote end of the tunnel. -.It Cm group Ar address +.It Cm vxlangroup Ar address The interface can be configured in a multicast mode to create a virtual network of hosts. This is the IP multicast group address the interface will join. -.It Cm localport Ar port +.It Cm vxlanlocalport Ar port The port number the interface will listen on. The default port number is 4789. -.It Cm remoteport Ar port +.It Cm vxlanremoteport Ar port The destination port number used in the encapsulating IPv4/IPv6 header. The remote host should be listening on this port. The default port number is 4789. Note some other implementations, such as Linux, do not default to the IANA assigned port, but instead listen on port 8472. -.It Cm portrange Ar low high +.It Cm vxlanportrange Ar low high The range of source ports used in the encapsulating IPv4/IPv6 header. The port selected within the range is based on a hash of the inner frame. A range is useful to provide entropy within the outer IP header @@ -2581,32 +2581,32 @@ variables .Va net.inet.ip.portrange.first and .Va net.inet.ip.portrange.last -.It Cm timeout Ar timeout +.It Cm vxlantimeout Ar timeout The maximum time, in seconds, before an entry in the forwarding table is pruned. The default is 1200 seconds (20 minutes). -.It Cm maxaddr Ar max +.It Cm vxlanmaxaddr Ar max The maximum number of entries in the forwarding table. The default is 2000. .It Cm vxlandev Ar dev When the interface is configured in multicast mode, the .Cm dev interface is used to transmit IP multicast packets. -.It Cm ttl Ar ttl +.It Cm vxlanttl Ar ttl The TTL used in the encapsulating IPv4/IPv6 header. The default is 64. -.It Cm learn +.It Cm vxlanlearn The source IP address and inner source Ethernet MAC address of received packets are used to dynamically populate the forwarding table. When in multicast mode, an entry in the forwarding table allows the interface to send the frame directly to the remote host instead of broadcasting the frame to the multicast group. This is the default. -.It Fl learn +.It Fl vxlanlearn The forwarding table is not populated by recevied packets. -.It Cm flush +.It Cm vxlanflush Delete all dynamically-learned addresses from the forwarding table. -.It Cm flushall +.It Cm vxlanflushall Delete all addresses, including static addresses, from the forwarding table. .El .Pp Modified: head/sbin/ifconfig/ifvxlan.c == --- head/sbin/ifconfig/ifvxlan.cWed Dec 17 03:04:43 2014 (r275850) +++ head/sbin/ifconfig/ifvxlan.cWed Dec 17 05:36:34 2014 (r275851) @@ -595,36
svn commit: r275630 - stable/10/sbin/camcontrol
Author: bryanv Date: Tue Dec 9 07:03:49 2014 New Revision: 275630 URL: https://svnweb.freebsd.org/changeset/base/275630 Log: MFC r274322: Attempt to report a better error if sanitize is not supported Modified: stable/10/sbin/camcontrol/camcontrol.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/camcontrol/camcontrol.c == --- stable/10/sbin/camcontrol/camcontrol.c Tue Dec 9 06:40:38 2014 (r275629) +++ stable/10/sbin/camcontrol/camcontrol.c Tue Dec 9 07:03:49 2014 (r275630) @@ -5827,15 +5827,31 @@ scsisanitize(struct cam_device *device, if (arglist CAM_ARG_ERR_RECOVER) ccb-ccb_h.flags |= CAM_PASS_ERR_RECOVER; - if (((retval = cam_send_ccb(device, ccb)) 0) -|| ((immediate == 0) - ((ccb-ccb_h.status CAM_STATUS_MASK) != CAM_REQ_CMP))) { - const char errstr[] = error sending sanitize command; + if (cam_send_ccb(device, ccb) 0) { + warn(error sending sanitize command); + error = 1; + goto scsisanitize_bailout; + } - if (retval 0) - warn(errstr); - else - warnx(errstr); + if ((ccb-ccb_h.status CAM_STATUS_MASK) != CAM_REQ_CMP) { + struct scsi_sense_data *sense; + int error_code, sense_key, asc, ascq; + + if ((ccb-ccb_h.status CAM_STATUS_MASK) == + CAM_SCSI_STATUS_ERROR) { + sense = ccb-csio.sense_data; + scsi_extract_sense_len(sense, ccb-csio.sense_len - + ccb-csio.sense_resid, error_code, sense_key, + asc, ascq, /*show_errors*/ 1); + + if (sense_key == SSD_KEY_ILLEGAL_REQUEST + asc == 0x20 ascq == 0x00) + warnx(sanitize is not supported by + this device); + else + warnx(error sanitizing this device); + } else + warnx(error sanitizing this device); if (arglist CAM_ARG_VERBOSE) { cam_error_print(device, ccb, CAM_ESF_ALL, ___ 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: r273331 - in head: sbin/ifconfig share/man/man4 sys/conf sys/modules sys/modules/if_vxlan sys/net sys/sys
On Mon, Dec 1, 2014 at 6:57 AM, Dag-Erling Smørgrav d...@des.no wrote: Bryan Venteicher bry...@freebsd.org writes: Log: Add vxlan interface [...] This breaks the existing group command, which means I now have machines that won't boot without manual intervention because their firewall rulesets rely on interface groups. Did you even bother to search for group in the code, or even in the man page, before deciding to add a command by that name? This stems from my misunderstanding that these commands were scoped. I'll work on fix shortly. DES -- Dag-Erling Smørgrav - d...@des.no ___ 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: r275335 - head/sys/dev/virtio/block
Author: bryanv Date: Sun Nov 30 16:36:26 2014 New Revision: 275335 URL: https://svnweb.freebsd.org/changeset/base/275335 Log: Cleanup and performance improvement of the virtio_blk driver - Add support for GEOM direct completion. Depending on the benchmark, this tends to give a ~30% improvement w.r.t IOPs and BW. - Remove an invariants check in the strategy routine. This assertion is caught later on by an existing panic. - Rename and resort various related functions to make more sense. MFC after:1 month Modified: head/sys/dev/virtio/block/virtio_blk.c Modified: head/sys/dev/virtio/block/virtio_blk.c == --- head/sys/dev/virtio/block/virtio_blk.c Sun Nov 30 14:35:01 2014 (r275334) +++ head/sys/dev/virtio/block/virtio_blk.c Sun Nov 30 16:36:26 2014 (r275335) @@ -58,7 +58,6 @@ struct vtblk_request { struct virtio_blk_outhdr vbr_hdr; struct bio *vbr_bp; uint8_t vbr_ack; - TAILQ_ENTRY(vtblk_request) vbr_link; }; @@ -132,53 +131,60 @@ static intvtblk_dump(void *, void *, vm static voidvtblk_strategy(struct bio *); static voidvtblk_negotiate_features(struct vtblk_softc *); +static voidvtblk_setup_features(struct vtblk_softc *); static int vtblk_maximum_segments(struct vtblk_softc *, struct virtio_blk_config *); static int vtblk_alloc_virtqueue(struct vtblk_softc *); static voidvtblk_resize_disk(struct vtblk_softc *, uint64_t); -static voidvtblk_set_write_cache(struct vtblk_softc *, int); -static int vtblk_write_cache_enabled(struct vtblk_softc *sc, - struct virtio_blk_config *); -static int vtblk_write_cache_sysctl(SYSCTL_HANDLER_ARGS); static voidvtblk_alloc_disk(struct vtblk_softc *, struct virtio_blk_config *); static voidvtblk_create_disk(struct vtblk_softc *); -static int vtblk_quiesce(struct vtblk_softc *); -static voidvtblk_startio(struct vtblk_softc *); -static struct vtblk_request * vtblk_bio_request(struct vtblk_softc *); -static int vtblk_execute_request(struct vtblk_softc *, +static int vtblk_request_prealloc(struct vtblk_softc *); +static voidvtblk_request_free(struct vtblk_softc *); +static struct vtblk_request * + vtblk_request_dequeue(struct vtblk_softc *); +static voidvtblk_request_enqueue(struct vtblk_softc *, struct vtblk_request *); +static struct vtblk_request * + vtblk_request_next_ready(struct vtblk_softc *); +static voidvtblk_request_requeue_ready(struct vtblk_softc *, + struct vtblk_request *); +static struct vtblk_request * + vtblk_request_next(struct vtblk_softc *); +static struct vtblk_request * + vtblk_request_bio(struct vtblk_softc *); +static int vtblk_request_execute(struct vtblk_softc *, + struct vtblk_request *); +static int vtblk_request_error(struct vtblk_request *); -static voidvtblk_vq_intr(void *); +static voidvtblk_queue_completed(struct vtblk_softc *, + struct bio_queue *); +static voidvtblk_done_completed(struct vtblk_softc *, + struct bio_queue *); +static voidvtblk_drain_vq(struct vtblk_softc *, int); +static voidvtblk_drain(struct vtblk_softc *); -static voidvtblk_stop(struct vtblk_softc *); +static voidvtblk_startio(struct vtblk_softc *); +static voidvtblk_bio_done(struct vtblk_softc *, struct bio *, int); static voidvtblk_read_config(struct vtblk_softc *, struct virtio_blk_config *); -static voidvtblk_get_ident(struct vtblk_softc *); -static voidvtblk_prepare_dump(struct vtblk_softc *); -static int vtblk_write_dump(struct vtblk_softc *, void *, off_t, size_t); -static int vtblk_flush_dump(struct vtblk_softc *); +static voidvtblk_ident(struct vtblk_softc *); static int vtblk_poll_request(struct vtblk_softc *, struct vtblk_request *); +static int vtblk_quiesce(struct vtblk_softc *); +static voidvtblk_vq_intr(void *); +static voidvtblk_stop(struct vtblk_softc *); -static voidvtblk_finish_completed(struct vtblk_softc *); -static voidvtblk_drain_vq(struct vtblk_softc *, int); -static voidvtblk_drain(struct vtblk_softc *); - -static int vtblk_alloc_requests(struct vtblk_softc *); -static voidvtblk_free_requests(struct vtblk_softc *); -static struct vtblk_request * vtblk_dequeue_request(struct vtblk_softc *); -static voidvtblk_enqueue_request(struct vtblk_softc *, - struct vtblk_request *); - -static struct vtblk_request * vtblk_dequeue_ready(struct vtblk_softc *); -static voidvtblk_enqueue_ready(struct vtblk_softc *, - struct vtblk_request *); +static void
svn commit: r275273 - in stable/10: share/man/man4 sys/amd64/conf sys/conf sys/dev/virtio/console sys/i386/conf sys/modules/virtio sys/modules/virtio/console
Author: bryanv Date: Sat Nov 29 22:48:40 2014 New Revision: 275273 URL: https://svnweb.freebsd.org/changeset/base/275273 Log: MFC r273515, r274055, r274063, r274215, r274065, r274502: Add VirtIO console driver. Added: stable/10/share/man/man4/virtio_console.4 - copied, changed from r273515, head/share/man/man4/virtio_console.4 stable/10/sys/dev/virtio/console/ - copied from r273515, head/sys/dev/virtio/console/ stable/10/sys/modules/virtio/console/ - copied from r273515, head/sys/modules/virtio/console/ Modified: stable/10/share/man/man4/Makefile stable/10/share/man/man4/virtio.4 stable/10/sys/amd64/conf/NOTES stable/10/sys/conf/files.amd64 stable/10/sys/conf/files.i386 stable/10/sys/dev/virtio/console/virtio_console.c stable/10/sys/i386/conf/NOTES stable/10/sys/modules/virtio/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/Makefile == --- stable/10/share/man/man4/Makefile Sat Nov 29 22:42:53 2014 (r275272) +++ stable/10/share/man/man4/Makefile Sat Nov 29 22:48:40 2014 (r275273) @@ -559,6 +559,7 @@ MAN=aac.4 \ ${_virtio.4} \ ${_virtio_balloon.4} \ ${_virtio_blk.4} \ + ${_virtio_console.4} \ ${_virtio_random.4} \ ${_virtio_scsi.4} \ vkbd.4 \ @@ -810,6 +811,7 @@ _nxge.4=nxge.4 _virtio.4= virtio.4 _virtio_balloon.4=virtio_balloon.4 _virtio_blk.4= virtio_blk.4 +_virtio_console.4=virtio_console.4 _virtio_random.4= virtio_random.4 _virtio_scsi.4= virtio_scsi.4 _vmx.4=vmx.4 Modified: stable/10/share/man/man4/virtio.4 == --- stable/10/share/man/man4/virtio.4 Sat Nov 29 22:42:53 2014 (r275272) +++ stable/10/share/man/man4/virtio.4 Sat Nov 29 22:48:40 2014 (r275273) @@ -85,6 +85,7 @@ device driver. .Sh SEE ALSO .Xr virtio_balloon 4 , .Xr virtio_blk 4 , +.Xr virtio_console 4 , .Xr virtio_scsi 4 , .Xr vtnet 4 .Sh HISTORY Copied and modified: stable/10/share/man/man4/virtio_console.4 (from r273515, head/share/man/man4/virtio_console.4) == --- head/share/man/man4/virtio_console.4Thu Oct 23 04:47:32 2014 (r273515, copy source) +++ stable/10/share/man/man4/virtio_console.4 Sat Nov 29 22:48:40 2014 (r275273) @@ -56,6 +56,7 @@ each port is accessible through .Sh FILES .Bl -tag -width .Pa /dev/ttyV?.?? -compact .It Pa /dev/ttyV?.?? +.El .Sh SEE ALSO .Xr tty 4 .Xr virtio 4 Modified: stable/10/sys/amd64/conf/NOTES == --- stable/10/sys/amd64/conf/NOTES Sat Nov 29 22:42:53 2014 (r275272) +++ stable/10/sys/amd64/conf/NOTES Sat Nov 29 22:48:40 2014 (r275273) @@ -477,6 +477,7 @@ device virtio_blk # VirtIO Block device device virtio_scsi # VirtIO SCSI device device virtio_balloon # VirtIO Memory Balloon device device virtio_random # VirtIO Entropy device +device virtio_console # VirtIO Console device device hyperv # HyperV drivers Modified: stable/10/sys/conf/files.amd64 == --- stable/10/sys/conf/files.amd64 Sat Nov 29 22:42:53 2014 (r275272) +++ stable/10/sys/conf/files.amd64 Sat Nov 29 22:48:40 2014 (r275273) @@ -469,6 +469,7 @@ dev/virtio/block/virtio_blk.c optional dev/virtio/balloon/virtio_balloon.coptionalvirtio_balloon dev/virtio/scsi/virtio_scsi.c optionalvirtio_scsi dev/virtio/random/virtio_random.c optionalvirtio_random +dev/virtio/console/virtio_console.coptionalvirtio_console isa/syscons_isa.c optionalsc isa/vga_isa.c optionalvga kern/imgact_binmisc.c optionalimagact_binmisc Modified: stable/10/sys/conf/files.i386 == --- stable/10/sys/conf/files.i386 Sat Nov 29 22:42:53 2014 (r275272) +++ stable/10/sys/conf/files.i386 Sat Nov 29 22:48:40 2014 (r275273) @@ -416,6 +416,7 @@ dev/virtio/block/virtio_blk.c optional dev/virtio/balloon/virtio_balloon.coptionalvirtio_balloon dev/virtio/scsi/virtio_scsi.c optionalvirtio_scsi dev/virtio/random/virtio_random.c optionalvirtio_random +dev/virtio/console/virtio_console.coptionalvirtio_console i386/acpica/acpi_machdep.c optional acpi acpi_wakecode.ooptional acpi \ dependency $S/i386/acpica/acpi_wakecode.S assym.s
svn commit: r275274 - stable/10/sys/dev/virtio/network
Author: bryanv Date: Sat Nov 29 23:05:01 2014 New Revision: 275274 URL: https://svnweb.freebsd.org/changeset/base/275274 Log: MFC r274325: Enable LRO by default when available on vtnet interfaces The prior change to not enable LRO by default has confused several people. The configurations where LRO is problematic is not the typical use case for VirtIO, and due to other issues, this often requires checksum offloading to be disabled anyways. Modified: stable/10/sys/dev/virtio/network/if_vtnet.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/virtio/network/if_vtnet.c == --- stable/10/sys/dev/virtio/network/if_vtnet.c Sat Nov 29 22:48:40 2014 (r275273) +++ stable/10/sys/dev/virtio/network/if_vtnet.c Sat Nov 29 23:05:01 2014 (r275274) @@ -967,9 +967,14 @@ vtnet_setup_interface(struct vtnet_softc ifp-if_capabilities |= IFCAP_VLAN_HWTSO; } - if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_CSUM)) + if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_CSUM)) { ifp-if_capabilities |= IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6; + if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO4) || + virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO6)) + ifp-if_capabilities |= IFCAP_LRO; + } + if (ifp-if_capabilities IFCAP_HWCSUM) { /* * VirtIO does not support VLAN tagging, but we can fake @@ -987,12 +992,6 @@ vtnet_setup_interface(struct vtnet_softc * Capabilities after here are not enabled by default. */ - if (ifp-if_capabilities IFCAP_RXCSUM) { - if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO4) || - virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO6)) - ifp-if_capabilities |= IFCAP_LRO; - } - if (sc-vtnet_flags VTNET_FLAG_VLAN_FILTER) { ifp-if_capabilities |= IFCAP_VLAN_HWFILTER; ___ 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: r275275 - stable/9/sys/dev/virtio/network
Author: bryanv Date: Sat Nov 29 23:10:19 2014 New Revision: 275275 URL: https://svnweb.freebsd.org/changeset/base/275275 Log: MFC r274325: Enable LRO by default when available on vtnet interfaces The prior change to not enable LRO by default has confused several people. The configurations where LRO is problematic is not the typical use case for VirtIO, and due to other issues, this often requires checksum offloading to be disabled anyways. Modified: stable/9/sys/dev/virtio/network/if_vtnet.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/virtio/network/if_vtnet.c == --- stable/9/sys/dev/virtio/network/if_vtnet.c Sat Nov 29 23:05:01 2014 (r275274) +++ stable/9/sys/dev/virtio/network/if_vtnet.c Sat Nov 29 23:10:19 2014 (r275275) @@ -966,9 +966,14 @@ vtnet_setup_interface(struct vtnet_softc ifp-if_capabilities |= IFCAP_VLAN_HWTSO; } - if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_CSUM)) + if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_CSUM)) { ifp-if_capabilities |= IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6; + if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO4) || + virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO6)) + ifp-if_capabilities |= IFCAP_LRO; + } + if (ifp-if_capabilities IFCAP_HWCSUM) { /* * VirtIO does not support VLAN tagging, but we can fake @@ -986,12 +991,6 @@ vtnet_setup_interface(struct vtnet_softc * Capabilities after here are not enabled by default. */ - if (ifp-if_capabilities IFCAP_RXCSUM) { - if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO4) || - virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO6)) - ifp-if_capabilities |= IFCAP_LRO; - } - if (sc-vtnet_flags VTNET_FLAG_VLAN_FILTER) { ifp-if_capabilities |= IFCAP_VLAN_HWFILTER; ___ 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: r274322 - head/sbin/camcontrol
Author: bryanv Date: Sun Nov 9 18:13:08 2014 New Revision: 274322 URL: https://svnweb.freebsd.org/changeset/base/274322 Log: Attempt to report a better error if sanitize is not supported MFC after:1 month Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c == --- head/sbin/camcontrol/camcontrol.c Sun Nov 9 17:32:07 2014 (r274321) +++ head/sbin/camcontrol/camcontrol.c Sun Nov 9 18:13:08 2014 (r274322) @@ -5827,15 +5827,31 @@ scsisanitize(struct cam_device *device, if (arglist CAM_ARG_ERR_RECOVER) ccb-ccb_h.flags |= CAM_PASS_ERR_RECOVER; - if (((retval = cam_send_ccb(device, ccb)) 0) -|| ((immediate == 0) - ((ccb-ccb_h.status CAM_STATUS_MASK) != CAM_REQ_CMP))) { - const char errstr[] = error sending sanitize command; + if (cam_send_ccb(device, ccb) 0) { + warn(error sending sanitize command); + error = 1; + goto scsisanitize_bailout; + } - if (retval 0) - warn(errstr); - else - warnx(errstr); + if ((ccb-ccb_h.status CAM_STATUS_MASK) != CAM_REQ_CMP) { + struct scsi_sense_data *sense; + int error_code, sense_key, asc, ascq; + + if ((ccb-ccb_h.status CAM_STATUS_MASK) == + CAM_SCSI_STATUS_ERROR) { + sense = ccb-csio.sense_data; + scsi_extract_sense_len(sense, ccb-csio.sense_len - + ccb-csio.sense_resid, error_code, sense_key, + asc, ascq, /*show_errors*/ 1); + + if (sense_key == SSD_KEY_ILLEGAL_REQUEST + asc == 0x20 ascq == 0x00) + warnx(sanitize is not supported by + this device); + else + warnx(error sanitizing this device); + } else + warnx(error sanitizing this device); if (arglist CAM_ARG_VERBOSE) { cam_error_print(device, ccb, CAM_ESF_ALL, ___ 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: r274325 - head/sys/dev/virtio/network
Author: bryanv Date: Sun Nov 9 20:04:12 2014 New Revision: 274325 URL: https://svnweb.freebsd.org/changeset/base/274325 Log: Enable LRO by default when available on vtnet interfaces The prior change to not enable LRO by default has confused several people. The configurations where LRO is problematic is not the typical use case for VirtIO, and due to other issues, this often requires checksum offloading to be disabled anyways. PR: 185864 MFC after:2 weeks 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 Sun Nov 9 19:58:30 2014 (r274324) +++ head/sys/dev/virtio/network/if_vtnet.c Sun Nov 9 20:04:12 2014 (r274325) @@ -967,9 +967,14 @@ vtnet_setup_interface(struct vtnet_softc ifp-if_capabilities |= IFCAP_VLAN_HWTSO; } - if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_CSUM)) + if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_CSUM)) { ifp-if_capabilities |= IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6; + if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO4) || + virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO6)) + ifp-if_capabilities |= IFCAP_LRO; + } + if (ifp-if_capabilities IFCAP_HWCSUM) { /* * VirtIO does not support VLAN tagging, but we can fake @@ -987,12 +992,6 @@ vtnet_setup_interface(struct vtnet_softc * Capabilities after here are not enabled by default. */ - if (ifp-if_capabilities IFCAP_RXCSUM) { - if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO4) || - virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO6)) - ifp-if_capabilities |= IFCAP_LRO; - } - if (sc-vtnet_flags VTNET_FLAG_VLAN_FILTER) { ifp-if_capabilities |= IFCAP_VLAN_HWFILTER; ___ 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: r274264 - stable/10/sys/netinet
Author: bryanv Date: Sat Nov 8 02:40:00 2014 New Revision: 274264 URL: https://svnweb.freebsd.org/changeset/base/274264 Log: MFC r272797: Check for mbuf copy failure when there are multiple multicast sockets This partitular case is the only path where the mbuf could be NULL. udp_append() checked for a NULL mbuf only after invoking the tunneling callback. Our only in tree tunneling callback - SCTP - assumed a non NULL mbuf, and it is a bit odd to make the callbacks responsible for checking this condition. This also reduces the differences between the IPv4 and IPv6 code. Modified: stable/10/sys/netinet/udp_usrreq.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/udp_usrreq.c == --- stable/10/sys/netinet/udp_usrreq.c Sat Nov 8 00:55:06 2014 (r274263) +++ stable/10/sys/netinet/udp_usrreq.c Sat Nov 8 02:40:00 2014 (r274264) @@ -307,9 +307,6 @@ udp_append(struct inpcb *inp, struct ip return; } - if (n == NULL) - return; - off += sizeof(struct udphdr); #ifdef IPSEC @@ -568,8 +565,10 @@ udp_input(struct mbuf *m, int off) if (last != NULL) { struct mbuf *n; - n = m_copy(m, 0, M_COPYALL); - udp_append(last, ip, n, iphlen, udp_in); + if ((n = m_copy(m, 0, M_COPYALL)) != NULL) { + udp_append(last, ip, n, iphlen, + udp_in); + } INP_RUNLOCK(last); } last = inp; ___ 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: r274265 - stable/10/sys/netinet6
Author: bryanv Date: Sat Nov 8 02:47:23 2014 New Revision: 274265 URL: https://svnweb.freebsd.org/changeset/base/274265 Log: MFC r272801: Move the calls to u_tun_func() into udp6_append() A similar cleanup for UDPv4 was performed in r220620. Modified: stable/10/sys/netinet6/udp6_usrreq.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet6/udp6_usrreq.c == --- stable/10/sys/netinet6/udp6_usrreq.cSat Nov 8 02:40:00 2014 (r274264) +++ stable/10/sys/netinet6/udp6_usrreq.cSat Nov 8 02:47:23 2014 (r274265) @@ -139,9 +139,18 @@ udp6_append(struct inpcb *inp, struct mb { struct socket *so; struct mbuf *opts; + struct udpcb *up; INP_LOCK_ASSERT(inp); + /* +* Engage the tunneling protocol. +*/ + up = intoudpcb(inp); + if (up-u_tun_func != NULL) { + (*up-u_tun_func)(n, off, inp); + return; + } #ifdef IPSEC /* Check AH/ESP integrity. */ if (ipsec6_in_reject(n, inp)) { @@ -359,20 +368,7 @@ udp6_input(struct mbuf **mp, int *offp, if ((n = m_copy(m, 0, M_COPYALL)) != NULL) { INP_RLOCK(last); - up = intoudpcb(last); - if (up-u_tun_func == NULL) { - udp6_append(last, n, off, fromsa); - } else { - /* -* Engage the tunneling -* protocol we will have to -* leave the info_lock up, -* since we are hunting -* through multiple UDP's. -* -*/ - (*up-u_tun_func)(n, off, last); - } + udp6_append(last, n, off, fromsa); INP_RUNLOCK(last); } } @@ -402,16 +398,8 @@ udp6_input(struct mbuf **mp, int *offp, } INP_RLOCK(last); INP_INFO_RUNLOCK(pcbinfo); - up = intoudpcb(last); UDP_PROBE(receive, NULL, last, ip6, last, uh); - if (up-u_tun_func == NULL) { - udp6_append(last, m, off, fromsa); - } else { - /* -* Engage the tunneling protocol. -*/ - (*up-u_tun_func)(m, off, last); - } + udp6_append(last, m, off, fromsa); INP_RUNLOCK(last); return (IPPROTO_DONE); } @@ -490,15 +478,7 @@ udp6_input(struct mbuf **mp, int *offp, } } UDP_PROBE(receive, NULL, inp, ip6, inp, uh); - if (up-u_tun_func == NULL) { - udp6_append(inp, m, off, fromsa); - } else { - /* -* Engage the tunneling protocol. -*/ - - (*up-u_tun_func)(m, off, inp); - } + udp6_append(inp, m, off, fromsa); INP_RUNLOCK(inp); return (IPPROTO_DONE); ___ 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: r274266 - in stable/10/sys: netinet netinet6
Author: bryanv Date: Sat Nov 8 02:53:55 2014 New Revision: 274266 URL: https://svnweb.freebsd.org/changeset/base/274266 Log: MFC r272844: Add missing UDP multicast receive dtrace probes Modified: stable/10/sys/netinet/udp_usrreq.c stable/10/sys/netinet6/udp6_usrreq.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/udp_usrreq.c == --- stable/10/sys/netinet/udp_usrreq.c Sat Nov 8 02:47:23 2014 (r274265) +++ stable/10/sys/netinet/udp_usrreq.c Sat Nov 8 02:53:55 2014 (r274266) @@ -566,6 +566,8 @@ udp_input(struct mbuf *m, int off) struct mbuf *n; if ((n = m_copy(m, 0, M_COPYALL)) != NULL) { + UDP_PROBE(receive, NULL, last, ip, + last, uh); udp_append(last, ip, n, iphlen, udp_in); } @@ -597,6 +599,7 @@ udp_input(struct mbuf *m, int off) INP_INFO_RUNLOCK(pcbinfo); goto badunlocked; } + UDP_PROBE(receive, NULL, last, ip, last, uh); udp_append(last, ip, m, iphlen, udp_in); INP_RUNLOCK(last); INP_INFO_RUNLOCK(pcbinfo); Modified: stable/10/sys/netinet6/udp6_usrreq.c == --- stable/10/sys/netinet6/udp6_usrreq.cSat Nov 8 02:47:23 2014 (r274265) +++ stable/10/sys/netinet6/udp6_usrreq.cSat Nov 8 02:53:55 2014 (r274266) @@ -368,6 +368,8 @@ udp6_input(struct mbuf **mp, int *offp, if ((n = m_copy(m, 0, M_COPYALL)) != NULL) { INP_RLOCK(last); + UDP_PROBE(receive, NULL, last, ip6, + last, uh); udp6_append(last, n, off, fromsa); INP_RUNLOCK(last); } ___ 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: r274215 - head/sys/dev/virtio/console
Author: bryanv Date: Fri Nov 7 03:36:28 2014 New Revision: 274215 URL: https://svnweb.freebsd.org/changeset/base/274215 Log: Several minor changes to hopefully complete the VirtIO console driver - Support the KDB alt break sequence to enter the debugger, panic, reboot, etc. [1] - Provide emergency write feature description. Note that QEMU does not implement this feature. - Make the VTCON_FLAG_* defines sequential once again. - When the multiple port feature is not negotiated, query the rows and columns of the one console during the device attach when the size feature is negotiated. - Report failure to the device if hot plugging a port fails. - Acknowledge the console port event with an open event. This is required by the spec, but QEMU doesn't seem to care. Submitted by: Juniper [1] MFC after:1 month Modified: head/sys/dev/virtio/console/virtio_console.c Modified: head/sys/dev/virtio/console/virtio_console.c == --- head/sys/dev/virtio/console/virtio_console.cFri Nov 7 03:07:10 2014(r274214) +++ head/sys/dev/virtio/console/virtio_console.cFri Nov 7 03:36:28 2014(r274215) @@ -34,6 +34,7 @@ __FBSDID($FreeBSD$); #include sys/kernel.h #include sys/malloc.h #include sys/module.h +#include sys/kdb.h #include sys/lock.h #include sys/mutex.h #include sys/sglist.h @@ -78,6 +79,11 @@ struct vtcon_port { int vtcport_id; int vtcport_flags; #define VTCON_PORT_FLAG_GONE 0x01 +#define VTCON_PORT_FLAG_CONSOLE0x02 + +#if defined(KDB) + int vtcport_alt_break_state; +#endif }; #define VTCON_PORT_LOCK(_port) mtx_lock((_port)-vtcport_mtx) @@ -94,17 +100,11 @@ struct vtcon_softc { device_t vtcon_dev; struct mtx vtcon_mtx; uint64_t vtcon_features; - uint32_t vtcon_flags; -#define VTCON_FLAG_DETACHED0x0001 -#define VTCON_FLAG_SIZE0x0010 -#define VTCON_FLAG_MULTIPORT 0x0020 - - struct task vtcon_ctrl_task; - struct virtqueue*vtcon_ctrl_rxvq; - struct virtqueue*vtcon_ctrl_txvq; - struct mtx vtcon_ctrl_tx_mtx; - uint32_t vtcon_max_ports; + uint32_t vtcon_flags; +#define VTCON_FLAG_DETACHED0x01 +#define VTCON_FLAG_SIZE0x02 +#define VTCON_FLAG_MULTIPORT 0x04 /* * Ports can be added and removed during runtime, but we have @@ -112,6 +112,11 @@ struct vtcon_softc { * indexed by the port ID. */ struct vtcon_softc_port *vtcon_ports; + + struct task vtcon_ctrl_task; + struct virtqueue*vtcon_ctrl_rxvq; + struct virtqueue*vtcon_ctrl_txvq; + struct mtx vtcon_ctrl_tx_mtx; }; #define VTCON_LOCK(_sc)mtx_lock((_sc)-vtcon_mtx) @@ -133,6 +138,7 @@ struct vtcon_softc { static struct virtio_feature_desc vtcon_feature_desc[] = { { VIRTIO_CONSOLE_F_SIZE,ConsoleSize }, { VIRTIO_CONSOLE_F_MULTIPORT, MultiplePorts }, + { VIRTIO_CONSOLE_F_EMERG_WRITE, EmergencyWrite }, { 0, NULL } }; @@ -331,10 +337,15 @@ vtcon_attach(device_t dev) if (sc-vtcon_flags VTCON_FLAG_MULTIPORT) { TASK_INIT(sc-vtcon_ctrl_task, 0, vtcon_ctrl_task_cb, sc); error = vtcon_ctrl_init(sc); - } else + if (error) + goto fail; + } else { error = vtcon_port_create(sc, 0); - if (error) - goto fail; + if (error) + goto fail; + if (sc-vtcon_flags VTCON_FLAG_SIZE) + vtcon_port_update_console_size(sc); + } error = virtio_setup_intr(dev, INTR_TYPE_TTY); if (error) { @@ -703,6 +714,7 @@ vtcon_ctrl_port_add_event(struct vtcon_s if (error) { device_printf(dev, %s: cannot create port %d: %d\n, __func__, id, error); + vtcon_ctrl_send_control(sc, id, VIRTIO_CONSOLE_PORT_READY, 0); return; } } @@ -735,9 +747,27 @@ vtcon_ctrl_port_remove_event(struct vtco static void vtcon_ctrl_port_console_event(struct vtcon_softc *sc, int id) { + device_t dev; + struct vtcon_softc_port *scport; + struct vtcon_port *port; + + dev = sc-vtcon_dev; + scport = sc-vtcon_ports[id]; + + VTCON_LOCK(sc); + port = scport-vcsp_port; + if (port == NULL) { + VTCON_UNLOCK(sc); + device_printf(dev, %s: console port %d, but does not exist\n, + __func__, id); + return; + } -
svn commit: r274055 - head/sys/dev/virtio/console
Author: bryanv Date: Mon Nov 3 16:57:01 2014 New Revision: 274055 URL: https://svnweb.freebsd.org/changeset/base/274055 Log: Add support for the multiport feature and fix hot plug races MFC after:1 month Modified: head/sys/dev/virtio/console/virtio_console.c Modified: head/sys/dev/virtio/console/virtio_console.c == --- head/sys/dev/virtio/console/virtio_console.cMon Nov 3 16:31:31 2014(r274054) +++ head/sys/dev/virtio/console/virtio_console.cMon Nov 3 16:57:01 2014(r274055) @@ -55,33 +55,40 @@ __FBSDID($FreeBSD$); #include virtio_if.h -#define VTCON_MAX_PORTS1 +#define VTCON_MAX_PORTS 32 #define VTCON_TTY_PREFIX V #define VTCON_BULK_BUFSZ 128 +/* + * The buffer cannot cross more than one page boundary due to the + * size of the sglist segment array used. + */ +CTASSERT(VTCON_BULK_BUFSZ = PAGE_SIZE); + struct vtcon_softc; +struct vtcon_softc_port; struct vtcon_port { - struct vtcon_softc *vtcport_sc; - TAILQ_ENTRY(vtcon_port) vtcport_next; - struct mtx vtcport_mtx; - int vtcport_id; - struct tty *vtcport_tty; - struct virtqueue*vtcport_invq; - struct virtqueue*vtcport_outvq; - char vtcport_name[16]; + struct mtx vtcport_mtx; + struct vtcon_softc *vtcport_sc; + struct vtcon_softc_port *vtcport_scport; + struct tty *vtcport_tty; + struct virtqueue*vtcport_invq; + struct virtqueue*vtcport_outvq; + int vtcport_id; + int vtcport_flags; +#define VTCON_PORT_FLAG_GONE 0x01 }; -#define VTCON_PORT_MTX(_port) (_port)-vtcport_mtx -#define VTCON_PORT_LOCK_INIT(_port) \ -mtx_init(VTCON_PORT_MTX((_port)), (_port)-vtcport_name, NULL, MTX_DEF) -#define VTCON_PORT_LOCK(_port) mtx_lock(VTCON_PORT_MTX((_port))) -#define VTCON_PORT_UNLOCK(_port) mtx_unlock(VTCON_PORT_MTX((_port))) -#define VTCON_PORT_LOCK_DESTROY(_port) mtx_destroy(VTCON_PORT_MTX((_port))) -#define VTCON_PORT_LOCK_ASSERT(_port) \ -mtx_assert(VTCON_PORT_MTX((_port)), MA_OWNED) -#define VTCON_PORT_LOCK_ASSERT_NOTOWNED(_port) \ -mtx_assert(VTCON_PORT_MTX((_port)), MA_NOTOWNED) +#define VTCON_PORT_LOCK(_port) mtx_lock((_port)-vtcport_mtx) +#define VTCON_PORT_UNLOCK(_port) mtx_unlock((_port)-vtcport_mtx) + +struct vtcon_softc_port { + struct vtcon_softc *vcsp_sc; + struct vtcon_port *vcsp_port; + struct virtqueue*vcsp_invq; + struct virtqueue*vcsp_outvq; +}; struct vtcon_softc { device_t vtcon_dev; @@ -95,38 +102,33 @@ struct vtcon_softc { struct task vtcon_ctrl_task; struct virtqueue*vtcon_ctrl_rxvq; struct virtqueue*vtcon_ctrl_txvq; + struct mtx vtcon_ctrl_tx_mtx; uint32_t vtcon_max_ports; - TAILQ_HEAD(, vtcon_port) -vtcon_ports; /* * Ports can be added and removed during runtime, but we have * to allocate all the virtqueues during attach. This array is * indexed by the port ID. */ - struct vtcon_port_extra { - struct vtcon_port *port; - struct virtqueue*invq; - struct virtqueue*outvq; - } *vtcon_portsx; + struct vtcon_softc_port *vtcon_ports; }; -#define VTCON_MTX(_sc) (_sc)-vtcon_mtx -#define VTCON_LOCK_INIT(_sc, _name) \ -mtx_init(VTCON_MTX((_sc)), (_name), NULL, MTX_DEF) -#define VTCON_LOCK(_sc)mtx_lock(VTCON_MTX((_sc))) -#define VTCON_UNLOCK(_sc) mtx_unlock(VTCON_MTX((_sc))) -#define VTCON_LOCK_DESTROY(_sc)mtx_destroy(VTCON_MTX((_sc))) -#define VTCON_LOCK_ASSERT(_sc) mtx_assert(VTCON_MTX((_sc)), MA_OWNED) -#define VTCON_LOCK_ASSERT_NOTOWNED(_sc) \ -mtx_assert(VTCON_MTX((_sc)), MA_NOTOWNED) +#define VTCON_LOCK(_sc)mtx_lock((_sc)-vtcon_mtx) +#define VTCON_UNLOCK(_sc) mtx_unlock((_sc)-vtcon_mtx) +#define VTCON_LOCK_ASSERT(_sc) \ +mtx_assert((_sc)-vtcon_mtx, MA_OWNED) +#define VTCON_LOCK_ASSERT_NOTOWNED(_sc)\ +mtx_assert((_sc)-vtcon_mtx, MA_NOTOWNED) + +#define VTCON_CTRL_TX_LOCK(_sc) mtx_lock((_sc)-vtcon_ctrl_tx_mtx) +#define VTCON_CTRL_TX_UNLOCK(_sc) mtx_unlock((_sc)-vtcon_ctrl_tx_mtx) #define VTCON_ASSERT_VALID_PORTID(_sc, _id)\ KASSERT((_id) = 0 (_id) (_sc)-vtcon_max_ports, \ (%s: port ID %d out of range, __func__, _id)) -#define VTCON_FEATURES 0 +#define VTCON_FEATURES
svn commit: r274063 - head/sys/dev/virtio/console
Author: bryanv Date: Mon Nov 3 22:17:25 2014 New Revision: 274063 URL: https://svnweb.freebsd.org/changeset/base/274063 Log: Create the tty device after the port is completely initialized This fixes a race with a tty open before the host is the ready. MFC after:1 month Modified: head/sys/dev/virtio/console/virtio_console.c Modified: head/sys/dev/virtio/console/virtio_console.c == --- head/sys/dev/virtio/console/virtio_console.cMon Nov 3 21:26:11 2014(r274062) +++ head/sys/dev/virtio/console/virtio_console.cMon Nov 3 22:17:25 2014(r274063) @@ -1048,17 +1048,17 @@ vtcon_port_create(struct vtcon_softc *sc return (error); } - tty_makedev(port-vtcport_tty, NULL, %s%r.%r, VTCON_TTY_PREFIX, - device_get_unit(dev), id); - VTCON_LOCK(sc); VTCON_PORT_LOCK(port); - vtcon_port_enable_intr(port); scport-vcsp_port = port; + vtcon_port_enable_intr(port); vtcon_port_submit_event(port, VIRTIO_CONSOLE_PORT_READY, 1); VTCON_PORT_UNLOCK(port); VTCON_UNLOCK(sc); + tty_makedev(port-vtcport_tty, NULL, %s%r.%r, VTCON_TTY_PREFIX, + device_get_unit(dev), id); + 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: r274065 - in head/sys: amd64/conf conf i386/conf
Author: bryanv Date: Mon Nov 3 22:37:10 2014 New Revision: 274065 URL: https://svnweb.freebsd.org/changeset/base/274065 Log: Add VirtIO console to the x86 NOTES and files Requested by: jhb Modified: head/sys/amd64/conf/NOTES head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/i386/conf/NOTES Modified: head/sys/amd64/conf/NOTES == --- head/sys/amd64/conf/NOTES Mon Nov 3 22:19:44 2014(r274064) +++ head/sys/amd64/conf/NOTES Mon Nov 3 22:37:10 2014(r274065) @@ -492,6 +492,7 @@ device virtio_blk # VirtIO Block device device virtio_scsi # VirtIO SCSI device device virtio_balloon # VirtIO Memory Balloon device device virtio_random # VirtIO Entropy device +device virtio_console # VirtIO Console device device hyperv # HyperV drivers Modified: head/sys/conf/files.amd64 == --- head/sys/conf/files.amd64 Mon Nov 3 22:19:44 2014(r274064) +++ head/sys/conf/files.amd64 Mon Nov 3 22:37:10 2014(r274065) @@ -455,6 +455,7 @@ dev/virtio/block/virtio_blk.c optional dev/virtio/balloon/virtio_balloon.coptionalvirtio_balloon dev/virtio/scsi/virtio_scsi.c optionalvirtio_scsi dev/virtio/random/virtio_random.c optionalvirtio_random +dev/virtio/console/virtio_console.coptionalvirtio_console isa/syscons_isa.c optionalsc isa/vga_isa.c optionalvga kern/kern_clocksource.cstandard Modified: head/sys/conf/files.i386 == --- head/sys/conf/files.i386Mon Nov 3 22:19:44 2014(r274064) +++ head/sys/conf/files.i386Mon Nov 3 22:37:10 2014(r274065) @@ -402,6 +402,7 @@ dev/virtio/block/virtio_blk.c optional dev/virtio/balloon/virtio_balloon.coptionalvirtio_balloon dev/virtio/scsi/virtio_scsi.c optionalvirtio_scsi dev/virtio/random/virtio_random.c optionalvirtio_random +dev/virtio/console/virtio_console.coptionalvirtio_console i386/acpica/acpi_machdep.c optional acpi acpi_wakecode.ooptional acpi \ dependency $S/i386/acpica/acpi_wakecode.S assym.s\ Modified: head/sys/i386/conf/NOTES == --- head/sys/i386/conf/NOTESMon Nov 3 22:19:44 2014(r274064) +++ head/sys/i386/conf/NOTESMon Nov 3 22:37:10 2014(r274065) @@ -815,6 +815,7 @@ device virtio_blk # VirtIO Block device device virtio_scsi # VirtIO SCSI device device virtio_balloon # VirtIO Memory Balloon device device virtio_random # VirtIO Entropy device +device virtio_console # VirtIO Console device device hyperv # HyperV drivers ___ 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: r273515 - in head: share/man/man4 sys/dev/virtio/console sys/modules/virtio sys/modules/virtio/console
Author: bryanv Date: Thu Oct 23 04:47:32 2014 New Revision: 273515 URL: https://svnweb.freebsd.org/changeset/base/273515 Log: Add VirtIO console driver Support for the multiport feature is mostly implemented, but currently disabled due to some potential races in the hot plug code paths. Requested by: marcel MFC after:1 month Relnotes: yes Added: head/share/man/man4/virtio_console.4 (contents, props changed) head/sys/dev/virtio/console/ head/sys/dev/virtio/console/virtio_console.c (contents, props changed) head/sys/dev/virtio/console/virtio_console.h (contents, props changed) head/sys/modules/virtio/console/ head/sys/modules/virtio/console/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/share/man/man4/virtio.4 head/sys/modules/virtio/Makefile Modified: head/share/man/man4/Makefile == --- head/share/man/man4/MakefileThu Oct 23 03:13:14 2014 (r273514) +++ head/share/man/man4/MakefileThu Oct 23 04:47:32 2014 (r273515) @@ -563,6 +563,7 @@ MAN=aac.4 \ ${_virtio.4} \ ${_virtio_balloon.4} \ ${_virtio_blk.4} \ + ${_virtio_console.4} \ ${_virtio_random.4} \ ${_virtio_scsi.4} \ vkbd.4 \ @@ -814,6 +815,7 @@ _nxge.4=nxge.4 _virtio.4= virtio.4 _virtio_balloon.4=virtio_balloon.4 _virtio_blk.4= virtio_blk.4 +_virtio_console.4=virtio_console.4 _virtio_random.4= virtio_random.4 _virtio_scsi.4= virtio_scsi.4 _vmx.4=vmx.4 Modified: head/share/man/man4/virtio.4 == --- head/share/man/man4/virtio.4Thu Oct 23 03:13:14 2014 (r273514) +++ head/share/man/man4/virtio.4Thu Oct 23 04:47:32 2014 (r273515) @@ -85,6 +85,7 @@ device driver. .Sh SEE ALSO .Xr virtio_balloon 4 , .Xr virtio_blk 4 , +.Xr virtio_console 4 , .Xr virtio_scsi 4 , .Xr vtnet 4 .Sh HISTORY Added: head/share/man/man4/virtio_console.4 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/virtio_console.4Thu Oct 23 04:47:32 2014 (r273515) @@ -0,0 +1,66 @@ +.\ Copyright (c) 2014 Bryan Venteicher +.\ 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$ +.\ +.Dd October 22, 2014 +.Dt VIRTIO_CONSOLE 4 +.Os +.Sh NAME +.Nm virtio_console +.Nd VirtIO Console driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd device virtio_console +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +virtio_console_load=YES +.Ed +.Sh DESCRIPTION +The +.Nm +device driver provides support for VirtIO console devices. +.Pp +The console device may have one or more ports. +Each port is similar to a simple serial interface, and +each port is accessible through +.Xr tty 4 . +.Sh FILES +.Bl -tag -width .Pa /dev/ttyV?.?? -compact +.It Pa /dev/ttyV?.?? +.Sh SEE ALSO +.Xr tty 4 +.Xr virtio 4 +.Sh HISTORY +The +.Nm +driver was written by +.An Bryan Venteicher Aq bry...@freebsd.org . Added: head/sys/dev/virtio/console/virtio_console.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/virtio/console/virtio_console.cThu Oct 23 04:47:32 2014(r273515) @@ -0,0 +1,1238
svn commit: r273450 - stable/10/sys/sys
Author: bryanv Date: Wed Oct 22 04:01:27 2014 New Revision: 273450 URL: https://svnweb.freebsd.org/changeset/base/273450 Log: MFC r272796: Add M_FLOWID to M_COPYFLAGS The M_FLOWID flag should be propagated to the new mbuf pkthdr in m_move_pkthdr() and m_dup_pkthdr(). The new mbuf already got the existing flowid value, but would be ignored since the flag was not set. Modified: stable/10/sys/sys/mbuf.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sys/mbuf.h == --- stable/10/sys/sys/mbuf.hWed Oct 22 03:39:11 2014(r273449) +++ stable/10/sys/sys/mbuf.hWed Oct 22 04:01:27 2014(r273450) @@ -247,7 +247,7 @@ struct mbuf { * Flags preserved when copying m_pkthdr. */ #define M_COPYFLAGS \ -(M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_VLANTAG|M_PROMISC| \ +(M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_PROMISC|M_VLANTAG|M_FLOWID| \ M_PROTOFLAGS) /* ___ 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: r273451 - stable/10/sys/vm
Author: bryanv Date: Wed Oct 22 04:09:47 2014 New Revision: 273451 URL: https://svnweb.freebsd.org/changeset/base/273451 Log: MFC r272573: Change the UMA mutex into a rwlock Acquire the lock in read mode when just needed to ensure the stability of the keg list. The UMA lock may be held for a long time (relatively speaking) in uma_reclaim() on machines with lots of zones/kegs. If the uma_timeout() would fire during that period, subsequent callouts on that CPU may be significantly delayed. Modified: stable/10/sys/vm/uma_core.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/uma_core.c == --- stable/10/sys/vm/uma_core.c Wed Oct 22 04:01:27 2014(r273450) +++ stable/10/sys/vm/uma_core.c Wed Oct 22 04:09:47 2014(r273451) @@ -135,8 +135,8 @@ static LIST_HEAD(,uma_keg) uma_kegs = LI static LIST_HEAD(,uma_zone) uma_cachezones = LIST_HEAD_INITIALIZER(uma_cachezones); -/* This mutex protects the keg list */ -static struct mtx_padalign uma_mtx; +/* This RW lock protects the keg list */ +static struct rwlock_padalign uma_rwlock; /* Linked list of boot time pages */ static LIST_HEAD(,uma_slab) uma_boot_pages = @@ -905,7 +905,7 @@ zone_drain_wait(uma_zone_t zone, int wai ZONE_UNLOCK(zone); /* * The DRAINING flag protects us from being freed while -* we're running. Normally the uma_mtx would protect us but we +* we're running. Normally the uma_rwlock would protect us but we * must be able to release and acquire the right lock for each keg. */ zone_foreach_keg(zone, keg_drain); @@ -1541,9 +1541,9 @@ keg_ctor(void *mem, int size, void *udat LIST_INSERT_HEAD(keg-uk_zones, zone, uz_link); - mtx_lock(uma_mtx); + rw_wlock(uma_rwlock); LIST_INSERT_HEAD(uma_kegs, keg, uk_link); - mtx_unlock(uma_mtx); + rw_wunlock(uma_rwlock); return (0); } @@ -1593,9 +1593,9 @@ zone_ctor(void *mem, int size, void *uda zone-uz_release = arg-release; zone-uz_arg = arg-arg; zone-uz_lockptr = zone-uz_lock; - mtx_lock(uma_mtx); + rw_wlock(uma_rwlock); LIST_INSERT_HEAD(uma_cachezones, zone, uz_link); - mtx_unlock(uma_mtx); + rw_wunlock(uma_rwlock); goto out; } @@ -1612,7 +1612,7 @@ zone_ctor(void *mem, int size, void *uda zone-uz_fini = arg-fini; zone-uz_lockptr = keg-uk_lock; zone-uz_flags |= UMA_ZONE_SECONDARY; - mtx_lock(uma_mtx); + rw_wlock(uma_rwlock); ZONE_LOCK(zone); LIST_FOREACH(z, keg-uk_zones, uz_link) { if (LIST_NEXT(z, uz_link) == NULL) { @@ -1621,7 +1621,7 @@ zone_ctor(void *mem, int size, void *uda } } ZONE_UNLOCK(zone); - mtx_unlock(uma_mtx); + rw_wunlock(uma_rwlock); } else if (keg == NULL) { if ((keg = uma_kcreate(zone, arg-size, arg-uminit, arg-fini, arg-align, arg-flags)) == NULL) @@ -1719,9 +1719,9 @@ zone_dtor(void *arg, int size, void *uda if (!(zone-uz_flags UMA_ZFLAG_INTERNAL)) cache_drain(zone); - mtx_lock(uma_mtx); + rw_wlock(uma_rwlock); LIST_REMOVE(zone, uz_link); - mtx_unlock(uma_mtx); + rw_wunlock(uma_rwlock); /* * XXX there are some races here where * the zone can be drained but zone lock @@ -1743,9 +1743,9 @@ zone_dtor(void *arg, int size, void *uda * We only destroy kegs from non secondary zones. */ if (keg != NULL (zone-uz_flags UMA_ZONE_SECONDARY) == 0) { - mtx_lock(uma_mtx); + rw_wlock(uma_rwlock); LIST_REMOVE(keg, uk_link); - mtx_unlock(uma_mtx); + rw_wunlock(uma_rwlock); zone_free_item(kegs, keg, NULL, SKIP_NONE); } ZONE_LOCK_FINI(zone); @@ -1767,12 +1767,12 @@ zone_foreach(void (*zfunc)(uma_zone_t)) uma_keg_t keg; uma_zone_t zone; - mtx_lock(uma_mtx); + rw_rlock(uma_rwlock); LIST_FOREACH(keg, uma_kegs, uk_link) { LIST_FOREACH(zone, keg-uk_zones, uz_link) zfunc(zone); } - mtx_unlock(uma_mtx); + rw_runlock(uma_rwlock); } /* Public functions */ @@ -1788,7 +1788,7 @@ uma_startup(void *bootmem, int boot_page #ifdef UMA_DEBUG printf(Creating uma keg headers zone and keg.\n); #endif - mtx_init(uma_mtx, UMA lock, NULL, MTX_DEF); + rw_init(uma_rwlock, UMA lock); /* manually create the initial zone */ memset(args, 0, sizeof(args)); @@ -3363,12 +3363,12 @@
svn commit: r273331 - in head: sbin/ifconfig share/man/man4 sys/conf sys/modules sys/modules/if_vxlan sys/net sys/sys
source Ethernet MAC address of +received packets are used to dynamically populate the forwarding table. +When in multicast mode, an entry in the forwarding table allows the +interface to send the frame directly to the remote host instead of +broadcasting the frame to the multicast group. +This is the default. +.It Fl learn +The forwarding table is not populated by recevied packets. +.It Cm flush +Delete all dynamically-learned addresses from the forwarding table. +.It Cm flushall +Delete all addresses, including static addresses, from the forwarding table. +.El +.Pp +The following parameters are used to configure .Xr carp 4 protocol on an interface: .Bl -tag -width indent @@ -2745,6 +2815,7 @@ tried to alter an interface's configurat .Xr pfsync 4 , .Xr polling 4 , .Xr vlan 4 , +.Xr vxlan 4 , .Xr devd.conf 5 , .\ .Xr eon 5 , .Xr devd 8 , Added: head/sbin/ifconfig/ifvxlan.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/ifconfig/ifvxlan.cMon Oct 20 14:42:42 2014 (r273331) @@ -0,0 +1,648 @@ +/*- + * Copyright (c) 2014, Bryan Venteicher bry...@freebsd.org + * 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. + */ + +#include sys/cdefs.h +__FBSDID($FreeBSD$); + +#include sys/param.h +#include sys/ioctl.h +#include sys/socket.h +#include sys/sockio.h + +#include stdlib.h +#include stdint.h +#include unistd.h +#include netdb.h + +#include net/ethernet.h +#include net/if.h +#include net/if_var.h +#include net/if_vxlan.h +#include net/route.h +#include netinet/in.h + +#include ctype.h +#include stdio.h +#include string.h +#include stdlib.h +#include unistd.h +#include err.h +#include errno.h + +#include ifconfig.h + +static struct ifvxlanparam params = { + .vxlp_vni = VXLAN_VNI_MAX, +}; + +static int +get_val(const char *cp, u_long *valp) +{ + char *endptr; + u_long val; + + errno = 0; + val = strtoul(cp, endptr, 0); + if (cp[0] == '\0' || endptr[0] != '\0' || errno == ERANGE) + return (-1); + + *valp = val; + return (0); +} + +static int +do_cmd(int sock, u_long op, void *arg, size_t argsize, int set) +{ + struct ifdrv ifd; + + bzero(ifd, sizeof(ifd)); + + strlcpy(ifd.ifd_name, ifr.ifr_name, sizeof(ifd.ifd_name)); + ifd.ifd_cmd = op; + ifd.ifd_len = argsize; + ifd.ifd_data = arg; + + return (ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, ifd)); +} + +static int +vxlan_exists(int sock) +{ + struct ifvxlancfg cfg; + + bzero(cfg, sizeof(cfg)); + + return (do_cmd(sock, VXLAN_CMD_GET_CONFIG, cfg, sizeof(cfg), 0) != -1); +} + +static void +vxlan_status(int s) +{ + struct ifvxlancfg cfg; + char src[NI_MAXHOST], dst[NI_MAXHOST]; + char srcport[NI_MAXSERV], dstport[NI_MAXSERV]; + struct sockaddr *lsa, *rsa; + int vni, mc, ipv6; + + bzero(cfg, sizeof(cfg)); + + if (do_cmd(s, VXLAN_CMD_GET_CONFIG, cfg, sizeof(cfg), 0) 0) + return; + + vni = cfg.vxlc_vni; + lsa = cfg.vxlc_local_sa.sa; + rsa = cfg.vxlc_remote_sa.sa; + ipv6 = rsa-sa_family == AF_INET6; + + /* Just report nothing if the network identity isn't set yet. */ + if (vni = VXLAN_VNI_MAX) + return; + + if (getnameinfo(lsa, lsa-sa_len, src, sizeof(src), + srcport, sizeof(srcport), NI_NUMERICHOST | NI_NUMERICSERV) != 0) + src[0] = srcport[0] = '\0'; + if (getnameinfo(rsa, rsa-sa_len, dst, sizeof(dst), + dstport, sizeof(dstport), NI_NUMERICHOST | NI_NUMERICSERV) != 0) + dst[0] = dstport[0] = '\0
Re: svn commit: r273331 - in head: sbin/ifconfig share/man/man4 sys/conf sys/modules sys/modules/if_vxlan sys/net sys/sys
On Mon, Oct 20, 2014 at 5:37 PM, Andrew Thompson thom...@freebsd.org wrote: On 21 October 2014 03:42, Bryan Venteicher bry...@freebsd.org wrote: Author: bryanv Date: Mon Oct 20 14:42:42 2014 New Revision: 273331 URL: https://svnweb.freebsd.org/changeset/base/273331 Log: Add vxlan interface vxlan creates a virtual LAN by encapsulating the inner Ethernet frame in a UDP packet. This implementation is based on RFC7348. Currently, the IPv6 support is not fully compliant with the specification: we should be able to receive UPDv6 packets with a zero checksum, but we need to support RFC6935 first. Patches for this should come soon. Given it is self contained new code is it a 10.1 MFC candidate? I hope to merge vxlan to 10-STABLE in a couple of months, but need to determine how to handle prerequisite commit r272886. There's ways without it - use a mbuf tag and a reserved field in the inpcb - but it would be nice if that commit is MFC'able. https://svnweb.freebsd.org/base?view=revisionrevision=272886 Andrew ___ 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: r273371 - head/sys/net
Author: bryanv Date: Tue Oct 21 05:45:57 2014 New Revision: 273371 URL: https://svnweb.freebsd.org/changeset/base/273371 Log: Use the size of the Ethernet address, not the entire header, when copying into forwarding entry. Reported by: Coverity CID: 1248849 Modified: head/sys/net/if_vxlan.c Modified: head/sys/net/if_vxlan.c == --- head/sys/net/if_vxlan.c Tue Oct 21 05:19:08 2014(r273370) +++ head/sys/net/if_vxlan.c Tue Oct 21 05:45:57 2014(r273371) @@ -716,7 +716,7 @@ vxlan_ftable_entry_init(struct vxlan_sof fe-vxlfe_flags = flags; fe-vxlfe_expire = time_uptime + sc-vxl_ftable_timeout; - memcpy(fe-vxlfe_mac, mac, ETHER_HDR_LEN); + memcpy(fe-vxlfe_mac, mac, ETHER_ADDR_LEN); vxlan_sockaddr_copy(fe-vxlfe_raddr, sa); } ___ 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: r272886 - in head/sys: netinet netinet6
Author: bryanv Date: Fri Oct 10 06:08:59 2014 New Revision: 272886 URL: https://svnweb.freebsd.org/changeset/base/272886 Log: Add context pointer and source address to the UDP tunnel callback These are needed for the forthcoming vxlan implementation. The context pointer means we do not have to use a spare pointer field in the inpcb, and the source address is required to populate vxlan's forwarding table. While I highly doubt there is an out of tree consumer of the UDP tunneling callback, this change may be a difficult to eventually MFC. Phabricator: https://reviews.freebsd.org/D383 Reviewed by: gnn Modified: head/sys/netinet/sctputil.c head/sys/netinet/udp_usrreq.c head/sys/netinet/udp_var.h head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Fri Oct 10 03:20:12 2014(r272885) +++ head/sys/netinet/sctputil.c Fri Oct 10 06:08:59 2014(r272886) @@ -6832,7 +6832,8 @@ sctp_log_trace(uint32_t subsys, const ch #endif static void -sctp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *ignored) +sctp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *ignored, +const struct sockaddr *sa SCTP_UNUSED, void *ctx SCTP_UNUSED) { struct ip *iph; @@ -6968,7 +6969,7 @@ sctp_over_udp_start(void) } /* Call the special UDP hook. */ if ((ret = udp_set_kernel_tunneling(SCTP_BASE_INFO(udp4_tun_socket), - sctp_recv_udp_tunneled_packet))) { + sctp_recv_udp_tunneled_packet, NULL))) { sctp_over_udp_stop(); return (ret); } @@ -6992,7 +6993,7 @@ sctp_over_udp_start(void) } /* Call the special UDP hook. */ if ((ret = udp_set_kernel_tunneling(SCTP_BASE_INFO(udp6_tun_socket), - sctp_recv_udp_tunneled_packet))) { + sctp_recv_udp_tunneled_packet, NULL))) { sctp_over_udp_stop(); return (ret); } Modified: head/sys/netinet/udp_usrreq.c == --- head/sys/netinet/udp_usrreq.c Fri Oct 10 03:20:12 2014 (r272885) +++ head/sys/netinet/udp_usrreq.c Fri Oct 10 06:08:59 2014 (r272886) @@ -312,7 +312,8 @@ udp_append(struct inpcb *inp, struct ip */ up = intoudpcb(inp); if (up-u_tun_func != NULL) { - (*up-u_tun_func)(n, off, inp); + (*up-u_tun_func)(n, off, inp, (struct sockaddr *)udp_in, + up-u_tun_ctx); return; } @@ -1717,7 +1718,7 @@ udp_attach(struct socket *so, int proto, #endif /* INET */ int -udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f) +udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f, void *ctx) { struct inpcb *inp; struct udpcb *up; @@ -1733,6 +1734,7 @@ udp_set_kernel_tunneling(struct socket * return (EBUSY); } up-u_tun_func = f; + up-u_tun_ctx = ctx; INP_WUNLOCK(inp); return (0); } Modified: head/sys/netinet/udp_var.h == --- head/sys/netinet/udp_var.h Fri Oct 10 03:20:12 2014(r272885) +++ head/sys/netinet/udp_var.h Fri Oct 10 06:08:59 2014(r272886) @@ -55,7 +55,8 @@ struct udpiphdr { struct inpcb; struct mbuf; -typedef void(*udp_tun_func_t)(struct mbuf *, int off, struct inpcb *); +typedef void(*udp_tun_func_t)(struct mbuf *, int off, struct inpcb *, + const struct sockaddr *, void *); /* * UDP control block; one per udp. @@ -65,6 +66,7 @@ struct udpcb { u_int u_flags;/* Generic UDP flags. */ uint16_tu_rxcslen; /* Coverage for incoming datagrams. */ uint16_tu_txcslen; /* Coverage for outgoing datagrams. */ + void*u_tun_ctx; /* Tunneling callback context. */ }; #defineintoudpcb(ip) ((struct udpcb *)(ip)-inp_ppcb) @@ -176,7 +178,8 @@ voidudplite_input(struct mbuf *, int); struct inpcb *udp_notify(struct inpcb *inp, int errno); intudp_shutdown(struct socket *so); -intudp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f); +intudp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f, +void *ctx); #endif /* _KERNEL */ Modified: head/sys/netinet6/udp6_usrreq.c == --- head/sys/netinet6/udp6_usrreq.c Fri Oct 10 03:20:12 2014 (r272885) +++ head/sys/netinet6/udp6_usrreq.c Fri Oct 10 06:08:59 2014 (r272886) @@ -150,7 +150,8 @@ udp6_append(struct inpcb *inp, struct mb */ up = intoudpcb(inp); if
svn commit: r272844 - in head/sys: netinet netinet6
Author: bryanv Date: Thu Oct 9 22:36:21 2014 New Revision: 272844 URL: https://svnweb.freebsd.org/changeset/base/272844 Log: Add missing UDP multicast receive dtrace probes Phabricator: https://reviews.freebsd.org/D924 Reviewed by: rpaulo markj MFC after:1 month Modified: head/sys/netinet/udp_usrreq.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet/udp_usrreq.c == --- head/sys/netinet/udp_usrreq.c Thu Oct 9 20:55:05 2014 (r272843) +++ head/sys/netinet/udp_usrreq.c Thu Oct 9 22:36:21 2014 (r272844) @@ -576,6 +576,8 @@ udp_input(struct mbuf **mp, int *offp, i struct mbuf *n; if ((n = m_copy(m, 0, M_COPYALL)) != NULL) { + UDP_PROBE(receive, NULL, last, ip, + last, uh); udp_append(last, ip, n, iphlen, udp_in); } @@ -607,6 +609,7 @@ udp_input(struct mbuf **mp, int *offp, i INP_INFO_RUNLOCK(pcbinfo); goto badunlocked; } + UDP_PROBE(receive, NULL, last, ip, last, uh); udp_append(last, ip, m, iphlen, udp_in); INP_RUNLOCK(last); INP_INFO_RUNLOCK(pcbinfo); Modified: head/sys/netinet6/udp6_usrreq.c == --- head/sys/netinet6/udp6_usrreq.c Thu Oct 9 20:55:05 2014 (r272843) +++ head/sys/netinet6/udp6_usrreq.c Thu Oct 9 22:36:21 2014 (r272844) @@ -370,6 +370,8 @@ udp6_input(struct mbuf **mp, int *offp, if ((n = m_copy(m, 0, M_COPYALL)) != NULL) { INP_RLOCK(last); + UDP_PROBE(receive, NULL, last, ip6, + last, uh); udp6_append(last, n, off, fromsa); INP_RUNLOCK(last); } ___ 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: r272797 - head/sys/netinet
Author: bryanv Date: Thu Oct 9 05:17:47 2014 New Revision: 272797 URL: https://svnweb.freebsd.org/changeset/base/272797 Log: Check for mbuf copy failure when there are multiple multicast sockets This partitular case is the only path where the mbuf could be NULL. udp_append() checked for a NULL mbuf only after invoking the tunneling callback. Our only in tree tunneling callback - SCTP - assumed a non NULL mbuf, and it is a bit odd to make the callbacks responsible for checking this condition. This also reduces the differences between the IPv4 and IPv6 code. MFC after:1 month Modified: head/sys/netinet/udp_usrreq.c Modified: head/sys/netinet/udp_usrreq.c == --- head/sys/netinet/udp_usrreq.c Thu Oct 9 04:40:19 2014 (r272796) +++ head/sys/netinet/udp_usrreq.c Thu Oct 9 05:17:47 2014 (r272797) @@ -316,9 +316,6 @@ udp_append(struct inpcb *inp, struct ip return; } - if (n == NULL) - return; - off += sizeof(struct udphdr); #ifdef IPSEC @@ -578,8 +575,10 @@ udp_input(struct mbuf **mp, int *offp, i if (last != NULL) { struct mbuf *n; - n = m_copy(m, 0, M_COPYALL); - udp_append(last, ip, n, iphlen, udp_in); + if ((n = m_copy(m, 0, M_COPYALL)) != NULL) { + udp_append(last, ip, n, iphlen, + udp_in); + } INP_RUNLOCK(last); } last = inp; ___ 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: r272801 - head/sys/netinet6
Author: bryanv Date: Thu Oct 9 05:42:07 2014 New Revision: 272801 URL: https://svnweb.freebsd.org/changeset/base/272801 Log: Move the calls to u_tun_func() into udp6_append() A similar cleanup for UDPv4 was performed in r220620. Phabricator: https://reviews.freebsd.org/D383 Reviewed by: gnn MFC after:1 month Modified: head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet6/udp6_usrreq.c == --- head/sys/netinet6/udp6_usrreq.c Thu Oct 9 05:34:28 2014 (r272800) +++ head/sys/netinet6/udp6_usrreq.c Thu Oct 9 05:42:07 2014 (r272801) @@ -141,9 +141,18 @@ udp6_append(struct inpcb *inp, struct mb { struct socket *so; struct mbuf *opts; + struct udpcb *up; INP_LOCK_ASSERT(inp); + /* +* Engage the tunneling protocol. +*/ + up = intoudpcb(inp); + if (up-u_tun_func != NULL) { + (*up-u_tun_func)(n, off, inp); + return; + } #ifdef IPSEC /* Check AH/ESP integrity. */ if (ipsec6_in_reject(n, inp)) { @@ -361,20 +370,7 @@ udp6_input(struct mbuf **mp, int *offp, if ((n = m_copy(m, 0, M_COPYALL)) != NULL) { INP_RLOCK(last); - up = intoudpcb(last); - if (up-u_tun_func == NULL) { - udp6_append(last, n, off, fromsa); - } else { - /* -* Engage the tunneling -* protocol we will have to -* leave the info_lock up, -* since we are hunting -* through multiple UDP's. -* -*/ - (*up-u_tun_func)(n, off, last); - } + udp6_append(last, n, off, fromsa); INP_RUNLOCK(last); } } @@ -404,16 +400,8 @@ udp6_input(struct mbuf **mp, int *offp, } INP_RLOCK(last); INP_INFO_RUNLOCK(pcbinfo); - up = intoudpcb(last); UDP_PROBE(receive, NULL, last, ip6, last, uh); - if (up-u_tun_func == NULL) { - udp6_append(last, m, off, fromsa); - } else { - /* -* Engage the tunneling protocol. -*/ - (*up-u_tun_func)(m, off, last); - } + udp6_append(last, m, off, fromsa); INP_RUNLOCK(last); return (IPPROTO_DONE); } @@ -492,15 +480,7 @@ udp6_input(struct mbuf **mp, int *offp, } } UDP_PROBE(receive, NULL, inp, ip6, inp, uh); - if (up-u_tun_func == NULL) { - udp6_append(inp, m, off, fromsa); - } else { - /* -* Engage the tunneling protocol. -*/ - - (*up-u_tun_func)(m, off, inp); - } + udp6_append(inp, m, off, fromsa); INP_RUNLOCK(inp); return (IPPROTO_DONE); ___ 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: r272722 - stable/10/sys/vm
Author: bryanv Date: Wed Oct 8 04:07:07 2014 New Revision: 272722 URL: https://svnweb.freebsd.org/changeset/base/272722 Log: MFC 272550: Remove stray uma_mtx lock/unlock in zone_drain_wait() Callers of zone_drain_wait(M_WAITOK) do not need to hold (and were not) the uma_mtx, but we would attempt to unlock and relock the mutex if we had to sleep because the zone was already draining. The M_NOWAIT callers may hold the uma_mtx, but we do not sleep in that case. Modified: stable/10/sys/vm/uma_core.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/uma_core.c == --- stable/10/sys/vm/uma_core.c Wed Oct 8 01:03:32 2014(r272721) +++ stable/10/sys/vm/uma_core.c Wed Oct 8 04:07:07 2014(r272722) @@ -898,9 +898,7 @@ zone_drain_wait(uma_zone_t zone, int wai while (zone-uz_flags UMA_ZFLAG_DRAINING) { if (waitok == M_NOWAIT) goto out; - mtx_unlock(uma_mtx); msleep(zone, zone-uz_lockptr, PVM, zonedrain, 1); - mtx_lock(uma_mtx); } zone-uz_flags |= UMA_ZFLAG_DRAINING; bucket_cache_drain(zone); ___ 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: r272723 - stable/9/sys/vm
Author: bryanv Date: Wed Oct 8 04:11:05 2014 New Revision: 272723 URL: https://svnweb.freebsd.org/changeset/base/272723 Log: MFC 272550: Remove stray uma_mtx lock/unlock in zone_drain_wait() Callers of zone_drain_wait(M_WAITOK) do not need to hold (and were not) the uma_mtx, but we would attempt to unlock and relock the mutex if we had to sleep because the zone was already draining. The M_NOWAIT callers may hold the uma_mtx, but we do not sleep in that case. Modified: stable/9/sys/vm/uma_core.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/uma_core.c == --- stable/9/sys/vm/uma_core.c Wed Oct 8 04:07:07 2014(r272722) +++ stable/9/sys/vm/uma_core.c Wed Oct 8 04:11:05 2014(r272723) @@ -761,9 +761,7 @@ zone_drain_wait(uma_zone_t zone, int wai while (zone-uz_flags UMA_ZFLAG_DRAINING) { if (waitok == M_NOWAIT) goto out; - mtx_unlock(uma_mtx); msleep(zone, zone-uz_lock, PVM, zonedrain, 1); - mtx_lock(uma_mtx); } zone-uz_flags |= UMA_ZFLAG_DRAINING; bucket_cache_drain(zone); ___ 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: r272725 - stable/8/sys/vm
Author: bryanv Date: Wed Oct 8 04:34:46 2014 New Revision: 272725 URL: https://svnweb.freebsd.org/changeset/base/272725 Log: MFC 272550: Remove stray uma_mtx lock/unlock in zone_drain_wait() Callers of zone_drain_wait(M_WAITOK) do not need to hold (and were not) the uma_mtx, but we would attempt to unlock and relock the mutex if we had to sleep because the zone was already draining. The M_NOWAIT callers may hold the uma_mtx, but we do not sleep in that case. Modified: stable/8/sys/vm/uma_core.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/vm/ (props changed) Modified: stable/8/sys/vm/uma_core.c == --- stable/8/sys/vm/uma_core.c Wed Oct 8 04:25:17 2014(r272724) +++ stable/8/sys/vm/uma_core.c Wed Oct 8 04:34:46 2014(r272725) @@ -761,9 +761,7 @@ zone_drain_wait(uma_zone_t zone, int wai while (zone-uz_flags UMA_ZFLAG_DRAINING) { if (waitok == M_NOWAIT) goto out; - mtx_unlock(uma_mtx); msleep(zone, zone-uz_lock, PVM, zonedrain, 1); - mtx_lock(uma_mtx); } zone-uz_flags |= UMA_ZFLAG_DRAINING; bucket_cache_drain(zone); ___ 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: r272573 - head/sys/vm
Author: bryanv Date: Sun Oct 5 21:34:56 2014 New Revision: 272573 URL: https://svnweb.freebsd.org/changeset/base/272573 Log: Change the UMA mutex into a rwlock Acquire the lock in read mode when just needed to ensure the stability of the keg list. The UMA lock may be held for a long time (relatively speaking) in uma_reclaim() on machines with lots of zones/kegs. If the uma_timeout() would fire during that period, subsequent callouts on that CPU may be significantly delayed. Reviewed by: jhb Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Sun Oct 5 21:27:26 2014(r272572) +++ head/sys/vm/uma_core.c Sun Oct 5 21:34:56 2014(r272573) @@ -135,8 +135,8 @@ static LIST_HEAD(,uma_keg) uma_kegs = LI static LIST_HEAD(,uma_zone) uma_cachezones = LIST_HEAD_INITIALIZER(uma_cachezones); -/* This mutex protects the keg list */ -static struct mtx_padalign uma_mtx; +/* This RW lock protects the keg list */ +static struct rwlock_padalign uma_rwlock; /* Linked list of boot time pages */ static LIST_HEAD(,uma_slab) uma_boot_pages = @@ -904,7 +904,7 @@ zone_drain_wait(uma_zone_t zone, int wai ZONE_UNLOCK(zone); /* * The DRAINING flag protects us from being freed while -* we're running. Normally the uma_mtx would protect us but we +* we're running. Normally the uma_rwlock would protect us but we * must be able to release and acquire the right lock for each keg. */ zone_foreach_keg(zone, keg_drain); @@ -1540,9 +1540,9 @@ keg_ctor(void *mem, int size, void *udat LIST_INSERT_HEAD(keg-uk_zones, zone, uz_link); - mtx_lock(uma_mtx); + rw_wlock(uma_rwlock); LIST_INSERT_HEAD(uma_kegs, keg, uk_link); - mtx_unlock(uma_mtx); + rw_wunlock(uma_rwlock); return (0); } @@ -1592,9 +1592,9 @@ zone_ctor(void *mem, int size, void *uda zone-uz_release = arg-release; zone-uz_arg = arg-arg; zone-uz_lockptr = zone-uz_lock; - mtx_lock(uma_mtx); + rw_wlock(uma_rwlock); LIST_INSERT_HEAD(uma_cachezones, zone, uz_link); - mtx_unlock(uma_mtx); + rw_wunlock(uma_rwlock); goto out; } @@ -1611,7 +1611,7 @@ zone_ctor(void *mem, int size, void *uda zone-uz_fini = arg-fini; zone-uz_lockptr = keg-uk_lock; zone-uz_flags |= UMA_ZONE_SECONDARY; - mtx_lock(uma_mtx); + rw_wlock(uma_rwlock); ZONE_LOCK(zone); LIST_FOREACH(z, keg-uk_zones, uz_link) { if (LIST_NEXT(z, uz_link) == NULL) { @@ -1620,7 +1620,7 @@ zone_ctor(void *mem, int size, void *uda } } ZONE_UNLOCK(zone); - mtx_unlock(uma_mtx); + rw_wunlock(uma_rwlock); } else if (keg == NULL) { if ((keg = uma_kcreate(zone, arg-size, arg-uminit, arg-fini, arg-align, arg-flags)) == NULL) @@ -1718,9 +1718,9 @@ zone_dtor(void *arg, int size, void *uda if (!(zone-uz_flags UMA_ZFLAG_INTERNAL)) cache_drain(zone); - mtx_lock(uma_mtx); + rw_wlock(uma_rwlock); LIST_REMOVE(zone, uz_link); - mtx_unlock(uma_mtx); + rw_wunlock(uma_rwlock); /* * XXX there are some races here where * the zone can be drained but zone lock @@ -1742,9 +1742,9 @@ zone_dtor(void *arg, int size, void *uda * We only destroy kegs from non secondary zones. */ if (keg != NULL (zone-uz_flags UMA_ZONE_SECONDARY) == 0) { - mtx_lock(uma_mtx); + rw_wlock(uma_rwlock); LIST_REMOVE(keg, uk_link); - mtx_unlock(uma_mtx); + rw_wunlock(uma_rwlock); zone_free_item(kegs, keg, NULL, SKIP_NONE); } ZONE_LOCK_FINI(zone); @@ -1766,12 +1766,12 @@ zone_foreach(void (*zfunc)(uma_zone_t)) uma_keg_t keg; uma_zone_t zone; - mtx_lock(uma_mtx); + rw_rlock(uma_rwlock); LIST_FOREACH(keg, uma_kegs, uk_link) { LIST_FOREACH(zone, keg-uk_zones, uz_link) zfunc(zone); } - mtx_unlock(uma_mtx); + rw_runlock(uma_rwlock); } /* Public functions */ @@ -1787,7 +1787,7 @@ uma_startup(void *bootmem, int boot_page #ifdef UMA_DEBUG printf(Creating uma keg headers zone and keg.\n); #endif - mtx_init(uma_mtx, UMA lock, NULL, MTX_DEF); + rw_init(uma_rwlock, UMA lock); /* manually create the initial zone */ memset(args, 0, sizeof(args)); @@ -3362,12 +3362,12 @@ sysctl_vm_zone_count(SYSCTL_HANDLER_ARGS int count; count = 0; -
svn commit: r272550 - head/sys/vm
Author: bryanv Date: Sun Oct 5 03:18:30 2014 New Revision: 272550 URL: https://svnweb.freebsd.org/changeset/base/272550 Log: Remove stray uma_mtx lock/unlock in zone_drain_wait() Callers of zone_drain_wait(M_WAITOK) do not need to hold (and were not) the uma_mtx, but we would attempt to unlock and relock the mutex if we had to sleep because the zone was already draining. The M_NOWAIT callers may hold the uma_mtx, but we do not sleep in that case. Reviewed by: jhb MFC after:3 days Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Sun Oct 5 02:52:54 2014(r272549) +++ head/sys/vm/uma_core.c Sun Oct 5 03:18:30 2014(r272550) @@ -897,9 +897,7 @@ zone_drain_wait(uma_zone_t zone, int wai while (zone-uz_flags UMA_ZFLAG_DRAINING) { if (waitok == M_NOWAIT) goto out; - mtx_unlock(uma_mtx); msleep(zone, zone-uz_lockptr, PVM, zonedrain, 1); - mtx_lock(uma_mtx); } zone-uz_flags |= UMA_ZFLAG_DRAINING; bucket_cache_drain(zone); ___ 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: r271603 - head/sbin/ifconfig
Author: bryanv Date: Sun Sep 14 22:10:35 2014 New Revision: 271603 URL: http://svnweb.freebsd.org/changeset/base/271603 Log: Add DEF_CLONE_CMD_ARG2 This will be used in the forthcoming vxlan import. Reviewed by: gnn Phabric: https://reviews.freebsd.org/D382 Modified: head/sbin/ifconfig/ifconfig.h Modified: head/sbin/ifconfig/ifconfig.h == --- head/sbin/ifconfig/ifconfig.h Sun Sep 14 22:03:41 2014 (r271602) +++ head/sbin/ifconfig/ifconfig.h Sun Sep 14 22:10:35 2014 (r271603) @@ -74,6 +74,7 @@ void callback_register(callback_func *, #defineDEF_CMD_ARG2(name, func){ name, NEXTARG2, { .c_func2 = func }, 0, NULL } #defineDEF_CLONE_CMD(name, param, func) { name, param, { .c_func = func }, 1, NULL } #defineDEF_CLONE_CMD_ARG(name, func) { name, NEXTARG, { .c_func = func }, 1, NULL } +#defineDEF_CLONE_CMD_ARG2(name, func) { name, NEXTARG2, { .c_func2 = func }, 1, NULL } struct ifaddrs; struct addrinfo; ___ 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: r270739 - stable/10/sys/dev/vmware/vmxnet3
Author: bryanv Date: Thu Aug 28 04:20:24 2014 New Revision: 270739 URL: http://svnweb.freebsd.org/changeset/base/270739 Log: MFC r267632: Fix GCC compile warning: Variable(s) can be used uninitialized. PR: 193076 Modified: stable/10/sys/dev/vmware/vmxnet3/if_vmx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/vmware/vmxnet3/if_vmx.c == --- stable/10/sys/dev/vmware/vmxnet3/if_vmx.c Thu Aug 28 03:18:27 2014 (r270738) +++ stable/10/sys/dev/vmware/vmxnet3/if_vmx.c Thu Aug 28 04:20:24 2014 (r270739) @@ -2619,10 +2619,12 @@ vmxnet3_txq_offload_ctx(struct vmxnet3_t struct ether_vlan_header *evh; int offset; #if defined(INET) - struct ip *ip, iphdr; + struct ip *ip = NULL; + struct ip iphdr; #endif #if defined(INET6) - struct ip6_hdr *ip6, ip6hdr; + struct ip6_hdr *ip6 = NULL; + struct ip6_hdr ip6hdr; #endif evh = mtod(m, struct ether_vlan_header *); ___ 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: r270509 - stable/10/sys/dev/virtio/network
Author: bryanv Date: Sun Aug 24 19:31:26 2014 New Revision: 270509 URL: http://svnweb.freebsd.org/changeset/base/270509 Log: MFC r270063 (vtnet) The vtnet changes were not originally merged in r270252 since r268480 and r268481 had not been MFC'ed. Modified: stable/10/sys/dev/virtio/network/if_vtnet.c Modified: stable/10/sys/dev/virtio/network/if_vtnet.c == --- stable/10/sys/dev/virtio/network/if_vtnet.c Sun Aug 24 17:10:47 2014 (r270508) +++ stable/10/sys/dev/virtio/network/if_vtnet.c Sun Aug 24 19:31:26 2014 (r270509) @@ -287,6 +287,10 @@ static device_method_t vtnet_methods[] = DEVMETHOD_END }; +#ifdef DEV_NETMAP +#include dev/netmap/if_vtnet_netmap.h +#endif /* DEV_NETMAP */ + static driver_t vtnet_driver = { vtnet, vtnet_methods, @@ -393,6 +397,10 @@ vtnet_attach(device_t dev) goto fail; } +#ifdef DEV_NETMAP + vtnet_netmap_attach(sc); +#endif /* DEV_NETMAP */ + vtnet_start_taskqueues(sc); fail: @@ -422,6 +430,10 @@ vtnet_detach(device_t dev) ether_ifdetach(ifp); } +#ifdef DEV_NETMAP + netmap_detach(ifp); +#endif /* DEV_NETMAP */ + vtnet_free_taskqueues(sc); if (sc-vtnet_vlan_attach != NULL) { @@ -1733,6 +1745,12 @@ vtnet_rxq_eof(struct vtnet_rxq *rxq) VTNET_RXQ_LOCK_ASSERT(rxq); +#ifdef DEV_NETMAP + if (netmap_rx_irq(ifp, 0, deq)) { + return (FALSE); + } +#endif /* DEV_NETMAP */ + while (count-- 0) { m = virtqueue_dequeue(vq, len); if (m == NULL) @@ -2419,6 +2437,13 @@ vtnet_txq_eof(struct vtnet_txq *txq) deq = 0; VTNET_TXQ_LOCK_ASSERT(txq); +#ifdef DEV_NETMAP + if (netmap_tx_irq(txq-vtntx_sc-vtnet_ifp, txq-vtntx_id)) { + virtqueue_disable_intr(vq); // XXX luigi + return 0; // XXX or 1 ? + } +#endif /* DEV_NETMAP */ + while ((txhdr = virtqueue_dequeue(vq, NULL)) != NULL) { m = txhdr-vth_mbuf; deq++; @@ -2893,6 +2918,11 @@ vtnet_init_rx_queues(struct vtnet_softc (%s: too many rx mbufs %d for %d segments, __func__, sc-vtnet_rx_nmbufs, sc-vtnet_rx_nsegs)); +#ifdef DEV_NETMAP + if (vtnet_netmap_init_rx_buffers(sc)) + return 0; +#endif /* DEV_NETMAP */ + for (i = 0; i sc-vtnet_act_vq_pairs; i++) { rxq = sc-vtnet_rxqs[i]; @@ -3045,6 +3075,13 @@ vtnet_init(void *xsc) sc = xsc; +#ifdef DEV_NETMAP + if (!NA(sc-vtnet_ifp)) { + D(try to attach again); + vtnet_netmap_attach(sc); + } +#endif /* DEV_NETMAP */ + VTNET_CORE_LOCK(sc); vtnet_init_locked(sc); VTNET_CORE_UNLOCK(sc); ___ 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: r270334 - stable/10/sys/dev/virtio/network
Author: bryanv Date: Fri Aug 22 15:12:20 2014 New Revision: 270334 URL: http://svnweb.freebsd.org/changeset/base/270334 Log: MFC r268481: Rework when the Tx queue completion interrupt is enabled The Tx interrupt is now kept disabled in the common case, only enabled when the number of free descriptors in the queue falls below a threshold. Transmitted frames are cleared from the VQ before subsequent transmit, or in the watchdog timer. This was a very big performance improvement for an experimental Netmap bhyve backend. Modified: stable/10/sys/dev/virtio/network/if_vtnet.c stable/10/sys/dev/virtio/network/if_vtnetvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/virtio/network/if_vtnet.c == --- stable/10/sys/dev/virtio/network/if_vtnet.c Fri Aug 22 15:10:26 2014 (r270333) +++ stable/10/sys/dev/virtio/network/if_vtnet.c Fri Aug 22 15:12:20 2014 (r270334) @@ -126,6 +126,8 @@ static int vtnet_rxq_eof(struct vtnet_rx static voidvtnet_rx_vq_intr(void *); static voidvtnet_rxq_tq_intr(void *, int); +static int vtnet_txq_below_threshold(struct vtnet_txq *); +static int vtnet_txq_notify(struct vtnet_txq *); static voidvtnet_txq_free_mbufs(struct vtnet_txq *); static int vtnet_txq_offload_ctx(struct vtnet_txq *, struct mbuf *, int *, int *, int *); @@ -147,7 +149,7 @@ static void vtnet_txq_tq_deferred(void * #endif static voidvtnet_txq_start(struct vtnet_txq *); static voidvtnet_txq_tq_intr(void *, int); -static voidvtnet_txq_eof(struct vtnet_txq *); +static int vtnet_txq_eof(struct vtnet_txq *); static voidvtnet_tx_vq_intr(void *); static voidvtnet_tx_start_all(struct vtnet_softc *); @@ -204,6 +206,8 @@ static void vtnet_ifmedia_sts(struct ifn static voidvtnet_get_hwaddr(struct vtnet_softc *); static voidvtnet_set_hwaddr(struct vtnet_softc *); static voidvtnet_vlan_tag_remove(struct mbuf *); +static voidvtnet_set_rx_process_limit(struct vtnet_softc *); +static voidvtnet_set_tx_intr_threshold(struct vtnet_softc *); static voidvtnet_setup_rxq_sysctl(struct sysctl_ctx_list *, struct sysctl_oid_list *, struct vtnet_rxq *); @@ -239,19 +243,6 @@ TUNABLE_INT(hw.vtnet.mq_max_pairs, vt static int vtnet_rx_process_limit = 512; TUNABLE_INT(hw.vtnet.rx_process_limit, vtnet_rx_process_limit); -/* - * Reducing the number of transmit completed interrupts can improve - * performance. To do so, the define below keeps the Tx vq interrupt - * disabled and adds calls to vtnet_txeof() in the start and watchdog - * paths. The price to pay for this is the m_free'ing of transmitted - * mbufs may be delayed until the watchdog fires. - * - * BMV: Reintroduce this later as a run-time option, if it makes - * sense after the EVENT_IDX feature is supported. - * - * #define VTNET_TX_INTR_MODERATION - */ - static uma_zone_t vtnet_tx_header_zone; static struct virtio_feature_desc vtnet_feature_desc[] = { @@ -901,7 +892,6 @@ vtnet_setup_interface(struct vtnet_softc { device_t dev; struct ifnet *ifp; - int limit; dev = sc-vtnet_dev; @@ -1000,11 +990,8 @@ vtnet_setup_interface(struct vtnet_softc vtnet_unregister_vlan, sc, EVENTHANDLER_PRI_FIRST); } - limit = vtnet_tunable_int(sc, rx_process_limit, - vtnet_rx_process_limit); - if (limit 0) - limit = INT_MAX; - sc-vtnet_rx_process_limit = limit; + vtnet_set_rx_process_limit(sc); + vtnet_set_tx_intr_threshold(sc); return (0); } @@ -1895,6 +1882,44 @@ vtnet_rxq_tq_intr(void *xrxq, int pendin VTNET_RXQ_UNLOCK(rxq); } +static int +vtnet_txq_below_threshold(struct vtnet_txq *txq) +{ + struct vtnet_softc *sc; + struct virtqueue *vq; + + sc = txq-vtntx_sc; + vq = txq-vtntx_vq; + + return (virtqueue_nfree(vq) = sc-vtnet_tx_intr_thresh); +} + +static int +vtnet_txq_notify(struct vtnet_txq *txq) +{ + struct virtqueue *vq; + + vq = txq-vtntx_vq; + + txq-vtntx_watchdog = VTNET_TX_TIMEOUT; + virtqueue_notify(vq); + + if (vtnet_txq_enable_intr(txq) == 0) + return (0); + + /* +* Drain frames that were completed since last checked. If this +* causes the queue to go above the threshold, the caller should +* continue transmitting. +*/ + if (vtnet_txq_eof(txq) != 0 vtnet_txq_below_threshold(txq) == 0) { + virtqueue_disable_intr(vq); + return (1); + } + + return (0); +} + static void vtnet_txq_free_mbufs(struct vtnet_txq *txq) { @@ -2169,11 +2194,11 @@ vtnet_start_locked(struct vtnet_txq *txq struct vtnet_softc *sc; struct virtqueue *vq; struct mbuf *m0; - int enq; + int tries,
svn commit: r270270 - stable/10/sys/dev/virtio
Author: bryanv Date: Thu Aug 21 13:27:05 2014 New Revision: 270270 URL: http://svnweb.freebsd.org/changeset/base/270270 Log: MFC r268480: Add accessor to get the number of free descriptors in the virtqueue Modified: stable/10/sys/dev/virtio/virtqueue.c stable/10/sys/dev/virtio/virtqueue.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/virtio/virtqueue.c == --- stable/10/sys/dev/virtio/virtqueue.cThu Aug 21 13:04:34 2014 (r270269) +++ stable/10/sys/dev/virtio/virtqueue.cThu Aug 21 13:27:05 2014 (r270270) @@ -375,6 +375,13 @@ virtqueue_size(struct virtqueue *vq) } int +virtqueue_nfree(struct virtqueue *vq) +{ + + return (vq-vq_free_cnt); +} + +int virtqueue_empty(struct virtqueue *vq) { Modified: stable/10/sys/dev/virtio/virtqueue.h == --- stable/10/sys/dev/virtio/virtqueue.hThu Aug 21 13:04:34 2014 (r270269) +++ stable/10/sys/dev/virtio/virtqueue.hThu Aug 21 13:27:05 2014 (r270270) @@ -86,6 +86,7 @@ vm_paddr_t virtqueue_paddr(struct virtqu int virtqueue_full(struct virtqueue *vq); int virtqueue_empty(struct virtqueue *vq); int virtqueue_size(struct virtqueue *vq); +int virtqueue_nfree(struct virtqueue *vq); int virtqueue_nused(struct virtqueue *vq); voidvirtqueue_notify(struct virtqueue *vq); voidvirtqueue_dump(struct virtqueue *vq); ___ 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: r270252 - in stable/10: sys/conf sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap tools/tools/netmap
On Wed, Aug 20, 2014 at 6:36 PM, Navdeep Parhar n...@freebsd.org wrote: On 08/20/14 16:34, Luigi Rizzo wrote: 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) I'll take care of the cxgbe bits. There's a mega MFC coming soon.. vtnet is on my todo list in the next day. I think there is two commits. Regards, Navdeep ___ 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: r268480 - head/sys/dev/virtio
Author: bryanv Date: Thu Jul 10 05:26:01 2014 New Revision: 268480 URL: http://svnweb.freebsd.org/changeset/base/268480 Log: Add accessor to get the number of free descriptors in the virtqueue MFC after:1 month Modified: head/sys/dev/virtio/virtqueue.c head/sys/dev/virtio/virtqueue.h Modified: head/sys/dev/virtio/virtqueue.c == --- head/sys/dev/virtio/virtqueue.c Thu Jul 10 03:10:56 2014 (r268479) +++ head/sys/dev/virtio/virtqueue.c Thu Jul 10 05:26:01 2014 (r268480) @@ -375,6 +375,13 @@ virtqueue_size(struct virtqueue *vq) } int +virtqueue_nfree(struct virtqueue *vq) +{ + + return (vq-vq_free_cnt); +} + +int virtqueue_empty(struct virtqueue *vq) { Modified: head/sys/dev/virtio/virtqueue.h == --- head/sys/dev/virtio/virtqueue.h Thu Jul 10 03:10:56 2014 (r268479) +++ head/sys/dev/virtio/virtqueue.h Thu Jul 10 05:26:01 2014 (r268480) @@ -86,6 +86,7 @@ vm_paddr_t virtqueue_paddr(struct virtqu int virtqueue_full(struct virtqueue *vq); int virtqueue_empty(struct virtqueue *vq); int virtqueue_size(struct virtqueue *vq); +int virtqueue_nfree(struct virtqueue *vq); int virtqueue_nused(struct virtqueue *vq); voidvirtqueue_notify(struct virtqueue *vq); voidvirtqueue_dump(struct virtqueue *vq); ___ 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: r268481 - head/sys/dev/virtio/network
Author: bryanv Date: Thu Jul 10 05:36:04 2014 New Revision: 268481 URL: http://svnweb.freebsd.org/changeset/base/268481 Log: Rework when the Tx queue completion interrupt is enabled The Tx interrupt is now kept disabled in the common case, only enabled when the number of free descriptors in the queue falls below a threshold. Transmitted frames are cleared from the VQ before subsequent transmit, or in the watchdog timer. This was a very big performance improvement for an experimental Netmap bhyve backend. MFC after:1 month Modified: head/sys/dev/virtio/network/if_vtnet.c head/sys/dev/virtio/network/if_vtnetvar.h Modified: head/sys/dev/virtio/network/if_vtnet.c == --- head/sys/dev/virtio/network/if_vtnet.c Thu Jul 10 05:26:01 2014 (r268480) +++ head/sys/dev/virtio/network/if_vtnet.c Thu Jul 10 05:36:04 2014 (r268481) @@ -128,6 +128,8 @@ static int vtnet_rxq_eof(struct vtnet_rx static voidvtnet_rx_vq_intr(void *); static voidvtnet_rxq_tq_intr(void *, int); +static int vtnet_txq_below_threshold(struct vtnet_txq *); +static int vtnet_txq_notify(struct vtnet_txq *); static voidvtnet_txq_free_mbufs(struct vtnet_txq *); static int vtnet_txq_offload_ctx(struct vtnet_txq *, struct mbuf *, int *, int *, int *); @@ -149,7 +151,7 @@ static void vtnet_txq_tq_deferred(void * #endif static voidvtnet_txq_start(struct vtnet_txq *); static voidvtnet_txq_tq_intr(void *, int); -static voidvtnet_txq_eof(struct vtnet_txq *); +static int vtnet_txq_eof(struct vtnet_txq *); static voidvtnet_tx_vq_intr(void *); static voidvtnet_tx_start_all(struct vtnet_softc *); @@ -206,6 +208,8 @@ static void vtnet_ifmedia_sts(struct ifn static voidvtnet_get_hwaddr(struct vtnet_softc *); static voidvtnet_set_hwaddr(struct vtnet_softc *); static voidvtnet_vlan_tag_remove(struct mbuf *); +static voidvtnet_set_rx_process_limit(struct vtnet_softc *); +static voidvtnet_set_tx_intr_threshold(struct vtnet_softc *); static voidvtnet_setup_rxq_sysctl(struct sysctl_ctx_list *, struct sysctl_oid_list *, struct vtnet_rxq *); @@ -241,19 +245,6 @@ TUNABLE_INT(hw.vtnet.mq_max_pairs, vt static int vtnet_rx_process_limit = 512; TUNABLE_INT(hw.vtnet.rx_process_limit, vtnet_rx_process_limit); -/* - * Reducing the number of transmit completed interrupts can improve - * performance. To do so, the define below keeps the Tx vq interrupt - * disabled and adds calls to vtnet_txeof() in the start and watchdog - * paths. The price to pay for this is the m_free'ing of transmitted - * mbufs may be delayed until the watchdog fires. - * - * BMV: Reintroduce this later as a run-time option, if it makes - * sense after the EVENT_IDX feature is supported. - * - * #define VTNET_TX_INTR_MODERATION - */ - static uma_zone_t vtnet_tx_header_zone; static struct virtio_feature_desc vtnet_feature_desc[] = { @@ -903,7 +894,6 @@ vtnet_setup_interface(struct vtnet_softc { device_t dev; struct ifnet *ifp; - int limit; dev = sc-vtnet_dev; @@ -1002,11 +992,8 @@ vtnet_setup_interface(struct vtnet_softc vtnet_unregister_vlan, sc, EVENTHANDLER_PRI_FIRST); } - limit = vtnet_tunable_int(sc, rx_process_limit, - vtnet_rx_process_limit); - if (limit 0) - limit = INT_MAX; - sc-vtnet_rx_process_limit = limit; + vtnet_set_rx_process_limit(sc); + vtnet_set_tx_intr_threshold(sc); return (0); } @@ -1897,6 +1884,44 @@ vtnet_rxq_tq_intr(void *xrxq, int pendin VTNET_RXQ_UNLOCK(rxq); } +static int +vtnet_txq_below_threshold(struct vtnet_txq *txq) +{ + struct vtnet_softc *sc; + struct virtqueue *vq; + + sc = txq-vtntx_sc; + vq = txq-vtntx_vq; + + return (virtqueue_nfree(vq) = sc-vtnet_tx_intr_thresh); +} + +static int +vtnet_txq_notify(struct vtnet_txq *txq) +{ + struct virtqueue *vq; + + vq = txq-vtntx_vq; + + txq-vtntx_watchdog = VTNET_TX_TIMEOUT; + virtqueue_notify(vq); + + if (vtnet_txq_enable_intr(txq) == 0) + return (0); + + /* +* Drain frames that were completed since last checked. If this +* causes the queue to go above the threshold, the caller should +* continue transmitting. +*/ + if (vtnet_txq_eof(txq) != 0 vtnet_txq_below_threshold(txq) == 0) { + virtqueue_disable_intr(vq); + return (1); + } + + return (0); +} + static void vtnet_txq_free_mbufs(struct vtnet_txq *txq) { @@ -2171,11 +2196,11 @@ vtnet_start_locked(struct vtnet_txq *txq struct vtnet_softc *sc; struct virtqueue *vq; struct mbuf *m0; - int enq; + int tries, enq; sc = txq-vtntx_sc; vq = txq-vtntx_vq; - enq =
svn commit: r268349 - head/sys/netinet6
Author: bryanv Date: Mon Jul 7 00:02:49 2014 New Revision: 268349 URL: http://svnweb.freebsd.org/changeset/base/268349 Log: Use the appropriate IPv6 hashtype defines when looking up the PCBGROUP Reviewed by: adrian@ Modified: head/sys/netinet6/in6_pcbgroup.c Modified: head/sys/netinet6/in6_pcbgroup.c == --- head/sys/netinet6/in6_pcbgroup.cSun Jul 6 23:27:13 2014 (r268348) +++ head/sys/netinet6/in6_pcbgroup.cMon Jul 7 00:02:49 2014 (r268349) @@ -72,9 +72,9 @@ in6_pcbgroup_byhash(struct inpcbinfo *pc #ifdef RSS if ((pcbinfo-ipi_hashfields == IPI_HASHFIELDS_4TUPLE - hashtype == M_HASHTYPE_RSS_TCP_IPV4) || + hashtype == M_HASHTYPE_RSS_TCP_IPV6) || (pcbinfo-ipi_hashfields == IPI_HASHFIELDS_2TUPLE - hashtype == M_HASHTYPE_RSS_IPV4)) + hashtype == M_HASHTYPE_RSS_IPV6)) return (pcbinfo-ipi_pcbgroups[ in6_pcbgroup_getbucket(pcbinfo, hash)]); #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: r268281 - stable/10/sys/dev/vmware/vmxnet3
Author: bryanv Date: Sat Jul 5 03:48:22 2014 New Revision: 268281 URL: http://svnweb.freebsd.org/changeset/base/268281 Log: MFC r268012, r268196: - Remove some write only variables - Give each interrupt a descriptive name when using MSIX Modified: stable/10/sys/dev/vmware/vmxnet3/if_vmx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/vmware/vmxnet3/if_vmx.c == --- stable/10/sys/dev/vmware/vmxnet3/if_vmx.c Sat Jul 5 03:34:52 2014 (r268280) +++ stable/10/sys/dev/vmware/vmxnet3/if_vmx.c Sat Jul 5 03:48:22 2014 (r268281) @@ -692,6 +692,8 @@ vmxnet3_setup_msix_interrupts(struct vmx vmxnet3_txq_intr, txq, intr-vmxi_handler); if (error) return (error); + bus_describe_intr(dev, intr-vmxi_irq, intr-vmxi_handler, + tq%d, i); txq-vxtxq_intr_idx = intr-vmxi_rid - 1; } @@ -701,6 +703,8 @@ vmxnet3_setup_msix_interrupts(struct vmx vmxnet3_rxq_intr, rxq, intr-vmxi_handler); if (error) return (error); + bus_describe_intr(dev, intr-vmxi_irq, intr-vmxi_handler, + rq%d, i); rxq-vxrxq_intr_idx = intr-vmxi_rid - 1; } @@ -708,6 +712,7 @@ vmxnet3_setup_msix_interrupts(struct vmx vmxnet3_event_intr, sc, intr-vmxi_handler); if (error) return (error); + bus_describe_intr(dev, intr-vmxi_irq, intr-vmxi_handler, event); sc-vmx_event_intr_idx = intr-vmxi_rid - 1; return (0); @@ -2219,12 +2224,10 @@ vmxnet3_legacy_intr(void *xsc) struct vmxnet3_softc *sc; struct vmxnet3_rxqueue *rxq; struct vmxnet3_txqueue *txq; - struct ifnet *ifp; sc = xsc; rxq = sc-vmx_rxq[0]; txq = sc-vmx_txq[0]; - ifp = sc-vmx_ifp; if (sc-vmx_intr_type == VMXNET3_IT_LEGACY) { if (vmxnet3_read_bar1(sc, VMXNET3_BAR1_INTR) == 0) @@ -2253,11 +2256,9 @@ vmxnet3_txq_intr(void *xtxq) { struct vmxnet3_softc *sc; struct vmxnet3_txqueue *txq; - struct ifnet *ifp; txq = xtxq; sc = txq-vxtxq_sc; - ifp = sc-vmx_ifp; if (sc-vmx_intr_mask_mode == VMXNET3_IMM_ACTIVE) vmxnet3_disable_intr(sc, txq-vxtxq_intr_idx); @@ -2765,7 +2766,6 @@ static int vmxnet3_txq_encap(struct vmxnet3_txqueue *txq, struct mbuf **m0) { struct vmxnet3_softc *sc; - struct ifnet *ifp; struct vmxnet3_txring *txr; struct vmxnet3_txdesc *txd, *sop; struct mbuf *m; @@ -2774,7 +2774,6 @@ vmxnet3_txq_encap(struct vmxnet3_txqueue int i, gen, nsegs, etype, proto, start, error; sc = txq-vxtxq_sc; - ifp = sc-vmx_ifp; start = 0; txd = NULL; txr = txq-vxtxq_cmd_ring; ___ 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: r268196 - head/sys/dev/vmware/vmxnet3
Author: bryanv Date: Wed Jul 2 23:28:21 2014 New Revision: 268196 URL: http://svnweb.freebsd.org/changeset/base/268196 Log: Remove some write only variables MFC after:3 days Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c == --- head/sys/dev/vmware/vmxnet3/if_vmx.cWed Jul 2 23:23:18 2014 (r268195) +++ head/sys/dev/vmware/vmxnet3/if_vmx.cWed Jul 2 23:28:21 2014 (r268196) @@ -2226,12 +2226,10 @@ vmxnet3_legacy_intr(void *xsc) struct vmxnet3_softc *sc; struct vmxnet3_rxqueue *rxq; struct vmxnet3_txqueue *txq; - struct ifnet *ifp; sc = xsc; rxq = sc-vmx_rxq[0]; txq = sc-vmx_txq[0]; - ifp = sc-vmx_ifp; if (sc-vmx_intr_type == VMXNET3_IT_LEGACY) { if (vmxnet3_read_bar1(sc, VMXNET3_BAR1_INTR) == 0) @@ -2260,11 +2258,9 @@ vmxnet3_txq_intr(void *xtxq) { struct vmxnet3_softc *sc; struct vmxnet3_txqueue *txq; - struct ifnet *ifp; txq = xtxq; sc = txq-vxtxq_sc; - ifp = sc-vmx_ifp; if (sc-vmx_intr_mask_mode == VMXNET3_IMM_ACTIVE) vmxnet3_disable_intr(sc, txq-vxtxq_intr_idx); @@ -2774,7 +2770,6 @@ static int vmxnet3_txq_encap(struct vmxnet3_txqueue *txq, struct mbuf **m0) { struct vmxnet3_softc *sc; - struct ifnet *ifp; struct vmxnet3_txring *txr; struct vmxnet3_txdesc *txd, *sop; struct mbuf *m; @@ -2783,7 +2778,6 @@ vmxnet3_txq_encap(struct vmxnet3_txqueue int i, gen, nsegs, etype, proto, start, error; sc = txq-vxtxq_sc; - ifp = sc-vmx_ifp; start = 0; txd = NULL; txr = txq-vxtxq_cmd_ring; ___ 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: r268010 - in stable/10/sys/dev/virtio: . network pci
Author: bryanv Date: Sun Jun 29 00:37:59 2014 New Revision: 268010 URL: http://svnweb.freebsd.org/changeset/base/268010 Log: MFC r267520, r267521, r267522, r267523, r267524: - Remove two write-only local variables - Remove unused element in the vtnet_rxq structure - Remove kernel specific macro out of the VirtIO PCI header file - Move the VIRTIO_RING_F_* defines out of virtqueue.h into virtio_config.h - Make the feature negotiation code easier to follow - Force two byte alignment for all control message headers Modified: stable/10/sys/dev/virtio/network/if_vtnet.c stable/10/sys/dev/virtio/network/if_vtnetvar.h stable/10/sys/dev/virtio/pci/virtio_pci.c stable/10/sys/dev/virtio/pci/virtio_pci.h stable/10/sys/dev/virtio/virtio.h stable/10/sys/dev/virtio/virtio_config.h stable/10/sys/dev/virtio/virtqueue.c stable/10/sys/dev/virtio/virtqueue.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/virtio/network/if_vtnet.c == --- stable/10/sys/dev/virtio/network/if_vtnet.c Sat Jun 28 23:20:24 2014 (r268009) +++ stable/10/sys/dev/virtio/network/if_vtnet.c Sun Jun 29 00:37:59 2014 (r268010) @@ -550,37 +550,38 @@ vtnet_negotiate_features(struct vtnet_so mask |= VTNET_TSO_FEATURES; if (vtnet_tunable_int(sc, lro_disable, vtnet_lro_disable)) mask |= VTNET_LRO_FEATURES; +#ifndef VTNET_LEGACY_TX if (vtnet_tunable_int(sc, mq_disable, vtnet_mq_disable)) mask |= VIRTIO_NET_F_MQ; -#ifdef VTNET_LEGACY_TX +#else mask |= VIRTIO_NET_F_MQ; #endif features = VTNET_FEATURES ~mask; sc-vtnet_features = virtio_negotiate_features(dev, features); - if (virtio_with_feature(dev, VTNET_LRO_FEATURES) == 0) - return; - if (virtio_with_feature(dev, VIRTIO_NET_F_MRG_RXBUF)) - return; - - /* -* LRO without mergeable buffers requires special care. This is not -* ideal because every receive buffer must be large enough to hold -* the maximum TCP packet, the Ethernet header, and the header. This -* requires up to 34 descriptors with MCLBYTES clusters. If we do -* not have indirect descriptors, LRO is disabled since the virtqueue -* will not contain very many receive buffers. -*/ - if (virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC) == 0) { - device_printf(dev, - LRO disabled due to both mergeable buffers and indirect - descriptors not negotiated\n); + if (virtio_with_feature(dev, VTNET_LRO_FEATURES) + virtio_with_feature(dev, VIRTIO_NET_F_MRG_RXBUF) == 0) { + /* +* LRO without mergeable buffers requires special care. This +* is not ideal because every receive buffer must be large +* enough to hold the maximum TCP packet, the Ethernet header, +* and the header. This requires up to 34 descriptors with +* MCLBYTES clusters. If we do not have indirect descriptors, +* LRO is disabled since the virtqueue will not contain very +* many receive buffers. +*/ + if (!virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC)) { + device_printf(dev, + LRO disabled due to both mergeable buffers and + indirect descriptors not negotiated\n); - features = ~VTNET_LRO_FEATURES; - sc-vtnet_features = virtio_negotiate_features(dev, features); - } else - sc-vtnet_flags |= VTNET_FLAG_LRO_NOMRG; + features = ~VTNET_LRO_FEATURES; + sc-vtnet_features = + virtio_negotiate_features(dev, features); + } else + sc-vtnet_flags |= VTNET_FLAG_LRO_NOMRG; + } } static void @@ -2111,13 +2112,11 @@ fail: static int vtnet_txq_encap(struct vtnet_txq *txq, struct mbuf **m_head) { - struct vtnet_softc *sc; struct vtnet_tx_header *txhdr; struct virtio_net_hdr *hdr; struct mbuf *m; int error; - sc = txq-vtntx_sc; m = *m_head; M_ASSERTPKTHDR(m); @@ -2944,11 +2943,9 @@ vtnet_set_active_vq_pairs(struct vtnet_s static int vtnet_reinit(struct vtnet_softc *sc) { - device_t dev; struct ifnet *ifp; int error; - dev = sc-vtnet_dev; ifp = sc-vtnet_ifp; /* Use the current MAC address. */ @@ -3069,7 +3066,7 @@ vtnet_exec_ctrl_cmd(struct vtnet_softc * static int vtnet_ctrl_mac_cmd(struct vtnet_softc *sc, uint8_t *hwaddr) { - struct virtio_net_ctrl_hdr hdr; + struct virtio_net_ctrl_hdr hdr __aligned(2); struct sglist_seg segs[3];
svn commit: r268011 - stable/10/sys/dev/vmware/vmxnet3
Author: bryanv Date: Sun Jun 29 00:50:56 2014 New Revision: 268011 URL: http://svnweb.freebsd.org/changeset/base/268011 Log: MFC r267661, r267662, r267663: - Remove an unnecessary kick of the host at the end of transmitting - Handle multiple calls to rxq_eof for single packet completion - Increment the pending packets more aggressively for TSO Modified: stable/10/sys/dev/vmware/vmxnet3/if_vmx.c stable/10/sys/dev/vmware/vmxnet3/if_vmxvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/vmware/vmxnet3/if_vmx.c == --- stable/10/sys/dev/vmware/vmxnet3/if_vmx.c Sun Jun 29 00:37:59 2014 (r268010) +++ stable/10/sys/dev/vmware/vmxnet3/if_vmx.c Sun Jun 29 00:50:56 2014 (r268011) @@ -166,7 +166,6 @@ static int vmxnet3_txq_load_mbuf(struct bus_dmamap_t, bus_dma_segment_t [], int *); static voidvmxnet3_txq_unload_mbuf(struct vmxnet3_txqueue *, bus_dmamap_t); static int vmxnet3_txq_encap(struct vmxnet3_txqueue *, struct mbuf **); -static voidvmxnet3_txq_update_pending(struct vmxnet3_txqueue *); #ifdef VMXNET3_LEGACY_TX static voidvmxnet3_start_locked(struct ifnet *); static voidvmxnet3_start(struct ifnet *); @@ -2086,17 +2085,25 @@ vmxnet3_rxq_eof(struct vmxnet3_rxqueue * sc = rxq-vxrxq_sc; ifp = sc-vmx_ifp; rxc = rxq-vxrxq_comp_ring; - m_head = m_tail = NULL; VMXNET3_RXQ_LOCK_ASSERT(rxq); if ((ifp-if_drv_flags IFF_DRV_RUNNING) == 0) return; + m_head = rxq-vxrxq_mhead; + rxq-vxrxq_mhead = NULL; + m_tail = rxq-vxrxq_mtail; + rxq-vxrxq_mtail = NULL; + MPASS(m_head == NULL || m_tail != NULL); + for (;;) { rxcd = rxc-vxcr_u.rxcd[rxc-vxcr_next]; - if (rxcd-gen != rxc-vxcr_gen) + if (rxcd-gen != rxc-vxcr_gen) { + rxq-vxrxq_mhead = m_head; + rxq-vxrxq_mtail = m_tail; break; + } vmxnet3_barrier(sc, VMXNET3_BARRIER_RD); if (++rxc-vxcr_next == rxc-vxcr_ndesc) { @@ -2328,6 +2335,12 @@ vmxnet3_rxstop(struct vmxnet3_softc *sc, struct vmxnet3_rxbuf *rxb; int i, j; + if (rxq-vxrxq_mhead != NULL) { + m_freem(rxq-vxrxq_mhead); + rxq-vxrxq_mhead = NULL; + rxq-vxrxq_mtail = NULL; + } + for (i = 0; i VMXNET3_RXRINGS_PERQ; i++) { rxr = rxq-vxrxq_cmd_ring[i]; @@ -2839,7 +2852,8 @@ vmxnet3_txq_encap(struct vmxnet3_txqueue vmxnet3_barrier(sc, VMXNET3_BARRIER_WR); sop-gen ^= 1; - if (++txq-vxtxq_ts-npending = txq-vxtxq_ts-intr_threshold) { + txq-vxtxq_ts-npending += nsegs; + if (txq-vxtxq_ts-npending = txq-vxtxq_ts-intr_threshold) { txq-vxtxq_ts-npending = 0; vmxnet3_write_bar0(sc, VMXNET3_BAR0_TXH(txq-vxtxq_id), txr-vxtxr_head); @@ -2848,20 +2862,6 @@ vmxnet3_txq_encap(struct vmxnet3_txqueue return (0); } -static void -vmxnet3_txq_update_pending(struct vmxnet3_txqueue *txq) -{ - struct vmxnet3_txring *txr; - - txr = txq-vxtxq_cmd_ring; - - if (txq-vxtxq_ts-npending 0) { - txq-vxtxq_ts-npending = 0; - vmxnet3_write_bar0(txq-vxtxq_sc, - VMXNET3_BAR0_TXH(txq-vxtxq_id), txr-vxtxr_head); - } -} - #ifdef VMXNET3_LEGACY_TX static void @@ -2908,10 +2908,8 @@ vmxnet3_start_locked(struct ifnet *ifp) ETHER_BPF_MTAP(ifp, m_head); } - if (tx 0) { - vmxnet3_txq_update_pending(txq); + if (tx 0) txq-vxtxq_watchdog = VMXNET3_WATCHDOG_TIMEOUT; - } } static void @@ -2972,8 +2970,7 @@ vmxnet3_txq_mq_start_locked(struct vmxne break; } - error = vmxnet3_txq_encap(txq, m); - if (error) { + if (vmxnet3_txq_encap(txq, m) != 0) { if (m != NULL) drbr_putback(ifp, br, m); else @@ -2986,10 +2983,8 @@ vmxnet3_txq_mq_start_locked(struct vmxne ETHER_BPF_MTAP(ifp, m); } - if (tx 0) { - vmxnet3_txq_update_pending(txq); + if (tx 0) txq-vxtxq_watchdog = VMXNET3_WATCHDOG_TIMEOUT; - } return (0); } Modified: stable/10/sys/dev/vmware/vmxnet3/if_vmxvar.h == --- stable/10/sys/dev/vmware/vmxnet3/if_vmxvar.hSun Jun 29 00:37:59 2014(r268010) +++ stable/10/sys/dev/vmware/vmxnet3/if_vmxvar.hSun Jun 29 00:50:56 2014(r268011) @@ -168,6 +168,8 @@ struct vmxnet3_rxqueue { struct vmxnet3_softc*vxrxq_sc;
svn commit: r268012 - head/sys/dev/vmware/vmxnet3
Author: bryanv Date: Sun Jun 29 01:04:11 2014 New Revision: 268012 URL: http://svnweb.freebsd.org/changeset/base/268012 Log: Give each interrupt a descriptive name when using MSIX MFC after:3 days Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c == --- head/sys/dev/vmware/vmxnet3/if_vmx.cSun Jun 29 00:50:56 2014 (r268011) +++ head/sys/dev/vmware/vmxnet3/if_vmx.cSun Jun 29 01:04:11 2014 (r268012) @@ -694,6 +694,8 @@ vmxnet3_setup_msix_interrupts(struct vmx vmxnet3_txq_intr, txq, intr-vmxi_handler); if (error) return (error); + bus_describe_intr(dev, intr-vmxi_irq, intr-vmxi_handler, + tq%d, i); txq-vxtxq_intr_idx = intr-vmxi_rid - 1; } @@ -703,6 +705,8 @@ vmxnet3_setup_msix_interrupts(struct vmx vmxnet3_rxq_intr, rxq, intr-vmxi_handler); if (error) return (error); + bus_describe_intr(dev, intr-vmxi_irq, intr-vmxi_handler, + rq%d, i); rxq-vxrxq_intr_idx = intr-vmxi_rid - 1; } @@ -710,6 +714,7 @@ vmxnet3_setup_msix_interrupts(struct vmx vmxnet3_event_intr, sc, intr-vmxi_handler); if (error) return (error); + bus_describe_intr(dev, intr-vmxi_irq, intr-vmxi_handler, event); sc-vmx_event_intr_idx = intr-vmxi_rid - 1; 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: r267661 - head/sys/dev/vmware/vmxnet3
Author: bryanv Date: Fri Jun 20 02:31:52 2014 New Revision: 267661 URL: http://svnweb.freebsd.org/changeset/base/267661 Log: Remove an unnecessary kick of the host at the end of transmitting MFC after:1 week Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c == --- head/sys/dev/vmware/vmxnet3/if_vmx.cFri Jun 20 01:45:03 2014 (r267660) +++ head/sys/dev/vmware/vmxnet3/if_vmx.cFri Jun 20 02:31:52 2014 (r267661) @@ -168,7 +168,6 @@ static int vmxnet3_txq_load_mbuf(struct bus_dmamap_t, bus_dma_segment_t [], int *); static voidvmxnet3_txq_unload_mbuf(struct vmxnet3_txqueue *, bus_dmamap_t); static int vmxnet3_txq_encap(struct vmxnet3_txqueue *, struct mbuf **); -static voidvmxnet3_txq_update_pending(struct vmxnet3_txqueue *); #ifdef VMXNET3_LEGACY_TX static voidvmxnet3_start_locked(struct ifnet *); static voidvmxnet3_start(struct ifnet *); @@ -2852,20 +2851,6 @@ vmxnet3_txq_encap(struct vmxnet3_txqueue return (0); } -static void -vmxnet3_txq_update_pending(struct vmxnet3_txqueue *txq) -{ - struct vmxnet3_txring *txr; - - txr = txq-vxtxq_cmd_ring; - - if (txq-vxtxq_ts-npending 0) { - txq-vxtxq_ts-npending = 0; - vmxnet3_write_bar0(txq-vxtxq_sc, - VMXNET3_BAR0_TXH(txq-vxtxq_id), txr-vxtxr_head); - } -} - #ifdef VMXNET3_LEGACY_TX static void @@ -2912,10 +2897,8 @@ vmxnet3_start_locked(struct ifnet *ifp) ETHER_BPF_MTAP(ifp, m_head); } - if (tx 0) { - vmxnet3_txq_update_pending(txq); + if (tx 0) txq-vxtxq_watchdog = VMXNET3_WATCHDOG_TIMEOUT; - } } static void @@ -2990,10 +2973,8 @@ vmxnet3_txq_mq_start_locked(struct vmxne ETHER_BPF_MTAP(ifp, m); } - if (tx 0) { - vmxnet3_txq_update_pending(txq); + if (tx 0) txq-vxtxq_watchdog = VMXNET3_WATCHDOG_TIMEOUT; - } 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: r267662 - head/sys/dev/vmware/vmxnet3
Author: bryanv Date: Fri Jun 20 02:49:03 2014 New Revision: 267662 URL: http://svnweb.freebsd.org/changeset/base/267662 Log: Handle multiple calls to rxq_eof for single packet completion This requires the VMware vmxnet3 device to flip the start of packet descriptor's generation before the rest of the packet's descriptors have been loaded into the Rx ring. I've never observed this behavior, and it seems to make the most sense not to do it this way. But it is not a lot of work for the driver to handle this situation just in case. MFC after:1 week Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c head/sys/dev/vmware/vmxnet3/if_vmxvar.h Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c == --- head/sys/dev/vmware/vmxnet3/if_vmx.cFri Jun 20 02:31:52 2014 (r267661) +++ head/sys/dev/vmware/vmxnet3/if_vmx.cFri Jun 20 02:49:03 2014 (r267662) @@ -2087,17 +2087,25 @@ vmxnet3_rxq_eof(struct vmxnet3_rxqueue * sc = rxq-vxrxq_sc; ifp = sc-vmx_ifp; rxc = rxq-vxrxq_comp_ring; - m_head = m_tail = NULL; VMXNET3_RXQ_LOCK_ASSERT(rxq); if ((ifp-if_drv_flags IFF_DRV_RUNNING) == 0) return; + m_head = rxq-vxrxq_mhead; + rxq-vxrxq_mhead = NULL; + m_tail = rxq-vxrxq_mtail; + rxq-vxrxq_mtail = NULL; + MPASS(m_head == NULL || m_tail != NULL); + for (;;) { rxcd = rxc-vxcr_u.rxcd[rxc-vxcr_next]; - if (rxcd-gen != rxc-vxcr_gen) + if (rxcd-gen != rxc-vxcr_gen) { + rxq-vxrxq_mhead = m_head; + rxq-vxrxq_mtail = m_tail; break; + } vmxnet3_barrier(sc, VMXNET3_BARRIER_RD); if (++rxc-vxcr_next == rxc-vxcr_ndesc) { @@ -2329,6 +2337,12 @@ vmxnet3_rxstop(struct vmxnet3_softc *sc, struct vmxnet3_rxbuf *rxb; int i, j; + if (rxq-vxrxq_mhead != NULL) { + m_freem(rxq-vxrxq_mhead); + rxq-vxrxq_mhead = NULL; + rxq-vxrxq_mtail = NULL; + } + for (i = 0; i VMXNET3_RXRINGS_PERQ; i++) { rxr = rxq-vxrxq_cmd_ring[i]; Modified: head/sys/dev/vmware/vmxnet3/if_vmxvar.h == --- head/sys/dev/vmware/vmxnet3/if_vmxvar.h Fri Jun 20 02:31:52 2014 (r267661) +++ head/sys/dev/vmware/vmxnet3/if_vmxvar.h Fri Jun 20 02:49:03 2014 (r267662) @@ -168,6 +168,8 @@ struct vmxnet3_rxqueue { struct vmxnet3_softc*vxrxq_sc; int vxrxq_id; int vxrxq_intr_idx; + struct mbuf *vxrxq_mhead; + struct mbuf *vxrxq_mtail; struct vmxnet3_rxringvxrxq_cmd_ring[VMXNET3_RXRINGS_PERQ]; struct vmxnet3_comp_ring vxrxq_comp_ring; struct vmxnet3_rxq_stats vxrxq_stats; ___ 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: r267663 - head/sys/dev/vmware/vmxnet3
Author: bryanv Date: Fri Jun 20 02:54:04 2014 New Revision: 267663 URL: http://svnweb.freebsd.org/changeset/base/267663 Log: Increment the pending packets more aggressively for TSO Assume the number of description used is reasonable value to increment this otherwise opaque field by. While here, reduce a minor difference between the legacy and multiqueue transmit paths. MFC after:1 week Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c == --- head/sys/dev/vmware/vmxnet3/if_vmx.cFri Jun 20 02:49:03 2014 (r267662) +++ head/sys/dev/vmware/vmxnet3/if_vmx.cFri Jun 20 02:54:04 2014 (r267663) @@ -2856,7 +2856,8 @@ vmxnet3_txq_encap(struct vmxnet3_txqueue vmxnet3_barrier(sc, VMXNET3_BARRIER_WR); sop-gen ^= 1; - if (++txq-vxtxq_ts-npending = txq-vxtxq_ts-intr_threshold) { + txq-vxtxq_ts-npending += nsegs; + if (txq-vxtxq_ts-npending = txq-vxtxq_ts-intr_threshold) { txq-vxtxq_ts-npending = 0; vmxnet3_write_bar0(sc, VMXNET3_BAR0_TXH(txq-vxtxq_id), txr-vxtxr_head); @@ -2973,8 +2974,7 @@ vmxnet3_txq_mq_start_locked(struct vmxne break; } - error = vmxnet3_txq_encap(txq, m); - if (error) { + if (vmxnet3_txq_encap(txq, m) != 0) { if (m != NULL) drbr_putback(ifp, br, m); else ___ 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: r267562 - stable/10/sys/dev/virtio/block
Author: bryanv Date: Tue Jun 17 05:24:45 2014 New Revision: 267562 URL: http://svnweb.freebsd.org/changeset/base/267562 Log: MFC r267313: Always append new bios to the tail of the queue, instead of sorting them Modified: stable/10/sys/dev/virtio/block/virtio_blk.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/virtio/block/virtio_blk.c == --- stable/10/sys/dev/virtio/block/virtio_blk.c Tue Jun 17 05:21:48 2014 (r267561) +++ stable/10/sys/dev/virtio/block/virtio_blk.c Tue Jun 17 05:24:45 2014 (r267562) @@ -577,7 +577,7 @@ vtblk_strategy(struct bio *bp) if (sc-vtblk_flags VTBLK_FLAG_DETACH) vtblk_finish_bio(bp, ENXIO); else { - bioq_disksort(sc-vtblk_bioq, bp); + bioq_insert_tail(sc-vtblk_bioq, bp); if ((sc-vtblk_flags VTBLK_FLAG_SUSPEND) == 0) vtblk_startio(sc); ___ 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: r267520 - head/sys/dev/virtio/network
Author: bryanv Date: Mon Jun 16 04:12:33 2014 New Revision: 267520 URL: http://svnweb.freebsd.org/changeset/base/267520 Log: - Remove two write-only local variables - Remove unused element in the vtnet_rxq structure MFC after:1 week Modified: head/sys/dev/virtio/network/if_vtnet.c head/sys/dev/virtio/network/if_vtnetvar.h Modified: head/sys/dev/virtio/network/if_vtnet.c == --- head/sys/dev/virtio/network/if_vtnet.c Sun Jun 15 20:14:11 2014 (r267519) +++ head/sys/dev/virtio/network/if_vtnet.c Mon Jun 16 04:12:33 2014 (r267520) @@ -2113,13 +2113,11 @@ fail: static int vtnet_txq_encap(struct vtnet_txq *txq, struct mbuf **m_head) { - struct vtnet_softc *sc; struct vtnet_tx_header *txhdr; struct virtio_net_hdr *hdr; struct mbuf *m; int error; - sc = txq-vtntx_sc; m = *m_head; M_ASSERTPKTHDR(m); @@ -2946,11 +2944,9 @@ vtnet_set_active_vq_pairs(struct vtnet_s static int vtnet_reinit(struct vtnet_softc *sc) { - device_t dev; struct ifnet *ifp; int error; - dev = sc-vtnet_dev; ifp = sc-vtnet_ifp; /* Use the current MAC address. */ Modified: head/sys/dev/virtio/network/if_vtnetvar.h == --- head/sys/dev/virtio/network/if_vtnetvar.h Sun Jun 15 20:14:11 2014 (r267519) +++ head/sys/dev/virtio/network/if_vtnetvar.h Mon Jun 16 04:12:33 2014 (r267520) @@ -74,7 +74,6 @@ struct vtnet_rxq { struct virtqueue*vtnrx_vq; struct sglist *vtnrx_sg; int vtnrx_id; - int vtnrx_process_limit; struct vtnet_rxq_stats vtnrx_stats; struct taskqueue*vtnrx_tq; struct task vtnrx_intrtask; ___ 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: r267521 - head/sys/dev/virtio/pci
Author: bryanv Date: Mon Jun 16 04:16:31 2014 New Revision: 267521 URL: http://svnweb.freebsd.org/changeset/base/267521 Log: Remove kernel specific macro out of the VirtIO PCI header file The eventual goal is to share this file with userland, so remove the macro that is only specific for virtio_pci(4). Instead, add the VIRTIO_PCI_CONFIG_OFF macro from Linux to get the config size whether MSIX is enabled or not. MFC after:1 week Modified: head/sys/dev/virtio/pci/virtio_pci.c head/sys/dev/virtio/pci/virtio_pci.h Modified: head/sys/dev/virtio/pci/virtio_pci.c == --- head/sys/dev/virtio/pci/virtio_pci.cMon Jun 16 04:12:33 2014 (r267520) +++ head/sys/dev/virtio/pci/virtio_pci.cMon Jun 16 04:16:31 2014 (r267521) @@ -170,6 +170,9 @@ static void vtpci_config_intr(void *); #define vtpci_setup_msi_interrupt vtpci_setup_legacy_interrupt +#define VIRTIO_PCI_CONFIG(_sc) \ +VIRTIO_PCI_CONFIG_OFF_sc)-vtpci_flags VTPCI_FLAG_MSIX)) != 0) + /* * I/O port read/write wrappers. */ Modified: head/sys/dev/virtio/pci/virtio_pci.h == --- head/sys/dev/virtio/pci/virtio_pci.hMon Jun 16 04:12:33 2014 (r267520) +++ head/sys/dev/virtio/pci/virtio_pci.hMon Jun 16 04:16:31 2014 (r267521) @@ -72,8 +72,7 @@ * The remaining space is defined by each driver as the per-driver * configuration space. */ -#define VIRTIO_PCI_CONFIG(sc) \ -(((sc)-vtpci_flags VTPCI_FLAG_MSIX) ? 24 : 20) +#define VIRTIO_PCI_CONFIG_OFF(msix_enabled) ((msix_enabled) ? 24 : 20) /* * How many bits to shift physical queue address written to QUEUE_PFN. ___ 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: r267522 - in head/sys/dev/virtio: . pci
Author: bryanv Date: Mon Jun 16 04:25:04 2014 New Revision: 267522 URL: http://svnweb.freebsd.org/changeset/base/267522 Log: Move the VIRTIO_RING_F_* defines out of virtqueue.h into virtio_config.h These defines are applicable to userland too, but virtqueue.h contains the kernel virtqueue interface, and is therefore not usable in userland. Note that Linux places these defines in virtio_ring.h, but I don't want the drivers including this header file to keep the VirtIO ring opaque to everything but the virtqueue. MFC after:1 week Modified: head/sys/dev/virtio/pci/virtio_pci.c head/sys/dev/virtio/virtio.h head/sys/dev/virtio/virtio_config.h head/sys/dev/virtio/virtqueue.c head/sys/dev/virtio/virtqueue.h Modified: head/sys/dev/virtio/pci/virtio_pci.c == --- head/sys/dev/virtio/pci/virtio_pci.cMon Jun 16 04:16:31 2014 (r267521) +++ head/sys/dev/virtio/pci/virtio_pci.cMon Jun 16 04:25:04 2014 (r267522) @@ -45,7 +45,6 @@ __FBSDID($FreeBSD$); #include dev/pci/pcireg.h #include dev/virtio/virtio.h -#include dev/virtio/virtio_config.h #include dev/virtio/virtqueue.h #include dev/virtio/pci/virtio_pci.h Modified: head/sys/dev/virtio/virtio.h == --- head/sys/dev/virtio/virtio.hMon Jun 16 04:16:31 2014 (r267521) +++ head/sys/dev/virtio/virtio.hMon Jun 16 04:25:04 2014 (r267522) @@ -30,6 +30,7 @@ #define _VIRTIO_H_ #include dev/virtio/virtio_ids.h +#include dev/virtio/virtio_config.h struct vq_alloc_info; Modified: head/sys/dev/virtio/virtio_config.h == --- head/sys/dev/virtio/virtio_config.h Mon Jun 16 04:16:31 2014 (r267521) +++ head/sys/dev/virtio/virtio_config.h Mon Jun 16 04:25:04 2014 (r267522) @@ -44,6 +44,12 @@ */ #define VIRTIO_F_NOTIFY_ON_EMPTY (1 24) +/* Support for indirect buffer descriptors. */ +#define VIRTIO_RING_F_INDIRECT_DESC(1 28) + +/* Support to suppress interrupt until specific index is reached. */ +#define VIRTIO_RING_F_EVENT_IDX(1 29) + /* * The guest should never negotiate this feature; it * is used to detect faulty drivers. Modified: head/sys/dev/virtio/virtqueue.c == --- head/sys/dev/virtio/virtqueue.c Mon Jun 16 04:16:31 2014 (r267521) +++ head/sys/dev/virtio/virtqueue.c Mon Jun 16 04:25:04 2014 (r267522) @@ -48,7 +48,6 @@ __FBSDID($FreeBSD$); #include sys/rman.h #include dev/virtio/virtio.h -#include dev/virtio/virtio_config.h #include dev/virtio/virtqueue.h #include dev/virtio/virtio_ring.h Modified: head/sys/dev/virtio/virtqueue.h == --- head/sys/dev/virtio/virtqueue.h Mon Jun 16 04:16:31 2014 (r267521) +++ head/sys/dev/virtio/virtqueue.h Mon Jun 16 04:25:04 2014 (r267522) @@ -32,12 +32,6 @@ struct virtqueue; struct sglist; -/* Support for indirect buffer descriptors. */ -#define VIRTIO_RING_F_INDIRECT_DESC(1 28) - -/* Support to suppress interrupt until specific index is reached. */ -#define VIRTIO_RING_F_EVENT_IDX(1 29) - /* Device callback for a virtqueue interrupt. */ typedef void virtqueue_intr_t(void *); ___ 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: r267523 - head/sys/dev/virtio/network
Author: bryanv Date: Mon Jun 16 04:29:28 2014 New Revision: 267523 URL: http://svnweb.freebsd.org/changeset/base/267523 Log: Make the feature negotiation code easier to follow MFC after:1 week 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 Mon Jun 16 04:25:04 2014 (r267522) +++ head/sys/dev/virtio/network/if_vtnet.c Mon Jun 16 04:29:28 2014 (r267523) @@ -552,37 +552,38 @@ vtnet_negotiate_features(struct vtnet_so mask |= VTNET_TSO_FEATURES; if (vtnet_tunable_int(sc, lro_disable, vtnet_lro_disable)) mask |= VTNET_LRO_FEATURES; +#ifndef VTNET_LEGACY_TX if (vtnet_tunable_int(sc, mq_disable, vtnet_mq_disable)) mask |= VIRTIO_NET_F_MQ; -#ifdef VTNET_LEGACY_TX +#else mask |= VIRTIO_NET_F_MQ; #endif features = VTNET_FEATURES ~mask; sc-vtnet_features = virtio_negotiate_features(dev, features); - if (virtio_with_feature(dev, VTNET_LRO_FEATURES) == 0) - return; - if (virtio_with_feature(dev, VIRTIO_NET_F_MRG_RXBUF)) - return; - - /* -* LRO without mergeable buffers requires special care. This is not -* ideal because every receive buffer must be large enough to hold -* the maximum TCP packet, the Ethernet header, and the header. This -* requires up to 34 descriptors with MCLBYTES clusters. If we do -* not have indirect descriptors, LRO is disabled since the virtqueue -* will not contain very many receive buffers. -*/ - if (virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC) == 0) { - device_printf(dev, - LRO disabled due to both mergeable buffers and indirect - descriptors not negotiated\n); + if (virtio_with_feature(dev, VTNET_LRO_FEATURES) + virtio_with_feature(dev, VIRTIO_NET_F_MRG_RXBUF) == 0) { + /* +* LRO without mergeable buffers requires special care. This +* is not ideal because every receive buffer must be large +* enough to hold the maximum TCP packet, the Ethernet header, +* and the header. This requires up to 34 descriptors with +* MCLBYTES clusters. If we do not have indirect descriptors, +* LRO is disabled since the virtqueue will not contain very +* many receive buffers. +*/ + if (!virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC)) { + device_printf(dev, + LRO disabled due to both mergeable buffers and + indirect descriptors not negotiated\n); - features = ~VTNET_LRO_FEATURES; - sc-vtnet_features = virtio_negotiate_features(dev, features); - } else - sc-vtnet_flags |= VTNET_FLAG_LRO_NOMRG; + features = ~VTNET_LRO_FEATURES; + sc-vtnet_features = + virtio_negotiate_features(dev, features); + } else + sc-vtnet_flags |= VTNET_FLAG_LRO_NOMRG; + } } static void ___ 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: r267524 - head/sys/dev/virtio/network
Author: bryanv Date: Mon Jun 16 04:32:27 2014 New Revision: 267524 URL: http://svnweb.freebsd.org/changeset/base/267524 Log: Force two byte alignment for all control message headers The header structure consists of two 1-byte elements, but it must always be describable by a single SG entry. Note for consistency, specify the alignment everywhere, even if the structure has the appropriate natural alignment since it contains a uint16_t. Obtained from:DragonFlyBSD MFC after:1 week 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 Mon Jun 16 04:29:28 2014 (r267523) +++ head/sys/dev/virtio/network/if_vtnet.c Mon Jun 16 04:32:27 2014 (r267524) @@ -3068,7 +3068,7 @@ vtnet_exec_ctrl_cmd(struct vtnet_softc * static int vtnet_ctrl_mac_cmd(struct vtnet_softc *sc, uint8_t *hwaddr) { - struct virtio_net_ctrl_hdr hdr; + struct virtio_net_ctrl_hdr hdr __aligned(2); struct sglist_seg segs[3]; struct sglist sg; uint8_t ack; @@ -3102,7 +3102,7 @@ vtnet_ctrl_mq_cmd(struct vtnet_softc *sc struct virtio_net_ctrl_mq mq; uint8_t pad2; uint8_t ack; - } s; + } s __aligned(2); int error; s.hdr.class = VIRTIO_NET_CTRL_MQ; @@ -3134,7 +3134,7 @@ vtnet_ctrl_rx_cmd(struct vtnet_softc *sc uint8_t onoff; uint8_t pad2; uint8_t ack; - } s; + } s __aligned(2); int error; KASSERT(sc-vtnet_flags VTNET_FLAG_CTRL_RX, @@ -3217,7 +3217,7 @@ vtnet_rx_filter(struct vtnet_softc *sc) static void vtnet_rx_filter_mac(struct vtnet_softc *sc) { - struct virtio_net_ctrl_hdr hdr; + struct virtio_net_ctrl_hdr hdr __aligned(2); struct vtnet_mac_filter *filter; struct sglist_seg segs[4]; struct sglist sg; @@ -3330,7 +3330,7 @@ vtnet_exec_vlan_filter(struct vtnet_soft uint16_t tag; uint8_t pad2; uint8_t ack; - } s; + } s __aligned(2); int error; s.hdr.class = VIRTIO_NET_CTRL_VLAN; ___ 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: r267488 - head/sys/dev/vmware/vmxnet3
Author: bryanv Date: Sat Jun 14 23:36:17 2014 New Revision: 267488 URL: http://svnweb.freebsd.org/changeset/base/267488 Log: Don't check the dma map address for a static DMA mapping against NULL to determine if the mapping is valid. Submitted by: jhb Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c == --- head/sys/dev/vmware/vmxnet3/if_vmx.cSat Jun 14 22:47:25 2014 (r267487) +++ head/sys/dev/vmware/vmxnet3/if_vmx.cSat Jun 14 23:36:17 2014 (r267488) @@ -3886,7 +3886,7 @@ vmxnet3_dma_free(struct vmxnet3_softc *s { if (dma-dma_tag != NULL) { - if (dma-dma_map != NULL) { + if (dma-dma_paddr != 0) { bus_dmamap_sync(dma-dma_tag, dma-dma_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(dma-dma_tag, dma-dma_map); ___ 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