OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * |
| 3 * Copyright (c) 2004-2007 Atheros Communications Inc. |
| 4 * All rights reserved. |
| 5 * |
| 6 * |
| 7 // This program is free software; you can redistribute it and/or modify |
| 8 // it under the terms of the GNU General Public License version 2 as |
| 9 // published by the Free Software Foundation; |
| 10 // |
| 11 // Software distributed under the License is distributed on an "AS |
| 12 // IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or |
| 13 // implied. See the License for the specific language governing |
| 14 // rights and limitations under the License. |
| 15 // |
| 16 // |
| 17 * |
| 18 */ |
| 19 |
| 20 #ifndef __AGGR_RX_INTERNAL_H__ |
| 21 #define __AGGR_RX_INTERNAL_H__ |
| 22 |
| 23 #include "a_osapi.h" |
| 24 #include "aggr_recv_api.h" |
| 25 |
| 26 #define AGGR_WIN_IDX(x, y) ((x) % (y)) |
| 27 #define AGGR_INCR_IDX(x, y) AGGR_WIN_IDX(((x)+1), (y)) |
| 28 #define AGGR_DCRM_IDX(x, y) AGGR_WIN_IDX(((x)-1), (y)) |
| 29 #define IEEE80211_MAX_SEQ_NO 0xFFF |
| 30 #define IEEE80211_NEXT_SEQ_NO(x) (((x) + 1) & IEEE80211_MAX_SEQ_NO) |
| 31 |
| 32 |
| 33 #define NUM_OF_TIDS 8 |
| 34 #define AGGR_SZ_DEFAULT 8 |
| 35 |
| 36 #define AGGR_WIN_SZ_MIN 2 |
| 37 #define AGGR_WIN_SZ_MAX 8 |
| 38 /* TID Window sz is double of what is negotiated. Derive TID_WINDOW_SZ from win_
sz, per tid */ |
| 39 #define TID_WINDOW_SZ(_x) ((_x) << 1) |
| 40 |
| 41 #define AGGR_NUM_OF_FREE_NETBUFS 16 |
| 42 |
| 43 #define AGGR_GET_RXTID_STATS(_p, _x) (&(_p->stat[(_x)])) |
| 44 #define AGGR_GET_RXTID(_p, _x) (&(_p->RxTid[(_x)])) |
| 45 |
| 46 /* Hold q is a function of win_sz, which is negotiated per tid */ |
| 47 #define HOLD_Q_SZ(_x) (TID_WINDOW_SZ((_x))*sizeof(OSBUF_HOLD_Q)) |
| 48 /* AGGR_RX_TIMEOUT value is important as a (too) small value can cause frames to
be |
| 49 * delivered out of order and a (too) large value can cause undesirable latency
in |
| 50 * certain situations. */ |
| 51 #define AGGR_RX_TIMEOUT 400 /* Timeout(in ms) for delivery of frames, if th
ey are stuck */ |
| 52 |
| 53 typedef enum { |
| 54 ALL_SEQNO = 0, |
| 55 CONTIGUOUS_SEQNO = 1, |
| 56 }DELIVERY_ORDER; |
| 57 |
| 58 typedef struct { |
| 59 void *osbuf; |
| 60 A_BOOL is_amsdu; |
| 61 A_UINT16 seq_no; |
| 62 }OSBUF_HOLD_Q; |
| 63 |
| 64 |
| 65 #if 0 |
| 66 typedef struct { |
| 67 A_UINT16 seqno_st; |
| 68 A_UINT16 seqno_end; |
| 69 }WINDOW_SNAPSHOT; |
| 70 #endif |
| 71 |
| 72 typedef struct { |
| 73 A_BOOL aggr; /* is it ON or OFF */ |
| 74 A_BOOL progress; /* TRUE when frames have arrived after a tim
er start */ |
| 75 A_BOOL timerMon; /* TRUE if the timer started for the sake of
this TID */ |
| 76 A_UINT16 win_sz; /* negotiated window size */ |
| 77 A_UINT16 seq_next; /* Next seq no, in current window */ |
| 78 A_UINT32 hold_q_sz; /* Num of frames that can be held in hold q
*/ |
| 79 OSBUF_HOLD_Q *hold_q; /* Hold q for re-order */ |
| 80 #if 0 |
| 81 WINDOW_SNAPSHOT old_win; /* Sliding window snapshot - for timeout */ |
| 82 #endif |
| 83 A_NETBUF_QUEUE_T q; /* q head for enqueuing frames for dispatch
*/ |
| 84 A_MUTEX_T lock; |
| 85 }RXTID; |
| 86 |
| 87 typedef struct { |
| 88 A_UINT32 num_into_aggr; /* hitting at the input of this module */ |
| 89 A_UINT32 num_dups; /* duplicate */ |
| 90 A_UINT32 num_oow; /* out of window */ |
| 91 A_UINT32 num_mpdu; /* single payload 802.3/802.11 frame */ |
| 92 A_UINT32 num_amsdu; /* AMSDU */ |
| 93 A_UINT32 num_delivered; /* frames delivered to IP stack */ |
| 94 A_UINT32 num_timeouts; /* num of timeouts, during which frames deli
vered */ |
| 95 A_UINT32 num_hole; /* frame not present, when window moved over
*/ |
| 96 A_UINT32 num_bar; /* num of resets of seq_num, via BAR */ |
| 97 }RXTID_STATS; |
| 98 |
| 99 typedef struct { |
| 100 A_UINT8 aggr_sz; /* config value of aggregation size
*/ |
| 101 A_UINT8 timerScheduled; |
| 102 A_TIMER timer; /* timer for returning held up pkts
in re-order que */ |
| 103 void *dev; /* dev handle */ |
| 104 RX_CALLBACK rx_fn; /* callback function to return frame
s; to upper layer */ |
| 105 RXTID RxTid[NUM_OF_TIDS]; /* Per tid window */ |
| 106 ALLOC_NETBUFS netbuf_allocator; /* OS netbuf alloc fn */ |
| 107 A_NETBUF_QUEUE_T freeQ; /* pre-allocated buffers - for A_MSD
U slicing */ |
| 108 RXTID_STATS stat[NUM_OF_TIDS]; /* Tid based statistics */ |
| 109 PACKET_LOG pkt_log; /* Log info of the packets */ |
| 110 }AGGR_INFO; |
| 111 |
| 112 #endif /* __AGGR_RX_INTERNAL_H__ */ |
OLD | NEW |