net/mlx5e: HW LRO changes/fixes
authorAchiad Shochat <achiad@mellanox.com>
Sun, 16 Aug 2015 13:04:49 +0000 (16:04 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 Aug 2015 22:51:35 +0000 (15:51 -0700)
- Change the maximum LRO session size from 16KB to 64KB
- Reduce the LRO session timeout from 512us to 32us in
  order to reduce the TCP latency of non-LRO'ed flows.
- Fix skb_shinfo(skb)->gso_size and set skb_shinfo(skb)->gso_type.
- Fix a bug accessing un-initialized mdev pointer.

Signed-off-by: Achiad Shochat <achiad@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx5/core/en.h
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c

index d32a005c601e31a0bd629de3bc91f24055d928d1..298f0bf476a78ed1fc0f993e99729bc09a2bca94 100644 (file)
@@ -50,7 +50,7 @@
 #define MLX5E_PARAMS_DEFAULT_LOG_RQ_SIZE                0xa
 #define MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE                0xd
 
-#define MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ                 (16 * 1024)
+#define MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ                 (64 * 1024)
 #define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC      0x10
 #define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_PKTS      0x20
 #define MLX5E_PARAMS_DEFAULT_TX_CQ_MODERATION_USEC      0x10
index 2b48ff0b1e44d1e90b4bbe6fbf2b760bfcf7fe71..f50a119776de70fa82068800e650a0bb6f5c0919 100644 (file)
@@ -1300,7 +1300,7 @@ static void mlx5e_build_tir_ctx_lro(void *tirc, struct mlx5e_priv *priv)
                  ROUGH_MAX_L2_L3_HDR_SZ) >> 8);
        MLX5_SET(tirc, tirc, lro_timeout_period_usecs,
                 MLX5_CAP_ETH(priv->mdev,
-                             lro_timer_supported_periods[3]));
+                             lro_timer_supported_periods[2]));
 }
 
 static int mlx5e_modify_tir_lro(struct mlx5e_priv *priv, int tt)
@@ -1940,7 +1940,6 @@ static void mlx5e_build_netdev_priv(struct mlx5_core_dev *mdev,
        for (i = 0; i < MLX5E_INDIR_RQT_SIZE; i++)
                priv->params.indirection_rqt[i] = i % num_channels;
 
-       priv->params.lro_en = false && !!MLX5_CAP_ETH(priv->mdev, lro_cap);
        priv->params.lro_wqe_sz            =
                MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ;
 
index 9a9374131f5b45e7c740f80e2ef8b0e9ba175fa9..9bb88f660aca26fd8d5fd5bff700488de7654c78 100644 (file)
@@ -111,10 +111,12 @@ static void mlx5e_lro_update_hdr(struct sk_buff *skb, struct mlx5_cqe64 *cqe)
                tcp = (struct tcphdr *)(skb->data + ETH_HLEN +
                                        sizeof(struct iphdr));
                ipv6 = NULL;
+               skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
        } else {
                tcp = (struct tcphdr *)(skb->data + ETH_HLEN +
                                        sizeof(struct ipv6hdr));
                ipv4 = NULL;
+               skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
        }
 
        if (get_cqe_lro_tcppsh(cqe))
@@ -162,7 +164,7 @@ static inline void mlx5e_build_rx_skb(struct mlx5_cqe64 *cqe,
        lro_num_seg = be32_to_cpu(cqe->srqn) >> 24;
        if (lro_num_seg > 1) {
                mlx5e_lro_update_hdr(skb, cqe);
-               skb_shinfo(skb)->gso_size = MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ;
+               skb_shinfo(skb)->gso_size = DIV_ROUND_UP(cqe_bcnt, lro_num_seg);
                rq->stats.lro_packets++;
                rq->stats.lro_bytes += cqe_bcnt;
        }