• Fugang Duan's avatar
    net: fec: add ndo_select_queue to fix TX bandwidth fluctuations · 52c4a1a8
    Fugang Duan authored
    As we know that AVB is enabled by default, and the ENET IP design is
    queue 0 for best effort, queue 1&2 for AVB Class A&B. Bandwidth of each
    queue 1&2 set in driver is 50%, TX bandwidth fluctuated when selecting
    tx queues randomly with FEC_QUIRK_HAS_AVB quirk available.
    
    This patch adds ndo_select_queue callback to select queues for
    transmitting to fix this issue. It will always return queue 0 if this is
    not a vlan packet, and return queue 1 or 2 based on priority of vlan
    packet.
    
    You may complain that in fact we only use single queue for trasmitting
    if we are not targeted to VLAN. Yes, but seems we have no choice, since
    AVB is enabled when the driver probed, we can't switch this feature
    dynamicly. After compare multiple queues to single queue, TX throughput
    almost no improvement.
    
    One way we can implemet is to configure the driver to multiple queues
    with Round-robin scheme by default. Then add ndo_setup_tc callback to
    enable/disable AVB feature for users. Unfortunately, ENET AVB IP seems
    not follow the standard 802.1Qav spec. We only can program
    DMAnCFG[IDLE_SLOPE] field to calculate bandwidth fraction. And idle
    slope is restricted to certain valus (a total of 19). It's far away from
    CBS QDisc implemented in Linux TC framework. If you strongly suggest to do
    this, I think we only can support limited numbers of bandwidth and reject
    others, but it's really urgly and wried.
    
    With this patch, VLAN tagged packets route to queue 0/1/2 based on vlan
    priority; VLAN untagged packets route to queue 0.
    Tested-by: default avatarFrieder Schrempf <frieder.schrempf@kontron.de>
    Reported-by: default avatarFrieder Schrempf <frieder.schrempf@kontron.de>
    Signed-off-by: default avatarFugang Duan <fugang.duan@nxp.com>
    Signed-off-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
    Reported-by: default avatarkernel test robot <lkp@intel.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    52c4a1a8
fec_main.c 102 KB