Lines Matching refs:ndlc
58 int ndlc_open(struct llt_ndlc *ndlc) in ndlc_open() argument
61 ndlc->ops->enable(ndlc->phy_id); in ndlc_open()
62 ndlc->powered = 1; in ndlc_open()
67 void ndlc_close(struct llt_ndlc *ndlc) in ndlc_close() argument
75 ndlc->ops->enable(ndlc->phy_id); in ndlc_close()
77 nci_prop_cmd(ndlc->ndev, ST_NCI_CORE_PROP, in ndlc_close()
80 ndlc->powered = 0; in ndlc_close()
81 ndlc->ops->disable(ndlc->phy_id); in ndlc_close()
85 int ndlc_send(struct llt_ndlc *ndlc, struct sk_buff *skb) in ndlc_send() argument
92 skb_queue_tail(&ndlc->send_q, skb); in ndlc_send()
94 schedule_work(&ndlc->sm_work); in ndlc_send()
100 static void llt_ndlc_send_queue(struct llt_ndlc *ndlc) in llt_ndlc_send_queue() argument
106 if (ndlc->send_q.qlen) in llt_ndlc_send_queue()
108 ndlc->send_q.qlen, ndlc->ack_pending_q.qlen); in llt_ndlc_send_queue()
110 while (ndlc->send_q.qlen) { in llt_ndlc_send_queue()
111 skb = skb_dequeue(&ndlc->send_q); in llt_ndlc_send_queue()
113 r = ndlc->ops->write(ndlc->phy_id, skb); in llt_ndlc_send_queue()
115 ndlc->hard_fault = r; in llt_ndlc_send_queue()
121 skb_queue_tail(&ndlc->ack_pending_q, skb); in llt_ndlc_send_queue()
124 ndlc->t1_active = true; in llt_ndlc_send_queue()
125 mod_timer(&ndlc->t1_timer, time_sent + in llt_ndlc_send_queue()
128 ndlc->t2_active = true; in llt_ndlc_send_queue()
129 mod_timer(&ndlc->t2_timer, time_sent + in llt_ndlc_send_queue()
134 static void llt_ndlc_requeue_data_pending(struct llt_ndlc *ndlc) in llt_ndlc_requeue_data_pending() argument
139 while ((skb = skb_dequeue_tail(&ndlc->ack_pending_q))) { in llt_ndlc_requeue_data_pending()
155 skb_queue_head(&ndlc->send_q, skb); in llt_ndlc_requeue_data_pending()
159 static void llt_ndlc_rcv_queue(struct llt_ndlc *ndlc) in llt_ndlc_rcv_queue() argument
165 if (ndlc->rcv_q.qlen) in llt_ndlc_rcv_queue()
166 pr_debug("rcvQlen=%d\n", ndlc->rcv_q.qlen); in llt_ndlc_rcv_queue()
168 while ((skb = skb_dequeue(&ndlc->rcv_q)) != NULL) { in llt_ndlc_rcv_queue()
174 skb = skb_dequeue(&ndlc->ack_pending_q); in llt_ndlc_rcv_queue()
176 del_timer_sync(&ndlc->t1_timer); in llt_ndlc_rcv_queue()
177 del_timer_sync(&ndlc->t2_timer); in llt_ndlc_rcv_queue()
178 ndlc->t2_active = false; in llt_ndlc_rcv_queue()
179 ndlc->t1_active = false; in llt_ndlc_rcv_queue()
182 llt_ndlc_requeue_data_pending(ndlc); in llt_ndlc_rcv_queue()
183 llt_ndlc_send_queue(ndlc); in llt_ndlc_rcv_queue()
186 ndlc->t1_active = true; in llt_ndlc_rcv_queue()
187 mod_timer(&ndlc->t1_timer, time_sent + in llt_ndlc_rcv_queue()
192 ndlc->t1_active = true; in llt_ndlc_rcv_queue()
193 mod_timer(&ndlc->t1_timer, time_sent + in llt_ndlc_rcv_queue()
201 nci_recv_frame(ndlc->ndev, skb); in llt_ndlc_rcv_queue()
210 struct llt_ndlc *ndlc = container_of(work, struct llt_ndlc, sm_work); in llt_ndlc_sm_work() local
212 llt_ndlc_send_queue(ndlc); in llt_ndlc_sm_work()
213 llt_ndlc_rcv_queue(ndlc); in llt_ndlc_sm_work()
215 if (ndlc->t1_active && timer_pending(&ndlc->t1_timer) == 0) { in llt_ndlc_sm_work()
218 ndlc->t1_active = false; in llt_ndlc_sm_work()
220 llt_ndlc_requeue_data_pending(ndlc); in llt_ndlc_sm_work()
221 llt_ndlc_send_queue(ndlc); in llt_ndlc_sm_work()
224 if (ndlc->t2_active && timer_pending(&ndlc->t2_timer) == 0) { in llt_ndlc_sm_work()
226 ndlc->t2_active = false; in llt_ndlc_sm_work()
227 ndlc->t1_active = false; in llt_ndlc_sm_work()
228 del_timer_sync(&ndlc->t1_timer); in llt_ndlc_sm_work()
229 del_timer_sync(&ndlc->t2_timer); in llt_ndlc_sm_work()
230 ndlc_close(ndlc); in llt_ndlc_sm_work()
231 ndlc->hard_fault = -EREMOTEIO; in llt_ndlc_sm_work()
235 void ndlc_recv(struct llt_ndlc *ndlc, struct sk_buff *skb) in ndlc_recv() argument
239 ndlc->hard_fault = -EREMOTEIO; in ndlc_recv()
240 ndlc_close(ndlc); in ndlc_recv()
243 skb_queue_tail(&ndlc->rcv_q, skb); in ndlc_recv()
246 schedule_work(&ndlc->sm_work); in ndlc_recv()
252 struct llt_ndlc *ndlc = (struct llt_ndlc *)data; in ndlc_t1_timeout() local
256 schedule_work(&ndlc->sm_work); in ndlc_t1_timeout()
261 struct llt_ndlc *ndlc = (struct llt_ndlc *)data; in ndlc_t2_timeout() local
265 schedule_work(&ndlc->sm_work); in ndlc_t2_timeout()
272 struct llt_ndlc *ndlc; in ndlc_probe() local
274 ndlc = devm_kzalloc(dev, sizeof(struct llt_ndlc), GFP_KERNEL); in ndlc_probe()
275 if (!ndlc) in ndlc_probe()
278 ndlc->ops = phy_ops; in ndlc_probe()
279 ndlc->phy_id = phy_id; in ndlc_probe()
280 ndlc->dev = dev; in ndlc_probe()
281 ndlc->powered = 0; in ndlc_probe()
283 *ndlc_id = ndlc; in ndlc_probe()
286 init_timer(&ndlc->t1_timer); in ndlc_probe()
287 ndlc->t1_timer.data = (unsigned long)ndlc; in ndlc_probe()
288 ndlc->t1_timer.function = ndlc_t1_timeout; in ndlc_probe()
290 init_timer(&ndlc->t2_timer); in ndlc_probe()
291 ndlc->t2_timer.data = (unsigned long)ndlc; in ndlc_probe()
292 ndlc->t2_timer.function = ndlc_t2_timeout; in ndlc_probe()
294 skb_queue_head_init(&ndlc->rcv_q); in ndlc_probe()
295 skb_queue_head_init(&ndlc->send_q); in ndlc_probe()
296 skb_queue_head_init(&ndlc->ack_pending_q); in ndlc_probe()
298 INIT_WORK(&ndlc->sm_work, llt_ndlc_sm_work); in ndlc_probe()
300 return st_nci_probe(ndlc, phy_headroom, phy_tailroom, se_status); in ndlc_probe()
304 void ndlc_remove(struct llt_ndlc *ndlc) in ndlc_remove() argument
306 st_nci_remove(ndlc->ndev); in ndlc_remove()
309 del_timer_sync(&ndlc->t1_timer); in ndlc_remove()
310 del_timer_sync(&ndlc->t2_timer); in ndlc_remove()
311 ndlc->t2_active = false; in ndlc_remove()
312 ndlc->t1_active = false; in ndlc_remove()
314 skb_queue_purge(&ndlc->rcv_q); in ndlc_remove()
315 skb_queue_purge(&ndlc->send_q); in ndlc_remove()