]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agopf tests: Basic adaptive mode syncookie test
Kristof Provost [Sat, 25 Sep 2021 13:05:02 +0000 (15:05 +0200)]
pf tests: Basic adaptive mode syncookie test

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32139

(cherry picked from commit 2f20d80692ceb584842a7642562fc9f610a5b661)

2 years agopf tests: Basic syncookie test
Kristof Provost [Sat, 10 Jul 2021 11:20:44 +0000 (13:20 +0200)]
pf tests: Basic syncookie test

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32138

(cherry picked from commit dc0636636bb1937283d4f218732ac2357f4ec4f1)

2 years agopf.conf: document syncookies
Kristof Provost [Sat, 14 Aug 2021 08:42:03 +0000 (10:42 +0200)]
pf.conf: document syncookies

Reviewed by: bcr
Obtained from: OpenBSD
MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32137

(cherry picked from commit 20f015f08d66d0d953e49245cb95c81c118b9ee9)

2 years agopfctl: userspace adaptive syncookies configration
Kristof Provost [Fri, 13 Aug 2021 11:42:59 +0000 (13:42 +0200)]
pfctl: userspace adaptive syncookies configration

Hook up the userspace bits to configure syncookies in adaptive mode.

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32136

(cherry picked from commit 5062afff9de7e67da96e3f0dcb9d8bbd5a4e1c5b)

2 years agopf: hook up adaptive mode configuration
Kristof Provost [Sat, 24 Jul 2021 12:23:59 +0000 (14:23 +0200)]
pf: hook up adaptive mode configuration

The kernel side of pf syncookie adaptive mode configuration.

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32135

(cherry picked from commit 955460d41e99031906841870e02063ffdf227f09)

2 years agopf: implement adaptive mode
Kristof Provost [Sat, 24 Jul 2021 11:59:34 +0000 (13:59 +0200)]
pf: implement adaptive mode

Use atomic counters to ensure that we correctly track the number of half
open states and syncookie responses in-flight.
This determines if we activate or deactivate syncookies in adaptive
mode.

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32134

(cherry picked from commit bf8637181a2bb81206ff8c685f1632d07b8feb13)

2 years agotcp_wrappers: get rid of duplicate fgets declarations
Kyle Evans [Thu, 30 Sep 2021 04:21:24 +0000 (23:21 -0500)]
tcp_wrappers: get rid of duplicate fgets declarations

This is declared in stdio.h, no need for this one.

(cherry picked from commit 4dbd8c72d3030b8f111fdac86ba45ff596595497)

2 years agolibc: ssp: sprinkle around some __dead2
Kyle Evans [Wed, 29 Sep 2021 21:48:20 +0000 (16:48 -0500)]
libc: ssp: sprinkle around some __dead2

This is consistent with, e.g., NetBSD's implementation, which declares
these as noreturn in ssp/ssp.h.

(cherry picked from commit 5487294d79f9ebe72a847d0855adb4df85e0d66e)

2 years agobootp: remove the USE_BFUNCS knob
Kyle Evans [Thu, 30 Sep 2021 03:01:34 +0000 (22:01 -0500)]
bootp: remove the USE_BFUNCS knob

We'd likely be better served by converting these to the equivalent mem*
calls, but just kill the knob for now. The b* macros being defined get
in the way of _FORTIFY_SOURCE.

(cherry picked from commit cfb9be506285cd65120f9686d532130a3757ce56)

2 years agokqueue: document how timers with low/past timeouts are handled
Kyle Evans [Thu, 30 Sep 2021 18:19:05 +0000 (13:19 -0500)]
kqueue: document how timers with low/past timeouts are handled

(cherry picked from commit 4b5554cebb66020f59dc869b835aebbd66e4bb8c)

2 years agokqueue: don't arbitrarily restrict long-past values for NOTE_ABSTIME
Kyle Evans [Wed, 29 Sep 2021 19:55:59 +0000 (14:55 -0500)]
kqueue: don't arbitrarily restrict long-past values for NOTE_ABSTIME

NOTE_ABSTIME values are converted to values relative to boottime in
filt_timervalidate(), and negative values are currently rejected.  We
don't reject times in the past in general, so clamp this up to 0 as
needed such that the timer fires immediately rather than imposing what
looks like an arbitrary restriction.

Another possible scenario is that the system clock had to be adjusted
by ~minutes or ~hours and we have less than that in terms of uptime,
making a reasonable short-timeout suddenly invalid. Firing it is still
a valid choice in this scenario so that applications can at least
expect a consistent behavior.

(cherry picked from commit 9c999a259f00b35f0467acd351fea9157ed7e1e4)
(cherry picked from commit 2f4dbe279f6b5eb87ec493d96f6943ffdb603ba0)

2 years agocam: Fix a typo in a comment
Gordon Bergling [Sat, 2 Oct 2021 08:48:43 +0000 (10:48 +0200)]
cam: Fix a typo in a comment

- s/perorming/performing/

(cherry picked from commit 15c5f657a0107c7c1a3c954252a9ac6bb80f2535)

2 years agovnic: Fix a typo in a comment
Gordon Bergling [Sat, 2 Oct 2021 08:47:21 +0000 (10:47 +0200)]
vnic: Fix a typo in a comment

- s/setings/settings/

(cherry picked from commit fafb1c574d43b8c3acb510d925f599fee461c039)

2 years agoevdev: Fix a typo in a commit
Gordon Bergling [Sat, 2 Oct 2021 08:43:41 +0000 (10:43 +0200)]
evdev: Fix a typo in a commit

- s/prefered/preferred/

(cherry picked from commit efd8749fe5cccb6c3d6b5f3c3515bf89ad306bcc)

2 years agonetvsc: Fix a typo in a comment
Gordon Bergling [Sat, 2 Oct 2021 08:42:18 +0000 (10:42 +0200)]
netvsc: Fix a typo in a comment

- s/prefered/preferred/

(cherry picked from commit 9ebd651b58502f0572a7832d088f53f7a2ad00a5)

2 years agowpa: Fix EAP/PEAP MSCHAPv2 authentication SIGSEGV
Cy Schubert [Tue, 5 Oct 2021 22:09:06 +0000 (15:09 -0700)]
wpa: Fix EAP/PEAP MSCHAPv2 authentication SIGSEGV

25ecdc7d52770caf1c9b44b5ec11f468f6b636f3 (MFCed by
5654815fd3604e024eefdcb34904d3a7c883e8c5) introduced a link error
causing a SIGSEGV when using EAP/PEAP MSCHAPv2 authentication. It was
subsequently addressed by c1d255d3ffdbe447de3ab875bf4e7d7accc5bfc5,
discovered by build time link errors not experienced during testing of
25ecdc7d52770caf1c9b44b5ec11f468f6b636f3. This commit MFCs a portion
of c1d255d3ffdbe447de3ab875bf4e7d7accc5bfc5 addressing only the
SIGSEGV. The rest of c1d255d3ffdbe447de3ab875bf4e7d7accc5bfc5 will
be MFCed in November 2021.

This is a direct commit to stable/12.

PR: 258527
Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
Tested by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>

