Re: svn commit: r360581 - in head/sys: dev/cxgbe dev/cxgbe/crypto dev/cxgbe/tom dev/mlx5/mlx5_en kern netinet sys

2020-05-02 Thread Navdeep Parhar
On Sun, May 03, 2020 at 12:21:11AM +, Gleb Smirnoff wrote:
> Author: glebius
> Date: Sun May  3 00:21:11 2020
> New Revision: 360581
> URL: https://svnweb.freebsd.org/changeset/base/360581
> 
> Log:
>   Step 4.1: mechanically rename M_NOMAP to M_EXTPG

Hello Gleb,

This looks incomplete.  mbuf.9 still refers to M_NOMAP.  ifnet cap is
still IFCAP_NOMAP and shown as NOMAP by ifconfig, and ifconfig still
uses (-)nomap to enable/disable the capability.

This looks a bit gratuitous to me but if you're going to do it then at
least use the same name consistently throughout the tree.

Regards,
Navdeep

>   
>   Reviewed by:gallatin
>   Differential Revision:  https://reviews.freebsd.org/D24598
> 
> Modified:
>   head/sys/dev/cxgbe/crypto/t4_kern_tls.c
>   head/sys/dev/cxgbe/t4_sge.c
>   head/sys/dev/cxgbe/tom/t4_cpl_io.c
>   head/sys/dev/cxgbe/tom/t4_tls.c
>   head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c
>   head/sys/kern/kern_mbuf.c
>   head/sys/kern/kern_sendfile.c
>   head/sys/kern/subr_bus_dma.c
>   head/sys/kern/subr_sglist.c
>   head/sys/kern/uipc_ktls.c
>   head/sys/kern/uipc_mbuf.c
>   head/sys/kern/uipc_sockbuf.c
>   head/sys/kern/uipc_socket.c
>   head/sys/netinet/tcp_output.c
>   head/sys/netinet/tcp_pcap.c
>   head/sys/sys/mbuf.h
> 
> Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c
> ==
> --- head/sys/dev/cxgbe/crypto/t4_kern_tls.c   Sun May  3 00:15:18 2020
> (r360580)
> +++ head/sys/dev/cxgbe/crypto/t4_kern_tls.c   Sun May  3 00:21:11 2020
> (r360581)
> @@ -1208,7 +1208,7 @@ t6_ktls_parse_pkt(struct mbuf *m, int *nsegsp, int *le
>  
>   /* Assume all headers are in 'm' for now. */
>   MPASS(m->m_next != NULL);
> - MPASS(m->m_next->m_flags & M_NOMAP);
> + MPASS(m->m_next->m_flags & M_EXTPG);
>  
>   tot_len = 0;
>  
> @@ -1218,7 +1218,7 @@ t6_ktls_parse_pkt(struct mbuf *m, int *nsegsp, int *le
>*/
>   *nsegsp = 0;
>   for (m_tls = m->m_next; m_tls != NULL; m_tls = m_tls->m_next) {
> - MPASS(m_tls->m_flags & M_NOMAP);
> + MPASS(m_tls->m_flags & M_EXTPG);
>  
>   wr_len = ktls_wr_len(tlsp, m, m_tls, &nsegs);
>  #ifdef VERBOSE_TRACES
> @@ -2265,7 +2265,7 @@ t6_ktls_write_wr(struct sge_txq *txq, void *dst, struc
>* for that record.
>*/
>   for (m_tls = m->m_next; m_tls != NULL; m_tls = m_tls->m_next) {
> - MPASS(m_tls->m_flags & M_NOMAP);
> + MPASS(m_tls->m_flags & M_EXTPG);
>  
>   /*
>* Determine the initial TCP sequence number for this
> 
> Modified: head/sys/dev/cxgbe/t4_sge.c
> ==
> --- head/sys/dev/cxgbe/t4_sge.c   Sun May  3 00:15:18 2020
> (r360580)
> +++ head/sys/dev/cxgbe/t4_sge.c   Sun May  3 00:21:11 2020
> (r360581)
> @@ -2497,7 +2497,7 @@ count_mbuf_nsegs(struct mbuf *m, int skip, uint8_t *cf
>   skip -= len;
>   continue;
>   }
> - if ((m->m_flags & M_NOMAP) != 0) {
> + if ((m->m_flags & M_EXTPG) != 0) {
>   *cflags |= MC_NOMAP;
>   nsegs += count_mbuf_ext_pgs(m, skip, &nextaddr);
>   skip = 0;
> @@ -5836,7 +5836,7 @@ write_ethofld_wr(struct cxgbe_rate_tag *cst, struct fw
>   immhdrs -= m0->m_len;
>   continue;
>   }
> - if (m0->m_flags & M_NOMAP)
> + if (m0->m_flags & M_EXTPG)
>   sglist_append_mbuf_epg(&sg, m0,
>   mtod(m0, vm_offset_t), m0->m_len);
>  else
> 
> Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c
> ==
> --- head/sys/dev/cxgbe/tom/t4_cpl_io.cSun May  3 00:15:18 2020
> (r360580)
> +++ head/sys/dev/cxgbe/tom/t4_cpl_io.cSun May  3 00:21:11 2020
> (r360581)
> @@ -610,7 +610,7 @@ write_tx_sgl(void *dst, struct mbuf *start, struct mbu
>  
>   i = -1;
>   for (m = start; m != stop; m = m->m_next) {
> - if (m->m_flags & M_NOMAP)
> + if (m->m_flags & M_EXTPG)
>   rc = sglist_append_mbuf_epg(&sg, m,
>   mtod(m, vm_offset_t), m->m_len);
>   else
> @@ -731,7 +731,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep
>   for (m = sndptr; m != NULL; m = m->m_next) {
>   int n;
>  
> - if (m->m_flags & M_NOMAP) {
> + if (m->m_flags & M_EXTPG) {
>  #ifdef KERN_TLS
>   if (m->m_epg_tls != NULL) {
>   toep->flags |= TPF_KTLS;
> @@ -772,7 +772,7 @@ t4_push_frames(struct adapter *sc, struct to

svn commit: r360600 - head/sys/cam/nvme

2020-05-02 Thread Warner Losh
Author: imp
Date: Sun May  3 04:22:27 2020
New Revision: 360600
URL: https://svnweb.freebsd.org/changeset/base/360600

Log:
  We need to hold the periph lock when we release the ccb (and when we
  run it). Make sure that we do. Simplify the flow a bit, and fix a
  comment since we do need to do these things.
  
  Noticed by: cperciva (not sure why my invariants kernel didn't trigger)

Modified:
  head/sys/cam/nvme/nvme_da.c

Modified: head/sys/cam/nvme/nvme_da.c
==
--- head/sys/cam/nvme/nvme_da.c Sun May  3 04:03:05 2020(r360599)
+++ head/sys/cam/nvme/nvme_da.c Sun May  3 04:22:27 2020(r360600)
@@ -426,26 +426,26 @@ ndaioctl(struct disk *dp, u_long cmd, void *data, int 
 */
memset(&mapinfo, 0, sizeof(mapinfo));
error = cam_periph_mapmem(ccb, &mapinfo, maxmap);
-   if (error) {
-   xpt_release_ccb(ccb);
-   return (error);
-   }
+   if (error)
+   goto out;
 
/*
-* Lock the periph and run the command. XXX do we need
-* to lock the periph?
+* Lock the periph and run the command.
 */
cam_periph_lock(periph);
-   cam_periph_runccb(ccb, NULL, CAM_RETRY_SELTO, SF_RETRY_UA | 
SF_NO_PRINT,
-   NULL);
-   cam_periph_unlock(periph);
+   cam_periph_runccb(ccb, NULL, CAM_RETRY_SELTO,
+   SF_RETRY_UA | SF_NO_PRINT, NULL);
 
/*
 * Tear down mapping and return status.
 */
+   cam_periph_unlock(periph);
cam_periph_unmapmem(ccb, &mapinfo);
error = (ccb->ccb_h.status == CAM_REQ_CMP) ? 0 : EIO;
+out:
+   cam_periph_lock(periph);
xpt_release_ccb(ccb);
+   cam_periph_unlock(periph);
return (error);
}
default:
___
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: r360599 - in stable/11/stand: forth lua

2020-05-02 Thread Kyle Evans
Author: kevans
Date: Sun May  3 04:03:05 2020
New Revision: 360599
URL: https://svnweb.freebsd.org/changeset/base/360599

Log:
  MFC r359371: loader: Fully reset terminal settings, not just colors

Modified:
  stable/11/stand/forth/loader.4th
  stable/11/stand/forth/loader.rc
  stable/11/stand/forth/screen.4th
  stable/11/stand/lua/core.lua
  stable/11/stand/lua/loader.lua
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/forth/loader.4th
==
--- stable/11/stand/forth/loader.4thSun May  3 03:56:17 2020
(r360598)
+++ stable/11/stand/forth/loader.4thSun May  3 04:03:05 2020
(r360599)
@@ -49,6 +49,12 @@ include /boot/check-password.4th
 
 only forth definitions
 
+: maybe-resetcons ( -- )
+  loader_color? if
+ris
+  then
+;
+
 : bootmsg ( -- )
   loader_color? dup ( -- bool bool )
   if 7 fg 4 bg then

Modified: stable/11/stand/forth/loader.rc
==
--- stable/11/stand/forth/loader.rc Sun May  3 03:56:17 2020
(r360598)
+++ stable/11/stand/forth/loader.rc Sun May  3 04:03:05 2020
(r360599)
@@ -12,6 +12,8 @@ try-include /boot/loader.rc.local
 \ NOTE: Change to `initialize' if you enable the below boot menu
 start
 
+maybe-resetcons
+
 \ Tests for password -- executes autoboot first if a password was defined
 check-password
 

Modified: stable/11/stand/forth/screen.4th
==
--- stable/11/stand/forth/screen.4thSun May  3 03:56:17 2020
(r360598)
+++ stable/11/stand/forth/screen.4thSun May  3 04:03:05 2020
(r360599)
@@ -39,6 +39,9 @@ marker task-screen.4th
 \ clear screen
 : clear ( -- ) ho cld ;
 
+\ reset to initial state
+: ris ( -- ) 27 emit [char] c emit ;
+
 \ move cursor to x rows, y cols (1-based coords) ( Esc-[%d;%dH )
 : at-xy ( x y -- ) escc .# [char] ; emit .# [char] H emit ;
 

Modified: stable/11/stand/lua/core.lua
==
--- stable/11/stand/lua/core.luaSun May  3 03:56:17 2020
(r360598)
+++ stable/11/stand/lua/core.luaSun May  3 04:03:05 2020
(r360599)
@@ -103,6 +103,7 @@ core.KEY_DELETE = 127
 -- other contexts (outside of Lua) may mean 'octal'
 core.KEYSTR_ESCAPE = "\027"
 core.KEYSTR_CSI= core.KEYSTR_ESCAPE .. "["
+core.KEYSTR_RESET  = core.KEYSTR_ESCAPE .. "c"
 
 core.MENU_RETURN   = "return"
 core.MENU_ENTRY= "entry"

Modified: stable/11/stand/lua/loader.lua
==
--- stable/11/stand/lua/loader.lua  Sun May  3 03:56:17 2020
(r360598)
+++ stable/11/stand/lua/loader.lua  Sun May  3 04:03:05 2020
(r360599)
@@ -38,25 +38,21 @@ local color = require("color")
 local core = require("core")
 local config = require("config")
 local password = require("password")
--- The menu module will be brought in after config has loaded if we actually
--- need it.
-local menu
 
 config.load()
 
--- Our console may have been setup for a different color scheme before we get
--- here, so make sure we set the default.
+if core.isUEFIBoot() then
+   loader.perform("efi-autoresizecons")
+end
+-- Our console may have been setup with different settings before we get
+-- here, so make sure we reset everything back to default.
 if color.isEnabled() then
-   printc(color.default())
+   printc(core.KEYSTR_RESET)
 end
 try_include("local")
-if not core.isMenuSkipped() then
-   menu = require("menu")
-end
 password.check()
--- menu might be disabled
-if menu ~= nil then
-   menu.run()
+if not core.isMenuSkipped() then
+   require("menu").run()
 else
-- Load kernel/modules before we go
config.loadelf()
___
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: r360598 - stable/11/stand/lua

2020-05-02 Thread Kyle Evans
Author: kevans
Date: Sun May  3 03:56:17 2020
New Revision: 360598
URL: https://svnweb.freebsd.org/changeset/base/360598

Log:
  MFC r360199: menu.lua: Give names to menu entries
  
  Make menu customizations easier by naming the entries and using the
  names to build the table entries.

Modified:
  stable/11/stand/lua/menu.lua
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/lua/menu.lua
==
--- stable/11/stand/lua/menu.luaSun May  3 03:54:49 2020
(r360597)
+++ stable/11/stand/lua/menu.luaSun May  3 03:56:17 2020
(r360598)
@@ -212,30 +212,50 @@ menu.boot_options = {
 menu.welcome = {
entries = function()
local menu_entries = menu.welcome.all_entries
-   -- Swap the first two menu items on single user boot
+   local multi_user = menu_entries.multi_user
+   local single_user = menu_entries.single_user
+   local boot_entry_1, boot_entry_2
if core.isSingleUserBoot() then
-   -- We'll cache the swapped menu, for performance
-   if menu.welcome.swapped_menu ~= nil then
-   return menu.welcome.swapped_menu
+   -- Swap the first two menu items on single user boot.
+   -- We'll cache the alternate entries for performance.
+   local alts = menu_entries.alts
+   if alts == nil then
+   single_user = core.deepCopyTable(single_user)
+   multi_user = core.deepCopyTable(multi_user)
+   single_user.name = single_user.alternate_name
+   multi_user.name = multi_user.alternate_name
+   menu_entries.alts = {
+   single_user = single_user,
+   multi_user = multi_user,
+   }
+   else
+   single_user = alts.single_user 
+   multi_user = alts.multi_user
end
-   -- Shallow copy the table
-   menu_entries = core.deepCopyTable(menu_entries)
-
-   -- Swap the first two menu entries
-   menu_entries[1], menu_entries[2] =
-   menu_entries[2], menu_entries[1]
-
-   -- Then set their names to their alternate names
-   menu_entries[1].name, menu_entries[2].name =
-   menu_entries[1].alternate_name,
-   menu_entries[2].alternate_name
-   menu.welcome.swapped_menu = menu_entries
+   boot_entry_1, boot_entry_2 = single_user, multi_user
+   else
+   boot_entry_1, boot_entry_2 = multi_user, single_user
end
-   return menu_entries
+   return {
+   boot_entry_1,
+   boot_entry_2,
+   menu_entries.prompt,
+   menu_entries.reboot,
+   {
+   entry_type = core.MENU_SEPARATOR,
+   },
+   {
+   entry_type = core.MENU_SEPARATOR,
+   name = "Options:",
+   },
+   menu_entries.kernel_options,
+   menu_entries.boot_options,
+   menu_entries.boot_envs,
+   menu_entries.chainload,
+   }
end,
all_entries = {
-   -- boot multi user
-   {
+   multi_user = {
entry_type = core.MENU_ENTRY,
name = color.highlight("B") .. "oot Multi user " ..
color.highlight("[Enter]"),
@@ -248,8 +268,7 @@ menu.welcome = {
end,
alias = {"b", "B"},
},
-   -- boot single user
-   {
+   single_user = {
entry_type = core.MENU_ENTRY,
name = "Boot " .. color.highlight("S") .. "ingle user",
-- Not a standard menu entry function!
@@ -261,8 +280,7 @@ menu.welcome = {
end,
alias = {"s", "S"},
},
-   -- escape to interpreter
-   {
+   prompt = {
entry_type = core.MENU_RETURN,
name = color.highlight("Esc") .. "ape to loader prompt",
func = function()
@@ -270,8 +288,7 @@ menu.welcome = {
   

svn commit: r360597 - stable/11/stand/lua

2020-05-02 Thread Kyle Evans
Author: kevans
Date: Sun May  3 03:54:49 2020
New Revision: 360597
URL: https://svnweb.freebsd.org/changeset/base/360597

Log:
  MFC r352601: loader_lua: lua color changes should end with reset
  
  The color change should have reset sequence, not switch to white.

Modified:
  stable/11/stand/lua/color.lua
  stable/11/stand/lua/logo-beastie.lua
  stable/11/stand/lua/logo-orb.lua
  stable/11/stand/lua/menu.lua
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/lua/color.lua
==
--- stable/11/stand/lua/color.lua   Sun May  3 03:53:38 2020
(r360596)
+++ stable/11/stand/lua/color.lua   Sun May  3 03:54:49 2020
(r360597)
@@ -47,7 +47,7 @@ color.MAGENTA = 5
 color.CYAN= 6
 color.WHITE   = 7
 
-color.DEFAULT = 0
+color.DEFAULT = 9
 color.BRIGHT  = 1
 color.DIM = 2
 
@@ -70,7 +70,7 @@ function color.resetfg()
if color.disabled then
return ''
end
-   return color.escapefg(color.WHITE)
+   return color.escapefg(color.DEFAULT)
 end
 
 function color.escapebg(color_value)
@@ -84,7 +84,7 @@ function color.resetbg()
if color.disabled then
return ''
end
-   return color.escapebg(color.BLACK)
+   return color.escapebg(color.DEFAULT)
 end
 
 function color.escape(fg_color, bg_color, attribute)
@@ -104,7 +104,7 @@ function color.default()
if color.disabled then
return ""
end
-   return color.escape(color.WHITE, color.BLACK, color.DEFAULT)
+   return color.escape(color.DEFAULT, color.DEFAULT)
 end
 
 function color.highlight(str)

Modified: stable/11/stand/lua/logo-beastie.lua
==
--- stable/11/stand/lua/logo-beastie.luaSun May  3 03:53:38 2020
(r360596)
+++ stable/11/stand/lua/logo-beastie.luaSun May  3 03:54:49 2020
(r360597)
@@ -49,7 +49,7 @@ local beastie_color = {
 "\\   /   /\\",
 "   \027[36m__\027[31m( (_  / \\__/",
 " \027[36m,'  ,-'   |",
-" `--{__)\027[37m"
+" `--{__)\027[m"
 }
 
 drawer.addLogo("beastie", {

Modified: stable/11/stand/lua/logo-orb.lua
==
--- stable/11/stand/lua/logo-orb.luaSun May  3 03:53:38 2020
(r360596)
+++ stable/11/stand/lua/logo-orb.luaSun May  3 03:54:49 2020
(r360597)
@@ -45,7 +45,7 @@ local orb_color = {
 "   --  \027[31;1m-.\027[31m",
 "`:`  \027[31;1m`:`",
 "  \027[31;1m.-- `--.",
-" .---..\027[37m"
+" .---..\027[m"
 }
 
 drawer.addLogo("orb", {

Modified: stable/11/stand/lua/menu.lua
==
--- stable/11/stand/lua/menu.luaSun May  3 03:53:38 2020
(r360596)
+++ stable/11/stand/lua/menu.luaSun May  3 03:54:49 2020
(r360597)
@@ -47,10 +47,10 @@ local return_menu_entry = {
 local function OnOff(str, value)
if value then
return str .. color.escapefg(color.GREEN) .. "On" ..
-   color.escapefg(color.WHITE)
+   color.resetfg()
else
return str .. color.escapefg(color.RED) .. "off" ..
-   color.escapefg(color.WHITE)
+   color.resetfg()
end
 end
 
___
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: r360596 - in stable: 11/stand/defaults 11/stand/lua 12/stand/defaults 12/stand/lua

2020-05-02 Thread Kyle Evans
Author: kevans
Date: Sun May  3 03:53:38 2020
New Revision: 360596
URL: https://svnweb.freebsd.org/changeset/base/360596

Log:
  MFC lualoader read-conf support: r360420-r360423, r360425, r360427, r360486,
  \r360505-r360506
  
  r360420:
  lualoader config: don't call loader.getenv() as much
  
  We don't actually need to fetch loader_conf_files as much as we do; we've
  already fetched it once at the beginning, we only really need to fetch it
  again after each file we've processed. If it changes, then we can stash that
  off into our local prefiles.
  
  While here, drop a note about the recursion so that I stop trying to
  change it. It may very well make redundant some of the work we're doing, but
  that's OK.
  
  r360421:
  lualoader: config: start exporting readConfFiles
  
  In the process, change it slightly: readConfFiles will take a string like
  loader_conf_files in addition to the loaded_files table that it normally
  takes. This is to facilitate the addition of a read-conf CLI command, which
  will just pass in the single file to read and an empty table.
  
  r360422:
  lualoader: cli: add read-conf
  
  This is a straightforward match to the command used by many in forthloader;
  it uses the newly-exported config.readConfFiles() to make sure that any
  loader_conf_files gets done as appropriate.
  
  r360423:
  lualoader: cli: clobber loader_conf_files before proceeding
  
  This makes sure that config.readConfFiles doesn't see a stale
  loader_conf_files from before, in case the newly loaded file doesn't set it.
  
  r360425:
  config.lua(8): "may should" is not proper grammar
  
  r360427:
  config.lua(8): catch up to recently added hooks
  
  While we're here, let's stylize these as functions instead of just raw text.
  A future change may allow arbitrary data arguments to be passed some of
  these, and the distinction is useful.
  
  r360486:
  loader.conf(5): document that loader_conf_files may be clobbered
  
  A future change in lualoader may take some liberties with the
  loader_conf_files in the name of efficiency; namely, it may start omitting
  it from the loader environment entirely so that it doesn't need to worry
  about maintaining any specific value.
  
  This variable has historically been incredibly volatile anyways, as it may
  get set to completely different values in any given configuration file to
  trigger a load of more files.
  
  Document now that we may not maintain it in the future, but perhaps we'll
  reserve the right to change our minds and eventually formally export all of
  the loader configuration files that were read using this variable.
  
  r360505:
  lualoader: config: add a table for restricted environment vars
  
  This new table should be used for transient values that don't need to end up
  in the loader environment. Generally, these will be things that are internal
  details that really aren't needed or interesting outside of the config
  module (e.g. if we changed how ${module}_* directives work, they might use
  this instead).
  
  To start, populate it with loader_conf_files. Any specific value of
  loader_conf_files isn't all that interesting; if we're going to export it,
  we should really instead export a loader_conf_files that indicates all of
  the configuration files we processed. This will be used to reduce
  bookkeeping overhead in a future commit that cleans up readConfFiles.
  
  r360506:
  lualoader: config: improve readConfFiles, rename to readConf
  
  The previous interface was pretty bad, and required the caller to get some
  implementation details correct that it really shouldn't need to (e.g.
  loader_conf_files handling) and pass in an empty table for it to use.
  
  The new and much improved interface, readConf, is much less of a hack;
  hiding these implementation details and just doing the right thing.
  config.lua will now use it to process /boot/defaults/loader.conf and the
  subsequent loader_conf_files from there, and read-conf will also use it.
  
  This improvement submitted by Olivier (cited below), loader_conf_files
  handling from the original patch was changed to just clobber it before
  processing and not bother restoring it after the fact following r360505
  where it's now guaranteed to evade the loader environment.
  
  PR:   244640

Modified:
  stable/11/stand/defaults/loader.conf.5
  stable/11/stand/lua/cli.lua
  stable/11/stand/lua/config.lua
  stable/11/stand/lua/config.lua.8
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/stand/defaults/loader.conf.5
  stable/12/stand/lua/cli.lua
  stable/12/stand/lua/config.lua
  stable/12/stand/lua/config.lua.8
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/stand/defaults/loader.conf.5
==
--- stable/11/stand/defaults/loader.conf.5  Sun May  3 03:44:58 2020
(r360595)
+++ stable/1

svn commit: r360596 - in stable: 11/stand/defaults 11/stand/lua 12/stand/defaults 12/stand/lua

2020-05-02 Thread Kyle Evans
Author: kevans
Date: Sun May  3 03:53:38 2020
New Revision: 360596
URL: https://svnweb.freebsd.org/changeset/base/360596

Log:
  MFC lualoader read-conf support: r360420-r360423, r360425, r360427, r360486,
  \r360505-r360506
  
  r360420:
  lualoader config: don't call loader.getenv() as much
  
  We don't actually need to fetch loader_conf_files as much as we do; we've
  already fetched it once at the beginning, we only really need to fetch it
  again after each file we've processed. If it changes, then we can stash that
  off into our local prefiles.
  
  While here, drop a note about the recursion so that I stop trying to
  change it. It may very well make redundant some of the work we're doing, but
  that's OK.
  
  r360421:
  lualoader: config: start exporting readConfFiles
  
  In the process, change it slightly: readConfFiles will take a string like
  loader_conf_files in addition to the loaded_files table that it normally
  takes. This is to facilitate the addition of a read-conf CLI command, which
  will just pass in the single file to read and an empty table.
  
  r360422:
  lualoader: cli: add read-conf
  
  This is a straightforward match to the command used by many in forthloader;
  it uses the newly-exported config.readConfFiles() to make sure that any
  loader_conf_files gets done as appropriate.
  
  r360423:
  lualoader: cli: clobber loader_conf_files before proceeding
  
  This makes sure that config.readConfFiles doesn't see a stale
  loader_conf_files from before, in case the newly loaded file doesn't set it.
  
  r360425:
  config.lua(8): "may should" is not proper grammar
  
  r360427:
  config.lua(8): catch up to recently added hooks
  
  While we're here, let's stylize these as functions instead of just raw text.
  A future change may allow arbitrary data arguments to be passed some of
  these, and the distinction is useful.
  
  r360486:
  loader.conf(5): document that loader_conf_files may be clobbered
  
  A future change in lualoader may take some liberties with the
  loader_conf_files in the name of efficiency; namely, it may start omitting
  it from the loader environment entirely so that it doesn't need to worry
  about maintaining any specific value.
  
  This variable has historically been incredibly volatile anyways, as it may
  get set to completely different values in any given configuration file to
  trigger a load of more files.
  
  Document now that we may not maintain it in the future, but perhaps we'll
  reserve the right to change our minds and eventually formally export all of
  the loader configuration files that were read using this variable.
  
  r360505:
  lualoader: config: add a table for restricted environment vars
  
  This new table should be used for transient values that don't need to end up
  in the loader environment. Generally, these will be things that are internal
  details that really aren't needed or interesting outside of the config
  module (e.g. if we changed how ${module}_* directives work, they might use
  this instead).
  
  To start, populate it with loader_conf_files. Any specific value of
  loader_conf_files isn't all that interesting; if we're going to export it,
  we should really instead export a loader_conf_files that indicates all of
  the configuration files we processed. This will be used to reduce
  bookkeeping overhead in a future commit that cleans up readConfFiles.
  
  r360506:
  lualoader: config: improve readConfFiles, rename to readConf
  
  The previous interface was pretty bad, and required the caller to get some
  implementation details correct that it really shouldn't need to (e.g.
  loader_conf_files handling) and pass in an empty table for it to use.
  
  The new and much improved interface, readConf, is much less of a hack;
  hiding these implementation details and just doing the right thing.
  config.lua will now use it to process /boot/defaults/loader.conf and the
  subsequent loader_conf_files from there, and read-conf will also use it.
  
  This improvement submitted by Olivier (cited below), loader_conf_files
  handling from the original patch was changed to just clobber it before
  processing and not bother restoring it after the fact following r360505
  where it's now guaranteed to evade the loader environment.
  
  PR:   244640

Modified:
  stable/12/stand/defaults/loader.conf.5
  stable/12/stand/lua/cli.lua
  stable/12/stand/lua/config.lua
  stable/12/stand/lua/config.lua.8
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/stand/defaults/loader.conf.5
  stable/11/stand/lua/cli.lua
  stable/11/stand/lua/config.lua
  stable/11/stand/lua/config.lua.8
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/stand/defaults/loader.conf.5
==
--- stable/12/stand/defaults/loader.conf.5  Sun May  3 03:44:58 2020
(r360595)
+++ stable/1

svn commit: r360595 - in stable/12/usr.bin/diff: . tests

2020-05-02 Thread Kyle Evans
Author: kevans
Date: Sun May  3 03:44:58 2020
New Revision: 360595
URL: https://svnweb.freebsd.org/changeset/base/360595

Log:
  MFC r360437: diff(1): don't reject specifying the same format multiple times
  
  This may happen, for instance, if one happens to have an alias of diff to
  diff -up and attempts to specify the amount of context on top of that.
  
  Aliases like this may cause other problems, but if they're really not ever
  generating non-unified diffs then we should at least not break that
  use-case.
  
  In addition, we'll now pick up a format mismatch if -p is specified with
  !contextual && !unified && !unset.
  
  Fix up a small trailing whitespace nit in the tests while we're here, and
  add tests to make sure that we can double up all the formatting options.

Modified:
  stable/12/usr.bin/diff/diff.c
  stable/12/usr.bin/diff/tests/diff_test.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.bin/diff/diff.c
==
--- stable/12/usr.bin/diff/diff.c   Sun May  3 03:44:16 2020
(r360594)
+++ stable/12/usr.bin/diff/diff.c   Sun May  3 03:44:58 2020
(r360595)
@@ -122,6 +122,8 @@ main(int argc, char **argv)
newarg = 1;
diff_context = 3;
diff_format = D_UNSET;
+#defineFORMAT_MISMATCHED(type) \
+   (diff_format != D_UNSET && diff_format != (type))
while ((ch = getopt_long(argc, argv, OPTIONS, longopts, NULL)) != -1) {
switch (ch) {
case '0': case '1': case '2': case '3': case '4':
@@ -142,7 +144,7 @@ main(int argc, char **argv)
break;
case 'C':
case 'c':
-   if (diff_format != D_UNSET)
+   if (FORMAT_MISMATCHED(D_CONTEXT))
conflicting_format();
cflag = 1;
diff_format = D_CONTEXT;
@@ -157,18 +159,18 @@ main(int argc, char **argv)
dflags |= D_MINIMAL;
break;
case 'D':
-   if (diff_format != D_UNSET)
+   if (FORMAT_MISMATCHED(D_IFDEF))
conflicting_format();
diff_format = D_IFDEF;
ifdefname = optarg;
break;
case 'e':
-   if (diff_format != D_UNSET)
+   if (FORMAT_MISMATCHED(D_EDIT))
conflicting_format();
diff_format = D_EDIT;
break;
case 'f':
-   if (diff_format != D_UNSET)
+   if (FORMAT_MISMATCHED(D_REVERSE))
conflicting_format();
diff_format = D_REVERSE;
break;
@@ -202,11 +204,20 @@ main(int argc, char **argv)
Nflag = 1;
break;
case 'n':
-   if (diff_format != D_UNSET)
+   if (FORMAT_MISMATCHED(D_NREVERSE))
conflicting_format();
diff_format = D_NREVERSE;
break;
case 'p':
+   /*
+* If it's not unset and it's not set to context or
+* unified, we'll error out here as a conflicting
+* format.  If it's unset, we'll go ahead and set it to
+* context.
+*/
+   if (FORMAT_MISMATCHED(D_CONTEXT) &&
+   FORMAT_MISMATCHED(D_UNIFIED))
+   conflicting_format();
if (diff_format == D_UNSET)
diff_format = D_CONTEXT;
dflags |= D_PROTOTYPE;
@@ -218,7 +229,7 @@ main(int argc, char **argv)
rflag = 1;
break;
case 'q':
-   if (diff_format != D_UNSET)
+   if (FORMAT_MISMATCHED(D_BRIEF))
conflicting_format();
diff_format = D_BRIEF;
break;
@@ -236,7 +247,7 @@ main(int argc, char **argv)
break;
case 'U':
case 'u':
-   if (diff_format != D_UNSET)
+   if (FORMAT_MISMATCHED(D_UNIFIED))
conflicting_format();
diff_format = D_UNIFIED;
if (optarg != NULL) {
@@ -264,12 +275,12 @@ main(int argc, char **argv)
push_excludes(optarg);
break;
case 'y':
-   if (diff_format != D_UN

svn commit: r360594 - head/sys/netpfil/ipfw

2020-05-02 Thread Ed Maste
Author: emaste
Date: Sun May  3 03:44:16 2020
New Revision: 360594
URL: https://svnweb.freebsd.org/changeset/base/360594

Log:
  ipfw: whitespace fix in SCTP_ABORT_ASSOCIATION case statement comment
  
  Submitted by: Neel Chauhan 
  Reviewed by:  rgrimes, tuexen
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D24602

Modified:
  head/sys/netpfil/ipfw/ip_fw2.c

Modified: head/sys/netpfil/ipfw/ip_fw2.c
==
--- head/sys/netpfil/ipfw/ip_fw2.c  Sun May  3 03:35:10 2020
(r360593)
+++ head/sys/netpfil/ipfw/ip_fw2.c  Sun May  3 03:44:16 2020
(r360594)
@@ -937,7 +937,7 @@ send_reject6(struct ip_fw_args *args, int code, u_int 
 * If the packet contains an ABORT chunk, don't
 * reply.
 * XXX: We should search through all chunks,
-*  but don't do to avoid attacks.
+* but do not do that to avoid attacks.
 */
v_tag = 0;
break;
@@ -1055,7 +1055,7 @@ send_reject(struct ip_fw_args *args, int code, int ipl
 * If the packet contains an ABORT chunk, don't
 * reply.
 * XXX: We should search through all chunks,
-* but don't do to avoid attacks.
+* but do not do that to avoid attacks.
 */
v_tag = 0;
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: r360593 - in stable/11: . lib/libbsm

2020-05-02 Thread Alan Somers
Author: asomers
Date: Sun May  3 03:35:10 2020
New Revision: 360593
URL: https://svnweb.freebsd.org/changeset/base/360593

Log:
  MFC r360087:
  
  libbsm: fix some MLINKS
  
  Add missing MLINKS entries for a few functions. Remove some old typo
  entries.
  
  Reported by:  phk
  Reviewed by:  cem

Modified:
  stable/11/ObsoleteFiles.inc
  stable/11/lib/libbsm/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/ObsoleteFiles.inc
==
--- stable/11/ObsoleteFiles.inc Sun May  3 03:28:06 2020(r360592)
+++ stable/11/ObsoleteFiles.inc Sun May  3 03:35:10 2020(r360593)
@@ -38,6 +38,10 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20200418: Remove bogus man links
+OLD_FILES+=usr/share/man/man3/getauusernam_R.3.gz
+OLD_FILES+=usr/share/man/man3/getauclassnam_3.3.gz
+
 # 20200115: gcc libssp removed
 OLD_FILES+=usr/include/ssp/ssp.h
 OLD_FILES+=usr/include/ssp/stdio.h

Modified: stable/11/lib/libbsm/Makefile
==
--- stable/11/lib/libbsm/Makefile   Sun May  3 03:28:06 2020
(r360592)
+++ stable/11/lib/libbsm/Makefile   Sun May  3 03:35:10 2020
(r360593)
@@ -75,10 +75,11 @@ MAN+=   audit.2 
\
setauid.2
 
 MLINKS=libbsm.3 bsm.3  
\
+   libbsm.3 au_fcntl_cmd_to_bsm.3  \
au_class.3 getauclassent.3  \
au_class.3 getauclassent_r.3\
au_class.3 getauclassnam.3  \
-   au_class.3 getauclassnam_3.3\
+   au_class.3 getauclassnam_r.3\
au_class.3 setauclass.3 \
au_class.3 endauclass.3 \
au_control.3 setac.3\
@@ -126,6 +127,7 @@ MLINKS= libbsm.3 bsm.3  
\
au_token.3 au_to_arg32.3\
au_token.3 au_to_arg64.3\
au_token.3 au_to_arg.3  \
+   au_token.3 au_to_attr32.3   \
au_token.3 au_to_attr64.3   \
au_token.3 au_to_data.3 \
au_token.3 au_to_exit.3 \
@@ -154,6 +156,7 @@ MLINKS= libbsm.3 bsm.3  
\
au_token.3 au_to_sock_inet32.3  \
au_token.3 au_to_sock_inet128.3 \
au_token.3 au_to_sock_inet.3\
+   au_token.3 au_to_socket_ex.3\
au_token.3 au_to_subject32.3\
au_token.3 au_to_subject64.3\
au_token.3 au_to_subject.3  \
@@ -165,6 +168,7 @@ MLINKS= libbsm.3 bsm.3  
\
au_token.3 au_to_exec_env.3 \
au_token.3 au_to_header.3   \
au_token.3 au_to_header32.3 \
+   au_token.3 au_to_header32_ex.3  \
au_token.3 au_to_header64.3 \
au_token.3 au_to_trailer.3  \
au_token.3 au_to_zonename.3 \
@@ -173,7 +177,7 @@ MLINKS= libbsm.3 bsm.3  
\
au_user.3 getauuserent.3\
au_user.3 getauuserent_r.3  \
au_user.3 getauusernam.3\
-   au_user.3 getauusernam_R.3  \
+   au_user.3 getauusernam_r.3  \
au_user.3 au_user_mask.3\
au_user.3 getfauditflags.3  \
getaudit.2 getaudit_addr.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: r360592 - stable/11/cddl/contrib/opensolaris/cmd/zfs

2020-05-02 Thread Alan Somers
Author: asomers
Date: Sun May  3 03:28:06 2020
New Revision: 360592
URL: https://svnweb.freebsd.org/changeset/base/360592

Log:
  MFC r360080:
  
  zfs-program.8: fix orphan .Xr
  
  Reported by:  phk
  Reviewed by:  avg
  Differential Revision:https://reviews.freebsd.org/D24488

Modified:
  stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8
==
--- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8Sun May  3 
03:21:42 2020(r360591)
+++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8Sun May  3 
03:28:06 2020(r360592)
@@ -10,7 +10,7 @@
 .\"
 .\" Copyright (c) 2016, 2017 by Delphix. All rights reserved.
 .\"
-.Dd October 02, 2017
+.Dd April 18, 2020
 .Dt ZFS-PROGRAM 8
 .Os
 .Sh NAME
@@ -283,7 +283,7 @@ EBADF EXDEV   EFBIG
 .Ss API Functions
 For detailed descriptions of the exact behavior of any zfs administrative
 operations, see the main
-.Xr zfs 1
+.Xr zfs 8
 manual page.
 .Bl -tag -width "xx"
 .It Em zfs.debug(msg)
___
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: r360591 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet

2020-05-02 Thread Cy Schubert
Author: cy
Date: Sun May  3 03:21:42 2020
New Revision: 360591
URL: https://svnweb.freebsd.org/changeset/base/360591

Log:
  MFC r360100:
  
  fib4_free_nh_ext is an empty function. It does nothing. Don't call it.

Modified:
  stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==
--- stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sun May  3 
03:09:35 2020(r360590)
+++ stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sun May  3 
03:21:42 2020(r360591)
@@ -710,7 +710,6 @@ ipf_fastroute(m0, mpp, fin, fdp)
struct ifnet *ifp, *sifp;
struct sockaddr_in dst;
struct nhop4_extended nh4;
-   int has_nhop = 0;
u_long fibnum = 0;
u_short ip_off;
frdest_t node;
@@ -793,7 +792,6 @@ ipf_fastroute(m0, mpp, fin, fdp)
goto bad;
}
 
-   has_nhop = 1;
if (ifp == NULL)
ifp = nh4.nh_ifp;
if (nh4.nh_flags & NHF_GATEWAY)
@@ -936,9 +934,6 @@ done:
V_ipfmain.ipf_frouteok[0]++;
else
V_ipfmain.ipf_frouteok[1]++;
-
-   if (has_nhop)
-   fib4_free_nh_ext(fibnum, &nh4);
 
return 0;
 bad:
___
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: r360591 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet

2020-05-02 Thread Cy Schubert
Author: cy
Date: Sun May  3 03:21:42 2020
New Revision: 360591
URL: https://svnweb.freebsd.org/changeset/base/360591

Log:
  MFC r360100:
  
  fib4_free_nh_ext is an empty function. It does nothing. Don't call it.

Modified:
  stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==
--- stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sun May  3 
03:09:35 2020(r360590)
+++ stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sun May  3 
03:21:42 2020(r360591)
@@ -706,7 +706,6 @@ ipf_fastroute(m0, mpp, fin, fdp)
struct ifnet *ifp, *sifp;
struct sockaddr_in dst;
struct nhop4_extended nh4;
-   int has_nhop = 0;
u_long fibnum = 0;
u_short ip_off;
frdest_t node;
@@ -789,7 +788,6 @@ ipf_fastroute(m0, mpp, fin, fdp)
goto bad;
}
 
-   has_nhop = 1;
if (ifp == NULL)
ifp = nh4.nh_ifp;
if (nh4.nh_flags & NHF_GATEWAY)
@@ -932,9 +930,6 @@ done:
V_ipfmain.ipf_frouteok[0]++;
else
V_ipfmain.ipf_frouteok[1]++;
-
-   if (has_nhop)
-   fib4_free_nh_ext(fibnum, &nh4);
 
return 0;
 bad:
___
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: r360590 - stable/11/cddl/usr.sbin/zfsd

2020-05-02 Thread Alan Somers
Author: asomers
Date: Sun May  3 03:09:35 2020
New Revision: 360590
URL: https://svnweb.freebsd.org/changeset/base/360590

Log:
  MFC r360077:
  
  zfsd.8: fix orphan .Xr
  
  Though ZFS is a kernel module, it has no man page in section 4.
  
  Reported by:  phk

Modified:
  stable/11/cddl/usr.sbin/zfsd/zfsd.8
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/usr.sbin/zfsd/zfsd.8
==
--- stable/11/cddl/usr.sbin/zfsd/zfsd.8 Sun May  3 02:23:40 2020
(r360589)
+++ stable/11/cddl/usr.sbin/zfsd/zfsd.8 Sun May  3 03:09:35 2020
(r360590)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 26, 2016
+.Dd April 18, 2020
 .Dt ZFSD 8
 .Os
 .Sh NAME
@@ -96,8 +96,7 @@ If a leaf vdev generates more than 50 I/O errors in a 
 .Nm
 will mark that vdev as
 .Em FAULTED .
-.Xr zfs 4
-will no longer issue any I/Os to it.
+ZFS will no longer issue any I/Os to it.
 .Nm
 will activate a hotspare if one is available.
 .It Checksum errors
@@ -106,8 +105,7 @@ period, then
 .Nm
 will mark that vdev as
 .Em DEGRADED .
-.Xr zfs 4
-will still use it, but zfsd will activate a spare anyway.
+ZFS will still use it, but zfsd will activate a spare anyway.
 .It Spare addition
 If the system administrator adds a hotspare to a pool that is already degraded,
 .Nm
@@ -138,7 +136,6 @@ then reads them back in when next it starts up.
 .El
 .Sh SEE ALSO
 .Xr devctl 4 ,
-.Xr zfs 4 ,
 .Xr zpool 8
 .Sh HISTORY
 .Nm
___
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: r360583 - in head/sys: kern netinet sys

2020-05-02 Thread Gleb Smirnoff
Author: glebius
Date: Sun May  3 00:37:16 2020
New Revision: 360583
URL: https://svnweb.freebsd.org/changeset/base/360583

Log:
  Step 4.2: start divorce of M_EXT and M_EXTPG
  
  They have more differencies than similarities. For now there is lots
  of code that would check for M_EXT only and work correctly on M_EXTPG
  buffers, so still carry M_EXT bit together with M_EXTPG. However,
  prepare some code for explicit check for M_EXTPG.
  
  Reviewed by:  gallatin
  Differential Revision:https://reviews.freebsd.org/D24598

Modified:
  head/sys/kern/kern_mbuf.c
  head/sys/kern/kern_sendfile.c
  head/sys/kern/subr_sglist.c
  head/sys/kern/uipc_mbuf.c
  head/sys/kern/uipc_sockbuf.c
  head/sys/netinet/tcp_output.c
  head/sys/netinet/tcp_pcap.c
  head/sys/sys/mbuf.h

Modified: head/sys/kern/kern_mbuf.c
==
--- head/sys/kern/kern_mbuf.c   Sun May  3 00:27:41 2020(r360582)
+++ head/sys/kern/kern_mbuf.c   Sun May  3 00:37:16 2020(r360583)
@@ -115,7 +115,7 @@ int nmbjumbop;  /* limits number of 
page size jumbo c
 int nmbjumbo9; /* limits number of 9k jumbo clusters */
 int nmbjumbo16;/* limits number of 16k jumbo clusters 
*/
 
-bool mb_use_ext_pgs;   /* use EXT_PGS mbufs for sendfile & TLS */
+bool mb_use_ext_pgs;   /* use M_EXTPG mbufs for sendfile & TLS */
 SYSCTL_BOOL(_kern_ipc, OID_AUTO, mb_use_ext_pgs, CTLFLAG_RWTUN,
 &mb_use_ext_pgs, 0,
 "Use unmapped mbufs for sendfile(2) and TLS offload");
@@ -822,7 +822,7 @@ mb_reclaim(uma_zone_t zone __unused, int pending __unu
 
 /*
  * Free "count" units of I/O from an mbuf chain.  They could be held
- * in EXT_PGS or just as a normal mbuf.  This code is intended to be
+ * in M_EXTPG or just as a normal mbuf.  This code is intended to be
  * called in an error path (I/O error, closed connection, etc).
  */
 void
@@ -831,8 +831,7 @@ mb_free_notready(struct mbuf *m, int count)
int i;
 
for (i = 0; i < count && m != NULL; i++) {
-   if ((m->m_flags & M_EXT) != 0 &&
-   m->m_ext.ext_type == EXT_PGS) {
+   if ((m->m_flags & M_EXTPG) != 0) {
m->m_epg_nrdy--;
if (m->m_epg_nrdy != 0)
continue;
@@ -860,9 +859,8 @@ mb_unmapped_compress(struct mbuf *m)
 * a packet header, it would only be able to hold MHLEN bytes
 * and m_data would have to be initialized differently.
 */
-   KASSERT((m->m_flags & M_PKTHDR) == 0 && (m->m_flags & M_EXT) &&
-   m->m_ext.ext_type == EXT_PGS,
-("%s: m %p !M_EXT or !EXT_PGS or M_PKTHDR", __func__, m));
+   KASSERT((m->m_flags & M_PKTHDR) == 0 && (m->m_flags & M_EXTPG),
+("%s: m %p !M_EXTPG or M_PKTHDR", __func__, m));
KASSERT(m->m_len <= MLEN, ("m_len too large %p", m));
 
if (m->m_ext.ext_flags & EXT_FLAG_EMBREF) {
@@ -902,12 +900,12 @@ mb_unmapped_compress(struct mbuf *m)
  * unmapped data is stored in an mbuf with an EXT_SFBUF external
  * cluster.  These mbufs use an sf_buf to provide a valid KVA for the
  * associated physical page.  They also hold a reference on the
- * original EXT_PGS mbuf to ensure the physical page doesn't go away.
+ * original M_EXTPG mbuf to ensure the physical page doesn't go away.
  * Finally, any TLS trailer data is stored in a regular mbuf.
  *
  * mb_unmapped_free_mext() is the ext_free handler for the EXT_SFBUF
  * mbufs.  It frees the associated sf_buf and releases its reference
- * on the original EXT_PGS mbuf.
+ * on the original M_EXTPG mbuf.
  *
  * _mb_unmapped_to_ext() is a helper function that converts a single
  * unmapped mbuf into a chain of mbufs.
@@ -926,9 +924,9 @@ mb_unmapped_free_mext(struct mbuf *m)
sf = m->m_ext.ext_arg1;
sf_buf_free(sf);
 
-   /* Drop the reference on the backing EXT_PGS mbuf. */
+   /* Drop the reference on the backing M_EXTPG mbuf. */
old_m = m->m_ext.ext_arg2;
-   mb_free_ext(old_m);
+   mb_free_extpg(old_m);
 }
 
 static struct mbuf *
@@ -1109,7 +1107,7 @@ mb_unmapped_to_ext(struct mbuf *top)
 }
 
 /*
- * Allocate an empty EXT_PGS mbuf.  The ext_free routine is
+ * Allocate an empty M_EXTPG mbuf.  The ext_free routine is
  * responsible for freeing any pages backing this mbuf when it is
  * freed.
  */
@@ -1133,7 +1131,6 @@ mb_alloc_ext_pgs(int how, m_ext_free_t ext_free)
m->m_epg_so = NULL;
m->m_data = NULL;
m->m_flags |= (M_EXT | M_RDONLY | M_EXTPG);
-   m->m_ext.ext_type = EXT_PGS;
m->m_ext.ext_flags = EXT_FLAG_EMBREF;
m->m_ext.ext_count = 1;
m->m_ext.ext_size = 0;
@@ -1206,24 +1203,6 @@ mb_free_ext(struct mbuf *m)
uma_zfree(zone_jumbo16, m->m_ext.ext_buf);
uma_zfree(zone_mbuf, mref);
break;
-   case EXT_PGS: 

svn commit: r360582 - in head/sys: dev/cxgbe dev/cxgbe/crypto dev/cxgbe/tom kern sys

2020-05-02 Thread Gleb Smirnoff
Author: glebius
Date: Sun May  3 00:27:41 2020
New Revision: 360582
URL: https://svnweb.freebsd.org/changeset/base/360582

Log:
  Mechanically rename MBUF_EXT_PGS_ASSERT() to M_ASSERTEXTPG() to match
  classical M_ASSERTPKTHDR.
  
  Reviewed by:  gallatin
  Differential Revision:https://reviews.freebsd.org/D24598

Modified:
  head/sys/dev/cxgbe/crypto/t4_kern_tls.c
  head/sys/dev/cxgbe/t4_sge.c
  head/sys/dev/cxgbe/tom/t4_cpl_io.c
  head/sys/kern/kern_mbuf.c
  head/sys/kern/subr_bus_dma.c
  head/sys/kern/subr_sglist.c
  head/sys/kern/uipc_mbuf.c
  head/sys/sys/mbuf.h

Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c
==
--- head/sys/dev/cxgbe/crypto/t4_kern_tls.c Sun May  3 00:21:11 2020
(r360581)
+++ head/sys/dev/cxgbe/crypto/t4_kern_tls.c Sun May  3 00:27:41 2020
(r360582)
@@ -903,7 +903,7 @@ ktls_tcp_payload_length(struct tlspcb *tlsp, struct mb
struct tls_record_layer *hdr;
u_int plen, mlen;
 
-   MBUF_EXT_PGS_ASSERT(m_tls);
+   M_ASSERTEXTPG(m_tls);
hdr = (void *)m_tls->m_epg_hdr;
plen = ntohs(hdr->tls_length);
 
@@ -957,7 +957,7 @@ ktls_payload_offset(struct tlspcb *tlsp, struct mbuf *
u_int mlen;
 #endif
 
-   MBUF_EXT_PGS_ASSERT(m_tls);
+   M_ASSERTEXTPG(m_tls);
hdr = (void *)m_tls->m_epg_hdr;
plen = ntohs(hdr->tls_length);
 #ifdef INVARIANTS
@@ -1002,7 +1002,7 @@ ktls_wr_len(struct tlspcb *tlsp, struct mbuf *m, struc
struct tls_record_layer *hdr;
u_int imm_len, offset, plen, wr_len, tlen;
 
-   MBUF_EXT_PGS_ASSERT(m_tls);
+   M_ASSERTEXTPG(m_tls);
 
/*
 * Determine the size of the TLS record payload to send
@@ -1466,7 +1466,7 @@ ktls_write_tunnel_packet(struct sge_txq *txq, void *ds
M_ASSERTPKTHDR(m);
 
/* Locate the template TLS header. */
-   MBUF_EXT_PGS_ASSERT(m_tls);
+   M_ASSERTEXTPG(m_tls);
 
/* This should always be the last TLS record in a chain. */
MPASS(m_tls->m_next == NULL);
@@ -1593,7 +1593,7 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq 
using_scratch = (eq->sidx - pidx < SGE_MAX_WR_LEN / EQ_ESIZE);
 
/* Locate the TLS header. */
-   MBUF_EXT_PGS_ASSERT(m_tls);
+   M_ASSERTEXTPG(m_tls);
hdr = (void *)m_tls->m_epg_hdr;
plen = TLS_HEADER_LENGTH + ntohs(hdr->tls_length) - m_tls->m_epg_trllen;
 

Modified: head/sys/dev/cxgbe/t4_sge.c
==
--- head/sys/dev/cxgbe/t4_sge.c Sun May  3 00:21:11 2020(r360581)
+++ head/sys/dev/cxgbe/t4_sge.c Sun May  3 00:27:41 2020(r360582)
@@ -2417,7 +2417,7 @@ count_mbuf_ext_pgs(struct mbuf *m, int skip, vm_paddr_
int i, len, off, pglen, pgoff, seglen, segoff;
int nsegs = 0;
 
-   MBUF_EXT_PGS_ASSERT(m);
+   M_ASSERTEXTPG(m);
off = mtod(m, vm_offset_t);
len = m->m_len;
off += skip;

Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c
==
--- head/sys/dev/cxgbe/tom/t4_cpl_io.c  Sun May  3 00:21:11 2020
(r360581)
+++ head/sys/dev/cxgbe/tom/t4_cpl_io.c  Sun May  3 00:27:41 2020
(r360582)
@@ -1927,7 +1927,7 @@ aiotx_free_pgs(struct mbuf *m)
struct kaiocb *job;
vm_page_t pg;
 
-   MBUF_EXT_PGS_ASSERT(m);
+   M_ASSERTEXTPG(m);
job = m->m_ext.ext_arg1;
 #ifdef VERBOSE_TRACES
CTR3(KTR_CXGBE, "%s: completed %d bytes for tid %d", __func__,

Modified: head/sys/kern/kern_mbuf.c
==
--- head/sys/kern/kern_mbuf.c   Sun May  3 00:21:11 2020(r360581)
+++ head/sys/kern/kern_mbuf.c   Sun May  3 00:27:41 2020(r360582)
@@ -941,7 +941,7 @@ _mb_unmapped_to_ext(struct mbuf *m)
volatile u_int *refcnt;
u_int ref_inc = 0;
 
-   MBUF_EXT_PGS_ASSERT(m);
+   M_ASSERTEXTPG(m);
len = m->m_len;
KASSERT(m->m_epg_tls == NULL, ("%s: can't convert TLS mbuf %p",
__func__, m));

Modified: head/sys/kern/subr_bus_dma.c
==
--- head/sys/kern/subr_bus_dma.cSun May  3 00:21:11 2020
(r360581)
+++ head/sys/kern/subr_bus_dma.cSun May  3 00:27:41 2020
(r360582)
@@ -121,7 +121,7 @@ _bus_dmamap_load_mbuf_epg(bus_dma_tag_t dmat, bus_dmam
 {
int error, i, off, len, pglen, pgoff, seglen, segoff;
 
-   MBUF_EXT_PGS_ASSERT(m);
+   M_ASSERTEXTPG(m);
 
len = m->m_len;
error = 0;

Modified: head/sys/kern/subr_sglist.c
==
--- head/sys/kern/subr_sglist.c Sun May  3 00:21:11 2020(r360581)
+++ head/sys/kern/subr_sglist.c Sun May  3 00:27:41 2020(r360582)
@@ -388,7 +388,7 @@ sglist_append_

svn commit: r360581 - in head/sys: dev/cxgbe dev/cxgbe/crypto dev/cxgbe/tom dev/mlx5/mlx5_en kern netinet sys

2020-05-02 Thread Gleb Smirnoff
Author: glebius
Date: Sun May  3 00:21:11 2020
New Revision: 360581
URL: https://svnweb.freebsd.org/changeset/base/360581

Log:
  Step 4.1: mechanically rename M_NOMAP to M_EXTPG
  
  Reviewed by:  gallatin
  Differential Revision:https://reviews.freebsd.org/D24598

Modified:
  head/sys/dev/cxgbe/crypto/t4_kern_tls.c
  head/sys/dev/cxgbe/t4_sge.c
  head/sys/dev/cxgbe/tom/t4_cpl_io.c
  head/sys/dev/cxgbe/tom/t4_tls.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c
  head/sys/kern/kern_mbuf.c
  head/sys/kern/kern_sendfile.c
  head/sys/kern/subr_bus_dma.c
  head/sys/kern/subr_sglist.c
  head/sys/kern/uipc_ktls.c
  head/sys/kern/uipc_mbuf.c
  head/sys/kern/uipc_sockbuf.c
  head/sys/kern/uipc_socket.c
  head/sys/netinet/tcp_output.c
  head/sys/netinet/tcp_pcap.c
  head/sys/sys/mbuf.h

Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c
==
--- head/sys/dev/cxgbe/crypto/t4_kern_tls.c Sun May  3 00:15:18 2020
(r360580)
+++ head/sys/dev/cxgbe/crypto/t4_kern_tls.c Sun May  3 00:21:11 2020
(r360581)
@@ -1208,7 +1208,7 @@ t6_ktls_parse_pkt(struct mbuf *m, int *nsegsp, int *le
 
/* Assume all headers are in 'm' for now. */
MPASS(m->m_next != NULL);
-   MPASS(m->m_next->m_flags & M_NOMAP);
+   MPASS(m->m_next->m_flags & M_EXTPG);
 
tot_len = 0;
 
@@ -1218,7 +1218,7 @@ t6_ktls_parse_pkt(struct mbuf *m, int *nsegsp, int *le
 */
*nsegsp = 0;
for (m_tls = m->m_next; m_tls != NULL; m_tls = m_tls->m_next) {
-   MPASS(m_tls->m_flags & M_NOMAP);
+   MPASS(m_tls->m_flags & M_EXTPG);
 
wr_len = ktls_wr_len(tlsp, m, m_tls, &nsegs);
 #ifdef VERBOSE_TRACES
@@ -2265,7 +2265,7 @@ t6_ktls_write_wr(struct sge_txq *txq, void *dst, struc
 * for that record.
 */
for (m_tls = m->m_next; m_tls != NULL; m_tls = m_tls->m_next) {
-   MPASS(m_tls->m_flags & M_NOMAP);
+   MPASS(m_tls->m_flags & M_EXTPG);
 
/*
 * Determine the initial TCP sequence number for this

Modified: head/sys/dev/cxgbe/t4_sge.c
==
--- head/sys/dev/cxgbe/t4_sge.c Sun May  3 00:15:18 2020(r360580)
+++ head/sys/dev/cxgbe/t4_sge.c Sun May  3 00:21:11 2020(r360581)
@@ -2497,7 +2497,7 @@ count_mbuf_nsegs(struct mbuf *m, int skip, uint8_t *cf
skip -= len;
continue;
}
-   if ((m->m_flags & M_NOMAP) != 0) {
+   if ((m->m_flags & M_EXTPG) != 0) {
*cflags |= MC_NOMAP;
nsegs += count_mbuf_ext_pgs(m, skip, &nextaddr);
skip = 0;
@@ -5836,7 +5836,7 @@ write_ethofld_wr(struct cxgbe_rate_tag *cst, struct fw
immhdrs -= m0->m_len;
continue;
}
-   if (m0->m_flags & M_NOMAP)
+   if (m0->m_flags & M_EXTPG)
sglist_append_mbuf_epg(&sg, m0,
mtod(m0, vm_offset_t), m0->m_len);
 else

Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c
==
--- head/sys/dev/cxgbe/tom/t4_cpl_io.c  Sun May  3 00:15:18 2020
(r360580)
+++ head/sys/dev/cxgbe/tom/t4_cpl_io.c  Sun May  3 00:21:11 2020
(r360581)
@@ -610,7 +610,7 @@ write_tx_sgl(void *dst, struct mbuf *start, struct mbu
 
i = -1;
for (m = start; m != stop; m = m->m_next) {
-   if (m->m_flags & M_NOMAP)
+   if (m->m_flags & M_EXTPG)
rc = sglist_append_mbuf_epg(&sg, m,
mtod(m, vm_offset_t), m->m_len);
else
@@ -731,7 +731,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep
for (m = sndptr; m != NULL; m = m->m_next) {
int n;
 
-   if (m->m_flags & M_NOMAP) {
+   if (m->m_flags & M_EXTPG) {
 #ifdef KERN_TLS
if (m->m_epg_tls != NULL) {
toep->flags |= TPF_KTLS;
@@ -772,7 +772,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep
break;
}
 
-   if (m->m_flags & M_NOMAP)
+   if (m->m_flags & M_EXTPG)
nomap_mbuf_seen = true;
if (max_nsegs_1mbuf < n)
max_nsegs_1mbuf = n;

Modified: head/sys/dev/cxgbe/tom/t4_tls.c
==
--- head/sys/dev/cxgbe/tom/t4_tls.c Sun May  3 00:15:18 2020
(r360580)
+++ head/sys/dev/cxgbe/tom/t4_tl

svn commit: r360579 - in head/sys: dev/cxgbe dev/cxgbe/crypto dev/cxgbe/tom dev/mlx5/mlx5_en kern netinet netinet6 sys

2020-05-02 Thread Gleb Smirnoff
Author: glebius
Date: Sun May  3 00:12:56 2020
New Revision: 360579
URL: https://svnweb.freebsd.org/changeset/base/360579

Log:
  Step 3: anonymize struct mbuf_ext_pgs and move all its fields into mbuf
  within m_epg namespace.
  All edits except the 'struct mbuf' declaration and mb_dupcl() were done
  mechanically with sed:
  
  s/->m_ext_pgs.nrdy/->m_epg_nrdy/g
  s/->m_ext_pgs.hdr_len/->m_epg_hdrlen/g
  s/->m_ext_pgs.trail_len/->m_epg_trllen/g
  s/->m_ext_pgs.first_pg_off/->m_epg_1st_off/g
  s/->m_ext_pgs.last_pg_len/->m_epg_last_len/g
  s/->m_ext_pgs.flags/->m_epg_flags/g
  s/->m_ext_pgs.record_type/->m_epg_record_type/g
  s/->m_ext_pgs.enc_cnt/->m_epg_enc_cnt/g
  s/->m_ext_pgs.tls/->m_epg_tls/g
  s/->m_ext_pgs.so/->m_epg_so/g
  s/->m_ext_pgs.seqno/->m_epg_seqno/g
  s/->m_ext_pgs.stailq/->m_epg_stailq/g
  
  Reviewed by:  gallatin
  Differential Revision:https://reviews.freebsd.org/D24598

Modified:
  head/sys/dev/cxgbe/crypto/t4_kern_tls.c
  head/sys/dev/cxgbe/t4_sge.c
  head/sys/dev/cxgbe/tom/t4_cpl_io.c
  head/sys/dev/cxgbe/tom/t4_tls.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c
  head/sys/kern/kern_mbuf.c
  head/sys/kern/kern_sendfile.c
  head/sys/kern/subr_bus_dma.c
  head/sys/kern/subr_sglist.c
  head/sys/kern/uipc_ktls.c
  head/sys/kern/uipc_mbuf.c
  head/sys/kern/uipc_sockbuf.c
  head/sys/netinet/ip_output.c
  head/sys/netinet/tcp_output.c
  head/sys/netinet6/ip6_output.c
  head/sys/sys/mbuf.h

Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c
==
--- head/sys/dev/cxgbe/crypto/t4_kern_tls.c Sun May  3 00:08:05 2020
(r360578)
+++ head/sys/dev/cxgbe/crypto/t4_kern_tls.c Sun May  3 00:12:56 2020
(r360579)
@@ -922,8 +922,8 @@ ktls_tcp_payload_length(struct tlspcb *tlsp, struct mb
 * trim the length to avoid sending any of the trailer.  There
 * is no way to send a partial trailer currently.
 */
-   if (mlen > TLS_HEADER_LENGTH + plen - m_tls->m_ext_pgs.trail_len)
-   mlen = TLS_HEADER_LENGTH + plen - m_tls->m_ext_pgs.trail_len;
+   if (mlen > TLS_HEADER_LENGTH + plen - m_tls->m_epg_trllen)
+   mlen = TLS_HEADER_LENGTH + plen - m_tls->m_epg_trllen;
 
 
/*
@@ -964,7 +964,7 @@ ktls_payload_offset(struct tlspcb *tlsp, struct mbuf *
mlen = mtod(m_tls, vm_offset_t) + m_tls->m_len;
MPASS(mlen < TLS_HEADER_LENGTH + plen);
 #endif
-   if (mtod(m_tls, vm_offset_t) <= m_tls->m_ext_pgs.hdr_len)
+   if (mtod(m_tls, vm_offset_t) <= m_tls->m_epg_hdrlen)
return (0);
if (tlsp->enc_mode == SCMD_CIPH_MODE_AES_GCM) {
/*
@@ -975,8 +975,8 @@ ktls_payload_offset(struct tlspcb *tlsp, struct mbuf *
 * the offset at the last byte of the record payload
 * to send the last cipher block.
 */
-   offset = min(mtod(m_tls, vm_offset_t) - 
m_tls->m_ext_pgs.hdr_len,
-   (plen - TLS_HEADER_LENGTH - m_tls->m_ext_pgs.trail_len) - 
1);
+   offset = min(mtod(m_tls, vm_offset_t) - m_tls->m_epg_hdrlen,
+   (plen - TLS_HEADER_LENGTH - m_tls->m_epg_trllen) - 1);
return (rounddown(offset, AES_BLOCK_LEN));
}
return (0);
@@ -1009,7 +1009,7 @@ ktls_wr_len(struct tlspcb *tlsp, struct mbuf *m, struc
 * excluding header and trailer.
 */
tlen = ktls_tcp_payload_length(tlsp, m_tls);
-   if (tlen <= m_tls->m_ext_pgs.hdr_len) {
+   if (tlen <= m_tls->m_epg_hdrlen) {
/*
 * For requests that only want to send the TLS header,
 * send a tunnelled packet as immediate data.
@@ -1035,7 +1035,7 @@ ktls_wr_len(struct tlspcb *tlsp, struct mbuf *m, struc
}
 
hdr = (void *)m_tls->m_epg_hdr;
-   plen = TLS_HEADER_LENGTH + ntohs(hdr->tls_length) - 
m_tls->m_ext_pgs.trail_len;
+   plen = TLS_HEADER_LENGTH + ntohs(hdr->tls_length) - m_tls->m_epg_trllen;
if (tlen < plen) {
plen = tlen;
offset = ktls_payload_offset(tlsp, m_tls);
@@ -1052,14 +1052,14 @@ ktls_wr_len(struct tlspcb *tlsp, struct mbuf *m, struc
 */
imm_len = 0;
if (offset == 0)
-   imm_len += m_tls->m_ext_pgs.hdr_len;
+   imm_len += m_tls->m_epg_hdrlen;
if (plen == tlen)
imm_len += AES_BLOCK_LEN;
wr_len += roundup2(imm_len, 16);
 
/* TLS record payload via DSGL. */
-   *nsegsp = sglist_count_mbuf_epg(m_tls, m_tls->m_ext_pgs.hdr_len + 
offset,
-   plen - (m_tls->m_ext_pgs.hdr_len + offset));
+   *nsegsp = sglist_count_mbuf_epg(m_tls, m_tls->m_epg_hdrlen + offset,
+   plen - (m_tls->m_epg_hdrlen + offset));
wr_len += ktls_sgl_size(*nsegsp);
 
wr_len = roundup2(wr_len, 16);
@@ -1595,18 +1595,18 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq 
/* Locate t

svn commit: r360578 - head/sys/kern

2020-05-02 Thread Gleb Smirnoff
Author: glebius
Date: Sun May  3 00:08:05 2020
New Revision: 360578
URL: https://svnweb.freebsd.org/changeset/base/360578

Log:
  Step 2.5: Stop using 'struct mbuf_ext_pgs' in the kernel itself.
  
  Reviewed by:  gallatin
  Differential Revision:https://reviews.freebsd.org/D24598

Modified:
  head/sys/kern/kern_mbuf.c
  head/sys/kern/kern_sendfile.c
  head/sys/kern/uipc_ktls.c
  head/sys/kern/uipc_mbuf.c
  head/sys/kern/uipc_sockbuf.c

Modified: head/sys/kern/kern_mbuf.c
==
--- head/sys/kern/kern_mbuf.c   Sun May  3 00:03:39 2020(r360577)
+++ head/sys/kern/kern_mbuf.c   Sun May  3 00:08:05 2020(r360578)
@@ -934,7 +934,6 @@ mb_unmapped_free_mext(struct mbuf *m)
 static struct mbuf *
 _mb_unmapped_to_ext(struct mbuf *m)
 {
-   struct mbuf_ext_pgs *ext_pgs;
struct mbuf *m_new, *top, *prev, *mref;
struct sf_buf *sf;
vm_page_t pg;
@@ -943,9 +942,8 @@ _mb_unmapped_to_ext(struct mbuf *m)
u_int ref_inc = 0;
 
MBUF_EXT_PGS_ASSERT(m);
-   ext_pgs = &m->m_ext_pgs;
len = m->m_len;
-   KASSERT(ext_pgs->tls == NULL, ("%s: can't convert TLS mbuf %p",
+   KASSERT(m->m_ext_pgs.tls == NULL, ("%s: can't convert TLS mbuf %p",
__func__, m));
 
/* See if this is the mbuf that holds the embedded refcount. */
@@ -963,11 +961,11 @@ _mb_unmapped_to_ext(struct mbuf *m)
off = mtod(m, vm_offset_t);
 
top = NULL;
-   if (ext_pgs->hdr_len != 0) {
-   if (off >= ext_pgs->hdr_len) {
-   off -= ext_pgs->hdr_len;
+   if (m->m_ext_pgs.hdr_len != 0) {
+   if (off >= m->m_ext_pgs.hdr_len) {
+   off -= m->m_ext_pgs.hdr_len;
} else {
-   seglen = ext_pgs->hdr_len - off;
+   seglen = m->m_ext_pgs.hdr_len - off;
segoff = off;
seglen = min(seglen, len);
off = 0;
@@ -981,8 +979,8 @@ _mb_unmapped_to_ext(struct mbuf *m)
seglen);
}
}
-   pgoff = ext_pgs->first_pg_off;
-   for (i = 0; i < ext_pgs->npgs && len > 0; i++) {
+   pgoff = m->m_ext_pgs.first_pg_off;
+   for (i = 0; i < m->m_ext_pgs.npgs && len > 0; i++) {
pglen = m_epg_pagelen(m, i, pgoff);
if (off >= pglen) {
off -= pglen;
@@ -1018,9 +1016,9 @@ _mb_unmapped_to_ext(struct mbuf *m)
pgoff = 0;
};
if (len != 0) {
-   KASSERT((off + len) <= ext_pgs->trail_len,
+   KASSERT((off + len) <= m->m_ext_pgs.trail_len,
("off + len > trail (%d + %d > %d)", off, len,
-   ext_pgs->trail_len));
+   m->m_ext_pgs.trail_len));
m_new = m_get(M_NOWAIT, MT_DATA);
if (m_new == NULL)
goto fail;
@@ -1119,22 +1117,20 @@ struct mbuf *
 mb_alloc_ext_pgs(int how, m_ext_free_t ext_free)
 {
struct mbuf *m;
-   struct mbuf_ext_pgs *ext_pgs;
 
m = m_get(how, MT_DATA);
if (m == NULL)
return (NULL);
 
-   ext_pgs = &m->m_ext_pgs;
-   ext_pgs->npgs = 0;
-   ext_pgs->nrdy = 0;
-   ext_pgs->first_pg_off = 0;
-   ext_pgs->last_pg_len = 0;
-   ext_pgs->flags = 0;
-   ext_pgs->hdr_len = 0;
-   ext_pgs->trail_len = 0;
-   ext_pgs->tls = NULL;
-   ext_pgs->so = NULL;
+   m->m_ext_pgs.npgs = 0;
+   m->m_ext_pgs.nrdy = 0;
+   m->m_ext_pgs.first_pg_off = 0;
+   m->m_ext_pgs.last_pg_len = 0;
+   m->m_ext_pgs.flags = 0;
+   m->m_ext_pgs.hdr_len = 0;
+   m->m_ext_pgs.trail_len = 0;
+   m->m_ext_pgs.tls = NULL;
+   m->m_ext_pgs.so = NULL;
m->m_data = NULL;
m->m_flags |= (M_EXT | M_RDONLY | M_NOMAP);
m->m_ext.ext_type = EXT_PGS;

Modified: head/sys/kern/kern_sendfile.c
==
--- head/sys/kern/kern_sendfile.c   Sun May  3 00:03:39 2020
(r360577)
+++ head/sys/kern/kern_sendfile.c   Sun May  3 00:08:05 2020
(r360578)
@@ -188,7 +188,6 @@ sendfile_free_mext(struct mbuf *m)
 static void
 sendfile_free_mext_pg(struct mbuf *m)
 {
-   struct mbuf_ext_pgs *ext_pgs;
vm_page_t pg;
int flags, i;
bool cache_last;
@@ -197,11 +196,10 @@ sendfile_free_mext_pg(struct mbuf *m)
("%s: m %p !M_EXT or !EXT_PGS", __func__, m));
 
cache_last = m->m_ext.ext_flags & EXT_FLAG_CACHE_LAST;
-   ext_pgs = &m->m_ext_pgs;
flags = (m->m_ext.ext_flags & EXT_FLAG_NOCACHE) != 0 ? VPR_TRYFREE : 0;
 
-   for (i = 0; i < ext_pgs->npgs; i++) {
-   if (cache_last && i == ext_pgs->npgs - 1)
+   for (i = 0; i < m->m_ext_pgs.npgs; i++) {
+   if (cache_last && i == m->m_ext_pgs.npgs - 1)

svn commit: r360577 - in head/sys: kern sys

2020-05-02 Thread Gleb Smirnoff
Author: glebius
Date: Sun May  3 00:03:39 2020
New Revision: 360577
URL: https://svnweb.freebsd.org/changeset/base/360577

Log:
  Make MBUF_EXT_PGS_ASSERT_SANITY() a macro, so that it prints file:line.
  While here, stop using struct mbuf_ext_pgs.
  
  Reviewed by:  gallatin
  Differential Revision:https://reviews.freebsd.org/D24598

Modified:
  head/sys/kern/kern_mbuf.c
  head/sys/sys/mbuf.h

Modified: head/sys/kern/kern_mbuf.c
==
--- head/sys/kern/kern_mbuf.c   Sat May  2 23:58:20 2020(r360576)
+++ head/sys/kern/kern_mbuf.c   Sun May  3 00:03:39 2020(r360577)
@@ -1145,40 +1145,6 @@ mb_alloc_ext_pgs(int how, m_ext_free_t ext_free)
return (m);
 }
 
-#ifdef INVARIANT_SUPPORT
-void
-mb_ext_pgs_check(struct mbuf *m)
-{
-   struct mbuf_ext_pgs *ext_pgs = &m->m_ext_pgs;
-
-   /*
-* NB: This expects a non-empty buffer (npgs > 0 and
-* last_pg_len > 0).
-*/
-   KASSERT(ext_pgs->npgs > 0,
-   ("ext_pgs with no valid pages: %p", ext_pgs));
-   KASSERT(ext_pgs->npgs <= nitems(m->m_epg_pa),
-   ("ext_pgs with too many pages: %p", ext_pgs));
-   KASSERT(ext_pgs->nrdy <= ext_pgs->npgs,
-   ("ext_pgs with too many ready pages: %p", ext_pgs));
-   KASSERT(ext_pgs->first_pg_off < PAGE_SIZE,
-   ("ext_pgs with too large page offset: %p", ext_pgs));
-   KASSERT(ext_pgs->last_pg_len > 0,
-   ("ext_pgs with zero last page length: %p", ext_pgs));
-   KASSERT(ext_pgs->last_pg_len <= PAGE_SIZE,
-   ("ext_pgs with too large last page length: %p", ext_pgs));
-   if (ext_pgs->npgs == 1) {
-   KASSERT(ext_pgs->first_pg_off + ext_pgs->last_pg_len <=
-   PAGE_SIZE, ("ext_pgs with single page too large: %p",
-   ext_pgs));
-   }
-   KASSERT(ext_pgs->hdr_len <= sizeof(m->m_epg_hdr),
-   ("ext_pgs with too large header length: %p", ext_pgs));
-   KASSERT(ext_pgs->trail_len <= sizeof(m->m_epg_trail),
-   ("ext_pgs with too large header length: %p", ext_pgs));
-}
-#endif
-
 /*
  * Clean up after mbufs with M_EXT storage attached to them if the
  * reference count hits 1.

Modified: head/sys/sys/mbuf.h
==
--- head/sys/sys/mbuf.h Sat May  2 23:58:20 2020(r360576)
+++ head/sys/sys/mbuf.h Sun May  3 00:03:39 2020(r360577)
@@ -401,13 +401,36 @@ m_epg_pagelen(const struct mbuf *m, int pidx, int pgof
}
 }
 
-#ifdef INVARIANT_SUPPORT
-void   mb_ext_pgs_check(struct mbuf *m);
-#endif
 #ifdef INVARIANTS
-#defineMBUF_EXT_PGS_ASSERT_SANITY(m)   mb_ext_pgs_check((m))
+#defineMCHECK(ex, msg) KASSERT((ex),   \
+   ("Multi page mbuf %p with " #msg " at %s:%d",   \
+   m, __FILE__, __LINE__))
+/*
+ * NB: This expects a non-empty buffer (npgs > 0 and
+ * last_pg_len > 0).
+ */
+#defineMBUF_EXT_PGS_ASSERT_SANITY(m)   do {
\
+   MCHECK(m->m_ext_pgs.npgs > 0, "no valid pages");\
+   MCHECK(m->m_ext_pgs.npgs <= nitems(m->m_epg_pa),\
+   "too many pages");  \
+   MCHECK(m->m_ext_pgs.nrdy <= m->m_ext_pgs.npgs,  \
+   "too many ready pages");\
+   MCHECK(m->m_ext_pgs.first_pg_off < PAGE_SIZE,   \
+   "too large page offset");   \
+   MCHECK(m->m_ext_pgs.last_pg_len > 0, "zero last page length");  \
+   MCHECK(m->m_ext_pgs.last_pg_len <= PAGE_SIZE,   \
+   "too large last page length");  \
+   if (m->m_ext_pgs.npgs == 1) \
+   MCHECK(m->m_ext_pgs.first_pg_off +  \
+   m->m_ext_pgs.last_pg_len <=  PAGE_SIZE, \
+   "single page too large");   \
+   MCHECK(m->m_ext_pgs.hdr_len <= sizeof(m->m_epg_hdr),\
+   "too large header length"); \
+   MCHECK(m->m_ext_pgs.trail_len <= sizeof(m->m_epg_trail),\
+   "too large header length"); \
+} while (0)
 #else
-#defineMBUF_EXT_PGS_ASSERT_SANITY(m)
+#defineMBUF_EXT_PGS_ASSERT_SANITY(m)   do {} while (0);
 #endif
 #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: r360576 - in head/sys/dev: cxgbe/crypto cxgbe/tom mlx5/mlx5_en

2020-05-02 Thread Gleb Smirnoff
Author: glebius
Date: Sat May  2 23:58:20 2020
New Revision: 360576
URL: https://svnweb.freebsd.org/changeset/base/360576

Log:
  Step 2.4: Stop using 'struct mbuf_ext_pgs' in drivers.
  
  Reviewed by:  gallatin, hselasky
  Differential Revision:https://reviews.freebsd.org/D24598

Modified:
  head/sys/dev/cxgbe/crypto/t4_kern_tls.c
  head/sys/dev/cxgbe/tom/t4_cpl_io.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c

Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c
==
--- head/sys/dev/cxgbe/crypto/t4_kern_tls.c Sat May  2 23:52:35 2020
(r360575)
+++ head/sys/dev/cxgbe/crypto/t4_kern_tls.c Sat May  2 23:58:20 2020
(r360576)
@@ -900,12 +900,10 @@ ktls_base_wr_size(struct tlspcb *tlsp)
 static u_int
 ktls_tcp_payload_length(struct tlspcb *tlsp, struct mbuf *m_tls)
 {
-   struct mbuf_ext_pgs *ext_pgs;
struct tls_record_layer *hdr;
u_int plen, mlen;
 
MBUF_EXT_PGS_ASSERT(m_tls);
-   ext_pgs = &m_tls->m_ext_pgs;
hdr = (void *)m_tls->m_epg_hdr;
plen = ntohs(hdr->tls_length);
 
@@ -924,8 +922,8 @@ ktls_tcp_payload_length(struct tlspcb *tlsp, struct mb
 * trim the length to avoid sending any of the trailer.  There
 * is no way to send a partial trailer currently.
 */
-   if (mlen > TLS_HEADER_LENGTH + plen - ext_pgs->trail_len)
-   mlen = TLS_HEADER_LENGTH + plen - ext_pgs->trail_len;
+   if (mlen > TLS_HEADER_LENGTH + plen - m_tls->m_ext_pgs.trail_len)
+   mlen = TLS_HEADER_LENGTH + plen - m_tls->m_ext_pgs.trail_len;
 
 
/*
@@ -953,7 +951,6 @@ ktls_tcp_payload_length(struct tlspcb *tlsp, struct mb
 static u_int
 ktls_payload_offset(struct tlspcb *tlsp, struct mbuf *m_tls)
 {
-   struct mbuf_ext_pgs *ext_pgs;
struct tls_record_layer *hdr;
u_int offset, plen;
 #ifdef INVARIANTS
@@ -961,14 +958,13 @@ ktls_payload_offset(struct tlspcb *tlsp, struct mbuf *
 #endif
 
MBUF_EXT_PGS_ASSERT(m_tls);
-   ext_pgs = &m_tls->m_ext_pgs;
hdr = (void *)m_tls->m_epg_hdr;
plen = ntohs(hdr->tls_length);
 #ifdef INVARIANTS
mlen = mtod(m_tls, vm_offset_t) + m_tls->m_len;
MPASS(mlen < TLS_HEADER_LENGTH + plen);
 #endif
-   if (mtod(m_tls, vm_offset_t) <= ext_pgs->hdr_len)
+   if (mtod(m_tls, vm_offset_t) <= m_tls->m_ext_pgs.hdr_len)
return (0);
if (tlsp->enc_mode == SCMD_CIPH_MODE_AES_GCM) {
/*
@@ -979,8 +975,8 @@ ktls_payload_offset(struct tlspcb *tlsp, struct mbuf *
 * the offset at the last byte of the record payload
 * to send the last cipher block.
 */
-   offset = min(mtod(m_tls, vm_offset_t) - ext_pgs->hdr_len,
-   (plen - TLS_HEADER_LENGTH - ext_pgs->trail_len) - 1);
+   offset = min(mtod(m_tls, vm_offset_t) - 
m_tls->m_ext_pgs.hdr_len,
+   (plen - TLS_HEADER_LENGTH - m_tls->m_ext_pgs.trail_len) - 
1);
return (rounddown(offset, AES_BLOCK_LEN));
}
return (0);
@@ -1003,19 +999,17 @@ static int
 ktls_wr_len(struct tlspcb *tlsp, struct mbuf *m, struct mbuf *m_tls,
 int *nsegsp)
 {
-   struct mbuf_ext_pgs *ext_pgs;
struct tls_record_layer *hdr;
u_int imm_len, offset, plen, wr_len, tlen;
 
MBUF_EXT_PGS_ASSERT(m_tls);
-   ext_pgs = &m_tls->m_ext_pgs;
 
/*
 * Determine the size of the TLS record payload to send
 * excluding header and trailer.
 */
tlen = ktls_tcp_payload_length(tlsp, m_tls);
-   if (tlen <= ext_pgs->hdr_len) {
+   if (tlen <= m_tls->m_ext_pgs.hdr_len) {
/*
 * For requests that only want to send the TLS header,
 * send a tunnelled packet as immediate data.
@@ -1041,7 +1035,7 @@ ktls_wr_len(struct tlspcb *tlsp, struct mbuf *m, struc
}
 
hdr = (void *)m_tls->m_epg_hdr;
-   plen = TLS_HEADER_LENGTH + ntohs(hdr->tls_length) - ext_pgs->trail_len;
+   plen = TLS_HEADER_LENGTH + ntohs(hdr->tls_length) - 
m_tls->m_ext_pgs.trail_len;
if (tlen < plen) {
plen = tlen;
offset = ktls_payload_offset(tlsp, m_tls);
@@ -1058,14 +1052,14 @@ ktls_wr_len(struct tlspcb *tlsp, struct mbuf *m, struc
 */
imm_len = 0;
if (offset == 0)
-   imm_len += ext_pgs->hdr_len;
+   imm_len += m_tls->m_ext_pgs.hdr_len;
if (plen == tlen)
imm_len += AES_BLOCK_LEN;
wr_len += roundup2(imm_len, 16);
 
/* TLS record payload via DSGL. */
-   *nsegsp = sglist_count_mbuf_epg(m_tls, ext_pgs->hdr_len + offset,
-   plen - (ext_pgs->hdr_len + offset));
+   *nsegsp = sglist_count_mbuf_epg(m_tls, m_tls->m_ext_pgs.hdr_len + 
offset,
+   plen - (m_tls->m_ext_pgs.hdr_len + offset));
wr_len += ktls_sgl_size(*ns

svn commit: r360575 - in head/sys: dev/cxgbe dev/cxgbe/tom kern sys

2020-05-02 Thread Gleb Smirnoff
Author: glebius
Date: Sat May  2 23:52:35 2020
New Revision: 360575
URL: https://svnweb.freebsd.org/changeset/base/360575

Log:
  Step 2.3: Rename mbuf_ext_pg_len() to m_epg_pagelen() that
uses mbuf argument.
  
  Reviewed by:  gallatin
  Differential Revision:https://reviews.freebsd.org/D24598

Modified:
  head/sys/dev/cxgbe/t4_sge.c
  head/sys/dev/cxgbe/tom/t4_tls.c
  head/sys/kern/kern_mbuf.c
  head/sys/kern/subr_bus_dma.c
  head/sys/kern/subr_sglist.c
  head/sys/kern/uipc_ktls.c
  head/sys/kern/uipc_mbuf.c
  head/sys/sys/mbuf.h

Modified: head/sys/dev/cxgbe/t4_sge.c
==
--- head/sys/dev/cxgbe/t4_sge.c Sat May  2 23:46:29 2020(r360574)
+++ head/sys/dev/cxgbe/t4_sge.c Sat May  2 23:52:35 2020(r360575)
@@ -2441,7 +2441,7 @@ count_mbuf_ext_pgs(struct mbuf *m, int skip, vm_paddr_
}
pgoff = m->m_ext_pgs.first_pg_off;
for (i = 0; i < m->m_ext_pgs.npgs && len > 0; i++) {
-   pglen = mbuf_ext_pg_len(&m->m_ext_pgs, i, pgoff);
+   pglen = m_epg_pagelen(m, i, pgoff);
if (off >= pglen) {
off -= pglen;
pgoff = 0;

Modified: head/sys/dev/cxgbe/tom/t4_tls.c
==
--- head/sys/dev/cxgbe/tom/t4_tls.c Sat May  2 23:46:29 2020
(r360574)
+++ head/sys/dev/cxgbe/tom/t4_tls.c Sat May  2 23:52:35 2020
(r360575)
@@ -1655,13 +1655,13 @@ write_ktlstx_sgl(void *dst, struct mbuf *m, int nsegs)
/* Figure out the first S/G length. */
pa = m->m_epg_pa[0] + m->m_ext_pgs.first_pg_off;
usgl->addr0 = htobe64(pa);
-   len = mbuf_ext_pg_len(&m->m_ext_pgs, 0, m->m_ext_pgs.first_pg_off);
+   len = m_epg_pagelen(m, 0, m->m_ext_pgs.first_pg_off);
pa += len;
for (i = 1; i < m->m_ext_pgs.npgs; i++) {
if (m->m_epg_pa[i] != pa)
break;
-   len += mbuf_ext_pg_len(&m->m_ext_pgs, i, 0);
-   pa += mbuf_ext_pg_len(&m->m_ext_pgs, i, 0);
+   len += m_epg_pagelen(m, i, 0);
+   pa += m_epg_pagelen(m, i, 0);
}
usgl->len0 = htobe32(len);
 #ifdef INVARIANTS
@@ -1679,11 +1679,11 @@ write_ktlstx_sgl(void *dst, struct mbuf *m, int nsegs)
 #endif
pa = m->m_epg_pa[i];
usgl->sge[j / 2].addr[j & 1] = htobe64(pa);
-   len = mbuf_ext_pg_len(&m->m_ext_pgs, i, 0);
+   len = m_epg_pagelen(m, i, 0);
pa += len;
} else {
-   len += mbuf_ext_pg_len(&m->m_ext_pgs, i, 0);
-   pa += mbuf_ext_pg_len(&m->m_ext_pgs, i, 0);
+   len += m_epg_pagelen(m, i, 0);
+   pa += m_epg_pagelen(m, i, 0);
}
}
if (j >= 0) {

Modified: head/sys/kern/kern_mbuf.c
==
--- head/sys/kern/kern_mbuf.c   Sat May  2 23:46:29 2020(r360574)
+++ head/sys/kern/kern_mbuf.c   Sat May  2 23:52:35 2020(r360575)
@@ -983,7 +983,7 @@ _mb_unmapped_to_ext(struct mbuf *m)
}
pgoff = ext_pgs->first_pg_off;
for (i = 0; i < ext_pgs->npgs && len > 0; i++) {
-   pglen = mbuf_ext_pg_len(ext_pgs, i, pgoff);
+   pglen = m_epg_pagelen(m, i, pgoff);
if (off >= pglen) {
off -= pglen;
pgoff = 0;

Modified: head/sys/kern/subr_bus_dma.c
==
--- head/sys/kern/subr_bus_dma.cSat May  2 23:46:29 2020
(r360574)
+++ head/sys/kern/subr_bus_dma.cSat May  2 23:52:35 2020
(r360575)
@@ -145,7 +145,7 @@ _bus_dmamap_load_mbuf_epg(bus_dma_tag_t dmat, bus_dmam
}
pgoff = m->m_ext_pgs.first_pg_off;
for (i = 0; i < m->m_ext_pgs.npgs && error == 0 && len > 0; i++) {
-   pglen = mbuf_ext_pg_len(&m->m_ext_pgs, i, pgoff);
+   pglen = m_epg_pagelen(m, i, pgoff);
if (off >= pglen) {
off -= pglen;
pgoff = 0;

Modified: head/sys/kern/subr_sglist.c
==
--- head/sys/kern/subr_sglist.c Sat May  2 23:46:29 2020(r360574)
+++ head/sys/kern/subr_sglist.c Sat May  2 23:52:35 2020(r360575)
@@ -249,7 +249,7 @@ sglist_count_mbuf_epg(struct mbuf *m, size_t off, size
nextaddr = 0;
pgoff = m->m_ext_pgs.first_pg_off;
for (i = 0; i < m->m_ext_pgs.npgs && len > 0; i++) {
-   pglen = mbuf_ext_pg_len(&m->m_ext_pgs, i, pgoff);
+   pglen = m_epg_pagelen(m, i, pgoff);
if (off >= pglen) {
off -= p

svn commit: r360574 - in head: share/man/man9 sys/dev/cxgbe sys/dev/cxgbe/crypto sys/dev/cxgbe/tom sys/kern sys/sys

2020-05-02 Thread Gleb Smirnoff
Author: glebius
Date: Sat May  2 23:46:29 2020
New Revision: 360574
URL: https://svnweb.freebsd.org/changeset/base/360574

Log:
  Step 2.2:
  o Shrink sglist(9) functions to work with multipage mbufs down from
four functions to two.
  o Don't use 'struct mbuf_ext_pgs *' as argument, use struct mbuf.
  o Rename to something matching _epg.
  
  Reviewed by:  gallatin
  Differential Revision:https://reviews.freebsd.org/D24598

Modified:
  head/share/man/man9/sglist.9
  head/sys/dev/cxgbe/crypto/t4_kern_tls.c
  head/sys/dev/cxgbe/t4_sge.c
  head/sys/dev/cxgbe/tom/t4_cpl_io.c
  head/sys/kern/subr_bus_dma.c
  head/sys/kern/subr_sglist.c
  head/sys/sys/sglist.h

Modified: head/share/man/man9/sglist.9
==
--- head/share/man/man9/sglist.9Sat May  2 23:38:13 2020
(r360573)
+++ head/share/man/man9/sglist.9Sat May  2 23:46:29 2020
(r360574)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 28, 2019
+.Dd April 24, 2020
 .Dt SGLIST 9
 .Os
 .Sh NAME
@@ -34,9 +34,8 @@
 .Nm sglist_alloc ,
 .Nm sglist_append ,
 .Nm sglist_append_bio ,
-.Nm sglist_append_ext_pgs,
-.Nm sglist_append_mb_ext_pgs,
 .Nm sglist_append_mbuf ,
+.Nm sglist_append_mbuf_epg,
 .Nm sglist_append_phys ,
 .Nm sglist_append_sglist ,
 .Nm sglist_append_uio ,
@@ -46,8 +45,7 @@
 .Nm sglist_clone ,
 .Nm sglist_consume_uio ,
 .Nm sglist_count ,
-.Nm sglist_count_ext_pgs ,
-.Nm sglist_count_mb_ext_pgs ,
+.Nm sglist_count_mbuf_epg ,
 .Nm sglist_count_vmpages ,
 .Nm sglist_free ,
 .Nm sglist_hold ,
@@ -68,10 +66,8 @@
 .Ft int
 .Fn sglist_append_bio "struct sglist *sg" "struct bio *bp"
 .Ft int
-.Fn sglist_append_ext_pgs "struct sglist *sg" "struct mbuf_ext_pgs *ext_pgs" 
"size_t offset" "size_t len"
+.Fn sglist_append_mbuf_epg "struct sglist *sg" "struct mbuf *m" "size_t 
offset" "size_t len"
 .Ft int
-.Fn sglist_append_mb_ext_pgs "struct sglist *sg" "struct mbuf *m"
-.Ft int
 .Fn sglist_append_mbuf "struct sglist *sg" "struct mbuf *m"
 .Ft int
 .Fn sglist_append_phys "struct sglist *sg" "vm_paddr_t paddr" "size_t len"
@@ -92,10 +88,8 @@
 .Ft int
 .Fn sglist_count "void *buf" "size_t len"
 .Ft int
-.Fn sglist_count_ext_pgs "struct mbuf_ext_pgs *ext_pgs" "size_t offset" 
"size_t len"
+.Fn sglist_count_mbuf_epg "struct mbuf *m" "size_t offset" "size_t len"
 .Ft int
-.Fn sglist_count_mb_ext_pgs "struct mbuf *m"
-.Ft int
 .Fn sglist_count_vmpages "vm_page_t *m" "size_t pgoff" "size_t len"
 .Ft void
 .Fn sglist_free "struct sglist *sg"
@@ -158,20 +152,15 @@ and is
 bytes long.
 .Pp
 The
-.Nm sglist_count_ext_pgs
+.Nm sglist_count_mbuf_epg
 function returns the number of scatter/gather list elements needed to describe
-the unmapped external mbuf buffer
-.Fa ext_pgs .
+the external multipage mbuf buffer
+.Fa m .
 The ranges start at an offset of
 .Fa offset
 relative to the start of the buffer and is
 .Fa len
 bytes long.
-The
-.Nm sglist_count_mb_ext_pgs
-function returns the number of scatter/gather list elements needed to describe
-the physical address ranges of a single unmapped mbuf
-.Fa m .
 .Pp
 The
 .Nm sglist_count_vmpages
@@ -265,9 +254,11 @@ to the scatter/gather list
 .Fa sg .
 .Pp
 The
-.Nm sglist_append_ext_pgs
-function appends the physical address ranges described by the unmapped
-external mbuf buffer
+.Nm sglist_append_mbuf_epg
+function appends the physical address ranges described by the
+external multipage
+.Xr mbuf 9
+buffer
 .Fa ext_pgs
 to the scatter/gather list
 .Fa sg .
@@ -278,17 +269,9 @@ within
 and continue for
 .Fa len
 bytes.
-.Pp
-The
-.Nm sglist_append_mb_ext_pgs
-function appends the physical address ranges described by the unmapped
-mbuf
-.Fa m
-to the scatter/gather list
-.Fa sg .
 Note that unlike
 .Nm sglist_append_mbuf ,
-.Nm sglist_append_mb_ext_pgs
+.Nm sglist_append_mbuf_epg
 only adds ranges for a single mbuf,
 not an entire mbuf chain.
 .Pp

Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c
==
--- head/sys/dev/cxgbe/crypto/t4_kern_tls.c Sat May  2 23:38:13 2020
(r360573)
+++ head/sys/dev/cxgbe/crypto/t4_kern_tls.c Sat May  2 23:46:29 2020
(r360574)
@@ -1064,7 +1064,7 @@ ktls_wr_len(struct tlspcb *tlsp, struct mbuf *m, struc
wr_len += roundup2(imm_len, 16);
 
/* TLS record payload via DSGL. */
-   *nsegsp = sglist_count_ext_pgs(m_tls, ext_pgs->hdr_len + offset,
+   *nsegsp = sglist_count_mbuf_epg(m_tls, ext_pgs->hdr_len + offset,
plen - (ext_pgs->hdr_len + offset));
wr_len += ktls_sgl_size(*nsegsp);
 
@@ -1799,7 +1799,7 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq 
 
/* Recalculate 'nsegs' if cached value is not available. */
if (nsegs == 0)
-   nsegs = sglist_count_ext_pgs(m_tls, ext_pgs->hdr_len +
+   nsegs = sglist_count_mbuf_epg(m_tls, ext_pgs->hdr_len +
offset, plen - (ext_pgs->hdr_len + offs

svn commit: r360573 - in head/sys: kern sys

2020-05-02 Thread Gleb Smirnoff
Author: glebius
Date: Sat May  2 23:38:13 2020
New Revision: 360573
URL: https://svnweb.freebsd.org/changeset/base/360573

Log:
  Step 2.1: Build TLS workqueue from mbufs, not struct mbuf_ext_pgs.
  
  Reviewed by:  gallatin
  Differential Revision:https://reviews.freebsd.org/D24598

Modified:
  head/sys/kern/kern_mbuf.c
  head/sys/kern/uipc_ktls.c
  head/sys/sys/ktls.h
  head/sys/sys/mbuf.h

Modified: head/sys/kern/kern_mbuf.c
==
--- head/sys/kern/kern_mbuf.c   Sat May  2 22:56:22 2020(r360572)
+++ head/sys/kern/kern_mbuf.c   Sat May  2 23:38:13 2020(r360573)
@@ -1246,7 +1246,6 @@ mb_free_ext(struct mbuf *m)
break;
case EXT_PGS: {
 #ifdef KERN_TLS
-   struct mbuf_ext_pgs *pgs;
struct ktls_session *tls;
 #endif
 
@@ -1254,11 +1253,10 @@ mb_free_ext(struct mbuf *m)
("%s: ext_free not set", __func__));
mref->m_ext.ext_free(mref);
 #ifdef KERN_TLS
-   pgs = &mref->m_ext_pgs;
-   tls = pgs->tls;
+   tls = mref->m_ext_pgs.tls;
if (tls != NULL &&
!refcount_release_if_not_last(&tls->refcount))
-   ktls_enqueue_to_free(pgs);
+   ktls_enqueue_to_free(mref);
else
 #endif
uma_zfree(zone_mbuf, mref);

Modified: head/sys/kern/uipc_ktls.c
==
--- head/sys/kern/uipc_ktls.c   Sat May  2 22:56:22 2020(r360572)
+++ head/sys/kern/uipc_ktls.c   Sat May  2 23:38:13 2020(r360573)
@@ -79,7 +79,7 @@ __FBSDID("$FreeBSD$");
 
 struct ktls_wq {
struct mtx  mtx;
-   STAILQ_HEAD(, mbuf_ext_pgs) head;
+   STAILQ_HEAD(, mbuf) head;
boolrunning;
 } __aligned(CACHE_LINE_SIZE);
 
@@ -1430,16 +1430,19 @@ ktls_frame(struct mbuf *top, struct ktls_session *tls,
 }
 
 void
-ktls_enqueue_to_free(struct mbuf_ext_pgs *pgs)
+ktls_enqueue_to_free(struct mbuf *m)
 {
+   struct mbuf_ext_pgs *pgs;
struct ktls_wq *wq;
bool running;
 
+   pgs = &m->m_ext_pgs;
+
/* Mark it for freeing. */
pgs->flags |= EPG_FLAG_2FREE;
wq = &ktls_wq[pgs->tls->wq_index];
mtx_lock(&wq->mtx);
-   STAILQ_INSERT_TAIL(&wq->head, pgs, stailq);
+   STAILQ_INSERT_TAIL(&wq->head, m, m_ext_pgs.stailq);
running = wq->running;
mtx_unlock(&wq->mtx);
if (!running)
@@ -1472,7 +1475,7 @@ ktls_enqueue(struct mbuf *m, struct socket *so, int pa
 
wq = &ktls_wq[pgs->tls->wq_index];
mtx_lock(&wq->mtx);
-   STAILQ_INSERT_TAIL(&wq->head, pgs, stailq);
+   STAILQ_INSERT_TAIL(&wq->head, m, m_ext_pgs.stailq);
running = wq->running;
mtx_unlock(&wq->mtx);
if (!running)
@@ -1481,11 +1484,12 @@ ktls_enqueue(struct mbuf *m, struct socket *so, int pa
 }
 
 static __noinline void
-ktls_encrypt(struct mbuf_ext_pgs *pgs)
+ktls_encrypt(struct mbuf *top)
 {
struct ktls_session *tls;
struct socket *so;
-   struct mbuf *m, *top;
+   struct mbuf *m;
+   struct mbuf_ext_pgs *pgs;
vm_paddr_t parray[1 + btoc(TLS_MAX_MSG_SIZE_V10_2)];
struct iovec src_iov[1 + btoc(TLS_MAX_MSG_SIZE_V10_2)];
struct iovec dst_iov[1 + btoc(TLS_MAX_MSG_SIZE_V10_2)];
@@ -1493,15 +1497,14 @@ ktls_encrypt(struct mbuf_ext_pgs *pgs)
int error, i, len, npages, off, total_pages;
bool is_anon;
 
-   so = pgs->so;
-   tls = pgs->tls;
-   top = __containerof(pgs, struct mbuf, m_ext_pgs);
-   KASSERT(tls != NULL, ("tls = NULL, top = %p, pgs = %p\n", top, pgs));
-   KASSERT(so != NULL, ("so = NULL, top = %p, pgs = %p\n", top, pgs));
+   so = top->m_ext_pgs.so;
+   tls = top->m_ext_pgs.tls;
+   KASSERT(tls != NULL, ("tls = NULL, top = %p\n", top));
+   KASSERT(so != NULL, ("so = NULL, top = %p\n", top));
 #ifdef INVARIANTS
-   pgs->so = NULL;
+   top->m_ext_pgs.so = NULL;
 #endif
-   total_pages = pgs->enc_cnt;
+   total_pages = top->m_ext_pgs.enc_cnt;
npages = 0;
 
/*
@@ -1631,10 +1634,8 @@ static void
 ktls_work_thread(void *ctx)
 {
struct ktls_wq *wq = ctx;
-   struct mbuf_ext_pgs *p, *n;
-   struct ktls_session *tls;
-   struct mbuf *m;
-   STAILQ_HEAD(, mbuf_ext_pgs) local_head;
+   struct mbuf *m, *n;
+   STAILQ_HEAD(, mbuf) local_head;
 
 #if defined(__aarch64__) || defined(__amd64__) || defined(__i386__)
fpu_kern_thread(0);
@@ -1651,14 +1652,12 @@ ktls_work_thread(void *ctx)
STAILQ_CONCAT(&local_head, &wq->head);
mtx_unlock(&wq->mtx);
 
-   STAILQ_FOREACH_SAFE(p, &local_head, stailq, n) {
-   if

svn commit: r360572 - in head/sys: kern sys

2020-05-02 Thread Gleb Smirnoff
Author: glebius
Date: Sat May  2 22:56:22 2020
New Revision: 360572
URL: https://svnweb.freebsd.org/changeset/base/360572

Log:
  Get rid of the mbuf self-pointing pointer.
  
  Reviewed by:  gallatin
  Differential Revision:https://reviews.freebsd.org/D24598

Modified:
  head/sys/kern/uipc_ktls.c
  head/sys/sys/mbuf.h

Modified: head/sys/kern/uipc_ktls.c
==
--- head/sys/kern/uipc_ktls.c   Sat May  2 22:49:14 2020(r360571)
+++ head/sys/kern/uipc_ktls.c   Sat May  2 22:56:22 2020(r360572)
@@ -1436,7 +1436,7 @@ ktls_enqueue_to_free(struct mbuf_ext_pgs *pgs)
bool running;
 
/* Mark it for freeing. */
-   pgs->mbuf = NULL;
+   pgs->flags |= EPG_FLAG_2FREE;
wq = &ktls_wq[pgs->tls->wq_index];
mtx_lock(&wq->mtx);
STAILQ_INSERT_TAIL(&wq->head, pgs, stailq);
@@ -1463,7 +1463,6 @@ ktls_enqueue(struct mbuf *m, struct socket *so, int pa
KASSERT(pgs->tls->mode == TCP_TLS_MODE_SW, ("!SW TLS mbuf"));
 
pgs->enc_cnt = page_count;
-   pgs->mbuf = m;
 
/*
 * Save a pointer to the socket.  The caller is responsible
@@ -1496,12 +1495,11 @@ ktls_encrypt(struct mbuf_ext_pgs *pgs)
 
so = pgs->so;
tls = pgs->tls;
-   top = pgs->mbuf;
+   top = __containerof(pgs, struct mbuf, m_ext_pgs);
KASSERT(tls != NULL, ("tls = NULL, top = %p, pgs = %p\n", top, pgs));
KASSERT(so != NULL, ("so = NULL, top = %p, pgs = %p\n", top, pgs));
 #ifdef INVARIANTS
pgs->so = NULL;
-   pgs->mbuf = NULL;
 #endif
total_pages = pgs->enc_cnt;
npages = 0;
@@ -1654,14 +1652,14 @@ ktls_work_thread(void *ctx)
mtx_unlock(&wq->mtx);
 
STAILQ_FOREACH_SAFE(p, &local_head, stailq, n) {
-   if (p->mbuf != NULL) {
-   ktls_encrypt(p);
-   counter_u64_add(ktls_cnt_on, -1);
-   } else {
+   if (p->flags & EPG_FLAG_2FREE) {
tls = p->tls;
ktls_free(tls);
m = __containerof(p, struct mbuf, m_ext_pgs);
uma_zfree(zone_mbuf, m);
+   } else {
+   ktls_encrypt(p);
+   counter_u64_add(ktls_cnt_on, -1);
}
}
}

Modified: head/sys/sys/mbuf.h
==
--- head/sys/sys/mbuf.h Sat May  2 22:49:14 2020(r360571)
+++ head/sys/sys/mbuf.h Sat May  2 22:56:22 2020(r360572)
@@ -365,13 +365,13 @@ struct mbuf {
uint16_t last_pg_len;
uint8_t flags;
 #defineEPG_FLAG_ANON   0x1 /* Data can be encrypted in place. */
+#defineEPG_FLAG_2FREE  0x2 /* Scheduled for free. */
uint8_t record_type;
uint8_t spare[2];
int enc_cnt;
struct ktls_session *tls;
struct socket   *so;
uint64_tseqno;
-   struct mbuf *mbuf;
STAILQ_ENTRY(mbuf_ext_pgs) stailq;
} m_ext_pgs;
};
___
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: r360571 - in head/sys: kern sys

2020-05-02 Thread Gleb Smirnoff
Author: glebius
Date: Sat May  2 22:49:14 2020
New Revision: 360571
URL: https://svnweb.freebsd.org/changeset/base/360571

Log:
  Start moving into EPG_/epg_ namespace.  There is only one flag, but
  next commit brings in second flag, so let them already be in the
  future namespace.
  
  Reviewed by:  gallatin
  Differential Revision:https://reviews.freebsd.org/D24598

Modified:
  head/sys/kern/uipc_ktls.c
  head/sys/kern/uipc_mbuf.c
  head/sys/sys/mbuf.h

Modified: head/sys/kern/uipc_ktls.c
==
--- head/sys/kern/uipc_ktls.c   Sat May  2 22:44:23 2020(r360570)
+++ head/sys/kern/uipc_ktls.c   Sat May  2 22:49:14 2020(r360571)
@@ -1545,7 +1545,7 @@ ktls_encrypt(struct mbuf_ext_pgs *pgs)
 * (from sendfile), anonymous wired pages are
 * allocated and assigned to the destination iovec.
 */
-   is_anon = (pgs->flags & MBUF_PEXT_FLAG_ANON) != 0;
+   is_anon = (pgs->flags & EPG_FLAG_ANON) != 0;
 
off = pgs->first_pg_off;
for (i = 0; i < pgs->npgs; i++, off = 0) {
@@ -1601,7 +1601,7 @@ retry_page:
m->m_ext.ext_free = mb_free_mext_pgs;
 
/* Pages are now writable. */
-   pgs->flags |= MBUF_PEXT_FLAG_ANON;
+   pgs->flags |= EPG_FLAG_ANON;
}
 
/*

Modified: head/sys/kern/uipc_mbuf.c
==
--- head/sys/kern/uipc_mbuf.c   Sat May  2 22:44:23 2020(r360570)
+++ head/sys/kern/uipc_mbuf.c   Sat May  2 22:49:14 2020(r360571)
@@ -1678,7 +1678,7 @@ m_uiotombuf_nomap(struct uio *uio, int how, int len, i
prev->m_next = mb;
prev = mb;
pgs = &mb->m_ext_pgs;
-   pgs->flags = MBUF_PEXT_FLAG_ANON;
+   pgs->flags = EPG_FLAG_ANON;
needed = length = MIN(maxseg, total);
for (i = 0; needed > 0; i++, needed -= PAGE_SIZE) {
 retry_page:

Modified: head/sys/sys/mbuf.h
==
--- head/sys/sys/mbuf.h Sat May  2 22:44:23 2020(r360570)
+++ head/sys/sys/mbuf.h Sat May  2 22:49:14 2020(r360571)
@@ -229,8 +229,6 @@ struct pkthdr {
 #defineMBUF_PEXT_MAX_BYTES 
\
 (MBUF_PEXT_MAX_PGS * PAGE_SIZE + MBUF_PEXT_HDR_LEN + MBUF_PEXT_TRAIL_LEN)
 
-#define MBUF_PEXT_FLAG_ANON1   /* Data can be encrypted in place. */
-
 struct ktls_session;
 struct socket;
 
@@ -366,6 +364,7 @@ struct mbuf {
uint16_t first_pg_off;
uint16_t last_pg_len;
uint8_t flags;
+#defineEPG_FLAG_ANON   0x1 /* Data can be encrypted in place. */
uint8_t record_type;
uint8_t spare[2];
int enc_cnt;
___
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: r360570 - head/sys/kern

2020-05-02 Thread Gleb Smirnoff
Author: glebius
Date: Sat May  2 22:44:23 2020
New Revision: 360570
URL: https://svnweb.freebsd.org/changeset/base/360570

Log:
  In mb_unmapped_compress() we don't need mbuf structure to keep data,
  but we need buffer of MLEN bytes.  This isn't just a simplification,
  but important fixup, because previous commit shrinked sizeof(struct
  mbuf) down below MSIZE, and instantiating an mbuf on stack no longer
  provides enough data.
  
  Reviewed by:  gallatin
  Differential Revision:https://reviews.freebsd.org/D24598

Modified:
  head/sys/kern/kern_mbuf.c

Modified: head/sys/kern/kern_mbuf.c
==
--- head/sys/kern/kern_mbuf.c   Sat May  2 22:39:26 2020(r360569)
+++ head/sys/kern/kern_mbuf.c   Sat May  2 22:44:23 2020(r360570)
@@ -853,7 +853,7 @@ int
 mb_unmapped_compress(struct mbuf *m)
 {
volatile u_int *refcnt;
-   struct mbuf m_temp;
+   char buf[MLEN];
 
/*
 * Assert that 'm' does not have a packet header.  If 'm' had
@@ -876,12 +876,8 @@ mb_unmapped_compress(struct mbuf *m)
if (*refcnt != 1)
return (EBUSY);
 
-   m_init(&m_temp, M_NOWAIT, MT_DATA, 0);
+   m_copydata(m, 0, m->m_len, buf);
 
-   /* copy data out of old mbuf */
-   m_copydata(m, 0, m->m_len, mtod(&m_temp, char *));
-   m_temp.m_len = m->m_len;
-
/* Free the backing pages. */
m->m_ext.ext_free(m);
 
@@ -889,8 +885,8 @@ mb_unmapped_compress(struct mbuf *m)
m->m_flags &= ~(M_EXT | M_RDONLY | M_NOMAP);
m->m_data = m->m_dat;
 
-   /* copy data back into m */
-   m_copydata(&m_temp, 0, m_temp.m_len, mtod(m, char *));
+   /* Copy data back into m. */
+   bcopy(buf, mtod(m, char *), m->m_len);
 
return (0);
 }
___
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: r360569 - in head/sys: dev/cxgbe dev/cxgbe/crypto dev/cxgbe/tom kern sys

2020-05-02 Thread Gleb Smirnoff
Author: glebius
Date: Sat May  2 22:39:26 2020
New Revision: 360569
URL: https://svnweb.freebsd.org/changeset/base/360569

Log:
  Continuation of multi page mbuf redesign from r359919.
  
  The following series of patches addresses three things:
  
  Now that array of pages is embedded into mbuf, we no longer need
  separate structure to pass around, so struct mbuf_ext_pgs is an
  artifact of the first implementation. And struct mbuf_ext_pgs_data
  is a crutch to accomodate the main idea r359919 with minimal churn.
  
  Also, M_EXT of type EXT_PGS are just a synonym of M_NOMAP.
  
  The namespace for the newfeature is somewhat inconsistent and
  sometimes has a lengthy prefixes. In these patches we will
  gradually bring the namespace to "m_epg" prefix for all mbuf
  fields and most functions.
  
  Step 1 of 4:
  
   o Anonymize mbuf_ext_pgs_data, embed in m_ext
   o Embed mbuf_ext_pgs
   o Start documenting all this entanglement
  
  Reviewed by:  gallatin
  Differential Revision:https://reviews.freebsd.org/D24598

Modified:
  head/sys/dev/cxgbe/crypto/t4_kern_tls.c
  head/sys/dev/cxgbe/t4_sge.c
  head/sys/dev/cxgbe/tom/t4_cpl_io.c
  head/sys/dev/cxgbe/tom/t4_tls.c
  head/sys/kern/kern_mbuf.c
  head/sys/kern/kern_sendfile.c
  head/sys/kern/subr_bus_dma.c
  head/sys/kern/subr_sglist.c
  head/sys/kern/uipc_ktls.c
  head/sys/kern/uipc_mbuf.c
  head/sys/sys/mbuf.h
  head/sys/sys/sglist.h

Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c
==
--- head/sys/dev/cxgbe/crypto/t4_kern_tls.c Sat May  2 20:47:58 2020
(r360568)
+++ head/sys/dev/cxgbe/crypto/t4_kern_tls.c Sat May  2 22:39:26 2020
(r360569)
@@ -906,7 +906,7 @@ ktls_tcp_payload_length(struct tlspcb *tlsp, struct mb
 
MBUF_EXT_PGS_ASSERT(m_tls);
ext_pgs = &m_tls->m_ext_pgs;
-   hdr = (void *)ext_pgs->m_epg_hdr;
+   hdr = (void *)m_tls->m_epg_hdr;
plen = ntohs(hdr->tls_length);
 
/*
@@ -962,7 +962,7 @@ ktls_payload_offset(struct tlspcb *tlsp, struct mbuf *
 
MBUF_EXT_PGS_ASSERT(m_tls);
ext_pgs = &m_tls->m_ext_pgs;
-   hdr = (void *)ext_pgs->m_epg_hdr;
+   hdr = (void *)m_tls->m_epg_hdr;
plen = ntohs(hdr->tls_length);
 #ifdef INVARIANTS
mlen = mtod(m_tls, vm_offset_t) + m_tls->m_len;
@@ -1040,7 +1040,7 @@ ktls_wr_len(struct tlspcb *tlsp, struct mbuf *m, struc
return (wr_len);
}
 
-   hdr = (void *)ext_pgs->m_epg_hdr;
+   hdr = (void *)m_tls->m_epg_hdr;
plen = TLS_HEADER_LENGTH + ntohs(hdr->tls_length) - ext_pgs->trail_len;
if (tlen < plen) {
plen = tlen;
@@ -1064,7 +1064,7 @@ ktls_wr_len(struct tlspcb *tlsp, struct mbuf *m, struc
wr_len += roundup2(imm_len, 16);
 
/* TLS record payload via DSGL. */
-   *nsegsp = sglist_count_ext_pgs(ext_pgs, ext_pgs->hdr_len + offset,
+   *nsegsp = sglist_count_ext_pgs(m_tls, ext_pgs->hdr_len + offset,
plen - (ext_pgs->hdr_len + offset));
wr_len += ktls_sgl_size(*nsegsp);
 
@@ -1543,7 +1543,7 @@ ktls_write_tunnel_packet(struct sge_txq *txq, void *ds
(m->m_pkthdr.l2hlen + m->m_pkthdr.l3hlen + sizeof(*tcp)));
 
/* Copy the subset of the TLS header requested. */
-   copy_to_txd(&txq->eq, (char *)ext_pgs->m_epg_hdr +
+   copy_to_txd(&txq->eq, (char *)m_tls->m_epg_hdr +
mtod(m_tls, vm_offset_t), &out, m_tls->m_len);
txq->imm_wrs++;
 
@@ -1604,7 +1604,7 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq 
/* Locate the TLS header. */
MBUF_EXT_PGS_ASSERT(m_tls);
ext_pgs = &m_tls->m_ext_pgs;
-   hdr = (void *)ext_pgs->m_epg_hdr;
+   hdr = (void *)m_tls->m_epg_hdr;
plen = TLS_HEADER_LENGTH + ntohs(hdr->tls_length) - ext_pgs->trail_len;
 
/* Determine how much of the TLS record to send. */
@@ -1799,7 +1799,7 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq 
 
/* Recalculate 'nsegs' if cached value is not available. */
if (nsegs == 0)
-   nsegs = sglist_count_ext_pgs(ext_pgs, ext_pgs->hdr_len +
+   nsegs = sglist_count_ext_pgs(m_tls, ext_pgs->hdr_len +
offset, plen - (ext_pgs->hdr_len + offset));
 
/* Calculate the size of the TLS work request. */
@@ -2031,7 +2031,7 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq 
/* Populate the TLS header */
out = (void *)(tx_data + 1);
if (offset == 0) {
-   memcpy(out, ext_pgs->m_epg_hdr, ext_pgs->hdr_len);
+   memcpy(out, m_tls->m_epg_hdr, ext_pgs->hdr_len);
out += ext_pgs->hdr_len;
}
 
@@ -2067,7 +2067,7 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq 
 
/* SGL for record payload */
sglist_reset(txq->gl);
-   if (sglist_append_ext_pgs(txq->gl, ext_pgs, ext_pgs->hdr_len + offset,
+   if (sglist_append_ext_pgs(txq->gl, m_t

svn commit: r360568 - head/sys/dev/nvme

2020-05-02 Thread David Bright
Author: dab
Date: Sat May  2 20:47:58 2020
New Revision: 360568
URL: https://svnweb.freebsd.org/changeset/base/360568

Log:
  Fix various Coverity-detected errors in nvme driver
  
  This fixes several Coverity-detected errors in the nvme driver.
  
  CIDs addressed: 1008344, 1009377, 1009380, 1193740, 1305470, 1403975,
  1403980
  
  Reviewed by:  imp@, vangyzen@
  MFC after:5 days
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D24532

Modified:
  head/sys/dev/nvme/nvme.c
  head/sys/dev/nvme/nvme_ctrlr.c
  head/sys/dev/nvme/nvme_ns.c
  head/sys/dev/nvme/nvme_pci.c
  head/sys/dev/nvme/nvme_qpair.c
  head/sys/dev/nvme/nvme_sysctl.c
  head/sys/dev/nvme/nvme_test.c

Modified: head/sys/dev/nvme/nvme.c
==
--- head/sys/dev/nvme/nvme.cSat May  2 20:14:59 2020(r360567)
+++ head/sys/dev/nvme/nvme.cSat May  2 20:47:58 2020(r360568)
@@ -138,7 +138,8 @@ nvme_attach(device_t dev)
ctrlr->config_hook.ich_func = nvme_ctrlr_start_config_hook;
ctrlr->config_hook.ich_arg = ctrlr;
 
-   config_intrhook_establish(&ctrlr->config_hook);
+   if (config_intrhook_establish(&ctrlr->config_hook) != 0)
+   return (ENOMEM);
 
return (0);
 }

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==
--- head/sys/dev/nvme/nvme_ctrlr.c  Sat May  2 20:14:59 2020
(r360567)
+++ head/sys/dev/nvme/nvme_ctrlr.c  Sat May  2 20:47:58 2020
(r360568)
@@ -1335,6 +1335,7 @@ nvme_ctrlr_ioctl(struct cdev *cdev, u_long cmd, caddr_
struct nvme_get_nsid *gnsid = (struct nvme_get_nsid *)arg;
strncpy(gnsid->cdev, device_get_nameunit(ctrlr->dev),
sizeof(gnsid->cdev));
+   gnsid->cdev[sizeof(gnsid->cdev) - 1] = '\0';
gnsid->nsid = 0;
break;
}
@@ -1619,12 +1620,12 @@ nvme_ctrlr_resume(struct nvme_controller *ctrlr)
goto fail;
 
/*
-* Now that we're reset the hardware, we can restart the controller. Any
+* Now that we've reset the hardware, we can restart the controller. Any
 * I/O that was pending is requeued. Any admin commands are aborted with
 * an error. Once we've restarted, take the controller out of reset.
 */
nvme_ctrlr_start(ctrlr, true);
-   atomic_cmpset_32(&ctrlr->is_resetting, 1, 0);
+   (void)atomic_cmpset_32(&ctrlr->is_resetting, 1, 0);
 
return (0);
 fail:
@@ -1635,6 +1636,6 @@ fail:
 */
nvme_printf(ctrlr, "Failed to reset on resume, failing.\n");
nvme_ctrlr_fail(ctrlr);
-   atomic_cmpset_32(&ctrlr->is_resetting, 1, 0);
+   (void)atomic_cmpset_32(&ctrlr->is_resetting, 1, 0);
return (0);
 }

Modified: head/sys/dev/nvme/nvme_ns.c
==
--- head/sys/dev/nvme/nvme_ns.c Sat May  2 20:14:59 2020(r360567)
+++ head/sys/dev/nvme/nvme_ns.c Sat May  2 20:47:58 2020(r360568)
@@ -87,6 +87,7 @@ nvme_ns_ioctl(struct cdev *cdev, u_long cmd, caddr_t a
struct nvme_get_nsid *gnsid = (struct nvme_get_nsid *)arg;
strncpy(gnsid->cdev, device_get_nameunit(ctrlr->dev),
sizeof(gnsid->cdev));
+   gnsid->cdev[sizeof(gnsid->cdev) - 1] = '\0';
gnsid->nsid = ns->id;
break;
}

Modified: head/sys/dev/nvme/nvme_pci.c
==
--- head/sys/dev/nvme/nvme_pci.cSat May  2 20:14:59 2020
(r360567)
+++ head/sys/dev/nvme/nvme_pci.cSat May  2 20:47:58 2020
(r360568)
@@ -243,11 +243,9 @@ nvme_ctrlr_configure_intx(struct nvme_controller *ctrl
return (ENOMEM);
}
 
-   bus_setup_intr(ctrlr->dev, ctrlr->res,
+   if (bus_setup_intr(ctrlr->dev, ctrlr->res,
INTR_TYPE_MISC | INTR_MPSAFE, NULL, nvme_ctrlr_intx_handler,
-   ctrlr, &ctrlr->tag);
-
-   if (ctrlr->tag == NULL) {
+   ctrlr, &ctrlr->tag) != 0) {
nvme_printf(ctrlr, "unable to setup intx handler\n");
return (ENOMEM);
}

Modified: head/sys/dev/nvme/nvme_qpair.c
==
--- head/sys/dev/nvme/nvme_qpair.c  Sat May  2 20:14:59 2020
(r360567)
+++ head/sys/dev/nvme/nvme_qpair.c  Sat May  2 20:47:58 2020
(r360568)
@@ -671,9 +671,12 @@ nvme_qpair_construct(struct nvme_qpair *qpair,
 
qpair->res = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ,
&qpair->rid, RF_ACTIVE);
-   bus_setup_intr(ctrlr->dev, qpair->res,
+   if (bus_setup_intr(ctrlr->dev, qpair->res,
INTR_TYPE_MISC | INTR_MP

svn commit: r360567 - in head/tests/sys: fs/fusefs mac/bsdextended

2020-05-02 Thread Alan Somers
Author: asomers
Date: Sat May  2 20:14:59 2020
New Revision: 360567
URL: https://svnweb.freebsd.org/changeset/base/360567

Log:
  Resolve conflict between the fusefs(5) and mac_bsdextended(4) tests
  
  mac_bsdextended(4), when enabled, causes ordinary operations to send many
  more VOP_GETATTRs to file system. The fusefs tests expectations aren't
  written with those in mind. Optionally expecting them would greatly
  obfuscate the fusefs tests. Worse, certain fusefs functionality (like
  attribute caching) would be impossible to test if the tests couldn't expect
  an exact number of GETATTR operations.
  
  This commit resolves that conflict by making two changes:
  
  1. The fusefs tests will now check for mac_bsdextended, and skip if it's
 enabled.
  2. The mac_bsdextended tests will now check whether the module is enabled, not
 merely loaded. If it's loaded but disabled, the tests will automatically
 enable it for the duration of the tests.
  
  With these changes, a CI system can achieve best coverage by loading both
  fusefs and mac_bsdextended at boot, and setting
  security.mac.bsdextended.enabled=0
  
  PR:   244229
  Reported by:  lwhsu
  Reviewed by:  cem
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D24577

Modified:
  head/tests/sys/fs/fusefs/utils.cc
  head/tests/sys/mac/bsdextended/matches_test.sh

Modified: head/tests/sys/fs/fusefs/utils.cc
==
--- head/tests/sys/fs/fusefs/utils.cc   Sat May  2 18:54:25 2020
(r360566)
+++ head/tests/sys/fs/fusefs/utils.cc   Sat May  2 20:14:59 2020
(r360567)
@@ -70,6 +70,10 @@ const uint32_t default_max_write = MIN(libfuse_max_wri
 void check_environment()
 {
const char *devnode = "/dev/fuse";
+   const char *bsdextended_node = "security.mac.bsdextended.enabled";
+   int bsdextended_val = 0;
+   size_t bsdextended_size = sizeof(bsdextended_val);
+   int bsdextended_found;
const char *usermount_node = "vfs.usermount";
int usermount_val = 0;
size_t usermount_size = sizeof(usermount_val);
@@ -83,9 +87,19 @@ void check_environment()
GTEST_SKIP() << strerror(errno);
}
}
+   // mac_bsdextended(4), when enabled, generates many more GETATTR
+   // operations. The fusefs tests' expectations don't account for those,
+   // and adding extra code to handle them obfuscates the real purpose of
+   // the tests.  Better just to skip the fusefs tests if mac_bsdextended
+   // is enabled.
+   bsdextended_found = sysctlbyname(bsdextended_node, &bsdextended_val,
+&bsdextended_size, NULL, 0);
+   if (bsdextended_found == 0 && bsdextended_val != 0)
+   GTEST_SKIP() <<
+   "The fusefs tests are incompatible with mac_bsdextended.";
ASSERT_EQ(sysctlbyname(usermount_node, &usermount_val, &usermount_size,
   NULL, 0),
- 0);;
+ 0);
if (geteuid() != 0 && !usermount_val)
GTEST_SKIP() << "current user is not allowed to mount";
 }

Modified: head/tests/sys/mac/bsdextended/matches_test.sh
==
--- head/tests/sys/mac/bsdextended/matches_test.sh  Sat May  2 18:54:25 
2020(r360566)
+++ head/tests/sys/mac/bsdextended/matches_test.sh  Sat May  2 20:14:59 
2020(r360567)
@@ -16,6 +16,12 @@ check_ko()
if ! sysctl -N security.mac.bsdextended >/dev/null 2>&1; then
atf_skip "mac_bsdextended(4) support isn't available"
fi
+   if [ $(sysctl -n security.mac.bsdextended.enabled) = "0" ]; then
+   # The kernel module is loaded but disabled.  Enable it for the
+   # duration of the test.
+   touch enabled_bsdextended
+   sysctl security.mac.bsdextended.enabled=1
+   fi
 }
 
 setup()
@@ -68,6 +74,9 @@ cleanup()
umount -f mnt
if [ -f md_device ]; then
mdconfig -d -u $( cat md_device )
+   fi
+   if [ -f enabled_bsdextended ]; then
+   sysctl security.mac.bsdextended.enabled=0
fi
 }
 
___
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: r360508 - head/sys/cam/nvme

2020-05-02 Thread Warner Losh
On Sat, May 2, 2020, 12:34 PM Colin Percival  wrote:

> On 2020-04-30 14:08, Warner Losh wrote:
> > Author: imp
> > Date: Thu Apr 30 21:08:59 2020
> > New Revision: 360508
> > URL: https://svnweb.freebsd.org/changeset/base/360508
> >
> >   - Unlock the periph before returning. We don't need to relock it to
> > release the ccb.
>
> You sure about that?  I'm getting a panic here:
>
> panic: mutex CAM device lock not owned at /usr/src/sys/cam/cam_xpt.c:3983
> KDB: stack backtrace:
> db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame
> 0xfe00d8243430
> vpanic() at vpanic+0x182/frame 0xfe00d8243480
> panic() at panic+0x43/frame 0xfe00d82434e0
> __mtx_assert() at __mtx_assert+0xb0/frame 0xfe00d82434f0
> xpt_release_ccb() at xpt_release_ccb+0x30/frame 0xfe00d8243520
> ndaioctl() at ndaioctl+0x241/frame 0xfe00d8243730
>

Hmmm... I'm not.. I need to figure out why... I thought I was running with
invariants...

Warner

-- 
> Colin Percival
> Security Officer Emeritus, FreeBSD | The power to serve
> Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid
>
___
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: r360566 - head/sys/kern

2020-05-02 Thread Conrad Meyer
Author: cem
Date: Sat May  2 18:54:25 2020
New Revision: 360566
URL: https://svnweb.freebsd.org/changeset/base/360566

Log:
  kern_exec.c: Produce valid code ifndef SYS_PROTO_H
  
  Reported by: Coccinelle

Modified:
  head/sys/kern/kern_exec.c

Modified: head/sys/kern/kern_exec.c
==
--- head/sys/kern/kern_exec.c   Sat May  2 17:18:32 2020(r360565)
+++ head/sys/kern/kern_exec.c   Sat May  2 18:54:25 2020(r360566)
@@ -233,7 +233,7 @@ struct fexecve_args {
int fd;
char**argv;
char**envv;
-}
+};
 #endif
 int
 sys_fexecve(struct thread *td, struct fexecve_args *uap)
___
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: r360508 - head/sys/cam/nvme

2020-05-02 Thread Colin Percival
On 2020-04-30 14:08, Warner Losh wrote:
> Author: imp
> Date: Thu Apr 30 21:08:59 2020
> New Revision: 360508
> URL: https://svnweb.freebsd.org/changeset/base/360508
> 
>   - Unlock the periph before returning. We don't need to relock it to
> release the ccb.

You sure about that?  I'm getting a panic here:

panic: mutex CAM device lock not owned at /usr/src/sys/cam/cam_xpt.c:3983
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfe00d8243430
vpanic() at vpanic+0x182/frame 0xfe00d8243480
panic() at panic+0x43/frame 0xfe00d82434e0
__mtx_assert() at __mtx_assert+0xb0/frame 0xfe00d82434f0
xpt_release_ccb() at xpt_release_ccb+0x30/frame 0xfe00d8243520
ndaioctl() at ndaioctl+0x241/frame 0xfe00d8243730

-- 
Colin Percival
Security Officer Emeritus, FreeBSD | The power to serve
Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid
___
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: r360565 - head/sys/opencrypto

2020-05-02 Thread John Baldwin
Author: jhb
Date: Sat May  2 17:18:32 2020
New Revision: 360565
URL: https://svnweb.freebsd.org/changeset/base/360565

Log:
  Actually remove support for Triple DES, not just the warning.
  
  Missed in r360562.

Modified:
  head/sys/opencrypto/cryptodev.c

Modified: head/sys/opencrypto/cryptodev.c
==
--- head/sys/opencrypto/cryptodev.c Sat May  2 16:54:59 2020
(r360564)
+++ head/sys/opencrypto/cryptodev.c Sat May  2 17:18:32 2020
(r360565)
@@ -403,9 +403,6 @@ cryptof_ioctl(
switch (sop->cipher) {
case 0:
break;
-   case CRYPTO_3DES_CBC:
-   txform = &enc_xform_3des;
-   break;
case CRYPTO_AES_CBC:
txform = &enc_xform_rijndael128;
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: r360564 - head/sys/cam/ctl

2020-05-02 Thread Alexander Motin
Author: mav
Date: Sat May  2 16:54:59 2020
New Revision: 360564
URL: https://svnweb.freebsd.org/changeset/base/360564

Log:
  Cleanup LUN addition/removal.
  
   - Make ctl_add_lun() synchronous.  Asynchronous addition was used by
  Copan's proprietary code long ago and never for upstream FreeBSD.
   - Move LUN enable/disable calls from backends to CTL core.
   - Serialize LUN modification and partially removal to avoid double frees.
   - Slightly unify backends code.
  
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_backend.c
  head/sys/cam/ctl/ctl_backend.h
  head/sys/cam/ctl/ctl_backend_block.c
  head/sys/cam/ctl/ctl_backend_ramdisk.c
  head/sys/cam/ctl/ctl_private.h

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Sat May  2 14:23:55 2020(r360563)
+++ head/sys/cam/ctl/ctl.c  Sat May  2 16:54:59 2020(r360564)
@@ -469,10 +469,9 @@ static void ctl_ioctl_fill_ooa(struct ctl_lun *lun, ui
  struct ctl_ooa_entry *kern_entries);
 static int ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
 struct thread *td);
-static int ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *lun,
-struct ctl_be_lun *be_lun);
+static int ctl_enable_lun(struct ctl_lun *lun);
+static int ctl_disable_lun(struct ctl_lun *lun);
 static int ctl_free_lun(struct ctl_lun *lun);
-static void ctl_create_lun(struct ctl_be_lun *be_lun);
 
 static int ctl_do_mode_select(union ctl_io *io);
 static int ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun,
@@ -547,7 +546,6 @@ static int ctl_datamove_remote_xfer(union ctl_io *io, 
 static void ctl_datamove_remote_read(union ctl_io *io);
 static void ctl_datamove_remote(union ctl_io *io);
 static void ctl_process_done(union ctl_io *io);
-static void ctl_lun_thread(void *arg);
 static void ctl_thresh_thread(void *arg);
 static void ctl_work_thread(void *arg);
 static void ctl_enqueue_incoming(union ctl_io *io);
@@ -1945,7 +1943,6 @@ ctl_init(void)
"HA link state (0 - offline, 1 - unknown, 2 - online)");
 
STAILQ_INIT(&softc->lun_list);
-   STAILQ_INIT(&softc->pending_lun_queue);
STAILQ_INIT(&softc->fe_list);
STAILQ_INIT(&softc->port_list);
STAILQ_INIT(&softc->be_list);
@@ -1973,12 +1970,6 @@ ctl_init(void)
return (error);
}
}
-   error = kproc_kthread_add(ctl_lun_thread, softc,
-   &softc->ctl_proc, &softc->lun_thread, 0, 0, "ctl", "lun");
-   if (error != 0) {
-   printf("error creating CTL lun thread!\n");
-   return (error);
-   }
error = kproc_kthread_add(ctl_thresh_thread, softc,
&softc->ctl_proc, &softc->thresh_thread, 0, 0, "ctl", "thresh");
if (error != 0) {
@@ -2020,11 +2011,6 @@ ctl_shutdown(void)
}
mtx_destroy(&thr->queue_lock);
}
-   while (softc->lun_thread != NULL) {
-   wakeup(&softc->pending_lun_queue);
-   if (softc->lun_thread != NULL)
-   pause("CTL thr shutdown", 1);
-   }
while (softc->thresh_thread != NULL) {
wakeup(softc->thresh_thread);
if (softc->thresh_thread != NULL)
@@ -4497,32 +4483,23 @@ hex2bin(const char *str, uint8_t *buf, int buf_size)
 }
 
 /*
- * LUN allocation.
+ * Add LUN.
  *
- * Requirements:
- * - caller allocates and zeros LUN storage, or passes in a NULL LUN if he
- *   wants us to allocate the LUN and he can block.
- * - ctl_softc is always set
- * - be_lun is set if the LUN has a backend (needed for disk LUNs)
- *
  * Returns 0 for success, non-zero (errno) for failure.
  */
-static int
-ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *ctl_lun,
- struct ctl_be_lun *const be_lun)
+int
+ctl_add_lun(struct ctl_be_lun *be_lun)
 {
+   struct ctl_softc *ctl_softc = control_softc;
struct ctl_lun *nlun, *lun;
struct scsi_vpd_id_descriptor *desc;
struct scsi_vpd_id_t10 *t10id;
const char *eui, *naa, *scsiname, *uuid, *vendor, *value;
-   int lun_number, lun_malloced;
+   int lun_number;
int devidlen, idlen1, idlen2 = 0, len;
 
-   if (be_lun == NULL)
-   return (EINVAL);
-
/*
-* We currently only support Direct Access or Processor LUN types.
+* We support only Direct Access, CD-ROM or Processor LUN types.
 */
switch (be_lun->lun_type) {
case T_DIRECT:
@@ -4532,22 +4509,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_
case T_SEQUENTIAL:
case T_CHANGER:
default:
-   be_lun->lun_config_status(be_lun->be_lun,
- CTL_LUN_CONFIG_FAILURE);
-   break;
+ 

svn commit: r360563 - head

2020-05-02 Thread John Baldwin
Author: jhb
Date: Sat May  2 14:23:55 2020
New Revision: 360563
URL: https://svnweb.freebsd.org/changeset/base/360563

Log:
  Document removal of deprecated algorithms from /dev/crypto.

Modified:
  head/RELNOTES

Modified: head/RELNOTES
==
--- head/RELNOTES   Sat May  2 14:20:32 2020(r360562)
+++ head/RELNOTES   Sat May  2 14:23:55 2020(r360563)
@@ -10,6 +10,10 @@ newline.  Entries should be separated by a newline.
 
 Changes to this file should not be MFCed.
 
+r360562:
+   Remove support for ARC4, Blowfish, Cast, DES, Triple DES,
+   MD5-HMAC, and Skipjack algorithms from /dev/crypto.
+
 r360557:
Remove support for DES, Triple DES, Blowfish, Cast, and
Camellia ciphers from IPsec(4).  Remove support for MD5-HMAC,
___
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: r360562 - in head: sys/opencrypto tests/sys/opencrypto

2020-05-02 Thread John Baldwin
Author: jhb
Date: Sat May  2 14:20:32 2020
New Revision: 360562
URL: https://svnweb.freebsd.org/changeset/base/360562

Log:
  Remove support for the algorithms deprecated in r348876.
  
  This removes support for the following algorithms:
  - ARC4
  - Blowfish
  - CAST128
  - DES
  - 3DES
  - MD5-HMAC
  - Skipjack
  
  Since /dev/crypto no longer supports 3DES, stop testing the 3DES KAT
  vectors in cryptotest.py.
  
  Reviewed by:  cem (previous version)
  Relnotes: yes
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D24346

Modified:
  head/sys/opencrypto/cryptodev.c
  head/tests/sys/opencrypto/cryptotest.py

Modified: head/sys/opencrypto/cryptodev.c
==
--- head/sys/opencrypto/cryptodev.c Sat May  2 13:42:03 2020
(r360561)
+++ head/sys/opencrypto/cryptodev.c Sat May  2 14:20:32 2020
(r360562)
@@ -291,11 +291,6 @@ struct fcrypt {
struct mtx  lock;
 };
 
-static struct timeval warninterval = { .tv_sec = 60, .tv_usec = 0 };
-SYSCTL_TIMEVAL_SEC(_kern, OID_AUTO, cryptodev_warn_interval, CTLFLAG_RW,
-&warninterval,
-"Delay in seconds between warnings of deprecated /dev/crypto algorithms");
-
 static int cryptof_ioctl(struct file *, u_long, void *,
struct ucred *, struct thread *);
 static int cryptof_stat(struct file *, struct stat *,
@@ -408,21 +403,9 @@ cryptof_ioctl(
switch (sop->cipher) {
case 0:
break;
-   case CRYPTO_DES_CBC:
-   txform = &enc_xform_des;
-   break;
case CRYPTO_3DES_CBC:
txform = &enc_xform_3des;
break;
-   case CRYPTO_BLF_CBC:
-   txform = &enc_xform_blf;
-   break;
-   case CRYPTO_CAST_CBC:
-   txform = &enc_xform_cast5;
-   break;
-   case CRYPTO_SKIPJACK_CBC:
-   txform = &enc_xform_skipjack;
-   break;
case CRYPTO_AES_CBC:
txform = &enc_xform_rijndael128;
break;
@@ -432,9 +415,6 @@ cryptof_ioctl(
case CRYPTO_NULL_CBC:
txform = &enc_xform_null;
break;
-   case CRYPTO_ARC4:
-   txform = &enc_xform_arc4;
-   break;
case CRYPTO_CAMELLIA_CBC:
txform = &enc_xform_camellia;
break;
@@ -460,9 +440,6 @@ cryptof_ioctl(
switch (sop->mac) {
case 0:
break;
-   case CRYPTO_MD5_HMAC:
-   thash = &auth_hash_hmac_md5;
-   break;
case CRYPTO_POLY1305:
thash = &auth_hash_poly1305;
break;
@@ -847,49 +824,6 @@ cod_free(struct cryptop_data *cod)
free(cod, M_XDATA);
 }
 
-static void
-cryptodev_warn(struct csession *cse)
-{
-   static struct timeval arc4warn, blfwarn, castwarn, deswarn, md5warn;
-   static struct timeval skipwarn, tdeswarn;
-   const struct crypto_session_params *csp;
-
-   csp = crypto_get_params(cse->cses);
-   switch (csp->csp_cipher_alg) {
-   case CRYPTO_DES_CBC:
-   if (ratecheck(&deswarn, &warninterval))
-   gone_in(13, "DES cipher via /dev/crypto");
-   break;
-   case CRYPTO_3DES_CBC:
-   if (ratecheck(&tdeswarn, &warninterval))
-   gone_in(13, "3DES cipher via /dev/crypto");
-   break;
-   case CRYPTO_BLF_CBC:
-   if (ratecheck(&blfwarn, &warninterval))
-   gone_in(13, "Blowfish cipher via /dev/crypto");
-   break;
-   case CRYPTO_CAST_CBC:
-   if (ratecheck(&castwarn, &warninterval))
-   gone_in(13, "CAST128 cipher via /dev/crypto");
-   break;
-   case CRYPTO_SKIPJACK_CBC:
-   if (ratecheck(&skipwarn, &warninterval))
-   gone_in(13, "Skipjack cipher via /dev/crypto");
-   break;
-   case CRYPTO_ARC4:
-   if (ratecheck(&arc4warn, &warninterval))
-   gone_in(13, "ARC4 cipher via /dev/crypto");
-   break;
-   }
-
-   switch (csp->csp_auth_alg) {
-   case CRYPTO_MD5_HMAC:
-   if (ratecheck(&md5warn, &warninterval))
-   gone_in(13, "MD5-HMAC authenticator via /dev/crypto");
-   break;
-   }
-}
-
 static int
 cryptodev_op(
struct csession *cse,
@@ -1040,7 +974,6 @@ cryptodev_op(
goto bail;
}
}
-   cryptodev_warn(cse);
 again:
/*

svn commit: r360561 - stable/12

2020-05-02 Thread John Baldwin
Author: jhb
Date: Sat May  2 13:42:03 2020
New Revision: 360561
URL: https://svnweb.freebsd.org/changeset/base/360561

Log:
  MFC 354661,354693: Fix WITH_CLANG_BOOTSTRAP without WITH_CLANG_IS_CC.
  
  354661:
  Force MK_CLANG_IS_CC on in XMAKE.
  
  This ensures that a bootstrap clang compiler is always installed as cc
  in WORLDTMP.  If it is only installed as 'clang' then /usr/bin/cc is
  used during the build instead of the bootstrap compiler.
  
  354693:
  Refine r354661 to unbreak the GCC_BOOTSTRAP case.
  
  MK_CLANG_IS_CC controls installing links for GCC, not just clang.  Set
  MK_CLANG_IS_CC to the value of MK_CLANG_BOOTSTRAP.  This will leave it
  as "no" if no bootstrap compiler is being built or GCC 4.2.1 is being
  used as the bootstrap compiler, and "yes" if clang is being used as
  the bootstrap compiler.

Modified:
  stable/12/Makefile.inc1
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/Makefile.inc1
==
--- stable/12/Makefile.inc1 Sat May  2 01:00:29 2020(r360560)
+++ stable/12/Makefile.inc1 Sat May  2 13:42:03 2020(r360561)
@@ -687,6 +687,7 @@ TMAKE=  \
 # TOOLS_PREFIX set in BMAKE
 XMAKE= ${BMAKE} \
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
+   MK_CLANG_IS_CC=${MK_CLANG_BOOTSTRAP} \
MK_GDB=no MK_TESTS=no
 
 # kernel-tools stage
___
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: r360540 - head/stand/libofw

2020-05-02 Thread Rene Ladan
On Sat, May 02, 2020 at 09:16:35AM +, Rene Ladan wrote:
> On Fri, May 01, 2020 at 05:50:22PM +, Warner Losh wrote:
> > Author: imp
> > Date: Fri May  1 17:50:21 2020
> > New Revision: 360540
> > URL: https://svnweb.freebsd.org/changeset/base/360540
> > 
> > Log:
> >   Remove more stray sparc64 ifdefs.
> >   
> >   Also, dmabuf appears to only be set for sparc64 case, but there was a
> >   comment at its only use that says it was broken for some apple
> >   adapters. #ifdef it all of that out now that nothing sets it.
> > 
> > Modified:
> >   head/stand/libofw/ofw_net.c
> > 
> > Modified: head/stand/libofw/ofw_net.c
> > ==
> > --- head/stand/libofw/ofw_net.c Fri May  1 17:17:01 2020
> > (r360539)
> > +++ head/stand/libofw/ofw_net.c Fri May  1 17:50:21 2020
> > (r360540)
> [...]
> > @@ -220,20 +220,6 @@ ofwn_init(struct iodesc *desc, void *machdep_hint)
> >  #if defined(NETIF_DEBUG)
> > printf("ofwn_init: Open Firmware instance handle: %08x\n", netinstance);
> >  #endif
> > -
> > -#ifndef __sparc64__
>   ^
> Shouldn't this code always be present?

Ah yes, but already fixed :)

René
___
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: r360540 - head/stand/libofw

2020-05-02 Thread Rene Ladan
On Fri, May 01, 2020 at 05:50:22PM +, Warner Losh wrote:
> Author: imp
> Date: Fri May  1 17:50:21 2020
> New Revision: 360540
> URL: https://svnweb.freebsd.org/changeset/base/360540
> 
> Log:
>   Remove more stray sparc64 ifdefs.
>   
>   Also, dmabuf appears to only be set for sparc64 case, but there was a
>   comment at its only use that says it was broken for some apple
>   adapters. #ifdef it all of that out now that nothing sets it.
> 
> Modified:
>   head/stand/libofw/ofw_net.c
> 
> Modified: head/stand/libofw/ofw_net.c
> ==
> --- head/stand/libofw/ofw_net.c   Fri May  1 17:17:01 2020
> (r360539)
> +++ head/stand/libofw/ofw_net.c   Fri May  1 17:50:21 2020
> (r360540)
[...]
> @@ -220,20 +220,6 @@ ofwn_init(struct iodesc *desc, void *machdep_hint)
>  #if defined(NETIF_DEBUG)
>   printf("ofwn_init: Open Firmware instance handle: %08x\n", netinstance);
>  #endif
> -
> -#ifndef __sparc64__
  ^
Shouldn't this code always be present?
> - dmabuf = NULL;
> - if (OF_call_method("dma-alloc", netinstance, 1, 1, (64 * 1024), &dmabuf)
> - < 0) {   
> - printf("Failed to allocate DMA buffer (got %p).\n", dmabuf);
> - goto punt;
> - }
> -
> -#if defined(NETIF_DEBUG)
> - printf("ofwn_init: allocated DMA buffer: %p\n", dmabuf);
> -#endif
> -#endif
> -

René
___
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: r360525 - in stable/12: sys/arm64/arm64 sys/arm64/include sys/compat/linuxkpi/common/include/linux sys/compat/linuxkpi/common/src sys/dev/ofw sys/dev/pci sys/kern sys/sys sys/x86/inclu

2020-05-02 Thread Konstantin Belousov
On Fri, May 01, 2020 at 09:46:27AM +, Hans Petter Selasky wrote:
> Author: hselasky
> Date: Fri May  1 09:46:27 2020
> New Revision: 360525
> URL: https://svnweb.freebsd.org/changeset/base/360525
> 
> Log:
>   MFC r346645, r346664, r346687, r347387, r347836, r347088, 347089, r346956,
>   r346957, r346958, r347088, r347089, r347385, r353938, r350570,
>   r350572 and r350573:
>   
>   Implement full bus_dma(9) support in the LinuxKPI and pull in all 
> dependencies.
>   
>   Bump FreeBSD version to force recompilation of external modules.
>   
>   Sponsored by:   Mellanox Technologies
> 
> Modified:
>   stable/12/sys/arm64/arm64/busdma_bounce.c
>   stable/12/sys/arm64/include/bus_dma.h
>   stable/12/sys/arm64/include/bus_dma_impl.h
>   stable/12/sys/compat/linuxkpi/common/include/linux/device.h
>   stable/12/sys/compat/linuxkpi/common/include/linux/dma-mapping.h
>   stable/12/sys/compat/linuxkpi/common/include/linux/dmapool.h
>   stable/12/sys/compat/linuxkpi/common/include/linux/gfp.h
>   stable/12/sys/compat/linuxkpi/common/include/linux/io.h
>   stable/12/sys/compat/linuxkpi/common/include/linux/pci.h
>   stable/12/sys/compat/linuxkpi/common/include/linux/scatterlist.h
>   stable/12/sys/compat/linuxkpi/common/src/linux_pci.c
>   stable/12/sys/dev/ofw/ofwpci.c
>   stable/12/sys/dev/pci/vga_pci.c
>   stable/12/sys/kern/bus_if.m
>   stable/12/sys/kern/subr_bus.c
>   stable/12/sys/sys/bus.h
>   stable/12/sys/sys/bus_dma.h
>   stable/12/sys/sys/param.h
>   stable/12/sys/x86/include/bus_dma.h
>   stable/12/sys/x86/include/busdma_impl.h
>   stable/12/sys/x86/iommu/busdma_dmar.c
>   stable/12/sys/x86/x86/busdma_bounce.c
>   stable/12/usr.sbin/camdd/camdd.c
> Directory Properties:
>   stable/12/   (props changed)

The diff was truncated by commit mailer, so I inline the change:
Index: sys/x86/include/busdma_impl.h
===
--- sys/x86/include/busdma_impl.h  (revision 360524)
+++ sys/x86/include/busdma_impl.h  (revision 360525)
@@ -62,6 +62,7 @@
   void *lockfuncarg, bus_dma_tag_t *dmat);
   int (*tag_destroy)(bus_dma_tag_t dmat);
   int (*tag_set_domain)(bus_dma_tag_t);
+  bool (*id_mapped)(bus_dma_tag_t, vm_paddr_t, bus_size_t);
   int (*map_create)(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp);
   int (*map_destroy)(bus_dma_tag_t dmat, bus_dmamap_t map);
   int (*mem_alloc)(bus_dma_tag_t dmat, void** vaddr, int flags,

It changed the layout of struct bus_dma_impl which is part of the KBI
because it is accessed by inline wrappers of busdma KPI.  End result is
that all drivers binaries using busdma are broken.

I believe it would be fine to move id_mapped to the end of the structure.
___
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"