Lines Matching full:pdu

2  * llc_pdu.c - access to PDU internals
19 static u8 llc_pdu_get_pf_bit(struct llc_pdu_sn *pdu);
31 * This function sets poll/final bit in LLC header (based on type of PDU).
38 struct llc_pdu_sn *pdu; in llc_pdu_set_pf_bit() local
41 pdu = llc_pdu_sn_hdr(skb); in llc_pdu_set_pf_bit()
46 pdu->ctrl_2 = (pdu->ctrl_2 & 0xFE) | bit_value; in llc_pdu_set_pf_bit()
49 pdu->ctrl_1 |= (pdu->ctrl_1 & 0xEF) | (bit_value << 4); in llc_pdu_set_pf_bit()
60 * PDU). In I or S pdus, p/f bit is right bit of fourth byte in header. In
66 struct llc_pdu_sn *pdu; in llc_pdu_decode_pf_bit() local
69 pdu = llc_pdu_sn_hdr(skb); in llc_pdu_decode_pf_bit()
74 *pf_bit = pdu->ctrl_2 & LLC_S_PF_BIT_MASK; in llc_pdu_decode_pf_bit()
77 *pf_bit = (pdu->ctrl_1 & LLC_U_PF_BIT_MASK) >> 4; in llc_pdu_decode_pf_bit()
83 * llc_pdu_init_as_disc_cmd - Builds DISC PDU
85 * @p_bit: The P bit to set in the PDU
87 * Builds a pdu frame as a DISC command.
91 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); in llc_pdu_init_as_disc_cmd() local
93 pdu->ctrl_1 = LLC_PDU_TYPE_U; in llc_pdu_init_as_disc_cmd()
94 pdu->ctrl_1 |= LLC_2_PDU_CMD_DISC; in llc_pdu_init_as_disc_cmd()
95 pdu->ctrl_1 |= ((p_bit & 1) << 4) & LLC_U_PF_BIT_MASK; in llc_pdu_init_as_disc_cmd()
99 * llc_pdu_init_as_i_cmd - builds I pdu
101 * @p_bit: The P bit to set in the PDU
102 * @ns: The sequence number of the data PDU
103 * @nr: The seq. number of the expected I PDU from the remote
105 * Builds a pdu frame as an I command.
109 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); in llc_pdu_init_as_i_cmd() local
111 pdu->ctrl_1 = LLC_PDU_TYPE_I; in llc_pdu_init_as_i_cmd()
112 pdu->ctrl_2 = 0; in llc_pdu_init_as_i_cmd()
113 pdu->ctrl_2 |= (p_bit & LLC_I_PF_BIT_MASK); /* p/f bit */ in llc_pdu_init_as_i_cmd()
114 pdu->ctrl_1 |= (ns << 1) & 0xFE; /* set N(S) in bits 2..8 */ in llc_pdu_init_as_i_cmd()
115 pdu->ctrl_2 |= (nr << 1) & 0xFE; /* set N(R) in bits 10..16 */ in llc_pdu_init_as_i_cmd()
119 * llc_pdu_init_as_rej_cmd - builds REJ PDU
121 * @p_bit: The P bit to set in the PDU
122 * @nr: The seq. number of the expected I PDU from the remote
124 * Builds a pdu frame as a REJ command.
128 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); in llc_pdu_init_as_rej_cmd() local
130 pdu->ctrl_1 = LLC_PDU_TYPE_S; in llc_pdu_init_as_rej_cmd()
131 pdu->ctrl_1 |= LLC_2_PDU_CMD_REJ; in llc_pdu_init_as_rej_cmd()
132 pdu->ctrl_2 = 0; in llc_pdu_init_as_rej_cmd()
133 pdu->ctrl_2 |= p_bit & LLC_S_PF_BIT_MASK; in llc_pdu_init_as_rej_cmd()
134 pdu->ctrl_1 &= 0x0F; /* setting bits 5..8 to zero(reserved) */ in llc_pdu_init_as_rej_cmd()
135 pdu->ctrl_2 |= (nr << 1) & 0xFE; /* set N(R) in bits 10..16 */ in llc_pdu_init_as_rej_cmd()
139 * llc_pdu_init_as_rnr_cmd - builds RNR pdu
141 * @p_bit: The P bit to set in the PDU
142 * @nr: The seq. number of the expected I PDU from the remote
144 * Builds a pdu frame as an RNR command.
148 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); in llc_pdu_init_as_rnr_cmd() local
150 pdu->ctrl_1 = LLC_PDU_TYPE_S; in llc_pdu_init_as_rnr_cmd()
151 pdu->ctrl_1 |= LLC_2_PDU_CMD_RNR; in llc_pdu_init_as_rnr_cmd()
152 pdu->ctrl_2 = 0; in llc_pdu_init_as_rnr_cmd()
153 pdu->ctrl_2 |= p_bit & LLC_S_PF_BIT_MASK; in llc_pdu_init_as_rnr_cmd()
154 pdu->ctrl_1 &= 0x0F; /* setting bits 5..8 to zero(reserved) */ in llc_pdu_init_as_rnr_cmd()
155 pdu->ctrl_2 |= (nr << 1) & 0xFE; /* set N(R) in bits 10..16 */ in llc_pdu_init_as_rnr_cmd()
159 * llc_pdu_init_as_rr_cmd - Builds RR pdu
161 * @p_bit: The P bit to set in the PDU
162 * @nr: The seq. number of the expected I PDU from the remote
164 * Builds a pdu frame as an RR command.
168 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); in llc_pdu_init_as_rr_cmd() local
170 pdu->ctrl_1 = LLC_PDU_TYPE_S; in llc_pdu_init_as_rr_cmd()
171 pdu->ctrl_1 |= LLC_2_PDU_CMD_RR; in llc_pdu_init_as_rr_cmd()
172 pdu->ctrl_2 = p_bit & LLC_S_PF_BIT_MASK; in llc_pdu_init_as_rr_cmd()
173 pdu->ctrl_1 &= 0x0F; /* setting bits 5..8 to zero(reserved) */ in llc_pdu_init_as_rr_cmd()
174 pdu->ctrl_2 |= (nr << 1) & 0xFE; /* set N(R) in bits 10..16 */ in llc_pdu_init_as_rr_cmd()
178 * llc_pdu_init_as_sabme_cmd - builds SABME pdu
180 * @p_bit: The P bit to set in the PDU
182 * Builds a pdu frame as an SABME command.
186 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); in llc_pdu_init_as_sabme_cmd() local
188 pdu->ctrl_1 = LLC_PDU_TYPE_U; in llc_pdu_init_as_sabme_cmd()
189 pdu->ctrl_1 |= LLC_2_PDU_CMD_SABME; in llc_pdu_init_as_sabme_cmd()
190 pdu->ctrl_1 |= ((p_bit & 1) << 4) & LLC_U_PF_BIT_MASK; in llc_pdu_init_as_sabme_cmd()
194 * llc_pdu_init_as_dm_rsp - builds DM response pdu
196 * @f_bit: The F bit to set in the PDU
198 * Builds a pdu frame as a DM response.
202 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); in llc_pdu_init_as_dm_rsp() local
204 pdu->ctrl_1 = LLC_PDU_TYPE_U; in llc_pdu_init_as_dm_rsp()
205 pdu->ctrl_1 |= LLC_2_PDU_RSP_DM; in llc_pdu_init_as_dm_rsp()
206 pdu->ctrl_1 |= ((f_bit & 1) << 4) & LLC_U_PF_BIT_MASK; in llc_pdu_init_as_dm_rsp()
210 * llc_pdu_init_as_frmr_rsp - builds FRMR response PDU
212 * @prev_pdu: The rejected PDU frame
213 * @f_bit: The F bit to set in the PDU
218 * Builds a pdu frame as a FRMR response.
226 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); in llc_pdu_init_as_frmr_rsp() local
228 pdu->ctrl_1 = LLC_PDU_TYPE_U; in llc_pdu_init_as_frmr_rsp()
229 pdu->ctrl_1 |= LLC_2_PDU_RSP_FRMR; in llc_pdu_init_as_frmr_rsp()
230 pdu->ctrl_1 |= ((f_bit & 1) << 4) & LLC_U_PF_BIT_MASK; in llc_pdu_init_as_frmr_rsp()
232 frmr_info = (struct llc_frmr_info *)&pdu->ctrl_2; in llc_pdu_init_as_frmr_rsp()
248 * llc_pdu_init_as_rr_rsp - builds RR response pdu
250 * @f_bit: The F bit to set in the PDU
251 * @nr: The seq. number of the expected data PDU from the remote
253 * Builds a pdu frame as an RR response.
257 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); in llc_pdu_init_as_rr_rsp() local
259 pdu->ctrl_1 = LLC_PDU_TYPE_S; in llc_pdu_init_as_rr_rsp()
260 pdu->ctrl_1 |= LLC_2_PDU_RSP_RR; in llc_pdu_init_as_rr_rsp()
261 pdu->ctrl_2 = 0; in llc_pdu_init_as_rr_rsp()
262 pdu->ctrl_2 |= f_bit & LLC_S_PF_BIT_MASK; in llc_pdu_init_as_rr_rsp()
263 pdu->ctrl_1 &= 0x0F; /* setting bits 5..8 to zero(reserved) */ in llc_pdu_init_as_rr_rsp()
264 pdu->ctrl_2 |= (nr << 1) & 0xFE; /* set N(R) in bits 10..16 */ in llc_pdu_init_as_rr_rsp()
268 * llc_pdu_init_as_rej_rsp - builds REJ response pdu
270 * @f_bit: The F bit to set in the PDU
271 * @nr: The seq. number of the expected data PDU from the remote
273 * Builds a pdu frame as a REJ response.
277 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); in llc_pdu_init_as_rej_rsp() local
279 pdu->ctrl_1 = LLC_PDU_TYPE_S; in llc_pdu_init_as_rej_rsp()
280 pdu->ctrl_1 |= LLC_2_PDU_RSP_REJ; in llc_pdu_init_as_rej_rsp()
281 pdu->ctrl_2 = 0; in llc_pdu_init_as_rej_rsp()
282 pdu->ctrl_2 |= f_bit & LLC_S_PF_BIT_MASK; in llc_pdu_init_as_rej_rsp()
283 pdu->ctrl_1 &= 0x0F; /* setting bits 5..8 to zero(reserved) */ in llc_pdu_init_as_rej_rsp()
284 pdu->ctrl_2 |= (nr << 1) & 0xFE; /* set N(R) in bits 10..16 */ in llc_pdu_init_as_rej_rsp()
288 * llc_pdu_init_as_rnr_rsp - builds RNR response pdu
290 * @f_bit: The F bit to set in the PDU
291 * @nr: The seq. number of the expected data PDU from the remote
293 * Builds a pdu frame as an RNR response.
297 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); in llc_pdu_init_as_rnr_rsp() local
299 pdu->ctrl_1 = LLC_PDU_TYPE_S; in llc_pdu_init_as_rnr_rsp()
300 pdu->ctrl_1 |= LLC_2_PDU_RSP_RNR; in llc_pdu_init_as_rnr_rsp()
301 pdu->ctrl_2 = 0; in llc_pdu_init_as_rnr_rsp()
302 pdu->ctrl_2 |= f_bit & LLC_S_PF_BIT_MASK; in llc_pdu_init_as_rnr_rsp()
303 pdu->ctrl_1 &= 0x0F; /* setting bits 5..8 to zero(reserved) */ in llc_pdu_init_as_rnr_rsp()
304 pdu->ctrl_2 |= (nr << 1) & 0xFE; /* set N(R) in bits 10..16 */ in llc_pdu_init_as_rnr_rsp()
308 * llc_pdu_init_as_ua_rsp - builds UA response pdu
310 * @f_bit: The F bit to set in the PDU
312 * Builds a pdu frame as a UA response.
316 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); in llc_pdu_init_as_ua_rsp() local
318 pdu->ctrl_1 = LLC_PDU_TYPE_U; in llc_pdu_init_as_ua_rsp()
319 pdu->ctrl_1 |= LLC_2_PDU_RSP_UA; in llc_pdu_init_as_ua_rsp()
320 pdu->ctrl_1 |= ((f_bit & 1) << 4) & LLC_U_PF_BIT_MASK; in llc_pdu_init_as_ua_rsp()
324 * llc_pdu_decode_pdu_type - designates PDU type
326 * @type: type of PDU (output argument).
328 * This function designates type of PDU (I, S or U).
332 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); in llc_pdu_decode_pdu_type() local
334 if (pdu->ctrl_1 & 1) { in llc_pdu_decode_pdu_type()
335 if ((pdu->ctrl_1 & LLC_PDU_TYPE_U) == LLC_PDU_TYPE_U) in llc_pdu_decode_pdu_type()
344 * llc_pdu_get_pf_bit - extracts p/f bit of input PDU
345 * @pdu: pointer to LLC header.
347 * This function extracts p/f bit of input PDU. at first examines type of
348 * PDU and then extracts p/f bit. Returns the p/f bit.
350 static u8 llc_pdu_get_pf_bit(struct llc_pdu_sn *pdu) in llc_pdu_get_pf_bit() argument
355 if (pdu->ctrl_1 & 1) { in llc_pdu_get_pf_bit()
356 if ((pdu->ctrl_1 & LLC_PDU_TYPE_U) == LLC_PDU_TYPE_U) in llc_pdu_get_pf_bit()
365 pf_bit = pdu->ctrl_2 & LLC_S_PF_BIT_MASK; in llc_pdu_get_pf_bit()
368 pf_bit = (pdu->ctrl_1 & LLC_U_PF_BIT_MASK) >> 4; in llc_pdu_get_pf_bit()