g_eli.c (8f7878e3e151e27cb5233f7aaad42fae4ba1cefe) g_eli.c (081b4452a758dd81dcdc68ffb6f7bad901d53e3d)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2005-2019 Pawel Jakub Dawidek <pawel@dawidek.net>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 83 unchanged lines hidden (view full) ---

92u_int g_eli_batch = 0;
93SYSCTL_UINT(_kern_geom_eli, OID_AUTO, batch, CTLFLAG_RWTUN, &g_eli_batch, 0,
94 "Use crypto operations batching");
95static u_int g_eli_minbufs = 16;
96static int sysctl_g_eli_minbufs(SYSCTL_HANDLER_ARGS);
97SYSCTL_PROC(_kern_geom_eli, OID_AUTO, minbufs, CTLTYPE_UINT | CTLFLAG_RW |
98 CTLFLAG_MPSAFE, NULL, 0, sysctl_g_eli_minbufs, "IU",
99 "Number of GELI bufs reserved for swap transactions");
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2005-2019 Pawel Jakub Dawidek <pawel@dawidek.net>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 83 unchanged lines hidden (view full) ---

92u_int g_eli_batch = 0;
93SYSCTL_UINT(_kern_geom_eli, OID_AUTO, batch, CTLFLAG_RWTUN, &g_eli_batch, 0,
94 "Use crypto operations batching");
95static u_int g_eli_minbufs = 16;
96static int sysctl_g_eli_minbufs(SYSCTL_HANDLER_ARGS);
97SYSCTL_PROC(_kern_geom_eli, OID_AUTO, minbufs, CTLTYPE_UINT | CTLFLAG_RW |
98 CTLFLAG_MPSAFE, NULL, 0, sysctl_g_eli_minbufs, "IU",
99 "Number of GELI bufs reserved for swap transactions");
100static bool g_eli_blocking_malloc = false;
101SYSCTL_BOOL(_kern_geom_eli, OID_AUTO, blocking_malloc, CTLFLAG_RWTUN,
102 &g_eli_blocking_malloc, 0, "Use blocking malloc calls for GELI buffers");
103static bool g_eli_unmapped_io = true;
104SYSCTL_BOOL(_kern_geom_eli, OID_AUTO, unmapped_io, CTLFLAG_RDTUN,
105 &g_eli_unmapped_io, 0, "Enable support for unmapped I/O");
106
100static struct sx g_eli_umalock; /* Controls changes to UMA zone. */
101SX_SYSINIT(g_eli_umalock, &g_eli_umalock, "GELI UMA");
102static uma_zone_t g_eli_uma = NULL;
103static int g_eli_alloc_sz;
104static volatile int g_eli_umaoutstanding;
105static volatile int g_eli_devs;
107static struct sx g_eli_umalock; /* Controls changes to UMA zone. */
108SX_SYSINIT(g_eli_umalock, &g_eli_umalock, "GELI UMA");
109static uma_zone_t g_eli_uma = NULL;
110static int g_eli_alloc_sz;
111static volatile int g_eli_umaoutstanding;
112static volatile int g_eli_devs;
106static bool g_eli_blocking_malloc = false;
107SYSCTL_BOOL(_kern_geom_eli, OID_AUTO, blocking_malloc, CTLFLAG_RWTUN,
108 &g_eli_blocking_malloc, 0, "Use blocking malloc calls for GELI buffers");
109
110/*
111 * Control the number of reserved entries in the GELI zone.
112 * If the GELI zone has already been allocated, update the zone. Otherwise,
113 * simply update the variable for use the next time the zone is created.
114 */
115static int
116sysctl_g_eli_minbufs(SYSCTL_HANDLER_ARGS)

--- 1015 unchanged lines hidden (view full) ---

1132 LIST_INSERT_HEAD(&sc->sc_workers, wr, w_next);
1133 }
1134
1135 /*
1136 * Create decrypted provider.
1137 */
1138 pp = g_new_providerf(gp, "%s%s", bpp->name, G_ELI_SUFFIX);
1139 pp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE;
113
114/*
115 * Control the number of reserved entries in the GELI zone.
116 * If the GELI zone has already been allocated, update the zone. Otherwise,
117 * simply update the variable for use the next time the zone is created.
118 */
119static int
120sysctl_g_eli_minbufs(SYSCTL_HANDLER_ARGS)

--- 1015 unchanged lines hidden (view full) ---

1136 LIST_INSERT_HEAD(&sc->sc_workers, wr, w_next);
1137 }
1138
1139 /*
1140 * Create decrypted provider.
1141 */
1142 pp = g_new_providerf(gp, "%s%s", bpp->name, G_ELI_SUFFIX);
1143 pp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE;
1140 if (CRYPTO_HAS_VMPAGE) {
1144 if (g_eli_unmapped_io && CRYPTO_HAS_VMPAGE) {
1141 /*
1142 * On DMAP architectures we can use unmapped I/O. But don't
1143 * use it with data integrity verification. That code hasn't
1144 * been written yet.
1145 */
1146 if ((sc->sc_flags & G_ELI_FLAG_AUTH) == 0)
1147 pp->flags |= G_PF_ACCEPT_UNMAPPED;
1148 }

--- 482 unchanged lines hidden ---
1145 /*
1146 * On DMAP architectures we can use unmapped I/O. But don't
1147 * use it with data integrity verification. That code hasn't
1148 * been written yet.
1149 */
1150 if ((sc->sc_flags & G_ELI_FLAG_AUTH) == 0)
1151 pp->flags |= G_PF_ACCEPT_UNMAPPED;
1152 }

--- 482 unchanged lines hidden ---