The skb_csum_offload_chk is used to resolve checksums that are unable
to be offloaded to the device.

Signed-off-by: Tom Herbert <t...@herbertland.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_main.c   | 16 ++++++++++++++--
 drivers/net/ethernet/intel/fm10k/fm10k_netdev.c |  5 ++---
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c 
b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
index e76a44c..3c78ea6 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
@@ -827,6 +827,17 @@ err_vxlan:
        return -1;
 }
 
+static const struct skb_csum_offl_spec csum_offl_spec = {
+       .ipv4_okay = 1,
+       .ip_options_okay = 1,
+       .ipv6_okay = 1,
+       .encap_okay = 1,
+       .no_encapped_ipv6 = 1,
+       .vlan_okay = 1,
+       .tcp_okay = 1,
+       .udp_okay = 1,
+};
+
 static void fm10k_tx_csum(struct fm10k_ring *tx_ring,
                          struct fm10k_tx_buffer *first)
 {
@@ -839,11 +850,12 @@ static void fm10k_tx_csum(struct fm10k_ring *tx_ring,
        } network_hdr;
        __be16 protocol;
        u8 l4_hdr = 0;
+       bool csum_encapped;
 
-       if (skb->ip_summed != CHECKSUM_PARTIAL)
+       if (!skb_csum_offload_chk(skb, &csum_offl_spec, &csum_encapped, true))
                goto no_csum;
 
-       if (skb->encapsulation) {
+       if (csum_encapped) {
                protocol = fm10k_tx_encap_offload(skb);
                if (!protocol) {
                        if (skb_checksum_help(skb)) {
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c 
b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
index a340772..b467e2b 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
@@ -1404,8 +1404,7 @@ struct net_device *fm10k_alloc_netdev(void)
        interface->msg_enable = (1 << DEFAULT_DEBUG_LEVEL_SHIFT) - 1;
 
        /* configure default features */
-       dev->features |= NETIF_F_IP_CSUM |
-                        NETIF_F_IPV6_CSUM |
+       dev->features |= NETIF_F_HW_CSUM |
                         NETIF_F_SG |
                         NETIF_F_TSO |
                         NETIF_F_TSO6 |
@@ -1424,7 +1423,7 @@ struct net_device *fm10k_alloc_netdev(void)
        dev->vlan_features |= dev->features;
 
        /* configure tunnel offloads */
-       dev->hw_enc_features |= NETIF_F_IP_CSUM |
+       dev->hw_enc_features |= NETIF_F_HW_CSUM |
                                NETIF_F_TSO |
                                NETIF_F_TSO6 |
                                NETIF_F_TSO_ECN |
-- 
2.4.6

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

Reply via email to