diff options
author | Allan Stephens <allan.stephens@windriver.com> | 2011-10-07 15:19:11 -0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2011-12-27 11:33:36 -0500 |
commit | 3d749a6a26b0811b4b2bb4ec2c47cd630a6bbf88 (patch) | |
tree | 57616bd9e10a70b9146cb46ccd8905ee2a75475d /net/tipc/msg.h | |
parent | 4d163a326fa4868cce1bb75dd95855d40e5497c6 (diff) |
tipc: Hide media-specific addressing details from generic bearer code
Reworks TIPC's media address data structure and associated processing
routines to transfer all media-specific details of address conversion
to the associated TIPC media adaptation code. TIPC's generic bearer code
now only needs to know which media type an address is associated with
and whether or not it is a broadcast address, and totally ignores the
"value" field that contains the actual media-specific addressing info.
These changes eliminate the need for a number of endianness conversion
operations and will make it easier for TIPC to support new media types
in the future.
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc/msg.h')
-rw-r--r-- | net/tipc/msg.h | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/net/tipc/msg.h b/net/tipc/msg.h index d93178f2e852..7b0cda167107 100644 --- a/net/tipc/msg.h +++ b/net/tipc/msg.h | |||
@@ -78,6 +78,8 @@ | |||
78 | 78 | ||
79 | #define MAX_MSG_SIZE (MAX_H_SIZE + TIPC_MAX_USER_MSG_SIZE) | 79 | #define MAX_MSG_SIZE (MAX_H_SIZE + TIPC_MAX_USER_MSG_SIZE) |
80 | 80 | ||
81 | #define TIPC_MEDIA_ADDR_OFFSET 5 | ||
82 | |||
81 | 83 | ||
82 | struct tipc_msg { | 84 | struct tipc_msg { |
83 | __be32 hdr[15]; | 85 | __be32 hdr[15]; |
@@ -682,6 +684,10 @@ static inline void msg_set_redundant_link(struct tipc_msg *m, u32 r) | |||
682 | msg_set_bits(m, 5, 12, 0x1, r); | 684 | msg_set_bits(m, 5, 12, 0x1, r); |
683 | } | 685 | } |
684 | 686 | ||
687 | static inline char *msg_media_addr(struct tipc_msg *m) | ||
688 | { | ||
689 | return (char *)&m->hdr[TIPC_MEDIA_ADDR_OFFSET]; | ||
690 | } | ||
685 | 691 | ||
686 | /* | 692 | /* |
687 | * Word 9 | 693 | * Word 9 |
@@ -734,14 +740,4 @@ int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect, | |||
734 | u32 num_sect, unsigned int total_len, | 740 | u32 num_sect, unsigned int total_len, |
735 | int max_size, int usrmem, struct sk_buff **buf); | 741 | int max_size, int usrmem, struct sk_buff **buf); |
736 | 742 | ||
737 | static inline void msg_set_media_addr(struct tipc_msg *m, struct tipc_media_addr *a) | ||
738 | { | ||
739 | memcpy(&((int *)m)[5], a, sizeof(*a)); | ||
740 | } | ||
741 | |||
742 | static inline void msg_get_media_addr(struct tipc_msg *m, struct tipc_media_addr *a) | ||
743 | { | ||
744 | memcpy(a, &((int *)m)[5], sizeof(*a)); | ||
745 | } | ||
746 | |||
747 | #endif | 743 | #endif |