This is just a preparation patch for software TSO in the enetc driver.
Unfortunately, ENETC does not support Tx checksum offload which would
normally render TSO, even software, impossible.
Declare NETIF_F_HW_CSUM as part of the feature set and do it at driver
level using skb_csum_hwoffload_help() so that we can move forward and
also add support for TSO in the next patch.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
 {
        struct enetc_ndev_priv *priv = netdev_priv(ndev);
        struct enetc_bdr *tx_ring;
-       int count;
+       int count, err;
 
        /* Queue one-step Sync packet if already locked */
        if (skb->cb[0] & ENETC_F_TX_ONESTEP_SYNC_TSTAMP) {
                return NETDEV_TX_BUSY;
        }
 
+       if (skb->ip_summed == CHECKSUM_PARTIAL) {
+               err = skb_checksum_help(skb);
+               if (err)
+                       goto drop_packet_err;
+       }
+
        enetc_lock_mdio();
        count = enetc_map_tx_buffs(tx_ring, skb);
        enetc_unlock_mdio();
 
 
        ndev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
                            NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
-                           NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_LOOPBACK;
+                           NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_LOOPBACK |
+                           NETIF_F_HW_CSUM;
        ndev->features = NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM |
                         NETIF_F_HW_VLAN_CTAG_TX |
-                        NETIF_F_HW_VLAN_CTAG_RX;
+                        NETIF_F_HW_VLAN_CTAG_RX |
+                        NETIF_F_HW_CSUM;
 
        if (si->num_rss)
                ndev->hw_features |= NETIF_F_RXHASH;
 
 
        ndev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
                            NETIF_F_HW_VLAN_CTAG_TX |
-                           NETIF_F_HW_VLAN_CTAG_RX;
+                           NETIF_F_HW_VLAN_CTAG_RX |
+                           NETIF_F_HW_CSUM;
        ndev->features = NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM |
                         NETIF_F_HW_VLAN_CTAG_TX |
-                        NETIF_F_HW_VLAN_CTAG_RX;
+                        NETIF_F_HW_VLAN_CTAG_RX |
+                        NETIF_F_HW_CSUM;
 
        if (si->num_rss)
                ndev->hw_features |= NETIF_F_RXHASH;