[qca-nss-sfe] Initialize the original and reply direction connection match objects using kzalloc.
Change-Id: I5f877d380d4f442f2ab6f1fba8eb19c5dcef91e2
Signed-off-by: Parikshit Gune <quic_pgune@quicinc.com>
diff --git a/sfe_ipv6.c b/sfe_ipv6.c
index 73d8181..5776fe2 100644
--- a/sfe_ipv6.c
+++ b/sfe_ipv6.c
@@ -1162,7 +1162,7 @@
/*
* Allocate the various connection tracking objects.
*/
- c = (struct sfe_ipv6_connection *)kmalloc(sizeof(struct sfe_ipv6_connection), GFP_ATOMIC);
+ c = (struct sfe_ipv6_connection *)kzalloc(sizeof(struct sfe_ipv6_connection), GFP_ATOMIC);
if (unlikely(!c)) {
DEBUG_WARN("%px: memory allocation of connection entry failed\n", msg);
this_cpu_inc(si->stats_pcpu->connection_create_failures64);
@@ -1171,7 +1171,7 @@
return -ENOMEM;
}
- original_cm = (struct sfe_ipv6_connection_match *)kmalloc(sizeof(struct sfe_ipv6_connection_match), GFP_ATOMIC);
+ original_cm = (struct sfe_ipv6_connection_match *)kzalloc(sizeof(struct sfe_ipv6_connection_match), GFP_ATOMIC);
if (unlikely(!original_cm)) {
this_cpu_inc(si->stats_pcpu->connection_create_failures64);
DEBUG_WARN("%px: memory allocation of connection match entry failed\n", msg);
@@ -1181,7 +1181,7 @@
return -ENOMEM;
}
- reply_cm = (struct sfe_ipv6_connection_match *)kmalloc(sizeof(struct sfe_ipv6_connection_match), GFP_ATOMIC);
+ reply_cm = (struct sfe_ipv6_connection_match *)kzalloc(sizeof(struct sfe_ipv6_connection_match), GFP_ATOMIC);
if (unlikely(!reply_cm)) {
this_cpu_inc(si->stats_pcpu->connection_create_failures64);
DEBUG_WARN("%px: memory allocation of connection match entry failed\n", msg);
@@ -1250,18 +1250,12 @@
original_cm->xlate_dest_ip[0] = *(struct sfe_ipv6_addr *)tuple->return_ip;
original_cm->xlate_dest_port = tuple->return_ident;
- atomic_set(&original_cm->rx_packet_count, 0);
- original_cm->rx_packet_count64 = 0;
- atomic_set(&original_cm->rx_byte_count, 0);
- original_cm->rx_byte_count64 = 0;
original_cm->xmit_dev = dest_dev;
original_cm->xmit_dev_mtu = msg->conn_rule.return_mtu;
original_cm->connection = c;
original_cm->counter_match = reply_cm;
- original_cm->l2_hdr_size = 0;
- original_cm->flags = 0;
/*
* Valid in decap direction only
@@ -1350,9 +1344,6 @@
}
}
- reply_cm->l2_hdr_size = 0;
- reply_cm->flags = 0;
-
/*
* Adding PPPoE parameters to original and reply entries based on the direction where
* PPPoE header is valid in ECM rule.
@@ -1449,10 +1440,6 @@
reply_cm->match_src_port = tuple->return_ident;
}
- atomic_set(&original_cm->rx_byte_count, 0);
- reply_cm->rx_packet_count64 = 0;
- atomic_set(&reply_cm->rx_byte_count, 0);
- reply_cm->rx_byte_count64 = 0;
reply_cm->xmit_dev = src_dev;
reply_cm->xmit_dev_mtu = msg->conn_rule.flow_mtu;