Skip to content

Commit fd7da28

Browse files
ogerlitzdavem330
authored andcommitted
net/mlx5e: Offload TC matching on ip tos / traffic-class
Enable offloading of TC matching on ipv4 tos or ipv6 traffic-class. Signed-off-by: Or Gerlitz <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e77834e commit fd7da28

File tree

1 file changed

+25
-1
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+25
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,8 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
582582
BIT(FLOW_DISSECTOR_KEY_ENC_IPV6_ADDRS) |
583583
BIT(FLOW_DISSECTOR_KEY_ENC_PORTS) |
584584
BIT(FLOW_DISSECTOR_KEY_ENC_CONTROL) |
585-
BIT(FLOW_DISSECTOR_KEY_TCP))) {
585+
BIT(FLOW_DISSECTOR_KEY_TCP) |
586+
BIT(FLOW_DISSECTOR_KEY_IP))) {
586587
netdev_warn(priv->netdev, "Unsupported key used: 0x%x\n",
587588
f->dissector->used_keys);
588589
return -EOPNOTSUPP;
@@ -809,6 +810,29 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
809810
*min_inline = MLX5_INLINE_MODE_TCP_UDP;
810811
}
811812

813+
if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_IP)) {
814+
struct flow_dissector_key_ip *key =
815+
skb_flow_dissector_target(f->dissector,
816+
FLOW_DISSECTOR_KEY_IP,
817+
f->key);
818+
struct flow_dissector_key_ip *mask =
819+
skb_flow_dissector_target(f->dissector,
820+
FLOW_DISSECTOR_KEY_IP,
821+
f->mask);
822+
823+
MLX5_SET(fte_match_set_lyr_2_4, headers_c, ip_ecn, mask->tos & 0x3);
824+
MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_ecn, key->tos & 0x3);
825+
826+
MLX5_SET(fte_match_set_lyr_2_4, headers_c, ip_dscp, mask->tos >> 2);
827+
MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_dscp, key->tos >> 2);
828+
829+
if (mask->tos)
830+
*min_inline = MLX5_INLINE_MODE_IP;
831+
832+
if (mask->ttl) /* currently not supported */
833+
return -EOPNOTSUPP;
834+
}
835+
812836
if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_TCP)) {
813837
struct flow_dissector_key_tcp *key =
814838
skb_flow_dissector_target(f->dissector,

0 commit comments

Comments
 (0)