2 years agosched_ule(4): Fix interactive threads stealing.
Alexander Motin [Tue, 21 Sep 2021 19:56:49 +0000 (15:56 -0400)]
sched_ule(4): Fix interactive threads stealing.

In scenarios when first thread in the queue can migrate to specified
CPU, but later ones can't runq_steal_from() incorrectly returned NULL.

MFC after: 2 weeks

(cherry picked from commit bd84094a51c4648a7c97ececdaccfb30bc832096)

2 years agoboot(9): update to match reality
Mitchell Horne [Tue, 28 Sep 2021 14:36:09 +0000 (11:36 -0300)]
boot(9): update to match reality

This function was renamed to kern_reboot() in 2010, but the man page has
failed to keep in sync. Bring it up to date on the rename, add the
shutdown hooks to the synopsis, and document the (obvious) fact that
kern_reboot() does not return.

Fix an outdated reference to the old name in kern_reboot(), and leave a
reference to the man page so future readers might find it before any
large changes.

Reviewed by: imp, markj
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32085

(cherry picked from commit 800e74955d4e5f90e7258956ba42228350f71049)

2 years agorman: fix overflow in rman_reserve_resource_bound()
Elliott Mitchell [Mon, 27 Sep 2021 17:13:19 +0000 (14:13 -0300)]
rman: fix overflow in rman_reserve_resource_bound()

If the default range of [0, ~0] is given, then (~0 - 0) + 1 == 0. This
in turn will cause any allocation of non-zero size to fail. Zero-sized
allocations are prohibited, so add a KASSERT to this effect.

History indicates it is part of the original rman code.  This bug may in
fact be older than some contributors.

Reviewed by: mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30280

(cherry picked from commit bcddaadbef5850ed9f040836d3f25ff57138ae28)

2 years agontb_hw_intel: fix xeon NTB gen3 bar disable logic
David Bright [Mon, 27 Sep 2021 13:18:46 +0000 (06:18 -0700)]
ntb_hw_intel: fix xeon NTB gen3 bar disable logic

In NTB gen3 driver, it was supposed to disable NTB bar access by
default, but due to incorrect register access method, the bar disable
logic does not work as expected. Those registers should be modified
through NTB bar0 rather than PCI configuration space.

Besides, we'd better to protect ourselves from a bad buddy node so
ingress disable logic should be implemented together.

Submitted by:   Austin Zhang (austin.zhang@dell.com)
Sponsored by:   Dell EMC

(cherry picked from commit e3cf7ebc1d36d068f1d1a83ea73ce2eed547e3cb)

2 years agoipfilter: Print the correct TCP sequence index number
Cy Schubert [Sat, 25 Sep 2021 00:00:20 +0000 (17:00 -0700)]
ipfilter: Print the correct TCP sequence index number

TCP sequence numbers in the FTP proxy are maintained in a two dimensional
array. The debug message prints the same seq[N] for both. Fix that.

(cherry picked from commit df38343e71304169ebca0e4c4fa24b339982d7be)

2 years agoipfilter: Correct a comment
Cy Schubert [Sat, 25 Sep 2021 06:41:22 +0000 (23:41 -0700)]
ipfilter: Correct a comment

Correct a comment's grammar and while at it clarify its meaining.

(cherry picked from commit aa6cfcc820b438cec58fbe0af408d4457f8daf9d)

2 years agoipfilter: Avoid a null if-then-else blocks
Cy Schubert [Wed, 22 Sep 2021 04:58:08 +0000 (21:58 -0700)]
ipfilter: Avoid a null if-then-else blocks

When WITHOUT_INET6 is selected we generate a null if-then-else blocks
due to incorrect placment of #if statments. Move the #if statements
reducing unnecessary runtime comparisons WITHOUT_INET6.

(cherry picked from commit 73db3b64f167972db3ee3f780cecb439b09492b1)

2 years agocmp: add -b, --print-bytes
Kyle Evans [Thu, 23 Sep 2021 05:46:30 +0000 (00:46 -0500)]
cmp: add -b, --print-bytes

This is compatible with GNU cmp.

Reviewed by: bapt, markj (earlier version)
Sponsored by: Klara, Inc.

(cherry picked from commit f66b9b40f403f7c30fec3c4ceed93c6e8fafa8ac)

2 years agocmp: add -i, --ignore-initial, an alternative to skip1/skip2 args
Kyle Evans [Thu, 23 Sep 2021 05:43:32 +0000 (00:43 -0500)]
cmp: add -i, --ignore-initial, an alternative to skip1/skip2 args

This is compatible with GNU cmp.

Reviewed by: markj
Sponsored by: Klara, Inc.

(cherry picked from commit 8d546b6832eea031f95f30eaec3232ec1256a281)

2 years agocmp: add -n, --bytes to limit number of bytes to compare
Kyle Evans [Thu, 23 Sep 2021 05:26:52 +0000 (00:26 -0500)]
cmp: add -n, --bytes to limit number of bytes to compare

This is compatible with GNU cmp.

Reviewed by: markj
Sponsored by: Klara, Inc.

(cherry picked from commit 4e380e8474609875c4cf5277b3755ac29079a8b5)

2 years agocmp: accept SI suffixes for skip1 and skip2
Kyle Evans [Thu, 23 Sep 2021 05:17:07 +0000 (00:17 -0500)]
cmp: accept SI suffixes for skip1 and skip2

This is compatible with GNU cmp.

Reviewed by: bapt (earlier version), markj, imp
Sponsored by: Klara, Inc.

(cherry picked from commit f6787614fd4db2a9d5e649af0e819852ebd5a19d)

2 years agohostname: avoid strcpy() overlap in -d flag handling
Kyle Evans [Sat, 25 Sep 2021 05:00:31 +0000 (00:00 -0500)]
hostname: avoid strcpy() overlap in -d flag handling

We don't need the strcpy() anyways, just use a pointer to the hostname
buffer and move it forward for `hostname -d`.

Sponsored by: Klara, Inc.

(cherry picked from commit 33c1e7271ac21a626829289780b88071ae46ec65)

2 years agoman: reset OPTIND before parsing args
Kyle Evans [Wed, 22 Sep 2021 19:58:19 +0000 (14:58 -0500)]
man: reset OPTIND before parsing args

From jilles: POSIX requires that a script set `OPTIND=1` before using
different sets of parameters with `getopts`, or the results will be
unspecified.

The specific problem observed here is that we would execute `man -f` or
`man -k` without cleaning up state from man_parse_args()' `getopts`
loop.  FreeBSD's /bin/sh seems to reset OPTIND to 1 after we hit the
second getopts loop, rendering the following shift harmless; other
/bin/sh implementations will leave it at what we came into the loop at
(e.g., bash as /bin/sh), shifting off any keywords that we had.

Input from: jilles
Reviewed by: allanjude, bapt, imp
Sponsored by: Klara, Inc.

(cherry picked from commit f555b39e6bb7cbfbe1905e90f64c4dfc4456fabb)

2 years agocmp(1): Add EXAMPLES section
Fernando Apesteguía [Sat, 20 Jun 2020 11:20:16 +0000 (11:20 +0000)]
cmp(1): Add EXAMPLES section

