diff options
author | Erik Hugne <erik.hugne@ericsson.com> | 2015-02-27 02:56:58 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-02-27 18:18:48 -0500 |
commit | d76a436d50d1ebce352e1815eaea79a254b2b24f (patch) | |
tree | 6d5b3bdd02fd7586b54de631f806e76efcdbfb50 | |
parent | 91e2eb56845a018e5c691acf87137baf05316c4e (diff) |
tipc: make media address offset a common define
With the exception of infiniband media which does not use media
offsets, the media address is always located at offset 4 in the
media info field as defined by the protocol, so we move the
definition to the generic bearer.h
Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/tipc/bearer.h | 1 | ||||
-rw-r--r-- | net/tipc/eth_media.c | 6 |
2 files changed, 3 insertions, 4 deletions
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h index 1a233271d1b5..097aff08ad5b 100644 --- a/net/tipc/bearer.h +++ b/net/tipc/bearer.h | |||
@@ -52,6 +52,7 @@ | |||
52 | */ | 52 | */ |
53 | #define TIPC_MEDIA_INFO_SIZE 32 | 53 | #define TIPC_MEDIA_INFO_SIZE 32 |
54 | #define TIPC_MEDIA_TYPE_OFFSET 3 | 54 | #define TIPC_MEDIA_TYPE_OFFSET 3 |
55 | #define TIPC_MEDIA_ADDR_OFFSET 4 | ||
55 | 56 | ||
56 | /* | 57 | /* |
57 | * Identifiers of supported TIPC media types | 58 | * Identifiers of supported TIPC media types |
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c index 085d3a07e565..f69a2fde9f4a 100644 --- a/net/tipc/eth_media.c +++ b/net/tipc/eth_media.c | |||
@@ -37,8 +37,6 @@ | |||
37 | #include "core.h" | 37 | #include "core.h" |
38 | #include "bearer.h" | 38 | #include "bearer.h" |
39 | 39 | ||
40 | #define ETH_ADDR_OFFSET 4 /* MAC addr position inside address field */ | ||
41 | |||
42 | /* Convert Ethernet address (media address format) to string */ | 40 | /* Convert Ethernet address (media address format) to string */ |
43 | static int tipc_eth_addr2str(struct tipc_media_addr *addr, | 41 | static int tipc_eth_addr2str(struct tipc_media_addr *addr, |
44 | char *strbuf, int bufsz) | 42 | char *strbuf, int bufsz) |
@@ -55,7 +53,7 @@ static int tipc_eth_addr2msg(char *msg, struct tipc_media_addr *addr) | |||
55 | { | 53 | { |
56 | memset(msg, 0, TIPC_MEDIA_INFO_SIZE); | 54 | memset(msg, 0, TIPC_MEDIA_INFO_SIZE); |
57 | msg[TIPC_MEDIA_TYPE_OFFSET] = TIPC_MEDIA_TYPE_ETH; | 55 | msg[TIPC_MEDIA_TYPE_OFFSET] = TIPC_MEDIA_TYPE_ETH; |
58 | memcpy(msg + ETH_ADDR_OFFSET, addr->value, ETH_ALEN); | 56 | memcpy(msg + TIPC_MEDIA_ADDR_OFFSET, addr->value, ETH_ALEN); |
59 | return 0; | 57 | return 0; |
60 | } | 58 | } |
61 | 59 | ||
@@ -79,7 +77,7 @@ static int tipc_eth_msg2addr(struct tipc_bearer *b, | |||
79 | char *msg) | 77 | char *msg) |
80 | { | 78 | { |
81 | /* Skip past preamble: */ | 79 | /* Skip past preamble: */ |
82 | msg += ETH_ADDR_OFFSET; | 80 | msg += TIPC_MEDIA_ADDR_OFFSET; |
83 | return tipc_eth_raw2addr(b, addr, msg); | 81 | return tipc_eth_raw2addr(b, addr, msg); |
84 | } | 82 | } |
85 | 83 | ||