Changes between Version 1 and Version 2 of 802.11/wlan_exp/app_notes/tutorial_token_mac/CPU_HIGH


Ignore:
Timestamp:
Jul 8, 2015, 11:07:41 AM (9 years ago)
Author:
chunter
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • 802.11/wlan_exp/app_notes/tutorial_token_mac/CPU_HIGH

    v1 v2  
    44
    55= Alterations to CPU_HIGH =
     6
     7In this section, we will describe and discuss the changes needed to the high-level MAC code to realize the design. Specifically, we will modify the AP codebase to allow it to determine which node in the network should have the token and for how long it should have it.
     8
     9== Overview of Changes ==
     10
     11The main concept of TokenMAC is that the token should rotate among members of the network. This inherently requires knowledge of the membership of the network so that that it can be determined who should be given the token and for how long they should have it. In the 802.11 Reference Design, knowledge of network membership (or "association") belongs to the AP. As such, the AP project is well-suited to being modified with the behavior of managing token passing. In a sense, the AP becomes a sort of "traffic cop" and halts traffic from certain associations while enabling traffic to others.
     12
     13Additionally, we will need to make some small changes to the MAC High Framework to deal with some new inter-processor communication (IPC) messages with CPU_LOW.
     14
     15== Specific Changes ==
     16
     17=== Access Point (AP) ===
     18Changes should be made to [browser:ReferenceDesigns/w3_802.11/c/wlan_mac_high_ap/wlan_mac_ap.c wlan_mac_ap.c].
     19
     20----
     211. We need to create a function that, when called, knows how to issue a new token for a reservation period to a device on the network. Note: the AP itself needs to be able to transmit, so it should include itself as one of the devices that get issued a token. Add the following function to the AP code:
     22
     23{{{
     24#!c
     25void set_new_reservation(){
     26
     27#define DEFAULT_RESERVATION_DURATION_USEC 20000
     28
     29        interrupt_state_t curr_interrupt_state;
     30
     31        static dl_entry* next_station_info_entry = NULL;
     32        dl_entry* curr_station_info_entry;
     33
     34        station_info* curr_station_info;
     35
     36        wlan_ipc_msg       ipc_msg_to_low;
     37        ipc_token_new_reservation ipc_payload;
     38
     39        ipc_msg_to_low.msg_id            = IPC_MBOX_MSG_ID(IPC_MBOX_TOKEN_NEW_RESERVATION);
     40
     41        if( (sizeof(u32)*(sizeof(ipc_token_new_reservation)/sizeof(u32))) ==  sizeof(ipc_token_new_reservation) ){
     42                ipc_msg_to_low.num_payload_words = (sizeof(ipc_token_new_reservation)/sizeof(u32));
     43        } else {
     44                ipc_msg_to_low.num_payload_words = (sizeof(ipc_token_new_reservation)/sizeof(u32)) + 1;
     45        }
     46
     47        ipc_msg_to_low.payload_ptr       = (u32*)(&ipc_payload);
     48
     49
     50        curr_interrupt_state = wlan_mac_high_interrupt_stop();
     51
     52        // Send an IPC message down to CPU_LOW to let it know we are moving to a new
     53        // reservation period.
     54
     55        curr_station_info_entry = next_station_info_entry;
     56
     57        // Loop through all associated stations' queues
     58        if(curr_station_info_entry == NULL){
     59                // It's the AP's reservation
     60                next_station_info_entry = my_bss_info->associated_stations.first;
     61
     62                //SEND IPC for AP
     63
     64                memcpy( ipc_payload.addr, my_bss_info->bssid, 6 );
     65                ipc_payload.res_duration = DEFAULT_RESERVATION_DURATION_USEC;
     66                ipc_mailbox_write_msg(&ipc_msg_to_low);
     67
     68                curr_station_info_entry = next_station_info_entry;
     69
     70        } else {
     71                curr_station_info = (station_info*)(curr_station_info_entry->data);
     72                if( wlan_mac_high_is_valid_association(&my_bss_info->associated_stations, curr_station_info) ){
     73                        if(curr_station_info_entry == my_bss_info->associated_stations.last){
     74                                // We've reached the end of the table, so we wrap around to the beginning
     75                                next_station_info_entry = NULL;
     76                        } else {
     77                                next_station_info_entry = dl_entry_next(curr_station_info_entry);
     78                        }
     79
     80                        //SEND IPC for curr_station_info
     81
     82                        memcpy( ipc_payload.addr, curr_station_info->addr, 6 );
     83                        ipc_payload.res_duration = DEFAULT_RESERVATION_DURATION_USEC;
     84                        ipc_mailbox_write_msg(&ipc_msg_to_low);
     85
     86                        curr_station_info_entry = next_station_info_entry;
     87
     88                } else {
     89                        // This curr_station_info is invalid. Perhaps it was removed from
     90                        // the association table before poll_tx_queues was called. We will
     91                        // start the round robin checking back at broadcast.
     92                        next_station_info_entry = NULL;
     93                } // END if(is_valid_association)
     94        }
     95
     96        wlan_mac_high_interrupt_restore_state(curr_interrupt_state);
     97
     98}
     99}}}
     100
     101Take a minute and read through what that code snippet is doing. Every time it is called, it will move on to the next member of the association table doubly-linked list and send an IPC message to CPU_LOW indicating the address of that member along with a duration of time the token reservation for that member should last. After every loop through of the association table, it will issue an IPC message to CPU_LOW using its own BSSID as the address in the IPC payload. This indicates that the medium is now reserved for the AP itself.
     102
     103
     104
     105----