← Documents Documentation/networking/dsa/bcm_sf2.rst GitHub 원문 ↗

Linux 6.18.37 · Networking

Broadcom Starfighter 2 Ethernet switch driver

Broadcom SF2 DSA 스위치의 하드웨어 블록, 간접 MDIO, MoCA 링크 처리, 전원 관리와 Wake-on-LAN을 설명합니다.

Source pathDocumentation/networking/dsa/bcm_sf2.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

bcm_sf2.rst:1-115

SF2는 여러 PHY와 외부 인터페이스를 묶는 SoC용 DSA 스위치입니다. 일반적인 DSA 태그 경로 위에 주소 30의 의사 PHY 충돌 우회, 펌웨어 기반 MoCA carrier 반영, 활성 포트에 맞춘 전력 절감, 호스트 MAC 기반 WoL이라는 하드웨어별 처리가 추가됩니다.

SF2 링크와 제어 경로
Device TreeDSA 탐색SF2 setupMMIO·인터럽트 설정
MDIO 트랜잭션phys_mii_mask외부 스위치 의사 PHY
MoCA 케이블·펌웨어 이벤트인터럽트 처리기fixed_link_update네트워크 carrier

관리 경로와 데이터·링크 이벤트 경로를 함께 보여 줍니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 =============================================
2 Broadcom Starfighter 2 Ethernet switch driver
3 =============================================
4
5 Broadcom's Starfighter 2 Ethernet switch hardware block is commonly found and
6 deployed in the following products:
7
8 - xDSL gateways such as BCM63138
9 - streaming/multimedia Set Top Box such as BCM7445
10 - Cable Modem/residential gateways such as BCM7145/BCM3390
11
12 The switch is typically deployed in a configuration involving between 5 to 13
13 ports, offering a range of built-in and customizable interfaces:
14
15 - single integrated Gigabit PHY
16 - quad integrated Gigabit PHY
17 - quad external Gigabit PHY w/ MDIO multiplexer
18 - integrated MoCA PHY
19 - several external MII/RevMII/GMII/RGMII interfaces
20
21 The switch also supports specific congestion control features which allow MoCA
22 fail-over not to lose packets during a MoCA role re-election, as well as out of
23 band back-pressure to the host CPU network interface when downstream interfaces
24 are connected at a lower speed.
25
26 The switch hardware block is typically interfaced using MMIO accesses and
27 contains a bunch of sub-blocks/registers:
28
29 - ``SWITCH_CORE``: common switch registers
30 - ``SWITCH_REG``: external interfaces switch register
31 - ``SWITCH_MDIO``: external MDIO bus controller (there is another one in SWITCH_CORE,
32 which is used for indirect PHY accesses)
33 - ``SWITCH_INDIR_RW``: 64-bits wide register helper block
34 - ``SWITCH_INTRL2_0/1``: Level-2 interrupt controllers
35 - ``SWITCH_ACB``: Admission control block
36 - ``SWITCH_FCB``: Fail-over control block
37
38 Implementation details
39 ======================
40
41 The driver is located in ``drivers/net/dsa/bcm_sf2.c`` and is implemented as a DSA
42 driver; see ``Documentation/networking/dsa/dsa.rst`` for details on the subsystem
43 and what it provides.
44
45 The SF2 switch is configured to enable a Broadcom specific 4-bytes switch tag
46 which gets inserted by the switch for every packet forwarded to the CPU
47 interface, conversely, the CPU network interface should insert a similar tag for
48 packets entering the CPU port. The tag format is described in
49 ``net/dsa/tag_brcm.c``.
50
51 Overall, the SF2 driver is a fairly regular DSA driver; there are a few
52 specifics covered below.
53
54 Device Tree probing
55 -------------------
56
57 The DSA platform device driver is probed using a specific compatible string
58 provided in ``net/dsa/dsa.c``. The reason for that is because the DSA subsystem gets
59 registered as a platform device driver currently. DSA will provide the needed
60 device_node pointers which are then accessible by the switch driver setup
61 function to setup resources such as register ranges and interrupts. This
62 currently works very well because none of the of_* functions utilized by the
63 driver require a struct device to be bound to a struct device_node, but things
64 may change in the future.
65
66 MDIO indirect accesses
67 ----------------------
68
69 Due to a limitation in how Broadcom switches have been designed, external
70 Broadcom switches connected to a SF2 require the use of the DSA user MDIO bus
71 in order to properly configure them. By default, the SF2 pseudo-PHY address, and
72 an external switch pseudo-PHY address will both be snooping for incoming MDIO
73 transactions, since they are at the same address (30), resulting in some kind of
74 "double" programming. Using DSA, and setting ``ds->phys_mii_mask`` accordingly, we
75 selectively divert reads and writes towards external Broadcom switches
76 pseudo-PHY addresses. Newer revisions of the SF2 hardware have introduced a
77 configurable pseudo-PHY address which circumvents the initial design limitation.
78
79 Multimedia over CoAxial (MoCA) interfaces
80 -----------------------------------------
81
82 MoCA interfaces are fairly specific and require the use of a firmware blob which
83 gets loaded onto the MoCA processor(s) for packet processing. The switch
84 hardware contains logic which will assert/de-assert link states accordingly for
85 the MoCA interface whenever the MoCA coaxial cable gets disconnected or the
86 firmware gets reloaded. The SF2 driver relies on such events to properly set its
87 MoCA interface carrier state and properly report this to the networking stack.
88
89 The MoCA interfaces are supported using the PHY library's fixed PHY/emulated PHY
90 device and the switch driver registers a ``fixed_link_update`` callback for such
91 PHYs which reflects the link state obtained from the interrupt handler.
92
93
94 Power Management
95 ----------------
96
97 Whenever possible, the SF2 driver tries to minimize the overall switch power
98 consumption by applying a combination of:
99
100 - turning off internal buffers/memories
101 - disabling packet processing logic
102 - putting integrated PHYs in IDDQ/low-power
103 - reducing the switch core clock based on the active port count
104 - enabling and advertising EEE
105 - turning off RGMII data processing logic when the link goes down
106
107 Wake-on-LAN
108 -----------
109
110 Wake-on-LAN is currently implemented by utilizing the host processor Ethernet
111 MAC controller wake-on logic. Whenever Wake-on-LAN is requested, an intersection
112 between the user request and the supported host Ethernet interface WoL
113 capabilities is done and the intersection result gets configured. During
114 system-wide suspend/resume, only ports not participating in Wake-on-LAN are
115 disabled.
116

