Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Aug 2024 21:28:08 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Zhenlei Huang <zlei@freebsd.org>
Cc:        Warner Losh <imp@freebsd.org>, src-committers <src-committers@freebsd.org>,  "<dev-commits-src-all@freebsd.org>" <dev-commits-src-all@freebsd.org>,  "<dev-commits-src-main@freebsd.org>" <dev-commits-src-main@freebsd.org>
Subject:   Re: git: d5507f9e4366 - main - nvme: Separate total failures from I/O failures
Message-ID:  <CANCZdfpk7dSiuYaU42cFXrhqMsonbPrQrjzTDeWL=vvCnoHMxA@mail.gmail.com>
In-Reply-To: <0936F9D3-86A7-46AF-83E3-3EE63C41DA67@FreeBSD.org>
References:  <202408160230.47G2UO9J045807@gitrepo.freebsd.org> <0936F9D3-86A7-46AF-83E3-3EE63C41DA67@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000014480061fc48d49
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Thu, Aug 15, 2024, 9:12=E2=80=AFPM Zhenlei Huang <zlei@freebsd.org> wrot=
e:

> Hi Warner,
>
> I'm not sure but this change seems include lots of unintended changes (
> maybe some local WIP ) .
>

Git am somehow screwed me.  I'll fix.

Warner

> On Aug 16, 2024, at 10:30 AM, Warner Losh <imp@FreeBSD.org> wrote:
> >
> > The branch main has been updated by imp:
> >
> > URL:
> https://cgit.FreeBSD.org/src/commit/?id=3Dd5507f9e436698ac17dc5ace7ef5849=
3988a9b04
> >
> > commit d5507f9e436698ac17dc5ace7ef58493988a9b04
> > Author:     Warner Losh <imp@FreeBSD.org>
> > AuthorDate: 2024-08-14 22:55:49 +0000
> > Commit:     Warner Losh <imp@FreeBSD.org>
> > CommitDate: 2024-08-16 02:22:18 +0000
> >
> >    nvme: Separate total failures from I/O failures
> >
> >    When it's a I/O failure, we can still send admin commands. Separate
> out
> >    the admin failures and flag them as such so that we can still send
> admin
> >    commands on half-failed drives.
> >
> >    Fixes: 9229b3105d88 (nvme: Fail passthrough commands right away in
> failed state)
> >    Sponsored by: Netflix
> > ---
> > sys/amd64/conf/IOSCHED                             |    2 +
> > sys/amd64/conf/MPI3MR                              |   10 +
> > sys/arm64/conf/GENERIC16K                          |    4 +
> > .../linuxkpi/common/include/linux/#compiler.h#     |  117 +
> > sys/contrib/dev/iwlwifi/fw/api/soc.h               |   35 +
> > sys/contrib/zlib/contrib/asm686/README.686         |   51 +
> > sys/contrib/zlib/contrib/asm686/match.S            |  357 +
> > sys/dev/ice/ice_sriov.c                            |  595 ++
> > sys/dev/ice/ice_sriov.h                            |   64 +
> > sys/dev/mps/mpi/mpi2_pci.h                         |  141 +
> > sys/dev/nvme/nvme_ctrlr.c                          |   46 +-
> > sys/dev/nvme/nvme_private.h                        |    1 +
> > sys/dev/nvme/nvme_qpair.c                          |   23 +-
> > sys/dev/nvme/nvme_sim.c                            |   13 +-
> > sys/dev/sound/pci/aureal.c                         |  686 ++
> > sys/dev/sound/pci/aureal.h                         |   99 +
> > sys/dev/sound/pci/ds1-fw.h                         | 1602 ++++
> > sys/dev/sound/pci/ds1.c                            | 1103 +++
> > sys/dev/sound/pci/ds1.h                            |  146 +
> > sys/dev/sound/pci/maestro.c                        | 2043 +++++
> > sys/dev/sound/pci/maestro_reg.h                    |  381 +
> > sys/kern/bsduser-syscalls.c                        | 8712
> ++++++++++++++++++++
> > sys/modules/sound/driver/ds1/Makefile              |    8 +
> > sys/modules/sound/driver/maestro/Makefile          |    8 +
> > 24 files changed, 16219 insertions(+), 28 deletions(-)
> >
> > diff --git a/sys/amd64/conf/IOSCHED b/sys/amd64/conf/IOSCHED
> > new file mode 100644
> > index 000000000000..e15106bc4c1f
> > --- /dev/null
> > +++ b/sys/amd64/conf/IOSCHED
> > @@ -0,0 +1,2 @@
> > +include "GENERIC"
> > +options CAM_IOSCHED_DYNAMIC
> > diff --git a/sys/amd64/conf/MPI3MR b/sys/amd64/conf/MPI3MR
> > new file mode 100644
> > index 000000000000..99e5244cb49d
> > --- /dev/null
> > +++ b/sys/amd64/conf/MPI3MR
> > @@ -0,0 +1,10 @@
> > +include GENERIC
> > +
> > +device mpi3mr
> > +# All the debugging options
> > +options DEADLKRES # Enable the deadlock resolver
> > +options INVARIANTS # Enable calls of extra sanity checking
> > +options INVARIANT_SUPPORT # Extra sanity checks of internal structures=
,
> required by INVARIANTS
> > +options QUEUE_MACRO_DEBUG_TRASH # Trash queue(2) internal pointers on
> invalidation
> > +options WITNESS # Enable checks to detect deadlocks and cycles
> > +options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed
> > diff --git a/sys/arm64/conf/GENERIC16K b/sys/arm64/conf/GENERIC16K
> > new file mode 100644
> > index 000000000000..9bf9e2dadb08
> > --- /dev/null
> > +++ b/sys/arm64/conf/GENERIC16K
> > @@ -0,0 +1,4 @@
> > +include              "GENERIC"
> > +
> > +ident                GENERIC_16K
> > +
> > diff --git a/sys/compat/linuxkpi/common/include/linux/#compiler.h#
> b/sys/compat/linuxkpi/common/include/linux/#compiler.h#
> > new file mode 100644
> > index 000000000000..1177674aa68f
> > --- /dev/null
> > +++ b/sys/compat/linuxkpi/common/include/linux/#compiler.h#
> > @@ -0,0 +1,117 @@
> > +/*-
> > + * Copyright (c) 2010 Isilon Systems, Inc.
> > + * Copyright (c) 2010 iX Systems, Inc.
> > + * Copyright (c) 2010 Panasas, Inc.
> > + * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
> > + * Copyright (c) 2015 Fran=C3=A7ois Tigeot
> > + * All rights reserved.
> > + *
> > + * Redistribution and use in source and binary forms, with or without
> > + * modification, are permitted provided that the following conditions
> > + * are met:
> > + * 1. Redistributions of source code must retain the above copyright
> > + *    notice unmodified, this list of conditions, and the following
> > + *    disclaimer.
> > + * 2. Redistributions in binary form must reproduce the above copyrigh=
t
> > + *    notice, this list of conditions and the following disclaimer in
> the
> > + *    documentation and/or other materials provided with the
> distribution.
> > + *
> > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS O=
R
> > + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
> WARRANTIES
> > + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> DISCLAIMED.
> > + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> > + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING=
,
> BUT
> > + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS O=
F
> USE,
> > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON A=
NY
> > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
> USE OF
> > + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> > + *
> > + * $FreeBSD$
> > + */
> > +#ifndef      _LINUX_COMPILER_H_
> > +#define      _LINUX_COMPILER_H_
> > +
> > +#include <sys/cdefs.h>
> > +
> > +#define __user
> > +#define __kernel
> > +#define __safe
> > +#define __force
> > +#define __nocast
> > +#define __iomem
> > +#define __chk_user_ptr(x)            ((void)0)
> > +#define __chk_io_ptr(x)                      ((void)0)
> > +#define __builtin_warning(x, y...)   (1)
> > +#define __acquires(x)
> > +#define __releases(x)
> > +#define __acquire(x)                 do { } while (0)
> > +#define __release(x)                 do { } while (0)
> > +#define __cond_lock(x,c)             (c)
> > +#define      __bitwise
> > +#define __devinitdata
> > +#define      __deprecated
> > +#define __init
> > +#define      __initconst
> > +#define      __devinit
> > +#define      __devexit
> > +#define __exit
> > +#define      __rcu
> > +#define      __percpu
> > +#define      __weak __weak_symbol
> > +#define      __malloc
> > +#define      ___stringify(...)               #__VA_ARGS__
> > +#define      __stringify(...)                ___stringify(__VA_ARGS__)
> > +#define      __attribute_const__             __attribute__((__const__)=
)
> > +#undef __always_inline
> > +#define      __always_inline                 inline
> > +#define      noinline                        __noinline
> > +#define      ____cacheline_aligned           __aligned(CACHE_LINE_SIZE=
)
> > +
> > +#define      likely(x)                       __builtin_expect(!!(x), 1=
)
> > +#define      unlikely(x)                     __builtin_expect(!!(x), 0=
)
> > +#define typeof(x)                    __typeof(x)
> > +
> > +#define      uninitialized_var(x)            x =3D x
> > +#define      __maybe_unused                  __unused
> > +#define      __always_unused                 __unused
> > +#define      __must_check                    __result_use_check
> > +
> > +#define      __printf(a,b)                   __printflike(a,b)
> > +
> > +#define      barrier()                       __asm__ __volatile__("": =
:
> :"memory")
> > +
> > +#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >=3D 50000
> > +/* Moved from drm_os_freebsd.h */
> > +#define      lower_32_bits(n)                ((u32)(n))
> > +#define      upper_32_bits(n)                ((u32)(((n) >> 16) >> 16)=
)
> > +#endif
> > +
> > +#define      ___PASTE(a,b) a##b
> > +#define      __PASTE(a,b) ___PASTE(a,b)
> > +
> > +#define      ACCESS_ONCE(x)                  (*(volatile __typeof(x)
> *)&(x))
> > +
> > +#define      WRITE_ONCE(x,v) do {            \
> > +     barrier();                      \
> > +     ACCESS_ONCE(x) =3D (v);           \
> > +     barrier();                      \
> > +} while (0)
> > +
> > +#define      READ_ONCE(x) ({                 \
> > +     __typeof(x) __var =3D ({          \
> > +             barrier();              \
> > +             ACCESS_ONCE(x);         \
> > +     });                             \
> > +     barrier();                      \
> > +     __var;                          \
> > +})
> > +
> > +#define      lockless_dereference(p) READ_ONCE(p)
> > +
> > +#define      _AT(T,X)        ((T)(X))
> > +
> > +#define      __same_type(a, b)
>  __builtin_types_compatible_p(typeof(a), typeof(b))
> > +#define      __must_be_array(a)      __same_type(a, &(a)[0])
> > +
> > +#endif       /* _LINUX_COMPILER_H_ */
> > diff --git a/sys/contrib/dev/iwlwifi/fw/api/soc.h
> b/sys/contrib/dev/iwlwifi/fw/api/soc.h
> > new file mode 100644
> > index 000000000000..c5df1171462b
> > --- /dev/null
> > +++ b/sys/contrib/dev/iwlwifi/fw/api/soc.h
> > @@ -0,0 +1,35 @@
> > +/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
> > +/*
> > + * Copyright (C) 2012-2014, 2019-2020 Intel Corporation
> > + * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
> > + * Copyright (C) 2016-2017 Intel Deutschland GmbH
> > + */
> > +#ifndef __iwl_fw_api_soc_h__
> > +#define __iwl_fw_api_soc_h__
> > +
> > +#define SOC_CONFIG_CMD_FLAGS_DISCRETE                BIT(0)
> > +#define SOC_CONFIG_CMD_FLAGS_LOW_LATENCY     BIT(1)
> > +
> > +#define SOC_FLAGS_LTR_APPLY_DELAY_MASK               0xc
> > +#define SOC_FLAGS_LTR_APPLY_DELAY_NONE               0
> > +#define SOC_FLAGS_LTR_APPLY_DELAY_200                1
> > +#define SOC_FLAGS_LTR_APPLY_DELAY_2500               2
> > +#define SOC_FLAGS_LTR_APPLY_DELAY_1820               3
> > +
> > +/**
> > + * struct iwl_soc_configuration_cmd - Set device stabilization latency
> > + *
> > + * @flags: soc settings flags.  In VER_1, we can only set the DISCRETE
> > + *   flag, because the FW treats the whole value as an integer. In
> > + *   VER_2, we can set the bits independently.
> > + * @latency: time for SOC to ensure stable power & XTAL
> > + */
> > +struct iwl_soc_configuration_cmd {
> > +     __le32 flags;
> > +     __le32 latency;
> > +} __packed; /*
> > +          * SOC_CONFIGURATION_CMD_S_VER_1 (see description above)
> > +          * SOC_CONFIGURATION_CMD_S_VER_2
> > +          */
> > +
> > +#endif /* __iwl_fw_api_soc_h__ */
> > diff --git a/sys/contrib/zlib/contrib/asm686/README.686
> b/sys/contrib/zlib/contrib/asm686/README.686
> > new file mode 100644
> > index 000000000000..a0bf3bea4aff
> > --- /dev/null
> > +++ b/sys/contrib/zlib/contrib/asm686/README.686
> > @@ -0,0 +1,51 @@
> > +This is a patched version of zlib, modified to use
> > +Pentium-Pro-optimized assembly code in the deflation algorithm. The
> > +files changed/added by this patch are:
> > +
> > +README.686
> > +match.S
> > +
> > +The speedup that this patch provides varies, depending on whether the
> > +compiler used to build the original version of zlib falls afoul of the
> > +PPro's speed traps. My own tests show a speedup of around 10-20% at
> > +the default compression level, and 20-30% using -9, against a version
> > +compiled using gcc 2.7.2.3. Your mileage may vary.
> > +
> > +Note that this code has been tailored for the PPro/PII in particular,
> > +and will not perform particuarly well on a Pentium.
> > +
> > +If you are using an assembler other than GNU as, you will have to
> > +translate match.S to use your assembler's syntax. (Have fun.)
> > +
> > +Brian Raiter
> > +breadbox@muppetlabs.com
> > +April, 1998
> > +
> > +
> > +Added for zlib 1.1.3:
> > +
> > +The patches come from
> > +http://www.muppetlabs.com/~breadbox/software/assembly.html
> > +
> > +To compile zlib with this asm file, copy match.S to the zlib directory
> > +then do:
> > +
> > +CFLAGS=3D"-O3 -DASMV" ./configure
> > +make OBJA=3Dmatch.o
> > +
> > +
> > +Update:
> > +
> > +I've been ignoring these assembly routines for years, believing that
> > +gcc's generated code had caught up with it sometime around gcc 2.95
> > +and the major rearchitecting of the Pentium 4. However, I recently
> > +learned that, despite what I believed, this code still has some life
> > +in it. On the Pentium 4 and AMD64 chips, it continues to run about 8%
> > +faster than the code produced by gcc 4.1.
> > +
> > +In acknowledgement of its continuing usefulness, I've altered the
> > +license to match that of the rest of zlib. Share and Enjoy!
> > +
> > +Brian Raiter
> > +breadbox@muppetlabs.com
> > +April, 2007
> > diff --git a/sys/contrib/zlib/contrib/asm686/match.S
> b/sys/contrib/zlib/contrib/asm686/match.S
> > new file mode 100644
> > index 000000000000..fa421092785d
> > --- /dev/null
> > +++ b/sys/contrib/zlib/contrib/asm686/match.S
> > @@ -0,0 +1,357 @@
> > +/* match.S -- x86 assembly version of the zlib longest_match() functio=
n.
> > + * Optimized for the Intel 686 chips (PPro and later).
> > + *
> > + * Copyright (C) 1998, 2007 Brian Raiter <breadbox@muppetlabs.com>
> > + *
> > + * This software is provided 'as-is', without any express or implied
> > + * warranty.  In no event will the author be held liable for any damag=
es
> > + * arising from the use of this software.
> > + *
> > + * Permission is granted to anyone to use this software for any purpos=
e,
> > + * including commercial applications, and to alter it and redistribute
> it
> > + * freely, subject to the following restrictions:
> > + *
> > + * 1. The origin of this software must not be misrepresented; you must
> not
> > + *    claim that you wrote the original software. If you use this
> software
> > + *    in a product, an acknowledgment in the product documentation
> would be
> > + *    appreciated but is not required.
> > + * 2. Altered source versions must be plainly marked as such, and must
> not be
> > + *    misrepresented as being the original software.
> > + * 3. This notice may not be removed or altered from any source
> distribution.
> > + */
> > +
> > +#ifndef NO_UNDERLINE
> > +#define      match_init      _match_init
> > +#define      longest_match   _longest_match
> > +#endif
> > +
> > +#define      MAX_MATCH       (258)
> > +#define      MIN_MATCH       (3)
> > +#define      MIN_LOOKAHEAD   (MAX_MATCH + MIN_MATCH + 1)
> > +#define      MAX_MATCH_8     ((MAX_MATCH + 7) & ~7)
> > +
> > +/* stack frame offsets */
> > +
> > +#define      chainlenwmask           0       /* high word: current
> chain len */
> > +                                     /* low word: s->wmask           *=
/
> > +#define      window                  4       /* local copy of
> s->window      */
> > +#define      windowbestlen           8       /* s->window + bestlen
>       */
> > +#define      scanstart               16      /* first two bytes of
> string    */
> > +#define      scanend                 12      /* last two bytes of
> string     */
> > +#define      scanalign               20      /* dword-misalignment of
> string */
> > +#define      nicematch               24      /* a good enough match
> size     */
> > +#define      bestlen                 28      /* size of best match so
> far    */
> > +#define      scan                    32      /* ptr to string wanting
> match  */
> > +
> > +#define      LocalVarsSize           (36)
> > +/*   saved ebx               36 */
> > +/*   saved edi               40 */
> > +/*   saved esi               44 */
> > +/*   saved ebp               48 */
> > +/*   return address          52 */
> > +#define      deflatestate            56      /* the function arguments
>      */
> > +#define      curmatch                60
> > +
> > +/* All the +zlib1222add offsets are due to the addition of fields
> > + *  in zlib in the deflate_state structure since the asm code was firs=
t
> written
> > + * (if you compile with zlib 1.0.4 or older, use "zlib1222add equ
> (-4)").
> > + * (if you compile with zlib between 1.0.5 and 1.2.2.1, use
> "zlib1222add equ 0").
> > + * if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8"=
).
> > + */
> > +
> > +#define zlib1222add          (8)
> > +
> > +#define      dsWSize                 (36+zlib1222add)
> > +#define      dsWMask                 (44+zlib1222add)
> > +#define      dsWindow                (48+zlib1222add)
> > +#define      dsPrev                  (56+zlib1222add)
> > +#define      dsMatchLen              (88+zlib1222add)
> > +#define      dsPrevMatch             (92+zlib1222add)
> > +#define      dsStrStart              (100+zlib1222add)
> > +#define      dsMatchStart            (104+zlib1222add)
> > +#define      dsLookahead             (108+zlib1222add)
> > +#define      dsPrevLen               (112+zlib1222add)
> > +#define      dsMaxChainLen           (116+zlib1222add)
> > +#define      dsGoodMatch             (132+zlib1222add)
> > +#define      dsNiceMatch             (136+zlib1222add)
> > +
> > +
> > +.file "match.S"
> > +
> > +.globl       match_init, longest_match
> > +
> > +.text
> > +
> > +/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */
> > +.cfi_sections        .debug_frame
> > +
> > +longest_match:
> > +
> > +.cfi_startproc
> > +/* Save registers that the compiler may be using, and adjust %esp to *=
/
> > +/* make room for our stack frame.                                    *=
/
> > +
> > +             pushl   %ebp
> > +             .cfi_def_cfa_offset 8
> > +             .cfi_offset ebp, -8
> > +             pushl   %edi
> > +             .cfi_def_cfa_offset 12
> > +             pushl   %esi
> > +             .cfi_def_cfa_offset 16
> > +             pushl   %ebx
> > +             .cfi_def_cfa_offset 20
> > +             subl    $LocalVarsSize, %esp
> > +             .cfi_def_cfa_offset LocalVarsSize+20
> > +
> > +/* Retrieve the function arguments. %ecx will hold cur_match         *=
/
> > +/* throughout the entire function. %edx will hold the pointer to the *=
/
> > +/* deflate_state structure during the function's setup (before
>      */
> > +/* entering the main loop).                                          *=
/
> > +
> > +             movl    deflatestate(%esp), %edx
> > +             movl    curmatch(%esp), %ecx
> > +
> > +/* uInt wmask =3D s->w_mask;                                          =
 */