Add a small number of examples depicting the use of -l, -z and byte offsets

(cherry picked from commit 1831993577db18d193e94269e337f6286536814e)

2 years agocmp(1): Add EXAMPLES section
Fernando Apesteguía [Tue, 16 Jun 2020 15:54:59 +0000 (15:54 +0000)]
cmp(1): Add EXAMPLES section

Add simple examples showing the use of -l, -z, stdin and offsets

(cherry picked from commit 022ebaf5432d5a8112c7d75ab9d406176b3dfd39)

2 years agoiflib: ensure that tx interrupts enabled and cleanups
Matt Macy [Sat, 19 Dec 2020 01:08:33 +0000 (17:08 -0800)]
iflib: ensure that tx interrupts enabled and cleanups

Doing a 'dd' over iscsi will reliably cause stalls. Tx
cleaning _should_ reliably happen as data is sent.
However, currently if the transmit queue fills it will
wait until the iflib timer (hz/2) runs.

This change causes the the tx taskq thread to be run
if there are completed descriptors.

While here:

- make timer interrupt delay a sysctl

- simplify txd_db_check handling

- comment on INTR types

Background on the change:

Initially doorbell updates were minimized by only writing to the register
on every fourth packet. If txq_drain would return without writing to the
doorbell it scheduled a callout on the next tick to do the doorbell write
to ensure that the write otherwise happened "soon". At that time a sysctl
was added for users to avoid the potential added latency by simply writing
to the doorbell register on every packet. This worked perfectly well for
e1000 and ixgbe ... and appeared to work well on ixl. However, as it
turned out there was a race to this approach that would lockup the ixl MAC.
It was possible for a lower producer index to be written after a higher one.
On e1000 and ixgbe this was harmless - on ixl it was fatal. My initial
response was to add a lock around doorbell writes - fixing the problem but
adding an unacceptable amount of lock contention.

The next iteration was to use transmit interrupts to drive delayed doorbell
writes. If there were no packets in the queue all doorbell writes would be
immediate as the queue started to fill up we could delay doorbell writes
further and further. At the start of drain if we've cleaned any packets we
know we've moved the state machine along and we write the doorbell (an
obvious missing optimization was to skip that doorbell write if db_pending
is zero). This change required that tx interrupts be scheduled periodically
as opposed to just when the hardware txq was full. However, that just leads
to our next problem.

Initially dedicated msix vectors were used for both tx and rx. However, it
was often possible to use up all available vectors before we set up all the
queues we wanted. By having rx and tx share a vector for a given queue we
could halve the number of vectors used by a given configuration. The problem
here is that with this change only e1000 passed the necessary value to have
the fast interrupt drive tx when appropriate.

Reported by: mav@
Tested by: mav@
Reviewed by:    gallatin@
MFC after:      1 month
Sponsored by:   iXsystems
Differential Revision:  https://reviews.freebsd.org/D27683

(cherry picked from commit 81be655266fac2b333e25f386f32c9bcd17f523d)

2 years agoixgbe: fix impossible condition
Eric van Gyzen [Fri, 21 Aug 2020 19:34:41 +0000 (19:34 +0000)]
ixgbe: fix impossible condition

Coverity flagged this condition: The condition
    offset == 0 && offset == 65535
can never be true because offset cannot be equal
to two different values at the same time.

Submitted by: bret_ketchum@dell.com
Reported by: Coverity
Reviewed by: tsoome, cem
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D26144

(cherry picked from commit ab1c54fec66803235a8923333fa79f2cbfa33354)

2 years agoixgbe: whitespace cleanup pass
Kevin Bowling [Sun, 26 Sep 2021 18:29:00 +0000 (11:29 -0700)]
ixgbe: whitespace cleanup pass

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32131

(cherry picked from commit 15d077995bd2c56b7b1742ea2d4e9070ff7e9427)

2 years agoiflib: Make if_shared_ctx_t a pointer to const
Mark Johnston [Mon, 8 Mar 2021 17:39:06 +0000 (12:39 -0500)]
iflib: Make if_shared_ctx_t a pointer to const

This structure is shared among multiple instances of a driver, so we
should ensure that it doesn't somehow get treated as if there's a
separate instance per interface.  This is especially important for
software-only drivers like wg.

DEVICE_REGISTER() still returns a void * and so the per-driver sctx
structures are not yet defined with the const qualifier.

Reviewed by: gallatin, erj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29102

(cherry picked from commit ffe3def903a5f239c319e5fe12450659658974a5)

2 years agoixgbe(4): Eliminate bogus sizeof() expressions
Conrad Meyer [Wed, 29 Jan 2020 05:31:40 +0000 (05:31 +0000)]
ixgbe(4): Eliminate bogus sizeof() expressions

All of these uses of sizeof() were on the wrong type in relation to the pointer
passed to SYSCTL_ADD_PROC as arg1.  Fortunately, none of the handlers actually
use arg2.  So just don't pass a (non-zero) arg2.

Reported by: Coverity
CID: 1007701

(cherry picked from commit d09fbcd0b6eae765a190eaa4dc931050af7bd25f)

2 years agoixgbe(4): Fix enabling/disabling and reconfiguration of queues
Eric Joyner [Tue, 23 Jul 2019 18:14:32 +0000 (18:14 +0000)]
ixgbe(4): Fix enabling/disabling and reconfiguration of queues

- Wrong order of casting and bit shift caused that enabling and disabling
  queues didn't work properly for queues number larger than 32. Use literals
  with right suffix instead.

- TX ring tail address was not updated during reinitiailzation of TX
  structures. It could block sending traffic.

- Also remove unused variables 'eims' and 'active_queues'.

Submitted by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: erj@
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D20826

(cherry picked from commit 2dc2d580354e95491a033fa9e21c8ef0cbd9bc42)

2 years agoixgbe: Rename 'struct adapter' to 'struct ixgbe_softc'
Kevin Bowling [Sat, 25 Sep 2021 23:12:23 +0000 (16:12 -0700)]
ixgbe: Rename 'struct adapter' to 'struct ixgbe_softc'

Rename the 'struct adapter' to 'struct ixgbe_softc' to avoid type
ambiguity in things like kgdb.

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32131

(cherry picked from commit b1d5caf3c7504a1ece0498ec3f7360ac760577f7)

2 years agogenoffset.sh: Use 10 X's instead of 5 for pick mkdtemp implementations
Warner Losh [Tue, 7 Sep 2021 16:08:51 +0000 (10:08 -0600)]
genoffset.sh: Use 10 X's instead of 5 for pick mkdtemp implementations

Linux fails to build now because the mkdtemp in the bootstrapped
environment wants 6 or more X's. Use 10 out of an abundance of caution.

Sponsored by: Netflix
Reviewed by: arichards
Differential Revision: https://reviews.freebsd.org/D31863

(cherry picked from commit ecfbb2e30241ee460617ad4e0c0be16d9930945a)

2 years agocdefs.h: Remove redundant #ifdefs
Warner Losh [Tue, 7 Sep 2021 15:34:02 +0000 (09:34 -0600)]
cdefs.h: Remove redundant #ifdefs

