2025-04-01 20:10:43 +02:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2018-02-09 23:52:03 -08:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.networking.rxe;
|
|
|
|
|
2025-04-01 20:10:43 +02:00
|
|
|
in
|
|
|
|
{
|
2018-02-09 23:52:03 -08:00
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
networking.rxe = {
|
2024-04-13 14:54:15 +02:00
|
|
|
enable = mkEnableOption "RDMA over converged ethernet";
|
2018-02-09 23:52:03 -08:00
|
|
|
interfaces = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [ ];
|
|
|
|
example = [ "eth0" ];
|
2024-04-13 14:54:15 +02:00
|
|
|
description = ''
|
2018-02-09 23:52:03 -08:00
|
|
|
Enable RDMA on the listed interfaces. The corresponding virtual
|
2022-08-28 21:18:44 +02:00
|
|
|
RDMA interfaces will be named rxe_\<interface\>.
|
2020-02-28 10:06:37 +01:00
|
|
|
UDP port 4791 must be open on the respective ethernet interfaces.
|
2018-02-09 23:52:03 -08:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
systemd.services.rxe = {
|
|
|
|
description = "RoCE interfaces";
|
|
|
|
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
2025-04-01 20:10:43 +02:00
|
|
|
after = [
|
|
|
|
"systemd-modules-load.service"
|
|
|
|
"network-online.target"
|
|
|
|
];
|
|
|
|
wants = [
|
|
|
|
"network-pre.target"
|
|
|
|
"network-online.target"
|
|
|
|
];
|
2018-02-09 23:52:03 -08:00
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
|
|
|
RemainAfterExit = true;
|
2025-04-01 20:10:43 +02:00
|
|
|
ExecStart = map (
|
|
|
|
x: "${pkgs.iproute2}/bin/rdma link add rxe_${x} type rxe netdev ${x}"
|
|
|
|
) cfg.interfaces;
|
2020-02-28 10:06:37 +01:00
|
|
|
|
2025-04-01 20:10:43 +02:00
|
|
|
ExecStop = map (x: "${pkgs.iproute2}/bin/rdma link delete rxe_${x}") cfg.interfaces;
|
2018-02-09 23:52:03 -08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|