Lines Matching refs:ndlc

46 int ndlc_open(struct llt_ndlc *ndlc)  in ndlc_open()  argument
49 ndlc->ops->enable(ndlc->phy_id); in ndlc_open()
50 ndlc->powered = 1; in ndlc_open()
55 void ndlc_close(struct llt_ndlc *ndlc) in ndlc_close() argument
63 ndlc->ops->enable(ndlc->phy_id); in ndlc_close()
65 nci_prop_cmd(ndlc->ndev, ST_NCI_CORE_PROP, in ndlc_close()
68 ndlc->powered = 0; in ndlc_close()
69 ndlc->ops->disable(ndlc->phy_id); in ndlc_close()
73 int ndlc_send(struct llt_ndlc *ndlc, struct sk_buff *skb) in ndlc_send() argument
80 skb_queue_tail(&ndlc->send_q, skb); in ndlc_send()
82 schedule_work(&ndlc->sm_work); in ndlc_send()
88 static void llt_ndlc_send_queue(struct llt_ndlc *ndlc) in llt_ndlc_send_queue() argument
94 if (ndlc->send_q.qlen) in llt_ndlc_send_queue()
96 ndlc->send_q.qlen, ndlc->ack_pending_q.qlen); in llt_ndlc_send_queue()
98 while (ndlc->send_q.qlen) { in llt_ndlc_send_queue()
99 skb = skb_dequeue(&ndlc->send_q); in llt_ndlc_send_queue()
101 r = ndlc->ops->write(ndlc->phy_id, skb); in llt_ndlc_send_queue()
103 ndlc->hard_fault = r; in llt_ndlc_send_queue()
109 skb_queue_tail(&ndlc->ack_pending_q, skb); in llt_ndlc_send_queue()
112 ndlc->t1_active = true; in llt_ndlc_send_queue()
113 mod_timer(&ndlc->t1_timer, time_sent + in llt_ndlc_send_queue()
116 ndlc->t2_active = true; in llt_ndlc_send_queue()
117 mod_timer(&ndlc->t2_timer, time_sent + in llt_ndlc_send_queue()
122 static void llt_ndlc_requeue_data_pending(struct llt_ndlc *ndlc) in llt_ndlc_requeue_data_pending() argument
127 while ((skb = skb_dequeue_tail(&ndlc->ack_pending_q))) { in llt_ndlc_requeue_data_pending()
143 skb_queue_head(&ndlc->send_q, skb); in llt_ndlc_requeue_data_pending()
147 static void llt_ndlc_rcv_queue(struct llt_ndlc *ndlc) in llt_ndlc_rcv_queue() argument
153 if (ndlc->rcv_q.qlen) in llt_ndlc_rcv_queue()
154 pr_debug("rcvQlen=%d\n", ndlc->rcv_q.qlen); in llt_ndlc_rcv_queue()
156 while ((skb = skb_dequeue(&ndlc->rcv_q)) != NULL) { in llt_ndlc_rcv_queue()
162 skb = skb_dequeue(&ndlc->ack_pending_q); in llt_ndlc_rcv_queue()
164 del_timer_sync(&ndlc->t1_timer); in llt_ndlc_rcv_queue()
165 del_timer_sync(&ndlc->t2_timer); in llt_ndlc_rcv_queue()
166 ndlc->t2_active = false; in llt_ndlc_rcv_queue()
167 ndlc->t1_active = false; in llt_ndlc_rcv_queue()
170 llt_ndlc_requeue_data_pending(ndlc); in llt_ndlc_rcv_queue()
171 llt_ndlc_send_queue(ndlc); in llt_ndlc_rcv_queue()
174 ndlc->t1_active = true; in llt_ndlc_rcv_queue()
175 mod_timer(&ndlc->t1_timer, time_sent + in llt_ndlc_rcv_queue()
180 ndlc->t1_active = true; in llt_ndlc_rcv_queue()
181 mod_timer(&ndlc->t1_timer, time_sent + in llt_ndlc_rcv_queue()
189 nci_recv_frame(ndlc->ndev, skb); in llt_ndlc_rcv_queue()
198 struct llt_ndlc *ndlc = container_of(work, struct llt_ndlc, sm_work); in llt_ndlc_sm_work() local
200 llt_ndlc_send_queue(ndlc); in llt_ndlc_sm_work()
201 llt_ndlc_rcv_queue(ndlc); in llt_ndlc_sm_work()
203 if (ndlc->t1_active && timer_pending(&ndlc->t1_timer) == 0) { in llt_ndlc_sm_work()
206 ndlc->t1_active = false; in llt_ndlc_sm_work()
208 llt_ndlc_requeue_data_pending(ndlc); in llt_ndlc_sm_work()
209 llt_ndlc_send_queue(ndlc); in llt_ndlc_sm_work()
212 if (ndlc->t2_active && timer_pending(&ndlc->t2_timer) == 0) { in llt_ndlc_sm_work()
214 ndlc->t2_active = false; in llt_ndlc_sm_work()
215 ndlc->t1_active = false; in llt_ndlc_sm_work()
216 del_timer_sync(&ndlc->t1_timer); in llt_ndlc_sm_work()
217 del_timer_sync(&ndlc->t2_timer); in llt_ndlc_sm_work()
218 ndlc_close(ndlc); in llt_ndlc_sm_work()
219 ndlc->hard_fault = -EREMOTEIO; in llt_ndlc_sm_work()
223 void ndlc_recv(struct llt_ndlc *ndlc, struct sk_buff *skb) in ndlc_recv() argument
227 ndlc->hard_fault = -EREMOTEIO; in ndlc_recv()
228 ndlc_close(ndlc); in ndlc_recv()
231 skb_queue_tail(&ndlc->rcv_q, skb); in ndlc_recv()
234 schedule_work(&ndlc->sm_work); in ndlc_recv()
240 struct llt_ndlc *ndlc = from_timer(ndlc, t, t1_timer); in ndlc_t1_timeout() local
244 schedule_work(&ndlc->sm_work); in ndlc_t1_timeout()
249 struct llt_ndlc *ndlc = from_timer(ndlc, t, t2_timer); in ndlc_t2_timeout() local
253 schedule_work(&ndlc->sm_work); in ndlc_t2_timeout()
260 struct llt_ndlc *ndlc; in ndlc_probe() local
262 ndlc = devm_kzalloc(dev, sizeof(struct llt_ndlc), GFP_KERNEL); in ndlc_probe()
263 if (!ndlc) in ndlc_probe()
266 ndlc->ops = phy_ops; in ndlc_probe()
267 ndlc->phy_id = phy_id; in ndlc_probe()
268 ndlc->dev = dev; in ndlc_probe()
269 ndlc->powered = 0; in ndlc_probe()
271 *ndlc_id = ndlc; in ndlc_probe()
274 timer_setup(&ndlc->t1_timer, ndlc_t1_timeout, 0); in ndlc_probe()
275 timer_setup(&ndlc->t2_timer, ndlc_t2_timeout, 0); in ndlc_probe()
277 skb_queue_head_init(&ndlc->rcv_q); in ndlc_probe()
278 skb_queue_head_init(&ndlc->send_q); in ndlc_probe()
279 skb_queue_head_init(&ndlc->ack_pending_q); in ndlc_probe()
281 INIT_WORK(&ndlc->sm_work, llt_ndlc_sm_work); in ndlc_probe()
283 return st_nci_probe(ndlc, phy_headroom, phy_tailroom, se_status); in ndlc_probe()
287 void ndlc_remove(struct llt_ndlc *ndlc) in ndlc_remove() argument
289 st_nci_remove(ndlc->ndev); in ndlc_remove()
292 del_timer_sync(&ndlc->t1_timer); in ndlc_remove()
293 del_timer_sync(&ndlc->t2_timer); in ndlc_remove()
294 ndlc->t2_active = false; in ndlc_remove()
295 ndlc->t1_active = false; in ndlc_remove()
297 skb_queue_purge(&ndlc->rcv_q); in ndlc_remove()
298 skb_queue_purge(&ndlc->send_q); in ndlc_remove()