Lines Matching full:pdu
37 #define LLC_PDU_IS_GROUP_DSAP(pdu) \ argument
38 ((pdu->dsap & LLC_PDU_GROUP_DSAP_MASK) ? 0 : 1)
39 #define LLC_PDU_IS_INDIV_DSAP(pdu) \ argument
40 (!(pdu->dsap & LLC_PDU_GROUP_DSAP_MASK) ? 0 : 1)
42 /* Command/response PDU indicator in SSAP field */
46 #define LLC_PDU_IS_CMD(pdu) ((pdu->ssap & LLC_PDU_RSP) ? 0 : 1) argument
47 #define LLC_PDU_IS_RSP(pdu) ((pdu->ssap & LLC_PDU_RSP) ? 1 : 0) argument
49 /* Get PDU type from 2 lowest-order bits of control field first byte */
60 #define LLC_PDU_TYPE_IS_I(pdu) \ argument
61 ((!(pdu->ctrl_1 & LLC_PDU_TYPE_I_MASK)) ? 1 : 0)
63 #define LLC_PDU_TYPE_IS_U(pdu) \ argument
64 (((pdu->ctrl_1 & LLC_PDU_TYPE_U_MASK) == LLC_PDU_TYPE_U) ? 1 : 0)
66 #define LLC_PDU_TYPE_IS_S(pdu) \ argument
67 (((pdu->ctrl_1 & LLC_PDU_TYPE_S_MASK) == LLC_PDU_TYPE_S) ? 1 : 0)
69 /* U-format PDU control field masks */
71 #define LLC_U_PF_IS_1(pdu) ((pdu->ctrl_1 & LLC_U_PF_BIT_MASK) ? 1 : 0) argument
72 #define LLC_U_PF_IS_0(pdu) ((!(pdu->ctrl_1 & LLC_U_PF_BIT_MASK)) ? 1 : 0) argument
75 #define LLC_U_PDU_CMD(pdu) (pdu->ctrl_1 & LLC_U_PDU_CMD_MASK) argument
76 #define LLC_U_PDU_RSP(pdu) (pdu->ctrl_1 & LLC_U_PDU_CMD_MASK) argument
121 /* I-PDU masks ('ctrl' is I-PDU control word) */
122 #define LLC_I_GET_NS(pdu) (u8)((pdu->ctrl_1 & 0xFE) >> 1) argument
123 #define LLC_I_GET_NR(pdu) (u8)((pdu->ctrl_2 & 0xFE) >> 1) argument
127 #define LLC_I_PF_IS_0(pdu) ((!(pdu->ctrl_2 & LLC_I_PF_BIT_MASK)) ? 1 : 0) argument
128 #define LLC_I_PF_IS_1(pdu) ((pdu->ctrl_2 & LLC_I_PF_BIT_MASK) ? 1 : 0) argument
130 /* S-PDU supervisory commands and responses */
133 #define LLC_S_PDU_CMD(pdu) (pdu->ctrl_1 & LLC_S_PDU_CMD_MASK) argument
134 #define LLC_S_PDU_RSP(pdu) (pdu->ctrl_1 & LLC_S_PDU_CMD_MASK) argument
138 #define LLC_2_PDU_CMD_REJ 0x08 /* reject PDU cmd */
139 #define LLC_2_PDU_RSP_REJ 0x08 /* reject PDU rsp */
144 #define LLC_S_PF_IS_0(pdu) ((!(pdu->ctrl_2 & LLC_S_PF_BIT_MASK)) ? 1 : 0) argument
145 #define LLC_S_PF_IS_1(pdu) ((pdu->ctrl_2 & LLC_S_PF_BIT_MASK) ? 1 : 0) argument
147 #define PDU_SUPV_GET_Nr(pdu) ((pdu->ctrl_2 & 0xFE) >> 1) argument
156 * (if U-PDU) or word pointer to rejected PDU control field
198 /* Sequence-numbered PDU format (4 bytes in length) */
211 /* Un-numbered PDU format (3 bytes in length) */
224 * llc_pdu_header_init - initializes pdu header
226 * @type: type of PDU (U, I or S).
237 struct llc_pdu_un *pdu; in llc_pdu_header_init() local
250 pdu = llc_pdu_un_hdr(skb); in llc_pdu_header_init()
251 pdu->dsap = dsap; in llc_pdu_header_init()
252 pdu->ssap = ssap; in llc_pdu_header_init()
253 pdu->ssap |= cr; in llc_pdu_header_init()
307 * llc_pdu_init_as_ui_cmd - sets LLC header as UI PDU
310 * This function sets third byte of LLC header as a UI PDU.
314 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); in llc_pdu_init_as_ui_cmd() local
316 pdu->ctrl_1 = LLC_PDU_TYPE_U; in llc_pdu_init_as_ui_cmd()
317 pdu->ctrl_1 |= LLC_1_PDU_CMD_UI; in llc_pdu_init_as_ui_cmd()
321 * llc_pdu_init_as_test_cmd - sets PDU as TEST
324 * Sets a PDU as TEST
328 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); in llc_pdu_init_as_test_cmd() local
330 pdu->ctrl_1 = LLC_PDU_TYPE_U; in llc_pdu_init_as_test_cmd()
331 pdu->ctrl_1 |= LLC_1_PDU_CMD_TEST; in llc_pdu_init_as_test_cmd()
332 pdu->ctrl_1 |= LLC_U_PF_BIT_MASK; in llc_pdu_init_as_test_cmd()
336 * llc_pdu_init_as_test_rsp - build TEST response PDU
338 * @ev_skb: The received TEST command PDU frame
340 * Builds a pdu frame as a TEST response.
345 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); in llc_pdu_init_as_test_rsp() local
347 pdu->ctrl_1 = LLC_PDU_TYPE_U; in llc_pdu_init_as_test_rsp()
348 pdu->ctrl_1 |= LLC_1_PDU_CMD_TEST; in llc_pdu_init_as_test_rsp()
349 pdu->ctrl_1 |= LLC_U_PF_BIT_MASK; in llc_pdu_init_as_test_rsp()
355 memcpy(((u8 *)pdu) + 3, ((u8 *)ev_pdu) + 3, dsize); in llc_pdu_init_as_test_rsp()
374 * a XID PDU.
380 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); in llc_pdu_init_as_xid_cmd() local
382 pdu->ctrl_1 = LLC_PDU_TYPE_U; in llc_pdu_init_as_xid_cmd()
383 pdu->ctrl_1 |= LLC_1_PDU_CMD_XID; in llc_pdu_init_as_xid_cmd()
384 pdu->ctrl_1 |= LLC_U_PF_BIT_MASK; in llc_pdu_init_as_xid_cmd()
385 xid_info = (struct llc_xid_info *)(((u8 *)&pdu->ctrl_1) + 1); in llc_pdu_init_as_xid_cmd()
396 * llc_pdu_init_as_xid_rsp - builds XID response PDU
401 * Builds a pdu frame as an XID response.
407 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); in llc_pdu_init_as_xid_rsp() local
409 pdu->ctrl_1 = LLC_PDU_TYPE_U; in llc_pdu_init_as_xid_rsp()
410 pdu->ctrl_1 |= LLC_1_PDU_CMD_XID; in llc_pdu_init_as_xid_rsp()
411 pdu->ctrl_1 |= LLC_U_PF_BIT_MASK; in llc_pdu_init_as_xid_rsp()
413 xid_info = (struct llc_xid_info *)(((u8 *)&pdu->ctrl_1) + 1); in llc_pdu_init_as_xid_rsp()
422 u16 rej_pdu_ctrl; /* bits 1-8 if U-PDU */