mlx4: Enable TX checksum offload
authorXiao Jia <stfairy@gmail.com>
Thu, 3 Dec 2015 23:20:00 +0000 (15:20 -0800)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 8 Dec 2015 21:20:21 +0000 (16:20 -0500)
Signed-off-by: Xiao Jia <stfairy@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/drivers/net/mlx4/en_netdev.c
kern/drivers/net/mlx4/en_tx.c

index e660376..94b3088 100644 (file)
@@ -2995,7 +2995,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
                        NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
                        NETIF_F_HW_VLAN_CTAG_FILTER;
 #else
-       dev->feat = NETIF_F_SG;
+       dev->feat = NETIF_F_SG | NETIF_F_IP_CSUM;
 #endif
        dev->hw_features |= NETIF_F_LOOPBACK |
                        NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
index 3fa02a4..3f469e9 100644 (file)
@@ -830,6 +830,12 @@ netdev_tx_t mlx4_send_packet(struct block *block, struct ether *dev)
 
        /* Prepare ctrl segement apart opcode+ownership */
        tx_desc->ctrl.srcrb_flags = priv->ctrl_flags;
+       if (likely(block->flag & BCKSUM_FLAGS)) {
+               if (block->flag & Bipck)
+                       tx_desc->ctrl.srcrb_flags |= cpu_to_be32(MLX4_WQE_CTRL_IP_CSUM);
+               if (block->flag & (Budpck | Btcpck))
+                       tx_desc->ctrl.srcrb_flags |= cpu_to_be32(MLX4_WQE_CTRL_TCP_UDP_CSUM);
+       }
 
        if (priv->flags & MLX4_EN_FLAG_ENABLE_HW_LOOPBACK) {
                struct ethhdr *ethh;