2024年2月28日 星期三

netif_dbg 有的會印, 有的不會印

 netif_dbg


netif_dbg(pdata, drv, pdata->netdev, "???!!!\n");  不會印

netif_dbg(pdata, link, pdata->netdev, "CL73 AN initialized hahaha ~~~\n");  會印


#define netif_dbg(priv, type, netdev, format, args...) \

do { \

if (netif_msg_##type(priv)) \

dynamic_netdev_dbg(netdev, format, ##args); \

} while (0)


#define netif_msg_drv(p) ((p)->msg_enable & NETIF_MSG_DRV)

#define netif_msg_probe(p) ((p)->msg_enable & NETIF_MSG_PROBE)

#define netif_msg_link(p) ((p)->msg_enable & NETIF_MSG_LINK)


可以看的出來是priv的變數中決定哪一些要印的.

請以NETIF_MSG_LINK之類作為關鍵字搜尋, 把自己想印的加進去

enum {

NETIF_MSG_DRV = 0x0001,

NETIF_MSG_PROBE = 0x0002,

NETIF_MSG_LINK = 0x0004,

NETIF_MSG_TIMER = 0x0008,

NETIF_MSG_IFDOWN = 0x0010,

NETIF_MSG_IFUP = 0x0020,

NETIF_MSG_RX_ERR = 0x0040,

NETIF_MSG_TX_ERR = 0x0080,

NETIF_MSG_TX_QUEUED = 0x0100,

NETIF_MSG_INTR = 0x0200,

NETIF_MSG_TX_DONE = 0x0400,

NETIF_MSG_RX_STATUS = 0x0800,

NETIF_MSG_PKTDATA = 0x1000,

NETIF_MSG_HW = 0x2000,

NETIF_MSG_WOL = 0x4000,

};


2024年1月29日 星期一

讀取org.freedesktop.systemd1的變數

https://www.freedesktop.org/software/systemd/man/latest/busctl.html 

https://manpages.ubuntu.com/manpages/focal/zh_TW/man1/busctl.1.html




busctl get-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager FirmwareTimestampMonotonic

2023年11月28日 星期二

tpm2_startup: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory

 




如果需要特定的openssl版本,得自行編譯, ln
https://github.com/openssl/openssl/releases/tag/OpenSSL_1_1_1t

#.config
#make && make install
/lib/x86_64-linux-gnu$ sudo ln -s /usr/local/lib/libcrypto.so.1.1 libcrypto.so.1.1

2023年10月5日 星期四

更新initramfs

 update-initramfs -c -k 5.11.0-37-generic

動態加載Debug

 https://www.kernel.org/doc/html/v4.12/admin-guide/dynamic-debug-howto.html


Debug Messages at Module Initialization Time

modprobe amd_xgbe dyndbg==pmf 

sudo modprobe amd-xgbe dyndbg debug=0x8

   
可以看到許多的debug

2023年10月4日 星期三

sfp linux kernel code

 xgbe_phy_sfp_read_eeprom()->

/* Check for an added or changed SFP */

if (memcmp(&phy_data->sfp_eeprom, &sfp_eeprom, sizeof(sfp_eeprom)))  ->

xgbe_phy_sfp_parse_eeprom()->


if (phy_data->sfp_cable != XGBE_SFP_CABLE_FIBER &&

    xgbe_phy_sfp_bit_rate(sfp_eeprom, XGBE_SFP_SPEED_10000))

phy_data->sfp_base = XGBE_SFP_BASE_10000_CR;  ->

xgbe_phy_sfp_phy_settings() ->

case XGBE_SFP_BASE_10000_CR:

XGBE_SET_SUP(lks, 10000baseCR_Full);  ->



vim xgbe/xgbe-phy-v2.c

xgbe_phy_sfp_phy_settings

XGBE_SET_SUP 可以設定速度