diff options
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 89 |
1 files changed, 53 insertions, 36 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c index da7555fdb4d5..3e78a727f3e6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | |||
@@ -1664,46 +1664,63 @@ static int parse_tunnel_attr(struct mlx5e_priv *priv, | |||
1664 | return err; | 1664 | return err; |
1665 | } | 1665 | } |
1666 | 1666 | ||
1667 | if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_IPV4_ADDRS)) { | 1667 | if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_CONTROL)) { |
1668 | struct flow_match_ipv4_addrs match; | 1668 | struct flow_match_control match; |
1669 | u16 addr_type; | ||
1669 | 1670 | ||
1670 | flow_rule_match_enc_ipv4_addrs(rule, &match); | 1671 | flow_rule_match_enc_control(rule, &match); |
1671 | MLX5_SET(fte_match_set_lyr_2_4, headers_c, | 1672 | addr_type = match.key->addr_type; |
1672 | src_ipv4_src_ipv6.ipv4_layout.ipv4, | ||
1673 | ntohl(match.mask->src)); | ||
1674 | MLX5_SET(fte_match_set_lyr_2_4, headers_v, | ||
1675 | src_ipv4_src_ipv6.ipv4_layout.ipv4, | ||
1676 | ntohl(match.key->src)); | ||
1677 | |||
1678 | MLX5_SET(fte_match_set_lyr_2_4, headers_c, | ||
1679 | dst_ipv4_dst_ipv6.ipv4_layout.ipv4, | ||
1680 | ntohl(match.mask->dst)); | ||
1681 | MLX5_SET(fte_match_set_lyr_2_4, headers_v, | ||
1682 | dst_ipv4_dst_ipv6.ipv4_layout.ipv4, | ||
1683 | ntohl(match.key->dst)); | ||
1684 | |||
1685 | MLX5_SET_TO_ONES(fte_match_set_lyr_2_4, headers_c, ethertype); | ||
1686 | MLX5_SET(fte_match_set_lyr_2_4, headers_v, ethertype, ETH_P_IP); | ||
1687 | } else if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_IPV6_ADDRS)) { | ||
1688 | struct flow_match_ipv6_addrs match; | ||
1689 | 1673 | ||
1690 | flow_rule_match_enc_ipv6_addrs(rule, &match); | 1674 | /* For tunnel addr_type used same key id`s as for non-tunnel */ |
1691 | memcpy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c, | 1675 | if (addr_type == FLOW_DISSECTOR_KEY_IPV4_ADDRS) { |
1692 | src_ipv4_src_ipv6.ipv6_layout.ipv6), | 1676 | struct flow_match_ipv4_addrs match; |
1693 | &match.mask->src, MLX5_FLD_SZ_BYTES(ipv6_layout, ipv6)); | ||
1694 | memcpy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, | ||
1695 | src_ipv4_src_ipv6.ipv6_layout.ipv6), | ||
1696 | &match.key->src, MLX5_FLD_SZ_BYTES(ipv6_layout, ipv6)); | ||
1697 | 1677 | ||
1698 | memcpy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c, | 1678 | flow_rule_match_enc_ipv4_addrs(rule, &match); |
1699 | dst_ipv4_dst_ipv6.ipv6_layout.ipv6), | 1679 | MLX5_SET(fte_match_set_lyr_2_4, headers_c, |
1700 | &match.mask->dst, MLX5_FLD_SZ_BYTES(ipv6_layout, ipv6)); | 1680 | src_ipv4_src_ipv6.ipv4_layout.ipv4, |
1701 | memcpy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, | 1681 | ntohl(match.mask->src)); |
1702 | dst_ipv4_dst_ipv6.ipv6_layout.ipv6), | 1682 | MLX5_SET(fte_match_set_lyr_2_4, headers_v, |
1703 | &match.key->dst, MLX5_FLD_SZ_BYTES(ipv6_layout, ipv6)); | 1683 | src_ipv4_src_ipv6.ipv4_layout.ipv4, |
1684 | ntohl(match.key->src)); | ||
1704 | 1685 | ||
1705 | MLX5_SET_TO_ONES(fte_match_set_lyr_2_4, headers_c, ethertype); | 1686 | MLX5_SET(fte_match_set_lyr_2_4, headers_c, |
1706 | MLX5_SET(fte_match_set_lyr_2_4, headers_v, ethertype, ETH_P_IPV6); | 1687 | dst_ipv4_dst_ipv6.ipv4_layout.ipv4, |
1688 | ntohl(match.mask->dst)); | ||
1689 | MLX5_SET(fte_match_set_lyr_2_4, headers_v, | ||
1690 | dst_ipv4_dst_ipv6.ipv4_layout.ipv4, | ||
1691 | ntohl(match.key->dst)); | ||
1692 | |||
1693 | MLX5_SET_TO_ONES(fte_match_set_lyr_2_4, headers_c, | ||
1694 | ethertype); | ||
1695 | MLX5_SET(fte_match_set_lyr_2_4, headers_v, ethertype, | ||
1696 | ETH_P_IP); | ||
1697 | } else if (addr_type == FLOW_DISSECTOR_KEY_IPV6_ADDRS) { | ||
1698 | struct flow_match_ipv6_addrs match; | ||
1699 | |||
1700 | flow_rule_match_enc_ipv6_addrs(rule, &match); | ||
1701 | memcpy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c, | ||
1702 | src_ipv4_src_ipv6.ipv6_layout.ipv6), | ||
1703 | &match.mask->src, MLX5_FLD_SZ_BYTES(ipv6_layout, | ||
1704 | ipv6)); | ||
1705 | memcpy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, | ||
1706 | src_ipv4_src_ipv6.ipv6_layout.ipv6), | ||
1707 | &match.key->src, MLX5_FLD_SZ_BYTES(ipv6_layout, | ||
1708 | ipv6)); | ||
1709 | |||
1710 | memcpy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c, | ||
1711 | dst_ipv4_dst_ipv6.ipv6_layout.ipv6), | ||
1712 | &match.mask->dst, MLX5_FLD_SZ_BYTES(ipv6_layout, | ||
1713 | ipv6)); | ||
1714 | memcpy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, | ||
1715 | dst_ipv4_dst_ipv6.ipv6_layout.ipv6), | ||
1716 | &match.key->dst, MLX5_FLD_SZ_BYTES(ipv6_layout, | ||
1717 | ipv6)); | ||
1718 | |||
1719 | MLX5_SET_TO_ONES(fte_match_set_lyr_2_4, headers_c, | ||
1720 | ethertype); | ||
1721 | MLX5_SET(fte_match_set_lyr_2_4, headers_v, ethertype, | ||
1722 | ETH_P_IPV6); | ||
1723 | } | ||
1707 | } | 1724 | } |
1708 | 1725 | ||
1709 | if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_IP)) { | 1726 | if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_IP)) { |