From: Chiqijun chiqijun@huawei.com
driver inclusion category: bugfix bugzilla: 4472
-----------------------------------------------------------------------
OVS does not support the csum offload capability of tunnel packet. If the protocol stack does the csum offloading of tunnel packet, it will cause the packet'csum error; therefore, the csum offload capability of tunnel packet needs to be disabled in SDI mode.
Signed-off-by: Chiqijun chiqijun@huawei.com Reviewed-by: Luoshaokai luoshaokai@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/huawei/hinic/hinic_hw.h | 5 +++++ drivers/net/ethernet/huawei/hinic/hinic_hwdev.h | 3 ++- drivers/net/ethernet/huawei/hinic/hinic_main.c | 16 ++++++++++------ 3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw.h b/drivers/net/ethernet/huawei/hinic/hinic_hw.h index 38c77d0..404be1f 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hw.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_hw.h @@ -325,6 +325,8 @@ enum hinic_func_cap { HINIC_FUNC_SUPP_CHANGE_MAC = 1 << 9, /* OVS don't support SCTP_CRC/HW_VLAN/LRO */ HINIC_FUNC_OFFLOAD_OVS_UNSUPP = 1 << 10, + /* OVS don't support encap-tso/encap-csum */ + HINIC_FUNC_SUPP_ENCAP_TSO_CSUM = 1 << 11, };
#define FUNC_SUPPORT_MGMT(hwdev) \ @@ -363,6 +365,9 @@ enum hinic_func_cap { #define FUNC_SUPPORT_LRO(hwdev) \ (!(hinic_get_func_feature_cap(hwdev) & \ HINIC_FUNC_OFFLOAD_OVS_UNSUPP)) +#define FUNC_SUPPORT_ENCAP_TSO_CSUM(hwdev) \ + (!!(hinic_get_func_feature_cap(hwdev) & \ + HINIC_FUNC_SUPP_ENCAP_TSO_CSUM))
int hinic_init_hwdev(struct hinic_init_para *para); int hinic_set_vf_dev_cap(void *hwdev); diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hwdev.h b/drivers/net/ethernet/huawei/hinic/hinic_hwdev.h index 24391d0..a096f91 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hwdev.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_hwdev.h @@ -198,7 +198,8 @@ struct hinic_heartbeat_enhanced { HINIC_FUNC_SUPP_DFX_REG | \ HINIC_FUNC_SUPP_RX_MODE | \ HINIC_FUNC_SUPP_SET_VF_MAC_VLAN | \ - HINIC_FUNC_SUPP_CHANGE_MAC) + HINIC_FUNC_SUPP_CHANGE_MAC | \ + HINIC_FUNC_SUPP_ENCAP_TSO_CSUM) #define HINIC_MULTI_BM_MASTER (HINIC_FUNC_MGMT | HINIC_FUNC_PORT | \ HINIC_FUNC_SUPP_DFX_REG | \ HINIC_FUNC_SUPP_RX_MODE | \ diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/ethernet/huawei/hinic/hinic_main.c index c036b9e..83af4a8 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c @@ -2243,10 +2243,12 @@ static void netdev_feature_init(struct net_device *netdev)
netdev->vlan_features = netdev->features;
+ if (FUNC_SUPPORT_ENCAP_TSO_CSUM(nic_dev->hwdev)) { #ifdef HAVE_ENCAPSULATION_TSO - netdev->features |= NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM; + netdev->features |= NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM; #endif /* HAVE_ENCAPSULATION_TSO */ + }
if (FUNC_SUPPORT_HW_VLAN(nic_dev->hwdev)) { #if defined(NETIF_F_HW_VLAN_CTAG_TX) @@ -2300,16 +2302,18 @@ static void netdev_feature_init(struct net_device *netdev) netdev->priv_flags |= IFF_UNICAST_FLT; #endif
+ if (FUNC_SUPPORT_ENCAP_TSO_CSUM(nic_dev->hwdev)) { #ifdef HAVE_ENCAPSULATION_CSUM - netdev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM - | NETIF_F_SCTP_CRC | NETIF_F_SG + netdev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM + | NETIF_F_SCTP_CRC | NETIF_F_SG; #ifdef HAVE_ENCAPSULATION_TSO - | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN + netdev->hw_enc_features |= NETIF_F_TSO | NETIF_F_TSO6 + | NETIF_F_TSO_ECN | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_UDP_TUNNEL; - #endif /* HAVE_ENCAPSULATION_TSO */ #endif /* HAVE_ENCAPSULATION_CSUM */ + } }
#define MOD_PARA_VALIDATE_NUM_QPS(nic_dev, num_qps, out_qps) { \