security: add statistics definitions and update API
diff mbox series

Message ID 1567156760-29520-1-git-send-email-radu.nicolau@intel.com
State Superseded, archived
Headers show
Series
  • security: add statistics definitions and update API
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-dpdk_compile success Compile Testing PASS
ci/iol-dpdk_compile_spdk success Compile Testing PASS
ci/iol-dpdk_compile_ovs success Compile Testing PASS
ci/intel-Performance success Performance Testing PASS
ci/mellanox-Performance success Performance Testing PASS

Commit Message

Nicolau, Radu Aug. 30, 2019, 9:19 a.m. UTC
Update IPsec statistics struct definition, add per SA
statistics collection enable flag.

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
 lib/librte_security/rte_security.h | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

Comments

Stephen Hemminger Aug. 30, 2019, 2:33 p.m. UTC | #1
On Fri, 30 Aug 2019 10:19:20 +0100
Radu Nicolau <radu.nicolau@intel.com> wrote:

>  
>  struct rte_security_ipsec_stats {
> +	uint64_t ipackets;  /**< Successfully received IPsec packets. */
> +	uint64_t opackets;  /**< Successfully transmitted IPsec packets.*/
> +	uint64_t ibytes;    /**< Successfully received IPsec bytes. */
> +	uint64_t obytes;    /**< Successfully transmitted IPsec bytes. */
> +	uint64_t ierrors;   /**< IPsec packets receive/decrypt errors. */
> +	uint64_t oerrors;   /**< IPsec packets transmit/encrypt errors. */
>  	uint64_t reserved;
>  
>  };

Why not a second reserved field, then it will be 8*8 64 bytes long
which is cache aligned. And you will have a pair for future counters.
Nicolau, Radu Sept. 2, 2019, 9:20 a.m. UTC | #2
On 8/30/2019 3:33 PM, Stephen Hemminger wrote:
> On Fri, 30 Aug 2019 10:19:20 +0100
> Radu Nicolau <radu.nicolau@intel.com> wrote:
>
>>   
>>   struct rte_security_ipsec_stats {
>> +	uint64_t ipackets;  /**< Successfully received IPsec packets. */
>> +	uint64_t opackets;  /**< Successfully transmitted IPsec packets.*/
>> +	uint64_t ibytes;    /**< Successfully received IPsec bytes. */
>> +	uint64_t obytes;    /**< Successfully transmitted IPsec bytes. */
>> +	uint64_t ierrors;   /**< IPsec packets receive/decrypt errors. */
>> +	uint64_t oerrors;   /**< IPsec packets transmit/encrypt errors. */
>>   	uint64_t reserved;
>>   
>>   };
> Why not a second reserved field, then it will be 8*8 64 bytes long
> which is cache aligned. And you will have a pair for future counters.
Yes, I will add a second reserved field.

Patch
diff mbox series

diff --git a/lib/librte_security/rte_security.h b/lib/librte_security/rte_security.h
index 96806e3..8a2ff34 100644
--- a/lib/librte_security/rte_security.h
+++ b/lib/librte_security/rte_security.h
@@ -172,6 +172,14 @@  struct rte_security_ipsec_sa_options {
 	 * * 0: Inner/outer header are not modified.
 	 */
 	uint32_t ecn : 1;
+
+	/**< Security statistics
+	 *
+	 * * 1: Enable per session security statistics collection for
+	 *      this SA, if supported by the driver.
+	 * * 0: Disable per session security statistics collection for this SA.
+	 */
+	uint32_t stats : 1;
 };
 
 /** IPSec security association direction */
@@ -482,6 +490,12 @@  struct rte_security_macsec_stats {
 };
 
 struct rte_security_ipsec_stats {
+	uint64_t ipackets;  /**< Successfully received IPsec packets. */
+	uint64_t opackets;  /**< Successfully transmitted IPsec packets.*/
+	uint64_t ibytes;    /**< Successfully received IPsec bytes. */
+	uint64_t obytes;    /**< Successfully transmitted IPsec bytes. */
+	uint64_t ierrors;   /**< IPsec packets receive/decrypt errors. */
+	uint64_t oerrors;   /**< IPsec packets transmit/encrypt errors. */
 	uint64_t reserved;
 
 };
@@ -507,10 +521,12 @@  struct rte_security_stats {
  *
  * @param	instance	security instance
  * @param	sess		security session
+ * If security session is NULL then global (per security instance) statistics
+ * will be retrieved, if supported
  * @param	stats		statistics
  * @return
- *  - On success return 0
- *  - On failure errno
+ *  - On success, return 0
+ *  - On failure, a negative value
  */
 __rte_experimental
 int