ARM汇编实战2:内核模块函数

死机堆栈

Exception Class: Kernel (KE)
Current Executing Process:
[tx_thread, 12001][kthreadd, 2]
Backtrace:
[] emmc_ipanic+0x4c/0x46c
[] notifier_call_chain+0x64/0xdc
[] __atomic_notifier_call_chain+0x40/0x54
[] atomic_notifier_call_chain+0x20/0x28
[] panic+0x7c/0x194
[] die+0x120/0x2a0
[] __do_kernel_fault.part.10+0x5c/0x7c
[] do_page_fault+0x238/0x274
[] do_translation_fault+0xa0/0xa8
[] do_DataAbort+0x7c/0x100
[] __dabt_svc+0x38/0x60
[] wlanTxPendingPackets+0x48/0x128 [wlan_mt]
[] tx_thread+0x3c0/0x558 [wlan_mt]
[] kthread+0x90/0x9c
[] do_exit+0x0/0x7f0
[] 0xffffffff

Exception Detail Info:
<0>[15118.693621] (4)[12001:tx_thread]Internal error: Oops: 5 [#1] PREEMPT SMP ARM
<4>[15118.693644] (4)[12001:tx_thread]Modules linked in: wlan_mt bf165000  mtk_wmt_wifi_soc bf161000  mtk_fm_drv bf136000  mtk_stp_gps_soc bf129000  mtk_stp_bt_soc bf11c000  mtk_stp_wmt_soc bf095000  lowmemorydetect bf091000  ccci bf066000  ccci_plat bf032000  mali bf000000  [last unloaded: mtk_wmt_detect]
<4>[15118.693819] (4)[12001:tx_thread]CPU: 4    Tainted: G        W     (3.4.39 #1)
<4>[15118.693889] (4)[12001:tx_thread]PC is at qmDequeueTxPackets+0x160/0xc68 [wlan_mt]
<4>[15118.693952] (4)[12001:tx_thread]LR is at wlanTxPendingPackets+0x48/0x128 [wlan_mt]
<4>[15118.693974] (4)[12001:tx_thread]pc : []    lr : []    psr: 60000093
<4>[15118.693979] (4)[12001:tx_thread]sp : c8d17eb8  ip : e3f8fb98  fp : c8d17f34
<4>[15118.694019] (4)[12001:tx_thread]r10: 00000001  r9 : 00000000  r8 : e3f8f134
<4>[15118.694037] (4)[12001:tx_thread]r7 : e3f8fc94  r6 : 00000002  r5 : 00000043  r4 : e3f634b0
<4>[15118.694060] (4)[12001:tx_thread]r3 : 00000000  r2 : 00000000  r1 : 00000003  r0 : 00000000
<4>[15118.694080] (4)[12001:tx_thread]Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
<4>[15118.694096] (4)[12001:tx_thread]Control: 10c5387d  Table: 9b98806a  DAC: 00000015

 

 

汇编代码

lumy1@xmws48:~/workspace/mickey/android/kernel/out/mediatek/kernel/drivers/conn_soc/drv_wlan/mt_wifi/wlan/nic$ ~/workspace/mt6592_dev/android/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-objdump -s -D que_mgt.o > que_mgt.asm

000007ac :
     7ac: e1a0c00d mov ip, sp
     7b0: e92ddff0 push {r4, r5, r6, r7, r8, r9, sl, fp, ip, lr, pc}
     7b4: e24cb004 sub fp, ip, #4
     7b8: e24dd054 sub sp, sp, #84 ; 0x54
     7bc: e92d4000 push {lr}
     7c0: ebfffffe bl 0 <__gnu_mcount_nc>
     7c4: e3a0a000 mov sl, #0
     7c8: e30ccccd movw ip, #52429 ; 0xcccd
     7cc: e50ba038 str sl, [fp, #-56] ; 0x38
     7d0: e34ccccc movt ip, #52428 ; 0xcccc
     7d4: e281a004 add sl, r1, #4
     7d8: e50bc048 str ip, [fp, #-72] ; 0x48
     7dc: e3a07000 mov r7, #0
     7e0: e3a0c004 mov ip, #4
     7e4: e50b1074 str r1, [fp, #-116] ; 0x74
     7e8: e50ba064 str sl, [fp, #-100] ; 0x64
     7ec: e50b0040 str r0, [fp, #-64] ; 0x40
     7f0: e50b7058 str r7, [fp, #-88] ; 0x58
     7f4: e50bc060 str ip, [fp, #-96] ; 0x60
     7f8: e51bc064 ldr ip, [fp, #-100] ; 0x64
     7fc: e30c3b04 movw r3, #51972 ; 0xcb04
     800: e3403002 movt r3, #2
     804: e45ca001 ldrb sl, [ip], #-1
     808: e35a0000 cmp sl, #0
     80c: e50bc064 str ip, [fp, #-100] ; 0x64
     810: e50ba034 str sl, [fp, #-52] ; 0x34
     814: e5dca007 ldrb sl, [ip, #7]
     818: e51bc040 ldr ip, [fp, #-64] ; 0x40
     81c: e50ba05c str sl, [fp, #-92] ; 0x5c
     820: e79c9003 ldr r9, [ip, r3]
     824: 0a00011e beq ca4
     828: e51ba060 ldr sl, [fp, #-96] ; 0x60
     82c: e3a03001 mov r3, #1
     830: e3a05015 mov r5, #21
     834: e50b9044 str r9, [fp, #-68] ; 0x44
     838: e50b7054 str r7, [fp, #-84] ; 0x54
     83c: e1a07005 mov r7, r5
     840: e6efa07a uxtb sl, sl
     844: e50ba03c str sl, [fp, #-60] ; 0x3c
     848: e28ac03c add ip, sl, #60 ; 0x3c
     84c: e51ba040 ldr sl, [fp, #-64] ; 0x40
     850: e50bc068 str ip, [fp, #-104] ; 0x68
     854: e51bc03c ldr ip, [fp, #-60] ; 0x3c
     858: e28aabb3 add sl, sl, #183296 ; 0x2cc00
     85c: e50ba04c str sl, [fp, #-76] ; 0x4c
     860: e28ca040 add sl, ip, #64 ; 0x40
     864: e50ba050 str sl, [fp, #-80] ; 0x50
     868: e51ba068 ldr sl, [fp, #-104] ; 0x68
     86c: e1a03c13 lsl r3, r3, ip
     870: e51bc040 ldr ip, [fp, #-64] ; 0x40
     874: e50b306c str r3, [fp, #-108] ; 0x6c
     878: e08c810a add r8, ip, sl, lsl #2
     87c: e51bc04c ldr ip, [fp, #-76] ; 0x4c
     880: e3a0a000 mov sl, #0
     884: e2888bb3 add r8, r8, #183296 ; 0x2cc00
     888: e28ccf72 add ip, ip, #456 ; 0x1c8
     88c: e50bc04c str ip, [fp, #-76] ; 0x4c
     890: e50ba030 str sl, [fp, #-48] ; 0x30
     894: e2888f72 add r8, r8, #456 ; 0x1c8
     898: e1a0900a mov r9, sl
     89c: e51b5050 ldr r5, [fp, #-80] ; 0x50
     8a0: e51bc04c ldr ip, [fp, #-76] ; 0x4c
     8a4: ea00002c b 95c
     8a8: e5d4301c ldrb r3, [r4, #28]
     8ac: e3a06f6e mov r6, #440 ; 0x1b8
     8b0: e51ba040 ldr sl, [fp, #-64] ; 0x40
     8b4: e026a396 mla r6, r6, r3, sl
     8b8: e286690b add r6, r6, #180224 ; 0x2c000
     8bc: e2866fcd add r6, r6, #820 ; 0x334
     8c0: e5d62011 ldrb r2, [r6, #17]
     8c4: e1520003 cmp r2, r3
     8c8: 0a000004 beq 8e0
     8cc: e3000000 movw r0, #0
     8d0: e3400000 movt r0, #0
     8d4: e5d03000 ldrb r3, [r0]
     8d8: e3530000 cmp r3, #0
     8dc: 0a00016e beq e9c
     8e0: e51b103c ldr r1, [fp, #-60] ; 0x3c
     8e4: e5d49065 ldrb r9, [r4, #101] ; 0x65
     8e8: e251a004 subs sl, r1, #4
     8ec: 13a0a001 movne sl, #1
     8f0: e3590000 cmp r9, #0
     8f4: 03a09000 moveq r9, #0
     8f8: 120a9001 andne r9, sl, #1
     8fc: e3590000 cmp r9, #0
     900: 1a00009b bne b74
     904: e51b205c ldr r2, [fp, #-92] ; 0x5c
     908: e50b2030 str r2, [fp, #-48] ; 0x30
     90c: e5d63083 ldrb r3, [r6, #131] ; 0x83
     910: e3530000 cmp r3, #0
     914: 03a0a000 moveq sl, #0
     918: 120aa001 andne sl, sl, #1
     91c: e35a0000 cmp sl, #0
     920: 0a000007 beq 944
     924: e5963008 ldr r3, [r6, #8]
     928: e3530002 cmp r3, #2
     92c: 0a000162 beq ebc
     930: e51ba030 ldr sl, [fp, #-48] ; 0x30
     934: e5d631b4 ldrb r3, [r6, #436] ; 0x1b4
     938: e15a0003 cmp sl, r3
     93c: 21a0a003 movcs sl, r3
     940: e50ba030 str sl, [fp, #-48] ; 0x30
     944: e5983000 ldr r3, [r8]
     948: e51ba030 ldr sl, [fp, #-48] ; 0x30
     94c: e153000a cmp r3, sl
     950: 3a000019 bcc 9bc
     954: e2577001 subs r7, r7, #1
     958: 0a000017 beq 9bc
     95c: e28c3004 add r3, ip, #4
     960: e51ba040 ldr sl, [fp, #-64] ; 0x40
     964: e3a04e25 mov r4, #592 ; 0x250
     968: e7933105 ldr r3, [r3, r5, lsl #2]
     96c: e024a394 mla r4, r4, r3, sl
     970: e2944e4b adds r4, r4, #1200 ; 0x4b0
     974: 0a00009c beq bec
     978: e5d431ec ldrb r3, [r4, #492] ; 0x1ec
     97c: e3530000 cmp r3, #0
     980: 1affffc8 bne 8a8
     984: e28c2004 add r2, ip, #4
     988: e51ba048 ldr sl, [fp, #-72] ; 0x48
     98c: e2577001 subs r7, r7, #1
     990: e1a04003 mov r4, r3
     994: e7921105 ldr r1, [r2, r5, lsl #2]
     998: e1a06003 mov r6, r3
     99c: e2811001 add r1, r1, #1
     9a0: e080a19a umull sl, r0, sl, r1
     9a4: e1a00220 lsr r0, r0, #4
     9a8: e0800100 add r0, r0, r0, lsl #2
     9ac: e0410100 sub r0, r1, r0, lsl #2
     9b0: e7820105 str r0, [r2, r5, lsl #2]
     9b4: e5883000 str r3, [r8]
     9b8: 1affffe7 bne 95c
     9bc: e3540000 cmp r4, #0
     9c0: e1a0c009 mov ip, r9
     9c4: e51b7054 ldr r7, [fp, #-84] ; 0x54
     9c8: 0a0000b5 beq ca4
     9cc: e51ba03c ldr sl, [fp, #-60] ; 0x3c
     9d0: e1a0300c mov r3, ip
     9d4: e51b0068 ldr r0, [fp, #-104] ; 0x68
     9d8: e1a0c006 mov ip, r6
     9dc: e3a02000 mov r2, #0
     9e0: e1a06003 mov r6, r3
     9e4: e1a0a08a lsl sl, sl, #1
     9e8: e50ba044 str sl, [fp, #-68] ; 0x44
     9ec: e51ba040 ldr sl, [fp, #-64] ; 0x40
     9f0: e08a9100 add r9, sl, r0, lsl #2
     9f4: e51ba044 ldr sl, [fp, #-68] ; 0x44
     9f8: e51b003c ldr r0, [fp, #-60] ; 0x3c
     9fc: e2899bb3 add r9, r9, #183296 ; 0x2cc00
     a00: e2899f72 add r9, r9, #456 ; 0x1c8
     a04: e08a8000 add r8, sl, r0
     a08: e51ba034 ldr sl, [fp, #-52] ; 0x34
     a0c: e1a05000 mov r5, r0
     a10: e50b4034 str r4, [fp, #-52] ; 0x34
     a14: e0848108 add r8, r4, r8, lsl #2
     a18: e2888e1f add r8, r8, #496 ; 0x1f0
     a1c: ea000032 b aec
     a20: e5983000 ldr r3, [r8]
     a24: e3a01000 mov r1, #0
     a28: e51b0034 ldr r0, [fp, #-52] ; 0x34
     a2c: e24aa001 sub sl, sl, #1
     a30: e3530000 cmp r3, #0
     a34: e5841000 str r1, [r4]
     a38: e51b2038 ldr r2, [fp, #-56] ; 0x38
     a3c: 13a03003 movne r3, #3
     a40: 15c4301c strbne r3, [r4, #28]
     a44: e3570000 cmp r7, #0
     a48: 15874000 strne r4, [r7]
     a4c: e5993000 ldr r3, [r9]
     a50: e2822001 add r2, r2, #1
     a54: 050b4058 streq r4, [fp, #-88] ; 0x58
     a58: e2557004 subs r7, r5, #4
     a5c: e2833001 add r3, r3, #1
     a60: e5893000 str r3, [r9]
     a64: e5d03065 ldrb r3, [r0, #101] ; 0x65
     a68: 13a07001 movne r7, #1
     a6c: e50b2038 str r2, [fp, #-56] ; 0x38
     a70: e3530000 cmp r3, #0
     a74: 13550004 cmpne r5, #4
     a78: 0a00000f beq abc
     a7c: e3560000 cmp r6, #0
     a80: 0a000112 beq ed0
     a84: e5d63000 ldrb r3, [r6]
     a88: e3530000 cmp r3, #0
     a8c: 1a000004 bne aa4
     a90: e3002000 movw r2, #0
     a94: e3402000 movt r2, #0
     a98: e5d23000 ldrb r3, [r2]
     a9c: e3530000 cmp r3, #0
     aa0: 0a000117 beq f04
     aa4: e3560000 cmp r6, #0
     aa8: 0a000003 beq abc
     aac: e5d63000 ldrb r3, [r6]
     ab0: e3530000 cmp r3, #0
     ab4: 12433001 subne r3, r3, #1
     ab8: 15c63000 strbne r3, [r6]
     abc: e5dc3083 ldrb r3, [ip, #131] ; 0x83
     ac0: e3530000 cmp r3, #0
     ac4: 03a07000 moveq r7, #0
     ac8: 12077001 andne r7, r7, #1
     acc: e3570000 cmp r7, #0
     ad0: 0a000003 beq ae4
     ad4: e5dc31b4 ldrb r3, [ip, #436] ; 0x1b4
     ad8: e3530000 cmp r3, #0
     adc: 12433001 subne r3, r3, #1
     ae0: 15cc31b4 strbne r3, [ip, #436] ; 0x1b4
     ae4: e1a07004 mov r7, r4
     ae8: e1a02004 mov r2, r4
     aec: e5984000 ldr r4, [r8]
     af0: e3540000 cmp r4, #0
     af4: 0a00010f beq f38
     af8: e5993000 ldr r3, [r9]
     afc: e51b1030 ldr r1, [fp, #-48] ; 0x30
     b00: e1530001 cmp r3, r1
     b04: 2a00010b bcs f38
     b08: e35a0000 cmp sl, #0
     b0c: 0a00022c beq 13c4
     b10: e5943000 ldr r3, [r4]
     b14: e3a02000 mov r2, #0
     b18: e3530000 cmp r3, #0
     b1c: e5883000 str r3, [r8]
     b20: 05883004 streq r3, [r8, #4]
     b24: e5842000 str r2, [r4]
     b28: e5983008 ldr r3, [r8, #8]
     b2c: e2433001 sub r3, r3, #1
     b30: e5883008 str r3, [r8, #8]
     b34: e5d43011 ldrb r3, [r4, #17]
     b38: e1530005 cmp r3, r5
     b3c: 0affffb7 beq a20
     b40: e3000000 movw r0, #0
     b44: e3400000 movt r0, #0
     b48: e5d03000 ldrb r3, [r0]
     b4c: e1530002 cmp r3, r2
     b50: 1affffb2 bne a20
     b54: e59f0870 ldr r0, [pc, #2160] ; 13cc
     b58: e30026f8 movw r2, #1784 ; 0x6f8
     b5c: e59f386c ldr r3, [pc, #2156] ; 13d0
     b60: e240103c sub r1, r0, #60 ; 0x3c
     b64: e50bc078 str ip, [fp, #-120] ; 0x78
     b68: ebfffffe bl 0 <__xlog_printk>
     b6c: e51bc078 ldr ip, [fp, #-120] ; 0x78
     b70: eaffffaa b a20
     b74: e5d43162 ldrb r3, [r4, #354] ; 0x162
     b78: e3530000 cmp r3, #0
     b7c: 0a00000d beq bb8
     b80: e5d43164 ldrb r3, [r4, #356] ; 0x164
     b84: e3530000 cmp r3, #0
     b88: 0a00000a beq bb8
     b8c: e5d43069 ldrb r3, [r4, #105] ; 0x69
     b90: e2849f76 add r9, r4, #472 ; 0x1d8
     b94: e51b006c ldr r0, [fp, #-108] ; 0x6c
     b98: e1100003 tst r0, r3
     b9c: 12899001 addne r9, r9, #1
     ba0: 02899002 addeq r9, r9, #2
     ba4: 15d411d9 ldrbne r1, [r4, #473] ; 0x1d9
     ba8: 05d421da ldrbeq r2, [r4, #474] ; 0x1da
     bac: 150b1030 strne r1, [fp, #-48] ; 0x30
     bb0: 050b2030 streq r2, [fp, #-48] ; 0x30
     bb4: eaffff54 b 90c
     bb8: e5d431d9 ldrb r3, [r4, #473] ; 0x1d9
     bbc: e3530000 cmp r3, #0
     bc0: 0a000004 beq bd8
     bc4: e3000000 movw r0, #0
     bc8: e3400000 movt r0, #0
     bcc: e5d03000 ldrb r3, [r0]
     bd0: e3530000 cmp r3, #0
     bd4: 0a0001e3 beq 1368
     bd8: e5d411da ldrb r1, [r4, #474] ; 0x1da
     bdc: e2849f76 add r9, r4, #472 ; 0x1d8
     be0: e2899002 add r9, r9, #2
     be4: e50b1030 str r1, [fp, #-48] ; 0x30
     be8: eaffff47 b 90c
     bec: e3000000 movw r0, #0
     bf0: e3400000 movt r0, #0
     bf4: e5d03000 ldrb r3, [r0]
     bf8: e3530000 cmp r3, #0
     bfc: 1affff5d bne 978
     c00: e59f07cc ldr r0, [pc, #1996] ; 13d4
     c04: e3002654 movw r2, #1620 ; 0x654
     c08: e59f37c8 ldr r3, [pc, #1992] ; 13d8
     c0c: e280100c add r1, r0, #12
     c10: e50bc078 str ip, [fp, #-120] ; 0x78
     c14: ebfffffe bl 0 <__xlog_printk>
     c18: e51bc078 ldr ip, [fp, #-120] ; 0x78
     c1c: eaffff55 b 978
     c20: e3560000 cmp r6, #0
     c24: e50ba038 str sl, [fp, #-56] ; 0x38
     c28: e1a0a004 mov sl, r4
     c2c: 13a03001 movne r3, #1
     c30: 15c4301e strbne r3, [r4, #30]
     c34: e51bc044 ldr ip, [fp, #-68] ; 0x44
     c38: e28cc001 add ip, ip, #1
     c3c: e50bc044 str ip, [fp, #-68] ; 0x44
     c40: e35c0014 cmp ip, #20
     c44: 0a000001 beq c50
     c48: e3590000 cmp r9, #0
     c4c: 1a0000ca bne f7c
     c50: e1a0700a mov r7, sl
     c54: e51ba070 ldr sl, [fp, #-112] ; 0x70
     c58: e35a0000 cmp sl, #0
     c5c: 0a000010 beq ca4
     c60: e51bc04c ldr ip, [fp, #-76] ; 0x4c
     c64: e51ba040 ldr sl, [fp, #-64] ; 0x40
     c68: e28c2004 add r2, ip, #4
     c6c: e51bc068 ldr ip, [fp, #-104] ; 0x68
     c70: e08a310c add r3, sl, ip, lsl #2
     c74: e51ba050 ldr sl, [fp, #-80] ; 0x50
     c78: e51bc048 ldr ip, [fp, #-72] ; 0x48
     c7c: e2833bb3 add r3, r3, #183296 ; 0x2cc00
     c80: e792110a ldr r1, [r2, sl, lsl #2]
     c84: e2811001 add r1, r1, #1
     c88: e080c19c umull ip, r0, ip, r1
     c8c: e1a00220 lsr r0, r0, #4
     c90: e0800100 add r0, r0, r0, lsl #2
     c94: e0411100 sub r1, r1, r0, lsl #2
     c98: e782110a str r1, [r2, sl, lsl #2]
     c9c: e3a02000 mov r2, #0
     ca0: e58321c8 str r2, [r3, #456] ; 0x1c8
     ca4: e51ba060 ldr sl, [fp, #-96] ; 0x60
     ca8: e24aa001 sub sl, sl, #1
     cac: e50ba060 str sl, [fp, #-96] ; 0x60
     cb0: e37a0001 cmn sl, #1
     cb4: 1afffecf bne 7f8
     cb8: e51bc074 ldr ip, [fp, #-116] ; 0x74
     cbc: e5dc6005 ldrb r6, [ip, #5]
     cc0: e3560000 cmp r6, #0
     cc4: 0a00006c beq e7c
     cc8: e51bc040 ldr ip, [fp, #-64] ; 0x40
     ccc: e3a0a000 mov sl, #0
     cd0: e1a0900a mov r9, sl
     cd4: e50ba03c str sl, [fp, #-60] ; 0x3c
     cd8: e28c5bb3 add r5, ip, #183296 ; 0x2cc00
     cdc: e50ba034 str sl, [fp, #-52] ; 0x34
     ce0: e2855f72 add r5, r5, #456 ; 0x1c8
     ce4: e50ba030 str sl, [fp, #-48] ; 0x30
     ce8: e59f86ec ldr r8, [pc, #1772] ; 13dc
     cec: e1a0a007 mov sl, r7
     cf0: e1a07006 mov r7, r6
     cf4: e1a06005 mov r6, r5
     cf8: e1a0500c mov r5, ip
     cfc: ea00000c b d34
     d00: e2477001 sub r7, r7, #1
     d04: e51bc038 ldr ip, [fp, #-56] ; 0x38
     d08: e35a0000 cmp sl, #0
     d0c: e5843000 str r3, [r4]
     d10: e6ef7077 uxtb r7, r7
     d14: 158a4000 strne r4, [sl]
     d18: e1a0a004 mov sl, r4
     d1c: e28cc001 add ip, ip, #1
     d20: 050b4058 streq r4, [fp, #-88] ; 0x58
     d24: e50bc038 str ip, [fp, #-56] ; 0x38
     d28: e50b4034 str r4, [fp, #-52] ; 0x34
     d2c: e3570000 cmp r7, #0
     d30: 0a00002e beq df0
     d34: e30c3dc8 movw r3, #52680 ; 0xcdc8
     d38: e3403002 movt r3, #2
     d3c: e7954003 ldr r4, [r5, r3]
     d40: e3540000 cmp r4, #0
     d44: 0a000029 beq df0
     d48: e5942000 ldr r2, [r4]
     d4c: e3520000 cmp r2, #0
     d50: e7852003 str r2, [r5, r3]
     d54: e3a03000 mov r3, #0
     d58: 05862004 streq r2, [r6, #4]
     d5c: e5843000 str r3, [r4]
     d60: e5963008 ldr r3, [r6, #8]
     d64: e2433001 sub r3, r3, #1
     d68: e5863008 str r3, [r6, #8]
     d6c: e5d43011 ldrb r3, [r4, #17]
     d70: e3530005 cmp r3, #5
     d74: 0a000002 beq d84
     d78: e5d83000 ldrb r3, [r8]
     d7c: e3530000 cmp r3, #0
     d80: 0a000172 beq 1350
     d84: e5d43014 ldrb r3, [r4, #20]
     d88: e3530002 cmp r3, #2
     d8c: 9a000002 bls d9c
     d90: e5d82000 ldrb r2, [r8]
     d94: e3520000 cmp r2, #0
     d98: 0a00017a beq 1388
     d9c: e3a02f6e mov r2, #440 ; 0x1b8
     da0: e0235392 mla r3, r2, r3, r5
     da4: e283390b add r3, r3, #180224 ; 0x2c000
     da8: e5d32344 ldrb r2, [r3, #836] ; 0x344
     dac: e2833fcd add r3, r3, #820 ; 0x334
     db0: e3520000 cmp r2, #0
     db4: 0a00005a beq f24
     db8: e5d33083 ldrb r3, [r3, #131] ; 0x83
     dbc: e3530000 cmp r3, #0
     dc0: 0affffce beq d00
     dc4: e3590000 cmp r9, #0
     dc8: e51bc030 ldr ip, [fp, #-48] ; 0x30
     dcc: e3a03000 mov r3, #0
     dd0: 050b403c streq r4, [fp, #-60] ; 0x3c
     dd4: e5843000 str r3, [r4]
     dd8: e28cc001 add ip, ip, #1
     ddc: 15894000 strne r4, [r9]
     de0: e3570000 cmp r7, #0
     de4: e50bc030 str ip, [fp, #-48] ; 0x30
     de8: e1a09004 mov r9, r4
     dec: 1affffd0 bne d34
     df0: e1a0700a mov r7, sl
     df4: e1a0a009 mov sl, r9
     df8: e51b9030 ldr r9, [fp, #-48] ; 0x30
     dfc: e3590000 cmp r9, #0
     e00: 0a000019 beq e6c
     e04: e51bc040 ldr ip, [fp, #-64] ; 0x40
     e08: e30c1dc8 movw r1, #52680 ; 0xcdc8
     e0c: e3401002 movt r1, #2
     e10: e28c3bb3 add r3, ip, #183296 ; 0x2cc00
     e14: e2833f72 add r3, r3, #456 ; 0x1c8
     e18: e5932008 ldr r2, [r3, #8]
     e1c: e3520000 cmp r2, #0
     e20: 0a000008 beq e48
     e24: e35a0000 cmp sl, #0
     e28: 179c2001 ldrne r2, [ip, r1]
     e2c: 051ba040 ldreq sl, [fp, #-64] ; 0x40
     e30: 158a2000 strne r2, [sl]
     e34: 15932008 ldrne r2, [r3, #8]
     e38: 079a1001 ldreq r1, [sl, r1]
     e3c: e593a004 ldr sl, [r3, #4]
     e40: e0899002 add r9, r9, r2
     e44: 050b103c streq r1, [fp, #-60] ; 0x3c
     e48: e51bc03c ldr ip, [fp, #-60] ; 0x3c
     e4c: e30c2dc8 movw r2, #52680 ; 0xcdc8
     e50: e51b0040 ldr r0, [fp, #-64] ; 0x40
     e54: e3402002 movt r2, #2
     e58: e780c002 str ip, [r0, r2]
     e5c: e583a004 str sl, [r3, #4]
     e60: e5839008 str r9, [r3, #8]
     e64: e3a03000 mov r3, #0
     e68: e58a3000 str r3, [sl]
     e6c: e51ba034 ldr sl, [fp, #-52] ; 0x34
     e70: e35a0000 cmp sl, #0
     e74: 13a03001 movne r3, #1
     e78: 15ca301e strbne r3, [sl, #30]
     e7c: e51bc038 ldr ip, [fp, #-56] ; 0x38
     e80: e35c0000 cmp ip, #0
     e84: 13a03000 movne r3, #0
     e88: 151b0058 ldrne r0, [fp, #-88] ; 0x58
     e8c: 15873000 strne r3, [r7]
     e90: 051b0038 ldreq r0, [fp, #-56] ; 0x38
     e94: e24bd028 sub sp, fp, #40 ; 0x28
     e98: e89daff0 ldm sp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, pc}
     e9c: e59f053c ldr r0, [pc, #1340] ; 13e0
     ea0: e300265b movw r2, #1627 ; 0x65b
     ea4: e59f3538 ldr r3, [pc, #1336] ; 13e4
     ea8: e2401024 sub r1, r0, #36 ; 0x24
     eac: e50bc078 str ip, [fp, #-120] ; 0x78
     eb0: ebfffffe bl 0 <__xlog_printk>
     eb4: e51bc078 ldr ip, [fp, #-120] ; 0x78
     eb8: eafffe88 b 8e0
     ebc: e51ba044 ldr sl, [fp, #-68] ; 0x44
     ec0: e59a3038 ldr r3, [sl, #56] ; 0x38
     ec4: e3530001 cmp r3, #1
     ec8: 1afffe98 bne 930
     ecc: eafffe9c b 944
     ed0: e3001000 movw r1, #0
     ed4: e3401000 movt r1, #0
     ed8: e5d13000 ldrb r3, [r1]
     edc: e3530000 cmp r3, #0
     ee0: 1afffee7 bne a84
     ee4: e59f04fc ldr r0, [pc, #1276] ; 13e8
     ee8: e3002707 movw r2, #1799 ; 0x707
     eec: e59f34f8 ldr r3, [pc, #1272] ; 13ec
     ef0: e2401048 sub r1, r0, #72 ; 0x48
     ef4: e50bc078 str ip, [fp, #-120] ; 0x78
     ef8: ebfffffe bl 0 <__xlog_printk>
     efc: e51bc078 ldr ip, [fp, #-120] ; 0x78
     f00: eafffedf b a84
     f04: e59f04e4 ldr r0, [pc, #1252] ; 13f0
     f08: e3002708 movw r2, #1800 ; 0x708
     f0c: e59f34e0 ldr r3, [pc, #1248] ; 13f4
     f10: e2401054 sub r1, r0, #84 ; 0x54
     f14: e50bc078 str ip, [fp, #-120] ; 0x78
     f18: ebfffffe bl 0 <__xlog_printk>
     f1c: e51bc078 ldr ip, [fp, #-120] ; 0x78
     f20: eafffedf b aa4
     f24: e5842000 str r2, [r4]
     f28: e1a00005 mov r0, r5
     f2c: e1a01004 mov r1, r4
     f30: ebfffffe bl 0
     f34: eaffff7c b d2c
     f38: e3a0c001 mov ip, #1
     f3c: e50bc070 str ip, [fp, #-112] ; 0x70
     f40: e3520000 cmp r2, #0
     f44: 13a03001 movne r3, #1
     f48: 15c2301e strbne r3, [r2, #30]
     f4c: e35a0000 cmp sl, #0
     f50: 0affff3f beq c54
     f54: e51bc044 ldr ip, [fp, #-68] ; 0x44
     f58: e1a0900a mov r9, sl
     f5c: e51b003c ldr r0, [fp, #-60] ; 0x3c
     f60: e1a0a007 mov sl, r7
     f64: e08c3000 add r3, ip, r0
     f68: e3a0c000 mov ip, #0
     f6c: e50bc044 str ip, [fp, #-68] ; 0x44
     f70: e1a03103 lsl r3, r3, #2
     f74: e2833e1f add r3, r3, #496 ; 0x1f0
     f78: e50b3054 str r3, [fp, #-84] ; 0x54
     f7c: e51bc04c ldr ip, [fp, #-76] ; 0x4c
     f80: e28c3004 add r3, ip, #4
     f84: e51bc050 ldr ip, [fp, #-80] ; 0x50
     f88: e793310c ldr r3, [r3, ip, lsl #2]
     f8c: e51bc044 ldr ip, [fp, #-68] ; 0x44
     f90: e2833001 add r3, r3, #1
     f94: e083300c add r3, r3, ip
     f98: e51bc048 ldr ip, [fp, #-72] ; 0x48
     f9c: e088c39c umull ip, r8, ip, r3
     fa0: e51bc040 ldr ip, [fp, #-64] ; 0x40
     fa4: e1a08228 lsr r8, r8, #4
     fa8: e0888108 add r8, r8, r8, lsl #2
     fac: e0433108 sub r3, r3, r8, lsl #2
     fb0: e3a08e25 mov r8, #592 ; 0x250
     fb4: e028c398 mla r8, r8, r3, ip
     fb8: e2988e4b adds r8, r8, #1200 ; 0x4b0
     fbc: 0a0000d2 beq 130c
     fc0: e5d831ec ldrb r3, [r8, #492] ; 0x1ec
     fc4: e3530000 cmp r3, #0
     fc8: 0affff19 beq c34
     fcc: e5d8301c ldrb r3, [r8, #28]
     fd0: e3a07f6e mov r7, #440 ; 0x1b8
     fd4: e51bc040 ldr ip, [fp, #-64] ; 0x40
     fd8: e027c397 mla r7, r7, r3, ip
     fdc: e287790b add r7, r7, #180224 ; 0x2c000
     fe0: e2877fcd add r7, r7, #820 ; 0x334
     fe4: e5d72011 ldrb r2, [r7, #17]
     fe8: e1520003 cmp r2, r3
     fec: 0a000004 beq 1004
     ff0: e3000000 movw r0, #0
     ff4: e3400000 movt r0, #0
     ff8: e5d03000 ldrb r3, [r0]
     ffc: e3530000 cmp r3, #0
    1000: 0a0000cc beq 1338
    1004: e51b103c ldr r1, [fp, #-60] ; 0x3c
    1008: e5d83065 ldrb r3, [r8, #101] ; 0x65
    100c: e251c004 subs ip, r1, #4
    1010: e51b2054 ldr r2, [fp, #-84] ; 0x54
    1014: 13a0c001 movne ip, #1
    1018: e3530000 cmp r3, #0
    101c: 03a03000 moveq r3, #0
    1020: 120c3001 andne r3, ip, #1
    1024: e3530000 cmp r3, #0
    1028: e0885002 add r5, r8, r2
    102c: 1a000094 bne 1284
    1030: e51b005c ldr r0, [fp, #-92] ; 0x5c
    1034: e50b3030 str r3, [fp, #-48] ; 0x30
    1038: e50b0034 str r0, [fp, #-52] ; 0x34
    103c: e5d73083 ldrb r3, [r7, #131] ; 0x83
    1040: e3530000 cmp r3, #0
    1044: 03a03000 moveq r3, #0
    1048: 120c3001 andne r3, ip, #1
    104c: e3530000 cmp r3, #0
    1050: 0a000004 beq 1068
    1054: e51b1034 ldr r1, [fp, #-52] ; 0x34
    1058: e5d731b4 ldrb r3, [r7, #436] ; 0x1b4
    105c: e1510003 cmp r1, r3
    1060: 21a01003 movcs r1, r3
    1064: e50b1034 str r1, [fp, #-52] ; 0x34
    1068: e3550000 cmp r5, #0
    106c: 0afffef0 beq c34
    1070: e3590000 cmp r9, #0
    1074: 0afffeee beq c34
    1078: e51b2054 ldr r2, [fp, #-84] ; 0x54
    107c: e51b0034 ldr r0, [fp, #-52] ; 0x34
    1080: e7984002 ldr r4, [r8, r2]
    1084: e3540000 cmp r4, #0
    1088: 13500000 cmpne r0, #0
    108c: 13a06001 movne r6, #1
    1090: 1a000023 bne 1124
    1094: eafffee6 b c34
    1098: e3001000 movw r1, #0
    109c: e3401000 movt r1, #0
    10a0: e5d13000 ldrb r3, [r1]
    10a4: e3530000 cmp r3, #0
    10a8: 0a000069 beq 1254
    10ac: e5d72011 ldrb r2, [r7, #17]
    10b0: e5d8301c ldrb r3, [r8, #28]
    10b4: e1520003 cmp r2, r3
    10b8: 0a000004 beq 10d0
    10bc: e3001000 movw r1, #0
    10c0: e3401000 movt r1, #0
    10c4: e5d13000 ldrb r3, [r1]
    10c8: e3530000 cmp r3, #0
    10cc: 0a00004b beq 1200
    10d0: e5d73083 ldrb r3, [r7, #131] ; 0x83
    10d4: e3530000 cmp r3, #0
    10d8: 03a03000 moveq r3, #0
    10dc: 120c3001 andne r3, ip, #1
    10e0: e3530000 cmp r3, #0
    10e4: 0a000003 beq 10f8
    10e8: e5d731b4 ldrb r3, [r7, #436] ; 0x1b4
    10ec: e3530000 cmp r3, #0
    10f0: 12433001 subne r3, r3, #1
    10f4: 15c731b4 strbne r3, [r7, #436] ; 0x1b4
    10f8: e3590000 cmp r9, #0
    10fc: 0afffec7 beq c20
    1100: e5953000 ldr r3, [r5]
    1104: e2862001 add r2, r6, #1
    1108: e51b1034 ldr r1, [fp, #-52] ; 0x34
    110c: e3530000 cmp r3, #0
    1110: 11560001 cmpne r6, r1
    1114: 2afffec1 bcs c20
    1118: e1a0a004 mov sl, r4
    111c: e1a06002 mov r6, r2
    1120: e1a04003 mov r4, r3
    1124: e5943000 ldr r3, [r4]
    1128: e3a02000 mov r2, #0
    112c: e51b003c ldr r0, [fp, #-60] ; 0x3c
    1130: e3530000 cmp r3, #0
    1134: e5853000 str r3, [r5]
    1138: 05853004 streq r3, [r5, #4]
    113c: e5842000 str r2, [r4]
    1140: e5953008 ldr r3, [r5, #8]
    1144: e2433001 sub r3, r3, #1
    1148: e5853008 str r3, [r5, #8]
    114c: e5d43011 ldrb r3, [r4, #17]
    1150: e1530000 cmp r3, r0
    1154: 0a000004 beq 116c
    1158: e3001000 movw r1, #0
    115c: e3401000 movt r1, #0
    1160: e5d13000 ldrb r3, [r1]
    1164: e1530002 cmp r3, r2
    1168: 0a00001c beq 11e0
    116c: e5953000 ldr r3, [r5]
    1170: e3a02000 mov r2, #0
    1174: e5842000 str r2, [r4]
    1178: e2499001 sub r9, r9, #1
    117c: e3530000 cmp r3, #0
    1180: e51b0038 ldr r0, [fp, #-56] ; 0x38
    1184: 13a03003 movne r3, #3
    1188: 15c4301c strbne r3, [r4, #28]
    118c: e35a0000 cmp sl, #0
    1190: 158a4000 strne r4, [sl]
    1194: e5d83065 ldrb r3, [r8, #101] ; 0x65
    1198: e086a000 add sl, r6, r0
    119c: 050b4058 streq r4, [fp, #-88] ; 0x58
    11a0: e3530000 cmp r3, #0
    11a4: 03a03000 moveq r3, #0
    11a8: 120c3001 andne r3, ip, #1
    11ac: e3530000 cmp r3, #0
    11b0: 0affffbd beq 10ac
    11b4: e51b1030 ldr r1, [fp, #-48] ; 0x30
    11b8: e3510000 cmp r1, #0
    11bc: 0a000017 beq 1220
    11c0: e51b0030 ldr r0, [fp, #-48] ; 0x30
    11c4: e5d03000 ldrb r3, [r0]
    11c8: e3530000 cmp r3, #0
    11cc: 0affffb1 beq 1098
    11d0: e51b0030 ldr r0, [fp, #-48] ; 0x30
    11d4: e2433001 sub r3, r3, #1
    11d8: e5c03000 strb r3, [r0]
    11dc: eaffffb2 b 10ac
    11e0: e59f0210 ldr r0, [pc, #528] ; 13f8
    11e4: e300278e movw r2, #1934 ; 0x78e
    11e8: e59f31e0 ldr r3, [pc, #480] ; 13d0
    11ec: e2401084 sub r1, r0, #132 ; 0x84
    11f0: e50bc078 str ip, [fp, #-120] ; 0x78
    11f4: ebfffffe bl 0 <__xlog_printk>
    11f8: e51bc078 ldr ip, [fp, #-120] ; 0x78
    11fc: eaffffda b 116c
    1200: e59f01f4 ldr r0, [pc, #500] ; 13fc
    1204: e30027a5 movw r2, #1957 ; 0x7a5
    1208: e59f31d4 ldr r3, [pc, #468] ; 13e4
    120c: e24010a8 sub r1, r0, #168 ; 0xa8
    1210: e50bc078 str ip, [fp, #-120] ; 0x78
    1214: ebfffffe bl 0 <__xlog_printk>
    1218: e51bc078 ldr ip, [fp, #-120] ; 0x78
    121c: eaffffab b 10d0
    1220: e3002000 movw r2, #0
    1224: e3402000 movt r2, #0
    1228: e5d23000 ldrb r3, [r2]
    122c: e3530000 cmp r3, #0
    1230: 1affffe2 bne 11c0
    1234: e59f01c4 ldr r0, [pc, #452] ; 1400
    1238: e300279b movw r2, #1947 ; 0x79b
    123c: e59f31a8 ldr r3, [pc, #424] ; 13ec
    1240: e2401090 sub r1, r0, #144 ; 0x90
    1244: e50bc078 str ip, [fp, #-120] ; 0x78
    1248: ebfffffe bl 0 <__xlog_printk>
    124c: e51bc078 ldr ip, [fp, #-120] ; 0x78
    1250: eaffffda b 11c0
    1254: e59f01a8 ldr r0, [pc, #424] ; 1404
    1258: e300279c movw r2, #1948 ; 0x79c
    125c: e59f3190 ldr r3, [pc, #400] ; 13f4
    1260: e240109c sub r1, r0, #156 ; 0x9c
    1264: e50bc078 str ip, [fp, #-120] ; 0x78
    1268: ebfffffe bl 0 <__xlog_printk>
    126c: e51b2030 ldr r2, [fp, #-48] ; 0x30
    1270: e51bc078 ldr ip, [fp, #-120] ; 0x78
    1274: e5d23000 ldrb r3, [r2]
    1278: e3530000 cmp r3, #0
    127c: 0affff8a beq 10ac
    1280: eaffffd2 b 11d0
    1284: e5d83162 ldrb r3, [r8, #354] ; 0x162
    1288: e3530000 cmp r3, #0
    128c: 0a000010 beq 12d4
    1290: e5d83164 ldrb r3, [r8, #356] ; 0x164
    1294: e3530000 cmp r3, #0
    1298: 0a00000d beq 12d4
    129c: e5d83069 ldrb r3, [r8, #105] ; 0x69
    12a0: e51b106c ldr r1, [fp, #-108] ; 0x6c
    12a4: e1130001 tst r3, r1
    12a8: 12882f76 addne r2, r8, #472 ; 0x1d8
    12ac: 02880f76 addeq r0, r8, #472 ; 0x1d8
    12b0: 15d831d9 ldrbne r3, [r8, #473] ; 0x1d9
    12b4: 12822001 addne r2, r2, #1
    12b8: 05d811da ldrbeq r1, [r8, #474] ; 0x1da
    12bc: 02800002 addeq r0, r0, #2
    12c0: 150b2030 strne r2, [fp, #-48] ; 0x30
    12c4: 150b3034 strne r3, [fp, #-52] ; 0x34
    12c8: 050b1034 streq r1, [fp, #-52] ; 0x34
    12cc: 050b0030 streq r0, [fp, #-48] ; 0x30
    12d0: eaffff59 b 103c
    12d4: e5d831d9 ldrb r3, [r8, #473] ; 0x1d9
    12d8: e3530000 cmp r3, #0
    12dc: 0a000004 beq 12f4
    12e0: e3002000 movw r2, #0
    12e4: e3402000 movt r2, #0
    12e8: e5d23000 ldrb r3, [r2]
    12ec: e3530000 cmp r3, #0
    12f0: 0a00002b beq 13a4
    12f4: e5d801da ldrb r0, [r8, #474] ; 0x1da
    12f8: e2883f76 add r3, r8, #472 ; 0x1d8
    12fc: e2833002 add r3, r3, #2
    1300: e50b3030 str r3, [fp, #-48] ; 0x30
    1304: e50b0034 str r0, [fp, #-52] ; 0x34
    1308: eaffff4b b 103c
    130c: e3000000 movw r0, #0
    1310: e3400000 movt r0, #0
    1314: e5d03000 ldrb r3, [r0]
    1318: e3530000 cmp r3, #0
    131c: 1affff27 bne fc0
    1320: e59f00e0 ldr r0, [pc, #224] ; 1408
    1324: e3002731 movw r2, #1841 ; 0x731
    1328: e59f30a8 ldr r3, [pc, #168] ; 13d8
    132c: e2401060 sub r1, r0, #96 ; 0x60
    1330: ebfffffe bl 0 <__xlog_printk>
    1334: eaffff21 b fc0
    1338: e59f00cc ldr r0, [pc, #204] ; 140c
    133c: e3002736 movw r2, #1846 ; 0x736
    1340: e59f309c ldr r3, [pc, #156] ; 13e4
    1344: e240106c sub r1, r0, #108 ; 0x6c
    1348: ebfffffe bl 0 <__xlog_printk>
    134c: eaffff2c b 1004
    1350: e59f00b8 ldr r0, [pc, #184] ; 1410
    1354: e3002844 movw r2, #2116 ; 0x844
    1358: e59f3070 ldr r3, [pc, #112] ; 13d0
    135c: e280100c add r1, r0, #12
    1360: ebfffffe bl 0 <__xlog_printk>
    1364: eafffe86 b d84
    1368: e59f00a4 ldr r0, [pc, #164] ; 1414
    136c: e300267b movw r2, #1659 ; 0x67b
    1370: e59f30a0 ldr r3, [pc, #160] ; 1418
    1374: e2401030 sub r1, r0, #48 ; 0x30
    1378: e50bc078 str ip, [fp, #-120] ; 0x78
    137c: ebfffffe bl 0 <__xlog_printk>
    1380: e51bc078 ldr ip, [fp, #-120] ; 0x78
    1384: eafffe13 b bd8
    1388: e59f008c ldr r0, [pc, #140] ; 141c
    138c: e3002846 movw r2, #2118 ; 0x846
    1390: e59f3088 ldr r3, [pc, #136] ; 1420
    1394: e2401024 sub r1, r0, #36 ; 0x24
    1398: ebfffffe bl 0 <__xlog_printk>
    139c: e5d43014 ldrb r3, [r4, #20]
    13a0: eafffe7d b d9c
    13a4: e59f0078 ldr r0, [pc, #120] ; 1424
    13a8: e3002757 movw r2, #1879 ; 0x757
    13ac: e59f3064 ldr r3, [pc, #100] ; 1418
    13b0: e2401078 sub r1, r0, #120 ; 0x78
    13b4: e50bc078 str ip, [fp, #-120] ; 0x78
    13b8: ebfffffe bl 0 <__xlog_printk>
    13bc: e51bc078 ldr ip, [fp, #-120] ; 0x78
    13c0: eaffffcb b 12f4
    13c4: e50ba070 str sl, [fp, #-112] ; 0x70
    13c8: eafffedc b f40
    13cc: 000000b8 strheq r0, [r0], -r8
    13d0: 00000090 muleq r0, r0, r0
    13d4: 00000070 andeq r0, r0, r0, ror r0
    13d8: 00000024 andeq r0, r0, r4, lsr #32
    13dc: 00000000 andeq r0, r0, r0
    13e0: 000000a0 andeq r0, r0, r0, lsr #1
    13e4: 00000030 andeq r0, r0, r0, lsr r0
    13e8: 000000c4 andeq r0, r0, r4, asr #1
    13ec: 000000ac andeq r0, r0, ip, lsr #1
    13f0: 000000d0 ldrdeq r0, [r0], -r0 ;
    13f4: 000000bc strheq r0, [r0], -ip
    13f8: 00000100 andeq r0, r0, r0, lsl #2
    13fc: 00000124 andeq r0, r0, r4, lsr #2
    1400: 0000010c andeq r0, r0, ip, lsl #2
    1404: 00000118 andeq r0, r0, r8, lsl r1
    1408: 000000dc ldrdeq r0, [r0], -ip
    140c: 000000e8 andeq r0, r0, r8, ror #1
    1410: 00000130 andeq r0, r0, r0, lsr r1
    1414: 000000ac andeq r0, r0, ip, lsr #1
    1418: 00000068 andeq r0, r0, r8, rrx
    141c: 00000160 andeq r0, r0, r0, ror #2
    1420: 000000cc andeq r0, r0, ip, asr #1
    1424: 000000f4 strdeq r0, [r0], -r4

源代码

 

P_MSDU_INFO_T
qmDequeueTxPackets(
    IN P_ADAPTER_T   prAdapter,
 IN P_TX_TCQ_STATUS_T prTcqStatus
 )
{

    INT_32 i;
    P_MSDU_INFO_T prReturnedPacketListHead;
    QUE_T rReturnedQue;

    DBGLOG(QM, LOUD, ("Enter qmDequeueTxPackets\n"));

    QUEUE_INITIALIZE(&rReturnedQue);

    prReturnedPacketListHead = NULL;

    /* dequeue packets from different AC queue based on available aucFreeBufferCount */
    /* TC0 to TC4: AC0~AC3, 802.1x (commands packets are not handled by QM) */
    for(i = TC4_INDEX; i >= TC0_INDEX; i--){
        DBGLOG(QM, LOUD, ("Dequeue packets from Per-STA queue[%u]\n", i));

        qmDequeueTxPacketsFromPerStaQueues(
            prAdapter,
            &rReturnedQue,
            (UINT_8)i,
            prTcqStatus->aucFreeBufferCount[i], /* maximum dequeue number */
            prTcqStatus->aucMaxNumOfBuffer[i]
            );

        /* The aggregate number of dequeued packets */
        DBGLOG(QM, LOUD, ("DQA)[%u](%lu)\n", i, rReturnedQue.u4NumElem));
    }


    /* TC5 (BMCAST or STA-NOT-FOUND packets) */
    qmDequeueTxPacketsFromPerTypeQueues(
            prAdapter,
            &rReturnedQue,
            TC5_INDEX,
            prTcqStatus->aucFreeBufferCount[TC5_INDEX]
            );

    DBGLOG(QM, LOUD, ("Current total number of dequeued packets = %u\n", rReturnedQue.u4NumElem));

    if (QUEUE_IS_NOT_EMPTY(&rReturnedQue)){
        prReturnedPacketListHead = (P_MSDU_INFO_T)QUEUE_GET_HEAD(&rReturnedQue);
        QM_TX_SET_NEXT_MSDU_INFO((P_MSDU_INFO_T)QUEUE_GET_TAIL(&rReturnedQue), NULL);
    }

    return prReturnedPacketListHead;
}

 

static VOID
qmDequeueTxPacketsFromPerStaQueues(
    IN P_ADAPTER_T   prAdapter,
    OUT P_QUE_T prQue,
    IN  UINT_8  ucTC,
    IN  UINT_8  ucCurrentQuota,
    IN  UINT_8  ucTotalQuota
    )
{

#if QM_FORWARDING_FAIRNESS
    UINT_32         i;  /* Loop for */

    PUINT_32        pu4HeadStaRecIndex;         /* The Head STA index */
    PUINT_32        pu4HeadStaRecForwardCount;  /* The total forwarded packets for the head STA */

    P_STA_RECORD_T  prStaRec;           /* The current focused STA */
    P_BSS_INFO_T    prBssInfo;          /* The Bss for current focused STA */
    P_QUE_T         prCurrQueue;        /* The current TX queue to dequeue */
    P_MSDU_INFO_T   prDequeuedPkt;      /* The dequeued packet */

    UINT_32         u4ForwardCount;     /* To remember the total forwarded packets for a STA */
    UINT_32         u4MaxForwardCount;  /* The maximum number of packets a STA can forward */
    UINT_32         u4Resource;         /* The TX resource amount */

    BOOLEAN         fgChangeHeadSta;    /* Whether a new head STA shall be determined at the end of the function */
    P_QUE_MGT_T prQM = &prAdapter->rQM;

    PUINT_8         pucFreeQuota = NULL;
#if CFG_ENABLE_WIFI_DIRECT
 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &prAdapter->rWifiVar.prP2pFsmInfo->rChnlReqInfo;
 /*NFC Beam + Indication*/
#endif
    DBGLOG(QM, LOUD, ("Enter qmDequeueTxPacketsFromPerStaQueues (TC = %u)\n", ucTC));

    ASSERT(ucTC == TC0_INDEX || ucTC == TC1_INDEX ||
           ucTC == TC2_INDEX || ucTC == TC3_INDEX ||
           ucTC == TC4_INDEX
           );

    if(!ucCurrentQuota){
        DBGLOG(TX, LOUD, ("@@@@@ TC = %u ucCurrentQuota = %u @@@@@\n",
        ucTC, ucCurrentQuota));
        return;
    }

    u4Resource = ucCurrentQuota;

    //4 <1> Determine the head STA
    /* The head STA shall be an active STA */

    pu4HeadStaRecIndex = &(prQM->au4HeadStaRecIndex[ucTC]);
    pu4HeadStaRecForwardCount = &(prQM->au4ForwardCount[ucTC]);

    DBGLOG(QM, LOUD, ("(Fairness) TID = %u Init Head STA = %u Resource = %u\n",
        ucTC, *pu4HeadStaRecIndex, u4Resource));


    /* From STA[x] to STA[x+1] to STA[x+2] to ... to STA[x] */
    for (i=0; i < CFG_NUM_OF_STA_RECORD + 1; i++){
        prStaRec = &prAdapter->arStaRec[(*pu4HeadStaRecIndex)];
        ASSERT(prStaRec);

        /* Only Data frame (1x was not included) will be queued in */
        if (prStaRec->fgIsValid){

              prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]);

              ASSERT(prBssInfo->ucNetTypeIndex == prStaRec->ucNetTypeIndex);

                /* Determine how many packets the head STA is allowed to send in a round */

                    QM_DBG_CNT_INC(prQM, QM_DBG_CNT_25);
                    u4MaxForwardCount = ucTotalQuota;
#if CFG_ENABLE_WIFI_DIRECT

                    pucFreeQuota = NULL;
                    if(prStaRec->fgIsInPS && (ucTC!=TC4_INDEX)) {
                        // TODO: Change the threshold in coorperation with the PS forwarding mechanism
                        // u4MaxForwardCount = ucTotalQuota;
                        /* Per STA flow control when STA in PS mode */
                        /* The PHASE 1: only update from ucFreeQuota (now) */
                        /* XXX The PHASE 2: Decide by ucFreeQuota and ucBmpDeliveryAC (per queue ) aucFreeQuotaPerQueue[] */
                        /* NOTE: other method to set u4Resource */

                        if(prStaRec->fgIsQoS && prStaRec->fgIsUapsdSupported
                              /*  && prAdapter->rWifiVar.fgSupportQoS
                                && prAdapter->rWifiVar.fgSupportUAPSD*/) {

                            if( prStaRec->ucBmpTriggerAC & BIT(ucTC)) {
                                u4MaxForwardCount = prStaRec->ucFreeQuotaForDelivery;
                                pucFreeQuota = &prStaRec->ucFreeQuotaForDelivery;
                            }
                            else {
                                u4MaxForwardCount = prStaRec->ucFreeQuotaForNonDelivery;
                                pucFreeQuota = &prStaRec->ucFreeQuotaForNonDelivery;
                            }

                        }
                        else {
                            ASSERT(prStaRec->ucFreeQuotaForDelivery == 0);
                            u4MaxForwardCount = prStaRec->ucFreeQuotaForNonDelivery;
                            pucFreeQuota = &prStaRec->ucFreeQuotaForNonDelivery;
                        }

                    } /* fgIsInPS */
#endif /* CFG_ENABLE_WIFI_DIRECT */

#if CFG_ENABLE_WIFI_DIRECT

     /*NFC Beam + Indication*/

     

                    if(prBssInfo->fgIsNetAbsent && (ucTC!=TC4_INDEX)) {
    if(prBssInfo->eCurrentOPMode==OP_MODE_ACCESS_POINT)
    {
     if(prChnlReqInfo->NFC_BEAM!=1/*||*/)
     {
                          if(u4MaxForwardCount > prBssInfo->ucBssFreeQuota) {
                              u4MaxForwardCount = prBssInfo->ucBssFreeQuota;
                          }
                       }

    }
    else
    {
                          if(u4MaxForwardCount > prBssInfo->ucBssFreeQuota) {
                              u4MaxForwardCount = prBssInfo->ucBssFreeQuota;
                          }
    }
                    }

#endif /* CFG_ENABLE_WIFI_DIRECT */

                    /* Determine whether the head STA can continue to forward packets in this round */
                    if((*pu4HeadStaRecForwardCount) < u4MaxForwardCount){
                        break;
                    }

        } /* prStaRec->fgIsValid */
        else{
            /* The current Head STA has been deactivated, so search for a new head STA */
            prStaRec = NULL;
            prBssInfo = NULL;
            (*pu4HeadStaRecIndex) ++;
            (*pu4HeadStaRecIndex) %= CFG_NUM_OF_STA_RECORD;

            /* Reset the forwarding count before searching (since this is for a new selected STA) */
            (*pu4HeadStaRecForwardCount) = 0;
        }
    } /* i < CFG_NUM_OF_STA_RECORD + 1 */

    /* All STA_RECs are inactive, so exit */
    if (!prStaRec){
        /* Under concurrent, it is possible that there is no candidcated STA.*/
        //DBGLOG(TX, EVENT, ("All STA_RECs are inactive\n"));
        return;
    }

    DBGLOG(QM, LOUD, ("(Fairness) TID = %u Round Head STA = %lu\n",
        ucTC, *pu4HeadStaRecIndex));

    //4 <2> Dequeue packets from the head STA

    prCurrQueue = &prStaRec->arTxQueue[ucTC];
    prDequeuedPkt = NULL;
    fgChangeHeadSta = FALSE;

    while(prCurrQueue){


#if QM_DEBUG_COUNTER

        if(ucTC <= TC4_INDEX) {
            if(QUEUE_IS_EMPTY(prCurrQueue)) {
                QM_DBG_CNT_INC(prQM, ucTC);
                /* QM_DBG_CNT_00 */ /* QM_DBG_CNT_01 */ /* QM_DBG_CNT_02 */ /* QM_DBG_CNT_03 */ /* QM_DBG_CNT_04 */
            }
            if(u4Resource == 0) {
                QM_DBG_CNT_INC(prQM, ucTC + 5);
                /* QM_DBG_CNT_05 */ /* QM_DBG_CNT_06 */ /* QM_DBG_CNT_07 */ /* QM_DBG_CNT_08 */ /* QM_DBG_CNT_09 */
            }
            if(((*pu4HeadStaRecForwardCount) >= u4MaxForwardCount)) {
                QM_DBG_CNT_INC(prQM, ucTC + 10);
                /* QM_DBG_CNT_10 */ /* QM_DBG_CNT_11 */ /* QM_DBG_CNT_12 */ /* QM_DBG_CNT_13 */ /* QM_DBG_CNT_14 */
            }
        }
#endif


        /* Three cases to break: (1) No resource (2) No packets (3) Fairness */
        if (QUEUE_IS_EMPTY(prCurrQueue) || ((*pu4HeadStaRecForwardCount) >= u4MaxForwardCount)){
            fgChangeHeadSta = TRUE;
            break;
        }
        else if (u4Resource == 0){
            break;
        }
        else{

            QUEUE_REMOVE_HEAD(prCurrQueue, prDequeuedPkt, P_MSDU_INFO_T);
#if DBG && 0
            LOG_FUNC("Deq0 TC %d queued %u net %u mac len %u len %u Type %u 1x %u 11 %u\n",
                    prDequeuedPkt->ucTC,
                    prCurrQueue->u4NumElem,
                    prDequeuedPkt->ucNetworkType,
                    prDequeuedPkt->ucMacHeaderLength,
                    prDequeuedPkt->u2FrameLength,
                    prDequeuedPkt->ucPacketType,
                    prDequeuedPkt->fgIs802_1x,
                    prDequeuedPkt->fgIs802_11 );

            LOG_FUNC("Dest Mac: " MACSTR "\n",
                    MAC2STR(prDequeuedPkt->aucEthDestAddr));

#if LINUX
            {
                struct sk_buff *prSkb = (struct sk_buff *) prDequeuedPkt->prPacket;
                dumpMemory8((PUINT_8)prSkb->data,prSkb->len);
            }
#endif

#endif

            ASSERT(prDequeuedPkt->ucTC == ucTC);

            if(!QUEUE_IS_EMPTY(prCurrQueue)) {
                /* XXX: check all queues for STA */
                prDequeuedPkt->ucPsForwardingType = PS_FORWARDING_MORE_DATA_ENABLED;
            }

            QUEUE_INSERT_TAIL(prQue,(P_QUE_ENTRY_T)prDequeuedPkt);
            u4Resource--;
            (*pu4HeadStaRecForwardCount) ++;


#if CFG_ENABLE_WIFI_DIRECT
            /* XXX The PHASE 2: decrease from  aucFreeQuotaPerQueue[] */
            if(prStaRec->fgIsInPS && (ucTC!=TC4_INDEX)) {
                ASSERT(pucFreeQuota);
                ASSERT(*pucFreeQuota>0);
                if ((pucFreeQuota) && (*pucFreeQuota>0)) {
                    *pucFreeQuota = *pucFreeQuota - 1;
                }
            }
#endif  /* CFG_ENABLE_WIFI_DIRECT */

#if CFG_ENABLE_WIFI_DIRECT
                if(prBssInfo->fgIsNetAbsent && (ucTC!=TC4_INDEX)) {
                    if(prBssInfo->ucBssFreeQuota>0) {
                        prBssInfo->ucBssFreeQuota--;
                    }
                }
#endif  /* CFG_ENABLE_WIFI_DIRECT */

        }
    }

   if (*pu4HeadStaRecForwardCount){
        DBGLOG(QM, LOUD, ("TC = %u Round Head STA = %lu, u4HeadStaRecForwardCount = %lu\n", ucTC, *pu4HeadStaRecIndex, (*pu4HeadStaRecForwardCount)));
   }

#if QM_BURST_END_INFO_ENABLED
    /* Let FW know which packet is the last one dequeued from the STA */
    if (prDequeuedPkt){
        prDequeuedPkt->fgIsBurstEnd = TRUE;
    }
#endif


    //4 <3> Dequeue from the other STAs if there is residual TX resource

    /* Check all of the STAs to continue forwarding packets (including the head STA) */
    for (i= 0; i< CFG_NUM_OF_STA_RECORD; i++){
        /* Break in case no reasource is available */
        if (u4Resource == 0){
            break;
        }

        /* The current head STA will be examined when i = CFG_NUM_OF_STA_RECORD-1 */
        prStaRec = &prAdapter->arStaRec[((*pu4HeadStaRecIndex) + i + 1) % CFG_NUM_OF_STA_RECORD];
        ASSERT(prStaRec);

       if (prStaRec->fgIsValid) {

              prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]);
                ASSERT(prBssInfo->ucNetTypeIndex == prStaRec->ucNetTypeIndex);

                DBGLOG(QM, LOUD, ("(Fairness) TID = %u Sharing STA = %u Resource = %lu\n",
                ucTC, prStaRec->ucIndex, u4Resource));

                prCurrQueue = &prStaRec->arTxQueue[ucTC];
                u4ForwardCount = 0;
                u4MaxForwardCount = ucTotalQuota;

#if CFG_ENABLE_WIFI_DIRECT
                pucFreeQuota = NULL;
                if(prStaRec->fgIsInPS && (ucTC!=TC4_INDEX)) {
                    // TODO: Change the threshold in coorperation with the PS forwarding mechanism
                    // u4MaxForwardCount = ucTotalQuota;
                    /* Per STA flow control when STA in PS mode */
                    /* The PHASE 1: only update from ucFreeQuota (now) */
                    /* XXX The PHASE 2: Decide by ucFreeQuota and ucBmpDeliveryAC (per queue ) aucFreeQuotaPerQueue[] */
                    /* NOTE: other method to set u4Resource */
                    if(prStaRec->fgIsQoS && prStaRec->fgIsUapsdSupported
                          /*  && prAdapter->rWifiVar.fgSupportQoS
                            && prAdapter->rWifiVar.fgSupportUAPSD*/) {

                        if( prStaRec->ucBmpTriggerAC & BIT(ucTC)) {
                            u4MaxForwardCount = prStaRec->ucFreeQuotaForDelivery;
                            pucFreeQuota = &prStaRec->ucFreeQuotaForDelivery;
                        }
                        else {
                            u4MaxForwardCount = prStaRec->ucFreeQuotaForNonDelivery;
                            pucFreeQuota = &prStaRec->ucFreeQuotaForNonDelivery;
                        }

                    }
                    else {
                        ASSERT(prStaRec->ucFreeQuotaForDelivery == 0);
                        u4MaxForwardCount = prStaRec->ucFreeQuotaForNonDelivery;
                        pucFreeQuota = &prStaRec->ucFreeQuotaForNonDelivery;
                    }

                }
#endif /* CFG_ENABLE_WIFI_DIRECT */
#if CFG_ENABLE_WIFI_DIRECT
                if(prBssInfo->fgIsNetAbsent && (ucTC!=TC4_INDEX)) {
                    if(u4MaxForwardCount > prBssInfo->ucBssFreeQuota) {
                        u4MaxForwardCount = prBssInfo->ucBssFreeQuota;
                    }
                }

#endif /* CFG_ENABLE_WIFI_DIRECT */
        } /* prStaRec->fgIsValid */
        else{
            prBssInfo = NULL;
            /* Invalid STA, so check the next STA */
            continue;
        }

        while(prCurrQueue){
            /* Three cases to break: (1) No resource (2) No packets (3) Fairness */
            if ((u4Resource == 0) || QUEUE_IS_EMPTY(prCurrQueue) || (u4ForwardCount >= u4MaxForwardCount)){
                break;
            }
            else{

                QUEUE_REMOVE_HEAD(prCurrQueue, prDequeuedPkt, P_MSDU_INFO_T);

#if DBG && 0
                DBGLOG(QM, LOUD, ("Deq0 TC %d queued %u net %u mac len %u len %u Type %u 1x %u 11 %u\n",
                    prDequeuedPkt->ucTC,
                    prCurrQueue->u4NumElem,
                        prDequeuedPkt->ucNetworkType,
                        prDequeuedPkt->ucMacHeaderLength,
                    prDequeuedPkt->u2FrameLength,
                    prDequeuedPkt->ucPacketType,
                    prDequeuedPkt->fgIs802_1x,
                    prDequeuedPkt->fgIs802_11 ));

                DBGLOG(QM, LOUD,("Dest Mac: " MACSTR "\n",
                        MAC2STR(prDequeuedPkt->aucEthDestAddr)));

#if LINUX
                {
                    struct sk_buff *prSkb = (struct sk_buff *) prDequeuedPkt->prPacket;
                    dumpMemory8((PUINT_8)prSkb->data,prSkb->len);
                }
#endif

#endif


                ASSERT(prDequeuedPkt->ucTC == ucTC);

                if(!QUEUE_IS_EMPTY(prCurrQueue)) {
                    prDequeuedPkt->ucPsForwardingType = PS_FORWARDING_MORE_DATA_ENABLED; /* more data field ? */
                }

                QUEUE_INSERT_TAIL(prQue,(P_QUE_ENTRY_T)prDequeuedPkt);
                u4Resource--;
                u4ForwardCount ++;

#if CFG_ENABLE_WIFI_DIRECT
                /* XXX The PHASE 2: decrease from  aucFreeQuotaPerQueue[] */
                if(prStaRec->fgIsInPS && (ucTC!=TC4_INDEX)) {
                    ASSERT(pucFreeQuota);
                    ASSERT(*pucFreeQuota>0);
                    if(*pucFreeQuota>0) {
                        *pucFreeQuota = *pucFreeQuota - 1;
                    }
                }
#endif  /* CFG_ENABLE_WIFI_DIRECT */


#if CFG_ENABLE_WIFI_DIRECT
                ASSERT(prBssInfo->ucNetTypeIndex == prStaRec->ucNetTypeIndex);
                if(prBssInfo->fgIsNetAbsent && (ucTC!=TC4_INDEX)) {
                    if(prBssInfo->ucBssFreeQuota>0) {
                        prBssInfo->ucBssFreeQuota--;
                    }
                }
#endif  /* CFG_ENABLE_WIFI_DIRECT */

            }
        }

#if QM_BURST_END_INFO_ENABLED
        /* Let FW know which packet is the last one dequeued from the STA */
        if (u4ForwardCount){
            prDequeuedPkt->fgIsBurstEnd = TRUE;
        }
#endif
    }


    if (fgChangeHeadSta){
        (*pu4HeadStaRecIndex) ++;
        (*pu4HeadStaRecIndex) %= CFG_NUM_OF_STA_RECORD;
        (*pu4HeadStaRecForwardCount) = 0;
        DBGLOG(QM, LOUD, ("(Fairness) TID = %u Scheduled Head STA = %lu Left Resource = %lu\n",
            ucTC, (*pu4HeadStaRecIndex),  u4Resource));
    }


/***************************************************************************************/
#else
    UINT_8          ucStaRecIndex;
    P_STA_RECORD_T  prStaRec;
    P_QUE_T         prCurrQueue;
    UINT_8          ucPktCount;
    P_MSDU_INFO_T   prDequeuedPkt;

    DBGLOG(QM, LOUD, ("Enter qmDequeueTxPacketsFromPerStaQueues (TC = %u)\n", ucTC));

    if (ucCurrentQuota == 0){
        return;
    }

    //4 <1> Determine the queue index and the head STA

    /* The head STA */
    ucStaRecIndex = 0;  /* TODO: Get the current head STA */
    prStaRec = QM_GET_STA_REC_PTR_FROM_INDEX(prAdapter, ucStaRecIndex);
    ASSERT(prStaRec);

    if(prStaRec == NULL) {
        return;
    }

    /* The queue to pull out packets */
    ASSERT(ucTC == TC0_INDEX || ucTC == TC1_INDEX ||
           ucTC == TC2_INDEX || ucTC == TC3_INDEX ||
           ucTC == TC4_INDEX
           );
    prCurrQueue = &prStaRec->arTxQueue[ucTC];

    ucPktCount = ucCurrentQuota;
    prDequeuedPkt = NULL;

    //4 <2> Dequeue packets for the head STA
    while(TRUE){
        if (!(prStaRec->fgIsValid) || ucPktCount ==0 || QUEUE_IS_EMPTY(prCurrQueue)){
            break;

        }
        else{

            QUEUE_REMOVE_HEAD(prCurrQueue, prDequeuedPkt, P_MSDU_INFO_T);
            //DbgPrint("QM: Remove Queue Head, TC= %d\n", prDequeuedPkt->ucTC);
            ASSERT(prDequeuedPkt->ucTC == ucTC);

            QUEUE_INSERT_TAIL(prQue,(P_QUE_ENTRY_T)prDequeuedPkt);
            ucPktCount--;
        }
    }

    //DbgPrint("QM: Remaining number of queued packets = %d\n", prCurrQueue->u4NumElem);

#if QM_BURST_END_INFO_ENABLED
    if (prDequeuedPkt){
        prDequeuedPkt->fgIsBurstEnd = TRUE;
    }

#endif

    //4 <3> Update scheduling info
    /* TODO */

    //4 <4> Utilize the remainaing TX opportunities for non-head STAs
    /* TODO */
#endif
}

 

你可能感兴趣的:(ARM)