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