> > +/* unsigned chain_length =3D s->max_chain_length;
>       */
> > +/* if (s->prev_length >=3D s->good_match) {                           =
 */
> > +/*     chain_length >>=3D 2;                                          =
 */
> > +/* }                                                                 *=
/
> > +
> > +             movl    dsPrevLen(%edx), %eax
> > +             movl    dsGoodMatch(%edx), %ebx
> > +             cmpl    %ebx, %eax
> > +             movl    dsWMask(%edx), %eax
> > +             movl    dsMaxChainLen(%edx), %ebx
> > +             jl      LastMatchGood
> > +             shrl    $2, %ebx
> > +LastMatchGood:
> > +
> > +/* chainlen is decremented once beforehand so that the function can  *=
/
> > +/* use the sign flag instead of the zero flag for the exit test.     *=
/
> > +/* It is then shifted into the high word, to make room for the wmask *=
/
> > +/* value, which it will always accompany.                            *=
/
> > +
> > +             decl    %ebx
> > +             shll    $16, %ebx
> > +             orl     %eax, %ebx
> > +             movl    %ebx, chainlenwmask(%esp)
> > +
> > +/* if ((uInt)nice_match > s->lookahead) nice_match =3D s->lookahead;  =
 */
> > +
> > +             movl    dsNiceMatch(%edx), %eax
> > +             movl    dsLookahead(%edx), %ebx
> > +             cmpl    %eax, %ebx
> > +             jl      LookaheadLess
> > +             movl    %eax, %ebx
> > +LookaheadLess:       movl    %ebx, nicematch(%esp)
> > +
> > +/* register Bytef *scan =3D s->window + s->strstart;                  =
 */
> > +
> > +             movl    dsWindow(%edx), %esi
> > +             movl    %esi, window(%esp)
> > +             movl    dsStrStart(%edx), %ebp
> > +             lea     (%esi,%ebp), %edi
> > +             movl    %edi, scan(%esp)
> > +
> > +/* Determine how many bytes the scan ptr is off from being           *=
/
> > +/* dword-aligned.                                                    *=
/
> > +
> > +             movl    %edi, %eax
> > +             negl    %eax
> > +             andl    $3, %eax
> > +             movl    %eax, scanalign(%esp)
> > +
> > +/* IPos limit =3D s->strstart > (IPos)MAX_DIST(s) ?                   =
 */
> > +/*     s->strstart - (IPos)MAX_DIST(s) : NIL;
>       */
> > +
> > +             movl    dsWSize(%edx), %eax
> > +             subl    $MIN_LOOKAHEAD, %eax
> > +             subl    %eax, %ebp
> > +             jg      LimitPositive
> > +             xorl    %ebp, %ebp
> > +LimitPositive:
> > +
> > +/* int best_len =3D s->prev_length;                                   =
 */
> > +
> > +             movl    dsPrevLen(%edx), %eax
> > +             movl    %eax, bestlen(%esp)
> > +
> > +/* Store the sum of s->window + best_len in %esi locally, and in %esi.
>      */
> > +
> > +             addl    %eax, %esi
> > +             movl    %esi, windowbestlen(%esp)
> > +
> > +/* register ush scan_start =3D *(ushf*)scan;                          =
 */
> > +/* register ush scan_end   =3D *(ushf*)(scan+best_len-1);
>       */
> > +/* Posf *prev =3D s->prev;                                            =
 */
