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	[thread overview]
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?

Thanks


                 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* 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 \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).