K.Xu
K.Xu

Reputation: 49

DPDK send customized pkt but fail to receive

I'm trying to send customized packages with dpdk, but i find that some package structure will make it fail to receive. For example, i define the package structure like this:

union my_pkt{
   struct hdr{
       uint32_t id;
       uint32_t name_len;
       uint64_t tsc;
       uint8_t name[100];
   }__attribute__((__packed__)) pkt_hdr;
   char buff[500];
};

My server running dpdk can only receive 1st batch of pkts, but the returned value of rte_eth_tx_burst() shows much more packages which have been sent.
However , if i modify the structure as below:

union my_pkt{
   struct hdr{
       uint32_t id;
       uint32_t name_len;
       uint32_t tsc[2];//modify this line
       uint8_t name[100];
   }__attribute__((__packed__)) pkt_hdr;
   char buff[500];
};

Sending and receiving both work correctly. The only difference between two structures is that the uint64_t timestamp were replace by an uint32_t array consisting of 2 items. I debug into the i40e driver code but can not understand where it goes wrong.

Can anybody help me? thanks!

Upvotes: 1

Views: 976

Answers (1)

Andriy Berestovskyy
Andriy Berestovskyy

Reputation: 8544

While it is not clear from your description, you probably should add an Ethernet header at the beginning of you buffer, i.e.:

union my_pkt{
   struct hdr{
       struct ether_hdr; // Ethernet header
       uint32_t id;
       uint32_t name_len;
       uint64_t tsc;
       uint8_t name[100];
   }__attribute__((__packed__)) pkt_hdr;
   char buff[500];
};

And then fill it with destination/source MACs and type in your code.

Upvotes: 0

Related Questions