> > +
> > +             movzwl  (%edi), %ebx
> > +             movl    %ebx, scanstart(%esp)
> > +             movzwl  -1(%edi,%eax), %ebx
> > +             movl    %ebx, scanend(%esp)
> > +             movl    dsPrev(%edx), %edi
> > +
> > +/* Jump into the main loop.                                          *=
/
> > +
> > +             movl    chainlenwmask(%esp), %edx
> > +             jmp     LoopEntry
> > +
> > +.balign 16
> > +
> > +/* do {
> > + *     match =3D s->window + cur_match;
> > + *     if (*(ushf*)(match+best_len-1) !=3D scan_end ||
> > + *         *(ushf*)match !=3D scan_start) continue;
> > + *     [...]
> > + * } while ((cur_match =3D prev[cur_match & wmask]) > limit
> > + *          && --chain_length !=3D 0);
> > + *
> > + * Here is the inner loop of the function. The function will spend the
> > + * majority of its time in this loop, and majority of that time will
> > + * be spent in the first ten instructions.
> > + *
> > + * Within this loop:
> > + * %ebx =3D scanend
> > + * %ecx =3D curmatch
> > + * %edx =3D chainlenwmask - i.e., ((chainlen << 16) | wmask)
> > + * %esi =3D windowbestlen - i.e., (window + bestlen)
> > + * %edi =3D prev
> > + * %ebp =3D limit
> > + */
> > +LookupLoop:
> > +             andl    %edx, %ecx
> > +             movzwl  (%edi,%ecx,2), %ecx
> > +             cmpl    %ebp, %ecx
> > +             jbe     LeaveNow
> > +             subl    $0x00010000, %edx
> > +             js      LeaveNow
> > +LoopEntry:   movzwl  -1(%esi,%ecx), %eax
> > +             cmpl    %ebx, %eax
> > +             jnz     LookupLoop
> > +             movl    window(%esp), %eax
> > +             movzwl  (%eax,%ecx), %eax
> > +             cmpl    scanstart(%esp), %eax
> > +             jnz     LookupLoop
> > +
> > +/* Store the current value of chainlen.
>       */
> > +
> > +             movl    %edx, chainlenwmask(%esp)
> > +
> > +/* Point %edi to the string under scrutiny, and %esi to the string we
>       */
> > +/* are hoping to match it up with. In actuality, %esi and %edi are   *=
/
> > +/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is   *=
/
> > +/* initialized to -(MAX_MATCH_8 - scanalign).
>       */
> > +
> > +             movl    window(%esp), %esi
> > +             movl    scan(%esp), %edi
> > +             addl    %ecx, %esi
> > +             movl    scanalign(%esp), %eax
> > +             movl    $(-MAX_MATCH_8), %edx
> > +             lea     MAX_MATCH_8(%edi,%eax), %edi
> > +             lea     MAX_MATCH_8(%esi,%eax), %esi
> > +
> > +/* Test the strings for equality, 8 bytes at a time. At the end,
> > + * adjust %edx so that it is offset to the exact byte that mismatched.
> > + *
> > + * We already know at this point that the first three bytes of the
> > + * strings match each other, and they can be safely passed over before
> > + * starting the compare loop. So what this code does is skip over 0-3
> > + * bytes, as much as necessary in order to dword-align the %edi
> > + * pointer. (%esi will still be misaligned three times out of four.)
> > + *
> > + * It should be confessed that this loop usually does not represent
> > + * much of the total running time. Replacing it with a more
> > + * straightforward "rep cmpsb" would not drastically degrade
> > + * performance.
> > + */
> > +LoopCmps:
> > +             movl    (%esi,%edx), %eax
> > +             xorl    (%edi,%edx), %eax
> > +             jnz     LeaveLoopCmps
> > +             movl    4(%esi,%edx), %eax
> > +             xorl    4(%edi,%edx), %eax
> > +             jnz     LeaveLoopCmps4
> > +             addl    $8, %edx
> > +             jnz     LoopCmps
> > +             jmp     LenMaximum
> > +LeaveLoopCmps4:      addl    $4, %edx
> > +LeaveLoopCmps:       testl   $0x0000FFFF, %eax
> > +             jnz     LenLower
> > +             addl    $2, %edx
> > +             shrl    $16, %eax
> > +LenLower:    subb    $1, %al
> > +             adcl    $0, %edx
> > +
> > +/* Calculate the length of the match. If it is longer than MAX_MATCH,
>       */
> > +/* then automatically accept it as the best possible match and leave.
>       */
> > +
> > +             lea     (%edi,%edx), %eax
> > +             movl    scan(%esp), %edi
> > +             subl    %edi, %eax
> > +             cmpl    $MAX_MATCH, %eax
> > +             jge     LenMaximum
> > +
> > +/* If the length of the match is not longer than the best match we   *=
/
> > +/* have so far, then forget it and return to the lookup loop.
>       */
> > +
> > +             movl    deflatestate(%esp), %edx
> > +             movl    bestlen(%esp), %ebx
> > +             cmpl    %ebx, %eax
> > +             jg      LongerMatch
> > +             movl    windowbestlen(%esp), %esi
> > +             movl    dsPrev(%edx), %edi
> > +             movl    scanend(%esp), %ebx
> > +             movl    chainlenwmask(%esp), %edx
> > +             jmp     LookupLoop
> > +
> > +/*         s->match_start =3D cur_match;
>      */
> > +/*         best_len =3D len;                                          =
 */
> > +/*         if (len >=3D nice_match) break;                            =
 */
> > +/*         scan_end =3D *(ushf*)(scan+best_len-1);                    =
 */
> > +
> > +LongerMatch: movl    nicematch(%esp), %ebx
> > +             movl    %eax, bestlen(%esp)
> > +             movl    %ecx, dsMatchStart(%edx)
> > +             cmpl    %ebx, %eax
> > +             jge     LeaveNow
> > +             movl    window(%esp), %esi
> > +             addl    %eax, %esi
> > +             movl    %esi, windowbestlen(%esp)
> > +             movzwl  -1(%edi,%eax), %ebx
> > +             movl    dsPrev(%edx), %edi
> > +             movl    %ebx, scanend(%esp)
> > +             movl    chainlenwmask(%esp), %edx
> > +             jmp     LookupLoop
> > +
> > +/* Accept the current string, with the maximum possible length.
>       */
> > +
> > +LenMaximum:  movl    deflatestate(%esp), %edx
> > +             movl    $MAX_MATCH, bestlen(%esp)
> > +             movl    %ecx, dsMatchStart(%edx)
> > +
> > +/* if ((uInt)best_len <=3D s->lookahead) return (uInt)best_len;
>       */
> > +/* return s->lookahead;
>       */
> > +
> > +LeaveNow:
> > +             movl    deflatestate(%esp), %edx
> > +             movl    bestlen(%esp), %ebx
> > +             movl    dsLookahead(%edx), %eax
> > +             cmpl    %eax, %ebx
> > +             jg      LookaheadRet
> > +             movl    %ebx, %eax
> > +LookaheadRet:
> > +
> > +/* Restore the stack and return from whence we came.                 *=
/
> > +
> > +             addl    $LocalVarsSize, %esp
> > +             .cfi_def_cfa_offset 20
> > +             popl    %ebx
> > +             .cfi_def_cfa_offset 16
> > +             popl    %esi
> > +             .cfi_def_cfa_offset 12
> > +             popl    %edi
> > +             .cfi_def_cfa_offset 8
> > +             popl    %ebp
> > +             .cfi_def_cfa_offset 4
> > +.cfi_endproc
> > +match_init:  ret
> > diff --git a/sys/dev/ice/ice_sriov.c b/sys/dev/ice/ice_sriov.c
> > new file mode 100644
> > index 000000000000..c0521e667fa2
> > --- /dev/null
> > +++ b/sys/dev/ice/ice_sriov.c
> > @@ -0,0 +1,595 @@
> > +/* SPDX-License-Identifier: BSD-3-Clause */
> > +/*  Copyright (c) 2021, Intel Corporation
> > + *  All rights reserved.
> > + *
> > + *  Redistribution and use in source and binary forms, with or without
> > + *  modification, are permitted provided that the following conditions
> are met:
> > + *
> > + *   1. Redistributions of source code must retain the above copyright
> notice,
> > + *      this list of conditions and the following disclaimer.
> > + *
> > + *   2. Redistributions in binary form must reproduce the above
> copyright
> > + *      notice, this list of conditions and the following disclaimer i=
n
> the
> > + *      documentation and/or other materials provided with the
> distribution.
> > + *
> > + *   3. Neither the name of the Intel Corporation nor the names of its
> > + *      contributors may be used to endorse or promote products derive=
d
> from
> > + *      this software without specific prior written permission.
> > + *
> > + *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTOR=
S
> "AS IS"
> > + *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
> TO, THE
> > + *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
> PURPOSE
> > + *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
> CONTRIBUTORS BE
> > + *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, O=
R
> > + *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT =
OF
> > + *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
> BUSINESS
> > + *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
> WHETHER IN
> > + *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
> OTHERWISE)
> > + *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISE=
D
> OF THE
> > + *  POSSIBILITY OF SUCH DAMAGE.
> > + */
> > +
> > +#include "ice_common.h"
> > +#include "ice_sriov.h"
> > +
> > +/**
> > + * ice_aq_send_msg_to_vf
> > + * @hw: pointer to the hardware structure
> > + * @vfid: VF ID to send msg
> > + * @v_opcode: opcodes for VF-PF communication
> > + * @v_retval: return error code
> > + * @msg: pointer to the msg buffer
> > + * @msglen: msg length
> > + * @cd: pointer to command details
> > + *
> > + * Send message to VF driver (0x0802) using mailbox
> > + * queue and asynchronously sending message via
> > + * ice_sq_send_cmd() function
> > + */
> > +enum ice_status
> > +ice_aq_send_msg_to_vf(struct ice_hw *hw, u16 vfid, u32 v_opcode, u32
> v_retval,
> > +                   u8 *msg, u16 msglen, struct ice_sq_cd *cd)
> > +{
> > +     struct ice_aqc_pf_vf_msg *cmd;
> > +     struct ice_aq_desc desc;
> > +
> > +     ice_fill_dflt_direct_cmd_desc(&desc, ice_mbx_opc_send_msg_to_vf);
> > +
> > +     cmd =3D &desc.params.virt;
> > +     cmd->id =3D CPU_TO_LE32(vfid);
> > +
> > +     desc.cookie_high =3D CPU_TO_LE32(v_opcode);
> > +     desc.cookie_low =3D CPU_TO_LE32(v_retval);
> > +
> > +     if (msglen)
> > +             desc.flags |=3D CPU_TO_LE16(ICE_AQ_FLAG_RD);
> > +
> > +     return ice_sq_send_cmd(hw, &hw->mailboxq, &desc, msg, msglen, cd)=
;
> > +}
> > +
> > +/**
> > + * ice_aq_send_msg_to_pf
> > + * @hw: pointer to the hardware structure
> > + * @v_opcode: opcodes for VF-PF communication
> > + * @v_retval: return error code
> > + * @msg: pointer to the msg buffer
> > + * @msglen: msg length
> > + * @cd: pointer to command details
> > + *
> > + * Send message to PF driver using mailbox queue. By default, this
> > + * message is sent asynchronously, i.e. ice_sq_send_cmd()
> > + * does not wait for completion before returning.
> > + */
> > +enum ice_status
> > +ice_aq_send_msg_to_pf(struct ice_hw *hw, enum virtchnl_ops v_opcode,
> > +                   enum ice_status v_retval, u8 *msg, u16 msglen,
> > +                   struct ice_sq_cd *cd)
> > +{
> > +     struct ice_aq_desc desc;
> > +
> > +     ice_fill_dflt_direct_cmd_desc(&desc, ice_mbx_opc_send_msg_to_pf);
> > +     desc.cookie_high =3D CPU_TO_LE32(v_opcode);
> > +     desc.cookie_low =3D CPU_TO_LE32(v_retval);
> > +
> > +     if (msglen)
> > +             desc.flags |=3D CPU_TO_LE16(ICE_AQ_FLAG_RD);
> > +
> > +     return ice_sq_send_cmd(hw, &hw->mailboxq, &desc, msg, msglen, cd)=
;
> > +}
> > +
> > +/**
> > + * ice_conv_link_speed_to_virtchnl
> > + * @adv_link_support: determines the format of the returned link speed
> > + * @link_speed: variable containing the link_speed to be converted
> > + *
> > + * Convert link speed supported by HW to link speed supported by
> virtchnl.
> > + * If adv_link_support is true, then return link speed in Mbps. Else
> return
> > + * link speed as a VIRTCHNL_LINK_SPEED_* casted to a u32. Note that th=
e
> caller
> > + * needs to cast back to an enum virtchnl_link_speed in the case where
> > + * adv_link_support is false, but when adv_link_support is true the
> caller can
> > + * expect the speed in Mbps.
> > + */
> > +u32 ice_conv_link_speed_to_virtchnl(bool adv_link_support, u16
> link_speed)
> > +{
> > +     u32 speed;
> > +
> > +     if (adv_link_support)
> > +             switch (link_speed) {
> > +             case ICE_AQ_LINK_SPEED_10MB:
> > +                     speed =3D ICE_LINK_SPEED_10MBPS;
> > +                     break;
> > +             case ICE_AQ_LINK_SPEED_100MB:
> > +                     speed =3D ICE_LINK_SPEED_100MBPS;
> > +                     break;
> > +             case ICE_AQ_LINK_SPEED_1000MB:
> > +                     speed =3D ICE_LINK_SPEED_1000MBPS;
> > +                     break;
> > +             case ICE_AQ_LINK_SPEED_2500MB:
> > +                     speed =3D ICE_LINK_SPEED_2500MBPS;
> > +                     break;
> > +             case ICE_AQ_LINK_SPEED_5GB:
> > +                     speed =3D ICE_LINK_SPEED_5000MBPS;
> > +                     break;
> > +             case ICE_AQ_LINK_SPEED_10GB:
> > +                     speed =3D ICE_LINK_SPEED_10000MBPS;
> > +                     break;
> > +             case ICE_AQ_LINK_SPEED_20GB:
> > +                     speed =3D ICE_LINK_SPEED_20000MBPS;
> > +                     break;
> > +             case ICE_AQ_LINK_SPEED_25GB:
> > +                     speed =3D ICE_LINK_SPEED_25000MBPS;
> > +                     break;
> > +             case ICE_AQ_LINK_SPEED_40GB:
> > +                     speed =3D ICE_LINK_SPEED_40000MBPS;
> > +                     break;
> > +             case ICE_AQ_LINK_SPEED_50GB:
> > +                     speed =3D ICE_LINK_SPEED_50000MBPS;
> > +                     break;
> > +             case ICE_AQ_LINK_SPEED_100GB:
> > +                     speed =3D ICE_LINK_SPEED_100000MBPS;
> > +                     break;
> > +             default:
> > +                     speed =3D ICE_LINK_SPEED_UNKNOWN;
> > +                     break;
> > +             }
> > +     else
> > +             /* Virtchnl speeds are not defined for every speed
> supported in
> > +              * the hardware. To maintain compatibility with older AVF
> > +              * drivers, while reporting the speed the new speed value=
s
> are
> > +              * resolved to the closest known virtchnl speeds
> > +              */
> > +             switch (link_speed) {
> > +             case ICE_AQ_LINK_SPEED_10MB:
> > +             case ICE_AQ_LINK_SPEED_100MB:
> > +                     speed =3D (u32)VIRTCHNL_LINK_SPEED_100MB;
> > +                     break;
> > +             case ICE_AQ_LINK_SPEED_1000MB:
> > +             case ICE_AQ_LINK_SPEED_2500MB:
> > +             case ICE_AQ_LINK_SPEED_5GB:
> > +                     speed =3D (u32)VIRTCHNL_LINK_SPEED_1GB;
> > +                     break;
> > +             case ICE_AQ_LINK_SPEED_10GB:
> > +                     speed =3D (u32)VIRTCHNL_LINK_SPEED_10GB;
> > +                     break;
> > +             case ICE_AQ_LINK_SPEED_20GB:
> > +                     speed =3D (u32)VIRTCHNL_LINK_SPEED_20GB;
> > +                     break;
> > +             case ICE_AQ_LINK_SPEED_25GB:
> > +                     speed =3D (u32)VIRTCHNL_LINK_SPEED_25GB;
> > +                     break;
> > +             case ICE_AQ_LINK_SPEED_40GB:
> > +             case ICE_AQ_LINK_SPEED_50GB:
> > +             case ICE_AQ_LINK_SPEED_100GB:
> > +                     speed =3D (u32)VIRTCHNL_LINK_SPEED_40GB;
> > +                     break;
> > +             default:
> > +                     speed =3D (u32)VIRTCHNL_LINK_SPEED_UNKNOWN;
> > +                     break;
> > +             }
> > +
> > +     return speed;
> > +}
> > +
> > +/* The mailbox overflow detection algorithm helps to check if there
> > + * is a possibility of a malicious VF transmitting too many MBX
> messages to the
> > + * PF.
> > + * 1. The mailbox snapshot structure, ice_mbx_snapshot, is initialized
> during
> > + * driver initialization in ice_init_hw() using ice_mbx_init_snapshot(=
).
> > + * The struct ice_mbx_snapshot helps to track and traverse a static
> window of
> > + * messages within the mailbox queue while looking for a malicious VF.
> > + *
> > + * 2. When the caller starts processing its mailbox queue in response
> to an
> > + * interrupt, the structure ice_mbx_snapshot is expected to be cleared
> before
> > + * the algorithm can be run for the first time for that interrupt. Thi=
s
> can be
> > + * done via ice_mbx_reset_snapshot().
> > + *
> > + * 3. For every message read by the caller from the MBX Queue, the
> caller must
> > + * call the detection algorithm's entry function
> ice_mbx_vf_state_handler().
> > + * Before every call to ice_mbx_vf_state_handler() the struct
> ice_mbx_data is
> > + * filled as it is required to be passed to the algorithm.
> > + *
> > + * 4. Every time a message is read from the MBX queue, a VFId is
> received which
> > + * is passed to the state handler. The boolean output is_malvf of the
> state
> > + * handler ice_mbx_vf_state_handler() serves as an indicator to the
> caller
> > + * whether this VF is malicious or not.
> > + *
> > + * 5. When a VF is identified to be malicious, the caller can send a
> message
> > + * to the system administrator. The caller can invoke
> ice_mbx_report_malvf()
> > + * to help determine if a malicious VF is to be reported or not. This
> function
> > + * requires the caller to maintain a global bitmap to track all
> malicious VFs
> > + * and pass that to ice_mbx_report_malvf() along with the VFID which
> was identified
> > + * to be malicious by ice_mbx_vf_state_handler().
> > + *
> > + * 6. The global bitmap maintained by PF can be cleared completely if
> PF is in
> > + * reset or the bit corresponding to a VF can be cleared if that VF is
> in reset.
> > + * When a VF is shut down and brought back up, we assume that the new =
VF
> > + * brought up is not malicious and hence report it if found malicious.
> > + *
> > + * 7. The function ice_mbx_reset_snapshot() is called to reset the
> information
> > + * in ice_mbx_snapshot for every new mailbox interrupt handled.
> > + *
> > + * 8. The memory allocated for variables in ice_mbx_snapshot is
> de-allocated
> > + * when driver is unloaded.
> > + */
> > +#define ICE_RQ_DATA_MASK(rq_data) ((rq_data) & PF_MBX_ARQH_ARQH_M)
> > +/* Using the highest value for an unsigned 16-bit value 0xFFFF to
> indicate that
> > + * the max messages check must be ignored in the algorithm
> > + */
> > +#define ICE_IGNORE_MAX_MSG_CNT       0xFFFF
> > +
> > +/**
> > + * ice_mbx_traverse - Pass through mailbox snapshot
> > + * @hw: pointer to the HW struct
> > + * @new_state: new algorithm state
> > + *
> > + * Traversing the mailbox static snapshot without checking
> > + * for malicious VFs.
> > + */
> > +static void
> > +ice_mbx_traverse(struct ice_hw *hw,
> > +              enum ice_mbx_snapshot_state *new_state)
> > +{
> > +     struct ice_mbx_snap_buffer_data *snap_buf;
> > +     u32 num_iterations;
> > +
> > +     snap_buf =3D &hw->mbx_snapshot.mbx_buf;
> > +
> > +     /* As mailbox buffer is circular, applying a mask
> > +      * on the incremented iteration count.
> > +      */
> > +     num_iterations =3D ICE_RQ_DATA_MASK(++snap_buf->num_iterations);
> > +
> > +     /* Checking either of the below conditions to exit snapshot
> traversal:
> > +      * Condition-1: If the number of iterations in the mailbox is
> equal to
> > +      * the mailbox head which would indicate that we have reached the
> end
> > +      * of the static snapshot.
> > +      * Condition-2: If the maximum messages serviced in the mailbox
> for a
> > +      * given interrupt is the highest possible value then there is no
> need
> > +      * to check if the number of messages processed is equal to it. I=
f
> not
> > +      * check if the number of messages processed is greater than or
> equal
> > +      * to the maximum number of mailbox entries serviced in current
> work item.
> > +      */
> > +     if (num_iterations =3D=3D snap_buf->head ||
> > +         (snap_buf->max_num_msgs_mbx < ICE_IGNORE_MAX_MSG_CNT &&
> > +          ++snap_buf->num_msg_proc >=3D snap_buf->max_num_msgs_mbx))
> > +             *new_state =3D ICE_MAL_VF_DETECT_STATE_NEW_SNAPSHOT;
> > +}
> > +
> > +/**
> > + * ice_mbx_detect_malvf - Detect malicious VF in snapshot
> > + * @hw: pointer to the HW struct
> > + * @vf_id: relative virtual function ID
> > + * @new_state: new algorithm state
> > + * @is_malvf: boolean output to indicate if VF is malicious
> > + *
> > + * This function tracks the number of asynchronous messages
> > + * sent per VF and marks the VF as malicious if it exceeds
> > + * the permissible number of messages to send.
> > + */
> > +static enum ice_status
> > +ice_mbx_detect_malvf(struct ice_hw *hw, u16 vf_id,
> > +                  enum ice_mbx_snapshot_state *new_state,
> > +                  bool *is_malvf)
> > +{
> > +     struct ice_mbx_snapshot *snap =3D &hw->mbx_snapshot;
> > +
> > +     if (vf_id >=3D snap->mbx_vf.vfcntr_len)
> > +             return ICE_ERR_OUT_OF_RANGE;
> > +
> > +     /* increment the message count in the VF array */
> > +     snap->mbx_vf.vf_cntr[vf_id]++;
> > +
> > +     if (snap->mbx_vf.vf_cntr[vf_id] >=3D ICE_ASYNC_VF_MSG_THRESHOLD)
> > +             *is_malvf =3D true;
> > +
> > +     /* continue to iterate through the mailbox snapshot */
> > +     ice_mbx_traverse(hw, new_state);
> > +
> > +     return ICE_SUCCESS;
> > +}
> > +
> > +/**
> > + * ice_mbx_reset_snapshot - Reset mailbox snapshot structure
> > + * @snap: pointer to mailbox snapshot structure in the ice_hw struct
> > + *
> > + * Reset the mailbox snapshot structure and clear VF counter array.
> > + */
> > +static void ice_mbx_reset_snapshot(struct ice_mbx_snapshot *snap)
> > *** 15611 LINES SKIPPED ***
>
>
>
>

