[1/3] security: add MACsec algo in capability index

Message ID 20230731034447.929506-1-gakhil@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: akhil goyal
Headers
Series [1/3] security: add MACsec algo in capability index |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Akhil Goyal July 31, 2023, 3:44 a.m. UTC
  From: Ankur Dwivedi <adwivedi@marvell.com>

This patch adds the MACsec algorithm field in security capability index
structure. This field is compared against the MACsec alg to return the
correct capability.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
---
 lib/security/rte_security.c | 4 ++++
 lib/security/rte_security.h | 3 +++
 2 files changed, 7 insertions(+)
  

Comments

Akhil Goyal Sept. 19, 2023, 7:17 p.m. UTC | #1
> Subject: [PATCH v2 0/3] MACsec capability verification
> 
> Changes in v2: Fixed clang build issue in 3/3 patch.
> 
> Ankur Dwivedi (3):
>   security: add MACsec algo in capability index
>   net/cnxk: add MACsec capability
>   test/security: add capability verification for MACsec
> 
>  app/test/test_security_inline_macsec.c | 373 ++++++++++++++++++++-----
>  drivers/common/cnxk/roc_features.h     |   6 +
>  drivers/common/cnxk/roc_mcs.h          |   3 +
>  drivers/net/cnxk/cn10k_ethdev_sec.c    | 120 +++++++-
>  lib/security/rte_security.c            |   4 +
>  lib/security/rte_security.h            |   3 +
>  6 files changed, 428 insertions(+), 81 deletions(-)
> 
Series Applied to dpdk-next-crypto
  

Patch

diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index c4d64bb8e9..2d729b735b 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -282,6 +282,10 @@  rte_security_capability_get(struct rte_security_ctx *instance,
 				if (capability->docsis.direction ==
 							idx->docsis.direction)
 					return capability;
+			} else if (idx->protocol ==
+						RTE_SECURITY_PROTOCOL_MACSEC) {
+				if (idx->macsec.alg == capability->macsec.alg)
+					return capability;
 			}
 		}
 	}
diff --git a/lib/security/rte_security.h b/lib/security/rte_security.h
index 3b2df526ba..5459002d43 100644
--- a/lib/security/rte_security.h
+++ b/lib/security/rte_security.h
@@ -1251,6 +1251,9 @@  struct rte_security_capability_idx {
 		struct {
 			enum rte_security_docsis_direction direction;
 		} docsis;
+		struct {
+			enum rte_security_macsec_alg alg;
+		} macsec;
 	};
 };