diff --git a/drivers/net/ethernet/lantiq/ltq_eth_drv_xrx500.c b/drivers/net/ethernet/lantiq/ltq_eth_drv_xrx500.c index 5beade9b9c7313443325de34dabaa5302c96a161..34573d5aab3afcd67a4fbfadd833eabef0839644 100644 --- a/drivers/net/ethernet/lantiq/ltq_eth_drv_xrx500.c +++ b/drivers/net/ethernet/lantiq/ltq_eth_drv_xrx500.c @@ -119,6 +119,7 @@ static struct net_device *eth_dev[NUM_ETH_INF]; static struct module g_ltq_eth_module[NUM_ETH_INF]; static u32 g_rx_csum_offload; static u32 g_eth_switch_mode; +static struct ltq_net_soc_data g_soc_data; static const struct net_device_ops ltq_eth_drv_ops = { .ndo_init = ltq_switch_init, @@ -1256,11 +1257,15 @@ static int xrx500_of_iface(struct xrx500_hw *hw, struct device_node *iface, NETIF_F_HW_CSUM; hw->devs[hw->num_devs]->gso_max_size = GSO_MAX_SIZE; #else - /* temporary workaround for falcon mountain */ - //hw->devs[hw->num_devs]->features = NETIF_F_SG | NETIF_F_HW_CSUM; - //hw->devs[hw->num_devs]->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM; hw->devs[hw->num_devs]->features = NETIF_F_SG; hw->devs[hw->num_devs]->hw_features = NETIF_F_SG; + if (g_soc_data.hw_checksum) { + hw->devs[hw->num_devs]->features |= NETIF_F_HW_CSUM; + hw->devs[hw->num_devs]->hw_features |= NETIF_F_HW_CSUM; + pr_debug("%s: hw csum offload is enabled!\n", __func__); + } else { + pr_debug("%s: hw csum offload is disable!\n", __func__); + } #endif if (g_rx_csum_offload) { @@ -2100,6 +2105,7 @@ static int ltq_eth_drv_probe(struct platform_device *pdev) if (soc_data->need_defer && !is_xway_gphy_fw_loaded()) return -EPROBE_DEFER; + memcpy(&g_soc_data, soc_data, sizeof(*soc_data)); /* Just do the init */ ltq_eth_drv_init(pdev); register_netdevice_notifier(&netdevice_notifier); @@ -2117,10 +2123,12 @@ static int ltq_eth_drv_remove(struct platform_device *pdev) static const struct ltq_net_soc_data xrx500_net_data = { .need_defer = true, + .hw_checksum = true, }; static const struct ltq_net_soc_data falconmx_net_data = { .need_defer = false, + .hw_checksum = false, }; static const struct of_device_id ltq_eth_drv_match[] = { diff --git a/drivers/net/ethernet/lantiq/ltq_eth_drv_xrx500.h b/drivers/net/ethernet/lantiq/ltq_eth_drv_xrx500.h index d13277fc1405fb86dd6192386333277a8b99d2b9..9e281f9215065a58f0b0e501cf24d642fe090d52 100644 --- a/drivers/net/ethernet/lantiq/ltq_eth_drv_xrx500.h +++ b/drivers/net/ethernet/lantiq/ltq_eth_drv_xrx500.h @@ -119,5 +119,6 @@ extern int g_xway_gphy_fw_loaded; struct ltq_net_soc_data { bool need_defer; + bool hw_checksum; }; #endif /* _LANTIQ_ETH_DRV_H_ */