I want to add a few printk statements in mac80211.c file in mt76 driver for some research project.
I have the following files in my build directory. But when I add them and make bin files we cant see them.
May I ask you what you are trying to change? I added a dev_info() call because I faced the same issue. I did add them, though as a patch to the current driver; see below:
--- a/mt7615/dma.c
+++ b/mt7615/dma.c
@@ -218,6 +218,7 @@ void mt7615_dma_start(struct mt7615_dev
int mt7615_dma_init(struct mt7615_dev *dev)
{
+ struct mt76_dev *mdev = &dev->mt76;
int rx_ring_size = MT7615_RX_RING_SIZE;
u32 mask;
int ret;
@@ -281,6 +282,7 @@ int mt7615_dma_init(struct mt7615_dev *d
if (ret < 0)
return ret;
+ dev_info(mdev->dev, "NAPI poll weight value set to %d\n", NAPI_POLL_WEIGHT);
netif_tx_napi_add(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
mt7615_poll_tx, NAPI_POLL_WEIGHT);
napi_enable(&dev->mt76.tx_napi);
@kamran-nishat Unles you are using an SDK, you are looking at the wrong files. OpenWrt relies on kernel backports to have the most recent wireless stack available, even on older kernels. Currently those are 5.15.58 backports:
$ cd build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/backports-5.15.58-1/drivers/net/wireless/mediatek/mt76/
$ cp mt7615/dma.c{,.new}
Modify code and diff against old file. Make sure to keep the path relative to the root of your package, ie your paths in this case would be a/mt7615/dma.c and b/mt7615/dma.c.
Now you got a diff, redirect that into a file and adjust the paths with the a/b prefix like you see in the other patches in the OpenWrt tree. Then dump your new patch in the patches/ subdir like I said earlier. If the subdir isn't there, create it and the OpenWrt buildroot will pick its contents up when you recompile mt76.
I did a poor job explaining myself. What I posted is appropriately managed by quilt. It's in the right patches directory and works. My question was more on the line: why, when correctly applying a patch, printk() didn't work?
Thank you, I'll check if that works. It's a bit confusing since according to the internet dev_*() are like pr_*() with device informations. And are all based on printk().
No idea, the patches are still working on my latest build. See the following:
@reaper$ ➜ ~ ssh root@nanohd-upstairs.lan
BusyBox v1.35.0 (2022-11-10 13:47:07 UTC) built-in shell (ash)
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
OpenWrt SNAPSHOT, r21271-6f729163b1
-----------------------------------------------------
root@nanohd-upstairs:~# logread | grep NAPI
Sun Nov 13 07:06:01 2022 kern.info kernel: [ 48.153102] mt7615e 0000:02:00.0: NAPI poll weight value set to 8
root@nanohd-upstairs:~#
Thank you @amteza for the confirmation, I have no doubt :)... I just got a bit frustrated and needed to vent, Sorry.
Maybe it is an issue with the layer it is in. In the drivers/net/dsa/mt7530.c there are several dev_dbg() already in there and none of them show up in dmesg.
@robimarko@amteza I did start with dev_info() and then tried dev_dbg() since there were already existing entries in .../dsa/mt7530.c. And for dev_dbg() I set the level to 15 (echo 15 > /proc/sys/kernel/printk` I think it was).
It does work if I boot into initramfs but not if flashed. Does that generally work with files in the net/dsa/ for you @robimarko. Not sure if there's something wrong with the image creation, I'll have to dig deeper.