]> git.droids-corp.org - dpdk.git/commitdiff
lib: document free functions
authorStephen Hemminger <stephen@networkplumber.org>
Wed, 22 Jun 2022 20:52:57 +0000 (13:52 -0700)
committerDavid Marchand <david.marchand@redhat.com>
Fri, 24 Jun 2022 12:50:34 +0000 (14:50 +0200)
Make sure all functions which use the convention that XXX_free(NULL)
is a nop are all documented.

The wording is chosen to match the documentation of free(3).
"If ptr is NULL, no operation is performed."

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
[David: squashed with other series updates, unified wording]

21 files changed:
lib/acl/rte_acl.h
lib/bitratestats/rte_bitrate.h
lib/compressdev/rte_comp.h
lib/cryptodev/rte_crypto.h
lib/eal/include/rte_interrupts.h
lib/efd/rte_efd.h
lib/eventdev/rte_event_ring.h
lib/fib/rte_fib.h
lib/fib/rte_fib6.h
lib/lpm/rte_lpm.h
lib/lpm/rte_lpm6.h
lib/member/rte_member.h
lib/pipeline/rte_port_in_action.h
lib/pipeline/rte_swx_ctl.h
lib/pipeline/rte_swx_pipeline.h
lib/reorder/rte_reorder.h
lib/rib/rte_rib.h
lib/rib/rte_rib6.h
lib/sched/rte_sched.h
lib/stack/rte_stack.h
lib/telemetry/rte_telemetry.h

index f7f5f08701226a46d28d73ba7a1db7ba3c2daecc..ca75a6f2208ac6bca9e9099dddc39725fbf0712e 100644 (file)
@@ -165,6 +165,7 @@ rte_acl_find_existing(const char *name);
  *
  * @param ctx
  *   ACL context to free
+ *   If ctx is NULL, no operation is performed.
  */
 void
 rte_acl_free(struct rte_acl_ctx *ctx);
index e494389b95a096f3fab683051d186198f9c4132b..979a712837ac25375a238ee8472dd10866088bb5 100644 (file)
@@ -32,6 +32,7 @@ struct rte_stats_bitrates *rte_stats_bitrate_create(void);
  *
  * @param bitrate_data
  *   Pointer allocated by rte_stats_bitrate_create()
+ *   If bitrate_data is NULL, no operation is performed.
  */
 void rte_stats_bitrate_free(struct rte_stats_bitrates *bitrate_data);
 
