| 103 | === Access Point (AP) === |
| 104 | |
| 105 | Changes should be made to [browser:ReferenceDesigns/w3_802.11/c/wlan_mac_high_ap/wlan_mac_ap.c wlan_mac_ap.c]. |
| 106 | |
| 107 | ---- |
| 108 | |
| 109 | First, we need to add a few global variables to the top of the AP code. Add the following code snippet: |
| 110 | |
| 111 | {{{ |
| 112 | #!c |
| 113 | |
| 114 | u8 token_addr[6]; |
| 115 | u64 token_ap_num_tx_bytes; |
| 116 | u8 token_ap_res_mult_factor; |
| 117 | |
| 118 | u64 token_sta_num_rx_bytes_start; |
| 119 | }}} |
| 120 | |
| 121 | We will use these variables in the coming sections. Furthermore, add the following line somewhere in the AP's main() function to give it a sane default: |
| 122 | |
| 123 | {{{ |
| 124 | #!c |
| 125 | |
| 126 | token_ap_res_mult_factor = TOKEN_RES_MULT_FACTOR_MIN; |
| 127 | }}} |
| 128 | |
| 129 | ---- |
| 130 | |
| 131 | Next we will let {{{set_new_reservation}}} set the reservation duration as a function of a per-station multiplication factor. In the existing function find the {{{ipc_payload.res_duration = DEFAULT_RESERVATION_DURATION_USEC;}}} line within the {{{if(curr_station_info_entry == NULL){}}} clause. Replaces this line with |
| 132 | |
| 133 | {{{ |
| 134 | #!c |
| 135 | |
| 136 | ipc_payload.res_duration = DEFAULT_RESERVATION_DURATION_USEC * token_ap_res_mult_factor; |
| 137 | }}} |
| 138 | |
| 139 | Here, {{{token_ap_res_mult_factor}}} is the top-level variable we just added. If we make no other changes, then this value will be fixed at {{{TOKEN_RES_MULT_FACTOR_MIN}}}. |
| 140 | |
| 141 | ---- |
| 142 | |