aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/atm/he.h
diff options
context:
space:
mode:
authorchas williams - CONTRACTOR <chas@cmf.nrl.navy.mil>2010-05-29 05:05:33 -0400
committerDavid S. Miller <davem@davemloft.net>2010-05-31 03:27:47 -0400
commite623d62512dcb68a1c4844f4d7b5c8f3aff7d0da (patch)
tree24d697011fcf477eb1781fc89f8e63c5edc735ec /drivers/atm/he.h
parent1d927870e583d19afa17b2062b65e8f74a83b742 (diff)
atm: [he] rewrite buffer handling in receive path
Instead of a fixed list of buffers, use the buffer pool correctly and keep track of the outstanding buffer indexes using a fixed table. Resolves reported HBUF_ERR's -- failures due to lack of receive buffers. Signed-off-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/atm/he.h')
-rw-r--r--drivers/atm/he.h48
1 files changed, 25 insertions, 23 deletions
diff --git a/drivers/atm/he.h b/drivers/atm/he.h
index 8bf3264e5d00..110a27d2ecfc 100644
--- a/drivers/atm/he.h
+++ b/drivers/atm/he.h
@@ -198,26 +198,33 @@ struct he_hsp {
198 } group[HE_NUM_GROUPS]; 198 } group[HE_NUM_GROUPS];
199}; 199};
200 200
201/* figure 2.9 receive buffer pools */ 201/*
202 * figure 2.9 receive buffer pools
203 *
204 * since a virtual address might be more than 32 bits, we store an index
205 * in the virt member of he_rbp. NOTE: the lower six bits in the rbrq
206 * addr member are used for buffer status further limiting us to 26 bits.
207 */
202 208
203struct he_rbp { 209struct he_rbp {
204 volatile u32 phys; 210 volatile u32 phys;
205 volatile u32 status; 211 volatile u32 idx; /* virt */
206}; 212};
207 213
208/* NOTE: it is suggested that virt be the virtual address of the host 214#define RBP_IDX_OFFSET 6
209 buffer. on a 64-bit machine, this would not work. Instead, we 215
210 store the real virtual address in another list, and store an index 216/*
211 (and buffer status) in the virt member. 217 * the he dma engine will try to hold an extra 16 buffers in its local
212*/ 218 * caches. and add a couple buffers for safety.
219 */
213 220
214#define RBP_INDEX_OFF 6 221#define RBPL_TABLE_SIZE (CONFIG_RBPL_SIZE + 16 + 2)
215#define RBP_INDEX(x) (((long)(x) >> RBP_INDEX_OFF) & 0xffff)
216#define RBP_LOANED 0x80000000
217#define RBP_SMALLBUF 0x40000000
218 222
219struct he_virt { 223struct he_buff {
220 void *virt; 224 struct list_head entry;
225 dma_addr_t mapping;
226 unsigned long len;
227 u8 data[];
221}; 228};
222 229
223#ifdef notyet 230#ifdef notyet
@@ -286,10 +293,13 @@ struct he_dev {
286 struct he_rbrq *rbrq_base, *rbrq_head; 293 struct he_rbrq *rbrq_base, *rbrq_head;
287 int rbrq_peak; 294 int rbrq_peak;
288 295
296 struct he_buff **rbpl_virt;
297 unsigned long *rbpl_table;
298 unsigned long rbpl_hint;
289 struct pci_pool *rbpl_pool; 299 struct pci_pool *rbpl_pool;
290 dma_addr_t rbpl_phys; 300 dma_addr_t rbpl_phys;
291 struct he_rbp *rbpl_base, *rbpl_tail; 301 struct he_rbp *rbpl_base, *rbpl_tail;
292 struct he_virt *rbpl_virt; 302 struct list_head rbpl_outstanding;
293 int rbpl_peak; 303 int rbpl_peak;
294 304
295 dma_addr_t tbrq_phys; 305 dma_addr_t tbrq_phys;
@@ -304,20 +314,12 @@ struct he_dev {
304 struct he_dev *next; 314 struct he_dev *next;
305}; 315};
306 316
307struct he_iovec
308{
309 u32 iov_base;
310 u32 iov_len;
311};
312
313#define HE_MAXIOV 20 317#define HE_MAXIOV 20
314 318
315struct he_vcc 319struct he_vcc
316{ 320{
317 struct he_iovec iov_head[HE_MAXIOV]; 321 struct list_head buffers;
318 struct he_iovec *iov_tail;
319 int pdu_len; 322 int pdu_len;
320
321 int rc_index; 323 int rc_index;
322 324
323 wait_queue_head_t rx_waitq; 325 wait_queue_head_t rx_waitq;