--000000000000014480061fc48d49
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div><br><br><div class=3D"gmail_quote"><div dir=3D"ltr" =
class=3D"gmail_attr">On Thu, Aug 15, 2024, 9:12=E2=80=AFPM Zhenlei Huang &l=
t;<a href=3D"mailto:zlei@freebsd.org">zlei@freebsd.org</a>&gt; wrote:<br></=
div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-lef=
t:1px #ccc solid;padding-left:1ex">Hi Warner,<br>
<br>
I&#39;m not sure but this change seems include lots of unintended changes (=
 maybe some local WIP ) .<br></blockquote></div></div><div dir=3D"auto"><br=
></div><div dir=3D"auto">Git am somehow screwed me.=C2=A0 I&#39;ll fix.</di=
v><div dir=3D"auto"><br></div><div dir=3D"auto">Warner</div><div dir=3D"aut=
o"><br></div><div dir=3D"auto"><div class=3D"gmail_quote"><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex">
&gt; On Aug 16, 2024, at 10:30 AM, Warner Losh &lt;imp@FreeBSD.org&gt; wrot=
e:<br>
&gt; <br>
&gt; The branch main has been updated by imp:<br>
&gt; <br>
&gt; URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3Dd5507f9e4366=
98ac17dc5ace7ef58493988a9b04" rel=3D"noreferrer noreferrer" target=3D"_blan=
k">https://cgit.FreeBSD.org/src/commit/?id=3Dd5507f9e436698ac17dc5ace7ef584=
93988a9b04</a><br>
&gt; <br>
&gt; commit d5507f9e436698ac17dc5ace7ef58493988a9b04<br>
&gt; Author:=C2=A0 =C2=A0 =C2=A0Warner Losh &lt;imp@FreeBSD.org&gt;<br>
&gt; AuthorDate: 2024-08-14 22:55:49 +0000<br>
&gt; Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh &lt;imp@FreeBSD.org&gt;<br>
&gt; CommitDate: 2024-08-16 02:22:18 +0000<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 nvme: Separate total failures from I/O failures<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 When it&#39;s a I/O failure, we can still send admin comm=
ands. Separate out<br>
&gt;=C2=A0 =C2=A0 the admin failures and flag them as such so that we can s=
till send admin<br>
&gt;=C2=A0 =C2=A0 commands on half-failed drives.<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 Fixes: 9229b3105d88 (nvme: Fail passthrough commands righ=
t away in failed state)<br>
&gt;=C2=A0 =C2=A0 Sponsored by: Netflix<br>
&gt; ---<br>
&gt; sys/amd64/conf/IOSCHED=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A0 2 +<=
br>
&gt; sys/amd64/conf/MPI3MR=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A010 +<=
br>
&gt; sys/arm64/conf/GENERIC16K=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A0 4 +<br>
&gt; .../linuxkpi/common/include/linux/#compiler.h#=C2=A0 =C2=A0 =C2=A0|=C2=
=A0 117 +<br>
&gt; sys/contrib/dev/iwlwifi/fw/api/soc.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A035 +<br>
&gt; sys/contrib/zlib/contrib/asm686/README.686=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0|=C2=A0 =C2=A051 +<br>
&gt; sys/contrib/zlib/contrib/asm686/match.S=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 |=C2=A0 357 +<br>
&gt; sys/dev/ice/ice_sriov.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 595 ++<br>
&gt; sys/dev/ice/ice_sriov.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A064 +<br>
&gt; sys/dev/mps/mpi/mpi2_pci.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 141 +<br>
&gt; sys/dev/nvme/nvme_ctrlr.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A046 +-<br>
&gt; sys/dev/nvme/nvme_private.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A0 1 +<br>
&gt; sys/dev/nvme/nvme_qpair.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A023 +-<br>
&gt; sys/dev/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gt; sys/kern/bsduser-syscalls.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | 8712 ++++++++++++++++++++<br>
&gt; sys/modules/sound/driver/ds1/Makefile=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A0 8 +<br>
&gt; sys/modules/sound/driver/maestro/Makefile=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 |=C2=A0 =C2=A0 8 +<br>
&gt; 24 files changed, 16219 insertions(+), 28 deletions(-)<br>
&gt; <br>
&gt; diff --git a/sys/amd64/conf/IOSCHED b/sys/amd64/conf/IOSCHED<br>
&gt; new file mode 100644<br>
&gt; index 000000000000..e15106bc4c1f<br>
&gt; --- /dev/null<br>
&gt; +++ b/sys/amd64/conf/IOSCHED<br>
&gt; @@ -0,0 +1,2 @@<br>
&gt; +include &quot;GENERIC&quot;<br>
&gt; +options CAM_IOSCHED_DYNAMIC<br>
&gt; diff --git a/sys/amd64/conf/MPI3MR b/sys/amd64/conf/MPI3MR<br>
&gt; new file mode 100644<br>
&gt; index 000000000000..99e5244cb49d<br>
&gt; --- /dev/null<br>
&gt; +++ b/sys/amd64/conf/MPI3MR<br>
&gt; @@ -0,0 +1,10 @@<br>
&gt; +include GENERIC<br>
&gt; +<br>
&gt; +device mpi3mr<br>
&gt; +# All the debugging options<br>
&gt; +options DEADLKRES # Enable the deadlock resolver<br>
&gt; +options INVARIANTS # Enable calls of extra sanity checking<br>
&gt; +options INVARIANT_SUPPORT # Extra sanity checks of internal structure=
s, required by INVARIANTS<br>
&gt; +options QUEUE_MACRO_DEBUG_TRASH # Trash queue(2) internal pointers on=
 invalidation<br>
