Friday, 29 January 2016

Aggragation in 11n

Aggregation in 80211n

-------------------------------

Aggregation is must feature of 80211n - Send mutiple MPDU  in a single packet. MPDUs received in this single bundled packet are acked using single Block Ack.

Aggragation related fields In HT Capabilites IE

Capability Info - 1 bit for max A-MSDU length 0 - 3895 bytes 1 - 7990 bytes
AMPDU Parameters - Max AMPDU Exponent - Max length = 2^(13 + exp) -1 bytes


Paramters that are negotiated for Aggregation in each direction
- TID
- Block Ack Policy
- is AMSDU supported
- Numbers of buffers allocated(10 bits, Max value 1023)
- Starting Sequence Number

Each buffer represents packet of max size MPDU  or less.

Implementation:

1. After STA is associated, when first unicast packet is received from the stack for the peer station
AP will send ADD BA action frame to the peer device. First packet is sent in non-aggragated format.
2. At AP, for each connected client it will create 17 software queues for storing the packets corresponding that particulaer TID.
3.  aggragate_schd() can be implemented which picks the highest priority non-empty TID queue for processing the packets aggregation
4. In aggragated list if there are any  packets which are to be sent at legacy rate or minrate, that packet is seperated out
5. Packets till Block Ack window are considered for aggregation
5. A-Packets are given to firmware for transmission at best possible rate

A-MPDU format

| ---- 4 bytes of Delimiter---|------MPDU_1----|---EOD Padding----|------ same for MPDU_2

Delimiter has MPDU length.

Block Ack:
------------


Tuesday, 19 January 2016

Linux Kernel

Interrupt Mechanism:

1. Interrupt line is asserted
2. CPU halts the current execution and jumps to the interrupt vector table
3. Interrupt vector table has the branching address of the correspnding INTR line

Before the execution of the ISR(Interrupt Service Routine), linux kernel masks that INR line across all the CPU in SMP environment, so that same interrupt does not occur again before current one is over


API to regrister the ISR to kernel: request_irq(interrupt number, flags, dev)
flags - DISABLE_INTERRUPTS -> Disabled all other interrupts on the CPU
        - SHARED - IF the interrupt number is shared with other devices

dev - This argument is important if the INTR line is shared, it helps to differentiate different handler functions

In the Linux kernel ISR need not reentrant as INTR line masked
Use spin lock to protect any shared resources


How to synchronize data between 'two interrupts' and 'interrupts and process'.
Between Interrupts: Use spin_locks
'interrupts and process'.: spin_lock_irqsave


Device Driver:
Device Driver

Completions
Completions - "wait for completion" barrier APIs - Provide very useful and efficient thread synchronization mechanism where thread has to wait till certain event or task is completed.

Can be used only in process context, as it sleep.  
wait_for_completion() calls spin_lock_irq() & spin_unlock_irq().

struct complete;
init_completion(&completion)
wait_for_completion(&complete) - Wait
complete(&complete);




Wednesday, 26 November 2014

P2P Power save

P2P Power save

1. Opportunistic Power save
 Attributes - CT Window
    - P2P GO enters sleep mode only when all the connected CLIs are in sleep (if there is any opprtunity to sleep)
    - CT widnow - Time duarion after TBTT. For this perios GO should be in active state.
    - After CT window, if all the connected clis are in sleep, GO enters into sleep till next TBTT.

2. NOA (Notice of Absence)
Attributes - Count, interval, duration, start time
Count - Count of repetation
Interval - Absence Interval
Duration - GO absence period  within absence interval(it is fraction of absence interval)
Start time - Last 4 bytes of  Starttime TSF
 TSF is 8 byte value
First Absence interval will start when last 4 bytes of TSF match the  4 byte of Start time attribute


   - Period NOA ->
Count > 1, if count=255 then it is repeated infitly till it is explictly stopped
Wrap Around time - since last 4 bytes reappear after 2exp(32) usecs (71 minutes). Spec mandates to updated the start time after every 2exp31 usecs(35.5 minutes)
Used mainly in concurrant mode after STA interface becomes active

  - Non Periodic NOA ->
Count = 1.
Mainly used during during station scan. Absence Duration =  Complete STA scan

Priority of different active and absence periods
1. Absence due to Non periodic NOA
2. Presence for TBTT
3. Presnce for CTWidow
4. Absence due to periodic NOA







Tuesday, 25 November 2014

Security modes in Wifi

Security modes in Wifi
1 Open

2 WPA(Personal)
 - Supported Cipher Suites TKIP(Temporal Key Integrity Protocol)
 - Authentication type - PSK
 - Present in VS IE WPA
 - hostapd.conf
       - wpa=1
       - wpa_psk="encrypted key"
       - wpa_pairwise=TKIP
Pairwise 4 way Handshake
 AP        STA
     -M1->
    <-M2-
    -M3->
    <-M4-
Groupwise 2 way Handshake
    -M1->
    <-M2-
(AP mode - group key is set locally after 1st STA connect, any STA leaves or group rekey happens)


3 WPA2(Personal) -
- Supported Cipher Suites CCMP
- Authentication type - PSK
- Present in RSN IE
- hostapd.conf
      -wpa=2
      -wpa_psk="encrypred key"
      -rsn_pairwise=CCMP
M1 and M2 for pairwise, M3 and M4 for groupwise

4 Mixed mode
 - Supported Cipher Suites TKIP and CCMP