at 23.11-pre 1.2 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 cfg = config.networking.rxe; 7 8in { 9 ###### interface 10 11 options = { 12 networking.rxe = { 13 enable = mkEnableOption (lib.mdDoc "RDMA over converged ethernet"); 14 interfaces = mkOption { 15 type = types.listOf types.str; 16 default = [ ]; 17 example = [ "eth0" ]; 18 description = lib.mdDoc '' 19 Enable RDMA on the listed interfaces. The corresponding virtual 20 RDMA interfaces will be named rxe_\<interface\>. 21 UDP port 4791 must be open on the respective ethernet interfaces. 22 ''; 23 }; 24 }; 25 }; 26 27 ###### implementation 28 29 config = mkIf cfg.enable { 30 31 systemd.services.rxe = { 32 description = "RoCE interfaces"; 33 34 wantedBy = [ "multi-user.target" ]; 35 after = [ "systemd-modules-load.service" "network-online.target" ]; 36 wants = [ "network-pre.target" ]; 37 38 serviceConfig = { 39 Type = "oneshot"; 40 RemainAfterExit = true; 41 ExecStart = map ( x: 42 "${pkgs.iproute2}/bin/rdma link add rxe_${x} type rxe netdev ${x}" 43 ) cfg.interfaces; 44 45 ExecStop = map ( x: 46 "${pkgs.iproute2}/bin/rdma link delete rxe_${x}" 47 ) cfg.interfaces; 48 }; 49 }; 50 }; 51} 52