3. 한국어 전문 번역

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

Starfighter 2 배치 형태와 하드웨어 블록

1-37

Broadcom Starfighter 2 이더넷 스위치 드라이버

Broadcom Starfighter 2 이더넷 스위치 하드웨어 블록은 BCM63138 같은 xDSL 게이트웨이, BCM7445 같은 스트리밍·멀티미디어 셋톱박스, BCM7145 또는 BCM3390 같은 케이블 모뎀·가정용 게이트웨이에 널리 배치됩니다.

일반적인 구성은 5개에서 13개 포트를 사용하며, 단일 또는 4중 통합 Gigabit PHY, MDIO 멀티플렉서가 있는 4중 외부 Gigabit PHY, 통합 MoCA PHY, 여러 외부 MII·RevMII·GMII·RGMII 인터페이스를 제공합니다.

스위치는 MoCA 역할 재선출 동안 패킷 손실을 막는 MoCA 장애 조치와, 다운스트림 인터페이스가 더 낮은 속도로 연결될 때 호스트 CPU 네트워크 인터페이스에 대역 외 역압을 가하는 혼잡 제어 기능도 지원합니다.

스위치 하드웨어 블록은 보통 MMIO로 접근하며 여러 하위 블록과 레지스터를 포함합니다.

SF2 하드웨어 블록
블록역할
SWITCH_CORE공통 스위치 레지스터
SWITCH_REG외부 인터페이스 스위치 레지스터
SWITCH_MDIO외부 MDIO 버스 컨트롤러
SWITCH_INDIR_RW64비트 레지스터 접근 도우미
SWITCH_INTRL2_0/1레벨 2 인터럽트 컨트롤러
SWITCH_ACB승인 제어 블록
SWITCH_FCB장애 조치 제어 블록

각 MMIO 하위 블록의 역할을 구분합니다.

`SWITCH_CORE` 안에는 간접 PHY 접근에 쓰는 별도의 MDIO 컨트롤러도 있습니다.

=============================================
Broadcom Starfighter 2 Ethernet switch driver
=============================================

Broadcom's Starfighter 2 Ethernet switch hardware block is commonly found and
deployed in the following products:

- xDSL gateways such as BCM63138
- streaming/multimedia Set Top Box such as BCM7445
- Cable Modem/residential gateways such as BCM7145/BCM3390

