aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/msg.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/msg.h')
-rw-r--r--net/tipc/msg.h60
1 files changed, 40 insertions, 20 deletions
diff --git a/net/tipc/msg.h b/net/tipc/msg.h
index d5c83d7ecb47..526ef345b70e 100644
--- a/net/tipc/msg.h
+++ b/net/tipc/msg.h
@@ -37,7 +37,7 @@
37#ifndef _TIPC_MSG_H 37#ifndef _TIPC_MSG_H
38#define _TIPC_MSG_H 38#define _TIPC_MSG_H
39 39
40#include "bearer.h" 40#include <linux/tipc.h>
41 41
42/* 42/*
43 * Constants and routines used to read and write TIPC payload message headers 43 * Constants and routines used to read and write TIPC payload message headers
@@ -77,11 +77,37 @@
77 77
78#define TIPC_MEDIA_ADDR_OFFSET 5 78#define TIPC_MEDIA_ADDR_OFFSET 5
79 79
80/**
81 * TIPC message buffer code
82 *
83 * TIPC message buffer headroom reserves space for the worst-case
84 * link-level device header (in case the message is sent off-node).
85 *
86 * Note: Headroom should be a multiple of 4 to ensure the TIPC header fields
87 * are word aligned for quicker access
88 */
89#define BUF_HEADROOM LL_MAX_HEADER
90
91struct tipc_skb_cb {
92 void *handle;
93 struct sk_buff *tail;
94 bool deferred;
95 bool wakeup_pending;
96 bool bundling;
97 u16 chain_sz;
98 u16 chain_imp;
99};
100
101#define TIPC_SKB_CB(__skb) ((struct tipc_skb_cb *)&((__skb)->cb[0]))
80 102
81struct tipc_msg { 103struct tipc_msg {
82 __be32 hdr[15]; 104 __be32 hdr[15];
83}; 105};
84 106
107static inline struct tipc_msg *buf_msg(struct sk_buff *skb)
108{
109 return (struct tipc_msg *)skb->data;
110}
85 111
86static inline u32 msg_word(struct tipc_msg *m, u32 pos) 112static inline u32 msg_word(struct tipc_msg *m, u32 pos)
87{ 113{
@@ -721,27 +747,21 @@ static inline u32 msg_tot_origport(struct tipc_msg *m)
721 return msg_origport(m); 747 return msg_origport(m);
722} 748}
723 749
724bool tipc_msg_reverse(struct sk_buff *buf, u32 *dnode, int err); 750struct sk_buff *tipc_buf_acquire(u32 size);
725 751bool tipc_msg_reverse(struct net *net, struct sk_buff *buf, u32 *dnode,
726int tipc_msg_eval(struct sk_buff *buf, u32 *dnode); 752 int err);
727 753int tipc_msg_eval(struct net *net, struct sk_buff *buf, u32 *dnode);
728void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type, u32 hsize, 754void tipc_msg_init(struct net *net, struct tipc_msg *m, u32 user, u32 type,
729 u32 destnode); 755 u32 hsize, u32 destnode);
730 756struct sk_buff *tipc_msg_create(struct net *net, uint user, uint type,
731struct sk_buff *tipc_msg_create(uint user, uint type, uint hdr_sz, 757 uint hdr_sz, uint data_sz, u32 dnode,
732 uint data_sz, u32 dnode, u32 onode, 758 u32 onode, u32 dport, u32 oport, int errcode);
733 u32 dport, u32 oport, int errcode);
734
735int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf); 759int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf);
736
737bool tipc_msg_bundle(struct sk_buff_head *list, struct sk_buff *skb, u32 mtu); 760bool tipc_msg_bundle(struct sk_buff_head *list, struct sk_buff *skb, u32 mtu);
738 761bool tipc_msg_make_bundle(struct net *net, struct sk_buff_head *list,
739bool tipc_msg_make_bundle(struct sk_buff_head *list, struct sk_buff *skb, 762 struct sk_buff *skb, u32 mtu, u32 dnode);
740 u32 mtu, u32 dnode); 763int tipc_msg_build(struct net *net, struct tipc_msg *mhdr, struct msghdr *m,
741 764 int offset, int dsz, int mtu, struct sk_buff_head *list);
742int tipc_msg_build(struct tipc_msg *mhdr, struct msghdr *m, int offset,
743 int dsz, int mtu, struct sk_buff_head *list);
744
745struct sk_buff *tipc_msg_reassemble(struct sk_buff_head *list); 765struct sk_buff *tipc_msg_reassemble(struct sk_buff_head *list);
746 766
747#endif 767#endif