Lines Matching full:fs

26 #define dbg_print_fs(fs)                                                                           \  argument
27 NET_DBG("fs(1): %u/%u/%u/%u/%u/%u", fs->fc.frame_type, fs->fc.security_enabled, \
28 fs->fc.frame_pending, fs->fc.ar, fs->fc.pan_id_comp, fs->fc.reserved); \
29 NET_DBG("fs(2): %u/%u/%u/%u/%u - %u", fs->fc.seq_num_suppr, fs->fc.ie_list, \
30 fs->fc.dst_addr_mode, fs->fc.frame_version, fs->fc.src_addr_mode, fs->sequence)
43 struct ieee802154_fcf_seq *fs = (struct ieee802154_fcf_seq *)buf; in ieee802154_validate_fc_seq() local
45 dbg_print_fs(fs); in ieee802154_validate_fc_seq()
48 if (fs->fc.frame_type == IEEE802154_FRAME_TYPE_RESERVED || in ieee802154_validate_fc_seq()
49 fs->fc.frame_version >= IEEE802154_VERSION_RESERVED) { in ieee802154_validate_fc_seq()
53 if (fs->fc.frame_type == IEEE802154_FRAME_TYPE_MULTIPURPOSE) { in ieee802154_validate_fc_seq()
54 if (fs->fc.frame_version != 0) { in ieee802154_validate_fc_seq()
59 if (fs->fc.frame_version < IEEE802154_VERSION_802154 && in ieee802154_validate_fc_seq()
60 (fs->fc.dst_addr_mode == IEEE802154_ADDR_MODE_RESERVED || in ieee802154_validate_fc_seq()
61 fs->fc.src_addr_mode == IEEE802154_ADDR_MODE_RESERVED || in ieee802154_validate_fc_seq()
62 fs->fc.frame_type >= IEEE802154_FRAME_TYPE_RESERVED)) { in ieee802154_validate_fc_seq()
67 if (fs->fc.frame_type == IEEE802154_FRAME_TYPE_BEACON && in ieee802154_validate_fc_seq()
68 (fs->fc.dst_addr_mode != IEEE802154_ADDR_MODE_NONE || in ieee802154_validate_fc_seq()
69 fs->fc.src_addr_mode == IEEE802154_ADDR_MODE_NONE || fs->fc.pan_id_comp)) { in ieee802154_validate_fc_seq()
72 } else if (fs->fc.frame_type == IEEE802154_FRAME_TYPE_DATA && in ieee802154_validate_fc_seq()
73 fs->fc.dst_addr_mode == IEEE802154_ADDR_MODE_NONE && in ieee802154_validate_fc_seq()
74 fs->fc.src_addr_mode == IEEE802154_ADDR_MODE_NONE) { in ieee802154_validate_fc_seq()
77 } else if (fs->fc.frame_type == IEEE802154_FRAME_TYPE_MAC_COMMAND && fs->fc.frame_pending) { in ieee802154_validate_fc_seq()
83 if (fs->fc.security_enabled) { in ieee802154_validate_fc_seq()
93 return fs; in ieee802154_validate_fc_seq()
242 if (mhr->fs->fc.ar != ack_requested || mhr->fs->fc.pan_id_comp == has_pan_id) { in validate_mac_command_cfi_to_mhr()
246 if (!(BIT(mhr->fs->fc.src_addr_mode) & src_bf) || in validate_mac_command_cfi_to_mhr()
247 !(BIT(mhr->fs->fc.dst_addr_mode) & dst_bf)) { in validate_mac_command_cfi_to_mhr()
312 if (mpdu->mhr.fs->fc.dst_addr_mode == IEEE802154_ADDR_MODE_NONE) { in validate_mac_command()
337 if (mpdu->mhr.fs->fc.dst_addr_mode == IEEE802154_ADDR_MODE_SHORT) { in validate_mac_command()
374 uint8_t type = mpdu->mhr.fs->fc.frame_type; in validate_payload_and_mfr()
418 mpdu->mhr.fs = ieee802154_validate_fc_seq(buf, &p_buf, &length); in ieee802154_validate_frame()
419 if (!mpdu->mhr.fs) { in ieee802154_validate_frame()
424 if (mpdu->mhr.fs->fc.frame_type > IEEE802154_FRAME_TYPE_MAC_COMMAND) { in ieee802154_validate_frame()
428 if (!validate_addr(p_buf, &p_buf, &length, mpdu->mhr.fs->fc.dst_addr_mode, false, in ieee802154_validate_frame()
430 !validate_addr(p_buf, &p_buf, &length, mpdu->mhr.fs->fc.src_addr_mode, in ieee802154_validate_frame()
431 (mpdu->mhr.fs->fc.pan_id_comp), &mpdu->mhr.src_addr)) { in ieee802154_validate_frame()
436 if (mpdu->mhr.fs->fc.security_enabled) { in ieee802154_validate_frame()
520 struct ieee802154_fcf_seq *fs; in generate_fcf_grounds() local
522 fs = (struct ieee802154_fcf_seq *)*p_buf; in generate_fcf_grounds()
524 fs->fc.security_enabled = 0U; in generate_fcf_grounds()
525 fs->fc.frame_pending = 0U; in generate_fcf_grounds()
526 fs->fc.ar = ack_requested; in generate_fcf_grounds()
527 fs->fc.pan_id_comp = 0U; in generate_fcf_grounds()
528 fs->fc.reserved = 0U; in generate_fcf_grounds()
530 fs->fc.seq_num_suppr = 0U; in generate_fcf_grounds()
531 fs->fc.ie_list = 0U; in generate_fcf_grounds()
532 fs->fc.frame_version = IEEE802154_VERSION_802154_2006; in generate_fcf_grounds()
536 return fs; in generate_fcf_grounds()
563 static inline bool data_addr_to_fs_settings(struct net_linkaddr *dst, struct ieee802154_fcf_seq *fs, in data_addr_to_fs_settings() argument
568 fs->fc.dst_addr_mode = get_dst_addr_mode(dst, &broadcast); in data_addr_to_fs_settings()
569 if (fs->fc.dst_addr_mode != IEEE802154_ADDR_MODE_NONE) { in data_addr_to_fs_settings()
570 fs->fc.pan_id_comp = 1U; in data_addr_to_fs_settings()
575 fs->fc.ar = 0U; in data_addr_to_fs_settings()
587 fs->fc.src_addr_mode = IEEE802154_ADDR_MODE_SHORT; in data_addr_to_fs_settings()
589 fs->fc.src_addr_mode = IEEE802154_ADDR_MODE_EXTENDED; in data_addr_to_fs_settings()
596 struct ieee802154_fcf_seq *fs, in generate_addressing_fields() argument
603 if (fs->fc.dst_addr_mode != IEEE802154_ADDR_MODE_NONE) { in generate_addressing_fields()
609 if (fs->fc.dst_addr_mode == IEEE802154_ADDR_MODE_SHORT) { in generate_addressing_fields()
621 if (fs->fc.src_addr_mode == IEEE802154_ADDR_MODE_NONE) { in generate_addressing_fields()
627 if (fs->fc.pan_id_comp) { in generate_addressing_fields()
635 if (fs->fc.src_addr_mode == IEEE802154_ADDR_MODE_SHORT) { in generate_addressing_fields()
676 struct ieee802154_fcf_seq *fs; in ieee802154_create_data_frame() local
684 fs = generate_fcf_grounds(&p_buf, ctx->ack_requested); in ieee802154_create_data_frame()
686 fs->fc.frame_type = IEEE802154_FRAME_TYPE_DATA; in ieee802154_create_data_frame()
687 fs->sequence = ctx->sequence++; in ieee802154_create_data_frame()
709 broadcast = data_addr_to_fs_settings(dst, fs, &params); in ieee802154_create_data_frame()
711 p_buf = generate_addressing_fields(ctx, fs, &params, p_buf); in ieee802154_create_data_frame()
727 fs->fc.security_enabled = 1U; in ieee802154_create_data_frame()
756 dbg_print_fs(fs); in ieee802154_create_data_frame()
767 static inline bool cfi_to_fs_settings(enum ieee802154_cfi cfi, struct ieee802154_fcf_seq *fs, in cfi_to_fs_settings() argument
772 fs->fc.pan_id_comp = 1U; in cfi_to_fs_settings()
776 fs->fc.ar = 1U; in cfi_to_fs_settings()
777 fs->fc.src_addr_mode = IEEE802154_ADDR_MODE_EXTENDED; in cfi_to_fs_settings()
780 fs->fc.dst_addr_mode = IEEE802154_ADDR_MODE_SHORT; in cfi_to_fs_settings()
782 fs->fc.dst_addr_mode = IEEE802154_ADDR_MODE_EXTENDED; in cfi_to_fs_settings()
788 fs->fc.ar = 1U; in cfi_to_fs_settings()
789 fs->fc.pan_id_comp = 1U; in cfi_to_fs_settings()
790 fs->fc.src_addr_mode = IEEE802154_ADDR_MODE_EXTENDED; in cfi_to_fs_settings()
791 fs->fc.dst_addr_mode = IEEE802154_ADDR_MODE_EXTENDED; in cfi_to_fs_settings()
795 fs->fc.ar = 1U; in cfi_to_fs_settings()
800 fs->fc.pan_id_comp = 1U; in cfi_to_fs_settings()
801 fs->fc.src_addr_mode = IEEE802154_ADDR_MODE_EXTENDED; in cfi_to_fs_settings()
802 fs->fc.dst_addr_mode = IEEE802154_ADDR_MODE_SHORT; in cfi_to_fs_settings()
806 fs->fc.src_addr_mode = IEEE802154_ADDR_MODE_NONE; in cfi_to_fs_settings()
807 fs->fc.dst_addr_mode = IEEE802154_ADDR_MODE_SHORT; in cfi_to_fs_settings()
810 fs->fc.src_addr_mode = IEEE802154_ADDR_MODE_EXTENDED; in cfi_to_fs_settings()
815 fs->fc.ar = 1U; in cfi_to_fs_settings()
816 fs->fc.src_addr_mode = IEEE802154_ADDR_MODE_SHORT; in cfi_to_fs_settings()
817 fs->fc.dst_addr_mode = IEEE802154_ADDR_MODE_NONE; in cfi_to_fs_settings()
854 struct ieee802154_fcf_seq *fs; in ieee802154_create_mac_cmd_frame() local
872 fs = generate_fcf_grounds( in ieee802154_create_mac_cmd_frame()
875 fs->fc.frame_type = IEEE802154_FRAME_TYPE_MAC_COMMAND; in ieee802154_create_mac_cmd_frame()
876 fs->sequence = ctx->sequence++; in ieee802154_create_mac_cmd_frame()
878 if (!cfi_to_fs_settings(type, fs, params)) { in ieee802154_create_mac_cmd_frame()
882 p_buf = generate_addressing_fields(ctx, fs, params, p_buf); in ieee802154_create_mac_cmd_frame()
889 dbg_print_fs(fs); in ieee802154_create_mac_cmd_frame()
912 struct ieee802154_fcf_seq *fs; in ieee802154_create_ack_frame() local
918 fs = generate_fcf_grounds(&p_buf, false); in ieee802154_create_ack_frame()
920 fs->fc.dst_addr_mode = IEEE802154_ADDR_MODE_NONE; in ieee802154_create_ack_frame()
921 fs->fc.src_addr_mode = IEEE802154_ADDR_MODE_NONE; in ieee802154_create_ack_frame()
923 fs->fc.frame_type = IEEE802154_FRAME_TYPE_ACK; in ieee802154_create_ack_frame()
924 fs->sequence = seq; in ieee802154_create_ack_frame()
943 if (!mhr->fs->fc.security_enabled) { in ieee802154_decipher_data_frame()
973 if (mhr->fs->fc.src_addr_mode != IEEE802154_ADDR_MODE_EXTENDED) { in ieee802154_decipher_data_frame()
978 src = mhr->fs->fc.pan_id_comp ? &mhr->src_addr->comp.addr : &mhr->src_addr->plain.addr; in ieee802154_decipher_data_frame()