The switch is typically deployed in a configuration involving between 5 to 13
ports, offering a range of built-in and customizable interfaces:

- single integrated Gigabit PHY
- quad integrated Gigabit PHY
- quad external Gigabit PHY w/ MDIO multiplexer
- integrated MoCA PHY
- several external MII/RevMII/GMII/RGMII interfaces

The switch also supports specific congestion control features which allow MoCA
fail-over not to lose packets during a MoCA role re-election, as well as out of
band back-pressure to the host CPU network interface when downstream interfaces
are connected at a lower speed.

The switch hardware block is typically interfaced using MMIO accesses and
contains a bunch of sub-blocks/registers:

- ``SWITCH_CORE``: common switch registers
- ``SWITCH_REG``: external interfaces switch register
- ``SWITCH_MDIO``: external MDIO bus controller (there is another one in SWITCH_CORE,
  which is used for indirect PHY accesses)
- ``SWITCH_INDIR_RW``: 64-bits wide register helper block
- ``SWITCH_INTRL2_0/1``: Level-2 interrupt controllers
- ``SWITCH_ACB``: Admission control block
- ``SWITCH_FCB``: Fail-over control block

DSA 드라이버와 4바이트 태그

38-53

구현 세부 사항

드라이버는 `drivers/net/dsa/bcm_sf2.c`에 있고 DSA 드라이버로 구현됩니다. DSA 하위 시스템에 관한 자세한 내용은 `Documentation/networking/dsa/dsa.rst`를 참고하십시오.

SF2 스위치는 Broadcom 전용 4바이트 스위치 태그를 사용합니다. 스위치는 CPU 인터페이스로 전달하는 모든 패킷에 태그를 넣고, CPU 네트워크 인터페이스는 CPU 포트로 들어가는 패킷에 같은 태그를 넣어야 합니다. 형식은 `net/dsa/tag_brcm.c`에 설명되어 있습니다.

전반적으로 SF2는 일반적인 DSA 드라이버이며, 아래 절에서 몇 가지 고유 사항을 다룹니다.

Implementation details
======================

The driver is located in ``drivers/net/dsa/bcm_sf2.c`` and is implemented as a DSA
driver; see ``Documentation/networking/dsa/dsa.rst`` for details on the subsystem
and what it provides.

The SF2 switch is configured to enable a Broadcom specific 4-bytes switch tag
which gets inserted by the switch for every packet forwarded to the CPU
interface, conversely, the CPU network interface should insert a similar tag for
packets entering the CPU port. The tag format is described in
``net/dsa/tag_brcm.c``.

Overall, the SF2 driver is a fairly regular DSA driver; there are a few
specifics covered below.

Device Tree 탐색 방식

54-65

Device Tree 탐색

DSA 플랫폼 장치 드라이버는 `net/dsa/dsa.c`에 제공된 전용 compatible 문자열로 탐색됩니다. 현재 DSA 하위 시스템 자체가 플랫폼 장치 드라이버로 등록되기 때문입니다.

DSA는 필요한 `device_node` 포인터를 제공하고, 스위치 드라이버의 setup 함수는 이를 이용해 레지스터 범위와 인터럽트 같은 리소스를 설정합니다.

현재 드라이버가 사용하는 `of_*` 함수 중 어느 것도 `struct device`가 `struct device_node`에 바인딩되어 있을 것을 요구하지 않으므로 잘 동작하지만, 이 조건은 앞으로 달라질 수 있습니다.

Device Tree probing
-------------------

The DSA platform device driver is probed using a specific compatible string
provided in ``net/dsa/dsa.c``. The reason for that is because the DSA subsystem gets
registered as a platform device driver currently. DSA will provide the needed
device_node pointers which are then accessible by the switch driver setup
function to setup resources such as register ranges and interrupts. This
currently works very well because none of the of_* functions utilized by the
driver require a struct device to be bound to a struct device_node, but things
may change in the future.

외부 스위치의 간접 MDIO 접근

66-78

MDIO 간접 접근

Broadcom 스위치 설계의 제약 때문에 SF2에 연결된 외부 Broadcom 스위치를 올바르게 구성하려면 DSA 사용자 MDIO 버스를 사용해야 합니다.

기본적으로 SF2 의사 PHY 주소와 외부 스위치 의사 PHY 주소가 둘 다 같은 주소 30에서 들어오는 MDIO 트랜잭션을 감시하므로 이중 프로그래밍이 발생합니다.