Remove redunant #ifdef __GNUC__ inside an #if defined(__GNUC__)
block. They are nops.

Sponsored by: Netflix

(cherry picked from commit 1e7b5f950b2d54ddb257d008592563c4d753aa54)

2 years agoppbus: Set the lock for pps interface, update to latest api
Warner Losh [Wed, 1 Sep 2021 19:37:27 +0000 (13:37 -0600)]
ppbus: Set the lock for pps interface, update to latest api

Since we take a lock when we enter the ioctl, we need to set driver_mtx
in the pps structure so it can be dropped while sleeping during a call
to timepps_fetch() with a non-zero timeout (PPS_CANWAIT feature).

MFC After: 5 days
Sponsored by: Netflix
Reviewed by: ian
Differential Revision: https://reviews.freebsd.org/D31763

(cherry picked from commit c62aa65b2a7a6492e712a69c58a35347aa441a98)

2 years agounzip: sync with NetBSD upstream to add passphrase support
Yoshihiro Takahashi [Sat, 25 Sep 2021 16:32:42 +0000 (01:32 +0900)]
unzip: sync with NetBSD upstream to add passphrase support

- Add support for password protected zip archives.
  We use memset_s() rather than explicit_bzero() for more portable
  (See PR).
- Use success/failure macro in exit()
- Mention ZIPX format in unzip(1)

Submitted by: Mingye Wang and Alex Kozlov (ak@)
PR: 244181
Reviewed by: mizhka
Obtained from: NetBSD
Differential Revision: https://reviews.freebsd.org/D28892

(cherry picked from commit a4724ff48108840416c83f10e15d666ac8d78937)

2 years agong_ether: Create netgraph nodes for bridge interfaces.
Yoshihiro Takahashi [Sat, 25 Sep 2021 16:24:33 +0000 (01:24 +0900)]
ng_ether: Create netgraph nodes for bridge interfaces.

Create netgraph nodes for bridge interfaces when the ng_ether module
is loaded.  If a bridge interface is created after loading the ng_ether
module, a netgraph node is created via ether_ifattach().

(cherry picked from commit d653b188e89b5e44b2708342c7d3b789398f9cde)

2 years agopf: fix pagefault in pf_getstatus()
Kristof Provost [Thu, 23 Sep 2021 08:39:49 +0000 (10:39 +0200)]
pf: fix pagefault in pf_getstatus()

We can't copyout() while holding a lock, in case it triggers a page
fault.
Release the lock before copyout, which is safe because we've already
copied all the data into the nvlist.

PR: 258601
Reviewed by: mjg
MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32076

(cherry picked from commit cb13059663e455b3fc69c293dadec53c164490dc)

2 years agogmultipath failloop test: Add a checker for dtrace executes successfully or not
Li-Wen Hsu [Tue, 28 Sep 2021 18:02:27 +0000 (02:02 +0800)]
gmultipath failloop test: Add a checker for dtrace executes successfully or not

To provide a more informative error message.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 819961c5808b053c626648e202dec42a19ebe7a6)
(cherry picked from commit 38dac71d0a95ab2cf2cdfa1232cc556008b7ac94)
(cherry picked from commit b9b5a4dd590e1b30d92dc73b3d1f22d3303e7e41)

2 years agoe1000: fix K1 configuration
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:09 +0000 (10:51 +0800)]
e1000: fix K1 configuration

This patch is for the following updates to the K1 configurations:
Tx idle period for entering K1 should be 128 ns.
Minimum Tx idle period in K1 should be 256 ns.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
PR: 258153
Reviewed by: erj
Tested by: iron.udjin@gmail.com
Approved by: imp
Obtained from: DPDK (6f934fa24dfd437c90ead96bc7598ee77a117ede)
MFC after: 1 week

(cherry picked from commit d5ad2f2a67df54ac40148cca21e726bc61a48982)

2 years agonfsclient: Fix a typo in a comment
Gordon Bergling [Sun, 26 Sep 2021 13:17:00 +0000 (15:17 +0200)]
nfsclient: Fix a typo in a comment

- s/derefernce/dereference/

(cherry picked from commit 90d60ca8b7f2483cdc162633f7ea4738dad8fa0e)

2 years agopcm(4): Fix a common typo in source code comments
Gordon Bergling [Sun, 26 Sep 2021 09:21:16 +0000 (11:21 +0200)]
pcm(4): Fix a common typo in source code comments

- s/prefered/preferred/

(cherry picked from commit 513ee901eec639da45796d563168f0af966705e6)

2 years agosctp: Fix a typo in a comment
Gordon Bergling [Sun, 26 Sep 2021 13:15:39 +0000 (15:15 +0200)]
sctp: Fix a typo in a comment

- s/assue/assume/

(cherry picked from commit d2e616147db7b688f2b6fa8ec6d545bc4253de92)

2 years agojail(9): Fix a typo in a comment
Gordon Bergling [Sun, 26 Sep 2021 13:17:41 +0000 (15:17 +0200)]
jail(9): Fix a typo in a comment

- s/erorr/error/

(cherry picked from commit 8771ff75384dec8c9f95ce25b6ca9a639c4b208c)

2 years agocontrib/tzdata: correct DST in Jordan and Samoa
Philip Paeps [Wed, 29 Sep 2021 04:43:58 +0000 (12:43 +0800)]
contrib/tzdata: correct DST in Jordan and Samoa

Direct commit to stable/12.

The recent tzdata 2021b release includes several controversial changes
under active debate on the tz mailing list.  Pending consensus, and
hopefully a 2021c release reflecting it, only merge the DST changes for
Jordan and Samoa.  This corrects present and future timestamps in those
regions.

2 years agoFix false device_set_unit() error.
Alexander Motin [Wed, 22 Sep 2021 12:42:36 +0000 (08:42 -0400)]
Fix false device_set_unit() error.

It should silently succeed if the current unit number is the same as
requested, not fail immediately.

MFC after: 1 week

(cherry picked from commit 884f38590c3cc0b1a2c00904c1f1f6c791376308)

2 years agoipmi(4): Limit maximum watchdog pre-timeout interval.
Alexander Motin [Wed, 15 Sep 2021 01:06:39 +0000 (21:06 -0400)]
ipmi(4): Limit maximum watchdog pre-timeout interval.

Previous code by default setting pre-timeout interval to 120 seconds
made impossible to set timeout interval below that, resulting in error
0xcc (Invalid data field in Request) at least on Supermicro boards.

To fix that limit maximum pre-timeout interval to ~1/4 of the timeout
interval, that sounds like a reasonable default: not too short to fire
too late, but also not too long to give many false reports.

MFC after: 2 weeks

(cherry picked from commit 6c2d4404161aa2bac1c7992afbf5a763f1a6f66e)

2 years agoe1000: Re-arm link changes
Kevin Bowling [Mon, 27 Sep 2021 16:17:48 +0000 (09:17 -0700)]
e1000: Re-arm link changes

A change to MSI-X link handler was somehow causing issues on
MSI-based em(4) NICs.

Revert the change based on user reports and testing.

