examples/l2fwd-macsec: enable extended packet number

Message ID 20240916112636.3158391-1-gakhil@marvell.com (mailing list archive)
State New
Delegated to: akhil goyal
Headers
Series examples/l2fwd-macsec: enable extended packet number |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Akhil Goyal Sept. 16, 2024, 11:26 a.m. UTC
Enabled the extended packet number(XPN) case so that
traffic runs for longer duration without raising interrupt
for PN threshold as the application currently does not handle
rekeying.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
---
 examples/l2fwd-macsec/main.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
  

Patch

diff --git a/examples/l2fwd-macsec/main.c b/examples/l2fwd-macsec/main.c
index 294ee113e3..b262d3ba0b 100644
--- a/examples/l2fwd-macsec/main.c
+++ b/examples/l2fwd-macsec/main.c
@@ -446,7 +446,8 @@  fill_macsec_sc_conf(uint16_t portid, struct rte_security_macsec_sc *sc_conf)
 		}
 		sc_conf->sc_tx.active = 1;
 		sc_conf->sc_tx.sci = mcs_port_params[portid].sci;
-		if (mcs_port_params[portid].xpn > 0)
+		if (mcs_port_params[portid].alg == RTE_SECURITY_MACSEC_ALG_GCM_XPN_128 ||
+			       mcs_port_params[portid].alg == RTE_SECURITY_MACSEC_ALG_GCM_XPN_256)
 			sc_conf->sc_tx.is_xpn = 1;
 	} else {
 		for (i = 0; i < RTE_SECURITY_MACSEC_NUM_AN; i++) {
@@ -456,7 +457,8 @@  fill_macsec_sc_conf(uint16_t portid, struct rte_security_macsec_sc *sc_conf)
 			}
 		}
 		sc_conf->sc_rx.active = 1;
-		if (mcs_port_params[portid].xpn > 0)
+		if (mcs_port_params[portid].alg == RTE_SECURITY_MACSEC_ALG_GCM_XPN_128 ||
+			       mcs_port_params[portid].alg == RTE_SECURITY_MACSEC_ALG_GCM_XPN_256)
 			sc_conf->sc_rx.is_xpn = 1;
 	}
 }
@@ -1008,7 +1010,7 @@  l2fwd_macsec_default_options(struct l2fwd_macsec_options *options)
 		if ((options->rx_portmask & (1 << portid)) != 0)
 			mcs_port_params[portid].dir = RTE_SECURITY_MACSEC_DIR_RX;
 
-		mcs_port_params[portid].alg = RTE_SECURITY_MACSEC_ALG_GCM_128;
+		mcs_port_params[portid].alg = RTE_SECURITY_MACSEC_ALG_GCM_XPN_128;
 		memcpy(mcs_port_params[portid].sa_key.data, key, 16);
 		mcs_port_params[portid].sa_key.len = 16;
 		memcpy(mcs_port_params[portid].salt, salt, MCS_SALT_LEN);