← Documents Documentation/infiniband/ucaps.rst GitHub 원문 ↗

Linux 6.18.37 · InfiniBand

InfiniBand Userspace Capabilities

문자 장치 파일 디스크립터로 특정 IB 펌웨어 권한을 위임하는 UCAP의 생성과 제거를 설명합니다.

Source pathDocumentation/infiniband/ucaps.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

ucaps.rst:1-71

UCAP은 포괄적인 Linux capability 대신 IB 펌웨어 기능별 문자 장치로 권한을 위임합니다. 사용자는 허용된 UCAP 파일을 열어 IB 장치 open 속성에 전달하고, 드라이버는 유형별 참조 계수로 `/dev/infiniband` 노드의 공유 수명을 관리합니다.

문서 개요
항목내용
SourceDocumentation/infiniband/ucaps.rst
분량71 source lines
사용 경계UCAP character-device FD
수명유형별 reference count

원문 분량과 핵심 적용 대상을 요약합니다.

핵심 흐름
Root가 UCAP 노드 권한 위임사용자가 FD 획득IB open 속성에 FD 전달`ib_uverbs`가 기능 활성화마지막 참조 제거 시 장치 노드 삭제

문서의 주요 동작 순서를 압축해 보여 줍니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 =================================
2 Infiniband Userspace Capabilities
3 =================================
4
5 User CAPabilities (UCAPs) provide fine-grained control over specific
6 firmware features in Infiniband (IB) devices. This approach offers
7 more granular capabilities than the existing Linux capabilities,
8 which may be too generic for certain FW features.
9
10 Each user capability is represented as a character device with root
11 read-write access. Root processes can grant users special privileges
12 by allowing access to these character devices (e.g., using chown).
13
14 Usage
15 =====
16
17 UCAPs allow control over specific features of an IB device using file
18 descriptors of UCAP character devices. Here is how a user enables
19 specific features of an IB device:
20
21 * A root process grants the user access to the UCAP files that
22 represents the capabilities (e.g., using chown).
23 * The user opens the UCAP files, obtaining file descriptors.
24 * When opening an IB device, include an array of the UCAP file
25 descriptors as an attribute.
26 * The ib_uverbs driver recognizes the UCAP file descriptors and enables
27 the corresponding capabilities for the IB device.
28
29 Creating UCAPs
30 ==============
31
32 To create a new UCAP, drivers must first define a type in the
33 rdma_user_cap enum in rdma/ib_ucaps.h. The name of the UCAP character
34 device should be added to the ucap_names array in
35 drivers/infiniband/core/ucaps.c. Then, the driver can create the UCAP
36 character device by calling the ib_create_ucap API with the UCAP
37 type.
38
39 A reference count is stored for each UCAP to track creations and
40 removals of the UCAP device. If multiple creation calls are made with
41 the same type (e.g., for two IB devices), the UCAP character device
42 is created during the first call and subsequent calls increment the
43 reference count.
44
45 The UCAP character device is created under /dev/infiniband, and its
46 permissions are set to allow root read and write access only.
47
48 Removing UCAPs
49 ==============
50
51 Each removal decrements the reference count of the UCAP. The UCAP
52 character device is removed from the filesystem only when the
53 reference count is decreased to 0.
54
55 /dev and /sys/class files
56 =========================
57
58 The class::
59
60 /sys/class/infiniband_ucaps
61
62 is created when the first UCAP character device is created.
63
64 The UCAP character device is created under /dev/infiniband.
65
66 For example, if mlx5_ib adds the rdma_user_cap
67 RDMA_UCAP_MLX5_CTRL_LOCAL with name "mlx5_perm_ctrl_local", this will
68 create the device node::
69
70 /dev/infiniband/mlx5_perm_ctrl_local
71
72

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

UCAP 목적과 사용자 권한 부여 흐름

1-28

User CAPabilities(UCAPs)는 InfiniBand 장치의 특정 펌웨어 기능을 세밀하게 제어합니다. 일부 펌웨어 기능에는 기존 Linux capability가 지나치게 포괄적일 수 있으므로, UCAP은 기능별로 더 작은 권한 단위를 제공합니다.

각 사용자 capability는 root만 읽고 쓸 수 있는 문자 장치로 표현됩니다. root 프로세스는 `chown` 같은 방법으로 사용자가 해당 문자 장치에 접근하도록 허용해 특정 특권만 부여할 수 있습니다.

사용자는 허용된 UCAP 파일을 열어 파일 디스크립터를 얻고, IB 장치를 열 때 이 디스크립터 배열을 속성으로 함께 전달합니다. `ib_uverbs` 드라이버는 UCAP 파일 디스크립터를 인식해 해당 IB 장치에 대응 기능을 활성화합니다.

UCAP 권한 사용 절차
Root가 필요한 UCAP 문자 장치 접근 권한 부여사용자가 UCAP 파일을 열어 파일 디스크립터 획득IB 장치를 열 때 UCAP FD 배열을 속성으로 전달`ib_uverbs`가 UCAP FD를 검증하고 식별대응하는 펌웨어 capability를 IB 장치에 활성화

root의 기능별 권한 위임부터 IB 장치 기능 활성화까지의 순서입니다.

UCAP 권한 모델
항목UCAP 동작
권한 단위특정 IB 펌웨어 기능
표현문자 장치
초기 권한Root read-write only
사용자 위임`chown` 등으로 장치 접근 허용
커널 전달IB open 속성의 UCAP 파일 디스크립터 배열
인식 주체`ib_uverbs` 드라이버