&gt; +options WITNESS # Enable checks to detect deadlocks and cycles<br>
&gt; +options WITNESS_SKIPSPIN # Don&#39;t run witness on spinlocks for spe=
ed<br>
&gt; diff --git a/sys/arm64/conf/GENERIC16K b/sys/arm64/conf/GENERIC16K<br>
&gt; new file mode 100644<br>
&gt; index 000000000000..9bf9e2dadb08<br>
&gt; --- /dev/null<br>
&gt; +++ b/sys/arm64/conf/GENERIC16K<br>
&gt; @@ -0,0 +1,4 @@<br>
&gt; +include=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &quot;GENERIC=
&quot;<br>
&gt; +<br>
&gt; +ident=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 GENERIC_=
16K<br>
&gt; +<br>
&gt; diff --git a/sys/compat/linuxkpi/common/include/linux/#compiler.h# b/s=
ys/compat/linuxkpi/common/include/linux/#compiler.h#<br>
&gt; new file mode 100644<br>
&gt; index 000000000000..1177674aa68f<br>
&gt; --- /dev/null<br>
&gt; +++ b/sys/compat/linuxkpi/common/include/linux/#compiler.h#<br>
&gt; @@ -0,0 +1,117 @@<br>
&gt; +/*-<br>
&gt; + * Copyright (c) 2010 Isilon Systems, Inc.<br>
&gt; + * Copyright (c) 2010 iX Systems, Inc.<br>
&gt; + * Copyright (c) 2010 Panasas, Inc.<br>
&gt; + * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.<br>
&gt; + * Copyright (c) 2015 Fran=C3=A7ois Tigeot<br>
&gt; + * All rights reserved.<br>
&gt; + *<br>
&gt; + * Redistribution and use in source and binary forms, with or without=
<br>
&gt; + * modification, are permitted provided that the following conditions=
<br>
&gt; + * are met:<br>
&gt; + * 1. Redistributions of source code must retain the above copyright<=
br>
&gt; + *=C2=A0 =C2=A0 notice unmodified, this list of conditions, and the f=
ollowing<br>
&gt; + *=C2=A0 =C2=A0 disclaimer.<br>
&gt; + * 2. Redistributions in binary form must reproduce the above copyrig=
ht<br>
&gt; + *=C2=A0 =C2=A0 notice, this list of conditions and the following dis=
claimer in the<br>
&gt; + *=C2=A0 =C2=A0 documentation and/or other materials provided with th=
e distribution.<br>
&gt; + *<br>
&gt; + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS&#39;&#39; AND ANY =
EXPRESS OR<br>
&gt; + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WAR=
RANTIES<br>
&gt; + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLA=
IMED.<br>
&gt; + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,<b=
r>
&gt; + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDIN=
G, BUT<br>
&gt; + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS =
OF USE,<br>
&gt; + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON =
ANY<br>
&gt; + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TOR=
T<br>
&gt; + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE =
USE OF<br>
&gt; + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.<=
br>
&gt; + *<br>
&gt; + * $FreeBSD$<br>
&gt; + */<br>
&gt; +#ifndef=C2=A0 =C2=A0 =C2=A0 _LINUX_COMPILER_H_<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 _LINUX_COMPILER_H_<br>
&gt; +<br>
&gt; +#include &lt;sys/cdefs.h&gt;<br>
&gt; +<br>
&gt; +#define __user<br>
&gt; +#define __kernel<br>
&gt; +#define __safe<br>
&gt; +#define __force<br>
&gt; +#define __nocast<br>
&gt; +#define __iomem<br>
&gt; +#define __chk_user_ptr(x)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((=
void)0)<br>
&gt; +#define __chk_io_ptr(x)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((void)0)<br>
&gt; +#define __builtin_warning(x, y...)=C2=A0 =C2=A0(1)<br>
&gt; +#define __acquires(x)<br>
&gt; +#define __releases(x)<br>
&gt; +#define __acquire(x)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0do { } while (0)<br>
&gt; +#define __release(x)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0do { } while (0)<br>
&gt; +#define __cond_lock(x,c)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0(c)<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 __bitwise<br>
&gt; +#define __devinitdata<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 __deprecated<br>
&gt; +#define __init<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 __initconst<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 __devinit<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 __devexit<br>
&gt; +#define __exit<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 __rcu<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 __percpu<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 __weak __weak_symbol<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 __malloc<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 ___stringify(...)=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#__VA_ARGS__<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 __stringify(...)=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ___stringify(__VA_ARGS__)<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 __attribute_const__=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0__attribute__((__const__))<br>
&gt; +#undef __always_inline<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 __always_inline=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0inline<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 noinline=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 __noinline<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 ____cacheline_aligned=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0__aligned(CACHE_LINE_SIZE)<br>
&gt; +<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 likely(x)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__builtin_expect(!!(x),=
 1)<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 unlikely(x)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__builtin_expect(!!(x), 0)<=
br>
&gt; +#define typeof(x)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 __typeof(x)<br>
&gt; +<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 uninitialized_var(x)=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 x =3D x<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 __maybe_unused=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 __unused<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 __always_unused=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__unused<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 __must_check=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 __result_use_check<br>
&gt; +<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 __printf(a,b)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__printflike(a,b)<br>
&gt; +<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 barrier()=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__asm__ __volatile__(&q=
uot;&quot;: : :&quot;memory&quot;)<br>
&gt; +<br>
&gt; +#if defined(LINUXKPI_VERSION) &amp;&amp; LINUXKPI_VERSION &gt;=3D 500=
00<br>
&gt; +/* Moved from drm_os_freebsd.h */<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 lower_32_bits(n)=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((u32)(n))<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 upper_32_bits(n)=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((u32)(((n) &gt;&gt; 16) &gt;&gt; 16))<br>
&gt; +#endif<br>
&gt; +<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 ___PASTE(a,b) a##b<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 __PASTE(a,b) ___PASTE(a,b)<br>
&gt; +<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 ACCESS_ONCE(x)=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 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=A0 =C2=A0 =C2=A0barrier();=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \<br>
&gt; +=C2=A0 =C2=A0 =C2=A0__var;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \<br>
&gt; +})<br>
&gt; +<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 lockless_dereference(p) READ_ONCE(p)<br>
&gt; +<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 _AT(T,X)=C2=A0 =C2=A0 =C2=A0 =C2=A0 ((T)(=
X))<br>
&gt; +<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 __same_type(a, b)=C2=A0 =C2=A0 =C2=A0 =C2=
=A0__builtin_types_compatible_p(typeof(a), typeof(b))<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 __must_be_array(a)=C2=A0 =C2=A0 =C2=A0 __=
same_type(a, &amp;(a)[0])<br>
&gt; +<br>
&gt; +#endif=C2=A0 =C2=A0 =C2=A0 =C2=A0/* _LINUX_COMPILER_H_ */<br>
&gt; diff --git a/sys/contrib/dev/iwlwifi/fw/api/soc.h b/sys/contrib/dev/iw=
lwifi/fw/api/soc.h<br>
&gt; new file mode 100644<br>
&gt; index 000000000000..c5df1171462b<br>
&gt; --- /dev/null<br>
&gt; +++ b/sys/contrib/dev/iwlwifi/fw/api/soc.h<br>
&gt; @@ -0,0 +1,35 @@<br>
&gt; +/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */<br>
&gt; +/*<br>
&gt; + * Copyright (C) 2012-2014, 2019-2020 Intel Corporation<br>
&gt; + * Copyright (C) 2013-2015 Intel Mobile Communications GmbH<br>
&gt; + * Copyright (C) 2016-2017 Intel Deutschland GmbH<br>
&gt; + */<br>
&gt; +#ifndef __iwl_fw_api_soc_h__<br>
&gt; +#define __iwl_fw_api_soc_h__<br>
&gt; +<br>
&gt; +#define SOC_CONFIG_CMD_FLAGS_DISCRETE=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 BIT(0)<br>
&gt; +#define SOC_CONFIG_CMD_FLAGS_LOW_LATENCY=C2=A0 =C2=A0 =C2=A0BIT(1)<br=
>
&gt; +<br>
&gt; +#define SOC_FLAGS_LTR_APPLY_DELAY_MASK=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A00xc<br>
&gt; +#define SOC_FLAGS_LTR_APPLY_DELAY_NONE=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A00<br>
&gt; +#define SOC_FLAGS_LTR_APPLY_DELAY_200=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 1<br>
&gt; +#define SOC_FLAGS_LTR_APPLY_DELAY_2500=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A02<br>
&gt; +#define SOC_FLAGS_LTR_APPLY_DELAY_1820=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A03<br>
&gt; +<br>
&gt; +/**<br>
&gt; + * struct iwl_soc_configuration_cmd - Set device stabilization latenc=
y<br>
&gt; + *<br>
&gt; + * @flags: soc settings flags.=C2=A0 In VER_1, we can only set the DI=
SCRETE<br>
&gt; + *=C2=A0 =C2=A0flag, because the FW treats the whole value as an inte=
ger. In<br>
&gt; + *=C2=A0 =C2=A0VER_2, we can set the bits independently.<br>
&gt; + * @latency: time for SOC to ensure stable power &amp; XTAL<br>
&gt; + */<br>
&gt; +struct iwl_soc_configuration_cmd {<br>
&gt; +=C2=A0 =C2=A0 =C2=A0__le32 flags;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0__le32 latency;<br>
&gt; +} __packed; /*<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * SOC_CONFIGURATION_CMD_S_VER_1 (s=
ee description above)<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * SOC_CONFIGURATION_CMD_S_VER_2<br=
>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
&gt; +<br>
&gt; +#endif /* __iwl_fw_api_soc_h__ */<br>
&gt; diff --git a/sys/contrib/zlib/contrib/asm686/README.686 b/sys/contrib/=
zlib/contrib/asm686/README.686<br>
&gt; new file mode 100644<br>
&gt; index 000000000000..a0bf3bea4aff<br>
&gt; --- /dev/null<br>
&gt; +++ b/sys/contrib/zlib/contrib/asm686/README.686<br>
&gt; @@ -0,0 +1,51 @@<br>
&gt; +This is a patched version of zlib, modified to use<br>
&gt; +Pentium-Pro-optimized assembly code in the deflation algorithm. The<b=
r>
&gt; +files changed/added by this patch are:<br>
&gt; +<br>
&gt; +README.686<br>
&gt; +match.S<br>
&gt; +<br>
&gt; +The speedup that this patch provides varies, depending on whether the=
<br>
&gt; +compiler used to build the original version of zlib falls afoul of th=
e<br>
&gt; +PPro&#39;s speed traps. My own tests show a speedup of around 10-20% =
at<br>
&gt; +the default compression level, and 20-30% using -9, against a version=
<br>
&gt; +compiled using gcc 2.7.2.3. Your mileage may vary.<br>
&gt; +<br>
&gt; +Note that this code has been tailored for the PPro/PII in particular,=
<br>
&gt; +and will not perform particuarly well on a Pentium.<br>
&gt; +<br>
&gt; +If you are using an assembler other than GNU as, you will have to<br>
&gt; +translate match.S to use your assembler&#39;s syntax. (Have fun.)<br>
&gt; +<br>
&gt; +Brian Raiter<br>
&gt; +<a href=3D"mailto:breadbox@muppetlabs.com" target=3D"_blank" rel=3D"n=
oreferrer">breadbox@muppetlabs.com</a><br>
&gt; +April, 1998<br>
&gt; +<br>
&gt; +<br>
&gt; +Added for zlib 1.1.3:<br>
&gt; +<br>
&gt; +The patches come from<br>
&gt; +<a href=3D"http://www.muppetlabs.com/~breadbox/software/assembly.html=
" rel=3D"noreferrer noreferrer" target=3D"_blank">http://www.muppetlabs.com=
/~breadbox/software/assembly.html</a><br>
&gt; +<br>
&gt; +To compile zlib with this asm file, copy match.S to the zlib director=
y<br>
&gt; +then do:<br>
&gt; +<br>
&gt; +CFLAGS=3D&quot;-O3 -DASMV&quot; ./configure<br>
&gt; +make OBJA=3Dmatch.o<br>
&gt; +<br>
&gt; +<br>
&gt; +Update:<br>
&gt; +<br>
&gt; +I&#39;ve been ignoring these assembly routines for years, believing t=
hat<br>
&gt; +gcc&#39;s generated code had caught up with it sometime around gcc 2.=
95<br>
&gt; +and the major rearchitecting of the Pentium 4. However, I recently<br=
>
&gt; +learned that, despite what I believed, this code still has some life<=
br>
&gt; +in it. On the Pentium 4 and AMD64 chips, it continues to run about 8%=
<br>
&gt; +faster than the code produced by gcc 4.1.<br>
&gt; +<br>
&gt; +In acknowledgement of its continuing usefulness, I&#39;ve altered the=
<br>
&gt; +license to match that of the rest of zlib. Share and Enjoy!<br>
&gt; +<br>
&gt; +Brian Raiter<br>
&gt; +<a href=3D"mailto:breadbox@muppetlabs.com" target=3D"_blank" rel=3D"n=
oreferrer">breadbox@muppetlabs.com</a><br>
&gt; +April, 2007<br>
&gt; diff --git a/sys/contrib/zlib/contrib/asm686/match.S b/sys/contrib/zli=
b/contrib/asm686/match.S<br>
&gt; new file mode 100644<br>
&gt; index 000000000000..fa421092785d<br>
&gt; --- /dev/null<br>
&gt; +++ b/sys/contrib/zlib/contrib/asm686/match.S<br>
&gt; @@ -0,0 +1,357 @@<br>
&gt; +/* match.S -- x86 assembly version of the zlib longest_match() functi=
on.<br>
&gt; + * Optimized for the Intel 686 chips (PPro and later).<br>
&gt; + *<br>
&gt; + * Copyright (C) 1998, 2007 Brian Raiter &lt;<a href=3D"mailto:breadb=
ox@muppetlabs.com" target=3D"_blank" rel=3D"noreferrer">breadbox@muppetlabs=
.com</a>&gt;<br>
&gt; + *<br>
&gt; + * This software is provided &#39;as-is&#39;, without any express or =
implied<br>
&gt; + * warranty.=C2=A0 In no event will the author be held liable for any=
 damages<br>
&gt; + * arising from the use of this software.<br>
&gt; + *<br>
&gt; + * Permission is granted to anyone to use this software for any purpo=
se,<br>
&gt; + * including commercial applications, and to alter it and redistribut=
e it<br>
&gt; + * freely, subject to the following restrictions:<br>
&gt; + *<br>
&gt; + * 1. The origin of this software must not be misrepresented; you mus=
t not<br>
&gt; + *=C2=A0 =C2=A0 claim that you wrote the original software. If you us=
e this software<br>
&gt; + *=C2=A0 =C2=A0 in a product, an acknowledgment in the product docume=
ntation would be<br>
&gt; + *=C2=A0 =C2=A0 appreciated but is not required.<br>
&gt; + * 2. Altered source versions must be plainly marked as such, and mus=
t not be<br>
&gt; + *=C2=A0 =C2=A0 misrepresented as being the original software.<br>
&gt; + * 3. This notice may not be removed or altered from any source distr=
ibution.<br>
&gt; + */<br>
&gt; +<br>
&gt; +#ifndef NO_UNDERLINE<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 match_init=C2=A0 =C2=A0 =C2=A0 _match_ini=
t<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 longest_match=C2=A0 =C2=A0_longest_match<=
br>
&gt; +#endif<br>
&gt; +<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 MAX_MATCH=C2=A0 =C2=A0 =C2=A0 =C2=A0(258)=
<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 MIN_MATCH=C2=A0 =C2=A0 =C2=A0 =C2=A0(3)<b=
r>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 MIN_LOOKAHEAD=C2=A0 =C2=A0(MAX_MATCH + MI=
N_MATCH + 1)<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 MAX_MATCH_8=C2=A0 =C2=A0 =C2=A0((MAX_MATC=
H + 7) &amp; ~7)<br>
&gt; +<br>
&gt; +/* stack frame offsets */<br>
&gt; +<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 chainlenwmask=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A00=C2=A0 =C2=A0 =C2=A0 =C2=A0/* high word: current chain len */=
<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* low word:=
 s-&gt;wmask=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 window=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 4=C2=A0 =C2=A0 =C2=A0 =C2=A0/* local copy of s-=
&gt;window=C2=A0 =C2=A0 =C2=A0 */<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 windowbestlen=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A08=C2=A0 =C2=A0 =C2=A0 =C2=A0/* s-&gt;window + bestlen=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 scanstart=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A016=C2=A0 =C2=A0 =C2=A0 /* first two bytes of string=
=C2=A0 =C2=A0 */<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 scanend=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A012=C2=A0 =C2=A0 =C2=A0 /* last two bytes of str=
ing=C2=A0 =C2=A0 =C2=A0*/<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 scanalign=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A020=C2=A0 =C2=A0 =C2=A0 /* dword-misalignment of str=
ing */<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 nicematch=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A024=C2=A0 =C2=A0 =C2=A0 /* a good enough match size=
=C2=A0 =C2=A0 =C2=A0*/<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 bestlen=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A028=C2=A0 =C2=A0 =C2=A0 /* size of best match so=
 far=C2=A0 =C2=A0 */<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 scan=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 32=C2=A0 =C2=A0 =C2=A0 /* ptr to string =
wanting match=C2=A0 */<br>
&gt; +<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 LocalVarsSize=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0(36)<br>
&gt; +/*=C2=A0 =C2=A0saved ebx=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A036 */<br>
&gt; +/*=C2=A0 =C2=A0saved edi=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A040 */<br>
&gt; +/*=C2=A0 =C2=A0saved esi=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A044 */<br>
&gt; +/*=C2=A0 =C2=A0saved ebp=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A048 */<br>
&gt; +/*=C2=A0 =C2=A0return address=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 52 */=
<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 deflatestate=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 56=C2=A0 =C2=A0 =C2=A0 /* the function arguments=C2=A0 =C2=A0=
 =C2=A0 =C2=A0*/<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 curmatch=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 60<br>
