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>
This commit is contained in:
Allan Stephens 2011-10-07 15:19:11 -04:00 committed by Paul Gortmaker
parent 4d163a326f
commit 3d749a6a26
6 changed files with 41 additions and 41 deletions

View file

@ -78,6 +78,8 @@
#define MAX_MSG_SIZE (MAX_H_SIZE + TIPC_MAX_USER_MSG_SIZE)
#define TIPC_MEDIA_ADDR_OFFSET 5
struct tipc_msg {
__be32 hdr[15];
@ -682,6 +684,10 @@ static inline void msg_set_redundant_link(struct tipc_msg *m, u32 r)
msg_set_bits(m, 5, 12, 0x1, r);
}
static inline char *msg_media_addr(struct tipc_msg *m)
{
return (char *)&m->hdr[TIPC_MEDIA_ADDR_OFFSET];
}
/*
* Word 9
@ -734,14 +740,4 @@ int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
u32 num_sect, unsigned int total_len,
int max_size, int usrmem, struct sk_buff **buf);
static inline void msg_set_media_addr(struct tipc_msg *m, struct tipc_media_addr *a)
{
memcpy(&((int *)m)[5], a, sizeof(*a));
}
static inline void msg_get_media_addr(struct tipc_msg *m, struct tipc_media_addr *a)
{
memcpy(a, &((int *)m)[5], sizeof(*a));
}
#endif