Linuxにはftraceと言うカーネル内部の動きを覗き見る機能があります。cumulusで採用されているlinuxカーネルでもこの機能は有効になっています。以下はEdgeCore AS7712にcumulus 3.6がインストールされたマシンでの操作例です。

root@as7712:# grep CONFIG_FTRACE /boot/config-4.1.0-cl-7-amd64
CONFIG_FTRACE=y
CONFIG_FTRACE_SYSCALLS=y
CONFIG_FTRACE_MCOUNT_RECORD=y
# CONFIG_FTRACE_STARTUP_TEST is not set
# mount -t debugfs nodev /sys/kernel/debug

I2Cの通信情報を蓄えるには

#echo 1 > /sys/kernel/debug/tracing/events/i2c/enable

即座に/sys/kernel/debug/tracing/traceに出力されます

出力を停止するのは

#echo 0 > /sys/kernel/debug/tracing/events/i2c/enable

しかし全部のI2Cはとても大量なので、特定のポートのQSFPに関する情報だけのフィルターが必要です

i2c-22が1番ポート(swp1)のI2Cインターフェースなので。

# echo adapter_nr==22 > /sys/kernel/debug/tracing/events/i2c/filter

 

出力例

root@as7712:/sys/kernel/debug/tracing/events/i2c# tail -100 /sys/kernel/debug/tracing/trace
portwd-874   [003] .... 23152.098963: smbus_result: i2c-22 a=050 f=0000 c=c0 I2C_BLOCK_DATA rd res=0
portwd-874   [003] .... 23152.264905: smbus_read: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA
portwd-874   [003] .... 23152.265810: smbus_reply: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA l=2 [01-11]
portwd-874   [003] .... 23152.265811: smbus_result: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA rd res=0
portwd-874   [003] .... 23152.266045: smbus_read: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA
portwd-874   [003] .... 23152.266966: smbus_reply: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA l=2 [01-11]
portwd-874   [003] .... 23152.266967: smbus_result: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA rd res=0
portwd-874   [003] .... 23152.267119: smbus_read: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA
portwd-874   [003] .... 23152.268040: smbus_reply: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA l=2 [01-11]
portwd-874   [003] .... 23152.268041: smbus_result: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA rd res=0
portwd-874   [003] .... 23152.268115: smbus_read: i2c-22 a=050 f=0000 c=81 I2C_BLOCK_DATA
portwd-874   [003] .... 23152.269049: smbus_reply: i2c-22 a=050 f=0000 c=81 I2C_BLOCK_DATA l=2 [01-cc]
portwd-874   [003] .... 23152.269051: smbus_result: i2c-22 a=050 f=0000 c=81 I2C_BLOCK_DATA rd res=0
portwd-874   [003] .... 23152.269114: smbus_read: i2c-22 a=050 f=0000 c=c2 I2C_BLOCK_DATA
portwd-874   [003] .... 23152.270041: smbus_reply: i2c-22 a=050 f=0000 c=c2 I2C_BLOCK_DATA l=2 [01-c0]
portwd-874   [003] .... 23152.270042: smbus_result: i2c-22 a=050 f=0000 c=c2 I2C_BLOCK_DATA rd res=0
portwd-874   [003] .... 23152.270105: smbus_read: i2c-22 a=050 f=0000 c=62 I2C_BLOCK_DATA
portwd-874   [003] .... 23152.271000: smbus_reply: i2c-22 a=050 f=0000 c=62 I2C_BLOCK_DATA l=2 [01-ff]
portwd-874   [003] .... 23152.271001: smbus_result: i2c-22 a=050 f=0000 c=62 I2C_BLOCK_DATA rd res=0
portwd-874   [003] .... 23157.590936: smbus_read: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA
portwd-874   [003] .... 23157.591887: smbus_reply: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA l=2 [01-11]
portwd-874   [003] .... 23157.591889: smbus_result: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA rd res=0
portwd-874   [003] .... 23157.592019: smbus_read: i2c-22 a=050 f=0000 c=a5 I2C_BLOCK_DATA
portwd-874   [003] .... 23157.593164: smbus_reply: i2c-22 a=050 f=0000 c=a5 I2C_BLOCK_DATA l=4 [03-00-0f-0e]
portwd-874   [003] .... 23157.593167: smbus_result: i2c-22 a=050 f=0000 c=a5 I2C_BLOCK_DATA rd res=0
portwd-874   [003] .... 23157.593335: smbus_read: i2c-22 a=050 f=0000 c=a8 I2C_BLOCK_DATA
portwd-874   [003] .... 23157.595633: smbus_reply: i2c-22 a=050 f=0000 c=a8 I2C_BLOCK_DATA l=17 [10-57-53-54-2d-51-53-32-38-2d-43-4d-34-2d-43-20-20]
portwd-874   [003] .... 23157.595635: smbus_result: i2c-22 a=050 f=0000 c=a8 I2C_BLOCK_DATA rd res=0
portwd-874   [003] .... 23157.595752: smbus_read: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA
portwd-874   [003] .... 23157.596708: smbus_reply: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA l=2 [01-11]
portwd-874   [003] .... 23157.596710: smbus_result: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA rd res=0
portwd-874   [003] .... 23157.596828: smbus_read: i2c-22 a=050 f=0000 c=94 I2C_BLOCK_DATA
portwd-874   [003] .... 23157.599155: smbus_reply: i2c-22 a=050 f=0000 c=94 I2C_BLOCK_DATA l=17 [10-57-41-56-45-53-50-4c-49-54-54-45-52-20-20-20-20]
portwd-874   [003] .... 23157.599158: smbus_result: i2c-22 a=050 f=0000 c=94 I2C_BLOCK_DATA rd res=0
portwd-874   [003] .... 23157.599283: smbus_read: i2c-22 a=050 f=0000 c=a8 I2C_BLOCK_DATA
portwd-874   [003] .... 23157.601591: smbus_reply: i2c-22 a=050 f=0000 c=a8 I2C_BLOCK_DATA l=17 [10-57-53-54-2d-51-53-32-38-2d-43-4d-34-2d-43-20-20]
portwd-874   [003] .... 23157.601594: smbus_result: i2c-22 a=050 f=0000 c=a8 I2C_BLOCK_DATA rd res=0
portwd-874   [003] .... 23157.601707: smbus_read: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA
portwd-874   [003] .... 23157.602666: smbus_reply: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA l=2 [01-11]
portwd-874   [003] .... 23157.602668: smbus_result: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA rd res=0
portwd-874   [003] .... 23157.602785: smbus_read: i2c-22 a=050 f=0000 c=83 I2C_BLOCK_DATA
portwd-874   [003] .... 23157.603770: smbus_reply: i2c-22 a=050 f=0000 c=83 I2C_BLOCK_DATA l=2 [01-80]
portwd-874   [003] .... 23157.603773: smbus_result: i2c-22 a=050 f=0000 c=83 I2C_BLOCK_DATA rd res=0
portwd-874   [003] .... 23157.603907: smbus_read: i2c-22 a=050 f=0000 c=c0 I2C_BLOCK_DATA
portwd-874   [003] .... 23157.604845: smbus_reply: i2c-22 a=050 f=0000 c=c0 I2C_BLOCK_DATA l=2 [01-06]
portwd-874   [003] .... 23157.604848: smbus_result: i2c-22 a=050 f=0000 c=c0 I2C_BLOCK_DATA rd res=0
portwd-874   [002] .... 23157.771473: smbus_read: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA
portwd-874   [002] .... 23157.772435: smbus_reply: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA l=2 [01-11]
portwd-874   [002] .... 23157.772437: smbus_result: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA rd res=0
portwd-874   [002] .... 23157.777331: smbus_read: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA
portwd-874   [002] .... 23157.778287: smbus_reply: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA l=2 [01-11]
portwd-874   [002] .... 23157.778289: smbus_result: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA rd res=0
portwd-874   [002] .... 23157.778421: smbus_read: i2c-22 a=050 f=0000 c=82 I2C_BLOCK_DATA
portwd-874   [002] .... 23157.779373: smbus_reply: i2c-22 a=050 f=0000 c=82 I2C_BLOCK_DATA l=2 [01-07]
portwd-874   [002] .... 23157.779375: smbus_result: i2c-22 a=050 f=0000 c=82 I2C_BLOCK_DATA rd res=0
portwd-874   [002] .... 23157.779508: smbus_read: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA
portwd-874   [002] .... 23157.780440: smbus_reply: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA l=2 [01-11]
portwd-874   [002] .... 23157.780442: smbus_result: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA rd res=0
portwd-874   [002] .... 23157.780549: smbus_read: i2c-22 a=050 f=0000 c=a5 I2C_BLOCK_DATA
portwd-874   [002] .... 23157.781680: smbus_reply: i2c-22 a=050 f=0000 c=a5 I2C_BLOCK_DATA l=4 [03-00-0f-0e]
portwd-874   [002] .... 23157.781682: smbus_result: i2c-22 a=050 f=0000 c=a5 I2C_BLOCK_DATA rd res=0
portwd-874   [002] .... 23157.781799: smbus_read: i2c-22 a=050 f=0000 c=a8 I2C_BLOCK_DATA
portwd-874   [002] .... 23157.784125: smbus_reply: i2c-22 a=050 f=0000 c=a8 I2C_BLOCK_DATA l=17 [10-57-53-54-2d-51-53-32-38-2d-43-4d-34-2d-43-20-20]
portwd-874   [002] .... 23157.784127: smbus_result: i2c-22 a=050 f=0000 c=a8 I2C_BLOCK_DATA rd res=0
portwd-874   [002] .... 23157.784233: smbus_read: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA
portwd-874   [002] .... 23157.785176: smbus_reply: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA l=2 [01-11]
portwd-874   [002] .... 23157.785178: smbus_result: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA rd res=0
portwd-874   [002] .... 23157.785284: smbus_read: i2c-22 a=050 f=0000 c=94 I2C_BLOCK_DATA
portwd-874   [002] .... 23157.787592: smbus_reply: i2c-22 a=050 f=0000 c=94 I2C_BLOCK_DATA l=17 [10-57-41-56-45-53-50-4c-49-54-54-45-52-20-20-20-20]
portwd-874   [002] .... 23157.787595: smbus_result: i2c-22 a=050 f=0000 c=94 I2C_BLOCK_DATA rd res=0
portwd-874   [002] .... 23157.787694: smbus_read: i2c-22 a=050 f=0000 c=a8 I2C_BLOCK_DATA
portwd-874   [003] .... 23157.790008: smbus_reply: i2c-22 a=050 f=0000 c=a8 I2C_BLOCK_DATA l=17 [10-57-53-54-2d-51-53-32-38-2d-43-4d-34-2d-43-20-20]
portwd-874   [003] .... 23157.790011: smbus_result: i2c-22 a=050 f=0000 c=a8 I2C_BLOCK_DATA rd res=0
portwd-874   [003] .... 23157.790118: smbus_read: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA
portwd-874   [003] .... 23157.791070: smbus_reply: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA l=2 [01-11]
portwd-874   [003] .... 23157.791072: smbus_result: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA rd res=0
portwd-874   [003] .... 23157.791180: smbus_read: i2c-22 a=050 f=0000 c=83 I2C_BLOCK_DATA
portwd-874   [003] .... 23157.792151: smbus_reply: i2c-22 a=050 f=0000 c=83 I2C_BLOCK_DATA l=2 [01-80]
portwd-874   [003] .... 23157.792153: smbus_result: i2c-22 a=050 f=0000 c=83 I2C_BLOCK_DATA rd res=0
portwd-874   [003] .... 23157.792278: smbus_read: i2c-22 a=050 f=0000 c=c0 I2C_BLOCK_DATA
portwd-874   [003] .... 23157.793213: smbus_reply: i2c-22 a=050 f=0000 c=c0 I2C_BLOCK_DATA l=2 [01-06]
portwd-874   [003] .... 23157.793215: smbus_result: i2c-22 a=050 f=0000 c=c0 I2C_BLOCK_DATA rd res=0
portwd-874   [000] .... 23157.960668: smbus_read: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA
portwd-874   [000] .... 23157.961587: smbus_reply: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA l=2 [01-11]
portwd-874   [000] .... 23157.961588: smbus_result: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA rd res=0
portwd-874   [000] .... 23157.961804: smbus_read: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA
portwd-874   [001] .... 23157.962699: smbus_reply: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA l=2 [01-11]
portwd-874   [001] .... 23157.962701: smbus_result: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA rd res=0
portwd-874   [001] .... 23157.962879: smbus_read: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA
portwd-874   [001] .... 23157.963801: smbus_reply: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA l=2 [01-11]
portwd-874   [001] .... 23157.963803: smbus_result: i2c-22 a=050 f=0000 c=0 I2C_BLOCK_DATA rd res=0
portwd-874   [001] .... 23157.963876: smbus_read: i2c-22 a=050 f=0000 c=81 I2C_BLOCK_DATA
portwd-874   [001] .... 23157.964801: smbus_reply: i2c-22 a=050 f=0000 c=81 I2C_BLOCK_DATA l=2 [01-cc]
portwd-874   [001] .... 23157.964803: smbus_result: i2c-22 a=050 f=0000 c=81 I2C_BLOCK_DATA rd res=0
portwd-874   [001] .... 23157.964866: smbus_read: i2c-22 a=050 f=0000 c=c2 I2C_BLOCK_DATA
portwd-874   [001] .... 23157.965786: smbus_reply: i2c-22 a=050 f=0000 c=c2 I2C_BLOCK_DATA l=2 [01-c0]
portwd-874   [001] .... 23157.965787: smbus_result: i2c-22 a=050 f=0000 c=c2 I2C_BLOCK_DATA rd res=0
portwd-874   [001] .... 23157.965849: smbus_read: i2c-22 a=050 f=0000 c=62 I2C_BLOCK_DATA
portwd-874   [001] .... 23157.966758: smbus_reply: i2c-22 a=050 f=0000 c=62 I2C_BLOCK_DATA l=2 [01-ff]
portwd-874   [001] .... 23157.966759: smbus_result: i2c-22 a=050 f=0000 c=62 I2C_BLOCK_DATA rd res=0

