• V
    net: mscc: ocelot: convert the VLAN masks to a list · 90e0aa8d
    Vladimir Oltean 提交于
    First and foremost, the driver currently allocates a constant sized
    4K * u32 (16KB memory) array for the VLAN masks. However, a typical
    application might not need so many VLANs, so if we dynamically allocate
    the memory as needed, we might actually save some space.
    
    Secondly, we'll need to keep more advanced bookkeeping of the VLANs we
    have, notably we'll have to check how many untagged and how many tagged
    VLANs we have. This will have to stay in a structure, and allocating
    another 16 KB array for that is again a bit too much.
    
    So refactor the bridge VLANs in a linked list of structures.
    
    The hook points inside the driver are ocelot_vlan_member_add() and
    ocelot_vlan_member_del(), which previously used to operate on the
    ocelot->vlan_mask[vid] array element.
    
    ocelot_vlan_member_add() and ocelot_vlan_member_del() used to call
    ocelot_vlan_member_set() to commit to the ocelot->vlan_mask.
    Additionally, we had two calls to ocelot_vlan_member_set() from outside
    those callers, and those were directly from ocelot_vlan_init().
    Those calls do not set up bridging service VLANs, instead they:
    
    - clear the VLAN table on reset
    - set the port pvid to the value used by this driver for VLAN-unaware
      standalone port operation (VID 0)
    
    So now, when we have a structure which represents actual bridge VLANs,
    VID 0 doesn't belong in that structure, since it is not part of the
    bridging layer.
    
    So delete the middle man, ocelot_vlan_member_set(), and let
    ocelot_vlan_init() call directly ocelot_vlant_set_mask() which forgoes
    any data structure and writes directly to hardware, which is all that we
    need.
    Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    90e0aa8d
ocelot.h 26.7 KB