| 63 | }}} |
| 64 | |
| 65 | ---- |
| 66 | |
| 67 | Next, we need to make a small addition to an existing struct definition that tracks details about each associated device to an AP. The reasons behind this addition will be clear once we make our changes to the AP code. In the meantime, find the definition of {{{station_info}}} in [browser:ReferenceDesigns/w3_802.11/c/wlan_mac_high_framework/include/wlan_mac_high.h wlan_mac_high.h]. Simply add the following element somewhere after the {{{MY_STATION_INFO_COMMON_FIELDS}}}: |
| 68 | |
| 69 | {{{ |
| 70 | #!c |
| 71 | u8 token_res_mult_factor; |
| 72 | }}} |
| 73 | |
| 74 | Next, let us add a few new definitions that will act as parameters for our new TokenMAC extensions. The easiest place to add these is to the top of {{{[browser:ReferenceDesigns/w3_802.11/c/wlan_mac_high_framework/include/wlan_mac_high.h wlan_mac_high.h]}}}. This will ensure that both the MAC High Framework as well as the AP has visibility of these definitions. |
| 75 | |
| 76 | {{{ |
| 77 | #!c |
| 78 | |
| 79 | #define TOKEN_RES_MULT_FACTOR_MIN 1 |
| 80 | #define TOKEN_RES_MULT_FACTOR_MAX 50 |
| 81 | |
| 82 | #define DEFAULT_RESERVATION_DURATION_USEC 2000 |
| 83 | |
| 84 | //Ignoring all overhead, a 6 Mbps PHY rate |
| 85 | //could theoretically deliver (6e6*2000e-6) = 12 kBytes |
| 86 | //in 2ms. Let's define our "success" threshold at (an arbitrary) 1/6 of that: 2000 bytes. |
| 87 | //Delivering more than this threshold in 2ms will grant access to the larger |
| 88 | //token reservation period |
| 89 | #define TOKEN_RES_BYTES_EFFICIENCY_THRESH 2000 |
| 90 | }}} |
| 91 | |
| 92 | Note that we moved the {{{DEFAULT_RESERVATION_DURATION_USEC}}} definition to the above code snippet. We will remove it from the AP code in the next section. |
| 93 | |
| 94 | Finally, we should set this new {{{token_res_mult_factor}}} field to {{{TOKEN_RES_MULT_FACTOR_MIN}}} whenever a {{{station_info}}} is created. To do this, add the following line to {{{wlan_mac_high_add_association()}}} just prior to the {{{entry->data = (void*)station;}}} line. |
| 95 | {{{ |
| 96 | #!c |
| 97 | |
| 98 | station->token_res_mult_factor = TOKEN_RES_MULT_FACTOR_MIN; |