일반 Linux capability와 구별되는 UCAP의 제어 단위와 전달 방식입니다.

=================================
Infiniband Userspace Capabilities
=================================

   User CAPabilities (UCAPs) provide fine-grained control over specific
   firmware features in Infiniband (IB) devices. This approach offers
   more granular capabilities than the existing Linux capabilities,
   which may be too generic for certain FW features.

   Each user capability is represented as a character device with root
   read-write access. Root processes can grant users special privileges
   by allowing access to these character devices (e.g., using chown).

Usage
=====

   UCAPs allow control over specific features of an IB device using file
   descriptors of UCAP character devices. Here is how a user enables
   specific features of an IB device:

      * A root process grants the user access to the UCAP files that
        represents the capabilities (e.g., using chown).
      * The user opens the UCAP files, obtaining file descriptors.
      * When opening an IB device, include an array of the UCAP file
        descriptors as an attribute.
      * The ib_uverbs driver recognizes the UCAP file descriptors and enables
        the corresponding capabilities for the IB device.

UCAP 생성·참조 계수·제거

29-54

새 UCAP을 만들려면 드라이버가 먼저 `rdma/ib_ucaps.h`의 `rdma_user_cap` 열거형에 유형을 정의해야 합니다. 문자 장치 이름은 `drivers/infiniband/core/ucaps.c`의 `ucap_names` 배열에 추가합니다. 이후 UCAP 유형을 인자로 `ib_create_ucap` API를 호출해 문자 장치를 생성합니다.

각 UCAP에는 생성과 제거를 추적하는 참조 계수가 저장됩니다. 같은 유형을 여러 IB 장치에서 생성하면 첫 호출에서만 실제 문자 장치를 만들고, 이후 호출은 참조 계수만 증가시킵니다.

UCAP 문자 장치는 `/dev/infiniband` 아래에 생성되며 기본 권한은 root 읽기·쓰기 전용입니다. 제거 호출마다 참조 계수가 하나 줄고, 계수가 0이 된 경우에만 파일시스템에서 문자 장치를 제거합니다.

UCAP 생성과 제거 수명 주기
`rdma_user_cap`에 새 유형 정의`ucap_names`에 문자 장치 이름 등록첫 `ib_create_ucap(type)` 호출에서 `/dev/infiniband` 노드 생성같은 유형의 추가 생성은 참조 계수 증가각 제거 호출에서 참조 계수 감소참조 계수가 0이면 문자 장치 노드 제거

여러 IB 장치가 같은 UCAP 유형을 공유할 때의 참조 계수 동작입니다.

UCAP 구현 위치
목적심볼 또는 경로
유형 정의`rdma_user_cap` in `rdma/ib_ucaps.h`
장치 이름`ucap_names` in `drivers/infiniband/core/ucaps.c`
장치 생성`ib_create_ucap(type)`
생성 위치`/dev/infiniband`
공유 수명유형별 reference count

새 capability 유형을 추가할 때 수정하거나 호출하는 인터페이스입니다.

Creating UCAPs
==============

   To create a new UCAP, drivers must first define a type in the
   rdma_user_cap enum in rdma/ib_ucaps.h. The name of the UCAP character
   device should be added to the ucap_names array in
   drivers/infiniband/core/ucaps.c. Then, the driver can create the UCAP
   character device by calling the ib_create_ucap API with the UCAP
   type.

   A reference count is stored for each UCAP to track creations and
   removals of the UCAP device. If multiple creation calls are made with
   the same type (e.g., for two IB devices), the UCAP character device
   is created during the first call and subsequent calls increment the
   reference count.

   The UCAP character device is created under /dev/infiniband, and its
   permissions are set to allow root read and write access only.

Removing UCAPs
==============

   Each removal decrements the reference count of the UCAP. The UCAP
   character device is removed from the filesystem only when the
   reference count is decreased to 0.

UCAP /dev 노드와 sysfs 클래스

55-71

첫 UCAP 문자 장치가 생성되면 `/sys/class/infiniband_ucaps` 클래스가 만들어집니다. 개별 UCAP 문자 장치는 `/dev/infiniband` 아래에 위치합니다.

예를 들어 `mlx5_ib`가 이름이 `mlx5_perm_ctrl_local`인 `RDMA_UCAP_MLX5_CTRL_LOCAL` capability를 추가하면 `/dev/infiniband/mlx5_perm_ctrl_local` 장치 노드가 생성됩니다.

UCAP 파일시스템 배치 예
항목
Sysfs class`/sys/class/infiniband_ucaps`
문자 장치 디렉터리`/dev/infiniband`
예제 유형`RDMA_UCAP_MLX5_CTRL_LOCAL`
예제 이름`mlx5_perm_ctrl_local`
예제 노드`/dev/infiniband/mlx5_perm_ctrl_local`

클래스와 문자 장치 노드가 만들어지는 위치를 보존합니다.

/dev and /sys/class files
=========================

   The class::

      /sys/class/infiniband_ucaps

   is created when the first UCAP character device is created.

   The UCAP character device is created under /dev/infiniband.

   For example, if mlx5_ib adds the rdma_user_cap
   RDMA_UCAP_MLX5_CTRL_LOCAL with name "mlx5_perm_ctrl_local", this will
   create the device node::

      /dev/infiniband/mlx5_perm_ctrl_local