PR: 258551
Reported by: Franco Fichtner <franco@opnsense.org>, t_uemura@macome.co.jp
Reviewed by: markj, Franco Fichtner <franco@opnsense.org>
Tested by: t_uemura@macome.co.jp
MFC after: 1 day

(cherry picked from commit 450c3f8b3d259c7eb82488319aff45f1f6554aaf)

2 years agoe1000: Fix tabstop width in if_em.h
Kevin Bowling [Sun, 26 Sep 2021 16:24:53 +0000 (09:24 -0700)]
e1000: Fix tabstop width in if_em.h

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D32145

(cherry picked from commit 21ab8c75c940dd15343b4af28b18a66f377e670a)

2 years agouart: Add PCI ID for intel 100 Series/C230 Series AMT
Sean Bruno [Sat, 25 Sep 2021 22:23:08 +0000 (15:23 -0700)]
uart: Add PCI ID for intel 100 Series/C230 Series AMT

Reviewed by: kib
Tested by: kbowling
Differential Revision: https://reviews.freebsd.org/D32146

(cherry picked from commit fb640be4e9443f1890680c27b213825300bc65f4)

2 years agoe1000: Rename 'struct adapter' to 'struct e1000_sc'
Kevin Bowling [Sat, 25 Sep 2021 00:09:43 +0000 (17:09 -0700)]
e1000: Rename 'struct adapter' to 'struct e1000_sc'

Rename the 'struct adapter' to 'struct e1000_sc' to avoid type ambiguity
in things like kgdb.

Reviewed by: jhb, markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D32129

(cherry picked from commit dc9260515449cde9a4b26b5448f7386388c55bbd)

2 years agoiflib: Free resources in a consistent order during detach
Sai Rajesh Tallamraju [Mon, 1 Feb 2021 16:13:00 +0000 (11:13 -0500)]
iflib: Free resources in a consistent order during detach

Memory and PCI resources are freed with no particular order.  This could
cause use-after-frees when detaching following a failed attach.  For
instance, iflib_tx_structures_free() frees ctx->ifc_txqs[] but
iflib_tqg_detach() attempts to access this array. Similarly, adapter
queues gets freed by IFDI_QUEUES_FREE() but IFDI_DETACH() attempts to
access adapter queues to free PCI resources.

MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D27634

(cherry picked from commit 38bfc6dee33bedb290e1ea2540f97a86fe3caee0)

2 years agoe1000: Consistently use FALLTHROUGH
Kevin Bowling [Fri, 17 Sep 2021 03:13:26 +0000 (20:13 -0700)]
e1000: Consistently use FALLTHROUGH

Approved by: imp
MFC after: 1 week

(cherry picked from commit e05d9788b7e90ffd6405dc59656b52a63ba7ff3e)

2 years agoe1000: Use C99 bool types
Kevin Bowling [Fri, 17 Sep 2021 03:08:08 +0000 (20:08 -0700)]
e1000: Use C99 bool types

Approved by: imp
MFC after: 1 week

(cherry picked from commit 1bbdc25fc1edb43562bf2a5f30df7381078991d4)

2 years agoe1000: Fix up HW vlan ops
Kevin Bowling [Wed, 15 Sep 2021 14:47:19 +0000 (07:47 -0700)]
e1000: Fix up HW vlan ops

2796f7ca:
* Don't reset the entire adapter for vlan changes, fix up the problems
* Add some functions for vlan filter (vfta) manipulation
* Don't muck with the vfta if we aren't doing HW vlan filtering
* Disable interrupts when manipulating vfta on lem(4)-class NICs
* On the I350 there is a specification update (2.4.20) in which the
suggested workaround is to write to the vfta 10 times (if at first you
don't succeed, try, try again). Our shared code has the goods, use it
* Increase a VF's frame receive size in the case of vlans

From the referenced PR, this reduced vlan configuration from minutes
to seconds with hundreds or thousands of vlans and prevents wedging the
adapter with needless adapter reinitialization for each vlan ID.

PR: 230996
Reviewed by: markj
Tested by: Ozkan KIRIK <ozkan.kirik@gmail.com>
Differential Revision: https://reviews.freebsd.org/D30002

22b20b45:
e1000: Fix variable typo

Forgot to git add this in last commit

Reported by: jenkins
Fixes: 2796f7cab107

(cherry picked from commit 2796f7cab10785ef40efbba97ef67ab319c96e9c)
(cherry picked from commit 22b20b45c9118bf6ef313c074cdb107a1eaca78e)

2 years agobcm2835_sdhci: don't use DMA for kernel dumps
Mitchell Horne [Thu, 9 Sep 2021 18:07:06 +0000 (15:07 -0300)]
bcm2835_sdhci: don't use DMA for kernel dumps

When handling a data irq, the sdhci driver calls the
sdhci_platform_will_handle() method, to determine if it should allow the
platform driver to handle the transfer or fall back to programmed I/O.
While dumping, the data irq path may be invoked directly (not from an
interrupt context), which the bcm2835_sdhci DMA code is not prepared to
handle. Return early in this case, to force the fallback to PIO.

Otherwise, the KASSERT that follows will be triggered, and the dump will
fail. On non-INVARIANTS kernels, the system will hang, waiting for a DMA
interrupt that will never arrive.

Reviewed by: kevans
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31893

(cherry picked from commit 806ebc9eba2a45638d63ae8a2ed20e6fb44dd06e)

2 years agosyslog.conf.5: Fix the message priority order
Felix Guest [Tue, 21 Sep 2021 15:29:39 +0000 (11:29 -0400)]
syslog.conf.5: Fix the message priority order

PR: 219942

(cherry picked from commit 8678140127296c15894094087b81f71fe79a21d9)

2 years agofreebsd32: Fix a double copyin in sendmsg() and recvmsg()
Mark Johnston [Sun, 19 Sep 2021 17:45:09 +0000 (13:45 -0400)]
freebsd32: Fix a double copyin in sendmsg() and recvmsg()

freebsd32_sendmsg() and freebsd32_recvmsg() both copyin the message
header twice, once directly and once in freebsd32_copyinmsghdr().  The
iovec length from the former is used when copying in msg_iov, but the
rest of the kernel uses the iovec length from the latter.  When
kern_sendit() and kern_recvit() iterate over the iovec to compute the
residual for I/O, they can therefore end up walking past the end of the
copied in iovec, either resulting in a system call error, userspace
memory corruption from uiomove() with invalid iovecs, or a kernel page
fault if the copied-in iovec is followed by an unmapped KVA region.

Reported by: syzbot+7cc64cd0c49605acd421@syzkaller.appspotmail.com
Reviewed by: kib, emaste
Sponsored by: The FreeBSD Foundation

(cherry picked from commit fea1a98ead918b39280b586773a923e76194400b)

2 years agofreebsd32: Provide an ANSI definition for freebsd32_recvmsg()
Mark Johnston [Sun, 19 Sep 2021 17:41:43 +0000 (13:41 -0400)]
freebsd32: Provide an ANSI definition for freebsd32_recvmsg()

Fix style in the freebsd32_sendmsg() definition.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 4bda16ff184bfca5ee4bf9709a06323d9cf5945b)