&gt; +<br>
&gt; +/* All the +zlib1222add offsets are due to the addition of fields<br>
&gt; + *=C2=A0 in zlib in the deflate_state structure since the asm code wa=
s first written<br>
&gt; + * (if you compile with zlib 1.0.4 or older, use &quot;zlib1222add eq=
u (-4)&quot;).<br>
&gt; + * (if you compile with zlib between 1.0.5 and 1.2.2.1, use &quot;zli=
b1222add equ 0&quot;).<br>
&gt; + * if you compile with zlib 1.2.2.2 or later , use &quot;zlib1222add =
equ 8&quot;).<br>
&gt; + */<br>
&gt; +<br>
&gt; +#define zlib1222add=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (8)<br>
&gt; +<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 dsWSize=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0(36+zlib1222add)<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 dsWMask=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0(44+zlib1222add)<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 dsWindow=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 (48+zlib1222add)<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 dsPrev=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (56+zlib1222add)<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 dsMatchLen=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 (88+zlib1222add)<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 dsPrevMatch=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0(92+zlib1222add)<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 dsStrStart=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 (100+zlib1222add)<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 dsMatchStart=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 (104+zlib1222add)<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 dsLookahead=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0(108+zlib1222add)<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 dsPrevLen=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0(112+zlib1222add)<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 dsMaxChainLen=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0(116+zlib1222add)<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 dsGoodMatch=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0(132+zlib1222add)<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 dsNiceMatch=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0(136+zlib1222add)<br>
&gt; +<br>
&gt; +<br>
&gt; +.file &quot;match.S&quot;<br>
&gt; +<br>
&gt; +.globl=C2=A0 =C2=A0 =C2=A0 =C2=A0match_init, longest_match<br>
&gt; +<br>
&gt; +.text<br>
&gt; +<br>
&gt; +/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */<=
br>
&gt; +.cfi_sections=C2=A0 =C2=A0 =C2=A0 =C2=A0 .debug_frame<br>
&gt; +<br>
&gt; +longest_match:<br>
&gt; +<br>
&gt; +.cfi_startproc<br>
&gt; +/* Save registers that the compiler may be using, and adjust %esp to =
*/<br>
&gt; +/* make room for our stack frame.=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 */<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pushl=C2=A0 =C2=A0%eb=
p<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.cfi_def_cfa_offset 8=
<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.cfi_offset ebp, -8<b=
r>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pushl=C2=A0 =C2=A0%ed=
i<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.cfi_def_cfa_offset 1=
2<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pushl=C2=A0 =C2=A0%es=
i<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.cfi_def_cfa_offset 1=
6<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pushl=C2=A0 =C2=A0%eb=
x<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.cfi_def_cfa_offset 2=
0<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0subl=C2=A0 =C2=A0 $Lo=
calVarsSize, %esp<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.cfi_def_cfa_offset L=
ocalVarsSize+20<br>
&gt; +<br>
&gt; +/* Retrieve the function arguments. %ecx will hold cur_match=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0*/<br>
&gt; +/* throughout the entire function. %edx will hold the pointer to the =
*/<br>
&gt; +/* deflate_state structure during the function&#39;s setup (before=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/<br>
&gt; +/* entering the main loop).=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 def=
latestate(%esp), %edx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 cur=
match(%esp), %ecx<br>
&gt; +<br>
&gt; +/* uInt wmask =3D s-&gt;w_mask;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/<br>
&gt; +/* unsigned chain_length =3D s-&gt;max_chain_length;=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 */<br>
&gt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 =C2=A0 dsM=
axChainLen(%edx), %ebx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jl=C2=A0 =C2=A0 =C2=
=A0 LastMatchGood<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0shrl=C2=A0 =C2=A0 $2,=
 %ebx<br>
&gt; +LastMatchGood:<br>
&gt; +<br>
&gt; +/* chainlen is decremented once beforehand so that the function can=
=C2=A0 */<br>
&gt; +/* use the sign flag instead of the zero flag for the exit test.=C2=
=A0 =C2=A0 =C2=A0*/<br>
&gt; +/* It is then shifted into the high word, to make room for the wmask =
*/<br>
&gt; +/* value, which it will always accompany.=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br=
>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0decl=C2=A0 =C2=A0 %eb=
x<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0shll=C2=A0 =C2=A0 $16=
, %ebx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0orl=C2=A0 =C2=A0 =C2=
=A0%eax, %ebx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 %eb=
x, chainlenwmask(%esp)<br>
&gt; +<br>
&gt; +/* if ((uInt)nice_match &gt; s-&gt;lookahead) nice_match =3D s-&gt;lo=
okahead;=C2=A0 =C2=A0*/<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 dsN=
iceMatch(%edx), %eax<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 dsL=
ookahead(%edx), %ebx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cmpl=C2=A0 =C2=A0 %ea=
x, %ebx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jl=C2=A0 =C2=A0 =C2=
=A0 LookaheadLess<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 %ea=
x, %ebx<br>
&gt; +LookaheadLess:=C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 %ebx, nice=
match(%esp)<br>
&gt; +<br>
&gt; +/* register Bytef *scan =3D s-&gt;window + s-&gt;strstart;=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 dsW=
indow(%edx), %esi<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 %es=
i, window(%esp)<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 dsS=
trStart(%edx), %ebp<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0lea=C2=A0 =C2=A0 =C2=
=A0(%esi,%ebp), %edi<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 %ed=
i, scan(%esp)<br>
&gt; +<br>
&gt; +/* Determine how many bytes the scan ptr is off from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2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0subl=C2=A0 =C2=A0 $MI=
N_LOOKAHEAD, %eax<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0subl=C2=A0 =C2=A0 %ea=
x, %ebp<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jg=C2=A0 =C2=A0 =C2=
=A0 LimitPositive<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0xorl=C2=A0 =C2=A0 %eb=
p, %ebp<br>
&gt; +LimitPositive:<br>
&gt; +<br>
&gt; +/* int best_len =3D s-&gt;prev_length;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 */<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 dsP=
revLen(%edx), %eax<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 %ea=
x, bestlen(%esp)<br>
&gt; +<br>
&gt; +/* Store the sum of s-&gt;window + best_len in %esi locally, and in %=
esi.=C2=A0 =C2=A0 =C2=A0 =C2=A0*/<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0addl=C2=A0 =C2=A0 %ea=
x, %esi<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 %es=
i, windowbestlen(%esp)<br>
&gt; +<br>
&gt; +/* register ush scan_start =3D *(ushf*)scan;=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/=
<br>
&gt; +/* register ush scan_end=C2=A0 =C2=A0=3D *(ushf*)(scan+best_len-1);=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 */<br>
&gt; +/* Posf *prev =3D s-&gt;prev;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movzwl=C2=A0 (%edi), =
%ebx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 %eb=
x, scanstart(%esp)<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movzwl=C2=A0 -1(%edi,=
%eax), %ebx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 %eb=
x, scanend(%esp)<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 dsP=
rev(%edx), %edi<br>
&gt; +<br>
&gt; +/* Jump into the main loop.=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 cha=
inlenwmask(%esp), %edx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jmp=C2=A0 =C2=A0 =C2=
=A0LoopEntry<br>
&gt; +<br>
&gt; +.balign 16<br>
&gt; +<br>
&gt; +/* do {<br>
&gt; + *=C2=A0 =C2=A0 =C2=A0match =3D s-&gt;window + cur_match;<br>
&gt; + *=C2=A0 =C2=A0 =C2=A0if (*(ushf*)(match+best_len-1) !=3D scan_end ||=
<br>
&gt; + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*(ushf*)match !=3D scan_start) co=
ntinue;<br>
&gt; + *=C2=A0 =C2=A0 =C2=A0[...]<br>
&gt; + * } while ((cur_match =3D prev[cur_match &amp; wmask]) &gt; limit<br=
>
&gt; + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &amp;&amp; --chain_length !=3D 0=
);<br>
&gt; + *<br>
&gt; + * Here is the inner loop of the function. The function will spend th=
e<br>
&gt; + * majority of its time in this loop, and majority of that time will<=
br>
&gt; + * be spent in the first ten instructions.<br>
&gt; + *<br>
&gt; + * Within this loop:<br>
&gt; + * %ebx =3D scanend<br>
&gt; + * %ecx =3D curmatch<br>
&gt; + * %edx =3D chainlenwmask - i.e., ((chainlen &lt;&lt; 16) | wmask)<br=
>
&gt; + * %esi =3D windowbestlen - i.e., (window + bestlen)<br>
&gt; + * %edi =3D prev<br>
&gt; + * %ebp =3D limit<br>
&gt; + */<br>
&gt; +LookupLoop:<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0andl=C2=A0 =C2=A0 %ed=
x, %ecx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movzwl=C2=A0 (%edi,%e=
cx,2), %ecx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cmpl=C2=A0 =C2=A0 %eb=
p, %ecx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jbe=C2=A0 =C2=A0 =C2=
=A0LeaveNow<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0subl=C2=A0 =C2=A0 $0x=
00010000, %edx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0js=C2=A0 =C2=A0 =C2=
=A0 LeaveNow<br>
&gt; +LoopEntry:=C2=A0 =C2=A0movzwl=C2=A0 -1(%esi,%ecx), %eax<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cmpl=C2=A0 =C2=A0 %eb=
x, %eax<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jnz=C2=A0 =C2=A0 =C2=
=A0LookupLoop<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 win=
dow(%esp), %eax<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movzwl=C2=A0 (%eax,%e=
cx), %eax<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cmpl=C2=A0 =C2=A0 sca=
nstart(%esp), %eax<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jnz=C2=A0 =C2=A0 =C2=
=A0LookupLoop<br>
&gt; +<br>
&gt; +/* Store the current value of chainlen.=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 %ed=
x, chainlenwmask(%esp)<br>
&gt; +<br>
&gt; +/* Point %edi to the string under scrutiny, and %esi to the string we=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
&gt; +/* are hoping to match it up with. In actuality, %esi and %edi are=C2=
=A0 =C2=A0*/<br>
&gt; +/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is=C2=
=A0 =C2=A0*/<br>
&gt; +/* initialized to -(MAX_MATCH_8 - scanalign).=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 */<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 win=
dow(%esp), %esi<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 sca=
n(%esp), %edi<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0addl=C2=A0 =C2=A0 %ec=
x, %esi<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 sca=
nalign(%esp), %eax<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 $(-=
MAX_MATCH_8), %edx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0lea=C2=A0 =C2=A0 =C2=
=A0MAX_MATCH_8(%edi,%eax), %edi<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0lea=C2=A0 =C2=A0 =C2=
=A0MAX_MATCH_8(%esi,%eax), %esi<br>
&gt; +<br>
&gt; +/* Test the strings for equality, 8 bytes at a time. At the end,<br>
&gt; + * adjust %edx so that it is offset to the exact byte that mismatched=
.<br>
&gt; + *<br>
&gt; + * We already know at this point that the first three bytes of the<br=
>
&gt; + * strings match each other, and they can be safely passed over befor=
e<br>
&gt; + * starting the compare loop. So what this code does is skip over 0-3=
<br>
&gt; + * bytes, as much as necessary in order to dword-align the %edi<br>
&gt; + * pointer. (%esi will still be misaligned three times out of four.)<=
br>
&gt; + *<br>
&gt; + * It should be confessed that this loop usually does not represent<b=
r>
&gt; + * much of the total running time. Replacing it with a more<br>
&gt; + * straightforward &quot;rep cmpsb&quot; would not drastically degrad=
e<br>
&gt; + * performance.<br>
&gt; + */<br>
&gt; +LoopCmps:<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 (%e=
si,%edx), %eax<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0xorl=C2=A0 =C2=A0 (%e=
di,%edx), %eax<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jnz=C2=A0 =C2=A0 =C2=
=A0LeaveLoopCmps<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 4(%=
esi,%edx), %eax<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0xorl=C2=A0 =C2=A0 4(%=
edi,%edx), %eax<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jnz=C2=A0 =C2=A0 =C2=
=A0LeaveLoopCmps4<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0addl=C2=A0 =C2=A0 $8,=
 %edx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jnz=C2=A0 =C2=A0 =C2=
