Skip to contentSkip to conversation

security: add statistics definitions and update API

PATCH Superseded Radu Nicolau 4 participants 11 messages Aug 30, 2019 – Sep 19, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 security: add statistics definitions and update API

Update IPsec statistics struct definition, add per SA statistics collection enable flag.

---
 lib/librte_security/rte_security.h | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
lib/librte_security/rte_security.h +18 -2
index 96806e3..8a2ff34 100644
@@ -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
Signature · 1 line
2.7.4
#1 lore raw

lib/librte_security/rte_security.h struct rte_security_macsec_stats { · line 501

Quoted 11 lines · On Fri, 30 Aug 2019 10:19:20 +0100 Radu Nicolau <[email protected]> wrote:

struct rte_security_ipsec_stats {

lib/librte_security/rte_security.h +6 -0
+	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.

#2 lore raw
Quoted 13 lines · Stephen Hemminger
Quoted 10 lines · On Fri, 30 Aug 2019 10:19:20 +0100 Radu Nicolau <[email protected]> wrote:
  
  struct rte_security_ipsec_stats {
lib/librte_security/rte_security.h +6 -0
+	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;
Quoted 3 lines
Quoted 1 line
  };

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.

#3 lore raw

PATCH v2 1/1 security: add statistics definitions and update API

In reply to Radu Nicolau

Update IPsec statistics struct definition, add per SA statistics collection enable flag.

---
v2: added second reserved field

 lib/librte_security/rte_security.h | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)
lib/librte_security/rte_security.h +20 -4
index 96806e3..21bbee2 100644
@@ -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,8 +490,14 @@ struct rte_security_macsec_stats {
 };
 
 struct rte_security_ipsec_stats {
-	uint64_t reserved;
-
+	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 reserved1; /**< Reserved for future use. */
+	uint64_t reserved2; /**< Reserved for future use. */
 };
 
 struct rte_security_pdcp_stats {
@@ -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
Signature · 1 line
2.7.4
#4 lore raw

Hi Radu,

Please see inline.

Thanks,
Anoob

Quoted 26 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Radu Nicolau
Sent: Tuesday, September 3, 2019 3:12 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Radu Nicolau <[email protected]>
Subject: [dpdk-dev] [PATCH v2] security: add statistics definitions and update API

Update IPsec statistics struct definition, add per SA statistics collection enable flag.

---
v2: added second reserved field

 lib/librte_security/rte_security.h | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)
lib/librte_security/rte_security.h +0 -0
index 96806e3..21bbee2 100644

lib/librte_security/rte_security.h struct rte_security_ipsec_sa_options { · line 181

Quoted 10 lines
lib/librte_security/rte_security.h +7 -0
@@ -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.
+	 */

[Anoob] I believe you will have to add the above description after the item. Else the documentation generated could end up wrong. Description of all items of this structure is actually wrong.
https://doc.dpdk.org/api/structrte__security__ipsec__sa__options.html

Quoted 21 lines
lib/librte_security/rte_security.h +1 -0
+	uint32_t stats : 1;
 };
 
 /** IPSec security association direction */ @@ -482,8 +490,14 @@ struct

rte_security_macsec_stats { };

struct rte_security_ipsec_stats {

lib/librte_security/rte_security.h +8 -2
-	uint64_t reserved;
-
+	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 reserved1; /**< Reserved for future use. */
+	uint64_t reserved2; /**< Reserved for future use. */
 };
 
 struct rte_security_pdcp_stats {

lib/librte_security/rte_security.h struct rte_security_stats { · line 526

Quoted 6 lines
lib/librte_security/rte_security.h +3 -0
@@ -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

[Anoob] With NULL as security session, do we expect PMDs to return stats for all sessions or only for the ones 'stats' is enabled?

lib/librte_security/rte_security.h struct rte_security_stats { · line 529

Quoted 6 lines
lib/librte_security/rte_security.h +2 -2
  * @param	stats		statistics
  * @return
- *  - On success return 0
- *  - On failure errno
+ *  - On success, return 0
+ *  - On failure, a negative value

[Anoob] PMDs which doesn't support this would return ENOTSUP, right? Do you think we should document that?

Quoted 5 lines
lib/librte_security/rte_security.h +0 -1
  */
 __rte_experimental
 int
--

2.7.4

#5 lore raw

Hi, replies inline:

Quoted 37 lines · Anoob Joseph

Hi Radu,

Please see inline.

Thanks,
Anoob

Quoted 30 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Radu Nicolau
Sent: Tuesday, September 3, 2019 3:12 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Radu Nicolau <[email protected]>
Subject: [dpdk-dev] [PATCH v2] security: add statistics definitions and update API

Update IPsec statistics struct definition, add per SA statistics collection enable flag.

---
v2: added second reserved field

  lib/librte_security/rte_security.h | 24 ++++++++++++++++++++----
  1 file changed, 20 insertions(+), 4 deletions(-)
lib/librte_security/rte_security.h +1 -0
index 96806e3..21bbee2 100644
@@ -172,6 +172,14 @@ struct rte_security_ipsec_sa_options {
  	 * * 0: Inner/outer header are not modified.
  	 */
  	uint32_t ecn : 1;
+
Quoted 8 lines

lib/librte_security/rte_security.h struct rte_security_ipsec_sa_options { · line 181

Quoted 6 lines
lib/librte_security/rte_security.h +6 -0
+	/**< 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.
+	 */

[Anoob] I believe you will have to add the above description after the item. Else the documentation generated could end up wrong. Description of all items of this structure is actually wrong.
https://doc.dpdk.org/api/structrte__security__ipsec__sa__options.html

It is wrong indeed, I will fix it for the whole struct.

Quoted 20 lines
Quoted 20 lines
lib/librte_security/rte_security.h +1 -0
+	uint32_t stats : 1;
  };
 
  /** IPSec security association direction */ @@ -482,8 +490,14 @@ struct

rte_security_macsec_stats { };

  struct rte_security_ipsec_stats {
lib/librte_security/rte_security.h +8 -2
-	uint64_t reserved;
-
+	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 reserved1; /**< Reserved for future use. */
+	uint64_t reserved2; /**< Reserved for future use. */
  };
Quoted 9 lines

lib/librte_security/rte_security.h struct rte_security_stats { · line 526

Quoted 8 lines
  struct rte_security_pdcp_stats {
lib/librte_security/rte_security.h +3 -0
@@ -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

[Anoob] With NULL as security session, do we expect PMDs to return stats for all sessions or only for the ones 'stats' is enabled?

We expect global stats, not a sum of per session stats, and independent of the per session configuration - that is, if there are 2 sessions and the per seesion stats are enabled for only one, this will still return the global total. I will make a note of this in the doc.

Quoted 8 lines

lib/librte_security/rte_security.h struct rte_security_stats { · line 529

Quoted 7 lines
lib/librte_security/rte_security.h +2 -2
   * @param	stats		statistics
   * @return
- *  - On success return 0
- *  - On failure errno
+ *  - On success, return 0
+ *  - On failure, a negative value

[Anoob] PMDs which doesn't support this would return ENOTSUP, right? Do you think we should document that?

I don't think we need to explicitly document it, as the ENOTSUP is quite self explanatory.

Quoted 6 lines
Quoted 6 lines
lib/librte_security/rte_security.h +0 -1
   */
  __rte_experimental
  int
--

2.7.4

#6 lore raw

Hi Radu,

Please see inline.

Thanks,
Anoob

Quoted 93 lines

-----Original Message-----
From: Nicolau, Radu <[email protected]>
Sent: Tuesday, September 3, 2019 3:44 PM
To: Anoob Joseph <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [EXT] Re: [dpdk-dev] [PATCH v2] security: add statistics definitions and update API

External Email

----------------------------------------------------------------------
Hi, replies inline:

Quoted 36 lines · Anoob Joseph

Hi Radu,

Please see inline.

Thanks,
Anoob

Quoted 29 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Radu Nicolau
Sent: Tuesday, September 3, 2019 3:12 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Radu Nicolau <[email protected]>
Subject: [dpdk-dev] [PATCH v2] security: add statistics definitions and update API

Update IPsec statistics struct definition, add per SA statistics collection enable flag.

---
v2: added second reserved field

  lib/librte_security/rte_security.h | 24 ++++++++++++++++++++----
  1 file changed, 20 insertions(+), 4 deletions(-)
lib/librte_security/rte_security.h +0 -0
index 96806e3..21bbee2 100644
@@ -172,6 +172,14 @@ struct rte_security_ipsec_sa_options {
  	 * * 0: Inner/outer header are not modified.
  	 */
  	uint32_t ecn : 1;
Quoted 8 lines

lib/librte_security/rte_security.h struct rte_security_ipsec_sa_options { · line 181

Quoted 7 lines
lib/librte_security/rte_security.h +7 -0
+
+	/**< 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.
+	 */

[Anoob] I believe you will have to add the above description after the item.

Else the documentation generated could end up wrong. Description of all items of this structure is actually wrong.

Quoted 1 line

https://doc.dpdk.org/api/structrte__security__ipsec__sa__options.html

It is wrong indeed, I will fix it for the whole struct.

Quoted 20 lines
Quoted 20 lines
lib/librte_security/rte_security.h +1 -0
+	uint32_t stats : 1;
  };
 
  /** IPSec security association direction */ @@ -482,8 +490,14 @@

struct rte_security_macsec_stats { };

  struct rte_security_ipsec_stats {
lib/librte_security/rte_security.h +8 -2
-	uint64_t reserved;
-
+	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 reserved1; /**< Reserved for future use. */
+	uint64_t reserved2; /**< Reserved for future use. */
  };
Quoted 9 lines

lib/librte_security/rte_security.h struct rte_security_stats { · line 526

Quoted 8 lines
  struct rte_security_pdcp_stats {
lib/librte_security/rte_security.h +3 -0
@@ -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

[Anoob] With NULL as security session, do we expect PMDs to return stats

Quoted 5 lines

for all sessions or only for the ones 'stats' is enabled?
We expect global stats, not a sum of per session stats, and independent of the per session configuration - that is, if there are 2 sessions and the per seesion stats are enabled for only one, this will still return the global total. I will make a note of this in the doc.

[Anoob] That sounds good.

Quoted 11 lines
Quoted 8 lines

lib/librte_security/rte_security.h struct rte_security_stats { · line 529

Quoted 7 lines
lib/librte_security/rte_security.h +2 -2
   * @param	stats		statistics
   * @return
- *  - On success return 0
- *  - On failure errno
+ *  - On success, return 0
+ *  - On failure, a negative value

[Anoob] PMDs which doesn't support this would return ENOTSUP, right?

Do you think we should document that?
I don't think we need to explicitly document it, as the ENOTSUP is quite self explanatory.

[Anoob] Agreed.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
lib/librte_security/rte_security.h +0 -1
   */
  __rte_experimental
  int
--

2.7.4

#7 lore raw

PATCH v3 1/1 security: add statistics definitions and update API

In reply to Radu Nicolau

Update IPsec statistics struct definition, add per SA statistics collection enable flag.

---
v2: added second reserved field
v3: update doc

 lib/librte_security/rte_security.h | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)
lib/librte_security/rte_security.h +21 -4
index d56907d..2d064f4 100644
@@ -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,8 +490,14 @@ struct rte_security_macsec_stats {
 };
 
 struct rte_security_ipsec_stats {
-	uint64_t reserved;
-
+	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 reserved1; /**< Reserved for future use. */
+	uint64_t reserved2; /**< Reserved for future use. */
 };
 
 struct rte_security_pdcp_stats {
@@ -507,10 +521,13 @@ 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. Global statistics collection is not
+ * dependent on the per session statistics configuration.
  * @param	stats		statistics
  * @return
- *  - On success return 0
- *  - On failure errno
+ *  - On success, return 0
+ *  - On failure, a negative value
  */
 __rte_experimental
 int
Signature · 1 line
2.7.4
Acked-by on v3 1/1
#10 lore raw
In reply to Radu Nicolau
Quoted 12 lines

-----Original Message-----
From: Radu Nicolau <[email protected]>
Sent: Tuesday, September 3, 2019 6:36 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Anoob Joseph <[email protected]>; Radu Nicolau <[email protected]>
Subject: [EXT] [PATCH v3] security: add statistics definitions and update API

External Email

Quoted 8 lines

----------------------------------------------------------------------
Update IPsec statistics struct definition, add per SA statistics collection enable flag.

---
v2: added second reserved field
v3: update doc