• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/char/

Lines Matching refs:dlci

134 	void (*data)(struct gsm_dlci *dlci, u8 *data, int len);
207 struct gsm_dlci *dlci[NUM_DLCI];
390 * @dlci: DLCI to encode from
396 static u8 gsm_encode_modem(const struct gsm_dlci *dlci)
400 if (dlci->throttled)
402 if (dlci->modem_tx & TIOCM_DTR)
404 if (dlci->modem_tx & TIOCM_RTS)
406 if (dlci->modem_tx & TIOCM_RI)
408 if (dlci->modem_tx & TIOCM_CD)
675 * @dlci: DLCI sending the data
683 static void __gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg)
685 struct gsm_mux *gsm = dlci->gsm;
730 * @dlci: DLCI sending the data
735 * the gsm tx lock and dlci lock.
738 static void gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg)
741 spin_lock_irqsave(&dlci->gsm->tx_lock, flags);
742 __gsm_data_queue(dlci, msg);
743 spin_unlock_irqrestore(&dlci->gsm->tx_lock, flags);
749 * @dlci: the DLCI to pull data from
758 static int gsm_dlci_data_output(struct gsm_mux *gsm, struct gsm_dlci *dlci)
763 int h = dlci->adaption - 1;
765 len = kfifo_len(dlci->fifo);
775 msg = gsm_data_alloc(gsm, dlci->addr, size, gsm->ftype);
779 switch (dlci->adaption) {
784 *dp += gsm_encode_modem(dlci);
788 WARN_ON(kfifo_out_locked(dlci->fifo, dp , len, &dlci->lock) != len);
789 __gsm_data_queue(dlci, msg);
797 * @dlci: the DLCI to pull data from
807 struct gsm_dlci *dlci)
816 if (dlci->adaption == 4)
819 /* dlci->skb is locked by tx_lock */
820 if (dlci->skb == NULL) {
821 dlci->skb = skb_dequeue(&dlci->skb_list);
822 if (dlci->skb == NULL)
826 len = dlci->skb->len + overhead;
830 if (dlci->adaption == 3) {
832 kfree_skb(dlci->skb);
833 dlci->skb = NULL;
841 msg = gsm_data_alloc(gsm, dlci->addr, size, gsm->ftype);
847 if (dlci->adaption == 4) { /* Interruptible framed (Packetised Data) */
852 memcpy(dp, skb_pull(dlci->skb, len), len);
853 __gsm_data_queue(dlci, msg);
855 dlci->skb = NULL;
867 struct gsm_dlci *dlci;
871 dlci = gsm->dlci[i];
872 if (dlci == NULL || dlci->constipated) {
876 if (dlci->adaption < 3)
877 len = gsm_dlci_data_output(gsm, dlci);
879 len = gsm_dlci_data_output_framed(gsm, dlci);
890 * @dlci: DLCI to kick
897 static void gsm_dlci_data_kick(struct gsm_dlci *dlci)
901 spin_lock_irqsave(&dlci->gsm->tx_lock, flags);
903 if (dlci->gsm->tx_bytes == 0)
904 gsm_dlci_data_output(dlci->gsm, dlci);
905 else if (dlci->gsm->tx_bytes < TX_THRESH_LO)
906 gsm_dlci_data_sweep(dlci->gsm);
907 spin_unlock_irqrestore(&dlci->gsm->tx_lock, flags);
935 gsm_data_queue(gsm->dlci[0], msg);
941 * @dlci: DLCI to affect
948 static void gsm_process_modem(struct tty_struct *tty, struct gsm_dlci *dlci,
957 dlci->constipated = 1;
961 dlci->constipated = 0;
962 gsm_dlci_data_kick(dlci);
974 if ((mlines & TIOCM_CD) == 0 && (dlci->modem_rx & TIOCM_CD))
980 dlci->modem_rx = mlines;
999 struct gsm_dlci *dlci;
1016 if (addr == 0 || addr >= NUM_DLCI || gsm->dlci[addr] == NULL)
1018 dlci = gsm->dlci[addr];
1025 tty = tty_port_tty_get(&dlci->port);
1026 gsm_process_modem(tty, dlci, modem);
1064 if (addr == 0 || addr >= NUM_DLCI || gsm->dlci[addr] == NULL)
1071 tty = tty_port_tty_get(&gsm->dlci[addr]->port);
1086 static void gsm_dlci_begin_close(struct gsm_dlci *dlci);
1106 struct gsm_dlci *dlci = gsm->dlci[0];
1108 if (dlci) {
1109 dlci->dead = 1;
1111 gsm_dlci_begin_close(dlci);
1208 gsm_data_queue(gsm->dlci[0], msg);
1313 * @dlci: DLCI that closed
1319 static void gsm_dlci_close(struct gsm_dlci *dlci)
1321 del_timer(&dlci->t1);
1323 printk("DLCI %d goes closed.\n", dlci->addr);
1324 dlci->state = DLCI_CLOSED;
1325 if (dlci->addr != 0) {
1326 struct tty_struct *tty = tty_port_tty_get(&dlci->port);
1331 kfifo_reset(dlci->fifo);
1333 dlci->gsm->dead = 1;
1334 wake_up(&dlci->gsm->event);
1341 * @dlci: DLCI that opened
1346 static void gsm_dlci_open(struct gsm_dlci *dlci)
1350 del_timer(&dlci->t1);
1352 dlci->state = DLCI_OPEN;
1354 printk("DLCI %d goes open.\n", dlci->addr);
1355 wake_up(&dlci->gsm->event);
1360 * @dlci: DLCI that opened
1371 struct gsm_dlci *dlci = (struct gsm_dlci *)data;
1372 struct gsm_mux *gsm = dlci->gsm;
1374 switch (dlci->state) {
1376 dlci->retries--;
1377 if (dlci->retries) {
1378 gsm_command(dlci->gsm, dlci->addr, SABM|PF);
1379 mod_timer(&dlci->t1, jiffies + gsm->t1 * HZ / 100);
1381 gsm_dlci_close(dlci);
1384 dlci->retries--;
1385 if (dlci->retries) {
1386 gsm_command(dlci->gsm, dlci->addr, DISC|PF);
1387 mod_timer(&dlci->t1, jiffies + gsm->t1 * HZ / 100);
1389 gsm_dlci_close(dlci);
1396 * @dlci: DLCI to open
1404 static void gsm_dlci_begin_open(struct gsm_dlci *dlci)
1406 struct gsm_mux *gsm = dlci->gsm;
1407 if (dlci->state == DLCI_OPEN || dlci->state == DLCI_OPENING)
1409 dlci->retries = gsm->n2;
1410 dlci->state = DLCI_OPENING;
1411 gsm_command(dlci->gsm, dlci->addr, SABM|PF);
1412 mod_timer(&dlci->t1, jiffies + gsm->t1 * HZ / 100);
1417 * @dlci: DLCI to open
1426 static void gsm_dlci_begin_close(struct gsm_dlci *dlci)
1428 struct gsm_mux *gsm = dlci->gsm;
1429 if (dlci->state == DLCI_CLOSED || dlci->state == DLCI_CLOSING)
1431 dlci->retries = gsm->n2;
1432 dlci->state = DLCI_CLOSING;
1433 gsm_command(dlci->gsm, dlci->addr, DISC|PF);
1434 mod_timer(&dlci->t1, jiffies + gsm->t1 * HZ / 100);
1439 * @dlci: channel
1448 static void gsm_dlci_data(struct gsm_dlci *dlci, u8 *data, int len)
1451 struct tty_port *port = &dlci->port;
1458 switch (dlci->adaption) {
1473 gsm_process_modem(tty, dlci, modem);
1486 * @dlci: channel
1496 static void gsm_dlci_command(struct gsm_dlci *dlci, u8 *data, int len)
1509 gsm_control_message(dlci->gsm, command,
1512 gsm_control_response(dlci->gsm, command,
1526 struct gsm_dlci *dlci = kzalloc(sizeof(struct gsm_dlci), GFP_ATOMIC);
1527 if (dlci == NULL)
1529 spin_lock_init(&dlci->lock);
1530 dlci->fifo = &dlci->_fifo;
1531 if (kfifo_alloc(&dlci->_fifo, 4096, GFP_KERNEL) < 0) {
1532 kfree(dlci);
1536 skb_queue_head_init(&dlci->skb_list);
1537 init_timer(&dlci->t1);
1538 dlci->t1.function = gsm_dlci_t1;
1539 dlci->t1.data = (unsigned long)dlci;
1540 tty_port_init(&dlci->port);
1541 dlci->port.ops = &gsm_port_ops;
1542 dlci->gsm = gsm;
1543 dlci->addr = addr;
1544 dlci->adaption = gsm->adaption;
1545 dlci->state = DLCI_CLOSED;
1547 dlci->data = gsm_dlci_data;
1549 dlci->data = gsm_dlci_command;
1550 gsm->dlci[addr] = dlci;
1551 return dlci;
1556 * @dlci: DLCI to destroy
1564 static void gsm_dlci_free(struct gsm_dlci *dlci)
1566 struct tty_struct *tty = tty_port_tty_get(&dlci->port);
1571 del_timer_sync(&dlci->t1);
1572 dlci->gsm->dlci[dlci->addr] = NULL;
1573 kfifo_free(dlci->fifo);
1574 kfree(dlci);
1594 struct gsm_dlci *dlci;
1617 dlci = gsm->dlci[address];
1623 if (dlci == NULL)
1624 dlci = gsm_dlci_alloc(gsm, address);
1625 if (dlci == NULL)
1627 if (dlci->dead)
1631 gsm_dlci_open(dlci);
1637 if (dlci == NULL || dlci->state == DLCI_CLOSED) {
1643 gsm_dlci_close(dlci);
1647 if (cr == 0 || dlci == NULL)
1649 switch (dlci->state) {
1651 gsm_dlci_close(dlci);
1654 gsm_dlci_open(dlci);
1662 if (dlci == NULL)
1664 gsm_dlci_close(dlci);
1670 if (dlci == NULL || dlci->state != DLCI_OPEN) {
1674 dlci->data(dlci, gsm->buf, gsm->len);
1835 struct gsm_dlci *dlci = gsm->dlci[0];
1852 if (dlci) {
1853 dlci->dead = 1;
1854 gsm_dlci_begin_close(dlci);
1856 dlci->state == DLCI_CLOSED);
1860 if (gsm->dlci[i])
1861 gsm_dlci_free(gsm->dlci[i]);
1882 struct gsm_dlci *dlci;
1909 dlci = gsm_dlci_alloc(gsm, 0);
1910 if (dlci == NULL)
2300 gsm_dlci_begin_close(gsm->dlci[0]);
2303 gsm->dlci[0]->state == DLCI_CLOSED);
2328 gsm_dlci_begin_open(gsm->dlci[0]);
2392 static int gsmtty_modem_update(struct gsm_dlci *dlci, u8 brk)
2402 modembits[1] = dlci->addr << 2 | 3; /* DLCI, EA, 1 */
2403 modembits[2] = gsm_encode_modem(dlci) << 1 | EA;
2406 ctrl = gsm_control_send(dlci->gsm, CMD_MSC, modembits, len + 1);
2409 return gsm_control_wait(dlci->gsm, ctrl);
2414 struct gsm_dlci *dlci = container_of(port, struct gsm_dlci, port);
2416 if (dlci->state != DLCI_OPEN)
2420 return dlci->modem_rx & TIOCM_CD;
2425 struct gsm_dlci *dlci = container_of(port, struct gsm_dlci, port);
2426 unsigned int modem_tx = dlci->modem_tx;
2431 if (modem_tx != dlci->modem_tx) {
2432 dlci->modem_tx = modem_tx;
2433 gsmtty_modem_update(dlci, 0);
2446 struct gsm_dlci *dlci;
2462 dlci = gsm->dlci[line];
2463 if (dlci == NULL)
2464 dlci = gsm_dlci_alloc(gsm, line);
2465 if (dlci == NULL)
2467 port = &dlci->port;
2469 tty->driver_data = dlci;
2472 dlci->modem_rx = 0;
2477 gsm_dlci_begin_open(dlci);
2484 struct gsm_dlci *dlci = tty->driver_data;
2485 if (dlci == NULL)
2487 if (tty_port_close_start(&dlci->port, tty, filp) == 0)
2489 gsm_dlci_begin_close(dlci);
2490 tty_port_close_end(&dlci->port, tty);
2491 tty_port_tty_set(&dlci->port, NULL);
2496 struct gsm_dlci *dlci = tty->driver_data;
2497 tty_port_hangup(&dlci->port);
2498 gsm_dlci_begin_close(dlci);
2504 struct gsm_dlci *dlci = tty->driver_data;
2506 int sent = kfifo_in_locked(dlci->fifo, buf, len, &dlci->lock);
2508 gsm_dlci_data_kick(dlci);
2514 struct gsm_dlci *dlci = tty->driver_data;
2515 return TX_SIZE - kfifo_len(dlci->fifo);
2520 struct gsm_dlci *dlci = tty->driver_data;
2521 return kfifo_len(dlci->fifo);
2526 struct gsm_dlci *dlci = tty->driver_data;
2531 kfifo_reset(dlci->fifo);
2544 struct gsm_dlci *dlci = tty->driver_data;
2545 return dlci->modem_rx;
2551 struct gsm_dlci *dlci = tty->driver_data;
2552 unsigned int modem_tx = dlci->modem_tx;
2557 if (modem_tx != dlci->modem_tx) {
2558 dlci->modem_tx = modem_tx;
2559 return gsmtty_modem_update(dlci, 0);
2583 struct gsm_dlci *dlci = tty->driver_data;
2585 dlci->modem_tx &= ~TIOCM_DTR;
2586 dlci->throttled = 1;
2588 gsmtty_modem_update(dlci, 0);
2593 struct gsm_dlci *dlci = tty->driver_data;
2595 dlci->modem_tx |= TIOCM_DTR;
2596 dlci->throttled = 0;
2598 gsmtty_modem_update(dlci, 0);
2603 struct gsm_dlci *dlci = tty->driver_data;
2614 return gsmtty_modem_update(dlci, encode);