• Ido Schimmel's avatar
    mlxsw: spectrum: Add IEEE 802.1Qbb PFC support · d81a6bdb
    Ido Schimmel authored
    Implement the appropriate DCB ops and allow a user to configure certain
    traffic classes as lossless.
    
    The operation configures PFC for both the egress (respecting PFC frames)
    and ingress (sending PFC frames) parts of the port.
    
    At egress, when a PFC frame is received for a PFC enabled priority, then
    all the priorities mapped to the same TC are stopped.
    
    At ingress, the priority group (PG) buffers to which the enabled PFC
    priorities are mapped are configured to be lossless. PFC frames will be
    transmitted when the Xoff threshold is crossed.
    
    The user-supplied delay parameter is used to determine the PG's size
    according to the following formula:
    
    PG_SIZE = PG_SIZE_LOSSY + delay * CELL_FACTOR + MTU
    
    In the worst case scenario the delay will be made up of packets that
    are all of size CELL_SIZE + 1, which means each packet will require
    almost twice its true size when buffered in the switch. We therefore
    multiply this value by the "cell factor", which is close to 2.
    
    Another MTU is added in case the transmitting host already started
    transmitting a maximum length frame when the PFC packet was received.
    
    As with PAUSE enabled ports, when the port's MTU is changed both the
    PGs' size and threshold are adjusted accordingly.
    Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
    Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    d81a6bdb
spectrum_dcb.c 12.9 KB