DSA를 사용하고 `ds->phys_mii_mask`를 적절히 설정하면 읽기와 쓰기를 외부 Broadcom 스위치의 의사 PHY 주소로 선택적으로 우회시킬 수 있습니다. 최신 SF2 하드웨어 리비전은 구성 가능한 의사 PHY 주소를 도입해 초기 설계 제약을 피합니다.

MDIO indirect accesses
----------------------

Due to a limitation in how Broadcom switches have been designed, external
Broadcom switches connected to a SF2 require the use of the DSA user MDIO bus
in order to properly configure them. By default, the SF2 pseudo-PHY address, and
an external switch pseudo-PHY address will both be snooping for incoming MDIO
transactions, since they are at the same address (30), resulting in some kind of
"double" programming. Using DSA, and setting ``ds->phys_mii_mask`` accordingly, we
selectively divert reads and writes towards external Broadcom switches
pseudo-PHY addresses. Newer revisions of the SF2 hardware have introduced a
configurable pseudo-PHY address which circumvents the initial design limitation.

MoCA 링크 상태와 고정 PHY

79-93

동축 케이블 기반 멀티미디어(MoCA) 인터페이스

MoCA 인터페이스는 패킷 처리를 위해 MoCA 프로세서에 로드할 펌웨어 blob이 필요합니다. 스위치 하드웨어에는 MoCA 동축 케이블이 분리되거나 펌웨어가 다시 로드될 때 인터페이스 링크 상태를 알맞게 단언하거나 해제하는 로직이 있습니다.

SF2 드라이버는 이 이벤트를 이용해 MoCA 인터페이스의 carrier 상태를 설정하고 네트워크 스택에 보고합니다.

MoCA 인터페이스는 PHY 라이브러리의 fixed PHY 또는 에뮬레이션 PHY 장치를 통해 지원합니다. 스위치 드라이버는 인터럽트 처리기에서 얻은 링크 상태를 반영하는 `fixed_link_update` 콜백을 이 PHY에 등록합니다.

Multimedia over CoAxial (MoCA) interfaces
-----------------------------------------

MoCA interfaces are fairly specific and require the use of a firmware blob which
gets loaded onto the MoCA processor(s) for packet processing. The switch
hardware contains logic which will assert/de-assert link states accordingly for
the MoCA interface whenever the MoCA coaxial cable gets disconnected or the
firmware gets reloaded. The SF2 driver relies on such events to properly set its
MoCA interface carrier state and properly report this to the networking stack.

The MoCA interfaces are supported using the PHY library's fixed PHY/emulated PHY
device and the switch driver registers a ``fixed_link_update`` callback for such
PHYs which reflects the link state obtained from the interrupt handler.

포트 상태 기반 전력 절감

94-106

전원 관리

SF2 드라이버는 가능한 경우 내부 버퍼와 메모리 끄기, 패킷 처리 로직 비활성화, 통합 PHY를 IDDQ 또는 저전력 상태로 전환, 활성 포트 수에 따른 스위치 코어 클록 감소, EEE 활성화 및 광고, 링크가 내려갔을 때 RGMII 데이터 처리 로직 끄기를 조합하여 전체 전력 소비를 줄입니다.

Power Management
----------------

Whenever possible, the SF2 driver tries to minimize the overall switch power
consumption by applying a combination of:

- turning off internal buffers/memories
- disabling packet processing logic
- putting integrated PHYs in IDDQ/low-power
- reducing the switch core clock based on the active port count
- enabling and advertising EEE
- turning off RGMII data processing logic when the link goes down

호스트 MAC을 이용한 Wake-on-LAN

107-115

Wake-on-LAN

현재 Wake-on-LAN은 호스트 프로세서 이더넷 MAC 컨트롤러의 깨우기 로직을 이용해 구현합니다.

Wake-on-LAN이 요청되면 사용자 요청과 호스트 이더넷 인터페이스가 지원하는 WoL 기능의 교집합을 구하고, 그 결과를 구성합니다. 시스템 전체 suspend 및 resume 동안에는 Wake-on-LAN에 참여하지 않는 포트만 비활성화합니다.

Wake-on-LAN
-----------

Wake-on-LAN is currently implemented by utilizing the host processor Ethernet
MAC controller wake-on logic. Whenever Wake-on-LAN is requested, an intersection
between the user request and the supported host Ethernet interface WoL
capabilities is done and the intersection result gets configured. During
system-wide suspend/resume, only ports not participating in Wake-on-LAN are
disabled.