=A0LoopCmps<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jmp=C2=A0 =C2=A0 =C2=
=A0LenMaximum<br>
&gt; +LeaveLoopCmps4:=C2=A0 =C2=A0 =C2=A0 addl=C2=A0 =C2=A0 $4, %edx<br>
&gt; +LeaveLoopCmps:=C2=A0 =C2=A0 =C2=A0 =C2=A0testl=C2=A0 =C2=A0$0x0000FFF=
F, %eax<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jnz=C2=A0 =C2=A0 =C2=
=A0LenLower<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0addl=C2=A0 =C2=A0 $2,=
 %edx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0shrl=C2=A0 =C2=A0 $16=
, %eax<br>
&gt; +LenLower:=C2=A0 =C2=A0 subb=C2=A0 =C2=A0 $1, %al<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0adcl=C2=A0 =C2=A0 $0,=
 %edx<br>
&gt; +<br>
&gt; +/* Calculate the length of the match. If it is longer than MAX_MATCH,=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
&gt; +/* then automatically accept it as the best possible match and leave.=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0lea=C2=A0 =C2=A0 =C2=
=A0(%edi,%edx), %eax<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 sca=
n(%esp), %edi<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0subl=C2=A0 =C2=A0 %ed=
i, %eax<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cmpl=C2=A0 =C2=A0 $MA=
X_MATCH, %eax<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jge=C2=A0 =C2=A0 =C2=
=A0LenMaximum<br>
&gt; +<br>
&gt; +/* If the length of the match is not longer than the best match we=C2=
=A0 =C2=A0*/<br>
&gt; +/* have so far, then forget it and return to the lookup loop.=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 def=
latestate(%esp), %edx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 bes=
tlen(%esp), %ebx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cmpl=C2=A0 =C2=A0 %eb=
x, %eax<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jg=C2=A0 =C2=A0 =C2=
=A0 LongerMatch<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 win=
dowbestlen(%esp), %esi<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2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2=A0 =C2=A0 =C2=A0=
 =C2=A0*/<br>
