DPDK usage discussions
 help / color / mirror / Atom feed
From: Ahmet Genç <ahmet.genc@ulakhaberlesme.com.tr>
To: "users@dpdk.org" <users@dpdk.org>
Cc: Mehmet Hakan Doğan <hakan.dogan@ulakhaberlesme.com.tr>,
	 Volkan Atlı <volkan.atli@b-ulltech.com>
Subject: [dpdk-users] How to send an mbuf packet created on secondary process without memory corruption
Date: Tue, 4 Aug 2020 09:14:24 +0000
Message-ID: <DB8P189MB07327844C2302969C096DAD2D44A0@DB8P189MB0732.EURP189.PROD.OUTLOOK.COM> (raw)

Hello everyone,

We are trying to run a multiprocess application over DPDK, but we are getting a memory corruption error.

On secondary DPDK application, we allocate an mbuf packet as below;


struct rte_mbuf *created_pkt = rte_pktmbuf_alloc(mbuf_pool);
// error check

pkt_size = sizeof(struct rte_ether_hdr) + sizeof(struct rte_arp_hdr);
created_pkt->data_len = pkt_size;
created_pkt->pkt_len = pkt_size;

eth_hdr = rte_pktmbuf_mtod(created_pkt, struct rte_ether_hdr *);
rte_ether_addr_copy(&bond_mac_addr, &eth_hdr->s_addr);
memset(&eth_hdr->d_addr, 0xFF, RTE_ETHER_ADDR_LEN);
eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP);

arp_hdr = (struct rte_arp_hdr *)(
   (char *)eth_hdr + sizeof(struct rte_ether_hdr));
arp_hdr->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER);
arp_hdr->arp_protocol = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
arp_hdr->arp_hlen = RTE_ETHER_ADDR_LEN;
arp_hdr->arp_plen = sizeof(uint32_t);
arp_hdr->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REQUEST);

rte_ether_addr_copy(&bond_mac_addr, &arp_hdr->arp_data.arp_sha);
arp_hdr->arp_data.arp_sip = bond_ip;
memset(&arp_hdr->arp_data.arp_tha, 0, RTE_ETHER_ADDR_LEN);
arp_hdr->arp_data.arp_tip =
        ((unsigned char *)&res->ip.addr.ipv4)[0]        |
       (((unsigned char *)&res->ip.addr.ipv4)[1] << 8)  |
       (((unsigned char *)&res->ip.addr.ipv4)[2] << 16) |
       (((unsigned char *)&res->ip.addr.ipv4)[3] << 24);

rte_ring_enqueue_burst(ring, (void **)&created_pkt, 1, NULL);

The packet (created_pkt) is created and allocated successfully (packet_len is not null and we don't see error line.). After that, we send out this packet to the primary application over the ring. On the primary application, we send the packet to a physical port using rte_eth_tx_burst.
However, we think that whenever the ring size reaches full (RING_SIZE 256) secondary application tries to release the memory and we get memory corruption error.

We think we are missing a point about the virtual and physical memory addresses between processes (setting mbuf->buf_addr or mbuf->buf_iova addresses or something like that). Could anyone help us to resolve this issue?


                 reply	other threads:[~2020-08-04  9:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DB8P189MB07327844C2302969C096DAD2D44A0@DB8P189MB0732.EURP189.PROD.OUTLOOK.COM \
    --to=ahmet.genc@ulakhaberlesme.com.tr \
    --cc=hakan.dogan@ulakhaberlesme.com.tr \
    --cc=users@dpdk.org \
    --cc=volkan.atli@b-ulltech.com \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK usage discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/users/0 users/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 users users/ https://inbox.dpdk.org/users \
	public-inbox-index users

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git