Skip to content

Commit 907dbd3

Browse files
Alexei Starovoitovanakryiko
authored andcommitted
selftests/bpf: Remove bpf_assert_eq-like macros.
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 <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Acked-by: Jiri Olsa <[email protected]> Acked-by: Kumar Kartikeya Dwivedi <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 624cd2a commit 907dbd3

File tree

1 file changed

+0
-150
lines changed

1 file changed

+0
-150
lines changed

tools/testing/selftests/bpf/bpf_experimental.h

Lines changed: 0 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -341,156 +341,6 @@ l_true: \
341341
*/
342342
#define bpf_assert_with(cond, value) if (!(cond)) bpf_throw(value);
343343

344-
/* Description
345-
* Assert that LHS is equal to RHS. This statement updates the known value
346-
* of LHS during verification. Note that RHS must be a constant value, and
347-
* must fit within the data type of LHS.
348-
* Returns
349-
* Void.
350-
* Throws
351-
* An exception with the value zero when the assertion fails.
352-
*/
353-
#define bpf_assert_eq(LHS, RHS) \
354-
({ \
355-
barrier_var(LHS); \
356-
__bpf_assert_op(LHS, ==, RHS, 0, true); \
357-
})
358-
359-
/* Description
360-
* Assert that LHS is equal to RHS. This statement updates the known value
361-
* of LHS during verification. Note that RHS must be a constant value, and
362-
* must fit within the data type of LHS.
363-
* Returns
364-
* Void.
365-
* Throws
366-
* An exception with the specified value when the assertion fails.
367-
*/
368-
#define bpf_assert_eq_with(LHS, RHS, value) \
369-
({ \
370-
barrier_var(LHS); \
371-
__bpf_assert_op(LHS, ==, RHS, value, true); \
372-
})
373-
374-
/* Description
375-
* Assert that LHS is less than RHS. This statement updates the known
376-
* bounds of LHS during verification. Note that RHS must be a constant
377-
* value, and must fit within the data type of LHS.
378-
* Returns
379-
* Void.
380-
* Throws
381-
* An exception with the value zero when the assertion fails.
382-
*/
383-
#define bpf_assert_lt(LHS, RHS) \
384-
({ \
385-
barrier_var(LHS); \
386-
__bpf_assert_op(LHS, <, RHS, 0, false); \
387-
})
388-
389-
/* Description
390-
* Assert that LHS is less than RHS. This statement updates the known
391-
* bounds of LHS during verification. Note that RHS must be a constant
392-
* value, and must fit within the data type of LHS.
393-
* Returns
394-
* Void.
395-
* Throws
396-
* An exception with the specified value when the assertion fails.
397-
*/
398-
#define bpf_assert_lt_with(LHS, RHS, value) \
399-
({ \
400-
barrier_var(LHS); \
401-
__bpf_assert_op(LHS, <, RHS, value, false); \
402-
})
403-
404-
/* Description
405-
* Assert that LHS is greater than RHS. This statement updates the known
406-
* bounds of LHS during verification. Note that RHS must be a constant
407-
* value, and must fit within the data type of LHS.
408-
* Returns
409-
* Void.
410-
* Throws
411-
* An exception with the value zero when the assertion fails.
412-
*/
413-
#define bpf_assert_gt(LHS, RHS) \
414-
({ \
415-
barrier_var(LHS); \
416-
__bpf_assert_op(LHS, >, RHS, 0, false); \
417-
})
418-
419-
/* Description
420-
* Assert that LHS is greater than RHS. This statement updates the known
421-
* bounds of LHS during verification. Note that RHS must be a constant
422-
* value, and must fit within the data type of LHS.
423-
* Returns
424-
* Void.
425-
* Throws
426-
* An exception with the specified value when the assertion fails.
427-
*/
428-
#define bpf_assert_gt_with(LHS, RHS, value) \
429-
({ \
430-
barrier_var(LHS); \
431-
__bpf_assert_op(LHS, >, RHS, value, false); \
432-
})
433-
434-
/* Description
435-
* Assert that LHS is less than or equal to RHS. This statement updates the
436-
* known bounds of LHS during verification. Note that RHS must be a
437-
* constant value, and must fit within the data type of LHS.
438-
* Returns
439-
* Void.
440-
* Throws
441-
* An exception with the value zero when the assertion fails.
442-
*/
443-
#define bpf_assert_le(LHS, RHS) \
444-
({ \
445-
barrier_var(LHS); \
446-
__bpf_assert_op(LHS, <=, RHS, 0, false); \
447-
})
448-
449-
/* Description
450-
* Assert that LHS is less than or equal to RHS. This statement updates the
451-
* known bounds of LHS during verification. Note that RHS must be a
452-
* constant value, and must fit within the data type of LHS.
453-
* Returns
454-
* Void.
455-
* Throws
456-
* An exception with the specified value when the assertion fails.
457-
*/
458-
#define bpf_assert_le_with(LHS, RHS, value) \
459-
({ \
460-
barrier_var(LHS); \
461-
__bpf_assert_op(LHS, <=, RHS, value, false); \
462-
})
463-
464-
/* Description
465-
* Assert that LHS is greater than or equal to RHS. This statement updates
466-
* the known bounds of LHS during verification. Note that RHS must be a
467-
* constant value, and must fit within the data type of LHS.
468-
* Returns
469-
* Void.
470-
* Throws
471-
* An exception with the value zero when the assertion fails.
472-
*/
473-
#define bpf_assert_ge(LHS, RHS) \
474-
({ \
475-
barrier_var(LHS); \
476-
__bpf_assert_op(LHS, >=, RHS, 0, false); \
477-
})
478-
479-
/* Description
480-
* Assert that LHS is greater than or equal to RHS. This statement updates
481-
* the known bounds of LHS during verification. Note that RHS must be a
482-
* constant value, and must fit within the data type of LHS.
483-
* Returns
484-
* Void.
485-
* Throws
486-
* An exception with the specified value when the assertion fails.
487-
*/
488-
#define bpf_assert_ge_with(LHS, RHS, value) \
489-
({ \
490-
barrier_var(LHS); \
491-
__bpf_assert_op(LHS, >=, RHS, value, false); \
492-
})
493-
494344
/* Description
495345
* Assert that LHS is in the range [BEG, END] (inclusive of both). This
496346
* statement updates the known bounds of LHS during verification. Note

0 commit comments

Comments
 (0)