index cdb55e5887d3cfccc20412a58ddc546675a8be0d..99a48711e4aec183aa9156aa0dafd4556a84fb0e 100644 (file)
@@ -469,7 +469,8 @@ rte_comp_op_bulk_alloc(struct rte_mempool *mempool,
  * be returned to the mempool.
  *
  * @param op
- *   Compress operation
+ *   Compress operation pointer allocated from rte_comp_op_alloc()
+ *   If op is NULL, no operation is performed.
  */
 __rte_experimental
 void
index aeb3bf6e383ac03a291d21a372e1fc77cff6aaed..6dfca2c169283ac4ce1feeaf0b30f3d0f1fec0a7 100644 (file)
@@ -347,7 +347,9 @@ __rte_crypto_op_get_priv_data(struct rte_crypto_op *op, uint32_t size)
  * If operation has been allocate from a rte_mempool, then the operation will
  * be returned to the mempool.
  *
- * @param      op      symmetric crypto operation
+ * @param op
+ *   Pointer to symmetric crypto operation allocated with rte_crypto_op_alloc()
+ *   If op is NULL, no operation is performed.
  */
 static inline void
 rte_crypto_op_free(struct rte_crypto_op *op)
index 68ad19c3e742bc0bd146b2c4c836a97f13291742..9d1d53f46cbcf2b6bc519786da2fe52ff358f3ad 100644 (file)
@@ -242,7 +242,8 @@ rte_intr_instance_alloc(uint32_t flags);
  * Free the memory allocated for interrupt handle resources.
  *
  * @param intr_handle
- *  Interrupt handle address.
+ *  Interrupt handle allocated with rte_intr_instance_alloc().
+ *  If intr_handle is NULL, no operation is performed.
  *
  */
 __rte_experimental
index d3d7befd0c907ad453869ad0be71ca60263f503a..89cb4a24832c0f1009873f105914177e4e824c54 100644 (file)
@@ -145,7 +145,8 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
  * Releases the resources from an EFD table
  *
  * @param table
- *   Table to free
+ *   Pointer to table allocated with rte_efd_create().
+ *   If table is NULL, no operation is performed.
  */
 void
 rte_efd_free(struct rte_efd_table *table);
index 0101cc0aa232cf770929794dce31c0bcbc09e282..7efa64444b28f977ff3880ba70f531bfebcfcad0 100644 (file)
@@ -234,7 +234,8 @@ rte_event_ring_lookup(const char *name);
  * De-allocate all memory used by the ring.
  *
  * @param r
- *   Ring to free
+ *   Pointer to ring to created with rte_event_ring_create().
+ *   If r is NULL, no operation is performed.
  */
 void
 rte_event_ring_free(struct rte_event_ring *r);
index 90f28b7e11ad789e0654f2b93de6668c8f785770..baa206093cfb123a34661277e494b3f83f087020 100644 (file)
@@ -122,7 +122,8 @@ rte_fib_find_existing(const char *name);
  * Free an FIB object.
  *
  * @param fib
- *   FIB object handle
+ *   FIB object handle created by rte_fib_create().
+ *   If fib is NULL, no operation is performed.
  * @return
  *   None
  */
index 62a425d9afe27ae1435e853ea2ce66b103e4e11f..6fc915b1f34a8574ff9069acd8366aa4799b6324 100644 (file)
@@ -113,7 +113,8 @@ rte_fib6_find_existing(const char *name);
  * Free an FIB object.
  *
  * @param fib
- *   FIB object handle
+ *   FIB object handle created by rte_fib6_create().
+ *   If fib is NULL, no operation is performed.
  * @return
  *   None
  */
index 4f38864fde20bd7250919b6adc38729e3f37d0f4..c8295905e4ce39bdf6bd671179a044c3c7bff56d 100644 (file)
@@ -179,6 +179,7 @@ rte_lpm_find_existing(const char *name);
  *
  * @param lpm
  *   LPM object handle
+ *   If lpm is NULL, no operation is performed.
  * @return
  *   None
  */
index 9b07260d5a7eeb4655f7ed8caedde40438176881..cd9ce17989b9931e76c99b61bd2095aaa0294437 100644 (file)
@@ -72,6 +72,7 @@ rte_lpm6_find_existing(const char *name);
  *
  * @param lpm
  *   LPM object handle
+ *   If lpm is NULL, no operation is performed.
  * @return
  *   None
  */
index 567ee0c84bd9b250b9c4f35b019ea0fefdd5a30b..2611015771910bbe03e0c6db9cf83ab2883be60d 100644 (file)
@@ -443,6 +443,7 @@ rte_member_add(const struct rte_member_setsum *setsum, const void *key,
  *
  * @param setsum
  *   Pointer to the set summary.
+ *   If setsum is NULL, no operation is performed.
  */
 void
 rte_member_free(struct rte_member_setsum *setsum);
index d6b063cf58a71e3e300796728e32f1f07e29bd5e..ec2994599f6195b2a51152d5a47f9cecb77774a5 100644 (file)
@@ -181,8 +181,9 @@ rte_port_in_action_profile_create(uint32_t socket_id);
  *
  * @param[in] profile
  *   Input port action profile handle (needs to be valid).
+ *   If profile is NULL, no operation is performed.
  * @return
- *   Zero on success, non-zero error code otherwise.
+ *   Always zero.
  */
 __rte_experimental
 int
@@ -259,8 +260,9 @@ rte_port_in_action_create(struct rte_port_in_action_profile *profile,
  *
  * @param[in] action
  *   Handle to input port action object (needs to be valid).
+ *   If action is NULL, no operation is performed.
  * @return
- *   Zero on success, non-zero error code otherwise.
+ *   Always zero.
  */
 __rte_experimental
 int
index 689f45e3e7cd54471b3ce245c24acd4c64dd1bbd..d771389d26e30daebf704d075ac20207ca3d45f2 100644 (file)
@@ -1375,6 +1375,7 @@ rte_swx_ctl_meter_stats_read(struct rte_swx_pipeline *p,
  *
  * @param[in] ctl
  *   Pipeline control handle.
+ *   If ctl is NULL, no operation is performed.
  */
 __rte_experimental
 void
index 9299f27094b16cea83aeacea3ffb3d7522e0b52f..c41ca5cb15cf0a2edbddcb8072487d5285928a9c 100644 (file)
@@ -987,6 +987,7 @@ rte_swx_pipeline_run(struct rte_swx_pipeline *p,
  *
  * @param[in] p
  *   Pipeline handle.
+ *   If p is NULL, no operation is performed.
  */
 __rte_experimental
 void
index 9de02403746b2fae2cd1ea3933ffaa73e073d787..f72f07e645a7fdc518a3ec61fe2b05e71242665a 100644 (file)
@@ -114,7 +114,8 @@ rte_reorder_reset(struct rte_reorder_buffer *b);
  * Free reorder buffer instance.
  *
  * @param b
- *   reorder buffer instance
+ *   Pointer to reorder buffer instance.
+ *   If b is NULL, no operation is performed.
  * @return
  *   None
  */
index c18c4ca594c134c8704fed3bd219f5787ab22b44..f41774afe7372311cf62ff00c07d7653bbad0a88 100644 (file)
@@ -263,7 +263,8 @@ rte_rib_find_existing(const char *name);
  * Free an RIB object.
  *
  * @param rib
- *   RIB object handle
+ *   RIB object handle created with rte_rib_create().
+ *   If rib is NULL, no operation is performed.
  * @return
  *   None
  */
index fa8e9bf7327bb1523aa865dbf5d15835b6191f9c..8bd99c4ab53c47208fd3dea0e4b84f1aec9d262c 100644 (file)
@@ -318,7 +318,8 @@ rte_rib6_find_existing(const char *name);
  * Free an RIB object.
  *
  * @param rib
- *   RIB object handle
+ *   RIB object handle created with rte_rib6_create().
+ *   If rib is NULL, no operation is performed.
  * @return
  *   None
  */
index 0bd5b72a4a7a948d9b722a749ff4d5c12fda0fba..a33292b06614fc8cfa22dc488b0bebbd34261fdc 100644 (file)
@@ -328,7 +328,8 @@ rte_sched_port_config(struct rte_sched_port_params *params);
  * Hierarchical scheduler port free
  *
  * @param port
- *   Handle to port scheduler instance
+ *   Handle to port scheduler instance.
+ *   If port is NULL, no operation is performed.
  */
 void
 rte_sched_port_free(struct rte_sched_port *port);
index 91fc5707670f1c907c4f4eaaf68aa8359da4c42c..278a5bd0b0af4ae2862b41f17f9a22216025add4 100644 (file)
@@ -213,7 +213,8 @@ rte_stack_create(const char *name, unsigned int count, int socket_id,
  * Free all memory used by the stack.
  *
  * @param s
- *   Stack to free
+ *   Pointer to stack created with rte_stack_create().
+ *   If s is NULL, no operation is performed.
  */
 void
 rte_stack_free(struct rte_stack *s);
index 3372b32f38b5281789afc23bb9fdc56da2ffb241..d586dd0fc1f04e0d97de7c6ecc0d85cc303d6a3d 100644 (file)
@@ -293,7 +293,7 @@ rte_tel_data_alloc(void);
  *
  * @param data
  *  Pointer to container.
- *.
+ *  If data is NULL, no operation is performed.
  */
 void
 rte_tel_data_free(struct rte_tel_data *data);