Re: svn commit: r361546 - head/sys/cam/ata

2020-05-26 Thread Ravi Pokala
-Original Message-
From:  on behalf of Adrian Chadd 

Date: 2020-05-26, Tuesday at 19:10
To: , , 

Subject: svn commit: r361546 - head/sys/cam/ata

Author: adrian
Date: Wed May 27 02:10:09 2020
New Revision: 361546
URL: https://svnweb.freebsd.org/changeset/base/361546

Log:
  [ata_da] remove duplicate definition; it trips up ye olde gcc-6 on mips32

s/definition/declaration/



-Ravi (rpokala@)

  Checked first with: irc

Modified:
  head/sys/cam/ata/ata_da.c

Modified: head/sys/cam/ata/ata_da.c

==
--- head/sys/cam/ata/ata_da.c   Wed May 27 01:35:46 2020
(r361545)
+++ head/sys/cam/ata/ata_da.c   Wed May 27 02:10:09 2020
(r361546)
@@ -836,7 +836,6 @@ static  voidadaasync(void *callback_arg, 
u_int32_t co
 static int adabitsysctl(SYSCTL_HANDLER_ARGS);
 static int adaflagssysctl(SYSCTL_HANDLER_ARGS);
 static int adazonesupsysctl(SYSCTL_HANDLER_ARGS);
-static int adazonesupsysctl(SYSCTL_HANDLER_ARGS);
 static voidadasysctlinit(void *context, int pending);
 static int adagetattr(struct bio *bp);
 static voidadasetflags(struct ada_softc *softc,


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361546 - head/sys/cam/ata

2020-05-26 Thread Adrian Chadd
Author: adrian
Date: Wed May 27 02:10:09 2020
New Revision: 361546
URL: https://svnweb.freebsd.org/changeset/base/361546

Log:
  [ata_da] remove duplicate definition; it trips up ye olde gcc-6 on mips32
  
  Checked first with: irc

Modified:
  head/sys/cam/ata/ata_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Wed May 27 01:35:46 2020(r361545)
+++ head/sys/cam/ata/ata_da.c   Wed May 27 02:10:09 2020(r361546)
@@ -836,7 +836,6 @@ static  voidadaasync(void *callback_arg, 
u_int32_t co
 static int adabitsysctl(SYSCTL_HANDLER_ARGS);
 static int adaflagssysctl(SYSCTL_HANDLER_ARGS);
 static int adazonesupsysctl(SYSCTL_HANDLER_ARGS);
-static int adazonesupsysctl(SYSCTL_HANDLER_ARGS);
 static voidadasysctlinit(void *context, int pending);
 static int adagetattr(struct bio *bp);
 static voidadasetflags(struct ada_softc *softc,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r361544 - in head/sys: conf powerpc/aim powerpc/booke powerpc/include powerpc/powerpc powerpc/ps3 powerpc/pseries

2020-05-26 Thread Justin Hibbits
On Tue, May 26, 2020, 20:24 Justin Hibbits  wrote:

> Author: jhibbits
> Date: Wed May 27 01:24:12 2020
> New Revision: 361544
> URL: https://svnweb.freebsd.org/changeset/base/361544
>
> Log:
>   powerpc/mmu: Convert PowerPC pmap drivers to ifunc from kobj
>
>   With IFUNC support in the kernel, we can finally get rid of our
> poor-man's
>   ifunc for pmap, utilizing kobj.  Since moea64 uses a second tier kobj as
>   well, for its own private methods, this adds a second pmap install
> function
>   (pmap_mmu_init()) to perform pmap 'post-install pre-bootstrap'
>   initialization, before the IFUNCs get initialized.
>
>   Reviewed by:  bdragon


Differential revision: https://reviews.freebsd.org/D24993

>
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r361541 - in head: . sys/amd64/conf sys/arm64/conf sys/conf sys/contrib/dev/ice sys/dev/ice sys/modules sys/modules/ice sys/modules/ice_ddp tools/kerneldoc/subsys

2020-05-26 Thread Eric Joyner
On Tue, May 26, 2020 at 5:39 PM Rodney W. Grimes 
wrote

> That ones a bit iffy in a source released situation, what does it
> mean to "reverse engineer" source code?
>

I don't know. Keep in mind that is the license for that binary in the
directory; the actual
source code for the driver (not in this sys/contrib/dev/ice directory) is
still the 3-clause
BSD license.


> A patent clause?  I do not believe we have any code in the tree
> with an attached patent clause.
>

The text in that LICENSE is actually exactly the same as the one used for
the Wi-Fi firmware blobs
in sys/contrib/iwm and sys/contrib/iwn. The one in iwn has been in there
for 12 years.


> It must be interpretted that an "express licenese" overrides these terms to
> be safe.  It is not clear to me that the contentx of LICENSE file are an
> over riding express license to these statements here as neither is
> explicity
> in the materials covered by the license.
>

I will look at this, though I'm not sure that having the LICENSE file in
the same directory
wouldn't be obvious enough.

- Eric
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361545 - head/sys/vm

2020-05-26 Thread Justin Hibbits
Author: jhibbits
Date: Wed May 27 01:35:46 2020
New Revision: 361545
URL: https://svnweb.freebsd.org/changeset/base/361545

Log:
  Properly sort ifdef archs in vm_fault_soft_fast superpage guards.
  
  Sort broken in r360887.

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==
--- head/sys/vm/vm_fault.c  Wed May 27 01:24:12 2020(r361544)
+++ head/sys/vm/vm_fault.c  Wed May 27 01:35:46 2020(r361545)
@@ -299,9 +299,9 @@ static int
 vm_fault_soft_fast(struct faultstate *fs)
 {
vm_page_t m, m_map;
-#if (defined(__aarch64__) || defined(__amd64__) || defined(__powerpc64__) || 
(defined(__arm__) && \
-__ARM_ARCH >= 6) || defined(__i386__) || defined(__riscv)) && \
-VM_NRESERVLEVEL > 0
+#if (defined(__aarch64__) || defined(__amd64__) || (defined(__arm__) && \
+__ARM_ARCH >= 6) || defined(__i386__) || defined(__powerpc64__) || \
+defined(__riscv)) && VM_NRESERVLEVEL > 0
vm_page_t m_super;
int flags;
 #endif
@@ -320,9 +320,9 @@ vm_fault_soft_fast(struct faultstate *fs)
}
m_map = m;
psind = 0;
-#if (defined(__aarch64__) || defined(__amd64__) || defined(__powerpc64__) || 
(defined(__arm__) && \
-__ARM_ARCH >= 6) || defined(__i386__) || defined(__riscv)) && \
-VM_NRESERVLEVEL > 0
+#if (defined(__aarch64__) || defined(__amd64__) || (defined(__arm__) && \
+__ARM_ARCH >= 6) || defined(__i386__) || defined(__powerpc64__) || \
+defined(__riscv)) && VM_NRESERVLEVEL > 0
if ((m->flags & PG_FICTITIOUS) == 0 &&
(m_super = vm_reserv_to_superpage(m)) != NULL &&
rounddown2(vaddr, pagesizes[m_super->psind]) >= fs->entry->start &&
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361544 - in head/sys: conf powerpc/aim powerpc/booke powerpc/include powerpc/powerpc powerpc/ps3 powerpc/pseries

2020-05-26 Thread Justin Hibbits
Author: jhibbits
Date: Wed May 27 01:24:12 2020
New Revision: 361544
URL: https://svnweb.freebsd.org/changeset/base/361544

Log:
  powerpc/mmu: Convert PowerPC pmap drivers to ifunc from kobj
  
  With IFUNC support in the kernel, we can finally get rid of our poor-man's
  ifunc for pmap, utilizing kobj.  Since moea64 uses a second tier kobj as
  well, for its own private methods, this adds a second pmap install function
  (pmap_mmu_init()) to perform pmap 'post-install pre-bootstrap'
  initialization, before the IFUNCs get initialized.
  
  Reviewed by:  bdragon

Deleted:
  head/sys/powerpc/aim/moea64_if.m
  head/sys/powerpc/powerpc/mmu_if.m
Modified:
  head/sys/conf/files.powerpc
  head/sys/powerpc/aim/mmu_oea.c
  head/sys/powerpc/aim/mmu_oea64.c
  head/sys/powerpc/aim/mmu_oea64.h
  head/sys/powerpc/aim/mmu_radix.c
  head/sys/powerpc/aim/moea64_native.c
  head/sys/powerpc/booke/booke_machdep.c
  head/sys/powerpc/booke/pmap.c
  head/sys/powerpc/booke/pmap_32.c
  head/sys/powerpc/booke/pmap_64.c
  head/sys/powerpc/include/mmuvar.h
  head/sys/powerpc/include/pmap.h
  head/sys/powerpc/powerpc/machdep.c
  head/sys/powerpc/powerpc/pmap_dispatch.c
  head/sys/powerpc/ps3/mmu_ps3.c
  head/sys/powerpc/pseries/mmu_phyp.c

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Wed May 27 01:04:03 2020(r361543)
+++ head/sys/conf/files.powerpc Wed May 27 01:24:12 2020(r361544)
@@ -135,7 +135,6 @@ powerpc/aim/aim_machdep.c   optionalaim
 powerpc/aim/mmu_oea.c  optionalaim powerpc
 powerpc/aim/mmu_oea64.coptionalaim
 powerpc/aim/mmu_radix.coptionalaim powerpc64
-powerpc/aim/moea64_if.moptionalaim
 powerpc/aim/moea64_native.coptionalaim
 powerpc/aim/mp_cpudep.coptionalaim
 powerpc/aim/slb.c  optionalaim powerpc64
@@ -260,7 +259,6 @@ powerpc/powerpc/iommu_if.m  standard
 powerpc/powerpc/machdep.c  standard
 powerpc/powerpc/mem.c  optionalmem
 powerpc/powerpc/minidump_machdep.c optionalpowerpc64
-powerpc/powerpc/mmu_if.m   standard
 powerpc/powerpc/mp_machdep.c   optionalsmp
 powerpc/powerpc/nexus.cstandard
 powerpc/powerpc/openpic.c  standard

Modified: head/sys/powerpc/aim/mmu_oea.c
==
--- head/sys/powerpc/aim/mmu_oea.c  Wed May 27 01:04:03 2020
(r361543)
+++ head/sys/powerpc/aim/mmu_oea.c  Wed May 27 01:24:12 2020
(r361544)
@@ -149,8 +149,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "mmu_if.h"
-
 #defineMOEA_DEBUG
 
 #define TODO   panic("%s: not implemented", __func__);
@@ -267,125 +265,123 @@ static int  moea_enter_locked(pmap_t, 
vm_offset_t, vm_
 static voidmoea_syncicache(vm_paddr_t, vm_size_t);
 static boolean_t   moea_query_bit(vm_page_t, int);
 static u_int   moea_clear_bit(vm_page_t, int);
-static voidmoea_kremove(mmu_t, vm_offset_t);
+static voidmoea_kremove(vm_offset_t);
 intmoea_pte_spill(vm_offset_t);
 
 /*
  * Kernel MMU interface
  */
-void moea_clear_modify(mmu_t, vm_page_t);
-void moea_copy_page(mmu_t, vm_page_t, vm_page_t);
-void moea_copy_pages(mmu_t mmu, vm_page_t *ma, vm_offset_t a_offset,
+void moea_clear_modify(vm_page_t);
+void moea_copy_page(vm_page_t, vm_page_t);
+void moea_copy_pages(vm_page_t *ma, vm_offset_t a_offset,
 vm_page_t *mb, vm_offset_t b_offset, int xfersize);
-int moea_enter(mmu_t, pmap_t, vm_offset_t, vm_page_t, vm_prot_t, u_int,
+int moea_enter(pmap_t, vm_offset_t, vm_page_t, vm_prot_t, u_int,
 int8_t);
-void moea_enter_object(mmu_t, pmap_t, vm_offset_t, vm_offset_t, vm_page_t,
+void moea_enter_object(pmap_t, vm_offset_t, vm_offset_t, vm_page_t,
 vm_prot_t);
-void moea_enter_quick(mmu_t, pmap_t, vm_offset_t, vm_page_t, vm_prot_t);
-vm_paddr_t moea_extract(mmu_t, pmap_t, vm_offset_t);
-vm_page_t moea_extract_and_hold(mmu_t, pmap_t, vm_offset_t, vm_prot_t);
-void moea_init(mmu_t);
-boolean_t moea_is_modified(mmu_t, vm_page_t);
-boolean_t moea_is_prefaultable(mmu_t, pmap_t, vm_offset_t);
-boolean_t moea_is_referenced(mmu_t, vm_page_t);
-int moea_ts_referenced(mmu_t, vm_page_t);
-vm_offset_t moea_map(mmu_t, vm_offset_t *, vm_paddr_t, vm_paddr_t, int);
-boolean_t moea_page_exists_quick(mmu_t, pmap_t, vm_page_t);
-void moea_page_init(mmu_t, vm_page_t);
-int moea_page_wired_mappings(mmu_t, vm_page_t);
-void moea_pinit(mmu_t, pmap_t);
-void moea_pinit0(mmu_t, pmap_t);
-void moea_protect(mmu_t, pmap_t, vm_offset_t, vm_offset_t, vm_prot_t);
-void moea_qenter(mmu_t, vm_offset_t, vm_page_t *, int);
-void moea_qremove(mmu_t, vm_offset_t, int);
-void moea_release(mmu_t, pmap_t);
-void moea_remove(mmu_t, pmap_t, vm_offset_t, vm_offset_t);
-void moea_remove_all(mmu_t, 

svn commit: r361543 - stable/12/share/vt/keymaps

2020-05-26 Thread Ed Maste
Author: emaste
Date: Wed May 27 01:04:03 2020
New Revision: 361543
URL: https://svnweb.freebsd.org/changeset/base/361543

Log:
  MFC r361292: vt: fix duplicate keymap descriptions
  
  PR:   246495
  Submitted by: Jorge Maidana

Modified:
  stable/12/share/vt/keymaps/INDEX.keymaps
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/vt/keymaps/INDEX.keymaps
==
--- stable/12/share/vt/keymaps/INDEX.keymapsWed May 27 00:17:05 2020
(r361542)
+++ stable/12/share/vt/keymaps/INDEX.keymapsWed May 27 01:04:03 2020
(r361543)
@@ -308,10 +308,10 @@ kz.kst.kbd:da:Kasakhisk
 kz.kst.kbd:de:Kasachisch
 kz.kst.kbd:fr:Kazakh
 
-kz.io.kbd:en:Kazakh
-kz.io.kbd:da:Kasakhisk
-kz.io.kbd:de:Kasachisch
-kz.io.kbd:fr:Kazakh
+kz.io.kbd:en:Kazakh (with IO)
+kz.io.kbd:da:Kasakhisk (IO)
+kz.io.kbd:de:Kasachisch (mit IO)
+kz.io.kbd:fr:Kazakh (avec IO)
 
 latinamerican.kbd:en:Latin American
 latinamerican.kbd:da:Latinamerikansk
@@ -411,19 +411,19 @@ es.dvorak.kbd:fr:Espagnol Dvorak
 es.dvorak.kbd:pt:Espanhol Dvorak
 es.dvorak.kbd:es:Español Dvorak
 
+es.kbd:en:Spanish
+es.kbd:da:Spansk
+es.kbd:de:Spanisch
+es.kbd:fr:Espagnol
+es.kbd:pt:Espanhol
+es.kbd:es:Español
+
 es.acc.kbd:en:Spanish (accent keys)
 es.acc.kbd:da:Spansk (accenttaster)
 es.acc.kbd:de:Spanisch (accent keys)
 es.acc.kbd:fr:Espagnol (avec accents)
 es.acc.kbd:pt:Espanhol (com acentos)
 es.acc.kbd:es:Español (con acentos)
-
-es.kbd:en:Spanish (accent keys)
-es.kbd:da:Spansk (accenttaster)
-es.kbd:de:Spanisch (accent keys)
-es.kbd:fr:Espagnol (avec accents)
-es.kbd:pt:Espanhol (com acentos)
-es.kbd:es:Español (con acentos)
 
 si.kbd:en:Slovenian
 si.kbd:da:Slovensk
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r361541 - in head: . sys/amd64/conf sys/arm64/conf sys/conf sys/contrib/dev/ice sys/dev/ice sys/modules sys/modules/ice sys/modules/ice_ddp tools/kerneldoc/subsys

2020-05-26 Thread Rodney W. Grimes
[ Charset UTF-8 unsupported, converting... ]
> Author: erj
> Date: Tue May 26 23:35:10 2020
> New Revision: 361541
> URL: https://svnweb.freebsd.org/changeset/base/361541
> 
> Log:
>   ice(4): Introduce new driver for Intel E800 Ethernet controllers
>   
>   The ice(4) driver is the driver for the Intel E8xx series Ethernet
>   controllers; currently with codenames Columbiaville and
>   Columbia Park.
>   
>   These new controllers support 100G speeds, as well as introducing
>   more queues, better virtualization support, and more offload
>   capabilities. Future work will enable virtual functions (like
>   in ixl(4)) and the other functionality outlined above.
>   
>   For full functionality, the kernel should be compiled with
>   "device ice_ddp" like in the amd64 NOTES file, and/or
>   ice_ddp_load="YES" should be added to /boot/loader.conf so that
>   the DDP package file included in this commit can be downloaded
>   to the adapter. Otherwise, the adapter will fall back to a single
>   queue mode with limited functionality.
>   
>   A man page for this driver will be forthcoming.
>   
>   MFC after:  1 month
>   Relnotes:   yes
>   Sponsored by:   Intel Corporation
>   Differential Revision:  https://reviews.freebsd.org/D21959

This code is not strickly BSD n-claused licensed.

These files contain license clauses and scopes that are outside
the curretly accepted "by the project" and that needs reviewed
by core before this should of been committed.

I do not see any huge issues, but there are some edges that
might need some far more careful consideration.

Oddly the file that was in the email of the commit actually
does contain an "Intel'ed 3 clause BSD license?"

> 
> Added:
>   head/sys/contrib/dev/ice/
>   head/sys/contrib/dev/ice/LICENSE   (contents, props changed)
>   head/sys/contrib/dev/ice/README   (contents, props changed)
>   head/sys/contrib/dev/ice/ice-1.3.9.0.pkg   (contents, props changed)
>   head/sys/dev/ice/
>   head/sys/dev/ice/ice_adminq_cmd.h   (contents, props changed)
>   head/sys/dev/ice/ice_alloc.h   (contents, props changed)
>   head/sys/dev/ice/ice_bitops.h   (contents, props changed)
>   head/sys/dev/ice/ice_common.c   (contents, props changed)
>   head/sys/dev/ice/ice_common.h   (contents, props changed)
>   head/sys/dev/ice/ice_common_sysctls.h   (contents, props changed)
>   head/sys/dev/ice/ice_common_txrx.h   (contents, props changed)
>   head/sys/dev/ice/ice_controlq.c   (contents, props changed)
>   head/sys/dev/ice/ice_controlq.h   (contents, props changed)
>   head/sys/dev/ice/ice_dcb.c   (contents, props changed)
>   head/sys/dev/ice/ice_dcb.h   (contents, props changed)
>   head/sys/dev/ice/ice_devids.h   (contents, props changed)
>   head/sys/dev/ice/ice_drv_info.h   (contents, props changed)
>   head/sys/dev/ice/ice_features.h   (contents, props changed)
>   head/sys/dev/ice/ice_flex_pipe.c   (contents, props changed)
>   head/sys/dev/ice/ice_flex_pipe.h   (contents, props changed)
>   head/sys/dev/ice/ice_flex_type.h   (contents, props changed)
>   head/sys/dev/ice/ice_flow.c   (contents, props changed)
>   head/sys/dev/ice/ice_flow.h   (contents, props changed)
>   head/sys/dev/ice/ice_hw_autogen.h   (contents, props changed)
>   head/sys/dev/ice/ice_iflib.h   (contents, props changed)
>   head/sys/dev/ice/ice_iflib_recovery_txrx.c   (contents, props changed)
>   head/sys/dev/ice/ice_iflib_sysctls.h   (contents, props changed)
>   head/sys/dev/ice/ice_iflib_txrx.c   (contents, props changed)
>   head/sys/dev/ice/ice_lan_tx_rx.h   (contents, props changed)
>   head/sys/dev/ice/ice_lib.c   (contents, props changed)
>   head/sys/dev/ice/ice_lib.h   (contents, props changed)
>   head/sys/dev/ice/ice_nvm.c   (contents, props changed)
>   head/sys/dev/ice/ice_nvm.h   (contents, props changed)
>   head/sys/dev/ice/ice_opts.h   (contents, props changed)
>   head/sys/dev/ice/ice_osdep.c   (contents, props changed)
>   head/sys/dev/ice/ice_osdep.h   (contents, props changed)
>   head/sys/dev/ice/ice_protocol_type.h   (contents, props changed)
>   head/sys/dev/ice/ice_resmgr.c   (contents, props changed)
>   head/sys/dev/ice/ice_resmgr.h   (contents, props changed)
>   head/sys/dev/ice/ice_rss.h   (contents, props changed)
>   head/sys/dev/ice/ice_sbq_cmd.h   (contents, props changed)
>   head/sys/dev/ice/ice_sched.c   (contents, props changed)
>   head/sys/dev/ice/ice_sched.h   (contents, props changed)
>   head/sys/dev/ice/ice_sriov.c   (contents, props changed)
>   head/sys/dev/ice/ice_sriov.h   (contents, props changed)
>   head/sys/dev/ice/ice_status.h   (contents, props changed)
>   head/sys/dev/ice/ice_strings.c   (contents, props changed)
>   head/sys/dev/ice/ice_switch.c   (contents, props changed)
>   head/sys/dev/ice/ice_switch.h   (contents, props changed)
>   head/sys/dev/ice/ice_type.h   (contents, props changed)
>   head/sys/dev/ice/if_ice_iflib.c   (contents, props changed)
>   head/sys/dev/ice/virtchnl.h   (contents, props changed)
>   

svn commit: r361542 - head/sys/powerpc/aim

2020-05-26 Thread Brandon Bergren
Author: bdragon
Date: Wed May 27 00:17:05 2020
New Revision: 361542
URL: https://svnweb.freebsd.org/changeset/base/361542

Log:
  [PowerPC] Fix invalid asm in trap code
  
  In this context, 0 actually means 0 (i.e. this is a li instruction).
  
  While most assemblers will ignore this, I did have a compile failure at one
  point when using an external toolchain.
  
  In the future, we should use the li syntax to make this clearer.
  
  Sponsored by: Tag1 Consulting, Inc.

Modified:
  head/sys/powerpc/aim/trap_subr32.S

Modified: head/sys/powerpc/aim/trap_subr32.S
==
--- head/sys/powerpc/aim/trap_subr32.S  Tue May 26 23:35:10 2020
(r361541)
+++ head/sys/powerpc/aim/trap_subr32.S  Wed May 27 00:17:05 2020
(r361542)
@@ -426,7 +426,7 @@ instr_sec_hash:
bne do_isi  /* if so, go to ISI interrupt */
mfspr %r2, SPR_HASH2/* get the second pointer */
ori %r3, %r3, 0x0040/* change the compare value */
-   addi %r1, %r0, 8/* load 8 for counter */
+   addi %r1, 0, 8  /* load 8 for counter */
addi %r2, %r2, -8   /* pre dec for update on load */
b im0   /* try second hash */
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361541 - in head: . sys/amd64/conf sys/arm64/conf sys/conf sys/contrib/dev/ice sys/dev/ice sys/modules sys/modules/ice sys/modules/ice_ddp tools/kerneldoc/subsys

2020-05-26 Thread Eric Joyner
Author: erj
Date: Tue May 26 23:35:10 2020
New Revision: 361541
URL: https://svnweb.freebsd.org/changeset/base/361541

Log:
  ice(4): Introduce new driver for Intel E800 Ethernet controllers
  
  The ice(4) driver is the driver for the Intel E8xx series Ethernet
  controllers; currently with codenames Columbiaville and
  Columbia Park.
  
  These new controllers support 100G speeds, as well as introducing
  more queues, better virtualization support, and more offload
  capabilities. Future work will enable virtual functions (like
  in ixl(4)) and the other functionality outlined above.
  
  For full functionality, the kernel should be compiled with
  "device ice_ddp" like in the amd64 NOTES file, and/or
  ice_ddp_load="YES" should be added to /boot/loader.conf so that
  the DDP package file included in this commit can be downloaded
  to the adapter. Otherwise, the adapter will fall back to a single
  queue mode with limited functionality.
  
  A man page for this driver will be forthcoming.
  
  MFC after:1 month
  Relnotes: yes
  Sponsored by: Intel Corporation
  Differential Revision:https://reviews.freebsd.org/D21959

Added:
  head/sys/contrib/dev/ice/
  head/sys/contrib/dev/ice/LICENSE   (contents, props changed)
  head/sys/contrib/dev/ice/README   (contents, props changed)
  head/sys/contrib/dev/ice/ice-1.3.9.0.pkg   (contents, props changed)
  head/sys/dev/ice/
  head/sys/dev/ice/ice_adminq_cmd.h   (contents, props changed)
  head/sys/dev/ice/ice_alloc.h   (contents, props changed)
  head/sys/dev/ice/ice_bitops.h   (contents, props changed)
  head/sys/dev/ice/ice_common.c   (contents, props changed)
  head/sys/dev/ice/ice_common.h   (contents, props changed)
  head/sys/dev/ice/ice_common_sysctls.h   (contents, props changed)
  head/sys/dev/ice/ice_common_txrx.h   (contents, props changed)
  head/sys/dev/ice/ice_controlq.c   (contents, props changed)
  head/sys/dev/ice/ice_controlq.h   (contents, props changed)
  head/sys/dev/ice/ice_dcb.c   (contents, props changed)
  head/sys/dev/ice/ice_dcb.h   (contents, props changed)
  head/sys/dev/ice/ice_devids.h   (contents, props changed)
  head/sys/dev/ice/ice_drv_info.h   (contents, props changed)
  head/sys/dev/ice/ice_features.h   (contents, props changed)
  head/sys/dev/ice/ice_flex_pipe.c   (contents, props changed)
  head/sys/dev/ice/ice_flex_pipe.h   (contents, props changed)
  head/sys/dev/ice/ice_flex_type.h   (contents, props changed)
  head/sys/dev/ice/ice_flow.c   (contents, props changed)
  head/sys/dev/ice/ice_flow.h   (contents, props changed)
  head/sys/dev/ice/ice_hw_autogen.h   (contents, props changed)
  head/sys/dev/ice/ice_iflib.h   (contents, props changed)
  head/sys/dev/ice/ice_iflib_recovery_txrx.c   (contents, props changed)
  head/sys/dev/ice/ice_iflib_sysctls.h   (contents, props changed)
  head/sys/dev/ice/ice_iflib_txrx.c   (contents, props changed)
  head/sys/dev/ice/ice_lan_tx_rx.h   (contents, props changed)
  head/sys/dev/ice/ice_lib.c   (contents, props changed)
  head/sys/dev/ice/ice_lib.h   (contents, props changed)
  head/sys/dev/ice/ice_nvm.c   (contents, props changed)
  head/sys/dev/ice/ice_nvm.h   (contents, props changed)
  head/sys/dev/ice/ice_opts.h   (contents, props changed)
  head/sys/dev/ice/ice_osdep.c   (contents, props changed)
  head/sys/dev/ice/ice_osdep.h   (contents, props changed)
  head/sys/dev/ice/ice_protocol_type.h   (contents, props changed)
  head/sys/dev/ice/ice_resmgr.c   (contents, props changed)
  head/sys/dev/ice/ice_resmgr.h   (contents, props changed)
  head/sys/dev/ice/ice_rss.h   (contents, props changed)
  head/sys/dev/ice/ice_sbq_cmd.h   (contents, props changed)
  head/sys/dev/ice/ice_sched.c   (contents, props changed)
  head/sys/dev/ice/ice_sched.h   (contents, props changed)
  head/sys/dev/ice/ice_sriov.c   (contents, props changed)
  head/sys/dev/ice/ice_sriov.h   (contents, props changed)
  head/sys/dev/ice/ice_status.h   (contents, props changed)
  head/sys/dev/ice/ice_strings.c   (contents, props changed)
  head/sys/dev/ice/ice_switch.c   (contents, props changed)
  head/sys/dev/ice/ice_switch.h   (contents, props changed)
  head/sys/dev/ice/ice_type.h   (contents, props changed)
  head/sys/dev/ice/if_ice_iflib.c   (contents, props changed)
  head/sys/dev/ice/virtchnl.h   (contents, props changed)
  head/sys/dev/ice/virtchnl_inline_ipsec.h   (contents, props changed)
  head/sys/modules/ice/
  head/sys/modules/ice/Makefile   (contents, props changed)
  head/sys/modules/ice_ddp/
  head/sys/modules/ice_ddp/Makefile   (contents, props changed)
  head/tools/kerneldoc/subsys/Doxyfile-dev_ice   (contents, props changed)
Modified:
  head/MAINTAINERS
  head/sys/amd64/conf/GENERIC
  head/sys/amd64/conf/NOTES
  head/sys/arm64/conf/NOTES
  head/sys/conf/files.amd64
  head/sys/conf/files.arm64
  head/sys/modules/Makefile

Modified: head/MAINTAINERS
==
--- head/MAINTAINERSTue May 26 23:12:57 

svn commit: r361540 - in head/sys/x86: include x86

2020-05-26 Thread Conrad Meyer
Author: cem
Date: Tue May 26 23:12:57 2020
New Revision: 361540
URL: https://svnweb.freebsd.org/changeset/base/361540

Log:
  x86: Detect new feature bits
  
  Fix an off-by-one in AVX512VPOPCNTDQ identification.  That was actually the
  TME bit.
  
  Reported by:  debdrup

Modified:
  head/sys/x86/include/specialreg.h
  head/sys/x86/x86/identcpu.c

Modified: head/sys/x86/include/specialreg.h
==
--- head/sys/x86/include/specialreg.h   Tue May 26 22:41:12 2020
(r361539)
+++ head/sys/x86/include/specialreg.h   Tue May 26 23:12:57 2020
(r361540)
@@ -396,6 +396,7 @@
 #defineAMDFEID_IBRS_ALWAYSON   0x0001
 #defineAMDFEID_STIBP_ALWAYSON  0x0002
 #defineAMDFEID_PREFER_IBRS 0x0004
+#defineAMDFEID_PPIN0x0080
 #defineAMDFEID_SSBD0x0100
 /* SSBD via MSRC001_011F instead of MSR 0x48: */
 #defineAMDFEID_VIRT_SSBD   0x0200
@@ -459,7 +460,9 @@
 #defineCPUID_STDEXT2_VPCLMULQDQ0x0400
 #defineCPUID_STDEXT2_AVX512VNNI0x0800
 #defineCPUID_STDEXT2_AVX512BITALG  0x1000
+#defineCPUID_STDEXT2_TME   0x2000
 #defineCPUID_STDEXT2_AVX512VPOPCNTDQ   0x4000
+#defineCPUID_STDEXT2_LA57  0x0001
 #defineCPUID_STDEXT2_RDPID 0x0040
 #defineCPUID_STDEXT2_CLDEMOTE  0x0200
 #defineCPUID_STDEXT2_MOVDIRI   0x0800
@@ -472,6 +475,7 @@
  */
 #defineCPUID_STDEXT3_AVX5124VNNIW  0x0004
 #defineCPUID_STDEXT3_AVX5124FMAPS  0x0008
+#defineCPUID_STDEXT3_FSRM  0x0010
 #defineCPUID_STDEXT3_AVX512VP2INTERSECT0x0100
 #defineCPUID_STDEXT3_MD_CLEAR  0x0400
 #defineCPUID_STDEXT3_TSXFA 0x2000

Modified: head/sys/x86/x86/identcpu.c
==
--- head/sys/x86/x86/identcpu.c Tue May 26 22:41:12 2020(r361539)
+++ head/sys/x86/x86/identcpu.c Tue May 26 23:12:57 2020(r361540)
@@ -1008,7 +1008,9 @@ printcpuinfo(void)
   "\013VPCLMULQDQ"
   "\014AVX512VNNI"
   "\015AVX512BITALG"
-  "\016AVX512VPOPCNTDQ"
+  "\016TME"
+  "\017AVX512VPOPCNTDQ"
+  "\021LA57"
   "\027RDPID"
   "\032CLDEMOTE"
   "\034MOVDIRI"
@@ -1095,6 +1097,7 @@ printcpuinfo(void)
"\021IBRS_ALWAYSON"
"\022STIBP_ALWAYSON"
"\023PREFER_IBRS"
+   "\030PPIN"
"\031SSBD"
"\032VIRT_SSBD"
"\033SSB_NO"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361539 - in releng/11.4: share/man/man4 sys/contrib/ena-com sys/contrib/ena-com/ena_defs sys/dev/ena sys/modules/ena

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 22:41:12 2020
New Revision: 361539
URL: https://svnweb.freebsd.org/changeset/base/361539

Log:
  MF11: r361467-361468,361534
  
  This patch upgrades the ENA driver to version 2.2.0.
  
  Approved by: re (gjb)
  Sponsored by: Amazon, Inc.

Added:
  releng/11.4/sys/dev/ena/ena_datapath.c
 - copied, changed from r361468, stable/11/sys/dev/ena/ena_datapath.c
  releng/11.4/sys/dev/ena/ena_datapath.h
 - copied, changed from r361468, stable/11/sys/dev/ena/ena_datapath.h
  releng/11.4/sys/dev/ena/ena_netmap.c
 - copied, changed from r361468, stable/11/sys/dev/ena/ena_netmap.c
  releng/11.4/sys/dev/ena/ena_netmap.h
 - copied, changed from r361468, stable/11/sys/dev/ena/ena_netmap.h
Modified:
  releng/11.4/share/man/man4/ena.4
  releng/11.4/sys/contrib/ena-com/ena_com.c
  releng/11.4/sys/contrib/ena-com/ena_com.h
  releng/11.4/sys/contrib/ena-com/ena_defs/ena_admin_defs.h
  releng/11.4/sys/contrib/ena-com/ena_defs/ena_common_defs.h
  releng/11.4/sys/contrib/ena-com/ena_defs/ena_eth_io_defs.h
  releng/11.4/sys/contrib/ena-com/ena_defs/ena_gen_info.h
  releng/11.4/sys/contrib/ena-com/ena_defs/ena_regs_defs.h
  releng/11.4/sys/contrib/ena-com/ena_eth_com.c
  releng/11.4/sys/contrib/ena-com/ena_eth_com.h
  releng/11.4/sys/contrib/ena-com/ena_plat.h
  releng/11.4/sys/dev/ena/ena.c
  releng/11.4/sys/dev/ena/ena.h
  releng/11.4/sys/dev/ena/ena_sysctl.c
  releng/11.4/sys/dev/ena/ena_sysctl.h
  releng/11.4/sys/modules/ena/Makefile
Directory Properties:
  releng/11.4/   (props changed)

Modified: releng/11.4/share/man/man4/ena.4
==
--- releng/11.4/share/man/man4/ena.4Tue May 26 19:34:05 2020
(r361538)
+++ releng/11.4/share/man/man4/ena.4Tue May 26 22:41:12 2020
(r361539)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 04, 2017
+.Dd August 16, 2017
 .Dt ENA 4
 .Os
 .Sh NAME
@@ -35,7 +35,7 @@
 .Nd "FreeBSD kernel driver for Elastic Network Adapter (ENA) family"
 .Sh SYNOPSIS
 To compile this driver into the kernel,
-place the following line in your
+place the following line in the
 kernel configuration file:
 .Bd -ragged -offset indent
 .Cd "device ena"
@@ -59,8 +59,9 @@ The driver supports a range of ENA devices, is link-sp
 (i.e., the same driver is used for 10GbE, 25GbE, 40GbE, etc.), and has
 a negotiated and extendable feature set.
 .Pp
-Some ENA devices support SR-IOV. This driver is used for both the
-SR-IOV Physical Function (PF) and Virtual Function (VF) devices.
+Some ENA devices support SR-IOV.
+This driver is used for both the SR-IOV Physical Function (PF) and Virtual
+Function (VF) devices.
 .Pp
 The ENA devices enable high speed and low overhead network traffic
 processing by providing multiple Tx/Rx queue pairs (the maximum number
@@ -82,8 +83,8 @@ to recover in a manner transparent to the application,
 debug logs.
 .Pp
 Some of the ENA devices support a working mode called Low-latency
-Queue (LLQ), which saves several more microseconds. This feature will
-be implemented for driver in future releases.
+Queue (LLQ), which saves several more microseconds.
+This feature will be implemented for driver in future releases.
 .Sh HARDWARE
 Supported PCI vendor ID/device IDs:
 .Pp
@@ -105,19 +106,23 @@ Supported PCI vendor ID/device IDs:
 Error occurred during initialization of the mmio register read request.
 .It ena%d: Can not reset device
 .Pp
-Device could not be reset; device may not be responding or is already
-during reset.
+Device could not be reset.
+.br
+Device may not be responding or is already during reset.
 .It ena%d: device version is too low
 .Pp
-Version of the controller is too low and it is not supported by the driver.
+Version of the controller is too old and it is not supported by the driver.
 .It ena%d: Invalid dma width value %d
 .Pp
-The controller is able to request dma transcation width. Device stopped
-responding or it demanded invalid value.
+The controller is able to request dma transaction width.
+.br
+Device stopped responding or it demanded invalid value.
 .It ena%d: Can not initialize ena admin queue with device
 .Pp
-Initialization of the Admin Queue failed; device may not be responding or there
-was a problem with initialization of the resources.
+Initialization of the Admin Queue failed.
+.br
+Device may not be responding or there was a problem with initialization of
+the resources.
 .It ena%d: Cannot get attribute for ena device rc: %d
 .Pp
 Failed to get attributes of the device from the controller.
@@ -141,11 +146,14 @@ Errors occurred when trying to configure AENQ groups.
 .It ena%d: could not allocate irq vector: %d
 .It ena%d: Unable to allocate bus resource: registers
 .Pp
-Resource allocation failed when initializing the device; driver will not
-be attached.
+Resource allocation failed when initializing the device.
+.br
+Driver will not be attached.
 .It ena%d: ENA device init failed (err: %d)
 .Pp
-Device initialization failed; 

svn commit: r361538 - in stable: 11/stand/common 12/stand/common

2020-05-26 Thread Kyle Evans
Author: kevans
Date: Tue May 26 19:34:05 2020
New Revision: 361538
URL: https://svnweb.freebsd.org/changeset/base/361538

Log:
  loader: fix userboot's ability to detect a guest's interpreter
  
  Some time after r338418, I believe with -Os/-Oz -ffunction-sections
  -fdata-sections, the bootprog_interp variable that held our "$Interpreter:"
  marker started getting strip from all loaders, with exception to userboot
  since it used bootprog_interp to determine what flavor of userboot it was.
  
  At some point, it had been brought to my attention that this was no longer
  working and I had worked up some potential solutions to use the variable
  that involved printing it out. My vague recollection is that this was
  rejected, and I forgot to explore the alternatives; I cannot find records of
  this discussion anymore.
  
  Fast forward to present day, Andrew reported that it was non-functional and
  offered (effectively) this patch (sans comment) to stop the compiler from
  optimizing it out by assigning it to a volatile variable. This removes
  concerns about user-facing change while retaining the interpreter marker.
  Furthermore, it could certainly be uglier.

Modified:
  stable/12/stand/common/interp.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/stand/common/interp.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/stand/common/interp.c
==
--- stable/12/stand/common/interp.c Tue May 26 19:22:46 2020
(r361537)
+++ stable/12/stand/common/interp.c Tue May 26 19:34:05 2020
(r361538)
@@ -45,8 +45,17 @@ __FBSDID("$FreeBSD$");
 void
 interact(void)
 {
-   static char input[256]; /* big enough? */
+   static char input[256]; /* big enough? */
+   const char * volatile   interp_identifier;
 
+   /*
+* Because interp_identifier is volatile, it cannot be optimized out by
+* the compiler as it's considered an externally observable event.  This
+* prevents the compiler from optimizing out our carefully placed
+* $Interpreter:4th string that userboot may use to determine that
+* we need to switch interpreters.
+*/
+   interp_identifier = bootprog_interp;
interp_init();
 
printf("\n");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361538 - in stable: 11/stand/common 12/stand/common

2020-05-26 Thread Kyle Evans
Author: kevans
Date: Tue May 26 19:34:05 2020
New Revision: 361538
URL: https://svnweb.freebsd.org/changeset/base/361538

Log:
  loader: fix userboot's ability to detect a guest's interpreter
  
  Some time after r338418, I believe with -Os/-Oz -ffunction-sections
  -fdata-sections, the bootprog_interp variable that held our "$Interpreter:"
  marker started getting strip from all loaders, with exception to userboot
  since it used bootprog_interp to determine what flavor of userboot it was.
  
  At some point, it had been brought to my attention that this was no longer
  working and I had worked up some potential solutions to use the variable
  that involved printing it out. My vague recollection is that this was
  rejected, and I forgot to explore the alternatives; I cannot find records of
  this discussion anymore.
  
  Fast forward to present day, Andrew reported that it was non-functional and
  offered (effectively) this patch (sans comment) to stop the compiler from
  optimizing it out by assigning it to a volatile variable. This removes
  concerns about user-facing change while retaining the interpreter marker.
  Furthermore, it could certainly be uglier.

Modified:
  stable/11/stand/common/interp.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/stand/common/interp.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/stand/common/interp.c
==
--- stable/11/stand/common/interp.c Tue May 26 19:22:46 2020
(r361537)
+++ stable/11/stand/common/interp.c Tue May 26 19:34:05 2020
(r361538)
@@ -45,8 +45,17 @@ __FBSDID("$FreeBSD$");
 void
 interact(void)
 {
-   static char input[256]; /* big enough? */
+   static char input[256]; /* big enough? */
+   const char * volatile   interp_identifier;
 
+   /*
+* Because interp_identifier is volatile, it cannot be optimized out by
+* the compiler as it's considered an externally observable event.  This
+* prevents the compiler from optimizing out our carefully placed
+* $Interpreter:4th string that userboot may use to determine that
+* we need to switch interpreters.
+*/
+   interp_identifier = bootprog_interp;
interp_init();
 
printf("\n");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361537 - head/libexec/rtld-elf

2020-05-26 Thread Konstantin Belousov
Author: kib
Date: Tue May 26 19:22:46 2020
New Revision: 361537
URL: https://svnweb.freebsd.org/changeset/base/361537

Log:
  Add version indicators to rtld.
  
  It is wrong to relate on __FreeBSD_version, either from
  include/param.h, kernel, or libc, to check for rtld features.
  Rtld might be from newer world than the running userspace.
  
  Add special private symbols exported by rtld itself, to indicate the
  changes in runtime behavior, and features that cannot be otherwise
  detected or deduced at runtime.
  
  Note that the symbols are not exported from libc, so they intentionally
  cannot be linked against, and exported from the private namespace from rtld.
  Consumers are required to use dlsym(3).  For instance, for
  _rtld_version_laddr_offset, user should do
ptr = dlsym(RTLD_DEFAULT, "_rtld_version_laddr_offset")
  or even
ptr = dlvsym(RTLD_DEFAULT,  "_rtld_version_laddr_offset",
"FBSDprivate_1.0");
  Non-null ptr means that the change is present.
  
  Also add _rtld_version__FreeBSD_version indicator to report the
  headers version used at time of the rtld build.
  
  Reviewed by:  jhb
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D24982

Modified:
  head/libexec/rtld-elf/Symbol.map
  head/libexec/rtld-elf/rtld.1
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/Symbol.map
==
--- head/libexec/rtld-elf/Symbol.mapTue May 26 19:09:19 2020
(r361536)
+++ head/libexec/rtld-elf/Symbol.mapTue May 26 19:22:46 2020
(r361537)
@@ -32,4 +32,6 @@ FBSDprivate_1.0 {
 _rtld_get_stack_prot;
 _rtld_is_dlopened;
 _r_debug_postinit;
+_rtld_version__FreeBSD_version;
+_rtld_version_laddr_offset;
 };

Modified: head/libexec/rtld-elf/rtld.1
==
--- head/libexec/rtld-elf/rtld.1Tue May 26 19:09:19 2020
(r361536)
+++ head/libexec/rtld-elf/rtld.1Tue May 26 19:22:46 2020
(r361537)
@@ -355,6 +355,54 @@ ignores
 and is naturally prone to race conditions.
 Environments which rely on such restrictions are weak
 and breakable on their own.
+.Sh VERSIONING
+Newer
+.Nm
+might provide some features or changes in runtime behavior that cannot be
+easily detected at runtime by checking of the normal exported symbols.
+Note that it is almost always wrong to verify
+.Dv __FreeBSD_version
+in userspace to detect features, either at compile or at run time,
+because either kernel, or libc, or environment variables could not
+match the running
+.Nm .
+.Pp
+To solve the problem,
+.Nm
+exports some feature indicators in the
+.Fx
+private symbols namespace
+.Dv FBSDprivate_1.0 .
+Symbols start with the
+.Dv _rtld_version
+prefix.
+Current list of defined symbols and corresponding features is:
+.Bl -tag -width indent
+.It Dv _rtld_version__FreeBSD_version
+Symbol exports the value of the
+.Dv __FreeBSD_version
+definition as it was provided during the
+.Nm
+build.
+The symbol is always present since the
+.Dv _rtld_version
+facility was introduced.
+.It Dv _rtld_version_laddr_offset
+The
+.Va l_addr
+member of the
+.Vt link_map
+structure contains the load offset of the shared object.
+Before that,
+.Va l_addr
+contained the base address of the library.
+See
+.Xr dlinfo 3 .
+.Pp
+Also it indicates the presence of
+.Va l_refname
+member of the structure.
+.El
 .Sh FILES
 .Bl -tag -width ".Pa /var/run/ld-elf32.so.hints" -compact
 .It Pa /var/run/ld-elf.so.hints
@@ -369,6 +417,7 @@ The libmap configuration file for 32-bit binaries on 6
 .Sh SEE ALSO
 .Xr ld 1 ,
 .Xr ldd 1 ,
+.Xr dlinfo 3 ,
 .Xr capsicum 4 ,
 .Xr elf 5 ,
 .Xr libmap.conf 5 ,

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cTue May 26 19:09:19 2020
(r361536)
+++ head/libexec/rtld-elf/rtld.cTue May 26 19:22:46 2020
(r361537)
@@ -5785,3 +5785,9 @@ realloc(void *cp, size_t nbytes)
 
return (__crt_realloc(cp, nbytes));
 }
+
+extern int _rtld_version__FreeBSD_version __exported;
+int _rtld_version__FreeBSD_version = __FreeBSD_version;
+
+extern char _rtld_version_laddr_offset __exported;
+char _rtld_version_laddr_offset;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361536 - head/sys/cam/ctl

2020-05-26 Thread Alexander Motin
Author: mav
Date: Tue May 26 19:09:19 2020
New Revision: 361536
URL: https://svnweb.freebsd.org/changeset/base/361536

Log:
  Properly check kern_sg_entries for S/G list.
  
  ctl_data_print() is called in core context, so does not even know meaning
  of ext_sg_entries.
  
  MFC after:1 week
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/cam/ctl/ctl_util.c

Modified: head/sys/cam/ctl/ctl_util.c
==
--- head/sys/cam/ctl/ctl_util.c Tue May 26 19:03:45 2020(r361535)
+++ head/sys/cam/ctl/ctl_util.c Tue May 26 19:09:19 2020(r361536)
@@ -861,7 +861,7 @@ ctl_data_print(union ctl_io *io)
return;
if (io->io_hdr.flags & CTL_FLAG_BUS_ADDR)
return;
-   if (io->scsiio.ext_sg_entries > 0)  /* XXX: Implement */
+   if (io->scsiio.kern_sg_entries > 0) /* XXX: Implement */
return;
ctl_scsi_path_string(io, path_str, sizeof(path_str));
len = min(io->scsiio.kern_data_len, 4096);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r361535 - head/sys/powerpc/include

2020-05-26 Thread Brandon Bergren



On Tue, May 26, 2020, at 2:03 PM, Brandon Bergren wrote:
>   
>   Obtained from:  jhibbits

Of course I meant "Submitted By:" here.

-- 
  Brandon Bergren
  bdra...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361535 - head/sys/powerpc/include

2020-05-26 Thread Brandon Bergren
Author: bdragon
Date: Tue May 26 19:03:45 2020
New Revision: 361535
URL: https://svnweb.freebsd.org/changeset/base/361535

Log:
  [PowerPC] Fix atomic_cmpset_masked().
  
  A recent kernel change caused the previously unused atomic_cmpset_masked() to
  be used.
  
  It had a typo in it.
  
  Instead of reading the old value from an uninitialized variable, read it
  from the passed-in pointer as intended.
  
  This fixes crashes on 64 bit Book-E.
  
  Obtained from:jhibbits

Modified:
  head/sys/powerpc/include/atomic.h

Modified: head/sys/powerpc/include/atomic.h
==
--- head/sys/powerpc/include/atomic.h   Tue May 26 17:54:11 2020
(r361534)
+++ head/sys/powerpc/include/atomic.h   Tue May 26 19:03:45 2020
(r361535)
@@ -621,7 +621,7 @@ atomic_cmpset_masked(uint32_t *p, uint32_t cmpval, uin
uint32_ttmp;
 
__asm __volatile (
-   "1:\tlwarx %2, 0, %2\n\t"   /* load old value */
+   "1:\tlwarx %2, 0, %3\n\t"   /* load old value */
"and %0, %2, %7\n\t"
"cmplw %4, %0\n\t"  /* compare */
"bne- 2f\n\t"   /* exit if not equal */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361534 - in stable/11/sys: contrib/ena-com contrib/ena-com/ena_defs dev/ena

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 17:54:11 2020
New Revision: 361534
URL: https://svnweb.freebsd.org/changeset/base/361534

Log:
  MFC: Merge ENA v2.2.0 driver
  
  r361530 Update ENA driver version to v2.2.0
  r361529 Refactor ena_tx_map_mbuf() function
  r361528 Fix double-free bug within ena_detach()
  r361527 Allow disabling meta caching for ENA Tx path
  r361526 Create ENA IO queues with optional backoff
  r361525 Add sysctl node for ENA IO queues number adjustment
  r361524 Fix assumptions about number of IO queues in the ENA
  r361523 Rework ENA Tx buffer ring size reconfiguration
  r361521 Rework ENA Rx queue size configuration
  r361518 Improve indentation in ena_up() and ena_down()
  r361517 Expose argument names for non static ENA driver functions
  r361516 Use single global lock in the ENA driver
  r361515 Add trigger reset function in the ENA driver
  r361514 Provide ENA driver version in a sysctl node
  r361513 Remove unused argument from static function in ena.c
  r361512 Enable Tx drops reporting in the ENA driver
  r361511 Adjust ENA driver to the new HAL
  
  Sponsored by: Amazon, Inc.

Modified:
  stable/11/sys/contrib/ena-com/ena_com.c
  stable/11/sys/contrib/ena-com/ena_com.h
  stable/11/sys/contrib/ena-com/ena_defs/ena_admin_defs.h
  stable/11/sys/contrib/ena-com/ena_defs/ena_common_defs.h
  stable/11/sys/contrib/ena-com/ena_defs/ena_eth_io_defs.h
  stable/11/sys/contrib/ena-com/ena_defs/ena_gen_info.h
  stable/11/sys/contrib/ena-com/ena_defs/ena_regs_defs.h
  stable/11/sys/contrib/ena-com/ena_eth_com.c
  stable/11/sys/contrib/ena-com/ena_eth_com.h
  stable/11/sys/contrib/ena-com/ena_plat.h
  stable/11/sys/dev/ena/ena.c
  stable/11/sys/dev/ena/ena.h
  stable/11/sys/dev/ena/ena_datapath.c
  stable/11/sys/dev/ena/ena_datapath.h
  stable/11/sys/dev/ena/ena_netmap.c
  stable/11/sys/dev/ena/ena_netmap.h
  stable/11/sys/dev/ena/ena_sysctl.c
  stable/11/sys/dev/ena/ena_sysctl.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/contrib/ena-com/ena_com.c
==
--- stable/11/sys/contrib/ena-com/ena_com.c Tue May 26 16:44:05 2020
(r361533)
+++ stable/11/sys/contrib/ena-com/ena_com.c Tue May 26 17:54:11 2020
(r361534)
@@ -1,7 +1,7 @@
 /*-
  * BSD LICENSE
  *
- * Copyright (c) 2015-2019 Amazon.com, Inc. or its affiliates.
+ * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -70,8 +70,10 @@
 
 #define ENA_REGS_ADMIN_INTR_MASK 1
 
-#define ENA_POLL_MS5
+#define ENA_MIN_POLL_US 100
 
+#define ENA_MAX_POLL_US 5000
+
 /*/
 /*/
 /*/
@@ -99,7 +101,7 @@ struct ena_com_stats_ctx {
struct ena_admin_acq_get_stats_resp get_resp;
 };
 
-static inline int ena_com_mem_addr_set(struct ena_com_dev *ena_dev,
+static int ena_com_mem_addr_set(struct ena_com_dev *ena_dev,
   struct ena_common_mem_addr *ena_addr,
   dma_addr_t addr)
 {
@@ -200,7 +202,7 @@ static int ena_com_admin_init_aenq(struct ena_com_dev 
return 0;
 }
 
-static inline void comp_ctxt_release(struct ena_com_admin_queue *queue,
+static void comp_ctxt_release(struct ena_com_admin_queue *queue,
 struct ena_comp_ctx *comp_ctx)
 {
comp_ctx->occupied = false;
@@ -216,6 +218,11 @@ static struct ena_comp_ctx *get_comp_ctxt(struct ena_c
return NULL;
}
 
+   if (unlikely(!queue->comp_ctx)) {
+   ena_trc_err("Completion context is NULL\n");
+   return NULL;
+   }
+
if (unlikely(queue->comp_ctx[command_id].occupied && capture)) {
ena_trc_err("Completion context is occupied\n");
return NULL;
@@ -289,7 +296,7 @@ static struct ena_comp_ctx *__ena_com_submit_admin_cmd
return comp_ctx;
 }
 
-static inline int ena_com_init_comp_ctxt(struct ena_com_admin_queue *queue)
+static int ena_com_init_comp_ctxt(struct ena_com_admin_queue *queue)
 {
size_t size = queue->q_depth * sizeof(struct ena_comp_ctx);
struct ena_comp_ctx *comp_ctx;
@@ -409,6 +416,8 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_
   0x0, io_sq->llq_info.desc_list_entry_size);
io_sq->llq_buf_ctrl.descs_left_in_line =
io_sq->llq_info.descs_num_before_header;
+   io_sq->disable_meta_caching =
+   io_sq->llq_info.disable_meta_caching;
 
if (io_sq->llq_info.max_entries_in_tx_burst > 0)
io_sq->entries_in_tx_burst_left =
@@ -534,12 +543,9 @@ static int 

svn commit: r361533 - in head/sys: cddl/dev/dtrace/riscv riscv/riscv

2020-05-26 Thread Ruslan Bukin
Author: br
Date: Tue May 26 16:44:05 2020
New Revision: 361533
URL: https://svnweb.freebsd.org/changeset/base/361533

Log:
  Fix entering KDB with dtrace-enabled kernel.
  
  Reviewed by:  markj, jhb
  Differential Revision:https://reviews.freebsd.org/D24018

Modified:
  head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c
  head/sys/riscv/riscv/trap.c

Modified: head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c
==
--- head/sys/cddl/dev/dtrace/riscv/dtrace_subr.cTue May 26 16:40:40 
2020(r361532)
+++ head/sys/cddl/dev/dtrace/riscv/dtrace_subr.cTue May 26 16:44:05 
2020(r361533)
@@ -255,6 +255,8 @@ dtrace_invop_start(struct trapframe *frame)
int invop;
 
invop = dtrace_invop(frame->tf_sepc, frame, frame->tf_sepc);
+   if (invop == 0)
+   return (-1);
 
if (match_opcode(invop, (MATCH_SD | RS2_RA | RS1_SP),
(MASK_SD | RS2_MASK | RS1_MASK))) {
@@ -291,6 +293,10 @@ dtrace_invop_start(struct trapframe *frame)
frame->tf_sepc = frame->tf_ra;
return (0);
}
+
+#ifdef INVARIANTS
+   panic("Instruction %x doesn't match any opcode.", invop);
+#endif
 
return (-1);
 }

Modified: head/sys/riscv/riscv/trap.c
==
--- head/sys/riscv/riscv/trap.c Tue May 26 16:40:40 2020(r361532)
+++ head/sys/riscv/riscv/trap.c Tue May 26 16:44:05 2020(r361533)
@@ -274,10 +274,9 @@ do_trap_supervisor(struct trapframe *frame)
break;
case EXCP_BREAKPOINT:
 #ifdef KDTRACE_HOOKS
-   if (dtrace_invop_jump_addr != 0) {
-   dtrace_invop_jump_addr(frame);
-   break;
-   }
+   if (dtrace_invop_jump_addr != NULL &&
+   dtrace_invop_jump_addr(frame) == 0)
+   break;
 #endif
 #ifdef KDB
kdb_trap(exception, 0, frame);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361532 - in head/sys: dev/acpica dev/pci x86/iommu

2020-05-26 Thread Ruslan Bukin
Author: br
Date: Tue May 26 16:40:40 2020
New Revision: 361532
URL: https://svnweb.freebsd.org/changeset/base/361532

Log:
  Rename dmar_get_dma_tag() to acpi_iommu_get_dma_tag().
  This is needed for a new IOMMU controller support.
  
  Reviewed by:  kib
  Differential Revision:https://reviews.freebsd.org/D24943

Modified:
  head/sys/dev/acpica/acpi_pci.c
  head/sys/dev/pci/pci.c
  head/sys/x86/iommu/busdma_dmar.c
  head/sys/x86/iommu/busdma_dmar.h

Modified: head/sys/dev/acpica/acpi_pci.c
==
--- head/sys/dev/acpica/acpi_pci.c  Tue May 26 16:14:21 2020
(r361531)
+++ head/sys/dev/acpica/acpi_pci.c  Tue May 26 16:40:40 2020
(r361532)
@@ -456,15 +456,15 @@ acpi_pci_detach(device_t dev)
 }
 
 #ifdef ACPI_DMAR
-bus_dma_tag_t dmar_get_dma_tag(device_t dev, device_t child);
+bus_dma_tag_t acpi_iommu_get_dma_tag(device_t dev, device_t child);
 static bus_dma_tag_t
 acpi_pci_get_dma_tag(device_t bus, device_t child)
 {
bus_dma_tag_t tag;
 
if (device_get_parent(child) == bus) {
-   /* try dmar and return if it works */
-   tag = dmar_get_dma_tag(bus, child);
+   /* try iommu and return if it works */
+   tag = acpi_iommu_get_dma_tag(bus, child);
} else
tag = NULL;
if (tag == NULL)

Modified: head/sys/dev/pci/pci.c
==
--- head/sys/dev/pci/pci.c  Tue May 26 16:14:21 2020(r361531)
+++ head/sys/dev/pci/pci.c  Tue May 26 16:40:40 2020(r361532)
@@ -5682,7 +5682,7 @@ pci_get_resource_list (device_t dev, device_t child)
 }
 
 #ifdef ACPI_DMAR
-bus_dma_tag_t dmar_get_dma_tag(device_t dev, device_t child);
+bus_dma_tag_t acpi_iommu_get_dma_tag(device_t dev, device_t child);
 bus_dma_tag_t
 pci_get_dma_tag(device_t bus, device_t dev)
 {
@@ -5690,8 +5690,8 @@ pci_get_dma_tag(device_t bus, device_t dev)
struct pci_softc *sc;
 
if (device_get_parent(dev) == bus) {
-   /* try dmar and return if it works */
-   tag = dmar_get_dma_tag(bus, dev);
+   /* try iommu and return if it works */
+   tag = acpi_iommu_get_dma_tag(bus, dev);
} else
tag = NULL;
if (tag == NULL) {

Modified: head/sys/x86/iommu/busdma_dmar.c
==
--- head/sys/x86/iommu/busdma_dmar.cTue May 26 16:14:21 2020
(r361531)
+++ head/sys/x86/iommu/busdma_dmar.cTue May 26 16:40:40 2020
(r361532)
@@ -269,7 +269,7 @@ dmar_instantiate_ctx(struct dmar_unit *dmar, device_t 
 }
 
 bus_dma_tag_t
-dmar_get_dma_tag(device_t dev, device_t child)
+acpi_iommu_get_dma_tag(device_t dev, device_t child)
 {
struct dmar_unit *dmar;
struct dmar_ctx *ctx;

Modified: head/sys/x86/iommu/busdma_dmar.h
==
--- head/sys/x86/iommu/busdma_dmar.hTue May 26 16:14:21 2020
(r361531)
+++ head/sys/x86/iommu/busdma_dmar.hTue May 26 16:40:40 2020
(r361532)
@@ -62,6 +62,6 @@ struct bus_dmamap_dmar {
 
 extern struct bus_dma_impl bus_dma_dmar_impl;
 
-bus_dma_tag_t dmar_get_dma_tag(device_t dev, device_t child);
+bus_dma_tag_t acpi_iommu_get_dma_tag(device_t dev, device_t child);
 
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361531 - in releng/11.4/lib/clang/include: clang/Config llvm/Config

2020-05-26 Thread Dimitry Andric
Author: dim
Date: Tue May 26 16:14:21 2020
New Revision: 361531
URL: https://svnweb.freebsd.org/changeset/base/361531

Log:
  MF11 r361465:
  
  Regenerate llvm config headers to correctly enable zlib support
  
  During the initial upgrade to 10.0.0 in r357120, I generated these
  headers once, but they were missing zlib-related settings at that time.
  These should have been regenerated again during the merge of the final
  10.0.0 release.
  
  Direct commit to stable/{11,12}, since head has gotten 10.0.1 in the
  mean time, with up-to-date generated headers.
  
  Approved by:  re (gjb)
  Reported by:  hyam...@gmail.com
  PR:   246244

Modified:
  releng/11.4/lib/clang/include/clang/Config/config.h
  releng/11.4/lib/clang/include/llvm/Config/config.h
  releng/11.4/lib/clang/include/llvm/Config/llvm-config.h
Directory Properties:
  releng/11.4/   (props changed)

Modified: releng/11.4/lib/clang/include/clang/Config/config.h
==
--- releng/11.4/lib/clang/include/clang/Config/config.h Tue May 26 16:11:46 
2020(r361530)
+++ releng/11.4/lib/clang/include/clang/Config/config.h Tue May 26 16:14:21 
2020(r361531)
@@ -62,7 +62,7 @@
 #define CLANG_HAVE_RLIMITS 1
 
 /* The LLVM product name and version */
-#define BACKEND_PACKAGE_STRING "LLVM 10.0.0git"
+#define BACKEND_PACKAGE_STRING "LLVM 10.0.0"
 
 /* Linker version detected at compile time. */
 /* #undef HOST_LINK_VERSION */

Modified: releng/11.4/lib/clang/include/llvm/Config/config.h
==
--- releng/11.4/lib/clang/include/llvm/Config/config.h  Tue May 26 16:11:46 
2020(r361530)
+++ releng/11.4/lib/clang/include/llvm/Config/config.h  Tue May 26 16:14:21 
2020(r361531)
@@ -110,6 +110,9 @@
 /* Define to 1 if you have the `pthread_setname_np' function. */
 /* #undef HAVE_PTHREAD_SETNAME_NP */
 
+/* Define to 1 if you have the `z' library (-lz). */
+#define HAVE_LIBZ 1
+
 /* Define to 1 if you have the  header file. */
 #define HAVE_LINK_H 1
 
@@ -224,6 +227,9 @@
 /* Define to 1 if you have the  header file. */
 /* #undef HAVE_VALGRIND_VALGRIND_H */
 
+/* Define to 1 if you have the  header file. */
+#define HAVE_ZLIB_H 1
+
 /* Have host's _alloca */
 /* #undef HAVE__ALLOCA */
 
@@ -316,10 +322,10 @@
 #define PACKAGE_NAME "LLVM"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "LLVM 10.0.0git"
+#define PACKAGE_STRING "LLVM 10.0.0"
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "10.0.0git"
+#define PACKAGE_VERSION "10.0.0"
 
 /* Define to the vendor of this package. */
 /* #undef PACKAGE_VENDOR */

Modified: releng/11.4/lib/clang/include/llvm/Config/llvm-config.h
==
--- releng/11.4/lib/clang/include/llvm/Config/llvm-config.h Tue May 26 
16:11:46 2020(r361530)
+++ releng/11.4/lib/clang/include/llvm/Config/llvm-config.h Tue May 26 
16:14:21 2020(r361531)
@@ -73,7 +73,7 @@
 #define LLVM_VERSION_PATCH 0
 
 /* LLVM version string */
-#define LLVM_VERSION_STRING "10.0.0git"
+#define LLVM_VERSION_STRING "10.0.0"
 
 /* Whether LLVM records statistics for use with GetStatistics(),
  * PrintStatistics() or PrintStatisticsJSON()
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361530 - head/sys/dev/ena

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 16:11:46 2020
New Revision: 361530
URL: https://svnweb.freebsd.org/changeset/base/361530

Log:
  Update ENA driver version to v2.2.0
  
  Driver version upgrade is connected with support for the new device
  fetures, like Tx drops reporting or disabling meta caching.
  
  Moreover, the driver configuration from the sysctl was reworked to
  provide safer and better flow for configuring:
  * number of IO queues (new feature),
  * drbr size on Tx,
  * Rx queue size.
  
  Moreover, a lot of minor bug fixes and improvements were added.
  
  Copyright date in the license of the modified files in this release was
  updated to 2020.
  
  Submitted by: Michal Krawczyk 
  Obtained from: Semihalf
  Sponsored by: Amazon, Inc.

Modified:
  head/sys/dev/ena/ena.c
  head/sys/dev/ena/ena.h
  head/sys/dev/ena/ena_datapath.c
  head/sys/dev/ena/ena_datapath.h
  head/sys/dev/ena/ena_netmap.c
  head/sys/dev/ena/ena_netmap.h
  head/sys/dev/ena/ena_sysctl.c
  head/sys/dev/ena/ena_sysctl.h

Modified: head/sys/dev/ena/ena.c
==
--- head/sys/dev/ena/ena.c  Tue May 26 16:05:42 2020(r361529)
+++ head/sys/dev/ena/ena.c  Tue May 26 16:11:46 2020(r361530)
@@ -1,7 +1,7 @@
 /*-
  * BSD LICENSE
  *
- * Copyright (c) 2015-2019 Amazon.com, Inc. or its affiliates.
+ * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/ena/ena.h
==
--- head/sys/dev/ena/ena.h  Tue May 26 16:05:42 2020(r361529)
+++ head/sys/dev/ena/ena.h  Tue May 26 16:11:46 2020(r361530)
@@ -1,7 +1,7 @@
 /*-
  * BSD LICENSE
  *
- * Copyright (c) 2015-2019 Amazon.com, Inc. or its affiliates.
+ * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -40,8 +40,8 @@
 #include "ena-com/ena_eth_com.h"
 
 #define DRV_MODULE_VER_MAJOR   2
-#define DRV_MODULE_VER_MINOR   1
-#define DRV_MODULE_VER_SUBMINOR 2
+#define DRV_MODULE_VER_MINOR   2
+#define DRV_MODULE_VER_SUBMINOR 0
 
 #define DRV_MODULE_NAME"ena"
 

Modified: head/sys/dev/ena/ena_datapath.c
==
--- head/sys/dev/ena/ena_datapath.c Tue May 26 16:05:42 2020
(r361529)
+++ head/sys/dev/ena/ena_datapath.c Tue May 26 16:11:46 2020
(r361530)
@@ -1,7 +1,7 @@
 /*-
  * BSD LICENSE
  *
- * Copyright (c) 2015-2019 Amazon.com, Inc. or its affiliates.
+ * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/ena/ena_datapath.h
==
--- head/sys/dev/ena/ena_datapath.h Tue May 26 16:05:42 2020
(r361529)
+++ head/sys/dev/ena/ena_datapath.h Tue May 26 16:11:46 2020
(r361530)
@@ -1,7 +1,7 @@
 /*-
  * BSD LICENSE
  *
- * Copyright (c) 2015-2019 Amazon.com, Inc. or its affiliates.
+ * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/ena/ena_netmap.c
==
--- head/sys/dev/ena/ena_netmap.c   Tue May 26 16:05:42 2020
(r361529)
+++ head/sys/dev/ena/ena_netmap.c   Tue May 26 16:11:46 2020
(r361530)
@@ -1,7 +1,7 @@
 /*-
  * BSD LICENSE
  *
- * Copyright (c) 2015-2019 Amazon.com, Inc. or its affiliates.
+ * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/ena/ena_netmap.h
==
--- head/sys/dev/ena/ena_netmap.h   Tue May 26 16:05:42 2020
(r361529)
+++ head/sys/dev/ena/ena_netmap.h   Tue May 26 16:11:46 2020
(r361530)
@@ -1,7 +1,7 @@
 /*-
  * BSD LICENSE
  *
- * Copyright (c) 2015-2019 Amazon.com, Inc. or its affiliates.
+ * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/ena/ena_sysctl.c
==
--- head/sys/dev/ena/ena_sysctl.c   Tue May 26 16:05:42 2020
(r361529)
+++ head/sys/dev/ena/ena_sysctl.c   Tue May 26 16:11:46 2020
(r361530)
@@ -1,7 +1,7 @@
 /*-
  * BSD LICENSE
  *
- * Copyright (c) 2015-2019 Amazon.com, Inc. or its affiliates.
+ * Copyright (c) 2015-2020 

svn commit: r361529 - head/sys/dev/ena

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 16:05:42 2020
New Revision: 361529
URL: https://svnweb.freebsd.org/changeset/base/361529

Log:
  Refactor ena_tx_map_mbuf() function
  
  There is no guarantee from bus_dmamap_load_mbuf_sg() for matching
  mbuf chain segments to dma physical segments.
  
  This patch ensure correctly mapping to LLQ header and DMA segments.
  
  Submitted by: Ido Segev 
  Obtained from: Amazon, Inc.

Modified:
  head/sys/dev/ena/ena_datapath.c

Modified: head/sys/dev/ena/ena_datapath.c
==
--- head/sys/dev/ena/ena_datapath.c Tue May 26 16:02:10 2020
(r361528)
+++ head/sys/dev/ena/ena_datapath.c Tue May 26 16:05:42 2020
(r361529)
@@ -812,9 +812,8 @@ ena_tx_map_mbuf(struct ena_ring *tx_ring, struct ena_t
struct ena_com_buf *ena_buf;
bus_dma_segment_t segs[ENA_BUS_DMA_SEGS];
size_t iseg = 0;
-   uint32_t mbuf_head_len, frag_len;
-   uint16_t push_len = 0;
-   uint16_t delta = 0;
+   uint32_t mbuf_head_len;
+   uint16_t offset;
int rc, nsegs;
 
mbuf_head_len = mbuf->m_len;
@@ -833,7 +832,6 @@ ena_tx_map_mbuf(struct ena_ring *tx_ring, struct ena_t
goto dma_error;
}
 
-
if (tx_ring->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) {
/*
 * When the device is LLQ mode, the driver will copy
@@ -845,44 +843,48 @@ ena_tx_map_mbuf(struct ena_ring *tx_ring, struct ena_t
 * First check if header fits in the mbuf. If not, copy it to
 * separate buffer that will be holding linearized data.
 */
-   push_len = min_t(uint32_t, mbuf->m_pkthdr.len,
-   tx_ring->tx_max_header_size);
-   *header_len = push_len;
+   *header_len = min_t(uint32_t, mbuf->m_pkthdr.len, 
tx_ring->tx_max_header_size);
+
/* If header is in linear space, just point into mbuf's data. */
-   if (likely(push_len <= mbuf_head_len)) {
+   if (likely(*header_len <= mbuf_head_len)) {
*push_hdr = mbuf->m_data;
/*
 * Otherwise, copy whole portion of header from multiple mbufs
 * to intermediate buffer.
 */
} else {
-   m_copydata(mbuf, 0, push_len,
-   tx_ring->push_buf_intermediate_buf);
+   m_copydata(mbuf, 0, *header_len, 
tx_ring->push_buf_intermediate_buf);
*push_hdr = tx_ring->push_buf_intermediate_buf;
 
counter_u64_add(tx_ring->tx_stats.llq_buffer_copy, 1);
-   delta = push_len - mbuf_head_len;
}
 
ena_trace(ENA_DBG | ENA_TXPTH,
"mbuf: %p header_buf->vaddr: %p push_len: %d\n",
-   mbuf, *push_hdr, push_len);
+   mbuf, *push_hdr, *header_len);
 
-   /*
-   * If header was in linear memory space, map for the dma rest of 
the data
-   * in the first mbuf of the mbuf chain.
-   */
-   if (mbuf_head_len > push_len) {
-   ena_buf->paddr = segs[iseg].ds_addr + push_len;
-   ena_buf->len = segs[iseg].ds_len - push_len;
-   ena_buf++;
-   tx_info->num_of_bufs++;
+   /* If packet is fitted in LLQ header, no need for DMA segments. 
*/
+   if (mbuf->m_pkthdr.len <= tx_ring->tx_max_header_size) {
+   return (0);
+   } else {
+   offset = tx_ring->tx_max_header_size;
+   /*
+* As Header part is mapped to LLQ header, we can skip 
it and just
+* map the residuum of the mbuf to DMA Segments.
+*/
+   while (offset > 0) {
+   if (offset >= segs[iseg].ds_len) {
+   offset -= segs[iseg].ds_len;
+   } else {
+   ena_buf->paddr = segs[iseg].ds_addr + 
offset;
+   ena_buf->len = segs[iseg].ds_len - 
offset;
+   ena_buf++;
+   tx_info->num_of_bufs++;
+   offset = 0;
+   }
+   iseg++;
+   }
}
-   /*
-* Advance the seg index as either the 1st mbuf was mapped or is
-* a part of push_hdr.
-*/
-   iseg++;
} else {
*push_hdr = NULL;
/*
@@ -893,41 +895,6 @@ ena_tx_map_mbuf(struct ena_ring *tx_ring, struct ena_t
   

svn commit: r361528 - head/sys/dev/ena

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 16:02:10 2020
New Revision: 361528
URL: https://svnweb.freebsd.org/changeset/base/361528

Log:
  Fix double-free bug within ena_detach()
  
  There is ena_free_all_io_rings_resources() called twice on device
  detach:
  
  ena_detach():
  
  ena_destroy_device():
  /* First call */
  ena_free_all_io_rings_resources()
  
  /* Second call */
  ena_free_all_io_rings_resources()
  
  The double-free causes panic() on kldunload, for example.
  
  As the ena_destroy_device() is also called by ena_reset_task() it is
  better to stay unchanged. Thus, remove the "Second call" of the function.
  
  Submitted by:  Maciej Bielski 
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/dev/ena/ena.c

Modified: head/sys/dev/ena/ena.c
==
--- head/sys/dev/ena/ena.c  Tue May 26 16:00:30 2020(r361527)
+++ head/sys/dev/ena/ena.c  Tue May 26 16:02:10 2020(r361528)
@@ -3695,8 +3695,6 @@ ena_detach(device_t pdev)
netmap_detach(adapter->ifp);
 #endif /* DEV_NETMAP */
 
-   ena_free_all_io_rings_resources(adapter);
-
ena_free_counters((counter_u64_t *)>hw_stats,
sizeof(struct ena_hw_stats));
ena_free_counters((counter_u64_t *)>dev_stats,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361527 - head/sys/dev/ena

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 16:00:30 2020
New Revision: 361527
URL: https://svnweb.freebsd.org/changeset/base/361527

Log:
  Allow disabling meta caching for ENA Tx path
  
  Determined by a flag passed from the device. No metadata is set within
  ena_tx_csum when caching is disabled.
  
  Submitted by:  Maciej Bielski 
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/dev/ena/ena.c
  head/sys/dev/ena/ena.h
  head/sys/dev/ena/ena_datapath.c

Modified: head/sys/dev/ena/ena.c
==
--- head/sys/dev/ena/ena.c  Tue May 26 15:58:48 2020(r361526)
+++ head/sys/dev/ena/ena.c  Tue May 26 16:00:30 2020(r361527)
@@ -3519,6 +3519,11 @@ ena_attach(device_t pdev)
goto err_com_free;
}
 
+   if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV)
+   adapter->disable_meta_caching =
+   !!(get_feat_ctx.llq.accel_mode.u.get.supported_flags &
+   BIT(ENA_ADMIN_DISABLE_META_CACHING));
+
adapter->keep_alive_timestamp = getsbinuptime();
 
adapter->tx_offload_cap = get_feat_ctx.offload.tx;

Modified: head/sys/dev/ena/ena.h
==
--- head/sys/dev/ena/ena.h  Tue May 26 15:58:48 2020(r361526)
+++ head/sys/dev/ena/ena.h  Tue May 26 16:00:30 2020(r361527)
@@ -461,6 +461,7 @@ struct ena_adapter {
sbintime_t missing_tx_timeout;
uint32_t missing_tx_max_queues;
uint32_t missing_tx_threshold;
+   bool disable_meta_caching;
 
/* Statistics */
struct ena_stats_dev dev_stats;

Modified: head/sys/dev/ena/ena_datapath.c
==
--- head/sys/dev/ena/ena_datapath.c Tue May 26 15:58:48 2020
(r361526)
+++ head/sys/dev/ena/ena_datapath.c Tue May 26 16:00:30 2020
(r361527)
@@ -49,7 +49,7 @@ static struct mbuf* ena_rx_mbuf(struct ena_ring *, str
 struct ena_com_rx_ctx *, uint16_t *);
 static inline void ena_rx_checksum(struct ena_ring *, struct ena_com_rx_ctx *,
 struct mbuf *);
-static voidena_tx_csum(struct ena_com_tx_ctx *, struct mbuf *);
+static voidena_tx_csum(struct ena_com_tx_ctx *, struct mbuf *, bool);
 static int ena_check_and_collapse_mbuf(struct ena_ring *tx_ring,
 struct mbuf **mbuf);
 static int ena_xmit_mbuf(struct ena_ring *, struct mbuf **);
@@ -675,7 +675,8 @@ error:
 }
 
 static void
-ena_tx_csum(struct ena_com_tx_ctx *ena_tx_ctx, struct mbuf *mbuf)
+ena_tx_csum(struct ena_com_tx_ctx *ena_tx_ctx, struct mbuf *mbuf,
+bool disable_meta_caching)
 {
struct ena_com_tx_meta *ena_meta;
struct ether_vlan_header *eh;
@@ -703,7 +704,12 @@ ena_tx_csum(struct ena_com_tx_ctx *ena_tx_ctx, struct 
offload = true;
 
if (!offload) {
-   ena_tx_ctx->meta_valid = 0;
+   if (disable_meta_caching) {
+   memset(ena_meta, 0, sizeof(*ena_meta));
+   ena_tx_ctx->meta_valid = 1;
+   } else {
+   ena_tx_ctx->meta_valid = 0;
+   }
return;
}
 
@@ -989,7 +995,7 @@ ena_xmit_mbuf(struct ena_ring *tx_ring, struct mbuf **
ena_tx_ctx.header_len = header_len;
 
/* Set flags and meta data */
-   ena_tx_csum(_tx_ctx, *mbuf);
+   ena_tx_csum(_tx_ctx, *mbuf, adapter->disable_meta_caching);
 
if (tx_ring->acum_pkts == DB_THRESHOLD ||
ena_com_is_doorbell_needed(tx_ring->ena_com_io_sq, _tx_ctx)) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361526 - head/sys/dev/ena

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 15:58:48 2020
New Revision: 361526
URL: https://svnweb.freebsd.org/changeset/base/361526

Log:
  Create ENA IO queues with optional backoff
  
  If requested size of IO queues is not supported try to decrease it until
  finding the highest value that can be satisfied.
  
  Submitted by:  Maciej Bielski 
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/dev/ena/ena.c
  head/sys/dev/ena/ena.h
  head/sys/dev/ena/ena_netmap.c
  head/sys/dev/ena/ena_sysctl.c

Modified: head/sys/dev/ena/ena.c
==
--- head/sys/dev/ena/ena.c  Tue May 26 15:57:02 2020(r361525)
+++ head/sys/dev/ena/ena.c  Tue May 26 15:58:48 2020(r361526)
@@ -408,13 +408,9 @@ ena_init_io_rings_basic(struct ena_adapter *adapter)
ena_init_io_rings_common(adapter, rxr, i);
 
/* TX specific ring state */
-   txr->ring_size = adapter->tx_ring_size;
txr->tx_max_header_size = ena_dev->tx_max_header_size;
txr->tx_mem_queue_type = ena_dev->tx_mem_queue_type;
 
-   /* RX specific ring state */
-   rxr->ring_size = adapter->rx_ring_size;
-
que = >que[i];
que->adapter = adapter;
que->id = i;
@@ -1193,10 +1189,10 @@ ena_update_queue_size(struct ena_adapter *adapter, uin
 
ENA_LOCK_LOCK(adapter);
 
-   old_tx_size = adapter->tx_ring_size;
-   old_rx_size = adapter->rx_ring_size;
-   adapter->tx_ring_size = new_tx_size;
-   adapter->rx_ring_size = new_rx_size;
+   old_tx_size = adapter->requested_tx_ring_size;
+   old_rx_size = adapter->requested_rx_ring_size;
+   adapter->requested_tx_ring_size = new_tx_size;
+   adapter->requested_rx_ring_size = new_rx_size;
 
dev_was_up = ENA_FLAG_ISSET(ENA_FLAG_DEV_UP, adapter);
ena_down(adapter);
@@ -1211,8 +1207,8 @@ ena_update_queue_size(struct ena_adapter *adapter, uin
new_tx_size, new_rx_size, old_tx_size, old_rx_size);
 
/* Revert old size. */
-   adapter->tx_ring_size = old_tx_size;
-   adapter->rx_ring_size = old_rx_size;
+   adapter->requested_tx_ring_size = old_tx_size;
+   adapter->requested_rx_ring_size = old_rx_size;
ena_init_io_rings_basic(adapter);
 
/* And try again. */
@@ -1455,7 +1451,7 @@ ena_create_io_queues(struct ena_adapter *adapter)
ena_qid = ENA_IO_TXQ_IDX(i);
ctx.mem_queue_type = ena_dev->tx_mem_queue_type;
ctx.direction = ENA_COM_IO_QUEUE_DIRECTION_TX;
-   ctx.queue_size = adapter->tx_ring_size;
+   ctx.queue_size = adapter->requested_tx_ring_size;
ctx.msix_vector = msix_vector;
ctx.qid = ena_qid;
rc = ena_com_create_io_queue(ena_dev, );
@@ -1483,7 +1479,7 @@ ena_create_io_queues(struct ena_adapter *adapter)
ena_qid = ENA_IO_RXQ_IDX(i);
ctx.mem_queue_type = ENA_ADMIN_PLACEMENT_POLICY_HOST;
ctx.direction = ENA_COM_IO_QUEUE_DIRECTION_RX;
-   ctx.queue_size = adapter->rx_ring_size;
+   ctx.queue_size = adapter->requested_rx_ring_size;
ctx.msix_vector = msix_vector;
ctx.qid = ena_qid;
rc = ena_com_create_io_queue(ena_dev, );
@@ -1975,6 +1971,104 @@ ena_up_complete(struct ena_adapter *adapter)
return (0);
 }
 
+static void
+set_io_rings_size(struct ena_adapter *adapter, int new_tx_size,
+int new_rx_size)
+{
+   int i;
+
+   for (i = 0; i < adapter->num_io_queues; i++) {
+   adapter->tx_ring[i].ring_size = new_tx_size;
+   adapter->rx_ring[i].ring_size = new_rx_size;
+   }
+}
+
+static int
+create_queues_with_size_backoff(struct ena_adapter *adapter)
+{
+   int rc;
+   uint32_t cur_rx_ring_size, cur_tx_ring_size;
+   uint32_t new_rx_ring_size, new_tx_ring_size;
+
+   /*
+* Current queue sizes might be set to smaller than the requested
+* ones due to past queue allocation failures.
+*/
+   set_io_rings_size(adapter, adapter->requested_tx_ring_size,
+   adapter->requested_rx_ring_size);
+
+   while (1) {
+   /* Allocate transmit descriptors */
+   rc = ena_setup_all_tx_resources(adapter);
+   if (unlikely(rc != 0)) {
+   ena_trace(ENA_ALERT, "err_setup_tx\n");
+   goto err_setup_tx;
+   }
+
+   /* Allocate receive descriptors */
+   rc = ena_setup_all_rx_resources(adapter);
+   if (unlikely(rc != 0)) {
+   ena_trace(ENA_ALERT, "err_setup_rx\n");
+   goto err_setup_rx;
+

svn commit: r361525 - head/sys/dev/ena

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 15:57:02 2020
New Revision: 361525
URL: https://svnweb.freebsd.org/changeset/base/361525

Log:
  Add sysctl node for ENA IO queues number adjustment
  
  By default, in ena_attach() the driver attempts to acquire
  ena_adapter::max_num_io_queues MSI-X vectors for the purpose of IO
  queues, however this is not guaranteed. The number of vectors acquired
  depends also on system resources availability.
  
  Regardless of that, enable the number of effectively used IO queues to
  be further limited through the sysctl node.
  
  Example: Assumming that there are 8 IO queues configured by default, the
  command
  
  $ sysctl dev.ena.0.io_queues_nb=4
  
  will reduce the number of available IO queues to 4. Similarly, the value
  can be also increased up to maximum supported value. A value higher than
  maximum supported number of IO queues is ignored. Zero is ignored too.
  
  Submitted by:  Maciej Bielski 
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/dev/ena/ena.c
  head/sys/dev/ena/ena.h
  head/sys/dev/ena/ena_sysctl.c

Modified: head/sys/dev/ena/ena.c
==
--- head/sys/dev/ena/ena.c  Tue May 26 15:54:32 2020(r361524)
+++ head/sys/dev/ena/ena.c  Tue May 26 15:57:02 2020(r361525)
@@ -1239,6 +1239,61 @@ ena_update_queue_size(struct ena_adapter *adapter, uin
 }
 
 static void
+ena_update_io_rings(struct ena_adapter *adapter, uint32_t num)
+{
+   ena_free_all_io_rings_resources(adapter);
+   /* Force indirection table to be reinitialized */
+   ena_com_rss_destroy(adapter->ena_dev);
+
+   adapter->num_io_queues = num;
+   ena_init_io_rings(adapter);
+}
+
+/* Caller should sanitize new_num */
+int
+ena_update_io_queue_nb(struct ena_adapter *adapter, uint32_t new_num)
+{
+   uint32_t old_num;
+   int rc = 0;
+   bool dev_was_up;
+
+   ENA_LOCK_LOCK(adapter);
+
+   dev_was_up = ENA_FLAG_ISSET(ENA_FLAG_DEV_UP, adapter);
+   old_num = adapter->num_io_queues;
+   ena_down(adapter);
+
+   ena_update_io_rings(adapter, new_num);
+
+   if (dev_was_up) {
+   rc = ena_up(adapter);
+   if (unlikely(rc != 0)) {
+   device_printf(adapter->pdev,
+   "Failed to configure device with %u IO queues. "
+   "Reverting to previous value: %u\n",
+   new_num, old_num);
+
+   ena_update_io_rings(adapter, old_num);
+
+   rc = ena_up(adapter);
+   if (unlikely(rc != 0)) {
+   device_printf(adapter->pdev,
+   "Failed to revert to previous setup IO "
+   "queues. Triggering device reset.\n");
+   ENA_FLAG_SET_ATOMIC(
+   ENA_FLAG_DEV_UP_BEFORE_RESET, adapter);
+   ena_trigger_reset(adapter,
+   ENA_REGS_RESET_OS_TRIGGER);
+   }
+   }
+   }
+
+   ENA_LOCK_UNLOCK(adapter);
+
+   return (rc);
+}
+
+static void
 ena_free_rx_bufs(struct ena_adapter *adapter, unsigned int qid)
 {
struct ena_ring *rx_ring = >rx_ring[qid];
@@ -1865,6 +1920,18 @@ ena_rss_configure(struct ena_adapter *adapter)
struct ena_com_dev *ena_dev = adapter->ena_dev;
int rc;
 
+   /* In case the RSS table was destroyed */
+   if (!ena_dev->rss.tbl_log_size) {
+   rc = ena_rss_init_default(adapter);
+   if (unlikely((rc != 0) && (rc != EOPNOTSUPP))) {
+   device_printf(adapter->pdev,
+   "WARNING: RSS was not properly re-initialized,"
+   " it will affect bandwidth\n");
+   ENA_FLAG_CLEAR_ATOMIC(ENA_FLAG_RSS_ACTIVE, adapter);
+   return (rc);
+   }
+   }
+
/* Set indirect table */
rc = ena_com_indirect_table_set(ena_dev);
if (unlikely((rc != 0) && (rc != EOPNOTSUPP)))
@@ -1890,8 +1957,11 @@ ena_up_complete(struct ena_adapter *adapter)
 
if (likely(ENA_FLAG_ISSET(ENA_FLAG_RSS_ACTIVE, adapter))) {
rc = ena_rss_configure(adapter);
-   if (rc != 0)
+   if (rc != 0) {
+   device_printf(adapter->pdev,
+   "Failed to configure RSS\n");
return (rc);
+   }
}
 
rc = ena_change_mtu(adapter->ifp, adapter->ifp->if_mtu);

Modified: head/sys/dev/ena/ena.h
==
--- head/sys/dev/ena/ena.h  Tue May 26 15:54:32 2020(r361524)
+++ head/sys/dev/ena/ena.h  Tue May 26 15:57:02 2020(r361525)
@@ -501,6 +501,7 @@ int 

svn commit: r361524 - head/sys/dev/ena

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 15:54:32 2020
New Revision: 361524
URL: https://svnweb.freebsd.org/changeset/base/361524

Log:
  Fix assumptions about number of IO queues in the ENA
  
  Make the ena_adapter::num_io_queues a number of effectively used IO
  queues. While the ena_adapter::max_num_io_queues is an upper-bound
  specified by the HW, the ena_adapter::num_io_queues may be lower than
  that, depending on runtime system resources availability.
  
  On reset, there are called ena_destroy_device() and then
  ena_restore_device(). The latter calls, in turn, ena_enable_msix(),
  which will attempt to re-acquire ena_adapter::max_num_io_queues of
  MSIX vectors again.
  
  Thus, the value of ena_adapter::num_io_queues may be different before
  and after reset. For this reason, free the IO rings structures (drbr,
  counters) in ena_destroy_device() and allocate again in
  ena_restore_device().
  
  Submitted by:  Maciej Bielski 
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/dev/ena/ena.c

Modified: head/sys/dev/ena/ena.c
==
--- head/sys/dev/ena/ena.c  Tue May 26 15:50:30 2020(r361523)
+++ head/sys/dev/ena/ena.c  Tue May 26 15:54:32 2020(r361524)
@@ -1562,7 +1562,6 @@ ena_enable_msix(struct ena_adapter *adapter)
}
device_printf(dev, "Enable only %d MSI-x (out of %d), reduce "
"the number of queues\n", msix_vecs, msix_req);
-   adapter->num_io_queues = msix_vecs - ENA_ADMIN_MSIX_VEC;
}
 
adapter->msix_vecs = msix_vecs;
@@ -3116,6 +3115,15 @@ ena_destroy_device(struct ena_adapter *adapter, bool g
 
ena_disable_msix(adapter);
 
+   /*
+* IO rings resources should be freed because `ena_restore_device()`
+* calls (not directly) `ena_enable_msix()`, which re-allocates MSIX
+* vectors. The amount of MSIX vectors after destroy-restore may be
+* different than before. Therefore, IO rings resources should be
+* established from scratch each time.
+*/
+   ena_free_all_io_rings_resources(adapter);
+
ena_com_abort_admin_commands(ena_dev);
 
ena_com_wait_for_abort_completion(ena_dev);
@@ -3192,6 +3200,18 @@ ena_restore_device(struct ena_adapter *adapter)
goto err_device_destroy;
}
 
+   /*
+* Effective value of used MSIX vectors should be the same as before
+* `ena_destroy_device()`, if possible, or closest to it if less vectors
+* are available.
+*/
+   if ((adapter->msix_vecs - ENA_ADMIN_MSIX_VEC) < adapter->num_io_queues)
+   adapter->num_io_queues =
+   adapter->msix_vecs - ENA_ADMIN_MSIX_VEC;
+
+   /* Re-initialize rings basic information */
+   ena_init_io_rings(adapter);
+
/* If the interface was up before the reset bring it up */
if (ENA_FLAG_ISSET(ENA_FLAG_DEV_UP_BEFORE_RESET, adapter)) {
rc = ena_up(adapter);
@@ -3379,7 +3399,6 @@ ena_attach(device_t pdev)
adapter->max_rx_sgl_size = calc_queue_ctx.max_rx_sgl_size;
 
adapter->max_num_io_queues = max_num_io_queues;
-   adapter->num_io_queues = max_num_io_queues;
 
adapter->buf_ring_size = ENA_DEFAULT_BUF_RING_SIZE;
 
@@ -3400,15 +3419,26 @@ ena_attach(device_t pdev)
goto err_tx_tag_free;
}
 
-   /* initialize rings basic information */
-   ena_init_io_rings(adapter);
-
+   /*
+* The amount of requested MSIX vectors is equal to
+* adapter::max_num_io_queues (see `ena_enable_msix()`), plus a constant
+* number of admin queue interrupts. The former is initially determined
+* by HW capabilities (see `ena_calc_max_io_queue_num())` but may not be
+* achieved if there are not enough system resources. By default, the
+* number of effectively used IO queues is the same but later on it can
+* be limited by the user using sysctl interface.
+*/
rc = ena_enable_msix_and_set_admin_interrupts(adapter);
if (unlikely(rc != 0)) {
device_printf(pdev,
"Failed to enable and set the admin interrupts\n");
goto err_io_free;
}
+   /* By default all of allocated MSIX vectors are actively used */
+   adapter->num_io_queues = adapter->msix_vecs - ENA_ADMIN_MSIX_VEC;
+
+   /* initialize rings basic information */
+   ena_init_io_rings(adapter);
 
/* setup network interface */
rc = ena_setup_ifnet(pdev, adapter, _feat_ctx);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361520 - head/usr.sbin/bluetooth/hccontrol

2020-05-26 Thread Takanori Watanabe
Author: takawata
Date: Tue May 26 15:46:18 2020
New Revision: 361520
URL: https://svnweb.freebsd.org/changeset/base/361520

Log:
  Add le_connect command to connect to an LE device.
  
  PR:246664
  Submitted by:MarcVeldman

Modified:
  head/usr.sbin/bluetooth/hccontrol/hccontrol.8
  head/usr.sbin/bluetooth/hccontrol/hccontrol.h
  head/usr.sbin/bluetooth/hccontrol/le.c
  head/usr.sbin/bluetooth/hccontrol/util.c

Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.8
==
--- head/usr.sbin/bluetooth/hccontrol/hccontrol.8   Tue May 26 15:45:54 
2020(r361519)
+++ head/usr.sbin/bluetooth/hccontrol/hccontrol.8   Tue May 26 15:46:18 
2020(r361520)
@@ -161,6 +161,7 @@ are:
 .It Cm LE_Clear_White_List
 .It Cm LE_Add_Device_To_White_List
 .It Cm LE_Remove_Device_From_White_List
+.It Cm LE_Connect
 .El
 .Pp
 The currently supported node commands in

Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.h
==
--- head/usr.sbin/bluetooth/hccontrol/hccontrol.h   Tue May 26 15:45:54 
2020(r361519)
+++ head/usr.sbin/bluetooth/hccontrol/hccontrol.h   Tue May 26 15:46:18 
2020(r361520)
@@ -80,6 +80,8 @@ char const *  hci_con_state2str   (int);
 char const *   hci_status2str  (int);
 char const *   hci_bdaddr2str  (bdaddr_t const *);
 char const *   hci_addrtype2str(int type);
+char const *hci_role2str(int role);
+char const *hci_mc_accuracy2str (int accuracy);
 
 void dump_adv_data(int len, uint8_t* advdata);
 void print_adv_data(int len, uint8_t* advdata);

Modified: head/usr.sbin/bluetooth/hccontrol/le.c
==
--- head/usr.sbin/bluetooth/hccontrol/le.c  Tue May 26 15:45:54 2020
(r361519)
+++ head/usr.sbin/bluetooth/hccontrol/le.c  Tue May 26 15:46:18 2020
(r361520)
@@ -67,6 +67,8 @@ static int le_read_white_list_size(int s, int argc, ch
 static int le_clear_white_list(int s, int argc, char *argv[]);
 static int le_add_device_to_white_list(int s, int argc, char *argv[]);
 static int le_remove_device_from_white_list(int s, int argc, char *argv[]);
+static int le_connect(int s, int argc, char *argv[]);
+static void handle_le_connection_event(ng_hci_event_pkt_t* e, bool verbose);
 
 static int
 le_set_scan_param(int s, int argc, char *argv[])
@@ -933,6 +935,157 @@ le_remove_device_from_white_list(int s, int argc, char
return (OK);
 }
 
+static int
+le_connect(int s, int argc, char *argv[])
+{ 
+   ng_hci_le_create_connection_cp cp;
+   ng_hci_status_rp rp;
+   charb[512];
+   ng_hci_event_pkt_t  *e = (ng_hci_event_pkt_t *) b;
+
+   int n, scancount, bufsize;
+   char ch;
+   bool addr_set = false;
+   bool verbose = false;
+
+   optreset = 1;
+   optind = 0;
+
+   /* minimal scan interval (2.5ms) */ 
+   cp.scan_interval = htole16(4);
+   cp.scan_window = htole16(4);
+
+   /* Don't use the whitelist */
+   cp.filter_policy = 0x00;
+
+   /* Default to public peer address */
+   cp.peer_addr_type = 0x00;
+
+   /* Own address type public */
+   cp.own_address_type = 0x00;
+
+   /* 18.75ms min connection interval */
+   cp.conn_interval_min = htole16(0x000F);
+   /* 18.75ms max connection interval */
+   cp.conn_interval_max = htole16(0x000F);
+
+   /* 0 events connection latency */
+   cp.conn_latency = htole16(0x);
+
+   /* 32s supervision timeout */
+   cp.supervision_timeout = htole16(0x0C80);
+
+   /* Min CE Length 0.625 ms */
+   cp.min_ce_length = htole16(1);
+   /* Max CE Length 0.625 ms */
+   cp.max_ce_length = htole16(1);
+
+   while ((ch = getopt(argc, argv , "a:t:v")) != -1) {
+   switch(ch) {
+   case 't':
+   if (strcmp(optarg, "public") == 0)
+   cp.peer_addr_type = 0x00;
+   else if (strcmp(optarg, "random") == 0)
+   cp.peer_addr_type = 0x01;
+   else 
+   return (USAGE);
+   break;
+   case 'a':
+   addr_set = true;
+   if (!bt_aton(optarg, _addr)) {
+   struct hostent  *he = NULL;
+
+   if ((he = bt_gethostbyname(optarg)) == NULL)
+   return (USAGE);
+
+   memcpy(_addr, he->h_addr,
+   sizeof(cp.peer_addr));
+   }
+   break;
+   case 'v':
+   verbose = true;
+   break;
+   }
+   }
+
+   if (addr_set == false) 
+   return 

svn commit: r361523 - head/sys/dev/ena

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 15:50:30 2020
New Revision: 361523
URL: https://svnweb.freebsd.org/changeset/base/361523

Log:
  Rework ENA Tx buffer ring size reconfiguration
  
  This method has been aligned with the way how the Rx queue size is being
  updated - so it's now done synchronously instead of resetting the
  device.
  
  Moreover, the input parameter is now being validated if it's a power of
  2. Without this, it can cause kernel panic.
  
  Submitted by:  Michal Krawczyk 
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/dev/ena/ena.c
  head/sys/dev/ena/ena.h
  head/sys/dev/ena/ena_sysctl.c

Modified: head/sys/dev/ena/ena.c
==
--- head/sys/dev/ena/ena.c  Tue May 26 15:48:27 2020(r361522)
+++ head/sys/dev/ena/ena.c  Tue May 26 15:50:30 2020(r361523)
@@ -1135,6 +1135,55 @@ ena_refill_rx_bufs(struct ena_ring *rx_ring, uint32_t 
 }
 
 int
+ena_update_buf_ring_size(struct ena_adapter *adapter,
+uint32_t new_buf_ring_size)
+{
+   uint32_t old_buf_ring_size;
+   int rc = 0;
+   bool dev_was_up;
+
+   ENA_LOCK_LOCK(adapter);
+
+   old_buf_ring_size = adapter->buf_ring_size;
+   adapter->buf_ring_size = new_buf_ring_size;
+
+   dev_was_up = ENA_FLAG_ISSET(ENA_FLAG_DEV_UP, adapter);
+   ena_down(adapter);
+
+   /* Reconfigure buf ring for all Tx rings. */
+   ena_free_all_io_rings_resources(adapter);
+   ena_init_io_rings_advanced(adapter);
+   if (dev_was_up) {
+   /*
+* If ena_up() fails, it's not because of recent buf_ring size
+* changes. Because of that, we just want to revert old drbr
+* value and trigger the reset because something else had to
+* go wrong.
+*/
+   rc = ena_up(adapter);
+   if (unlikely(rc != 0)) {
+   device_printf(adapter->pdev,
+   "Failed to configure device after setting new drbr 
size: %u. Reverting old value: %u and triggering the reset\n",
+   new_buf_ring_size, old_buf_ring_size);
+
+   /* Revert old size and trigger the reset */
+   adapter->buf_ring_size = old_buf_ring_size;
+   ena_free_all_io_rings_resources(adapter);
+   ena_init_io_rings_advanced(adapter);
+
+   ENA_FLAG_SET_ATOMIC(ENA_FLAG_DEV_UP_BEFORE_RESET,
+   adapter);
+   ena_trigger_reset(adapter, ENA_REGS_RESET_OS_TRIGGER);
+
+   }
+   }
+
+   ENA_LOCK_UNLOCK(adapter);
+
+   return (rc);
+}
+
+int
 ena_update_queue_size(struct ena_adapter *adapter, uint32_t new_tx_size,
 uint32_t new_rx_size)
 {

Modified: head/sys/dev/ena/ena.h
==
--- head/sys/dev/ena/ena.h  Tue May 26 15:48:27 2020(r361522)
+++ head/sys/dev/ena/ena.h  Tue May 26 15:50:30 2020(r361523)
@@ -426,7 +426,7 @@ struct ena_adapter {
 
uint32_t tx_offload_cap;
 
-   uint16_t buf_ring_size;
+   uint32_t buf_ring_size;
 
/* RSS*/
uint8_t rss_ind_tbl[ENA_RX_RSS_TABLE_SIZE];
@@ -497,6 +497,8 @@ voidena_down(struct ena_adapter *adapter);
 intena_restore_device(struct ena_adapter *adapter);
 void   ena_destroy_device(struct ena_adapter *adapter, bool graceful);
 intena_refill_rx_bufs(struct ena_ring *rx_ring, uint32_t num);
+intena_update_buf_ring_size(struct ena_adapter *adapter,
+uint32_t new_buf_ring_size);
 intena_update_queue_size(struct ena_adapter *adapter, uint32_t new_tx_size,
 uint32_t new_rx_size);
 

Modified: head/sys/dev/ena/ena_sysctl.c
==
--- head/sys/dev/ena/ena_sysctl.c   Tue May 26 15:48:27 2020
(r361522)
+++ head/sys/dev/ena/ena_sysctl.c   Tue May 26 15:50:30 2020
(r361523)
@@ -307,8 +307,9 @@ ena_sysctl_add_tuneables(struct ena_adapter *adapter)
 
/* Tuneable number of buffers in the buf-ring (drbr) */
SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "buf_ring_size",
-   CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, adapter, 0,
-   ena_sysctl_buf_ring_size, "I", "Size of the bufring");
+   CTLTYPE_U32 | CTLFLAG_RW | CTLFLAG_MPSAFE, adapter, 0,
+   ena_sysctl_buf_ring_size, "I",
+   "Size of the Tx buffer ring (drbr).");
 
/* Tuneable number of the Rx ring size */
SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rx_queue_size",
@@ -322,31 +323,38 @@ static int
 ena_sysctl_buf_ring_size(SYSCTL_HANDLER_ARGS)
 {
struct ena_adapter *adapter = arg1;
-   int val;
+   uint32_t val;
int error;
 
val = 0;
-   error = sysctl_wire_old_buffer(req, sizeof(int));
+   error = 

svn commit: r361521 - head/sys/dev/ena

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 15:48:06 2020
New Revision: 361521
URL: https://svnweb.freebsd.org/changeset/base/361521

Log:
  Rework ENA Rx queue size configuration
  
  This patch reworks how the Rx queue size is being reconfigured and how
  the information from the device is being processed.
  
  Reconfiguration of the queues and reset of the device in order to make
  the changes alive isn't the best approach. It can be done synchronously
  and it will let to pass information if the reconfiguration was
  successful to the user. It now is done in the ena_update_queue_size()
  function.
  
  To avoid reallocation of the ring buffer, statistic counters and the
  reinitialization of the mutexes when only new size has to be assigned,
  the io queues initialization function has been split into 2 stages:
  basic, which is just copying appropriate fields and the advanced, which
  allocates and inits more advanced structures for the IO rings.
  
  Moreover, now the max allowed Rx and Tx ring size is being kept
  statically in the adapter and the size of the variables holding those
  values has been changed to uint32_t everywhere.
  
  Information about IO queues size is now being logged in the up routine
  instead of the attach.
  
  Submitted by:  Michal Krawczyk 
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/dev/ena/ena.c
  head/sys/dev/ena/ena.h
  head/sys/dev/ena/ena_datapath.c
  head/sys/dev/ena/ena_netmap.c
  head/sys/dev/ena/ena_sysctl.c

Modified: head/sys/dev/ena/ena.c
==
--- head/sys/dev/ena/ena.c  Tue May 26 15:46:18 2020(r361520)
+++ head/sys/dev/ena/ena.c  Tue May 26 15:48:06 2020(r361521)
@@ -96,6 +96,8 @@ static inline void ena_free_counters(counter_u64_t *, 
 static inline void ena_reset_counters(counter_u64_t *, int);
 static voidena_init_io_rings_common(struct ena_adapter *,
 struct ena_ring *, uint16_t);
+static voidena_init_io_rings_basic(struct ena_adapter *);
+static voidena_init_io_rings_advanced(struct ena_adapter *);
 static voidena_init_io_rings(struct ena_adapter *);
 static voidena_free_io_ring_resources(struct ena_adapter *, unsigned int);
 static voidena_free_all_io_rings_resources(struct ena_adapter *);
@@ -151,12 +153,9 @@ static int ena_setup_ifnet(device_t, struct ena_adapte
 static int ena_enable_wc(struct resource *);
 static int ena_set_queues_placement_policy(device_t, struct ena_com_dev *,
 struct ena_admin_feature_llq_desc *, struct ena_llq_configurations *);
-static int ena_calc_io_queue_num(struct ena_adapter *,
+static uint32_tena_calc_max_io_queue_num(device_t, struct ena_com_dev 
*,
 struct ena_com_dev_get_features_ctx *);
-static int ena_calc_queue_size(struct ena_adapter *,
-struct ena_calc_queue_size_ctx *);
-static int ena_handle_updated_queues(struct ena_adapter *,
-struct ena_com_dev_get_features_ctx *);
+static int ena_calc_io_queue_size(struct ena_calc_queue_size_ctx *);
 static int ena_rss_init_default(struct ena_adapter *);
 static voidena_rss_init_default_deferred(void *);
 static voidena_config_host_info(struct ena_com_dev *, device_t);
@@ -388,11 +387,10 @@ ena_init_io_rings_common(struct ena_adapter *adapter, 
ring->ena_dev = adapter->ena_dev;
ring->first_interrupt = false;
ring->no_interrupt_event_cnt = 0;
-   ring->rx_mbuf_sz = ena_mbuf_sz;
 }
 
 static void
-ena_init_io_rings(struct ena_adapter *adapter)
+ena_init_io_rings_basic(struct ena_adapter *adapter)
 {
struct ena_com_dev *ena_dev;
struct ena_ring *txr, *rxr;
@@ -401,7 +399,7 @@ ena_init_io_rings(struct ena_adapter *adapter)
 
ena_dev = adapter->ena_dev;
 
-   for (i = 0; i < adapter->num_queues; i++) {
+   for (i = 0; i < adapter->num_io_queues; i++) {
txr = >tx_ring[i];
rxr = >rx_ring[i];
 
@@ -414,19 +412,43 @@ ena_init_io_rings(struct ena_adapter *adapter)
txr->tx_max_header_size = ena_dev->tx_max_header_size;
txr->tx_mem_queue_type = ena_dev->tx_mem_queue_type;
 
+   /* RX specific ring state */
+   rxr->ring_size = adapter->rx_ring_size;
+
+   que = >que[i];
+   que->adapter = adapter;
+   que->id = i;
+   que->tx_ring = txr;
+   que->rx_ring = rxr;
+
+   txr->que = que;
+   rxr->que = que;
+
+   rxr->empty_rx_queue = 0;
+   rxr->rx_mbuf_sz = ena_mbuf_sz;
+   }
+}
+
+static void
+ena_init_io_rings_advanced(struct ena_adapter *adapter)
+{
+   struct ena_ring *txr, *rxr;
+   int i;
+
+   for (i = 0; i < adapter->num_io_queues; i++) {
+   txr = >tx_ring[i];
+   rxr = >rx_ring[i];
+
/* Allocate a buf ring */
txr->buf_ring_size = adapter->buf_ring_size;

svn commit: r361522 - releng/11.4/sys/netinet

2020-05-26 Thread Michael Tuexen
Author: tuexen
Date: Tue May 26 15:48:27 2020
New Revision: 361522
URL: https://svnweb.freebsd.org/changeset/base/361522

Log:
  MFS r361469: Fix bug in PR-SCTP
  Only drop DATA chunk with lower priorities as specified in RFC 7496.
  This issue was found by looking at a reproducer generated by syzkaller.
  
  MFS r361472: Improve SCTP iterator
  Ensure that the SCTP iterator runs with an stcb and inp, which belong to
  each other.
  
  MFS r361473: Improve stcb handling during teardown
  Ensure that an stcb is not dereferenced when it is about to be freed.
  This issue was found by SYZKALLER.
  
  MFS r361476: Improve ASCONF handling
  Avoid an integer underflow.
  
  Approved by:  re(gjb)

Modified:
  releng/11.4/sys/netinet/sctp_asconf.c
  releng/11.4/sys/netinet/sctp_indata.c
  releng/11.4/sys/netinet/sctp_indata.h
  releng/11.4/sys/netinet/sctp_output.c
  releng/11.4/sys/netinet/sctputil.c
Directory Properties:
  releng/11.4/   (props changed)

Modified: releng/11.4/sys/netinet/sctp_asconf.c
==
--- releng/11.4/sys/netinet/sctp_asconf.c   Tue May 26 15:48:06 2020
(r361521)
+++ releng/11.4/sys/netinet/sctp_asconf.c   Tue May 26 15:48:27 2020
(r361522)
@@ -1797,9 +1797,9 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset,
}   /* switch */
 
/* update remaining ASCONF-ACK message length to process */
-   ack_length -= SCTP_SIZE32(param_length);
-   if (ack_length <= 0) {
-   /* no more data in the mbuf chain */
+   if (ack_length > SCTP_SIZE32(param_length)) {
+   ack_length -= SCTP_SIZE32(param_length);
+   } else {
break;
}
offset += SCTP_SIZE32(param_length);

Modified: releng/11.4/sys/netinet/sctp_indata.c
==
--- releng/11.4/sys/netinet/sctp_indata.c   Tue May 26 15:48:06 2020
(r361521)
+++ releng/11.4/sys/netinet/sctp_indata.c   Tue May 26 15:48:27 2020
(r361522)
@@ -162,6 +162,9 @@ sctp_build_readq_entry(struct sctp_tcb *stcb,
read_queue_e->data = dm;
read_queue_e->stcb = stcb;
read_queue_e->port_from = stcb->rport;
+   if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
+   read_queue_e->do_not_ref_stcb = 1;
+   }
 failed_build:
return (read_queue_e);
 }
@@ -773,6 +776,7 @@ sctp_build_readq_entry_from_ctl(struct sctp_queued_to_
atomic_add_int(>whoFrom->ref_count, 1);
nc->stcb = control->stcb;
nc->port_from = control->port_from;
+   nc->do_not_ref_stcb = control->do_not_ref_stcb;
 }
 
 static void

Modified: releng/11.4/sys/netinet/sctp_indata.h
==
--- releng/11.4/sys/netinet/sctp_indata.h   Tue May 26 15:48:06 2020
(r361521)
+++ releng/11.4/sys/netinet/sctp_indata.h   Tue May 26 15:48:27 2020
(r361522)
@@ -66,6 +66,9 @@ sctp_build_readq_entry(struct sctp_tcb *stcb,
(_ctl)->data = dm; \
(_ctl)->stcb = (in_it); \
(_ctl)->port_from = (in_it)->rport; \
+   if ((in_it)->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { \
+   (_ctl)->do_not_ref_stcb = 1; \
+   }\
} \
 } while (0)
 

Modified: releng/11.4/sys/netinet/sctp_output.c
==
--- releng/11.4/sys/netinet/sctp_output.c   Tue May 26 15:48:06 2020
(r361521)
+++ releng/11.4/sys/netinet/sctp_output.c   Tue May 26 15:48:27 2020
(r361522)
@@ -6198,11 +6198,11 @@ sctp_prune_prsctp(struct sctp_tcb *stcb,
 * This one is PR-SCTP AND buffer space
 * limited type
 */
-   if (chk->rec.data.timetodrop.tv_sec >= 
(long)srcv->sinfo_timetolive) {
+   if (chk->rec.data.timetodrop.tv_sec > 
(long)srcv->sinfo_timetolive) {
/*
 * Lower numbers equates to higher
 * priority so if the one we are
-* looking at has a larger or equal
+* looking at has a larger
 * priority we want to drop the data
 * and NOT retransmit it.
 */
@@ -6233,7 +6233,7 @@ sctp_prune_prsctp(struct sctp_tcb *stcb,
TAILQ_FOREACH_SAFE(chk, >send_queue, sctp_next, nchk) {
/* Here we must move to the sent queue and mark */
if 

svn commit: r361519 - head/sys/dev/ena

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 15:45:54 2020
New Revision: 361519
URL: https://svnweb.freebsd.org/changeset/base/361519

Log:
  Mark the ENA driver as epoch ready
  
  Recent changes to the epoch requires driver to notify that they knows
  epoch in order to prevent input packet function to enter epoch each
  time the packet is received.
  
  ENA is using NET_TASK for handling Rx, so it's entering epoch
  automatically whenever this task is being executed.
  
  Submitted by:  Michal Krawczyk 
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/dev/ena/ena.c

Modified: head/sys/dev/ena/ena.c
==
--- head/sys/dev/ena/ena.c  Tue May 26 15:44:08 2020(r361518)
+++ head/sys/dev/ena/ena.c  Tue May 26 15:45:54 2020(r361519)
@@ -2116,7 +2116,8 @@ ena_setup_ifnet(device_t pdev, struct ena_adapter *ada
if_setdev(ifp, pdev);
if_setsoftc(ifp, adapter);
 
-   if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST);
+   if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST |
+   IFF_KNOWSEPOCH);
if_setinitfn(ifp, ena_init);
if_settransmitfn(ifp, ena_mq_start);
if_setqflushfn(ifp, ena_qflush);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361518 - head/sys/dev/ena

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 15:44:08 2020
New Revision: 361518
URL: https://svnweb.freebsd.org/changeset/base/361518

Log:
  Improve indentation in ena_up() and ena_down()
  
  If the conditional check for ENA_FLAG_DEV_UP is negated, the body of the
  function can have smaller indentation and it makes the code cleaner.
  
  Submitted by:  Michal Krawczyk 
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/dev/ena/ena.c

Modified: head/sys/dev/ena/ena.c
==
--- head/sys/dev/ena/ena.c  Tue May 26 15:41:53 2020(r361517)
+++ head/sys/dev/ena/ena.c  Tue May 26 15:44:08 2020(r361518)
@@ -1788,71 +1788,72 @@ ena_up(struct ena_adapter *adapter)
return (ENXIO);
}
 
-   if (!ENA_FLAG_ISSET(ENA_FLAG_DEV_UP, adapter)) {
-   device_printf(adapter->pdev, "device is going UP\n");
+   if (ENA_FLAG_ISSET(ENA_FLAG_DEV_UP, adapter))
+   return (0);
 
-   /* setup interrupts for IO queues */
-   rc = ena_setup_io_intr(adapter);
-   if (unlikely(rc != 0)) {
-   ena_trace(ENA_ALERT, "error setting up IO interrupt\n");
-   goto error;
-   }
-   rc = ena_request_io_irq(adapter);
-   if (unlikely(rc != 0)) {
-   ena_trace(ENA_ALERT, "err_req_irq\n");
-   goto error;
-   }
+   device_printf(adapter->pdev, "device is going UP\n");
 
-   /* allocate transmit descriptors */
-   rc = ena_setup_all_tx_resources(adapter);
-   if (unlikely(rc != 0)) {
-   ena_trace(ENA_ALERT, "err_setup_tx\n");
-   goto err_setup_tx;
-   }
+   /* setup interrupts for IO queues */
+   rc = ena_setup_io_intr(adapter);
+   if (unlikely(rc != 0)) {
+   ena_trace(ENA_ALERT, "error setting up IO interrupt\n");
+   goto error;
+   }
+   rc = ena_request_io_irq(adapter);
+   if (unlikely(rc != 0)) {
+   ena_trace(ENA_ALERT, "err_req_irq\n");
+   goto error;
+   }
 
-   /* allocate receive descriptors */
-   rc = ena_setup_all_rx_resources(adapter);
-   if (unlikely(rc != 0)) {
-   ena_trace(ENA_ALERT, "err_setup_rx\n");
-   goto err_setup_rx;
-   }
+   /* allocate transmit descriptors */
+   rc = ena_setup_all_tx_resources(adapter);
+   if (unlikely(rc != 0)) {
+   ena_trace(ENA_ALERT, "err_setup_tx\n");
+   goto err_setup_tx;
+   }
 
-   /* create IO queues for Rx & Tx */
-   rc = ena_create_io_queues(adapter);
-   if (unlikely(rc != 0)) {
-   ena_trace(ENA_ALERT,
-   "create IO queues failed\n");
-   goto err_io_que;
-   }
+   /* allocate receive descriptors */
+   rc = ena_setup_all_rx_resources(adapter);
+   if (unlikely(rc != 0)) {
+   ena_trace(ENA_ALERT, "err_setup_rx\n");
+   goto err_setup_rx;
+   }
 
-   if (ENA_FLAG_ISSET(ENA_FLAG_LINK_UP, adapter))
-   if_link_state_change(adapter->ifp, LINK_STATE_UP);
+   /* create IO queues for Rx & Tx */
+   rc = ena_create_io_queues(adapter);
+   if (unlikely(rc != 0)) {
+   ena_trace(ENA_ALERT,
+   "create IO queues failed\n");
+   goto err_io_que;
+   }
 
-   rc = ena_up_complete(adapter);
-   if (unlikely(rc != 0))
-   goto err_up_complete;
+   if (ENA_FLAG_ISSET(ENA_FLAG_LINK_UP, adapter))
+   if_link_state_change(adapter->ifp, LINK_STATE_UP);
 
-   counter_u64_add(adapter->dev_stats.interface_up, 1);
+   rc = ena_up_complete(adapter);
+   if (unlikely(rc != 0))
+   goto err_up_complete;
 
-   ena_update_hwassist(adapter);
+   counter_u64_add(adapter->dev_stats.interface_up, 1);
 
-   if_setdrvflagbits(adapter->ifp, IFF_DRV_RUNNING,
-   IFF_DRV_OACTIVE);
+   ena_update_hwassist(adapter);
 
-   /* Activate timer service only if the device is running.
-* If this flag is not set, it means that the driver is being
-* reset and timer service will be activated afterwards.
-*/
-   if (ENA_FLAG_ISSET(ENA_FLAG_DEVICE_RUNNING, adapter)) {
-   callout_reset_sbt(>timer_service, SBT_1S,
-   SBT_1S, ena_timer_service, (void *)adapter, 0);
-   }
+   if_setdrvflagbits(adapter->ifp, IFF_DRV_RUNNING,
+   IFF_DRV_OACTIVE);
 
-   ENA_FLAG_SET_ATOMIC(ENA_FLAG_DEV_UP, 

svn commit: r361517 - head/sys/dev/ena

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 15:41:53 2020
New Revision: 361517
URL: https://svnweb.freebsd.org/changeset/base/361517

Log:
  Expose argument names for non static ENA driver functions
  
  As functions which are declared in the header files are intended to be
  the interface and are going to be used by other files, it's better to
  include argument names in the definition, so the caller won't have to
  check the .c file in order to check their meaning and order.
  
  Submitted by:  Michal Krawczyk 
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/dev/ena/ena.h
  head/sys/dev/ena/ena_datapath.h
  head/sys/dev/ena/ena_netmap.h
  head/sys/dev/ena/ena_sysctl.h

Modified: head/sys/dev/ena/ena.h
==
--- head/sys/dev/ena/ena.h  Tue May 26 15:39:41 2020(r361516)
+++ head/sys/dev/ena/ena.h  Tue May 26 15:41:53 2020(r361517)
@@ -483,11 +483,11 @@ static inline int ena_mbuf_count(struct mbuf *mbuf)
return count;
 }
 
-intena_up(struct ena_adapter *);
-void   ena_down(struct ena_adapter *);
-intena_restore_device(struct ena_adapter *);
-void   ena_destroy_device(struct ena_adapter *, bool);
-intena_refill_rx_bufs(struct ena_ring *, uint32_t);
+intena_up(struct ena_adapter *adapter);
+void   ena_down(struct ena_adapter *adapter);
+intena_restore_device(struct ena_adapter *adapter);
+void   ena_destroy_device(struct ena_adapter *adapter, bool graceful);
+intena_refill_rx_bufs(struct ena_ring *rx_ring, uint32_t num);
 
 static inline void
 ena_trigger_reset(struct ena_adapter *adapter,

Modified: head/sys/dev/ena/ena_datapath.h
==
--- head/sys/dev/ena/ena_datapath.h Tue May 26 15:39:41 2020
(r361516)
+++ head/sys/dev/ena/ena_datapath.h Tue May 26 15:41:53 2020
(r361517)
@@ -34,9 +34,9 @@
 #ifndef ENA_TXRX_H
 #define ENA_TXRX_H
 
-void   ena_cleanup(void *, int);
-void   ena_qflush(if_t);
-intena_mq_start(if_t, struct mbuf *);
-void   ena_deferred_mq_start(void *, int);
+void   ena_cleanup(void *arg, int pending);
+void   ena_qflush(if_t ifp);
+intena_mq_start(if_t ifp, struct mbuf *m);
+void   ena_deferred_mq_start(void *arg, int pending);
 
 #endif /* ENA_TXRX_H */

Modified: head/sys/dev/ena/ena_netmap.h
==
--- head/sys/dev/ena/ena_netmap.h   Tue May 26 15:39:41 2020
(r361516)
+++ head/sys/dev/ena/ena_netmap.h   Tue May 26 15:41:53 2020
(r361517)
@@ -46,15 +46,15 @@
 #include 
 #include 
 
-intena_netmap_attach(struct ena_adapter *);
-intena_netmap_alloc_rx_slot(struct ena_adapter *, struct ena_ring *,
-struct ena_rx_buffer *);
-void   ena_netmap_free_rx_slot(struct ena_adapter *, struct ena_ring *,
-struct ena_rx_buffer *);
-bool   ena_rx_ring_in_netmap(struct ena_adapter *, int);
-bool   ena_tx_ring_in_netmap(struct ena_adapter *, int);
-void   ena_netmap_reset_rx_ring(struct ena_adapter *, int);
-void   ena_netmap_reset_tx_ring(struct ena_adapter *, int);
-void   ena_netmap_unload(struct ena_adapter *, bus_dmamap_t);
+intena_netmap_attach(struct ena_adapter *adapter);
+intena_netmap_alloc_rx_slot(struct ena_adapter *adapter,
+struct ena_ring *rx_ring, struct ena_rx_buffer *rx_info);
+void   ena_netmap_free_rx_slot(struct ena_adapter *adapter,
+struct ena_ring *rx_ring, struct ena_rx_buffer *rx_info);
+bool   ena_rx_ring_in_netmap(struct ena_adapter *adapter, int qid);
+bool   ena_tx_ring_in_netmap(struct ena_adapter *adapter, int qid);
+void   ena_netmap_reset_rx_ring(struct ena_adapter *adapter, int qid);
+void   ena_netmap_reset_tx_ring(struct ena_adapter *adapter, int qid);
+void   ena_netmap_unload(struct ena_adapter *adapter, bus_dmamap_t map);
 
 #endif /* _ENA_NETMAP_H_ */

Modified: head/sys/dev/ena/ena_sysctl.h
==
--- head/sys/dev/ena/ena_sysctl.h   Tue May 26 15:39:41 2020
(r361516)
+++ head/sys/dev/ena/ena_sysctl.h   Tue May 26 15:41:53 2020
(r361517)
@@ -39,7 +39,7 @@
 
 #include "ena.h"
 
-void   ena_sysctl_add_nodes(struct ena_adapter *);
+void   ena_sysctl_add_nodes(struct ena_adapter *adapter);
 
 extern int ena_enable_9k_mbufs;
 #define ena_mbuf_sz (ena_enable_9k_mbufs ? MJUM9BYTES : MJUMPAGESIZE)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361516 - head/sys/dev/ena

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 15:39:41 2020
New Revision: 361516
URL: https://svnweb.freebsd.org/changeset/base/361516

Log:
  Use single global lock in the ENA driver
  
  Currently, the driver had 2 global locks - one was sx lock used for
  up/down synchronization and the second one was mutex, which was used
  for link configuration and timer service callout.
  
  It is better to have single lock for that. We cannot use mutex, as it
  can sleep and cause witness errors in up/down configuration, so sx lock
  seems to be the only choice.
  
  Callout cannot use sx lock, but the timer service is MP safe, so we just
  need to avoid race between ena_down() and ena_detach(). It can be
  avoided by acquiring sx lock.
  
  Simple macros were added that are encapsulating implementation of the
  lock and makes the code cleaner.
  
  Submitted by:  Michal Krawczyk 
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/dev/ena/ena.c
  head/sys/dev/ena/ena.h
  head/sys/dev/ena/ena_netmap.c

Modified: head/sys/dev/ena/ena.c
==
--- head/sys/dev/ena/ena.c  Tue May 26 15:37:55 2020(r361515)
+++ head/sys/dev/ena/ena.c  Tue May 26 15:39:41 2020(r361516)
@@ -1907,13 +1907,13 @@ ena_media_status(if_t ifp, struct ifmediareq *ifmr)
struct ena_adapter *adapter = if_getsoftc(ifp);
ena_trace(ENA_DBG, "enter\n");
 
-   mtx_lock(>global_mtx);
+   ENA_LOCK_LOCK(adapter);
 
ifmr->ifm_status = IFM_AVALID;
ifmr->ifm_active = IFM_ETHER;
 
if (!ENA_FLAG_ISSET(ENA_FLAG_LINK_UP, adapter)) {
-   mtx_unlock(>global_mtx);
+   ENA_LOCK_UNLOCK(adapter);
ena_trace(ENA_INFO, "Link is down\n");
return;
}
@@ -1921,7 +1921,7 @@ ena_media_status(if_t ifp, struct ifmediareq *ifmr)
ifmr->ifm_status |= IFM_ACTIVE;
ifmr->ifm_active |= IFM_UNKNOWN | IFM_FDX;
 
-   mtx_unlock(>global_mtx);
+   ENA_LOCK_UNLOCK(adapter);
 }
 
 static void
@@ -1930,9 +1930,9 @@ ena_init(void *arg)
struct ena_adapter *adapter = (struct ena_adapter *)arg;
 
if (!ENA_FLAG_ISSET(ENA_FLAG_DEV_UP, adapter)) {
-   sx_xlock(>ioctl_sx);
+   ENA_LOCK_LOCK(adapter);
ena_up(adapter);
-   sx_unlock(>ioctl_sx);
+   ENA_LOCK_UNLOCK(adapter);
}
 }
 
@@ -1954,13 +1954,13 @@ ena_ioctl(if_t ifp, u_long command, caddr_t data)
case SIOCSIFMTU:
if (ifp->if_mtu == ifr->ifr_mtu)
break;
-   sx_xlock(>ioctl_sx);
+   ENA_LOCK_LOCK(adapter);
ena_down(adapter);
 
ena_change_mtu(ifp, ifr->ifr_mtu);
 
rc = ena_up(adapter);
-   sx_unlock(>ioctl_sx);
+   ENA_LOCK_UNLOCK(adapter);
break;
 
case SIOCSIFFLAGS:
@@ -1972,15 +1972,15 @@ ena_ioctl(if_t ifp, u_long command, caddr_t data)
"ioctl promisc/allmulti\n");
}
} else {
-   sx_xlock(>ioctl_sx);
+   ENA_LOCK_LOCK(adapter);
rc = ena_up(adapter);
-   sx_unlock(>ioctl_sx);
+   ENA_LOCK_UNLOCK(adapter);
}
} else {
if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) != 0) {
-   sx_xlock(>ioctl_sx);
+   ENA_LOCK_LOCK(adapter);
ena_down(adapter);
-   sx_unlock(>ioctl_sx);
+   ENA_LOCK_UNLOCK(adapter);
}
}
break;
@@ -2005,10 +2005,10 @@ ena_ioctl(if_t ifp, u_long command, caddr_t data)
 
if ((reinit != 0) &&
((if_getdrvflags(ifp) & IFF_DRV_RUNNING) != 0)) {
-   sx_xlock(>ioctl_sx);
+   ENA_LOCK_LOCK(adapter);
ena_down(adapter);
rc = ena_up(adapter);
-   sx_unlock(>ioctl_sx);
+   ENA_LOCK_UNLOCK(adapter);
}
}
 
@@ -3180,10 +3180,10 @@ ena_reset_task(void *arg, int pending)
return;
}
 
-   sx_xlock(>ioctl_sx);
+   ENA_LOCK_LOCK(adapter);
ena_destroy_device(adapter, false);
ena_restore_device(adapter);
-   sx_unlock(>ioctl_sx);
+   ENA_LOCK_UNLOCK(adapter);
 }
 
 /**
@@ -3212,11 +3212,13 @@ ena_attach(device_t pdev)
adapter = device_get_softc(pdev);
adapter->pdev = pdev;
 
-   mtx_init(>global_mtx, "ENA global mtx", NULL, MTX_DEF);
-  

svn commit: r361515 - head/sys/dev/ena

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 15:37:55 2020
New Revision: 361515
URL: https://svnweb.freebsd.org/changeset/base/361515

Log:
  Add trigger reset function in the ENA driver
  
  As the reset triggering is no longer a simple macro that was just
  setting appropriate flag, the new function for triggering reset was
  added. It improves code readability a lot, as we are avoiding additional
  indentation.
  
  Submitted by:  Michal Krawczyk 
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/dev/ena/ena.c
  head/sys/dev/ena/ena.h
  head/sys/dev/ena/ena_datapath.c
  head/sys/dev/ena/ena_netmap.c

Modified: head/sys/dev/ena/ena.c
==
--- head/sys/dev/ena/ena.c  Tue May 26 15:35:22 2020(r361514)
+++ head/sys/dev/ena/ena.c  Tue May 26 15:37:55 2020(r361515)
@@ -2742,10 +2742,7 @@ static void check_for_missing_keep_alive(struct ena_ad
device_printf(adapter->pdev,
"Keep alive watchdog timeout.\n");
counter_u64_add(adapter->dev_stats.wd_expired, 1);
-   if (likely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, adapter))) {
-   adapter->reset_reason = ENA_REGS_RESET_KEEP_ALIVE_TO;
-   ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, adapter);
-   }
+   ena_trigger_reset(adapter, ENA_REGS_RESET_KEEP_ALIVE_TO);
}
 }
 
@@ -2757,10 +2754,7 @@ static void check_for_admin_com_state(struct ena_adapt
device_printf(adapter->pdev,
"ENA admin queue is not in running state!\n");
counter_u64_add(adapter->dev_stats.admin_q_pause, 1);
-   if (likely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, adapter))) {
-   adapter->reset_reason = ENA_REGS_RESET_ADMIN_TO;
-   ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, adapter);
-   }
+   ena_trigger_reset(adapter, ENA_REGS_RESET_ADMIN_TO);
}
 }
 
@@ -2779,10 +2773,7 @@ check_for_rx_interrupt_queue(struct ena_adapter *adapt
if (rx_ring->no_interrupt_event_cnt == ENA_MAX_NO_INTERRUPT_ITERATIONS) 
{
device_printf(adapter->pdev, "Potential MSIX issue on Rx side "
"Queue = %d. Reset the device\n", rx_ring->qid);
-   if (likely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, adapter))) {
-   adapter->reset_reason = ENA_REGS_RESET_MISS_INTERRUPT;
-   ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, adapter);
-   }
+   ena_trigger_reset(adapter, ENA_REGS_RESET_MISS_INTERRUPT);
return (EIO);
}
 
@@ -2820,13 +2811,8 @@ check_missing_comp_in_tx_queue(struct ena_adapter *ada
device_printf(adapter->pdev,
"Potential MSIX issue on Tx side Queue = %d. "
"Reset the device\n", tx_ring->qid);
-   if (likely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET,
-   adapter))) {
-   adapter->reset_reason =
-   ENA_REGS_RESET_MISS_INTERRUPT;
-   ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET,
-   adapter);
-   }
+   ena_trigger_reset(adapter,
+   ENA_REGS_RESET_MISS_INTERRUPT);
return (EIO);
}
 
@@ -2848,10 +2834,7 @@ check_missing_comp_in_tx_queue(struct ena_adapter *ada
"The number of lost tx completion is above the threshold "
"(%d > %d). Reset the device\n",
missed_tx, adapter->missing_tx_threshold);
-   if (likely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, adapter))) {
-   adapter->reset_reason = ENA_REGS_RESET_MISS_TX_CMPL;
-   ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, adapter);
-   }
+   ena_trigger_reset(adapter, ENA_REGS_RESET_MISS_TX_CMPL);
rc = EIO;
}
 

Modified: head/sys/dev/ena/ena.h
==
--- head/sys/dev/ena/ena.h  Tue May 26 15:35:22 2020(r361514)
+++ head/sys/dev/ena/ena.h  Tue May 26 15:37:55 2020(r361515)
@@ -484,6 +484,16 @@ intena_restore_device(struct ena_adapter *);
 void   ena_destroy_device(struct ena_adapter *, bool);
 intena_refill_rx_bufs(struct ena_ring *, uint32_t);
 
+static inline void
+ena_trigger_reset(struct ena_adapter *adapter,
+enum ena_regs_reset_reason_types reset_reason)
+{
+   if (likely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, adapter))) {
+   adapter->reset_reason = reset_reason;
+   ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, adapter);
+   }
+}
+
 

svn commit: r361514 - head/sys/dev/ena

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 15:35:22 2020
New Revision: 361514
URL: https://svnweb.freebsd.org/changeset/base/361514

Log:
  Provide ENA driver version in a sysctl node
  
  Usage example: $ sysctl hw.ena.driver_version
  
  Submitted by:  Maciej Bielski 
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/dev/ena/ena_sysctl.c

Modified: head/sys/dev/ena/ena_sysctl.c
==
--- head/sys/dev/ena/ena_sysctl.c   Tue May 26 15:33:43 2020
(r361513)
+++ head/sys/dev/ena/ena_sysctl.c   Tue May 26 15:35:22 2020
(r361514)
@@ -48,6 +48,9 @@ int ena_log_level = ENA_ALERT | ENA_WARNING;
 SYSCTL_INT(_hw_ena, OID_AUTO, log_level, CTLFLAG_RWTUN,
 _log_level, 0, "Logging level indicating verbosity of the logs");
 
+SYSCTL_CONST_STRING(_hw_ena, OID_AUTO, driver_version, CTLFLAG_RD,
+DRV_MODULE_VERSION, "ENA driver version");
+
 /*
  * Use 9k mbufs for the Rx buffers. Default to 0 (use page size mbufs instead).
  * Using 9k mbufs in low memory conditions might cause allocation to take a lot
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361513 - head/sys/dev/ena

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 15:33:43 2020
New Revision: 361513
URL: https://svnweb.freebsd.org/changeset/base/361513

Log:
  Remove unused argument from static function in ena.c
  
  The function ena_enable_msix_and_set_admin_interrupts takes two
  arguments while the second is not used and so can be spared. This is a
  static function, only ena.c is affected.
  
  Submitted by:  Maciej Bielski 
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/dev/ena/ena.c

Modified: head/sys/dev/ena/ena.c
==
--- head/sys/dev/ena/ena.c  Tue May 26 15:31:28 2020(r361512)
+++ head/sys/dev/ena/ena.c  Tue May 26 15:33:43 2020(r361513)
@@ -164,8 +164,7 @@ static int  ena_attach(device_t);
 static int ena_detach(device_t);
 static int ena_device_init(struct ena_adapter *, device_t,
 struct ena_com_dev_get_features_ctx *, int *);
-static int ena_enable_msix_and_set_admin_interrupts(struct ena_adapter *,
-int);
+static int ena_enable_msix_and_set_admin_interrupts(struct ena_adapter *);
 static void ena_update_on_link_change(void *, struct ena_admin_aenq_entry *);
 static voidunimplemented_aenq_handler(void *,
 struct ena_admin_aenq_entry *);
@@ -2672,8 +2671,7 @@ err_mmio_read_less:
return (rc);
 }
 
-static int ena_enable_msix_and_set_admin_interrupts(struct ena_adapter 
*adapter,
-int io_vectors)
+static int ena_enable_msix_and_set_admin_interrupts(struct ena_adapter 
*adapter)
 {
struct ena_com_dev *ena_dev = adapter->ena_dev;
int rc;
@@ -3136,8 +3134,7 @@ ena_restore_device(struct ena_adapter *adapter)
if (ENA_FLAG_ISSET(ENA_FLAG_LINK_UP, adapter))
if_link_state_change(ifp, LINK_STATE_UP);
 
-   rc = ena_enable_msix_and_set_admin_interrupts(adapter,
-   adapter->num_queues);
+   rc = ena_enable_msix_and_set_admin_interrupts(adapter);
if (rc != 0) {
device_printf(dev, "Enable MSI-X failed\n");
goto err_device_destroy;
@@ -3365,7 +3362,7 @@ ena_attach(device_t pdev)
calc_queue_ctx.tx_queue_size);
ena_init_io_rings(adapter);
 
-   rc = ena_enable_msix_and_set_admin_interrupts(adapter, io_queue_num);
+   rc = ena_enable_msix_and_set_admin_interrupts(adapter);
if (unlikely(rc != 0)) {
device_printf(pdev,
"Failed to enable and set the admin interrupts\n");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361512 - head/sys/dev/ena

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 15:31:28 2020
New Revision: 361512
URL: https://svnweb.freebsd.org/changeset/base/361512

Log:
  Enable Tx drops reporting in the ENA driver
  
  Tx drops statistics are fetched from HW every ena_keepalive_wd() call
  and are observable using one of the commands:
  * sysctl dev.ena.0.hw_stats.tx_drops
  * netstat -I ena0 -d
  
  Submitted by:  Maciej Bielski 
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/dev/ena/ena.c
  head/sys/dev/ena/ena.h
  head/sys/dev/ena/ena_sysctl.c

Modified: head/sys/dev/ena/ena.c
==
--- head/sys/dev/ena/ena.c  Tue May 26 15:29:19 2020(r361511)
+++ head/sys/dev/ena/ena.c  Tue May 26 15:31:28 2020(r361512)
@@ -1888,6 +1888,8 @@ ena_get_counter(if_t ifp, ift_counter cnt)
return (counter_u64_fetch(stats->tx_bytes));
case IFCOUNTER_IQDROPS:
return (counter_u64_fetch(stats->rx_drops));
+   case IFCOUNTER_OQDROPS:
+   return (counter_u64_fetch(stats->tx_drops));
default:
return (if_get_counter_default(ifp, cnt));
}
@@ -2710,12 +2712,16 @@ static void ena_keep_alive_wd(void *adapter_data,
struct ena_admin_aenq_keep_alive_desc *desc;
sbintime_t stime;
uint64_t rx_drops;
+   uint64_t tx_drops;
 
desc = (struct ena_admin_aenq_keep_alive_desc *)aenq_e;
 
rx_drops = ((uint64_t)desc->rx_drops_high << 32) | desc->rx_drops_low;
+   tx_drops = ((uint64_t)desc->tx_drops_high << 32) | desc->tx_drops_low;
counter_u64_zero(adapter->hw_stats.rx_drops);
counter_u64_add(adapter->hw_stats.rx_drops, rx_drops);
+   counter_u64_zero(adapter->hw_stats.tx_drops);
+   counter_u64_add(adapter->hw_stats.tx_drops, tx_drops);
 
stime = getsbinuptime();
atomic_store_rel_64(>keep_alive_timestamp, stime);

Modified: head/sys/dev/ena/ena.h
==
--- head/sys/dev/ena/ena.h  Tue May 26 15:29:19 2020(r361511)
+++ head/sys/dev/ena/ena.h  Tue May 26 15:31:28 2020(r361512)
@@ -380,6 +380,7 @@ struct ena_hw_stats {
counter_u64_t tx_bytes;
 
counter_u64_t rx_drops;
+   counter_u64_t tx_drops;
 };
 
 /* Board specific private data structure */

Modified: head/sys/dev/ena/ena_sysctl.c
==
--- head/sys/dev/ena/ena_sysctl.c   Tue May 26 15:29:19 2020
(r361511)
+++ head/sys/dev/ena/ena_sysctl.c   Tue May 26 15:31:28 2020
(r361512)
@@ -267,6 +267,8 @@ ena_sysctl_add_stats(struct ena_adapter *adapter)
_stats->tx_bytes, "Bytes transmitted");
SYSCTL_ADD_COUNTER_U64(ctx, hw_list, OID_AUTO, "rx_drops", CTLFLAG_RD,
_stats->rx_drops, "Receive packet drops");
+   SYSCTL_ADD_COUNTER_U64(ctx, hw_list, OID_AUTO, "tx_drops", CTLFLAG_RD,
+   _stats->tx_drops, "Transmit packet drops");
 
/* ENA Admin queue stats */
admin_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "admin_stats",
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361511 - in head/sys: contrib/ena-com contrib/ena-com/ena_defs dev/ena

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 15:29:19 2020
New Revision: 361511
URL: https://svnweb.freebsd.org/changeset/base/361511

Log:
  Adjust ENA driver to the new HAL
  
  * Removed adaptive interrupt moderation (not suported on FreeBSD).
  * Use ena_com_free_q_entries instead of ena_com_free_desc.
  * Don't use ENA_MEM_FREE outside of the ena_com.
  * Don't use barriers before calling doorbells as it's already done in
the HAL.
  * Add function that generates random RSS key, common for all driver's
interfaces.
  * Change admin stats sysctls to U64.
  
  Submitted by:  Michal Krawczyk 
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/contrib/ena-com/ena_com.c
  head/sys/contrib/ena-com/ena_com.h
  head/sys/contrib/ena-com/ena_defs/ena_admin_defs.h
  head/sys/contrib/ena-com/ena_defs/ena_common_defs.h
  head/sys/contrib/ena-com/ena_defs/ena_eth_io_defs.h
  head/sys/contrib/ena-com/ena_defs/ena_gen_info.h
  head/sys/contrib/ena-com/ena_defs/ena_regs_defs.h
  head/sys/contrib/ena-com/ena_eth_com.c
  head/sys/contrib/ena-com/ena_eth_com.h
  head/sys/contrib/ena-com/ena_plat.h
  head/sys/dev/ena/ena.c
  head/sys/dev/ena/ena.h
  head/sys/dev/ena/ena_datapath.c
  head/sys/dev/ena/ena_netmap.c
  head/sys/dev/ena/ena_sysctl.c
Directory Properties:
  head/sys/contrib/ena-com/   (props changed)

Modified: head/sys/contrib/ena-com/ena_com.c
==
--- head/sys/contrib/ena-com/ena_com.c  Tue May 26 15:12:09 2020
(r361510)
+++ head/sys/contrib/ena-com/ena_com.c  Tue May 26 15:29:19 2020
(r361511)
@@ -1,7 +1,7 @@
 /*-
  * BSD LICENSE
  *
- * Copyright (c) 2015-2019 Amazon.com, Inc. or its affiliates.
+ * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -70,8 +70,10 @@
 
 #define ENA_REGS_ADMIN_INTR_MASK 1
 
-#define ENA_POLL_MS5
+#define ENA_MIN_POLL_US 100
 
+#define ENA_MAX_POLL_US 5000
+
 /*/
 /*/
 /*/
@@ -99,7 +101,7 @@ struct ena_com_stats_ctx {
struct ena_admin_acq_get_stats_resp get_resp;
 };
 
-static inline int ena_com_mem_addr_set(struct ena_com_dev *ena_dev,
+static int ena_com_mem_addr_set(struct ena_com_dev *ena_dev,
   struct ena_common_mem_addr *ena_addr,
   dma_addr_t addr)
 {
@@ -200,7 +202,7 @@ static int ena_com_admin_init_aenq(struct ena_com_dev 
return 0;
 }
 
-static inline void comp_ctxt_release(struct ena_com_admin_queue *queue,
+static void comp_ctxt_release(struct ena_com_admin_queue *queue,
 struct ena_comp_ctx *comp_ctx)
 {
comp_ctx->occupied = false;
@@ -216,6 +218,11 @@ static struct ena_comp_ctx *get_comp_ctxt(struct ena_c
return NULL;
}
 
+   if (unlikely(!queue->comp_ctx)) {
+   ena_trc_err("Completion context is NULL\n");
+   return NULL;
+   }
+
if (unlikely(queue->comp_ctx[command_id].occupied && capture)) {
ena_trc_err("Completion context is occupied\n");
return NULL;
@@ -289,7 +296,7 @@ static struct ena_comp_ctx *__ena_com_submit_admin_cmd
return comp_ctx;
 }
 
-static inline int ena_com_init_comp_ctxt(struct ena_com_admin_queue *queue)
+static int ena_com_init_comp_ctxt(struct ena_com_admin_queue *queue)
 {
size_t size = queue->q_depth * sizeof(struct ena_comp_ctx);
struct ena_comp_ctx *comp_ctx;
@@ -409,6 +416,8 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_
   0x0, io_sq->llq_info.desc_list_entry_size);
io_sq->llq_buf_ctrl.descs_left_in_line =
io_sq->llq_info.descs_num_before_header;
+   io_sq->disable_meta_caching =
+   io_sq->llq_info.disable_meta_caching;
 
if (io_sq->llq_info.max_entries_in_tx_burst > 0)
io_sq->entries_in_tx_burst_left =
@@ -534,12 +543,9 @@ static int ena_com_comp_status_to_errno(u8 comp_status
if (unlikely(comp_status != 0))
ena_trc_err("admin command failed[%u]\n", comp_status);
 
-   if (unlikely(comp_status > ENA_ADMIN_UNKNOWN_ERROR))
-   return ENA_COM_INVAL;
-
switch (comp_status) {
case ENA_ADMIN_SUCCESS:
-   return 0;
+   return ENA_COM_OK;
case ENA_ADMIN_RESOURCE_ALLOCATION_FAILURE:
return ENA_COM_NO_MEM;
case ENA_ADMIN_UNSUPPORTED_OPCODE:
@@ -551,24 +557,32 @@ static int ena_com_comp_status_to_errno(u8 comp_status
return ENA_COM_INVAL;
}
 
-   return 0;
+   return 

svn commit: r361510 - vendor-sys/ena-com/2.2.0

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 15:12:09 2020
New Revision: 361510
URL: https://svnweb.freebsd.org/changeset/base/361510

Log:
  Create 2.0.0 tag in ena-com
  
  Tag is added after updating the ENA HAL to the
  newest in r361508.
  
  Obtained from: Semihalf
  Sponsored by: Amazon, Inc.

Added:
  vendor-sys/ena-com/2.2.0/
 - copied from r361509, vendor-sys/ena-com/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361509 - head/sys/cam/ctl

2020-05-26 Thread Alexander Motin
Author: mav
Date: Tue May 26 15:08:35 2020
New Revision: 361509
URL: https://svnweb.freebsd.org/changeset/base/361509

Log:
  Fix fallout of r319722 in CTL HA.
  
  ha_lso is a listening socket (unless bind() has failed), so should use
  solisten_upcall_set(NULL, NULL), not soupcall_clear().
  
  MFC after:1 week
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/cam/ctl/ctl_ha.c

Modified: head/sys/cam/ctl/ctl_ha.c
==
--- head/sys/cam/ctl/ctl_ha.c   Tue May 26 15:04:49 2020(r361508)
+++ head/sys/cam/ctl/ctl_ha.c   Tue May 26 15:08:35 2020(r361509)
@@ -196,10 +196,11 @@ ctl_ha_lclose(struct ha_softc *softc)
 {
 
if (softc->ha_lso) {
-   SOCKBUF_LOCK(>ha_lso->so_rcv);
-   if (softc->ha_lso->so_rcv.sb_upcall != NULL)
-   soupcall_clear(softc->ha_lso, SO_RCV);
-   SOCKBUF_UNLOCK(>ha_lso->so_rcv);
+   if (SOLISTENING(softc->ha_lso)) {
+   SOLISTEN_LOCK(softc->ha_lso);
+   solisten_upcall_set(softc->ha_lso, NULL, NULL);
+   SOLISTEN_UNLOCK(softc->ha_lso);
+   }
soclose(softc->ha_lso);
softc->ha_lso = NULL;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361508 - in vendor-sys/ena-com/dist: . ena_defs

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 15:04:49 2020
New Revision: 361508
URL: https://svnweb.freebsd.org/changeset/base/361508

Log:
  Upgrade ENA HAL to the version from 20.04.2020
  
  This version of the HAL supports newest generation ENA HW, random
  RSS generation upon device initialization and also includes bug fixes
  in the platform file, like fix for IO write/read macros regarding using
  barriers.
  
  Submitted by: Michal Krawczyk 
  Obtained from: Semihalf
  Sponsored by: Amazon, Inc.

Modified:
  vendor-sys/ena-com/dist/ena_com.c
  vendor-sys/ena-com/dist/ena_com.h
  vendor-sys/ena-com/dist/ena_defs/ena_admin_defs.h
  vendor-sys/ena-com/dist/ena_defs/ena_common_defs.h
  vendor-sys/ena-com/dist/ena_defs/ena_eth_io_defs.h
  vendor-sys/ena-com/dist/ena_defs/ena_gen_info.h
  vendor-sys/ena-com/dist/ena_defs/ena_regs_defs.h
  vendor-sys/ena-com/dist/ena_eth_com.c
  vendor-sys/ena-com/dist/ena_eth_com.h
  vendor-sys/ena-com/dist/ena_plat.h

Modified: vendor-sys/ena-com/dist/ena_com.c
==
--- vendor-sys/ena-com/dist/ena_com.c   Tue May 26 14:16:26 2020
(r361507)
+++ vendor-sys/ena-com/dist/ena_com.c   Tue May 26 15:04:49 2020
(r361508)
@@ -1,7 +1,7 @@
 /*-
  * BSD LICENSE
  *
- * Copyright (c) 2015-2019 Amazon.com, Inc. or its affiliates.
+ * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -70,8 +70,10 @@
 
 #define ENA_REGS_ADMIN_INTR_MASK 1
 
-#define ENA_POLL_MS5
+#define ENA_MIN_POLL_US 100
 
+#define ENA_MAX_POLL_US 5000
+
 /*/
 /*/
 /*/
@@ -99,7 +101,7 @@ struct ena_com_stats_ctx {
struct ena_admin_acq_get_stats_resp get_resp;
 };
 
-static inline int ena_com_mem_addr_set(struct ena_com_dev *ena_dev,
+static int ena_com_mem_addr_set(struct ena_com_dev *ena_dev,
   struct ena_common_mem_addr *ena_addr,
   dma_addr_t addr)
 {
@@ -200,7 +202,7 @@ static int ena_com_admin_init_aenq(struct ena_com_dev 
return 0;
 }
 
-static inline void comp_ctxt_release(struct ena_com_admin_queue *queue,
+static void comp_ctxt_release(struct ena_com_admin_queue *queue,
 struct ena_comp_ctx *comp_ctx)
 {
comp_ctx->occupied = false;
@@ -216,6 +218,11 @@ static struct ena_comp_ctx *get_comp_ctxt(struct ena_c
return NULL;
}
 
+   if (unlikely(!queue->comp_ctx)) {
+   ena_trc_err("Completion context is NULL\n");
+   return NULL;
+   }
+
if (unlikely(queue->comp_ctx[command_id].occupied && capture)) {
ena_trc_err("Completion context is occupied\n");
return NULL;
@@ -289,7 +296,7 @@ static struct ena_comp_ctx *__ena_com_submit_admin_cmd
return comp_ctx;
 }
 
-static inline int ena_com_init_comp_ctxt(struct ena_com_admin_queue *queue)
+static int ena_com_init_comp_ctxt(struct ena_com_admin_queue *queue)
 {
size_t size = queue->q_depth * sizeof(struct ena_comp_ctx);
struct ena_comp_ctx *comp_ctx;
@@ -409,6 +416,8 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_
   0x0, io_sq->llq_info.desc_list_entry_size);
io_sq->llq_buf_ctrl.descs_left_in_line =
io_sq->llq_info.descs_num_before_header;
+   io_sq->disable_meta_caching =
+   io_sq->llq_info.disable_meta_caching;
 
if (io_sq->llq_info.max_entries_in_tx_burst > 0)
io_sq->entries_in_tx_burst_left =
@@ -534,12 +543,9 @@ static int ena_com_comp_status_to_errno(u8 comp_status
if (unlikely(comp_status != 0))
ena_trc_err("admin command failed[%u]\n", comp_status);
 
-   if (unlikely(comp_status > ENA_ADMIN_UNKNOWN_ERROR))
-   return ENA_COM_INVAL;
-
switch (comp_status) {
case ENA_ADMIN_SUCCESS:
-   return 0;
+   return ENA_COM_OK;
case ENA_ADMIN_RESOURCE_ALLOCATION_FAILURE:
return ENA_COM_NO_MEM;
case ENA_ADMIN_UNSUPPORTED_OPCODE:
@@ -551,24 +557,32 @@ static int ena_com_comp_status_to_errno(u8 comp_status
return ENA_COM_INVAL;
}
 
-   return 0;
+   return ENA_COM_INVAL;
 }
 
+static inline void ena_delay_exponential_backoff_us(u32 exp, u32 delay_us)
+{
+   delay_us = ENA_MAX32(ENA_MIN_POLL_US, delay_us);
+   delay_us = ENA_MIN32(delay_us * (1 << exp), ENA_MAX_POLL_US);
+   ENA_USLEEP(delay_us);
+}
+
 static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx 
*comp_ctx,
  

svn commit: r361507 - head/sys/netipsec

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 14:16:26 2020
New Revision: 361507
URL: https://svnweb.freebsd.org/changeset/base/361507

Log:
  Fix AES-CTR compatibility issue in ipsec
  
  r361390 decreased blocksize of AES-CTR from 16 to 1.
  Because of that ESP payload is no longer aligned to 16 bytes
  before being encrypted and sent.
  This is a good change since RFC3686 specifies that the last block
  doesn't need to be aligned.
  Since FreeBSD before r361390 couldn't decrypt partial blocks encrypted
  with AES-CTR we need to enforce 16 byte alignment in order to preserve
  compatibility.
  Add a sysctl(on by default) to control it.
  
  Submitted by: Kornel Duleba 
  Reviewed by: jhb
  Obtained from: Semihalf
  Sponsored by: Stormshield
  Differential Revision: https://reviews.freebsd.org/D24999

Modified:
  head/sys/netipsec/xform_esp.c

Modified: head/sys/netipsec/xform_esp.c
==
--- head/sys/netipsec/xform_esp.c   Tue May 26 14:10:53 2020
(r361506)
+++ head/sys/netipsec/xform_esp.c   Tue May 26 14:16:26 2020
(r361507)
@@ -80,6 +80,8 @@
 #include 
 
 VNET_DEFINE(int, esp_enable) = 1;
+VNET_DEFINE_STATIC(int, esp_ctr_compatibility) = 1;
+#define V_esp_ctr_compatibility VNET(esp_ctr_compatibility)
 VNET_PCPUSTAT_DEFINE(struct espstat, espstat);
 VNET_PCPUSTAT_SYSINIT(espstat);
 
@@ -90,6 +92,9 @@ VNET_PCPUSTAT_SYSUNINIT(espstat);
 SYSCTL_DECL(_net_inet_esp);
 SYSCTL_INT(_net_inet_esp, OID_AUTO, esp_enable,
CTLFLAG_VNET | CTLFLAG_RW, _NAME(esp_enable), 0, "");
+SYSCTL_INT(_net_inet_esp, OID_AUTO, ctr_compatibility,
+CTLFLAG_VNET | CTLFLAG_RW, _NAME(esp_ctr_compatibility), 0,
+"Align AES-CTR encrypted transmitted frames to blocksize");
 SYSCTL_VNET_PCPUSTAT(_net_inet_esp, IPSECCTL_STATS, stats,
 struct espstat, espstat,
 "ESP statistics (struct espstat, netipsec/esp_var.h");
@@ -652,8 +657,14 @@ esp_output(struct mbuf *m, struct secpolicy *sp, struc
rlen = m->m_pkthdr.len - skip;  /* Raw payload length. */
/*
 * RFC4303 2.4 Requires 4 byte alignment.
+* Old versions of FreeBSD can't decrypt partial blocks encrypted
+* with AES-CTR. Align payload to native_blocksize (16 bytes)
+* in order to preserve compatibility.
 */
-   blks = MAX(4, espx->blocksize); /* Cipher blocksize */
+   if (SAV_ISCTR(sav) && V_esp_ctr_compatibility)
+   blks = MAX(4, espx->native_blocksize);  /* Cipher blocksize */
+   else
+   blks = MAX(4, espx->blocksize);
 
/* XXX clamp padding length a la KAME??? */
padding = ((blks - ((rlen + 2) % blks)) % blks) + 2;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361506 - head/sys/arm/mv

2020-05-26 Thread Marcin Wojtas
Author: mw
Date: Tue May 26 14:10:53 2020
New Revision: 361506
URL: https://svnweb.freebsd.org/changeset/base/361506

Log:
  Restore XHCI operation on Armada 38x
  
  r347343 split generic xhci driver into three files.
  Include generic_xhci_fdt.c when building kernel for Armada SoCs.
  This brings back XHCI support on these platforms and also
  others, which use GENERIC config.
  
  Submitted by: Kornel Duleba
  Obtained from: Semihalf
  MFC after: 1 week
  Sponsored by: Stormshield
  Differential Revision: https://reviews.freebsd.org/D24944

Modified:
  head/sys/arm/mv/files.arm7

Modified: head/sys/arm/mv/files.arm7
==
--- head/sys/arm/mv/files.arm7  Tue May 26 14:06:07 2020(r361505)
+++ head/sys/arm/mv/files.arm7  Tue May 26 14:10:53 2020(r361506)
@@ -34,4 +34,5 @@ dev/uart/uart_dev_ns8250.coptionaluart
 dev/uart/uart_dev_snps.c   optionaluart
 dev/usb/controller/ehci_mv.c   optionalehci
 dev/usb/controller/generic_xhci.c  optionalxhci
+dev/usb/controller/generic_xhci_fdt.c  optionalxhci
 dev/ahci/ahci_mv_fdt.c optionalahci
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361505 - stable/12/lib/libproc/tests

2020-05-26 Thread Mark Johnston
Author: markj
Date: Tue May 26 14:06:07 2020
New Revision: 361505
URL: https://svnweb.freebsd.org/changeset/base/361505

Log:
  MFC r360980:
  Re-enable proc_test:symbol_lookup after r360979.
  
  PR:   244732

Modified:
  stable/12/lib/libproc/tests/proc_test.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libproc/tests/proc_test.c
==
--- stable/12/lib/libproc/tests/proc_test.c Tue May 26 14:05:37 2020
(r361504)
+++ stable/12/lib/libproc/tests/proc_test.c Tue May 26 14:06:07 2020
(r361505)
@@ -270,9 +270,6 @@ ATF_TC_BODY(symbol_lookup, tc)
u_long saved;
int error;
 
-   if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
-   atf_tc_skip("https://bugs.freebsd.org/244732;);
-
phdl = start_prog(tc, false);
 
error = proc_name2sym(phdl, target_prog_file, "main", _sym, NULL);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361504 - stable/12/lib/librtld_db

2020-05-26 Thread Mark Johnston
Author: markj
Date: Tue May 26 14:05:37 2020
New Revision: 361504
URL: https://svnweb.freebsd.org/changeset/base/361504

Log:
  MFC r360979:
  librtld_db: Fix shlib mapping offsets.
  
  PR:   244732

Modified:
  stable/12/lib/librtld_db/rtld_db.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/librtld_db/rtld_db.c
==
--- stable/12/lib/librtld_db/rtld_db.c  Tue May 26 14:05:06 2020
(r361503)
+++ stable/12/lib/librtld_db/rtld_db.c  Tue May 26 14:05:37 2020
(r361504)
@@ -160,9 +160,12 @@ rd_err_e
 rd_loadobj_iter(rd_agent_t *rdap, rl_iter_f *cb, void *clnt_data)
 {
struct kinfo_vmentry *kves, *kve;
+   const char *path;
+   uint64_t fileid;
rd_loadobj_t rdl;
rd_err_e ret;
-   int cnt, i, lastvn;
+   uintptr_t base;
+   int cnt, i;
 
DPRINTF("%s\n", __func__);
 
@@ -171,27 +174,38 @@ rd_loadobj_iter(rd_agent_t *rdap, rl_iter_f *cb, void 
return (RD_ERR);
}
 
+   base = 0;
+   fileid = 0;
+   path = NULL;
ret = RD_OK;
-   lastvn = 0;
for (i = 0; i < cnt; i++) {
-   kve = kves + i;
-   if (kve->kve_type == KVME_TYPE_VNODE)
-   lastvn = i;
+   kve = [i];
+   /*
+* Cache the base offset of the file mapping.  The kve_offset
+* field gives the file offset of a particular mapping into the
+* file, but we want the mapping offset relative to the base
+* mapping.
+*/
+   if (kve->kve_type == KVME_TYPE_VNODE &&
+   kve->kve_vn_fileid != fileid) {
+   base = kve->kve_start;
+   fileid = kve->kve_vn_fileid;
+   path = kve->kve_path;
+   }
memset(, 0, sizeof(rdl));
/*
 * Map the kinfo_vmentry struct to the rd_loadobj structure.
 */
rdl.rdl_saddr = kve->kve_start;
rdl.rdl_eaddr = kve->kve_end;
-   rdl.rdl_offset = kve->kve_offset;
+   rdl.rdl_offset = kve->kve_start - base;
if (kve->kve_protection & KVME_PROT_READ)
rdl.rdl_prot |= RD_RDL_R;
if (kve->kve_protection & KVME_PROT_WRITE)
rdl.rdl_prot |= RD_RDL_W;
if (kve->kve_protection & KVME_PROT_EXEC)
rdl.rdl_prot |= RD_RDL_X;
-   strlcpy(rdl.rdl_path, kves[lastvn].kve_path,
-   sizeof(rdl.rdl_path));
+   strlcpy(rdl.rdl_path, path, sizeof(rdl.rdl_path));
if ((*cb)(, clnt_data) != 0) {
ret = RD_ERR;
break;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361503 - stable/12/sys/kern

2020-05-26 Thread Mark Johnston
Author: markj
Date: Tue May 26 14:05:06 2020
New Revision: 361503
URL: https://svnweb.freebsd.org/changeset/base/361503

Log:
  MFC r361262:
  Use the symbolic name for "modmetadata_set".

Modified:
  stable/12/sys/kern/kern_linker.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/kern_linker.c
==
--- stable/12/sys/kern/kern_linker.cTue May 26 13:57:14 2020
(r361502)
+++ stable/12/sys/kern/kern_linker.cTue May 26 14:05:06 2020
(r361503)
@@ -370,8 +370,7 @@ linker_file_register_modules(linker_file_t lf)
 
sx_assert(_sx, SA_XLOCKED);
 
-   if (linker_file_lookup_set(lf, "modmetadata_set", ,
-   , NULL) != 0) {
+   if (linker_file_lookup_set(lf, MDT_SETNAME, , , NULL) != 0) {
/*
 * This fallback should be unnecessary, but if we get booted
 * from boot2 instead of loader and we are missing our
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361502 - head/sys/cam/ctl

2020-05-26 Thread Alexander Motin
Author: mav
Date: Tue May 26 13:57:14 2020
New Revision: 361502
URL: https://svnweb.freebsd.org/changeset/base/361502

Log:
  Do not remove upcall if we haven't yet.
  
  This fixes assertion if we failed to bind listening HA socket.
  
  MFC after:1 week
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/cam/ctl/ctl_ha.c

Modified: head/sys/cam/ctl/ctl_ha.c
==
--- head/sys/cam/ctl/ctl_ha.c   Tue May 26 13:35:41 2020(r361501)
+++ head/sys/cam/ctl/ctl_ha.c   Tue May 26 13:57:14 2020(r361502)
@@ -197,7 +197,8 @@ ctl_ha_lclose(struct ha_softc *softc)
 
if (softc->ha_lso) {
SOCKBUF_LOCK(>ha_lso->so_rcv);
-   soupcall_clear(softc->ha_lso, SO_RCV);
+   if (softc->ha_lso->so_rcv.sb_upcall != NULL)
+   soupcall_clear(softc->ha_lso, SO_RCV);
SOCKBUF_UNLOCK(>ha_lso->so_rcv);
soclose(softc->ha_lso);
softc->ha_lso = NULL;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361501 - stable/12/include

2020-05-26 Thread Konstantin Belousov
Author: kib
Date: Tue May 26 13:35:41 2020
New Revision: 361501
URL: https://svnweb.freebsd.org/changeset/base/361501

Log:
  MFC r360984:
  Make include/malloc.h usable again.

Modified:
  stable/12/include/malloc.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/include/malloc.h
==
--- stable/12/include/malloc.h  Tue May 26 10:24:06 2020(r361500)
+++ stable/12/include/malloc.h  Tue May 26 13:35:41 2020(r361501)
@@ -1,6 +1,6 @@
-/* $FreeBSD$ */
-#if __STDC__
-#error " has been replaced by "
-#else
+/*-
+ * This file is in the public domain.
+ * $FreeBSD$
+ */
 #include 
-#endif
+#include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361500 - head/sys/amd64/amd64

2020-05-26 Thread Roger Pau Monné
Author: royger
Date: Tue May 26 10:24:06 2020
New Revision: 361500
URL: https://svnweb.freebsd.org/changeset/base/361500

Log:
  xen-locore: fix size in GDT descriptor
  
  There was an off-by-one in the GDT descriptor size field used by the
  early Xen boot code. The GDT descriptor size should be the size of the
  GDT minus one. No functional change expected as a result of this
  change.
  
  Sponsored by: Citrix Systems R

Modified:
  head/sys/amd64/amd64/xen-locore.S

Modified: head/sys/amd64/amd64/xen-locore.S
==
--- head/sys/amd64/amd64/xen-locore.S   Tue May 26 08:25:24 2020
(r361499)
+++ head/sys/amd64/amd64/xen-locore.S   Tue May 26 10:24:06 2020
(r361500)
@@ -207,7 +207,7 @@ PT2:
 
 /* 64bit GDT */
 gdtdesc:
-   .word   gdtend - gdt
+   .word   gdtend - gdt - 1
.long   VTOP(gdt)   # low
.long   0   # high
 gdt:
@@ -221,7 +221,7 @@ gdtend:
 
 /* 32bit GDT */
 gdtdesc32:
-   .word   gdt32end - gdt32
+   .word   gdt32end - gdt32 - 1
.long   VTOP(gdt32)
.long   0
 gdt32:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361499 - head/sys/kern

2020-05-26 Thread Hans Petter Selasky
Author: hselasky
Date: Tue May 26 08:25:24 2020
New Revision: 361499
URL: https://svnweb.freebsd.org/changeset/base/361499

Log:
  Fix build issue after r360292 when using both RSS and KERN_TLS options.
  
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/kern/uipc_ktls.c

Modified: head/sys/kern/uipc_ktls.c
==
--- head/sys/kern/uipc_ktls.c   Tue May 26 07:41:46 2020(r361498)
+++ head/sys/kern/uipc_ktls.c   Tue May 26 08:25:24 2020(r361499)
@@ -58,7 +58,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #ifdef RSS
 #include 
-#include 
 #include 
 #endif
 #include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361498 - in head/sys/dev/mlx5: . mlx5_core

2020-05-26 Thread Hans Petter Selasky
Author: hselasky
Date: Tue May 26 07:41:46 2020
New Revision: 361498
URL: https://svnweb.freebsd.org/changeset/base/361498

Log:
  Sync with Linux packet pacing enhancements in mlx5en(4).
  
  Linux commit:
  05d3ac978ed25b753bfe34fe76c50c31ee506a82
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_rl.c
  head/sys/dev/mlx5/mlx5_ifc.h

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_rl.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_rl.c   Tue May 26 06:55:03 2020
(r361497)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_rl.c   Tue May 26 07:41:46 2020
(r361498)
@@ -58,16 +58,14 @@ static struct mlx5_rl_entry *find_rl_entry(struct mlx5
 static int mlx5_set_rate_limit_cmd(struct mlx5_core_dev *dev,
   u32 rate, u32 burst, u16 index)
 {
-   u32 in[MLX5_ST_SZ_DW(set_rate_limit_in)] = {0};
-   u32 out[MLX5_ST_SZ_DW(set_rate_limit_out)] = {0};
+   u32 in[MLX5_ST_SZ_DW(set_rate_limit_in)] = {};
+   u32 out[MLX5_ST_SZ_DW(set_rate_limit_out)] = {};
 
-   MLX5_SET(set_rate_limit_in, in, opcode,
-MLX5_CMD_OP_SET_RATE_LIMIT);
+   MLX5_SET(set_rate_limit_in, in, opcode, MLX5_CMD_OP_SET_RATE_LIMIT);
MLX5_SET(set_rate_limit_in, in, rate_limit_index, index);
MLX5_SET(set_rate_limit_in, in, rate_limit, rate);
-
-   if (MLX5_CAP_QOS(dev, packet_pacing_burst_bound))
-   MLX5_SET(set_rate_limit_in, in, burst_upper_bound, burst);
+   MLX5_SET(set_rate_limit_in, in, burst_upper_bound, burst);
+   MLX5_SET(set_rate_limit_in, in, typical_packet_size, 0 /* use MTU */);
 
return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
 }

Modified: head/sys/dev/mlx5/mlx5_ifc.h
==
--- head/sys/dev/mlx5/mlx5_ifc.hTue May 26 06:55:03 2020
(r361497)
+++ head/sys/dev/mlx5/mlx5_ifc.hTue May 26 07:41:46 2020
(r361498)
@@ -690,7 +690,8 @@ struct mlx5_ifc_qos_cap_bits {
u8 esw_rate_limit[0x1];
u8 hll[0x1];
u8 packet_pacing_burst_bound[0x1];
-   u8 reserved_at_6[0x1a];
+   u8 packet_pacing_typical_size[0x1];
+   u8 reserved_at_7[0x19];
 
u8 reserved_at_20[0x20];
 
@@ -7790,7 +7791,13 @@ struct mlx5_ifc_set_rate_limit_in_bits {
u8 reserved_at_60[0x20];
 
u8 rate_limit[0x20];
+
u8 burst_upper_bound[0x20];
+
+   u8 reserved_at_c0[0x10];
+   u8 typical_packet_size[0x10];
+
+   u8 reserved_at_e0[0x120];
 };
 
 struct mlx5_ifc_access_register_out_bits {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361497 - head/tests/sys/netipsec/tunnel

2020-05-26 Thread Li-Wen Hsu
Author: lwhsu
Date: Tue May 26 06:55:03 2020
New Revision: 361497
URL: https://svnweb.freebsd.org/changeset/base/361497

Log:
  Disable failing test cases in CI:
  
  sys.netipsec.tunnel.aes_cbc_128_hmac_sha1.v4
  sys.netipsec.tunnel.aes_cbc_256_hmac_sha2_256.v4
  sys.netipsec.tunnel.aesni_aes_cbc_128_hmac_sha1.v4
  sys.netipsec.tunnel.aesni_aes_cbc_256_hmac_sha2_256.v4
  
  PR:   246737
  Sponsored by: The FreeBSD Foundation

Modified:
  head/tests/sys/netipsec/tunnel/aes_cbc_128_hmac_sha1.sh
  head/tests/sys/netipsec/tunnel/aes_cbc_256_hmac_sha2_256.sh
  head/tests/sys/netipsec/tunnel/aesni_aes_cbc_128_hmac_sha1.sh
  head/tests/sys/netipsec/tunnel/aesni_aes_cbc_256_hmac_sha2_256.sh

Modified: head/tests/sys/netipsec/tunnel/aes_cbc_128_hmac_sha1.sh
==
--- head/tests/sys/netipsec/tunnel/aes_cbc_128_hmac_sha1.sh Tue May 26 
05:55:46 2020(r361496)
+++ head/tests/sys/netipsec/tunnel/aes_cbc_128_hmac_sha1.sh Tue May 26 
06:55:03 2020(r361497)
@@ -11,6 +11,10 @@ v4_head()
 
 v4_body()
 {
+   if [ "$(atf_config_get ci false)" = "true" ]; then
+   atf_skip "https://bugs.freebsd.org/246737;
+   fi
+
# Unload AESNI module if loaded
kldstat -q -n aesni && kldunload aesni
 

Modified: head/tests/sys/netipsec/tunnel/aes_cbc_256_hmac_sha2_256.sh
==
--- head/tests/sys/netipsec/tunnel/aes_cbc_256_hmac_sha2_256.sh Tue May 26 
05:55:46 2020(r361496)
+++ head/tests/sys/netipsec/tunnel/aes_cbc_256_hmac_sha2_256.sh Tue May 26 
06:55:03 2020(r361497)
@@ -11,6 +11,10 @@ v4_head()
 
 v4_body()
 {
+   if [ "$(atf_config_get ci false)" = "true" ]; then
+   atf_skip "https://bugs.freebsd.org/246737;
+   fi
+
# load AESNI module if not already
kldstat -q -n aesni || kldload aesni
 

Modified: head/tests/sys/netipsec/tunnel/aesni_aes_cbc_128_hmac_sha1.sh
==
--- head/tests/sys/netipsec/tunnel/aesni_aes_cbc_128_hmac_sha1.sh   Tue May 
26 05:55:46 2020(r361496)
+++ head/tests/sys/netipsec/tunnel/aesni_aes_cbc_128_hmac_sha1.sh   Tue May 
26 06:55:03 2020(r361497)
@@ -11,6 +11,10 @@ v4_head()
 
 v4_body()
 {
+   if [ "$(atf_config_get ci false)" = "true" ]; then
+   atf_skip "https://bugs.freebsd.org/246737;
+   fi
+
# load AESNI module if not already
kldstat -q -n aesni || kldload aesni
 

Modified: head/tests/sys/netipsec/tunnel/aesni_aes_cbc_256_hmac_sha2_256.sh
==
--- head/tests/sys/netipsec/tunnel/aesni_aes_cbc_256_hmac_sha2_256.sh   Tue May 
26 05:55:46 2020(r361496)
+++ head/tests/sys/netipsec/tunnel/aesni_aes_cbc_256_hmac_sha2_256.sh   Tue May 
26 06:55:03 2020(r361497)
@@ -11,6 +11,10 @@ v4_head()
 
 v4_body()
 {
+   if [ "$(atf_config_get ci false)" = "true" ]; then
+   atf_skip "https://bugs.freebsd.org/246737;
+   fi
+
# Unload AESNI module if loaded
kldstat -q -n aesni && kldunload aesni
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"