lanai.c (858a0d7eb5300b5f620d98ab3c4b96c9d5f19131) lanai.c (5b5e0928f742cfa853b2411400a1b19fa379d758)
1/* lanai.c -- Copyright 1999-2003 by Mitchell Blank Jr <mitch@sfgoth.com>
2 *
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License
5 * as published by the Free Software Foundation; either version
6 * 2 of the License, or (at your option) any later version.
7 *
8 * This driver supports ATM cards based on the Efficient "Lanai"

--- 1375 unchanged lines hidden (view full) ---

1384 int size;
1385 struct sk_buff *skb;
1386 const u32 *x;
1387 u32 *end = &lvcc->rx.buf.start[endptr * 4];
1388 int n = ((unsigned long) end) - ((unsigned long) lvcc->rx.buf.ptr);
1389 if (n < 0)
1390 n += lanai_buf_size(&lvcc->rx.buf);
1391 APRINTK(n >= 0 && n < lanai_buf_size(&lvcc->rx.buf) && !(n & 15),
1/* lanai.c -- Copyright 1999-2003 by Mitchell Blank Jr <mitch@sfgoth.com>
2 *
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License
5 * as published by the Free Software Foundation; either version
6 * 2 of the License, or (at your option) any later version.
7 *
8 * This driver supports ATM cards based on the Efficient "Lanai"

--- 1375 unchanged lines hidden (view full) ---

1384 int size;
1385 struct sk_buff *skb;
1386 const u32 *x;
1387 u32 *end = &lvcc->rx.buf.start[endptr * 4];
1388 int n = ((unsigned long) end) - ((unsigned long) lvcc->rx.buf.ptr);
1389 if (n < 0)
1390 n += lanai_buf_size(&lvcc->rx.buf);
1391 APRINTK(n >= 0 && n < lanai_buf_size(&lvcc->rx.buf) && !(n & 15),
1392 "vcc_rx_aal5: n out of range (%d/%Zu)\n",
1392 "vcc_rx_aal5: n out of range (%d/%zu)\n",
1393 n, lanai_buf_size(&lvcc->rx.buf));
1394 /* Recover the second-to-last word to get true pdu length */
1395 if ((x = &end[-2]) < lvcc->rx.buf.start)
1396 x = &lvcc->rx.buf.end[-2];
1397 /*
1398 * Before we actually read from the buffer, make sure the memory
1399 * changes have arrived
1400 */

--- 87 unchanged lines hidden (view full) ---

1488 max_sdu = 1;
1489 max_sdu = aal5_size(max_sdu);
1490 size = (max_sdu + 16) * multiplier + 16;
1491 lanai_buf_allocate(buf, size, max_sdu + 32, lanai->pci);
1492 if (unlikely(buf->start == NULL))
1493 return -ENOMEM;
1494 if (unlikely(lanai_buf_size(buf) < size))
1495 printk(KERN_WARNING DEV_LABEL "(itf %d): wanted %d bytes "
1393 n, lanai_buf_size(&lvcc->rx.buf));
1394 /* Recover the second-to-last word to get true pdu length */
1395 if ((x = &end[-2]) < lvcc->rx.buf.start)
1396 x = &lvcc->rx.buf.end[-2];
1397 /*
1398 * Before we actually read from the buffer, make sure the memory
1399 * changes have arrived
1400 */

--- 87 unchanged lines hidden (view full) ---

