요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>
==========
Linux CAIF
==========
Copyright |copy| ST-Ericsson AB 2010
:Author: Sjur Brendeland/ sjur.brandeland@stericsson.com
:License terms: GNU General Public License (GPL) version 2
Introduction
============
CAIF is a MUX protocol used by ST-Ericsson cellular modems for
communication between Modem and host. The host processes can open virtual AT
channels, initiate GPRS Data connections, Video channels and Utility Channels.
The Utility Channels are general purpose pipes between modem and host.
ST-Ericsson modems support a number of transports between modem
and host. Currently, UART and Loopback are available for Linux.
Architecture
============
The implementation of CAIF is divided into:
* CAIF Socket Layer and GPRS IP Interface.
* CAIF Core Protocol Implementation
* CAIF Link Layer, implemented as NET devices.
::
RTNL
!
! +------+ +------+
! +------+! +------+!
! ! IP !! !Socket!!
+-------> !interf!+ ! API !+ <- CAIF Client APIs
! +------+ +------!
! ! !
! +-----------+
! !
! +------+ <- CAIF Core Protocol
! ! CAIF !
! ! Core !
! +------+
! +----------!---------+
! ! ! !
! +------+ +-----+ +------+
+--> ! HSI ! ! TTY ! ! USB ! <- Link Layer (Net Devices)
+------+ +-----+ +------+
Implementation
==============
CAIF Core Protocol Layer
------------------------
CAIF Core layer implements the CAIF protocol as defined by ST-Ericsson.
It implements the CAIF protocol stack in a layered approach, where
each layer described in the specification is implemented as a separate layer.
The architecture is inspired by the design patterns "Protocol Layer" and
"Protocol Packet".
CAIF structure
^^^^^^^^^^^^^^
The Core CAIF implementation contains:
- Simple implementation of CAIF.
- Layered architecture (a la Streams), each layer in the CAIF
specification is implemented in a separate c-file.
- Clients must call configuration function to add PHY layer.
- Clients must implement CAIF layer to consume/produce
CAIF payload with receive and transmit functions.
- Clients must call configuration function to add and connect the
Client layer.
- When receiving / transmitting CAIF Packets (cfpkt), ownership is passed
to the called function (except for framing layers' receive function)
Layered Architecture
====================
The CAIF protocol can be divided into two parts: Support functions and Protocol
Implementation. The support functions include:
- CFPKT CAIF Packet. Implementation of CAIF Protocol Packet. The
CAIF Packet has functions for creating, destroying and adding content
and for adding/extracting header and trailers to protocol packets.
The CAIF Protocol implementation contains:
- CFCNFG CAIF Configuration layer. Configures the CAIF Protocol
Stack and provides a Client interface for adding Link-Layer and
Driver interfaces on top of the CAIF Stack.
- CFCTRL CAIF Control layer. Encodes and Decodes control messages
such as enumeration and channel setup. Also matches request and
response messages.
- CFSERVL General CAIF Service Layer functionality; handles flow
control and remote shutdown requests.
- CFVEI CAIF VEI layer. Handles CAIF AT Channels on VEI (Virtual
External Interface). This layer encodes/decodes VEI frames.
- CFDGML CAIF Datagram layer. Handles CAIF Datagram layer (IP
traffic), encodes/decodes Datagram frames.
- CFMUX CAIF Mux layer. Handles multiplexing between multiple
physical bearers and multiple channels such as VEI, Datagram, etc.
The MUX keeps track of the existing CAIF Channels and
Physical Instances and selects the appropriate instance based
on Channel-Id and Physical-ID.
- CFFRML CAIF Framing layer. Handles Framing i.e. Frame length
and frame checksum.
- CFSERL CAIF Serial layer. Handles concatenation/split of frames
into CAIF Frames with correct length.
::
+---------+
| Config |
| CFCNFG |
+---------+
!
+---------+ +---------+ +---------+
| AT | | Control | | Datagram|
| CFVEIL | | CFCTRL | | CFDGML |
+---------+ +---------+ +---------+
\_____________!______________/
!
+---------+
| MUX |
| |
+---------+
_____!_____
/ \
+---------+ +---------+
| CFFRML | | CFFRML |
| Framing | | Framing |
+---------+ +---------+
! !
+---------+ +---------+
| | | Serial |
| | | CFSERL |
+---------+ +---------+
In this layered approach the following "rules" apply.
- All layers embed the same structure "struct cflayer"
- A layer does not depend on any other layer's private data.
- Layers are stacked by setting the pointers::
layer->up , layer->dn
- In order to send data upwards, each layer should do::
layer->up->receive(layer->up, packet);
- In order to send data downwards, each layer should do::
layer->dn->transmit(layer->dn, packet);
CAIF Socket and IP interface
============================
The IP interface and CAIF socket API are implemented on top of the
CAIF Core protocol. The IP Interface and CAIF socket have an instance of
'struct cflayer', just like the CAIF Core protocol stack.
Net device and Socket implement the 'receive()' function defined by
'struct cflayer', just like the rest of the CAIF stack. In this way, transmit and
receive of packets is handled as by the rest of the layers: the 'dn->transmit()'
function is called in order to transmit data.
Configuration of Link Layer
---------------------------
The Link Layer is implemented as Linux network devices (struct net_device).
Payload handling and registration is done using standard Linux mechanisms.
The CAIF Protocol relies on a loss-less link layer without implementing
retransmission. This implies that packet drops must not happen.
Therefore a flow-control mechanism is implemented where the physical
interface can initiate flow stop for all CAIF Channels.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
CAIF 소개와 전체 architecture
1-58`.. SPDX-License-Identifier: GPL-2.0`
`.. include:: <isonum.txt>`
Linux CAIF
Copyright |copy| ST-Ericsson AB 2010
:Author: Sjur Brendeland/ sjur.brandeland@stericsson.com
:License terms: GNU General Public License (GPL) version 2
소개
CAIF는 ST-Ericsson cellular modem이 modem과 host 사이의 통신에 사용하는 MUX protocol입니다. Host process는 virtual AT channel을 열고 GPRS data connection, video channel, utility channel을 시작할 수 있습니다. Utility channel은 modem과 host 사이의 범용 pipe입니다.
ST-Ericsson modem은 modem과 host 사이에 여러 transport를 지원합니다. 현재 Linux에서는 UART와 Loopback을 사용할 수 있습니다.
Architecture
CAIF 구현은 다음 부분으로 나뉩니다.
- CAIF Socket Layer와 GPRS IP Interface
- CAIF Core Protocol 구현
- NET device로 구현된 CAIF Link Layer
RTNL은 CAIF client API의 IP interface와 Socket API, CAIF Core Protocol, 그리고 net device인 HSI·TTY·USB link layer를 구성하고 연결합니다.
.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>
==========
Linux CAIF
==========
Copyright |copy| ST-Ericsson AB 2010
:Author: Sjur Brendeland/ sjur.brandeland@stericsson.com
:License terms: GNU General Public License (GPL) version 2
Introduction
============
CAIF is a MUX protocol used by ST-Ericsson cellular modems for
communication between Modem and host. The host processes can open virtual AT
channels, initiate GPRS Data connections, Video channels and Utility Channels.
The Utility Channels are general purpose pipes between modem and host.
ST-Ericsson modems support a number of transports between modem
and host. Currently, UART and Loopback are available for Linux.
Architecture
============
The implementation of CAIF is divided into:
* CAIF Socket Layer and GPRS IP Interface.
* CAIF Core Protocol Implementation
* CAIF Link Layer, implemented as NET devices.
::
RTNL
!
! +------+ +------+
! +------+! +------+!
! ! IP !! !Socket!!
+-------> !interf!+ ! API !+ <- CAIF Client APIs
! +------+ +------!
! ! !
! +-----------+
! !
! +------+ <- CAIF Core Protocol
! ! CAIF !
! ! Core !
! +------+
! +----------!---------+
! ! ! !
! +------+ +-----+ +------+
+--> ! HSI ! ! TTY ! ! USB ! <- Link Layer (Net Devices)
+------+ +-----+ +------+
CAIF Core Protocol 구조
59-87구현
CAIF Core Protocol Layer
CAIF Core layer는 ST-Ericsson이 정의한 CAIF protocol을 구현합니다. Specification에 설명된 각 layer를 별도 layer로 구현하는 계층적 방식으로 CAIF protocol stack을 구성합니다. Architecture는 `Protocol Layer`와 `Protocol Packet` design pattern에서 영감을 받았습니다.
CAIF 구조
Core CAIF 구현에는 다음 특성이 있습니다.
- CAIF의 단순한 구현입니다.
- Streams와 유사한 layered architecture를 사용하며, CAIF specification의 각 layer를 별도 C file로 구현합니다.
- Client는 configuration function을 호출해 PHY layer를 추가해야 합니다.
- Client는 receive와 transmit function으로 CAIF payload를 소비·생성하는 CAIF layer를 구현해야 합니다.
- Client는 configuration function을 호출해 Client layer를 추가하고 연결해야 합니다.
- CAIF packet(`cfpkt`)을 수신하거나 전송할 때는 호출된 function으로 ownership이 넘어갑니다. 단, framing layer의 receive function은 예외입니다.
Implementation
==============
CAIF Core Protocol Layer
------------------------
CAIF Core layer implements the CAIF protocol as defined by ST-Ericsson.
It implements the CAIF protocol stack in a layered approach, where
each layer described in the specification is implemented as a separate layer.
The architecture is inspired by the design patterns "Protocol Layer" and
"Protocol Packet".
CAIF structure
^^^^^^^^^^^^^^
The Core CAIF implementation contains:
- Simple implementation of CAIF.
- Layered architecture (a la Streams), each layer in the CAIF
specification is implemented in a separate c-file.
- Clients must call configuration function to add PHY layer.
- Clients must implement CAIF layer to consume/produce
CAIF payload with receive and transmit functions.
- Clients must call configuration function to add and connect the
Client layer.
- When receiving / transmitting CAIF Packets (cfpkt), ownership is passed
to the called function (except for framing layers' receive function)
계층별 component
88-128Layered Architecture
CAIF protocol은 support function과 protocol 구현의 두 부분으로 나눌 수 있습니다. Support function에는 다음이 포함됩니다.
- CFPKT CAIF Packet: CAIF Protocol Packet 구현입니다. CAIF packet을 생성·파괴하고 content를 추가하며 protocol packet의 header와 trailer를 추가·추출하는 function을 제공합니다.
CAIF protocol 구현에는 다음이 포함됩니다.
- CFCNFG CAIF Configuration layer: CAIF protocol stack을 구성하고 CAIF stack 위에 Link-Layer와 Driver interface를 추가하는 client interface를 제공합니다.
- CFCTRL CAIF Control layer: enumeration과 channel setup 같은 control message를 encode·decode하고 request와 response message를 짝지어 줍니다.
- CFSERVL General CAIF Service Layer: flow control과 remote shutdown request를 처리합니다.
- CFVEI CAIF VEI layer: VEI(Virtual External Interface)의 CAIF AT Channel을 처리하며 VEI frame을 encode·decode합니다.
- CFDGML CAIF Datagram layer: IP traffic을 위한 CAIF Datagram layer를 처리하고 Datagram frame을 encode·decode합니다.
- CFMUX CAIF Mux layer: 여러 physical bearer와 VEI·Datagram 같은 여러 channel 사이를 multiplexing합니다. MUX는 기존 CAIF Channel과 Physical Instance를 추적하고 Channel-ID와 Physical-ID에 따라 적절한 instance를 선택합니다.
- CFFRML CAIF Framing layer: frame length와 frame checksum을 포함한 framing을 처리합니다.
- CFSERL CAIF Serial layer: frame을 올바른 길이의 CAIF frame으로 연결하거나 분할합니다.
Layered Architecture
====================
The CAIF protocol can be divided into two parts: Support functions and Protocol
Implementation. The support functions include:
- CFPKT CAIF Packet. Implementation of CAIF Protocol Packet. The
CAIF Packet has functions for creating, destroying and adding content
and for adding/extracting header and trailers to protocol packets.
The CAIF Protocol implementation contains:
- CFCNFG CAIF Configuration layer. Configures the CAIF Protocol
Stack and provides a Client interface for adding Link-Layer and
Driver interfaces on top of the CAIF Stack.
- CFCTRL CAIF Control layer. Encodes and Decodes control messages
such as enumeration and channel setup. Also matches request and
response messages.
- CFSERVL General CAIF Service Layer functionality; handles flow
control and remote shutdown requests.
- CFVEI CAIF VEI layer. Handles CAIF AT Channels on VEI (Virtual
External Interface). This layer encodes/decodes VEI frames.
- CFDGML CAIF Datagram layer. Handles CAIF Datagram layer (IP
traffic), encodes/decodes Datagram frames.
- CFMUX CAIF Mux layer. Handles multiplexing between multiple
physical bearers and multiple channels such as VEI, Datagram, etc.
The MUX keeps track of the existing CAIF Channels and
Physical Instances and selects the appropriate instance based
on Channel-Id and Physical-ID.
- CFFRML CAIF Framing layer. Handles Framing i.e. Frame length
and frame checksum.
- CFSERL CAIF Serial layer. Handles concatenation/split of frames
into CAIF Frames with correct length.
Layer 연결 구조와 호출 규칙
129-175Configuration layer `CFCNFG` 아래에는 AT `CFVEIL`, Control `CFCTRL`, Datagram `CFDGML` service가 놓입니다. 이 service들은 하나의 MUX로 모이고, MUX 아래에서 physical path별 `CFFRML` framing layer와 선택적인 `CFSERL` serial layer로 갈라집니다.
이 layered approach에는 다음 규칙이 적용됩니다.
- 모든 layer는 같은 structure인 `struct cflayer`를 embed합니다.
- 어떤 layer도 다른 layer의 private data에 의존하지 않습니다.
- Layer는 `layer->up`과 `layer->dn` pointer를 설정해 쌓습니다.
- Data를 위로 보내려면 각 layer가 `layer->up->receive(layer->up, packet);`을 호출합니다.
- Data를 아래로 보내려면 각 layer가 `layer->dn->transmit(layer->dn, packet);`을 호출합니다.
layer->up , layer->dn
layer->up->receive(layer->up, packet);
layer->dn->transmit(layer->dn, packet);
::
+---------+
| Config |
| CFCNFG |
+---------+
!
+---------+ +---------+ +---------+
| AT | | Control | | Datagram|
| CFVEIL | | CFCTRL | | CFDGML |
+---------+ +---------+ +---------+
\_____________!______________/
!
+---------+
| MUX |
| |
+---------+
_____!_____
/ \
+---------+ +---------+
| CFFRML | | CFFRML |
| Framing | | Framing |
+---------+ +---------+
! !
+---------+ +---------+
| | | Serial |
| | | CFSERL |
+---------+ +---------+
In this layered approach the following "rules" apply.
- All layers embed the same structure "struct cflayer"
- A layer does not depend on any other layer's private data.
- Layers are stacked by setting the pointers::
layer->up , layer->dn
- In order to send data upwards, each layer should do::
layer->up->receive(layer->up, packet);
- In order to send data downwards, each layer should do::
layer->dn->transmit(layer->dn, packet);
Socket·IP interface와 Link Layer
176-195CAIF Socket과 IP interface
IP interface와 CAIF socket API는 CAIF Core protocol 위에 구현됩니다. IP Interface와 CAIF socket도 CAIF Core protocol stack처럼 `struct cflayer` instance를 가집니다. Net device와 Socket은 CAIF stack의 나머지 부분처럼 `struct cflayer`가 정의한 `receive()` function을 구현합니다. 따라서 packet transmit과 receive도 다른 layer와 같은 방식으로 처리하며, data를 전송하려면 `dn->transmit()` function을 호출합니다.
Link Layer 구성
Link Layer는 Linux network device(`struct net_device`)로 구현합니다. Payload 처리와 등록에는 표준 Linux mechanism을 사용합니다.
CAIF Protocol은 retransmission을 구현하지 않고 lossless link layer에 의존합니다. 따라서 packet drop이 발생해서는 안 됩니다. 이를 위해 physical interface가 모든 CAIF Channel에 flow stop을 시작할 수 있는 flow-control mechanism을 구현합니다.
CAIF Socket and IP interface
============================
The IP interface and CAIF socket API are implemented on top of the
CAIF Core protocol. The IP Interface and CAIF socket have an instance of
'struct cflayer', just like the CAIF Core protocol stack.
Net device and Socket implement the 'receive()' function defined by
'struct cflayer', just like the rest of the CAIF stack. In this way, transmit and
receive of packets is handled as by the rest of the layers: the 'dn->transmit()'
function is called in order to transmit data.
Configuration of Link Layer
---------------------------
The Link Layer is implemented as Linux network devices (struct net_device).
Payload handling and registration is done using standard Linux mechanisms.
The CAIF Protocol relies on a loss-less link layer without implementing
retransmission. This implies that packet drops must not happen.
Therefore a flow-control mechanism is implemented where the physical
interface can initiate flow stop for all CAIF Channels.
요약·해설
linux_caif.rst:1-195CAIF는 modem과 host 사이에서 AT, IP datagram, utility traffic을 하나 이상의 physical bearer로 multiplexing합니다. Linux 구현은 공통 `struct cflayer` 계약을 사용해 client API, service layer, MUX, framing, serial/link layer를 위아래 호출 관계로 연결합니다.
원문 L35-55의 수직·수평 연결을 계층형 flow로 재구성했습니다.
원문 L129-156의 service·MUX·framing 구조를 보존한 흐름입니다.
각 component가 맡는 protocol 기능입니다.
모든 layer가 같은 호출 규칙으로 packet ownership과 흐름을 전달합니다.
CAIF에는 retransmission이 없으므로 하위 계층의 성질이 중요합니다.