net/mlx5e: Tx, no inline copy on ConnectX-5
[sfrench/cifs-2.6.git] / drivers / net / ethernet / mellanox / mlx5 / core / en_tx.c
index cfb68371c397e0b19b231ba2730d4d54179d0fd5..f193128bac4b8c18504ec1f5905def3baa5c4633 100644 (file)
@@ -154,6 +154,8 @@ static inline unsigned int mlx5e_calc_min_inline(enum mlx5_inline_modes mode,
        int hlen;
 
        switch (mode) {
+       case MLX5_INLINE_MODE_NONE:
+               return 0;
        case MLX5_INLINE_MODE_TCP_UDP:
                hlen = eth_get_headlen(skb->data, skb_headlen(skb));
                if (hlen == ETH_HLEN && !skb_vlan_tag_present(skb))
@@ -283,21 +285,23 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
 
        wi->num_bytes = num_bytes;
 
-       if (skb_vlan_tag_present(skb)) {
-               mlx5e_insert_vlan(eseg->inline_hdr_start, skb, ihs, &skb_data,
-                                 &skb_len);
-               ihs += VLAN_HLEN;
-       } else {
-               memcpy(eseg->inline_hdr_start, skb_data, ihs);
-               mlx5e_tx_skb_pull_inline(&skb_data, &skb_len, ihs);
+       ds_cnt = sizeof(*wqe) / MLX5_SEND_WQE_DS;
+       if (ihs) {
+               if (skb_vlan_tag_present(skb)) {
+                       mlx5e_insert_vlan(eseg->inline_hdr.start, skb, ihs, &skb_data, &skb_len);
+                       ihs += VLAN_HLEN;
+               } else {
+                       memcpy(eseg->inline_hdr.start, skb_data, ihs);
+                       mlx5e_tx_skb_pull_inline(&skb_data, &skb_len, ihs);
+               }
+               eseg->inline_hdr.sz = cpu_to_be16(ihs);
+               ds_cnt += DIV_ROUND_UP(ihs - sizeof(eseg->inline_hdr.start), MLX5_SEND_WQE_DS);
+       } else if (skb_vlan_tag_present(skb)) {
+               eseg->insert.type = cpu_to_be16(MLX5_ETH_WQE_INSERT_VLAN);
+               eseg->insert.vlan_tci = cpu_to_be16(skb_vlan_tag_get(skb));
        }
 
-       eseg->inline_hdr_sz = cpu_to_be16(ihs);
-
-       ds_cnt  = sizeof(*wqe) / MLX5_SEND_WQE_DS;
-       ds_cnt += DIV_ROUND_UP(ihs - sizeof(eseg->inline_hdr_start),
-                              MLX5_SEND_WQE_DS);
-       dseg    = (struct mlx5_wqe_data_seg *)cseg + ds_cnt;
+       dseg = (struct mlx5_wqe_data_seg *)cseg + ds_cnt;
 
        wi->num_dma = 0;