DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/iavf: fix handling of IPsec events
@ 2022-10-20  9:20 Radu Nicolau
  2022-10-24 11:34 ` [PATCH v2] " Radu Nicolau
  0 siblings, 1 reply; 3+ messages in thread
From: Radu Nicolau @ 2022-10-20  9:20 UTC (permalink / raw)
  To: Jingjing Wu, Beilei Xing; +Cc: dev, qi.z.zhang, Radu Nicolau, stable

Verify that the message length is non zero and keep processing
virtual channel messages after the event is received.

Fixes: 6bc987ecb860 ("net/iavf: support IPsec inline crypto")
Cc: stable@dpdk.org

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
 drivers/net/iavf/iavf_vchnl.c | 43 +++++++++++++++++++++--------------
 1 file changed, 26 insertions(+), 17 deletions(-)

diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 4327c5a786..7fc239ee98 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -346,23 +346,32 @@ iavf_handle_virtchnl_msg(struct rte_eth_dev *dev)
 				iavf_handle_pf_event_msg(dev, info.msg_buf,
 						info.msg_len);
 			} else {
-				/* check for inline IPsec events */
-				struct inline_ipsec_msg *imsg =
-					(struct inline_ipsec_msg *)info.msg_buf;
-				struct rte_eth_event_ipsec_desc desc;
-				if (msg_opc ==
-					VIRTCHNL_OP_INLINE_IPSEC_CRYPTO &&
-					imsg->ipsec_opcode ==
-						INLINE_IPSEC_OP_EVENT) {
-					struct virtchnl_ipsec_event *ev =
-							imsg->ipsec_data.event;
-					desc.subtype =
-						RTE_ETH_EVENT_IPSEC_UNKNOWN;
-					desc.metadata = ev->ipsec_event_data;
-					rte_eth_dev_callback_process(dev,
-							RTE_ETH_EVENT_IPSEC,
-							&desc);
-					return;
+				/* check for unsolicited messages i.e. events */
+				if (info.msg_len > 0) {
+					switch (msg_opc) {
+					case VIRTCHNL_OP_INLINE_IPSEC_CRYPTO: {
+						struct inline_ipsec_msg *imsg =
+							(struct inline_ipsec_msg *)info.msg_buf;
+						if (imsg->ipsec_opcode
+								== INLINE_IPSEC_OP_EVENT) {
+							struct rte_eth_event_ipsec_desc desc;
+							struct virtchnl_ipsec_event *ev =
+									imsg->ipsec_data.event;
+							desc.subtype =
+									RTE_ETH_EVENT_IPSEC_UNKNOWN;
+							desc.metadata =
+									ev->ipsec_event_data;
+							rte_eth_dev_callback_process(dev,
+									RTE_ETH_EVENT_IPSEC,
+									&desc);
+							continue;
+					}
+				}
+						break;
+					default:
+						break;
+					}
+
 				}
 
 				/* read message and it's expected one */
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] net/iavf: fix handling of IPsec events
  2022-10-20  9:20 [PATCH] net/iavf: fix handling of IPsec events Radu Nicolau
@ 2022-10-24 11:34 ` Radu Nicolau
  2022-10-25  7:30   ` Zhang, Qi Z
  0 siblings, 1 reply; 3+ messages in thread
From: Radu Nicolau @ 2022-10-24 11:34 UTC (permalink / raw)
  To: Jingjing Wu, Beilei Xing; +Cc: dev, qi.z.zhang, Radu Nicolau, stable

Verify that the message length is non zero and keep processing
virtual channel messages after the event is received.

Fixes: 6bc987ecb860 ("net/iavf: support IPsec inline crypto")
Cc: stable@dpdk.org

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
v2: rebased to next-net-intel

 drivers/net/iavf/iavf_vchnl.c | 42 ++++++++++++++++++++++-------------
 1 file changed, 26 insertions(+), 16 deletions(-)

diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 654bc7edb6..f92daf97f2 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -488,22 +488,32 @@ iavf_handle_virtchnl_msg(struct rte_eth_dev *dev)
 				iavf_handle_pf_event_msg(dev, info.msg_buf,
 						info.msg_len);
 			} else {
-				/* check for inline IPsec events */
-				struct inline_ipsec_msg *imsg =
-					(struct inline_ipsec_msg *)info.msg_buf;
-				struct rte_eth_event_ipsec_desc desc;
-				if (msg_opc ==
-					VIRTCHNL_OP_INLINE_IPSEC_CRYPTO &&
-					imsg->ipsec_opcode ==
-						INLINE_IPSEC_OP_EVENT) {
-					struct virtchnl_ipsec_event *ev =
-							imsg->ipsec_data.event;
-					desc.subtype =
-						RTE_ETH_EVENT_IPSEC_UNKNOWN;
-					desc.metadata = ev->ipsec_event_data;
-					iavf_dev_event_post(dev, RTE_ETH_EVENT_IPSEC,
-							&desc, sizeof(desc));
-					return;
+				/* check for unsolicited messages i.e. events */
+				if (info.msg_len > 0) {
+					switch (msg_opc) {
+					case VIRTCHNL_OP_INLINE_IPSEC_CRYPTO: {
+						struct inline_ipsec_msg *imsg =
+							(struct inline_ipsec_msg *)info.msg_buf;
+						if (imsg->ipsec_opcode
+								== INLINE_IPSEC_OP_EVENT) {
+							struct rte_eth_event_ipsec_desc desc;
+							struct virtchnl_ipsec_event *ev =
+									imsg->ipsec_data.event;
+							desc.subtype =
+									RTE_ETH_EVENT_IPSEC_UNKNOWN;
+							desc.metadata =
+									ev->ipsec_event_data;
+							iavf_dev_event_post(dev,
+								RTE_ETH_EVENT_IPSEC,
+								&desc, sizeof(desc));
+							continue;
+					}
+				}
+						break;
+					default:
+						break;
+					}
+
 				}
 
 				/* read message and it's expected one */
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH v2] net/iavf: fix handling of IPsec events
  2022-10-24 11:34 ` [PATCH v2] " Radu Nicolau
@ 2022-10-25  7:30   ` Zhang, Qi Z
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang, Qi Z @ 2022-10-25  7:30 UTC (permalink / raw)
  To: Nicolau, Radu, Wu, Jingjing, Xing, Beilei; +Cc: dev, stable



> -----Original Message-----
> From: Nicolau, Radu <radu.nicolau@intel.com>
> Sent: Monday, October 24, 2022 7:35 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Nicolau, Radu
> <radu.nicolau@intel.com>; stable@dpdk.org
> Subject: [PATCH v2] net/iavf: fix handling of IPsec events
> 
> Verify that the message length is non zero and keep processing virtual
> channel messages after the event is received.
> 
> Fixes: 6bc987ecb860 ("net/iavf: support IPsec inline crypto")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-25  7:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-20  9:20 [PATCH] net/iavf: fix handling of IPsec events Radu Nicolau
2022-10-24 11:34 ` [PATCH v2] " Radu Nicolau
2022-10-25  7:30   ` Zhang, Qi Z

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).