36 #include <linux/netdevice.h>
45 #define dprintk(args...) printk(KERN_DEBUG args)
47 #define dprintk(args...)
75 static u16 llc_util_nr_inside_tx_window(
struct sock *
sk,
u8 nr)
89 pdu = llc_pdu_sn_hdr(skb);
92 pdu = llc_pdu_sn_hdr(skb);
154 const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
162 const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
170 const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
178 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
180 return llc_conn_space(sk, skb) &&
188 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
190 return llc_conn_space(sk, skb) &&
199 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
200 const u8 vr = llc_sk(sk)->vR;
205 !llc_util_ns_inside_rx_window(ns, vr, llc_sk(sk)->
rw) ? 0 : 1;
211 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
212 const u8 vr = llc_sk(sk)->vR;
217 !llc_util_ns_inside_rx_window(ns, vr, llc_sk(sk)->
rw) ? 0 : 1;
223 const struct llc_pdu_sn * pdu = llc_pdu_sn_hdr(skb);
224 const u8 vr = llc_sk(sk)->vR;
228 llc_util_ns_inside_rx_window(ns, vr, llc_sk(sk)->
rw) ? 0 : 1;
230 dprintk(
"%s: matched, state=%d, ns=%d, vr=%d\n",
231 __func__, llc_sk(sk)->
state, ns, vr);
237 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
239 return llc_conn_space(sk, skb) &&
247 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
256 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
258 return llc_conn_space(sk, skb) &&
266 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
267 const u8 vr = llc_sk(sk)->vR;
272 !llc_util_ns_inside_rx_window(ns, vr, llc_sk(sk)->
rw) ? 0 : 1;
278 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
279 const u8 vr = llc_sk(sk)->vR;
284 !llc_util_ns_inside_rx_window(ns, vr, llc_sk(sk)->
rw) ? 0 : 1;
290 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
291 const u8 vr = llc_sk(sk)->vR;
295 !llc_util_ns_inside_rx_window(ns, vr, llc_sk(sk)->
rw) ? 0 : 1;
301 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
302 const u8 vr = llc_sk(sk)->vR;
306 llc_util_ns_inside_rx_window(ns, vr, llc_sk(sk)->
rw) ? 0 : 1;
308 dprintk(
"%s: matched, state=%d, ns=%d, vr=%d\n",
309 __func__, llc_sk(sk)->
state, ns, vr);
315 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
324 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
333 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
342 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
351 const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
359 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
368 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
377 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
386 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
395 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
404 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
413 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
415 return llc_conn_space(sk, skb) &&
423 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
425 return llc_conn_space(sk, skb) &&
433 const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
450 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
465 const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
484 const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
506 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
507 const u8 vs = llc_sk(sk)->vS;
512 nr != vs && llc_util_nr_inside_tx_window(sk, nr)) {
513 dprintk(
"%s: matched, state=%d, vs=%d, nr=%d\n",
514 __func__, llc_sk(sk)->
state, vs, nr);
524 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
525 const u8 vs = llc_sk(sk)->vS;
530 nr != vs && llc_util_nr_inside_tx_window(sk, nr)) {
532 dprintk(
"%s: matched, state=%d, vs=%d, nr=%d\n",
533 __func__, llc_sk(sk)->
state, vs, nr);
592 return llc_sk(sk)->data_flag != 1;
597 return llc_sk(sk)->data_flag;
602 return llc_sk(sk)->data_flag != 2;
607 return llc_sk(sk)->p_flag != 1;
623 return !(skb_queue_len(&llc_sk(sk)->pdu_unack_q) + 1 == llc_sk(sk)->k);
637 return skb_queue_len(&llc_sk(sk)->pdu_unack_q) + 1 == llc_sk(sk)->k;
642 return llc_sk(sk)->p_flag;
650 return llc_sk(sk)->p_flag == f_bit ? 0 : 1;
655 return llc_sk(sk)->remote_busy_flag;
660 return !llc_sk(sk)->remote_busy_flag;
665 return !(llc_sk(sk)->retry_count < llc_sk(sk)->n2);
670 return !(llc_sk(sk)->retry_count >= llc_sk(sk)->n2);
675 return !llc_sk(sk)->s_flag;
680 return llc_sk(sk)->s_flag;
685 return !llc_sk(sk)->cause_flag;
690 return llc_sk(sk)->cause_flag;