&gt; +<br>
&gt; +LongerMatch: movl=C2=A0 =C2=A0 nicematch(%esp), %ebx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 %ea=
x, bestlen(%esp)<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 %ec=
x, dsMatchStart(%edx)<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cmpl=C2=A0 =C2=A0 %eb=
x, %eax<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jge=C2=A0 =C2=A0 =C2=
=A0LeaveNow<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 win=
dow(%esp), %esi<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0addl=C2=A0 =C2=A0 %ea=
x, %esi<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 %es=
i, windowbestlen(%esp)<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movzwl=C2=A0 -1(%edi,=
%eax), %ebx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 dsP=
rev(%edx), %edi<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 %eb=
x, scanend(%esp)<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 cha=
inlenwmask(%esp), %edx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jmp=C2=A0 =C2=A0 =C2=
=A0LookupLoop<br>
&gt; +<br>
&gt; +/* Accept the current string, with the maximum possible length.=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
&gt; +<br>
&gt; +LenMaximum:=C2=A0 movl=C2=A0 =C2=A0 deflatestate(%esp), %edx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 $MA=
X_MATCH, bestlen(%esp)<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 %ec=
x, dsMatchStart(%edx)<br>
&gt; +<br>
&gt; +/* if ((uInt)best_len &lt;=3D s-&gt;lookahead) return (uInt)best_len;=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
&gt; +/* return s-&gt;lookahead;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *=
/<br>
&gt; +<br>
&gt; +LeaveNow:<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 def=
latestate(%esp), %edx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 bes=
tlen(%esp), %ebx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 dsL=
ookahead(%edx), %eax<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cmpl=C2=A0 =C2=A0 %ea=
x, %ebx<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jg=C2=A0 =C2=A0 =C2=
=A0 LookaheadRet<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movl=C2=A0 =C2=A0 %eb=
x, %eax<br>
&gt; +LookaheadRet:<br>
&gt; +<br>
&gt; +/* Restore the stack and return from whence we came.=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0addl=C2=A0 =C2=A0 $Lo=
calVarsSize, %esp<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.cfi_def_cfa_offset 2=
0<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0popl=C2=A0 =C2=A0 %eb=
x<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.cfi_def_cfa_offset 1=
6<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0popl=C2=A0 =C2=A0 %es=
i<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.cfi_def_cfa_offset 1=
2<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0popl=C2=A0 =C2=A0 %ed=
i<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.cfi_def_cfa_offset 8=
<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0popl=C2=A0 =C2=A0 %eb=
p<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.cfi_def_cfa_offset 4=
<br>
&gt; +.cfi_endproc<br>
&gt; +match_init:=C2=A0 ret<br>
&gt; diff --git a/sys/dev/ice/ice_sriov.c b/sys/dev/ice/ice_sriov.c<br>
&gt; new file mode 100644<br>
&gt; index 000000000000..c0521e667fa2<br>
&gt; --- /dev/null<br>
&gt; +++ b/sys/dev/ice/ice_sriov.c<br>
&gt; @@ -0,0 +1,595 @@<br>
&gt; +/* SPDX-License-Identifier: BSD-3-Clause */<br>
&gt; +/*=C2=A0 Copyright (c) 2021, Intel Corporation<br>
&gt; + *=C2=A0 All rights reserved.<br>
&gt; + *<br>
&gt; + *=C2=A0 Redistribution and use in source and binary forms, with or w=
ithout<br>
&gt; + *=C2=A0 modification, are permitted provided that the following cond=
itions are met:<br>
&gt; + *<br>
&gt; + *=C2=A0 =C2=A01. Redistributions of source code must retain the abov=
e copyright notice,<br>
&gt; + *=C2=A0 =C2=A0 =C2=A0 this list of conditions and the following disc=
laimer.<br>
&gt; + *<br>
&gt; + *=C2=A0 =C2=A02. Redistributions in binary form must reproduce the a=
bove copyright<br>
&gt; + *=C2=A0 =C2=A0 =C2=A0 notice, this list of conditions and the follow=
ing disclaimer in the<br>
&gt; + *=C2=A0 =C2=A0 =C2=A0 documentation and/or other materials provided =
with the distribution.<br>
&gt; + *<br>
&gt; + *=C2=A0 =C2=A03. Neither the name of the Intel Corporation nor the n=
ames of its<br>
&gt; + *=C2=A0 =C2=A0 =C2=A0 contributors may be used to endorse or promote=
 products derived from<br>
&gt; + *=C2=A0 =C2=A0 =C2=A0 this software without specific prior written p=
ermission.<br>
&gt; + *<br>
&gt; + *=C2=A0 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTR=
IBUTORS &quot;AS IS&quot;<br>
&gt; + *=C2=A0 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LI=
MITED TO, THE<br>
&gt; + *=C2=A0 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PART=
ICULAR PURPOSE<br>
&gt; + *=C2=A0 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CON=
TRIBUTORS BE<br>
&gt; + *=C2=A0 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPL=
ARY, OR<br>
&gt; + *=C2=A0 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUR=
EMENT OF<br>
&gt; + *=C2=A0 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;=
 OR BUSINESS<br>
&gt; + *=C2=A0 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,=
 WHETHER IN<br>
&gt; + *=C2=A0 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR=
 OTHERWISE)<br>
&gt; + *=C2=A0 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF =
ADVISED OF THE<br>
&gt; + *=C2=A0 POSSIBILITY OF SUCH DAMAGE.<br>
&gt; + */<br>
&gt; +<br>
&gt; +#include &quot;ice_common.h&quot;<br>
&gt; +#include &quot;ice_sriov.h&quot;<br>
&gt; +<br>
&gt; +/**<br>
&gt; + * ice_aq_send_msg_to_vf<br>
&gt; + * @hw: pointer to the hardware structure<br>
&gt; + * @vfid: VF ID to send msg<br>
&gt; + * @v_opcode: opcodes for VF-PF communication<br>
&gt; + * @v_retval: return error code<br>
&gt; + * @msg: pointer to the msg buffer<br>
&gt; + * @msglen: msg length<br>
&gt; + * @cd: pointer to command details<br>
&gt; + *<br>
&gt; + * Send message to VF driver (0x0802) using mailbox<br>
&gt; + * queue and asynchronously sending message via<br>
&gt; + * ice_sq_send_cmd() function<br>
&gt; + */<br>
&gt; +enum ice_status<br>
&gt; +ice_aq_send_msg_to_vf(struct ice_hw *hw, u16 vfid, u32 v_opcode, u32 =
v_retval,<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
u8 *msg, u16 msglen, struct ice_sq_cd *cd)<br>
&gt; +{<br>
&gt; +=C2=A0 =C2=A0 =C2=A0struct ice_aqc_pf_vf_msg *cmd;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0struct ice_aq_desc desc;<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0ice_fill_dflt_direct_cmd_desc(&amp;desc, ice_mbx_=
opc_send_msg_to_vf);<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0cmd =3D &amp;desc.params.virt;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0cmd-&gt;id =3D CPU_TO_LE32(vfid);<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0desc.cookie_high =3D CPU_TO_LE32(v_opcode);<br>
&gt; +=C2=A0 =C2=A0 =C2=A0desc.cookie_low =3D CPU_TO_LE32(v_retval);<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0if (msglen)<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0desc.flags |=3D CPU_T=
O_LE16(ICE_AQ_FLAG_RD);<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0return ice_sq_send_cmd(hw, &amp;hw-&gt;mailboxq, =
&amp;desc, msg, msglen, cd);<br>
&gt; +}<br>
&gt; +<br>
&gt; +/**<br>
&gt; + * ice_aq_send_msg_to_pf<br>
&gt; + * @hw: pointer to the hardware structure<br>
&gt; + * @v_opcode: opcodes for VF-PF communication<br>
&gt; + * @v_retval: return error code<br>
&gt; + * @msg: pointer to the msg buffer<br>
&gt; + * @msglen: msg length<br>
&gt; + * @cd: pointer to command details<br>
&gt; + *<br>
&gt; + * Send message to PF driver using mailbox queue. By default, this<br=
>
&gt; + * message is sent asynchronously, i.e. ice_sq_send_cmd()<br>
&gt; + * does not wait for completion before returning.<br>
&gt; + */<br>
&gt; +enum ice_status<br>
&gt; +ice_aq_send_msg_to_pf(struct ice_hw *hw, enum virtchnl_ops v_opcode,<=
br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
enum ice_status v_retval, u8 *msg, u16 msglen,<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
struct ice_sq_cd *cd)<br>
&gt; +{<br>
&gt; +=C2=A0 =C2=A0 =C2=A0struct ice_aq_desc desc;<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0ice_fill_dflt_direct_cmd_desc(&amp;desc, ice_mbx_=
opc_send_msg_to_pf);<br>
&gt; +=C2=A0 =C2=A0 =C2=A0desc.cookie_high =3D CPU_TO_LE32(v_opcode);<br>
&gt; +=C2=A0 =C2=A0 =C2=A0desc.cookie_low =3D CPU_TO_LE32(v_retval);<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0if (msglen)<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0desc.flags |=3D CPU_T=
O_LE16(ICE_AQ_FLAG_RD);<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0return ice_sq_send_cmd(hw, &amp;hw-&gt;mailboxq, =
&amp;desc, msg, msglen, cd);<br>
&gt; +}<br>
&gt; +<br>
&gt; +/**<br>
&gt; + * ice_conv_link_speed_to_virtchnl<br>
&gt; + * @adv_link_support: determines the format of the returned link spee=
d<br>
&gt; + * @link_speed: variable containing the link_speed to be converted<br=
>
&gt; + *<br>
&gt; + * Convert link speed supported by HW to link speed supported by virt=
chnl.<br>
&gt; + * If adv_link_support is true, then return link speed in Mbps. Else =
return<br>
&gt; + * link speed as a VIRTCHNL_LINK_SPEED_* casted to a u32. Note that t=
he caller<br>
&gt; + * needs to cast back to an enum virtchnl_link_speed in the case wher=
e<br>
&gt; + * adv_link_support is false, but when adv_link_support is true the c=
aller can<br>
&gt; + * expect the speed in Mbps.<br>
&gt; + */<br>
&gt; +u32 ice_conv_link_speed_to_virtchnl(bool adv_link_support, u16 link_s=
peed)<br>
&gt; +{<br>
&gt; +=C2=A0 =C2=A0 =C2=A0u32 speed;<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0if (adv_link_support)<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0switch (link_speed) {=
<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case ICE_AQ_LINK_SPEE=
D_10MB:<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0speed =3D ICE_LINK_SPEED_10MBPS;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0break;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case ICE_AQ_LINK_SPEE=
D_100MB:<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0speed =3D ICE_LINK_SPEED_100MBPS;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0break;<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LINK_SPEE=
D_50GB:<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0speed =3D ICE_LINK_SPEED_50000MBPS;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0break;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case ICE_AQ_LINK_SPEE=
D_100GB:<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0speed =3D ICE_LINK_SPEED_100000MBPS;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0break;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0default:<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0speed =3D ICE_LINK_SPEED_UNKNOWN;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0break;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
&gt; +=C2=A0 =C2=A0 =C2=A0else<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* Virtchnl speeds ar=
e not defined for every speed supported in<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * the hardware. To m=
aintain compatibility with older AVF<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * drivers, while rep=
orting the speed the new speed values are<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * resolved to the cl=
osest known virtchnl speeds<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0switch (link_speed) {=
<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case ICE_AQ_LINK_SPEE=
D_10MB:<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case ICE_AQ_LINK_SPEE=
D_100MB:<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0speed =3D (u32)VIRTCHNL_LINK_SPEED_100MB;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0break;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case ICE_AQ_LINK_SPEE=
D_1000MB:<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case ICE_AQ_LINK_SPEE=
D_2500MB:<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case ICE_AQ_LINK_SPEE=
D_5GB:<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0speed =3D (u32)VIRTCHNL_LINK_SPEED_1GB;<br>
&gt; +=C2=A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<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case ICE_AQ_LINK_SPEE=
D_50GB:<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case ICE_AQ_LINK_SPEE=
D_100GB:<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0speed =3D (u32)VIRTCHNL_LINK_SPEED_40GB;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0break;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0default:<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0speed =3D (u32)VIRTCHNL_LINK_SPEED_UNKNOWN;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0break;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0return speed;<br>
&gt; +}<br>
&gt; +<br>
&gt; +/* The mailbox overflow detection algorithm helps to check if there<b=
r>
&gt; + * is a possibility of a malicious VF transmitting too many MBX messa=
ges to the<br>
&gt; + * PF.<br>
&gt; + * 1. The mailbox snapshot structure, ice_mbx_snapshot, is initialize=
d during<br>
&gt; + * driver initialization in ice_init_hw() using ice_mbx_init_snapshot=
().<br>
&gt; + * The struct ice_mbx_snapshot helps to track and traverse a static w=
indow of<br>
&gt; + * messages within the mailbox queue while looking for a malicious VF=
.<br>
&gt; + *<br>
&gt; + * 2. When the caller starts processing its mailbox queue in response=
 to an<br>
&gt; + * interrupt, the structure ice_mbx_snapshot is expected to be cleare=
d before<br>
&gt; + * the algorithm can be run for the first time for that interrupt. Th=
is can be<br>
&gt; + * done via ice_mbx_reset_snapshot().<br>
&gt; + *<br>
&gt; + * 3. For every message read by the caller from the MBX Queue, the ca=
ller must<br>
&gt; + * call the detection algorithm&#39;s entry function ice_mbx_vf_state=
_handler().<br>
&gt; + * Before every call to ice_mbx_vf_state_handler() the struct ice_mbx=
_data is<br>
&gt; + * filled as it is required to be passed to the algorithm.<br>
&gt; + *<br>
&gt; + * 4. Every time a message is read from the MBX queue, a VFId is rece=
ived which<br>
&gt; + * is passed to the state handler. The boolean output is_malvf of the=
 state<br>
&gt; + * handler ice_mbx_vf_state_handler() serves as an indicator to the c=
aller<br>
&gt; + * whether this VF is malicious or not.<br>
&gt; + *<br>
&gt; + * 5. When a VF is identified to be malicious, the caller can send a =
message<br>
&gt; + * to the system administrator. The caller can invoke ice_mbx_report_=
malvf()<br>
&gt; + * to help determine if a malicious VF is to be reported or not. This=
 function<br>
&gt; + * requires the caller to maintain a global bitmap to track all malic=
ious VFs<br>
&gt; + * and pass that to ice_mbx_report_malvf() along with the VFID which =
was identified<br>
&gt; + * to be malicious by ice_mbx_vf_state_handler().<br>
&gt; + *<br>
&gt; + * 6. The global bitmap maintained by PF can be cleared completely if=
 PF is in<br>
&gt; + * reset or the bit corresponding to a VF can be cleared if that VF i=
s in reset.<br>
&gt; + * When a VF is shut down and brought back up, we assume that the new=
 VF<br>
&gt; + * brought up is not malicious and hence report it if found malicious=
.<br>
&gt; + *<br>
&gt; + * 7. The function ice_mbx_reset_snapshot() is called to reset the in=
formation<br>
&gt; + * in ice_mbx_snapshot for every new mailbox interrupt handled.<br>
&gt; + *<br>
&gt; + * 8. The memory allocated for variables in ice_mbx_snapshot is de-al=
located<br>
&gt; + * when driver is unloaded.<br>
&gt; + */<br>
&gt; +#define ICE_RQ_DATA_MASK(rq_data) ((rq_data) &amp; PF_MBX_ARQH_ARQH_M=
)<br>
&gt; +/* Using the highest value for an unsigned 16-bit value 0xFFFF to ind=
icate that<br>
&gt; + * the max messages check must be ignored in the algorithm<br>
&gt; + */<br>
&gt; +#define ICE_IGNORE_MAX_MSG_CNT=C2=A0 =C2=A0 =C2=A0 =C2=A00xFFFF<br>
&gt; +<br>
&gt; +/**<br>
&gt; + * ice_mbx_traverse - Pass through mailbox snapshot<br>
&gt; + * @hw: pointer to the HW struct<br>
&gt; + * @new_state: new algorithm state<br>
&gt; + *<br>
&gt; + * Traversing the mailbox static snapshot without checking<br>
&gt; + * for malicious VFs.<br>
&gt; + */<br>
&gt; +static void<br>
&gt; +ice_mbx_traverse(struct ice_hw *hw,<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 enum ice_mbx_snapsho=
t_state *new_state)<br>
&gt; +{<br>
&gt; +=C2=A0 =C2=A0 =C2=A0struct ice_mbx_snap_buffer_data *snap_buf;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0u32 num_iterations;<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0snap_buf =3D &amp;hw-&gt;mbx_snapshot.mbx_buf;<br=
>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0/* As mailbox buffer is circular, applying a mask=
<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 * on the incremented iteration count.<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 */<br>
&gt; +=C2=A0 =C2=A0 =C2=A0num_iterations =3D ICE_RQ_DATA_MASK(++snap_buf-&g=
t;num_iterations);<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0/* Checking either of the below conditions to exi=
t snapshot traversal:<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 * Condition-1: If the number of iterations in th=
e mailbox is equal to<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 * the mailbox head which would indicate that we =
have reached the end<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 * of the static snapshot.<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 * Condition-2: If the maximum messages serviced =
in the mailbox for a<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 * given interrupt is the highest possible value =
then there is no need<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 * to check if the number of messages processed i=
s equal to it. If not<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 * check if the number of messages processed is g=
reater than or equal<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 * to the maximum number of mailbox entries servi=
ced in current work item.<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 */<br>
&gt; +=C2=A0 =C2=A0 =C2=A0if (num_iterations =3D=3D snap_buf-&gt;head ||<br=
>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(snap_buf-&gt;max_num_msgs_mbx &lt;=
 ICE_IGNORE_MAX_MSG_CNT &amp;&amp;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ++snap_buf-&gt;num_msg_proc &gt;=
=3D snap_buf-&gt;max_num_msgs_mbx))<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*new_state =3D ICE_MA=
L_VF_DETECT_STATE_NEW_SNAPSHOT;<br>
&gt; +}<br>
&gt; +<br>
&gt; +/**<br>
&gt; + * ice_mbx_detect_malvf - Detect malicious VF in snapshot<br>
&gt; + * @hw: pointer to the HW struct<br>
&gt; + * @vf_id: relative virtual function ID<br>
&gt; + * @new_state: new algorithm state<br>
&gt; + * @is_malvf: boolean output to indicate if VF is malicious<br>
&gt; + *<br>
&gt; + * This function tracks the number of asynchronous messages<br>
&gt; + * sent per VF and marks the VF as malicious if it exceeds<br>
&gt; + * the permissible number of messages to send.<br>
&gt; + */<br>
&gt; +static enum ice_status<br>
&gt; +ice_mbx_detect_malvf(struct ice_hw *hw, u16 vf_id,<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 enum i=
ce_mbx_snapshot_state *new_state,<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bool *=
is_malvf)<br>
&gt; +{<br>
&gt; +=C2=A0 =C2=A0 =C2=A0struct ice_mbx_snapshot *snap =3D &amp;hw-&gt;mbx=
_snapshot;<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0if (vf_id &gt;=3D snap-&gt;mbx_vf.vfcntr_len)<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return ICE_ERR_OUT_OF=
_RANGE;<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0/* increment the message count in the VF array */=
<br>
&gt; +=C2=A0 =C2=A0 =C2=A0snap-&gt;mbx_vf.vf_cntr[vf_id]++;<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0if (snap-&gt;mbx_vf.vf_cntr[vf_id] &gt;=3D ICE_AS=
YNC_VF_MSG_THRESHOLD)<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*is_malvf =3D true;<b=
r>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0/* continue to iterate through the mailbox snapsh=
ot */<br>
&gt; +=C2=A0 =C2=A0 =C2=A0ice_mbx_traverse(hw, new_state);<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0return ICE_SUCCESS;<br>
&gt; +}<br>
&gt; +<br>
&gt; +/**<br>
&gt; + * ice_mbx_reset_snapshot - Reset mailbox snapshot structure<br>
&gt; + * @snap: pointer to mailbox snapshot structure in the ice_hw struct<=
br>
&gt; + *<br>
&gt; + * Reset the mailbox snapshot structure and clear VF counter array.<b=
r>
&gt; + */<br>
&gt; +static void ice_mbx_reset_snapshot(struct ice_mbx_snapshot *snap)<br>
&gt; *** 15611 LINES SKIPPED ***<br>
<br>
<br>
<br>
</blockquote></div></div></div>

--000000000000014480061fc48d49--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfpk7dSiuYaU42cFXrhqMsonbPrQrjzTDeWL=vvCnoHMxA>