diff mbox

[RFC,6/6] net/faraday: Enable offload checksum according to device-tree

Message ID 1447027806-4744-7-git-send-email-gwshan@linux.vnet.ibm.com
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Gavin Shan Nov. 9, 2015, 12:10 a.m. UTC
This enables IP/UDP/TCP offload checksum according to information
passed on from bootloader through device-tree. The offload doesn't
working properly when the interface works in NCSI mode.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
---
 drivers/net/ethernet/faraday/ftgmac100.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Benjamin Herrenschmidt Nov. 9, 2015, 12:36 a.m. UTC | #1
On Mon, 2015-11-09 at 11:10 +1100, Gavin Shan wrote:
> This enables IP/UDP/TCP offload checksum according to information
> passed on from bootloader through device-tree. The offload doesn't
> working properly when the interface works in NCSI mode.
> 
> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
> ---
>  drivers/net/ethernet/faraday/ftgmac100.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
> index 1b13fd4..1e2f4d2 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.c
> +++ b/drivers/net/ethernet/faraday/ftgmac100.c
> @@ -1377,7 +1377,10 @@ static int ftgmac100_probe(struct platform_device *pdev)
>  
>  > 	> netdev->ethtool_ops = &ftgmac100_ethtool_ops;
>  > 	> netdev->netdev_ops = &ftgmac100_netdev_ops;
> -> 	> netdev->features = NETIF_F_IP_CSUM | NETIF_F_GRO;
> +> 	> netdev->features = NETIF_F_GRO;
> +> 	> if (pdev->dev.of_node &&
> +> 	>     of_property_read_bool(pdev->dev.of_node, "no-hw-checksum"))
> +> 	> 	> netdev->features |= NETIF_F_IP_CSUM;

Am I reading properly that if you put "no-hw-checksum" in the device-
tree you *enable* HW checksum ? This doesn't look right to me...

The logic should be:

	if (pdev->dev.of_node &&
		of_property_read_bool(pdev->dev.of_node, "no-hw-checksum"))
		netdev->features &= ~NETIF_F_IP_CSUM;

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gavin Shan Nov. 9, 2015, 12:45 a.m. UTC | #2
On Mon, Nov 09, 2015 at 11:36:10AM +1100, Benjamin Herrenschmidt wrote:
>On Mon, 2015-11-09 at 11:10 +1100, Gavin Shan wrote:
>> This enables IP/UDP/TCP offload checksum according to information
>> passed on from bootloader through device-tree. The offload doesn't
>> working properly when the interface works in NCSI mode.
>> 
>> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
>> ---
>>  drivers/net/ethernet/faraday/ftgmac100.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
>> index 1b13fd4..1e2f4d2 100644
>> --- a/drivers/net/ethernet/faraday/ftgmac100.c
>> +++ b/drivers/net/ethernet/faraday/ftgmac100.c
>> @@ -1377,7 +1377,10 @@ static int ftgmac100_probe(struct platform_device *pdev)
>>  
>>  > 	> netdev->ethtool_ops = &ftgmac100_ethtool_ops;
>>  > 	> netdev->netdev_ops = &ftgmac100_netdev_ops;
>> -> 	> netdev->features = NETIF_F_IP_CSUM | NETIF_F_GRO;
>> +> 	> netdev->features = NETIF_F_GRO;
>> +> 	> if (pdev->dev.of_node &&
>> +> 	>     of_property_read_bool(pdev->dev.of_node, "no-hw-checksum"))
>> +> 	> 	> netdev->features |= NETIF_F_IP_CSUM;
>
>Am I reading properly that if you put "no-hw-checksum" in the device-
>tree you *enable* HW checksum ? This doesn't look right to me...
>
>The logic should be:
>
>	if (pdev->dev.of_node &&
>		of_property_read_bool(pdev->dev.of_node, "no-hw-checksum"))
>		netdev->features &= ~NETIF_F_IP_CSUM;
>

Thanks, Ben. You're right. This flag affects TCP flows and I didn't test
it with this series of patchset. I'll adjust the code accordingly in next
respin.

Thanks,
Gavin

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 1b13fd4..1e2f4d2 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -1377,7 +1377,10 @@  static int ftgmac100_probe(struct platform_device *pdev)
 
 	netdev->ethtool_ops = &ftgmac100_ethtool_ops;
 	netdev->netdev_ops = &ftgmac100_netdev_ops;
-	netdev->features = NETIF_F_IP_CSUM | NETIF_F_GRO;
+	netdev->features = NETIF_F_GRO;
+	if (pdev->dev.of_node &&
+	    of_property_read_bool(pdev->dev.of_node, "no-hw-checksum"))
+		netdev->features |= NETIF_F_IP_CSUM;
 
 	platform_set_drvdata(pdev, netdev);