• Florian Fainelli's avatar
    net: systemport: Establish lower/upper queue mapping · d1565763
    Florian Fainelli authored
    Establish a queue mapping between the DSA slave network device queues
    created that correspond to switch port queues, and the transmit queue
    that SYSTEMPORT manages.
    
    We need to configure the SYSTEMPORT transmit queue with the switch port number
    and switch port queue number in order for the switch and SYSTEMPORT hardware to
    utilize the out of band congestion notification. This hardware mechanism works
    by looking at the switch port egress queue and determines whether there is
    enough buffers for this queue, with that class of service for a successful
    transmission and if not, backpressures the SYSTEMPORT queue that is being used.
    
    For this to work, we implement a notifier which looks at the
    DSA_PORT_REGISTER event.  When DSA network devices are registered, the
    framework calls the DSA notifiers when that happens, extracts the number
    of queues for these devices and their associated port number, remembers
    that in the driver private structure and linearly maps those queues to
    TX rings/queues that we manage.
    
    This scheme works because DSA slave network deviecs always transmit
    through SYSTEMPORT so when DSA slave network devices are
    destroyed/brought down, the corresponding SYSTEMPORT queues are no
    longer used. Also, by design of the DSA framework, the master network
    device (SYSTEMPORT) is registered first.
    
    For faster lookups we use an array of up to DSA_MAX_PORTS * number of
    queues per port, and then map pointers to bcm_sysport_tx_ring such that
    our ndo_select_queue() implementation can just index into that array to
    locate the corresponding ring index.
    Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    d1565763
bcmsysport.h 22.7 KB