From: Anoob Joseph <hidden> Date: 2018-02-21 05:38:30
This series enables application to set the sequence number soft limit
for IPsec offload. In inline IPsec offload, as the sequence number
(maintained by PMD/device) reaches the specified soft limit, the PMD
would raise an "IPSEC_EVENT". This event would have some metadata,
which would be used by the application to identify the SA on which the
sequence number overflow is about to happen.
Anoob Joseph (5):
lib/ethdev: support for inline IPsec events
lib/security: add ESN soft limit in conf
lib/security: extend userdata for IPsec events
examples/ipsec-secgw: handle ESN soft limit event
app/testpmd: support for IPsec event
app/test-pmd/parameters.c | 2 ++
app/test-pmd/testpmd.c | 2 ++
examples/ipsec-secgw/ipsec-secgw.c | 56 +++++++++++++++++++++++++++++++
examples/ipsec-secgw/ipsec.c | 10 ++++--
examples/ipsec-secgw/ipsec.h | 2 ++
lib/librte_ether/rte_ethdev.h | 22 ++++++++++++
lib/librte_security/rte_security.h | 16 +++++----
lib/librte_security/rte_security_driver.h | 6 ++--
8 files changed, 104 insertions(+), 12 deletions(-)
--
2.7.4
From: Anoob Joseph <hidden> Date: 2018-02-21 05:38:36
Adding support for IPsec events in rte_eth_event framework. In inline
IPsec offload, the per packet protocol defined variables, like ESN,
would be managed by PMD. In such cases, PMD would need IPsec events
to notify application about various conditions like, ESN overflow.
Signed-off-by: Anoob Joseph <redacted>
---
lib/librte_ether/rte_ethdev.h | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
@@ -2438,6 +2438,27 @@ intrte_eth_tx_done_cleanup(uint16_tport_id,uint16_tqueue_id,uint32_tfree_cnt);/**+*SubtypesforIPsecoffloadeventsraisedbyethdevice.+*/+enumrte_eth_event_ipsec_subtype{+RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW,+/** Sequence number overflow in security offload */+RTE_ETH_EVENT_IPSEC_MAX+/** Max value of this enum */+};++/**+*DescriptorforIPsecevent.Usedbyethdevtosendextrainformationofthe+*event.+*/+structrte_eth_event_ipsec_desc{+enumrte_eth_event_ipsec_subtypestype;+/** Type of IPsec event */+uint64_tmd;+/** Event specific metadata */+};++/***Theethdeviceeventtypeforinterrupt,andmaybeothersinthefuture.*/enumrte_eth_event_type{
@@ -2448,6 +2469,7 @@ enum rte_eth_event_type {RTE_ETH_EVENT_INTR_RESET,/**< reset interrupt event, sent to VF on PF reset */RTE_ETH_EVENT_VF_MBOX,/**< message from the VF received by PF */+RTE_ETH_EVENT_IPSEC,/**< IPsec offload related event */RTE_ETH_EVENT_MACSEC,/**< MACsec offload related event */RTE_ETH_EVENT_INTR_RMV,/**< device removal event */RTE_ETH_EVENT_NEW,/**< port is probed */
From: Anoob Joseph <hidden> Date: 2018-02-21 05:38:40
Adding ESN soft limit in conf. This will be used in case of protocol
offload. Per SA, application could specify for what ESN the security
device need to notify application. In case of eth dev(inline protocol),
rte_eth_event framework would raise an IPsec event.
Signed-off-by: Anoob Joseph <redacted>
---
lib/librte_security/rte_security.h | 2 ++
1 file changed, 2 insertions(+)
@@ -222,6 +222,8 @@ struct rte_security_ipsec_xform {/**< IPsec SA Mode - transport/tunnel */structrte_security_ipsec_tunnel_paramtunnel;/**< Tunnel parameters, NULL for transport mode */+uint64_tesn_soft_limit;+/**< ESN for which the overflow event need to be raised by eth dev */};/**
From: Anoob Joseph <hidden> Date: 2018-02-21 05:38:45
Extending 'userdata' to be used for IPsec events too.
IPsec events would have some metadata which would uniquely identify the
security session for which the event is raised. But application would
need some construct which it can understand. The 'userdata' solves a
similar problem for inline processed inbound traffic. Updating the
documentation to extend the usage of 'userdata'.
Signed-off-by: Anoob Joseph <redacted>
---
lib/librte_security/rte_security.h | 14 ++++++++------
lib/librte_security/rte_security_driver.h | 6 +++---
2 files changed, 11 insertions(+), 9 deletions(-)
From: Anoob Joseph <hidden> Date: 2018-02-21 05:38:49
For inline protocol processing, the PMD/device is required to maintain
the ESN. But the application is required to monitor ESN overflow to
initiate SA expiry.
For such cases, application would set the ESN soft limit. An IPsec event
would be raised by rte_eth_event framework, when ESN hits the soft limit
set by the application.
Signed-off-by: Anoob Joseph <redacted>
---
examples/ipsec-secgw/ipsec-secgw.c | 56 ++++++++++++++++++++++++++++++++++++++
examples/ipsec-secgw/ipsec.c | 10 +++++--
examples/ipsec-secgw/ipsec.h | 2 ++
3 files changed, 65 insertions(+), 3 deletions(-)
@@ -1640,6 +1641,58 @@ pool_init(struct socket_ctx *ctx, int32_t socket_id, uint32_t nb_mbuf)printf("Allocated mbuf pool on socket %d\n",socket_id);}+staticinlineint+inline_ipsec_event_esn_overflow(structrte_security_ctx*ctx,uint64_tmd)+{+structipsec_sa*sa;++/* For inline protocol processing, the metadata in the event will+*uniquelyidentifythesecuritysessionwhichraisedtheevent.+*Applicationwouldthenneedtheuserdataithadregisteredwiththe+*securitysessiontoprocesstheevent.+*/++sa=(structipsec_sa*)rte_security_get_userdata(ctx,md);++if(sa==NULL){+/* userdata could not be retrieved */+return-1;+}++/* Sequence number over flow. SA need to be re-established */+RTE_SET_USED(sa);+return0;+}++staticint+inline_ipsec_event_callback(uint16_tport_id,enumrte_eth_event_typetype,+void*param,void*ret_param)+{+structrte_eth_event_ipsec_desc*event_desc=NULL;+structrte_security_ctx*ctx=(structrte_security_ctx*)+rte_eth_dev_get_sec_ctx(port_id);++RTE_SET_USED(param);++if(type!=RTE_ETH_EVENT_IPSEC)+return-1;++event_desc=ret_param;+if(event_desc==NULL){+printf("Event descriptor not set\n");+return-1;+}++if(event_desc->stype==RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW)+returninline_ipsec_event_esn_overflow(ctx,event_desc->md);+elseif(event_desc->stype>=RTE_ETH_EVENT_IPSEC_MAX){+printf("Invalid IPsec event reported\n");+return-1;+}++return-1;+}+int32_tmain(int32_targc,char**argv){
@@ -36,6 +36,7 @@ set_ipsec_conf(struct ipsec_sa *sa, struct rte_security_ipsec_xform *ipsec)}/* TODO support for Transport and IPV6 tunnel */}+ipsec->esn_soft_limit=IPSEC_OFFLOAD_ESN_SOFTLIMIT;}staticinlineint
From: Nicolau, Radu <hidden> Date: 2018-02-26 09:35:56
quoted hunk
-----Original Message-----
From: Anoob Joseph [mailto:anoob.joseph@caviumnetworks.com]
Sent: Wednesday, February 21, 2018 5:37 AM
To: Akhil Goyal <redacted>; Doherty, Declan
[off-list ref]; Nicolau, Radu [off-list ref]
Cc: Anoob Joseph <redacted>; Jerin Jacob
[off-list ref]; Narayana Prasad
[off-list ref]; Nelio Laranjeiro
[off-list ref]; dev@dpdk.org
Subject: [PATCH 1/5] lib/ethdev: support for inline IPsec events
Adding support for IPsec events in rte_eth_event framework. In inline IPsec
offload, the per packet protocol defined variables, like ESN, would be
managed by PMD. In such cases, PMD would need IPsec events to notify
application about various conditions like, ESN overflow.
Signed-off-by: Anoob Joseph <redacted>
---
lib/librte_ether/rte_ethdev.h | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
free_cnt);
/**
+ * Subtypes for IPsec offload events raised by eth device.
+ */
+enum rte_eth_event_ipsec_subtype {
+ RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW,
+ /** Sequence number overflow in security offload */
+ RTE_ETH_EVENT_IPSEC_MAX
+ /** Max value of this enum */
+};
I would add some more events to the list (to make it look less like a very specific case implementation): crypto/auth failed and undefined/unspecified being the most obvious.
Apart from this, the patchset looks fine.
quoted hunk
+
+/**
+ * Descriptor for IPsec event. Used by eth dev to send extra
+information of the
+ * event.
+ */
+struct rte_eth_event_ipsec_desc {
+ enum rte_eth_event_ipsec_subtype stype;
+ /** Type of IPsec event */
+ uint64_t md;
+ /** Event specific metadata */
+};
+
+/**
* The eth device event type for interrupt, and maybe others in the future.
*/
enum rte_eth_event_type {
@@ -2448,6 +2469,7 @@ enum rte_eth_event_type { RTE_ETH_EVENT_INTR_RESET, /**< reset interrupt event, sent to VF on PF reset */ RTE_ETH_EVENT_VF_MBOX, /**< message from the VF received by
PF */
+ RTE_ETH_EVENT_IPSEC, /**< IPsec offload related event */
RTE_ETH_EVENT_MACSEC, /**< MACsec offload related event */
RTE_ETH_EVENT_INTR_RMV, /**< device removal event */
RTE_ETH_EVENT_NEW, /**< port is probed */
--
2.7.4
From: Anoob Joseph <hidden> Date: 2018-02-27 06:57:17
Hi Radu,
Please see inline.
Thanks,
Anoob
On 26/02/18 15:05, Nicolau, Radu wrote:
quoted
-----Original Message-----
From: Anoob Joseph [mailto:anoob.joseph@caviumnetworks.com]
Sent: Wednesday, February 21, 2018 5:37 AM
To: Akhil Goyal <redacted>; Doherty, Declan
[off-list ref]; Nicolau, Radu [off-list ref]
Cc: Anoob Joseph <redacted>; Jerin Jacob
[off-list ref]; Narayana Prasad
[off-list ref]; Nelio Laranjeiro
[off-list ref]; dev@dpdk.org
Subject: [PATCH 1/5] lib/ethdev: support for inline IPsec events
Adding support for IPsec events in rte_eth_event framework. In inline IPsec
offload, the per packet protocol defined variables, like ESN, would be
managed by PMD. In such cases, PMD would need IPsec events to notify
application about various conditions like, ESN overflow.
Signed-off-by: Anoob Joseph <redacted>
---
lib/librte_ether/rte_ethdev.h | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
free_cnt);
/**
+ * Subtypes for IPsec offload events raised by eth device.
+ */
+enum rte_eth_event_ipsec_subtype {
+ RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW,
+ /** Sequence number overflow in security offload */
+ RTE_ETH_EVENT_IPSEC_MAX
+ /** Max value of this enum */
+};
I would add some more events to the list (to make it look less like a very specific case implementation): crypto/auth failed and undefined/unspecified being the most obvious.
Apart from this, the patchset looks fine.
Understood your point. But crypto/auth failed would be per packet,
right? How are we handling such error cases presently? Just want to make
sure we are not adding two error reporting mechanisms.
quoted
+
+/**
+ * Descriptor for IPsec event. Used by eth dev to send extra
+information of the
+ * event.
+ */
+struct rte_eth_event_ipsec_desc {
+ enum rte_eth_event_ipsec_subtype stype;
+ /** Type of IPsec event */
+ uint64_t md;
+ /** Event specific metadata */
+};
+
+/**
* The eth device event type for interrupt, and maybe others in the future.
*/
enum rte_eth_event_type {
@@ -2448,6 +2469,7 @@ enum rte_eth_event_type { RTE_ETH_EVENT_INTR_RESET, /**< reset interrupt event, sent to VF on PF reset */ RTE_ETH_EVENT_VF_MBOX, /**< message from the VF received by
PF */
+ RTE_ETH_EVENT_IPSEC, /**< IPsec offload related event */
RTE_ETH_EVENT_MACSEC, /**< MACsec offload related event */
RTE_ETH_EVENT_INTR_RMV, /**< device removal event */
RTE_ETH_EVENT_NEW, /**< port is probed */
--
2.7.4
From: Nicolau, Radu <hidden> Date: 2018-02-27 10:19:19
-----Original Message-----
From: Anoob Joseph [mailto:Anoob.Joseph@caviumnetworks.com]
Sent: Tuesday, February 27, 2018 6:57 AM
To: Nicolau, Radu <redacted>; Akhil Goyal
[off-list ref]; Doherty, Declan [off-list ref]
Cc: Jerin Jacob <redacted>; Narayana Prasad
[off-list ref]; Nelio Laranjeiro
[off-list ref]; dev@dpdk.org
Subject: Re: [PATCH 1/5] lib/ethdev: support for inline IPsec events
Hi Radu,
Please see inline.
Thanks,
Anoob
On 26/02/18 15:05, Nicolau, Radu wrote:
quoted
quoted
-----Original Message-----
From: Anoob Joseph [mailto:anoob.joseph@caviumnetworks.com]
Sent: Wednesday, February 21, 2018 5:37 AM
To: Akhil Goyal <redacted>; Doherty, Declan
[off-list ref]; Nicolau, Radu [off-list ref]
Cc: Anoob Joseph <redacted>; Jerin Jacob
[off-list ref]; Narayana Prasad
[off-list ref]; Nelio Laranjeiro
[off-list ref]; dev@dpdk.org
Subject: [PATCH 1/5] lib/ethdev: support for inline IPsec events
Adding support for IPsec events in rte_eth_event framework. In inline
IPsec offload, the per packet protocol defined variables, like ESN,
would be managed by PMD. In such cases, PMD would need IPsec events
to notify application about various conditions like, ESN overflow.
Signed-off-by: Anoob Joseph <redacted>
---
lib/librte_ether/rte_ethdev.h | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/lib/librte_ether/rte_ethdev.h
b/lib/librte_ether/rte_ethdev.h index 0361533..4e4e18d 100644
uint32_t free_cnt);
/**
+ * Subtypes for IPsec offload events raised by eth device.
+ */
+enum rte_eth_event_ipsec_subtype {
+ RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW,
+ /** Sequence number overflow in security offload */
+ RTE_ETH_EVENT_IPSEC_MAX
+ /** Max value of this enum */
+};
I would add some more events to the list (to make it look less like a very
specific case implementation): crypto/auth failed and undefined/unspecified
being the most obvious.
quoted
Apart from this, the patchset looks fine.
Understood your point. But crypto/auth failed would be per packet, right?
How are we handling such error cases presently? Just want to make sure we
are not adding two error reporting mechanisms.
The only reason for my suggestion was to keep the API as flexible and generic as possible.
For the inline crypto on ixgbe we only flag the mbuf with the security error flag, but no extra info is added. I guess we can have a ipsec crypto error event with a list of failed mbufs or similar. In any case, it's just a suggestion.
quoted
quoted
+
+/**
+ * Descriptor for IPsec event. Used by eth dev to send extra
+information of the
+ * event.
+ */
+struct rte_eth_event_ipsec_desc {
+ enum rte_eth_event_ipsec_subtype stype;
+ /** Type of IPsec event */
+ uint64_t md;
+ /** Event specific metadata */
+};
+
+/**
* The eth device event type for interrupt, and maybe others in the
future.
quoted
quoted
*/
enum rte_eth_event_type {
@@ -2448,6 +2469,7 @@ enum rte_eth_event_type { RTE_ETH_EVENT_INTR_RESET, /**< reset interrupt event, sent to VF on PF reset */ RTE_ETH_EVENT_VF_MBOX, /**< message from the VF received by
PF */
quoted
quoted
+ RTE_ETH_EVENT_IPSEC, /**< IPsec offload related event */
RTE_ETH_EVENT_MACSEC, /**< MACsec offload related event */
RTE_ETH_EVENT_INTR_RMV, /**< device removal event */
RTE_ETH_EVENT_NEW, /**< port is probed */
--
2.7.4
From: Anoob Joseph <hidden> Date: 2018-02-27 11:32:38
Hi Radu,
Please see inline.
Thanks,
Anoob
On 27/02/18 15:49, Nicolau, Radu wrote:
quoted
-----Original Message-----
From: Anoob Joseph [mailto:Anoob.Joseph@caviumnetworks.com]
Sent: Tuesday, February 27, 2018 6:57 AM
To: Nicolau, Radu <redacted>; Akhil Goyal
[off-list ref]; Doherty, Declan [off-list ref]
Cc: Jerin Jacob <redacted>; Narayana Prasad
[off-list ref]; Nelio Laranjeiro
[off-list ref]; dev@dpdk.org
Subject: Re: [PATCH 1/5] lib/ethdev: support for inline IPsec events
Hi Radu,
Please see inline.
Thanks,
Anoob
On 26/02/18 15:05, Nicolau, Radu wrote:
quoted
quoted
-----Original Message-----
From: Anoob Joseph [mailto:anoob.joseph@caviumnetworks.com]
Sent: Wednesday, February 21, 2018 5:37 AM
To: Akhil Goyal <redacted>; Doherty, Declan
[off-list ref]; Nicolau, Radu [off-list ref]
Cc: Anoob Joseph <redacted>; Jerin Jacob
[off-list ref]; Narayana Prasad
[off-list ref]; Nelio Laranjeiro
[off-list ref]; dev@dpdk.org
Subject: [PATCH 1/5] lib/ethdev: support for inline IPsec events
Adding support for IPsec events in rte_eth_event framework. In inline
IPsec offload, the per packet protocol defined variables, like ESN,
would be managed by PMD. In such cases, PMD would need IPsec events
to notify application about various conditions like, ESN overflow.
Signed-off-by: Anoob Joseph <redacted>
---
lib/librte_ether/rte_ethdev.h | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/lib/librte_ether/rte_ethdev.h
b/lib/librte_ether/rte_ethdev.h index 0361533..4e4e18d 100644
uint32_t free_cnt);
/**
+ * Subtypes for IPsec offload events raised by eth device.
+ */
+enum rte_eth_event_ipsec_subtype {
+ RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW,
+ /** Sequence number overflow in security offload */
+ RTE_ETH_EVENT_IPSEC_MAX
+ /** Max value of this enum */
+};
I would add some more events to the list (to make it look less like a very
specific case implementation): crypto/auth failed and undefined/unspecified
being the most obvious.
quoted
Apart from this, the patchset looks fine.
Understood your point. But crypto/auth failed would be per packet, right?
How are we handling such error cases presently? Just want to make sure we
are not adding two error reporting mechanisms.
The only reason for my suggestion was to keep the API as flexible and generic as possible.
I agree to your suggestion.
For the inline crypto on ixgbe we only flag the mbuf with the security error flag, but no extra info is added. I guess we can have a ipsec crypto error event with a list of failed mbufs or similar. In any case, it's just a suggestion.
Do you think having a crypto error with failed mbufs would be useful? If
yes, I can add that. While considering other SA specific events, there
could be two other such events that we may need to consider.
1) Byte expiry of SA [1]
2) Time expiry of SA [1]
Shall I add these events? Or do we need to make that a separate patch?
Considering that it would need an entry in conf for actually of any use.
[1] https://tools.ietf.org/html/rfc4301#page-37
quoted
quoted
quoted
+
+/**
+ * Descriptor for IPsec event. Used by eth dev to send extra
+information of the
+ * event.
+ */
+struct rte_eth_event_ipsec_desc {
+ enum rte_eth_event_ipsec_subtype stype;
+ /** Type of IPsec event */
+ uint64_t md;
+ /** Event specific metadata */
+};
+
+/**
* The eth device event type for interrupt, and maybe others in the
future.
quoted
quoted
*/
enum rte_eth_event_type {
@@ -2448,6 +2469,7 @@ enum rte_eth_event_type { RTE_ETH_EVENT_INTR_RESET, /**< reset interrupt event, sent to VF on PF reset */ RTE_ETH_EVENT_VF_MBOX, /**< message from the VF received by
PF */
quoted
quoted
+ RTE_ETH_EVENT_IPSEC, /**< IPsec offload related event */
RTE_ETH_EVENT_MACSEC, /**< MACsec offload related event */
RTE_ETH_EVENT_INTR_RMV, /**< device removal event */
RTE_ETH_EVENT_NEW, /**< port is probed */
--
2.7.4
From: Nicolau, Radu <hidden> Date: 2018-02-28 09:30:14
Hi,
-----Original Message-----
From: Anoob Joseph [mailto:Anoob.Joseph@caviumnetworks.com]
Sent: Tuesday, February 27, 2018 11:32 AM
To: Nicolau, Radu <redacted>; Akhil Goyal
[off-list ref]; Doherty, Declan [off-list ref]
Cc: Jerin Jacob <redacted>; Narayana Prasad
[off-list ref]; Nelio Laranjeiro
[off-list ref]; dev@dpdk.org
Subject: Re: [PATCH 1/5] lib/ethdev: support for inline IPsec events
Hi Radu,
Please see inline.
Thanks,
Anoob
On 27/02/18 15:49, Nicolau, Radu wrote:
quoted
quoted
-----Original Message-----
From: Anoob Joseph [mailto:Anoob.Joseph@caviumnetworks.com]
Sent: Tuesday, February 27, 2018 6:57 AM
To: Nicolau, Radu <redacted>; Akhil Goyal
[off-list ref]; Doherty, Declan [off-list ref]
Cc: Jerin Jacob <redacted>; Narayana Prasad
[off-list ref]; Nelio Laranjeiro
[off-list ref]; dev@dpdk.org
Subject: Re: [PATCH 1/5] lib/ethdev: support for inline IPsec events
Hi Radu,
Please see inline.
Thanks,
Anoob
On 26/02/18 15:05, Nicolau, Radu wrote:
quoted
quoted
-----Original Message-----
From: Anoob Joseph [mailto:anoob.joseph@caviumnetworks.com]
Sent: Wednesday, February 21, 2018 5:37 AM
To: Akhil Goyal <redacted>; Doherty, Declan
[off-list ref]; Nicolau, Radu [off-list ref]
Cc: Anoob Joseph <redacted>; Jerin Jacob
[off-list ref]; Narayana Prasad
[off-list ref]; Nelio Laranjeiro
[off-list ref]; dev@dpdk.org
Subject: [PATCH 1/5] lib/ethdev: support for inline IPsec events
Adding support for IPsec events in rte_eth_event framework. In
inline IPsec offload, the per packet protocol defined variables,
like ESN, would be managed by PMD. In such cases, PMD would need
IPsec events to notify application about various conditions like, ESN
uint32_t free_cnt);
/**
+ * Subtypes for IPsec offload events raised by eth device.
+ */
+enum rte_eth_event_ipsec_subtype {
+ RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW,
+ /** Sequence number overflow in security offload */
+ RTE_ETH_EVENT_IPSEC_MAX
+ /** Max value of this enum */
+};
I would add some more events to the list (to make it look less like
a very
specific case implementation): crypto/auth failed and
undefined/unspecified being the most obvious.
quoted
Apart from this, the patchset looks fine.
Understood your point. But crypto/auth failed would be per packet, right?
How are we handling such error cases presently? Just want to make
sure we are not adding two error reporting mechanisms.
The only reason for my suggestion was to keep the API as flexible and
generic as possible.
I agree to your suggestion.
quoted
For the inline crypto on ixgbe we only flag the mbuf with the security error
flag, but no extra info is added. I guess we can have a ipsec crypto error
event with a list of failed mbufs or similar. In any case, it's just a suggestion.
Do you think having a crypto error with failed mbufs would be useful? If yes, I
can add that. While considering other SA specific events, there could be two
other such events that we may need to consider.
1) Byte expiry of SA [1]
2) Time expiry of SA [1]
You can add the flags even if we don't provide support for them in the sample app.
Shall I add these events? Or do we need to make that a separate patch?
Considering that it would need an entry in conf for actually of any use.
[1] https://tools.ietf.org/html/rfc4301#page-37
quoted
quoted
quoted
quoted
+
+/**
+ * Descriptor for IPsec event. Used by eth dev to send extra
+information of the
+ * event.
+ */
+struct rte_eth_event_ipsec_desc {
+ enum rte_eth_event_ipsec_subtype stype;
+ /** Type of IPsec event */
+ uint64_t md;
+ /** Event specific metadata */
+};
+
+/**
* The eth device event type for interrupt, and maybe others in
the
future.
quoted
quoted
*/
enum rte_eth_event_type {
@@ -2448,6 +2469,7 @@ enum rte_eth_event_type { RTE_ETH_EVENT_INTR_RESET, /**< reset interrupt event, sent to VF on PF reset */ RTE_ETH_EVENT_VF_MBOX, /**< message from the VF received by
PF */
quoted
quoted
+ RTE_ETH_EVENT_IPSEC, /**< IPsec offload related event */
RTE_ETH_EVENT_MACSEC, /**< MACsec offload related event */
RTE_ETH_EVENT_INTR_RMV, /**< device removal event */
RTE_ETH_EVENT_NEW, /**< port is probed */
--
2.7.4
From: Anoob Joseph <hidden> Date: 2018-03-01 09:22:13
This series enables application to set the sequence number soft limit
for IPsec offload. In inline IPsec offload, as the sequence number
(maintained by PMD/device) reaches the specified soft limit, the PMD
would raise an "IPSEC_EVENT". This event would have some metadata,
which would be used by the application to identify the SA on which the
sequence number overflow is about to happen.
Anoob Joseph (5):
lib/ethdev: support for inline IPsec events
lib/security: add ESN soft limit in conf
lib/security: extend userdata for IPsec events
examples/ipsec-secgw: handle ESN soft limit event
app/testpmd: support for IPsec event
app/test-pmd/parameters.c | 2 ++
app/test-pmd/testpmd.c | 2 ++
examples/ipsec-secgw/ipsec-secgw.c | 56 +++++++++++++++++++++++++++++++
examples/ipsec-secgw/ipsec.c | 10 ++++--
examples/ipsec-secgw/ipsec.h | 2 ++
lib/librte_ether/rte_ethdev.h | 28 ++++++++++++++++
lib/librte_security/rte_security.h | 16 +++++----
lib/librte_security/rte_security_driver.h | 6 ++--
8 files changed, 110 insertions(+), 12 deletions(-)
--
2.7.4
From: Anoob Joseph <hidden> Date: 2018-03-01 09:22:18
Adding support for IPsec events in rte_eth_event framework. In inline
IPsec offload, the per packet protocol defined variables, like ESN,
would be managed by PMD. In such cases, PMD would need IPsec events
to notify application about various conditions like, ESN overflow.
Signed-off-by: Anoob Joseph <redacted>
---
v2:
* Added time expiry & byte expiry IPsec events in the enum
lib/librte_ether/rte_ethdev.h | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
@@ -2438,6 +2438,33 @@ intrte_eth_tx_done_cleanup(uint16_tport_id,uint16_tqueue_id,uint32_tfree_cnt);/**+*SubtypesforIPsecoffloadeventsraisedbyethdevice.+*/+enumrte_eth_event_ipsec_subtype{+RTE_ETH_EVENT_IPSEC_UNKNOWN=0,+/** Unknown event type */+RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW,+/** Sequence number overflow in security offload */+RTE_ETH_EVENT_IPSEC_SA_TIME_EXPIRY,+/** Soft time expiry of SA */+RTE_ETH_EVENT_IPSEC_SA_BYTE_EXPIRY,+/** Soft byte expiry of SA */+RTE_ETH_EVENT_IPSEC_MAX+/** Max value of this enum */+};++/**+*DescriptorforIPsecevent.Usedbyethdevtosendextrainformationofthe+*event.+*/+structrte_eth_event_ipsec_desc{+enumrte_eth_event_ipsec_subtypestype;+/** Type of IPsec event */+uint64_tmd;+/** Event specific metadata */+};++/***Theethdeviceeventtypeforinterrupt,andmaybeothersinthefuture.*/enumrte_eth_event_type{
@@ -2448,6 +2475,7 @@ enum rte_eth_event_type {RTE_ETH_EVENT_INTR_RESET,/**< reset interrupt event, sent to VF on PF reset */RTE_ETH_EVENT_VF_MBOX,/**< message from the VF received by PF */+RTE_ETH_EVENT_IPSEC,/**< IPsec offload related event */RTE_ETH_EVENT_MACSEC,/**< MACsec offload related event */RTE_ETH_EVENT_INTR_RMV,/**< device removal event */RTE_ETH_EVENT_NEW,/**< port is probed */
From: Anoob Joseph <hidden> Date: 2018-03-01 09:22:23
Adding ESN soft limit in conf. This will be used in case of protocol
offload. Per SA, application could specify for what ESN the security
device need to notify application. In case of eth dev(inline protocol),
rte_eth_event framework would raise an IPsec event.
Signed-off-by: Anoob Joseph <redacted>
---
v2:
* No change
lib/librte_security/rte_security.h | 2 ++
1 file changed, 2 insertions(+)
@@ -222,6 +222,8 @@ struct rte_security_ipsec_xform {/**< IPsec SA Mode - transport/tunnel */structrte_security_ipsec_tunnel_paramtunnel;/**< Tunnel parameters, NULL for transport mode */+uint64_tesn_soft_limit;+/**< ESN for which the overflow event need to be raised by eth dev */};/**
From: Anoob Joseph <hidden> Date: 2018-03-01 09:22:27
Extending 'userdata' to be used for IPsec events too.
IPsec events would have some metadata which would uniquely identify the
security session for which the event is raised. But application would
need some construct which it can understand. The 'userdata' solves a
similar problem for inline processed inbound traffic. Updating the
documentation to extend the usage of 'userdata'.
Signed-off-by: Anoob Joseph <redacted>
---
v2:
* No change
lib/librte_security/rte_security.h | 14 ++++++++------
lib/librte_security/rte_security_driver.h | 6 +++---
2 files changed, 11 insertions(+), 9 deletions(-)
From: Anoob Joseph <hidden> Date: 2018-03-01 09:22:32
For inline protocol processing, the PMD/device is required to maintain
the ESN. But the application is required to monitor ESN overflow to
initiate SA expiry.
For such cases, application would set the ESN soft limit. An IPsec event
would be raised by rte_eth_event framework, when ESN hits the soft limit
set by the application.
Signed-off-by: Anoob Joseph <redacted>
---
v2:
* No change
examples/ipsec-secgw/ipsec-secgw.c | 56 ++++++++++++++++++++++++++++++++++++++
examples/ipsec-secgw/ipsec.c | 10 +++++--
examples/ipsec-secgw/ipsec.h | 2 ++
3 files changed, 65 insertions(+), 3 deletions(-)
@@ -1640,6 +1641,58 @@ pool_init(struct socket_ctx *ctx, int32_t socket_id, uint32_t nb_mbuf)printf("Allocated mbuf pool on socket %d\n",socket_id);}+staticinlineint+inline_ipsec_event_esn_overflow(structrte_security_ctx*ctx,uint64_tmd)+{+structipsec_sa*sa;++/* For inline protocol processing, the metadata in the event will+*uniquelyidentifythesecuritysessionwhichraisedtheevent.+*Applicationwouldthenneedtheuserdataithadregisteredwiththe+*securitysessiontoprocesstheevent.+*/++sa=(structipsec_sa*)rte_security_get_userdata(ctx,md);++if(sa==NULL){+/* userdata could not be retrieved */+return-1;+}++/* Sequence number over flow. SA need to be re-established */+RTE_SET_USED(sa);+return0;+}++staticint+inline_ipsec_event_callback(uint16_tport_id,enumrte_eth_event_typetype,+void*param,void*ret_param)+{+structrte_eth_event_ipsec_desc*event_desc=NULL;+structrte_security_ctx*ctx=(structrte_security_ctx*)+rte_eth_dev_get_sec_ctx(port_id);++RTE_SET_USED(param);++if(type!=RTE_ETH_EVENT_IPSEC)+return-1;++event_desc=ret_param;+if(event_desc==NULL){+printf("Event descriptor not set\n");+return-1;+}++if(event_desc->stype==RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW)+returninline_ipsec_event_esn_overflow(ctx,event_desc->md);+elseif(event_desc->stype>=RTE_ETH_EVENT_IPSEC_MAX){+printf("Invalid IPsec event reported\n");+return-1;+}++return-1;+}+int32_tmain(int32_targc,char**argv){
@@ -36,6 +36,7 @@ set_ipsec_conf(struct ipsec_sa *sa, struct rte_security_ipsec_xform *ipsec)}/* TODO support for Transport and IPV6 tunnel */}+ipsec->esn_soft_limit=IPSEC_OFFLOAD_ESN_SOFTLIMIT;}staticinlineint
From: Anoob Joseph <hidden> Date: 2018-03-08 05:57:43
Hi Akhil, Radu,
Can you review the patch set and share your comments?
Thanks,
Anoob
On 01/03/18 14:51, Anoob Joseph wrote:
This series enables application to set the sequence number soft limit
for IPsec offload. In inline IPsec offload, as the sequence number
(maintained by PMD/device) reaches the specified soft limit, the PMD
would raise an "IPSEC_EVENT". This event would have some metadata,
which would be used by the application to identify the SA on which the
sequence number overflow is about to happen.
Anoob Joseph (5):
lib/ethdev: support for inline IPsec events
lib/security: add ESN soft limit in conf
lib/security: extend userdata for IPsec events
examples/ipsec-secgw: handle ESN soft limit event
app/testpmd: support for IPsec event
app/test-pmd/parameters.c | 2 ++
app/test-pmd/testpmd.c | 2 ++
examples/ipsec-secgw/ipsec-secgw.c | 56 +++++++++++++++++++++++++++++++
examples/ipsec-secgw/ipsec.c | 10 ++++--
examples/ipsec-secgw/ipsec.h | 2 ++
lib/librte_ether/rte_ethdev.h | 28 ++++++++++++++++
lib/librte_security/rte_security.h | 16 +++++----
lib/librte_security/rte_security_driver.h | 6 ++--
8 files changed, 110 insertions(+), 12 deletions(-)
Hi Anoob,
Just a minor comment.
On 3/1/2018 2:51 PM, Anoob Joseph wrote:
quoted hunk
Adding ESN soft limit in conf. This will be used in case of protocol
offload. Per SA, application could specify for what ESN the security
device need to notify application. In case of eth dev(inline protocol),
rte_eth_event framework would raise an IPsec event.
Signed-off-by: Anoob Joseph <redacted>
---
v2:
* No change
lib/librte_security/rte_security.h | 2 ++
1 file changed, 2 insertions(+)
@@ -222,6 +222,8 @@ struct rte_security_ipsec_xform {/**< IPsec SA Mode - transport/tunnel */structrte_security_ipsec_tunnel_paramtunnel;/**< Tunnel parameters, NULL for transport mode */+uint64_tesn_soft_limit;+/**< ESN for which the overflow event need to be raised by eth dev */
Hi Anoob,
On 3/1/2018 2:51 PM, Anoob Joseph wrote:
quoted hunk
For inline protocol processing, the PMD/device is required to maintain
the ESN. But the application is required to monitor ESN overflow to
initiate SA expiry.
For such cases, application would set the ESN soft limit. An IPsec event
would be raised by rte_eth_event framework, when ESN hits the soft limit
set by the application.
Signed-off-by: Anoob Joseph <redacted>
---
v2:
* No change
examples/ipsec-secgw/ipsec-secgw.c | 56 ++++++++++++++++++++++++++++++++++++++
examples/ipsec-secgw/ipsec.c | 10 +++++--
examples/ipsec-secgw/ipsec.h | 2 ++
3 files changed, 65 insertions(+), 3 deletions(-)
@@ -1640,6 +1641,58 @@ pool_init(struct socket_ctx *ctx, int32_t socket_id, uint32_t nb_mbuf)printf("Allocated mbuf pool on socket %d\n",socket_id);}+staticinlineint+inline_ipsec_event_esn_overflow(structrte_security_ctx*ctx,uint64_tmd)+{+structipsec_sa*sa;++/* For inline protocol processing, the metadata in the event will+*uniquelyidentifythesecuritysessionwhichraisedtheevent.+*Applicationwouldthenneedtheuserdataithadregisteredwiththe+*securitysessiontoprocesstheevent.+*/++sa=(structipsec_sa*)rte_security_get_userdata(ctx,md);++if(sa==NULL){+/* userdata could not be retrieved */+return-1;+}++/* Sequence number over flow. SA need to be re-established */
With this patchset, application will be able to get notification if the
error has occurred. But it is not re-configuring the SA.
Do you intend to add the same?
@@ -36,6 +36,7 @@ set_ipsec_conf(struct ipsec_sa *sa, struct rte_security_ipsec_xform *ipsec)}/* TODO support for Transport and IPV6 tunnel */}+ipsec->esn_soft_limit=IPSEC_OFFLOAD_ESN_SOFTLIMIT;}staticinlineint
From: Anoob Joseph <hidden> Date: 2018-03-14 05:15:45
Hi Akhil,
Will revise the patch with the mentioned change.
Thanks,
Anoob
On 13/03/18 17:49, Akhil Goyal wrote:
Hi Anoob,
Just a minor comment.
On 3/1/2018 2:51 PM, Anoob Joseph wrote:
quoted
Adding ESN soft limit in conf. This will be used in case of protocol
offload. Per SA, application could specify for what ESN the security
device need to notify application. In case of eth dev(inline protocol),
rte_eth_event framework would raise an IPsec event.
Signed-off-by: Anoob Joseph <redacted>
---
v2:
* No change
lib/librte_security/rte_security.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/librte_security/rte_security.h
b/lib/librte_security/rte_security.h
index c75c121..a71ff6f 100644
/**< IPsec SA Mode - transport/tunnel */
struct rte_security_ipsec_tunnel_param tunnel;
/**< Tunnel parameters, NULL for transport mode */
+ uint64_t esn_soft_limit;
+ /**< ESN for which the overflow event need to be raised by eth
dev */
From: Anoob Joseph <hidden> Date: 2018-03-14 06:06:25
Hi Akhil,
Please see inline.
Thanks,
Anoob
On 13/03/18 17:54, Akhil Goyal wrote:
Hi Anoob,
On 3/1/2018 2:51 PM, Anoob Joseph wrote:
quoted
For inline protocol processing, the PMD/device is required to maintain
the ESN. But the application is required to monitor ESN overflow to
initiate SA expiry.
For such cases, application would set the ESN soft limit. An IPsec event
would be raised by rte_eth_event framework, when ESN hits the soft limit
set by the application.
Signed-off-by: Anoob Joseph <redacted>
---
v2:
* No change
examples/ipsec-secgw/ipsec-secgw.c | 56
++++++++++++++++++++++++++++++++++++++
examples/ipsec-secgw/ipsec.c | 10 +++++--
examples/ipsec-secgw/ipsec.h | 2 ++
3 files changed, 65 insertions(+), 3 deletions(-)
diff --git a/examples/ipsec-secgw/ipsec-secgw.c
b/examples/ipsec-secgw/ipsec-secgw.c
index 3a8562e..5726fd3 100644
socket_id, uint32_t nb_mbuf)
printf("Allocated mbuf pool on socket %d\n", socket_id);
}
+static inline int
+inline_ipsec_event_esn_overflow(struct rte_security_ctx *ctx,
uint64_t md)
+{
+ struct ipsec_sa *sa;
+
+ /* For inline protocol processing, the metadata in the event will
+ * uniquely identify the security session which raised the event.
+ * Application would then need the userdata it had registered
with the
+ * security session to process the event.
+ */
+
+ sa = (struct ipsec_sa *)rte_security_get_userdata(ctx, md);
+
+ if (sa == NULL) {
+ /* userdata could not be retrieved */
+ return -1;
+ }
+
+ /* Sequence number over flow. SA need to be re-established */
With this patchset, application will be able to get notification if
the error has occurred. But it is not re-configuring the SA.
Do you intend to add the same?
Ideally the application should initiate a SA renegotiation sequence
(with IKE etc). But ipsec-secgw uses predetermined SAs, and so addition
of SA renegotiation might not fit in with the current design. I was just
adding this as a place holder for future expansion (and a model for real
applications).
What are your thoughts on addition here? Similar handling would be
needed for byte & time expiry as well, when that is added. May be we
could just log the event and leave it be.
rte_security_ipsec_xform *ipsec)
}
/* TODO support for Transport and IPV6 tunnel */
}
+ ipsec->esn_soft_limit = IPSEC_OFFLOAD_ESN_SOFTLIMIT;
}
static inline int
struct ipsec_sa *sa)
* the packet is received, this userdata will be
* retrieved using the metadata from the packet.
*
- * This is required only for inbound SAs.
+ * The PMD is expected to set similar metadata for other
+ * operations, like rte_eth_event, which are tied to
+ * security session. In such cases, the userdata could
+ * be obtained to uniquely identify the security
+ * parameters denoted.
*/
- if (sa->direction == RTE_SECURITY_IPSEC_SA_DIR_INGRESS)
- sess_conf.userdata = (void *) sa;
+ sess_conf.userdata = (void *) sa;
sa->sec_session = rte_security_session_create(ctx,
&sess_conf, ipsec_ctx->session_pool);
From: Anoob Joseph <hidden> Date: 2018-03-21 05:20:30
Hi Akhil,
If you are fine with the existing code, I'll send a revised patchset
incorporating the comment change you had suggested for 3rd patch. Shall
I proceed?
Thanks,
Anoob
On 14/03/18 11:36, Anoob Joseph wrote:
Hi Akhil,
Please see inline.
Thanks,
Anoob
On 13/03/18 17:54, Akhil Goyal wrote:
quoted
Hi Anoob,
On 3/1/2018 2:51 PM, Anoob Joseph wrote:
quoted
For inline protocol processing, the PMD/device is required to maintain
the ESN. But the application is required to monitor ESN overflow to
initiate SA expiry.
For such cases, application would set the ESN soft limit. An IPsec
event
would be raised by rte_eth_event framework, when ESN hits the soft
limit
set by the application.
Signed-off-by: Anoob Joseph <redacted>
---
v2:
* No change
examples/ipsec-secgw/ipsec-secgw.c | 56
++++++++++++++++++++++++++++++++++++++
examples/ipsec-secgw/ipsec.c | 10 +++++--
examples/ipsec-secgw/ipsec.h | 2 ++
3 files changed, 65 insertions(+), 3 deletions(-)
diff --git a/examples/ipsec-secgw/ipsec-secgw.c
b/examples/ipsec-secgw/ipsec-secgw.c
index 3a8562e..5726fd3 100644
socket_id, uint32_t nb_mbuf)
printf("Allocated mbuf pool on socket %d\n", socket_id);
}
+static inline int
+inline_ipsec_event_esn_overflow(struct rte_security_ctx *ctx,
uint64_t md)
+{
+ struct ipsec_sa *sa;
+
+ /* For inline protocol processing, the metadata in the event will
+ * uniquely identify the security session which raised the event.
+ * Application would then need the userdata it had registered
with the
+ * security session to process the event.
+ */
+
+ sa = (struct ipsec_sa *)rte_security_get_userdata(ctx, md);
+
+ if (sa == NULL) {
+ /* userdata could not be retrieved */
+ return -1;
+ }
+
+ /* Sequence number over flow. SA need to be re-established */
With this patchset, application will be able to get notification if
the error has occurred. But it is not re-configuring the SA.
Do you intend to add the same?
Ideally the application should initiate a SA renegotiation sequence
(with IKE etc). But ipsec-secgw uses predetermined SAs, and so
addition of SA renegotiation might not fit in with the current design.
I was just adding this as a place holder for future expansion (and a
model for real applications).
What are your thoughts on addition here? Similar handling would be
needed for byte & time expiry as well, when that is added. May be we
could just log the event and leave it be.
rte_security_ipsec_xform *ipsec)
}
/* TODO support for Transport and IPV6 tunnel */
}
+ ipsec->esn_soft_limit = IPSEC_OFFLOAD_ESN_SOFTLIMIT;
}
static inline int
struct ipsec_sa *sa)
* the packet is received, this userdata will be
* retrieved using the metadata from the packet.
*
- * This is required only for inbound SAs.
+ * The PMD is expected to set similar metadata for other
+ * operations, like rte_eth_event, which are tied to
+ * security session. In such cases, the userdata could
+ * be obtained to uniquely identify the security
+ * parameters denoted.
*/
- if (sa->direction == RTE_SECURITY_IPSEC_SA_DIR_INGRESS)
- sess_conf.userdata = (void *) sa;
+ sess_conf.userdata = (void *) sa;
sa->sec_session = rte_security_session_create(ctx,
&sess_conf, ipsec_ctx->session_pool);
diff --git a/examples/ipsec-secgw/ipsec.h
b/examples/ipsec-secgw/ipsec.h
index 6059f6c..c1450f6 100644
Hi Anoob,
On 3/21/2018 10:50 AM, Anoob Joseph wrote:
Hi Akhil,
If you are fine with the existing code, I'll send a revised patchset
incorporating the comment change you had suggested for 3rd patch. Shall
I proceed?
Thanks,
Anoob
Yes you can send the patchset with existing code.
BTW we are open for an approach to add sa rediscovery in the application
in future.
Thanks,
Akhil
On 14/03/18 11:36, Anoob Joseph wrote:
quoted
Hi Akhil,
Please see inline.
Thanks,
Anoob
On 13/03/18 17:54, Akhil Goyal wrote:
quoted
Hi Anoob,
On 3/1/2018 2:51 PM, Anoob Joseph wrote:
quoted
For inline protocol processing, the PMD/device is required to maintain
the ESN. But the application is required to monitor ESN overflow to
initiate SA expiry.
For such cases, application would set the ESN soft limit. An IPsec
event
would be raised by rte_eth_event framework, when ESN hits the soft
limit
set by the application.
Signed-off-by: Anoob Joseph <redacted>
---
v2:
* No change
examples/ipsec-secgw/ipsec-secgw.c | 56
++++++++++++++++++++++++++++++++++++++
examples/ipsec-secgw/ipsec.c | 10 +++++--
examples/ipsec-secgw/ipsec.h | 2 ++
3 files changed, 65 insertions(+), 3 deletions(-)
diff --git a/examples/ipsec-secgw/ipsec-secgw.c
b/examples/ipsec-secgw/ipsec-secgw.c
index 3a8562e..5726fd3 100644
socket_id, uint32_t nb_mbuf)
printf("Allocated mbuf pool on socket %d\n", socket_id);
}
+static inline int
+inline_ipsec_event_esn_overflow(struct rte_security_ctx *ctx,
uint64_t md)
+{
+ struct ipsec_sa *sa;
+
+ /* For inline protocol processing, the metadata in the event will
+ * uniquely identify the security session which raised the event.
+ * Application would then need the userdata it had registered
with the
+ * security session to process the event.
+ */
+
+ sa = (struct ipsec_sa *)rte_security_get_userdata(ctx, md);
+
+ if (sa == NULL) {
+ /* userdata could not be retrieved */
+ return -1;
+ }
+
+ /* Sequence number over flow. SA need to be re-established */
With this patchset, application will be able to get notification if
the error has occurred. But it is not re-configuring the SA.
Do you intend to add the same?
Ideally the application should initiate a SA renegotiation sequence
(with IKE etc). But ipsec-secgw uses predetermined SAs, and so
addition of SA renegotiation might not fit in with the current design.
I was just adding this as a place holder for future expansion (and a
model for real applications).
What are your thoughts on addition here? Similar handling would be
needed for byte & time expiry as well, when that is added. May be we
could just log the event and leave it be.
rte_security_ipsec_xform *ipsec)
}
/* TODO support for Transport and IPV6 tunnel */
}
+ ipsec->esn_soft_limit = IPSEC_OFFLOAD_ESN_SOFTLIMIT;
}
static inline int
struct ipsec_sa *sa)
* the packet is received, this userdata will be
* retrieved using the metadata from the packet.
*
- * This is required only for inbound SAs.
+ * The PMD is expected to set similar metadata for other
+ * operations, like rte_eth_event, which are tied to
+ * security session. In such cases, the userdata could
+ * be obtained to uniquely identify the security
+ * parameters denoted.
*/
- if (sa->direction == RTE_SECURITY_IPSEC_SA_DIR_INGRESS)
- sess_conf.userdata = (void *) sa;
+ sess_conf.userdata = (void *) sa;
sa->sec_session = rte_security_session_create(ctx,
&sess_conf, ipsec_ctx->session_pool);
diff --git a/examples/ipsec-secgw/ipsec.h
b/examples/ipsec-secgw/ipsec.h
index 6059f6c..c1450f6 100644
From: Anoob Joseph <hidden> Date: 2018-03-21 11:12:02
This series enables application to set the sequence number soft limit
for IPsec offload. In inline IPsec offload, as the sequence number
(maintained by PMD/device) reaches the specified soft limit, the PMD
would raise an "IPSEC_EVENT". This event would have some metadata,
which would be used by the application to identify the SA on which the
sequence number overflow is about to happen.
Anoob Joseph (5):
lib/ethdev: support for inline IPsec events
lib/security: add ESN soft limit in conf
lib/security: extend userdata for IPsec events
examples/ipsec-secgw: handle ESN soft limit event
app/testpmd: support for IPsec event
app/test-pmd/parameters.c | 2 ++
app/test-pmd/testpmd.c | 2 ++
examples/ipsec-secgw/ipsec-secgw.c | 56 +++++++++++++++++++++++++++++++
examples/ipsec-secgw/ipsec.c | 10 ++++--
examples/ipsec-secgw/ipsec.h | 2 ++
lib/librte_ether/rte_ethdev.h | 28 ++++++++++++++++
lib/librte_security/rte_security.h | 16 +++++----
lib/librte_security/rte_security_driver.h | 6 ++--
8 files changed, 110 insertions(+), 12 deletions(-)
--
2.7.4
From: Anoob Joseph <hidden> Date: 2018-03-21 11:12:11
Adding support for IPsec events in rte_eth_event framework. In inline
IPsec offload, the per packet protocol defined variables, like ESN,
would be managed by PMD. In such cases, PMD would need IPsec events
to notify application about various conditions like, ESN overflow.
Signed-off-by: Anoob Joseph <redacted>
---
v3:
* No change
v2:
* Added time expiry & byte expiry IPsec events in the enum
lib/librte_ether/rte_ethdev.h | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
@@ -2438,6 +2438,33 @@ intrte_eth_tx_done_cleanup(uint16_tport_id,uint16_tqueue_id,uint32_tfree_cnt);/**+*SubtypesforIPsecoffloadeventsraisedbyethdevice.+*/+enumrte_eth_event_ipsec_subtype{+RTE_ETH_EVENT_IPSEC_UNKNOWN=0,+/** Unknown event type */+RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW,+/** Sequence number overflow in security offload */+RTE_ETH_EVENT_IPSEC_SA_TIME_EXPIRY,+/** Soft time expiry of SA */+RTE_ETH_EVENT_IPSEC_SA_BYTE_EXPIRY,+/** Soft byte expiry of SA */+RTE_ETH_EVENT_IPSEC_MAX+/** Max value of this enum */+};++/**+*DescriptorforIPsecevent.Usedbyethdevtosendextrainformationofthe+*event.+*/+structrte_eth_event_ipsec_desc{+enumrte_eth_event_ipsec_subtypestype;+/** Type of IPsec event */+uint64_tmd;+/** Event specific metadata */+};++/***Theethdeviceeventtypeforinterrupt,andmaybeothersinthefuture.*/enumrte_eth_event_type{
@@ -2448,6 +2475,7 @@ enum rte_eth_event_type {RTE_ETH_EVENT_INTR_RESET,/**< reset interrupt event, sent to VF on PF reset */RTE_ETH_EVENT_VF_MBOX,/**< message from the VF received by PF */+RTE_ETH_EVENT_IPSEC,/**< IPsec offload related event */RTE_ETH_EVENT_MACSEC,/**< MACsec offload related event */RTE_ETH_EVENT_INTR_RMV,/**< device removal event */RTE_ETH_EVENT_NEW,/**< port is probed */
From: Anoob Joseph <hidden> Date: 2018-03-21 11:12:22
Adding ESN soft limit in conf. This will be used in case of protocol
offload. Per SA, application could specify for what ESN the security
device need to notify application. In case of eth dev(inline protocol),
rte_eth_event framework would raise an IPsec event.
Signed-off-by: Anoob Joseph <redacted>
---
v3:
* Minor change in the comment
v2:
* No change
lib/librte_security/rte_security.h | 2 ++
1 file changed, 2 insertions(+)
@@ -222,6 +222,8 @@ struct rte_security_ipsec_xform {/**< IPsec SA Mode - transport/tunnel */structrte_security_ipsec_tunnel_paramtunnel;/**< Tunnel parameters, NULL for transport mode */+uint64_tesn_soft_limit;+/**< ESN for which the overflow event need to be raised */};/**
From: Anoob Joseph <hidden> Date: 2018-03-21 11:12:29
Extending 'userdata' to be used for IPsec events too.
IPsec events would have some metadata which would uniquely identify the
security session for which the event is raised. But application would
need some construct which it can understand. The 'userdata' solves a
similar problem for inline processed inbound traffic. Updating the
documentation to extend the usage of 'userdata'.
Signed-off-by: Anoob Joseph <redacted>
---
v3:
* No change
v2:
* No change
lib/librte_security/rte_security.h | 14 ++++++++------
lib/librte_security/rte_security_driver.h | 6 +++---
2 files changed, 11 insertions(+), 9 deletions(-)
From: Anoob Joseph <hidden> Date: 2018-03-21 11:12:33
For inline protocol processing, the PMD/device is required to maintain
the ESN. But the application is required to monitor ESN overflow to
initiate SA expiry.
For such cases, application would set the ESN soft limit. An IPsec event
would be raised by rte_eth_event framework, when ESN hits the soft limit
set by the application.
Signed-off-by: Anoob Joseph <redacted>
---
v3:
* No change
v2:
* No change
examples/ipsec-secgw/ipsec-secgw.c | 56 ++++++++++++++++++++++++++++++++++++++
examples/ipsec-secgw/ipsec.c | 10 +++++--
examples/ipsec-secgw/ipsec.h | 2 ++
3 files changed, 65 insertions(+), 3 deletions(-)
@@ -1640,6 +1641,58 @@ pool_init(struct socket_ctx *ctx, int32_t socket_id, uint32_t nb_mbuf)printf("Allocated mbuf pool on socket %d\n",socket_id);}+staticinlineint+inline_ipsec_event_esn_overflow(structrte_security_ctx*ctx,uint64_tmd)+{+structipsec_sa*sa;++/* For inline protocol processing, the metadata in the event will+*uniquelyidentifythesecuritysessionwhichraisedtheevent.+*Applicationwouldthenneedtheuserdataithadregisteredwiththe+*securitysessiontoprocesstheevent.+*/++sa=(structipsec_sa*)rte_security_get_userdata(ctx,md);++if(sa==NULL){+/* userdata could not be retrieved */+return-1;+}++/* Sequence number over flow. SA need to be re-established */+RTE_SET_USED(sa);+return0;+}++staticint+inline_ipsec_event_callback(uint16_tport_id,enumrte_eth_event_typetype,+void*param,void*ret_param)+{+structrte_eth_event_ipsec_desc*event_desc=NULL;+structrte_security_ctx*ctx=(structrte_security_ctx*)+rte_eth_dev_get_sec_ctx(port_id);++RTE_SET_USED(param);++if(type!=RTE_ETH_EVENT_IPSEC)+return-1;++event_desc=ret_param;+if(event_desc==NULL){+printf("Event descriptor not set\n");+return-1;+}++if(event_desc->stype==RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW)+returninline_ipsec_event_esn_overflow(ctx,event_desc->md);+elseif(event_desc->stype>=RTE_ETH_EVENT_IPSEC_MAX){+printf("Invalid IPsec event reported\n");+return-1;+}++return-1;+}+int32_tmain(int32_targc,char**argv){
@@ -36,6 +36,7 @@ set_ipsec_conf(struct ipsec_sa *sa, struct rte_security_ipsec_xform *ipsec)}/* TODO support for Transport and IPV6 tunnel */}+ipsec->esn_soft_limit=IPSEC_OFFLOAD_ESN_SOFTLIMIT;}staticinlineint
Adding support for IPsec events in rte_eth_event framework. In inline
IPsec offload, the per packet protocol defined variables, like ESN,
would be managed by PMD. In such cases, PMD would need IPsec events
to notify application about various conditions like, ESN overflow.
Signed-off-by: Anoob Joseph <redacted>
---
v3:
* No change
v2:
* Added time expiry & byte expiry IPsec events in the enum
lib/librte_ether/rte_ethdev.h | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
From: Anoob Joseph <hidden> Date: 2018-04-03 14:27:16
Adding maintainers of testpmd & lib/ethdev
Thanks,
Anoob
On 21/03/18 16:41, Anoob Joseph wrote:
This series enables application to set the sequence number soft limit
for IPsec offload. In inline IPsec offload, as the sequence number
(maintained by PMD/device) reaches the specified soft limit, the PMD
would raise an "IPSEC_EVENT". This event would have some metadata,
which would be used by the application to identify the SA on which the
sequence number overflow is about to happen.
Anoob Joseph (5):
lib/ethdev: support for inline IPsec events
lib/security: add ESN soft limit in conf
lib/security: extend userdata for IPsec events
examples/ipsec-secgw: handle ESN soft limit event
app/testpmd: support for IPsec event
app/test-pmd/parameters.c | 2 ++
app/test-pmd/testpmd.c | 2 ++
examples/ipsec-secgw/ipsec-secgw.c | 56 +++++++++++++++++++++++++++++++
examples/ipsec-secgw/ipsec.c | 10 ++++--
examples/ipsec-secgw/ipsec.h | 2 ++
lib/librte_ether/rte_ethdev.h | 28 ++++++++++++++++
lib/librte_security/rte_security.h | 16 +++++----
lib/librte_security/rte_security_driver.h | 6 ++--
8 files changed, 110 insertions(+), 12 deletions(-)
From: Anoob Joseph <hidden> Date: 2018-04-03 14:27:41
Adding maintainers of testpmd & lib/ethdev
Thanks,
Anoob
On 21/03/18 16:41, Anoob Joseph wrote:
quoted hunk
Adding support for IPsec events in rte_eth_event framework. In inline
IPsec offload, the per packet protocol defined variables, like ESN,
would be managed by PMD. In such cases, PMD would need IPsec events
to notify application about various conditions like, ESN overflow.
Signed-off-by: Anoob Joseph <redacted>
---
v3:
* No change
v2:
* Added time expiry & byte expiry IPsec events in the enum
lib/librte_ether/rte_ethdev.h | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
@@ -2438,6 +2438,33 @@ intrte_eth_tx_done_cleanup(uint16_tport_id,uint16_tqueue_id,uint32_tfree_cnt);/**+*SubtypesforIPsecoffloadeventsraisedbyethdevice.+*/+enumrte_eth_event_ipsec_subtype{+RTE_ETH_EVENT_IPSEC_UNKNOWN=0,+/** Unknown event type */+RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW,+/** Sequence number overflow in security offload */+RTE_ETH_EVENT_IPSEC_SA_TIME_EXPIRY,+/** Soft time expiry of SA */+RTE_ETH_EVENT_IPSEC_SA_BYTE_EXPIRY,+/** Soft byte expiry of SA */+RTE_ETH_EVENT_IPSEC_MAX+/** Max value of this enum */+};++/**+*DescriptorforIPsecevent.Usedbyethdevtosendextrainformationofthe+*event.+*/+structrte_eth_event_ipsec_desc{+enumrte_eth_event_ipsec_subtypestype;+/** Type of IPsec event */+uint64_tmd;+/** Event specific metadata */+};++/***Theethdeviceeventtypeforinterrupt,andmaybeothersinthefuture.*/enumrte_eth_event_type{
@@ -2448,6 +2475,7 @@ enum rte_eth_event_type {RTE_ETH_EVENT_INTR_RESET,/**< reset interrupt event, sent to VF on PF reset */RTE_ETH_EVENT_VF_MBOX,/**< message from the VF received by PF */+RTE_ETH_EVENT_IPSEC,/**< IPsec offload related event */RTE_ETH_EVENT_MACSEC,/**< MACsec offload related event */RTE_ETH_EVENT_INTR_RMV,/**< device removal event */RTE_ETH_EVENT_NEW,/**< port is probed */
From: Anoob Joseph <hidden> Date: 2018-04-03 14:28:02
Adding maintainers of testpmd & lib/ethdev
Thanks,
Anoob
On 21/03/18 16:41, Anoob Joseph wrote:
quoted hunk
Adding ESN soft limit in conf. This will be used in case of protocol
offload. Per SA, application could specify for what ESN the security
device need to notify application. In case of eth dev(inline protocol),
rte_eth_event framework would raise an IPsec event.
Signed-off-by: Anoob Joseph <redacted>
---
v3:
* Minor change in the comment
v2:
* No change
lib/librte_security/rte_security.h | 2 ++
1 file changed, 2 insertions(+)
@@ -222,6 +222,8 @@ struct rte_security_ipsec_xform {/**< IPsec SA Mode - transport/tunnel */structrte_security_ipsec_tunnel_paramtunnel;/**< Tunnel parameters, NULL for transport mode */+uint64_tesn_soft_limit;+/**< ESN for which the overflow event need to be raised */};/**
From: Anoob Joseph <hidden> Date: 2018-04-03 14:28:29
Adding maintainers of testpmd & lib/ethdev
Thanks,
Anoob
On 21/03/18 16:41, Anoob Joseph wrote:
quoted hunk
Extending 'userdata' to be used for IPsec events too.
IPsec events would have some metadata which would uniquely identify the
security session for which the event is raised. But application would
need some construct which it can understand. The 'userdata' solves a
similar problem for inline processed inbound traffic. Updating the
documentation to extend the usage of 'userdata'.
Signed-off-by: Anoob Joseph <redacted>
---
v3:
* No change
v2:
* No change
lib/librte_security/rte_security.h | 14 ++++++++------
lib/librte_security/rte_security_driver.h | 6 +++---
2 files changed, 11 insertions(+), 9 deletions(-)
From: Anoob Joseph <hidden> Date: 2018-04-03 14:29:09
Adding maintainers of testpmd & lib/ethdev
Thanks,
Anoob
On 21/03/18 16:41, Anoob Joseph wrote:
quoted hunk
For inline protocol processing, the PMD/device is required to maintain
the ESN. But the application is required to monitor ESN overflow to
initiate SA expiry.
For such cases, application would set the ESN soft limit. An IPsec event
would be raised by rte_eth_event framework, when ESN hits the soft limit
set by the application.
Signed-off-by: Anoob Joseph <redacted>
---
v3:
* No change
v2:
* No change
examples/ipsec-secgw/ipsec-secgw.c | 56 ++++++++++++++++++++++++++++++++++++++
examples/ipsec-secgw/ipsec.c | 10 +++++--
examples/ipsec-secgw/ipsec.h | 2 ++
3 files changed, 65 insertions(+), 3 deletions(-)
@@ -1640,6 +1641,58 @@ pool_init(struct socket_ctx *ctx, int32_t socket_id, uint32_t nb_mbuf)printf("Allocated mbuf pool on socket %d\n",socket_id);}+staticinlineint+inline_ipsec_event_esn_overflow(structrte_security_ctx*ctx,uint64_tmd)+{+structipsec_sa*sa;++/* For inline protocol processing, the metadata in the event will+*uniquelyidentifythesecuritysessionwhichraisedtheevent.+*Applicationwouldthenneedtheuserdataithadregisteredwiththe+*securitysessiontoprocesstheevent.+*/++sa=(structipsec_sa*)rte_security_get_userdata(ctx,md);++if(sa==NULL){+/* userdata could not be retrieved */+return-1;+}++/* Sequence number over flow. SA need to be re-established */+RTE_SET_USED(sa);+return0;+}++staticint+inline_ipsec_event_callback(uint16_tport_id,enumrte_eth_event_typetype,+void*param,void*ret_param)+{+structrte_eth_event_ipsec_desc*event_desc=NULL;+structrte_security_ctx*ctx=(structrte_security_ctx*)+rte_eth_dev_get_sec_ctx(port_id);++RTE_SET_USED(param);++if(type!=RTE_ETH_EVENT_IPSEC)+return-1;++event_desc=ret_param;+if(event_desc==NULL){+printf("Event descriptor not set\n");+return-1;+}++if(event_desc->stype==RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW)+returninline_ipsec_event_esn_overflow(ctx,event_desc->md);+elseif(event_desc->stype>=RTE_ETH_EVENT_IPSEC_MAX){+printf("Invalid IPsec event reported\n");+return-1;+}++return-1;+}+int32_tmain(int32_targc,char**argv){
@@ -36,6 +36,7 @@ set_ipsec_conf(struct ipsec_sa *sa, struct rte_security_ipsec_xform *ipsec)}/* TODO support for Transport and IPV6 tunnel */}+ipsec->esn_soft_limit=IPSEC_OFFLOAD_ESN_SOFTLIMIT;}staticinlineint
From: Anoob Joseph <hidden> Date: 2018-04-10 05:10:59
Hi Thomas,
Can you review the patch and let me know if you have any comments.
Thanks,
Anoob
On 03/04/18 19:57, Anoob Joseph wrote:
Adding maintainers of testpmd & lib/ethdev
Thanks,
Anoob
On 21/03/18 16:41, Anoob Joseph wrote:
quoted
Adding support for IPsec events in rte_eth_event framework. In inline
IPsec offload, the per packet protocol defined variables, like ESN,
would be managed by PMD. In such cases, PMD would need IPsec events
to notify application about various conditions like, ESN overflow.
Signed-off-by: Anoob Joseph <redacted>
---
v3:
* No change
v2:
* Added time expiry & byte expiry IPsec events in the enum
lib/librte_ether/rte_ethdev.h | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/lib/librte_ether/rte_ethdev.h
b/lib/librte_ether/rte_ethdev.h
index 0361533..96b2aa0 100644
rte_eth_tx_done_cleanup(uint16_t port_id, uint16_t queue_id,
uint32_t free_cnt);
/**
+ * Subtypes for IPsec offload events raised by eth device.
+ */
+enum rte_eth_event_ipsec_subtype {
+ RTE_ETH_EVENT_IPSEC_UNKNOWN = 0,
+ /** Unknown event type */
+ RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW,
+ /** Sequence number overflow in security offload */
+ RTE_ETH_EVENT_IPSEC_SA_TIME_EXPIRY,
+ /** Soft time expiry of SA */
+ RTE_ETH_EVENT_IPSEC_SA_BYTE_EXPIRY,
+ /** Soft byte expiry of SA */
+ RTE_ETH_EVENT_IPSEC_MAX
+ /** Max value of this enum */
+};
+
+/**
+ * Descriptor for IPsec event. Used by eth dev to send extra
information of the
+ * event.
+ */
+struct rte_eth_event_ipsec_desc {
+ enum rte_eth_event_ipsec_subtype stype;
+ /** Type of IPsec event */
+ uint64_t md;
+ /** Event specific metadata */
+};
+
+/**
* The eth device event type for interrupt, and maybe others in the
future.
*/
enum rte_eth_event_type {
@@ -2448,6 +2475,7 @@ enum rte_eth_event_type {
RTE_ETH_EVENT_INTR_RESET,
/**< reset interrupt event, sent to VF on PF reset */
RTE_ETH_EVENT_VF_MBOX, /**< message from the VF received by PF */
+ RTE_ETH_EVENT_IPSEC, /**< IPsec offload related event */
RTE_ETH_EVENT_MACSEC, /**< MACsec offload related event */
RTE_ETH_EVENT_INTR_RMV, /**< device removal event */
RTE_ETH_EVENT_NEW, /**< port is probed */
From: Thomas Monjalon <hidden> Date: 2018-04-10 09:11:46
Hi,
21/03/2018 12:11, Anoob Joseph:
Adding support for IPsec events in rte_eth_event framework. In inline
IPsec offload, the per packet protocol defined variables, like ESN,
would be managed by PMD. In such cases, PMD would need IPsec events
to notify application about various conditions like, ESN overflow.
Signed-off-by: Anoob Joseph <redacted>
No comment about IPsec handling.
The documentation could try to better link things together, see below:
/**
+ * Subtypes for IPsec offload events raised by eth device.
+ */
+enum rte_eth_event_ipsec_subtype {
+ RTE_ETH_EVENT_IPSEC_UNKNOWN = 0,
+ /** Unknown event type */
+ RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW,
+ /** Sequence number overflow in security offload */
+ RTE_ETH_EVENT_IPSEC_SA_TIME_EXPIRY,
+ /** Soft time expiry of SA */
+ RTE_ETH_EVENT_IPSEC_SA_BYTE_EXPIRY,
+ /** Soft byte expiry of SA */
+ RTE_ETH_EVENT_IPSEC_MAX
+ /** Max value of this enum */
+};
+
+/**
+ * Descriptor for IPsec event. Used by eth dev to send extra information of the
+ * event.
+ */
You could link it to the event type RTE_ETH_EVENT_IPSEC in this doxygen comment.
stype is not easy to read & understand. What about subtype?
+ /** Type of IPsec event */
You could add the prefix of the events in this comment: RTE_ETH_EVENT_IPSEC_*
+ uint64_t md;
What about metadata?
+ /** Event specific metadata */
Could you describe what is the metadata, depending on each sub-type?
quoted hunk
+};
+
+/**
* The eth device event type for interrupt, and maybe others in the future.
*/
enum rte_eth_event_type {
@@ -2448,6 +2475,7 @@ enum rte_eth_event_type { RTE_ETH_EVENT_INTR_RESET, /**< reset interrupt event, sent to VF on PF reset */ RTE_ETH_EVENT_VF_MBOX, /**< message from the VF received by PF */+ RTE_ETH_EVENT_IPSEC, /**< IPsec offload related event */ RTE_ETH_EVENT_MACSEC, /**< MACsec offload related event */ RTE_ETH_EVENT_INTR_RMV, /**< device removal event */ RTE_ETH_EVENT_NEW, /**< port is probed */
From: Anoob Joseph <hidden> Date: 2018-04-11 06:41:25
This series enables application to set the sequence number soft limit
for IPsec offload. In inline IPsec offload, as the sequence number
(maintained by PMD/device) reaches the specified soft limit, the PMD
would raise an "IPSEC_EVENT". This event would have some metadata,
which would be used by the application to identify the SA on which the
sequence number overflow is about to happen.
Anoob Joseph (5):
lib/ethdev: support for inline IPsec events
lib/security: add ESN soft limit in conf
lib/security: extend userdata for IPsec events
examples/ipsec-secgw: handle ESN soft limit event
app/testpmd: support for IPsec event
app/test-pmd/parameters.c | 2 ++
app/test-pmd/testpmd.c | 2 ++
examples/ipsec-secgw/ipsec-secgw.c | 59 +++++++++++++++++++++++++++++++
examples/ipsec-secgw/ipsec.c | 10 ++++--
examples/ipsec-secgw/ipsec.h | 2 ++
lib/librte_ether/rte_ethdev.h | 41 +++++++++++++++++++++
lib/librte_security/rte_security.h | 16 +++++----
lib/librte_security/rte_security_driver.h | 6 ++--
8 files changed, 126 insertions(+), 12 deletions(-)
--
2.7.4
From: Anoob Joseph <hidden> Date: 2018-04-11 06:41:49
Adding support for IPsec events in rte_eth_event framework. In inline
IPsec offload, the per packet protocol defined variables, like ESN,
would be managed by PMD. In such cases, PMD would need IPsec events
to notify application about various conditions like, ESN overflow.
Signed-off-by: Anoob Joseph <redacted>
Acked-by: Akhil Goyal <redacted>
---
v4:
* Added more details in documentation
* Renamed members of struct rte_eth_event_ipsec_desc for better readablity
v3:
* No change
v2:
* Added time expiry & byte expiry IPsec events in the enum
lib/librte_ether/rte_ethdev.h | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
@@ -2436,6 +2436,46 @@ intrte_eth_tx_done_cleanup(uint16_tport_id,uint16_tqueue_id,uint32_tfree_cnt);/**+*SubtypesforIPsecoffloadevent(@refRTE_ETH_EVENT_IPSEC)raisedby+*ethdevice.+*/+enumrte_eth_event_ipsec_subtype{+RTE_ETH_EVENT_IPSEC_UNKNOWN=0,+/**< Unknown event type */+RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW,+/**< Sequence number overflow */+RTE_ETH_EVENT_IPSEC_SA_TIME_EXPIRY,+/**< Soft time expiry of SA */+RTE_ETH_EVENT_IPSEC_SA_BYTE_EXPIRY,+/**< Soft byte expiry of SA */+RTE_ETH_EVENT_IPSEC_MAX+/**< Max value of this enum */+};++/**+*Descriptorfor@refRTE_ETH_EVENT_IPSECevent.Usedbyethdevtosendextra+*informationoftheIPsecoffloadevent.+*/+structrte_eth_event_ipsec_desc{+enumrte_eth_event_ipsec_subtypesubtype;+/**< Type of RTE_ETH_EVENT_IPSEC_* event */+uint64_tmetadata;+/**< Event specific metadata+*+*Forthefollowingevents,*userdata*registered+*withthe*rte_security_session*wouldbereturned+*asmetadata,+*+*-@refRTE_ETH_EVENT_IPSEC_ESN_OVERFLOW+*-@refRTE_ETH_EVENT_IPSEC_SA_TIME_EXPIRY+*-@refRTE_ETH_EVENT_IPSEC_SA_BYTE_EXPIRY+*+*@seestructrte_security_session_conf+*+*/+};++/***Theethdeviceeventtypeforinterrupt,andmaybeothersinthefuture.*/enumrte_eth_event_type{
@@ -2446,6 +2486,7 @@ enum rte_eth_event_type {RTE_ETH_EVENT_INTR_RESET,/**< reset interrupt event, sent to VF on PF reset */RTE_ETH_EVENT_VF_MBOX,/**< message from the VF received by PF */+RTE_ETH_EVENT_IPSEC,/**< IPsec offload related event */RTE_ETH_EVENT_MACSEC,/**< MACsec offload related event */RTE_ETH_EVENT_INTR_RMV,/**< device removal event */RTE_ETH_EVENT_NEW,/**< port is probed */
From: Anoob Joseph <hidden> Date: 2018-04-11 06:41:55
Adding ESN soft limit in conf. This will be used in case of protocol
offload. Per SA, application could specify for what ESN the security
device need to notify application. In case of eth dev(inline protocol),
rte_eth_event framework would raise an IPsec event.
Signed-off-by: Anoob Joseph <redacted>
Acked-by: Akhil Goyal <redacted>
---
v4:
* No change
v3:
* Minor change in the comment
v2:
* No change
lib/librte_security/rte_security.h | 2 ++
1 file changed, 2 insertions(+)
@@ -222,6 +222,8 @@ struct rte_security_ipsec_xform {/**< IPsec SA Mode - transport/tunnel */structrte_security_ipsec_tunnel_paramtunnel;/**< Tunnel parameters, NULL for transport mode */+uint64_tesn_soft_limit;+/**< ESN for which the overflow event need to be raised */};/**
From: Anoob Joseph <hidden> Date: 2018-04-11 06:41:59
Extending 'userdata' to be used for IPsec events too.
IPsec events would have some metadata which would uniquely identify the
security session for which the event is raised. But application would
need some construct which it can understand. The 'userdata' solves a
similar problem for inline processed inbound traffic. Updating the
documentation to extend the usage of 'userdata'.
Signed-off-by: Anoob Joseph <redacted>
Acked-by: Akhil Goyal <redacted>
---
v4:
* No change
v3:
* No change
v2:
* No change
lib/librte_security/rte_security.h | 14 ++++++++------
lib/librte_security/rte_security_driver.h | 6 +++---
2 files changed, 11 insertions(+), 9 deletions(-)
From: Anoob Joseph <hidden> Date: 2018-04-11 06:42:05
For inline protocol processing, the PMD/device is required to maintain
the ESN. But the application is required to monitor ESN overflow to
initiate SA expiry.
For such cases, application would set the ESN soft limit. An IPsec event
would be raised by rte_eth_event framework, when ESN hits the soft limit
set by the application.
Signed-off-by: Anoob Joseph <redacted>
Acked-by: Akhil Goyal <redacted>
---
v4:
* Reflected the variable renames
v3:
* No change
v2:
* No change
examples/ipsec-secgw/ipsec-secgw.c | 59 ++++++++++++++++++++++++++++++++++++++
examples/ipsec-secgw/ipsec.c | 10 +++++--
examples/ipsec-secgw/ipsec.h | 2 ++
3 files changed, 68 insertions(+), 3 deletions(-)
@@ -1644,6 +1645,61 @@ pool_init(struct socket_ctx *ctx, int32_t socket_id, uint32_t nb_mbuf)printf("Allocated mbuf pool on socket %d\n",socket_id);}+staticinlineint+inline_ipsec_event_esn_overflow(structrte_security_ctx*ctx,uint64_tmd)+{+structipsec_sa*sa;++/* For inline protocol processing, the metadata in the event will+*uniquelyidentifythesecuritysessionwhichraisedtheevent.+*Applicationwouldthenneedtheuserdataithadregisteredwiththe+*securitysessiontoprocesstheevent.+*/++sa=(structipsec_sa*)rte_security_get_userdata(ctx,md);++if(sa==NULL){+/* userdata could not be retrieved */+return-1;+}++/* Sequence number over flow. SA need to be re-established */+RTE_SET_USED(sa);+return0;+}++staticint+inline_ipsec_event_callback(uint16_tport_id,enumrte_eth_event_typetype,+void*param,void*ret_param)+{+uint64_tmd;+structrte_eth_event_ipsec_desc*event_desc=NULL;+structrte_security_ctx*ctx=(structrte_security_ctx*)+rte_eth_dev_get_sec_ctx(port_id);++RTE_SET_USED(param);++if(type!=RTE_ETH_EVENT_IPSEC)+return-1;++event_desc=ret_param;+if(event_desc==NULL){+printf("Event descriptor not set\n");+return-1;+}++md=event_desc->metadata;++if(event_desc->subtype==RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW)+returninline_ipsec_event_esn_overflow(ctx,md);+elseif(event_desc->subtype>=RTE_ETH_EVENT_IPSEC_MAX){+printf("Invalid IPsec event reported\n");+return-1;+}++return-1;+}+int32_tmain(int32_targc,char**argv){
@@ -36,6 +36,7 @@ set_ipsec_conf(struct ipsec_sa *sa, struct rte_security_ipsec_xform *ipsec)}/* TODO support for Transport and IPV6 tunnel */}+ipsec->esn_soft_limit=IPSEC_OFFLOAD_ESN_SOFTLIMIT;}staticinlineint
From: Anoob Joseph <hidden> Date: 2018-04-19 09:15:25
Hi Thomas,
Are these changes fine? Can you review the changes and let me know if
you have more comments.
Thanks,
Anoob
On 11/04/18 12:10, Anoob Joseph wrote:
quoted hunk
Adding support for IPsec events in rte_eth_event framework. In inline
IPsec offload, the per packet protocol defined variables, like ESN,
would be managed by PMD. In such cases, PMD would need IPsec events
to notify application about various conditions like, ESN overflow.
Signed-off-by: Anoob Joseph <redacted>
Acked-by: Akhil Goyal <redacted>
---
v4:
* Added more details in documentation
* Renamed members of struct rte_eth_event_ipsec_desc for better readablity
v3:
* No change
v2:
* Added time expiry & byte expiry IPsec events in the enum
lib/librte_ether/rte_ethdev.h | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
@@ -2436,6 +2436,46 @@ intrte_eth_tx_done_cleanup(uint16_tport_id,uint16_tqueue_id,uint32_tfree_cnt);/**+*SubtypesforIPsecoffloadevent(@refRTE_ETH_EVENT_IPSEC)raisedby+*ethdevice.+*/+enumrte_eth_event_ipsec_subtype{+RTE_ETH_EVENT_IPSEC_UNKNOWN=0,+/**< Unknown event type */+RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW,+/**< Sequence number overflow */+RTE_ETH_EVENT_IPSEC_SA_TIME_EXPIRY,+/**< Soft time expiry of SA */+RTE_ETH_EVENT_IPSEC_SA_BYTE_EXPIRY,+/**< Soft byte expiry of SA */+RTE_ETH_EVENT_IPSEC_MAX+/**< Max value of this enum */+};++/**+*Descriptorfor@refRTE_ETH_EVENT_IPSECevent.Usedbyethdevtosendextra+*informationoftheIPsecoffloadevent.+*/+structrte_eth_event_ipsec_desc{+enumrte_eth_event_ipsec_subtypesubtype;+/**< Type of RTE_ETH_EVENT_IPSEC_* event */+uint64_tmetadata;+/**< Event specific metadata+*+*Forthefollowingevents,*userdata*registered+*withthe*rte_security_session*wouldbereturned+*asmetadata,+*+*-@refRTE_ETH_EVENT_IPSEC_ESN_OVERFLOW+*-@refRTE_ETH_EVENT_IPSEC_SA_TIME_EXPIRY+*-@refRTE_ETH_EVENT_IPSEC_SA_BYTE_EXPIRY+*+*@seestructrte_security_session_conf+*+*/+};++/***Theethdeviceeventtypeforinterrupt,andmaybeothersinthefuture.*/enumrte_eth_event_type{
@@ -2446,6 +2486,7 @@ enum rte_eth_event_type {RTE_ETH_EVENT_INTR_RESET,/**< reset interrupt event, sent to VF on PF reset */RTE_ETH_EVENT_VF_MBOX,/**< message from the VF received by PF */+RTE_ETH_EVENT_IPSEC,/**< IPsec offload related event */RTE_ETH_EVENT_MACSEC,/**< MACsec offload related event */RTE_ETH_EVENT_INTR_RMV,/**< device removal event */RTE_ETH_EVENT_NEW,/**< port is probed */
From: Thomas Monjalon <hidden> Date: 2018-04-19 11:13:23
11/04/2018 08:40, Anoob Joseph:
Adding support for IPsec events in rte_eth_event framework. In inline
IPsec offload, the per packet protocol defined variables, like ESN,
would be managed by PMD. In such cases, PMD would need IPsec events
to notify application about various conditions like, ESN overflow.
Signed-off-by: Anoob Joseph <redacted>
Acked-by: Akhil Goyal <redacted>
---
v4:
* Added more details in documentation
* Renamed members of struct rte_eth_event_ipsec_desc for better readablity
Good, thank you.
Acked-by: Thomas Monjalon <redacted>
From: De Lara Guarch, Pablo <hidden> Date: 2018-04-19 15:44:32
-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Anoob Joseph
Sent: Wednesday, April 11, 2018 7:41 AM
To: Akhil Goyal <redacted>; Doherty, Declan
[off-list ref]; Wu, Jingjing [off-list ref]; Nicolau,
Radu [off-list ref]; Thomas Monjalon [off-list ref];
Lu, Wenzhuo [off-list ref]
Cc: Anoob Joseph <redacted>; Jerin Jacob
[off-list ref]; Narayana Prasad
[off-list ref]; Nelio Laranjeiro
[off-list ref]; dev@dpdk.org
Subject: [dpdk-dev] [PATCH v4 0/5] handle seq no overflow in IPsec offload
This series enables application to set the sequence number soft limit for IPsec
offload. In inline IPsec offload, as the sequence number (maintained by
PMD/device) reaches the specified soft limit, the PMD would raise an
"IPSEC_EVENT". This event would have some metadata, which would be used by
the application to identify the SA on which the sequence number overflow is
about to happen.
Anoob Joseph (5):
lib/ethdev: support for inline IPsec events
lib/security: add ESN soft limit in conf
lib/security: extend userdata for IPsec events
examples/ipsec-secgw: handle ESN soft limit event
app/testpmd: support for IPsec event
app/test-pmd/parameters.c | 2 ++
app/test-pmd/testpmd.c | 2 ++
examples/ipsec-secgw/ipsec-secgw.c | 59
+++++++++++++++++++++++++++++++
examples/ipsec-secgw/ipsec.c | 10 ++++--
examples/ipsec-secgw/ipsec.h | 2 ++
lib/librte_ether/rte_ethdev.h | 41 +++++++++++++++++++++
lib/librte_security/rte_security.h | 16 +++++----
lib/librte_security/rte_security_driver.h | 6 ++--
8 files changed, 126 insertions(+), 12 deletions(-)
--
2.7.4
From: Stephen Hemminger <stephen@networkplumber.org> Date: 2018-04-20 15:14:35
On Thu, 19 Apr 2018 14:45:01 +0530
Anoob Joseph [off-list ref] wrote:
quoted
+/**
* The eth device event type for interrupt, and maybe others in the future.
*/
enum rte_eth_event_type {
@@ -2446,6 +2486,7 @@ enum rte_eth_event_type { RTE_ETH_EVENT_INTR_RESET, /**< reset interrupt event, sent to VF on PF reset */ RTE_ETH_EVENT_VF_MBOX, /**< message from the VF received by PF */+ RTE_ETH_EVENT_IPSEC, /**< IPsec offload related event */ RTE_ETH_EVENT_MACSEC, /**< MACsec offload related event */ RTE_ETH_EVENT_INTR_RMV, /**< device removal event */ RTE_ETH_EVENT_NEW, /**< port is probed */
Putting new value in middle of enum risks breaking ABI compatiablity