[qca-nss-clients] Fix window_size and seq_start stats

Change-Id: Ic627ad48b08e307236e1e65ee7fadfdebd2c949b
Signed-off-by: Ratheesh Kannoth <rkannoth@codeaurora.org>
diff --git a/ipsecmgr/v2.0/nss_ipsecmgr_ctx.c b/ipsecmgr/v2.0/nss_ipsecmgr_ctx.c
index c200c56..2d22eec 100644
--- a/ipsecmgr/v2.0/nss_ipsecmgr_ctx.c
+++ b/ipsecmgr/v2.0/nss_ipsecmgr_ctx.c
@@ -774,7 +774,7 @@
 
 		ev_cb = sa->cb.event_cb;
 		if (ev_cb) {
-			nss_ipsecmgr_sa_sync2stats(sync, &event.data.stats);
+			nss_ipsecmgr_sa_sync2stats(sa, sync, &event.data.stats);
 			app_data = sa->cb.app_data;
 		}
 
diff --git a/ipsecmgr/v2.0/nss_ipsecmgr_sa.c b/ipsecmgr/v2.0/nss_ipsecmgr_sa.c
index e2cbe8f..f2c5aee 100644
--- a/ipsecmgr/v2.0/nss_ipsecmgr_sa.c
+++ b/ipsecmgr/v2.0/nss_ipsecmgr_sa.c
@@ -733,9 +733,11 @@
  * nss_ipsecmgr_sa_sync_state()
  *	Update SA sync state
  */
-void nss_ipsecmgr_sa_sync2stats(struct nss_ipsec_cmn_sa_sync *sync, struct nss_ipsecmgr_sa_stats *stats)
+void nss_ipsecmgr_sa_sync2stats(struct nss_ipsecmgr_sa *sa, struct nss_ipsec_cmn_sa_sync *sync,
+					struct nss_ipsecmgr_sa_stats *stats)
 {
 	struct nss_ipsec_cmn_sa_stats *sa_stats = &sync->stats;
+	struct nss_ipsec_cmn_sa_data *sa_data = &sa->state.data;
 	uint32_t *drop_counters;
 	size_t num_counters;
 	int i;
@@ -757,9 +759,11 @@
 	for (i = 0; i < num_counters; i++)
 		stats->pkt_failed += drop_counters[i];
 
-	stats->seq_start = sync->replay.seq_start;
-	stats->seq_cur = sync->replay.seq_cur;
-	stats->window_size = sync->replay.window_size;
+	if (sa_data->window_size) {
+		stats->window_size = sa_data->window_size;
+		stats->seq_start = sync->replay.seq_start;
+		stats->seq_cur = sync->replay.seq_cur;
+	}
 }
 
 /*
diff --git a/ipsecmgr/v2.0/nss_ipsecmgr_sa.h b/ipsecmgr/v2.0/nss_ipsecmgr_sa.h
index c3e9e6a..554e72f 100644
--- a/ipsecmgr/v2.0/nss_ipsecmgr_sa.h
+++ b/ipsecmgr/v2.0/nss_ipsecmgr_sa.h
@@ -245,5 +245,5 @@
 /* functions to operate on SA object */
 struct nss_ipsecmgr_sa *nss_ipsecmgr_sa_find(struct list_head *db, struct nss_ipsec_cmn_sa_tuple *tuple);
 void nss_ipsecmgr_sa_sync_state(struct nss_ipsecmgr_sa *sa, struct nss_ipsec_cmn_sa_sync *sync);
-void nss_ipsecmgr_sa_sync2stats(struct nss_ipsec_cmn_sa_sync *sync, struct nss_ipsecmgr_sa_stats *stats);
+void nss_ipsecmgr_sa_sync2stats(struct nss_ipsecmgr_sa *sa, struct nss_ipsec_cmn_sa_sync *sync, struct nss_ipsecmgr_sa_stats *stats);
 #endif