• Joakim Zhang's avatar
    net: fec: add FEC_QUIRK_HAS_MULTI_QUEUES represents i.MX6SX ENET IP · 471ff445
    Joakim Zhang authored
    Frieder Schrempf reported a TX throuthput issue [1], it happens quite often
    that the measured bandwidth in TX direction drops from its expected/nominal
    value to something like ~50% (for 100M) or ~67% (for 1G) connections.
    
    [1] https://lore.kernel.org/linux-arm-kernel/421cc86c-b66f-b372-32f7-21e59f9a98bc@kontron.de/
    
    The issue becomes clear after digging into it, Net core would select
    queues when transmitting packets. Since FEC have not impletemented
    ndo_select_queue callback yet, so it will call netdev_pick_tx to select
    queues randomly.
    
    For i.MX6SX ENET IP with AVB support, driver default enables this
    feature. According to the setting of QOS/RCMRn/DMAnCFG registers, AVB
    configured to Credit-based scheme, 50% bandwidth of each queue 1&2.
    
    With below tests let me think more:
    1) With FEC_QUIRK_HAS_AVB quirk, can reproduce TX bandwidth fluctuations issue.
    2) Without FEC_QUIRK_HAS_AVB quirk, can't reproduce TX bandwidth fluctuations issue.
    
    The related difference with or w/o FEC_QUIRK_HAS_AVB quirk is that, whether we
    program FTYPE field of TxBD or not. As I describe above, AVB feature is
    enabled by default. With FEC_QUIRK_HAS_AVB quirk, frames in queue 0
    marked as non-AVB, and frames in queue 1&2 marked as AVB Class A&B. It's
    unreasonable if frames in queue 1&2 are not required to be time-sensitive.
    So when Net core select tx queues ramdomly, Credit-based scheme would work
    and lead to TX bandwidth fluctuated. On the other hand, w/o
    FEC_QUIRK_HAS_AVB quirk, frames in queue 1&2 are all marked as non-AVB, so
    Credit-based scheme would not work.
    
    Till now, how can we fix this TX throughput issue? Yes, please remove
    FEC_QUIRK_HAS_AVB quirk if you suffer it from time-nonsensitive networking.
    However, this quirk is used to indicate i.MX6SX, other setting depends
    on it. So this patch adds a new quirk FEC_QUIRK_HAS_MULTI_QUEUES to
    represent i.MX6SX, it is safe for us remove FEC_QUIRK_HAS_AVB quirk
    now.
    
    FEC_QUIRK_HAS_AVB quirk is set by default in the driver, and users may
    not know much about driver details, they would waste effort to find the
    root cause, that is not we want. The following patch is a implementation
    to fix it and users don't need to modify the driver.
    Tested-by: default avatarFrieder Schrempf <frieder.schrempf@kontron.de>
    Reported-by: default avatarFrieder Schrempf <frieder.schrempf@kontron.de>
    Signed-off-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    471ff445
fec.h 24 KB