Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d76a436d authored by Erik Hugne's avatar Erik Hugne Committed by David S. Miller
Browse files

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: default avatarErik Hugne <erik.hugne@ericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 91e2eb56
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@
 */
#define TIPC_MEDIA_INFO_SIZE	32
#define TIPC_MEDIA_TYPE_OFFSET	3
#define TIPC_MEDIA_ADDR_OFFSET	4

/*
 * Identifiers of supported TIPC media types
+2 −4
Original line number Diff line number Diff line
@@ -37,8 +37,6 @@
#include "core.h"
#include "bearer.h"

#define ETH_ADDR_OFFSET  4  /* MAC addr position inside address field */

/* Convert Ethernet address (media address format) to string */
static int tipc_eth_addr2str(struct tipc_media_addr *addr,
			     char *strbuf, int bufsz)
@@ -55,7 +53,7 @@ static int tipc_eth_addr2msg(char *msg, struct tipc_media_addr *addr)
{
	memset(msg, 0, TIPC_MEDIA_INFO_SIZE);
	msg[TIPC_MEDIA_TYPE_OFFSET] = TIPC_MEDIA_TYPE_ETH;
	memcpy(msg + ETH_ADDR_OFFSET, addr->value, ETH_ALEN);
	memcpy(msg + TIPC_MEDIA_ADDR_OFFSET, addr->value, ETH_ALEN);
	return 0;
}

@@ -79,7 +77,7 @@ static int tipc_eth_msg2addr(struct tipc_bearer *b,
			     char *msg)
{
	/* Skip past preamble: */
	msg += ETH_ADDR_OFFSET;
	msg += TIPC_MEDIA_ADDR_OFFSET;
	return tipc_eth_raw2addr(b, addr, msg);
}