aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/bearer.c
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2011-10-07 15:19:11 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2011-12-27 11:33:36 -0500
commit3d749a6a26b0811b4b2bb4ec2c47cd630a6bbf88 (patch)
tree57616bd9e10a70b9146cb46ccd8905ee2a75475d /net/tipc/bearer.c
parent4d163a326fa4868cce1bb75dd95855d40e5497c6 (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/bearer.c')
-rw-r--r--net/tipc/bearer.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 17652f20a359..aa37261626d6 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -108,7 +108,8 @@ int tipc_register_media(struct media *m_ptr)
108 108
109 if (!media_name_valid(m_ptr->name)) 109 if (!media_name_valid(m_ptr->name))
110 goto exit; 110 goto exit;
111 if (m_ptr->bcast_addr.type != htonl(m_ptr->type_id)) 111 if ((m_ptr->bcast_addr.media_id != m_ptr->type_id) ||
112 !m_ptr->bcast_addr.broadcast)
112 goto exit; 113 goto exit;
113 if (m_ptr->priority > TIPC_MAX_LINK_PRI) 114 if (m_ptr->priority > TIPC_MAX_LINK_PRI)
114 goto exit; 115 goto exit;
@@ -138,20 +139,17 @@ void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a)
138{ 139{
139 char addr_str[MAX_ADDR_STR]; 140 char addr_str[MAX_ADDR_STR];
140 struct media *m_ptr; 141 struct media *m_ptr;
141 u32 media_type;
142 142
143 media_type = ntohl(a->type); 143 m_ptr = media_find_id(a->media_id);
144 m_ptr = media_find_id(media_type);
145 144
146 if (m_ptr && !m_ptr->addr2str(a, addr_str, sizeof(addr_str))) 145 if (m_ptr && !m_ptr->addr2str(a, addr_str, sizeof(addr_str)))
147 tipc_printf(pb, "%s(%s)", m_ptr->name, addr_str); 146 tipc_printf(pb, "%s(%s)", m_ptr->name, addr_str);
148 else { 147 else {
149 unchar *addr = (unchar *)&a->dev_addr;
150 u32 i; 148 u32 i;
151 149
152 tipc_printf(pb, "UNKNOWN(%u)", media_type); 150 tipc_printf(pb, "UNKNOWN(%u)", a->media_id);
153 for (i = 0; i < (sizeof(*a) - sizeof(a->type)); i++) 151 for (i = 0; i < sizeof(a->value); i++)
154 tipc_printf(pb, "-%02x", addr[i]); 152 tipc_printf(pb, "-%02x", a->value[i]);
155 } 153 }
156} 154}
157 155