2 years agovt: bound buffer access in redraw optimization
Ed Maste [Wed, 22 Sep 2021 18:41:00 +0000 (14:41 -0400)]
vt: bound buffer access in redraw optimization

PR: 248628
Reported by: oleg
Reviewed by: cem, oleg (both earlier)
Fixes: ee97b2336aa4 ("Speed up vt(4) by keeping...")
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32059

(cherry picked from commit dbc7ca59451561a179f9852642e13ef024169d84)

2 years agoUpdate leap-seconds to leap-seconds.3676924800.
Xin LI [Mon, 20 Sep 2021 05:26:22 +0000 (22:26 -0700)]
Update leap-seconds to leap-seconds.3676924800.

Obtained from: ftp://ftp.nist.gov/pub/time/leap-seconds.3676924800.
MFC after: 3 days

(cherry picked from commit 7ba7bf48d5bd6ca89f4e81579456b74ee7aa9e4f)

2 years agoe1000: Catch up commit with DPDK
Kevin Bowling [Fri, 17 Sep 2021 02:30:49 +0000 (19:30 -0700)]
e1000: Catch up commit with DPDK

Various syncs with the e1000 shared code from DPDK:
"cid-gigabit.2020.06.05.tar.gz released by ND"

Approved by: imp
Obtained from: DPDK
MFC after: 1 week

(cherry picked from commit 984d1616be883bc2c351aff9aa69b1abd7d1214c)

2 years agoe1000: prevent ULP flow if cable connected
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:03 +0000 (10:51 +0800)]
e1000: prevent ULP flow if cable connected

Enabling ulp on link down when cable is connect caused an infinite
loop of linkup/down indications in the NDIS driver.
After discussed, correct flow is to enable ULP only when cable is
disconnected.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Approved by: imp
Obtained from: DPDK (4bff263d54d299269966365f9697941eecaa241b)
MFC after: 1 week

(cherry picked from commit 40fa6e53f53cde84f6f5c7330f89e4ae373d7d93)

2 years agoe1000: clean LTO warnings
Andrzej Ostruszka [Thu, 7 Nov 2019 15:03:15 +0000 (16:03 +0100)]
e1000: clean LTO warnings

During LTO build compiler reports some 'false positive' warnings about
variables being possibly used uninitialized.  This patch silences these
warnings.

