svn commit: r312374 - head/sys/boot/efi/libefi
Author: tsoome Date: Wed Jan 18 08:18:07 2017 New Revision: 312374 URL: https://svnweb.freebsd.org/changeset/base/312374 Log: loader: efi devpath api usage should be more aware of NULL pointers As the efi_devpath_last_node() and efi_devpath_trim() can return NULL pointers, the consumers of this API should check the the NULL pointers. Same for efinet_dev_init() using calloc(). Reported by: Robert Mustacchi Reviewed by: jhb, allanjude Approved by: allanjude (mentor) Differential Revision:https://reviews.freebsd.org/D9203 Modified: head/sys/boot/efi/libefi/devpath.c head/sys/boot/efi/libefi/efinet.c head/sys/boot/efi/libefi/efipart.c Modified: head/sys/boot/efi/libefi/devpath.c == --- head/sys/boot/efi/libefi/devpath.c Wed Jan 18 08:11:18 2017 (r312373) +++ head/sys/boot/efi/libefi/devpath.c Wed Jan 18 08:18:07 2017 (r312374) @@ -106,15 +106,18 @@ efi_devpath_trim(EFI_DEVICE_PATH *devpat EFI_DEVICE_PATH *node, *copy; size_t prefix, len; - node = efi_devpath_last_node(devpath); + if ((node = efi_devpath_last_node(devpath)) == NULL) + return (NULL); prefix = (UINT8 *)node - (UINT8 *)devpath; if (prefix == 0) return (NULL); len = prefix + DevicePathNodeLength(NextDevicePathNode(node)); copy = malloc(len); - memcpy(copy, devpath, prefix); - node = (EFI_DEVICE_PATH *)((UINT8 *)copy + prefix); - SetDevicePathEndNode(node); + if (copy != NULL) { + memcpy(copy, devpath, prefix); + node = (EFI_DEVICE_PATH *)((UINT8 *)copy + prefix); + SetDevicePathEndNode(node); + } return (copy); } Modified: head/sys/boot/efi/libefi/efinet.c == --- head/sys/boot/efi/libefi/efinet.c Wed Jan 18 08:11:18 2017 (r312373) +++ head/sys/boot/efi/libefi/efinet.c Wed Jan 18 08:18:07 2017 (r312374) @@ -291,12 +291,18 @@ efinet_dev_init() if (EFI_ERROR(status)) return (efi_status_to_errno(status)); handles2 = (EFI_HANDLE *)malloc(sz); + if (handles2 == NULL) { + free(handles); + return (ENOMEM); + } nifs = 0; for (i = 0; i < sz / sizeof(EFI_HANDLE); i++) { devpath = efi_lookup_devpath(handles[i]); if (devpath == NULL) continue; - node = efi_devpath_last_node(devpath); + if ((node = efi_devpath_last_node(devpath)) == NULL) + continue; + if (DevicePathType(node) != MESSAGING_DEVICE_PATH || DevicePathSubType(node) != MSG_MAC_ADDR_DP) continue; @@ -318,20 +324,24 @@ efinet_dev_init() } free(handles); if (nifs == 0) { - free(handles2); - return (ENOENT); + err = ENOENT; + goto done; } err = efi_register_handles(&efinet_dev, handles2, NULL, nifs); - if (err != 0) { - free(handles2); - return (err); - } + if (err != 0) + goto done; - efinetif.netif_nifs = nifs; efinetif.netif_ifs = calloc(nifs, sizeof(struct netif_dif)); - stats = calloc(nifs, sizeof(struct netif_stats)); + if (efinetif.netif_ifs == NULL || stats == NULL) { + free(efinetif.netif_ifs); + free(stats); + efinetif.netif_ifs = NULL; + err = ENOMEM; + goto done; + } + efinetif.netif_nifs = nifs; for (i = 0; i < nifs; i++) { @@ -341,9 +351,9 @@ efinet_dev_init() dif->dif_stats = &stats[i]; dif->dif_private = handles2[i]; } +done: free(handles2); - - return (0); + return (err); } static int Modified: head/sys/boot/efi/libefi/efipart.c == --- head/sys/boot/efi/libefi/efipart.c Wed Jan 18 08:11:18 2017 (r312373) +++ head/sys/boot/efi/libefi/efipart.c Wed Jan 18 08:18:07 2017 (r312374) @@ -130,10 +130,13 @@ efipart_init(void) * we try to find the parent device and add that instead as * that will be the CD filesystem. */ - node = efi_devpath_last_node(devpath); + if ((node = efi_devpath_last_node(devpath)) == NULL) + continue; if (DevicePathType(node) == MEDIA_DEVICE_PATH && DevicePathSubType(node) == MEDIA_CDROM_DP) { devpathcpy = efi_devpath_trim(devpath); + if (devpathcpy == NULL) + continue;
svn commit: r312378 - head/sys/cddl/dev/fbt/arm
Author: andrew Date: Wed Jan 18 13:27:24 2017 New Revision: 312378 URL: https://svnweb.freebsd.org/changeset/base/312378 Log: Use the kernel stack in the ARM FBT DTrace provider. This is used to find the fifth argument to functions being traced, however there was an error where the userspace stack was being used. This may be invalid leading to a kernel panic if this address is unmapped. Submitted by: Graeme Jenkinson MFC after:1 week Differential Revision:https://reviews.freebsd.org/D9229 Modified: head/sys/cddl/dev/fbt/arm/fbt_isa.c Modified: head/sys/cddl/dev/fbt/arm/fbt_isa.c == --- head/sys/cddl/dev/fbt/arm/fbt_isa.c Wed Jan 18 10:21:06 2017 (r312377) +++ head/sys/cddl/dev/fbt/arm/fbt_isa.c Wed Jan 18 13:27:24 2017 (r312378) @@ -61,7 +61,7 @@ fbt_invop(uintptr_t addr, struct trapfra /* Get 5th parameter from stack */ DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); - fifthparam = *(register_t *)frame->tf_usr_sp; + fifthparam = *(register_t *)frame->tf_svc_sp; DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT | CPU_DTRACE_BADADDR); dtrace_probe(fbt->fbtp_id, frame->tf_r0, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312379 - in head: lib/libc/sys sbin/ifconfig sys/conf sys/kern sys/modules/if_lagg sys/modules/if_vlan sys/net sys/netinet sys/netinet6 sys/sys
Author: hselasky Date: Wed Jan 18 13:31:17 2017 New Revision: 312379 URL: https://svnweb.freebsd.org/changeset/base/312379 Log: Implement kernel support for hardware rate limited sockets. - Add RATELIMIT kernel configuration keyword which must be set to enable the new functionality. - Add support for hardware driven, Receive Side Scaling, RSS aware, rate limited sendqueues and expose the functionality through the already established SO_MAX_PACING_RATE setsockopt(). The API support rates in the range from 1 to 4Gbytes/s which are suitable for regular TCP and UDP streams. The setsockopt(2) manual page has been updated. - Add rate limit function callback API to "struct ifnet" which supports the following operations: if_snd_tag_alloc(), if_snd_tag_modify(), if_snd_tag_query() and if_snd_tag_free(). - Add support to ifconfig to view, set and clear the IFCAP_TXRTLMT flag, which tells if a network driver supports rate limiting or not. - This patch also adds support for rate limiting through VLAN and LAGG intermediate network devices. - How rate limiting works: 1) The userspace application calls setsockopt() after accepting or making a new connection to set the rate which is then stored in the socket structure in the kernel. Later on when packets are transmitted a check is made in the transmit path for rate changes. A rate change implies a non-blocking ifp->if_snd_tag_alloc() call will be made to the destination network interface, which then sets up a custom sendqueue with the given rate limitation parameter. A "struct m_snd_tag" pointer is returned which serves as a "snd_tag" hint in the m_pkthdr for the subsequently transmitted mbufs. 2) When the network driver sees the "m->m_pkthdr.snd_tag" different from NULL, it will move the packets into a designated rate limited sendqueue given by the snd_tag pointer. It is up to the individual drivers how the rate limited traffic will be rate limited. 3) Route changes are detected by the NIC drivers in the ifp->if_transmit() routine when the ifnet pointer in the incoming snd_tag mismatches the one of the network interface. The network adapter frees the mbuf and returns EAGAIN which causes the ip_output() to release and clear the send tag. Upon next ip_output() a new "snd_tag" will be tried allocated. 4) When the PCB is detached the custom sendqueue will be released by a non-blocking ifp->if_snd_tag_free() call to the currently bound network interface. Reviewed by: wblock (manpages), adrian, gallatin, scottl (network) Differential Revision:https://reviews.freebsd.org/D3687 Sponsored by: Mellanox Technologies MFC after:3 months Modified: head/lib/libc/sys/getsockopt.2 head/sbin/ifconfig/ifconfig.8 head/sbin/ifconfig/ifconfig.c head/sys/conf/NOTES head/sys/conf/config.mk head/sys/conf/kern.opts.mk head/sys/conf/options head/sys/kern/uipc_socket.c head/sys/modules/if_lagg/Makefile head/sys/modules/if_vlan/Makefile head/sys/net/ieee8023ad_lacp.c head/sys/net/ieee8023ad_lacp.h head/sys/net/if.h head/sys/net/if_dead.c head/sys/net/if_lagg.c head/sys/net/if_var.h head/sys/net/if_vlan.c head/sys/netinet/in_pcb.c head/sys/netinet/in_pcb.h head/sys/netinet/ip_output.c head/sys/netinet6/ip6_output.c head/sys/sys/mbuf.h head/sys/sys/socket.h head/sys/sys/socketvar.h Modified: head/lib/libc/sys/getsockopt.2 == --- head/lib/libc/sys/getsockopt.2 Wed Jan 18 13:27:24 2017 (r312378) +++ head/lib/libc/sys/getsockopt.2 Wed Jan 18 13:31:17 2017 (r312379) @@ -28,7 +28,7 @@ .\" @(#)getsockopt.2 8.4 (Berkeley) 5/2/95 .\" $FreeBSD$ .\" -.Dd April 5, 2013 +.Dd January 18, 2017 .Dt GETSOCKOPT 2 .Os .Sh NAME @@ -188,6 +188,7 @@ The following options are recognized in .It Dv SO_LISTENINCQLEN Ta "get incomplete queue length of the socket (get only)" .It Dv SO_USER_COOKIE Ta "set the 'so_user_cookie' value for the socket (uint32_t, set only)" .It Dv SO_TS_CLOCK Ta "set specific format of timestamp returned by SO_TIMESTAMP" +.It Dv SO_MAX_PACING_RATE "set the maximum transmit rate in bytes per second for the socket" .El .Pp .Dv SO_DEBUG @@ -515,6 +516,10 @@ returns the maximal number of queued con returns the number of unaccepted complete connections. .Dv SO_LISTENINCQLEN returns the number of unaccepted incomplete connections. +.Pp +.Dv SO_MAX_PACING_RATE +instruct the socket and underlying network adapter layers to limit the +transfer rate to the given unsigned 32-bit value in bytes per second. .Sh RETURN VALUES .Rv -std .Sh ERRORS Modified: head/sbin/ifconfig/ifconfig.8 == --- head/sbin/ifconfig/ifconfig.8 Wed Jan 18 13:27:24 2017 (r312378) +++ head/sbin/ifconfig/ifconfig.8 W
svn commit: r312380 - head/sys/dev/e1000
Author: sbruno Date: Wed Jan 18 13:57:29 2017 New Revision: 312380 URL: https://svnweb.freebsd.org/changeset/base/312380 Log: Change device type to unbreak drm-next testing and builds. Submitted by: Matt Macy Modified: head/sys/dev/e1000/if_em.h Modified: head/sys/dev/e1000/if_em.h == --- head/sys/dev/e1000/if_em.h Wed Jan 18 13:31:17 2017(r312379) +++ head/sys/dev/e1000/if_em.h Wed Jan 18 13:57:29 2017(r312380) @@ -436,7 +436,7 @@ struct adapter { #define intr_type shared->isc_intr /* FreeBSD operating-system-specific structures. */ struct e1000_osdep osdep; - struct device *dev; + device_t*dev; struct cdev *led_dev; struct em_tx_queue *tx_queues; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r312380 - head/sys/dev/e1000
On Wed, Jan 18, 2017 at 01:57:29PM +, Sean Bruno wrote: > Author: sbruno > Date: Wed Jan 18 13:57:29 2017 > New Revision: 312380 > URL: https://svnweb.freebsd.org/changeset/base/312380 > > Log: > Change device type to unbreak drm-next testing and builds. > > Submitted by: Matt Macy > > Modified: > head/sys/dev/e1000/if_em.h > > Modified: head/sys/dev/e1000/if_em.h > == > --- head/sys/dev/e1000/if_em.hWed Jan 18 13:31:17 2017 > (r312379) > +++ head/sys/dev/e1000/if_em.hWed Jan 18 13:57:29 2017 > (r312380) > @@ -436,7 +436,7 @@ struct adapter { > #define intr_type shared->isc_intr > /* FreeBSD operating-system-specific structures. */ > struct e1000_osdep osdep; > - struct device *dev; > + device_t*dev; this should be 'device_t dev'; > struct cdev *led_dev; > > struct em_tx_queue *tx_queues; > ___ > svn-src-...@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" -- Mateusz Guzik ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312383 - head/sys/dev/e1000
Author: sbruno Date: Wed Jan 18 14:23:43 2017 New Revision: 312383 URL: https://svnweb.freebsd.org/changeset/base/312383 Log: ugh, device_t not device_t * Reported by: hps Modified: head/sys/dev/e1000/if_em.h Modified: head/sys/dev/e1000/if_em.h == --- head/sys/dev/e1000/if_em.h Wed Jan 18 14:14:00 2017(r312382) +++ head/sys/dev/e1000/if_em.h Wed Jan 18 14:23:43 2017(r312383) @@ -436,7 +436,7 @@ struct adapter { #define intr_type shared->isc_intr /* FreeBSD operating-system-specific structures. */ struct e1000_osdep osdep; - device_t*dev; + device_tdev; struct cdev *led_dev; struct em_tx_queue *tx_queues; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312384 - head/sys/boot/fdt/dts/mips
Author: br Date: Wed Jan 18 14:41:59 2017 New Revision: 312384 URL: https://svnweb.freebsd.org/changeset/base/312384 Log: Remove empty ranges property so beri_simplebus can be attached again. Sponsored by: DARPA, AFRL Modified: head/sys/boot/fdt/dts/mips/beri-netfpga.dts head/sys/boot/fdt/dts/mips/beri-sim.dts head/sys/boot/fdt/dts/mips/beripad-de4.dts head/sys/boot/fdt/dts/mips/beripad-sockit.dts Modified: head/sys/boot/fdt/dts/mips/beri-netfpga.dts == --- head/sys/boot/fdt/dts/mips/beri-netfpga.dts Wed Jan 18 14:23:43 2017 (r312383) +++ head/sys/boot/fdt/dts/mips/beri-netfpga.dts Wed Jan 18 14:41:59 2017 (r312384) @@ -97,7 +97,6 @@ * we use mips4k coprocessor 0 interrupt management directly. */ compatible = "simple-bus", "mips,mips4k"; - ranges = <>; beripic: beripic@7f804000 { compatible = "sri-cambridge,beri-pic"; Modified: head/sys/boot/fdt/dts/mips/beri-sim.dts == --- head/sys/boot/fdt/dts/mips/beri-sim.dts Wed Jan 18 14:23:43 2017 (r312383) +++ head/sys/boot/fdt/dts/mips/beri-sim.dts Wed Jan 18 14:41:59 2017 (r312384) @@ -95,7 +95,6 @@ * we use mips4k coprocessor 0 interrupt management directly. */ compatible = "simple-bus", "mips,mips4k"; - ranges = <>; beripic0: beripic@7f804000 { compatible = "sri-cambridge,beri-pic"; Modified: head/sys/boot/fdt/dts/mips/beripad-de4.dts == --- head/sys/boot/fdt/dts/mips/beripad-de4.dts Wed Jan 18 14:23:43 2017 (r312383) +++ head/sys/boot/fdt/dts/mips/beripad-de4.dts Wed Jan 18 14:41:59 2017 (r312384) @@ -95,7 +95,6 @@ * we use mips4k coprocessor 0 interrupt management directly. */ compatible = "simple-bus", "mips,mips4k"; - ranges = <>; beripic0: beripic@7f804000 { compatible = "sri-cambridge,beri-pic"; Modified: head/sys/boot/fdt/dts/mips/beripad-sockit.dts == --- head/sys/boot/fdt/dts/mips/beripad-sockit.dts Wed Jan 18 14:23:43 2017(r312383) +++ head/sys/boot/fdt/dts/mips/beripad-sockit.dts Wed Jan 18 14:41:59 2017(r312384) @@ -93,7 +93,6 @@ * we use mips4k coprocessor 0 interrupt management directly. */ compatible = "simple-bus", "mips,mips4k"; - /* ranges = <>; */ beripic0: beripic@7f804000 { compatible = "sri-cambridge,beri-pic"; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312387 - head/sys/sys
Author: glebius Date: Wed Jan 18 17:09:22 2017 New Revision: 312387 URL: https://svnweb.freebsd.org/changeset/base/312387 Log: Fix regression from r311568: collision of MSG_NOSIGNAL with MSG_MORETOCOME lead to delayed send of data sent with sendto(MSG_NOSIGNAL). Submitted by: rrs Modified: head/sys/sys/socket.h Modified: head/sys/sys/socket.h == --- head/sys/sys/socket.h Wed Jan 18 15:23:40 2017(r312386) +++ head/sys/sys/socket.h Wed Jan 18 17:09:22 2017(r312387) @@ -446,7 +446,7 @@ struct msghdr { #endif #ifdef _KERNEL #defineMSG_SOCALLBCK 0x1 /* for use by socket callbacks - soreceive (TCP) */ -#defineMSG_MORETOCOME 0x2 /* additional data pending */ +#defineMSG_MORETOCOME 0x10/* additional data pending */ #endif /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312388 - head/sys/sys
Author: glebius Date: Wed Jan 18 17:21:28 2017 New Revision: 312388 URL: https://svnweb.freebsd.org/changeset/base/312388 Log: Format and sort MSG_* flags, to prevent misedits in future. There is no functional change. Modified: head/sys/sys/socket.h Modified: head/sys/sys/socket.h == --- head/sys/sys/socket.h Wed Jan 18 17:09:22 2017(r312387) +++ head/sys/sys/socket.h Wed Jan 18 17:21:28 2017(r312388) @@ -425,28 +425,36 @@ struct msghdr { int msg_flags; /* flags on received message */ }; -#defineMSG_OOB 0x1 /* process out-of-band data */ -#defineMSG_PEEK0x2 /* peek at incoming message */ -#defineMSG_DONTROUTE 0x4 /* send without using routing tables */ -#defineMSG_EOR 0x8 /* data completes record */ -#defineMSG_TRUNC 0x10/* data discarded before delivery */ -#defineMSG_CTRUNC 0x20/* control data lost before delivery */ -#defineMSG_WAITALL 0x40/* wait for full request or error */ +#defineMSG_OOB 0x0001 /* process out-of-band data */ +#defineMSG_PEEK 0x0002 /* peek at incoming message */ +#defineMSG_DONTROUTE0x0004 /* send without using routing tables */ +#defineMSG_EOR 0x0008 /* data completes record */ +#defineMSG_TRUNC0x0010 /* data discarded before delivery */ +#defineMSG_CTRUNC 0x0020 /* control data lost before delivery */ +#defineMSG_WAITALL 0x0040 /* wait for full request or error */ +#if __BSD_VISIBLE +#defineMSG_DONTWAIT 0x0080 /* this message should be nonblocking */ +#defineMSG_EOF 0x0100 /* data completes connection */ +/* 0x0200unused */ +/* 0x0400unused */ +/* 0x0800unused */ +/* 0x1000unused */ +#defineMSG_NOTIFICATION 0x2000 /* SCTP notification */ +#defineMSG_NBIO 0x4000 /* FIONBIO mode, used by fifofs */ +#defineMSG_COMPAT 0x8000 /* used in sendit() */ +#endif +#ifdef _KERNEL +#defineMSG_SOCALLBCK0x0001 /* for use by socket callbacks - soreceive (TCP) */ +#endif #if __POSIX_VISIBLE >= 200809 -#defineMSG_NOSIGNAL0x2 /* do not generate SIGPIPE on EOF */ +#defineMSG_NOSIGNAL 0x0002 /* do not generate SIGPIPE on EOF */ #endif #if __BSD_VISIBLE -#defineMSG_DONTWAIT0x80/* this message should be nonblocking */ -#defineMSG_EOF 0x100 /* data completes connection */ -#defineMSG_NOTIFICATION 0x2000 /* SCTP notification */ -#defineMSG_NBIO0x4000 /* FIONBIO mode, used by fifofs */ -#defineMSG_COMPAT 0x8000 /* used in sendit() */ -#defineMSG_CMSG_CLOEXEC 0x4/* make received fds close-on-exec */ -#defineMSG_WAITFORONE 0x8 /* for recvmmsg() */ +#defineMSG_CMSG_CLOEXEC 0x0004 /* make received fds close-on-exec */ +#defineMSG_WAITFORONE 0x0008 /* for recvmmsg() */ #endif #ifdef _KERNEL -#defineMSG_SOCALLBCK 0x1 /* for use by socket callbacks - soreceive (TCP) */ -#defineMSG_MORETOCOME 0x10/* additional data pending */ +#defineMSG_MORETOCOME 0x0010 /* additional data pending */ #endif /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r312379 - in head: lib/libc/sys sbin/ifconfig sys/conf sys/kern sys/modules/if_lagg sys/modules/if_vlan sys/net sys/netinet sys/netinet6 sys/sys
Hi! I'm quite disappointed by this checkin. This is an interesting experimental feature, but to my knowledge, there were no production testing of the feature, that will prove that the idea actually works. To my knowledge the code isn't used anywhere right now, it was just tested to work as a concept. At the same time it introduces yet another socket to interface layering violation, bloats the ifnet structure and other intrusive things. Please correct me if I am wrong. On Wed, Jan 18, 2017 at 01:31:17PM +, Hans Petter Selasky wrote: H> Author: hselasky H> Date: Wed Jan 18 13:31:17 2017 H> New Revision: 312379 H> URL: https://svnweb.freebsd.org/changeset/base/312379 H> H> Log: H> Implement kernel support for hardware rate limited sockets. H> H> - Add RATELIMIT kernel configuration keyword which must be set to H> enable the new functionality. H> H> - Add support for hardware driven, Receive Side Scaling, RSS aware, rate H> limited sendqueues and expose the functionality through the already H> established SO_MAX_PACING_RATE setsockopt(). The API support rates in H> the range from 1 to 4Gbytes/s which are suitable for regular TCP and H> UDP streams. The setsockopt(2) manual page has been updated. H> H> - Add rate limit function callback API to "struct ifnet" which supports H> the following operations: if_snd_tag_alloc(), if_snd_tag_modify(), H> if_snd_tag_query() and if_snd_tag_free(). H> H> - Add support to ifconfig to view, set and clear the IFCAP_TXRTLMT H> flag, which tells if a network driver supports rate limiting or not. H> H> - This patch also adds support for rate limiting through VLAN and LAGG H> intermediate network devices. H> H> - How rate limiting works: H> H> 1) The userspace application calls setsockopt() after accepting or H> making a new connection to set the rate which is then stored in the H> socket structure in the kernel. Later on when packets are transmitted H> a check is made in the transmit path for rate changes. A rate change H> implies a non-blocking ifp->if_snd_tag_alloc() call will be made to the H> destination network interface, which then sets up a custom sendqueue H> with the given rate limitation parameter. A "struct m_snd_tag" pointer is H> returned which serves as a "snd_tag" hint in the m_pkthdr for the H> subsequently transmitted mbufs. H> H> 2) When the network driver sees the "m->m_pkthdr.snd_tag" different H> from NULL, it will move the packets into a designated rate limited sendqueue H> given by the snd_tag pointer. It is up to the individual drivers how the rate H> limited traffic will be rate limited. H> H> 3) Route changes are detected by the NIC drivers in the ifp->if_transmit() H> routine when the ifnet pointer in the incoming snd_tag mismatches the H> one of the network interface. The network adapter frees the mbuf and H> returns EAGAIN which causes the ip_output() to release and clear the send H> tag. Upon next ip_output() a new "snd_tag" will be tried allocated. H> H> 4) When the PCB is detached the custom sendqueue will be released by a H> non-blocking ifp->if_snd_tag_free() call to the currently bound network H> interface. H> H> Reviewed by: wblock (manpages), adrian, gallatin, scottl (network) H> Differential Revision: https://reviews.freebsd.org/D3687 H> Sponsored by: Mellanox Technologies H> MFC after: 3 months H> H> Modified: H> head/lib/libc/sys/getsockopt.2 H> head/sbin/ifconfig/ifconfig.8 H> head/sbin/ifconfig/ifconfig.c H> head/sys/conf/NOTES H> head/sys/conf/config.mk H> head/sys/conf/kern.opts.mk H> head/sys/conf/options H> head/sys/kern/uipc_socket.c H> head/sys/modules/if_lagg/Makefile H> head/sys/modules/if_vlan/Makefile H> head/sys/net/ieee8023ad_lacp.c H> head/sys/net/ieee8023ad_lacp.h H> head/sys/net/if.h H> head/sys/net/if_dead.c H> head/sys/net/if_lagg.c H> head/sys/net/if_var.h H> head/sys/net/if_vlan.c H> head/sys/netinet/in_pcb.c H> head/sys/netinet/in_pcb.h H> head/sys/netinet/ip_output.c H> head/sys/netinet6/ip6_output.c H> head/sys/sys/mbuf.h H> head/sys/sys/socket.h H> head/sys/sys/socketvar.h H> H> Modified: head/lib/libc/sys/getsockopt.2 H> == H> --- head/lib/libc/sys/getsockopt.2 Wed Jan 18 13:27:24 2017 (r312378) H> +++ head/lib/libc/sys/getsockopt.2 Wed Jan 18 13:31:17 2017 (r312379) H> @@ -28,7 +28,7 @@ H> .\" @(#)getsockopt.28.4 (Berkeley) 5/2/95 H> .\" $FreeBSD$ H> .\" H> -.Dd April 5, 2013 H> +.Dd January 18, 2017 H> .Dt GETSOCKOPT 2 H> .Os H> .Sh NAME H> @@ -188,6 +188,7 @@ The following options are recognized in H> .It Dv SO_LISTENINCQLEN Ta "get incomplete queue length of the socket (get only)" H> .It Dv SO_USER_COOKIE Ta "set the 'so_user_cookie' value for the socket (uint32_t, set only)" H> .It
svn commit: r312389 - in head/sys: kern sys
Author: mjg Date: Wed Jan 18 17:53:57 2017 New Revision: 312389 URL: https://svnweb.freebsd.org/changeset/base/312389 Log: rwlock: reduce lock accesses similarly to r311172 Discussed with: jhb Tested by:pho (previous version) Modified: head/sys/kern/kern_rwlock.c head/sys/sys/rwlock.h Modified: head/sys/kern/kern_rwlock.c == --- head/sys/kern/kern_rwlock.c Wed Jan 18 17:21:28 2017(r312388) +++ head/sys/kern/kern_rwlock.c Wed Jan 18 17:53:57 2017(r312389) @@ -132,9 +132,12 @@ LOCK_DELAY_SYSINIT(rw_delay_sysinit); * Return a pointer to the owning thread if the lock is write-locked or * NULL if the lock is unlocked or read-locked. */ -#definerw_wowner(rw) \ - ((rw)->rw_lock & RW_LOCK_READ ? NULL : \ - (struct thread *)RW_OWNER((rw)->rw_lock)) + +#definelv_rw_wowner(v) \ + ((v) & RW_LOCK_READ ? NULL :\ +(struct thread *)RW_OWNER((v))) + +#definerw_wowner(rw) lv_rw_wowner(RW_READ_VALUE(rw)) /* * Returns if a write owner is recursed. Write ownership is not assured @@ -415,7 +418,10 @@ __rw_rlock(volatile uintptr_t *c, const #ifdef KDTRACE_HOOKS all_time -= lockstat_nsecs(&rw->lock_object); - state = rw->rw_lock; +#endif + v = RW_READ_VALUE(rw); +#ifdef KDTRACE_HOOKS + state = v; #endif for (;;) { /* @@ -428,7 +434,6 @@ __rw_rlock(volatile uintptr_t *c, const * completely unlocked rwlock since such a lock is encoded * as a read lock with no waiters. */ - v = rw->rw_lock; if (RW_CAN_READ(v)) { /* * The RW_LOCK_READ_WAITERS flag should only be set @@ -444,6 +449,7 @@ __rw_rlock(volatile uintptr_t *c, const (void *)(v + RW_ONE_READER)); break; } + v = RW_READ_VALUE(rw); continue; } #ifdef KDTRACE_HOOKS @@ -471,9 +477,11 @@ __rw_rlock(volatile uintptr_t *c, const KTR_STATE1(KTR_SCHED, "thread", sched_tdname(curthread), "spinning", "lockname:\"%s\"", rw->lock_object.lo_name); - while ((struct thread*)RW_OWNER(rw->rw_lock) == - owner && TD_IS_RUNNING(owner)) + do { lock_delay(&lda); + v = RW_READ_VALUE(rw); + owner = lv_rw_wowner(v); + } while (owner != NULL && TD_IS_RUNNING(owner)); KTR_STATE0(KTR_SCHED, "thread", sched_tdname(curthread), "running"); continue; @@ -484,11 +492,12 @@ __rw_rlock(volatile uintptr_t *c, const "spinning", "lockname:\"%s\"", rw->lock_object.lo_name); for (i = 0; i < rowner_loops; i++) { - v = rw->rw_lock; + v = RW_READ_VALUE(rw); if ((v & RW_LOCK_READ) == 0 || RW_CAN_READ(v)) break; cpu_spinwait(); } + v = RW_READ_VALUE(rw); #ifdef KDTRACE_HOOKS lda.spin_cnt += rowner_loops - i; #endif @@ -511,7 +520,7 @@ __rw_rlock(volatile uintptr_t *c, const * The lock might have been released while we spun, so * recheck its state and restart the loop if needed. */ - v = rw->rw_lock; + v = RW_READ_VALUE(rw); if (RW_CAN_READ(v)) { turnstile_cancel(ts); continue; @@ -549,6 +558,7 @@ __rw_rlock(volatile uintptr_t *c, const if (!atomic_cmpset_ptr(&rw->rw_lock, v, v | RW_LOCK_READ_WAITERS)) { turnstile_cancel(ts); + v = RW_READ_VALUE(rw); continue; } if (LOCK_LOG_TEST(&rw->lock_object, 0)) @@ -574,6 +584,7 @@ __rw_rlock(volatile uintptr_t *c, const if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR2(KTR_LOCK, "%s: %p resuming from turnstile", __func__, rw); + v = RW_READ_VAL
svn commit: r312390 - in head/sys: kern sys
Author: mjg Date: Wed Jan 18 17:55:08 2017 New Revision: 312390 URL: https://svnweb.freebsd.org/changeset/base/312390 Log: sx: reduce lock accesses similarly to r311172 Discussed with: jhb Tested by:pho (previous version) Modified: head/sys/kern/kern_sx.c head/sys/sys/sx.h Modified: head/sys/kern/kern_sx.c == --- head/sys/kern/kern_sx.c Wed Jan 18 17:53:57 2017(r312389) +++ head/sys/kern/kern_sx.c Wed Jan 18 17:55:08 2017(r312390) @@ -563,8 +563,10 @@ _sx_xlock_hard(struct sx *sx, uintptr_t lock_delay_arg_init(&lda, NULL); #endif + x = SX_READ_VALUE(sx); + /* If we already hold an exclusive lock, then recurse. */ - if (sx_xlocked(sx)) { + if (__predict_false(lv_sx_owner(x) == (struct thread *)tid)) { KASSERT((sx->lock_object.lo_flags & LO_RECURSABLE) != 0, ("_sx_xlock_hard: recursed on non-recursive sx %s @ %s:%d\n", sx->lock_object.lo_name, file, line)); @@ -581,12 +583,15 @@ _sx_xlock_hard(struct sx *sx, uintptr_t #ifdef KDTRACE_HOOKS all_time -= lockstat_nsecs(&sx->lock_object); - state = sx->sx_lock; + state = x; #endif for (;;) { - if (sx->sx_lock == SX_LOCK_UNLOCKED && - atomic_cmpset_acq_ptr(&sx->sx_lock, SX_LOCK_UNLOCKED, tid)) - break; + if (x == SX_LOCK_UNLOCKED) { + if (atomic_cmpset_acq_ptr(&sx->sx_lock, x, tid)) + break; + x = SX_READ_VALUE(sx); + continue; + } #ifdef KDTRACE_HOOKS lda.spin_cnt++; #endif @@ -601,11 +606,9 @@ _sx_xlock_hard(struct sx *sx, uintptr_t * running on another CPU, spin until the owner stops * running or the state of the lock changes. */ - x = sx->sx_lock; if ((sx->lock_object.lo_flags & SX_NOADAPTIVE) == 0) { if ((x & SX_LOCK_SHARED) == 0) { - x = SX_OWNER(x); - owner = (struct thread *)x; + owner = lv_sx_owner(x); if (TD_IS_RUNNING(owner)) { if (LOCK_LOG_TEST(&sx->lock_object, 0)) CTR3(KTR_LOCK, @@ -616,9 +619,12 @@ _sx_xlock_hard(struct sx *sx, uintptr_t "lockname:\"%s\"", sx->lock_object.lo_name); GIANT_SAVE(); - while (SX_OWNER(sx->sx_lock) == x && - TD_IS_RUNNING(owner)) + do { lock_delay(&lda); + x = SX_READ_VALUE(sx); + owner = lv_sx_owner(x); + } while (owner != NULL && + TD_IS_RUNNING(owner)); KTR_STATE0(KTR_SCHED, "thread", sched_tdname(curthread), "running"); continue; @@ -645,6 +651,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t } KTR_STATE0(KTR_SCHED, "thread", sched_tdname(curthread), "running"); + x = SX_READ_VALUE(sx); if (i != asx_loops) continue; } @@ -652,7 +659,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t #endif sleepq_lock(&sx->lock_object); - x = sx->sx_lock; + x = SX_READ_VALUE(sx); /* * If the lock was released while spinning on the @@ -701,6 +708,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t break; } sleepq_release(&sx->lock_object); + x = SX_READ_VALUE(sx); continue; } @@ -712,6 +720,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t if (!atomic_cmpset_ptr(&sx->sx_lock, x, x | SX_LOCK_EXCLUSIVE_WAITERS)) { sleepq_release(&sx->lock_object); + x = SX_READ_VALUE(sx); continue; } if (LOCK_LOG_TEST(&sx->lock_object, 0)) @@ -753,6 +762,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t
svn commit: r312391 - in head: share/man/man5 sys/ufs/ufs
Author: cem Date: Wed Jan 18 17:55:49 2017 New Revision: 312391 URL: https://svnweb.freebsd.org/changeset/base/312391 Log: ufs/extattr.h: Fix documentation of ea_name termination The ea_name string is not nul-terminated. Correct the documentation. Because the subsequent field is padded to 8 bytes, and the padding is zeroed, the ea_name string will appear to be nul-terminated whenever the length isn't exactly one (mod eight). This was introduced in r167010 (2007). Additionally, mark the length fields as unsigned. This particularly matters for the single byte ea_namelength field, which can represent extended attribute names up to 255 bytes long. No functional change. PR: 216127 Reported by: dewayne at heuristicsystems.com.au Reviewed by: kib@ Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D9206 Modified: head/share/man/man5/fs.5 head/sys/ufs/ufs/extattr.h Modified: head/share/man/man5/fs.5 == --- head/share/man/man5/fs.5Wed Jan 18 17:55:08 2017(r312390) +++ head/share/man/man5/fs.5Wed Jan 18 17:55:49 2017(r312391) @@ -28,7 +28,7 @@ .\" @(#)fs.5 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd April 23, 2016 +.Dd January 16, 2017 .Dt FS 5 .Os .Sh NAME @@ -388,18 +388,19 @@ For further information, see the include The format of an external attribute is defined by the extattr structure: .Bd -literal struct extattr { - int32_t ea_length; /* length of this attribute */ - int8_t ea_namespace; /* name space of this attribute */ - int8_t ea_contentpadlen; /* padding at end of attribute */ - int8_t ea_namelength; /* length of attribute name */ - charea_name[1]; /* null-terminated attribute name */ + uint32_t ea_length; /* length of this attribute */ + uint8_t ea_namespace; /* name space of this attribute */ + uint8_t ea_contentpadlen; /* bytes of padding at end of attribute */ + uint8_t ea_namelength; /* length of attribute name */ + charea_name[1]; /* attribute name (NOT nul-terminated) */ + /* padding, if any, to align attribute content to 8 byte boundary */ /* extended attribute content follows */ }; .Ed .Pp Several macros are defined to manipulate these structures. Each macro takes a pointer to an extattr structure. -.Bl -tag -width ".Dv EXTATTR_SET_LENGTHS(eap, size)" +.Bl -tag -width ".Dv EXTATTR_CONTENT_SIZE(eap)" .It Dv EXTATTR_NEXT(eap) Returns a pointer to the next extended attribute following .Fa eap . @@ -409,35 +410,19 @@ Returns a pointer to the extended attrib .It Dv EXTATTR_CONTENT_SIZE(eap) Returns the size of the extended attribute content referenced by .Fa eap . -.It Dv EXTATTR_SET_LENGTHS(eap, size) -Called with the size of the attribute content after initializing -the attribute name to calculate and set the -.Fa ea_length , -.Fa ea_namelength , -and -.Fa ea_contentpadlen -fields of the extended attribute structure. .El .Pp The following code identifies an ACL: .Bd -literal if (eap->ea_namespace == EXTATTR_NAMESPACE_SYSTEM && - !strcmp(eap->ea_name, POSIX1E_ACL_ACCESS_EXTATTR_NAME) { +eap->ea_namelength == sizeof(POSIX1E_ACL_ACCESS_EXTATTR_NAME) - 1 && + strncmp(eap->ea_name, POSIX1E_ACL_ACCESS_EXTATTR_NAME, + sizeof(POSIX1E_ACL_ACCESS_EXTATTR_NAME) - 1) == 0) { aclp = EXTATTR_CONTENT(eap); acllen = EXTATTR_CONTENT_SIZE(eap); ... } .Ed -.Pp -The following code creates an extended attribute -containing a copy of a structure -.Fa mygif : -.Bd -literal - eap->ea_namespace = EXTATTR_NAMESPACE_USER; - strcpy(eap->ea_name, "filepic.gif"); - EXTATTR_SET_LENGTHS(eap, sizeof(struct mygif)); - memcpy(EXTATTR_CONTENT(eap), &mygif, sizeof(struct mygif)); -.Ed .Sh HISTORY A super-block structure named filsys appeared in .At v6 . Modified: head/sys/ufs/ufs/extattr.h == --- head/sys/ufs/ufs/extattr.h Wed Jan 18 17:55:08 2017(r312390) +++ head/sys/ufs/ufs/extattr.h Wed Jan 18 17:55:49 2017(r312391) @@ -73,11 +73,12 @@ struct ufs_extattr_header { * This structure defines the required fields of an extended-attribute header. */ struct extattr { - int32_t ea_length; /* length of this attribute */ - int8_t ea_namespace; /* name space of this attribute */ - int8_t ea_contentpadlen; /* bytes of padding at end of attribute */ - int8_t ea_namelength; /* length of attribute name */ - charea_name[1]; /* null-terminated attribute name */ + uint32_t ea_length; /* length of this attribute */ + uint8_t ea_namespace; /* name sp
Re: svn commit: r312379 - in head: lib/libc/sys sbin/ifconfig sys/conf sys/kern sys/modules/if_lagg sys/modules/if_vlan sys/net sys/netinet sys/netinet6 sys/sys
On 01/18/17 18:31, Gleb Smirnoff wrote: there were no production testing of the feature, that will prove that the idea actually works. Hi Gleb, This feature has been tested small scale in production environments and it for sure saves CPU versus doing rate limiting all in software. Mellanox plans to checkin support for the mlx5en driver which starts using this feature soon and I believe np@ has similar plans for cxgbe. I'll reply to your other questions tomorrow. --HPS ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r312391 - in head: share/man/man5 sys/ufs/ufs
On Wed, Jan 18, 2017 at 9:55 AM, Conrad E. Meyer wrote: > Author: cem > Date: Wed Jan 18 17:55:49 2017 > New Revision: 312391 > URL: https://svnweb.freebsd.org/changeset/base/312391 > > Log: > ufs/extattr.h: Fix documentation of ea_name termination > > The ea_name string is not nul-terminated. Correct the documentation. > > Because the subsequent field is padded to 8 bytes, and the padding is > zeroed, the ea_name string will appear to be nul-terminated whenever the > length isn't exactly one (mod eight). > > This was introduced in r167010 (2007). > > Additionally, mark the length fields as unsigned. This particularly > matters for the single byte ea_namelength field, which can represent > extended attribute names up to 255 bytes long. > > No functional change. Whoops — very minor functional change — restore(8) can now handle some dumps with extended attribute names longer than 127 characters that it couldn't before, due to the unsigned type change called out above. Best, Conrad ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312392 - head/lib/libwrap
Author: ngie Date: Wed Jan 18 18:14:50 2017 New Revision: 312392 URL: https://svnweb.freebsd.org/changeset/base/312392 Log: Use SRCTOP instead of .CURDIR-relative path in .PATH directive MFC after:3 weeks Sponsored by: Dell EMC Isilon Modified: head/lib/libwrap/Makefile Modified: head/lib/libwrap/Makefile == --- head/lib/libwrap/Makefile Wed Jan 18 17:55:49 2017(r312391) +++ head/lib/libwrap/Makefile Wed Jan 18 18:14:50 2017(r312392) @@ -15,7 +15,7 @@ MLINKS= hosts_access.3 hosts_ctl.3 \ hosts_access.3 request_set.3 \ hosts_options.5 hosts.allow.5 -.PATH: ${.CURDIR}/../../contrib/tcp_wrappers +.PATH: ${SRCTOP}/contrib/tcp_wrappers CFLAGS+=-DFACILITY=LOG_AUTH -DHOSTS_ACCESS -DNETGROUP -DDAEMON_UMASK=022 \ -DREAL_DAEMON_DIR=\"${LIBEXECDIR}\" -DPROCESS_OPTIONS \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312393 - in head: sbin/restore sys/sys sys/ufs/ufs
Author: cem Date: Wed Jan 18 18:16:57 2017 New Revision: 312393 URL: https://svnweb.freebsd.org/changeset/base/312393 Log: restore(8): Handle extended attribute names correctly UFS2 extended attribute names are not NUL-terminated. Handle appropriately. Correct the EXTATTR_BASE_LENGTH() macro, which handled ea_namelength == one (mod eight) extended attributes incorrectly. PR: 216127 Reported by: dewayne at heuristicsystems.com.au Reviewed by: kib@ Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D9208 Modified: head/sbin/restore/dirs.c head/sbin/restore/extern.h head/sbin/restore/tape.c head/sys/sys/extattr.h head/sys/ufs/ufs/extattr.h Modified: head/sbin/restore/dirs.c == --- head/sbin/restore/dirs.cWed Jan 18 18:14:50 2017(r312392) +++ head/sbin/restore/dirs.cWed Jan 18 18:16:57 2017(r312393) @@ -645,7 +645,7 @@ setdirmodes(int flags) if (!Nflag) { if (node.extsize > 0) { if (bufsize >= node.extsize) { - set_extattr_file(cp, buf, node.extsize); + set_extattr(-1, cp, buf, node.extsize, SXA_FILE); } else { fprintf(stderr, "Cannot restore %s%s\n", "extended attributes for ", cp); Modified: head/sbin/restore/extern.h == --- head/sbin/restore/extern.h Wed Jan 18 18:14:50 2017(r312392) +++ head/sbin/restore/extern.h Wed Jan 18 18:16:57 2017(r312393) @@ -87,7 +87,12 @@ struct direct*rst_readdir(RST_DIR *); voidrst_closedir(void *); voidruncmdshell(void); char *savename(char *); -voidset_extattr_file(char *, void *, int); +enum set_extattr_mode { + SXA_FILE, + SXA_LINK, + SXA_FD, +}; +voidset_extattr(int, char *, void *, int, enum set_extattr_mode); voidsetdirmodes(int); voidsetinput(char *, int); voidsetup(void); Modified: head/sbin/restore/tape.c == --- head/sbin/restore/tape.cWed Jan 18 18:14:50 2017(r312392) +++ head/sbin/restore/tape.cWed Jan 18 18:16:57 2017(r312393) @@ -105,8 +105,6 @@ static void findinode(struct s_spcl *); static void findtapeblksize(void); static char*setupextattr(int); static void xtrattr(char *, size_t); -static void set_extattr_link(char *, void *, int); -static void set_extattr_fd(int, char *, void *, int); static void skiphole(void (*)(char *, size_t), size_t *); static int gethead(struct s_spcl *); static void readtape(char *); @@ -627,7 +625,7 @@ extractfile(char *name) } if (linkit(lnkbuf, name, SYMLINK) == GOOD) { if (extsize > 0) - set_extattr_link(name, buf, extsize); + set_extattr(-1, name, buf, extsize, SXA_LINK); (void) lchown(name, uid, gid); (void) lchmod(name, mode); (void) utimensat(AT_FDCWD, name, ctimep, @@ -658,7 +656,7 @@ extractfile(char *name) } else { buf = setupextattr(extsize); getfile(xtrnull, xtrattr, xtrnull); - set_extattr_file(name, buf, extsize); + set_extattr(-1, name, buf, extsize, SXA_FILE); } (void) chown(name, uid, gid); (void) chmod(name, mode); @@ -688,7 +686,7 @@ extractfile(char *name) } else { buf = setupextattr(extsize); getfile(xtrnull, xtrattr, xtrnull); - set_extattr_file(name, buf, extsize); + set_extattr(-1, name, buf, extsize, SXA_FILE); } (void) chown(name, uid, gid); (void) chmod(name, mode); @@ -715,7 +713,7 @@ extractfile(char *name) buf = setupextattr(extsize); getfile(xtrfile, xtrattr, xtrskip); if (extsize > 0) - set_extattr_fd(ofile, name, buf, extsize); + set_extattr(ofile, name, buf, extsize, SXA_FD); (void) fchown(ofile, uid, gid); (void) fchmod(ofile, mode); (void) futimens(ofile, ctimep); @@ -728,12 +726,16 @@ extractfile(char *name) } /* - * Set attributes for a file. + * Set attributes on a file descriptor, link, or file. */ void -set_extattr_file(char *name, void *buf, int size) +se
Re: svn commit: r312379 - in head: lib/libc/sys sbin/ifconfig sys/conf sys/kern sys/modules/if_lagg sys/modules/if_vlan sys/net sys/netinet sys/netinet6 sys/sys
On Wed, Jan 18, 2017 at 07:04:05PM +0100, Hans Petter Selasky wrote: H> > there were no production testing of the feature, H> > that will prove that the idea actually works. H> H> Hi Gleb, H> H> This feature has been tested small scale in production environments and H> it for sure saves CPU versus doing rate limiting all in software. H> H> Mellanox plans to checkin support for the mlx5en driver which starts H> using this feature soon and I believe np@ has similar plans for cxgbe. H> H> I'll reply to your other questions tomorrow. The pacing in general (either software or hardware) haven't yet been used in production anywhere, to my knowledge. So, let's decide is FreeBSD an academical experimental OS, where we throw bare fresh ideas in, or is it a mature production ready OS, which we recommend to install to end users, who aren't hackers theirselves? -- Totus tuus, Glebius. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r312387 - head/sys/sys
On Wednesday, January 18, 2017 05:09:22 PM Gleb Smirnoff wrote: > Author: glebius > Date: Wed Jan 18 17:09:22 2017 > New Revision: 312387 > URL: https://svnweb.freebsd.org/changeset/base/312387 > > Log: > Fix regression from r311568: collision of MSG_NOSIGNAL with MSG_MORETOCOME > lead to delayed send of data sent with sendto(MSG_NOSIGNAL). > > Submitted by: rrs Ouch, thanks for fixing. Hopefully this fixes the freerdp report. :( -- John Baldwin ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r312379 - in head: lib/libc/sys sbin/ifconfig sys/conf sys/kern sys/modules/if_lagg sys/modules/if_vlan sys/net sys/netinet sys/netinet6 sys/sys
It depends, is this -HEAD or is this -stable? If this thing doesn't pan out with the chelsio/mellanox hardware socket rate limiting then we can either evolve it or remove it. -adrian ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312395 - head/sbin/devd
Author: asomers Date: Wed Jan 18 20:24:37 2017 New Revision: 312395 URL: https://svnweb.freebsd.org/changeset/base/312395 Log: Fix several Coverity CIDs in devd CID 1362055, 1362054: File descriptor leaks during shutdown CID 1362013: Potential null-termination fail with long network device names CID 1362097: Uncaught exception during memory pressure CID 1362017, 1362016: Unchecked errors, possibly resulting in weird behavior if two devd instances start at the same time. CID 1362015: Unchecked error that will probably never fail Reported by: Coverity CID: 1362055 1362054 1362013 1362097 1362017 1362016 1362015 MFC after:4 weeks Sponsored by: Spectra Logic Corp Modified: head/sbin/devd/devd.cc Modified: head/sbin/devd/devd.cc == --- head/sbin/devd/devd.cc Wed Jan 18 19:38:53 2017(r312394) +++ head/sbin/devd/devd.cc Wed Jan 18 20:24:37 2017(r312395) @@ -372,7 +372,7 @@ media::do_match(config &c) s = socket(PF_INET, SOCK_DGRAM, 0); if (s >= 0) { memset(&ifmr, 0, sizeof(ifmr)); - strncpy(ifmr.ifm_name, value.c_str(), sizeof(ifmr.ifm_name)); + strlcpy(ifmr.ifm_name, value.c_str(), sizeof(ifmr.ifm_name)); if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) >= 0 && ifmr.ifm_status & IFM_AVALID) { @@ -871,8 +871,10 @@ create_socket(const char *name, int sock if (::bind(fd, (struct sockaddr *) & sun, slen) < 0) err(1, "bind"); listen(fd, 4); - chown(name, 0, 0); /* XXX - root.wheel */ - chmod(name, 0666); + if (chown(name, 0, 0)) /* XXX - root.wheel */ + err(1, "chown"); + if (chmod(name, 0666)) + err(1, "chmod"); return (fd); } @@ -1058,7 +1060,13 @@ event_loop(void) buffer[rv] = '\0'; while (buffer[--rv] == '\n') buffer[rv] = '\0'; - process_event(buffer); + try { + process_event(buffer); + } + catch (std::length_error e) { + devdlog(LOG_ERR, "Dropping event %s " + "due to low memory", buffer); + } } else if (rv < 0) { if (errno != EINTR) break; @@ -1076,6 +1084,8 @@ event_loop(void) if (FD_ISSET(seqpacket_fd, &fds)) new_client(seqpacket_fd, SOCK_SEQPACKET); } + close(seqpacket_fd); + close(stream_fd); close(fd); } @@ -1218,7 +1228,8 @@ check_devd_enabled() if (val == 0) { warnx("Setting " SYSCTL " to 1000"); val = 1000; - sysctlbyname(SYSCTL, NULL, NULL, &val, sizeof(val)); + if (sysctlbyname(SYSCTL, NULL, NULL, &val, sizeof(val))) + err(1, "sysctlbyname"); } } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r286700 - in head: sbin/ifconfig sys/net
Is the change to lacp_port_create correct? The comment indicates that fast is configurable, but it's actually constant. Later on, there's some dead code that depends on the value of fast (it was dead before this commit, too). CID: 1305734 CID: 1305692 -Alan On Wed, Aug 12, 2015 at 2:21 PM, Hiren Panchasara wrote: > Author: hiren > Date: Wed Aug 12 20:21:04 2015 > New Revision: 286700 > URL: https://svnweb.freebsd.org/changeset/base/286700 > > Log: > Make LAG LACP fast timeout tunable through IOCTL. > > Differential Revision:D3300 > Submitted by: LN Sundararajan > Reviewed by: wblock, smh, gnn, hiren, rpokala at panasas > MFC after:2 weeks > Sponsored by: Panasas > > Modified: > head/sbin/ifconfig/ifconfig.8 > head/sbin/ifconfig/iflagg.c > head/sys/net/ieee8023ad_lacp.c > head/sys/net/ieee8023ad_lacp.h > head/sys/net/if_lagg.c > head/sys/net/if_lagg.h > > Modified: head/sbin/ifconfig/ifconfig.8 > == > --- head/sbin/ifconfig/ifconfig.8 Wed Aug 12 20:16:13 2015 > (r286699) > +++ head/sbin/ifconfig/ifconfig.8 Wed Aug 12 20:21:04 2015 > (r286700) > @@ -28,7 +28,7 @@ > .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 > .\" $FreeBSD$ > .\" > -.Dd May 15, 2015 > +.Dd Aug 12, 2015 > .Dt IFCONFIG 8 > .Os > .Sh NAME > @@ -2396,6 +2396,10 @@ Disable local hash computation for RSS h > Set a shift parameter for RSS local hash computation. > Hash is calculated by using flowid bits in a packet header mbuf > which are shifted by the number of this parameter. > +.It Cm lacp_fast_timeout > +Enable lacp fast-timeout on the interface. > +.It Cm -lacp_fast_timeout > +Disable lacp fast-timeout on the interface. > .El > .Pp > The following parameters are specific to IP tunnel interfaces, > > Modified: head/sbin/ifconfig/iflagg.c > == > --- head/sbin/ifconfig/iflagg.c Wed Aug 12 20:16:13 2015(r286699) > +++ head/sbin/ifconfig/iflagg.c Wed Aug 12 20:21:04 2015(r286700) > @@ -115,6 +115,8 @@ setlaggsetopt(const char *val, int d, in > case -LAGG_OPT_LACP_TXTEST: > case LAGG_OPT_LACP_RXTEST: > case -LAGG_OPT_LACP_RXTEST: > + case LAGG_OPT_LACP_TIMEOUT: > + case -LAGG_OPT_LACP_TIMEOUT: > break; > default: > err(1, "Invalid lagg option"); > @@ -293,6 +295,8 @@ static struct cmd lagg_cmds[] = { > DEF_CMD("-lacp_txtest", -LAGG_OPT_LACP_TXTEST, setlaggsetopt), > DEF_CMD("lacp_rxtest", LAGG_OPT_LACP_RXTEST, setlaggsetopt), > DEF_CMD("-lacp_rxtest", -LAGG_OPT_LACP_RXTEST, setlaggsetopt), > + DEF_CMD("lacp_fast_timeout",LAGG_OPT_LACP_TIMEOUT, > setlaggsetopt), > + DEF_CMD("-lacp_fast_timeout", -LAGG_OPT_LACP_TIMEOUT, > setlaggsetopt), > DEF_CMD_ARG("flowid_shift", setlaggflowidshift), > }; > static struct afswtch af_lagg = { > > Modified: head/sys/net/ieee8023ad_lacp.c > == > --- head/sys/net/ieee8023ad_lacp.c Wed Aug 12 20:16:13 2015 > (r286699) > +++ head/sys/net/ieee8023ad_lacp.c Wed Aug 12 20:21:04 2015 > (r286700) > @@ -522,7 +522,7 @@ lacp_port_create(struct lagg_port *lgp) > int error; > > boolean_t active = TRUE; /* XXX should be configurable */ > - boolean_t fast = FALSE; /* XXX should be configurable */ > + boolean_t fast = FALSE; /* Configurable via ioctl */ > > link_init_sdl(ifp, (struct sockaddr *)&sdl, IFT_ETHER); > sdl.sdl_alen = ETHER_ADDR_LEN; > > Modified: head/sys/net/ieee8023ad_lacp.h > == > --- head/sys/net/ieee8023ad_lacp.h Wed Aug 12 20:16:13 2015 > (r286699) > +++ head/sys/net/ieee8023ad_lacp.h Wed Aug 12 20:21:04 2015 > (r286700) > @@ -251,6 +251,7 @@ struct lacp_softc { > u_int32_t lsc_tx_test; > } lsc_debug; > u_int32_t lsc_strict_mode; > + boolean_t lsc_fast_timeout; /* if set, fast timeout */ > }; > > #defineLACP_TYPE_ACTORINFO 1 > > Modified: head/sys/net/if_lagg.c > == > --- head/sys/net/if_lagg.c Wed Aug 12 20:16:13 2015(r286699) > +++ head/sys/net/if_lagg.c Wed Aug 12 20:21:04 2015(r286700) > @@ -1257,6 +1257,8 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd > ro->ro_opts |= LAGG_OPT_LACP_RXTEST; > if (lsc->lsc_strict_mode != 0) > ro->ro_opts |= LAGG_OPT_LACP_STRICT; > + if (lsc->lsc_fast_timeout != 0) > + ro->ro_opts |= LAGG_OPT
svn commit: r312396 - head/cddl/usr.sbin/zfsd
Author: asomers Date: Wed Jan 18 22:10:18 2017 New Revision: 312396 URL: https://svnweb.freebsd.org/changeset/base/312396 Log: Fix an unchecked return value in zfsd It's pretty unlikely to actually hit this, but good to check it anyway Reported by: Coverity CID: 1362018 MFC after:4 weeks Sponsored by: Spectra Logic Corp Modified: head/cddl/usr.sbin/zfsd/case_file.cc Modified: head/cddl/usr.sbin/zfsd/case_file.cc == --- head/cddl/usr.sbin/zfsd/case_file.ccWed Jan 18 20:24:37 2017 (r312395) +++ head/cddl/usr.sbin/zfsd/case_file.ccWed Jan 18 22:10:18 2017 (r312396) @@ -656,8 +656,11 @@ CaseFile::DeSerializeFile(const char *fi uint64_t vdevGUID; nvlist_t *vdevConf; - sscanf(fileName, "pool_%" PRIu64 "_vdev_%" PRIu64 ".case", - &poolGUID, &vdevGUID); + if (sscanf(fileName, "pool_%" PRIu64 "_vdev_%" PRIu64 ".case", + &poolGUID, &vdevGUID) != 2) { + throw ZfsdException("CaseFile::DeSerialize: " + "Unintelligible CaseFile filename %s.\n", fileName); + } existingCaseFile = Find(Guid(poolGUID), Guid(vdevGUID)); if (existingCaseFile != NULL) { /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r286700 - in head: sbin/ifconfig sys/net
Adding the submitter and other reviewers for their comments. On 01/18/17 at 03:03P, Alan Somers wrote: > Is the change to lacp_port_create correct? The comment indicates that > fast is configurable, but it's actually constant. Later on, there's > some dead code that depends on the value of fast (it was dead before > this commit, too). > > CID: 1305734 > CID: 1305692 > > -Alan > > On Wed, Aug 12, 2015 at 2:21 PM, Hiren Panchasara wrote: > > Author: hiren > > Date: Wed Aug 12 20:21:04 2015 > > New Revision: 286700 > > URL: https://svnweb.freebsd.org/changeset/base/286700 > > > > Log: > > Make LAG LACP fast timeout tunable through IOCTL. > > > > Differential Revision:D3300 > > Submitted by: LN Sundararajan > > Reviewed by: wblock, smh, gnn, hiren, rpokala at panasas > > MFC after:2 weeks > > Sponsored by: Panasas > > > > Modified: > > head/sbin/ifconfig/ifconfig.8 > > head/sbin/ifconfig/iflagg.c > > head/sys/net/ieee8023ad_lacp.c > > head/sys/net/ieee8023ad_lacp.h > > head/sys/net/if_lagg.c > > head/sys/net/if_lagg.h > > > > Modified: head/sbin/ifconfig/ifconfig.8 > > == > > --- head/sbin/ifconfig/ifconfig.8 Wed Aug 12 20:16:13 2015 > > (r286699) > > +++ head/sbin/ifconfig/ifconfig.8 Wed Aug 12 20:21:04 2015 > > (r286700) > > @@ -28,7 +28,7 @@ > > .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 > > .\" $FreeBSD$ > > .\" > > -.Dd May 15, 2015 > > +.Dd Aug 12, 2015 > > .Dt IFCONFIG 8 > > .Os > > .Sh NAME > > @@ -2396,6 +2396,10 @@ Disable local hash computation for RSS h > > Set a shift parameter for RSS local hash computation. > > Hash is calculated by using flowid bits in a packet header mbuf > > which are shifted by the number of this parameter. > > +.It Cm lacp_fast_timeout > > +Enable lacp fast-timeout on the interface. > > +.It Cm -lacp_fast_timeout > > +Disable lacp fast-timeout on the interface. > > .El > > .Pp > > The following parameters are specific to IP tunnel interfaces, > > > > Modified: head/sbin/ifconfig/iflagg.c > > == > > --- head/sbin/ifconfig/iflagg.c Wed Aug 12 20:16:13 2015(r286699) > > +++ head/sbin/ifconfig/iflagg.c Wed Aug 12 20:21:04 2015(r286700) > > @@ -115,6 +115,8 @@ setlaggsetopt(const char *val, int d, in > > case -LAGG_OPT_LACP_TXTEST: > > case LAGG_OPT_LACP_RXTEST: > > case -LAGG_OPT_LACP_RXTEST: > > + case LAGG_OPT_LACP_TIMEOUT: > > + case -LAGG_OPT_LACP_TIMEOUT: > > break; > > default: > > err(1, "Invalid lagg option"); > > @@ -293,6 +295,8 @@ static struct cmd lagg_cmds[] = { > > DEF_CMD("-lacp_txtest", -LAGG_OPT_LACP_TXTEST, setlaggsetopt), > > DEF_CMD("lacp_rxtest", LAGG_OPT_LACP_RXTEST, setlaggsetopt), > > DEF_CMD("-lacp_rxtest", -LAGG_OPT_LACP_RXTEST, setlaggsetopt), > > + DEF_CMD("lacp_fast_timeout",LAGG_OPT_LACP_TIMEOUT, > > setlaggsetopt), > > + DEF_CMD("-lacp_fast_timeout", -LAGG_OPT_LACP_TIMEOUT, > > setlaggsetopt), > > DEF_CMD_ARG("flowid_shift", setlaggflowidshift), > > }; > > static struct afswtch af_lagg = { > > > > Modified: head/sys/net/ieee8023ad_lacp.c > > == > > --- head/sys/net/ieee8023ad_lacp.c Wed Aug 12 20:16:13 2015 > > (r286699) > > +++ head/sys/net/ieee8023ad_lacp.c Wed Aug 12 20:21:04 2015 > > (r286700) > > @@ -522,7 +522,7 @@ lacp_port_create(struct lagg_port *lgp) > > int error; > > > > boolean_t active = TRUE; /* XXX should be configurable */ > > - boolean_t fast = FALSE; /* XXX should be configurable */ > > + boolean_t fast = FALSE; /* Configurable via ioctl */ > > > > link_init_sdl(ifp, (struct sockaddr *)&sdl, IFT_ETHER); > > sdl.sdl_alen = ETHER_ADDR_LEN; > > > > Modified: head/sys/net/ieee8023ad_lacp.h > > == > > --- head/sys/net/ieee8023ad_lacp.h Wed Aug 12 20:16:13 2015 > > (r286699) > > +++ head/sys/net/ieee8023ad_lacp.h Wed Aug 12 20:21:04 2015 > > (r286700) > > @@ -251,6 +251,7 @@ struct lacp_softc { > > u_int32_t lsc_tx_test; > > } lsc_debug; > > u_int32_t lsc_strict_mode; > > + boolean_t lsc_fast_timeout; /* if set, fast timeout */ > > }; > > > > #defineLACP_TYPE_ACTORINFO 1 > > > > Modified: head/sys/net/if_lagg.c > > == > > --- head/sys/net/if_lagg.c Wed Aug 12 20:16:13 2015(r286699) > > +++ head/sys/net/if_lagg.c Wed Aug 12 20:21:04 2015(r286700) > > @@ -1257,6 +1257,8 @@ lagg_ioct