static void confirm_Dsend(struct dchannel *dch) { struct sk_buff *skb; skb = _alloc_mISDN_skb(PH_DATA_CNF, mISDN_HEAD_ID(dch->tx_skb), 0, NULL, GFP_ATOMIC); if (!skb) { printk(KERN_ERR "%s: no skb id %x\n", __func__, mISDN_HEAD_ID(dch->tx_skb)); return; } skb_queue_tail(&dch->rqueue, skb); schedule_event(dch, FLG_RECVQUEUE); }
static int mISDN_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags) { struct sk_buff *skb; struct sock *sk = sock->sk; struct sockaddr_mISDN *maddr; int copied, err; if (*debug & DEBUG_SOCKET) printk(KERN_DEBUG "%s: len %d, flags %x ch.nr %d, proto %x\n", __func__, (int)len, flags, _pms(sk)->ch.nr, sk->sk_protocol); if (flags & (MSG_OOB)) return -EOPNOTSUPP; if (sk->sk_state == MISDN_CLOSED) return 0; skb = skb_recv_datagram(sk, flags, flags & MSG_DONTWAIT, &err); if (!skb) return err; if (msg->msg_namelen >= sizeof(struct sockaddr_mISDN)) { msg->msg_namelen = sizeof(struct sockaddr_mISDN); maddr = (struct sockaddr_mISDN *)msg->msg_name; maddr->family = AF_ISDN; maddr->dev = _pms(sk)->dev->id; if ((sk->sk_protocol == ISDN_P_LAPD_TE) || (sk->sk_protocol == ISDN_P_LAPD_NT)) { maddr->channel = (mISDN_HEAD_ID(skb) >> 16) & 0xff; maddr->tei = (mISDN_HEAD_ID(skb) >> 8) & 0xff; maddr->sapi = mISDN_HEAD_ID(skb) & 0xff; } else {
static int ph_data_confirm(struct layer2 *l2, struct mISDNhead *hh, struct sk_buff *skb) { struct sk_buff *nskb = skb; int ret = -EAGAIN; if (test_bit(FLG_L1_NOTREADY, &l2->flag)) { if (hh->id == l2->down_id) { nskb = skb_dequeue(&l2->down_queue); if (nskb) { l2->down_id = mISDN_HEAD_ID(nskb); if (l2down_skb(l2, nskb)) { dev_kfree_skb(nskb); l2->down_id = MISDN_ID_NONE; } } else l2->down_id = MISDN_ID_NONE; if (ret) { dev_kfree_skb(skb); ret = 0; } if (l2->down_id == MISDN_ID_NONE) { test_and_clear_bit(FLG_L1_NOTREADY, &l2->flag); mISDN_FsmEvent(&l2->l2m, EV_L2_ACK_PULL, NULL); } } } if (!test_and_set_bit(FLG_L1_NOTREADY, &l2->flag)) { nskb = skb_dequeue(&l2->down_queue); if (nskb) { l2->down_id = mISDN_HEAD_ID(nskb); if (l2down_skb(l2, nskb)) { dev_kfree_skb(nskb); l2->down_id = MISDN_ID_NONE; test_and_clear_bit(FLG_L1_NOTREADY, &l2->flag); } } else test_and_clear_bit(FLG_L1_NOTREADY, &l2->flag); } return ret; }
void confirm_Bsend(struct bchannel *bch) { struct sk_buff *skb; if (bch->rcount >= 64) { printk(KERN_WARNING "B-channel %p receive queue overflow, " "flushing!\n", bch); skb_queue_purge(&bch->rqueue); bch->rcount = 0; } skb = _alloc_mISDN_skb(PH_DATA_CNF, mISDN_HEAD_ID(bch->tx_skb), 0, NULL, GFP_ATOMIC); if (!skb) { printk(KERN_ERR "%s: no skb id %x\n", __func__, mISDN_HEAD_ID(bch->tx_skb)); return; } bch->rcount++; skb_queue_tail(&bch->rqueue, skb); schedule_event(bch, FLG_RECVQUEUE); }
static int l2down_raw(struct layer2 *l2, struct sk_buff *skb) { struct mISDNhead *hh = mISDN_HEAD_P(skb); if (hh->prim == PH_DATA_REQ) { if (test_and_set_bit(FLG_L1_NOTREADY, &l2->flag)) { skb_queue_tail(&l2->down_queue, skb); return 0; } l2->down_id = mISDN_HEAD_ID(skb); } return l2down_skb(l2, skb); }
static void l2up(struct layer2 *l2, u_int prim, struct sk_buff *skb) { int err; if (!l2->up) return; mISDN_HEAD_PRIM(skb) = prim; mISDN_HEAD_ID(skb) = (l2->ch.nr << 16) | l2->ch.addr; err = l2->up->send(l2->up, skb); if (err) { printk(KERN_WARNING "%s: err=%d\n", __func__, err); dev_kfree_skb(skb); } }
static void l2up(struct layer2 *l2, u_int prim, struct sk_buff *skb) { int err; if (!l2->up) return; mISDN_HEAD_PRIM(skb) = prim; mISDN_HEAD_ID(skb) = (l2->ch.nr << 16) | l2->ch.addr; err = l2->up->send(l2->up, skb); if (err) { ; dev_kfree_skb(skb); } }