Exemplary compiler warning to suppress (with LTO enabled):
error: 'link' may be used uninitialized in this function
[-Werror=maybe-uninitialized]
  if (link) {

Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
Approved by: imp
Obtained from: DPDK (46136031f19107f4e9b6b3a952cb7f57877a7f0f)
MFC after: 1 week

(cherry picked from commit 089cdb3990f47be3cd34d1a57567a2e89c917929)

2 years agoe1000: fix multicast setting in VF
Yong Wang [Tue, 21 Feb 2017 09:33:23 +0000 (04:33 -0500)]
e1000: fix multicast setting in VF

In function e1000_update_mc_addr_list_vf(), "msgbuf[0]" is used prior
to initialization at "msgbuf[0] |= E1000_VF_SET_MULTICAST_OVERFLOW".
And "msgbuf[0]" is overwritten at "msgbuf[0] = E1000_VF_SET_MULTICAST".

Fix it by moving the second line prior to the first one that mentioned
above.

Fixes: dffbaf7880a8 ("e1000: revert fix for multicast in VF")
Cc: stable@dpdk.org
Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Approved by: imp
Obtained from: DPDK (f58ca2f9ef6)
MFC after: 1 week

(cherry picked from commit ecf2a89a997ad4a14339b6a2f544e44b422620a0)

2 years agoe1000: fix timeout for shadow RAM write
Chengwen Feng [Wed, 21 Apr 2021 09:15:35 +0000 (17:15 +0800)]
e1000: fix timeout for shadow RAM write

This fixes the timed out for shadow RAM write EEWR can't be detected.

Fixes: 5a32a257f957 ("e1000: more NICs in base driver")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Approved by: imp
Obtained from: DPDK (4a8ab48ec47b3616272e50620b8e1a9599358ea6)
MFC after: 1 week

(cherry picked from commit f6517a7e69c10c6057d6c990a9f3ea22a2b62398)

2 years agoe1000: cleanup pre-processor tags
Guinan Sun [Mon, 6 Jul 2020 08:12:20 +0000 (08:12 +0000)]
e1000: cleanup pre-processor tags

The codes has been exposed correctly, so remove pre-processor tags.

Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (a50e998a0fd94e5db508710868a3417b1846425c)
MFC after: 1 week

(cherry picked from commit 9c4a0fabc8b88af0d9fd3f0d67bd080714d1ee4b)

2 years agoe1000: introduce DPGFR register
Guinan Sun [Mon, 6 Jul 2020 08:12:19 +0000 (08:12 +0000)]
e1000: introduce DPGFR register

Defined DPGFR, Dynamic Power Gate Force Control Register.

Signed-off-by: Vitaly Lifshits <vitaly.lifshits@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (1469e5aceffbdcebe834292aadb40b1bd1602867)
MFC after: 1 week

(cherry picked from commit 7fb2111413c799414c86d7bfdcc72bc1c6302726)

2 years agoe1000: expose FEXTNVM registers and masks
Guinan Sun [Mon, 6 Jul 2020 08:12:16 +0000 (08:12 +0000)]
e1000: expose FEXTNVM registers and masks

Adding defines for FEXTNVM8 and FEXTNVM12 registers with new masks for
future use.

Signed-off-by: Nir Efrati <nir.efrati@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (6d208ec099cd870a73c6b444b350a82c7a26c5e4)
MFC after: 1 week

(cherry picked from commit de965d042fa4d341cec3fa7cacac0f30f224bde4)

2 years agoe1000: add missed define for VFTA
Guinan Sun [Mon, 6 Jul 2020 08:12:13 +0000 (08:12 +0000)]
e1000: add missed define for VFTA

VLAN filtering using the VFTA (VLAN Filter Table Array) and
should be initialized prior to setting rx mode.

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (fc9933953c90e99970aa867c38f9c6e6c5d0488d)
MFC after: 1 week

(cherry picked from commit a8bb4ab7cfb84195ef8af3c788fecdc8830fc960)

2 years agoe1000: increase timeout for ME ULP exit
Guinan Sun [Mon, 6 Jul 2020 08:12:09 +0000 (08:12 +0000)]
e1000: increase timeout for ME ULP exit

Due timing issues in WHL and since recovery by host is
not always supported, increased timeout for Manageability Engine(ME)
to finish Ultra Low Power(ULP) exit flow for Nahum before timer expiration.

Signed-off-by: Nir Efrati <nir.efrati@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (cf1f3ca45d33e793ca581200b4000c39a798113e)
MFC after: 1 week

(cherry picked from commit e8e3171d992f3255cc8e5a0f59912d07679cc94c)

2 years agoe1000: add missing register defines
Guinan Sun [Mon, 6 Jul 2020 08:12:08 +0000 (08:12 +0000)]
e1000: add missing register defines

Added defines for the EEC, SHADOWINF and FLFWUPDATE registers needed for
the nvmupd_validate_offset function to correctly validate the NVM update
offset.

Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (2c7fe65ab9a31e6ebf438dad7ccc59bcde83a89f)
MFC after: 1 week

(cherry picked from commit 09888d4bc1a2c45d121046f79be5c01e4889a67e)

2 years agoe1000: add PCIm function state
Guinan Sun [Mon, 6 Jul 2020 08:12:07 +0000 (08:12 +0000)]
e1000: add PCIm function state

Added define to pcim function state.

Signed-off-by: Vitaly Lifshits <vitaly.lifshits@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (7ee1a3b273c7f321b50e6ba17c3d9537b1b08347)
MFC after: 1 week

(cherry picked from commit a6f0cc373f0afc24c9c27bbba45a6a7a3ac268d1)

2 years agoe1000: expose MAC functions
Guinan Sun [Mon, 6 Jul 2020 08:12:06 +0000 (08:12 +0000)]
e1000: expose MAC functions

Now the functions are being accessed outside of the file, we need
to properly expose them for silicon families to use.

Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (df01c0ee277d51f81d7d72501dba97550d3b6c4a)
MFC after: 1 week

(cherry picked from commit d1c37752e2afb51dfb2e08afe714a799788b6ede)

2 years agoe1000: update for i210 slow system clock
Guinan Sun [Mon, 6 Jul 2020 08:11:56 +0000 (08:11 +0000)]
e1000: update for i210 slow system clock

This code is required for the update for system clock.

Signed-off-by: Todd Fujinaka <todd.fujinaka@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (3f0188c8f29847038bc9f306b2570ace57e3811c)
MFC after: 1 week

(cherry picked from commit 1883a6ff3b2ebaf108c45717c8eb94e0a76bb0b9)

2 years agoe1000: remove duplicated phy codes
Guinan Sun [Mon, 6 Jul 2020 08:12:05 +0000 (08:12 +0000)]
e1000: remove duplicated phy codes

Add two files base.c and base.h to reduce the redundancy
in the silicon family code.
Remove the code duplication from e1000_82575 files.
Clean family specific functions from base.
Fix up a stray and duplicate function declaration.

Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (44dddd14059f151f39f7e075b887decfc9a10f11)
MFC after: 1 week

(cherry picked from commit 6b9d35fac12bf657cd1df8f1521c70704ff62b61)

2 years agoe1000: modify HW level time sync mechanisms
Guinan Sun [Mon, 6 Jul 2020 08:12:04 +0000 (08:12 +0000)]
e1000: modify HW level time sync mechanisms

Add additional configuration space access to allow HW
level time sync mechanism.

Signed-off-by: Evgeny Efimov <evgeny.efimov@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (d53391f1fe2e0eba8818517fdf285f893d95dcc8)
MFC after: 1 week

(cherry picked from commit d50f362b505e9026fbd33d00dc43e09cac26a209)

2 years agoe1000: fix minor issues and improve code style
Guinan Sun [Mon, 6 Jul 2020 08:12:03 +0000 (08:12 +0000)]
e1000: fix minor issues and improve code style

Fix typo in piece of code of NVM access for SPT.
And cleans up the remaining instances in the shared code
where it was not adhering to the Linux code standard.
Wrong description was found in the mentioned file, so fix them.
Remove shadowing variable declarations.

Relating to operands in bitwise operations having different sizes.
Unreachable code since *clock_in_i2c_* always return success.
Don't return unused s32 and don't check for constants.

Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Signed-off-by: Vitaly Lifshits <vitaly.lifshits@intel.com>
Signed-off-by: Robert Konklewski <robertx.konklewski@intel.com>
Signed-off-by: Doug Dziggel <douglas.a.dziggel@intel.com>
Signed-off-by: Todd Fujinaka <todd.fujinaka@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (b8592c89c8fbc871d22313dcac0b86c89a7d5a62)
MFC after: 1 week

(cherry picked from commit 6c59e1866ca7a48d84f1d298bb3e6a07d2e6f756)

2 years agoe1000: add function parameter descriptions
Guinan Sun [Mon, 6 Jul 2020 08:12:02 +0000 (08:12 +0000)]
e1000: add function parameter descriptions

Add function parameter descriptions to address gcc 7 warnings.

Signed-off-by: Todd Fujinaka <todd.fujinaka@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (1bf35d435c9764e83be76042fa6489dd127b6c40)
MFC after: 1 week

(cherry picked from commit 5b426b3e8cbd5abdb3a57ff49cd27c36cac03427)

2 years agoe1000: expose xMDIO methods
Guinan Sun [Mon, 6 Jul 2020 08:12:00 +0000 (08:12 +0000)]
e1000: expose xMDIO methods

Move read and write xmdio methods to e1000_phy.

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (b14d20f1b2bb0e6d95f19963c5d7f55374e0ead9)
MFC after: 1 week

(cherry picked from commit da24467c7a162691a14f2f74d90ff8dedb816cfc)

2 years agoe1000: add missing device ID
Guinan Sun [Mon, 6 Jul 2020 08:12:10 +0000 (08:12 +0000)]
e1000: add missing device ID

Adding Intel(R) I210 Gigabit Network Connection 15F6 device ID for SGMII
flashless automotive device.

Signed-off-by: Kamil Bednarczyk <kamil.bednarczyk@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (586d770bfefc01d4af97c0ddf17c960c3e49ec22)
MFC after: 1 week

(cherry picked from commit 82a9d0c2c1ef75703d16e49e96d1e7b0bf046882)

2 years agoe1000: support flashless i211 PBA
Guinan Sun [Mon, 6 Jul 2020 08:11:59 +0000 (08:11 +0000)]
e1000: support flashless i211 PBA

Add support to print PBA when using flashless.

Signed-off-by: Todd Fujinaka <todd.fujinaka@intel.com>
Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (d3c41d90dfd5b39dec14c74cf53086f4e6634aed)
MFC after: 1 week

(cherry picked from commit de0ae5d1cb896dbc04c5334ef0b864b3c841c3ce)

2 years agoe1000: Update copyrights and readme
Kevin Bowling [Thu, 16 Sep 2021 11:35:45 +0000 (04:35 -0700)]
e1000: Update copyrights and readme

Copyrights in sync with "cid-gigabit.2020.06.05.tar.gz released by ND"
(from DPDK).

README from the latest em-7.7.8 on intel.com

Approved by: imp
MFC after: 1 week

(cherry picked from commit 702cac6c6bf20ca43db26c38185f65fc9ed1935e)

2 years agoFix -Wpointer-sign warnings in usr.bin/grep
Alex Richardson [Mon, 21 Sep 2020 09:03:37 +0000 (09:03 +0000)]
Fix -Wpointer-sign warnings in usr.bin/grep

Reviewed By: kevans
Differential Revision: https://reviews.freebsd.org/D26479

(cherry picked from commit 86ce5365215ab252e0d1904b410381c96cfc4076)

2 years agousr.bin/grep: Fix Address OOB read error
Alex Richardson [Tue, 19 Jan 2021 11:35:07 +0000 (11:35 +0000)]
usr.bin/grep: Fix Address OOB read error

I found this when compiling all the bootstrap tools with -fsanitize=addres:

==65590==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62d000008400 at pc 0x000000473053 bp 0x7ffc1c7dd910 sp 0x7ffc1c7dd0b8
READ of size 32769 at 0x62d000008400 thread T0
    #0 0x473052 in regexec (/local/scratch/alr48/cheri/build/freebsd-amd64-build/local/scratch/alr48/cheri/freebsd/amd64.amd64/tmp/legacy/bin/grep+0x473052)
    #1 0x4c9cf3 in procline /local/scratch/alr48/cheri/freebsd/usr.bin/grep/util.c:539:8
    #2 0x4c8687 in procfile /local/scratch/alr48/cheri/freebsd/usr.bin/grep/util.c:379:18
    #3 0x4c6596 in main /local/scratch/alr48/cheri/freebsd/usr.bin/grep/grep.c:714:8

0x62d000008400 is located 0 bytes to the right of 32768-byte region [0x62d000000400,0x62d000008400)
allocated by thread T0 here:
    #0 0x493d5d in malloc (/local/scratch/alr48/cheri/build/freebsd-amd64-build/local/scratch/alr48/cheri/freebsd/amd64.amd64/tmp/legacy/bin/grep+0x493d5d)
    #1 0x4cad75 in grep_malloc /local/scratch/alr48/cheri/freebsd/usr.bin/grep/util.c:656:13
    #2 0x4c8129 in procfile /local/scratch/alr48/cheri/freebsd/usr.bin/grep/util.c
    #3 0x4c6596 in main /local/scratch/alr48/cheri/freebsd/usr.bin/grep/grep.c:714:8

SUMMARY: AddressSanitizer: heap-buffer-overflow (/local/scratch/alr48/cheri/build/freebsd-amd64-build/local/scratch/alr48/cheri/freebsd/amd64.amd64/tmp/legacy/bin/grep+0x473052) in regexec

Reviewed By: kevans
MFC after: 1 week

(cherry picked from commit 81c3f64110bb76e24d6062eafd7206c10f676d6f)

2 years agoreadelf: document that -u / --unwind is not yet implemented
Ed Maste [Fri, 17 Sep 2021 13:59:41 +0000 (09:59 -0400)]
readelf: document that -u / --unwind is not yet implemented

ELF tool chain readelf accepts -u / --unwind but just ignores the
option.  This was previously undocumented, which could be confusing for
someone encountering `readelf -u` (in a script or GNU readelf example).

Reported by: markj (in D32003)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit deef4b8ce8ba7292fe5088bf9f6d4e2e35662fe8)