1488 max_sdu = 1;
1489 max_sdu = aal5_size(max_sdu);
1490 size = (max_sdu + 16) * multiplier + 16;
1491 lanai_buf_allocate(buf, size, max_sdu + 32, lanai->pci);
1492 if (unlikely(buf->start == NULL))
1493 return -ENOMEM;
1494 if (unlikely(lanai_buf_size(buf) < size))
1495 printk(KERN_WARNING DEV_LABEL "(itf %d): wanted %d bytes "
1496 "for %s buffer, got only %Zu\n", lanai->number, size,
1496 "for %s buffer, got only %zu\n", lanai->number, size,
1497 name, lanai_buf_size(buf));
1497 name, lanai_buf_size(buf));
1498 DPRINTK("Allocated %Zu byte %s buffer\n", lanai_buf_size(buf), name);
1498 DPRINTK("Allocated %zu byte %s buffer\n", lanai_buf_size(buf), name);
1499 return 0;
1500}
1501
1502/* Setup a RX buffer for a currently unbound AAL5 vci */
1503static inline int lanai_setup_rx_vci_aal5(struct lanai_dev *lanai,
1504 struct lanai_vcc *lvcc, const struct atm_qos *qos)
1505{
1506 return lanai_get_sized_buffer(lanai, &lvcc->rx.buf,

--- 74 unchanged lines hidden (view full) ---

1581 * Allocate service buffer and tell card about it
1582 */
1583static int service_buffer_allocate(struct lanai_dev *lanai)
1584{
1585 lanai_buf_allocate(&lanai->service, SERVICE_ENTRIES * 4, 8,
1586 lanai->pci);
1587 if (unlikely(lanai->service.start == NULL))
1588 return -ENOMEM;
1499 return 0;
1500}
1501
1502/* Setup a RX buffer for a currently unbound AAL5 vci */
1503static inline int lanai_setup_rx_vci_aal5(struct lanai_dev *lanai,
1504 struct lanai_vcc *lvcc, const struct atm_qos *qos)
1505{
1506 return lanai_get_sized_buffer(lanai, &lvcc->rx.buf,

--- 74 unchanged lines hidden (view full) ---

1581 * Allocate service buffer and tell card about it
1582 */
1583static int service_buffer_allocate(struct lanai_dev *lanai)
1584{
1585 lanai_buf_allocate(&lanai->service, SERVICE_ENTRIES * 4, 8,
1586 lanai->pci);
1587 if (unlikely(lanai->service.start == NULL))
1588 return -ENOMEM;
1589 DPRINTK("allocated service buffer at 0x%08lX, size %Zu(%d)\n",
1589 DPRINTK("allocated service buffer at 0x%08lX, size %zu(%d)\n",
1590 (unsigned long) lanai->service.start,
1591 lanai_buf_size(&lanai->service),
1592 lanai_buf_size_cardorder(&lanai->service));
1593 /* Clear ServWrite register to be safe */
1594 reg_write(lanai, 0, ServWrite_Reg);
1595 /* ServiceStuff register contains size and address of buffer */
1596 reg_write(lanai,
1597 SSTUFF_SET_SIZE(lanai_buf_size_cardorder(&lanai->service)) |

--- 864 unchanged lines hidden (view full) ---

2462 &lanai->eeprom[EEPROM_MAC]);
2463 if (left-- == 0)
2464 return sprintf(page, "status: SOOL=%d, LOCD=%d, LED=%d, "
2465 "GPIN=%d\n", (lanai->status & STATUS_SOOL) ? 1 : 0,
2466 (lanai->status & STATUS_LOCD) ? 1 : 0,
2467 (lanai->status & STATUS_LED) ? 1 : 0,
2468 (lanai->status & STATUS_GPIN) ? 1 : 0);
2469 if (left-- == 0)
1590 (unsigned long) lanai->service.start,
1591 lanai_buf_size(&lanai->service),
1592 lanai_buf_size_cardorder(&lanai->service));
1593 /* Clear ServWrite register to be safe */
1594 reg_write(lanai, 0, ServWrite_Reg);
1595 /* ServiceStuff register contains size and address of buffer */
1596 reg_write(lanai,
1597 SSTUFF_SET_SIZE(lanai_buf_size_cardorder(&lanai->service)) |

--- 864 unchanged lines hidden (view full) ---

2462 &lanai->eeprom[EEPROM_MAC]);
2463 if (left-- == 0)
2464 return sprintf(page, "status: SOOL=%d, LOCD=%d, LED=%d, "
2465 "GPIN=%d\n", (lanai->status & STATUS_SOOL) ? 1 : 0,
2466 (lanai->status & STATUS_LOCD) ? 1 : 0,
2467 (lanai->status & STATUS_LED) ? 1 : 0,
2468 (lanai->status & STATUS_GPIN) ? 1 : 0);
2469 if (left-- == 0)
2470 return sprintf(page, "global buffer sizes: service=%Zu, "
2471 "aal0_rx=%Zu\n", lanai_buf_size(&lanai->service),
2470 return sprintf(page, "global buffer sizes: service=%zu, "
2471 "aal0_rx=%zu\n", lanai_buf_size(&lanai->service),
2472 lanai->naal0 ? lanai_buf_size(&lanai->aal0buf) : 0);
2473 if (left-- == 0) {
2474 get_statistics(lanai);
2475 return sprintf(page, "cells in error: overflow=%u, "
2476 "closed_vci=%u, bad_HEC=%u, rx_fifo=%u\n",
2477 lanai->stats.ovfl_trash, lanai->stats.vci_trash,
2478 lanai->stats.hec_err, lanai->stats.atm_ovfl);
2479 }

--- 28 unchanged lines hidden (view full) ---

2508 }
2509 /* Note that we re-use "left" here since we're done with it */
2510 left = sprintf(page, "VCI %4d: nref=%d, rx_nomem=%u", (vci_t) left,
2511 lvcc->nref, lvcc->stats.rx_nomem);
2512 if (lvcc->rx.atmvcc != NULL) {
2513 left += sprintf(&page[left], ",\n rx_AAL=%d",
2514 lvcc->rx.atmvcc->qos.aal == ATM_AAL5 ? 5 : 0);
2515 if (lvcc->rx.atmvcc->qos.aal == ATM_AAL5)
2472 lanai->naal0 ? lanai_buf_size(&lanai->aal0buf) : 0);
2473 if (left-- == 0) {
2474 get_statistics(lanai);
2475 return sprintf(page, "cells in error: overflow=%u, "
2476 "closed_vci=%u, bad_HEC=%u, rx_fifo=%u\n",
2477 lanai->stats.ovfl_trash, lanai->stats.vci_trash,
2478 lanai->stats.hec_err, lanai->stats.atm_ovfl);
2479 }

--- 28 unchanged lines hidden (view full) ---

2508 }
2509 /* Note that we re-use "left" here since we're done with it */
2510 left = sprintf(page, "VCI %4d: nref=%d, rx_nomem=%u", (vci_t) left,
2511 lvcc->nref, lvcc->stats.rx_nomem);
2512 if (lvcc->rx.atmvcc != NULL) {
2513 left += sprintf(&page[left], ",\n rx_AAL=%d",
2514 lvcc->rx.atmvcc->qos.aal == ATM_AAL5 ? 5 : 0);
2515 if (lvcc->rx.atmvcc->qos.aal == ATM_AAL5)
2516 left += sprintf(&page[left], ", rx_buf_size=%Zu, "
2516 left += sprintf(&page[left], ", rx_buf_size=%zu, "
2517 "rx_bad_len=%u,\n rx_service_trash=%u, "
2518 "rx_service_stream=%u, rx_bad_crc=%u",
2519 lanai_buf_size(&lvcc->rx.buf),
2520 lvcc->stats.x.aal5.rx_badlen,
2521 lvcc->stats.x.aal5.service_trash,
2522 lvcc->stats.x.aal5.service_stream,
2523 lvcc->stats.x.aal5.service_rxcrc);
2524 }
2525 if (lvcc->tx.atmvcc != NULL)
2526 left += sprintf(&page[left], ",\n tx_AAL=%d, "
2517 "rx_bad_len=%u,\n rx_service_trash=%u, "
2518 "rx_service_stream=%u, rx_bad_crc=%u",
2519 lanai_buf_size(&lvcc->rx.buf),
2520 lvcc->stats.x.aal5.rx_badlen,
2521 lvcc->stats.x.aal5.service_trash,
2522 lvcc->stats.x.aal5.service_stream,
2523 lvcc->stats.x.aal5.service_rxcrc);
2524 }
2525 if (lvcc->tx.atmvcc != NULL)
2526 left += sprintf(&page[left], ",\n tx_AAL=%d, "
2527 "tx_buf_size=%Zu, tx_qos=%cBR, tx_backlogged=%c",
2527 "tx_buf_size=%zu, tx_qos=%cBR, tx_backlogged=%c",
2528 lvcc->tx.atmvcc->qos.aal == ATM_AAL5 ? 5 : 0,
2529 lanai_buf_size(&lvcc->tx.buf),
2530 lvcc->tx.atmvcc == lanai->cbrvcc ? 'C' : 'U',
2531 vcc_is_backlogged(lvcc) ? 'Y' : 'N');
2532 page[left++] = '\n';
2533 page[left] = '\0';
2534 out:
2535 read_unlock(&vcc_sklist_lock);

--- 74 unchanged lines hidden ---
2528 lvcc->tx.atmvcc->qos.aal == ATM_AAL5 ? 5 : 0,
2529 lanai_buf_size(&lvcc->tx.buf),
2530 lvcc->tx.atmvcc == lanai->cbrvcc ? 'C' : 'U',
2531 vcc_is_backlogged(lvcc) ? 'Y' : 'N');
2532 page[left++] = '\n';
2533 page[left] = '\0';
2534 out:
2535 read_unlock(&vcc_sklist_lock);

--- 74 unchanged lines hidden ---