Lines Matching refs:m
116 static inline u32 msg_word(struct tipc_msg *m, u32 pos) in msg_word() argument
118 return ntohl(m->hdr[pos]); in msg_word()
121 static inline void msg_set_word(struct tipc_msg *m, u32 w, u32 val) in msg_set_word() argument
123 m->hdr[w] = htonl(val); in msg_set_word()
126 static inline u32 msg_bits(struct tipc_msg *m, u32 w, u32 pos, u32 mask) in msg_bits() argument
128 return (msg_word(m, w) >> pos) & mask; in msg_bits()
131 static inline void msg_set_bits(struct tipc_msg *m, u32 w, in msg_set_bits() argument
136 m->hdr[w] &= ~htonl(mask); in msg_set_bits()
137 m->hdr[w] |= htonl(val); in msg_set_bits()
151 static inline u32 msg_version(struct tipc_msg *m) in msg_version() argument
153 return msg_bits(m, 0, 29, 7); in msg_version()
156 static inline void msg_set_version(struct tipc_msg *m) in msg_set_version() argument
158 msg_set_bits(m, 0, 29, 7, TIPC_VERSION); in msg_set_version()
161 static inline u32 msg_user(struct tipc_msg *m) in msg_user() argument
163 return msg_bits(m, 0, 25, 0xf); in msg_user()
166 static inline u32 msg_isdata(struct tipc_msg *m) in msg_isdata() argument
168 return msg_user(m) <= TIPC_CRITICAL_IMPORTANCE; in msg_isdata()
171 static inline void msg_set_user(struct tipc_msg *m, u32 n) in msg_set_user() argument
173 msg_set_bits(m, 0, 25, 0xf, n); in msg_set_user()
176 static inline u32 msg_hdr_sz(struct tipc_msg *m) in msg_hdr_sz() argument
178 return msg_bits(m, 0, 21, 0xf) << 2; in msg_hdr_sz()
181 static inline void msg_set_hdr_sz(struct tipc_msg *m, u32 n) in msg_set_hdr_sz() argument
183 msg_set_bits(m, 0, 21, 0xf, n>>2); in msg_set_hdr_sz()
186 static inline u32 msg_size(struct tipc_msg *m) in msg_size() argument
188 return msg_bits(m, 0, 0, 0x1ffff); in msg_size()
191 static inline u32 msg_data_sz(struct tipc_msg *m) in msg_data_sz() argument
193 return msg_size(m) - msg_hdr_sz(m); in msg_data_sz()
196 static inline int msg_non_seq(struct tipc_msg *m) in msg_non_seq() argument
198 return msg_bits(m, 0, 20, 1); in msg_non_seq()
201 static inline void msg_set_non_seq(struct tipc_msg *m, u32 n) in msg_set_non_seq() argument
203 msg_set_bits(m, 0, 20, 1, n); in msg_set_non_seq()
206 static inline int msg_dest_droppable(struct tipc_msg *m) in msg_dest_droppable() argument
208 return msg_bits(m, 0, 19, 1); in msg_dest_droppable()
211 static inline void msg_set_dest_droppable(struct tipc_msg *m, u32 d) in msg_set_dest_droppable() argument
213 msg_set_bits(m, 0, 19, 1, d); in msg_set_dest_droppable()
216 static inline int msg_src_droppable(struct tipc_msg *m) in msg_src_droppable() argument
218 return msg_bits(m, 0, 18, 1); in msg_src_droppable()
221 static inline void msg_set_src_droppable(struct tipc_msg *m, u32 d) in msg_set_src_droppable() argument
223 msg_set_bits(m, 0, 18, 1, d); in msg_set_src_droppable()
226 static inline void msg_set_size(struct tipc_msg *m, u32 sz) in msg_set_size() argument
228 m->hdr[0] = htonl((msg_word(m, 0) & ~0x1ffff) | sz); in msg_set_size()
231 static inline unchar *msg_data(struct tipc_msg *m) in msg_data() argument
233 return ((unchar *)m) + msg_hdr_sz(m); in msg_data()
236 static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m) in msg_get_wrapped() argument
238 return (struct tipc_msg *)msg_data(m); in msg_get_wrapped()
244 static inline u32 msg_type(struct tipc_msg *m) in msg_type() argument
246 return msg_bits(m, 1, 29, 0x7); in msg_type()
249 static inline void msg_set_type(struct tipc_msg *m, u32 n) in msg_set_type() argument
251 msg_set_bits(m, 1, 29, 0x7, n); in msg_set_type()
254 static inline u32 msg_named(struct tipc_msg *m) in msg_named() argument
256 return msg_type(m) == TIPC_NAMED_MSG; in msg_named()
259 static inline u32 msg_mcast(struct tipc_msg *m) in msg_mcast() argument
261 return msg_type(m) == TIPC_MCAST_MSG; in msg_mcast()
264 static inline u32 msg_connected(struct tipc_msg *m) in msg_connected() argument
266 return msg_type(m) == TIPC_CONN_MSG; in msg_connected()
269 static inline u32 msg_errcode(struct tipc_msg *m) in msg_errcode() argument
271 return msg_bits(m, 1, 25, 0xf); in msg_errcode()
274 static inline void msg_set_errcode(struct tipc_msg *m, u32 err) in msg_set_errcode() argument
276 msg_set_bits(m, 1, 25, 0xf, err); in msg_set_errcode()
279 static inline u32 msg_reroute_cnt(struct tipc_msg *m) in msg_reroute_cnt() argument
281 return msg_bits(m, 1, 21, 0xf); in msg_reroute_cnt()
284 static inline void msg_incr_reroute_cnt(struct tipc_msg *m) in msg_incr_reroute_cnt() argument
286 msg_set_bits(m, 1, 21, 0xf, msg_reroute_cnt(m) + 1); in msg_incr_reroute_cnt()
289 static inline void msg_reset_reroute_cnt(struct tipc_msg *m) in msg_reset_reroute_cnt() argument
291 msg_set_bits(m, 1, 21, 0xf, 0); in msg_reset_reroute_cnt()
294 static inline u32 msg_lookup_scope(struct tipc_msg *m) in msg_lookup_scope() argument
296 return msg_bits(m, 1, 19, 0x3); in msg_lookup_scope()
299 static inline void msg_set_lookup_scope(struct tipc_msg *m, u32 n) in msg_set_lookup_scope() argument
301 msg_set_bits(m, 1, 19, 0x3, n); in msg_set_lookup_scope()
304 static inline u16 msg_bcast_ack(struct tipc_msg *m) in msg_bcast_ack() argument
306 return msg_bits(m, 1, 0, 0xffff); in msg_bcast_ack()
309 static inline void msg_set_bcast_ack(struct tipc_msg *m, u16 n) in msg_set_bcast_ack() argument
311 msg_set_bits(m, 1, 0, 0xffff, n); in msg_set_bcast_ack()
318 static inline u16 msg_ack(struct tipc_msg *m) in msg_ack() argument
320 return msg_bits(m, 2, 16, 0xffff); in msg_ack()
323 static inline void msg_set_ack(struct tipc_msg *m, u16 n) in msg_set_ack() argument
325 msg_set_bits(m, 2, 16, 0xffff, n); in msg_set_ack()
328 static inline u16 msg_seqno(struct tipc_msg *m) in msg_seqno() argument
330 return msg_bits(m, 2, 0, 0xffff); in msg_seqno()
333 static inline void msg_set_seqno(struct tipc_msg *m, u16 n) in msg_set_seqno() argument
335 msg_set_bits(m, 2, 0, 0xffff, n); in msg_set_seqno()
341 static inline u32 msg_importance(struct tipc_msg *m) in msg_importance() argument
343 int usr = msg_user(m); in msg_importance()
345 if (likely((usr <= TIPC_CRITICAL_IMPORTANCE) && !msg_errcode(m))) in msg_importance()
348 return msg_bits(m, 9, 0, 0x7); in msg_importance()
352 static inline void msg_set_importance(struct tipc_msg *m, u32 i) in msg_set_importance() argument
354 int usr = msg_user(m); in msg_set_importance()
357 msg_set_bits(m, 9, 0, 0x7, i); in msg_set_importance()
359 msg_set_user(m, i); in msg_set_importance()
364 static inline u32 msg_prevnode(struct tipc_msg *m) in msg_prevnode() argument
366 return msg_word(m, 3); in msg_prevnode()
369 static inline void msg_set_prevnode(struct tipc_msg *m, u32 a) in msg_set_prevnode() argument
371 msg_set_word(m, 3, a); in msg_set_prevnode()
374 static inline u32 msg_origport(struct tipc_msg *m) in msg_origport() argument
376 if (msg_user(m) == MSG_FRAGMENTER) in msg_origport()
377 m = msg_get_wrapped(m); in msg_origport()
378 return msg_word(m, 4); in msg_origport()
381 static inline void msg_set_origport(struct tipc_msg *m, u32 p) in msg_set_origport() argument
383 msg_set_word(m, 4, p); in msg_set_origport()
386 static inline u32 msg_destport(struct tipc_msg *m) in msg_destport() argument
388 return msg_word(m, 5); in msg_destport()
391 static inline void msg_set_destport(struct tipc_msg *m, u32 p) in msg_set_destport() argument
393 msg_set_word(m, 5, p); in msg_set_destport()
396 static inline u32 msg_mc_netid(struct tipc_msg *m) in msg_mc_netid() argument
398 return msg_word(m, 5); in msg_mc_netid()
401 static inline void msg_set_mc_netid(struct tipc_msg *m, u32 p) in msg_set_mc_netid() argument
403 msg_set_word(m, 5, p); in msg_set_mc_netid()
406 static inline int msg_short(struct tipc_msg *m) in msg_short() argument
408 return msg_hdr_sz(m) == SHORT_H_SIZE; in msg_short()
411 static inline u32 msg_orignode(struct tipc_msg *m) in msg_orignode() argument
413 if (likely(msg_short(m))) in msg_orignode()
414 return msg_prevnode(m); in msg_orignode()
415 return msg_word(m, 6); in msg_orignode()
418 static inline void msg_set_orignode(struct tipc_msg *m, u32 a) in msg_set_orignode() argument
420 msg_set_word(m, 6, a); in msg_set_orignode()
423 static inline u32 msg_destnode(struct tipc_msg *m) in msg_destnode() argument
425 return msg_word(m, 7); in msg_destnode()
428 static inline void msg_set_destnode(struct tipc_msg *m, u32 a) in msg_set_destnode() argument
430 msg_set_word(m, 7, a); in msg_set_destnode()
433 static inline u32 msg_nametype(struct tipc_msg *m) in msg_nametype() argument
435 return msg_word(m, 8); in msg_nametype()
438 static inline void msg_set_nametype(struct tipc_msg *m, u32 n) in msg_set_nametype() argument
440 msg_set_word(m, 8, n); in msg_set_nametype()
443 static inline u32 msg_nameinst(struct tipc_msg *m) in msg_nameinst() argument
445 return msg_word(m, 9); in msg_nameinst()
448 static inline u32 msg_namelower(struct tipc_msg *m) in msg_namelower() argument
450 return msg_nameinst(m); in msg_namelower()
453 static inline void msg_set_namelower(struct tipc_msg *m, u32 n) in msg_set_namelower() argument
455 msg_set_word(m, 9, n); in msg_set_namelower()
458 static inline void msg_set_nameinst(struct tipc_msg *m, u32 n) in msg_set_nameinst() argument
460 msg_set_namelower(m, n); in msg_set_nameinst()
463 static inline u32 msg_nameupper(struct tipc_msg *m) in msg_nameupper() argument
465 return msg_word(m, 10); in msg_nameupper()
468 static inline void msg_set_nameupper(struct tipc_msg *m, u32 n) in msg_set_nameupper() argument
470 msg_set_word(m, 10, n); in msg_set_nameupper()
519 static inline u32 msg_seq_gap(struct tipc_msg *m) in msg_seq_gap() argument
521 return msg_bits(m, 1, 16, 0x1fff); in msg_seq_gap()
524 static inline void msg_set_seq_gap(struct tipc_msg *m, u32 n) in msg_set_seq_gap() argument
526 msg_set_bits(m, 1, 16, 0x1fff, n); in msg_set_seq_gap()
529 static inline u32 msg_node_sig(struct tipc_msg *m) in msg_node_sig() argument
531 return msg_bits(m, 1, 0, 0xffff); in msg_node_sig()
534 static inline void msg_set_node_sig(struct tipc_msg *m, u32 n) in msg_set_node_sig() argument
536 msg_set_bits(m, 1, 0, 0xffff, n); in msg_set_node_sig()
539 static inline u32 msg_node_capabilities(struct tipc_msg *m) in msg_node_capabilities() argument
541 return msg_bits(m, 1, 15, 0x1fff); in msg_node_capabilities()
544 static inline void msg_set_node_capabilities(struct tipc_msg *m, u32 n) in msg_set_node_capabilities() argument
546 msg_set_bits(m, 1, 15, 0x1fff, n); in msg_set_node_capabilities()
552 static inline u32 msg_dest_domain(struct tipc_msg *m) in msg_dest_domain() argument
554 return msg_word(m, 2); in msg_dest_domain()
557 static inline void msg_set_dest_domain(struct tipc_msg *m, u32 n) in msg_set_dest_domain() argument
559 msg_set_word(m, 2, n); in msg_set_dest_domain()
562 static inline u32 msg_bcgap_after(struct tipc_msg *m) in msg_bcgap_after() argument
564 return msg_bits(m, 2, 16, 0xffff); in msg_bcgap_after()
567 static inline void msg_set_bcgap_after(struct tipc_msg *m, u32 n) in msg_set_bcgap_after() argument
569 msg_set_bits(m, 2, 16, 0xffff, n); in msg_set_bcgap_after()
572 static inline u32 msg_bcgap_to(struct tipc_msg *m) in msg_bcgap_to() argument
574 return msg_bits(m, 2, 0, 0xffff); in msg_bcgap_to()
577 static inline void msg_set_bcgap_to(struct tipc_msg *m, u32 n) in msg_set_bcgap_to() argument
579 msg_set_bits(m, 2, 0, 0xffff, n); in msg_set_bcgap_to()
586 static inline u32 msg_last_bcast(struct tipc_msg *m) in msg_last_bcast() argument
588 return msg_bits(m, 4, 16, 0xffff); in msg_last_bcast()
591 static inline u32 msg_bc_snd_nxt(struct tipc_msg *m) in msg_bc_snd_nxt() argument
593 return msg_last_bcast(m) + 1; in msg_bc_snd_nxt()
596 static inline void msg_set_last_bcast(struct tipc_msg *m, u32 n) in msg_set_last_bcast() argument
598 msg_set_bits(m, 4, 16, 0xffff, n); in msg_set_last_bcast()
601 static inline void msg_set_fragm_no(struct tipc_msg *m, u32 n) in msg_set_fragm_no() argument
603 msg_set_bits(m, 4, 16, 0xffff, n); in msg_set_fragm_no()
607 static inline u16 msg_next_sent(struct tipc_msg *m) in msg_next_sent() argument
609 return msg_bits(m, 4, 0, 0xffff); in msg_next_sent()
612 static inline void msg_set_next_sent(struct tipc_msg *m, u16 n) in msg_set_next_sent() argument
614 msg_set_bits(m, 4, 0, 0xffff, n); in msg_set_next_sent()
617 static inline void msg_set_long_msgno(struct tipc_msg *m, u32 n) in msg_set_long_msgno() argument
619 msg_set_bits(m, 4, 0, 0xffff, n); in msg_set_long_msgno()
622 static inline u32 msg_bc_netid(struct tipc_msg *m) in msg_bc_netid() argument
624 return msg_word(m, 4); in msg_bc_netid()
627 static inline void msg_set_bc_netid(struct tipc_msg *m, u32 id) in msg_set_bc_netid() argument
629 msg_set_word(m, 4, id); in msg_set_bc_netid()
632 static inline u32 msg_link_selector(struct tipc_msg *m) in msg_link_selector() argument
634 if (msg_user(m) == MSG_FRAGMENTER) in msg_link_selector()
635 m = (void *)msg_data(m); in msg_link_selector()
636 return msg_bits(m, 4, 0, 1); in msg_link_selector()
642 static inline u16 msg_session(struct tipc_msg *m) in msg_session() argument
644 return msg_bits(m, 5, 16, 0xffff); in msg_session()
647 static inline void msg_set_session(struct tipc_msg *m, u16 n) in msg_set_session() argument
649 msg_set_bits(m, 5, 16, 0xffff, n); in msg_set_session()
652 static inline u32 msg_probe(struct tipc_msg *m) in msg_probe() argument
654 return msg_bits(m, 5, 0, 1); in msg_probe()
657 static inline void msg_set_probe(struct tipc_msg *m, u32 val) in msg_set_probe() argument
659 msg_set_bits(m, 5, 0, 1, val); in msg_set_probe()
662 static inline char msg_net_plane(struct tipc_msg *m) in msg_net_plane() argument
664 return msg_bits(m, 5, 1, 7) + 'A'; in msg_net_plane()
667 static inline void msg_set_net_plane(struct tipc_msg *m, char n) in msg_set_net_plane() argument
669 msg_set_bits(m, 5, 1, 7, (n - 'A')); in msg_set_net_plane()
672 static inline u32 msg_linkprio(struct tipc_msg *m) in msg_linkprio() argument
674 return msg_bits(m, 5, 4, 0x1f); in msg_linkprio()
677 static inline void msg_set_linkprio(struct tipc_msg *m, u32 n) in msg_set_linkprio() argument
679 msg_set_bits(m, 5, 4, 0x1f, n); in msg_set_linkprio()
682 static inline u32 msg_bearer_id(struct tipc_msg *m) in msg_bearer_id() argument
684 return msg_bits(m, 5, 9, 0x7); in msg_bearer_id()
687 static inline void msg_set_bearer_id(struct tipc_msg *m, u32 n) in msg_set_bearer_id() argument
689 msg_set_bits(m, 5, 9, 0x7, n); in msg_set_bearer_id()
692 static inline u32 msg_redundant_link(struct tipc_msg *m) in msg_redundant_link() argument
694 return msg_bits(m, 5, 12, 0x1); in msg_redundant_link()
697 static inline void msg_set_redundant_link(struct tipc_msg *m, u32 r) in msg_set_redundant_link() argument
699 msg_set_bits(m, 5, 12, 0x1, r); in msg_set_redundant_link()
702 static inline u32 msg_peer_stopping(struct tipc_msg *m) in msg_peer_stopping() argument
704 return msg_bits(m, 5, 13, 0x1); in msg_peer_stopping()
707 static inline void msg_set_peer_stopping(struct tipc_msg *m, u32 s) in msg_set_peer_stopping() argument
709 msg_set_bits(m, 5, 13, 0x1, s); in msg_set_peer_stopping()
712 static inline bool msg_bc_ack_invalid(struct tipc_msg *m) in msg_bc_ack_invalid() argument
714 switch (msg_user(m)) { in msg_bc_ack_invalid()
718 return msg_bits(m, 5, 14, 0x1); in msg_bc_ack_invalid()
724 static inline void msg_set_bc_ack_invalid(struct tipc_msg *m, bool invalid) in msg_set_bc_ack_invalid() argument
726 msg_set_bits(m, 5, 14, 0x1, invalid); in msg_set_bc_ack_invalid()
729 static inline char *msg_media_addr(struct tipc_msg *m) in msg_media_addr() argument
731 return (char *)&m->hdr[TIPC_MEDIA_INFO_OFFSET]; in msg_media_addr()
734 static inline u32 msg_bc_gap(struct tipc_msg *m) in msg_bc_gap() argument
736 return msg_bits(m, 8, 0, 0x3ff); in msg_bc_gap()
739 static inline void msg_set_bc_gap(struct tipc_msg *m, u32 n) in msg_set_bc_gap() argument
741 msg_set_bits(m, 8, 0, 0x3ff, n); in msg_set_bc_gap()
747 static inline u16 msg_msgcnt(struct tipc_msg *m) in msg_msgcnt() argument
749 return msg_bits(m, 9, 16, 0xffff); in msg_msgcnt()
752 static inline void msg_set_msgcnt(struct tipc_msg *m, u16 n) in msg_set_msgcnt() argument
754 msg_set_bits(m, 9, 16, 0xffff, n); in msg_set_msgcnt()
757 static inline u32 msg_conn_ack(struct tipc_msg *m) in msg_conn_ack() argument
759 return msg_bits(m, 9, 16, 0xffff); in msg_conn_ack()
762 static inline void msg_set_conn_ack(struct tipc_msg *m, u32 n) in msg_set_conn_ack() argument
764 msg_set_bits(m, 9, 16, 0xffff, n); in msg_set_conn_ack()
767 static inline u32 msg_adv_win(struct tipc_msg *m) in msg_adv_win() argument
769 return msg_bits(m, 9, 0, 0xffff); in msg_adv_win()
772 static inline void msg_set_adv_win(struct tipc_msg *m, u32 n) in msg_set_adv_win() argument
774 msg_set_bits(m, 9, 0, 0xffff, n); in msg_set_adv_win()
777 static inline u32 msg_max_pkt(struct tipc_msg *m) in msg_max_pkt() argument
779 return msg_bits(m, 9, 16, 0xffff) * 4; in msg_max_pkt()
782 static inline void msg_set_max_pkt(struct tipc_msg *m, u32 n) in msg_set_max_pkt() argument
784 msg_set_bits(m, 9, 16, 0xffff, (n / 4)); in msg_set_max_pkt()
787 static inline u32 msg_link_tolerance(struct tipc_msg *m) in msg_link_tolerance() argument
789 return msg_bits(m, 9, 0, 0xffff); in msg_link_tolerance()
792 static inline void msg_set_link_tolerance(struct tipc_msg *m, u32 n) in msg_set_link_tolerance() argument
794 msg_set_bits(m, 9, 0, 0xffff, n); in msg_set_link_tolerance()
797 static inline bool msg_peer_link_is_up(struct tipc_msg *m) in msg_peer_link_is_up() argument
799 if (likely(msg_user(m) != LINK_PROTOCOL)) in msg_peer_link_is_up()
801 if (msg_type(m) == STATE_MSG) in msg_peer_link_is_up()
806 static inline bool msg_peer_node_is_up(struct tipc_msg *m) in msg_peer_node_is_up() argument
808 if (msg_peer_link_is_up(m)) in msg_peer_node_is_up()
810 return msg_redundant_link(m); in msg_peer_node_is_up()
821 void tipc_msg_init(u32 own_addr, struct tipc_msg *m, u32 user, u32 type,
831 int tipc_msg_build(struct tipc_msg *mhdr, struct msghdr *m,