Month: September 2018

  • 日文單字 (二)

    建物(たてもの) – jisho Noun 1. building 曲(ま)がる – jisho Godan verb with ru ending, intransitive verb 1. to bend; to curve; to warp; to wind; to twist 風(かぜ)に吹(ふ)かれて木(き)が曲(ま)がった。The tree bent in the wind. 2. to turn  See also 折れる おれる 3. to be awry; to be askew; to be crooked​ ネクタイが 曲がってるよ。Your tie is crooked. 側(そば) – jisho Noun 1. near; close; beside;…

  • 日文單字 (一)

    汚(きたな)い – jisho 1. dirty; filthy; foul; unclean​ 2. disordered; messy; untidy; poor (e.g. handwriting)​ 3. indecent (language, etc.); dirty; vulgar; coarse​ 4. dastardly; mean; base; underhanded​ 5. stingy; greedy​ I-adjective Affirmative Negative Non-past 汚い 汚くない Past 汚かった 汚くなかった   昼(ひる) (Noun)- jisho 1. noon; midday  See also 御昼 2. daytime  Only applies to 昼, Only applies to 晝, See also 御昼 3. lunch  Only applies to 昼, Only…

  • TIL: private data struct in Linux kernel

    在 Linux kernel 當中有許多的 common struct,例如說 ieee80211_txq 這樣的結構,透過這樣的方式,可以讓不同的 driver 重用相同的 struct。但是,針對每個不同的 driver,還是會有不同的 private data,這時候就會用 private data struct 的方式來處理。 例如說,struct ieee80211_txq 是 mac80211 中的 intermediate tx queue,目前有使用的 wireless driver 為 ath9k, ath10k 以及 mt76。struct ieee80211_txq 的整個結構為: /** * struct ieee80211_txq – Software intermediate tx queue * * @vif: &struct ieee80211_vif pointer from the add_interface callback. * @sta: station table…

  • TIL: ARRAY_SIZE in Linux kernel

    from net/mac80211/sta_info.c, define at include/linux/kernel.h /** * ARRAY_SIZE – get the number of elements in array @arr * @arr: array to be sized */ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) __must_be_array: 檢查 a 是否為 array,當 a 為 array 時,會因為 &(a)[0] 變成 pointer,而讓 __same_type 產生 0 的結果,反之如果 a 為 pointer,因為 &(a)[0] 仍然是 pointer, __same_type 回傳…

  • Qualcomm ath9k 驅動程式解析 (二) – 幾個重要結構

    ieee80211_local *local 用途: contains information about the real hardware, and is created when the interface is first added. (Daniel Caps Mur, Linux Wi-Fi open source drivers-mac80211,ath9k/ath5k-, pp.1) each instance of these (hw is embedded into local) represents a wireless driver, ieee80211_hw is the part of the ieee80211_local that is visible to drivers, contains all operating…

  • Qualcomm ath9k 驅動程式解析 (一) – 初始化過程

    以 linux-4.19-rc2 為例,平台為 TP-Link WDR4300。程式碼以 linux-4.19-rc2 為準,有特別標示者以 OpenWrt/LEDE 為準。 1. ath9k 驅動程式註冊點:ath9k/init.c#ath9k_init(void) static int __init ath9k_init(void) { int error; error = ath_pci_init(); if (error < 0) { pr_err(“No PCI devices found, driver not installed\n”); error = -ENODEV; goto err_out; } error = ath_ahb_init(); if (error < 0) { error = -ENODEV; goto err_pci_exit; } dmi_check_system(ath9k_quirks);…

  • TIL: ALIGN in Linux kernel

    from include/uapi/linux/kernel.h and scripts/dtc/dtc.h #define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))a – 1) #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) or #define ALIGN(x, a) (((x) + (a) – 1) & ~((a) – 1))  

  • 在 TP-Link wdr4300 對 OpenWrt/LEDE 的 ath9k driver 打 patch

    在 TP-Link wdr4300 對 OpenWrt/LEDE 的 ath9k driver 打 patch

    1. 目標 透過 OpenWrt/LEDE 的 quilt 將 ath9k 打上 patch,把 ath9k/xmit.c、ath9k/recv.c、net/mac80211/tx.c 特定的 function static 修飾字消除,以利 ftrace / perf 能夠順利取得 symbol 進行追蹤。 2. 方法 a. 找出 ath9k 在 OpenWrt/LEDE 正確的 package b. 使用 quilt 對 ath9k 以及 mac80211 打 patch c. 重新編譯後替換 ath9k.ko / 或重新刷機 3. 實做 a. 找出 ath9k 在 OpenWrt/LEDE 正確的 package 一般來說,kernel code 應該是在…