I2Cとネットワークインターフェースの対応

今回は、下記のように順に情報をdumpして一致するものを見つけましたが。もっと論理的に対応を調べる方法が必要です。

また、Mellanoxのスイッチで動作しているCumulusではそもそもI2Cのインターフェース数がネットワークポートすうよりも少なくI2Cとネットワークインターフェースの紐付けができないとの事。

I2Cポート番号確認(23 = swp2)
root@as7712:/sys/kernel/debug/tracing/events/i2c# i2cdump -y -f 23 0x50
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 11 00 00 0f 00 00 00 00 00 55 55 00 00 00 00 00    ?..?.....UU.....
10: 00 00 00 00 00 00 1a a0 00 00 80 87 00 00 00 00    ......??..??....
20: 00 00 00 00 00 00 00 00 00 00 46 80 42 e0 49 20    ..........F?B?I
30: 41 60 25 8e 20 30 2e a8 28 a0 00 00 00 00 00 00    A`%? 0.?(?......
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
80: 11 cc 07 80 00 00 00 00 00 00 00 05 ff 00 01 00    ????.......?..?.
90: 00 00 00 40 57 41 56 45 53 50 4c 49 54 54 45 52    ...@WAVESPLITTER
a0: 20 20 20 20 00 00 0f 0e 57 53 54 2d 51 53 32 38        ..??WST-QS28
b0: 2d 43 4d 34 63 2d 44 20 30 31 66 58 05 14 37 7d    -CM4c-D 01fX??7}
c0: 06 07 00 d0 54 53 38 34 57 38 30 30 30 39 20 20    ??.?TS84W80009
d0: 20 20 20 20 31 38 30 34 32 34 20 20 0c 00 67 ee        180424  ?.g?
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

root@as7712:/sys/kernel/debug/tracing/events/i2c# ethtool -m swp2 hex on
Offset          Values
------          ------
0x0000:         11 00 00 0f 00 00 00 00 00 55 55 00 00 00 00 00
0x0010:         00 00 00 00 00 00 1a af 00 00 80 97 00 00 00 00
0x0020:         00 00 00 00 00 00 00 00 00 00 46 80 42 e0 49 20
0x0030:         41 60 25 88 20 30 2e ac 28 a0 00 00 00 00 00 00
0x0040:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0050:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0060:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0070:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0080:         11 cc 07 80 00 00 00 00 00 00 00 05 ff 00 01 00
0x0090:         00 00 00 40 57 41 56 45 53 50 4c 49 54 54 45 52
0x00a0:         20 20 20 20 00 00 0f 0e 57 53 54 2d 51 53 32 38
0x00b0:         2d 43 4d 34 63 2d 44 20 30 31 66 58 05 14 37 7d
0x00c0:         06 07 00 d0 54 53 38 34 57 38 30 30 30 39 20 20
0x00d0:         20 20 20 20 31 38 30 34 32 34 20 20 0c 00 67 ee
0x00e0:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x00f0:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

コメント欄を読み込み中