• Grygorii Strashko's avatar
    net: ethernet: ti: am65-cpsw: fix tx csum offload for multi mac mode · 97067aaf
    Grygorii Strashko authored
    The current implementation uses .ndo_set_features() callback to track
    NETIF_F_HW_CSUM feature changes and update generic
    CPSW_P0_CONTROL_REG.RX_CHECKSUM_EN option accordingly. It's not going to
    work in case of multi-port devices as TX csum offload can be changed per
    netdev.
    
    On K3 CPSWxG devices TX csum offload enabled in the following way:
    
     - the CPSW_P0_CONTROL_REG.RX_CHECKSUM_EN option enables TX csum offload in
    generic and affects all TX DMA channels and packets;
    
     - corresponding fields in TX DMA descriptor have to be filed properly when
    upper layer wants to offload TX csum (skb->ip_summed == CHECKSUM_PARTIAL)
    and it's per-packet option.
    
    The Linux Network core is expected to never request TX csum offload if
    netdev NETIF_F_HW_CSUM feature is disabled, and, as result, TX DMA
    descriptors should not be modified, and per-packet TX csum offload will be
    disabled (or enabled) on per-netdev basis. Which, in turn, makes it safe to
    enable the CPSW_P0_CONTROL_REG.RX_CHECKSUM_EN option unconditionally.
    
    Hence, fix TX csum offload for multi-port devices by:
     - enabling the CPSW_P0_CONTROL_REG.RX_CHECKSUM_EN option in
    am65_cpsw_nuss_common_open() unconditionally
     - and removing .ndo_set_features() callback implementation, which was used
    only NETIF_F_HW_CSUM feature update purposes
    Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
    Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    97067aaf
am65-cpsw-nuss.c 58.9 KB