• Jon Paul Maloy's avatar
    tipc: improve and extend media address conversion functions · 38504c28
    Jon Paul Maloy authored
    TIPC currently handles two media specific addresses: Ethernet MAC
    addresses and InfiniBand addresses. Those are kept in three different
    formats:
    
    1) A "raw" format as obtained from the device. This format is known
       only by the media specific adapter code in eth_media.c and
       ib_media.c.
    2) A "generic" internal format, in the form of struct tipc_media_addr,
       which can be referenced and passed around by the generic media-
       unaware code.
    3) A serialized version of the latter, to be conveyed in neighbor
       discovery messages.
    
    Conversion between the three formats can only be done by the media
    specific code, so we have function pointers for this purpose in
    struct tipc_media. Here, the media adapters can install their own
    conversion functions at startup.
    
    We now introduce a new such function, 'raw2addr()', whose purpose
    is to convert from format 1 to format 2 above. We also try to as far
    as possible uniform commenting, variable names and usage of these
    functions, with the purpose of making them more comprehensible.
    
    We can now also remove the function tipc_l2_media_addr_set(), whose
    job is done better by the new function.
    
    Finally, we expand the field for serialized addresses (format 3)
    in discovery messages from 20 to 32 bytes. This is permitted
    according to the spec, and reduces the risk of problems when we
    add new media in the future.
    Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
    Reviewed-by: default avatarYing Xue <ying.xue@windriver.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    38504c28
eth_media.c 3.68 KB