PORT テーブル¶
概要¶
物理スイッチポートの設定を保持するテーブル。ポート名(Ethernet0 など)をキーに、speed、lanes、MTU、admin status、FEC、auto-negotiation、breakout subport、MACsec プロファイル、TPID、mux cable 情報、400G ZR トランシーバ向けの tx-power / laser_freq などを記載する1。
portmgrd / orchagent の PortsOrch が PORT テーブルを購読し、SAI 経由で hardware に設定を反映する。speed と lanes は通常 port_config.ini 由来の初期値で、運用中に CLI で変更可能。
データフロー (自動生成)¶
flowchart LR
CDB[("CONFIG_DB<br/>PORT")]
DM["portmgrd"]
CDB --> DM
APPDB[("APP_DB<br/>APP_PORT_TABLE")]
DM --> APPDB
SYNCD["syncd"]
APPDB --> SYNCD
SAI["SAI<br/>sai_port_api"]
SYNCD --> SAI
凡例
CONFIG_DB から SAI までの典型経路を docs/reference/config-db-orch-map.md から機械生成したミニ図。詳細・例外は本ページ本文と対応表を参照。
key 構造¶
<name> は Ethernet<N> 形式の物理ポート名。
フィールド一覧¶
| フィールド | 型 | 必須 | デフォルト | 説明 |
|---|---|---|---|---|
name (key) |
string (1..128) | ✅ | - | 物理ポート名(例: Ethernet0) |
core_id |
string (1..16) | - | - | ポートが属する ASIC コア |
core_port_id |
string (1..16) | - | - | ASIC コア上のポート ID |
num_voq |
string (1..16) | - | - | このポートでサポートする VoQ 数 |
alias |
string (1..128) | - | - | ベンダ固有のポート別名/フロントパネル表記 |
lanes |
string (1..128) | ✅ (chassis 例外あり) | - | ハードウェアレーン数(chassis では条件付き) |
mode |
switchport_mode (routed/access/trunk) |
- | routed |
スイッチポートモード |
description |
string (0..255) | - | - | ユーザ定義説明 |
speed |
uint32 (1..1600000) | ✅ | - | ポート速度 [Mbps] |
dhcp_rate_limit |
uint32 | - | 300 |
DHCP DOS 緩和レート |
link_training |
string on/off |
- | - | リンクトレーニング |
autoneg |
string on/off |
- | - | オートネゴシエーション |
adv_speeds |
leaf-list uint32 | all |
- | - | 広告する速度。all は単独でのみ |
interface_type |
interface_type |
- | - | ポートインタフェースタイプ |
adv_interface_types |
leaf-list interface_type | all |
- | - | 広告するインタフェースタイプ |
mtu |
uint16 (68..9216) | - | - | MTU [byte] |
subport |
uint8 (0..8) | - | - | breakout で生成された論理サブポート番号 |
index |
uint16 | - | - | フロントパネルポートインデックス |
asic_port_name |
string | - | - | ASIC 内部のポート名(例: Eth0-ASIC1) |
role |
string Ext/Int/Inb/Rec/Dpc |
- | Ext |
多 ASIC / SmartSwitch のロール |
admin_status |
admin_status (up/down) |
- | down |
管理状態 |
fec |
string rs/fc/none/auto |
- | - | 前方誤り訂正モード |
dom_polling |
admin_mode (enabled/disabled) |
- | - | DOM (Digital Optical Monitoring) ポーリング |
pfc_asym |
string on/off |
- | - | 非対称 PFC |
tpid |
tpid_type (0x8100 / 0x9100 / 0x9200 / 0x88a8) |
- | - | TPID。HW 対応時のみ |
mux_cable |
boolean | - | - | dual-ToR mux cable 接続フラグ |
macsec |
leafref MACSEC_PROFILE.name |
- | - | 適用する MACsec プロファイル |
tx_power |
decimal64 | - | - | 400G ZR 向け目標出力 [dBm] |
laser_freq |
int32 | - | - | 400G ZR 向け目標レーザ周波数 [GHz] |
fast_linkup |
boolean | - | false |
fast link-up |
制約¶
lanesは通常mandatory trueだが、switch_typeがvoq/chassis-packet/fabricまたはhwskuがmsft_*_asic_vsの場合は除外(when条件)1adv_speeds/adv_interface_typesはallを指定する場合 1 要素のみ(must)
購読者¶
orchagentのPortsOrch: PORT 全フィールドを購読し、SAI でSAI_PORT_ATTR_*に反映portmgrd: ポート status と admin_status をモニタxcvrd: トランシーバ関連 (tx_power、laser_freq、dom_polling) をモニタlinkmgrd:mux_cable = trueのポートを mux 制御対象として扱うmacsecmgrd:macsec参照をもとに MACsec セッション確立
関連 CONFIG_DB テーブル / YANG / CLI¶
- 関連 CONFIG_DB:
VLAN_MEMBER(PORT を leafref 参照)、PORTCHANNEL_MEMBER(PORT を leafref)、INTERFACE(L3 用 PORT 上の IP)、MACSEC_PROFILE、BUFFER_PG/BUFFER_QUEUE - 関連 CLI:
config interface(speed / mtu / admin / fec / autoneg を変更) - 関連 YANG:
sonic-port、sonic-types(switchport_mode、admin_status、interface_type、tpid_type)
値依存挙動マトリクス¶
PORT.admin_status¶
| 値 | PortsOrch / portmgrd 挙動 |
|---|---|
up |
SAI SAI_PORT_ATTR_ADMIN_STATE=true、Linux netdev も up |
down (デフォルト) |
SAI SAI_PORT_ATTR_ADMIN_STATE=false、netdev down |
PORT.fec¶
| 値 | SAI 属性 | 挙動 |
|---|---|---|
rs |
SAI_PORT_FEC_MODE_RS | Reed-Solomon FEC (100G+ 向け) |
fc |
SAI_PORT_FEC_MODE_FC | FireCode FEC (25G 向け) |
none |
SAI_PORT_FEC_MODE_NONE | FEC 無効 |
auto |
SAI_PORT_FEC_MODE_AUTO | 対向とネゴシエーションで決定 |
| 不正 | - | Failed to set FEC mode SWSS_LOG_ERROR |
PORT.autoneg / link_training¶
| 値 | 挙動 |
|---|---|
on |
オートネゴ / リンクトレーニングを有効化 |
off |
無効化 |
on (非サポート HW) |
autoneg is not supported (cap=%d) SWSS_LOG_ERROR |
PORT.mode (switchport_mode)¶
| 値 | 挙動 |
|---|---|
routed (デフォルト) |
L3 ルーテッドポートとして扱う |
access |
L2 access ポート (single VLAN) |
trunk |
L2 trunk ポート (複数 VLAN) |
PORT.role (multi-ASIC / SmartSwitch)¶
| 値 | 意味 |
|---|---|
Ext (デフォルト) |
外部向けポート |
Int |
内部 ASIC 間接続 |
Inb |
inband 管理ポート |
Rec |
recirculation ポート |
Dpc |
DPC (Data Plane CPU) ポート |
PORT.tpid¶
| 値 | SAI 属性 | 備考 |
|---|---|---|
0x8100 |
標準 802.1Q | デフォルト TPID |
0x9100 / 0x9200 |
Q-in-Q / VLAN Stacking | HW 対応が必要 |
0x88a8 / 0x88A8 |
802.1ad (Provider Bridging) | HW 対応が必要 |
speed は uint32 (1..1600000 Mbps)、mtu は uint16 (68..9216 byte)。adv_speeds/adv_interface_types で all と他値の混在は must 制約で reject。
例外条件・特殊挙動¶
YANG スキーマ検証¶
lanesは mandatory (chassis 以外)、length 1..128。speedは mandatory、range 1..1600000 (Kbps)。mturange: 68..9216。fecpattern:rs|fc|none|auto。autoneg/pfc_asympattern:on|off。adv_speeds:allと他値の混在はmust制約で reject。adv_interface_typesも同様。
consumer (portsorch / portmgr) 例外動作¶
- 非サポート speed: SAI supported speed リストと照合; 不一致は SWSS_LOG_ERROR + 処理中断。
- MTU 設定失敗:
Failed to set MTU %u to port pid→ SWSS_LOG_ERROR。 - FEC モード不正:
Failed to set FEC mode→ SWSS_LOG_ERROR。 - AutoNeg 設定失敗:
Failed to set AutoNeg %u to port %s→ SWSS_LOG_ERROR。 autoneg非サポート:autoneg is not supported (cap=%d)→ SWSS_LOG_ERROR。- portmgr MTU netdev 設定失敗:
Setting mtu to alias:%s netdev failed→ SWSS_LOG_WARN +return false。 - portmgr admin_status netdev 設定失敗:
Setting admin_status to alias:%s netdev failed→ SWSS_LOG_WARN +return false。
関連リファレンス¶
- YANG:
sonic-port - CLI:
config interface
引用元¶
関連 Topics¶
運用ヒント¶
典型値¶
Ethernet0等のEthernetN形式キー。Nは port_config.ini 由来の lane base。speed: 10000 / 25000 / 40000 / 100000 / 400000 (Mbps)。mtu: 9100(jumbo を有効にする一般運用値)。admin_status:up(運用ポート)。fec:rs(100G+) /fc(25G) /none。autoneg:on/off(25G/100G の対向と合わせる)。
よくある誤設定¶
speedをlanes数と不整合な値にすると SAI がSAI_STATUS_INVALID_PARAMETERを返してポートが down のまま。- 対向と
fecが不一致だと PHY は up しても link 不安定。両端を同じ FEC モードに揃える。 mtuを VLAN/PortChannel メンバ間で揃えないと L2 で巨大フレームがドロップされる。- Breakout 中の親ポートに
admin_status: upを残すと subport と二重設定で orchagent エラー。
確認コマンド¶
sonic-db-cli CONFIG_DB hgetall 'PORT|Ethernet0'
show interfaces status
show interfaces transceiver eeprom Ethernet0
-
YANG 定義:
sonic-buildimage/src/sonic-yang-models/yang-models/sonic-port.yang(sha9ea932ec). https://github.com/sonic-net/sonic-buildimage/blob/9ea932ec2e18f35e58268ec2e4456b1d4afd65cd/src/sonic-yang-models/yang-models/sonic-port.yang ↩↩