Try   HackMD

Linux 核心專題: 虛擬無線網路裝置驅動程式

執行人: horseface1110

TODO: 重現去年實驗並確保在 Linux v6.11+ 運作

2024 年報告

commit 800ad32 / Support Linux v6.11

  • Replace legacy virtio_find_vqs() interface with struct virtqueue_info based version
  • Explicitly set ctx = false to maintain behavior of legacy API

commit c502eb8 "virtio: Introduce struct virtqueue_info and find_vqs_info() config op"

kernel version : v6.11-rc1 ~
date : Jul 17, 2024

Using separate arrays for names, callbacks, and contexts when setting up virtqueues is error-prone and not extensible.
To simplify and consolidate queue configuration, a new struct virtqueue_info was introduced.
This structure bundles name, callback, and ctx together into a single unit.

+ struct virtqueue_info {Add commentMore actions
+	const char *name;
+	vq_callback_t *callback;
+	bool ctx;
+ };

+ int virtio_find_vqs_info(struct virtio_device *vdev, unsigned int nvqs,Add commentMore actions
+			 struct virtqueue *vqs[],
+ 			 struct virtqueue_info vqs_info[],
+			 struct irq_affinity *desc)
+ {
+	return vdev->config->find_vqs_info(vdev, nvqs, vqs, vqs_info, desc);
+ }

commit 6c85d6b/Support Linux 6.15

kernel version : v6.11-rc1 ~
Jul 17, 2024

Since the original virtio_find_vqs() is no longer present, rename
virtio_find_vqs_info() back to virtio_find_vqs().

- int virtio_find_vqs_info(struct virtio_device *vdev, unsigned int nvqs,Add commentMore actions
-			 struct virtqueue *vqs[],
-			 struct virtqueue_info vqs_info[],
-			 struct irq_affinity *desc)
+int virtio_find_vqs(struct virtio_device *vdev, unsigned int nvqs,
+		    struct virtqueue *vqs[],
+		    struct virtqueue_info vqs_info[],
+		    struct irq_affinity *desc)

commit a50af43/Support Linux 6.15

  • Replace legacy hrtimer_init() with the new hrtimer_setup() API

commit 908a1d7 "hrtimer: Introduce hrtimer_setup() to replace hrtimer_init()"

kernel version : v6.13-rc1 ~
date : Nov 7, 2024

The legacy hrtimer_init() was replaced by hrtimer_setup() to provide a safer, clearer API.
The new interface requires the callback function to be explicitly passed during initialization, avoiding assignment errors.

+extern void hrtimer_setup(struct hrtimer *timer, enum hrtimer_restart (*function)(struct hrtimer *),Add commentMore actions
+			  clockid_t clock_id, enum hrtimer_mode mode);

commit 9779489"hrtimers: Delete hrtimer_init()"

kernel version : v6.15-rc1 ~
date : Apr 5, 2025

hrtimer_init() is now unused. Delete it.

- extern void hrtimer_init(struct hrtimer *timer, clockid_t which_clock,Add commentMore actions
-			 enum hrtimer_mode mode);

commit75f36f5/Support Linux v6.1.84

  • Replace deprecated del_timer_sync() with timer_delete_sync()

commit 9b13df3f "timers: Rename del_timer_sync() to timer_delete_sync()"

kernel version: v6.1.84 ~
date: Nov 24, 2022

del_timer_sync() was renamed to timer_delete_sync() for naming consistency.
The old name remains as a wrapper but is discouraged in new code.

- extern int del_timer_sync(struct timer_list *timer);
+ extern int timer_delete_sync(struct timer_list *timer);Add commentMore actions

+ /**
+ * del_timer_sync - Delete a pending timer and wait for a running callback
+ * @timer:	The timer to be deleted
+ *
+ * See timer_delete_sync() for detailed explanation.
+ *
+ * Do not use in new code. Use timer_delete_sync() instead.
+ */
+ static inline int del_timer_sync(struct timer_list *timer)
+ {
+ 	return timer_delete_sync(timer);
+ }

commit f82e7df/ Support Linux v6.14

  • Update vwifi_get_tx_power() signature to match new MLO-compatible prototype

commit 7a53af8"wifi: cfg80211: send MLO links tx power info in GET_INTERFACE"

kernel version: v6.14-rc1 ~
date: Dec 4, 2024

To support Multi-Link Operation (MLO), the get_tx_power callback now includes a link_id parameter.
TX power can be reported per link via NL80211_ATTR_MLO_LINKS in GET_INTERFACE.
For non-MLO interfaces, behavior remains unchanged.

int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,Add commentMore actions
-				int *dbm);
+ 				unsigned int link_id, int *dbm);

TODO: 傳輸延遲應與目前 bit rate 成反比,自動或手動調整

傳輸延遲應能根據目前的 bit rate 動態調整,以模擬不同傳輸速率下的封包傳輸行為。

TODO: 可調整的 MCS

調變與編碼組合 (Modulation and Coding Scheme, MCS) 應允許程式化控制與調整,以符合各種測試場景中對於 PHY 層吞吐量模擬的需求。
在 IEEE 802.11 無線網路架構中,MCS 決定了所使用的調變方式(如 BPSK、QPSK、16-QAM 等)以及 FEC 編碼率 (如 1/2、3/4),因此對 bit rate 與傳輸延遲具直接影響。現代無線網路裝置通常支援根據訊號品質進行動態 MCS 調整 (即 rate adaptation),而在虛擬裝置中,若能以使用者空間介面(例如 netlink 或 debugfs)手動調整 MCS,將有助於研究 WiFi stack 在不同傳輸品質下的行為。