PageRenderTime 18ms CodeModel.GetById 9ms app.highlight 7ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/staging/ath6kl/reorder/aggr_rx_internal.h

https://bitbucket.org/cyanogenmod/android_kernel_asus_tf300t
C Header | 117 lines | 72 code | 17 blank | 28 comment | 0 complexity | 6983c743c0695b51bfefe3c6502c37ae MD5 | raw file
Possible License(s): LGPL-2.0, AGPL-1.0, GPL-2.0
  1/*
  2 *
  3 * Copyright (c) 2004-2010 Atheros Communications Inc.
  4 * All rights reserved.
  5 *
  6 * 
  7//
  8// Permission to use, copy, modify, and/or distribute this software for any
  9// purpose with or without fee is hereby granted, provided that the above
 10// copyright notice and this permission notice appear in all copies.
 11//
 12// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 13// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 14// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 15// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 16// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 17// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 18// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 19//
 20//
 21 *
 22 */
 23
 24#ifndef __AGGR_RX_INTERNAL_H__
 25#define __AGGR_RX_INTERNAL_H__
 26
 27#include "a_osapi.h"
 28#include "aggr_recv_api.h"
 29
 30#define AGGR_WIN_IDX(x, y)          ((x) % (y))
 31#define AGGR_INCR_IDX(x, y)         AGGR_WIN_IDX(((x)+1), (y))
 32#define AGGR_DCRM_IDX(x, y)         AGGR_WIN_IDX(((x)-1), (y))
 33#define IEEE80211_MAX_SEQ_NO        0xFFF
 34#define IEEE80211_NEXT_SEQ_NO(x)    (((x) + 1) & IEEE80211_MAX_SEQ_NO)
 35
 36
 37#define NUM_OF_TIDS         8
 38#define AGGR_SZ_DEFAULT     8
 39
 40#define AGGR_WIN_SZ_MIN     2
 41#define AGGR_WIN_SZ_MAX     8
 42/* TID Window sz is double of what is negotiated. Derive TID_WINDOW_SZ from win_sz, per tid */
 43#define TID_WINDOW_SZ(_x)   ((_x) << 1)
 44
 45#define AGGR_NUM_OF_FREE_NETBUFS    16
 46
 47#define AGGR_GET_RXTID_STATS(_p, _x)    (&(_p->stat[(_x)]))
 48#define AGGR_GET_RXTID(_p, _x)    (&(_p->RxTid[(_x)]))
 49
 50/* Hold q is a function of win_sz, which is negotiated per tid */
 51#define HOLD_Q_SZ(_x)   (TID_WINDOW_SZ((_x))*sizeof(struct osbuf_hold_q))
 52/* AGGR_RX_TIMEOUT value is important as a (too) small value can cause frames to be 
 53 * delivered out of order and a (too) large value can cause undesirable latency in
 54 * certain situations. */
 55#define AGGR_RX_TIMEOUT     400  /* Timeout(in ms) for delivery of frames, if they are stuck */
 56
 57typedef enum {
 58    ALL_SEQNO = 0,
 59    CONTIGUOUS_SEQNO = 1,
 60}DELIVERY_ORDER;
 61
 62struct osbuf_hold_q {
 63    void        *osbuf;
 64    bool      is_amsdu;
 65    u16 seq_no;
 66};
 67
 68
 69#if 0
 70/* XXX: unused ? */
 71struct window_snapshot {
 72    u16 seqno_st;
 73    u16 seqno_end;
 74};
 75#endif
 76
 77struct rxtid {
 78    bool              aggr;       /* is it ON or OFF */
 79    bool              progress;   /* true when frames have arrived after a timer start */
 80    bool              timerMon;   /* true if the timer started for the sake of this TID */
 81    u16 win_sz;     /* negotiated window size */
 82    u16 seq_next;   /* Next seq no, in current window */
 83    u32 hold_q_sz;  /* Num of frames that can be held in hold q */
 84    struct osbuf_hold_q        *hold_q;    /* Hold q for re-order */
 85#if 0    
 86    struct window_snapshot     old_win;    /* Sliding window snapshot - for timeout */
 87#endif    
 88    A_NETBUF_QUEUE_T    q;          /* q head for enqueuing frames for dispatch */
 89    A_MUTEX_T           lock;
 90};
 91
 92struct rxtid_stats {
 93    u32 num_into_aggr;      /* hitting at the input of this module */
 94    u32 num_dups;           /* duplicate */
 95    u32 num_oow;            /* out of window */
 96    u32 num_mpdu;           /* single payload 802.3/802.11 frame */
 97    u32 num_amsdu;          /* AMSDU */
 98    u32 num_delivered;      /* frames delivered to IP stack */
 99    u32 num_timeouts;       /* num of timeouts, during which frames delivered */
100    u32 num_hole;           /* frame not present, when window moved over */
101    u32 num_bar;            /* num of resets of seq_num, via BAR */
102};
103
104struct aggr_info {
105    u8 aggr_sz;            /* config value of aggregation size */
106    u8 timerScheduled;
107    A_TIMER             timer;              /* timer for returning held up pkts in re-order que */    
108    void                *dev;               /* dev handle */
109    RX_CALLBACK         rx_fn;              /* callback function to return frames; to upper layer */
110    struct rxtid               RxTid[NUM_OF_TIDS]; /* Per tid window */
111    ALLOC_NETBUFS       netbuf_allocator;   /* OS netbuf alloc fn */
112    A_NETBUF_QUEUE_T    freeQ;              /* pre-allocated buffers - for A_MSDU slicing */
113    struct rxtid_stats         stat[NUM_OF_TIDS];  /* Tid based statistics */
114    PACKET_LOG          pkt_log;            /* Log info of the packets */
115};
116
117#endif /* __AGGR_RX_INTERNAL_H__ */