2 years agoreadelf: include notes (-n) and unwind (-u) in --all/-a
Ed Maste [Fri, 17 Sep 2021 12:06:27 +0000 (08:06 -0400)]
readelf: include notes (-n) and unwind (-u) in --all/-a

This matches the GNU and LLVM versions of readelf.

As markj noted in the review -u is not actually implemented yet and has
no effect.  The option is accepted and just ignored.

Reported by: andrew
Reviewed by: andrew, markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32003

(cherry picked from commit f161abf9f2cd7fdd28543f9774de82c89675477c)

2 years agogrep: fix combination of quiet and count flag
Mariusz Zaborski [Fri, 9 Jul 2021 12:09:14 +0000 (14:09 +0200)]
grep: fix combination of quiet and count flag

When the quiet (-q) flag is provided, we don't expect any output.
Currently, the behavior is broken:
$ grep -cq flag util.c
1

$ grep -cs flag util.c
55

First of all, we print a number to stdout. Secondly, it just returns
0 or 1 (which is unexpected). GNU grep with c and q flags doesn't
print anything.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D31108

(cherry picked from commit 24c681a7f6d6c777221fdbd289da64ff65ad8785)

2 years agoimport nvi 2.2.0-3bbdfe4
Baptiste Daroussin [Fri, 21 May 2021 20:50:50 +0000 (22:50 +0200)]
import nvi 2.2.0-3bbdfe4

(cherry picked from commit 6680e5a52f8abf059bbbd3e0be66d9dce476cdf9)

2 years agonvi: fix catalog generation
dankm [Fri, 26 Feb 2021 15:32:01 +0000 (16:32 +0100)]
nvi: fix catalog generation

Upstream broke catalog generation with some over-eagre style cleanups.
This brings in my pull request.

Obtained from: https://github.com/lichray/nvi2/pull/88
Differential Revision: https://reviews.freebsd.org/D28594

(cherry picked from commit 888ae5725257c251319f14f31c2e941717b675f2)

2 years agoFix buildworld on Linux/macOS after nvi update
Alex Richardson [Mon, 12 Oct 2020 10:42:24 +0000 (10:42 +0000)]
Fix buildworld on Linux/macOS after nvi update

This re-applies r365941 which was lost in the nvi update.

(cherry picked from commit 5ce117c698bce69808f214781fe03a2c0f451d9f)

2 years agoUpdate nvi to 2.2.0-05ed8b9
Baptiste Daroussin [Thu, 1 Oct 2020 04:46:23 +0000 (04:46 +0000)]
Update nvi to 2.2.0-05ed8b9

This version incorporates many fixes in particular a fix for vi -w
Another approach was proposed to merge those fixes (see review), I find
it easier to track changes if we keep importing snapshot on regular
basis

PR: 241985
Reported by: fernape
Differential Revision: https://reviews.freebsd.org/D26158

(cherry picked from commit 755cc40c21ca63388c6a67ba848a908b429e9391)

2 years agovi(1): Add URL to the vi/ex reference manual in the man page
Fernando Apesteguía [Fri, 25 Sep 2020 10:20:12 +0000 (10:20 +0000)]
vi(1): Add URL to the vi/ex reference manual in the man page

Reported in PR 241985

The manual page references the "vi/ex reference manual" but there is no
information about where to find that document. Add a reference to the manual in
the SEE ALSO section since the Project hosts a copy of it[1].

Change sent upstream[2]

If D26158 gets reviewed and committed, we could close that PR.

[1] https://docs.freebsd.org/44doc/usd/13.viref/paper.pdf).
[2] https://github.com/lichray/nvi2/pull/85

Submitted by: freebsd@tim.thechases.com
Approved by: manpages (gbe@)
Differential Revision: https://reviews.freebsd.org/D26163

(cherry picked from commit f1cba2b70cd1f705d7b878e7b8d9f99fe389dc7a)

2 years agoFix vi build on Linux/macOS
Alex Richardson [Mon, 21 Sep 2020 09:03:42 +0000 (09:03 +0000)]
Fix vi build on Linux/macOS

This absolute include causes a build failure on Linux for me:
.../cheri/freebsd/contrib/nvi/cl/../common/common.h:10:10: fatal error: '/usr/include/db.h' file not found

This change patches the file to use #include <db.h> instead until a
solution has been found upstream. See also https://github.com/lichray/nvi2/issues/69

Reviewed By: bapt
Differential Revision: https://reviews.freebsd.org/D26480

(cherry picked from commit 2bd2b113353d79cc7bdd315c3c76e0fc13218219)