selftests/bpf: Remove bpf_assert_eq-like macros.
authorAlexei Starovoitov <ast@kernel.org>
Tue, 26 Dec 2023 19:11:46 +0000 (11:11 -0800)
committerAndrii Nakryiko <andrii@kernel.org>
Wed, 3 Jan 2024 19:08:23 +0000 (11:08 -0800)
Since the last user was converted to bpf_cmp, remove bpf_assert_eq/ne/... macros.

__bpf_assert_op() macro is kept for experiments, since it's slightly more efficient
than bpf_assert(bpf_cmp_unlikely()) until LLVM is fixed.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/bpf/20231226191148.48536-5-alexei.starovoitov@gmail.com
tools/testing/selftests/bpf/bpf_experimental.h

index 19ed6c941c1c4b067c24880826f77dcee5203850..2ef9949fbd637e6491f38258f445b349c6e099f1 100644 (file)
@@ -341,156 +341,6 @@ l_true:                                                                                           \
  */
 #define bpf_assert_with(cond, value) if (!(cond)) bpf_throw(value);
 
-/* Description
- *     Assert that LHS is equal to RHS. This statement updates the known value
- *     of LHS during verification. Note that RHS must be a constant value, and
- *     must fit within the data type of LHS.
- * Returns
- *     Void.
- * Throws
- *     An exception with the value zero when the assertion fails.
- */
-#define bpf_assert_eq(LHS, RHS)                                                \
-       ({                                                              \
-               barrier_var(LHS);                                       \
-               __bpf_assert_op(LHS, ==, RHS, 0, true);                 \
-       })
-
-/* Description
- *     Assert that LHS is equal to RHS. This statement updates the known value
- *     of LHS during verification. Note that RHS must be a constant value, and
- *     must fit within the data type of LHS.
- * Returns
- *     Void.
- * Throws
- *     An exception with the specified value when the assertion fails.
- */
-#define bpf_assert_eq_with(LHS, RHS, value)                            \
-       ({                                                              \
-               barrier_var(LHS);                                       \
-               __bpf_assert_op(LHS, ==, RHS, value, true);             \
-       })
-
-/* Description
- *     Assert that LHS is less than RHS. This statement updates the known
- *     bounds of LHS during verification. Note that RHS must be a constant
- *     value, and must fit within the data type of LHS.
- * Returns
- *     Void.
- * Throws
- *     An exception with the value zero when the assertion fails.
- */
-#define bpf_assert_lt(LHS, RHS)                                                \
-       ({                                                              \
-               barrier_var(LHS);                                       \
-               __bpf_assert_op(LHS, <, RHS, 0, false);                 \
-       })
-
-/* Description
- *     Assert that LHS is less than RHS. This statement updates the known
- *     bounds of LHS during verification. Note that RHS must be a constant
- *     value, and must fit within the data type of LHS.
- * Returns
- *     Void.
- * Throws
- *     An exception with the specified value when the assertion fails.
- */
-#define bpf_assert_lt_with(LHS, RHS, value)                            \
-       ({                                                              \
-               barrier_var(LHS);                                       \
-               __bpf_assert_op(LHS, <, RHS, value, false);             \
-       })
-
-/* Description
- *     Assert that LHS is greater than RHS. This statement updates the known
- *     bounds of LHS during verification. Note that RHS must be a constant
- *     value, and must fit within the data type of LHS.
- * Returns
- *     Void.
- * Throws
- *     An exception with the value zero when the assertion fails.
- */
-#define bpf_assert_gt(LHS, RHS)                                                \
-       ({                                                              \
-               barrier_var(LHS);                                       \
-               __bpf_assert_op(LHS, >, RHS, 0, false);                 \
-       })
-
-/* Description
- *     Assert that LHS is greater than RHS. This statement updates the known
- *     bounds of LHS during verification. Note that RHS must be a constant
- *     value, and must fit within the data type of LHS.
- * Returns
- *     Void.
- * Throws
- *     An exception with the specified value when the assertion fails.
- */
-#define bpf_assert_gt_with(LHS, RHS, value)                            \
-       ({                                                              \
-               barrier_var(LHS);                                       \
-               __bpf_assert_op(LHS, >, RHS, value, false);             \
-       })
-
-/* Description
- *     Assert that LHS is less than or equal to RHS. This statement updates the
- *     known bounds of LHS during verification. Note that RHS must be a
- *     constant value, and must fit within the data type of LHS.
- * Returns
- *     Void.
- * Throws
- *     An exception with the value zero when the assertion fails.
- */
-#define bpf_assert_le(LHS, RHS)                                                \
-       ({                                                              \
-               barrier_var(LHS);                                       \
-               __bpf_assert_op(LHS, <=, RHS, 0, false);                \
-       })
-
-/* Description
- *     Assert that LHS is less than or equal to RHS. This statement updates the
- *     known bounds of LHS during verification. Note that RHS must be a
- *     constant value, and must fit within the data type of LHS.
- * Returns
- *     Void.
- * Throws
- *     An exception with the specified value when the assertion fails.
- */
-#define bpf_assert_le_with(LHS, RHS, value)                            \
-       ({                                                              \
-               barrier_var(LHS);                                       \
-               __bpf_assert_op(LHS, <=, RHS, value, false);            \
-       })
-
-/* Description
- *     Assert that LHS is greater than or equal to RHS. This statement updates
- *     the known bounds of LHS during verification. Note that RHS must be a
- *     constant value, and must fit within the data type of LHS.
- * Returns
- *     Void.
- * Throws
- *     An exception with the value zero when the assertion fails.
- */
-#define bpf_assert_ge(LHS, RHS)                                                \
-       ({                                                              \
-               barrier_var(LHS);                                       \
-               __bpf_assert_op(LHS, >=, RHS, 0, false);                \
-       })
-
-/* Description
- *     Assert that LHS is greater than or equal to RHS. This statement updates
- *     the known bounds of LHS during verification. Note that RHS must be a
- *     constant value, and must fit within the data type of LHS.
- * Returns
- *     Void.
- * Throws
- *     An exception with the specified value when the assertion fails.
- */
-#define bpf_assert_ge_with(LHS, RHS, value)                            \
-       ({                                                              \
-               barrier_var(LHS);                                       \
-               __bpf_assert_op(LHS, >=, RHS, value, false);            \
-       })
-
 /* Description
  *     Assert that LHS is in the range [BEG, END] (inclusive of both). This
  *     statement updates the known bounds of LHS during verification. Note