• Vladimir Oltean's avatar
    net: mscc: ocelot: don't rely on preprocessor for vcap key/action packing · e0632940
    Vladimir Oltean authored
    The IGR_PORT_MASK key width is different between the 11-port VSC7514 and
    the 6-port VSC9959 switches. And since IGR_PORT_MASK is one of the first
    fields of a VCAP key entry, it means that all further field
    offset/length pairs are shifted between the 2.
    
    The ocelot driver performs packing of VCAP half keys with the help of
    some preprocessor macros:
    
    - A set of macros for defining the HKO (Half Key Offset) and HKL (Half
      Key Length) of each possible key field. The offset of each field is
      defined as the sum between the offset and the sum of the previous
      field.
    
    - A set of accessors on top of vcap_key_set for shorter (aka less
      typing) access to the HKO and HKL of each key field.
    
    Since the field offsets and lengths are different between switches,
    defining them through the preprocessor isn't going to fly. So introduce
    a structure holding (offset, length) pairs and instantiate it in
    ocelot_board.c for VSC7514. In a future patch, a similar structure will
    be instantiated in felix_vsc9959.c for NXP LS1028A.
    
    The accessors also need to go. They are based on macro name
    concatenation, which is horrible to understand and follow.
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Tested-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    e0632940
ocelot_vcap.h 4.8 KB