Skip to contentSkip to conversation

replace bzero with memset

PATCH Applied Stephen Hemminger 3 participants 6 messages Dec 2, 2015 – Dec 6, 2015 Network drivers

lore
Share & tools
lore
#0 lore raw

cover replace bzero with memset

The DPDK is mostly consistent about using the POSIX standard memset instead of bzero; but there seem to be some leftover BSD hold outs.

Stephen Hemminger (3):
test-pmd: use memset not bzero
xen-virt: use memset not bzero
qat: use memset instead of bzero

 app/test-pmd/testpmd.c                | 4 ++--
 drivers/net/xenvirt/rte_eth_xenvirt.c | 3 ++-
 examples/dpdk_qat/crypto.c            | 8 ++++----
 3 files changed, 8 insertions(+), 7 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/3 test-pmd: use memset not bzero

The standard for DPDK is to use memset() not bzero which is a leftover BSD-ism.

---
 app/test-pmd/testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test-pmd/testpmd.c +2 -2
index 093952f..98ae46d 100644
@@ -1512,7 +1512,7 @@ attach_port(char *identifier)
 	nb_ports = rte_eth_dev_count();
 
 	/* set_default_fwd_ports_config(); */
-	bzero(fwd_ports_ids, sizeof(fwd_ports_ids));
+	memset(fwd_ports_ids, 0, sizeof(fwd_ports_ids));
 	i = 0;
 	FOREACH_PORT(j, ports) {
 		fwd_ports_ids[i] = j;
@@ -1547,7 +1547,7 @@ detach_port(uint8_t port_id)
 	nb_ports = rte_eth_dev_count();
 
 	/* set_default_fwd_ports_config(); */
-	bzero(fwd_ports_ids, sizeof(fwd_ports_ids));
+	memset(fwd_ports_ids, 0, sizeof(fwd_ports_ids));
 	i = 0;
 	FOREACH_PORT(pi, ports) {
 		fwd_ports_ids[i] = pi;
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/3 xen-virt: use memset not bzero

In reply to Stephen Hemminger
---
 drivers/net/xenvirt/rte_eth_xenvirt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/xenvirt/rte_eth_xenvirt.c +2 -1
index e83c08c..3353bcb 100644
@@ -640,7 +640,8 @@ eth_dev_xenvirt_create(const char *name, const char *params,
 	struct pmd_internals *internals = NULL;
 	struct rte_eth_dev *eth_dev = NULL;
 	struct xenvirt_dict dict;
-	bzero(&dict, sizeof(struct xenvirt_dict));
+
+	memset(&dict, 0, sizeof(struct xenvirt_dict));
 
 	RTE_LOG(INFO, PMD, "Creating virtio rings backed ethdev on numa socket %u\n",
 			numa_node);
Signature · 1 line
2.1.4
#3 lore raw

PATCH 3/3 qat: use memset instead of bzero

In reply to Stephen Hemminger
---
 examples/dpdk_qat/crypto.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
examples/dpdk_qat/crypto.c +4 -4
index c03ea78..8954bf8 100644
@@ -307,7 +307,7 @@ getCoreAffinity(Cpa32U *coreAffinity, const CpaInstanceHandle instanceHandle)
 	Cpa16U i = 0;
 	CpaStatus status = CPA_STATUS_SUCCESS;
 
-	bzero(&info, sizeof(CpaInstanceInfo2));
+	memset(&info, 0, sizeof(CpaInstanceInfo2));
 
 	status = cpaCyInstanceGetInfo2(instanceHandle, &info);
 	if (CPA_STATUS_SUCCESS != status) {
@@ -380,7 +380,7 @@ initCySymSession(const int pkt_cipher_alg,
 	CpaBoolean isCrypto = CPA_TRUE, isHmac = CPA_TRUE;
 	CpaCySymSessionSetupData sessionSetupData;
 
-	bzero(&sessionSetupData, sizeof(CpaCySymSessionSetupData));
+	memset(&sessionSetupData, 0, sizeof(CpaCySymSessionSetupData));
 
 	/* Assumption: key length is set to each algorithm's max length */
 	switch (pkt_cipher_alg) {
@@ -781,7 +781,7 @@ crypto_encrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 
 	lcore_id = rte_lcore_id();
 
-	bzero(opData, sizeof(CpaCySymDpOpData));
+	memset(opData, 0, sizeof(CpaCySymDpOpData));
 
 	opData->srcBuffer = opData->dstBuffer = PACKET_DATA_START_PHYS(rte_buff);
 	opData->srcBufferLen = opData->dstBufferLen = rte_buff->data_len;
@@ -856,7 +856,7 @@ crypto_decrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 
 	lcore_id = rte_lcore_id();
 
-	bzero(opData, sizeof(CpaCySymDpOpData));
+	memset(opData, 0, sizeof(CpaCySymDpOpData));
 
 	opData->dstBuffer = opData->srcBuffer = PACKET_DATA_START_PHYS(rte_buff);
 	opData->dstBufferLen = opData->srcBufferLen = rte_buff->data_len;
Signature · 1 line
2.1.4
#4 lore raw
In reply to Stephen Hemminger
Quoted 18 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Stephen Hemminger
Sent: Wednesday, December 02, 2015 3:24 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH 0/3] replace bzero with memset

The DPDK is mostly consistent about using the POSIX standard memset instead of bzero; but there seem to be some leftover BSD hold outs.

Stephen Hemminger (3):
test-pmd: use memset not bzero
xen-virt: use memset not bzero
qat: use memset instead of bzero

Quoted 7 lines
 app/test-pmd/testpmd.c                | 4 ++--
 drivers/net/xenvirt/rte_eth_xenvirt.c | 3 ++-
 examples/dpdk_qat/crypto.c            | 8 ++++----
 3 files changed, 8 insertions(+), 7 deletions(-)

--
2.1.4

#5 lore raw
Quoted 10 lines
Quoted 8 lines

The DPDK is mostly consistent about using the POSIX standard memset instead of bzero; but there seem to be some leftover BSD hold outs.

Stephen Hemminger (3):
test-pmd: use memset not bzero
xen-virt: use memset not bzero
qat: use memset instead of bzero

Applied, thanks